summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
Diffstat (limited to 'xmloff')
-rwxr-xr-xxmloff/JunitTest_xmloff_unoapi.mk49
-rw-r--r--xmloff/Library_xo.mk382
-rw-r--r--xmloff/Library_xof.mk91
-rwxr-xr-xxmloff/Makefile38
-rwxr-xr-xxmloff/Module_xmloff.mk44
-rwxr-xr-xxmloff/Package_dtd.mk45
-rwxr-xr-xxmloff/Package_inc.mk131
-rwxr-xr-xxmloff/dtd/Blocklist.dtd34
-rwxr-xr-xxmloff/dtd/chart.mod262
-rwxr-xr-xxmloff/dtd/datastyl.mod208
-rwxr-xr-xxmloff/dtd/defs.mod56
-rwxr-xr-xxmloff/dtd/drawing.mod861
-rwxr-xr-xxmloff/dtd/dtypes.mod143
-rwxr-xr-xxmloff/dtd/form.mod366
-rwxr-xr-xxmloff/dtd/meta.mod90
-rwxr-xr-xxmloff/dtd/nmspace.mod53
-rwxr-xr-xxmloff/dtd/office.dtd56
-rwxr-xr-xxmloff/dtd/office.mod245
-rwxr-xr-xxmloff/dtd/openoffice-2.0-schema.rng92
-rwxr-xr-xxmloff/dtd/script.mod59
-rwxr-xr-xxmloff/dtd/settings.mod49
-rwxr-xr-xxmloff/dtd/style.mod427
-rwxr-xr-xxmloff/dtd/table.mod496
-rwxr-xr-xxmloff/dtd/text.mod1099
-rw-r--r--xmloff/inc/AttributeContainerHandler.hxx50
-rw-r--r--xmloff/inc/DomBuilderContext.hxx112
-rw-r--r--xmloff/inc/DomExport.hxx46
-rw-r--r--xmloff/inc/EnhancedCustomShapeToken.hxx169
-rw-r--r--xmloff/inc/MetaExportComponent.hxx85
-rw-r--r--xmloff/inc/MetaImportComponent.hxx85
-rw-r--r--xmloff/inc/MultiPropertySetHelper.hxx207
-rw-r--r--xmloff/inc/PageMasterImportContext.hxx70
-rw-r--r--xmloff/inc/PropertySetMerger.hxx41
-rw-r--r--xmloff/inc/RDFaExportHelper.hxx80
-rw-r--r--xmloff/inc/RDFaImportHelper.hxx106
-rw-r--r--xmloff/inc/SchXMLExport.hxx93
-rw-r--r--xmloff/inc/SchXMLImport.hxx201
-rw-r--r--xmloff/inc/StyleMap.hxx97
-rw-r--r--xmloff/inc/TransGradientStyle.hxx73
-rw-r--r--xmloff/inc/XMLBackgroundImageContext.hxx85
-rw-r--r--xmloff/inc/XMLBackgroundImageExport.hxx65
-rw-r--r--xmloff/inc/XMLBase64Export.hxx63
-rw-r--r--xmloff/inc/XMLBasicExportFilter.hxx75
-rw-r--r--xmloff/inc/XMLBitmapLogicalSizePropertyHandler.hxx65
-rw-r--r--xmloff/inc/XMLBitmapRepeatOffsetPropertyHandler.hxx68
-rw-r--r--xmloff/inc/XMLChartPropertySetMapper.hxx130
-rw-r--r--xmloff/inc/XMLChartStyleContext.hxx70
-rw-r--r--xmloff/inc/XMLClipPropertyHandler.hxx51
-rw-r--r--xmloff/inc/XMLElementPropertyContext.hxx70
-rw-r--r--xmloff/inc/XMLEmbeddedObjectImportContext.hxx81
-rw-r--r--xmloff/inc/XMLEventImportHelper.hxx109
-rw-r--r--xmloff/inc/XMLFillBitmapSizePropertyHandler.hxx65
-rw-r--r--xmloff/inc/XMLFootnoteConfigurationImportContext.hxx124
-rw-r--r--xmloff/inc/XMLImageMapContext.hxx79
-rw-r--r--xmloff/inc/XMLImageMapExport.hxx122
-rw-r--r--xmloff/inc/XMLIndexBibliographyConfigurationContext.hxx110
-rw-r--r--xmloff/inc/XMLIsPercentagePropertyHandler.hxx55
-rw-r--r--xmloff/inc/XMLLineNumberingImportContext.hxx129
-rw-r--r--xmloff/inc/XMLNumberStylesImport.hxx81
-rw-r--r--xmloff/inc/XMLPercentOrMeasurePropertyHandler.hxx57
-rw-r--r--xmloff/inc/XMLRectangleMembersHandler.hxx67
-rw-r--r--xmloff/inc/XMLReplacementImageContext.hxx74
-rw-r--r--xmloff/inc/XMLScriptContextFactory.hxx70
-rw-r--r--xmloff/inc/XMLScriptExportHandler.hxx62
-rw-r--r--xmloff/inc/XMLShapePropertySetContext.hxx65
-rw-r--r--xmloff/inc/XMLStarBasicContextFactory.hxx71
-rw-r--r--xmloff/inc/XMLStarBasicExportHandler.hxx66
-rw-r--r--xmloff/inc/XMLStringBufferImportContext.hxx72
-rw-r--r--xmloff/inc/XMLTextColumnsContext.hxx83
-rw-r--r--xmloff/inc/XMLTextColumnsExport.hxx62
-rw-r--r--xmloff/inc/XMLTextColumnsPropertyHandler.hxx59
-rw-r--r--xmloff/inc/XMLTextHeaderFooterContext.hxx78
-rw-r--r--xmloff/inc/anim.hxx106
-rw-r--r--xmloff/inc/animationexport.hxx58
-rw-r--r--xmloff/inc/animationimport.hxx74
-rw-r--r--xmloff/inc/animations.hxx69
-rw-r--r--xmloff/inc/animimp.hxx59
-rw-r--r--xmloff/inc/forms/form_handler_factory.hxx50
-rw-r--r--xmloff/inc/forms/property_handler.hxx84
-rw-r--r--xmloff/inc/forms/property_ids.hxx56
-rw-r--r--xmloff/inc/functional.hxx30
-rw-r--r--xmloff/inc/pch/precompiled_xmloff.cxx31
-rw-r--r--xmloff/inc/pch/precompiled_xmloff.hxx482
-rw-r--r--xmloff/inc/txtflde.hxx549
-rw-r--r--xmloff/inc/txtfldi.hxx1596
-rw-r--r--xmloff/inc/txtlists.hxx191
-rw-r--r--xmloff/inc/txtvfldi.hxx621
-rw-r--r--xmloff/inc/unointerfacetouniqueidentifiermapper.hxx55
-rw-r--r--xmloff/inc/xexptran.hxx204
-rw-r--r--xmloff/inc/xmlehelp.hxx53
-rw-r--r--xmloff/inc/xmloff/DashStyle.hxx76
-rw-r--r--xmloff/inc/xmloff/DocumentSettingsContext.hxx66
-rw-r--r--xmloff/inc/xmloff/EnumPropertyHdl.hxx55
-rw-r--r--xmloff/inc/xmloff/GradientStyle.hxx77
-rw-r--r--xmloff/inc/xmloff/HatchStyle.hxx74
-rw-r--r--xmloff/inc/xmloff/ImageStyle.hxx63
-rw-r--r--xmloff/inc/xmloff/MarkerStyle.hxx76
-rw-r--r--xmloff/inc/xmloff/NamedBoolPropertyHdl.hxx65
-rw-r--r--xmloff/inc/xmloff/PageMasterStyleMap.hxx159
-rw-r--r--xmloff/inc/xmloff/ProgressBarHelper.hxx80
-rw-r--r--xmloff/inc/xmloff/PropertySetInfoHash.hxx68
-rw-r--r--xmloff/inc/xmloff/PropertySetInfoKey.hxx70
-rw-r--r--xmloff/inc/xmloff/SchXMLExportHelper.hxx76
-rw-r--r--xmloff/inc/xmloff/SchXMLImportHelper.hxx166
-rw-r--r--xmloff/inc/xmloff/SettingsExportHelper.hxx113
-rw-r--r--xmloff/inc/xmloff/SinglePropertySetInfoCache.hxx82
-rw-r--r--xmloff/inc/xmloff/VisAreaContext.hxx72
-rw-r--r--xmloff/inc/xmloff/VisAreaExport.hxx57
-rw-r--r--xmloff/inc/xmloff/WordWrapPropertyHdl.hxx56
-rw-r--r--xmloff/inc/xmloff/XMLBase64ImportContext.hxx66
-rw-r--r--xmloff/inc/xmloff/XMLCharContext.hxx74
-rw-r--r--xmloff/inc/xmloff/XMLConstantsPropertyHandler.hxx72
-rw-r--r--xmloff/inc/xmloff/XMLEmbeddedObjectExportFilter.hxx95
-rw-r--r--xmloff/inc/xmloff/XMLEventExport.hxx142
-rw-r--r--xmloff/inc/xmloff/XMLEventsImportContext.hxx141
-rwxr-xr-xxmloff/inc/xmloff/XMLFilterServiceNames.h49
-rw-r--r--xmloff/inc/xmloff/XMLFontAutoStylePool.hxx78
-rw-r--r--xmloff/inc/xmloff/XMLFontStylesContext.hxx98
-rw-r--r--xmloff/inc/xmloff/XMLGraphicsDefaultStyle.hxx65
-rw-r--r--xmloff/inc/xmloff/XMLPageExport.hxx114
-rw-r--r--xmloff/inc/xmloff/XMLSettingsExportContext.hxx69
-rw-r--r--xmloff/inc/xmloff/XMLShapeStyleContext.hxx79
-rw-r--r--xmloff/inc/xmloff/XMLStringVector.hxx41
-rw-r--r--xmloff/inc/xmloff/XMLTextListAutoStylePool.hxx87
-rw-r--r--xmloff/inc/xmloff/XMLTextMasterPageContext.hxx93
-rw-r--r--xmloff/inc/xmloff/XMLTextMasterPageExport.hxx73
-rw-r--r--xmloff/inc/xmloff/XMLTextMasterStylesContext.hxx64
-rw-r--r--xmloff/inc/xmloff/XMLTextShapeImportHelper.hxx60
-rw-r--r--xmloff/inc/xmloff/XMLTextShapeStyleContext.hxx75
-rw-r--r--xmloff/inc/xmloff/XMLTextTableContext.hxx62
-rw-r--r--xmloff/inc/xmloff/animexp.hxx54
-rw-r--r--xmloff/inc/xmloff/attrlist.hxx96
-rw-r--r--xmloff/inc/xmloff/contextid.hxx57
-rw-r--r--xmloff/inc/xmloff/controlpropertyhdl.hxx145
-rwxr-xr-xxmloff/inc/xmloff/dllapi.h43
-rw-r--r--xmloff/inc/xmloff/families.hxx119
-rw-r--r--xmloff/inc/xmloff/formlayerexport.hxx211
-rw-r--r--xmloff/inc/xmloff/formlayerimport.hxx168
-rw-r--r--xmloff/inc/xmloff/formsimp.hxx51
-rw-r--r--xmloff/inc/xmloff/functional.hxx56
-rw-r--r--xmloff/inc/xmloff/i18nmap.hxx71
-rw-r--r--xmloff/inc/xmloff/maptype.hxx77
-rw-r--r--xmloff/inc/xmloff/nmspmap.hxx186
-rw-r--r--xmloff/inc/xmloff/numehelp.hxx129
-rw-r--r--xmloff/inc/xmloff/odffields.hxx61
-rw-r--r--xmloff/inc/xmloff/prhdlfac.hxx112
-rw-r--r--xmloff/inc/xmloff/prstylei.hxx108
-rw-r--r--xmloff/inc/xmloff/shapeexport.hxx340
-rw-r--r--xmloff/inc/xmloff/shapeimport.hxx443
-rw-r--r--xmloff/inc/xmloff/styleexp.hxx136
-rw-r--r--xmloff/inc/xmloff/table/XMLTableExport.hxx115
-rw-r--r--xmloff/inc/xmloff/table/XMLTableImport.hxx81
-rw-r--r--xmloff/inc/xmloff/txtimp.hxx743
-rw-r--r--xmloff/inc/xmloff/txtimppr.hxx84
-rw-r--r--xmloff/inc/xmloff/txtparae.hxx735
-rw-r--r--xmloff/inc/xmloff/txtprmap.hxx206
-rw-r--r--xmloff/inc/xmloff/txtstyle.hxx63
-rw-r--r--xmloff/inc/xmloff/txtstyli.hxx121
-rw-r--r--xmloff/inc/xmloff/uniref.hxx232
-rw-r--r--xmloff/inc/xmloff/unoatrcn.hxx89
-rw-r--r--xmloff/inc/xmloff/xformsexport.hxx63
-rw-r--r--xmloff/inc/xmloff/xformsimport.hxx93
-rw-r--r--xmloff/inc/xmloff/xmlaustp.hxx140
-rw-r--r--xmloff/inc/xmloff/xmlcnimp.hxx131
-rw-r--r--xmloff/inc/xmloff/xmlcnitm.hxx92
-rw-r--r--xmloff/inc/xmloff/xmlement.hxx60
-rw-r--r--xmloff/inc/xmloff/xmlerror.hxx169
-rw-r--r--xmloff/inc/xmloff/xmlevent.hxx155
-rw-r--r--xmloff/inc/xmloff/xmlexp.hxx725
-rw-r--r--xmloff/inc/xmloff/xmlexppr.hxx207
-rw-r--r--xmloff/inc/xmloff/xmlictxt.hxx110
-rw-r--r--xmloff/inc/xmloff/xmlimp.hxx536
-rw-r--r--xmloff/inc/xmloff/xmlimppr.hxx210
-rw-r--r--xmloff/inc/xmloff/xmlkywd.hxx1998
-rw-r--r--xmloff/inc/xmloff/xmlmetae.hxx129
-rw-r--r--xmloff/inc/xmloff/xmlmetai.hxx86
-rw-r--r--xmloff/inc/xmloff/xmlnmspe.hxx114
-rw-r--r--xmloff/inc/xmloff/xmlnume.hxx110
-rw-r--r--xmloff/inc/xmloff/xmlnumfe.hxx142
-rw-r--r--xmloff/inc/xmloff/xmlnumfi.hxx226
-rw-r--r--xmloff/inc/xmloff/xmlnumi.hxx113
-rw-r--r--xmloff/inc/xmloff/xmlprcon.hxx80
-rw-r--r--xmloff/inc/xmloff/xmlprhdl.hxx67
-rw-r--r--xmloff/inc/xmloff/xmlprmap.hxx190
-rw-r--r--xmloff/inc/xmloff/xmlreg.hxx45
-rw-r--r--xmloff/inc/xmloff/xmlscripti.hxx63
-rw-r--r--xmloff/inc/xmloff/xmlstyle.hxx271
-rw-r--r--xmloff/inc/xmloff/xmltabe.hxx62
-rw-r--r--xmloff/inc/xmloff/xmltkmap.hxx69
-rw-r--r--xmloff/inc/xmloff/xmltoken.hxx3165
-rw-r--r--xmloff/inc/xmloff/xmltypes.hxx289
-rw-r--r--xmloff/inc/xmloff/xmluconv.hxx448
-rw-r--r--xmloff/inc/xmltabi.hxx67
-rw-r--r--xmloff/inc/xmlversion.hxx158
-rw-r--r--xmloff/prj/build.lst2
-rw-r--r--xmloff/prj/d.lst0
-rwxr-xr-xxmloff/prj/makefile.mk40
-rwxr-xr-xxmloff/qa/unoapi/knownissues.xcl25
-rwxr-xr-xxmloff/qa/unoapi/testdocuments/emptyChart.sdsbin0 -> 44544 bytes
-rwxr-xr-xxmloff/qa/unoapi/xmloff.sce26
-rw-r--r--xmloff/source/chart/ColorPropertySet.cxx228
-rw-r--r--xmloff/source/chart/ColorPropertySet.hxx129
-rw-r--r--xmloff/source/chart/MultiPropertySetHandler.hxx288
-rw-r--r--xmloff/source/chart/PropertyMap.hxx328
-rw-r--r--xmloff/source/chart/PropertyMaps.cxx620
-rw-r--r--xmloff/source/chart/SchXMLAutoStylePoolP.cxx94
-rw-r--r--xmloff/source/chart/SchXMLAutoStylePoolP.hxx56
-rw-r--r--xmloff/source/chart/SchXMLAxisContext.cxx1053
-rw-r--r--xmloff/source/chart/SchXMLAxisContext.hxx83
-rw-r--r--xmloff/source/chart/SchXMLCalculationSettingsContext.cxx89
-rw-r--r--xmloff/source/chart/SchXMLCalculationSettingsContext.hxx54
-rw-r--r--xmloff/source/chart/SchXMLChartContext.cxx1248
-rw-r--r--xmloff/source/chart/SchXMLChartContext.hxx177
-rw-r--r--xmloff/source/chart/SchXMLEnumConverter.cxx104
-rw-r--r--xmloff/source/chart/SchXMLEnumConverter.hxx39
-rw-r--r--xmloff/source/chart/SchXMLExport.cxx4021
-rw-r--r--xmloff/source/chart/SchXMLImport.cxx895
-rw-r--r--xmloff/source/chart/SchXMLLegendContext.cxx229
-rw-r--r--xmloff/source/chart/SchXMLLegendContext.hxx49
-rw-r--r--xmloff/source/chart/SchXMLParagraphContext.cxx121
-rw-r--r--xmloff/source/chart/SchXMLParagraphContext.hxx67
-rw-r--r--xmloff/source/chart/SchXMLPlotAreaContext.cxx1181
-rw-r--r--xmloff/source/chart/SchXMLPlotAreaContext.hxx333
-rw-r--r--xmloff/source/chart/SchXMLSeries2Context.cxx1079
-rw-r--r--xmloff/source/chart/SchXMLSeries2Context.hxx138
-rw-r--r--xmloff/source/chart/SchXMLSeriesHelper.cxx303
-rw-r--r--xmloff/source/chart/SchXMLSeriesHelper.hxx83
-rw-r--r--xmloff/source/chart/SchXMLTableContext.cxx1253
-rw-r--r--xmloff/source/chart/SchXMLTableContext.hxx231
-rw-r--r--xmloff/source/chart/SchXMLTextListContext.cxx139
-rw-r--r--xmloff/source/chart/SchXMLTextListContext.hxx61
-rw-r--r--xmloff/source/chart/SchXMLTools.cxx896
-rw-r--r--xmloff/source/chart/SchXMLTools.hxx155
-rw-r--r--xmloff/source/chart/XMLAxisPositionPropertyHdl.cxx131
-rw-r--r--xmloff/source/chart/XMLAxisPositionPropertyHdl.hxx48
-rw-r--r--xmloff/source/chart/XMLChartPropertyContext.cxx85
-rw-r--r--xmloff/source/chart/XMLChartPropertyContext.hxx61
-rw-r--r--xmloff/source/chart/XMLChartStyleContext.cxx164
-rw-r--r--xmloff/source/chart/XMLErrorBarStylePropertyHdl.cxx71
-rw-r--r--xmloff/source/chart/XMLErrorBarStylePropertyHdl.hxx44
-rw-r--r--xmloff/source/chart/XMLErrorIndicatorPropertyHdl.cxx108
-rw-r--r--xmloff/source/chart/XMLErrorIndicatorPropertyHdl.hxx49
-rw-r--r--xmloff/source/chart/XMLLabelSeparatorContext.cxx90
-rw-r--r--xmloff/source/chart/XMLLabelSeparatorContext.hxx57
-rw-r--r--xmloff/source/chart/XMLSymbolImageContext.cxx153
-rw-r--r--xmloff/source/chart/XMLSymbolImageContext.hxx62
-rw-r--r--xmloff/source/chart/XMLSymbolTypePropertyHdl.cxx173
-rw-r--r--xmloff/source/chart/XMLSymbolTypePropertyHdl.hxx49
-rw-r--r--xmloff/source/chart/XMLTextOrientationHdl.cxx83
-rw-r--r--xmloff/source/chart/XMLTextOrientationHdl.hxx49
-rw-r--r--xmloff/source/chart/contexts.cxx235
-rw-r--r--xmloff/source/chart/contexts.hxx118
-rwxr-xr-xxmloff/source/chart/makefile.mk73
-rw-r--r--xmloff/source/chart/transporttypes.cxx41
-rw-r--r--xmloff/source/chart/transporttypes.hxx228
-rw-r--r--xmloff/source/core/DocumentSettingsContext.cxx1018
-rw-r--r--xmloff/source/core/DomBuilderContext.cxx267
-rw-r--r--xmloff/source/core/DomExport.cxx308
-rw-r--r--xmloff/source/core/ProgressBarHelper.cxx133
-rw-r--r--xmloff/source/core/PropertySetMerger.cxx268
-rw-r--r--xmloff/source/core/RDFaExportHelper.cxx233
-rw-r--r--xmloff/source/core/RDFaImportHelper.cxx501
-rw-r--r--xmloff/source/core/SettingsExportHelper.cxx570
-rw-r--r--xmloff/source/core/XMLBase64Export.cxx97
-rw-r--r--xmloff/source/core/XMLBase64ImportContext.cxx94
-rw-r--r--xmloff/source/core/XMLBasicExportFilter.cxx128
-rw-r--r--xmloff/source/core/XMLEmbeddedObjectExportFilter.cxx185
-rw-r--r--xmloff/source/core/XMLEmbeddedObjectImportContext.cxx347
-rw-r--r--xmloff/source/core/attrlist.cxx303
-rw-r--r--xmloff/source/core/facreg.cxx286
-rw-r--r--xmloff/source/core/i18nmap.cxx128
-rw-r--r--xmloff/source/core/nmspmap.cxx594
-rw-r--r--xmloff/source/core/unoatrcn.cxx317
-rw-r--r--xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx173
-rw-r--r--xmloff/source/core/xmlcnitm.cxx221
-rw-r--r--xmloff/source/core/xmlehelp.cxx501
-rw-r--r--xmloff/source/core/xmlenums.hxx58
-rw-r--r--xmloff/source/core/xmlerror.cxx260
-rw-r--r--xmloff/source/core/xmlexp.cxx2687
-rw-r--r--xmloff/source/core/xmlictxt.cxx86
-rw-r--r--xmloff/source/core/xmlimp.cxx1998
-rw-r--r--xmloff/source/core/xmltkmap.cxx125
-rw-r--r--xmloff/source/core/xmltoken.cxx3219
-rw-r--r--xmloff/source/core/xmluconv.cxx2262
-rw-r--r--xmloff/source/draw/EnhancedCustomShapeToken.cxx231
-rw-r--r--xmloff/source/draw/XMLGraphicsDefaultStyle.cxx129
-rw-r--r--xmloff/source/draw/XMLImageMapContext.cxx721
-rw-r--r--xmloff/source/draw/XMLImageMapExport.cxx387
-rw-r--r--xmloff/source/draw/XMLNumberStyles.cxx743
-rw-r--r--xmloff/source/draw/XMLNumberStylesExport.hxx55
-rw-r--r--xmloff/source/draw/XMLReplacementImageContext.cxx138
-rw-r--r--xmloff/source/draw/XMLShapePropertySetContext.cxx117
-rw-r--r--xmloff/source/draw/XMLShapeStyleContext.cxx328
-rw-r--r--xmloff/source/draw/animationexport.cxx1739
-rw-r--r--xmloff/source/draw/animationimport.cxx1493
-rw-r--r--xmloff/source/draw/animexp.cxx556
-rw-r--r--xmloff/source/draw/animimp.cxx697
-rw-r--r--xmloff/source/draw/descriptionimp.cxx95
-rw-r--r--xmloff/source/draw/descriptionimp.hxx62
-rw-r--r--xmloff/source/draw/eventimp.cxx528
-rw-r--r--xmloff/source/draw/eventimp.hxx59
-rw-r--r--xmloff/source/draw/layerexp.cxx112
-rw-r--r--xmloff/source/draw/layerexp.hxx42
-rw-r--r--xmloff/source/draw/layerimp.cxx183
-rw-r--r--xmloff/source/draw/layerimp.hxx60
-rw-r--r--xmloff/source/draw/numithdl.cxx65
-rw-r--r--xmloff/source/draw/numithdl.hxx55
-rw-r--r--xmloff/source/draw/propimp0.cxx275
-rw-r--r--xmloff/source/draw/propimp0.hxx81
-rw-r--r--xmloff/source/draw/sdpropls.cxx1759
-rw-r--r--xmloff/source/draw/sdpropls.hxx337
-rw-r--r--xmloff/source/draw/sdxmlexp.cxx2961
-rw-r--r--xmloff/source/draw/sdxmlexp_impl.hxx233
-rw-r--r--xmloff/source/draw/sdxmlimp.cxx1091
-rw-r--r--xmloff/source/draw/sdxmlimp_impl.hxx340
-rw-r--r--xmloff/source/draw/shapeexport.cxx1286
-rw-r--r--xmloff/source/draw/shapeexport2.cxx2009
-rw-r--r--xmloff/source/draw/shapeexport3.cxx499
-rw-r--r--xmloff/source/draw/shapeexport4.cxx1243
-rw-r--r--xmloff/source/draw/shapeimport.cxx1272
-rw-r--r--xmloff/source/draw/viewcontext.cxx95
-rw-r--r--xmloff/source/draw/viewcontext.hxx57
-rw-r--r--xmloff/source/draw/xexptran.cxx3116
-rw-r--r--xmloff/source/draw/ximp3dobject.cxx556
-rw-r--r--xmloff/source/draw/ximp3dobject.hxx178
-rw-r--r--xmloff/source/draw/ximp3dscene.cxx501
-rw-r--r--xmloff/source/draw/ximp3dscene.hxx84
-rw-r--r--xmloff/source/draw/ximpbody.cxx391
-rw-r--r--xmloff/source/draw/ximpbody.hxx82
-rw-r--r--xmloff/source/draw/ximpcustomshape.cxx1399
-rw-r--r--xmloff/source/draw/ximpcustomshape.hxx80
-rw-r--r--xmloff/source/draw/ximpgrp.cxx132
-rw-r--r--xmloff/source/draw/ximpgrp.hxx75
-rw-r--r--xmloff/source/draw/ximplink.cxx104
-rw-r--r--xmloff/source/draw/ximplink.hxx69
-rw-r--r--xmloff/source/draw/ximpnote.cxx145
-rw-r--r--xmloff/source/draw/ximpnote.hxx61
-rw-r--r--xmloff/source/draw/ximppage.cxx650
-rw-r--r--xmloff/source/draw/ximppage.hxx99
-rw-r--r--xmloff/source/draw/ximpshap.cxx3777
-rw-r--r--xmloff/source/draw/ximpshap.hxx667
-rw-r--r--xmloff/source/draw/ximpshow.cxx284
-rw-r--r--xmloff/source/draw/ximpshow.hxx59
-rw-r--r--xmloff/source/draw/ximpstyl.cxx1660
-rw-r--r--xmloff/source/draw/ximpstyl.hxx306
-rw-r--r--xmloff/source/forms/attriblistmerge.cxx172
-rw-r--r--xmloff/source/forms/attriblistmerge.hxx87
-rw-r--r--xmloff/source/forms/callbacks.hxx97
-rw-r--r--xmloff/source/forms/controlelement.cxx74
-rw-r--r--xmloff/source/forms/controlelement.hxx97
-rw-r--r--xmloff/source/forms/controlpropertyhdl.cxx392
-rw-r--r--xmloff/source/forms/controlpropertymap.cxx156
-rw-r--r--xmloff/source/forms/controlpropertymap.hxx70
-rw-r--r--xmloff/source/forms/elementexport.cxx2298
-rw-r--r--xmloff/source/forms/elementexport.hxx331
-rw-r--r--xmloff/source/forms/elementimport.cxx2232
-rw-r--r--xmloff/source/forms/elementimport.hxx775
-rw-r--r--xmloff/source/forms/elementimport_impl.hxx125
-rw-r--r--xmloff/source/forms/eventexport.cxx162
-rw-r--r--xmloff/source/forms/eventexport.hxx88
-rw-r--r--xmloff/source/forms/eventimport.cxx165
-rw-r--r--xmloff/source/forms/eventimport.hxx97
-rw-r--r--xmloff/source/forms/formattributes.cxx347
-rw-r--r--xmloff/source/forms/formattributes.hxx366
-rw-r--r--xmloff/source/forms/formcellbinding.cxx493
-rw-r--r--xmloff/source/forms/formcellbinding.hxx282
-rw-r--r--xmloff/source/forms/formenums.cxx350
-rw-r--r--xmloff/source/forms/formenums.hxx82
-rw-r--r--xmloff/source/forms/formevents.cxx87
-rw-r--r--xmloff/source/forms/formevents.hxx49
-rw-r--r--xmloff/source/forms/formlayerexport.cxx183
-rw-r--r--xmloff/source/forms/formlayerimport.cxx125
-rw-r--r--xmloff/source/forms/formsimp.cxx59
-rw-r--r--xmloff/source/forms/formstyles.cxx68
-rw-r--r--xmloff/source/forms/formstyles.hxx74
-rw-r--r--xmloff/source/forms/gridcolumnproptranslator.cxx347
-rw-r--r--xmloff/source/forms/gridcolumnproptranslator.hxx86
-rw-r--r--xmloff/source/forms/handler/form_handler_factory.cxx90
-rw-r--r--xmloff/source/forms/handler/property_handler_base.cxx61
-rw-r--r--xmloff/source/forms/handler/property_handler_base.hxx64
-rw-r--r--xmloff/source/forms/handler/vcl_date_handler.cxx114
-rw-r--r--xmloff/source/forms/handler/vcl_date_handler.hxx55
-rw-r--r--xmloff/source/forms/handler/vcl_time_handler.cxx115
-rw-r--r--xmloff/source/forms/handler/vcl_time_handler.hxx58
-rw-r--r--xmloff/source/forms/ifacecompare.hxx72
-rw-r--r--xmloff/source/forms/layerexport.cxx835
-rw-r--r--xmloff/source/forms/layerexport.hxx322
-rw-r--r--xmloff/source/forms/layerimport.cxx650
-rw-r--r--xmloff/source/forms/layerimport.hxx200
-rw-r--r--xmloff/source/forms/logging.cxx62
-rw-r--r--xmloff/source/forms/logging.hxx77
-rw-r--r--xmloff/source/forms/officeforms.cxx195
-rw-r--r--xmloff/source/forms/officeforms.hxx106
-rw-r--r--xmloff/source/forms/property_description.hxx140
-rw-r--r--xmloff/source/forms/property_group.hxx47
-rw-r--r--xmloff/source/forms/property_meta_data.cxx270
-rw-r--r--xmloff/source/forms/property_meta_data.hxx68
-rw-r--r--xmloff/source/forms/propertyexport.cxx733
-rw-r--r--xmloff/source/forms/propertyexport.hxx423
-rw-r--r--xmloff/source/forms/propertyimport.cxx639
-rw-r--r--xmloff/source/forms/propertyimport.hxx255
-rw-r--r--xmloff/source/forms/strings.cxx39
-rw-r--r--xmloff/source/forms/strings.hxx287
-rw-r--r--xmloff/source/forms/valueproperties.cxx201
-rw-r--r--xmloff/source/forms/valueproperties.hxx86
-rw-r--r--xmloff/source/meta/MetaExportComponent.cxx236
-rw-r--r--xmloff/source/meta/MetaImportComponent.cxx119
-rw-r--r--xmloff/source/meta/xmlmetae.cxx529
-rw-r--r--xmloff/source/meta/xmlmetai.cxx279
-rw-r--r--xmloff/source/meta/xmlversion.cxx513
-rw-r--r--xmloff/source/script/XMLEventExport.cxx364
-rw-r--r--xmloff/source/script/XMLEventImportHelper.cxx180
-rw-r--r--xmloff/source/script/XMLEventsImportContext.cxx232
-rw-r--r--xmloff/source/script/XMLScriptContextFactory.cxx105
-rw-r--r--xmloff/source/script/XMLScriptExportHandler.cxx89
-rw-r--r--xmloff/source/script/XMLStarBasicContextFactory.cxx130
-rw-r--r--xmloff/source/script/XMLStarBasicExportHandler.cxx112
-rw-r--r--xmloff/source/script/xmlbasici.cxx200
-rw-r--r--xmloff/source/script/xmlbasici.hxx91
-rw-r--r--xmloff/source/script/xmlscripti.cxx192
-rw-r--r--xmloff/source/style/AttributeContainerHandler.cxx107
-rw-r--r--xmloff/source/style/DashStyle.cxx331
-rw-r--r--xmloff/source/style/DrawAspectHdl.cxx91
-rw-r--r--xmloff/source/style/DrawAspectHdl.hxx48
-rw-r--r--xmloff/source/style/EnumPropertyHdl.cxx100
-rw-r--r--xmloff/source/style/FillStyleContext.cxx362
-rw-r--r--xmloff/source/style/FillStyleContext.hxx170
-rw-r--r--xmloff/source/style/GradientStyle.cxx343
-rw-r--r--xmloff/source/style/HatchStyle.cxx262
-rw-r--r--xmloff/source/style/ImageStyle.cxx209
-rw-r--r--xmloff/source/style/MarkerStyle.cxx285
-rw-r--r--xmloff/source/style/MultiPropertySetHelper.cxx217
-rw-r--r--xmloff/source/style/NamedBoolPropertyHdl.cxx84
-rw-r--r--xmloff/source/style/PageHeaderFooterContext.cxx100
-rw-r--r--xmloff/source/style/PageHeaderFooterContext.hxx65
-rw-r--r--xmloff/source/style/PageMasterExportPropMapper.cxx446
-rw-r--r--xmloff/source/style/PageMasterExportPropMapper.hxx81
-rw-r--r--xmloff/source/style/PageMasterImportContext.cxx197
-rw-r--r--xmloff/source/style/PageMasterImportPropMapper.cxx342
-rw-r--r--xmloff/source/style/PageMasterImportPropMapper.hxx65
-rw-r--r--xmloff/source/style/PageMasterPropHdl.cxx428
-rw-r--r--xmloff/source/style/PageMasterPropHdl.hxx182
-rw-r--r--xmloff/source/style/PageMasterPropHdlFactory.cxx148
-rw-r--r--xmloff/source/style/PageMasterPropHdlFactory.hxx49
-rw-r--r--xmloff/source/style/PageMasterPropMapper.cxx61
-rw-r--r--xmloff/source/style/PageMasterPropMapper.hxx49
-rw-r--r--xmloff/source/style/PageMasterStyleMap.cxx193
-rw-r--r--xmloff/source/style/PagePropertySetContext.cxx136
-rw-r--r--xmloff/source/style/PagePropertySetContext.hxx69
-rw-r--r--xmloff/source/style/SinglePropertySetInfoCache.cxx90
-rw-r--r--xmloff/source/style/StyleMap.cxx96
-rw-r--r--xmloff/source/style/TransGradientStyle.cxx328
-rw-r--r--xmloff/source/style/VisAreaContext.cxx137
-rw-r--r--xmloff/source/style/VisAreaExport.cxx86
-rw-r--r--xmloff/source/style/WordWrapPropertyHdl.cxx104
-rw-r--r--xmloff/source/style/XMLBackgroundImageContext.cxx417
-rw-r--r--xmloff/source/style/XMLBackgroundImageExport.cxx177
-rw-r--r--xmloff/source/style/XMLBitmapLogicalSizePropertyHandler.cxx68
-rw-r--r--xmloff/source/style/XMLBitmapRepeatOffsetPropertyHandler.cxx107
-rw-r--r--xmloff/source/style/XMLClipPropertyHandler.cxx149
-rw-r--r--xmloff/source/style/XMLConstantsPropertyHandler.cxx115
-rw-r--r--xmloff/source/style/XMLElementPropertyContext.cxx62
-rw-r--r--xmloff/source/style/XMLFillBitmapSizePropertyHandler.cxx101
-rw-r--r--xmloff/source/style/XMLFontAutoStylePool.cxx294
-rw-r--r--xmloff/source/style/XMLFontStylesContext.cxx288
-rw-r--r--xmloff/source/style/XMLFootnoteSeparatorExport.cxx190
-rw-r--r--xmloff/source/style/XMLFootnoteSeparatorExport.hxx65
-rw-r--r--xmloff/source/style/XMLFootnoteSeparatorImport.cxx217
-rw-r--r--xmloff/source/style/XMLFootnoteSeparatorImport.hxx80
-rw-r--r--xmloff/source/style/XMLIsPercentagePropertyHandler.cxx64
-rw-r--r--xmloff/source/style/XMLPageExport.cxx272
-rw-r--r--xmloff/source/style/XMLPercentOrMeasurePropertyHandler.cxx101
-rw-r--r--xmloff/source/style/XMLRectangleMembersHandler.cxx125
-rw-r--r--xmloff/source/style/adjushdl.cxx138
-rw-r--r--xmloff/source/style/adjushdl.hxx60
-rw-r--r--xmloff/source/style/backhdl.cxx300
-rw-r--r--xmloff/source/style/backhdl.hxx56
-rw-r--r--xmloff/source/style/bordrhdl.cxx374
-rw-r--r--xmloff/source/style/bordrhdl.hxx57
-rw-r--r--xmloff/source/style/breakhdl.cxx196
-rw-r--r--xmloff/source/style/breakhdl.hxx60
-rw-r--r--xmloff/source/style/cdouthdl.cxx332
-rw-r--r--xmloff/source/style/cdouthdl.hxx75
-rw-r--r--xmloff/source/style/chrhghdl.cxx169
-rw-r--r--xmloff/source/style/chrhghdl.hxx66
-rw-r--r--xmloff/source/style/chrlohdl.cxx147
-rw-r--r--xmloff/source/style/chrlohdl.hxx61
-rw-r--r--xmloff/source/style/csmaphdl.cxx141
-rw-r--r--xmloff/source/style/csmaphdl.hxx57
-rw-r--r--xmloff/source/style/durationhdl.cxx84
-rw-r--r--xmloff/source/style/durationhdl.hxx48
-rw-r--r--xmloff/source/style/escphdl.cxx175
-rw-r--r--xmloff/source/style/escphdl.hxx57
-rw-r--r--xmloff/source/style/fonthdl.cxx322
-rw-r--r--xmloff/source/style/fonthdl.hxx85
-rw-r--r--xmloff/source/style/impastp1.cxx135
-rw-r--r--xmloff/source/style/impastp2.cxx66
-rw-r--r--xmloff/source/style/impastp3.cxx194
-rw-r--r--xmloff/source/style/impastp4.cxx523
-rw-r--r--xmloff/source/style/impastpl.hxx227
-rw-r--r--xmloff/source/style/kernihdl.cxx92
-rw-r--r--xmloff/source/style/kernihdl.hxx48
-rw-r--r--xmloff/source/style/lspachdl.cxx198
-rw-r--r--xmloff/source/style/lspachdl.hxx66
-rw-r--r--xmloff/source/style/numehelp.cxx561
-rw-r--r--xmloff/source/style/opaquhdl.cxx85
-rw-r--r--xmloff/source/style/opaquhdl.hxx48
-rw-r--r--xmloff/source/style/postuhdl.cxx95
-rw-r--r--xmloff/source/style/postuhdl.hxx48
-rw-r--r--xmloff/source/style/prhdlfac.cxx453
-rw-r--r--xmloff/source/style/prstylei.cxx420
-rw-r--r--xmloff/source/style/shadwhdl.cxx178
-rw-r--r--xmloff/source/style/shadwhdl.hxx48
-rw-r--r--xmloff/source/style/shdwdhdl.cxx87
-rw-r--r--xmloff/source/style/shdwdhdl.hxx48
-rw-r--r--xmloff/source/style/styleexp.cxx526
-rw-r--r--xmloff/source/style/tabsthdl.cxx94
-rw-r--r--xmloff/source/style/tabsthdl.hxx51
-rw-r--r--xmloff/source/style/undlihdl.cxx383
-rw-r--r--xmloff/source/style/undlihdl.hxx66
-rw-r--r--xmloff/source/style/uniref.cxx43
-rw-r--r--xmloff/source/style/weighhdl.cxx177
-rw-r--r--xmloff/source/style/weighhdl.hxx49
-rw-r--r--xmloff/source/style/xmlaustp.cxx449
-rw-r--r--xmloff/source/style/xmlbahdl.cxx946
-rw-r--r--xmloff/source/style/xmlbahdl.hxx310
-rw-r--r--xmloff/source/style/xmlexppr.cxx1141
-rw-r--r--xmloff/source/style/xmlimppr.cxx779
-rw-r--r--xmloff/source/style/xmlnume.cxx907
-rw-r--r--xmloff/source/style/xmlnumfe.cxx1809
-rw-r--r--xmloff/source/style/xmlnumfi.cxx2233
-rw-r--r--xmloff/source/style/xmlnumi.cxx1397
-rw-r--r--xmloff/source/style/xmlprcon.cxx106
-rw-r--r--xmloff/source/style/xmlprhdl.cxx44
-rw-r--r--xmloff/source/style/xmlprmap.cxx255
-rw-r--r--xmloff/source/style/xmlstyle.cxx954
-rw-r--r--xmloff/source/style/xmltabe.cxx140
-rw-r--r--xmloff/source/style/xmltabi.cxx295
-rw-r--r--xmloff/source/table/XMLTableExport.cxx593
-rw-r--r--xmloff/source/table/XMLTableImport.cxx829
-rw-r--r--xmloff/source/table/table.hxx48
-rw-r--r--xmloff/source/text/XMLAnchorTypePropHdl.hxx55
-rw-r--r--xmloff/source/text/XMLAutoMarkFileContext.cxx98
-rw-r--r--xmloff/source/text/XMLAutoMarkFileContext.hxx67
-rw-r--r--xmloff/source/text/XMLAutoTextContainerEventImport.cxx85
-rw-r--r--xmloff/source/text/XMLAutoTextContainerEventImport.hxx78
-rw-r--r--xmloff/source/text/XMLAutoTextEventExport.cxx286
-rw-r--r--xmloff/source/text/XMLAutoTextEventExport.hxx161
-rw-r--r--xmloff/source/text/XMLAutoTextEventImport.cxx146
-rw-r--r--xmloff/source/text/XMLAutoTextEventImport.hxx101
-rw-r--r--xmloff/source/text/XMLCalculationSettingsContext.cxx97
-rw-r--r--xmloff/source/text/XMLCalculationSettingsContext.hxx52
-rw-r--r--xmloff/source/text/XMLChangeElementImportContext.cxx116
-rw-r--r--xmloff/source/text/XMLChangeElementImportContext.hxx88
-rw-r--r--xmloff/source/text/XMLChangeImportContext.cxx103
-rw-r--r--xmloff/source/text/XMLChangeImportContext.hxx88
-rw-r--r--xmloff/source/text/XMLChangeInfoContext.cxx112
-rw-r--r--xmloff/source/text/XMLChangeInfoContext.hxx90
-rw-r--r--xmloff/source/text/XMLChangedRegionImportContext.cxx199
-rw-r--r--xmloff/source/text/XMLChangedRegionImportContext.hxx101
-rw-r--r--xmloff/source/text/XMLFootnoteBodyImportContext.cxx77
-rw-r--r--xmloff/source/text/XMLFootnoteBodyImportContext.hxx71
-rw-r--r--xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx455
-rw-r--r--xmloff/source/text/XMLFootnoteImportContext.cxx246
-rw-r--r--xmloff/source/text/XMLFootnoteImportContext.hxx100
-rw-r--r--xmloff/source/text/XMLIndexAlphabeticalSourceContext.cxx274
-rw-r--r--xmloff/source/text/XMLIndexAlphabeticalSourceContext.hxx106
-rw-r--r--xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx300
-rw-r--r--xmloff/source/text/XMLIndexBibliographyEntryContext.cxx184
-rw-r--r--xmloff/source/text/XMLIndexBibliographyEntryContext.hxx87
-rw-r--r--xmloff/source/text/XMLIndexBibliographySourceContext.cxx114
-rw-r--r--xmloff/source/text/XMLIndexBibliographySourceContext.hxx79
-rw-r--r--xmloff/source/text/XMLIndexBodyContext.cxx80
-rw-r--r--xmloff/source/text/XMLIndexBodyContext.hxx82
-rw-r--r--xmloff/source/text/XMLIndexChapterInfoEntryContext.cxx210
-rw-r--r--xmloff/source/text/XMLIndexChapterInfoEntryContext.hxx84
-rw-r--r--xmloff/source/text/XMLIndexIllustrationSourceContext.cxx95
-rw-r--r--xmloff/source/text/XMLIndexIllustrationSourceContext.hxx75
-rw-r--r--xmloff/source/text/XMLIndexMarkExport.cxx270
-rw-r--r--xmloff/source/text/XMLIndexMarkExport.hxx120
-rw-r--r--xmloff/source/text/XMLIndexObjectSourceContext.cxx193
-rw-r--r--xmloff/source/text/XMLIndexObjectSourceContext.hxx90
-rw-r--r--xmloff/source/text/XMLIndexSimpleEntryContext.cxx146
-rw-r--r--xmloff/source/text/XMLIndexSimpleEntryContext.hxx96
-rw-r--r--xmloff/source/text/XMLIndexSourceBaseContext.cxx280
-rw-r--r--xmloff/source/text/XMLIndexSourceBaseContext.hxx134
-rw-r--r--xmloff/source/text/XMLIndexSpanEntryContext.cxx78
-rw-r--r--xmloff/source/text/XMLIndexSpanEntryContext.hxx75
-rw-r--r--xmloff/source/text/XMLIndexTOCContext.cxx385
-rw-r--r--xmloff/source/text/XMLIndexTOCContext.hxx109
-rw-r--r--xmloff/source/text/XMLIndexTOCSourceContext.cxx199
-rw-r--r--xmloff/source/text/XMLIndexTOCSourceContext.hxx89
-rw-r--r--xmloff/source/text/XMLIndexTOCStylesContext.cxx162
-rw-r--r--xmloff/source/text/XMLIndexTOCStylesContext.hxx97
-rw-r--r--xmloff/source/text/XMLIndexTabStopEntryContext.cxx177
-rw-r--r--xmloff/source/text/XMLIndexTabStopEntryContext.hxx82
-rw-r--r--xmloff/source/text/XMLIndexTableSourceContext.cxx189
-rw-r--r--xmloff/source/text/XMLIndexTableSourceContext.hxx89
-rw-r--r--xmloff/source/text/XMLIndexTemplateContext.cxx505
-rw-r--r--xmloff/source/text/XMLIndexTemplateContext.hxx162
-rw-r--r--xmloff/source/text/XMLIndexTitleTemplateContext.cxx119
-rw-r--r--xmloff/source/text/XMLIndexTitleTemplateContext.hxx93
-rw-r--r--xmloff/source/text/XMLIndexUserSourceContext.cxx234
-rw-r--r--xmloff/source/text/XMLIndexUserSourceContext.hxx96
-rw-r--r--xmloff/source/text/XMLLineNumberingExport.cxx215
-rw-r--r--xmloff/source/text/XMLLineNumberingExport.hxx63
-rw-r--r--xmloff/source/text/XMLLineNumberingImportContext.cxx324
-rw-r--r--xmloff/source/text/XMLLineNumberingSeparatorImportContext.cxx100
-rw-r--r--xmloff/source/text/XMLLineNumberingSeparatorImportContext.hxx75
-rw-r--r--xmloff/source/text/XMLPropertyBackpatcher.cxx314
-rw-r--r--xmloff/source/text/XMLPropertyBackpatcher.hxx154
-rw-r--r--xmloff/source/text/XMLRedlineExport.cxx675
-rw-r--r--xmloff/source/text/XMLRedlineExport.hxx215
-rw-r--r--xmloff/source/text/XMLSectionExport.cxx1931
-rw-r--r--xmloff/source/text/XMLSectionExport.hxx369
-rw-r--r--xmloff/source/text/XMLSectionFootnoteConfigExport.cxx203
-rw-r--r--xmloff/source/text/XMLSectionFootnoteConfigExport.hxx62
-rw-r--r--xmloff/source/text/XMLSectionFootnoteConfigImport.cxx198
-rw-r--r--xmloff/source/text/XMLSectionFootnoteConfigImport.hxx79
-rw-r--r--xmloff/source/text/XMLSectionImportContext.cxx408
-rw-r--r--xmloff/source/text/XMLSectionImportContext.hxx121
-rw-r--r--xmloff/source/text/XMLSectionSourceDDEImportContext.cxx189
-rw-r--r--xmloff/source/text/XMLSectionSourceDDEImportContext.hxx81
-rw-r--r--xmloff/source/text/XMLSectionSourceImportContext.cxx159
-rw-r--r--xmloff/source/text/XMLSectionSourceImportContext.hxx76
-rw-r--r--xmloff/source/text/XMLStringBufferImportContext.cxx85
-rw-r--r--xmloff/source/text/XMLTextCharStyleNamesElementExport.cxx91
-rw-r--r--xmloff/source/text/XMLTextCharStyleNamesElementExport.hxx59
-rw-r--r--xmloff/source/text/XMLTextColumnsContext.cxx535
-rw-r--r--xmloff/source/text/XMLTextColumnsExport.cxx210
-rw-r--r--xmloff/source/text/XMLTextFrameContext.cxx1657
-rw-r--r--xmloff/source/text/XMLTextFrameContext.hxx108
-rw-r--r--xmloff/source/text/XMLTextFrameHyperlinkContext.cxx188
-rw-r--r--xmloff/source/text/XMLTextFrameHyperlinkContext.hxx85
-rw-r--r--xmloff/source/text/XMLTextHeaderFooterContext.cxx194
-rw-r--r--xmloff/source/text/XMLTextListAutoStylePool.cxx321
-rw-r--r--xmloff/source/text/XMLTextListBlockContext.cxx308
-rw-r--r--xmloff/source/text/XMLTextListBlockContext.hxx97
-rw-r--r--xmloff/source/text/XMLTextListItemContext.cxx185
-rw-r--r--xmloff/source/text/XMLTextListItemContext.hxx86
-rw-r--r--xmloff/source/text/XMLTextMarkImportContext.cxx492
-rw-r--r--xmloff/source/text/XMLTextMarkImportContext.hxx127
-rw-r--r--xmloff/source/text/XMLTextMasterPageContext.cxx295
-rw-r--r--xmloff/source/text/XMLTextMasterPageExport.cxx187
-rw-r--r--xmloff/source/text/XMLTextMasterStylesContext.cxx101
-rw-r--r--xmloff/source/text/XMLTextNumRuleInfo.cxx248
-rw-r--r--xmloff/source/text/XMLTextNumRuleInfo.hxx187
-rw-r--r--xmloff/source/text/XMLTextPropertySetContext.cxx149
-rw-r--r--xmloff/source/text/XMLTextPropertySetContext.hxx65
-rw-r--r--xmloff/source/text/XMLTextShapeImportHelper.cxx165
-rw-r--r--xmloff/source/text/XMLTextShapeStyleContext.cxx252
-rw-r--r--xmloff/source/text/XMLTextTableContext.cxx52
-rw-r--r--xmloff/source/text/XMLTrackedChangesImportContext.cxx119
-rw-r--r--xmloff/source/text/XMLTrackedChangesImportContext.hxx78
-rw-r--r--xmloff/source/text/txtdrope.cxx108
-rw-r--r--xmloff/source/text/txtdrope.hxx54
-rw-r--r--xmloff/source/text/txtdropi.cxx156
-rw-r--r--xmloff/source/text/txtdropi.hxx69
-rw-r--r--xmloff/source/text/txtexppr.cxx1036
-rw-r--r--xmloff/source/text/txtexppr.hxx99
-rw-r--r--xmloff/source/text/txtflde.cxx3621
-rw-r--r--xmloff/source/text/txtfldi.cxx4127
-rw-r--r--xmloff/source/text/txtftne.cxx394
-rw-r--r--xmloff/source/text/txtimp.cxx2959
-rw-r--r--xmloff/source/text/txtimppr.cxx673
-rw-r--r--xmloff/source/text/txtlists.cxx520
-rw-r--r--xmloff/source/text/txtparae.cxx3719
-rw-r--r--xmloff/source/text/txtparai.cxx2439
-rw-r--r--xmloff/source/text/txtparai.hxx133
-rw-r--r--xmloff/source/text/txtparaimphint.hxx295
-rw-r--r--xmloff/source/text/txtprhdl.cxx1482
-rw-r--r--xmloff/source/text/txtprhdl.hxx51
-rw-r--r--xmloff/source/text/txtprmap.cxx897
-rw-r--r--xmloff/source/text/txtsecte.cxx256
-rw-r--r--xmloff/source/text/txtstyle.cxx176
-rw-r--r--xmloff/source/text/txtstyli.cxx562
-rw-r--r--xmloff/source/text/txtvfldi.cxx1476
-rw-r--r--xmloff/source/transform/ActionMapTypesOASIS.hxx99
-rw-r--r--xmloff/source/transform/ActionMapTypesOOo.hxx95
-rw-r--r--xmloff/source/transform/AttrTransformerAction.hxx144
-rw-r--r--xmloff/source/transform/ChartOASISTContext.cxx146
-rw-r--r--xmloff/source/transform/ChartOASISTContext.hxx48
-rw-r--r--xmloff/source/transform/ChartOOoTContext.cxx149
-rw-r--r--xmloff/source/transform/ChartOOoTContext.hxx48
-rw-r--r--xmloff/source/transform/ChartPlotAreaOASISTContext.cxx259
-rw-r--r--xmloff/source/transform/ChartPlotAreaOASISTContext.hxx59
-rw-r--r--xmloff/source/transform/ChartPlotAreaOOoTContext.cxx243
-rw-r--r--xmloff/source/transform/ChartPlotAreaOOoTContext.hxx67
-rw-r--r--xmloff/source/transform/ControlOASISTContext.cxx166
-rw-r--r--xmloff/source/transform/ControlOASISTContext.hxx55
-rw-r--r--xmloff/source/transform/ControlOOoTContext.cxx108
-rw-r--r--xmloff/source/transform/ControlOOoTContext.hxx63
-rw-r--r--xmloff/source/transform/CreateElemTContext.cxx132
-rw-r--r--xmloff/source/transform/CreateElemTContext.hxx59
-rw-r--r--xmloff/source/transform/DeepTContext.cxx179
-rw-r--r--xmloff/source/transform/DeepTContext.hxx86
-rw-r--r--xmloff/source/transform/DlgOASISTContext.cxx117
-rw-r--r--xmloff/source/transform/DlgOASISTContext.hxx48
-rw-r--r--xmloff/source/transform/DocumentTContext.cxx148
-rw-r--r--xmloff/source/transform/DocumentTContext.hxx60
-rw-r--r--xmloff/source/transform/ElemTransformerAction.hxx99
-rw-r--r--xmloff/source/transform/EventMap.cxx114
-rw-r--r--xmloff/source/transform/EventMap.hxx46
-rw-r--r--xmloff/source/transform/EventOASISTContext.cxx421
-rw-r--r--xmloff/source/transform/EventOASISTContext.hxx58
-rw-r--r--xmloff/source/transform/EventOOoTContext.cxx265
-rw-r--r--xmloff/source/transform/EventOOoTContext.hxx66
-rw-r--r--xmloff/source/transform/FamilyType.hxx62
-rw-r--r--xmloff/source/transform/FlatTContext.cxx71
-rw-r--r--xmloff/source/transform/FlatTContext.hxx72
-rw-r--r--xmloff/source/transform/FormPropOASISTContext.cxx226
-rw-r--r--xmloff/source/transform/FormPropOASISTContext.hxx57
-rw-r--r--xmloff/source/transform/FormPropOOoTContext.cxx313
-rw-r--r--xmloff/source/transform/FormPropOOoTContext.hxx72
-rw-r--r--xmloff/source/transform/FrameOASISTContext.cxx201
-rw-r--r--xmloff/source/transform/FrameOASISTContext.hxx70
-rw-r--r--xmloff/source/transform/FrameOOoTContext.cxx175
-rw-r--r--xmloff/source/transform/FrameOOoTContext.hxx62
-rw-r--r--xmloff/source/transform/IgnoreTContext.cxx109
-rw-r--r--xmloff/source/transform/IgnoreTContext.hxx91
-rw-r--r--xmloff/source/transform/MergeElemTContext.cxx347
-rw-r--r--xmloff/source/transform/MergeElemTContext.hxx72
-rw-r--r--xmloff/source/transform/MetaTContext.cxx146
-rw-r--r--xmloff/source/transform/MetaTContext.hxx83
-rw-r--r--xmloff/source/transform/MutableAttrList.cxx206
-rw-r--r--xmloff/source/transform/MutableAttrList.hxx90
-rw-r--r--xmloff/source/transform/NotesTContext.cxx231
-rw-r--r--xmloff/source/transform/NotesTContext.hxx63
-rw-r--r--xmloff/source/transform/OOo2Oasis.cxx2200
-rw-r--r--xmloff/source/transform/OOo2Oasis.hxx115
-rw-r--r--xmloff/source/transform/Oasis2OOo.cxx2084
-rw-r--r--xmloff/source/transform/Oasis2OOo.hxx72
-rw-r--r--xmloff/source/transform/PersAttrListTContext.cxx197
-rw-r--r--xmloff/source/transform/PersAttrListTContext.hxx124
-rw-r--r--xmloff/source/transform/PersMixedContentTContext.cxx161
-rw-r--r--xmloff/source/transform/PersMixedContentTContext.hxx71
-rw-r--r--xmloff/source/transform/ProcAddAttrTContext.cxx80
-rw-r--r--xmloff/source/transform/ProcAddAttrTContext.hxx60
-rw-r--r--xmloff/source/transform/ProcAttrTContext.cxx85
-rw-r--r--xmloff/source/transform/ProcAttrTContext.hxx68
-rw-r--r--xmloff/source/transform/PropType.hxx53
-rw-r--r--xmloff/source/transform/PropertyActionsOASIS.cxx557
-rw-r--r--xmloff/source/transform/PropertyActionsOASIS.hxx78
-rw-r--r--xmloff/source/transform/PropertyActionsOOo.cxx1070
-rw-r--r--xmloff/source/transform/PropertyActionsOOo.hxx81
-rw-r--r--xmloff/source/transform/RenameElemTContext.cxx94
-rw-r--r--xmloff/source/transform/RenameElemTContext.hxx75
-rw-r--r--xmloff/source/transform/StyleOASISTContext.cxx1014
-rw-r--r--xmloff/source/transform/StyleOASISTContext.hxx78
-rw-r--r--xmloff/source/transform/StyleOOoTContext.cxx1373
-rw-r--r--xmloff/source/transform/StyleOOoTContext.hxx77
-rw-r--r--xmloff/source/transform/TContextVector.hxx44
-rw-r--r--xmloff/source/transform/Transformer.hxx48
-rw-r--r--xmloff/source/transform/TransformerAction.hxx38
-rw-r--r--xmloff/source/transform/TransformerActionInit.hxx54
-rw-r--r--xmloff/source/transform/TransformerActions.cxx95
-rw-r--r--xmloff/source/transform/TransformerActions.hxx164
-rw-r--r--xmloff/source/transform/TransformerBase.cxx1477
-rw-r--r--xmloff/source/transform/TransformerBase.hxx209
-rw-r--r--xmloff/source/transform/TransformerContext.cxx112
-rw-r--r--xmloff/source/transform/TransformerContext.hxx118
-rw-r--r--xmloff/source/transform/TransformerTokenMap.cxx55
-rw-r--r--xmloff/source/transform/TransformerTokenMap.hxx51
-rw-r--r--xmloff/source/transform/XMLFilterRegistration.cxx197
-rwxr-xr-xxmloff/source/transform/xof.component118
-rw-r--r--xmloff/source/xforms/SchemaContext.cxx103
-rw-r--r--xmloff/source/xforms/SchemaContext.hxx87
-rw-r--r--xmloff/source/xforms/SchemaRestrictionContext.cxx383
-rw-r--r--xmloff/source/xforms/SchemaRestrictionContext.hxx94
-rw-r--r--xmloff/source/xforms/SchemaSimpleTypeContext.cxx118
-rw-r--r--xmloff/source/xforms/SchemaSimpleTypeContext.hxx89
-rw-r--r--xmloff/source/xforms/TokenContext.cxx149
-rw-r--r--xmloff/source/xforms/TokenContext.hxx117
-rw-r--r--xmloff/source/xforms/XFormsBindContext.cxx193
-rw-r--r--xmloff/source/xforms/XFormsBindContext.hxx91
-rw-r--r--xmloff/source/xforms/XFormsInstanceContext.cxx161
-rw-r--r--xmloff/source/xforms/XFormsInstanceContext.hxx102
-rw-r--r--xmloff/source/xforms/XFormsModelContext.cxx166
-rw-r--r--xmloff/source/xforms/XFormsModelContext.hxx88
-rw-r--r--xmloff/source/xforms/XFormsModelExport.hxx45
-rw-r--r--xmloff/source/xforms/XFormsSubmissionContext.cxx185
-rw-r--r--xmloff/source/xforms/XFormsSubmissionContext.hxx86
-rw-r--r--xmloff/source/xforms/xformsapi.cxx352
-rw-r--r--xmloff/source/xforms/xformsapi.hxx96
-rw-r--r--xmloff/source/xforms/xformsexport.cxx838
-rw-r--r--xmloff/source/xforms/xformsimport.cxx209
-rwxr-xr-xxmloff/util/xo.component178
-rwxr-xr-xxmloff/xml/components.xml473
788 files changed, 225843 insertions, 0 deletions
diff --git a/xmloff/JunitTest_xmloff_unoapi.mk b/xmloff/JunitTest_xmloff_unoapi.mk
new file mode 100755
index 000000000000..7dfe6974f225
--- /dev/null
+++ b/xmloff/JunitTest_xmloff_unoapi.mk
@@ -0,0 +1,49 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 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.
+#
+#*************************************************************************
+
+$(eval $(call gb_JunitTest_JunitTest,xmloff_unoapi))
+
+$(eval $(call gb_JunitTest_set_defs,xmloff_unoapi,\
+ $$(DEFS) \
+ -Dorg.openoffice.test.arg.sce=$(SRCDIR)/xmloff/qa/unoapi/xmloff.sce \
+ -Dorg.openoffice.test.arg.xcl=$(SRCDIR)/xmloff/qa/unoapi/knownissues.xcl \
+ -Dorg.openoffice.test.arg.tdoc=$(SRCDIR)/xmloff/qa/unoapi/testdocuments \
+))
+
+$(eval $(call gb_JunitTest_add_jars,xmloff_unoapi,\
+ $(OUTDIR)/bin/OOoRunner.jar \
+ $(OUTDIR)/bin/ridl.jar \
+ $(OUTDIR)/bin/test.jar \
+ $(OUTDIR)/bin/unoil.jar \
+ $(OUTDIR)/bin/jurt.jar \
+))
+
+$(eval $(call gb_JunitTest_add_classes,xmloff_unoapi,\
+ org.openoffice.test.UnoApiTest \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/xmloff/Library_xo.mk b/xmloff/Library_xo.mk
new file mode 100644
index 000000000000..278971088472
--- /dev/null
+++ b/xmloff/Library_xo.mk
@@ -0,0 +1,382 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 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.
+#
+#*************************************************************************
+
+$(eval $(call gb_Library_Library,xo))
+
+$(eval $(call gb_Library_set_componentfile,xo,xmloff/util/xo))
+
+$(eval $(call gb_Library_add_package_headers,xo,xmloff_inc))
+
+$(eval $(call gb_Library_add_precompiled_header,xo,$(SRCDIR)/xmloff/inc/pch/precompiled_xmloff))
+
+$(eval $(call gb_Library_set_include,xo,\
+ $$(SOLARINC) \
+ -I$(realpath $(SRCDIR)/xmloff/inc) \
+ -I$(realpath $(SRCDIR)/xmloff/inc/pch) \
+ -I$(OUTDIR)/inc/offuh \
+))
+
+$(eval $(call gb_Library_set_defs,xo,\
+ $$(DEFS) \
+ -DXMLOFF_DLLIMPLEMENTATION \
+))
+
+$(eval $(call gb_Library_add_linked_libs,xo,\
+ basegfx \
+ comphelper \
+ cppu \
+ cppuhelper \
+ i18nisolang1 \
+ sal \
+ salhelper \
+ svl \
+ tl \
+ utl \
+ $(gb_STDLIBS) \
+))
+
+$(eval $(call gb_Library_add_exception_objects,xo,\
+ xmloff/source/chart/ColorPropertySet \
+ xmloff/source/chart/PropertyMaps \
+ xmloff/source/chart/SchXMLAutoStylePoolP \
+ xmloff/source/chart/SchXMLAxisContext \
+ xmloff/source/chart/SchXMLCalculationSettingsContext \
+ xmloff/source/chart/SchXMLChartContext \
+ xmloff/source/chart/SchXMLEnumConverter \
+ xmloff/source/chart/SchXMLExport \
+ xmloff/source/chart/SchXMLImport \
+ xmloff/source/chart/SchXMLLegendContext \
+ xmloff/source/chart/SchXMLParagraphContext \
+ xmloff/source/chart/SchXMLPlotAreaContext \
+ xmloff/source/chart/SchXMLSeries2Context \
+ xmloff/source/chart/SchXMLSeriesHelper \
+ xmloff/source/chart/SchXMLTableContext \
+ xmloff/source/chart/SchXMLTextListContext \
+ xmloff/source/chart/SchXMLTools \
+ xmloff/source/chart/XMLAxisPositionPropertyHdl \
+ xmloff/source/chart/XMLChartPropertyContext \
+ xmloff/source/chart/XMLChartStyleContext \
+ xmloff/source/chart/XMLErrorBarStylePropertyHdl \
+ xmloff/source/chart/XMLErrorIndicatorPropertyHdl \
+ xmloff/source/chart/XMLLabelSeparatorContext \
+ xmloff/source/chart/XMLSymbolImageContext \
+ xmloff/source/chart/XMLSymbolTypePropertyHdl \
+ xmloff/source/chart/XMLTextOrientationHdl \
+ xmloff/source/chart/contexts \
+ xmloff/source/chart/transporttypes \
+ xmloff/source/core/DocumentSettingsContext \
+ xmloff/source/core/DomBuilderContext \
+ xmloff/source/core/DomExport \
+ xmloff/source/core/ProgressBarHelper \
+ xmloff/source/core/PropertySetMerger \
+ xmloff/source/core/RDFaExportHelper \
+ xmloff/source/core/RDFaImportHelper \
+ xmloff/source/core/SettingsExportHelper \
+ xmloff/source/core/XMLBase64Export \
+ xmloff/source/core/XMLBase64ImportContext \
+ xmloff/source/core/XMLBasicExportFilter \
+ xmloff/source/core/XMLEmbeddedObjectExportFilter \
+ xmloff/source/core/XMLEmbeddedObjectImportContext \
+ xmloff/source/core/attrlist \
+ xmloff/source/core/facreg \
+ xmloff/source/core/i18nmap \
+ xmloff/source/core/nmspmap \
+ xmloff/source/core/unoatrcn \
+ xmloff/source/core/unointerfacetouniqueidentifiermapper \
+ xmloff/source/core/xmlcnitm \
+ xmloff/source/core/xmlehelp \
+ xmloff/source/core/xmlerror \
+ xmloff/source/core/xmlexp \
+ xmloff/source/core/xmlictxt \
+ xmloff/source/core/xmlimp \
+ xmloff/source/core/xmltkmap \
+ xmloff/source/core/xmltoken \
+ xmloff/source/core/xmluconv \
+ xmloff/source/draw/EnhancedCustomShapeToken \
+ xmloff/source/draw/XMLGraphicsDefaultStyle \
+ xmloff/source/draw/XMLImageMapContext \
+ xmloff/source/draw/XMLImageMapExport \
+ xmloff/source/draw/XMLNumberStyles \
+ xmloff/source/draw/XMLReplacementImageContext \
+ xmloff/source/draw/XMLShapePropertySetContext \
+ xmloff/source/draw/XMLShapeStyleContext \
+ xmloff/source/draw/animationexport \
+ xmloff/source/draw/animationimport \
+ xmloff/source/draw/animexp \
+ xmloff/source/draw/animimp \
+ xmloff/source/draw/descriptionimp \
+ xmloff/source/draw/eventimp \
+ xmloff/source/draw/layerexp \
+ xmloff/source/draw/layerimp \
+ xmloff/source/draw/numithdl \
+ xmloff/source/draw/propimp0 \
+ xmloff/source/draw/sdpropls \
+ xmloff/source/draw/sdxmlexp \
+ xmloff/source/draw/sdxmlimp \
+ xmloff/source/draw/shapeexport \
+ xmloff/source/draw/shapeexport2 \
+ xmloff/source/draw/shapeexport3 \
+ xmloff/source/draw/shapeexport4 \
+ xmloff/source/draw/shapeimport \
+ xmloff/source/draw/viewcontext \
+ xmloff/source/draw/xexptran \
+ xmloff/source/draw/ximp3dobject \
+ xmloff/source/draw/ximp3dscene \
+ xmloff/source/draw/ximpbody \
+ xmloff/source/draw/ximpcustomshape \
+ xmloff/source/draw/ximpgrp \
+ xmloff/source/draw/ximplink \
+ xmloff/source/draw/ximpnote \
+ xmloff/source/draw/ximppage \
+ xmloff/source/draw/ximpshap \
+ xmloff/source/draw/ximpshow \
+ xmloff/source/draw/ximpstyl \
+ xmloff/source/forms/attriblistmerge \
+ xmloff/source/forms/controlelement \
+ xmloff/source/forms/controlpropertyhdl \
+ xmloff/source/forms/controlpropertymap \
+ xmloff/source/forms/elementexport \
+ xmloff/source/forms/elementimport \
+ xmloff/source/forms/eventexport \
+ xmloff/source/forms/eventimport \
+ xmloff/source/forms/formattributes \
+ xmloff/source/forms/formcellbinding \
+ xmloff/source/forms/formenums \
+ xmloff/source/forms/formevents \
+ xmloff/source/forms/formlayerexport \
+ xmloff/source/forms/formlayerimport \
+ xmloff/source/forms/formsimp \
+ xmloff/source/forms/formstyles \
+ xmloff/source/forms/gridcolumnproptranslator \
+ xmloff/source/forms/layerexport \
+ xmloff/source/forms/layerimport \
+ xmloff/source/forms/logging \
+ xmloff/source/forms/officeforms \
+ xmloff/source/forms/propertyexport \
+ xmloff/source/forms/propertyimport \
+ xmloff/source/forms/property_meta_data \
+ xmloff/source/forms/strings \
+ xmloff/source/forms/valueproperties \
+ xmloff/source/forms/handler/form_handler_factory \
+ xmloff/source/forms/handler/property_handler_base \
+ xmloff/source/forms/handler/vcl_date_handler \
+ xmloff/source/forms/handler/vcl_time_handler \
+ xmloff/source/meta/MetaExportComponent \
+ xmloff/source/meta/MetaImportComponent \
+ xmloff/source/meta/xmlmetae \
+ xmloff/source/meta/xmlmetai \
+ xmloff/source/meta/xmlversion \
+ xmloff/source/script/XMLEventExport \
+ xmloff/source/script/XMLEventImportHelper \
+ xmloff/source/script/XMLEventsImportContext \
+ xmloff/source/script/XMLScriptContextFactory \
+ xmloff/source/script/XMLScriptExportHandler \
+ xmloff/source/script/XMLStarBasicContextFactory \
+ xmloff/source/script/XMLStarBasicExportHandler \
+ xmloff/source/script/xmlbasici \
+ xmloff/source/script/xmlscripti \
+ xmloff/source/style/AttributeContainerHandler \
+ xmloff/source/style/DashStyle \
+ xmloff/source/style/DrawAspectHdl \
+ xmloff/source/style/EnumPropertyHdl \
+ xmloff/source/style/FillStyleContext \
+ xmloff/source/style/GradientStyle \
+ xmloff/source/style/HatchStyle \
+ xmloff/source/style/ImageStyle \
+ xmloff/source/style/MarkerStyle \
+ xmloff/source/style/MultiPropertySetHelper \
+ xmloff/source/style/NamedBoolPropertyHdl \
+ xmloff/source/style/PageHeaderFooterContext \
+ xmloff/source/style/PageMasterExportPropMapper \
+ xmloff/source/style/PageMasterImportContext \
+ xmloff/source/style/PageMasterImportPropMapper \
+ xmloff/source/style/PageMasterPropHdl \
+ xmloff/source/style/PageMasterPropHdlFactory \
+ xmloff/source/style/PageMasterPropMapper \
+ xmloff/source/style/PageMasterStyleMap \
+ xmloff/source/style/PagePropertySetContext \
+ xmloff/source/style/SinglePropertySetInfoCache \
+ xmloff/source/style/StyleMap \
+ xmloff/source/style/TransGradientStyle \
+ xmloff/source/style/VisAreaContext \
+ xmloff/source/style/VisAreaExport \
+ xmloff/source/style/WordWrapPropertyHdl \
+ xmloff/source/style/XMLBackgroundImageContext \
+ xmloff/source/style/XMLBackgroundImageExport \
+ xmloff/source/style/XMLBitmapLogicalSizePropertyHandler \
+ xmloff/source/style/XMLBitmapRepeatOffsetPropertyHandler \
+ xmloff/source/style/XMLClipPropertyHandler \
+ xmloff/source/style/XMLConstantsPropertyHandler \
+ xmloff/source/style/XMLElementPropertyContext \
+ xmloff/source/style/XMLFillBitmapSizePropertyHandler \
+ xmloff/source/style/XMLFontAutoStylePool \
+ xmloff/source/style/XMLFontStylesContext \
+ xmloff/source/style/XMLFootnoteSeparatorExport \
+ xmloff/source/style/XMLFootnoteSeparatorImport \
+ xmloff/source/style/XMLIsPercentagePropertyHandler \
+ xmloff/source/style/XMLPageExport \
+ xmloff/source/style/XMLPercentOrMeasurePropertyHandler \
+ xmloff/source/style/XMLRectangleMembersHandler \
+ xmloff/source/style/adjushdl \
+ xmloff/source/style/backhdl \
+ xmloff/source/style/bordrhdl \
+ xmloff/source/style/breakhdl \
+ xmloff/source/style/cdouthdl \
+ xmloff/source/style/chrhghdl \
+ xmloff/source/style/chrlohdl \
+ xmloff/source/style/csmaphdl \
+ xmloff/source/style/durationhdl \
+ xmloff/source/style/escphdl \
+ xmloff/source/style/fonthdl \
+ xmloff/source/style/impastp1 \
+ xmloff/source/style/impastp2 \
+ xmloff/source/style/impastp3 \
+ xmloff/source/style/impastp4 \
+ xmloff/source/style/kernihdl \
+ xmloff/source/style/lspachdl \
+ xmloff/source/style/numehelp \
+ xmloff/source/style/opaquhdl \
+ xmloff/source/style/postuhdl \
+ xmloff/source/style/prhdlfac \
+ xmloff/source/style/prstylei \
+ xmloff/source/style/shadwhdl \
+ xmloff/source/style/shdwdhdl \
+ xmloff/source/style/styleexp \
+ xmloff/source/style/tabsthdl \
+ xmloff/source/style/undlihdl \
+ xmloff/source/style/uniref \
+ xmloff/source/style/weighhdl \
+ xmloff/source/style/xmlaustp \
+ xmloff/source/style/xmlbahdl \
+ xmloff/source/style/xmlexppr \
+ xmloff/source/style/xmlimppr \
+ xmloff/source/style/xmlnume \
+ xmloff/source/style/xmlnumfe \
+ xmloff/source/style/xmlnumfi \
+ xmloff/source/style/xmlnumi \
+ xmloff/source/style/xmlprcon \
+ xmloff/source/style/xmlprhdl \
+ xmloff/source/style/xmlprmap \
+ xmloff/source/style/xmlstyle \
+ xmloff/source/style/xmltabe \
+ xmloff/source/style/xmltabi \
+ xmloff/source/table/XMLTableExport \
+ xmloff/source/table/XMLTableImport \
+ xmloff/source/text/XMLAutoMarkFileContext \
+ xmloff/source/text/XMLAutoTextContainerEventImport \
+ xmloff/source/text/XMLAutoTextEventExport \
+ xmloff/source/text/XMLAutoTextEventImport \
+ xmloff/source/text/XMLCalculationSettingsContext \
+ xmloff/source/text/XMLChangeElementImportContext \
+ xmloff/source/text/XMLChangeImportContext \
+ xmloff/source/text/XMLChangeInfoContext \
+ xmloff/source/text/XMLChangedRegionImportContext \
+ xmloff/source/text/XMLFootnoteBodyImportContext \
+ xmloff/source/text/XMLFootnoteConfigurationImportContext \
+ xmloff/source/text/XMLFootnoteImportContext \
+ xmloff/source/text/XMLIndexAlphabeticalSourceContext \
+ xmloff/source/text/XMLIndexBibliographyConfigurationContext \
+ xmloff/source/text/XMLIndexBibliographyEntryContext \
+ xmloff/source/text/XMLIndexBibliographySourceContext \
+ xmloff/source/text/XMLIndexBodyContext \
+ xmloff/source/text/XMLIndexChapterInfoEntryContext \
+ xmloff/source/text/XMLIndexIllustrationSourceContext \
+ xmloff/source/text/XMLIndexMarkExport \
+ xmloff/source/text/XMLIndexObjectSourceContext \
+ xmloff/source/text/XMLIndexSimpleEntryContext \
+ xmloff/source/text/XMLIndexSourceBaseContext \
+ xmloff/source/text/XMLIndexSpanEntryContext \
+ xmloff/source/text/XMLIndexTOCContext \
+ xmloff/source/text/XMLIndexTOCSourceContext \
+ xmloff/source/text/XMLIndexTOCStylesContext \
+ xmloff/source/text/XMLIndexTabStopEntryContext \
+ xmloff/source/text/XMLIndexTableSourceContext \
+ xmloff/source/text/XMLIndexTemplateContext \
+ xmloff/source/text/XMLIndexTitleTemplateContext \
+ xmloff/source/text/XMLIndexUserSourceContext \
+ xmloff/source/text/XMLLineNumberingExport \
+ xmloff/source/text/XMLLineNumberingImportContext \
+ xmloff/source/text/XMLLineNumberingSeparatorImportContext \
+ xmloff/source/text/XMLPropertyBackpatcher \
+ xmloff/source/text/XMLRedlineExport \
+ xmloff/source/text/XMLSectionExport \
+ xmloff/source/text/XMLSectionFootnoteConfigExport \
+ xmloff/source/text/XMLSectionFootnoteConfigImport \
+ xmloff/source/text/XMLSectionImportContext \
+ xmloff/source/text/XMLSectionSourceDDEImportContext \
+ xmloff/source/text/XMLSectionSourceImportContext \
+ xmloff/source/text/XMLStringBufferImportContext \
+ xmloff/source/text/XMLTextCharStyleNamesElementExport \
+ xmloff/source/text/XMLTextColumnsContext \
+ xmloff/source/text/XMLTextColumnsExport \
+ xmloff/source/text/XMLTextFrameContext \
+ xmloff/source/text/XMLTextFrameHyperlinkContext \
+ xmloff/source/text/XMLTextHeaderFooterContext \
+ xmloff/source/text/XMLTextListAutoStylePool \
+ xmloff/source/text/XMLTextListBlockContext \
+ xmloff/source/text/XMLTextListItemContext \
+ xmloff/source/text/XMLTextMarkImportContext \
+ xmloff/source/text/XMLTextMasterPageContext \
+ xmloff/source/text/XMLTextMasterPageExport \
+ xmloff/source/text/XMLTextMasterStylesContext \
+ xmloff/source/text/XMLTextNumRuleInfo \
+ xmloff/source/text/XMLTextPropertySetContext \
+ xmloff/source/text/XMLTextShapeImportHelper \
+ xmloff/source/text/XMLTextShapeStyleContext \
+ xmloff/source/text/XMLTextTableContext \
+ xmloff/source/text/XMLTrackedChangesImportContext \
+ xmloff/source/text/txtdrope \
+ xmloff/source/text/txtdropi \
+ xmloff/source/text/txtexppr \
+ xmloff/source/text/txtflde \
+ xmloff/source/text/txtfldi \
+ xmloff/source/text/txtftne \
+ xmloff/source/text/txtimp \
+ xmloff/source/text/txtimppr \
+ xmloff/source/text/txtlists \
+ xmloff/source/text/txtparae \
+ xmloff/source/text/txtparai \
+ xmloff/source/text/txtprhdl \
+ xmloff/source/text/txtprmap \
+ xmloff/source/text/txtsecte \
+ xmloff/source/text/txtstyle \
+ xmloff/source/text/txtstyli \
+ xmloff/source/text/txtvfldi \
+ xmloff/source/xforms/SchemaContext \
+ xmloff/source/xforms/SchemaRestrictionContext \
+ xmloff/source/xforms/SchemaSimpleTypeContext \
+ xmloff/source/xforms/TokenContext \
+ xmloff/source/xforms/XFormsBindContext \
+ xmloff/source/xforms/XFormsInstanceContext \
+ xmloff/source/xforms/XFormsModelContext \
+ xmloff/source/xforms/XFormsSubmissionContext \
+ xmloff/source/xforms/xformsapi \
+ xmloff/source/xforms/xformsexport \
+ xmloff/source/xforms/xformsimport \
+))
+
+# vim: set noet ts=4 sw=4:
diff --git a/xmloff/Library_xof.mk b/xmloff/Library_xof.mk
new file mode 100644
index 000000000000..2ed555d7ac41
--- /dev/null
+++ b/xmloff/Library_xof.mk
@@ -0,0 +1,91 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 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.
+#
+#*************************************************************************
+
+$(eval $(call gb_Library_Library,xof))
+
+$(eval $(call gb_Library_set_componentfile,xof,xmloff/source/transform/xof))
+
+$(eval $(call gb_Library_set_include,xof,\
+ -I$(realpath $(SRCDIR)/xmloff/inc/pch) \
+ -I$(realpath $(SRCDIR)/xmloff/inc) \
+ $$(INCLUDE) \
+ -I$(OUTDIR)/inc/offuh \
+))
+
+$(eval $(call gb_Library_add_linked_libs,xof,\
+ comphelper \
+ cppu \
+ cppuhelper \
+ sal \
+ salhelper \
+ xo \
+ $(gb_STDLIBS) \
+))
+
+$(eval $(call gb_Library_add_exception_objects,xof,\
+ xmloff/source/transform/ChartOASISTContext \
+ xmloff/source/transform/ChartOOoTContext \
+ xmloff/source/transform/ChartPlotAreaOASISTContext \
+ xmloff/source/transform/ChartPlotAreaOOoTContext \
+ xmloff/source/transform/ControlOASISTContext \
+ xmloff/source/transform/ControlOOoTContext \
+ xmloff/source/transform/CreateElemTContext \
+ xmloff/source/transform/DeepTContext \
+ xmloff/source/transform/DlgOASISTContext \
+ xmloff/source/transform/DocumentTContext \
+ xmloff/source/transform/EventMap \
+ xmloff/source/transform/EventOASISTContext \
+ xmloff/source/transform/EventOOoTContext \
+ xmloff/source/transform/FlatTContext \
+ xmloff/source/transform/FormPropOASISTContext \
+ xmloff/source/transform/FormPropOOoTContext \
+ xmloff/source/transform/FrameOASISTContext \
+ xmloff/source/transform/FrameOOoTContext \
+ xmloff/source/transform/IgnoreTContext \
+ xmloff/source/transform/MergeElemTContext \
+ xmloff/source/transform/MetaTContext \
+ xmloff/source/transform/MutableAttrList \
+ xmloff/source/transform/NotesTContext \
+ xmloff/source/transform/OOo2Oasis \
+ xmloff/source/transform/Oasis2OOo \
+ xmloff/source/transform/PersAttrListTContext \
+ xmloff/source/transform/PersMixedContentTContext \
+ xmloff/source/transform/ProcAddAttrTContext \
+ xmloff/source/transform/ProcAttrTContext \
+ xmloff/source/transform/PropertyActionsOASIS \
+ xmloff/source/transform/PropertyActionsOOo \
+ xmloff/source/transform/RenameElemTContext \
+ xmloff/source/transform/StyleOASISTContext \
+ xmloff/source/transform/StyleOOoTContext \
+ xmloff/source/transform/TransformerActions \
+ xmloff/source/transform/TransformerBase \
+ xmloff/source/transform/TransformerContext \
+ xmloff/source/transform/TransformerTokenMap \
+ xmloff/source/transform/XMLFilterRegistration \
+))
+
+# vim: set noet ts=4 sw=4:
diff --git a/xmloff/Makefile b/xmloff/Makefile
new file mode 100755
index 000000000000..a79aff831024
--- /dev/null
+++ b/xmloff/Makefile
@@ -0,0 +1,38 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+ifeq ($(strip $(SOLARENV)),)
+$(error No environment set!)
+endif
+
+gb_PARTIALBUILD := T
+GBUILDDIR := $(SOLARENV)/gbuild
+include $(GBUILDDIR)/gbuild.mk
+
+$(eval $(call gb_Module_make_global_targets,$(shell ls $(dir $(realpath $(firstword $(MAKEFILE_LIST))))/Module*.mk)))
+
+# vim: set noet sw=4 ts=4:
diff --git a/xmloff/Module_xmloff.mk b/xmloff/Module_xmloff.mk
new file mode 100755
index 000000000000..74a1aa3aaa1e
--- /dev/null
+++ b/xmloff/Module_xmloff.mk
@@ -0,0 +1,44 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 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.
+#
+#*************************************************************************
+
+$(eval $(call gb_Module_Module,xmloff))
+
+$(eval $(call gb_Module_add_targets,xmloff,\
+ Library_xo \
+ Library_xof \
+ Package_dtd \
+ Package_inc \
+))
+
+$(eval $(call gb_Module_add_subsequentcheck_targets,xmloff,\
+ JunitTest_xmloff_unoapi \
+))
+
+#todo: map file
+#todo: xmlkywd.lib - built, but never used?!
+
+# vim: set noet ts=4 sw=4:
diff --git a/xmloff/Package_dtd.mk b/xmloff/Package_dtd.mk
new file mode 100755
index 000000000000..7f2d5a4e0f1d
--- /dev/null
+++ b/xmloff/Package_dtd.mk
@@ -0,0 +1,45 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 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.
+#
+#*************************************************************************
+
+$(eval $(call gb_Package_Package,xmloff_dtd,$(SRCDIR)/xmloff/dtd))
+$(eval $(call gb_Package_add_file,xmloff_dtd,bin/Blocklist.dtd,Blocklist.dtd))
+$(eval $(call gb_Package_add_file,xmloff_dtd,bin/chart.mod,chart.mod))
+$(eval $(call gb_Package_add_file,xmloff_dtd,bin/datastyl.mod,datastyl.mod))
+$(eval $(call gb_Package_add_file,xmloff_dtd,bin/defs.mod,defs.mod))
+$(eval $(call gb_Package_add_file,xmloff_dtd,bin/drawing.mod,drawing.mod))
+$(eval $(call gb_Package_add_file,xmloff_dtd,bin/dtypes.mod,dtypes.mod))
+$(eval $(call gb_Package_add_file,xmloff_dtd,bin/form.mod,form.mod))
+$(eval $(call gb_Package_add_file,xmloff_dtd,bin/meta.mod,meta.mod))
+$(eval $(call gb_Package_add_file,xmloff_dtd,bin/nmspace.mod,nmspace.mod))
+$(eval $(call gb_Package_add_file,xmloff_dtd,bin/office.dtd,office.dtd))
+$(eval $(call gb_Package_add_file,xmloff_dtd,bin/office.mod,office.mod))
+$(eval $(call gb_Package_add_file,xmloff_dtd,bin/openoffice-2.0-schema.rng,openoffice-2.0-schema.rng))
+$(eval $(call gb_Package_add_file,xmloff_dtd,bin/script.mod,script.mod))
+$(eval $(call gb_Package_add_file,xmloff_dtd,bin/settings.mod,settings.mod))
+$(eval $(call gb_Package_add_file,xmloff_dtd,bin/style.mod,style.mod))
+$(eval $(call gb_Package_add_file,xmloff_dtd,bin/table.mod,table.mod))
+$(eval $(call gb_Package_add_file,xmloff_dtd,bin/text.mod,text.mod))
diff --git a/xmloff/Package_inc.mk b/xmloff/Package_inc.mk
new file mode 100755
index 000000000000..4e11c2b4b5d9
--- /dev/null
+++ b/xmloff/Package_inc.mk
@@ -0,0 +1,131 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 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.
+#
+#*************************************************************************
+
+$(eval $(call gb_Package_Package,xmloff_inc,$(SRCDIR)/xmloff/inc))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/DashStyle.hxx,xmloff/DashStyle.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/DocumentSettingsContext.hxx,xmloff/DocumentSettingsContext.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/EnumPropertyHdl.hxx,xmloff/EnumPropertyHdl.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/GradientStyle.hxx,xmloff/GradientStyle.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/HatchStyle.hxx,xmloff/HatchStyle.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/ImageStyle.hxx,xmloff/ImageStyle.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/MarkerStyle.hxx,xmloff/MarkerStyle.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/NamedBoolPropertyHdl.hxx,xmloff/NamedBoolPropertyHdl.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/PageMasterStyleMap.hxx,xmloff/PageMasterStyleMap.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/ProgressBarHelper.hxx,xmloff/ProgressBarHelper.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/PropertySetInfoHash.hxx,xmloff/PropertySetInfoHash.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/PropertySetInfoKey.hxx,xmloff/PropertySetInfoKey.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/SchXMLExportHelper.hxx,xmloff/SchXMLExportHelper.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/SchXMLImportHelper.hxx,xmloff/SchXMLImportHelper.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/SettingsExportHelper.hxx,xmloff/SettingsExportHelper.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/SinglePropertySetInfoCache.hxx,xmloff/SinglePropertySetInfoCache.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/VisAreaContext.hxx,xmloff/VisAreaContext.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/VisAreaExport.hxx,xmloff/VisAreaExport.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/WordWrapPropertyHdl.hxx,xmloff/WordWrapPropertyHdl.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/XMLBase64ImportContext.hxx,xmloff/XMLBase64ImportContext.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/XMLCharContext.hxx,xmloff/XMLCharContext.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/XMLConstantsPropertyHandler.hxx,xmloff/XMLConstantsPropertyHandler.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/XMLEmbeddedObjectExportFilter.hxx,xmloff/XMLEmbeddedObjectExportFilter.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/XMLEventExport.hxx,xmloff/XMLEventExport.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/XMLEventsImportContext.hxx,xmloff/XMLEventsImportContext.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/XMLFilterServiceNames.h,xmloff/XMLFilterServiceNames.h))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/XMLFontAutoStylePool.hxx,xmloff/XMLFontAutoStylePool.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/XMLFontStylesContext.hxx,xmloff/XMLFontStylesContext.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/XMLGraphicsDefaultStyle.hxx,xmloff/XMLGraphicsDefaultStyle.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/XMLPageExport.hxx,xmloff/XMLPageExport.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/XMLSettingsExportContext.hxx,xmloff/XMLSettingsExportContext.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/XMLShapeStyleContext.hxx,xmloff/XMLShapeStyleContext.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/XMLStringVector.hxx,xmloff/XMLStringVector.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/XMLTextListAutoStylePool.hxx,xmloff/XMLTextListAutoStylePool.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/XMLTextMasterPageContext.hxx,xmloff/XMLTextMasterPageContext.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/XMLTextMasterPageExport.hxx,xmloff/XMLTextMasterPageExport.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/XMLTextMasterStylesContext.hxx,xmloff/XMLTextMasterStylesContext.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/XMLTextShapeImportHelper.hxx,xmloff/XMLTextShapeImportHelper.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/XMLTextShapeImportHelper.hxx,xmloff/XMLTextShapeImportHelper.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/XMLTextShapeStyleContext.hxx,xmloff/XMLTextShapeStyleContext.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/XMLTextTableContext.hxx,xmloff/XMLTextTableContext.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/animexp.hxx,xmloff/animexp.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/attrlist.hxx,xmloff/attrlist.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/contextid.hxx,xmloff/contextid.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/controlpropertyhdl.hxx,xmloff/controlpropertyhdl.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/dllapi.h,xmloff/dllapi.h))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/families.hxx,xmloff/families.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/formlayerexport.hxx,xmloff/formlayerexport.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/formlayerimport.hxx,xmloff/formlayerimport.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/formsimp.hxx,xmloff/formsimp.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/functional.hxx,xmloff/functional.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/i18nmap.hxx,xmloff/i18nmap.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/maptype.hxx,xmloff/maptype.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/nmspmap.hxx,xmloff/nmspmap.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/numehelp.hxx,xmloff/numehelp.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/odffields.hxx,xmloff/odffields.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/prhdlfac.hxx,xmloff/prhdlfac.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/prstylei.hxx,xmloff/prstylei.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/shapeexport.hxx,xmloff/shapeexport.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/shapeimport.hxx,xmloff/shapeimport.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/styleexp.hxx,xmloff/styleexp.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/table/XMLTableExport.hxx,xmloff/table/XMLTableExport.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/table/XMLTableImport.hxx,xmloff/table/XMLTableImport.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/txtimp.hxx,xmloff/txtimp.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/txtimppr.hxx,xmloff/txtimppr.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/txtparae.hxx,xmloff/txtparae.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/txtprmap.hxx,xmloff/txtprmap.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/txtstyle.hxx,xmloff/txtstyle.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/txtstyli.hxx,xmloff/txtstyli.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/uniref.hxx,xmloff/uniref.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/unoatrcn.hxx,xmloff/unoatrcn.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/xformsexport.hxx,xmloff/xformsexport.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/xformsimport.hxx,xmloff/xformsimport.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/xmlaustp.hxx,xmloff/xmlaustp.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/xmlcnimp.hxx,xmloff/xmlcnimp.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/xmlcnitm.hxx,xmloff/xmlcnitm.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/xmlement.hxx,xmloff/xmlement.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/xmlerror.hxx,xmloff/xmlerror.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/xmlevent.hxx,xmloff/xmlevent.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/xmlexp.hxx,xmloff/xmlexp.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/xmlexppr.hxx,xmloff/xmlexppr.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/xmlictxt.hxx,xmloff/xmlictxt.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/xmlimp.hxx,xmloff/xmlimp.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/xmlimppr.hxx,xmloff/xmlimppr.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/xmlkywd.hxx,xmloff/xmlkywd.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/xmlmetae.hxx,xmloff/xmlmetae.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/xmlmetai.hxx,xmloff/xmlmetai.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/xmlnmspe.hxx,xmloff/xmlnmspe.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/xmlnume.hxx,xmloff/xmlnume.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/xmlnumfe.hxx,xmloff/xmlnumfe.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/xmlnumfi.hxx,xmloff/xmlnumfi.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/xmlnumi.hxx,xmloff/xmlnumi.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/xmlprcon.hxx,xmloff/xmlprcon.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/xmlprhdl.hxx,xmloff/xmlprhdl.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/xmlprmap.hxx,xmloff/xmlprmap.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/xmlreg.hxx,xmloff/xmlreg.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/xmlscripti.hxx,xmloff/xmlscripti.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/xmlstyle.hxx,xmloff/xmlstyle.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/xmltabe.hxx,xmloff/xmltabe.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/xmltkmap.hxx,xmloff/xmltkmap.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/xmltoken.hxx,xmloff/xmltoken.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/xmltypes.hxx,xmloff/xmltypes.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/xmluconv.hxx,xmloff/xmluconv.hxx))
diff --git a/xmloff/dtd/Blocklist.dtd b/xmloff/dtd/Blocklist.dtd
new file mode 100755
index 000000000000..f7bb8eb321bb
--- /dev/null
+++ b/xmloff/dtd/Blocklist.dtd
@@ -0,0 +1,34 @@
+<!--
+
+ 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.
+
+-->
+<!ELEMENT block-list:block-list (block-list:block*) >
+<!ATTLIST block-list:block-list
+ block-list:list-name CDATA #REQUIRED>
+<!ELEMENT block-list:block EMPTY>
+<!ATTLIST block-list:block
+ block-list:abbreviated-name CDATA #REQUIRED
+ block-list:package-name CDATA #REQUIRED
+ block-list:name CDATA #REQUIRED>
diff --git a/xmloff/dtd/chart.mod b/xmloff/dtd/chart.mod
new file mode 100755
index 000000000000..e72bab68c3f9
--- /dev/null
+++ b/xmloff/dtd/chart.mod
@@ -0,0 +1,262 @@
+<!--
+
+ 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.
+
+-->
+
+
+<!ENTITY % chart-class "(line|area|circle|ring|scatter|radar|bar|stock|add-in)">
+<!ENTITY % chart-solid-type "(cuboid|cylinder|cone|pyramid)">
+
+<!-- Chart element -->
+<!ELEMENT chart:chart ( chart:title?, chart:subtitle?, chart:legend?,
+ chart:plot-area,
+ table:table? )>
+<!ATTLIST chart:chart
+ chart:class %chart-class; #REQUIRED
+ chart:add-in-name %string; #IMPLIED
+ chart:table-number-list %string; #IMPLIED
+ draw:name %string; #IMPLIED
+ %draw-position;
+ %draw-size;
+ %draw-style-name;
+ chart:column-mapping %string; #IMPLIED
+ chart:row-mapping %string; #IMPLIED
+ chart:style-name %styleName; #IMPLIED>
+
+<!ATTLIST chart:chart %presentation-class; >
+<!ATTLIST chart:chart %zindex;>
+<!ATTLIST chart:chart %draw-end-position; >
+<!ATTLIST chart:chart draw:id %draw-shape-id; >
+<!ATTLIST chart:chart draw:layer %layerName; #IMPLIED>
+
+<!ATTLIST style:properties
+ chart:scale-text %boolean; "true"
+ chart:stock-updown-bars %boolean; "false"
+ chart:stock-with-volume %boolean; "false"
+ chart:three-dimensional %boolean; "false"
+ chart:deep %boolean; "false"
+ chart:lines %boolean; "false"
+ chart:percentage %boolean; "false"
+ chart:solid-type %chart-solid-type; "cuboid"
+ chart:splines %nonNegativeInteger; "0"
+ chart:stacked %boolean; "false"
+ chart:symbol %integer; "-1"
+ chart:vertical %boolean; "false"
+ chart:lines-used %nonNegativeInteger; "0"
+ chart:connect-bars %boolean; "false"
+ chart:spline-order %nonNegativeInteger; "2"
+ chart:spline-resolution %nonNegativeInteger; "20"
+ chart:pie-offset %nonNegativeInteger; "0">
+
+<!-- Main/Sub Title -->
+<!-- the cell-address attribute is currently not supported for titles -->
+<!ELEMENT chart:title (text:p)?>
+<!ATTLIST chart:title
+ table:cell-range %cell-address; #IMPLIED
+ svg:x %coordinate; #IMPLIED
+ svg:y %coordinate; #IMPLIED
+ chart:style-name %styleName; #IMPLIED >
+
+<!ELEMENT chart:subtitle (text:p)?>
+<!ATTLIST chart:subtitle
+ table:cell-range %cell-address; #IMPLIED
+ svg:x %coordinate; #IMPLIED
+ svg:y %coordinate; #IMPLIED
+ chart:style-name %styleName; #IMPLIED >
+
+<!-- you must specify either a legend-position or both, x and y coordinates -->
+<!ELEMENT chart:legend EMPTY>
+<!ATTLIST chart:legend
+ chart:legend-position (top|left|bottom|right) "right"
+ svg:x %coordinate; #IMPLIED
+ svg:y %coordinate; #IMPLIED
+ chart:style-name %styleName; #IMPLIED >
+
+<!-- Plot-Area specification -->
+
+<!ELEMENT chart:plot-area (dr3d:light*,
+ chart:axis*,
+ chart:categories?,
+ chart:series*,
+ chart:stock-gain-marker?,
+ chart:stock-loss-marker?,
+ chart:stock-range-line?,
+ chart:wall?,
+ chart:floor?) >
+
+<!ATTLIST chart:plot-area
+ svg:x %coordinate; #IMPLIED
+ svg:y %coordinate; #IMPLIED
+ svg:width %length; #IMPLIED
+ svg:height %length; #IMPLIED
+ chart:style-name %styleName; #IMPLIED
+ table:cell-range-address %cell-range-address; #IMPLIED
+ chart:table-number-list %string; #IMPLIED
+ chart:data-source-has-labels (none|row|column|both) "none" >
+
+<!-- 3d scene attributes on plot-area -->
+<!ATTLIST chart:plot-area
+ dr3d:vrp %vector3D; #IMPLIED
+ dr3d:vpn %vector3D; #IMPLIED
+ dr3d:vup %vector3D; #IMPLIED
+ dr3d:projection (parallel|perspective) #IMPLIED
+ dr3d:transform CDATA #IMPLIED
+ dr3d:distance %length; #IMPLIED
+ dr3d:focal-length %length; #IMPLIED
+ dr3d:shadow-slant %nonNegativeInteger; #IMPLIED
+ dr3d:shade-mode (flat|phong|gouraud|draft) #IMPLIED
+ dr3d:ambient-color %color; #IMPLIED
+ dr3d:lighting-mode %boolean; #IMPLIED >
+
+<!ATTLIST style:properties
+ chart:series-source (columns|rows) "columns" >
+
+<!ELEMENT chart:wall EMPTY>
+<!ATTLIST chart:wall
+ svg:width %length; #IMPLIED
+ chart:style-name %styleName; #IMPLIED >
+
+<!ELEMENT chart:floor EMPTY>
+<!ATTLIST chart:floor
+ svg:width %length; #IMPLIED
+ chart:style-name %styleName; #IMPLIED >
+
+<!-- Stock chart elements -->
+
+<!ELEMENT chart:stock-gain-marker EMPTY>
+<!ATTLIST chart:stock-gain-marker
+ chart:style-name %styleName; #IMPLIED >
+
+<!ELEMENT chart:stock-loss-marker EMPTY>
+<!ATTLIST chart:stock-loss-marker
+ chart:style-name %styleName; #IMPLIED >
+
+<!ELEMENT chart:stock-range-line EMPTY>
+<!ATTLIST chart:stock-range-line
+ chart:style-name %styleName; #IMPLIED >
+
+<!-- Axis -->
+
+<!ELEMENT chart:axis (chart:title?, chart:grid*)>
+<!ATTLIST chart:axis
+ chart:class (category|value|series|domain) #REQUIRED
+ chart:name %string; #IMPLIED
+ chart:style-name %styleName; #IMPLIED >
+
+<!ATTLIST style:properties
+ chart:tick-marks-major-inner %boolean; "false"
+ chart:tick-marks-major-outer %boolean; "true"
+ chart:tick-marks-minor-inner %boolean; "false"
+ chart:tick-marks-minor-outer %boolean; "false"
+ chart:logarithmic %boolean; "false"
+ chart:maximum %float; #IMPLIED
+ chart:minimum %float; #IMPLIED
+ chart:origin %float; #IMPLIED
+ chart:interval-major %float; #IMPLIED
+ chart:interval-minor %float; #IMPLIED
+ chart:gap-width %integer; #IMPLIED
+ chart:overlap %integer; #IMPLIED
+ text:line-break %boolean; "true"
+ chart:display-label %boolean; "true"
+ chart:label-arrangement (side-by-side|stagger-even|stagger-odd) "side-by-side"
+ chart:text-overlap %boolean; "false"
+ chart:visible %boolean; "true"
+ chart:link-data-style-to-source %boolean; "true" >
+
+<!ELEMENT chart:grid EMPTY>
+<!ATTLIST chart:grid
+ chart:class (major|minor) "major"
+ chart:style-name %styleName; #IMPLIED >
+
+
+<!ELEMENT chart:categories EMPTY>
+<!ATTLIST chart:categories
+ table:cell-range-address %cell-range-address; #IMPLIED >
+
+<!--
+ each series element must have an cell-range-address element that points
+ to the underlying table data.
+ Impl. Note: Internally all href elements are merged to one table range
+ that represents the data for the whole chart
+-->
+<!ELEMENT chart:series ( chart:domain*,
+ chart:mean-value?,
+ chart:regression-curve?,
+ chart:error-indicator?,
+ chart:data-point* )>
+<!ATTLIST chart:series
+ chart:values-cell-range-address %cell-range-address; #IMPLIED
+ chart:label-cell-address %cell-address; #IMPLIED
+ chart:class %chart-class; #IMPLIED
+ chart:attached-axis %string; #IMPLIED
+ chart:style-name %styleName; #IMPLIED >
+
+<!ELEMENT chart:domain EMPTY>
+<!ATTLIST chart:domain
+ table:cell-range-address %cell-range-address; #IMPLIED >
+
+<!ELEMENT chart:data-point EMPTY>
+<!ATTLIST chart:data-point
+ chart:repeated %nonNegativeInteger; #IMPLIED
+ chart:style-name %styleName; #IMPLIED >
+
+<!-- statistical properties -->
+
+<!ELEMENT chart:mean-value EMPTY>
+<!ELEMENT chart:regression-curve EMPTY >
+<!ELEMENT chart:error-indicator EMPTY >
+<!ATTLIST chart:mean-value chart:style-name %styleName; #IMPLIED >
+<!ATTLIST chart:regression-curve chart:style-name %styleName; #IMPLIED >
+<!ATTLIST chart:error-indicator chart:style-name %styleName; #IMPLIED >
+
+<!ATTLIST style:properties
+ chart:mean-value %boolean; #IMPLIED
+ chart:error-category (none|variance|standard-deviation|percentage|error-margin|constant) "none"
+ chart:error-percentage %float; #IMPLIED
+ chart:error-margin %float; #IMPLIED
+ chart:error-lower-limit %float; #IMPLIED
+ chart:error-upper-limit %float; #IMPLIED
+ chart:error-upper-indicator %boolean; #IMPLIED
+ chart:error-lower-indicator %boolean; #IMPLIED
+ chart:regression-type (none|linear|logarithmic|exponential|power) "none" >
+
+<!-- data label properties -->
+
+<!ATTLIST style:properties
+ chart:data-label-number (none|value|percentage) "none"
+ chart:data-label-text %boolean; "false"
+ chart:data-label-symbol %boolean; "false" >
+
+<!-- general text properties -->
+
+<!ATTLIST style:properties
+ text:rotation-angle %integer; "0" >
+
+<!-- symbol properties -->
+
+<!ATTLIST style:properties
+ chart:symbol-width %nonNegativeLength; #IMPLIED
+ chart:symbol-height %nonNegativeLength; #IMPLIED
+ chart:symbol-image-name %string; #IMPLIED >
diff --git a/xmloff/dtd/datastyl.mod b/xmloff/dtd/datastyl.mod
new file mode 100755
index 000000000000..daacfad66f5b
--- /dev/null
+++ b/xmloff/dtd/datastyl.mod
@@ -0,0 +1,208 @@
+<!--
+
+ 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.
+
+-->
+
+<!-- data styles -->
+<!ENTITY % any-number "( number:number | number:scientific-number | number:fraction )">
+<!ENTITY % number-style-content "( (number:text,(%any-number;,number:text?)?) | (%any-number;,number:text?) )">
+<!ELEMENT number:number-style ( style:properties?, %number-style-content;, style:map* )>
+<!ELEMENT number:number ( number:embedded-text* )>
+<!ELEMENT number:scientific-number EMPTY>
+<!ELEMENT number:fraction EMPTY>
+
+<!ELEMENT number:embedded-text (#PCDATA)>
+<!ATTLIST number:embedded-text number:position %integer; #REQUIRED>
+
+<!ENTITY % currency-symbol-and-text "number:currency-symbol,number:text?">
+<!ENTITY % number-and-text "number:number,number:text?">
+<!ENTITY % currency-symbol-and-number "((%number-and-text;),(%currency-symbol-and-text;)?) | ((%currency-symbol-and-text;),(%number-and-text;)?)">
+<!ENTITY % currency-style-content "number:text?, (%currency-symbol-and-number;)?">
+
+<!ELEMENT number:currency-style ( style:properties?, (%currency-style-content;), style:map* )>
+<!ELEMENT number:currency-symbol (#PCDATA)>
+<!ATTLIST number:currency-symbol number:language CDATA #IMPLIED>
+<!ATTLIST number:currency-symbol number:country CDATA #IMPLIED>
+
+<!ENTITY % percentage-style-content "( (number:text,(%number-and-text;)?) | (%number-and-text;) )">
+<!ELEMENT number:percentage-style ( style:properties?, %percentage-style-content;, style:map* )>
+
+<!ENTITY % any-date "( number:day | number:month | number:year | number:era | number:day-of-week | number:week-of-year | number:quarter| number:hours | number:am-pm | number:minutes | number:seconds )">
+<!ENTITY % date-style-content "( (number:text,(%any-date;,number:text?)+) | (%any-date;,number:text?)+ )">
+<!ELEMENT number:date-style ( style:properties?, %date-style-content;, style:map* )>
+<!ELEMENT number:day EMPTY>
+<!ATTLIST number:day number:style (short|long) "short">
+<!ATTLIST number:day number:calendar CDATA #IMPLIED>
+<!ELEMENT number:month EMPTY>
+<!ATTLIST number:month number:textual %boolean; "false">
+<!ATTLIST number:month number:style (short|long) "short">
+<!ATTLIST number:month number:calendar CDATA #IMPLIED>
+<!ELEMENT number:year EMPTY>
+<!ATTLIST number:year number:style (short|long) "short">
+<!ATTLIST number:year number:calendar CDATA #IMPLIED>
+<!ELEMENT number:era EMPTY>
+<!ATTLIST number:era number:style (short|long) "short">
+<!ATTLIST number:era number:calendar CDATA #IMPLIED>
+<!ELEMENT number:day-of-week EMPTY>
+<!ATTLIST number:day-of-week number:style (short|long) "short">
+<!ATTLIST number:day-of-week number:calendar CDATA #IMPLIED>
+<!ELEMENT number:week-of-year EMPTY>
+<!ATTLIST number:week-of-year number:calendar CDATA #IMPLIED>
+<!ELEMENT number:quarter EMPTY>
+<!ATTLIST number:quarter number:style (short|long) "short">
+<!ATTLIST number:quarter number:calendar CDATA #IMPLIED>
+
+<!ENTITY % any-time "( number:hours | number:am-pm | number:minutes | number:seconds )">
+<!ENTITY % time-style-content "( (number:text,(%any-time;,number:text?)+) | (%any-time;,number:text?)+)">
+<!ELEMENT number:time-style ( style:properties?, %time-style-content;, style:map* )>
+<!ELEMENT number:hours EMPTY>
+<!ATTLIST number:hours number:style (short|long) "short">
+<!ELEMENT number:minutes EMPTY>
+<!ATTLIST number:minutes number:style (short|long) "short">
+<!ELEMENT number:seconds EMPTY>
+<!ATTLIST number:seconds number:style (short|long) "short">
+<!ATTLIST number:seconds number:decimal-places %integer; "0">
+<!ELEMENT number:am-pm EMPTY>
+
+<!ENTITY % boolean-style-content "( (number:text,(number:boolean,number:text?)?) | (number:boolean,number:text?) )">
+<!ELEMENT number:boolean-style ( style:properties?,%boolean-style-content;, style:map* )>
+<!ELEMENT number:boolean EMPTY>
+
+<!ENTITY % text-style-content "( (number:text,(number:text-content,number:text?)?) | (number:text-content,number:text?) )">
+<!ELEMENT number:text-style ( style:properties?,%text-style-content;, style:map* )>
+<!ELEMENT number:text (#PCDATA)>
+<!ELEMENT number:text-content EMPTY>
+
+<!ATTLIST number:number-style style:name %styleName; #REQUIRED>
+<!ATTLIST number:currency-style style:name %styleName; #REQUIRED>
+<!ATTLIST number:percentage-style style:name %styleName; #REQUIRED>
+<!ATTLIST number:date-style style:name %styleName; #REQUIRED>
+<!ATTLIST number:time-style style:name %styleName; #REQUIRED>
+<!ATTLIST number:boolean-style style:name %styleName; #REQUIRED>
+<!ATTLIST number:text-style style:name %styleName; #REQUIRED>
+
+<!-- The style:family is redundant and therefor should not exist at all -->
+<!-- Since OOo 1.0/1.1 is exporting this attribute is is an #IMPLIED -->
+<!-- one to avoid validation errors. -->
+<!ATTLIST number:number-style style:family CDATA #IMPLIED>
+<!ATTLIST number:currency-style style:family CDATA #IMPLIED>
+<!ATTLIST number:percentage-style style:family CDATA #IMPLIED>
+<!ATTLIST number:date-style style:family CDATA #IMPLIED>
+<!ATTLIST number:time-style style:family CDATA #IMPLIED>
+<!ATTLIST number:boolean-style style:family CDATA #IMPLIED>
+<!ATTLIST number:text-style style:family CDATA #IMPLIED>
+
+<!ATTLIST number:number-style number:language CDATA #IMPLIED>
+<!ATTLIST number:currency-style number:language CDATA #IMPLIED>
+<!ATTLIST number:percentage-style number:language CDATA #IMPLIED>
+<!ATTLIST number:date-style number:language CDATA #IMPLIED>
+<!ATTLIST number:time-style number:language CDATA #IMPLIED>
+<!ATTLIST number:boolean-style number:language CDATA #IMPLIED>
+<!ATTLIST number:text-style number:language CDATA #IMPLIED>
+
+<!ATTLIST number:number-style number:country CDATA #IMPLIED>
+<!ATTLIST number:currency-style number:country CDATA #IMPLIED>
+<!ATTLIST number:percentage-style number:country CDATA #IMPLIED>
+<!ATTLIST number:date-style number:country CDATA #IMPLIED>
+<!ATTLIST number:time-style number:country CDATA #IMPLIED>
+<!ATTLIST number:boolean-style number:country CDATA #IMPLIED>
+<!ATTLIST number:text-style number:country CDATA #IMPLIED>
+
+<!ATTLIST number:number-style number:title CDATA #IMPLIED>
+<!ATTLIST number:currency-style number:title CDATA #IMPLIED>
+<!ATTLIST number:percentage-style number:title CDATA #IMPLIED>
+<!ATTLIST number:date-style number:title CDATA #IMPLIED>
+<!ATTLIST number:time-style number:title CDATA #IMPLIED>
+<!ATTLIST number:boolean-style number:title CDATA #IMPLIED>
+<!ATTLIST number:text-style number:title CDATA #IMPLIED>
+
+<!ATTLIST number:number-style style:volatile %boolean; #IMPLIED>
+<!ATTLIST number:currency-style style:volatile %boolean; #IMPLIED>
+<!ATTLIST number:percentage-style style:volatile %boolean; #IMPLIED>
+<!ATTLIST number:date-style style:volatile %boolean; #IMPLIED>
+<!ATTLIST number:time-style style:volatile %boolean; #IMPLIED>
+<!ATTLIST number:boolean-style style:volatile %boolean; #IMPLIED>
+<!ATTLIST number:text-style style:volatile %boolean; #IMPLIED>
+
+<!ATTLIST number:number-style number:transliteration-format CDATA "1">
+<!ATTLIST number:currency-style number:transliteration-format CDATA "1">
+<!ATTLIST number:percentage-style number:transliteration-format CDATA "1">
+<!ATTLIST number:date-style number:transliteration-format CDATA "1">
+<!ATTLIST number:time-style number:transliteration-format CDATA "1">
+<!ATTLIST number:boolean-style number:transliteration-format CDATA "1">
+<!ATTLIST number:text-style number:transliteration-format CDATA "1">
+
+<!ATTLIST number:number-style number:transliteration-language CDATA #IMPLIED>
+<!ATTLIST number:currency-style number:transliteration-language CDATA #IMPLIED>
+<!ATTLIST number:percentage-style number:transliteration-language CDATA #IMPLIED>
+<!ATTLIST number:date-style number:transliteration-language CDATA #IMPLIED>
+<!ATTLIST number:time-style number:transliteration-language CDATA #IMPLIED>
+<!ATTLIST number:boolean-style number:transliteration-language CDATA #IMPLIED>
+<!ATTLIST number:text-style number:transliteration-language CDATA #IMPLIED>
+
+<!ATTLIST number:number-style number:transliteration-country CDATA #IMPLIED>
+<!ATTLIST number:currency-style number:transliteration-country CDATA #IMPLIED>
+<!ATTLIST number:percentage-style number:transliteration-country CDATA #IMPLIED>
+<!ATTLIST number:date-style number:transliteration-country CDATA #IMPLIED>
+<!ATTLIST number:time-style number:transliteration-country CDATA #IMPLIED>
+<!ATTLIST number:boolean-style number:transliteration-country CDATA #IMPLIED>
+<!ATTLIST number:text-style number:transliteration-country CDATA #IMPLIED>
+
+<!ATTLIST number:number-style number:transliteration-style (short|medium|long) "short">
+<!ATTLIST number:currency-style number:transliteration-style (short|medium|long) "short">
+<!ATTLIST number:percentage-style number:transliteration-style (short|medium|long) "short">
+<!ATTLIST number:date-style number:transliteration-style (short|medium|long) "short">
+<!ATTLIST number:time-style number:transliteration-style (short|medium|long) "short">
+<!ATTLIST number:boolean-style number:transliteration-style (short|medium|long) "short">
+<!ATTLIST number:text-style number:transliteration-style (short|medium|long) "short">
+
+<!ATTLIST number:currency-style number:automatic-order %boolean; "false">
+<!ATTLIST number:date-style number:automatic-order %boolean; "false">
+
+<!ATTLIST number:date-style number:format-source (fixed|language) "fixed">
+<!ATTLIST number:time-style number:format-source (fixed|language) "fixed">
+
+<!ATTLIST number:time-style number:truncate-on-overflow %boolean; "true">
+
+<!ATTLIST number:number number:decimal-places %integer; #IMPLIED>
+<!ATTLIST number:scientific-number number:decimal-places %integer; #IMPLIED>
+
+<!ATTLIST number:number number:min-integer-digits %integer; #IMPLIED>
+<!ATTLIST number:scientific-number number:min-integer-digits %integer; #IMPLIED>
+<!ATTLIST number:fraction number:min-integer-digits %integer; #IMPLIED>
+
+<!ATTLIST number:number number:grouping %boolean; "false">
+<!ATTLIST number:scientific-number number:grouping %boolean; "false">
+<!ATTLIST number:fraction number:grouping %boolean; "false">
+
+<!ATTLIST number:number number:decimal-replacement CDATA #IMPLIED>
+
+<!ATTLIST number:number number:display-factor %float; "1">
+
+<!ATTLIST number:scientific-number number:min-exponent-digits %integer; #IMPLIED>
+
+<!ATTLIST number:fraction number:min-numerator-digits %integer; #IMPLIED>
+
+<!ATTLIST number:fraction number:min-denominator-digits %integer; #IMPLIED>
diff --git a/xmloff/dtd/defs.mod b/xmloff/dtd/defs.mod
new file mode 100755
index 000000000000..98c964fe99e3
--- /dev/null
+++ b/xmloff/dtd/defs.mod
@@ -0,0 +1,56 @@
+<!--
+
+ 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.
+
+-->
+
+<!-- This module should contain entities intended for content definitions
+ in several other modules. Putting all of them here should remove
+ (some) order dependencies of the other module files
+-->
+
+
+<!-- text marks for tracking changes; usually used inside of paragraphs -->
+<!ENTITY % change-marks "text:change | text:change-start | text:change-end">
+
+<!-- (optional) text declarations; used before the first paragraph -->
+<!ENTITY % text-decls "text:variable-decls?, text:sequence-decls?,
+ text:user-field-decls?, text:dde-connection-decls?,
+ text:alphabetical-index-auto-mark-file?" >
+
+<!-- define the types of text which may occur inside of sections -->
+<!ENTITY % sectionText "(text:h|text:p|text:ordered-list|
+ text:unordered-list|table:table|text:section|
+ text:table-of-content|text:illustration-index|
+ text:table-index|text:object-index|text:user-index|
+ text:alphabetical-index|text:bibliography|
+ text:index-title|%change-marks;)*">
+
+<!ENTITY % headerText "(%text-decls;, (text:h|text:p|text:ordered-list|
+ text:unordered-list|table:table|text:section|
+ text:table-of-content|text:illustration-index|
+ text:table-index|text:object-index|text:user-index|
+ text:alphabetical-index|text:bibliography|
+ text:index-title|%change-marks;)* )">
+
diff --git a/xmloff/dtd/drawing.mod b/xmloff/dtd/drawing.mod
new file mode 100755
index 000000000000..93d7544b4fb9
--- /dev/null
+++ b/xmloff/dtd/drawing.mod
@@ -0,0 +1,861 @@
+<!--
+
+ 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.
+
+-->
+
+<!ENTITY % points "CDATA" >
+<!ENTITY % pathData "CDATA" >
+<!ENTITY % gradient-style "(linear|axial|radial|ellipsoid|square|rectangular)" >
+<!ENTITY % draw-position "svg:x %coordinate; #IMPLIED svg:y %coordinate; #IMPLIED">
+<!ENTITY % draw-end-position "table:end-cell-address %cell-address; #IMPLIED table:end-x %coordinate; #IMPLIED table:end-y %coordinate; #IMPLIED">
+<!ENTITY % draw-size "svg:width %coordinate; #IMPLIED svg:height %coordinate; #IMPLIED">
+<!ENTITY % draw-transform "draw:transform CDATA #IMPLIED">
+<!ENTITY % draw-viewbox "svg:viewBox CDATA #REQUIRED">
+<!ENTITY % draw-style-name "draw:style-name %styleName; #IMPLIED presentation:style-name %styleName; #IMPLIED draw:text-style-name %styleName; #IMPLIED">
+<!ENTITY % draw-shape-id "CDATA #IMPLIED" >
+<!ENTITY % draw-text "(text:p|text:unordered-list|text:ordered-list)*">
+<!ENTITY % zindex "draw:z-index %nonNegativeInteger; #IMPLIED">
+<!ENTITY % distance "CDATA">
+<!ENTITY % rectanglePoint "(top-left|top|top-right|left|center|right|bottom-left|bottom|bottom-right)">
+<!ENTITY % vector3D "CDATA">
+<!ENTITY % text-anchor "text:anchor-type %anchorType; #IMPLIED text:anchor-page-number %positiveInteger; #IMPLIED">
+<!ENTITY % layerName "CDATA">
+<!ENTITY % table-background "table:table-background (true | false) #IMPLIED">
+
+<!-- commont presentation shape attributes -->
+<!ENTITY % presentation-style-name "presentation:style-name %styleName; #IMPLIED">
+<!ENTITY % presentation-classes "(title|outline|subtitle|text|graphic|object|chart|table|orgchart|page|notes)" >
+<!-- ENTITY % presentation-class "presentation:class %presentation-classes; #IMPLIED" -->
+<!ENTITY % presentation-class "presentation:class %presentation-classes; #IMPLIED presentation:placeholder (true|false) #IMPLIED presentation:user-transformed (true|false) #IMPLIED">
+<!ENTITY % presentationEffects "(none|fade|move|stripes|open|close|dissolve|wavyline|random|lines|laser|appear|hide|move-short|checkerboard|rotate|stretch)" >
+<!ENTITY % presentationEffectDirections "(none|from-left|from-top|from-right|from-bottom|from-center|from-upper-left|from-upper-right|from-lower-left|from-lower-right|to-left|to-top|to-right|to-bottom|to-upper-left|to-upper-right|to-lower-right|to-lower-left|path|spiral-inward-left|spiral-inward-right|spiral-outward-left|spiral-outward-right|vertical|horizontal|to-center|clockwise|counter-clockwise)" >
+<!ENTITY % presentationSpeeds "(slow|medium|fast)" >
+
+<!-- Drawing shapes -->
+<!ELEMENT draw:rect ( office:events?, %draw-text; )>
+<!ATTLIST draw:rect %draw-position; >
+<!ATTLIST draw:rect %draw-end-position; >
+<!ATTLIST draw:rect %table-background; >
+<!ATTLIST draw:rect %draw-size; >
+<!ATTLIST draw:rect %draw-style-name; >
+<!ATTLIST draw:rect %draw-transform; >
+<!ATTLIST draw:rect draw:corner-radius %nonNegativeLength; #IMPLIED>
+<!ATTLIST draw:rect %zindex;>
+<!ATTLIST draw:rect draw:id %draw-shape-id;>
+<!ATTLIST draw:rect %text-anchor;>
+<!ATTLIST draw:rect draw:layer %layerName; #IMPLIED>
+
+<!ELEMENT draw:line ( office:events?, %draw-text; )>
+<!ATTLIST draw:line svg:x1 %length; #IMPLIED>
+<!ATTLIST draw:line svg:y1 %length; #IMPLIED>
+<!ATTLIST draw:line svg:x2 %length; #REQUIRED>
+<!ATTLIST draw:line svg:y2 %length; #REQUIRED>
+<!ATTLIST draw:line svg:y %coordinate; #IMPLIED>
+<!ATTLIST draw:line %draw-style-name; >
+<!ATTLIST draw:line %draw-transform; >
+<!ATTLIST draw:line %zindex;>
+<!ATTLIST draw:line %draw-end-position; >
+<!ATTLIST draw:line %table-background; >
+<!ATTLIST draw:line draw:id %draw-shape-id;>
+<!ATTLIST draw:line %text-anchor;>
+<!ATTLIST draw:line draw:layer %layerName; #IMPLIED>
+
+<!ELEMENT draw:polyline ( office:events?, %draw-text; )>
+<!ATTLIST draw:polyline %draw-position; >
+<!ATTLIST draw:polyline %draw-size; >
+<!ATTLIST draw:polyline %draw-viewbox; >
+<!ATTLIST draw:polyline draw:points %points; #REQUIRED>
+<!ATTLIST draw:polyline %draw-style-name; >
+<!ATTLIST draw:polyline %draw-transform; >
+<!ATTLIST draw:polyline %zindex;>
+<!ATTLIST draw:polyline %draw-end-position; >
+<!ATTLIST draw:polyline %table-background; >
+<!ATTLIST draw:polyline draw:id %draw-shape-id;>
+<!ATTLIST draw:polyline %text-anchor;>
+<!ATTLIST draw:polyline draw:layer %layerName; #IMPLIED>
+
+<!ELEMENT draw:polygon ( office:events?, %draw-text; )>
+<!ATTLIST draw:polygon %draw-position; >
+<!ATTLIST draw:polygon %draw-end-position; >
+<!ATTLIST draw:polygon %table-background; >
+<!ATTLIST draw:polygon %draw-size; >
+<!ATTLIST draw:polygon %draw-viewbox; >
+<!ATTLIST draw:polygon draw:points %points; #REQUIRED >
+<!ATTLIST draw:polygon %draw-style-name; >
+<!ATTLIST draw:polygon %draw-transform; >
+<!ATTLIST draw:polygon %zindex;>
+<!ATTLIST draw:polygon draw:id %draw-shape-id;>
+<!ATTLIST draw:polygon %text-anchor;>
+<!ATTLIST draw:polygon draw:layer %layerName; #IMPLIED>
+
+<!ELEMENT draw:path ( office:events?, %draw-text; )>
+<!ATTLIST draw:path %draw-position;>
+<!ATTLIST draw:path %draw-end-position; >
+<!ATTLIST draw:path %table-background; >
+<!ATTLIST draw:path %draw-size; >
+<!ATTLIST draw:path %draw-viewbox; >
+<!ATTLIST draw:path svg:d %pathData; #REQUIRED >
+<!ATTLIST draw:path %draw-style-name; >
+<!ATTLIST draw:path %draw-transform; >
+<!ATTLIST draw:path %zindex;>
+<!ATTLIST draw:path draw:id %draw-shape-id;>
+<!ATTLIST draw:path %text-anchor;>
+<!ATTLIST draw:path draw:layer %layerName; #IMPLIED>
+
+<!ELEMENT draw:circle ( office:events?, %draw-text; )>
+<!ATTLIST draw:circle %draw-position; >
+<!ATTLIST draw:circle %draw-size; >
+<!ATTLIST draw:circle %draw-style-name; >
+<!ATTLIST draw:circle %draw-transform; >
+<!ATTLIST draw:circle %zindex;>
+<!ATTLIST draw:circle %draw-end-position; >
+<!ATTLIST draw:circle %table-background; >
+<!ATTLIST draw:circle draw:id %draw-shape-id;>
+<!ATTLIST draw:circle draw:kind (full|section|cut|arc) "full">
+<!ATTLIST draw:circle draw:start-angle %nonNegativeInteger; #IMPLIED>
+<!ATTLIST draw:circle draw:end-angle %nonNegativeInteger; #IMPLIED>
+<!ATTLIST draw:circle %text-anchor;>
+<!ATTLIST draw:circle draw:layer %layerName; #IMPLIED>
+
+<!ELEMENT draw:ellipse ( office:events?, %draw-text; )>
+<!ATTLIST draw:ellipse %draw-position; >
+<!ATTLIST draw:ellipse %draw-size; >
+<!ATTLIST draw:ellipse %draw-style-name; >
+<!ATTLIST draw:ellipse %draw-transform; >
+<!ATTLIST draw:ellipse %zindex;>
+<!ATTLIST draw:ellipse %draw-end-position; >
+<!ATTLIST draw:ellipse %table-background; >
+<!ATTLIST draw:ellipse draw:id %draw-shape-id;>
+<!ATTLIST draw:ellipse draw:kind (full|section|cut|arc) "full">
+<!ATTLIST draw:ellipse draw:start-angle %nonNegativeInteger; #IMPLIED>
+<!ATTLIST draw:ellipse draw:end-angle %nonNegativeInteger; #IMPLIED>
+<!ATTLIST draw:ellipse %text-anchor;>
+<!ATTLIST draw:ellipse draw:layer %layerName; #IMPLIED>
+
+<!ELEMENT draw:connector ( office:events?, %draw-text;)>
+<!ATTLIST draw:connector draw:type (standard|lines|line|curve) "standard">
+<!ATTLIST draw:connector draw:line-skew CDATA #IMPLIED>
+<!ATTLIST draw:connector %draw-style-name;>
+<!ATTLIST draw:connector svg:x1 %coordinate; #REQUIRED>
+<!ATTLIST draw:connector svg:y1 %coordinate; #REQUIRED>
+<!ATTLIST draw:connector svg:x2 %coordinate; #REQUIRED>
+<!ATTLIST draw:connector svg:y2 %coordinate; #REQUIRED>
+<!ATTLIST draw:connector draw:start-shape %draw-shape-id;>
+<!ATTLIST draw:connector draw:start-glue-point %integer; #IMPLIED>
+<!ATTLIST draw:connector draw:end-shape %draw-shape-id;>
+<!ATTLIST draw:connector draw:end-glue-point %integer; #IMPLIED>
+<!ATTLIST draw:connector %zindex;>
+<!ATTLIST draw:connector %draw-end-position; >
+<!ATTLIST draw:connector %table-background; >
+<!ATTLIST draw:connector draw:id %draw-shape-id;>
+<!ATTLIST draw:connector %text-anchor;>
+<!ATTLIST draw:connector draw:layer %layerName; #IMPLIED>
+
+<!ELEMENT draw:control EMPTY>
+<!ATTLIST draw:control %draw-style-name;>
+<!ATTLIST draw:control %draw-position; >
+<!ATTLIST draw:control %draw-size; >
+<!ATTLIST draw:control %control-id; >
+<!ATTLIST draw:control %zindex;>
+<!ATTLIST draw:control %draw-end-position; >
+<!ATTLIST draw:control %table-background; >
+<!ATTLIST draw:control draw:id %draw-shape-id;>
+<!ATTLIST draw:control %text-anchor;>
+<!ATTLIST draw:control draw:layer %layerName; #IMPLIED>
+
+<!ELEMENT draw:g ( office:events?, (%shapes;)* ) >
+<!ATTLIST draw:g svg:y %coordinate; #IMPLIED>
+<!ATTLIST draw:g %draw-transform; >
+<!ATTLIST draw:g draw:name %string; #IMPLIED>
+<!ATTLIST draw:g %draw-style-name; >
+<!ATTLIST draw:g %zindex;>
+<!ATTLIST draw:g %draw-end-position; >
+<!ATTLIST draw:g %table-background; >
+<!ATTLIST draw:g draw:id %draw-shape-id;>
+<!ATTLIST draw:g %text-anchor;>
+<!ATTLIST draw:g draw:layer %layerName; #IMPLIED>
+
+<!ELEMENT draw:page-thumbnail EMPTY>
+<!ATTLIST draw:page-thumbnail draw:page-number %positiveInteger; #IMPLIED>
+<!ATTLIST draw:page-thumbnail %draw-position; >
+<!ATTLIST draw:page-thumbnail %draw-size; >
+<!ATTLIST draw:page-thumbnail %draw-style-name; >
+<!ATTLIST draw:page-thumbnail %presentation-class; >
+<!ATTLIST draw:page-thumbnail %zindex;>
+<!ATTLIST draw:page-thumbnail %draw-end-position; >
+<!ATTLIST draw:page-thumbnail %table-background; >
+<!ATTLIST draw:page-thumbnail draw:id %draw-shape-id;>
+<!ATTLIST draw:page-thumbnail %text-anchor;>
+<!ATTLIST draw:page-thumbnail draw:layer %layerName; #IMPLIED>
+
+<!ELEMENT draw:caption ( office:events?, %draw-text;)>
+<!ATTLIST draw:caption %draw-position; >
+<!ATTLIST draw:caption %draw-end-position; >
+<!ATTLIST draw:caption %table-background; >
+<!ATTLIST draw:caption %draw-size; >
+<!ATTLIST draw:caption %draw-style-name; >
+<!ATTLIST draw:caption %draw-transform; >
+<!ATTLIST draw:caption draw:caption-point-x %coordinate; #IMPLIED>
+<!ATTLIST draw:caption draw:caption-point-y %coordinate; #IMPLIED>
+<!ATTLIST draw:caption %zindex;>
+<!ATTLIST draw:caption draw:id %draw-shape-id;>
+<!ATTLIST draw:caption %text-anchor;>
+<!ATTLIST draw:caption draw:layer %layerName; #IMPLIED>
+<!ATTLIST draw:caption draw:corner-radius %nonNegativeLength; #IMPLIED>
+
+<!ELEMENT draw:measure ( office:events?, %draw-text;)>
+<!ATTLIST draw:measure svg:x1 %coordinate; #REQUIRED>
+<!ATTLIST draw:measure svg:y1 %coordinate; #REQUIRED>
+<!ATTLIST draw:measure svg:x2 %coordinate; #REQUIRED>
+<!ATTLIST draw:measure svg:y2 %coordinate; #REQUIRED>
+<!ATTLIST draw:measure %draw-end-position; >
+<!ATTLIST draw:measure %table-background; >
+<!ATTLIST draw:measure %draw-style-name; >
+<!ATTLIST draw:measure %draw-transform; >
+<!ATTLIST draw:measure %zindex;>
+<!ATTLIST draw:measure draw:id %draw-shape-id;>
+<!ATTLIST draw:measure %text-anchor;>
+<!ATTLIST draw:measure draw:layer %layerName; #IMPLIED>
+
+<!-- graphic style elements -->
+<!ELEMENT draw:gradient EMPTY >
+<!ATTLIST draw:gradient draw:name %styleName; #REQUIRED>
+<!ATTLIST draw:gradient draw:style %gradient-style; #REQUIRED>
+<!ATTLIST draw:gradient draw:cx %coordinate; #IMPLIED>
+<!ATTLIST draw:gradient draw:cy %coordinate; #IMPLIED>
+<!ATTLIST draw:gradient draw:start-color %color; #IMPLIED>
+<!ATTLIST draw:gradient draw:end-color %color; #IMPLIED>
+<!ATTLIST draw:gradient draw:start-intensity %percentage; #IMPLIED>
+<!ATTLIST draw:gradient draw:end-intensity %percentage; #IMPLIED>
+<!ATTLIST draw:gradient draw:angle %integer; #IMPLIED>
+<!ATTLIST draw:gradient draw:border %percentage; #IMPLIED>
+
+<!ELEMENT draw:hatch EMPTY >
+<!ATTLIST draw:hatch draw:name %styleName; #REQUIRED>
+<!ATTLIST draw:hatch draw:style (single|double|triple) #REQUIRED >
+<!ATTLIST draw:hatch draw:color %color; #IMPLIED>
+<!ATTLIST draw:hatch draw:distance %length; #IMPLIED>
+<!ATTLIST draw:hatch draw:rotation %integer; #IMPLIED>
+
+
+<!ELEMENT draw:fill-image EMPTY >
+<!ATTLIST draw:fill-image draw:name %styleName; #REQUIRED>
+<!ATTLIST draw:fill-image xlink:href %uriReference; #REQUIRED>
+<!ATTLIST draw:fill-image xlink:type (simple) #IMPLIED>
+<!ATTLIST draw:fill-image xlink:show (embed) #IMPLIED>
+<!ATTLIST draw:fill-image xlink:actuate (onLoad) #IMPLIED>
+<!ATTLIST draw:fill-image svg:width %length; #IMPLIED>
+<!ATTLIST draw:fill-image svg:height %length; #IMPLIED>
+
+<!ELEMENT draw:transparency EMPTY>
+<!ATTLIST draw:transparency draw:name %styleName; #REQUIRED>
+<!ATTLIST draw:transparency draw:style %gradient-style; #REQUIRED>
+<!ATTLIST draw:transparency draw:cx %coordinate; #IMPLIED>
+<!ATTLIST draw:transparency draw:cy %coordinate; #IMPLIED>
+<!ATTLIST draw:transparency draw:start %percentage; #IMPLIED>
+<!ATTLIST draw:transparency draw:end %percentage; #IMPLIED>
+<!ATTLIST draw:transparency draw:angle %integer; #IMPLIED>
+<!ATTLIST draw:transparency draw:border %percentage; #IMPLIED>
+
+<!ELEMENT draw:marker EMPTY>
+<!ATTLIST draw:marker draw:name %styleName; #REQUIRED>
+<!ATTLIST draw:marker %draw-viewbox; >
+<!ATTLIST draw:marker svg:d %pathData; #REQUIRED>
+
+<!ELEMENT draw:stroke-dash EMPTY>
+<!ATTLIST draw:stroke-dash draw:name %styleName; #REQUIRED>
+<!ATTLIST draw:stroke-dash draw:style (rect|round) #IMPLIED>
+<!ATTLIST draw:stroke-dash draw:dots1 %integer; #IMPLIED>
+<!ATTLIST draw:stroke-dash draw:dots1-length %length; #IMPLIED>
+<!ATTLIST draw:stroke-dash draw:dots2 %integer; #IMPLIED>
+<!ATTLIST draw:stroke-dash draw:dots2-length %length; #IMPLIED>
+<!ATTLIST draw:stroke-dash draw:distance %length; #IMPLIED>
+
+<!-- stroke attributes -->
+<!ATTLIST style:properties draw:stroke (none|dash|solid) #IMPLIED>
+<!ATTLIST style:properties draw:stroke-dash CDATA #IMPLIED>
+<!ATTLIST style:properties svg:stroke-width %length; #IMPLIED>
+<!ATTLIST style:properties svg:stroke-color %color; #IMPLIED>
+<!ATTLIST style:properties draw:marker-start %styleName; #IMPLIED>
+<!ATTLIST style:properties draw:marker-end %styleName; #IMPLIED>
+<!ATTLIST style:properties draw:marker-start-width %length; #IMPLIED>
+<!ATTLIST style:properties draw:marker-end-width %length; #IMPLIED>
+<!ATTLIST style:properties draw:marker-start-center %boolean; #IMPLIED>
+<!ATTLIST style:properties draw:marker-end-center %boolean; #IMPLIED>
+<!ATTLIST style:properties svg:stroke-opacity %floatOrPercentage; #IMPLIED>
+<!ATTLIST style:properties svg:stroke-linejoin (miter|round|bevel|middle|none|inherit) #IMPLIED>
+
+<!-- text attributes -->
+<!ATTLIST style:properties draw:auto-grow-width %boolean; #IMPLIED>
+<!ATTLIST style:properties draw:auto-grow-height %boolean; #IMPLIED>
+<!ATTLIST style:properties draw:fit-to-size %boolean; #IMPLIED>
+<!ATTLIST style:properties draw:fit-to-contour %boolean; #IMPLIED>
+<!ATTLIST style:properties draw:textarea-horizontal-align ( left | center | right | justify ) #IMPLIED>
+<!ATTLIST style:properties draw:textarea-vertical-align ( top | middle | bottom | justify ) #IMPLIED>
+<!ATTLIST style:properties draw:writing-mode (lr-tb|tb-rl) "lr-tb">
+<!ATTLIST style:properties style:font-independent-line-spacing %boolean; #IMPLIED>
+
+
+<!-- fill attributes -->
+<!ATTLIST style:properties draw:fill (none|solid|bitmap|gradient|hatch) #IMPLIED>
+<!ATTLIST style:properties draw:fill-color %color; #IMPLIED>
+<!ATTLIST style:properties draw:fill-gradient-name %styleName; #IMPLIED>
+<!ATTLIST style:properties draw:gradient-step-count CDATA #IMPLIED>
+<!ATTLIST style:properties draw:fill-hatch-name %styleName; #IMPLIED>
+<!ATTLIST style:properties draw:fill-hatch-solid %boolean; #IMPLIED>
+<!ATTLIST style:properties draw:fill-image-name %styleName; #IMPLIED>
+<!ATTLIST style:properties style:repeat (no-repeat|repeat|stretch) #IMPLIED>
+<!ATTLIST style:properties draw:fill-image-width %lengthOrPercentage; #IMPLIED>
+<!ATTLIST style:properties draw:fill-image-height %lengthOrPercentage; #IMPLIED>
+<!ATTLIST style:properties draw:fill-image-ref-point-x %percentage; #IMPLIED>
+<!ATTLIST style:properties draw:fill-image-ref-point-y %percentage; #IMPLIED>
+<!ATTLIST style:properties draw:fill-image-ref-point %rectanglePoint; #IMPLIED>
+<!ATTLIST style:properties draw:tile-repeat-offset CDATA #IMPLIED>
+<!ATTLIST style:properties draw:transparency %percentage; #IMPLIED>
+<!ATTLIST style:properties draw:transparency-name %styleName; #IMPLIED>
+
+<!-- graphic attributes -->
+<!ATTLIST style:properties draw:color-mode (greyscale|mono|watermark|standard) #IMPLIED>
+<!ATTLIST style:properties draw:luminance %percentage; #IMPLIED>
+<!ATTLIST style:properties draw:contrast %percentage; #IMPLIED>
+<!ATTLIST style:properties draw:gamma %percentage; #IMPLIED>
+<!ATTLIST style:properties draw:red %percentage; #IMPLIED>
+<!ATTLIST style:properties draw:green %percentage; #IMPLIED>
+<!ATTLIST style:properties draw:blue %percentage; #IMPLIED>
+<!ATTLIST style:properties draw:color-inversion %boolean; #IMPLIED>
+<!ATTLIST style:properties draw:mirror %boolean; #IMPLIED>
+
+<!-- shadow attributes -->
+<!ATTLIST style:properties draw:shadow (visible|hidden) #IMPLIED>
+<!ATTLIST style:properties draw:shadow-offset-x %length; #IMPLIED>
+<!ATTLIST style:properties draw:shadow-offset-y %length; #IMPLIED>
+<!ATTLIST style:properties draw:shadow-color %color; #IMPLIED>
+<!ATTLIST style:properties draw:shadow-transparency CDATA #IMPLIED>
+
+<!-- connector attributes -->
+<!ATTLIST style:properties draw:start-line-spacing-horizontal %distance; #IMPLIED>
+<!ATTLIST style:properties draw:start-line-spacing-vertical %distance; #IMPLIED>
+<!ATTLIST style:properties draw:end-line-spacing-horizontal %distance; #IMPLIED>
+<!ATTLIST style:properties draw:end-line-spacing-vertical %distance; #IMPLIED>
+
+<!-- measure attributes -->
+<!ATTLIST style:properties draw:line-distance %distance; #IMPLIED>
+<!ATTLIST style:properties draw:guide-overhang %distance; #IMPLIED>
+<!ATTLIST style:properties draw:guide-distance %distance; #IMPLIED>
+<!ATTLIST style:properties draw:start-guide %distance; #IMPLIED>
+<!ATTLIST style:properties draw:end-guide %distance; #IMPLIED>
+<!ATTLIST style:properties draw:measure-align (automatic|left-outside|inside|right-outside) #IMPLIED>
+<!ATTLIST style:properties draw:measure-vertical-align (automatic|above|below|center) #IMPLIED>
+<!ATTLIST style:properties draw:unit (automatic|mm|cm|m|km|pt|pc|inch|ft|mi) #IMPLIED>
+<!ATTLIST style:properties draw:show-unit %boolean; #IMPLIED>
+<!ATTLIST style:properties draw:placing (below|above) #IMPLIED>
+<!ATTLIST style:properties draw:parallel %boolean; #IMPLIED>
+<!ATTLIST style:properties draw:decimal-places %nonNegativeLength; #IMPLIED>
+
+<!-- frame attributes -->
+<!ATTLIST style:properties draw:frame-display-scrollbar %boolean; #IMPLIED>
+<!ATTLIST style:properties draw:frame-display-border %boolean; #IMPLIED>
+<!ATTLIST style:properties draw:frame-margin-horizontal %nonNegativePixelLength; #IMPLIED>
+<!ATTLIST style:properties draw:frame-margin-vertical %nonNegativePixelLength; #IMPLIED>
+<!ATTLIST style:properties draw:size-protect %boolean; #IMPLIED>
+<!ATTLIST style:properties draw:move-protect %boolean; #IMPLIED>
+
+<!-- ole object attributes -->
+<!ATTLIST style:properties draw:visible-area-left %nonNegativeLength; #IMPLIED>
+<!ATTLIST style:properties draw:visible-area-top %nonNegativeLength; #IMPLIED>
+<!ATTLIST style:properties draw:visible-area-width %positiveLength; #IMPLIED>
+<!ATTLIST style:properties draw:visible-area-height %positiveLength; #IMPLIED>
+
+<!-- fontwork attributes -->
+<!ATTLIST style:properties draw:fontwork-style (rotate|upright|slant-x|slant-y|none) #IMPLIED>
+<!ATTLIST style:properties draw:fontwork-adjust (left|right|autosize|center) #IMPLIED>
+<!ATTLIST style:properties draw:fontwork-distance %distance; #IMPLIED>
+<!ATTLIST style:properties draw:fontwork-start %distance; #IMPLIED>
+<!ATTLIST style:properties draw:fontwork-mirror %boolean; #IMPLIED>
+<!ATTLIST style:properties draw:fontwork-outline %boolean; #IMPLIED>
+<!ATTLIST style:properties draw:fontwork-shadow (normal|slant|none) #IMPLIED>
+<!ATTLIST style:properties draw:fontwork-shadow-color %color; #IMPLIED>
+<!ATTLIST style:properties draw:fontwork-shadow-offset-x %distance; #IMPLIED>
+<!ATTLIST style:properties draw:fontwork-shadow-offset-y %distance; #IMPLIED>
+<!ATTLIST style:properties draw:fontwork-form (none|top-circle|bottom-circle|left-circle|right-circle|top-arc|bottom-arc|left-arc|right-arc|button1|button2|button3|button4) #IMPLIED>
+<!ATTLIST style:properties draw:fontwork-hide-form %boolean; #IMPLIED>
+<!ATTLIST style:properties draw:fontwork-shadow-transparence %percentage; #IMPLIED>
+
+<!-- caption attributes -->
+<!ATTLIST style:properties draw:caption-type (straight-line|angled-line|angled-connector-line) #IMPLIED>
+<!ATTLIST style:properties draw:caption-angle-type (fixed|free) #IMPLIED>
+<!ATTLIST style:properties draw:caption-angle %nonNegativeInteger; #IMPLIED>
+<!ATTLIST style:properties draw:caption-gap %distance; #IMPLIED>
+<!ATTLIST style:properties draw:caption-escape-direction (horizontal|vertical|auto) #IMPLIED>
+<!ATTLIST style:properties draw:caption-escape %lengthOrPercentage; #IMPLIED>
+<!ATTLIST style:properties draw:caption-line-length %distance; #IMPLIED>
+<!ATTLIST style:properties draw:caption-fit-line-length %boolean; #IMPLIED>
+
+<!-- Animations -->
+<!ELEMENT presentation:sound EMPTY>
+<!ATTLIST presentation:sound xlink:href %uriReference; #REQUIRED>
+<!ATTLIST presentation:sound xlink:type (simple) #FIXED "simple">
+<!ATTLIST presentation:sound xlink:show (new|replace) #IMPLIED>
+<!ATTLIST presentation:sound xlink:actuate (onRequest) "onRequest">
+<!ATTLIST presentation:sound presentation:play-full %boolean; #IMPLIED>
+
+<!ELEMENT presentation:show-shape (presentation:sound)?>
+<!ATTLIST presentation:show-shape draw:shape-id CDATA #REQUIRED>
+<!ATTLIST presentation:show-shape presentation:effect %presentationEffects; "none">
+<!ATTLIST presentation:show-shape presentation:direction %presentationEffectDirections; "none">
+<!ATTLIST presentation:show-shape presentation:speed %presentationSpeeds; "medium">
+<!ATTLIST presentation:show-shape presentation:start-scale %percentage; "100&#37;">
+<!ATTLIST presentation:show-shape presentation:path-id CDATA #IMPLIED >
+
+<!ELEMENT presentation:show-text (presentation:sound)?>
+<!ATTLIST presentation:show-text draw:shape-id CDATA #REQUIRED>
+<!ATTLIST presentation:show-text presentation:effect %presentationEffects; "none">
+<!ATTLIST presentation:show-text presentation:direction %presentationEffectDirections; "none">
+<!ATTLIST presentation:show-text presentation:speed %presentationSpeeds; "medium">
+<!ATTLIST presentation:show-text presentation:start-scale %percentage; "100&#37;">
+<!ATTLIST presentation:show-text presentation:path-id CDATA #IMPLIED >
+
+<!ELEMENT presentation:hide-shape (presentation:sound)?>
+<!ATTLIST presentation:hide-shape draw:shape-id CDATA #REQUIRED>
+<!ATTLIST presentation:hide-shape presentation:effect %presentationEffects; "none">
+<!ATTLIST presentation:hide-shape presentation:direction %presentationEffectDirections; "none">
+<!ATTLIST presentation:hide-shape presentation:speed %presentationSpeeds; "medium">
+<!ATTLIST presentation:hide-shape presentation:start-scale %percentage; "100&#37;">
+<!ATTLIST presentation:hide-shape presentation:path-id CDATA #IMPLIED >
+
+<!ELEMENT presentation:hide-text (presentation:sound)?>
+<!ATTLIST presentation:hide-text draw:shape-id CDATA #REQUIRED>
+<!ATTLIST presentation:hide-text presentation:effect %presentationEffects; "none">
+<!ATTLIST presentation:hide-text presentation:direction %presentationEffectDirections; "none">
+<!ATTLIST presentation:hide-text presentation:speed %presentationSpeeds; "medium">
+<!ATTLIST presentation:hide-text presentation:start-scale %percentage; "100&#37;">
+<!ATTLIST presentation:hide-text presentation:path-id CDATA #IMPLIED >
+
+<!ELEMENT presentation:dim (presentation:sound)?>
+<!ATTLIST presentation:dim draw:shape-id CDATA #REQUIRED>
+<!ATTLIST presentation:dim draw:color %color; #REQUIRED>
+
+<!ELEMENT presentation:play EMPTY>
+<!ATTLIST presentation:play draw:shape-id CDATA #REQUIRED>
+<!ATTLIST presentation:play presentation:speed %presentationSpeeds; "medium">
+
+<!ELEMENT presentation:animations (presentation:show-shape|presentation:show-text|presentation:hide-shape|presentation:hide-text|presentation:dim|presentation:play)*>
+
+<!ELEMENT presentation:show EMPTY>
+<!ATTLIST presentation:show presentation:name %styleName; #REQUIRED>
+<!ATTLIST presentation:show presentation:pages CDATA #REQUIRED>
+
+<!ELEMENT presentation:settings (presentation:show)*>
+<!ATTLIST presentation:settings presentation:start-page %styleName; #IMPLIED>
+<!ATTLIST presentation:settings presentation:show %styleName; #IMPLIED>
+<!ATTLIST presentation:settings presentation:full-screen %boolean; "true">
+<!ATTLIST presentation:settings presentation:endless %boolean; "false">
+<!ATTLIST presentation:settings presentation:pause %timeDuration; #IMPLIED>
+<!ATTLIST presentation:settings presentation:show-logo %boolean; "false">
+<!ATTLIST presentation:settings presentation:force-manual %boolean; "false">
+<!ATTLIST presentation:settings presentation:mouse-visible %boolean; "true">
+<!ATTLIST presentation:settings presentation:mouse-as-pen %boolean; "false">
+<!ATTLIST presentation:settings presentation:start-with-navigator %boolean; "false">
+<!ATTLIST presentation:settings presentation:animations (enabled|disabled) "enabled">
+<!ATTLIST presentation:settings presentation:stay-on-top %boolean; "false">
+<!ATTLIST presentation:settings presentation:transition-on-click (enabled|disabled) "enabled">
+
+<!-- Drawing page -->
+<!ELEMENT draw:page (office:forms?,(%shapes;)*,presentation:animations?,presentation:notes?)>
+<!ATTLIST draw:page draw:name %string; #IMPLIED>
+<!ATTLIST draw:page draw:style-name %styleName; #IMPLIED>
+<!ATTLIST draw:page draw:master-page-name %styleName; #REQUIRED>
+<!ATTLIST draw:page presentation:presentation-page-layout-name %styleName; #IMPLIED>
+<!ATTLIST draw:page draw:id %nonNegativeInteger; #IMPLIED>
+<!ATTLIST draw:page xlink:href %uriReference; #IMPLIED>
+<!ATTLIST draw:page xlink:type (simple) #IMPLIED>
+<!ATTLIST draw:page xlink:show (replace) #IMPLIED>
+<!ATTLIST draw:page xlink:actuate (onRequest) #IMPLIED>
+
+<!-- Presentation notes -->
+<!ELEMENT presentation:notes (%shapes;)*>
+<!ATTLIST presentation:notes style:page-master-name %styleName; #IMPLIED>
+<!ATTLIST presentation:notes draw:style-name %styleName; #IMPLIED>
+
+<!-- presentation page layouts -->
+<!ELEMENT style:presentation-page-layout (presentation:placeholder)* >
+<!ATTLIST style:presentation-page-layout style:name %styleName; #REQUIRED>
+<!ELEMENT presentation:placeholder EMPTY >
+<!ATTLIST presentation:placeholder presentation:object (title|outline|subtitle|text|graphic|object|chart|orgchart|page|notes|handout) #REQUIRED>
+<!ATTLIST presentation:placeholder svg:x %coordinateOrPercentage; #REQUIRED>
+<!ATTLIST presentation:placeholder svg:y %coordinateOrPercentage; #REQUIRED>
+<!ATTLIST presentation:placeholder svg:width %lengthOrPercentage; #REQUIRED>
+<!ATTLIST presentation:placeholder svg:height %lengthOrPercentage; #REQUIRED>
+
+<!-- presentation page attributes -->
+<!ATTLIST style:properties presentation:transition-type (manual|automatic|semi-automatic) #IMPLIED >
+<!ATTLIST style:properties presentation:transition-style (none|fade-from-left|fade-from-top|fade-from-right|fade-from-bottom|fade-to-center|fade-from-center|move-from-left|move-from-top|move-from-right|move-from-bottom|roll-from-top|roll-from-left|roll-from-right|roll-from-bottom|vertical-stripes|horizontal-stripes|clockwise|counterclockwise|fade-from-upperleft|fade-from-upperright|fade-from-lowerleft|fade-from-lowerright|close-vertical|close-horizontal|open-vertical|open-horizontal|spiralin-left|spiralin-right|spiralout-left|spiralout-right|dissolve|wavyline-from-left|wavyline-from-top|wavyline-from-right|wavyline-from-bottom|random|stretch-from-left|stretch-from-top|stretch-from-right|stretch-from-bottom|vertical-lines|horizontal-lines) #IMPLIED >
+<!ATTLIST style:properties presentation:transition-speed %presentationSpeeds; #IMPLIED >
+<!ATTLIST style:properties presentation:duration %timeDuration; #IMPLIED>
+<!ATTLIST style:properties presentation:visibility (visible|hidden) #IMPLIED>
+<!ATTLIST style:properties draw:background-size (full|border) #IMPLIED>
+<!ATTLIST style:properties presentation:background-objects-visible %boolean; #IMPLIED>
+<!ATTLIST style:properties presentation:background-visible %boolean; #IMPLIED>
+
+
+<!-- text boxes -->
+<!ELEMENT draw:text-box (office:events?,draw:image-map?,
+ %sectionText;)>
+<!ATTLIST draw:text-box %draw-style-name;>
+<!ATTLIST draw:text-box %draw-transform; >
+<!ATTLIST draw:text-box draw:name %string; #IMPLIED>
+<!ATTLIST draw:text-box draw:chain-next-name %string; #IMPLIED>
+
+<!ATTLIST draw:text-box %text-anchor;>
+<!ATTLIST draw:text-box %draw-position;>
+<!ATTLIST draw:text-box %draw-end-position; >
+<!ATTLIST draw:text-box %table-background; >
+<!ATTLIST draw:text-box svg:width %lengthOrPercentage; #IMPLIED>
+<!ATTLIST draw:text-box svg:height %lengthOrPercentage; #IMPLIED>
+<!ATTLIST draw:text-box style:rel-width %percentage; #IMPLIED>
+<!ATTLIST draw:text-box style:rel-height %percentage; #IMPLIED>
+<!ATTLIST draw:text-box fo:min-height %lengthOrPercentage; #IMPLIED>
+<!ATTLIST draw:text-box %zindex;>
+<!ATTLIST draw:text-box %presentation-class; >
+<!ATTLIST draw:text-box draw:id %draw-shape-id;>
+<!ATTLIST draw:text-box draw:layer %layerName; #IMPLIED>
+<!ATTLIST draw:text-box draw:corner-radius %nonNegativeLength; #IMPLIED>
+
+<!-- image -->
+<!ELEMENT draw:image (office:binary-data?,office:events?,draw:image-map?,svg:desc?,(draw:contour-polygon|draw:contour-path)?)>
+<!ATTLIST draw:image %draw-transform; >
+<!ATTLIST draw:image %draw-style-name;>
+<!ATTLIST draw:image draw:name %string; #IMPLIED>
+<!ATTLIST draw:image xlink:href %uriReference; #IMPLIED>
+<!ATTLIST draw:image xlink:type (simple) #IMPLIED>
+<!ATTLIST draw:image xlink:show (embed) #IMPLIED>
+<!ATTLIST draw:image xlink:actuate (onLoad) #IMPLIED>
+<!ATTLIST draw:image draw:filter-name %string; #IMPLIED>
+<!ATTLIST draw:image %text-anchor;>
+<!ATTLIST draw:image %draw-position;>
+<!ATTLIST draw:image %draw-end-position; >
+<!ATTLIST draw:image %table-background; >
+<!ATTLIST draw:image svg:width %lengthOrPercentage; #IMPLIED>
+<!ATTLIST draw:image svg:height %lengthOrPercentage; #IMPLIED>
+<!ATTLIST draw:image %presentation-class; >
+<!ATTLIST draw:image %zindex;>
+<!ATTLIST draw:image draw:id %draw-shape-id;>
+<!ATTLIST draw:image draw:layer %layerName; #IMPLIED>
+<!ATTLIST draw:image style:rel-width %percentage; #IMPLIED>
+<!ATTLIST draw:image style:rel-height %percentage; #IMPLIED>
+
+<!-- objects -->
+<!ELEMENT draw:thumbnail EMPTY>
+<!ATTLIST draw:thumbnail xlink:href %uriReference; #REQUIRED>
+<!ATTLIST draw:thumbnail xlink:type (simple) #IMPLIED>
+<!ATTLIST draw:thumbnail xlink:show (embed) #IMPLIED>
+<!ATTLIST draw:thumbnail xlink:actuate (onLoad) #IMPLIED>
+
+<!ELEMENT math:math ANY> <!-- dummy (we have no MathML DTD currently)-->
+<!ELEMENT draw:object (draw:thumbnail?,(office:document|math:math)?,office:events?, draw:image-map?, svg:desc?,(draw:contour-polygon|draw:contour-path)?)>
+<!ATTLIST draw:object %draw-style-name;>
+<!ATTLIST draw:object draw:name %string; #IMPLIED>
+<!ATTLIST draw:object xlink:href %uriReference; #IMPLIED>
+<!ATTLIST draw:object xlink:type (simple) #IMPLIED>
+<!ATTLIST draw:object xlink:show (embed) #IMPLIED>
+<!ATTLIST draw:object xlink:actuate (onLoad) #IMPLIED>
+<!ATTLIST draw:object %text-anchor;>
+<!ATTLIST draw:object %draw-position;>
+<!ATTLIST draw:object %draw-end-position; >
+<!ATTLIST draw:object %table-background; >
+<!ATTLIST draw:object svg:width %lengthOrPercentage; #IMPLIED>
+<!ATTLIST draw:object svg:height %lengthOrPercentage; #IMPLIED>
+<!ATTLIST draw:object %presentation-class; >
+<!ATTLIST draw:object %zindex;>
+<!ATTLIST draw:object draw:id %draw-shape-id;>
+<!ATTLIST draw:object draw:layer %layerName; #IMPLIED>
+<!ATTLIST draw:object draw:notify-on-update-of-ranges %string; #IMPLIED>
+<!ATTLIST draw:object style:rel-width %percentage; #IMPLIED>
+<!ATTLIST draw:object style:rel-height %percentage; #IMPLIED>
+
+<!ELEMENT draw:object-ole (office:binary-data?|office:events?|draw:image-map?|svg:desc?|draw:contour-polygon?|draw:contour-path?|draw:thumbnail?)>
+<!ATTLIST draw:object-ole draw:class-id CDATA #IMPLIED>
+<!ATTLIST draw:object-ole %draw-style-name;>
+<!ATTLIST draw:object-ole draw:name %string; #IMPLIED>
+<!ATTLIST draw:object-ole xlink:href %uriReference; #IMPLIED>
+<!ATTLIST draw:object-ole xlink:type (simple) #IMPLIED>
+<!ATTLIST draw:object-ole xlink:show (embed) #IMPLIED>
+<!ATTLIST draw:object-ole xlink:actuate (onLoad) #IMPLIED>
+<!ATTLIST draw:object-ole %text-anchor;>
+<!ATTLIST draw:object-ole %draw-position;>
+<!ATTLIST draw:object-ole %draw-end-position; >
+<!ATTLIST draw:object-ole %table-background; >
+<!ATTLIST draw:object-ole svg:width %lengthOrPercentage; #IMPLIED>
+<!ATTLIST draw:object-ole svg:height %lengthOrPercentage; #IMPLIED>
+<!ATTLIST draw:object-ole %presentation-class; >
+<!ATTLIST draw:object-ole %zindex;>
+<!ATTLIST draw:object-ole draw:id %draw-shape-id;>
+<!ATTLIST draw:object-ole draw:layer %layerName; #IMPLIED>
+<!ATTLIST draw:object-ole style:rel-width %percentage; #IMPLIED>
+<!ATTLIST draw:object-ole style:rel-height %percentage; #IMPLIED>
+
+<!ELEMENT svg:desc (#PCDATA)>
+
+<!ELEMENT draw:contour-polygon EMPTY>
+<!ATTLIST draw:contour-polygon svg:width %coordinate; #REQUIRED>
+<!ATTLIST draw:contour-polygon svg:height %coordinate; #REQUIRED>
+<!ATTLIST draw:contour-polygon %draw-viewbox;>
+<!ATTLIST draw:contour-polygon draw:points %points; #REQUIRED>
+<!ATTLIST draw:contour-polygon draw:recreate-on-edit %boolean; #IMPLIED>
+
+<!ELEMENT draw:contour-path EMPTY>
+<!ATTLIST draw:contour-path svg:width %coordinate; #REQUIRED>
+<!ATTLIST draw:contour-path svg:height %coordinate; #REQUIRED>
+<!ATTLIST draw:contour-path %draw-viewbox;>
+<!ATTLIST draw:contour-path svg:d %pathData; #REQUIRED>
+<!ATTLIST draw:contour-path draw:recreate-on-edit %boolean; #IMPLIED>
+
+<!-- hyperlink -->
+<!ELEMENT draw:a (draw:image|draw:text-box)>
+<!ATTLIST draw:a xlink:href %uriReference; #REQUIRED>
+<!ATTLIST draw:a xlink:type (simple) #FIXED "simple">
+<!ATTLIST draw:a xlink:show (new|replace) #IMPLIED>
+<!ATTLIST draw:a xlink:actuate (onRequest) "onRequest">
+<!ATTLIST draw:a office:name %string; #IMPLIED>
+<!ATTLIST draw:a office:target-frame-name %string; #IMPLIED>
+<!ATTLIST draw:a office:server-map %boolean; "false">
+
+<!-- 3d properties -->
+<!ATTLIST style:properties dr3d:horizontal-segments %nonNegativeInteger; #IMPLIED>
+<!ATTLIST style:properties dr3d:vertical-segments %nonNegativeInteger; #IMPLIED>
+<!ATTLIST style:properties dr3d:edge-rounding %percentage; #IMPLIED>
+<!ATTLIST style:properties dr3d:edge-rounding-mode (correct|attractive) #IMPLIED>
+<!ATTLIST style:properties dr3d:back-scale %percentage; #IMPLIED>
+<!ATTLIST style:properties dr3d:end-angle %nonNegativeInteger; #IMPLIED>
+<!ATTLIST style:properties dr3d:depth %length; #IMPLIED>
+<!ATTLIST style:properties dr3d:backface-culling (enabled|disabled) #IMPLIED>
+<!ATTLIST style:properties dr3d:lighting-mode (standard|double-sided) #IMPLIED>
+<!ATTLIST style:properties dr3d:normals-kind (object|flat|sphere) #IMPLIED>
+<!ATTLIST style:properties dr3d:normals-direction (normal|inverse) #IMPLIED>
+<!ATTLIST style:properties dr3d:texture-generation-mode-x (object|parallel|sphere) #IMPLIED>
+<!ATTLIST style:properties dr3d:texture-generation-mode-y (object|parallel|sphere) #IMPLIED>
+<!ATTLIST style:properties dr3d:texture-kind (luminance|intesity|color) #IMPLIED>
+<!ATTLIST style:properties dr3d:texture-filter (enabled|disabled) #IMPLIED>
+<!ATTLIST style:properties dr3d:texture-mode (replace|modulate|blend) #IMPLIED>
+<!ATTLIST style:properties dr3d:ambient-color %color; #IMPLIED>
+<!ATTLIST style:properties dr3d:emissive-color %color; #IMPLIED>
+<!ATTLIST style:properties dr3d:specular-color %color; #IMPLIED>
+<!ATTLIST style:properties dr3d:diffuse-color %color; #IMPLIED>
+<!ATTLIST style:properties dr3d:shininess %percentage; #IMPLIED>
+<!ATTLIST style:properties dr3d:shadow (visible|hidden) #IMPLIED>
+<!ATTLIST style:properties dr3d:close-front %boolean; #IMPLIED>
+<!ATTLIST style:properties dr3d:close-back %boolean; #IMPLIED>
+
+<!ELEMENT dr3d:light EMPTY>
+<!ATTLIST dr3d:light dr3d:diffuse-color %color; #IMPLIED>
+<!ATTLIST dr3d:light dr3d:direction %vector3D; #REQUIRED>
+<!ATTLIST dr3d:light dr3d:enabled %boolean; #IMPLIED>
+<!ATTLIST dr3d:light dr3d:specular %boolean; #IMPLIED>
+
+<!ENTITY % shapes3d "(dr3d:scene|dr3d:extrude|dr3d:sphere|dr3d:rotate|dr3d:cube)">
+
+<!ELEMENT dr3d:cube EMPTY>
+<!ATTLIST dr3d:cube dr3d:transform CDATA #IMPLIED>
+<!ATTLIST dr3d:cube dr3d:min-edge %vector3D; #IMPLIED>
+<!ATTLIST dr3d:cube dr3d:max-edge %vector3D; #IMPLIED>
+<!ATTLIST dr3d:cube %zindex;>
+<!ATTLIST dr3d:cube draw:id %draw-shape-id;>
+<!ATTLIST dr3d:cube %draw-end-position; >
+<!ATTLIST dr3d:cube %table-background; >
+<!ATTLIST dr3d:cube %draw-style-name; >
+<!ATTLIST dr3d:cube draw:layer %layerName; #IMPLIED>
+
+<!ELEMENT dr3d:sphere EMPTY>
+<!ATTLIST dr3d:sphere dr3d:transform CDATA #IMPLIED>
+<!ATTLIST dr3d:sphere dr3d:center %vector3D; #IMPLIED>
+<!ATTLIST dr3d:sphere dr3d:size %vector3D; #IMPLIED>
+<!ATTLIST dr3d:sphere %zindex;>
+<!ATTLIST dr3d:sphere draw:id %draw-shape-id;>
+<!ATTLIST dr3d:sphere %draw-end-position; >
+<!ATTLIST dr3d:sphere %table-background; >
+<!ATTLIST dr3d:sphere %draw-style-name; >
+<!ATTLIST dr3d:sphere draw:layer %layerName; #IMPLIED>
+
+<!ELEMENT dr3d:extrude EMPTY>
+<!ATTLIST dr3d:extrude dr3d:transform CDATA #IMPLIED>
+<!ATTLIST dr3d:extrude %draw-viewbox;>
+<!ATTLIST dr3d:extrude svg:d %pathData; #REQUIRED >
+<!ATTLIST dr3d:extrude %zindex;>
+<!ATTLIST dr3d:extrude draw:id %draw-shape-id;>
+<!ATTLIST dr3d:extrude %draw-end-position; >
+<!ATTLIST dr3d:extrude %table-background; >
+<!ATTLIST dr3d:extrude %draw-style-name; >
+<!ATTLIST dr3d:extrude draw:layer %layerName; #IMPLIED>
+
+<!ELEMENT dr3d:rotate EMPTY>
+<!ATTLIST dr3d:rotate dr3d:transform CDATA #IMPLIED>
+<!ATTLIST dr3d:rotate %draw-viewbox;>
+<!ATTLIST dr3d:rotate svg:d %pathData; #REQUIRED >
+<!ATTLIST dr3d:rotate %zindex;>
+<!ATTLIST dr3d:rotate draw:id %draw-shape-id;>
+<!ATTLIST dr3d:rotate %draw-end-position; >
+<!ATTLIST dr3d:rotate %table-background; >
+<!ATTLIST dr3d:rotate %draw-style-name; >
+<!ATTLIST dr3d:rotate draw:layer %layerName; #IMPLIED>
+
+<!ELEMENT dr3d:scene (dr3d:light*,(%shapes3d;)*)>
+<!ATTLIST dr3d:scene %draw-style-name; >
+<!ATTLIST dr3d:scene svg:x %coordinate; #IMPLIED>
+<!ATTLIST dr3d:scene svg:y %coordinate; #IMPLIED>
+<!ATTLIST dr3d:scene svg:width %length; #IMPLIED>
+<!ATTLIST dr3d:scene svg:height %length; #IMPLIED>
+<!ATTLIST dr3d:scene dr3d:vrp %vector3D; #IMPLIED>
+<!ATTLIST dr3d:scene dr3d:vpn %vector3D; #IMPLIED>
+<!ATTLIST dr3d:scene dr3d:vup %vector3D; #IMPLIED>
+<!ATTLIST dr3d:scene dr3d:projection (parallel|perspective) #IMPLIED>
+<!ATTLIST dr3d:scene dr3d:transform CDATA #IMPLIED>
+<!ATTLIST dr3d:scene dr3d:distance %length; #IMPLIED>
+<!ATTLIST dr3d:scene dr3d:focal-length %length; #IMPLIED>
+<!ATTLIST dr3d:scene dr3d:shadow-slant %nonNegativeInteger; #IMPLIED>
+<!ATTLIST dr3d:scene dr3d:shade-mode (flat|phong|gouraud|draft) #IMPLIED>
+<!ATTLIST dr3d:scene dr3d:ambient-color %color; #IMPLIED>
+<!ATTLIST dr3d:scene dr3d:lighting-mode %boolean; #IMPLIED>
+<!ATTLIST dr3d:scene %zindex;>
+<!ATTLIST dr3d:scene draw:id %draw-shape-id;>
+<!ATTLIST dr3d:scene %draw-end-position; >
+<!ATTLIST dr3d:scene %table-background; >
+
+<!-- layer -->
+
+<!ELEMENT draw:layer-set (draw:layer*)>
+
+<!ELEMENT draw:layer EMPTY>
+<!ATTLIST draw:layer draw:name %layerName; #REQUIRED>
+
+<!-- events -->
+<!ELEMENT presentation:event (presentation:sound)?>
+<!ATTLIST presentation:event %event-name;>
+<!ATTLIST presentation:event presentation:action (none|previous-page|next-page|first-page|last-page|hide|stop|execute|show|verb|fade-out|sound) #REQUIRED>
+<!ATTLIST presentation:event presentation:effect %presentationEffects; "none">
+<!ATTLIST presentation:event presentation:direction %presentationEffectDirections; "none">
+<!ATTLIST presentation:event presentation:speed %presentationSpeeds; "medium">
+<!ATTLIST presentation:event presentation:start-scale %percentage; "100&#37;">
+<!ATTLIST presentation:event xlink:href %uriReference; #IMPLIED>
+<!ATTLIST presentation:event xlink:type (simple) #IMPLIED>
+<!ATTLIST presentation:event xlink:show (embed) #IMPLIED>
+<!ATTLIST presentation:event xlink:actuate (onRequest) #IMPLIED>
+<!ATTLIST presentation:event presentation:verb %nonNegativeInteger; #IMPLIED>
+
+<!-- applets -->
+<!ELEMENT draw:applet (draw:thumbnail?, draw:param*, svg:desc?)>
+<!ATTLIST draw:applet xlink:href %uriReference; #IMPLIED>
+<!ATTLIST draw:applet xlink:type (simple) #IMPLIED>
+<!ATTLIST draw:applet xlink:show (embed) #IMPLIED>
+<!ATTLIST draw:applet xlink:actuate (onLoad) #IMPLIED>
+<!ATTLIST draw:applet draw:code CDATA #REQUIRED>
+<!ATTLIST draw:applet draw:object CDATA #IMPLIED>
+<!ATTLIST draw:applet draw:archive CDATA #IMPLIED>
+<!ATTLIST draw:applet draw:may-script %boolean; "false">
+<!ATTLIST draw:applet draw:name CDATA #IMPLIED>
+<!ATTLIST draw:applet %draw-style-name;>
+<!ATTLIST draw:applet svg:width %lengthOrPercentage; #IMPLIED>
+<!ATTLIST draw:applet svg:height %lengthOrPercentage; #IMPLIED>
+<!ATTLIST draw:applet %zindex;>
+<!ATTLIST draw:applet draw:layer %layerName; #IMPLIED>
+<!ATTLIST draw:applet %draw-position;>
+<!ATTLIST draw:applet %draw-end-position; >
+
+<!-- plugins -->
+<!ELEMENT draw:plugin (draw:thumbnail?, draw:param*, svg:desc?)>
+<!ATTLIST draw:plugin xlink:href %uriReference; #IMPLIED>
+<!ATTLIST draw:plugin xlink:type (simple) #IMPLIED>
+<!ATTLIST draw:plugin xlink:show (embed) #IMPLIED>
+<!ATTLIST draw:plugin xlink:actuate (onLoad) #IMPLIED>
+<!ATTLIST draw:plugin draw:mime-type CDATA #IMPLIED>
+<!ATTLIST draw:plugin draw:name CDATA #IMPLIED>
+<!ATTLIST draw:plugin %draw-style-name;>
+<!ATTLIST draw:plugin svg:width %lengthOrPercentage; #IMPLIED>
+<!ATTLIST draw:plugin svg:height %lengthOrPercentage; #IMPLIED>
+<!ATTLIST draw:plugin %zindex;>
+<!ATTLIST draw:plugin draw:layer %layerName; #IMPLIED>
+<!ATTLIST draw:plugin %draw-position;>
+<!ATTLIST draw:plugin %draw-end-position; >
+
+<!-- Paramaters -->
+<!ELEMENT draw:param EMPTY>
+<!ATTLIST draw:param draw:name CDATA #IMPLIED>
+<!ATTLIST draw:param draw:value CDATA #IMPLIED>
+
+<!-- Floating Frames -->
+<!ELEMENT draw:floating-frame (draw:thumbnail?, svg:desc?)>
+<!ATTLIST draw:floating-frame xlink:href %uriReference; #IMPLIED>
+<!ATTLIST draw:floating-frame xlink:type (simple) #IMPLIED>
+<!ATTLIST draw:floating-frame xlink:show (embed) #IMPLIED>
+<!ATTLIST draw:floating-frame xlink:actuate (onLoad) #IMPLIED>
+<!ATTLIST draw:floating-frame draw:name CDATA #IMPLIED>
+<!ATTLIST draw:floating-frame draw:frame-name CDATA #IMPLIED>
+<!ATTLIST draw:floating-frame %draw-style-name;>
+<!ATTLIST draw:floating-frame svg:width %lengthOrPercentage; #IMPLIED>
+<!ATTLIST draw:floating-frame svg:height %lengthOrPercentage; #IMPLIED>
+<!ATTLIST draw:floating-frame %zindex;>
+<!ATTLIST draw:floating-frame draw:layer %layerName; #IMPLIED>
+<!ATTLIST draw:floating-frame %draw-position;>
+<!ATTLIST draw:floating-frame %draw-end-position; >
+
+<!-- Image Maps -->
+<!ELEMENT draw:image-map
+ (draw:area-rectangle|draw:area-circle|draw:area-polygon)*>
+
+<!ELEMENT draw:area-rectangle (svg:desc?,office:events?)>
+<!ATTLIST draw:area-rectangle xlink:href %uriReference; #IMPLIED>
+<!ATTLIST draw:area-rectangle xlink:type (simple) #IMPLIED>
+<!ATTLIST draw:area-rectangle office:target-frame-name CDATA #IMPLIED>
+<!ATTLIST draw:area-rectangle xlink:show (new|replace) #IMPLIED>
+<!ATTLIST draw:area-rectangle office:name CDATA #IMPLIED>
+<!ATTLIST draw:area-rectangle draw:nohref (nohref) #IMPLIED>
+<!ATTLIST draw:area-rectangle svg:x %coordinate; #REQUIRED>
+<!ATTLIST draw:area-rectangle svg:y %coordinate; #REQUIRED>
+<!ATTLIST draw:area-rectangle svg:width %coordinate; #REQUIRED>
+<!ATTLIST draw:area-rectangle svg:height %coordinate; #REQUIRED>
+
+<!ELEMENT draw:area-circle (svg:desc?,office:events?)>
+<!ATTLIST draw:area-circle xlink:href %uriReference; #IMPLIED>
+<!ATTLIST draw:area-circle xlink:type (simple) #IMPLIED>
+<!ATTLIST draw:area-circle office:target-frame-name CDATA #IMPLIED>
+<!ATTLIST draw:area-circle xlink:show (new|replace) #IMPLIED>
+<!ATTLIST draw:area-circle office:name CDATA #IMPLIED>
+<!ATTLIST draw:area-circle draw:nohref (nohref) #IMPLIED>
+<!ATTLIST draw:area-circle svg:cx %coordinate; #REQUIRED>
+<!ATTLIST draw:area-circle svg:cy %coordinate; #REQUIRED>
+<!ATTLIST draw:area-circle svg:r %coordinate; #REQUIRED>
+
+<!ELEMENT draw:area-polygon (svg:desc?,office:events?)>
+<!ATTLIST draw:area-polygon xlink:href %uriReference; #IMPLIED>
+<!ATTLIST draw:area-polygon xlink:type (simple) #IMPLIED>
+<!ATTLIST draw:area-polygon office:target-frame-name CDATA #IMPLIED>
+<!ATTLIST draw:area-polygon xlink:show (new|replace) #IMPLIED>
+<!ATTLIST draw:area-polygon office:name CDATA #IMPLIED>
+<!ATTLIST draw:area-polygon draw:nohref (nohref) #IMPLIED>
+<!ATTLIST draw:area-polygon svg:x %coordinate; #REQUIRED>
+<!ATTLIST draw:area-polygon svg:y %coordinate; #REQUIRED>
+<!ATTLIST draw:area-polygon svg:width %coordinate; #REQUIRED>
+<!ATTLIST draw:area-polygon svg:height %coordinate; #REQUIRED>
+<!ATTLIST draw:area-polygon svg:points %points; #REQUIRED>
+<!ATTLIST draw:area-polygon svg:viewBox CDATA #REQUIRED>
diff --git a/xmloff/dtd/dtypes.mod b/xmloff/dtd/dtypes.mod
new file mode 100755
index 000000000000..4de538ced12b
--- /dev/null
+++ b/xmloff/dtd/dtypes.mod
@@ -0,0 +1,143 @@
+<!--
+
+ 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.
+
+-->
+
+<!-- datatypes corresponding to XML Schema Part 2 W3C Working draft of -->
+<!-- 07 April 2000 -->
+
+<!-- string -->
+<!ENTITY % string "CDATA">
+<!ENTITY % cString "#PCDATA">
+
+<!-- boolean (values are "true" and "false" -->
+<!ENTITY % boolean "CDATA">
+
+<!-- integer ( ..., -2, -1, 0, 1, 2, ...) -->
+<!ENTITY % integer "CDATA">
+
+<!-- non negative integer ( 0, 1, 2, ...) -->
+<!ENTITY % nonNegativeInteger "CDATA">
+
+<!-- positive integer ( 1, 2, ...) -->
+<!ENTITY % positiveInteger "CDATA">
+<!ENTITY % cPositiveInteger "#PCDATA">
+
+<!ENTITY % positiveNumberOrDefault "CDATA">
+
+<!-- time duration as specified by ISO8601, section 5.5.3.2 -->
+<!ENTITY % timeDuration "CDATA">
+<!ENTITY % cTimeDuration "#PCDATA">
+
+<!-- time instance as specified by ISO8601, section 5.4 -->
+<!ENTITY % timeInstance "CDATA">
+<!ENTITY % cTimeInstance "#PCDATA">
+
+<!-- date instance as specified by ISO8601, section 5.2.1.1, extended format-->
+<!ENTITY % date "CDATA">
+<!ENTITY % cDate "#PCDATA">
+
+<!-- date duration, like timDuration but truncated to full dates -->
+<!ENTITY % dateDuration "CDATA">
+<!ENTITY % cDateDuration "#PCDATA">
+
+<!-- URI reference -->
+<!ENTITY % uriReference "CDATA">
+
+<!-- language code as specified by RFC1766 -->
+<!ENTITY % language "CDATA">
+<!ENTITY % cLanguage "#PCDATA">
+
+<!-- float -->
+<!ENTITY % float "CDATA">
+
+<!-- Some other common used data types -->
+
+<!-- a single UNICODE character -->
+<!ENTITY % character "CDATA">
+
+<!-- a style name -->
+<!ENTITY % styleName "CDATA">
+
+<!-- a target frame mame -->
+<!ENTITY % targetFrameName "CDATA">
+
+<!-- a language without a country as specified by ISO639 -->
+<!ENTITY % languageOnly "CDATA">
+
+<!-- a country as specified by ISO3166 -->
+<!ENTITY % country "CDATA">
+
+<!-- a color value having the format #rrggbb -->
+<!ENTITY % color "CDATA">
+<!-- a color value having the format #rrggbb or "transparent" -->
+<!ENTITY % transparentOrColor "CDATA">
+
+<!-- a percentage -->
+<!ENTITY % percentage "CDATA">
+
+<!-- a length (i.e. 1cm or .6inch) -->
+<!ENTITY % length "CDATA">
+<!ENTITY % positiveLength "CDATA">
+<!ENTITY % nonNegativeLength "CDATA">
+<!ENTITY % lengthOrNoLimit "CDATA">
+
+<!-- a length or a percentage -->
+<!ENTITY % lengthOrPercentage "CDATA">
+<!ENTITY % positiveLengthOrPercentage "CDATA">
+
+<!-- a pixel length (i.e. 2px) -->
+<!ENTITY % nonNegativePixelLength "CDATA">
+
+<!-- a float or a percentage -->
+<!ENTITY % floatOrPercentage "CDATA">
+
+<!-- a text encoding -->
+<!ENTITY % textEncoding "CDATA">
+
+<!-- cell address and cell range address -->
+<!ENTITY % cell-address "CDATA">
+<!ENTITY % cell-range-address "CDATA">
+<!ENTITY % cell-range-address-list "CDATA">
+
+<!-- value types -->
+<!ENTITY % valueType "(float|time|date|percentage|currency|boolean|string)">
+
+<!-- an svg coordinate in different distance formats -->
+<!ENTITY % coordinate "CDATA">
+
+<!ENTITY % coordinateOrPercentage "CDATA">
+
+<!ENTITY % shape "draw:rect|draw:line|draw:polyline|draw:polygon|draw:path|
+ draw:circle|draw:ellipse|draw:g|draw:page-thumbnail|
+ draw:text-box|draw:image|draw:object|draw:object-ole|
+ draw:applet|draw:floating-frame|draw:plugin|
+ draw:measure|draw:caption|draw:connector|chart:chart|
+ dr3d:scene|draw:control|draw:custom-shape" >
+<!ENTITY % shapes "(%shape;)" >
+
+<!ENTITY % anchorType "(page|frame|paragraph|char|as-char)">
+
+<!ENTITY % control-id "form:id CDATA #REQUIRED">
diff --git a/xmloff/dtd/form.mod b/xmloff/dtd/form.mod
new file mode 100755
index 000000000000..511fb180f488
--- /dev/null
+++ b/xmloff/dtd/form.mod
@@ -0,0 +1,366 @@
+<!--
+
+ 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.
+
+-->
+
+<!ENTITY % controls "form:text|form:textarea|form:fixed-text|form:file|
+ form:password|form:formatted-text|form:button|form:image|
+ form:checkbox|form:radio|form:listbox|form:combobox|form:frame|
+ form:hidden|form:image-frame|form:grid|form:value-range|form:generic-control">
+
+<!ENTITY % name "form:name CDATA #IMPLIED">
+<!ENTITY % service-name "form:service-name CDATA #IMPLIED">
+
+<!ENTITY % navigation "(none|current|parent)">
+<!ENTITY % cycles "(records|current|page)">
+<!ENTITY % url "CDATA">
+
+
+<!ENTITY % types "(submit|reset|push|url)">
+<!ENTITY % button-type "form:button-type %types; 'push'">
+<!ENTITY % current-selected "form:current-selected %boolean; 'false'">
+<!ENTITY % current-value "form:current-value CDATA #IMPLIED">
+<!ENTITY % value "form:value CDATA #IMPLIED">
+<!ENTITY % disabled "form:disabled %boolean; 'false'">
+<!ENTITY % dropdown "form:dropdown %boolean; 'false'">
+<!ENTITY % for "form:for CDATA #IMPLIED">
+<!ENTITY % image-data "form:image-data %url; #IMPLIED">
+<!ENTITY % label "form:label CDATA #IMPLIED">
+<!ENTITY % max-length "form:max-length CDATA #IMPLIED">
+<!ENTITY % printable "form:printable %boolean; 'true'">
+<!ENTITY % readonly "form:readonly %boolean; 'false'">
+<!ENTITY % size "form:size CDATA #IMPLIED">
+<!ENTITY % selected "form:selected %boolean; 'false'">
+<!ENTITY % size "form:size CDATA #IMPLIED">
+<!ENTITY % tab-index "form:tab-index CDATA #IMPLIED">
+<!ENTITY % target-frame "office:target-frame CDATA '_blank'">
+<!ENTITY % target-location "xlink:href %url; #IMPLIED">
+<!ENTITY % tab-stop "form:tab-stop %boolean; 'true'">
+<!ENTITY % title "form:title CDATA #IMPLIED">
+<!ENTITY % default-value "form:default-value CDATA #IMPLIED">
+<!ENTITY % bound-column "form:bound-column CDATA #IMPLIED">
+<!ENTITY % convert-empty "form:convert-empty-to-null %boolean; 'false'">
+<!ENTITY % data-field "form:data-field CDATA #IMPLIED">
+<!ENTITY % linked-cell "form:linked-cell CDATA #IMPLIED">
+<!ENTITY % visual-effect "form:visual-effect (flat|3d) #IMPLIED">
+<!ENTITY % image-position "form:image-position (start|end|top|bottom|center) 'center'">
+<!ENTITY % image-align "form:image-align (start|center|end) 'center'">
+<!ENTITY % list-linkage-type "form:list-linkage-type (selection|selection-indexes) #IMPLIED">
+<!ENTITY % source-cell-range "form:source-cell-range CDATA #IMPLIED">
+<!ENTITY % list-source "form:list-source CDATA #IMPLIED">
+<!ENTITY % list-source-types "(table|query|sql|sql-pass-through|value-list|table-fields)">
+<!ENTITY % list-source-type "form:list-source-type %list-source-types; #IMPLIED">
+<!ENTITY % column-style-name "form:column-style-name %styleName; #IMPLIED">
+<!ENTITY % min-value "form:min-value %float; #IMPLIED">
+<!ENTITY % max-value "form:max-value %float; #IMPLIED">
+<!ENTITY % step-size "form:step-size %positiveInteger; '1'">
+<!ENTITY % page-step-size "form:page-step-size %positiveInteger; #IMPLIED">
+<!ENTITY % delay-for-repeat "form:delay-for-repeat %positiveInteger; #IMPLIED">
+<!ENTITY % orientation "form:orientation (horizontal|vertical) #IMPLIED">
+
+
+
+
+<!ELEMENT form:control (%controls;)+>
+<!ATTLIST form:control %name;
+ %service-name;
+ %control-id;>
+
+<!ELEMENT form:form (form:properties?, office:events?, (form:control|form:form)*)>
+<!ATTLIST form:form %name; %service-name;>
+<!ATTLIST form:form xlink:href %url; #IMPLIED>
+<!ATTLIST form:form form:enctype CDATA "application/x-www-form-urlencoded">
+<!ATTLIST form:form form:method CDATA "get">
+<!ATTLIST form:form office:target-frame CDATA "_blank">
+<!ATTLIST form:form form:allow-deletes %boolean; "true">
+<!ATTLIST form:form form:allow-inserts %boolean; "true">
+<!ATTLIST form:form form:allow-updates %boolean; "true">
+<!ATTLIST form:form form:apply-filter %boolean; "false">
+<!ATTLIST form:form form:command CDATA #IMPLIED>
+<!ATTLIST form:form form:command-type (table|query|command) "command">
+<!ATTLIST form:form form:datasource CDATA #IMPLIED>
+<!ATTLIST form:form form:detail-fields CDATA #IMPLIED>
+<!ATTLIST form:form form:escape-processing %boolean; "true">
+<!ATTLIST form:form form:filter CDATA #IMPLIED>
+<!ATTLIST form:form form:ignore-result %boolean; "false">
+<!ATTLIST form:form form:master-fields CDATA #IMPLIED>
+<!ATTLIST form:form form:navigation-mode %navigation; #IMPLIED>
+<!ATTLIST form:form form:order CDATA #IMPLIED>
+<!ATTLIST form:form form:tab-cycle %cycles; #IMPLIED>
+
+<!ELEMENT office:forms (form:form*)>
+<!ATTLIST office:forms form:automatic-focus %boolean; "false">
+<!ATTLIST office:forms form:apply-design-mode %boolean; "true">
+
+<!ELEMENT form:text (form:properties?, office:events?)>
+<!ATTLIST form:text %current-value;
+ %disabled;
+ %max-length;
+ %printable;
+ %readonly;
+ %tab-index;
+ %tab-stop;
+ %title;
+ %value;
+ %convert-empty;
+ %data-field;
+ %linked-cell;>
+
+<!ELEMENT form:textarea (form:properties?, office:events?, text:p*)>
+<!ATTLIST form:textarea %current-value;
+ %disabled;
+ %max-length;
+ %printable;
+ %readonly;
+ %tab-index;
+ %tab-stop;
+ %title;
+ %value;
+ %convert-empty;
+ %data-field;
+ %linked-cell;>
+
+<!ELEMENT form:password (form:properties?, office:events?)>
+<!ATTLIST form:password %disabled;
+ %max-length;
+ %printable;
+ %tab-index;
+ %tab-stop;
+ %title;
+ %value;
+ %convert-empty;
+ %linked-cell;>
+
+<!ATTLIST form:password form:echo-char CDATA "*">
+
+<!ELEMENT form:file (form:properties?, office:events?)>
+<!ATTLIST form:file %current-value;
+ %disabled;
+ %max-length;
+ %printable;
+ %readonly;
+ %tab-index;
+ %tab-stop;
+ %title;
+ %value;>
+
+<!ELEMENT form:formatted-text (form:properties?, office:events?)>
+<!ATTLIST form:formatted-text %current-value;
+ %disabled;
+ %max-length;
+ %printable;
+ %readonly;
+ %tab-index;
+ %tab-stop;
+ %title;
+ %min-value;
+ %max-value;
+ %value;
+ %convert-empty;
+ %data-field;
+ %linked-cell;>
+<!ATTLIST form:formatted-text form:validation %boolean; "false">
+
+<!ELEMENT form:fixed-text (form:properties?, office:events?)>
+<!ATTLIST form:fixed-text %for;
+ %disabled;
+ %label;
+ %printable;
+ %title;>
+<!ATTLIST form:fixed-text form:multi-line %boolean; "false">
+
+<!ELEMENT form:combobox (form:properties?, office:events?, form:item*)>
+<!ATTLIST form:combobox %current-value;
+ %disabled;
+ %dropdown;
+ %max-length;
+ %printable;
+ %readonly;
+ %size;
+ %tab-index;
+ %tab-stop;
+ %title;
+ %value;
+ %convert-empty;
+ %data-field;
+ %list-source;
+ %list-source-type;
+ %linked-cell;
+ %source-cell-range;>
+
+<!ATTLIST form:combobox form:auto-complete %boolean; #IMPLIED>
+
+<!ELEMENT form:item (#PCDATA)>
+<!ATTLIST form:item %label;>
+
+<!ELEMENT form:listbox (form:properties?, office:events?, form:option*)>
+<!ATTLIST form:listbox %disabled;
+ %dropdown;
+ %printable;
+ %size;
+ %tab-index;
+ %tab-stop;
+ %title;
+ %bound-column;
+ %data-field;
+ %list-source;
+ %list-source-type;
+ %linked-cell;
+ %list-linkage-type;
+ %source-cell-range;>
+
+<!ATTLIST form:listbox form:multiple %boolean; "false">
+
+<!ELEMENT form:option (#PCDATA)>
+<!ATTLIST form:option %current-selected;
+ %selected;
+ %label;
+ %value;>
+
+<!ELEMENT form:button (form:properties?, office:events?)>
+<!ATTLIST form:button %button-type;
+ %disabled;
+ %label;
+ %image-data;
+ %printable;
+ %tab-index;
+ %tab-stop;
+ %target-frame;
+ %target-location;
+ %title;
+ %value;
+ %image-position;
+ %image-align;>
+
+<!ATTLIST form:button form:default-button %boolean; "false"
+ form:toggle %boolean; "false"
+ form:focus-on-click %boolean; "true">
+
+<!ELEMENT form:image (form:properties?, office:events?)>
+<!ATTLIST form:image %button-type;
+ %disabled;
+ %image-data;
+ %printable;
+ %tab-index;
+ %tab-stop;
+ %target-frame;
+ %target-location;
+ %title;
+ %value;>
+
+<!ELEMENT form:checkbox (form:properties?, office:events?)>
+<!ATTLIST form:checkbox %disabled;
+ %label;
+ %printable;
+ %tab-index;
+ %tab-stop;
+ %title;
+ %value;
+ %data-field;
+ %linked-cell;
+ %visual-effect;
+ %image-position;
+ %image-align;>
+
+<!ENTITY % states "(unchecked|checked|unknown)">
+<!ATTLIST form:checkbox form:current-state %states; #IMPLIED>
+<!ATTLIST form:checkbox form:is-tristate %boolean; "false">
+<!ATTLIST form:checkbox form:state %states; "unchecked">
+
+<!ELEMENT form:radio (form:properties?, office:events?)>
+<!ATTLIST form:radio %current-selected;
+ %disabled;
+ %label;
+ %printable;
+ %selected;
+ %tab-index;
+ %tab-stop;
+ %title;
+ %value;
+ %data-field;
+ %linked-cell;
+ %visual-effect;
+ %image-position;
+ %image-align;>
+
+<!ELEMENT form:frame (form:properties?, office:events?)>
+<!ATTLIST form:frame %disabled;
+ %for;
+ %label;
+ %printable;
+ %title;>
+
+<!ELEMENT form:image-frame (form:properties?, office:events?)>
+<!ATTLIST form:image-frame %disabled;
+ %image-data;
+ %printable;
+ %readonly;
+ %title;
+ %data-field;>
+
+<!ELEMENT form:hidden (form:properties?, office:events?)>
+<!ATTLIST form:hidden %name;
+ %service-name;
+ %value;>
+
+<!ELEMENT form:grid (form:properties?, office:events?, form:column*)>
+<!ATTLIST form:grid %disabled;
+ %printable;
+ %tab-index;
+ %tab-stop;
+ %title;>
+
+<!ENTITY % column-type "form:text| form:textarea| form:formatted-text|form:checkbox| form:listbox| form:combobox">
+<!ELEMENT form:column (%column-type;)+>
+<!ATTLIST form:column %name;
+ %service-name;
+ %label;
+ %column-style-name;>
+
+<!ELEMENT form:generic-control (form:properties?, office:events?)>
+
+<!ELEMENT form:value-range (form:properties?, office:events?)>
+<!ATTLIST form:value-range %disabled;
+ %printable;
+ %tab-index;
+ %tab-stop;
+ %title;
+ %min-value;
+ %max-value;
+ %current-value;
+ %value;
+ %linked-cell;
+ %step-size;
+ %page-step-size;
+ %delay-for-repeat;
+ %orientation;>
+
+<!ELEMENT form:properties (form:property+)>
+<!ELEMENT form:property (form:property-value*)>
+<!ATTLIST form:property form:property-is-list %boolean; #IMPLIED>
+<!ATTLIST form:property form:property-name CDATA #REQUIRED>
+<!ATTLIST form:property form:property-type (boolean|short|int|long|double|string) #REQUIRED>
+<!ELEMENT form:property-value (#PCDATA)>
+<!ATTLIST form:property-value form:property-is-void %boolean; #IMPLIED>
diff --git a/xmloff/dtd/meta.mod b/xmloff/dtd/meta.mod
new file mode 100755
index 000000000000..1ea845bcb02d
--- /dev/null
+++ b/xmloff/dtd/meta.mod
@@ -0,0 +1,90 @@
+<!--
+
+ 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.
+
+-->
+
+
+<!ELEMENT meta:generator (%cString;)>
+
+<!ELEMENT dc:title (%cString;)>
+
+<!ELEMENT dc:description (%cString;)>
+
+<!ELEMENT dc:subject (%cString;)>
+
+<!ELEMENT meta:keywords (meta:keyword)*>
+<!ELEMENT meta:keyword (%cString;)>
+
+<!ELEMENT meta:initial-creator (%cString;)>
+
+<!ELEMENT dc:creator (%cString;)>
+
+<!ELEMENT meta:printed-by (%cString;)>
+
+<!ELEMENT meta:creation-date (%cTimeInstance;)>
+
+<!ELEMENT dc:date (%cTimeInstance;)>
+
+<!ELEMENT meta:print-date (%cTimeInstance;)>
+
+<!ELEMENT meta:template EMPTY>
+<!ATTLIST meta:template xlink:type (simple) #FIXED "simple">
+<!ATTLIST meta:template xlink:actuate (onRequest) "onRequest">
+<!ATTLIST meta:template xlink:href %uriReference; #REQUIRED>
+<!ATTLIST meta:template xlink:title %string; #IMPLIED>
+<!ATTLIST meta:template meta:date %timeInstance; #IMPLIED>
+
+<!ELEMENT meta:auto-reload EMPTY>
+<!ATTLIST meta:auto-reload xlink:type (simple) #IMPLIED>
+<!ATTLIST meta:auto-reload xlink:show (replace) #IMPLIED>
+<!ATTLIST meta:auto-reload xlink:actuate (onLoad) #IMPLIED>
+<!ATTLIST meta:auto-reload xlink:href %uriReference; #IMPLIED>
+<!ATTLIST meta:auto-reload meta:delay %timeDuration; "P0S">
+
+<!ELEMENT meta:hyperlink-behaviour EMPTY>
+<!ATTLIST meta:hyperlink-behaviour office:target-frame-name %targetFrameName; #IMPLIED>
+<!ATTLIST meta:hyperlink-behaviour xlink:show (new|replace) #IMPLIED>
+
+<!ELEMENT dc:language (%cLanguage;)>
+
+<!ELEMENT meta:editing-cycles (%cPositiveInteger;)>
+
+<!ELEMENT meta:editing-duration (%cTimeDuration;)>
+
+<!ELEMENT meta:user-defined (%cString;)>
+<!ATTLIST meta:user-defined meta:name %string; #REQUIRED>
+
+<!ELEMENT meta:document-statistic EMPTY>
+<!ATTLIST meta:document-statistic meta:page-count %positiveInteger; #IMPLIED
+ meta:table-count %nonNegativeInteger; #IMPLIED
+ meta:draw-count %nonNegativeInteger; #IMPLIED
+ meta:image-count %nonNegativeInteger; #IMPLIED
+ meta:ole-object-count %nonNegativeInteger; #IMPLIED
+ meta:paragraph-count %nonNegativeInteger; #IMPLIED
+ meta:word-count %nonNegativeInteger; #IMPLIED
+ meta:character-count %nonNegativeInteger; #IMPLIED
+ meta:row-count %nonNegativeInteger; #IMPLIED
+ meta:cell-count %nonNegativeInteger; #IMPLIED
+ meta:object-count %positiveInteger; #IMPLIED>
diff --git a/xmloff/dtd/nmspace.mod b/xmloff/dtd/nmspace.mod
new file mode 100755
index 000000000000..addcdc59224f
--- /dev/null
+++ b/xmloff/dtd/nmspace.mod
@@ -0,0 +1,53 @@
+<!--
+
+ 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.
+
+-->
+
+<!ENTITY nFO "http://www.w3.org/1999/XSL/Format">
+<!ENTITY nXLink "http://www.w3.org/1999/xlink">
+<!ENTITY nSVG "http://www.w3.org/2000/svg">
+<!ENTITY nMath "http://www.w3.org/1998/Math/MathML">
+
+<!-- StarOffice namespace names and prefixes -->
+
+<!ENTITY nOpenOffice "http://openoffice.org/2000">
+<!ENTITY nOpenOffice2001 "http://openoffice.org/2001">
+
+<!ENTITY nOffice "&nOpenOffice;/office">
+<!ENTITY nStyle "&nOpenOffice;/style">
+<!ENTITY nText "&nOpenOffice;/text">
+<!ENTITY nTable "&nOpenOffice;/table">
+<!ENTITY nMeta "&nOpenOffice;/meta">
+<!ENTITY nScript "&nOpenOffice;/script">
+<!ENTITY nDraw "&nOpenOffice;/drawing">
+<!ENTITY nChart "&nOpenOffice;/chart">
+<!ENTITY nNumber "&nOpenOffice;/datastyle">
+<!ENTITY nDr3D "&nOpenOffice;/dr3d">
+<!ENTITY nForm "&nOpenOffice;/form">
+<!ENTITY nConfig "&nOpenOffice2001;/config">
+<!ENTITY nPresentation "&nOpenOffice2001;/presentation">
+
+<!-- dublin core namespace name and prefic -->
+<!ENTITY nDC "http://purl.org/dc/elements/1.1/">
diff --git a/xmloff/dtd/office.dtd b/xmloff/dtd/office.dtd
new file mode 100755
index 000000000000..c66bc8d2ad4b
--- /dev/null
+++ b/xmloff/dtd/office.dtd
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+
+<!ENTITY % dtypes-mod SYSTEM "dtypes.mod">
+%dtypes-mod;
+<!ENTITY % nmspace-mod SYSTEM "nmspace.mod">
+%nmspace-mod;
+<!ENTITY % defs-mod SYSTEM "defs.mod">
+%defs-mod;
+<!ENTITY % office-mod SYSTEM "office.mod">
+%office-mod;
+<!ENTITY % style-mod SYSTEM "style.mod">
+%style-mod;
+<!ENTITY % meta-mod SYSTEM "meta.mod">
+%meta-mod;
+<!ENTITY % script-mod SYSTEM "script.mod">
+%script-mod;
+<!ENTITY % drawing-mod SYSTEM "drawing.mod">
+%drawing-mod;
+<!ENTITY % text-mod SYSTEM "text.mod">
+%text-mod;
+<!ENTITY % table-mod SYSTEM "table.mod">
+%table-mod;
+<!ENTITY % chart-mod SYSTEM "chart.mod">
+%chart-mod;
+<!ENTITY % datastyl-mod SYSTEM "datastyl.mod">
+%datastyl-mod;
+<!ENTITY % form-mod SYSTEM "form.mod">
+%form-mod;
+<!ENTITY % settings-mod SYSTEM "settings.mod">
+%settings-mod;
diff --git a/xmloff/dtd/office.mod b/xmloff/dtd/office.mod
new file mode 100755
index 000000000000..a7d50df0cf06
--- /dev/null
+++ b/xmloff/dtd/office.mod
@@ -0,0 +1,245 @@
+<!--
+
+ 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.
+
+-->
+
+<!ELEMENT office:document ( office:meta?,
+ office:settings?,
+ office:script?,
+ office:font-decls?,
+ office:styles?,
+ office:automatic-styles?,
+ office:master-styles?,
+ office:body ) >
+
+<!ATTLIST office:document xmlns:office CDATA #FIXED "&nOffice;">
+<!ATTLIST office:document xmlns:meta CDATA #FIXED "&nMeta;">
+<!ATTLIST office:document xmlns:script CDATA #FIXED "&nScript;">
+<!ATTLIST office:document xmlns:style CDATA #FIXED "&nStyle;">
+<!ATTLIST office:document xmlns:text CDATA #FIXED "&nText;">
+<!ATTLIST office:document xmlns:table CDATA #FIXED "&nTable;">
+<!ATTLIST office:document xmlns:draw CDATA #FIXED "&nDraw;">
+<!ATTLIST office:document xmlns:chart CDATA #FIXED "&nChart;">
+<!ATTLIST office:document xmlns:number CDATA #FIXED "&nNumber;">
+<!ATTLIST office:document xmlns:fo CDATA #FIXED "&nFO;">
+<!ATTLIST office:document xmlns:xlink CDATA #FIXED "&nXLink;">
+<!ATTLIST office:document xmlns:svg CDATA #FIXED "&nSVG;">
+<!ATTLIST office:document xmlns:dc CDATA #FIXED "&nDC;">
+<!ATTLIST office:document xmlns:dr3d CDATA #FIXED "&nDr3D;">
+<!ATTLIST office:document xmlns:math CDATA #FIXED "&nMath;">
+<!ATTLIST office:document xmlns:form CDATA #FIXED "&nForm;">
+<!ATTLIST office:document xmlns:config CDATA #FIXED "&nConfig;">
+<!ATTLIST office:document xmlns:presentation CDATA #FIXED "&nPresentation;">
+
+<!ATTLIST office:document office:class
+ (text|text-global|
+ drawing|presentation|
+ spreadsheet|chart) #REQUIRED>
+
+<!ATTLIST office:document office:version %string; #IMPLIED>
+
+<!-- document-styles -->
+<!ELEMENT office:document-styles (
+ office:font-decls?,
+ office:styles?,
+ office:automatic-styles?,
+ office:master-styles? ) >
+
+<!ATTLIST office:document-styles xmlns:office CDATA #FIXED "&nOffice;">
+<!ATTLIST office:document-styles xmlns:meta CDATA #FIXED "&nMeta;">
+<!ATTLIST office:document-styles xmlns:script CDATA #FIXED "&nScript;">
+<!ATTLIST office:document-styles xmlns:style CDATA #FIXED "&nStyle;">
+<!ATTLIST office:document-styles xmlns:text CDATA #FIXED "&nText;">
+<!ATTLIST office:document-styles xmlns:table CDATA #FIXED "&nTable;">
+<!ATTLIST office:document-styles xmlns:draw CDATA #FIXED "&nDraw;">
+<!ATTLIST office:document-styles xmlns:chart CDATA #FIXED "&nChart;">
+<!ATTLIST office:document-styles xmlns:number CDATA #FIXED "&nNumber;">
+<!ATTLIST office:document-styles xmlns:fo CDATA #FIXED "&nFO;">
+<!ATTLIST office:document-styles xmlns:xlink CDATA #FIXED "&nXLink;">
+<!ATTLIST office:document-styles xmlns:svg CDATA #FIXED "&nSVG;">
+<!ATTLIST office:document-styles xmlns:dc CDATA #FIXED "&nDC;">
+<!ATTLIST office:document-styles xmlns:dr3d CDATA #FIXED "&nDr3D;">
+<!ATTLIST office:document-styles xmlns:math CDATA #FIXED "&nMath;">
+<!ATTLIST office:document-styles xmlns:form CDATA #FIXED "&nForm;">
+
+<!ATTLIST office:document-styles office:version %string; #IMPLIED>
+
+<!-- document-content -->
+
+<!ELEMENT office:document-content (
+ office:script?,
+ office:font-decls?,
+ office:automatic-styles?,
+ office:body ) >
+
+<!ATTLIST office:document-content xmlns:office CDATA #FIXED "&nOffice;">
+<!ATTLIST office:document-content xmlns:meta CDATA #FIXED "&nMeta;">
+<!ATTLIST office:document-content xmlns:script CDATA #FIXED "&nScript;">
+<!ATTLIST office:document-content xmlns:style CDATA #FIXED "&nStyle;">
+<!ATTLIST office:document-content xmlns:text CDATA #FIXED "&nText;">
+<!ATTLIST office:document-content xmlns:table CDATA #FIXED "&nTable;">
+<!ATTLIST office:document-content xmlns:draw CDATA #FIXED "&nDraw;">
+<!ATTLIST office:document-content xmlns:chart CDATA #FIXED "&nChart;">
+<!ATTLIST office:document-content xmlns:number CDATA #FIXED "&nNumber;">
+<!ATTLIST office:document-content xmlns:fo CDATA #FIXED "&nFO;">
+<!ATTLIST office:document-content xmlns:xlink CDATA #FIXED "&nXLink;">
+<!ATTLIST office:document-content xmlns:svg CDATA #FIXED "&nSVG;">
+<!ATTLIST office:document-content xmlns:dc CDATA #FIXED "&nDC;">
+<!ATTLIST office:document-content xmlns:dr3d CDATA #FIXED "&nDr3D;">
+<!ATTLIST office:document-content xmlns:math CDATA #FIXED "&nMath;">
+<!ATTLIST office:document-content xmlns:form CDATA #FIXED "&nForm;">
+
+<!ATTLIST office:document-content office:class
+ (text|text-global|
+ drawing|presentation|
+ spreadsheet|chart) #REQUIRED>
+
+<!ATTLIST office:document-content office:version %string; #IMPLIED>
+
+<!-- document-content -->
+
+<!ELEMENT office:document-meta ( office:meta? ) >
+
+<!ATTLIST office:document-meta xmlns:office CDATA #FIXED "&nOffice;">
+<!ATTLIST office:document-meta xmlns:meta CDATA #FIXED "&nMeta;">
+<!ATTLIST office:document-meta xmlns:script CDATA #FIXED "&nScript;">
+<!ATTLIST office:document-meta xmlns:style CDATA #FIXED "&nStyle;">
+<!ATTLIST office:document-meta xmlns:text CDATA #FIXED "&nText;">
+<!ATTLIST office:document-meta xmlns:table CDATA #FIXED "&nTable;">
+<!ATTLIST office:document-meta xmlns:draw CDATA #FIXED "&nDraw;">
+<!ATTLIST office:document-meta xmlns:chart CDATA #FIXED "&nChart;">
+<!ATTLIST office:document-meta xmlns:number CDATA #FIXED "&nNumber;">
+<!ATTLIST office:document-meta xmlns:fo CDATA #FIXED "&nFO;">
+<!ATTLIST office:document-meta xmlns:xlink CDATA #FIXED "&nXLink;">
+<!ATTLIST office:document-meta xmlns:svg CDATA #FIXED "&nSVG;">
+<!ATTLIST office:document-meta xmlns:dc CDATA #FIXED "&nDC;">
+<!ATTLIST office:document-meta xmlns:dr3d CDATA #FIXED "&nDr3D;">
+<!ATTLIST office:document-meta xmlns:math CDATA #FIXED "&nMath;">
+<!ATTLIST office:document-meta xmlns:form CDATA #FIXED "&nForm;">
+
+<!ATTLIST office:document-meta office:version %string; #IMPLIED>
+
+<!ELEMENT office:document-settings (office:settings) >
+<!ATTLIST office:document-settings xmlns:office CDATA #FIXED "&nOffice;">
+<!ATTLIST office:document-settings xmlns:xlink CDATA #FIXED "&nXLink;">
+<!ATTLIST office:document-settings xmlns:config CDATA #FIXED "&nConfig;">
+
+<!ATTLIST office:document-settings office:version %string; #IMPLIED>
+
+<!ENTITY % meta "(meta:generator?,
+ dc:title?,
+ dc:description?,
+ dc:subject?,
+ meta:initial-creator?,
+ meta:creation-date?,
+ dc:creator?,
+ dc:date?,
+ meta:printed-by?,
+ meta:print-date?,
+ meta:keywords?,
+ dc:language?,
+ meta:editing-cycles?,
+ meta:editing-duration?,
+ meta:hyperlink-behaviour?,
+ meta:auto-reload?,
+ meta:template?,
+ meta:user-defined*,
+ meta:document-statistic?)">
+<!ELEMENT office:meta %meta;>
+
+<!ENTITY % script "office:script-data*,office:events?">
+<!ELEMENT office:script (%script;)>
+
+<!ELEMENT office:script-data (script:libraries*)>
+<!ATTLIST office:script-data script:language %string; #REQUIRED>
+
+<!ELEMENT office:font-decls (style:font-decl)*>
+
+<!ENTITY % styles "(style:default-style|style:style|text:list-style|
+ number:number-style|number:currency-style|number:percentage-style|
+ number:date-style|number:time-style|number:boolean-style|
+ number:text-style|
+ draw:gradient|draw:hatch|draw:fill-image|draw:marker|draw:stroke-dash|
+ style:presentation-page-layout|draw:transparency)">
+
+<!-- Validity constraint: The elements
+ text:outline-style,
+ text:footnotes-configuration,
+ text:endnotes-configuration,
+ text:bibliography-configuration and
+ text:linenumbering-configuration
+ may appear only once!
+ Unfortunatetly, this constraint cannot be easily specified in the DTD.
+-->
+<!ELEMENT office:styles (%styles;|text:outline-style|
+ text:footnotes-configuration|text:endnotes-configuration|
+ text:bibliography-configuration|text:linenumbering-configuration)*>
+
+<!ELEMENT office:automatic-styles (%styles;|style:page-master)*>
+
+<!ELEMENT office:master-styles (draw:layer-set?,style:handout-master?,style:master-page*) >
+
+
+<!ENTITY % body "(office:forms?,(text:tracked-changes|table:tracked-changes)?,%text-decls;,table:calculation-settings?,table:content-validations?,table:label-ranges?,
+ (text:h|text:p|text:ordered-list|
+ text:unordered-list|table:table|draw:page|
+ draw:a|%shape;|text:section|text:table-of-content|
+ text:illustration-index|text:table-index|text:object-index|
+ text:user-index|text:alphabetical-index|text:bibliography|
+ %change-marks;)*,
+ table:named-expressions?,
+ table:database-ranges?,table:data-pilot-tables?,
+ table:consolidation?,
+ table:dde-links?,
+ presentation:settings?)">
+<!ELEMENT office:body %body;>
+<!ATTLIST office:body table:structure-protected %boolean; "false"
+ table:protection-key CDATA #IMPLIED>
+
+<!ELEMENT office:events (script:event|presentation:event)*>
+
+<!-- DDE source: for text sections and tables -->
+<!ELEMENT office:dde-source EMPTY>
+<!ATTLIST office:dde-source office:dde-application CDATA #IMPLIED>
+<!ATTLIST office:dde-source office:dde-topic CDATA #IMPLIED>
+<!ATTLIST office:dde-source office:dde-item CDATA #IMPLIED>
+<!ATTLIST office:dde-source office:automatic-update %boolean; "false">
+<!ATTLIST office:dde-source office:name CDATA #IMPLIED>
+<!ATTLIST office:dde-source table:conversion-mode (into-default-style-data-style|into-english-number|let-text) "into-default-style-data-style" >
+
+<!-- annotations -->
+<!-- limitation: in the current implementation, only plain text inside of
+ paragraphs is supported -->
+<!ELEMENT office:annotation (text:p)*>
+<!ATTLIST office:annotation office:author %string; #IMPLIED>
+<!ATTLIST office:annotation office:create-date %date; #IMPLIED>
+<!ATTLIST office:annotation office:create-date-string %string; #IMPLIED>
+<!ATTLIST office:annotation office:display %boolean; "false">
+
+<!ELEMENT office:change-info (text:p)*>
+<!ATTLIST office:change-info office:chg-author %string; #REQUIRED>
+<!ATTLIST office:change-info office:chg-date-time %timeInstance; #REQUIRED>
+
+<!ELEMENT office:binary-data (#PCDATA)>
diff --git a/xmloff/dtd/openoffice-2.0-schema.rng b/xmloff/dtd/openoffice-2.0-schema.rng
new file mode 100755
index 000000000000..36a319876682
--- /dev/null
+++ b/xmloff/dtd/openoffice-2.0-schema.rng
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+
+<grammar
+ xmlns="http://relaxng.org/ns/structure/1.0"
+ xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+
+ xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
+ xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
+ xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
+>
+<include href="office-strict-schema-1.0-cd-2.rng">
+
+<!-- ==================== -->
+<!-- replaced definitions -->
+<!-- ==================== -->
+
+<!-- list styles contained in graphic styles currently have no name (i36217) -->
+<define name="text-list-style-attr" combine="interleave">
+ <optional>
+ <attribute name="style:name">
+ <ref name="styleName"/>
+ </attribute>
+ </optional>
+</define>
+<define name="text-list-style-attr" combine="interleave">
+ <optional>
+ <attribute name="style:display-name">
+ <ref name="string"/>
+ </attribute>
+ </optional>
+</define>
+<define name="text-list-style-attr" combine="interleave">
+ <optional>
+ <attribute name="text:consecutive-numbering" a:defaultValue="false">
+ <ref name="boolean"/>
+ </attribute>
+ </optional>
+</define>
+
+</include>
+
+<!-- ====================== -->
+<!-- additional definitions -->
+<!-- ====================== -->
+
+<!-- The following definition is obsolete, but required for legacy -->
+<!-- files that have their origin in binary files (i35420). -->
+<define name="chart-plot-area-attlist" combine="interleave">
+ <optional>
+ <attribute name="chart:table-number-list">
+ <ref name="string"/>
+ </attribute>
+ </optional>
+</define>
+
+<!-- List styles contained in graphic styles currently are -->
+<!-- enabled by the following attribute (i36217). -->
+<define name="style-paragraph-properties-attlist" combine="interleave">
+ <optional>
+ <attribute name="text:enable-numbering">
+ <ref name="boolean"/>
+ </attribute>
+ </optional>
+</define>
+
+</grammar>
diff --git a/xmloff/dtd/script.mod b/xmloff/dtd/script.mod
new file mode 100755
index 000000000000..5e255ac6df4d
--- /dev/null
+++ b/xmloff/dtd/script.mod
@@ -0,0 +1,59 @@
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2000, 2010 Oracle and/or its affiliates.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+
+<!ELEMENT script:libraries (script:library-embedded | script:library-linked)*>
+<!ATTLIST script:libraries xmlns:script CDATA #FIXED "http://openoffice.org/2000/script">
+<!ATTLIST script:libraries xmlns:xlink CDATA #FIXED "http://www.w3.org/1999/xlink">
+
+<!ENTITY % boolean "(true|false)">
+
+<!ELEMENT script:library-embedded (script:module*)>
+<!ATTLIST script:library-embedded script:name %string; #REQUIRED>
+<!ATTLIST script:library-embedded script:readonly %boolean; #IMPLIED>
+
+<!ELEMENT script:library-linked EMPTY>
+<!ATTLIST script:library-linked script:name %string; #REQUIRED>
+<!ATTLIST script:library-linked xlink:href %string; #REQUIRED>
+<!ATTLIST script:library-linked xlink:type (simple) #FIXED "simple">
+<!ATTLIST script:library-linked script:readonly %boolean; #IMPLIED>
+
+<!ELEMENT script:module (script:source-code)>
+<!ATTLIST script:module script:name %string; #REQUIRED>
+
+<!ELEMENT script:source-code (#PCDATA)>
+
+
+<!ENTITY % script-language "script:language %string; #REQUIRED">
+<!ENTITY % event-name "script:event-name %string; #REQUIRED">
+<!ENTITY % location "script:location (document|application) #REQUIRED">
+<!ENTITY % macro-name "script:macro-name %string; #REQUIRED">
+
+<!ELEMENT script:event (#PCDATA)>
+<!ATTLIST script:event %script-language;
+ %event-name;
+ %location;
+ %macro-name;>
diff --git a/xmloff/dtd/settings.mod b/xmloff/dtd/settings.mod
new file mode 100755
index 000000000000..bb9224237fa8
--- /dev/null
+++ b/xmloff/dtd/settings.mod
@@ -0,0 +1,49 @@
+<!--
+
+ 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.
+
+-->
+
+<!ELEMENT office:settings (config:config-item-set+)>
+
+<!ENTITY % items "(config:config-item |
+ config:config-item-set |
+ config:config-item-map-named |
+ config:config-item-map-indexed)+">
+
+<!ELEMENT config:config-item-set %items;>
+<!ATTLIST config:config-item-set config:name CDATA #REQUIRED>
+
+<!ELEMENT config:config-item (#PCDATA)>
+<!ATTLIST config:config-item config:name CDATA #REQUIRED
+ config:type (boolean | short | int | long | double | string | datetime | base64Binary) #REQUIRED>
+
+<!ELEMENT config:config-item-map-named (config:config-item-map-entry)+>
+<!ATTLIST config:config-item-map-named config:name CDATA #REQUIRED>
+
+<!ELEMENT config:config-item-map-indexed (config:config-item-map-entry)+>
+<!ATTLIST config:config-item-map-indexed config:name CDATA #REQUIRED>
+
+<!ELEMENT config:config-item-map-entry %items;>
+<!ATTLIST config:config-item-map-entry config:name CDATA #IMPLIED>
diff --git a/xmloff/dtd/style.mod b/xmloff/dtd/style.mod
new file mode 100755
index 000000000000..fef8f73630ef
--- /dev/null
+++ b/xmloff/dtd/style.mod
@@ -0,0 +1,427 @@
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2000, 2010 Oracle and/or its affiliates.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+
+<!ELEMENT style:font-decl EMPTY>
+<!ATTLIST style:font-decl style:name %string; #REQUIRED>
+<!ATTLIST style:font-decl fo:font-family %string; #REQUIRED>
+<!ATTLIST style:font-decl style:font-style-name %string; #IMPLIED>
+<!ENTITY % fontFamilyGeneric "(roman|swiss|modern|decorative|script|system)">
+<!ATTLIST style:font-decl style:font-family-generic %fontFamilyGeneric;
+ #IMPLIED>
+<!ENTITY % fontPitch "(fixed|variable)">
+<!ATTLIST style:font-decl style:font-pitch %fontPitch; #IMPLIED>
+<!ATTLIST style:font-decl style:font-charset %textEncoding; #IMPLIED>
+
+<!ELEMENT style:style ( style:properties?,office:events?,style:map*)>
+
+<!ATTLIST style:style style:name %styleName; #REQUIRED>
+
+<!ENTITY % styleFamily "(paragraph|text|section|
+ table|table-column|table-row|table-cell|table-page|chart|graphics|default|drawing-page|presentation|control|ruby)">
+<!ATTLIST style:style style:family %styleFamily; #REQUIRED>
+
+<!ATTLIST style:style style:parent-style-name %styleName; #IMPLIED>
+<!ATTLIST style:style style:master-page-name %styleName; #IMPLIED>
+<!ATTLIST style:style style:next-style-name %styleName; #IMPLIED>
+<!ATTLIST style:style style:list-style-name %styleName; #IMPLIED>
+<!ATTLIST style:style style:data-style-name %styleName; #IMPLIED>
+
+<!ATTLIST style:style style:auto-update %boolean; "false">
+
+<!ATTLIST style:style style:class %string; #IMPLIED>
+
+<!ELEMENT style:default-style (style:properties?)>
+<!ATTLIST style:default-style style:family %styleFamily; #REQUIRED>
+
+<!ELEMENT style:map EMPTY>
+
+<!ATTLIST style:map style:condition %string; #REQUIRED>
+<!ATTLIST style:map style:apply-style-name %styleName; #REQUIRED>
+<!ATTLIST style:map style:base-cell-address %cell-address; #IMPLIED>
+
+<!ELEMENT style:properties ANY>
+
+<!-- number format properties -->
+<!ATTLIST style:properties style:num-prefix %string; #IMPLIED>
+<!ATTLIST style:properties style:num-suffix %string; #IMPLIED>
+<!ATTLIST style:properties style:num-format %string; #IMPLIED>
+<!ATTLIST style:properties style:num-letter-sync %boolean; #IMPLIED>
+
+<!-- frame properties -->
+<!ATTLIST style:properties fo:width %positiveLength; #IMPLIED>
+<!ATTLIST style:properties fo:height %positiveLength; #IMPLIED>
+<!ATTLIST style:properties style:vertical-pos (top|middle|bottom|from-top|below) #IMPLIED>
+<!ATTLIST style:properties style:vertical-rel (page|page-content|
+ frame|frame-content|
+ paragraph|paragraph-content|char|
+ line|baseline|text) #IMPLIED>
+<!ATTLIST style:properties style:horizontal-pos (left|center|right|from-left|inside|outside|from-inside) #IMPLIED>
+<!ATTLIST style:properties style:horizontal-rel (page|page-content|
+ page-start-margin|page-end-margin|
+ frame|frame-content|
+ frame-start-margin|frame-end-margin|
+ paragraph|paragraph-content|
+ paragraph-start-margin|paragraph-end-margin|
+ char) #IMPLIED>
+<!ATTLIST style:properties svg:width %lengthOrPercentage; #IMPLIED>
+<!ATTLIST style:properties svg:height %lengthOrPercentage; #IMPLIED>
+<!ATTLIST style:properties fo:min-height %lengthOrPercentage; #IMPLIED>
+<!ATTLIST style:properties fo:min-width %lengthOrPercentage; #IMPLIED>
+<!ATTLIST style:properties fo:max-height %lengthOrPercentage; #IMPLIED>
+<!ATTLIST style:properties fo:max-width %lengthOrPercentage; #IMPLIED>
+<!ATTLIST style:properties text:anchor-type %anchorType; #IMPLIED>
+<!ATTLIST style:properties text:anchor-page-number %positiveInteger; #IMPLIED>
+<!ATTLIST style:properties svg:x %coordinate; #IMPLIED>
+<!ATTLIST style:properties svg:y %coordinate; #IMPLIED>
+<!ATTLIST style:properties style:print-content %boolean; #IMPLIED>
+<!ATTLIST style:properties style:protect %boolean; #IMPLIED>
+<!ATTLIST style:properties style:wrap (none|left|right|parallel|dynamic|run-through) #IMPLIED>
+<!ENTITY % noLimitOrPositiveInteger "CDATA">
+<!ATTLIST style:properties style:number-wrapped-paragraphs %noLimitOrPositiveInteger; #IMPLIED>
+<!ATTLIST style:properties style:wrap-contour %boolean; #IMPLIED>
+<!ATTLIST style:properties style:wrap-contour-mode (full|outside) #IMPLIED>
+<!ATTLIST style:properties style:run-through (foreground|background) #IMPLIED>
+<!ATTLIST style:properties style:editable %boolean; #IMPLIED>
+<!ATTLIST style:properties style:mirror CDATA #IMPLIED>
+<!ATTLIST style:properties fo:clip CDATA #IMPLIED>
+<!ATTLIST style:properties text:animation (none|scroll|alternate|slide) #IMPLIED>
+<!ATTLIST style:properties text:animation-direction (left|right|up|down) #IMPLIED>
+<!ATTLIST style:properties text:animation-start-inside %boolean; #IMPLIED>
+<!ATTLIST style:properties text:animation-stop-inside %boolean; #IMPLIED>
+<!ATTLIST style:properties text:animation-repeat %integer; #IMPLIED>
+<!ATTLIST style:properties text:animation-delay %timeDuration; #IMPLIED>
+<!ATTLIST style:properties text:animation-steps %length; #IMPLIED>
+
+<!-- text properties -->
+<!ATTLIST style:properties fo:font-variant (normal|small-caps) #IMPLIED>
+<!ATTLIST style:properties fo:text-transform (none|lowercase|
+ uppercase|capitalize) #IMPLIED>
+<!ATTLIST style:properties fo:color %color; #IMPLIED>
+<!ATTLIST style:properties style:use-window-font-color %boolean; #IMPLIED>
+<!ATTLIST style:properties style:text-outline %boolean; #IMPLIED>
+<!ATTLIST style:properties style:text-crossing-out
+ (none|single-line|double-line|thick-line|slash|X)
+ #IMPLIED>
+<!ATTLIST style:properties style:text-position CDATA #IMPLIED>
+<!ATTLIST style:properties style:text-align (left|right|start|center|end|justify|justified) #IMPLIED>
+
+<!ATTLIST style:properties style:font-name %string; #IMPLIED>
+<!ATTLIST style:properties fo:font-family %string; #IMPLIED>
+<!ATTLIST style:properties style:font-family-generic %fontFamilyGeneric;
+ #IMPLIED>
+<!ATTLIST style:properties style:font-style-name %string; #IMPLIED>
+<!ATTLIST style:properties style:font-pitch %fontPitch; #IMPLIED>
+<!ATTLIST style:properties style:font-charset %textEncoding; #IMPLIED>
+<!ATTLIST style:properties style:font-name-asian %string; #IMPLIED>
+<!ATTLIST style:properties style:font-family-asian %string; #IMPLIED>
+<!ATTLIST style:properties style:font-family-generic-asian %fontFamilyGeneric;
+ #IMPLIED>
+<!ATTLIST style:properties style:font-style-name-asian %string; #IMPLIED>
+<!ATTLIST style:properties style:font-pitch-asian %fontPitch; #IMPLIED>
+<!ATTLIST style:properties style:font-charset-asian %textEncoding; #IMPLIED>
+<!ATTLIST style:properties style:font-name-complex %string; #IMPLIED>
+<!ATTLIST style:properties style:font-family-complex %string; #IMPLIED>
+<!ATTLIST style:properties style:font-family-generic-complex %fontFamilyGeneric;
+ #IMPLIED>
+<!ATTLIST style:properties style:font-style-name-complex %string; #IMPLIED>
+<!ATTLIST style:properties style:font-pitch-complex %fontPitch; #IMPLIED>
+<!ATTLIST style:properties style:font-charset-complex %textEncoding; #IMPLIED>
+
+<!ATTLIST style:properties fo:font-size %positiveLengthOrPercentage; #IMPLIED>
+<!ATTLIST style:properties style:font-size-rel %length; #IMPLIED>
+<!ATTLIST style:properties style:font-size-asian %positiveLengthOrPercentage; #IMPLIED>
+<!ATTLIST style:properties style:font-size-rel-asian %length; #IMPLIED>
+<!ATTLIST style:properties style:font-size-complex %positiveLengthOrPercentage; #IMPLIED>
+<!ATTLIST style:properties style:font-size-rel-complex %length; #IMPLIED>
+<!ENTITY % normalOrLength "CDATA">
+<!ATTLIST style:properties fo:letter-spacing %normalOrLength; #IMPLIED>
+<!ATTLIST style:properties fo:language %languageOnly; #IMPLIED>
+<!ATTLIST style:properties style:language-asian %languageOnly; #IMPLIED>
+<!ATTLIST style:properties style:language-complex %languageOnly; #IMPLIED>
+<!ATTLIST style:properties fo:country %country; #IMPLIED>
+<!ATTLIST style:properties style:country-asian %country; #IMPLIED>
+<!ATTLIST style:properties style:country-complex %country; #IMPLIED>
+<!ENTITY % fontStyle "(normal|italic|oblique)">
+<!ATTLIST style:properties fo:font-style %fontStyle; #IMPLIED>
+<!ATTLIST style:properties style:font-style-asian %fontStyle; #IMPLIED>
+<!ATTLIST style:properties style:font-style-complex %fontStyle; #IMPLIED>
+<!ENTITY % fontRelief "(none|embossed|engraved)">
+<!ATTLIST style:properties style:font-relief %fontRelief; #IMPLIED>
+<!ATTLIST style:properties fo:text-shadow CDATA #IMPLIED>
+<!ATTLIST style:properties style:text-underline
+ (none|single|double|dotted|dash|long-dash|dot-dash|
+ dot-dot-dash|wave|bold|bold-dotted|bold-dash|
+ bold-long-dash|bold-dot-dash|bold-dot-dot-dash|
+ bold-wave|double-wave|small-wave) #IMPLIED>
+<!ATTLIST style:properties style:text-autospace (none | ideograph-alpha) #IMPLIED>
+<!ATTLIST style:properties style:punctuation-wrap (simple | hanging) #IMPLIED>
+<!ATTLIST style:properties style:line-break (normal | strict) #IMPLIED>
+<!ENTITY % fontColorOrColor "CDATA">
+<!ATTLIST style:properties style:text-underline-color %fontColorOrColor;
+ #IMPLIED>
+<!ATTLIST style:properties fo:font-weight CDATA #IMPLIED>
+<!ATTLIST style:properties style:font-weight-asian CDATA #IMPLIED>
+<!ATTLIST style:properties style:font-weight-complex CDATA #IMPLIED>
+<!ATTLIST style:properties fo:score-spaces %boolean; #IMPLIED>
+<!ATTLIST style:properties style:letter-kerning %boolean; #IMPLIED>
+<!ATTLIST style:properties style:text-blinking %boolean; #IMPLIED>
+<!ATTLIST style:properties style:text-background-color %transparentOrColor;
+ #IMPLIED>
+
+<!ATTLIST style:properties style:text-combine (none|letters|lines) #IMPLIED>
+<!ATTLIST style:properties style:text-combine-start-char %character; #IMPLIED>
+<!ATTLIST style:properties style:text-combine-end-char %character; #IMPLIED>
+<!ATTLIST style:properties style:text-emphasize CDATA #IMPLIED>
+<!ATTLIST style:properties style:text-scale %percentage; #IMPLIED>
+<!ATTLIST style:properties style:text-rotation-angle %integer; #IMPLIED>
+<!ATTLIST style:properties style:text-rotation-scale (fixed|line-height) #IMPLIED>
+<!ATTLIST style:properties text:display (none|true) #IMPLIED>
+
+<!-- paragraph properties -->
+<!ENTITY % nonNegativeLengthOrPercentageOrNormal "CDATA">
+<!ATTLIST style:properties fo:line-height
+ %nonNegativeLengthOrPercentageOrNormal; #IMPLIED>
+<!ATTLIST style:properties style:line-height-at-least %nonNegativeLength;
+ #IMPLIED>
+<!ATTLIST style:properties style:line-spacing %length; #IMPLIED>
+<!ATTLIST style:properties fo:text-align (start|end|center|justify) #IMPLIED>
+<!ATTLIST style:properties fo:text-align-last (start|center|justify) #IMPLIED>
+<!ATTLIST style:properties style:text-align-source (fix|value-type) #IMPLIED>
+<!ATTLIST style:properties style:justify-single-word %boolean; #IMPLIED>
+<!-- fo:keep-together is new in OOo 2.0 -->
+<!ATTLIST style:properties fo:keep-together (auto|always) #IMPLIED>
+<!ATTLIST style:properties style:break-inside (auto|avoid) #IMPLIED>
+<!ATTLIST style:properties fo:widows %nonNegativeInteger; #IMPLIED>
+<!ATTLIST style:properties fo:orphans %nonNegativeInteger; #IMPLIED>
+
+<!ATTLIST style:properties fo:hyphenate %boolean; #IMPLIED>
+<!ATTLIST style:properties fo:hyphenate-keep (none|page) #IMPLIED>
+<!ATTLIST style:properties fo:hyphenation-remain-char-count %positiveInteger;
+ #IMPLIED>
+<!ATTLIST style:properties fo:hyphenation-push-char-count %positiveInteger;
+ #IMPLIED>
+<!ATTLIST style:properties fo:hyphenation-ladder-count
+ %noLimitOrPositiveInteger; #IMPLIED>
+<!ATTLIST style:properties style:page-number %positiveInteger; #IMPLIED>
+
+<!ELEMENT style:tab-stops (style:tab-stop)*>
+<!ELEMENT style:tab-stop EMPTY>
+<!ATTLIST style:tab-stop style:position %nonNegativeLength; #REQUIRED>
+<!ATTLIST style:tab-stop style:type (left|center|right|char|default) "left">
+<!ATTLIST style:tab-stop style:char %character; #IMPLIED>
+<!ATTLIST style:tab-stop style:leader-char %character; " ">
+
+<!ELEMENT style:drop-cap EMPTY>
+<!ENTITY % wordOrPositiveInteger "CDATA">
+<!ATTLIST style:drop-cap style:length %wordOrPositiveInteger; "1">
+<!ATTLIST style:drop-cap style:lines %positiveInteger; "1">
+<!ATTLIST style:drop-cap style:distance %length; "0cm">
+<!ATTLIST style:drop-cap style:style-name %styleName; #IMPLIED>
+
+<!ATTLIST style:properties style:register-true %boolean; #IMPLIED>
+<!ATTLIST style:properties style:register-truth-ref-style-name %styleName; #IMPLIED>
+<!ATTLIST style:properties fo:margin-left %positiveLengthOrPercentage; #IMPLIED>
+<!ATTLIST style:properties fo:margin-right %positiveLengthOrPercentage;
+ #IMPLIED>
+<!ATTLIST style:properties fo:text-indent %lengthOrPercentage; #IMPLIED>
+<!ATTLIST style:properties style:auto-text-indent %boolean; #IMPLIED>
+<!ATTLIST style:properties fo:margin-top %positiveLengthOrPercentage; #IMPLIED>
+<!ATTLIST style:properties fo:margin-bottom %positiveLengthOrPercentage; #IMPLIED>
+<!ATTLIST style:properties fo:break-before (auto|column|page) #IMPLIED>
+<!ATTLIST style:properties fo:break-after (auto|column|page) #IMPLIED>
+<!ATTLIST style:properties fo:background-color %transparentOrColor; #IMPLIED>
+<!ATTLIST style:properties style:background-transparency %percentage; #IMPLIED>
+<!ATTLIST style:properties style:dynamic-spacing %boolean; #IMPLIED>
+
+<!ELEMENT style:background-image (office:binary-data?)>
+<!ATTLIST style:background-image xlink:type (simple) #IMPLIED>
+<!ATTLIST style:background-image xlink:href %uriReference; #IMPLIED>
+<!ATTLIST style:background-image xlink:show (embed) #IMPLIED>
+<!ATTLIST style:background-image xlink:actuate (onLoad) #IMPLIED>
+<!ATTLIST style:background-image style:repeat (no-repeat|repeat|stretch)
+ "repeat">
+<!ATTLIST style:background-image style:position CDATA "center">
+<!ATTLIST style:background-image style:filter-name %string; #IMPLIED>
+<!ATTLIST style:background-image draw:transparency %percentage; #IMPLIED>
+
+<!ELEMENT style:symbol-image (office:binary-data?)>
+<!ATTLIST style:symbol-image xlink:type (simple) #IMPLIED>
+<!ATTLIST style:symbol-image xlink:href %uriReference; #IMPLIED>
+<!ATTLIST style:symbol-image xlink:show (embed) #IMPLIED>
+<!ATTLIST style:symbol-image xlink:actuate (onLoad) #IMPLIED>
+
+<!ATTLIST style:properties fo:border CDATA #IMPLIED>
+<!ATTLIST style:properties fo:border-top CDATA #IMPLIED>
+<!ATTLIST style:properties fo:border-bottom CDATA #IMPLIED>
+<!ATTLIST style:properties fo:border-left CDATA #IMPLIED>
+<!ATTLIST style:properties fo:border-right CDATA #IMPLIED>
+<!ATTLIST style:properties style:border-line-width CDATA #IMPLIED>
+<!ATTLIST style:properties style:border-line-width-top CDATA #IMPLIED>
+<!ATTLIST style:properties style:border-line-width-bottom CDATA #IMPLIED>
+<!ATTLIST style:properties style:border-line-width-left CDATA #IMPLIED>
+<!ATTLIST style:properties style:border-line-width-right CDATA #IMPLIED>
+<!ATTLIST style:properties fo:padding %nonNegativeLength; #IMPLIED>
+<!ATTLIST style:properties fo:padding-top %nonNegativeLength; #IMPLIED>
+<!ATTLIST style:properties fo:padding-bottom %nonNegativeLength; #IMPLIED>
+<!ATTLIST style:properties fo:padding-left %nonNegativeLength; #IMPLIED>
+<!ATTLIST style:properties fo:padding-right %nonNegativeLength; #IMPLIED>
+<!ATTLIST style:properties style:shadow CDATA #IMPLIED>
+<!ATTLIST style:properties fo:keep-with-next %boolean; #IMPLIED>
+<!ATTLIST style:properties style:join-border %boolean; #IMPLIED>
+
+<!ATTLIST style:properties text:number-lines %boolean; "false">
+<!ATTLIST style:properties text:line-number %nonNegativeInteger; #IMPLIED>
+
+<!ATTLIST style:properties style:decimal-places %nonNegativeInteger; #IMPLIED>
+<!ATTLIST style:properties style:tab-stop-distance %nonNegativeLength; #IMPLIED>
+
+<!-- section properties -->
+<!ATTLIST style:properties text:dont-balance-text-columns %boolean; #IMPLIED>
+
+<!-- ruby properties -->
+<!ATTLIST style:properties style:ruby-align (left|center|right|distribute-letter|distribute-space) #IMPLIED>
+<!ATTLIST style:properties style:ruby-position (above|below) #IMPLIED>
+
+
+<!-- table properties -->
+<!ATTLIST style:properties style:width %positiveLength; #IMPLIED>
+<!ATTLIST style:properties style:rel-width %percentage; #IMPLIED>
+<!ATTLIST style:properties style:may-break-between-rows %boolean; #IMPLIED>
+<!ATTLIST style:properties table:page-style-name %styleName; #IMPLIED>
+<!ATTLIST style:properties table:display %boolean; #IMPLIED>
+
+<!-- table column properties -->
+<!ATTLIST style:properties style:column-width %positiveLength; #IMPLIED>
+<!ENTITY % relWidth "CDATA">
+<!ATTLIST style:properties style:rel-column-width %relWidth; #IMPLIED>
+<!ATTLIST style:properties style:use-optimal-column-width %boolean; #IMPLIED>
+
+<!-- table row properties -->
+<!ATTLIST style:properties style:row-height %positiveLength; #IMPLIED>
+<!ATTLIST style:properties style:min-row-height %nonNegativeLength; #IMPLIED>
+<!ATTLIST style:properties style:use-optimal-row-height %boolean; #IMPLIED>
+
+<!-- table cell properties -->
+<!ATTLIST style:properties
+ table:align (left | center | right | margins) #IMPLIED
+ table:border-model (collapsing | separating) #IMPLIED
+ fo:vertical-align (top | middle | bottom | automatic) #IMPLIED
+ fo:direction (ltr | ttb) #IMPLIED
+ style:glyph-orientation-vertical (auto | 0) #IMPLIED
+ style:rotation-angle %nonNegativeInteger; #IMPLIED
+ style:rotation-align (none | bottom | top | center) #IMPLIED
+ style:cell-protect CDATA #IMPLIED
+ fo:wrap-option (no-wrap | wrap) #IMPLIED
+>
+<!ELEMENT style:columns (style:column-sep?,style:column*)>
+<!ATTLIST style:columns fo:column-count %nonNegativeInteger; #IMPLIED>
+<!ATTLIST style:columns fo:column-gap %positiveLength; #IMPLIED>
+
+<!ELEMENT style:column EMPTY>
+<!ATTLIST style:column style:rel-width CDATA #IMPLIED>
+<!ATTLIST style:column fo:margin-left %positiveLength; #IMPLIED>
+<!ATTLIST style:column fo:margin-right %positiveLength; #IMPLIED>
+
+<!ELEMENT style:column-sep EMPTY>
+<!ATTLIST style:column-sep style:style (none|solid|dotted|dashed|dot-dashed)
+ "solid">
+<!ATTLIST style:column-sep style:width %length; #REQUIRED>
+<!ATTLIST style:column-sep style:height %percentage; "100&#37;">
+<!ATTLIST style:column-sep style:vertical-align (top|middle|bottom) "top">
+<!ATTLIST style:column-sep style:color %color; "#000000">
+
+<!-- page master properties -->
+<!ELEMENT style:page-master (style:properties?, style:header-style?, style:footer-style?)>
+<!ATTLIST style:page-master style:name %styleName; #REQUIRED>
+<!ATTLIST style:page-master style:page-usage (all|left|right|mirrored) "all">
+
+<!ELEMENT style:header-style (style:properties?)>
+<!ELEMENT style:footer-style (style:properties?)>
+
+<!ATTLIST style:properties fo:page-width %length; #IMPLIED>
+<!ATTLIST style:properties fo:page-height %length; #IMPLIED>
+<!ATTLIST style:properties style:paper-tray-name %string; #IMPLIED>
+<!ATTLIST style:properties style:print-orientation (portrait|landscape) #IMPLIED>
+<!ATTLIST style:properties style:print CDATA #IMPLIED>
+<!ATTLIST style:properties style:print-page-order (ttb|ltr) #IMPLIED>
+<!ATTLIST style:properties style:first-page-number %positiveInteger; #IMPLIED>
+<!ATTLIST style:properties style:scale-to %percentage; #IMPLIED>
+<!ATTLIST style:properties style:scale-to-pages %positiveInteger; #IMPLIED>
+<!ATTLIST style:properties style:table-centering (horizontal | vertical | both | none) #IMPLIED>
+
+<!ATTLIST style:properties style:footnote-max-height %lengthOrNoLimit; #IMPLIED>
+<!ATTLIST style:properties style:vertical-align (top|bottom|middle|basline|auto) #IMPLIED>
+<!ATTLIST style:properties style:writing-mode (lr-tb|rl-tb|tb-rl|tb-lr|lr|rl|tb|page) "lr-tb">
+<!ATTLIST style:properties style:layout-grid-mode (none|line|both) #IMPLIED>
+<!ATTLIST style:properties style:layout-grid-base-height %length; #IMPLIED>
+<!ATTLIST style:properties style:layout-grid-ruby-height %length; #IMPLIED>
+<!ATTLIST style:properties style:layout-grid-lines %positiveInteger; #IMPLIED>
+<!ATTLIST style:properties style:layout-grid-color %color; #IMPLIED>
+<!ATTLIST style:properties style:layout-grid-ruby-below %boolean; #IMPLIED>
+<!ATTLIST style:properties style:layout-grid-print %boolean; #IMPLIED>
+<!ATTLIST style:properties style:layout-grid-display %boolean; #IMPLIED>
+<!ATTLIST style:properties style:snap-to-layout-grid %boolean; #IMPLIED>
+
+<!ELEMENT style:footnote-sep EMPTY>
+<!ATTLIST style:footnote-sep style:width %length; #IMPLIED>
+<!ATTLIST style:footnote-sep style:rel-width %percentage; #IMPLIED>
+<!ATTLIST style:footnote-sep style:color %color; #IMPLIED>
+<!ATTLIST style:footnote-sep style:adjustment (left|center|right) "left">
+<!ATTLIST style:footnote-sep style:distance-before-sep %length; #IMPLIED>
+<!ATTLIST style:footnote-sep style:distance-after-sep %length; #IMPLIED>
+
+<!-- master page -->
+<!ELEMENT style:master-page ( (style:header, style:header-left?)?, (style:footer, style:footer-left?)?,
+ office:forms?,style:style*, (%shapes;)*, presentation:notes? )>
+<!ATTLIST style:master-page style:name %styleName; #REQUIRED>
+<!ATTLIST style:master-page style:page-master-name %styleName; #REQUIRED>
+<!ATTLIST style:master-page style:next-style-name %styleName; #IMPLIED>
+<!ATTLIST style:master-page draw:style-name %styleName; #IMPLIED>
+
+<!-- handout master -->
+<!ELEMENT style:handout-master (%shapes;)*>
+<!ATTLIST style:handout-master presentation:presentation-page-layout-name %styleName; #IMPLIED>
+<!ATTLIST style:handout-master style:page-master-name %styleName; #IMPLIED>
+<!ATTLIST style:handout-master draw:style-name %styleName; #IMPLIED>
+
+<!ENTITY % hd-ft-content "( %headerText; | (style:region-left?, style:region-center?, style:region-right?) )">
+<!ELEMENT style:header %hd-ft-content;>
+<!ATTLIST style:header style:display %boolean; "true">
+<!ELEMENT style:footer %hd-ft-content;>
+<!ATTLIST style:footer style:display %boolean; "true">
+<!ELEMENT style:header-left %hd-ft-content;>
+<!ATTLIST style:header-left style:display %boolean; "true">
+<!ELEMENT style:footer-left %hd-ft-content;>
+<!ATTLIST style:footer-left style:display %boolean; "true">
+
+<!ENTITY % region-content "(text:p*)">
+<!ELEMENT style:region-left %region-content;>
+<!ELEMENT style:region-center %region-content;>
+<!ELEMENT style:region-right %region-content;>
+
+<!-- control shape properties -->
+<!ATTLIST style:properties draw:symbol-color %color; #IMPLIED>
diff --git a/xmloff/dtd/table.mod b/xmloff/dtd/table.mod
new file mode 100755
index 000000000000..be30da54293c
--- /dev/null
+++ b/xmloff/dtd/table.mod
@@ -0,0 +1,496 @@
+<!--
+
+ 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.
+
+-->
+
+<!ELEMENT table:calculation-settings (table:null-date?, table:iteration?)>
+<!ATTLIST table:calculation-settings
+ table:case-sensitive %boolean; "true"
+ table:precision-as-shown %boolean; "false"
+ table:search-criteria-must-apply-to-whole-cell %boolean; "true"
+ table:automatic-find-labels %boolean; "true"
+ table:use-regular-expressions %boolean; "true"
+ table:null-year %positiveInteger; "1930"
+>
+<!ELEMENT table:null-date EMPTY>
+<!ATTLIST table:null-date
+ table:value-type %valueType; #FIXED "date"
+ table:date-value %date; "1899-12-30"
+>
+<!ELEMENT table:iteration EMPTY>
+<!ATTLIST table:iteration
+ table:status (enable | disable) "disable"
+ table:steps %positiveInteger; "100"
+ table:maximum-difference %float; "0.001"
+>
+
+<!ELEMENT table:tracked-changes (table:cell-content-change | table:insertion | table:deletion | table:movement | table:rejection)*>
+<!ATTLIST table:tracked-changes table:track-changes %boolean; "true"
+ table:protected %boolean; "false"
+ table:protection-key CDATA #IMPLIED
+>
+
+<!ELEMENT table:dependences (table:dependence)+>
+<!ELEMENT table:dependence EMPTY>
+<!ATTLIST table:dependence
+ table:id CDATA #REQUIRED
+>
+<!ELEMENT table:deletions (table:cell-content-deletion | table:change-deletion)+>
+<!ELEMENT table:cell-content-deletion (table:cell-address?, table:change-track-table-cell?)>
+<!ATTLIST table:cell-content-deletion
+ table:id CDATA #IMPLIED
+>
+<!ELEMENT table:change-deletion EMPTY>
+<!ATTLIST table:change-deletion
+ table:id CDATA #IMPLIED
+>
+<!ELEMENT table:insertion (office:change-info, table:dependences?, table:deletions?)>
+<!ATTLIST table:insertion
+ table:id CDATA #REQUIRED
+ table:acceptance-state (accepted | rejected | pending) "pending"
+ table:rejecting-change-id %positiveInteger; #IMPLIED
+ table:type (row | column | table) #REQUIRED
+ table:position %integer; #REQUIRED
+ table:count %positiveInteger; "1"
+ table:table %integer; #IMPLIED
+>
+<!ELEMENT table:deletion (office:change-info, table:dependences?, table:deletions?, table:cut-offs?)>
+<!ATTLIST table:deletion
+ table:id CDATA #REQUIRED
+ table:acceptance-state (accepted | rejected | pending) "pending"
+ table:rejecting-change-id %positiveInteger; #IMPLIED
+ table:type (row | column | table) #REQUIRED
+ table:position %integer; #REQUIRED
+ table:count %positiveInteger; "1"
+ table:table %integer; #IMPLIED
+ table:multi-deletion-spanned %integer; #IMPLIED
+>
+<!ELEMENT table:cut-offs (table:movement-cut-off+ | (table:insertion-cut-off, table:movement-cut-off*))>
+<!ELEMENT table:insertion-cut-off EMPTY>
+<!ATTLIST table:insertion-cut-off
+ table:id CDATA #REQUIRED
+ table:position %integer; #REQUIRED
+>
+<!ELEMENT table:movement-cut-off EMPTY>
+<!ATTLIST table:movement-cut-off
+ table:id CDATA #REQUIRED
+ table:start-position %integer; #IMPLIED
+ table:end-position %integer; #IMPLIED
+ table:position %integer; #IMPLIED
+>
+<!ELEMENT table:movement (table:source-range-address, table:target-range-address, office:change-info, table:dependences?, table:deletions?)>
+<!ATTLIST table:movement
+ table:id CDATA #REQUIRED
+ table:acceptance-state (accepted | rejected | pending) "pending"
+ table:rejecting-change-id %positiveInteger; #IMPLIED
+>
+<!ELEMENT table:target-range-address EMPTY>
+<!ATTLIST table:target-range-address
+ table:column %integer; #IMPLIED
+ table:row %integer; #IMPLIED
+ table:table %integer; #IMPLIED
+ table:start-column %integer; #IMPLIED
+ table:start-row %integer; #IMPLIED
+ table:start-table %integer; #IMPLIED
+ table:end-column %integer; #IMPLIED
+ table:end-row %integer; #IMPLIED
+ table:end-table %integer; #IMPLIED
+>
+<!ELEMENT table:source-range-address EMPTY>
+<!ATTLIST table:source-range-address
+ table:column %integer; #IMPLIED
+ table:row %integer; #IMPLIED
+ table:table %integer; #IMPLIED
+ table:start-column %integer; #IMPLIED
+ table:start-row %integer; #IMPLIED
+ table:start-table %integer; #IMPLIED
+ table:end-column %integer; #IMPLIED
+ table:end-row %integer; #IMPLIED
+ table:end-table %integer; #IMPLIED
+>
+<!ELEMENT table:change-track-table-cell (text:p*)>
+<!ATTLIST table:change-track-table-cell
+ table:cell-address %cell-address; #IMPLIED
+ table:matrix-covered (true | false) "false"
+ table:formula %string; #IMPLIED
+ table:number-matrix-rows-spanned %positiveInteger; #IMPLIED
+ table:number-matrix-columns-spanned %positiveInteger; #IMPLIED
+ table:value-type %valueType; "string"
+ table:value %float; #IMPLIED
+ table:date-value %date; #IMPLIED
+ table:time-value %timeInstance; #IMPLIED
+ table:string-value %string; #IMPLIED
+>
+<!ELEMENT table:cell-content-change (table:cell-address, office:change-info, table:dependences?, table:deletions?, table:previous)>
+<!ATTLIST table:cell-content-change
+ table:id CDATA #REQUIRED
+ table:acceptance-state (accepted | rejected | pending) "pending"
+ table:rejecting-change-id %positiveInteger; #IMPLIED
+>
+<!ELEMENT table:cell-address EMPTY>
+<!ATTLIST table:cell-address
+ table:column %integer; #IMPLIED
+ table:row %integer; #IMPLIED
+ table:table %integer; #IMPLIED
+>
+<!ELEMENT table:previous (table:change-track-table-cell)>
+<!ATTLIST table:previous
+ table:id CDATA #IMPLIED
+>
+<!ELEMENT table:rejection (office:change-info, table:dependences?, table:deletions?)>
+<!ATTLIST table:rejection
+ table:id CDATA #REQUIRED
+ table:acceptance-state (accepted | rejected | pending) "pending"
+ table:rejecting-change-id %positiveInteger; #IMPLIED
+>
+
+<!ENTITY % table-columns "table:table-columns | ( table:table-column | table:table-column-group )+">
+<!ENTITY % table-header-columns "table:table-header-columns">
+<!ENTITY % table-rows "table:table-rows | ( table:table-row | table:table-row-group )+">
+<!ENTITY % table-header-rows "table:table-header-rows">
+<!ENTITY % table-column-groups "((%table-columns;),(%table-header-columns;,(%table-columns;)?)?) | (%table-header-columns;,(%table-columns;)?)">
+<!ENTITY % table-row-groups "((%table-rows;),(%table-header-rows;,(%table-rows;)?)?) | (%table-header-rows;,(%table-rows;)?)">
+<!ELEMENT table:table (table:table-source?, table:scenario?, office:forms?, table:shapes?, (%table-column-groups;), (%table-row-groups;))>
+<!ATTLIST table:table
+ table:name %string; #IMPLIED
+ table:style-name %styleName; #IMPLIED
+ table:protected %boolean; "false"
+ table:protection-key CDATA #IMPLIED
+ table:print-ranges %cell-range-address-list; #IMPLIED
+ table:automatic-print-range %boolean; #IMPLIED
+>
+<!ELEMENT table:table-source EMPTY>
+<!ATTLIST table:table-source
+ table:mode (copy-all | copy-results-only) "copy-all"
+ xlink:type (simple) #FIXED "simple"
+ xlink:actuate (onRequest) "onRequest"
+ xlink:href %uriReference; #REQUIRED
+ table:filter-name CDATA #IMPLIED
+ table:table-name CDATA #IMPLIED
+ table:filter-options CDATA #IMPLIED
+ table:refresh-delay %timeDuration; #IMPLIED
+>
+<!ELEMENT table:scenario EMPTY>
+<!ATTLIST table:scenario
+ table:display-border %boolean; "true"
+ table:border-color %color; #IMPLIED
+ table:copy-back %boolean; "true"
+ table:copy-styles %boolean; "true"
+ table:copy-formulas %boolean; "true"
+ table:is-active %boolean; #REQUIRED
+ table:scenario-ranges %cell-range-address-list; #REQUIRED
+ table:comment CDATA #IMPLIED
+>
+<!ELEMENT table:shapes %shapes;>
+<!ELEMENT table:table-column-group (table:table-header-columns | table:table-column | table:table-column-group)+>
+<!ATTLIST table:table-column-group
+ table:display %boolean; "true"
+>
+<!ELEMENT table:table-header-columns (table:table-column | table:table-column-group)+>
+<!ELEMENT table:table-columns (table:table-column | table:table-column-group)+>
+<!ELEMENT table:table-column EMPTY>
+<!ATTLIST table:table-column
+ table:number-columns-repeated %positiveInteger; "1"
+ table:style-name %styleName; #IMPLIED
+ table:visibility (visible | collapse | filter) "visible"
+ table:default-cell-style-name %styleName; #IMPLIED
+>
+<!ELEMENT table:table-row-group (table:table-header-rows | table:table-row | table:table-row-group)+>
+<!ATTLIST table:table-row-group
+ table:display %boolean; "true"
+>
+<!ELEMENT table:table-header-rows (table:table-row | table:table-row-group)+>
+<!ELEMENT table:table-rows (table:table-row | table:table-row-group)+>
+<!ENTITY % table-cells "(table:table-cell|table:covered-table-cell)+">
+<!ELEMENT table:table-row %table-cells;>
+<!ATTLIST table:table-row
+ table:number-rows-repeated %positiveInteger; "1"
+ table:style-name %styleName; #IMPLIED
+ table:visibility (visible | collapse | filter) "visible"
+ table:default-cell-style-name %styleName; #IMPLIED
+>
+
+<!ENTITY % text-wo-table "(text:h|text:p|text:ordered-list|text:unordered-list|%shapes;)*">
+<!ENTITY % cell-content "(table:cell-range-source?,office:annotation?,table:detective?,(table:sub-table|%text-wo-table;))">
+<!ELEMENT table:table-cell %cell-content;>
+<!ELEMENT table:covered-table-cell %cell-content;>
+<!ATTLIST table:table-cell
+ table:number-columns-repeated %positiveInteger; "1"
+ table:number-rows-spanned %positiveInteger; "1"
+ table:number-columns-spanned %positiveInteger; "1"
+ table:style-name %styleName; #IMPLIED
+ table:validation-name CDATA #IMPLIED
+ table:formula %string; #IMPLIED
+ table:number-matrix-rows-spanned %positiveInteger; #IMPLIED
+ table:number-matrix-columns-spanned %positiveInteger; #IMPLIED
+ table:value-type %valueType; "string"
+ table:value %float; #IMPLIED
+ table:date-value %date; #IMPLIED
+ table:time-value %timeInstance; #IMPLIED
+ table:boolean-value %boolean; #IMPLIED
+ table:string-value %string; #IMPLIED
+ table:currency %string; #IMPLIED
+>
+<!ATTLIST table:covered-table-cell
+ table:number-columns-repeated %positiveInteger; "1"
+ table:style-name %styleName; #IMPLIED
+ table:validation-name CDATA #IMPLIED
+ table:formula %string; #IMPLIED
+ table:number-matrix-rows-spanned %positiveInteger; #IMPLIED
+ table:number-matrix-columns-spanned %positiveInteger; #IMPLIED
+ table:value-type %valueType; "string"
+ table:value %float; #IMPLIED
+ table:date-value %date; #IMPLIED
+ table:time-value %timeInstance; #IMPLIED
+ table:boolean-value %boolean; #IMPLIED
+ table:string-value %string; #IMPLIED
+ table:currency %string; #IMPLIED
+>
+<!-- cell protection in writer: cell attribute; calc uses format -->
+<!ATTLIST table:table-cell table:protected %boolean; "false">
+
+<!ELEMENT table:cell-range-source EMPTY>
+<!ATTLIST table:cell-range-source
+ table:name %string; #REQUIRED
+ xlink:type (simple) #FIXED "simple"
+ xlink:actuate (onRequest) #FIXED "onRequest"
+ xlink:href %uriReference; #REQUIRED
+ table:filter-name %string; #REQUIRED
+ table:filter-options %string; #IMPLIED
+ table:last-column-spanned %positiveInteger; #REQUIRED
+ table:last-row-spanned %positiveInteger; #REQUIRED
+ table:refresh-delay %timeDuration; #IMPLIED
+>
+
+<!ELEMENT table:detective (table:highlighted-range*, table:operation*)>
+<!ELEMENT table:highlighted-range EMPTY>
+<!ATTLIST table:highlighted-range
+ table:cell-range-address %cell-range-address; #IMPLIED
+ table:direction (from-another-table | to-another-table | from-same-table | to-same-table) #IMPLIED
+ table:contains-error %boolean; #IMPLIED
+ table:marked-invalid %boolean; #IMPLIED
+>
+<!ELEMENT table:operation EMPTY>
+<!ATTLIST table:operation
+ table:name (trace-dependents | remove-dependents | trace-precedents | remove-precedents | trace-errors) #REQUIRED
+ table:index %nonNegativeInteger; #REQUIRED
+>
+
+<!ELEMENT table:content-validations (table:content-validation)+>
+<!ELEMENT table:content-validation (table:help-message?, (table:error-message | (table:error-macro, office:events?))?)>
+<!ATTLIST table:content-validation
+ table:name CDATA #REQUIRED
+ table:condition CDATA #IMPLIED
+ table:base-cell-address %cell-address; #IMPLIED
+ table:allow-empty-cell %boolean; #IMPLIED
+ table:show-list (no | unsorted | sorted-ascending) #IMPLIED
+>
+<!ELEMENT table:help-message (text:p*)>
+<!ATTLIST table:help-message
+ table:title CDATA #IMPLIED
+ table:display %boolean; #IMPLIED
+>
+<!ELEMENT table:error-message (text:p*)>
+<!ATTLIST table:error-message
+ table:title CDATA #IMPLIED
+ table:message-type (stop | warning | information) #IMPLIED
+ table:display %boolean; #IMPLIED
+>
+<!ELEMENT table:error-macro EMPTY>
+<!ATTLIST table:error-macro
+ table:name CDATA #IMPLIED
+ table:execute %boolean; #IMPLIED
+>
+
+<!ELEMENT table:sub-table ((%table-column-groups;) , (%table-row-groups;))>
+
+<!ELEMENT table:label-ranges (table:label-range)*>
+<!ELEMENT table:label-range EMPTY>
+<!ATTLIST table:label-range
+ table:label-cell-range-address %cell-range-address; #REQUIRED
+ table:data-cell-range-address %cell-range-address; #REQUIRED
+ table:orientation (column | row) #REQUIRED
+>
+
+<!ELEMENT table:named-expressions (table:named-range | table:named-expression)*>
+<!ELEMENT table:named-range EMPTY>
+<!ATTLIST table:named-range
+ table:name CDATA #REQUIRED
+ table:cell-range-address %cell-range-address; #REQUIRED
+ table:base-cell-address %cell-address; #IMPLIED
+ table:range-usable-as CDATA "none"
+>
+<!ELEMENT table:named-expression EMPTY>
+<!ATTLIST table:named-expression
+ table:name CDATA #REQUIRED
+ table:expression CDATA #REQUIRED
+ table:base-cell-address %cell-address; #IMPLIED
+>
+
+<!ELEMENT table:filter (table:filter-condition | table:filter-and | table:filter-or)>
+<!ATTLIST table:filter
+ table:target-range-address %cell-range-address; #IMPLIED
+ table:condition-source-range-address %cell-range-address; #IMPLIED
+ table:condition-source (self | cell-range) "self"
+ table:display-duplicates %boolean; "true"
+>
+<!ELEMENT table:filter-and (table:filter-or | table:filter-condition)+>
+<!ELEMENT table:filter-or (table:filter-and | table:filter-condition)+>
+<!ELEMENT table:filter-condition EMPTY>
+<!ATTLIST table:filter-condition
+ table:field-number %nonNegativeInteger; #REQUIRED
+ table:case-sensitive %boolean; "false"
+ table:data-type (text | number) "text"
+ table:value CDATA #REQUIRED
+ table:operator CDATA #REQUIRED
+>
+
+<!ELEMENT table:database-ranges (table:database-range)*>
+<!ELEMENT table:database-range ((table:database-source-sql | table:database-source-table | table:database-source-query)?, table:filter?, table:sort?, table:subtotal-rules?)>
+<!ATTLIST table:database-range
+ table:name CDATA #IMPLIED
+ table:is-selection %boolean; "false"
+ table:on-update-keep-styles %boolean; "false"
+ table:on-update-keep-size %boolean; "true"
+ table:has-persistant-data %boolean; "true"
+ table:orientation (row | column) "row"
+ table:contains-header %boolean; "true"
+ table:display-filter-buttons %boolean; "false"
+ table:target-range-address %cell-range-address; #REQUIRED
+ table:refresh-delay %timeDuration; #IMPLIED
+>
+<!ELEMENT table:database-source-sql EMPTY>
+<!ATTLIST table:database-source-sql
+ table:database-name CDATA #REQUIRED
+ table:sql-statement CDATA #REQUIRED
+ table:parse-sql-statements %boolean; "false"
+>
+<!ELEMENT table:database-source-table EMPTY>
+<!ATTLIST table:database-source-table
+ table:database-name CDATA #REQUIRED
+ table:table-name CDATA #REQUIRED
+>
+<!ELEMENT table:database-source-query EMPTY>
+<!ATTLIST table:database-source-query
+ table:database-name CDATA #REQUIRED
+ table:query-name CDATA #REQUIRED
+>
+
+<!ELEMENT table:sort (table:sort-by)+>
+<!ATTLIST table:sort
+ table:bind-styles-to-content %boolean; "true"
+ table:target-range-address %cell-range-address; #IMPLIED
+ table:case-sensitive %boolean; "false"
+ table:language CDATA #IMPLIED
+ table:country CDATA #IMPLIED
+ table:algorithm CDATA #IMPLIED
+>
+<!ELEMENT table:sort-by EMPTY>
+<!ATTLIST table:sort-by
+ table:field-number %nonNegativeInteger; #REQUIRED
+ table:data-type CDATA "automatic"
+ table:order (ascending | descending) "ascending"
+>
+
+<!ELEMENT table:subtotal-rules (table:sort-groups? | table:subtotal-rule*)?>
+<!ATTLIST table:subtotal-rules
+ table:bind-styles-to-content %boolean; "true"
+ table:case-sensitive %boolean; "false"
+ table:page-breaks-on-group-change %boolean; "false"
+>
+<!ELEMENT table:sort-groups EMPTY>
+<!ATTLIST table:sort-groups
+ table:data-type CDATA "automatic"
+ table:order (ascending | descending) "ascending"
+>
+<!ELEMENT table:subtotal-rule (table:subtotal-field)*>
+<!ATTLIST table:subtotal-rule
+ table:group-by-field-number %nonNegativeInteger; #REQUIRED
+>
+<!ELEMENT table:subtotal-field EMPTY>
+<!ATTLIST table:subtotal-field
+ table:field-number %nonNegativeInteger; #REQUIRED
+ table:function CDATA #REQUIRED
+>
+
+<!ELEMENT table:data-pilot-tables (table:data-pilot-table)*>
+<!ELEMENT table:data-pilot-table ((table:database-source-sql | table:database-source-table | table:database-source-query | table:source-service | table:source-cell-range)?, table:data-pilot-field+)>
+<!ATTLIST table:data-pilot-table
+ table:name CDATA #REQUIRED
+ table:application-data CDATA #IMPLIED
+ table:grand-total (none | row | column | both) "both"
+ table:ignore-empty-rows %boolean; "false"
+ table:identify-categories %boolean; "false"
+ table:target-range-address %cell-range-address; #REQUIRED
+ table:buttons %cell-range-address-list; #REQUIRED
+>
+<!ELEMENT table:source-service EMPTY>
+<!ATTLIST table:source-service
+ table:name CDATA #REQUIRED
+ table:source-name CDATA #REQUIRED
+ table:object-name CDATA #REQUIRED
+ table:username CDATA #IMPLIED
+ table:password CDATA #IMPLIED
+>
+<!ELEMENT table:source-cell-range (table:filter)?>
+<!ATTLIST table:source-cell-range
+ table:cell-range-address %cell-range-address; #REQUIRED
+>
+<!ELEMENT table:data-pilot-field (table:data-pilot-level)?>
+<!ATTLIST table:data-pilot-field
+ table:source-field-name CDATA #REQUIRED
+ table:is-data-layout-field %boolean; "false"
+ table:function CDATA #REQUIRED
+ table:orientation (row | column | data | page | hidden) #REQUIRED
+ table:used-hierarchy %positiveInteger; "1"
+>
+<!ELEMENT table:data-pilot-level (table:data-pilot-subtotals?, table:data-pilot-members?)>
+<!ATTLIST table:data-pilot-level
+ table:display-empty %boolean; #IMPLIED
+>
+<!ELEMENT table:data-pilot-subtotals (table:data-pilot-subtotal)*>
+<!ELEMENT table:data-pilot-subtotal EMPTY>
+<!ATTLIST table:data-pilot-subtotal
+ table:function CDATA #REQUIRED
+>
+<!ELEMENT table:data-pilot-members (table:data-pilot-member)*>
+<!ELEMENT table:data-pilot-member EMPTY>
+<!ATTLIST table:data-pilot-member
+ table:name CDATA #REQUIRED
+ table:display %boolean; #IMPLIED
+ table:display-details %boolean; #IMPLIED
+>
+
+<!ELEMENT table:consolidation EMPTY>
+<!ATTLIST table:consolidation
+ table:function CDATA #REQUIRED
+ table:source-cell-range-addresses %cell-range-address-list; #REQUIRED
+ table:target-cell-address %cell-address; #REQUIRED
+ table:use-label (none | column | row | both) "none"
+ table:link-to-source-data %boolean; "false"
+>
+
+<!ELEMENT table:dde-links (table:dde-link)+>
+<!ELEMENT table:dde-link (office:dde-source, table:table)>
diff --git a/xmloff/dtd/text.mod b/xmloff/dtd/text.mod
new file mode 100755
index 000000000000..909321312df8
--- /dev/null
+++ b/xmloff/dtd/text.mod
@@ -0,0 +1,1099 @@
+<!--
+
+ 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.
+
+-->
+
+<!ENTITY % fields "text:date |
+ text:time |
+ text:page-number |
+ text:page-continuation |
+ text:sender-firstname |
+ text:sender-lastname |
+ text:sender-initials |
+ text:sender-title |
+ text:sender-position |
+ text:sender-email |
+ text:sender-phone-private |
+ text:sender-fax |
+ text:sender-company |
+ text:sender-phone-work |
+ text:sender-street |
+ text:sender-city |
+ text:sender-postal-code |
+ text:sender-country |
+ text:sender-state-or-province |
+ text:author-name |
+ text:author-initials |
+ text:placeholder |
+ text:variable-set |
+ text:variable-get |
+ text:variable-input |
+ text:user-field-get |
+ text:user-field-input |
+ text:sequence |
+ text:expression |
+ text:text-input |
+ text:database-display |
+ text:database-next |
+ text:database-select |
+ text:database-row-number |
+ text:database-name |
+ text:initial-creator |
+ text:creation-date |
+ text:creation-time |
+ text:description |
+ text:user-defined |
+ text:print-time |
+ text:print-date |
+ text:printed-by |
+ text:title |
+ text:subject |
+ text:keywords |
+ text:editing-cycles |
+ text:editing-duration |
+ text:modification-time |
+ text:modification-date |
+ text:creator |
+ text:conditional-text |
+ text:hidden-text |
+ text:hidden-paragraph |
+ text:chapter |
+ text:file-name |
+ text:template-name |
+ text:page-variable-set |
+ text:page-variable-get |
+ text:execute-macro |
+ text:dde-connection |
+ text:reference-ref |
+ text:sequence-ref |
+ text:bookmark-ref |
+ text:footnote-ref |
+ text:endnote-ref |
+ text:sheet-name |
+ text:bibliography-mark |
+ text:page-count |
+ text:paragraph-count |
+ text:word-count |
+ text:character-count |
+ text:table-count |
+ text:image-count |
+ text:object-count |
+ office:annotation |
+ text:script |
+ text:measure" >
+
+<!ENTITY % inline-text-elements "
+ text:span|text:tab-stop|text:s|text:line-break|
+ text:footnote|text:endnote|text:a|
+ text:bookmark|text:bookmark-start|text:bookmark-end|
+ text:reference-mark|text:reference-mark-start|
+ text:reference-mark-end|%fields;|%shape;|
+ text:toc-mark-start | text:toc-mark-end |
+ text:toc-mark | text:user-index-mark-start |
+ text:user-index-mark-end | text:user-index-mark |
+ text:alphabetical-index-mark-start |
+ text:alphabetical-index-mark-end |
+ text:alphabetical-index-mark |
+ %change-marks; | draw:a | text:ruby">
+
+<!ENTITY % inline-text "( #PCDATA | %inline-text-elements; )*">
+
+<!ELEMENT text:p %inline-text;>
+<!ELEMENT text:h %inline-text;>
+
+<!ATTLIST text:p text:style-name %styleName; #IMPLIED>
+<!ATTLIST text:p text:cond-style-name %styleName; #IMPLIED>
+
+<!ATTLIST text:h text:style-name %styleName; #IMPLIED>
+<!ATTLIST text:h text:cond-style-name %styleName; #IMPLIED>
+<!ATTLIST text:h text:level %positiveInteger; "1">
+
+<!ELEMENT text:span %inline-text;>
+<!ATTLIST text:span text:style-name %styleName; #REQUIRED>
+
+<!ELEMENT text:a (#PCDATA | office:events | %inline-text-elements;)*>
+<!ATTLIST text:a xlink:href %uriReference; #REQUIRED>
+<!ATTLIST text:a xlink:type (simple) #FIXED "simple">
+<!ATTLIST text:a xlink:actuate (onRequest) "onRequest">
+<!ATTLIST text:a xlink:show (new|replace) "replace">
+<!ATTLIST text:a office:name %string; #IMPLIED>
+<!ATTLIST text:a office:target-frame-name %string; #IMPLIED>
+<!ATTLIST text:a text:style-name %styleName; #IMPLIED>
+<!ATTLIST text:a text:visited-style-name %styleName; #IMPLIED>
+
+
+<!ELEMENT text:s EMPTY>
+<!ATTLIST text:s text:c %positiveInteger; "1">
+
+<!ELEMENT text:tab-stop EMPTY>
+
+<!ELEMENT text:line-break EMPTY>
+
+
+<!ENTITY % list-items "((text:list-header,text:list-item*)|text:list-item+)">
+<!ELEMENT text:ordered-list %list-items;>
+<!ELEMENT text:unordered-list %list-items;>
+
+
+<!ATTLIST text:ordered-list text:style-name %styleName; #IMPLIED>
+<!ATTLIST text:unordered-list text:style-name %styleName; #IMPLIED>
+
+<!ATTLIST text:ordered-list text:continue-numbering %boolean; "false">
+
+<!ELEMENT text:list-header (text:p|text:h)+>
+<!ELEMENT text:list-item (text:p|text:h|text:ordered-list|text:unordered-list)+>
+
+<!ATTLIST text:list-item text:restart-numbering %boolean; "false">
+<!ATTLIST text:list-item text:start-value %positiveInteger; #IMPLIED>
+
+<!ELEMENT text:list-style (text:list-level-style-number|
+ text:list-level-style-bullet|
+ text:list-level-style-image)+>
+
+<!ATTLIST text:list-style style:name %styleName; #IMPLIED>
+
+<!ATTLIST text:list-style text:consecutive-numbering %boolean; "false">
+
+
+<!ELEMENT text:list-level-style-number (style:properties?)>
+
+<!ATTLIST text:list-level-style-number text:level %positiveInteger;
+ #REQUIRED>
+<!ATTLIST text:list-level-style-number text:style-name %styleName; #IMPLIED>
+
+<!ATTLIST text:list-level-style-number style:num-format %string; #REQUIRED>
+<!ATTLIST text:list-level-style-number style:num-prefix %string; #IMPLIED>
+<!ATTLIST text:list-level-style-number style:num-suffix %string; #IMPLIED>
+<!ATTLIST text:list-level-style-number style:num-letter-sync %boolean;
+ "false">
+<!ATTLIST text:list-level-style-number text:display-levels %positiveInteger;
+ "1">
+<!ATTLIST text:list-level-style-number text:start-value %positiveInteger;
+ "1">
+<!ELEMENT text:list-level-style-bullet (style:properties?)>
+
+<!ATTLIST text:list-level-style-bullet text:level %positiveInteger; #REQUIRED>
+<!ATTLIST text:list-level-style-bullet text:style-name %styleName; #IMPLIED>
+<!ATTLIST text:list-level-style-bullet text:bullet-char %character; #REQUIRED>
+<!ATTLIST text:list-level-style-bullet style:num-prefix %string; #IMPLIED>
+<!ATTLIST text:list-level-style-bullet style:num-suffix %string; #IMPLIED>
+
+<!ELEMENT text:list-level-style-image (style:properties?,office:binary-data?)>
+
+<!ATTLIST text:list-level-style-image text:level %positiveInteger; #REQUIRED>
+<!ATTLIST text:list-level-style-image xlink:type (simple) #IMPLIED>
+<!ATTLIST text:list-level-style-image xlink:href %uriReference; #IMPLIED>
+<!ATTLIST text:list-level-style-image xlink:actuate (onLoad) #IMPLIED>
+<!ATTLIST text:list-level-style-image xlink:show (embed) #IMPLIED>
+
+
+<!-- list properties -->
+<!ATTLIST style:properties text:space-before %nonNegativeLength; #IMPLIED>
+<!ATTLIST style:properties text:min-label-width %nonNegativeLength; #IMPLIED>
+<!ATTLIST style:properties text:min-label-distance %nonNegativeLength; #IMPLIED>
+<!ATTLIST style:properties text:enable-numbering %boolean; #IMPLIED>
+<!ATTLIST style:properties style:list-style-name %styleName; #IMPLIED>
+
+<!ELEMENT text:outline-style (text:outline-level-style)+>
+
+<!ELEMENT text:outline-level-style (style:properties?)>
+
+<!ATTLIST text:outline-level-style text:level %positiveInteger;
+ #REQUIRED>
+<!ATTLIST text:outline-level-style text:style-name %styleName; #IMPLIED>
+
+<!ATTLIST text:outline-level-style style:num-format %string; #REQUIRED>
+<!ATTLIST text:outline-level-style style:num-prefix %string; #IMPLIED>
+<!ATTLIST text:outline-level-style style:num-suffix %string; #IMPLIED>
+<!ATTLIST text:outline-level-style style:num-letter-sync %boolean;
+ "false">
+<!ATTLIST text:outline-level-style text:display-levels %positiveInteger;
+ "1">
+<!ATTLIST text:outline-level-style text:start-value %positiveInteger;
+ "1">
+
+<!ENTITY % field-declarations "text:variable-decls?,
+ text:user-field-decls?,
+ text:sequence-decls?">
+
+<!ENTITY % variableName "CDATA">
+
+<!ENTITY % formula "CDATA">
+
+<!ENTITY % valueAttr "text:value-type %valueType; #IMPLIED
+ text:currency CDATA #IMPLIED" >
+
+<!ENTITY % valueAndTypeAttr "%valueAttr;
+ text:value %float; #IMPLIED
+ text:date-value %date; #IMPLIED
+ text:time-value %timeInstance; #IMPLIED
+ text:boolean-value %boolean; #IMPLIED
+ text:string-value %string; #IMPLIED" >
+
+<!ENTITY % numFormat 'style:num-format CDATA #IMPLIED
+ style:num-letter-sync %boolean; "false"'>
+
+
+<!ELEMENT text:date (#PCDATA)>
+<!ATTLIST text:date text:date-value %timeInstance; #IMPLIED>
+<!ATTLIST text:date text:date-adjust %dateDuration; #IMPLIED>
+<!ATTLIST text:date text:fixed %boolean; "false">
+<!ATTLIST text:date style:data-style-name %styleName; #IMPLIED>
+
+<!ELEMENT text:time (#PCDATA)>
+<!ATTLIST text:time text:time-value %timeInstance; #IMPLIED>
+<!ATTLIST text:time text:time-adjust %timeDuration; #IMPLIED>
+<!ATTLIST text:time text:fixed %boolean; "false">
+<!ATTLIST text:time style:data-style-name %styleName; #IMPLIED>
+
+<!ELEMENT text:page-number (#PCDATA)>
+<!ATTLIST text:page-number text:page-adjust %positiveInteger; #IMPLIED>
+<!ATTLIST text:page-number text:select-page (previous|current|next) "current">
+<!ATTLIST text:page-number %numFormat;>
+
+<!ELEMENT text:page-continuation (#PCDATA)>
+<!ATTLIST text:page-continuation text:select-page (previous|next) #REQUIRED>
+<!ATTLIST text:page-continuation text:string-value %string; #IMPLIED>
+
+<!ELEMENT text:sender-firstname (#PCDATA)>
+<!ATTLIST text:sender-firstname text:fixed %boolean; "true">
+
+<!ELEMENT text:sender-lastname (#PCDATA)>
+<!ATTLIST text:sender-lastname text:fixed %boolean; "true">
+
+<!ELEMENT text:sender-initials (#PCDATA)>
+<!ATTLIST text:sender-initials text:fixed %boolean; "true">
+
+<!ELEMENT text:sender-title (#PCDATA)>
+<!ATTLIST text:sender-title text:fixed %boolean; "true">
+
+<!ELEMENT text:sender-position (#PCDATA)>
+<!ATTLIST text:sender-position text:fixed %boolean; "true">
+
+<!ELEMENT text:sender-email (#PCDATA)>
+<!ATTLIST text:sender-email text:fixed %boolean; "true">
+
+<!ELEMENT text:sender-phone-private (#PCDATA)>
+<!ATTLIST text:sender-phone-private text:fixed %boolean; "true">
+
+<!ELEMENT text:sender-fax (#PCDATA)>
+<!ATTLIST text:sender-fax text:fixed %boolean; "true">
+
+<!ELEMENT text:sender-company (#PCDATA)>
+<!ATTLIST text:sender-company text:fixed %boolean; "true">
+
+<!ELEMENT text:sender-phone-work (#PCDATA)>
+<!ATTLIST text:sender-phone-work text:fixed %boolean; "true">
+
+<!ELEMENT text:sender-street (#PCDATA)>
+<!ATTLIST text:sender-street text:fixed %boolean; "true">
+
+<!ELEMENT text:sender-city (#PCDATA)>
+<!ATTLIST text:sender-city text:fixed %boolean; "true">
+
+<!ELEMENT text:sender-postal-code (#PCDATA)>
+<!ATTLIST text:sender-postal-code text:fixed %boolean; "true">
+
+<!ELEMENT text:sender-country (#PCDATA)>
+<!ATTLIST text:sender-country text:fixed %boolean; "true">
+
+<!ELEMENT text:sender-state-or-province (#PCDATA)>
+<!ATTLIST text:sender-state-or-province text:fixed %boolean; "true">
+
+<!ELEMENT text:author-name (#PCDATA)>
+<!ATTLIST text:author-name text:fixed %boolean; "true">
+
+<!ELEMENT text:author-initials (#PCDATA)>
+<!ATTLIST text:author-initials text:fixed %boolean; "true">
+
+<!ELEMENT text:placeholder (#PCDATA)>
+<!ATTLIST text:placeholder text:placeholder-type (text|table|text-box|image|object) #REQUIRED>
+<!ATTLIST text:placeholder text:description %string; #IMPLIED>
+
+<!ELEMENT text:variable-decls (text:variable-decl)*>
+
+<!ELEMENT text:variable-decl EMPTY>
+<!ATTLIST text:variable-decl text:name %variableName; #REQUIRED>
+<!ATTLIST text:variable-decl %valueAndTypeAttr;>
+
+<!ELEMENT text:variable-set (#PCDATA)>
+<!ATTLIST text:variable-set text:name %variableName; #REQUIRED>
+<!ATTLIST text:variable-set text:formula %formula; #IMPLIED>
+<!ATTLIST text:variable-set %valueAndTypeAttr;>
+<!ATTLIST text:variable-set text:display (value|none) "value">
+<!ATTLIST text:variable-set style:data-style-name %styleName; #IMPLIED>
+
+<!ELEMENT text:variable-get (#PCDATA)>
+<!ATTLIST text:variable-get text:name %variableName; #REQUIRED>
+<!ATTLIST text:variable-get text:display (value|formula) "value">
+<!ATTLIST text:variable-get style:data-style-name %styleName; #IMPLIED>
+<!ATTLIST text:variable-get %valueAttr;>
+
+<!ELEMENT text:variable-input (#PCDATA)>
+<!ATTLIST text:variable-input text:name %variableName; #REQUIRED>
+<!ATTLIST text:variable-input text:description %string; #IMPLIED>
+<!ATTLIST text:variable-input %valueAndTypeAttr;>
+<!ATTLIST text:variable-input text:display (value|none) "value">
+<!ATTLIST text:variable-input style:data-style-name %styleName; #IMPLIED>
+
+<!ELEMENT text:user-field-decls (text:user-field-decl)*>
+
+<!ELEMENT text:user-field-decl EMPTY>
+<!ATTLIST text:user-field-decl text:name %variableName; #REQUIRED>
+<!ATTLIST text:user-field-decl text:formula %formula; #IMPLIED>
+<!ATTLIST text:user-field-decl %valueAndTypeAttr;>
+
+<!ELEMENT text:user-field-get (#PCDATA)>
+<!ATTLIST text:user-field-get text:name %variableName; #REQUIRED>
+<!ATTLIST text:user-field-get text:display (value|formula|none) "value">
+<!ATTLIST text:user-field-get style:data-style-name %styleName; #IMPLIED>
+
+<!ELEMENT text:user-field-input (#PCDATA)>
+<!ATTLIST text:user-field-input text:name %variableName; #REQUIRED>
+<!ATTLIST text:user-field-input text:description %string; #IMPLIED>
+<!ATTLIST text:user-field-input style:data-style-name %styleName; #IMPLIED>
+
+<!ELEMENT text:sequence-decls (text:sequence-decl)*>
+
+<!ELEMENT text:sequence-decl EMPTY>
+<!ATTLIST text:sequence-decl text:name %variableName; #REQUIRED>
+<!ATTLIST text:sequence-decl text:display-outline-level %positiveInteger; "0">
+<!ATTLIST text:sequence-decl text:separation-character %character; ".">
+
+<!ELEMENT text:sequence (#PCDATA)>
+<!ATTLIST text:sequence text:name %variableName; #REQUIRED>
+<!ATTLIST text:sequence text:formula %formula; #IMPLIED>
+<!ATTLIST text:sequence %numFormat;>
+<!ATTLIST text:sequence text:ref-name ID #IMPLIED>
+
+<!ELEMENT text:expression (#PCDATA)>
+<!ATTLIST text:expression text:formula %formula; #IMPLIED>
+<!ATTLIST text:expression text:display (value|formula ) "value">
+<!ATTLIST text:expression %valueAndTypeAttr;>
+<!ATTLIST text:expression style:data-style-name %styleName; #IMPLIED>
+
+<!ELEMENT text:text-input (#PCDATA)>
+<!ATTLIST text:text-input text:description %string; #IMPLIED>
+
+<!ENTITY % database-table "text:database-name CDATA #REQUIRED
+ text:table-name CDATA #REQUIRED
+ text:table-type (table|query|command) #IMPLIED">
+
+<!ELEMENT text:database-display (#PCDATA)>
+<!ATTLIST text:database-display %database-table;>
+<!ATTLIST text:database-display text:column-name %string; #REQUIRED>
+<!ATTLIST text:database-display style:data-style-name %styleName; #IMPLIED>
+<!ATTLIST text:database-display text:display (none|value) #IMPLIED>
+
+<!ELEMENT text:database-next (#PCDATA)>
+<!ATTLIST text:database-next %database-table;>
+<!ATTLIST text:database-next text:condition %formula; #IMPLIED>
+
+<!ELEMENT text:database-select (#PCDATA)>
+<!ATTLIST text:database-select %database-table;>
+<!ATTLIST text:database-select text:condition %formula; #IMPLIED>
+<!ATTLIST text:database-select text:row-number %integer; #REQUIRED>
+
+<!ELEMENT text:database-row-number (#PCDATA)>
+<!ATTLIST text:database-row-number %database-table;>
+<!ATTLIST text:database-row-number %numFormat;>
+<!ATTLIST text:database-row-number text:value %integer; #IMPLIED>
+<!ATTLIST text:database-row-number text:display (none|value) #IMPLIED>
+
+<!ELEMENT text:database-name (#PCDATA)>
+<!ATTLIST text:database-name %database-table;>
+<!ATTLIST text:database-name text:display (none|value) #IMPLIED>
+
+<!ELEMENT text:initial-creator (#PCDATA)>
+<!ATTLIST text:initial-creator text:fixed %boolean; "false">
+
+<!ELEMENT text:creation-date (#PCDATA)>
+<!ATTLIST text:creation-date text:fixed %boolean; "false">
+<!ATTLIST text:creation-date text:date-value %date; #IMPLIED>
+<!ATTLIST text:creation-date style:data-style-name %styleName; #IMPLIED>
+
+<!ELEMENT text:creation-time (#PCDATA)>
+<!ATTLIST text:creation-time text:fixed %boolean; "false">
+<!ATTLIST text:creation-time text:time-value %timeInstance; #IMPLIED>
+<!ATTLIST text:creation-time style:data-style-name %styleName; #IMPLIED>
+
+<!ELEMENT text:description (#PCDATA)>
+<!ATTLIST text:description text:fixed %boolean; "false">
+
+<!ELEMENT text:user-defined (#PCDATA)>
+<!ATTLIST text:user-defined text:fixed %boolean; "false">
+<!ATTLIST text:user-defined text:name %string; #REQUIRED>
+
+<!ELEMENT text:print-time (#PCDATA)>
+<!ATTLIST text:print-time text:fixed %boolean; "false">
+<!ATTLIST text:print-time text:time-value %timeInstance; #IMPLIED>
+<!ATTLIST text:print-time style:data-style-name %styleName; #IMPLIED>
+
+<!ELEMENT text:print-date (#PCDATA)>
+<!ATTLIST text:print-date text:fixed %boolean; "false">
+<!ATTLIST text:print-date text:date-value %date; #IMPLIED>
+<!ATTLIST text:print-date style:data-style-name %styleName; #IMPLIED>
+
+<!ELEMENT text:printed-by (#PCDATA)>
+<!ATTLIST text:printed-by text:fixed %boolean; "false">
+
+<!ELEMENT text:title (#PCDATA)>
+<!ATTLIST text:title text:fixed %boolean; "false">
+
+<!ELEMENT text:subject (#PCDATA)>
+<!ATTLIST text:subject text:fixed %boolean; "false">
+
+<!ELEMENT text:keywords (#PCDATA)>
+<!ATTLIST text:keywords text:fixed %boolean; "false">
+
+<!ELEMENT text:editing-cycles (#PCDATA)>
+<!ATTLIST text:editing-cycles text:fixed %boolean; "false">
+
+<!ELEMENT text:editing-duration (#PCDATA)>
+<!ATTLIST text:editing-duration text:fixed %boolean; "false">
+<!ATTLIST text:editing-duration text:duration %timeDuration; #IMPLIED>
+<!ATTLIST text:editing-duration style:data-style-name %styleName; #IMPLIED>
+
+<!ELEMENT text:modification-time (#PCDATA)>
+<!ATTLIST text:modification-time text:fixed %boolean; "false">
+<!ATTLIST text:modification-time text:time-value %timeInstance; #IMPLIED>
+<!ATTLIST text:modification-time style:data-style-name %styleName; #IMPLIED>
+
+<!ELEMENT text:modification-date (#PCDATA)>
+<!ATTLIST text:modification-date text:fixed %boolean; "false">
+<!ATTLIST text:modification-date text:date-value %date; #IMPLIED>
+<!ATTLIST text:modification-date style:data-style-name %styleName; #IMPLIED>
+
+<!ELEMENT text:creator (#PCDATA)>
+<!ATTLIST text:creator text:fixed %boolean; "false">
+
+<!ELEMENT text:conditional-text (#PCDATA)>
+<!ATTLIST text:conditional-text text:condition %formula; #REQUIRED>
+<!ATTLIST text:conditional-text text:string-value-if-false %string; #REQUIRED>
+<!ATTLIST text:conditional-text text:string-value-if-true %string; #REQUIRED>
+<!ATTLIST text:conditional-text text:current-value %boolean; "false">
+
+<!ELEMENT text:hidden-text (#PCDATA)>
+<!ATTLIST text:hidden-text text:condition %formula; #REQUIRED>
+<!ATTLIST text:hidden-text text:string-value %string; #REQUIRED>
+<!ATTLIST text:hidden-text text:is-hidden %boolean; "false">
+
+<!ELEMENT text:hidden-paragraph EMPTY>
+<!ATTLIST text:hidden-paragraph text:condition %formula; #REQUIRED>
+<!ATTLIST text:hidden-paragraph text:is-hidden %boolean; "false">
+
+<!ELEMENT text:chapter (#PCDATA)>
+<!ATTLIST text:chapter text:display (name|number|number-and-name|
+ plain-number-and-name|plain-number)
+ "number-and-name">
+<!ATTLIST text:chapter text:outline-level %integer; "1">
+
+<!ELEMENT text:file-name (#PCDATA)>
+<!ATTLIST text:file-name text:display (full|path|name|name-and-extension)
+ "full">
+<!ATTLIST text:file-name text:fixed %boolean; "false">
+
+<!ELEMENT text:template-name (#PCDATA)>
+<!ATTLIST text:template-name text:display (full|path|name|name-and-extension|
+ area|title) "full">
+
+<!ELEMENT text:page-variable-set EMPTY>
+<!ATTLIST text:page-variable-set text:active %boolean; "true">
+<!ATTLIST text:page-variable-set text:page-adjust %integer; "0">
+
+<!ELEMENT text:page-variable-get (#PCDATA)>
+<!ATTLIST text:page-variable-get %numFormat;>
+
+<!ELEMENT text:execute-macro (#PCDATA|office:events)* >
+<!ATTLIST text:execute-macro text:description %string; #IMPLIED>
+
+
+<!ELEMENT text:dde-connection-decls (text:dde-connection-decl)*>
+
+<!ELEMENT text:dde-connection-decl EMPTY>
+<!ATTLIST text:dde-connection-decl text:name %string; #REQUIRED>
+<!ATTLIST text:dde-connection-decl office:dde-application %string; #REQUIRED>
+<!ATTLIST text:dde-connection-decl office:dde-topic %string; #REQUIRED>
+<!ATTLIST text:dde-connection-decl office:dde-item %string; #REQUIRED>
+<!ATTLIST text:dde-connection-decl office:automatic-update %boolean; "false">
+
+<!ELEMENT text:dde-connection (#PCDATA)>
+<!ATTLIST text:dde-connection text:connection-name %string; #REQUIRED>
+
+<!ELEMENT text:reference-ref (#PCDATA)>
+<!ATTLIST text:reference-ref text:ref-name %string; #REQUIRED>
+<!ATTLIST text:reference-ref text:reference-format (page|chapter|text|direction) #IMPLIED>
+
+<!ELEMENT text:sequence-ref (#PCDATA)>
+<!ATTLIST text:sequence-ref text:ref-name %string; #REQUIRED>
+<!ATTLIST text:sequence-ref text:reference-format (page|chapter|text|direction|category-and-value|caption|value) #IMPLIED>
+
+<!ELEMENT text:bookmark-ref (#PCDATA)>
+<!ATTLIST text:bookmark-ref text:ref-name %string; #REQUIRED>
+<!ATTLIST text:bookmark-ref text:reference-format (page|chapter|text|direction) #IMPLIED>
+
+<!ELEMENT text:footnote-ref (#PCDATA)>
+<!ATTLIST text:footnote-ref text:ref-name %string; #REQUIRED>
+<!ATTLIST text:footnote-ref text:reference-format (page|chapter|text|direction) #IMPLIED>
+
+<!ELEMENT text:endnote-ref (#PCDATA)>
+<!ATTLIST text:endnote-ref text:ref-name %string; #REQUIRED>
+<!ATTLIST text:endnote-ref text:reference-format (page|chapter|text|direction) #IMPLIED>
+
+<!ELEMENT text:sheet-name (#PCDATA)>
+
+<!ELEMENT text:page-count (#PCDATA)>
+<!ATTLIST text:page-count style:num-format %string; #IMPLIED>
+<!ATTLIST text:page-count style:num-letter-sync %boolean; "false">
+
+<!ELEMENT text:paragraph-count (#PCDATA)>
+<!ATTLIST text:paragraph-count style:num-format %string; #IMPLIED>
+<!ATTLIST text:paragraph-count style:num-letter-sync %boolean; "false">
+
+<!ELEMENT text:word-count (#PCDATA)>
+<!ATTLIST text:word-count style:num-format %string; #IMPLIED>
+<!ATTLIST text:word-count style:num-letter-sync %boolean; "false">
+
+<!ELEMENT text:character-count (#PCDATA)>
+<!ATTLIST text:character-count style:num-format %string; #IMPLIED>
+<!ATTLIST text:character-count style:num-letter-sync %boolean; "false">
+
+<!ELEMENT text:table-count (#PCDATA)>
+<!ATTLIST text:table-count style:num-format %string; #IMPLIED>
+<!ATTLIST text:table-count style:num-letter-sync %boolean; "false">
+
+<!ELEMENT text:image-count (#PCDATA)>
+<!ATTLIST text:image-count style:num-format %string; #IMPLIED>
+<!ATTLIST text:image-count style:num-letter-sync %boolean; "false">
+
+<!ELEMENT text:object-count (#PCDATA)>
+<!ATTLIST text:object-count style:num-format %string; #IMPLIED>
+<!ATTLIST text:object-count style:num-letter-sync %boolean; "false">
+
+<!ELEMENT text:bibliography-mark (#PCDATA)>
+<!ATTLIST text:bibliography-mark text:bibliography-type
+ ( article | book | booklet | conference | custom1 | custom2 | custom3 |
+ custom4 | custom5 | email | inbook | incollection | inproceedings |
+ journal | manual | mastersthesis | misc | phdthesis | proceedings |
+ techreport | unpublished | www ) #REQUIRED >
+<!ATTLIST text:bibliography-mark text:identifier CDATA #IMPLIED>
+<!ATTLIST text:bibliography-mark text:address CDATA #IMPLIED>
+<!ATTLIST text:bibliography-mark text:annote CDATA #IMPLIED>
+<!ATTLIST text:bibliography-mark text:author CDATA #IMPLIED>
+<!ATTLIST text:bibliography-mark text:booktitle CDATA #IMPLIED>
+<!ATTLIST text:bibliography-mark text:chapter CDATA #IMPLIED>
+<!ATTLIST text:bibliography-mark text:edition CDATA #IMPLIED>
+<!ATTLIST text:bibliography-mark text:editor CDATA #IMPLIED>
+<!ATTLIST text:bibliography-mark text:howpublished CDATA #IMPLIED>
+<!ATTLIST text:bibliography-mark text:institution CDATA #IMPLIED>
+<!ATTLIST text:bibliography-mark text:journal CDATA #IMPLIED>
+<!ATTLIST text:bibliography-mark text:month CDATA #IMPLIED>
+<!ATTLIST text:bibliography-mark text:note CDATA #IMPLIED>
+<!ATTLIST text:bibliography-mark text:number CDATA #IMPLIED>
+<!ATTLIST text:bibliography-mark text:organizations CDATA #IMPLIED>
+<!ATTLIST text:bibliography-mark text:pages CDATA #IMPLIED>
+<!ATTLIST text:bibliography-mark text:publisher CDATA #IMPLIED>
+<!ATTLIST text:bibliography-mark text:school CDATA #IMPLIED>
+<!ATTLIST text:bibliography-mark text:series CDATA #IMPLIED>
+<!ATTLIST text:bibliography-mark text:title CDATA #IMPLIED>
+<!ATTLIST text:bibliography-mark text:report-type CDATA #IMPLIED>
+<!ATTLIST text:bibliography-mark text:volume CDATA #IMPLIED>
+<!ATTLIST text:bibliography-mark text:year CDATA #IMPLIED>
+<!ATTLIST text:bibliography-mark text:url CDATA #IMPLIED>
+<!ATTLIST text:bibliography-mark text:custom1 CDATA #IMPLIED>
+<!ATTLIST text:bibliography-mark text:custom2 CDATA #IMPLIED>
+<!ATTLIST text:bibliography-mark text:custom3 CDATA #IMPLIED>
+<!ATTLIST text:bibliography-mark text:custom4 CDATA #IMPLIED>
+<!ATTLIST text:bibliography-mark text:custom5 CDATA #IMPLIED>
+<!ATTLIST text:bibliography-mark text:isbn CDATA #IMPLIED>
+
+
+<!ELEMENT text:bookmark EMPTY>
+<!ATTLIST text:bookmark text:name CDATA #REQUIRED>
+
+<!ELEMENT text:bookmark-start EMPTY>
+<!ATTLIST text:bookmark-start text:name CDATA #REQUIRED>
+
+<!ELEMENT text:bookmark-end EMPTY>
+<!ATTLIST text:bookmark-end text:name CDATA #REQUIRED>
+
+<!ELEMENT text:reference-mark EMPTY>
+<!ATTLIST text:reference-mark text:name CDATA #REQUIRED>
+
+<!ELEMENT text:reference-mark-start EMPTY>
+<!ATTLIST text:reference-mark-start text:name CDATA #REQUIRED>
+
+<!ELEMENT text:reference-mark-end EMPTY>
+<!ATTLIST text:reference-mark-end text:name CDATA #REQUIRED>
+
+<!ELEMENT text:footnotes-configuration (text:footnote-continuation-notice-forward?,text:footnote-continuation-notice-backward?)>
+<!ATTLIST text:footnotes-configuration style:num-prefix %string; #IMPLIED>
+<!ATTLIST text:footnotes-configuration style:num-suffix %string; #IMPLIED>
+<!ATTLIST text:footnotes-configuration style:num-format %string; #IMPLIED>
+<!ATTLIST text:footnotes-configuration style:num-letter-sync %string; #IMPLIED>
+<!ATTLIST text:footnotes-configuration text:citation-body-style-name %styleName; #IMPLIED>
+<!ATTLIST text:footnotes-configuration text:citation-style-name %styleName; #IMPLIED>
+<!ATTLIST text:footnotes-configuration text:default-style-name %styleName; #IMPLIED>
+<!ATTLIST text:footnotes-configuration text:master-page-name %styleName; #IMPLIED>
+<!ATTLIST text:footnotes-configuration text:start-value %integer; #IMPLIED>
+<!ATTLIST text:footnotes-configuration text:footnotes-position (document|page) "page">
+<!ATTLIST text:footnotes-configuration text:start-numbering-at (document|chapter|page) "document">
+
+<!ELEMENT text:footnote-continuation-notice-forward (#PCDATA)>
+<!ELEMENT text:footnote-continuation-notice-backward (#PCDATA)>
+
+<!ELEMENT text:endnotes-configuration EMPTY>
+<!ATTLIST text:endnotes-configuration style:num-prefix %string; #IMPLIED>
+<!ATTLIST text:endnotes-configuration style:num-suffix %string; #IMPLIED>
+<!ATTLIST text:endnotes-configuration style:num-format %string; #IMPLIED>
+<!ATTLIST text:endnotes-configuration style:num-letter-sync %string; #IMPLIED>
+<!ATTLIST text:endnotes-configuration text:start-value %integer; #IMPLIED>
+<!ATTLIST text:endnotes-configuration text:citation-style-name %styleName; #IMPLIED>
+<!ATTLIST text:endnotes-configuration text:citation-body-style-name %styleName; #IMPLIED>
+<!ATTLIST text:endnotes-configuration text:default-style-name %styleName; #IMPLIED>
+<!ATTLIST text:endnotes-configuration text:master-page-name %styleName; #IMPLIED>
+
+<!-- Validity constraint: text:footnote and text:endnote elements may not
+ contain other text:footnote or text:endnote elements, even though the DTD
+ allows this (via the %text; in the foot-/endnote-body).
+ Unfortunatetly, this constraint cannot be easily specified in the DTD.
+-->
+<!ELEMENT text:footnote (text:footnote-citation, text:footnote-body)>
+<!ATTLIST text:footnote text:id ID #IMPLIED>
+
+<!ELEMENT text:footnote-citation (#PCDATA)>
+<!ATTLIST text:footnote-citation text:label %string; #IMPLIED>
+
+<!ELEMENT text:footnote-body (text:h|text:p|
+ text:ordered-list|text:unordered-list)*>
+
+<!ELEMENT text:endnote (text:endnote-citation, text:endnote-body)>
+<!ATTLIST text:endnote text:id ID #IMPLIED>
+
+<!ELEMENT text:endnote-citation (#PCDATA)>
+<!ATTLIST text:endnote-citation text:label %string; #IMPLIED>
+
+<!ELEMENT text:endnote-body (text:h|text:p|
+ text:ordered-list|text:unordered-list)*>
+
+<!ENTITY % sectionAttr "text:name CDATA #REQUIRED
+ text:style-name %styleName; #IMPLIED
+ text:protected %boolean; 'false' ">
+
+
+<!ELEMENT text:section ((text:section-source|office:dde-source)?,
+ %sectionText;) >
+
+<!ATTLIST text:section %sectionAttr;>
+<!ATTLIST text:section text:display (true|none|condition) "true">
+<!ATTLIST text:section text:condition %formula; #IMPLIED>
+<!ATTLIST text:section text:protection-key CDATA #IMPLIED>
+<!ATTLIST text:section text:is-hidden %boolean; #IMPLIED>
+
+<!ELEMENT text:section-source EMPTY>
+<!ATTLIST text:section-source xlink:href %string; #IMPLIED>
+<!ATTLIST text:section-source xlink:type (simple) #FIXED "simple">
+<!ATTLIST text:section-source xlink:show (embed) #FIXED "embed">
+<!ATTLIST text:section-source text:section-name %string; #IMPLIED>
+<!ATTLIST text:section-source text:filter-name %string; #IMPLIED>
+
+<!ELEMENT text:table-of-content (text:table-of-content-source,
+ text:index-body) >
+<!ATTLIST text:table-of-content %sectionAttr;>
+
+<!ELEMENT text:table-of-content-source (text:index-title-template? ,
+ text:table-of-content-entry-template*,
+ text:index-source-styles* ) >
+<!ATTLIST text:table-of-content-source text:outline-level %integer; #IMPLIED>
+<!ATTLIST text:table-of-content-source text:use-outline-level %boolean; "true">
+<!ATTLIST text:table-of-content-source text:use-index-marks %boolean; "true">
+<!ATTLIST text:table-of-content-source text:use-index-source-styles
+ %boolean; "false">
+<!ATTLIST text:table-of-content-source text:index-scope (document|chapter)
+ "document">
+<!ATTLIST text:table-of-content-source text:relative-tab-stop-position
+ %boolean; "true">
+<!ATTLIST text:table-of-content-source fo:language %string; #IMPLIED>
+<!ATTLIST text:table-of-content-source fo:country %string; #IMPLIED>
+<!ATTLIST text:table-of-content-source text:sort-algorithm %string; #IMPLIED>
+
+<!ELEMENT text:table-of-content-entry-template (text:index-entry-chapter-number |
+ text:index-entry-page-number |
+ text:index-entry-text |
+ text:index-entry-span |
+ text:index-entry-tab-stop |
+ text:index-entry-link-start |
+ text:index-entry-link-end)* >
+<!ATTLIST text:table-of-content-entry-template text:outline-level
+ %integer; #REQUIRED>
+<!ATTLIST text:table-of-content-entry-template text:style-name
+ %styleName; #REQUIRED>
+
+<!ELEMENT text:illustration-index
+ (text:illustration-index-source, text:index-body)>
+<!ATTLIST text:illustration-index %sectionAttr;>
+
+<!ELEMENT text:illustration-index-source (text:index-title-template?,
+ text:illustration-index-entry-template?) >
+<!ATTLIST text:illustration-index-source text:index-scope
+ (document|chapter) "document">
+<!ATTLIST text:illustration-index-source text:relative-tab-stop-position
+ %boolean; "true">
+<!ATTLIST text:illustration-index-source text:use-caption %boolean; "true">
+<!ATTLIST text:illustration-index-source text:caption-sequence-name
+ %string; #IMPLIED>
+<!ATTLIST text:illustration-index-source text:caption-sequence-format
+ (text|category-and-value|caption) "text">
+<!ATTLIST text:illustration-index-source fo:language %string; #IMPLIED>
+<!ATTLIST text:illustration-index-source fo:country %string; #IMPLIED>
+<!ATTLIST text:illustration-index-source text:sort-algorithm %string; #IMPLIED>
+
+<!ELEMENT text:illustration-index-entry-template
+ ( text:index-entry-page-number |
+ text:index-entry-text |
+ text:index-entry-span |
+ text:index-entry-tab-stop )* >
+<!ATTLIST text:illustration-index-entry-template text:style-name
+ %styleName; #REQUIRED>
+
+<!ELEMENT text:table-index (text:table-index-source, text:index-body)>
+<!ATTLIST text:table-index %sectionAttr;>
+
+<!ELEMENT text:table-index-source (text:index-title-template?,
+ text:table-index-entry-template?) >
+<!ATTLIST text:table-index-source text:index-scope
+ (document|chapter) "document">
+<!ATTLIST text:table-index-source text:relative-tab-stop-position
+ %boolean; "true">
+<!ATTLIST text:table-index-source text:use-caption %boolean; "true">
+<!ATTLIST text:table-index-source text:caption-sequence-name
+ %string; #IMPLIED>
+<!ATTLIST text:table-index-source text:caption-sequence-format
+ (text|category-and-value|caption) "text">
+<!ATTLIST text:table-index-source fo:language %string; #IMPLIED>
+<!ATTLIST text:table-index-source fo:country %string; #IMPLIED>
+<!ATTLIST text:table-index-source text:sort-algorithm %string; #IMPLIED>
+
+<!ELEMENT text:table-index-entry-template ( text:index-entry-page-number |
+ text:index-entry-text |
+ text:index-entry-span |
+ text:index-entry-tab-stop )* >
+<!ATTLIST text:table-index-entry-template text:style-name
+ %styleName; #REQUIRED>
+
+<!ELEMENT text:object-index ( text:object-index-source, text:index-body ) >
+<!ATTLIST text:object-index %sectionAttr;>
+
+<!ELEMENT text:object-index-source ( text:index-title-template?,
+ text:object-index-entry-template? ) >
+<!ATTLIST text:object-index-source text:index-scope
+ (document|chapter) "document">
+<!ATTLIST text:object-index-source text:relative-tab-stop-position
+ %boolean; "true">
+<!ATTLIST text:object-index-source text:use-spreadsheet-objects
+ %boolean; "false">
+<!ATTLIST text:object-index-source text:use-draw-objects %boolean; "false">
+<!ATTLIST text:object-index-source text:use-chart-objects %boolean; "false">
+<!ATTLIST text:object-index-source text:use-other-objects %boolean; "false">
+<!ATTLIST text:object-index-source text:use-math-objects %boolean; "false">
+<!ATTLIST text:object-index-source fo:language %string; #IMPLIED>
+<!ATTLIST text:object-index-source fo:country %string; #IMPLIED>
+<!ATTLIST text:object-index-source text:sort-algorithm %string; #IMPLIED>
+
+<!ELEMENT text:object-index-entry-template ( text:index-entry-page-number |
+ text:index-entry-text |
+ text:index-entry-span |
+ text:index-entry-tab-stop )* >
+<!ATTLIST text:object-index-entry-template text:style-name
+ %styleName; #REQUIRED >
+
+<!ELEMENT text:user-index (text:user-index-source, text:index-body) >
+<!ATTLIST text:user-index %sectionAttr;>
+
+<!ELEMENT text:user-index-source ( text:index-title-template?,
+ text:user-index-entry-template*,
+ text:index-source-styles* ) >
+<!ATTLIST text:user-index-source text:index-scope
+ (document|chapter) "document">
+<!ATTLIST text:user-index-source text:relative-tab-stop-position
+ %boolean; "true">
+<!ATTLIST text:user-index-source text:use-index-marks %boolean; "false">
+<!ATTLIST text:user-index-source text:use-graphics %boolean; "false">
+<!ATTLIST text:user-index-source text:use-tables %boolean; "false">
+<!ATTLIST text:user-index-source text:use-floating-frames %boolean; "false">
+<!ATTLIST text:user-index-source text:use-objects %boolean; "false">
+<!ATTLIST text:user-index-source text:use-index-source-styles
+ %boolean; "false">
+<!ATTLIST text:user-index-source text:copy-outline-levels %boolean; "false">
+<!ATTLIST text:user-index-source fo:language %string; #IMPLIED>
+<!ATTLIST text:user-index-source fo:country %string; #IMPLIED>
+<!ATTLIST text:user-index-source text:sort-algorithm %string; #IMPLIED>
+<!ATTLIST text:user-index-source text:index-name %string; #IMPLIED>
+
+<!ELEMENT text:user-index-entry-template ( text:index-entry-chapter |
+ text:index-entry-page-number |
+ text:index-entry-text |
+ text:index-entry-span |
+ text:index-entry-tab-stop )* >
+<!ATTLIST text:user-index-entry-template text:outline-level %integer; #REQUIRED>
+<!ATTLIST text:user-index-entry-template text:style-name %styleName; #REQUIRED>
+
+<!ELEMENT text:alphabetical-index (text:alphabetical-index-source,
+ text:index-body)>
+<!ATTLIST text:alphabetical-index %sectionAttr;>
+
+<!ELEMENT text:alphabetical-index-source ( text:index-title-template?,
+ text:alphabetical-index-entry-template* ) >
+<!ATTLIST text:alphabetical-index-source text:index-scope
+ (document|chapter) "document">
+<!ATTLIST text:alphabetical-index-source text:relative-tab-stop-position
+ %boolean; "true">
+<!ATTLIST text:alphabetical-index-source text:ignore-case %boolean; "false">
+<!ATTLIST text:alphabetical-index-source text:main-entry-style-name
+ %styleName; #IMPLIED>
+<!ATTLIST text:alphabetical-index-source text:alphabetical-separators
+ %boolean; "false">
+<!ATTLIST text:alphabetical-index-source text:combine-entries
+ %boolean; "true">
+<!ATTLIST text:alphabetical-index-source text:combine-entries-with-dash
+ %boolean; "false">
+<!ATTLIST text:alphabetical-index-source text:combine-entries-with-pp
+ %boolean; "true">
+<!ATTLIST text:alphabetical-index-source text:use-keys-as-entries
+ %boolean; "false">
+<!ATTLIST text:alphabetical-index-source text:capitalize-entries
+ %boolean; "false">
+<!ATTLIST text:alphabetical-index-source text:comma-separated
+ %boolean; "false">
+<!ATTLIST text:alphabetical-index-source fo:language %string; #IMPLIED>
+<!ATTLIST text:alphabetical-index-source fo:country %string; #IMPLIED>
+<!ATTLIST text:alphabetical-index-source text:sort-algorithm %string; #IMPLIED>
+
+<!ELEMENT text:alphabetical-index-entry-template ( text:index-entry-chapter |
+ text:index-entry-page-number |
+ text:index-entry-text |
+ text:index-entry-span |
+ text:index-entry-tab-stop )* >
+<!ATTLIST text:alphabetical-index-entry-template text:outline-level
+ (1|2|3|separator) #REQUIRED>
+<!ATTLIST text:alphabetical-index-entry-template text:style-name
+ %styleName; #REQUIRED>
+
+<!ELEMENT text:alphabetical-index-auto-mark-file EMPTY>
+<!ATTLIST text:alphabetical-index-auto-mark-file xlink:href CDATA #IMPLIED>
+<!ATTLIST text:alphabetical-index-auto-mark-file xlink:type (simple) #FIXED "simple">
+
+<!ELEMENT text:bibliography (text:bibliography-source, text:index-body) >
+<!ATTLIST text:bibliography %sectionAttr;>
+
+<!ELEMENT text:bibliography-source ( text:index-title-template?,
+ text:bibliography-entry-template* ) >
+
+<!ELEMENT text:bibliography-entry-template ( text:index-entry-span |
+ text:index-entry-tab-stop |
+ text:index-entry-bibliography )* >
+<!ATTLIST text:bibliography-entry-template text:bibliography-type
+ ( article | book | booklet | conference | custom1 | custom2 |
+ custom3 | custom4 | custom5 | email | inbook | incollection |
+ inproceedings | journal | manual | mastersthesis | misc |
+ phdthesis | proceedings | techreport | unpublished | www )
+ #REQUIRED >
+<!ATTLIST text:bibliography-entry-template text:style-name
+ %styleName; #REQUIRED>
+
+<!ELEMENT text:index-body %sectionText; >
+
+<!--
+Validity constraint: text:index-title elements may appear only in
+indices, and there may be only one text:index-title element.
+-->
+<!ELEMENT text:index-title %sectionText; >
+<!ATTLIST text:index-title text:style-name %styleName; #IMPLIED>
+<!ATTLIST text:index-title text:name %string; #IMPLIED>
+
+<!ELEMENT text:index-title-template (#PCDATA)>
+<!ATTLIST text:index-title-template text:style-name %styleName; #IMPLIED>
+
+<!ELEMENT text:index-entry-chapter-number EMPTY>
+<!ATTLIST text:index-entry-chapter-number text:style-name %styleName; #IMPLIED>
+
+<!ELEMENT text:index-entry-chapter EMPTY>
+<!ATTLIST text:index-entry-chapter text:style-name %styleName; #IMPLIED>
+<!ATTLIST text:index-entry-chapter text:display (name|number|number-and-name)
+ "number-and-name" >
+
+<!ELEMENT text:index-entry-text EMPTY>
+<!ATTLIST text:index-entry-text text:style-name %styleName; #IMPLIED>
+
+<!ELEMENT text:index-entry-page-number EMPTY>
+<!ATTLIST text:index-entry-page-number text:style-name %styleName; #IMPLIED>
+
+<!ELEMENT text:index-entry-span (#PCDATA)>
+<!ATTLIST text:index-entry-span text:style-name %styleName; #IMPLIED>
+
+<!ELEMENT text:index-entry-bibliography EMPTY>
+<!ATTLIST text:index-entry-bibliography text:style-name %styleName; #IMPLIED>
+<!ATTLIST text:index-entry-bibliography text:bibliography-data-field
+ ( address | annote | author | bibliography-type |
+ booktitle | chapter | custom1 | custom2 |
+ custom3 | custom4 | custom5 | edition | editor |
+ howpublished | identifier | institution | isbn |
+ journal | month | note | number | organizations |
+ pages | publisher | report-type | school |
+ series | title | url | volume | year ) #REQUIRED>
+
+
+<!ELEMENT text:index-entry-tab-stop EMPTY>
+<!ATTLIST text:index-entry-tab-stop text:style-name %styleName; #IMPLIED>
+<!ATTLIST text:index-entry-tab-stop style:leader-char %character; " ">
+<!ATTLIST text:index-entry-tab-stop style:type (left|right) "left">
+<!ATTLIST text:index-entry-tab-stop style:position %length; #IMPLIED>
+<!ATTLIST text:index-entry-tab-stop style:with-tab %boolean; "true">
+
+<!ELEMENT text:index-entry-link-start EMPTY>
+<!ATTLIST text:index-entry-link-start text:style-name %styleName; #IMPLIED>
+
+<!ELEMENT text:index-entry-link-end EMPTY>
+<!ATTLIST text:index-entry-link-end text:style-name %styleName; #IMPLIED>
+
+<!ELEMENT text:index-source-styles (text:index-source-style)*>
+<!ATTLIST text:index-source-styles text:outline-level %integer; #REQUIRED>
+
+<!ELEMENT text:index-source-style EMPTY>
+<!ATTLIST text:index-source-style text:style-name %styleName; #REQUIRED>
+
+<!ELEMENT text:toc-mark-start EMPTY>
+<!ATTLIST text:toc-mark-start text:id %string; #REQUIRED>
+<!ATTLIST text:toc-mark-start text:outline-level %integer; #IMPLIED>
+
+<!ELEMENT text:toc-mark-end EMPTY>
+<!ATTLIST text:toc-mark-end text:id %string; #REQUIRED>
+
+<!ELEMENT text:toc-mark EMPTY>
+<!ATTLIST text:toc-mark text:string-value %string; #REQUIRED>
+<!ATTLIST text:toc-mark text:outline-level %integer; #IMPLIED>
+
+<!ELEMENT text:user-index-mark-start EMPTY>
+<!ATTLIST text:user-index-mark-start text:id %string; #REQUIRED>
+<!ATTLIST text:user-index-mark-start text:outline-level %integer; #IMPLIED>
+<!ATTLIST text:user-index-mark-start text:index-name %string; #IMPLIED>
+
+<!ELEMENT text:user-index-mark-end EMPTY>
+<!ATTLIST text:user-index-mark-end text:id %string; #REQUIRED>
+
+<!ELEMENT text:user-index-mark EMPTY>
+<!ATTLIST text:user-index-mark text:string-value %string; #REQUIRED>
+<!ATTLIST text:user-index-mark text:outline-level %integer; #IMPLIED>
+<!ATTLIST text:user-index-mark text:index-name %string; #IMPLIED>
+
+<!ELEMENT text:alphabetical-index-mark-start EMPTY>
+<!ATTLIST text:alphabetical-index-mark-start text:id %string; #REQUIRED>
+<!ATTLIST text:alphabetical-index-mark-start text:key1 %string; #IMPLIED>
+<!ATTLIST text:alphabetical-index-mark-start text:key2 %string; #IMPLIED>
+<!ATTLIST text:alphabetical-index-mark-start text:main-etry %boolean; "false">
+
+<!ELEMENT text:alphabetical-index-mark-end EMPTY>
+<!ATTLIST text:alphabetical-index-mark-end text:id %string; #REQUIRED>
+
+<!ELEMENT text:alphabetical-index-mark EMPTY>
+<!ATTLIST text:alphabetical-index-mark text:string-value %string; #REQUIRED>
+<!ATTLIST text:alphabetical-index-mark text:key1 %string; #IMPLIED>
+<!ATTLIST text:alphabetical-index-mark text:key2 %string; #IMPLIED>
+<!ATTLIST text:alphabetical-index-mark text:main-etry %boolean; "false">
+
+<!ELEMENT text:bibliography-configuration (text:sort-key)*>
+<!ATTLIST text:bibliography-configuration text:prefix %string; #IMPLIED>
+<!ATTLIST text:bibliography-configuration text:suffix %string; #IMPLIED>
+<!ATTLIST text:bibliography-configuration text:sort-by-position %boolean; "true">
+<!ATTLIST text:bibliography-configuration text:numbered-entries %boolean; "false">
+<!ATTLIST text:bibliography-configuration fo:language %string; #IMPLIED>
+<!ATTLIST text:bibliography-configuration fo:country %string; #IMPLIED>
+<!ATTLIST text:bibliography-configuration text:sort-algorithm %string; #IMPLIED>
+
+<!ELEMENT text:sort-key EMPTY>
+<!ATTLIST text:sort-key text:key ( address | annote | author |
+ bibliography-type | booktitle | chapter | custom1 | custom2 |
+ custom3 | custom4 | custom5 | edition | editor | howpublished |
+ identifier | institution | isbn | journal | month | note | number |
+ organizations | pages | publisher | report-type | school | series |
+ title | url | volume | year ) #REQUIRED>
+<!ATTLIST text:sort-key text:sort-ascending %boolean; "true">
+
+<!ELEMENT text:linenumbering-configuration (text:linenumbering-separator?)>
+<!ATTLIST text:linenumbering-configuration text:style-name %styleName; #IMPLIED>
+<!ATTLIST text:linenumbering-configuration text:number-lines %boolean; "true">
+<!ATTLIST text:linenumbering-configuration text:count-empty-lines %boolean; "true">
+<!ATTLIST text:linenumbering-configuration text:count-in-floating-frames %boolean; "false">
+<!ATTLIST text:linenumbering-configuration text:restart-numbering %boolean; "false">
+<!ATTLIST text:linenumbering-configuration text:offset %nonNegativeLength; #IMPLIED>
+<!ATTLIST text:linenumbering-configuration style:num-format (1|a|A|i|I) "1">
+<!ATTLIST text:linenumbering-configuration style:num-letter-sync %boolean; "false">
+<!ATTLIST text:linenumbering-configuration text:number-position (left|rigth|inner|outer) "left">
+<!ATTLIST text:linenumbering-configuration text:increment %nonNegativeInteger; #IMPLIED>
+
+<!ELEMENT text:linenumbering-separator (#PCDATA)>
+<!ATTLIST text:linenumbering-separator text:increment %nonNegativeInteger; #IMPLIED>
+
+<!ELEMENT text:script (#PCDATA)>
+<!ATTLIST text:script script:language CDATA #REQUIRED>
+<!ATTLIST text:script xlink:href CDATA #IMPLIED>
+<!ATTLIST text:script xlink:type (simple) #FIXED "simple">
+
+<!ELEMENT text:measure (#PCDATA)>
+<!ATTLIST text:measure text:kind (value|unit|gap) #REQUIRED>
+
+<!ELEMENT text:ruby (text:ruby-base, text:ruby-text)>
+<!ATTLIST text:ruby text:style-name %styleName; #IMPLIED>
+
+<!ELEMENT text:ruby-base %inline-text;>
+
+<!ELEMENT text:ruby-text (#PCDATA)>
+<!ATTLIST text:ruby-text text:style-name %styleName; #IMPLIED>
+
+<!-- elements for change tracking -->
+
+<!ELEMENT text:change EMPTY>
+<!ATTLIST text:change text:change-id CDATA #REQUIRED>
+
+<!ELEMENT text:change-start EMPTY>
+<!ATTLIST text:change-start text:change-id CDATA #REQUIRED>
+
+<!ELEMENT text:change-end EMPTY>
+<!ATTLIST text:change-end text:change-id CDATA #REQUIRED>
+
+<!ELEMENT text:tracked-changes (text:changed-region)*>
+<!ATTLIST text:tracked-changes text:track-changes %boolean; "true">
+<!ATTLIST text:tracked-changes text:protection-key CDATA #IMPLIED>
+
+<!ELEMENT text:changed-region (text:insertion |
+ (text:deletion, text:insertion?) |
+ text:format-change) >
+<!ATTLIST text:changed-region text:id ID #REQUIRED>
+<!ATTLIST text:changed-region text:merge-last-paragraph %boolean; "true">
+
+<!ELEMENT text:insertion (office:change-info, %sectionText;)>
+<!ELEMENT text:deletion (office:change-info, %sectionText;)>
+<!ELEMENT text:format-change (office:change-info)>
+
diff --git a/xmloff/inc/AttributeContainerHandler.hxx b/xmloff/inc/AttributeContainerHandler.hxx
new file mode 100644
index 000000000000..64f6ac6d2863
--- /dev/null
+++ b/xmloff/inc/AttributeContainerHandler.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_ATTRIBUTECONTAINERHANDLER_HXX
+#define _XMLOFF_ATTRIBUTECONTAINERHANDLER_HXX
+
+#include <xmloff/xmlprhdl.hxx>
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLAttributeContainerHandler : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLAttributeContainerHandler();
+
+ virtual bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const;
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_ATTRIBUTECONTAINERHANDLER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/DomBuilderContext.hxx b/xmloff/inc/DomBuilderContext.hxx
new file mode 100644
index 000000000000..4ae1dc374a1e
--- /dev/null
+++ b/xmloff/inc/DomBuilderContext.hxx
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_DOMBUILDERCONTEXT_HXX
+#define _XMLOFF_DOMBUILDERCONTEXT_HXX
+
+
+//
+// include for parent class and members
+//
+
+#include <xmloff/xmlictxt.hxx>
+
+
+//
+// forward declarations
+//
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace dom {
+ class XNode;
+ class XDocument;
+ } }
+ namespace xml { namespace sax {
+ class XAttributeList;
+ } }
+} } }
+namespace rtl {
+ class OUString;
+}
+class SvXMLImport;
+class SvXMLImportContext;
+
+/**
+ * DomBuilderContext creates a DOM tree suitable for in-memory processing of
+ * XML data from a sequence of SAX events */
+class DomBuilderContext : public SvXMLImportContext
+{
+ com::sun::star::uno::Reference<com::sun::star::xml::dom::XNode> mxNode;
+
+public:
+
+ /** default constructor: create new DOM tree */
+ DomBuilderContext( SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName );
+
+ /** constructor: create DOM subtree under the given node */
+ DomBuilderContext( SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ com::sun::star::uno::Reference<com::sun::star::xml::dom::XNode>& );
+
+ virtual ~DomBuilderContext();
+
+
+ //
+ // access to the DOM tree
+ //
+
+ /** access the DOM tree */
+ com::sun::star::uno::Reference<com::sun::star::xml::dom::XDocument> getTree();
+
+ /** access this context's DOM sub-tree */
+ com::sun::star::uno::Reference<com::sun::star::xml::dom::XNode> getNode();
+
+
+ //
+ // implement SvXMLImportContext methods:
+ //
+
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void StartElement(
+ const com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+ virtual void EndElement();
+
+ virtual void Characters( const ::rtl::OUString& rChars );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/DomExport.hxx b/xmloff/inc/DomExport.hxx
new file mode 100644
index 000000000000..aa7b245be136
--- /dev/null
+++ b/xmloff/inc/DomExport.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_DOMEXPORT_HXX
+#define _XMLOFF_DOMEXPORT_HXX
+
+// the Solaris compiler apparently needs the following include:
+#include <com/sun/star/uno/Reference.hxx>
+
+class SvXMLExport;
+namespace com { namespace sun { namespace star {
+ namespace uno { template<typename T> class Reference; }
+ namespace xml { namespace dom { class XDocument; } }
+ namespace xml { namespace dom { class XNode; } }
+} } }
+
+void exportDom( SvXMLExport&, const com::sun::star::uno::Reference<com::sun::star::xml::dom::XDocument>& );
+void exportDom( SvXMLExport&, const com::sun::star::uno::Reference<com::sun::star::xml::dom::XNode>& );
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/EnhancedCustomShapeToken.hxx b/xmloff/inc/EnhancedCustomShapeToken.hxx
new file mode 100644
index 000000000000..66b973746979
--- /dev/null
+++ b/xmloff/inc/EnhancedCustomShapeToken.hxx
@@ -0,0 +1,169 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _ENHANCED_CUSTOMSHAPE_TOKEN_HXX
+#define _ENHANCED_CUSTOMSHAPE_TOKEN_HXX
+
+#include <rtl/ustring.hxx>
+
+namespace xmloff { namespace EnhancedCustomShapeToken {
+
+ enum EnhancedCustomShapeTokenEnum
+ {
+ EAS_type,
+ EAS_name,
+ EAS_mirror_horizontal,
+ EAS_mirror_vertical,
+ EAS_viewBox,
+ EAS_text_rotate_angle,
+ EAS_extrusion_allowed,
+ EAS_text_path_allowed,
+ EAS_concentric_gradient_fill_allowed,
+ EAS_extrusion,
+ EAS_extrusion_brightness,
+ EAS_extrusion_depth,
+ EAS_extrusion_diffusion,
+ EAS_extrusion_number_of_line_segments,
+ EAS_extrusion_light_face,
+ EAS_extrusion_first_light_harsh,
+ EAS_extrusion_second_light_harsh,
+ EAS_extrusion_first_light_level,
+ EAS_extrusion_second_light_level,
+ EAS_extrusion_first_light_direction,
+ EAS_extrusion_second_light_direction,
+ EAS_extrusion_metal,
+ EAS_shade_mode,
+ EAS_extrusion_rotation_angle,
+ EAS_extrusion_rotation_center,
+ EAS_extrusion_shininess,
+ EAS_extrusion_skew,
+ EAS_extrusion_specularity,
+ EAS_projection,
+ EAS_extrusion_viewpoint,
+ EAS_extrusion_origin,
+ EAS_extrusion_color,
+ EAS_enhanced_path,
+ EAS_path_stretchpoint_x,
+ EAS_path_stretchpoint_y,
+ EAS_text_areas,
+ EAS_glue_points,
+ EAS_glue_point_type,
+ EAS_glue_point_leaving_directions,
+ EAS_text_path,
+ EAS_text_path_mode,
+ EAS_text_path_scale,
+ EAS_text_path_same_letter_heights,
+ EAS_modifiers,
+ EAS_equation,
+ EAS_formula,
+ EAS_handle,
+ EAS_handle_mirror_horizontal,
+ EAS_handle_mirror_vertical,
+ EAS_handle_switched,
+ EAS_handle_position,
+ EAS_handle_range_x_minimum,
+ EAS_handle_range_x_maximum,
+ EAS_handle_range_y_minimum,
+ EAS_handle_range_y_maximum,
+ EAS_handle_polar,
+ EAS_handle_radius_range_minimum,
+ EAS_handle_radius_range_maximum,
+
+ EAS_CustomShapeEngine,
+ EAS_CustomShapeData,
+ EAS_Type,
+ EAS_MirroredX,
+ EAS_MirroredY,
+ EAS_ViewBox,
+ EAS_TextRotateAngle,
+ EAS_ExtrusionAllowed,
+ EAS_ConcentricGradientFillAllowed,
+ EAS_TextPathAllowed,
+ EAS_Extrusion,
+ EAS_Equations,
+ EAS_Equation,
+ EAS_Path,
+ EAS_TextPath,
+ EAS_Handles,
+ EAS_Handle,
+ EAS_Brightness,
+ EAS_Depth,
+ EAS_Diffusion,
+ EAS_NumberOfLineSegments,
+ EAS_LightFace,
+ EAS_FirstLightHarsh,
+ EAS_SecondLightHarsh,
+ EAS_FirstLightLevel,
+ EAS_SecondLightLevel,
+ EAS_FirstLightDirection,
+ EAS_SecondLightDirection,
+ EAS_Metal,
+ EAS_ShadeMode,
+ EAS_RotateAngle,
+ EAS_RotationCenter,
+ EAS_Shininess,
+ EAS_Skew,
+ EAS_Specularity,
+ EAS_ProjectionMode,
+ EAS_ViewPoint,
+ EAS_Origin,
+ EAS_Color,
+ EAS_Switched,
+ EAS_Polar,
+ EAS_RangeXMinimum,
+ EAS_RangeXMaximum,
+ EAS_RangeYMinimum,
+ EAS_RangeYMaximum,
+ EAS_RadiusRangeMinimum,
+ EAS_RadiusRangeMaximum,
+ EAS_Coordinates,
+ EAS_Segments,
+ EAS_StretchX,
+ EAS_StretchY,
+ EAS_TextFrames,
+ EAS_GluePoints,
+ EAS_GluePointLeavingDirections,
+ EAS_GluePointType,
+ EAS_TextPathMode,
+ EAS_ScaleX,
+ EAS_SameLetterHeights,
+ EAS_Position,
+ EAS_AdjustmentValues,
+
+ EAS_Last,
+ EAS_NotFound
+ };
+
+ EnhancedCustomShapeTokenEnum EASGet( const rtl::OUString& );
+ rtl::OUString EASGet( const EnhancedCustomShapeTokenEnum );
+}
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/MetaExportComponent.hxx b/xmloff/inc/MetaExportComponent.hxx
new file mode 100644
index 000000000000..67cd7d514b43
--- /dev/null
+++ b/xmloff/inc/MetaExportComponent.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_METAEXPORTCOMPONENT_HXX
+#define _XMLOFF_METAEXPORTCOMPONENT_HXX
+
+#include <com/sun/star/document/XDocumentProperties.hpp>
+
+#include <xmloff/xmlexp.hxx>
+
+class XMLMetaExportComponent : public SvXMLExport
+{
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::document::XDocumentProperties > mxDocProps;
+
+public:
+ // #110680#
+ // XMLMetaExportComponent();
+ XMLMetaExportComponent(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ sal_uInt16 nFlags
+ );
+
+ virtual ~XMLMetaExportComponent();
+
+protected:
+ // export the events off all autotexts
+ virtual sal_uInt32 exportDoc(
+ enum ::xmloff::token::XMLTokenEnum eClass = xmloff::token::XML_TOKEN_INVALID );
+
+ // accept XDocumentProperties in addition to XModel
+ virtual void SAL_CALL setSourceDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ // override
+ virtual void _ExportMeta();
+
+ // methods without content:
+ virtual void _ExportAutoStyles();
+ virtual void _ExportMasterStyles();
+ virtual void _ExportContent();
+};
+
+// global functions to support the component
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ XMLMetaExportComponent_getSupportedServiceNames()
+ throw();
+
+::rtl::OUString SAL_CALL XMLMetaExportComponent_getImplementationName()
+ throw();
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
+ XMLMetaExportComponent_createInstance(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > & )
+ throw( ::com::sun::star::uno::Exception );
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/MetaImportComponent.hxx b/xmloff/inc/MetaImportComponent.hxx
new file mode 100644
index 000000000000..afa9fe298698
--- /dev/null
+++ b/xmloff/inc/MetaImportComponent.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_METAIMPORTCOMPONENT_HXX
+#define _XMLOFF_METAIMPORTCOMPONENT_HXX
+
+#include <xmloff/xmlimp.hxx>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/document/XDocumentProperties.hpp>
+
+
+class XMLMetaImportComponent : public SvXMLImport
+{
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::document::XDocumentProperties> mxDocProps;
+
+public:
+ // #110680#
+ // XMLMetaImportComponent() throw();
+ XMLMetaImportComponent(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory
+ ) throw();
+
+ virtual ~XMLMetaImportComponent() throw();
+
+
+protected:
+
+ virtual SvXMLImportContext* CreateContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+ // XImporter
+ virtual void SAL_CALL setTargetDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc )
+ throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+};
+
+
+// global functions to support the component
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ XMLMetaImportComponent_getSupportedServiceNames()
+ throw();
+
+::rtl::OUString SAL_CALL XMLMetaImportComponent_getImplementationName()
+ throw();
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
+ XMLMetaImportComponent_createInstance(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > & )
+ throw( ::com::sun::star::uno::Exception );
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/MultiPropertySetHelper.hxx b/xmloff/inc/MultiPropertySetHelper.hxx
new file mode 100644
index 000000000000..a64e8c8524dd
--- /dev/null
+++ b/xmloff/inc/MultiPropertySetHelper.hxx
@@ -0,0 +1,207 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_CONDITIONALMULTIPROPERTYSETHELPER_HXX
+#define _XMLOFF_CONDITIONALMULTIPROPERTYSETHELPER_HXX
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <tools/debug.hxx>
+
+
+namespace com { namespace sun { namespace star {
+ namespace beans { class XMultiPropertySet; }
+ namespace beans { class XPropertySet; }
+ namespace beans { class XPropertySetInfo; }
+} } }
+
+
+/**
+ * The MultiPropertySetHelper performs the follwing functions:
+ *
+ * Given a list of property names (as sal_Char** or OUString*), it can
+ * query an XMultiPropertySet (or XPropertySet) which of these properties
+ * it supports (method hasProperties(...)). The properties *MUST* be
+ * sorted alphabetically.
+ *
+ * Then, the X(Multi)PropertySet can be queried for values, and only
+ * the supported properties are queried. (method getValues(...)) The
+ * values are stored in the helper itself.
+ *
+ * Finally, each property can be queried for existence
+ * (method hasProperty(...)) or its value (method (getValue(...))).
+ *
+ * After some initial preparation (hasProperties, getValues) the
+ * MultiPropertySetHelper can be used similarly to an
+ * XPropertySet in that you can query the values in the places where you
+ * need them. However, if an XMultiPropertySet is supplied, the queries
+ * are more efficient, often significantly so.
+ */
+class MultiPropertySetHelper
+{
+ /// names of all properties
+ ::rtl::OUString* pPropertyNames;
+
+ /// length of pPropertyNames array
+ sal_Int16 nLength;
+
+ /// the sequence of property names that the current (multi)
+ /// property set implementation supports
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > aPropertySequence;
+
+ /// an array of indices that maps from pPropertyNames indices to
+ /// aPropertySequence indices
+ sal_Int16* pSequenceIndex;
+
+ /// the last set of values retrieved by getValues
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aValues;
+
+ /// result of aValues.getConstArray()
+ const ::com::sun::star::uno::Any* pValues;
+
+ /// an empty Any
+ ::com::sun::star::uno::Any aEmptyAny;
+
+public:
+
+ MultiPropertySetHelper( const sal_Char** pNames );
+
+ MultiPropertySetHelper( const ::rtl::OUString* pNames );
+
+ ~MultiPropertySetHelper();
+
+
+ /**
+ * Call hasPropertiesByName for the provided XPropertySetInfo and build
+ * list of allowed properties.
+ */
+ void hasProperties( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySetInfo> & );
+
+
+ /**
+ * Return whether hasProperties was called
+ * (i.e. if we are ready to call getValues)
+ */
+ sal_Bool checkedProperties();
+
+ /**
+ * Get values from the XMultiPropertySet.
+ *
+ * May only be called after hasProperties() was called for the
+ * appropriate XPropertySetInfo.
+ */
+ void getValues( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XMultiPropertySet> & );
+
+ /**
+ * Get values from the XPropertySet. This can be much slower than
+ * getValues( const Reference<XMultiPropertySet& ) and hence
+ * should be avoided.
+ *
+ * May only be called after hasProperties() was called for the
+ * appropriate XPropertySetInfo.
+ */
+ void getValues( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & );
+
+
+
+ /**
+ * Get a value from the values array.
+ *
+ * May only be called after getValues() was called.
+ */
+ inline const ::com::sun::star::uno::Any& getValue( sal_Int16 nIndex );
+
+ /**
+ * Find out if this property is supported.
+ *
+ * May only be called after hasProperties() was called.
+ */
+ inline sal_Bool hasProperty( sal_Int16 nIndex );
+
+ /**
+ * Get a value from the XPropertySet on demand.
+ *
+ * If neither getValues nor getValueOnDemand has been called already
+ * after the last call to resetValues, the values are retrieved
+ * using getValues. Otherwise the value already retrieved is returned.
+ * In case XMultiPropertySet is supported by the XPropertySet and
+ * bTryMult is set, the XMultiPropertySet is used to get the values.
+ *
+ */
+ const ::com::sun::star::uno::Any& getValue( sal_Int16 nIndex,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> &,
+ sal_Bool bTryMulti = sal_False );
+
+ /**
+ * Get a value from the XMultiPropertySet on demand.
+ *
+ * If neither getValues nor getValueOnDemand has been called already
+ * after the last call to resetValues, the values are retrieved
+ * using getValues. Otherwise the value already retrieved is returned.
+ * In case XMultiPropertySet is supported by the XPropertySet,
+ * XMultiPropertySet is used to get the values.
+ *
+ */
+ const ::com::sun::star::uno::Any& getValue( sal_Int16 nIndex,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XMultiPropertySet> & );
+
+ inline void resetValues() { pValues = 0; }
+};
+
+
+// inline implementations of the often-called methods getValue and hasProperty:
+
+const ::com::sun::star::uno::Any& MultiPropertySetHelper::getValue(
+ sal_Int16 nValueNo )
+{
+ DBG_ASSERT( pValues != NULL,
+ "called getValue() without calling getValues() before");
+ DBG_ASSERT( pSequenceIndex != NULL,
+ "called getValue() without calling hasProperties() before" );
+ DBG_ASSERT( nValueNo < nLength, "index out of range" );
+
+ sal_Int16 nIndex = pSequenceIndex[ nValueNo ];
+ return ( nIndex != -1 ) ? pValues[ nIndex ] : aEmptyAny;
+}
+
+sal_Bool MultiPropertySetHelper::hasProperty( sal_Int16 nValueNo )
+{
+ DBG_ASSERT( pSequenceIndex != NULL,
+ "called getValue() without calling hasProperties() before" );
+ DBG_ASSERT( nValueNo < nLength, "index out of range" );
+
+ return pSequenceIndex[ nValueNo ] != -1;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/PageMasterImportContext.hxx b/xmloff/inc/PageMasterImportContext.hxx
new file mode 100644
index 000000000000..7a4f5be70d61
--- /dev/null
+++ b/xmloff/inc/PageMasterImportContext.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PAGEMASTERIMPORTCONTEXT_HXX
+#define _XMLOFF_PAGEMASTERIMPORTCONTEXT_HXX
+
+#include <xmloff/prstylei.hxx>
+#include <xmloff/xmlimp.hxx>
+
+class PageStyleContext : public XMLPropStyleContext
+{
+ ::rtl::OUString sPageUsage;
+protected:
+
+ virtual void SetAttribute( sal_uInt16 nPrefixKey,
+ const ::rtl::OUString& rLocalName,
+ const ::rtl::OUString& rValue );
+
+public:
+
+ TYPEINFO();
+
+ PageStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
+ SvXMLStylesContext& rStyles,
+ sal_Bool bDefaultStyle=sal_False);
+ virtual ~PageStyleContext();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+ virtual void FillPropertySet(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rPropSet );
+
+ //text grid enhancement
+ virtual void SetDefaults();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/PropertySetMerger.hxx b/xmloff/inc/PropertySetMerger.hxx
new file mode 100644
index 000000000000..d5b1d02fa29c
--- /dev/null
+++ b/xmloff/inc/PropertySetMerger.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PROPERTYSETMERGER_HXX_
+#define _XMLOFF_PROPERTYSETMERGER_HXX_
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+extern ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ PropertySetMerger_CreateInstance(
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rPropSet1,
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rPropSet2 ) throw();
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/RDFaExportHelper.hxx b/xmloff/inc/RDFaExportHelper.hxx
new file mode 100644
index 000000000000..268cd97ca077
--- /dev/null
+++ b/xmloff/inc/RDFaExportHelper.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 RDFAEXPORTHELPER_HXX
+#define RDFAEXPORTHELPER_HXX
+
+#include <com/sun/star/uno/Reference.h>
+
+#include <rtl/ustring.hxx>
+
+#include <map>
+
+
+namespace com { namespace sun { namespace star {
+ namespace rdf { class XBlankNode; }
+ namespace rdf { class XMetadatable; }
+ namespace rdf { class XDocumentRepository; }
+} } }
+
+class SvXMLExport;
+
+namespace xmloff {
+
+class SAL_DLLPRIVATE RDFaExportHelper
+{
+private:
+ SvXMLExport & m_rExport;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XDocumentRepository> m_xRepository;
+
+ typedef ::std::map< ::rtl::OUString, ::rtl::OUString >
+ BlankNodeMap_t;
+
+ BlankNodeMap_t m_BlankNodeMap;
+
+ long m_Counter;
+
+ ::rtl::OUString
+ LookupBlankNode( ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XBlankNode> const & i_xBlankNode);
+
+public:
+ RDFaExportHelper(SvXMLExport & i_rExport);
+
+ void
+ AddRDFa(::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XMetadatable> const & i_xMetadatable);
+};
+
+} // namespace xmloff
+
+#endif // RDFAEXPORTHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/RDFaImportHelper.hxx b/xmloff/inc/RDFaImportHelper.hxx
new file mode 100644
index 000000000000..e68e833b9937
--- /dev/null
+++ b/xmloff/inc/RDFaImportHelper.hxx
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 RDFAIMPORTHELPER_HXX
+#define RDFAIMPORTHELPER_HXX
+
+#include <vector>
+
+#include <boost/shared_ptr.hpp>
+
+#include <com/sun/star/uno/Reference.h>
+
+
+namespace rtl { class OUString; }
+
+namespace com { namespace sun { namespace star {
+ namespace uno { class XComponentContext; }
+ namespace rdf { class XMetadatable; }
+ namespace rdf { class XRepositorySupplier; }
+} } }
+
+class SvXMLImport;
+
+namespace xmloff {
+
+struct RDFaEntry;
+struct ParsedRDFaAttributes;
+
+class SAL_DLLPRIVATE RDFaImportHelper
+{
+
+private:
+ const SvXMLImport & m_rImport;
+
+ typedef ::std::vector< RDFaEntry > RDFaEntries_t;
+
+ RDFaEntries_t m_RDFaEntries;
+
+ const SvXMLImport & GetImport() const { return m_rImport; }
+
+
+public:
+ RDFaImportHelper(const SvXMLImport & i_rImport);
+
+ ~RDFaImportHelper();
+
+ /** Parse RDFa attributes */
+ ::boost::shared_ptr<ParsedRDFaAttributes> ParseRDFa(
+ ::rtl::OUString const & i_rAbout,
+ ::rtl::OUString const & i_rProperty,
+ ::rtl::OUString const & i_rContent,
+ ::rtl::OUString const & i_rDatatype);
+
+ /** Add a RDFa statement; must have been parsed with ParseRDFa */
+ void AddRDFa(
+ ::com::sun::star::uno::Reference< ::com::sun::star::rdf::XMetadatable>
+ const & i_xObject,
+ ::boost::shared_ptr<ParsedRDFaAttributes> & i_pRDFaAttributes);
+
+ /** Parse and add a RDFa statement; parameters are XML attribute values */
+ void ParseAndAddRDFa(
+ ::com::sun::star::uno::Reference< ::com::sun::star::rdf::XMetadatable>
+ const & i_xObject,
+ ::rtl::OUString const & i_rAbout,
+ ::rtl::OUString const & i_rProperty,
+ ::rtl::OUString const & i_rContent,
+ ::rtl::OUString const & i_rDatatype);
+
+ /** Insert all added statements into the RDF repository.
+ <p> This is done <em>after</em> the input file has been read,
+ to prevent collision between generated ids and ids in the file.</p>
+ */
+ void InsertRDFa( ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XRepositorySupplier > const & i_xModel);
+};
+
+} // namespace xmloff
+
+#endif // RDFAIMPORTHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/SchXMLExport.hxx b/xmloff/inc/SchXMLExport.hxx
new file mode 100644
index 000000000000..f5034b0983c3
--- /dev/null
+++ b/xmloff/inc/SchXMLExport.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 SCH_XMLEXPORT_HXX_
+#define SCH_XMLEXPORT_HXX_
+
+#include <xmloff/SchXMLExportHelper.hxx>
+#include "SchXMLAutoStylePoolP.hxx"
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/uniref.hxx>
+#include <xmloff/xmlprmap.hxx>
+#include <xmloff/prhdlfac.hxx>
+
+namespace com { namespace sun { namespace star {
+ namespace chart {
+ class XDiagram;
+ class XChartDocument;
+ struct ChartSeriesAddress;
+ }
+ namespace drawing {
+ class XShape;
+ }
+ namespace task {
+ class XStatusIndicator;
+ }
+}}}
+
+class SvXMLAutoStylePoolP;
+class SvXMLUnitConverter;
+class XMLChartExportPropertyMapper;
+
+// ------------------------------------------
+// export class for a complete chart document
+// ------------------------------------------
+
+class SchXMLExport : public SvXMLExport
+{
+private:
+ com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > mxStatusIndicator;
+ SchXMLAutoStylePoolP maAutoStylePool;
+
+ SchXMLExportHelper maExportHelper;
+
+protected:
+ virtual sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID );
+
+ virtual void _ExportStyles( sal_Bool bUsed );
+ virtual void _ExportAutoStyles();
+ virtual void _ExportMasterStyles();
+ virtual void _ExportContent();
+
+public:
+ // #110680#
+ SchXMLExport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ sal_uInt16 nExportFlags = EXPORT_ALL );
+ virtual ~SchXMLExport();
+
+ void SetProgress( sal_Int32 nPercentage );
+
+ UniReference< XMLPropertySetMapper > GetPropertySetMapper() const;
+
+ // XServiceInfo ( : SvXMLExport )
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
+};
+
+#endif // SCH_XMLEXPORT_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/SchXMLImport.hxx b/xmloff/inc/SchXMLImport.hxx
new file mode 100644
index 000000000000..11b90ca5a34f
--- /dev/null
+++ b/xmloff/inc/SchXMLImport.hxx
@@ -0,0 +1,201 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 SCH_XMLIMPORT_HXX_
+#define SCH_XMLIMPORT_HXX_
+
+#include <xmloff/SchXMLImportHelper.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmltkmap.hxx>
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/prhdlfac.hxx>
+#include <xmloff/families.hxx>
+
+/* ----------------------------------------
+ these enums are used for the
+ SvXMLTokenMapEntries to distinguish
+ the tokens in switch-directives
+ ----------------------------------------*/
+
+enum SchXMLDocElemTokenMap
+{
+ XML_TOK_DOC_AUTOSTYLES,
+ XML_TOK_DOC_STYLES,
+ XML_TOK_DOC_META,
+ XML_TOK_DOC_BODY
+};
+
+enum SchXMLTableElemTokenMap
+{
+ XML_TOK_TABLE_HEADER_COLS,
+ XML_TOK_TABLE_COLUMNS,
+ XML_TOK_TABLE_COLUMN,
+ XML_TOK_TABLE_HEADER_ROWS,
+ XML_TOK_TABLE_ROWS,
+ XML_TOK_TABLE_ROW
+};
+
+enum SchXMLChartElemTokenMap
+{
+ XML_TOK_CHART_PLOT_AREA,
+ XML_TOK_CHART_TITLE,
+ XML_TOK_CHART_SUBTITLE,
+ XML_TOK_CHART_LEGEND,
+ XML_TOK_CHART_TABLE
+};
+
+enum SchXMLPlotAreaElemTokenMap
+{
+ XML_TOK_PA_COORDINATE_REGION_EXT,
+ XML_TOK_PA_COORDINATE_REGION,
+ XML_TOK_PA_AXIS,
+ XML_TOK_PA_SERIES,
+ XML_TOK_PA_WALL,
+ XML_TOK_PA_FLOOR,
+ XML_TOK_PA_LIGHT_SOURCE,
+ XML_TOK_PA_STOCK_GAIN,
+ XML_TOK_PA_STOCK_LOSS,
+ XML_TOK_PA_STOCK_RANGE
+};
+
+enum SchXMLSeriesElemTokenMap
+{
+ XML_TOK_SERIES_DATA_POINT,
+ XML_TOK_SERIES_DOMAIN,
+ XML_TOK_SERIES_MEAN_VALUE_LINE,
+ XML_TOK_SERIES_REGRESSION_CURVE,
+ XML_TOK_SERIES_ERROR_INDICATOR
+};
+
+// ----------------------------------------
+
+enum SchXMLChartAttrMap
+{
+ XML_TOK_CHART_HREF,
+ XML_TOK_CHART_CLASS,
+ XML_TOK_CHART_WIDTH,
+ XML_TOK_CHART_HEIGHT,
+ XML_TOK_CHART_STYLE_NAME,
+ XML_TOK_CHART_ADDIN_NAME,
+ XML_TOK_CHART_COL_MAPPING,
+ XML_TOK_CHART_ROW_MAPPING
+};
+
+enum SchXMLPlotAreaAttrTokenMap
+{
+ XML_TOK_PA_X,
+ XML_TOK_PA_Y,
+ XML_TOK_PA_WIDTH,
+ XML_TOK_PA_HEIGHT,
+ XML_TOK_PA_STYLE_NAME,
+ XML_TOK_PA_TRANSFORM,
+ XML_TOK_PA_CHART_ADDRESS,
+ XML_TOK_PA_TABLE_NUMBER_LIST,
+ XML_TOK_PA_DS_HAS_LABELS,
+ XML_TOK_PA_VRP,
+ XML_TOK_PA_VPN,
+ XML_TOK_PA_VUP,
+ XML_TOK_PA_PROJECTION,
+ XML_TOK_PA_DISTANCE,
+ XML_TOK_PA_FOCAL_LENGTH,
+ XML_TOK_PA_SHADOW_SLANT,
+ XML_TOK_PA_SHADE_MODE,
+ XML_TOK_PA_AMBIENT_COLOR,
+ XML_TOK_PA_LIGHTING_MODE
+};
+
+enum SchXMLAutoStyleAttrMap
+{
+ XML_TOK_AS_FAMILY,
+ XML_TOK_AS_NAME
+};
+
+enum SchXMLCellAttrMap
+{
+ XML_TOK_CELL_VAL_TYPE,
+ XML_TOK_CELL_VALUE
+};
+
+enum SchXMLSeriesAttrMap
+{
+ XML_TOK_SERIES_CELL_RANGE,
+ XML_TOK_SERIES_LABEL_ADDRESS,
+ XML_TOK_SERIES_ATTACHED_AXIS,
+ XML_TOK_SERIES_STYLE_NAME,
+ XML_TOK_SERIES_CHART_CLASS
+};
+
+enum SchXMLRegEquationAttrMap
+{
+ XML_TOK_REGEQ_STYLE_NAME,
+ XML_TOK_REGEQ_DISPLAY_EQUATION,
+ XML_TOK_REGEQ_DISPLAY_R_SQUARE,
+ XML_TOK_REGEQ_POS_X,
+ XML_TOK_REGEQ_POS_Y
+};
+
+class SchXMLImport : public SvXMLImport
+{
+private:
+ com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > mxStatusIndicator;
+
+ SchXMLImportHelper maImportHelper;
+
+protected:
+ virtual SvXMLImportContext *CreateContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+public:
+ // #110680#
+ SchXMLImport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ sal_uInt16 nImportFlags = IMPORT_ALL );
+
+ // #110680#
+ SchXMLImport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ com::sun::star::uno::Reference< com::sun::star::frame::XModel > xModel,
+ com::sun::star::uno::Reference< com::sun::star::document::XGraphicObjectResolver > &,
+ sal_Bool bLoadDoc, sal_Bool bShowProgress );
+
+ virtual ~SchXMLImport() throw ();
+
+ // XServiceInfo ( : SvXMLExport )
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
+
+ SvXMLImportContext* CreateStylesContext( const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ // XImporter
+ virtual void SAL_CALL setTargetDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+};
+
+#endif // SCH_XMLIMPORT_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/StyleMap.hxx b/xmloff/inc/StyleMap.hxx
new file mode 100644
index 000000000000..da11f0a33e03
--- /dev/null
+++ b/xmloff/inc/StyleMap.hxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_STYLEMAP_HXX
+#define _XMLOFF_STYLEMAP_HXX
+
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <boost/unordered_map.hpp>
+
+struct StyleNameKey_Impl
+{
+ sal_uInt16 m_nFamily;
+ ::rtl::OUString m_aName;
+
+ inline StyleNameKey_Impl( sal_uInt16 nFamily,
+ const ::rtl::OUString& rName ) :
+ m_nFamily( nFamily ),
+ m_aName( rName )
+ {
+ }
+
+ inline StyleNameKey_Impl() :
+ m_nFamily( 0 )
+ {
+ }
+};
+
+struct StyleNameHash_Impl
+{
+ inline size_t operator()( const StyleNameKey_Impl& r ) const;
+ inline bool operator()( const StyleNameKey_Impl& r1,
+ const StyleNameKey_Impl& r2 ) const;
+};
+
+inline size_t StyleNameHash_Impl::operator()( const StyleNameKey_Impl& r ) const
+{
+ return static_cast< size_t >( r.m_nFamily ) +
+ static_cast< size_t >( r.m_aName.hashCode() );
+}
+
+inline bool StyleNameHash_Impl::operator()(
+ const StyleNameKey_Impl& r1,
+ const StyleNameKey_Impl& r2 ) const
+{
+ return r1.m_nFamily == r2.m_nFamily && r1.m_aName == r2.m_aName;
+}
+
+class StyleMap :
+ public ::cppu::WeakImplHelper1< ::com::sun::star::lang::XUnoTunnel>,
+ public ::boost::unordered_map< StyleNameKey_Impl, ::rtl::OUString,
+ StyleNameHash_Impl, StyleNameHash_Impl >
+{
+
+public:
+
+ StyleMap();
+ virtual ~StyleMap();
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
+ static StyleMap* getImplementation(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface > ) throw();
+
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething(
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+#endif // _XMLOFF_STYLEMAP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/TransGradientStyle.hxx b/xmloff/inc/TransGradientStyle.hxx
new file mode 100644
index 000000000000..74ad5cbcced2
--- /dev/null
+++ b/xmloff/inc/TransGradientStyle.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_TRANSGRADIENTSTYLE_HXX
+#define _XMLOFF_TRANSGRADIENTSTYLE_HXX
+
+
+#include <sal/types.h>
+
+class SvXMLImport;
+class SvXMLExport;
+namespace com { namespace sun { namespace star {
+ namespace uno { template<class A> class Reference; }
+ namespace xml { namespace sax { class XAttributeList; } }
+ namespace uno { class Any; }
+} } }
+namespace rtl { class OUString; }
+
+
+class XMLTransGradientStyleImport
+{
+ SvXMLImport& rImport;
+
+public:
+ XMLTransGradientStyleImport( SvXMLImport& rImport );
+ ~XMLTransGradientStyleImport();
+
+ sal_Bool importXML(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList >& xAttrList,
+ ::com::sun::star::uno::Any& rValue,
+ ::rtl::OUString& rStrName );
+};
+
+class XMLTransGradientStyleExport
+{
+ SvXMLExport& rExport;
+
+public:
+ XMLTransGradientStyleExport( SvXMLExport& rExport );
+ ~XMLTransGradientStyleExport();
+
+ sal_Bool exportXML( const ::rtl::OUString& rStrName, const ::com::sun::star::uno::Any& rValue );
+};
+
+#endif // _XMLOFF_TRANSGRADIENTSTYLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/XMLBackgroundImageContext.hxx b/xmloff/inc/XMLBackgroundImageContext.hxx
new file mode 100644
index 000000000000..6e61bd072ef1
--- /dev/null
+++ b/xmloff/inc/XMLBackgroundImageContext.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLBACKGROUNDIMAGECONTEXT_HXX
+#define _XMLBACKGROUNDIMAGECONTEXT_HXX
+
+#include <com/sun/star/style/GraphicLocation.hpp>
+#include "XMLElementPropertyContext.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace io { class XOutputStream; }
+} } }
+
+class XMLBackgroundImageContext : public XMLElementPropertyContext
+{
+ XMLPropertyState aPosProp;
+ XMLPropertyState aFilterProp;
+ XMLPropertyState aTransparencyProp;
+
+ ::com::sun::star::style::GraphicLocation ePos;
+ ::rtl::OUString sURL;
+ ::rtl::OUString sFilter;
+ sal_Int8 nTransparency;
+
+ ::com::sun::star::uno::Reference < ::com::sun::star::io::XOutputStream > xBase64Stream;
+
+private:
+ void ProcessAttrs(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+public:
+ TYPEINFO();
+
+ XMLBackgroundImageContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
+ const XMLPropertyState& rProp,
+ sal_Int32 nPosIdx,
+ sal_Int32 nFilterIdx,
+ sal_Int32 nTransparencyIdx,
+ ::std::vector< XMLPropertyState > &rProps );
+
+ virtual ~XMLBackgroundImageContext();
+
+ SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+ virtual void EndElement();
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/XMLBackgroundImageExport.hxx b/xmloff/inc/XMLBackgroundImageExport.hxx
new file mode 100644
index 000000000000..201d4f302111
--- /dev/null
+++ b/xmloff/inc/XMLBackgroundImageExport.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLBACKGROUNDIMAGEEXPORT_HXX
+#define _XMLBACKGROUNDIMAGEEXPORT_HXX
+
+#include <sal/types.h>
+
+namespace rtl { class OUString; }
+namespace com { namespace sun { namespace star { namespace uno {
+ class Any;
+} } } }
+
+class SvXMLExport;
+
+class XMLBackgroundImageExport
+{
+ SvXMLExport& rExport;
+
+protected:
+
+ SvXMLExport& GetExport() { return rExport; }
+public:
+
+ XMLBackgroundImageExport( SvXMLExport& rExport );
+
+ ~XMLBackgroundImageExport();
+
+ void exportXML( const ::com::sun::star::uno::Any& rURL,
+ const ::com::sun::star::uno::Any *pPos,
+ const ::com::sun::star::uno::Any *pFilter,
+ const ::com::sun::star::uno::Any *pTransparency,
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName );
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/XMLBase64Export.hxx b/xmloff/inc/XMLBase64Export.hxx
new file mode 100644
index 000000000000..558809cd9926
--- /dev/null
+++ b/xmloff/inc/XMLBase64Export.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLBASE64EXPORT_HXX
+#define _XMLOFF_XMLBASE64EXPORT_HXX
+
+#include <com/sun/star/uno/Reference.h>
+
+namespace com { namespace sun { namespace star { namespace io {
+ class XInputStream; } } } }
+class SvXMLExport;
+
+class XMLBase64Export
+{
+ SvXMLExport& rExport;
+
+protected:
+
+ SvXMLExport& GetExport() { return rExport; }
+
+public:
+
+ XMLBase64Export( SvXMLExport& rExport );
+
+ sal_Bool exportXML( const ::com::sun::star::uno::Reference <
+ ::com::sun::star::io::XInputStream > & rIn );
+ sal_Bool exportElement( const ::com::sun::star::uno::Reference <
+ ::com::sun::star::io::XInputStream > & rIn,
+ sal_uInt16 nNamespace,
+ enum ::xmloff::token::XMLTokenEnum eName );
+ sal_Bool exportOfficeBinaryDataElement(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::io::XInputStream > & rIn );
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/XMLBasicExportFilter.hxx b/xmloff/inc/XMLBasicExportFilter.hxx
new file mode 100644
index 000000000000..3ab3d9f4cb4f
--- /dev/null
+++ b/xmloff/inc/XMLBasicExportFilter.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLBASICEXPORTFILTER_HXX
+#define _XMLOFF_XMLBASICEXPORTFILTER_HXX
+
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <cppuhelper/implbase1.hxx>
+
+
+// =============================================================================
+// class XMLBasicExportFilter
+// =============================================================================
+
+typedef ::cppu::WeakImplHelper1<
+ ::com::sun::star::xml::sax::XDocumentHandler > XMLBasicExportFilter_BASE;
+
+class XMLBasicExportFilter : public XMLBasicExportFilter_BASE
+{
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > m_xHandler;
+
+public:
+ XMLBasicExportFilter(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler >& rxHandler );
+ virtual ~XMLBasicExportFilter();
+
+ // XDocumentHandler
+ virtual void SAL_CALL startDocument()
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL endDocument()
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL startElement( const ::rtl::OUString& aName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttribs )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL endElement( const ::rtl::OUString& aName )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL characters( const ::rtl::OUString& aChars )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL ignorableWhitespace( const ::rtl::OUString& aWhitespaces )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL processingInstruction( const ::rtl::OUString& aTarget, const ::rtl::OUString& aData )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDocumentLocator( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >& xLocator )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+};
+
+#endif // _XMLOFF_XMLBASICEXPORTFILTER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/XMLBitmapLogicalSizePropertyHandler.hxx b/xmloff/inc/XMLBitmapLogicalSizePropertyHandler.hxx
new file mode 100644
index 000000000000..de8a2ffe0dee
--- /dev/null
+++ b/xmloff/inc/XMLBitmapLogicalSizePropertyHandler.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLBITMAPLOGICALSIZEPROPERTYHANDLER_HXX
+#define _XMLOFF_XMLBITMAPLOGICALSIZEPROPERTYHANDLER_HXX
+
+#include <xmloff/xmlprhdl.hxx>
+
+struct SvXMLEnumMapEntry;
+
+///////////////////////////////////////////////////////////////////////////
+//
+/** Abstract base-class for different XML-types. Derivations of this class
+ knows how to compare, im/export a special XML-type
+*/
+class XMLBitmapLogicalSizePropertyHandler: public XMLPropertyHandler
+{
+public:
+
+ XMLBitmapLogicalSizePropertyHandler();
+
+ // Just needed for virtual destruction
+ virtual ~XMLBitmapLogicalSizePropertyHandler();
+
+ /// Imports the given value in cas of the given XML-data-type
+ virtual sal_Bool importXML(
+ const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const;
+
+ /// Exports the given value in cas of the given XML-data-type
+ virtual sal_Bool exportXML(
+ ::rtl::OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_XMLBITMAPLOGICALSIZEPROPERTYHANDLER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/XMLBitmapRepeatOffsetPropertyHandler.hxx b/xmloff/inc/XMLBitmapRepeatOffsetPropertyHandler.hxx
new file mode 100644
index 000000000000..e94c113d0386
--- /dev/null
+++ b/xmloff/inc/XMLBitmapRepeatOffsetPropertyHandler.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLBITMAPREPEATOFFSETPROPERTYHANDLER_HXX
+#define _XMLOFF_XMLBITMAPREPEATOFFSETPROPERTYHANDLER_HXX
+
+#include <xmloff/xmlprhdl.hxx>
+
+struct SvXMLEnumMapEntry;
+
+///////////////////////////////////////////////////////////////////////////
+//
+/** Abstract base-class for different XML-types. Derivations of this class
+ knows how to compare, im/export a special XML-type
+*/
+class XMLBitmapRepeatOffsetPropertyHandler: public XMLPropertyHandler
+{
+ sal_Bool mbX;
+ ::rtl::OUString msVertical;
+ ::rtl::OUString msHorizontal;
+public:
+
+ XMLBitmapRepeatOffsetPropertyHandler( sal_Bool bX );
+
+ // Just needed for virtual destruction
+ virtual ~XMLBitmapRepeatOffsetPropertyHandler();
+
+ /// Imports the given value in cas of the given XML-data-type
+ virtual sal_Bool importXML(
+ const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const;
+
+ /// Exports the given value in cas of the given XML-data-type
+ virtual sal_Bool exportXML(
+ ::rtl::OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_XMLBITMAPREPEATOFFSETPROPERTYHANDLER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/XMLChartPropertySetMapper.hxx b/xmloff/inc/XMLChartPropertySetMapper.hxx
new file mode 100644
index 000000000000..21e2ff56563f
--- /dev/null
+++ b/xmloff/inc/XMLChartPropertySetMapper.hxx
@@ -0,0 +1,130 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_CHARTPROPERTYSETMAPPER_HXX_
+#define _XMLOFF_CHARTPROPERTYSETMAPPER_HXX_
+
+#include <xmloff/uniref.hxx>
+#include <xmloff/xmlprmap.hxx>
+#include <xmloff/xmlexppr.hxx>
+#include <xmloff/xmlimppr.hxx>
+#include <xmloff/xmlimp.hxx>
+
+namespace rtl { class OUString; }
+
+extern const XMLPropertyMapEntry aXMLChartPropMap[];
+
+class SvXMLExport;
+
+// ----------------------------------------
+
+class XMLChartPropHdlFactory : public XMLPropertyHandlerFactory
+{
+private:
+ const XMLPropertyHandler* GetShapePropertyHandler( sal_Int32 nType ) const;
+
+public:
+ virtual ~XMLChartPropHdlFactory();
+ virtual const XMLPropertyHandler* GetPropertyHandler( sal_Int32 nType ) const;
+};
+
+// ----------------------------------------
+
+class XMLChartPropertySetMapper : public XMLPropertySetMapper
+{
+public:
+ XMLChartPropertySetMapper();
+ ~XMLChartPropertySetMapper();
+};
+
+// ----------------------------------------
+
+class XMLChartExportPropertyMapper : public SvXMLExportPropertyMapper
+{
+private:
+ const rtl::OUString msTrue;
+ const rtl::OUString msFalse;
+ bool mbAdaptPercentage;
+
+ SvXMLExport& mrExport;
+
+protected:
+ virtual void ContextFilter(
+ ::std::vector< XMLPropertyState >& rProperties,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > rPropSet ) const;
+
+private:
+ /// this method is called for every item that has the MID_FLAG_ELEMENT_EXPORT flag set
+ virtual void handleElementItem(
+ SvXMLExport& rExport,
+ const XMLPropertyState& rProperty, sal_uInt16 nFlags,
+ const ::std::vector< XMLPropertyState > *pProperties = 0,
+ sal_uInt32 nIdx = 0 ) const;
+
+ /// this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_EXPORT flag set
+ virtual void handleSpecialItem(
+ SvXMLAttributeList& rAttrList, const XMLPropertyState& rProperty,
+ const SvXMLUnitConverter& rUnitConverter, const SvXMLNamespaceMap& rNamespaceMap,
+ const ::std::vector< XMLPropertyState > *pProperties = 0,
+ sal_uInt32 nIdx = 0 ) const;
+
+public:
+ XMLChartExportPropertyMapper( const UniReference< XMLPropertySetMapper >& rMapper,
+ SvXMLExport& rExport );
+ virtual ~XMLChartExportPropertyMapper();
+
+ void setAdaptPercentage( bool bNewValue );
+};
+
+// ----------------------------------------
+
+class XMLChartImportPropertyMapper : public SvXMLImportPropertyMapper
+{
+private:
+ SvXMLImport& mrImport;
+
+public:
+ XMLChartImportPropertyMapper( const UniReference< XMLPropertySetMapper >& rMapper,
+ const SvXMLImport& rImport );
+ virtual ~XMLChartImportPropertyMapper();
+
+ virtual bool handleSpecialItem(
+ XMLPropertyState& rProperty,
+ ::std::vector< XMLPropertyState >& rProperties,
+ const ::rtl::OUString& rValue,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap ) const;
+
+ virtual void finished(
+ ::std::vector< XMLPropertyState >& rProperties,
+ sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const;
+};
+
+#endif // _XMLOFF_CHARTPROPERTYSETMAPPER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/XMLChartStyleContext.hxx b/xmloff/inc/XMLChartStyleContext.hxx
new file mode 100644
index 000000000000..ea4ae8853f90
--- /dev/null
+++ b/xmloff/inc/XMLChartStyleContext.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLCHARTSTYLECONTEXT_HXX_
+#define _XMLOFF_XMLCHARTSTYLECONTEXT_HXX_
+
+#include <xmloff/XMLShapeStyleContext.hxx>
+
+class XMLChartStyleContext : public XMLShapeStyleContext
+{
+private:
+ ::rtl::OUString msDataStyleName;
+ ::rtl::OUString msPercentageDataStyleName;
+ SvXMLStylesContext& mrStyles;
+
+protected:
+ /// is called when an attribute at the (auto)style element is found
+ virtual void SetAttribute( sal_uInt16 nPrefixKey,
+ const ::rtl::OUString& rLocalName,
+ const ::rtl::OUString& rValue );
+
+public:
+ TYPEINFO();
+
+ XMLChartStyleContext(
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
+ SvXMLStylesContext& rStyles, sal_uInt16 nFamily );
+ virtual ~XMLChartStyleContext();
+
+ /// is called after all styles have been read to apply styles
+ void FillPropertySet(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rPropSet );
+
+ /// necessary for property context (element-property symbol-image)
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+};
+
+#endif // _XMLOFF_XMLCHARTSTYLECONTEXT_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/XMLClipPropertyHandler.hxx b/xmloff/inc/XMLClipPropertyHandler.hxx
new file mode 100644
index 000000000000..c63da912ebfe
--- /dev/null
+++ b/xmloff/inc/XMLClipPropertyHandler.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLCLIPPROPERTYHANDLER_HXX
+#define _XMLOFF_XMLCLIPPROPERTYHANDLER_HXX
+
+#include <xmloff/xmlprhdl.hxx>
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLClipPropertyHandler : public XMLPropertyHandler
+{
+ sal_Bool m_bODF11;
+public:
+ XMLClipPropertyHandler( sal_Bool bODF11 );
+ virtual ~XMLClipPropertyHandler();
+
+ virtual bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const;
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_BASICTYPES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/XMLElementPropertyContext.hxx b/xmloff/inc/XMLElementPropertyContext.hxx
new file mode 100644
index 000000000000..8baf3ac53dca
--- /dev/null
+++ b/xmloff/inc/XMLElementPropertyContext.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLELEMENTPROPERTYCONTEXT_HXX
+#define _XMLOFF_XMLELEMENTPROPERTYCONTEXT_HXX
+
+#include <xmloff/xmlprmap.hxx>
+#include <xmloff/xmlictxt.hxx>
+
+class SvXMLImport;
+
+namespace rtl
+{
+ class OUString;
+}
+
+class XMLElementPropertyContext : public SvXMLImportContext
+{
+ sal_Bool bInsert;
+
+protected:
+
+ ::std::vector< XMLPropertyState > &rProperties;
+ XMLPropertyState aProp;
+
+ sal_Bool IsInsert() const { return bInsert; }
+ void SetInsert( sal_Bool bIns ) { bInsert = bIns; }
+
+public:
+ TYPEINFO();
+
+ XMLElementPropertyContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const XMLPropertyState& rProp,
+ ::std::vector< XMLPropertyState > &rProps );
+
+ virtual ~XMLElementPropertyContext();
+
+ virtual void EndElement();
+};
+
+
+#endif // _XMLOFF_ELEMENTPROPERTYCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/XMLEmbeddedObjectImportContext.hxx b/xmloff/inc/XMLEmbeddedObjectImportContext.hxx
new file mode 100644
index 000000000000..280ca1109ff9
--- /dev/null
+++ b/xmloff/inc/XMLEmbeddedObjectImportContext.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLEMBEDDEDOBJECTIMPORTCONTEXT_HXX
+#define _XMLOFF_XMLEMBEDDEDOBJECTIMPORTCONTEXT_HXX
+
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <xmloff/xmlictxt.hxx>
+
+namespace com { namespace sun { namespace star { namespace lang {
+ class XComponent; } } } }
+
+class XMLEmbeddedObjectImportContext : public SvXMLImportContext
+{
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XDocumentHandler > xHandler;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XComponent > xComp;
+
+ ::rtl::OUString sFilterService;
+ // #100592#
+ ::rtl::OUString sCLSID;
+
+public:
+ TYPEINFO();
+
+ const ::rtl::OUString& GetFilterServiceName() const { return sFilterService; }
+ // #100592#
+ const ::rtl::OUString& GetFilterCLSID() const { return sCLSID; }
+
+ XMLEmbeddedObjectImportContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual ~XMLEmbeddedObjectImportContext();
+
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void EndElement();
+
+ virtual void Characters( const ::rtl::OUString& rChars );
+
+ sal_Bool SetComponent(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XComponent >& rComp );
+
+};
+
+#endif // _XMLOFF_XMLEMBEDDEDOBJECTIMPORTCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/XMLEventImportHelper.hxx b/xmloff/inc/XMLEventImportHelper.hxx
new file mode 100644
index 000000000000..5a1c84b4ec4d
--- /dev/null
+++ b/xmloff/inc/XMLEventImportHelper.hxx
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_EVENTIMPORTHELPER_HXX
+#define _XMLOFF_EVENTIMPORTHELPER_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <xmloff/xmlevent.hxx>
+
+#include <map>
+#include <list>
+
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+} } }
+namespace rtl { class OUString; }
+class XMLEventContextFactory;
+class XMLEventsImportContext;
+struct XMLEventNameTranslation;
+
+typedef ::std::map< ::rtl::OUString, XMLEventContextFactory* > FactoryMap;
+typedef ::std::map< XMLEventName, ::rtl::OUString > NameMap;
+typedef ::std::list< NameMap* > NameMapList;
+
+
+/**
+ * Helps the XMLEventsImportContext.
+ *
+ * This class stores
+ * a) the translation from XML event names to API event names, and
+ * b) a mapping from script language names to XMLEventContextFactory objects
+ * (that handle particular languages).
+ *
+ * Event name translation tables may be added, i.e. they will be joined
+ * together. If different translations are needed (i.e., if the same XML name
+ * needs to be translated to different API names in different contexts), then
+ * translation tables may be saved on a translation table stack.
+ */
+class XMLEventImportHelper
+{
+ /// map of XMLEventContextFactory objects
+ FactoryMap aFactoryMap;
+
+ /// map from XML to API names
+ NameMap* pEventNameMap;
+
+ /// stack of previous aEventNameMap
+ NameMapList aEventNameMapList;
+
+public:
+ XMLEventImportHelper();
+
+ ~XMLEventImportHelper();
+
+ /// register a handler for a particular language type
+ void RegisterFactory( const ::rtl::OUString& rLanguage,
+ XMLEventContextFactory* aFactory );
+
+ /// add event name translation to the internal table
+ void AddTranslationTable( const XMLEventNameTranslation* pTransTable );
+
+ /// save the old translation table on a stack and install an empty table
+ void PushTranslationTable();
+
+ /// recover the top-most previously saved translation table
+ void PopTranslationTable();
+
+ /// create an appropriate import context for a particular event
+ SvXMLImportContext* CreateContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList,
+ XMLEventsImportContext* rEvents,
+ const ::rtl::OUString& rXmlEventName,
+ const ::rtl::OUString& rLanguage);
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/XMLFillBitmapSizePropertyHandler.hxx b/xmloff/inc/XMLFillBitmapSizePropertyHandler.hxx
new file mode 100644
index 000000000000..930939ca1f9a
--- /dev/null
+++ b/xmloff/inc/XMLFillBitmapSizePropertyHandler.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLFILLBITMAPSIZEPROPERTYHANDLER_HXX
+#define _XMLOFF_XMLFILLBITMAPSIZEPROPERTYHANDLER_HXX
+
+#include <xmloff/xmlprhdl.hxx>
+
+struct SvXMLEnumMapEntry;
+
+///////////////////////////////////////////////////////////////////////////
+//
+/** Abstract base-class for different XML-types. Derivations of this class
+ knows how to compare, im/export a special XML-type
+*/
+class XMLFillBitmapSizePropertyHandler: public XMLPropertyHandler
+{
+public:
+
+ XMLFillBitmapSizePropertyHandler();
+
+ // Just needed for virtual destruction
+ virtual ~XMLFillBitmapSizePropertyHandler();
+
+ /// Imports the given value in cas of the given XML-data-type
+ virtual sal_Bool importXML(
+ const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const;
+
+ /// Exports the given value in cas of the given XML-data-type
+ virtual sal_Bool exportXML(
+ ::rtl::OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_XMLFILLBITMAPSIZEPROPERTYHANDLER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/XMLFootnoteConfigurationImportContext.hxx b/xmloff/inc/XMLFootnoteConfigurationImportContext.hxx
new file mode 100644
index 000000000000..a950e405c22f
--- /dev/null
+++ b/xmloff/inc/XMLFootnoteConfigurationImportContext.hxx
@@ -0,0 +1,124 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLFOOTNOTECONFIGURATIONIMPORTCONTEXT_HXX
+#define _XMLOFF_XMLFOOTNOTECONFIGURATIONIMPORTCONTEXT_HXX
+
+#include <xmloff/xmlstyle.hxx>
+
+namespace com { namespace sun { namespace star {
+ namespace uno { template<class X> class Reference; }
+ namespace xml { namespace sax { class XAttributeList; } }
+ namespace beans { class XPropertySet; }
+} } }
+namespace rtl { class OUString; }
+class SvXMLImport;
+
+/// import footnote and endnote configuration elements
+class XMLFootnoteConfigurationImportContext : public SvXMLStyleContext
+{
+ const ::rtl::OUString sPropertyAnchorCharStyleName;
+ const ::rtl::OUString sPropertyCharStyleName;
+ const ::rtl::OUString sPropertyNumberingType;
+ const ::rtl::OUString sPropertyPageStyleName;
+ const ::rtl::OUString sPropertyParagraphStyleName;
+ const ::rtl::OUString sPropertyPrefix;
+ const ::rtl::OUString sPropertyStartAt;
+ const ::rtl::OUString sPropertySuffix;
+ const ::rtl::OUString sPropertyPositionEndOfDoc;
+ const ::rtl::OUString sPropertyFootnoteCounting;
+ const ::rtl::OUString sPropertyEndNotice;
+ const ::rtl::OUString sPropertyBeginNotice;
+
+ ::rtl::OUString sCitationStyle;
+ ::rtl::OUString sAnchorStyle;
+ ::rtl::OUString sDefaultStyle;
+ ::rtl::OUString sPageStyle;
+ ::rtl::OUString sPrefix;
+ ::rtl::OUString sSuffix;
+ ::rtl::OUString sNumFormat;
+ ::rtl::OUString sNumSync;
+ ::rtl::OUString sBeginNotice;
+ ::rtl::OUString sEndNotice;
+
+ SvXMLTokenMap* pAttrTokenMap;
+
+ sal_Int16 nOffset;
+ sal_Int16 nNumbering;
+ sal_Bool bPosition;
+ sal_Bool bIsEndnote;
+
+public:
+
+ TYPEINFO();
+
+ XMLFootnoteConfigurationImportContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+
+ virtual ~XMLFootnoteConfigurationImportContext();
+
+ /// parse attributes
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+
+ /// for footnotes, also parse begin and end notices
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+
+ /// get token map for attributes
+ const SvXMLTokenMap& GetFtnConfigAttrTokenMap();
+
+ /// set configuration at document; calls ProcessSettings
+ /* Move code from <CreateAndInsertLate(..)> to <Finish(..)>, because
+ at this time all styles it references have been set. (#i40579#)
+ */
+ virtual void Finish( sal_Bool bOverwrite);
+
+ /// set configuration at document
+ void ProcessSettings(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rConfig);
+
+ /// for helper class: set begin notice
+ void SetBeginNotice( ::rtl::OUString sText);
+
+ /// for helper class: set end notice
+ void SetEndNotice( ::rtl::OUString sText);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/XMLImageMapContext.hxx b/xmloff/inc/XMLImageMapContext.hxx
new file mode 100644
index 000000000000..339a0c72e9f9
--- /dev/null
+++ b/xmloff/inc/XMLImageMapContext.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLIMAGEMAPCONTEXT_HXX_
+#define _XMLOFF_XMLIMAGEMAPCONTEXT_HXX_
+
+#include <xmloff/xmlictxt.hxx>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Reference.h>
+
+namespace com { namespace sun { namespace star {
+ namespace container { class XIndexContainer; }
+ namespace beans { class XPropertySet; }
+ namespace xml { namespace sax { class XAttributeList; } }
+} } }
+
+
+class XMLImageMapContext : public SvXMLImportContext
+{
+ const ::rtl::OUString sImageMap;
+
+ /// the image map to be imported
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XIndexContainer> xImageMap;
+
+ /// the property set from which to get and where eventually to set the
+ /// image map
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> xPropertySet;
+
+public:
+ TYPEINFO();
+
+ XMLImageMapContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropertySet);
+
+ virtual ~XMLImageMapContext();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void EndElement();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/XMLImageMapExport.hxx b/xmloff/inc/XMLImageMapExport.hxx
new file mode 100644
index 000000000000..d0e39f43390b
--- /dev/null
+++ b/xmloff/inc/XMLImageMapExport.hxx
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLIMAGEMAPEXPORT_HXX_
+#define _XMLOFF_XMLIMAGEMAPEXPORT_HXX_
+
+#include <rtl/ustring.hxx>
+
+namespace com { namespace sun { namespace star {
+ namespace uno { template<class X> class Reference; }
+ namespace beans { class XPropertySet; }
+ namespace container { class XIndexContainer; }
+} } }
+class SvXMLExport;
+
+
+/**
+ * Export an ImageMap as defined by service com.sun.star.image.ImageMap to XML.
+ */
+class XMLImageMapExport
+{
+ const ::rtl::OUString msBoundary;
+ const ::rtl::OUString msCenter;
+ const ::rtl::OUString msDescription;
+ const ::rtl::OUString msImageMap;
+ const ::rtl::OUString msIsActive;
+ const ::rtl::OUString msName;
+ const ::rtl::OUString msPolygon;
+ const ::rtl::OUString msRadius;
+ const ::rtl::OUString msTarget;
+ const ::rtl::OUString msURL;
+ const ::rtl::OUString msTitle;
+
+ SvXMLExport& mrExport;
+
+ sal_Bool mbWhiteSpace; /// use whitespace between image map elements?
+
+public:
+ XMLImageMapExport(SvXMLExport& rExport);
+
+ ~XMLImageMapExport();
+
+ /**
+ * Get the ImageMap object from the "ImageMap" property and subsequently
+ * export the map (if present).
+ */
+ void Export(
+ /// the property set containing the ImageMap property
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropertySet);
+ /**
+ * Export an ImageMap (XIndexContainer).
+ */
+ void Export(
+ /// the container containing the image map elements
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XIndexContainer> & rContainer);
+
+protected:
+
+ /**
+ * Export a single, named map entry.
+ * (as given by com.sun.star.image.ImageMapObject)
+ * Calls methods for specific image map entries.
+ */
+ void ExportMapEntry(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropertySet);
+
+ /**
+ * Export the specifics of a rectangular image map entry.
+ * To be called by ExportMapEntry.
+ */
+ void ExportRectangle(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropertySet);
+
+ /**
+ * Export the specifics of a circular image map entry.
+ * To be called by ExportMapEntry.
+ */
+ void ExportCircle(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropertySet);
+
+ /**
+ * Export the specifics of a polygonal image map entry;
+ * To be called by ExportMapEntry.
+ */
+ void ExportPolygon(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropertySet);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/XMLIndexBibliographyConfigurationContext.hxx b/xmloff/inc/XMLIndexBibliographyConfigurationContext.hxx
new file mode 100644
index 000000000000..9d8fbdbf8089
--- /dev/null
+++ b/xmloff/inc/XMLIndexBibliographyConfigurationContext.hxx
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLINDEXBIBLIOGRAPHYCONFIGURATIONCONTEXT_HXX_
+#define _XMLOFF_XMLINDEXBIBLIOGRAPHYCONFIGURATIONCONTEXT_HXX_
+
+#include <xmloff/xmlstyle.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/lang/Locale.hpp>
+#include <rtl/ustring.hxx>
+
+
+#include <vector>
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+} } }
+
+
+/**
+ * Import bibliography configuration.
+ *
+ * Little cheat: Cover all child elements in CreateChildContext.
+ */
+class XMLIndexBibliographyConfigurationContext : public SvXMLStyleContext
+{
+ const ::rtl::OUString sFieldMaster_Bibliography;
+ const ::rtl::OUString sBracketBefore;
+ const ::rtl::OUString sBracketAfter;
+ const ::rtl::OUString sIsNumberEntries;
+ const ::rtl::OUString sIsSortByPosition;
+ const ::rtl::OUString sSortKeys;
+ const ::rtl::OUString sSortKey;
+ const ::rtl::OUString sIsSortAscending;
+ const ::rtl::OUString sSortAlgorithm;
+ const ::rtl::OUString sLocale;
+
+ ::rtl::OUString sSuffix;
+ ::rtl::OUString sPrefix;
+ ::rtl::OUString sAlgorithm;
+ ::com::sun::star::lang::Locale aLocale;
+ sal_Bool bNumberedEntries;
+ sal_Bool bSortByPosition;
+
+ ::std::vector< ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue> > aSortKeys;
+
+public:
+
+ TYPEINFO();
+
+ XMLIndexBibliographyConfigurationContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+
+ ~XMLIndexBibliographyConfigurationContext();
+
+protected:
+
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+
+ virtual void CreateAndInsert( sal_Bool bOverwrite );
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+
+ void ProcessAttribute(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString sLocalName,
+ const ::rtl::OUString sValue);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/XMLIsPercentagePropertyHandler.hxx b/xmloff/inc/XMLIsPercentagePropertyHandler.hxx
new file mode 100644
index 000000000000..17b7b351980d
--- /dev/null
+++ b/xmloff/inc/XMLIsPercentagePropertyHandler.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLISPERCENTAGEPROPERTYHANDLER_HXX
+#define _XMLOFF_XMLISPERCENTAGEPROPERTYHANDLER_HXX
+
+#include <xmloff/xmlprhdl.hxx>
+
+/**
+ This is a handler that returns true for import if the attribute string
+ contains a '%' value. For export this is only usable for filtering.
+*/
+class XMLIsPercentagePropertyHandler : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLIsPercentagePropertyHandler ();
+
+ virtual sal_Bool importXML(
+ const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML(
+ ::rtl::OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/XMLLineNumberingImportContext.hxx b/xmloff/inc/XMLLineNumberingImportContext.hxx
new file mode 100644
index 000000000000..e00282d4e284
--- /dev/null
+++ b/xmloff/inc/XMLLineNumberingImportContext.hxx
@@ -0,0 +1,129 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLLINENUMBERINGIMPORTCONTEXT_HXX_
+#define _XMLOFF_XMLLINENUMBERINGIMPORTCONTEXT_HXX_
+
+#include <xmloff/xmlstyle.hxx>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Reference.h>
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+} } }
+
+
+enum LineNumberingToken
+{
+ XML_TOK_LINENUMBERING_STYLE_NAME,
+ XML_TOK_LINENUMBERING_NUMBER_LINES,
+ XML_TOK_LINENUMBERING_COUNT_EMPTY_LINES,
+ XML_TOK_LINENUMBERING_COUNT_IN_TEXT_BOXES,
+ XML_TOK_LINENUMBERING_RESTART_NUMBERING,
+ XML_TOK_LINENUMBERING_OFFSET,
+ XML_TOK_LINENUMBERING_NUM_FORMAT,
+ XML_TOK_LINENUMBERING_NUM_LETTER_SYNC,
+ XML_TOK_LINENUMBERING_NUMBER_POSITION,
+ XML_TOK_LINENUMBERING_INCREMENT
+// XML_TOK_LINENUMBERING_LINENUMBERING_CONFIGURATION,
+// XML_TOK_LINENUMBERING_INCREMENT,
+// XML_TOK_LINENUMBERING_LINENUMBERING_SEPARATOR,
+};
+
+
+/** import <text:linenumbering-configuration> elements */
+class XMLLineNumberingImportContext : public SvXMLStyleContext
+{
+ const ::rtl::OUString sCharStyleName;
+ const ::rtl::OUString sCountEmptyLines;
+ const ::rtl::OUString sCountLinesInFrames;
+ const ::rtl::OUString sDistance;
+ const ::rtl::OUString sInterval;
+ const ::rtl::OUString sSeparatorText;
+ const ::rtl::OUString sNumberPosition;
+ const ::rtl::OUString sNumberingType;
+ const ::rtl::OUString sIsOn;
+ const ::rtl::OUString sRestartAtEachPage;
+ const ::rtl::OUString sSeparatorInterval;
+
+ ::rtl::OUString sStyleName;
+ ::rtl::OUString sNumFormat;
+ ::rtl::OUString sNumLetterSync;
+ ::rtl::OUString sSeparator;
+ sal_Int32 nOffset;
+ sal_Int16 nNumberPosition;
+ sal_Int16 nIncrement;
+ sal_Int16 nSeparatorIncrement;
+ sal_Bool bNumberLines;
+ sal_Bool bCountEmptyLines;
+ sal_Bool bCountInFloatingFrames;
+ sal_Bool bRestartNumbering;
+
+public:
+
+ TYPEINFO();
+
+ XMLLineNumberingImportContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+
+ ~XMLLineNumberingImportContext();
+
+ // to be used by child context: set separator info
+ void SetSeparatorText(const ::rtl::OUString& sText);
+ void SetSeparatorIncrement(sal_Int16 nIncr);
+
+protected:
+
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+
+ void ProcessAttribute(
+ enum LineNumberingToken eToken,
+ ::rtl::OUString sValue);
+
+ virtual void CreateAndInsert(sal_Bool bOverwrite);
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+
+ void ProcessAttribute(
+ const ::rtl::OUString sLocalName,
+ const ::rtl::OUString sValue);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/XMLNumberStylesImport.hxx b/xmloff/inc/XMLNumberStylesImport.hxx
new file mode 100644
index 000000000000..29f279ee440e
--- /dev/null
+++ b/xmloff/inc/XMLNumberStylesImport.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_NUMBERSTYLESIMPORT_HXX
+#define _XMLOFF_NUMBERSTYLESIMPORT_HXX
+
+#include <xmloff/xmlnumfi.hxx>
+#include <com/sun/star/container/XNameAccess.hpp>
+
+//////////////////////////////////////////////////////////////////////////////
+// presentations:animations
+
+struct SdXMLFixedDataStyle;
+class SdXMLImport;
+
+class SdXMLNumberFormatImportContext : public SvXMLNumFormatContext
+{
+private:
+ friend class SdXMLNumberFormatMemberImportContext;
+
+ SdXMLImport& mrImport;
+
+ sal_Bool mbTimeStyle;
+ sal_Bool mbAutomatic;
+ sal_uInt8 mnElements[16];
+ sal_Int16 mnIndex;
+
+ sal_Int32 mnKey;
+
+ bool compareStyle( const SdXMLFixedDataStyle* pStyle, sal_Int16& nIndex ) const;
+
+protected:
+ void add( rtl::OUString& rNumberStyle, sal_Bool bLong, sal_Bool bTextual, sal_Bool bDecimal02, rtl::OUString& rText );
+
+public:
+ TYPEINFO();
+
+ SdXMLNumberFormatImportContext( SdXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ SvXMLNumImpData* pNewData, sal_uInt16 nNewType,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ SvXMLStylesContext& rStyles);
+ virtual ~SdXMLNumberFormatImportContext();
+
+ virtual void EndElement();
+
+ virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+ sal_Int32 GetDrawKey() const { return mnKey; }
+};
+
+#endif // _XMLOFF_NUMBERSTYLESIMPORT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/XMLPercentOrMeasurePropertyHandler.hxx b/xmloff/inc/XMLPercentOrMeasurePropertyHandler.hxx
new file mode 100644
index 000000000000..1d45876d57f3
--- /dev/null
+++ b/xmloff/inc/XMLPercentOrMeasurePropertyHandler.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLPERCENTORMEASUREPROPERTYHANDLER_HXX
+#define _XMLOFF_XMLPERCENTORMEASUREPROPERTYHANDLER_HXX
+
+#include <xmloff/xmlprhdl.hxx>
+
+/**
+ This is a handler either only import/exports percent or measure.
+*/
+class XMLPercentOrMeasurePropertyHandler : public XMLPropertyHandler
+{
+private:
+ sal_Bool mbPercent;
+public:
+ XMLPercentOrMeasurePropertyHandler( sal_Bool bPercent );
+ virtual ~XMLPercentOrMeasurePropertyHandler ();
+
+ virtual sal_Bool importXML(
+ const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML(
+ ::rtl::OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/XMLRectangleMembersHandler.hxx b/xmloff/inc/XMLRectangleMembersHandler.hxx
new file mode 100644
index 000000000000..22a55e805e76
--- /dev/null
+++ b/xmloff/inc/XMLRectangleMembersHandler.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLRECTANGLEMEMBERSHANDLER_HXX
+#define _XMLOFF_XMLRECTANGLEMEMBERSHANDLER_HXX
+
+#include <xmloff/xmlprhdl.hxx>
+
+struct SvXMLEnumMapEntry;
+
+///////////////////////////////////////////////////////////////////////////
+//
+/** Abstract base-class for different XML-types. Derivations of this class
+ knows how to compare, im/export a special XML-type
+*/
+class XMLRectangleMembersHdl: public XMLPropertyHandler
+{
+private:
+ sal_Int32 mnType;
+public:
+
+ XMLRectangleMembersHdl( sal_Int32 nType );
+
+ // Just needed for virtual destruction
+ virtual ~XMLRectangleMembersHdl();
+
+ /// Imports the given value in cas of the given XML-data-type
+ virtual sal_Bool importXML(
+ const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const;
+
+ /// Exports the given value in cas of the given XML-data-type
+ virtual sal_Bool exportXML(
+ ::rtl::OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_XMLRECTANGLEMEMBERSHANDLER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/XMLReplacementImageContext.hxx b/xmloff/inc/XMLReplacementImageContext.hxx
new file mode 100644
index 000000000000..2c391ba2c67f
--- /dev/null
+++ b/xmloff/inc/XMLReplacementImageContext.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLREPLACEMENTIMAGECONTEXT_HXX
+#define _XMLOFF_XMLREPLACEMENTIMAGECONTEXT_HXX
+
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <xmloff/xmlictxt.hxx>
+
+
+namespace com { namespace sun { namespace star {
+ namespace beans { class XPropertySet; }
+ namespace io { class XOutputStream; } } } }
+
+class XMLReplacementImageContext : public SvXMLImportContext
+{
+ ::com::sun::star::uno::Reference <
+ ::com::sun::star::io::XOutputStream > m_xBase64Stream;
+::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > m_xPropSet;
+
+ ::rtl::OUString m_sHRef;
+ const ::rtl::OUString m_sGraphicURL;
+
+public:
+
+ TYPEINFO();
+
+ XMLReplacementImageContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & rAttrList,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet >& rPropSet );
+ virtual ~XMLReplacementImageContext();
+
+ virtual void EndElement();
+
+ SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+};
+
+#endif // _XMLOFF_XMLREPLACEMENTIMAGECONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/XMLScriptContextFactory.hxx b/xmloff/inc/XMLScriptContextFactory.hxx
new file mode 100644
index 000000000000..156c8fcf4729
--- /dev/null
+++ b/xmloff/inc/XMLScriptContextFactory.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLSCRIPTCONTEXTFACTORY_HXX
+#define _XMLOFF_XMLSCRIPTCONTEXTFACTORY_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <xmloff/xmlevent.hxx>
+
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+} } }
+namespace rtl { class OUString; }
+class SvXMLImport;
+class XMLEventsImportContext;
+
+class XMLScriptContextFactory : public XMLEventContextFactory
+{
+ const ::rtl::OUString sEventType;
+ const ::rtl::OUString sScript;
+ const ::rtl::OUString sURL;
+
+public:
+ XMLScriptContextFactory();
+ virtual ~XMLScriptContextFactory();
+
+ virtual SvXMLImportContext *
+ CreateContext(SvXMLImport & rImport, /// import context
+ sal_uInt16 nPrefix, /// element: namespace prefix
+ const ::rtl::OUString & rLocalName, /// element: local name
+ /// attribute list
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList,
+ /// the context for the enclosing <script:events> element
+ XMLEventsImportContext * rEvents,
+ /// the event name (as understood by the API)
+ const ::rtl::OUString & rApiEventName,
+ /// the event type name (as registered)
+ const ::rtl::OUString & rLanguage);
+};
+
+#endif // _XMLOFF_XMLSCRIPTCONTEXTFACTORY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/XMLScriptExportHandler.hxx b/xmloff/inc/XMLScriptExportHandler.hxx
new file mode 100644
index 000000000000..0ee6b8b6c23b
--- /dev/null
+++ b/xmloff/inc/XMLScriptExportHandler.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLSCRIPTEXPORTHANDLER_HXX
+#define _XMLOFF_XMLSCRIPTEXPORTHANDLER_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <rtl/ustring.hxx>
+#include <xmloff/xmlevent.hxx>
+
+#include <map>
+
+class SvXMLExport;
+namespace com { namespace sun { namespace star {
+ namespace beans { struct PropertyValue; }
+} } }
+
+class XMLScriptExportHandler : public XMLEventExportHandler
+{
+ const ::rtl::OUString sURL;
+
+public:
+ XMLScriptExportHandler();
+ virtual ~XMLScriptExportHandler();
+
+ virtual void Export(
+ SvXMLExport& rExport,
+ const ::rtl::OUString& rEventName,
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue> & rValues,
+ sal_Bool bUseWhitespace);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/XMLShapePropertySetContext.hxx b/xmloff/inc/XMLShapePropertySetContext.hxx
new file mode 100644
index 000000000000..2c9b1038ecc0
--- /dev/null
+++ b/xmloff/inc/XMLShapePropertySetContext.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLSHAPEPROPERTYSETCONTEXT_HXX
+#define _XMLOFF_XMLSHAPEPROPERTYSETCONTEXT_HXX
+
+
+#include <xmloff/xmlprcon.hxx>
+
+class XMLShapePropertySetContext : public SvXMLPropertySetContext
+{
+ SvXMLImportContextRef mxBulletStyle;
+ sal_Int32 mnBulletIndex;
+
+public:
+
+ TYPEINFO();
+
+ XMLShapePropertySetContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList >& xAttrList,
+ sal_uInt32 nFam,
+ ::std::vector< XMLPropertyState > &rProps,
+ const UniReference < SvXMLImportPropertyMapper > &rMap );
+
+ virtual ~XMLShapePropertySetContext();
+
+ virtual void EndElement();
+
+ using SvXMLPropertySetContext::CreateChildContext;
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList,
+ ::std::vector< XMLPropertyState > &rProperties,
+ const XMLPropertyState& rProp);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/XMLStarBasicContextFactory.hxx b/xmloff/inc/XMLStarBasicContextFactory.hxx
new file mode 100644
index 000000000000..b4fbb62618ef
--- /dev/null
+++ b/xmloff/inc/XMLStarBasicContextFactory.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLSTARBASICCONTEXTFACTORY_HXX
+#define _XMLOFF_XMLSTARBASICCONTEXTFACTORY_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <xmloff/xmlevent.hxx>
+
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+} } }
+namespace rtl { class OUString; }
+class SvXMLImport;
+class XMLEventsImportContext;
+
+
+class XMLStarBasicContextFactory : public XMLEventContextFactory
+{
+ const ::rtl::OUString sEventType;
+ const ::rtl::OUString sLibrary;
+ const ::rtl::OUString sMacroName;
+ const ::rtl::OUString sStarBasic;
+
+public:
+ XMLStarBasicContextFactory();
+ virtual ~XMLStarBasicContextFactory();
+
+ virtual SvXMLImportContext* CreateContext(
+ SvXMLImport& rImport, /// import context
+ sal_uInt16 nPrefix, /// element: namespace prefix
+ const ::rtl::OUString& rLocalName, /// element: local name
+ const ::com::sun::star::uno::Reference< /// attribute list
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList,
+ /// the context for the enclosing <script:events> element
+ XMLEventsImportContext* rEvents,
+ /// the event name (as understood by the API)
+ const ::rtl::OUString& rApiEventName,
+ /// the event type name (as registered)
+ const ::rtl::OUString& rLanguage);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/XMLStarBasicExportHandler.hxx b/xmloff/inc/XMLStarBasicExportHandler.hxx
new file mode 100644
index 000000000000..56876e8d5a6e
--- /dev/null
+++ b/xmloff/inc/XMLStarBasicExportHandler.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLSTARBASICEXPORTHANDLER_HXX
+#define _XMLOFF_XMLSTARBASICEXPORTHANDLER_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <rtl/ustring.hxx>
+#include <xmloff/xmlevent.hxx>
+
+#include <map>
+
+class SvXMLExport;
+namespace com { namespace sun { namespace star {
+ namespace beans { struct PropertyValue; }
+} } }
+
+class XMLStarBasicExportHandler : public XMLEventExportHandler
+{
+ const ::rtl::OUString sStarBasic;
+ const ::rtl::OUString sLibrary;
+ const ::rtl::OUString sMacroName;
+ const ::rtl::OUString sStarOffice;
+ const ::rtl::OUString sApplication;
+
+public:
+ XMLStarBasicExportHandler();
+ virtual ~XMLStarBasicExportHandler();
+
+ virtual void Export(
+ SvXMLExport& rExport,
+ const ::rtl::OUString& rEventName,
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue> & rValues,
+ sal_Bool bUseWhitespace);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/XMLStringBufferImportContext.hxx b/xmloff/inc/XMLStringBufferImportContext.hxx
new file mode 100644
index 000000000000..89f87448ba49
--- /dev/null
+++ b/xmloff/inc/XMLStringBufferImportContext.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLSTRINGBUFFERIMPORTCONTEXT_HXX
+#define _XMLOFF_XMLSTRINGBUFFERIMPORTCONTEXT_HXX
+
+
+#include <xmloff/xmlictxt.hxx>
+
+#include <xmloff/xmlimp.hxx>
+#include <rtl/ustrbuf.hxx>
+
+
+/**
+ * Import all text into a string buffer. Paragraph elements (<text:p>)
+ * are recognized and cause a return character (0x0a) to be added.
+ */
+class XMLStringBufferImportContext : public SvXMLImportContext
+{
+ ::rtl::OUStringBuffer& rTextBuffer;
+
+public:
+
+ TYPEINFO();
+
+ XMLStringBufferImportContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& sLocalName,
+ ::rtl::OUStringBuffer& rBuffer);
+
+ virtual ~XMLStringBufferImportContext();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void Characters(
+ const ::rtl::OUString& rChars );
+
+ virtual void EndElement();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/XMLTextColumnsContext.hxx b/xmloff/inc/XMLTextColumnsContext.hxx
new file mode 100644
index 000000000000..c8bc74ea1c87
--- /dev/null
+++ b/xmloff/inc/XMLTextColumnsContext.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLTEXTCOLUMNSCONTEXT_HXX
+#define _XMLTEXTCOLUMNSCONTEXT_HXX
+
+#include "XMLElementPropertyContext.hxx"
+
+
+namespace rtl { class OUString; }
+class XMLTextColumnsArray_Impl;
+class XMLTextColumnSepContext_Impl;
+class SvXMLTokenMap;
+
+class XMLTextColumnsContext :public XMLElementPropertyContext
+{
+ const ::rtl::OUString sSeparatorLineIsOn;
+ const ::rtl::OUString sSeparatorLineWidth;
+ const ::rtl::OUString sSeparatorLineColor;
+ const ::rtl::OUString sSeparatorLineRelativeHeight;
+ const ::rtl::OUString sSeparatorLineVerticalAlignment;
+ const ::rtl::OUString sIsAutomatic;
+ const ::rtl::OUString sAutomaticDistance;
+ const ::rtl::OUString sSeparatorLineStyle;
+
+
+ XMLTextColumnsArray_Impl *pColumns;
+ XMLTextColumnSepContext_Impl *pColumnSep;
+ SvXMLTokenMap *pColumnAttrTokenMap;
+ SvXMLTokenMap *pColumnSepAttrTokenMap;
+ sal_Int16 nCount;
+ sal_Bool bAutomatic;
+ sal_Int32 nAutomaticDistance;
+
+public:
+ TYPEINFO();
+
+ XMLTextColumnsContext(
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
+ const XMLPropertyState& rProp,
+ ::std::vector< XMLPropertyState > &rProps );
+
+ virtual ~XMLTextColumnsContext();
+
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+ virtual void EndElement();
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/XMLTextColumnsExport.hxx b/xmloff/inc/XMLTextColumnsExport.hxx
new file mode 100644
index 000000000000..b108e1982b53
--- /dev/null
+++ b/xmloff/inc/XMLTextColumnsExport.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLTEXTCOLUMNSEXPORT_HXX
+#define _XMLOFF_XMLTEXTCOLUMNSEXPORT_HXX
+
+namespace com { namespace sun { namespace star { namespace uno {
+ class Any; } } } }
+class SvXMLExport;
+
+class XMLTextColumnsExport
+{
+ SvXMLExport& rExport;
+
+ const ::rtl::OUString sSeparatorLineIsOn;
+ const ::rtl::OUString sSeparatorLineWidth;
+ const ::rtl::OUString sSeparatorLineColor;
+ const ::rtl::OUString sSeparatorLineRelativeHeight;
+ const ::rtl::OUString sSeparatorLineVerticalAlignment;
+ const ::rtl::OUString sIsAutomatic;
+ const ::rtl::OUString sAutomaticDistance;
+ const ::rtl::OUString sSeparatorLineStyle;
+
+protected:
+
+ SvXMLExport& GetExport() { return rExport; }
+
+public:
+
+ XMLTextColumnsExport( SvXMLExport& rExport );
+
+ void exportXML( const ::com::sun::star::uno::Any& rAny );
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/XMLTextColumnsPropertyHandler.hxx b/xmloff/inc/XMLTextColumnsPropertyHandler.hxx
new file mode 100644
index 000000000000..4c949d225a08
--- /dev/null
+++ b/xmloff/inc/XMLTextColumnsPropertyHandler.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLTEXTCOLUMNSPROPERTYHANDLER_HXX
+#define _XMLOFF_XMLTEXTCOLUMNSPROPERTYHANDLER_HXX
+
+#include <xmloff/xmlprhdl.hxx>
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLTextColumnsPropertyHandler : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLTextColumnsPropertyHandler ();
+
+ virtual bool equals(
+ const ::com::sun::star::uno::Any& r1,
+ const ::com::sun::star::uno::Any& r2 ) const;
+
+ /// TabStops will be imported/exported as XML-Elements. So the Import/Export-work must be done at another place.
+ virtual sal_Bool importXML(
+ const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML(
+ ::rtl::OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/XMLTextHeaderFooterContext.hxx b/xmloff/inc/XMLTextHeaderFooterContext.hxx
new file mode 100644
index 000000000000..e80bb576bc82
--- /dev/null
+++ b/xmloff/inc/XMLTextHeaderFooterContext.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_TEXTHEADERFOOTERCONTEXT_HXX_
+#define _XMLOFF_TEXTHEADERFOOTERCONTEXT_HXX_
+
+
+#include <xmloff/xmlictxt.hxx>
+
+namespace com { namespace sun { namespace star {
+ namespace text { class XTextCursor; }
+ namespace beans { class XPropertySet; }
+} } }
+
+class XMLTextHeaderFooterContext: public SvXMLImportContext
+{
+ ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextCursor > xOldTextCursor;
+ ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > xPropSet;
+
+ const ::rtl::OUString sOn;
+ const ::rtl::OUString sShareContent;
+ const ::rtl::OUString sText;
+ const ::rtl::OUString sTextLeft;
+
+ sal_Bool bInsertContent : 1;
+ sal_Bool bLeft : 1;
+
+public:
+ TYPEINFO();
+
+ XMLTextHeaderFooterContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rPageStylePropSet,
+ sal_Bool bFooter, sal_Bool bLft );
+
+ virtual ~XMLTextHeaderFooterContext();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+ virtual void EndElement();
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/anim.hxx b/xmloff/inc/anim.hxx
new file mode 100644
index 000000000000..2e5a1547efb4
--- /dev/null
+++ b/xmloff/inc/anim.hxx
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_ANIM_HXX
+#define _XMLOFF_ANIM_HXX
+
+#include <com/sun/star/presentation/AnimationEffect.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <xmloff/uniref.hxx>
+#include <xmloff/xmlement.hxx>
+
+enum XMLEffect
+{
+ EK_none,
+ EK_fade,
+ EK_move,
+ EK_stripes,
+ EK_open,
+ EK_close,
+ EK_dissolve,
+ EK_wavyline,
+ EK_random,
+ EK_lines,
+ EK_laser,
+ EK_appear,
+ EK_hide,
+ EK_move_short,
+ EK_checkerboard,
+ EK_rotate,
+ EK_stretch
+};
+
+extern SvXMLEnumMapEntry aXML_AnimationEffect_EnumMap[];
+
+enum XMLEffectDirection
+{
+ ED_none,
+ ED_from_left,
+ ED_from_top,
+ ED_from_right,
+ ED_from_bottom,
+ ED_from_center,
+ ED_from_upperleft,
+ ED_from_upperright,
+ ED_from_lowerleft,
+ ED_from_lowerright,
+
+ ED_to_left,
+ ED_to_top,
+ ED_to_right,
+ ED_to_bottom,
+ ED_to_upperleft,
+ ED_to_upperright,
+ ED_to_lowerright,
+ ED_to_lowerleft,
+
+ ED_path,
+ ED_spiral_inward_left,
+ ED_spiral_inward_right,
+ ED_spiral_outward_left,
+ ED_spiral_outward_right,
+
+ ED_vertical,
+ ED_horizontal,
+
+ ED_to_center,
+
+ ED_clockwise,
+ ED_cclockwise
+};
+
+extern SvXMLEnumMapEntry aXML_AnimationDirection_EnumMap[];
+
+extern SvXMLEnumMapEntry aXML_AnimationSpeed_EnumMap[];
+
+void SdXMLImplSetEffect( ::com::sun::star::presentation::AnimationEffect eEffect, XMLEffect& eKind, XMLEffectDirection& eDirection, sal_Int16& nStartScale, sal_Bool& bIn );
+::com::sun::star::presentation::AnimationEffect ImplSdXMLgetEffect( XMLEffect eKind, XMLEffectDirection eDirection, sal_Int16 nStartScale, sal_Bool bIn );
+
+#endif // _XMLOFF_ANIM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/animationexport.hxx b/xmloff/inc/animationexport.hxx
new file mode 100644
index 000000000000..d14f74ad5d0a
--- /dev/null
+++ b/xmloff/inc/animationexport.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_ANIMATIONEXPORT_HXX
+#define _XMLOFF_ANIMATIONEXPORT_HXX
+
+#include <com/sun/star/animations/XAnimationNode.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <xmloff/uniref.hxx>
+
+class SvXMLExport;
+
+namespace xmloff
+{
+class AnimationsExporterImpl;
+
+class AnimationsExporter : public UniRefBase
+{
+ AnimationsExporterImpl* mpImpl;
+
+public:
+ AnimationsExporter( SvXMLExport& rExport, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xPageProps );
+ virtual ~AnimationsExporter();
+
+ void prepare( ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > xRootNode );
+ void exportAnimations( ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > xRootNode );
+};
+
+}
+
+#endif // _XMLOFF_ANIMATIONEXPORT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/animationimport.hxx b/xmloff/inc/animationimport.hxx
new file mode 100644
index 000000000000..f3e5b9456f02
--- /dev/null
+++ b/xmloff/inc/animationimport.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_ANIMATIONIMPORT_HXX
+#define _XMLOFF_ANIMATIONIMPORT_HXX
+
+#include <xmloff/xmlictxt.hxx>
+#include <com/sun/star/animations/XAnimationNode.hpp>
+
+//////////////////////////////////////////////////////////////////////////////
+// presentations:animations
+
+namespace xmloff
+{
+class AnimationsImportHelperImpl;
+
+class AnimationNodeContext : public SvXMLImportContext
+{
+ AnimationsImportHelperImpl* mpHelper;
+ bool mbRootContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > mxNode;
+
+ void init_node( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+public:
+ TYPEINFO();
+
+ AnimationNodeContext(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xParentNode,
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ AnimationsImportHelperImpl* mpImpl = NULL );
+ virtual ~AnimationNodeContext();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+ static void postProcessRootNode( SvXMLImport& rImport, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xPageProps );
+};
+
+}
+
+#endif // _XMLOFF_ANIMATIONIMPORT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/animations.hxx b/xmloff/inc/animations.hxx
new file mode 100644
index 000000000000..b67fd8ea268b
--- /dev/null
+++ b/xmloff/inc/animations.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_ANIMATIONS_HXX
+#define _XMLOFF_ANIMATIONS_HXX
+
+#include <xmloff/xmltoken.hxx>
+
+struct SvXMLEnumMapEntry;
+
+namespace xmloff
+{
+const sal_uInt16 Animations_EnumMap_Fill = 0;
+const sal_uInt16 Animations_EnumMap_FillDefault = 1;
+const sal_uInt16 Animations_EnumMap_Restart = 2;
+const sal_uInt16 Animations_EnumMap_RestartDefault = 3;
+const sal_uInt16 Animations_EnumMap_Endsync = 4;
+const sal_uInt16 Animations_EnumMap_CalcMode = 5;
+const sal_uInt16 Animations_EnumMap_AdditiveMode = 6;
+const sal_uInt16 Animations_EnumMap_TransformType = 7;
+const sal_uInt16 Animations_EnumMap_TransitionType = 8;
+const sal_uInt16 Animations_EnumMap_TransitionSubType = 9;
+const sal_uInt16 Animations_EnumMap_EventTrigger = 10;
+const sal_uInt16 Animations_EnumMap_EffectPresetClass = 11;
+const sal_uInt16 Animations_EnumMap_EffectNodeType = 12;
+const sal_uInt16 Animations_EnumMap_SubItem = 13;
+const sal_uInt16 Animations_EnumMap_IterateType = 14;
+const sal_uInt16 Animations_EnumMap_Command = 15;
+
+extern SvXMLEnumMapEntry* getAnimationsEnumMap( sal_uInt16 nMap );
+
+struct ImplAttributeNameConversion
+{
+ token::XMLTokenEnum meXMLToken;
+ const sal_Char* mpAPIName;
+};
+
+extern struct ImplAttributeNameConversion* getAnimationAttributeNamesConversionList();
+
+}
+
+#endif // _XMLOFF_ANIMATIONS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/animimp.hxx b/xmloff/inc/animimp.hxx
new file mode 100644
index 000000000000..a7a67f5b0d3a
--- /dev/null
+++ b/xmloff/inc/animimp.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_ANIMIMP_HXX
+#define _XMLOFF_ANIMIMP_HXX
+
+#include <xmloff/xmlictxt.hxx>
+#include <com/sun/star/drawing/XShapes.hpp>
+
+class AnimImpImpl;
+
+//////////////////////////////////////////////////////////////////////////////
+// presentations:animations
+
+class XMLAnimationsContext : public SvXMLImportContext
+{
+ AnimImpImpl* mpImpl;
+
+public:
+ TYPEINFO();
+
+ XMLAnimationsContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+ virtual ~XMLAnimationsContext();
+
+ virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+};
+
+#endif // _XMLOFF_ANIMIMP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/forms/form_handler_factory.hxx b/xmloff/inc/forms/form_handler_factory.hxx
new file mode 100644
index 000000000000..8752b8384fef
--- /dev/null
+++ b/xmloff/inc/forms/form_handler_factory.hxx
@@ -0,0 +1,50 @@
+/*************************************************************************
+ * 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 XMLOFF_FORM_HANDLER_FACTORY_HXX
+#define XMLOFF_FORM_HANDLER_FACTORY_HXX
+
+#include "forms/property_handler.hxx"
+
+//......................................................................................................................
+namespace xmloff
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= FormHandlerFactory
+ //==================================================================================================================
+ class FormHandlerFactory
+ {
+ public:
+ static PPropertyHandler getFormPropertyHandler( const PropertyId i_propertyId );
+ };
+
+//......................................................................................................................
+} // namespace xmloff
+//......................................................................................................................
+
+#endif // XMLOFF_FORM_HANDLER_FACTORY_HXX
diff --git a/xmloff/inc/forms/property_handler.hxx b/xmloff/inc/forms/property_handler.hxx
new file mode 100644
index 000000000000..d2675ba58ad0
--- /dev/null
+++ b/xmloff/inc/forms/property_handler.hxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+ * 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 XMLOFF_PROPERTY_HANDLER_HXX
+#define XMLOFF_PROPERTY_HANDLER_HXX
+
+#include "forms/property_ids.hxx"
+
+#include <com/sun/star/uno/Any.hxx>
+
+#include <rtl/ref.hxx>
+
+#include <map>
+#include <vector>
+
+//......................................................................................................................
+namespace xmloff
+{
+//......................................................................................................................
+
+ typedef ::std::map< PropertyId, ::com::sun::star::uno::Any > PropertyValues;
+
+ //==================================================================================================================
+ //= IPropertyHandler
+ //==================================================================================================================
+ class IPropertyHandler : public ::rtl::IReference
+ {
+ public:
+ /** retrieves the XML attribute value for the given property values
+ */
+ virtual ::rtl::OUString
+ getAttributeValue( const PropertyValues& i_propertyValues ) const = 0;
+
+ /** is a convenience method for XML attributes whose value comprises of only one UNO API property
+ */
+ virtual ::rtl::OUString
+ getAttributeValue( const ::com::sun::star::uno::Any& i_propertyValue ) const = 0;
+
+ /** retrieves the values of the properties controlled by an XML attributed, described by a given attribute value
+ */
+ virtual bool
+ getPropertyValues( const ::rtl::OUString i_attributeValue, PropertyValues& o_propertyValues ) const = 0;
+
+ virtual ~IPropertyHandler() { }
+ };
+
+ //==================================================================================================================
+ //= PPropertyHandler
+ //==================================================================================================================
+ typedef ::rtl::Reference< IPropertyHandler > PPropertyHandler;
+
+ //==================================================================================================================
+ //= PropertyHandlerFactory
+ //==================================================================================================================
+ typedef PPropertyHandler (*PropertyHandlerFactory)( const PropertyId i_propertyId );
+
+//......................................................................................................................
+} // namespace xmloff
+//......................................................................................................................
+
+#endif // XMLOFF_PROPERTY_HANDLER_HXX
diff --git a/xmloff/inc/forms/property_ids.hxx b/xmloff/inc/forms/property_ids.hxx
new file mode 100644
index 000000000000..31004f2d9ff2
--- /dev/null
+++ b/xmloff/inc/forms/property_ids.hxx
@@ -0,0 +1,56 @@
+/*************************************************************************
+ * 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 XMLOFF_PROPERTY_IDS_HXX
+#define XMLOFF_PROPERTY_IDS_HXX
+
+//......................................................................................................................
+namespace xmloff
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= PropertyId
+ //==================================================================================================================
+ enum PropertyId
+ {
+ PID_DATE_MIN,
+ PID_DATE_MAX,
+ PID_DEFAULT_DATE,
+ PID_DATE,
+ PID_TIME_MIN,
+ PID_TIME_MAX,
+ PID_DEFAULT_TIME,
+ PID_TIME,
+
+ PID_INVALID
+ };
+
+//......................................................................................................................
+} // namespace xmloff
+//......................................................................................................................
+
+#endif // XMLOFF_PROPERTY_IDS_HXX
diff --git a/xmloff/inc/functional.hxx b/xmloff/inc/functional.hxx
new file mode 100644
index 000000000000..6d27da04f742
--- /dev/null
+++ b/xmloff/inc/functional.hxx
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+#ifndef _XMLOFF_FUNCTIONAL_HXX
+#define _XMLOFF_FUNCTIONAL_HXX
+
+#include <rtl/ustring.hxx>
+
+/* THIS HEADER IS DEPRECATED. USE comphelper/stl_types.hxx INSTEAD!!! */
+
+/** @#file
+ *
+ * re-implement STL functors as needed
+ *
+ * The standard comparison operators from the STL cause warnings with
+ * several compilers about our sal_Bool (=unsigned char) being
+ * converted to bool (C++ bool). We wish to avoid that.
+ */
+
+struct less_functor
+{
+ bool operator()(const ::rtl::OUString& x,
+ const ::rtl::OUString& y) const
+ {
+ return 0 != (x<y);
+ }
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/pch/precompiled_xmloff.cxx b/xmloff/inc/pch/precompiled_xmloff.cxx
new file mode 100644
index 000000000000..31570f2a2bb1
--- /dev/null
+++ b/xmloff/inc/pch/precompiled_xmloff.cxx
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_xmloff.hxx"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/pch/precompiled_xmloff.hxx b/xmloff/inc/pch/precompiled_xmloff.hxx
new file mode 100644
index 000000000000..22f11be546ca
--- /dev/null
+++ b/xmloff/inc/pch/precompiled_xmloff.hxx
@@ -0,0 +1,482 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): Generated on 2006-09-01 17:50:21.060744
+
+#ifdef PRECOMPILED_HEADERS
+
+//---MARKER---
+#include "sal/config.h"
+#include "sal/types.h"
+
+#include "com/sun/star/animations/AnimationAdditiveMode.hpp"
+#include "com/sun/star/animations/AnimationCalcMode.hpp"
+#include "com/sun/star/animations/AnimationColorSpace.hpp"
+#include "com/sun/star/animations/AnimationEndSync.hpp"
+#include "com/sun/star/animations/AnimationFill.hpp"
+#include "com/sun/star/animations/AnimationNodeType.hpp"
+#include "com/sun/star/animations/AnimationRestart.hpp"
+#include "com/sun/star/animations/AnimationTransformType.hpp"
+#include "com/sun/star/animations/Event.hpp"
+#include "com/sun/star/animations/EventTrigger.hpp"
+#include "com/sun/star/animations/Timing.hpp"
+#include "com/sun/star/animations/TransitionSubType.hpp"
+#include "com/sun/star/animations/TransitionType.hpp"
+#include "com/sun/star/animations/ValuePair.hpp"
+#include "com/sun/star/animations/XAnimateColor.hpp"
+#include "com/sun/star/animations/XAnimateMotion.hpp"
+#include "com/sun/star/animations/XAnimateSet.hpp"
+#include "com/sun/star/animations/XAnimateTransform.hpp"
+#include "com/sun/star/animations/XAnimationNode.hpp"
+#include "com/sun/star/animations/XAnimationNodeSupplier.hpp"
+#include "com/sun/star/animations/XAudio.hpp"
+#include "com/sun/star/animations/XCommand.hpp"
+#include "com/sun/star/animations/XIterateContainer.hpp"
+#include "com/sun/star/animations/XTransitionFilter.hpp"
+#include "com/sun/star/awt/FontDescriptor.hpp"
+#include "com/sun/star/awt/FontEmphasisMark.hpp"
+#include "com/sun/star/awt/FontFamily.hpp"
+#include "com/sun/star/awt/FontPitch.hpp"
+#include "com/sun/star/awt/FontRelief.hpp"
+#include "com/sun/star/awt/FontSlant.hpp"
+#include "com/sun/star/awt/FontStrikeout.hpp"
+#include "com/sun/star/awt/FontUnderline.hpp"
+#include "com/sun/star/awt/FontWidth.hpp"
+#include "com/sun/star/awt/Gradient.hpp"
+#include "com/sun/star/awt/ImagePosition.hpp"
+#include "com/sun/star/awt/Point.hpp"
+#include "com/sun/star/awt/Rectangle.hdl"
+#include "com/sun/star/awt/Rectangle.hpp"
+#include "com/sun/star/awt/ScrollBarOrientation.hpp"
+#include "com/sun/star/awt/Size.hpp"
+#include "com/sun/star/awt/TextAlign.hpp"
+#include "com/sun/star/awt/VisualEffect.hpp"
+#include "com/sun/star/awt/XBitmap.hpp"
+#include "com/sun/star/awt/XControlModel.hpp"
+#include "com/sun/star/beans/NamedValue.hpp"
+#include "com/sun/star/beans/PropertyAttribute.hpp"
+#include "com/sun/star/beans/PropertyState.hpp"
+#include "com/sun/star/beans/PropertyValue.hpp"
+#include "com/sun/star/beans/PropertyValues.hpp"
+#include "com/sun/star/beans/PropertyVetoException.hpp"
+#include "com/sun/star/beans/TolerantPropertySetResultType.hpp"
+#include "com/sun/star/beans/UnknownPropertyException.hpp"
+#include "com/sun/star/beans/XMultiPropertySet.hpp"
+#include "com/sun/star/beans/XMultiPropertyStates.hpp"
+#include "com/sun/star/beans/XPropertyContainer.hpp"
+#include "com/sun/star/beans/XPropertySet.hpp"
+#include "com/sun/star/beans/XPropertySetInfo.hpp"
+#include "com/sun/star/beans/XPropertyState.hpp"
+#include "com/sun/star/beans/XTolerantMultiPropertySet.hpp"
+#include "com/sun/star/chart/ChartAxisArrangeOrderType.hpp"
+#include "com/sun/star/chart/ChartAxisAssign.hpp"
+#include "com/sun/star/chart/ChartAxisMarks.hpp"
+#include "com/sun/star/chart/ChartDataCaption.hpp"
+#include "com/sun/star/chart/ChartDataRowSource.hpp"
+#include "com/sun/star/chart/ChartErrorCategory.hpp"
+#include "com/sun/star/chart/ChartErrorIndicatorType.hpp"
+#include "com/sun/star/chart/ChartLegendPosition.hpp"
+#include "com/sun/star/chart/ChartRegressionCurveType.hpp"
+#include "com/sun/star/chart/ChartSeriesAddress.hpp"
+#include "com/sun/star/chart/ChartSolidType.hpp"
+#include "com/sun/star/chart/ChartSymbolType.hpp"
+#include "com/sun/star/chart/X3DDisplay.hpp"
+#include "com/sun/star/chart/XAxisZSupplier.hpp"
+#include "com/sun/star/chart/XChartDataArray.hpp"
+#include "com/sun/star/chart/XChartDocument.hpp"
+#include "com/sun/star/chart/XDiagram.hpp"
+#include "com/sun/star/chart/XSecondAxisTitleSupplier.hpp"
+#include "com/sun/star/chart/XStatisticDisplay.hpp"
+#include "com/sun/star/chart/XTwoAxisXSupplier.hpp"
+#include "com/sun/star/chart/XTwoAxisYSupplier.hpp"
+#include "com/sun/star/container/XChild.hpp"
+#include "com/sun/star/container/XContentEnumerationAccess.hpp"
+#include "com/sun/star/container/XEnumeration.hpp"
+#include "com/sun/star/container/XEnumerationAccess.hpp"
+#include "com/sun/star/container/XIdentifierAccess.hpp"
+#include "com/sun/star/container/XIdentifierContainer.hpp"
+#include "com/sun/star/container/XIndexAccess.hpp"
+#include "com/sun/star/container/XIndexContainer.hpp"
+#include "com/sun/star/container/XIndexReplace.hpp"
+#include "com/sun/star/container/XNameAccess.hpp"
+#include "com/sun/star/container/XNameContainer.hpp"
+#include "com/sun/star/container/XNameReplace.hpp"
+#include "com/sun/star/container/XNamed.hpp"
+#include "com/sun/star/container/XSet.hpp"
+#include "com/sun/star/document/PrinterIndependentLayout.hpp"
+#include "com/sun/star/document/XActionLockable.hpp"
+#include "com/sun/star/document/XBinaryStreamResolver.hpp"
+#include "com/sun/star/document/XDocumentInfo.hpp"
+#include "com/sun/star/document/XDocumentInfoSupplier.hpp"
+#include "com/sun/star/document/XDocumentRevisionListPersistence.hpp"
+#include "com/sun/star/document/XEmbeddedObjectResolver.hpp"
+#include "com/sun/star/document/XEmbeddedObjectSupplier.hpp"
+#include "com/sun/star/document/XEventsSupplier.hpp"
+#include "com/sun/star/document/XExporter.hpp"
+#include "com/sun/star/document/XFilter.hpp"
+#include "com/sun/star/document/XGraphicObjectResolver.hpp"
+#include "com/sun/star/document/XImporter.hpp"
+#include "com/sun/star/document/XRedlinesSupplier.hpp"
+#include "com/sun/star/document/XViewDataSupplier.hpp"
+#include "com/sun/star/drawing/Alignment.hpp"
+#include "com/sun/star/drawing/BitmapMode.hpp"
+#include "com/sun/star/drawing/CameraGeometry.hpp"
+#include "com/sun/star/drawing/CircleKind.hpp"
+#include "com/sun/star/drawing/ColorMode.hpp"
+#include "com/sun/star/drawing/ConnectorType.hpp"
+#include "com/sun/star/drawing/DashStyle.hpp"
+#include "com/sun/star/drawing/Direction3D.hpp"
+#include "com/sun/star/drawing/DoubleSequence.hpp"
+#include "com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp"
+#include "com/sun/star/drawing/EnhancedCustomShapeGluePointType.hpp"
+#include "com/sun/star/drawing/EnhancedCustomShapeParameter.hpp"
+#include "com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp"
+#include "com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp"
+#include "com/sun/star/drawing/EnhancedCustomShapeSegment.hpp"
+#include "com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp"
+#include "com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp"
+#include "com/sun/star/drawing/EnhancedCustomShapeTextPathMode.hpp"
+#include "com/sun/star/drawing/EscapeDirection.hpp"
+#include "com/sun/star/drawing/FillStyle.hpp"
+#include "com/sun/star/drawing/FlagSequence.hpp"
+#include "com/sun/star/drawing/FlagSequenceSequence.hpp"
+#include "com/sun/star/drawing/GluePoint2.hpp"
+#include "com/sun/star/drawing/Hatch.hpp"
+#include "com/sun/star/drawing/HomogenMatrix.hpp"
+#include "com/sun/star/drawing/HomogenMatrix3.hpp"
+#include "com/sun/star/drawing/LineDash.hpp"
+#include "com/sun/star/drawing/LineJoint.hpp"
+#include "com/sun/star/drawing/LineStyle.hpp"
+#include "com/sun/star/drawing/MeasureTextHorzPos.hpp"
+#include "com/sun/star/drawing/MeasureTextVertPos.hpp"
+#include "com/sun/star/drawing/NormalsKind.hpp"
+#include "com/sun/star/drawing/PointSequence.hpp"
+#include "com/sun/star/drawing/PointSequenceSequence.hpp"
+#include "com/sun/star/drawing/PolyPolygonBezierCoords.hpp"
+#include "com/sun/star/drawing/PolyPolygonShape3D.hpp"
+#include "com/sun/star/drawing/Position3D.hpp"
+#include "com/sun/star/drawing/ProjectionMode.hpp"
+#include "com/sun/star/drawing/RectanglePoint.hpp"
+#include "com/sun/star/drawing/ShadeMode.hpp"
+#include "com/sun/star/drawing/TextAnimationDirection.hpp"
+#include "com/sun/star/drawing/TextAnimationKind.hpp"
+#include "com/sun/star/drawing/TextFitToSizeType.hpp"
+#include "com/sun/star/drawing/TextHorizontalAdjust.hpp"
+#include "com/sun/star/drawing/TextVerticalAdjust.hpp"
+#include "com/sun/star/drawing/TextureKind.hpp"
+#include "com/sun/star/drawing/TextureMode.hpp"
+#include "com/sun/star/drawing/TextureProjectionMode.hpp"
+#include "com/sun/star/drawing/XControlShape.hpp"
+#include "com/sun/star/drawing/XCustomShapeEngine.hpp"
+#include "com/sun/star/drawing/XDrawPage.hpp"
+#include "com/sun/star/drawing/XDrawPageSupplier.hpp"
+#include "com/sun/star/drawing/XDrawPages.hpp"
+#include "com/sun/star/drawing/XDrawPagesSupplier.hpp"
+#include "com/sun/star/drawing/XGluePointsSupplier.hpp"
+#include "com/sun/star/drawing/XLayerManager.hpp"
+#include "com/sun/star/drawing/XLayerSupplier.hpp"
+#include "com/sun/star/drawing/XMasterPageTarget.hpp"
+#include "com/sun/star/drawing/XMasterPagesSupplier.hpp"
+#include "com/sun/star/drawing/XShape.hpp"
+#include "com/sun/star/drawing/XShapes.hpp"
+#include "com/sun/star/embed/ElementModes.hpp"
+#include "com/sun/star/embed/XStorage.hpp"
+#include "com/sun/star/form/FormButtonType.hpp"
+#include "com/sun/star/form/FormComponentType.hpp"
+#include "com/sun/star/form/FormSubmitEncoding.hpp"
+#include "com/sun/star/form/FormSubmitMethod.hpp"
+#include "com/sun/star/form/ListSourceType.hpp"
+#include "com/sun/star/form/NavigationBarMode.hpp"
+#include "com/sun/star/form/TabulatorCycle.hpp"
+#include "com/sun/star/form/XForm.hpp"
+#include "com/sun/star/form/XFormsSupplier.hpp"
+#include "com/sun/star/form/XFormsSupplier2.hpp"
+#include "com/sun/star/form/XGridColumnFactory.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/form/submission/XSubmission.hpp"
+#include "com/sun/star/form/submission/XSubmissionSupplier.hpp"
+#include "com/sun/star/formula/SymbolDescriptor.hpp"
+#include "com/sun/star/frame/XModel.hpp"
+#include "com/sun/star/frame/XStorable.hpp"
+#include "com/sun/star/i18n/NativeNumberXmlAttributes.hpp"
+#include "com/sun/star/i18n/UnicodeType.hpp"
+#include "com/sun/star/i18n/XCharacterClassification.hpp"
+#include "com/sun/star/i18n/XForbiddenCharacters.hpp"
+#include "com/sun/star/io/XActiveDataSource.hpp"
+#include "com/sun/star/io/XInputStream.hpp"
+#include "com/sun/star/io/XOutputStream.hpp"
+#include "com/sun/star/io/XPersistObject.hpp"
+#include "com/sun/star/lang/IllegalArgumentException.hpp"
+#include "com/sun/star/lang/Locale.hpp"
+#include "com/sun/star/lang/ServiceNotRegisteredException.hpp"
+#include "com/sun/star/lang/WrappedTargetException.hpp"
+#include "com/sun/star/lang/XEventListener.hpp"
+#include "com/sun/star/lang/XInitialization.hpp"
+#include "com/sun/star/lang/XMultiServiceFactory.hpp"
+#include "com/sun/star/lang/XServiceInfo.hpp"
+#include "com/sun/star/lang/XSingleServiceFactory.hpp"
+#include "com/sun/star/lang/XTypeProvider.hpp"
+#include "com/sun/star/lang/XUnoTunnel.hpp"
+#include "com/sun/star/linguistic2/XSupportedLocales.hpp"
+#include "com/sun/star/media/ZoomLevel.hpp"
+#include "com/sun/star/presentation/AnimationEffect.hpp"
+#include "com/sun/star/presentation/AnimationSpeed.hpp"
+#include "com/sun/star/presentation/ClickAction.hpp"
+#include "com/sun/star/presentation/EffectCommands.hpp"
+#include "com/sun/star/presentation/EffectNodeType.hpp"
+#include "com/sun/star/presentation/EffectPresetClass.hpp"
+#include "com/sun/star/presentation/FadeEffect.hpp"
+#include "com/sun/star/presentation/ParagraphTarget.hpp"
+#include "com/sun/star/presentation/ShapeAnimationSubType.hpp"
+#include "com/sun/star/presentation/TextAnimationType.hpp"
+#include "com/sun/star/presentation/XCustomPresentationSupplier.hpp"
+#include "com/sun/star/presentation/XHandoutMasterSupplier.hpp"
+#include "com/sun/star/presentation/XPresentationPage.hpp"
+#include "com/sun/star/presentation/XPresentationSupplier.hpp"
+#include "com/sun/star/registry/XRegistryKey.hpp"
+#include "com/sun/star/script/ScriptEventDescriptor.hpp"
+#include "com/sun/star/script/XEventAttacherManager.hpp"
+#include "com/sun/star/sdb/CommandType.hpp"
+#include "com/sun/star/sheet/XSpreadsheetDocument.hpp"
+#include "com/sun/star/style/BreakType.hpp"
+#include "com/sun/star/style/CaseMap.hpp"
+#include "com/sun/star/style/DropCapFormat.hpp"
+#include "com/sun/star/style/GraphicLocation.hpp"
+#include "com/sun/star/style/LineNumberPosition.hpp"
+#include "com/sun/star/style/LineSpacing.hpp"
+#include "com/sun/star/style/LineSpacingMode.hpp"
+#include "com/sun/star/style/NumberingType.hpp"
+#include "com/sun/star/style/PageStyleLayout.hpp"
+#include "com/sun/star/style/ParagraphAdjust.hpp"
+#include "com/sun/star/style/ParagraphStyleCategory.hpp"
+#include "com/sun/star/style/TabAlign.hpp"
+#include "com/sun/star/style/TabStop.hpp"
+#include "com/sun/star/style/VerticalAlignment.hpp"
+#include "com/sun/star/style/XStyle.hpp"
+#include "com/sun/star/style/XStyleFamiliesSupplier.hpp"
+#include "com/sun/star/table/BorderLine.hpp"
+#include "com/sun/star/table/CellAddress.hpp"
+#include "com/sun/star/table/CellRangeAddress.hpp"
+#include "com/sun/star/table/ShadowFormat.hpp"
+#include "com/sun/star/table/XCellRange.hpp"
+#include "com/sun/star/task/XStatusIndicator.hpp"
+#include "com/sun/star/task/XStatusIndicatorSupplier.hpp"
+#include "com/sun/star/text/BibliographyDataField.hpp"
+#include "com/sun/star/text/BibliographyDataType.hpp"
+#include "com/sun/star/text/ChapterFormat.hpp"
+#include "com/sun/star/text/ControlCharacter.hpp"
+#include "com/sun/star/text/FilenameDisplayFormat.hpp"
+#include "com/sun/star/text/FontEmphasis.hpp"
+#include "com/sun/star/text/FontRelief.hpp"
+#include "com/sun/star/text/FootnoteNumbering.hpp"
+#include "com/sun/star/text/GraphicCrop.hpp"
+#include "com/sun/star/text/HoriOrientation.hpp"
+#include "com/sun/star/text/HorizontalAdjust.hpp"
+#include "com/sun/star/text/PageNumberType.hpp"
+#include "com/sun/star/text/ParagraphVertAlign.hpp"
+#include "com/sun/star/text/PlaceholderType.hpp"
+#include "com/sun/star/text/PositionLayoutDir.hpp"
+#include "com/sun/star/text/ReferenceFieldPart.hpp"
+#include "com/sun/star/text/ReferenceFieldSource.hpp"
+#include "com/sun/star/text/RelOrientation.hpp"
+#include "com/sun/star/text/RubyAdjust.hpp"
+#include "com/sun/star/text/SectionFileLink.hpp"
+#include "com/sun/star/text/SetVariableType.hpp"
+#include "com/sun/star/text/SizeType.hpp"
+#include "com/sun/star/text/TemplateDisplayFormat.hpp"
+#include "com/sun/star/text/TextColumn.hpp"
+#include "com/sun/star/text/TextContentAnchorType.hpp"
+#include "com/sun/star/text/TextGridMode.hpp"
+#include "com/sun/star/text/UserDataPart.hpp"
+#include "com/sun/star/text/VertOrientation.hpp"
+#include "com/sun/star/text/WrapInfluenceOnPosition.hpp"
+#include "com/sun/star/text/WrapTextMode.hpp"
+#include "com/sun/star/text/WritingMode.hpp"
+#include "com/sun/star/text/WritingMode2.hpp"
+#include "com/sun/star/text/XChapterNumberingSupplier.hpp"
+#include "com/sun/star/text/XDependentTextField.hpp"
+#include "com/sun/star/text/XDocumentIndex.hpp"
+#include "com/sun/star/text/XEndnotesSupplier.hpp"
+#include "com/sun/star/text/XFootnote.hpp"
+#include "com/sun/star/text/XFootnotesSupplier.hpp"
+#include "com/sun/star/text/XLineNumberingProperties.hpp"
+#include "com/sun/star/text/XNumberingTypeInfo.hpp"
+#include "com/sun/star/text/XRelativeTextContentInsert.hpp"
+#include "com/sun/star/text/XRelativeTextContentRemove.hpp"
+#include "com/sun/star/text/XText.hpp"
+#include "com/sun/star/text/XTextColumns.hpp"
+#include "com/sun/star/text/XTextContent.hpp"
+#include "com/sun/star/text/XTextCursor.hpp"
+#include "com/sun/star/text/XTextDocument.hpp"
+#include "com/sun/star/text/XTextEmbeddedObjectsSupplier.hpp"
+#include "com/sun/star/text/XTextField.hpp"
+#include "com/sun/star/text/XTextFieldsSupplier.hpp"
+#include "com/sun/star/text/XTextFrame.hpp"
+#include "com/sun/star/text/XTextFramesSupplier.hpp"
+#include "com/sun/star/text/XTextGraphicObjectsSupplier.hpp"
+#include "com/sun/star/text/XTextRange.hpp"
+#include "com/sun/star/text/XTextRangeCompare.hpp"
+#include "com/sun/star/text/XTextSection.hpp"
+#include "com/sun/star/text/XTextShapesSupplier.hpp"
+#include "com/sun/star/ucb/XAnyCompare.hpp"
+#include "com/sun/star/ucb/XAnyCompareFactory.hpp"
+#include "com/sun/star/uno/Any.hxx"
+#include "com/sun/star/uno/Exception.hpp"
+#include "com/sun/star/uno/Reference.h"
+#include "com/sun/star/uno/Reference.hxx"
+#include "com/sun/star/uno/Sequence.h"
+#include "com/sun/star/uno/Sequence.hxx"
+#include "com/sun/star/uno/Type.h"
+#include "com/sun/star/uno/Type.hxx"
+#include "com/sun/star/uno/XInterface.hpp"
+#include "com/sun/star/uri/XUriReferenceFactory.hpp"
+#include "com/sun/star/uri/XVndSunStarScriptUrl.hpp"
+#include "com/sun/star/util/Date.hpp"
+#include "com/sun/star/util/DateTime.hpp"
+#include "com/sun/star/util/NumberFormat.hpp"
+#include "com/sun/star/util/RevisionTag.hpp"
+#include "com/sun/star/util/Time.hpp"
+#include "com/sun/star/util/XCloneable.hpp"
+#include "com/sun/star/util/XModifiable.hpp"
+#include "com/sun/star/util/XNumberFormats.hpp"
+#include "com/sun/star/util/XNumberFormatsSupplier.hpp"
+#include "com/sun/star/util/XStringMapping.hpp"
+#include "com/sun/star/util/XStringSubstitution.hpp"
+#include "com/sun/star/util/XUpdatable.hpp"
+#include "com/sun/star/view/PaperOrientation.hpp"
+#include "com/sun/star/xforms/XDataTypeRepository.hpp"
+#include "com/sun/star/xforms/XFormsSupplier.hpp"
+#include "com/sun/star/xforms/XModel.hpp"
+#include "com/sun/star/xml/AttributeData.hpp"
+#include "com/sun/star/xml/dom/NodeType.hpp"
+#include "com/sun/star/xml/dom/XAttr.hpp"
+#include "com/sun/star/xml/dom/XDocument.hpp"
+#include "com/sun/star/xml/dom/XDocumentBuilder.hpp"
+#include "com/sun/star/xml/dom/XElement.hpp"
+#include "com/sun/star/xml/dom/XEntity.hpp"
+#include "com/sun/star/xml/dom/XNamedNodeMap.hpp"
+#include "com/sun/star/xml/dom/XNode.hpp"
+#include "com/sun/star/xml/dom/XNotation.hpp"
+#include "com/sun/star/xml/sax/InputSource.hpp"
+#include "com/sun/star/xml/sax/SAXException.hpp"
+#include "com/sun/star/xml/sax/SAXInvalidCharacterException.hpp"
+#include "com/sun/star/xml/sax/SAXParseException.hpp"
+#include "com/sun/star/xml/sax/XAttributeList.hpp"
+#include "com/sun/star/xml/sax/XDocumentHandler.hpp"
+#include "com/sun/star/xml/sax/XExtendedDocumentHandler.hpp"
+#include "com/sun/star/xml/sax/XLocator.hpp"
+#include "com/sun/star/xml/sax/XParser.hpp"
+#include "com/sun/star/xsd/DataTypeClass.hpp"
+#include "com/sun/star/xsd/WhiteSpaceTreatment.hpp"
+#include "com/sun/star/xsd/XDataType.hpp"
+
+#include "comphelper/genericpropertyset.hxx"
+#include "comphelper/namecontainer.hxx"
+#include "comphelper/processfactory.hxx"
+#include "comphelper/sequence.hxx"
+#include "comphelper/stl_types.hxx"
+#include "comphelper/types.hxx"
+
+#include "cppuhelper/factory.hxx"
+#include "cppuhelper/implbase1.hxx"
+#include "cppuhelper/implbase2.hxx"
+#include "cppuhelper/implbase3.hxx"
+#include "cppuhelper/implbase4.hxx"
+#include "cppuhelper/implbase6.hxx"
+#include "cppuhelper/weak.hxx"
+#include "cppuhelper/weakref.hxx"
+
+#include "i18npool/lang.h"
+#include "i18npool/mslangid.hxx"
+
+#include "osl/diagnose.h"
+#include "osl/interlck.h"
+#include "osl/mutex.hxx"
+
+#include "rsc/rscsfx.hxx"
+
+#include "rtl/logfile.hxx"
+#include "rtl/math.hxx"
+#include "rtl/memory.h"
+#include "rtl/ustrbuf.hxx"
+#include "rtl/ustring.hxx"
+#include "rtl/uuid.h"
+
+#include "salhelper/simplereferenceobject.hxx"
+
+#include "sot/clsids.hxx"
+
+#include "svl/cntnrsrt.hxx"
+#include "svl/itemset.hxx"
+#include "unotools/moduleoptions.hxx"
+#include "svl/nfsymbol.hxx"
+#include "svl/numuno.hxx"
+#include "svl/poolitem.hxx"
+#include "svl/svarray.hxx"
+#include "svl/svstdarr.hxx"
+#include "svl/urihelper.hxx"
+
+
+#include "tools/bigint.hxx"
+#include "tools/color.hxx"
+#include "tools/debug.hxx"
+#include "tools/gen.hxx"
+#include "tools/globname.hxx"
+#include "tools/inetdef.hxx"
+#include "tools/ref.hxx"
+#include "tools/rtti.hxx"
+#include "tools/solar.h"
+#include "tools/string.hxx"
+#include "tools/time.hxx"
+#include "tools/urlobj.hxx"
+
+#include "uno/lbnames.h"
+
+#include "unotools/bootstrap.hxx"
+#include "unotools/charclass.hxx"
+#include "unotools/configmgr.hxx"
+#include "unotools/processfactory.hxx"
+#include "unotools/streamwrap.hxx"
+
+#include "tools/fldunit.hxx"
+#include "unotools/fontcvt.hxx"
+#include "tools/mapunit.hxx"
+
+#include "osl/mutex.hxx"
+#include "rtl/ref.hxx"
+#include "salhelper/simplereferenceobject.hxx"
+
+#include "xmloff/dllapi.h"
+//---MARKER---
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/txtflde.hxx b/xmloff/inc/txtflde.hxx
new file mode 100644
index 000000000000..2c94703596ea
--- /dev/null
+++ b/xmloff/inc/txtflde.hxx
@@ -0,0 +1,549 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+/** @#file
+ * XML export of all text fields
+ */
+
+#ifndef _XMLOFF_TXTFLDE_HXX
+#define _XMLOFF_TXTFLDE_HXX
+
+#include <com/sun/star/uno/Reference.h>
+#include "xmloff/xmlnmspe.hxx"
+
+#include <rtl/ustring.hxx>
+#include <xmloff/xmltoken.hxx>
+
+#include <map>
+#include <set>
+
+
+class SvXMLExport;
+class SvXMLNumFmtExport;
+struct XMLPropertyState;
+
+namespace com { namespace sun { namespace star {
+ namespace util { struct DateTime; }
+ namespace util { struct Date; }
+ namespace text { class XTextField; }
+ namespace text { class XText; }
+ namespace beans { class XPropertySet; }
+ namespace beans { class XPropertySetInfo; }
+ namespace frame { class XModel; }
+ namespace uno { template<typename A> class Sequence; }
+} } }
+namespace rtl { class OUString; }
+
+
+/// field IDs,
+// including translation between UNO speak and XML speak if appropriate
+
+enum FieldIdEnum {
+ FIELD_ID_SENDER, // sender == extended user
+ FIELD_ID_AUTHOR,
+ FIELD_ID_DATE, // current date
+ FIELD_ID_TIME, // current time (+date)
+ FIELD_ID_PAGENUMBER, // page number
+ FIELD_ID_PAGESTRING, // page contination string (page number string)
+ FIELD_ID_REFPAGE_SET, // set reference page
+ FIELD_ID_REFPAGE_GET, // get reference page number
+
+ FIELD_ID_PLACEHOLDER, // placeholder field == jump edit field
+
+ FIELD_ID_VARIABLE_DECL, // field type for set variable
+ FIELD_ID_VARIABLE_GET, // get variable == get expression
+ FIELD_ID_VARIABLE_SET, // set variable == set expression
+ FIELD_ID_VARIABLE_INPUT, // input field (variable)
+ FIELD_ID_USER_DECL, // field type for user field
+ FIELD_ID_USER_GET, // user field
+ FIELD_ID_USER_INPUT, // input field (user field)
+ FIELD_ID_TEXT_INPUT, // input field (text)
+ FIELD_ID_EXPRESSION, // expression field = formula field
+ FIELD_ID_SEQUENCE_DECL, // field type for sequence
+ FIELD_ID_SEQUENCE, // sequence field
+
+ FIELD_ID_DATABASE_NEXT, // select next row
+ FIELD_ID_DATABASE_SELECT, // select row # (NumSet)
+ FIELD_ID_DATABASE_DISPLAY, // display data (form letter field)
+ FIELD_ID_DATABASE_NAME, // display current db name (database name)
+ FIELD_ID_DATABASE_NUMBER, // display row # (SetNumber)
+
+ FIELD_ID_DOCINFO_CREATION_AUTHOR, // docinfo fields
+ FIELD_ID_DOCINFO_CREATION_TIME,
+ FIELD_ID_DOCINFO_CREATION_DATE,
+ FIELD_ID_DOCINFO_DESCRIPTION,
+ FIELD_ID_DOCINFO_CUSTOM,
+ FIELD_ID_DOCINFO_PRINT_TIME,
+ FIELD_ID_DOCINFO_PRINT_DATE,
+ FIELD_ID_DOCINFO_PRINT_AUTHOR,
+ FIELD_ID_DOCINFO_TITLE,
+ FIELD_ID_DOCINFO_SUBJECT,
+ FIELD_ID_DOCINFO_KEYWORDS,
+ FIELD_ID_DOCINFO_REVISION,
+ FIELD_ID_DOCINFO_EDIT_DURATION,
+ FIELD_ID_DOCINFO_SAVE_TIME,
+ FIELD_ID_DOCINFO_SAVE_DATE,
+ FIELD_ID_DOCINFO_SAVE_AUTHOR,
+
+ FIELD_ID_CONDITIONAL_TEXT, // conditionally choose between 2 texts
+ FIELD_ID_HIDDEN_TEXT, // conditionally hide a text
+ FIELD_ID_HIDDEN_PARAGRAPH, // conditionally hide a paragraph
+
+ FIELD_ID_TEMPLATE_NAME, // display name of template
+ FIELD_ID_CHAPTER, // display name/number of current chapter
+ FIELD_ID_FILE_NAME, // display name of current file
+
+ FIELD_ID_COUNT_PARAGRAPHS, // statistics fields: - paragraphs
+ FIELD_ID_COUNT_WORDS, // - words
+ FIELD_ID_COUNT_CHARACTERS, // - chars
+ FIELD_ID_COUNT_PAGES, // - pages
+ FIELD_ID_COUNT_TABLES, // - tables
+ FIELD_ID_COUNT_GRAPHICS, // - graphics
+ FIELD_ID_COUNT_OBJECTS, // - objects
+
+ FIELD_ID_MACRO, // macro fields
+ FIELD_ID_REF_REFERENCE, // get reference field (reference)
+ FIELD_ID_REF_SEQUENCE, // get reference field (sequence)
+ FIELD_ID_REF_BOOKMARK, // get reference field (bookmark)
+ FIELD_ID_REF_FOOTNOTE, // get reference field (footnote)
+ FIELD_ID_REF_ENDNOTE, // get reference field (endnote)
+ FIELD_ID_DDE, // DDE field
+
+ FIELD_ID_BIBLIOGRAPHY, // bibliography index entry
+
+ FIELD_ID_SHEET_NAME, // name of current (spread-)sheet
+ FIELD_ID_URL, // URL field (only Calc, Draw, Impress)
+
+ FIELD_ID_SCRIPT, // script fields (for HTML pages, mostly)
+ FIELD_ID_ANNOTATION, // annotation (notice) field
+
+ FIELD_ID_COMBINED_CHARACTERS, // combined characters (asian typography)
+
+ FIELD_ID_META, // text:meta-field (RDF metadata)
+
+ FIELD_ID_MEASURE, // for measure shapes
+
+ FIELD_ID_TABLE_FORMULA, // DEPRECATED: table formulas (Writer 2.0)
+ FIELD_ID_DROP_DOWN, // DEPRECATED: dropdown fields (WW8)
+
+ FIELD_ID_DRAW_HEADER,
+ FIELD_ID_DRAW_FOOTER,
+ FIELD_ID_DRAW_DATE_TIME,
+
+ FIELD_ID_UNKNOWN // invalid or unknown field type!
+};
+
+
+
+class XMLTextFieldExport
+{
+ SvXMLExport& rExport;
+
+ /// store used text field master names (NULL means: don't collect)
+ ::std::map<
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >,
+ ::std::set< ::rtl::OUString > > *
+ pUsedMasters;
+
+public:
+
+ XMLTextFieldExport( SvXMLExport& rExp,
+ /// XMLPropertyState for the combined characters field
+ XMLPropertyState* pCombinedCharState = NULL );
+ virtual ~XMLTextFieldExport();
+
+ /// Export this field and the surrounding span element with the formatting.
+ /// To be called for every field in the document body.
+ void ExportField(const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextField > & rTextField,
+ sal_Bool bProgress );
+
+ /// collect styles (character styles, data styles, ...) for this field
+ /// (if appropriate).
+ /// Also collect used field masters (if pUsedMasters is set)
+ /// to be called for every field during style export.
+ void ExportFieldAutoStyle(const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextField > & rTextField,
+ const sal_Bool bProgress, const sal_Bool bRecursive );
+
+ /// export field declarations.
+ /// to be called once at beginning of document body.
+ void ExportFieldDeclarations();
+
+ /// export field declarations for fields used in the the particular XText.
+ /// (Requires that a list of used field declarations has previously been
+ /// built-up in ExportFieldAutoStyle() )
+ void ExportFieldDeclarations(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XText > & rText);
+
+ /// export all field declarations, or only those that have been used?
+ /// Calling this method will reset the list of used field declataions.
+ void SetExportOnlyUsedFieldDeclarations(
+ sal_Bool bExportOnlyUsed = sal_True);
+
+ // determine element or attribute names
+ // (public, because they may be useful in related XML export classes)
+ static enum ::xmloff::token::XMLTokenEnum MapPlaceholderType(sal_uInt16 nType);
+ static enum ::xmloff::token::XMLTokenEnum MapTemplateDisplayFormat(sal_Int16 nType);
+ static enum ::xmloff::token::XMLTokenEnum MapChapterDisplayFormat(sal_Int16 nType);
+ static enum ::xmloff::token::XMLTokenEnum MapFilenameDisplayFormat(sal_Int16 nType);
+ static enum ::xmloff::token::XMLTokenEnum MapDocInfoFieldName(enum FieldIdEnum nToken);
+ static enum ::xmloff::token::XMLTokenEnum MapReferenceSource(sal_Int16 nType);
+ static enum ::xmloff::token::XMLTokenEnum MapReferenceType(sal_Int16 nType);
+ static enum ::xmloff::token::XMLTokenEnum MapCountFieldName(FieldIdEnum nToken);
+ static enum ::xmloff::token::XMLTokenEnum MapBibliographyFieldName(::rtl::OUString sName);
+ static enum ::xmloff::token::XMLTokenEnum MapMeasureKind(sal_Int16 nKind);
+ enum ::xmloff::token::XMLTokenEnum MapPageNumberName(const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropSet,
+ sal_Int32& nOffset); /// also adjust page offset
+ enum ::xmloff::token::XMLTokenEnum MapAuthorFieldName(const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & xPropSet);
+ enum ::xmloff::token::XMLTokenEnum MapSenderFieldName(const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & xPropSet);
+
+protected:
+
+ SvXMLExport& GetExport() { return rExport; }
+
+ /// export a field after <text:span> is already written
+ void ExportFieldHelper(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextField> & rTextField,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rRangePropSet,
+ enum FieldIdEnum nToken,
+ sal_Bool bProgress );
+
+ /// export an empty element
+ void ExportElement(enum ::xmloff::token::XMLTokenEnum eElement, /// element token
+ sal_Bool bAddSpace = sal_False); /// add blanks around
+ /// element?
+
+ /// export an element with string content
+ void ExportElement(enum ::xmloff::token::XMLTokenEnum eElement, /// element token
+ const ::rtl::OUString& sContent, /// element content
+ sal_Bool bAddSpace = sal_False); /// add blanks around
+ /// element?
+
+ /// export a macro (as used in the macro field)
+ void ExportMacro( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet,
+ const ::rtl::OUString& rContent);
+
+ /// export text:meta-field (RDF metadata)
+ void ExportMetaField( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & i_xMeta,
+ bool i_bAutoStyles, sal_Bool i_bProgress );
+
+ /// export a boolean attribute
+ void ProcessBoolean(
+ enum ::xmloff::token::XMLTokenEnum eXmlName, /// attribute token (namespace text)
+ sal_Bool bBool, /// attribute value
+ sal_Bool bDefault); /// attribute default; omit, if attribute differs
+
+ /// export an integer attribute
+ void ProcessInteger(
+ enum ::xmloff::token::XMLTokenEnum eXmlName, /// attribute token (namespace text)
+ sal_Int32 nNum); /// attribute value
+
+ /// export an integer attribute, omit if default
+ void ProcessIntegerDef(
+ enum ::xmloff::token::XMLTokenEnum eXmlName, /// attribute token (namespace text)
+ sal_Int32 nNum, /// attribute value
+ sal_Int32 nDefault); /// default value
+
+ /// export a string attribute
+ void ProcessString(
+ enum ::xmloff::token::XMLTokenEnum eXmlName, /// attribute token (namespace text)
+ const ::rtl::OUString& sValue, /// attribute value
+ sal_Bool bOmitEmpty = sal_False, /// omit attribute, if value is empty
+ sal_uInt16 nPrefix = XML_NAMESPACE_TEXT); /// attribute name prefix
+
+ /// export a string attribute taht gets a QName value
+ void ProcessString(
+ enum ::xmloff::token::XMLTokenEnum eXmlName, /// attribute token (namespace text)
+ sal_uInt16 nValuePrefix,
+ const ::rtl::OUString& sValue, /// attribute value
+ sal_Bool bOmitEmpty = sal_False, /// omit attribute, if value is empty
+ sal_uInt16 nPrefix = XML_NAMESPACE_TEXT); /// attribute name prefix
+
+
+ /// export a string attribute, omit if default
+ void ProcessString(
+ enum ::xmloff::token::XMLTokenEnum eXmlName, /// attribute token (namespace text)
+ const ::rtl::OUString& sValue, /// attribute value
+ const ::rtl::OUString& sDefault, /// default value; omit if equal
+ sal_uInt16 nPrefix = XML_NAMESPACE_TEXT); /// attribute name prefix
+
+ /// export a string attribute, omit if default
+ void ProcessString(
+ enum ::xmloff::token::XMLTokenEnum eXmlName, /// attribute token (namespace text)
+ sal_uInt16 nValuePrefix,
+ const ::rtl::OUString& sValue, /// attribute value
+ const ::rtl::OUString& sDefault, /// default value; omit if equal
+ sal_uInt16 nPrefix = XML_NAMESPACE_TEXT); /// attribute name prefix
+
+ /// export a string attribute
+ void ProcessString(
+ enum ::xmloff::token::XMLTokenEnum eXmlName, /// attribute token (namespace text)
+ enum ::xmloff::token::XMLTokenEnum eValue, /// attribute token
+ sal_Bool bOmitEmpty = sal_False, /// omit attribute, if value is empty
+ sal_uInt16 nPrefix = XML_NAMESPACE_TEXT); /// attribute name prefix
+
+ /// export a string attribute, omit if default
+ void ProcessString(
+ enum ::xmloff::token::XMLTokenEnum eXmlName, /// attribute token (namespace text)
+ enum ::xmloff::token::XMLTokenEnum eValue, /// attribute value token
+ enum ::xmloff::token::XMLTokenEnum eDefault, /// default value token
+ sal_uInt16 nPrefix = XML_NAMESPACE_TEXT); /// attribute name prefix
+
+ /// export a string as a sequence of paragraphs
+ void ProcessParagraphSequence(
+ /// string containing the paragraphs
+ const ::rtl::OUString& sParagraphSequence);
+
+ /// export a numbering format (numeric, roman, alphabetic, etc.)
+ void ProcessNumberingType(
+ sal_Int16 nNumberingType); /// numbering type key
+
+ /// export display attribute (value, formula, none)
+ void ProcessDisplay(sal_Bool bIsVisible, /// is visible?
+ sal_Bool bIsCommand, /// is show command/show name?
+ sal_Bool bDefault = sal_True); /// omit, if default
+
+ /// export all data-style related attributes
+ void ProcessValueAndType(
+ sal_Bool bIsString, /// do we process a string or a number?
+ sal_Int32 nFormatKey, /// format key for NumberFormatter; possibly -1
+ const ::rtl::OUString& sContent, /// string content; possibly invalid
+ const ::rtl::OUString& sDefault, /// default string
+ double fValue, /// float content; possibly invalid
+ sal_Bool bExportValue, /// export value attribute?
+ sal_Bool bExportValueType, /// export value-type attribute?
+ sal_Bool bExportStyle, /// export style-sttribute?
+ sal_Bool bForceSystemLanguage, /// no style language export
+ sal_Bool bTimeStyle = sal_False); /// exporting a time style?
+
+ /// export times, dates and durations according to ISO 8601
+ void ProcessDateTime(
+ enum ::xmloff::token::XMLTokenEnum eXMLName, /// attribute token
+ double dValue, /// date/time value
+ sal_Bool bIsDate, /// export as date (rather than date/time)?
+ sal_Bool bIsDuration = sal_False, /// export as duration
+ sal_Bool bOmitDurationIfZero = sal_True, /// omit zero-length durat.
+ sal_uInt16 nPrefix = XML_NAMESPACE_TEXT); /// attribute name prefix
+
+ /// export a date, time, or duration
+ void ProcessDateTime(
+ enum ::xmloff::token::XMLTokenEnum eXMLName, /// attribute token
+ sal_Int32 nMinutes, /// date/time value in minutes
+ sal_Bool bIsDate, /// export as date?
+ sal_Bool bIsDuration, /// export as duration?
+ sal_Bool bOmitDurationIfZero, /// omit zero-length durations
+ sal_uInt16 nPrefix = XML_NAMESPACE_TEXT); /// attribute name prefix
+
+ /// export times, dates and durations according to ISO 8601
+ void ProcessDateTime(
+ enum ::xmloff::token::XMLTokenEnum eXMLName, /// attribute token
+ const ::com::sun::star::util::DateTime& rTime, /// date/time value
+ sal_Bool bIsDate, /// export as date (rather than date/time)?
+ sal_uInt16 nPrefix = XML_NAMESPACE_TEXT); /// attribute name prefix
+
+ /// export date according to ISO 8601
+ void ProcessDate(
+ enum ::xmloff::token::XMLTokenEnum eXMLName, /// attribute token
+ const ::com::sun::star::util::Date& rTime, /// date value
+ sal_uInt16 nPrefix = XML_NAMESPACE_TEXT); /// attribute name prefix
+
+ /// export all attributes for bibliography data fields
+ void ProcessBibliographyData(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rPropertySet);
+
+ /// export CommandTypeAttribute
+ void ProcessCommandType(
+ sal_Int32 nCommandType); /// com::sun::star::sdb::CommandType
+
+ void ProcessStringSequence(
+ const ::com::sun::star::uno::Sequence<rtl::OUString>& rSequence,
+ const rtl::OUString sSelected );
+
+ void ProcessStringSequence(
+ const ::com::sun::star::uno::Sequence<rtl::OUString>& rSequence,
+ sal_Int32 nSelected );
+
+ /// export attributes that describe a data source
+ void ExportDataBaseElement(
+ enum ::xmloff::token::XMLTokenEnum eElement,
+ const ::rtl::OUString& sContent,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rPropertySet,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySetInfo > & rPropertySetInfo );
+
+ /// for XDependentTextFields, get PropertySet of FieldMaster
+ ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet >
+ GetMasterPropertySet(const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextField > & rTextField);
+
+ /// get PropertySet of (any) DependentTextField for this FieldMaster
+ sal_Bool GetDependentFieldPropertySet(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xmaster,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xField);
+
+
+ /// get field ID from XTextField (and it's Property-Set)
+ enum FieldIdEnum GetFieldID(const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextField > & rTextField,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & xPropSet);
+
+ /// get field ID from XTextField service name (and it's PropertySet)
+ enum FieldIdEnum MapFieldName(const ::rtl::OUString& sFieldName,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet> & xPropSet);
+
+ /// determine, whether field has string or numeric content
+ sal_Bool IsStringField(FieldIdEnum nFieldType, /// field ID
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & xPropSet);
+
+
+ /// explode a field master name into field type and field name
+ sal_Bool ExplodeFieldMasterName(
+ const ::rtl::OUString& sMasterName, /// name as returned by SO API
+ ::rtl::OUString& sFieldType, /// out: field type
+ ::rtl::OUString& sVarName); /// out: variable name
+
+ /// make reference name for a foot- or endnote
+ static ::rtl::OUString MakeFootnoteRefName(sal_Int16 nSeqNo);
+
+ /// make reference name for a sequence field
+ static ::rtl::OUString MakeSequenceRefName(sal_Int16 nSeqNo,
+ const ::rtl::OUString& rSeqName);
+
+private:
+ // constants
+
+ // service names
+ const ::rtl::OUString sServicePrefix;
+ const ::rtl::OUString sFieldMasterPrefix;
+ const ::rtl::OUString sPresentationServicePrefix;
+
+ // property names
+ const ::rtl::OUString sPropertyAdjust;
+ const ::rtl::OUString sPropertyAuthor;
+ const ::rtl::OUString sPropertyChapterFormat;
+ const ::rtl::OUString sPropertyChapterNumberingLevel;
+ const ::rtl::OUString sPropertyCharStyleNames;
+ const ::rtl::OUString sPropertyCondition;
+ const ::rtl::OUString sPropertyContent;
+ const ::rtl::OUString sPropertyDataBaseName;
+ const ::rtl::OUString sPropertyDataBaseURL;
+ const ::rtl::OUString sPropertyDataColumnName;
+ const ::rtl::OUString sPropertyDataCommandType;
+ const ::rtl::OUString sPropertyDataTableName;
+ const ::rtl::OUString sPropertyDate;
+ const ::rtl::OUString sPropertyDateTime;
+ const ::rtl::OUString sPropertyDateTimeValue;
+ const ::rtl::OUString sPropertyDDECommandElement;
+ const ::rtl::OUString sPropertyDDECommandFile;
+ const ::rtl::OUString sPropertyDDECommandType;
+ const ::rtl::OUString sPropertyDependentTextFields;
+ const ::rtl::OUString sPropertyFalseContent;
+ const ::rtl::OUString sPropertyFields;
+ const ::rtl::OUString sPropertyFieldSubType;
+ const ::rtl::OUString sPropertyFileFormat;
+ const ::rtl::OUString sPropertyFullName;
+ const ::rtl::OUString sPropertyHint;
+ const ::rtl::OUString sPropertyInstanceName;
+ const ::rtl::OUString sPropertyIsAutomaticUpdate;
+ const ::rtl::OUString sPropertyIsConditionTrue;
+ const ::rtl::OUString sPropertyIsDataBaseFormat;
+ const ::rtl::OUString sPropertyIsDate;
+ const ::rtl::OUString sPropertyIsExpression;
+ const ::rtl::OUString sPropertyIsFixed;
+ const ::rtl::OUString sPropertyIsFixedLanguage;
+ const ::rtl::OUString sPropertyIsHidden;
+ const ::rtl::OUString sPropertyIsInput;
+ const ::rtl::OUString sPropertyIsShowFormula;
+ const ::rtl::OUString sPropertyIsVisible;
+ const ::rtl::OUString sPropertyItems;
+ const ::rtl::OUString sPropertyLevel;
+ const ::rtl::OUString sPropertyMacro;
+ const ::rtl::OUString sPropertyMeasureKind;
+ const ::rtl::OUString sPropertyName;
+ const ::rtl::OUString sPropertyNumberFormat;
+ const ::rtl::OUString sPropertyNumberingSeparator;
+ const ::rtl::OUString sPropertyNumberingType;
+ const ::rtl::OUString sPropertyOffset;
+ const ::rtl::OUString sPropertyOn;
+ const ::rtl::OUString sPropertyPlaceholder;
+ const ::rtl::OUString sPropertyPlaceholderType;
+ const ::rtl::OUString sPropertyReferenceFieldPart;
+ const ::rtl::OUString sPropertyReferenceFieldSource;
+ const ::rtl::OUString sPropertyReferenceFieldType;
+ const ::rtl::OUString sPropertyRevision;
+ const ::rtl::OUString sPropertyScriptType;
+ const ::rtl::OUString sPropertySelectedItem;
+ const ::rtl::OUString sPropertySequenceNumber;
+ const ::rtl::OUString sPropertySequenceValue;
+ const ::rtl::OUString sPropertySetNumber;
+ const ::rtl::OUString sPropertySourceName;
+ const ::rtl::OUString sPropertySubType;
+ const ::rtl::OUString sPropertyTargetFrame;
+ const ::rtl::OUString sPropertyTrueContent;
+ const ::rtl::OUString sPropertyURL;
+ const ::rtl::OUString sPropertyURLContent;
+ const ::rtl::OUString sPropertyUserText;
+ const ::rtl::OUString sPropertyValue;
+ const ::rtl::OUString sPropertyVariableName;
+ const ::rtl::OUString sPropertyVariableSubType;
+ const ::rtl::OUString sPropertyHelp;
+ const ::rtl::OUString sPropertyTooltip;
+ const ::rtl::OUString sPropertyTextRange;
+
+ const ::rtl::OUString sEmpty;
+
+ XMLPropertyState* pCombinedCharactersPropertyState;
+
+};
+
+
+
+
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/txtfldi.hxx b/xmloff/inc/txtfldi.hxx
new file mode 100644
index 000000000000..597994ffab49
--- /dev/null
+++ b/xmloff/inc/txtfldi.hxx
@@ -0,0 +1,1596 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+/** @#file
+ *
+ * import of all text fields
+ * (except variable related + database display field: see txtvfldi.hxx)
+ */
+
+#ifndef _XMLOFF_TXTFLDI_HXX
+#define _XMLOFF_TXTFLDI_HXX
+
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/text/PageNumberType.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/util/Date.hpp>
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/txtimp.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <tools/debug.hxx>
+
+
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+ namespace text { class XTextField; }
+ namespace beans { class XPropertySet; struct PropertyValue; }
+} } }
+
+namespace rtl
+{
+ class OUString;
+}
+
+
+class SvXMLImport;
+class XMLTextImportHelper;
+class SvXMLTokenMap;
+
+
+
+
+enum XMLTextFieldAttrTokens
+{
+ XML_TOK_TEXTFIELD_FIXED = 0,
+ XML_TOK_TEXTFIELD_DESCRIPTION,
+ XML_TOK_TEXTFIELD_HELP,
+ XML_TOK_TEXTFIELD_HINT,
+ XML_TOK_TEXTFIELD_PLACEHOLDER_TYPE,
+ XML_TOK_TEXTFIELD_TIME_ADJUST,
+ XML_TOK_TEXTFIELD_DATE_ADJUST,
+ XML_TOK_TEXTFIELD_PAGE_ADJUST,
+ XML_TOK_TEXTFIELD_SELECT_PAGE,
+ XML_TOK_TEXTFIELD_ACTIVE,
+
+ XML_TOK_TEXTFIELD_NAME,
+ XML_TOK_TEXTFIELD_FORMULA,
+ XML_TOK_TEXTFIELD_NUM_FORMAT,
+ XML_TOK_TEXTFIELD_NUM_LETTER_SYNC,
+ XML_TOK_TEXTFIELD_DISPLAY_FORMULA,
+ XML_TOK_TEXTFIELD_NUMBERING_LEVEL,
+ XML_TOK_TEXTFIELD_NUMBERING_SEPARATOR,
+ XML_TOK_TEXTFIELD_DISPLAY,
+ XML_TOK_TEXTFIELD_OUTLINE_LEVEL,
+
+ XML_TOK_TEXTFIELD_VALUE_TYPE,
+ XML_TOK_TEXTFIELD_VALUE,
+ XML_TOK_TEXTFIELD_STRING_VALUE,
+ XML_TOK_TEXTFIELD_DATE_VALUE,
+ XML_TOK_TEXTFIELD_TIME_VALUE,
+ XML_TOK_TEXTFIELD_BOOL_VALUE,
+ XML_TOK_TEXTFIELD_CURRENCY,
+ XML_TOK_TEXTFIELD_DATA_STYLE_NAME,
+
+ XML_TOK_TEXTFIELD_DATABASE_NAME,
+ XML_TOK_TEXTFIELD_TABLE_NAME,
+ XML_TOK_TEXTFIELD_COLUMN_NAME,
+ XML_TOK_TEXTFIELD_ROW_NUMBER,
+ XML_TOK_TEXTFIELD_CONDITION,
+ XML_TOK_TEXTFIELD_STRING_VALUE_IF_TRUE,
+ XML_TOK_TEXTFIELD_STRING_VALUE_IF_FALSE,
+ XML_TOK_TEXTFIELD_REVISION,
+ XML_TOK_TEXTFIELD_IS_HIDDEN,
+ XML_TOK_TEXTFIELD_CURRENT_VALUE,
+
+ XML_TOK_TEXTFIELD_REFERENCE_FORMAT,
+ XML_TOK_TEXTFIELD_REF_NAME,
+ XML_TOK_TEXTFIELD_CONNECTION_NAME,
+
+ XML_TOK_TEXTFIELD_HREF,
+ XML_TOK_TEXTFIELD_TARGET_FRAME,
+
+ XML_TOK_TEXTFIELD_OFFICE_CREATE_DATE,
+ XML_TOK_TEXTFIELD_OFFICE_AUTHOR,
+ XML_TOK_TEXTFIELD_ANNOTATION,
+ XML_TOK_TEXTFIELD_LANGUAGE,
+
+ XML_TOK_TEXTFIELD_MEASURE_KIND,
+ XML_TOK_TEXTFIELD_TABLE_TYPE,
+
+ XML_TOK_TEXTFIELD_NOTE_CLASS,
+
+ XML_TOK_TEXTFIELD_UNKNOWN
+};
+
+
+
+
+
+/// abstract class for text field import
+class XMLTextFieldImportContext : public SvXMLImportContext
+{
+ const ::rtl::OUString sIsFixed;
+
+ // data members
+ ::rtl::OUStringBuffer sContentBuffer; /// collect character data
+ ::rtl::OUString sContent; /// character data after collection
+ ::rtl::OUString sServiceName; /// service name for text field
+ XMLTextImportHelper& rTextImportHelper; /// the import helper
+
+protected:
+ ::rtl::OUString sServicePrefix;
+
+ // data members for use in subclasses
+ sal_Bool bValid; /// ist dieses Feld gültig?
+
+public:
+
+ TYPEINFO();
+
+ XMLTextFieldImportContext(
+ SvXMLImport& rImport, /// XML Import
+ XMLTextImportHelper& rHlp, /// Text import helper
+ const sal_Char* pService, /// name of SO API service
+ sal_uInt16 nPrfx, /// namespace prefix
+ const ::rtl::OUString& rLocalName); /// element name w/o prefix
+
+ virtual ~XMLTextFieldImportContext();
+
+ /// process character data: will be collected in member sContentBuffer
+ virtual void Characters( const ::rtl::OUString& sContent );
+
+ /// parses attributes and calls ProcessAttribute
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+
+ /// create XTextField and insert into document; calls PrepareTextField
+ virtual void EndElement();
+
+ /// create the appropriate field context from
+ /// (for use in paragraph import)
+ static XMLTextFieldImportContext* CreateTextFieldImportContext(
+ SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rName,
+ sal_uInt16 nToken);
+
+
+protected:
+
+ /// get helper
+ inline XMLTextImportHelper& GetImportHelper() { return rTextImportHelper; }
+
+ inline ::rtl::OUString GetServiceName() { return sServiceName; }
+ inline void SetServiceName(::rtl::OUString sStr) { sServiceName = sStr; }
+
+ ::rtl::OUString GetContent();
+
+ /// process attribute values
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue ) = 0;
+
+ /// prepare XTextField for insertion into document
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet) = 0;
+
+ /// create field from ServiceName
+ sal_Bool CreateField(::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xField,
+ const ::rtl::OUString& sServiceName);
+
+ /// force an update of the field's value
+ /// call update on optional XUptadeable interface; (disable Fixed property)
+ void ForceUpdate(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropertySet);
+};
+
+
+
+class XMLSenderFieldImportContext : public XMLTextFieldImportContext
+{
+
+ sal_Int16 nSubType; /// API subtype for ExtUser field
+
+ const ::rtl::OUString sEmpty; /// empty string
+ const ::rtl::OUString sPropertyFixed;
+ const ::rtl::OUString sPropertyFieldSubType;
+ const ::rtl::OUString sPropertyContent;
+
+protected:
+
+ // variables for access in subclass
+ sal_Bool bFixed;
+ sal_uInt16 nElementToken; /// token for this elment field
+
+public:
+
+ TYPEINFO();
+
+ XMLSenderFieldImportContext(
+ SvXMLImport& rImport, /// XML Import
+ XMLTextImportHelper& rHlp, /// Text import helper
+ sal_uInt16 nPrfx, /// namespace prefix
+ const ::rtl::OUString& sLocalName, /// element name w/o prefix
+ sal_uInt16 nToken); /// element token
+
+protected:
+
+ /// start element
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+
+ /// process attribute values
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// prepare XTextField for insertion into document
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+
+/** inherit sender field because of fixed attribute in ProcessAttributes */
+class XMLAuthorFieldImportContext : public XMLSenderFieldImportContext
+{
+
+ sal_Bool bAuthorFullName;
+ const ::rtl::OUString sServiceAuthor;
+ const ::rtl::OUString sPropertyAuthorFullName;
+ const ::rtl::OUString sPropertyFixed;
+ const ::rtl::OUString sPropertyContent;
+
+public:
+
+ TYPEINFO();
+
+ XMLAuthorFieldImportContext(
+ SvXMLImport& rImport, /// XML Import
+ XMLTextImportHelper& rHlp, /// Text import helper
+ sal_uInt16 nPrfx, /// namespace prefix
+ const ::rtl::OUString& sLocalName, /// element name w/o prefix
+ sal_uInt16 nToken); /// element token
+
+protected:
+
+ /// start element
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+
+ /// prepare XTextField for insertion into document
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+
+
+class XMLPlaceholderFieldImportContext : public XMLTextFieldImportContext
+{
+
+ const ::rtl::OUString sEmpty; /// empty string
+ const ::rtl::OUString sServiceJumpEdit;
+ const ::rtl::OUString sPropertyPlaceholderType;
+ const ::rtl::OUString sPropertyPlaceholder;
+ const ::rtl::OUString sPropertyHint;
+
+ ::rtl::OUString sDescription;
+
+ sal_Int16 nPlaceholderType;
+
+public:
+
+ TYPEINFO();
+
+ XMLPlaceholderFieldImportContext(
+ SvXMLImport& rImport, /// XML Import
+ XMLTextImportHelper& rHlp, /// Text import helper
+ sal_uInt16 nPrfx, /// namespace prefix
+ const ::rtl::OUString& sLocalName); /// element name w/o prefix
+
+protected:
+
+ /// process attribute values
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// prepare XTextField for insertion into document
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+class XMLTimeFieldImportContext : public XMLTextFieldImportContext
+{
+
+protected:
+ const ::rtl::OUString sPropertyNumberFormat;
+ const ::rtl::OUString sPropertyFixed;
+ const ::rtl::OUString sPropertyDateTimeValue;
+ const ::rtl::OUString sPropertyDateTime;
+ const ::rtl::OUString sPropertyAdjust;
+ const ::rtl::OUString sPropertyIsDate;
+ const ::rtl::OUString sPropertyIsFixedLanguage;
+
+ double fTimeValue;
+ ::com::sun::star::util::DateTime aDateTimeValue;
+ sal_Int32 nAdjust;
+ sal_Int32 nFormatKey;
+ sal_Bool bTimeOK;
+ sal_Bool bFormatOK;
+ sal_Bool bFixed;
+ sal_Bool bIsDate; // is this a date?
+ // (for XMLDateFieldImportContext, really)
+ sal_Bool bIsDefaultLanguage;
+
+public:
+
+ TYPEINFO();
+
+ XMLTimeFieldImportContext(
+ SvXMLImport& rImport, /// XML Import
+ XMLTextImportHelper& rHlp, /// Text import helper
+ sal_uInt16 nPrfx, /// namespace prefix
+ const ::rtl::OUString& sLocalName); /// element name w/o prefix
+
+ /// process attribute values
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// prepare XTextField for insertion into document
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+
+/** import date fields (<text:date>);
+ inherit from TimeField to reuse implementation */
+class XMLDateFieldImportContext : public XMLTimeFieldImportContext
+{
+
+public:
+
+ TYPEINFO();
+
+ XMLDateFieldImportContext(
+ SvXMLImport& rImport, /// XML Import
+ XMLTextImportHelper& rHlp, /// Text import helper
+ sal_uInt16 nPrfx, /// namespace prefix
+ const ::rtl::OUString& sLocalName); /// element name w/o prefix
+
+ /// process attribute values
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+};
+
+
+/** import page continuation fields (<text:page-continuation-string>) */
+class XMLPageContinuationImportContext : public XMLTextFieldImportContext
+{
+ const ::rtl::OUString sPropertySubType;
+ const ::rtl::OUString sPropertyUserText;
+ const ::rtl::OUString sPropertyNumberingType;
+
+ ::rtl::OUString sString; /// continuation string
+ com::sun::star::text::PageNumberType eSelectPage; /// previous, current
+ /// or next page
+ sal_Bool sStringOK; /// continuation string encountered?
+
+public:
+
+ TYPEINFO();
+
+ XMLPageContinuationImportContext(
+ SvXMLImport& rImport, /// XML Import
+ XMLTextImportHelper& rHlp, /// Text import helper
+ sal_uInt16 nPrfx, /// namespace prefix
+ const ::rtl::OUString& sLocalName); /// element name w/o prefix
+
+
+ /// process attribute values
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// prepare XTextField for insertion into document
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+
+/** import page number fields (<text:page-number>) */
+class XMLPageNumberImportContext : public XMLTextFieldImportContext
+{
+ const ::rtl::OUString sPropertySubType;
+ const ::rtl::OUString sPropertyNumberingType;
+ const ::rtl::OUString sPropertyOffset;
+
+ ::rtl::OUString sNumberFormat;
+ ::rtl::OUString sNumberSync;
+ sal_Int16 nPageAdjust;
+ com::sun::star::text::PageNumberType eSelectPage; /// previous, current
+ /// or next page
+ sal_Bool sNumberFormatOK;
+
+public:
+
+ TYPEINFO();
+
+ XMLPageNumberImportContext(
+ SvXMLImport& rImport, /// XML Import
+ XMLTextImportHelper& rHlp, /// Text import helper
+ sal_uInt16 nPrfx, /// namespace prefix
+ const ::rtl::OUString& sLocalName); /// element name w/o prefix
+
+
+ /// process attribute values
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// prepare XTextField for insertion into document
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+
+/** superclass for database fields: handle database and table names */
+class XMLDatabaseFieldImportContext : public XMLTextFieldImportContext
+{
+ const ::rtl::OUString sPropertyDataBaseName;
+ const ::rtl::OUString sPropertyDataBaseURL;
+ const ::rtl::OUString sPropertyTableName;
+ const ::rtl::OUString sPropertyDataCommandType;
+ const ::rtl::OUString sPropertyIsVisible;
+
+ ::rtl::OUString sDatabaseName;
+ ::rtl::OUString sDatabaseURL;
+ ::rtl::OUString sTableName;
+
+ sal_Int32 nCommandType;
+ sal_Bool bCommandTypeOK;
+
+ sal_Bool bDisplay;
+ bool bDisplayOK;
+ bool bUseDisplay;
+
+protected:
+ sal_Bool bDatabaseOK;
+ sal_Bool bDatabaseNameOK;
+ sal_Bool bDatabaseURLOK;
+ sal_Bool bTableOK;
+
+ /// protected constructor: only for subclasses
+ XMLDatabaseFieldImportContext(SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ const sal_Char* pServiceName,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& sLocalName,
+ bool bUseDisplay );
+
+public:
+
+TYPEINFO();
+
+ /// process attribute values
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// prepare XTextField for insertion into document
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+
+ /// handle database-location children
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+};
+
+/** import database name fields (<text:database-name>) */
+class XMLDatabaseNameImportContext : public XMLDatabaseFieldImportContext
+{
+public:
+
+ TYPEINFO();
+
+ XMLDatabaseNameImportContext(SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& sLocalName);
+
+ /// process attribute values
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+};
+
+
+/** import database next fields (<text:database-next>) */
+class XMLDatabaseNextImportContext : public XMLDatabaseFieldImportContext
+{
+ const ::rtl::OUString sPropertyCondition;
+ const ::rtl::OUString sTrue;
+ ::rtl::OUString sCondition;
+ sal_Bool bConditionOK;
+
+protected:
+
+ // for use in child classes
+ XMLDatabaseNextImportContext(SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ const sal_Char* pServiceName,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& sLocalName);
+
+public:
+
+ TYPEINFO();
+
+ XMLDatabaseNextImportContext(SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& sLocalName);
+
+ /// process attribute values
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// prepare XTextField for insertion into document
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+
+
+/** import database select fields (<text:database-select>) */
+class XMLDatabaseSelectImportContext : public XMLDatabaseNextImportContext
+{
+ const ::rtl::OUString sPropertySetNumber;
+ sal_Int32 nNumber;
+ sal_Bool bNumberOK;
+
+public:
+
+ TYPEINFO();
+
+ XMLDatabaseSelectImportContext(SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& sLocalName);
+
+ /// process attribute values
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// prepare XTextField for insertion into document
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+
+/** import database display number fields (<text:database-row-number>) */
+class XMLDatabaseNumberImportContext : public XMLDatabaseFieldImportContext
+{
+ const ::rtl::OUString sPropertyNumberingType;
+ const ::rtl::OUString sPropertySetNumber;
+ ::rtl::OUString sNumberFormat;
+ ::rtl::OUString sNumberSync;
+ sal_Int32 nValue;
+ sal_Bool bValueOK;
+
+public:
+
+ TYPEINFO();
+
+ XMLDatabaseNumberImportContext(SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& sLocalName);
+
+ /// process attribute values
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// prepare XTextField for insertion into document
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+
+/** import docinfo fields with only fixed atribute */
+class XMLSimpleDocInfoImportContext : public XMLTextFieldImportContext
+{
+ const ::rtl::OUString sPropertyFixed;
+ const ::rtl::OUString sPropertyContent;
+ const ::rtl::OUString sPropertyAuthor;
+ const ::rtl::OUString sPropertyCurrentPresentation;
+
+protected:
+ sal_Bool bFixed;
+ sal_Bool bHasAuthor;
+ sal_Bool bHasContent;
+
+public:
+
+ TYPEINFO();
+
+ XMLSimpleDocInfoImportContext(SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& sLocalName,
+ sal_uInt16 nToken,
+ sal_Bool bContent,
+ sal_Bool bAuthor);
+
+protected:
+
+ /// process attribute values
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// prepare XTextField for insertion into document
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+
+ static const sal_Char* MapTokenToServiceName(sal_uInt16 nToken);
+};
+
+
+
+/** import docinfo fields with date or time attributes and numberformats */
+class XMLDateTimeDocInfoImportContext : public XMLSimpleDocInfoImportContext
+{
+ const ::rtl::OUString sPropertyNumberFormat;
+ const ::rtl::OUString sPropertyIsDate;
+ const ::rtl::OUString sPropertyIsFixedLanguage;
+
+ sal_Int32 nFormat;
+ sal_Bool bFormatOK;
+ sal_Bool bIsDate;
+ sal_Bool bHasDateTime;
+ sal_Bool bIsDefaultLanguage;
+
+public:
+
+ TYPEINFO();
+
+ XMLDateTimeDocInfoImportContext(SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& sLocalName,
+ sal_uInt16 nToken);
+
+protected:
+
+ /// process attribute values
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// prepare XTextField for insertion into document
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+
+
+/** import revision field (<text:editing-cycles>) */
+class XMLRevisionDocInfoImportContext : public XMLSimpleDocInfoImportContext
+{
+ const ::rtl::OUString sPropertyRevision;
+
+public:
+
+ TYPEINFO();
+
+ XMLRevisionDocInfoImportContext(SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& sLocalName,
+ sal_uInt16 nToken);
+
+protected:
+
+ /// prepare XTextField for insertion into document
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+
+
+/** import user docinfo field (<text:user-defined>) */
+class XMLUserDocInfoImportContext : public XMLSimpleDocInfoImportContext
+{
+ rtl::OUString aName;
+ const ::rtl::OUString sPropertyName;
+ const ::rtl::OUString sPropertyNumberFormat;
+ const ::rtl::OUString sPropertyIsFixedLanguage;
+ sal_Int32 nFormat;
+ sal_Bool bFormatOK;
+ sal_Bool bIsDefaultLanguage;
+
+public:
+
+ TYPEINFO();
+
+ XMLUserDocInfoImportContext(SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& sLocalName,
+ sal_uInt16 nToken);
+
+protected:
+
+ /// process attribute values
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+
+
+/** import hidden paragraph fields (<text:hidden-paragraph>) */
+class XMLHiddenParagraphImportContext : public XMLTextFieldImportContext
+{
+ const ::rtl::OUString sPropertyCondition;
+ const ::rtl::OUString sPropertyIsHidden;
+
+ ::rtl::OUString sCondition;
+ sal_Bool bIsHidden;
+
+public:
+
+ TYPEINFO();
+
+ XMLHiddenParagraphImportContext(SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& sLocalName);
+
+protected:
+
+ /// process attribute values
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// prepare XTextField for insertion into document
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+
+
+/** import conditional text fields (<text:conditional-text>) */
+class XMLConditionalTextImportContext : public XMLTextFieldImportContext
+{
+ const ::rtl::OUString sPropertyCondition;
+ const ::rtl::OUString sPropertyTrueContent;
+ const ::rtl::OUString sPropertyFalseContent;
+ const ::rtl::OUString sPropertyIsConditionTrue;
+ const ::rtl::OUString sPropertyCurrentPresentation;
+
+ ::rtl::OUString sCondition;
+ ::rtl::OUString sTrueContent;
+ ::rtl::OUString sFalseContent;
+
+ sal_Bool bConditionOK;
+ sal_Bool bTrueOK;
+ sal_Bool bFalseOK;
+ sal_Bool bCurrentValue;
+
+public:
+
+ TYPEINFO();
+
+ XMLConditionalTextImportContext(SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& sLocalName);
+
+protected:
+
+ /// process attribute values
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// prepare XTextField for insertion into document
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+
+
+/** import conditional text fields (<text:hidden-text>) */
+class XMLHiddenTextImportContext : public XMLTextFieldImportContext
+{
+ const ::rtl::OUString sPropertyCondition;
+ const ::rtl::OUString sPropertyContent;
+ const ::rtl::OUString sPropertyIsHidden;
+
+ ::rtl::OUString sCondition;
+ ::rtl::OUString sString;
+
+ sal_Bool bConditionOK;
+ sal_Bool bStringOK;
+ sal_Bool bIsHidden;
+
+public:
+
+ TYPEINFO();
+
+ XMLHiddenTextImportContext(SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& sLocalName);
+
+protected:
+
+ /// process attribute values
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// prepare XTextField for insertion into document
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+
+
+/** import file name fields (<text:file-name>) */
+class XMLFileNameImportContext : public XMLTextFieldImportContext
+{
+ const ::rtl::OUString sPropertyFixed;
+ const ::rtl::OUString sPropertyFileFormat;
+ const ::rtl::OUString sPropertyCurrentPresentation;
+
+ sal_Int16 nFormat;
+ sal_Bool bFixed;
+
+public:
+
+ TYPEINFO();
+
+ XMLFileNameImportContext(SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& sLocalName);
+
+protected:
+
+ /// process attribute values
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// prepare XTextField for insertion into document
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+
+
+/** import document template name fields (<text:template-name>) */
+class XMLTemplateNameImportContext : public XMLTextFieldImportContext
+{
+ const ::rtl::OUString sPropertyFileFormat;
+
+ sal_Int16 nFormat;
+
+public:
+
+ TYPEINFO();
+
+ XMLTemplateNameImportContext(SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& sLocalName);
+
+protected:
+
+ /// process attribute values
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// prepare XTextField for insertion into document
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+
+/** import chapter fields (<text:chapter>) */
+class XMLChapterImportContext : public XMLTextFieldImportContext
+{
+ const ::rtl::OUString sPropertyChapterFormat;
+ const ::rtl::OUString sPropertyLevel;
+
+ sal_Int16 nFormat;
+ sal_Int8 nLevel;
+
+public:
+
+ TYPEINFO();
+
+ XMLChapterImportContext(SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& sLocalName);
+
+protected:
+
+ /// process attribute values
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// prepare XTextField for insertion into document
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+
+
+/** import count fields (<text:[XXX]-count>) */
+class XMLCountFieldImportContext : public XMLTextFieldImportContext
+{
+ const ::rtl::OUString sPropertyNumberingType;
+
+ ::rtl::OUString sNumberFormat;
+ ::rtl::OUString sLetterSync;
+
+ sal_Bool bNumberFormatOK;
+
+public:
+
+ TYPEINFO();
+
+ XMLCountFieldImportContext(SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& sLocalName,
+ sal_uInt16 nToken);
+
+protected:
+
+ /// process attribute values
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// prepare XTextField for insertion into document
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+
+ static const sal_Char* MapTokenToServiceName(sal_uInt16 nToken);
+};
+
+
+/** import page variable fields (<text:get-page-variable>) */
+class XMLPageVarGetFieldImportContext : public XMLTextFieldImportContext
+{
+ const ::rtl::OUString sPropertyNumberingType;
+
+ ::rtl::OUString sNumberFormat;
+ ::rtl::OUString sLetterSync;
+
+ sal_Bool bNumberFormatOK;
+
+public:
+
+ TYPEINFO();
+
+ XMLPageVarGetFieldImportContext(SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& sLocalName);
+
+protected:
+
+ /// process attribute values
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// prepare XTextField for insertion into document
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+
+/** import page variable fields (<text:get-page-variable>) */
+class XMLPageVarSetFieldImportContext : public XMLTextFieldImportContext
+{
+ const ::rtl::OUString sPropertyOn;
+ const ::rtl::OUString sPropertyOffset;
+
+ sal_Int16 nAdjust;
+ sal_Bool bActive;
+
+public:
+
+ TYPEINFO();
+
+ XMLPageVarSetFieldImportContext(SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& sLocalName);
+
+protected:
+
+ /// process attribute values
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// prepare XTextField for insertion into document
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+
+/** import macro fields (<text:execute-macro>) */
+class XMLMacroFieldImportContext : public XMLTextFieldImportContext
+{
+
+ const ::rtl::OUString sPropertyHint;
+ const ::rtl::OUString sPropertyMacroName;
+ const ::rtl::OUString sPropertyScriptURL;
+ const ::rtl::OUString sPropertyLibraryName;
+
+ ::rtl::OUString sDescription;
+ SvXMLImportContextRef xEventContext;
+
+ ::rtl::OUString sMacro; // macro for old documents (pre 638i)
+
+ sal_Bool bMacroOK;
+ sal_Bool bDescriptionOK;
+
+public:
+
+ TYPEINFO();
+
+ XMLMacroFieldImportContext(SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& sLocalName);
+
+protected:
+
+ /// for <office:events> children
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+
+ /// process attribute values
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// prepare XTextField for insertion into document
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+
+
+/** import reference fields (<text:reference-get>) */
+class XMLReferenceFieldImportContext : public XMLTextFieldImportContext
+{
+ const ::rtl::OUString sPropertyReferenceFieldPart;
+ const ::rtl::OUString sPropertyReferenceFieldSource;
+ const ::rtl::OUString sPropertySourceName;
+ const ::rtl::OUString sPropertyCurrentPresentation;
+
+ ::rtl::OUString sName;
+ sal_uInt16 nElementToken;
+ sal_Int16 nSource;
+ sal_Int16 nType;
+ sal_Int16 nSequenceNumber;
+
+ sal_Bool bNameOK;
+ sal_Bool bTypeOK;
+ sal_Bool bSeqNumberOK;
+
+public:
+
+ TYPEINFO();
+
+ XMLReferenceFieldImportContext(SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nToken,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& sLocalName);
+
+protected:
+
+ /// start element
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+
+ /// process attribute values
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// prepare XTextField for insertion into document
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+
+
+/** import dde field declaration container (<text:dde-connection-decls>) */
+class XMLDdeFieldDeclsImportContext : public SvXMLImportContext
+{
+
+ SvXMLTokenMap aTokenMap;
+
+public:
+
+ TYPEINFO();
+
+ XMLDdeFieldDeclsImportContext(SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& sLocalName);
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+
+
+};
+
+
+
+/** import dde field declaration (<text:dde-connection-decl>) */
+class XMLDdeFieldDeclImportContext : public SvXMLImportContext
+{
+ const ::rtl::OUString sPropertyIsAutomaticUpdate;
+ const ::rtl::OUString sPropertyName;
+ const ::rtl::OUString sPropertyDDECommandType;
+ const ::rtl::OUString sPropertyDDECommandFile;
+ const ::rtl::OUString sPropertyDDECommandElement;
+
+ const SvXMLTokenMap& rTokenMap;
+
+public:
+
+ TYPEINFO();
+
+ XMLDdeFieldDeclImportContext(SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& sLocalName,
+ const SvXMLTokenMap& rMap);
+
+ // create fieldmaster
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+};
+
+
+
+/** import dde fields (<text:dde-connection>) */
+class XMLDdeFieldImportContext : public XMLTextFieldImportContext
+{
+ ::rtl::OUString sName;
+ ::rtl::OUString sPropertyContent;
+public:
+
+ TYPEINFO();
+
+ XMLDdeFieldImportContext(SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& sLocalName);
+
+protected:
+
+ /// process attribute values
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// create textfield, attach master, and insert into document
+ virtual void EndElement();
+
+ /// empty method
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+
+};
+
+
+/** import sheet name fields (Calc) dde fields (<text:sheet-name>) */
+class XMLSheetNameImportContext : public XMLTextFieldImportContext
+{
+
+public:
+
+ TYPEINFO();
+
+ XMLSheetNameImportContext(SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& sLocalName);
+
+protected:
+
+ /// no attributes -> empty method
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// no atributes -> empty method
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+/** import hyperlinks as URL fields (Calc, Impress, Draw) (<office:a>) */
+class XMLUrlFieldImportContext : public XMLTextFieldImportContext
+{
+
+ const ::rtl::OUString sPropertyURL;
+ const ::rtl::OUString sPropertyTargetFrame;
+ const ::rtl::OUString sPropertyRepresentation;
+
+ ::rtl::OUString sURL;
+ ::rtl::OUString sFrame;
+ sal_Bool bFrameOK;
+
+public:
+
+ TYPEINFO();
+
+ XMLUrlFieldImportContext(SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& sLocalName);
+
+protected:
+
+ /// no attributes -> empty method
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// no atributes -> empty method
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+/** import bibliography info fields (<text:bibliography-mark>) */
+class XMLBibliographyFieldImportContext : public XMLTextFieldImportContext
+{
+
+ const ::rtl::OUString sPropertyFields;
+
+ ::std::vector< ::com::sun::star::beans::PropertyValue> aValues;
+
+public:
+
+ TYPEINFO();
+
+ XMLBibliographyFieldImportContext(SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& sLocalName);
+
+protected:
+
+ /// process attributes (fill aValues)
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+
+ /// empty method; all attributes are handled in StartElement
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// convert aValues into sequence and set property
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+
+ static const sal_Char* MapBibliographyFieldName(::rtl::OUString sName);
+
+};
+
+
+/** Import an annotation field (<text:annotation>) */
+class XMLAnnotationImportContext : public XMLTextFieldImportContext
+{
+ const ::rtl::OUString sPropertyAuthor;
+ const ::rtl::OUString sPropertyContent;
+ const ::rtl::OUString sPropertyDate;
+ const ::rtl::OUString sPropertyTextRange;
+
+ ::rtl::OUStringBuffer aAuthorBuffer;
+ ::rtl::OUStringBuffer aTextBuffer;
+ ::rtl::OUStringBuffer aDateBuffer;
+
+ com::sun::star::uno::Reference < com::sun::star::beans::XPropertySet > mxField;
+ com::sun::star::uno::Reference < com::sun::star::text::XTextCursor > mxCursor;
+ com::sun::star::uno::Reference < com::sun::star::text::XTextCursor > mxOldCursor;
+
+public:
+
+ TYPEINFO();
+
+ XMLAnnotationImportContext(SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& sLocalName);
+
+protected:
+
+ /// process attributes
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// set properties
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+};
+
+
+/** Import a script field (<text:script>) */
+class XMLScriptImportContext : public XMLTextFieldImportContext
+{
+ const ::rtl::OUString sPropertyScriptType;
+ const ::rtl::OUString sPropertyURLContent;
+ const ::rtl::OUString sPropertyContent;
+
+ ::rtl::OUString sContent;
+ ::rtl::OUString sScriptType;
+
+ sal_Bool bContentOK;
+ sal_Bool bScriptTypeOK;
+ sal_Bool bUrlContent;
+
+public:
+
+ TYPEINFO();
+
+ XMLScriptImportContext(SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& sLocalName);
+
+protected:
+
+ /// process attributes
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// set properties
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+/** import measure fields (<text:measure>) */
+class XMLMeasureFieldImportContext : public XMLTextFieldImportContext
+{
+ sal_Int16 mnKind;
+public:
+
+ TYPEINFO();
+
+ XMLMeasureFieldImportContext(SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& sLocalName);
+
+protected:
+
+ /// process attribute values
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// prepare XTextField for insertion into document
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+
+/** dropdown field (filter legacy) */
+class XMLDropDownFieldImportContext : public XMLTextFieldImportContext
+{
+ std::vector<rtl::OUString> aLabels;
+ rtl::OUString sName;
+ rtl::OUString sHelp;
+ rtl::OUString sHint;
+ sal_Int32 nSelected;
+ bool bNameOK;
+ bool bHelpOK;
+ bool bHintOK;
+
+ const rtl::OUString sPropertyItems;
+ const rtl::OUString sPropertySelectedItem;
+ const rtl::OUString sPropertyName;
+ const rtl::OUString sPropertyHelp;
+ const rtl::OUString sPropertyToolTip;
+
+public:
+ TYPEINFO();
+
+ XMLDropDownFieldImportContext(SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& sLocalName);
+
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+protected:
+
+ /// process attribute values
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// prepare XTextField for insertion into document
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+/** import header fields (<draw:header>) */
+class XMLHeaderFieldImportContext : public XMLTextFieldImportContext
+{
+public:
+ TYPEINFO();
+
+ XMLHeaderFieldImportContext(
+ SvXMLImport& rImport, /// XML Import
+ XMLTextImportHelper& rHlp, /// Text import helper
+ sal_uInt16 nPrfx, /// namespace prefix
+ const ::rtl::OUString& sLocalName); /// element name w/o prefix
+
+ /// process attribute values
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// prepare XTextField for insertion into document
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+/** import footer fields (<draw:footer>) */
+class XMLFooterFieldImportContext : public XMLTextFieldImportContext
+{
+public:
+ TYPEINFO();
+
+ XMLFooterFieldImportContext(
+ SvXMLImport& rImport, /// XML Import
+ XMLTextImportHelper& rHlp, /// Text import helper
+ sal_uInt16 nPrfx, /// namespace prefix
+ const ::rtl::OUString& sLocalName); /// element name w/o prefix
+
+ /// process attribute values
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// prepare XTextField for insertion into document
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+/** import footer fields (<draw:date-and-time>) */
+class XMLDateTimeFieldImportContext : public XMLTextFieldImportContext
+{
+public:
+ TYPEINFO();
+
+ XMLDateTimeFieldImportContext(
+ SvXMLImport& rImport, /// XML Import
+ XMLTextImportHelper& rHlp, /// Text import helper
+ sal_uInt16 nPrfx, /// namespace prefix
+ const ::rtl::OUString& sLocalName); /// element name w/o prefix
+
+ /// process attribute values
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// prepare XTextField for insertion into document
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+class XMLCustomPropertyFieldImportContext : public XMLTextFieldImportContext
+{
+ ::rtl::OUString sName;
+ ::com::sun::star::uno::Any aValue;
+ const ::rtl::OUString sPropertyName;
+ const ::rtl::OUString sPropertyValue;
+
+public:
+
+ TYPEINFO();
+
+ XMLCustomPropertyFieldImportContext (SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& sLocalName);
+
+protected:
+
+ /// process attribute values
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// prepare XTextField for insertion into document
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/txtlists.hxx b/xmloff/inc/txtlists.hxx
new file mode 100644
index 000000000000..b8735e8b7856
--- /dev/null
+++ b/xmloff/inc/txtlists.hxx
@@ -0,0 +1,191 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_TXTLISTS_HXX
+#define _XMLOFF_TXTLISTS_HXX
+
+#include <rtl/ustring.hxx>
+#include <comphelper/stl_types.hxx>
+#include <map>
+#include <vector>
+#include <stack>
+#include <boost/utility.hpp>
+#include <boost/tuple/tuple.hpp>
+#include <com/sun/star/container/XIndexReplace.hpp>
+#include <xmloff/xmlictxt.hxx>
+
+class SvXMLImport;
+class XMLTextListBlockContext;
+class XMLTextListItemContext;
+class XMLNumberedParaContext;
+
+class XMLTextListsHelper : private boost::noncopyable
+{
+ public:
+ XMLTextListsHelper();
+ ~XMLTextListsHelper();
+
+ /// list stack for importing:
+
+ /// push a list context on the list context stack
+ void PushListContext(XMLTextListBlockContext *i_pListBlock = 0);
+ void PushListContext(XMLNumberedParaContext *i_pNumberedParagraph);
+ /// pop the list context stack
+ void PopListContext();
+ /// peek at the top of the list context stack
+ void ListContextTop(XMLTextListBlockContext*& o_pListBlockContext,
+ XMLTextListItemContext*& o_pListItemContext,
+ XMLNumberedParaContext*& o_pNumberedParagraphContext );
+ /// set list item on top of the list context stack
+ void SetListItem( XMLTextListItemContext *pListItem );
+
+
+ // keeping track of processed lists for import and export
+ // Add optional parameter <sListStyleDefaultListId> (#i92811#)
+ void KeepListAsProcessed( ::rtl::OUString sListId,
+ ::rtl::OUString sListStyleName,
+ ::rtl::OUString sContinueListId,
+ ::rtl::OUString sListStyleDefaultListId = ::rtl::OUString() );
+
+ sal_Bool IsListProcessed( const ::rtl::OUString sListId ) const;
+ ::rtl::OUString GetListStyleOfProcessedList(
+ const ::rtl::OUString sListId ) const;
+ ::rtl::OUString GetContinueListIdOfProcessedList(
+ const ::rtl::OUString sListId ) const;
+ const ::rtl::OUString& GetLastProcessedListId() const;
+ const ::rtl::OUString& GetListStyleOfLastProcessedList() const;
+
+ ::rtl::OUString GenerateNewListId() const;
+
+ // Provide list id for a certain list block for import (#i92811#)
+ ::rtl::OUString GetListIdForListBlock( XMLTextListBlockContext& rListBlock );
+
+ // keep track of continue list chain for export
+ void StoreLastContinuingList( ::rtl::OUString sListId,
+ ::rtl::OUString sContinuingListId );
+
+ ::rtl::OUString GetLastContinuingListId( ::rtl::OUString sListId ) const;
+
+ // keep track of opened list elements of a certain list for export
+ void PushListOnStack( ::rtl::OUString sListId,
+ ::rtl::OUString sListStyleName );
+ void PopListFromStack();
+ sal_Bool EqualsToTopListStyleOnStack( const ::rtl::OUString sListId ) const;
+
+ /** for importing numbered-paragraph
+ note that the ID namespace for numbered-paragraph and regular list
+ is distinct; we never combine a list and a n-p
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XIndexReplace>
+ EnsureNumberedParagraph(
+ SvXMLImport & i_rImport,
+ const ::rtl::OUString i_ListId,
+ sal_Int16 & io_rLevel, const ::rtl::OUString i_StyleName);
+
+ /// get ID of the last numbered-paragraph iff it has given style-name
+ ::rtl::OUString GetNumberedParagraphListId(
+ const sal_uInt16 i_Level,
+ const ::rtl::OUString i_StyleName);
+
+ /** Creates a NumRule from given style-name.
+ @param i_rImport the SvXMLImport
+ @param i_xNumRule parent num rule
+ @param i_ParentStyleName parent list style name
+ @param i_StyleName the list style name
+ @param io_rLevel the list level (may be reset if too large)
+ @param o_rRestartNumbering set to true if no style (defaulting)
+ @param io_rSetDefaults set to true if no style (defaulting)
+ */
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XIndexReplace> MakeNumRule(
+ SvXMLImport & i_rImport,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XIndexReplace>& i_xNumRule,
+ const ::rtl::OUString i_ParentStyleName,
+ const ::rtl::OUString i_StyleName,
+ sal_Int16 & io_rLevel,
+ sal_Bool* o_pRestartNumbering = 0,
+ sal_Bool* io_pSetDefaults = 0);
+
+ private:
+
+ /** list context: list, list-item, numbered-paragraph
+ XMLTextListBlockContext, XMLTextListItemContext,
+ XMLNumberedParaContext
+ */
+ typedef ::boost::tuple<SvXMLImportContextRef,
+ SvXMLImportContextRef, SvXMLImportContextRef> ListStackFrame_t;
+ ::std::stack< ListStackFrame_t > mListStack;
+
+ // container type for processed lists:
+ // map with <ListId> as key and pair( <ListStyleName, ContinueListId> )
+ // as value
+ typedef ::std::map< ::rtl::OUString,
+ ::std::pair< ::rtl::OUString, ::rtl::OUString >,
+ ::comphelper::UStringLess > tMapForLists;
+ tMapForLists* mpProcessedLists;
+ ::rtl::OUString msLastProcessedListId;
+ ::rtl::OUString msListStyleOfLastProcessedList;
+
+ /* additional container for processed lists.
+ map with <ListStyleName> as key and pair( <ListId, ListStyleDefaultListId> )
+ as value. (#i92811#)
+ */
+ tMapForLists* mpMapListIdToListStyleDefaultListId;
+
+ // container type to build up continue list chain:
+ // map with <ListId> of master list as key and <ListId> of last list
+ // continuing the master list as value
+ typedef ::std::map< ::rtl::OUString, ::rtl::OUString,
+ ::comphelper::UStringLess > tMapForContinuingLists;
+ tMapForContinuingLists* mpContinuingLists;
+
+ // stack type for opened list elements and its list style:
+ // vector with pair( <ListId>, <ListStyleName> ) as value
+ typedef ::std::vector< ::std::pair< ::rtl::OUString, ::rtl::OUString > >
+ tStackForLists;
+ tStackForLists* mpListStack;
+
+ /// to connect numbered-paragraphs that have no list-id attribute:
+ /// vector of pair of style-name and list-id (indexed by level)
+ typedef ::std::vector< ::std::pair< ::rtl::OUString, ::rtl::OUString > >
+ LastNumberedParagraphs_t;
+
+ LastNumberedParagraphs_t mLastNumberedParagraphs;
+
+ /// numbered-paragraphs
+ typedef ::std::vector< ::std::pair< ::rtl::OUString,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XIndexReplace > > > NumParaList_t;
+ ::std::map< ::rtl::OUString, NumParaList_t > mNPLists;
+
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/txtvfldi.hxx b/xmloff/inc/txtvfldi.hxx
new file mode 100644
index 000000000000..fdd2383d12c2
--- /dev/null
+++ b/xmloff/inc/txtvfldi.hxx
@@ -0,0 +1,621 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+/** @#file
+ *
+ * XML import of all variable related text fields plus database display field
+ */
+
+#ifndef _XMLOFF_TXTVFLDI_HXX
+#define _XMLOFF_TXTVFLDI_HXX
+
+#include "txtvfldi.hxx"
+#include "txtfldi.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+
+
+
+/// variable type (for XMLSetVarFieldImportContext)
+enum VarType
+{
+ VarTypeSimple,
+ VarTypeUserField,
+ VarTypeSequence
+};
+
+
+
+/** helper class: parses value-type and associated value attributes */
+class XMLValueImportHelper
+{
+
+ const ::rtl::OUString sPropertyContent;
+ const ::rtl::OUString sPropertyValue;
+ const ::rtl::OUString sPropertyFormula;
+ const ::rtl::OUString sPropertyNumberFormat;
+ const ::rtl::OUString sPropertyIsFixedLanguage;
+
+ SvXMLImport& rImport;
+ XMLTextImportHelper& rHelper;
+
+ ::rtl::OUString sValue; /// string value (only valid if bStringValueOK)
+ double fValue; /// double value (only valid if bFloatValueOK)
+ sal_Int32 nFormatKey; /// format key (only valid of bFormatOK)
+ ::rtl::OUString sFormula; /// formula string
+ ::rtl::OUString sDefault; /// default (see bStringDefault/bFormulaDef.)
+ sal_Bool bIsDefaultLanguage;/// format (of nFormatKey) has system language?
+
+ sal_Bool bStringType; /// is this a string (or a float) type?
+ sal_Bool bFormatOK; /// have we read a style:data-style-name attr.?
+ sal_Bool bTypeOK; /// have we read a value-type attribute?
+ sal_Bool bStringValueOK; /// have we read a string-value attr.?
+ sal_Bool bFloatValueOK; /// have we read any of the float attr.s?
+ sal_Bool bFormulaOK; /// have we read the formula attribute?
+
+ const sal_Bool bSetType; /// should PrepareField set the SetExp subtype?
+ const sal_Bool bSetValue; /// should PrepareField set content/value?
+ const sal_Bool bSetStyle; /// should PrepareField set NumberFormat?
+ const sal_Bool bSetFormula; /// should PrepareField set Formula?
+
+ const sal_Bool bStringDefault; /// default: string-value = content
+ const sal_Bool bFormulaDefault; /// default: formula = content
+
+public:
+ XMLValueImportHelper(
+ SvXMLImport& rImprt, /// XML Import
+ XMLTextImportHelper& rHlp, /// text import helper
+ sal_Bool bType, /// process type (PrepareField)
+ sal_Bool bStyle, /// process data style (P.F.)
+ sal_Bool bValue, /// process value (Prep.Field)
+ sal_Bool bFormula); /// process formula (Prep.F.)
+
+ virtual ~XMLValueImportHelper();
+
+ /// process attribute values
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// prepare XTextField for insertion into document
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+
+ /// is value a string (rather than double)?
+ inline sal_Bool IsStringValue() { return bStringType; }
+
+ /// has format been read?
+ inline sal_Bool IsFormatOK() { return bFormatOK; }
+
+ inline void SetDefault(const ::rtl::OUString& sStr) { sDefault = sStr; }
+};
+
+
+
+/**
+ * abstract parent class for all variable related fields
+ * - variable-set/get/decl (not -decls),
+ * - user-field-get/decl (not -decls),
+ * - sequence/-decl (not -decls),
+ * - expression,
+ * - text-input
+ *
+ * Processes the following attributes:
+ * - name
+ * - formula
+ * - display
+ * - value, value-type, data-style-name (via XMLValueImportHelper)
+ * - description.
+ *
+ * Each attribute has a corresponding member, a bool variable to indicate
+ * whether it was set or not, and a bool variable whether it should be set
+ * using the standard property name.
+ *
+ * bValid is set true, when name is found!
+ * (Most variable related fields are valid, if a name is
+ * found. However, some are always valid. In this case, setting bValid
+ * does not matter.)
+ */
+class XMLVarFieldImportContext : public XMLTextFieldImportContext
+{
+protected:
+ const ::rtl::OUString sPropertyContent;
+ const ::rtl::OUString sPropertyHint;
+ const ::rtl::OUString sPropertyHelp;
+ const ::rtl::OUString sPropertyTooltip;
+ const ::rtl::OUString sPropertyIsVisible;
+ const ::rtl::OUString sPropertyIsDisplayFormula;
+ const ::rtl::OUString sPropertyCurrentPresentation;
+
+private:
+ ::rtl::OUString sName; /// name attribute
+ ::rtl::OUString sFormula; /// formula attribute
+ ::rtl::OUString sDescription; /// description
+ ::rtl::OUString sHelp; /// help text
+ ::rtl::OUString sHint; /// hint
+ XMLValueImportHelper aValueHelper; /// value, value-type, and style
+ sal_Bool bDisplayFormula; /// display formula?(rather than value)
+ sal_Bool bDisplayNone; /// hide field?
+
+ sal_Bool bNameOK; /// sName was set
+ sal_Bool bFormulaOK; /// sFormula was set
+ sal_Bool bDescriptionOK; /// sDescription was set
+ sal_Bool bHelpOK; /// sHelp was set
+ sal_Bool bHintOK; /// sHint was set
+ sal_Bool bDisplayOK; /// sDisplayFormula/-None were set
+
+ sal_Bool bSetName; /// set sName with ???-property
+ sal_Bool bSetFormula; /// set Formula property
+ sal_Bool bSetFormulaDefault; /// use content as default for formula
+ sal_Bool bSetDescription; /// set sDescription with Hint-property
+ sal_Bool bSetHelp;
+ sal_Bool bSetHint;
+ sal_Bool bSetVisible; /// set IsVisible
+ sal_Bool bSetDisplayFormula; /// set DisplayFormula (sub type???)
+ sal_Bool bSetPresentation; /// set presentation frm elem. content?
+
+public:
+
+ TYPEINFO();
+
+ XMLVarFieldImportContext(
+ // for XMLTextFieldImportContext:
+ SvXMLImport& rImport, /// XML Import
+ XMLTextImportHelper& rHlp, /// text import helper
+ const sal_Char* pServiceName, /// name of SO API service
+ sal_uInt16 nPrfx, /// namespace prefix
+ const ::rtl::OUString& rLocalName, /// element name w/o prefix
+ // config variables for PrepareField behavior:
+ sal_Bool bName, /// set sName with ???-property
+ sal_Bool bFormula, /// set Formula property
+ sal_Bool bFormulaDefault, /// use content as default for formula
+ sal_Bool bDescription, /// set sDescription with Hint-property
+ sal_Bool bHelp,
+ sal_Bool bHint,
+ sal_Bool bVisible, /// set IsVisible (display attr)
+ sal_Bool bDisplayFormula, /// set ??? (display attr.)
+ sal_Bool bType, /// set value type with ???-property
+ sal_Bool bStyle, /// set data style (NumberFormat-Prop.)
+ sal_Bool bValue, /// set value with Content/Value-Prop.
+ sal_Bool bPresentation); /// set presentation from elem. content
+
+protected:
+ /// process attribute values
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// prepare XTextField for insertion into document
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+
+ // various accessor methods:
+ inline ::rtl::OUString GetName() { return sName; }
+ inline sal_Bool IsStringValue() { return aValueHelper.IsStringValue();}
+ inline sal_Bool IsNameOK() { return bNameOK; }
+ inline sal_Bool IsFormulaOK() { return bFormulaOK; }
+ inline sal_Bool IsDescriptionOK() { return bDescriptionOK; }
+ inline sal_Bool IsDisplayOK() { return bDisplayOK; }
+};
+
+
+
+/** import variable get fields (<text:variable-get>) */
+class XMLVariableGetFieldImportContext : public XMLVarFieldImportContext
+{
+ const ::rtl::OUString sPropertySubType;
+
+public:
+
+ TYPEINFO();
+
+ XMLVariableGetFieldImportContext(
+ SvXMLImport& rImport, /// XML Import
+ XMLTextImportHelper& rHlp, /// Text import helper
+ sal_uInt16 nPrfx, /// namespace prefix
+ const ::rtl::OUString& rLocalName); /// element name w/o prefix
+
+
+protected:
+ /// prepare XTextField for insertion into document
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+
+
+/** import expression fields (<text:expression>) */
+class XMLExpressionFieldImportContext : public XMLVarFieldImportContext
+{
+ const ::rtl::OUString sPropertySubType;
+
+public:
+
+ TYPEINFO();
+
+ XMLExpressionFieldImportContext(
+ SvXMLImport& rImport, /// XML Import
+ XMLTextImportHelper& rHlp, /// Text import helper
+ sal_uInt16 nPrfx, /// namespace prefix
+ const ::rtl::OUString& sLocalName); /// element name w/o prefix
+
+protected:
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+/*** import text input fields (<text:text-input>) */
+class XMLTextInputFieldImportContext : public XMLVarFieldImportContext
+{
+ const ::rtl::OUString sPropertyContent;
+
+public:
+
+ TYPEINFO();
+
+ XMLTextInputFieldImportContext(
+ SvXMLImport& rImport, /// XML Import
+ XMLTextImportHelper& rHlp, /// Text import helper
+ sal_uInt16 nPrfx, /// namespace prefix
+ const ::rtl::OUString& sLocalName); /// element name w/o prefix
+
+protected:
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+
+
+
+
+
+/**
+ * uperclass for variable/user-set, var/user-input, and sequence fields
+ * inds field master of appropriate type and attaches field to it.
+ */
+class XMLSetVarFieldImportContext : public XMLVarFieldImportContext
+{
+ const VarType eFieldType;
+
+public:
+
+ TYPEINFO();
+
+ XMLSetVarFieldImportContext(
+ // for XMLTextFieldImportContext:
+ SvXMLImport& rImport, /// see XMLTextFieldImportContext
+ XMLTextImportHelper& rHlp, /// see XMLTextFieldImportContext
+ const sal_Char* pServiceName, /// see XMLTextFieldImportContext
+ sal_uInt16 nPrfx, /// see XMLTextFieldImportContext
+ const ::rtl::OUString& rLocalName, /// see XMLTextFieldImportContext
+ // for finding appropriate field master (see EndElement())
+ VarType eVarType, /// variable type
+ // config variables:
+ sal_Bool bName, /// see XMLTextFieldImportContext
+ sal_Bool bFormula, /// see XMLTextFieldImportContext
+ sal_Bool bFormulaDefault, /// see XMLTextFieldImportContext
+ sal_Bool bDescription, /// see XMLTextFieldImportContext
+ sal_Bool bHelp, /// see XMLTextFieldImportContext
+ sal_Bool bHint, /// see XMLTextFieldImportContext
+ sal_Bool bVisible, /// see XMLTextFieldImportContext
+ sal_Bool bDisplayFormula, /// see XMLTextFieldImportContext
+ sal_Bool bType, /// see XMLTextFieldImportContext
+ sal_Bool bStyle, /// see XMLTextFieldImportContext
+ sal_Bool bValue, /// see XMLTextFieldImportContext
+ sal_Bool bPresentation); /// see XMLTextFieldImportContext
+
+protected:
+
+ /// create XTextField, attach master and insert into document;
+ /// also calls PrepareTextField
+ virtual void EndElement();
+
+ /// find appropriate field master
+ sal_Bool FindFieldMaster(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xMaster);
+};
+
+
+
+/** import variable set fields (<text:variable-set>) */
+class XMLVariableSetFieldImportContext : public XMLSetVarFieldImportContext
+{
+ const ::rtl::OUString sPropertySubType;
+
+public:
+
+ TYPEINFO();
+
+ XMLVariableSetFieldImportContext(
+ SvXMLImport& rImport, /// XML Import
+ XMLTextImportHelper& rHlp, /// Text import helper
+ sal_uInt16 nPrfx, /// namespace prefix
+ const ::rtl::OUString& rLocalName); /// element name w/o prefix
+
+protected:
+ /// prepare XTextField for insertion into document
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+
+
+/** variable input fields (<text:variable-input>) */
+class XMLVariableInputFieldImportContext : public XMLSetVarFieldImportContext
+{
+ const ::rtl::OUString sPropertySubType;
+ const ::rtl::OUString sPropertyIsInput;
+
+public:
+
+ TYPEINFO();
+
+ XMLVariableInputFieldImportContext(
+ SvXMLImport& rImport, /// XML Import
+ XMLTextImportHelper& rHlp, /// Text import helper
+ sal_uInt16 nPrfx, /// namespace prefix
+ const ::rtl::OUString& rLocalName); /// element name w/o prefix
+
+protected:
+
+ /// prepare XTextField for insertion into document
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+
+
+/** user fields (<text:user-field-get>) */
+class XMLUserFieldImportContext : public XMLSetVarFieldImportContext
+{
+
+public:
+
+ TYPEINFO();
+
+ XMLUserFieldImportContext(
+ SvXMLImport& rImport, /// XML Import
+ XMLTextImportHelper& rHlp, /// Text import helper
+ sal_uInt16 nPrfx, /// namespace prefix
+ const ::rtl::OUString& rLocalName); /// element name w/o prefix
+};
+
+/** user input fields (<text:user-field-input>) */
+class XMLUserFieldInputImportContext : public XMLVarFieldImportContext
+{
+
+public:
+
+ TYPEINFO();
+
+ XMLUserFieldInputImportContext(
+ SvXMLImport& rImport, /// XML Import
+ XMLTextImportHelper& rHlp, /// Text import helper
+ sal_uInt16 nPrfx, /// namespace prefix
+ const ::rtl::OUString& rLocalName); /// element name w/o prefix
+
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+
+
+/** sequence fields (<text:sequence>) */
+class XMLSequenceFieldImportContext : public XMLSetVarFieldImportContext
+{
+ const ::rtl::OUString sPropertyFormula;
+ const ::rtl::OUString sPropertyNumberFormat;
+ const ::rtl::OUString sPropertySequenceValue;
+ ::rtl::OUString sFormula;
+ ::rtl::OUString sNumFormat;
+ ::rtl::OUString sNumFormatSync;
+ ::rtl::OUString sRefName;
+
+ sal_Bool bRefNameOK;
+
+public:
+
+ TYPEINFO();
+
+ XMLSequenceFieldImportContext(
+ SvXMLImport& rImport, /// XML Import
+ XMLTextImportHelper& rHlp, /// Text import helper
+ sal_uInt16 nPrfx, /// namespace prefix
+ const ::rtl::OUString& rLocalName); /// element name w/o prefix
+
+protected:
+
+ /// process attribute values
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// prepare XTextField for insertion into document
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+
+
+
+
+
+/**
+ * variable declaration container for all variable fields
+ * (variable-decls, user-field-decls, sequence-decls)
+ */
+class XMLVariableDeclsImportContext : public SvXMLImportContext
+{
+ enum VarType eVarDeclsContextType;
+ XMLTextImportHelper& rImportHelper;
+
+public:
+
+ TYPEINFO();
+
+ XMLVariableDeclsImportContext(
+ SvXMLImport& rImport, /// XML Import
+ XMLTextImportHelper& rHlp, /// text import helper
+ sal_uInt16 nPrfx, /// namespace prefix
+ const ::rtl::OUString& rLocalName, /// element name w/o prefix
+ enum VarType eVarType); /// variable type
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+};
+
+/**
+ * variable field declarations
+ * (variable-decl, user-field-decl, sequence-decl)
+ */
+class XMLVariableDeclImportContext : public SvXMLImportContext
+{
+ const ::rtl::OUString sPropertyName;
+ const ::rtl::OUString sPropertySubType;
+ const ::rtl::OUString sPropertyNumberingLevel;
+ const ::rtl::OUString sPropertyNumberingSeparator;
+ const ::rtl::OUString sPropertyIsExpression;
+
+ ::rtl::OUString sName;
+ XMLValueImportHelper aValueHelper;
+ sal_Int8 nNumLevel;
+ sal_Unicode cSeparationChar;
+
+public:
+
+ TYPEINFO();
+
+ XMLVariableDeclImportContext(
+ SvXMLImport& rImport, /// XML Import
+ XMLTextImportHelper& rHlp, /// text import helper
+ sal_uInt16 nPrfx, /// namespace prefix
+ const ::rtl::OUString& rLocalName, /// element name w/o prefix
+ const ::com::sun::star::uno::Reference< /// list of element attributes
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList,
+ enum VarType eVarType); /// variable type
+
+ /// get field master for name and rename if appropriate
+ static sal_Bool FindFieldMaster(::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xMaster,
+ SvXMLImport& rImport,
+ XMLTextImportHelper& rHelper,
+ const ::rtl::OUString& sVarName,
+ enum VarType eVarType);
+};
+
+
+
+/** import table formula fields (deprecated; for Writer 2.0 compatibility) */
+class XMLTableFormulaImportContext : public XMLTextFieldImportContext
+{
+ const ::rtl::OUString sPropertyNumberFormat;
+ const ::rtl::OUString sPropertyContent;
+ const ::rtl::OUString sPropertyIsShowFormula;
+ const ::rtl::OUString sPropertyCurrentPresentation;
+
+ XMLValueImportHelper aValueHelper;
+
+ ::rtl::OUString sFormula;
+ sal_Bool bFormulaOK;
+
+ sal_Bool bIsShowFormula;
+
+public:
+
+ TYPEINFO();
+
+ XMLTableFormulaImportContext(
+ SvXMLImport& rImport, /// XML Import
+ XMLTextImportHelper& rHlp, /// text import helper
+ sal_uInt16 nPrfx, /// namespace prefix
+ const ::rtl::OUString& rLocalName); /// element name w/o prefix
+ virtual ~XMLTableFormulaImportContext();
+
+protected:
+
+ /// process attribute values
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// prepare XTextField for insertion into document
+ virtual void PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet);
+};
+
+
+
+/** import database display fields (<text:database-display>) */
+class XMLDatabaseDisplayImportContext : public XMLDatabaseFieldImportContext
+{
+ const ::rtl::OUString sPropertyColumnName;
+ const ::rtl::OUString sPropertyDatabaseFormat;
+ const ::rtl::OUString sPropertyCurrentPresentation;
+ const ::rtl::OUString sPropertyIsVisible;
+
+ XMLValueImportHelper aValueHelper;
+
+ ::rtl::OUString sColumnName;
+ sal_Bool bColumnOK;
+
+ sal_Bool bDisplay;
+ sal_Bool bDisplayOK;
+
+public:
+
+ TYPEINFO();
+
+ XMLDatabaseDisplayImportContext(
+ SvXMLImport& rImport, /// XML Import
+ XMLTextImportHelper& rHlp, /// text import helper
+ sal_uInt16 nPrfx, /// namespace prefix
+ const ::rtl::OUString& rLocalName); /// element name w/o prefix
+
+protected:
+
+ /// process attribute values
+ virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue );
+
+ /// create, prepare and insert database field master and database field
+ virtual void EndElement();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/unointerfacetouniqueidentifiermapper.hxx b/xmloff/inc/unointerfacetouniqueidentifiermapper.hxx
new file mode 100644
index 000000000000..0baf405c6b2e
--- /dev/null
+++ b/xmloff/inc/unointerfacetouniqueidentifiermapper.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+#ifndef __COMPHELPER_UNOINTERFACETOUNIQUEIDENTIFIERMAPPER__
+#define __COMPHELPER_UNOINTERFACETOUNIQUEIDENTIFIERMAPPER__
+
+#include <map>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/XInterface.hpp>
+
+namespace comphelper
+{
+
+typedef ::std::map< rtl::OUString, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > > IdMap_t;
+
+class UnoInterfaceToUniqueIdentifierMapper
+{
+public:
+ UnoInterfaceToUniqueIdentifierMapper();
+
+ /** returns a unique identifier for the given uno object. IF a uno object is
+ registered more than once, the returned identifier is always the same.
+ */
+ const rtl::OUString& registerReference( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rInterface );
+
+ /** registers the given uno object with the given identifier.
+
+ @returns
+ false, if the given identifier already exists and is not associated with the given interface
+ */
+ bool registerReference( const rtl::OUString& rIdentifier, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rInterface );
+
+ /** @returns
+ the identifier for the given uno object. If this uno object is not already
+ registered, an empty string is returned
+ */
+ const rtl::OUString& getIdentifier( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rInterface ) const;
+
+ /** @returns
+ the uno object that is registered with the given identifier. If no uno object
+ is registered with the given identifier, an empty reference is returned.
+ */
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& getReference( const rtl::OUString& rIdentifier ) const;
+
+private:
+ bool findReference( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rInterface, IdMap_t::const_iterator& rIter ) const;
+ bool findIdentifier( const rtl::OUString& rIdentifier, IdMap_t::const_iterator& rIter ) const;
+
+ IdMap_t maEntries;
+ sal_Int32 mnNextId;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xexptran.hxx b/xmloff/inc/xexptran.hxx
new file mode 100644
index 000000000000..bd2c55d6557e
--- /dev/null
+++ b/xmloff/inc/xexptran.hxx
@@ -0,0 +1,204 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XEXPTRANSFORM_HXX
+#define _XEXPTRANSFORM_HXX
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/drawing/PointSequenceSequence.hpp>
+#include <com/sun/star/drawing/PointSequence.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/drawing/FlagSequenceSequence.hpp>
+#include <com/sun/star/drawing/FlagSequence.hpp>
+#include <com/sun/star/drawing/HomogenMatrix.hpp>
+#include <tools/mapunit.hxx>
+
+#include <vector>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+struct ImpSdXMLExpTransObj2DBase;
+struct ImpSdXMLExpTransObj3DBase;
+class SvXMLUnitConverter;
+
+namespace basegfx
+{
+ class B2DTuple;
+ class B2DHomMatrix;
+ class B3DTuple;
+ class B3DHomMatrix;
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+
+typedef ::std::vector< ImpSdXMLExpTransObj2DBase* > ImpSdXMLExpTransObj2DBaseList;
+typedef ::std::vector< ImpSdXMLExpTransObj3DBase* > ImpSdXMLExpTransObj3DBaseList;
+
+//////////////////////////////////////////////////////////////////////////////
+
+class SdXMLImExTransform2D
+{
+ ImpSdXMLExpTransObj2DBaseList maList;
+ rtl::OUString msString;
+
+ void EmptyList();
+
+public:
+ SdXMLImExTransform2D() {}
+ SdXMLImExTransform2D(const rtl::OUString& rNew, const SvXMLUnitConverter& rConv);
+ ~SdXMLImExTransform2D() { EmptyList(); }
+
+ void AddRotate(double fNew);
+ void AddScale(const ::basegfx::B2DTuple& rNew);
+ void AddTranslate(const ::basegfx::B2DTuple& rNew);
+ void AddSkewX(double fNew);
+ void AddSkewY(double fNew);
+ void AddMatrix(const ::basegfx::B2DHomMatrix& rNew);
+
+ bool NeedsAction() const { return !maList.empty(); }
+ void GetFullTransform(::basegfx::B2DHomMatrix& rFullTrans);
+ const rtl::OUString& GetExportString(const SvXMLUnitConverter& rConv);
+ void SetString(const rtl::OUString& rNew, const SvXMLUnitConverter& rConv);
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+class SdXMLImExTransform3D
+{
+ ImpSdXMLExpTransObj3DBaseList maList;
+ rtl::OUString msString;
+
+ void EmptyList();
+
+public:
+ SdXMLImExTransform3D() {}
+ SdXMLImExTransform3D(const rtl::OUString& rNew, const SvXMLUnitConverter& rConv);
+ ~SdXMLImExTransform3D() { EmptyList(); }
+
+ void AddRotateX(double fNew);
+ void AddRotateY(double fNew);
+ void AddRotateZ(double fNew);
+ void AddScale(const ::basegfx::B3DTuple& rNew);
+ void AddTranslate(const ::basegfx::B3DTuple& rNew);
+ void AddMatrix(const ::basegfx::B3DHomMatrix& rNew);
+
+ void AddHomogenMatrix(const com::sun::star::drawing::HomogenMatrix& xHomMat);
+ bool NeedsAction() const { return !maList.empty(); }
+ void GetFullTransform(::basegfx::B3DHomMatrix& rFullTrans);
+ bool GetFullHomogenTransform(com::sun::star::drawing::HomogenMatrix& xHomMat);
+ const rtl::OUString& GetExportString(const SvXMLUnitConverter& rConv);
+ void SetString(const rtl::OUString& rNew, const SvXMLUnitConverter& rConv);
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+class SdXMLImExViewBox
+{
+ rtl::OUString msString;
+ sal_Int32 mnX;
+ sal_Int32 mnY;
+ sal_Int32 mnW;
+ sal_Int32 mnH;
+
+public:
+ SdXMLImExViewBox(sal_Int32 nX = 0L, sal_Int32 nY = 0L, sal_Int32 nW = 1000L, sal_Int32 nH = 1000L);
+ SdXMLImExViewBox(const rtl::OUString& rNew, const SvXMLUnitConverter& rConv);
+
+ sal_Int32 GetX() const { return mnX; }
+ sal_Int32 GetY() const { return mnY; }
+ sal_Int32 GetWidth() const { return mnW; }
+ sal_Int32 GetHeight() const { return mnH; }
+ const rtl::OUString& GetExportString();
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+class SdXMLImExPointsElement
+{
+ rtl::OUString msString;
+ com::sun::star::drawing::PointSequenceSequence maPoly;
+
+public:
+ SdXMLImExPointsElement(com::sun::star::drawing::PointSequence* pPoints,
+ const SdXMLImExViewBox& rViewBox,
+ const com::sun::star::awt::Point& rObjectPos,
+ const com::sun::star::awt::Size& rObjectSize,
+ // #96328#
+ const bool bClosed = true);
+ SdXMLImExPointsElement(const rtl::OUString& rNew,
+ const SdXMLImExViewBox& rViewBox,
+ const com::sun::star::awt::Point& rObjectPos,
+ const com::sun::star::awt::Size& rObjectSize,
+ const SvXMLUnitConverter& rConv);
+
+ const rtl::OUString& GetExportString() const { return msString; }
+ const com::sun::star::drawing::PointSequenceSequence& GetPointSequenceSequence() const { return maPoly; }
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+class SdXMLImExSvgDElement
+{
+ rtl::OUString msString;
+ const SdXMLImExViewBox& mrViewBox;
+ bool mbIsClosed;
+ bool mbIsCurve;
+
+ sal_Int32 mnLastX;
+ sal_Int32 mnLastY;
+
+ com::sun::star::drawing::PointSequenceSequence maPoly;
+ com::sun::star::drawing::FlagSequenceSequence maFlag;
+
+public:
+ SdXMLImExSvgDElement(const SdXMLImExViewBox& rViewBox);
+ SdXMLImExSvgDElement(const rtl::OUString& rNew,
+ const SdXMLImExViewBox& rViewBox,
+ const com::sun::star::awt::Point& rObjectPos,
+ const com::sun::star::awt::Size& rObjectSize,
+ const SvXMLUnitConverter& rConv);
+
+ void AddPolygon(
+ com::sun::star::drawing::PointSequence* pPoints,
+ com::sun::star::drawing::FlagSequence* pFlags,
+ const com::sun::star::awt::Point& rObjectPos,
+ const com::sun::star::awt::Size& rObjectSize,
+ bool bClosed = false, bool bRelative = true);
+
+ const rtl::OUString& GetExportString() const { return msString; }
+ bool IsClosed() const { return mbIsClosed; }
+ bool IsCurve() const { return mbIsCurve; }
+ const com::sun::star::drawing::PointSequenceSequence& GetPointSequenceSequence() const { return maPoly; }
+ const com::sun::star::drawing::FlagSequenceSequence& GetFlagSequenceSequence() const { return maFlag; }
+};
+
+
+#endif // _XEXPTRANSFORM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmlehelp.hxx b/xmloff/inc/xmlehelp.hxx
new file mode 100644
index 000000000000..10595408092b
--- /dev/null
+++ b/xmloff/inc/xmlehelp.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLEHELP_HXX
+#define _XMLOFF_XMLEHELP_HXX
+
+#include <tools/mapunit.hxx>
+
+namespace rtl { class OUStringBuffer; }
+
+class SvXMLExportHelper
+{
+public:
+ static void AddLength( sal_Int32 nValue, MapUnit eValueUnit,
+ ::rtl::OUStringBuffer& rOut,
+ MapUnit eOutUnit );
+ static void AddPercentage( sal_Int32 nVal, ::rtl::OUStringBuffer& rOut );
+ static double GetConversionFactor(::rtl::OUStringBuffer& rUnit,
+ const MapUnit eCoreUnit, const MapUnit eDestUnit);
+ static MapUnit GetUnitFromString(const ::rtl::OUString& rString,
+ MapUnit eDefaultUnit);
+};
+
+
+
+#endif // _XMLOFF_XMLEHELP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/DashStyle.hxx b/xmloff/inc/xmloff/DashStyle.hxx
new file mode 100644
index 000000000000..5d3d5b0615b4
--- /dev/null
+++ b/xmloff/inc/xmloff/DashStyle.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_DASHSTYLE_HXX
+#define _XMLOFF_DASHSTYLE_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include <sal/types.h>
+
+class SvXMLImport;
+class SvXMLExport;
+namespace com { namespace sun { namespace star {
+ namespace uno { template<class A> class Reference; }
+ namespace xml { namespace sax { class XAttributeList; } }
+ namespace uno { class Any; }
+} } }
+namespace rtl { class OUString; }
+
+
+class XMLOFF_DLLPUBLIC XMLDashStyleImport
+{
+ SvXMLImport& rImport;
+
+public:
+ XMLDashStyleImport( SvXMLImport& rImport );
+ ~XMLDashStyleImport();
+
+ sal_Bool importXML(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList >& xAttrList,
+ ::com::sun::star::uno::Any& rValue,
+ ::rtl::OUString& rStrName );
+};
+
+
+class XMLOFF_DLLPUBLIC XMLDashStyleExport
+{
+ SvXMLExport& rExport;
+
+public:
+ XMLDashStyleExport( SvXMLExport& rExport );
+ ~XMLDashStyleExport();
+
+ sal_Bool exportXML( const ::rtl::OUString& rStrName,
+ const ::com::sun::star::uno::Any& rValue );
+};
+
+#endif // _XMLOFF_DASHSTYLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/DocumentSettingsContext.hxx b/xmloff/inc/xmloff/DocumentSettingsContext.hxx
new file mode 100644
index 000000000000..e02a60fa689f
--- /dev/null
+++ b/xmloff/inc/xmloff/DocumentSettingsContext.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_DOCUMENTSETTINGSCONTEXT_HXX
+#define _XMLOFF_DOCUMENTSETTINGSCONTEXT_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include <xmloff/xmlictxt.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+#include <memory>
+
+struct XMLDocumentSettingsContext_Data;
+
+class XMLOFF_DLLPUBLIC XMLDocumentSettingsContext : public SvXMLImportContext
+{
+ ::std::auto_ptr< XMLDocumentSettingsContext_Data > m_pData;
+
+public:
+ XMLDocumentSettingsContext(SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList);
+ virtual ~XMLDocumentSettingsContext();
+
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
+ virtual void EndElement();
+
+private:
+ XMLDocumentSettingsContext(); // never implemented
+ XMLDocumentSettingsContext( const XMLDocumentSettingsContext& ); // never implemented
+ XMLDocumentSettingsContext& operator=( const XMLDocumentSettingsContext& ); // never implemented
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/EnumPropertyHdl.hxx b/xmloff/inc/xmloff/EnumPropertyHdl.hxx
new file mode 100644
index 000000000000..3e9d14d91f30
--- /dev/null
+++ b/xmloff/inc/xmloff/EnumPropertyHdl.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_ENUMPROPERTYHANDLER_HXX
+#define _XMLOFF_ENUMPROPERTYHANDLER_HXX
+
+#include <xmloff/xmlprhdl.hxx>
+#include <com/sun/star/uno/Type.h>
+#include <xmloff/xmlement.hxx>
+
+/**
+ PropertyHandler for a generic xml enumeration type:
+*/
+class XMLOFF_DLLPUBLIC XMLEnumPropertyHdl : public XMLPropertyHandler
+{
+private:
+ const SvXMLEnumMapEntry* mpEnumMap;
+ const ::com::sun::star::uno::Type & mrType;
+
+public:
+ XMLEnumPropertyHdl( const SvXMLEnumMapEntry* pEnumMap, const ::com::sun::star::uno::Type & rType ) : mpEnumMap( pEnumMap ), mrType( rType ) {}
+ virtual ~XMLEnumPropertyHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_ENUMPROPERTYHANDLER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/GradientStyle.hxx b/xmloff/inc/xmloff/GradientStyle.hxx
new file mode 100644
index 000000000000..89b3739312a7
--- /dev/null
+++ b/xmloff/inc/xmloff/GradientStyle.hxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_GRADIENTSTYLE_HXX
+#define _XMLOFF_GRADIENTSTYLE_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include <sal/types.h>
+
+class SvXMLImport;
+class SvXMLExport;
+namespace com { namespace sun { namespace star {
+ namespace uno { template<class A> class Reference; }
+ namespace xml { namespace sax { class XAttributeList; } }
+ namespace uno { class Any; }
+} } }
+namespace rtl { class OUString; }
+
+
+class XMLOFF_DLLPUBLIC XMLGradientStyleImport
+{
+ SvXMLImport& rImport;
+
+public:
+ XMLGradientStyleImport( SvXMLImport& rImport );
+ ~XMLGradientStyleImport();
+
+ sal_Bool importXML(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList >& xAttrList,
+ ::com::sun::star::uno::Any& rValue,
+ ::rtl::OUString& rStrName );
+};
+
+
+class XMLOFF_DLLPUBLIC XMLGradientStyleExport
+{
+ SvXMLExport& rExport;
+
+public:
+ XMLGradientStyleExport( SvXMLExport& rExport );
+ ~XMLGradientStyleExport();
+
+ sal_Bool exportXML(
+ const ::rtl::OUString& rStrName,
+ const ::com::sun::star::uno::Any& rValue );
+};
+
+#endif // _XMLOFF_GRADIENTSTYLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/HatchStyle.hxx b/xmloff/inc/xmloff/HatchStyle.hxx
new file mode 100644
index 000000000000..c6ff364ee4f6
--- /dev/null
+++ b/xmloff/inc/xmloff/HatchStyle.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_HATCHSTYLE_HXX
+#define _XMLOFF_HATCHSTYLE_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include <sal/types.h>
+
+class SvXMLImport;
+class SvXMLExport;
+namespace com { namespace sun { namespace star {
+ namespace uno { template<class A> class Reference; }
+ namespace xml { namespace sax { class XAttributeList; } }
+ namespace uno { class Any; }
+} } }
+namespace rtl { class OUString; }
+
+
+class XMLOFF_DLLPUBLIC XMLHatchStyleImport
+{
+ SvXMLImport& rImport;
+
+public:
+ XMLHatchStyleImport( SvXMLImport& rImport );
+ ~XMLHatchStyleImport();
+
+ sal_Bool importXML(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ ::com::sun::star::uno::Any& rValue,
+ ::rtl::OUString& rStrName );
+};
+
+class XMLOFF_DLLPUBLIC XMLHatchStyleExport
+{
+ SvXMLExport& rExport;
+
+public:
+ XMLHatchStyleExport( SvXMLExport& rExport );
+ ~XMLHatchStyleExport();
+
+ sal_Bool exportXML( const ::rtl::OUString& rStrName, const ::com::sun::star::uno::Any& rValue );
+};
+
+#endif // _XMLOFF_HATCHELEMENT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/ImageStyle.hxx b/xmloff/inc/xmloff/ImageStyle.hxx
new file mode 100644
index 000000000000..f35e1da77097
--- /dev/null
+++ b/xmloff/inc/xmloff/ImageStyle.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_IMAGESTYLE_HXX
+#define _XMLOFF_IMAGESTYLE_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include "sal/types.h"
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+
+class SvXMLNamespaceMap;
+class SvXMLAttributeList;
+class SvXMLUnitConverter;
+class SvXMLExport;
+class SvXMLImport;
+
+class XMLOFF_DLLPUBLIC XMLImageStyle
+{
+public:
+ XMLImageStyle();
+ ~XMLImageStyle();
+
+ sal_Bool exportXML( const ::rtl::OUString& rStrName, const ::com::sun::star::uno::Any& rValue, SvXMLExport& rExport );
+ sal_Bool importXML( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList, ::com::sun::star::uno::Any& rValue, ::rtl::OUString& rStrName, SvXMLImport& rImport );
+
+private:
+
+ SAL_DLLPRIVATE sal_Bool ImpExportXML( const ::rtl::OUString& rStrName, const ::com::sun::star::uno::Any& rValue,
+ SvXMLExport& rExport );
+ SAL_DLLPRIVATE sal_Bool ImpImportXML( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList,
+ ::com::sun::star::uno::Any& rValue, ::rtl::OUString& rStrName,
+ SvXMLImport& rImport );
+};
+
+#endif // _XMLOFF_IMAGESTYLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/MarkerStyle.hxx b/xmloff/inc/xmloff/MarkerStyle.hxx
new file mode 100644
index 000000000000..11c214c7343e
--- /dev/null
+++ b/xmloff/inc/xmloff/MarkerStyle.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_MARKERSTYLE_HXX
+#define _XMLOFF_MARKERSTYLE_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include <sal/types.h>
+
+class SvXMLImport;
+class SvXMLExport;
+namespace com { namespace sun { namespace star {
+ namespace uno { template<class A> class Reference; }
+ namespace xml { namespace sax { class XAttributeList; } }
+ namespace uno { class Any; }
+} } }
+namespace rtl { class OUString; }
+
+
+class XMLOFF_DLLPUBLIC XMLMarkerStyleImport
+{
+ SvXMLImport& rImport;
+
+public:
+ XMLMarkerStyleImport( SvXMLImport& rImport );
+ ~XMLMarkerStyleImport();
+
+ sal_Bool importXML(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList >& xAttrList,
+ ::com::sun::star::uno::Any& rValue,
+ ::rtl::OUString& rStrName );
+};
+
+class XMLOFF_DLLPUBLIC XMLMarkerStyleExport
+{
+ SvXMLExport& rExport;
+
+public:
+ XMLMarkerStyleExport( SvXMLExport& rExport );
+ ~XMLMarkerStyleExport();
+
+ sal_Bool exportXML(
+ const ::rtl::OUString& rStrName,
+ const ::com::sun::star::uno::Any& rValue );
+};
+
+#endif // _XMLOFF_MARKERSTYLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/NamedBoolPropertyHdl.hxx b/xmloff/inc/xmloff/NamedBoolPropertyHdl.hxx
new file mode 100644
index 000000000000..712b269cd57e
--- /dev/null
+++ b/xmloff/inc/xmloff/NamedBoolPropertyHdl.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_NAMEDBOOLPROPERTYHANDLER_HXX
+#define _XMLOFF_NAMEDBOOLPROPERTYHANDLER_HXX
+
+#include <xmloff/xmlprhdl.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <com/sun/star/uno/Type.h>
+#include <xmloff/xmlement.hxx>
+
+/**
+ PropertyHandler for a named xml bool type:
+*/
+class XMLNamedBoolPropertyHdl : public XMLPropertyHandler
+{
+private:
+ const ::rtl::OUString maTrueStr;
+ const ::rtl::OUString maFalseStr;
+
+public:
+ XMLNamedBoolPropertyHdl( const ::rtl::OUString& rTrueStr, const ::rtl::OUString& rFalseStr ) : maTrueStr( rTrueStr ), maFalseStr( rFalseStr ) {}
+
+ XMLNamedBoolPropertyHdl(
+ ::xmloff::token::XMLTokenEnum eTrue,
+ ::xmloff::token::XMLTokenEnum eFalse
+ ) :
+ maTrueStr( ::xmloff::token::GetXMLToken( eTrue ) ),
+ maFalseStr( ::xmloff::token::GetXMLToken( eFalse ) )
+ {}
+
+ virtual ~XMLNamedBoolPropertyHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_NAMEDBOOLPROPERTYHANDLER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/PageMasterStyleMap.hxx b/xmloff/inc/xmloff/PageMasterStyleMap.hxx
new file mode 100644
index 000000000000..84685a780fdb
--- /dev/null
+++ b/xmloff/inc/xmloff/PageMasterStyleMap.hxx
@@ -0,0 +1,159 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PAGEMASTERSTYLEMAP_HXX_
+#define _XMLOFF_PAGEMASTERSTYLEMAP_HXX_
+
+#include <xmloff/maptype.hxx>
+#include <xmloff/xmltypes.hxx>
+#include <xmloff/contextid.hxx>
+
+//______________________________________________________________________________
+
+#define XML_PM_TYPE_PAGESTYLELAYOUT (XML_PM_TYPES_START + 0)
+#define XML_PM_TYPE_NUMFORMAT (XML_PM_TYPES_START + 1)
+#define XML_PM_TYPE_NUMLETTERSYNC (XML_PM_TYPES_START + 2)
+#define XML_PM_TYPE_PAPERTRAYNUMBER (XML_PM_TYPES_START + 3)
+#define XML_PM_TYPE_PRINTORIENTATION (XML_PM_TYPES_START + 4)
+#define XML_PM_TYPE_PRINTANNOTATIONS (XML_PM_TYPES_START + 5)
+#define XML_PM_TYPE_PRINTCHARTS (XML_PM_TYPES_START + 6)
+#define XML_PM_TYPE_PRINTDRAWING (XML_PM_TYPES_START + 7)
+#define XML_PM_TYPE_PRINTFORMULAS (XML_PM_TYPES_START + 8)
+#define XML_PM_TYPE_PRINTGRID (XML_PM_TYPES_START + 9)
+#define XML_PM_TYPE_PRINTHEADERS (XML_PM_TYPES_START + 10)
+#define XML_PM_TYPE_PRINTOBJECTS (XML_PM_TYPES_START + 11)
+#define XML_PM_TYPE_PRINTZEROVALUES (XML_PM_TYPES_START + 12)
+#define XML_PM_TYPE_PRINTPAGEORDER (XML_PM_TYPES_START + 13)
+#define XML_PM_TYPE_FIRSTPAGENUMBER (XML_PM_TYPES_START + 14)
+#define XML_PM_TYPE_CENTER_HORIZONTAL (XML_PM_TYPES_START + 15)
+#define XML_PM_TYPE_CENTER_VERTICAL (XML_PM_TYPES_START + 16)
+
+// control flags
+#define CTF_PM_FLAGMASK (XML_PM_CTF_START + 0x0F00)
+#define CTF_PM_HEADERFLAG (XML_PM_CTF_START + 0x0100)
+#define CTF_PM_FOOTERFLAG (XML_PM_CTF_START + 0x0200)
+#define CTF_PM_PRINTMASK (XML_PM_CTF_START + 0x1000)
+// page master
+#define CTF_PM_BORDERALL (XML_PM_CTF_START + 0x0001)
+#define CTF_PM_BORDERTOP (XML_PM_CTF_START + 0x0002)
+#define CTF_PM_BORDERBOTTOM (XML_PM_CTF_START + 0x0003)
+#define CTF_PM_BORDERLEFT (XML_PM_CTF_START + 0x0004)
+#define CTF_PM_BORDERRIGHT (XML_PM_CTF_START + 0x0005)
+#define CTF_PM_BORDERWIDTHALL (XML_PM_CTF_START + 0x0006)
+#define CTF_PM_BORDERWIDTHTOP (XML_PM_CTF_START + 0x0007)
+#define CTF_PM_BORDERWIDTHBOTTOM (XML_PM_CTF_START + 0x0008)
+#define CTF_PM_BORDERWIDTHLEFT (XML_PM_CTF_START + 0x0009)
+#define CTF_PM_BORDERWIDTHRIGHT (XML_PM_CTF_START + 0x000A)
+#define CTF_PM_PADDINGALL (XML_PM_CTF_START + 0x000B)
+#define CTF_PM_PADDINGTOP (XML_PM_CTF_START + 0x000C)
+#define CTF_PM_PADDINGBOTTOM (XML_PM_CTF_START + 0x000D)
+#define CTF_PM_PADDINGLEFT (XML_PM_CTF_START + 0x000E)
+#define CTF_PM_PADDINGRIGHT (XML_PM_CTF_START + 0x000F)
+#define CTF_PM_TEXTCOLUMNS (XML_PM_CTF_START + 0x0010)
+#define CTF_PM_REGISTER_STYLE (XML_PM_CTF_START + 0x0011)
+#define CTF_PM_PRINT_ANNOTATIONS (CTF_PM_PRINTMASK|(XML_PM_CTF_START + 0x0012))
+#define CTF_PM_PRINT_CHARTS (CTF_PM_PRINTMASK|(XML_PM_CTF_START + 0x0013))
+#define CTF_PM_PRINT_DRAWING (CTF_PM_PRINTMASK|(XML_PM_CTF_START + 0x0014))
+#define CTF_PM_PRINT_FORMULAS (CTF_PM_PRINTMASK|(XML_PM_CTF_START + 0x0015))
+#define CTF_PM_PRINT_GRID (CTF_PM_PRINTMASK|(XML_PM_CTF_START + 0x0016))
+#define CTF_PM_PRINT_HEADERS (CTF_PM_PRINTMASK|(XML_PM_CTF_START + 0x0017))
+#define CTF_PM_PRINT_OBJECTS (CTF_PM_PRINTMASK|(XML_PM_CTF_START + 0x0018))
+#define CTF_PM_PRINT_ZEROVALUES (CTF_PM_PRINTMASK|(XML_PM_CTF_START + 0x0019))
+
+#define CTF_PM_PAGEUSAGE (XML_PM_CTF_START + 0x0031)
+#define CTF_PM_GRAPHICPOSITION (XML_PM_CTF_START + 0x0032)
+#define CTF_PM_GRAPHICFILTER (XML_PM_CTF_START + 0x0033)
+#define CTF_PM_GRAPHICURL (XML_PM_CTF_START + 0x0034)
+
+#define CTF_PM_SCALETO (XML_PM_CTF_START + 0x0051) // calc specific
+#define CTF_PM_SCALETOPAGES (XML_PM_CTF_START + 0x0052)
+#define CTF_PM_SCALETOX (XML_PM_CTF_START + 0x0053)
+#define CTF_PM_SCALETOY (XML_PM_CTF_START + 0x0054)
+#define CTF_PM_STANDARD_MODE (XML_PM_CTF_START + 0x0055)
+#define CTP_PM_GRID_BASE_WIDTH (XML_PM_CTF_START + 0x0056)
+#define CTP_PM_GRID_SNAP_TO_CHARS (XML_PM_CTF_START + 0x0057)
+// header
+#define CTF_PM_HEADERBORDERALL (CTF_PM_HEADERFLAG|CTF_PM_BORDERALL)
+#define CTF_PM_HEADERBORDERTOP (CTF_PM_HEADERFLAG|CTF_PM_BORDERTOP)
+#define CTF_PM_HEADERBORDERBOTTOM (CTF_PM_HEADERFLAG|CTF_PM_BORDERBOTTOM)
+#define CTF_PM_HEADERBORDERLEFT (CTF_PM_HEADERFLAG|CTF_PM_BORDERLEFT)
+#define CTF_PM_HEADERBORDERRIGHT (CTF_PM_HEADERFLAG|CTF_PM_BORDERRIGHT)
+#define CTF_PM_HEADERBORDERWIDTHALL (CTF_PM_HEADERFLAG|CTF_PM_BORDERWIDTHALL)
+#define CTF_PM_HEADERBORDERWIDTHTOP (CTF_PM_HEADERFLAG|CTF_PM_BORDERWIDTHTOP)
+#define CTF_PM_HEADERBORDERWIDTHBOTTOM (CTF_PM_HEADERFLAG|CTF_PM_BORDERWIDTHBOTTOM)
+#define CTF_PM_HEADERBORDERWIDTHLEFT (CTF_PM_HEADERFLAG|CTF_PM_BORDERWIDTHLEFT)
+#define CTF_PM_HEADERBORDERWIDTHRIGHT (CTF_PM_HEADERFLAG|CTF_PM_BORDERWIDTHRIGHT)
+#define CTF_PM_HEADERPADDINGALL (CTF_PM_HEADERFLAG|CTF_PM_PADDINGALL)
+#define CTF_PM_HEADERPADDINGTOP (CTF_PM_HEADERFLAG|CTF_PM_PADDINGTOP)
+#define CTF_PM_HEADERPADDINGBOTTOM (CTF_PM_HEADERFLAG|CTF_PM_PADDINGBOTTOM)
+#define CTF_PM_HEADERPADDINGLEFT (CTF_PM_HEADERFLAG|CTF_PM_PADDINGLEFT)
+#define CTF_PM_HEADERPADDINGRIGHT (CTF_PM_HEADERFLAG|CTF_PM_PADDINGRIGHT)
+#define CTF_PM_HEADERHEIGHT (CTF_PM_HEADERFLAG|(XML_PM_CTF_START + 0x0031))
+#define CTF_PM_HEADERMINHEIGHT (CTF_PM_HEADERFLAG|(XML_PM_CTF_START + 0x0032))
+#define CTF_PM_HEADERDYNAMIC (CTF_PM_HEADERFLAG|(XML_PM_CTF_START + 0x0033))
+#define CTF_PM_HEADERGRAPHICPOSITION (CTF_PM_HEADERFLAG|(XML_PM_CTF_START + 0x0034))
+#define CTF_PM_HEADERGRAPHICFILTER (CTF_PM_HEADERFLAG|(XML_PM_CTF_START + 0x0035))
+#define CTF_PM_HEADERGRAPHICURL (CTF_PM_HEADERFLAG|(XML_PM_CTF_START + 0x0036))
+// footer
+#define CTF_PM_FOOTERBORDERALL (CTF_PM_FOOTERFLAG|CTF_PM_BORDERALL)
+#define CTF_PM_FOOTERBORDERTOP (CTF_PM_FOOTERFLAG|CTF_PM_BORDERTOP)
+#define CTF_PM_FOOTERBORDERBOTTOM (CTF_PM_FOOTERFLAG|CTF_PM_BORDERBOTTOM)
+#define CTF_PM_FOOTERBORDERLEFT (CTF_PM_FOOTERFLAG|CTF_PM_BORDERLEFT)
+#define CTF_PM_FOOTERBORDERRIGHT (CTF_PM_FOOTERFLAG|CTF_PM_BORDERRIGHT)
+#define CTF_PM_FOOTERBORDERWIDTHALL (CTF_PM_FOOTERFLAG|CTF_PM_BORDERWIDTHALL)
+#define CTF_PM_FOOTERBORDERWIDTHTOP (CTF_PM_FOOTERFLAG|CTF_PM_BORDERWIDTHTOP)
+#define CTF_PM_FOOTERBORDERWIDTHBOTTOM (CTF_PM_FOOTERFLAG|CTF_PM_BORDERWIDTHBOTTOM)
+#define CTF_PM_FOOTERBORDERWIDTHLEFT (CTF_PM_FOOTERFLAG|CTF_PM_BORDERWIDTHLEFT)
+#define CTF_PM_FOOTERBORDERWIDTHRIGHT (CTF_PM_FOOTERFLAG|CTF_PM_BORDERWIDTHRIGHT)
+#define CTF_PM_FOOTERPADDINGALL (CTF_PM_FOOTERFLAG|CTF_PM_PADDINGALL)
+#define CTF_PM_FOOTERPADDINGTOP (CTF_PM_FOOTERFLAG|CTF_PM_PADDINGTOP)
+#define CTF_PM_FOOTERPADDINGBOTTOM (CTF_PM_FOOTERFLAG|CTF_PM_PADDINGBOTTOM)
+#define CTF_PM_FOOTERPADDINGLEFT (CTF_PM_FOOTERFLAG|CTF_PM_PADDINGLEFT)
+#define CTF_PM_FOOTERPADDINGRIGHT (CTF_PM_FOOTERFLAG|CTF_PM_PADDINGRIGHT)
+#define CTF_PM_FOOTERHEIGHT (CTF_PM_FOOTERFLAG|(XML_PM_CTF_START + 0x0031))
+#define CTF_PM_FOOTERMINHEIGHT (CTF_PM_FOOTERFLAG|(XML_PM_CTF_START + 0x0032))
+#define CTF_PM_FOOTERDYNAMIC (CTF_PM_FOOTERFLAG|(XML_PM_CTF_START + 0x0033))
+#define CTF_PM_FOOTERGRAPHICPOSITION (CTF_PM_FOOTERFLAG|(XML_PM_CTF_START + 0x0034))
+#define CTF_PM_FOOTERGRAPHICFILTER (CTF_PM_FOOTERFLAG|(XML_PM_CTF_START + 0x0035))
+#define CTF_PM_FOOTERGRAPHICURL (CTF_PM_FOOTERFLAG|(XML_PM_CTF_START + 0x0036))
+#define CTF_PM_FTN_HEIGTH (XML_PM_CTF_START + 0x0060)
+#define CTF_PM_FTN_LINE_WEIGTH (XML_PM_CTF_START + 0x0061)
+#define CTF_PM_FTN_LINE_COLOR (XML_PM_CTF_START + 0x0062)
+#define CTF_PM_FTN_LINE_WIDTH (XML_PM_CTF_START + 0x0063)
+#define CTF_PM_FTN_LINE_ADJUST (XML_PM_CTF_START + 0x0064)
+#define CTF_PM_FTN_LINE_DISTANCE (XML_PM_CTF_START + 0x0065)
+#define CTF_PM_FTN_DISTANCE (XML_PM_CTF_START + 0x0066)
+#define CTF_PM_FTN_LINE_STYLE (XML_PM_CTF_START + 0x0067)
+
+extern const XMLPropertyMapEntry aXMLPageMasterStyleMap[];
+extern const XMLPropertyMapEntry aXMLPageMasterHeaderImportStyleMap[];
+extern const XMLPropertyMapEntry aXMLPageMasterFooterImportStyleMap[];
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/ProgressBarHelper.hxx b/xmloff/inc/xmloff/ProgressBarHelper.hxx
new file mode 100644
index 000000000000..749ab46f8b82
--- /dev/null
+++ b/xmloff/inc/xmloff/ProgressBarHelper.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PROGRESSBARHELPER_HXX
+#define _XMLOFF_PROGRESSBARHELPER_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include <com/sun/star/task/XStatusIndicator.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+
+#define XML_PROGRESSRANGE "ProgressRange"
+#define XML_PROGRESSMAX "ProgressMax"
+#define XML_PROGRESSCURRENT "ProgressCurrent"
+#define XML_PROGRESSREPEAT "ProgressRepeat"
+
+class XMLOFF_DLLPUBLIC ProgressBarHelper
+{
+ ::com::sun::star::uno::Reference < ::com::sun::star::task::XStatusIndicator > xStatusIndicator;
+ sal_Int32 nRange;
+ sal_Int32 nReference;
+ sal_Int32 nValue;
+ double fOldPercent;
+ sal_Bool bStrict;
+ // #96469#; if the value goes over the Range the progressbar starts again
+ sal_Bool bRepeat;
+
+#ifdef DBG_UTIL
+ sal_Bool bFailure;
+#endif
+public:
+ ProgressBarHelper(const ::com::sun::star::uno::Reference < ::com::sun::star::task::XStatusIndicator>& xStatusIndicator,
+ const sal_Bool bStrict);
+ ~ProgressBarHelper();
+
+ void SetText(::rtl::OUString& rText) { if (xStatusIndicator.is()) xStatusIndicator->setText(rText); }
+ void SetRange(sal_Int32 nVal) { nRange = nVal; }
+ void SetReference(sal_Int32 nVal) { nReference = nVal; }
+ void SetValue(sal_Int32 nValue);
+ void SetRepeat(sal_Bool bValue) { bRepeat = bValue; }
+ inline void Increment(sal_Int32 nInc = 1) { SetValue( nValue+nInc ); }
+ void End() { if (xStatusIndicator.is()) xStatusIndicator->end(); }
+
+ // set the new reference and returns the new value which gives the
+ // Progress Bar the sam position as before
+ sal_Int32 ChangeReference(sal_Int32 nNewReference);
+
+ sal_Int32 GetReference() { return nReference; }
+ sal_Int32 GetValue() { return nValue; }
+ sal_Bool GetRepeat() { return bRepeat; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/PropertySetInfoHash.hxx b/xmloff/inc/xmloff/PropertySetInfoHash.hxx
new file mode 100644
index 000000000000..802f2445c770
--- /dev/null
+++ b/xmloff/inc/xmloff/PropertySetInfoHash.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PROPERTYSETINFOHASH_HXX
+#define _XMLOFF_PROPERTYSETINFOHASH_HXX
+
+#include <xmloff/PropertySetInfoKey.hxx>
+
+#include <string.h>
+#include <memory>
+
+struct PropertySetInfoHash
+{
+ inline size_t operator()( const PropertySetInfoKey& r ) const;
+ inline bool operator()( const PropertySetInfoKey& r1,
+ const PropertySetInfoKey& r2 ) const;
+};
+
+inline size_t PropertySetInfoHash::operator()(
+ const PropertySetInfoKey& r ) const
+{
+ const sal_Int32* pBytesAsInt32Array =
+ (const sal_Int32*)r.aImplementationId.getConstArray();
+ sal_Int32 nId32 = pBytesAsInt32Array[0] ^
+ pBytesAsInt32Array[1] ^
+ pBytesAsInt32Array[2] ^
+ pBytesAsInt32Array[3];
+ return (size_t)nId32 ^ (size_t)r.xPropInfo.get();
+}
+
+inline bool PropertySetInfoHash::operator()(
+ const PropertySetInfoKey& r1,
+ const PropertySetInfoKey& r2 ) const
+{
+ if( r1.xPropInfo != r2.xPropInfo )
+ return sal_False;
+
+ const sal_Int8* pId1 = r1.aImplementationId.getConstArray();
+ const sal_Int8* pId2 = r2.aImplementationId.getConstArray();
+ return memcmp( pId1, pId2, 16 * sizeof( sal_Int8 ) ) == 0;
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/PropertySetInfoKey.hxx b/xmloff/inc/xmloff/PropertySetInfoKey.hxx
new file mode 100644
index 000000000000..744b0bbac826
--- /dev/null
+++ b/xmloff/inc/xmloff/PropertySetInfoKey.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PROPERTYSETINFOKEY_HXX
+#define _XMLOFF_PROPERTYSETINFOKEY_HXX
+
+#include <osl/diagnose.h>
+#include <com/sun/star/uno/Sequence.hxx>
+
+namespace com { namespace sun { namespace star {
+ namespace beans { class XPropertySetInfo; }
+} } }
+
+
+struct PropertySetInfoKey
+{
+ ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySetInfo > xPropInfo;
+ ::com::sun::star::uno::Sequence < sal_Int8 > aImplementationId;
+
+ inline PropertySetInfoKey();
+ inline PropertySetInfoKey(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySetInfo >& rPropInfo,
+ const ::com::sun::star::uno::Sequence < sal_Int8 >& rImplId );
+};
+
+inline PropertySetInfoKey::PropertySetInfoKey()
+{
+ OSL_ENSURE( aImplementationId.getLength()==16, "illegal constructor call" );
+}
+
+inline PropertySetInfoKey::PropertySetInfoKey(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySetInfo >& rPropInfo,
+ const ::com::sun::star::uno::Sequence < sal_Int8 >& rImplId ) :
+ xPropInfo( rPropInfo ),
+ aImplementationId( rImplId )
+{
+ OSL_ENSURE( rPropInfo.is(), "prop info missing" );
+ OSL_ENSURE( aImplementationId.getLength()==16, "invalid implementation id" );
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/SchXMLExportHelper.hxx b/xmloff/inc/xmloff/SchXMLExportHelper.hxx
new file mode 100644
index 000000000000..45206492a50e
--- /dev/null
+++ b/xmloff/inc/xmloff/SchXMLExportHelper.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_SCH_XMLEXPORTHELPER_HXX_
+#define _XMLOFF_SCH_XMLEXPORTHELPER_HXX_
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include "sal/types.h"
+#include <xmloff/uniref.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/util/XStringMapping.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/awt/Point.hpp>
+#include <xmloff/xmlprmap.hxx>
+
+#include <queue>
+#include <vector>
+
+class SvXMLAutoStylePoolP;
+class SvXMLExport;
+class SchXMLExportHelper_Impl;
+
+/** With this class you can export a <chart:chart> element containing
+ its data as <table:table> element or without internal table. In
+ the latter case you have to provide a table address mapper if the
+ cell addressing set at the document is not in XML format.
+ */
+class XMLOFF_DLLPUBLIC SchXMLExportHelper : public UniRefBase
+{
+public:
+ SchXMLExportHelper( SvXMLExport& rExport,
+ SvXMLAutoStylePoolP& rASPool );
+
+ virtual ~SchXMLExportHelper();
+
+ /// returns the string corresponding to the current FileFormat CLSID for Chart
+ const rtl::OUString& getChartCLSID();
+
+private:
+ SchXMLExportHelper(); // not defined
+ SchXMLExportHelper(SchXMLExportHelper &); // not defined
+ void operator =(SchXMLExportHelper &); // not defined
+
+private:
+ SchXMLExportHelper_Impl* m_pImpl;
+ friend class SchXMLExport;
+};
+
+#endif // _XMLOFF_SCH_XMLEXPORTHELPER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/SchXMLImportHelper.hxx b/xmloff/inc/xmloff/SchXMLImportHelper.hxx
new file mode 100644
index 000000000000..ea4c459148ad
--- /dev/null
+++ b/xmloff/inc/xmloff/SchXMLImportHelper.hxx
@@ -0,0 +1,166 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_SCH_XMLIMPORTHELPER_HXX_
+#define _XMLOFF_SCH_XMLIMPORTHELPER_HXX_
+
+#include <xmloff/uniref.hxx>
+#include <xmloff/families.hxx>
+#include <com/sun/star/util/XStringMapping.hpp>
+#include <com/sun/star/chart/XChartDocument.hpp>
+
+namespace com { namespace sun { namespace star {
+ namespace frame {
+ class XModel;
+ }
+ namespace task {
+ class XStatusIndicator;
+ }
+ namespace xml {
+ namespace sax {
+ class XAttributeList;
+ }
+ }
+ namespace chart2 {
+ namespace data {
+ class XDataProvider;
+ class XLabeledDataSequence;
+ }
+ class XChartDocument;
+ class XDataSeries;
+ }
+}}}
+
+class SvXMLUnitConverter;
+class SvXMLStylesContext;
+class XMLChartImportPropertyMapper;
+class SvXMLTokenMap;
+class SvXMLImportContext;
+class SvXMLImport;
+
+// ========================================
+
+/** With this class you can import a <chart:chart> element containing
+ its data as <table:table> element or without internal table. In
+ the latter case you have to provide a table address mapper that
+ converts table addresses in XML format to the appropriate application
+ format.
+ */
+class SchXMLImportHelper : public UniRefBase
+{
+private:
+ com::sun::star::uno::Reference< com::sun::star::chart::XChartDocument > mxChartDoc;
+ SvXMLStylesContext* mpAutoStyles;
+
+ SvXMLTokenMap* mpChartDocElemTokenMap;
+ SvXMLTokenMap* mpTableElemTokenMap;
+ SvXMLTokenMap* mpChartElemTokenMap;
+ SvXMLTokenMap* mpPlotAreaElemTokenMap;
+ SvXMLTokenMap* mpSeriesElemTokenMap;
+
+ SvXMLTokenMap* mpChartAttrTokenMap;
+ SvXMLTokenMap* mpPlotAreaAttrTokenMap;
+ SvXMLTokenMap* mpAutoStyleAttrTokenMap;
+ SvXMLTokenMap* mpCellAttrTokenMap;
+ SvXMLTokenMap* mpSeriesAttrTokenMap;
+ SvXMLTokenMap* mpRegEquationAttrTokenMap;
+
+public:
+
+ SchXMLImportHelper();
+ ~SchXMLImportHelper();
+
+ /** get the context for reading the <chart:chart> element with subelements.
+ The result is stored in the XModel given if it also implements
+ XChartDocument
+ */
+ SvXMLImportContext* CreateChartContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference<
+ com::sun::star::frame::XModel > xChartModel,
+ const com::sun::star::uno::Reference<
+ com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ /** set the auto-style context that will be used to retrieve auto-styles
+ used inside the following <chart:chart> element to parse
+ */
+ void SetAutoStylesContext( SvXMLStylesContext* pAutoStyles ) { mpAutoStyles = pAutoStyles; }
+ SvXMLStylesContext* GetAutoStylesContext() const { return mpAutoStyles; }
+
+ const com::sun::star::uno::Reference<
+ com::sun::star::chart::XChartDocument >& GetChartDocument()
+ { return mxChartDoc; }
+
+ const SvXMLTokenMap& GetDocElemTokenMap();
+ const SvXMLTokenMap& GetTableElemTokenMap();
+ const SvXMLTokenMap& GetChartElemTokenMap();
+ const SvXMLTokenMap& GetPlotAreaElemTokenMap();
+ const SvXMLTokenMap& GetSeriesElemTokenMap();
+
+ const SvXMLTokenMap& GetChartAttrTokenMap();
+ const SvXMLTokenMap& GetPlotAreaAttrTokenMap();
+ const SvXMLTokenMap& GetAutoStyleAttrTokenMap();
+ const SvXMLTokenMap& GetCellAttrTokenMap();
+ const SvXMLTokenMap& GetSeriesAttrTokenMap();
+ const SvXMLTokenMap& GetRegEquationAttrTokenMap();
+
+ static sal_uInt16 GetChartFamilyID() { return XML_STYLE_FAMILY_SCH_CHART_ID; }
+
+ /** @param bPushLastChartType If </sal_False>, in case a new chart type has to
+ be added (because it does not exist yet), it is appended at the
+ end of the chart-type container. When </sal_True>, a new chart type
+ is added at one position before the last one, i.e. the formerly
+ last chart type is pushed back, so that it remains the last one.
+
+ This is needed when the global chart type is set to type A, but
+ the first series has type B. Then B should appear before A (done
+ by passing true). Once a series of type A has been read,
+ following new chart types are again be added at the end (by
+ passing false).
+ */
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > GetNewDataSeries(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > & xDoc,
+ sal_Int32 nCoordinateSystemIndex,
+ const ::rtl::OUString & rChartTypeName,
+ bool bPushLastChartType = false );
+
+ static void DeleteDataSeries(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >& xSeries,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > & xDoc );
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XLabeledDataSequence > GetNewLabeledDataSequence();
+};
+
+#endif // _XMLOFF_SCH_XMLIMPORTHELPER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/SettingsExportHelper.hxx b/xmloff/inc/xmloff/SettingsExportHelper.hxx
new file mode 100644
index 000000000000..6d42f5df0f8a
--- /dev/null
+++ b/xmloff/inc/xmloff/SettingsExportHelper.hxx
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_SETTINGSEXPORTHELPER_HXX
+#define _XMLOFF_SETTINGSEXPORTHELPER_HXX
+
+#include "xmloff/dllapi.h"
+
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/formula/SymbolDescriptor.hpp>
+#include <com/sun/star/util/XStringSubstitution.hpp>
+#include <xmloff/xmlexp.hxx>
+
+namespace com
+{
+ namespace sun { namespace star {
+ namespace container { class XNameAccess; class XIndexAccess; }
+ namespace util { struct DateTime; }
+ } }
+}
+
+namespace xmloff
+{
+ class XMLSettingsExportContext;
+}
+
+class XMLOFF_DLLPUBLIC XMLSettingsExportHelper
+{
+ ::xmloff::XMLSettingsExportContext& m_rContext;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XStringSubstitution > mxStringSubsitution;
+
+ const rtl::OUString msPrinterIndependentLayout;
+ const rtl::OUString msColorTableURL;
+ const rtl::OUString msLineEndTableURL;
+ const rtl::OUString msHatchTableURL;
+ const rtl::OUString msDashTableURL;
+ const rtl::OUString msGradientTableURL;
+ const rtl::OUString msBitmapTableURL;
+
+ void ManipulateSetting( com::sun::star::uno::Any& rAny, const rtl::OUString& rName ) const;
+
+ void CallTypeFunction(const com::sun::star::uno::Any& rAny,
+ const rtl::OUString& rName) const;
+
+ void exportBool(const sal_Bool bValue, const rtl::OUString& rName) const;
+ void exportByte(const sal_Int8 nValue, const rtl::OUString& rName) const;
+ void exportShort(const sal_Int16 nValue, const rtl::OUString& rName) const;
+ void exportInt(const sal_Int32 nValue, const rtl::OUString& rName) const;
+ void exportLong(const sal_Int64 nValue, const rtl::OUString& rName) const;
+ void exportDouble(const double fValue, const rtl::OUString& rName) const;
+ void exportString(const rtl::OUString& sValue, const rtl::OUString& rName) const;
+ void exportDateTime(const com::sun::star::util::DateTime& aValue, const rtl::OUString& rName) const;
+ void exportSequencePropertyValue(
+ const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps,
+ const rtl::OUString& rName) const;
+ void exportbase64Binary(
+ const com::sun::star::uno::Sequence<sal_Int8>& aProps,
+ const rtl::OUString& rName) const;
+ void exportMapEntry(const com::sun::star::uno::Any& rAny,
+ const rtl::OUString& rName,
+ const sal_Bool bNameAccess) const;
+ void exportNameAccess(
+ const com::sun::star::uno::Reference<com::sun::star::container::XNameAccess>& aNamed,
+ const rtl::OUString& rName) const;
+ void exportIndexAccess(
+ const com::sun::star::uno::Reference<com::sun::star::container::XIndexAccess> aIndexed,
+ const rtl::OUString rName) const;
+
+ void exportSymbolDescriptors(
+ const com::sun::star::uno::Sequence < com::sun::star::formula::SymbolDescriptor > &rProps,
+ const rtl::OUString rName) const;
+ void exportForbiddenCharacters(
+ const com::sun::star::uno::Any &rAny,
+ const rtl::OUString rName) const;
+
+public:
+ XMLSettingsExportHelper( ::xmloff::XMLSettingsExportContext& i_rContext );
+ ~XMLSettingsExportHelper();
+
+ void exportAllSettings(
+ const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps,
+ const rtl::OUString& rName) const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/SinglePropertySetInfoCache.hxx b/xmloff/inc/xmloff/SinglePropertySetInfoCache.hxx
new file mode 100644
index 000000000000..4458417a125b
--- /dev/null
+++ b/xmloff/inc/xmloff/SinglePropertySetInfoCache.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_SINGEPROPERTYSETINFOCACHE_HXX
+#define _XMLOFF_SINGEPROPERTYSETINFOCACHE_HXX
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+#include <boost/unordered_map.hpp>
+#include <xmloff/PropertySetInfoHash.hxx>
+
+typedef boost::unordered_map
+<
+ PropertySetInfoKey,
+ sal_Bool,
+ PropertySetInfoHash,
+ PropertySetInfoHash
+>
+SinglePropertySetInfoMap_Impl;
+
+class SinglePropertySetInfoCache : private SinglePropertySetInfoMap_Impl
+{
+ ::rtl::OUString sName;
+
+public:
+
+ inline SinglePropertySetInfoCache( const ::rtl::OUString& rName );
+ ~SinglePropertySetInfoCache() {};
+
+ sal_Bool hasProperty(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& rPropSet,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySetInfo >& rPropSetInfo );
+ inline sal_Bool hasProperty(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet>& rPropSet );
+};
+
+inline SinglePropertySetInfoCache::SinglePropertySetInfoCache(
+ const ::rtl::OUString& rName ) :
+ sName( rName )
+{
+}
+
+inline sal_Bool SinglePropertySetInfoCache::hasProperty(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet>& rPropSet )
+{
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySetInfo > xInfo;
+ return hasProperty( rPropSet, xInfo );
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/VisAreaContext.hxx b/xmloff/inc/xmloff/VisAreaContext.hxx
new file mode 100644
index 000000000000..cdb04a90c802
--- /dev/null
+++ b/xmloff/inc/xmloff/VisAreaContext.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_VISAREACONTEXT_HXX
+#define _XMLOFF_VISAREACONTEXT_HXX
+
+#include <xmloff/xmlictxt.hxx>
+#include <tools/mapunit.hxx>
+
+class Rectangle;
+
+namespace com { namespace sun { namespace star { namespace awt {
+ struct Rectangle;
+} } } }
+
+class XMLVisAreaContext : public SvXMLImportContext
+{
+public:
+ // read all attributes and set the values in rRect
+ XMLVisAreaContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ Rectangle& rRect, const MapUnit aMapUnit);
+
+ XMLVisAreaContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ ::com::sun::star::awt::Rectangle& rRect, const sal_Int16 nMeasureUnit);
+
+ virtual ~XMLVisAreaContext();
+
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
+ virtual void EndElement();
+
+private:
+ void process( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ ::com::sun::star::awt::Rectangle& rRect,
+ const sal_Int16 nMeasureUnit );
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/VisAreaExport.hxx b/xmloff/inc/xmloff/VisAreaExport.hxx
new file mode 100644
index 000000000000..9a98db5a04f8
--- /dev/null
+++ b/xmloff/inc/xmloff/VisAreaExport.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_VISAREAEXPORT_HXX
+#define _XMLOFF_VISAREAEXPORT_HXX
+
+#include <tools/mapunit.hxx>
+#include <sal/types.h>
+
+class SvXMLExport;
+class Rectangle;
+
+namespace com { namespace sun { namespace star { namespace awt {
+ struct Rectangle;
+} } } }
+
+class XMLVisAreaExport
+{
+public:
+ // the complete export is done in the constructor
+ XMLVisAreaExport(SvXMLExport& rExport, const sal_Char *pName,
+ const Rectangle& aRect, const MapUnit aMapUnit);
+
+ XMLVisAreaExport(SvXMLExport& rExport, const sal_Char *pName,
+ const com::sun::star::awt::Rectangle& aRect, const sal_Int16 nMeasureUnit );
+
+ ~XMLVisAreaExport();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/WordWrapPropertyHdl.hxx b/xmloff/inc/xmloff/WordWrapPropertyHdl.hxx
new file mode 100644
index 000000000000..a39b5b55878f
--- /dev/null
+++ b/xmloff/inc/xmloff/WordWrapPropertyHdl.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_WORDWRAPPROPERTYHANDLER_HXX
+#define _XMLOFF_WORDWRAPPROPERTYHANDLER_HXX
+
+#include <xmloff/xmlprhdl.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <com/sun/star/uno/Type.h>
+#include <xmloff/xmlement.hxx>
+
+/**
+ PropertyHandler for a named xml bool type:
+*/
+class SvXMLImport;
+class XMLWordWrapPropertyHdl : public XMLPropertyHandler
+{
+private:
+ SvXMLImport* mpImport;
+
+public:
+ XMLWordWrapPropertyHdl( SvXMLImport* pImport );
+ virtual ~XMLWordWrapPropertyHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_NAMEDBOOLPROPERTYHANDLER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/XMLBase64ImportContext.hxx b/xmloff/inc/xmloff/XMLBase64ImportContext.hxx
new file mode 100644
index 000000000000..e94e7ae18371
--- /dev/null
+++ b/xmloff/inc/xmloff/XMLBase64ImportContext.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLBASE64IMPORTCONTEXT_HXX
+#define _XMLOFF_XMLBASE64IMPORTCONTEXT_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <xmloff/xmlictxt.hxx>
+
+namespace com { namespace sun { namespace star { namespace io {
+ class XOutputStream; } } } }
+
+class XMLOFF_DLLPUBLIC XMLBase64ImportContext : public SvXMLImportContext
+{
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::io::XOutputStream > xOut;
+ ::rtl::OUString sBase64CharsLeft;
+
+public:
+ TYPEINFO();
+
+ XMLBase64ImportContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList >& xAttrList,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::io::XOutputStream >& rOut );
+
+ virtual ~XMLBase64ImportContext();
+
+ virtual void EndElement();
+
+ virtual void Characters( const ::rtl::OUString& rChars );
+
+};
+
+#endif // _XMLOFF_XMLBASE64IMPORTCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/XMLCharContext.hxx b/xmloff/inc/xmloff/XMLCharContext.hxx
new file mode 100644
index 000000000000..6ced863e9391
--- /dev/null
+++ b/xmloff/inc/xmloff/XMLCharContext.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 INCLUDED__XMLOFF_CHARCONTEXT_HXX
+#define INCLUDED__XMLOFF_CHARCONTEXT_HXX
+
+#include "xmloff/dllapi.h"
+#include <com/sun/star/uno/Reference.h>
+#include "xmlictxt.hxx"
+
+class XMLOFF_DLLPUBLIC XMLCharContext : public SvXMLImportContext
+{
+ XMLCharContext(const XMLCharContext&);
+ void operator =(const XMLCharContext&);
+protected:
+ sal_Int16 m_nControl;
+ sal_uInt16 m_nCount;
+ sal_Unicode m_c;
+public:
+
+ TYPEINFO();
+
+ XMLCharContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
+ sal_Unicode c,
+ sal_Bool bCount );
+ XMLCharContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
+ sal_Int16 nControl );
+
+ virtual ~XMLCharContext();
+
+ // EndElement is called before a context will be destructed, but
+ // after a elements context has been parsed. It may be used for actions
+ // that require virtual methods. The default is to do nothing.
+ virtual void EndElement();
+
+ virtual void InsertControlCharacter(sal_Int16 _nControl);
+ virtual void InsertString(const ::rtl::OUString& _sString);
+};
+// ---------------------------------------------------------------------
+#endif // INCLUDED__XMLOFF_CHARCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/XMLConstantsPropertyHandler.hxx b/xmloff/inc/xmloff/XMLConstantsPropertyHandler.hxx
new file mode 100644
index 000000000000..5e3024909b26
--- /dev/null
+++ b/xmloff/inc/xmloff/XMLConstantsPropertyHandler.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLCONSTANTSPROPERTYHANDLER_HXX
+#define _XMLOFF_XMLCONSTANTSPROPERTYHANDLER_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include <xmloff/xmlprhdl.hxx>
+#include <xmloff/xmltoken.hxx>
+
+struct SvXMLEnumMapEntry;
+
+///////////////////////////////////////////////////////////////////////////
+//
+/** Abstract base-class for different XML-types. Derivations of this class
+ knows how to compare, im/export a special XML-type
+*/
+class XMLOFF_DLLPUBLIC XMLConstantsPropertyHandler: public XMLPropertyHandler
+{
+ const SvXMLEnumMapEntry *pMap;
+ const enum ::xmloff::token::XMLTokenEnum eDefault;
+
+public:
+
+ XMLConstantsPropertyHandler( const SvXMLEnumMapEntry *pM,
+ enum ::xmloff::token::XMLTokenEnum eDflt);
+
+ // Just needed for virtual destruction
+ virtual ~XMLConstantsPropertyHandler();
+
+ /// Imports the given value in cas of the given XML-data-type
+ virtual sal_Bool importXML(
+ const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const;
+
+ /// Exports the given value in cas of the given XML-data-type
+ virtual sal_Bool exportXML(
+ ::rtl::OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_XMLCONSTANTSPROPERTYHANDLER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/XMLEmbeddedObjectExportFilter.hxx b/xmloff/inc/xmloff/XMLEmbeddedObjectExportFilter.hxx
new file mode 100644
index 000000000000..2c9af8b4c400
--- /dev/null
+++ b/xmloff/inc/xmloff/XMLEmbeddedObjectExportFilter.hxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLEMBEDDEDOBJECTEXPORTFILTER_HXX
+#define _XMLOFF_XMLEMBEDDEDOBJECTEXPORTFILTER_HXX
+
+#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/implbase3.hxx>
+
+class XMLEmbeddedObjectExportFilter : public ::cppu::WeakImplHelper3<
+ ::com::sun::star::xml::sax::XExtendedDocumentHandler,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::lang::XInitialization>
+{
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XDocumentHandler > xHandler;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XExtendedDocumentHandler > xExtHandler;
+
+public:
+ XMLEmbeddedObjectExportFilter() throw();
+ XMLEmbeddedObjectExportFilter( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XDocumentHandler > & rHandler ) throw();
+ virtual ~XMLEmbeddedObjectExportFilter () throw();
+
+ // ::com::sun::star::xml::sax::XDocumentHandler
+ virtual void SAL_CALL startDocument(void)
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL endDocument(void)
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL startElement(const ::rtl::OUString& aName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttribs)
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL endElement(const ::rtl::OUString& aName)
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL characters(const ::rtl::OUString& aChars)
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL ignorableWhitespace(const ::rtl::OUString& aWhitespaces)
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL processingInstruction(const ::rtl::OUString& aTarget,
+ const ::rtl::OUString& aData)
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL setDocumentLocator(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > & xLocator)
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+
+ // ::com::sun::star::xml::sax::XExtendedDocumentHandler
+ virtual void SAL_CALL startCDATA(void) throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL endCDATA(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL comment(const ::rtl::OUString& sComment)
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL allowLineBreak(void)
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL unknown(const ::rtl::OUString& sString)
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+
+};
+
+#endif // _XMLOFF_XMLEMBEDDEDOBJECTEXPORTFILTER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/XMLEventExport.hxx b/xmloff/inc/xmloff/XMLEventExport.hxx
new file mode 100644
index 000000000000..991ec360c55b
--- /dev/null
+++ b/xmloff/inc/xmloff/XMLEventExport.hxx
@@ -0,0 +1,142 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLEVENTEXPORT_HXX
+#define _XMLOFF_XMLEVENTEXPORT_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include "sal/types.h"
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <rtl/ustring.hxx>
+#include <xmloff/xmlevent.hxx>
+
+#include <map>
+
+class SvXMLExport;
+namespace com { namespace sun { namespace star {
+ namespace document { class XEventsSupplier; }
+ namespace container { class XNameReplace; }
+ namespace container { class XNameAccess; }
+ namespace beans { struct PropertyValue; }
+} } }
+
+typedef ::std::map< ::rtl::OUString, XMLEventExportHandler* > HandlerMap;
+typedef ::std::map< ::rtl::OUString, XMLEventName > NameMap;
+
+/**
+ * Export instances of EventsSupplier services. To use this class you
+ * must fulfill two conditions:
+ *
+ * 1) provide a translation from the API event names to XML event
+ * names
+ * 2) Register XMLEventExportHandler instances for all script types
+ * that you would like to export.
+ *
+ * The Export()-Methods all have a bUseWhitespace parameter that
+ * causes the exported elements to be surrounded by whitespace, which
+ * in turn causes the elements to be indented properly. By default,
+ * whitespace is used, but it may not be called for in all cases (e.g
+ * events attached to hyperlink within a paragraph.)
+ */
+class XMLOFF_DLLPUBLIC XMLEventExport
+{
+ const ::rtl::OUString sEventType;
+
+ SvXMLExport& rExport;
+
+ HandlerMap aHandlerMap;
+ NameMap aNameTranslationMap;
+
+ bool bExtNamespace;
+
+public:
+ XMLEventExport(SvXMLExport& rExport,
+ const XMLEventNameTranslation* pTranslationTable = NULL);
+ ~XMLEventExport();
+
+ /// register an EventExportHandler for a particular script type
+ ///
+ /// The handlers will be deleted when the object is destroyed, hence
+ /// no pointers to a handler registered with AddHandler() should be
+ /// held by anyone.
+ void AddHandler( const ::rtl::OUString& rName,
+ XMLEventExportHandler* rHandler );
+
+ /// register additional event names
+ void AddTranslationTable( const XMLEventNameTranslation* pTransTable );
+
+ /// export the events (calls EventExport::Export(Reference<XNameAcess>) )
+ void Export( ::com::sun::star::uno::Reference<
+ ::com::sun::star::document::XEventsSupplier> & xAccess,
+ sal_Bool bUseWhitespace = sal_True);
+
+ /// export the events (calls EventExport::Export(Reference<XNameAcess>) )
+ void Export( ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XNameReplace> & xAccess,
+ sal_Bool bUseWhitespace = sal_True);
+
+ /// export the events (writes <office:events> element)
+ void Export( ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XNameAccess> & xAccess,
+ sal_Bool bUseWhitespace = sal_True);
+
+ /// export the events, but write <officeooo:events> element
+ /// (for new file format additions)
+ void ExportExt( ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XNameAccess> & xAccess,
+ sal_Bool bUseWhitespace = sal_True);
+
+ /// export a single event (writes <office:events> element)
+ void ExportSingleEvent(
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue>& rEventValues,
+ const ::rtl::OUString& rApiEventName,
+ sal_Bool bUseWhitespace = sal_True );
+
+private:
+
+ /// export one event (start container-element if necessary)
+ SAL_DLLPRIVATE void ExportEvent(
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue>& rEventValues,
+ const XMLEventName& rXmlEventName,
+ sal_Bool bUseWhitespace,
+ sal_Bool& rExported);
+
+ /// export the start element
+ SAL_DLLPRIVATE void StartElement(sal_Bool bUseWhitespace);
+
+ /// export the end element
+ SAL_DLLPRIVATE void EndElement(sal_Bool bUseWhitespace);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/XMLEventsImportContext.hxx b/xmloff/inc/xmloff/XMLEventsImportContext.hxx
new file mode 100644
index 000000000000..7d0f47d6e4a0
--- /dev/null
+++ b/xmloff/inc/xmloff/XMLEventsImportContext.hxx
@@ -0,0 +1,141 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLEVENTSIMPORTCONTEXT_HXX
+#define _XMLOFF_XMLEVENTSIMPORTCONTEXT_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/xmlevent.hxx>
+
+#include <map>
+#include <vector>
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+ namespace beans { struct PropertyValue; }
+ namespace container { class XNameReplace; }
+ namespace document { class XEventsSupplier; }
+} } }
+namespace rtl { class OUString; }
+
+typedef ::std::pair<
+ ::rtl::OUString,
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue> > EventNameValuesPair;
+
+typedef ::std::vector< EventNameValuesPair > EventsVector;
+
+/**
+ * Import <script:events> element.
+ *
+ * The import context usually sets the events immediatly at the event
+ * XNameReplace. If none was given on construction, it operates in
+ * delayed mode: All events are collected and may then be set
+ * with the setEvents() method.
+ */
+class XMLOFF_DLLPUBLIC XMLEventsImportContext : public SvXMLImportContext
+{
+protected:
+ // the event XNameReplace; may be empty
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XNameReplace> xEvents;
+
+ // if no XNameReplace is given, use this vector to collect events
+ EventsVector aCollectEvents;
+
+public:
+
+ TYPEINFO();
+
+ XMLEventsImportContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName);
+
+ XMLEventsImportContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::document::XEventsSupplier> & xEventsSupplier);
+
+ XMLEventsImportContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XNameReplace> & xNameRepl);
+
+ ~XMLEventsImportContext();
+
+ void AddEventValues(
+ const ::rtl::OUString& rEventName,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue> & rValues);
+
+ /// if the import operates in delayed mode, you can use this method
+ /// to set all events that have been read on the XEventsSupplier
+ void SetEvents(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::document::XEventsSupplier> & xEventsSupplier);
+
+ /// if the import operates in delayed mode, you can use this method
+ /// to set all events that have been read on the XNameReplace
+ void SetEvents(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XNameReplace> & xNameRepl);
+
+ /// if the import operates indelayed mode, you can use this method
+ /// to obtain the value sequence for a specific event
+ sal_Bool GetEventSequence(
+ const ::rtl::OUString& rName,
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue> & rSequence );
+
+protected:
+
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+
+ virtual void EndElement();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/XMLFilterServiceNames.h b/xmloff/inc/xmloff/XMLFilterServiceNames.h
new file mode 100755
index 000000000000..627f3bbcda9b
--- /dev/null
+++ b/xmloff/inc/xmloff/XMLFilterServiceNames.h
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLFILTERSERVICENAMES_H
+#define _XMLOFF_XMLFILTERSERVICENAMES_H
+
+
+#define XML_IMPORT_FILTER_WRITER "com.sun.star.comp.Writer.XMLOasisImporter"
+#define XML_IMPORT_FILTER_CALC "com.sun.star.comp.Calc.XMLOasisImporter"
+#define XML_IMPORT_FILTER_DRAW "com.sun.star.comp.Draw.XMLOasisImporter"
+#define XML_IMPORT_FILTER_IMPRESS "com.sun.star.comp.Impress.XMLOasisImporter"
+#define XML_IMPORT_FILTER_MATH "com.sun.star.comp.Math.XMLImporter"
+#define XML_IMPORT_FILTER_CHART "com.sun.star.comp.Chart.XMLOasisImporter"
+
+#define XML_EXPORT_FILTER_WRITER "com.sun.star.comp.Writer.XMLOasisExporter"
+#define XML_EXPORT_FILTER_CALC "com.sun.star.comp.Calc.XMLOasisExporter"
+#define XML_EXPORT_FILTER_DRAW "com.sun.star.comp.Draw.XMLOasisExporter"
+#define XML_EXPORT_FILTER_IMPRESS "com.sun.star.comp.Impress.XMLOasisExporter"
+#define XML_EXPORT_FILTER_MATH "com.sun.star.comp.Math.XMLExporter"
+#define XML_EXPORT_FILTER_CHART "com.sun.star.comp.Chart.XMLOasisExporter"
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/XMLFontAutoStylePool.hxx b/xmloff/inc/xmloff/XMLFontAutoStylePool.hxx
new file mode 100644
index 000000000000..6016f15b0c07
--- /dev/null
+++ b/xmloff/inc/xmloff/XMLFontAutoStylePool.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLFONTAUTOSTYLEPOOL_HXX
+#define _XMLOFF_XMLFONTAUTOSTYLEPOOL_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include <rtl/ustring.hxx>
+#include <xmloff/uniref.hxx>
+
+class XMLFontAutoStylePool_Impl;
+class XMLFontAutoStylePoolNames_Impl;
+class SvXMLExport;
+
+class XMLOFF_DLLPUBLIC XMLFontAutoStylePool : public UniRefBase
+{
+ SvXMLExport& rExport;
+
+ XMLFontAutoStylePool_Impl *pPool;
+ XMLFontAutoStylePoolNames_Impl *pNames;
+ sal_uInt32 nName;
+
+protected:
+
+ SvXMLExport& GetExport() { return rExport; }
+
+public:
+
+ XMLFontAutoStylePool( SvXMLExport& rExport );
+ ~XMLFontAutoStylePool();
+
+ ::rtl::OUString Add(
+ const ::rtl::OUString& rFamilyName,
+ const ::rtl::OUString& rStyleName,
+ sal_Int16 nFamily,
+ sal_Int16 nPitch,
+ rtl_TextEncoding eEnc );
+
+ ::rtl::OUString Find(
+ const ::rtl::OUString& rFamilyName,
+ const ::rtl::OUString& rStyleName,
+ sal_Int16 nFamily,
+ sal_Int16 nPitch,
+ rtl_TextEncoding eEnc )const;
+ ::rtl::OUString Find( const ::rtl::OUString& rInternalName ) const;
+
+ void exportXML();
+};
+
+#endif // _XMLOFF_XMLFONTAUTOSTYLEPOOL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/XMLFontStylesContext.hxx b/xmloff/inc/xmloff/XMLFontStylesContext.hxx
new file mode 100644
index 000000000000..9813ab708302
--- /dev/null
+++ b/xmloff/inc/xmloff/XMLFontStylesContext.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLFONTSTYLESCONTEXT_HXX_
+#define _XMLOFF_XMLFONTSTYLESCONTEXT_HXX_
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+
+#include <vector>
+
+#include <xmloff/xmlstyle.hxx>
+
+struct XMLPropertyState;
+class SvXMLTokenMap;
+class XMLFontFamilyNamePropHdl;
+class XMLFontFamilyPropHdl;
+class XMLFontPitchPropHdl;
+class XMLFontEncodingPropHdl;
+
+class XMLOFF_DLLPUBLIC XMLFontStylesContext : public SvXMLStylesContext
+{
+ XMLFontFamilyNamePropHdl *pFamilyNameHdl;
+ XMLFontFamilyPropHdl *pFamilyHdl;
+ XMLFontPitchPropHdl *pPitchHdl;
+ XMLFontEncodingPropHdl *pEncHdl;
+
+ SvXMLTokenMap *pFontStyleAttrTokenMap;
+
+ rtl_TextEncoding eDfltEncoding;
+
+protected:
+
+ virtual SvXMLStyleContext *CreateStyleChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+public:
+
+ TYPEINFO();
+
+ XMLFontStylesContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
+ rtl_TextEncoding eDfltEnc );
+ virtual ~XMLFontStylesContext();
+
+ const SvXMLTokenMap& GetFontStyleAttrTokenMap() const
+ {
+ return *pFontStyleAttrTokenMap;
+ }
+
+ sal_Bool FillProperties( const ::rtl::OUString& rName,
+ ::std::vector< XMLPropertyState > &rProps,
+ sal_Int32 nFamilyNameIdx,
+ sal_Int32 nStyleNameIdx,
+ sal_Int32 nFamilyIdx,
+ sal_Int32 nPitchIdx,
+ sal_Int32 nCharsetIdx ) const;
+
+ rtl_TextEncoding GetDfltCharset() const { return eDfltEncoding; }
+
+ XMLFontFamilyNamePropHdl& GetFamilyNameHdl() const { return *pFamilyNameHdl; }
+ XMLFontFamilyPropHdl& GetFamilyHdl() const { return *pFamilyHdl; }
+ XMLFontPitchPropHdl& GetPitchHdl() const { return *pPitchHdl; }
+ XMLFontEncodingPropHdl& GetEncodingHdl() const { return *pEncHdl; }
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/XMLGraphicsDefaultStyle.hxx b/xmloff/inc/xmloff/XMLGraphicsDefaultStyle.hxx
new file mode 100644
index 000000000000..6a1731f84529
--- /dev/null
+++ b/xmloff/inc/xmloff/XMLGraphicsDefaultStyle.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLGRAPHICSDEFAULTSTYLE_HXX
+#define _XMLOFF_XMLGRAPHICSDEFAULTSTYLE_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include <xmloff/prstylei.hxx>
+
+namespace com { namespace sun { namespace star { namespace container
+{
+ class XNameContainer;
+} } } }
+
+class XMLOFF_DLLPUBLIC XMLGraphicsDefaultStyle : public XMLPropStyleContext
+{
+public:
+ TYPEINFO();
+
+ XMLGraphicsDefaultStyle( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList >& xAttrList,
+ SvXMLStylesContext& rStyles);
+
+ virtual ~XMLGraphicsDefaultStyle();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+ // This method is called for every default style
+ virtual void SetDefaults();
+};
+
+#endif // _XMLOFF_XMLGRAPHICSDEFAULTSTYLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/XMLPageExport.hxx b/xmloff/inc/xmloff/XMLPageExport.hxx
new file mode 100644
index 000000000000..9b9bd2781e75
--- /dev/null
+++ b/xmloff/inc/xmloff/XMLPageExport.hxx
@@ -0,0 +1,114 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLPAGEEXPORT_HXX
+#define _XMLOFF_XMLPAGEEXPORT_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include "sal/types.h"
+#include <rtl/ustring.hxx>
+#include <vector>
+#include <xmloff/attrlist.hxx>
+#include <xmloff/uniref.hxx>
+#include <com/sun/star/container/XIndexAccess.hpp>
+
+namespace com { namespace sun { namespace star {
+ namespace style { class XStyle; }
+ namespace container { class XIndexReplace; class XNameAccess;}
+ namespace beans { class XPropertySet; }
+} } }
+
+class SvXMLExport;
+class XMLPropertyHandlerFactory;
+class XMLPropertySetMapper;
+class SvXMLExportPropertyMapper;
+
+//______________________________________________________________________________
+
+struct XMLPageExportNameEntry
+{
+ ::rtl::OUString sPageMasterName;
+ ::rtl::OUString sStyleName;
+};
+
+//______________________________________________________________________________
+
+class XMLOFF_DLLPUBLIC XMLPageExport : public UniRefBase
+{
+ SvXMLExport& rExport;
+
+ const ::rtl::OUString sIsPhysical;
+ const ::rtl::OUString sFollowStyle;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XNameAccess > xPageStyles;
+
+ ::std::vector< XMLPageExportNameEntry > aNameVector;
+ SAL_DLLPRIVATE sal_Bool findPageMasterName( const ::rtl::OUString& rStyleName, ::rtl::OUString& rPMName ) const;
+
+ UniReference < XMLPropertyHandlerFactory > xPageMasterPropHdlFactory;
+ UniReference < XMLPropertySetMapper > xPageMasterPropSetMapper;
+ UniReference < SvXMLExportPropertyMapper > xPageMasterExportPropMapper;
+
+protected:
+
+ SvXMLExport& GetExport() { return rExport; }
+
+ virtual void collectPageMasterAutoStyle(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rPropSet,
+ ::rtl::OUString& rPageMasterName );
+
+ virtual void exportMasterPageContent(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rPropSet,
+ sal_Bool bAutoStyles );
+
+ sal_Bool exportStyle(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::style::XStyle >& rStyle,
+ sal_Bool bAutoStyles );
+
+ void exportStyles( sal_Bool bUsed, sal_Bool bAutoStyles );
+
+public:
+ XMLPageExport( SvXMLExport& rExp );
+ ~XMLPageExport();
+
+ void collectAutoStyles( sal_Bool bUsed ) { exportStyles( bUsed, sal_True ); }
+ void exportAutoStyles();
+ void exportMasterStyles( sal_Bool bUsed ) { exportStyles( bUsed, sal_False ); }
+
+ //text grid enhancement for better CJK support
+ void exportDefaultStyle();
+};
+
+#endif // _XMLOFF_XMLTEXTMASTERPAGEEXPORT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/XMLSettingsExportContext.hxx b/xmloff/inc/xmloff/XMLSettingsExportContext.hxx
new file mode 100644
index 000000000000..aea52317e90a
--- /dev/null
+++ b/xmloff/inc/xmloff/XMLSettingsExportContext.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2009 by Sun Microsystems, Inc.
+*
+* 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 XML_SETTINGS_EXPORT_CONTEXT_HXX
+#define XML_SETTINGS_EXPORT_CONTEXT_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+/** === end UNO includes === **/
+
+#include "xmloff/xmltoken.hxx"
+
+//........................................................................
+namespace xmloff
+{
+//........................................................................
+
+ //====================================================================
+ //= XMLExporter
+ //====================================================================
+ class SAL_NO_VTABLE XMLSettingsExportContext
+ {
+ public:
+ virtual void AddAttribute( enum ::xmloff::token::XMLTokenEnum i_eName,
+ const ::rtl::OUString& i_rValue ) = 0;
+ virtual void AddAttribute( enum ::xmloff::token::XMLTokenEnum i_eName,
+ enum ::xmloff::token::XMLTokenEnum i_eValue ) = 0;
+
+ virtual void StartElement( enum ::xmloff::token::XMLTokenEnum i_eName,
+ const sal_Bool i_bIgnoreWhitespace ) = 0;
+ virtual void EndElement( const sal_Bool i_bIgnoreWhitespace ) = 0;
+
+ virtual void Characters( const ::rtl::OUString& i_rCharacters ) = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
+ GetServiceFactory() const = 0;
+
+ };
+
+//........................................................................
+} // namespace xmloff
+//........................................................................
+
+#endif // XML_SETTINGS_EXPORT_CONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/XMLShapeStyleContext.hxx b/xmloff/inc/xmloff/XMLShapeStyleContext.hxx
new file mode 100644
index 000000000000..de35727e7a5c
--- /dev/null
+++ b/xmloff/inc/xmloff/XMLShapeStyleContext.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLSHAPESTYLECONTEXT_HXX
+#define _XMLOFF_XMLSHAPESTYLECONTEXT_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include <xmloff/prstylei.hxx>
+#include <xmloff/families.hxx>
+
+class SvXMLImport;
+
+//////////////////////////////////////////////////////////////////////////////
+// style:style context
+
+class XMLOFF_DLLPUBLIC XMLShapeStyleContext: public XMLPropStyleContext
+{
+protected:
+ ::rtl::OUString m_sControlDataStyleName;
+ ::rtl::OUString m_sListStyleName;
+ sal_Bool m_bIsNumRuleAlreadyConverted;
+
+protected:
+ virtual void SetAttribute( sal_uInt16 nPrefixKey,
+ const ::rtl::OUString& rLocalName,
+ const ::rtl::OUString& rValue );
+public:
+ TYPEINFO();
+
+ XMLShapeStyleContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList,
+ SvXMLStylesContext& rStyles,
+ sal_uInt16 nFamily = XML_STYLE_FAMILY_SD_GRAPHICS_ID);
+ virtual ~XMLShapeStyleContext();
+
+ SvXMLImportContext * CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+ virtual void Finish( sal_Bool bOverwrite );
+
+ virtual void FillPropertySet(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rPropSet );
+};
+
+#endif // _XMLOFF_XMLSHAPESTYLECONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/XMLStringVector.hxx b/xmloff/inc/xmloff/XMLStringVector.hxx
new file mode 100644
index 000000000000..3f63fc96c7d8
--- /dev/null
+++ b/xmloff/inc/xmloff/XMLStringVector.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLSTRINGVECTOR_HXX
+#define _XMLOFF_XMLSTRINGVECTOR_HXX
+
+#include <rtl/ustring.hxx>
+
+#include <vector>
+
+typedef ::std::vector < ::rtl::OUString> XMLStringVector;
+
+
+#endif // _XMLOFF_XMLSTRINGVECTOR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/XMLTextListAutoStylePool.hxx b/xmloff/inc/xmloff/XMLTextListAutoStylePool.hxx
new file mode 100644
index 000000000000..b1dbb673c1a5
--- /dev/null
+++ b/xmloff/inc/xmloff/XMLTextListAutoStylePool.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLTEXTLISTAUTOSTYLEPOOL_HXX
+#define _XMLOFF_XMLTEXTLISTAUTOSTYLEPOOL_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include "sal/types.h"
+#include <rtl/ustring.hxx>
+#include <com/sun/star/ucb/XAnyCompare.hpp>
+
+namespace com { namespace sun { namespace star { namespace container {
+ class XIndexReplace; } } } }
+namespace rtl { class OUString; }
+
+
+class XMLTextListAutoStylePool_Impl;
+class XMLTextListAutoStylePoolNames_Impl;
+class XMLTextListAutoStylePoolEntry_Impl;
+class SvXMLExport;
+
+class XMLOFF_DLLPUBLIC XMLTextListAutoStylePool
+{
+ SvXMLExport& rExport;
+
+ ::rtl::OUString sPrefix;
+
+ XMLTextListAutoStylePool_Impl *pPool;
+ XMLTextListAutoStylePoolNames_Impl *pNames;
+ sal_uInt32 nName;
+
+ /** this is an optional NumRule compare component for applications where
+ the NumRules don't have names */
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XAnyCompare > mxNumRuleCompare;
+
+ SAL_DLLPRIVATE sal_uInt32 Find( XMLTextListAutoStylePoolEntry_Impl* pEntry )
+ const;
+public:
+
+ XMLTextListAutoStylePool( SvXMLExport& rExport );
+ ~XMLTextListAutoStylePool();
+
+ void RegisterName( const ::rtl::OUString& rName );
+ sal_Bool HasName( const ::rtl::OUString& rName ) const;
+
+ ::rtl::OUString Add(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::container::XIndexReplace > & rNumRules );
+
+ ::rtl::OUString Find(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::container::XIndexReplace > & rNumRules ) const;
+ ::rtl::OUString Find( const ::rtl::OUString& rInternalName ) const;
+
+ void exportXML() const;
+};
+
+
+#endif // _XMLOFF_XMLTEXTLISTAUTOSTYLEPOOL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/XMLTextMasterPageContext.hxx b/xmloff/inc/xmloff/XMLTextMasterPageContext.hxx
new file mode 100644
index 000000000000..67c3e99698e7
--- /dev/null
+++ b/xmloff/inc/xmloff/XMLTextMasterPageContext.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_TEXTMASTERPAGECONTEXT_HXX_
+#define _XMLOFF_TEXTMASTERPAGECONTEXT_HXX_
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include "sal/types.h"
+
+#include <xmloff/xmlstyle.hxx>
+
+namespace com { namespace sun { namespace star {
+ namespace style { class XStyle; }
+} } }
+
+class XMLOFF_DLLPUBLIC XMLTextMasterPageContext : public SvXMLStyleContext
+{
+ const ::rtl::OUString sIsPhysical;
+ const ::rtl::OUString sPageStyleLayout;
+ const ::rtl::OUString sFollowStyle;
+ ::rtl::OUString sFollow;
+ ::rtl::OUString sPageMasterName;
+
+ ::com::sun::star::uno::Reference < ::com::sun::star::style::XStyle > xStyle;
+
+ sal_Bool bInsertHeader;
+ sal_Bool bInsertFooter;
+ sal_Bool bInsertHeaderLeft;
+ sal_Bool bInsertFooterLeft;
+ sal_Bool bHeaderInserted;
+ sal_Bool bFooterInserted;
+ sal_Bool bHeaderLeftInserted;
+ sal_Bool bFooterLeftInserted;
+
+ SAL_DLLPRIVATE ::com::sun::star::uno::Reference <
+ ::com::sun::star::style::XStyle > Create();
+protected:
+ ::com::sun::star::uno::Reference <
+ ::com::sun::star::style::XStyle > GetStyle() { return xStyle; }
+public:
+
+ TYPEINFO();
+
+ XMLTextMasterPageContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
+ sal_Bool bOverwrite );
+ virtual ~XMLTextMasterPageContext();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+ virtual SvXMLImportContext *CreateHeaderFooterContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
+ const sal_Bool bFooter,
+ const sal_Bool bLeft );
+
+ virtual void Finish( sal_Bool bOverwrite );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/XMLTextMasterPageExport.hxx b/xmloff/inc/xmloff/XMLTextMasterPageExport.hxx
new file mode 100644
index 000000000000..38052c59fc4a
--- /dev/null
+++ b/xmloff/inc/xmloff/XMLTextMasterPageExport.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLTEXTMASTERPAGEEXPORT_HXX
+#define _XMLOFF_XMLTEXTMASTERPAGEEXPORT_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include <rtl/ustring.hxx>
+#include <xmloff/attrlist.hxx>
+#include <xmloff/XMLPageExport.hxx>
+
+namespace com { namespace sun { namespace star {
+ namespace text { class XText; }
+} } }
+
+class XMLOFF_DLLPUBLIC XMLTextMasterPageExport : public XMLPageExport
+{
+ const ::rtl::OUString sHeaderText;
+ const ::rtl::OUString sHeaderOn;
+ const ::rtl::OUString sHeaderShareContent;
+ const ::rtl::OUString sHeaderTextLeft;
+
+ const ::rtl::OUString sFooterText;
+ const ::rtl::OUString sFooterOn;
+ const ::rtl::OUString sFooterShareContent;
+ const ::rtl::OUString sFooterTextLeft;
+
+protected:
+
+ virtual void exportHeaderFooterContent(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XText >& rText,
+ sal_Bool bAutoStyles, sal_Bool bExportParagraph = sal_True );
+
+ virtual void exportMasterPageContent(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rPropSet,
+ sal_Bool bAutoStyles );
+
+public:
+ XMLTextMasterPageExport( SvXMLExport& rExp );
+ ~XMLTextMasterPageExport();
+};
+
+#endif // _XMLOFF_XMLTEXTMASTERPAGEEXPORT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/XMLTextMasterStylesContext.hxx b/xmloff/inc/xmloff/XMLTextMasterStylesContext.hxx
new file mode 100644
index 000000000000..064beff7aede
--- /dev/null
+++ b/xmloff/inc/xmloff/XMLTextMasterStylesContext.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLTEXTMASTERSTYLESCONTEXT_HXX
+#define _XMLOFF_XMLTEXTMASTERSTYLESCONTEXT_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include <xmloff/xmlstyle.hxx>
+
+class XMLOFF_DLLPUBLIC XMLTextMasterStylesContext : public SvXMLStylesContext
+{
+protected:
+ virtual SvXMLStyleContext *CreateStyleChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+ virtual SvXMLStyleContext *CreateStyleStyleChildContext( sal_uInt16 nFamily,
+ sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+ virtual sal_Bool InsertStyleFamily( sal_uInt16 nFamily ) const;
+
+public:
+ TYPEINFO();
+
+ XMLTextMasterStylesContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList);
+
+ virtual ~XMLTextMasterStylesContext();
+};
+
+#endif // _XMLOFF_XMLTEXTMASTERSTYLECONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/XMLTextShapeImportHelper.hxx b/xmloff/inc/xmloff/XMLTextShapeImportHelper.hxx
new file mode 100644
index 000000000000..7dd3526ec93c
--- /dev/null
+++ b/xmloff/inc/xmloff/XMLTextShapeImportHelper.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLTEXTSHAPEIMPORTHELPER_HXX
+#define _XMLTEXTSHAPEIMPORTHELPER_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include <xmloff/shapeimport.hxx>
+
+class XMLOFF_DLLPUBLIC XMLTextShapeImportHelper : public XMLShapeImportHelper
+{
+ SvXMLImport& rImport;
+
+ const ::rtl::OUString sAnchorType;
+ const ::rtl::OUString sAnchorPageNo;
+ const ::rtl::OUString sVertOrientPosition;
+
+public:
+
+ XMLTextShapeImportHelper( SvXMLImport& rImp );
+ ~XMLTextShapeImportHelper();
+
+ virtual void addShape(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape >& rShape,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList >& xAttrList,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& rShapes );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/XMLTextShapeStyleContext.hxx b/xmloff/inc/xmloff/XMLTextShapeStyleContext.hxx
new file mode 100644
index 000000000000..246491d2484d
--- /dev/null
+++ b/xmloff/inc/xmloff/XMLTextShapeStyleContext.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLTEXTSHAPESTYLECONTEXT_HXX_
+#define _XMLOFF_XMLTEXTSHAPESTYLECONTEXT_HXX_
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include <xmloff/XMLShapeStyleContext.hxx>
+
+class XMLOFF_DLLPUBLIC XMLTextShapeStyleContext : public XMLShapeStyleContext
+{
+ const ::rtl::OUString sIsAutoUpdate;
+
+ sal_Bool bAutoUpdate : 1;
+
+ SvXMLImportContextRef xEventContext;
+
+protected:
+
+ virtual void SetAttribute( sal_uInt16 nPrefixKey,
+ const ::rtl::OUString& rLocalName,
+ const ::rtl::OUString& rValue );
+
+public:
+
+ TYPEINFO();
+
+ XMLTextShapeStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
+ SvXMLStylesContext& rStyles, sal_uInt16 nFamily,
+ sal_Bool bDefaultStyle = sal_False );
+ virtual ~XMLTextShapeStyleContext();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+ sal_Bool IsAutoUpdate() const { return bAutoUpdate; }
+
+ virtual void CreateAndInsert( sal_Bool bOverwrite );
+
+ virtual void Finish( sal_Bool bOverwrite );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/XMLTextTableContext.hxx b/xmloff/inc/xmloff/XMLTextTableContext.hxx
new file mode 100644
index 000000000000..81112f926035
--- /dev/null
+++ b/xmloff/inc/xmloff/XMLTextTableContext.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLTEXTTABLECONTEXT_HXX
+#define _XMLTEXTTABLECONTEXT_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include <xmloff/xmlictxt.hxx>
+#include <com/sun/star/uno/Reference.h>
+
+namespace com { namespace sun { namespace star {
+ namespace text { class XTextContent; }
+} } }
+
+#define XML_TEXT_FRAME_TEXTBOX 1
+#define XML_TEXT_FRAME_GRAPHIC 2
+
+class XMLOFF_DLLPUBLIC XMLTextTableContext : public SvXMLImportContext
+{
+
+public:
+
+ TYPEINFO();
+
+ XMLTextTableContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName );
+ virtual ~XMLTextTableContext();
+
+ virtual ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextContent > GetXTextContent() const = 0;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/animexp.hxx b/xmloff/inc/xmloff/animexp.hxx
new file mode 100644
index 000000000000..7726d5a411b5
--- /dev/null
+++ b/xmloff/inc/xmloff/animexp.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_ANIMEXP_HXX
+#define _XMLOFF_ANIMEXP_HXX
+
+#include <com/sun/star/drawing/XShape.hpp>
+#include <xmloff/uniref.hxx>
+
+class AnimExpImpl;
+class SvXMLExport;
+class XMLShapeExport;
+
+class XMLAnimationsExporter : public UniRefBase
+{
+ AnimExpImpl* mpImpl;
+
+public:
+ XMLAnimationsExporter( XMLShapeExport* pShapeExp );
+ virtual ~XMLAnimationsExporter();
+
+ void prepare( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape, SvXMLExport& rExport );
+ void collect( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape, SvXMLExport& rExport );
+ void exportAnimations( SvXMLExport& rExport );
+};
+
+#endif // _XMLOFF_ANIMEXP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/attrlist.hxx b/xmloff/inc/xmloff/attrlist.hxx
new file mode 100644
index 000000000000..33a2fcb8184b
--- /dev/null
+++ b/xmloff/inc/xmloff/attrlist.hxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_ATTRLIST_HXX
+#define _XMLOFF_ATTRLIST_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/xml/sax/SAXParseException.hpp>
+#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/SAXException.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/xml/sax/XLocator.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+
+#include <cppuhelper/implbase3.hxx>
+
+struct SvXMLAttributeList_Impl;
+
+class XMLOFF_DLLPUBLIC SvXMLAttributeList : public ::cppu::WeakImplHelper3<
+ ::com::sun::star::xml::sax::XAttributeList,
+ ::com::sun::star::util::XCloneable,
+ ::com::sun::star::lang::XUnoTunnel>
+{
+ SvXMLAttributeList_Impl *m_pImpl;
+
+public:
+ SvXMLAttributeList();
+ SvXMLAttributeList( const SvXMLAttributeList& );
+ SvXMLAttributeList( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & rAttrList );
+ ~SvXMLAttributeList();
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
+ static SvXMLAttributeList* getImplementation( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > ) throw();
+
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::xml::sax::XAttributeList
+ virtual sal_Int16 SAL_CALL getLength(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::rtl::OUString SAL_CALL getNameByIndex(sal_Int16 i) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::rtl::OUString SAL_CALL getTypeByIndex(sal_Int16 i) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::rtl::OUString SAL_CALL getTypeByName(const ::rtl::OUString& aName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::rtl::OUString SAL_CALL getValueByIndex(sal_Int16 i) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::rtl::OUString SAL_CALL getValueByName(const ::rtl::OUString& aName) throw( ::com::sun::star::uno::RuntimeException );
+
+ // ::com::sun::star::util::XCloneable
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone() throw( ::com::sun::star::uno::RuntimeException );
+
+ // methods that are not contained in any interface
+ void AddAttribute( const ::rtl::OUString &sName , const ::rtl::OUString &sValue );
+ void Clear();
+ void RemoveAttribute( const ::rtl::OUString sName );
+ void SetAttributeList( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & );
+ void AppendAttributeList( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & );
+ void SetValueByIndex( sal_Int16 i, const ::rtl::OUString& rValue );
+ void RemoveAttributeByIndex( sal_Int16 i );
+ void RenameAttributeByIndex( sal_Int16 i, const ::rtl::OUString& rNewName );
+ sal_Int16 GetIndexByName( const ::rtl::OUString& rName ) const;
+
+ private:
+ const ::rtl::OUString sType; // "CDATA"
+};
+
+
+#endif // _XMLOFF_ATTRLIST_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/contextid.hxx b/xmloff/inc/xmloff/contextid.hxx
new file mode 100644
index 000000000000..e4fffcd4cced
--- /dev/null
+++ b/xmloff/inc/xmloff/contextid.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_CONTEXTID_HXX_
+#define _XMLOFF_CONTEXTID_HXX_
+
+/** These defines determine the unique ids for XML style-context-id's
+ used in the SvXMLAutoStylePoolP.
+ */
+
+#define XML_SC_CTF_START 0x00001000
+#define XML_SD_CTF_START 0x00002000
+#define XML_TEXT_CTF_START 0x00003000
+#define XML_SCH_CTF_START 0x00004000
+#define XML_PM_CTF_START 0x00005000 // page master
+#define XML_FORM_CTF_START 0x00006000
+#define XML_DB_CTF_START 0x00007000
+
+
+#define CTF_SD_CONTROL_SHAPE_DATA_STYLE ( XML_SD_CTF_START + 1 )
+#define CTF_SD_NUMBERINGRULES_NAME ( XML_SD_CTF_START + 2 )
+#define CTF_SD_SHAPE_PARA_ADJUST ( XML_SD_CTF_START + 3 )
+
+#define CTF_FORMS_DATA_STYLE ( XML_FORM_CTF_START + 0 )
+
+/** use together with MID_FLAG_NO_PROPERTY to import the specified
+ attribute into the alien attribute container */
+
+#define CTF_ALIEN_ATTRIBUTE_IMPORT 0x00007fff
+
+#endif // _XMLOFF_CONTEXTID_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/controlpropertyhdl.hxx b/xmloff/inc/xmloff/controlpropertyhdl.hxx
new file mode 100644
index 000000000000..ffb636cd7163
--- /dev/null
+++ b/xmloff/inc/xmloff/controlpropertyhdl.hxx
@@ -0,0 +1,145 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_FORMS_CONTROLPROPERTYHDL_HXX_
+#define _XMLOFF_FORMS_CONTROLPROPERTYHDL_HXX_
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include <xmloff/prhdlfac.hxx>
+#include <rtl/ref.hxx>
+#include <rtl/ustring.hxx>
+#include <xmloff/xmlexppr.hxx>
+#include <xmloff/XMLConstantsPropertyHandler.hxx>
+
+struct SvXMLEnumMapEntry;
+class Color;
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ class IFormsExportContext;
+ class OFormLayerXMLImport_Impl;
+
+ //=====================================================================
+ //= ORotationAngleHandler
+ //=====================================================================
+ class ORotationAngleHandler : public XMLPropertyHandler
+ {
+ public:
+ ORotationAngleHandler();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& _rStrImpValue, ::com::sun::star::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& _rStrExpValue, const ::com::sun::star::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const;
+ };
+
+ //=====================================================================
+ //= OFontWidthHandler
+ //=====================================================================
+ class OFontWidthHandler : public XMLPropertyHandler
+ {
+ public:
+ OFontWidthHandler();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& _rStrImpValue, ::com::sun::star::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& _rStrExpValue, const ::com::sun::star::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const;
+ };
+
+ //=====================================================================
+ //= OControlBorderHandlerBase
+ //=====================================================================
+ class OControlBorderHandler : public XMLPropertyHandler
+ {
+ public:
+ enum BorderFacet
+ {
+ STYLE,
+ COLOR
+ };
+
+ OControlBorderHandler( const BorderFacet _eFacet );
+
+ virtual sal_Bool importXML( const ::rtl::OUString& _rStrImpValue, ::com::sun::star::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& _rStrExpValue, const ::com::sun::star::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const;
+
+ private:
+ BorderFacet m_eFacet;
+ };
+
+ //=====================================================================
+ //= OControlTextEmphasisHandler
+ //=====================================================================
+ class OControlTextEmphasisHandler : public XMLPropertyHandler
+ {
+ public:
+ OControlTextEmphasisHandler();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& _rStrImpValue, ::com::sun::star::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& _rStrExpValue, const ::com::sun::star::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const;
+ };
+
+ //=====================================================================
+ //= ImageScaleModeHandler
+ //=====================================================================
+ class XMLOFF_DLLPUBLIC ImageScaleModeHandler : public XMLConstantsPropertyHandler
+ {
+ public:
+ ImageScaleModeHandler();
+ };
+
+ //=====================================================================
+ //= OControlPropertyHandlerFactory
+ //=====================================================================
+ class XMLOFF_DLLPUBLIC OControlPropertyHandlerFactory : public XMLPropertyHandlerFactory
+ {
+ protected:
+ mutable XMLConstantsPropertyHandler* m_pTextAlignHandler;
+ mutable OControlBorderHandler* m_pControlBorderStyleHandler;
+ mutable OControlBorderHandler* m_pControlBorderColorHandler;
+ mutable ORotationAngleHandler* m_pRotationAngleHandler;
+ mutable OFontWidthHandler* m_pFontWidthHandler;
+ mutable XMLConstantsPropertyHandler* m_pFontEmphasisHandler;
+ mutable XMLConstantsPropertyHandler* m_pFontReliefHandler;
+
+ protected:
+ virtual ~OControlPropertyHandlerFactory();
+
+ public:
+ OControlPropertyHandlerFactory();
+
+ virtual const XMLPropertyHandler* GetPropertyHandler(sal_Int32 _nType) const;
+ };
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+#endif // _XMLOFF_FORMS_CONTROLPROPERTYHDL_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/dllapi.h b/xmloff/inc/xmloff/dllapi.h
new file mode 100755
index 000000000000..d89653cccb71
--- /dev/null
+++ b/xmloff/inc/xmloff/dllapi.h
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 INCLUDED_XMLOFF_DLLAPI_H
+#define INCLUDED_XMLOFF_DLLAPI_H
+
+#include "sal/config.h"
+#include "sal/types.h"
+
+#if defined XMLOFF_DLLIMPLEMENTATION
+#define XMLOFF_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define XMLOFF_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/families.hxx b/xmloff/inc/xmloff/families.hxx
new file mode 100644
index 000000000000..2751efa81770
--- /dev/null
+++ b/xmloff/inc/xmloff/families.hxx
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_FAMILIES_HXX_
+#define _XMLOFF_FAMILIES_HXX_
+
+/** These defines determine the unique ids for XML style-families
+ used in the SvXMLAutoStylePoolP.
+ */
+
+// Misc (Pool)
+// reserved: 0..99
+#define XML_STYLE_FAMILY_DATA_STYLE 0
+#define XML_STYLE_FAMILY_DATA_STYLE_NAME "data-style"
+#define XML_STYLE_FAMILY_PAGE_MASTER 1
+#define XML_STYLE_FAMILY_PAGE_MASTER_NAME "page-layout"
+#define XML_STYLE_FAMILY_PAGE_MASTER_PREFIX "pm"
+#define XML_STYLE_FAMILY_MASTER_PAGE 2
+
+// Text
+// reserved: 100..199
+#define XML_STYLE_FAMILY_TEXT_PARAGRAPH 100
+#define XML_STYLE_FAMILY_TEXT_TEXT 101
+#define XML_STYLE_FAMILY_TEXT_LIST 102
+#define XML_STYLE_FAMILY_TEXT_OUTLINE 103
+#define XML_STYLE_FAMILY_TEXT_FOOTNOTECONFIG 105
+#define XML_STYLE_FAMILY_TEXT_ENDNOTECONFIG 106
+#define XML_STYLE_FAMILY_TEXT_SECTION 107
+#define XML_STYLE_FAMILY_TEXT_FRAME 108 // export only
+#define XML_STYLE_FAMILY_TEXT_RUBY 109
+#define XML_STYLE_FAMILY_TEXT_BIBLIOGRAPHYCONFIG 110
+#define XML_STYLE_FAMILY_TEXT_LINENUMBERINGCONFIG 111
+
+// Table
+// reserved: 200..299
+#define XML_STYLE_FAMILY_TABLE_TABLE 200
+#define XML_STYLE_FAMILY_TABLE_TABLE_STYLES_NAME "table"
+#define XML_STYLE_FAMILY_TABLE_TABLE_STYLES_PREFIX "ta"
+#define XML_STYLE_FAMILY_TABLE_COLUMN 202
+#define XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_NAME "table-column"
+#define XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_PREFIX "co"
+#define XML_STYLE_FAMILY_TABLE_ROW 203
+#define XML_STYLE_FAMILY_TABLE_ROW_STYLES_NAME "table-row"
+#define XML_STYLE_FAMILY_TABLE_ROW_STYLES_PREFIX "ro"
+#define XML_STYLE_FAMILY_TABLE_CELL 204
+#define XML_STYLE_FAMILY_TABLE_CELL_STYLES_NAME "table-cell"
+#define XML_STYLE_FAMILY_TABLE_CELL_STYLES_PREFIX "ce"
+#define XML_STYLE_FAMILY_TABLE_TEMPLATE_ID 205
+
+// Impress/Draw
+// reserved: 300..399
+#define XML_STYLE_FAMILY_SD_GRAPHICS_ID 300
+#define XML_STYLE_FAMILY_SD_GRAPHICS_NAME "graphic"
+#define XML_STYLE_FAMILY_SD_GRAPHICS_PREFIX "gr"
+
+#define XML_STYLE_FAMILY_SD_PRESENTATION_ID 301
+#define XML_STYLE_FAMILY_SD_PRESENTATION_NAME "presentation"
+#define XML_STYLE_FAMILY_SD_PRESENTATION_PREFIX "pr"
+// families for derived from SvXMLStyleContext
+#define XML_STYLE_FAMILY_SD_PAGEMASTERCONEXT_ID 302
+#define XML_STYLE_FAMILY_SD_PAGEMASTERSTYLECONEXT_ID 306
+#define XML_STYLE_FAMILY_SD_PRESENTATIONPAGELAYOUT_ID 303
+// family for draw pool
+#define XML_STYLE_FAMILY_SD_POOL_ID 304
+#define XML_STYLE_FAMILY_SD_POOL_NAME "default"
+// family for presentation drawpage properties
+#define XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID 305
+#define XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME "drawing-page"
+#define XML_STYLE_FAMILY_SD_DRAWINGPAGE_PREFIX "dp"
+
+#define XML_STYLE_FAMILY_SD_GRADIENT_ID 306
+#define XML_STYLE_FAMILY_SD_HATCH_ID 307
+#define XML_STYLE_FAMILY_SD_FILL_IMAGE_ID 308
+#define XML_STYLE_FAMILY_SD_MARKER_ID 309
+#define XML_STYLE_FAMILY_SD_STROKE_DASH_ID 310
+
+// Chart
+// reserved: 400..499
+#define XML_STYLE_FAMILY_SCH_CHART_ID 400
+#define XML_STYLE_FAMILY_SCH_CHART_NAME "chart"
+#define XML_STYLE_FAMILY_SCH_CHART_PREFIX "ch"
+
+// Math
+// reserved: 500..599
+
+
+// Forms/Controls
+// reserved 600..649
+#define XML_STYLE_FAMILY_CONTROL_ID 600
+#define XML_STYLE_FAMILY_CONTROL_NAME "control"
+#define XML_STYLE_FAMILY_CONTROL_PREFIX "ctrl"
+
+#endif // _XMLOFF_FAMILIES_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/formlayerexport.hxx b/xmloff/inc/xmloff/formlayerexport.hxx
new file mode 100644
index 000000000000..f628dcffd869
--- /dev/null
+++ b/xmloff/inc/xmloff/formlayerexport.hxx
@@ -0,0 +1,211 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_FORMLAYEREXPORT_HXX_
+#define _XMLOFF_FORMLAYEREXPORT_HXX_
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <rtl/ref.hxx>
+#include <salhelper/simplereferenceobject.hxx>
+#include <xmloff/xmlexppr.hxx>
+
+namespace com { namespace sun { namespace star { namespace awt {
+ class XControlModel;
+} } } }
+
+class SvXMLExport;
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ class OFormLayerXMLExport_Impl;
+ class OFormsRootExport;
+
+ //=====================================================================
+ //= OFormLayerXMLExport
+ //=====================================================================
+ /** provides functionallity for exporting a complete form layer.
+ */
+ class XMLOFF_DLLPUBLIC OFormLayerXMLExport
+ :public ::salhelper::SimpleReferenceObject
+ {
+ protected:
+ /// our export context
+ SvXMLExport& m_rContext;
+ // impl class
+ OFormLayerXMLExport_Impl* m_pImpl;
+
+ protected:
+ ~OFormLayerXMLExport();
+
+ public:
+ OFormLayerXMLExport(SvXMLExport& _rContext);
+
+ /** initial the object
+
+ <p>To be called if you want to reuse the same object for exportin different documents.</p>
+
+ <p>You don't need to call this if you just constructed the object, in this case it is already
+ initialized..</p>
+ */
+ void initialize();
+
+ /** initializes some internal structures for fast access to the given page
+
+ <p>This method has to be called before you use getControlId for controls on the given page.
+ This way a performance optimization can be done for faster access to the control ids</p>
+
+ @return
+ <TRUE/> if the page has been examined before. If <FALSE/> is returned, this is a serious error.
+
+ @see getControlId
+ @see examineForms
+ */
+ sal_Bool seekPage(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& _rxDrawPage);
+
+ /** get the id for the given control
+
+ <p>The page the control belongs to must have been examined and sought to.</p>
+
+ @param _rxControl
+ the control which's id should be retrieved. Must not be <NULL/>.
+
+ @see examineForms
+ @see seekPage
+
+ */
+ ::rtl::OUString getControlId(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControl);
+
+ /** retrieves the style name for the control's number style.
+
+ <p>For performance reasons, this method is allowed to be called for any controls, even those which
+ do not have a number style. In this case, an empty string is returned.</p>
+
+ @param _rxControl
+ the control which's id should be retrieved. Must not be <NULL/>.
+
+ @see examineForms
+ @see seekPage
+ */
+ ::rtl::OUString getControlNumberStyle(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControl );
+
+ /** examines the forms collection given.
+
+ <p>This method will collect all form layer related data of the given draw page</p>
+
+ @param _rxDrawPage
+ the draw page to examine. The object will be queried for a <type scope="com.sun.star.form">XFormsSupplier</type>
+ interface to obtain the forms container.
+ */
+ void examineForms(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& _rxDrawPage);
+
+ /** exports the structure of a form layer
+
+ <p>This method does not export styles (e.g. font properties of the controls), or any references
+ external instances may have to the control models contained in the form layer (e.g. uno control
+ shapes in the drawing layer may have such references)</p>
+
+ <p>No top level element describing the whole collection is inserted. I.e. if within your document, you
+ expect the the forms collection to be stored like
+ <listing>
+ &lt;Forms&gt;
+ .... // all the forms stuff here
+ &lt;/Forms&gt;
+ </listing>
+ you have to start the Forms element yourself.</p>
+
+ @param _rxDrawPage
+ the draw page to examine. The object will be queried for a <type scope="com.sun.star.form">XFormsSupplier</type>
+ interface to obtain the forms container.
+ */
+ void exportForms(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& _rxDrawPage);
+
+ /** exports the XForms model data
+ */
+ void exportXForms() const;
+
+ /** determines whether the given page contains logical forms
+ */
+ bool pageContainsForms( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& _rxDrawPage ) const;
+
+ /** determines whether the given page contains XForm instances
+ */
+ bool documentContainsXForms() const;
+
+ /** exports the controls number styles
+ */
+ void exportControlNumberStyles();
+
+ /** exports the automatic controls number styles
+ */
+ void exportAutoControlNumberStyles();
+
+ /** exports the auto-styles collected during the examineForms calls
+ */
+ void exportAutoStyles();
+
+ /** exclude the given control (model) from export.
+
+ <p>If your document contains form controls which are not to be exported for whatever reason,
+ you need to announce the models of these controls (can be retrieved from XControlShape::getControl)
+ to the form layer exporter.<br/>
+ Of course you have to do this before calling <member>exportForms</member></p>
+ */
+ void excludeFromExport( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > _rxControl );
+ };
+
+ //=========================================================================
+ //= OOfficeFormsExport
+ //=========================================================================
+ /// export helper for the office::forms element
+ class XMLOFF_DLLPUBLIC OOfficeFormsExport
+ {
+ private:
+ OFormsRootExport* m_pImpl;
+
+ public:
+ OOfficeFormsExport( SvXMLExport& _rExp );
+ ~OOfficeFormsExport();
+ };
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+#endif // _XMLOFF_FORMLAYEREXPORT_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/formlayerimport.hxx b/xmloff/inc/xmloff/formlayerimport.hxx
new file mode 100644
index 000000000000..5f814f6638fc
--- /dev/null
+++ b/xmloff/inc/xmloff/formlayerimport.hxx
@@ -0,0 +1,168 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_FORMLAYERIMPORT_HXX_
+#define _XMLOFF_FORMLAYERIMPORT_HXX_
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <rtl/ref.hxx>
+#include <salhelper/simplereferenceobject.hxx>
+#include <xmloff/xmlimppr.hxx>
+
+class SvXMLImport;
+class SvXMLImportContext;
+class SvXMLStylesContext;
+class XMLPropStyleContext;
+
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ //=====================================================================
+ //= OFormLayerXMLImport
+ //=====================================================================
+ class OFormLayerXMLImport_Impl;
+ /** allows you to import a &lt;form:form&gt; element
+ */
+ class XMLOFF_DLLPUBLIC OFormLayerXMLImport
+ :public ::salhelper::SimpleReferenceObject
+ {
+ OFormLayerXMLImport_Impl* m_pImpl;
+
+ public:
+ OFormLayerXMLImport(SvXMLImport& _rImporter);
+ ~OFormLayerXMLImport();
+
+ /** start importing the forms of the given page
+
+ <p>starting the import of a new page (by using this method) invalidates the current page position
+ you may have set with <method>seekPage</method>.</p>
+
+ @see endPage
+ @see seekPage
+ */
+ void startPage(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& _rxDrawPage);
+
+ /** creates an import context for the office:forms element
+ */
+ SvXMLImportContext* createOfficeFormsContext(
+ SvXMLImport& _rImport,
+ sal_uInt16 _nPrefix,
+ const rtl::OUString& _rLocalName);
+
+ /** create an <type>SvXMLImportContext</type> instance which is able to import the &lt;form:form&gt;
+ element.
+
+ <p>You must have called <method>startPage</method> before you can create such an import context.</p>
+
+ @see startPage
+ @see endPage
+ */
+ SvXMLImportContext* createContext(
+ const sal_uInt16 _nPrefix,
+ const rtl::OUString& _rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttribs);
+
+ /** lookup a control given by id.
+
+ <p>The control must be part of the page which is currently beeing imported, or you must have used
+ seekPage for the page which the control belongs to.</p>
+
+ <p>(And, of course, the control must have been imported already at the moment you call this.)</p>
+
+ @see startPage
+ @see seekPage
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ lookupControl(const ::rtl::OUString& _rId);
+
+ /** end importing the forms of the current page
+
+ <p>You must call this method if you want the import to be finished correctly. Without calling
+ it, you will lose information.</p>
+
+ @see startPage
+ @see seekPage
+ */
+ void endPage();
+
+ /** seek to the given page.
+
+ <p>This method should be used if you want to call lookupControl outside of a startPage-endPage frame.</p>
+
+ <p>You can't seek to a page which hasn't been imported yet. This means that you must have called
+ <method>endPage</method> for the page in question.</p>
+
+ <p>The "current page" position you have set with this method is invalidated as soon as you call
+ <method>startPage</method> for a new page.</p>
+
+ <p>You should not call seekPage while importing a page (i.e. between startPage and endPage). This will
+ smash this other page beeing imported (seeking back to it will not help you :).</p>
+
+ @see lookupControl
+ */
+ void seekPage(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& _rxDrawPage);
+
+ /** announces the auto-style context to the form importer
+ */
+ void setAutoStyleContext(SvXMLStylesContext* _pNewContext);
+
+ /** sets the given number style on the given control
+ @param _rxControlModel
+ the control model which's style is to be set
+ @param _rControlNumerStyleName
+ the style name for the control's number style
+ */
+ void applyControlNumberStyle(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel,
+ const ::rtl::OUString& _rControlNumerStyleName
+ );
+
+ /** to be called when the document has been completely imported
+
+ <p>For some documents (currently: only some spreadsheet documents) it's necessary
+ do to a post processing, since not all information from the file can be processed
+ if the document is not completed, yet.</p>
+ */
+ void documentDone( );
+ };
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+#endif // _XMLOFF_FORMLAYERIMPORT_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/formsimp.hxx b/xmloff/inc/xmloff/formsimp.hxx
new file mode 100644
index 000000000000..3fadb7195e51
--- /dev/null
+++ b/xmloff/inc/xmloff/formsimp.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_FORMSIMP_HXX
+#define _XMLOFF_FORMSIMP_HXX
+
+#include <xmloff/xmlictxt.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// presentations:animations
+
+class XMLFormsContext : public SvXMLImportContext
+{
+public:
+ TYPEINFO();
+
+ XMLFormsContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLocalName);
+ virtual ~XMLFormsContext();
+
+ virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+};
+
+#endif // _XMLOFF_ANIMIMP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/functional.hxx b/xmloff/inc/xmloff/functional.hxx
new file mode 100644
index 000000000000..c7b4938d2925
--- /dev/null
+++ b/xmloff/inc/xmloff/functional.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_FUNCTIONAL_HXX
+#define _XMLOFF_FUNCTIONAL_HXX
+
+#include <rtl/ustring.hxx>
+
+/* THIS HEADER IS DEPRECATED. USE comphelper/stl_types.hxx INSTEAD!!! */
+
+/** @#file
+ *
+ * re-implement STL functors as needed
+ *
+ * The standard comparison operators from the STL cause warnings with
+ * several compilers about our sal_Bool (=unsigned char) being
+ * converted to bool (C++ bool). We wish to avoid that.
+ */
+
+struct less_functor
+{
+ bool operator()(const ::rtl::OUString& x,
+ const ::rtl::OUString& y) const
+ {
+ return 0 != (x<y);
+ }
+};
+
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/i18nmap.hxx b/xmloff/inc/xmloff/i18nmap.hxx
new file mode 100644
index 000000000000..2f56e26bf5f8
--- /dev/null
+++ b/xmloff/inc/xmloff/i18nmap.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_I18NMAP_HXX
+#define _XMLOFF_I18NMAP_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include "sal/types.h"
+#include <tools/solar.h>
+
+
+namespace rtl
+{
+ class OUString;
+}
+
+class SvI18NMap_Impl;
+class SvI18NMapEntry_Impl;
+
+class XMLOFF_DLLPUBLIC SvI18NMap
+{
+ SvI18NMap_Impl *pImpl;
+
+ SAL_DLLPRIVATE SvI18NMapEntry_Impl *_Find( sal_uInt16 nKind,
+ const ::rtl::OUString& rName ) const;
+
+public:
+
+ SvI18NMap();
+ ~SvI18NMap();
+
+ // Add a name mapping
+ void Add( sal_uInt16 nKind, const ::rtl::OUString& rName,
+ const ::rtl::OUString& rNewName );
+
+ // Return a mapped name. If the name could not be found, return the
+ // original name.
+ const ::rtl::OUString& Get( sal_uInt16 nKind,
+ const ::rtl::OUString& rName ) const;
+};
+
+
+#endif // _XMLOFF_I18NMAP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/maptype.hxx b/xmloff/inc/xmloff/maptype.hxx
new file mode 100644
index 000000000000..a4afdd020887
--- /dev/null
+++ b/xmloff/inc/xmloff/maptype.hxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PROPMAPPINGTYPES_HXX
+#define _XMLOFF_PROPMAPPINGTYPES_HXX
+
+#include <tools/solar.h>
+#include <com/sun/star/uno/Any.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <unotools/saveopt.hxx>
+
+///////////////////////////////////////////////////////////////////////////
+//
+/** Represents a property with its API-name, its XML-name and the type of
+ its value.
+*/
+struct XMLPropertyMapEntry
+{
+ const sal_Char* msApiName; /// Property-Name
+ sal_Int32 nApiNameLength; /// length of property name
+ sal_uInt16 mnNameSpace; /** declares the Namespace in wich this
+ property exists */
+ enum ::xmloff::token::XMLTokenEnum meXMLName; /// XML-Name
+ sal_Int32 mnType; /** Bit 0..23 : XML-Type of its value
+ Bit 24..31: The flags specifies
+ additional rules how
+ to im/export the porperty */
+ sal_Int16 mnContextId; /// User defined id for context filtering
+ SvtSaveOptions::ODFDefaultVersion mnEarliestODFVersionForExport;// no export when the used ODF version is lower than this
+};
+
+///////////////////////////////////////////////////////////////////////////
+//
+/** Smart struct to transport an Any with an index to the appropriate
+ property-name
+*/
+struct XMLPropertyState
+{
+ sal_Int32 mnIndex;
+ ::com::sun::star::uno::Any maValue;
+
+ XMLPropertyState( sal_Int32 nIndex )
+ : mnIndex( nIndex ) {}
+ XMLPropertyState( sal_Int32 nIndex, const ::com::sun::star::uno::Any& rValue )
+ : mnIndex( nIndex ), maValue( rValue ) {}
+ XMLPropertyState( const XMLPropertyState& rPropState )
+ : mnIndex( rPropState.mnIndex ), maValue( rPropState.maValue ) {}
+};
+
+#endif // _XMLOFF_PROPMAPPINGTYPES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/nmspmap.hxx b/xmloff/inc/xmloff/nmspmap.hxx
new file mode 100644
index 000000000000..e56983a58df8
--- /dev/null
+++ b/xmloff/inc/xmloff/nmspmap.hxx
@@ -0,0 +1,186 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_NMSPMAP_HXX
+#define _XMLOFF_NMSPMAP_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include "sal/types.h"
+#include <rtl/ustring.hxx>
+#include <boost/unordered_map.hpp>
+#include <map>
+#include <rtl/ref.hxx>
+#include <cppuhelper/weak.hxx>
+
+#include <limits.h>
+
+const sal_uInt16 XML_NAMESPACE_XMLNS = (USHRT_MAX-2);
+const sal_uInt16 XML_NAMESPACE_NONE = (USHRT_MAX-1);
+const sal_uInt16 XML_NAMESPACE_UNKNOWN = (USHRT_MAX);
+const sal_uInt16 XML_NAMESPACE_UNKNOWN_FLAG = 0x8000;
+
+class NameSpaceEntry : public cppu::OWeakObject
+{
+public:
+ // sName refers to the full namespace name
+ ::rtl::OUString sName;
+ // sPrefix is the prefix used to declare a given item to be from a given namespace
+ ::rtl::OUString sPrefix;
+ // nKey is the unique identifier of a namespace
+ sal_uInt16 nKey;
+};
+
+struct OUStringEqFunc
+{
+ sal_Bool operator()( const rtl::OUString &r1,
+ const rtl::OUString &r2) const
+ {
+ return r1 == r2;
+ }
+};
+
+struct uInt32lt
+{
+ sal_Bool operator()( const sal_uInt32 &r1,
+ const sal_uInt32 &r2) const
+ {
+ return r1 < r2;
+ }
+};
+typedef ::std::pair < sal_uInt16, const ::rtl::OUString* > QNamePair;
+
+struct QNamePairHash
+{
+ size_t operator()( const QNamePair &r1 ) const
+ {
+ return (size_t) r1.second->hashCode() + r1.first;
+ }
+};
+struct QNamePairEq
+{
+ bool operator()( const QNamePair &r1,
+ const QNamePair &r2 ) const
+ {
+ return r1.first == r2.first && *(r1.second) == *(r2.second);
+ }
+};
+
+typedef ::boost::unordered_map < QNamePair, ::rtl::OUString, QNamePairHash, QNamePairEq > QNameCache;
+typedef ::boost::unordered_map < ::rtl::OUString, ::rtl::Reference <NameSpaceEntry >, rtl::OUStringHash, OUStringEqFunc > NameSpaceHash;
+typedef ::std::map < sal_uInt16, ::rtl::Reference < NameSpaceEntry >, uInt32lt > NameSpaceMap;
+
+class XMLOFF_DLLPUBLIC SvXMLNamespaceMap
+{
+ const ::rtl::OUString sXMLNS;
+ const ::rtl::OUString sEmpty;
+
+ NameSpaceHash aNameHash, aNameCache;
+ NameSpaceMap aNameMap;
+ QNameCache aQNameCache;
+ SAL_DLLPRIVATE sal_uInt16 _Add( const rtl::OUString& rPrefix, const rtl::OUString &rName, sal_uInt16 nKey );
+
+public:
+
+ SvXMLNamespaceMap();
+ ~SvXMLNamespaceMap();
+
+ SvXMLNamespaceMap( const SvXMLNamespaceMap& );
+
+ void operator =( const SvXMLNamespaceMap& rCmp );
+ int operator ==( const SvXMLNamespaceMap& rCmp ) const;
+
+ sal_uInt16 Add( const ::rtl::OUString& rPrefix,
+ const ::rtl::OUString& rName,
+ sal_uInt16 nKey = XML_NAMESPACE_UNKNOWN );
+ sal_uInt16 AddIfKnown( const ::rtl::OUString& rPrefix,
+ const ::rtl::OUString& rName );
+
+ sal_uInt16 GetKeyByName( const ::rtl::OUString& rName ) const;
+ const ::rtl::OUString& GetNameByKey( sal_uInt16 nKey ) const;
+
+ sal_uInt16 GetKeyByPrefix( const ::rtl::OUString& rPrefix ) const;
+ const ::rtl::OUString& GetPrefixByKey( sal_uInt16 nKey ) const;
+
+ ::rtl::OUString GetQNameByKey( sal_uInt16 nKey,
+ const ::rtl::OUString& rLocalName,
+ sal_Bool bCache = sal_True) const;
+
+ ::rtl::OUString GetAttrNameByKey( sal_uInt16 nKey ) const;
+
+ /* This will replace the version with the unused 5th default parameter */
+ sal_uInt16 _GetKeyByAttrName( const ::rtl::OUString& rAttrName,
+ ::rtl::OUString *pPrefix,
+ ::rtl::OUString *pLocalName,
+ ::rtl::OUString *pNamespace = 0,
+ sal_Bool bCache = sal_True) const;
+
+ /* This will replace the version with the unused 3rd default parameter */
+ sal_uInt16 _GetKeyByAttrName( const ::rtl::OUString& rAttrName,
+ ::rtl::OUString *pLocalName = 0,
+ sal_Bool bCache = sal_True) const;
+
+ sal_uInt16 GetFirstKey() const;
+ sal_uInt16 GetNextKey( sal_uInt16 nOldKey ) const;
+
+ /* Give access to all namespace definitions, including multiple entries
+ for the same key (needed for saving sheets separately in Calc).
+ This might be replaced by a better interface later. */
+ const NameSpaceHash& GetAllEntries() const { return aNameHash; }
+
+ static sal_Bool NormalizeOasisURN( ::rtl::OUString& rName );
+ static sal_Bool NormalizeW3URI( ::rtl::OUString& rName );
+ static sal_Bool NormalizeURI( ::rtl::OUString& rName );
+
+/* deprecated */ sal_Bool AddAtIndex( sal_uInt16 nIdx, const ::rtl::OUString& rPrefix,
+ const ::rtl::OUString& rName, sal_uInt16 nKey = XML_NAMESPACE_UNKNOWN );
+/* deprecated */ sal_Bool AddAtIndex( sal_uInt16 nIdx, const sal_Char *pPrefix,
+ const sal_Char *pName, sal_uInt16 nKey = XML_NAMESPACE_UNKNOWN );
+/* deprecated */ sal_uInt16 GetIndexByKey( sal_uInt16 nKey ) const;
+/* deprecated */ sal_uInt16 GetKeyByIndex( sal_uInt16 nIdx ) const;
+/* deprecated */ sal_uInt16 GetIndexByPrefix( const ::rtl::OUString& rPrefix ) const;
+/* deprecated */ sal_uInt16 GetFirstIndex() const;
+/* deprecated */ sal_uInt16 GetNextIndex( sal_uInt16 nOldIdx ) const;
+/* deprecated */ const ::rtl::OUString& GetPrefixByIndex( sal_uInt16 nIdx ) const;
+/* deprecated */ const ::rtl::OUString& GetNameByIndex( sal_uInt16 nIdx ) const;
+/* deprecated */ ::rtl::OUString GetAttrNameByIndex( sal_uInt16 nIdx ) const;
+/* deprecated */ ::rtl::OUString GetQNameByIndex( sal_uInt16 nIdx,
+ const ::rtl::OUString& rLocalName ) const;
+/* deprecated */ sal_uInt16 GetKeyByAttrName( const ::rtl::OUString& rAttrName,
+ ::rtl::OUString *pPrefix,
+ ::rtl::OUString *pLocalName,
+ ::rtl::OUString *pNamespace=0,
+ sal_uInt16 nIdxGuess = USHRT_MAX ) const;
+/* deprecated */ sal_uInt16 GetKeyByAttrName( const ::rtl::OUString& rAttrName,
+ ::rtl::OUString *pLocalName = 0,
+ sal_uInt16 nIdxGuess = USHRT_MAX ) const;
+};
+
+#endif // _XMLOFF_NMSPMAP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/numehelp.hxx b/xmloff/inc/xmloff/numehelp.hxx
new file mode 100644
index 000000000000..f6eeeed55877
--- /dev/null
+++ b/xmloff/inc/xmloff/numehelp.hxx
@@ -0,0 +1,129 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 XMLOFF_NUMEHELP_HXX
+#define XMLOFF_NUMEHELP_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include <sal/types.h>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+
+#include <set>
+
+class SvXMLExport;
+namespace rtl
+{
+ class OUString;
+}
+
+struct XMLNumberFormat
+{
+ rtl::OUString sCurrency;
+ sal_Int32 nNumberFormat;
+ sal_Int16 nType;
+ sal_Bool bIsStandard : 1;
+ XMLNumberFormat() : nNumberFormat(0), nType(0) {}
+ XMLNumberFormat(const rtl::OUString& sTempCurrency, sal_Int32 nTempFormat,
+ sal_Int16 nTempType) : sCurrency(sTempCurrency), nNumberFormat(nTempFormat),
+ nType(nTempType) {}
+};
+
+struct LessNumberFormat
+{
+ sal_Bool operator() (const XMLNumberFormat& rValue1, const XMLNumberFormat& rValue2) const
+ {
+ return rValue1.nNumberFormat < rValue2.nNumberFormat;
+ }
+};
+
+typedef std::set<XMLNumberFormat, LessNumberFormat> XMLNumberFormatSet;
+
+class XMLOFF_DLLPUBLIC XMLNumberFormatAttributesExportHelper
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats > xNumberFormats;
+ SvXMLExport* pExport;
+ const rtl::OUString sEmpty;
+ const rtl::OUString sStandardFormat;
+ const rtl::OUString sType;
+ const rtl::OUString sAttrValueType;
+ const rtl::OUString sAttrValue;
+ const rtl::OUString sAttrDateValue;
+ const rtl::OUString sAttrTimeValue;
+ const rtl::OUString sAttrBooleanValue;
+ const rtl::OUString sAttrStringValue;
+ const rtl::OUString sAttrCurrency;
+ const rtl::OUString msCurrencySymbol;
+ const rtl::OUString msCurrencyAbbreviation;
+ XMLNumberFormatSet aNumberFormats;
+public :
+ XMLNumberFormatAttributesExportHelper(::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier);
+ XMLNumberFormatAttributesExportHelper(::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier,
+ SvXMLExport& rExport );
+ ~XMLNumberFormatAttributesExportHelper();
+ void SetExport(SvXMLExport* pExp) { this->pExport = pExp; }
+
+ sal_Int16 GetCellType(const sal_Int32 nNumberFormat, rtl::OUString& sCurrency, sal_Bool& bIsStandard);
+ static void WriteAttributes(SvXMLExport& rXMLExport,
+ const sal_Int16 nTypeKey,
+ const double& rValue,
+ const rtl::OUString& rCurrencySymbol,
+ sal_Bool bExportValue = sal_True);
+ static sal_Bool GetCurrencySymbol(const sal_Int32 nNumberFormat, rtl::OUString& rCurrencySymbol,
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > & xNumberFormatsSupplier);
+ static sal_Int16 GetCellType(const sal_Int32 nNumberFormat, sal_Bool& bIsStandard,
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > & xNumberFormatsSupplier);
+ static void SetNumberFormatAttributes(SvXMLExport& rXMLExport,
+ const sal_Int32 nNumberFormat,
+ const double& rValue,
+ sal_Bool bExportValue = sal_True);
+ static void SetNumberFormatAttributes(SvXMLExport& rXMLExport,
+ const rtl::OUString& rValue,
+ const rtl::OUString& rCharacters,
+ sal_Bool bExportValue = sal_True,
+ sal_Bool bExportTypeAttribute = sal_True);
+
+ sal_Bool GetCurrencySymbol(const sal_Int32 nNumberFormat, rtl::OUString& rCurrencySymbol);
+ sal_Int16 GetCellType(const sal_Int32 nNumberFormat, sal_Bool& bIsStandard);
+ void WriteAttributes(const sal_Int16 nTypeKey,
+ const double& rValue,
+ const rtl::OUString& rCurrencySymbol,
+ sal_Bool bExportValue = sal_True);
+ void SetNumberFormatAttributes(const sal_Int32 nNumberFormat,
+ const double& rValue,
+ sal_Bool bExportValue = sal_True);
+ void SetNumberFormatAttributes(const rtl::OUString& rValue,
+ const rtl::OUString& rCharacters,
+ sal_Bool bExportValue = sal_True,
+ sal_Bool bExportTypeAttribute = sal_True);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/odffields.hxx b/xmloff/inc/xmloff/odffields.hxx
new file mode 100644
index 000000000000..ae2c78ddc59f
--- /dev/null
+++ b/xmloff/inc/xmloff/odffields.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+/*
+ * Copyright 2008 by Novell, Inc.
+ */
+
+#ifndef _ODFFIELDS_HXX
+#define _ODFFIELDS_HXX
+
+
+#define ODF_FORMTEXT "vnd.oasis.opendocument.field.FORMTEXT"
+
+#define ODF_FORMCHECKBOX "vnd.oasis.opendocument.field.FORMCHECKBOX"
+#define ODF_FORMCHECKBOX_HELPTEXT "Checkbox_HelpText"
+#define ODF_FORMCHECKBOX_NAME "Checkbox_Name"
+#define ODF_FORMCHECKBOX_RESULT "Checkbox_Checked"
+
+#define ODF_FORMDROPDOWN "vnd.oasis.opendocument.field.FORMDROPDOWN"
+#define ODF_FORMDROPDOWN_LISTENTRY "Dropdown_ListEntry"
+#define ODF_FORMDROPDOWN_RESULT "Dropdown_Selected"
+
+#define ODF_TOC "vnd.oasis.opendocument.field.TOC"
+
+#define ODF_HYPERLINK "vnd.oasis.opendocument.field.HYPERLINK"
+
+#define ODF_PAGEREF "vnd.oasis.opendocument.field.PAGEREF"
+
+#define ODF_UNHANDLED "vnd.oasis.opendocument.field.UNHANDLED"
+#define ODF_OLE_PARAM "vnd.oasis.opendocument.field.ole"
+#define ODF_ID_PARAM "vnd.oasis.opendocument.field.id"
+#define ODF_CODE_PARAM "vnd.oasis.opendocument.field.code"
+
+#endif /* _ODFFIELDS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/prhdlfac.hxx b/xmloff/inc/xmloff/prhdlfac.hxx
new file mode 100644
index 000000000000..c13d43654dea
--- /dev/null
+++ b/xmloff/inc/xmloff/prhdlfac.hxx
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PROPERTYHANDLERFACTORY_HXX
+#define _XMLOFF_PROPERTYHANDLERFACTORY_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include "sal/types.h"
+
+#include <map>
+#include <xmloff/uniref.hxx>
+#include <xmloff/xmlprhdl.hxx>
+
+/**
+ This class is a base-class to create XMLPropertyHandler.
+ It creates PropertyHandler for given XML-types and store
+ them in an internal cache. They'll be deleted at destruction-
+ time.
+ For create your own PropertyHandler for specific XML-types
+ you have to override the virtual method GetPropertyHandler
+ ( see below ).
+*/
+class XMLOFF_DLLPUBLIC XMLPropertyHandlerFactory : public UniRefBase
+{
+public:
+ virtual ~XMLPropertyHandlerFactory();
+
+ /**
+ This method retrieves a PropertyHandler for the given XML-type.
+ To extend this method for more XML-types override this method
+ like the example below. If you call the method of the base-class
+ you get propertyhandler for basic-XML-types ( e.g. for color, percent, ... ).
+ Afetr that you could create your new XML-types. After creating a new type
+ you have to put the pointer into the cache via the method
+ PutHdlCache( sal_Int32 , XMLPropertyHandler* ).
+
+ virtual const XMLPropertyHandler* GetPropertyHandler( sal_Int32 nType ) const
+ {
+ XMLPropertyHandler* pHdl = XMLPropertyHandlerFactory::GetPropertyHandler( nType );
+
+ if( !pHdl )
+ {
+ switch( nType )
+ {
+ case XML_TYPE_XYZ :
+ pHdl = new XML_xyz_PropHdl;
+ break;
+ case ...
+ :
+ :
+ }
+
+ if( pHdl )
+ PutHdlCache( nType, pHdl );
+ }
+
+ return pHdl;
+ }
+ */
+ virtual const XMLPropertyHandler* GetPropertyHandler( sal_Int32 nType ) const;
+
+ /** helper method to statically create a property handler; this will not
+ * use the handler cache. This method should only be called in special
+ * circumstances; calling GetPropertyHandler is almost always
+ * preferable. */
+ static const XMLPropertyHandler* CreatePropertyHandler( sal_Int32 nType );
+
+protected:
+ /** Retrieves a PropertyHandler from the internal cache */
+ XMLPropertyHandler* GetHdlCache( sal_Int32 nType ) const;
+ /** Puts a PropertyHandler into the internal cache */
+ void PutHdlCache( sal_Int32 nType, const XMLPropertyHandler* pHdl ) const;
+
+private:
+ /** Retrieves ( creates if necessary ) PropertyHandler for
+ basic XML-types */
+ SAL_DLLPRIVATE const XMLPropertyHandler* GetBasicHandler( sal_Int32 nType )
+ const;
+
+ typedef ::std::map< sal_Int32, XMLPropertyHandler* > CacheMap;
+ CacheMap maHandlerCache;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLERFACTORY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/prstylei.hxx b/xmloff/inc/xmloff/prstylei.hxx
new file mode 100644
index 000000000000..d777206da2a2
--- /dev/null
+++ b/xmloff/inc/xmloff/prstylei.hxx
@@ -0,0 +1,108 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PRSTYLEI_HXX_
+#define _XMLOFF_PRSTYLEI_HXX_
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include "sal/types.h"
+#include <com/sun/star/style/XStyle.hpp>
+#include <vector>
+#include <xmloff/xmlstyle.hxx>
+
+struct XMLPropertyState;
+class SvXMLStylesContext;
+
+namespace com { namespace sun { namespace star {
+ namespace beans { class XPropertySet; }
+} } }
+
+class XMLOFF_DLLPUBLIC XMLPropStyleContext : public SvXMLStyleContext
+{
+ const ::rtl::OUString msIsPhysical;
+ const ::rtl::OUString msFollowStyle;
+ ::std::vector< XMLPropertyState > maProperties;
+ ::com::sun::star::uno::Reference < ::com::sun::star::style::XStyle > mxStyle;
+ SvXMLImportContextRef mxStyles;
+
+ SAL_DLLPRIVATE XMLPropStyleContext(XMLPropStyleContext &); // not defined
+ SAL_DLLPRIVATE void operator =(XMLPropStyleContext &); // not defined
+
+protected:
+
+ virtual void SetAttribute( sal_uInt16 nPrefixKey,
+ const ::rtl::OUString& rLocalName,
+ const ::rtl::OUString& rValue );
+ SvXMLStylesContext *GetStyles() { return (SvXMLStylesContext *)&mxStyles; }
+ ::std::vector< XMLPropertyState > & GetProperties() { return maProperties; }
+
+ // This methos my be overloaded to create a new style. Its called by
+ // CreateInsert to create a style if a style with the requested family and
+ // name couldn't be found. The st
+ virtual ::com::sun::star::uno::Reference <
+ ::com::sun::star::style::XStyle > Create();
+
+public:
+
+ TYPEINFO();
+
+ XMLPropStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
+ SvXMLStylesContext& rStyles, sal_uInt16 nFamily = 0,
+ sal_Bool bDefaultStyle=sal_False );
+ virtual ~XMLPropStyleContext();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+ virtual void FillPropertySet(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rPropSet );
+
+ const SvXMLStylesContext *GetStyles() const { return (const SvXMLStylesContext *)&mxStyles; }
+ const ::std::vector< XMLPropertyState > & GetProperties() const { return maProperties; }
+
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::style::XStyle >&
+ GetStyle() const { return mxStyle; }
+ void SetStyle(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::style::XStyle >& xStl) { mxStyle = xStl; }
+
+ virtual void SetDefaults();
+
+ virtual void CreateAndInsert( sal_Bool bOverwrite );
+ virtual void Finish( sal_Bool bOverwrite );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/shapeexport.hxx b/xmloff/inc/xmloff/shapeexport.hxx
new file mode 100644
index 000000000000..fd97c522f257
--- /dev/null
+++ b/xmloff/inc/xmloff/shapeexport.hxx
@@ -0,0 +1,340 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_SHAPEEXPORT_HXX_
+#define _XMLOFF_SHAPEEXPORT_HXX_
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include "sal/types.h"
+
+#include <rtl/ref.hxx>
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <xmloff/uniref.hxx>
+
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+#include <map>
+#include <xmloff/xmlprmap.hxx>
+#include <xmloff/xmlexppr.hxx>
+#include <xmloff/animexp.hxx>
+#include <xmloff/families.hxx>
+
+#include "xmloff/table/XMLTableExport.hxx"
+
+// shape export features are bits used for the nFeature
+// parameter of XMLShapeExport::exportShape
+
+#define SEF_EXPORT_X 0x0001
+#define SEF_EXPORT_Y 0x0002
+#define SEF_EXPORT_POSITION 0x0003
+
+#define SEF_EXPORT_WIDTH 0x0004
+#define SEF_EXPORT_HEIGHT 0x0008
+#define SEF_EXPORT_SIZE 0x000c
+
+// when you set this flag a chart does NOT export its own data as table element
+#define SEF_EXPORT_NO_CHART_DATA 0x0010
+
+// When setting the flag below no ignorableWhiteSpace will be called around
+// the drawing object elements
+#define SEF_EXPORT_NO_WS 0x0020
+
+// When setting the flag below a callout shape is exported as office:annotation
+#define SEF_EXPORT_ANNOTATION 0x0040
+
+#define SEF_DEFAULT SEF_EXPORT_POSITION|SEF_EXPORT_SIZE
+
+enum XmlShapeType
+{
+ XmlShapeTypeUnknown, // not known
+
+ XmlShapeTypeDrawRectangleShape, // "com.sun.star.drawing.RectangleShape"
+ XmlShapeTypeDrawEllipseShape, // "com.sun.star.drawing.EllipseShape"
+ XmlShapeTypeDrawControlShape, // "com.sun.star.drawing.ControlShape"
+ XmlShapeTypeDrawConnectorShape, // "com.sun.star.drawing.ConnectorShape"
+ XmlShapeTypeDrawMeasureShape, // "com.sun.star.drawing.MeasureShape"
+ XmlShapeTypeDrawLineShape, // "com.sun.star.drawing.LineShape"
+ XmlShapeTypeDrawPolyPolygonShape, // "com.sun.star.drawing.PolyPolygonShape"
+ XmlShapeTypeDrawPolyLineShape, // "com.sun.star.drawing.PolyLineShape"
+ XmlShapeTypeDrawOpenBezierShape, // "com.sun.star.drawing.OpenBezierShape"
+ XmlShapeTypeDrawClosedBezierShape, // "com.sun.star.drawing.ClosedBezierShape"
+ XmlShapeTypeDrawGraphicObjectShape, // "com.sun.star.drawing.GraphicObjectShape"
+ XmlShapeTypeDrawGroupShape, // "com.sun.star.drawing.GroupShape"
+ XmlShapeTypeDrawTextShape, // "com.sun.star.drawing.TextShape"
+ XmlShapeTypeDrawOLE2Shape, // "com.sun.star.drawing.OLE2Shape"
+ XmlShapeTypeDrawChartShape, // embedded com.sun.star.chart
+ XmlShapeTypeDrawSheetShape, // embedded com.sun.star.sheet
+ XmlShapeTypeDrawPageShape, // "com.sun.star.drawing.PageShape"
+ XmlShapeTypeDrawFrameShape, // "com.sun.star.drawing.FrameShape"
+ XmlShapeTypeDrawCaptionShape, // "com.sun.star.drawing.CaptionShape"
+ XmlShapeTypeDrawAppletShape, // "com.sun.star.drawing.AppletShape"
+ XmlShapeTypeDrawPluginShape, // "com.sun.star.drawing.PlugginShape"
+
+ XmlShapeTypeDraw3DSceneObject, // "com.sun.star.drawing.Shape3DSceneObject"
+ XmlShapeTypeDraw3DCubeObject, // "com.sun.star.drawing.Shape3DCubeObject"
+ XmlShapeTypeDraw3DSphereObject, // "com.sun.star.drawing.Shape3DSphereObject"
+ XmlShapeTypeDraw3DLatheObject, // "com.sun.star.drawing.Shape3DLatheObject"
+ XmlShapeTypeDraw3DExtrudeObject, // "com.sun.star.drawing.Shape3DExtrudeObject"
+
+ XmlShapeTypePresTitleTextShape, // "com.sun.star.presentation.TitleTextShape"
+ XmlShapeTypePresOutlinerShape, // "com.sun.star.presentation.OutlinerShape"
+ XmlShapeTypePresSubtitleShape, // "com.sun.star.presentation.SubtitleShape"
+ XmlShapeTypePresGraphicObjectShape, // "com.sun.star.presentation.GraphicObjectShape"
+ XmlShapeTypePresPageShape, // "com.sun.star.presentation.PageShape"
+ XmlShapeTypePresOLE2Shape, // "com.sun.star.presentation.OLE2Shape"
+ XmlShapeTypePresChartShape, // "com.sun.star.presentation.ChartShape"
+ XmlShapeTypePresSheetShape, // "com.sun.star.presentation.CalcShape"
+ XmlShapeTypePresTableShape, // "com.sun.star.presentation.TableShape"
+ XmlShapeTypePresOrgChartShape, // "com.sun.star.presentation.OrgChartShape"
+ XmlShapeTypePresNotesShape, // "com.sun.star.presentation.NotesShape"
+ XmlShapeTypeHandoutShape, // "com.sun.star.presentation.HandoutShape"
+
+ XmlShapeTypePresHeaderShape, // "com.sun.star.presentation.HeaderShape"
+ XmlShapeTypePresFooterShape, // "com.sun.star.presentation.FooterShape"
+ XmlShapeTypePresSlideNumberShape, // "com.sun.star.presentation.SlideNumberShape"
+ XmlShapeTypePresDateTimeShape, // "com.sun.star.presentation.DateTimeShape"
+
+ XmlShapeTypeDrawCustomShape, // "com.sun.star.drawing.CustomShape"
+ XmlShapeTypeDrawMediaShape, // "com.sun.star.drawing.MediaShape"
+ XmlShapeTypePresMediaShape, // "com.sun.star.presentation.MediaShape"
+
+ XmlShapeTypeDrawTableShape, // "com.sun.star.drawing.TableShape"
+
+ XmlShapeTypeNotYetSet
+};
+
+/** caches style and type info after a collectShapeAutostyle for later use in exportShape */
+struct ImplXMLShapeExportInfo
+{
+ rtl::OUString msStyleName;
+ rtl::OUString msTextStyleName;
+ sal_Int32 mnFamily;
+ XmlShapeType meShapeType;
+
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xCustomShapeReplacement;
+
+ ImplXMLShapeExportInfo() : mnFamily( XML_STYLE_FAMILY_SD_GRAPHICS_ID ), meShapeType( XmlShapeTypeNotYetSet ) {}
+};
+
+/** a vector for shape style and type cache information */
+typedef std::vector< ImplXMLShapeExportInfo > ImplXMLShapeExportInfoVector;
+
+/** a map to store all cache data for already collected XShapes */
+typedef std::map< com::sun::star::uno::Reference < com::sun::star::drawing::XShapes >, ImplXMLShapeExportInfoVector > ShapesInfos;
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class SvXMLExport;
+class SvXMLExportPropertyMapper;
+
+namespace basegfx
+{
+ class B2DTuple;
+ class B2DHomMatrix;
+} // end of namespace basegfx
+
+class XMLOFF_DLLPUBLIC XMLShapeExport : public UniRefBase
+{
+private:
+
+ SvXMLExport& mrExport;
+ UniReference< XMLPropertyHandlerFactory > mxSdPropHdlFactory;
+ UniReference< SvXMLExportPropertyMapper > mxPropertySetMapper;
+ UniReference< XMLAnimationsExporter > mxAnimationsExporter;
+ sal_Int32 mnNextUniqueShapeId;
+ ShapesInfos maShapesInfos;
+ ShapesInfos::iterator maCurrentShapesIter;
+ sal_Bool mbExportLayer;
+ ImplXMLShapeExportInfoVector maShapeInfos;
+ ImplXMLShapeExportInfoVector::iterator maCurrentInfo;
+ rtl::OUString msPresentationStylePrefix;
+
+ // #88546# possibility to swich progress bar handling on/off
+ sal_Bool mbHandleProgressBar;
+
+ rtl::Reference< XMLTableExport > mxShapeTableExport;
+
+protected:
+ SvXMLExport& GetExport() { return mrExport; }
+ const SvXMLExport& GetExport() const { return mrExport; }
+private:
+
+ SAL_DLLPRIVATE UniReference< SvXMLExportPropertyMapper > GetPropertySetMapper() const { return mxPropertySetMapper; }
+
+ const rtl::OUString msZIndex;
+ const rtl::OUString msPrintable;
+ const rtl::OUString msVisible;
+
+ const rtl::OUString msEmptyPres;
+ const rtl::OUString msModel;
+ const rtl::OUString msStartShape;
+ const rtl::OUString msEndShape;
+ const rtl::OUString msOnClick;
+ const rtl::OUString msEventType;
+ const rtl::OUString msPresentation;
+ const rtl::OUString msMacroName;
+ const rtl::OUString msScript;
+ const rtl::OUString msLibrary;
+ const rtl::OUString msClickAction;
+ const rtl::OUString msBookmark;
+ const rtl::OUString msEffect;
+ const rtl::OUString msPlayFull;
+ const rtl::OUString msVerb;
+ const rtl::OUString msSoundURL;
+ const rtl::OUString msSpeed;
+ const rtl::OUString msStarBasic;
+
+ rtl::OUStringBuffer msBuffer;
+
+ SAL_DLLPRIVATE void ImpCalcShapeType(const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType& eShapeType);
+
+ SAL_DLLPRIVATE void ImpExportNewTrans(const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xPropSet, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint);
+ SAL_DLLPRIVATE void ImpExportNewTrans_GetB2DHomMatrix(::basegfx::B2DHomMatrix& rMatrix, const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xPropSet);
+ SAL_DLLPRIVATE void ImpExportNewTrans_DecomposeAndRefPoint(const ::basegfx::B2DHomMatrix& rMat, ::basegfx::B2DTuple& rTRScale, double& fTRShear, double& fTRRotate, ::basegfx::B2DTuple& rTRTranslate, com::sun::star::awt::Point* pRefPoint);
+ SAL_DLLPRIVATE void ImpExportNewTrans_FeaturesAndWrite(::basegfx::B2DTuple& rTRScale, double fTRShear, double fTRRotate, ::basegfx::B2DTuple& rTRTranslate, const sal_Int32 nFeatures);
+ SAL_DLLPRIVATE sal_Bool ImpExportPresentationAttributes( const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xPropSet, const rtl::OUString& rClass );
+ SAL_DLLPRIVATE void ImpExportText( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape );
+ SAL_DLLPRIVATE void ImpExportEvents( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape );
+ SAL_DLLPRIVATE void ImpExportDescription( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape ); // #i68101#
+ SAL_DLLPRIVATE void ImpExportGluePoints( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape );
+
+ // single shape exporters
+ SAL_DLLPRIVATE void ImpExportGroupShape( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL );
+ SAL_DLLPRIVATE void ImpExport3DSceneShape( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL );
+ SAL_DLLPRIVATE void ImpExportRectangleShape( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL );
+ SAL_DLLPRIVATE void ImpExportLineShape(const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL );
+ SAL_DLLPRIVATE void ImpExportEllipseShape(const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL );
+ SAL_DLLPRIVATE void ImpExportPolygonShape(const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL );
+ SAL_DLLPRIVATE void ImpExportTextBoxShape(const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL );
+ SAL_DLLPRIVATE void ImpExportGraphicObjectShape(const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL );
+ SAL_DLLPRIVATE void ImpExportChartShape(const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL, SvXMLAttributeList* pAttrList = NULL );
+ SAL_DLLPRIVATE void ImpExportControlShape(const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL );
+ SAL_DLLPRIVATE void ImpExportConnectorShape(const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL );
+ SAL_DLLPRIVATE void ImpExportMeasureShape(const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL );
+ SAL_DLLPRIVATE void ImpExportOLE2Shape(const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL, SvXMLAttributeList* pAttrList = NULL );
+ SAL_DLLPRIVATE void ImpExportPageShape(const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL );
+ SAL_DLLPRIVATE void ImpExportCaptionShape(const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL );
+ SAL_DLLPRIVATE void ImpExport3DShape(const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL );
+ SAL_DLLPRIVATE void ImpExportFrameShape( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL );
+ SAL_DLLPRIVATE void ImpExportPluginShape( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL );
+ SAL_DLLPRIVATE void ImpExportAppletShape( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL );
+ SAL_DLLPRIVATE void ImpExportCustomShape( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL );
+ SAL_DLLPRIVATE void ImpExportMediaShape( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL );
+ SAL_DLLPRIVATE void ImpExportTableShape(const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL );
+public:
+ XMLShapeExport(SvXMLExport& rExp, SvXMLExportPropertyMapper *pExtMapper=0 );
+ virtual ~XMLShapeExport();
+
+ // This method collects all automatic styles for the given XShape
+ void collectShapeAutoStyles(
+ const com::sun::star::uno::Reference < com::sun::star::drawing::XShape >& xShape);
+
+ // This method exports the given XShape
+ void exportShape(
+ const com::sun::star::uno::Reference < com::sun::star::drawing::XShape >& xShape,
+ sal_Int32 nFeatures = SEF_DEFAULT,
+ com::sun::star::awt::Point* pRefPoint = NULL,
+ SvXMLAttributeList* pAttrList = NULL
+ );
+
+ // This method collects all automatic styles for the shapes inside the given XShapes collection
+ void collectShapesAutoStyles(
+ const com::sun::star::uno::Reference < com::sun::star::drawing::XShapes >& xShapes);
+
+ // This method exports all XShape inside the given XShapes collection
+ void exportShapes(
+ const com::sun::star::uno::Reference < com::sun::star::drawing::XShapes >& xShapes,
+ sal_Int32 nFeatures = SEF_DEFAULT,
+ com::sun::star::awt::Point* pRefPoint = NULL
+ );
+
+ /** initializes some internal structures for fast access to the given XShapes collection
+
+ <p>This method has to be called before you use exportShape or collectShapeAutoStyles.
+ It is automaticly called if you use collectShapesAutoStyles and exportShapes.
+
+ @see collectShapeAutoStyles
+ @see exportShape
+ @see collectShapesAutoStyles
+ @see exportShapes
+ */
+ void seekShapes(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xShapes ) throw();
+
+ void exportAutoStyles();
+
+ /** sets a new reference to an XMLAnimationExporter.
+ If this is a non NULL reference, the animation information from all shapes given to exportShape()
+ from now on are collected.
+ */
+ void setAnimationsExporter( UniReference< XMLAnimationsExporter > xAnimExport ) { mxAnimationsExporter = xAnimExport; }
+
+ /** returns the last set XMLAnimationExport */
+ UniReference< XMLAnimationsExporter > getAnimationsExporter() const { return mxAnimationsExporter; }
+
+ /// returns the export property mapper for external chaining
+ static SvXMLExportPropertyMapper* CreateShapePropMapper( SvXMLExport& rExport );
+
+ void enableLayerExport( sal_Bool bEnable = sal_True ) { mbExportLayer = bEnable; }
+ sal_Bool IsLayerExportEnabled() const { return mbExportLayer; }
+
+ // #88546#
+ /** defines if the export should increment the progress bar or not */
+ void enableHandleProgressBar( sal_Bool bEnable = sal_True ) { mbHandleProgressBar = bEnable; }
+ sal_Bool IsHandleProgressBarEnabled() const { return mbHandleProgressBar; }
+
+ void setPresentationStylePrefix( const rtl::OUString& rPrefix ) { msPresentationStylePrefix = rPrefix; }
+
+ /** helper for chart that adds all attributes of a 3d scene element to the export */
+ void export3DSceneAttributes( const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xPropSet );
+
+ /** helper for chart that exports all lamps from the propertyset */
+ void export3DLamps( const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xPropSet );
+
+ /** sj: replacing CustomShapes with standard objects that are also supported in OpenOffice.org format */
+ com::sun::star::uno::Reference < com::sun::star::drawing::XShape > checkForCustomShapeReplacement(
+ const com::sun::star::uno::Reference < com::sun::star::drawing::XShape >& );
+
+ /** helper to export the style for graphic defaults */
+ void ExportGraphicDefaults();
+
+ /** is called before a shape element for the given XShape is exported */
+ virtual void onExport( const com::sun::star::uno::Reference < com::sun::star::drawing::XShape >& xShape );
+
+ const rtl::Reference< XMLTableExport >& GetShapeTableExport();
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/shapeimport.hxx b/xmloff/inc/xmloff/shapeimport.hxx
new file mode 100644
index 000000000000..80e4f861cfbe
--- /dev/null
+++ b/xmloff/inc/xmloff/shapeimport.hxx
@@ -0,0 +1,443 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_SHAPEIMPORT_HXX_
+#define _XMLOFF_SHAPEIMPORT_HXX_
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/drawing/HomogenMatrix.hpp>
+#include <com/sun/star/drawing/ProjectionMode.hpp>
+#include <com/sun/star/drawing/ShadeMode.hpp>
+#include <tools/color.hxx>
+#include <xmloff/uniref.hxx>
+#include <xmloff/xmlictxt.hxx>
+
+#include "xmloff/table/XMLTableImport.hxx"
+#include <basegfx/vector/b3dvector.hxx>
+#include <vector>
+
+class SvXMLImport;
+class SvXMLImportContext;
+class SvXMLTokenMap;
+class SvXMLStylesContext;
+class XMLSdPropHdlFactory;
+class XMLPropertySetMapper;
+class SvXMLImportPropertyMapper;
+
+//////////////////////////////////////////////////////////////////////////////
+
+enum SdXMLGroupShapeElemTokenMap
+{
+ XML_TOK_GROUP_GROUP,
+ XML_TOK_GROUP_RECT,
+ XML_TOK_GROUP_LINE,
+ XML_TOK_GROUP_CIRCLE,
+ XML_TOK_GROUP_ELLIPSE,
+ XML_TOK_GROUP_POLYGON,
+ XML_TOK_GROUP_POLYLINE,
+ XML_TOK_GROUP_PATH,
+
+ XML_TOK_GROUP_CONTROL,
+ XML_TOK_GROUP_CONNECTOR,
+ XML_TOK_GROUP_MEASURE,
+ XML_TOK_GROUP_PAGE,
+ XML_TOK_GROUP_CAPTION,
+
+ XML_TOK_GROUP_CHART,
+ XML_TOK_GROUP_3DSCENE,
+
+ XML_TOK_GROUP_FRAME,
+
+ XML_TOK_GROUP_CUSTOM_SHAPE,
+
+ XML_TOK_GROUP_ANNOTATION,
+
+ XML_TOK_GROUP_A,
+
+ XML_TOK_GROUP_LAST
+};
+
+enum SdXMLFrameShapeElemTokenMap
+{
+ XML_TOK_FRAME_TEXT_BOX,
+ XML_TOK_FRAME_IMAGE,
+ XML_TOK_FRAME_OBJECT,
+ XML_TOK_FRAME_OBJECT_OLE,
+ XML_TOK_FRAME_PLUGIN,
+ XML_TOK_FRAME_FRAME,
+ XML_TOK_FRAME_FLOATING_FRAME,
+ XML_TOK_FRAME_APPLET,
+ XML_TOK_FRAME_TABLE,
+
+ XML_TOK_FRAME_LAST
+};
+
+enum SdXML3DSceneShapeElemTokenMap
+{
+ XML_TOK_3DSCENE_3DSCENE,
+ XML_TOK_3DSCENE_3DCUBE,
+ XML_TOK_3DSCENE_3DSPHERE,
+ XML_TOK_3DSCENE_3DLATHE,
+ XML_TOK_3DSCENE_3DEXTRUDE,
+
+ XML_TOK_3DSCENE_LAST
+};
+
+enum SdXMLShapeAttrTokenMap
+{
+ XML_TOK_SHAPE_NAME,
+ XML_TOK_SHAPE_DRAWSTYLE_NAME_GRAPHICS,
+ XML_TOK_SHAPE_PRESENTATION_CLASS,
+ XML_TOK_SHAPE_DRAWSTYLE_NAME_PRESENTATION,
+ XML_TOK_SHAPE_TRANSFORM,
+ XML_TOK_SHAPE_IS_PLACEHOLDER,
+ XML_TOK_SHAPE_IS_USER_TRANSFORMED
+};
+
+enum SdXML3DObjectAttrTokenMap
+{
+ XML_TOK_3DOBJECT_DRAWSTYLE_NAME,
+ XML_TOK_3DOBJECT_TRANSFORM
+};
+
+enum SdXML3DPolygonBasedAttrTokenMap
+{
+ XML_TOK_3DPOLYGONBASED_VIEWBOX,
+ XML_TOK_3DPOLYGONBASED_D
+};
+
+enum SdXML3DCubeObjectAttrTokenMap
+{
+ XML_TOK_3DCUBEOBJ_MINEDGE,
+ XML_TOK_3DCUBEOBJ_MAXEDGE
+};
+
+enum SdXML3DSphereObjectAttrTokenMap
+{
+ XML_TOK_3DSPHEREOBJ_CENTER,
+ XML_TOK_3DSPHEREOBJ_SIZE
+};
+
+enum SdXMLPolygonShapeAttrTokenMap
+{
+ XML_TOK_POLYGONSHAPE_VIEWBOX,
+ XML_TOK_POLYGONSHAPE_POINTS
+};
+
+enum SdXMLPathShapeAttrTokenMap
+{
+ XML_TOK_PATHSHAPE_VIEWBOX,
+ XML_TOK_PATHSHAPE_D
+};
+
+enum SdXML3DSceneShapeAttrTokenMap
+{
+ XML_TOK_3DSCENESHAPE_TRANSFORM,
+ XML_TOK_3DSCENESHAPE_VRP,
+ XML_TOK_3DSCENESHAPE_VPN,
+ XML_TOK_3DSCENESHAPE_VUP,
+ XML_TOK_3DSCENESHAPE_PROJECTION,
+ XML_TOK_3DSCENESHAPE_DISTANCE,
+ XML_TOK_3DSCENESHAPE_FOCAL_LENGTH,
+ XML_TOK_3DSCENESHAPE_SHADOW_SLANT,
+ XML_TOK_3DSCENESHAPE_SHADE_MODE,
+ XML_TOK_3DSCENESHAPE_AMBIENT_COLOR,
+ XML_TOK_3DSCENESHAPE_LIGHTING_MODE
+};
+
+enum SdXML3DLightAttrTokenMap
+{
+ XML_TOK_3DLIGHT_DIFFUSE_COLOR,
+ XML_TOK_3DLIGHT_DIRECTION,
+ XML_TOK_3DLIGHT_ENABLED,
+ XML_TOK_3DLIGHT_SPECULAR
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// dr3d:3dlight context
+
+class SdXML3DLightContext: public SvXMLImportContext
+{
+ // local parameters which need to be read
+ Color maDiffuseColor;
+ ::basegfx::B3DVector maDirection;
+ bool mbEnabled;
+ bool mbSpecular;
+
+public:
+ SdXML3DLightContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
+ virtual ~SdXML3DLightContext();
+
+ const Color& GetDiffuseColor() { return maDiffuseColor; }
+ const ::basegfx::B3DVector& GetDirection() { return maDirection; }
+ sal_Bool GetEnabled() { return mbEnabled; }
+ sal_Bool GetSpecular() { return mbSpecular; }
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+typedef ::std::vector< SdXML3DLightContext* > Imp3DLightList;
+
+class SdXML3DSceneAttributesHelper
+{
+protected:
+ SvXMLImport& mrImport;
+
+ // list for local light contexts
+ Imp3DLightList maList;
+
+ // local parameters which need to be read
+ com::sun::star::drawing::HomogenMatrix mxHomMat;
+ sal_Bool mbSetTransform;
+
+ com::sun::star::drawing::ProjectionMode mxPrjMode;
+ sal_Int32 mnDistance;
+ sal_Int32 mnFocalLength;
+ sal_Int32 mnShadowSlant;
+ com::sun::star::drawing::ShadeMode mxShadeMode;
+ Color maAmbientColor;
+ bool mbLightingMode;
+
+ ::basegfx::B3DVector maVRP;
+ ::basegfx::B3DVector maVPN;
+ ::basegfx::B3DVector maVUP;
+ sal_Bool mbVRPUsed;
+ sal_Bool mbVPNUsed;
+ sal_Bool mbVUPUsed;
+
+public:
+ SdXML3DSceneAttributesHelper( SvXMLImport& rImporter );
+ ~SdXML3DSceneAttributesHelper();
+
+ /** creates a 3d ligth context and adds it to the internal list for later processing */
+ SvXMLImportContext * create3DLightContext( sal_uInt16 nPrfx, const rtl::OUString& rLName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
+
+ /** this should be called for each scene attribute */
+ void processSceneAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+
+ /** this sets the scene attributes at this propertyset */
+ void setSceneAttributes( const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xPropSet );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+class SvXMLShapeContext : public SvXMLImportContext
+{
+protected:
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShape > mxShape;
+ sal_Bool mbTemporaryShape;
+ rtl::OUString msHyperlink;
+
+public:
+ SvXMLShapeContext( SvXMLImport& rImp, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName, sal_Bool bTemporaryShape ) : SvXMLImportContext( rImp, nPrfx, rLName ), mbTemporaryShape(bTemporaryShape) {}
+
+ TYPEINFO();
+
+ const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& getShape() const { return mxShape; }
+
+ void setHyperlink( const ::rtl::OUString& rHyperlink );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+class ShapeSortContext;
+struct XMLShapeImportHelperImpl;
+struct XMLShapeImportPageContextImpl;
+
+class XMLOFF_DLLPUBLIC XMLShapeImportHelper : public UniRefBase
+{
+ XMLShapeImportHelperImpl* mpImpl;
+
+ XMLShapeImportPageContextImpl* mpPageContext;
+
+ com::sun::star::uno::Reference< com::sun::star::frame::XModel > mxModel;
+
+ // PropertySetMappers and factory
+ XMLSdPropHdlFactory* mpSdPropHdlFactory;
+ SvXMLImportPropertyMapper* mpPropertySetMapper;
+ SvXMLImportPropertyMapper* mpPresPagePropsMapper;
+
+ // contexts for Style and AutoStyle import
+ SvXMLStylesContext* mpStylesContext;
+ SvXMLStylesContext* mpAutoStylesContext;
+
+ // contexts for xShape contents TokenMaps
+ SvXMLTokenMap* mpGroupShapeElemTokenMap;
+ SvXMLTokenMap* mpFrameShapeElemTokenMap;
+ SvXMLTokenMap* mp3DSceneShapeElemTokenMap;
+ SvXMLTokenMap* mp3DObjectAttrTokenMap;
+ SvXMLTokenMap* mp3DPolygonBasedAttrTokenMap;
+ SvXMLTokenMap* mp3DCubeObjectAttrTokenMap;
+ SvXMLTokenMap* mp3DSphereObjectAttrTokenMap;
+ SvXMLTokenMap* mp3DSceneShapeAttrTokenMap;
+ SvXMLTokenMap* mp3DLightAttrTokenMap;
+ SvXMLTokenMap* mpPathShapeAttrTokenMap;
+ SvXMLTokenMap* mpPolygonShapeAttrTokenMap;
+
+ const ::rtl::OUString msStartShape;
+ const ::rtl::OUString msEndShape;
+ const ::rtl::OUString msStartGluePointIndex;
+ const ::rtl::OUString msEndGluePointIndex;
+
+ rtl::Reference< XMLTableImport > mxShapeTableImport;
+
+protected:
+ SvXMLImport& mrImporter;
+
+public:
+ XMLShapeImportHelper( SvXMLImport& rImporter,
+ const com::sun::star::uno::Reference< com::sun::star::frame::XModel>& rModel,
+ SvXMLImportPropertyMapper *pExtMapper=0 );
+
+ ~XMLShapeImportHelper();
+
+ SvXMLShapeContext* CreateGroupChildContext(
+ SvXMLImport& rImport, sal_uInt16 nPrefix, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape = sal_False);
+
+ SvXMLShapeContext* CreateFrameChildContext(
+ SvXMLImport& rImport, sal_uInt16 nPrefix, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xFrameAttrList);
+ SvXMLImportContext* CreateFrameChildContext(
+ SvXMLImportContext *pThisContext, sal_uInt16 nPrefix, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ SvXMLShapeContext* Create3DSceneChildContext(
+ SvXMLImport& rImport, sal_uInt16 nPrefix, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes);
+
+ const SvXMLTokenMap& GetGroupShapeElemTokenMap();
+ const SvXMLTokenMap& GetFrameShapeElemTokenMap();
+ const SvXMLTokenMap& Get3DSceneShapeElemTokenMap();
+ const SvXMLTokenMap& Get3DObjectAttrTokenMap();
+ const SvXMLTokenMap& Get3DPolygonBasedAttrTokenMap();
+ const SvXMLTokenMap& Get3DCubeObjectAttrTokenMap();
+ const SvXMLTokenMap& Get3DSphereObjectAttrTokenMap();
+ const SvXMLTokenMap& Get3DSceneShapeAttrTokenMap();
+ const SvXMLTokenMap& Get3DLightAttrTokenMap();
+ const SvXMLTokenMap& GetPathShapeAttrTokenMap();
+ const SvXMLTokenMap& GetPolygonShapeAttrTokenMap();
+
+ // Styles and AutoStyles contexts
+ SvXMLStylesContext* GetStylesContext() const { return mpStylesContext; }
+ void SetStylesContext(SvXMLStylesContext* pNew);
+ SvXMLStylesContext* GetAutoStylesContext() const { return mpAutoStylesContext; }
+ void SetAutoStylesContext(SvXMLStylesContext* pNew);
+
+ // get factories and mappers
+ SvXMLImportPropertyMapper* GetPropertySetMapper() const { return mpPropertySetMapper; }
+ SvXMLImportPropertyMapper* GetPresPagePropsMapper() const { return mpPresPagePropsMapper; }
+
+ // this function is called whenever the implementation classes like to add this new
+ // shape to the given XShapes.
+ virtual void addShape(
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rShape,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes);
+
+ // this function is called whenever the implementation classes have finished importing
+ // a shape to the given XShapes. The shape is already inserted into its XShapes and
+ // all properties and styles are set.
+ virtual void finishShape(
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rShape,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes);
+
+ // helper functions for z-order sorting
+ void pushGroupForSorting( com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes );
+ void popGroupAndSort();
+
+ void shapeWithZIndexAdded( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rShape,
+ sal_Int32 nZIndex );
+
+ void addShapeConnection( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rConnectorShape,
+ sal_Bool bStart,
+ const rtl::OUString& rDestShapeId,
+ sal_Int32 nDestGlueId );
+
+ /** adds a mapping for a glue point identifier from an xml file to the identifier created after inserting
+ the new glue point into the core. The saved mappings can be retrieved by getGluePointId() */
+ void addGluePointMapping( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape,
+ sal_Int32 nSourceId, sal_Int32 nDestinnationId );
+
+ /** moves all current DestinationId's for rXShape by n */
+ void moveGluePointMapping( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, const sal_Int32 n );
+
+ /** retrieves a mapping for a glue point identifier from the current xml file to the identifier created after
+ inserting the new glue point into the core. The mapping must be initialized first with addGluePointMapping() */
+ sal_Int32 getGluePointId( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, sal_Int32 nSourceId );
+
+ /** this method must be calling before the first shape is imported for the given page.
+ Calls to this method can be nested */
+ void startPage( com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes );
+
+ /** this method must be calling after the last shape is imported for the given page
+ Calls to this method can be nested */
+ void endPage( com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes );
+
+ void restoreConnections();
+
+ /** creates a property mapper for external chaining */
+ static SvXMLImportPropertyMapper* CreateShapePropMapper(
+ const com::sun::star::uno::Reference< com::sun::star::frame::XModel>& rModel, SvXMLImport& rImport );
+
+ /** creates a shape property set mapper that can be used for non shape elements */
+ static SvXMLImportPropertyMapper* CreateExternalShapePropMapper(
+ const com::sun::star::uno::Reference< com::sun::star::frame::XModel>& rModel, SvXMLImport& rImport );
+
+ // #88546#
+ /** defines if the import should increment the progress bar or not */
+ void enableHandleProgressBar( sal_Bool bEnable = sal_True );
+ sal_Bool IsHandleProgressBarEnabled() const;
+
+ /** queries the capability of the current model to create presentation shapes */
+ sal_Bool IsPresentationShapesSupported();
+
+ XMLSdPropHdlFactory* GetSdPropHdlFactory() const { return mpSdPropHdlFactory; }
+
+ const rtl::Reference< XMLTableImport >& GetShapeTableImport();
+};
+
+#endif // _XMLOFF_SHAPEIMPORT_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/styleexp.hxx b/xmloff/inc/xmloff/styleexp.hxx
new file mode 100644
index 000000000000..3931c76146ef
--- /dev/null
+++ b/xmloff/inc/xmloff/styleexp.hxx
@@ -0,0 +1,136 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_STYLEEXP_HXX_
+#define _XMLOFF_STYLEEXP_HXX_
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Reference.h>
+
+#include <xmloff/uniref.hxx>
+
+namespace com { namespace sun { namespace star
+{
+ namespace style
+ {
+ class XStyle;
+ }
+ namespace beans
+ {
+ class XPropertySet;
+ }
+ namespace container
+ {
+ class XNameAccess;
+ }
+
+} } }
+
+class XMLPropertySetMapper;
+class SvXMLExportPropertyMapper;
+class SvXMLAutoStylePoolP;
+class SvXMLExport;
+
+class XMLOFF_DLLPUBLIC XMLStyleExport : public UniRefBase
+{
+ SvXMLExport& rExport;
+protected:
+ const ::rtl::OUString sIsPhysical;
+ const ::rtl::OUString sIsAutoUpdate;
+ const ::rtl::OUString sFollowStyle;
+ const ::rtl::OUString sNumberingStyleName;
+ const ::rtl::OUString sOutlineLevel;
+
+ SvXMLExport& GetExport() { return rExport; }
+ const SvXMLExport& GetExport() const { return rExport; }
+
+private:
+
+ const ::rtl::OUString sPoolStyleName;
+
+ SvXMLAutoStylePoolP *pAutoStylePool;
+
+protected:
+
+ virtual sal_Bool exportStyle(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::style::XStyle > & rStyle,
+ const ::rtl::OUString& rXMLFamily,
+ const UniReference < SvXMLExportPropertyMapper >& rPropMapper,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > & xStyles,
+ const ::rtl::OUString* pPrefix = 0L );
+
+ virtual void exportStyleAttributes(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::style::XStyle > & rStyle );
+
+ virtual void exportStyleContent(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::style::XStyle > & rStyle );
+public:
+ XMLStyleExport(
+ SvXMLExport& rExp,
+ const ::rtl::OUString& rPoolStyleName,
+ SvXMLAutoStylePoolP *pAutoStyleP=0 );
+ virtual ~XMLStyleExport();
+
+// void exportStyleFamily(
+// const ::rtl::OUString& rFamily, const ::rtl::OUString& rXMLFamily,
+// const UniReference < XMLPropertySetMapper >& rPropMapper,
+// sal_Bool bUsed, sal_uInt16 nFamily = 0,
+// const ::rtl::OUString* pPrefix = 0L);
+
+// void exportStyleFamily(
+// const sal_Char *pFamily, const ::rtl::OUString& rXMLFamily,
+// const UniReference < XMLPropertySetMapper >& rPropMapper,
+// sal_Bool bUsed, sal_uInt16 nFamily = 0,
+// const ::rtl::OUString* pPrefix = 0L);
+
+ virtual sal_Bool exportDefaultStyle(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & xPropSet,
+ const ::rtl::OUString& rXMLFamily,
+ const UniReference < SvXMLExportPropertyMapper >& rPropMapper );
+
+ void exportStyleFamily(
+ const ::rtl::OUString& rFamily, const ::rtl::OUString& rXMLFamily,
+ const UniReference < SvXMLExportPropertyMapper >& rPropMapper,
+ sal_Bool bUsed, sal_uInt16 nFamily = 0,
+ const ::rtl::OUString* pPrefix = 0L);
+
+ void exportStyleFamily(
+ const sal_Char *pFamily, const ::rtl::OUString& rXMLFamily,
+ const UniReference < SvXMLExportPropertyMapper >& rPropMapper,
+ sal_Bool bUsed, sal_uInt16 nFamily = 0,
+ const ::rtl::OUString* pPrefix = 0L);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/table/XMLTableExport.hxx b/xmloff/inc/xmloff/table/XMLTableExport.hxx
new file mode 100644
index 000000000000..8b51d1e30c70
--- /dev/null
+++ b/xmloff/inc/xmloff/table/XMLTableExport.hxx
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLTABLEEXPORT_HXX
+#define _XMLOFF_XMLTABLEEXPORT_HXX
+
+#include "sal/config.h"
+
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+
+#include <boost/shared_ptr.hpp>
+#include <map>
+#include <vector>
+
+#include <com/sun/star/table/XTableColumns.hpp>
+#include <com/sun/star/table/XColumnRowRange.hpp>
+#include <com/sun/star/table/XCell.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+
+#include <rtl/ref.hxx>
+
+#include "xmloff/dllapi.h"
+#include "xmloff/uniref.hxx"
+#include "xmloff/xmlprmap.hxx"
+#include "xmloff/xmlexppr.hxx"
+
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class SvXMLExport;
+class SvXMLExportPropertyMapper;
+
+typedef ::std::map< const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >, rtl::OUString > TableStyleMap;
+
+struct XMLTableInfo
+{
+ TableStyleMap maColumnStyleMap;
+ TableStyleMap maRowStyleMap;
+ TableStyleMap maCellStyleMap;
+ std::vector< ::rtl::OUString > maDefaultRowCellStyles;
+};
+
+typedef ::std::map< const ::com::sun::star::uno::Reference< com::sun::star::table::XColumnRowRange >, boost::shared_ptr< XMLTableInfo > > TableInfoMap;
+
+class XMLOFF_DLLPUBLIC XMLTableExport : public UniRefBase
+{
+public:
+ XMLTableExport(SvXMLExport& rExp, const rtl::Reference< SvXMLExportPropertyMapper >& xCellExportPropertySetMapper, const rtl::Reference< XMLPropertyHandlerFactory >& xFactoryRef );
+ virtual ~XMLTableExport();
+
+ // This method collects all automatic styles for the given table
+ void collectTableAutoStyles(const com::sun::star::uno::Reference < com::sun::star::table::XColumnRowRange >& xColumnRowRange);
+
+ // This method exports the given table
+ void exportTable(const com::sun::star::uno::Reference < com::sun::star::table::XColumnRowRange >& xColumnRowRange);
+
+ // export the styles from the cell style family
+ void exportTableStyles();
+
+ // Export the collected automatic styles
+ void exportAutoStyles();
+
+private:
+ void exportTableTemplates();
+
+ SvXMLExport& mrExport;
+ rtl::Reference< SvXMLExportPropertyMapper > mxCellExportPropertySetMapper;
+ rtl::Reference< SvXMLExportPropertyMapper > mxRowExportPropertySetMapper;
+ rtl::Reference< SvXMLExportPropertyMapper > mxColumnExportPropertySetMapper;
+ TableInfoMap maTableInfoMap;
+ bool mbExportTables;
+
+protected:
+ SvXMLExport& GetExport() { return mrExport; }
+ const SvXMLExport& GetExport() const { return mrExport; }
+private:
+
+ SAL_DLLPRIVATE void ImpExportText( const com::sun::star::uno::Reference < com::sun::star::table::XCell >& xCell );
+
+ void ExportCell( const com::sun::star::uno::Reference < com::sun::star::table::XCell >& xCell, const boost::shared_ptr< XMLTableInfo >& pTableInfo, const ::rtl::OUString& sDefaultCellStyle );
+ void ExportTableColumns( const com::sun::star::uno::Reference < com::sun::star::container::XIndexAccess >& xtableColumns, const boost::shared_ptr< XMLTableInfo >& pTableInfo );
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/table/XMLTableImport.hxx b/xmloff/inc/xmloff/table/XMLTableImport.hxx
new file mode 100644
index 000000000000..3479129e66cb
--- /dev/null
+++ b/xmloff/inc/xmloff/table/XMLTableImport.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 XMLTABLEIMPORT_HXX_
+#define XMLTABLEIMPORT_HXX_
+
+#include <com/sun/star/table/XColumnRowRange.hpp>
+
+#include "xmloff/dllapi.h"
+#include "xmloff/xmlictxt.hxx"
+#include "xmloff/uniref.hxx"
+#include "xmloff/xmlimppr.hxx"
+#include "xmloff/prhdlfac.hxx"
+
+#include <rtl/ref.hxx>
+
+#include <boost/shared_ptr.hpp>
+#include <map>
+
+class SvXMLStyleContext;
+
+typedef std::map< ::rtl::OUString, ::rtl::OUString > XMLTableTemplate;
+typedef std::map < ::rtl::OUString, boost::shared_ptr< XMLTableTemplate > > XMLTableTemplateMap;
+
+class XMLTableImport : public UniRefBase
+{
+ friend class XMLTableImportContext;
+
+public:
+ XMLTableImport( SvXMLImport& rImport, const rtl::Reference< XMLPropertySetMapper >& xCellPropertySetMapper, const rtl::Reference< XMLPropertyHandlerFactory >& xFactoryRef );
+ virtual ~XMLTableImport();
+
+ SvXMLImportContext* CreateTableContext( sal_uInt16 nPrfx, const ::rtl::OUString& rLName,
+ ::com::sun::star::uno::Reference< ::com::sun::star::table::XColumnRowRange >& xColumnRowRange );
+
+ SvXMLStyleContext* CreateTableTemplateContext( sal_uInt16 nPrfx, const ::rtl::OUString& rLName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ rtl::Reference< SvXMLImportPropertyMapper > GetCellImportPropertySetMapper() const { return mxCellImportPropertySetMapper; }
+ rtl::Reference< SvXMLImportPropertyMapper > GetRowImportPropertySetMapper() const { return mxRowImportPropertySetMapper; }
+ rtl::Reference< SvXMLImportPropertyMapper > GetColumnImportPropertySetMapper() const { return mxColumnImportPropertySetMapper; }
+
+ void addTableTemplate( const rtl::OUString& rsStyleName, XMLTableTemplate& xTableTemplate );
+ void finishStyles();
+
+private:
+ SvXMLImport& mrImport;
+ rtl::Reference< SvXMLImportPropertyMapper > mxCellImportPropertySetMapper;
+ rtl::Reference< SvXMLImportPropertyMapper > mxRowImportPropertySetMapper;
+ rtl::Reference< SvXMLImportPropertyMapper > mxColumnImportPropertySetMapper;
+
+ XMLTableTemplateMap maTableTemplates;
+};
+
+#endif /*XMLTABLEIMPORT_HXX_*/
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/txtimp.hxx b/xmloff/inc/xmloff/txtimp.hxx
new file mode 100644
index 000000000000..e625cb66b0d4
--- /dev/null
+++ b/xmloff/inc/xmloff/txtimp.hxx
@@ -0,0 +1,743 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 XMLOFF_TEXTIMP_HXX
+#define XMLOFF_TEXTIMP_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include "sal/types.h"
+#include <com/sun/star/uno/Reference.h>
+
+#include <map>
+#include <memory>
+#include <boost/utility.hpp>
+#include <boost/shared_ptr.hpp>
+
+#include <xmloff/xmltkmap.hxx>
+
+// xmloff/functional.hxx is obsolete and should be replaced by its comphelper
+// counterpart
+#include <comphelper/stl_types.hxx>
+#include <xmloff/uniref.hxx>
+
+class XMLTextListsHelper;
+class SvXMLImportContext;
+class SvXMLTokenMap;
+class SvXMLImportPropertyMapper;
+class SvXMLNamespaceMap;
+class SvXMLImport;
+class SvXMLStylesContext;
+class XMLTextListBlockContext;
+class SvxXMLListStyleContext;
+class XMLPropStyleContext;
+class SvI18NMap;
+class XMLSectionImportContext;
+class XMLFontStylesContext;
+template<class A> class XMLPropertyBackpatcher;
+class XMLEventsImportContext;
+
+namespace xmloff {
+ struct ParsedRDFaAttributes;
+}
+
+namespace com { namespace sun { namespace star {
+namespace text {
+ class XText;
+ class XTextCursor;
+ class XTextRange;
+ class XTextContent;
+ class XFormField;
+}
+namespace frame { class XModel; }
+namespace container { class XNameContainer; class XIndexReplace; class XNameAccess; }
+namespace beans { class XPropertySet; }
+namespace xml { namespace sax { class XAttributeList; } }
+namespace util { struct DateTime; }
+namespace lang { class XMultiServiceFactory; }
+} } }
+
+enum SwXMLTextElemTokens
+{
+ XML_TOK_TEXT_P,
+ XML_TOK_TEXT_H,
+ XML_TOK_TEXT_LIST,
+ XML_TOK_TEXT_FRAME_PAGE,
+ XML_TOK_TABLE_TABLE,
+ XML_TOK_TEXT_VARFIELD_DECLS,
+ XML_TOK_TEXT_USERFIELD_DECLS,
+ XML_TOK_TEXT_SEQUENCE_DECLS,
+ XML_TOK_TEXT_DDE_DECLS,
+ XML_TOK_DRAW_A_PAGE,
+ XML_TOK_TEXT_SECTION,
+ XML_TOK_TEXT_TOC,
+ XML_TOK_TEXT_OBJECT_INDEX,
+ XML_TOK_TEXT_TABLE_INDEX,
+ XML_TOK_TEXT_ILLUSTRATION_INDEX,
+ XML_TOK_TEXT_USER_INDEX,
+ XML_TOK_TEXT_ALPHABETICAL_INDEX,
+ XML_TOK_TEXT_BIBLIOGRAPHY_INDEX,
+ XML_TOK_TEXT_INDEX_TITLE,
+ XML_TOK_TEXT_TRACKED_CHANGES,
+ XML_TOK_TEXT_CHANGE_START,
+ XML_TOK_TEXT_CHANGE_END,
+ XML_TOK_TEXT_CHANGE,
+ XML_TOK_TEXT_FORMS,
+ XML_TOK_TEXT_CALCULATION_SETTINGS,
+ XML_TOK_TEXT_AUTOMARK,
+ XML_TOK_TEXT_NUMBERED_PARAGRAPH,
+ XML_TOK_TEXT_ELEM_END=XML_TOK_UNKNOWN
+};
+
+enum XMLTextPElemTokens
+{
+ XML_TOK_TEXT_SPAN,
+ XML_TOK_TEXT_TAB_STOP,
+ XML_TOK_TEXT_LINE_BREAK,
+ XML_TOK_TEXT_SOFT_PAGE_BREAK,
+ XML_TOK_TEXT_S,
+ XML_TOK_TEXT_FRAME,
+ XML_TOK_TEXT_HYPERLINK,
+ XML_TOK_TEXT_RUBY,
+
+ XML_TOK_TEXT_NOTE,
+ XML_TOK_TEXT_BOOKMARK,
+ XML_TOK_TEXT_BOOKMARK_START,
+ XML_TOK_TEXT_BOOKMARK_END,
+ XML_TOK_TEXT_REFERENCE,
+ XML_TOK_TEXT_REFERENCE_START,
+ XML_TOK_TEXT_REFERENCE_END,
+
+ XML_TOK_TEXT_TOC_MARK, // index marks
+ XML_TOK_TEXT_TOC_MARK_START,
+ XML_TOK_TEXT_TOC_MARK_END,
+ XML_TOK_TEXT_USER_INDEX_MARK,
+ XML_TOK_TEXT_USER_INDEX_MARK_START,
+ XML_TOK_TEXT_USER_INDEX_MARK_END,
+ XML_TOK_TEXT_ALPHA_INDEX_MARK,
+ XML_TOK_TEXT_ALPHA_INDEX_MARK_START,
+ XML_TOK_TEXT_ALPHA_INDEX_MARK_END,
+
+ XML_TOK_TEXT_SENDER_FIRSTNAME, // sender fields
+ XML_TOK_TEXT_SENDER_LASTNAME,
+ XML_TOK_TEXT_SENDER_INITIALS,
+ XML_TOK_TEXT_SENDER_TITLE,
+ XML_TOK_TEXT_SENDER_POSITION,
+ XML_TOK_TEXT_SENDER_EMAIL,
+ XML_TOK_TEXT_SENDER_PHONE_PRIVATE,
+ XML_TOK_TEXT_SENDER_FAX,
+ XML_TOK_TEXT_SENDER_COMPANY,
+ XML_TOK_TEXT_SENDER_PHONE_WORK,
+ XML_TOK_TEXT_SENDER_STREET,
+ XML_TOK_TEXT_SENDER_CITY,
+ XML_TOK_TEXT_SENDER_POSTAL_CODE,
+ XML_TOK_TEXT_SENDER_COUNTRY,
+ XML_TOK_TEXT_SENDER_STATE_OR_PROVINCE,
+
+ XML_TOK_TEXT_AUTHOR_NAME, // author fields
+ XML_TOK_TEXT_AUTHOR_INITIALS,
+
+ XML_TOK_TEXT_DATE, // date & time fields
+ XML_TOK_TEXT_TIME,
+
+ XML_TOK_TEXT_PAGE_NUMBER, // page number fields
+ XML_TOK_TEXT_PAGE_CONTINUATION_STRING,
+
+ XML_TOK_TEXT_VARIABLE_SET, // variable fields
+ XML_TOK_TEXT_VARIABLE_GET,
+ XML_TOK_TEXT_VARIABLE_INPUT,
+ XML_TOK_TEXT_USER_FIELD_GET,
+ XML_TOK_TEXT_USER_FIELD_INPUT,
+ XML_TOK_TEXT_SEQUENCE,
+ XML_TOK_TEXT_EXPRESSION,
+ XML_TOK_TEXT_TEXT_INPUT,
+
+ XML_TOK_TEXT_DATABASE_DISPLAY, // database fields
+ XML_TOK_TEXT_DATABASE_NEXT,
+ XML_TOK_TEXT_DATABASE_SELECT,
+ XML_TOK_TEXT_DATABASE_ROW_NUMBER,
+ XML_TOK_TEXT_DATABASE_NAME,
+
+ XML_TOK_TEXT_DOCUMENT_CREATION_AUTHOR, //document info fields
+ XML_TOK_TEXT_DOCUMENT_CREATION_DATE,
+ XML_TOK_TEXT_DOCUMENT_CREATION_TIME,
+ XML_TOK_TEXT_DOCUMENT_DESCRIPTION,
+ XML_TOK_TEXT_DOCUMENT_PRINT_AUTHOR,
+ XML_TOK_TEXT_DOCUMENT_PRINT_DATE,
+ XML_TOK_TEXT_DOCUMENT_PRINT_TIME,
+ XML_TOK_TEXT_DOCUMENT_TITLE,
+ XML_TOK_TEXT_DOCUMENT_SUBJECT,
+ XML_TOK_TEXT_DOCUMENT_KEYWORDS,
+ XML_TOK_TEXT_DOCUMENT_REVISION,
+ XML_TOK_TEXT_DOCUMENT_EDIT_DURATION,
+ XML_TOK_TEXT_DOCUMENT_SAVE_AUTHOR,
+ XML_TOK_TEXT_DOCUMENT_SAVE_DATE,
+ XML_TOK_TEXT_DOCUMENT_SAVE_TIME,
+ XML_TOK_TEXT_DOCUMENT_USER_DEFINED,
+
+ XML_TOK_TEXT_PLACEHOLDER, // misc. fields
+ XML_TOK_TEXT_CONDITIONAL_TEXT,
+ XML_TOK_TEXT_HIDDEN_TEXT,
+ XML_TOK_TEXT_HIDDEN_PARAGRAPH,
+ XML_TOK_TEXT_FILENAME,
+ XML_TOK_TEXT_CHAPTER,
+ XML_TOK_TEXT_TEMPLATENAME,
+ XML_TOK_TEXT_WORD_COUNT, // statistics/count fields
+ XML_TOK_TEXT_PARAGRAPH_COUNT,
+ XML_TOK_TEXT_TABLE_COUNT,
+ XML_TOK_TEXT_CHARACTER_COUNT,
+ XML_TOK_TEXT_IMAGE_COUNT,
+ XML_TOK_TEXT_OBJECT_COUNT,
+ XML_TOK_TEXT_PAGE_COUNT,
+ XML_TOK_TEXT_GET_PAGE_VAR,
+ XML_TOK_TEXT_SET_PAGE_VAR,
+ XML_TOK_TEXT_MACRO,
+ XML_TOK_TEXT_DDE,
+ XML_TOK_TEXT_REFERENCE_REF,
+ XML_TOK_TEXT_BOOKMARK_REF,
+ XML_TOK_TEXT_SEQUENCE_REF,
+ XML_TOK_TEXT_NOTE_REF,
+ XML_TOK_TEXT_SHEET_NAME,
+ XML_TOK_TEXT_BIBLIOGRAPHY_MARK,
+ XML_TOK_TEXT_ANNOTATION,
+ XML_TOK_TEXT_SCRIPT,
+ XML_TOK_TEXT_TABLE_FORMULA,
+ XML_TOK_TEXT_DROPDOWN,
+
+ // RDF metadata
+ XML_TOK_TEXT_META,
+ XML_TOK_TEXT_META_FIELD,
+
+ // misc
+ XML_TOK_TEXTP_CHANGE_START, // TEXTP avoids clash with SwXMLTextElemTokens
+ XML_TOK_TEXTP_CHANGE_END,
+ XML_TOK_TEXTP_CHANGE,
+ XML_TOK_DRAW_A,
+ XML_TOK_TEXT_MEASURE,
+
+ XML_TOK_DRAW_HEADER,
+ XML_TOK_DRAW_FOOTER,
+ XML_TOK_DRAW_DATE_TIME,
+ XML_TOK_TEXT_PAGE_CONTINUATION,
+
+ XML_TOK_TEXT_FIELDMARK,
+ XML_TOK_TEXT_FIELDMARK_START,
+ XML_TOK_TEXT_FIELDMARK_END,
+
+ XML_TOK_TEXT_P_ELEM_END=XML_TOK_UNKNOWN
+};
+
+enum XMLTextPAttrTokens
+{
+ XML_TOK_TEXT_P_XMLID,
+ XML_TOK_TEXT_P_ABOUT,
+ XML_TOK_TEXT_P_PROPERTY,
+ XML_TOK_TEXT_P_CONTENT,
+ XML_TOK_TEXT_P_DATATYPE,
+ XML_TOK_TEXT_P_TEXTID,
+ XML_TOK_TEXT_P_STYLE_NAME,
+ XML_TOK_TEXT_P_COND_STYLE_NAME,
+ XML_TOK_TEXT_P_LEVEL,
+ XML_TOK_TEXT_P_CLASS_NAMES,
+ XML_TOK_TEXT_P_IS_LIST_HEADER,
+ XML_TOK_TEXT_P_RESTART_NUMBERING,
+ XML_TOK_TEXT_P_START_VALUE,
+ XML_TOK_TEXT_P_END=XML_TOK_UNKNOWN
+};
+
+enum XMLTextNumberedParagraphAttrTokens
+{
+ XML_TOK_TEXT_NUMBERED_PARAGRAPH_XMLID,
+ XML_TOK_TEXT_NUMBERED_PARAGRAPH_LIST_ID,
+ XML_TOK_TEXT_NUMBERED_PARAGRAPH_LEVEL,
+ XML_TOK_TEXT_NUMBERED_PARAGRAPH_STYLE_NAME,
+ XML_TOK_TEXT_NUMBERED_PARAGRAPH_CONTINUE_NUMBERING,
+ XML_TOK_TEXT_NUMBERED_PARAGRAPH_START_VALUE,
+ XML_TOK_TEXT_NUMBERED_PARAGRAPH_END=XML_TOK_UNKNOWN
+};
+
+enum XMLTextListBlockAttrTokens
+{
+ XML_TOK_TEXT_LIST_BLOCK_XMLID,
+ XML_TOK_TEXT_LIST_BLOCK_STYLE_NAME,
+ XML_TOK_TEXT_LIST_BLOCK_CONTINUE_NUMBERING,
+ XML_TOK_TEXT_LIST_BLOCK_ID,
+ XML_TOK_TEXT_LIST_BLOCK_CONTINUE_LIST,
+ XML_TOK_TEXT_LIST_BLOCK_END=XML_TOK_UNKNOWN
+};
+
+enum XMLTextListBlockElemTokens
+{
+ XML_TOK_TEXT_LIST_HEADER,
+ XML_TOK_TEXT_LIST_ITEM,
+ XML_TOK_TEXT_LIST_BLOCK_ELEM_END=XML_TOK_UNKNOWN
+};
+
+enum XMLTextFrameAttrTokens
+{
+ XML_TOK_TEXT_FRAME_STYLE_NAME,
+ XML_TOK_TEXT_FRAME_NAME,
+ XML_TOK_TEXT_FRAME_ANCHOR_TYPE,
+ XML_TOK_TEXT_FRAME_ANCHOR_PAGE_NUMBER,
+ XML_TOK_TEXT_FRAME_X,
+ XML_TOK_TEXT_FRAME_Y,
+ XML_TOK_TEXT_FRAME_WIDTH,
+ XML_TOK_TEXT_FRAME_REL_WIDTH,
+ XML_TOK_TEXT_FRAME_HEIGHT,
+ XML_TOK_TEXT_FRAME_MIN_HEIGHT,
+ XML_TOK_TEXT_FRAME_REL_HEIGHT,
+ XML_TOK_TEXT_FRAME_NEXT_CHAIN_NAME,
+ XML_TOK_TEXT_FRAME_HREF,
+ XML_TOK_TEXT_FRAME_FILTER_NAME,
+ XML_TOK_TEXT_FRAME_Z_INDEX,
+ XML_TOK_TEXT_FRAME_TRANSFORM,
+ XML_TOK_TEXT_FRAME_CLASS_ID,
+ XML_TOK_TEXT_FRAME_CODE,
+ XML_TOK_TEXT_FRAME_OBJECT,
+ XML_TOK_TEXT_FRAME_ARCHIVE,
+ XML_TOK_TEXT_FRAME_MAY_SCRIPT,
+ XML_TOK_TEXT_FRAME_MIME_TYPE,
+ XML_TOK_TEXT_FRAME_APPLET_NAME,
+ XML_TOK_TEXT_FRAME_FRAME_NAME,
+ XML_TOK_TEXT_FRAME_NOTIFY_ON_UPDATE,
+ XML_TOK_TEXT_FRAME_MIN_WIDTH,
+ XML_TOK_TEXT_FRAME_END=XML_TOK_UNKNOWN
+};
+
+enum XMLTextHyperlinkAttrTokens
+{
+ XML_TOK_TEXT_HYPERLINK_HREF,
+ XML_TOK_TEXT_HYPERLINK_NAME,
+ XML_TOK_TEXT_HYPERLINK_TARGET_FRAME,
+ XML_TOK_TEXT_HYPERLINK_SHOW,
+ XML_TOK_TEXT_HYPERLINK_STYLE_NAME,
+ XML_TOK_TEXT_HYPERLINK_VIS_STYLE_NAME,
+ XML_TOK_TEXT_HYPERLINK_SERVER_MAP,
+ XML_TOK_TEXT_HYPERLINK_END=XML_TOK_UNKNOWN
+};
+
+enum XMLTextPageMasterElemTokens
+{
+ XML_TOK_TEXT_MP_HEADER,
+ XML_TOK_TEXT_MP_FOOTER,
+ XML_TOK_TEXT_MP_HEADER_LEFT,
+ XML_TOK_TEXT_MP_FOOTER_LEFT,
+ XML_TOK_TEXT_MP_END=XML_TOK_UNKNOWN
+};
+
+enum XMLTextContourAttrTokens
+{
+ XML_TOK_TEXT_CONTOUR_WIDTH,
+ XML_TOK_TEXT_CONTOUR_HEIGHT,
+ XML_TOK_TEXT_CONTOUR_VIEWBOX,
+ XML_TOK_TEXT_CONTOUR_POINTS,
+ XML_TOK_TEXT_CONTOUR_D,
+ XML_TOK_TEXT_CONTOUR_AUTO,
+ XML_TOK_TEXT_CONTOUR_END=XML_TOK_UNKNOWN
+};
+enum XMLTextType
+{
+ XML_TEXT_TYPE_BODY,
+ XML_TEXT_TYPE_CELL,
+ XML_TEXT_TYPE_SHAPE,
+ XML_TEXT_TYPE_TEXTBOX,
+ XML_TEXT_TYPE_HEADER_FOOTER,
+ XML_TEXT_TYPE_SECTION,
+ XML_TEXT_TYPE_FOOTNOTE,
+ XML_TEXT_TYPE_CHANGED_REGION
+};
+
+#define XML_TEXT_RENAME_TYPE_FRAME 10
+#define XML_TEXT_RENAME_TYPE_TABLE 20
+
+class XMLOFF_DLLPUBLIC XMLTextImportHelper : public UniRefBase,
+ private boost::noncopyable
+{
+private:
+ struct Impl;
+ ::std::auto_ptr<Impl> m_pImpl;
+ /// ugly, but implementation of this is in XMLPropertyBackpatcher.cxx
+ struct BackpatcherImpl;
+ ::boost::shared_ptr<BackpatcherImpl> m_pBackpatcherImpl;
+ ::boost::shared_ptr<BackpatcherImpl> MakeBackpatcherImpl();
+
+protected:
+ virtual SvXMLImportContext *CreateTableChildContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+ // access, lazy initialization and destruction of backpatchers
+ // Code is implemented in XMLPropertyBackpatcher.cxx
+ inline XMLPropertyBackpatcher<sal_Int16>& GetFootnoteBP();
+ inline XMLPropertyBackpatcher<sal_Int16>& GetSequenceIdBP();
+ inline XMLPropertyBackpatcher< ::rtl::OUString> & GetSequenceNameBP();
+
+public:
+
+ XMLTextImportHelper(
+ ::com::sun::star::uno::Reference <
+ ::com::sun::star::frame::XModel> const& rModel,
+ SvXMLImport& rImport,
+ bool const bInsertMode = false, bool const bStylesOnlyMode = false,
+ bool const bProgress = false, bool const bBlockMode = false,
+ bool const bOrganizerMode = false);
+
+ ~XMLTextImportHelper();
+
+ void SetCursor(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextCursor >& rCursor );
+ void ResetCursor();
+
+ void SetAutoStyles( SvXMLStylesContext *pStyles );
+
+ void SetFontDecls( XMLFontStylesContext *pFontDecls );
+ const XMLFontStylesContext *GetFontDecls() const;
+
+ SvXMLImportContext *CreateTextChildContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
+ XMLTextType eType = XML_TEXT_TYPE_SHAPE );
+
+ SvXMLTokenMap const& GetTextElemTokenMap();
+ SvXMLTokenMap const& GetTextPElemTokenMap();
+ SvXMLTokenMap const& GetTextPAttrTokenMap();
+ SvXMLTokenMap const& GetTextFrameAttrTokenMap();
+ SvXMLTokenMap const& GetTextContourAttrTokenMap();
+ SvXMLTokenMap const& GetTextHyperlinkAttrTokenMap();
+ SvXMLTokenMap const& GetTextMasterPageElemTokenMap();
+
+ const SvXMLTokenMap& GetTextNumberedParagraphAttrTokenMap();
+ const SvXMLTokenMap& GetTextListBlockAttrTokenMap();
+ const SvXMLTokenMap& GetTextListBlockElemTokenMap();
+ const SvXMLTokenMap& GetTextFieldAttrTokenMap(); // impl: txtfldi.cxx
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XText > & GetText();
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextCursor > & GetCursor();
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > & GetCursorAsRange();
+
+ bool IsInsertMode() const;
+ bool IsStylesOnlyMode() const;
+ bool IsBlockMode() const;
+ bool IsOrganizerMode() const;
+ bool IsProgress() const;
+
+ ::rtl::OUString ConvertStarFonts( const ::rtl::OUString& rChars,
+ const ::rtl::OUString& rStyleName,
+ sal_uInt8& rFlags,
+ sal_Bool bPara,
+ SvXMLImport& rImport ) const;
+ // insert a string without special whitespace processing enabled
+ void InsertString( const ::rtl::OUString& rChars );
+ // insert a string with special whitespace processing enabled
+ void InsertString( const ::rtl::OUString& rChars,
+ sal_Bool& rIgnoreLeadingSpace );
+ // Delete current paragraph
+ void DeleteParagraph();
+
+ void InsertControlCharacter( sal_Int16 nControl );
+ void InsertTextContent( ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextContent > & xContent);
+
+ // Add parameter <bOutlineLevelAttrFound> (#i73509#)
+ // Add parameter <bSetListAttrs> in order to suppress the handling of the list attributes (#i80724#)
+ ::rtl::OUString SetStyleAndAttrs(
+ SvXMLImport& rImport,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextCursor >& rCursor,
+ const ::rtl::OUString& rStyleName,
+ sal_Bool bPara,
+ sal_Bool bOutlineLevelAttrFound = sal_False,
+ sal_Int8 nOutlineLevel = -1,
+ sal_Bool bSetListAttrs = sal_True );
+
+ /** Find a suitable name for the given outline level.
+ * If rStyleName is empty, change it to a previously used or default style
+ * name for that level. Otherwise, leave rStyleName unmodified.
+ */
+ // Adjust 2nd parameter (#i69629#)
+ void FindOutlineStyleName( ::rtl::OUString& rStyleName,
+ sal_Int8 nOutlineLevel );
+
+ // Change method name to reflect change of data structure (#i69629#)
+ void AddOutlineStyleCandidate( const sal_Int8 nOutlineLevel,
+ const ::rtl::OUString& rStyleName );
+
+ void SetOutlineStyles( sal_Bool bSetEmpty );
+
+ void SetHyperlink(
+ SvXMLImport& rImport,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextCursor >& rCursor,
+ const ::rtl::OUString& rHRef,
+ const ::rtl::OUString& rName,
+ const ::rtl::OUString& rTargetFrameName,
+ const ::rtl::OUString& rStyleName,
+ const ::rtl::OUString& rVisitedStyleName,
+ XMLEventsImportContext* pEvents = NULL);
+ void SetRuby(
+ SvXMLImport& rImport,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextCursor >& rCursor,
+ const ::rtl::OUString& rStyleName,
+ const ::rtl::OUString& rTextStyleName,
+ const ::rtl::OUString& rText );
+
+ /// return key appropriate for use with NumberFormat property
+ /// return -1 if style is not found
+ /// (may return whether data style uses the system language)
+ sal_Int32 GetDataStyleKey( const ::rtl::OUString& sStyleName,
+ sal_Bool* pIsSystemLanguage = NULL );
+
+ const SvxXMLListStyleContext *FindAutoListStyle(
+ const ::rtl::OUString& rName ) const;
+ XMLPropStyleContext *FindAutoFrameStyle(
+ const ::rtl::OUString& rName ) const;
+ XMLPropStyleContext* FindSectionStyle(
+ const ::rtl::OUString& rName ) const;
+ XMLPropStyleContext* FindPageMaster(
+ const ::rtl::OUString& rName ) const;
+
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XNameContainer> & GetParaStyles() const;
+
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XNameContainer> & GetTextStyles() const;
+
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XNameContainer> &
+ GetNumberingStyles() const;
+
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XNameContainer> & GetFrameStyles() const;
+
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XNameContainer> & GetPageStyles() const;
+
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XIndexReplace > &
+ GetChapterNumbering() const;
+
+ sal_Bool HasFrameByName( const ::rtl::OUString& rName ) const;
+ void ConnectFrameChains( const ::rtl::OUString& rFrmName,
+ const ::rtl::OUString& rNextFrmName,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet >& rFrmPropSet );
+
+ UniReference< SvXMLImportPropertyMapper > const&
+ GetParaImportPropertySetMapper() const;
+ UniReference< SvXMLImportPropertyMapper > const&
+ GetTextImportPropertySetMapper() const;
+ UniReference< SvXMLImportPropertyMapper > const&
+ GetFrameImportPropertySetMapper() const;
+ UniReference< SvXMLImportPropertyMapper > const&
+ GetSectionImportPropertySetMapper() const;
+ UniReference< SvXMLImportPropertyMapper > const&
+ GetRubyImportPropertySetMapper() const;
+
+ static SvXMLImportPropertyMapper *CreateShapeExtPropMapper(SvXMLImport&);
+ static SvXMLImportPropertyMapper *CreateCharExtPropMapper(SvXMLImport&, XMLFontStylesContext *pFontDecls = NULL);
+ static SvXMLImportPropertyMapper *CreateParaExtPropMapper(SvXMLImport&, XMLFontStylesContext *pFontDecls = NULL);
+ static SvXMLImportPropertyMapper* CreateParaDefaultExtPropMapper(SvXMLImport&, XMLFontStylesContext* pFontDecls = NULL);
+ static SvXMLImportPropertyMapper* CreateTableDefaultExtPropMapper(SvXMLImport&, XMLFontStylesContext* pFontDecls = NULL);
+ static SvXMLImportPropertyMapper* CreateTableRowDefaultExtPropMapper(SvXMLImport&, XMLFontStylesContext* pFontDecls = NULL);
+
+ static sal_Bool HasDrawNameAttribute(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
+ SvXMLNamespaceMap& rNamespaceMap );
+
+ SvI18NMap& GetRenameMap();
+
+ /// save the start of a range reference
+ void InsertBookmarkStartRange(
+ const ::rtl::OUString sName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange> & rRange,
+ ::rtl::OUString const& i_rXmlId,
+ ::boost::shared_ptr< ::xmloff::ParsedRDFaAttributes > &
+ i_rpRDFaAttributes);
+
+ /// process the start of a range reference
+ sal_Bool FindAndRemoveBookmarkStartRange(
+ const ::rtl::OUString sName,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange> & o_rRange,
+ ::rtl::OUString & o_rXmlId,
+ ::boost::shared_ptr< ::xmloff::ParsedRDFaAttributes > &
+ o_rpRDFaAttributes);
+
+ ::rtl::OUString FindActiveBookmarkName();
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > GetRangeFor(::rtl::OUString &sName);
+
+ void pushFieldCtx( ::rtl::OUString name, ::rtl::OUString type );
+ void popFieldCtx();
+ void addFieldParam( ::rtl::OUString name, ::rtl::OUString value );
+ void setCurrentFieldParamsTo(::com::sun::star::uno::Reference< ::com::sun::star::text::XFormField> &xFormField);
+ ::rtl::OUString getCurrentFieldName();
+ ::rtl::OUString getCurrentFieldType();
+ bool hasCurrentFieldCtx();
+
+
+ /// insert new footnote ID.
+ /// Also fixup open references from the backpatch list to this ID.
+ // Code is implemented in XMLPropertyBackpatcher.cxx
+ void InsertFootnoteID(const ::rtl::OUString& sXMLId, sal_Int16 nAPIId);
+
+ /// set the proper footnote reference ID,
+ /// or put into backpatch list if ID is unknown
+ // Code is implemented in XMLPropertyBackpatcher.cxx
+ void ProcessFootnoteReference(
+ const ::rtl::OUString& sXMLId,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropSet);
+
+ /// insert new sequence ID
+ /// Also fixup open references from backpatch list to this ID.
+ // Code is implemented in XMLPropertyBackpatcher.cxx
+ void InsertSequenceID(const ::rtl::OUString& sXMLId,
+ const ::rtl::OUString& sName,
+ sal_Int16 nAPIId);
+
+ /// set sequence ID or insert into backpatch list
+ // Code is implemented in XMLPropertyBackpatcher.cxx
+ void ProcessSequenceReference(
+ const ::rtl::OUString& sXMLId,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropSet);
+
+ sal_Bool IsInFrame() const;
+ virtual sal_Bool IsInHeaderFooter() const;
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet>
+ createAndInsertOLEObject( SvXMLImport& rImport,
+ const ::rtl::OUString& rHRef,
+ const ::rtl::OUString &rStyleName,
+ const ::rtl::OUString &rTblName,
+ sal_Int32 nWidth, sal_Int32 nHeight );
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet>
+ createAndInsertOOoLink( SvXMLImport& rImport,
+ const ::rtl::OUString& rHRef,
+ const ::rtl::OUString &rStyleName,
+ const ::rtl::OUString &rTblName,
+ sal_Int32 nWidth, sal_Int32 nHeight );
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet>
+ createAndInsertApplet(
+ const ::rtl::OUString &rName,
+ const ::rtl::OUString &rCode,
+ sal_Bool bMayScript,
+ const ::rtl::OUString& rHRef,
+ sal_Int32 nWidth, sal_Int32 nHeight );
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet>
+ createAndInsertPlugin(
+ const ::rtl::OUString &rMimeType,
+ const ::rtl::OUString& rHRef,
+ sal_Int32 nWidth, sal_Int32 nHeight );
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet>
+ createAndInsertFloatingFrame(
+ const ::rtl::OUString &rName,
+ const ::rtl::OUString &rHRef,
+ const ::rtl::OUString &rStyleName,
+ sal_Int32 nWidth, sal_Int32 nHeight );
+
+ virtual void endAppletOrPlugin(
+ const com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> &rPropSet,
+ ::std::map < const ::rtl::OUString, ::rtl::OUString, ::comphelper::UStringLess > &rParamMap );
+
+ // applet helper methods
+ // implemented in sw/filter/xml/txtparai.hxx
+
+ // redlining helper methods
+ // (to be implemented in sw/filter/xml/txtparai.hxx)
+
+ virtual void RedlineAdd(
+ const ::rtl::OUString& rType, /// redline type (insert, del,... )
+ const ::rtl::OUString& rId, /// use to identify this redline
+ const ::rtl::OUString& rAuthor, /// name of the author
+ const ::rtl::OUString& rComment, /// redline comment
+ const ::com::sun::star::util::DateTime& rDateTime, /// date+time
+ sal_Bool bMergeLastParagraph); /// merge last paras
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextCursor> RedlineCreateText(
+ ::com::sun::star::uno::Reference< /// needed to get the document
+ ::com::sun::star::text::XTextCursor> & rOldCursor,
+ const ::rtl::OUString& rId); /// ID used to RedlineAdd() call
+ virtual void RedlineSetCursor(
+ const ::rtl::OUString& rId, /// ID used to RedlineAdd() call
+ sal_Bool bStart, /// start or end Cursor
+ sal_Bool bIsOutsideOfParagraph); /// range is not within <text:p>
+ virtual void RedlineAdjustStartNodeCursor(
+ sal_Bool bStart);
+ virtual void SetShowChanges( sal_Bool bShowChanges );
+ virtual void SetRecordChanges( sal_Bool bRecordChanges );
+ virtual void SetChangesProtectionKey(
+ const ::com::sun::star::uno::Sequence<sal_Int8> & rProtectionKey );
+
+ // access to the last open redline ID:
+ ::rtl::OUString GetOpenRedlineId();
+ void SetOpenRedlineId( ::rtl::OUString& rId);
+ void ResetOpenRedlineId();
+
+ // #107848#
+ // Access methods to the inside_deleted_section flag (redlining)
+ void SetInsideDeleteContext(bool const bNew);
+ bool IsInsideDeleteContext() const;
+
+ SvXMLImport & GetXMLImport();
+
+ XMLTextListsHelper & GetTextListHelper();
+
+ // forwards to TextListHelper; these are used in many places
+ /// push a list context on the list context stack
+ void PushListContext(XMLTextListBlockContext *i_pListBlock = 0);
+ /// pop the list context stack
+ void PopListContext();
+
+ void SetCellParaStyleDefault(::rtl::OUString const& rNewValue);
+ ::rtl::OUString const& GetCellParaStyleDefault();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/txtimppr.hxx b/xmloff/inc/xmloff/txtimppr.hxx
new file mode 100644
index 000000000000..1a1394b87386
--- /dev/null
+++ b/xmloff/inc/xmloff/txtimppr.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_TXTIMPPR_HXX
+#define _XMLOFF_TXTIMPPR_HXX
+
+#include "xmloff/dllapi.h"
+#include <xmloff/xmlimppr.hxx>
+
+class XMLFontStylesContext;
+
+class XMLOFF_DLLPUBLIC XMLTextImportPropertyMapper : public SvXMLImportPropertyMapper
+{
+ sal_Int32 nSizeTypeIndex;
+ sal_Int32 nWidthTypeIndex;
+ SvXMLImportContextRef xFontDecls;
+
+ void FontFinished(
+ XMLPropertyState *pFontFamilyNameState,
+ XMLPropertyState *pFontStyleNameState,
+ XMLPropertyState *pFontFamilyState,
+ XMLPropertyState *pFontPitchState,
+ XMLPropertyState *pFontCharsetState ) const;
+
+ void FontDefaultsCheck(
+ XMLPropertyState*pFontFamilyName,
+ XMLPropertyState* pFontStyleName,
+ XMLPropertyState* pFontFamily,
+ XMLPropertyState* pFontPitch,
+ XMLPropertyState* pFontCharSet,
+ XMLPropertyState** ppNewFontStyleName,
+ XMLPropertyState** ppNewFontFamily,
+ XMLPropertyState** ppNewFontPitch,
+ XMLPropertyState** ppNewFontCharSet ) const;
+
+protected:
+ virtual bool handleSpecialItem(
+ XMLPropertyState& rProperty,
+ ::std::vector< XMLPropertyState >& rProperties,
+ const ::rtl::OUString& rValue,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap ) const;
+public:
+ XMLTextImportPropertyMapper(
+ const UniReference< XMLPropertySetMapper >& rMapper,
+ SvXMLImport& rImport,
+ XMLFontStylesContext *pFontDecls = 0 );
+ virtual ~XMLTextImportPropertyMapper();
+
+ void SetFontDecls( XMLFontStylesContext *pFontDecls );
+
+ /** This method is called when all attributes have benn processed. It may be used to remove items that are incomplete */
+ virtual void finished(
+ ::std::vector< XMLPropertyState >& rProperties,
+ sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const;
+};
+
+#endif // _XMLOFF_XMLIMPPR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/txtparae.hxx b/xmloff/inc/xmloff/txtparae.hxx
new file mode 100644
index 000000000000..c354fc5fbcaa
--- /dev/null
+++ b/xmloff/inc/xmloff/txtparae.hxx
@@ -0,0 +1,735 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_TEXTPARAE_HXX_
+#define _XMLOFF_TEXTPARAE_HXX_
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <xmloff/uniref.hxx>
+#include <xmloff/xmlexppr.hxx>
+#include <xmloff/styleexp.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/SinglePropertySetInfoCache.hxx>
+#include <xmloff/XMLStringVector.hxx>
+#include <vector>
+
+class XMLTextListsHelper;
+class SvXMLExport;
+class SvXMLAutoStylePoolP;
+class XMLTextFieldExport;
+class OUStrings_Impl;
+class OUStringsSort_Impl;
+class XMLTextNumRuleInfo;
+class XMLTextListAutoStylePool;
+class XMLSectionExport;
+class XMLIndexMarkExport;
+class XMLRedlineExport;
+struct XMLPropertyState;
+class MultiPropertySetHelper;
+
+namespace com { namespace sun { namespace star
+{
+ namespace beans { class XPropertySet; class XPropertyState;
+ class XPropertySetInfo; }
+ namespace container { class XEnumerationAccess; class XEnumeration; class XIndexAccess; }
+ namespace text { class XTextContent; class XTextRange; class XText;
+ class XFootnote; class XTextFrame; class XTextSection;
+ class XTextField;
+ class XDocumentIndex; class XTextShapesSupplier; }
+} } }
+
+namespace xmloff
+{
+ class OFormLayerXMLExport;
+ class BoundFrameSets;
+}
+
+class XMLOFF_DLLPUBLIC XMLTextParagraphExport : public XMLStyleExport
+{
+
+// SvXMLExport& rExport;
+ SvXMLAutoStylePoolP& rAutoStylePool;
+ UniReference < SvXMLExportPropertyMapper > xParaPropMapper;
+ UniReference < SvXMLExportPropertyMapper > xTextPropMapper;
+ UniReference < SvXMLExportPropertyMapper > xFramePropMapper;
+ UniReference < SvXMLExportPropertyMapper > xAutoFramePropMapper;
+ UniReference < SvXMLExportPropertyMapper > xSectionPropMapper;
+ UniReference < SvXMLExportPropertyMapper > xRubyPropMapper;
+
+ const ::std::auto_ptr< ::xmloff::BoundFrameSets > pBoundFrameSets;
+ XMLTextFieldExport *pFieldExport;
+ OUStrings_Impl *pListElements;
+ XMLTextListAutoStylePool *pListAutoPool;
+ XMLSectionExport *pSectionExport;
+ XMLIndexMarkExport *pIndexMarkExport;
+
+ /// may be NULL (if no redlines should be exported; e.g. in block mode)
+ XMLRedlineExport *pRedlineExport;
+ XMLStringVector *pHeadingStyles;
+
+ sal_Bool bProgress;
+
+ sal_Bool bBlock;
+
+ // keep track of open rubies
+ ::rtl::OUString sOpenRubyText;
+ ::rtl::OUString sOpenRubyCharStyle;
+ sal_Bool bOpenRuby;
+
+ XMLTextListsHelper* mpTextListsHelper;
+ ::std::vector< XMLTextListsHelper* > maTextListsHelperStack;
+
+ enum FrameType { FT_TEXT, FT_GRAPHIC, FT_EMBEDDED, FT_SHAPE };
+
+protected:
+
+ const ::rtl::OUString sActualSize;
+ // Implement Title/Description Elements UI (#i73249#)
+ const ::rtl::OUString sTitle;
+ const ::rtl::OUString sDescription;
+ const ::rtl::OUString sAnchorCharStyleName;
+ const ::rtl::OUString sAnchorPageNo;
+ const ::rtl::OUString sAnchorType;
+ const ::rtl::OUString sBeginNotice;
+ const ::rtl::OUString sBookmark;
+ const ::rtl::OUString sCategory;
+ const ::rtl::OUString sChainNextName;
+ const ::rtl::OUString sCharStyleName;
+ const ::rtl::OUString sCharStyleNames;
+ const ::rtl::OUString sContourPolyPolygon;
+ const ::rtl::OUString sDocumentIndex;
+ const ::rtl::OUString sDocumentIndexMark;
+ const ::rtl::OUString sEndNotice;
+ const ::rtl::OUString sFootnote;
+ const ::rtl::OUString sFootnoteCounting;
+ const ::rtl::OUString sFrame;
+ const ::rtl::OUString sFrameHeightAbsolute;
+ const ::rtl::OUString sFrameHeightPercent;
+ const ::rtl::OUString sFrameStyleName;
+ const ::rtl::OUString sFrameWidthAbsolute;
+ const ::rtl::OUString sFrameWidthPercent;
+ const ::rtl::OUString sGraphicFilter;
+ const ::rtl::OUString sGraphicRotation;
+ const ::rtl::OUString sGraphicURL;
+ const ::rtl::OUString sHeight;
+ const ::rtl::OUString sHoriOrient;
+ const ::rtl::OUString sHoriOrientPosition;
+ const ::rtl::OUString sHyperLinkName;
+ const ::rtl::OUString sHyperLinkTarget;
+ const ::rtl::OUString sHyperLinkURL;
+ const ::rtl::OUString sIsAutomaticContour;
+ const ::rtl::OUString sIsCollapsed;
+ const ::rtl::OUString sIsPixelContour;
+ const ::rtl::OUString sIsStart;
+ const ::rtl::OUString sIsSyncHeightToWidth;
+ const ::rtl::OUString sIsSyncWidthToHeight;
+ const ::rtl::OUString sNumberingRules;
+ const ::rtl::OUString sNumberingType;
+ const ::rtl::OUString sPageDescName;
+ const ::rtl::OUString sPageStyleName;
+ const ::rtl::OUString sParaChapterNumberingLevel;
+ const ::rtl::OUString sParaConditionalStyleName;
+ const ::rtl::OUString sParagraphService;
+ const ::rtl::OUString sParaStyleName;
+ const ::rtl::OUString sPositionEndOfDoc;
+ const ::rtl::OUString sPrefix;
+ const ::rtl::OUString sRedline;
+ const ::rtl::OUString sReferenceId;
+ const ::rtl::OUString sReferenceMark;
+ const ::rtl::OUString sRelativeHeight;
+ const ::rtl::OUString sRelativeWidth;
+ const ::rtl::OUString sRuby;
+ const ::rtl::OUString sRubyAdjust;
+ const ::rtl::OUString sRubyCharStyleName;
+ const ::rtl::OUString sRubyText;
+ const ::rtl::OUString sServerMap;
+ const ::rtl::OUString sShapeService;
+ const ::rtl::OUString sSizeType;
+ const ::rtl::OUString sSoftPageBreak;
+ const ::rtl::OUString sStartAt;
+ const ::rtl::OUString sSuffix;
+ const ::rtl::OUString sTableService;
+ const ::rtl::OUString sText;
+ const ::rtl::OUString sTextContentService;
+ const ::rtl::OUString sTextEmbeddedService;
+ const ::rtl::OUString sTextEndnoteService;
+ const ::rtl::OUString sTextField;
+ const ::rtl::OUString sTextFieldService;
+ const ::rtl::OUString sTextFrameService;
+ const ::rtl::OUString sTextGraphicService;
+ const ::rtl::OUString sTextPortionType;
+ const ::rtl::OUString sTextSection;
+ const ::rtl::OUString sUnvisitedCharStyleName;
+ const ::rtl::OUString sVertOrient;
+ const ::rtl::OUString sVertOrientPosition;
+ const ::rtl::OUString sVisitedCharStyleName;
+ const ::rtl::OUString sWidth;
+ const ::rtl::OUString sWidthType;
+ const ::rtl::OUString sTextFieldStart;
+ const ::rtl::OUString sTextFieldEnd;
+ const ::rtl::OUString sTextFieldStartEnd;
+
+ SinglePropertySetInfoCache aCharStyleNamesPropInfoCache;
+
+// SvXMLExport& GetExport() { return rExport; }
+// const SvXMLExport& GetExport() const { return rExport; }
+
+ UniReference < SvXMLExportPropertyMapper > GetParaPropMapper() const
+ {
+ return xParaPropMapper;
+ }
+
+ UniReference < SvXMLExportPropertyMapper > GetTextPropMapper() const
+ {
+ return xTextPropMapper;
+ }
+
+ UniReference < SvXMLExportPropertyMapper > GetFramePropMapper() const
+ {
+ return xFramePropMapper;
+ }
+ UniReference < SvXMLExportPropertyMapper > GetAutoFramePropMapper() const
+ {
+ return xAutoFramePropMapper;
+ }
+ UniReference < SvXMLExportPropertyMapper > GetSectionPropMapper() const
+ {
+ return xSectionPropMapper;
+ }
+ UniReference < SvXMLExportPropertyMapper > GetRubyPropMapper() const
+ {
+ return xRubyPropMapper;
+ }
+
+
+ SvXMLAutoStylePoolP& GetAutoStylePool() { return rAutoStylePool; }
+ const SvXMLAutoStylePoolP& GetAutoStylePool() const { return rAutoStylePool; }
+
+public:
+ ::rtl::OUString FindTextStyle(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rPropSet,
+ sal_Bool& rbHasCharStyle ) const;
+ ::rtl::OUString FindTextStyleAndHyperlink(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rPropSet,
+ sal_Bool& rbHyperlink,
+ sal_Bool& rbHasCharStyle,
+ sal_Bool& rbHasAutoStyle,
+ const XMLPropertyState** pAddState = NULL) const;
+ sal_Bool addHyperlinkAttributes(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rPropSet,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertyState > & rPropState,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySetInfo > & rPropSetInfo );
+
+ void exportTextRangeEnumeration(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::container::XEnumeration > & rRangeEnum,
+ sal_Bool bAutoStyles, sal_Bool bProgress,
+ sal_Bool bPrvChrIsSpc = sal_True );
+
+protected:
+
+ sal_Int32 addTextFrameAttributes(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet >& rPropSet,
+ sal_Bool bShape,
+ ::rtl::OUString *pMinHeightValue = 0 );
+
+ virtual void exportStyleAttributes(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::style::XStyle > & rStyle );
+
+ void exportPageFrames( sal_Bool bAutoStyles, sal_Bool bProgress );
+ void exportFrameFrames( sal_Bool bAutoStyles, sal_Bool bProgress,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextFrame > *pParentTxtFrame = 0 );
+
+ void exportNumStyles( sal_Bool bUsed );
+
+ void exportText(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XText > & rText,
+ sal_Bool bAutoStyles, sal_Bool bProgress, sal_Bool bExportParagraph );
+
+ void exportText(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XText > & rText,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextSection > & rBaseSection,
+ sal_Bool bAutoStyles, sal_Bool bProgress, sal_Bool bExportParagraph );
+
+ sal_Bool exportTextContentEnumeration(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::container::XEnumeration > & rContentEnum,
+ sal_Bool bAutoStyles,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextSection > & rBaseSection,
+ sal_Bool bProgress,
+ sal_Bool bExportParagraph = sal_True,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > *pRangePropSet = 0,
+ sal_Bool bExportLevels = sal_True );
+ void exportParagraph(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextContent > & rTextContent,
+ sal_Bool bAutoStyles, sal_Bool bProgress,
+ sal_Bool bExportParagraph,
+ MultiPropertySetHelper& rPropSetHelper);
+ virtual void exportTable(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextContent > & rTextContent,
+ sal_Bool bAutoStyles, sal_Bool bProgress );
+
+ void exportTextField(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextRange > & rTextRange,
+ sal_Bool bAutoStyles, sal_Bool bProgress );
+
+ void exportTextField(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextField> & xTextField,
+ const sal_Bool bAutoStyles, const sal_Bool bProgress,
+ const sal_Bool bRecursive );
+
+ void exportAnyTextFrame(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextContent > & rTextContent,
+ FrameType eTxpe,
+ sal_Bool bAutoStyles, sal_Bool bProgress, sal_Bool bExportContent,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > *pRangePropSet = 0 );
+ void _exportTextFrame(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rPropSet,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySetInfo > & rPropSetInfo,
+ sal_Bool bProgress );
+ inline void exportTextFrame(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextContent > & rTextContent,
+ sal_Bool bAutoStyles, sal_Bool bProgress, sal_Bool bExportContent,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > *pRangePropSet = 0 );
+ inline void exportShape(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextContent > & rTextContent,
+ sal_Bool bAutoStyles,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > *pRangePropSet = 0 );
+
+ void exportContour(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rPropSet,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySetInfo > & rPropSetInfo );
+ void _exportTextGraphic(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rPropSet,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySetInfo > & rPropSetInfo );
+ inline void exportTextGraphic(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextContent > & rTextContent,
+ sal_Bool bAutoStyles,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > *pRangePropSet = 0 );
+
+ virtual void _collectTextEmbeddedAutoStyles(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rPropSet );
+ virtual void _exportTextEmbedded(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rPropSet,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySetInfo > & rPropSetInfo );
+ inline void exportTextEmbedded(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextContent > & rTextContent,
+ sal_Bool bAutoStyles,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > *pRangePropSet = 0 );
+ virtual void setTextEmbeddedGraphicURL(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet >& rPropSet,
+ ::rtl::OUString& rStreamName ) const;
+
+ /// export a footnote and styles
+ void exportTextFootnote(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rPropSet,
+ const ::rtl::OUString& sString,
+ sal_Bool bAutoStyles, sal_Bool bProgress );
+
+ /// helper for exportTextFootnote
+ void exportTextFootnoteHelper(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XFootnote > & rPropSet,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XText> & rText,
+ const ::rtl::OUString& sString,
+ sal_Bool bAutoStyles,
+ sal_Bool bIsEndnote, sal_Bool bProgress );
+
+ /// export footnote and endnote configuration elements
+ void exportTextFootnoteConfiguration();
+
+ void exportTextFootnoteConfigurationHelper(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rFootnoteSupplier,
+ sal_Bool bIsEndnote);
+
+ void exportTextMark(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropSet,
+ const ::rtl::OUString& rProperty,
+ const enum ::xmloff::token::XMLTokenEnum pElements[],
+ sal_Bool bAutoStyles);
+
+ void exportIndexMark(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet,
+ sal_Bool bAutoStyles);
+
+ void exportSoftPageBreak(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet,
+ sal_Bool bAutoStyles);
+
+ void exportTextRange(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextRange > & rTextRange,
+ sal_Bool bAutoStyles,
+ sal_Bool& rPrevCharWasSpace );
+
+ void exportListChange( const XMLTextNumRuleInfo& rPrvInfo,
+ const XMLTextNumRuleInfo& rNextInfo );
+
+ /// check if current section or current list has changed;
+ /// calls exortListChange as appropriate
+ void exportListAndSectionChange(
+ ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextSection > & rOldSection,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextSection > & rNewSection,
+ const XMLTextNumRuleInfo& rOldList,
+ const XMLTextNumRuleInfo& rNewList,
+ sal_Bool bAutoStyles );
+
+ /// overload for exportListAndSectionChange;
+ /// takes new content rather than new section.
+ void exportListAndSectionChange(
+ ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextSection > & rOldSection,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextContent > & rNewContent,
+ const XMLTextNumRuleInfo& rOldList,
+ const XMLTextNumRuleInfo& rNewList,
+ sal_Bool bAutoStyles );
+ void exportListAndSectionChange(
+ ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextSection > & rOldSection,
+ MultiPropertySetHelper& rPropSetHelper,
+ sal_Int16 nTextSectionId,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextContent > & rNewContent,
+ const XMLTextNumRuleInfo& rOldList,
+ const XMLTextNumRuleInfo& rNewList,
+ sal_Bool bAutoStyles );
+
+ /// export a redline text portion
+ void exportChange(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rPropSet,
+ sal_Bool bAutoStyle);
+
+ /// export a ruby
+ void exportRuby(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPortionPropSet,
+ sal_Bool bAutoStyles );
+
+ /// export a text:meta
+ void exportMeta(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & i_xPortion,
+ sal_Bool i_bAutoStyles, sal_Bool i_isProgress );
+
+public:
+
+ XMLTextParagraphExport(
+ SvXMLExport& rExp,
+ SvXMLAutoStylePoolP & rASP
+ );
+ virtual ~XMLTextParagraphExport();
+
+ /// add autostyle for specified family
+ void Add(
+ sal_uInt16 nFamily,
+ MultiPropertySetHelper& rPropSetHelper,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rPropSet,
+ const XMLPropertyState** pAddState = NULL );
+ void Add(
+ sal_uInt16 nFamily,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rPropSet,
+ const XMLPropertyState** pAddState = NULL, bool bDontSeek = false );
+
+ /// find style name for specified family and parent
+ ::rtl::OUString Find(
+ sal_uInt16 nFamily,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rPropSet,
+ const ::rtl::OUString& rParent,
+ const XMLPropertyState** pAddState = NULL ) const;
+
+ static SvXMLExportPropertyMapper *CreateShapeExtPropMapper(
+ SvXMLExport& rExport );
+ static SvXMLExportPropertyMapper *CreateCharExtPropMapper(
+ SvXMLExport& rExport);
+ static SvXMLExportPropertyMapper *CreateParaExtPropMapper(
+ SvXMLExport& rExport);
+ static SvXMLExportPropertyMapper *CreateParaDefaultExtPropMapper(
+ SvXMLExport& rExport);
+
+ // This methods exports all (or all used) styles
+ void exportTextStyles( sal_Bool bUsed
+ , sal_Bool bProg = sal_False
+ );
+
+ /// This method exports (text field) declarations etc.
+ void exportTextDeclarations();
+
+ /// export the (text field) declarations for a particular XText
+ void exportTextDeclarations(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XText > & rText );
+
+ /// true: export only those declarations that are used;
+ /// false: export all declarations
+ void exportUsedDeclarations( sal_Bool bOnlyUsed );
+
+ /// Export the list of change information (enclosed by <tracked-changes>)
+ /// (or the necessary automatic styles)
+ void exportTrackedChanges(sal_Bool bAutoStyle);
+
+ /// Export the list of change information (enclosed by <tracked-changes>)
+ /// (or the necessary automatic styles)
+ void exportTrackedChanges(const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XText > & rText,
+ sal_Bool bAutoStyle );
+
+ /// Record tracked changes for this particular XText
+ /// (empty reference stop recording)
+ /// This should be used if tracked changes for e.g. footers are to
+ /// be exported seperately via the exportTrackedChanges(sal_Bool,
+ /// Reference<XText>) method.
+ void recordTrackedChangesForXText(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XText > & rText );
+
+
+ /// Stop recording tracked changes.
+ /// This is the same as calling recordTrackedChanges(...) with an
+ /// empty reference.
+ void recordTrackedChangesNoXText();
+
+
+ // This method exports the given OUString
+ void exportText(
+ const ::rtl::OUString& rText,
+ sal_Bool& rPrevCharWasSpace );
+
+ // This method collects all automatic styles for the given XText
+ void collectTextAutoStyles(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XText > & rText,
+ sal_Bool bIsProgress = sal_False,
+ sal_Bool bExportParagraph = sal_True )
+ {
+ exportText( rText, sal_True, bIsProgress, bExportParagraph );
+ }
+
+ void collectTextAutoStyles(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XText > & rText,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextSection > & rBaseSection,
+ sal_Bool bIsProgress = sal_False,
+ sal_Bool bExportParagraph = sal_True )
+ {
+ exportText( rText, rBaseSection, sal_True, bIsProgress, bExportParagraph );
+ }
+
+ // It the model implements the xAutoStylesSupplier interface, the automatic
+ // styles can exported without iterating over the text portions
+ bool collectTextAutoStylesOptimized(
+ sal_Bool bIsProgress = sal_False );
+
+ // This method exports all automatic styles that have been collected.
+ virtual void exportTextAutoStyles();
+
+ void exportEvents( const ::com::sun::star::uno::Reference < com::sun::star::beans::XPropertySet > & rPropSet );
+
+ // Implement Title/Description Elements UI (#i73249#)
+ void exportTitleAndDescription( const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > & rPropSet,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySetInfo > & rPropSetInfo );
+
+ // This method exports the given XText
+ void exportText(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XText > & rText,
+ sal_Bool bIsProgress = sal_False,
+ sal_Bool bExportParagraph = sal_True)
+ {
+ exportText( rText, sal_False, bIsProgress, bExportParagraph );
+ }
+
+ void exportText(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XText > & rText,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextSection > & rBaseSection,
+ sal_Bool bIsProgress = sal_False,
+ sal_Bool bExportParagraph = sal_True)
+ {
+ exportText( rText, rBaseSection, sal_False, bIsProgress, bExportParagraph );
+ }
+
+ void exportFramesBoundToPage( sal_Bool bIsProgress = sal_False )
+ {
+ exportPageFrames( sal_False, bIsProgress );
+ }
+ void exportFramesBoundToFrame(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextFrame >& rParentTxtFrame,
+ sal_Bool bIsProgress = sal_False )
+ {
+ exportFrameFrames( sal_False, bIsProgress, &rParentTxtFrame );
+ }
+ inline const XMLTextListAutoStylePool& GetListAutoStylePool() const;
+
+ void SetBlockMode( sal_Bool bSet ) { bBlock = bSet; }
+ sal_Bool IsBlockMode() const { return bBlock; }
+
+
+ UniReference < SvXMLExportPropertyMapper > GetParagraphPropertyMapper() const
+ {
+ return xParaPropMapper;
+ }
+
+
+ /** exclude form controls which are in mute sections.
+ *
+ * This method is necessary to prevent the form layer export from exporting
+ * control models whose controls are not represented in the document. To
+ * achieve this, this method iterates over all shapes, checks to see if
+ * they are control shapes, and if so, whether they should be exported or
+ * not. If not, the form layer export will be notified accordingly.
+ *
+ * The reason this method is located here is tha it needs to access the
+ * XMLSectionExport, which is only available here.
+ */
+ void PreventExportOfControlsInMuteSections(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XIndexAccess> & rShapes,
+ UniReference<xmloff::OFormLayerXMLExport> xFormExport );
+
+ SinglePropertySetInfoCache& GetCharStyleNamesPropInfoCache() { return aCharStyleNamesPropInfoCache; }
+
+ sal_Int32 GetHeadingLevel( const ::rtl::OUString& rStyleName );
+
+ void PushNewTextListsHelper();
+
+ void PopTextListsHelper();
+
+private:
+ XMLTextParagraphExport(XMLTextParagraphExport &); // private copy-ctor because of explicit copy-ctor of auto_ptr
+};
+
+inline const XMLTextListAutoStylePool&
+ XMLTextParagraphExport::GetListAutoStylePool() const
+{
+ return *pListAutoPool;
+}
+
+inline void XMLTextParagraphExport::exportTextFrame(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextContent > & rTextContent,
+ sal_Bool bAutoStyles, sal_Bool bIsProgress, sal_Bool bExportContent,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > *pRangePropSet)
+{
+ exportAnyTextFrame( rTextContent, FT_TEXT, bAutoStyles, bIsProgress,
+ bExportContent, pRangePropSet );
+}
+
+inline void XMLTextParagraphExport::exportTextGraphic(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextContent > & rTextContent,
+ sal_Bool bAutoStyles,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > *pRangePropSet )
+{
+ exportAnyTextFrame( rTextContent, FT_GRAPHIC, bAutoStyles, sal_False,
+ sal_True, pRangePropSet );
+}
+
+inline void XMLTextParagraphExport::exportTextEmbedded(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextContent > & rTextContent,
+ sal_Bool bAutoStyles,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > *pRangePropSet )
+{
+ exportAnyTextFrame( rTextContent, FT_EMBEDDED, bAutoStyles, sal_False,
+ sal_True, pRangePropSet );
+}
+
+inline void XMLTextParagraphExport::exportShape(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextContent > & rTextContent,
+ sal_Bool bAutoStyles,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > *pRangePropSet )
+{
+ exportAnyTextFrame( rTextContent, FT_SHAPE, bAutoStyles, sal_False,
+ sal_True, pRangePropSet );
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/txtprmap.hxx b/xmloff/inc/xmloff/txtprmap.hxx
new file mode 100644
index 000000000000..88c7d0aa63df
--- /dev/null
+++ b/xmloff/inc/xmloff/txtprmap.hxx
@@ -0,0 +1,206 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_TEXTPRMAP_HXX_
+#define _XMLOFF_TEXTPRMAP_HXX_
+
+#include <xmloff/contextid.hxx>
+#include <xmloff/xmlprmap.hxx>
+
+#define CTF_CHARHEIGHT (XML_TEXT_CTF_START + 1)
+#define CTF_CHARHEIGHT_REL (XML_TEXT_CTF_START + 2)
+#define CTF_PARALEFTMARGIN (XML_TEXT_CTF_START + 3)
+#define CTF_PARALEFTMARGIN_REL (XML_TEXT_CTF_START + 4)
+#define CTF_PARARIGHTMARGIN (XML_TEXT_CTF_START + 5)
+#define CTF_PARARIGHTMARGIN_REL (XML_TEXT_CTF_START + 6)
+#define CTF_PARAFIRSTLINE (XML_TEXT_CTF_START + 7)
+#define CTF_PARAFIRSTLINE_REL (XML_TEXT_CTF_START + 8)
+#define CTF_PARATOPMARGIN (XML_TEXT_CTF_START + 9)
+#define CTF_PARATOPMARGIN_REL (XML_TEXT_CTF_START + 10)
+#define CTF_PARABOTTOMMARGIN (XML_TEXT_CTF_START + 11)
+#define CTF_PARABOTTOMMARGIN_REL (XML_TEXT_CTF_START + 12)
+#define CTF_ALLBORDERWIDTH (XML_TEXT_CTF_START + 13)
+#define CTF_LEFTBORDERWIDTH (XML_TEXT_CTF_START + 14)
+#define CTF_RIGHTBORDERWIDTH (XML_TEXT_CTF_START + 15)
+#define CTF_TOPBORDERWIDTH (XML_TEXT_CTF_START + 16)
+#define CTF_BOTTOMBORDERWIDTH (XML_TEXT_CTF_START + 17)
+#define CTF_ALLBORDERDISTANCE (XML_TEXT_CTF_START + 18)
+#define CTF_LEFTBORDERDISTANCE (XML_TEXT_CTF_START + 19)
+#define CTF_RIGHTBORDERDISTANCE (XML_TEXT_CTF_START + 20)
+#define CTF_TOPBORDERDISTANCE (XML_TEXT_CTF_START + 21)
+#define CTF_BOTTOMBORDERDISTANCE (XML_TEXT_CTF_START + 22)
+#define CTF_ALLBORDER (XML_TEXT_CTF_START + 23)
+#define CTF_LEFTBORDER (XML_TEXT_CTF_START + 24)
+#define CTF_RIGHTBORDER (XML_TEXT_CTF_START + 25)
+#define CTF_TOPBORDER (XML_TEXT_CTF_START + 26)
+#define CTF_BOTTOMBORDER (XML_TEXT_CTF_START + 27)
+#define CTF_DROPCAPWHOLEWORD (XML_TEXT_CTF_START + 28)
+#define CTF_DROPCAPFORMAT (XML_TEXT_CTF_START + 29)
+#define CTF_DROPCAPCHARSTYLE (XML_TEXT_CTF_START + 30)
+#define CTF_TABSTOP (XML_TEXT_CTF_START + 31)
+#define CTF_NUMBERINGSTYLENAME (XML_TEXT_CTF_START + 32)
+#define CTF_OLDTEXTBACKGROUND (XML_TEXT_CTF_START + 33)
+#define CTF_FONTFAMILYNAME (XML_TEXT_CTF_START + 34)
+#define CTF_FONTSTYLENAME (XML_TEXT_CTF_START + 35)
+#define CTF_FONTFAMILY (XML_TEXT_CTF_START + 36)
+#define CTF_FONTPITCH (XML_TEXT_CTF_START + 37)
+#define CTF_FONTCHARSET (XML_TEXT_CTF_START + 38)
+#define CTF_TEXTWRITINGMODE (XML_TEXT_CTF_START + 39)
+#define CTF_SYNCHEIGHT_MIN (XML_TEXT_CTF_START + 40)
+#define CTF_FRAMEHEIGHT_ABS (XML_TEXT_CTF_START + 41)
+#define CTF_FRAMEHEIGHT_REL (XML_TEXT_CTF_START + 42)
+#define CTF_FRAMEHEIGHT_MIN_ABS (XML_TEXT_CTF_START + 43)
+#define CTF_FRAMEHEIGHT_MIN_REL (XML_TEXT_CTF_START + 44)
+#define CTF_SIZETYPE (XML_TEXT_CTF_START + 45)
+#define CTF_SYNCHEIGHT (XML_TEXT_CTF_START + 46)
+#define CTF_WRAP (XML_TEXT_CTF_START + 47)
+#define CTF_WRAP_CONTOUR (XML_TEXT_CTF_START + 48)
+#define CTF_WRAP_CONTOUR_MODE (XML_TEXT_CTF_START + 49)
+#define CTF_WRAP_PARAGRAPH_ONLY (XML_TEXT_CTF_START + 50)
+#define CTF_ANCHORTYPE (XML_TEXT_CTF_START + 51)
+#define CTF_ANCHORPAGENUMBER (XML_TEXT_CTF_START + 52)
+#define CTF_TEXTCOLUMNS (XML_TEXT_CTF_START + 53)
+#define CTF_HORIZONTALPOS (XML_TEXT_CTF_START + 54)
+#define CTF_HORIZONTALPOS_MIRRORED (XML_TEXT_CTF_START + 55)
+#define CTF_HORIZONTALREL (XML_TEXT_CTF_START + 56)
+#define CTF_HORIZONTALREL_FRAME (XML_TEXT_CTF_START + 57)
+#define CTF_HORIZONTALMIRROR (XML_TEXT_CTF_START + 58)
+#define CTF_VERTICALPOS (XML_TEXT_CTF_START + 59)
+#define CTF_VERTICALREL (XML_TEXT_CTF_START + 60)
+#define CTF_VERTICALREL_PAGE (XML_TEXT_CTF_START + 61)
+#define CTF_VERTICALREL_FRAME (XML_TEXT_CTF_START + 62)
+#define CTF_VERTICALREL_ASCHAR (XML_TEXT_CTF_START + 63)
+#define CTF_PAGEDESCNAME (XML_TEXT_CTF_START + 64)
+#define CTF_BACKGROUND_URL (XML_TEXT_CTF_START + 66)
+#define CTF_BACKGROUND_POS (XML_TEXT_CTF_START + 67)
+#define CTF_BACKGROUND_FILTER (XML_TEXT_CTF_START + 68)
+#define CTF_CHARHEIGHT_DIFF (XML_TEXT_CTF_START + 69)
+#define CTF_FONTNAME (XML_TEXT_CTF_START + 70)
+#define CTF_FONTNAME_CJK (XML_TEXT_CTF_START + 71)
+#define CTF_FONTFAMILYNAME_CJK (XML_TEXT_CTF_START + 72)
+#define CTF_FONTSTYLENAME_CJK (XML_TEXT_CTF_START + 73)
+#define CTF_FONTFAMILY_CJK (XML_TEXT_CTF_START + 74)
+#define CTF_FONTPITCH_CJK (XML_TEXT_CTF_START + 75)
+#define CTF_FONTCHARSET_CJK (XML_TEXT_CTF_START + 76)
+#define CTF_CHARHEIGHT_CJK (XML_TEXT_CTF_START + 77)
+#define CTF_CHARHEIGHT_REL_CJK (XML_TEXT_CTF_START + 78)
+#define CTF_CHARHEIGHT_DIFF_CJK (XML_TEXT_CTF_START + 79)
+#define CTF_FONTNAME_CTL (XML_TEXT_CTF_START + 80)
+#define CTF_FONTFAMILYNAME_CTL (XML_TEXT_CTF_START + 81)
+#define CTF_FONTSTYLENAME_CTL (XML_TEXT_CTF_START + 82)
+#define CTF_FONTFAMILY_CTL (XML_TEXT_CTF_START + 83)
+#define CTF_FONTPITCH_CTL (XML_TEXT_CTF_START + 84)
+#define CTF_FONTCHARSET_CTL (XML_TEXT_CTF_START + 85)
+#define CTF_CHARHEIGHT_CTL (XML_TEXT_CTF_START + 86)
+#define CTF_CHARHEIGHT_REL_CTL (XML_TEXT_CTF_START + 87)
+#define CTF_CHARHEIGHT_DIFF_CTL (XML_TEXT_CTF_START + 88)
+#define CTF_UNDERLINE (XML_TEXT_CTF_START + 89)
+#define CTF_UNDERLINE_COLOR (XML_TEXT_CTF_START + 90)
+#define CTF_UNDERLINE_HASCOLOR (XML_TEXT_CTF_START + 91)
+#define CTF_SECTION_FOOTNOTE_END (XML_TEXT_CTF_START + 92)
+#define CTF_SECTION_FOOTNOTE_NUM_RESTART (XML_TEXT_CTF_START + 93)
+#define CTF_SECTION_FOOTNOTE_NUM_RESTART_AT (XML_TEXT_CTF_START + 94)
+#define CTF_SECTION_FOOTNOTE_NUM_TYPE (XML_TEXT_CTF_START + 95)
+#define CTF_SECTION_FOOTNOTE_NUM_PREFIX (XML_TEXT_CTF_START + 96)
+#define CTF_SECTION_FOOTNOTE_NUM_SUFFIX (XML_TEXT_CTF_START + 97)
+#define CTF_SECTION_FOOTNOTE_NUM_OWN (XML_TEXT_CTF_START + 98)
+#define CTF_SECTION_ENDNOTE_END (XML_TEXT_CTF_START + 99)
+#define CTF_SECTION_ENDNOTE_NUM_RESTART (XML_TEXT_CTF_START + 100)
+#define CTF_SECTION_ENDNOTE_NUM_RESTART_AT (XML_TEXT_CTF_START + 101)
+#define CTF_SECTION_ENDNOTE_NUM_TYPE (XML_TEXT_CTF_START + 102)
+#define CTF_SECTION_ENDNOTE_NUM_PREFIX (XML_TEXT_CTF_START + 103)
+#define CTF_SECTION_ENDNOTE_NUM_SUFFIX (XML_TEXT_CTF_START + 104)
+#define CTF_SECTION_ENDNOTE_NUM_OWN (XML_TEXT_CTF_START + 105)
+#define CTF_PAGE_FOOTNOTE (XML_TEXT_CTF_START + 106)
+#define CTF_FRAME_DISPLAY_SCROLLBAR (XML_TEXT_CTF_START + 107)
+#define CTF_FRAME_DISPLAY_BORDER (XML_TEXT_CTF_START + 108)
+#define CTF_FRAME_MARGIN_HORI (XML_TEXT_CTF_START + 109)
+#define CTF_FRAME_MARGIN_VERT (XML_TEXT_CTF_START + 110)
+#define CTF_COMBINED_CHARACTERS_FIELD (XML_TEXT_CTF_START + 111)
+#define CTF_OLE_VIS_AREA_TOP (XML_TEXT_CTF_START + 112)
+#define CTF_OLE_VIS_AREA_LEFT (XML_TEXT_CTF_START + 113)
+#define CTF_OLE_VIS_AREA_WIDTH (XML_TEXT_CTF_START + 114)
+#define CTF_OLE_VIS_AREA_HEIGHT (XML_TEXT_CTF_START + 115)
+#define CTF_OLE_DRAW_ASPECT (XML_TEXT_CTF_START + 116)
+#define CTF_HYPERLINK_URL (XML_TEXT_CTF_START + 117)
+#define CTF_CHAR_STYLE_NAME (XML_TEXT_CTF_START + 118)
+#define CTF_VERTICALPOS_ATCHAR (XML_TEXT_CTF_START + 119)
+#define CTF_BACKGROUND_TRANSPARENCY (XML_TEXT_CTF_START + 120)
+#define CTF_BACKGROUND_TRANSPARENT (XML_TEXT_CTF_START + 121)
+#define CTF_KEEP_TOGETHER (XML_TEXT_CTF_START + 122)
+#define CTF_FRAMEWIDTH_ABS (XML_TEXT_CTF_START + 123)
+#define CTF_FRAMEWIDTH_MIN_ABS (XML_TEXT_CTF_START + 124)
+#define CTF_FRAMEWIDTH_MIN_REL (XML_TEXT_CTF_START + 125)
+#define CTF_FRAMEWIDTH_REL (XML_TEXT_CTF_START + 126)
+#define CTF_FRAMEWIDTH_TYPE (XML_TEXT_CTF_START + 127)
+#define CTF_BORDER_MODEL (XML_TEXT_CTF_START + 128)
+/* Define CTF ids for positioning properties of
+ shapes, because on export to OpenOffice.org file format these have to
+ be handled special, if shape isn't anchored as-character. (#i28749#)
+*/
+#define CTF_SHAPE_HORIZONTALPOS (XML_TEXT_CTF_START + 129)
+#define CTF_SHAPE_HORIZONTALPOS_MIRRORED (XML_TEXT_CTF_START + 130)
+#define CTF_SHAPE_HORIZONTALREL (XML_TEXT_CTF_START + 131)
+#define CTF_SHAPE_HORIZONTALREL_FRAME (XML_TEXT_CTF_START + 132)
+#define CTF_SHAPE_HORIZONTALMIRROR (XML_TEXT_CTF_START + 133)
+#define CTF_SHAPE_VERTICALPOS (XML_TEXT_CTF_START + 134)
+#define CTF_SHAPE_VERTICALPOS_ATCHAR (XML_TEXT_CTF_START + 135)
+#define CTF_SHAPE_VERTICALREL (XML_TEXT_CTF_START + 136)
+#define CTF_SHAPE_VERTICALREL_PAGE (XML_TEXT_CTF_START + 137)
+#define CTF_SHAPE_VERTICALREL_FRAME (XML_TEXT_CTF_START + 138)
+// <--
+#define CTF_PARA_ADJUSTLAST (XML_TEXT_CTF_START + 139)
+#define CTF_DEFAULT_OUTLINE_LEVEL (XML_TEXT_CTF_START + 140)
+#define CTF_OLD_FLOW_WITH_TEXT (XML_TEXT_CTF_START + 141)
+#define CTF_ISNUMBERING (XML_TEXT_CTF_START + 142)
+#define CTF_TEXT_DISPLAY (XML_TEXT_CTF_START + 143)
+#define CTF_TEXT_CLIP (XML_TEXT_CTF_START + 144)
+#define CTF_TEXT_CLIP11 (XML_TEXT_CTF_START + 145)
+#define TEXT_PROP_MAP_TEXT 0
+#define TEXT_PROP_MAP_PARA 1
+#define TEXT_PROP_MAP_FRAME 2
+#define TEXT_PROP_MAP_AUTO_FRAME 3
+#define TEXT_PROP_MAP_SECTION 4
+#define TEXT_PROP_MAP_SHAPE 5
+#define TEXT_PROP_MAP_RUBY 6
+#define TEXT_PROP_MAP_SHAPE_PARA 7
+#define TEXT_PROP_MAP_TEXT_ADDITIONAL_DEFAULTS 8
+#define TEXT_PROP_MAP_TABLE_DEFAULTS 9
+#define TEXT_PROP_MAP_TABLE_ROW_DEFAULTS 10
+
+class XMLOFF_DLLPUBLIC XMLTextPropertySetMapper : public XMLPropertySetMapper
+{
+public:
+ XMLTextPropertySetMapper( sal_uInt16 nType );
+ virtual ~XMLTextPropertySetMapper();
+
+ static const XMLPropertyMapEntry* getPropertyMapForType( sal_uInt16 _nType );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/txtstyle.hxx b/xmloff/inc/xmloff/txtstyle.hxx
new file mode 100644
index 000000000000..67a0762cb001
--- /dev/null
+++ b/xmloff/inc/xmloff/txtstyle.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_TEXTSTYLE_HXX_
+#define _XMLOFF_TEXTSTYLE_HXX_
+
+#include <xmloff/styleexp.hxx>
+#include <xmloff/uniref.hxx>
+
+class XMLPropertySetMapper;
+
+class XMLTextStyleExport : public XMLStyleExport
+{
+ UniReference < XMLPropertySetMapper > xParaPropMapper;
+
+ void exportNumStyles( sal_Bool bUsed );
+
+public:
+
+ XMLTextStyleExport(
+ SvXMLExport& rExp,
+// const ::com::sun::star::uno::Reference<
+// ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
+// const ::com::sun::star::uno::Reference<
+// ::com::sun::star::frame::XModel > & rModel,
+ const ::rtl::OUString& rPoolStyleName,
+// const SvXMLNamespaceMap &rNamespaceMap,
+// MapUnit eDUnit,
+ SvXMLAutoStylePoolP *pAutoStyleP=0 );
+ virtual ~XMLTextStyleExport();
+
+ void exportStyles( sal_Bool bUsed );
+
+ UniReference < XMLPropertySetMapper >& getParaPropMapper();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/txtstyli.hxx b/xmloff/inc/xmloff/txtstyli.hxx
new file mode 100644
index 000000000000..79eb6cfb3cd5
--- /dev/null
+++ b/xmloff/inc/xmloff/txtstyli.hxx
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_TXTSTYLI_HXX_
+#define _XMLOFF_TXTSTYLI_HXX_
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include <xmloff/prstylei.hxx>
+
+class SvXMLTokenMap;
+class XMLEventsImportContext;
+
+class XMLOFF_DLLPUBLIC XMLTextStyleContext : public XMLPropStyleContext
+{
+ ::rtl::OUString sListStyleName;
+ ::rtl::OUString sCategoryVal;
+ ::rtl::OUString sDropCapTextStyleName;
+ ::rtl::OUString sMasterPageName;
+ ::rtl::OUString sDataStyleName; // for grid columns only
+ const ::rtl::OUString sIsAutoUpdate;
+ const ::rtl::OUString sCategory;
+ const ::rtl::OUString sNumberingStyleName;
+ const ::rtl::OUString sOutlineLevel;
+
+public:
+ const ::rtl::OUString sDropCapCharStyleName;
+private:
+ const ::rtl::OUString sPageDescName;
+
+ sal_Int8 nOutlineLevel;
+
+ sal_Bool bAutoUpdate : 1;
+ sal_Bool bHasMasterPageName : 1;
+
+ sal_Bool bHasCombinedCharactersLetter : 1;
+
+ // Introduce import of empty list style (#i69523#)
+ sal_Bool mbListStyleSet : 1;
+
+ XMLEventsImportContext* pEventContext;
+
+protected:
+
+ virtual void SetAttribute( sal_uInt16 nPrefixKey,
+ const ::rtl::OUString& rLocalName,
+ const ::rtl::OUString& rValue );
+
+public:
+
+ TYPEINFO();
+
+ XMLTextStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
+ SvXMLStylesContext& rStyles, sal_uInt16 nFamily,
+ sal_Bool bDefaultStyle = sal_False );
+ virtual ~XMLTextStyleContext();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+ sal_Bool IsAutoUpdate() const { return bAutoUpdate; }
+
+ const ::rtl::OUString& GetListStyle() const { return sListStyleName; }
+ // XML import: reconstrution of assignment of paragraph style to outline levels (#i69629#)
+ sal_Bool IsListStyleSet() const
+ {
+ return mbListStyleSet;
+ }
+
+ const ::rtl::OUString& GetMasterPageName() const { return sMasterPageName; }
+ sal_Bool HasMasterPageName() const { return bHasMasterPageName; }
+ const ::rtl::OUString& GetDropCapStyleName() const { return sDropCapTextStyleName; }
+ const ::rtl::OUString& GetDataStyleName() const { return sDataStyleName; }
+
+ virtual void CreateAndInsert( sal_Bool bOverwrite );
+ virtual void Finish( sal_Bool bOverwrite );
+ virtual void SetDefaults();
+
+ // overload FillPropertySet, so we can get at the combined characters
+ virtual void FillPropertySet(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rPropSet );
+
+ inline sal_Bool HasCombinedCharactersLetter()
+ { return bHasCombinedCharactersLetter; }
+
+ const ::std::vector< XMLPropertyState > & _GetProperties() { return GetProperties(); }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/uniref.hxx b/xmloff/inc/xmloff/uniref.hxx
new file mode 100644
index 000000000000..0a9d8e9dd6d4
--- /dev/null
+++ b/xmloff/inc/xmloff/uniref.hxx
@@ -0,0 +1,232 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _UNIVERSALL_REFERENCE_HXX
+#define _UNIVERSALL_REFERENCE_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include <sal/types.h>
+#include <osl/interlck.h>
+
+/**
+ * An instance of this class holds a pointer to an object. The lifetime of
+ * the object is controled by the instance. The constructor calls
+ * acquire() and the destructor calls release().
+ * You could delive your class from the baseclass UniRefBase wich implements
+ * the methods acquire and release, yet.
+ */
+template< class T > class UniReference
+{
+private:
+ T* mpElement;
+
+public:
+ /** Create an empty reference.*/
+ UniReference()
+ : mpElement( NULL )
+ {}
+
+ /** Destroy the reference and releases the element.*/
+ inline ~UniReference();
+
+ /** Create a new reference with the same element as in rRef and acquire this one.*/
+ inline UniReference( const UniReference< T > & rRef );
+
+ /**
+ * Create a new reference with the given element pElement and acquire this one.
+ */
+ inline UniReference( T * pElement );
+
+ /**
+ * Release the reference and set the new one pObj.
+ */
+ inline UniReference< T > & operator = ( T * pElement );
+
+ /**
+ * Release the reference and set the new one from rObj.
+ */
+ inline UniReference< T > & operator = ( const UniReference< T > & rRef );
+
+ /**
+ * Return the pointer to the element, may be null.
+ */
+ inline T* operator -> () const;
+
+ /**
+ * Returns true if the pointer to the element is valid.
+ */
+ inline sal_Bool is() const;
+
+ /**
+ * Return true if both elements refer to the same object.
+ */
+ inline sal_Bool operator == ( const UniReference & rRef ) const;
+
+ /**
+ * Return true if both elements does not refer to the same object.
+ */
+ inline sal_Bool operator != ( const UniReference & rRef ) const;
+
+ /** Gets implementation pointer.
+ This call does <b>not</b> acquire the implementation.
+ <br>
+ @return <b>un</b>acquired implementation pointer
+ */
+ inline T* get() const;
+};
+
+class XMLOFF_DLLPUBLIC UniRefBase
+{
+private:
+ /**
+ * The reference counter.
+ */
+ oslInterlockedCount m_refCount;
+
+public:
+ UniRefBase() : m_refCount( 0 )
+ {}
+ virtual ~UniRefBase();
+
+ void acquire() { osl_incrementInterlockedCount( &m_refCount ); }
+ void release();
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Inline-implementations of UniReference
+//
+
+/** Create a new reference with the same element as in rRef and acquire this one.*/
+template< class T >
+inline UniReference< T >::UniReference( const UniReference< T > & rRef )
+ : mpElement( rRef.mpElement )
+{
+ if( mpElement )
+ mpElement->acquire();
+}
+
+template< class T >
+inline UniReference< T >::~UniReference()
+{
+ if( mpElement )
+ mpElement->release();
+}
+
+/**
+ * Create a new reference with the given element pElement and acquire this one.
+ * @param pInterface the interface, pointer may be null.
+ */
+template< class T >
+inline UniReference< T >::UniReference( T * pElement )
+ : mpElement( pElement )
+{
+ if( mpElement )
+ mpElement->acquire();
+}
+
+/**
+ * Release the reference and set the new one pObj.<BR>
+ * <B>The operation is not thread save. You must protect all assigns to a reference class.</B>
+ */
+template< class T >
+inline UniReference< T > & UniReference< T >::operator = ( T * pElement )
+{
+ if( pElement )
+ pElement->acquire();
+ if( mpElement )
+ mpElement->release();
+
+ mpElement = pElement;
+
+ return *this;
+}
+
+/**
+ * Release the reference and set the new one from rObj.<BR>
+ * <B>The operation is not thread save. You must protect all assigns to a reference class.</B>
+ */
+template< class T >
+inline UniReference< T > & UniReference< T >::operator = ( const UniReference< T > & rRef )
+{
+ return operator = ( rRef.mpElement );
+}
+
+/**
+ * Return the pointer to the interface, may be null.
+ */
+template< class T >
+inline T* UniReference< T >::operator -> () const
+{
+ return get();
+}
+
+/**
+ * Return the pointer to the interface, may be null.
+ */
+template< class T >
+inline T* UniReference< T >::get () const
+{
+ return static_cast< T * >( mpElement );
+}
+
+/**
+ * Returns true if the pointer to the interface is valid.
+ */
+template< class T >
+inline sal_Bool UniReference< T >::is() const
+{
+ return (mpElement != 0);
+}
+/**
+ * Return true if both interfaces refer to the same object. The operation can be
+ * much more expensive than a pointer comparision.<BR>
+ *
+ * @param rRef another interface reference
+ */
+template< class T >
+inline sal_Bool UniReference< T >::operator == ( const UniReference & rRef ) const
+{
+ return ( mpElement == rRef.mpElement );
+}
+/**
+ * Return true if both interfaces does not refer to the same object. The operation can be
+ * much more expensive than a pointer comparision.<BR>
+ *
+ * @param rRef another interface reference
+ */
+template< class T >
+inline sal_Bool UniReference< T >::operator != ( const UniReference & rRef ) const
+{
+ return ( ! operator == ( rRef ) );
+}
+
+#endif // _UNIVERSALL_REFERENCE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/unoatrcn.hxx b/xmloff/inc/xmloff/unoatrcn.hxx
new file mode 100644
index 000000000000..a393b033ee10
--- /dev/null
+++ b/xmloff/inc/xmloff/unoatrcn.hxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 "sal/config.h"
+#include "xmloff/dllapi.h"
+#include "sal/types.h"
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+
+#include <cppuhelper/implbase3.hxx>
+
+extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SvUnoAttributeContainer_CreateInstance();
+
+class SvXMLAttrContainerData;
+
+class XMLOFF_DLLPUBLIC SvUnoAttributeContainer:
+ public ::cppu::WeakAggImplHelper3<
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::lang::XUnoTunnel,
+ ::com::sun::star::container::XNameContainer >
+{
+private:
+ SvXMLAttrContainerData* mpContainer;
+
+ SAL_DLLPRIVATE sal_uInt16 getIndexByName(const ::rtl::OUString& aName )
+ const;
+
+public:
+ SvUnoAttributeContainer( SvXMLAttrContainerData* pContainer = NULL );
+ virtual ~SvUnoAttributeContainer();
+
+ SvXMLAttrContainerData* GetContainerImpl() const { return mpContainer; }
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
+ static SvUnoAttributeContainer* getImplementation( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xInt ) throw();
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::container::XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL hasElements(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ // ::com::sun::star::container::XNameAccess
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName(const ::rtl::OUString& aName) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL hasByName(const ::rtl::OUString& aName) throw( ::com::sun::star::uno::RuntimeException );
+
+ // ::com::sun::star::container::XNameReplace
+ virtual void SAL_CALL replaceByName(const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+
+ // ::com::sun::star::container::XNameContainer
+ virtual void SAL_CALL insertByName(const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL removeByName(const ::rtl::OUString& Name) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+
+ // ::com::sun::star::lang::XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+
+ friend ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SvUnoAttributeContainer_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr ) throw( ::com::sun::star::uno::Exception );
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/xformsexport.hxx b/xmloff/inc/xmloff/xformsexport.hxx
new file mode 100644
index 000000000000..1c6b1c7122af
--- /dev/null
+++ b/xmloff/inc/xmloff/xformsexport.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XFORMSEXPORT_HXX
+#define _XMLOFF_XFORMSEXPORT_HXX
+
+#include "xmloff/dllapi.h"
+
+class SvXMLExport;
+namespace com { namespace sun { namespace star {
+ namespace uno { template<typename T> class Reference; }
+ namespace uno { template<typename T> class Sequence; }
+ namespace frame { class XModel; }
+ namespace beans { class XPropertySet; struct PropertyValue; }
+ namespace container { class XNameAccess; }
+} } }
+namespace rtl { class OUString; }
+
+
+/** export an XForms model. */
+void SAL_DLLPRIVATE exportXForms( SvXMLExport& );
+
+rtl::OUString SAL_DLLPRIVATE getXFormsBindName( const com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>& xBinding );
+
+rtl::OUString SAL_DLLPRIVATE getXFormsListBindName( const com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>& xBinding );
+
+rtl::OUString SAL_DLLPRIVATE getXFormsSubmissionName( const com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>& xBinding );
+
+
+/** returns the settings of the given XForms container, to be exported as document specific settings
+*/
+void XMLOFF_DLLPUBLIC getXFormsSettings(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rXForms,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _out_rSettings
+ );
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/xformsimport.hxx b/xmloff/inc/xmloff/xformsimport.hxx
new file mode 100644
index 000000000000..09136241706c
--- /dev/null
+++ b/xmloff/inc/xmloff/xformsimport.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XFORMSIMPORT_HXX
+#define _XMLOFF_XFORMSIMPORT_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+
+#include <tools/solar.h> // for sal_uInt16
+#include <com/sun/star/uno/Reference.hxx>
+
+class SvXMLImport;
+class SvXMLImportContext;
+namespace rtl { class OUString; }
+
+#if defined(WNT) && _MSC_VER < 1400
+namespace std { template<typename A, typename B> struct pair; }
+#endif
+
+namespace com { namespace sun { namespace star {
+ namespace uno { template<typename T> class Reference; }
+ namespace beans { class XPropertySet; struct PropertyValue; }
+ namespace frame { class XModel; }
+ namespace container { class XNameAccess; }
+} } }
+
+/** create import context for xforms:model element. */
+XMLOFF_DLLPUBLIC SvXMLImportContext* createXFormsModelContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName );
+
+/** perform the actual binding of an XForms-binding with the suitable control
+ * @param document which contains the XForms-model(s)
+ * @param pair<XForms binding ID, reference to control>
+ */
+void bindXFormsValueBinding(
+ com::sun::star::uno::Reference<com::sun::star::frame::XModel>,
+ std::pair<com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>,rtl::OUString> );
+
+
+/** perform the actual binding of an XForms-binding as list source with a list control
+ * @param document which contains the XForms-model(s)
+ * @param pair<XForms binding ID, reference to control>
+ */
+void bindXFormsListBinding(
+ com::sun::star::uno::Reference<com::sun::star::frame::XModel>,
+ std::pair<com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>,rtl::OUString> );
+
+/** perform the actual binding of an XForms submission with the suitable control
+ * @param document which contains the XForms-model(s)
+ * @param pair<XForms submission ID, reference to control>
+ */
+void bindXFormsSubmission(
+ com::sun::star::uno::Reference<com::sun::star::frame::XModel>,
+ std::pair<com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>,rtl::OUString> );
+
+/** applies the given settings to the given XForms container
+*/
+void XMLOFF_DLLPUBLIC applyXFormsSettings(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rXForms,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rSettings
+ );
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/xmlaustp.hxx b/xmloff/inc/xmloff/xmlaustp.hxx
new file mode 100644
index 000000000000..1eb26a766e90
--- /dev/null
+++ b/xmloff/inc/xmloff/xmlaustp.hxx
@@ -0,0 +1,140 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLASTPLP_HXX
+#define _XMLOFF_XMLASTPLP_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <xmloff/xmlprmap.hxx>
+#include <xmloff/uniref.hxx>
+
+class SvXMLExportPropertyMapper;
+class SvXMLNamespaceMap;
+class SvXMLAutoStylePoolP_Impl;
+class SvXMLAttributeList;
+class SvXMLExport;
+namespace com { namespace sun { namespace star { namespace uno
+ { template<typename A> class Sequence; }
+} } }
+
+class XMLOFF_DLLPUBLIC SvXMLAutoStylePoolP : public UniRefBase
+{
+ friend class SvXMLAutoStylePoolP_Impl;
+
+ SvXMLAutoStylePoolP_Impl *pImpl;
+
+protected:
+
+ virtual void exportStyleAttributes(
+ SvXMLAttributeList& rAttrList,
+ sal_Int32 nFamily,
+ const ::std::vector< XMLPropertyState >& rProperties,
+ const SvXMLExportPropertyMapper& rPropExp
+ , const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap
+ ) const;
+
+// this methode is executed after Properties Export, so you can e.g. export a map or so on
+ virtual void exportStyleContent(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
+ sal_Int32 nFamily,
+ const ::std::vector< XMLPropertyState >& rProperties,
+ const SvXMLExportPropertyMapper& rPropExp
+ , const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap
+ ) const;
+
+
+public:
+
+ SvXMLAutoStylePoolP( SvXMLExport& rExport);
+
+ SvXMLAutoStylePoolP();
+ virtual ~SvXMLAutoStylePoolP();
+
+ SvXMLExport& GetExport() const;
+
+ /** register a new family with its appropriate instance of a derivation of XMLPropertySetMapper
+ for family numbers see families.hxx
+ if bAsFamily is sal_False, the family name is used as element name
+ */
+ // TODO: Remove this ugly method as soon as possible
+ void AddFamily( sal_Int32 nFamily, const ::rtl::OUString& rStrName, SvXMLExportPropertyMapper* pMapper, ::rtl::OUString aStrPrefix, sal_Bool bAsFamily = sal_True );
+ void AddFamily( sal_Int32 nFamily, const ::rtl::OUString& rStrName,
+ const UniReference< SvXMLExportPropertyMapper >& rMapper,
+ const ::rtl::OUString& rStrPrefix, sal_Bool bAsFamily = sal_True );
+
+ /// Register a name that must not be used as a generated name.
+ void RegisterName( sal_Int32 nFamily, const ::rtl::OUString& rName );
+
+ /// retrieve the registered names (names + families)
+ void GetRegisteredNames(
+ com::sun::star::uno::Sequence<sal_Int32>& aFamilies,
+ com::sun::star::uno::Sequence<rtl::OUString>& aNames );
+
+ /// register (families + names)
+ void RegisterNames(
+ com::sun::star::uno::Sequence<sal_Int32>& aFamilies,
+ com::sun::star::uno::Sequence<rtl::OUString>& aNames );
+
+ /// Add an item set to the pool and return its generated name.
+ ::rtl::OUString Add( sal_Int32 nFamily, const ::std::vector< XMLPropertyState >& rProperties );
+ ::rtl::OUString Add( sal_Int32 nFamily, const ::rtl::OUString& rParent, const ::std::vector< XMLPropertyState >& rProperties, bool bDontSeek = false );
+ sal_Bool Add( ::rtl::OUString& rName, sal_Int32 nFamily, const ::std::vector< XMLPropertyState >& rProperties );
+ sal_Bool Add( ::rtl::OUString& rName, sal_Int32 nFamily, const ::rtl::OUString& rParent, const ::std::vector< XMLPropertyState >& rProperties );
+
+ /// Add an item set with a pre-defined name (needed for saving sheets separately in Calc).
+ sal_Bool AddNamed( const ::rtl::OUString& rName, sal_Int32 nFamily, const ::rtl::OUString& rParent,
+ const ::std::vector< XMLPropertyState >& rProperties );
+
+ /// Find an item set's name.
+ ::rtl::OUString Find( sal_Int32 nFamily, const ::std::vector< XMLPropertyState >& rProperties ) const;
+ ::rtl::OUString Find( sal_Int32 nFamily, const ::rtl::OUString& rParent, const ::std::vector< XMLPropertyState >& rProperties ) const;
+
+ // Add a property set to the pool and cache its name.
+ ::rtl::OUString AddAndCache( sal_Int32 nFamily, const ::std::vector< XMLPropertyState >& rProperties );
+ ::rtl::OUString AddAndCache( sal_Int32 nFamily, const ::rtl::OUString& rParent, const ::std::vector< XMLPropertyState >& rProperties );
+ ::rtl::OUString AddAndCache( sal_Int32 nFamily, const ::rtl::OUString& rParent );
+
+ ::rtl::OUString FindAndRemoveCached( sal_Int32 nFamily ) const;
+
+ /** Export all item sets ofs a certain class in the order in that they have been added. */
+ void exportXML( sal_Int32 nFamily
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap
+ ) const;
+
+ void ClearEntries();
+};
+
+#endif // _XMLOFF_XMLASTPLP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/xmlcnimp.hxx b/xmloff/inc/xmloff/xmlcnimp.hxx
new file mode 100644
index 000000000000..013dfb874733
--- /dev/null
+++ b/xmloff/inc/xmloff/xmlcnimp.hxx
@@ -0,0 +1,131 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLCNIMP_HXX
+#define _XMLOFF_XMLCNIMP_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include "sal/types.h"
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <svl/svarray.hxx>
+#include <xmloff/nmspmap.hxx>
+
+#define _SVSTDARR_USHORTS
+#include <svl/svstdarr.hxx>
+
+namespace rtl { class OUString; }
+
+class SvXMLAttrContainerData_Impl;
+
+class XMLOFF_DLLPUBLIC SvXMLAttrContainerData
+{
+ SvXMLNamespaceMap aNamespaceMap;
+ SvUShorts aPrefixPoss;
+ SvXMLAttrContainerData_Impl *pLNames;
+ SvXMLAttrContainerData_Impl *pValues;
+
+ SAL_DLLPRIVATE inline sal_uInt16 GetPrefixPos( sal_uInt16 i ) const;
+public:
+
+ SvXMLAttrContainerData( const SvXMLAttrContainerData& rImpl );
+ SvXMLAttrContainerData();
+ ~SvXMLAttrContainerData();
+
+ int operator ==( const SvXMLAttrContainerData& rCmp ) const;
+
+ sal_Bool AddAttr( const ::rtl::OUString& rLName, const rtl::OUString& rValue );
+ sal_Bool AddAttr( const ::rtl::OUString& rPrefix, const rtl::OUString& rNamespace,
+ const ::rtl::OUString& rLName, const rtl::OUString& rValue );
+ sal_Bool AddAttr( const ::rtl::OUString& rPrefix,
+ const ::rtl::OUString& rLName,
+ const ::rtl::OUString& rValue );
+
+ sal_uInt16 GetAttrCount() const;
+ inline ::rtl::OUString GetAttrNamespace( sal_uInt16 i ) const;
+ inline ::rtl::OUString GetAttrPrefix( sal_uInt16 i ) const;
+ const ::rtl::OUString& GetAttrLName( sal_uInt16 i ) const;
+ const ::rtl::OUString& GetAttrValue( sal_uInt16 i ) const;
+
+ sal_uInt16 GetFirstNamespaceIndex() const { return aNamespaceMap.GetFirstIndex(); }
+ sal_uInt16 GetNextNamespaceIndex( sal_uInt16 nIdx ) const { return aNamespaceMap.GetNextIndex( nIdx ); }
+ inline const ::rtl::OUString& GetNamespace( sal_uInt16 i ) const;
+ inline const ::rtl::OUString& GetPrefix( sal_uInt16 i ) const;
+
+ sal_Bool SetAt( sal_uInt16 i,
+ const ::rtl::OUString& rLName, const rtl::OUString& rValue );
+ sal_Bool SetAt( sal_uInt16 i,
+ const ::rtl::OUString& rPrefix, const rtl::OUString& rNamespace,
+ const ::rtl::OUString& rLName, const rtl::OUString& rValue );
+ sal_Bool SetAt( sal_uInt16 i,
+ const ::rtl::OUString& rPrefix,
+ const ::rtl::OUString& rLName,
+ const ::rtl::OUString& rValue );
+
+ void Remove( sal_uInt16 i );
+};
+
+inline sal_uInt16 SvXMLAttrContainerData::GetPrefixPos( sal_uInt16 i ) const
+{
+// DBG_ASSERT( i >= 0 && i < aPrefixPoss.Count(),
+// "SvXMLAttrContainerData::GetPrefixPos: illegal index" );
+ return aPrefixPoss[i];
+}
+
+inline ::rtl::OUString SvXMLAttrContainerData::GetAttrNamespace( sal_uInt16 i ) const
+{
+ ::rtl::OUString sRet;
+ sal_uInt16 nPos = GetPrefixPos( i );
+ if( USHRT_MAX != nPos )
+ sRet = aNamespaceMap.GetNameByIndex( nPos );
+ return sRet;
+}
+
+inline ::rtl::OUString SvXMLAttrContainerData::GetAttrPrefix( sal_uInt16 i ) const
+{
+ ::rtl::OUString sRet;
+ sal_uInt16 nPos = GetPrefixPos( i );
+ if( USHRT_MAX != nPos )
+ sRet = aNamespaceMap.GetPrefixByIndex( nPos );
+ return sRet;
+}
+
+inline const ::rtl::OUString& SvXMLAttrContainerData::GetNamespace(
+ sal_uInt16 i ) const
+{
+ return aNamespaceMap.GetNameByIndex( i );
+}
+
+inline const ::rtl::OUString& SvXMLAttrContainerData::GetPrefix( sal_uInt16 i ) const
+{
+ return aNamespaceMap.GetPrefixByIndex( i );
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/xmlcnitm.hxx b/xmloff/inc/xmloff/xmlcnitm.hxx
new file mode 100644
index 000000000000..9f65282816c0
--- /dev/null
+++ b/xmloff/inc/xmloff/xmlcnitm.hxx
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLCNITM_HXX
+#define _XMLOFF_XMLCNITM_HXX
+
+#include <svl/poolitem.hxx>
+
+class SvXMLNamespaceMap;
+namespace rtl { class OUString; }
+
+//============================================================================
+
+class SvXMLAttrContainerItem_Impl;
+
+class SvXMLAttrContainerItem: public SfxPoolItem
+{
+ SvXMLAttrContainerItem_Impl *pImpl;
+
+public:
+ TYPEINFO();
+
+ SvXMLAttrContainerItem( sal_uInt16 nWhich = 0 );
+ SvXMLAttrContainerItem( const SvXMLAttrContainerItem& );
+ virtual ~SvXMLAttrContainerItem();
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ using SfxPoolItem::Compare;
+ virtual int Compare( const SfxPoolItem &rWith ) const;
+
+ virtual SfxItemPresentation GetPresentation(
+ SfxItemPresentation ePresentation,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresentationMetric,
+ XubString &rText,
+ const IntlWrapper *pIntlWrapper = 0 ) const;
+
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxPoolItem *Clone( SfxItemPool * = 0) const
+ { return new SvXMLAttrContainerItem( *this ); }
+
+ sal_Bool AddAttr( const ::rtl::OUString& rLName,
+ const ::rtl::OUString& rValue );
+ sal_Bool AddAttr( const ::rtl::OUString& rPrefix,
+ const ::rtl::OUString& rNamespace,
+ const ::rtl::OUString& rLName,
+ const ::rtl::OUString& rValue );
+
+ sal_uInt16 GetAttrCount() const;
+ ::rtl::OUString GetAttrNamespace( sal_uInt16 i ) const;
+ ::rtl::OUString GetAttrPrefix( sal_uInt16 i ) const;
+ const ::rtl::OUString& GetAttrLName( sal_uInt16 i ) const;
+ const ::rtl::OUString& GetAttrValue( sal_uInt16 i ) const;
+
+ sal_uInt16 GetFirstNamespaceIndex() const;
+ sal_uInt16 GetNextNamespaceIndex( sal_uInt16 nIdx ) const;
+ const ::rtl::OUString& GetNamespace( sal_uInt16 i ) const;
+ const ::rtl::OUString& GetPrefix( sal_uInt16 i ) const;
+};
+
+#endif // _XMLOFF_XMLCNITM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/xmlement.hxx b/xmloff/inc/xmloff/xmlement.hxx
new file mode 100644
index 000000000000..58845603963e
--- /dev/null
+++ b/xmloff/inc/xmloff/xmlement.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLEMENT_HXX
+#define _XMLOFF_XMLEMENT_HXX
+
+#include <sal/types.h>
+#include <xmloff/xmltoken.hxx>
+
+/** Map an XMLTokenEnum to a sal_uInt16 value.
+ * To be used with SvXMLUnitConverter::convertEnum(...)
+ */
+struct SvXMLEnumMapEntry
+{
+ ::xmloff::token::XMLTokenEnum eToken;
+ sal_uInt16 nValue;
+};
+
+#define ENUM_STRING_MAP_ENTRY(name,tok) { name, sizeof(name)-1, tok }
+
+#define ENUM_STRING_MAP_END() { NULL, 0, 0 }
+
+/** Map a const sal_Char* (with length) to a sal_uInt16 value.
+ * To be used with SvXMLUnitConverter::convertEnum(...)
+ */
+struct SvXMLEnumStringMapEntry
+{
+ const sal_Char * pName;
+ sal_Int32 nNameLength;
+ sal_uInt16 nValue;
+};
+
+#endif // _XMLOFF_XMLEMENT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/xmlerror.hxx b/xmloff/inc/xmloff/xmlerror.hxx
new file mode 100644
index 000000000000..46595f6737a8
--- /dev/null
+++ b/xmloff/inc/xmloff/xmlerror.hxx
@@ -0,0 +1,169 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLERROR_HXX
+#define _XMLOFF_XMLERROR_HXX
+
+#include <com/sun/star/xml/sax/SAXParseException.hpp>
+#include <sal/types.h>
+
+// STL includes
+#include <vector>
+
+
+
+// masks for the error ID fields
+#define XMLERROR_MASK_FLAG 0xF0000000
+#define XMLERROR_MASK_CLASS 0x00FF0000
+#define XMLERROR_MASK_NUMBER 0x0000FFFF
+
+// error flags:
+#define XMLERROR_FLAG_WARNING 0x10000000
+#define XMLERROR_FLAG_ERROR 0x20000000
+#define XMLERROR_FLAG_SEVERE 0x40000000
+
+// error classes: Error ID
+#define XMLERROR_CLASS_IO 0x00010000
+#define XMLERROR_CLASS_FORMAT 0x00020000
+#define XMLERROR_CLASS_API 0x00040000
+#define XMLERROR_CLASS_OTHER 0x00080000
+
+
+// error numbers, listed by error class
+// Within each class, errors should be numbered consecutively. Please
+// allways add to error code below the appropriate comment.
+
+// I/O errors:
+
+// format errors:
+#define XMLERROR_SAX ( XMLERROR_CLASS_FORMAT | 0x00000001 )
+#define XMLERROR_STYLE_ATTR_VALUE ( XMLERROR_CLASS_FORMAT | 0x00000002 )
+#define XMLERROR_NO_INDEX_ALLOWED_HERE ( XMLERROR_CLASS_FORMAT | 0x00000003 )
+#define XMLERROR_PARENT_STYLE_NOT_ALLOWED ( XMLERROR_CLASS_FORMAT | 0x00000004 )
+#define XMLERROR_ILLEGAL_EVENT (XMLERROR_CLASS_FORMAT | 0x00000005 )
+#define XMLERROR_NAMESPACE_TROUBLE (XMLERROR_CLASS_FORMAT | 0x00000006 )
+
+#define XMLERROR_XFORMS_NO_SCHEMA_SUPPORT ( XMLERROR_CLASS_FORMAT | XMLERROR_FLAG_WARNING | 0x00000007 )
+#define XMLERROR_XFORMS_UNKNOWN ( XMLERROR_CLASS_FORMAT | XMLERROR_FLAG_WARNING | 0x00000008 )
+#define XMLERROR_XFORMS_ONLY_ONE_INSTANCE_ELEMENT ( XMLERROR_CLASS_FORMAT | XMLERROR_FLAG_WARNING | 0x00000009 )
+#define XMLERROR_UNKNOWN_ATTRIBUTE ( XMLERROR_CLASS_FORMAT | XMLERROR_FLAG_WARNING | 0x0000000a )
+#define XMLERROR_UNKNOWN_ELEMENT ( XMLERROR_CLASS_FORMAT | XMLERROR_FLAG_WARNING | 0x0000000b )
+#define XMLERROR_UNKNOWN_CHARACTERS ( XMLERROR_CLASS_FORMAT | XMLERROR_FLAG_WARNING | 0x0000000c )
+#define XMLERROR_UNKNWON_ROOT (XMLERROR_CLASS_FORMAT | 0x0000000d )
+
+// API errors:
+#define XMLERROR_STYLE_PROP_VALUE ( XMLERROR_CLASS_API | 0x00000001 )
+#define XMLERROR_STYLE_PROP_UNKNOWN ( XMLERROR_CLASS_API | 0x00000002 )
+#define XMLERROR_STYLE_PROP_OTHER ( XMLERROR_CLASS_API | 0x00000003 )
+#define XMLERROR_API ( XMLERROR_CLASS_API | 0x00000004 )
+
+// other errors:
+#define XMLERROR_CANCEL ( XMLERROR_CLASS_OTHER | 0x00000001 )
+
+
+
+// 16bit error flag constants for use in the
+// SvXMLExport/SvXMLImport error flags
+#define ERROR_NO 0x0000
+#define ERROR_DO_NOTHING 0x0001
+#define ERROR_ERROR_OCCURRED 0x0002
+#define ERROR_WARNING_OCCURRED 0x0004
+
+
+
+
+// forward declarations
+namespace rtl { class OUString; }
+namespace com { namespace sun { namespace star {
+ namespace uno { template<class X> class Sequence; }
+ namespace uno { template<class X> class Reference; }
+ namespace xml { namespace sax { class XLocator; } }
+} } }
+class ErrorRecord;
+
+
+
+/**
+ * The XMLErrors is used to collect all errors and warnings that occur
+ * for appropriate processing.
+ */
+class XMLErrors
+{
+ /// definition of type for error list
+ typedef ::std::vector<ErrorRecord> ErrorList;
+
+ ErrorList aErrors; /// list of error records
+
+public:
+
+ XMLErrors();
+ ~XMLErrors();
+
+ /// add a new entry to the list of error messages
+ void AddRecord(
+ sal_Int32 nId, /// error ID == error flags + error class + error number
+ const ::com::sun::star::uno::Sequence<
+ ::rtl::OUString> & rParams, /// parameters for error message
+ const ::rtl::OUString& rExceptionMessage, /// original exception string
+ sal_Int32 nRow, /// XLocator: file row number
+ sal_Int32 nColumn, /// XLocator: file column number
+ const ::rtl::OUString& rPublicId, /// XLocator: file public ID
+ const ::rtl::OUString& rSystemId ); /// XLocator: file system ID
+
+ void AddRecord(
+ sal_Int32 nId, /// error ID == error flags + error class + error number
+ const ::com::sun::star::uno::Sequence<
+ ::rtl::OUString> & rParams, /// parameters for error message
+ const ::rtl::OUString& rExceptionMessage, /// original exception string
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XLocator> & rLocator); /// location
+
+ void AddRecord(
+ sal_Int32 nId, /// error ID == error flags + error class + error number
+ const ::com::sun::star::uno::Sequence<
+ ::rtl::OUString> & rParams, /// parameters for error message
+ const ::rtl::OUString& rExceptionMessage); /// original exception string
+
+ void AddRecord(
+ sal_Int32 nId, /// error ID == error flags + error class + error number
+ const ::com::sun::star::uno::Sequence<
+ ::rtl::OUString> & rParams); /// parameters for error message
+
+
+ /**
+ * throw a SAXParseException that describes the first error that matches
+ * the given mask
+ */
+ void ThrowErrorAsSAXException( sal_Int32 nIdMask )
+ throw( ::com::sun::star::xml::sax::SAXParseException );
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/xmlevent.hxx b/xmloff/inc/xmloff/xmlevent.hxx
new file mode 100644
index 000000000000..2b240d350c35
--- /dev/null
+++ b/xmloff/inc/xmloff/xmlevent.hxx
@@ -0,0 +1,155 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLEVENT_HXX
+#define _XMLOFF_XMLEVENT_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+
+
+/**
+ * @#file
+ *
+ * Several definition used in im- and export of events
+ */
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+ namespace beans { struct PropertyValue; }
+} } }
+namespace rtl { class OUString; }
+
+class SvXMLExport;
+class SvXMLImportContext;
+class SvXMLImport;
+class XMLEventsImportContext;
+
+
+struct XMLEventName
+{
+ sal_uInt16 m_nPrefix;
+ ::rtl::OUString m_aName;
+
+ XMLEventName() : m_nPrefix( 0 ) {}
+ XMLEventName( sal_uInt16 n, const sal_Char *p ) :
+ m_nPrefix( n ),
+ m_aName( ::rtl::OUString::createFromAscii(p) )
+ {}
+
+ XMLEventName( sal_uInt16 n, const ::rtl::OUString& r ) :
+ m_nPrefix( n ),
+ m_aName( r )
+ {}
+
+ bool operator<( const XMLEventName& r ) const
+ {
+ return m_nPrefix < r.m_nPrefix ||
+ (m_nPrefix == r.m_nPrefix && m_aName < r.m_aName );
+ }
+
+};
+
+/**
+ * XMLEventNameTranslation: define tables that translate between event names
+ * as used in the XML file format and in the StarOffice API.
+ * The last entry in the table must be { NULL, 0, NULL }.
+ */
+struct XMLEventNameTranslation
+{
+ const sal_Char* sAPIName;
+ sal_uInt16 nPrefix; // namespace prefix
+ const sal_Char* sXMLName;
+};
+
+/// a translation table for the events defined in the XEventsSupplier service
+/// (implemented in XMLEventExport.cxx)
+extern const XMLEventNameTranslation aStandardEventTable[];
+
+
+/**
+ * Handle export of an event for a certain event type (event type as
+ * defined by the PropertyValue "EventType" in API).
+ *
+ * The Handler has to generate the full <script:event> element.
+ */
+class XMLEventExportHandler
+{
+public:
+ virtual ~XMLEventExportHandler() {};
+
+ virtual void Export(
+ SvXMLExport& rExport, /// the current XML export
+ const ::rtl::OUString& rEventQName, /// the XML name of the event
+ ::com::sun::star::uno::Sequence< /// the values for the event
+ ::com::sun::star::beans::PropertyValue> & rValues,
+ sal_Bool bUseWhitespace) = 0; /// create whitespace around elements?
+};
+
+
+/**
+ * Handle import of an event for a certain event type (as defined by
+ * the PropertyValue "EventType" in the API).
+ *
+ * EventContextFactories must be registered with the EventImportHelper
+ * that is attached to the SvXMLImport.
+ *
+ * The factory has to create an import context for a <script:event>
+ * element. The context has to call the
+ * EventsImportContext::AddEventValues() method to fave its event
+ * registered with the enclosing element. For events consisting only
+ * of attributes (and an empty element) an easy solution is to handle
+ * all attributes in the CreateContext()-method and return a default
+ * context.
+ *
+ * EventContextFactory objects have to be registered with the
+ * EventsImportHelper.
+ */
+class XMLEventContextFactory
+{
+public:
+ virtual ~XMLEventContextFactory() {};
+
+ virtual SvXMLImportContext* CreateContext(
+ SvXMLImport& rImport, /// import context
+ sal_uInt16 nPrefix, /// element: namespace prefix
+ const ::rtl::OUString& rLocalName, /// element: local name
+ const ::com::sun::star::uno::Reference< /// attribute list
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList,
+ /// the context for the enclosing <script:events> element
+ XMLEventsImportContext* rEvents,
+ /// the event name (as understood by the API)
+ const ::rtl::OUString& rApiEventName,
+ /// the event type name (as registered)
+ const ::rtl::OUString& rApiLanguage) = 0;
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/xmlexp.hxx b/xmloff/inc/xmloff/xmlexp.hxx
new file mode 100644
index 000000000000..153065f9b970
--- /dev/null
+++ b/xmloff/inc/xmloff/xmlexp.hxx
@@ -0,0 +1,725 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLEXP_HXX
+#define _XMLOFF_XMLEXP_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include "sal/types.h"
+
+#include <com/sun/star/embed/XStorage.hpp>
+#include <com/sun/star/xml/sax/SAXParseException.hpp>
+#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/SAXException.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/xml/sax/XLocator.hpp>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <rtl/ustring.hxx>
+#include <tools/mapunit.hxx>
+#include <xmloff/txtparae.hxx>
+#include <xmloff/formlayerexport.hxx>
+#include <xmloff/xmlnumfe.hxx>
+#include <xmloff/xmlaustp.hxx>
+#include <xmloff/shapeexport.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/SchXMLExportHelper.hxx>
+#include <xmloff/XMLFontAutoStylePool.hxx>
+#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/document/XExporter.hpp>
+#include <com/sun/star/document/XGraphicObjectResolver.hpp>
+#include <com/sun/star/document/XEmbeddedObjectResolver.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+
+#include <unotools/saveopt.hxx>
+
+#include <xmloff/XMLPageExport.hxx>
+#include <xmloff/ProgressBarHelper.hxx>
+#include <cppuhelper/implbase6.hxx>
+
+#include <list>
+
+class SvXMLNamespaceMap;
+class SvXMLAttributeList;
+class SvXMLExport_Impl;
+class SvXMLUnitConverter;
+class ProgressBarHelper;
+class XMLEventExport;
+class XMLSettingsExportHelper;
+class XMLImageMapExport;
+class XMLErrors;
+
+// Shapes in Writer cannot be named via context menu (#i51726#)
+#include <unotools/moduleoptions.hxx>
+
+namespace rtl { class OUString; }
+namespace com { namespace sun { namespace star {
+ namespace uno { class XComponentContext; }
+ namespace frame { class XModel; }
+ namespace container { class XIndexContainer; }
+} } }
+namespace comphelper { class UnoInterfaceToUniqueIdentifierMapper; }
+
+#define EXPORT_META 0x0001
+#define EXPORT_STYLES 0x0002
+#define EXPORT_MASTERSTYLES 0x0004
+#define EXPORT_AUTOSTYLES 0x0008
+#define EXPORT_CONTENT 0x0010
+#define EXPORT_SCRIPTS 0x0020
+#define EXPORT_SETTINGS 0x0040
+#define EXPORT_FONTDECLS 0x0080
+#define EXPORT_EMBEDDED 0x0100
+#define EXPORT_NODOCTYPE 0x0200
+#define EXPORT_PRETTY 0x0400
+#define EXPORT_SAVEBACKWARDCOMPATIBLE 0x0800
+#define EXPORT_OASIS 0x8000
+#define EXPORT_ALL 0x7fff
+
+class XMLOFF_DLLPUBLIC SvXMLExport : public ::cppu::WeakImplHelper6<
+ ::com::sun::star::document::XFilter,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::document::XExporter,
+ ::com::sun::star::lang::XInitialization,
+ ::com::sun::star::container::XNamed,
+ ::com::sun::star::lang::XUnoTunnel>
+{
+ SvXMLExport_Impl *mpImpl; // dummy
+
+ // #110680#
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxServiceFactory;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxModel;
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > mxHandler; // the handlers
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XExtendedDocumentHandler > mxExtHandler;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > mxNumberFormatsSupplier;
+ ::com::sun::star::uno::Reference< ::com::sun::star::document::XGraphicObjectResolver > mxGraphicResolver;
+ ::com::sun::star::uno::Reference< ::com::sun::star::document::XEmbeddedObjectResolver > mxEmbeddedResolver;
+ ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > mxStatusIndicator;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxExportInfo;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > mxEventListener;
+
+ SvXMLAttributeList *mpAttrList; // a common attribute list
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > mxAttrList; // and an interface of it
+
+ ::rtl::OUString msOrigFileName; // the original URL
+ ::rtl::OUString msPicturesPath;
+ ::rtl::OUString msGraphicObjectProtocol;
+ ::rtl::OUString msEmbeddedObjectProtocol;
+ ::rtl::OUString msObjectsPath;
+ ::rtl::OUString msFilterName;
+ SvXMLNamespaceMap *mpNamespaceMap; // the namepspace map
+ SvXMLUnitConverter *mpUnitConv; // the unit converter
+ SvXMLNumFmtExport *mpNumExport;
+ ProgressBarHelper *mpProgressBarHelper;
+
+ UniReference< XMLTextParagraphExport > mxTextParagraphExport;
+ UniReference< XMLShapeExport > mxShapeExport;
+ UniReference< SvXMLAutoStylePoolP > mxAutoStylePool;
+ UniReference< SchXMLExportHelper > mxChartExport;
+ UniReference< XMLPageExport > mxPageExport;
+ UniReference< XMLFontAutoStylePool > mxFontAutoStylePool;
+ UniReference< xmloff::OFormLayerXMLExport > mxFormExport;
+ XMLEventExport* mpEventExport;
+ XMLImageMapExport* mpImageMapExport;
+ XMLErrors* mpXMLErrors;
+
+ sal_Bool mbExtended; // Does document contain extens.
+
+ const enum ::xmloff::token::XMLTokenEnum meClass;
+ SAL_DLLPRIVATE void _InitCtor();
+
+ sal_uInt16 mnExportFlags;
+ sal_uInt16 mnErrorFlags;
+ bool mbEnableExperimentalOdfExport;
+
+public:
+
+ const ::rtl::OUString msWS; // " "
+
+private:
+
+ // Shapes in Writer cannot be named via context menu (#i51726#)
+ SvtModuleOptions::EFactory meModelType;
+ SAL_DLLPRIVATE void _DetermineModelType();
+
+ SAL_DLLPRIVATE void ImplExportMeta(); // <office:meta>
+ SAL_DLLPRIVATE void ImplExportSettings(); // <office:settings>
+ SAL_DLLPRIVATE void ImplExportStyles( sal_Bool bUsed ); // <office:styles>
+ SAL_DLLPRIVATE void ImplExportAutoStyles( sal_Bool bUsed );
+ // <office:automatic-styles>
+ SAL_DLLPRIVATE void ImplExportMasterStyles( sal_Bool bUsed );
+ // <office:master-styles>
+ SAL_DLLPRIVATE void ImplExportContent(); // <office:body>
+ virtual void SetBodyAttributes();
+ void GetViewSettingsAndViews(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& rProps);
+
+protected:
+ void setExportFlags( sal_uInt16 nExportFlags ) { mnExportFlags = nExportFlags; }
+
+ // Get (modifyable) namespace map
+ SvXMLNamespaceMap& _GetNamespaceMap() { return *mpNamespaceMap; }
+
+ // get a new namespave map (used in starmath to have a default namespace)
+ void ResetNamespaceMap();
+
+ // This method can be overloaded to export the content of <office:meta>.
+ // There is a default implementation.
+ virtual void _ExportMeta();
+
+ // This method can be overloaded to export the content of <office:scripts>.
+ // There is a default implementation.
+ virtual void _ExportScripts();
+
+ // This method can be overloaded to export the font declarations
+ // The default implementation will export the contents of the
+ // XMLFontAutoStylePool if it has been created.
+ virtual void _ExportFontDecls();
+
+ // This method should be overloaded to export the content of <style:styles>.
+ // If bUsed is set, used styles should be exported only.
+ // Overloaded Methods must call this method !
+ virtual void _ExportStyles( sal_Bool bUsed ) ;
+
+ // This method must be overloaded to export the contents of
+ // <style:auto-styles>
+ virtual void _ExportAutoStyles() = 0;
+
+ // This method must be overloaded to export the contents of
+ // <style:master-styles>
+ virtual void _ExportMasterStyles() = 0;
+
+ // This method must be overloaded to export the content of <office:body>.
+ virtual void _ExportContent() = 0;
+
+ void SetExtended( sal_Bool bSet=sal_True ) { mbExtended = bSet; }
+
+ // save linked sections? (may be false in global documents)
+ sal_Bool mbSaveLinkedSections;
+
+ virtual XMLTextParagraphExport* CreateTextParagraphExport();
+ virtual XMLShapeExport* CreateShapeExport();
+ virtual SvXMLAutoStylePoolP* CreateAutoStylePool();
+ virtual SchXMLExportHelper* CreateChartExport();
+ virtual XMLPageExport* CreatePageExport();
+ virtual XMLFontAutoStylePool* CreateFontAutoStylePool();
+ virtual xmloff::OFormLayerXMLExport* CreateFormExport();
+ virtual void GetViewSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps);
+ virtual void GetConfigurationSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps);
+
+ struct SettingsGroup
+ {
+ ::xmloff::token::XMLTokenEnum eGroupName;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aSettings;
+
+ SettingsGroup()
+ :eGroupName( ::xmloff::token::XML_TOKEN_INVALID )
+ ,aSettings()
+ {
+ }
+
+ SettingsGroup(
+ const ::xmloff::token::XMLTokenEnum _eGroupName,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rSettings )
+ :eGroupName( _eGroupName )
+ ,aSettings( _rSettings )
+ {
+ }
+ };
+ /** returns the current document settings
+
+ The default implementation will obtain the view settings by calling GetViewSettingsAndViews, and the
+ configuration settings by calling GetConfigurationSettings, and return them together with the proper XML token.
+
+ @return
+ the accumulated count of all settings in all groups
+ */
+ virtual sal_Int32 GetDocumentSpecificSettings( ::std::list< SettingsGroup >& _out_rSettings );
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::document::XEmbeddedObjectResolver >& GetEmbeddedResolver() const { return mxEmbeddedResolver; }
+ inline void SetEmbeddedResolver( com::sun::star::uno::Reference< com::sun::star::document::XEmbeddedObjectResolver >& _xEmbeddedResolver );
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::document::XGraphicObjectResolver >& GetGraphicResolver() const { return mxGraphicResolver; }
+ void SetGraphicResolver( com::sun::star::uno::Reference< com::sun::star::document::XGraphicObjectResolver >& _xGraphicResolver );
+
+ void SetDocHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > &rHandler );
+
+public:
+
+ // #110680#
+ //SvXMLExport( MapUnit eDfltUnit,
+ // const enum ::xmloff::token::XMLTokenEnum eClass = xmloff::token::XML_TOKEN_INVALID,
+ // sal_uInt16 nExportFlag = EXPORT_ALL );
+ SvXMLExport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ MapUnit eDfltUnit,
+ const enum ::xmloff::token::XMLTokenEnum eClass = xmloff::token::XML_TOKEN_INVALID,
+ sal_uInt16 nExportFlag = EXPORT_ALL );
+
+ // #110680#
+ //SvXMLExport( const ::rtl::OUString& rFileName,
+ // const ::com::sun::star::uno::Reference<
+ // ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
+ // MapUnit eDfltUnit = MAP_INCH );
+ SvXMLExport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ const ::rtl::OUString& rFileName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
+ MapUnit eDfltUnit = MAP_INCH );
+
+ // #110680#
+ //SvXMLExport( const ::rtl::OUString& rFileName,
+ // const ::com::sun::star::uno::Reference<
+ // ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
+ // const ::com::sun::star::uno::Reference<
+ // ::com::sun::star::frame::XModel > &,
+ // sal_Int16 eDfltUnit );
+ SvXMLExport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ const ::rtl::OUString& rFileName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > &,
+ sal_Int16 eDfltUnit );
+
+ // #110680#
+ //SvXMLExport( const ::rtl::OUString& rFileName,
+ // const ::com::sun::star::uno::Reference<
+ // ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
+ // const ::com::sun::star::uno::Reference<
+ // ::com::sun::star::frame::XModel > &,
+ // const ::com::sun::star::uno::Reference<
+ // ::com::sun::star::document::XGraphicObjectResolver > &,
+ // sal_Int16 eDfltUnit );
+ SvXMLExport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ const ::rtl::OUString& rFileName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > &,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::document::XGraphicObjectResolver > &,
+ sal_Int16 eDfltUnit );
+
+ virtual ~SvXMLExport();
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
+ static SvXMLExport* getImplementation( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > ) throw();
+
+ // XExporter
+ virtual void SAL_CALL setSourceDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ // XFilter
+ virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL cancel() throw(::com::sun::star::uno::RuntimeException);
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ // XNamed
+ virtual ::rtl::OUString SAL_CALL getName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ /** ensures that the given namespace is in scope at the next started
+ element.
+
+ <p>If the namespace is not yet declared, the necessary attribute will
+ be added, as well.</p>
+
+ @param i_rNamespace the namespace to be declared
+ @param i_rPreferredPrefix (opt.) preferred prefix for the namespace
+
+ @returns the actual prefix that the namespace is associated with
+ */
+ ::rtl::OUString
+ EnsureNamespace(::rtl::OUString const & i_rNamespace,
+ ::rtl::OUString const & i_rPreferredPrefix
+ = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("gen")) );
+
+ // Check if common attribute list is empty.
+#ifndef DBG_UTIL
+ void CheckAttrList() {}
+#else
+ void CheckAttrList();
+#endif
+
+ // Clear common attribute list.
+ void ClearAttrList();
+
+ // Add an attribute to the common attribute list.
+ void AddAttributeASCII( sal_uInt16 nPrefix, const sal_Char *pName,
+ const sal_Char *pValue );
+ void AddAttribute( sal_uInt16 nPrefix, const sal_Char *pName,
+ const ::rtl::OUString& rValue );
+ void AddAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rName,
+ const ::rtl::OUString& rValue );
+ void AddAttribute( sal_uInt16 nPrefix,
+ enum ::xmloff::token::XMLTokenEnum eName,
+ const ::rtl::OUString& rValue );
+ void AddAttribute( sal_uInt16 nPrefix,
+ enum ::xmloff::token::XMLTokenEnum eName,
+ enum ::xmloff::token::XMLTokenEnum eValue );
+ void AddAttribute( const ::rtl::OUString& rQName,
+ const ::rtl::OUString& rValue );
+ void AddAttribute( const ::rtl::OUString& rQName,
+ enum ::xmloff::token::XMLTokenEnum eValue );
+ // add several attributes to the common attribute list
+ void AddAttributeList( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ // Get common attribute list as implementation or interface.
+ SvXMLAttributeList &GetAttrList() { return *mpAttrList; }
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & GetXAttrList() { return mxAttrList; }
+
+ // Get document handler. This methods are not const, because the
+ // reference allowes modifications through the handler.
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & GetDocHandler() { return mxHandler; }
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XExtendedDocumentHandler > & GetExtDocHandler()
+ {
+ return mxExtHandler;
+ }
+
+ // Get original ::com::sun::star::util::URL.
+ const ::rtl::OUString& GetOrigFileName() const { return msOrigFileName; }
+
+ // Get the relative path for embedded pictures
+ const ::rtl::OUString& GetPicturesPath() const { return msPicturesPath; }
+
+ // Get the relative path for embedded objects
+ const ::rtl::OUString& GetObjectsPath() const { return msObjectsPath; }
+
+ // Get (const) namespace map.
+ const SvXMLNamespaceMap& GetNamespaceMap() const { return *mpNamespaceMap; }
+
+ // Get unit converter
+ const SvXMLUnitConverter& GetMM100UnitConverter() const { return *mpUnitConv; }
+
+ SvXMLUnitConverter& GetMM100UnitConverter() { return *mpUnitConv; }
+
+ // Export the document.
+ virtual sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID );
+
+ virtual void addDataStyle(const sal_Int32 nNumberFormat, sal_Bool bTimeFormat = sal_False );
+ virtual void exportDataStyles();
+ virtual void exportAutoDataStyles();
+ virtual rtl::OUString getDataStyleName(const sal_Int32 nNumberFormat, sal_Bool bTimeFormat = sal_False ) const;
+ sal_Int32 dataStyleForceSystemLanguage(sal_Int32 nFormat) const;
+
+ virtual void exportAnnotationMeta( const com::sun::star::uno::Reference < com::sun::star::drawing::XShape >& xShape);
+
+ // Get XModel
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > &
+ GetModel() const { return mxModel; }
+ // Get XNumberFormatsSupplier
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > & GetNumberFormatsSupplier() { return mxNumberFormatsSupplier; }
+ inline void SetNumberFormatsSupplier(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& _xNumberFormatSupplier)
+ {
+ mxNumberFormatsSupplier = _xNumberFormatSupplier;
+ if ( mxNumberFormatsSupplier.is() && mxHandler.is() )
+ mpNumExport = new SvXMLNumFmtExport(*this, mxNumberFormatsSupplier);
+ }
+
+ // get export helper for text
+ inline UniReference< XMLTextParagraphExport > GetTextParagraphExport();
+
+ // get export helper for shapes
+ inline UniReference< XMLShapeExport > GetShapeExport();
+
+ // get auto style pool
+ inline UniReference< SvXMLAutoStylePoolP > GetAutoStylePool();
+
+ // get Page Export
+ inline UniReference< XMLPageExport > GetPageExport();
+
+ // get chart export helper
+ inline UniReference< SchXMLExportHelper > GetChartExport();
+
+ // get font auto style pool
+ inline UniReference< XMLFontAutoStylePool > GetFontAutoStylePool();
+
+ ProgressBarHelper* GetProgressBarHelper();
+
+ // get Formlayer Export
+ inline UniReference< xmloff::OFormLayerXMLExport > GetFormExport();
+ inline bool HasFormExport();
+
+ // get XPropertySet with export information
+ inline ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getExportInfo() const { return mxExportInfo; }
+
+ com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > GetStatusIndicator() { return mxStatusIndicator; }
+
+ /// get Event export, with handlers for script types "None" and
+ /// "StarBasic" already registered; other handlers may be registered, too.
+ XMLEventExport& GetEventExport();
+
+ /// get the export for image maps
+ XMLImageMapExport& GetImageMapExport();
+
+ ::rtl::OUString AddEmbeddedGraphicObject(
+ const ::rtl::OUString& rGraphicObjectURL );
+ sal_Bool AddEmbeddedGraphicObjectAsBase64(
+ const ::rtl::OUString& rGraphicObjectURL );
+
+ ::rtl::OUString AddEmbeddedObject(
+ const ::rtl::OUString& rEmbeddedObjectURL );
+ sal_Bool AddEmbeddedObjectAsBase64(
+ const ::rtl::OUString& rEmbeddedObjectURL );
+
+ ::rtl::OUString EncodeStyleName( const ::rtl::OUString& rName,
+ sal_Bool *pEncoded=0 ) const;
+
+ // save linked sections?
+ inline sal_Bool IsSaveLinkedSections() { return mbSaveLinkedSections; }
+
+ // get export flags
+ sal_uInt16 getExportFlags() const { return mnExportFlags; }
+
+ sal_Bool ExportEmbeddedOwnObject(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XComponent >& rComp );
+
+ rtl::OUString GetRelativeReference(const rtl::OUString& rValue);
+
+ // methods for accessing the document handler and handling SAX errors
+ void StartElement(sal_uInt16 nPrefix,
+ enum ::xmloff::token::XMLTokenEnum eName,
+ sal_Bool bIgnWSOutside );
+ void StartElement(const ::rtl::OUString& rName,
+ sal_Bool bIgnWSOutside );
+ void Characters(const ::rtl::OUString& rChars);
+ void EndElement(sal_uInt16 nPrefix,
+ enum ::xmloff::token::XMLTokenEnum eName,
+ sal_Bool bIgnWSInside );
+ void EndElement(const ::rtl::OUString& rName,
+ sal_Bool bIgnWSInside );
+ void IgnorableWhitespace();
+
+ /**
+ * Record an error condition that occurred during export. The
+ * behavior of SetError can be modified using the error flag
+ * constants.
+ */
+ void SetError(
+ /// error ID, may contain an error flag
+ sal_Int32 nId,
+ /// string parameters for the error message
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString> & rMsgParams,
+ /// original exception message (if applicable)
+ const ::rtl::OUString& rExceptionMessage,
+ /// error location (if applicable)
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XLocator> & rLocator );
+
+ void SetError(
+ sal_Int32 nId,
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString> & rMsgParams);
+
+ /** return list of errors */
+ XMLErrors* GetErrors();
+
+ /** return current error flags (logical 'or' of all error flags so far) */
+ sal_uInt16 GetErrorFlags() { return mnErrorFlags; }
+
+ virtual void DisposingModel();
+
+ ::comphelper::UnoInterfaceToUniqueIdentifierMapper& getInterfaceToIdentifierMapper();
+
+ // #110680#
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getServiceFactory();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ GetComponentContext() const;
+
+ // Shapes in Writer cannot be named via context menu (#i51726#)
+ SvtModuleOptions::EFactory GetModelType() const
+ {
+ return meModelType;
+ }
+
+ // Written OpenDocument file format doesn't fit to the created text document (#i69627#)
+ sal_Bool writeOutlineStyleAsNormalListStyle() const;
+ bool isExperimentalOdfExportEnabled() const { return mbEnableExperimentalOdfExport; }
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > GetTargetStorage();
+
+ /// returns the currently configured default version for odf export
+ SvtSaveOptions::ODFDefaultVersion getDefaultVersion() const;
+
+ /// name of stream in package, e.g., "content.xml"
+ ::rtl::OUString GetStreamName() const;
+
+ // FIXME: this is only for legacy stuff that has not yet been adapted
+ // to implement XMetadatable; this can write duplicate IDs!
+ /// add xml:id and legacy namespace id
+ void SAL_DLLPRIVATE AddAttributeIdLegacy(
+ sal_uInt16 const nLegacyPrefix, ::rtl::OUString const& rValue);
+
+ /// add xml:id attribute (for RDF metadata)
+ void AddAttributeXmlId(::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface> const & i_xIfc);
+
+ /// add RDFa attributes for a metadatable text content
+ void AddAttributesRDFa( ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextContent> const & i_xTextContent);
+
+ sal_Bool exportTextNumberElement() const;
+
+ /// set null date from model to unit converter, if not already done
+ sal_Bool SetNullDateOnUnitConverter();
+};
+
+inline UniReference< XMLTextParagraphExport > SvXMLExport::GetTextParagraphExport()
+{
+ if( !mxTextParagraphExport.is() )
+ mxTextParagraphExport = CreateTextParagraphExport();
+
+ return mxTextParagraphExport;
+}
+
+inline UniReference< XMLShapeExport > SvXMLExport::GetShapeExport()
+{
+ if( !mxShapeExport.is() )
+ mxShapeExport = CreateShapeExport();
+
+ return mxShapeExport;
+}
+
+inline UniReference< SvXMLAutoStylePoolP > SvXMLExport::GetAutoStylePool()
+{
+ if( !mxAutoStylePool.is() )
+ mxAutoStylePool = CreateAutoStylePool();
+
+ return mxAutoStylePool;
+}
+
+inline UniReference< SchXMLExportHelper > SvXMLExport::GetChartExport()
+{
+ if( !mxChartExport.is() )
+ mxChartExport = CreateChartExport();
+
+ return mxChartExport;
+}
+
+inline UniReference< XMLPageExport > SvXMLExport::GetPageExport()
+{
+ if( !mxPageExport.is() )
+ mxPageExport = CreatePageExport();
+
+ return mxPageExport;
+}
+
+inline UniReference< XMLFontAutoStylePool > SvXMLExport::GetFontAutoStylePool()
+{
+ if( !mxFontAutoStylePool.is() )
+ mxFontAutoStylePool = CreateFontAutoStylePool();
+
+ return mxFontAutoStylePool;
+}
+
+inline UniReference< xmloff::OFormLayerXMLExport > SvXMLExport::GetFormExport()
+{
+ if( !mxFormExport.is() )
+ mxFormExport = CreateFormExport();
+
+ return mxFormExport;
+}
+
+inline bool SvXMLExport::HasFormExport()
+{
+ return mxFormExport.is();
+}
+
+inline void SvXMLExport::SetEmbeddedResolver(
+ com::sun::star::uno::Reference< com::sun::star::document::XEmbeddedObjectResolver >& _xEmbeddedResolver )
+{
+ mxEmbeddedResolver = _xEmbeddedResolver;
+}
+
+inline void SvXMLExport::SetGraphicResolver(
+ com::sun::star::uno::Reference< com::sun::star::document::XGraphicObjectResolver >& _xGraphicResolver )
+{
+ mxGraphicResolver = _xGraphicResolver;
+}
+
+// Helper class to export an element.
+class XMLOFF_DLLPUBLIC SvXMLElementExport
+{
+ SvXMLExport& rExport;
+ ::rtl::OUString aName;
+ sal_Bool bIgnWS : 1;
+ sal_Bool bDoSomething : 1;
+
+ SAL_DLLPRIVATE void StartElement( SvXMLExport& rExp, sal_uInt16 nPrefix,
+ const ::rtl::OUString& rName,
+ sal_Bool bIgnWSOutside );
+
+public:
+
+ // The constructor prints a start tag that has the common attributes
+ // of the XMLExport instance attached.
+ SvXMLElementExport( SvXMLExport& rExp, sal_uInt16 nPrefix,
+ const sal_Char *pName,
+ sal_Bool bIgnWSOutside, sal_Bool bIgnWSInside );
+ SvXMLElementExport( SvXMLExport& rExp, sal_uInt16 nPrefix,
+ const ::rtl::OUString& rName,
+ sal_Bool bIgnWSOutside, sal_Bool bIgnWSInside );
+ SvXMLElementExport( SvXMLExport& rExp, sal_uInt16 nPrefix,
+ enum ::xmloff::token::XMLTokenEnum eName,
+ sal_Bool bIgnWSOutside, sal_Bool bIgnWSInside );
+ SvXMLElementExport( SvXMLExport& rExp, const ::rtl::OUString& rQName,
+ sal_Bool bIgnWSOutside, sal_Bool bIgnWSInside );
+
+ // Thes constructors do nothing if bDoSomething is not set
+ SvXMLElementExport( SvXMLExport& rExp, sal_Bool bDoSomething,
+ sal_uInt16 nPrefix, const sal_Char *pName,
+ sal_Bool bIgnWSOutside, sal_Bool bIgnWSInside );
+ SvXMLElementExport( SvXMLExport& rExp, sal_Bool bDoSomething,
+ sal_uInt16 nPrefix, const ::rtl::OUString& rName,
+ sal_Bool bIgnWSOutside, sal_Bool bIgnWSInside );
+ SvXMLElementExport( SvXMLExport& rExp, sal_Bool bDoSomething,
+ sal_uInt16 nPrefix,
+ enum ::xmloff::token::XMLTokenEnum eName,
+ sal_Bool bIgnWSOutside, sal_Bool bIgnWSInside );
+
+ // The destructor prints an end tag.
+ ~SvXMLElementExport();
+};
+
+#endif // _XMLOFF_SVXMLEXP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/xmlexppr.hxx b/xmloff/inc/xmloff/xmlexppr.hxx
new file mode 100644
index 000000000000..2cbafe089910
--- /dev/null
+++ b/xmloff/inc/xmloff/xmlexppr.hxx
@@ -0,0 +1,207 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLEXPPR_HXX
+#define _XMLOFF_XMLEXPPR_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include <xmloff/xmlprmap.hxx>
+#include <xmloff/uniref.hxx>
+
+namespace rtl { class OUString; }
+
+class SvXMLUnitConverter;
+class SvXMLAttributeList;
+class SvXMLNamespaceMap;
+class SvUShorts;
+class FilterPropertiesInfos_Impl;
+class SvXMLExport;
+
+#define XML_EXPORT_FLAG_DEFAULTS 0x0001 // export also default items
+#define XML_EXPORT_FLAG_DEEP 0x0002 // export also items from
+ // parent item sets
+#define XML_EXPORT_FLAG_EMPTY 0x0004 // export attribs element
+ // even if its empty
+#define XML_EXPORT_FLAG_IGN_WS 0x0008
+
+class XMLOFF_DLLPUBLIC SvXMLExportPropertyMapper : public UniRefBase
+{
+ UniReference< SvXMLExportPropertyMapper> mxNextMapper;
+
+ FilterPropertiesInfos_Impl *pCache;
+
+protected:
+ UniReference< XMLPropertySetMapper > maPropMapper;
+
+ rtl::OUString maStyleName;
+
+ /** Filter all properties we don't want to export:
+ Take all properties of the XPropertySet which are also found in the
+ XMLPropertyMapEntry-array and which are not set directly (so, the value isn't
+ default and isn't inherited, apart from bDefault is true)
+ After this process It'll called 'Contextfilter' for application-specific
+ filter-processes. */
+ ::std::vector< XMLPropertyState > _Filter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > rPropSet,
+ const sal_Bool bDefault ) const;
+
+ /** Application-specific filter. By default do nothing. */
+ virtual void ContextFilter(
+ ::std::vector< XMLPropertyState >& rProperties,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > rPropSet ) const;
+
+ /** fills the given attribute list with the items in the given set */
+ void _exportXML( sal_uInt16 nPropType, sal_uInt16& rPropTypeFlags,
+ SvXMLAttributeList& rAttrList,
+ const ::std::vector< XMLPropertyState >& rProperties,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ sal_uInt16 nFlags,
+ SvUShorts* pIndexArray,
+ sal_Int32 nPropMapStartIdx, sal_Int32 nPropMapEndIdx ) const;
+
+ void _exportXML( SvXMLAttributeList& rAttrList,
+ const XMLPropertyState& rProperty,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ sal_uInt16 nFlags,
+ const ::std::vector< XMLPropertyState > *pProperties = 0,
+ sal_uInt32 nIdx = 0 ) const;
+
+ void exportElementItems(
+ SvXMLExport& rExport,
+ const ::std::vector< XMLPropertyState >& rProperties,
+ sal_uInt16 nFlags,
+ const SvUShorts& rIndexArray ) const;
+
+public:
+
+ SvXMLExportPropertyMapper(
+ const UniReference< XMLPropertySetMapper >& rMapper );
+ virtual ~SvXMLExportPropertyMapper();
+
+ // Add a ExportPropertyMapper at the end of the import mapper chain.
+ // The added mapper MUST not be used outside the Mapper chain any longer,
+ // because its PropertyMapper will be replaced.
+ void ChainExportMapper(
+ const UniReference< SvXMLExportPropertyMapper>& rMapper );
+
+ /** Filter all properties we don't want to export:
+ Take all properties of the XPropertySet which are also found in the
+ XMLPropertyMapEntry-array and which are not set directly (so, the value isn't
+ default and isn't inherited)
+ After this process It'll called 'Contextfilter' for application-specific
+ filter-processes. */
+ ::std::vector< XMLPropertyState > Filter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > rPropSet ) const
+ { return _Filter(rPropSet, sal_False); }
+
+ /** Like Filter(), excepti that:
+ * - only properties that have the map flag MID_FLAG_DEFAULT_ITEM_EXPORT
+ * set are exported,
+ * - instead of the property's value, its defualt value is exported.
+ */
+ ::std::vector< XMLPropertyState > FilterDefaults(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > rPropSet ) const
+ { return _Filter(rPropSet, sal_True); }
+
+ /** Compare to arrays of XMLPropertyState */
+ sal_Bool Equals( const ::std::vector< XMLPropertyState >& aProperties1,
+ const ::std::vector< XMLPropertyState >& aProperties2 ) const;
+
+ /** fills the given attribute list with the items in the given set */
+ void exportXML(
+ SvXMLAttributeList& rAttrList,
+ const ::std::vector< XMLPropertyState >& rProperties,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ sal_uInt16 nFlags = 0 ) const;
+ /** like above but only properties whose property map index is within the
+ specified range are exported */
+ void exportXML(
+ SvXMLAttributeList& rAttrList,
+ const ::std::vector< XMLPropertyState >& rProperties,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ sal_Int32 nPropMapStartIdx, sal_Int32 nPropMapEndIdx,
+ sal_uInt16 nFlags = 0 ) const;
+
+ /** fills the given attribute list with the representation of one item */
+ void exportXML(
+ SvXMLAttributeList& rAttrList,
+ const XMLPropertyState& rProperty,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ sal_uInt16 nFlags = 0 ) const;
+
+ void exportXML(
+ SvXMLExport& rExport,
+ const ::std::vector< XMLPropertyState >& rProperties,
+ sal_uInt16 nFlags = 0 ) const;
+
+ /** like above but only properties whose property map index is within the
+ specified range are exported */
+ void exportXML(
+ SvXMLExport& rExport,
+ const ::std::vector< XMLPropertyState >& rProperties,
+ sal_Int32 nPropMapStartIdx, sal_Int32 nPropMapEndIdx,
+ sal_uInt16 nFlags = 0 ) const;
+
+ /** this method is called for every item that has the
+ MID_FLAG_ELEMENT_EXPORT flag set */
+ virtual void handleElementItem(
+ SvXMLExport& rExport,
+ const XMLPropertyState& rProperty,
+ sal_uInt16 nFlags,
+ const ::std::vector< XMLPropertyState > *pProperties = 0,
+ sal_uInt32 nIdx = 0 ) const;
+
+ /** this method is called for every item that has the
+ MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
+ virtual void handleSpecialItem(
+ SvXMLAttributeList& rAttrList,
+ const XMLPropertyState& rProperty,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ const ::std::vector< XMLPropertyState > *pProperties = 0,
+ sal_uInt32 nIdx = 0 ) const;
+
+ inline const UniReference< XMLPropertySetMapper >&
+ getPropertySetMapper() const { return maPropMapper; }
+
+ void SetStyleName( const rtl::OUString& rStyleName ) { maStyleName = rStyleName; }
+};
+
+#endif // _XMLOFF_XMLEXPPR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/xmlictxt.hxx b/xmloff/inc/xmloff/xmlictxt.hxx
new file mode 100644
index 000000000000..52a358431029
--- /dev/null
+++ b/xmloff/inc/xmloff/xmlictxt.hxx
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLICTXT_HXX
+#define _XMLOFF_XMLICTXT_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include "sal/types.h"
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <tools/solar.h>
+#include <tools/ref.hxx>
+#include <rtl/ustring.hxx>
+#include <tools/rtti.hxx>
+
+class SvXMLNamespaceMap;
+class SvXMLImport;
+
+class XMLOFF_DLLPUBLIC SvXMLImportContext : public SvRefBase
+{
+ friend class SvXMLImport;
+
+ SvXMLImport& mrImport;
+
+ sal_uInt16 mnPrefix;
+ ::rtl::OUString maLocalName;
+
+ SvXMLNamespaceMap *mpRewindMap;
+
+ SAL_DLLPRIVATE SvXMLNamespaceMap *GetRewindMap() const
+ { return mpRewindMap; }
+ SAL_DLLPRIVATE void SetRewindMap( SvXMLNamespaceMap *p ) { mpRewindMap = p; }
+
+protected:
+
+ SvXMLImport& GetImport() { return mrImport; }
+ const SvXMLImport& GetImport() const { return mrImport; }
+
+public:
+ TYPEINFO();
+
+ sal_uInt16 GetPrefix() const { return mnPrefix; }
+ const ::rtl::OUString& GetLocalName() const { return maLocalName; }
+
+ // A contexts constructor does anything that is required if an element
+ // starts. Namespace processing has been done already.
+ // Note that virtual methods cannot be used inside constructors. Use
+ // StartElement instead if this is required.
+ SvXMLImportContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName );
+
+ // A contexts destructor does anything that is required if an element
+ // ends. By default, nothing is done.
+ // Note that virtual methods cannot be used inside destructors. Use
+ // EndElement instead if this is required.
+ virtual ~SvXMLImportContext();
+
+ // Create a childs element context. By default, the import's
+ // CreateContext method is called to create a new default context.
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ // StartElement is called after a context has been constructed and
+ // before a elements context is parsed. It may be used for actions that
+ // require virtual methods. The default is to do nothing.
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ // EndElement is called before a context will be destructed, but
+ // after a elements context has been parsed. It may be used for actions
+ // that require virtual methods. The default is to do nothing.
+ virtual void EndElement();
+
+ // This method is called for all characters that are contained in the
+ // current element. The default is to ignore them.
+ virtual void Characters( const ::rtl::OUString& rChars );
+};
+
+SV_DECL_REF( SvXMLImportContext )
+SV_IMPL_REF( SvXMLImportContext )
+
+
+#endif // _XMLOFF_XMLICTXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/xmlimp.hxx b/xmloff/inc/xmloff/xmlimp.hxx
new file mode 100644
index 000000000000..02b90a5103f5
--- /dev/null
+++ b/xmloff/inc/xmloff/xmlimp.hxx
@@ -0,0 +1,536 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLIMP_HXX
+#define _XMLOFF_XMLIMP_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include "sal/types.h"
+#include <com/sun/star/xml/sax/SAXParseException.hpp>
+#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/SAXException.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/xml/sax/XLocator.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/document/XImporter.hpp>
+#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/document/XGraphicObjectResolver.hpp>
+#include <com/sun/star/document/XEmbeddedObjectResolver.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <cppuhelper/weak.hxx>
+#include <xmloff/txtimp.hxx>
+#include <xmloff/shapeimport.hxx>
+#include <xmloff/SchXMLImportHelper.hxx>
+#include <xmloff/ProgressBarHelper.hxx>
+#include <cppuhelper/implbase6.hxx>
+#include <xmloff/formlayerimport.hxx>
+
+#include <com/sun/star/beans/NamedValue.hpp>
+
+namespace rtl { class OUString; }
+namespace com { namespace sun { namespace star {
+ namespace uno { class XComponentContext; }
+ namespace frame { class XModel; }
+ namespace io { class XOutputStream; }
+ namespace rdf { class XMetadatable; }
+} } }
+namespace comphelper { class UnoInterfaceToUniqueIdentifierMapper; }
+
+class SvXMLNamespaceMap;
+class SvXMLImportContext;
+class SvXMLImportContexts_Impl;
+class SvXMLImport_Impl;
+class SvXMLUnitConverter;
+class SvXMLNumFmtHelper;
+class XMLFontStylesContext;
+class XMLEventImportHelper;
+class XMLErrors;
+class StyleMap;
+class String;
+
+namespace xmloff {
+ class RDFaImportHelper;
+}
+
+#define IMPORT_META 0x0001
+#define IMPORT_STYLES 0x0002
+#define IMPORT_MASTERSTYLES 0x0004
+#define IMPORT_AUTOSTYLES 0x0008
+#define IMPORT_CONTENT 0x0010
+#define IMPORT_SCRIPTS 0x0020
+#define IMPORT_SETTINGS 0x0040
+#define IMPORT_FONTDECLS 0x0080
+#define IMPORT_EMBEDDED 0x0100
+#define IMPORT_OOO_NAMESPACES 0x0100
+#define IMPORT_ALL 0xffff
+
+
+
+class XMLOFF_DLLPUBLIC SvXMLImport : public ::cppu::WeakImplHelper6<
+ ::com::sun::star::xml::sax::XExtendedDocumentHandler,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::lang::XInitialization,
+ ::com::sun::star::document::XImporter,
+ ::com::sun::star::document::XFilter,
+ ::com::sun::star::lang::XUnoTunnel>
+{
+ friend class SvXMLImportContext;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > mxLocator;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxModel;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > mxNumberFormatsSupplier;
+ ::com::sun::star::uno::Reference< ::com::sun::star::document::XGraphicObjectResolver > mxGraphicResolver;
+ ::com::sun::star::uno::Reference< ::com::sun::star::document::XEmbeddedObjectResolver > mxEmbeddedResolver;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxImportInfo;
+
+ UniReference< XMLTextImportHelper > mxTextImport;
+ UniReference< XMLShapeImportHelper > mxShapeImport;
+ UniReference< SchXMLImportHelper > mxChartImport;
+ UniReference< ::xmloff::OFormLayerXMLImport > mxFormImport;
+
+ SvXMLImportContextRef mxFontDecls;
+ SvXMLImportContextRef mxStyles;
+ SvXMLImportContextRef mxAutoStyles;
+ SvXMLImportContextRef mxMasterStyles;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > mxGradientHelper;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > mxHatchHelper;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > mxBitmapHelper;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > mxTransGradientHelper;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > mxMarkerHelper;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > mxDashHelper;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > mxNumberStyles;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > mxEventListener;
+
+ SvXMLImport_Impl *mpImpl; // dummy
+
+ SvXMLNamespaceMap *mpNamespaceMap;
+ SvXMLUnitConverter *mpUnitConv;
+ SvXMLImportContexts_Impl *mpContexts;
+ SvXMLNumFmtHelper *mpNumImport;
+ ProgressBarHelper *mpProgressBarHelper;
+ XMLEventImportHelper *mpEventImportHelper;
+ XMLErrors *mpXMLErrors;
+ StyleMap *mpStyleMap;
+ ::rtl::OUString msPackageProtocol;
+
+ SAL_DLLPRIVATE void _InitCtor();
+
+ sal_uInt16 mnImportFlags;
+ sal_uInt16 mnErrorFlags;
+
+protected:
+ // #110680#
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxServiceFactory;
+
+ ::com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > mxStatusIndicator;
+ sal_Bool mbIsFormsSupported;
+ bool mbIsTableShapeSupported;
+ bool mbIsGraphicLoadOnDemandSupported;
+
+ // This method is called after the namespace map has been updated, but
+ // before a context for the current element has been pushed.
+ virtual SvXMLImportContext *CreateContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual XMLTextImportHelper* CreateTextImport();
+ virtual XMLShapeImportHelper* CreateShapeImport();
+ inline sal_Bool HasShapeImport() const { return mxShapeImport.is(); }
+ inline void ClearShapeImport() { mxShapeImport = 0; }
+
+ virtual SchXMLImportHelper* CreateChartImport();
+ virtual ::xmloff::OFormLayerXMLImport* CreateFormImport();
+
+ void SetFontDecls( XMLFontStylesContext *pFontDecls );
+ void SetStyles( SvXMLStylesContext *pStyles );
+ void SetAutoStyles( SvXMLStylesContext *pAutoStyles );
+ void SetMasterStyles( SvXMLStylesContext *pMasterStyles );
+
+ sal_Bool IsODFVersionConsistent( const ::rtl::OUString& aODFVersion );
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::document::XEmbeddedObjectResolver >& GetEmbeddedResolver() const { return mxEmbeddedResolver; }
+ inline void SetEmbeddedResolver( com::sun::star::uno::Reference< com::sun::star::document::XEmbeddedObjectResolver >& _xEmbeddedResolver );
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::document::XGraphicObjectResolver >& GetGraphicResolver() const { return mxGraphicResolver; }
+ void SetGraphicResolver( com::sun::star::uno::Reference< com::sun::star::document::XGraphicObjectResolver >& _xGraphicResolver );
+
+
+ void _CreateNumberFormatsSupplier();
+ void _CreateDataStylesImport();
+
+public:
+ // #110680#
+ // SvXMLImport( sal_uInt16 nImportFlags = IMPORT_ALL ) throw();
+ SvXMLImport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ sal_uInt16 nImportFlags = IMPORT_ALL ) throw();
+
+ // #110680#
+ //SvXMLImport( const ::com::sun::star::uno::Reference<
+ // ::com::sun::star::frame::XModel > & ) throw();
+ SvXMLImport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & ) throw();
+
+ // #110680#
+ //SvXMLImport( const ::com::sun::star::uno::Reference<
+ // ::com::sun::star::frame::XModel > &,
+ // const ::com::sun::star::uno::Reference< ::com::sun::star::document::XGraphicObjectResolver > & ) throw();
+ SvXMLImport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > &,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::document::XGraphicObjectResolver > & ) throw();
+
+ virtual ~SvXMLImport() throw();
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
+ static SvXMLImport* getImplementation( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > ) throw();
+
+ // ::com::sun::star::xml::sax::XDocumentHandler
+ virtual void SAL_CALL startDocument(void)
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL endDocument(void)
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL startElement(const ::rtl::OUString& aName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttribs)
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL endElement(const ::rtl::OUString& aName)
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL characters(const ::rtl::OUString& aChars)
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL ignorableWhitespace(const ::rtl::OUString& aWhitespaces)
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL processingInstruction(const ::rtl::OUString& aTarget,
+ const ::rtl::OUString& aData)
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL setDocumentLocator(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > & xLocator)
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+
+ // ::com::sun::star::xml::sax::XExtendedDocumentHandler
+ virtual void SAL_CALL startCDATA(void) throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL endCDATA(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL comment(const ::rtl::OUString& sComment)
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL allowLineBreak(void)
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL unknown(const ::rtl::OUString& sString)
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+
+ // XImporter
+ virtual void SAL_CALL setTargetDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ // XFilter
+ virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL cancel( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // may be called by certain subclasses that handle document meta-data
+ // override to provide customized handling of document statistics
+ // the base class implementation initializes the progress bar and should
+ // be called by overriding methods
+ virtual void SetStatistics(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > & i_rStats);
+
+ // get import helper for text
+ inline UniReference< XMLTextImportHelper > GetTextImport();
+ sal_Bool HasTextImport() const { return mxTextImport.is(); }
+ inline SvXMLNumFmtHelper* GetDataStylesImport();
+
+ // get import helper for shapes
+ inline UniReference< XMLShapeImportHelper > GetShapeImport();
+
+ // get import helper for charts
+ inline UniReference< SchXMLImportHelper > GetChartImport();
+
+ // get import helper for form layer
+ inline UniReference< ::xmloff::OFormLayerXMLImport > GetFormImport();
+
+ // get XPropertySet with import information
+ inline ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getImportInfo() const { return mxImportInfo; }
+
+ // get import helper for events
+ XMLEventImportHelper& GetEventImport();
+
+ SvXMLNamespaceMap& GetNamespaceMap() { return *mpNamespaceMap; }
+ const SvXMLNamespaceMap& GetNamespaceMap() const { return *mpNamespaceMap; }
+ const SvXMLUnitConverter& GetMM100UnitConverter() const { return *mpUnitConv; }
+ SvXMLUnitConverter& GetMM100UnitConverter() { return *mpUnitConv; }
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > & GetLocator() const { return mxLocator; }
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > &
+ GetModel() const { return mxModel; }
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & GetGradientHelper();
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & GetHatchHelper();
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & GetBitmapHelper();
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & GetTransGradientHelper();
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & GetMarkerHelper();
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & GetDashHelper();
+ inline ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > & GetNumberFormatsSupplier();
+ inline void SetNumberFormatsSupplier(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& _xNumberFormatSupplier)
+ {
+ mxNumberFormatsSupplier = _xNumberFormatSupplier;
+ }
+
+ // Convert a local packe URL into either a graphic manager or a
+ // internal package URL. The later one happens only if bLoadURL is true
+ ::rtl::OUString ResolveGraphicObjectURL( const ::rtl::OUString& rURL, sal_Bool bLoadOnDemand );
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
+ GetStreamForGraphicObjectURLFromBase64();
+ ::rtl::OUString ResolveGraphicObjectURLFromBase64(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rOut );
+
+ sal_Bool IsPackageURL( const ::rtl::OUString& rURL ) const;
+ ::rtl::OUString ResolveEmbeddedObjectURL( const ::rtl::OUString& rURL,
+ const ::rtl::OUString& rClassId );
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
+ GetStreamForEmbeddedObjectURLFromBase64();
+ ::rtl::OUString ResolveEmbeddedObjectURLFromBase64();
+
+ void AddStyleDisplayName( sal_uInt16 nFamily,
+ const ::rtl::OUString& rName,
+ const ::rtl::OUString& rDisplayName );
+ ::rtl::OUString GetStyleDisplayName( sal_uInt16 nFamily,
+ const ::rtl::OUString& rName ) const;
+
+ ProgressBarHelper* GetProgressBarHelper();
+
+ void AddNumberStyle(sal_Int32 nKey, const rtl::OUString& sName);
+
+ virtual void SetViewSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aViewProps);
+ virtual void SetConfigurationSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aConfigProps);
+ virtual void SetDocumentSpecificSettings(const ::rtl::OUString& _rSettingsGroupName,
+ const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& _rSettings);
+
+ XMLFontStylesContext *GetFontDecls();
+ SvXMLStylesContext *GetStyles();
+ SvXMLStylesContext *GetAutoStyles();
+ SvXMLStylesContext *GetMasterStyles();
+ const XMLFontStylesContext *GetFontDecls() const;
+ const SvXMLStylesContext *GetStyles() const;
+ const SvXMLStylesContext *GetAutoStyles() const;
+ const SvXMLStylesContext *GetMasterStyles() const;
+
+ sal_uInt16 getImportFlags() const { return mnImportFlags; }
+ sal_Bool IsFormsSupported() const { return mbIsFormsSupported; }
+ rtl::OUString GetAbsoluteReference(const rtl::OUString& rValue) const;
+
+ sal_Unicode ConvStarBatsCharToStarSymbol( sal_Unicode c );
+ sal_Unicode ConvStarMathCharToStarSymbol( sal_Unicode c );
+
+ bool IsTableShapeSupported() const { return mbIsTableShapeSupported; }
+
+ ::rtl::OUString GetODFVersion() const;
+
+ /**
+ * Record an error condition that occurred during import. The
+ * behavior of SetError can be modified using the error flag
+ * constants.
+ */
+ void SetError(
+ /// error ID, may contain an error flag
+ sal_Int32 nId,
+ /// string parameters for the error message
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString> & rMsgParams,
+ /// original exception message (if applicable)
+ const ::rtl::OUString& rExceptionMessage,
+ /// error location (if applicable)
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XLocator> & rLocator );
+
+ void SetError(
+ sal_Int32 nId,
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString> & rMsgParams);
+
+ void SetError( sal_Int32 nId );
+ void SetError( sal_Int32 nId, const rtl::OUString& rMsg1 );
+ void SetError( sal_Int32 nId, const rtl::OUString& rMsg1,
+ const rtl::OUString& rMsg2 );
+ void SetError( sal_Int32 nId, const rtl::OUString& rMsg1,
+ const rtl::OUString& rMsg2,
+ const rtl::OUString& rMsg3 );
+ void SetError( sal_Int32 nId, const rtl::OUString& rMsg1,
+ const rtl::OUString& rMsg2,
+ const rtl::OUString& rMsg3,
+ const rtl::OUString& rMsg4 );
+
+ /** return list of errors */
+ XMLErrors* GetErrors();
+
+ /** return current error flags */
+ sal_uInt16 GetErrorFlags() { return mnErrorFlags; }
+
+ virtual void DisposingModel();
+
+ ::comphelper::UnoInterfaceToUniqueIdentifierMapper& getInterfaceToIdentifierMapper();
+
+ // #110680#
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getServiceFactory();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ GetComponentContext() const;
+
+ // Convert drawing object positions from OOo file format to OASIS file format and vice versa (#i28749#)
+ sal_Bool IsShapePositionInHoriL2R() const;
+
+ sal_Bool IsTextDocInOOoFileFormat() const;
+
+ String GetBaseURL() const;
+ String GetDocumentBase() const;
+
+ /// name of stream in package, e.g., "content.xml"
+ ::rtl::OUString GetStreamName() const;
+
+ /// set the XmlId attribute of given UNO object (for RDF metadata)
+ void SetXmlId(::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface> const & i_xIfc,
+ ::rtl::OUString const & i_rXmlId);
+
+ /// Add a RDFa statement; parameters are XML attribute values
+ void AddRDFa(
+ ::com::sun::star::uno::Reference< ::com::sun::star::rdf::XMetadatable>
+ i_xObject,
+ ::rtl::OUString const & i_rAbout,
+ ::rtl::OUString const & i_rProperty,
+ ::rtl::OUString const & i_rContent,
+ ::rtl::OUString const & i_rDatatype);
+
+ /// do not dllexport this; only for advanced cases (bookmark-start)
+ SAL_DLLPRIVATE ::xmloff::RDFaImportHelper & GetRDFaImportHelper();
+
+ // #i31958# XForms helper method
+ // (to be implemented by applications suporting XForms)
+ virtual void initXForms();
+
+ /** returns the upd and build id (f.e. "680m124$Build-8964" gives rMaster = 680 and rBuild = 8964)
+ from the metafile.
+ this only works if the meta.xml was already imported and the
+ import propertyset contains the string property "BuildId".
+ If false is returned the build ids are not available (yet).
+ **/
+ bool getBuildIds( sal_Int32& rUPD, sal_Int32& rBuild ) const;
+
+ static const sal_uInt16 OOo_1x = 10;
+ static const sal_uInt16 OOo_2x = 20;
+ static const sal_uInt16 OOo_Current = 30;
+
+ /** this checks the build ID and returns
+
+ * OOo_1x for files created with OpenOffice.org 1.x or StarOffice 7 (this also includes binary import over binfilter)
+ * OOo_2x for files created with OpenOffice.org 2.x or StarOffice 8
+ * OOo_Current for files created with OpenOffice.org 3.x and StarOffice9 or newer or for files not created with OpenOffice.org or StarOffice
+ */
+ sal_uInt16 getGeneratorVersion() const;
+
+ /** If true, the URL for graphic shapes may be stored as a package URL and
+ loaded later (on demand) by the application. Otherwise graphics are
+ loaded immediately and the graphic shape gets the graphic manager URL.
+
+ @see <member>mbIsGraphicLoadOnDemandSupported</member>
+ */
+ bool isGraphicLoadOnDemandSupported() const;
+};
+
+inline UniReference< XMLTextImportHelper > SvXMLImport::GetTextImport()
+{
+ if( !mxTextImport.is() )
+ mxTextImport = CreateTextImport();
+
+ return mxTextImport;
+}
+
+inline UniReference< XMLShapeImportHelper > SvXMLImport::GetShapeImport()
+{
+ if( !mxShapeImport.is() )
+ mxShapeImport = CreateShapeImport();
+
+ return mxShapeImport;
+}
+
+inline UniReference< SchXMLImportHelper > SvXMLImport::GetChartImport()
+{
+ if( !mxChartImport.is() )
+ mxChartImport = CreateChartImport();
+
+ return mxChartImport;
+}
+
+inline UniReference< ::xmloff::OFormLayerXMLImport > SvXMLImport::GetFormImport()
+{
+ if( !mxFormImport.is() )
+ mxFormImport = CreateFormImport();
+
+ return mxFormImport;
+}
+
+inline void SvXMLImport::SetEmbeddedResolver(
+ com::sun::star::uno::Reference< com::sun::star::document::XEmbeddedObjectResolver >& _xEmbeddedResolver )
+{
+ mxEmbeddedResolver = _xEmbeddedResolver;
+}
+
+inline void SvXMLImport::SetGraphicResolver(
+ com::sun::star::uno::Reference< com::sun::star::document::XGraphicObjectResolver >& _xGraphicResolver )
+{
+ mxGraphicResolver = _xGraphicResolver;
+}
+
+inline ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > & SvXMLImport::GetNumberFormatsSupplier()
+{
+ if ( ! mxNumberFormatsSupplier.is() && mxModel.is() )
+ _CreateNumberFormatsSupplier();
+
+ return mxNumberFormatsSupplier;
+}
+
+inline SvXMLNumFmtHelper* SvXMLImport::GetDataStylesImport()
+{
+ if ( mpNumImport == NULL)
+ _CreateDataStylesImport();
+
+ return mpNumImport;
+}
+
+
+#endif // _XMLOFF_XMLIMP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/xmlimppr.hxx b/xmloff/inc/xmloff/xmlimppr.hxx
new file mode 100644
index 000000000000..eb1e245a044a
--- /dev/null
+++ b/xmloff/inc/xmloff/xmlimppr.hxx
@@ -0,0 +1,210 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLIMPPR_HXX
+#define _XMLOFF_XMLIMPPR_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include "sal/types.h"
+#include <tools/solar.h>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/beans/XTolerantMultiPropertySet.hpp>
+
+#include <vector>
+#include <xmloff/uniref.hxx>
+
+struct XMLPropertyState;
+class XMLPropertySetMapper;
+
+namespace rtl { class OUString; }
+
+class SvXMLUnitConverter;
+class SvXMLNamespaceMap;
+class SvXMLImport;
+
+/** This struct is used as an optional parameter to the static
+ * _FillPropertySet() methods.
+ *
+ * It should not be used in any other context.
+ */
+struct _ContextID_Index_Pair
+{
+ sal_Int16 nContextID;
+ sal_Int32 nIndex;
+};
+
+class XMLOFF_DLLPUBLIC SvXMLImportPropertyMapper : public UniRefBase
+{
+ UniReference< SvXMLImportPropertyMapper> mxNextMapper;
+
+ SvXMLImport& rImport; // access to error handling
+
+ SAL_DLLPRIVATE SvXMLImportPropertyMapper(SvXMLImportPropertyMapper &);
+ // not defined
+ SAL_DLLPRIVATE void operator =(SvXMLImportPropertyMapper &); // not defined
+
+protected:
+
+ UniReference< XMLPropertySetMapper > maPropMapper;
+ SvXMLImport& GetImport() const { return rImport;}
+
+public:
+
+ SvXMLImportPropertyMapper(
+ const UniReference< XMLPropertySetMapper >& rMapper,
+ SvXMLImport& rImport);
+ virtual ~SvXMLImportPropertyMapper();
+
+ // Add a ImportPropertyMapper at the end of the import mapper chain.
+ // The added mapper MUST not be used outside the Mapper chain any longer,
+ // because its PropertyMapper will be replaced.
+ void ChainImportMapper(
+ const UniReference< SvXMLImportPropertyMapper>& rMapper );
+
+ /** fills the given itemset with the attributes in the given list */
+ void importXML(
+ ::std::vector< XMLPropertyState >& rProperties,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > xAttrList,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ sal_uInt32 nPropType ) const;
+
+ /** like above, except that the mart is only serached within the range
+ * [nStartIdx, nEndIdx[
+ */
+ void importXML(
+ ::std::vector< XMLPropertyState >& rProperties,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > xAttrList,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ sal_uInt32 nPropType,
+ sal_Int32 nStartIdx, sal_Int32 nEndIdx ) const;
+
+ /** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_IMPORT flag set */
+ virtual bool handleSpecialItem(
+ XMLPropertyState& rProperty,
+ ::std::vector< XMLPropertyState >& rProperties,
+ const ::rtl::OUString& rValue,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap ) const;
+
+ /** This method is called when all attributes have benn processed. It may be used to remove items that are incomplete */
+ virtual void finished(
+ ::std::vector< XMLPropertyState >& rProperties,
+ sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const;
+
+ void CheckSpecialContext(
+ const ::std::vector< XMLPropertyState >& aProperties,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > rPropSet,
+ _ContextID_Index_Pair* pSpecialContextIds ) const;
+
+ sal_Bool FillPropertySet(
+ const ::std::vector< XMLPropertyState >& aProperties,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > rPropSet,
+ _ContextID_Index_Pair* pSpecialContextIds = NULL ) const;
+
+ void FillPropertySequence(
+ const ::std::vector< XMLPropertyState >& aProperties,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rValues )
+ const;
+
+ inline const UniReference< XMLPropertySetMapper >&
+ getPropertySetMapper() const;
+
+
+
+ /** implementation helper for FillPropertySet: fill an XPropertySet.
+ * Exceptions will be asserted. */
+ static sal_Bool _FillPropertySet(
+ const ::std::vector<XMLPropertyState> & rProperties,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySetInfo> & rPropSetInfo,
+ const UniReference<XMLPropertySetMapper> & rPropMapper,
+ SvXMLImport& rImport,
+
+ // parameter for use by txtstyli.cxx; allows efficient
+ // catching the combined characters property
+ _ContextID_Index_Pair* pSpecialContextIds = NULL );
+
+ /** implementation helper for FillPropertySet: fill an XMultiPropertySet.
+ * If unsuccessul, set return value. */
+ static sal_Bool _FillMultiPropertySet(
+ const ::std::vector<XMLPropertyState> & rProperties,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XMultiPropertySet> & rMultiPropSet,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySetInfo> & rPropSetInfo,
+ const UniReference<XMLPropertySetMapper> & rPropMapper,
+
+ // parameters for use by txtstyli.cxx; allows efficient
+ // catching the combined characters property
+ _ContextID_Index_Pair* pSpecialContextIds = NULL );
+
+ /** implementation helper for FillPropertySet: fill an XTolerantMultiPropertySet.
+ * If unsuccessul, set return value. */
+ static sal_Bool _FillTolerantMultiPropertySet(
+ const ::std::vector<XMLPropertyState> & rProperties,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XTolerantMultiPropertySet> & rTolPropSet,
+ const UniReference<XMLPropertySetMapper> & rPropMapper,
+ SvXMLImport& rImport,
+
+ // parameters for use by txtstyli.cxx; allows efficient
+ // catching the combined characters property
+ _ContextID_Index_Pair* pSpecialContextIds = NULL );
+
+
+ static void _PrepareForMultiPropertySet(
+ const ::std::vector<XMLPropertyState> & rProperties,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySetInfo> & rPropSetInfo,
+ const UniReference<XMLPropertySetMapper> & rPropMapper,
+ _ContextID_Index_Pair* pSpecialContextIds,
+ ::com::sun::star::uno::Sequence< ::rtl::OUString >& rNames,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rValues);
+};
+
+
+inline const UniReference< XMLPropertySetMapper >&
+ SvXMLImportPropertyMapper::getPropertySetMapper() const
+{
+ return maPropMapper;
+}
+
+#endif // _XMLOFF_XMLIMPPR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/xmlkywd.hxx b/xmloff/inc/xmloff/xmlkywd.hxx
new file mode 100644
index 000000000000..bce52d875b52
--- /dev/null
+++ b/xmloff/inc/xmloff/xmlkywd.hxx
@@ -0,0 +1,1998 @@
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLKYWD_HXX
+#define _XMLOFF_XMLKYWD_HXX
+
+#include <tools/string.hxx>
+
+/*
+ * THIS FILE IS DEPRECATED. IT IS SUPERSEDED BY XMLTOKEN.HXX.
+ *
+ * Please use xmltoken.hxx / xmltoken.cxx from now on.
+ */
+
+
+/* if XML_DEFINE_KEYWORDS is defined the variables are
+ defined rather than declared. So this file MUST be included
+ WITHOUT this define.
+
+ (Except the xmlkywd.cxx file that actually defines the
+ variables which sets this define.)
+ */
+
+#ifndef XML_DEFINE_KEYWORDS
+#define XML_CONSTASCII_ACTION( n, s ) extern sal_Char __FAR_DATA n[sizeof(s)]
+#else
+#define XML_CONSTASCII_ACTION( n, s ) sal_Char __FAR_DATA n[sizeof(s)] = s
+#endif
+
+// common XML
+XML_CONSTASCII_ACTION( sXML_CDATA, "CDATA" );
+XML_CONSTASCII_ACTION( sXML_WS, " " );
+XML_CONSTASCII_ACTION( sXML_xml, "xml" );
+XML_CONSTASCII_ACTION( sXML_xmlns, "xmlns" );
+XML_CONSTASCII_ACTION( sXML_xml_pi, "version=\"1.0\" encoding=\"UTF-8\"" );
+XML_CONSTASCII_ACTION( sXML_xml_doctype_prefix, "<!DOCTYPE " );
+XML_CONSTASCII_ACTION( sXML_xml_doctype_suffix, " PUBLIC \"-//OpenOffice.org//DTD OfficeDocument 1.0//EN\" \"office.dtd\">" );
+
+// namespace prefixes and names
+XML_CONSTASCII_ACTION( sXML_np_office, "office" );
+XML_CONSTASCII_ACTION( sXML_n_office, "http://openoffice.org/2000/office" );
+XML_CONSTASCII_ACTION( sXML_n_office_old, "http://sun.com/xmlns/staroffice/office" );
+XML_CONSTASCII_ACTION( sXML_np_meta, "meta" );
+XML_CONSTASCII_ACTION( sXML_n_meta, "http://openoffice.org/2000/meta" );
+XML_CONSTASCII_ACTION( sXML_n_meta_old, "http://sun.com/xmlns/staroffice/meta" );
+XML_CONSTASCII_ACTION( sXML_np_style, "style" );
+XML_CONSTASCII_ACTION( sXML_n_style, "http://openoffice.org/2000/style" );
+XML_CONSTASCII_ACTION( sXML_n_style_old, "http://sun.com/xmlns/staroffice/style" );
+XML_CONSTASCII_ACTION( sXML_np_number, "number" );
+XML_CONSTASCII_ACTION( sXML_n_number, "http://openoffice.org/2000/datastyle" );
+XML_CONSTASCII_ACTION( sXML_n_number_old, "http://sun.com/xmlns/staroffice/number" );
+XML_CONSTASCII_ACTION( sXML_np_text, "text" );
+XML_CONSTASCII_ACTION( sXML_n_text, "http://openoffice.org/2000/text" );
+XML_CONSTASCII_ACTION( sXML_n_text_old, "http://sun.com/xmlns/staroffice/text" );
+XML_CONSTASCII_ACTION( sXML_np_table, "table" );
+XML_CONSTASCII_ACTION( sXML_n_table, "http://openoffice.org/2000/table" );
+XML_CONSTASCII_ACTION( sXML_n_table_old, "http://sun.com/xmlns/staroffice/table" );
+XML_CONSTASCII_ACTION( sXML_np_draw, "draw" );
+XML_CONSTASCII_ACTION( sXML_n_draw, "http://openoffice.org/2000/drawing" );
+XML_CONSTASCII_ACTION( sXML_np_dr3d, "dr3d" );
+XML_CONSTASCII_ACTION( sXML_n_dr3d, "http://openoffice.org/2000/dr3d" );
+XML_CONSTASCII_ACTION( sXML_n_draw_old, "http://sun.com/xmlns/staroffice/draw" );
+XML_CONSTASCII_ACTION( sXML_np_presentation, "presentation" );
+XML_CONSTASCII_ACTION( sXML_n_presentation, "http://openoffice.org/2000/presentation" );
+XML_CONSTASCII_ACTION( sXML_n_presentation_old, "http://sun.com/xmlns/staroffice/presentation" );
+XML_CONSTASCII_ACTION( sXML_np_chart, "chart" );
+XML_CONSTASCII_ACTION( sXML_n_chart, "http://openoffice.org/2000/chart" );
+XML_CONSTASCII_ACTION( sXML_np_config, "config" );
+XML_CONSTASCII_ACTION( sXML_n_config, "http://openoffice.org/2001/config" );
+XML_CONSTASCII_ACTION( sXML_n_chart_old, "http://sun.com/xmlns/staroffice/chart" );
+XML_CONSTASCII_ACTION( sXML_np_fo, "fo" );
+XML_CONSTASCII_ACTION( sXML_n_fo_old, "http://www.w3.org/1999/XSL/Format/" );
+XML_CONSTASCII_ACTION( sXML_n_fo, "http://www.w3.org/1999/XSL/Format" );
+XML_CONSTASCII_ACTION( sXML_np_xlink, "xlink" );
+XML_CONSTASCII_ACTION( sXML_n_xlink, "http://www.w3.org/1999/xlink" );
+XML_CONSTASCII_ACTION( sXML_n_xlink_old, "http://www.w3.org/1999/xlink/namespace" );
+XML_CONSTASCII_ACTION( sXML_np_dc, "dc" );
+XML_CONSTASCII_ACTION( sXML_n_dc, "http://purl.org/dc/elements/1.1/" );
+XML_CONSTASCII_ACTION( sXML_np_svg, "svg" );
+XML_CONSTASCII_ACTION( sXML_n_svg, "http://www.w3.org/2000/svg" );
+XML_CONSTASCII_ACTION( sXML_namespace_form, "form" );
+XML_CONSTASCII_ACTION( sXML_url_form, "http://openoffice.org/2000/form" );
+XML_CONSTASCII_ACTION( sXML_namespace_script, "script" );
+XML_CONSTASCII_ACTION( sXML_url_script, "http://openoffice.org/2000/script" );
+
+XML_CONSTASCII_ACTION( sXML_np_block_list, "block-list");
+XML_CONSTASCII_ACTION( sXML_n_block_list, "http://openoffice.org/2001/block-list" );
+
+XML_CONSTASCII_ACTION( sXML_np_math, "math");
+XML_CONSTASCII_ACTION( sXML_n_math, "http://www.w3.org/1998/Math/MathML" );
+
+XML_CONSTASCII_ACTION( sXML_np_versions_list, "VL");
+XML_CONSTASCII_ACTION( sXML_n_versions_list, "http://openoffice.org/2001/versions-list" );
+
+// units
+XML_CONSTASCII_ACTION( sXML_unit_mm, "mm" );
+XML_CONSTASCII_ACTION( sXML_unit_m, "m" );
+XML_CONSTASCII_ACTION( sXML_unit_km, "km" );
+XML_CONSTASCII_ACTION( sXML_unit_cm, "cm" );
+XML_CONSTASCII_ACTION( sXML_unit_pt, "pt" );
+XML_CONSTASCII_ACTION( sXML_unit_pc, "pc" );
+XML_CONSTASCII_ACTION( sXML_unit_foot, "ft" );
+XML_CONSTASCII_ACTION( sXML_unit_miles, "mi" );
+XML_CONSTASCII_ACTION( sXML_unit_inch, "inch" );
+
+// any other
+XML_CONSTASCII_ACTION( sXML_1, "1" );
+XML_CONSTASCII_ACTION( sXML_10, "10" );
+XML_CONSTASCII_ACTION( sXML_2, "2" );
+XML_CONSTASCII_ACTION( sXML_3, "3" );
+XML_CONSTASCII_ACTION( sXML_4, "4" );
+XML_CONSTASCII_ACTION( sXML_5, "5" );
+XML_CONSTASCII_ACTION( sXML_6, "6" );
+XML_CONSTASCII_ACTION( sXML_7, "7" );
+XML_CONSTASCII_ACTION( sXML_8, "8" );
+XML_CONSTASCII_ACTION( sXML_9, "9" );
+XML_CONSTASCII_ACTION( sXML_A, "A" );
+XML_CONSTASCII_ACTION( sXML_I, "I" );
+XML_CONSTASCII_ACTION( sXML_IBM437, "IBM437" );
+XML_CONSTASCII_ACTION( sXML_IBM850, "IBM850" );
+XML_CONSTASCII_ACTION( sXML_IBM860, "IBM860" );
+XML_CONSTASCII_ACTION( sXML_IBM861, "IBM861" );
+XML_CONSTASCII_ACTION( sXML_IBM863, "IBM863" );
+XML_CONSTASCII_ACTION( sXML_IBM865, "IBM865" );
+XML_CONSTASCII_ACTION( sXML_ISO_8859_1, "ISO-8859-1" );
+XML_CONSTASCII_ACTION( sXML_OLE2, "ole2" );
+XML_CONSTASCII_ACTION( sXML__colon, ":" );
+XML_CONSTASCII_ACTION( sXML__empty, "" );
+XML_CONSTASCII_ACTION( sXML__unknown_, "_unknown_" );
+XML_CONSTASCII_ACTION( sXML_a, "a" );
+XML_CONSTASCII_ACTION( sXML_abbreviated_name, "abbreviated-name" );
+XML_CONSTASCII_ACTION( sXML_above, "above" );
+XML_CONSTASCII_ACTION( sXML_abs, "abs" );
+XML_CONSTASCII_ACTION( sXML_accent, "accent" );
+XML_CONSTASCII_ACTION( sXML_accentunder, "accentunder" );
+XML_CONSTASCII_ACTION( sXML_acceptance_state, "acceptance-state" );
+XML_CONSTASCII_ACTION( sXML_accepted, "accepted" );
+XML_CONSTASCII_ACTION( sXML_action, "action" );
+XML_CONSTASCII_ACTION( sXML_active, "active" );
+XML_CONSTASCII_ACTION( sXML_active_split_range, "active-split-range" );
+XML_CONSTASCII_ACTION( sXML_active_table, "active-table" );
+XML_CONSTASCII_ACTION( sXML_actuate, "actuate" );
+XML_CONSTASCII_ACTION( sXML_add_in, "add-in" );
+XML_CONSTASCII_ACTION( sXML_add_in_name, "add-in-name" );
+XML_CONSTASCII_ACTION( sXML_address, "address" );
+XML_CONSTASCII_ACTION( sXML_adjustment, "adjustment" );
+XML_CONSTASCII_ACTION( sXML_algorithm, "algorithm" );
+XML_CONSTASCII_ACTION( sXML_align, "align" );
+XML_CONSTASCII_ACTION( sXML_all, "all" );
+XML_CONSTASCII_ACTION( sXML_allow_empty_cell, "allow-empty-cell" );
+XML_CONSTASCII_ACTION( sXML_alphabetical_index, "alphabetical-index" );
+XML_CONSTASCII_ACTION( sXML_alphabetical_index_auto_mark_file, "alphabetical-index-auto-mark-file" );
+XML_CONSTASCII_ACTION( sXML_alphabetical_index_entry_template, "alphabetical-index-entry-template" );
+XML_CONSTASCII_ACTION( sXML_alphabetical_index_mark, "alphabetical-index-mark" );
+XML_CONSTASCII_ACTION( sXML_alphabetical_index_mark_end, "alphabetical-index-mark-end" );
+XML_CONSTASCII_ACTION( sXML_alphabetical_index_mark_start, "alphabetical-index-mark-start" );
+XML_CONSTASCII_ACTION( sXML_alphabetical_index_source, "alphabetical-index-source" );
+XML_CONSTASCII_ACTION( sXML_alphabetical_separators, "alphabetical-separators" );
+XML_CONSTASCII_ACTION( sXML_alternate, "alternate" );
+XML_CONSTASCII_ACTION( sXML_am_pm, "am-pm" );
+XML_CONSTASCII_ACTION( sXML_ambient_color, "ambient-color");
+XML_CONSTASCII_ACTION( sXML_anchor_page_number, "anchor-page-number" );
+XML_CONSTASCII_ACTION( sXML_anchor_type, "anchor-type" );
+XML_CONSTASCII_ACTION( sXML_and, "and" );
+XML_CONSTASCII_ACTION( sXML_animation, "animation" );
+XML_CONSTASCII_ACTION( sXML_animation_direction, "animation-direction" );
+XML_CONSTASCII_ACTION( sXML_animation_start_inside, "animation-start-inside" );
+XML_CONSTASCII_ACTION( sXML_animation_stop_inside, "animation-stop-inside" );
+XML_CONSTASCII_ACTION( sXML_animation_repeat, "animation-repeat" );
+XML_CONSTASCII_ACTION( sXML_animation_delay, "animation-delay" );
+XML_CONSTASCII_ACTION( sXML_animation_steps, "animation-steps" );
+XML_CONSTASCII_ACTION( sXML_annotation, "annotation" );
+XML_CONSTASCII_ACTION( sXML_annotations, "annotations" );
+XML_CONSTASCII_ACTION( sXML_annote, "annote" );
+XML_CONSTASCII_ACTION( sXML_applet, "applet");
+XML_CONSTASCII_ACTION( sXML_applet_name, "applet-name");
+XML_CONSTASCII_ACTION( sXML_application_data, "application-data");
+XML_CONSTASCII_ACTION( sXML_application_xml, "application-xml");
+XML_CONSTASCII_ACTION( sXML_apply, "apply" );
+XML_CONSTASCII_ACTION( sXML_apply_style_name, "apply-style-name" );
+XML_CONSTASCII_ACTION( sXML_aqua, "aqua" );
+XML_CONSTASCII_ACTION( sXML_arccos, "arccos" );
+XML_CONSTASCII_ACTION( sXML_archive, "archive" );
+XML_CONSTASCII_ACTION( sXML_arcsin, "arcsin" );
+XML_CONSTASCII_ACTION( sXML_arctan, "arctan" );
+XML_CONSTASCII_ACTION( sXML_area, "area" );
+XML_CONSTASCII_ACTION( sXML_area_circle, "area-circle" );
+XML_CONSTASCII_ACTION( sXML_area_polygon, "area-polygon" );
+XML_CONSTASCII_ACTION( sXML_area_rectangle, "area-rectangle" );
+XML_CONSTASCII_ACTION( sXML_article, "article" );
+XML_CONSTASCII_ACTION( sXML_as_char, "as-char" );
+XML_CONSTASCII_ACTION( sXML_ascending, "ascending");
+XML_CONSTASCII_ACTION( sXML_attached_axis, "attached-axis" );
+XML_CONSTASCII_ACTION( sXML_attractive, "attractive");
+XML_CONSTASCII_ACTION( sXML_author, "author" );
+XML_CONSTASCII_ACTION( sXML_author_initials, "author-initials" );
+XML_CONSTASCII_ACTION( sXML_author_name, "author-name" );
+XML_CONSTASCII_ACTION( sXML_auto, "auto" );
+XML_CONSTASCII_ACTION( sXML_auto_grow_height, "auto-grow-height" );
+XML_CONSTASCII_ACTION( sXML_auto_grow_width, "auto-grow-width" );
+XML_CONSTASCII_ACTION( sXML_auto_reload, "auto-reload" );
+XML_CONSTASCII_ACTION( sXML_auto_text, "auto-text" );
+XML_CONSTASCII_ACTION( sXML_auto_text_events, "auto-text-events" );
+XML_CONSTASCII_ACTION( sXML_auto_text_group, "auto-text-group" );
+XML_CONSTASCII_ACTION( sXML_auto_text_indent, "auto-text-indent" );
+XML_CONSTASCII_ACTION( sXML_up, "up" );
+XML_CONSTASCII_ACTION( sXML_auto_update, "auto-update" );
+XML_CONSTASCII_ACTION( sXML_automatic, "automatic");
+XML_CONSTASCII_ACTION( sXML_automatic_find_labels, "automatic-find-labels" );
+XML_CONSTASCII_ACTION( sXML_automatic_order, "automatic-order" );
+XML_CONSTASCII_ACTION( sXML_automatic_styles, "automatic-styles" );
+XML_CONSTASCII_ACTION( sXML_automatic_update, "automatic-update" );
+XML_CONSTASCII_ACTION( sXML_average, "average" );
+XML_CONSTASCII_ACTION( sXML_axis, "axis" );
+XML_CONSTASCII_ACTION( sXML_back_scale, "back-scale" );
+XML_CONSTASCII_ACTION( sXML_backface_culling, "backface-culling" );
+XML_CONSTASCII_ACTION( sXML_background, "background" );
+XML_CONSTASCII_ACTION( sXML_background_color, "background-color" );
+XML_CONSTASCII_ACTION( sXML_background_image, "background-image" );
+XML_CONSTASCII_ACTION( sXML_background_no_repeat, "no-repeat" );
+XML_CONSTASCII_ACTION( sXML_background_objects_visible, "background-objects-visible" );
+XML_CONSTASCII_ACTION( sXML_background_repeat, "repeat" );
+XML_CONSTASCII_ACTION( sXML_background_stretch, "stretch" );
+XML_CONSTASCII_ACTION( sXML_background_visible, "background-visible" );
+XML_CONSTASCII_ACTION( sXML_bar, "bar" );
+XML_CONSTASCII_ACTION( sXML_base64Binary, "base64Binary");
+XML_CONSTASCII_ACTION( sXML_base_cell_address, "base-cell-address");
+XML_CONSTASCII_ACTION( sXML_baseline, "baseline" );
+XML_CONSTASCII_ACTION( sXML_before_date_time, "before-date-time" );
+XML_CONSTASCII_ACTION( sXML_below , "below" );
+XML_CONSTASCII_ACTION( sXML_between_date_times, "between-date-times" );
+XML_CONSTASCII_ACTION( sXML_bevel , "bevel" );
+XML_CONSTASCII_ACTION( sXML_bibiliographic_type, "bibiliographic-type" );
+XML_CONSTASCII_ACTION( sXML_bibliography, "bibliography" );
+XML_CONSTASCII_ACTION( sXML_bibliography_configuration, "bibliography-configuration" );
+XML_CONSTASCII_ACTION( sXML_bibliography_data_field, "bibliography-data-field" );
+XML_CONSTASCII_ACTION( sXML_bibliography_entry_template, "bibliography-entry-template" );
+XML_CONSTASCII_ACTION( sXML_bibliography_mark, "bibliography-mark" );
+XML_CONSTASCII_ACTION( sXML_bibliography_source, "bibliography-source" );
+XML_CONSTASCII_ACTION( sXML_bibliography_type, "bibliography-type" );
+XML_CONSTASCII_ACTION( sXML_bind_styles_to_content, "bind-styles-to-content");
+XML_CONSTASCII_ACTION( sXML_bitmap , "bitmap" );
+XML_CONSTASCII_ACTION( sXML_black, "black" );
+XML_CONSTASCII_ACTION( sXML_blend, "blend" );
+XML_CONSTASCII_ACTION( sXML_blinking, "blinking" );
+XML_CONSTASCII_ACTION( sXML_block, "block" );
+XML_CONSTASCII_ACTION( sXML_block_list, "block-list" );
+XML_CONSTASCII_ACTION( sXML_blue , "blue" );
+XML_CONSTASCII_ACTION( sXML_body, "body" );
+XML_CONSTASCII_ACTION( sXML_bold, "bold" );
+XML_CONSTASCII_ACTION( sXML_book, "book" );
+XML_CONSTASCII_ACTION( sXML_booklet, "booklet" );
+XML_CONSTASCII_ACTION( sXML_bookmark, "bookmark" );
+XML_CONSTASCII_ACTION( sXML_bookmark_end, "bookmark-end" );
+XML_CONSTASCII_ACTION( sXML_bookmark_ref, "bookmark-ref" );
+XML_CONSTASCII_ACTION( sXML_bookmark_start, "bookmark-start" );
+XML_CONSTASCII_ACTION( sXML_booktitle, "booktitle" );
+XML_CONSTASCII_ACTION( sXML_boolean, "boolean");
+XML_CONSTASCII_ACTION( sXML_boolean_style, "boolean-style" );
+XML_CONSTASCII_ACTION( sXML_boolean_value, "boolean-value");
+XML_CONSTASCII_ACTION( sXML_border, "border" );
+XML_CONSTASCII_ACTION( sXML_border_bottom, "border-bottom" );
+XML_CONSTASCII_ACTION( sXML_border_color, "border-color" );
+XML_CONSTASCII_ACTION( sXML_border_left, "border-left" );
+XML_CONSTASCII_ACTION( sXML_border_line_width, "border-line-width" );
+XML_CONSTASCII_ACTION( sXML_border_line_width_bottom, "border-line-width-bottom" );
+XML_CONSTASCII_ACTION( sXML_border_line_width_left, "border-line-width-left" );
+XML_CONSTASCII_ACTION( sXML_border_line_width_right, "border-line-width-right" );
+XML_CONSTASCII_ACTION( sXML_border_line_width_top, "border-line-width-top" );
+XML_CONSTASCII_ACTION( sXML_border_right, "border-right" );
+XML_CONSTASCII_ACTION( sXML_border_top, "border-top" );
+XML_CONSTASCII_ACTION( sXML_both, "both");
+XML_CONSTASCII_ACTION( sXML_bottom, "bottom" );
+XML_CONSTASCII_ACTION( sXML_bottom_percent, "bottom percent");
+XML_CONSTASCII_ACTION( sXML_bottom_values, "bottom values");
+XML_CONSTASCII_ACTION( sXML_break_after, "break-after" );
+XML_CONSTASCII_ACTION( sXML_break_before, "break-before" );
+XML_CONSTASCII_ACTION( sXML_break_inside, "break-inside" );
+XML_CONSTASCII_ACTION( sXML_bubble, "bubble" );
+XML_CONSTASCII_ACTION( sXML_bullet_char, "bullet-char" );
+XML_CONSTASCII_ACTION( sXML_bullet_relative_size, "bullet-relative-size" );
+XML_CONSTASCII_ACTION( sXML_buttons, "buttons");
+XML_CONSTASCII_ACTION( sXML_bvar, "bvar");
+XML_CONSTASCII_ACTION( sXML_c, "c" );
+XML_CONSTASCII_ACTION( sXML_cm, "cm" );
+XML_CONSTASCII_ACTION( sXML_calculation_settings, "calculation-settings" );
+XML_CONSTASCII_ACTION( sXML_calendar, "calendar" );
+XML_CONSTASCII_ACTION( sXML_capitalize_entries, "capitalize-entries" );
+XML_CONSTASCII_ACTION( sXML_caption, "caption" );
+XML_CONSTASCII_ACTION( sXML_caption_point_x, "caption-point-x" );
+XML_CONSTASCII_ACTION( sXML_caption_point_y, "caption-point-y" );
+XML_CONSTASCII_ACTION( sXML_caption_sequence_format, "caption-sequence-format" );
+XML_CONSTASCII_ACTION( sXML_caption_sequence_name, "caption-sequence-name" );
+XML_CONSTASCII_ACTION( sXML_case_sensitive, "case-sensitive");
+XML_CONSTASCII_ACTION( sXML_casemap_capitalize, "capitalize" );
+XML_CONSTASCII_ACTION( sXML_casemap_lowercase, "lowercase" );
+XML_CONSTASCII_ACTION( sXML_casemap_normal, "normal" );
+XML_CONSTASCII_ACTION( sXML_casemap_small_caps, "small-caps" );
+XML_CONSTASCII_ACTION( sXML_casemap_uppercase, "uppercase" );
+XML_CONSTASCII_ACTION( sXML_categories, "categories" );
+XML_CONSTASCII_ACTION( sXML_category, "category" );
+XML_CONSTASCII_ACTION( sXML_category_and_value, "category-and-value" );
+XML_CONSTASCII_ACTION( sXML_cell_address, "cell-address");
+XML_CONSTASCII_ACTION( sXML_cell_content_change, "cell-content-change");
+XML_CONSTASCII_ACTION( sXML_cell_content_deletion, "cell-content-deletion");
+XML_CONSTASCII_ACTION( sXML_cell_count, "cell-count");
+XML_CONSTASCII_ACTION( sXML_cell_protect, "cell-protect");
+XML_CONSTASCII_ACTION( sXML_cell_range_address, "cell-range-address");
+XML_CONSTASCII_ACTION( sXML_cell_range_address_list, "cell-range-address-list");
+XML_CONSTASCII_ACTION( sXML_cell_range_source, "cell-range-source");
+XML_CONSTASCII_ACTION( sXML_center, "center" );
+XML_CONSTASCII_ACTION( sXML_chain_next_name, "chain-next-name" );
+XML_CONSTASCII_ACTION( sXML_change, "change" );
+XML_CONSTASCII_ACTION( sXML_change_deletion, "change-deletion" );
+XML_CONSTASCII_ACTION( sXML_change_end, "change-end" );
+XML_CONSTASCII_ACTION( sXML_change_id, "change-id" );
+XML_CONSTASCII_ACTION( sXML_change_info, "change-info" );
+XML_CONSTASCII_ACTION( sXML_change_start, "change-start" );
+XML_CONSTASCII_ACTION( sXML_change_track_table_cell, "change-track-table-cell" );
+XML_CONSTASCII_ACTION( sXML_change_view_conditions, "change-view-conditions" );
+XML_CONSTASCII_ACTION( sXML_change_view_settings, "change-view-settings" );
+XML_CONSTASCII_ACTION( sXML_changed_region, "changed-region" );
+XML_CONSTASCII_ACTION( sXML_chapter, "chapter");
+XML_CONSTASCII_ACTION( sXML_char, "char" );
+XML_CONSTASCII_ACTION( sXML_character_count, "character-count" );
+XML_CONSTASCII_ACTION( sXML_chart, "chart" );
+XML_CONSTASCII_ACTION( sXML_charts, "charts" );
+XML_CONSTASCII_ACTION( sXML_chg_author, "chg-author" );
+XML_CONSTASCII_ACTION( sXML_chg_comment, "chg-comment" );
+XML_CONSTASCII_ACTION( sXML_chg_date_time, "chg-date-time" );
+XML_CONSTASCII_ACTION( sXML_ci, "ci" );
+XML_CONSTASCII_ACTION( sXML_circle, "circle" );
+XML_CONSTASCII_ACTION( sXML_citation_body_style_name, "citation-body-style-name" );
+XML_CONSTASCII_ACTION( sXML_citation_style_name, "citation-style-name" );
+XML_CONSTASCII_ACTION( sXML_class, "class" );
+XML_CONSTASCII_ACTION( sXML_class_id, "class-id" );
+XML_CONSTASCII_ACTION( sXML_clip, "clip" );
+XML_CONSTASCII_ACTION( sXML_clockwise, "clockwise" );
+XML_CONSTASCII_ACTION( sXML_close, "close" );
+XML_CONSTASCII_ACTION( sXML_close_horizontal, "close-horizontal" );
+XML_CONSTASCII_ACTION( sXML_close_vertical, "close-vertical" );
+XML_CONSTASCII_ACTION( sXML_cn, "cn" );
+XML_CONSTASCII_ACTION( sXML_code, "code" );
+XML_CONSTASCII_ACTION( sXML_codebase, "codebase" );
+XML_CONSTASCII_ACTION( sXML_collapse, "collapse" );
+XML_CONSTASCII_ACTION( sXML_color, "color" );
+XML_CONSTASCII_ACTION( sXML_color_inversion , "color-inversion" );
+XML_CONSTASCII_ACTION( sXML_color_mode , "color-mode" );
+XML_CONSTASCII_ACTION( sXML_column, "column" );
+XML_CONSTASCII_ACTION( sXML_column_count, "column-count" );
+XML_CONSTASCII_ACTION( sXML_column_gap, "column-gap" );
+XML_CONSTASCII_ACTION( sXML_column_name, "column-name" );
+XML_CONSTASCII_ACTION( sXML_column_sep, "column-sep" );
+XML_CONSTASCII_ACTION( sXML_column_width, "column-width" );
+XML_CONSTASCII_ACTION( sXML_columns, "columns" );
+XML_CONSTASCII_ACTION( sXML_columnsplit_auto, "auto" );
+XML_CONSTASCII_ACTION( sXML_columnsplit_avoid, "avoid" );
+XML_CONSTASCII_ACTION( sXML_combine_entries, "combine-entries" );
+XML_CONSTASCII_ACTION( sXML_combine_entries_with_dash, "combine-entries-with-dash" );
+XML_CONSTASCII_ACTION( sXML_combine_entries_with_pp, "combine-entries-with-pp" );
+XML_CONSTASCII_ACTION( sXML_comma_separated, "comma-separated" );
+XML_CONSTASCII_ACTION( sXML_command, "command" );
+XML_CONSTASCII_ACTION( sXML_comment, "comment" );
+XML_CONSTASCII_ACTION( sXML_compose, "compose" );
+XML_CONSTASCII_ACTION( sXML_cond_style_name, "cond-style-name" );
+XML_CONSTASCII_ACTION( sXML_condition, "condition" );
+XML_CONSTASCII_ACTION( sXML_condition_source, "condition-source");
+XML_CONSTASCII_ACTION( sXML_condition_source_range_address, "condition-source-range-address");
+XML_CONSTASCII_ACTION( sXML_conditional_text, "conditional-text" );
+XML_CONSTASCII_ACTION( sXML_cone, "cone" );
+XML_CONSTASCII_ACTION( sXML_conference, "conference" );
+XML_CONSTASCII_ACTION( sXML_config_item, "config-item" );
+XML_CONSTASCII_ACTION( sXML_config_item_map_indexed, "config-item-map-indexed" );
+XML_CONSTASCII_ACTION( sXML_config_item_map_named, "config-item-map-named" );
+XML_CONSTASCII_ACTION( sXML_config_item_map_entry, "config-item-map-entry" );
+XML_CONSTASCII_ACTION( sXML_config_item_set, "config-item-set" );
+XML_CONSTASCII_ACTION( sXML_configuration_settings, "configuration-settings" );
+XML_CONSTASCII_ACTION( sXML_conjugate, "conjugate" );
+XML_CONSTASCII_ACTION( sXML_connect_bars, "connect-bars" );
+XML_CONSTASCII_ACTION( sXML_connection_name, "connection-name" );
+XML_CONSTASCII_ACTION( sXML_connector, "connector" );
+XML_CONSTASCII_ACTION( sXML_consecutive_numbering, "consecutive-numbering" );
+XML_CONSTASCII_ACTION( sXML_consolidation, "consolidation" );
+XML_CONSTASCII_ACTION( sXML_constant, "constant" );
+XML_CONSTASCII_ACTION( sXML_contains_error, "contains-error");
+XML_CONSTASCII_ACTION( sXML_contains_header, "contains-header");
+XML_CONSTASCII_ACTION( sXML_content, "content" );
+XML_CONSTASCII_ACTION( sXML_content_validation, "content-validation");
+XML_CONSTASCII_ACTION( sXML_content_validation_name, "validation-name");
+XML_CONSTASCII_ACTION( sXML_content_validations, "content-validations");
+XML_CONSTASCII_ACTION( sXML_continue, "continue" );
+XML_CONSTASCII_ACTION( sXML_continue_numbering, "continue-numbering" );
+XML_CONSTASCII_ACTION( sXML_contour_path, "contour-path" );
+XML_CONSTASCII_ACTION( sXML_contour_polygon, "contour-polygon" );
+XML_CONSTASCII_ACTION( sXML_contrast , "contrast" );
+XML_CONSTASCII_ACTION( sXML_control, "control" );
+XML_CONSTASCII_ACTION( sXML_conversion_mode, "conversion-mode" );
+XML_CONSTASCII_ACTION( sXML_copy_back, "copy-back" );
+XML_CONSTASCII_ACTION( sXML_copy_formulas, "copy-formulas" );
+XML_CONSTASCII_ACTION( sXML_copy_outline_levels, "copy-outline-levels" );
+XML_CONSTASCII_ACTION( sXML_copy_results_only, "copy-results-only" );
+XML_CONSTASCII_ACTION( sXML_copy_styles, "copy-styles" );
+XML_CONSTASCII_ACTION( sXML_corner_radius , "corner-radius" );
+XML_CONSTASCII_ACTION( sXML_correct, "correct");
+XML_CONSTASCII_ACTION( sXML_cos, "cos" );
+XML_CONSTASCII_ACTION( sXML_cosh, "cosh" );
+XML_CONSTASCII_ACTION( sXML_cot, "cot" );
+XML_CONSTASCII_ACTION( sXML_coth, "coth" );
+XML_CONSTASCII_ACTION( sXML_count, "count" );
+XML_CONSTASCII_ACTION( sXML_count_empty_lines, "count-empty-lines" );
+XML_CONSTASCII_ACTION( sXML_count_in_floating_frames, "count-in-floating-frames" );
+XML_CONSTASCII_ACTION( sXML_counterclockwise, "counterclockwise" );
+XML_CONSTASCII_ACTION( sXML_countnums, "countnums" );
+XML_CONSTASCII_ACTION( sXML_country, "country" );
+XML_CONSTASCII_ACTION( sXML_country_asian, "country-asian" );
+XML_CONSTASCII_ACTION( sXML_country_complex, "country-complex" );
+XML_CONSTASCII_ACTION( sXML_covered_table_cell, "covered-table-cell" );
+XML_CONSTASCII_ACTION( sXML_create_date, "create-date" );
+XML_CONSTASCII_ACTION( sXML_create_date_string, "create-date-string" );
+XML_CONSTASCII_ACTION( sXML_creation_date, "creation-date" );
+XML_CONSTASCII_ACTION( sXML_creation_time, "creation-time" );
+XML_CONSTASCII_ACTION( sXML_creator, "creator" );
+XML_CONSTASCII_ACTION( sXML_crossedout_cross, "X" );
+XML_CONSTASCII_ACTION( sXML_crossedout_double, "double-line" );
+XML_CONSTASCII_ACTION( sXML_crossedout_none, "none" );
+XML_CONSTASCII_ACTION( sXML_crossedout_single, "single-line" );
+XML_CONSTASCII_ACTION( sXML_crossedout_slash, "slash" );
+XML_CONSTASCII_ACTION( sXML_crossedout_thick, "thick-line" );
+XML_CONSTASCII_ACTION( sXML_csc, "csc" );
+XML_CONSTASCII_ACTION( sXML_csch, "csch" );
+XML_CONSTASCII_ACTION( sXML_cube, "cube" );
+XML_CONSTASCII_ACTION( sXML_cuboid, "cuboid" );
+XML_CONSTASCII_ACTION( sXML_currency, "currency");
+XML_CONSTASCII_ACTION( sXML_currency_style, "currency-style" );
+XML_CONSTASCII_ACTION( sXML_currency_symbol, "currency-symbol" );
+XML_CONSTASCII_ACTION( sXML_current, "current" );
+XML_CONSTASCII_ACTION( sXML_current_value, "current-value" );
+XML_CONSTASCII_ACTION( sXML_cursor_position, "cursor-position" );
+XML_CONSTASCII_ACTION( sXML_cursor_position_x, "cursor-position-x" );
+XML_CONSTASCII_ACTION( sXML_cursor_position_y, "cursor-position-y" );
+XML_CONSTASCII_ACTION( sXML_custom1, "custom1" );
+XML_CONSTASCII_ACTION( sXML_custom2, "custom2" );
+XML_CONSTASCII_ACTION( sXML_custom3, "custom3" );
+XML_CONSTASCII_ACTION( sXML_custom4, "custom4" );
+XML_CONSTASCII_ACTION( sXML_custom5, "custom5" );
+XML_CONSTASCII_ACTION( sXML_cut_offs, "cut_offs" );
+XML_CONSTASCII_ACTION( sXML_cx, "cx" );
+XML_CONSTASCII_ACTION( sXML_cy, "cy" );
+XML_CONSTASCII_ACTION( sXML_cylinder, "cylinder" );
+XML_CONSTASCII_ACTION( sXML_d, "d" );
+XML_CONSTASCII_ACTION( sXML_dash, "dash" );
+XML_CONSTASCII_ACTION( sXML_dashed, "dashed" );
+XML_CONSTASCII_ACTION( sXML_data, "data");
+XML_CONSTASCII_ACTION( sXML_data_cell_range_address, "data-cell-range-address" );
+XML_CONSTASCII_ACTION( sXML_data_label_number, "data-label-number" );
+XML_CONSTASCII_ACTION( sXML_data_label_symbol, "data-label-symbol" );
+XML_CONSTASCII_ACTION( sXML_data_label_text, "data-label-text" );
+XML_CONSTASCII_ACTION( sXML_data_pilot_field, "data-pilot-field");
+XML_CONSTASCII_ACTION( sXML_data_pilot_level, "data-pilot-level");
+XML_CONSTASCII_ACTION( sXML_data_pilot_member, "data-pilot-member");
+XML_CONSTASCII_ACTION( sXML_data_pilot_members, "data-pilot-members");
+XML_CONSTASCII_ACTION( sXML_data_pilot_subtotal, "data-pilot-subtotal");
+XML_CONSTASCII_ACTION( sXML_data_pilot_subtotals, "data-pilot-subtotals");
+XML_CONSTASCII_ACTION( sXML_data_pilot_table, "data-pilot-table");
+XML_CONSTASCII_ACTION( sXML_data_pilot_tables, "data-pilot-tables");
+XML_CONSTASCII_ACTION( sXML_data_point, "data-point" );
+XML_CONSTASCII_ACTION( sXML_data_style, "data-style" );
+XML_CONSTASCII_ACTION( sXML_data_style_name, "data-style-name" );
+XML_CONSTASCII_ACTION( sXML_data_type, "data-type");
+XML_CONSTASCII_ACTION( sXML_database_display, "database-display" );
+XML_CONSTASCII_ACTION( sXML_database_name, "database-name");
+XML_CONSTASCII_ACTION( sXML_database_next, "database-next" );
+XML_CONSTASCII_ACTION( sXML_database_range, "database-range");
+XML_CONSTASCII_ACTION( sXML_database_ranges, "database-ranges");
+XML_CONSTASCII_ACTION( sXML_database_row_number, "database-row-number" );
+XML_CONSTASCII_ACTION( sXML_database_select, "database-select" );
+XML_CONSTASCII_ACTION( sXML_database_source_query, "database-source-query");
+XML_CONSTASCII_ACTION( sXML_database_source_sql, "database-source-sql");
+XML_CONSTASCII_ACTION( sXML_database_source_table, "database-source-table");
+XML_CONSTASCII_ACTION( sXML_date, "date" );
+XML_CONSTASCII_ACTION( sXML_datetime, "datetime" );
+XML_CONSTASCII_ACTION( sXML_date_adjust, "date-adjust" );
+XML_CONSTASCII_ACTION( sXML_date_style, "date-style" );
+XML_CONSTASCII_ACTION( sXML_date_time, "date-time" );
+XML_CONSTASCII_ACTION( sXML_date_value, "date-value");
+XML_CONSTASCII_ACTION( sXML_day, "day" );
+XML_CONSTASCII_ACTION( sXML_day_of_week, "day-of-week" );
+XML_CONSTASCII_ACTION( sXML_dde_application, "dde-application" );
+XML_CONSTASCII_ACTION( sXML_dde_connection, "dde-connection" );
+XML_CONSTASCII_ACTION( sXML_dde_connection_decl, "dde-connection-decl" );
+XML_CONSTASCII_ACTION( sXML_dde_connection_decls, "dde-connection-decls" );
+XML_CONSTASCII_ACTION( sXML_dde_item, "dde-item" );
+XML_CONSTASCII_ACTION( sXML_dde_link, "dde-link" );
+XML_CONSTASCII_ACTION( sXML_dde_links, "dde-links" );
+XML_CONSTASCII_ACTION( sXML_dde_source, "dde-source" );
+XML_CONSTASCII_ACTION( sXML_dde_topic, "dde-topic" );
+XML_CONSTASCII_ACTION( sXML_decimal_places, "decimal-places" );
+XML_CONSTASCII_ACTION( sXML_decimal_replacement, "decimal-replacement" );
+XML_CONSTASCII_ACTION( sXML_declare, "declare" );
+XML_CONSTASCII_ACTION( sXML_decorate_words_only, "decorate-words-only" );
+XML_CONSTASCII_ACTION( sXML_decorative, "decorative" );
+XML_CONSTASCII_ACTION( sXML_deep, "deep" );
+XML_CONSTASCII_ACTION( sXML_default, "default" );
+XML_CONSTASCII_ACTION( sXML_default_cell_style_name, "default-cell-style-name" );
+XML_CONSTASCII_ACTION( sXML_default_style, "default-style" );
+XML_CONSTASCII_ACTION( sXML_default_style_name, "default-style-name" );
+XML_CONSTASCII_ACTION( sXML_degree, "degree" );
+XML_CONSTASCII_ACTION( sXML_delay, "delay" );
+XML_CONSTASCII_ACTION( sXML_deletion, "deletion" );
+XML_CONSTASCII_ACTION( sXML_deletions, "deletions" );
+XML_CONSTASCII_ACTION( sXML_depth, "depth" );
+XML_CONSTASCII_ACTION( sXML_desc, "desc" );
+XML_CONSTASCII_ACTION( sXML_descending, "descending");
+XML_CONSTASCII_ACTION( sXML_description, "description" );
+XML_CONSTASCII_ACTION( sXML_detective, "detective" );
+XML_CONSTASCII_ACTION( sXML_determinant, "determinant" );
+XML_CONSTASCII_ACTION( sXML_diff, "diff");
+XML_CONSTASCII_ACTION( sXML_diffuse_color, "diffuse-color" );
+XML_CONSTASCII_ACTION( sXML_dependences, "dependences");
+XML_CONSTASCII_ACTION( sXML_dependence, "dependence");
+XML_CONSTASCII_ACTION( sXML_direction, "direction");
+XML_CONSTASCII_ACTION( sXML_disabled, "disabled" );
+XML_CONSTASCII_ACTION( sXML_disc, "disc" );
+XML_CONSTASCII_ACTION( sXML_display, "display" );
+XML_CONSTASCII_ACTION( sXML_display_border, "display-border");
+XML_CONSTASCII_ACTION( sXML_display_details, "display-details");
+XML_CONSTASCII_ACTION( sXML_display_duplicates, "display-duplicates");
+XML_CONSTASCII_ACTION( sXML_display_empty, "display-empty");
+XML_CONSTASCII_ACTION( sXML_display_filter_buttons, "display-filter-buttons");
+XML_CONSTASCII_ACTION( sXML_display_formula, "display-formula" );
+XML_CONSTASCII_ACTION( sXML_display_label, "display-label" );
+XML_CONSTASCII_ACTION( sXML_display_levels, "display-levels" );
+XML_CONSTASCII_ACTION( sXML_display_name, "display-name" );
+XML_CONSTASCII_ACTION( sXML_display_outline_level, "display-outline-level" );
+XML_CONSTASCII_ACTION( sXML_dissolve, "dissolve" );
+XML_CONSTASCII_ACTION( sXML_distance, "distance" );
+XML_CONSTASCII_ACTION( sXML_distribute_letter, "distribute-letter" );
+XML_CONSTASCII_ACTION( sXML_distribute_space, "distribute-space" );
+XML_CONSTASCII_ACTION( sXML_divide, "divide" );
+XML_CONSTASCII_ACTION( sXML_document, "document" );
+XML_CONSTASCII_ACTION( sXML_document_content, "document-content" );
+XML_CONSTASCII_ACTION( sXML_document_meta, "document-meta" );
+XML_CONSTASCII_ACTION( sXML_document_settings, "document-settings" );
+XML_CONSTASCII_ACTION( sXML_document_styles, "document-styles" );
+XML_CONSTASCII_ACTION( sXML_document_statistic, "document-statistic" );
+XML_CONSTASCII_ACTION( sXML_domain, "domain" );
+XML_CONSTASCII_ACTION( sXML_dot, "dot" );
+XML_CONSTASCII_ACTION( sXML_dotted, "dotted" );
+XML_CONSTASCII_ACTION( sXML_double, "double" );
+XML_CONSTASCII_ACTION( sXML_double_sided, "double-sided" );
+XML_CONSTASCII_ACTION( sXML_down, "down" );
+XML_CONSTASCII_ACTION( sXML_draft, "draft");
+XML_CONSTASCII_ACTION( sXML_draw, "draw" );
+XML_CONSTASCII_ACTION( sXML_draw_aspect, "ole-draw-aspect" );
+XML_CONSTASCII_ACTION( sXML_drawing, "drawing" );
+XML_CONSTASCII_ACTION( sXML_drawings, "drawings" );
+XML_CONSTASCII_ACTION( sXML_drawpool , "drawpool" );
+XML_CONSTASCII_ACTION( sXML_drop_cap, "drop-cap" );
+XML_CONSTASCII_ACTION( sXML_dynamic, "dynamic" );
+XML_CONSTASCII_ACTION( sXML_edge_rounding, "edge-rounding" );
+XML_CONSTASCII_ACTION( sXML_editable, "editable" );
+XML_CONSTASCII_ACTION( sXML_editing_cycles, "editing-cycles" );
+XML_CONSTASCII_ACTION( sXML_editing_duration, "editing-duration" );
+XML_CONSTASCII_ACTION( sXML_edition, "edition" );
+XML_CONSTASCII_ACTION( sXML_editor, "editor" );
+XML_CONSTASCII_ACTION( sXML_ellipse , "ellipse" );
+XML_CONSTASCII_ACTION( sXML_email, "email" );
+XML_CONSTASCII_ACTION( sXML_embed, "embed" );
+XML_CONSTASCII_ACTION( sXML_embedded_visible_area, "embedded-visible-area" );
+XML_CONSTASCII_ACTION( sXML_embossed, "embossed" );
+XML_CONSTASCII_ACTION( sXML_emissive_color, "emissive-color" );
+XML_CONSTASCII_ACTION( sXML_empty, "empty");
+XML_CONSTASCII_ACTION( sXML_enabled, "enabled" );
+XML_CONSTASCII_ACTION( sXML_encoding, "encoding" );
+XML_CONSTASCII_ACTION( sXML_end, "end" );
+XML_CONSTASCII_ACTION( sXML_end_angle, "end-angle" );
+XML_CONSTASCII_ACTION( sXML_end_cell_address, "end-cell-address" );
+XML_CONSTASCII_ACTION( sXML_end_color, "end-color" );
+XML_CONSTASCII_ACTION( sXML_end_column, "end-column" );
+XML_CONSTASCII_ACTION( sXML_end_intensity, "end-intensity" );
+XML_CONSTASCII_ACTION( sXML_end_position, "end-position" );
+XML_CONSTASCII_ACTION( sXML_end_row, "end-row" );
+XML_CONSTASCII_ACTION( sXML_end_table, "end-table" );
+XML_CONSTASCII_ACTION( sXML_end_x, "end-x" );
+XML_CONSTASCII_ACTION( sXML_end_y, "end-y" );
+XML_CONSTASCII_ACTION( sXML_endless, "endless" );
+XML_CONSTASCII_ACTION( sXML_endnote, "endnote" );
+XML_CONSTASCII_ACTION( sXML_endnote_body, "endnote-body" );
+XML_CONSTASCII_ACTION( sXML_endnote_citation, "endnote-citation" );
+XML_CONSTASCII_ACTION( sXML_endnote_ref, "endnote-ref" );
+XML_CONSTASCII_ACTION( sXML_endnotes_configuration, "endnotes-configuration");
+XML_CONSTASCII_ACTION( sXML_engraved, "engraved" );
+XML_CONSTASCII_ACTION( sXML_eq, "eq");
+XML_CONSTASCII_ACTION( sXML_equal_author, "equal-author");
+XML_CONSTASCII_ACTION( sXML_equal_comment, "equal-comment");
+XML_CONSTASCII_ACTION( sXML_equal_date, "equal-date");
+XML_CONSTASCII_ACTION( sXML_era, "era" );
+XML_CONSTASCII_ACTION( sXML_ergo_sum, "ergo-sum" );
+XML_CONSTASCII_ACTION( sXML_error_category, "error-category" );
+XML_CONSTASCII_ACTION( sXML_error_lower_indicator, "error-lower-indicator" );
+XML_CONSTASCII_ACTION( sXML_error_lower_limit, "error-lower-limit" );
+XML_CONSTASCII_ACTION( sXML_error_macro, "error-macro" );
+XML_CONSTASCII_ACTION( sXML_error_margin, "error-margin" );
+XML_CONSTASCII_ACTION( sXML_error_message, "error-message" );
+XML_CONSTASCII_ACTION( sXML_error_percentage, "error-percentage" );
+XML_CONSTASCII_ACTION( sXML_error_upper_indicator, "error-upper-indicator" );
+XML_CONSTASCII_ACTION( sXML_error_upper_limit, "error-upper-limit" );
+XML_CONSTASCII_ACTION( sXML_escapement_sub, "sub" );
+XML_CONSTASCII_ACTION( sXML_escapement_super, "super" );
+XML_CONSTASCII_ACTION( sXML_even_page, "even-page" );
+XML_CONSTASCII_ACTION( sXML_event, "event" );
+XML_CONSTASCII_ACTION( sXML_event_name, "event-name" );
+XML_CONSTASCII_ACTION( sXML_events, "events" );
+XML_CONSTASCII_ACTION( sXML_execute, "execute" );
+XML_CONSTASCII_ACTION( sXML_execute_macro, "execute-macro" );
+XML_CONSTASCII_ACTION( sXML_exists, "exists" );
+XML_CONSTASCII_ACTION( sXML_exp, "exp" );
+XML_CONSTASCII_ACTION( sXML_exponential, "exponential" );
+XML_CONSTASCII_ACTION( sXML_expression, "expression");
+XML_CONSTASCII_ACTION( sXML_extra, "extra");
+XML_CONSTASCII_ACTION( sXML_extrude, "extrude" );
+XML_CONSTASCII_ACTION( sXML_factorial, "factorial" );
+XML_CONSTASCII_ACTION( sXML_fade_from_bottom, "fade-from-bottom" );
+XML_CONSTASCII_ACTION( sXML_fade_from_center, "fade-from-center" );
+XML_CONSTASCII_ACTION( sXML_fade_from_left, "fade-from-left" );
+XML_CONSTASCII_ACTION( sXML_fade_from_lowerleft, "fade-from-lowerleft" );
+XML_CONSTASCII_ACTION( sXML_fade_from_lowerright, "fade-from-lowerright" );
+XML_CONSTASCII_ACTION( sXML_fade_from_right, "fade-from-right" );
+XML_CONSTASCII_ACTION( sXML_fade_from_top, "fade-from-top" );
+XML_CONSTASCII_ACTION( sXML_fade_from_upperleft, "fade-from-upperleft" );
+XML_CONSTASCII_ACTION( sXML_fade_from_upperright, "fade-from-upperright" );
+XML_CONSTASCII_ACTION( sXML_fade_to_center, "fade-to-center" );
+XML_CONSTASCII_ACTION( sXML_fade_out, "fade-out" );
+XML_CONSTASCII_ACTION( sXML_false, "false" );
+XML_CONSTASCII_ACTION( sXML_family, "family" );
+XML_CONSTASCII_ACTION( sXML_fast, "fast" );
+XML_CONSTASCII_ACTION( sXML_field_number, "field-number");
+XML_CONSTASCII_ACTION( sXML_file_name, "file-name" );
+XML_CONSTASCII_ACTION( sXML_fill, "fill" );
+XML_CONSTASCII_ACTION( sXML_fill_color , "fill-color" );
+XML_CONSTASCII_ACTION( sXML_fill_gradient_name, "fill-gradient-name" );
+XML_CONSTASCII_ACTION( sXML_fill_hatch_name, "fill-hatch-name" );
+XML_CONSTASCII_ACTION( sXML_fill_hatch_solid, "fill-hatch-solid" );
+XML_CONSTASCII_ACTION( sXML_fill_image, "fill-image" );
+XML_CONSTASCII_ACTION( sXML_fill_image_height, "fill-image-height" );
+XML_CONSTASCII_ACTION( sXML_fill_image_name, "fill-image-name" );
+XML_CONSTASCII_ACTION( sXML_fill_image_width, "fill-image-width" );
+XML_CONSTASCII_ACTION( sXML_filter, "filter");
+XML_CONSTASCII_ACTION( sXML_filter_and, "filter-and");
+XML_CONSTASCII_ACTION( sXML_filter_condition, "filter-condition");
+XML_CONSTASCII_ACTION( sXML_filter_name, "filter-name" );
+XML_CONSTASCII_ACTION( sXML_filter_options, "filter-options" );
+XML_CONSTASCII_ACTION( sXML_filter_or, "filter-or");
+XML_CONSTASCII_ACTION( sXML_first_date_time, "first-date-time");
+XML_CONSTASCII_ACTION( sXML_first_page, "first-page");
+XML_CONSTASCII_ACTION( sXML_first_page_number, "first-page-number");
+XML_CONSTASCII_ACTION( sXML_fit_to_contour, "fit-to-contour");
+XML_CONSTASCII_ACTION( sXML_fit_to_size, "fit-to-size" );
+XML_CONSTASCII_ACTION( sXML_fix, "fix" );
+XML_CONSTASCII_ACTION( sXML_fixed, "fixed" );
+XML_CONSTASCII_ACTION( sXML_flat, "flat" );
+XML_CONSTASCII_ACTION( sXML_float, "float");
+XML_CONSTASCII_ACTION( sXML_floating_frame, "floating-frame");
+XML_CONSTASCII_ACTION( sXML_floor, "floor" );
+XML_CONSTASCII_ACTION( sXML_fn, "fn" );
+XML_CONSTASCII_ACTION( sXML_focal_length, "focal-length");
+XML_CONSTASCII_ACTION( sXML_font_char_width, "font-char-width" );
+XML_CONSTASCII_ACTION( sXML_font_charset, "font-charset" );
+XML_CONSTASCII_ACTION( sXML_font_charset_asian, "font-charset-asian" );
+XML_CONSTASCII_ACTION( sXML_font_charset_complex, "font-charset-complex" );
+XML_CONSTASCII_ACTION( sXML_font_color, "font-color" );
+XML_CONSTASCII_ACTION( sXML_font_decl, "font-decl" );
+XML_CONSTASCII_ACTION( sXML_font_decls, "font-decls" );
+XML_CONSTASCII_ACTION( sXML_font_family, "font-family" );
+XML_CONSTASCII_ACTION( sXML_font_family_asian, "font-family-asian" );
+XML_CONSTASCII_ACTION( sXML_font_family_complex, "font-family-complex" );
+XML_CONSTASCII_ACTION( sXML_font_family_generic, "font-family-generic" );
+XML_CONSTASCII_ACTION( sXML_font_family_generic_asian, "font-family-generic-asian" );
+XML_CONSTASCII_ACTION( sXML_font_family_generic_complex, "font-family-generic-complex" );
+XML_CONSTASCII_ACTION( sXML_font_kerning, "font-kerning" );
+XML_CONSTASCII_ACTION( sXML_font_name, "font-name" );
+XML_CONSTASCII_ACTION( sXML_font_name_asian, "font-name-asian" );
+XML_CONSTASCII_ACTION( sXML_font_name_complex, "font-name-complex" );
+XML_CONSTASCII_ACTION( sXML_font_pitch, "font-pitch" );
+XML_CONSTASCII_ACTION( sXML_font_pitch_asian, "font-pitch-asian" );
+XML_CONSTASCII_ACTION( sXML_font_pitch_complex, "font-pitch-complex" );
+XML_CONSTASCII_ACTION( sXML_font_relief, "font-relief" );
+XML_CONSTASCII_ACTION( sXML_font_size, "font-size" );
+XML_CONSTASCII_ACTION( sXML_font_size_asian, "font-size-asian" );
+XML_CONSTASCII_ACTION( sXML_font_size_complex, "font-size-complex" );
+XML_CONSTASCII_ACTION( sXML_font_size_rel, "font-size-rel" );
+XML_CONSTASCII_ACTION( sXML_font_size_rel_asian, "font-size-rel-asian" );
+XML_CONSTASCII_ACTION( sXML_font_size_rel_complex, "font-size-rel-complex" );
+XML_CONSTASCII_ACTION( sXML_font_style, "font-style" );
+XML_CONSTASCII_ACTION( sXML_font_style_asian, "font-style-asian" );
+XML_CONSTASCII_ACTION( sXML_font_style_complex, "font-style-complex" );
+XML_CONSTASCII_ACTION( sXML_font_style_name, "font-style-name" );
+XML_CONSTASCII_ACTION( sXML_font_style_name_asian, "font-style-name-asian" );
+XML_CONSTASCII_ACTION( sXML_font_style_name_complex, "font-style-name-complex" );
+XML_CONSTASCII_ACTION( sXML_font_variant, "font-variant" );
+XML_CONSTASCII_ACTION( sXML_font_weight, "font-weight" );
+XML_CONSTASCII_ACTION( sXML_font_weight_asian, "font-weight-asian" );
+XML_CONSTASCII_ACTION( sXML_font_weight_complex, "font-weight-complex" );
+XML_CONSTASCII_ACTION( sXML_font_width, "font-width" );
+XML_CONSTASCII_ACTION( sXML_font_word_line_mode, "font-word-line-mode" );
+XML_CONSTASCII_ACTION( sXML_fontfamily, "fontfamily" );
+XML_CONSTASCII_ACTION( sXML_fontsize, "fontsize" );
+XML_CONSTASCII_ACTION( sXML_fontstyle, "fontstyle" );
+XML_CONSTASCII_ACTION( sXML_fontweight, "fontweight" );
+XML_CONSTASCII_ACTION( sXML_fontwork_adjust, "fontwork-adjust" );
+XML_CONSTASCII_ACTION( sXML_fontwork_distance, "fontwork-distance" );
+XML_CONSTASCII_ACTION( sXML_fontwork_form, "fontwork-form" );
+XML_CONSTASCII_ACTION( sXML_fontwork_hide_form, "fontwork-hide-form" );
+XML_CONSTASCII_ACTION( sXML_fontwork_mirror, "fontwork-mirror" );
+XML_CONSTASCII_ACTION( sXML_fontwork_outline, "fontwork-outline" );
+XML_CONSTASCII_ACTION( sXML_fontwork_shadow, "fontwork-shadow" );
+XML_CONSTASCII_ACTION( sXML_fontwork_shadow_color, "fontwork-shadow-color" );
+XML_CONSTASCII_ACTION( sXML_fontwork_shadow_offset_x, "fontwork-shadow-offset-x" );
+XML_CONSTASCII_ACTION( sXML_fontwork_shadow_offset_y, "fontwork-shadow-offset-y" );
+XML_CONSTASCII_ACTION( sXML_fontwork_shadow_transparence, "fontwork-shadow-transparence" );
+XML_CONSTASCII_ACTION( sXML_fontwork_start, "fontwork-start" );
+XML_CONSTASCII_ACTION( sXML_fontwork_style, "fontwork-style" );
+XML_CONSTASCII_ACTION( sXML_footer, "footer" );
+XML_CONSTASCII_ACTION( sXML_footer_left, "footer-left" );
+XML_CONSTASCII_ACTION( sXML_footer_style, "footer-style" );
+XML_CONSTASCII_ACTION( sXML_footnote, "footnote" );
+XML_CONSTASCII_ACTION( sXML_footnote_body, "footnote-body" );
+XML_CONSTASCII_ACTION( sXML_footnote_citation, "footnote-citation" );
+XML_CONSTASCII_ACTION( sXML_footnote_continuation_notice_backward, "footnote-continuation-notice-backward" );
+XML_CONSTASCII_ACTION( sXML_footnote_continuation_notice_forward, "footnote-continuation-notice-forward" );
+XML_CONSTASCII_ACTION( sXML_footnote_max_height, "footnote-max-height" );
+XML_CONSTASCII_ACTION( sXML_distance_after_sep, "distance-after-sep" );
+XML_CONSTASCII_ACTION( sXML_distance_before_sep, "distance-before-sep" );
+XML_CONSTASCII_ACTION( sXML_footnote_ref, "footnote-ref" );
+XML_CONSTASCII_ACTION( sXML_footnote_sep, "footnote-sep" );
+XML_CONSTASCII_ACTION( sXML_footnotes_configuration, "footnotes-configuration");
+XML_CONSTASCII_ACTION( sXML_footnotes_position, "footnotes-position" );
+XML_CONSTASCII_ACTION( sXML_forall, "forall" );
+XML_CONSTASCII_ACTION( sXML_force_manual, "force-manual" );
+XML_CONSTASCII_ACTION( sXML_foreground, "foreground" );
+XML_CONSTASCII_ACTION( sXML_foreign_object, "foreign-object" );
+XML_CONSTASCII_ACTION( sXML_format_change, "format-change" );
+XML_CONSTASCII_ACTION( sXML_format_source, "format-source" );
+XML_CONSTASCII_ACTION( sXML_forms, "forms" );
+XML_CONSTASCII_ACTION( sXML_formula, "formula");
+XML_CONSTASCII_ACTION( sXML_formula_hidden, "formula-hidden");
+XML_CONSTASCII_ACTION( sXML_formulas, "formulas");
+XML_CONSTASCII_ACTION( sXML_fraction, "fraction" );
+XML_CONSTASCII_ACTION( sXML_frame, "frame" );
+XML_CONSTASCII_ACTION( sXML_frame_content, "frame-content" );
+XML_CONSTASCII_ACTION( sXML_frame_display_scrollbar, "frame-display-scrollbar" );
+XML_CONSTASCII_ACTION( sXML_frame_display_border, "frame-display-border" );
+XML_CONSTASCII_ACTION( sXML_frame_margin_horizontal, "frame-margin-horizontal" );
+XML_CONSTASCII_ACTION( sXML_frame_margin_vertical, "frame-margin-vertical" );
+XML_CONSTASCII_ACTION( sXML_frame_end_margin, "frame-end-margin" );
+XML_CONSTASCII_ACTION( sXML_frame_name, "frame-name" );
+XML_CONSTASCII_ACTION( sXML_frame_start_margin, "frame-start-margin" );
+XML_CONSTASCII_ACTION( sXML_freeze, "freeze" );
+XML_CONSTASCII_ACTION( sXML_freeze_position, "freeze-position" );
+XML_CONSTASCII_ACTION( sXML_from_another_table, "from-another-table" );
+XML_CONSTASCII_ACTION( sXML_from_inside, "from-inside" );
+XML_CONSTASCII_ACTION( sXML_from_left, "from-left" );
+XML_CONSTASCII_ACTION( sXML_from_same_table, "from-same-table" );
+XML_CONSTASCII_ACTION( sXML_from_top, "from-top" );
+XML_CONSTASCII_ACTION( sXML_fuchsia, "fuchsia");
+XML_CONSTASCII_ACTION( sXML_full, "full" );
+XML_CONSTASCII_ACTION( sXML_full_screen, "full-screen" );
+XML_CONSTASCII_ACTION( sXML_function, "function");
+XML_CONSTASCII_ACTION( sXML_g , "g" );
+XML_CONSTASCII_ACTION( sXML_gamma , "gamma" );
+XML_CONSTASCII_ACTION( sXML_gap, "gap" );
+XML_CONSTASCII_ACTION( sXML_gap_width, "gap-width" );
+XML_CONSTASCII_ACTION( sXML_gcd, "gcd" );
+XML_CONSTASCII_ACTION( sXML_generator, "generator" );
+XML_CONSTASCII_ACTION( sXML_geq, "geq" );
+XML_CONSTASCII_ACTION( sXML_gouraud, "gouraud");
+XML_CONSTASCII_ACTION( sXML_gradient , "gradient" );
+XML_CONSTASCII_ACTION( sXML_gradient_angle, "angle" );
+XML_CONSTASCII_ACTION( sXML_gradient_border, "border" );
+XML_CONSTASCII_ACTION( sXML_gradient_step_count , "gradient-step-count" );
+XML_CONSTASCII_ACTION( sXML_gradient_style, "gradient-style" );
+XML_CONSTASCII_ACTION( sXML_gradientstyle_axial, "axial" );
+XML_CONSTASCII_ACTION( sXML_gradientstyle_ellipsoid, "ellipsoid" );
+XML_CONSTASCII_ACTION( sXML_gradientstyle_linear, "linear" );
+XML_CONSTASCII_ACTION( sXML_gradientstyle_radial, "radial" );
+XML_CONSTASCII_ACTION( sXML_gradientstyle_rectangular, "rectangular" );
+XML_CONSTASCII_ACTION( sXML_gradientstyle_square, "square" );
+XML_CONSTASCII_ACTION( sXML_grand_total, "grand-total");
+XML_CONSTASCII_ACTION( sXML_graphic , "graphic" );
+XML_CONSTASCII_ACTION( sXML_gray, "gray" );
+XML_CONSTASCII_ACTION( sXML_green , "green" );
+XML_CONSTASCII_ACTION( sXML_greyscale, "greyscale" );
+XML_CONSTASCII_ACTION( sXML_grid, "grid" );
+XML_CONSTASCII_ACTION( sXML_groove, "groove" );
+XML_CONSTASCII_ACTION( sXML_group_by_field_number, "group-by-field-number");
+XML_CONSTASCII_ACTION( sXML_group_name, "group-name" );
+XML_CONSTASCII_ACTION( sXML_grouping, "grouping" );
+XML_CONSTASCII_ACTION( sXML_gt, "gt" );
+XML_CONSTASCII_ACTION( sXML_h, "h" );
+XML_CONSTASCII_ACTION( sXML_hanging, "hanging" );
+XML_CONSTASCII_ACTION( sXML_has_persistent_data, "has-persistent-data");
+XML_CONSTASCII_ACTION( sXML_hatch , "hatch" );
+XML_CONSTASCII_ACTION( sXML_hatch_distance, "distance" );
+XML_CONSTASCII_ACTION( sXML_hatch_style, "style" );
+XML_CONSTASCII_ACTION( sXML_hatchstyle_double, "double" );
+XML_CONSTASCII_ACTION( sXML_hatchstyle_single, "single" );
+XML_CONSTASCII_ACTION( sXML_hatchstyle_triple, "triple" );
+XML_CONSTASCII_ACTION( sXML_header, "header" );
+XML_CONSTASCII_ACTION( sXML_header_left, "header-left" );
+XML_CONSTASCII_ACTION( sXML_header_style, "header-style" );
+XML_CONSTASCII_ACTION( sXML_headers, "headers" );
+XML_CONSTASCII_ACTION( sXML_height, "height" );
+XML_CONSTASCII_ACTION( sXML_help_file_name, "help-file-name" );
+XML_CONSTASCII_ACTION( sXML_help_id, "help-id" );
+XML_CONSTASCII_ACTION( sXML_help_message, "help-message" );
+XML_CONSTASCII_ACTION( sXML_hidden, "hidden" );
+XML_CONSTASCII_ACTION( sXML_hidden_and_protected, "hidden-and-protected");
+XML_CONSTASCII_ACTION( sXML_hidden_paragraph, "hidden-paragraph" );
+XML_CONSTASCII_ACTION( sXML_hidden_text, "hidden-text" );
+XML_CONSTASCII_ACTION( sXML_highlighted_range, "highlighted-range" );
+XML_CONSTASCII_ACTION( sXML_horizontal, "horizontal" );
+XML_CONSTASCII_ACTION( sXML_horizontal_lines, "horizontal-lines" );
+XML_CONSTASCII_ACTION( sXML_horizontal_on_left_pages, "horizontal-on-left-pages" );
+XML_CONSTASCII_ACTION( sXML_horizontal_on_right_pages, "horizontal-on-right-pages" );
+XML_CONSTASCII_ACTION( sXML_horizontal_pos, "horizontal-pos" );
+XML_CONSTASCII_ACTION( sXML_horizontal_rel, "horizontal-rel" );
+XML_CONSTASCII_ACTION( sXML_horizontal_scrollbar_width, "horizontal-scrollbar-width" );
+XML_CONSTASCII_ACTION( sXML_horizontal_segments, "horizontal-segments" );
+XML_CONSTASCII_ACTION( sXML_horizontal_split_mode, "horizontal-split-mode" );
+XML_CONSTASCII_ACTION( sXML_horizontal_split_position, "horizontal-split-position" );
+XML_CONSTASCII_ACTION( sXML_horizontal_stripes, "horizontal-stripes" );
+XML_CONSTASCII_ACTION( sXML_hours, "hours" );
+XML_CONSTASCII_ACTION( sXML_howpublished, "howpublished" );
+XML_CONSTASCII_ACTION( sXML_href, "href" );
+XML_CONSTASCII_ACTION( sXML_html, "html");
+XML_CONSTASCII_ACTION( sXML_hyperlink_behaviour, "hyperlink-behaviour" );
+XML_CONSTASCII_ACTION( sXML_hyphenate, "hyphenate" );
+XML_CONSTASCII_ACTION( sXML_hyphenation_keep, "hyphenation-keep" );
+XML_CONSTASCII_ACTION( sXML_hyphenation_ladder_count, "hyphenation-ladder-count" );
+XML_CONSTASCII_ACTION( sXML_hyphenation_push_char_count, "hyphenation-push-char-count" );
+XML_CONSTASCII_ACTION( sXML_hyphenation_remain_char_count, "hyphenation-remain-char-count" );
+XML_CONSTASCII_ACTION( sXML_i, "i" );
+XML_CONSTASCII_ACTION( sXML_icon, "icon" );
+XML_CONSTASCII_ACTION( sXML_id, "id" );
+XML_CONSTASCII_ACTION( sXML_ident, "ident");
+XML_CONSTASCII_ACTION( sXML_identifier, "identifier" );
+XML_CONSTASCII_ACTION( sXML_identify_categories, "identify-categories");
+XML_CONSTASCII_ACTION( sXML_ideograph_alpha, "ideograph-alpha");
+XML_CONSTASCII_ACTION( sXML_ignore_case, "ignore-case" );
+XML_CONSTASCII_ACTION( sXML_ignore_empty_rows, "ignore-empty-rows");
+XML_CONSTASCII_ACTION( sXML_illustration_index, "illustration-index" );
+XML_CONSTASCII_ACTION( sXML_illustration_index_entry_template, "illustration-index-entry-template" );
+XML_CONSTASCII_ACTION( sXML_illustration_index_source, "illustration-index-source" );
+XML_CONSTASCII_ACTION( sXML_image, "image" );
+XML_CONSTASCII_ACTION( sXML_image_count, "image-count" );
+XML_CONSTASCII_ACTION( sXML_image_map, "image-map" );
+XML_CONSTASCII_ACTION( sXML_implies, "implies" );
+XML_CONSTASCII_ACTION( sXML_in, "in");
+XML_CONSTASCII_ACTION( sXML_in_range, "in-range");
+XML_CONSTASCII_ACTION( sXML_inbook, "inbook" );
+XML_CONSTASCII_ACTION( sXML_incollection, "incollection" );
+XML_CONSTASCII_ACTION( sXML_increment, "increment" );
+XML_CONSTASCII_ACTION( sXML_index, "index");
+XML_CONSTASCII_ACTION( sXML_index_body, "index-body");
+XML_CONSTASCII_ACTION( sXML_index_entry_bibliography, "index-entry-bibliography" );
+XML_CONSTASCII_ACTION( sXML_index_entry_chapter, "index-entry-chapter" );
+XML_CONSTASCII_ACTION( sXML_index_entry_chapter_number, "index-entry-chapter-number" );
+XML_CONSTASCII_ACTION( sXML_index_entry_link_end, "index-entry-link-end" );
+XML_CONSTASCII_ACTION( sXML_index_entry_link_start, "index-entry-link-start" );
+XML_CONSTASCII_ACTION( sXML_index_entry_page_number, "index-entry-page-number" );
+XML_CONSTASCII_ACTION( sXML_index_entry_span, "index-entry-span" );
+XML_CONSTASCII_ACTION( sXML_index_entry_tab_stop, "index-entry-tab-stop" );
+XML_CONSTASCII_ACTION( sXML_index_entry_template, "index-entry-template" );
+XML_CONSTASCII_ACTION( sXML_index_entry_text, "index-entry-text" );
+XML_CONSTASCII_ACTION( sXML_index_name, "index-name" );
+XML_CONSTASCII_ACTION( sXML_index_scope, "index-scope" );
+XML_CONSTASCII_ACTION( sXML_index_source_style, "index-source-style" );
+XML_CONSTASCII_ACTION( sXML_index_source_styles, "index-source-styles" );
+XML_CONSTASCII_ACTION( sXML_index_title, "index-title" );
+XML_CONSTASCII_ACTION( sXML_index_title_template, "index-title-template" );
+XML_CONSTASCII_ACTION( sXML_information, "information" );
+XML_CONSTASCII_ACTION( sXML_initial_creator, "initial-creator" );
+XML_CONSTASCII_ACTION( sXML_inproceedings, "inproceedings" );
+XML_CONSTASCII_ACTION( sXML_insertion, "insertion" );
+XML_CONSTASCII_ACTION( sXML_insertion_cut_off, "insertion-cut-off" );
+XML_CONSTASCII_ACTION( sXML_inset, "inset" );
+XML_CONSTASCII_ACTION( sXML_inside, "inside" );
+XML_CONSTASCII_ACTION( sXML_institution, "institution" );
+XML_CONSTASCII_ACTION( sXML_int, "int" );
+XML_CONSTASCII_ACTION( sXML_intensity, "intensity" );
+XML_CONSTASCII_ACTION( sXML_intersect, "intersect" );
+XML_CONSTASCII_ACTION( sXML_interval, "interval" );
+XML_CONSTASCII_ACTION( sXML_interval_major, "interval-major" );
+XML_CONSTASCII_ACTION( sXML_interval_minor, "interval-minor" );
+XML_CONSTASCII_ACTION( sXML_into_english_number, "into-english-number" );
+XML_CONSTASCII_ACTION( sXML_inverse, "inverse" );
+XML_CONSTASCII_ACTION( sXML_is_active, "is-active");
+XML_CONSTASCII_ACTION( sXML_is_data_layout_field, "is-data-layout-field");
+XML_CONSTASCII_ACTION( sXML_is_hidden, "is-hidden" );
+XML_CONSTASCII_ACTION( sXML_is_selection, "is-selection");
+XML_CONSTASCII_ACTION( sXML_isbn, "isbn" );
+XML_CONSTASCII_ACTION( sXML_italic, "italic" );
+XML_CONSTASCII_ACTION( sXML_iteration, "iteration" );
+XML_CONSTASCII_ACTION( sXML_journal, "journal" );
+XML_CONSTASCII_ACTION( sXML_justified, "justified" );
+XML_CONSTASCII_ACTION( sXML_justify, "justify" );
+XML_CONSTASCII_ACTION( sXML_justify_single_word, "justify-single-word" );
+XML_CONSTASCII_ACTION( sXML_keep_with_next, "keep-with-next" );
+XML_CONSTASCII_ACTION( sXML_kerning_normal, "normal" );
+XML_CONSTASCII_ACTION( sXML_key, "key" );
+XML_CONSTASCII_ACTION( sXML_key1, "key1" );
+XML_CONSTASCII_ACTION( sXML_key2, "key2" );
+XML_CONSTASCII_ACTION( sXML_keyword, "keyword" );
+XML_CONSTASCII_ACTION( sXML_keywords, "keywords" );
+XML_CONSTASCII_ACTION( sXML_km, "km" );
+XML_CONSTASCII_ACTION( sXML_label, "label" );
+XML_CONSTASCII_ACTION( sXML_label_arrangement, "label-arrangement" );
+XML_CONSTASCII_ACTION( sXML_label_cell_address, "label-cell-address" );
+XML_CONSTASCII_ACTION( sXML_label_cell_range_address, "label-cell-range-address" );
+XML_CONSTASCII_ACTION( sXML_label_range, "label-range" );
+XML_CONSTASCII_ACTION( sXML_label_ranges, "label-ranges" );
+XML_CONSTASCII_ACTION( sXML_layer, "layer" );
+XML_CONSTASCII_ACTION( sXML_layer_set, "layer-set" );
+XML_CONSTASCII_ACTION( sXML_lambda, "lambda" );
+XML_CONSTASCII_ACTION( sXML_landscape, "landscape" );
+XML_CONSTASCII_ACTION( sXML_language, "language" );
+XML_CONSTASCII_ACTION( sXML_language_asian, "language-asian" );
+XML_CONSTASCII_ACTION( sXML_language_complex, "language-complex" );
+XML_CONSTASCII_ACTION( sXML_last_column_spanned, "last-column-spanned" );
+XML_CONSTASCII_ACTION( sXML_last_page, "last-page" );
+XML_CONSTASCII_ACTION( sXML_last_row_spanned, "last-row-spanned" );
+XML_CONSTASCII_ACTION( sXML_leader_char, "leader-char" );
+XML_CONSTASCII_ACTION( sXML_left, "left" );
+XML_CONSTASCII_ACTION( sXML_left_outside, "left-outside" );
+XML_CONSTASCII_ACTION( sXML_left_top_position, "left-top-position" );
+XML_CONSTASCII_ACTION( sXML_legend, "legend" );
+XML_CONSTASCII_ACTION( sXML_legend_position, "legend-position" );
+XML_CONSTASCII_ACTION( sXML_length, "length" );
+XML_CONSTASCII_ACTION( sXML_leq, "leq" );
+XML_CONSTASCII_ACTION( sXML_let_text, "let-text" );
+XML_CONSTASCII_ACTION( sXML_letter_kerning, "letter-kerning" );
+XML_CONSTASCII_ACTION( sXML_letter_spacing, "letter-spacing" );
+XML_CONSTASCII_ACTION( sXML_letters, "letters" );
+XML_CONSTASCII_ACTION( sXML_level, "level" );
+XML_CONSTASCII_ACTION( sXML_library, "library" );
+XML_CONSTASCII_ACTION( sXML_library_embedded, "library-embedded" );
+XML_CONSTASCII_ACTION( sXML_library_linked, "library-linked" );
+XML_CONSTASCII_ACTION( sXML_light, "light");
+XML_CONSTASCII_ACTION( sXML_lighting_mode, "lighting-mode");
+XML_CONSTASCII_ACTION( sXML_lime, "lime" );
+XML_CONSTASCII_ACTION( sXML_limit, "limit" );
+XML_CONSTASCII_ACTION( sXML_line, "line" );
+XML_CONSTASCII_ACTION( sXML_line_break, "line-break" );
+XML_CONSTASCII_ACTION( sXML_line_height, "line-height" );
+XML_CONSTASCII_ACTION( sXML_line_height_at_least, "line-height-at-least" );
+XML_CONSTASCII_ACTION( sXML_line_spacing, "line-spacing" );
+XML_CONSTASCII_ACTION( sXML_linear, "linear" );
+XML_CONSTASCII_ACTION( sXML_linenumbering_configuration, "linenumbering-configuration" );
+XML_CONSTASCII_ACTION( sXML_linenumbering_separator, "linenumbering-separator" );
+XML_CONSTASCII_ACTION( sXML_lines, "lines" );
+XML_CONSTASCII_ACTION( sXML_lines_used, "lines-used" );
+XML_CONSTASCII_ACTION( sXML_link_data_style_to_source, "link-data-style-to-source" );
+XML_CONSTASCII_ACTION( sXML_link_to_source_data, "link-to-source-data" );
+XML_CONSTASCII_ACTION( sXML_list, "list");
+XML_CONSTASCII_ACTION( sXML_list_block, "list-block" );
+XML_CONSTASCII_ACTION( sXML_list_header, "list-header" );
+XML_CONSTASCII_ACTION( sXML_list_info, "list-info" );
+XML_CONSTASCII_ACTION( sXML_list_item, "list-item" );
+XML_CONSTASCII_ACTION( sXML_list_level, "list-level" );
+XML_CONSTASCII_ACTION( sXML_list_level_style_bullet, "list-level-style-bullet" );
+XML_CONSTASCII_ACTION( sXML_list_level_style_image, "list-level-style-image" );
+XML_CONSTASCII_ACTION( sXML_list_level_style_number, "list-level-style-number" );
+XML_CONSTASCII_ACTION( sXML_list_name, "list-name" );
+XML_CONSTASCII_ACTION( sXML_list_style, "list-style" );
+XML_CONSTASCII_ACTION( sXML_list_style_name, "list-style-name" );
+XML_CONSTASCII_ACTION( sXML_ln, "ln" );
+XML_CONSTASCII_ACTION( sXML_locked, "locked" );
+XML_CONSTASCII_ACTION( sXML_log, "log" );
+XML_CONSTASCII_ACTION( sXML_logarithmic, "logarithmic" );
+XML_CONSTASCII_ACTION( sXML_logbase, "logbase" );
+XML_CONSTASCII_ACTION( sXML_long, "long" );
+XML_CONSTASCII_ACTION( sXML_lowlimit, "lowlimit" );
+XML_CONSTASCII_ACTION( sXML_lr_tb, "lr-tb" );
+XML_CONSTASCII_ACTION( sXML_lt, "lt");
+XML_CONSTASCII_ACTION( sXML_ltr, "ltr");
+XML_CONSTASCII_ACTION( sXML_luminance , "luminance" );
+XML_CONSTASCII_ACTION( sXML_macro_name, "macro-name");
+XML_CONSTASCII_ACTION( sXML_maction, "maction");
+XML_CONSTASCII_ACTION( sXML_main_entry_style_name, "main-entry-style-name" );
+XML_CONSTASCII_ACTION( sXML_major, "major" );
+XML_CONSTASCII_ACTION( sXML_maligngroup, "maligngroup");
+XML_CONSTASCII_ACTION( sXML_malignmark, "malignmark");
+XML_CONSTASCII_ACTION( sXML_manual, "manual" );
+XML_CONSTASCII_ACTION( sXML_map, "map" );
+XML_CONSTASCII_ACTION( sXML_margin_bottom, "margin-bottom" );
+XML_CONSTASCII_ACTION( sXML_margin_left, "margin-left" );
+XML_CONSTASCII_ACTION( sXML_margin_right, "margin-right" );
+XML_CONSTASCII_ACTION( sXML_margin_top, "margin-top" );
+XML_CONSTASCII_ACTION( sXML_margins, "margins" );
+XML_CONSTASCII_ACTION( sXML_marker, "marker" );
+XML_CONSTASCII_ACTION( sXML_marker_end , "marker-end" );
+XML_CONSTASCII_ACTION( sXML_marker_end_center , "marker-end-center" );
+XML_CONSTASCII_ACTION( sXML_marker_end_width , "marker-end-width" );
+XML_CONSTASCII_ACTION( sXML_marker_start , "marker-start" );
+XML_CONSTASCII_ACTION( sXML_marker_start_center , "marker-start-center" );
+XML_CONSTASCII_ACTION( sXML_marker_start_width , "marker-start-width" );
+XML_CONSTASCII_ACTION( sXML_maroon, "maroon" );
+XML_CONSTASCII_ACTION( sXML_master_page, "master-page" );
+XML_CONSTASCII_ACTION( sXML_master_page_name , "master-page-name" );
+XML_CONSTASCII_ACTION( sXML_master_styles, "master-styles" );
+XML_CONSTASCII_ACTION( sXML_mastersthesis, "mastersthesis" );
+XML_CONSTASCII_ACTION( sXML_match, "match");
+XML_CONSTASCII_ACTION( sXML_math, "math");
+XML_CONSTASCII_ACTION( sXML_matrix, "matrix");
+XML_CONSTASCII_ACTION( sXML_matrix_covered, "matrix-covered");
+XML_CONSTASCII_ACTION( sXML_matrixrow, "matrixrow");
+XML_CONSTASCII_ACTION( sXML_max, "max" );
+XML_CONSTASCII_ACTION( sXML_max_edge, "max-edge");
+XML_CONSTASCII_ACTION( sXML_max_height, "max-height");
+XML_CONSTASCII_ACTION( sXML_max_width, "max-width");
+XML_CONSTASCII_ACTION( sXML_maximum, "maximum" );
+XML_CONSTASCII_ACTION( sXML_maximum_difference, "maximum-difference" );
+XML_CONSTASCII_ACTION( sXML_may_break_between_rows, "may-break-between-rows" );
+XML_CONSTASCII_ACTION( sXML_may_script, "may-script" );
+XML_CONSTASCII_ACTION( sXML_mean, "mean" );
+XML_CONSTASCII_ACTION( sXML_mean_value, "mean-value" );
+XML_CONSTASCII_ACTION( sXML_measure, "measure" );
+XML_CONSTASCII_ACTION( sXML_measure_align, "measure-align" );
+XML_CONSTASCII_ACTION( sXML_measure_vertical_align, "measure-vertical-align" );
+XML_CONSTASCII_ACTION( sXML_median, "median" );
+XML_CONSTASCII_ACTION( sXML_medium, "medium" );
+XML_CONSTASCII_ACTION( sXML_merror, "merror" );
+XML_CONSTASCII_ACTION( sXML_message_type, "message-type" );
+XML_CONSTASCII_ACTION( sXML_meta, "meta" );
+XML_CONSTASCII_ACTION( sXML_mfenced, "mfenced" );
+XML_CONSTASCII_ACTION( sXML_mfrac, "mfrac" );
+XML_CONSTASCII_ACTION( sXML_mi, "mi" ); //MathML Math Identifier
+XML_CONSTASCII_ACTION( sXML_middle, "middle" );
+XML_CONSTASCII_ACTION( sXML_mime_type, "mime-type" );
+XML_CONSTASCII_ACTION( sXML_min, "min" );
+XML_CONSTASCII_ACTION( sXML_min_denominator_digits, "min-denominator-digits" );
+XML_CONSTASCII_ACTION( sXML_min_edge, "min-edge");
+XML_CONSTASCII_ACTION( sXML_min_exponent_digits, "min-exponent-digits" );
+XML_CONSTASCII_ACTION( sXML_min_height, "min-height" );
+XML_CONSTASCII_ACTION( sXML_min_width, "min-width" );
+XML_CONSTASCII_ACTION( sXML_min_integer_digits, "min-integer-digits" );
+XML_CONSTASCII_ACTION( sXML_min_label_distance, "min-label-distance" );
+XML_CONSTASCII_ACTION( sXML_min_label_width, "min-label-width" );
+XML_CONSTASCII_ACTION( sXML_min_line_height, "min-line-height" );
+XML_CONSTASCII_ACTION( sXML_min_numerator_digits, "min-numerator-digits" );
+XML_CONSTASCII_ACTION( sXML_min_row_height, "min-row-height" );
+XML_CONSTASCII_ACTION( sXML_minimum, "minimum" );
+XML_CONSTASCII_ACTION( sXML_minor, "minor" );
+XML_CONSTASCII_ACTION( sXML_minus, "minus" );
+XML_CONSTASCII_ACTION( sXML_minutes, "minutes" );
+XML_CONSTASCII_ACTION( sXML_mirror, "mirror" );
+XML_CONSTASCII_ACTION( sXML_mirrored, "mirrored" );
+XML_CONSTASCII_ACTION( sXML_misc, "misc" );
+XML_CONSTASCII_ACTION( sXML_miter , "miter" );
+XML_CONSTASCII_ACTION( sXML_mmultiscripts, "mmultiscripts" );
+XML_CONSTASCII_ACTION( sXML_mm, "mm" );
+XML_CONSTASCII_ACTION( sXML_mn, "mn" );
+XML_CONSTASCII_ACTION( sXML_mo, "mo" );
+XML_CONSTASCII_ACTION( sXML_mode, "mode" );
+XML_CONSTASCII_ACTION( sXML_modern, "modern" );
+XML_CONSTASCII_ACTION( sXML_modification_date, "modification-date" );
+XML_CONSTASCII_ACTION( sXML_modification_time, "modification-time" );
+XML_CONSTASCII_ACTION( sXML_modulate, "modulate" );
+XML_CONSTASCII_ACTION( sXML_module, "module" );
+XML_CONSTASCII_ACTION( sXML_moment, "moment" );
+XML_CONSTASCII_ACTION( sXML_mono, "mono" );
+XML_CONSTASCII_ACTION( sXML_month, "month" );
+XML_CONSTASCII_ACTION( sXML_move_from_bottom, "move-from-bottom" );
+XML_CONSTASCII_ACTION( sXML_move_from_left, "move-from-left" );
+XML_CONSTASCII_ACTION( sXML_move_from_right, "move-from-right" );
+XML_CONSTASCII_ACTION( sXML_move_from_top, "move-from-top" );
+XML_CONSTASCII_ACTION( sXML_move_protect, "move-protect" );
+XML_CONSTASCII_ACTION( sXML_mover, "mover" );
+XML_CONSTASCII_ACTION( sXML_movement, "movement" );
+XML_CONSTASCII_ACTION( sXML_movement_cut_off, "movement-cut-off" );
+XML_CONSTASCII_ACTION( sXML_mouse_as_pen, "mouse-as-pen" );
+XML_CONSTASCII_ACTION( sXML_mouse_visible, "mouse-visible" );
+XML_CONSTASCII_ACTION( sXML_mpadded, "mpadded");
+XML_CONSTASCII_ACTION( sXML_mphantom, "mphantom");
+XML_CONSTASCII_ACTION( sXML_mprescripts, "mprescripts");
+XML_CONSTASCII_ACTION( sXML_mroot, "mroot");
+XML_CONSTASCII_ACTION( sXML_mrow, "mrow");
+XML_CONSTASCII_ACTION( sXML_ms, "ms");
+XML_CONSTASCII_ACTION( sXML_mspace, "mspace");
+XML_CONSTASCII_ACTION( sXML_msqrt, "msqrt");
+XML_CONSTASCII_ACTION( sXML_mstyle, "mstyle");
+XML_CONSTASCII_ACTION( sXML_msub, "msub");
+XML_CONSTASCII_ACTION( sXML_msubsup, "msubsup");
+XML_CONSTASCII_ACTION( sXML_msup, "msup");
+XML_CONSTASCII_ACTION( sXML_mtable, "mtable");
+XML_CONSTASCII_ACTION( sXML_mtd, "mtd");
+XML_CONSTASCII_ACTION( sXML_mtext, "mtext");
+XML_CONSTASCII_ACTION( sXML_mtr, "mtr");
+XML_CONSTASCII_ACTION( sXML_multi_deletion_spanned, "multi-deletion-spanned");
+XML_CONSTASCII_ACTION( sXML_munder, "munder");
+XML_CONSTASCII_ACTION( sXML_munderover, "munderover");
+XML_CONSTASCII_ACTION( sXML_name, "name" );
+XML_CONSTASCII_ACTION( sXML_name_and_extension, "name-and-extension" );
+XML_CONSTASCII_ACTION( sXML_named_expression, "named-expression");
+XML_CONSTASCII_ACTION( sXML_named_expressions, "named-expressions");
+XML_CONSTASCII_ACTION( sXML_named_range, "named-range");
+XML_CONSTASCII_ACTION( sXML_navy, "navy");
+XML_CONSTASCII_ACTION( sXML_neq, "neq" );
+XML_CONSTASCII_ACTION( sXML_new, "new" );
+XML_CONSTASCII_ACTION( sXML_next, "next" );
+XML_CONSTASCII_ACTION( sXML_next_page, "next-page" );
+XML_CONSTASCII_ACTION( sXML_next_style_name, "next-style-name" );
+XML_CONSTASCII_ACTION( sXML_nohref, "nohref" );
+XML_CONSTASCII_ACTION( sXML_no_limit, "no-limit" );
+XML_CONSTASCII_ACTION( sXML_no_wrap, "no-wrap" );
+XML_CONSTASCII_ACTION( sXML_noempty, "!empty");
+XML_CONSTASCII_ACTION( sXML_nomatch, "!match");
+XML_CONSTASCII_ACTION( sXML_none, "none" );
+XML_CONSTASCII_ACTION( sXML_noprtsubset, "notprsubset" );
+XML_CONSTASCII_ACTION( sXML_normal, "normal" );
+XML_CONSTASCII_ACTION( sXML_normals_direction, "normals-direction" );
+XML_CONSTASCII_ACTION( sXML_normals_kind, "normals-kind" );
+XML_CONSTASCII_ACTION( sXML_not, "not" );
+XML_CONSTASCII_ACTION( sXML_not_equal_date, "not-equal-date" );
+XML_CONSTASCII_ACTION( sXML_note, "note" );
+XML_CONSTASCII_ACTION( sXML_notes, "notes" );
+XML_CONSTASCII_ACTION( sXML_notin, "notin" );
+XML_CONSTASCII_ACTION( sXML_notsubset, "notsubset" );
+XML_CONSTASCII_ACTION( sXML_null_date, "null-date" );
+XML_CONSTASCII_ACTION( sXML_null_year, "null-year" );
+XML_CONSTASCII_ACTION( sXML_num_format, "num-format" );
+XML_CONSTASCII_ACTION( sXML_num_letter_sync, "num-letter-sync" );
+XML_CONSTASCII_ACTION( sXML_num_prefix, "num-prefix" );
+XML_CONSTASCII_ACTION( sXML_num_suffix, "num-suffix" );
+XML_CONSTASCII_ACTION( sXML_number, "number" );
+XML_CONSTASCII_ACTION( sXML_number_and_name, "number-and-name" );
+XML_CONSTASCII_ACTION( sXML_number_columns_repeated, "number-columns-repeated" );
+XML_CONSTASCII_ACTION( sXML_number_columns_spanned, "number-columns-spanned" );
+XML_CONSTASCII_ACTION( sXML_number_lines, "number-lines" );
+XML_CONSTASCII_ACTION( sXML_number_matrix_columns_spanned, "number-matrix-columns-spanned" );
+XML_CONSTASCII_ACTION( sXML_number_matrix_rows_spanned, "number-matrix-rows-spanned" );
+XML_CONSTASCII_ACTION( sXML_number_position, "number-position" );
+XML_CONSTASCII_ACTION( sXML_number_rows_repeated, "number-rows-repeated" );
+XML_CONSTASCII_ACTION( sXML_number_rows_spanned, "number-rows-spanned" );
+XML_CONSTASCII_ACTION( sXML_number_style, "number-style" );
+XML_CONSTASCII_ACTION( sXML_number_wrapped_paragraphs, "number-wrapped-paragraphs" );
+XML_CONSTASCII_ACTION( sXML_numbered_entries, "numbered-entries" );
+XML_CONSTASCII_ACTION( sXML_object, "object" );
+XML_CONSTASCII_ACTION( sXML_object_count, "object-count" );
+XML_CONSTASCII_ACTION( sXML_object_index, "object-index" );
+XML_CONSTASCII_ACTION( sXML_object_index_entry_template, "object-index-entry-template" );
+XML_CONSTASCII_ACTION( sXML_object_index_source, "object-index-source" );
+XML_CONSTASCII_ACTION( sXML_object_name, "object-name");
+XML_CONSTASCII_ACTION( sXML_object_ole, "object-ole" );
+XML_CONSTASCII_ACTION( sXML_objects, "objects" );
+XML_CONSTASCII_ACTION( sXML_odd_page, "odd-page" );
+XML_CONSTASCII_ACTION( sXML_offset, "offset" );
+XML_CONSTASCII_ACTION( sXML_olive, "olive" );
+XML_CONSTASCII_ACTION( sXML_online, "online" );
+XML_CONSTASCII_ACTION( sXML_online_text, "online-text" );
+XML_CONSTASCII_ACTION( sXML_onLoad, "onLoad" );
+XML_CONSTASCII_ACTION( sXML_onRequest, "onRequest" );
+XML_CONSTASCII_ACTION( sXML_on_update_keep_size, "on-update-keep-size");
+XML_CONSTASCII_ACTION( sXML_on_update_keep_styles, "on-update-keep-styles");
+XML_CONSTASCII_ACTION( sXML_opaque_background, "background" );
+XML_CONSTASCII_ACTION( sXML_opaque_foreground, "foreground" );
+XML_CONSTASCII_ACTION( sXML_open, "open" );
+XML_CONSTASCII_ACTION( sXML_open_horizontal, "open-horizontal" );
+XML_CONSTASCII_ACTION( sXML_open_vertical, "open-vertical" );
+XML_CONSTASCII_ACTION( sXML_operation, "operation");
+XML_CONSTASCII_ACTION( sXML_operator, "operator");
+XML_CONSTASCII_ACTION( sXML_optimal, "optimal");
+XML_CONSTASCII_ACTION( sXML_or, "or");
+XML_CONSTASCII_ACTION( sXML_order, "order");
+XML_CONSTASCII_ACTION( sXML_ordered_list, "ordered-list" );
+XML_CONSTASCII_ACTION( sXML_organizations, "organizations" );
+XML_CONSTASCII_ACTION( sXML_orientation, "orientation");
+XML_CONSTASCII_ACTION( sXML_orientation_landscape, "orientation-landscape" );
+XML_CONSTASCII_ACTION( sXML_orientation_portrait, "orientation-portrait" );
+XML_CONSTASCII_ACTION( sXML_origin, "origin" );
+XML_CONSTASCII_ACTION( sXML_orphans, "orphans" );
+XML_CONSTASCII_ACTION( sXML_outline_level, "outline-level" );
+XML_CONSTASCII_ACTION( sXML_outline_level_style, "outline-level-style" );
+XML_CONSTASCII_ACTION( sXML_outline_style, "outline-style" );
+XML_CONSTASCII_ACTION( sXML_outset, "outset" );
+XML_CONSTASCII_ACTION( sXML_outside, "outside" );
+XML_CONSTASCII_ACTION( sXML_overlap, "overlap" );
+XML_CONSTASCII_ACTION( sXML_p, "p" );
+XML_CONSTASCII_ACTION( sXML_package_name, "package-name" );
+XML_CONSTASCII_ACTION( sXML_padding, "padding" );
+XML_CONSTASCII_ACTION( sXML_padding_bottom, "padding-bottom" );
+XML_CONSTASCII_ACTION( sXML_padding_left, "padding-left" );
+XML_CONSTASCII_ACTION( sXML_padding_right, "padding-right" );
+XML_CONSTASCII_ACTION( sXML_padding_top, "padding-top" );
+XML_CONSTASCII_ACTION( sXML_page, "page" );
+XML_CONSTASCII_ACTION( sXML_page_adjust, "page-adjust" );
+XML_CONSTASCII_ACTION( sXML_page_breaks_on_group_change, "page-breaks-on-group-change");
+XML_CONSTASCII_ACTION( sXML_page_content, "page-content" );
+XML_CONSTASCII_ACTION( sXML_page_continuation_string, "page-continuation-string" );
+XML_CONSTASCII_ACTION( sXML_page_count, "page-count" );
+XML_CONSTASCII_ACTION( sXML_page_end_margin, "page-end-margin" );
+XML_CONSTASCII_ACTION( sXML_page_height, "page-height" );
+XML_CONSTASCII_ACTION( sXML_page_master, "page-master" );
+XML_CONSTASCII_ACTION( sXML_page_master_name, "page-master-name" );
+XML_CONSTASCII_ACTION( sXML_page_number, "page-number" );
+XML_CONSTASCII_ACTION( sXML_page_start_margin, "page-start-margin" );
+XML_CONSTASCII_ACTION( sXML_page_style_name, "page-style-name" );
+XML_CONSTASCII_ACTION( sXML_page_thumbnail, "page-thumbnail" );
+XML_CONSTASCII_ACTION( sXML_page_usage, "page-usage" );
+XML_CONSTASCII_ACTION( sXML_page_variable_get, "page-variable-get" );
+XML_CONSTASCII_ACTION( sXML_page_variable_set, "page-variable-set" );
+XML_CONSTASCII_ACTION( sXML_page_view_zoom_value, "page-view-zoom-value" );
+XML_CONSTASCII_ACTION( sXML_page_width, "page-width" );
+XML_CONSTASCII_ACTION( sXML_pages, "pages" );
+XML_CONSTASCII_ACTION( sXML_paper_tray_number, "paper-tray-number" );
+XML_CONSTASCII_ACTION( sXML_paragraph, "paragraph" );
+XML_CONSTASCII_ACTION( sXML_paragraph_content, "paragraph-content" );
+XML_CONSTASCII_ACTION( sXML_paragraph_count, "paragraph-count" );
+XML_CONSTASCII_ACTION( sXML_paragraph_end_margin, "paragraph-end-margin" );
+XML_CONSTASCII_ACTION( sXML_paragraph_start_margin, "paragraph-start-margin" );
+XML_CONSTASCII_ACTION( sXML_param, "param" );
+XML_CONSTASCII_ACTION( sXML_parallel, "parallel" );
+XML_CONSTASCII_ACTION( sXML_parent_style_name, "parent-style-name" );
+XML_CONSTASCII_ACTION( sXML_parse_sql_statement, "parse-sql-statement");
+XML_CONSTASCII_ACTION( sXML_parsed, "parsed" );
+XML_CONSTASCII_ACTION( sXML_pause, "pause" );
+XML_CONSTASCII_ACTION( sXML_partialdiff, "partialdiff");
+XML_CONSTASCII_ACTION( sXML_password, "password");
+XML_CONSTASCII_ACTION( sXML_passwort, "passwort");
+XML_CONSTASCII_ACTION( sXML_path , "path" );
+XML_CONSTASCII_ACTION( sXML_pending , "pending" );
+XML_CONSTASCII_ACTION( sXML_percentage, "percentage");
+XML_CONSTASCII_ACTION( sXML_percentage_style, "percentage-style" );
+XML_CONSTASCII_ACTION( sXML_perspective, "perspective");
+XML_CONSTASCII_ACTION( sXML_phdthesis, "phdthesis" );
+XML_CONSTASCII_ACTION( sXML_phong, "phong");
+XML_CONSTASCII_ACTION( sXML_pie_offset, "pie-offset" );
+XML_CONSTASCII_ACTION( sXML_placeholder, "placeholder" );
+XML_CONSTASCII_ACTION( sXML_placeholder_type, "placeholder-type" );
+XML_CONSTASCII_ACTION( sXML_placing, "placing" );
+XML_CONSTASCII_ACTION( sXML_plain_number, "plain-number" );
+XML_CONSTASCII_ACTION( sXML_plain_number_and_name, "plain-number-and-name" );
+XML_CONSTASCII_ACTION( sXML_plot_area, "plot-area" );
+XML_CONSTASCII_ACTION( sXML_plugin, "plugin" );
+XML_CONSTASCII_ACTION( sXML_plus, "plus" );
+XML_CONSTASCII_ACTION( sXML_points, "points" );
+XML_CONSTASCII_ACTION( sXML_polygon , "polygon" );
+XML_CONSTASCII_ACTION( sXML_polyline , "polyline" );
+XML_CONSTASCII_ACTION( sXML_polynomial, "polynomial" );
+XML_CONSTASCII_ACTION( sXML_pool_id, "pool-id" );
+XML_CONSTASCII_ACTION( sXML_portrait, "portrait" );
+XML_CONSTASCII_ACTION( sXML_position, "position" );
+XML_CONSTASCII_ACTION( sXML_position_bottom, "position-bottom" );
+XML_CONSTASCII_ACTION( sXML_position_left, "position-left" );
+XML_CONSTASCII_ACTION( sXML_position_right, "position-right" );
+XML_CONSTASCII_ACTION( sXML_position_top, "position-top" );
+XML_CONSTASCII_ACTION( sXML_posture_italic, "italic" );
+XML_CONSTASCII_ACTION( sXML_posture_normal, "normal" );
+XML_CONSTASCII_ACTION( sXML_posture_oblique, "oblique" );
+XML_CONSTASCII_ACTION( sXML_power, "power" );
+XML_CONSTASCII_ACTION( sXML_precision_as_shown, "precision-as-shown" );
+XML_CONSTASCII_ACTION( sXML_prefix, "prefix" );
+XML_CONSTASCII_ACTION( sXML_presentation, "presentation" );
+XML_CONSTASCII_ACTION( sXML_presentation_chart , "chart" );
+XML_CONSTASCII_ACTION( sXML_presentation_graphic , "graphic" );
+XML_CONSTASCII_ACTION( sXML_presentation_notes , "notes" );
+XML_CONSTASCII_ACTION( sXML_presentation_object , "object" );
+XML_CONSTASCII_ACTION( sXML_presentation_orgchart , "orgchart" );
+XML_CONSTASCII_ACTION( sXML_presentation_outline , "outline" );
+XML_CONSTASCII_ACTION( sXML_presentation_page , "page" );
+XML_CONSTASCII_ACTION( sXML_presentation_page_layout, "presentation-page-layout" );
+XML_CONSTASCII_ACTION( sXML_presentation_page_layout_name, "presentation-page-layout-name" );
+XML_CONSTASCII_ACTION( sXML_presentation_subtitle , "subtitle" );
+XML_CONSTASCII_ACTION( sXML_presentation_table , "table" );
+XML_CONSTASCII_ACTION( sXML_presentation_title , "title" );
+XML_CONSTASCII_ACTION( sXML_previous, "previous" );
+XML_CONSTASCII_ACTION( sXML_previous_page, "previous-page" );
+XML_CONSTASCII_ACTION( sXML_print, "print" );
+XML_CONSTASCII_ACTION( sXML_printable, "printable" );
+XML_CONSTASCII_ACTION( sXML_print_content, "print-content");
+XML_CONSTASCII_ACTION( sXML_print_date, "print-date" );
+XML_CONSTASCII_ACTION( sXML_print_orientation, "print-orientation");
+XML_CONSTASCII_ACTION( sXML_print_page_order, "print-page-order");
+XML_CONSTASCII_ACTION( sXML_print_range, "print-range");
+XML_CONSTASCII_ACTION( sXML_print_ranges, "print-ranges");
+XML_CONSTASCII_ACTION( sXML_print_time, "print-time" );
+XML_CONSTASCII_ACTION( sXML_printed_by, "printed-by" );
+XML_CONSTASCII_ACTION( sXML_proceedings, "proceedings" );
+XML_CONSTASCII_ACTION( sXML_product, "product" );
+XML_CONSTASCII_ACTION( sXML_projection, "projection");
+XML_CONSTASCII_ACTION( sXML_properties, "properties" );
+XML_CONSTASCII_ACTION( sXML_protect, "protect" );
+XML_CONSTASCII_ACTION( sXML_protect_content, "content" );
+XML_CONSTASCII_ACTION( sXML_protect_position, "position" );
+XML_CONSTASCII_ACTION( sXML_protect_size, "size" );
+XML_CONSTASCII_ACTION( sXML_protected, "protected" );
+XML_CONSTASCII_ACTION( sXML_protection_key, "protection-key" );
+XML_CONSTASCII_ACTION( sXML_prsubset, "prsubset" );
+XML_CONSTASCII_ACTION( sXML_publisher, "publisher" );
+XML_CONSTASCII_ACTION( sXML_punctuation_wrap, "punctuation-wrap" );
+XML_CONSTASCII_ACTION( sXML_purple, "purple" );
+XML_CONSTASCII_ACTION( sXML_pyramid, "pyramid" );
+XML_CONSTASCII_ACTION( sXML_quarter, "quarter" );
+XML_CONSTASCII_ACTION( sXML_query_name, "query-name");
+XML_CONSTASCII_ACTION( sXML_quo_vadis, "quo-vadis" );
+XML_CONSTASCII_ACTION( sXML_quotient, "quotient" );
+XML_CONSTASCII_ACTION( sXML_r, "r" );
+XML_CONSTASCII_ACTION( sXML_radar, "radar" );
+XML_CONSTASCII_ACTION( sXML_random, "random" );
+XML_CONSTASCII_ACTION( sXML_range_address, "range-address");
+XML_CONSTASCII_ACTION( sXML_range_usable_as, "range-usable-as");
+XML_CONSTASCII_ACTION( sXML_recreate_on_edit , "recreate-on-edit" );
+XML_CONSTASCII_ACTION( sXML_rect , "rect" );
+XML_CONSTASCII_ACTION( sXML_red , "red" );
+XML_CONSTASCII_ACTION( sXML_ref_name, "ref-name" );
+XML_CONSTASCII_ACTION( sXML_reference, "reference" );
+XML_CONSTASCII_ACTION( sXML_reference_end, "reference-end" );
+XML_CONSTASCII_ACTION( sXML_reference_format, "reference-format" );
+XML_CONSTASCII_ACTION( sXML_reference_mark, "reference-mark" );
+XML_CONSTASCII_ACTION( sXML_reference_mark_end, "reference-mark-end" );
+XML_CONSTASCII_ACTION( sXML_reference_mark_start, "reference-mark-start" );
+XML_CONSTASCII_ACTION( sXML_reference_ref, "reference-ref" );
+XML_CONSTASCII_ACTION( sXML_reference_start, "reference-start" );
+XML_CONSTASCII_ACTION( sXML_reference_type, "reference-type" );
+XML_CONSTASCII_ACTION( sXML_refresh_delay, "refresh-delay" );
+XML_CONSTASCII_ACTION( sXML_region_center, "region-center" );
+XML_CONSTASCII_ACTION( sXML_region_left, "region-left" );
+XML_CONSTASCII_ACTION( sXML_region_right, "region-right" );
+XML_CONSTASCII_ACTION( sXML_register_true, "register-true" );
+XML_CONSTASCII_ACTION( sXML_register_truth_ref_style_name, "register-truth-ref-style-name" );
+XML_CONSTASCII_ACTION( sXML_regression_type, "regression-type" );
+XML_CONSTASCII_ACTION( sXML_rejected, "rejected" );
+XML_CONSTASCII_ACTION( sXML_rejecting_change_id, "rejecting-change-id" );
+XML_CONSTASCII_ACTION( sXML_rejection, "rejection" );
+XML_CONSTASCII_ACTION( sXML_rel_column_width, "rel-column-width" );
+XML_CONSTASCII_ACTION( sXML_rel_height, "rel-height" );
+XML_CONSTASCII_ACTION( sXML_rel_width, "rel-width" );
+XML_CONSTASCII_ACTION( sXML_relative, "relative" ) ;
+XML_CONSTASCII_ACTION( sXML_relative_tab_stop_position, "relative-tab-stop-position" );
+XML_CONSTASCII_ACTION( sXML_reln, "reln" ) ;
+XML_CONSTASCII_ACTION( sXML_rem, "rem" ) ;
+XML_CONSTASCII_ACTION( sXML_remove_dependents, "remove-dependents" );
+XML_CONSTASCII_ACTION( sXML_remove_precedents, "remove-precedents" );
+XML_CONSTASCII_ACTION( sXML_repeat, "repeat" );
+XML_CONSTASCII_ACTION( sXML_repeat_column, "repeat-column");
+XML_CONSTASCII_ACTION( sXML_repeat_row, "repeat-row");
+XML_CONSTASCII_ACTION( sXML_repeated, "repeated" );
+XML_CONSTASCII_ACTION( sXML_replace, "replace" );
+XML_CONSTASCII_ACTION( sXML_report_type, "report-type" );
+XML_CONSTASCII_ACTION( sXML_restart_on_page, "restart-on-page" );
+XML_CONSTASCII_ACTION( sXML_revision, "revision" );
+XML_CONSTASCII_ACTION( sXML_ridge, "ridge" );
+XML_CONSTASCII_ACTION( sXML_right, "right" );
+XML_CONSTASCII_ACTION( sXML_right_outside, "right-outside" );
+XML_CONSTASCII_ACTION( sXML_ring, "ring" );
+XML_CONSTASCII_ACTION( sXML_role, "role" );
+XML_CONSTASCII_ACTION( sXML_roll_from_bottom, "roll-from-bottom" );
+XML_CONSTASCII_ACTION( sXML_roll_from_left, "roll-from-left" );
+XML_CONSTASCII_ACTION( sXML_roll_from_right, "roll-from-right" );
+XML_CONSTASCII_ACTION( sXML_roman, "roman" );
+XML_CONSTASCII_ACTION( sXML_root, "root" );
+XML_CONSTASCII_ACTION( sXML_rotate, "rotate" );
+XML_CONSTASCII_ACTION( sXML_rotation, "rotation" );
+XML_CONSTASCII_ACTION( sXML_rotation_align, "rotation-align" );
+XML_CONSTASCII_ACTION( sXML_rotation_angle, "rotation-angle" );
+XML_CONSTASCII_ACTION( sXML_round , "round" );
+XML_CONSTASCII_ACTION( sXML_row, "row");
+XML_CONSTASCII_ACTION( sXML_rows, "rows");
+XML_CONSTASCII_ACTION( sXML_row_height, "row-height" );
+XML_CONSTASCII_ACTION( sXML_row_number, "row-number" );
+XML_CONSTASCII_ACTION( sXML_ruby, "ruby" );
+XML_CONSTASCII_ACTION( sXML_ruby_align, "ruby-align" );
+XML_CONSTASCII_ACTION( sXML_ruby_base, "ruby-base" );
+XML_CONSTASCII_ACTION( sXML_ruby_position, "ruby-position" );
+XML_CONSTASCII_ACTION( sXML_ruby_text, "ruby-text" );
+XML_CONSTASCII_ACTION( sXML_run_through, "run-through" );
+XML_CONSTASCII_ACTION( sXML_rx, "rx" );
+XML_CONSTASCII_ACTION( sXML_ry, "ry" );
+XML_CONSTASCII_ACTION( sXML_s, "s" );
+XML_CONSTASCII_ACTION( sXML_scale, "scale" );
+XML_CONSTASCII_ACTION( sXML_scale_min, "scale-min" );
+XML_CONSTASCII_ACTION( sXML_scale_text, "scale-text" );
+XML_CONSTASCII_ACTION( sXML_scale_to, "scale-to" );
+XML_CONSTASCII_ACTION( sXML_scale_to_pages, "scale-to-pages" );
+XML_CONSTASCII_ACTION( sXML_scatter, "scatter" );
+XML_CONSTASCII_ACTION( sXML_scenario, "scenario" );
+XML_CONSTASCII_ACTION( sXML_scenario_ranges, "scenario-ranges" );
+XML_CONSTASCII_ACTION( sXML_scene, "scene");
+XML_CONSTASCII_ACTION( sXML_school, "school" );
+XML_CONSTASCII_ACTION( sXML_scientific_number, "scientific-number" );
+XML_CONSTASCII_ACTION( sXML_score_spaces, "score-spaces" );
+XML_CONSTASCII_ACTION( sXML_script, "script" );
+XML_CONSTASCII_ACTION( sXML_scroll, "scroll" );
+XML_CONSTASCII_ACTION( sXML_sdev, "sdev" );
+XML_CONSTASCII_ACTION( sXML_search_criteria_must_apply_to_whole_cell, "search-criteria-must-apply-to-whole-cell" );
+XML_CONSTASCII_ACTION( sXML_sec, "sec" );
+XML_CONSTASCII_ACTION( sXML_sech, "sech" );
+XML_CONSTASCII_ACTION( sXML_second_date_time, "second-date-time" );
+XML_CONSTASCII_ACTION( sXML_seconds, "seconds" );
+XML_CONSTASCII_ACTION( sXML_section, "section" );
+XML_CONSTASCII_ACTION( sXML_section_desc, "section-desc" );
+XML_CONSTASCII_ACTION( sXML_section_name, "section-name" );
+XML_CONSTASCII_ACTION( sXML_section_source, "section-source" );
+XML_CONSTASCII_ACTION( sXML_select_page, "select-page" );
+XML_CONSTASCII_ACTION( sXML_selector, "selector" );
+XML_CONSTASCII_ACTION( sXML_semantics, "semantics" );
+XML_CONSTASCII_ACTION( sXML_semi_automatic, "semi-automatic" );
+XML_CONSTASCII_ACTION( sXML_sender_city, "sender-city" );
+XML_CONSTASCII_ACTION( sXML_sender_company, "sender-company" );
+XML_CONSTASCII_ACTION( sXML_sender_country, "sender-country" );
+XML_CONSTASCII_ACTION( sXML_sender_email, "sender-email" );
+XML_CONSTASCII_ACTION( sXML_sender_fax, "sender-fax" );
+XML_CONSTASCII_ACTION( sXML_sender_firstname, "sender-firstname" );
+XML_CONSTASCII_ACTION( sXML_sender_initials, "sender-initials" );
+XML_CONSTASCII_ACTION( sXML_sender_lastname, "sender-lastname" );
+XML_CONSTASCII_ACTION( sXML_sender_phone_private, "sender-phone-private" );
+XML_CONSTASCII_ACTION( sXML_sender_phone_work, "sender-phone-work" );
+XML_CONSTASCII_ACTION( sXML_sender_position, "sender-position" );
+XML_CONSTASCII_ACTION( sXML_sender_postal_code, "sender-postal-code" );
+XML_CONSTASCII_ACTION( sXML_sender_state_or_province, "sender-state-or-province" );
+XML_CONSTASCII_ACTION( sXML_sender_street, "sender-street" );
+XML_CONSTASCII_ACTION( sXML_sender_title, "sender-title" );
+XML_CONSTASCII_ACTION( sXML_sep, "sep" );
+XML_CONSTASCII_ACTION( sXML_separation_character, "separation-character" );
+XML_CONSTASCII_ACTION( sXML_separator, "separator" );
+XML_CONSTASCII_ACTION( sXML_sequence, "sequence" );
+XML_CONSTASCII_ACTION( sXML_sequence_decl, "sequence-decl" );
+XML_CONSTASCII_ACTION( sXML_sequence_decls, "sequence-decls" );
+XML_CONSTASCII_ACTION( sXML_sequence_ref, "sequence-ref" );
+XML_CONSTASCII_ACTION( sXML_series, "series" );
+XML_CONSTASCII_ACTION( sXML_series_source, "series-source" );
+XML_CONSTASCII_ACTION( sXML_server_map, "server-map" );
+XML_CONSTASCII_ACTION( sXML_set, "set" );
+XML_CONSTASCII_ACTION( sXML_setdiff, "setdiff" );
+XML_CONSTASCII_ACTION( sXML_settings, "settings" );
+XML_CONSTASCII_ACTION( sXML_shade_mode, "shade-mode");
+XML_CONSTASCII_ACTION( sXML_shadow, "shadow" );
+XML_CONSTASCII_ACTION( sXML_shadow_color , "shadow-color" );
+XML_CONSTASCII_ACTION( sXML_shadow_offset_x , "shadow-offset-x" );
+XML_CONSTASCII_ACTION( sXML_shadow_offset_y , "shadow-offset-y" );
+XML_CONSTASCII_ACTION( sXML_shadow_slant, "shadow-slant");
+XML_CONSTASCII_ACTION( sXML_shadow_transparency , "shadow-transparency" );
+XML_CONSTASCII_ACTION( sXML_shape, "shape" );
+XML_CONSTASCII_ACTION( sXML_shapes, "shapes" );
+XML_CONSTASCII_ACTION( sXML_sheet_name, "sheet-name" );
+XML_CONSTASCII_ACTION( sXML_shininess, "shininess" );
+XML_CONSTASCII_ACTION( sXML_short, "short" );
+XML_CONSTASCII_ACTION( sXML_show, "show" );
+XML_CONSTASCII_ACTION( sXML_show_accepted_changes, "show-accepted-changes" );
+XML_CONSTASCII_ACTION( sXML_show_rejected_changes, "show-rejected-changes" );
+XML_CONSTASCII_ACTION( sXML_show_changes, "show-changes" );
+XML_CONSTASCII_ACTION( sXML_show_changes_by_author, "show-changes-by-author" );
+XML_CONSTASCII_ACTION( sXML_show_changes_by_author_name, "show-changes-by-author-name" );
+XML_CONSTASCII_ACTION( sXML_show_changes_by_comment, "show-changes-by-comment" );
+XML_CONSTASCII_ACTION( sXML_show_changes_by_comment_text, "show-changes-by-comment-text" );
+XML_CONSTASCII_ACTION( sXML_show_changes_by_datetime, "show-changes-by-datetime" );
+XML_CONSTASCII_ACTION( sXML_show_changes_by_datetime_mode, "show-changes-by-datetime-mode" );
+XML_CONSTASCII_ACTION( sXML_show_changes_by_datetime_first_datetime, "show-changes-by-datetime-first-datetime" );
+XML_CONSTASCII_ACTION( sXML_show_changes_by_datetime_second_datetime, "show-changes-by-datetime-second-datetime" );
+XML_CONSTASCII_ACTION( sXML_show_changes_by_ranges, "show-changes-by-ranges" );
+XML_CONSTASCII_ACTION( sXML_show_changes_by_ranges_list, "show-changes-by-ranges-list" );
+XML_CONSTASCII_ACTION( sXML_show_logo, "show-logo" );
+XML_CONSTASCII_ACTION( sXML_show_unit, "show-unit" );
+XML_CONSTASCII_ACTION( sXML_shows, "shows" );
+XML_CONSTASCII_ACTION( sXML_side_by_side, "side-by-side" );
+XML_CONSTASCII_ACTION( sXML_silver, "silver" );
+XML_CONSTASCII_ACTION( sXML_simple, "simple" );
+XML_CONSTASCII_ACTION( sXML_sin, "sin" );
+XML_CONSTASCII_ACTION( sXML_since_date_time, "since-date-time" );
+XML_CONSTASCII_ACTION( sXML_since_save, "since-save" );
+XML_CONSTASCII_ACTION( sXML_sinh, "sinh" );
+XML_CONSTASCII_ACTION( sXML_size, "size" );
+XML_CONSTASCII_ACTION( sXML_size_protect, "size-protect" );
+XML_CONSTASCII_ACTION( sXML_slide, "slide" );
+XML_CONSTASCII_ACTION( sXML_slow, "slow" );
+XML_CONSTASCII_ACTION( sXML_soft_page_break, "soft-page-break" );
+XML_CONSTASCII_ACTION( sXML_solid, "solid" );
+XML_CONSTASCII_ACTION( sXML_solid_type, "solid-type" );
+XML_CONSTASCII_ACTION( sXML_sort, "sort");
+XML_CONSTASCII_ACTION( sXML_sort_ascending, "sort-ascending" );
+XML_CONSTASCII_ACTION( sXML_sort_by, "sort-by");
+XML_CONSTASCII_ACTION( sXML_sort_by_position, "sort-by-position" );
+XML_CONSTASCII_ACTION( sXML_sort_groups, "sort-groups");
+XML_CONSTASCII_ACTION( sXML_sort_key, "sort-key");
+XML_CONSTASCII_ACTION( sXML_sort_by_x_values, "sort-by-x-values" );
+XML_CONSTASCII_ACTION( sXML_source_cell_range, "source-cell-range");
+XML_CONSTASCII_ACTION( sXML_source_cell_range_addresses, "source-cell-range-addresses");
+XML_CONSTASCII_ACTION( sXML_source_field_name, "source-field-name");
+XML_CONSTASCII_ACTION( sXML_source_name, "source-name");
+XML_CONSTASCII_ACTION( sXML_source_range_address, "source-range-address");
+XML_CONSTASCII_ACTION( sXML_source_service, "source-service");
+XML_CONSTASCII_ACTION( sXML_space_before, "space-before" );
+XML_CONSTASCII_ACTION( sXML_span, "span" );
+XML_CONSTASCII_ACTION( sXML_specular, "specular");
+XML_CONSTASCII_ACTION( sXML_specular_color, "specular-color" );
+XML_CONSTASCII_ACTION( sXML_sphere, "sphere" );
+XML_CONSTASCII_ACTION( sXML_spiralin_left, "spiralin-left" );
+XML_CONSTASCII_ACTION( sXML_spiralin_right, "spiralin-right" );
+XML_CONSTASCII_ACTION( sXML_spiralout_left, "spiralout-left" );
+XML_CONSTASCII_ACTION( sXML_spiralout_right, "spiralout-right" );
+XML_CONSTASCII_ACTION( sXML_splines, "splines" );
+XML_CONSTASCII_ACTION( sXML_split, "split" );
+XML_CONSTASCII_ACTION( sXML_split_column, "split-column" );
+XML_CONSTASCII_ACTION( sXML_split_position, "split-position" );
+XML_CONSTASCII_ACTION( sXML_split_row, "split-row" );
+XML_CONSTASCII_ACTION( sXML_spreadsheet , "spreadsheet" );
+XML_CONSTASCII_ACTION( sXML_sql_statement, "sql-statement");
+XML_CONSTASCII_ACTION( sXML_stacked, "stacked" );
+XML_CONSTASCII_ACTION( sXML_stagger_even, "stagger-even" );
+XML_CONSTASCII_ACTION( sXML_stagger_odd, "stagger-odd" );
+XML_CONSTASCII_ACTION( sXML_standard, "standard" );
+XML_CONSTASCII_ACTION( sXML_standard_deviation, "standard-deviation" );
+XML_CONSTASCII_ACTION( sXML_starbasic, "starbasic" );
+XML_CONSTASCII_ACTION( sXML_start, "start" );
+XML_CONSTASCII_ACTION( sXML_start_color, "start-color" );
+XML_CONSTASCII_ACTION( sXML_start_column, "start-column" );
+XML_CONSTASCII_ACTION( sXML_start_intensity, "start-intensity" );
+XML_CONSTASCII_ACTION( sXML_start_numbering_at, "start-numbering-at" );
+XML_CONSTASCII_ACTION( sXML_start_page, "start-page" );
+XML_CONSTASCII_ACTION( sXML_start_position, "start-position" );
+XML_CONSTASCII_ACTION( sXML_start_row, "start-row" );
+XML_CONSTASCII_ACTION( sXML_start_table, "start-table" );
+XML_CONSTASCII_ACTION( sXML_start_value, "start-value" );
+XML_CONSTASCII_ACTION( sXML_start_with_navigator, "start-with-navigator" );
+XML_CONSTASCII_ACTION( sXML_statistics, "statistics" );
+XML_CONSTASCII_ACTION( sXML_status, "status" );
+XML_CONSTASCII_ACTION( sXML_stay_on_top, "stay-on-top" );
+XML_CONSTASCII_ACTION( sXML_stdev, "stdev" );
+XML_CONSTASCII_ACTION( sXML_stdevp, "stdevp" );
+XML_CONSTASCII_ACTION( sXML_steps, "steps" );
+XML_CONSTASCII_ACTION( sXML_stock, "stock" );
+XML_CONSTASCII_ACTION( sXML_stock_updown_bars, "stock-updown-bars" );
+XML_CONSTASCII_ACTION( sXML_stock_with_volume, "stock-with-volume" );
+XML_CONSTASCII_ACTION( sXML_stop, "stop" );
+XML_CONSTASCII_ACTION( sXML_stretch_from_bottom, "stretch-from-bottom" );
+XML_CONSTASCII_ACTION( sXML_stretch_from_left, "stretch-from-left" );
+XML_CONSTASCII_ACTION( sXML_stretch_from_right, "stretch-from-right" );
+XML_CONSTASCII_ACTION( sXML_stretch_from_top, "stretch-from-top" );
+XML_CONSTASCII_ACTION( sXML_stretchy, "stretchy" );
+XML_CONSTASCII_ACTION( sXML_strict , "strict" );
+XML_CONSTASCII_ACTION( sXML_string, "string");
+XML_CONSTASCII_ACTION( sXML_string_value, "string-value");
+XML_CONSTASCII_ACTION( sXML_string_value_if_false, "string-value-if-false" );
+XML_CONSTASCII_ACTION( sXML_string_value_if_true, "string-value-if-true" );
+XML_CONSTASCII_ACTION( sXML_stroke , "stroke" );
+XML_CONSTASCII_ACTION( sXML_stroke_color , "stroke-color" );
+XML_CONSTASCII_ACTION( sXML_stroke_dash , "stroke-dash" );
+XML_CONSTASCII_ACTION( sXML_stroke_linejoin , "stroke-linejoin" );
+XML_CONSTASCII_ACTION( sXML_stroke_opacity, "stroke-opacity" );
+XML_CONSTASCII_ACTION( sXML_stroke_width, "stroke-width" );
+XML_CONSTASCII_ACTION( sXML_structure_protected, "structure-protected" );
+XML_CONSTASCII_ACTION( sXML_style, "style" );
+XML_CONSTASCII_ACTION( sXML_style_name, "style-name" );
+XML_CONSTASCII_ACTION( sXML_styles, "styles" );
+XML_CONSTASCII_ACTION( sXML_stylesheet, "stylesheet" );
+XML_CONSTASCII_ACTION( sXML_sub_table, "sub-table" );
+XML_CONSTASCII_ACTION( sXML_subject, "subject" );
+XML_CONSTASCII_ACTION( sXML_subset, "subset" );
+XML_CONSTASCII_ACTION( sXML_subtitle, "subtitle" );
+XML_CONSTASCII_ACTION( sXML_subtotal_field, "subtotal-field");
+XML_CONSTASCII_ACTION( sXML_subtotal_rule, "subtotal-rule");
+XML_CONSTASCII_ACTION( sXML_subtotal_rules, "subtotal-rules");
+XML_CONSTASCII_ACTION( sXML_suffix, "suffix" );
+XML_CONSTASCII_ACTION( sXML_sum, "sum" );
+XML_CONSTASCII_ACTION( sXML_swiss, "swiss" );
+XML_CONSTASCII_ACTION( sXML_symbol, "symbol" );
+XML_CONSTASCII_ACTION( sXML_symbol_height, "symbol-height" );
+XML_CONSTASCII_ACTION( sXML_symbol_image_name, "symbol-image-name" );
+XML_CONSTASCII_ACTION( sXML_symbol_width, "symbol-width" );
+XML_CONSTASCII_ACTION( sXML_system, "system" );
+XML_CONSTASCII_ACTION( sXML_tab_stop, "tab-stop" );
+XML_CONSTASCII_ACTION( sXML_tab_stops, "tab-stops" );
+XML_CONSTASCII_ACTION( sXML_table, "table" );
+XML_CONSTASCII_ACTION( sXML_tables, "tables" );
+XML_CONSTASCII_ACTION( sXML_table_background, "table-background" );
+XML_CONSTASCII_ACTION( sXML_table_cell, "table-cell" );
+XML_CONSTASCII_ACTION( sXML_table_centering, "table-centering" );
+XML_CONSTASCII_ACTION( sXML_table_column, "table-column" );
+XML_CONSTASCII_ACTION( sXML_table_column_group, "table-column-group" );
+XML_CONSTASCII_ACTION( sXML_table_columns, "table-columns" );
+XML_CONSTASCII_ACTION( sXML_table_count, "table-count" );
+XML_CONSTASCII_ACTION( sXML_table_header, "table-header" );
+XML_CONSTASCII_ACTION( sXML_table_header_columns, "table-header-columns" );
+XML_CONSTASCII_ACTION( sXML_table_header_rows, "table-header-rows" );
+XML_CONSTASCII_ACTION( sXML_table_index, "table-index" );
+XML_CONSTASCII_ACTION( sXML_table_index_entry_template, "table-index-entry-template" );
+XML_CONSTASCII_ACTION( sXML_table_index_source, "table-index-source" );
+XML_CONSTASCII_ACTION( sXML_table_name, "table-name");
+XML_CONSTASCII_ACTION( sXML_table_number_list, "table-number-list");
+XML_CONSTASCII_ACTION( sXML_table_of_content, "table-of-content" );
+XML_CONSTASCII_ACTION( sXML_table_of_content_entry_template, "table-of-content-entry-template" );
+XML_CONSTASCII_ACTION( sXML_table_of_content_source, "table-of-content-source" );
+XML_CONSTASCII_ACTION( sXML_table_page, "table-page" );
+XML_CONSTASCII_ACTION( sXML_table_row, "table-row" );
+XML_CONSTASCII_ACTION( sXML_table_row_group, "table-row-group" );
+XML_CONSTASCII_ACTION( sXML_table_rows, "table-rows" );
+XML_CONSTASCII_ACTION( sXML_table_source, "table-source" );
+XML_CONSTASCII_ACTION( sXML_table_view, "table-view" );
+XML_CONSTASCII_ACTION( sXML_tab_stop_distance, "tab-stop-distance" );
+XML_CONSTASCII_ACTION( sXML_tan, "tan" );
+XML_CONSTASCII_ACTION( sXML_tanh, "tanh" );
+XML_CONSTASCII_ACTION( sXML_target_cell_address, "target-cell-address");
+XML_CONSTASCII_ACTION( sXML_target_frame_name, "target-frame-name" );
+XML_CONSTASCII_ACTION( sXML_target_range_address, "target-range-address");
+XML_CONSTASCII_ACTION( sXML_tb_rl, "tb-rl" );
+XML_CONSTASCII_ACTION( sXML_teal, "teal" );
+XML_CONSTASCII_ACTION( sXML_techreport, "techreport" );
+XML_CONSTASCII_ACTION( sXML_template, "template" );
+XML_CONSTASCII_ACTION( sXML_template_name, "template-name" );
+XML_CONSTASCII_ACTION( sXML_tendsto, "tendsto" );
+XML_CONSTASCII_ACTION( sXML_tex_filter, "texture-filter" );
+XML_CONSTASCII_ACTION( sXML_tex_generation_mode_x, "texture-generation-mode-x" );
+XML_CONSTASCII_ACTION( sXML_tex_generation_mode_y, "texture-generation-mode-y" );
+XML_CONSTASCII_ACTION( sXML_tex_kind, "texture-kind" );
+XML_CONSTASCII_ACTION( sXML_tex_mode, "texture-mode" );
+XML_CONSTASCII_ACTION( sXML_text, "text" );
+XML_CONSTASCII_ACTION( sXML_text_align, "text-align" );
+XML_CONSTASCII_ACTION( sXML_text_align_last, "text-align-last" );
+XML_CONSTASCII_ACTION( sXML_text_align_source, "text-align-source" );
+XML_CONSTASCII_ACTION( sXML_text_autospace, "text-autospace" );
+XML_CONSTASCII_ACTION( sXML_text_background_color, "text-background-color" );
+XML_CONSTASCII_ACTION( sXML_text_blinking, "text-blinking" );
+XML_CONSTASCII_ACTION( sXML_text_box, "text-box" );
+XML_CONSTASCII_ACTION( sXML_text_combine, "text-combine" );
+XML_CONSTASCII_ACTION( sXML_text_combine_end_char, "text-combine-end-char" );
+XML_CONSTASCII_ACTION( sXML_text_combine_start_char, "text-combine-start-char" );
+XML_CONSTASCII_ACTION( sXML_text_content, "text-content" );
+XML_CONSTASCII_ACTION( sXML_text_crossing_out, "text-crossing-out" );
+XML_CONSTASCII_ACTION( sXML_text_emphasize, "text-emphasize" );
+XML_CONSTASCII_ACTION( sXML_text_global, "text-global" );
+XML_CONSTASCII_ACTION( sXML_text_indent, "text-indent" );
+XML_CONSTASCII_ACTION( sXML_text_input, "text-input" );
+XML_CONSTASCII_ACTION( sXML_text_outline, "text-outline" );
+XML_CONSTASCII_ACTION( sXML_text_position, "text-position" );
+XML_CONSTASCII_ACTION( sXML_text_rotation_angle, "text-rotation-angle" );
+XML_CONSTASCII_ACTION( sXML_text_rotation_scale, "text-rotation-scale" );
+XML_CONSTASCII_ACTION( sXML_text_scale, "text-scale" );
+XML_CONSTASCII_ACTION( sXML_text_shadow, "text-shadow" );
+XML_CONSTASCII_ACTION( sXML_text_style, "text-style" );
+XML_CONSTASCII_ACTION( sXML_text_transform, "text-transform" );
+XML_CONSTASCII_ACTION( sXML_text_underline, "text-underline" );
+XML_CONSTASCII_ACTION( sXML_text_underline_color, "text-underline-color" );
+XML_CONSTASCII_ACTION( sXML_textarea_horizontal_align, "textarea-horizontal-align" );
+XML_CONSTASCII_ACTION( sXML_textarea_vertical_align, "textarea-vertical-align" );
+XML_CONSTASCII_ACTION( sXML_textual, "textual" );
+XML_CONSTASCII_ACTION( sXML_thick, "thick" );
+XML_CONSTASCII_ACTION( sXML_thin, "thin" );
+XML_CONSTASCII_ACTION( sXML_three_dimensional, "three-dimensional" );
+XML_CONSTASCII_ACTION( sXML_thumbnail, "thumbnail" );
+XML_CONSTASCII_ACTION( sXML_tick_marks_major_inner, "tick-marks-major-inner" );
+XML_CONSTASCII_ACTION( sXML_tick_marks_major_outer, "tick-marks-major-outer" );
+XML_CONSTASCII_ACTION( sXML_tick_marks_minor_inner, "tick-marks-minor-inner" );
+XML_CONSTASCII_ACTION( sXML_tick_marks_minor_outer, "tick-marks-minor-outer" );
+XML_CONSTASCII_ACTION( sXML_tile_repeat_offset, "tile-repeat-offset" );
+XML_CONSTASCII_ACTION( sXML_time, "time");
+XML_CONSTASCII_ACTION( sXML_time_adjust, "time-adjust" );
+XML_CONSTASCII_ACTION( sXML_time_style, "time-style" );
+XML_CONSTASCII_ACTION( sXML_time_value, "time-value");
+XML_CONSTASCII_ACTION( sXML_times, "times");
+XML_CONSTASCII_ACTION( sXML_title, "title" );
+XML_CONSTASCII_ACTION( sXML_to_another_table, "to-another-table" );
+XML_CONSTASCII_ACTION( sXML_toc_mark, "toc-mark" );
+XML_CONSTASCII_ACTION( sXML_toc_mark_end, "toc-mark-end" );
+XML_CONSTASCII_ACTION( sXML_toc_mark_start, "toc-mark-start" );
+XML_CONSTASCII_ACTION( sXML_top, "top" );
+XML_CONSTASCII_ACTION( sXML_top_percent, "top percent");
+XML_CONSTASCII_ACTION( sXML_top_values, "top values");
+XML_CONSTASCII_ACTION( sXML_trace_dependents, "trace-dependents" );
+XML_CONSTASCII_ACTION( sXML_trace_errors, "trace-errors" );
+XML_CONSTASCII_ACTION( sXML_trace_precedents, "trace-precedents" );
+XML_CONSTASCII_ACTION( sXML_track_changes, "track-changes" );
+XML_CONSTASCII_ACTION( sXML_tracked_changes, "tracked-changes" );
+XML_CONSTASCII_ACTION( sXML_tracked_changes_view_settings, "tracked-changes-view-settings" );
+XML_CONSTASCII_ACTION( sXML_transform , "transform" );
+XML_CONSTASCII_ACTION( sXML_transition_on_click, "transition-on-click" );
+XML_CONSTASCII_ACTION( sXML_transparency, "transparency" );
+XML_CONSTASCII_ACTION( sXML_transparency_name, "transparency-name" );
+XML_CONSTASCII_ACTION( sXML_transparent, "transparent" );
+XML_CONSTASCII_ACTION( sXML_transpose, "transpose" );
+XML_CONSTASCII_ACTION( sXML_true, "true" );
+XML_CONSTASCII_ACTION( sXML_truncate_on_overflow, "truncate-on-overflow" );
+XML_CONSTASCII_ACTION( sXML_ttb, "ttb");
+XML_CONSTASCII_ACTION( sXML_type, "type" );
+XML_CONSTASCII_ACTION( sXML_underline_bold, "bold" );
+XML_CONSTASCII_ACTION( sXML_underline_bold_dash, "bold-dash" );
+XML_CONSTASCII_ACTION( sXML_underline_bold_dot_dash, "bold-dot-dash" );
+XML_CONSTASCII_ACTION( sXML_underline_bold_dot_dot_dash, "bold-dot-dot-dash" );
+XML_CONSTASCII_ACTION( sXML_underline_bold_dotted, "bold-dotted" );
+XML_CONSTASCII_ACTION( sXML_underline_bold_long_dash, "bold-long-dash" );
+XML_CONSTASCII_ACTION( sXML_underline_bold_wave, "bold-wave" );
+XML_CONSTASCII_ACTION( sXML_underline_dash, "dash" );
+XML_CONSTASCII_ACTION( sXML_underline_dot_dash, "dot-dash" );
+XML_CONSTASCII_ACTION( sXML_underline_dot_dot_dash, "dot-dot-dash" );
+XML_CONSTASCII_ACTION( sXML_underline_dotted, "dotted" );
+XML_CONSTASCII_ACTION( sXML_underline_double, "double" );
+XML_CONSTASCII_ACTION( sXML_underline_double_wave, "double-wave" );
+XML_CONSTASCII_ACTION( sXML_underline_long_dash, "long-dash" );
+XML_CONSTASCII_ACTION( sXML_underline_none, "none" );
+XML_CONSTASCII_ACTION( sXML_underline_single, "single" );
+XML_CONSTASCII_ACTION( sXML_underline_small_wave, "small-wave" );
+XML_CONSTASCII_ACTION( sXML_underline_wave, "wave" );
+XML_CONSTASCII_ACTION( sXML_unformatted_text, "unformatted-text" );
+XML_CONSTASCII_ACTION( sXML_union, "union" );
+XML_CONSTASCII_ACTION( sXML_unit, "unit" );
+XML_CONSTASCII_ACTION( sXML_unordered_list, "unordered-list" );
+XML_CONSTASCII_ACTION( sXML_unpublished, "unpublished" );
+XML_CONSTASCII_ACTION( sXML_uplimit, "uplimit" );
+XML_CONSTASCII_ACTION( sXML_url, "url" );
+XML_CONSTASCII_ACTION( sXML_use_caption, "use-caption" );
+XML_CONSTASCII_ACTION( sXML_use_cell_protection, "use-cell-protection" );
+XML_CONSTASCII_ACTION( sXML_use_chart_objects, "use-chart-objects" );
+XML_CONSTASCII_ACTION( sXML_use_condition, "use-condition" );
+XML_CONSTASCII_ACTION( sXML_use_draw_objects, "use-draw-objects" );
+XML_CONSTASCII_ACTION( sXML_use_floating_frames, "use-floating-frames" );
+XML_CONSTASCII_ACTION( sXML_use_graphics, "use-graphics" );
+XML_CONSTASCII_ACTION( sXML_use_image_objects, "use-image-objects" );
+XML_CONSTASCII_ACTION( sXML_use_index_marks, "use-index-marks" );
+XML_CONSTASCII_ACTION( sXML_use_index_source_styles, "use-index-source-styles" );
+XML_CONSTASCII_ACTION( sXML_use_keys_as_entries, "use-keys-as-entries" );
+XML_CONSTASCII_ACTION( sXML_use_label, "use-label" );
+XML_CONSTASCII_ACTION( sXML_use_math_objects, "use-math-objects" );
+XML_CONSTASCII_ACTION( sXML_use_objects, "use-objects" );
+XML_CONSTASCII_ACTION( sXML_use_optimal_column_width, "use-optimal-column-width");
+XML_CONSTASCII_ACTION( sXML_use_optimal_row_height, "use-optimal-row-height");
+XML_CONSTASCII_ACTION( sXML_use_other_objects, "use-other-objects" );
+XML_CONSTASCII_ACTION( sXML_use_soft_page_breaks, "use-soft-page-breaks" );
+XML_CONSTASCII_ACTION( sXML_use_spreadsheet_objects, "use-spreadsheet-objects" );
+XML_CONSTASCII_ACTION( sXML_use_styles, "use-styles" );
+XML_CONSTASCII_ACTION( sXML_use_tables, "use-tables" );
+XML_CONSTASCII_ACTION( sXML_use_window_font_color, "use-window-font-color" );
+XML_CONSTASCII_ACTION( sXML_used_hierarchy, "used-hierarchy");
+XML_CONSTASCII_ACTION( sXML_user_defined, "user-defined" );
+XML_CONSTASCII_ACTION( sXML_user_field_decl, "user-field-decl" );
+XML_CONSTASCII_ACTION( sXML_user_field_decls, "user-field-decls" );
+XML_CONSTASCII_ACTION( sXML_user_field_get, "user-field-get" );
+XML_CONSTASCII_ACTION( sXML_user_field_input, "user-field-input" );
+XML_CONSTASCII_ACTION( sXML_user_index, "user-index" );
+XML_CONSTASCII_ACTION( sXML_user_index_entry_template, "user-index-entry-template" );
+XML_CONSTASCII_ACTION( sXML_user_index_mark, "user-index-mark" );
+XML_CONSTASCII_ACTION( sXML_user_index_mark_end, "user-index-mark-end" );
+XML_CONSTASCII_ACTION( sXML_user_index_mark_start, "user-index-mark-start" );
+XML_CONSTASCII_ACTION( sXML_user_index_source, "user-index-source" );
+XML_CONSTASCII_ACTION( sXML_user_transformed, "user-transformed" );
+XML_CONSTASCII_ACTION( sXML_username, "username");
+XML_CONSTASCII_ACTION( sXML_value, "value");
+XML_CONSTASCII_ACTION( sXML_value_type, "value-type");
+XML_CONSTASCII_ACTION( sXML_values_cell_range_address, "values-cell-range-address" );
+XML_CONSTASCII_ACTION( sXML_var, "var" );
+XML_CONSTASCII_ACTION( sXML_variable, "variable" );
+XML_CONSTASCII_ACTION( sXML_variable_decl, "variable-decl" );
+XML_CONSTASCII_ACTION( sXML_variable_decls, "variable-decls" );
+XML_CONSTASCII_ACTION( sXML_variable_get, "variable-get" );
+XML_CONSTASCII_ACTION( sXML_variable_input, "variable-input" );
+XML_CONSTASCII_ACTION( sXML_variable_set, "variable-set" );
+XML_CONSTASCII_ACTION( sXML_variance, "variance" );
+XML_CONSTASCII_ACTION( sXML_varp, "varp" );
+XML_CONSTASCII_ACTION( sXML_vector, "vector" );
+XML_CONSTASCII_ACTION( sXML_verb, "verb" );
+XML_CONSTASCII_ACTION( sXML_version, "version" );
+XML_CONSTASCII_ACTION( sXML_version_entry, "version-entry" );
+XML_CONSTASCII_ACTION( sXML_version_list, "version-list" );
+XML_CONSTASCII_ACTION( sXML_vertical, "vertical" );
+XML_CONSTASCII_ACTION( sXML_vertical_align, "vertical-align" );
+XML_CONSTASCII_ACTION( sXML_vertical_lines, "vertical-lines" );
+XML_CONSTASCII_ACTION( sXML_vertical_pos, "vertical-pos" );
+XML_CONSTASCII_ACTION( sXML_vertical_rel, "vertical-rel" );
+XML_CONSTASCII_ACTION( sXML_vertical_segments, "vertical-segments" );
+XML_CONSTASCII_ACTION( sXML_vertical_split_mode, "vertical-split-mode" );
+XML_CONSTASCII_ACTION( sXML_vertical_split_position, "vertical-split-position" );
+XML_CONSTASCII_ACTION( sXML_vertical_stripes, "vertical-stripes" );
+XML_CONSTASCII_ACTION( sXML_view, "view" );
+XML_CONSTASCII_ACTION( sXML_viewBox, "viewBox" );
+XML_CONSTASCII_ACTION( sXML_view_id, "view-id" );
+XML_CONSTASCII_ACTION( sXML_view_settings, "view-settings" );
+XML_CONSTASCII_ACTION( sXML_visibility, "visibility" );
+XML_CONSTASCII_ACTION( sXML_visible, "visible" );
+XML_CONSTASCII_ACTION( sXML_visible_area, "visible-area" );
+XML_CONSTASCII_ACTION( sXML_visible_area_height, "visible-area-height" );
+XML_CONSTASCII_ACTION( sXML_visible_area_left, "visible-area-left" );
+XML_CONSTASCII_ACTION( sXML_visible_area_top, "visible-area-top" );
+XML_CONSTASCII_ACTION( sXML_visible_area_width, "visible-area-width" );
+XML_CONSTASCII_ACTION( sXML_visited_style_name, "visited-style-name" );
+XML_CONSTASCII_ACTION( sXML_volatile, "volatile" );
+XML_CONSTASCII_ACTION( sXML_volume, "volume" );
+XML_CONSTASCII_ACTION( sXML_vpn, "vpn");
+XML_CONSTASCII_ACTION( sXML_vrp, "vrp");
+XML_CONSTASCII_ACTION( sXML_vup, "vup");
+XML_CONSTASCII_ACTION( sXML_wall, "wall" );
+XML_CONSTASCII_ACTION( sXML_warning, "warning" );
+XML_CONSTASCII_ACTION( sXML_watermark, "watermark" );
+XML_CONSTASCII_ACTION( sXML_wavyline_from_bottom, "wavyline-from-bottom" );
+XML_CONSTASCII_ACTION( sXML_wavyline_from_left, "wavyline-from-left" );
+XML_CONSTASCII_ACTION( sXML_wavyline_from_right, "wavyline-from-right" );
+XML_CONSTASCII_ACTION( sXML_wavyline_from_top, "wavyline-from-top" );
+XML_CONSTASCII_ACTION( sXML_week_of_year, "week-of-year" );
+XML_CONSTASCII_ACTION( sXML_weight_bold, "bold" );
+XML_CONSTASCII_ACTION( sXML_weight_normal, "normal" );
+XML_CONSTASCII_ACTION( sXML_white, "white" );
+XML_CONSTASCII_ACTION( sXML_whole_page, "whole-page" );
+XML_CONSTASCII_ACTION( sXML_widows, "widows" );
+XML_CONSTASCII_ACTION( sXML_width, "width" );
+XML_CONSTASCII_ACTION( sXML_word, "word" );
+XML_CONSTASCII_ACTION( sXML_word_count, "word-count" );
+XML_CONSTASCII_ACTION( sXML_wrap, "wrap" );
+XML_CONSTASCII_ACTION( sXML_wrap_contour, "wrap-contour" );
+XML_CONSTASCII_ACTION( sXML_wrap_contour_mode, "wrap-contour-mode" );
+XML_CONSTASCII_ACTION( sXML_wrap_option, "wrap-option" );
+XML_CONSTASCII_ACTION( sXML_writing_mode, "writing-mode" );
+XML_CONSTASCII_ACTION( sXML_www, "www" );
+XML_CONSTASCII_ACTION( sXML_x, "x" );
+XML_CONSTASCII_ACTION( sXML_x1, "x1" );
+XML_CONSTASCII_ACTION( sXML_x2, "x2" );
+XML_CONSTASCII_ACTION( sXML_x_mac_roman, "x-mac-roman" );
+XML_CONSTASCII_ACTION( sXML_x_symbol, "x-symbol" );
+XML_CONSTASCII_ACTION( sXML_x_system, "x-system" );
+XML_CONSTASCII_ACTION( sXML_xor, "xor" );
+XML_CONSTASCII_ACTION( sXML_y, "y" );
+XML_CONSTASCII_ACTION( sXML_y1, "y1" );
+XML_CONSTASCII_ACTION( sXML_y2, "y2" );
+XML_CONSTASCII_ACTION( sXML_year, "year" );
+XML_CONSTASCII_ACTION( sXML_yellow, "yellow" );
+XML_CONSTASCII_ACTION( sXML_zero_values, "zero-values" );
+XML_CONSTASCII_ACTION( sXML_zindex, "z-index" );
+XML_CONSTASCII_ACTION( sXML_zoom_type, "zoom-type" );
+XML_CONSTASCII_ACTION( sXML_zoom_value, "zoom-value" );
+
+XML_CONSTASCII_ACTION( sXML_start_shape, "start-shape");
+XML_CONSTASCII_ACTION( sXML_start_glue_point, "start-glue-point");
+XML_CONSTASCII_ACTION( sXML_end_shape, "end-shape");
+XML_CONSTASCII_ACTION( sXML_end_glue_point, "end-glue-point");
+XML_CONSTASCII_ACTION( sXML_line_number, "line-number");
+XML_CONSTASCII_ACTION( sXML_line_skew, "line-skew");
+XML_CONSTASCII_ACTION( sXML_curve, "curve" );
+XML_CONSTASCII_ACTION( sXML_start_line_spacing_horizontal, "start-line-spacing-horizontal" );
+XML_CONSTASCII_ACTION( sXML_start_line_spacing_vertical, "start-line-spacing-vertical" );
+XML_CONSTASCII_ACTION( sXML_end_line_spacing_horizontal, "end-line-spacing-horizontal" );
+XML_CONSTASCII_ACTION( sXML_end_line_spacing_vertical, "end-line-spacing-vertical" );
+XML_CONSTASCII_ACTION( sXML_line_distance, "line-distance" );
+XML_CONSTASCII_ACTION( sXML_guide_overhang, "guide-overhang" );
+XML_CONSTASCII_ACTION( sXML_guide_distance, "guide-distance" );
+XML_CONSTASCII_ACTION( sXML_start_guide, "start-guide" );
+XML_CONSTASCII_ACTION( sXML_end_guide, "end-guide" );
+
+XML_CONSTASCII_ACTION( sXML_dots1, "dots1" );
+XML_CONSTASCII_ACTION( sXML_dots1_length, "dots1-length" );
+XML_CONSTASCII_ACTION( sXML_dots2, "dots2" );
+XML_CONSTASCII_ACTION( sXML_dots2_length, "dots2-length" );
+XML_CONSTASCII_ACTION( sXML_enable_numbering, "enable-numbering" );
+
+XML_CONSTASCII_ACTION( sXML_top_left, "top-left" );
+XML_CONSTASCII_ACTION( sXML_top_right, "top-right" );
+XML_CONSTASCII_ACTION( sXML_bottom_left, "bottom-left" );
+XML_CONSTASCII_ACTION( sXML_bottom_right, "bottom-right" );
+
+XML_CONSTASCII_ACTION( sXML_fill_image_ref_point, "fill-image-ref-point" );
+XML_CONSTASCII_ACTION( sXML_fill_image_ref_point_x, "fill-image-ref-point-x" );
+XML_CONSTASCII_ACTION( sXML_fill_image_ref_point_y, "fill-image-ref-point-y" );
+
+XML_CONSTASCII_ACTION( sXML_from_right, "from-right" );
+XML_CONSTASCII_ACTION( sXML_from_bottom, "from-bottom" );
+XML_CONSTASCII_ACTION( sXML_from_center, "from-center" );
+XML_CONSTASCII_ACTION( sXML_from_upper_left, "from-upper-left" );
+XML_CONSTASCII_ACTION( sXML_from_upper_right, "from-upper-right" );
+XML_CONSTASCII_ACTION( sXML_from_lower_left, "from-lower-left" );
+XML_CONSTASCII_ACTION( sXML_from_lower_right, "from-lower-right" );
+XML_CONSTASCII_ACTION( sXML_to_left, "to-left" );
+XML_CONSTASCII_ACTION( sXML_to_top, "to-top" );
+XML_CONSTASCII_ACTION( sXML_to_right, "to-right" );
+XML_CONSTASCII_ACTION( sXML_to_bottom, "to-bottom" );
+XML_CONSTASCII_ACTION( sXML_to_upper_left, "to-upper-left" );
+XML_CONSTASCII_ACTION( sXML_to_upper_right, "to-upper-right" );
+XML_CONSTASCII_ACTION( sXML_to_lower_right, "to-lower-right" );
+XML_CONSTASCII_ACTION( sXML_to_lower_left, "to-lower-left" );
+XML_CONSTASCII_ACTION( sXML_to_center, "to-center" );
+XML_CONSTASCII_ACTION( sXML_counter_clockwise, "counter-clockwise" );
+
+XML_CONSTASCII_ACTION( sXML_fade, "fade" );
+XML_CONSTASCII_ACTION( sXML_move, "move" );
+XML_CONSTASCII_ACTION( sXML_stripes, "stripes" );
+XML_CONSTASCII_ACTION( sXML_spiral_inward_left, "spiral-inward-left" );
+XML_CONSTASCII_ACTION( sXML_spiral_inward_right, "spiral-inward-right" );
+XML_CONSTASCII_ACTION( sXML_spiral_outward_left, "spiral-outward-left" );
+XML_CONSTASCII_ACTION( sXML_spiral_outward_right, "spiral-outward-right" );
+XML_CONSTASCII_ACTION( sXML_spiral, "spiral" );
+XML_CONSTASCII_ACTION( sXML_spiral_in, "spiral-in" );
+XML_CONSTASCII_ACTION( sXML_spiral_out, "spiral-out" );
+XML_CONSTASCII_ACTION( sXML_wavyline, "wavyline" );
+XML_CONSTASCII_ACTION( sXML_laser, "laser" );
+XML_CONSTASCII_ACTION( sXML_appear, "appear" );
+XML_CONSTASCII_ACTION( sXML_hide, "hide" );
+XML_CONSTASCII_ACTION( sXML_move_short, "move-short" );
+XML_CONSTASCII_ACTION( sXML_checkerboard, "checkerboard" );
+XML_CONSTASCII_ACTION( sXML_stretch, "stretch" );
+
+XML_CONSTASCII_ACTION( sXML_shape_id, "shape-id" );
+XML_CONSTASCII_ACTION( sXML_effect, "effect" );
+XML_CONSTASCII_ACTION( sXML_speed, "speed" );
+XML_CONSTASCII_ACTION( sXML_start_scale, "start-scale" );
+XML_CONSTASCII_ACTION( sXML_show_shape, "show-shape" );
+XML_CONSTASCII_ACTION( sXML_show_text, "show-text" );
+XML_CONSTASCII_ACTION( sXML_hide_shape, "hide-shape" );
+XML_CONSTASCII_ACTION( sXML_hide_text, "hide-text" );
+XML_CONSTASCII_ACTION( sXML_dim, "dim" );
+XML_CONSTASCII_ACTION( sXML_sound, "sound" );
+XML_CONSTASCII_ACTION( sXML_play_full, "play-full" );
+XML_CONSTASCII_ACTION( sXML_path_id, "path-id" );
+
+XML_CONSTASCII_ACTION( sXML_animations, "animations" );
+
+XML_CONSTASCII_ACTION( sXML_kind, "kind" );
+XML_CONSTASCII_ACTION( sXML_start_angle, "start-angle" );
+XML_CONSTASCII_ACTION( sXML_cut, "cut" );
+XML_CONSTASCII_ACTION( sXML_arc, "arc" );
+
+XML_CONSTASCII_ACTION( sXML_upright, "upright" );
+XML_CONSTASCII_ACTION( sXML_slant_x, "slant-x" );
+XML_CONSTASCII_ACTION( sXML_slant_y, "slant-y" );
+XML_CONSTASCII_ACTION( sXML_autosize, "autosize" );
+XML_CONSTASCII_ACTION( sXML_slant, "slant" );
+XML_CONSTASCII_ACTION( sXML_topcircle, "top-circle" );
+XML_CONSTASCII_ACTION( sXML_bottomcircle, "bottom-circle" );
+XML_CONSTASCII_ACTION( sXML_leftcircle, "left-circle" );
+XML_CONSTASCII_ACTION( sXML_rightcircle, "right-circle" );
+XML_CONSTASCII_ACTION( sXML_toparc, "top-arc" );
+XML_CONSTASCII_ACTION( sXML_bottomarc, "bottom-arc" );
+XML_CONSTASCII_ACTION( sXML_leftarc, "left-arc" );
+XML_CONSTASCII_ACTION( sXML_rightarc, "right-arc" );
+XML_CONSTASCII_ACTION( sXML_button1, "button1" );
+XML_CONSTASCII_ACTION( sXML_button2, "button2" );
+XML_CONSTASCII_ACTION( sXML_button3, "button3" );
+XML_CONSTASCII_ACTION( sXML_button4, "button4" );
+
+XML_CONSTASCII_ACTION( sXML_caption_type, "caption-type" );
+XML_CONSTASCII_ACTION( sXML_caption_angle_type, "caption-angle-type" );
+XML_CONSTASCII_ACTION( sXML_caption_angle, "caption-angle" );
+XML_CONSTASCII_ACTION( sXML_caption_gap, "caption-gap" );
+XML_CONSTASCII_ACTION( sXML_caption_escape_direction, "caption-escape-direction" );
+XML_CONSTASCII_ACTION( sXML_caption_escape, "caption-escape" );
+XML_CONSTASCII_ACTION( sXML_caption_line_length, "caption-line-length" );
+XML_CONSTASCII_ACTION( sXML_caption_fit_line_length, "caption-fit-line-length" );
+XML_CONSTASCII_ACTION( sXML_free, "free" );
+
+XML_CONSTASCII_ACTION( sXML_straight_line, "straight-line" );
+XML_CONSTASCII_ACTION( sXML_angled_line, "angled-line" );
+XML_CONSTASCII_ACTION( sXML_angled_connector_line, "angled-connector-line" );
+
+XML_CONSTASCII_ACTION( sXML_data_source_has_labels, "data-source-has-labels" );
+
+XML_CONSTASCII_ACTION( sXML_play, "play" );
+XML_CONSTASCII_ACTION( sXML_handout_master, "handout-master" );
+
+XML_CONSTASCII_ACTION( sXML_escape_direction, "escape-direction" );
+XML_CONSTASCII_ACTION( sXML_glue_point, "glue-point" );
+
+XML_CONSTASCII_ACTION( sXML_text_style_name, "text-style-name" );
+
+XML_CONSTASCII_ACTION( sXML_sort_algorithm, "sort-algorithm" );
+XML_CONSTASCII_ACTION( sXML_roll_from_top, "roll-from-top" );
+
+XML_CONSTASCII_ACTION( sXML_script_data, "script-data" );
+XML_CONSTASCII_ACTION( sXML_libraries, "libraries" );
+XML_CONSTASCII_ACTION( sXML_source_code, "source-code" );
+XML_CONSTASCII_ACTION( sXML_readonly, "readonly" );
+
+XML_CONSTASCII_ACTION( sXML_page_continuation, "page-continuation" );
+
+XML_CONSTASCII_ACTION( sXML_contains, "contains" );
+XML_CONSTASCII_ACTION( sXML_does_not_contain, "does-not-contain" );
+XML_CONSTASCII_ACTION( sXML_begins_with, "begins-with" );
+XML_CONSTASCII_ACTION( sXML_does_not_begin_with, "does-not-begin-with" );
+XML_CONSTASCII_ACTION( sXML_ends_with, "ends-with" );
+XML_CONSTASCII_ACTION( sXML_does_not_end_with, "does-not-end-with" );
+
+#endif
diff --git a/xmloff/inc/xmloff/xmlmetae.hxx b/xmloff/inc/xmloff/xmlmetae.hxx
new file mode 100644
index 000000000000..abbcd03124b0
--- /dev/null
+++ b/xmloff/inc/xmloff/xmlmetae.hxx
@@ -0,0 +1,129 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLMETAE_HXX
+#define _XMLOFF_XMLMETAE_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include "sal/types.h"
+
+#include <cppuhelper/implbase1.hxx>
+#include <xmloff/xmltoken.hxx>
+
+#include <vector>
+
+#include <com/sun/star/beans/StringPair.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/document/XDocumentProperties.hpp>
+
+
+class SvXMLExport;
+
+/** export meta data from an <type>XDocumentProperties</type> instance.
+
+ <p>
+ This class will start the export at the office:meta element,
+ not at the root element. This means that when <method>Export</method>
+ is called here, the document root element must already be written, but
+ office:meta must <em>not</em> be written.
+ </p>
+ */
+class XMLOFF_DLLPUBLIC SvXMLMetaExport : public ::cppu::WeakImplHelper1<
+ ::com::sun::star::xml::sax::XDocumentHandler >
+{
+private:
+ SvXMLExport& mrExport;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::document::XDocumentProperties> mxDocProps;
+ /// counts levels of the xml document. necessary for special handling.
+ int m_level;
+ /// preserved namespaces. necessary because we do not write the root node.
+ std::vector< ::com::sun::star::beans::StringPair > m_preservedNSs;
+
+ SAL_DLLPRIVATE void SimpleStringElement(
+ const ::rtl::OUString& rText, sal_uInt16 nNamespace,
+ enum ::xmloff::token::XMLTokenEnum eElementName );
+ SAL_DLLPRIVATE void SimpleDateTimeElement(
+ const ::com::sun::star::util::DateTime & rDate, sal_uInt16 nNamespace,
+ enum ::xmloff::token::XMLTokenEnum eElementName );
+
+ /// currently unused; for exporting via the XDocumentProperties interface
+ SAL_DLLPRIVATE void _MExport();
+
+public:
+ SvXMLMetaExport( SvXMLExport& i_rExport,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::document::XDocumentProperties>& i_rDocProps);
+
+ virtual ~SvXMLMetaExport();
+
+ /// export via XSAXWriter interface, with fallback to _MExport
+ void Export();
+
+ static ::rtl::OUString GetISODateTimeString(
+ const ::com::sun::star::util::DateTime& rDateTime );
+
+ // ::com::sun::star::xml::sax::XDocumentHandler:
+ virtual void SAL_CALL startDocument()
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::xml::sax::SAXException);
+ virtual void SAL_CALL endDocument()
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::xml::sax::SAXException);
+ virtual void SAL_CALL startElement(const ::rtl::OUString & i_rName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & i_xAttribs)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::xml::sax::SAXException);
+ virtual void SAL_CALL endElement(const ::rtl::OUString & i_rName)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::xml::sax::SAXException);
+ virtual void SAL_CALL characters(const ::rtl::OUString & i_rChars)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::xml::sax::SAXException);
+ virtual void SAL_CALL ignorableWhitespace(
+ const ::rtl::OUString & i_rWhitespaces)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::xml::sax::SAXException);
+ virtual void SAL_CALL processingInstruction(
+ const ::rtl::OUString & i_rTarget, const ::rtl::OUString & i_rData)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::xml::sax::SAXException);
+ virtual void SAL_CALL setDocumentLocator(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XLocator > & i_xLocator)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::xml::sax::SAXException);
+
+};
+
+#endif // _XMLOFF_XMLMETAE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/xmlmetai.hxx b/xmloff/inc/xmloff/xmlmetai.hxx
new file mode 100644
index 000000000000..5d5e470f3be3
--- /dev/null
+++ b/xmloff/inc/xmloff/xmlmetai.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLMETAI_HXX
+#define _XMLOFF_XMLMETAI_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include <xmloff/xmlictxt.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+
+
+/// handles the top-level office:document-meta element of meta.xml documents
+// NB: virtual inheritance is needed so that the context that handles the
+// flat xml file format can multiply inherit properly
+class XMLOFF_DLLPUBLIC SvXMLMetaDocumentContext
+ : public virtual SvXMLImportContext
+{
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::document::XDocumentProperties> mxDocProps;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XDocumentHandler> mxDocBuilder;
+
+public:
+ SvXMLMetaDocumentContext(SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::document::XDocumentProperties>& xDocProps,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XDocumentHandler>& xDocBuilder);
+
+ virtual ~SvXMLMetaDocumentContext();
+
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void EndElement();
+
+protected:
+ /// initialize DocumentProperties object with DOM and base URL
+ void initDocumentProperties();
+ // set the BuildId property at the importer
+ void setBuildId(const ::rtl::OUString & i_rBuildId);
+
+public:
+ static void setBuildId(const ::rtl::OUString & rGenerator,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& xImportInfo );
+};
+
+#endif // _XMLOFF_XMLMETAI_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/xmlnmspe.hxx b/xmloff/inc/xmloff/xmlnmspe.hxx
new file mode 100644
index 000000000000..2f4615da2a2c
--- /dev/null
+++ b/xmloff/inc/xmloff/xmlnmspe.hxx
@@ -0,0 +1,114 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLNMSPE_HXX
+#define _XMLOFF_XMLNMSPE_HXX
+
+#include <sal/types.h>
+
+#define XML_NAMESPACE( prefix, key ) \
+const sal_uInt16 XML_NAMESPACE_##prefix = key; \
+const sal_uInt16 XML_NAMESPACE_##prefix##_IDX = key;
+
+#define XML_OLD_NAMESPACE( prefix, index ) \
+const sal_uInt16 XML_OLD_NAMESPACE_##prefix##_IDX = \
+ (_XML_OLD_NAMESPACE_BASE+index);
+
+// current namespaces
+// These namespaces have the same index in the namespace table as prefix used.
+// If a namespace is added, _XML_OLD_NAMESPACE_BASE has to be adjusted!
+XML_NAMESPACE( OFFICE, 0U )
+XML_NAMESPACE( STYLE, 1U )
+XML_NAMESPACE( TEXT , 2U )
+XML_NAMESPACE( TABLE, 3U )
+XML_NAMESPACE( DRAW , 4U )
+XML_NAMESPACE( FO , 5U )
+XML_NAMESPACE( XLINK, 6U )
+XML_NAMESPACE( DC , 7U )
+XML_NAMESPACE( META , 8U )
+XML_NAMESPACE( NUMBER, 9U )
+XML_NAMESPACE( PRESENTATION, 10U )
+XML_NAMESPACE( SVG, 11U )
+XML_NAMESPACE( CHART, 12U )
+XML_NAMESPACE( DR3D, 13U )
+XML_NAMESPACE( MATH, 14U )
+XML_NAMESPACE( FORM, 15U )
+XML_NAMESPACE( SCRIPT, 16U )
+XML_NAMESPACE( BLOCKLIST, 17U )
+XML_NAMESPACE( FRAMEWORK, 18U )
+XML_NAMESPACE( CONFIG, 19U )
+XML_NAMESPACE( OOO, 20U )
+XML_NAMESPACE( OOOW, 21U )
+XML_NAMESPACE( OOOC, 22U )
+XML_NAMESPACE( DOM, 23U )
+XML_NAMESPACE( TCD, 24U ) // text conversion dictionary
+XML_NAMESPACE( DB, 25U )
+XML_NAMESPACE( DLG, 26U )
+XML_NAMESPACE( XFORMS, 27U )
+XML_NAMESPACE( XSD, 28U )
+XML_NAMESPACE( XSI, 29U )
+XML_NAMESPACE( SMIL, 30U )
+XML_NAMESPACE( ANIMATION, 31U )
+XML_NAMESPACE( XML, 32U )
+XML_NAMESPACE( REPORT, 33U )
+XML_NAMESPACE( OF, 34U ) // OpenFormula aka ODFF
+XML_NAMESPACE( XHTML, 35U )
+XML_NAMESPACE( GRDDL, 36U )
+
+// namespaces for odf extended formats
+
+#define XML_NAMESPACE_EXT( prefix, key ) \
+const sal_uInt16 XML_NAMESPACE_##prefix##_EXT = key; \
+const sal_uInt16 XML_NAMESPACE_##prefix##_EXT_IDX = key;
+
+XML_NAMESPACE_EXT( OFFICE, 37U )
+XML_NAMESPACE_EXT( TABLE, 38U )
+XML_NAMESPACE_EXT( CHART, 39U )
+XML_NAMESPACE_EXT( DRAW, 40U )
+
+#define _XML_OLD_NAMESPACE_BASE 41U
+
+// namespaces used in the technical preview (SO 5.2)
+XML_OLD_NAMESPACE( FO, 0U )
+XML_OLD_NAMESPACE( XLINK, 1U )
+
+XML_OLD_NAMESPACE( OFFICE, 2U )
+XML_OLD_NAMESPACE( STYLE, 3U )
+XML_OLD_NAMESPACE( TEXT, 4U )
+XML_OLD_NAMESPACE( TABLE, 5U )
+XML_OLD_NAMESPACE( META, 6U )
+
+// experimental namespaces
+XML_NAMESPACE( FIELD, 100U )
+XML_NAMESPACE( CSS3TEXT, 103U ) // CSS Text Level 3
+XML_NAMESPACE( FORMX, 101U ) // form interop extensions
+
+
+#endif // _XMLOFF_XMLNMSPE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/xmlnume.hxx b/xmloff/inc/xmloff/xmlnume.hxx
new file mode 100644
index 000000000000..473bec6d5dec
--- /dev/null
+++ b/xmloff/inc/xmloff/xmlnume.hxx
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLNUME_HXX
+#define _XMLOFF_XMLNUME_HXX
+
+#include <rtl/ustring.hxx>
+#include <tools/mapunit.hxx>
+#include <xmloff/XMLStringVector.hxx>
+#include <xmloff/attrlist.hxx>
+
+namespace com { namespace sun { namespace star {
+ namespace frame { class XModel; }
+ namespace style { class XStyle; }
+ namespace container { class XIndexReplace; }
+ namespace beans { struct PropertyValue; }
+} } }
+
+class SvXMLNamespaceMap;
+class SvXMLUnitConverter;
+class SvXMLExportItemMapper;
+class SvXMLExport;
+class XMLTextListAutoStylePool;
+
+class SvxXMLNumRuleExport
+{
+ SvXMLExport& rExport;
+ const ::rtl::OUString sCDATA;
+ const ::rtl::OUString sWS;
+ const ::rtl::OUString sNumberingRules;
+ const ::rtl::OUString sIsPhysical;
+ const ::rtl::OUString sIsContinuousNumbering;
+ // Boolean indicating, if properties for position-and-space-mode LABEL_ALIGNEMNT
+ // are exported or not. (#i89178#)
+ // These properties have been introduced in ODF 1.2. Thus, its export have
+ // to be suppressed on writing ODF 1.0 respectively ODF 1.1
+ bool mbExportPositionAndSpaceModeLabelAlignment;
+
+ void exportLevelStyles(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XIndexReplace > & xNumRule,
+ sal_Bool bOutline=sal_False );
+
+ void exportLevelStyle(
+ sal_Int32 nLevel,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue>& rProps,
+ sal_Bool bOutline=sal_False );
+
+protected:
+
+ // This method may be overloaded to add attributes to the <list-style>
+ // element.
+ virtual void AddListStyleAttributes();
+
+ sal_Bool exportStyle( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::style::XStyle >& rStyle );
+ void exportOutline();
+
+ SvXMLExport& GetExport() { return rExport; }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace > GetUNONumRule() const;
+
+public:
+
+ SvxXMLNumRuleExport( SvXMLExport& rExport );
+ virtual ~SvxXMLNumRuleExport();
+
+ void exportStyles( sal_Bool bUsed,
+ XMLTextListAutoStylePool *pPool,
+ sal_Bool bExportChapterNumbering = sal_True );
+ void exportNumberingRule(
+ const ::rtl::OUString& rName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XIndexReplace > & xNumRule );
+
+ static sal_Bool GetOutlineStyles( XMLStringVector& rStyleNames,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & rModel );
+
+};
+
+#endif // _XMLOFF_XMLNUME_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/xmlnumfe.hxx b/xmloff/inc/xmloff/xmlnumfe.hxx
new file mode 100644
index 000000000000..b1f00e72ca95
--- /dev/null
+++ b/xmloff/inc/xmloff/xmlnumfe.hxx
@@ -0,0 +1,142 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLNUMFE_HXX
+#define _XMLOFF_XMLNUMFE_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include "sal/types.h"
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include <com/sun/star/uno/Sequence.h>
+#include <rtl/ustrbuf.hxx>
+
+#define XML_WRITTENNUMBERSTYLES "WrittenNumberStyles"
+
+class Color;
+class LocaleDataWrapper;
+class CharClass;
+class SvXMLExport;
+class SvXMLNamespaceMap;
+class SvXMLAttributeList;
+class SvNumberFormatter;
+class SvNumberformat;
+class SvXMLNumUsedList_Impl;
+class SvXMLEmbeddedTextEntryArr;
+
+class XMLOFF_DLLPUBLIC SvXMLNumFmtExport
+{
+private:
+ SvXMLExport& rExport;
+ ::rtl::OUString sPrefix;
+ SvNumberFormatter* pFormatter;
+ ::rtl::OUStringBuffer sTextContent;
+ SvXMLNumUsedList_Impl* pUsedList;
+ CharClass* pCharClass;
+ LocaleDataWrapper* pLocaleData;
+
+ SAL_DLLPRIVATE void AddCalendarAttr_Impl( const ::rtl::OUString& rCalendar );
+ SAL_DLLPRIVATE void AddStyleAttr_Impl( sal_Bool bLong );
+ SAL_DLLPRIVATE void AddTextualAttr_Impl( sal_Bool bText );
+ SAL_DLLPRIVATE void AddLanguageAttr_Impl( sal_Int32 nLang );
+
+ SAL_DLLPRIVATE void AddToTextElement_Impl( const ::rtl::OUString& rString );
+ SAL_DLLPRIVATE void FinishTextElement_Impl();
+
+ SAL_DLLPRIVATE void WriteColorElement_Impl( const Color& rColor );
+ SAL_DLLPRIVATE void WriteNumberElement_Impl( sal_Int32 nDecimals, sal_Int32 nInteger,
+ const ::rtl::OUString& rDashStr, sal_Bool bVarDecimals,
+ sal_Bool bGrouping, sal_Int32 nTrailingThousands,
+ const SvXMLEmbeddedTextEntryArr& rEmbeddedEntries );
+ SAL_DLLPRIVATE void WriteScientificElement_Impl( sal_Int32 nDecimals, sal_Int32 nInteger,
+ sal_Bool bGrouping, sal_Int32 nExp );
+ SAL_DLLPRIVATE void WriteFractionElement_Impl( sal_Int32 nInteger, sal_Bool bGrouping,
+ sal_Int32 nNumerator, sal_Int32 nDenominator );
+ SAL_DLLPRIVATE void WriteCurrencyElement_Impl( const ::rtl::OUString& rString,
+ const ::rtl::OUString& rExt );
+ SAL_DLLPRIVATE void WriteBooleanElement_Impl();
+ SAL_DLLPRIVATE void WriteTextContentElement_Impl();
+ SAL_DLLPRIVATE void WriteDayElement_Impl( const ::rtl::OUString& rCalendar, sal_Bool bLong );
+ SAL_DLLPRIVATE void WriteMonthElement_Impl( const ::rtl::OUString& rCalendar, sal_Bool bLong, sal_Bool bText );
+ SAL_DLLPRIVATE void WriteYearElement_Impl( const ::rtl::OUString& rCalendar, sal_Bool bLong );
+ SAL_DLLPRIVATE void WriteEraElement_Impl( const ::rtl::OUString& rCalendar, sal_Bool bLong );
+ SAL_DLLPRIVATE void WriteDayOfWeekElement_Impl( const ::rtl::OUString& rCalendar, sal_Bool bLong );
+ SAL_DLLPRIVATE void WriteWeekElement_Impl( const ::rtl::OUString& rCalendar );
+ SAL_DLLPRIVATE void WriteQuarterElement_Impl( const ::rtl::OUString& rCalendar, sal_Bool bLong );
+ SAL_DLLPRIVATE void WriteHoursElement_Impl( sal_Bool bLong );
+ SAL_DLLPRIVATE void WriteMinutesElement_Impl( sal_Bool bLong );
+ SAL_DLLPRIVATE void WriteSecondsElement_Impl( sal_Bool bLong, sal_uInt16 nDecimals );
+ SAL_DLLPRIVATE void WriteAMPMElement_Impl();
+ SAL_DLLPRIVATE void WriteMapElement_Impl( sal_Int32 nOp, double fLimit,
+ sal_Int32 nKey, sal_Int32 nPart );
+
+ SAL_DLLPRIVATE sal_Bool WriteTextWithCurrency_Impl( const ::rtl::OUString& rString,
+ const ::com::sun::star::lang::Locale& rLocale );
+ SAL_DLLPRIVATE void ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt32 nKey,
+ sal_uInt16 nPart, sal_Bool bDefPart );
+
+ SAL_DLLPRIVATE void ExportFormat_Impl( const SvNumberformat& rFormat, sal_uInt32 nKey );
+
+public:
+ SvXMLNumFmtExport( SvXMLExport& rExport,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XNumberFormatsSupplier >& rSupp );
+ SvXMLNumFmtExport( SvXMLExport& rExport,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XNumberFormatsSupplier >& rSupp,
+ const rtl::OUString& rPrefix );
+
+ virtual ~SvXMLNumFmtExport();
+
+ // core API
+ void Export( sal_Bool bIsAutoStyle);
+
+ // mark number format as used
+ void SetUsed( sal_uInt32 nKey );
+
+ // get the style name that was generated for a key
+ ::rtl::OUString GetStyleName( sal_uInt32 nKey );
+
+ void GetWasUsed(com::sun::star::uno::Sequence<sal_Int32>& rWasUsed);
+ void SetWasUsed(const com::sun::star::uno::Sequence<sal_Int32>& rWasUsed);
+
+
+
+ // two methods to allow the field import/export to treat system languages
+ // properly:
+
+ /// obtain number format with system languange for a given key
+ sal_uInt32 ForceSystemLanguage( sal_uInt32 nKey );
+
+ /// determine whether number format uses system language
+ bool IsSystemLanguage( sal_uInt32 nKey );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/xmlnumfi.hxx b/xmloff/inc/xmloff/xmlnumfi.hxx
new file mode 100644
index 000000000000..d5ccc45354ff
--- /dev/null
+++ b/xmloff/inc/xmloff/xmlnumfi.hxx
@@ -0,0 +1,226 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLNUMFI_HXX
+#define _XMLOFF_XMLNUMFI_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include "sal/types.h"
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <xmloff/xmlstyle.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <i18npool/lang.h>
+#include <vector>
+#include <unotools/localedatawrapper.hxx>
+
+#define XML_NUMBERSTYLES "NumberStyles"
+
+enum SvXMLStylesTokens
+{
+ XML_TOK_STYLES_NUMBER_STYLE,
+ XML_TOK_STYLES_CURRENCY_STYLE,
+ XML_TOK_STYLES_PERCENTAGE_STYLE,
+ XML_TOK_STYLES_DATE_STYLE,
+ XML_TOK_STYLES_TIME_STYLE,
+ XML_TOK_STYLES_BOOLEAN_STYLE,
+ XML_TOK_STYLES_TEXT_STYLE
+};
+
+enum SvXMLDateElementAttributes
+{
+ XML_DEA_NONE,
+ XML_DEA_ANY,
+ XML_DEA_SHORT,
+ XML_DEA_LONG,
+ XML_DEA_TEXTSHORT,
+ XML_DEA_TEXTLONG
+};
+
+class Color;
+class SvXMLNumImpData;
+class SvXMLImport;
+class SvXMLStyleContext;
+class SvXMLStylesContext;
+struct SvXMLNumberInfo;
+class SvNumberFormatter;
+class SvtSysLocale;
+
+// use SvXMLNumFmtHelper in the context for <office:styles> to create
+// child contexts for data styles
+
+class SvXMLNumFmtHelper
+{
+ SvXMLNumImpData* pData;
+
+ // #110680#
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxServiceFactory;
+
+public:
+ // #110680#
+ //SvXMLNumFmtHelper( const ::com::sun::star::uno::Reference<
+ // ::com::sun::star::util::XNumberFormatsSupplier >& rSupp );
+ //SvXMLNumFmtHelper( SvNumberFormatter* pNumberFormatter );
+ SvXMLNumFmtHelper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& rSupp,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory );
+
+ SvXMLNumFmtHelper(
+ SvNumberFormatter* pNumberFormatter,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory );
+
+ ~SvXMLNumFmtHelper();
+
+ SvXMLStyleContext* CreateChildContext( SvXMLImport& rImport,
+ sal_uInt16 nPrefix, const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ SvXMLStylesContext& rStyles);
+
+ SvXMLNumImpData* getData() { return pData; }
+
+ const SvXMLTokenMap& GetStylesElemTokenMap();
+
+// sal_uInt32 GetKeyForName( const rtl::OUString& rName );
+};
+
+// SvXMLNumFmtDefaults is used in import and export
+
+class SvXMLNumFmtDefaults
+{
+public:
+ // return value is NfIndexTableOffset
+ static sal_uInt16 GetDefaultDateFormat( SvXMLDateElementAttributes eDOW,
+ SvXMLDateElementAttributes eDay, SvXMLDateElementAttributes eMonth,
+ SvXMLDateElementAttributes eYear, SvXMLDateElementAttributes eHours,
+ SvXMLDateElementAttributes eMins, SvXMLDateElementAttributes eSecs,
+ sal_Bool bSystem );
+};
+
+struct MyCondition
+{
+ rtl::OUString sCondition;
+ rtl::OUString sMapName;
+};
+
+class XMLOFF_DLLPUBLIC SvXMLNumFormatContext : public SvXMLStyleContext
+{
+ SvXMLNumImpData* pData;
+ SvXMLStylesContext* pStyles;
+ std::vector <MyCondition> aMyConditions;
+ sal_uInt16 nType;
+ sal_Int32 nKey;
+// rtl::OUString sFormatName;
+ rtl::OUString sFormatTitle;
+// rtl::OUString sMapName;
+ rtl::OUString sCalendar;
+ rtl::OUString sFormatString;
+ LanguageType nFormatLang;
+ com::sun::star::lang::Locale aLocale;
+ sal_Bool bAutoOrder;
+ sal_Bool bFromSystem;
+ sal_Bool bTruncate;
+ sal_Bool bAutoDec; // set in AddNumber
+ sal_Bool bAutoInt; // set in AddNumber
+ sal_Bool bHasExtraText;
+ rtl::OUStringBuffer aFormatCode;
+ rtl::OUStringBuffer aConditions;
+ sal_Bool bHasLongDoW;
+ sal_Bool bHasEra;
+ sal_Bool bHasDateTime;
+ sal_Bool bRemoveAfterUse;
+
+ // contained date elements, used to recognize default date formats
+ SvXMLDateElementAttributes eDateDOW;
+ SvXMLDateElementAttributes eDateDay;
+ SvXMLDateElementAttributes eDateMonth;
+ SvXMLDateElementAttributes eDateYear;
+ SvXMLDateElementAttributes eDateHours;
+ SvXMLDateElementAttributes eDateMins;
+ SvXMLDateElementAttributes eDateSecs;
+ sal_Bool bDateNoDefault;
+
+ SAL_DLLPRIVATE sal_Int32 PrivateGetKey();
+
+public:
+ SvXMLNumFormatContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLName,
+ SvXMLNumImpData* pNewData, sal_uInt16 nNewType,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ SvXMLStylesContext& rStyles );
+ SvXMLNumFormatContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ const sal_Int32 nKey,
+ SvXMLStylesContext& rStyles );
+ virtual ~SvXMLNumFormatContext();
+
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
+ virtual void CreateAndInsert(sal_Bool bOverwrite);
+ virtual void Finish(sal_Bool bOverwrite);
+
+ SvXMLNumImpData* GetData() const { return pData; }
+ sal_Int32 GetKey();
+ sal_Int32 CreateAndInsert( SvNumberFormatter* pFormatter );
+ sal_Int32 CreateAndInsert( com::sun::star::uno::Reference< com::sun::star::util::XNumberFormatsSupplier >& xFormatsSupplier );
+ sal_uInt16 GetType() const { return nType; } // SvXMLStylesTokens
+
+ sal_Bool IsFromSystem() const { return bFromSystem; }
+ sal_Bool HasLongDoW() const { return bHasLongDoW; }
+ void SetHasLongDoW(sal_Bool bSet) { bHasLongDoW = bSet; }
+ sal_Bool HasEra() const { return bHasEra; }
+ void SetHasEra(sal_Bool bSet) { bHasEra = bSet; }
+
+ void UpdateCalendar( const rtl::OUString& rNewCalendar );
+
+ const LocaleDataWrapper& GetLocaleData() const;
+
+ void AddToCode( const rtl::OUString& rString );
+ void AddNumber( const SvXMLNumberInfo& rInfo );
+ void AddCurrency( const rtl::OUString& rContent, LanguageType nLang );
+
+ void AddNfKeyword( sal_uInt16 nIndex );
+ sal_Bool ReplaceNfKeyword( sal_uInt16 nOld, sal_uInt16 nNew );
+ void AddCondition( const sal_Int32 nIndex );
+ void AddCondition( const sal_Int32 nIndex, const rtl::OUString& rFormat, const LocaleDataWrapper& rData );
+ void AddCondition( const rtl::OUString& rCondition, const rtl::OUString& rApplyName );
+ void AddColor( const Color& rColor );
+
+ /// determine whether number format uses the system language
+ sal_Bool IsSystemLanguage();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/xmlnumi.hxx b/xmloff/inc/xmloff/xmlnumi.hxx
new file mode 100644
index 000000000000..c1c342165730
--- /dev/null
+++ b/xmloff/inc/xmloff/xmlnumi.hxx
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLNUMI_HXX
+#define _XMLOFF_XMLNUMI_HXX
+
+#include <com/sun/star/container/XIndexReplace.hpp>
+
+#include <xmloff/xmlstyle.hxx>
+#include <com/sun/star/style/NumberingType.hpp>
+
+namespace com { namespace sun { namespace star { namespace frame { class XModel; } } } }
+class SvI18NMap;
+class SvxXMLListStyle_Impl;
+
+class SvxXMLListStyleContext : public SvXMLStyleContext
+{
+ const ::rtl::OUString sIsPhysical;
+ const ::rtl::OUString sNumberingRules;
+ const ::rtl::OUString sName;
+ const ::rtl::OUString sIsContinuousNumbering;
+
+ ::com::sun::star::uno::Reference <
+ ::com::sun::star::container::XIndexReplace > xNumRules;
+
+ SvxXMLListStyle_Impl *pLevelStyles;
+
+ sal_Int32 nLevels;
+ sal_Bool bConsecutive : 1;
+ sal_Bool bOutline : 1;
+
+protected:
+
+ virtual void SetAttribute( sal_uInt16 nPrefixKey,
+ const ::rtl::OUString& rLocalName,
+ const ::rtl::OUString& rValue );
+
+public:
+
+ TYPEINFO();
+
+ SvxXMLListStyleContext(
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList >& xAttrList,
+ sal_Bool bOutl=sal_False );
+
+ virtual ~SvxXMLListStyleContext();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ void FillUnoNumRule(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XIndexReplace > & rNumRule,
+ const SvI18NMap *pI18NMap ) const;
+
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::container::XIndexReplace >& GetNumRules() const
+ { return xNumRules; }
+ sal_Bool IsOutline() const { return bOutline; }
+ sal_Bool IsConsecutive() const { return bConsecutive; }
+ sal_Int32 GetLevels() const { return nLevels; }
+
+ static ::com::sun::star::uno::Reference <
+ ::com::sun::star::container::XIndexReplace >
+ CreateNumRule(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::frame::XModel > & rModel );
+
+ static void SetDefaultStyle(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::container::XIndexReplace > & rNumRule,
+ sal_Int16 nLevel,
+ sal_Bool bOrdered );
+
+ virtual void CreateAndInsertLate( sal_Bool bOverwrite );
+
+ void CreateAndInsertAuto() const;
+};
+
+#endif // _XMLOFF_XMLNUMI_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/xmlprcon.hxx b/xmloff/inc/xmloff/xmlprcon.hxx
new file mode 100644
index 000000000000..123f23ed76a7
--- /dev/null
+++ b/xmloff/inc/xmloff/xmlprcon.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLPROPERTYSETCONTEXT_HXX
+#define _XMLOFF_XMLPROPERTYSETCONTEXT_HXX
+
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/xmlimppr.hxx>
+#include <xmloff/xmlprmap.hxx>
+#include <xmloff/uniref.hxx>
+
+namespace rtl { class OUString; }
+
+class SvXMLImportPropertyMapper;
+
+class SvXMLPropertySetContext : public SvXMLImportContext
+{
+protected:
+ sal_Int32 mnStartIdx;
+ sal_Int32 mnEndIdx;
+ sal_uInt32 mnFamily;
+ ::std::vector< XMLPropertyState > &mrProperties;
+ UniReference < SvXMLImportPropertyMapper > mxMapper;
+
+public:
+
+ SvXMLPropertySetContext(
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList,
+ sal_uInt32 nFamily,
+ ::std::vector< XMLPropertyState > &rProps,
+ const UniReference < SvXMLImportPropertyMapper > &rMap,
+ sal_Int32 nStartIdx = -1, sal_Int32 nEndIdx = -1 );
+
+ virtual ~SvXMLPropertySetContext();
+
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ // This method is called from this instance implementation of
+ // CreateChildContext if the element matches an entry in the
+ // SvXMLImportItemMapper with the mid flag MID_FLAG_ELEMENT_ITEM_IMPORT
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList,
+ ::std::vector< XMLPropertyState > &rProperties,
+ const XMLPropertyState& rProp );
+
+};
+
+#endif // _XMLOFF_XMLPROPERTYSETCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/xmlprhdl.hxx b/xmloff/inc/xmloff/xmlprhdl.hxx
new file mode 100644
index 000000000000..e6dfdb2cc36e
--- /dev/null
+++ b/xmloff/inc/xmloff/xmlprhdl.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PROPERTYHANDLERBASE_HXX
+#define _XMLOFF_PROPERTYHANDLERBASE_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include <sal/types.h>
+
+namespace com{ namespace sun{ namespace star{ namespace uno{ class Any; } } } }
+namespace rtl{ class OUString; }
+
+class SvXMLUnitConverter;
+struct XMLPropertyState;
+
+///////////////////////////////////////////////////////////////////////////
+//
+/** Abstract base-class for different XML-types. Derivations of this class
+ knows how to compare, im/export a special XML-type
+*/
+class XMLOFF_DLLPUBLIC XMLPropertyHandler
+{
+ // ??? const SvXMLUnitConverter& rUnitConverter Do we need this ?
+
+public:
+ // Just needed for virtual destruction
+ virtual ~XMLPropertyHandler();
+
+ /** Compares two Any's in case of the given XML-data-type.
+ By default the Any-equal-operator is called. */
+ virtual bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const;
+
+ /// Imports the given value in cas of the given XML-data-type
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const =0;
+ /// Exports the given value in cas of the given XML-data-type
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const =0;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLERBASE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/xmlprmap.hxx b/xmloff/inc/xmloff/xmlprmap.hxx
new file mode 100644
index 000000000000..41b997af86c0
--- /dev/null
+++ b/xmloff/inc/xmloff/xmlprmap.hxx
@@ -0,0 +1,190 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PROPERTYSETMAPPER_HXX
+#define _XMLOFF_PROPERTYSETMAPPER_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+#include <vector>
+#include <xmloff/uniref.hxx>
+#include <xmloff/maptype.hxx>
+#include <xmloff/xmltypes.hxx>
+#include <xmloff/prhdlfac.hxx>
+
+#include <tools/debug.hxx>
+
+class SvXMLUnitConverter;
+class XMLPropertyHandler;
+
+///////////////////////////////////////////////////////////////////////////
+//
+/** Helper-class for XML-im/export:
+ - Holds a pointer to a given array of XMLPropertyMapEntry
+ - Provides several methods to access data from this array
+ - Holds a Sequence of XML-names (for properties)
+ - The filter takes all properties of the XPropertySet which are also
+ in the XMLPropertyMapEntry and which are have not a default value
+ and put them into a vector of XMLPropertyStae
+ - this class knows how to compare, im/export properties
+
+ Attention: At all methods, which get an index as parameter, there is no
+ range validation to save runtime !!
+*/
+struct XMLPropertySetMapperEntry_Impl
+{
+ ::rtl::OUString sXMLAttributeName;
+ ::rtl::OUString sAPIPropertyName;
+ sal_uInt16 nXMLNameSpace;
+ sal_Int32 nType;
+ sal_Int16 nContextId;
+ SvtSaveOptions::ODFDefaultVersion nEarliestODFVersionForExport;
+ const XMLPropertyHandler *pHdl;
+
+ XMLPropertySetMapperEntry_Impl(
+ const XMLPropertyMapEntry& rMapEntry,
+ const UniReference< XMLPropertyHandlerFactory >& rFactory );
+
+ XMLPropertySetMapperEntry_Impl(
+ const XMLPropertySetMapperEntry_Impl& rEntry );
+
+ sal_uInt32 GetPropType() const { return nType & XML_TYPE_PROP_MASK; }
+};
+
+class XMLOFF_DLLPUBLIC XMLPropertySetMapper : public UniRefBase
+{
+ ::std::vector< XMLPropertySetMapperEntry_Impl > aMapEntries;
+ ::std::vector< UniReference < XMLPropertyHandlerFactory > > aHdlFactories;
+
+public:
+ /** The last element of the XMLPropertyMapEntry-array must contain NULL-values */
+ XMLPropertySetMapper(
+ const XMLPropertyMapEntry* pEntries,
+ const UniReference< XMLPropertyHandlerFactory >& rFactory );
+ virtual ~XMLPropertySetMapper();
+
+ void AddMapperEntry( const UniReference < XMLPropertySetMapper >& rMapper );
+
+ /** Return number of entries in input-array */
+ sal_Int32 GetEntryCount() const { return aMapEntries.size(); }
+
+ /** Returns the flags of an entry */
+ sal_uInt32 GetEntryFlags( sal_Int32 nIndex ) const
+ {
+ DBG_ASSERT( (nIndex >= 0) && (nIndex < (sal_Int32)aMapEntries.size() ), "illegal access to invalid entry!" );
+ return aMapEntries[nIndex].nType & ~MID_FLAG_MASK;
+ }
+
+ /** Returns the type of an entry */
+ sal_uInt32 GetEntryType( sal_Int32 nIndex,
+ sal_Bool bWithFlags = sal_True ) const
+ {
+ DBG_ASSERT( (nIndex >= 0) && (nIndex < (sal_Int32)aMapEntries.size() ), "illegal access to invalid entry!" );
+ sal_uInt32 nType = aMapEntries[nIndex].nType;
+ if( !bWithFlags )
+ nType = nType & MID_FLAG_MASK;
+ return nType;
+ }
+
+ /** Returns the namespace-key of an entry */
+ sal_uInt16 GetEntryNameSpace( sal_Int32 nIndex ) const
+ {
+ DBG_ASSERT( (nIndex >= 0) && (nIndex < (sal_Int32)aMapEntries.size() ), "illegal access to invalid entry!" );
+ return aMapEntries[nIndex].nXMLNameSpace;
+ }
+
+ /** Returns the 'local' XML-name of the entry */
+ const ::rtl::OUString& GetEntryXMLName( sal_Int32 nIndex ) const
+ {
+ DBG_ASSERT( (nIndex >= 0) && (nIndex < (sal_Int32)aMapEntries.size() ), "illegal access to invalid entry!" );
+ return aMapEntries[nIndex].sXMLAttributeName;
+ }
+
+ /** Returns the entry API name */
+ const ::rtl::OUString& GetEntryAPIName( sal_Int32 nIndex ) const
+ {
+ DBG_ASSERT( (nIndex >= 0) && (nIndex < (sal_Int32)aMapEntries.size() ), "illegal access to invalid entry!" );
+ return aMapEntries[nIndex].sAPIPropertyName;
+ }
+
+ /** returns the entry context id. -1 is a valid index here. */
+ sal_Int16 GetEntryContextId( sal_Int32 nIndex ) const
+ {
+ DBG_ASSERT( (nIndex >= -1) && (nIndex < (sal_Int32)aMapEntries.size() ), "illegal access to invalid entry!" );
+ return nIndex == -1 ? 0 : aMapEntries[nIndex].nContextId;
+ }
+
+ /** returns the earliest odf version for which this property should be exported. */
+ SvtSaveOptions::ODFDefaultVersion GetEarliestODFVersionForExport( sal_Int32 nIndex ) const
+ {
+ DBG_ASSERT( (nIndex >= -1) && (nIndex < (sal_Int32)aMapEntries.size() ), "illegal access to invalid entry!" );
+ return nIndex == -1 ? SvtSaveOptions::ODFVER_UNKNOWN : aMapEntries[nIndex].nEarliestODFVersionForExport;
+ }
+
+ /** Returns the index of an entry with the given XML-name and namespace
+ If there is no matching entry the method returns -1 */
+ sal_Int32 GetEntryIndex( sal_uInt16 nNamespace,
+ const ::rtl::OUString& rStrName,
+ sal_uInt32 nPropType,
+ sal_Int32 nStartAt = -1 ) const;
+
+ /** Retrieves a PropertyHandler for that property wich placed at nIndex in the XMLPropertyMapEntry-array */
+ const XMLPropertyHandler* GetPropertyHandler( sal_Int32 nIndex ) const
+ {
+ DBG_ASSERT( (nIndex >= 0) && (nIndex < (sal_Int32)aMapEntries.size() ), "illegal access to invalid entry!" );
+ return aMapEntries[nIndex].pHdl;
+ }
+
+ /** import/export
+ This methods calls the respective im/export-method of the respective PropertyHandler. */
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue,
+ const XMLPropertyState& rProperty,
+ const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue,
+ XMLPropertyState& rProperty,
+ const SvXMLUnitConverter& rUnitConverter ) const;
+
+ /** searches for an entry that matches the given api name, namespace and local name or -1 if nothing found */
+ sal_Int32 FindEntryIndex( const sal_Char* sApiName,
+ sal_uInt16 nNameSpace,
+ const ::rtl::OUString& sXMLName ) const;
+
+ /** searches for an entry that matches the given ContextId or gives -1 if nothing found */
+ sal_Int32 FindEntryIndex( const sal_Int16 nContextId ) const;
+
+ /** Remove an entry */
+ void RemoveEntry( sal_Int32 nIndex );
+};
+
+#endif // _XMLOFF_PROPERTYSETMAPPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/xmlreg.hxx b/xmloff/inc/xmloff/xmlreg.hxx
new file mode 100644
index 000000000000..3e9974d7a01c
--- /dev/null
+++ b/xmloff/inc/xmloff/xmlreg.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLREG_HXX
+#define _XMLOFF_XMLREG_HXX
+
+#include <rtl/ref.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+/**
+ * Register subset of UNO services from XML Office library. This is necessary when
+ * linking against the static "xol.lib".
+ *
+ * @return returns sal_False if at least one component could not be registered.
+ */
+sal_Bool XMLRegisterServices( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > ); /// [all] ServiceProvider to register in.
+
+#endif // _XMLOFF_XMLREG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/xmlscripti.hxx b/xmloff/inc/xmloff/xmlscripti.hxx
new file mode 100644
index 000000000000..74ae34073544
--- /dev/null
+++ b/xmloff/inc/xmloff/xmlscripti.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLSCRIPTI_HXX
+#define _XMLOFF_XMLSCRIPTI_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include <xmloff/xmlictxt.hxx>
+
+namespace com { namespace sun { namespace star { namespace frame {
+ class XModel;
+}}}}
+
+class XMLOFF_DLLPUBLIC XMLScriptContext : public SvXMLImportContext
+{
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xModel;
+
+public:
+ XMLScriptContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel>& rDocModel );
+ virtual ~XMLScriptContext();
+
+ // Create child element.
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+ virtual void EndElement();
+};
+
+#endif // _XMLOFF_XMLSCRIPTI_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/xmlstyle.hxx b/xmloff/inc/xmloff/xmlstyle.hxx
new file mode 100644
index 000000000000..2c42b7cddb57
--- /dev/null
+++ b/xmloff/inc/xmloff/xmlstyle.hxx
@@ -0,0 +1,271 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLSTYLE_HXX
+#define _XMLOFF_XMLSTYLE_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include "sal/types.h"
+#include <rsc/rscsfx.hxx>
+#include <tools/rtti.hxx>
+#include <xmloff/uniref.hxx>
+#include <xmloff/xmltkmap.hxx>
+#include <xmloff/xmlictxt.hxx>
+
+class SvXMLStylesContext_Impl;
+class SvXMLUnitConverter;
+class SvXMLImportPropertyMapper;
+
+namespace com { namespace sun { namespace star {
+namespace container { class XNameContainer; }
+namespace style { class XAutoStyleFamily; }
+} } }
+
+enum XMLStyleStylesElemTokens
+{
+ XML_TOK_STYLE_STYLE,
+ XML_TOK_STYLE_PAGE_MASTER,
+ XML_TOK_TEXT_LIST_STYLE,
+ XML_TOK_TEXT_OUTLINE,
+ XML_TOK_STYLES_GRADIENTSTYLES,
+ XML_TOK_STYLES_HATCHSTYLES,
+ XML_TOK_STYLES_BITMAPSTYLES,
+ XML_TOK_STYLES_TRANSGRADIENTSTYLES,
+ XML_TOK_STYLES_MARKERSTYLES,
+ XML_TOK_STYLES_DASHSTYLES,
+ XML_TOK_TEXT_NOTE_CONFIG,
+ XML_TOK_TEXT_BIBLIOGRAPHY_CONFIG,
+ XML_TOK_TEXT_LINENUMBERING_CONFIG,
+ XML_TOK_STYLE_DEFAULT_STYLE,
+ XML_TOK_STYLE_DEFAULT_PAGE_LAYOUT, //text grid enhancement
+ XML_TOK_STYLE_STYLES_ELEM_END=XML_TOK_UNKNOWN
+};
+
+class XMLOFF_DLLPUBLIC SvXMLStyleContext : public SvXMLImportContext
+{
+ ::rtl::OUString maName;
+ ::rtl::OUString maDisplayName;
+ ::rtl::OUString maAutoName;
+ ::rtl::OUString maParentName;// Will be moved to XMLPropStyle soon!!!!
+ ::rtl::OUString maFollow; // Will be moved to XMLPropStyle soon!!!!
+
+ ::rtl::OUString maHelpFile; // Will be removed very soon!!!!
+
+ sal_uInt32 mnHelpId; // Will be removed very soon!!!!
+ sal_uInt16 mnFamily;
+
+ sal_Bool mbValid : 1; // Set this to false in CreateAndInsert
+ // if the style shouldn't be processed
+ // by Finish() or si somehow invalid.
+ sal_Bool mbNew : 1; // Set this to false in CreateAnsInsert
+ // if the style is already existing.
+ sal_Bool mbDefaultStyle : 1;
+
+protected:
+
+ virtual void SetAttribute( sal_uInt16 nPrefixKey,
+ const ::rtl::OUString& rLocalName,
+ const ::rtl::OUString& rValue );
+
+ void SetFamily( sal_uInt16 nSet ) { mnFamily = nSet; }
+ void SetAutoName( const ::rtl::OUString& rName ) { maAutoName = rName; }
+
+public:
+
+ TYPEINFO();
+
+ SvXMLStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList >& xAttrList,
+ sal_uInt16 nFamily=0, sal_Bool bDefaultStyle = sal_False );
+
+ virtual ~SvXMLStyleContext();
+
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+ const ::rtl::OUString& GetName() const { return maName; }
+ const ::rtl::OUString& GetDisplayName() const { return maDisplayName.getLength() ? maDisplayName : maName; }
+ const ::rtl::OUString& GetAutoName() const { return maAutoName; }
+ const ::rtl::OUString& GetParentName() const { return maParentName; }
+ const ::rtl::OUString& GetFollow() const { return maFollow; }
+
+ const ::rtl::OUString& GetHelpFile() const { return maHelpFile; }
+ sal_uInt32 GetHelpId() const { return mnHelpId; }
+
+ sal_uInt16 GetFamily() const { return mnFamily; }
+
+ sal_Bool IsValid() const { return mbValid; }
+ void SetValid( sal_Bool b ) { mbValid = b; }
+
+ sal_Bool IsNew() const { return mbNew; }
+ void SetNew( sal_Bool b ) { mbNew = b; }
+
+ // This method is called for every default style
+ virtual void SetDefaults();
+
+ // This method is called for every style. It must create it and insert
+ // it into the document.
+ virtual void CreateAndInsert( sal_Bool bOverwrite );
+
+ // This method is called for every style. It must create it and insert
+ // it into the document if this hasn't happened already in CreateAndInsert().
+ virtual void CreateAndInsertLate( sal_Bool bOverwrite );
+
+ // This method is called fpr every style after all styles have been
+ // inserted into the document.
+ virtual void Finish( sal_Bool bOverwrite );
+
+ sal_Bool IsDefaultStyle() const { return mbDefaultStyle; }
+
+ /** if this method returns true, its parent styles context
+ should not add it to its container.<br>
+ Transient styles can't be accessed from its
+ parent SvXMLStylesContext after theyre imported and
+ the methods CreateAndInsert(), CreateAndInsertLate()
+ and Finish() will not be called.
+ The default return value is false
+ */
+ virtual sal_Bool IsTransient() const;
+};
+
+class XMLOFF_DLLPUBLIC SvXMLStylesContext : public SvXMLImportContext
+{
+ const ::rtl::OUString msParaStyleServiceName;
+ const ::rtl::OUString msTextStyleServiceName;
+
+ SvXMLStylesContext_Impl *mpImpl;
+ SvXMLTokenMap *mpStyleStylesElemTokenMap;
+
+
+ ::com::sun::star::uno::Reference <
+ ::com::sun::star::container::XNameContainer > mxParaStyles;
+
+ ::com::sun::star::uno::Reference <
+ ::com::sun::star::container::XNameContainer > mxTextStyles;
+
+ ::com::sun::star::uno::Reference <
+ ::com::sun::star::style::XAutoStyleFamily > mxParaAutoStyles;
+
+ ::com::sun::star::uno::Reference <
+ ::com::sun::star::style::XAutoStyleFamily > mxTextAutoStyles;
+
+ UniReference < SvXMLImportPropertyMapper > mxParaImpPropMapper;
+ UniReference < SvXMLImportPropertyMapper > mxTextImpPropMapper;
+ UniReference < SvXMLImportPropertyMapper > mxShapeImpPropMapper;
+ mutable UniReference < SvXMLImportPropertyMapper > mxChartImpPropMapper;
+ mutable UniReference < SvXMLImportPropertyMapper > mxPageImpPropMapper;
+
+ SAL_DLLPRIVATE const SvXMLTokenMap& GetStyleStylesElemTokenMap();
+
+ SAL_DLLPRIVATE SvXMLStylesContext(SvXMLStylesContext &); // not defined
+ SAL_DLLPRIVATE void operator =(SvXMLStylesContext &); // not defined
+
+protected:
+
+ sal_uInt32 GetStyleCount() const;
+ SvXMLStyleContext *GetStyle( sal_uInt32 i );
+ const SvXMLStyleContext *GetStyle( sal_uInt32 i ) const;
+
+ virtual SvXMLStyleContext *CreateStyleChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+ virtual SvXMLStyleContext *CreateStyleStyleChildContext( sal_uInt16 nFamily,
+ sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+ virtual SvXMLStyleContext *CreateDefaultStyleStyleChildContext(
+ sal_uInt16 nFamily, sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+ virtual sal_Bool InsertStyleFamily( sal_uInt16 nFamily ) const;
+
+public:
+ TYPEINFO();
+
+ SvXMLStylesContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
+ sal_Bool bAutomatic = sal_False );
+
+ virtual ~SvXMLStylesContext();
+
+ // Create child element.
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+ // This method must be overloaded to insert styles into the document.
+ virtual void EndElement();
+
+ // This allows to add an SvXMLStyleContext to this context from extern
+ void AddStyle(SvXMLStyleContext& rNew);
+
+ const SvXMLStyleContext *FindStyleChildContext(
+ sal_uInt16 nFamily,
+ const ::rtl::OUString& rName,
+ sal_Bool bCreateIndex=sal_False ) const;
+ virtual sal_uInt16 GetFamily( const ::rtl::OUString& rFamily ) const;
+ virtual UniReference < SvXMLImportPropertyMapper > GetImportPropertyMapper(
+ sal_uInt16 nFamily ) const;
+
+ virtual ::com::sun::star::uno::Reference <
+ ::com::sun::star::container::XNameContainer >
+ GetStylesContainer( sal_uInt16 nFamily ) const;
+ virtual ::rtl::OUString GetServiceName( sal_uInt16 nFamily ) const;
+
+ virtual ::com::sun::star::uno::Reference < ::com::sun::star::style::XAutoStyleFamily >
+ GetAutoStyles( sal_uInt16 nFamily ) const;
+ void CopyAutoStylesToDoc();
+ void CopyStylesToDoc( sal_Bool bOverwrite, sal_Bool bFinish=sal_True );
+ void FinishStyles( sal_Bool bOverwrite );
+
+ // This method must be called to release the references to all styles
+ // that are stored in the context.
+ void Clear();
+ sal_Bool IsAutomaticStyle() const;
+};
+
+#endif // _XMLOFF_XMLSTYLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/xmltabe.hxx b/xmloff/inc/xmloff/xmltabe.hxx
new file mode 100644
index 000000000000..a53166554fb1
--- /dev/null
+++ b/xmloff/inc/xmloff/xmltabe.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLTABE_HXX
+#define _XMLOFF_XMLTABE_HXX
+
+// prevent funny things like "#define sun 1" from the compiler
+#include <sal/config.h>
+
+class SvXMLExport;
+namespace com { namespace sun { namespace star {
+ namespace style { struct TabStop; }
+ namespace uno { class Any; }
+} } }
+
+
+class SvxXMLTabStopExport
+{
+ SvXMLExport& rExport; // for access to document handler
+
+protected:
+
+ void exportTabStop( const ::com::sun::star::style::TabStop* pTabStop );
+
+public:
+
+ SvxXMLTabStopExport( SvXMLExport& rExport );
+ virtual ~SvxXMLTabStopExport();
+
+ // core API
+ void Export( const ::com::sun::star::uno::Any& rAny );
+};
+
+
+#endif // _XMLOFF_XMLTABE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/xmltkmap.hxx b/xmloff/inc/xmloff/xmltkmap.hxx
new file mode 100644
index 000000000000..711d9eb310d5
--- /dev/null
+++ b/xmloff/inc/xmloff/xmltkmap.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLTKMAP_HXX
+#define _XMLOFF_XMLTKMAP_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include <sal/types.h>
+#include <xmloff/xmltoken.hxx>
+
+namespace rtl { class OUString; }
+
+class SvXMLTokenMap_Impl;
+class SvXMLTokenMapEntry_Impl;
+
+#define XML_TOK_UNKNOWN 0xffffU
+#define XML_TOKEN_MAP_END { 0xffffU, ::xmloff::token::XML_TOKEN_INVALID, 0U }
+
+struct SvXMLTokenMapEntry
+{
+ sal_uInt16 nPrefixKey;
+ enum ::xmloff::token::XMLTokenEnum eLocalName;
+ sal_uInt16 nToken;
+};
+
+class XMLOFF_DLLPUBLIC SvXMLTokenMap
+{
+ SvXMLTokenMap_Impl *pImpl;
+
+ SAL_DLLPRIVATE SvXMLTokenMapEntry_Impl *_Find(
+ sal_uInt16 nKind, const ::rtl::OUString& rName ) const;
+
+public:
+
+ SvXMLTokenMap( const SvXMLTokenMapEntry* pMap );
+ ~SvXMLTokenMap();
+
+ sal_uInt16 Get( sal_uInt16 nPrefix, const ::rtl::OUString& rLName ) const;
+};
+
+#endif // _XMLOFF_XMLTKMAP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx
new file mode 100644
index 000000000000..e47aa498ebe3
--- /dev/null
+++ b/xmloff/inc/xmloff/xmltoken.hxx
@@ -0,0 +1,3165 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLTOKEN_HXX
+#define _XMLOFF_XMLTOKEN_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include <sal/types.h>
+
+namespace rtl { class OUString; }
+
+
+/**
+ * Handling of tokens in XML:
+ *
+ * This header defines te enum ::xmloff::token::XMLTokenEnum containing one
+ * value for every fixed string used in our XML files.
+ *
+ * Usage:
+ * To obtain an OUString for a token, use the GetXMLToken() function.
+ * To test equality of an OUString and a token, use IsXMLToken().
+ * Additionally, XMLTokenEnum values may be passed to SvXMLExport::AddAttribute
+ * methods and the SvXMLElementExport constructor.
+ */
+
+namespace xmloff { namespace token {
+
+
+ /**
+ * The enumeration of all XML tokens.
+ */
+ enum XMLTokenEnum
+ {
+ XML_TOKEN_START = 0,
+ XML_TOKEN_INVALID = XML_TOKEN_START,
+
+ // common xml
+ XML_CDATA,
+ XML_WS,
+ XML_XML,
+ XML_XMLNS,
+ XML_XML_PI,
+ XML_XML_DOCTYPE_PREFIX,
+ XML_XML_DOCTYPE_SUFFIX,
+
+ // namespace prefixes and names
+ XML_N_XML,
+ XML_NP_OFFICE,
+ XML_N_OFFICE,
+ XML_N_OFFICE_OLD,
+ XML_NP_META,
+ XML_N_META,
+ XML_N_META_OLD,
+ XML_NP_STYLE,
+ XML_N_STYLE,
+ XML_N_STYLE_OLD,
+ XML_NP_NUMBER,
+ XML_N_NUMBER,
+ XML_N_NUMBER_OLD,
+ XML_NP_TEXT,
+ XML_N_TEXT,
+ XML_N_TEXT_OLD,
+ XML_NP_TABLE,
+ XML_N_TABLE,
+ XML_N_TABLE_OLD,
+ XML_NP_DRAW,
+ XML_N_DRAW,
+ XML_NP_DR3D,
+ XML_N_DR3D,
+ XML_N_DRAW_OLD,
+ XML_NP_PRESENTATION,
+ XML_N_PRESENTATION,
+ XML_N_PRESENTATION_OLD,
+ XML_NP_CHART,
+ XML_N_CHART,
+ XML_NP_CONFIG,
+ XML_N_CONFIG,
+ XML_N_CHART_OLD,
+ XML_NP_FO,
+ XML_N_FO_OLD,
+ XML_N_FO,
+ XML_NP_XLINK,
+ XML_N_XLINK,
+ XML_N_XLINK_OLD,
+ XML_NP_DC,
+ XML_N_DC,
+ XML_NP_SVG,
+ XML_N_SVG,
+ XML_NP_FORM,
+ XML_N_FORM,
+ XML_NP_SCRIPT,
+ XML_N_SCRIPT,
+ XML_NP_XFORMS_1_0,
+ XML_N_XFORMS_1_0,
+ XML_NP_XSD,
+ XML_N_XSD,
+ XML_NP_XSI,
+ XML_N_XSI,
+
+ XML_NP_BLOCK_LIST,
+ XML_N_BLOCK_LIST,
+
+ XML_NP_MATH,
+ XML_N_MATH,
+
+ XML_NP_VERSIONS_LIST,
+ XML_N_VERSIONS_LIST,
+
+ // erAck: 2008-04-09T20:02+0200 OpenFormula aka ODFF
+ XML_NP_OF,
+ XML_N_OF,
+
+ // ODF 1.2 metadata: RDFa and GRDDL
+ XML_NP_XHTML,
+ XML_N_XHTML,
+ XML_NP_GRDDL,
+ XML_N_GRDDL,
+
+ // ODF Enhanced namespaces
+ XML_NP_OFFICE_EXT,
+ XML_N_OFFICE_EXT,
+
+ // jonp: 2008-09-24 Excel Interop
+ XML_NP_FORMX,
+ XML_N_FORMX,
+
+ XML_NP_TABLE_EXT,
+ XML_N_TABLE_EXT,
+
+ XML_NP_DRAW_EXT,
+ XML_N_DRAW_EXT,
+
+ // css text level 3
+ XML_NP_CSS3TEXT,
+ XML_N_CSS3TEXT,
+
+ // units
+ XML_UNIT_MM,
+ XML_UNIT_M,
+ XML_UNIT_KM,
+ XML_UNIT_CM,
+ XML_UNIT_PT,
+ XML_UNIT_PC,
+ XML_UNIT_FOOT,
+ XML_UNIT_MILES,
+ XML_UNIT_INCH,
+
+ // any other
+ XML_1,
+ XML_10,
+ XML_2,
+ XML_3,
+ XML_4,
+ XML_5,
+ XML_6,
+ XML_7,
+ XML_8,
+ XML_9,
+ XML_A_UPCASE,
+ XML_I_UPCASE,
+ XML_IBM437,
+ XML_IBM850,
+ XML_IBM860,
+ XML_IBM861,
+ XML_IBM863,
+ XML_IBM865,
+ XML_ISO_8859_1,
+ XML_OLE2,
+ XML__COLON,
+ XML__EMPTY,
+ XML__UNKNOWN_,
+
+ XML_A,
+ XML_ABBREVIATED_NAME,
+ XML_ABOVE,
+ XML_ABS,
+ XML_ACCENT,
+ XML_ACCENTUNDER,
+ XML_ACCEPTANCE_STATE,
+ XML_ACCEPTED,
+ XML_ACTION,
+ XML_ACTIVE,
+ XML_ACTIVE_SPLIT_RANGE,
+ XML_ACTIVE_TABLE,
+ XML_ACTUATE,
+ XML_ADD_IN,
+ XML_ADD_IN_NAME,
+ XML_ADDRESS,
+ XML_ADJUSTMENT,
+ XML_ALGORITHM,
+ XML_ALIGN,
+ XML_ALL,
+ XML_ALLOW_EMPTY_CELL,
+ XML_ALPHABETICAL_INDEX,
+ XML_ALPHABETICAL_INDEX_AUTO_MARK_FILE,
+ XML_ALPHABETICAL_INDEX_ENTRY_TEMPLATE,
+ XML_ALPHABETICAL_INDEX_MARK,
+ XML_ALPHABETICAL_INDEX_MARK_END,
+ XML_ALPHABETICAL_INDEX_MARK_START,
+ XML_ALPHABETICAL_INDEX_SOURCE,
+ XML_ALPHABETICAL_SEPARATORS,
+ XML_ALTERNATE,
+ XML_AM_PM,
+ XML_AMBIENT_COLOR,
+ XML_ANCHOR_PAGE_NUMBER,
+ XML_ANCHOR_TYPE,
+ XML_AND,
+ XML_ANIMATION,
+ XML_ANIMATION_DELAY,
+ XML_ANIMATION_DIRECTION,
+ XML_ANIMATION_REPEAT,
+ XML_ANIMATION_START_INSIDE,
+ XML_ANIMATION_STEPS,
+ XML_ANIMATION_STOP_INSIDE,
+ XML_ANIMATIONS,
+ XML_ANNOTATION,
+ XML_ANNOTATIONS,
+ XML_ANNOTE,
+ XML_APPEAR,
+ XML_APPLET,
+ XML_APPLET_NAME,
+ XML_APPLICATION_DATA,
+ XML_APPLICATION_XML,
+ XML_APPLY,
+ XML_APPLY_STYLE_NAME,
+ XML_AQUA,
+ XML_ARC,
+ XML_ARCCOS,
+ XML_ARCHIVE,
+ XML_ARCSIN,
+ XML_ARCTAN,
+ XML_AREA,
+ XML_AREA_CIRCLE,
+ XML_AREA_POLYGON,
+ XML_AREA_RECTANGLE,
+ XML_ARTICLE,
+ XML_AS_CHAR,
+ XML_ASCENDING,
+ XML_ATTACHED_AXIS,
+ XML_ATTRACTIVE,
+ XML_AUTHOR,
+ XML_AUTHOR_INITIALS,
+ XML_AUTHOR_NAME,
+ XML_AUTO,
+ XML_AUTO_GROW_HEIGHT,
+ XML_AUTO_GROW_WIDTH,
+ XML_AUTO_RELOAD,
+ XML_AUTO_TEXT,
+ XML_AUTO_TEXT_EVENTS,
+ XML_AUTO_TEXT_GROUP,
+ XML_AUTO_TEXT_INDENT,
+ XML_AUTO_UPDATE,
+ XML_AUTOMATIC,
+ XML_AUTOMATIC_FIND_LABELS,
+ XML_AUTOMATIC_ORDER,
+ XML_AUTOMATIC_STYLES,
+ XML_AUTOMATIC_UPDATE,
+ XML_AUTOSIZE,
+ XML_AVERAGE,
+ XML_AXIS,
+ XML_BACK_SCALE,
+ XML_BACKFACE_CULLING,
+ XML_BACKGROUND,
+ XML_BACKGROUND_COLOR,
+ XML_BACKGROUND_IMAGE,
+ XML_BACKGROUND_NO_REPEAT,
+ XML_BACKGROUND_REPEAT,
+ XML_BACKGROUND_STRETCH,
+ XML_BAR,
+ XML_BASE64BINARY,
+ XML_BASE_CELL_ADDRESS,
+ XML_BASELINE,
+ XML_BEFORE_DATE_TIME,
+ XML_BELOW,
+ XML_BETWEEN_DATE_TIMES,
+ XML_BEVEL,
+ XML_BIBILIOGRAPHIC_TYPE,
+ XML_BIBLIOGRAPHY,
+ XML_BIBLIOGRAPHY_CONFIGURATION,
+ XML_BIBLIOGRAPHY_DATA_FIELD,
+ XML_BIBLIOGRAPHY_ENTRY_TEMPLATE,
+ XML_BIBLIOGRAPHY_MARK,
+ XML_BIBLIOGRAPHY_SOURCE,
+ XML_BIBLIOGRAPHY_TYPE,
+ XML_BIND_STYLES_TO_CONTENT,
+ XML_BITMAP,
+ XML_BLACK,
+ XML_BLEND,
+ XML_BLINKING,
+ XML_BLOCK,
+ XML_BLOCK_LIST,
+ XML_BLUE,
+ XML_BODY,
+ XML_BOLD,
+ XML_BOOK,
+ XML_BOOKLET,
+ XML_BOOKMARK,
+ XML_BOOKMARK_END,
+ XML_BOOKMARK_REF,
+ XML_BOOKMARK_START,
+ XML_BOOKTITLE,
+ XML_BOOLEAN,
+ XML_BOOLEAN_STYLE,
+ XML_BOOLEAN_VALUE,
+ XML_BORDER,
+ XML_BORDER_BOTTOM,
+ XML_BORDER_COLOR,
+ XML_BORDER_LEFT,
+ XML_BORDER_LINE_WIDTH,
+ XML_BORDER_LINE_WIDTH_BOTTOM,
+ XML_BORDER_LINE_WIDTH_LEFT,
+ XML_BORDER_LINE_WIDTH_RIGHT,
+ XML_BORDER_LINE_WIDTH_TOP,
+ XML_BORDER_RIGHT,
+ XML_BORDER_TOP,
+ XML_BOTH,
+ XML_BOTTOM,
+ XML_BOTTOM_LEFT,
+ XML_BOTTOM_PERCENT,
+ XML_BOTTOM_RIGHT,
+ XML_BOTTOM_VALUES,
+ XML_BOTTOMARC,
+ XML_BOTTOMCIRCLE,
+ XML_BREAK_AFTER,
+ XML_BREAK_BEFORE,
+ XML_BREAK_INSIDE,
+ XML_BUBBLE,
+ XML_BULLET_CHAR,
+ XML_BULLET_RELATIVE_SIZE,
+ XML_BUTTON1,
+ XML_BUTTON2,
+ XML_BUTTON3,
+ XML_BUTTON4,
+ XML_BUTTONS,
+ XML_BVAR,
+ XML_C,
+ XML_CALCULATION_SETTINGS,
+ XML_CALENDAR,
+ XML_CAPITALIZE_ENTRIES,
+ XML_CAPTION,
+ XML_CAPTION_POINT_X,
+ XML_CAPTION_POINT_Y,
+ XML_CAPTION_SEQUENCE_FORMAT,
+ XML_CAPTION_SEQUENCE_NAME,
+ XML_CASE_SENSITIVE,
+ XML_CASEMAP_CAPITALIZE,
+ XML_CASEMAP_LOWERCASE,
+ XML_CASEMAP_NORMAL,
+ XML_CASEMAP_SMALL_CAPS,
+ XML_CASEMAP_UPPERCASE,
+ XML_CATEGORIES,
+ XML_CATEGORY,
+ XML_CATEGORY_AND_VALUE,
+ XML_CELL_ADDRESS,
+ XML_CELL_CONTENT_CHANGE,
+ XML_CELL_CONTENT_DELETION,
+ XML_CELL_COUNT,
+ XML_CELL_PROTECT,
+ XML_CELL_RANGE_ADDRESS,
+ XML_CELL_RANGE_ADDRESS_LIST,
+ XML_CELL_RANGE_SOURCE,
+ XML_CENTER,
+ XML_CHAIN_NEXT_NAME,
+ XML_CHANGE,
+ XML_CHANGE_DELETION,
+ XML_CHANGE_END,
+ XML_CHANGE_ID,
+ XML_CHANGE_INFO,
+ XML_CHANGE_START,
+ XML_CHANGE_TRACK_TABLE_CELL,
+ XML_CHANGE_VIEW_CONDITIONS,
+ XML_CHANGE_VIEW_SETTINGS,
+ XML_CHANGED_REGION,
+ XML_CHAPTER,
+ XML_CHAR,
+ XML_CHARACTER_COUNT,
+ XML_CHART,
+ XML_CHARTS,
+ XML_CHECKERBOARD,
+ XML_CHG_AUTHOR,
+ XML_CHG_COMMENT,
+ XML_CHG_DATE_TIME,
+ XML_CI,
+ XML_CIRCLE,
+ XML_CITATION_BODY_STYLE_NAME,
+ XML_CITATION_STYLE_NAME,
+ XML_CLASS,
+ XML_CLASS_ID,
+ XML_CLIP,
+ XML_CLOCKWISE,
+ XML_CLOSE,
+ XML_CLOSE_HORIZONTAL,
+ XML_CLOSE_VERTICAL,
+ XML_CM,
+ XML_CN,
+ XML_CODE,
+ XML_CODEBASE,
+ XML_COLLAPSE,
+ XML_COLOR,
+ XML_COLOR_INVERSION,
+ XML_COLOR_MODE,
+ XML_COLUMN,
+ XML_COLUMN_COUNT,
+ XML_COLUMN_GAP,
+ XML_COLUMN_NAME,
+ XML_COLUMN_SEP,
+ XML_COLUMN_WIDTH,
+ XML_COLUMNS,
+ XML_COLUMNSPLIT_AUTO,
+ XML_COLUMNSPLIT_AVOID,
+ XML_COMBINE_ENTRIES,
+ XML_COMBINE_ENTRIES_WITH_DASH,
+ XML_COMBINE_ENTRIES_WITH_PP,
+ XML_COMMA_SEPARATED,
+ XML_COMMAND,
+ XML_COMMENT,
+ XML_COMPOSE,
+ XML_COND_STYLE_NAME,
+ XML_CONDITION,
+ XML_CONDITION_SOURCE,
+ XML_CONDITION_SOURCE_RANGE_ADDRESS,
+ XML_CONDITIONAL_TEXT,
+ XML_CONE,
+ XML_CONFERENCE,
+ XML_CONFIG_ITEM,
+ XML_CONFIG_ITEM_MAP_ENTRY,
+ XML_CONFIG_ITEM_MAP_INDEXED,
+ XML_CONFIG_ITEM_MAP_NAMED,
+ XML_CONFIG_ITEM_SET,
+ XML_CONFIGURATION_SETTINGS,
+ XML_CONJUGATE,
+ XML_CONNECT_BARS,
+ XML_CONNECTION_NAME,
+ XML_CONNECTOR,
+ XML_CONSECUTIVE_NUMBERING,
+ XML_CONSOLIDATION,
+ XML_CONSTANT,
+ XML_CONTAINS_ERROR,
+ XML_CONTAINS_HEADER,
+ XML_CONTENT,
+ XML_CONTENT_VALIDATION,
+ XML_CONTENT_VALIDATION_NAME,
+ XML_CONTENT_VALIDATIONS,
+ XML_CONTINUE,
+ XML_CONTINUE_NUMBERING,
+ XML_CONTOUR_PATH,
+ XML_CONTOUR_POLYGON,
+ XML_CONTRAST,
+ XML_CONTROL,
+ XML_CONVERSION_MODE,
+ XML_COPY_BACK,
+ XML_COPY_FORMULAS,
+ XML_COPY_OUTLINE_LEVELS,
+ XML_COPY_RESULTS_ONLY,
+ XML_COPY_STYLES,
+ XML_CORNER_RADIUS,
+ XML_CORRECT,
+ XML_COS,
+ XML_COSH,
+ XML_COT,
+ XML_COTH,
+ XML_COUNT,
+ XML_COUNT_EMPTY_LINES,
+ XML_COUNT_IN_FLOATING_FRAMES,
+ XML_COUNTER_CLOCKWISE,
+ XML_COUNTERCLOCKWISE,
+ XML_COUNTNUMS,
+ XML_COUNTRY,
+ XML_COUNTRY_ASIAN,
+ XML_COUNTRY_COMPLEX,
+ XML_COVERED_TABLE_CELL,
+ XML_CREATE_DATE,
+ XML_CREATE_DATE_STRING,
+ XML_CREATION_DATE,
+ XML_CREATION_TIME,
+ XML_CREATOR,
+ XML_CSC,
+ XML_CSCH,
+ XML_CUBE,
+ XML_CUBOID,
+ XML_CURRENCY,
+ XML_CURRENCY_STYLE,
+ XML_CURRENCY_SYMBOL,
+ XML_CURRENT,
+ XML_CURRENT_VALUE,
+ XML_CURSOR_POSITION,
+ XML_CURSOR_POSITION_X,
+ XML_CURSOR_POSITION_Y,
+ XML_CURVE,
+ XML_CUSTOM1,
+ XML_CUSTOM2,
+ XML_CUSTOM3,
+ XML_CUSTOM4,
+ XML_CUSTOM5,
+ XML_CUT,
+ XML_CUT_OFFS,
+ XML_CX,
+ XML_CY,
+ XML_CYLINDER,
+ XML_D,
+ XML_DASH,
+ XML_DASHED,
+ XML_DATA,
+ XML_DATA_CELL_RANGE_ADDRESS,
+ XML_DATA_LABEL_NUMBER,
+ XML_DATA_LABEL_SYMBOL,
+ XML_DATA_LABEL_TEXT,
+ XML_DATA_PILOT_FIELD,
+ XML_DATA_PILOT_GRAND_TOTAL,
+ XML_DATA_PILOT_LEVEL,
+ XML_DATA_PILOT_MEMBER,
+ XML_DATA_PILOT_MEMBERS,
+ XML_DATA_PILOT_SUBTOTAL,
+ XML_DATA_PILOT_SUBTOTALS,
+ XML_DATA_PILOT_TABLE,
+ XML_DATA_PILOT_TABLES,
+ XML_DATA_POINT,
+ XML_DATA_STYLE,
+ XML_DATA_STYLE_NAME,
+ XML_DATA_TYPE,
+ XML_DATABASE_DISPLAY,
+ XML_DATABASE_NAME,
+ XML_DATABASE_NEXT,
+ XML_DATABASE_RANGE,
+ XML_DATABASE_RANGES,
+ XML_DATABASE_ROW_NUMBER,
+ XML_DATABASE_SELECT,
+ XML_DATABASE_SOURCE_QUERY,
+ XML_DATABASE_SOURCE_SQL,
+ XML_DATABASE_SOURCE_TABLE,
+ XML_DATE,
+ XML_DATE_ADJUST,
+ XML_DATE_STYLE,
+ XML_DATE_TIME,
+ XML_DATE_VALUE,
+ XML_DATETIME,
+ XML_DAY,
+ XML_DAY_OF_WEEK,
+ XML_DDE_APPLICATION,
+ XML_DDE_CONNECTION,
+ XML_DDE_CONNECTION_DECL,
+ XML_DDE_CONNECTION_DECLS,
+ XML_DDE_ITEM,
+ XML_DDE_LINK,
+ XML_DDE_LINKS,
+ XML_DDE_SOURCE,
+ XML_DDE_TOPIC,
+ XML_DECIMAL_PLACES,
+ XML_DECIMAL_REPLACEMENT,
+ XML_DECLARE,
+ XML_DECORATE_WORDS_ONLY,
+ XML_DECORATIVE,
+ XML_DEEP,
+ XML_DEFAULT,
+ XML_DEFAULT_CELL_STYLE_NAME,
+ XML_DEFAULT_STYLE,
+ XML_DEFAULT_STYLE_NAME,
+ XML_DEGREE,
+ XML_DELAY,
+ XML_DELETION,
+ XML_DELETIONS,
+ XML_DEPENDENCE,
+ XML_DEPENDENCES,
+ XML_DEPENDENCIES,
+ XML_DEPTH,
+ XML_DESC,
+ XML_DESCENDING,
+ XML_DESCRIPTION,
+ XML_DETECTIVE,
+ XML_DETERMINANT,
+ XML_DIFF,
+ XML_DIFFUSE_COLOR,
+ XML_DIM,
+ XML_DIRECTION,
+ XML_DISABLED,
+ XML_DISC,
+ XML_DISPLAY,
+ XML_DISPLAY_BORDER,
+ XML_DISPLAY_DETAILS,
+ XML_DISPLAY_DUPLICATES,
+ XML_DISPLAY_EMPTY,
+ XML_DISPLAY_FILTER_BUTTONS,
+ XML_DISPLAY_FORMULA,
+ XML_DISPLAY_LABEL,
+ XML_DISPLAY_LEVELS,
+ XML_DISPLAY_NAME,
+ XML_DISPLAY_OUTLINE_LEVEL,
+ XML_DISSOLVE,
+ XML_DISTANCE,
+ XML_DISTANCE_AFTER_SEP,
+ XML_DISTANCE_BEFORE_SEP,
+ XML_DISTRIBUTE,
+ XML_DISTRIBUTE_LETTER,
+ XML_DISTRIBUTE_SPACE,
+ XML_DIVIDE,
+ XML_DOCUMENT,
+ XML_DOCUMENT_CONTENT,
+ XML_DOCUMENT_META,
+ XML_DOCUMENT_SETTINGS,
+ XML_DOCUMENT_STATISTIC,
+ XML_DOCUMENT_STYLES,
+ XML_DOMAIN,
+ XML_DOT,
+ XML_DOTS1,
+ XML_DOTS1_LENGTH,
+ XML_DOTS2,
+ XML_DOTS2_LENGTH,
+ XML_DOTTED,
+ XML_DOUBLE,
+ XML_DOUBLE_SIDED,
+ XML_DOWN,
+ XML_DRAFT,
+ XML_DRAW,
+ XML_DRAW_ASPECT,
+ XML_DRAWING,
+ XML_DRAWINGS,
+ XML_DRAWPOOL,
+ XML_DROP_CAP,
+ XML_DYNAMIC,
+ XML_EDGE_ROUNDING,
+ XML_EDITABLE,
+ XML_EDITING_CYCLES,
+ XML_EDITING_DURATION,
+ XML_EDITION,
+ XML_EDITOR,
+ XML_EFFECT,
+ XML_ELLIPSE,
+ XML_EMAIL,
+ XML_EMBED,
+ XML_EMBEDDED_VISIBLE_AREA,
+ XML_EMBOSSED,
+ XML_EMISSIVE_COLOR,
+ XML_EMPTY,
+ XML_ENABLE_NUMBERING,
+ XML_ENABLED,
+ XML_ENCODING,
+ XML_END,
+ XML_END_ANGLE,
+ XML_END_CELL_ADDRESS,
+ XML_END_COLOR,
+ XML_END_COLUMN,
+ XML_END_GLUE_POINT,
+ XML_END_GUIDE,
+ XML_END_INTENSITY,
+ XML_END_LINE_SPACING_HORIZONTAL,
+ XML_END_LINE_SPACING_VERTICAL,
+ XML_END_POSITION,
+ XML_END_ROW,
+ XML_END_SHAPE,
+ XML_END_TABLE,
+ XML_END_X,
+ XML_END_Y,
+ XML_ENDLESS,
+ XML_ENDNOTE,
+ XML_ENDNOTE_BODY,
+ XML_ENDNOTE_CITATION,
+ XML_ENDNOTE_REF,
+ XML_ENDNOTES_CONFIGURATION,
+ XML_ENGRAVED,
+ XML_EQ,
+ XML_EQUAL_AUTHOR,
+ XML_EQUAL_COMMENT,
+ XML_EQUAL_DATE,
+ XML_ERA,
+ XML_ERGO_SUM,
+ XML_ERROR_CATEGORY,
+ XML_ERROR_LOWER_INDICATOR,
+ XML_ERROR_LOWER_LIMIT,
+ XML_ERROR_MACRO,
+ XML_ERROR_MARGIN,
+ XML_ERROR_MESSAGE,
+ XML_ERROR_PERCENTAGE,
+ XML_ERROR_UPPER_INDICATOR,
+ XML_ERROR_UPPER_LIMIT,
+ XML_ESCAPEMENT_SUB,
+ XML_ESCAPEMENT_SUPER,
+ XML_EVEN_PAGE,
+ XML_EVENT,
+ XML_EVENT_NAME,
+ XML_EVENTS,
+ XML_EXECUTE,
+ XML_EXECUTE_MACRO,
+ XML_EXISTS,
+ XML_EXP,
+ XML_EXPONENTIAL,
+ XML_EXPRESSION,
+ XML_EXTRA,
+ XML_EXTRUDE,
+ XML_FACTORIAL,
+ XML_FADE,
+ XML_FADE_FROM_BOTTOM,
+ XML_FADE_FROM_CENTER,
+ XML_FADE_FROM_LEFT,
+ XML_FADE_FROM_LOWERLEFT,
+ XML_FADE_FROM_LOWERRIGHT,
+ XML_FADE_FROM_RIGHT,
+ XML_FADE_FROM_TOP,
+ XML_FADE_FROM_UPPERLEFT,
+ XML_FADE_FROM_UPPERRIGHT,
+ XML_FADE_OUT,
+ XML_FADE_TO_CENTER,
+ XML_FALSE,
+ XML_FAMILY,
+ XML_FAST,
+ XML_FIELD_NUMBER,
+ XML_FILE_NAME,
+ XML_FILL,
+ XML_FILL_COLOR,
+ XML_FILL_GRADIENT_NAME,
+ XML_FILL_HATCH_NAME,
+ XML_FILL_HATCH_SOLID,
+ XML_FILL_IMAGE,
+ XML_FILL_IMAGE_HEIGHT,
+ XML_FILL_IMAGE_NAME,
+ XML_FILL_IMAGE_REF_POINT,
+ XML_FILL_IMAGE_REF_POINT_X,
+ XML_FILL_IMAGE_REF_POINT_Y,
+ XML_FILL_IMAGE_WIDTH,
+ XML_FILTER,
+ XML_FILTER_AND,
+ XML_FILTER_CONDITION,
+ XML_FILTER_NAME,
+ XML_FILTER_OPTIONS,
+ XML_FILTER_OR,
+ XML_FIRST_DATE_TIME,
+ XML_FIRST_PAGE,
+ XML_FIRST_PAGE_NUMBER,
+ XML_FIT_TO_CONTOUR,
+ XML_FIT_TO_SIZE,
+ XML_FIX,
+ XML_FIXED,
+ XML_FLAT,
+ XML_FLOAT,
+ XML_FLOATING_FRAME,
+ XML_FLOOR,
+ XML_FN,
+ XML_FOCAL_LENGTH,
+ XML_FONT_CHAR_WIDTH,
+ XML_FONT_CHARSET,
+ XML_FONT_CHARSET_ASIAN,
+ XML_FONT_CHARSET_COMPLEX,
+ XML_FONT_COLOR,
+ XML_FONT_DECL,
+ XML_FONT_DECLS,
+ XML_FONT_FAMILY,
+ XML_FONT_FAMILY_ASIAN,
+ XML_FONT_FAMILY_COMPLEX,
+ XML_FONT_FAMILY_GENERIC,
+ XML_FONT_FAMILY_GENERIC_ASIAN,
+ XML_FONT_FAMILY_GENERIC_COMPLEX,
+ XML_FONT_KERNING,
+ XML_FONT_NAME,
+ XML_FONT_NAME_ASIAN,
+ XML_FONT_NAME_COMPLEX,
+ XML_FONT_PITCH,
+ XML_FONT_PITCH_ASIAN,
+ XML_FONT_PITCH_COMPLEX,
+ XML_FONT_RELIEF,
+ XML_FONT_SIZE,
+ XML_FONT_SIZE_ASIAN,
+ XML_FONT_SIZE_COMPLEX,
+ XML_FONT_SIZE_REL,
+ XML_FONT_SIZE_REL_ASIAN,
+ XML_FONT_SIZE_REL_COMPLEX,
+ XML_FONT_STYLE,
+ XML_FONT_STYLE_ASIAN,
+ XML_FONT_STYLE_COMPLEX,
+ XML_FONT_STYLE_NAME,
+ XML_FONT_STYLE_NAME_ASIAN,
+ XML_FONT_STYLE_NAME_COMPLEX,
+ XML_FONT_VARIANT,
+ XML_FONT_WEIGHT,
+ XML_FONT_WEIGHT_ASIAN,
+ XML_FONT_WEIGHT_COMPLEX,
+ XML_FONT_WIDTH,
+ XML_FONT_WORD_LINE_MODE,
+ XML_FONTFAMILY,
+ XML_FONTSIZE,
+ XML_FONTSTYLE,
+ XML_FONTWEIGHT,
+ XML_FONTWORK_ADJUST,
+ XML_FONTWORK_DISTANCE,
+ XML_FONTWORK_FORM,
+ XML_FONTWORK_HIDE_FORM,
+ XML_FONTWORK_MIRROR,
+ XML_FONTWORK_OUTLINE,
+ XML_FONTWORK_SHADOW,
+ XML_FONTWORK_SHADOW_COLOR,
+ XML_FONTWORK_SHADOW_OFFSET_X,
+ XML_FONTWORK_SHADOW_OFFSET_Y,
+ XML_FONTWORK_SHADOW_TRANSPARENCE,
+ XML_FONTWORK_START,
+ XML_FONTWORK_STYLE,
+ XML_FOOTER,
+ XML_FOOTER_LEFT,
+ XML_FOOTER_STYLE,
+ XML_FOOTNOTE,
+ XML_FOOTNOTE_BODY,
+ XML_FOOTNOTE_CITATION,
+ XML_FOOTNOTE_CONTINUATION_NOTICE_BACKWARD,
+ XML_FOOTNOTE_CONTINUATION_NOTICE_FORWARD,
+ XML_FOOTNOTE_MAX_HEIGHT,
+ XML_FOOTNOTE_REF,
+ XML_FOOTNOTE_SEP,
+ XML_FOOTNOTES_CONFIGURATION,
+ XML_FOOTNOTES_POSITION,
+ XML_FORALL,
+ XML_FORCE_MANUAL,
+ XML_FOREGROUND,
+ XML_FOREIGN_OBJECT,
+ XML_FORMAT_CHANGE,
+ XML_FORMAT_SOURCE,
+ XML_FORMS,
+ XML_FORMULA,
+ XML_FORMULA_HIDDEN,
+ XML_FORMULAS,
+ XML_FRACTION,
+ XML_FRAME,
+ XML_FRAME_CONTENT,
+ XML_FRAME_DISPLAY_BORDER,
+ XML_FRAME_DISPLAY_SCROLLBAR,
+ XML_FRAME_END_MARGIN,
+ XML_FRAME_MARGIN_HORIZONTAL,
+ XML_FRAME_MARGIN_VERTICAL,
+ XML_FRAME_NAME,
+ XML_FRAME_START_MARGIN,
+ XML_FREEZE,
+ XML_FREEZE_POSITION,
+ XML_FROM_ANOTHER_TABLE,
+ XML_FROM_BOTTOM,
+ XML_FROM_CENTER,
+ XML_FROM_INSIDE,
+ XML_FROM_LEFT,
+ XML_FROM_LOWER_LEFT,
+ XML_FROM_LOWER_RIGHT,
+ XML_FROM_RIGHT,
+ XML_FROM_SAME_TABLE,
+ XML_FROM_TOP,
+ XML_FROM_UPPER_LEFT,
+ XML_FROM_UPPER_RIGHT,
+ XML_FUCHSIA,
+ XML_FULL,
+ XML_FULL_SCREEN,
+ XML_FUNCTION,
+ XML_G,
+ XML_GAMMA,
+ XML_GAP,
+ XML_GAP_WIDTH,
+ XML_GCD,
+ XML_GENERATOR,
+ XML_GEQ,
+ XML_GOURAUD,
+ XML_GRADIENT,
+ XML_GRADIENT_ANGLE,
+ XML_GRADIENT_BORDER,
+ XML_GRADIENT_STEP_COUNT,
+ XML_GRADIENT_STYLE,
+ XML_GRADIENTSTYLE_AXIAL,
+ XML_GRADIENTSTYLE_ELLIPSOID,
+ XML_GRADIENTSTYLE_LINEAR,
+ XML_GRADIENTSTYLE_RADIAL,
+ XML_GRADIENTSTYLE_RECTANGULAR,
+ XML_GRADIENTSTYLE_SQUARE,
+ XML_GRAND_TOTAL,
+ XML_GRAPHIC,
+ XML_GRAY,
+ XML_GREEN,
+ XML_GREYSCALE,
+ XML_GRID,
+ XML_GROOVE,
+ XML_GROUP_BY_FIELD_NUMBER,
+ XML_GROUP_NAME,
+ XML_GROUPING,
+ XML_GT,
+ XML_GUIDE_DISTANCE,
+ XML_GUIDE_OVERHANG,
+ XML_H,
+ XML_HANGING,
+ XML_HAS_PERSISTENT_DATA,
+ XML_HATCH,
+ XML_HATCH_DISTANCE,
+ XML_HATCH_STYLE,
+ XML_HATCHSTYLE_DOUBLE,
+ XML_HATCHSTYLE_SINGLE,
+ XML_HATCHSTYLE_TRIPLE,
+ XML_HEADER,
+ XML_HEADER_LEFT,
+ XML_HEADER_STYLE,
+ XML_HEADERS,
+ XML_HEIGHT,
+ XML_HELP,
+ XML_HELP_FILE_NAME,
+ XML_HELP_ID,
+ XML_HELP_MESSAGE,
+ XML_HIDDEN,
+ XML_HIDDEN_AND_PROTECTED,
+ XML_HIDDEN_PARAGRAPH,
+ XML_HIDDEN_TEXT,
+ XML_HIDE,
+ XML_HIDE_SHAPE,
+ XML_HIDE_TEXT,
+ XML_HIGHLIGHTED_RANGE,
+ XML_HINT,
+ XML_HORIZONTAL,
+ XML_HORIZONTAL_LINES,
+ // XML_HORIZONTAL_ON_LEFT_PAGES and XML_HORIZONTAL_ON_RIGHT_PAGES
+ // are replaced by XML_HORIZONTAL_ON_EVEN and XML_HORIZONTAL_ON_ODD.
+ // Usage is deprecated, but the old token are needed for the
+ // OpenOffice.org file format import/export filter for the renaming (#i49139#)
+ XML_HORIZONTAL_ON_LEFT_PAGES,
+ XML_HORIZONTAL_ON_RIGHT_PAGES,
+ XML_HORIZONTAL_POS,
+ XML_HORIZONTAL_REL,
+ XML_HORIZONTAL_SCROLLBAR_WIDTH,
+ XML_HORIZONTAL_SEGMENTS,
+ XML_HORIZONTAL_SPLIT_MODE,
+ XML_HORIZONTAL_SPLIT_POSITION,
+ XML_HORIZONTAL_STRIPES,
+ XML_HOURS,
+ XML_HOWPUBLISHED,
+ XML_HREF,
+ XML_HTML,
+ XML_HYPERLINK_BEHAVIOUR,
+ XML_HYPHENATE,
+ XML_HYPHENATION_KEEP,
+ XML_HYPHENATION_LADDER_COUNT,
+ XML_HYPHENATION_PUSH_CHAR_COUNT,
+ XML_HYPHENATION_REMAIN_CHAR_COUNT,
+ XML_I,
+ XML_ICON,
+ XML_ID,
+ XML_IDENT,
+ XML_IDENTIFIER,
+ XML_IDENTIFY_CATEGORIES,
+ XML_IDEOGRAPH_ALPHA,
+ XML_IGNORE_CASE,
+ XML_IGNORE_EMPTY_ROWS,
+ XML_ILLUSTRATION_INDEX,
+ XML_ILLUSTRATION_INDEX_ENTRY_TEMPLATE,
+ XML_ILLUSTRATION_INDEX_SOURCE,
+ XML_IMAGE,
+ XML_IMAGE_COUNT,
+ XML_IMAGE_MAP,
+ XML_IMPLIES,
+ XML_IN,
+ XML_IN_RANGE,
+ XML_INBOOK,
+ XML_INCOLLECTION,
+ XML_INCREMENT,
+ XML_INDEX,
+ XML_INDEX_BODY,
+ XML_INDEX_ENTRY_BIBLIOGRAPHY,
+ XML_INDEX_ENTRY_CHAPTER,
+ XML_INDEX_ENTRY_CHAPTER_NUMBER,
+ XML_INDEX_ENTRY_LINK_END,
+ XML_INDEX_ENTRY_LINK_START,
+ XML_INDEX_ENTRY_PAGE_NUMBER,
+ XML_INDEX_ENTRY_SPAN,
+ XML_INDEX_ENTRY_TAB_STOP,
+ XML_INDEX_ENTRY_TEMPLATE,
+ XML_INDEX_ENTRY_TEXT,
+ XML_INDEX_NAME,
+ XML_INDEX_SCOPE,
+ XML_INDEX_SOURCE_STYLE,
+ XML_INDEX_SOURCE_STYLES,
+ XML_INDEX_TITLE,
+ XML_INDEX_TITLE_TEMPLATE,
+ XML_INFORMATION,
+ XML_INITIAL_CREATOR,
+ XML_INPROCEEDINGS,
+ XML_INSERTION,
+ XML_INSERTION_CUT_OFF,
+ XML_INSET,
+ XML_INSIDE,
+ XML_INSTITUTION,
+ XML_INT,
+ XML_INTENSITY,
+ XML_INTERSECT,
+ XML_INTERVAL,
+ XML_INTERVAL_MAJOR,
+ XML_INTERVAL_MINOR,
+ XML_INTO_ENGLISH_NUMBER,
+ XML_INVERSE,
+ XML_IS_ACTIVE,
+ XML_IS_DATA_LAYOUT_FIELD,
+ XML_IS_HIDDEN,
+ XML_IS_SELECTION,
+ XML_ISBN,
+ XML_ITALIC,
+ XML_ITERATION,
+ XML_JOURNAL,
+ XML_JUSTIFIED,
+ XML_JUSTIFY,
+ XML_JUSTIFY_SINGLE_WORD,
+ XML_KEEP_WITH_NEXT,
+ XML_KERNING_NORMAL,
+ XML_KEY,
+ XML_KEY1,
+ XML_KEY2,
+ XML_KEYWORD,
+ XML_KEYWORDS,
+ XML_KIND,
+ XML_KM,
+ XML_LABEL,
+ XML_LABEL_ARRANGEMENT,
+ XML_LABEL_CELL_ADDRESS,
+ XML_LABEL_CELL_RANGE_ADDRESS,
+ XML_LABEL_RANGE,
+ XML_LABEL_RANGES,
+ XML_LAMBDA,
+ XML_LANDSCAPE,
+ XML_LANGUAGE,
+ XML_LANGUAGE_ASIAN,
+ XML_LANGUAGE_COMPLEX,
+ XML_LASER,
+ XML_LAST_COLUMN_SPANNED,
+ XML_LAST_PAGE,
+ XML_LAST_ROW_SPANNED,
+ XML_LAYER,
+ XML_LAYER_SET,
+ XML_LEADER_CHAR,
+ XML_LEFT,
+ XML_LEFT_OUTSIDE,
+ XML_LEFT_TOP_POSITION,
+ XML_LEFTARC,
+ XML_LEFTCIRCLE,
+ XML_LEGEND,
+ XML_LEGEND_POSITION,
+ XML_LENGTH,
+ XML_LEQ,
+ XML_LET_TEXT,
+ XML_KEEP_TEXT,
+ XML_LETTER_KERNING,
+ XML_LETTER_SPACING,
+ XML_LETTERS,
+ XML_LEVEL,
+ XML_LIBRARY,
+ XML_LIBRARY_EMBEDDED,
+ XML_LIBRARY_LINKED,
+ XML_LIGHT,
+ XML_LIGHTING_MODE,
+ XML_LIME,
+ XML_LIMIT,
+ XML_LINE,
+ XML_LINE_BREAK,
+ XML_LINE_DISTANCE,
+ XML_LINE_HEIGHT,
+ XML_LINE_HEIGHT_AT_LEAST,
+ XML_LINE_NUMBER,
+ XML_LINE_SKEW,
+ XML_LINE_SPACING,
+ XML_LINE_STYLE,
+ XML_LINEAR,
+ XML_LINENUMBERING_CONFIGURATION,
+ XML_LINENUMBERING_SEPARATOR,
+ XML_LINES,
+ XML_LINES_USED,
+ XML_LINK_TO_SOURCE_DATA,
+ XML_LIST,
+ XML_LIST_BLOCK,
+ XML_LIST_HEADER,
+ XML_LIST_INFO,
+ XML_LIST_ITEM,
+ XML_LIST_LEVEL,
+ XML_LIST_LEVEL_STYLE_BULLET,
+ XML_LIST_LEVEL_STYLE_IMAGE,
+ XML_LIST_LEVEL_STYLE_NUMBER,
+ XML_LIST_NAME,
+ XML_LIST_STYLE,
+ XML_LIST_STYLE_NAME,
+ XML_LN,
+ XML_LOCKED,
+ XML_LOG,
+ XML_LOGARITHMIC,
+ XML_LOGBASE,
+ XML_LONG,
+ XML_LOWLIMIT,
+ XML_LR_TB,
+ XML_LT,
+ XML_LTR,
+ XML_LUMINANCE,
+ XML_MACRO_NAME,
+ XML_MACTION,
+ XML_MAIN_ENTRY_STYLE_NAME,
+ XML_MAJOR,
+ XML_MALIGNGROUP,
+ XML_MALIGNMARK,
+ XML_MANUAL,
+ XML_MAP,
+ XML_MARGIN_BOTTOM,
+ XML_MARGIN_LEFT,
+ XML_MARGIN_RIGHT,
+ XML_MARGIN_TOP,
+ XML_MARGINS,
+ XML_MARKER,
+ XML_MARKER_END,
+ XML_MARKER_END_CENTER,
+ XML_MARKER_END_WIDTH,
+ XML_MARKER_START,
+ XML_MARKER_START_CENTER,
+ XML_MARKER_START_WIDTH,
+ XML_MAROON,
+ XML_MASTER_PAGE,
+ XML_MASTER_PAGE_NAME,
+ XML_MASTER_STYLES,
+ XML_MASTERSTHESIS,
+ XML_MATCH,
+ XML_MATH,
+ XML_MATRIX,
+ XML_MATRIX_COVERED,
+ XML_MATRIXROW,
+ XML_MAX,
+ XML_MAX_EDGE,
+ XML_MAX_HEIGHT,
+ XML_MAX_WIDTH,
+ XML_MAXIMUM,
+ XML_MAXIMUM_DIFFERENCE,
+ XML_MAY_BREAK_BETWEEN_ROWS,
+ XML_MAY_SCRIPT,
+ XML_MEAN,
+ XML_MEAN_VALUE,
+ XML_MEASURE,
+ XML_MEASURE_ALIGN,
+ XML_MEASURE_VERTICAL_ALIGN,
+ XML_MEDIAN,
+ XML_MEDIUM,
+ XML_MERROR,
+ XML_MESSAGE_TYPE,
+ XML_META,
+ XML_MFENCED,
+ XML_MFRAC,
+ XML_MI,
+ XML_MIDDLE,
+ XML_MIME_TYPE,
+ XML_MIN,
+ XML_MIN_DENOMINATOR_DIGITS,
+ XML_MIN_EDGE,
+ XML_MIN_EXPONENT_DIGITS,
+ XML_MIN_HEIGHT,
+ XML_MIN_INTEGER_DIGITS,
+ XML_MIN_LABEL_DISTANCE,
+ XML_MIN_LABEL_WIDTH,
+ XML_MIN_LINE_HEIGHT,
+ XML_MIN_NUMERATOR_DIGITS,
+ XML_MIN_ROW_HEIGHT,
+ XML_MIN_WIDTH,
+ XML_MINIMUM,
+ XML_MINOR,
+ XML_MINUS,
+ XML_MINUTES,
+ XML_MIRROR,
+ XML_MIRRORED,
+ XML_MISC,
+ XML_MITER,
+ XML_MM,
+ XML_MMULTISCRIPTS,
+ XML_MN,
+ XML_MO,
+ XML_MODE,
+ XML_MODERN,
+ XML_MODIFICATION_DATE,
+ XML_MODIFICATION_TIME,
+ XML_MODULATE,
+ XML_MODULE,
+ XML_MOMENT,
+ XML_MONO,
+ XML_MONTH,
+ XML_MOUSE_AS_PEN,
+ XML_MOUSE_VISIBLE,
+ XML_MOVE,
+ XML_MOVE_FROM_BOTTOM,
+ XML_MOVE_FROM_LEFT,
+ XML_MOVE_FROM_RIGHT,
+ XML_MOVE_FROM_TOP,
+ XML_MOVE_PROTECT,
+ XML_MOVE_SHORT,
+ XML_MOVEMENT,
+ XML_MOVEMENT_CUT_OFF,
+ XML_MOVER,
+ XML_MPADDED,
+ XML_MPHANTOM,
+ XML_MPRESCRIPTS,
+ XML_MROOT,
+ XML_MROW,
+ XML_MS,
+ XML_MSPACE,
+ XML_MSQRT,
+ XML_MSTYLE,
+ XML_MSUB,
+ XML_MSUBSUP,
+ XML_MSUP,
+ XML_MTABLE,
+ XML_MTD,
+ XML_MTEXT,
+ XML_MTR,
+ XML_MULTI_DELETION_SPANNED,
+ XML_MUNDER,
+ XML_MUNDEROVER,
+ XML_NAME,
+ XML_NAME_AND_EXTENSION,
+ XML_NAMED_EXPRESSION,
+ XML_NAMED_EXPRESSIONS,
+ XML_NAMED_RANGE,
+ XML_NAVY,
+ XML_NEQ,
+ XML_NEW,
+ XML_NEXT,
+ XML_NEXT_PAGE,
+ XML_NEXT_STYLE_NAME,
+ XML_NO_LIMIT,
+ XML_NO_WRAP,
+ XML_NOEMPTY,
+ XML_NOHREF,
+ XML_NOMATCH,
+ XML_NONE,
+ XML_NOPRTSUBSET,
+ XML_NORMAL,
+ XML_NORMALS_DIRECTION,
+ XML_NORMALS_KIND,
+ XML_NOT,
+ XML_NOT_EQUAL_DATE,
+ XML_NOTE,
+ XML_NOTES,
+ XML_NOTIN,
+ XML_NOTSUBSET,
+ XML_NULL_DATE,
+ XML_NULL_YEAR,
+ XML_NUM_FORMAT,
+ XML_NUM_LETTER_SYNC,
+ XML_NUM_PREFIX,
+ XML_NUM_SUFFIX,
+ XML_NUMBER,
+ XML_NUMBER_AND_NAME,
+ XML_NUMBER_COLUMNS_REPEATED,
+ XML_NUMBER_COLUMNS_SPANNED,
+ XML_NUMBER_LINES,
+ XML_NUMBER_MATRIX_COLUMNS_SPANNED,
+ XML_NUMBER_MATRIX_ROWS_SPANNED,
+ XML_NUMBER_POSITION,
+ XML_NUMBER_ROWS_REPEATED,
+ XML_NUMBER_ROWS_SPANNED,
+ XML_NUMBER_STYLE,
+ XML_NUMBER_WRAPPED_PARAGRAPHS,
+ XML_NUMBERED_ENTRIES,
+ XML_OBJECT,
+ XML_OBJECT_COUNT,
+ XML_OBJECT_INDEX,
+ XML_OBJECT_INDEX_ENTRY_TEMPLATE,
+ XML_OBJECT_INDEX_SOURCE,
+ XML_OBJECT_NAME,
+ XML_OBJECT_OLE,
+ XML_OBJECTS,
+ XML_ODD_PAGE,
+ XML_OFFSET,
+ XML_OLIVE,
+ XML_ONLOAD,
+ XML_ONREQUEST,
+ XML_ON_UPDATE_KEEP_SIZE,
+ XML_ON_UPDATE_KEEP_STYLES,
+ XML_ONLINE,
+ XML_ONLINE_TEXT,
+ XML_OPAQUE_BACKGROUND,
+ XML_OPAQUE_FOREGROUND,
+ XML_OPEN,
+ XML_OPEN_HORIZONTAL,
+ XML_OPEN_VERTICAL,
+ XML_OPERATION,
+ XML_OPERATOR,
+ XML_OPTIMAL,
+ XML_OR,
+ XML_ORDER,
+ XML_ORDERED_LIST,
+ XML_ORGANIZATIONS,
+ XML_ORIENTATION,
+ XML_ORIENTATION_LANDSCAPE,
+ XML_ORIENTATION_PORTRAIT,
+ XML_ORIGIN,
+ XML_ORPHANS,
+ XML_OUTLINE_LEVEL,
+ XML_OUTLINE_LEVEL_STYLE,
+ XML_OUTLINE_STYLE,
+ XML_OUTSET,
+ XML_OUTSIDE,
+ XML_OVERLAP,
+ XML_P,
+ XML_PACKAGE_NAME,
+ XML_PADDING,
+ XML_PADDING_BOTTOM,
+ XML_PADDING_LEFT,
+ XML_PADDING_RIGHT,
+ XML_PADDING_TOP,
+ XML_PAGE,
+ XML_PAGE_ADJUST,
+ XML_PAGE_BREAKS_ON_GROUP_CHANGE,
+ XML_PAGE_CONTENT,
+ XML_PAGE_CONTINUATION_STRING,
+ XML_PAGE_COUNT,
+ XML_PAGE_END_MARGIN,
+ XML_PAGE_HEIGHT,
+ XML_PAGE_MASTER,
+ XML_PAGE_MASTER_NAME,
+ XML_PAGE_NUMBER,
+ XML_PAGE_START_MARGIN,
+ XML_PAGE_STYLE_NAME,
+ XML_PAGE_THUMBNAIL,
+ XML_PAGE_USAGE,
+ XML_PAGE_VARIABLE_GET,
+ XML_PAGE_VARIABLE_SET,
+ XML_PAGE_VIEW_ZOOM_VALUE,
+ XML_PAGE_WIDTH,
+ XML_PAGES,
+ XML_PAPER_TRAY_NUMBER,
+ XML_PARAGRAPH,
+ XML_PARAGRAPH_CONTENT,
+ XML_PARAGRAPH_COUNT,
+ XML_PARAGRAPH_END_MARGIN,
+ XML_PARAGRAPH_START_MARGIN,
+ XML_PARALLEL,
+ XML_PARAM,
+ XML_PARENT_STYLE_NAME,
+ XML_PARSE_SQL_STATEMENT,
+ XML_PARSED,
+ XML_PARTIALDIFF,
+ XML_PASSWORD,
+ XML_PASSWORT,
+ XML_PATH,
+ XML_PATH_ID,
+ XML_PAUSE,
+ XML_PENDING,
+ XML_PERCENTAGE,
+ XML_PERCENTAGE_STYLE,
+ XML_PERSPECTIVE,
+ XML_PHDTHESIS,
+ XML_PHONG,
+ XML_PIE_OFFSET,
+ XML_PLACEHOLDER,
+ XML_PLACEHOLDER_TYPE,
+ XML_PLACING,
+ XML_PLAIN_NUMBER,
+ XML_PLAIN_NUMBER_AND_NAME,
+ XML_PLAY_FULL,
+ XML_PLOT_AREA,
+ XML_PLUGIN,
+ XML_PLUS,
+ XML_POINTS,
+ XML_POLYGON,
+ XML_POLYLINE,
+ XML_POLYNOMIAL,
+ XML_POOL_ID,
+ XML_PORTRAIT,
+ XML_POSITION,
+ XML_POSITION_BOTTOM,
+ XML_POSITION_LEFT,
+ XML_POSITION_RIGHT,
+ XML_POSITION_TOP,
+ XML_POSTURE_ITALIC,
+ XML_POSTURE_NORMAL,
+ XML_POSTURE_OBLIQUE,
+ XML_POWER,
+ XML_PRECISION_AS_SHOWN,
+ XML_PREFIX,
+ XML_PRESENTATION,
+ XML_PRESENTATION_CHART,
+ XML_PRESENTATION_GRAPHIC,
+ XML_PRESENTATION_NOTES,
+ XML_PRESENTATION_OBJECT,
+ XML_PRESENTATION_ORGCHART,
+ XML_PRESENTATION_OUTLINE,
+ XML_PRESENTATION_PAGE,
+ XML_PRESENTATION_PAGE_LAYOUT,
+ XML_PRESENTATION_PAGE_LAYOUT_NAME,
+ XML_PRESENTATION_SUBTITLE,
+ XML_PRESENTATION_TABLE,
+ XML_PRESENTATION_TITLE,
+ XML_PREVIOUS,
+ XML_PREVIOUS_PAGE,
+ XML_PRINT,
+ XML_PRINT_CONTENT,
+ XML_PRINT_DATE,
+ XML_PRINT_ORIENTATION,
+ XML_PRINT_PAGE_ORDER,
+ XML_PRINT_RANGE,
+ XML_PRINT_RANGES,
+ XML_PRINT_TIME,
+ XML_PRINTABLE,
+ XML_PRINTED_BY,
+ XML_PROCEEDINGS,
+ XML_PRODUCT,
+ XML_PROJECTION,
+ XML_PROPERTIES,
+ XML_PROTECT,
+ XML_PROTECT_CONTENT,
+ XML_PROTECT_POSITION,
+ XML_PROTECT_SIZE,
+ XML_PROTECTED,
+ XML_PROTECTION_KEY,
+ XML_PROTECTION_KEY_DIGEST_ALGORITHM,
+ XML_PROTECTION_KEY_DIGEST_ALGORITHM_2,
+ XML_PRSUBSET,
+ XML_PUBLISHER,
+ XML_PUNCTUATION_WRAP,
+ XML_PURPLE,
+ XML_PYRAMID,
+ XML_QUARTER,
+ XML_QUERY_NAME,
+ XML_QUO_VADIS,
+ XML_QUOTIENT,
+ XML_R,
+ XML_RADAR,
+ XML_RANDOM,
+ XML_RANGE_ADDRESS,
+ XML_RANGE_USABLE_AS,
+ XML_RECREATE_ON_EDIT,
+ XML_RECT,
+ XML_RED,
+ XML_REF_NAME,
+ XML_REFERENCE,
+ XML_REFERENCE_END,
+ XML_REFERENCE_FORMAT,
+ XML_REFERENCE_MARK,
+ XML_REFERENCE_MARK_END,
+ XML_REFERENCE_MARK_START,
+ XML_REFERENCE_REF,
+ XML_REFERENCE_START,
+ XML_REFERENCE_TYPE,
+ XML_REFRESH_DELAY,
+ XML_REGION_CENTER,
+ XML_REGION_LEFT,
+ XML_REGION_RIGHT,
+ XML_REGISTER_TRUE,
+ XML_REGISTER_TRUTH_REF_STYLE_NAME,
+ XML_REGRESSION_TYPE,
+ XML_REJECTED,
+ XML_REJECTING_CHANGE_ID,
+ XML_REJECTION,
+ XML_REL_COLUMN_WIDTH,
+ XML_REL_HEIGHT,
+ XML_REL_WIDTH,
+ XML_RELATIVE,
+ XML_RELATIVE_TAB_STOP_POSITION,
+ XML_RELN,
+ XML_REM,
+ XML_REMOVE_DEPENDENTS,
+ XML_REMOVE_PRECEDENTS,
+ XML_REPEAT,
+ XML_REPEAT_COLUMN,
+ XML_REPEAT_ROW,
+ XML_REPEATED,
+ XML_REPLACE,
+ XML_REPORT_TYPE,
+ XML_RESTART_ON_PAGE,
+ XML_REVISION,
+ XML_RIDGE,
+ XML_RIGHT,
+ XML_RIGHT_OUTSIDE,
+ XML_RIGHTARC,
+ XML_RIGHTCIRCLE,
+ XML_RING,
+ XML_ROLE,
+ XML_ROLL_FROM_BOTTOM,
+ XML_ROLL_FROM_LEFT,
+ XML_ROLL_FROM_RIGHT,
+ XML_ROMAN,
+ XML_ROOT,
+ XML_ROTATE,
+ XML_ROTATION,
+ XML_ROTATION_ALIGN,
+ XML_ROTATION_ANGLE,
+ XML_ROUND,
+ XML_ROW,
+ XML_ROW_HEIGHT,
+ XML_ROW_NUMBER,
+ XML_ROWS,
+ XML_RUBY,
+ XML_RUBY_ALIGN,
+ XML_RUBY_BASE,
+ XML_RUBY_POSITION,
+ XML_RUBY_TEXT,
+ XML_RUN_THROUGH,
+ XML_RX,
+ XML_RY,
+ XML_S,
+ XML_SCALE,
+ XML_SCALE_MIN,
+ XML_SCALE_TEXT,
+ XML_SCALE_TO,
+ XML_SCALE_TO_PAGES,
+ XML_SCATTER,
+ XML_SCENARIO,
+ XML_SCENARIO_RANGES,
+ XML_SCENE,
+ XML_SCHOOL,
+ XML_SCIENTIFIC_NUMBER,
+ XML_SCORE_SPACES,
+ XML_SCRIPT,
+ XML_SCROLL,
+ XML_SDEV,
+ XML_SEARCH_CRITERIA_MUST_APPLY_TO_WHOLE_CELL,
+ XML_SEC,
+ XML_SECH,
+ XML_SECOND_DATE_TIME,
+ XML_SECONDS,
+ XML_SECTION,
+ XML_SECTION_DESC,
+ XML_SECTION_NAME,
+ XML_SECTION_SOURCE,
+ XML_SELECT_PAGE,
+ XML_SELECT_PROTECTED_CELLS,
+ XML_SELECT_UNPROTECTED_CELLS,
+ XML_SELECTOR,
+ XML_SEMANTICS,
+ XML_SEMI_AUTOMATIC,
+ XML_SENDER_CITY,
+ XML_SENDER_COMPANY,
+ XML_SENDER_COUNTRY,
+ XML_SENDER_EMAIL,
+ XML_SENDER_FAX,
+ XML_SENDER_FIRSTNAME,
+ XML_SENDER_INITIALS,
+ XML_SENDER_LASTNAME,
+ XML_SENDER_PHONE_PRIVATE,
+ XML_SENDER_PHONE_WORK,
+ XML_SENDER_POSITION,
+ XML_SENDER_POSTAL_CODE,
+ XML_SENDER_STATE_OR_PROVINCE,
+ XML_SENDER_STREET,
+ XML_SENDER_TITLE,
+ XML_SEP,
+ XML_SEPARATION_CHARACTER,
+ XML_SEPARATOR,
+ XML_SEQUENCE,
+ XML_SEQUENCE_DECL,
+ XML_SEQUENCE_DECLS,
+ XML_SEQUENCE_REF,
+ XML_SERIES,
+ XML_SERIES_SOURCE,
+ XML_SERVER_MAP,
+ XML_SET,
+ XML_SETDIFF,
+ XML_SETTINGS,
+ XML_SHADE_MODE,
+ XML_SHADOW,
+ XML_SHADOW_COLOR,
+ XML_SHADOW_OFFSET_X,
+ XML_SHADOW_OFFSET_Y,
+ XML_SHADOW_SLANT,
+ XML_SHADOW_TRANSPARENCY,
+ XML_SHAPE,
+ XML_SHAPE_ID,
+ XML_SHAPES,
+ XML_SHEET_NAME,
+ XML_SHININESS,
+ XML_SHORT,
+ XML_SHOW,
+ XML_SHOW_ACCEPTED_CHANGES,
+ XML_SHOW_CHANGES,
+ XML_SHOW_CHANGES_BY_AUTHOR,
+ XML_SHOW_CHANGES_BY_AUTHOR_NAME,
+ XML_SHOW_CHANGES_BY_COMMENT,
+ XML_SHOW_CHANGES_BY_COMMENT_TEXT,
+ XML_SHOW_CHANGES_BY_DATETIME,
+ XML_SHOW_CHANGES_BY_DATETIME_FIRST_DATETIME,
+ XML_SHOW_CHANGES_BY_DATETIME_MODE,
+ XML_SHOW_CHANGES_BY_DATETIME_SECOND_DATETIME,
+ XML_SHOW_CHANGES_BY_RANGES,
+ XML_SHOW_CHANGES_BY_RANGES_LIST,
+ XML_SHOW_LOGO,
+ XML_SHOW_REJECTED_CHANGES,
+ XML_SHOW_SHAPE,
+ XML_SHOW_TEXT,
+ XML_SHOW_UNIT,
+ XML_SHOWS,
+ XML_SIDE_BY_SIDE,
+ XML_SILVER,
+ XML_SIMPLE,
+ XML_SIN,
+ XML_SINCE_DATE_TIME,
+ XML_SINCE_SAVE,
+ XML_SINH,
+ XML_SIZE,
+ XML_SIZE_PROTECT,
+ XML_SLANT,
+ XML_SLANT_X,
+ XML_SLANT_Y,
+ XML_SLIDE,
+ XML_SLOW,
+ XML_SOLID,
+ XML_SOLID_TYPE,
+ XML_SORT,
+ XML_SORT_ASCENDING,
+ XML_SORT_BY,
+ XML_SORT_BY_POSITION,
+ XML_SORT_GROUPS,
+ XML_SORT_KEY,
+ XML_SOUND,
+ XML_SOURCE_CELL_RANGE,
+ XML_SOURCE_CELL_RANGE_ADDRESSES,
+ XML_SOURCE_FIELD_NAME,
+ XML_SOURCE_NAME,
+ XML_SOURCE_RANGE_ADDRESS,
+ XML_SOURCE_SERVICE,
+ XML_SPACE_BEFORE,
+ XML_SPAN,
+ XML_SPECULAR,
+ XML_SPECULAR_COLOR,
+ XML_SPEED,
+ XML_SPHERE,
+ XML_SPIRAL,
+ XML_SPIRAL_IN,
+ XML_SPIRAL_INWARD_LEFT,
+ XML_SPIRAL_INWARD_RIGHT,
+ XML_SPIRAL_OUT,
+ XML_SPIRAL_OUTWARD_LEFT,
+ XML_SPIRAL_OUTWARD_RIGHT,
+ XML_SPIRALIN_LEFT,
+ XML_SPIRALIN_RIGHT,
+ XML_SPIRALOUT_LEFT,
+ XML_SPIRALOUT_RIGHT,
+ XML_SPLINES,
+ XML_SPLIT,
+ XML_SPLIT_COLUMN,
+ XML_SPLIT_POSITION,
+ XML_SPLIT_ROW,
+ XML_SPREADSHEET,
+ XML_SQL_STATEMENT,
+ XML_STACKED,
+ XML_STAGGER_EVEN,
+ XML_STAGGER_ODD,
+ XML_STANDARD,
+ XML_STANDARD_DEVIATION,
+ XML_STARBASIC,
+ XML_START,
+ XML_START_ANGLE,
+ XML_START_COLOR,
+ XML_START_COLUMN,
+ XML_START_GLUE_POINT,
+ XML_START_GUIDE,
+ XML_START_INTENSITY,
+ XML_START_LINE_SPACING_HORIZONTAL,
+ XML_START_LINE_SPACING_VERTICAL,
+ XML_START_NUMBERING_AT,
+ XML_START_PAGE,
+ XML_START_POSITION,
+ XML_START_ROW,
+ XML_START_SCALE,
+ XML_START_SHAPE,
+ XML_START_TABLE,
+ XML_START_VALUE,
+ XML_START_WITH_NAVIGATOR,
+ XML_STATISTICS,
+ XML_STATUS,
+ XML_STAY_ON_TOP,
+ XML_STDEV,
+ XML_STDEVP,
+ XML_STEPS,
+ XML_STOCK,
+ XML_STOCK_UPDOWN_BARS,
+ XML_STOCK_WITH_VOLUME,
+ XML_STOP,
+ XML_STRETCH,
+ XML_STRETCH_FROM_BOTTOM,
+ XML_STRETCH_FROM_LEFT,
+ XML_STRETCH_FROM_RIGHT,
+ XML_STRETCH_FROM_TOP,
+ XML_STRETCHY,
+ XML_STRICT,
+ XML_STRING,
+ XML_STRING_VALUE,
+ XML_STRING_VALUE_IF_FALSE,
+ XML_STRING_VALUE_IF_TRUE,
+ XML_STRIPES,
+ XML_STROKE,
+ XML_STROKE_COLOR,
+ XML_STROKE_DASH,
+ XML_STROKE_LINEJOIN,
+ XML_STROKE_OPACITY,
+ XML_STROKE_WIDTH,
+ XML_STRUCTURE_PROTECTED,
+ XML_STYLE,
+ XML_STYLE_NAME,
+ XML_STYLES,
+ XML_STYLESHEET,
+ XML_SUB_TABLE,
+ XML_SUBJECT,
+ XML_SUBSET,
+ XML_SUBTITLE,
+ XML_SUBTOTAL_FIELD,
+ XML_SUBTOTAL_RULE,
+ XML_SUBTOTAL_RULES,
+ XML_SUFFIX,
+ XML_SUM,
+ XML_SWISS,
+ XML_SYMBOL,
+ XML_SYMBOL_HEIGHT,
+ XML_SYMBOL_IMAGE_NAME,
+ XML_SYMBOL_WIDTH,
+ XML_SYSTEM,
+ XML_TAB_COLOR,
+ XML_TAB_STOP,
+ XML_TAB_STOP_DISTANCE,
+ XML_TAB_STOPS,
+ XML_TABLE,
+ XML_TABLE_BACKGROUND,
+ XML_TABLE_CELL,
+ XML_TABLE_CENTERING,
+ XML_TABLE_COLUMN,
+ XML_TABLE_COLUMN_GROUP,
+ XML_TABLE_COLUMNS,
+ XML_TABLE_COUNT,
+ XML_TABLE_HEADER,
+ XML_TABLE_HEADER_COLUMNS,
+ XML_TABLE_HEADER_ROWS,
+ XML_TABLE_INDEX,
+ XML_TABLE_INDEX_ENTRY_TEMPLATE,
+ XML_TABLE_INDEX_SOURCE,
+ XML_TABLE_NAME,
+ XML_TABLE_NUMBER_LIST,
+ XML_TABLE_OF_CONTENT,
+ XML_TABLE_OF_CONTENT_ENTRY_TEMPLATE,
+ XML_TABLE_OF_CONTENT_SOURCE,
+ XML_TABLE_PAGE,
+ XML_TABLE_PROTECTION,
+ XML_TABLE_ROW,
+ XML_TABLE_ROW_GROUP,
+ XML_TABLE_ROWS,
+ XML_TABLE_SOURCE,
+ XML_TABLE_VIEW,
+ XML_TABLES,
+ XML_TAN,
+ XML_TANH,
+ XML_TARGET_CELL_ADDRESS,
+ XML_TARGET_FRAME_NAME,
+ XML_TARGET_RANGE_ADDRESS,
+ XML_TB_RL,
+ XML_TEAL,
+ XML_TECHREPORT,
+ XML_TEMPLATE,
+ XML_TEMPLATE_NAME,
+ XML_TENDSTO,
+ XML_TEX_FILTER,
+ XML_TEX_GENERATION_MODE_X,
+ XML_TEX_GENERATION_MODE_Y,
+ XML_TEX_KIND,
+ XML_TEX_MODE,
+ XML_TEXT,
+ XML_TEXT_ALIGN,
+ XML_TEXT_ALIGN_LAST,
+ XML_TEXT_ALIGN_SOURCE,
+ XML_TEXT_AUTOSPACE,
+ XML_TEXT_BACKGROUND_COLOR,
+ XML_TEXT_BLINKING,
+ XML_TEXT_BOX,
+ XML_TEXT_COMBINE,
+ XML_TEXT_COMBINE_END_CHAR,
+ XML_TEXT_COMBINE_START_CHAR,
+ XML_TEXT_CONTENT,
+ XML_TEXT_CROSSING_OUT,
+ XML_TEXT_EMPHASIZE,
+ XML_TEXT_GLOBAL,
+ XML_TEXT_INDENT,
+ XML_TEXT_INPUT,
+ XML_TEXT_JUSTIFY,
+ XML_TEXT_OUTLINE,
+ XML_TEXT_POSITION,
+ XML_TEXT_ROTATION_ANGLE,
+ XML_TEXT_ROTATION_SCALE,
+ XML_TEXT_SCALE,
+ XML_TEXT_SHADOW,
+ XML_TEXT_STYLE,
+ XML_TEXT_TRANSFORM,
+ XML_TEXT_UNDERLINE,
+ XML_TEXT_UNDERLINE_COLOR,
+ XML_TEXTAREA_HORIZONTAL_ALIGN,
+ XML_TEXTAREA_VERTICAL_ALIGN,
+ XML_TEXTUAL,
+ XML_THICK,
+ XML_THIN,
+ XML_THREE_DIMENSIONAL,
+ XML_THUMBNAIL,
+ XML_TICK_MARKS_MAJOR_INNER,
+ XML_TICK_MARKS_MAJOR_OUTER,
+ XML_TICK_MARKS_MINOR_INNER,
+ XML_TICK_MARKS_MINOR_OUTER,
+ XML_TILE_REPEAT_OFFSET,
+ XML_TIME,
+ XML_TIME_ADJUST,
+ XML_TIME_STYLE,
+ XML_TIME_VALUE,
+ XML_TIMES,
+ XML_TITLE,
+ XML_TO_ANOTHER_TABLE,
+ XML_TO_BOTTOM,
+ XML_TO_CENTER,
+ XML_TO_LEFT,
+ XML_TO_LOWER_LEFT,
+ XML_TO_LOWER_RIGHT,
+ XML_TO_RIGHT,
+ XML_TO_TOP,
+ XML_TO_UPPER_LEFT,
+ XML_TO_UPPER_RIGHT,
+ XML_TOC_MARK,
+ XML_TOC_MARK_END,
+ XML_TOC_MARK_START,
+ XML_TOP,
+ XML_TOP_LEFT,
+ XML_TOP_PERCENT,
+ XML_TOP_RIGHT,
+ XML_TOP_VALUES,
+ XML_TOPARC,
+ XML_TOPCIRCLE,
+ XML_TRACE_DEPENDENTS,
+ XML_TRACE_ERRORS,
+ XML_TRACE_PRECEDENTS,
+ XML_TRACK_CHANGES,
+ XML_TRACKED_CHANGES,
+ XML_TRACKED_CHANGES_VIEW_SETTINGS,
+ XML_TRANSFORM,
+ XML_TRANSITION_ON_CLICK,
+ XML_TRANSPARENCY,
+ XML_TRANSPARENCY_NAME,
+ XML_TRANSPARENT,
+ XML_TRANSPOSE,
+ XML_TRUE,
+ XML_TRUNCATE_ON_OVERFLOW,
+ XML_TTB,
+ XML_TYPE,
+ XML_DOT_DASH,
+ XML_DOT_DOT_DASH,
+ XML_LONG_DASH,
+ XML_SINGLE,
+ XML_SMALL_WAVE,
+ XML_WAVE,
+ XML_UNFORMATTED_TEXT,
+ XML_UNION,
+ XML_UNIT,
+ XML_UNORDERED_LIST,
+ XML_UNPUBLISHED,
+ XML_UP,
+ XML_UPLIMIT,
+ XML_UPRIGHT,
+ XML_URL,
+ XML_USE_CAPTION,
+ XML_USE_CELL_PROTECTION,
+ XML_USE_CHART_OBJECTS,
+ XML_USE_CONDITION,
+ XML_USE_DRAW_OBJECTS,
+ XML_USE_FLOATING_FRAMES,
+ XML_USE_GRAPHICS,
+ XML_USE_IMAGE_OBJECTS,
+ XML_USE_INDEX_MARKS,
+ XML_USE_INDEX_SOURCE_STYLES,
+ XML_USE_KEYS_AS_ENTRIES,
+ XML_USE_LABEL,
+ XML_USE_MATH_OBJECTS,
+ XML_USE_OBJECTS,
+ XML_USE_OPTIMAL_COLUMN_WIDTH,
+ XML_USE_OPTIMAL_ROW_HEIGHT,
+ XML_USE_OTHER_OBJECTS,
+ XML_USE_SPREADSHEET_OBJECTS,
+ XML_USE_STYLES,
+ XML_USE_TABLES,
+ XML_USE_WINDOW_FONT_COLOR,
+ XML_USED_HIERARCHY,
+ XML_USER_DEFINED,
+ XML_USER_FIELD_DECL,
+ XML_USER_FIELD_DECLS,
+ XML_USER_FIELD_GET,
+ XML_USER_FIELD_INPUT,
+ XML_USER_INDEX,
+ XML_USER_INDEX_ENTRY_TEMPLATE,
+ XML_USER_INDEX_MARK,
+ XML_USER_INDEX_MARK_END,
+ XML_USER_INDEX_MARK_START,
+ XML_USER_INDEX_SOURCE,
+ XML_USER_TRANSFORMED,
+ XML_USERNAME,
+ XML_VALUE,
+ XML_VALUE_TYPE,
+ XML_VALUES_CELL_RANGE_ADDRESS,
+ XML_VAR,
+ XML_VARIABLE,
+ XML_VARIABLE_DECL,
+ XML_VARIABLE_DECLS,
+ XML_VARIABLE_GET,
+ XML_VARIABLE_INPUT,
+ XML_VARIABLE_SET,
+ XML_VARIANCE,
+ XML_VARP,
+ XML_VECTOR,
+ XML_VERB,
+ XML_VERSION,
+ XML_VERSION_ENTRY,
+ XML_VERSION_LIST,
+ XML_VERTICAL,
+ XML_VERTICAL_ALIGN,
+ XML_VERTICAL_JUSTIFY,
+ XML_VERTICAL_LINES,
+ XML_VERTICAL_POS,
+ XML_VERTICAL_REL,
+ XML_VERTICAL_SEGMENTS,
+ XML_VERTICAL_SPLIT_MODE,
+ XML_VERTICAL_SPLIT_POSITION,
+ XML_VERTICAL_STRIPES,
+ XML_VIEW,
+ XML_VIEWBOX,
+ XML_VIEW_ID,
+ XML_VIEW_SETTINGS,
+ XML_VISIBILITY,
+ XML_VISIBLE,
+ XML_VISIBLE_AREA,
+ XML_VISIBLE_AREA_HEIGHT,
+ XML_VISIBLE_AREA_LEFT,
+ XML_VISIBLE_AREA_TOP,
+ XML_VISIBLE_AREA_WIDTH,
+ XML_VISITED_STYLE_NAME,
+ XML_VOLATILE,
+ XML_VOLUME,
+ XML_VPN,
+ XML_VRP,
+ XML_VUP,
+ XML_WALL,
+ XML_WARNING,
+ XML_WATERMARK,
+ XML_WAVYLINE,
+ XML_WAVYLINE_FROM_BOTTOM,
+ XML_WAVYLINE_FROM_LEFT,
+ XML_WAVYLINE_FROM_RIGHT,
+ XML_WAVYLINE_FROM_TOP,
+ XML_WEEK_OF_YEAR,
+ XML_WEIGHT_BOLD,
+ XML_WEIGHT_NORMAL,
+ XML_WHITE,
+ XML_WHOLE_PAGE,
+ XML_WIDOWS,
+ XML_WIDTH,
+ XML_WORD,
+ XML_WORD_COUNT,
+ XML_WRAP,
+ XML_WRAP_CONTOUR,
+ XML_WRAP_CONTOUR_MODE,
+ XML_WRAP_OPTION,
+ XML_WRITING_MODE,
+ XML_WWW,
+ XML_X,
+ XML_X1,
+ XML_X2,
+ XML_X_MAC_ROMAN,
+ XML_X_SYMBOL,
+ XML_X_SYSTEM,
+ XML_XOR,
+ XML_Y,
+ XML_Y1,
+ XML_Y2,
+ XML_YEAR,
+ XML_YELLOW,
+ XML_ZERO_VALUES,
+ XML_ZINDEX,
+ XML_ZOOM_TYPE,
+ XML_ZOOM_VALUE,
+
+ XML_ENABLE,
+ XML_USE_REGULAR_EXPRESSIONS,
+ XML_DATA_SOURCE_HAS_LABELS,
+ XML_LINK_DATA_STYLE_TO_SOURCE,
+ XML_SORT_ALGORITHM,
+ XML_STRAIGHT_LINE,
+ XML_ANGLED_LINE,
+ XML_ANGLED_CONNECTOR_LINE,
+ XML_APPLICATION_X_WWW_FORM_URLENCODED,
+ XML_MULTIPART_FORMDATA,
+ XML_APPLICATION_TEXT,
+ XML_GET,
+ XML_POST,
+ XML_QUERY,
+ XML_PARENT,
+ XML_RECORDS,
+ XML_PUSH,
+ XML_SUBMIT,
+ XML_RESET,
+ XML_VALUE_LIST,
+ XML_SQL,
+ XML_SQL_PASS_THROUGH,
+ XML_TABLE_FIELDS,
+ XML_UNCHECKED,
+ XML_CHECKED,
+ XML_UNKNOWN,
+
+ XML_ROLL_FROM_TOP,
+
+ XML_BINARY_DATA,
+ XML_NOTIFY_ON_UPDATE_OF_TABLE,
+
+ XML_0,
+ XML_PLAY,
+ XML_HANDOUT_MASTER,
+ XML_TEXT_STYLE_NAME,
+ XML_ESCAPE_DIRECTION,
+ XML_GLUE_POINT,
+ XML_PRIMARY_X,
+ XML_SECONDARY_X,
+ XML_PRIMARY_Y,
+ XML_SECONDARY_Y,
+ XML_PRIMARY_Z,
+
+ XML_CAPTION_TYPE,
+ XML_CAPTION_ANGLE_TYPE,
+ XML_CAPTION_ANGLE,
+ XML_CAPTION_GAP,
+ XML_CAPTION_ESCAPE_DIRECTION,
+ XML_CAPTION_ESCAPE,
+ XML_CAPTION_LINE_LENGTH,
+ XML_CAPTION_FIT_LINE_LENGTH,
+ XML_FREE,
+
+ XML_TRANSITION_TYPE,
+ XML_TRANSITION_STYLE,
+ XML_TRANSITION_SPEED,
+ XML_DURATION,
+ XML_BACKGROUND_SIZE,
+ XML_BACKGROUND_OBJECTS_VISIBLE,
+ XML_BACKGROUND_VISIBLE,
+
+ XML_MOVE_FROM_UPPERLEFT,
+ XML_MOVE_FROM_UPPERRIGHT,
+ XML_MOVE_FROM_LOWERRIGHT,
+ XML_MOVE_FROM_LOWERLEFT,
+ XML_UNCOVER_TO_LEFT,
+ XML_UNCOVER_TO_UPPERLEFT,
+ XML_UNCOVER_TO_TOP,
+ XML_UNCOVER_TO_UPPERRIGHT,
+ XML_UNCOVER_TO_RIGHT,
+ XML_UNCOVER_TO_LOWERRIGHT,
+ XML_UNCOVER_TO_BOTTOM,
+ XML_UNCOVER_TO_LOWERLEFT,
+ XML_VERTICAL_CHECKERBOARD,
+ XML_HORIZONTAL_CHECKERBOARD,
+ XML_NOTIFY_ON_UPDATE_OF_RANGES,
+ XML_BYTE,
+ XML_MACRO,
+ XML_LOCATION,
+ XML_APPLICATION,
+ XML_SYMBOL_IMAGE,
+ XML_TEXT_OVERLAP,
+ XML_SPLINE_ORDER,
+ XML_SPLINE_RESOLUTION,
+
+ XML_PAPER_TRAY_NAME,
+
+ XML_COLUMN_MAPPING,
+ XML_ROW_MAPPING,
+
+ XML_TABLE_FORMULA,
+
+ XML_EMBEDDED_TEXT,
+
+ XML_MERGE_LAST_PARAGRAPH,
+
+ XML_STOCK_LOSS_MARKER,
+ XML_STOCK_GAIN_MARKER,
+ XML_STOCK_RANGE_LINE,
+
+ XML_RL_TB,
+ XML_TB_LR,
+ XML_LR,
+ XML_RL,
+ XML_TB,
+
+ XML_LAYOUT_GRID_COLOR,
+ XML_LAYOUT_GRID_LINES,
+ XML_LAYOUT_GRID_BASE_HEIGHT,
+ XML_LAYOUT_GRID_RUBY_HEIGHT,
+ XML_LAYOUT_GRID_MODE,
+ XML_LAYOUT_GRID_RUBY_BELOW,
+ XML_LAYOUT_GRID_PRINT,
+ XML_LAYOUT_GRID_DISPLAY,
+
+ //text grid enhancement for better CJK support
+ XML_DEFAULT_PAGE_LAYOUT,
+ XML_LAYOUT_GRID_STANDARD_MODE,
+ XML_LAYOUT_GRID_BASE_WIDTH,
+ XML_LAYOUT_GRID_SNAP_TO_CHARS,
+ XML_LAYOUT_GRID_SNAP_TO,
+
+ XML_SNAP_TO_LAYOUT_GRID,
+ XML_DONT_BALANCE_TEXT_COLUMNS,
+
+ XML_GLYPH_ORIENTATION_VERTICAL,
+
+ XML_MARKED_INVALID,
+
+ XML_REGRESSION_CURVE,
+ XML_ERROR_INDICATOR,
+
+ XML_TABLE_TYPE,
+
+ XML_DISPLAY_FACTOR,
+
+ XML_TRANSLITERATION_FORMAT,
+ XML_TRANSLITERATION_LANGUAGE,
+ XML_TRANSLITERATION_COUNTRY,
+ XML_TRANSLITERATION_STYLE,
+
+ XML_KEY1_PHONETIC,
+ XML_KEY2_PHONETIC,
+ XML_STRING_VALUE_PHONETIC,
+
+ XML_BACKGROUND_TRANSPARENCY,
+ XML_BACKGROUND_IMAGE_TRANSPARENCY,
+
+ XML_DYNAMIC_SPACING,
+ XML_MAIN_ENTRY,
+
+ XML_USE_OUTLINE_LEVEL,
+
+ // #107245# New 3D properties which are possible for lathe and extrude 3d objects
+ XML_CLOSE_FRONT,
+ XML_CLOSE_BACK,
+
+ XML_DROPDOWN,
+ XML_CURRENT_SELECTED,
+
+ XML_JOIN_BORDER,
+
+ XML_DISPLAY_LIST,
+ XML_NO,
+ XML_UNSORTED,
+ XML_SORTED_ASCENDING,
+ XML_FONT_INDEPENDENT_LINE_SPACING,
+
+ XML_DATABASE,
+ XML_DATASOURCE,
+ XML_QUERIES,
+ XML_REPORTS,
+ XML_REPORT,
+ XML_AS_TEMPLATE,
+
+ XML_CONNECTION_RESOURCE,
+ XML_SUPPRESS_VERSION_COLUMNS,
+ XML_JAVA_DRIVER_CLASS,
+ XML_EXTENSION,
+ XML_IS_FIRST_ROW_HEADER_LINE,
+ XML_SHOW_DELETED,
+ XML_IS_TABLE_NAME_LENGTH_LIMITED,
+ XML_SYSTEM_DRIVER_SETTINGS,
+ XML_ENABLE_SQL92_CHECK,
+ XML_APPEND_TABLE_ALIAS_NAME,
+ XML_PARAMETER_NAME_SUBSTITUTION,
+ XML_IGNORE_DRIVER_PRIVILEGES,
+ XML_BOOLEAN_COMPARISON_MODE,
+ XML_USE_CATALOG,
+ XML_BASE_DN,
+ XML_MAX_ROW_COUNT,
+ XML_LOGIN,
+ XML_USER_NAME,
+ XML_IS_PASSWORD_REQUIRED,
+ XML_LOGIN_TIMEOUT,
+ XML_DELIMITER,
+ XML_FIELD,
+ XML_DECIMAL,
+ XML_THOUSAND,
+ XML_TABLE_FILTER,
+ XML_TABLE_FILTER_PATTERN,
+ XML_TABLE_TYPE_FILTER,
+ XML_AUTO_INCREMENT,
+ XML_ADDITIONAL_COLUMN_STATEMENT,
+ XML_ROW_RETRIEVING_STATEMENT,
+ XML_DATA_SOURCE_SETTINGS,
+ XML_DATA_SOURCE_SETTING,
+ XML_DATA_SOURCE_SETTING_VALUE,
+ XML_DATA_SOURCE_SETTING_IS_LIST,
+ XML_DATA_SOURCE_SETTING_TYPE,
+ XML_DATA_SOURCE_SETTING_NAME,
+ XML_COMPONENT,
+ XML_COMPONENT_COLLECTION,
+ XML_QUERY_COLLECTION,
+ XML_UPDATE_TABLE,
+ XML_FILTER_STATEMENT,
+ XML_ORDER_STATEMENT,
+ XML_ESCAPE_PROCESSING,
+ XML_KEYS,
+ XML_INDICES,
+ XML_TYPE_NAME,
+ XML_PRECISION,
+ XML_IS_NULLABLE,
+ XML_IS_AUTOINCREMENT,
+ XML_DEFAULT_VALUE,
+ XML_REFERENCED_TABLE_NAME,
+ XML_UPDATE_RULE,
+ XML_DELETE_RULE,
+ XML_KEY_COLUMNS,
+ XML_KEY_COLUMN,
+ XML_RELATED_COLUMN_NAME,
+ XML_CATALOG_NAME,
+ XML_IS_UNIQUE,
+ XML_IS_CLUSTERED,
+ XML_INDEX_COLUMNS,
+ XML_INDEX_COLUMN,
+ XML_IS_ASCENDING,
+ XML_SCHEMA_NAME,
+ XML_NP_DB,
+ XML_N_DB,
+ XML_APPLY_FILTER,
+ XML_APPLY_ORDER,
+ XML_AUTOMATIC_PRINT_RANGE,
+
+ XML_SELECTION,
+ XML_SELECTION_INDEXES,
+
+ XML_SCALE_TO_X,
+ XML_SCALE_TO_Y,
+
+ XML_KEEP_TOGETHER,
+
+ XML_USE_HEADER_NAME,
+ XML_USE_FOOTER_NAME,
+ XML_USE_DATE_TIME_NAME,
+ XML_DISPLAY_HEADER,
+ XML_DISPLAY_FOOTER,
+ XML_DISPLAY_PAGE_NUMBER,
+ XML_DISPLAY_DATE_TIME,
+ XML_SOURCE,
+ XML_CURRENT_DATE,
+
+ XML_HEADER_DECL,
+ XML_FOOTER_DECL,
+ XML_DATE_TIME_DECL,
+
+ XML_SELECTED_PAGE,
+
+ // DVO, OD 01.10.2003 #i18732
+ XML_FLOW_WITH_TEXT,
+
+ XML_WITH_TAB, // #i21237#
+
+ XML_CUSTOM_SHAPE,
+ XML_ENGINE,
+ XML_ENHANCED_GEOMETRY,
+ XML_TEXT_ROTATE_ANGLE,
+ XML_MIRROR_VERTICAL,
+ XML_MIRROR_HORIZONTAL,
+ XML_EXTRUSION_ALLOWED,
+ XML_TEXT_PATH_ALLOWED,
+ XML_CONCENTRIC_GRADIENT_FILL_ALLOWED,
+ XML_EXTRUSION,
+ XML_EXTRUSION_BRIGHTNESS,
+ XML_EXTRUSION_DEPTH,
+ XML_EXTRUSION_DIFFUSION,
+ XML_EXTRUSION_NUMBER_OF_LINE_SEGMENTS,
+ XML_EXTRUSION_LIGHT_FACE,
+ XML_EXTRUSION_FIRST_LIGHT_HARSH,
+ XML_EXTRUSION_SECOND_LIGHT_HARSH,
+ XML_EXTRUSION_FIRST_LIGHT_LEVEL,
+ XML_EXTRUSION_SECOND_LIGHT_LEVEL,
+ XML_EXTRUSION_FIRST_LIGHT_DIRECTION,
+ XML_EXTRUSION_SECOND_LIGHT_DIRECTION,
+ XML_EXTRUSION_METAL,
+ XML_EXTRUSION_ROTATION_ANGLE,
+ XML_EXTRUSION_ROTATION_CENTER,
+ XML_EXTRUSION_SHININESS,
+ XML_EXTRUSION_SKEW,
+ XML_EXTRUSION_SPECULARITY,
+ XML_EXTRUSION_PROJECTION_MODE,
+ XML_EXTRUSION_VIEWPOINT,
+ XML_EXTRUSION_ORIGIN,
+ XML_EXTRUSION_COLOR,
+ XML_SECONDARY_FILL_COLOR,
+ XML_ENHANCED_PATH,
+ XML_PATH_STRETCHPOINT_X,
+ XML_PATH_STRETCHPOINT_Y,
+ XML_TEXT_AREAS,
+ XML_GLUE_POINTS,
+ XML_GLUE_POINT_TYPE,
+ XML_GLUE_POINT_LEAVING_DIRECTIONS,
+ XML_TEXT_PATH,
+ XML_TEXT_PATH_MODE,
+ XML_TEXT_PATH_SCALE,
+ XML_TEXT_PATH_SAME_LETTER_HEIGHTS,
+ XML_MODIFIERS,
+ XML_EQUATION,
+ XML_XSTRETCH,
+ XML_YSTRETCH,
+ XML_HASSTROKE,
+ XML_HASFILL,
+ XML_LOGWIDTH,
+ XML_LOGHEIGHT,
+ XML_HANDLE,
+ XML_HANDLE_MIRROR_VERTICAL,
+ XML_HANDLE_MIRROR_HORIZONTAL,
+ XML_HANDLE_SWITCHED,
+ XML_HANDLE_POSITION,
+ XML_HANDLE_RANGE_X_MINIMUM,
+ XML_HANDLE_RANGE_X_MAXIMUM,
+ XML_HANDLE_RANGE_Y_MINIMUM,
+ XML_HANDLE_RANGE_Y_MAXIMUM,
+ XML_HANDLE_POLAR,
+ XML_HANDLE_RADIUS_RANGE_MINIMUM,
+ XML_HANDLE_RADIUS_RANGE_MAXIMUM,
+ XML_RECTANGLE,
+ XML_ROUNDRECTANGLE,
+ XML_OVAL,
+ XML_CLOUD,
+ XML_BOUNDINGCUBE,
+ XML_WIREFRAME,
+ XML_SEGMENTS,
+ XML_WORD_WRAP,
+
+ XML_COLLAPSING,
+ XML_SEPARATING,
+ XML_BORDER_MODEL,
+
+ XML_DATA_PILOT_FIELD_REFERENCE,
+ XML_MEMBER_DIFFERENCE,
+ XML_MEMBER_PERCENTAGE,
+ XML_MEMBER_PERCENTAGE_DIFFERENCE,
+ XML_RUNNING_TOTAL,
+ XML_ROW_PERCENTAGE,
+ XML_COLUMN_PERCENTAGE,
+ XML_TOTAL_PERCENTAGE,
+ XML_FIELD_NAME,
+ XML_MEMBER_TYPE,
+ XML_NAMED,
+ XML_MEMBER_NAME,
+ XML_DISPLAY_MEMBER_MODE,
+ XML_MEMBER_COUNT,
+ XML_DATA_FIELD,
+ XML_DATA_PILOT_DISPLAY_INFO,
+ XML_SORT_MODE,
+ XML_DATA_PILOT_SORT_INFO,
+ XML_ADD_EMPTY_LINES,
+ XML_TABULAR_LAYOUT,
+ XML_OUTLINE_SUBTOTALS_TOP,
+ XML_OUTLINE_SUBTOTALS_BOTTOM,
+ XML_LAYOUT_MODE,
+ XML_DATA_PILOT_LAYOUT_INFO,
+
+ XML_SYMBOL_COLOR,
+
+ XML_3D,
+ XML_IMAGE_POSITION,
+ XML_IMAGE_ALIGN,
+
+ XML_DIAGONAL_BL_TR,
+ XML_DIAGONAL_BL_TR_WIDTH,
+ XML_DIAGONAL_TL_BR,
+ XML_DIAGONAL_TL_BR_WIDTH,
+ XML_REPEAT_CONTENT,
+ XML_SHRINK_TO_FIT,
+
+ /* Core impl. of the positioning of floating screen objects without
+ considering its wrapping style (#i28701#)
+ */
+ XML_WRAP_INFLUENCE_ON_POSITION,
+ // Tokens have been renamed and <XML_ITERATIVE> has been added (#i35017#)
+ XML_ONCE_SUCCESSIVE,
+ XML_ONCE_CONCURRENT,
+
+ // Names for OOo format only
+ XML_N_OFFICE_OOO,
+ XML_N_META_OOO,
+ XML_N_STYLE_OOO,
+ XML_N_NUMBER_OOO,
+ XML_N_TEXT_OOO,
+ XML_N_TABLE_OOO,
+ XML_N_DRAW_OOO,
+ XML_N_DR3D_OOO,
+ XML_N_PRESENTATION_OOO,
+ XML_N_CHART_OOO,
+ XML_N_CONFIG_OOO,
+ XML_N_FORM_OOO,
+ XML_N_SCRIPT_OOO,
+
+ XML_GLOBAL,
+ XML_NOTE_CLASS,
+ XML_NOTE_CITATION,
+ XML_NOTE_BODY,
+ XML_NOTES_CONFIGURATION,
+ XML_NOTE_REF,
+ XML_IS_SUB_TABLE,
+ XML_PAGE_LAYOUT,
+ XML_PAGE_LAYOUT_NAME,
+ XML_GRAPHIC_PROPERTIES,
+ XML_DRAWING_PAGE_PROPERTIES,
+ XML_PAGE_LAYOUT_PROPERTIES,
+ XML_HEADER_FOOTER_PROPERTIES,
+ XML_TEXT_PROPERTIES,
+ XML_PARAGRAPH_PROPERTIES,
+ XML_RUBY_PROPERTIES,
+ XML_SECTION_PROPERTIES,
+ XML_TABLE_PROPERTIES,
+ XML_TABLE_COLUMN_PROPERTIES,
+ XML_TABLE_ROW_PROPERTIES,
+ XML_TABLE_CELL_PROPERTIES,
+ XML_LIST_LEVEL_PROPERTIES,
+ XML_CHART_PROPERTIES,
+ XML_DRAWING_PAGE,
+ XML_GRAPHICS,
+ XML_TAB,
+ XML_TEXT_UNDERLINE_MODE,
+ XML_TEXT_LINE_THROUGH_MODE,
+ XML_CONTINUOUS,
+ XML_SKIP_WHITE_SPACE,
+ XML_SCRIPTS,
+ XML_FONT_FACE_DECLS,
+ XML_FONT_FACE,
+ XML_FONT_ADORNMENTS,
+ XML_INCH,
+ XML_SPACE_AFTER,
+ XML_START_INDENT,
+ XML_END_INDENT,
+
+ // chart Oasis format additions
+ XML_INTERVAL_MINOR_DIVISOR,
+ XML_DATE_STRING,
+
+ XML_TEXT_UNDERLINE_STYLE,
+ XML_TEXT_UNDERLINE_TYPE,
+ XML_TEXT_UNDERLINE_WIDTH,
+
+ XML_TEXT_OVERLINE_TYPE,
+ XML_TEXT_OVERLINE_STYLE,
+ XML_TEXT_OVERLINE_WIDTH,
+ XML_TEXT_OVERLINE_COLOR,
+ XML_TEXT_OVERLINE_MODE,
+
+ XML_TEXT_LINE_THROUGH_STYLE,
+ XML_TEXT_LINE_THROUGH_TYPE,
+ XML_TEXT_LINE_THROUGH_WIDTH,
+ XML_TEXT_LINE_THROUGH_TEXT,
+
+ XML_LEADER_STYLE,
+ XML_LEADER_TEXT,
+
+ XML_BOLD_DOTTED,
+ XML_BOLD_DASH,
+ XML_BOLD_LONG_DASH,
+ XML_BOLD_DOT_DASH,
+ XML_BOLD_DOT_DOT_DASH,
+ XML_BOLD_WAVE,
+ XML_DOUBLE_WAVE,
+ XML_DOUBLE_LINE,
+ XML_THICK_LINE,
+ XML_SINGLE_LINE,
+ XML_SLASH,
+ XML_TEXT_LINE_THROUGH_COLOR,
+ XML_TEXT_LINE_THROUGH_TEXT_STYLE,
+ XML_LEADER_COLOR,
+ XML_LEADER_TYPE,
+ XML_LEADER_WIDTH,
+ XML_LEADER_TEXT_STYLE,
+
+ XML_OPACITY,
+ XML_OPACITY_NAME,
+ XML_SHADOW_OPACITY,
+ XML_ALWAYS,
+ XML_COUNT_IN_TEXT_BOXES,
+
+ XML_NP_OOO,
+ XML_N_OOO,
+ XML_NP_OOOW,
+ XML_N_OOOW,
+ XML_NP_OOOC,
+ XML_N_OOOC,
+ XML_NP_DOM,
+ XML_N_DOM,
+
+ XML_EVENT_LISTENERS,
+ XML_EVENT_LISTENER,
+
+ XML_FORM,
+ XML_VOID,
+ XML_PROPERTY,
+ XML_PROPERTY_NAME,
+ XML_LIST_PROPERTY,
+ XML_LIST_VALUE,
+ XML_COLUMN_STYLE_NAME,
+
+ XML_TEXTAREA,
+ XML_FIXED_TEXT,
+ XML_FILE,
+ XML_FORMATTED_TEXT,
+ XML_BUTTON,
+ XML_CHECKBOX,
+ XML_RADIO,
+ XML_LISTBOX,
+ XML_COMBOBOX,
+ XML_IMAGE_FRAME,
+ XML_VALUE_RANGE,
+ XML_GENERIC_CONTROL,
+ XML_SERVICE_NAME,
+ XML_PROPERTY_TYPE,
+ XML_INTEGER,
+ XML_PROPERTY_IS_VOID,
+ XML_PROPERTY_IS_LIST,
+ XML_PROPERTY_VALUE,
+ XML_MIMETYPE,
+ XML_DATABASE_ROW_SELECT,
+ XML_CONTROL_IMPLEMENTATION,
+ XML_INTERPOLATION,
+ XML_CUBIC_SPLINE,
+ XML_B_SPLINE,
+ XML_N_DB_OASIS,
+
+ XML_SHOW_FILTER_BUTTON,
+ XML_DRILL_DOWN_ON_DOUBLE_CLICK,
+ XML_HEADER_GRID_LAYOUT,
+ XML_GROUPED_BY,
+ XML_DAYS,
+ XML_MONTHS,
+ XML_QUARTERS,
+ XML_YEARS,
+ XML_DATE_START,
+ XML_DATE_END,
+ XML_STEP,
+ XML_IS_GROUP_FIELD,
+ XML_DATA_PILOT_GROUPS,
+ XML_DATA_PILOT_GROUP,
+
+ XML_JAPANESE_CANDLE_STICK,
+ XML_NAMED_SYMBOL,
+ XML_DIAMOND,
+ XML_ARROW_DOWN,
+ XML_ARROW_UP,
+ XML_ARROW_RIGHT,
+ XML_ARROW_LEFT,
+ XML_BOW_TIE,
+ XML_HOURGLASS,
+ XML_SYMBOL_NAME,
+ XML_SYMBOL_TYPE,
+ XML_IMAGE_OPACITY, // #i25616#
+
+ XML_DEFAULT_OUTLINE_LEVEL,
+ XML_SHOW_DETAILS,
+ XML_SHOW_EMPTY,
+ XML_ITERATIVE,
+ XML_uX,
+ XML_NP_DLG,
+ XML_N_DLG,
+ XML_SCRIPT_DATA,
+ XML_LIBRARIES,
+ XML_SOURCE_CODE,
+ XML_READONLY,
+
+ XML_Z,
+ XML_DIMENSION,
+ XML_VALIDATION_NAME,
+
+ XML_SCREEN,
+ XML_PRINTER,
+
+ // XForms tokens
+ // already defined: XML_ACTION, XML_VERSION, XML_ENCODING,
+ // XML_REPLACE, XML_SEPARATOR, XML_TYPE, XML_ID
+ XML_MODEL,
+ XML_SCHEMA,
+ XML_BIND,
+ XML_INSTANCE,
+ XML_SUBMISSION,
+ XML_REF,
+ XML_SRC,
+ XML_METHOD,
+ XML_NODESET,
+ XML_INDENT,
+ XML_OMIT_XML_DECLARATION,
+ XML_STANDALONE,
+ XML_CDATA_SECTION_ELEMENTS,
+ XML_REQUIRED,
+ XML_RELEVANT,
+ XML_CALCULATE,
+ XML_CONSTRAINT,
+ XML_MAXOCCURS, // maxOccurs
+ XML_MINOCCURS, // minOccurs
+ XML_P3PTYPE,
+ XML_MEDIATYPE,
+ XML_INCLUDENAMESPACEPREFIXES,
+
+ // XForms/XSD Schema; these tokens use innerWordCapitalization
+ // (already defined: XML_SCHEMA, XML_LENGTH, XML_ID)
+ XML_BASE,
+ XML_TARGETNAMESPACE, // targetNamespace
+ XML_SIMPLETYPE, // simpleType
+ XML_RESTRICTION,
+ XML_MAXLENGTH, // maxLength
+ XML_MINLENGTH, // minLength
+ XML_MININCLUSIVE, // minInclusive
+ XML_MINEXCLUSIVE, // minExclusive
+ XML_MAXINCLUSIVE, // maxInclusive
+ XML_MAXEXCLUSIVE, // maxExclusive
+ XML_PATTERN,
+ XML_ENUMERATION,
+ XML_WHITESPACE, // whiteSpace
+ XML_TOTALDIGITS, // totalDigits
+ XML_FRACTIONDIGITS, // fractionDigits
+ XML_PRESERVE,
+ XML_ANYURI, // anyURI
+ XML_DATETIME_XSD, // dateTime
+ XML_MAIN_ETRY, // #i28755#
+
+ // SMIL
+ XML_REMOVE,
+ XML_HOLD,
+ XML_TRANSITION,
+ XML_INHERIT,
+ XML_FILLDEFAULT,
+ XML_RESTART,
+ XML_RESTARTDEFAULT,
+ XML_WHENNOTACTIVE,
+ XML_NEVER,
+ XML_ACCELERATE,
+ XML_DECELERATE,
+ XML_AUTOREVERSE,
+ XML_INDEFINITE,
+ XML_REPEATCOUNT,
+ XML_REPEATDUR,
+ XML_ENDSYNC,
+ XML_FIRST,
+ XML_LAST,
+ XML_MEDIA,
+ XML_DUR,
+ XML_BEGIN,
+ XML_WHOLE,
+ XML_FROM,
+ XML_TO,
+ XML_BY,
+ XML_VALUES,
+ XML_KEYTIMES,
+ XML_KEYSPLINES,
+ XML_CALCMODE,
+ XML_DISCRETE,
+ XML_PACED,
+ XML_SPLINE,
+ XML_ACCUMULATE,
+ XML_ADDITIVE,
+ XML_MULTIPLY,
+ XML_ANIMATE,
+ XML_ANIMATEMOTION,
+ XML_ANIMATETRANSFORM,
+ XML_ANIMATECOLOR,
+ XML_TRANSITIONFILTER,
+ XML_ATTRIBUTENAME,
+
+ XML_NP_SMIL,
+ XML_N_SMIL,
+
+ XML_NP_ANIMATION,
+ XML_N_ANIMATION,
+
+ XML_PAR,
+ XML_SEQ,
+
+ XML_TRANSLATE,
+ XML_SKEWX,
+ XML_SKEWY,
+
+ XML_AUDIO,
+
+ XML_COLOR_INTERPOLATION,
+ XML_COLOR_INTERPOLATION_DIRECTION,
+ XML_HSL,
+ XML_RGB,
+
+ XML_BARWIPE,
+ XML_BOXWIPE,
+ XML_FOURBOXWIPE,
+ XML_BARNDOORWIPE,
+ XML_DIAGONALWIPE,
+ XML_BOWTIEWIPE,
+ XML_MISCDIAGONALWIPE,
+ XML_VEEWIPE,
+ XML_BARNVEEWIPE,
+ XML_ZIGZAGWIPE,
+ XML_BARNZIGZAGWIPE,
+ XML_IRISWIPE,
+ XML_TRIANGLEWIPE,
+ XML_ARROWHEADWIPE,
+ XML_PENTAGONWIPE,
+ XML_HEXAGONWIPE,
+ XML_ELLIPSEWIPE,
+ XML_EYEWIPE,
+ XML_ROUNDRECTWIPE,
+ XML_STARWIPE,
+ XML_MISCSHAPEWIPE,
+ XML_CLOCKWIPE,
+ XML_PINWHEELWIPE,
+ XML_SINGLESWEEPWIPE,
+ XML_FANWIPE,
+ XML_DOUBLEFANWIPE,
+ XML_DOUBLESWEEPWIPE,
+ XML_SALOONDOORWIPE,
+ XML_WINDSHIELDWIPE,
+ XML_SNAKEWIPE,
+ XML_SPIRALWIPE,
+ XML_PARALLELSNAKESWIPE,
+ XML_BOXSNAKESWIPE,
+ XML_WATERFALLWIPE,
+ XML_PUSHWIPE,
+ XML_SLIDEWIPE,
+ XML_BLINDSWIPE,
+ XML_RANDOMBARWIPE,
+ XML_CHECKERBOARDWIPE,
+ XML_ZOOM,
+
+ XML_LEFTTORIGHT,
+ XML_TOPTOBOTTOM,
+ XML_TOPLEFT,
+ XML_TOPRIGHT,
+ XML_BOTTOMRIGHT,
+ XML_BOTTOMLEFT,
+ XML_TOPCENTER,
+ XML_RIGHTCENTER,
+ XML_BOTTOMCENTER,
+ XML_LEFTCENTER,
+ XML_CORNERSIN,
+ XML_CORNERSOUT,
+ XML_DIAGONALBOTTOMLEFT,
+ XML_DIAGONALTOPLEFT,
+ XML_DOUBLEBARNDOOR,
+ XML_DOUBLEDIAMOND,
+ XML_FOURPOINT,
+ XML_FIVEPOINT,
+ XML_SIXPOINT,
+ XML_HEART,
+ XML_KEYHOLE,
+ XML_CLOCKWISETWELVE,
+ XML_CLOCKWISETHREE,
+ XML_CLOCKWISESIX,
+ XML_CLOCKWISENINE,
+ XML_TWOBLADEVERTICAL,
+ XML_TWOBLADEHORIZONTAL,
+ XML_FOURBLADE,
+ XML_CLOCKWISETOP,
+ XML_CLOCKWISERIGHT,
+ XML_CLOCKWISEBOTTOM,
+ XML_CLOCKWISELEFT,
+ XML_CLOCKWISETOPLEFT,
+ XML_COUNTERCLOCKWISEBOTTOMLEFT,
+ XML_CLOCKWISEBOTTOMRIGHT,
+ XML_COUNTERCLOCKWISETOPRIGHT,
+ XML_CENTERTOP,
+ XML_CENTERRIGHT,
+ XML_FANOUTVERTICAL,
+ XML_FANOUTHORIZONTAL,
+ XML_FANINVERTICAL,
+ XML_FANINHORIZONTAL,
+ XML_PARALLELVERTICAL,
+ XML_PARALLELDIAGONAL,
+ XML_OPPOSITEVERTICAL,
+ XML_OPPOSITEHORIZONTAL,
+ XML_PARALLELDIAGONALTOPLEFT,
+ XML_PARALLELDIAGONALBOTTOMLEFT,
+ XML_TOPLEFTHORIZONTAL,
+ XML_TOPLEFTDIAGONAL,
+ XML_TOPLEFTVERTICAL,
+ XML_TOPRIGHTDIAGONAL,
+ XML_BOTTOMRIGHTDIAGONAL,
+ XML_BOTTOMLEFTDIAGONAL,
+ XML_TOPLEFTCLOCKWISE,
+ XML_TOPRIGHTCLOCKWISE,
+ XML_BOTTOMRIGHTCLOCKWISE,
+ XML_BOTTOMLEFTCLOCKWISE,
+ XML_TOPLEFTCOUNTERCLOCKWISE,
+ XML_TOPRIGHTCOUNTERCLOCKWISE,
+ XML_BOTTOMRIGHTCOUNTERCLOCKWISE,
+ XML_BOTTOMLEFTCOUNTERCLOCKWISE,
+ XML_VERTICALTOPSAME,
+ XML_VERTICALBOTTOMSAME,
+ XML_VERTICALTOPLEFTOPPOSITE,
+ XML_VERTICALBOTTOMLEFTOPPOSITE,
+ XML_HORIZONTALLEFTSAME,
+ XML_HORIZONTALRIGHTSAME,
+ XML_HORIZONTALTOPLEFTOPPOSITE,
+ XML_HORIZONTALTOPRIGHTOPPOSITE,
+ XML_DIAGONALBOTTOMLEFTOPPOSITE,
+ XML_DIAGONALTOPLEFTOPPOSITE,
+ XML_TWOBOXTOP,
+ XML_TWOBOXBOTTOM,
+ XML_TWOBOXLEFT,
+ XML_TWOBOXRIGHT,
+ XML_FOURBOXVERTICAL,
+ XML_FOURBOXHORIZONTAL,
+ XML_VERTICALLEFT,
+ XML_VERTICALRIGHT,
+ XML_HORIZONTALLEFT,
+ XML_HORIZONTALRIGHT,
+ XML_FROMLEFT,
+ XML_FROMTOP,
+ XML_FROMRIGHT,
+ XML_FROMBOTTOM,
+ XML_CROSSFADE,
+ XML_FADETOCOLOR,
+ XML_FADEFROMCOLOR,
+ XML_FADEOVERCOLOR,
+ XML_THREEBLADE,
+ XML_EIGHTBLADE,
+ XML_ONEBLADE,
+ XML_ACROSS,
+ XML_COMBHORIZONTAL,
+ XML_COMBVERTICAL,
+ XML_ROTATEIN,
+ XML_ROTATEOUT,
+ XML_FROMTOPLEFT,
+ XML_FROMTOPRIGHT,
+ XML_FROMBOTTOMLEFT,
+ XML_FROMBOTTOMRIGHT,
+
+ XML_SUBTYPE,
+ XML_OUT,
+
+ XML_FORWARD,
+ XML_REVERSE,
+
+ XML_FADECOLOR,
+
+ XML_ONBEGIN,
+ XML_ONEND,
+ XML_CLICK,
+ XML_DOUBLECLICK,
+ XML_MOUSEOVER,
+ XML_MOUSEOUT,
+
+ XML_NODE_TYPE,
+ XML_PRESET_ID,
+ XML_PRESET_SUB_TYPE,
+ XML_PRESET_CLASS,
+ XML_CUSTOM,
+ XML_ENTRANCE,
+ XML_EXIT,
+ XML_EMPHASIS,
+ XML_MOTION_PATH,
+ XML_OLE_ACTION,
+ XML_MEDIA_CALL,
+ XML_ON_CLICK,
+ XML_WITH_PREVIOUS,
+ XML_AFTER_PREVIOUS,
+ XML_MAIN_SEQUENCE,
+ XML_TIMING_ROOT,
+ XML_INTERACTIVE_SEQUENCE,
+
+ XML_SUB_ITEM,
+ XML_ITERATE_TYPE,
+ XML_ITERATE_INTERVAL,
+ XML_ITERATE,
+ XML_BY_PARAGRAPH,
+ XML_BY_WORD,
+ XML_BY_LETTER,
+
+ XML_AFTER_EFFECT,
+ XML_MASTER,
+
+ XML_GROUP_ID,
+ XML_TARGETELEMENT,
+ XML_TOGGLE_PAUSE,
+ XML_MASTER_ELEMENT,
+ XML_STOP_AUDIO,
+
+ XML_AUDIO_LEVEL,
+
+ XML_URN_OASIS_NAMES_TC,
+ XML_OPENDOCUMENT,
+ XML_1_0,
+
+ XML_IS_LIST_HEADER,
+ XML_N_SVG_COMPAT,
+ XML_N_FO_COMPAT,
+ XML_N_SMIL_COMPAT,
+ XML_N_SMIL_OLD,
+ XML_XFORMS_SUBMISSION,
+ XML_XFORMS_LIST_SOURCE,
+
+ XML_URI_W3_PREFIX,
+ XML_URI_XFORMS_SUFFIX,
+
+ // XML_HORIZONTAL_ON_LEFT_PAGES and XML_HORIZONTAL_ON_RIGHT_PAGES
+ // are replaced by XML_HORIZONTAL_ON_EVEN and XML_HORIZONTAL_ON_ODD. (#i49139#)
+ XML_HORIZONTAL_ON_EVEN,
+ XML_N_RPT_OASIS,
+ XML_N_RPT,
+ XML_GROUP,
+ XML_GROUPS ,
+ XML_REPORT_HEADER,
+ XML_PAGE_HEADER ,
+ XML_DETAIL ,
+ XML_PAGE_FOOTER ,
+ XML_REPORT_FOOTER,
+ XML_START_NEW_COLUMN ,
+ XML_RESET_PAGE_NUMBER ,
+ XML_PRINT_HEADER_ON_EACH_PAGE ,
+ XML_GROUP_EXPRESSION ,
+ XML_GROUP_HEADER ,
+ XML_GROUP_FOOTER ,
+ XML_HEADER_ON_NEW_PAGE,
+ XML_FOOTER_ON_NEW_PAGE,
+ XML_PAGE_PRINT_OPTION,
+ XML_PRE_EVALUATED,
+ XML_COMMAND_TYPE,
+ XML_MASTER_FIELDS,
+ XML_DETAIL_FIELDS,
+ XML_CONDITIONAL_PRINT_EXPRESSION,
+ XML_REPORT_COMPONENT,
+ XML_PRINT_REPEATED_VALUES,
+ XML_REPEAT_SECTION,
+ XML_FORCE_NEW_COLUMN,
+ XML_GROUP_ON,
+ XML_FORCE_NEW_PAGE,
+ XML_GROUP_INTERVAL,
+ XML_PRINT_ONLY_WHEN_GROUP_CHANGE,
+ XML_REPORT_ELEMENT,
+ XML_LIST_SOURCE,
+ XML_LIST_SOURCE_TYPE,
+ XML_IMAGE_DATA,
+ XML_SELECTED,
+ XML_CURRENT_STATE,
+ XML_IS_TRISTATE,
+ XML_ALL_PAGES,
+ XML_NOT_WITH_REPORT_HEADER,
+ XML_NOT_WITH_REPORT_FOOTER,
+ XML_NOT_WITH_REPORT_HEADER_NOR_FOOTER,
+ XML_BEFORE_SECTION,
+ XML_AFTER_SECTION,
+ XML_BEFORE_AFTER_SECTION,
+ XML_PREFIX_CHARACTERS,
+ XML_QUARTAL,
+ XML_WEEK,
+ XML_WHOLE_GROUP,
+ XML_WITH_FIRST_DETAIL,
+ XML_TOP_DOWN,
+ XML_BOTTOM_UP,
+ XML_HOUR,
+ XML_MINUTE,
+ XML_NP_RPT,
+ XML_FORMAT_CONDITION,
+ XML_EXPRESSION1,
+ XML_EXPRESSION2,
+ XML_EQUAL,
+ XML_NOT_EQUAL,
+ XML_LESS,
+ XML_GREATER,
+ XML_LESS_EQUAL,
+ XML_GREATER_EQUAL,
+ XML_BETWEEN,
+ XML_NOT_BETWEEN,
+ XML_TABLE_TEMPLATE,
+ XML_FIRST_ROW,
+ XML_LAST_ROW,
+ XML_FIRST_COLUMN,
+ XML_LAST_COLUMN,
+ XML_EVEN_ROWS,
+ XML_ODD_ROWS,
+ XML_EVEN_COLUMNS,
+ XML_ODD_COLUMNS,
+ XML_HORIZONTAL_ON_ODD,
+ // Password error from 1.4 to 2.0 Beta (#i45874#)
+ XML_RESTART_NUMBERING,
+ // OpenDocument <text:numbered-paragraph> element not supported on OpenDocument import (#i52127#)
+ XML_NUMBERED_PARAGRAPH,
+ XML_MASTER_DETAIL_FIELDS,
+ XML_MASTER_DETAIL_FIELD,
+ XML_SUB_DOCUMENT,
+ XML_FIXED_CONTENT,
+ XML_INITIAL_FORMULA,
+ XML_DEEP_TRAVERSING,
+ XML_PRESERVE_IRI,
+ XML_SORT_BY_X_VALUES,
+ XML_PAGE_CONTINUATION,
+ XML_RIGHT_ANGLED_AXES,
+ XML_SOFT_PAGE_BREAK,
+ XML_USE_SOFT_PAGE_BREAKS,
+ XML_PERCENTAGE_DATA_STYLE_NAME,
+ XML_VALUE_AND_PERCENTAGE,
+ XML_GROUP_BARS_PER_AXIS,
+ XML_INCLUDE_HIDDEN_CELLS,
+ XML_AUTOMATIC_POSITION,
+ XML_AUTOMATIC_SIZE,
+ XML_REVERSE_DIRECTION,
+ XML_LABEL_SEPARATOR,
+ XML_LABEL_POSITION,
+ XML_AVOID_OVERLAP,
+ XML_NEAR_ORIGIN,
+ XML_DEPENDENCY,
+ XML_NAV_ORDER,
+
+ XML_USE_FIRST_ROW_STYLES,
+ XML_USE_LAST_ROW_STYLES,
+ XML_USE_FIRST_COLUMN_STYLES,
+ XML_USE_LAST_COLUMN_STYLES,
+ XML_USE_BANDING_ROWS_STYLES,
+ XML_USE_BANDING_COLUMNS_STYLES,
+
+ XML_AUTOMATIC_CONTENT,
+ XML_DISPLAY_R_SQUARE,
+ XML_DISPLAY_EQUATION,
+ // db odf 12
+ XML_TABLE_REPRESENTATIONS,
+ XML_TABLE_REPRESENTATION,
+ XML_SCHEMA_DEFINITION,
+ XML_CONNECTION_DATA,
+ XML_DATABASE_DESCRIPTION,
+ XML_COMPOUND_DATABASE,
+ XML_FILE_BASED_DATABASE,
+ XML_SERVER_DATABASE,
+ XML_MEDIA_TYPE,
+ XML_HOSTNAME,
+ XML_PORT,
+ XML_LOCAL_SOCKET,
+ XML_USE_SYSTEM_USER,
+ XML_DRIVER_SETTINGS,
+ XML_JAVA_CLASSPATH,
+ XML_CHARACTER_SET,
+ XML_APPLICATION_CONNECTION_SETTINGS,
+ XML_TABLE_INCLUDE_FILTER,
+ XML_DEFAULT_ROW_STYLE_NAME,
+ XML_ANGLE_OFFSET,
+ // Core implementation for direct cross-references (#i81002#)
+ XML_NUMBER_NO_SUPERIOR,
+ XML_NUMBER_ALL_SUPERIOR,
+ XML_LIST_LEVEL_POSITION_AND_SPACE_MODE,
+ XML_LABEL_WIDTH_AND_POSITION,
+ XML_LABEL_ALIGNMENT,
+ XML_LIST_LEVEL_LABEL_ALIGNMENT,
+ XML_LABEL_FOLLOWED_BY,
+ XML_LISTTAB,
+ XML_SPACE,
+ XML_NOTHING,
+ XML_LIST_TAB_STOP_POSITION,
+ XML_STANDARD_ERROR,
+ XML_CELL_RANGE,
+ XML_ERROR_LOWER_RANGE,
+ XML_ERROR_UPPER_RANGE,
+
+ XML_CONTINUE_LIST,
+ XML_STYLE_OVERRIDE,
+
+ // fs: #i90243#
+ XML_XFORM_MODEL_SETTINGS,
+
+ // ODF 1.2 metadata
+ XML_META_FIELD,
+ XML_ABOUT,
+ XML_DATATYPE,
+ XML_TRANSFORMATION,
+
+ // ODF 1.2 numbered-paragraph
+ XML_LIST_ID,
+
+ XML_TREAT_EMPTY_CELLS,
+ XML_LEAVE_GAP,
+ XML_USE_ZERO,
+ XML_IGNORE,
+
+ // enhanced fields
+ XML_FIELDMARK,
+ XML_FIELDMARK_START,
+ XML_FIELDMARK_END,
+ XML_N_FIELD,
+ XML_NP_FIELD,
+
+ XML_IMAGE_SCALE,
+ XML_ISOTROPIC,
+ XML_ANISOTROPIC,
+
+ XML_AXIS_POSITION,
+ XML_AXIS_LABEL_POSITION,
+ XML_NEAR_AXIS,
+ XML_NEAR_AXIS_OTHER_SIDE,
+ XML_OUTSIDE_START,
+ XML_OUTSIDE_END,
+ XML_TICK_MARK_POSITION,
+ XML_AT_LABELS,
+ XML_AT_AXIS,
+ XML_AT_LABELS_AND_AXIS,
+ XML_FILLED_RADAR,
+ XML_SURFACE,
+
+ // MathML only
+ XML_MATHVARIANT,
+ XML_MATHSIZE,
+ XML_MATHWEIGHT,
+ XML_MATHCOLOR,
+
+ XML_CONTAINS,
+ XML_DOES_NOT_CONTAIN,
+ XML_BEGINS_WITH,
+ XML_DOES_NOT_BEGIN_WITH,
+ XML_ENDS_WITH,
+ XML_DOES_NOT_END_WITH,
+
+ //chart
+ XML_NP_CHART_EXT,
+ XML_N_CHART_EXT,
+ XML_COORDINATE_REGION,
+
+ XML_DIAGONAL_BL_TR_WIDTHS,
+ XML_DIAGONAL_TL_BR_WIDTHS,
+
+ XML_OUTSIDE_MINIMUM,//#i114142#
+ XML_OUTSIDE_MAXIMUM,//#i114142#
+
+ XML_LEGEND_EXPANSION, //#i28760#
+ XML_LEGEND_EXPANSION_ASPECT_RATIO, //#i28760#
+ XML_BALANCED, //#i28760#
+ XML_HIGH, //#i28760#
+ XML_WIDE, //#i28760#
+
+ XML_AXIS_TYPE, //#i25706#
+ XML_DATE_SCALE,
+ XML_BASE_TIME_UNIT,
+ XML_MAJOR_INTERVAL_VALUE,
+ XML_MINOR_INTERVAL_VALUE,
+ XML_MAJOR_INTERVAL_UNIT,
+ XML_MINOR_INTERVAL_UNIT,
+
+ XML_MIN_VALUE,
+ XML_MAX_VALUE,
+
+ XML_TOKEN_END
+ };
+
+
+ /// return the OUString representation for eToken
+ XMLOFF_DLLPUBLIC const ::rtl::OUString& GetXMLToken(
+ enum XMLTokenEnum eToken );
+
+ /// compare eToken to the string
+ XMLOFF_DLLPUBLIC sal_Bool IsXMLToken(
+ const ::rtl::OUString& rString,
+ enum XMLTokenEnum eToken );
+
+ // gives all allocated memory for OUString* back
+ XMLOFF_DLLPUBLIC void ResetTokens();
+
+ XMLOFF_DLLPUBLIC void IncRescheduleCount();
+
+ XMLOFF_DLLPUBLIC void DecRescheduleCount();
+
+
+} }
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/xmltypes.hxx b/xmloff/inc/xmloff/xmltypes.hxx
new file mode 100644
index 000000000000..922ad3f340d0
--- /dev/null
+++ b/xmloff/inc/xmloff/xmltypes.hxx
@@ -0,0 +1,289 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLTYPES_HXX
+#define _XMLOFF_XMLTYPES_HXX
+
+///////////////////////////////////////////////////////////////////////////////
+// Flags to specify how to im/export the property
+//
+// OLD:
+// 8421.8421.8421.8421.8421.8421.8421.8421
+// n n m mmmd m baaa tttt.tttt.tttt
+// spsp eep paef e ppp tttt.tttt.tttt
+// iiee iei ieie i ppp tttt.tttt.tttt
+// NOW:
+// n n mm mmdm pp ppba aatt.tttt.tttt
+// spsp eepp aefe p pptt.tttt.tttt
+// iiee ieii eiei p pptt.tttt.tttt
+
+#define MID_FLAG_MASK 0x00003fff
+
+// Import only: the xml attribute's value is evaluated by a call to
+// handleSpecialItem instead of calling the property handler's importXML method
+#define MID_FLAG_SPECIAL_ITEM_IMPORT 0x80000000
+
+// Export only: the property's value is exported by a call to handleSpecialItem
+// instead of calling the property handler's exportXML method
+#define MID_FLAG_SPECIAL_ITEM_EXPORT 0x20000000
+#define MID_FLAG_SPECIAL_ITEM 0xa0000000 // both import and export
+
+// the map entry denotes the name of an element item
+#define MID_FLAG_ELEMENT_ITEM_IMPORT 0x08000000
+#define MID_FLAG_ELEMENT_ITEM_EXPORT 0x04000000
+#define MID_FLAG_ELEMENT_ITEM 0x0c000000 // both import and export
+
+// the attribute is ignored (not yet implemented)
+#define MID_FLAG_NO_PROPERTY_IMPORT 0x40000000
+
+// the property is ignored
+#define MID_FLAG_NO_PROPERTY_EXPORT 0x10000000
+#define MID_FLAG_NO_PROPERTY 0x50000000 // both import and export
+
+// Import only: there are more entries for the same xml attribute existing
+#define MID_FLAG_MULTI_PROPERTY 0x02000000 //
+
+// Import only: If a property with the same name has been set already, supply
+// the current value to the importXML call.
+#define MID_FLAG_MERGE_PROPERTY 0x01000000
+
+// Export only: If an xml attribute with the same name has been exported
+// already, supply its value to teh exportXML call and delete the existing
+// atribute afterwards.
+#define MID_FLAG_MERGE_ATTRIBUTE 0x00800000
+
+// Import and Export: The property in question must exist. No call to
+// hasPropertyByName is required.
+#define MID_FLAG_MUST_EXIST 0x00400000
+
+// Export only: When exporting defaults, export this property even if it is
+// not set
+#define MID_FLAG_DEFAULT_ITEM_EXPORT 0x00200000
+
+// Import only: In general, properties may not throw exception, but
+// this one may. If it throws an IllegalArgumentException, it will be
+// silently ignored. This should be used for properties whose values
+// cannot be checked. (E.g., the printer paper tray: The tray names
+// are different for all printers, and we don't know ahead whether a
+// printer supports the trays in the current document.)
+#define MID_FLAG_PROPERTY_MAY_EXCEPT 0x00100000
+
+#define XML_TYPE_PROP_SHIFT 14
+#define XML_TYPE_PROP_MASK (0xf << XML_TYPE_PROP_SHIFT)
+
+#define XML_TYPE_PROP_START (0x1 << XML_TYPE_PROP_SHIFT)
+#define XML_TYPE_PROP_GRAPHIC (0x1 << XML_TYPE_PROP_SHIFT)
+#define XML_TYPE_PROP_DRAWING_PAGE (0x2 << XML_TYPE_PROP_SHIFT)
+#define XML_TYPE_PROP_PAGE_LAYOUT (0x3 << XML_TYPE_PROP_SHIFT)
+#define XML_TYPE_PROP_HEADER_FOOTER (0x4 << XML_TYPE_PROP_SHIFT)
+#define XML_TYPE_PROP_TEXT (0x5 << XML_TYPE_PROP_SHIFT)
+#define XML_TYPE_PROP_PARAGRAPH (0x6 << XML_TYPE_PROP_SHIFT)
+#define XML_TYPE_PROP_RUBY (0x7 << XML_TYPE_PROP_SHIFT)
+#define XML_TYPE_PROP_SECTION (0x8 << XML_TYPE_PROP_SHIFT)
+#define XML_TYPE_PROP_TABLE (0x9 << XML_TYPE_PROP_SHIFT)
+#define XML_TYPE_PROP_TABLE_COLUMN (0xa << XML_TYPE_PROP_SHIFT)
+#define XML_TYPE_PROP_TABLE_ROW (0xb << XML_TYPE_PROP_SHIFT)
+#define XML_TYPE_PROP_TABLE_CELL (0xc << XML_TYPE_PROP_SHIFT)
+#define XML_TYPE_PROP_LIST_LEVEL (0xd << XML_TYPE_PROP_SHIFT)
+#define XML_TYPE_PROP_CHART (0xe << XML_TYPE_PROP_SHIFT)
+#define XML_TYPE_PROP_END (0xf << XML_TYPE_PROP_SHIFT)
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// XML-data-type-ID's
+//
+
+// simple types, no special compare necessary
+#define XML_TYPE_BUILDIN_CMP 0x00002000
+
+// basic types (all also XML_TYPE_BUILDIN_CMP)
+#define XML_TYPE_BOOL 0x00002001 // true/false
+#define XML_TYPE_MEASURE 0x00002002 // 1cm
+#define XML_TYPE_MEASURE8 0x00002003 // 1cm
+#define XML_TYPE_MEASURE16 0x00002004 // 1cm
+#define XML_TYPE_PERCENT 0x00002005 // 50%
+#define XML_TYPE_PERCENT8 0x00002006 // 50%
+#define XML_TYPE_PERCENT16 0x00002007 // 50%
+#define XML_TYPE_STRING 0x00002008 // "blablabla"
+#define XML_TYPE_COLOR 0x00002009 // Colors
+#define XML_TYPE_NUMBER 0x0000200a // 123
+#define XML_TYPE_NUMBER8 0x0000200b // 123
+#define XML_TYPE_NUMBER16 0x0000200c // 123
+#define XML_TYPE_NUMBER_NONE 0x0000200d // 123 and "no-limit" for 0
+#define XML_TYPE_DOUBLE 0x0000200e // for doubles
+#define XML_TYPE_NBOOL 0x0000200f // !true/false
+#define XML_TYPE_COLORTRANSPARENT 0x00002010 // Colors or "transparent"
+#define XML_TYPE_ISTRANSPARENT 0x00002011 // "transparent"
+#define XML_TYPE_BUILDIN_CMP_ONLY 0x00002012 // Only buildin comparison is required, so no handler exists
+#define XML_TYPE_NUMBER8_NONE 0x00002013 // 123 and "no-limit" for 0
+#define XML_TYPE_NUMBER16_NONE 0x00002014 // 123 and "no-limit" for 0
+#define XML_TYPE_COLOR_MODE 0x00002015
+#define XML_TYPE_DURATION16_MS 0x00002016 // PT00H00M01S to ms in sal_Int16
+#define XML_TYPE_MEASURE_PX 0x00002017 // 1px
+#define XML_TYPE_COLORAUTO 0x00002018 // color if not -1
+#define XML_TYPE_ISAUTOCOLOR 0x00002019 // true if -1
+#define XML_TYPE_STYLENAME 0x00002020 // "blablabla"
+#define XML_TYPE_NEG_PERCENT 0x00002021 // (100-x)%
+#define XML_TYPE_NEG_PERCENT8 0x00002022 // (100-x)%
+#define XML_TYPE_NEG_PERCENT16 0x00002023 // (100-x)
+#define XML_TYPE_DOUBLE_PERCENT 0x00002024 // 50% (source is a double from 0.0 to 1.0)
+
+// special basic types
+#define XML_TYPE_RECTANGLE_LEFT 0x00000100 // the Left member of a awt::Rectangle as a measure
+#define XML_TYPE_RECTANGLE_TOP 0x00000101 // the Top member of a awt::Rectangle as a measure
+#define XML_TYPE_RECTANGLE_WIDTH 0x00000102 // the Width member of a awt::Rectangle as a measure
+#define XML_TYPE_RECTANGLE_HEIGHT 0x00000103 // the Height member of a awt::Rectangle as a measure
+
+#define XML_TYPE_APP_SHIFT 10
+#define XML_SC_TYPES_START (0x1 << XML_TYPE_APP_SHIFT)
+#define XML_SD_TYPES_START (0x2 << XML_TYPE_APP_SHIFT)
+
+#define XML_TEXT_TYPES_START (0x3 << XML_TYPE_APP_SHIFT)
+#define XML_TYPE_TEXT_CROSSEDOUT_STYLE (XML_TEXT_TYPES_START + 0)
+#define XML_TYPE_TEXT_CASEMAP (XML_TEXT_TYPES_START + 1)
+#define XML_TYPE_TEXT_FONTFAMILYNAME (XML_TEXT_TYPES_START + 2)
+#define XML_TYPE_TEXT_FONTFAMILY (XML_TEXT_TYPES_START + 3)
+#define XML_TYPE_TEXT_FONTENCODING (XML_TEXT_TYPES_START + 4)
+#define XML_TYPE_TEXT_FONTPITCH (XML_TEXT_TYPES_START + 5)
+#define XML_TYPE_TEXT_KERNING (XML_TEXT_TYPES_START + 6)
+#define XML_TYPE_TEXT_POSTURE (XML_TEXT_TYPES_START + 7)
+#define XML_TYPE_TEXT_SHADOWED (XML_TEXT_TYPES_START + 8)
+#define XML_TYPE_TEXT_UNDERLINE_STYLE (XML_TEXT_TYPES_START + 9)
+#define XML_TYPE_TEXT_WEIGHT (XML_TEXT_TYPES_START + 10)
+#define XML_TYPE_TEXT_SPLIT (XML_TEXT_TYPES_START + 11)
+#define XML_TYPE_TEXT_BREAKBEFORE (XML_TEXT_TYPES_START + 12)
+#define XML_TYPE_TEXT_BREAKAFTER (XML_TEXT_TYPES_START + 13)
+#define XML_TYPE_TEXT_SHADOW (XML_TEXT_TYPES_START + 14)
+#define XML_TYPE_TEXT_ADJUST (XML_TEXT_TYPES_START + 15)
+#define XML_TYPE_TEXT_ADJUSTLAST (XML_TEXT_TYPES_START + 16)
+#define XML_TYPE_TEXT_CASEMAP_VAR (XML_TEXT_TYPES_START + 17)
+#define XML_TYPE_TEXT_ESCAPEMENT (XML_TEXT_TYPES_START + 18)
+#define XML_TYPE_TEXT_ESCAPEMENT_HEIGHT (XML_TEXT_TYPES_START + 19)
+#define XML_TYPE_CHAR_HEIGHT (XML_TEXT_TYPES_START + 20)
+#define XML_TYPE_CHAR_HEIGHT_PROP (XML_TEXT_TYPES_START + 21)
+#define XML_TYPE_CHAR_LANGUAGE (XML_TEXT_TYPES_START + 22)
+#define XML_TYPE_CHAR_COUNTRY (XML_TEXT_TYPES_START + 23)
+#define XML_TYPE_LINE_SPACE_FIXED (XML_TEXT_TYPES_START + 24)
+#define XML_TYPE_LINE_SPACE_MINIMUM (XML_TEXT_TYPES_START + 25)
+#define XML_TYPE_LINE_SPACE_DISTANCE (XML_TEXT_TYPES_START + 26)
+#define XML_TYPE_BORDER (XML_TEXT_TYPES_START + 27)
+#define XML_TYPE_BORDER_WIDTH (XML_TEXT_TYPES_START + 28)
+#define XML_TYPE_TEXT_DROPCAP (XML_TEXT_TYPES_START + 29)
+#define XML_TYPE_TEXT_TABSTOP (XML_TEXT_TYPES_START + 30)
+#define XML_TYPE_TEXT_BOOLCROSSEDOUT (XML_TEXT_TYPES_START + 31)
+#define XML_TYPE_TEXT_WRAP (XML_TEXT_TYPES_START + 32)
+#define XML_TYPE_TEXT_PARAGRAPH_ONLY (XML_TEXT_TYPES_START + 33)
+#define XML_TYPE_TEXT_WRAP_OUTSIDE (XML_TEXT_TYPES_START + 34)
+#define XML_TYPE_TEXT_OPAQUE (XML_TEXT_TYPES_START + 35)
+#define XML_TYPE_TEXT_PROTECT_CONTENT (XML_TEXT_TYPES_START + 36)
+#define XML_TYPE_TEXT_PROTECT_SIZE (XML_TEXT_TYPES_START + 37)
+#define XML_TYPE_TEXT_PROTECT_POSITION (XML_TEXT_TYPES_START + 38)
+#define XML_TYPE_TEXT_ANCHOR_TYPE (XML_TEXT_TYPES_START + 39)
+#define XML_TYPE_TEXT_COLUMNS (XML_TEXT_TYPES_START + 40)
+#define XML_TYPE_TEXT_HORIZONTAL_POS (XML_TEXT_TYPES_START + 41)
+#define XML_TYPE_TEXT_HORIZONTAL_POS_MIRRORED (XML_TEXT_TYPES_START + 42)
+#define XML_TYPE_TEXT_HORIZONTAL_REL (XML_TEXT_TYPES_START + 43)
+#define XML_TYPE_TEXT_HORIZONTAL_REL_FRAME (XML_TEXT_TYPES_START + 44)
+#define XML_TYPE_TEXT_HORIZONTAL_MIRROR (XML_TEXT_TYPES_START + 45)
+#define XML_TYPE_TEXT_VERTICAL_POS (XML_TEXT_TYPES_START + 46)
+#define XML_TYPE_TEXT_VERTICAL_REL (XML_TEXT_TYPES_START + 47)
+#define XML_TYPE_TEXT_VERTICAL_REL_PAGE (XML_TEXT_TYPES_START + 48)
+#define XML_TYPE_TEXT_VERTICAL_REL_FRAME (XML_TEXT_TYPES_START + 49)
+#define XML_TYPE_TEXT_VERTICAL_REL_AS_CHAR (XML_TEXT_TYPES_START + 50)
+#define XML_TYPE_TEXT_MIRROR_VERTICAL (XML_TEXT_TYPES_START + 51)
+#define XML_TYPE_TEXT_MIRROR_HORIZONTAL_LEFT (XML_TEXT_TYPES_START + 52)
+#define XML_TYPE_TEXT_MIRROR_HORIZONTAL_RIGHT (XML_TEXT_TYPES_START + 53)
+#define XML_TYPE_TEXT_CLIP11 (XML_TEXT_TYPES_START + 54)
+#define XML_TYPE_ATTRIBUTE_CONTAINER (XML_TEXT_TYPES_START + 55 )
+#define XML_TYPE_CHAR_HEIGHT_DIFF (XML_TEXT_TYPES_START + 56)
+#define XML_TYPE_TEXT_EMPHASIZE (XML_TEXT_TYPES_START + 57)
+#define XML_TYPE_TEXT_COMBINE (XML_TEXT_TYPES_START + 58)
+#define XML_TYPE_TEXT_COMBINECHAR (XML_TEXT_TYPES_START + 59)
+#define XML_TYPE_TEXT_UNDERLINE_COLOR (XML_TEXT_TYPES_START + 60)
+#define XML_TYPE_TEXT_UNDERLINE_HASCOLOR (XML_TEXT_TYPES_START + 61)
+#define XML_TYPE_TEXT_AUTOSPACE (XML_TEXT_TYPES_START + 62)
+#define XML_TYPE_TEXT_PUNCTUATION_WRAP (XML_TEXT_TYPES_START + 63)
+#define XML_TYPE_TEXT_LINE_BREAK (XML_TEXT_TYPES_START + 64)
+
+#define XML_TYPE_TEXT_ALIGN (XML_TEXT_TYPES_START + 65)
+#define XML_TYPE_FONT_WIDTH (XML_TEXT_TYPES_START + 66)
+#define XML_TYPE_ROTATION_ANGLE (XML_TEXT_TYPES_START + 67)
+#define XML_TYPE_CONTROL_BORDER (XML_TEXT_TYPES_START + 68)
+#define XML_TYPE_TEXT_REL_WIDTH_HEIGHT (XML_TEXT_TYPES_START + 69)
+#define XML_TYPE_TEXT_SYNC_WIDTH_HEIGHT (XML_TEXT_TYPES_START + 70)
+#define XML_TYPE_TEXT_SYNC_WIDTH_HEIGHT_MIN (XML_TEXT_TYPES_START + 71)
+#define XML_TYPE_TEXT_COMBINE_CHARACTERS (XML_TEXT_TYPES_START + 72)
+#define XML_TYPE_TEXT_ANIMATION (XML_TEXT_TYPES_START + 73)
+#define XML_TYPE_TEXT_ANIMATION_DIRECTION (XML_TEXT_TYPES_START + 74)
+#define XML_TYPE_TEXT_HORIZONTAL_ADJUST (XML_TEXT_TYPES_START + 75)
+#define XML_TYPE_TEXT_RUBY_ADJUST (XML_TEXT_TYPES_START + 76)
+#define XML_TYPE_TEXT_FONT_RELIEF (XML_TEXT_TYPES_START + 77)
+#define XML_TYPE_TEXT_ROTATION_ANGLE (XML_TEXT_TYPES_START + 78)
+#define XML_TYPE_TEXT_ROTATION_SCALE (XML_TEXT_TYPES_START + 79)
+#define XML_TYPE_TEXT_VERTICAL_ALIGN (XML_TEXT_TYPES_START + 80)
+#define XML_TYPE_TEXT_DRAW_ASPECT (XML_TEXT_TYPES_START + 81)
+#define XML_TYPE_CONTROL_TEXT_EMPHASIZE (XML_TEXT_TYPES_START + 82)
+#define XML_TYPE_TEXT_RUBY_POSITION (XML_TEXT_TYPES_START + 83)
+#define XML_TYPE_TEXT_VERTICAL_POS_AT_CHAR (XML_TEXT_TYPES_START + 84)
+#define XML_TYPE_TEXT_WRITING_MODE (XML_TEXT_TYPES_START + 85)
+#define XML_TYPE_TEXT_WRITING_MODE_WITH_DEFAULT (XML_TEXT_TYPES_START + 86)
+#define XML_TYPE_LAYOUT_GRID_MODE (XML_TEXT_TYPES_START + 87)
+#define XML_TYPE_TEXT_HIDDEN_AS_DISPLAY (XML_TEXT_TYPES_START + 88)
+#define XML_TYPE_CONTROL_BORDER_COLOR (XML_TEXT_TYPES_START + 89)
+#define XML_TYPE_BORDER_MODEL (XML_TEXT_TYPES_START + 90)
+#define XML_TYPE_TEXT_LINE_MODE (XML_TEXT_TYPES_START + 91)
+#define XML_TYPE_TEXT_UNDERLINE_TYPE (XML_TEXT_TYPES_START + 92)
+#define XML_TYPE_TEXT_UNDERLINE_WIDTH (XML_TEXT_TYPES_START + 93)
+#define XML_TYPE_TEXT_CROSSEDOUT_TYPE (XML_TEXT_TYPES_START + 94)
+#define XML_TYPE_TEXT_CROSSEDOUT_WIDTH (XML_TEXT_TYPES_START + 95)
+#define XML_TYPE_TEXT_CROSSEDOUT_TEXT (XML_TEXT_TYPES_START + 96)
+#define XML_TYPE_TEXT_KEEP (XML_TEXT_TYPES_START + 97)
+#define XML_TYPE_TEXT_NKEEP (XML_TEXT_TYPES_START + 98)
+#define XML_TYPE_WRAP_INFLUENCE_ON_POSITION (XML_TEXT_TYPES_START + 99)
+#define XML_TYPE_WRAP_OPTION (XML_TEXT_TYPES_START + 100)
+#define XML_TYPE_TEXT_NUMBER8_ONE_BASED (XML_TEXT_TYPES_START + 101)
+#define XML_TYPE_NUMBER_NO_ZERO (XML_TEXT_TYPES_START + 102)
+#define XML_TYPE_NUMBER8_NO_ZERO (XML_TEXT_TYPES_START + 103)
+#define XML_TYPE_NUMBER16_NO_ZERO (XML_TEXT_TYPES_START + 104)
+#define XML_TYPE_NUMBER16_AUTO (XML_TEXT_TYPES_START + 105)
+#define XML_TYPE_TEXT_SOFT_PAGE_BREAK (XML_TEXT_TYPES_START + 106)
+#define XML_TYPE_TEXT_USE_SOFT_PAGE_BREAKS (XML_TEXT_TYPES_START + 107)
+#define XML_TYPE_TEXT_CLIP (XML_TEXT_TYPES_START + 108)
+#define XML_TYPE_TEXT_OVERLINE_TYPE (XML_TEXT_TYPES_START + 109)
+#define XML_TYPE_TEXT_OVERLINE_STYLE (XML_TEXT_TYPES_START + 110)
+#define XML_TYPE_TEXT_OVERLINE_WIDTH (XML_TEXT_TYPES_START + 111)
+#define XML_TYPE_TEXT_OVERLINE_COLOR (XML_TEXT_TYPES_START + 112)
+#define XML_TYPE_TEXT_OVERLINE_HASCOLOR (XML_TEXT_TYPES_START + 113)
+
+#define XML_SCH_TYPES_START (0x4 << XML_TYPE_APP_SHIFT)
+#define XML_PM_TYPES_START (0x5 << XML_TYPE_APP_SHIFT) // page master
+#define XML_DB_TYPES_START (0x6 << XML_TYPE_APP_SHIFT)
+
+#endif // _XMLOFF_XMLTYPES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/xmluconv.hxx b/xmloff/inc/xmloff/xmluconv.hxx
new file mode 100644
index 000000000000..c593e99ebbbb
--- /dev/null
+++ b/xmloff/inc/xmloff/xmluconv.hxx
@@ -0,0 +1,448 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLUCONV_HXX
+#define _XMLOFF_XMLUCONV_HXX
+
+#include "sal/config.h"
+#include "xmloff/dllapi.h"
+#include "sal/types.h"
+
+#include <limits.h>
+#include <tools/solar.h>
+#include <tools/color.hxx>
+#include <tools/mapunit.hxx>
+#include <xmloff/xmlement.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/drawing/Position3D.hpp>
+
+// #110680#
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class Time;
+namespace rtl
+{
+class OUString;
+class OUStringBuffer;
+}
+
+namespace com { namespace sun { namespace star {
+ namespace util { struct DateTime; }
+ namespace text { class XNumberingTypeInfo; }
+ namespace i18n { class XCharacterClassification; }
+}}}
+
+namespace basegfx
+{
+ class B3DVector;
+} // end of namespace basegfx
+
+class XMLOFF_DLLPUBLIC SvXMLTokenEnumerator
+{
+private:
+ const ::rtl::OUString& maTokenString;
+ sal_Int32 mnNextTokenPos;
+ sal_Unicode mcSeperator;
+
+public:
+ SvXMLTokenEnumerator( const ::rtl::OUString& rString, sal_Unicode cSeperator = sal_Unicode(' ') );
+
+ sal_Bool getNextToken( ::rtl::OUString& rToken );
+};
+
+/** the SvXMLTypeConverter converts values of various types from
+ their internal represantation to the textual form used in xml
+ and back.
+ Most of the methods are static but the SvXMLTypeConverter can
+ also store default units for both numerical and textual measures.
+*/
+
+class XMLOFF_DLLPUBLIC SvXMLUnitConverter
+{
+private:
+ MapUnit meCoreMeasureUnit;
+ MapUnit meXMLMeasureUnit;
+ com::sun::star::util::Date aNullDate;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XNumberingTypeInfo > xNumTypeInfo;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::i18n::XCharacterClassification > xCharClass;
+ // #110680#
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxServiceFactory;
+
+ SAL_DLLPRIVATE static ::rtl::OUString msXML_false;
+ SAL_DLLPRIVATE static ::rtl::OUString msXML_true;
+
+ SAL_DLLPRIVATE static void initXMLStrings();
+
+ SAL_DLLPRIVATE void createNumTypeInfo() const;
+
+public:
+ /** constructs a SvXMLUnitConverter. The core measure unit is the
+ default unit for numerical measures, the XML measure unit is
+ the default unit for textual measures */
+ // #110680#
+ // SvXMLUnitConverter( MapUnit eCoreMeasureUnit, MapUnit eXMLMeasureUnit );
+ SvXMLUnitConverter(
+ MapUnit eCoreMeasureUnit,
+ MapUnit eXMLMeasureUnit,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory );
+
+ virtual ~SvXMLUnitConverter();
+
+ static MapUnit GetMapUnit(sal_Int16 nFieldUnit);
+
+ /** sets the default unit for numerical measures */
+ inline void setCoreMeasureUnit( MapUnit eCoreMeasureUnit );
+
+ /** gets the default unit for numerical measures */
+ inline MapUnit getCoreMeasureUnit() const;
+
+ /** sets the default unit for textual measures */
+ void setXMLMeasureUnit( MapUnit eXMLMeasureUnit );
+
+ /** gets the default unit for textual measures */
+ MapUnit getXMLMeasureUnit() const;
+
+ /** gets XNumberingTypeInfo */
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XNumberingTypeInfo >& getNumTypeInfo() const
+ {
+ if( !xNumTypeInfo.is() )
+ createNumTypeInfo();
+ return xNumTypeInfo;
+ }
+
+ /** convert string to measure using optional min and max values*/
+ sal_Bool convertMeasure( sal_Int32& rValue,
+ const ::rtl::OUString& rString,
+ sal_Int32 nMin = SAL_MIN_INT32,
+ sal_Int32 nMax = SAL_MAX_INT32) const;
+
+ /** convert measure to string */
+ void convertMeasure( ::rtl::OUStringBuffer& rBuffer,
+ sal_Int32 nMeasure ) const;
+
+ /** convert measure with given unit to string */
+ void convertMeasure( ::rtl::OUStringBuffer&,
+ sal_Int32 nMeasure,
+ MapUnit eSrcUnit ) const;
+
+ /** convert string to measure in given unit
+ using optional min and max values */
+ static sal_Bool convertMeasure( sal_Int32& rVal,
+ const ::rtl::OUString& rString,
+ MapUnit eDstUnit,
+ sal_Int32 nMin = SAL_MIN_INT32,
+ sal_Int32 nMax = SAL_MAX_INT32);
+
+ /** convert measure in given unit to string with given unit */
+ static void convertMeasure( ::rtl::OUStringBuffer& rBuffer,
+ sal_Int32 nMeasure,
+ MapUnit eSrcUnit,
+ MapUnit eDstUnit );
+
+ /** convert string to boolean */
+ static sal_Bool convertBool( bool& rBool,
+ const ::rtl::OUString& rString );
+
+ /** convert boolean to string */
+ static void convertBool( ::rtl::OUStringBuffer& rBuffer,
+ sal_Bool bValue );
+
+ /** convert string to percent */
+ static sal_Bool convertPercent( sal_Int32& rValue,
+ const ::rtl::OUString& rString );
+
+ /** convert percent to string */
+ static void convertPercent( ::rtl::OUStringBuffer& rBuffer,
+ sal_Int32 nValue );
+
+ /** convert string to pixel measure unite */
+ static sal_Bool convertMeasurePx( sal_Int32& rValue,
+ const ::rtl::OUString& rString );
+
+ /** convert pixel measure unit to string */
+ static void convertMeasurePx( ::rtl::OUStringBuffer& rBuffer,
+ sal_Int32 nValue );
+
+ /** convert string to enum using given enum map, if the enum is
+ not found in the map, this method will return false */
+ static sal_Bool convertEnum( sal_uInt16& rEnum,
+ const ::rtl::OUString& rValue,
+ const SvXMLEnumMapEntry *pMap );
+
+ /** convert string to enum using given token map, if the enum is
+ not found in the map, this method will return false */
+ static sal_Bool convertEnum( sal_uInt16& rEnum,
+ const ::rtl::OUString& rValue,
+ const SvXMLEnumStringMapEntry *pMap );
+
+ /** convert enum to string using given enum map with an optional
+ default token. If the enum is not found in the map,
+ this method will either use the given default or return
+ false if not default is set */
+ static sal_Bool convertEnum( ::rtl::OUStringBuffer& rBuffer,
+ unsigned int nValue,
+ const SvXMLEnumMapEntry *pMap,
+ enum ::xmloff::token::XMLTokenEnum eDefault =
+ ::xmloff::token::XML_TOKEN_INVALID );
+
+ /** convert enum to string using given token map with an optional
+ default token. If the enum is not found in the map,
+ this method will either use the given default or return
+ false if not default is set */
+ static sal_Bool convertEnum( ::rtl::OUStringBuffer& rBuffer,
+ sal_uInt16 nValue,
+ const SvXMLEnumStringMapEntry *pMap,
+ sal_Char* pDefault = NULL );
+
+ /** convert string to color */
+ static sal_Bool convertColor( Color& rColor,
+ const ::rtl::OUString&rValue );
+
+ /** convert color to string */
+ static void convertColor( ::rtl::OUStringBuffer &rBuffer,
+ const Color& rCol );
+
+ /** convert number to string */
+ static void convertNumber( ::rtl::OUStringBuffer& rBuffer,
+ sal_Int32 nNumber );
+
+ /** convert string to number with optional min and max values */
+ static sal_Bool convertNumber( sal_Int32& rValue,
+ const ::rtl::OUString& rString,
+ sal_Int32 nMin = SAL_MIN_INT32,
+ sal_Int32 nMax = SAL_MAX_INT32);
+
+ /** convert number to string */
+ static void convertNumber64( ::rtl::OUStringBuffer& rBuffer,
+ sal_Int64 nNumber );
+
+ /** convert string to number with optional min and max values */
+ static sal_Bool convertNumber64( sal_Int64& rValue,
+ const ::rtl::OUString& rString,
+ sal_Int64 nMin = SAL_MIN_INT64,
+ sal_Int64 nMax = SAL_MAX_INT64);
+
+ /** convert double number to string (using ::rtl::math) and DO
+ convert to export MapUnit */
+ void convertDouble(::rtl::OUStringBuffer& rBuffer,
+ double fNumber, sal_Bool bWriteUnits) const;
+
+ /** convert double number to string (using ::rtl::math) and
+ DO convert from eSrcUnit to export MapUnit */
+ static void convertDouble( ::rtl::OUStringBuffer& rBuffer,
+ double fNumber, sal_Bool bWriteUnits, MapUnit eCoreUnit, MapUnit eDstUnit);
+
+ /** convert double number to string (using ::rtl::math) without unit conversion */
+ static void convertDouble( ::rtl::OUStringBuffer& rBuffer, double fNumber);
+
+ /** convert string to double number (using ::rtl::math) and DO convert. */
+ sal_Bool convertDouble(double& rValue, const ::rtl::OUString& rString, sal_Bool bLookForUnits) const;
+
+ /** convert string to double number (using ::rtl::math) and DO convert from
+ SrcUnit to DstUnit. */
+ static sal_Bool convertDouble(double& rValue,
+ const ::rtl::OUString& rString, MapUnit eSrcUnit, MapUnit eCoreUnit);
+
+ /** convert string to double number (using ::rtl::math) without unit conversion */
+ static sal_Bool convertDouble(double& rValue, const ::rtl::OUString& rString);
+
+ /** get the Null Date of the XModel and set it to the UnitConverter */
+ sal_Bool setNullDate (
+ const com::sun::star::uno::Reference <com::sun::star::frame::XModel>& xModel);
+
+ /** Set the Null Date of the UnitConverter */
+ void setNullDate ( const com::sun::star::util::Date& aTempNullDate ) { aNullDate = aTempNullDate; }
+
+ /** convert double to ISO Time String */
+ static void convertTime( ::rtl::OUStringBuffer& rBuffer,
+ const double& fTime);
+
+ /** convert util::DateTime to ISO Time String */
+ static void convertTime( ::rtl::OUStringBuffer& rBuffer,
+ const ::com::sun::star::util::DateTime& rDateTime );
+
+ /** convert ISO Time String to double */
+ static sal_Bool convertTime( double& fTime,
+ const ::rtl::OUString& rString);
+
+ /** convert ISO Time String to util::DateTime */
+ static sal_Bool convertTime( ::com::sun::star::util::DateTime& rDateTime,
+ const ::rtl::OUString& rString );
+
+ /** convert double to ISO Date Time String */
+ void convertDateTime( ::rtl::OUStringBuffer& rBuffer,
+ const double& fDateTime,
+ sal_Bool bAddTimeIf0AM=sal_False) { convertDateTime(rBuffer, fDateTime, aNullDate, bAddTimeIf0AM); }
+
+ /** convert ISO Date Time String to double */
+ sal_Bool convertDateTime( double& fDateTime,
+ const ::rtl::OUString& rString) { return convertDateTime(fDateTime, rString, aNullDate); }
+
+ /** convert double to ISO Date Time String */
+ static void convertDateTime( ::rtl::OUStringBuffer& rBuffer,
+ const double& fDateTime,
+ const com::sun::star::util::Date& aNullDate,
+ sal_Bool bAddTimeIf0AM=sal_False);
+ /** convert ISO Date Time String to double */
+ static sal_Bool convertDateTime( double& fDateTime,
+ const ::rtl::OUString& rString,
+ const com::sun::star::util::Date& aNullDate);
+
+ /** converts the given time value into an ISO-conform duration string
+
+ @param rTime
+ the time value to convert. This parameter is evaluated only down to the seconds - in particular,
+ "100th seconds" are ignored.
+ @param nSecondsFraction
+ Additional milleseconds to add to the time. Must be smaller than 1000.
+ This parameter is necessary since neither <type>Time</type> nor <type scope="com::sun::star::util">Time</type>
+ have a sufficient resolution to transport milliseconds.
+ @see http://www.w3.org/TR/xmlschema-2/#duration
+ */
+ static ::rtl::OUString convertTimeDuration( const ::Time& rTime, sal_Int32 nSecondsFraction = 0 );
+
+ /** converts the given ISO-conform duration string into a time value
+
+ @param rTime
+ the converted time value. Fractions of seconds of this object are not filled, even if present in
+ the string. See <arg>nSecondsFraction</arg>
+
+ @param pSecondsFraction
+ recieves fractions of whole seconds, in milliseconds. May be <NULL/>
+ This parameter is necessary since neither <type>Time</type> nor <type scope="com::sun::star::util">Time</type>
+ have a sufficient resolution to transport milliseconds.
+ @see http://www.w3.org/TR/xmlschema-2/#duration
+ */
+ static bool convertTimeDuration( const rtl::OUString& rString, ::Time& rTime, sal_Int32* pSecondsFraction = NULL );
+
+ /** convert string to ::basegfx::B3DVector */
+ static sal_Bool convertB3DVector( ::basegfx::B3DVector& rVector,
+ const ::rtl::OUString& rValue );
+
+ /** convert B3DVector to string */
+ static void convertB3DVector( ::rtl::OUStringBuffer &rBuffer,
+ const ::basegfx::B3DVector& rVector );
+
+ /** convert string to Position3D */
+ sal_Bool convertPosition3D( com::sun::star::drawing::Position3D& rPosition,
+ const ::rtl::OUString& rValue );
+
+ /** convert Position3D to string */
+ void convertPosition3D( ::rtl::OUStringBuffer &rBuffer,
+ const com::sun::star::drawing::Position3D& rVector );
+
+ /** convert util::DateTime to ISO Date String */
+ static void convertDateTime( ::rtl::OUStringBuffer& rBuffer,
+ const com::sun::star::util::DateTime& rDateTime,
+ sal_Bool bAddTimeIf0AM=sal_False );
+
+ /** convert ISO Date String to util::DateTime */
+ static sal_Bool convertDateTime( com::sun::star::util::DateTime& rDateTime,
+ const ::rtl::OUString& rString );
+
+ /** gets the position of the first comma after npos in the string
+ rStr. Commas inside '"' pairs are not matched */
+ static sal_Int32 indexOfComma( const ::rtl::OUString& rStr,
+ sal_Int32 nPos );
+
+ static void encodeBase64(rtl::OUStringBuffer& aStrBuffer, const com::sun::star::uno::Sequence<sal_Int8>& aPass);
+
+ // Decode a base 64 encoded string into a sequence of bytes. The first
+ // version can be used for attribute values only, bacause it does not
+ // return any chars left from conversion.
+ // For text submitted throgh the SAX characters call, the later method
+ // must be used!
+ static void decodeBase64(com::sun::star::uno::Sequence<sal_Int8>& aPass, const rtl::OUString& sBuffer);
+
+ static sal_Int32 decodeBase64SomeChars(com::sun::star::uno::Sequence<sal_Int8>& aPass, const rtl::OUString& sBuffer);
+
+ /** convert num-forat and num-letter-sync values to NumberingType */
+ sal_Bool convertNumFormat( sal_Int16& rType,
+ const ::rtl::OUString& rNumFormat,
+ const ::rtl::OUString& rNumLetterSync,
+ sal_Bool bNumberNone = sal_False ) const;
+
+ /** convert NumberingType to num-forat and num-letter-sync values */
+ void convertNumFormat( ::rtl::OUStringBuffer& rBuffer,
+ sal_Int16 nType ) const;
+ void convertNumLetterSync( ::rtl::OUStringBuffer& rBuffer,
+ sal_Int16 nType ) const;
+
+ static void convertPropertySet(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& rProps,
+ const com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>& aProperties);
+ static void convertPropertySet(com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>& rProperties,
+ const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps);
+
+ static void clearUndefinedChars(rtl::OUString& rTarget, const rtl::OUString& rSource);
+
+ ::rtl::OUString encodeStyleName( const ::rtl::OUString& rName,
+ sal_Bool *pEncoded=0 ) const;
+
+ /** convert an Any to string (typesafe) */
+ static sal_Bool convertAny( ::rtl::OUStringBuffer& sValue,
+ ::rtl::OUStringBuffer& sType ,
+ const com::sun::star::uno::Any& aValue);
+
+ /** convert a string to Any (typesafe) */
+ static sal_Bool convertAny( com::sun::star::uno::Any& aValue,
+ const ::rtl::OUString& sType ,
+ const ::rtl::OUString& sValue);
+};
+
+inline void SvXMLUnitConverter::setCoreMeasureUnit( MapUnit eCoreMeasureUnit )
+{
+ meCoreMeasureUnit = eCoreMeasureUnit;
+}
+
+inline MapUnit SvXMLUnitConverter::getCoreMeasureUnit() const
+{
+ return meCoreMeasureUnit;
+}
+
+inline void SvXMLUnitConverter::setXMLMeasureUnit( MapUnit eXMLMeasureUnit )
+{
+ meXMLMeasureUnit = eXMLMeasureUnit;
+}
+
+inline MapUnit SvXMLUnitConverter::getXMLMeasureUnit() const
+{
+ return meXMLMeasureUnit;
+}
+
+#endif // _XMLOFF_XMLUCONV_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmltabi.hxx b/xmloff/inc/xmltabi.hxx
new file mode 100644
index 000000000000..8114e801503b
--- /dev/null
+++ b/xmloff/inc/xmltabi.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLTABI_HXX
+#define _XMLOFF_XMLTABI_HXX
+
+#include "XMLElementPropertyContext.hxx"
+
+class SvxXMLTabStopArray_Impl;
+class SvXMLImport;
+
+namespace rtl
+{
+ class OUString;
+}
+
+class SvxXMLTabStopImportContext : public XMLElementPropertyContext
+{
+private:
+ SvxXMLTabStopArray_Impl* mpTabStops;
+
+public:
+ TYPEINFO();
+
+ SvxXMLTabStopImportContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const XMLPropertyState& rProp,
+ ::std::vector< XMLPropertyState > &rProps );
+
+ virtual ~SvxXMLTabStopImportContext();
+
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+ virtual void EndElement();
+};
+
+
+#endif // _XMLOFF_XMLTABI_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmlversion.hxx b/xmloff/inc/xmlversion.hxx
new file mode 100644
index 000000000000..880e468b5f28
--- /dev/null
+++ b/xmloff/inc/xmlversion.hxx
@@ -0,0 +1,158 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLVERSION_HXX
+#define _XMLOFF_XMLVERSION_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/document/XDocumentRevisionListPersistence.hpp>
+#include <com/sun/star/util/RevisionTag.hpp>
+#include <com/sun/star/embed/XStorage.hpp>
+
+#include <cppuhelper/implbase1.hxx>
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmlnmspe.hxx>
+#include <xmloff/xmltoken.hxx>
+
+// ------------------------------------------------------------------------
+class XMLVersionListExport : public SvXMLExport
+{
+private:
+ const com::sun::star::uno::Sequence < com::sun::star::util::RevisionTag >& maVersions;
+public:
+ XMLVersionListExport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
+ const com::sun::star::uno::Sequence < com::sun::star::util::RevisionTag >& rVersions,
+ const rtl::OUString &rFileName,
+ com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler > &rHandler );
+ virtual ~XMLVersionListExport() {}
+
+ sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum eClass );
+ void _ExportAutoStyles() {}
+ void _ExportMasterStyles () {}
+ void _ExportContent() {}
+};
+
+// ------------------------------------------------------------------------
+class XMLVersionListImport : public SvXMLImport
+{
+private:
+ com::sun::star::uno::Sequence < com::sun::star::util::RevisionTag >& maVersions;
+
+protected:
+
+ // This method is called after the namespace map has been updated, but
+ // before a context for the current element has been pushed.
+ virtual SvXMLImportContext *CreateContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+public:
+
+ // #110897#
+ XMLVersionListImport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
+ com::sun::star::uno::Sequence < com::sun::star::util::RevisionTag >& rVersions );
+ ~XMLVersionListImport() throw();
+
+ com::sun::star::uno::Sequence < com::sun::star::util::RevisionTag >&
+ GetList() { return maVersions; }
+};
+
+// ------------------------------------------------------------------------
+class XMLVersionListContext : public SvXMLImportContext
+{
+private:
+ XMLVersionListImport & rLocalRef;
+
+public:
+
+ XMLVersionListContext( XMLVersionListImport& rImport,
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+ ~XMLVersionListContext();
+
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+};
+
+// ------------------------------------------------------------------------
+class XMLVersionContext: public SvXMLImportContext
+{
+private:
+ XMLVersionListImport& rLocalRef;
+
+ static sal_Bool ParseISODateTimeString(
+ const rtl::OUString& rString,
+ com::sun::star::util::DateTime& rDateTime );
+
+public:
+
+ XMLVersionContext( XMLVersionListImport& rImport,
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+ ~XMLVersionContext();
+};
+
+
+// ------------------------------------------------------------------------
+class XMLVersionListPersistence : public ::cppu::WeakImplHelper1< ::com::sun::star::document::XDocumentRevisionListPersistence >
+{
+public:
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::util::RevisionTag > SAL_CALL load( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& Storage ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL store( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& Storage, const ::com::sun::star::uno::Sequence< ::com::sun::star::util::RevisionTag >& List ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+};
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ XMLVersionListPersistence_getSupportedServiceNames()
+ throw();
+
+::rtl::OUString SAL_CALL XMLVersionPersistence_getImplementationName()
+ throw();
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
+ XMLVersionListPersistence_createInstance(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > & )
+ throw( ::com::sun::star::uno::Exception );
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/prj/build.lst b/xmloff/prj/build.lst
new file mode 100644
index 000000000000..1a8261d7a37e
--- /dev/null
+++ b/xmloff/prj/build.lst
@@ -0,0 +1,2 @@
+xo xmloff : LIBXSLT:libxslt offapi svl NULL
+xo xmloff\prj nmake - all xo_prj NULL
diff --git a/xmloff/prj/d.lst b/xmloff/prj/d.lst
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/xmloff/prj/d.lst
diff --git a/xmloff/prj/makefile.mk b/xmloff/prj/makefile.mk
new file mode 100755
index 000000000000..e312a7ccab65
--- /dev/null
+++ b/xmloff/prj/makefile.mk
@@ -0,0 +1,40 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..
+TARGET=prj
+
+.INCLUDE : settings.mk
+
+.IF "$(VERBOSE)"!=""
+VERBOSEFLAG :=
+.ELSE
+VERBOSEFLAG := -s
+.ENDIF
+
+all:
+ cd $(PRJ) && $(GNUMAKE) $(VERBOSEFLAG) -r -j$(MAXPROCESS) $(gb_MAKETARGET) && $(GNUMAKE) $(VERBOSEFLAG) -r deliverlog
diff --git a/xmloff/qa/unoapi/knownissues.xcl b/xmloff/qa/unoapi/knownissues.xcl
new file mode 100755
index 000000000000..974280f032bd
--- /dev/null
+++ b/xmloff/qa/unoapi/knownissues.xcl
@@ -0,0 +1,25 @@
+### i23394 ###
+xmloff.Chart.XMLContentImporter::com::sun::star::xml::sax::XDocumentHandler
+xmloff.Chart.XMLImporter::com::sun::star::xml::sax::XDocumentHandler
+xmloff.Draw.XMLContentImporter::com::sun::star::xml::sax::XDocumentHandler
+xmloff.Draw.XMLImporter::com::sun::star::xml::sax::XDocumentHandler
+xmloff.Draw.XMLMetaImporter::com::sun::star::xml::sax::XDocumentHandler
+xmloff.Draw.XMLStylesImporter::com::sun::star::xml::sax::XDocumentHandler
+xmloff.Impress.XMLContentImporter::com::sun::star::xml::sax::XDocumentHandler
+xmloff.Impress.XMLImporter::com::sun::star::xml::sax::XDocumentHandler
+xmloff.Impress.XMLMetaImporter::com::sun::star::xml::sax::XDocumentHandler
+xmloff.Impress.XMLStylesImporter::com::sun::star::xml::sax::XDocumentHandler
+
+### i87695 ###
+xmloff.Draw.XMLStylesExporter
+xmloff.Impress.XMLStylesExporter
+#-> disabled in xmloff.sce
+
+### i112778 ###
+xmloff.Draw.XMLContentExporter::com::sun::star::document::XFilter
+xmloff.Draw.XMLMetaExporter::com::sun::star::document::XFilter
+xmloff.Impress.XMLMetaExporter::com::sun::star::document::XFilter
+
+### i114211 ###
+xmloff.Draw.XMLStylesImporter::com::sun::star::lang::XInitialization
+xmloff.Impress.XMLStylesImporter::com::sun::star::lang::XInitialization
diff --git a/xmloff/qa/unoapi/testdocuments/emptyChart.sds b/xmloff/qa/unoapi/testdocuments/emptyChart.sds
new file mode 100755
index 000000000000..853a44a12cf8
--- /dev/null
+++ b/xmloff/qa/unoapi/testdocuments/emptyChart.sds
Binary files differ
diff --git a/xmloff/qa/unoapi/xmloff.sce b/xmloff/qa/unoapi/xmloff.sce
new file mode 100755
index 000000000000..69166aec6204
--- /dev/null
+++ b/xmloff/qa/unoapi/xmloff.sce
@@ -0,0 +1,26 @@
+#111102# -o xmloff.Chart.XMLContentExporter
+#111102# -o xmloff.Chart.XMLContentImporter
+#111102# -o xmloff.Chart.XMLExporter
+#111102# -o xmloff.Chart.XMLImporter
+#111102# -o xmloff.Chart.XMLStylesExporter
+#111102# #i112047 -o xmloff.Chart.XMLStylesImporter
+-o xmloff.Draw.XMLContentExporter
+-o xmloff.Draw.XMLContentImporter
+-o xmloff.Draw.XMLExporter
+-o xmloff.Draw.XMLImporter
+-o xmloff.Draw.XMLMetaExporter
+#i111200 -o xmloff.Draw.XMLMetaImporter
+#i111287 -o xmloff.Draw.XMLSettingsExporter
+#i111287 -o xmloff.Draw.XMLSettingsImporter
+#i87695 -o xmloff.Draw.XMLStylesExporter
+-o xmloff.Draw.XMLStylesImporter
+#i111224 -o xmloff.Impress.XMLContentExporter
+-o xmloff.Impress.XMLContentImporter
+#i112048 -o xmloff.Impress.XMLExporter
+#i111111# -o xmloff.Impress.XMLImporter
+-o xmloff.Impress.XMLMetaExporter
+-o xmloff.Impress.XMLMetaImporter
+#i111287 -o xmloff.Impress.XMLSettingsExporter
+#i111287 -o xmloff.Impress.XMLSettingsImporter
+#i87695 -o xmloff.Impress.XMLStylesExporter
+-o xmloff.Impress.XMLStylesImporter
diff --git a/xmloff/source/chart/ColorPropertySet.cxx b/xmloff/source/chart/ColorPropertySet.cxx
new file mode 100644
index 000000000000..e4a8525f5a1f
--- /dev/null
+++ b/xmloff/source/chart/ColorPropertySet.cxx
@@ -0,0 +1,228 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "ColorPropertySet.hxx"
+
+#include <cppuhelper/implbase1.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::beans;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+using ::com::sun::star::uno::RuntimeException;
+
+// ================================================================================
+
+namespace
+{
+class lcl_ColorPropertySetInfo : public ::cppu::WeakImplHelper1<
+ XPropertySetInfo >
+{
+public:
+ lcl_ColorPropertySetInfo( bool bFillColor );
+
+protected:
+ // ____ XPropertySetInfo ____
+ virtual Sequence< Property > SAL_CALL getProperties() throw (RuntimeException);
+ virtual Property SAL_CALL getPropertyByName( const OUString& aName ) throw (UnknownPropertyException, RuntimeException);
+ virtual sal_Bool SAL_CALL hasPropertyByName( const OUString& Name ) throw (RuntimeException);
+
+private:
+ bool m_bIsFillColor;
+ OUString m_aColorPropName;
+ Property m_aColorProp;
+};
+
+lcl_ColorPropertySetInfo::lcl_ColorPropertySetInfo( bool bFillColor ) :
+ m_bIsFillColor( bFillColor ),
+ // note: length of FillColor and LineColor is 9
+ m_aColorPropName( (bFillColor ? "FillColor" : "LineColor"), 9, RTL_TEXTENCODING_ASCII_US ),
+ m_aColorProp( m_aColorPropName, -1,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)), 0)
+{}
+
+Sequence< Property > SAL_CALL lcl_ColorPropertySetInfo::getProperties()
+ throw (RuntimeException)
+{
+
+ return Sequence< Property >( & m_aColorProp, 1 );
+}
+
+Property SAL_CALL lcl_ColorPropertySetInfo::getPropertyByName( const OUString& aName )
+ throw (UnknownPropertyException, RuntimeException)
+{
+ if( aName.equals( m_aColorPropName ))
+ return m_aColorProp;
+ throw UnknownPropertyException( m_aColorPropName, static_cast< uno::XWeak * >( this ));
+}
+
+sal_Bool SAL_CALL lcl_ColorPropertySetInfo::hasPropertyByName( const OUString& Name )
+ throw (RuntimeException)
+{
+ return Name.equals( m_aColorPropName );
+}
+
+} // anonymous namespace
+
+// ================================================================================
+
+namespace xmloff
+{
+namespace chart
+{
+
+ColorPropertySet::ColorPropertySet( sal_Int32 nColor, bool bFillColor /* = true */ ) :
+ // note: length of FillColor and LineColor is 9
+ m_aColorPropName( (bFillColor ? "FillColor" : "LineColor"), 9, RTL_TEXTENCODING_ASCII_US ),
+ m_nColor( nColor ),
+ m_bIsFillColor( bFillColor ),
+ m_nDefaultColor( 0x0099ccff ) // blue 8
+{}
+
+ColorPropertySet::~ColorPropertySet()
+{}
+
+void ColorPropertySet::setColor( sal_Int32 nColor )
+{
+ m_nColor = nColor;
+}
+
+sal_Int32 ColorPropertySet::getColor()
+{
+ return m_nColor;
+}
+
+// ____ XPropertySet ____
+
+Reference< XPropertySetInfo > SAL_CALL ColorPropertySet::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ if( ! m_xInfo.is())
+ m_xInfo.set( new lcl_ColorPropertySetInfo( m_bIsFillColor ));
+
+ return m_xInfo;
+}
+
+void SAL_CALL ColorPropertySet::setPropertyValue( const OUString& /* aPropertyName */, const uno::Any& aValue )
+ throw (UnknownPropertyException,
+ PropertyVetoException,
+ lang::IllegalArgumentException,
+ lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ aValue >>= m_nColor;
+}
+
+uno::Any SAL_CALL ColorPropertySet::getPropertyValue( const OUString& /* PropertyName */ )
+ throw (UnknownPropertyException,
+ lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ return uno::makeAny( m_nColor );
+}
+
+void SAL_CALL ColorPropertySet::addPropertyChangeListener( const OUString& /* aPropertyName */, const Reference< XPropertyChangeListener >& /* xListener */ )
+ throw (UnknownPropertyException,
+ lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_FAIL( "Not Implemented" );
+ return;
+}
+
+void SAL_CALL ColorPropertySet::removePropertyChangeListener( const OUString& /* aPropertyName */, const Reference< XPropertyChangeListener >& /* aListener */ )
+ throw (UnknownPropertyException,
+ lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_FAIL( "Not Implemented" );
+ return;
+}
+
+void SAL_CALL ColorPropertySet::addVetoableChangeListener( const OUString& /* PropertyName */, const Reference< XVetoableChangeListener >& /* aListener */ )
+ throw (UnknownPropertyException,
+ lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_FAIL( "Not Implemented" );
+ return;
+}
+
+void SAL_CALL ColorPropertySet::removeVetoableChangeListener( const OUString& /* PropertyName */, const Reference< XVetoableChangeListener >& /* aListener */ )
+ throw (UnknownPropertyException,
+ lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_FAIL( "Not Implemented" );
+ return;
+}
+
+// ____ XPropertyState ____
+
+PropertyState SAL_CALL ColorPropertySet::getPropertyState( const OUString& /* PropertyName */ )
+ throw (UnknownPropertyException,
+ uno::RuntimeException)
+{
+ return PropertyState_DIRECT_VALUE;
+}
+
+Sequence< PropertyState > SAL_CALL ColorPropertySet::getPropertyStates( const Sequence< OUString >& /* aPropertyName */ )
+ throw (UnknownPropertyException,
+ uno::RuntimeException)
+{
+ PropertyState aState = PropertyState_DIRECT_VALUE;
+ return Sequence< PropertyState >( & aState, 1 );
+}
+
+void SAL_CALL ColorPropertySet::setPropertyToDefault( const OUString& PropertyName )
+ throw (UnknownPropertyException,
+ uno::RuntimeException)
+{
+ if( PropertyName.equals( m_aColorPropName ))
+ m_nColor = m_nDefaultColor;
+}
+
+uno::Any SAL_CALL ColorPropertySet::getPropertyDefault( const OUString& aPropertyName )
+ throw (UnknownPropertyException,
+ lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ if( aPropertyName.equals( m_aColorPropName ))
+ return uno::makeAny( m_nDefaultColor );
+ return uno::Any();
+}
+
+} // namespace chart
+} // namespace xmloff
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/ColorPropertySet.hxx b/xmloff/source/chart/ColorPropertySet.hxx
new file mode 100644
index 000000000000..003c6119817a
--- /dev/null
+++ b/xmloff/source/chart/ColorPropertySet.hxx
@@ -0,0 +1,129 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 XMLOFF_COLORPROPERTYSET_HXX
+#define XMLOFF_COLORPROPERTYSET_HXX
+
+#include <cppuhelper/implbase2.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+
+namespace xmloff
+{
+namespace chart
+{
+
+class ColorPropertySet : public ::cppu::WeakImplHelper2<
+ ::com::sun::star::beans::XPropertySet,
+ ::com::sun::star::beans::XPropertyState >
+{
+public:
+ // if bFillColor == false, the color is a LineColor
+ explicit ColorPropertySet( sal_Int32 nColor, bool bFillColor = true );
+ virtual ~ColorPropertySet();
+
+ void setColor( sal_Int32 nColor );
+ sal_Int32 getColor();
+
+protected:
+ // ____ XPropertySet ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue(
+ const ::rtl::OUString& aPropertyName,
+ const ::com::sun::star::uno::Any& aValue )
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
+ const ::rtl::OUString& PropertyName )
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener(
+ const ::rtl::OUString& aPropertyName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener )
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener(
+ const ::rtl::OUString& aPropertyName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener )
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener(
+ const ::rtl::OUString& PropertyName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener )
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener(
+ const ::rtl::OUString& PropertyName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener )
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // ____ XPropertyState ____
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState(
+ const ::rtl::OUString& PropertyName )
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates(
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName )
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault(
+ const ::rtl::OUString& PropertyName )
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault(
+ const ::rtl::OUString& aPropertyName )
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySetInfo > m_xInfo;
+ ::rtl::OUString m_aColorPropName;
+ sal_Int32 m_nColor;
+ bool m_bIsFillColor;
+ sal_Int32 m_nDefaultColor;
+};
+
+} // namespace chart
+} // namespace xmloff
+
+// XMLOFF_COLORPROPERTYSET_HXX
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/MultiPropertySetHandler.hxx b/xmloff/source/chart/MultiPropertySetHandler.hxx
new file mode 100644
index 000000000000..160b9f218807
--- /dev/null
+++ b/xmloff/source/chart/MultiPropertySetHandler.hxx
@@ -0,0 +1,288 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _MULTI_PROPERTY_SET_HANDLER_HXX
+#define _MULTI_PROPERTY_SET_HANDLER_HXX
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+
+
+/** @descr MultiPropertySetHandler handles the two slightly different
+ interfaces XPropertySet and XMultiPorpertySet for accessing
+ properties of an object.
+
+ It uses the classes PropertyWrapperBase and the template
+ PropertyWrapper for a type safe access to single properties.
+
+ The function class OUStringComparison is used by a STL map to
+ sort the properties by names.
+*/
+
+/** @descr Base class for the templated property wrappers.
+ Having a common base class allows to set a variable to the
+ property's value without explicit knowledge of its type.
+*/
+class PropertyWrapperBase
+{
+public:
+ /** @descr Create a class instance and store the given name.
+ @param rName The name of the property.
+ */
+ PropertyWrapperBase (const ::rtl::OUString & rName)
+ : msName (rName)
+ {}
+ virtual ~PropertyWrapperBase()
+ {}
+
+ /** @descr Abstract interface of a method for setting a variables
+ value to that of the property.
+ */
+ virtual void SetValue (const ::com::sun::star::uno::Any & rValue) = 0;
+
+ const ::rtl::OUString msName;
+};
+
+
+
+
+/** @descr For every property type there will be one instantiation of this
+ template class with its own and type specific version of SetValue.
+*/
+template<class T> class PropertyWrapper : public PropertyWrapperBase
+{
+public:
+ /** @descr Create a wrapper for a property of type T.
+ */
+ PropertyWrapper (const ::rtl::OUString & rName, T & rValue)
+ : PropertyWrapperBase (rName),
+ mrValue (rValue)
+ {}
+
+ /** descr Set the given value inside an Any to the variable referenced
+ by the data member.
+ */
+ virtual void SetValue (const ::com::sun::star::uno::Any & rValue)
+ {
+ rValue >>= mrValue;
+ }
+
+private:
+ /// Reference to a variable. Its value can be modified by a call to SetValue.
+ T & mrValue;
+};
+
+
+
+
+/** @descr Function object for comparing two OUStrings.
+*/
+class OUStringComparison
+{
+public:
+ /// Compare two strings. Returns true if the first is before the second.
+ inline bool operator() (const ::rtl::OUString & a, const ::rtl::OUString & b) const
+ {
+ return (a.compareTo (b) < 0);
+ }
+};
+
+
+
+
+/** @descr This class lets you get the values from an object that either
+ supports the interface XPropertySet or XMultiPropertySet. If it
+ supports both interfaces then XMultiPropertySet is preferred.
+
+ Using it works in three steps.
+ 1. Create an instance and pass a reference to the object from which to
+ get the property values.
+ 2. Make all properties whose values you want to get known to the object
+ by using the Add method. This creates instances of a template class
+ that stores the properties name and a reference to the variable in
+ which to store its value.
+ 3. Finally call GetProperties to store the properties values into the
+ variables specified in step 2. This uses either the XPropertySet or
+ (preferred) the XMultiPropertySet interface.
+*/
+class MultiPropertySetHandler
+{
+public:
+ /** @descr Create a handler of the property set of the given
+ object.
+ @param xObject A reference to any of the object's interfaces.
+ not neccessarily XPropertySet or XMultiPropertySet. It
+ is casted later to one of the two of them.
+ */
+ MultiPropertySetHandler (::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface> xObject);
+ ~MultiPropertySetHandler (void);
+ /** @descr Add a property to handle. The type given implicitely by the
+ reference to a variable is used to create an instance of
+ the PropertyWrapper template class.
+ @param sName Name of the property.
+ @param rValue Reference to a variable whose value is set by the
+ call to GetProperties to the property's value.
+ */
+ template<class T> void Add (const ::rtl::OUString & sName, T& rValue)
+ {
+ aPropertyList[sName] = new PropertyWrapper<T> (sName, rValue);
+ }
+
+ /** @descr Try to get the values for all properties added with the Add
+ method. If possible it uses the XMultiPropertySet. If that fails
+ (i.e. for an UnknownPropertyExcption) or if the interface is not
+ supported it uses the XPropertySet interface.
+ @return If none of the two interfaces is supported or using them both
+ fails then sal_False is returned. Else True is returned.
+ */
+ inline sal_Bool GetProperties (void);
+
+private:
+ /** @descr Try to use the XMultiPropertySet interface to get the property
+ values.
+ @param rNameList A precomputed and sorted sequence of OUStrings
+ containing the properties names.
+ @return True if values could be derived.
+ */
+ inline sal_Bool MultiGet (const ::com::sun::star::uno::Sequence<
+ ::rtl::OUString> & rNameList);
+
+ /** @descr Try to use the XPropertySet interface to get the property
+ values.
+ @param rNameList A precomputed and sorted sequence of OUStrings
+ containing the properties names.
+ @return True if values could be derived.
+ */
+ inline sal_Bool SingleGet (const ::com::sun::star::uno::Sequence<
+ ::rtl::OUString> & rNameList);
+
+ /** @descr STL map that maps from property names to polymorphic instances of
+ PropertyWrapper. It uses OUStringComparison for sorting
+ the property names.
+ */
+ ::std::map< ::rtl::OUString, PropertyWrapperBase*, OUStringComparison> aPropertyList;
+
+ /// The object from which to get the property values.
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> mxObject;
+};
+
+
+
+//===== Inline implementation of the methods declared above ==========================
+
+MultiPropertySetHandler::MultiPropertySetHandler (::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface> xObject)
+ : mxObject (xObject)
+{
+}
+
+
+
+
+MultiPropertySetHandler::~MultiPropertySetHandler (void)
+{
+ ::std::map< ::rtl::OUString, PropertyWrapperBase*, OUStringComparison>::iterator I;
+ for (I=aPropertyList.begin(); I!=aPropertyList.end(); I++)
+ delete I->second;
+}
+
+
+
+sal_Bool MultiPropertySetHandler::GetProperties (void)
+{
+ ::std::map< ::rtl::OUString, PropertyWrapperBase*, OUStringComparison>::iterator I;
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aNameList (aPropertyList.size());
+ int i;
+ for (I=aPropertyList.begin(),i=0; I!=aPropertyList.end(); I++)
+ aNameList[i++] = I->second->msName;
+ if ( ! MultiGet(aNameList))
+ if ( ! SingleGet(aNameList))
+ return sal_False;
+ return sal_True;
+}
+
+
+
+
+sal_Bool MultiPropertySetHandler::MultiGet (const ::com::sun::star::uno::Sequence<
+ ::rtl::OUString> & rNameList)
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet> xMultiSet (
+ mxObject, ::com::sun::star::uno::UNO_QUERY);
+ if (xMultiSet.is())
+ try
+ {
+ ::std::map< ::rtl::OUString, PropertyWrapperBase*, OUStringComparison>::iterator I;
+ int i;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any> aValueList =
+ xMultiSet->getPropertyValues (rNameList);
+ for (I=aPropertyList.begin(),i=0; I!=aPropertyList.end(); I++)
+ I->second->SetValue (aValueList[i++]);
+ }
+ catch (::com::sun::star::beans::UnknownPropertyException e)
+ {
+ return sal_False;
+ }
+ else
+ return sal_False;
+
+ return sal_True;
+}
+
+
+
+
+sal_Bool MultiPropertySetHandler::SingleGet (const ::com::sun::star::uno::Sequence<
+ ::rtl::OUString> & rNameList)
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xSingleSet (
+ mxObject, ::com::sun::star::uno::UNO_QUERY);
+ if (xSingleSet.is())
+ try
+ {
+ ::std::map< ::rtl::OUString, PropertyWrapperBase*, OUStringComparison>::iterator I;
+ int i;
+ for (I=aPropertyList.begin(),i=0; I!=aPropertyList.end(); I++)
+ I->second->SetValue (xSingleSet->getPropertyValue (rNameList[i++]));
+ }
+ catch (::com::sun::star::beans::UnknownPropertyException e)
+ {
+ return sal_False;
+ }
+ else
+ return sal_False;
+
+ return sal_True;
+}
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/PropertyMap.hxx b/xmloff/source/chart/PropertyMap.hxx
new file mode 100644
index 000000000000..d0aab8b962cc
--- /dev/null
+++ b/xmloff/source/chart/PropertyMap.hxx
@@ -0,0 +1,328 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _PROPERTYMAP_HXX_
+#define _PROPERTYMAP_HXX_
+
+#include <xmloff/maptype.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmltypes.hxx>
+#include <xmloff/contextid.hxx>
+#include <xmloff/xmlement.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/ErrorBarStyle.hpp>
+#include <com/sun/star/chart/ChartErrorIndicatorType.hpp>
+#include <com/sun/star/chart/ChartRegressionCurveType.hpp>
+#include <com/sun/star/chart/ChartSolidType.hpp>
+#include <com/sun/star/chart/ChartDataRowSource.hpp>
+#include <com/sun/star/chart/DataLabelPlacement.hpp>
+#include <com/sun/star/chart/MissingValueTreatment.hpp>
+
+// custom types
+#define XML_SCH_TYPE_AXIS_ARRANGEMENT ( XML_SCH_TYPES_START + 0 )
+#define XML_SCH_TYPE_ERROR_BAR_STYLE ( XML_SCH_TYPES_START + 1 )
+#define XML_SCH_TYPE_REGRESSION_TYPE ( XML_SCH_TYPES_START + 2 )
+#define XML_SCH_TYPE_SOLID_TYPE ( XML_SCH_TYPES_START + 3 )
+#define XML_SCH_TYPE_ERROR_INDICATOR_UPPER ( XML_SCH_TYPES_START + 4 )
+#define XML_SCH_TYPE_ERROR_INDICATOR_LOWER ( XML_SCH_TYPES_START + 5 )
+#define XML_SCH_TYPE_DATAROWSOURCE ( XML_SCH_TYPES_START + 6 )
+#define XML_SCH_TYPE_TEXT_ORIENTATION ( XML_SCH_TYPES_START + 7 )
+#define XML_SCH_TYPE_INTERPOLATION ( XML_SCH_TYPES_START + 8 )
+#define XML_SCH_TYPE_SYMBOL_TYPE ( XML_SCH_TYPES_START + 9 )
+#define XML_SCH_TYPE_NAMED_SYMBOL ( XML_SCH_TYPES_START + 10 )
+#define XML_SCH_TYPE_LABEL_PLACEMENT_TYPE ( XML_SCH_TYPES_START + 11 )
+#define XML_SCH_TYPE_MISSING_VALUE_TREATMENT ( XML_SCH_TYPES_START + 12 )
+#define XML_SCH_TYPE_AXIS_POSITION ( XML_SCH_TYPES_START + 13 )
+#define XML_SCH_TYPE_AXIS_POSITION_VALUE ( XML_SCH_TYPES_START + 14 )
+#define XML_SCH_TYPE_AXIS_LABEL_POSITION ( XML_SCH_TYPES_START + 15 )
+#define XML_SCH_TYPE_TICK_MARK_POSITION ( XML_SCH_TYPES_START + 16 )
+
+// context ids
+#define XML_SCH_CONTEXT_USER_SYMBOL ( XML_SCH_CTF_START + 0 )
+#define XML_SCH_CONTEXT_MIN ( XML_SCH_CTF_START + 1 )
+#define XML_SCH_CONTEXT_MAX ( XML_SCH_CTF_START + 2 )
+#define XML_SCH_CONTEXT_STEP_MAIN ( XML_SCH_CTF_START + 3 )
+#define XML_SCH_CONTEXT_STEP_HELP_COUNT ( XML_SCH_CTF_START + 4 )
+#define XML_SCH_CONTEXT_ORIGIN ( XML_SCH_CTF_START + 5 )
+#define XML_SCH_CONTEXT_LOGARITHMIC ( XML_SCH_CTF_START + 6 )
+#define XML_SCH_CONTEXT_STOCK_WITH_VOLUME ( XML_SCH_CTF_START + 7 )
+#define XML_SCH_CONTEXT_LINES_USED ( XML_SCH_CTF_START + 8 )
+
+#define XML_SCH_CONTEXT_SPECIAL_TICKS_MAJ_INNER ( XML_SCH_CTF_START + 10 )
+#define XML_SCH_CONTEXT_SPECIAL_TICKS_MAJ_OUTER ( XML_SCH_CTF_START + 11 )
+#define XML_SCH_CONTEXT_SPECIAL_TICKS_MIN_INNER ( XML_SCH_CTF_START + 12 )
+#define XML_SCH_CONTEXT_SPECIAL_TICKS_MIN_OUTER ( XML_SCH_CTF_START + 13 )
+#define XML_SCH_CONTEXT_SPECIAL_TEXT_ROTATION ( XML_SCH_CTF_START + 14 )
+#define XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_NUMBER ( XML_SCH_CTF_START + 15 )
+#define XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_TEXT ( XML_SCH_CTF_START + 16 )
+#define XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_SYMBOL ( XML_SCH_CTF_START + 17 )
+#define XML_SCH_CONTEXT_SPECIAL_NUMBER_FORMAT ( XML_SCH_CTF_START + 18 )
+#define XML_SCH_CONTEXT_SPECIAL_DATA_ROW_SOURCE ( XML_SCH_CTF_START + 19 )
+#define XML_SCH_CONTEXT_SPECIAL_SYMBOL_WIDTH ( XML_SCH_CTF_START + 20 )
+#define XML_SCH_CONTEXT_SPECIAL_SYMBOL_HEIGHT ( XML_SCH_CTF_START + 21 )
+#define XML_SCH_CONTEXT_SPECIAL_SYMBOL_IMAGE_NAME ( XML_SCH_CTF_START + 22 )
+#define XML_SCH_CONTEXT_SPECIAL_SYMBOL_IMAGE ( XML_SCH_CTF_START + 23 )
+#define XML_SCH_CONTEXT_SPECIAL_LABEL_SEPARATOR ( XML_SCH_CTF_START + 24 )
+
+#define MAP_FULL( ApiName, NameSpace, XMLTokenName, XMLType, ContextId, EarliestODFVersionForExport ) { ApiName, sizeof(ApiName)-1, XML_NAMESPACE_##NameSpace, xmloff::token::XMLTokenName, XMLType|XML_TYPE_PROP_CHART, ContextId, EarliestODFVersionForExport }
+#define MAP_ENTRY( a, ns, nm, t ) { a, sizeof(a)-1, XML_NAMESPACE_##ns, xmloff::token::nm, t|XML_TYPE_PROP_CHART, 0, SvtSaveOptions::ODFVER_010 }
+#define MAP_ENTRY_ODF12( a, ns, nm, t ) { a, sizeof(a)-1, XML_NAMESPACE_##ns, xmloff::token::nm, t|XML_TYPE_PROP_CHART, 0, SvtSaveOptions::ODFVER_012 }
+#define MAP_CONTEXT( a, ns, nm, t, c ) { a, sizeof(a)-1, XML_NAMESPACE_##ns, xmloff::token::nm, t|XML_TYPE_PROP_CHART, c, SvtSaveOptions::ODFVER_010 }
+#define MAP_SPECIAL( a, ns, nm, t, c ) { a, sizeof(a)-1, XML_NAMESPACE_##ns, xmloff::token::nm, t|XML_TYPE_PROP_CHART | MID_FLAG_SPECIAL_ITEM, c, SvtSaveOptions::ODFVER_010 }
+#define MAP_SPECIAL_ODF12( a, ns, nm, t, c ) { a, sizeof(a)-1, XML_NAMESPACE_##ns, xmloff::token::nm, t|XML_TYPE_PROP_CHART | MID_FLAG_SPECIAL_ITEM, c, SvtSaveOptions::ODFVER_012 }
+#define MAP_ENTRY_END { 0,0,0,xmloff::token::XML_TOKEN_INVALID,0,0,SvtSaveOptions::ODFVER_010 }
+
+// ---------------------------------------------------------
+// PropertyMap for Chart properties drawing- and
+// textproperties are added later using the chaining
+// mechanism
+// ---------------------------------------------------------
+
+// only create maps once!
+// this define is set in PropertyMaps.cxx
+
+#ifdef XML_SCH_CREATE_GLOBAL_MAPS
+
+const XMLPropertyMapEntry aXMLChartPropMap[] =
+{
+ // chart subtypes
+ MAP_ENTRY( "UpDown", CHART, XML_JAPANESE_CANDLE_STICK, XML_TYPE_BOOL ), // formerly XML_STOCK_UPDOWN_BARS
+ MAP_CONTEXT( "Volume", CHART, XML_STOCK_WITH_VOLUME, XML_TYPE_BOOL, XML_SCH_CONTEXT_STOCK_WITH_VOLUME ),
+ MAP_ENTRY( "Dim3D", CHART, XML_THREE_DIMENSIONAL, XML_TYPE_BOOL ),
+ MAP_ENTRY( "Deep", CHART, XML_DEEP, XML_TYPE_BOOL ),
+ MAP_ENTRY( "Lines", CHART, XML_LINES, XML_TYPE_BOOL ),
+ MAP_ENTRY( "Percent", CHART, XML_PERCENTAGE, XML_TYPE_BOOL ),
+ MAP_ENTRY( "SolidType", CHART, XML_SOLID_TYPE, XML_SCH_TYPE_SOLID_TYPE ),
+ MAP_ENTRY( "SplineType", CHART, XML_INTERPOLATION, XML_SCH_TYPE_INTERPOLATION ),
+ MAP_ENTRY( "Stacked", CHART, XML_STACKED, XML_TYPE_BOOL ),
+ // type: "none", "automatic", "named-symbol" or "image"
+ MAP_ENTRY( "SymbolType", CHART, XML_SYMBOL_TYPE, XML_SCH_TYPE_SYMBOL_TYPE | MID_FLAG_MULTI_PROPERTY ),
+ // if type=="named-symbol" => name of symbol (square, diamond, ...)
+ MAP_ENTRY( "SymbolType", CHART, XML_SYMBOL_NAME, XML_SCH_TYPE_NAMED_SYMBOL | MID_FLAG_MULTI_PROPERTY ),
+ // if type=="image" => an xlink:href element with a linked (package) URI
+ MAP_SPECIAL( "SymbolBitmapURL", CHART, XML_SYMBOL_IMAGE, XML_TYPE_STRING | MID_FLAG_ELEMENT_ITEM, XML_SCH_CONTEXT_SPECIAL_SYMBOL_IMAGE ),
+ MAP_SPECIAL( "SymbolSize", CHART, XML_SYMBOL_WIDTH, XML_TYPE_MEASURE | MID_FLAG_MERGE_PROPERTY, XML_SCH_CONTEXT_SPECIAL_SYMBOL_WIDTH ),
+ MAP_SPECIAL( "SymbolSize", CHART, XML_SYMBOL_HEIGHT, XML_TYPE_MEASURE | MID_FLAG_MERGE_PROPERTY, XML_SCH_CONTEXT_SPECIAL_SYMBOL_HEIGHT ),
+ MAP_ENTRY( "Vertical", CHART, XML_VERTICAL, XML_TYPE_BOOL ),
+ // #i32368# property should no longer be used as XML-property (in OASIS
+ // format), but is still ex-/imported for compatibility with the OOo file format
+ MAP_CONTEXT( "NumberOfLines", CHART, XML_LINES_USED, XML_TYPE_NUMBER, XML_SCH_CONTEXT_LINES_USED ),
+ MAP_ENTRY( "StackedBarsConnected", CHART, XML_CONNECT_BARS, XML_TYPE_BOOL ),
+
+ MAP_ENTRY_ODF12( "GroupBarsPerAxis", CHART, XML_GROUP_BARS_PER_AXIS, XML_TYPE_BOOL ),
+ MAP_ENTRY_ODF12( "IncludeHiddenCells", CHART, XML_INCLUDE_HIDDEN_CELLS, XML_TYPE_BOOL ),
+ MAP_ENTRY_ODF12( "AutomaticPosition", CHART, XML_AUTOMATIC_POSITION, XML_TYPE_BOOL ),
+ MAP_ENTRY_ODF12( "AutomaticSize", CHART, XML_AUTOMATIC_SIZE, XML_TYPE_BOOL ),
+ MAP_ENTRY_ODF12( "StartingAngle", CHART, XML_ANGLE_OFFSET, XML_TYPE_NUMBER ),
+ MAP_ENTRY_ODF12( "MissingValueTreatment", CHART, XML_TREAT_EMPTY_CELLS, XML_SCH_TYPE_MISSING_VALUE_TREATMENT ),
+ MAP_ENTRY( "ScaleText", CHART, XML_SCALE_TEXT, XML_TYPE_BOOL ),
+
+ // spline settings
+ MAP_ENTRY( "SplineOrder", CHART, XML_SPLINE_ORDER, XML_TYPE_NUMBER ),
+ MAP_ENTRY( "SplineResolution", CHART, XML_SPLINE_RESOLUTION, XML_TYPE_NUMBER ),
+
+ // plot-area properties
+ MAP_ENTRY( "DataRowSource", CHART, XML_SERIES_SOURCE, XML_SCH_TYPE_DATAROWSOURCE ),
+ MAP_ENTRY_ODF12( "SortByXValues", CHART, XML_SORT_BY_X_VALUES, XML_TYPE_BOOL ),
+ MAP_ENTRY_ODF12( "RightAngledAxes", CHART, XML_RIGHT_ANGLED_AXES, XML_TYPE_BOOL ),
+
+ // axis properties
+ MAP_ENTRY( "DisplayLabels", CHART, XML_DISPLAY_LABEL, XML_TYPE_BOOL ),
+ MAP_SPECIAL( "Marks", CHART, XML_TICK_MARKS_MAJOR_INNER, XML_TYPE_NUMBER | MID_FLAG_MERGE_PROPERTY, XML_SCH_CONTEXT_SPECIAL_TICKS_MAJ_INNER ), // convert one constant
+ MAP_SPECIAL( "Marks", CHART, XML_TICK_MARKS_MAJOR_OUTER, XML_TYPE_NUMBER | MID_FLAG_MERGE_PROPERTY, XML_SCH_CONTEXT_SPECIAL_TICKS_MAJ_OUTER ), // to two bools
+ MAP_SPECIAL( "HelpMarks", CHART, XML_TICK_MARKS_MINOR_INNER, XML_TYPE_NUMBER | MID_FLAG_MERGE_PROPERTY, XML_SCH_CONTEXT_SPECIAL_TICKS_MIN_INNER ), // see above
+ MAP_SPECIAL( "HelpMarks", CHART, XML_TICK_MARKS_MINOR_OUTER, XML_TYPE_NUMBER | MID_FLAG_MERGE_PROPERTY, XML_SCH_CONTEXT_SPECIAL_TICKS_MIN_OUTER ),
+ MAP_CONTEXT( "Logarithmic", CHART, XML_LOGARITHMIC, XML_TYPE_BOOL, XML_SCH_CONTEXT_LOGARITHMIC ),
+ MAP_CONTEXT( "Min", CHART, XML_MINIMUM, XML_TYPE_DOUBLE, XML_SCH_CONTEXT_MIN ),
+ MAP_CONTEXT( "Max", CHART, XML_MAXIMUM, XML_TYPE_DOUBLE, XML_SCH_CONTEXT_MAX ),
+ MAP_CONTEXT( "Origin", CHART, XML_ORIGIN, XML_TYPE_DOUBLE, XML_SCH_CONTEXT_ORIGIN ),
+ MAP_CONTEXT( "StepMain", CHART, XML_INTERVAL_MAJOR, XML_TYPE_DOUBLE, XML_SCH_CONTEXT_STEP_MAIN ),
+ MAP_CONTEXT( "StepHelpCount", CHART, XML_INTERVAL_MINOR_DIVISOR, XML_TYPE_NUMBER, XML_SCH_CONTEXT_STEP_HELP_COUNT ),
+ MAP_ENTRY( "GapWidth", CHART, XML_GAP_WIDTH, XML_TYPE_NUMBER ),
+ MAP_ENTRY( "Overlap", CHART, XML_OVERLAP, XML_TYPE_NUMBER ),
+ MAP_ENTRY( "TextCanOverlap", CHART, XML_TEXT_OVERLAP, XML_TYPE_BOOL ),
+ MAP_ENTRY_ODF12( "ReverseDirection", CHART, XML_REVERSE_DIRECTION, XML_TYPE_BOOL ),
+ MAP_ENTRY( "TextBreak", TEXT, XML_LINE_BREAK, XML_TYPE_BOOL ),
+ MAP_ENTRY( "ArrangeOrder", CHART, XML_LABEL_ARRANGEMENT, XML_SCH_TYPE_AXIS_ARRANGEMENT ),
+ MAP_SPECIAL( "NumberFormat", STYLE, XML_DATA_STYLE_NAME, XML_TYPE_NUMBER, XML_SCH_CONTEXT_SPECIAL_NUMBER_FORMAT ),
+ MAP_ENTRY( "LinkNumberFormatToSource", CHART, XML_LINK_DATA_STYLE_TO_SOURCE, XML_TYPE_BOOL ),
+ MAP_ENTRY( "Visible", CHART, XML_VISIBLE, XML_TYPE_BOOL ),
+
+ MAP_FULL( "CrossoverPosition", CHART, XML_AXIS_POSITION, XML_SCH_TYPE_AXIS_POSITION|MID_FLAG_MERGE_ATTRIBUTE|MID_FLAG_MULTI_PROPERTY, 0, SvtSaveOptions::ODFVER_012 ),
+ MAP_FULL( "CrossoverValue", CHART, XML_AXIS_POSITION, XML_SCH_TYPE_AXIS_POSITION_VALUE|MID_FLAG_MERGE_ATTRIBUTE|MID_FLAG_MULTI_PROPERTY, 0, SvtSaveOptions::ODFVER_012 ),
+ MAP_FULL( "LabelPosition", CHART, XML_AXIS_LABEL_POSITION, XML_SCH_TYPE_AXIS_LABEL_POSITION, 0, SvtSaveOptions::ODFVER_012 ),
+ MAP_FULL( "MarkPosition", CHART, XML_TICK_MARK_POSITION, XML_SCH_TYPE_TICK_MARK_POSITION, 0, SvtSaveOptions::ODFVER_012 ),
+
+ // statistical properties
+ MAP_ENTRY( "MeanValue", CHART, XML_MEAN_VALUE, XML_TYPE_BOOL ),
+ MAP_ENTRY( "ErrorMargin", CHART, XML_ERROR_MARGIN, XML_TYPE_DOUBLE ),
+ MAP_ENTRY( "ConstantErrorLow", CHART, XML_ERROR_LOWER_LIMIT, XML_TYPE_DOUBLE ),
+ MAP_ENTRY( "ConstantErrorHigh", CHART, XML_ERROR_UPPER_LIMIT, XML_TYPE_DOUBLE ),
+ MAP_ENTRY( "ErrorIndicator", CHART, XML_ERROR_UPPER_INDICATOR, XML_SCH_TYPE_ERROR_INDICATOR_UPPER | MID_FLAG_MERGE_PROPERTY ), // convert one constant
+ MAP_ENTRY( "ErrorIndicator", CHART, XML_ERROR_LOWER_INDICATOR, XML_SCH_TYPE_ERROR_INDICATOR_LOWER | MID_FLAG_MERGE_PROPERTY ), // to two bools
+ MAP_ENTRY( "ErrorBarStyle", CHART, XML_ERROR_CATEGORY, XML_SCH_TYPE_ERROR_BAR_STYLE ),
+ MAP_ENTRY( "PercentageError", CHART, XML_ERROR_PERCENTAGE, XML_TYPE_DOUBLE ),
+ MAP_ENTRY( "RegressionCurves", CHART, XML_REGRESSION_TYPE, XML_SCH_TYPE_REGRESSION_TYPE ),
+ MAP_ENTRY_ODF12( "ErrorBarRangePositive", CHART, XML_ERROR_UPPER_RANGE, XML_TYPE_STRING ),
+ MAP_ENTRY_ODF12( "ErrorBarRangeNegative", CHART, XML_ERROR_LOWER_RANGE, XML_TYPE_STRING ),
+
+ // series/data-point properties
+ MAP_SPECIAL( "DataCaption", CHART, XML_DATA_LABEL_NUMBER, XML_TYPE_NUMBER | MID_FLAG_MERGE_PROPERTY, XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_NUMBER ), // convert one constant
+ MAP_SPECIAL( "DataCaption", CHART, XML_DATA_LABEL_TEXT, XML_TYPE_NUMBER | MID_FLAG_MERGE_PROPERTY, XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_TEXT ), // to 'tristate' and two bools
+ MAP_SPECIAL( "DataCaption", CHART, XML_DATA_LABEL_SYMBOL, XML_TYPE_NUMBER | MID_FLAG_MERGE_PROPERTY, XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_SYMBOL ),
+ MAP_SPECIAL_ODF12( "LabelSeparator", CHART, XML_LABEL_SEPARATOR, XML_TYPE_STRING | MID_FLAG_ELEMENT_ITEM, XML_SCH_CONTEXT_SPECIAL_LABEL_SEPARATOR ),
+ MAP_ENTRY_ODF12( "LabelPlacement", CHART, XML_LABEL_POSITION, XML_SCH_TYPE_LABEL_PLACEMENT_TYPE ),
+ MAP_ENTRY( "SegmentOffset", CHART, XML_PIE_OFFSET, XML_TYPE_NUMBER ),
+ MAP_SPECIAL_ODF12( "PercentageNumberFormat", STYLE, XML_PERCENTAGE_DATA_STYLE_NAME, XML_TYPE_NUMBER, XML_SCH_CONTEXT_SPECIAL_NUMBER_FORMAT ),
+
+ // text properties for titles
+ MAP_SPECIAL( "TextRotation", STYLE, XML_ROTATION_ANGLE, XML_TYPE_NUMBER, XML_SCH_CONTEXT_SPECIAL_TEXT_ROTATION ), // convert 1/100th degrees to degrees
+ MAP_ENTRY( "StackedText", STYLE, XML_DIRECTION, XML_SCH_TYPE_TEXT_ORIENTATION ),
+
+ // for compatability to pre 6.0beta documents
+// MAP_SPECIAL( "SymbolBitmapURL", CHART, XML_SYMBOL_IMAGE_NAME, XML_TYPE_STRING, XML_SCH_CONTEXT_SPECIAL_SYMBOL_IMAGE_NAME ),
+
+ MAP_ENTRY( "ChartUserDefinedAttributes", TEXT, XML_XMLNS, XML_TYPE_ATTRIBUTE_CONTAINER | MID_FLAG_SPECIAL_ITEM ),
+
+ MAP_ENTRY_END
+};
+
+// ----------------------------------------
+// maps for enums to XML attributes
+// ----------------------------------------
+
+SvXMLEnumMapEntry aXMLChartAxisLabelPositionEnumMap[] =
+{
+ { ::xmloff::token::XML_NEAR_AXIS, ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS },
+ { ::xmloff::token::XML_NEAR_AXIS_OTHER_SIDE, ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS_OTHER_SIDE },
+ { ::xmloff::token::XML_OUTSIDE_START, ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START },
+ { ::xmloff::token::XML_OUTSIDE_END, ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END },
+ { ::xmloff::token::XML_OUTSIDE_MINIMUM, ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START },//#i114142#
+ { ::xmloff::token::XML_OUTSIDE_MAXIMUM, ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END },//#i114142#
+ { ::xmloff::token::XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXMLChartAxisMarkPositionEnumMap[] =
+{
+ { ::xmloff::token::XML_AT_LABELS, ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS },
+ { ::xmloff::token::XML_AT_AXIS, ::com::sun::star::chart::ChartAxisMarkPosition_AT_AXIS },
+ { ::xmloff::token::XML_AT_LABELS_AND_AXIS, ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS_AND_AXIS },
+ { ::xmloff::token::XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXMLChartAxisArrangementEnumMap[] =
+{
+ { ::xmloff::token::XML_SIDE_BY_SIDE, ::com::sun::star::chart::ChartAxisArrangeOrderType_SIDE_BY_SIDE },
+ { ::xmloff::token::XML_STAGGER_EVEN, ::com::sun::star::chart::ChartAxisArrangeOrderType_STAGGER_EVEN },
+ { ::xmloff::token::XML_STAGGER_ODD, ::com::sun::star::chart::ChartAxisArrangeOrderType_STAGGER_ODD },
+ { ::xmloff::token::XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXMLChartErrorBarStyleEnumMap[] =
+{
+ { ::xmloff::token::XML_NONE, ::com::sun::star::chart::ErrorBarStyle::NONE },
+ { ::xmloff::token::XML_VARIANCE, ::com::sun::star::chart::ErrorBarStyle::VARIANCE },
+ { ::xmloff::token::XML_STANDARD_DEVIATION, ::com::sun::star::chart::ErrorBarStyle::STANDARD_DEVIATION },
+ { ::xmloff::token::XML_CONSTANT, ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE },
+ { ::xmloff::token::XML_PERCENTAGE, ::com::sun::star::chart::ErrorBarStyle::RELATIVE },
+ { ::xmloff::token::XML_ERROR_MARGIN, ::com::sun::star::chart::ErrorBarStyle::ERROR_MARGIN },
+ { ::xmloff::token::XML_STANDARD_ERROR, ::com::sun::star::chart::ErrorBarStyle::STANDARD_ERROR },
+ { ::xmloff::token::XML_CELL_RANGE, ::com::sun::star::chart::ErrorBarStyle::FROM_DATA },
+ { ::xmloff::token::XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXMLChartRegressionCurveTypeEnumMap[] =
+{
+ { ::xmloff::token::XML_NONE, ::com::sun::star::chart::ChartRegressionCurveType_NONE },
+ { ::xmloff::token::XML_LINEAR, ::com::sun::star::chart::ChartRegressionCurveType_LINEAR },
+ { ::xmloff::token::XML_LOGARITHMIC, ::com::sun::star::chart::ChartRegressionCurveType_LOGARITHM },
+ { ::xmloff::token::XML_EXPONENTIAL, ::com::sun::star::chart::ChartRegressionCurveType_EXPONENTIAL },
+ { ::xmloff::token::XML_POLYNOMIAL, ::com::sun::star::chart::ChartRegressionCurveType_POLYNOMIAL },
+ { ::xmloff::token::XML_POWER, ::com::sun::star::chart::ChartRegressionCurveType_POWER },
+ { ::xmloff::token::XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXMLChartSolidTypeEnumMap[] =
+{
+ { ::xmloff::token::XML_CUBOID, ::com::sun::star::chart::ChartSolidType::RECTANGULAR_SOLID },
+ { ::xmloff::token::XML_CYLINDER, ::com::sun::star::chart::ChartSolidType::CYLINDER },
+ { ::xmloff::token::XML_CONE, ::com::sun::star::chart::ChartSolidType::CONE },
+ { ::xmloff::token::XML_PYRAMID, ::com::sun::star::chart::ChartSolidType::PYRAMID },
+ { ::xmloff::token::XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXMLChartDataRowSourceTypeEnumMap[] =
+{
+ { ::xmloff::token::XML_COLUMNS, ::com::sun::star::chart::ChartDataRowSource_COLUMNS },
+ { ::xmloff::token::XML_ROWS, ::com::sun::star::chart::ChartDataRowSource_ROWS },
+ { ::xmloff::token::XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXMLChartInterpolationTypeEnumMap[] =
+{
+ // this is neither an enum nor a constants group, but just a
+ // documented long property
+ { ::xmloff::token::XML_NONE, 0 },
+ { ::xmloff::token::XML_CUBIC_SPLINE, 1 },
+ { ::xmloff::token::XML_B_SPLINE, 2 },
+ { ::xmloff::token::XML_TOKEN_INVALID,0 }
+};
+
+SvXMLEnumMapEntry aXMLChartDataLabelPlacementEnumMap[] =
+{
+ { ::xmloff::token::XML_AVOID_OVERLAP, ::com::sun::star::chart::DataLabelPlacement::AVOID_OVERLAP },
+ { ::xmloff::token::XML_CENTER, ::com::sun::star::chart::DataLabelPlacement::CENTER },
+ { ::xmloff::token::XML_TOP, ::com::sun::star::chart::DataLabelPlacement::TOP },
+ { ::xmloff::token::XML_TOP_LEFT, ::com::sun::star::chart::DataLabelPlacement::TOP_LEFT },
+ { ::xmloff::token::XML_LEFT, ::com::sun::star::chart::DataLabelPlacement::LEFT },
+ { ::xmloff::token::XML_BOTTOM_LEFT, ::com::sun::star::chart::DataLabelPlacement::BOTTOM_LEFT },
+ { ::xmloff::token::XML_BOTTOM, ::com::sun::star::chart::DataLabelPlacement::BOTTOM },
+ { ::xmloff::token::XML_BOTTOM_RIGHT, ::com::sun::star::chart::DataLabelPlacement::BOTTOM_RIGHT },
+ { ::xmloff::token::XML_RIGHT, ::com::sun::star::chart::DataLabelPlacement::RIGHT },
+ { ::xmloff::token::XML_TOP_RIGHT, ::com::sun::star::chart::DataLabelPlacement::TOP_RIGHT },
+ { ::xmloff::token::XML_INSIDE, ::com::sun::star::chart::DataLabelPlacement::INSIDE },
+ { ::xmloff::token::XML_OUTSIDE, ::com::sun::star::chart::DataLabelPlacement::OUTSIDE },
+ { ::xmloff::token::XML_NEAR_ORIGIN, ::com::sun::star::chart::DataLabelPlacement::NEAR_ORIGIN },
+ { ::xmloff::token::XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXMLChartMissingValueTreatmentEnumMap[] =
+{
+ { ::xmloff::token::XML_LEAVE_GAP, ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP },
+ { ::xmloff::token::XML_USE_ZERO, ::com::sun::star::chart::MissingValueTreatment::USE_ZERO },
+ { ::xmloff::token::XML_IGNORE, ::com::sun::star::chart::MissingValueTreatment::CONTINUE },
+ { ::xmloff::token::XML_TOKEN_INVALID,0 },
+};
+
+#endif // XML_SCH_CREATE_GLOBAL_MAPS
+
+#endif // _PROPERTYMAP_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/PropertyMaps.cxx b/xmloff/source/chart/PropertyMaps.cxx
new file mode 100644
index 000000000000..6cb029d9b1bf
--- /dev/null
+++ b/xmloff/source/chart/PropertyMaps.cxx
@@ -0,0 +1,620 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+// include PropertyMap.hxx with this define
+// to create the maps
+#ifndef _PROPERTYMAP_HXX_
+#define XML_SCH_CREATE_GLOBAL_MAPS
+#include "PropertyMap.hxx"
+#undef XML_SCH_CREATE_GLOBAL_MAPS
+#endif
+
+#include "XMLChartPropertySetMapper.hxx"
+#include "SchXMLTools.hxx"
+#include <xmloff/EnumPropertyHdl.hxx>
+#include <xmloff/XMLConstantsPropertyHandler.hxx>
+#include <xmloff/attrlist.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/shapeimport.hxx>
+#include <xmloff/NamedBoolPropertyHdl.hxx>
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmltoken.hxx>
+#include "XMLErrorIndicatorPropertyHdl.hxx"
+#include "XMLErrorBarStylePropertyHdl.hxx"
+#include "XMLTextOrientationHdl.hxx"
+#include "XMLSymbolTypePropertyHdl.hxx"
+#include "XMLAxisPositionPropertyHdl.hxx"
+#include <com/sun/star/chart/ChartAxisMarks.hpp>
+#include <com/sun/star/chart/ChartDataCaption.hpp>
+#include <com/sun/star/chart/ChartSymbolType.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/drawing/LineJoint.hpp>
+#include <com/sun/star/chart/ChartDataRowSource.hpp>
+#include <com/sun/star/chart/ChartAxisPosition.hpp>
+
+// header for any2enum
+#include <comphelper/extract.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/math.hxx>
+
+#define SCH_XML_SETFLAG( status, flag ) (status)|= (flag)
+#define SCH_XML_UNSETFLAG( status, flag ) (status) = ((status) | (flag)) - (flag)
+
+using namespace com::sun::star;
+using namespace ::xmloff::token;
+
+// the following class implementations are in this file:
+//
+// * XMLChartPropHdlFactory
+// * XMLChartPropertySetMapper
+// * XMLChartExportPropertyMapper
+// * XMLChartImportPropertyMapper
+// * SchXMLStyleExport
+
+// ----------------------------------------
+
+XMLChartPropHdlFactory::~XMLChartPropHdlFactory()
+{
+}
+
+const XMLPropertyHandler* XMLChartPropHdlFactory::GetPropertyHandler( sal_Int32 nType ) const
+{
+ const XMLPropertyHandler* pHdl = XMLPropertyHandlerFactory::GetPropertyHandler( nType );
+ if( ! pHdl )
+ {
+ switch( nType )
+ {
+ case XML_SCH_TYPE_AXIS_POSITION:
+ pHdl = new XMLAxisPositionPropertyHdl( false );
+ break;
+ case XML_SCH_TYPE_AXIS_POSITION_VALUE:
+ pHdl = new XMLAxisPositionPropertyHdl( true );
+ break;
+
+ case XML_SCH_TYPE_AXIS_LABEL_POSITION:
+ pHdl = new XMLEnumPropertyHdl( aXMLChartAxisLabelPositionEnumMap,
+ ::getCppuType((const chart::ChartAxisLabelPosition*)0) );
+ break;
+
+ case XML_SCH_TYPE_TICK_MARK_POSITION:
+ pHdl = new XMLEnumPropertyHdl( aXMLChartAxisMarkPositionEnumMap,
+ ::getCppuType((const chart::ChartAxisMarkPosition*)0) );
+ break;
+
+ case XML_SCH_TYPE_AXIS_ARRANGEMENT:
+ pHdl = new XMLEnumPropertyHdl( aXMLChartAxisArrangementEnumMap,
+ ::getCppuType((const chart::ChartAxisArrangeOrderType*)0) );
+ break;
+
+ case XML_SCH_TYPE_ERROR_BAR_STYLE:
+ // here we have a constant rather than an enum
+ pHdl = new XMLErrorBarStylePropertyHdl( aXMLChartErrorBarStyleEnumMap,
+ ::getCppuType((const sal_Int32*)0) );
+ break;
+
+ case XML_SCH_TYPE_REGRESSION_TYPE:
+ pHdl = new XMLEnumPropertyHdl( aXMLChartRegressionCurveTypeEnumMap,
+ ::getCppuType((const chart::ChartRegressionCurveType*)0) );
+ break;
+
+ case XML_SCH_TYPE_ERROR_INDICATOR_LOWER:
+ pHdl = new XMLErrorIndicatorPropertyHdl( sal_False );
+ break;
+ case XML_SCH_TYPE_ERROR_INDICATOR_UPPER:
+ pHdl = new XMLErrorIndicatorPropertyHdl( sal_True );
+ break;
+
+ case XML_SCH_TYPE_SOLID_TYPE:
+ // here we have a constant rather than an enum
+ pHdl = new XMLEnumPropertyHdl( aXMLChartSolidTypeEnumMap,
+ ::getCppuType((const sal_Int32*)0) );
+ break;
+ case XML_SCH_TYPE_LABEL_PLACEMENT_TYPE:
+ // here we have a constant rather than an enum
+ pHdl = new XMLEnumPropertyHdl( aXMLChartDataLabelPlacementEnumMap,
+ ::getCppuType((const sal_Int32*)0) );
+ break;
+ case XML_SCH_TYPE_DATAROWSOURCE:
+ pHdl = new XMLEnumPropertyHdl( aXMLChartDataRowSourceTypeEnumMap,
+ ::getCppuType((const chart::ChartDataRowSource*)0) );
+ break;
+ case XML_SCH_TYPE_TEXT_ORIENTATION:
+ pHdl = new XMLTextOrientationHdl();
+ break;
+
+ case XML_SCH_TYPE_INTERPOLATION:
+ pHdl = new XMLEnumPropertyHdl( aXMLChartInterpolationTypeEnumMap,
+ ::getCppuType((const sal_Int32*)0) );
+ break;
+ case XML_SCH_TYPE_SYMBOL_TYPE:
+ pHdl = new XMLSymbolTypePropertyHdl( false );
+ break;
+
+ case XML_SCH_TYPE_NAMED_SYMBOL:
+ pHdl = new XMLSymbolTypePropertyHdl( true );
+ break;
+
+ case XML_SCH_TYPE_MISSING_VALUE_TREATMENT:
+ pHdl = new XMLEnumPropertyHdl( aXMLChartMissingValueTreatmentEnumMap,
+ ::getCppuType((const sal_Int32*)0) );
+ break;
+ }
+ if( pHdl )
+ PutHdlCache( nType, pHdl );
+ }
+
+ return pHdl;
+}
+
+// ----------------------------------------
+
+XMLChartPropertySetMapper::XMLChartPropertySetMapper() :
+ XMLPropertySetMapper( aXMLChartPropMap, new XMLChartPropHdlFactory )
+{
+}
+
+XMLChartPropertySetMapper::~XMLChartPropertySetMapper()
+{
+}
+
+// ----------------------------------------
+
+XMLChartExportPropertyMapper::XMLChartExportPropertyMapper( const UniReference< XMLPropertySetMapper >& rMapper,
+ SvXMLExport& rExport) :
+ SvXMLExportPropertyMapper( rMapper ),
+ msTrue( GetXMLToken( XML_TRUE )),
+ msFalse( GetXMLToken( XML_FALSE )),
+ mrExport( rExport )
+{
+ // chain draw properties
+ ChainExportMapper( XMLShapeExport::CreateShapePropMapper( rExport ));
+
+ // chain text properties
+ ChainExportMapper( XMLTextParagraphExport::CreateParaExtPropMapper( rExport ));
+}
+
+XMLChartExportPropertyMapper::~XMLChartExportPropertyMapper()
+{
+}
+
+void XMLChartExportPropertyMapper::ContextFilter(
+ std::vector< XMLPropertyState >& rProperties,
+ uno::Reference< beans::XPropertySet > rPropSet ) const
+{
+ ::rtl::OUString aAutoPropName;
+ sal_Bool bCheckAuto = sal_False;
+
+ // filter properties
+ for( std::vector< XMLPropertyState >::iterator property = rProperties.begin();
+ property != rProperties.end();
+ ++property )
+ {
+ // find properties with context
+ // to prevent writing this property set mnIndex member to -1
+ switch( getPropertySetMapper()->GetEntryContextId( property->mnIndex ))
+ {
+ // if Auto... is set the corresponding properties mustn't be exported
+ case XML_SCH_CONTEXT_MIN:
+ bCheckAuto = sal_True;
+ aAutoPropName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "AutoMin" ));
+ break;
+ case XML_SCH_CONTEXT_MAX:
+ bCheckAuto = sal_True;
+ aAutoPropName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "AutoMax" ));
+ break;
+ case XML_SCH_CONTEXT_STEP_MAIN:
+ bCheckAuto = sal_True;
+ aAutoPropName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "AutoStepMain" ));
+ break;
+ case XML_SCH_CONTEXT_STEP_HELP_COUNT:
+ bCheckAuto = sal_True;
+ aAutoPropName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "AutoStepHelp" ));
+ break;
+
+ case XML_SCH_CONTEXT_ORIGIN:
+ bCheckAuto = sal_True;
+ aAutoPropName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "AutoOrigin" ));
+ break;
+
+ // the following property is deprecated
+ // elemet-item symbol-image is used now
+ case XML_SCH_CONTEXT_SPECIAL_SYMBOL_IMAGE_NAME:
+ property->mnIndex = -1;
+ break;
+
+ case XML_SCH_CONTEXT_STOCK_WITH_VOLUME:
+ case XML_SCH_CONTEXT_LINES_USED:
+ // note this avoids export of the properties in OASIS format,
+ // but also for the OOo XML Flat format (used by binfilter),
+ // because there, the transformation to OOo is done after the
+ // complete export of the chart in OASIS format.
+ if( mrExport.getExportFlags() & EXPORT_OASIS )
+ property->mnIndex = -1;
+ break;
+ }
+
+ if( bCheckAuto )
+ {
+ if( rPropSet.is())
+ {
+ try
+ {
+ sal_Bool bAuto = false;
+ uno::Any aAny = rPropSet->getPropertyValue( aAutoPropName );
+ aAny >>= bAuto;
+ if( bAuto )
+ property->mnIndex = -1;
+ }
+ catch( beans::UnknownPropertyException )
+ {
+ }
+ }
+ bCheckAuto = sal_False;
+ }
+ }
+
+ SvXMLExportPropertyMapper::ContextFilter(rProperties, rPropSet);
+}
+
+void XMLChartExportPropertyMapper::handleElementItem(
+ SvXMLExport& rExport,
+ const XMLPropertyState& rProperty, sal_uInt16 nFlags,
+ const ::std::vector< XMLPropertyState > *pProperties,
+ sal_uInt32 nIdx ) const
+{
+ switch( getPropertySetMapper()->GetEntryContextId( rProperty.mnIndex ))
+ {
+ case XML_SCH_CONTEXT_SPECIAL_SYMBOL_IMAGE:
+ {
+ ::rtl::OUString aURLStr;
+ rProperty.maValue >>= aURLStr;
+
+ // export as XLink reference into the package
+ // if embedding is off
+ ::rtl::OUString sTempURL( mrExport.AddEmbeddedGraphicObject( aURLStr ));
+ if( sTempURL.getLength() )
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, sTempURL );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE,
+ XML_SIMPLE );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE,
+ XML_ONLOAD );
+ }
+
+ {
+ sal_uInt32 nPropIndex = rProperty.mnIndex;
+ // this is the element that has to live until the next statement
+ SvXMLElementExport aElem( mrExport,
+ getPropertySetMapper()->GetEntryNameSpace( nPropIndex ),
+ getPropertySetMapper()->GetEntryXMLName( nPropIndex ),
+ sal_True, sal_True );
+
+ // export as Base64 embedded graphic
+ // if embedding is on
+ if( aURLStr.getLength())
+ mrExport.AddEmbeddedGraphicObjectAsBase64( aURLStr );
+ }
+ }
+ break;
+
+ case XML_SCH_CONTEXT_SPECIAL_LABEL_SEPARATOR:
+ {
+ ::rtl::OUString aSeparator;
+ rProperty.maValue >>= aSeparator;
+
+ if( aSeparator.getLength() )
+ {
+ sal_uInt32 nPropIndex = rProperty.mnIndex;
+ SvXMLElementExport aElem( mrExport,
+ getPropertySetMapper()->GetEntryNameSpace( nPropIndex ),
+ getPropertySetMapper()->GetEntryXMLName( nPropIndex ),
+ sal_True, sal_True );
+
+ SchXMLTools::exportText( mrExport, aSeparator, true );
+ }
+ }
+ break;
+
+ default:
+ // call parent
+ SvXMLExportPropertyMapper::handleElementItem( rExport, rProperty,
+ nFlags, pProperties, nIdx );
+ break;
+ }
+}
+
+void XMLChartExportPropertyMapper::handleSpecialItem(
+ SvXMLAttributeList& rAttrList, const XMLPropertyState& rProperty,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ const ::std::vector< XMLPropertyState > *pProperties,
+ sal_uInt32 nIdx ) const
+{
+ sal_Bool bHandled = sal_False;
+
+ sal_Int32 nContextId = maPropMapper->GetEntryContextId( rProperty.mnIndex );
+
+ if( nContextId )
+ {
+ bHandled = sal_True;
+
+ rtl::OUString sAttrName = maPropMapper->GetEntryXMLName( rProperty.mnIndex );
+ sal_uInt16 nNameSpace = maPropMapper->GetEntryNameSpace( rProperty.mnIndex );
+ rtl::OUStringBuffer sValueBuffer;
+ rtl::OUString sValue;
+
+ sal_Int32 nValue = 0;
+ sal_Bool bValue = sal_False;
+
+ switch( nContextId )
+ {
+ case XML_SCH_CONTEXT_SPECIAL_TICKS_MAJ_INNER:
+ case XML_SCH_CONTEXT_SPECIAL_TICKS_MIN_INNER:
+ rProperty.maValue >>= nValue;
+ bValue = (( nValue & chart::ChartAxisMarks::INNER ) == chart::ChartAxisMarks::INNER );
+ SvXMLUnitConverter::convertBool( sValueBuffer, bValue );
+ break;
+ case XML_SCH_CONTEXT_SPECIAL_TICKS_MAJ_OUTER:
+ case XML_SCH_CONTEXT_SPECIAL_TICKS_MIN_OUTER:
+ rProperty.maValue >>= nValue;
+ bValue = (( nValue & chart::ChartAxisMarks::OUTER ) == chart::ChartAxisMarks::OUTER );
+ SvXMLUnitConverter::convertBool( sValueBuffer, bValue );
+ break;
+ case XML_SCH_CONTEXT_SPECIAL_TEXT_ROTATION:
+ {
+ // convert from 100th degrees to degrees (double)
+ rProperty.maValue >>= nValue;
+ double fVal = (double)(nValue) / 100.0;
+ SvXMLUnitConverter::convertDouble( sValueBuffer, fVal );
+ }
+ break;
+ case XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_NUMBER:
+ {
+ rProperty.maValue >>= nValue;
+ if((( nValue & chart::ChartDataCaption::VALUE ) == chart::ChartDataCaption::VALUE ))
+ {
+ if( ( nValue & chart::ChartDataCaption::PERCENT ) == chart::ChartDataCaption::PERCENT )
+ {
+ const SvtSaveOptions::ODFDefaultVersion nCurrentVersion( SvtSaveOptions().GetODFDefaultVersion() );
+ if( nCurrentVersion < SvtSaveOptions::ODFVER_012 )
+ sValueBuffer.append( GetXMLToken( XML_PERCENTAGE ));
+ else
+ sValueBuffer.append( GetXMLToken( XML_VALUE_AND_PERCENTAGE ));
+ }
+ else
+ sValueBuffer.append( GetXMLToken( XML_VALUE ));
+ }
+ else if(( nValue & chart::ChartDataCaption::PERCENT ) == chart::ChartDataCaption::PERCENT )
+ sValueBuffer.append( GetXMLToken( XML_PERCENTAGE ));
+ else
+ sValueBuffer.append( GetXMLToken( XML_NONE ));
+ }
+ break;
+ case XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_TEXT:
+ rProperty.maValue >>= nValue;
+ bValue = (( nValue & chart::ChartDataCaption::TEXT ) == chart::ChartDataCaption::TEXT );
+ SvXMLUnitConverter::convertBool( sValueBuffer, bValue );
+ break;
+ case XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_SYMBOL:
+ rProperty.maValue >>= nValue;
+ bValue = (( nValue & chart::ChartDataCaption::SYMBOL ) == chart::ChartDataCaption::SYMBOL );
+ SvXMLUnitConverter::convertBool( sValueBuffer, bValue );
+ break;
+
+ case XML_SCH_CONTEXT_SPECIAL_SYMBOL_WIDTH:
+ case XML_SCH_CONTEXT_SPECIAL_SYMBOL_HEIGHT:
+ {
+ awt::Size aSize;
+ rProperty.maValue >>= aSize;
+ rUnitConverter.convertMeasure( sValueBuffer,
+ nContextId == XML_SCH_CONTEXT_SPECIAL_SYMBOL_WIDTH
+ ? aSize.Width
+ : aSize.Height );
+ }
+ break;
+
+ case XML_SCH_CONTEXT_SPECIAL_NUMBER_FORMAT:
+ {
+ // just for import
+ break;
+ }
+
+ default:
+ bHandled = sal_False;
+ break;
+ }
+
+ if( sValueBuffer.getLength())
+ {
+ sValue = sValueBuffer.makeStringAndClear();
+ sAttrName = rNamespaceMap.GetQNameByKey( nNameSpace, sAttrName );
+ rAttrList.AddAttribute( sAttrName, sValue );
+ }
+ }
+
+ if( !bHandled )
+ {
+ // call parent
+ SvXMLExportPropertyMapper::handleSpecialItem( rAttrList, rProperty, rUnitConverter, rNamespaceMap, pProperties, nIdx );
+ }
+}
+
+// ----------------------------------------
+
+XMLChartImportPropertyMapper::XMLChartImportPropertyMapper( const UniReference< XMLPropertySetMapper >& rMapper,
+ const SvXMLImport& _rImport ) :
+ SvXMLImportPropertyMapper( rMapper, const_cast< SvXMLImport & >( _rImport )),
+ mrImport( const_cast< SvXMLImport & > ( _rImport ))
+{
+ // chain shape mapper for drawing properties
+
+ // give an empty model. It is only used for numbering rules that don't exist in chart
+ uno::Reference< frame::XModel > xEmptyModel;
+ ChainImportMapper( XMLShapeImportHelper::CreateShapePropMapper( xEmptyModel, mrImport ));
+
+ //#i14365# save and load writing-mode for chart elements
+ //The property TextWritingMode is mapped wrongly in the underlying draw mapper, but for draw it is necessary
+ //We remove that property here only for chart thus the chart can use the correct mapping from the writer paragraph settings (attribute 'writing-mode' <-> property 'WritingMode')
+ sal_Int32 nUnwantedWrongEntry = maPropMapper->FindEntryIndex( "TextWritingMode", XML_NAMESPACE_STYLE, GetXMLToken(XML_WRITING_MODE) );
+ maPropMapper->RemoveEntry(nUnwantedWrongEntry);
+
+ // do not chain text properties: on import this is done by shape mapper
+ // to import old documents
+}
+
+XMLChartImportPropertyMapper::~XMLChartImportPropertyMapper()
+{
+}
+
+bool XMLChartImportPropertyMapper::handleSpecialItem(
+ XMLPropertyState& rProperty,
+ ::std::vector< XMLPropertyState >& rProperties,
+ const ::rtl::OUString& rValue,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap ) const
+{
+ static const ::rtl::OUString sPackageProtocol( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package:" ) );
+ sal_Int32 nContextId = maPropMapper->GetEntryContextId( rProperty.mnIndex );
+ sal_Bool bRet = (nContextId != 0);
+
+ if( nContextId )
+ {
+ sal_Int32 nValue = 0;
+ bool bValue = false;
+
+ switch( nContextId )
+ {
+ case XML_SCH_CONTEXT_SPECIAL_TICKS_MAJ_INNER:
+ case XML_SCH_CONTEXT_SPECIAL_TICKS_MIN_INNER:
+ SvXMLUnitConverter::convertBool( bValue, rValue );
+ // modify old value
+ rProperty.maValue >>= nValue;
+ if( bValue )
+ SCH_XML_SETFLAG( nValue, chart::ChartAxisMarks::INNER );
+ else
+ SCH_XML_UNSETFLAG( nValue, chart::ChartAxisMarks::INNER );
+ rProperty.maValue <<= nValue;
+ break;
+ case XML_SCH_CONTEXT_SPECIAL_TICKS_MAJ_OUTER:
+ case XML_SCH_CONTEXT_SPECIAL_TICKS_MIN_OUTER:
+ SvXMLUnitConverter::convertBool( bValue, rValue );
+ // modify old value
+ rProperty.maValue >>= nValue;
+ if( bValue )
+ SCH_XML_SETFLAG( nValue, chart::ChartAxisMarks::OUTER );
+ else
+ SCH_XML_UNSETFLAG( nValue, chart::ChartAxisMarks::OUTER );
+ rProperty.maValue <<= nValue;
+ break;
+ case XML_SCH_CONTEXT_SPECIAL_TEXT_ROTATION:
+ {
+ // convert from degrees (double) to 100th degrees (integer)
+ double fVal;
+ SvXMLUnitConverter::convertDouble( fVal, rValue );
+ nValue = (sal_Int32)( fVal * 100.0 );
+ rProperty.maValue <<= nValue;
+ }
+ break;
+ case XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_NUMBER:
+ {
+ // modify old value
+ rProperty.maValue >>= nValue;
+ if( IsXMLToken( rValue, XML_NONE ))
+ SCH_XML_UNSETFLAG( nValue, chart::ChartDataCaption::VALUE | chart::ChartDataCaption::PERCENT );
+ else if( IsXMLToken( rValue, XML_VALUE_AND_PERCENTAGE ) )
+ SCH_XML_SETFLAG( nValue, chart::ChartDataCaption::VALUE | chart::ChartDataCaption::PERCENT );
+ else if( IsXMLToken( rValue, XML_VALUE ) )
+ SCH_XML_SETFLAG( nValue, chart::ChartDataCaption::VALUE );
+ else // must be XML_PERCENTAGE
+ SCH_XML_SETFLAG( nValue, chart::ChartDataCaption::PERCENT );
+ rProperty.maValue <<= nValue;
+ }
+ break;
+ case XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_TEXT:
+ rProperty.maValue >>= nValue;
+ SvXMLUnitConverter::convertBool( bValue, rValue );
+ if( bValue )
+ SCH_XML_SETFLAG( nValue, chart::ChartDataCaption::TEXT );
+ else
+ SCH_XML_UNSETFLAG( nValue, chart::ChartDataCaption::TEXT );
+ rProperty.maValue <<= nValue;
+ break;
+ case XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_SYMBOL:
+ rProperty.maValue >>= nValue;
+ SvXMLUnitConverter::convertBool( bValue, rValue );
+ if( bValue )
+ SCH_XML_SETFLAG( nValue, chart::ChartDataCaption::SYMBOL );
+ else
+ SCH_XML_UNSETFLAG( nValue, chart::ChartDataCaption::SYMBOL );
+ rProperty.maValue <<= nValue;
+ break;
+ case XML_SCH_CONTEXT_SPECIAL_SYMBOL_WIDTH:
+ case XML_SCH_CONTEXT_SPECIAL_SYMBOL_HEIGHT:
+ {
+ awt::Size aSize;
+ rProperty.maValue >>= aSize;
+ rUnitConverter.convertMeasure( nContextId == XML_SCH_CONTEXT_SPECIAL_SYMBOL_WIDTH
+ ? aSize.Width
+ : aSize.Height,
+ rValue );
+ rProperty.maValue <<= aSize;
+ }
+ break;
+
+ // deprecated from 6.0 beta on
+ case XML_SCH_CONTEXT_SPECIAL_SYMBOL_IMAGE_NAME:
+ rProperty.maValue <<= mrImport.ResolveGraphicObjectURL( rValue, sal_False );
+ break;
+
+ default:
+ bRet = sal_False;
+ break;
+ }
+ }
+
+
+ // if we didn't handle it, the parent should
+ if( !bRet )
+ {
+ // call parent
+ bRet = SvXMLImportPropertyMapper::handleSpecialItem( rProperty, rProperties, rValue, rUnitConverter, rNamespaceMap );
+ }
+
+ return bRet;
+}
+
+void XMLChartImportPropertyMapper::finished( ::std::vector< XMLPropertyState >& /*rProperties*/, sal_Int32 /*nStartIndex*/, sal_Int32 /*nEndIndex*/ ) const
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/SchXMLAutoStylePoolP.cxx b/xmloff/source/chart/SchXMLAutoStylePoolP.cxx
new file mode 100644
index 000000000000..9f6f10a8886b
--- /dev/null
+++ b/xmloff/source/chart/SchXMLAutoStylePoolP.cxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "SchXMLAutoStylePoolP.hxx"
+#include "PropertyMap.hxx"
+#include "SchXMLExport.hxx"
+#include "XMLChartPropertySetMapper.hxx"
+#include <xmloff/families.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmltoken.hxx>
+
+using ::xmloff::token::GetXMLToken;
+using ::xmloff::token::XML_CDATA;
+
+SchXMLAutoStylePoolP::SchXMLAutoStylePoolP( SchXMLExport& rSchXMLExport ) :
+ SvXMLAutoStylePoolP( rSchXMLExport ),
+ mrSchXMLExport( rSchXMLExport )
+{}
+
+SchXMLAutoStylePoolP::~SchXMLAutoStylePoolP()
+{}
+
+void SchXMLAutoStylePoolP::exportStyleAttributes(
+ SvXMLAttributeList& rAttrList,
+ sal_Int32 nFamily,
+ const ::std::vector< XMLPropertyState >& rProperties,
+ const SvXMLExportPropertyMapper& rPropExp
+ , const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap
+ ) const
+{
+ const rtl::OUString sCDATA( GetXMLToken( XML_CDATA ));
+ SvXMLAutoStylePoolP::exportStyleAttributes( rAttrList, nFamily, rProperties,
+ rPropExp, rUnitConverter, rNamespaceMap );
+
+ if( nFamily == XML_STYLE_FAMILY_SCH_CHART_ID )
+ {
+ for( ::std::vector< XMLPropertyState >::const_iterator iter = rProperties.begin();
+ (iter != rProperties.end()); iter++ )
+ {
+ if( iter->mnIndex == -1 )
+ continue;
+
+ UniReference< XMLPropertySetMapper > aPropMapper =
+ mrSchXMLExport.GetPropertySetMapper();
+ sal_Int16 nContextID = aPropMapper->GetEntryContextId( iter->mnIndex );
+ if( nContextID == XML_SCH_CONTEXT_SPECIAL_NUMBER_FORMAT )
+ {
+ sal_Int32 nNumberFormat = -1;
+ if( ( iter->maValue >>= nNumberFormat ) &&
+ ( nNumberFormat != -1 ))
+ {
+ rtl::OUString sAttrValue = mrSchXMLExport.getDataStyleName( nNumberFormat );
+ if( sAttrValue.getLength() )
+ {
+ mrSchXMLExport.AddAttribute(
+ aPropMapper->GetEntryNameSpace( iter->mnIndex ),
+ aPropMapper->GetEntryXMLName( iter->mnIndex ),
+ sAttrValue );
+ }
+ }
+ }
+ }
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/SchXMLAutoStylePoolP.hxx b/xmloff/source/chart/SchXMLAutoStylePoolP.hxx
new file mode 100644
index 000000000000..bffa2cce3d13
--- /dev/null
+++ b/xmloff/source/chart/SchXMLAutoStylePoolP.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _SCH_XMLAUTOSTYLEPOOLP_HXX_
+#define _SCH_XMLAUTOSTYLEPOOLP_HXX_
+
+#include <xmloff/xmlaustp.hxx>
+
+class SchXMLExport;
+
+class SchXMLAutoStylePoolP : public SvXMLAutoStylePoolP
+{
+protected:
+ SchXMLExport& mrSchXMLExport;
+
+ virtual void exportStyleAttributes(
+ SvXMLAttributeList& rAttrList,
+ sal_Int32 nFamily,
+ const ::std::vector< XMLPropertyState >& rProperties,
+ const SvXMLExportPropertyMapper& rPropExp
+ , const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap
+ ) const;
+
+public:
+ SchXMLAutoStylePoolP( SchXMLExport& rSchXMLExport );
+ virtual ~SchXMLAutoStylePoolP();
+};
+
+#endif // _SCH_XMLAUTOSTYLEPOOLP_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/SchXMLAxisContext.cxx b/xmloff/source/chart/SchXMLAxisContext.cxx
new file mode 100644
index 000000000000..5b9fb7c56b0f
--- /dev/null
+++ b/xmloff/source/chart/SchXMLAxisContext.cxx
@@ -0,0 +1,1053 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "SchXMLAxisContext.hxx"
+#include "SchXMLChartContext.hxx"
+#include "SchXMLTools.hxx"
+#include <xmloff/xmlnmspe.hxx>
+#include <xmloff/xmlement.hxx>
+#include <xmloff/xmlstyle.hxx>
+#include <xmloff/prstylei.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmluconv.hxx>
+
+#include <tools/debug.hxx>
+
+#include <com/sun/star/chart/ChartAxisLabelPosition.hpp>
+#include <com/sun/star/chart/ChartAxisMarkPosition.hpp>
+#include <com/sun/star/chart/ChartAxisPosition.hpp>
+#include <com/sun/star/chart/ChartAxisType.hpp>
+#include <com/sun/star/chart/TimeIncrement.hpp>
+#include <com/sun/star/chart/TimeInterval.hpp>
+#include <com/sun/star/chart/TimeUnit.hpp>
+#include <com/sun/star/chart/XAxis.hpp>
+#include <com/sun/star/chart/XAxisSupplier.hpp>
+#include <com/sun/star/chart2/AxisType.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
+
+#include <com/sun/star/drawing/LineStyle.hpp>
+
+using namespace ::xmloff::token;
+using namespace com::sun::star;
+
+using rtl::OUString;
+using com::sun::star::uno::Reference;
+
+//----------------------------------------
+//----------------------------------------
+
+static SvXMLEnumMapEntry aXMLAxisDimensionMap[] =
+{
+ { XML_X, SCH_XML_AXIS_X },
+ { XML_Y, SCH_XML_AXIS_Y },
+ { XML_Z, SCH_XML_AXIS_Z },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+static SvXMLEnumMapEntry aXMLAxisTypeMap[] =
+{
+ { XML_AUTO, ::com::sun::star::chart::ChartAxisType::AUTOMATIC },
+ { XML_TEXT, ::com::sun::star::chart::ChartAxisType::CATEGORY },
+ { XML_DATE, ::com::sun::star::chart::ChartAxisType::DATE },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+//----------------------------------------
+//----------------------------------------
+
+class SchXMLCategoriesContext : public SvXMLImportContext
+{
+private:
+ SchXMLImportHelper& m_rImportHelper;
+ OUString& mrAddress;
+
+public:
+ SchXMLCategoriesContext( SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ OUString& rAddress );
+ virtual ~SchXMLCategoriesContext();
+ virtual void StartElement( const Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+};
+
+//----------------------------------------
+//----------------------------------------
+
+
+class DateScaleContext : public SvXMLImportContext
+{
+public:
+ DateScaleContext( SchXMLImportHelper& rImpHelper, SvXMLImport& rImport,
+ sal_uInt16 nPrefix, const OUString& rLocalName,
+ const Reference< beans::XPropertySet > xAxisProps );
+
+ virtual ~DateScaleContext();
+ virtual void StartElement( const Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+private:
+ SchXMLImportHelper& m_rImportHelper;
+ Reference< beans::XPropertySet > m_xAxisProps;
+};
+
+
+//----------------------------------------
+//----------------------------------------
+
+SchXMLAxisContext::SchXMLAxisContext( SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport, const OUString& rLocalName,
+ Reference< chart::XDiagram > xDiagram,
+ std::vector< SchXMLAxis >& rAxes,
+ OUString & rCategoriesAddress,
+ bool bAddMissingXAxisForNetCharts,
+ bool bAdaptWrongPercentScaleValues,
+ bool bAdaptXAxisOrientationForOld2DBarCharts,
+ bool& rbAxisPositionAttributeImported ) :
+ SvXMLImportContext( rImport, XML_NAMESPACE_CHART, rLocalName ),
+ m_rImportHelper( rImpHelper ),
+ m_xDiagram( xDiagram ),
+ m_rAxes( rAxes ),
+ m_rCategoriesAddress( rCategoriesAddress ),
+ m_nAxisType(chart::ChartAxisType::AUTOMATIC),
+ m_bAxisTypeImported(false),
+ m_bDateScaleImported(false),
+ m_bAddMissingXAxisForNetCharts( bAddMissingXAxisForNetCharts ),
+ m_bAdaptWrongPercentScaleValues( bAdaptWrongPercentScaleValues ),
+ m_bAdaptXAxisOrientationForOld2DBarCharts( bAdaptXAxisOrientationForOld2DBarCharts ),
+ m_rbAxisPositionAttributeImported( rbAxisPositionAttributeImported )
+{
+}
+
+SchXMLAxisContext::~SchXMLAxisContext()
+{}
+
+Reference< chart::XAxis > lcl_getChartAxis( SchXMLAxis aCurrentAxis, const Reference< chart::XDiagram > xDiagram )
+{
+ Reference< chart::XAxis > xAxis;
+ Reference< chart::XAxisSupplier > xAxisSuppl( xDiagram, uno::UNO_QUERY );
+ if( !xAxisSuppl.is() )
+ return xAxis;
+ if( aCurrentAxis.nAxisIndex == 0 )
+ xAxis = xAxisSuppl->getAxis(aCurrentAxis.eDimension);
+ else
+ xAxis = xAxisSuppl->getSecondaryAxis(aCurrentAxis.eDimension);
+ return xAxis;
+}
+
+/* returns a shape for the current axis's title. The property
+ "Has...AxisTitle" is set to "True" to get the shape
+ */
+Reference< drawing::XShape > SchXMLAxisContext::getTitleShape()
+{
+ Reference< drawing::XShape > xResult;
+ Reference< beans::XPropertySet > xDiaProp( m_rImportHelper.GetChartDocument()->getDiagram(), uno::UNO_QUERY );
+ Reference< chart::XAxis > xAxis( lcl_getChartAxis( m_aCurrentAxis, m_xDiagram ) );
+ if( !xDiaProp.is() || !xAxis.is() )
+ return xResult;
+
+ rtl::OUString aPropName;
+ switch( m_aCurrentAxis.eDimension )
+ {
+ case SCH_XML_AXIS_X:
+ if( m_aCurrentAxis.nAxisIndex == 0 )
+ aPropName = OUString::createFromAscii( "HasXAxisTitle" );
+ else
+ aPropName = OUString::createFromAscii( "HasSecondaryXAxisTitle" );
+ break;
+ case SCH_XML_AXIS_Y:
+ if( m_aCurrentAxis.nAxisIndex == 0 )
+ aPropName = OUString::createFromAscii( "HasYAxisTitle" );
+ else
+ aPropName = OUString::createFromAscii( "HasSecondaryYAxisTitle" );
+ break;
+ case SCH_XML_AXIS_Z:
+ aPropName = OUString::createFromAscii( "HasZAxisTitle" );
+ break;
+ case SCH_XML_AXIS_UNDEF:
+ OSL_TRACE( "Invalid axis" );
+ break;
+ }
+ xDiaProp->setPropertyValue( aPropName, uno::makeAny(sal_True) );
+ xResult = Reference< drawing::XShape >( xAxis->getAxisTitle(), uno::UNO_QUERY );
+ return xResult;
+}
+
+void SchXMLAxisContext::CreateGrid( OUString sAutoStyleName, bool bIsMajor )
+{
+ Reference< beans::XPropertySet > xDiaProp( m_rImportHelper.GetChartDocument()->getDiagram(), uno::UNO_QUERY );
+ Reference< chart::XAxis > xAxis( lcl_getChartAxis( m_aCurrentAxis, m_xDiagram ) );
+ if( !xDiaProp.is() || !xAxis.is() )
+ return;
+
+ rtl::OUString aPropName;
+ switch( m_aCurrentAxis.eDimension )
+ {
+ case SCH_XML_AXIS_X:
+ if( bIsMajor )
+ aPropName = OUString::createFromAscii("HasXAxisGrid");
+ else
+ aPropName = OUString::createFromAscii("HasXAxisHelpGrid");
+ break;
+ case SCH_XML_AXIS_Y:
+ if( bIsMajor )
+ aPropName = OUString::createFromAscii("HasYAxisGrid");
+ else
+ aPropName = OUString::createFromAscii("HasYAxisHelpGrid");
+ break;
+ case SCH_XML_AXIS_Z:
+ if( bIsMajor )
+ aPropName = OUString::createFromAscii("HasZAxisGrid");
+ else
+ aPropName = OUString::createFromAscii("HasZAxisHelpGrid");
+ break;
+ case SCH_XML_AXIS_UNDEF:
+ OSL_TRACE( "Invalid axis" );
+ break;
+ }
+ xDiaProp->setPropertyValue( aPropName, uno::makeAny(sal_True) );
+
+ Reference< beans::XPropertySet > xGridProp;
+ if( bIsMajor )
+ xGridProp = xAxis->getMajorGrid();
+ else
+ xGridProp = xAxis->getMinorGrid();
+
+ // set properties
+ if( xGridProp.is())
+ {
+ // the line color is black as default, in the model it is a light gray
+ xGridProp->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "LineColor" )),
+ uno::makeAny( COL_BLACK ));
+ if( sAutoStyleName.getLength())
+ {
+ const SvXMLStylesContext* pStylesCtxt = m_rImportHelper.GetAutoStylesContext();
+ if( pStylesCtxt )
+ {
+ const SvXMLStyleContext* pStyle = pStylesCtxt->FindStyleChildContext(
+ m_rImportHelper.GetChartFamilyID(), sAutoStyleName );
+
+ if( pStyle && pStyle->ISA( XMLPropStyleContext ))
+ (( XMLPropStyleContext* )pStyle )->FillPropertySet( xGridProp );
+ }
+ }
+ }
+}
+
+namespace
+{
+enum AxisAttributeTokens
+{
+ XML_TOK_AXIS_DIMENSION,
+ XML_TOK_AXIS_NAME,
+ XML_TOK_AXIS_STYLE_NAME,
+ XML_TOK_AXIS_TYPE,
+ XML_TOK_AXIS_TYPE_EXT
+};
+
+SvXMLTokenMapEntry aAxisAttributeTokenMap[] =
+{
+ { XML_NAMESPACE_CHART, XML_DIMENSION, XML_TOK_AXIS_DIMENSION },
+ { XML_NAMESPACE_CHART, XML_NAME, XML_TOK_AXIS_NAME },
+ { XML_NAMESPACE_CHART, XML_STYLE_NAME, XML_TOK_AXIS_STYLE_NAME },
+ { XML_NAMESPACE_CHART, XML_AXIS_TYPE, XML_TOK_AXIS_TYPE },
+ { XML_NAMESPACE_CHART_EXT, XML_AXIS_TYPE, XML_TOK_AXIS_TYPE_EXT },
+ XML_TOKEN_MAP_END
+};
+
+class AxisAttributeTokenMap : public SvXMLTokenMap
+{
+public:
+ AxisAttributeTokenMap(): SvXMLTokenMap( aAxisAttributeTokenMap ) {}
+ virtual ~AxisAttributeTokenMap() {}
+};
+
+//a AxisAttributeTokenMap Singleton
+struct theAxisAttributeTokenMap : public rtl::Static< AxisAttributeTokenMap, theAxisAttributeTokenMap > {};
+}
+
+void SchXMLAxisContext::StartElement( const Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ // parse attributes
+ sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
+ SchXMLImport& rImport = ( SchXMLImport& )GetImport();
+ const SvXMLTokenMap& rAttrTokenMap = theAxisAttributeTokenMap::get();
+
+ for( sal_Int16 i = 0; i < nAttrCount; i++ )
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ OUString aValue = xAttrList->getValueByIndex( i );
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+
+ switch( rAttrTokenMap.Get( nPrefix, aLocalName ))
+ {
+ case XML_TOK_AXIS_DIMENSION:
+ {
+ sal_uInt16 nEnumVal;
+ if( rImport.GetMM100UnitConverter().convertEnum( nEnumVal, aValue, aXMLAxisDimensionMap ))
+ m_aCurrentAxis.eDimension = ( SchXMLAxisDimension )nEnumVal;
+ }
+ break;
+ case XML_TOK_AXIS_NAME:
+ m_aCurrentAxis.aName = aValue;
+ break;
+ case XML_TOK_AXIS_TYPE:
+ case XML_TOK_AXIS_TYPE_EXT:
+ sal_uInt16 nEnumVal;
+ if( rImport.GetMM100UnitConverter().convertEnum( nEnumVal, aValue, aXMLAxisTypeMap ))
+ {
+ m_nAxisType = nEnumVal;
+ m_bAxisTypeImported = true;
+ }
+ break;
+ case XML_TOK_AXIS_STYLE_NAME:
+ m_aAutoStyleName = aValue;
+ break;
+ }
+ }
+
+ // check for number of axes with same dimension
+ m_aCurrentAxis.nAxisIndex = 0;
+ sal_Int32 nNumOfAxes = m_rAxes.size();
+ for( sal_Int32 nCurrent = 0; nCurrent < nNumOfAxes; nCurrent++ )
+ {
+ if( m_rAxes[ nCurrent ].eDimension == m_aCurrentAxis.eDimension )
+ m_aCurrentAxis.nAxisIndex++;
+ }
+ CreateAxis();
+}
+namespace
+{
+
+Reference< chart2::XAxis > lcl_getAxis( const Reference< frame::XModel >& xChartModel,
+ sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex )
+{
+ Reference< chart2::XAxis > xAxis;
+
+ try
+ {
+ Reference< chart2::XChartDocument > xChart2Document( xChartModel, uno::UNO_QUERY );
+ if( xChart2Document.is() )
+ {
+ Reference< chart2::XDiagram > xDiagram( xChart2Document->getFirstDiagram());
+ Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY_THROW );
+ uno::Sequence< Reference< chart2::XCoordinateSystem > >
+ aCooSysSeq( xCooSysCnt->getCoordinateSystems());
+ sal_Int32 nCooSysIndex = 0;
+ if( nCooSysIndex < aCooSysSeq.getLength() )
+ {
+ Reference< chart2::XCoordinateSystem > xCooSys( aCooSysSeq[nCooSysIndex] );
+ if( xCooSys.is() && nDimensionIndex < xCooSys->getDimension() )
+ {
+ const sal_Int32 nMaxAxisIndex = xCooSys->getMaximumAxisIndexByDimension(nDimensionIndex);
+ if( nAxisIndex <= nMaxAxisIndex )
+ xAxis = xCooSys->getAxisByDimension( nDimensionIndex, nAxisIndex );
+ }
+ }
+ }
+ }
+ catch( uno::Exception & )
+ {
+ OSL_TRACE( "Couldn't get axis" );
+ }
+
+ return xAxis;
+}
+
+bool lcl_divideBy100( uno::Any& rDoubleAny )
+{
+ bool bChanged = false;
+ double fValue=0.0;
+ if( (rDoubleAny>>=fValue) && (fValue!=0.0) )
+ {
+ fValue/=100.0;
+ rDoubleAny = uno::makeAny(fValue);
+ bChanged = true;
+ }
+ return bChanged;
+}
+
+bool lcl_AdaptWrongPercentScaleValues(chart2::ScaleData& rScaleData)
+{
+ bool bChanged = lcl_divideBy100( rScaleData.Minimum );
+ bChanged = lcl_divideBy100( rScaleData.Maximum ) || bChanged;
+ bChanged = lcl_divideBy100( rScaleData.Origin ) || bChanged;
+ bChanged = lcl_divideBy100( rScaleData.IncrementData.Distance ) || bChanged;
+ return bChanged;
+}
+
+}//end anonymous namespace
+
+void SchXMLAxisContext::CreateAxis()
+{
+ m_rAxes.push_back( m_aCurrentAxis );
+
+ Reference< beans::XPropertySet > xDiaProp( m_rImportHelper.GetChartDocument()->getDiagram(), uno::UNO_QUERY );
+ if( !xDiaProp.is() )
+ return;
+ rtl::OUString aPropName;
+ switch( m_aCurrentAxis.eDimension )
+ {
+ case SCH_XML_AXIS_X:
+ if( m_aCurrentAxis.nAxisIndex == 0 )
+ aPropName = OUString::createFromAscii("HasXAxis");
+ else
+ aPropName = OUString::createFromAscii("HasSecondaryXAxis");
+ break;
+ case SCH_XML_AXIS_Y:
+ if( m_aCurrentAxis.nAxisIndex == 0 )
+ aPropName = OUString::createFromAscii("HasYAxis");
+ else
+ aPropName = OUString::createFromAscii("HasSecondaryYAxis");
+ break;
+ case SCH_XML_AXIS_Z:
+ if( m_aCurrentAxis.nAxisIndex == 0 )
+ aPropName = OUString::createFromAscii("HasXAxis");
+ else
+ aPropName = OUString::createFromAscii("HasSecondaryXAxis");
+ break;
+ case SCH_XML_AXIS_UNDEF:
+ OSL_TRACE( "Invalid axis" );
+ break;
+ }
+ try
+ {
+ xDiaProp->setPropertyValue( aPropName, uno::makeAny(sal_True) );
+ }
+ catch( beans::UnknownPropertyException & )
+ {
+ OSL_TRACE( "Couldn't turn on axis" );
+ }
+ if( m_aCurrentAxis.eDimension==SCH_XML_AXIS_Z )
+ {
+ bool bSettingZAxisSuccedded = false;
+ try
+ {
+ xDiaProp->getPropertyValue( aPropName ) >>= bSettingZAxisSuccedded;
+ }
+ catch( beans::UnknownPropertyException & )
+ {
+ OSL_TRACE( "Couldn't turn on z axis" );
+ }
+ if( !bSettingZAxisSuccedded )
+ return;
+ }
+
+
+ m_xAxisProps = Reference<beans::XPropertySet>( lcl_getChartAxis( m_aCurrentAxis, m_xDiagram ), uno::UNO_QUERY );
+
+ if( m_bAddMissingXAxisForNetCharts && m_aCurrentAxis.eDimension==SCH_XML_AXIS_Y && m_aCurrentAxis.nAxisIndex==0 )
+ {
+ try
+ {
+ xDiaProp->setPropertyValue( OUString::createFromAscii( "HasXAxis" ), uno::makeAny(sal_True) );
+ }
+ catch( beans::UnknownPropertyException & )
+ {
+ OSL_TRACE( "Couldn't turn on x axis" );
+ }
+ }
+
+ // set properties
+ if( m_xAxisProps.is())
+ {
+ uno::Any aTrueBool( uno::makeAny( sal_True ));
+ uno::Any aFalseBool( uno::makeAny( sal_False ));
+
+ // #i109879# the line color is black as default, in the model it is a light gray
+ m_xAxisProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "LineColor" )),
+ uno::makeAny( COL_BLACK ));
+
+ m_xAxisProps->setPropertyValue( OUString::createFromAscii( "DisplayLabels" ), aFalseBool );
+
+ // #88077# AutoOrigin 'on' is default
+ m_xAxisProps->setPropertyValue( OUString::createFromAscii( "AutoOrigin" ), aTrueBool );
+
+ if( m_bAxisTypeImported )
+ m_xAxisProps->setPropertyValue( OUString::createFromAscii( "AxisType" ), uno::makeAny(m_nAxisType) );
+
+ if( m_aAutoStyleName.getLength())
+ {
+ const SvXMLStylesContext* pStylesCtxt = m_rImportHelper.GetAutoStylesContext();
+ if( pStylesCtxt )
+ {
+ const SvXMLStyleContext* pStyle = pStylesCtxt->FindStyleChildContext(
+ m_rImportHelper.GetChartFamilyID(), m_aAutoStyleName );
+
+ if( pStyle && pStyle->ISA( XMLPropStyleContext ))
+ {
+ // note: SvXMLStyleContext::FillPropertySet is not const
+ XMLPropStyleContext * pPropStyleContext = const_cast< XMLPropStyleContext * >( dynamic_cast< const XMLPropStyleContext * >( pStyle ));
+ if( pPropStyleContext )
+ pPropStyleContext->FillPropertySet( m_xAxisProps );
+
+ if( m_bAdaptWrongPercentScaleValues && m_aCurrentAxis.eDimension==SCH_XML_AXIS_Y )
+ {
+ //set scale data of added x axis back to default
+ Reference< chart2::XAxis > xAxis( lcl_getAxis( GetImport().GetModel(),
+ m_aCurrentAxis.eDimension, m_aCurrentAxis.nAxisIndex ) );
+ if( xAxis.is() )
+ {
+ chart2::ScaleData aScaleData( xAxis->getScaleData());
+ if( lcl_AdaptWrongPercentScaleValues(aScaleData) )
+ xAxis->setScaleData( aScaleData );
+ }
+ }
+
+ if( m_bAddMissingXAxisForNetCharts )
+ {
+ //copy style from y axis to added x axis:
+
+ Reference< chart::XAxisSupplier > xAxisSuppl( xDiaProp, uno::UNO_QUERY );
+ if( xAxisSuppl.is() )
+ {
+ Reference< beans::XPropertySet > xXAxisProp( xAxisSuppl->getAxis(0), uno::UNO_QUERY );
+ (( XMLPropStyleContext* )pStyle )->FillPropertySet( xXAxisProp );
+ }
+
+ //set scale data of added x axis back to default
+ Reference< chart2::XAxis > xAxis( lcl_getAxis( GetImport().GetModel(),
+ 0 /*nDimensionIndex*/, 0 /*nAxisIndex*/ ) );
+ if( xAxis.is() )
+ {
+ chart2::ScaleData aScaleData;
+ aScaleData.AxisType = chart2::AxisType::CATEGORY;
+ aScaleData.Orientation = chart2::AxisOrientation_MATHEMATICAL;
+ xAxis->setScaleData( aScaleData );
+ }
+
+ //set line style of added x axis to invisible
+ Reference< beans::XPropertySet > xNewAxisProp( xAxis, uno::UNO_QUERY );
+ if( xNewAxisProp.is() )
+ {
+ xNewAxisProp->setPropertyValue( OUString::createFromAscii("LineStyle")
+ , uno::makeAny(drawing::LineStyle_NONE));
+ }
+ }
+
+ if( m_bAdaptXAxisOrientationForOld2DBarCharts && m_aCurrentAxis.eDimension == SCH_XML_AXIS_X )
+ {
+ bool bIs3DChart = false;
+ if( xDiaProp.is() && ( xDiaProp->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Dim3D"))) >>= bIs3DChart )
+ && !bIs3DChart )
+ {
+ Reference< chart2::XChartDocument > xChart2Document( GetImport().GetModel(), uno::UNO_QUERY );
+ if( xChart2Document.is() )
+ {
+ Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xChart2Document->getFirstDiagram(), uno::UNO_QUERY );
+ if( xCooSysCnt.is() )
+ {
+ uno::Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems() );
+ if( aCooSysSeq.getLength() )
+ {
+ bool bSwapXandYAxis = false;
+ Reference< chart2::XCoordinateSystem > xCooSys( aCooSysSeq[0] );
+ Reference< beans::XPropertySet > xCooSysProp( xCooSys, uno::UNO_QUERY );
+ if( xCooSysProp.is() && ( xCooSysProp->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("SwapXAndYAxis"))) >>= bSwapXandYAxis )
+ && bSwapXandYAxis )
+ {
+ Reference< chart2::XAxis > xAxis = xCooSys->getAxisByDimension( 0, m_aCurrentAxis.nAxisIndex );
+ if( xAxis.is() )
+ {
+ chart2::ScaleData aScaleData = xAxis->getScaleData();
+ aScaleData.Orientation = chart2::AxisOrientation_REVERSE;
+ xAxis->setScaleData( aScaleData );
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ m_rbAxisPositionAttributeImported = m_rbAxisPositionAttributeImported || SchXMLTools::getPropertyFromContext(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("CrossoverPosition")), pPropStyleContext, pStylesCtxt ).hasValue();
+ }
+ }
+ }
+ }
+}
+
+void SchXMLAxisContext::SetAxisTitle()
+{
+ if( !m_aCurrentAxis.aTitle.getLength() )
+ return;
+
+ Reference< chart::XAxis > xAxis( lcl_getChartAxis( m_aCurrentAxis, m_xDiagram ) );
+ if( !xAxis.is() )
+ return;
+
+ Reference< beans::XPropertySet > xTitleProp( xAxis->getAxisTitle() );
+ if( xTitleProp.is() )
+ {
+ try
+ {
+ xTitleProp->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "String" )), uno::makeAny(m_aCurrentAxis.aTitle) );
+ }
+ catch( beans::UnknownPropertyException & )
+ {
+ OSL_TRACE( "Property String for Title not available" );
+ }
+ }
+}
+
+//-----------------------------------------------------------------------
+namespace
+{
+enum AxisChildTokens
+{
+ XML_TOK_AXIS_TITLE,
+ XML_TOK_AXIS_CATEGORIES,
+ XML_TOK_AXIS_GRID,
+ XML_TOK_AXIS_DATE_SCALE,
+ XML_TOK_AXIS_DATE_SCALE_EXT
+};
+
+SvXMLTokenMapEntry aAxisChildTokenMap[] =
+{
+ { XML_NAMESPACE_CHART, XML_TITLE, XML_TOK_AXIS_TITLE },
+ { XML_NAMESPACE_CHART, XML_CATEGORIES, XML_TOK_AXIS_CATEGORIES },
+ { XML_NAMESPACE_CHART, XML_GRID, XML_TOK_AXIS_GRID },
+ { XML_NAMESPACE_CHART, XML_DATE_SCALE, XML_TOK_AXIS_DATE_SCALE },
+ { XML_NAMESPACE_CHART_EXT, XML_DATE_SCALE, XML_TOK_AXIS_DATE_SCALE_EXT },
+ XML_TOKEN_MAP_END
+};
+
+class AxisChildTokenMap : public SvXMLTokenMap
+{
+public:
+ AxisChildTokenMap(): SvXMLTokenMap( aAxisChildTokenMap ) {}
+ virtual ~AxisChildTokenMap() {}
+};
+
+//a AxisChildTokenMap Singleton
+struct theAxisChildTokenMap : public rtl::Static< AxisChildTokenMap, theAxisChildTokenMap > {};
+}
+
+SvXMLImportContext* SchXMLAxisContext::CreateChildContext(
+ sal_uInt16 p_nPrefix,
+ const OUString& rLocalName,
+ const Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ SvXMLImportContext* pContext = 0;
+ const SvXMLTokenMap& rTokenMap = theAxisChildTokenMap::get();
+
+ switch( rTokenMap.Get( p_nPrefix, rLocalName ))
+ {
+ case XML_TOK_AXIS_TITLE:
+ {
+ Reference< drawing::XShape > xTitleShape = getTitleShape();
+ pContext = new SchXMLTitleContext( m_rImportHelper, GetImport(), rLocalName,
+ m_aCurrentAxis.aTitle,
+ xTitleShape );
+ }
+ break;
+
+ case XML_TOK_AXIS_CATEGORIES:
+ pContext = new SchXMLCategoriesContext( m_rImportHelper, GetImport(),
+ p_nPrefix, rLocalName,
+ m_rCategoriesAddress );
+ m_aCurrentAxis.bHasCategories = true;
+ break;
+
+ case XML_TOK_AXIS_DATE_SCALE:
+ case XML_TOK_AXIS_DATE_SCALE_EXT:
+ pContext = new DateScaleContext( m_rImportHelper, GetImport(),
+ p_nPrefix, rLocalName, m_xAxisProps );
+ m_bDateScaleImported = true;
+ break;
+
+ case XML_TOK_AXIS_GRID:
+ {
+ sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
+ bool bIsMajor = true; // default value for class is "major"
+ OUString sAutoStyleName;
+
+ for( sal_Int16 i = 0; i < nAttrCount; i++ )
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+
+ if( nPrefix == XML_NAMESPACE_CHART )
+ {
+ if( IsXMLToken( aLocalName, XML_CLASS ) )
+ {
+ if( IsXMLToken( xAttrList->getValueByIndex( i ), XML_MINOR ) )
+ bIsMajor = false;
+ }
+ else if( IsXMLToken( aLocalName, XML_STYLE_NAME ) )
+ sAutoStyleName = xAttrList->getValueByIndex( i );
+ }
+ }
+
+ CreateGrid( sAutoStyleName, bIsMajor );
+
+ // don't create a context => use default context. grid elements are empty
+ pContext = new SvXMLImportContext( GetImport(), p_nPrefix, rLocalName );
+ }
+ break;
+
+ default:
+ pContext = new SvXMLImportContext( GetImport(), p_nPrefix, rLocalName );
+ break;
+ }
+
+ return pContext;
+}
+
+void SchXMLAxisContext::EndElement()
+{
+ if( !m_bDateScaleImported && m_nAxisType==chart::ChartAxisType::AUTOMATIC )
+ {
+ Reference< chart2::XAxis > xAxis( lcl_getAxis( GetImport().GetModel(), m_aCurrentAxis.eDimension, m_aCurrentAxis.nAxisIndex ) );
+ if( xAxis.is() )
+ {
+ chart2::ScaleData aScaleData( xAxis->getScaleData());
+ aScaleData.AutoDateAxis = false;//different default for older documents
+ xAxis->setScaleData( aScaleData );
+ }
+ }
+
+ SetAxisTitle();
+}
+
+// ========================================
+
+namespace
+{
+
+Reference< chart2::XAxis > lcl_getAxis( const Reference< chart2::XCoordinateSystem > xCooSys, sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex )
+{
+ Reference< chart2::XAxis > xAxis;
+ try
+ {
+ xAxis = xCooSys->getAxisByDimension( nDimensionIndex, nAxisIndex );
+ }
+ catch( uno::Exception & )
+ {
+ }
+ return xAxis;
+}
+
+} // anonymous namespace
+
+void SchXMLAxisContext::CorrectAxisPositions( const Reference< chart2::XChartDocument >& xNewDoc,
+ const OUString& rChartTypeServiceName,
+ const OUString& rODFVersionOfFile,
+ bool bAxisPositionAttributeImported )
+{
+ if( ( !rODFVersionOfFile.getLength() || rODFVersionOfFile.equalsAscii("1.0")
+ || rODFVersionOfFile.equalsAscii("1.1")
+ || ( rODFVersionOfFile.equalsAscii("1.2") && !bAxisPositionAttributeImported ) ) )
+ {
+ try
+ {
+ Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xNewDoc->getFirstDiagram(), uno::UNO_QUERY_THROW );
+ uno::Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems());
+ if( aCooSysSeq.getLength() )
+ {
+ Reference< chart2::XCoordinateSystem > xCooSys( aCooSysSeq[0] );
+ if( xCooSys.is() )
+ {
+ Reference< chart2::XAxis > xMainXAxis = lcl_getAxis( xCooSys, 0, 0 );
+ Reference< chart2::XAxis > xMainYAxis = lcl_getAxis( xCooSys, 1, 0 );
+ //Reference< chart2::XAxis > xMajorZAxis = lcl_getAxis( xCooSys, 2, 0 );
+ Reference< chart2::XAxis > xSecondaryXAxis = lcl_getAxis( xCooSys, 0, 1 );
+ Reference< chart2::XAxis > xSecondaryYAxis = lcl_getAxis( xCooSys, 1, 1 );
+
+ Reference< beans::XPropertySet > xMainXAxisProp( xMainXAxis, uno::UNO_QUERY );
+ Reference< beans::XPropertySet > xMainYAxisProp( xMainYAxis, uno::UNO_QUERY );
+ Reference< beans::XPropertySet > xSecondaryXAxisProp( xSecondaryXAxis, uno::UNO_QUERY );
+ Reference< beans::XPropertySet > xSecondaryYAxisProp( xSecondaryYAxis, uno::UNO_QUERY );
+
+ if( xMainXAxisProp.is() && xMainYAxisProp.is() )
+ {
+ chart2::ScaleData aMainXScale = xMainXAxis->getScaleData();
+ if( 0 == rChartTypeServiceName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.chart2.ScatterChartType" ) ) )
+ {
+ xMainYAxisProp->setPropertyValue( OUString::createFromAscii("CrossoverPosition")
+ , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_VALUE) );
+ double fCrossoverValue = 0.0;
+ aMainXScale.Origin >>= fCrossoverValue;
+ xMainYAxisProp->setPropertyValue( OUString::createFromAscii("CrossoverValue")
+ , uno::makeAny( fCrossoverValue ) );
+
+ if( aMainXScale.Orientation == chart2::AxisOrientation_REVERSE )
+ {
+ xMainYAxisProp->setPropertyValue( OUString::createFromAscii("LabelPosition")
+ , uno::makeAny( ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END) );
+ xMainYAxisProp->setPropertyValue( OUString::createFromAscii("MarkPosition")
+ , uno::makeAny( ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS) );
+ if( xSecondaryYAxisProp.is() )
+ xSecondaryYAxisProp->setPropertyValue( OUString::createFromAscii("CrossoverPosition")
+ , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_START) );
+ }
+ else
+ {
+ xMainYAxisProp->setPropertyValue( OUString::createFromAscii("LabelPosition")
+ , uno::makeAny( ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START) );
+ xMainYAxisProp->setPropertyValue( OUString::createFromAscii("MarkPosition")
+ , uno::makeAny( ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS) );
+ if( xSecondaryYAxisProp.is() )
+ xSecondaryYAxisProp->setPropertyValue( OUString::createFromAscii("CrossoverPosition")
+ , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_END) );
+ }
+ }
+ else
+ {
+ if( aMainXScale.Orientation == chart2::AxisOrientation_REVERSE )
+ {
+ xMainYAxisProp->setPropertyValue( OUString::createFromAscii("CrossoverPosition")
+ , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_END) );
+ if( xSecondaryYAxisProp.is() )
+ xSecondaryYAxisProp->setPropertyValue( OUString::createFromAscii("CrossoverPosition")
+ , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_START) );
+ }
+ else
+ {
+ xMainYAxisProp->setPropertyValue( OUString::createFromAscii("CrossoverPosition")
+ , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_START) );
+ if( xSecondaryYAxisProp.is() )
+ xSecondaryYAxisProp->setPropertyValue( OUString::createFromAscii("CrossoverPosition")
+ , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_END) );
+ }
+ }
+
+ chart2::ScaleData aMainYScale = xMainYAxis->getScaleData();
+ xMainXAxisProp->setPropertyValue( OUString::createFromAscii("CrossoverPosition")
+ , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_VALUE) );
+ double fCrossoverValue = 0.0;
+ aMainYScale.Origin >>= fCrossoverValue;
+ xMainXAxisProp->setPropertyValue( OUString::createFromAscii("CrossoverValue")
+ , uno::makeAny( fCrossoverValue ) );
+
+ if( aMainYScale.Orientation == chart2::AxisOrientation_REVERSE )
+ {
+ xMainXAxisProp->setPropertyValue( OUString::createFromAscii("LabelPosition")
+ , uno::makeAny( ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END) );
+ xMainXAxisProp->setPropertyValue( OUString::createFromAscii("MarkPosition")
+ , uno::makeAny( ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS) );
+ if( xSecondaryXAxisProp.is() )
+ xSecondaryXAxisProp->setPropertyValue( OUString::createFromAscii("CrossoverPosition")
+ , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_START) );
+ }
+ else
+ {
+ xMainXAxisProp->setPropertyValue( OUString::createFromAscii("LabelPosition")
+ , uno::makeAny( ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START) );
+ xMainXAxisProp->setPropertyValue( OUString::createFromAscii("MarkPosition")
+ , uno::makeAny( ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS) );
+ if( xSecondaryXAxisProp.is() )
+ xSecondaryXAxisProp->setPropertyValue( OUString::createFromAscii("CrossoverPosition")
+ , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_END) );
+ }
+ }
+ }
+ }
+ }
+ catch( uno::Exception & )
+ {
+ }
+ }
+}
+
+// ========================================
+
+SchXMLCategoriesContext::SchXMLCategoriesContext(
+ SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ OUString& rAddress ) :
+ SvXMLImportContext( rImport, nPrefix, rLocalName ),
+ m_rImportHelper( rImpHelper ),
+ mrAddress( rAddress )
+{
+}
+
+SchXMLCategoriesContext::~SchXMLCategoriesContext()
+{
+}
+
+void SchXMLCategoriesContext::StartElement( const Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
+
+ for( sal_Int16 i = 0; i < nAttrCount; i++ )
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+
+ if( nPrefix == XML_NAMESPACE_TABLE &&
+ IsXMLToken( aLocalName, XML_CELL_RANGE_ADDRESS ) )
+ {
+ Reference< chart2::XChartDocument > xNewDoc( GetImport().GetModel(), uno::UNO_QUERY );
+ mrAddress = xAttrList->getValueByIndex( i );
+ }
+ }
+}
+
+// ========================================
+
+DateScaleContext::DateScaleContext(
+ SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference< beans::XPropertySet > xAxisProps ) :
+ SvXMLImportContext( rImport, nPrefix, rLocalName ),
+ m_rImportHelper( rImpHelper ),
+ m_xAxisProps( xAxisProps )
+{
+}
+
+DateScaleContext::~DateScaleContext()
+{
+}
+
+namespace
+{
+enum DateScaleAttributeTokens
+{
+ XML_TOK_DATESCALE_BASE_TIME_UNIT,
+ XML_TOK_DATESCALE_MAJOR_INTERVAL_VALUE,
+ XML_TOK_DATESCALE_MAJOR_INTERVAL_UNIT,
+ XML_TOK_DATESCALE_MINOR_INTERVAL_VALUE,
+ XML_TOK_DATESCALE_MINOR_INTERVAL_UNIT
+};
+
+SvXMLTokenMapEntry aDateScaleAttributeTokenMap[] =
+{
+ { XML_NAMESPACE_CHART, XML_BASE_TIME_UNIT, XML_TOK_DATESCALE_BASE_TIME_UNIT },
+ { XML_NAMESPACE_CHART, XML_MAJOR_INTERVAL_VALUE, XML_TOK_DATESCALE_MAJOR_INTERVAL_VALUE },
+ { XML_NAMESPACE_CHART, XML_MAJOR_INTERVAL_UNIT, XML_TOK_DATESCALE_MAJOR_INTERVAL_UNIT },
+ { XML_NAMESPACE_CHART, XML_MINOR_INTERVAL_VALUE, XML_TOK_DATESCALE_MINOR_INTERVAL_VALUE },
+ { XML_NAMESPACE_CHART, XML_MINOR_INTERVAL_UNIT, XML_TOK_DATESCALE_MINOR_INTERVAL_UNIT },
+ XML_TOKEN_MAP_END
+};
+
+class DateScaleAttributeTokenMap : public SvXMLTokenMap
+{
+public:
+ DateScaleAttributeTokenMap(): SvXMLTokenMap( aDateScaleAttributeTokenMap ) {}
+ virtual ~DateScaleAttributeTokenMap() {}
+};
+
+struct theDateScaleAttributeTokenMap : public rtl::Static< DateScaleAttributeTokenMap, theDateScaleAttributeTokenMap > {};
+
+sal_Int32 lcl_getTimeUnit( const OUString& rValue )
+{
+ sal_Int32 nTimeUnit = ::com::sun::star::chart::TimeUnit::DAY;
+ if( IsXMLToken( rValue, XML_DAYS ) )
+ nTimeUnit = ::com::sun::star::chart::TimeUnit::DAY;
+ else if( IsXMLToken( rValue, XML_MONTHS ) )
+ nTimeUnit = ::com::sun::star::chart::TimeUnit::MONTH;
+ else if( IsXMLToken( rValue, XML_YEARS ) )
+ nTimeUnit = ::com::sun::star::chart::TimeUnit::YEAR;
+ return nTimeUnit;
+}
+
+}
+
+void DateScaleContext::StartElement( const Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ if( !m_xAxisProps.is() )
+ return;
+
+ // parse attributes
+ sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
+ const SvXMLTokenMap& rAttrTokenMap = theDateScaleAttributeTokenMap::get();
+
+ bool bSetNewIncrement=false;
+ chart::TimeIncrement aIncrement;
+ m_xAxisProps->getPropertyValue( OUString::createFromAscii( "TimeIncrement" )) >>= aIncrement;
+
+ for( sal_Int16 i = 0; i < nAttrCount; i++ )
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ OUString aValue = xAttrList->getValueByIndex( i );
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+
+ switch( rAttrTokenMap.Get( nPrefix, aLocalName ))
+ {
+ case XML_TOK_DATESCALE_BASE_TIME_UNIT:
+ {
+ aIncrement.TimeResolution = uno::makeAny( lcl_getTimeUnit(aValue) );
+ bSetNewIncrement = true;
+ }
+ break;
+ case XML_TOK_DATESCALE_MAJOR_INTERVAL_VALUE:
+ {
+ chart::TimeInterval aInterval(1,0);
+ aIncrement.MajorTimeInterval >>= aInterval;
+ SvXMLUnitConverter::convertNumber( aInterval.Number, aValue );
+ aIncrement.MajorTimeInterval = uno::makeAny(aInterval);
+ bSetNewIncrement = true;
+ }
+ break;
+ case XML_TOK_DATESCALE_MAJOR_INTERVAL_UNIT:
+ {
+ chart::TimeInterval aInterval(1,0);
+ aIncrement.MajorTimeInterval >>= aInterval;
+ aInterval.TimeUnit = lcl_getTimeUnit(aValue);
+ aIncrement.MajorTimeInterval = uno::makeAny(aInterval);
+ bSetNewIncrement = true;
+ }
+ break;
+ case XML_TOK_DATESCALE_MINOR_INTERVAL_VALUE:
+ {
+ chart::TimeInterval aInterval(1,0);
+ aIncrement.MinorTimeInterval >>= aInterval;
+ SvXMLUnitConverter::convertNumber( aInterval.Number, aValue );
+ aIncrement.MinorTimeInterval = uno::makeAny(aInterval);
+ bSetNewIncrement = true;
+ }
+ break;
+ case XML_TOK_DATESCALE_MINOR_INTERVAL_UNIT:
+ {
+ chart::TimeInterval aInterval(1,0);
+ aIncrement.MinorTimeInterval >>= aInterval;
+ aInterval.TimeUnit = lcl_getTimeUnit(aValue);
+ aIncrement.MinorTimeInterval = uno::makeAny(aInterval);
+ bSetNewIncrement = true;
+ }
+ break;
+ }
+ }
+
+ if( bSetNewIncrement )
+ m_xAxisProps->setPropertyValue( OUString::createFromAscii( "TimeIncrement" ), uno::makeAny( aIncrement ) );
+}
+
+// ========================================
diff --git a/xmloff/source/chart/SchXMLAxisContext.hxx b/xmloff/source/chart/SchXMLAxisContext.hxx
new file mode 100644
index 000000000000..2689c6adff6d
--- /dev/null
+++ b/xmloff/source/chart/SchXMLAxisContext.hxx
@@ -0,0 +1,83 @@
+/*************************************************************************
+ *
+ * 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 _SCH_XMLAXISCONTEXT_HXX_
+#define _SCH_XMLAXISCONTEXT_HXX_
+
+#include "SchXMLImport.hxx"
+#include "transporttypes.hxx"
+
+// ----------------------------------------
+
+class SchXMLAxisContext : public SvXMLImportContext
+{
+public:
+ SchXMLAxisContext( SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport, const rtl::OUString& rLocalName,
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart::XDiagram > xDiagram,
+ std::vector< SchXMLAxis >& aAxes,
+ ::rtl::OUString& rCategoriesAddress,
+ bool bAddMissingXAxisForNetCharts,
+ bool bAdaptWrongPercentScaleValues,
+ bool bAdaptXAxisOrientationForOld2DBarCharts,
+ bool& rbAxisPositionAttributeImported );
+ virtual ~SchXMLAxisContext();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ static void CorrectAxisPositions( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xNewDoc,
+ const ::rtl::OUString& rChartTypeServiceName,
+ const ::rtl::OUString& rODFVersionOfFile,
+ bool bAxisPositionAttributeImported );
+
+private:
+ SchXMLImportHelper& m_rImportHelper;
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart::XDiagram > m_xDiagram;
+ SchXMLAxis m_aCurrentAxis;
+ std::vector< SchXMLAxis >& m_rAxes;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xAxisProps;
+ rtl::OUString m_aAutoStyleName;
+ rtl::OUString& m_rCategoriesAddress;
+ sal_Int32 m_nAxisType;//::com::sun::star::chart::ChartAxisType
+ bool m_bAxisTypeImported;
+ bool m_bDateScaleImported;
+ bool m_bAddMissingXAxisForNetCharts; //to correct errors from older versions
+ bool m_bAdaptWrongPercentScaleValues; //to correct errors from older versions
+ bool m_bAdaptXAxisOrientationForOld2DBarCharts; //to correct different behaviour from older versions
+ bool& m_rbAxisPositionAttributeImported;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > getTitleShape();
+ void CreateGrid( ::rtl::OUString sAutoStyleName, bool bIsMajor );
+ void CreateAxis();
+ void SetAxisTitle();
+};
+
+#endif // _SCH_XMLAXISCONTEXT_HXX_
diff --git a/xmloff/source/chart/SchXMLCalculationSettingsContext.cxx b/xmloff/source/chart/SchXMLCalculationSettingsContext.cxx
new file mode 100644
index 000000000000..531388d943e6
--- /dev/null
+++ b/xmloff/source/chart/SchXMLCalculationSettingsContext.cxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <SchXMLCalculationSettingsContext.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+SchXMLCalculationSettingsContext::SchXMLCalculationSettingsContext( SvXMLImport& rImport,
+ sal_uInt16 p_nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList >& xAttrList )
+: SvXMLImportContext ( rImport, p_nPrefix, rLocalName )
+{
+ const SvXMLNamespaceMap& rMap = GetImport().GetNamespaceMap();
+ const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
+ rtl::OUString aLocalName;
+ const sal_uInt16 nPrefix = rMap.GetKeyByAttrName(sAttrName, &aLocalName );
+ if ( nPrefix == XML_NAMESPACE_TABLE && IsXMLToken( aLocalName, XML_DATE_VALUE ) )
+ {
+ util::DateTime aNullDate;
+ const rtl::OUString sValue = xAttrList->getValueByIndex( i );
+ GetImport().GetMM100UnitConverter().convertDateTime(aNullDate, sValue);
+ m_aNullDate <<= aNullDate;
+ }
+ }
+}
+SvXMLImportContext* SchXMLCalculationSettingsContext::CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList )
+{
+ return new SchXMLCalculationSettingsContext(GetImport(),nPrefix,rLocalName,xAttrList);
+}
+
+void SchXMLCalculationSettingsContext::EndElement()
+{
+ if ( m_aNullDate.hasValue() )
+ {
+ Reference < XPropertySet > xPropSet ( GetImport().GetModel(), UNO_QUERY );
+ ::rtl::OUString sNullDate( RTL_CONSTASCII_USTRINGPARAM ( "NullDate" ) );
+ xPropSet->setPropertyValue ( sNullDate, m_aNullDate );
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/SchXMLCalculationSettingsContext.hxx b/xmloff/source/chart/SchXMLCalculationSettingsContext.hxx
new file mode 100644
index 000000000000..79496296ff0e
--- /dev/null
+++ b/xmloff/source/chart/SchXMLCalculationSettingsContext.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_SCHXMLCALCULATIONSETTINGSCONTEXT_HXX
+#define _XMLOFF_SCHXMLCALCULATIONSETTINGSCONTEXT_HXX
+
+#include <xmloff/xmlictxt.hxx>
+
+class SchXMLCalculationSettingsContext : public SvXMLImportContext
+{
+ com::sun::star::uno::Any m_aNullDate;
+public:
+ SchXMLCalculationSettingsContext( SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void EndElement();
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/SchXMLChartContext.cxx b/xmloff/source/chart/SchXMLChartContext.cxx
new file mode 100644
index 000000000000..131b7a97e73e
--- /dev/null
+++ b/xmloff/source/chart/SchXMLChartContext.cxx
@@ -0,0 +1,1248 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "SchXMLChartContext.hxx"
+#include "SchXMLImport.hxx"
+#include "SchXMLLegendContext.hxx"
+#include "SchXMLPlotAreaContext.hxx"
+#include "SchXMLParagraphContext.hxx"
+#include "SchXMLTableContext.hxx"
+#include "SchXMLSeriesHelper.hxx"
+#include "SchXMLSeries2Context.hxx"
+#include "SchXMLTools.hxx"
+#include <comphelper/mediadescriptor.hxx>
+#include <tools/debug.hxx>
+// header for class ByteString
+#include <tools/string.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmlement.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmlstyle.hxx>
+#include <xmloff/prstylei.hxx>
+
+#include "vector"
+#include <com/sun/star/chart/XChartDocument.hpp>
+#include <com/sun/star/chart/XDiagram.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/util/XStringMapping.hpp>
+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/chart/ChartDataRowSource.hpp>
+#include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/embed/Aspects.hpp>
+#include <com/sun/star/embed/XVisualObject.hpp>
+
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/data/XDataSink.hpp>
+#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
+#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
+#include <com/sun/star/chart2/XChartTypeContainer.hpp>
+#include <com/sun/star/chart2/XTitled.hpp>
+
+using namespace com::sun::star;
+using namespace ::xmloff::token;
+using ::rtl::OUString;
+using com::sun::star::uno::Reference;
+using namespace ::SchXMLTools;
+
+namespace
+{
+
+void lcl_setRoleAtLabeledSequence(
+ const uno::Reference< chart2::data::XLabeledDataSequence > & xLSeq,
+ const ::rtl::OUString &rRole )
+{
+ // set role of sequence
+ uno::Reference< chart2::data::XDataSequence > xValues( xLSeq->getValues());
+ if( xValues.is())
+ {
+ uno::Reference< beans::XPropertySet > xProp( xValues, uno::UNO_QUERY );
+ if( xProp.is())
+ xProp->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM( "Role" )), uno::makeAny( rRole ));
+ }
+}
+
+void lcl_MoveDataToCandleStickSeries(
+ const uno::Reference< chart2::data::XDataSource > & xDataSource,
+ const uno::Reference< chart2::XDataSeries > & xDestination,
+ const OUString & rRole )
+{
+ try
+ {
+ uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aLabeledSeq(
+ xDataSource->getDataSequences());
+ if( aLabeledSeq.getLength())
+ {
+ lcl_setRoleAtLabeledSequence( aLabeledSeq[0], rRole );
+
+ // add to data series
+ uno::Reference< chart2::data::XDataSource > xSource( xDestination, uno::UNO_QUERY_THROW );
+ // @todo: realloc only once outside this function
+ uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aData( xSource->getDataSequences());
+ aData.realloc( aData.getLength() + 1);
+ aData[ aData.getLength() - 1 ] = aLabeledSeq[0];
+ uno::Reference< chart2::data::XDataSink > xSink( xDestination, uno::UNO_QUERY_THROW );
+ xSink->setData( aData );
+ }
+ }
+ catch( uno::Exception & )
+ {
+ OSL_FAIL( "Exception caught while moving data to candlestick series" );
+ }
+}
+
+void lcl_setRoleAtFirstSequence(
+ const uno::Reference< chart2::XDataSeries > & xSeries,
+ const ::rtl::OUString & rRole )
+{
+ uno::Reference< chart2::data::XDataSource > xSource( xSeries, uno::UNO_QUERY );
+ if( xSource.is())
+ {
+ uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aSeq( xSource->getDataSequences());
+ if( aSeq.getLength())
+ lcl_setRoleAtLabeledSequence( aSeq[0], rRole );
+ }
+}
+
+void lcl_removeEmptyChartTypeGroups( const uno::Reference< chart2::XChartDocument > & xDoc )
+{
+ if( ! xDoc.is())
+ return;
+
+ uno::Reference< chart2::XDiagram > xDia( xDoc->getFirstDiagram());
+ if( ! xDia.is())
+ return;
+
+ try
+ {
+ // count all charttype groups to be able to leave at least one
+ sal_Int32 nRemainingGroups = 0;
+ uno::Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xDia, uno::UNO_QUERY_THROW );
+ uno::Sequence< uno::Reference< chart2::XCoordinateSystem > >
+ aCooSysSeq( xCooSysCnt->getCoordinateSystems());
+ for( sal_Int32 nI = aCooSysSeq.getLength(); nI--; )
+ {
+ uno::Reference< chart2::XChartTypeContainer > xCTCnt( aCooSysSeq[nI], uno::UNO_QUERY_THROW );
+ nRemainingGroups += xCTCnt->getChartTypes().getLength();
+ }
+
+ // delete all empty groups, but leave at least group (empty or not)
+ for( sal_Int32 nI = aCooSysSeq.getLength(); nI-- && (nRemainingGroups > 1); )
+ {
+ uno::Reference< chart2::XChartTypeContainer > xCTCnt( aCooSysSeq[nI], uno::UNO_QUERY_THROW );
+ uno::Sequence< uno::Reference< chart2::XChartType > > aCTSeq( xCTCnt->getChartTypes());
+ for( sal_Int32 nJ=aCTSeq.getLength(); nJ-- && (nRemainingGroups > 1); )
+ {
+ uno::Reference< chart2::XDataSeriesContainer > xDSCnt( aCTSeq[nJ], uno::UNO_QUERY_THROW );
+ if( xDSCnt->getDataSeries().getLength() == 0 )
+ {
+ // note: iterator stays valid as we have a local sequence
+ xCTCnt->removeChartType( aCTSeq[nJ] );
+ --nRemainingGroups;
+ }
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ String aStr( ex.Message );
+ ByteString aBStr( aStr, RTL_TEXTENCODING_ASCII_US );
+ OSL_TRACE( "Exception caught while removing empty chart types: %s", aBStr.GetBuffer());
+ }
+}
+
+uno::Sequence< sal_Int32 > lcl_getNumberSequenceFromString( const ::rtl::OUString& rStr, bool bAddOneToEachOldIndex )
+{
+ const sal_Unicode aSpace( ' ' );
+
+ // count number of entries
+ ::std::vector< sal_Int32 > aVec;
+ sal_Int32 nLastPos = 0;
+ sal_Int32 nPos = 0;
+ while( nPos != -1 )
+ {
+ nPos = rStr.indexOf( aSpace, nLastPos );
+ if( nPos > nLastPos )
+ {
+ aVec.push_back( rStr.copy( nLastPos, (nPos - nLastPos) ).toInt32() );
+ }
+ if( nPos != -1 )
+ nLastPos = nPos + 1;
+ }
+ // last entry
+ if( nLastPos != 0 &&
+ rStr.getLength() > nLastPos )
+ {
+ aVec.push_back( rStr.copy( nLastPos, (rStr.getLength() - nLastPos) ).toInt32() );
+ }
+
+ const sal_Int32 nVecSize = aVec.size();
+ uno::Sequence< sal_Int32 > aSeq( nVecSize );
+
+ if(!bAddOneToEachOldIndex)
+ {
+ sal_Int32* pSeqArr = aSeq.getArray();
+ for( nPos = 0; nPos < nVecSize; ++nPos )
+ {
+ pSeqArr[ nPos ] = aVec[ nPos ];
+ }
+ }
+ else if( bAddOneToEachOldIndex )
+ {
+ aSeq.realloc( nVecSize+1 );
+ aSeq[0]=0;
+
+ sal_Int32* pSeqArr = aSeq.getArray();
+ for( nPos = 0; nPos < nVecSize; ++nPos )
+ {
+ pSeqArr[ nPos+1 ] = aVec[ nPos ]+1;
+ }
+ }
+
+ return aSeq;
+}
+
+} // anonymous namespace
+
+// ----------------------------------------
+
+SchXMLChartContext::SchXMLChartContext( SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport, const rtl::OUString& rLocalName ) :
+ SvXMLImportContext( rImport, XML_NAMESPACE_CHART, rLocalName ),
+ mrImportHelper( rImpHelper ),
+ m_bHasRangeAtPlotArea( false ),
+ m_bHasTableElement( false ),
+ mbAllRangeAddressesAvailable( sal_True ),
+ mbColHasLabels( sal_False ),
+ mbRowHasLabels( sal_False ),
+ meDataRowSource( chart::ChartDataRowSource_COLUMNS ),
+ mbIsStockChart( false )
+{
+}
+
+SchXMLChartContext::~SchXMLChartContext()
+{}
+
+void SchXMLChartContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ // parse attributes
+ sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
+ const SvXMLTokenMap& rAttrTokenMap = mrImportHelper.GetChartAttrTokenMap();
+
+ uno::Reference< embed::XVisualObject > xVisualObject( mrImportHelper.GetChartDocument(), uno::UNO_QUERY);
+ DBG_ASSERT(xVisualObject.is(),"need xVisualObject for page size");
+ if( xVisualObject.is() )
+ maChartSize = xVisualObject->getVisualAreaSize( embed::Aspects::MSOLE_CONTENT ); //#i103460# take the size given from the parent frame as default
+
+ // this flag is necessarry for pie charts in the core
+ sal_Bool bSetSwitchData = sal_False;
+
+ ::rtl::OUString sAutoStyleName;
+ ::rtl::OUString aOldChartTypeName;
+ bool bHasAddin = false;
+
+ for( sal_Int16 i = 0; i < nAttrCount; i++ )
+ {
+ rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
+ rtl::OUString aLocalName;
+ rtl::OUString aValue = xAttrList->getValueByIndex( i );
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+
+ switch( rAttrTokenMap.Get( nPrefix, aLocalName ))
+ {
+ case XML_TOK_CHART_HREF:
+ m_aXLinkHRefAttributeToIndicateDataProvider = aValue;
+ break;
+
+ case XML_TOK_CHART_CLASS:
+ {
+ rtl::OUString sClassName;
+ sal_uInt16 nClassPrefix =
+ GetImport().GetNamespaceMap().GetKeyByAttrName(
+ aValue, &sClassName );
+ if( XML_NAMESPACE_CHART == nClassPrefix )
+ {
+ SchXMLChartTypeEnum eChartTypeEnum = SchXMLTools::GetChartTypeEnum( sClassName );
+ if( eChartTypeEnum != XML_CHART_CLASS_UNKNOWN )
+ {
+ aOldChartTypeName = SchXMLTools::GetChartTypeByClassName( sClassName, true /* bUseOldNames */ );
+ maChartTypeServiceName = SchXMLTools::GetChartTypeByClassName( sClassName, false /* bUseOldNames */ );
+ switch( eChartTypeEnum )
+ {
+ case XML_CHART_CLASS_CIRCLE:
+ bSetSwitchData = sal_True;
+ break;
+ case XML_CHART_CLASS_STOCK:
+ mbIsStockChart = true;
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ else if( XML_NAMESPACE_OOO == nClassPrefix )
+ {
+ // service is taken from add-in-name attribute
+ bHasAddin = true;
+
+ aOldChartTypeName = sClassName;
+ maChartTypeServiceName = sClassName;
+ }
+ }
+ break;
+
+ case XML_TOK_CHART_WIDTH:
+ GetImport().GetMM100UnitConverter().convertMeasure( maChartSize.Width, aValue );
+ break;
+
+ case XML_TOK_CHART_HEIGHT:
+ GetImport().GetMM100UnitConverter().convertMeasure( maChartSize.Height, aValue );
+ break;
+
+ case XML_TOK_CHART_STYLE_NAME:
+ sAutoStyleName = aValue;
+ break;
+
+ case XML_TOK_CHART_COL_MAPPING:
+ msColTrans = aValue;
+ break;
+ case XML_TOK_CHART_ROW_MAPPING:
+ msRowTrans = aValue;
+ break;
+ }
+ }
+
+ if( aOldChartTypeName.getLength()<= 0 )
+ {
+ OSL_FAIL( "need a charttype to create a diagram" );
+ //set a fallback value:
+ ::rtl::OUString aChartClass_Bar( GetXMLToken(XML_BAR ) );
+ aOldChartTypeName = SchXMLTools::GetChartTypeByClassName( aChartClass_Bar, true /* bUseOldNames */ );
+ maChartTypeServiceName = SchXMLTools::GetChartTypeByClassName( aChartClass_Bar, false /* bUseOldNames */ );
+ }
+
+ // Set the size of the draw page.
+ if( xVisualObject.is() )
+ xVisualObject->setVisualAreaSize( embed::Aspects::MSOLE_CONTENT, maChartSize );
+
+ InitChart( aOldChartTypeName, bSetSwitchData);
+
+ if( bHasAddin )
+ {
+ //correct charttype serveice name when having an addin
+ //and don't refresh addin during load
+ uno::Reference< beans::XPropertySet > xDocProp( mrImportHelper.GetChartDocument(), uno::UNO_QUERY );
+ if( xDocProp.is() )
+ {
+ try
+ {
+ xDocProp->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "BaseDiagram" ))) >>= aOldChartTypeName;
+ maChartTypeServiceName = SchXMLTools::GetNewChartTypeName( aOldChartTypeName );
+ xDocProp->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RefreshAddInAllowed" )) , uno::makeAny( sal_False) );
+ }
+ catch( uno::Exception & )
+ {
+ OSL_FAIL( "Exception during import SchXMLChartContext::StartElement" );
+ }
+ }
+ }
+
+ // set auto-styles for Area
+ uno::Reference< beans::XPropertySet > xProp( mrImportHelper.GetChartDocument()->getArea(), uno::UNO_QUERY );
+ if( xProp.is())
+ {
+ const SvXMLStylesContext* pStylesCtxt = mrImportHelper.GetAutoStylesContext();
+ if( pStylesCtxt )
+ {
+ const SvXMLStyleContext* pStyle = pStylesCtxt->FindStyleChildContext(
+ mrImportHelper.GetChartFamilyID(), sAutoStyleName );
+
+ if( pStyle && pStyle->ISA( XMLPropStyleContext ))
+ (( XMLPropStyleContext* )pStyle )->FillPropertySet( xProp );
+ }
+ }
+}
+
+namespace
+{
+
+struct NewDonutSeries
+{
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > m_xSeries;
+ ::rtl::OUString msStyleName;
+ sal_Int32 mnAttachedAxis;
+
+ ::std::vector< ::rtl::OUString > m_aSeriesStyles;
+ ::std::vector< ::rtl::OUString > m_aPointStyles;
+
+ NewDonutSeries( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >& xSeries, sal_Int32 nPointCount )
+ : m_xSeries( xSeries )
+ , mnAttachedAxis( 1 )
+ {
+ m_aPointStyles.resize(nPointCount);
+ m_aSeriesStyles.resize(nPointCount);
+ }
+
+ void setSeriesStyleNameToPoint( const ::rtl::OUString& rStyleName, sal_Int32 nPointIndex )
+ {
+ DBG_ASSERT(nPointIndex < static_cast<sal_Int32>(m_aSeriesStyles.size()),"donut point <-> series count mismatch");
+ if( nPointIndex < static_cast<sal_Int32>(m_aSeriesStyles.size()) )
+ m_aSeriesStyles[nPointIndex]=rStyleName;
+ }
+
+ void setPointStyleNameToPoint( const ::rtl::OUString& rStyleName, sal_Int32 nPointIndex )
+ {
+ DBG_ASSERT(nPointIndex < static_cast<sal_Int32>(m_aPointStyles.size()),"donut point <-> series count mismatch");
+ if( nPointIndex < static_cast<sal_Int32>(m_aPointStyles.size()) )
+ m_aPointStyles[nPointIndex]=rStyleName;
+ }
+
+ ::std::list< DataRowPointStyle > creatStyleList()
+ {
+ ::std::list< DataRowPointStyle > aRet;
+
+ DataRowPointStyle aSeriesStyle( DataRowPointStyle::DATA_SERIES
+ , m_xSeries, -1, 1, msStyleName, mnAttachedAxis );
+ aRet.push_back( aSeriesStyle );
+
+ sal_Int32 nPointIndex=0;
+ ::std::vector< ::rtl::OUString >::iterator aPointIt( m_aPointStyles.begin() );
+ ::std::vector< ::rtl::OUString >::iterator aPointEnd( m_aPointStyles.end() );
+ while( aPointIt != aPointEnd )
+ {
+ DataRowPointStyle aPointStyle( DataRowPointStyle::DATA_POINT
+ , m_xSeries, nPointIndex, 1, *aPointIt, mnAttachedAxis );
+ if( nPointIndex < static_cast<sal_Int32>(m_aSeriesStyles.size()) )
+ {
+ aPointStyle.msSeriesStyleNameForDonuts = m_aSeriesStyles[nPointIndex];
+ }
+ if( aPointStyle.msSeriesStyleNameForDonuts.getLength()
+ || aPointStyle.msStyleName.getLength() )
+ aRet.push_back( aPointStyle );
+ ++aPointIt;
+ ++nPointIndex;
+ }
+
+ return aRet;
+ }
+};
+
+void lcl_swapPointAndSeriesStylesForDonutCharts( ::std::list< DataRowPointStyle >& rStyleList
+ , const ::std::map< ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries> , sal_Int32 >& rSeriesMap )
+{
+ ::std::list< DataRowPointStyle >::iterator aIt(rStyleList.begin());
+ ::std::list< DataRowPointStyle >::iterator aEnd(rStyleList.end());
+
+ //detect old series count
+ //and add old series to aSeriesMap
+ ::std::map< ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >, sal_Int32 > aSeriesMap(rSeriesMap);
+ sal_Int32 nOldSeriesCount = 0;
+ {
+ sal_Int32 nMaxOldSeriesIndex = 0;
+ sal_Int32 nOldSeriesIndex = 0;
+ for( aIt = rStyleList.begin(); aIt != aEnd; ++aIt )
+ {
+ DataRowPointStyle aStyle(*aIt);
+ if(aStyle.meType == DataRowPointStyle::DATA_SERIES &&
+ aStyle.m_xSeries.is() )
+ {
+ nMaxOldSeriesIndex = nOldSeriesIndex;
+
+ if( aSeriesMap.end() == aSeriesMap.find(aStyle.m_xSeries) )
+ aSeriesMap[aStyle.m_xSeries] = nOldSeriesIndex;
+
+ nOldSeriesIndex++;
+ }
+ }
+ nOldSeriesCount = nMaxOldSeriesIndex+1;
+ }
+
+
+ //initialize new series styles
+ ::std::map< Reference< chart2::XDataSeries >, sal_Int32 >::const_iterator aSeriesMapIt( aSeriesMap.begin() );
+ ::std::map< Reference< chart2::XDataSeries >, sal_Int32 >::const_iterator aSeriesMapEnd( aSeriesMap.end() );
+
+ //sort by index
+ ::std::vector< NewDonutSeries > aNewSeriesVector;
+ {
+ ::std::map< sal_Int32, Reference< chart2::XDataSeries > > aIndexSeriesMap;
+ for( ; aSeriesMapIt != aSeriesMapEnd; ++aSeriesMapIt )
+ aIndexSeriesMap[aSeriesMapIt->second] = aSeriesMapIt->first;
+
+ ::std::map< sal_Int32, Reference< chart2::XDataSeries > >::const_iterator aIndexIt( aIndexSeriesMap.begin() );
+ ::std::map< sal_Int32, Reference< chart2::XDataSeries > >::const_iterator aIndexEnd( aIndexSeriesMap.end() );
+
+ for( ; aIndexIt != aIndexEnd; ++aIndexIt )
+ aNewSeriesVector.push_back( NewDonutSeries(aIndexIt->second,nOldSeriesCount) );
+ }
+
+ //overwrite attached axis information according to old series styles
+ for( aIt = rStyleList.begin(); aIt != aEnd; ++aIt )
+ {
+ DataRowPointStyle aStyle(*aIt);
+ if(aStyle.meType == DataRowPointStyle::DATA_SERIES )
+ {
+ aSeriesMapIt = aSeriesMap.find( aStyle.m_xSeries );
+ if( aSeriesMapIt != aSeriesMapEnd && aSeriesMapIt->second < static_cast<sal_Int32>(aNewSeriesVector.size()) )
+ aNewSeriesVector[aSeriesMapIt->second].mnAttachedAxis = aStyle.mnAttachedAxis;
+ }
+ }
+
+ //overwrite new series style names with old series style name information
+ for( aIt = rStyleList.begin(); aIt != aEnd; ++aIt )
+ {
+ DataRowPointStyle aStyle(*aIt);
+ if( aStyle.meType == DataRowPointStyle::DATA_SERIES )
+ {
+ aSeriesMapIt = aSeriesMap.find(aStyle.m_xSeries);
+ if( aSeriesMapEnd != aSeriesMapIt )
+ {
+ sal_Int32 nNewPointIndex = aSeriesMapIt->second;
+
+ ::std::vector< NewDonutSeries >::iterator aNewSeriesIt( aNewSeriesVector.begin() );
+ ::std::vector< NewDonutSeries >::iterator aNewSeriesEnd( aNewSeriesVector.end() );
+
+ for( ;aNewSeriesIt!=aNewSeriesEnd; ++aNewSeriesIt)
+ aNewSeriesIt->setSeriesStyleNameToPoint( aStyle.msStyleName, nNewPointIndex );
+ }
+ }
+ }
+
+ //overwrite new series style names with point style name information
+ for( aIt = rStyleList.begin(); aIt != aEnd; ++aIt )
+ {
+ DataRowPointStyle aStyle(*aIt);
+ if( aStyle.meType == DataRowPointStyle::DATA_POINT )
+ {
+ aSeriesMapIt = aSeriesMap.find(aStyle.m_xSeries);
+ if( aSeriesMapEnd != aSeriesMapIt )
+ {
+ sal_Int32 nNewPointIndex = aSeriesMapIt->second;
+ sal_Int32 nNewSeriesIndex = aStyle.m_nPointIndex;
+ sal_Int32 nRepeatCount = aStyle.m_nPointRepeat;
+
+ while( nRepeatCount && (nNewSeriesIndex>=0) && (nNewSeriesIndex< static_cast<sal_Int32>(aNewSeriesVector.size()) ) )
+ {
+ NewDonutSeries& rNewSeries( aNewSeriesVector[nNewSeriesIndex] );
+ rNewSeries.setPointStyleNameToPoint( aStyle.msStyleName, nNewPointIndex );
+
+ nRepeatCount--;
+ nNewSeriesIndex++;
+ }
+ }
+ }
+ }
+
+ //put information from aNewSeriesVector to output parameter rStyleList
+ rStyleList.clear();
+
+ ::std::vector< NewDonutSeries >::iterator aNewSeriesIt( aNewSeriesVector.begin() );
+ ::std::vector< NewDonutSeries >::iterator aNewSeriesEnd( aNewSeriesVector.end() );
+ for( ;aNewSeriesIt!=aNewSeriesEnd; ++aNewSeriesIt)
+ {
+ ::std::list< DataRowPointStyle > aList( aNewSeriesIt->creatStyleList() );
+ rStyleList.insert(rStyleList.end(),aList.begin(),aList.end());
+ }
+}
+
+bool lcl_SpecialHandlingForDonutChartNeeded(
+ const ::rtl::OUString & rServiceName,
+ const SvXMLImport & rImport )
+{
+ bool bResult = false;
+ if( rServiceName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "com.sun.star.chart2.DonutChartType" )))
+ {
+ bResult = SchXMLTools::isDocumentGeneratedWithOpenOfficeOlderThan2_3( rImport.GetModel() );
+ }
+ return bResult;
+}
+
+} // anonymous namespace
+
+
+void lcl_ApplyDataFromRectangularRangeToDiagram(
+ const uno::Reference< chart2::XChartDocument >& xNewDoc
+ , const rtl::OUString& rRectangularRange
+ , ::com::sun::star::chart::ChartDataRowSource eDataRowSource
+ , bool bRowHasLabels, bool bColHasLabels
+ , bool bSwitchOnLabelsAndCategoriesForOwnData
+ , const rtl::OUString& sColTrans
+ , const rtl::OUString& sRowTrans )
+{
+ if( !xNewDoc.is() )
+ return;
+
+ uno::Reference< chart2::XDiagram > xNewDia( xNewDoc->getFirstDiagram());
+ uno::Reference< chart2::data::XDataProvider > xDataProvider( xNewDoc->getDataProvider() );
+ if( !xNewDia.is() || !xDataProvider.is() )
+ return;
+
+ sal_Bool bFirstCellAsLabel =
+ (eDataRowSource==chart::ChartDataRowSource_COLUMNS)? bRowHasLabels : bColHasLabels;
+ sal_Bool bHasCateories =
+ (eDataRowSource==chart::ChartDataRowSource_COLUMNS)? bColHasLabels : bRowHasLabels;
+
+ if( bSwitchOnLabelsAndCategoriesForOwnData )
+ {
+ bFirstCellAsLabel = true;
+ bHasCateories = true;
+ }
+
+ uno::Sequence< beans::PropertyValue > aArgs( 3 );
+ aArgs[0] = beans::PropertyValue(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "CellRangeRepresentation" )),
+ -1, uno::makeAny( rRectangularRange ),
+ beans::PropertyState_DIRECT_VALUE );
+ aArgs[1] = beans::PropertyValue(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DataRowSource" )),
+ -1, uno::makeAny( eDataRowSource ),
+ beans::PropertyState_DIRECT_VALUE );
+ aArgs[2] = beans::PropertyValue(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "FirstCellAsLabel" )),
+ -1, uno::makeAny( bFirstCellAsLabel ),
+ beans::PropertyState_DIRECT_VALUE );
+
+ if( sColTrans.getLength() || sRowTrans.getLength() )
+ {
+ aArgs.realloc( aArgs.getLength() + 1 );
+ aArgs[ aArgs.getLength() - 1 ] = beans::PropertyValue(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "SequenceMapping" )),
+ -1, uno::makeAny( sColTrans.getLength()
+ ? lcl_getNumberSequenceFromString( sColTrans, bHasCateories && !xNewDoc->hasInternalDataProvider() )
+ : lcl_getNumberSequenceFromString( sRowTrans, bHasCateories && !xNewDoc->hasInternalDataProvider() ) ),
+ beans::PropertyState_DIRECT_VALUE );
+ }
+
+ //work around wrong writer ranges ( see Issue 58464 )
+ {
+ rtl::OUString aChartOleObjectName;
+ uno::Reference< frame::XModel > xModel(xNewDoc, uno::UNO_QUERY );
+ if( xModel.is() )
+ {
+ comphelper::MediaDescriptor aMediaDescriptor( xModel->getArgs() );
+
+ comphelper::MediaDescriptor::const_iterator aIt(
+ aMediaDescriptor.find( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HierarchicalDocumentName" ))));
+ if( aIt != aMediaDescriptor.end() )
+ {
+ aChartOleObjectName = (*aIt).second.get< ::rtl::OUString >();
+ }
+ }
+ if( aChartOleObjectName.getLength() )
+ {
+ aArgs.realloc( aArgs.getLength() + 1 );
+ aArgs[ aArgs.getLength() - 1 ] = beans::PropertyValue(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ChartOleObjectName" )),
+ -1, uno::makeAny( aChartOleObjectName ),
+ beans::PropertyState_DIRECT_VALUE );
+ }
+ }
+
+
+ uno::Reference< chart2::data::XDataSource > xDataSource(
+ xDataProvider->createDataSource( aArgs ));
+
+ aArgs.realloc( aArgs.getLength() + 2 );
+ aArgs[ aArgs.getLength() - 2 ] = beans::PropertyValue(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasCategories" )),
+ -1, uno::makeAny( bHasCateories ),
+ beans::PropertyState_DIRECT_VALUE );
+ aArgs[ aArgs.getLength() - 1 ] = beans::PropertyValue(
+ ::rtl::OUString::createFromAscii("UseCategoriesAsX"),
+ -1, uno::makeAny( sal_False ),//categories in ODF files are not to be used as x values (independent from what is offered in our ui)
+ beans::PropertyState_DIRECT_VALUE );
+
+ xNewDia->setDiagramData( xDataSource, aArgs );
+}
+
+void SchXMLChartContext::EndElement()
+{
+ uno::Reference< chart::XChartDocument > xDoc = mrImportHelper.GetChartDocument();
+ uno::Reference< beans::XPropertySet > xProp( xDoc, uno::UNO_QUERY );
+ uno::Reference< chart2::XChartDocument > xNewDoc( xDoc, uno::UNO_QUERY );
+
+ if( xProp.is())
+ {
+ if( maMainTitle.getLength())
+ {
+ uno::Reference< beans::XPropertySet > xTitleProp( xDoc->getTitle(), uno::UNO_QUERY );
+ if( xTitleProp.is())
+ {
+ try
+ {
+ uno::Any aAny;
+ aAny <<= maMainTitle;
+ xTitleProp->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "String" )), aAny );
+ }
+ catch( beans::UnknownPropertyException )
+ {
+ OSL_FAIL( "Property String for Title not available" );
+ }
+ }
+ }
+ if( maSubTitle.getLength())
+ {
+ uno::Reference< beans::XPropertySet > xTitleProp( xDoc->getSubTitle(), uno::UNO_QUERY );
+ if( xTitleProp.is())
+ {
+ try
+ {
+ uno::Any aAny;
+ aAny <<= maSubTitle;
+ xTitleProp->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "String" )), aAny );
+ }
+ catch( beans::UnknownPropertyException )
+ {
+ OSL_FAIL( "Property String for Title not available" );
+ }
+ }
+ }
+ }
+
+ // cleanup: remove empty chart type groups
+ lcl_removeEmptyChartTypeGroups( xNewDoc );
+
+ // set stack mode before a potential chart type detection (in case we have a rectangular range)
+ uno::Reference< chart::XDiagram > xDiagram( xDoc->getDiagram() );
+ uno::Reference< beans::XPropertySet > xDiaProp( xDiagram, uno::UNO_QUERY );
+ if( xDiaProp.is())
+ {
+ if( maSeriesDefaultsAndStyles.maStackedDefault.hasValue())
+ xDiaProp->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Stacked")),maSeriesDefaultsAndStyles.maStackedDefault);
+ if( maSeriesDefaultsAndStyles.maPercentDefault.hasValue())
+ xDiaProp->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Percent")),maSeriesDefaultsAndStyles.maPercentDefault);
+ if( maSeriesDefaultsAndStyles.maDeepDefault.hasValue())
+ xDiaProp->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Deep")),maSeriesDefaultsAndStyles.maDeepDefault);
+ if( maSeriesDefaultsAndStyles.maStackedBarsConnectedDefault.hasValue())
+ xDiaProp->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StackedBarsConnected")),maSeriesDefaultsAndStyles.maStackedBarsConnectedDefault);
+ }
+
+ //the OOo 2.0 implementation and older has a bug with donuts
+ bool bSpecialHandlingForDonutChart = lcl_SpecialHandlingForDonutChartNeeded(
+ maChartTypeServiceName, GetImport());
+
+ // apply data
+ if(!xNewDoc.is())
+ return;
+
+ bool bHasOwnData = false;
+ if( m_aXLinkHRefAttributeToIndicateDataProvider.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "." ) ) ) //data comes from the chart itself
+ bHasOwnData = true;
+ else if( m_aXLinkHRefAttributeToIndicateDataProvider.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ".." ) ) ) //data comes from the parent application
+ bHasOwnData = false;
+ else if( m_aXLinkHRefAttributeToIndicateDataProvider.getLength() ) //not supported so far to get the data by sibling objects -> fall back to chart itself if data are available
+ bHasOwnData = m_bHasTableElement;
+ else
+ bHasOwnData = !m_bHasRangeAtPlotArea;
+
+ if( xNewDoc->hasInternalDataProvider())
+ {
+ if( !m_bHasTableElement && !m_aXLinkHRefAttributeToIndicateDataProvider.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "." ) ) )
+ {
+ //#i103147# ODF, workaround broken files with a missing table:cell-range-address at the plot-area
+ bool bSwitchSuccessful = SchXMLTools::switchBackToDataProviderFromParent( xNewDoc, maLSequencesPerIndex );
+ bHasOwnData = !bSwitchSuccessful;
+ }
+ else
+ bHasOwnData = true;//e.g. in case of copy->paste from calc to impress
+ }
+ else if( bHasOwnData )
+ {
+ xNewDoc->createInternalDataProvider( sal_False /* bCloneExistingData */ );
+ }
+ if( bHasOwnData )
+ msChartAddress = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "all" ));
+
+ bool bSwitchRangesFromOuterToInternalIfNecessary = false;
+ if( !bHasOwnData && mbAllRangeAddressesAvailable )
+ {
+ // special handling for stock chart (merge series together)
+ if( mbIsStockChart )
+ MergeSeriesForStockChart();
+ }
+ else if( msChartAddress.getLength() )
+ {
+ //own data or only rectangular range available
+
+ if( xNewDoc->hasInternalDataProvider() )
+ SchXMLTableHelper::applyTableToInternalDataProvider( maTable, xNewDoc );
+
+ bool bOlderThan2_3 = SchXMLTools::isDocumentGeneratedWithOpenOfficeOlderThan2_3( Reference< frame::XModel >( xNewDoc, uno::UNO_QUERY ));
+ bool bOldFileWithOwnDataFromRows = (bOlderThan2_3 && bHasOwnData && (meDataRowSource==chart::ChartDataRowSource_ROWS)); // in this case there are range addresses that are simply wrong.
+
+ if( mbAllRangeAddressesAvailable && !bSpecialHandlingForDonutChart && !mbIsStockChart &&
+ !bOldFileWithOwnDataFromRows )
+ {
+ //bHasOwnData is true in this case!
+ //e.g. for normal files with own data or also in case of copy paste scenario (e.g. calc to impress)
+ bSwitchRangesFromOuterToInternalIfNecessary = true;
+ }
+ else
+ {
+ //apply data from rectangular range
+
+ // create datasource from data provider with rectangular range parameters and change the diagram setDiagramData
+ try
+ {
+ if( bOlderThan2_3 && xDiaProp.is() )//for older charts the hidden cells were removed by calc on the fly
+ xDiaProp->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IncludeHiddenCells")),uno::makeAny(false));
+
+ // note: mbRowHasLabels means the first row contains labels, that means we have "column-descriptions",
+ // (analogously mbColHasLabels means we have "row-descriptions")
+ lcl_ApplyDataFromRectangularRangeToDiagram( xNewDoc, msChartAddress, meDataRowSource, mbRowHasLabels, mbColHasLabels, bHasOwnData, msColTrans, msRowTrans );
+ }
+ catch( uno::Exception & )
+ {
+ //try to fallback to internal data
+ OSL_FAIL( "Exception during import SchXMLChartContext::lcl_ApplyDataFromRectangularRangeToDiagram try to fallback to internal data" );
+ if(!bHasOwnData)
+ {
+ bHasOwnData = true;
+ msChartAddress = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "all" ));
+ if( !xNewDoc->hasInternalDataProvider() )
+ {
+ xNewDoc->createInternalDataProvider( sal_False /* bCloneExistingData */ );
+ SchXMLTableHelper::applyTableToInternalDataProvider( maTable, xNewDoc );
+ try
+ {
+ lcl_ApplyDataFromRectangularRangeToDiagram( xNewDoc, msChartAddress, meDataRowSource, mbRowHasLabels, mbColHasLabels, bHasOwnData, msColTrans, msRowTrans );
+ }
+ catch( uno::Exception & )
+ {
+ OSL_FAIL( "Exception during import SchXMLChartContext::lcl_ApplyDataFromRectangularRangeToDiagram fallback to internal data failed also" );
+ }
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ OSL_FAIL( " Must not get here" );
+ }
+
+ // now all series and data point properties are available and can be set
+ {
+ if( bSpecialHandlingForDonutChart )
+ {
+ uno::Reference< chart2::XDiagram > xNewDiagram( xNewDoc->getFirstDiagram() );
+ lcl_swapPointAndSeriesStylesForDonutCharts( maSeriesDefaultsAndStyles.maSeriesStyleList
+ , SchXMLSeriesHelper::getDataSeriesIndexMapFromDiagram(xNewDiagram) );
+ }
+
+ SchXMLSeries2Context::initSeriesPropertySets( maSeriesDefaultsAndStyles, uno::Reference< frame::XModel >(xDoc, uno::UNO_QUERY ) );
+
+ //set defaults from diagram to the new series:
+ //check whether we need to remove lines from symbol only charts
+ bool bSwitchOffLinesForScatter = false;
+ {
+ bool bLinesOn = true;
+ if( (maSeriesDefaultsAndStyles.maLinesOnProperty >>= bLinesOn) && !bLinesOn )
+ {
+ if( 0 == maChartTypeServiceName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.chart2.ScatterChartType" ) ) )
+ {
+ bSwitchOffLinesForScatter = true;
+ SchXMLSeries2Context::switchSeriesLinesOff( maSeriesDefaultsAndStyles.maSeriesStyleList );
+ }
+ }
+ }
+ SchXMLSeries2Context::setDefaultsToSeries( maSeriesDefaultsAndStyles );
+
+ // set autostyles for series and data points
+ const SvXMLStylesContext* pStylesCtxt = mrImportHelper.GetAutoStylesContext();
+ const SvXMLStyleContext* pStyle = NULL;
+ ::rtl::OUString sCurrStyleName;
+
+ if( pStylesCtxt )
+ {
+ //iterate over data-series first
+ //don't set series styles for donut charts
+ if( !bSpecialHandlingForDonutChart )
+ {
+ SchXMLSeries2Context::setStylesToSeries( maSeriesDefaultsAndStyles
+ , pStylesCtxt, pStyle, sCurrStyleName, mrImportHelper, GetImport(), mbIsStockChart, maLSequencesPerIndex );
+ // ... then set attributes for statistics (after their existence was set in the series)
+ SchXMLSeries2Context::setStylesToStatisticsObjects( maSeriesDefaultsAndStyles
+ , pStylesCtxt, pStyle, sCurrStyleName );
+ }
+ }
+
+ //#i98319# call switchRangesFromOuterToInternalIfNecessary before the data point styles are applied, otherwise in copy->paste scenario the data point styles do get lost
+ if( bSwitchRangesFromOuterToInternalIfNecessary )
+ {
+ if( xNewDoc->hasInternalDataProvider() )
+ SchXMLTableHelper::switchRangesFromOuterToInternalIfNecessary( maTable, maLSequencesPerIndex, xNewDoc, meDataRowSource );
+ }
+
+ if( pStylesCtxt )
+ {
+ // ... then iterate over data-point attributes, so the latter are not overwritten
+ SchXMLSeries2Context::setStylesToDataPoints( maSeriesDefaultsAndStyles
+ , pStylesCtxt, pStyle, sCurrStyleName, mrImportHelper, GetImport(), mbIsStockChart, bSpecialHandlingForDonutChart, bSwitchOffLinesForScatter );
+ }
+ }
+
+ if( xProp.is())
+ xProp->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RefreshAddInAllowed" )) , uno::makeAny( sal_True) );
+}
+
+void SchXMLChartContext::MergeSeriesForStockChart()
+{
+ OSL_ASSERT( mbIsStockChart );
+ try
+ {
+ uno::Reference< chart::XChartDocument > xOldDoc( mrImportHelper.GetChartDocument());
+ uno::Reference< chart2::XChartDocument > xDoc( xOldDoc, uno::UNO_QUERY_THROW );
+ uno::Reference< chart2::XDiagram > xDiagram( xDoc->getFirstDiagram());
+ if( ! xDiagram.is())
+ return;
+
+ bool bHasJapaneseCandlestick = true;
+ uno::Reference< chart2::XDataSeriesContainer > xDSContainer;
+ uno::Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY_THROW );
+ uno::Sequence< uno::Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems());
+ for( sal_Int32 nCooSysIdx=0; nCooSysIdx<aCooSysSeq.getLength(); ++nCooSysIdx )
+ {
+ uno::Reference< chart2::XChartTypeContainer > xCTCnt( aCooSysSeq[nCooSysIdx], uno::UNO_QUERY_THROW );
+ uno::Sequence< uno::Reference< chart2::XChartType > > aChartTypes( xCTCnt->getChartTypes());
+ for( sal_Int32 nCTIdx=0; nCTIdx<aChartTypes.getLength(); ++nCTIdx )
+ {
+ if( aChartTypes[nCTIdx]->getChartType().equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("com.sun.star.chart2.CandleStickChartType")))
+ {
+ xDSContainer.set( aChartTypes[nCTIdx], uno::UNO_QUERY_THROW );
+ uno::Reference< beans::XPropertySet > xCTProp( aChartTypes[nCTIdx], uno::UNO_QUERY_THROW );
+ xCTProp->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Japanese" ))) >>= bHasJapaneseCandlestick;
+ break;
+ }
+ }
+ }
+
+ if( xDSContainer.is())
+ {
+ // with japanese candlesticks: open, low, high, close
+ // otherwise: low, high, close
+ uno::Sequence< uno::Reference< chart2::XDataSeries > > aSeriesSeq( xDSContainer->getDataSeries());
+ const sal_Int32 nSeriesCount( aSeriesSeq.getLength());
+ const sal_Int32 nSeriesPerCandleStick = bHasJapaneseCandlestick ? 4: 3;
+ sal_Int32 nCandleStickCount = nSeriesCount / nSeriesPerCandleStick;
+ OSL_ASSERT( nSeriesPerCandleStick * nCandleStickCount == nSeriesCount );
+ uno::Sequence< uno::Reference< chart2::XDataSeries > > aNewSeries( nCandleStickCount );
+ for( sal_Int32 i=0; i<nCandleStickCount; ++i )
+ {
+ sal_Int32 nSeriesIndex = i*nSeriesPerCandleStick;
+ if( bHasJapaneseCandlestick )
+ {
+ // open values
+ lcl_setRoleAtFirstSequence( aSeriesSeq[ nSeriesIndex ], OUString(RTL_CONSTASCII_USTRINGPARAM( "values-first" )));
+ aNewSeries[i] = aSeriesSeq[ nSeriesIndex ];
+ // low values
+ lcl_MoveDataToCandleStickSeries(
+ uno::Reference< chart2::data::XDataSource >( aSeriesSeq[ ++nSeriesIndex ], uno::UNO_QUERY_THROW ),
+ aNewSeries[i], OUString(RTL_CONSTASCII_USTRINGPARAM( "values-min" )));
+ }
+ else
+ {
+ // low values
+ lcl_setRoleAtFirstSequence( aSeriesSeq[ nSeriesIndex ], OUString(RTL_CONSTASCII_USTRINGPARAM( "values-min" )));
+ aNewSeries[i] = aSeriesSeq[ nSeriesIndex ];
+ }
+ // high values
+ lcl_MoveDataToCandleStickSeries(
+ uno::Reference< chart2::data::XDataSource >( aSeriesSeq[ ++nSeriesIndex ], uno::UNO_QUERY_THROW ),
+ aNewSeries[i], OUString(RTL_CONSTASCII_USTRINGPARAM( "values-max" )));
+ // close values
+ lcl_MoveDataToCandleStickSeries(
+ uno::Reference< chart2::data::XDataSource >( aSeriesSeq[ ++nSeriesIndex ], uno::UNO_QUERY_THROW ),
+ aNewSeries[i], OUString(RTL_CONSTASCII_USTRINGPARAM( "values-last" )));
+ }
+ xDSContainer->setDataSeries( aNewSeries );
+ }
+ }
+ catch( uno::Exception & )
+ {
+ OSL_FAIL( "Exception while merging series for stock chart" );
+ }
+}
+
+SvXMLImportContext* SchXMLChartContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ static const sal_Bool bTrue = sal_True;
+ static const uno::Any aTrueBool( &bTrue, ::getBooleanCppuType());
+
+ SvXMLImportContext* pContext = 0;
+ const SvXMLTokenMap& rTokenMap = mrImportHelper.GetChartElemTokenMap();
+ uno::Reference< chart::XChartDocument > xDoc = mrImportHelper.GetChartDocument();
+ uno::Reference< beans::XPropertySet > xProp( xDoc, uno::UNO_QUERY );
+
+ switch( rTokenMap.Get( nPrefix, rLocalName ))
+ {
+ case XML_TOK_CHART_PLOT_AREA:
+ pContext = new SchXMLPlotAreaContext( mrImportHelper, GetImport(), rLocalName,
+ m_aXLinkHRefAttributeToIndicateDataProvider,
+ maSeriesAddresses, msCategoriesAddress,
+ msChartAddress, m_bHasRangeAtPlotArea, mbAllRangeAddressesAvailable,
+ mbColHasLabels, mbRowHasLabels,
+ meDataRowSource,
+ maSeriesDefaultsAndStyles,
+ maChartTypeServiceName,
+ maLSequencesPerIndex, maChartSize );
+ break;
+
+ case XML_TOK_CHART_TITLE:
+ if( xDoc.is())
+ {
+ if( xProp.is())
+ {
+ xProp->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasMainTitle" )), aTrueBool );
+ }
+ uno::Reference< drawing::XShape > xTitleShape( xDoc->getTitle(), uno::UNO_QUERY );
+ pContext = new SchXMLTitleContext( mrImportHelper, GetImport(),
+ rLocalName, maMainTitle, xTitleShape );
+ }
+ break;
+
+ case XML_TOK_CHART_SUBTITLE:
+ if( xDoc.is())
+ {
+ if( xProp.is())
+ {
+ xProp->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasSubTitle" )), aTrueBool );
+ }
+ uno::Reference< drawing::XShape > xTitleShape( xDoc->getSubTitle(), uno::UNO_QUERY );
+ pContext = new SchXMLTitleContext( mrImportHelper, GetImport(),
+ rLocalName, maSubTitle, xTitleShape );
+ }
+ break;
+
+ case XML_TOK_CHART_LEGEND:
+ pContext = new SchXMLLegendContext( mrImportHelper, GetImport(), rLocalName );
+ break;
+
+ case XML_TOK_CHART_TABLE:
+ {
+ SchXMLTableContext * pTableContext =
+ new SchXMLTableContext( mrImportHelper, GetImport(), rLocalName, maTable );
+ m_bHasTableElement = true;
+ // #i85913# take into account column- and row- mapping for
+ // charts with own data only for those which were not copied
+ // from a place where they got data from the container. Note,
+ // that this requires the plot-area been read before the table
+ // (which is required in the ODF spec)
+ // Note: For stock charts and donut charts with special handling
+ // the mapping must not be applied!
+ if( !msChartAddress.getLength() && !mbIsStockChart &&
+ !lcl_SpecialHandlingForDonutChartNeeded(
+ maChartTypeServiceName, GetImport()))
+ {
+ if( msColTrans.getLength() > 0 )
+ {
+ OSL_ASSERT( msRowTrans.getLength() == 0 );
+ pTableContext->setColumnPermutation( lcl_getNumberSequenceFromString( msColTrans, true ));
+ msColTrans = OUString();
+ }
+ else if( msRowTrans.getLength() > 0 )
+ {
+ pTableContext->setRowPermutation( lcl_getNumberSequenceFromString( msRowTrans, true ));
+ msRowTrans = OUString();
+ }
+ }
+ pContext = pTableContext;
+ }
+ break;
+
+ default:
+ // try importing as an additional shape
+ if( ! mxDrawPage.is())
+ {
+ uno::Reference< drawing::XDrawPageSupplier > xSupp( xDoc, uno::UNO_QUERY );
+ if( xSupp.is())
+ mxDrawPage = uno::Reference< drawing::XShapes >( xSupp->getDrawPage(), uno::UNO_QUERY );
+
+ DBG_ASSERT( mxDrawPage.is(), "Invalid Chart Page" );
+ }
+ if( mxDrawPage.is())
+ pContext = GetImport().GetShapeImport()->CreateGroupChildContext(
+ GetImport(), nPrefix, rLocalName, xAttrList, mxDrawPage );
+ break;
+ }
+
+ if( ! pContext )
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+
+ return pContext;
+}
+
+
+/*
+ With a locked controller the following is done here:
+ 1. Hide title, subtitle, and legend.
+ 2. Set the size of the draw page.
+ 3. Set a (logically) empty data set.
+ 4. Set the chart type.
+*/
+void SchXMLChartContext::InitChart(
+ const OUString & rChartTypeServiceName, // currently the old service name
+ sal_Bool /* bSetSwitchData */ )
+{
+ uno::Reference< chart::XChartDocument > xDoc = mrImportHelper.GetChartDocument();
+ DBG_ASSERT( xDoc.is(), "No valid document!" );
+ uno::Reference< frame::XModel > xModel (xDoc, uno::UNO_QUERY );
+
+ // Remove Title and Diagram ("De-InitNew")
+ uno::Reference< chart2::XChartDocument > xNewDoc( mrImportHelper.GetChartDocument(), uno::UNO_QUERY );
+ if( xNewDoc.is())
+ {
+ xNewDoc->setFirstDiagram( 0 );
+ uno::Reference< chart2::XTitled > xTitled( xNewDoc, uno::UNO_QUERY );
+ if( xTitled.is())
+ xTitled->setTitleObject( 0 );
+ }
+
+ // Set the chart type via setting the diagram.
+ if( rChartTypeServiceName.getLength() &&
+ xDoc.is())
+ {
+ uno::Reference< lang::XMultiServiceFactory > xFact( xDoc, uno::UNO_QUERY );
+ if( xFact.is())
+ {
+ uno::Reference< chart::XDiagram > xDia( xFact->createInstance( rChartTypeServiceName ), uno::UNO_QUERY );
+ if( xDia.is())
+ xDoc->setDiagram( xDia );
+ }
+ }
+}
+
+// ----------------------------------------
+
+SchXMLTitleContext::SchXMLTitleContext( SchXMLImportHelper& rImpHelper, SvXMLImport& rImport,
+ const rtl::OUString& rLocalName,
+ rtl::OUString& rTitle,
+ uno::Reference< drawing::XShape >& xTitleShape ) :
+ SvXMLImportContext( rImport, XML_NAMESPACE_CHART, rLocalName ),
+ mrImportHelper( rImpHelper ),
+ mrTitle( rTitle ),
+ mxTitleShape( xTitleShape )
+{
+}
+
+SchXMLTitleContext::~SchXMLTitleContext()
+{}
+
+void SchXMLTitleContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
+
+ com::sun::star::awt::Point maPosition;
+ bool bHasXPosition=false;
+ bool bHasYPosition=false;
+
+ for( sal_Int16 i = 0; i < nAttrCount; i++ )
+ {
+ rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
+ rtl::OUString aLocalName;
+ rtl::OUString aValue = xAttrList->getValueByIndex( i );
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+
+ if( nPrefix == XML_NAMESPACE_SVG )
+ {
+ if( IsXMLToken( aLocalName, XML_X ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure( maPosition.X, aValue );
+ bHasXPosition = true;
+ }
+ else if( IsXMLToken( aLocalName, XML_Y ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure( maPosition.Y, aValue );
+ bHasYPosition = true;
+ }
+ }
+ else if( nPrefix == XML_NAMESPACE_CHART )
+ {
+ if( IsXMLToken( aLocalName, XML_STYLE_NAME ) )
+ msAutoStyleName = aValue;
+ }
+ }
+
+
+ if( mxTitleShape.is())
+ {
+ if( bHasXPosition && bHasYPosition )
+ mxTitleShape->setPosition( maPosition );
+
+ uno::Reference< beans::XPropertySet > xProp( mxTitleShape, uno::UNO_QUERY );
+ if( xProp.is())
+ {
+ const SvXMLStylesContext* pStylesCtxt = mrImportHelper.GetAutoStylesContext();
+ if( pStylesCtxt )
+ {
+ const SvXMLStyleContext* pStyle = pStylesCtxt->FindStyleChildContext(
+ mrImportHelper.GetChartFamilyID(), msAutoStyleName );
+
+ if( pStyle && pStyle->ISA( XMLPropStyleContext ))
+ (( XMLPropStyleContext* )pStyle )->FillPropertySet( xProp );
+ }
+ }
+ }
+}
+
+SvXMLImportContext* SchXMLTitleContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList >& )
+{
+ SvXMLImportContext* pContext = 0;
+
+ if( nPrefix == XML_NAMESPACE_TEXT &&
+ IsXMLToken( rLocalName, XML_P ) )
+ {
+ pContext = new SchXMLParagraphContext( GetImport(), rLocalName, mrTitle );
+ }
+ else
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+
+ return pContext;
+}
+
+// ----------------------------------------
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/SchXMLChartContext.hxx b/xmloff/source/chart/SchXMLChartContext.hxx
new file mode 100644
index 000000000000..af50fc5df26c
--- /dev/null
+++ b/xmloff/source/chart/SchXMLChartContext.hxx
@@ -0,0 +1,177 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _SCH_XMLCHARTCONTEXT_HXX_
+#define _SCH_XMLCHARTCONTEXT_HXX_
+
+#include <xmloff/xmlictxt.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/chart/ChartDataRowSource.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/awt/Size.hpp>
+
+#include "transporttypes.hxx"
+
+#include <list>
+#include <map>
+
+class SchXMLImport;
+class SchXMLImportHelper;
+
+namespace com { namespace sun { namespace star {
+ namespace chart {
+ class XChartDocument;
+ class XDiagram;
+ struct ChartSeriesAddress;
+ }
+ namespace util {
+ class XStringMapping;
+ }
+ namespace xml { namespace sax {
+ class XAttributeList;
+ }}
+ namespace drawing {
+ class XShapes;
+ }
+}}}
+
+// ----------------------------------------
+
+struct SeriesDefaultsAndStyles
+{
+ //default values for series:
+ ::com::sun::star::uno::Any maSymbolTypeDefault;
+ ::com::sun::star::uno::Any maDataCaptionDefault;
+
+ ::com::sun::star::uno::Any maErrorIndicatorDefault;
+ ::com::sun::star::uno::Any maErrorCategoryDefault;
+ ::com::sun::star::uno::Any maConstantErrorLowDefault;
+ ::com::sun::star::uno::Any maConstantErrorHighDefault;
+ ::com::sun::star::uno::Any maPercentageErrorDefault;
+ ::com::sun::star::uno::Any maErrorMarginDefault;
+
+ ::com::sun::star::uno::Any maMeanValueDefault;
+ ::com::sun::star::uno::Any maRegressionCurvesDefault;
+
+ ::com::sun::star::uno::Any maStackedDefault;
+ ::com::sun::star::uno::Any maPercentDefault;
+ ::com::sun::star::uno::Any maDeepDefault;
+ ::com::sun::star::uno::Any maStackedBarsConnectedDefault;
+
+ //additional information
+ ::com::sun::star::uno::Any maLinesOnProperty;
+
+ //styles for series and datapoints
+ ::std::list< DataRowPointStyle > maSeriesStyleList;
+};
+
+class SchXMLChartContext : public SvXMLImportContext
+{
+public:
+ SchXMLChartContext( SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport, const rtl::OUString& rLocalName );
+ virtual ~SchXMLChartContext();
+
+ virtual void StartElement( const com::sun::star::uno::Reference<
+ com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference<
+ com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+private:
+ SchXMLTable maTable;
+ SchXMLImportHelper& mrImportHelper;
+
+ ::rtl::OUString maMainTitle, maSubTitle;
+ com::sun::star::awt::Point maMainTitlePos, maSubTitlePos, maLegendPos;
+ ::rtl::OUString m_aXLinkHRefAttributeToIndicateDataProvider;
+ bool m_bHasRangeAtPlotArea;
+ bool m_bHasTableElement;
+ sal_Bool mbAllRangeAddressesAvailable;
+ sal_Bool mbColHasLabels;
+ sal_Bool mbRowHasLabels;
+ ::com::sun::star::chart::ChartDataRowSource meDataRowSource;
+ bool mbIsStockChart;
+
+ com::sun::star::uno::Sequence< com::sun::star::chart::ChartSeriesAddress > maSeriesAddresses;
+ ::rtl::OUString msCategoriesAddress;
+ ::rtl::OUString msChartAddress;
+
+ SeriesDefaultsAndStyles maSeriesDefaultsAndStyles;
+ tSchXMLLSequencesPerIndex maLSequencesPerIndex;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mxDrawPage;
+ ::rtl::OUString msColTrans;
+ ::rtl::OUString msRowTrans;
+ ::rtl::OUString maChartTypeServiceName;
+
+ ::com::sun::star::awt::Size maChartSize;
+
+ /** @descr This method bundles some settings to the chart model and executes them with
+ a locked controller. This includes setting the chart type.
+ @param aServiceName The name of the service the diagram is initialized with.
+ @param bSetWitchData Indicates wether the data set takes it's data series from
+ rows or from columns.
+ */
+ void InitChart (const ::rtl::OUString & rChartTypeServiceName,
+ sal_Bool bSetSwitchData);
+
+ void MergeSeriesForStockChart();
+};
+
+// ----------------------------------------
+
+class SchXMLTitleContext : public SvXMLImportContext
+{
+private:
+ SchXMLImportHelper& mrImportHelper;
+ rtl::OUString& mrTitle;
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShape > mxTitleShape;
+ rtl::OUString msAutoStyleName;
+
+public:
+ SchXMLTitleContext( SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport, const rtl::OUString& rLocalName,
+ rtl::OUString& rTitle,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xTitleShape );
+ virtual ~SchXMLTitleContext();
+
+ virtual void StartElement( const com::sun::star::uno::Reference<
+ com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
+};
+
+#endif // _SCH_XMLCHARTCONTEXT_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/SchXMLEnumConverter.cxx b/xmloff/source/chart/SchXMLEnumConverter.cxx
new file mode 100644
index 000000000000..fd4d7914a2fe
--- /dev/null
+++ b/xmloff/source/chart/SchXMLEnumConverter.cxx
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "SchXMLEnumConverter.hxx"
+
+#include <com/sun/star/chart/ChartLegendPosition.hpp>
+#include <com/sun/star/chart/ChartLegendExpansion.hpp>
+#include <com/sun/star/uno/Any.hxx>
+
+// header for rtl::Static
+#include <rtl/instance.hxx>
+
+using ::rtl::OUString;
+using namespace ::xmloff::token;
+using namespace ::com::sun::star;
+
+namespace
+{
+//-----------------------------------------------------------------------
+
+SvXMLEnumMapEntry aXMLLegendPositionEnumMap[] =
+{
+ { XML_START, chart::ChartLegendPosition_LEFT },
+ { XML_TOP, chart::ChartLegendPosition_TOP },
+ { XML_END, chart::ChartLegendPosition_RIGHT },
+ { XML_BOTTOM, chart::ChartLegendPosition_BOTTOM },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+class XMLLegendPositionPropertyHdl : public XMLEnumPropertyHdl
+{
+public:
+ XMLLegendPositionPropertyHdl()
+ : XMLEnumPropertyHdl( aXMLLegendPositionEnumMap, ::getCppuType((const chart::ChartLegendPosition*)0) ) {}
+ virtual ~XMLLegendPositionPropertyHdl() {};
+};
+
+struct TheLegendPositionPropertyHdl : public rtl::Static< XMLLegendPositionPropertyHdl, TheLegendPositionPropertyHdl >
+{
+};
+
+//-----------------------------------------------------------------------
+
+SvXMLEnumMapEntry aXMLLegendExpansionEnumMap[] =
+{
+ { XML_WIDE, chart::ChartLegendExpansion_WIDE },
+ { XML_HIGH, chart::ChartLegendExpansion_HIGH },
+ { XML_BALANCED, chart::ChartLegendExpansion_BALANCED },
+ { XML_CUSTOM, chart::ChartLegendExpansion_CUSTOM },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+class XMLLegendExpansionPropertyHdl : public XMLEnumPropertyHdl
+{
+public:
+ XMLLegendExpansionPropertyHdl()
+ : XMLEnumPropertyHdl( aXMLLegendExpansionEnumMap, ::getCppuType((const chart::ChartLegendExpansion*)0) ) {}
+ virtual ~XMLLegendExpansionPropertyHdl() {};
+};
+
+struct TheLegendExpansionPropertyHdl : public rtl::Static< XMLLegendExpansionPropertyHdl, TheLegendExpansionPropertyHdl >
+{
+};
+
+//-----------------------------------------------------------------------
+
+}//end anonymous namespace
+
+//-----------------------------------------------------------------------
+
+XMLEnumPropertyHdl& SchXMLEnumConverter::getLegendPositionConverter()
+{
+ return TheLegendPositionPropertyHdl::get();
+}
+XMLEnumPropertyHdl& SchXMLEnumConverter::getLegendExpansionConverter()
+{
+ return TheLegendExpansionPropertyHdl::get();
+}
diff --git a/xmloff/source/chart/SchXMLEnumConverter.hxx b/xmloff/source/chart/SchXMLEnumConverter.hxx
new file mode 100644
index 000000000000..63a9fb7ffb95
--- /dev/null
+++ b/xmloff/source/chart/SchXMLEnumConverter.hxx
@@ -0,0 +1,39 @@
+/*************************************************************************
+ *
+ * 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 _XML_CHART_ENUM_CONVERTER_HXX_
+#define _XML_CHART_ENUM_CONVERTER_HXX_
+
+#include <xmloff/EnumPropertyHdl.hxx>
+
+class SchXMLEnumConverter
+{
+public:
+ static XMLEnumPropertyHdl& getLegendPositionConverter();//returns a singleton
+ static XMLEnumPropertyHdl& getLegendExpansionConverter();//returns a singleton
+};
+
+#endif // _XML_CHART_ENUM_CONVERTER_HXX_
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
new file mode 100644
index 000000000000..f42026fb6d72
--- /dev/null
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -0,0 +1,4021 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <xmloff/xmlprmap.hxx>
+
+#include "SchXMLExport.hxx"
+#include "XMLChartPropertySetMapper.hxx"
+#include "SchXMLSeriesHelper.hxx"
+#include "ColorPropertySet.hxx"
+#include "SchXMLTools.hxx"
+#include "SchXMLEnumConverter.hxx"
+
+#include <tools/debug.hxx>
+#include <rtl/logfile.hxx>
+#include <comphelper/processfactory.hxx>
+#include <tools/globname.hxx>
+#include <sot/clsids.hxx>
+
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/families.hxx>
+#include <xmloff/xmlaustp.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmlmetae.hxx>
+#include "xexptran.hxx"
+#include <rtl/math.hxx>
+// header for any2enum
+#include <comphelper/extract.hxx>
+
+#include <list>
+#include <typeinfo>
+#include <algorithm>
+
+#include <com/sun/star/task/XStatusIndicatorSupplier.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XServiceName.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/util/XRefreshable.hpp>
+
+#include <com/sun/star/chart/XAxis.hpp>
+#include <com/sun/star/chart/XAxisSupplier.hpp>
+#include <com/sun/star/chart/XChartDocument.hpp>
+#include <com/sun/star/chart/ChartLegendPosition.hpp>
+#include <com/sun/star/chart/ChartLegendExpansion.hpp>
+#include <com/sun/star/chart/ChartDataRowSource.hpp>
+#include <com/sun/star/chart/ChartAxisAssign.hpp>
+#include <com/sun/star/chart/ChartAxisType.hpp>
+#include <com/sun/star/chart/TimeIncrement.hpp>
+#include <com/sun/star/chart/TimeInterval.hpp>
+#include <com/sun/star/chart/TimeUnit.hpp>
+#include <com/sun/star/chart/ChartSeriesAddress.hpp>
+#include <com/sun/star/chart/X3DDisplay.hpp>
+#include <com/sun/star/chart/XStatisticDisplay.hpp>
+#include <com/sun/star/chart/XSecondAxisTitleSupplier.hpp>
+#include <com/sun/star/chart/XDiagramPositioning.hpp>
+
+#include <com/sun/star/chart2/XAnyDescriptionAccess.hpp>
+#include <com/sun/star/chart2/AxisType.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/XDiagram.hpp>
+#include <com/sun/star/chart2/RelativePosition.hpp>
+#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
+#include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
+#include <com/sun/star/chart2/XChartTypeContainer.hpp>
+#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
+#include <com/sun/star/chart2/data/XDataSource.hpp>
+#include <com/sun/star/chart2/data/XDataSink.hpp>
+#include <com/sun/star/chart2/data/XDataReceiver.hpp>
+#include <com/sun/star/chart2/data/XDataProvider.hpp>
+#include <com/sun/star/chart2/data/XDatabaseDataProvider.hpp>
+#include <com/sun/star/chart2/data/XRangeXMLConversion.hpp>
+#include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
+#include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
+
+#include <com/sun/star/util/XStringMapping.hpp>
+#include <com/sun/star/drawing/HomogenMatrix.hpp>
+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/embed/Aspects.hpp>
+#include <com/sun/star/embed/XVisualObject.hpp>
+#include <com/sun/star/container/XChild.hpp>
+
+
+#include "MultiPropertySetHandler.hxx"
+#include "PropertyMap.hxx"
+
+using namespace com::sun::star;
+using namespace ::xmloff::token;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::rtl::OUStringToOString;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::std::vector;
+
+// ========================================
+// class SchXMLExportHelper_Impl
+// ========================================
+
+class SchXMLExportHelper_Impl
+{
+public:
+ // first: data sequence for label, second: data sequence for values.
+ typedef ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >,
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > > tLabelValuesDataPair;
+ typedef ::std::vector< tLabelValuesDataPair > tDataSequenceCont;
+
+public:
+ SchXMLExportHelper_Impl( SvXMLExport& rExport,
+ SvXMLAutoStylePoolP& rASPool );
+
+ virtual ~SchXMLExportHelper_Impl();
+
+ // auto-styles
+ /// parse chart and collect all auto-styles used in current pool
+ void collectAutoStyles( com::sun::star::uno::Reference<
+ com::sun::star::chart::XChartDocument > rChartDoc );
+
+ /// write the styles collected into the current pool as <style:style> elements
+ void exportAutoStyles();
+
+ /** export the <chart:chart> element corresponding to rChartDoc
+ if bIncludeTable is true, the chart data is exported as <table:table>
+ element (inside the chart element).
+
+ Otherwise the external references stored in the chart document are used
+ for writing the corresponding attributes at series
+
+ All attributes contained in xAttrList are written at the chart element,
+ which ist the outer element of a chart. So these attributes can easily
+ be parsed again by the container
+ */
+ void exportChart( com::sun::star::uno::Reference<
+ com::sun::star::chart::XChartDocument > rChartDoc,
+ sal_Bool bIncludeTable );
+
+ UniReference< XMLPropertySetMapper > GetPropertySetMapper() const;
+
+ void SetChartRangeAddress( const ::rtl::OUString& rAddress )
+ { msChartAddress = rAddress; }
+ void SetTableNumberList( const ::rtl::OUString& rList )
+ { msTableNumberList = rList; }
+
+ void InitRangeSegmentationProperties(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > & xChartDoc );
+
+ ::com::sun::star::awt::Size getPageSize(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > & xChartDoc ) const;
+
+ /** first parseDocument: collect autostyles and store names in this queue
+ second parseDocument: export content and use names from this queue
+ */
+ ::std::queue< ::rtl::OUString > maAutoStyleNameQueue;
+ void CollectAutoStyle(
+ const std::vector< XMLPropertyState >& aStates );
+ void AddAutoStyleAttribute(
+ const std::vector< XMLPropertyState >& aStates );
+
+ SvXMLAutoStylePoolP& GetAutoStylePoolP()
+ { return mrAutoStylePool; }
+
+ /// if bExportContent is false the auto-styles are collected
+ void parseDocument( com::sun::star::uno::Reference<
+ com::sun::star::chart::XChartDocument >& rChartDoc,
+ sal_Bool bExportContent,
+ sal_Bool bIncludeTable = sal_False );
+ void exportTable();
+ void exportPlotArea(
+ com::sun::star::uno::Reference< com::sun::star::chart::XDiagram > xDiagram,
+ com::sun::star::uno::Reference< com::sun::star::chart2::XDiagram > xNewDiagram,
+ const ::com::sun::star::awt::Size & rPageSize,
+ sal_Bool bExportContent,
+ sal_Bool bIncludeTable );
+ void exportCoordinateRegion( const com::sun::star::uno::Reference< com::sun::star::chart::XDiagram >& xDiagram );
+ void exportAxes( const com::sun::star::uno::Reference< com::sun::star::chart::XDiagram > & xDiagram,
+ const com::sun::star::uno::Reference< com::sun::star::chart2::XDiagram > & xNewDiagram,
+ sal_Bool bExportContent );
+ void exportAxis( enum XMLTokenEnum eDimension, enum XMLTokenEnum eAxisName,
+ const Reference< beans::XPropertySet > xAxisProps, const Reference< chart2::XAxis >& xChart2Axis,
+ const OUString& rCategoriesRanges,
+ bool bHasTitle, bool bHasMajorGrid, bool bHasMinorGrid, bool bExportContent );
+ void exportGrid( const Reference< beans::XPropertySet > xGridProperties, bool bMajor, bool bExportContent );
+ void exportDateScale( const Reference< beans::XPropertySet > xAxisProps );
+ void exportAxisTitle( const Reference< beans::XPropertySet > xTitleProps, bool bExportContent );
+
+ void exportSeries(
+ const com::sun::star::uno::Reference< com::sun::star::chart2::XDiagram > & xNewDiagram,
+ const ::com::sun::star::awt::Size & rPageSize,
+ sal_Bool bExportContent,
+ sal_Bool bHasTwoYAxes );
+ void exportCandleStickSeries(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > > & aSeriesSeq,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram > & xDiagram,
+ sal_Bool bJapaneseCandleSticks,
+ sal_Bool bExportContent );
+ void exportDataPoints(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & xSeriesProperties,
+ sal_Int32 nSeriesLength,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram > & xDiagram,
+ sal_Bool bExportContent );
+ void exportRegressionCurve(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > & xSeries,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & xSeriesProp,
+ const ::com::sun::star::awt::Size & rPageSize,
+ sal_Bool bExportContent );
+
+ /// add svg position as attribute for current element
+ void addPosition( const ::com::sun::star::awt::Point & rPosition );
+ void addPosition( com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape );
+ /// add svg size as attribute for current element
+ void addSize( const ::com::sun::star::awt::Size & rSize, bool bIsOOoNamespace = false );
+ void addSize( com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape, bool bIsOOoNamespace = false );
+ /// fills the member msString with the appropriate String (i.e. "A3")
+ void getCellAddress( sal_Int32 nCol, sal_Int32 nRow );
+ /// exports a string as a paragraph element
+ void exportText( const ::rtl::OUString& rText, bool bConvertTabsLFs = false );
+ void exportErrorBarRanges();
+
+private:
+ SchXMLExportHelper_Impl(SchXMLExportHelper_Impl &); // not defined
+ SchXMLExportHelper_Impl operator =(SchXMLExportHelper_Impl &); // not defined
+
+public:
+ SvXMLExport& mrExport;
+ SvXMLAutoStylePoolP& mrAutoStylePool;
+ UniReference< XMLPropertyHandlerFactory > mxPropertyHandlerFactory;
+ UniReference< XMLPropertySetMapper > mxPropertySetMapper;
+ UniReference< XMLChartExportPropertyMapper > mxExpPropMapper;
+
+ rtl::OUString msTableName;
+ rtl::OUStringBuffer msStringBuffer;
+ rtl::OUString msString;
+
+ // members filled by InitRangeSegmentationProperties (retrieved from DataProvider)
+ sal_Bool mbHasSeriesLabels;
+ sal_Bool mbHasCategoryLabels; //if the categories are only automatically generated this will be false
+ sal_Bool mbRowSourceColumns;
+ rtl::OUString msChartAddress;
+ rtl::OUString msTableNumberList;
+ ::com::sun::star::uno::Sequence< sal_Int32 > maSequenceMapping;
+
+ rtl::OUString msCLSID;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mxAdditionalShapes;
+
+ tDataSequenceCont m_aDataSequencesToExport;
+ rtl::OUString maCategoriesRange;
+};
+
+namespace
+{
+Reference< uno::XComponentContext > lcl_getComponentContext()
+{
+ Reference< uno::XComponentContext > xContext;
+ try
+ {
+ Reference< beans::XPropertySet > xFactProp( comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
+ if( xFactProp.is())
+ xFactProp->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xContext;
+ }
+ catch( uno::Exception& )
+ {}
+
+ return xContext;
+}
+
+class lcl_MatchesRole : public ::std::unary_function< Reference< chart2::data::XLabeledDataSequence >, bool >
+{
+public:
+ explicit lcl_MatchesRole( const OUString & aRole ) :
+ m_aRole( aRole )
+ {}
+
+ bool operator () ( const Reference< chart2::data::XLabeledDataSequence > & xSeq ) const
+ {
+ if( !xSeq.is() )
+ return false;
+ Reference< beans::XPropertySet > xProp( xSeq->getValues(), uno::UNO_QUERY );
+ OUString aRole;
+
+ return ( xProp.is() &&
+ (xProp->getPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "Role" )) ) >>= aRole ) &&
+ m_aRole.equals( aRole ));
+ }
+
+private:
+ OUString m_aRole;
+};
+
+template< typename T >
+ void lcl_SequenceToVectorAppend( const Sequence< T > & rSource, ::std::vector< T > & rDestination )
+{
+ rDestination.reserve( rDestination.size() + rSource.getLength());
+ ::std::copy( rSource.getConstArray(), rSource.getConstArray() + rSource.getLength(),
+ ::std::back_inserter( rDestination ));
+}
+
+template< typename T >
+ void lcl_SequenceToVector( const Sequence< T > & rSource, ::std::vector< T > & rDestination )
+{
+ rDestination.clear();
+ lcl_SequenceToVectorAppend( rSource, rDestination );
+}
+
+Reference< chart2::data::XLabeledDataSequence > lcl_getCategories( const Reference< chart2::XDiagram > & xDiagram )
+{
+ Reference< chart2::data::XLabeledDataSequence > xResult;
+ try
+ {
+ Reference< chart2::XCoordinateSystemContainer > xCooSysCnt(
+ xDiagram, uno::UNO_QUERY_THROW );
+ Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq(
+ xCooSysCnt->getCoordinateSystems());
+ for( sal_Int32 i=0; i<aCooSysSeq.getLength(); ++i )
+ {
+ Reference< chart2::XCoordinateSystem > xCooSys( aCooSysSeq[i] );
+ OSL_ASSERT( xCooSys.is());
+ for( sal_Int32 nN = xCooSys->getDimension(); nN--; )
+ {
+ const sal_Int32 nMaxAxisIndex = xCooSys->getMaximumAxisIndexByDimension(nN);
+ for(sal_Int32 nI=0; nI<=nMaxAxisIndex; ++nI)
+ {
+ Reference< chart2::XAxis > xAxis = xCooSys->getAxisByDimension( nN, nI );
+ OSL_ASSERT( xAxis.is());
+ if( xAxis.is())
+ {
+ chart2::ScaleData aScaleData = xAxis->getScaleData();
+ if( aScaleData.Categories.is())
+ {
+ xResult.set( aScaleData.Categories );
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ (void)ex; // avoid warning for pro build
+ OSL_FAIL( OUStringToOString(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "Exception caught. Type: " )) +
+ OUString::createFromAscii( typeid( ex ).name()) +
+ OUString( RTL_CONSTASCII_USTRINGPARAM( ", Message: " )) +
+ ex.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
+ }
+
+ return xResult;
+}
+
+Reference< chart2::data::XDataSource > lcl_createDataSource(
+ const Sequence< Reference< chart2::data::XLabeledDataSequence > > & aData )
+{
+ Reference< chart2::data::XDataSink > xSink;
+ Reference< uno::XComponentContext > xContext( lcl_getComponentContext());
+ if( xContext.is() )
+ xSink.set(
+ xContext->getServiceManager()->createInstanceWithContext(
+ OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.data.DataSource" )),
+ xContext ), uno::UNO_QUERY_THROW );
+ if( xSink.is())
+ xSink->setData( aData );
+
+ return Reference< chart2::data::XDataSource >( xSink, uno::UNO_QUERY );
+}
+
+Sequence< Reference< chart2::data::XLabeledDataSequence > > lcl_getAllSeriesSequences( const Reference< chart2::XChartDocument >& xChartDoc )
+{
+ ::std::vector< Reference< chart2::data::XLabeledDataSequence > > aContainer;
+ if( xChartDoc.is() )
+ {
+ Reference< chart2::XDiagram > xDiagram( xChartDoc->getFirstDiagram());
+ ::std::vector< Reference< chart2::XDataSeries > > aSeriesVector( SchXMLSeriesHelper::getDataSeriesFromDiagram( xDiagram ));
+ for( ::std::vector< Reference< chart2::XDataSeries > >::const_iterator aSeriesIt( aSeriesVector.begin() )
+ ; aSeriesIt != aSeriesVector.end(); ++aSeriesIt )
+ {
+ Reference< chart2::data::XDataSource > xDataSource( *aSeriesIt, uno::UNO_QUERY );
+ if( !xDataSource.is() )
+ continue;
+ uno::Sequence< Reference< chart2::data::XLabeledDataSequence > > aDataSequences( xDataSource->getDataSequences() );
+ lcl_SequenceToVectorAppend( aDataSequences, aContainer );
+ }
+ }
+
+ Sequence< Reference< chart2::data::XLabeledDataSequence > > aRet( aContainer.size());
+ ::std::copy( aContainer.begin(), aContainer.end(), aRet.getArray());
+
+ return aRet;
+}
+
+Reference< chart2::data::XLabeledDataSequence >
+ lcl_getDataSequenceByRole(
+ const Sequence< Reference< chart2::data::XLabeledDataSequence > > & aLabeledSeq,
+ const OUString & rRole )
+{
+ Reference< chart2::data::XLabeledDataSequence > aNoResult;
+
+ const Reference< chart2::data::XLabeledDataSequence > * pBegin = aLabeledSeq.getConstArray();
+ const Reference< chart2::data::XLabeledDataSequence > * pEnd = pBegin + aLabeledSeq.getLength();
+ const Reference< chart2::data::XLabeledDataSequence > * pMatch =
+ ::std::find_if( pBegin, pEnd, lcl_MatchesRole( rRole ));
+
+ if( pMatch != pEnd )
+ return *pMatch;
+
+ return aNoResult;
+}
+
+Reference< chart2::data::XDataSource > lcl_pressUsedDataIntoRectangularFormat( const Reference< chart2::XChartDocument >& xChartDoc, sal_Bool& rOutSourceHasCategoryLabels )
+{
+ ::std::vector< Reference< chart2::data::XLabeledDataSequence > > aLabeledSeqVector;
+
+ //categories are always the first sequence
+ Reference< chart2::XDiagram > xDiagram( xChartDoc->getFirstDiagram());
+ Reference< chart2::data::XLabeledDataSequence > xCategories( lcl_getCategories( xDiagram ) );
+ if( xCategories.is() )
+ aLabeledSeqVector.push_back( xCategories );
+ rOutSourceHasCategoryLabels = sal_Bool(xCategories.is());
+
+ Sequence< Reference< chart2::data::XLabeledDataSequence > > aSeriesSeqVector(
+ lcl_getAllSeriesSequences( xChartDoc ) );
+
+ //the first x-values is always the next sequence //todo ... other x-values get lost for old format
+ Reference< chart2::data::XLabeledDataSequence > xXValues(
+ lcl_getDataSequenceByRole( aSeriesSeqVector, OUString(RTL_CONSTASCII_USTRINGPARAM( "values-x" )) ) );
+ if( xXValues.is() )
+ aLabeledSeqVector.push_back( xXValues );
+
+ //add all other sequences now without x-values
+ lcl_MatchesRole aHasXValues( OUString(RTL_CONSTASCII_USTRINGPARAM( "values-x" )) );
+ for( sal_Int32 nN=0; nN<aSeriesSeqVector.getLength(); nN++ )
+ {
+ if( !aHasXValues( aSeriesSeqVector[nN] ) )
+ aLabeledSeqVector.push_back( aSeriesSeqVector[nN] );
+ }
+
+ Sequence< Reference< chart2::data::XLabeledDataSequence > > aSeq( aLabeledSeqVector.size() );
+ ::std::copy( aLabeledSeqVector.begin(), aLabeledSeqVector.end(), aSeq.getArray() );
+
+ return lcl_createDataSource( aSeq );
+}
+
+bool lcl_isSeriesAttachedToFirstAxis(
+ const Reference< chart2::XDataSeries > & xDataSeries )
+{
+ bool bResult=true;
+
+ try
+ {
+ sal_Int32 nAxisIndex = 0;
+ Reference< beans::XPropertySet > xProp( xDataSeries, uno::UNO_QUERY_THROW );
+ if( xProp.is() )
+ xProp->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("AttachedAxisIndex") ) ) >>= nAxisIndex;
+ bResult = (0==nAxisIndex);
+ }
+ catch( uno::Exception & ex )
+ {
+ (void)ex; // avoid warning for pro build
+ OSL_FAIL( OUStringToOString(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "Exception caught. Type: " )) +
+ OUString::createFromAscii( typeid( ex ).name()) +
+ OUString( RTL_CONSTASCII_USTRINGPARAM( ", Message: " )) +
+ ex.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
+ }
+
+ return bResult;
+}
+
+OUString lcl_ConvertRange( const ::rtl::OUString & rRange, const Reference< chart2::XChartDocument > & xDoc )
+{
+ OUString aResult = rRange;
+ if( !xDoc.is() )
+ return aResult;
+ Reference< chart2::data::XRangeXMLConversion > xConversion(
+ xDoc->getDataProvider(), uno::UNO_QUERY );
+ if( xConversion.is())
+ aResult = xConversion->convertRangeToXML( rRange );
+ return aResult;
+}
+
+typedef ::std::pair< OUString, OUString > tLabelAndValueRange;
+
+tLabelAndValueRange lcl_getLabelAndValueRangeByRole(
+ const Sequence< Reference< chart2::data::XLabeledDataSequence > > & aSeqCnt,
+ const OUString & rRole,
+ const Reference< chart2::XChartDocument > & xDoc,
+ SchXMLExportHelper_Impl::tDataSequenceCont & rOutSequencesToExport )
+{
+ tLabelAndValueRange aResult;
+
+ Reference< chart2::data::XLabeledDataSequence > xLabeledSeq(
+ lcl_getDataSequenceByRole( aSeqCnt, rRole ));
+ if( xLabeledSeq.is())
+ {
+ Reference< chart2::data::XDataSequence > xLabelSeq( xLabeledSeq->getLabel());
+ if( xLabelSeq.is())
+ aResult.first = lcl_ConvertRange( xLabelSeq->getSourceRangeRepresentation(), xDoc );
+
+ Reference< chart2::data::XDataSequence > xValueSeq( xLabeledSeq->getValues());
+ if( xValueSeq.is())
+ aResult.second = lcl_ConvertRange( xValueSeq->getSourceRangeRepresentation(), xDoc );
+
+ if( xLabelSeq.is() || xValueSeq.is())
+ rOutSequencesToExport.push_back( SchXMLExportHelper_Impl::tLabelValuesDataPair( xLabelSeq, xValueSeq ));
+ }
+
+ return aResult;
+}
+
+sal_Int32 lcl_getSequenceLengthByRole(
+ const Sequence< Reference< chart2::data::XLabeledDataSequence > > & aSeqCnt,
+ const OUString & rRole )
+{
+ Reference< chart2::data::XLabeledDataSequence > xLabeledSeq(
+ lcl_getDataSequenceByRole( aSeqCnt, rRole ));
+ if( xLabeledSeq.is())
+ {
+ Reference< chart2::data::XDataSequence > xSeq( xLabeledSeq->getValues());
+ return xSeq->getData().getLength();
+ }
+ return 0;
+}
+
+bool lcl_hasChartType( const Reference< chart2::XDiagram > & xDiagram, const OUString & rChartType )
+{
+ try
+ {
+ Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY_THROW );
+ Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems());
+ for( sal_Int32 nCooSysIdx=0; nCooSysIdx<aCooSysSeq.getLength(); ++nCooSysIdx )
+ {
+ Reference< chart2::XChartTypeContainer > xCTCnt( aCooSysSeq[nCooSysIdx], uno::UNO_QUERY_THROW );
+ Sequence< Reference< chart2::XChartType > > aChartTypes( xCTCnt->getChartTypes());
+ for( sal_Int32 nCTIdx=0; nCTIdx<aChartTypes.getLength(); ++nCTIdx )
+ {
+ if( aChartTypes[nCTIdx]->getChartType().equals( rChartType ))
+ return true;
+ }
+ }
+ }
+ catch( uno::Exception & )
+ {
+ OSL_FAIL( "Exception while searching for chart type in diagram" );
+ }
+ return false;
+}
+
+OUString lcl_flattenStringSequence( const Sequence< OUString > & rSequence )
+{
+ OUStringBuffer aResult;
+ bool bPrecedeWithSpace = false;
+ for( sal_Int32 nIndex=0; nIndex<rSequence.getLength(); ++nIndex )
+ {
+ if( rSequence[nIndex].getLength())
+ {
+ if( bPrecedeWithSpace )
+ aResult.append( static_cast< sal_Unicode >( ' ' ));
+ aResult.append( rSequence[nIndex] );
+ bPrecedeWithSpace = true;
+ }
+ }
+ return aResult.makeStringAndClear();
+}
+
+void lcl_getLabelStringSequence( Sequence< OUString >& rOutLabels, const Reference< chart2::data::XDataSequence > & xLabelSeq )
+{
+ uno::Reference< chart2::data::XTextualDataSequence > xTextualDataSequence( xLabelSeq, uno::UNO_QUERY );
+ if( xTextualDataSequence.is())
+ {
+ rOutLabels = xTextualDataSequence->getTextualData();
+ }
+ else if( xLabelSeq.is())
+ {
+ Sequence< uno::Any > aAnies( xLabelSeq->getData());
+ rOutLabels.realloc( aAnies.getLength());
+ for( sal_Int32 i=0; i<aAnies.getLength(); ++i )
+ aAnies[i] >>= rOutLabels[i];
+ }
+}
+
+sal_Int32 lcl_getMaxSequenceLength(
+ const SchXMLExportHelper_Impl::tDataSequenceCont & rContainer )
+{
+ sal_Int32 nResult = 0;
+ for( SchXMLExportHelper_Impl::tDataSequenceCont::const_iterator aIt( rContainer.begin());
+ aIt != rContainer.end(); ++aIt )
+ {
+ if( aIt->second.is())
+ {
+ sal_Int32 nSeqLength = aIt->second->getData().getLength();
+ if( nSeqLength > nResult )
+ nResult = nSeqLength;
+ }
+ }
+ return nResult;
+}
+
+uno::Sequence< rtl::OUString > lcl_DataSequenceToStringSequence(
+ const uno::Reference< chart2::data::XDataSequence >& xDataSequence )
+{
+ uno::Sequence< rtl::OUString > aResult;
+ if(!xDataSequence.is())
+ return aResult;
+
+ uno::Reference< chart2::data::XTextualDataSequence > xTextualDataSequence( xDataSequence, uno::UNO_QUERY );
+ if( xTextualDataSequence.is() )
+ {
+ aResult = xTextualDataSequence->getTextualData();
+ }
+ else
+ {
+ uno::Sequence< uno::Any > aValues = xDataSequence->getData();
+ aResult.realloc(aValues.getLength());
+
+ for(sal_Int32 nN=aValues.getLength();nN--;)
+ aValues[nN] >>= aResult[nN];
+ }
+
+ return aResult;
+}
+::std::vector< double > lcl_getAllValuesFromSequence( const Reference< chart2::data::XDataSequence > & xSeq )
+{
+ double fNan = 0.0;
+ ::rtl::math::setNan( &fNan );
+ ::std::vector< double > aResult;
+ if(!xSeq.is())
+ return aResult;
+
+ uno::Sequence< double > aValuesSequence;
+ Reference< chart2::data::XNumericalDataSequence > xNumSeq( xSeq, uno::UNO_QUERY );
+ if( xNumSeq.is() )
+ {
+ aValuesSequence = xNumSeq->getNumericalData();
+ }
+ else
+ {
+ Sequence< uno::Any > aAnies( xSeq->getData() );
+ aValuesSequence.realloc( aAnies.getLength() );
+ for( sal_Int32 i=0; i<aAnies.getLength(); ++i )
+ aAnies[i] >>= aValuesSequence[i];
+ }
+
+ //special handling for x-values (if x-values do point to categories, indices are used instead )
+ Reference< beans::XPropertySet > xProp( xSeq, uno::UNO_QUERY );
+ if( xProp.is() )
+ {
+ OUString aRole;
+ xProp->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Role") ) ) >>= aRole;
+ if( aRole.match( OUString( RTL_CONSTASCII_USTRINGPARAM( "values-x") ) ) )
+ {
+ //lcl_clearIfNoValuesButTextIsContained - replace by indices if the values are not appropriate
+ bool bHasValue=false;
+ bool bHasText=false;
+ sal_Int32 nCount = aValuesSequence.getLength();
+ for( sal_Int32 j = 0; j < nCount; ++j )
+ {
+ if( !::rtl::math::isNan( aValuesSequence[j] ) )
+ {
+ bHasValue=true;
+ break;
+ }
+ }
+ if(!bHasValue)
+ {
+ //no double value is countained
+ //is there any text?
+ uno::Sequence< rtl::OUString > aStrings( lcl_DataSequenceToStringSequence( xSeq ) );
+ sal_Int32 nTextCount = aStrings.getLength();
+ for( sal_Int32 j = 0; j < nTextCount; ++j )
+ {
+ if( aStrings[j].getLength() )
+ {
+ bHasText=true;
+ break;
+ }
+ }
+ }
+ if( !bHasValue && bHasText )
+ {
+ for( sal_Int32 j = 0; j < nCount; ++j )
+ aValuesSequence[j] = j+1;
+ }
+ }
+ }
+
+ ::std::copy( aValuesSequence.getConstArray(), aValuesSequence.getConstArray() + aValuesSequence.getLength(),
+ ::std::back_inserter( aResult ));
+ return aResult;
+}
+
+bool lcl_SequenceHasUnhiddenData( const uno::Reference< chart2::data::XDataSequence >& xDataSequence )
+{
+ if( !xDataSequence.is() )
+ return false;
+ uno::Reference< beans::XPropertySet > xProp( xDataSequence, uno::UNO_QUERY );
+ if( xProp.is() )
+ {
+ uno::Sequence< sal_Int32 > aHiddenValues;
+ try
+ {
+ xProp->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "HiddenValues" ) ) ) >>= aHiddenValues;
+ if( !aHiddenValues.getLength() )
+ return true;
+ }
+ catch( uno::Exception& e )
+ {
+ (void)e; // avoid warning
+ return true;
+ }
+ }
+ if( xDataSequence->getData().getLength() )
+ return true;
+ return false;
+}
+
+typedef vector< OUString > tStringVector;
+typedef vector< double > tDoubleVector;
+typedef vector< vector< OUString > > t2DStringVector;
+typedef vector< vector< double > > t2DNumberContainer;
+
+struct lcl_TableData
+{
+ t2DNumberContainer aDataInRows;
+ tStringVector aDataRangeRepresentations;
+
+ tStringVector aColumnDescriptions;
+ tStringVector aColumnDescriptions_Ranges;
+
+ tStringVector aRowDescriptions;
+ tStringVector aRowDescriptions_Ranges;
+
+ Sequence< Sequence< uno::Any > > aComplexColumnDescriptions;//outer index is columns - inner index is level
+ Sequence< Sequence< uno::Any > > aComplexRowDescriptions;//outer index is rows - inner index is level
+
+ ::std::vector< sal_Int32 > aHiddenColumns;
+};
+
+// ::std::bind2nd( ::std::mem_fun_ref( &T::resize ), nSize ) does not work
+template< class T >
+ struct lcl_resize
+ {
+ lcl_resize( typename T::size_type nSize, typename T::value_type fDefaultValue ) : m_nSize( nSize ), m_fDefaultValue( fDefaultValue ) {}
+ void operator()( T & t )
+ { t.resize( m_nSize, m_fDefaultValue ); }
+ private:
+ typename T::size_type m_nSize;
+ typename T::value_type m_fDefaultValue;
+ };
+
+
+typedef ::std::map< sal_Int32, SchXMLExportHelper_Impl::tLabelValuesDataPair >
+ lcl_DataSequenceMap;
+
+struct lcl_SequenceToMapElement :
+ public ::std::unary_function< lcl_DataSequenceMap::mapped_type, lcl_DataSequenceMap::value_type >
+{
+ lcl_SequenceToMapElement()
+ {}
+ result_type operator() ( const argument_type & rContent )
+ {
+ sal_Int32 nIndex = -1;
+ if( rContent.second.is()) //has values
+ {
+ OUString aRangeRep( rContent.second->getSourceRangeRepresentation());
+ nIndex = aRangeRep.toInt32();
+ }
+ else if( rContent.first.is()) //has labels
+ nIndex = rContent.first->getSourceRangeRepresentation().copy( sizeof("label ")).toInt32();
+ return result_type( nIndex, rContent );
+ }
+};
+
+void lcl_ReorderInternalSequencesAccordingToTheirRangeName(
+ SchXMLExportHelper_Impl::tDataSequenceCont & rInOutSequences )
+{
+ lcl_DataSequenceMap aIndexSequenceMap;
+ ::std::transform( rInOutSequences.begin(), rInOutSequences.end(),
+ ::std::inserter( aIndexSequenceMap, aIndexSequenceMap.begin()),
+ lcl_SequenceToMapElement());
+
+ rInOutSequences.clear();
+ sal_Int32 nIndex = 0;
+ for( lcl_DataSequenceMap::const_iterator aIt = aIndexSequenceMap.begin();
+ aIt != aIndexSequenceMap.end(); ++aIt, ++nIndex )
+ {
+ if( aIt->first < 0 )
+ continue;
+ // fill empty columns
+ for( ; nIndex < aIt->first; ++nIndex )
+ rInOutSequences.push_back(
+ SchXMLExportHelper_Impl::tDataSequenceCont::value_type( 0, 0 ));
+ OSL_ASSERT( nIndex == aIt->first );
+ rInOutSequences.push_back( aIt->second );
+ }
+}
+
+
+lcl_TableData lcl_getDataForLocalTable(
+ const SchXMLExportHelper_Impl::tDataSequenceCont & aSequencesToExport,
+ const Reference< chart2::XAnyDescriptionAccess >& xAnyDescriptionAccess,
+ const OUString& rCategoriesRange,
+ bool bSeriesFromColumns,
+ const Reference< chart2::data::XRangeXMLConversion > & xRangeConversion )
+{
+ lcl_TableData aResult;
+
+ try
+ {
+ Sequence< OUString > aSimpleCategories;
+ if( xAnyDescriptionAccess.is() )
+ {
+ //categories
+ if( bSeriesFromColumns )
+ {
+ aSimpleCategories = xAnyDescriptionAccess->getRowDescriptions();
+ aResult.aComplexRowDescriptions = xAnyDescriptionAccess->getAnyRowDescriptions();
+ }
+ else
+ {
+ aSimpleCategories = xAnyDescriptionAccess->getColumnDescriptions();
+ aResult.aComplexColumnDescriptions = xAnyDescriptionAccess->getAnyColumnDescriptions();
+ }
+ }
+
+ //series values and series labels
+ SchXMLExportHelper_Impl::tDataSequenceCont::size_type nNumSequences = aSequencesToExport.size();
+ SchXMLExportHelper_Impl::tDataSequenceCont::const_iterator aBegin( aSequencesToExport.begin());
+ SchXMLExportHelper_Impl::tDataSequenceCont::const_iterator aEnd( aSequencesToExport.end());
+ SchXMLExportHelper_Impl::tDataSequenceCont::const_iterator aIt( aBegin );
+
+ size_t nMaxSequenceLength( lcl_getMaxSequenceLength( aSequencesToExport ));
+ size_t nCategoriesLength( aSimpleCategories.getLength() );
+ if( nCategoriesLength > nMaxSequenceLength )
+ {
+ aSimpleCategories.realloc(nMaxSequenceLength);//#i110617#
+ nCategoriesLength = nMaxSequenceLength;
+ }
+ size_t nNumColumns( bSeriesFromColumns ? nNumSequences : nMaxSequenceLength );
+ size_t nNumRows( bSeriesFromColumns ? nMaxSequenceLength : nNumSequences );
+
+ // resize data
+ aResult.aDataInRows.resize( nNumRows );
+ double fNan = 0.0;
+ ::rtl::math::setNan( &fNan );
+ ::std::for_each( aResult.aDataInRows.begin(), aResult.aDataInRows.end(),
+ lcl_resize< t2DNumberContainer::value_type >( nNumColumns, fNan ));
+ aResult.aColumnDescriptions.resize( nNumColumns );
+ aResult.aComplexColumnDescriptions.realloc( nNumColumns );
+ aResult.aRowDescriptions.resize( nNumRows );
+ aResult.aComplexRowDescriptions.realloc( nNumRows );
+
+ tStringVector& rCategories = bSeriesFromColumns ? aResult.aRowDescriptions : aResult.aColumnDescriptions;
+ tStringVector& rLabels = bSeriesFromColumns ? aResult.aColumnDescriptions : aResult.aRowDescriptions;
+
+ //categories
+ lcl_SequenceToVector( aSimpleCategories, rCategories );
+ if( rCategoriesRange.getLength() )
+ {
+ OUString aRange(rCategoriesRange);
+ if( xRangeConversion.is())
+ aRange = xRangeConversion->convertRangeToXML( aRange );
+ if( bSeriesFromColumns )
+ aResult.aRowDescriptions_Ranges.push_back( aRange );
+ else
+ aResult.aColumnDescriptions_Ranges.push_back( aRange );
+ }
+
+ // iterate over all sequences
+ size_t nSeqIdx = 0;
+ Sequence< Sequence< OUString > > aComplexLabels(nNumSequences);
+ for( ; aIt != aEnd; ++aIt, ++nSeqIdx )
+ {
+ OUString aRange;
+ Sequence< OUString >& rCurrentComplexLabel = aComplexLabels[nSeqIdx];
+ if( aIt->first.is())
+ {
+ lcl_getLabelStringSequence( rCurrentComplexLabel, aIt->first );
+ rLabels[nSeqIdx] = lcl_flattenStringSequence( rCurrentComplexLabel );
+ aRange = aIt->first->getSourceRangeRepresentation();
+ if( xRangeConversion.is())
+ aRange = xRangeConversion->convertRangeToXML( aRange );
+ }
+ else if( aIt->second.is())
+ {
+ rCurrentComplexLabel.realloc(1);
+ rLabels[nSeqIdx] = rCurrentComplexLabel[0] = lcl_flattenStringSequence(
+ aIt->second->generateLabel( chart2::data::LabelOrigin_SHORT_SIDE ));
+ }
+ if( bSeriesFromColumns )
+ aResult.aColumnDescriptions_Ranges.push_back( aRange );
+ else
+ aResult.aRowDescriptions_Ranges.push_back( aRange );
+
+ ::std::vector< double > aNumbers( lcl_getAllValuesFromSequence( aIt->second ));
+ if( bSeriesFromColumns )
+ {
+ const sal_Int32 nSize( static_cast< sal_Int32 >( aNumbers.size()));
+ for( sal_Int32 nIdx=0; nIdx<nSize; ++nIdx )
+ aResult.aDataInRows[nIdx][nSeqIdx] = aNumbers[nIdx];
+ }
+ else
+ aResult.aDataInRows[nSeqIdx] = aNumbers;
+
+ if( aIt->second.is())
+ {
+ aRange = aIt->second->getSourceRangeRepresentation();
+ if( xRangeConversion.is())
+ aRange = xRangeConversion->convertRangeToXML( aRange );
+ }
+ aResult.aDataRangeRepresentations.push_back( aRange );
+
+ //is column hidden?
+ if( !lcl_SequenceHasUnhiddenData(aIt->first) && !lcl_SequenceHasUnhiddenData(aIt->second) )
+ aResult.aHiddenColumns.push_back(nSeqIdx);
+ }
+ Sequence< Sequence< Any > >& rComplexAnyLabels = bSeriesFromColumns ? aResult.aComplexColumnDescriptions : aResult.aComplexRowDescriptions;//#i116544#
+ rComplexAnyLabels.realloc(aComplexLabels.getLength());
+ for( sal_Int32 nN=0; nN<aComplexLabels.getLength();nN++ )
+ {
+ Sequence< OUString >& rSource = aComplexLabels[nN];
+ Sequence< Any >& rTarget = rComplexAnyLabels[nN];
+ rTarget.realloc( rSource.getLength() );
+ for( sal_Int32 i=0; i<rSource.getLength(); i++ )
+ rTarget[i] = uno::makeAny( rSource[i] );
+ }
+ }
+ catch( uno::Exception & rEx )
+ {
+ (void)rEx; // avoid warning for pro build
+ OSL_TRACE( OUStringToOString( OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "something went wrong during table data collection: " )) + rEx.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
+ }
+
+ return aResult;
+}
+
+void lcl_exportNumberFormat( const OUString& rPropertyName, const Reference< beans::XPropertySet >& xPropSet,
+ SvXMLExport& rExport )
+{
+ if( xPropSet.is())
+ {
+ sal_Int32 nNumberFormat = 0;
+ Any aNumAny = xPropSet->getPropertyValue( rPropertyName );
+ if( (aNumAny >>= nNumberFormat) && (nNumberFormat != -1) )
+ rExport.addDataStyle( nNumberFormat );
+ }
+}
+
+::std::vector< Reference< chart2::data::XDataSequence > >
+ lcl_getErrorBarSequences( const Reference< beans::XPropertySet > & xErrorBarProp )
+{
+ ::std::vector< Reference< chart2::data::XDataSequence > > aResult;
+ Reference< chart2::data::XDataSource > xErrorBarDataSource( xErrorBarProp, uno::UNO_QUERY );
+ if( !xErrorBarDataSource.is())
+ return aResult;
+
+ const OUString aRolePrefix( RTL_CONSTASCII_USTRINGPARAM( "error-bars-" ));
+
+ Sequence< Reference< chart2::data::XLabeledDataSequence > > aSequences(
+ xErrorBarDataSource->getDataSequences());
+ for( sal_Int32 nI=0; nI< aSequences.getLength(); ++nI )
+ {
+ try
+ {
+ if( aSequences[nI].is())
+ {
+ Reference< chart2::data::XDataSequence > xSequence( aSequences[nI]->getValues());
+ Reference< beans::XPropertySet > xSeqProp( xSequence, uno::UNO_QUERY_THROW );
+ OUString aRole;
+ if( ( xSeqProp->getPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "Role" ))) >>= aRole ) &&
+ aRole.match( aRolePrefix ))
+ {
+ aResult.push_back( xSequence );
+ }
+ }
+ }
+ catch( uno::Exception & rEx )
+ {
+#ifdef DBG_UTIL
+ String aStr( rEx.Message );
+ ByteString aBStr( aStr, RTL_TEXTENCODING_ASCII_US );
+ OSL_TRACE( "chart:exporting error bar ranges: %s", aBStr.GetBuffer());
+#else
+ (void)rEx; // avoid warning
+#endif
+ }
+ }
+
+ return aResult;
+}
+
+bool lcl_exportDomainForThisSequence( const Reference< chart2::data::XDataSequence > xValues, rtl::OUString& rFirstRangeForThisDomainIndex, SvXMLExport& rExport )
+{
+ bool bDomainExported = false;
+ if( xValues.is())
+ {
+ Reference< chart2::XChartDocument > xNewDoc( rExport.GetModel(), uno::UNO_QUERY );
+ OUString aRange( lcl_ConvertRange( xValues->getSourceRangeRepresentation(), xNewDoc ) );
+
+ //work around error in OOo 2.0 (problems with multiple series having a domain element)
+ if( !rFirstRangeForThisDomainIndex.getLength() || !aRange.equals(rFirstRangeForThisDomainIndex) )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_TABLE, XML_CELL_RANGE_ADDRESS, aRange);
+ SvXMLElementExport aDomain( rExport, XML_NAMESPACE_CHART, XML_DOMAIN, sal_True, sal_True );
+ bDomainExported = true;
+ }
+
+ if( !rFirstRangeForThisDomainIndex.getLength() )
+ rFirstRangeForThisDomainIndex = aRange;
+ }
+ return bDomainExported;
+}
+
+} // anonymous namespace
+
+struct SchXMLDataPointStruct
+{
+ OUString maStyleName;
+ sal_Int32 mnRepeat;
+
+ SchXMLDataPointStruct() : mnRepeat( 1 ) {}
+};
+
+// ========================================
+// class SchXMLExportHelper
+// ========================================
+
+SchXMLExportHelper::SchXMLExportHelper( SvXMLExport& rExport, SvXMLAutoStylePoolP& rASPool )
+ : m_pImpl( new SchXMLExportHelper_Impl( rExport, rASPool ) )
+{
+}
+
+SchXMLExportHelper::~SchXMLExportHelper()
+{
+ delete m_pImpl;
+}
+
+const OUString& SchXMLExportHelper::getChartCLSID()
+{
+ return m_pImpl->msCLSID;
+}
+
+UniReference< XMLPropertySetMapper > SchXMLExportHelper_Impl::GetPropertySetMapper() const
+{
+ return mxPropertySetMapper;
+}
+
+void SchXMLExportHelper_Impl::exportAutoStyles()
+{
+ if( mxExpPropMapper.is())
+ {
+ //ToDo: when embedded in calc/writer this is not necessary because the
+ // numberformatter is shared between both documents
+ mrExport.exportAutoDataStyles();
+
+ // export chart auto styles
+ mrAutoStylePool.exportXML(
+ XML_STYLE_FAMILY_SCH_CHART_ID
+ , mrExport.GetDocHandler(),
+ mrExport.GetMM100UnitConverter(),
+ mrExport.GetNamespaceMap()
+ );
+
+ // export auto styles for additional shapes
+ mrExport.GetShapeExport()->exportAutoStyles();
+ // and for text in additional shapes
+ mrExport.GetTextParagraphExport()->exportTextAutoStyles();
+ }
+}
+
+// private methods
+// ---------------
+
+SchXMLExportHelper_Impl::SchXMLExportHelper_Impl(
+ SvXMLExport& rExport,
+ SvXMLAutoStylePoolP& rASPool ) :
+ mrExport( rExport ),
+ mrAutoStylePool( rASPool ),
+ mbHasSeriesLabels( sal_False ),
+ mbHasCategoryLabels( sal_False ),
+ mbRowSourceColumns( sal_True )
+ // #110680#
+ // this id depends on the ServiceManager used due to the binary filter stripping.
+ // ,msCLSID( rtl::OUString( SvGlobalName( SO3_SCH_CLASSID ).GetHexName()))
+{
+ // #110680#
+ // changed initialisation for msCLSID. Compare the ServiceInfo name with
+ // the known name of the LegacyServiceManager.
+ Reference<lang::XServiceInfo> xServiceInfo( mrExport.getServiceFactory(), uno::UNO_QUERY );
+ DBG_ASSERT( xServiceInfo.is(), "XMultiServiceFactory without xServiceInfo (!)" );
+ OUString rdbURL = xServiceInfo->getImplementationName();
+ OUString implLegacyServiceManagerName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.office.LegacyServiceManager" ) );
+
+ if( rdbURL.equals( implLegacyServiceManagerName ))
+ {
+ msCLSID = OUString( SvGlobalName( BF_SO3_SCH_CLASSID ).GetHexName());
+ }
+ else
+ {
+ msCLSID = OUString( SvGlobalName( SO3_SCH_CLASSID ).GetHexName());
+ }
+
+ msTableName = OUString(RTL_CONSTASCII_USTRINGPARAM( "local-table" ));
+
+ // create factory
+ mxPropertyHandlerFactory = new XMLChartPropHdlFactory;
+
+ if( mxPropertyHandlerFactory.is() )
+ {
+ // create property set mapper
+ mxPropertySetMapper = new XMLChartPropertySetMapper;
+ }
+
+ mxExpPropMapper = new XMLChartExportPropertyMapper( mxPropertySetMapper, rExport );
+
+ // register chart auto-style family
+ mrAutoStylePool.AddFamily(
+ XML_STYLE_FAMILY_SCH_CHART_ID,
+ OUString(RTL_CONSTASCII_USTRINGPARAM( XML_STYLE_FAMILY_SCH_CHART_NAME )),
+ mxExpPropMapper.get(),
+ OUString(RTL_CONSTASCII_USTRINGPARAM( XML_STYLE_FAMILY_SCH_CHART_PREFIX )));
+
+ // register shape family
+ mrAutoStylePool.AddFamily(
+ XML_STYLE_FAMILY_SD_GRAPHICS_ID,
+ OUString(RTL_CONSTASCII_USTRINGPARAM( XML_STYLE_FAMILY_SD_GRAPHICS_NAME )),
+ mxExpPropMapper.get(),
+ OUString(RTL_CONSTASCII_USTRINGPARAM( XML_STYLE_FAMILY_SD_GRAPHICS_PREFIX )));
+ // register paragraph family also for shapes
+ mrAutoStylePool.AddFamily(
+ XML_STYLE_FAMILY_TEXT_PARAGRAPH,
+ GetXMLToken( XML_PARAGRAPH ),
+ mxExpPropMapper.get(),
+ String( 'P' ));
+ // register text family also for shapes
+ mrAutoStylePool.AddFamily(
+ XML_STYLE_FAMILY_TEXT_TEXT,
+ GetXMLToken( XML_TEXT ),
+ mxExpPropMapper.get(),
+ String( 'T' ));
+}
+
+SchXMLExportHelper_Impl::~SchXMLExportHelper_Impl()
+{
+}
+
+void SchXMLExportHelper_Impl::collectAutoStyles( Reference< chart::XChartDocument > rChartDoc )
+{
+ parseDocument( rChartDoc, sal_False );
+}
+
+void SchXMLExportHelper_Impl::exportChart( Reference< chart::XChartDocument > rChartDoc,
+ sal_Bool bIncludeTable )
+{
+ parseDocument( rChartDoc, sal_True, bIncludeTable );
+ DBG_ASSERT( maAutoStyleNameQueue.empty(), "There are still remaining autostyle names in the queue" );
+}
+
+::rtl::OUString lcl_GetStringFromNumberSequence( const ::com::sun::star::uno::Sequence< sal_Int32 >& rSequenceMapping, bool bRemoveOneFromEachIndex /*should be true if having categories*/ )
+{
+ const sal_Int32* pArray = rSequenceMapping.getConstArray();
+ const sal_Int32 nSize = rSequenceMapping.getLength();
+ sal_Int32 i = 0;
+ OUStringBuffer aBuf;
+ bool bHasPredecessor = false;
+ for( i = 0; i < nSize; ++i )
+ {
+ sal_Int32 nIndex = pArray[ i ];
+ if( bRemoveOneFromEachIndex )
+ --nIndex;
+ if(nIndex>=0)
+ {
+ if(bHasPredecessor)
+ aBuf.append( static_cast< sal_Unicode >( ' ' ));
+ aBuf.append( nIndex, 10 );
+ bHasPredecessor = true;
+ }
+ }
+ return aBuf.makeStringAndClear();
+}
+
+/// if bExportContent is false the auto-styles are collected
+void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument >& rChartDoc,
+ sal_Bool bExportContent,
+ sal_Bool bIncludeTable )
+{
+ Reference< chart2::XChartDocument > xNewDoc( rChartDoc, uno::UNO_QUERY );
+ if( !rChartDoc.is() || !xNewDoc.is() )
+ {
+ OSL_FAIL( "No XChartDocument was given for export." );
+ return;
+ }
+
+ awt::Size aPageSize( getPageSize( xNewDoc ));
+ if( bExportContent )
+ addSize( aPageSize );
+ Reference< chart::XDiagram > xDiagram = rChartDoc->getDiagram();
+ Reference< chart2::XDiagram > xNewDiagram;
+ if( xNewDoc.is())
+ xNewDiagram.set( xNewDoc->getFirstDiagram());
+
+ //todo remove if model changes are notified and view is updated automatically
+ if( bExportContent )
+ {
+ Reference< util::XRefreshable > xRefreshable( xNewDoc, uno::UNO_QUERY );
+ if( xRefreshable.is() )
+ xRefreshable->refresh();
+ }
+
+ // get Properties of ChartDocument
+ sal_Bool bHasMainTitle = sal_False;
+ sal_Bool bHasSubTitle = sal_False;
+ sal_Bool bHasLegend = sal_False;
+ util::DateTime aNullDate(0,0,0,0,30,12,1899);
+
+ std::vector< XMLPropertyState > aPropertyStates;
+
+ Reference< beans::XPropertySet > xDocPropSet( rChartDoc, uno::UNO_QUERY );
+ if( xDocPropSet.is())
+ {
+ try
+ {
+ Any aAny( xDocPropSet->getPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "HasMainTitle" ))));
+ aAny >>= bHasMainTitle;
+ aAny = xDocPropSet->getPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "HasSubTitle" )));
+ aAny >>= bHasSubTitle;
+ aAny = xDocPropSet->getPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "HasLegend" )));
+ aAny >>= bHasLegend;
+ if ( bIncludeTable )
+ {
+ OUString sNullDate( RTL_CONSTASCII_USTRINGPARAM( "NullDate" ));
+ aAny = xDocPropSet->getPropertyValue(sNullDate);
+ if ( !aAny.hasValue() )
+ {
+ Reference<container::XChild> xChild(rChartDoc, uno::UNO_QUERY );
+ if ( xChild.is() )
+ {
+ Reference< beans::XPropertySet > xParentDoc( xChild->getParent(),uno::UNO_QUERY);
+ if ( xParentDoc.is() && xParentDoc->getPropertySetInfo()->hasPropertyByName(sNullDate) )
+ aAny = xParentDoc->getPropertyValue(sNullDate);
+ }
+ }
+
+ aAny >>= aNullDate;
+ }
+ }
+ catch( beans::UnknownPropertyException & )
+ {
+ DBG_WARNING( "Required property not found in ChartDocument" );
+ }
+ }
+
+ if ( bIncludeTable && (aNullDate.Day != 30 || aNullDate.Month != 12 || aNullDate.Year != 1899 ) )
+ {
+ SvXMLElementExport aSet( mrExport, XML_NAMESPACE_TABLE, XML_CALCULATION_SETTINGS, sal_True, sal_True );
+ {
+ ::rtl::OUStringBuffer sBuffer;
+ SvXMLUnitConverter::convertDateTime(sBuffer,aNullDate);
+ mrExport.AddAttribute( XML_NAMESPACE_TABLE,XML_DATE_VALUE,sBuffer.makeStringAndClear());
+ SvXMLElementExport aNull( mrExport, XML_NAMESPACE_TABLE, XML_NULL_DATE, sal_True, sal_True );
+ }
+ }
+
+ // chart element
+ // -------------
+
+ SvXMLElementExport* pElChart = 0;
+ // get property states for autostyles
+ if( mxExpPropMapper.is())
+ {
+ Reference< beans::XPropertySet > xPropSet( rChartDoc->getArea(), uno::UNO_QUERY );
+ if( xPropSet.is())
+ aPropertyStates = mxExpPropMapper->Filter( xPropSet );
+ }
+
+ if( bExportContent )
+ {
+ //export data provider in xlink:href attribute
+ const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() );
+ if( nCurrentODFVersion >= SvtSaveOptions::ODFVER_012 )
+ {
+ OUString aDataProviderURL( RTL_CONSTASCII_USTRINGPARAM( ".." ) );
+ if( xNewDoc->hasInternalDataProvider() )
+ aDataProviderURL = OUString( RTL_CONSTASCII_USTRINGPARAM( "." ) );
+ else //special handling for data base data provider necessary
+ {
+ Reference< chart2::data::XDatabaseDataProvider > xDBDataProvider( xNewDoc->getDataProvider(), uno::UNO_QUERY );
+ if( xDBDataProvider.is() )
+ aDataProviderURL = OUString( RTL_CONSTASCII_USTRINGPARAM( "." ) );
+ }
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, aDataProviderURL );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ }
+
+ OUString sChartType( xDiagram->getDiagramType() );
+
+ // attributes
+ // determine class
+ if( sChartType.getLength())
+ {
+ enum XMLTokenEnum eXMLChartType = SchXMLTools::getTokenByChartType( sChartType, true /* bUseOldNames */ );
+
+ DBG_ASSERT( eXMLChartType != XML_TOKEN_INVALID, "invalid chart class" );
+ if( eXMLChartType == XML_TOKEN_INVALID )
+ eXMLChartType = XML_BAR;
+
+ if( eXMLChartType == XML_ADD_IN )
+ {
+ // sChartType is the servie-name of the add-in
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_CLASS,
+ mrExport.GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_OOO, sChartType) );
+ }
+ else if( eXMLChartType != XML_TOKEN_INVALID )
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_CLASS,
+ mrExport.GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_CHART, GetXMLToken(eXMLChartType )) );
+ }
+
+ //column-mapping or row-mapping
+ if( maSequenceMapping.getLength() )
+ {
+ enum XMLTokenEnum eTransToken = ::xmloff::token::XML_ROW_MAPPING;
+ if( mbRowSourceColumns )
+ eTransToken = ::xmloff::token::XML_COLUMN_MAPPING;
+ ::rtl::OUString aSequenceMappingStr( lcl_GetStringFromNumberSequence(
+ maSequenceMapping, mbHasCategoryLabels && !xNewDoc->hasInternalDataProvider() ) );
+
+ mrExport.AddAttribute( XML_NAMESPACE_CHART,
+ ::xmloff::token::GetXMLToken( eTransToken ),
+ aSequenceMappingStr );
+ }
+ }
+ // write style name
+ AddAutoStyleAttribute( aPropertyStates );
+
+ //element
+ pElChart = new SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_CHART, sal_True, sal_True );
+ }
+ else // autostyles
+ {
+ CollectAutoStyle( aPropertyStates );
+ }
+ // remove property states for autostyles
+ aPropertyStates.clear();
+
+ // title element
+ // -------------
+
+ if( bHasMainTitle )
+ {
+ // get property states for autostyles
+ if( mxExpPropMapper.is())
+ {
+ Reference< beans::XPropertySet > xPropSet( rChartDoc->getTitle(), uno::UNO_QUERY );
+ if( xPropSet.is())
+ aPropertyStates = mxExpPropMapper->Filter( xPropSet );
+ }
+ if( bExportContent )
+ {
+ Reference< drawing::XShape > xShape = rChartDoc->getTitle();
+ if( xShape.is()) // && "hasTitleBeenMoved"
+ addPosition( xShape );
+
+ // write style name
+ AddAutoStyleAttribute( aPropertyStates );
+
+ // element
+ SvXMLElementExport aElTitle( mrExport, XML_NAMESPACE_CHART, XML_TITLE, sal_True, sal_True );
+
+ // content (text:p)
+ Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY );
+ if( xPropSet.is())
+ {
+ Any aAny( xPropSet->getPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "String" ))));
+ OUString aText;
+ aAny >>= aText;
+ exportText( aText );
+ }
+ }
+ else // autostyles
+ {
+ CollectAutoStyle( aPropertyStates );
+ }
+ // remove property states for autostyles
+ aPropertyStates.clear();
+ }
+
+ // subtitle element
+ // ----------------
+
+ if( bHasSubTitle )
+ {
+ // get property states for autostyles
+ if( mxExpPropMapper.is())
+ {
+ Reference< beans::XPropertySet > xPropSet( rChartDoc->getSubTitle(), uno::UNO_QUERY );
+ if( xPropSet.is())
+ aPropertyStates = mxExpPropMapper->Filter( xPropSet );
+ }
+
+ if( bExportContent )
+ {
+ Reference< drawing::XShape > xShape = rChartDoc->getSubTitle();
+ if( xShape.is())
+ addPosition( xShape );
+
+ // write style name
+ AddAutoStyleAttribute( aPropertyStates );
+
+ // element (has no subelements)
+ SvXMLElementExport aElSubTitle( mrExport, XML_NAMESPACE_CHART, XML_SUBTITLE, sal_True, sal_True );
+
+ // content (text:p)
+ Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY );
+ if( xPropSet.is())
+ {
+ Any aAny( xPropSet->getPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "String" ))));
+ OUString aText;
+ aAny >>= aText;
+ exportText( aText );
+ }
+ }
+ else // autostyles
+ {
+ CollectAutoStyle( aPropertyStates );
+ }
+ // remove property states for autostyles
+ aPropertyStates.clear();
+ }
+
+ // legend element
+ // --------------
+ if( bHasLegend )
+ {
+ // get property states for autostyles
+ if( mxExpPropMapper.is())
+ {
+ Reference< beans::XPropertySet > xPropSet( rChartDoc->getLegend(), uno::UNO_QUERY );
+ if( xPropSet.is())
+ aPropertyStates = mxExpPropMapper->Filter( xPropSet );
+ }
+
+ if( bExportContent )
+ {
+ Reference< beans::XPropertySet > xProp( rChartDoc->getLegend(), uno::UNO_QUERY );
+ if( xProp.is())
+ {
+ // export legend anchor position
+ try
+ {
+ Any aAny( xProp->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Alignment" ))));
+ if( SchXMLEnumConverter::getLegendPositionConverter().exportXML( msString, aAny, mrExport.GetMM100UnitConverter() ) )
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_LEGEND_POSITION, msString );
+ }
+ catch( beans::UnknownPropertyException & )
+ {
+ DBG_WARNING( "Property Align not found in ChartLegend" );
+ }
+
+ // export absolute legend position
+ Reference< drawing::XShape > xLegendShape( xProp, uno::UNO_QUERY );
+ addPosition( xLegendShape );
+
+ // export legend size
+ const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() );
+ if( xLegendShape.is() && nCurrentODFVersion >= SvtSaveOptions::ODFVER_012 && nCurrentODFVersion == SvtSaveOptions::ODFVER_LATEST )//do not export legend-expansion to ODF 1.0 and export size only if extensions are enabled //#i28670# todo: change this dependent on fileformat evolution
+ {
+ try
+ {
+ chart::ChartLegendExpansion nLegendExpansion = chart::ChartLegendExpansion_HIGH;
+ OUString aExpansionString;
+ Any aAny( xProp->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Expansion" ))));
+ bool bHasExpansion = (aAny >>= nLegendExpansion);
+ if( bHasExpansion && SchXMLEnumConverter::getLegendExpansionConverter().exportXML( aExpansionString, aAny, mrExport.GetMM100UnitConverter() ) )
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_STYLE, XML_LEGEND_EXPANSION, aExpansionString );
+ if( nLegendExpansion == chart::ChartLegendExpansion_CUSTOM)
+ {
+ awt::Size aSize( xLegendShape->getSize() );
+ addSize( aSize, true );
+ rtl::OUStringBuffer aAspectRatioString;
+ SvXMLUnitConverter::convertDouble(aAspectRatioString, double(aSize.Width)/double(aSize.Height));
+ mrExport.AddAttribute( XML_NAMESPACE_STYLE, XML_LEGEND_EXPANSION_ASPECT_RATIO, aAspectRatioString.makeStringAndClear() );
+ }
+ }
+ }
+ catch( beans::UnknownPropertyException & )
+ {
+ DBG_WARNING( "Property Expansion not found in ChartLegend" );
+ }
+ }
+ }
+
+ // write style name
+ AddAutoStyleAttribute( aPropertyStates );
+
+ // element
+ SvXMLElementExport aLegend( mrExport, XML_NAMESPACE_CHART, XML_LEGEND, sal_True, sal_True );
+ }
+ else // autostyles
+ {
+ CollectAutoStyle( aPropertyStates );
+ }
+ // remove property states for autostyles
+ aPropertyStates.clear();
+ }
+
+ // plot-area element
+ // -----------------
+ if( xDiagram.is())
+ exportPlotArea( xDiagram, xNewDiagram, aPageSize, bExportContent, bIncludeTable );
+
+ // export additional shapes
+ // ------------------------
+ if( xDocPropSet.is() )
+ {
+ if( bExportContent )
+ {
+ if( mxAdditionalShapes.is())
+ {
+ // can't call exportShapes with all shapes because the
+ // initialisation happend with the complete draw page and not
+ // the XShapes object used here. Thus the shapes have to be
+ // exported one by one
+ UniReference< XMLShapeExport > rShapeExport = mrExport.GetShapeExport();
+ Reference< drawing::XShape > xShape;
+ const sal_Int32 nShapeCount( mxAdditionalShapes->getCount());
+ for( sal_Int32 nShapeId = 0; nShapeId < nShapeCount; nShapeId++ )
+ {
+ mxAdditionalShapes->getByIndex( nShapeId ) >>= xShape;
+ DBG_ASSERT( xShape.is(), "Shape without an XShape?" );
+ if( ! xShape.is())
+ continue;
+
+ rShapeExport->exportShape( xShape );
+ }
+ // this would be the easier way if it worked:
+ //mrExport.GetShapeExport()->exportShapes( mxAdditionalShapes );
+ }
+ }
+ else
+ {
+ // get a sequence of non-chart shapes (inserted via clipboard)
+ try
+ {
+ Any aShapesAny = xDocPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM( "AdditionalShapes" )));
+ aShapesAny >>= mxAdditionalShapes;
+ }
+ catch( uno::Exception & rEx )
+ {
+ (void)rEx; // avoid warning for pro build
+ OSL_TRACE(
+ OUStringToOString(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "AdditionalShapes not found: " )) +
+ rEx.Message,
+ RTL_TEXTENCODING_ASCII_US ).getStr());
+ }
+
+ if( mxAdditionalShapes.is())
+ {
+ // seek shapes has to be called for the whole page because in
+ // the shape export the vector of shapes is accessed via the
+ // ZOrder which might be (actually is) larger than the number of
+ // shapes in mxAdditionalShapes
+ Reference< drawing::XDrawPageSupplier > xSupplier( rChartDoc, uno::UNO_QUERY );
+ DBG_ASSERT( xSupplier.is(), "Cannot retrieve draw page to initialize shape export" );
+ if( xSupplier.is() )
+ {
+ Reference< drawing::XShapes > xDrawPage( xSupplier->getDrawPage(), uno::UNO_QUERY );
+ DBG_ASSERT( xDrawPage.is(), "Invalid draw page for initializing shape export" );
+ if( xDrawPage.is())
+ mrExport.GetShapeExport()->seekShapes( xDrawPage );
+ }
+
+ // can't call collectShapesAutoStyles with all shapes because
+ // the initialisation happend with the complete draw page and
+ // not the XShapes object used here. Thus the shapes have to be
+ // exported one by one
+ UniReference< XMLShapeExport > rShapeExport = mrExport.GetShapeExport();
+ Reference< drawing::XShape > xShape;
+ const sal_Int32 nShapeCount( mxAdditionalShapes->getCount());
+ for( sal_Int32 nShapeId = 0; nShapeId < nShapeCount; nShapeId++ )
+ {
+ mxAdditionalShapes->getByIndex( nShapeId ) >>= xShape;
+ DBG_ASSERT( xShape.is(), "Shape without an XShape?" );
+ if( ! xShape.is())
+ continue;
+
+ rShapeExport->collectShapeAutoStyles( xShape );
+ }
+ }
+ }
+ }
+
+ // table element
+ // (is included as subelement of chart)
+ // ------------------------------------
+ if( bExportContent )
+ {
+ // #85929# always export table, otherwise clipboard may loose data
+ exportTable();
+ }
+
+ // close <chart:chart> element
+ if( pElChart )
+ delete pElChart;
+}
+
+void lcl_exportComplexLabel( const Sequence< uno::Any >& rComplexLabel, SvXMLExport& rExport )
+{
+ sal_Int32 nLength = rComplexLabel.getLength();
+ if( nLength<=1 )
+ return;
+ SvXMLElementExport aTextList( rExport, XML_NAMESPACE_TEXT, XML_LIST, sal_True, sal_True );
+ for(sal_Int32 nN=0; nN<nLength; nN++)
+ {
+ SvXMLElementExport aListItem( rExport, XML_NAMESPACE_TEXT, XML_LIST_ITEM, sal_True, sal_True );
+ OUString aString;
+ if( !(rComplexLabel[nN]>>=aString) )
+ {
+ //todo?
+ }
+ SchXMLTools::exportText( rExport, aString, false /*bConvertTabsLFs*/ );
+ }
+}
+
+void SchXMLExportHelper_Impl::exportTable()
+{
+ // table element
+ // -------------
+ mrExport.AddAttribute( XML_NAMESPACE_TABLE, XML_NAME, msTableName );
+
+ try
+ {
+ bool bProtected = false;
+ Reference< beans::XPropertySet > xProps( mrExport.GetModel(), uno::UNO_QUERY_THROW );
+ if ( ( xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "DisableDataTableDialog" ) ) ) >>= bProtected ) &&
+ bProtected )
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_TABLE, XML_PROTECTED, XML_TRUE );
+ }
+ }
+ catch ( uno::Exception& )
+ {
+ }
+
+ SvXMLElementExport aTable( mrExport, XML_NAMESPACE_TABLE, XML_TABLE, sal_True, sal_True );
+
+ bool bHasOwnData = false;
+ Reference< chart2::XChartDocument > xNewDoc( mrExport.GetModel(), uno::UNO_QUERY );
+ Reference< chart2::data::XRangeXMLConversion > xRangeConversion;
+ if( xNewDoc.is())
+ {
+ bHasOwnData = xNewDoc->hasInternalDataProvider();
+ xRangeConversion.set( xNewDoc->getDataProvider(), uno::UNO_QUERY );
+ }
+
+ Reference< chart2::XAnyDescriptionAccess > xAnyDescriptionAccess;
+ {
+ Reference< chart::XChartDocument > xChartDoc( mrExport.GetModel(), uno::UNO_QUERY );
+ if( xChartDoc.is() )
+ xAnyDescriptionAccess = Reference< chart2::XAnyDescriptionAccess >( xChartDoc->getData(), uno::UNO_QUERY );
+ }
+
+ if( bHasOwnData )
+ lcl_ReorderInternalSequencesAccordingToTheirRangeName( m_aDataSequencesToExport );
+ lcl_TableData aData( lcl_getDataForLocalTable( m_aDataSequencesToExport
+ , xAnyDescriptionAccess, maCategoriesRange
+ , mbRowSourceColumns, xRangeConversion ));
+
+ tStringVector::const_iterator aDataRangeIter( aData.aDataRangeRepresentations.begin());
+ const tStringVector::const_iterator aDataRangeEndIter( aData.aDataRangeRepresentations.end());
+
+ tStringVector::const_iterator aRowDescriptions_RangeIter( aData.aRowDescriptions_Ranges.begin());
+ const tStringVector::const_iterator aRowDescriptions_RangeEnd( aData.aRowDescriptions_Ranges.end());
+
+ // declare columns
+ {
+ SvXMLElementExport aHeaderColumns( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_HEADER_COLUMNS, sal_True, sal_True );
+ SvXMLElementExport aHeaderColumn( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_COLUMN, sal_True, sal_True );
+ }
+ {
+ SvXMLElementExport aColumns( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_COLUMNS, sal_True, sal_True );
+
+ sal_Int32 nNextIndex = 0;
+ for( size_t nN=0; nN< aData.aHiddenColumns.size(); nN++ )
+ {
+ //i91578 display of hidden values (copy paste scenario; export hidden flag thus it can be used during migration to locale table upon paste )
+ sal_Int32 nHiddenIndex = aData.aHiddenColumns[nN];
+ if( nHiddenIndex > nNextIndex )
+ {
+ sal_Int64 nRepeat = static_cast< sal_Int64 >( nHiddenIndex - nNextIndex );
+ if(nRepeat>1)
+ mrExport.AddAttribute( XML_NAMESPACE_TABLE, XML_NUMBER_COLUMNS_REPEATED,
+ OUString::valueOf( nRepeat ));
+ SvXMLElementExport aColumn( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_COLUMN, sal_True, sal_True );
+ }
+ mrExport.AddAttribute( XML_NAMESPACE_TABLE, XML_VISIBILITY, GetXMLToken( XML_COLLAPSE ) );
+ SvXMLElementExport aColumn( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_COLUMN, sal_True, sal_True );
+ nNextIndex = nHiddenIndex+1;
+ }
+
+ sal_Int32 nEndIndex = aData.aColumnDescriptions.size()-1;
+ if( nEndIndex >= nNextIndex )
+ {
+ sal_Int64 nRepeat = static_cast< sal_Int64 >( nEndIndex - nNextIndex + 1 );
+ if(nRepeat>1)
+ mrExport.AddAttribute( XML_NAMESPACE_TABLE, XML_NUMBER_COLUMNS_REPEATED,
+ OUString::valueOf( nRepeat ));
+ SvXMLElementExport aColumn( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_COLUMN, sal_True, sal_True );
+ }
+ }
+
+ // export rows with content
+ //export header row
+ {
+ SvXMLElementExport aHeaderRows( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_HEADER_ROWS, sal_True, sal_True );
+ SvXMLElementExport aRow( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_ROW, sal_True, sal_True );
+
+ //first one empty cell for the row descriptions
+ {
+ SvXMLElementExport aEmptyCell( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_CELL, sal_True, sal_True );
+ SvXMLElementExport aEmptyParagraph( mrExport, XML_NAMESPACE_TEXT, XML_P, sal_True, sal_True );
+ }
+
+ //export column descriptions
+ tStringVector::const_iterator aColumnDescriptions_RangeIter( aData.aColumnDescriptions_Ranges.begin());
+ const tStringVector::const_iterator aColumnDescriptions_RangeEnd( aData.aColumnDescriptions_Ranges.end());
+ const Sequence< Sequence< uno::Any > >& rComplexColumnDescriptions = aData.aComplexColumnDescriptions;
+ sal_Int32 nComplexCount = rComplexColumnDescriptions.getLength();
+ sal_Int32 nC = 0;
+ for( tStringVector::const_iterator aIt( aData.aColumnDescriptions.begin())
+ ; (aIt != aData.aColumnDescriptions.end())
+ ; aIt++, nC++ )
+ {
+ bool bExportString = true;
+ if( nC < nComplexCount )
+ {
+ const Sequence< uno::Any >& rComplexLabel = rComplexColumnDescriptions[nC];
+ if( rComplexLabel.getLength()>0 )
+ {
+ double fValue=0.0;
+ if( rComplexLabel[0] >>=fValue )
+ {
+ bExportString = false;
+
+ SvXMLUnitConverter::convertDouble( msStringBuffer, fValue );
+ msString = msStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute( XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_FLOAT );
+ mrExport.AddAttribute( XML_NAMESPACE_OFFICE, XML_VALUE, msString );
+ }
+ }
+ }
+ if( bExportString )
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_STRING );
+ }
+
+ SvXMLElementExport aCell( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_CELL, sal_True, sal_True );
+ exportText( *aIt );
+ if( nC < nComplexCount )
+ lcl_exportComplexLabel( rComplexColumnDescriptions[nC], mrExport );
+ if( !bHasOwnData && aColumnDescriptions_RangeIter != aColumnDescriptions_RangeEnd )
+ {
+ // remind the original range to allow a correct re-association when copying via clipboard
+ if ((*aColumnDescriptions_RangeIter).getLength())
+ SchXMLTools::exportRangeToSomewhere( mrExport, *aColumnDescriptions_RangeIter );
+ ++aColumnDescriptions_RangeIter;
+ }
+ }
+ OSL_ASSERT( bHasOwnData || aColumnDescriptions_RangeIter == aColumnDescriptions_RangeEnd );
+ } // closing row and header-rows elements
+
+ // export value rows
+ {
+ SvXMLElementExport aRows( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_ROWS, sal_True, sal_True );
+ tStringVector::const_iterator aRowDescriptionsIter( aData.aRowDescriptions.begin());
+ const Sequence< Sequence< uno::Any > >& rComplexRowDescriptions = aData.aComplexRowDescriptions;
+ sal_Int32 nComplexCount = rComplexRowDescriptions.getLength();
+ sal_Int32 nC = 0;
+
+ for( t2DNumberContainer::const_iterator aRowIt( aData.aDataInRows.begin())
+ ; aRowIt != aData.aDataInRows.end()
+ ; ++aRowIt, ++nC )
+ {
+ SvXMLElementExport aRow( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_ROW, sal_True, sal_True );
+
+ //export row descriptions
+ {
+ bool bExportString = true;
+ if( nC < nComplexCount )
+ {
+ const Sequence< uno::Any >& rComplexLabel = rComplexRowDescriptions[nC];
+ if( rComplexLabel.getLength()>0 )
+ {
+ double fValue=0.0;
+ if( rComplexLabel[0] >>=fValue )
+ {
+ bExportString = false;
+
+ SvXMLUnitConverter::convertDouble( msStringBuffer, fValue );
+ msString = msStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute( XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_FLOAT );
+ mrExport.AddAttribute( XML_NAMESPACE_OFFICE, XML_VALUE, msString );
+ }
+ }
+ }
+ if( bExportString )
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_STRING );
+ }
+
+ SvXMLElementExport aCell( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_CELL, sal_True, sal_True );
+ if( aRowDescriptionsIter != aData.aRowDescriptions.end())
+ {
+ exportText( *aRowDescriptionsIter );
+ if( nC < nComplexCount )
+ lcl_exportComplexLabel( rComplexRowDescriptions[nC], mrExport );
+ if( !bHasOwnData && aRowDescriptions_RangeIter != aRowDescriptions_RangeEnd )
+ {
+ // remind the original range to allow a correct re-association when copying via clipboard
+ SchXMLTools::exportRangeToSomewhere( mrExport, *aRowDescriptions_RangeIter );
+ ++aRowDescriptions_RangeIter;
+ }
+ ++aRowDescriptionsIter;
+ }
+ }
+
+ //export row values
+ for( t2DNumberContainer::value_type::const_iterator aColIt( aRowIt->begin());
+ aColIt != aRowIt->end(); ++aColIt )
+ {
+ SvXMLUnitConverter::convertDouble( msStringBuffer, *aColIt );
+ msString = msStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute( XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_FLOAT );
+ mrExport.AddAttribute( XML_NAMESPACE_OFFICE, XML_VALUE, msString );
+ SvXMLElementExport aCell( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_CELL, sal_True, sal_True );
+ exportText( msString, false ); // do not convert tabs and lfs
+ if( ( !bHasOwnData && aDataRangeIter != aDataRangeEndIter ) &&
+ ( mbRowSourceColumns || (aColIt == aRowIt->begin()) ) )
+ {
+ // remind the original range to allow a correct re-association when copying via clipboard
+ if ((*aDataRangeIter).getLength())
+ SchXMLTools::exportRangeToSomewhere( mrExport, *aDataRangeIter );
+ ++aDataRangeIter;
+ }
+ }
+ }
+ }
+
+ // if range iterator was used it should have reached its end
+ OSL_ASSERT( bHasOwnData || (aDataRangeIter == aDataRangeEndIter) );
+ OSL_ASSERT( bHasOwnData || (aRowDescriptions_RangeIter == aRowDescriptions_RangeEnd) );
+}
+
+namespace
+{
+
+Reference< chart2::XCoordinateSystem > lcl_getCooSys( const Reference< chart2::XDiagram > & xNewDiagram )
+{
+ Reference< chart2::XCoordinateSystem > xCooSys;
+ Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xNewDiagram, uno::UNO_QUERY );
+ if(xCooSysCnt.is())
+ {
+ Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems() );
+ if(aCooSysSeq.getLength()>0)
+ xCooSys = aCooSysSeq[0];
+ }
+ return xCooSys;
+}
+
+Reference< chart2::XAxis > lcl_getAxis( const Reference< chart2::XCoordinateSystem >& xCooSys,
+ enum XMLTokenEnum eDimension, bool bPrimary=true )
+{
+ Reference< chart2::XAxis > xNewAxis;
+ try
+ {
+ if( xCooSys.is() )
+ {
+ sal_Int32 nDimensionIndex=0;
+ switch( eDimension )
+ {
+ case XML_X:
+ nDimensionIndex=0;
+ break;
+ case XML_Y:
+ nDimensionIndex=1;
+ break;
+ case XML_Z:
+ nDimensionIndex=2;
+ break;
+ default:
+ break;
+ }
+
+ xNewAxis = xCooSys->getAxisByDimension( nDimensionIndex, bPrimary ? 0 : 1 );
+ }
+ }
+ catch( const uno::Exception & )
+ {
+ }
+ return xNewAxis;
+}
+
+}
+
+void SchXMLExportHelper_Impl::exportPlotArea(
+ Reference< chart::XDiagram > xDiagram,
+ Reference< chart2::XDiagram > xNewDiagram,
+ const awt::Size & rPageSize,
+ sal_Bool bExportContent,
+ sal_Bool bIncludeTable )
+{
+ DBG_ASSERT( xDiagram.is(), "Invalid XDiagram as parameter" );
+ if( ! xDiagram.is())
+ return;
+
+ // variables for autostyles
+ Reference< beans::XPropertySet > xPropSet;
+ std::vector< XMLPropertyState > aPropertyStates;
+
+ sal_Bool bIs3DChart = sal_False;
+ drawing::HomogenMatrix aTransMatrix;
+
+ msStringBuffer.setLength( 0 );
+
+ // plot-area element
+ // -----------------
+
+ SvXMLElementExport* pElPlotArea = 0;
+ // get property states for autostyles
+ xPropSet = Reference< beans::XPropertySet >( xDiagram, uno::UNO_QUERY );
+ if( xPropSet.is())
+ {
+ if( mxExpPropMapper.is())
+ aPropertyStates = mxExpPropMapper->Filter( xPropSet );
+ }
+ if( bExportContent )
+ {
+ UniReference< XMLShapeExport > rShapeExport;
+
+ // write style name
+ AddAutoStyleAttribute( aPropertyStates );
+
+ if( msChartAddress.getLength() )
+ {
+ if( !bIncludeTable )
+ mrExport.AddAttribute( XML_NAMESPACE_TABLE, XML_CELL_RANGE_ADDRESS, msChartAddress );
+
+ Reference< chart::XChartDocument > xDoc( mrExport.GetModel(), uno::UNO_QUERY );
+ if( xDoc.is() )
+ {
+ Reference< beans::XPropertySet > xDocProp( xDoc, uno::UNO_QUERY );
+ if( xDocProp.is())
+ {
+ Any aAny;
+ sal_Bool bFirstCol = false, bFirstRow = false;
+
+ try
+ {
+ aAny = xDocProp->getPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "DataSourceLabelsInFirstColumn" )));
+ aAny >>= bFirstCol;
+ aAny = xDocProp->getPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "DataSourceLabelsInFirstRow" )));
+ aAny >>= bFirstRow;
+
+ if( bFirstCol || bFirstRow )
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_CHART,
+ ::xmloff::token::GetXMLToken( ::xmloff::token::XML_DATA_SOURCE_HAS_LABELS ),
+ ( bFirstCol
+ ? ( bFirstRow
+ ? ::xmloff::token::GetXMLToken( ::xmloff::token::XML_BOTH )
+ : ::xmloff::token::GetXMLToken( ::xmloff::token::XML_COLUMN ))
+ : ::xmloff::token::GetXMLToken( ::xmloff::token::XML_ROW )));
+ }
+ }
+ catch( beans::UnknownPropertyException & )
+ {
+ DBG_ERRORFILE( "Properties missing" );
+ }
+ }
+ }
+ }
+
+ // #i72973#, #144135# only export table-number-list in OOo format (also for binary)
+ Reference< beans::XPropertySet > xExportInfo( mrExport.getExportInfo());
+ if( msTableNumberList.getLength() &&
+ xExportInfo.is())
+ {
+ try
+ {
+ OUString sExportTableNumListPropName( RTL_CONSTASCII_USTRINGPARAM("ExportTableNumberList"));
+ Reference< beans::XPropertySetInfo > xInfo( xExportInfo->getPropertySetInfo());
+ bool bExportTableNumberList = false;
+ if( xInfo.is() && xInfo->hasPropertyByName( sExportTableNumListPropName ) &&
+ (xExportInfo->getPropertyValue( sExportTableNumListPropName ) >>= bExportTableNumberList) &&
+ bExportTableNumberList )
+ {
+ // this attribute is for charts embedded in calc documents only.
+ // With this you are able to store a file again in 5.0 binary format
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_TABLE_NUMBER_LIST, msTableNumberList );
+ }
+ }
+ catch( uno::Exception & rEx )
+ {
+#ifdef DBG_UTIL
+ String aStr( rEx.Message );
+ ByteString aBStr( aStr, RTL_TEXTENCODING_ASCII_US );
+ OSL_TRACE( "chart:TableNumberList property caught: %s", aBStr.GetBuffer());
+#else
+ (void)rEx; // avoid warning
+#endif
+ }
+ }
+
+ // attributes
+ Reference< drawing::XShape > xShape ( xDiagram, uno::UNO_QUERY );
+ if( xShape.is())
+ {
+ addPosition( xShape );
+ addSize( xShape );
+ }
+
+ if( xPropSet.is())
+ {
+ Any aAny;
+
+ // 3d attributes
+ try
+ {
+ aAny = xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Dim3D" )));
+ aAny >>= bIs3DChart;
+
+ if( bIs3DChart )
+ {
+ rShapeExport = mrExport.GetShapeExport();
+ if( rShapeExport.is())
+ rShapeExport->export3DSceneAttributes( xPropSet );
+ }
+ }
+ catch( uno::Exception & rEx )
+ {
+#ifdef DBG_UTIL
+ String aStr( rEx.Message );
+ ByteString aBStr( aStr, RTL_TEXTENCODING_ASCII_US );
+ OSL_TRACE( "chart:exportPlotAreaException caught: %s", aBStr.GetBuffer());
+#else
+ (void)rEx; // avoid warning
+#endif
+ }
+ }
+
+ // plot-area element
+ pElPlotArea = new SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_PLOT_AREA, sal_True, sal_True );
+
+ //inner position rectangle element
+ exportCoordinateRegion( xDiagram );
+
+ // light sources (inside plot area element)
+ if( bIs3DChart &&
+ rShapeExport.is())
+ rShapeExport->export3DLamps( xPropSet );
+ }
+ else // autostyles
+ {
+ CollectAutoStyle( aPropertyStates );
+ }
+ // remove property states for autostyles
+ aPropertyStates.clear();
+
+ // axis elements
+ // -------------
+ exportAxes( xDiagram, xNewDiagram, bExportContent );
+
+ // series elements
+ // ---------------
+ Reference< chart2::XAxis > xSecondYAxis = lcl_getAxis( lcl_getCooSys( xNewDiagram ), XML_Y, false );
+ exportSeries( xNewDiagram, rPageSize, bExportContent, xSecondYAxis.is() );
+
+ // stock-chart elements
+ OUString sChartType ( xDiagram->getDiagramType());
+ if( 0 == sChartType.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.chart.StockDiagram" )))
+ {
+ Reference< chart::XStatisticDisplay > xStockPropProvider( xDiagram, uno::UNO_QUERY );
+ if( xStockPropProvider.is())
+ {
+ // stock-gain-marker
+ Reference< beans::XPropertySet > xStockPropSet = xStockPropProvider->getUpBar();
+ if( xStockPropSet.is())
+ {
+ aPropertyStates.clear();
+ aPropertyStates = mxExpPropMapper->Filter( xStockPropSet );
+
+ if( !aPropertyStates.empty() )
+ {
+ if( bExportContent )
+ {
+ AddAutoStyleAttribute( aPropertyStates );
+
+ SvXMLElementExport aGain( mrExport, XML_NAMESPACE_CHART, XML_STOCK_GAIN_MARKER, sal_True, sal_True );
+ }
+ else
+ {
+ CollectAutoStyle( aPropertyStates );
+ }
+ }
+ }
+
+ // stock-loss-marker
+ xStockPropSet = xStockPropProvider->getDownBar();
+ if( xStockPropSet.is())
+ {
+ aPropertyStates.clear();
+ aPropertyStates = mxExpPropMapper->Filter( xStockPropSet );
+
+ if( !aPropertyStates.empty() )
+ {
+ if( bExportContent )
+ {
+ AddAutoStyleAttribute( aPropertyStates );
+
+ SvXMLElementExport aGain( mrExport, XML_NAMESPACE_CHART, XML_STOCK_LOSS_MARKER, sal_True, sal_True );
+ }
+ else
+ {
+ CollectAutoStyle( aPropertyStates );
+ }
+ }
+ }
+
+ // stock-range-line
+ xStockPropSet = xStockPropProvider->getMinMaxLine();
+ if( xStockPropSet.is())
+ {
+ aPropertyStates.clear();
+ aPropertyStates = mxExpPropMapper->Filter( xStockPropSet );
+
+ if( !aPropertyStates.empty() )
+ {
+ if( bExportContent )
+ {
+ AddAutoStyleAttribute( aPropertyStates );
+
+ SvXMLElementExport aGain( mrExport, XML_NAMESPACE_CHART, XML_STOCK_RANGE_LINE, sal_True, sal_True );
+ }
+ else
+ {
+ CollectAutoStyle( aPropertyStates );
+ }
+ }
+ }
+ }
+ }
+
+ // wall and floor element
+ // ----------------------
+
+ Reference< chart::X3DDisplay > xWallFloorSupplier( xDiagram, uno::UNO_QUERY );
+ if( mxExpPropMapper.is() &&
+ xWallFloorSupplier.is())
+ {
+ // remove property states for autostyles
+ aPropertyStates.clear();
+
+ Reference< beans::XPropertySet > xWallPropSet( xWallFloorSupplier->getWall(), uno::UNO_QUERY );
+ if( xWallPropSet.is())
+ {
+ aPropertyStates = mxExpPropMapper->Filter( xWallPropSet );
+
+ if( !aPropertyStates.empty() )
+ {
+ // write element
+ if( bExportContent )
+ {
+ // add style name attribute
+ AddAutoStyleAttribute( aPropertyStates );
+
+ SvXMLElementExport aWall( mrExport, XML_NAMESPACE_CHART, XML_WALL, sal_True, sal_True );
+ }
+ else // autostyles
+ {
+ CollectAutoStyle( aPropertyStates );
+ }
+ }
+ }
+
+ // floor element
+ // -------------
+
+ // remove property states for autostyles
+ aPropertyStates.clear();
+
+ Reference< beans::XPropertySet > xFloorPropSet( xWallFloorSupplier->getFloor(), uno::UNO_QUERY );
+ if( xFloorPropSet.is())
+ {
+ aPropertyStates = mxExpPropMapper->Filter( xFloorPropSet );
+
+ if( !aPropertyStates.empty() )
+ {
+ // write element
+ if( bExportContent )
+ {
+ // add style name attribute
+ AddAutoStyleAttribute( aPropertyStates );
+
+ SvXMLElementExport aFloor( mrExport, XML_NAMESPACE_CHART, XML_FLOOR, sal_True, sal_True );
+ }
+ else // autostyles
+ {
+ CollectAutoStyle( aPropertyStates );
+ }
+ }
+ }
+ }
+
+ if( pElPlotArea )
+ delete pElPlotArea;
+}
+
+void SchXMLExportHelper_Impl::exportCoordinateRegion( const uno::Reference< chart::XDiagram >& xDiagram )
+{
+ const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() );
+ if( nCurrentODFVersion <= SvtSaveOptions::ODFVER_012 )//do not export to ODF 1.2 or older
+ return;
+ if( nCurrentODFVersion != SvtSaveOptions::ODFVER_LATEST )//export only if extensions are enabled //#i100778# todo: change this dependent on fileformat evolution
+ return;
+
+ Reference< chart::XDiagramPositioning > xDiaPos( xDiagram, uno::UNO_QUERY );
+ DBG_ASSERT( xDiaPos.is(), "Invalid xDiaPos as parameter" );
+ if( !xDiaPos.is() )
+ return;
+
+ awt::Rectangle aRect( xDiaPos->calculateDiagramPositionExcludingAxes() );
+ addPosition( awt::Point(aRect.X,aRect.Y) );
+ addSize( awt::Size(aRect.Width,aRect.Height) );
+
+ SvXMLElementExport aCoordinateRegion( mrExport, XML_NAMESPACE_CHART_EXT, XML_COORDINATE_REGION, sal_True, sal_True );//#i100778# todo: change to chart namespace in future - dependent on fileformat
+}
+
+namespace
+{
+ XMLTokenEnum lcl_getTimeUnitToken( sal_Int32 nTimeUnit )
+ {
+ XMLTokenEnum eToken = XML_DAYS;
+ switch( nTimeUnit )
+ {
+ case ::com::sun::star::chart::TimeUnit::YEAR:
+ eToken = XML_YEARS;
+ break;
+ case ::com::sun::star::chart::TimeUnit::MONTH:
+ eToken = XML_MONTHS;
+ break;
+ default://days
+ break;
+ }
+ return eToken;
+ }
+}
+
+void SchXMLExportHelper_Impl::exportDateScale( const Reference< beans::XPropertySet > xAxisProps )
+{
+ if( !xAxisProps.is() )
+ return;
+
+ chart::TimeIncrement aIncrement;
+ if( (xAxisProps->getPropertyValue( OUString::createFromAscii( "TimeIncrement" )) >>= aIncrement) )
+ {
+ sal_Int32 nTimeResolution = ::com::sun::star::chart::TimeUnit::DAY;
+ if( aIncrement.TimeResolution >>= nTimeResolution )
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_BASE_TIME_UNIT, lcl_getTimeUnitToken( nTimeResolution ) );
+
+ OUStringBuffer aValue;
+ chart::TimeInterval aInterval;
+ if( aIncrement.MajorTimeInterval >>= aInterval )
+ {
+ SvXMLUnitConverter::convertNumber( aValue, aInterval.Number );
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_MAJOR_INTERVAL_VALUE, aValue.makeStringAndClear() );
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_MAJOR_INTERVAL_UNIT, lcl_getTimeUnitToken( aInterval.TimeUnit ) );
+ }
+ if( aIncrement.MinorTimeInterval >>= aInterval )
+ {
+ SvXMLUnitConverter::convertNumber( aValue, aInterval.Number );
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_MINOR_INTERVAL_VALUE, aValue.makeStringAndClear() );
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_MINOR_INTERVAL_UNIT, lcl_getTimeUnitToken( aInterval.TimeUnit ) );
+ }
+
+ SvXMLElementExport aDateScale( mrExport, XML_NAMESPACE_CHART_EXT, XML_DATE_SCALE, sal_True, sal_True );//#i25706#todo: change namespace for next ODF version
+ }
+}
+
+void SchXMLExportHelper_Impl::exportAxisTitle( const Reference< beans::XPropertySet > xTitleProps, bool bExportContent )
+{
+ if( !xTitleProps.is() )
+ return;
+ std::vector< XMLPropertyState > aPropertyStates = mxExpPropMapper->Filter( xTitleProps );
+ if( bExportContent )
+ {
+ OUString aText;
+ Any aAny( xTitleProps->getPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "String" ))));
+ aAny >>= aText;
+
+ Reference< drawing::XShape > xShape( xTitleProps, uno::UNO_QUERY );
+ if( xShape.is())
+ addPosition( xShape );
+
+ AddAutoStyleAttribute( aPropertyStates );
+ SvXMLElementExport aTitle( mrExport, XML_NAMESPACE_CHART, XML_TITLE, sal_True, sal_True );
+
+ // paragraph containing title
+ exportText( aText );
+ }
+ else
+ {
+ CollectAutoStyle( aPropertyStates );
+ }
+ aPropertyStates.clear();
+}
+
+void SchXMLExportHelper_Impl::exportGrid( const Reference< beans::XPropertySet > xGridProperties, bool bMajor, bool bExportContent )
+{
+ if( !xGridProperties.is() )
+ return;
+ std::vector< XMLPropertyState > aPropertyStates = mxExpPropMapper->Filter( xGridProperties );
+ if( bExportContent )
+ {
+ AddAutoStyleAttribute( aPropertyStates );
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_CLASS, bMajor ? XML_MAJOR : XML_MINOR );
+ SvXMLElementExport aGrid( mrExport, XML_NAMESPACE_CHART, XML_GRID, sal_True, sal_True );
+ }
+ else
+ {
+ CollectAutoStyle( aPropertyStates );
+ }
+ aPropertyStates.clear();
+}
+
+namespace
+{
+
+//returns true if a date scale needs to be exported
+bool lcl_exportAxisType( const Reference< chart2::XAxis > xChart2Axis, SvXMLExport& rExport)
+{
+ bool bExportDateScale = false;
+ if( !xChart2Axis.is() )
+ return bExportDateScale;
+
+ const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() );
+ if( nCurrentODFVersion != SvtSaveOptions::ODFVER_LATEST ) //#i25706#todo: change version for next ODF version
+ return bExportDateScale;
+
+ chart2::ScaleData aScale( xChart2Axis->getScaleData() );
+ //#i25706#todo: change namespace for next ODF version
+ sal_uInt16 nNameSpace = XML_NAMESPACE_CHART_EXT;
+
+ switch(aScale.AxisType)
+ {
+ case chart2::AxisType::CATEGORY:
+ if( aScale.AutoDateAxis )
+ {
+ rExport.AddAttribute( nNameSpace, XML_AXIS_TYPE, XML_AUTO );
+ bExportDateScale = true;
+ }
+ else
+ rExport.AddAttribute( nNameSpace, XML_AXIS_TYPE, XML_TEXT );
+ break;
+ case chart2::AxisType::DATE:
+ rExport.AddAttribute( nNameSpace, XML_AXIS_TYPE, XML_DATE );
+ bExportDateScale = true;
+ break;
+ default: //AUTOMATIC
+ rExport.AddAttribute( nNameSpace, XML_AXIS_TYPE, XML_AUTO );
+ break;
+ }
+
+ return bExportDateScale;
+}
+
+}
+
+void SchXMLExportHelper_Impl::exportAxis(
+ enum XMLTokenEnum eDimension,
+ enum XMLTokenEnum eAxisName,
+ const Reference< beans::XPropertySet > xAxisProps,
+ const Reference< chart2::XAxis >& xChart2Axis,
+ const OUString& rCategoriesRange,
+ bool bHasTitle, bool bHasMajorGrid, bool bHasMinorGrid,
+ bool bExportContent )
+{
+ static const OUString sNumFormat( OUString::createFromAscii( "NumberFormat" ));
+ std::vector< XMLPropertyState > aPropertyStates;
+ SvXMLElementExport* pAxis = NULL;
+
+ // get property states for autostyles
+ if( xAxisProps.is() && mxExpPropMapper.is() )
+ {
+ lcl_exportNumberFormat( sNumFormat, xAxisProps, mrExport );
+ aPropertyStates = mxExpPropMapper->Filter( xAxisProps );
+ }
+
+ bool bExportDateScale = false;
+ if( bExportContent )
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_DIMENSION, eDimension );
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_NAME, eAxisName );
+ AddAutoStyleAttribute( aPropertyStates ); // write style name
+ if( rCategoriesRange.getLength() )
+ bExportDateScale = lcl_exportAxisType( xChart2Axis, mrExport );
+
+ // open axis element
+ pAxis = new SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_AXIS, sal_True, sal_True );
+ }
+ else
+ {
+ CollectAutoStyle( aPropertyStates );
+ }
+ aPropertyStates.clear();
+
+ //date scale
+ if( bExportDateScale )
+ exportDateScale( xAxisProps );
+
+ Reference< beans::XPropertySet > xTitleProps;
+ Reference< beans::XPropertySet > xMajorGridProps;
+ Reference< beans::XPropertySet > xMinorGridProps;
+ Reference< chart::XAxis > xAxis( xAxisProps, uno::UNO_QUERY );
+ if( xAxis.is() )
+ {
+ xTitleProps = bHasTitle ? xAxis->getAxisTitle() : 0;
+ xMajorGridProps = bHasMajorGrid ? xAxis->getMajorGrid() : 0;
+ xMinorGridProps = bHasMinorGrid ? xAxis->getMinorGrid() : 0;
+ }
+
+ // axis-title
+ exportAxisTitle( xTitleProps , bExportContent );
+
+ // categories if we have a categories chart
+ if( bExportContent && rCategoriesRange.getLength() )
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_TABLE, XML_CELL_RANGE_ADDRESS, rCategoriesRange );
+ SvXMLElementExport aCategories( mrExport, XML_NAMESPACE_CHART, XML_CATEGORIES, sal_True, sal_True );
+ }
+
+ // grid
+ exportGrid( xMajorGridProps, true, bExportContent );
+ exportGrid( xMinorGridProps, false, bExportContent );
+
+ if( pAxis )
+ {
+ //close axis element
+ delete pAxis;
+ pAxis = NULL;
+ }
+}
+
+void SchXMLExportHelper_Impl::exportAxes(
+ const Reference< chart::XDiagram > & xDiagram,
+ const Reference< chart2::XDiagram > & xNewDiagram,
+ sal_Bool bExportContent )
+{
+ DBG_ASSERT( xDiagram.is(), "Invalid XDiagram as parameter" );
+ if( ! xDiagram.is())
+ return;
+
+ // get some properties from document first
+ sal_Bool bHasXAxis = sal_False,
+ bHasYAxis = sal_False,
+ bHasZAxis = sal_False,
+ bHasSecondaryXAxis = sal_False,
+ bHasSecondaryYAxis = sal_False;
+ sal_Bool bHasXAxisTitle = sal_False,
+ bHasYAxisTitle = sal_False,
+ bHasZAxisTitle = sal_False,
+ bHasSecondaryXAxisTitle = sal_False,
+ bHasSecondaryYAxisTitle = sal_False;
+ sal_Bool bHasXAxisMajorGrid = sal_False,
+ bHasXAxisMinorGrid = sal_False,
+ bHasYAxisMajorGrid = sal_False,
+ bHasYAxisMinorGrid = sal_False,
+ bHasZAxisMajorGrid = sal_False,
+ bHasZAxisMinorGrid = sal_False;
+
+ // get multiple properties using XMultiPropertySet
+ MultiPropertySetHandler aDiagramProperties (xDiagram);
+
+ aDiagramProperties.Add (
+ OUString(RTL_CONSTASCII_USTRINGPARAM("HasXAxis")), bHasXAxis);
+ aDiagramProperties.Add (
+ OUString(RTL_CONSTASCII_USTRINGPARAM("HasYAxis")), bHasYAxis);
+ aDiagramProperties.Add (
+ OUString(RTL_CONSTASCII_USTRINGPARAM("HasZAxis")), bHasZAxis);
+ aDiagramProperties.Add (
+ OUString(RTL_CONSTASCII_USTRINGPARAM("HasSecondaryXAxis")), bHasSecondaryXAxis);
+ aDiagramProperties.Add (
+ OUString(RTL_CONSTASCII_USTRINGPARAM("HasSecondaryYAxis")), bHasSecondaryYAxis);
+
+ aDiagramProperties.Add (
+ OUString (RTL_CONSTASCII_USTRINGPARAM ("HasXAxisTitle")), bHasXAxisTitle);
+ aDiagramProperties.Add (
+ OUString (RTL_CONSTASCII_USTRINGPARAM ("HasYAxisTitle")), bHasYAxisTitle);
+ aDiagramProperties.Add (
+ OUString (RTL_CONSTASCII_USTRINGPARAM ("HasZAxisTitle")), bHasZAxisTitle);
+ aDiagramProperties.Add (
+ OUString (RTL_CONSTASCII_USTRINGPARAM ("HasSecondaryXAxisTitle")), bHasSecondaryXAxisTitle);
+ aDiagramProperties.Add (
+ OUString (RTL_CONSTASCII_USTRINGPARAM ("HasSecondaryYAxisTitle")), bHasSecondaryYAxisTitle);
+
+ aDiagramProperties.Add (
+ OUString (RTL_CONSTASCII_USTRINGPARAM ("HasXAxisGrid")), bHasXAxisMajorGrid);
+ aDiagramProperties.Add (
+ OUString (RTL_CONSTASCII_USTRINGPARAM ("HasYAxisGrid")), bHasYAxisMajorGrid);
+ aDiagramProperties.Add (
+ OUString (RTL_CONSTASCII_USTRINGPARAM ("HasZAxisGrid")), bHasZAxisMajorGrid);
+
+ aDiagramProperties.Add (
+ OUString (RTL_CONSTASCII_USTRINGPARAM ("HasXAxisHelpGrid")), bHasXAxisMinorGrid);
+ aDiagramProperties.Add (
+ OUString (RTL_CONSTASCII_USTRINGPARAM ("HasYAxisHelpGrid")), bHasYAxisMinorGrid);
+ aDiagramProperties.Add (
+ OUString (RTL_CONSTASCII_USTRINGPARAM ("HasZAxisHelpGrid")), bHasZAxisMinorGrid);
+
+ if ( ! aDiagramProperties.GetProperties ())
+ {
+ DBG_WARNING ("Required properties not found in Chart diagram");
+ }
+
+ Reference< chart2::XCoordinateSystem > xCooSys( lcl_getCooSys(xNewDiagram) );
+
+ // write an axis element also if the axis itself is not visible, but a grid or a title
+
+ OUString aCategoriesRange;
+ Reference< chart::XAxisSupplier > xAxisSupp( xDiagram, uno::UNO_QUERY );
+
+ // x axis
+ // -------
+ Reference< ::com::sun::star::chart2::XAxis > xNewAxis = lcl_getAxis( xCooSys, XML_X );
+ if( xNewAxis.is() )
+ {
+ Reference< beans::XPropertySet > xAxisProps( xAxisSupp.is() ? xAxisSupp->getAxis(0) : 0, uno::UNO_QUERY );
+ if( mbHasCategoryLabels && bExportContent )
+ {
+ Reference< chart2::data::XLabeledDataSequence > xCategories( lcl_getCategories( xNewDiagram ) );
+ if( xCategories.is() )
+ {
+ Reference< chart2::data::XDataSequence > xValues( xCategories->getValues() );
+ if( xValues.is() )
+ {
+ Reference< chart2::XChartDocument > xNewDoc( mrExport.GetModel(), uno::UNO_QUERY );
+ maCategoriesRange = xValues->getSourceRangeRepresentation();
+ aCategoriesRange = lcl_ConvertRange( maCategoriesRange, xNewDoc );
+ }
+ }
+ }
+ exportAxis( XML_X, XML_PRIMARY_X, xAxisProps, xNewAxis, aCategoriesRange, bHasXAxisTitle, bHasXAxisMajorGrid, bHasXAxisMinorGrid, bExportContent );
+ aCategoriesRange = OUString();
+ }
+
+ // secondary x axis
+ // -------
+ Reference< chart::XSecondAxisTitleSupplier > xSecondTitleSupp( xDiagram, uno::UNO_QUERY );
+ xNewAxis = lcl_getAxis( xCooSys, XML_X, false );
+ if( xNewAxis.is() )
+ {
+ Reference< beans::XPropertySet > xAxisProps( xAxisSupp.is() ? xAxisSupp->getSecondaryAxis(0) : 0, uno::UNO_QUERY );
+ exportAxis( XML_X, XML_SECONDARY_X, xAxisProps, xNewAxis, aCategoriesRange, bHasSecondaryXAxisTitle, false, false, bExportContent );
+ }
+
+ // y axis
+ // -------
+ xNewAxis = lcl_getAxis( xCooSys, XML_Y );
+ if( xNewAxis.is() )
+ {
+ Reference< beans::XPropertySet > xAxisProps( xAxisSupp.is() ? xAxisSupp->getAxis(1) : 0, uno::UNO_QUERY );
+ exportAxis( XML_Y, XML_PRIMARY_Y, xAxisProps, xNewAxis, aCategoriesRange, bHasYAxisTitle, bHasYAxisMajorGrid, bHasYAxisMinorGrid, bExportContent );
+ }
+
+ // secondary y axis
+ // -------
+ xNewAxis = lcl_getAxis( xCooSys, XML_Y, false );
+ if( xNewAxis.is() )
+ {
+ Reference< beans::XPropertySet > xAxisProps( xAxisSupp.is() ? xAxisSupp->getSecondaryAxis(1) : 0, uno::UNO_QUERY );
+ exportAxis( XML_Y, XML_SECONDARY_Y, xAxisProps, xNewAxis, aCategoriesRange, bHasSecondaryYAxisTitle, false, false, bExportContent );
+ }
+
+ // z axis
+ // -------
+ xNewAxis = lcl_getAxis( xCooSys, XML_Z );
+ if( xNewAxis.is() )
+ {
+ Reference< beans::XPropertySet > xAxisProps( xAxisSupp.is() ? xAxisSupp->getAxis(2) : 0, uno::UNO_QUERY );
+ exportAxis( XML_Z, XML_PRIMARY_Z, xAxisProps, xNewAxis, aCategoriesRange, bHasZAxisTitle, bHasZAxisMajorGrid, bHasZAxisMinorGrid, bExportContent );
+ }
+}
+
+namespace
+{
+ bool lcl_hasNoValuesButText( const uno::Reference< chart2::data::XDataSequence >& xDataSequence )
+ {
+ if( !xDataSequence.is() )
+ return false;//have no data
+
+ Sequence< uno::Any > aData;
+ Reference< chart2::data::XNumericalDataSequence > xNumericalDataSequence( xDataSequence, uno::UNO_QUERY );
+ if( xNumericalDataSequence.is() )
+ {
+ Sequence< double > aDoubles( xNumericalDataSequence->getNumericalData() );
+ sal_Int32 nCount = aDoubles.getLength();
+ for( sal_Int32 i = 0; i < nCount; ++i )
+ {
+ if( !::rtl::math::isNan( aDoubles[i] ) )
+ return false;//have double value
+ }
+ }
+ else
+ {
+ aData = xDataSequence->getData();
+ double fDouble = 0.0;
+ sal_Int32 nCount = aData.getLength();
+ for( sal_Int32 i = 0; i < nCount; ++i )
+ {
+ if( (aData[i] >>= fDouble) && !::rtl::math::isNan( fDouble ) )
+ return false;//have double value
+ }
+
+ }
+ //no values found
+
+ Reference< chart2::data::XTextualDataSequence > xTextualDataSequence( xDataSequence, uno::UNO_QUERY );
+ if( xTextualDataSequence.is() )
+ {
+ uno::Sequence< rtl::OUString > aStrings( xTextualDataSequence->getTextualData() );
+ sal_Int32 nCount = aStrings.getLength();
+ for( sal_Int32 i = 0; i < nCount; ++i )
+ {
+ if( aStrings[i].getLength() )
+ return true;//have text
+ }
+ }
+ else
+ {
+ if( !aData.getLength() )
+ aData = xDataSequence->getData();
+ uno::Any aAny;
+ OUString aString;
+ sal_Int32 nCount = aData.getLength();
+ for( sal_Int32 i = 0; i < nCount; ++i )
+ {
+ if( (aData[i]>>=aString) && aString.getLength() )
+ return true;//have text
+ }
+ }
+ //no doubles and no texts
+ return false;
+ }
+}
+
+void SchXMLExportHelper_Impl::exportSeries(
+ const Reference< chart2::XDiagram > & xNewDiagram,
+ const awt::Size & rPageSize,
+ sal_Bool bExportContent,
+ sal_Bool bHasTwoYAxes )
+{
+ Reference< chart2::XCoordinateSystemContainer > xBCooSysCnt( xNewDiagram, uno::UNO_QUERY );
+ if( ! xBCooSysCnt.is())
+ return;
+ Reference< chart2::XChartDocument > xNewDoc( mrExport.GetModel(), uno::UNO_QUERY );
+
+ OUString aFirstXDomainRange;
+ OUString aFirstYDomainRange;
+
+ std::vector< XMLPropertyState > aPropertyStates;
+
+ const OUString sNumFormat(RTL_CONSTASCII_USTRINGPARAM("NumberFormat"));
+ const OUString sPercentageNumFormat(RTL_CONSTASCII_USTRINGPARAM( "PercentageNumberFormat"));
+
+ Sequence< Reference< chart2::XCoordinateSystem > >
+ aCooSysSeq( xBCooSysCnt->getCoordinateSystems());
+ for( sal_Int32 nCSIdx=0; nCSIdx<aCooSysSeq.getLength(); ++nCSIdx )
+ {
+ Reference< chart2::XChartTypeContainer > xCTCnt( aCooSysSeq[nCSIdx], uno::UNO_QUERY );
+ if( ! xCTCnt.is())
+ continue;
+ Sequence< Reference< chart2::XChartType > > aCTSeq( xCTCnt->getChartTypes());
+ for( sal_Int32 nCTIdx=0; nCTIdx<aCTSeq.getLength(); ++nCTIdx )
+ {
+ Reference< chart2::XDataSeriesContainer > xDSCnt( aCTSeq[nCTIdx], uno::UNO_QUERY );
+ if( ! xDSCnt.is())
+ continue;
+ // note: if xDSCnt.is() then also aCTSeq[nCTIdx]
+ OUString aChartType( aCTSeq[nCTIdx]->getChartType());
+ OUString aLabelRole = aCTSeq[nCTIdx]->getRoleOfSequenceForSeriesLabel();
+
+ // special export for stock charts
+ if( aChartType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.chart2.CandleStickChartType")))
+ {
+ sal_Bool bJapaneseCandleSticks = sal_False;
+ Reference< beans::XPropertySet > xCTProp( aCTSeq[nCTIdx], uno::UNO_QUERY );
+ if( xCTProp.is())
+ xCTProp->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM( "Japanese" ))) >>= bJapaneseCandleSticks;
+ exportCandleStickSeries(
+ xDSCnt->getDataSeries(), xNewDiagram, bJapaneseCandleSticks, bExportContent );
+ continue;
+ }
+
+ // export dataseries for current chart-type
+ Sequence< Reference< chart2::XDataSeries > > aSeriesSeq( xDSCnt->getDataSeries());
+ for( sal_Int32 nSeriesIdx=0; nSeriesIdx<aSeriesSeq.getLength(); ++nSeriesIdx )
+ {
+ // export series
+ Reference< chart2::data::XDataSource > xSource( aSeriesSeq[nSeriesIdx], uno::UNO_QUERY );
+ if( xSource.is())
+ {
+ SvXMLElementExport* pSeries = NULL;
+ Sequence< Reference< chart2::data::XLabeledDataSequence > > aSeqCnt(
+ xSource->getDataSequences());
+ sal_Int32 nSeriesLength = 0;
+ sal_Int32 nAttachedAxis = chart::ChartAxisAssign::PRIMARY_Y;
+ sal_Bool bHasMeanValueLine = false;
+ chart::ChartRegressionCurveType eRegressionType( chart::ChartRegressionCurveType_NONE );
+ chart::ChartErrorIndicatorType eErrorType( chart::ChartErrorIndicatorType_NONE );
+ sal_Int32 nErrorBarStyle( chart::ErrorBarStyle::NONE );
+ Reference< beans::XPropertySet > xPropSet;
+ tLabelValuesDataPair aSeriesLabelValuesPair;
+
+ // search for main sequence and create a series element
+ {
+ Reference< chart2::data::XDataSequence > xValuesSeq;
+ Reference< chart2::data::XDataSequence > xLabelSeq;
+ sal_Int32 nSeqIdx=0;
+ sal_Int32 nMainSequenceIndex = -1;
+ for( ; nSeqIdx<aSeqCnt.getLength(); ++nSeqIdx )
+ {
+ OUString aRole;
+ Reference< chart2::data::XDataSequence > xTempValueSeq( aSeqCnt[nSeqIdx]->getValues() );
+ if( nMainSequenceIndex==-1 )
+ {
+ Reference< beans::XPropertySet > xSeqProp( xTempValueSeq, uno::UNO_QUERY );
+ if( xSeqProp.is())
+ xSeqProp->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM( "Role" ))) >>= aRole;
+ // "main" sequence
+ if( aRole.equals( aLabelRole ))
+ {
+ xValuesSeq.set( xTempValueSeq );
+ xLabelSeq.set( aSeqCnt[nSeqIdx]->getLabel());
+ nMainSequenceIndex = nSeqIdx;
+ }
+ }
+ sal_Int32 nSequenceLength = (xTempValueSeq.is()? xTempValueSeq->getData().getLength() : sal_Int32(0));
+ if( nSeriesLength < nSequenceLength )
+ nSeriesLength = nSequenceLength;
+ }
+
+ // have found the main sequence, then xValuesSeq and
+ // xLabelSeq contain those. Otherwise both are empty
+ {
+ // get property states for autostyles
+ try
+ {
+ xPropSet = SchXMLSeriesHelper::createOldAPISeriesPropertySet(
+ aSeriesSeq[nSeriesIdx], mrExport.GetModel() );
+ }
+ catch( uno::Exception & rEx )
+ {
+ (void)rEx; // avoid warning for pro build
+ OSL_TRACE(
+ OUStringToOString(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "Series not found or no XPropertySet: " )) +
+ rEx.Message,
+ RTL_TEXTENCODING_ASCII_US ).getStr());
+ continue;
+ }
+ if( xPropSet.is())
+ {
+ // determine attached axis
+ try
+ {
+ Any aAny( xPropSet->getPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "Axis" ))));
+ aAny >>= nAttachedAxis;
+
+ aAny = xPropSet->getPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM ( "MeanValue" )));
+ aAny >>= bHasMeanValueLine;
+
+ aAny = xPropSet->getPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "RegressionCurves" )));
+ aAny >>= eRegressionType;
+
+ aAny = xPropSet->getPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "ErrorIndicator" )));
+ aAny >>= eErrorType;
+
+ aAny = xPropSet->getPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "ErrorBarStyle" )));
+ aAny >>= nErrorBarStyle;
+ }
+ catch( beans::UnknownPropertyException & rEx )
+ {
+ (void)rEx; // avoid warning for pro build
+ OSL_TRACE(
+ OUStringToOString(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "Required property not found in DataRowProperties: " )) +
+ rEx.Message,
+ RTL_TEXTENCODING_ASCII_US ).getStr());
+ }
+
+ const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() );
+ if( nCurrentODFVersion >= SvtSaveOptions::ODFVER_012 )
+ {
+ lcl_exportNumberFormat( sNumFormat, xPropSet, mrExport );
+ lcl_exportNumberFormat( sPercentageNumFormat, xPropSet, mrExport );
+ }
+
+ if( mxExpPropMapper.is())
+ aPropertyStates = mxExpPropMapper->Filter( xPropSet );
+ }
+
+ if( bExportContent )
+ {
+ if( bHasTwoYAxes )
+ {
+ if( nAttachedAxis == chart::ChartAxisAssign::SECONDARY_Y )
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_ATTACHED_AXIS, XML_SECONDARY_Y );
+ else
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_ATTACHED_AXIS, XML_PRIMARY_Y );
+ }
+
+ // write style name
+ AddAutoStyleAttribute( aPropertyStates );
+
+ if( xValuesSeq.is())
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_VALUES_CELL_RANGE_ADDRESS,
+ lcl_ConvertRange(
+ xValuesSeq->getSourceRangeRepresentation(),
+ xNewDoc ));
+ else
+ // #i75297# allow empty series, export empty range to have all ranges on import
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_VALUES_CELL_RANGE_ADDRESS, OUString());
+
+ if( xLabelSeq.is())
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_LABEL_CELL_ADDRESS,
+ lcl_ConvertRange(
+ xLabelSeq->getSourceRangeRepresentation(),
+ xNewDoc ));
+ if( xLabelSeq.is() || xValuesSeq.is() )
+ aSeriesLabelValuesPair = tLabelValuesDataPair( xLabelSeq, xValuesSeq );
+
+ // chart-type for mixed types
+ enum XMLTokenEnum eCTToken(
+ SchXMLTools::getTokenByChartType( aChartType, false /* bUseOldNames */ ));
+ //@todo: get token for current charttype
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_CLASS,
+ mrExport.GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_CHART, GetXMLToken( eCTToken )));
+
+ // open series element until end of for loop
+ pSeries = new SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_SERIES, sal_True, sal_True );
+ }
+ else // autostyles
+ {
+ CollectAutoStyle( aPropertyStates );
+ }
+ // remove property states for autostyles
+ aPropertyStates.clear();
+ }
+ }
+
+ // export domain elements if we have a series parent element
+ if( pSeries )
+ {
+ // domain elements
+ if( bExportContent )
+ {
+ bool bIsScatterChart = aChartType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.chart2.ScatterChartType"));
+ bool bIsBubbleChart = aChartType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.chart2.BubbleChartType"));
+ Reference< chart2::data::XDataSequence > xYValuesForBubbleChart;
+ if( bIsBubbleChart )
+ {
+ Reference< chart2::data::XLabeledDataSequence > xSequence( lcl_getDataSequenceByRole( aSeqCnt, OUString(RTL_CONSTASCII_USTRINGPARAM( "values-y" )) ) );
+ if( xSequence.is() )
+ {
+ xYValuesForBubbleChart = xSequence->getValues();
+ if( !lcl_exportDomainForThisSequence( xYValuesForBubbleChart, aFirstYDomainRange, mrExport ) )
+ xYValuesForBubbleChart = 0;
+ }
+ }
+ if( bIsScatterChart || bIsBubbleChart )
+ {
+ Reference< chart2::data::XLabeledDataSequence > xSequence( lcl_getDataSequenceByRole( aSeqCnt, OUString(RTL_CONSTASCII_USTRINGPARAM( "values-x" )) ) );
+ if( xSequence.is() )
+ {
+ Reference< chart2::data::XDataSequence > xValues( xSequence->getValues() );
+ if( lcl_exportDomainForThisSequence( xValues, aFirstXDomainRange, mrExport ) )
+ m_aDataSequencesToExport.push_back( tLabelValuesDataPair( 0, xValues ));
+ }
+ else if( nSeriesIdx==0 )
+ {
+ //might be that the categories are used as x-values (e.g. for date axis) -> export them accordingly
+ Reference< chart2::data::XLabeledDataSequence > xCategories( lcl_getCategories( xNewDiagram ) );
+ if( xCategories.is() )
+ {
+ Reference< chart2::data::XDataSequence > xValues( xCategories->getValues() );
+ if( !lcl_hasNoValuesButText( xValues ) )
+ lcl_exportDomainForThisSequence( xValues, aFirstXDomainRange, mrExport );
+ }
+ }
+ }
+ if( xYValuesForBubbleChart.is() )
+ m_aDataSequencesToExport.push_back( tLabelValuesDataPair( 0, xYValuesForBubbleChart ));
+ }
+ }
+
+ // add sequences for main sequence after domain sequences,
+ // so that the export of the local table has the correct order
+ if( bExportContent &&
+ (aSeriesLabelValuesPair.first.is() || aSeriesLabelValuesPair.second.is()))
+ m_aDataSequencesToExport.push_back( aSeriesLabelValuesPair );
+
+ // statistical objects:
+ // regression curves and mean value lines
+ if( bHasMeanValueLine &&
+ xPropSet.is() &&
+ mxExpPropMapper.is() )
+ {
+ Reference< beans::XPropertySet > xStatProp;
+ try
+ {
+ Any aPropAny( xPropSet->getPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "DataMeanValueProperties" ))));
+ aPropAny >>= xStatProp;
+ }
+ catch( uno::Exception & rEx )
+ {
+ (void)rEx; // avoid warning for pro build
+ OSL_TRACE( "Exception caught during Export of series - optional DataMeanValueProperties not available: %s",
+ OUStringToOString( rEx.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
+ }
+
+ if( xStatProp.is() )
+ {
+ aPropertyStates = mxExpPropMapper->Filter( xStatProp );
+
+ if( !aPropertyStates.empty() )
+ {
+ // write element
+ if( bExportContent )
+ {
+ // add style name attribute
+ AddAutoStyleAttribute( aPropertyStates );
+
+ SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_MEAN_VALUE, sal_True, sal_True );
+ }
+ else // autostyles
+ {
+ CollectAutoStyle( aPropertyStates );
+ }
+ }
+ }
+ }
+
+ if( eRegressionType != chart::ChartRegressionCurveType_NONE &&
+ xPropSet.is() &&
+ mxExpPropMapper.is() )
+ {
+ exportRegressionCurve( aSeriesSeq[nSeriesIdx], xPropSet, rPageSize, bExportContent );
+ }
+
+ if( nErrorBarStyle != chart::ErrorBarStyle::NONE &&
+ eErrorType != chart::ChartErrorIndicatorType_NONE &&
+ xPropSet.is() &&
+ mxExpPropMapper.is() )
+ {
+ Reference< beans::XPropertySet > xStatProp;
+ try
+ {
+ Any aPropAny( xPropSet->getPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "DataErrorProperties" ))));
+ aPropAny >>= xStatProp;
+ }
+ catch( uno::Exception & rEx )
+ {
+ (void)rEx; // avoid warning for pro build
+ OSL_TRACE( "Exception caught during Export of series - optional DataErrorProperties not available: %s",
+ OUStringToOString( rEx.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
+ }
+
+ if( xStatProp.is() )
+ {
+ if( bExportContent &&
+ nErrorBarStyle == chart::ErrorBarStyle::FROM_DATA )
+ {
+ // register data ranges for error bars for export in local table
+ ::std::vector< Reference< chart2::data::XDataSequence > > aErrorBarSequences(
+ lcl_getErrorBarSequences( xStatProp ));
+ for( ::std::vector< Reference< chart2::data::XDataSequence > >::const_iterator aIt(
+ aErrorBarSequences.begin()); aIt != aErrorBarSequences.end(); ++aIt )
+ {
+ m_aDataSequencesToExport.push_back( tLabelValuesDataPair( 0, *aIt ));
+ }
+ }
+
+ aPropertyStates = mxExpPropMapper->Filter( xStatProp );
+
+ if( !aPropertyStates.empty() )
+ {
+ // write element
+ if( bExportContent )
+ {
+ // add style name attribute
+ AddAutoStyleAttribute( aPropertyStates );
+
+ const SvtSaveOptions::ODFDefaultVersion nCurrentVersion( SvtSaveOptions().GetODFDefaultVersion() );
+ if( nCurrentVersion >= SvtSaveOptions::ODFVER_012 )
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_DIMENSION, XML_Y );//#i114149#
+ SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_ERROR_INDICATOR, sal_True, sal_True );
+ }
+ else // autostyles
+ {
+ CollectAutoStyle( aPropertyStates );
+ }
+ }
+ }
+ }
+
+ exportDataPoints(
+ uno::Reference< beans::XPropertySet >( aSeriesSeq[nSeriesIdx], uno::UNO_QUERY ),
+ nSeriesLength, xNewDiagram, bExportContent );
+
+ // close series element
+ if( pSeries )
+ delete pSeries;
+ }
+ }
+ aPropertyStates.clear();
+ }
+ }
+}
+
+void SchXMLExportHelper_Impl::exportRegressionCurve(
+ const Reference< chart2::XDataSeries > & xSeries,
+ const Reference< beans::XPropertySet > & xSeriesProp,
+ const awt::Size & rPageSize,
+ sal_Bool bExportContent )
+{
+ OSL_ASSERT( mxExpPropMapper.is());
+
+ std::vector< XMLPropertyState > aPropertyStates;
+ std::vector< XMLPropertyState > aEquationPropertyStates;
+ Reference< beans::XPropertySet > xStatProp;
+ try
+ {
+ Any aPropAny( xSeriesProp->getPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "DataRegressionProperties" ))));
+ aPropAny >>= xStatProp;
+ }
+ catch( uno::Exception & rEx )
+ {
+ (void)rEx; // avoid warning for pro build
+ OSL_TRACE( "Exception caught during Export of series - optional DataRegressionProperties not available: %s",
+ OUStringToOString( rEx.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
+ }
+
+ if( xStatProp.is() )
+ {
+ Reference< chart2::XRegressionCurve > xRegCurve( SchXMLTools::getRegressionCurve( xSeries ));
+ Reference< beans::XPropertySet > xEquationProperties;
+ if( xRegCurve.is())
+ xEquationProperties.set( xRegCurve->getEquationProperties());
+
+ bool bShowEquation = false;
+ bool bShowRSquared = false;
+ bool bExportEquation = false;
+ aPropertyStates = mxExpPropMapper->Filter( xStatProp );
+ if( xEquationProperties.is())
+ {
+ xEquationProperties->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "ShowEquation" )))
+ >>= bShowEquation;
+ xEquationProperties->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "ShowCorrelationCoefficient" )))
+ >>= bShowRSquared;
+ bExportEquation = ( bShowEquation || bShowRSquared );
+ const SvtSaveOptions::ODFDefaultVersion nCurrentVersion( SvtSaveOptions().GetODFDefaultVersion() );
+ if( nCurrentVersion < SvtSaveOptions::ODFVER_012 )
+ bExportEquation=false;
+ if( bExportEquation )
+ {
+ // number format
+ sal_Int32 nNumberFormat = 0;
+ if( ( xEquationProperties->getPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "NumberFormat" ))) >>= nNumberFormat ) &&
+ nNumberFormat != -1 )
+ {
+ mrExport.addDataStyle( nNumberFormat );
+ }
+ aEquationPropertyStates = mxExpPropMapper->Filter( xEquationProperties );
+ }
+ }
+
+ if( !aPropertyStates.empty() || bExportEquation )
+ {
+ // write element
+ if( bExportContent )
+ {
+ // add style name attribute
+ if( !aPropertyStates.empty())
+ AddAutoStyleAttribute( aPropertyStates );
+ SvXMLElementExport aRegressionExport( mrExport, XML_NAMESPACE_CHART, XML_REGRESSION_CURVE, sal_True, sal_True );
+ if( bExportEquation )
+ {
+ // default is true
+ if( !bShowEquation )
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_DISPLAY_EQUATION, XML_FALSE );
+ // default is false
+ if( bShowRSquared )
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_DISPLAY_R_SQUARE, XML_TRUE );
+
+ // export position
+ chart2::RelativePosition aRelativePosition;
+ if( xEquationProperties->getPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("RelativePosition"))) >>= aRelativePosition )
+ {
+ double fX = aRelativePosition.Primary * rPageSize.Width;
+ double fY = aRelativePosition.Secondary * rPageSize.Height;
+ awt::Point aPos;
+ aPos.X = static_cast< sal_Int32 >( ::rtl::math::round( fX ));
+ aPos.Y = static_cast< sal_Int32 >( ::rtl::math::round( fY ));
+ addPosition( aPos );
+ }
+
+ if( !aEquationPropertyStates.empty())
+ AddAutoStyleAttribute( aEquationPropertyStates );
+
+ SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_EQUATION, sal_True, sal_True );
+ }
+ }
+ else // autostyles
+ {
+ if( !aPropertyStates.empty())
+ CollectAutoStyle( aPropertyStates );
+ if( bExportEquation && !aEquationPropertyStates.empty())
+ CollectAutoStyle( aEquationPropertyStates );
+ }
+ }
+ }
+}
+
+void SchXMLExportHelper_Impl::exportCandleStickSeries(
+ const Sequence< Reference< chart2::XDataSeries > > & aSeriesSeq,
+ const Reference< chart2::XDiagram > & xDiagram,
+ sal_Bool bJapaneseCandleSticks,
+ sal_Bool bExportContent )
+{
+
+ for( sal_Int32 nSeriesIdx=0; nSeriesIdx<aSeriesSeq.getLength(); ++nSeriesIdx )
+ {
+ Reference< chart2::XDataSeries > xSeries( aSeriesSeq[nSeriesIdx] );
+ sal_Int32 nAttachedAxis = lcl_isSeriesAttachedToFirstAxis( xSeries )
+ ? chart::ChartAxisAssign::PRIMARY_Y
+ : chart::ChartAxisAssign::SECONDARY_Y;
+
+ Reference< chart2::data::XDataSource > xSource( xSeries, uno::UNO_QUERY );
+ if( xSource.is())
+ {
+ // export series in correct order (as we don't store roles)
+ // with japanese candlesticks: open, low, high, close
+ // otherwise: low, high, close
+ Sequence< Reference< chart2::data::XLabeledDataSequence > > aSeqCnt(
+ xSource->getDataSequences());
+
+ sal_Int32 nSeriesLength =
+ lcl_getSequenceLengthByRole( aSeqCnt, OUString(RTL_CONSTASCII_USTRINGPARAM( "values-last" )));
+
+ if( bExportContent )
+ {
+ Reference< chart2::XChartDocument > xNewDoc( mrExport.GetModel(), uno::UNO_QUERY );
+ //@todo: export data points
+
+ // open
+ if( bJapaneseCandleSticks )
+ {
+ tLabelAndValueRange aRanges( lcl_getLabelAndValueRangeByRole(
+ aSeqCnt, OUString(RTL_CONSTASCII_USTRINGPARAM( "values-first" )), xNewDoc, m_aDataSequencesToExport ));
+ if( aRanges.second.getLength())
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_VALUES_CELL_RANGE_ADDRESS, aRanges.second );
+ if( aRanges.first.getLength())
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_LABEL_CELL_ADDRESS, aRanges.first );
+ if( nAttachedAxis == chart::ChartAxisAssign::SECONDARY_Y )
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_ATTACHED_AXIS, XML_SECONDARY_Y );
+ else
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_ATTACHED_AXIS, XML_PRIMARY_Y );
+ SvXMLElementExport aOpenSeries( mrExport, XML_NAMESPACE_CHART, XML_SERIES, sal_True, sal_True );
+ // export empty data points
+ exportDataPoints( 0, nSeriesLength, xDiagram, bExportContent );
+ }
+
+ // low
+ {
+ tLabelAndValueRange aRanges( lcl_getLabelAndValueRangeByRole(
+ aSeqCnt, OUString(RTL_CONSTASCII_USTRINGPARAM( "values-min" )), xNewDoc, m_aDataSequencesToExport ));
+ if( aRanges.second.getLength())
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_VALUES_CELL_RANGE_ADDRESS, aRanges.second );
+ if( aRanges.first.getLength())
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_LABEL_CELL_ADDRESS, aRanges.first );
+ if( nAttachedAxis == chart::ChartAxisAssign::SECONDARY_Y )
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_ATTACHED_AXIS, XML_SECONDARY_Y );
+ else
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_ATTACHED_AXIS, XML_PRIMARY_Y );
+ SvXMLElementExport aLowSeries( mrExport, XML_NAMESPACE_CHART, XML_SERIES, sal_True, sal_True );
+ // export empty data points
+ exportDataPoints( 0, nSeriesLength, xDiagram, bExportContent );
+ }
+
+ // high
+ {
+ tLabelAndValueRange aRanges( lcl_getLabelAndValueRangeByRole(
+ aSeqCnt, OUString(RTL_CONSTASCII_USTRINGPARAM( "values-max" )), xNewDoc, m_aDataSequencesToExport ));
+ if( aRanges.second.getLength())
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_VALUES_CELL_RANGE_ADDRESS, aRanges.second );
+ if( aRanges.first.getLength())
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_LABEL_CELL_ADDRESS, aRanges.first );
+ if( nAttachedAxis == chart::ChartAxisAssign::SECONDARY_Y )
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_ATTACHED_AXIS, XML_SECONDARY_Y );
+ else
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_ATTACHED_AXIS, XML_PRIMARY_Y );
+ SvXMLElementExport aHighSeries( mrExport, XML_NAMESPACE_CHART, XML_SERIES, sal_True, sal_True );
+ // export empty data points
+ exportDataPoints( 0, nSeriesLength, xDiagram, bExportContent );
+ }
+
+ // close
+ {
+ tLabelAndValueRange aRanges( lcl_getLabelAndValueRangeByRole(
+ aSeqCnt, OUString(RTL_CONSTASCII_USTRINGPARAM( "values-last" )), xNewDoc, m_aDataSequencesToExport ));
+ if( aRanges.second.getLength())
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_VALUES_CELL_RANGE_ADDRESS, aRanges.second );
+ if( aRanges.first.getLength())
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_LABEL_CELL_ADDRESS, aRanges.first );
+ if( nAttachedAxis == chart::ChartAxisAssign::SECONDARY_Y )
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_ATTACHED_AXIS, XML_SECONDARY_Y );
+ else
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_ATTACHED_AXIS, XML_PRIMARY_Y );
+ SvXMLElementExport aCloseSeries( mrExport, XML_NAMESPACE_CHART, XML_SERIES, sal_True, sal_True );
+ // export empty data points
+ exportDataPoints( 0, nSeriesLength, xDiagram, bExportContent );
+ }
+ }
+ else // autostyles
+ {
+ // for close series
+ }
+ // remove property states for autostyles
+ }
+ }
+}
+
+void SchXMLExportHelper_Impl::exportDataPoints(
+ const uno::Reference< beans::XPropertySet > & xSeriesProperties,
+ sal_Int32 nSeriesLength,
+ const uno::Reference< chart2::XDiagram > & xDiagram,
+ sal_Bool bExportContent )
+{
+ // data-points
+ // -----------
+ // write data-points only if they contain autostyles
+ // objects with equal autostyles are grouped using the attribute
+ // repeat="number"
+
+ // Note: if only the nth data-point has autostyles there is an element
+ // without style and repeat="n-1" attribute written in advance.
+
+ // the sequence aDataPointSeq contains indices of data-points that
+ // do have own attributes. This increases the performance substantially.
+
+ // more performant version for #93600#
+ if( mxExpPropMapper.is())
+ {
+ uno::Reference< chart2::XDataSeries > xSeries( xSeriesProperties, uno::UNO_QUERY );
+
+ std::vector< XMLPropertyState > aPropertyStates;
+
+ const OUString sNumFormat(RTL_CONSTASCII_USTRINGPARAM("NumberFormat"));
+ const OUString sPercentageNumFormat(RTL_CONSTASCII_USTRINGPARAM( "PercentageNumberFormat"));
+
+ bool bVaryColorsByPoint = false;
+ Sequence< sal_Int32 > aDataPointSeq;
+ if( xSeriesProperties.is())
+ {
+ Any aAny = xSeriesProperties->getPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "AttributedDataPoints" )));
+ aAny >>= aDataPointSeq;
+ xSeriesProperties->getPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "VaryColorsByPoint" ))) >>= bVaryColorsByPoint;
+ }
+
+
+ sal_Int32 nSize = aDataPointSeq.getLength();
+ DBG_ASSERT( nSize <= nSeriesLength, "Too many point attributes" );
+
+ const sal_Int32 * pPoints = aDataPointSeq.getConstArray();
+ sal_Int32 nElement;
+ sal_Int32 nRepeat;
+ Reference< chart2::XColorScheme > xColorScheme;
+ if( xDiagram.is())
+ xColorScheme.set( xDiagram->getDefaultColorScheme());
+
+ ::std::list< SchXMLDataPointStruct > aDataPointList;
+
+ // collect elements
+ if( bVaryColorsByPoint && xColorScheme.is() )
+ {
+ ::std::set< sal_Int32 > aAttrPointSet;
+ ::std::copy( pPoints, pPoints + aDataPointSeq.getLength(),
+ ::std::inserter( aAttrPointSet, aAttrPointSet.begin()));
+ const ::std::set< sal_Int32 >::const_iterator aEndIt( aAttrPointSet.end());
+ for( nElement = 0; nElement < nSeriesLength; ++nElement )
+ {
+ aPropertyStates.clear();
+ uno::Reference< beans::XPropertySet > xPropSet;
+ bool bExportNumFmt = false;
+ if( aAttrPointSet.find( nElement ) != aEndIt )
+ {
+ try
+ {
+ xPropSet = SchXMLSeriesHelper::createOldAPIDataPointPropertySet(
+ xSeries, nElement, mrExport.GetModel() );
+ bExportNumFmt = true;
+ }
+ catch( uno::Exception & rEx )
+ {
+ (void)rEx; // avoid warning for pro build
+ OSL_TRACE( "Exception caught during Export of data point: %s",
+ OUStringToOString( rEx.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
+ }
+ }
+ else
+ {
+ // property set only containing the color
+ xPropSet.set( new ::xmloff::chart::ColorPropertySet(
+ xColorScheme->getColorByIndex( nElement )));
+ }
+ DBG_ASSERT( xPropSet.is(), "Pie Segments should have properties" );
+ if( xPropSet.is())
+ {
+ const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() );
+ if( nCurrentODFVersion >= SvtSaveOptions::ODFVER_012 && bExportNumFmt )
+ {
+ lcl_exportNumberFormat( sNumFormat, xPropSet, mrExport );
+ lcl_exportNumberFormat( sPercentageNumFormat, xPropSet, mrExport );
+ }
+
+ aPropertyStates = mxExpPropMapper->Filter( xPropSet );
+ if( !aPropertyStates.empty() )
+ {
+ if( bExportContent )
+ {
+ // write data-point with style
+ DBG_ASSERT( ! maAutoStyleNameQueue.empty(), "Autostyle queue empty!" );
+
+ SchXMLDataPointStruct aPoint;
+ aPoint.maStyleName = maAutoStyleNameQueue.front();
+ maAutoStyleNameQueue.pop();
+ aDataPointList.push_back( aPoint );
+ }
+ else
+ {
+ CollectAutoStyle( aPropertyStates );
+ }
+ }
+ }
+ }
+ DBG_ASSERT( !bExportContent || (static_cast<sal_Int32>(aDataPointList.size()) == nSeriesLength),
+ "not enough data points on content export" );
+ }
+ else
+ {
+
+ sal_Int32 nLastIndex = -1;
+ sal_Int32 nCurrIndex = 0;
+
+ for( nElement = 0; nElement < nSize; ++nElement )
+ {
+ aPropertyStates.clear();
+ nCurrIndex = pPoints[ nElement ];
+ //assuming sorted indices in pPoints
+
+ if( nCurrIndex<0 || nCurrIndex>=nSeriesLength )
+ break;
+
+ // write leading empty data points
+ if( nCurrIndex - nLastIndex > 1 )
+ {
+ SchXMLDataPointStruct aPoint;
+ aPoint.mnRepeat = nCurrIndex - nLastIndex - 1;
+ aDataPointList.push_back( aPoint );
+ }
+
+ uno::Reference< beans::XPropertySet > xPropSet;
+ // get property states
+ try
+ {
+ xPropSet = SchXMLSeriesHelper::createOldAPIDataPointPropertySet(
+ xSeries, nCurrIndex, mrExport.GetModel() );
+ }
+ catch( uno::Exception & rEx )
+ {
+ (void)rEx; // avoid warning for pro build
+ OSL_TRACE( "Exception caught during Export of data point: %s",
+ OUStringToOString( rEx.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
+ }
+ if( xPropSet.is())
+ {
+ const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() );
+ if( nCurrentODFVersion >= SvtSaveOptions::ODFVER_012 )
+ {
+ lcl_exportNumberFormat( sNumFormat, xPropSet, mrExport );
+ lcl_exportNumberFormat( sPercentageNumFormat, xPropSet, mrExport );
+ }
+
+ aPropertyStates = mxExpPropMapper->Filter( xPropSet );
+ if( !aPropertyStates.empty() )
+ {
+ if( bExportContent )
+ {
+ // write data-point with style
+ DBG_ASSERT( ! maAutoStyleNameQueue.empty(), "Autostyle queue empty!" );
+ SchXMLDataPointStruct aPoint;
+ aPoint.maStyleName = maAutoStyleNameQueue.front();
+ maAutoStyleNameQueue.pop();
+
+ aDataPointList.push_back( aPoint );
+ nLastIndex = nCurrIndex;
+ }
+ else
+ {
+ CollectAutoStyle( aPropertyStates );
+ }
+ continue;
+ }
+ }
+
+ // if we get here the property states are empty
+ SchXMLDataPointStruct aPoint;
+ aDataPointList.push_back( aPoint );
+
+ nLastIndex = nCurrIndex;
+ }
+ // final empty elements
+ nRepeat = nSeriesLength - nLastIndex - 1;
+ if( nRepeat > 0 )
+ {
+ SchXMLDataPointStruct aPoint;
+ aPoint.mnRepeat = nRepeat;
+ aDataPointList.push_back( aPoint );
+ }
+ }
+
+ if( bExportContent )
+ {
+ // write elements (merge equal ones)
+ ::std::list< SchXMLDataPointStruct >::iterator aIter = aDataPointList.begin();
+ SchXMLDataPointStruct aPoint;
+ SchXMLDataPointStruct aLastPoint;
+
+ // initialize so that it doesn't matter if
+ // the element is counted in the first iteration
+ aLastPoint.mnRepeat = 0;
+
+ for( ; aIter != aDataPointList.end(); ++aIter )
+ {
+ aPoint = (*aIter);
+
+ if( aPoint.maStyleName == aLastPoint.maStyleName )
+ aPoint.mnRepeat += aLastPoint.mnRepeat;
+ else if( aLastPoint.mnRepeat > 0 )
+ {
+ // write last element
+ if( aLastPoint.maStyleName.getLength() )
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_STYLE_NAME, aLastPoint.maStyleName );
+
+ if( aLastPoint.mnRepeat > 1 )
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_REPEATED,
+ OUString::valueOf( (sal_Int64)( aLastPoint.mnRepeat ) ));
+
+ SvXMLElementExport aPointElem( mrExport, XML_NAMESPACE_CHART, XML_DATA_POINT, sal_True, sal_True );
+ }
+ aLastPoint = aPoint;
+ }
+ // write last element if it hasn't been written in last iteration
+ if( aPoint.maStyleName == aLastPoint.maStyleName )
+ {
+ if( aLastPoint.maStyleName.getLength() )
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_STYLE_NAME, aLastPoint.maStyleName );
+
+ if( aLastPoint.mnRepeat > 1 )
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_REPEATED,
+ OUString::valueOf( (sal_Int64)( aLastPoint.mnRepeat ) ));
+
+ SvXMLElementExport aPointElem( mrExport, XML_NAMESPACE_CHART, XML_DATA_POINT, sal_True, sal_True );
+ }
+ }
+ }
+}
+
+
+void SchXMLExportHelper_Impl::getCellAddress( sal_Int32 nCol, sal_Int32 nRow )
+{
+ msStringBuffer.append( (sal_Unicode)'.' );
+ if( nCol < 26 )
+ msStringBuffer.append( (sal_Unicode)('A' + nCol) );
+ else if( nCol < 702 )
+ {
+ msStringBuffer.append( (sal_Unicode)('A' + nCol / 26 - 1 ));
+ msStringBuffer.append( (sal_Unicode)('A' + nCol % 26) );
+ }
+ else
+ {
+ msStringBuffer.append( (sal_Unicode)('A' + nCol / 702 - 1 ));
+ msStringBuffer.append( (sal_Unicode)('A' + (nCol % 702) / 26 ));
+ msStringBuffer.append( (sal_Unicode)('A' + nCol % 26) );
+ }
+
+ msStringBuffer.append( nRow + (sal_Int32)1 );
+}
+
+void SchXMLExportHelper_Impl::addPosition( const awt::Point & rPosition )
+{
+ mrExport.GetMM100UnitConverter().convertMeasure( msStringBuffer, rPosition.X );
+ msString = msStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_X, msString );
+
+ mrExport.GetMM100UnitConverter().convertMeasure( msStringBuffer, rPosition.Y );
+ msString = msStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_Y, msString );
+}
+
+void SchXMLExportHelper_Impl::addPosition( Reference< drawing::XShape > xShape )
+{
+ if( xShape.is())
+ addPosition( xShape->getPosition());
+}
+
+void SchXMLExportHelper_Impl::addSize( const awt::Size & rSize, bool bIsOOoNamespace)
+{
+ mrExport.GetMM100UnitConverter().convertMeasure( msStringBuffer, rSize.Width );
+ msString = msStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute( bIsOOoNamespace ? XML_NAMESPACE_CHART_EXT : XML_NAMESPACE_SVG , XML_WIDTH, msString );
+
+
+ mrExport.GetMM100UnitConverter().convertMeasure( msStringBuffer, rSize.Height);
+ msString = msStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute( bIsOOoNamespace ? XML_NAMESPACE_CHART_EXT : XML_NAMESPACE_SVG, XML_HEIGHT, msString );
+}
+
+void SchXMLExportHelper_Impl::addSize( Reference< drawing::XShape > xShape, bool bIsOOoNamespace )
+{
+ if( xShape.is())
+ addSize( xShape->getSize(), bIsOOoNamespace );
+}
+
+awt::Size SchXMLExportHelper_Impl::getPageSize( const Reference< chart2::XChartDocument > & xChartDoc ) const
+{
+ awt::Size aSize( 8000, 7000 );
+ uno::Reference< embed::XVisualObject > xVisualObject( xChartDoc, uno::UNO_QUERY );
+ DBG_ASSERT( xVisualObject.is(),"need XVisualObject for page size" );
+ if( xVisualObject.is() )
+ aSize = xVisualObject->getVisualAreaSize( embed::Aspects::MSOLE_CONTENT );
+
+ return aSize;
+}
+
+void SchXMLExportHelper_Impl::CollectAutoStyle( const std::vector< XMLPropertyState >& aStates )
+{
+ if( !aStates.empty() )
+ maAutoStyleNameQueue.push( GetAutoStylePoolP().Add( XML_STYLE_FAMILY_SCH_CHART_ID, aStates ));
+}
+
+void SchXMLExportHelper_Impl::AddAutoStyleAttribute( const std::vector< XMLPropertyState >& aStates )
+{
+ if( !aStates.empty() )
+ {
+ DBG_ASSERT( ! maAutoStyleNameQueue.empty(), "Autostyle queue empty!" );
+
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_STYLE_NAME, maAutoStyleNameQueue.front() );
+ maAutoStyleNameQueue.pop();
+ }
+}
+
+void SchXMLExportHelper_Impl::exportText( const OUString& rText, bool bConvertTabsLFs )
+{
+ SchXMLTools::exportText( mrExport, rText, bConvertTabsLFs );
+}
+
+// ========================================
+// class SchXMLExport
+// ========================================
+
+// #110680#
+SchXMLExport::SchXMLExport(
+ const Reference< lang::XMultiServiceFactory >& xServiceFactory,
+ sal_uInt16 nExportFlags )
+: SvXMLExport( xServiceFactory, MAP_CM, ::xmloff::token::XML_CHART, nExportFlags ),
+ maAutoStylePool( *this ),
+ maExportHelper( *this, maAutoStylePool )
+{
+ if( getDefaultVersion() == SvtSaveOptions::ODFVER_LATEST )
+ _GetNamespaceMap().Add( GetXMLToken(XML_NP_CHART_EXT), GetXMLToken(XML_N_CHART_EXT), XML_NAMESPACE_CHART_EXT);
+}
+
+
+SchXMLExport::~SchXMLExport()
+{
+ // stop progress view
+ if( mxStatusIndicator.is())
+ {
+ mxStatusIndicator->end();
+ mxStatusIndicator->reset();
+ }
+}
+
+sal_uInt32 SchXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass )
+{
+ Reference< chart2::XChartDocument > xChartDoc( GetModel(), uno::UNO_QUERY );
+ maExportHelper.m_pImpl->InitRangeSegmentationProperties( xChartDoc );
+ return SvXMLExport::exportDoc( eClass );
+}
+
+void SchXMLExport::_ExportStyles( sal_Bool bUsed )
+{
+ SvXMLExport::_ExportStyles( bUsed );
+}
+
+void SchXMLExport::_ExportMasterStyles()
+{
+ // not available in chart
+ DBG_WARNING( "Master Style Export requested. Not available for Chart" );
+}
+
+void SchXMLExport::_ExportAutoStyles()
+{
+ // there are no styles that require their own autostyles
+ if( getExportFlags() & EXPORT_CONTENT )
+ {
+ Reference< chart::XChartDocument > xChartDoc( GetModel(), uno::UNO_QUERY );
+ if( xChartDoc.is())
+ {
+ maExportHelper.m_pImpl->collectAutoStyles( xChartDoc );
+ maExportHelper.m_pImpl->exportAutoStyles();
+ }
+ else
+ {
+ OSL_FAIL( "Couldn't export chart due to wrong XModel (must be XChartDocument)" );
+ }
+ }
+}
+
+void SchXMLExport::_ExportContent()
+{
+ Reference< chart::XChartDocument > xChartDoc( GetModel(), uno::UNO_QUERY );
+ if( xChartDoc.is())
+ {
+ // determine if data comes from the outside
+ sal_Bool bIncludeTable = sal_True;
+
+ Reference< chart2::XChartDocument > xNewDoc( xChartDoc, uno::UNO_QUERY );
+ if( xNewDoc.is())
+ {
+ // check if we have own data. If so we must not export the complete
+ // range string, as this is our only indicator for having own or
+ // external data. @todo: fix this in the file format!
+ Reference< lang::XServiceInfo > xDPServiceInfo( xNewDoc->getDataProvider(), uno::UNO_QUERY );
+ if( ! (xDPServiceInfo.is() &&
+ xDPServiceInfo->getImplementationName().equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "com.sun.star.comp.chart.InternalDataProvider" ))))
+ {
+ bIncludeTable = sal_False;
+ }
+ }
+ else
+ {
+ Reference< lang::XServiceInfo > xServ( xChartDoc, uno::UNO_QUERY );
+ if( xServ.is())
+ {
+ if( xServ->supportsService(
+ OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart.ChartTableAddressSupplier" ))))
+ {
+ Reference< beans::XPropertySet > xProp( xServ, uno::UNO_QUERY );
+ if( xProp.is())
+ {
+ Any aAny;
+ try
+ {
+ OUString sChartAddress;
+ aAny = xProp->getPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM( "ChartRangeAddress" )));
+ aAny >>= sChartAddress;
+ maExportHelper.m_pImpl->SetChartRangeAddress( sChartAddress );
+
+ OUString sTableNumberList;
+ aAny = xProp->getPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM( "TableNumberList" )));
+ aAny >>= sTableNumberList;
+ maExportHelper.m_pImpl->SetTableNumberList( sTableNumberList );
+
+ // do not include own table if there are external addresses
+ bIncludeTable = (sChartAddress.getLength() == 0);
+ }
+ catch( beans::UnknownPropertyException & )
+ {
+ OSL_FAIL( "Property ChartRangeAddress not supported by ChartDocument" );
+ }
+ }
+ }
+ }
+ }
+ maExportHelper.m_pImpl->exportChart( xChartDoc, bIncludeTable );
+ }
+ else
+ {
+ OSL_FAIL( "Couldn't export chart due to wrong XModel" );
+ }
+}
+
+void SchXMLExport::SetProgress( sal_Int32 nPercentage )
+{
+ // set progress view
+ if( mxStatusIndicator.is())
+ mxStatusIndicator->setValue( nPercentage );
+}
+
+UniReference< XMLPropertySetMapper > SchXMLExport::GetPropertySetMapper() const
+{
+ return maExportHelper.m_pImpl->GetPropertySetMapper();
+}
+
+void SchXMLExportHelper_Impl::InitRangeSegmentationProperties( const Reference< chart2::XChartDocument > & xChartDoc )
+{
+ if( xChartDoc.is())
+ try
+ {
+ Reference< chart2::data::XDataProvider > xDataProvider( xChartDoc->getDataProvider() );
+ OSL_ENSURE( xDataProvider.is(), "No DataProvider" );
+ if( xDataProvider.is())
+ {
+ Reference< chart2::data::XDataSource > xDataSource( lcl_pressUsedDataIntoRectangularFormat( xChartDoc, mbHasCategoryLabels ));
+ Sequence< beans::PropertyValue > aArgs( xDataProvider->detectArguments( xDataSource ));
+ ::rtl::OUString sCellRange, sBrokenRange;
+ bool bBrokenRangeAvailable = false;
+ for( sal_Int32 i=0; i<aArgs.getLength(); ++i )
+ {
+ if( aArgs[i].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("CellRangeRepresentation")))
+ aArgs[i].Value >>= sCellRange;
+ else if( aArgs[i].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("BrokenCellRangeForExport")))
+ {
+ if( aArgs[i].Value >>= sBrokenRange )
+ bBrokenRangeAvailable = true;
+ }
+ else if( aArgs[i].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("DataRowSource")))
+ {
+ chart::ChartDataRowSource eRowSource;
+ aArgs[i].Value >>= eRowSource;
+ mbRowSourceColumns = ( eRowSource == chart::ChartDataRowSource_COLUMNS );
+ }
+ else if( aArgs[i].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("FirstCellAsLabel")))
+ aArgs[i].Value >>= mbHasSeriesLabels;
+ else if( aArgs[i].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("SequenceMapping")))
+ aArgs[i].Value >>= maSequenceMapping;
+ else if( aArgs[i].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("TableNumberList")))
+ aArgs[i].Value >>= msTableNumberList;
+ }
+
+ // #i79009# For Writer we have to export a broken version of the
+ // range, where every row number is noe too large, so that older
+ // version can correctly read those files.
+ msChartAddress = (bBrokenRangeAvailable ? sBrokenRange : sCellRange);
+ if( msChartAddress.getLength() > 0 )
+ {
+ // convert format to XML-conform one
+ Reference< chart2::data::XRangeXMLConversion > xConversion( xDataProvider, uno::UNO_QUERY );
+ if( xConversion.is())
+ msChartAddress = xConversion->convertRangeToXML( msChartAddress );
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ (void)ex; // avoid warning for pro build
+ OSL_FAIL( OUStringToOString(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "Exception caught. Type: " )) +
+ OUString::createFromAscii( typeid( ex ).name()) +
+ OUString( RTL_CONSTASCII_USTRINGPARAM( ", Message: " )) +
+ ex.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
+ }
+}
+
+// export components ========================================
+
+// first version: everything goes in one storage
+
+Sequence< OUString > SAL_CALL SchXMLExport_getSupportedServiceNames() throw()
+{
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Chart.XMLExporter" ) );
+ const Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+OUString SAL_CALL SchXMLExport_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "SchXMLExport.Compact" ) );
+}
+
+Reference< uno::XInterface > SAL_CALL SchXMLExport_createInstance(const Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )
+{
+ // #110680#
+ // #103997# removed some flags from EXPORT_ALL
+ return (cppu::OWeakObject*)new SchXMLExport( rSMgr, EXPORT_ALL ^ ( EXPORT_SETTINGS | EXPORT_MASTERSTYLES | EXPORT_SCRIPTS ));
+}
+
+// Oasis format
+Sequence< OUString > SAL_CALL SchXMLExport_Oasis_getSupportedServiceNames() throw()
+{
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Chart.XMLOasisExporter" ) );
+ const Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+OUString SAL_CALL SchXMLExport_Oasis_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "SchXMLExport.Oasis.Compact" ) );
+}
+
+Reference< uno::XInterface > SAL_CALL SchXMLExport_Oasis_createInstance(const Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )
+{
+ // #103997# removed some flags from EXPORT_ALL
+ return (cppu::OWeakObject*)new SchXMLExport( rSMgr,
+ (EXPORT_ALL ^ ( EXPORT_SETTINGS | EXPORT_MASTERSTYLES | EXPORT_SCRIPTS )) | EXPORT_OASIS );
+}
+
+// ============================================================
+
+// multiple storage version: one for content / styles / meta
+
+Sequence< OUString > SAL_CALL SchXMLExport_Styles_getSupportedServiceNames() throw()
+{
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Chart.XMLStylesExporter" ));
+ const Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+OUString SAL_CALL SchXMLExport_Styles_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "SchXMLExport.Styles" ));
+}
+
+Reference< uno::XInterface > SAL_CALL SchXMLExport_Styles_createInstance(const Reference< lang::XMultiServiceFactory >& rSMgr) throw( uno::Exception )
+{
+ // #110680#
+ return (cppu::OWeakObject*)new SchXMLExport( rSMgr, EXPORT_STYLES );
+}
+
+// Oasis format
+Sequence< OUString > SAL_CALL SchXMLExport_Oasis_Styles_getSupportedServiceNames() throw()
+{
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Chart.XMLOasisStylesExporter" ));
+ const Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+OUString SAL_CALL SchXMLExport_Oasis_Styles_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "SchXMLExport.Oasis.Styles" ));
+}
+
+Reference< uno::XInterface > SAL_CALL SchXMLExport_Oasis_Styles_createInstance(const Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )
+{
+ return (cppu::OWeakObject*)new SchXMLExport( rSMgr, EXPORT_STYLES | EXPORT_OASIS );
+}
+
+// ------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL SchXMLExport_Content_getSupportedServiceNames() throw()
+{
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Chart.XMLContentExporter" ));
+ const Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+OUString SAL_CALL SchXMLExport_Content_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "SchXMLExport.Content" ));
+}
+
+Reference< uno::XInterface > SAL_CALL SchXMLExport_Content_createInstance(const Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )
+{
+ // #110680#
+ return (cppu::OWeakObject*)new SchXMLExport( rSMgr, EXPORT_AUTOSTYLES | EXPORT_CONTENT | EXPORT_FONTDECLS );
+}
+
+// Oasis format
+Sequence< OUString > SAL_CALL SchXMLExport_Oasis_Content_getSupportedServiceNames() throw()
+{
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Chart.XMLOasisContentExporter" ));
+ const Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+OUString SAL_CALL SchXMLExport_Oasis_Content_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "SchXMLExport.Oasis.Content" ));
+}
+
+Reference< uno::XInterface > SAL_CALL SchXMLExport_Oasis_Content_createInstance(const Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )
+{
+ return (cppu::OWeakObject*)new SchXMLExport( rSMgr, EXPORT_AUTOSTYLES | EXPORT_CONTENT | EXPORT_FONTDECLS | EXPORT_OASIS );
+}
+
+// ------------------------------------------------------------
+
+// Oasis format
+Sequence< OUString > SAL_CALL SchXMLExport_Oasis_Meta_getSupportedServiceNames() throw()
+{
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Chart.XMLOasisMetaExporter" ));
+ const Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+OUString SAL_CALL SchXMLExport_Oasis_Meta_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "SchXMLExport.Oasis.Meta" ));
+}
+
+Reference< uno::XInterface > SAL_CALL SchXMLExport_Oasis_Meta_createInstance(const Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )
+{
+ return (cppu::OWeakObject*)new SchXMLExport( rSMgr, EXPORT_META | EXPORT_OASIS );
+}
+
+
+// XServiceInfo
+OUString SAL_CALL SchXMLExport::getImplementationName() throw( uno::RuntimeException )
+{
+ switch( getExportFlags())
+ {
+ case EXPORT_ALL:
+ return SchXMLExport_getImplementationName();
+ case EXPORT_STYLES:
+ return SchXMLExport_Styles_getImplementationName();
+ case ( EXPORT_AUTOSTYLES | EXPORT_CONTENT | EXPORT_FONTDECLS ):
+ return SchXMLExport_Content_getImplementationName();
+
+ // Oasis format
+ case ( EXPORT_ALL | EXPORT_OASIS ):
+ return SchXMLExport_Oasis_getImplementationName();
+ case ( EXPORT_STYLES | EXPORT_OASIS ):
+ return SchXMLExport_Oasis_Styles_getImplementationName();
+ case ( EXPORT_AUTOSTYLES | EXPORT_CONTENT | EXPORT_FONTDECLS | EXPORT_OASIS ):
+ return SchXMLExport_Oasis_Content_getImplementationName();
+ case ( EXPORT_META | EXPORT_OASIS ):
+ return SchXMLExport_Oasis_Meta_getImplementationName();
+
+ case EXPORT_SETTINGS:
+ // there is no settings component in chart
+ default:
+ return OUString(RTL_CONSTASCII_USTRINGPARAM( "SchXMLExport" ));
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/SchXMLImport.cxx b/xmloff/source/chart/SchXMLImport.cxx
new file mode 100644
index 000000000000..387f3a453eda
--- /dev/null
+++ b/xmloff/source/chart/SchXMLImport.cxx
@@ -0,0 +1,895 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "SchXMLImport.hxx"
+#include "SchXMLChartContext.hxx"
+#include "contexts.hxx"
+#include "XMLChartPropertySetMapper.hxx"
+#include "SchXMLTools.hxx"
+
+#include <tools/debug.hxx>
+#include <rtl/ustrbuf.hxx>
+// header for class ByteString
+#include <tools/string.hxx>
+#include <comphelper/processfactory.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/xmlstyle.hxx>
+#include <com/sun/star/task/XStatusIndicatorSupplier.hpp>
+#include <com/sun/star/chart/XChartDocument.hpp>
+#include <com/sun/star/chart/ChartDataRowSource.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/chart2/data/XDataReceiver.hpp>
+#include <com/sun/star/chart2/data/XDataProvider.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
+#include <com/sun/star/chart2/XChartTypeContainer.hpp>
+#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
+
+#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+
+#include <typeinfo>
+
+using namespace com::sun::star;
+using namespace ::xmloff::token;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::rtl::OUStringToOString;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+
+namespace
+{
+Reference< uno::XComponentContext > lcl_getComponentContext()
+{
+ Reference< uno::XComponentContext > xContext;
+ try
+ {
+ Reference< beans::XPropertySet > xFactProp( comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
+ if( xFactProp.is())
+ xFactProp->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xContext;
+ }
+ catch( uno::Exception& )
+ {}
+
+ return xContext;
+}
+
+class lcl_MatchesChartType : public ::std::unary_function< Reference< chart2::XChartType >, bool >
+{
+public:
+ explicit lcl_MatchesChartType( const OUString & aChartTypeName ) :
+ m_aChartTypeName( aChartTypeName )
+ {}
+
+ bool operator () ( const Reference< chart2::XChartType > & xChartType ) const
+ {
+ return (xChartType.is() &&
+ xChartType->getChartType().equals( m_aChartTypeName ));
+ }
+
+private:
+ OUString m_aChartTypeName;
+};
+} // anonymous namespace
+
+/* ----------------------------------------
+ TokenMaps for distinguishing different
+ tokens in different contexts
+ ----------------------------------------*/
+
+// ----------------------------------------
+// element maps
+// ----------------------------------------
+
+
+
+
+
+
+
+// ----------------------------------------
+// attribute maps
+// ----------------------------------------
+
+
+
+
+
+
+
+
+
+// ========================================
+
+SchXMLImportHelper::SchXMLImportHelper() :
+ mpAutoStyles( 0 ),
+
+ mpChartDocElemTokenMap( 0 ),
+ mpTableElemTokenMap( 0 ),
+ mpChartElemTokenMap( 0 ),
+ mpPlotAreaElemTokenMap( 0 ),
+ mpSeriesElemTokenMap( 0 ),
+
+ mpChartAttrTokenMap( 0 ),
+ mpPlotAreaAttrTokenMap( 0 ),
+ mpAutoStyleAttrTokenMap( 0 ),
+ mpCellAttrTokenMap( 0 ),
+ mpSeriesAttrTokenMap( 0 ),
+ mpRegEquationAttrTokenMap( 0 )
+{
+}
+
+SchXMLImportHelper::~SchXMLImportHelper()
+{
+ // delete token maps
+ if( mpChartDocElemTokenMap )
+ delete mpChartDocElemTokenMap;
+ if( mpTableElemTokenMap )
+ delete mpTableElemTokenMap;
+ if( mpChartElemTokenMap )
+ delete mpChartElemTokenMap;
+ if( mpPlotAreaElemTokenMap )
+ delete mpPlotAreaElemTokenMap;
+ if( mpSeriesElemTokenMap )
+ delete mpSeriesElemTokenMap;
+
+ if( mpChartAttrTokenMap )
+ delete mpChartAttrTokenMap;
+ if( mpPlotAreaAttrTokenMap )
+ delete mpPlotAreaAttrTokenMap;
+ if( mpAutoStyleAttrTokenMap )
+ delete mpAutoStyleAttrTokenMap;
+ if( mpCellAttrTokenMap )
+ delete mpCellAttrTokenMap;
+ if( mpSeriesAttrTokenMap )
+ delete mpSeriesAttrTokenMap;
+}
+
+SvXMLImportContext* SchXMLImportHelper::CreateChartContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix, const OUString& rLocalName,
+ const Reference< frame::XModel > xChartModel,
+ const Reference< xml::sax::XAttributeList >& )
+{
+ SvXMLImportContext* pContext = 0;
+
+ Reference< chart::XChartDocument > xDoc( xChartModel, uno::UNO_QUERY );
+ if( xDoc.is())
+ {
+ mxChartDoc = xDoc;
+ pContext = new SchXMLChartContext( *this, rImport, rLocalName );
+ }
+ else
+ {
+ OSL_FAIL( "No valid XChartDocument given as XModel" );
+ pContext = new SvXMLImportContext( rImport, nPrefix, rLocalName );
+ }
+
+ return pContext;
+}
+
+/* ----------------------------------------
+ get various token maps
+ ----------------------------------------*/
+
+const SvXMLTokenMap& SchXMLImportHelper::GetDocElemTokenMap()
+{
+ if( ! mpChartDocElemTokenMap )
+ {
+ static SvXMLTokenMapEntry aDocElemTokenMap[] =
+ {
+ { XML_NAMESPACE_OFFICE, XML_AUTOMATIC_STYLES, XML_TOK_DOC_AUTOSTYLES },
+ { XML_NAMESPACE_OFFICE, XML_STYLES, XML_TOK_DOC_STYLES },
+ { XML_NAMESPACE_OFFICE, XML_META, XML_TOK_DOC_META },
+ { XML_NAMESPACE_OFFICE, XML_BODY, XML_TOK_DOC_BODY },
+ XML_TOKEN_MAP_END
+ };
+
+ mpChartDocElemTokenMap = new SvXMLTokenMap( aDocElemTokenMap );
+ } // if( ! mpChartDocElemTokenMap )
+
+ return *mpChartDocElemTokenMap;
+}
+
+const SvXMLTokenMap& SchXMLImportHelper::GetTableElemTokenMap()
+{
+ if( ! mpTableElemTokenMap )
+ {
+ static SvXMLTokenMapEntry aTableElemTokenMap[] =
+ {
+ { XML_NAMESPACE_TABLE, XML_TABLE_HEADER_COLUMNS, XML_TOK_TABLE_HEADER_COLS },
+ { XML_NAMESPACE_TABLE, XML_TABLE_COLUMNS, XML_TOK_TABLE_COLUMNS },
+ { XML_NAMESPACE_TABLE, XML_TABLE_COLUMN, XML_TOK_TABLE_COLUMN },
+ { XML_NAMESPACE_TABLE, XML_TABLE_HEADER_ROWS, XML_TOK_TABLE_HEADER_ROWS },
+ { XML_NAMESPACE_TABLE, XML_TABLE_ROWS, XML_TOK_TABLE_ROWS },
+ { XML_NAMESPACE_TABLE, XML_TABLE_ROW, XML_TOK_TABLE_ROW },
+ XML_TOKEN_MAP_END
+ };
+
+ mpTableElemTokenMap = new SvXMLTokenMap( aTableElemTokenMap );
+ } // if( ! mpTableElemTokenMap )
+
+ return *mpTableElemTokenMap;
+}
+
+const SvXMLTokenMap& SchXMLImportHelper::GetChartElemTokenMap()
+{
+ if( ! mpChartElemTokenMap )
+ {
+ static SvXMLTokenMapEntry aChartElemTokenMap[] =
+ {
+ { XML_NAMESPACE_CHART, XML_PLOT_AREA, XML_TOK_CHART_PLOT_AREA },
+ { XML_NAMESPACE_CHART, XML_TITLE, XML_TOK_CHART_TITLE },
+ { XML_NAMESPACE_CHART, XML_SUBTITLE, XML_TOK_CHART_SUBTITLE },
+ { XML_NAMESPACE_CHART, XML_LEGEND, XML_TOK_CHART_LEGEND },
+ { XML_NAMESPACE_TABLE, XML_TABLE, XML_TOK_CHART_TABLE },
+ XML_TOKEN_MAP_END
+ };
+
+ mpChartElemTokenMap = new SvXMLTokenMap( aChartElemTokenMap );
+ } // if( ! mpChartElemTokenMap )
+
+ return *mpChartElemTokenMap;
+}
+
+const SvXMLTokenMap& SchXMLImportHelper::GetPlotAreaElemTokenMap()
+{
+ if( ! mpPlotAreaElemTokenMap )
+ {
+ static SvXMLTokenMapEntry aPlotAreaElemTokenMap[] =
+{
+ { XML_NAMESPACE_CHART_EXT, XML_COORDINATE_REGION, XML_TOK_PA_COORDINATE_REGION_EXT },
+ { XML_NAMESPACE_CHART, XML_COORDINATE_REGION, XML_TOK_PA_COORDINATE_REGION },
+ { XML_NAMESPACE_CHART, XML_AXIS, XML_TOK_PA_AXIS },
+ { XML_NAMESPACE_CHART, XML_SERIES, XML_TOK_PA_SERIES },
+ { XML_NAMESPACE_CHART, XML_WALL, XML_TOK_PA_WALL },
+ { XML_NAMESPACE_CHART, XML_FLOOR, XML_TOK_PA_FLOOR },
+ { XML_NAMESPACE_DR3D, XML_LIGHT, XML_TOK_PA_LIGHT_SOURCE },
+ { XML_NAMESPACE_CHART, XML_STOCK_GAIN_MARKER, XML_TOK_PA_STOCK_GAIN },
+ { XML_NAMESPACE_CHART, XML_STOCK_LOSS_MARKER, XML_TOK_PA_STOCK_LOSS },
+ { XML_NAMESPACE_CHART, XML_STOCK_RANGE_LINE, XML_TOK_PA_STOCK_RANGE },
+ XML_TOKEN_MAP_END
+};
+
+ mpPlotAreaElemTokenMap = new SvXMLTokenMap( aPlotAreaElemTokenMap );
+ } // if( ! mpPlotAreaElemTokenMap )
+
+ return *mpPlotAreaElemTokenMap;
+}
+
+const SvXMLTokenMap& SchXMLImportHelper::GetSeriesElemTokenMap()
+{
+ if( ! mpSeriesElemTokenMap )
+ {
+ static SvXMLTokenMapEntry aSeriesElemTokenMap[] =
+{
+ { XML_NAMESPACE_CHART, XML_DATA_POINT, XML_TOK_SERIES_DATA_POINT },
+ { XML_NAMESPACE_CHART, XML_DOMAIN, XML_TOK_SERIES_DOMAIN },
+ { XML_NAMESPACE_CHART, XML_MEAN_VALUE, XML_TOK_SERIES_MEAN_VALUE_LINE },
+ { XML_NAMESPACE_CHART, XML_REGRESSION_CURVE, XML_TOK_SERIES_REGRESSION_CURVE },
+ { XML_NAMESPACE_CHART, XML_ERROR_INDICATOR, XML_TOK_SERIES_ERROR_INDICATOR },
+ XML_TOKEN_MAP_END
+};
+
+ mpSeriesElemTokenMap = new SvXMLTokenMap( aSeriesElemTokenMap );
+ } // if( ! mpSeriesElemTokenMap )
+
+ return *mpSeriesElemTokenMap;
+}
+
+// ----------------------------------------
+
+const SvXMLTokenMap& SchXMLImportHelper::GetChartAttrTokenMap()
+{
+ if( ! mpChartAttrTokenMap )
+ {
+ static SvXMLTokenMapEntry aChartAttrTokenMap[] =
+{
+ { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_CHART_HREF },
+ { XML_NAMESPACE_CHART, XML_CLASS, XML_TOK_CHART_CLASS },
+ { XML_NAMESPACE_SVG, XML_WIDTH, XML_TOK_CHART_WIDTH },
+ { XML_NAMESPACE_SVG, XML_HEIGHT, XML_TOK_CHART_HEIGHT },
+ { XML_NAMESPACE_CHART, XML_STYLE_NAME, XML_TOK_CHART_STYLE_NAME },
+ { XML_NAMESPACE_CHART, XML_COLUMN_MAPPING, XML_TOK_CHART_COL_MAPPING },
+ { XML_NAMESPACE_CHART, XML_ROW_MAPPING, XML_TOK_CHART_ROW_MAPPING },
+ XML_TOKEN_MAP_END
+};
+
+ mpChartAttrTokenMap = new SvXMLTokenMap( aChartAttrTokenMap );
+ } // if( ! mpChartAttrTokenMap )
+
+ return *mpChartAttrTokenMap;
+}
+
+const SvXMLTokenMap& SchXMLImportHelper::GetPlotAreaAttrTokenMap()
+{
+ if( ! mpPlotAreaAttrTokenMap )
+ {
+ static SvXMLTokenMapEntry aPlotAreaAttrTokenMap[] =
+{
+ { XML_NAMESPACE_SVG, XML_X, XML_TOK_PA_X },
+ { XML_NAMESPACE_SVG, XML_Y, XML_TOK_PA_Y },
+ { XML_NAMESPACE_SVG, XML_WIDTH, XML_TOK_PA_WIDTH },
+ { XML_NAMESPACE_SVG, XML_HEIGHT, XML_TOK_PA_HEIGHT },
+ { XML_NAMESPACE_CHART, XML_STYLE_NAME, XML_TOK_PA_STYLE_NAME },
+ { XML_NAMESPACE_TABLE, XML_CELL_RANGE_ADDRESS, XML_TOK_PA_CHART_ADDRESS },
+ { XML_NAMESPACE_CHART, XML_DATA_SOURCE_HAS_LABELS, XML_TOK_PA_DS_HAS_LABELS },
+ { XML_NAMESPACE_DR3D, XML_TRANSFORM, XML_TOK_PA_TRANSFORM },
+ { XML_NAMESPACE_DR3D, XML_VRP, XML_TOK_PA_VRP },
+ { XML_NAMESPACE_DR3D, XML_VPN, XML_TOK_PA_VPN },
+ { XML_NAMESPACE_DR3D, XML_VUP, XML_TOK_PA_VUP },
+ { XML_NAMESPACE_DR3D, XML_PROJECTION, XML_TOK_PA_PROJECTION },
+ { XML_NAMESPACE_DR3D, XML_DISTANCE, XML_TOK_PA_DISTANCE },
+ { XML_NAMESPACE_DR3D, XML_FOCAL_LENGTH, XML_TOK_PA_FOCAL_LENGTH },
+ { XML_NAMESPACE_DR3D, XML_SHADOW_SLANT, XML_TOK_PA_SHADOW_SLANT },
+ { XML_NAMESPACE_DR3D, XML_SHADE_MODE, XML_TOK_PA_SHADE_MODE },
+ { XML_NAMESPACE_DR3D, XML_AMBIENT_COLOR, XML_TOK_PA_AMBIENT_COLOR },
+ { XML_NAMESPACE_DR3D, XML_LIGHTING_MODE, XML_TOK_PA_LIGHTING_MODE },
+ XML_TOKEN_MAP_END
+};
+
+ mpPlotAreaAttrTokenMap = new SvXMLTokenMap( aPlotAreaAttrTokenMap );
+ } // if( ! mpPlotAreaAttrTokenMap )
+
+ return *mpPlotAreaAttrTokenMap;
+}
+
+const SvXMLTokenMap& SchXMLImportHelper::GetAutoStyleAttrTokenMap()
+{
+ if( ! mpAutoStyleAttrTokenMap )
+ {
+ static SvXMLTokenMapEntry aAutoStyleAttrTokenMap[] =
+{
+ { XML_NAMESPACE_STYLE, XML_FAMILY, XML_TOK_AS_FAMILY },
+ { XML_NAMESPACE_STYLE, XML_NAME, XML_TOK_AS_NAME },
+ XML_TOKEN_MAP_END
+};
+
+ mpAutoStyleAttrTokenMap = new SvXMLTokenMap( aAutoStyleAttrTokenMap );
+ } // if( ! mpAutoStyleAttrTokenMap )
+
+ return *mpAutoStyleAttrTokenMap;
+}
+
+const SvXMLTokenMap& SchXMLImportHelper::GetCellAttrTokenMap()
+{
+ if( ! mpCellAttrTokenMap )
+ {
+ static SvXMLTokenMapEntry aCellAttrTokenMap[] =
+{
+ { XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_TOK_CELL_VAL_TYPE },
+ { XML_NAMESPACE_OFFICE, XML_VALUE, XML_TOK_CELL_VALUE },
+ XML_TOKEN_MAP_END
+};
+
+ mpCellAttrTokenMap = new SvXMLTokenMap( aCellAttrTokenMap );
+ } // if( ! mpCellAttrTokenMap )
+
+ return *mpCellAttrTokenMap;
+}
+
+const SvXMLTokenMap& SchXMLImportHelper::GetSeriesAttrTokenMap()
+{
+ if( ! mpSeriesAttrTokenMap )
+ {
+ static SvXMLTokenMapEntry aSeriesAttrTokenMap[] =
+{
+ { XML_NAMESPACE_CHART, XML_VALUES_CELL_RANGE_ADDRESS, XML_TOK_SERIES_CELL_RANGE },
+ { XML_NAMESPACE_CHART, XML_LABEL_CELL_ADDRESS, XML_TOK_SERIES_LABEL_ADDRESS },
+ { XML_NAMESPACE_CHART, XML_ATTACHED_AXIS, XML_TOK_SERIES_ATTACHED_AXIS },
+ { XML_NAMESPACE_CHART, XML_STYLE_NAME, XML_TOK_SERIES_STYLE_NAME },
+ { XML_NAMESPACE_CHART, XML_CLASS, XML_TOK_SERIES_CHART_CLASS },
+ XML_TOKEN_MAP_END
+};
+
+ mpSeriesAttrTokenMap = new SvXMLTokenMap( aSeriesAttrTokenMap );
+ } // if( ! mpSeriesAttrTokenMap )
+
+ return *mpSeriesAttrTokenMap;
+}
+
+const SvXMLTokenMap& SchXMLImportHelper::GetRegEquationAttrTokenMap()
+{
+ if( ! mpRegEquationAttrTokenMap )
+ {
+ static SvXMLTokenMapEntry aRegressionEquationAttrTokenMap[] =
+{
+ { XML_NAMESPACE_CHART, XML_STYLE_NAME, XML_TOK_REGEQ_STYLE_NAME },
+ { XML_NAMESPACE_CHART, XML_DISPLAY_EQUATION, XML_TOK_REGEQ_DISPLAY_EQUATION },
+ { XML_NAMESPACE_CHART, XML_DISPLAY_R_SQUARE, XML_TOK_REGEQ_DISPLAY_R_SQUARE },
+ { XML_NAMESPACE_SVG, XML_X, XML_TOK_REGEQ_POS_X },
+ { XML_NAMESPACE_SVG, XML_Y, XML_TOK_REGEQ_POS_Y },
+ XML_TOKEN_MAP_END
+};
+
+ mpRegEquationAttrTokenMap = new SvXMLTokenMap( aRegressionEquationAttrTokenMap );
+ } // if( ! mpRegEquationAttrTokenMap )
+
+ return *mpRegEquationAttrTokenMap;
+}
+
+// ----------------------------------------
+
+//static
+void SchXMLImportHelper::DeleteDataSeries(
+ const Reference< chart2::XDataSeries > & xSeries,
+ const Reference< chart2::XChartDocument > & xDoc )
+{
+ if( xDoc.is() )
+ try
+ {
+ Reference< chart2::XCoordinateSystemContainer > xCooSysCnt(
+ xDoc->getFirstDiagram(), uno::UNO_QUERY_THROW );
+ Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq(
+ xCooSysCnt->getCoordinateSystems());
+
+ sal_Int32 nCooSysIndex = 0;
+ for( nCooSysIndex=0; nCooSysIndex<aCooSysSeq.getLength(); nCooSysIndex++ )
+ {
+ Reference< chart2::XChartTypeContainer > xCTCnt( aCooSysSeq[ nCooSysIndex ], uno::UNO_QUERY_THROW );
+ Sequence< Reference< chart2::XChartType > > aChartTypes( xCTCnt->getChartTypes());
+
+ sal_Int32 nChartTypeIndex = 0;
+ for( nChartTypeIndex=0; nChartTypeIndex<aChartTypes.getLength(); nChartTypeIndex++ )
+ {
+ Reference< chart2::XDataSeriesContainer > xSeriesCnt( aChartTypes[nChartTypeIndex], uno::UNO_QUERY_THROW );
+ Sequence< Reference< chart2::XDataSeries > > aSeriesSeq( xSeriesCnt->getDataSeries());
+
+ sal_Int32 nSeriesIndex = 0;
+ for( nSeriesIndex=0; nSeriesIndex<aSeriesSeq.getLength(); nSeriesIndex++ )
+ {
+ if( xSeries==aSeriesSeq[nSeriesIndex] )
+ {
+ xSeriesCnt->removeDataSeries(xSeries);
+ return;
+ }
+ }
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ (void)ex; // avoid warning for pro build
+ OSL_FAIL( OUStringToOString(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "Exception caught. Type: " )) +
+ OUString::createFromAscii( typeid( ex ).name()) +
+ OUString( RTL_CONSTASCII_USTRINGPARAM( ", Message: " )) +
+ ex.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
+ }
+}
+
+// static
+Reference< chart2::XDataSeries > SchXMLImportHelper::GetNewDataSeries(
+ const Reference< chart2::XChartDocument > & xDoc,
+ sal_Int32 nCoordinateSystemIndex,
+ const OUString & rChartTypeName,
+ bool bPushLastChartType /* = false */ )
+{
+ Reference< chart2::XDataSeries > xResult;
+ if(!xDoc.is())
+ return xResult;
+
+ try
+ {
+ Reference< chart2::XCoordinateSystemContainer > xCooSysCnt(
+ xDoc->getFirstDiagram(), uno::UNO_QUERY_THROW );
+ Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq(
+ xCooSysCnt->getCoordinateSystems());
+ Reference< uno::XComponentContext > xContext( lcl_getComponentContext());
+
+ if( nCoordinateSystemIndex < aCooSysSeq.getLength())
+ {
+ Reference< chart2::XChartType > xCurrentType;
+ {
+ Reference< chart2::XChartTypeContainer > xCTCnt( aCooSysSeq[ nCoordinateSystemIndex ], uno::UNO_QUERY_THROW );
+ Sequence< Reference< chart2::XChartType > > aChartTypes( xCTCnt->getChartTypes());
+ // find matching chart type group
+ const Reference< chart2::XChartType > * pBegin = aChartTypes.getConstArray();
+ const Reference< chart2::XChartType > * pEnd = pBegin + aChartTypes.getLength();
+ const Reference< chart2::XChartType > * pIt =
+ ::std::find_if( pBegin, pEnd, lcl_MatchesChartType( rChartTypeName ));
+ if( pIt != pEnd )
+ xCurrentType.set( *pIt );
+ // if chart type is set at series and differs from current one,
+ // create a new chart type
+ if( !xCurrentType.is())
+ {
+ xCurrentType.set(
+ xContext->getServiceManager()->createInstanceWithContext( rChartTypeName, xContext ),
+ uno::UNO_QUERY );
+ if( xCurrentType.is())
+ {
+ if( bPushLastChartType && aChartTypes.getLength())
+ {
+ sal_Int32 nIndex( aChartTypes.getLength() - 1 );
+ aChartTypes.realloc( aChartTypes.getLength() + 1 );
+ aChartTypes[ nIndex + 1 ] = aChartTypes[ nIndex ];
+ aChartTypes[ nIndex ] = xCurrentType;
+ xCTCnt->setChartTypes( aChartTypes );
+ }
+ else
+ xCTCnt->addChartType( xCurrentType );
+ }
+ }
+ }
+
+ if( xCurrentType.is())
+ {
+ Reference< chart2::XDataSeriesContainer > xSeriesCnt( xCurrentType, uno::UNO_QUERY_THROW );
+ Sequence< Reference< chart2::XDataSeries > > aSeriesSeq( xSeriesCnt->getDataSeries());
+
+ if( xContext.is() )
+ {
+ xResult.set(
+ xContext->getServiceManager()->createInstanceWithContext(
+ OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.DataSeries" )),
+ xContext ), uno::UNO_QUERY_THROW );
+ }
+ if( xResult.is() )
+ xSeriesCnt->addDataSeries( xResult );
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ (void)ex; // avoid warning for pro build
+ OSL_FAIL( OUStringToOString(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "Exception caught. Type: " )) +
+ OUString::createFromAscii( typeid( ex ).name()) +
+ OUString( RTL_CONSTASCII_USTRINGPARAM( ", Message: " )) +
+ ex.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
+ }
+ return xResult;
+}
+
+// static
+Reference< chart2::data::XLabeledDataSequence > SchXMLImportHelper::GetNewLabeledDataSequence()
+{
+ // @todo: remove this asap
+ OSL_FAIL( "Do not call this method" );
+ Reference< chart2::data::XLabeledDataSequence > xResult;
+ // DO NOT USED -- DEPRECATED. Use SchXMLTools::GetNewLabeledDataSequence() instead
+ return xResult;
+}
+
+// ========================================
+
+// #110680#
+SchXMLImport::SchXMLImport(
+ const Reference< lang::XMultiServiceFactory >& xServiceFactory,
+ sal_uInt16 nImportFlags ) :
+ SvXMLImport( xServiceFactory, nImportFlags )
+{
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_XLINK), GetXMLToken(XML_N_XLINK), XML_NAMESPACE_XLINK );
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_CHART_EXT), GetXMLToken(XML_N_CHART_EXT), XML_NAMESPACE_CHART_EXT);
+
+ mbIsGraphicLoadOnDemandSupported = false;
+}
+
+// #110680#
+SchXMLImport::SchXMLImport(
+ const Reference< lang::XMultiServiceFactory >& xServiceFactory,
+ Reference< frame::XModel > xModel,
+ Reference< document::XGraphicObjectResolver >& rGrfContainer,
+ sal_Bool /*bLoadDoc*/, sal_Bool bShowProgress )
+: SvXMLImport( xServiceFactory, xModel, rGrfContainer )
+{
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_XLINK), GetXMLToken(XML_N_XLINK), XML_NAMESPACE_XLINK );
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_CHART_EXT), GetXMLToken(XML_N_CHART_EXT), XML_NAMESPACE_CHART_EXT);
+
+ // get status indicator (if requested)
+ if( bShowProgress )
+ {
+ Reference< frame::XController > xController( xModel->getCurrentController());
+ if( xController.is())
+ {
+ Reference< frame::XFrame > xFrame( xController->getFrame());
+ if( xFrame.is())
+ {
+ Reference< task::XStatusIndicatorSupplier > xFactory( xFrame, uno::UNO_QUERY );
+ if( xFactory.is())
+ {
+ mxStatusIndicator = xFactory->getStatusIndicator();
+ }
+ }
+ }
+ }
+
+ // add progress view
+ if( mxStatusIndicator.is())
+ {
+ const OUString aText( RTL_CONSTASCII_USTRINGPARAM( "XML Import" ));
+ mxStatusIndicator->start( aText, 100 ); // use percentage as values
+ }
+}
+
+SchXMLImport::~SchXMLImport() throw ()
+{
+ // stop progress view
+ if( mxStatusIndicator.is())
+ {
+ mxStatusIndicator->end();
+ mxStatusIndicator->reset();
+ }
+
+ uno::Reference< chart2::XChartDocument > xChartDoc( GetModel(), uno::UNO_QUERY );
+ if( xChartDoc.is() && xChartDoc->hasControllersLocked() )
+ xChartDoc->unlockControllers();
+}
+
+// create the main context (subcontexts are created
+// by the one created here)
+SvXMLImportContext *SchXMLImport::CreateContext( sal_uInt16 nPrefix, const OUString& rLocalName,
+ const Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ SvXMLImportContext* pContext = 0;
+
+ // accept <office:document>
+ if( XML_NAMESPACE_OFFICE == nPrefix &&
+ ( IsXMLToken( rLocalName, XML_DOCUMENT_STYLES) ||
+ IsXMLToken( rLocalName, XML_DOCUMENT_CONTENT) ))
+ {
+ pContext = new SchXMLDocContext( maImportHelper, *this, nPrefix, rLocalName );
+ } else if ( (XML_NAMESPACE_OFFICE == nPrefix) &&
+ ( IsXMLToken(rLocalName, XML_DOCUMENT) ||
+ (IsXMLToken(rLocalName, XML_DOCUMENT_META)
+ && (getImportFlags() & IMPORT_META) )) )
+ {
+ uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
+ GetModel(), uno::UNO_QUERY);
+ // mst@: right now, this seems to be not supported, so it is untested
+ if (xDPS.is()) {
+ uno::Reference<xml::sax::XDocumentHandler> xDocBuilder(
+ mxServiceFactory->createInstance(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.xml.dom.SAXDocumentBuilder"))),
+ uno::UNO_QUERY_THROW);
+ pContext = (IsXMLToken(rLocalName, XML_DOCUMENT_META))
+ ? new SvXMLMetaDocumentContext(*this,
+ XML_NAMESPACE_OFFICE, rLocalName,
+ xDPS->getDocumentProperties(), xDocBuilder)
+ // flat OpenDocument file format
+ : new SchXMLFlatDocContext_Impl(
+ maImportHelper, *this, nPrefix, rLocalName,
+ xDPS->getDocumentProperties(), xDocBuilder);
+ } else {
+ pContext = (IsXMLToken(rLocalName, XML_DOCUMENT_META))
+ ? SvXMLImport::CreateContext( nPrefix, rLocalName, xAttrList )
+ : new SchXMLDocContext( maImportHelper, *this,
+ nPrefix, rLocalName );
+ }
+ } else {
+ pContext = SvXMLImport::CreateContext( nPrefix, rLocalName, xAttrList );
+ }
+
+ return pContext;
+}
+
+SvXMLImportContext* SchXMLImport::CreateStylesContext(
+ const OUString& rLocalName,
+ const Reference<xml::sax::XAttributeList>& xAttrList )
+{
+ //#i103287# make sure that the version information is set before importing all the properties (especially stroke-opacity!)
+ SchXMLTools::setBuildIDAtImportInfo( GetModel(), getImportInfo() );
+
+ SvXMLStylesContext* pStylesCtxt =
+ new SvXMLStylesContext( *(this), XML_NAMESPACE_OFFICE, rLocalName, xAttrList );
+
+ // set context at base class, so that all auto-style classes are imported
+ SetAutoStyles( pStylesCtxt );
+ maImportHelper.SetAutoStylesContext( pStylesCtxt );
+
+ return pStylesCtxt;
+}
+
+void SAL_CALL SchXMLImport::setTargetDocument( const uno::Reference< lang::XComponent >& xDoc )
+ throw(lang::IllegalArgumentException, uno::RuntimeException)
+{
+ uno::Reference< chart2::XChartDocument > xOldDoc( GetModel(), uno::UNO_QUERY );
+ if( xOldDoc.is() && xOldDoc->hasControllersLocked() )
+ xOldDoc->unlockControllers();
+
+ SvXMLImport::setTargetDocument( xDoc );
+
+ //set data provider and number formatter
+ // try to get an XDataProvider and set it
+ // @todo: if we have our own data, we must not use the parent as data provider
+ uno::Reference< chart2::XChartDocument > xChartDoc( GetModel(), uno::UNO_QUERY );
+
+ if( xChartDoc.is() )
+ try
+ {
+ //prevent rebuild of view during load ( necesarry especially if loaded not via load api, which is the case for example if binary files are loaded )
+ xChartDoc->lockControllers();
+
+ uno::Reference< container::XChild > xChild( xChartDoc, uno::UNO_QUERY );
+ uno::Reference< chart2::data::XDataReceiver > xDataReceiver( xChartDoc, uno::UNO_QUERY );
+ bool bHasOwnData = true;
+ if( xChild.is() && xDataReceiver.is())
+ {
+ Reference< lang::XMultiServiceFactory > xFact( xChild->getParent(), uno::UNO_QUERY );
+ if( xFact.is() )
+ {
+ //if the parent has a number formatter we will use the numberformatter of the parent
+ Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( xFact, uno::UNO_QUERY );
+ xDataReceiver->attachNumberFormatsSupplier( xNumberFormatsSupplier );
+
+ if ( !xChartDoc->getDataProvider().is() )
+ {
+ const OUString aDataProviderServiceName( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2.data.DataProvider"));
+ const uno::Sequence< OUString > aServiceNames( xFact->getAvailableServiceNames());
+ const OUString * pBegin = aServiceNames.getConstArray();
+ const OUString * pEnd = pBegin + aServiceNames.getLength();
+ if( ::std::find( pBegin, pEnd, aDataProviderServiceName ) != pEnd )
+ {
+ Reference< chart2::data::XDataProvider > xProvider(
+ xFact->createInstance( aDataProviderServiceName ), uno::UNO_QUERY );
+ if( xProvider.is())
+ {
+ xDataReceiver->attachDataProvider( xProvider );
+ bHasOwnData = false;
+ }
+ }
+ }
+ else
+ bHasOwnData = false;
+ }
+// else we have no parent => we have our own data
+
+ if( bHasOwnData && ! xChartDoc->hasInternalDataProvider() )
+ xChartDoc->createInternalDataProvider( sal_False );
+ }
+ }
+ catch( uno::Exception & rEx )
+ {
+#ifdef DBG_UTIL
+ String aStr( rEx.Message );
+ ByteString aBStr( aStr, RTL_TEXTENCODING_ASCII_US );
+ OSL_TRACE( "SchXMLChartContext::StartElement(): Exception caught: %s", aBStr.GetBuffer());
+#else
+ (void)rEx; // avoid warning for pro build
+#endif
+ }
+}
+
+// export components ========================================
+
+// first version: everything comes from one storage
+
+Sequence< OUString > SAL_CALL SchXMLImport_getSupportedServiceNames() throw()
+{
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Chart.XMLOasisImporter" ) );
+ const Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+OUString SAL_CALL SchXMLImport_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "SchXMLImport" ) );
+}
+
+Reference< uno::XInterface > SAL_CALL SchXMLImport_createInstance(const Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )
+{
+ // #110680#
+ return (cppu::OWeakObject*)new SchXMLImport(rSMgr);
+}
+
+// ============================================================
+
+// multiple storage version: one for content / styles / meta
+
+Sequence< OUString > SAL_CALL SchXMLImport_Styles_getSupportedServiceNames() throw()
+{
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Chart.XMLOasisStylesImporter" ) );
+ const Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+OUString SAL_CALL SchXMLImport_Styles_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "SchXMLImport.Styles" ) );
+}
+
+Reference< uno::XInterface > SAL_CALL SchXMLImport_Styles_createInstance(const Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )
+{
+ // #110680#
+ return (cppu::OWeakObject*)new SchXMLImport( rSMgr, IMPORT_STYLES );
+}
+
+// ------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL SchXMLImport_Content_getSupportedServiceNames() throw()
+{
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Chart.XMLOasisContentImporter" ) );
+ const Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+OUString SAL_CALL SchXMLImport_Content_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "SchXMLImport.Content" ) );
+}
+
+Reference< uno::XInterface > SAL_CALL SchXMLImport_Content_createInstance(const Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )
+{
+ // #110680#
+ return (cppu::OWeakObject*)new SchXMLImport( rSMgr, IMPORT_CONTENT | IMPORT_AUTOSTYLES | IMPORT_FONTDECLS );
+}
+
+// ------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL SchXMLImport_Meta_getSupportedServiceNames() throw()
+{
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Chart.XMLOasisMetaImporter" ) );
+ const Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+OUString SAL_CALL SchXMLImport_Meta_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "SchXMLImport.Meta" ) );
+}
+
+Reference< uno::XInterface > SAL_CALL SchXMLImport_Meta_createInstance(const Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )
+{
+ // #110680#
+ return (cppu::OWeakObject*)new SchXMLImport( rSMgr, IMPORT_META );
+}
+
+// XServiceInfo
+OUString SAL_CALL SchXMLImport::getImplementationName() throw( uno::RuntimeException )
+{
+ switch( getImportFlags())
+ {
+ case IMPORT_ALL:
+ return SchXMLImport_getImplementationName();
+ case IMPORT_STYLES:
+ return SchXMLImport_Styles_getImplementationName();
+ case ( IMPORT_CONTENT | IMPORT_AUTOSTYLES | IMPORT_FONTDECLS ):
+ return SchXMLImport_Content_getImplementationName();
+ case IMPORT_META:
+ return SchXMLImport_Meta_getImplementationName();
+
+ case IMPORT_SETTINGS:
+ // there is no settings component in chart
+ default:
+ return OUString(RTL_CONSTASCII_USTRINGPARAM( "SchXMLImport" ));
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/SchXMLLegendContext.cxx b/xmloff/source/chart/SchXMLLegendContext.cxx
new file mode 100644
index 000000000000..e97214645c62
--- /dev/null
+++ b/xmloff/source/chart/SchXMLLegendContext.cxx
@@ -0,0 +1,229 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "SchXMLLegendContext.hxx"
+#include "SchXMLEnumConverter.hxx"
+
+#include <xmloff/xmlnmspe.hxx>
+#include <xmloff/xmlement.hxx>
+#include <xmloff/prstylei.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmluconv.hxx>
+
+#include <tools/debug.hxx>
+
+#include <com/sun/star/chart/ChartLegendPosition.hpp>
+#include <com/sun/star/chart/ChartLegendExpansion.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+
+using namespace ::xmloff::token;
+using namespace com::sun::star;
+
+using rtl::OUString;
+using com::sun::star::uno::Reference;
+
+//----------------------------------------
+
+namespace
+{
+
+enum LegendAttributeTokens
+{
+ XML_TOK_LEGEND_POSITION,
+ XML_TOK_LEGEND_X,
+ XML_TOK_LEGEND_Y,
+ XML_TOK_LEGEND_STYLE_NAME,
+ XML_TOK_LEGEND_EXPANSION,
+ XML_TOK_LEGEND_EXPANSION_ASPECT_RATIO,
+ XML_TOK_LEGEND_WIDTH,
+ XML_TOK_LEGEND_WIDTH_EXT,
+ XML_TOK_LEGEND_HEIGHT,
+ XML_TOK_LEGEND_HEIGHT_EXT
+};
+
+SvXMLTokenMapEntry aLegendAttributeTokenMap[] =
+{
+ { XML_NAMESPACE_CHART, XML_LEGEND_POSITION, XML_TOK_LEGEND_POSITION },
+ { XML_NAMESPACE_SVG, XML_X, XML_TOK_LEGEND_X },
+ { XML_NAMESPACE_SVG, XML_Y, XML_TOK_LEGEND_Y },
+ { XML_NAMESPACE_CHART, XML_STYLE_NAME, XML_TOK_LEGEND_STYLE_NAME },
+ { XML_NAMESPACE_STYLE, XML_LEGEND_EXPANSION, XML_TOK_LEGEND_EXPANSION },
+ { XML_NAMESPACE_STYLE, XML_LEGEND_EXPANSION_ASPECT_RATIO, XML_TOK_LEGEND_EXPANSION_ASPECT_RATIO },
+ { XML_NAMESPACE_SVG, XML_WIDTH, XML_TOK_LEGEND_WIDTH },
+ { XML_NAMESPACE_CHART_EXT, XML_WIDTH, XML_TOK_LEGEND_WIDTH_EXT },
+ { XML_NAMESPACE_SVG, XML_HEIGHT, XML_TOK_LEGEND_HEIGHT },
+ { XML_NAMESPACE_CHART_EXT, XML_HEIGHT, XML_TOK_LEGEND_HEIGHT_EXT },
+ XML_TOKEN_MAP_END
+};
+
+class LegendAttributeTokenMap : public SvXMLTokenMap
+{
+public:
+ LegendAttributeTokenMap(): SvXMLTokenMap( aLegendAttributeTokenMap ) {}
+ virtual ~LegendAttributeTokenMap() {}
+};
+
+//a LegendAttributeTokenMap Singleton
+struct theLegendAttributeTokenMap : public rtl::Static< LegendAttributeTokenMap, theLegendAttributeTokenMap > {};
+
+}//end anonymous namespace
+
+//----------------------------------------
+
+SchXMLLegendContext::SchXMLLegendContext( SchXMLImportHelper& rImpHelper, SvXMLImport& rImport, const rtl::OUString& rLocalName ) :
+ SvXMLImportContext( rImport, XML_NAMESPACE_CHART, rLocalName ),
+ mrImportHelper( rImpHelper )
+{
+}
+
+void SchXMLLegendContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ uno::Reference< chart::XChartDocument > xDoc = mrImportHelper.GetChartDocument();
+ if( !xDoc.is() )
+ return;
+
+ // turn on legend
+ uno::Reference< beans::XPropertySet > xDocProp( xDoc, uno::UNO_QUERY );
+ if( xDocProp.is() )
+ {
+ try
+ {
+ xDocProp->setPropertyValue( rtl::OUString::createFromAscii( "HasLegend" ), uno::makeAny( sal_True ) );
+ }
+ catch( beans::UnknownPropertyException )
+ {
+ OSL_TRACE( "Property HasLegend not found" );
+ }
+ }
+
+ uno::Reference< drawing::XShape > xLegendShape( xDoc->getLegend(), uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySet > xLegendProps( xLegendShape, uno::UNO_QUERY );
+ if( !xLegendShape.is() || !xLegendProps.is() )
+ {
+ OSL_TRACE( "legend could not be created" );
+ return;
+ }
+
+ // parse attributes
+ sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
+ const SvXMLTokenMap& rAttrTokenMap = theLegendAttributeTokenMap::get();
+
+ awt::Point aLegendPos;
+ bool bHasXPosition=false;
+ bool bHasYPosition=false;
+ awt::Size aLegendSize;
+ bool bHasWidth=false;
+ bool bHasHeight=false;
+ chart::ChartLegendExpansion nLegendExpansion = chart::ChartLegendExpansion_HIGH;
+ bool bHasExpansion=false;
+
+ rtl::OUString sAutoStyleName;
+ uno::Any aAny;
+
+ for( sal_Int16 i = 0; i < nAttrCount; i++ )
+ {
+ rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
+ rtl::OUString aLocalName;
+ rtl::OUString aValue = xAttrList->getValueByIndex( i );
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+
+ switch( rAttrTokenMap.Get( nPrefix, aLocalName ))
+ {
+ case XML_TOK_LEGEND_POSITION:
+ {
+ try
+ {
+ if( SchXMLEnumConverter::getLegendPositionConverter().importXML( aValue, aAny, GetImport().GetMM100UnitConverter() ) )
+ xLegendProps->setPropertyValue( rtl::OUString::createFromAscii( "Alignment" ), aAny );
+ }
+ catch( beans::UnknownPropertyException )
+ {
+ OSL_TRACE( "Property Alignment (legend) not found" );
+ }
+ }
+ break;
+
+ case XML_TOK_LEGEND_X:
+ GetImport().GetMM100UnitConverter().convertMeasure( aLegendPos.X, aValue );
+ bHasXPosition = true;
+ break;
+ case XML_TOK_LEGEND_Y:
+ GetImport().GetMM100UnitConverter().convertMeasure( aLegendPos.Y, aValue );
+ bHasYPosition = true;
+ break;
+ case XML_TOK_LEGEND_STYLE_NAME:
+ sAutoStyleName = aValue;
+ break;
+ case XML_TOK_LEGEND_EXPANSION:
+ SchXMLEnumConverter::getLegendPositionConverter().importXML( aValue, aAny, GetImport().GetMM100UnitConverter() );
+ bHasExpansion = (aAny>>=nLegendExpansion);
+ break;
+ case XML_TOK_LEGEND_EXPANSION_ASPECT_RATIO:
+ break;
+ case XML_TOK_LEGEND_WIDTH:
+ case XML_TOK_LEGEND_WIDTH_EXT:
+ GetImport().GetMM100UnitConverter().convertMeasure( aLegendSize.Width, aValue );
+ bHasWidth = true;
+ break;
+ case XML_TOK_LEGEND_HEIGHT:
+ case XML_TOK_LEGEND_HEIGHT_EXT:
+ GetImport().GetMM100UnitConverter().convertMeasure( aLegendSize.Height, aValue );
+ bHasHeight = true;
+ break;
+ default:
+ break;
+ }
+ }
+
+ if( bHasXPosition && bHasYPosition )
+ xLegendShape->setPosition( aLegendPos );
+
+ if( bHasExpansion && nLegendExpansion!= chart::ChartLegendExpansion_CUSTOM )
+ xLegendProps->setPropertyValue( rtl::OUString::createFromAscii( "Expansion" ), uno::makeAny(nLegendExpansion) );
+ else if( bHasHeight && bHasWidth )
+ xLegendShape->setSize( aLegendSize );
+
+ // the fill style has the default "none" in XML, but "solid" in the model.
+ xLegendProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillStyle" )), uno::makeAny( drawing::FillStyle_NONE ));
+
+ // set auto-styles for Legend
+ const SvXMLStylesContext* pStylesCtxt = mrImportHelper.GetAutoStylesContext();
+ if( pStylesCtxt )
+ {
+ const SvXMLStyleContext* pStyle = pStylesCtxt->FindStyleChildContext(
+ mrImportHelper.GetChartFamilyID(), sAutoStyleName );
+
+ if( pStyle && pStyle->ISA( XMLPropStyleContext ))
+ (( XMLPropStyleContext* )pStyle )->FillPropertySet( xLegendProps );
+ }
+}
+
+SchXMLLegendContext::~SchXMLLegendContext()
+{
+}
diff --git a/xmloff/source/chart/SchXMLLegendContext.hxx b/xmloff/source/chart/SchXMLLegendContext.hxx
new file mode 100644
index 000000000000..d3fa5b7516d3
--- /dev/null
+++ b/xmloff/source/chart/SchXMLLegendContext.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _SCH_XMLLEGENDCONTEXT_HXX_
+#define _SCH_XMLLEGENDCONTEXT_HXX_
+
+#include "SchXMLImport.hxx"
+
+// ----------------------------------------
+
+class SchXMLLegendContext : public SvXMLImportContext
+{
+public:
+ SchXMLLegendContext( SchXMLImportHelper& rImpHelper, SvXMLImport& rImport, const rtl::OUString& rLocalName );
+ virtual ~SchXMLLegendContext();
+
+ virtual void StartElement( const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+private:
+ SchXMLImportHelper& mrImportHelper;
+};
+
+#endif // _SCH_XMLLEGENDCONTEXT_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/SchXMLParagraphContext.cxx b/xmloff/source/chart/SchXMLParagraphContext.cxx
new file mode 100644
index 000000000000..5528d96b51b1
--- /dev/null
+++ b/xmloff/source/chart/SchXMLParagraphContext.cxx
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "SchXMLImport.hxx"
+#include "SchXMLParagraphContext.hxx"
+
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/nmspmap.hxx>
+
+using ::rtl::OUString;
+using namespace com::sun::star;
+using namespace ::xmloff::token;
+
+SchXMLParagraphContext::SchXMLParagraphContext( SvXMLImport& rImport,
+ const OUString& rLocalName,
+ OUString& rText,
+ OUString * pOutId /* = 0 */ ) :
+ SvXMLImportContext( rImport, XML_NAMESPACE_TEXT, rLocalName ),
+ mrText( rText ),
+ mpId( pOutId )
+{
+}
+
+SchXMLParagraphContext::~SchXMLParagraphContext()
+{}
+
+void SchXMLParagraphContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ // remember the id. It is used for storing the original cell range string in
+ // a local table (cached data)
+ if( mpId )
+ {
+ sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
+ rtl::OUString aValue;
+ bool bHaveXmlId( false );
+
+ for( sal_Int16 i = 0; i < nAttrCount; i++ )
+ {
+ rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
+ rtl::OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+
+ if (IsXMLToken(aLocalName, XML_ID))
+ {
+ if (nPrefix == XML_NAMESPACE_XML)
+ {
+ (*mpId) = xAttrList->getValueByIndex( i );
+ bHaveXmlId = true;
+ }
+ if (nPrefix == XML_NAMESPACE_TEXT)
+ { // text:id shall be ignored if xml:id exists
+ if (!bHaveXmlId)
+ {
+ (*mpId) = xAttrList->getValueByIndex( i );
+ }
+ }
+ }
+ }
+ }
+}
+
+void SchXMLParagraphContext::EndElement()
+{
+ mrText = maBuffer.makeStringAndClear();
+}
+
+SvXMLImportContext* SchXMLParagraphContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList >& )
+{
+ if( nPrefix == XML_NAMESPACE_TEXT )
+ {
+ if( rLocalName.equals( ::xmloff::token::GetXMLToken( ::xmloff::token::XML_TAB_STOP )))
+ {
+ maBuffer.append( sal_Unicode( 0x0009 )); // tabulator
+ }
+ else if( rLocalName.equals( ::xmloff::token::GetXMLToken( ::xmloff::token::XML_LINE_BREAK )))
+ {
+ maBuffer.append( sal_Unicode( 0x000A )); // linefeed
+ }
+ }
+
+ return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+}
+
+void SchXMLParagraphContext::Characters( const OUString& rChars )
+{
+ maBuffer.append( rChars );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/SchXMLParagraphContext.hxx b/xmloff/source/chart/SchXMLParagraphContext.hxx
new file mode 100644
index 000000000000..8304bf590d7b
--- /dev/null
+++ b/xmloff/source/chart/SchXMLParagraphContext.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _SCH_XMLPARAGRAPHCONTEXT_HXX_
+#define _SCH_XMLPARAGRAPHCONTEXT_HXX_
+
+#include <xmloff/xmlictxt.hxx>
+#include "rtl/ustring.hxx"
+#include "rtl/ustrbuf.hxx"
+
+class SchXMLImport;
+
+namespace com { namespace sun { namespace star { namespace xml { namespace sax {
+ class XAttributeList;
+}}}}}
+
+class SchXMLParagraphContext : public SvXMLImportContext
+{
+private:
+ ::rtl::OUString& mrText;
+ ::rtl::OUString* mpId;
+ ::rtl::OUStringBuffer maBuffer;
+
+public:
+ SchXMLParagraphContext( SvXMLImport& rImport,
+ const ::rtl::OUString& rLocalName,
+ ::rtl::OUString& rText,
+ ::rtl::OUString * pOutId = 0 );
+ virtual ~SchXMLParagraphContext();
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void Characters( const rtl::OUString& rChars );
+};
+
+#endif // _SCH_XMLPARAGRAPHCONTEXT_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
new file mode 100644
index 000000000000..41288969af64
--- /dev/null
+++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
@@ -0,0 +1,1181 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "SchXMLPlotAreaContext.hxx"
+#include "SchXMLImport.hxx"
+#include "SchXMLAxisContext.hxx"
+#include "SchXMLSeries2Context.hxx"
+#include "SchXMLTools.hxx"
+#include <tools/debug.hxx>
+#ifdef DBG_UTIL
+#include <tools/string.hxx>
+#endif
+
+#include <comphelper/processfactory.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmlement.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/prstylei.hxx>
+#include <xmloff/xmlstyle.hxx>
+#include "xexptran.hxx"
+#include <cppuhelper/implbase1.hxx>
+
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/awt/Size.hpp>
+
+#include <com/sun/star/chart/ChartDataRowSource.hpp>
+#include <com/sun/star/chart/X3DDisplay.hpp>
+#include <com/sun/star/chart/XStatisticDisplay.hpp>
+#include <com/sun/star/chart/XDiagramPositioning.hpp>
+
+#include <com/sun/star/chart2/data/XRangeXMLConversion.hpp>
+#include <com/sun/star/chart2/XChartTypeContainer.hpp>
+#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
+#include <com/sun/star/chart2/RelativePosition.hpp>
+
+#include <com/sun/star/drawing/CameraGeometry.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/util/XStringMapping.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+
+using namespace com::sun::star;
+using namespace ::xmloff::token;
+
+using ::rtl::OUString;
+using com::sun::star::uno::Reference;
+
+namespace
+{
+
+struct lcl_AxisHasCategories : public ::std::unary_function< SchXMLAxis, bool >
+{
+ bool operator() ( const SchXMLAxis & rAxis )
+ {
+ return rAxis.bHasCategories;
+ }
+};
+
+OUString lcl_ConvertRange( const ::rtl::OUString & rRange, const uno::Reference< chart2::XChartDocument > & xDoc )
+{
+ OUString aResult = rRange;
+ if(!xDoc.is())
+ return aResult;
+ uno::Reference< chart2::data::XRangeXMLConversion > xConversion(
+ xDoc->getDataProvider(), uno::UNO_QUERY );
+ if( xConversion.is())
+ aResult = xConversion->convertRangeFromXML( rRange );
+ return aResult;
+}
+
+} // anonymous namespace
+
+SchXML3DSceneAttributesHelper::SchXML3DSceneAttributesHelper( SvXMLImport& rImporter )
+ : SdXML3DSceneAttributesHelper( rImporter )
+{
+}
+
+void SchXML3DSceneAttributesHelper::getCameraDefaultFromDiagram( const uno::Reference< chart::XDiagram >& xDiagram )
+{
+ //different defaults for camera geometry necessary to workaround wrong behaviour in old chart
+ //in future make this version dependent if we have versioning (metastream) for ole objects
+
+ try
+ {
+ uno::Reference< beans::XPropertySet > xProp( xDiagram, uno::UNO_QUERY );
+ if( xProp.is() )
+ {
+ drawing::CameraGeometry aCamGeo;
+ xProp->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "D3DCameraGeometry" ))) >>= aCamGeo;
+ maVRP.setX( aCamGeo.vrp.PositionX );
+ maVRP.setY( aCamGeo.vrp.PositionY );
+ maVRP.setZ( aCamGeo.vrp.PositionZ );
+ maVPN.setX( aCamGeo.vpn.DirectionX );
+ maVPN.setY( aCamGeo.vpn.DirectionY );
+ maVPN.setZ( aCamGeo.vpn.DirectionZ );
+ maVUP.setX( aCamGeo.vup.DirectionX );
+ maVUP.setY( aCamGeo.vup.DirectionY );
+ maVUP.setZ( aCamGeo.vup.DirectionZ );
+ }
+ }
+ catch( uno::Exception & rEx )
+ {
+#ifdef DBG_UTIL
+ String aStr( rEx.Message );
+ ByteString aBStr( aStr, RTL_TEXTENCODING_ASCII_US );
+ OSL_TRACE( "Exception caught for property NumberOfLines: %s", aBStr.GetBuffer());
+#else
+ (void)rEx; // avoid warning for pro build
+#endif
+ }
+}
+
+SchXML3DSceneAttributesHelper::~SchXML3DSceneAttributesHelper()
+{
+}
+
+SchXMLPlotAreaContext::SchXMLPlotAreaContext(
+ SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport, const rtl::OUString& rLocalName,
+ const rtl::OUString& rXLinkHRefAttributeToIndicateDataProvider,
+ uno::Sequence< chart::ChartSeriesAddress >& rSeriesAddresses,
+ ::rtl::OUString& rCategoriesAddress,
+ ::rtl::OUString& rChartAddress,
+ bool& rbHasRangeAtPlotArea,
+ sal_Bool & rAllRangeAddressesAvailable,
+ sal_Bool & rColHasLabels,
+ sal_Bool & rRowHasLabels,
+ chart::ChartDataRowSource & rDataRowSource,
+ SeriesDefaultsAndStyles& rSeriesDefaultsAndStyles,
+ const ::rtl::OUString& aChartTypeServiceName,
+ tSchXMLLSequencesPerIndex & rLSequencesPerIndex,
+ const awt::Size & rChartSize ) :
+ SvXMLImportContext( rImport, XML_NAMESPACE_CHART, rLocalName ),
+ mrImportHelper( rImpHelper ),
+ mrSeriesAddresses( rSeriesAddresses ),
+ mrCategoriesAddress( rCategoriesAddress ),
+ mrSeriesDefaultsAndStyles( rSeriesDefaultsAndStyles ),
+ mnNumOfLinesProp( 0 ),
+ mbStockHasVolume( sal_False ),
+ mnSeries( 0 ),
+ m_aGlobalSeriesImportInfo( rAllRangeAddressesAvailable ),
+ maSceneImportHelper( rImport ),
+ m_aOuterPositioning( rImport ),
+ m_aInnerPositioning( rImport ),
+ mbPercentStacked(false),
+ m_bAxisPositionAttributeImported(false),
+ m_rXLinkHRefAttributeToIndicateDataProvider(rXLinkHRefAttributeToIndicateDataProvider),
+ mrChartAddress( rChartAddress ),
+ m_rbHasRangeAtPlotArea( rbHasRangeAtPlotArea ),
+ mrColHasLabels( rColHasLabels ),
+ mrRowHasLabels( rRowHasLabels ),
+ mrDataRowSource( rDataRowSource ),
+ maChartTypeServiceName( aChartTypeServiceName ),
+ mrLSequencesPerIndex( rLSequencesPerIndex ),
+ mbGlobalChartTypeUsedBySeries( false ),
+ maChartSize( rChartSize )
+{
+ m_rbHasRangeAtPlotArea = false;
+
+ // get Diagram
+ uno::Reference< chart::XChartDocument > xDoc( rImpHelper.GetChartDocument(), uno::UNO_QUERY );
+ if( xDoc.is())
+ {
+ mxDiagram = xDoc->getDiagram();
+ mxNewDoc.set( xDoc, uno::UNO_QUERY );
+
+ maSceneImportHelper.getCameraDefaultFromDiagram( mxDiagram );
+ }
+ DBG_ASSERT( mxDiagram.is(), "Couldn't get XDiagram" );
+
+ // turn off all axes initially
+ uno::Any aFalseBool;
+ aFalseBool <<= (sal_Bool)(sal_False);
+
+ uno::Reference< lang::XServiceInfo > xInfo( mxDiagram, uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySet > xProp( mxDiagram, uno::UNO_QUERY );
+ if( xInfo.is() &&
+ xProp.is())
+ {
+ try
+ {
+ xProp->setPropertyValue(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasXAxis" )), aFalseBool );
+ xProp->setPropertyValue(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasXAxisGrid" )), aFalseBool );
+ xProp->setPropertyValue(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasXAxisDescription" )), aFalseBool );
+ xProp->setPropertyValue(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasSecondaryXAxis" )), aFalseBool );
+ xProp->setPropertyValue(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasSecondaryXAxisDescription" )), aFalseBool );
+
+ xProp->setPropertyValue(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasYAxis" )), aFalseBool );
+ xProp->setPropertyValue(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasYAxisGrid" )), aFalseBool );
+ xProp->setPropertyValue(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasYAxisDescription" )), aFalseBool );
+ xProp->setPropertyValue(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasSecondaryYAxis" )), aFalseBool );
+ xProp->setPropertyValue(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasSecondaryYAxisDescription" )), aFalseBool );
+
+ xProp->setPropertyValue(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasZAxis" )), aFalseBool );
+ xProp->setPropertyValue(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasZAxisDescription" )), aFalseBool );
+
+ uno::Any aAny;
+ chart::ChartDataRowSource eSource = chart::ChartDataRowSource_COLUMNS;
+ aAny <<= eSource;
+ xProp->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DataRowSource" )), aAny );
+ }
+ catch( beans::UnknownPropertyException & )
+ {
+ OSL_FAIL( "Property required by service not supported" );
+ }
+ }
+}
+
+SchXMLPlotAreaContext::~SchXMLPlotAreaContext()
+{}
+
+void SchXMLPlotAreaContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ // parse attributes
+ sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
+ const SvXMLTokenMap& rAttrTokenMap = mrImportHelper.GetPlotAreaAttrTokenMap();
+ uno::Reference< chart2::XChartDocument > xNewDoc( GetImport().GetModel(), uno::UNO_QUERY );
+
+ for( sal_Int16 i = 0; i < nAttrCount; i++ )
+ {
+ rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
+ rtl::OUString aLocalName;
+ rtl::OUString aValue = xAttrList->getValueByIndex( i );
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+
+ switch( rAttrTokenMap.Get( nPrefix, aLocalName ))
+ {
+ case XML_TOK_PA_X:
+ case XML_TOK_PA_Y:
+ case XML_TOK_PA_WIDTH:
+ case XML_TOK_PA_HEIGHT:
+ m_aOuterPositioning.readPositioningAttribute( nPrefix, aLocalName, aValue );
+ break;
+ case XML_TOK_PA_STYLE_NAME:
+ msAutoStyleName = aValue;
+ break;
+ case XML_TOK_PA_CHART_ADDRESS:
+ mrChartAddress = lcl_ConvertRange( aValue, xNewDoc );
+ // indicator for getting data from the outside
+ m_rbHasRangeAtPlotArea = true;
+ break;
+ case XML_TOK_PA_DS_HAS_LABELS:
+ {
+ if( aValue.equals( ::xmloff::token::GetXMLToken( ::xmloff::token::XML_BOTH )))
+ mrColHasLabels = mrRowHasLabels = sal_True;
+ else if( aValue.equals( ::xmloff::token::GetXMLToken( ::xmloff::token::XML_ROW )))
+ mrRowHasLabels = sal_True;
+ else if( aValue.equals( ::xmloff::token::GetXMLToken( ::xmloff::token::XML_COLUMN )))
+ mrColHasLabels = sal_True;
+ }
+ break;
+ case XML_TOK_PA_TRANSFORM:
+ case XML_TOK_PA_VRP:
+ case XML_TOK_PA_VPN:
+ case XML_TOK_PA_VUP:
+ case XML_TOK_PA_PROJECTION:
+ case XML_TOK_PA_DISTANCE:
+ case XML_TOK_PA_FOCAL_LENGTH:
+ case XML_TOK_PA_SHADOW_SLANT:
+ case XML_TOK_PA_SHADE_MODE:
+ case XML_TOK_PA_AMBIENT_COLOR:
+ case XML_TOK_PA_LIGHTING_MODE:
+ maSceneImportHelper.processSceneAttribute( nPrefix, aLocalName, aValue );
+ break;
+ }
+ }
+
+ if( ! mxNewDoc.is())
+ {
+ uno::Reference< beans::XPropertySet > xDocProp( mrImportHelper.GetChartDocument(), uno::UNO_QUERY );
+ if( xDocProp.is())
+ {
+ try
+ {
+ uno::Any aAny;
+ aAny <<= (sal_Bool)(mrColHasLabels);
+ xDocProp->setPropertyValue(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DataSourceLabelsInFirstColumn" )),
+ aAny );
+
+ aAny <<= (sal_Bool)(mrRowHasLabels);
+ xDocProp->setPropertyValue(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DataSourceLabelsInFirstRow" )),
+ aAny );
+ }
+ catch( beans::UnknownPropertyException & )
+ {
+ DBG_ERRORFILE( "Properties missing" );
+ }
+ }
+ }
+
+ // set properties
+ uno::Reference< beans::XPropertySet > xProp( mxDiagram, uno::UNO_QUERY );
+ if( msAutoStyleName.getLength())
+ {
+ if( xProp.is())
+ {
+ const SvXMLStylesContext* pStylesCtxt = mrImportHelper.GetAutoStylesContext();
+ if( pStylesCtxt )
+ {
+ const SvXMLStyleContext* pStyle = pStylesCtxt->FindStyleChildContext(
+ mrImportHelper.GetChartFamilyID(), msAutoStyleName );
+
+ XMLPropStyleContext* pPropStyleContext =
+ const_cast< XMLPropStyleContext * >(
+ dynamic_cast< const XMLPropStyleContext * >( pStyle ) );
+ if( pPropStyleContext )
+ {
+ pPropStyleContext->FillPropertySet( xProp );
+
+ // get the data row source that was set without having data
+ xProp->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DataRowSource" )))
+ >>= mrDataRowSource;
+
+ //lines on/off
+ //this old property is not supported fully anymore with the new chart, so we need to get the information a little bit different from similar properties
+ mrSeriesDefaultsAndStyles.maLinesOnProperty = SchXMLTools::getPropertyFromContext(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Lines")), pPropStyleContext, pStylesCtxt );
+
+ //handle automatic position and size
+ m_aOuterPositioning.readAutomaticPositioningProperties( pPropStyleContext, pStylesCtxt );
+
+ //correct default starting angle for old 3D pies
+ if( SchXMLTools::isDocumentGeneratedWithOpenOfficeOlderThan3_0( GetImport().GetModel() ) )
+ {
+ bool bIs3d = false;
+ if( xProp.is() && ( xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Dim3D"))) >>= bIs3d ) &&
+ bIs3d )
+ {
+ if( maChartTypeServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.chart2.PieChartType" ))
+ || maChartTypeServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.chart2.DonutChartType" )) )
+ {
+ ::rtl::OUString aPropName( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StartingAngle")) );
+ uno::Any aAStartingAngle( SchXMLTools::getPropertyFromContext( aPropName, pPropStyleContext, pStylesCtxt ) );
+ if( !aAStartingAngle.hasValue() )
+ xProp->setPropertyValue( aPropName, uno::makeAny(sal_Int32(0)) ) ;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ //remember default values for dataseries
+ if(xProp.is())
+ try
+ {
+ mrSeriesDefaultsAndStyles.maSymbolTypeDefault = xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SymbolType")));
+ mrSeriesDefaultsAndStyles.maDataCaptionDefault = xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataCaption")));
+
+ mrSeriesDefaultsAndStyles.maErrorIndicatorDefault = xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ErrorIndicator")));
+ mrSeriesDefaultsAndStyles.maErrorCategoryDefault = xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ErrorCategory")));
+ mrSeriesDefaultsAndStyles.maConstantErrorLowDefault = xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ConstantErrorLow")));
+ mrSeriesDefaultsAndStyles.maConstantErrorHighDefault = xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ConstantErrorHigh")));
+ mrSeriesDefaultsAndStyles.maPercentageErrorDefault = xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PercentageError")));
+ mrSeriesDefaultsAndStyles.maErrorMarginDefault = xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ErrorMargin")));
+
+ mrSeriesDefaultsAndStyles.maMeanValueDefault = xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MeanValue")));
+ mrSeriesDefaultsAndStyles.maRegressionCurvesDefault = xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RegressionCurves")));
+
+ bool bStacked = false;
+ mrSeriesDefaultsAndStyles.maStackedDefault = xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Stacked")));
+ mrSeriesDefaultsAndStyles.maStackedDefault >>= bStacked;
+ mrSeriesDefaultsAndStyles.maPercentDefault = xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Percent")));
+ mrSeriesDefaultsAndStyles.maPercentDefault >>= mbPercentStacked;
+ mrSeriesDefaultsAndStyles.maStackedBarsConnectedDefault = xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StackedBarsConnected")));
+
+ // deep
+ uno::Any aDeepProperty( xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Deep"))));
+ // #124488# old versions store a 3d area and 3D line deep chart with Deep==false => workaround for this
+ if( ! (bStacked || mbPercentStacked ))
+ {
+ if( SchXMLTools::isDocumentGeneratedWithOpenOfficeOlderThan2_3( GetImport().GetModel() ) )
+ {
+ bool bIs3d = false;
+ if( ( xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Dim3D"))) >>= bIs3d ) &&
+ bIs3d )
+ {
+ if( maChartTypeServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.chart2.AreaChartType" )) ||
+ maChartTypeServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.chart2.LineChartType" )) )
+ {
+ aDeepProperty <<= uno::makeAny( true );
+ }
+ }
+ }
+ }
+ mrSeriesDefaultsAndStyles.maDeepDefault = aDeepProperty;
+
+ xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NumberOfLines"))) >>= mnNumOfLinesProp;
+ xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Volume"))) >>= mbStockHasVolume;
+ }
+ catch( uno::Exception & rEx )
+ {
+#ifdef DBG_UTIL
+ String aStr( rEx.Message );
+ ByteString aBStr( aStr, RTL_TEXTENCODING_ASCII_US );
+ OSL_TRACE( "PlotAreaContext:EndElement(): Exception caught: %s", aBStr.GetBuffer());
+#else
+ (void)rEx; // avoid warning for pro build
+#endif
+ }
+ //
+
+ bool bCreateInternalDataProvider = false;
+ if( m_rXLinkHRefAttributeToIndicateDataProvider.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "." ) ) ) //data comes from the chart itself
+ bCreateInternalDataProvider = true;
+ else if( m_rXLinkHRefAttributeToIndicateDataProvider.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ".." ) ) ) //data comes from the parent application
+ bCreateInternalDataProvider = false;
+ else if( m_rXLinkHRefAttributeToIndicateDataProvider.getLength() ) //not supported so far to get the data by sibling objects -> fall back to chart itself
+ bCreateInternalDataProvider = true;
+ else if( !m_rbHasRangeAtPlotArea )
+ bCreateInternalDataProvider = true;
+
+ if( bCreateInternalDataProvider && mxNewDoc.is() )
+ {
+ // we have no complete range => we have own data, so switch the data
+ // provider to internal. Clone is not necessary, as we don't have any
+ // data yet.
+ mxNewDoc->createInternalDataProvider( false /* bCloneExistingData */ );
+ if( xProp.is() && mrDataRowSource!=chart::ChartDataRowSource_COLUMNS )
+ xProp->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DataRowSource" )), uno::makeAny(mrDataRowSource) );
+ }
+}
+
+SvXMLImportContext* SchXMLPlotAreaContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ SvXMLImportContext* pContext = 0;
+ const SvXMLTokenMap& rTokenMap = mrImportHelper.GetPlotAreaElemTokenMap();
+
+ switch( rTokenMap.Get( nPrefix, rLocalName ))
+ {
+ case XML_TOK_PA_COORDINATE_REGION_EXT:
+ case XML_TOK_PA_COORDINATE_REGION:
+ {
+ pContext = new SchXMLCoordinateRegionContext( GetImport(), nPrefix, rLocalName, m_aInnerPositioning );
+ }
+ break;
+
+ case XML_TOK_PA_AXIS:
+ {
+ bool bAddMissingXAxisForNetCharts = false;
+ bool bAdaptWrongPercentScaleValues = false;
+ if( SchXMLTools::isDocumentGeneratedWithOpenOfficeOlderThan2_3( GetImport().GetModel() ) )
+ {
+ //correct errors from older versions
+
+ // for NetCharts there were no xAxis exported to older files
+ // so we need to add the x axis here for those old NetChart files
+ if( maChartTypeServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.chart2.NetChartType" )) )
+ bAddMissingXAxisForNetCharts = true;
+
+ //Issue 59288
+ if( mbPercentStacked )
+ bAdaptWrongPercentScaleValues = true;
+ }
+
+ bool bAdaptXAxisOrientationForOld2DBarCharts = false;
+ if( SchXMLTools::isDocumentGeneratedWithOpenOfficeOlderThan2_4( GetImport().GetModel() ) )
+ {
+ //issue74660
+ if( maChartTypeServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.chart2.ColumnChartType" )) )
+ bAdaptXAxisOrientationForOld2DBarCharts = true;
+ }
+
+ pContext = new SchXMLAxisContext( mrImportHelper, GetImport(), rLocalName, mxDiagram, maAxes, mrCategoriesAddress,
+ bAddMissingXAxisForNetCharts, bAdaptWrongPercentScaleValues, bAdaptXAxisOrientationForOld2DBarCharts, m_bAxisPositionAttributeImported );
+ }
+ break;
+
+ case XML_TOK_PA_SERIES:
+ {
+ if( mxNewDoc.is())
+ {
+ pContext = new SchXMLSeries2Context(
+ mrImportHelper, GetImport(), rLocalName,
+ mxNewDoc, maAxes,
+ mrSeriesDefaultsAndStyles.maSeriesStyleList,
+ mnSeries,
+ mbStockHasVolume,
+ m_aGlobalSeriesImportInfo,
+ maChartTypeServiceName,
+ mrLSequencesPerIndex,
+ mbGlobalChartTypeUsedBySeries, maChartSize );
+ }
+ mnSeries++;
+ }
+ break;
+
+ case XML_TOK_PA_WALL:
+ pContext = new SchXMLWallFloorContext( mrImportHelper, GetImport(), nPrefix, rLocalName, mxDiagram,
+ SchXMLWallFloorContext::CONTEXT_TYPE_WALL );
+ break;
+ case XML_TOK_PA_FLOOR:
+ pContext = new SchXMLWallFloorContext( mrImportHelper, GetImport(), nPrefix, rLocalName, mxDiagram,
+ SchXMLWallFloorContext::CONTEXT_TYPE_FLOOR );
+ break;
+
+ case XML_TOK_PA_LIGHT_SOURCE:
+ pContext = maSceneImportHelper.create3DLightContext( nPrefix, rLocalName, xAttrList );
+ break;
+
+ // elements for stock charts
+ case XML_TOK_PA_STOCK_GAIN:
+ pContext = new SchXMLStockContext( mrImportHelper, GetImport(), nPrefix, rLocalName, mxDiagram,
+ SchXMLStockContext::CONTEXT_TYPE_GAIN );
+ break;
+ case XML_TOK_PA_STOCK_LOSS:
+ pContext = new SchXMLStockContext( mrImportHelper, GetImport(), nPrefix, rLocalName, mxDiagram,
+ SchXMLStockContext::CONTEXT_TYPE_LOSS );
+ break;
+ case XML_TOK_PA_STOCK_RANGE:
+ pContext = new SchXMLStockContext( mrImportHelper, GetImport(), nPrefix, rLocalName, mxDiagram,
+ SchXMLStockContext::CONTEXT_TYPE_RANGE );
+ break;
+
+ default:
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+ }
+
+ return pContext;
+}
+
+void SchXMLPlotAreaContext::EndElement()
+{
+ // set categories
+ if( mrCategoriesAddress.getLength() && mxNewDoc.is())
+ {
+ uno::Reference< chart2::data::XDataProvider > xDataProvider(
+ mxNewDoc->getDataProvider() );
+ // @todo: correct coordinate system index
+ sal_Int32 nDimension( 0 );
+ ::std::vector< SchXMLAxis >::const_iterator aIt(
+ ::std::find_if( maAxes.begin(), maAxes.end(), lcl_AxisHasCategories()));
+ if( aIt != maAxes.end())
+ nDimension = static_cast< sal_Int32 >( (*aIt).eDimension );
+ SchXMLTools::CreateCategories(
+ xDataProvider, mxNewDoc, mrCategoriesAddress,
+ 0 /* nCooSysIndex */,
+ nDimension, &mrLSequencesPerIndex );
+ }
+
+ uno::Reference< beans::XPropertySet > xDiaProp( mxDiagram, uno::UNO_QUERY );
+ if( xDiaProp.is())
+ {
+ sal_Bool bIsThreeDim = sal_False;
+ uno::Any aAny = xDiaProp->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Dim3D" )));
+ aAny >>= bIsThreeDim;
+
+ // set 3d scene attributes
+ if( bIsThreeDim )
+ {
+ // set scene attributes at diagram
+ maSceneImportHelper.setSceneAttributes( xDiaProp );
+ }
+
+ // set correct number of lines at series
+ if( ! m_aGlobalSeriesImportInfo.rbAllRangeAddressesAvailable &&
+ mnNumOfLinesProp > 0 &&
+ maChartTypeServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.chart2.ColumnChartType" )))
+ {
+ try
+ {
+ xDiaProp->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "NumberOfLines" )),
+ uno::makeAny( mnNumOfLinesProp ));
+ }
+ catch( uno::Exception & rEx )
+ {
+#ifdef DBG_UTIL
+ String aStr( rEx.Message );
+ ByteString aBStr( aStr, RTL_TEXTENCODING_ASCII_US );
+ OSL_TRACE( "Exception caught for property NumberOfLines: %s", aBStr.GetBuffer());
+#else
+ (void)rEx; // avoid warning for pro build
+#endif
+ }
+ }
+
+ // #i32366# stock has volume
+ if( ( 0 == mxDiagram->getDiagramType().reverseCompareToAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "com.sun.star.chart.StockDiagram" ))) &&
+ mbStockHasVolume )
+ {
+ try
+ {
+ xDiaProp->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Volume" )),
+ uno::makeAny( true ));
+ }
+ catch( uno::Exception & rEx )
+ {
+#ifdef DBG_UTIL
+ String aStr( rEx.Message );
+ ByteString aBStr( aStr, RTL_TEXTENCODING_ASCII_US );
+ OSL_TRACE( "Exception caught for property Volume: %s", aBStr.GetBuffer());
+#else
+ (void)rEx; // avoid warning for pro build
+#endif
+ }
+ }
+ }
+
+ // set changed size and position after properties (esp. 3d)
+
+ uno::Reference< chart::XDiagramPositioning > xDiaPos( mxDiagram, uno::UNO_QUERY );
+ if( xDiaPos.is())
+ {
+ if( !m_aOuterPositioning.isAutomatic() )
+ {
+ if( m_aInnerPositioning.hasPosSize() )
+ xDiaPos->setDiagramPositionExcludingAxes( m_aInnerPositioning.getRectangle() );
+ else if( m_aOuterPositioning.hasPosSize() )
+ {
+ if( SchXMLTools::isDocumentGeneratedWithOpenOfficeOlderThan3_3( GetImport().GetModel() ) ) //old version of OOo did write a wrong rectangle for the diagram size
+ xDiaPos->setDiagramPositionIncludingAxesAndAxisTitles( m_aOuterPositioning.getRectangle() );
+ else
+ xDiaPos->setDiagramPositionIncludingAxes( m_aOuterPositioning.getRectangle() );
+ }
+ }
+ }
+
+ SchXMLAxisContext::CorrectAxisPositions( uno::Reference< chart2::XChartDocument >( mrImportHelper.GetChartDocument(), uno::UNO_QUERY ), maChartTypeServiceName, GetImport().GetODFVersion(), m_bAxisPositionAttributeImported );
+}
+
+// ========================================
+
+SchXMLDataPointContext::SchXMLDataPointContext( SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport, const rtl::OUString& rLocalName,
+ ::std::list< DataRowPointStyle >& rStyleList,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >& xSeries,
+ sal_Int32& rIndex,
+ bool bSymbolSizeForSeriesIsMissingInFile ) :
+ SvXMLImportContext( rImport, XML_NAMESPACE_CHART, rLocalName ),
+ mrImportHelper( rImpHelper ),
+ mrStyleList( rStyleList ),
+ m_xSeries( xSeries ),
+ mrIndex( rIndex ),
+ mbSymbolSizeForSeriesIsMissingInFile( bSymbolSizeForSeriesIsMissingInFile )
+{
+}
+
+SchXMLDataPointContext::~SchXMLDataPointContext()
+{
+}
+
+void SchXMLDataPointContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
+ ::rtl::OUString aValue;
+ ::rtl::OUString sAutoStyleName;
+ sal_Int32 nRepeat = 1;
+
+ for( sal_Int16 i = 0; i < nAttrCount; i++ )
+ {
+ rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
+ rtl::OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+
+ if( nPrefix == XML_NAMESPACE_CHART )
+ {
+ if( IsXMLToken( aLocalName, XML_STYLE_NAME ) )
+ sAutoStyleName = xAttrList->getValueByIndex( i );
+ else if( IsXMLToken( aLocalName, XML_REPEATED ) )
+ nRepeat = xAttrList->getValueByIndex( i ).toInt32();
+ }
+ }
+
+ if( sAutoStyleName.getLength())
+ {
+ DataRowPointStyle aStyle(
+ DataRowPointStyle::DATA_POINT,
+ m_xSeries, mrIndex, nRepeat, sAutoStyleName );
+ aStyle.mbSymbolSizeForSeriesIsMissingInFile = mbSymbolSizeForSeriesIsMissingInFile;
+ mrStyleList.push_back( aStyle );
+ }
+ mrIndex += nRepeat;
+}
+
+// ========================================
+
+SchXMLPositonAttributesHelper::SchXMLPositonAttributesHelper( SvXMLImport& rImporter )
+ : m_rImport( rImporter )
+ , m_aPosition(0,0)
+ , m_aSize(0,0)
+ , m_bHasSizeWidth( false )
+ , m_bHasSizeHeight( false )
+ , m_bHasPositionX( false )
+ , m_bHasPositionY( false )
+ , m_bAutoSize( false )
+ , m_bAutoPosition( false )
+{
+}
+
+SchXMLPositonAttributesHelper::~SchXMLPositonAttributesHelper()
+{
+}
+
+bool SchXMLPositonAttributesHelper::hasSize() const
+{
+ return m_bHasSizeWidth && m_bHasSizeHeight;
+}
+bool SchXMLPositonAttributesHelper::hasPosition() const
+{
+ return m_bHasPositionX && m_bHasPositionY;
+}
+bool SchXMLPositonAttributesHelper::hasPosSize() const
+{
+ return hasPosition() && hasSize();
+}
+bool SchXMLPositonAttributesHelper::isAutomatic() const
+{
+ return m_bAutoSize || m_bAutoPosition;
+}
+awt::Point SchXMLPositonAttributesHelper::getPosition() const
+{
+ return m_aPosition;
+}
+awt::Size SchXMLPositonAttributesHelper::getSize() const
+{
+ return m_aSize;
+}
+awt::Rectangle SchXMLPositonAttributesHelper::getRectangle() const
+{
+ return awt::Rectangle( m_aPosition.X, m_aPosition.Y, m_aSize.Width, m_aSize.Height );
+}
+
+bool SchXMLPositonAttributesHelper::readPositioningAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ //returns true if the attribute was proccessed
+ bool bReturn = true;
+
+ if( XML_NAMESPACE_SVG == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_X ) )
+ {
+ m_rImport.GetMM100UnitConverter().convertMeasure( m_aPosition.X, rValue );
+ m_bHasPositionX = true;
+ }
+ else if( IsXMLToken( rLocalName, XML_Y ) )
+ {
+ m_rImport.GetMM100UnitConverter().convertMeasure( m_aPosition.Y, rValue );
+ m_bHasPositionY = true;
+ }
+ else if( IsXMLToken( rLocalName, XML_WIDTH ) )
+ {
+ m_rImport.GetMM100UnitConverter().convertMeasure( m_aSize.Width, rValue );
+ m_bHasSizeWidth = true;
+ }
+ else if( IsXMLToken( rLocalName, XML_HEIGHT ) )
+ {
+ m_rImport.GetMM100UnitConverter().convertMeasure( m_aSize.Height, rValue );
+ m_bHasSizeHeight = true;
+ }
+ else
+ bReturn = false;
+ }
+ else
+ bReturn = false;
+
+ return bReturn;
+}
+
+
+void SchXMLPositonAttributesHelper::readAutomaticPositioningProperties( XMLPropStyleContext* pPropStyleContext, const SvXMLStylesContext* pStylesCtxt )
+{
+ if( pPropStyleContext && pStylesCtxt )
+ {
+ //handle automatic position and size
+ SchXMLTools::getPropertyFromContext(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AutomaticSize")), pPropStyleContext, pStylesCtxt ) >>= m_bAutoSize;
+ SchXMLTools::getPropertyFromContext(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AutomaticPosition")), pPropStyleContext, pStylesCtxt ) >>= m_bAutoPosition;
+ }
+}
+
+// ========================================
+
+SchXMLCoordinateRegionContext::SchXMLCoordinateRegionContext(
+ SvXMLImport& rImport
+ , sal_uInt16 nPrefix
+ , const rtl::OUString& rLocalName
+ , SchXMLPositonAttributesHelper& rPositioning )
+ : SvXMLImportContext( rImport, nPrefix, rLocalName )
+ , m_rPositioning( rPositioning )
+{
+}
+
+SchXMLCoordinateRegionContext::~SchXMLCoordinateRegionContext()
+{
+}
+
+void SchXMLCoordinateRegionContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ // parse attributes
+ sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
+
+ for( sal_Int16 i = 0; i < nAttrCount; i++ )
+ {
+ rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
+ rtl::OUString aLocalName;
+ rtl::OUString aValue = xAttrList->getValueByIndex( i );
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ m_rPositioning.readPositioningAttribute( nPrefix, aLocalName, aValue );
+ }
+}
+
+// ========================================
+
+SchXMLWallFloorContext::SchXMLWallFloorContext(
+ SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ uno::Reference< chart::XDiagram >& xDiagram,
+ ContextType eContextType ) :
+ SvXMLImportContext( rImport, nPrefix, rLocalName ),
+ mrImportHelper( rImpHelper ),
+ mxWallFloorSupplier( xDiagram, uno::UNO_QUERY ),
+ meContextType( eContextType )
+{
+}
+
+SchXMLWallFloorContext::~SchXMLWallFloorContext()
+{
+}
+
+void SchXMLWallFloorContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ if( mxWallFloorSupplier.is())
+ {
+ sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
+ rtl::OUString sAutoStyleName;
+
+ for( sal_Int16 i = 0; i < nAttrCount; i++ )
+ {
+ rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
+ rtl::OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+
+ if( nPrefix == XML_NAMESPACE_CHART &&
+ IsXMLToken( aLocalName, XML_STYLE_NAME ) )
+ {
+ sAutoStyleName = xAttrList->getValueByIndex( i );
+ }
+ }
+
+ // set properties
+ uno::Reference< beans::XPropertySet > xProp( ( meContextType == CONTEXT_TYPE_WALL )
+ ? mxWallFloorSupplier->getWall()
+ : mxWallFloorSupplier->getFloor(),
+ uno::UNO_QUERY );
+ if( xProp.is())
+ {
+ if( sAutoStyleName.getLength())
+ {
+ const SvXMLStylesContext* pStylesCtxt = mrImportHelper.GetAutoStylesContext();
+ if( pStylesCtxt )
+ {
+ const SvXMLStyleContext* pStyle = pStylesCtxt->FindStyleChildContext(
+ mrImportHelper.GetChartFamilyID(), sAutoStyleName );
+
+ if( pStyle && pStyle->ISA( XMLPropStyleContext ))
+ (( XMLPropStyleContext* )pStyle )->FillPropertySet( xProp );
+ }
+ }
+ }
+ }
+}
+
+// ========================================
+
+SchXMLStockContext::SchXMLStockContext(
+ SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ uno::Reference< chart::XDiagram >& xDiagram,
+ ContextType eContextType ) :
+ SvXMLImportContext( rImport, nPrefix, rLocalName ),
+ mrImportHelper( rImpHelper ),
+ mxStockPropProvider( xDiagram, uno::UNO_QUERY ),
+ meContextType( eContextType )
+{
+}
+
+SchXMLStockContext::~SchXMLStockContext()
+{
+}
+
+void SchXMLStockContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ if( mxStockPropProvider.is())
+ {
+ sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
+ rtl::OUString sAutoStyleName;
+
+ for( sal_Int16 i = 0; i < nAttrCount; i++ )
+ {
+ rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
+ rtl::OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+
+ if( nPrefix == XML_NAMESPACE_CHART &&
+ IsXMLToken( aLocalName, XML_STYLE_NAME ) )
+ {
+ sAutoStyleName = xAttrList->getValueByIndex( i );
+ }
+ }
+
+ if( sAutoStyleName.getLength())
+ {
+ // set properties
+ uno::Reference< beans::XPropertySet > xProp;
+ switch( meContextType )
+ {
+ case CONTEXT_TYPE_GAIN:
+ xProp = mxStockPropProvider->getUpBar();
+ break;
+ case CONTEXT_TYPE_LOSS:
+ xProp = mxStockPropProvider->getDownBar();
+ break;
+ case CONTEXT_TYPE_RANGE:
+ xProp = mxStockPropProvider->getMinMaxLine();
+ break;
+ }
+ if( xProp.is())
+ {
+ const SvXMLStylesContext* pStylesCtxt = mrImportHelper.GetAutoStylesContext();
+ if( pStylesCtxt )
+ {
+ const SvXMLStyleContext* pStyle = pStylesCtxt->FindStyleChildContext(
+ mrImportHelper.GetChartFamilyID(), sAutoStyleName );
+
+ if( pStyle && pStyle->ISA( XMLPropStyleContext ))
+ (( XMLPropStyleContext* )pStyle )->FillPropertySet( xProp );
+ }
+ }
+ }
+ }
+}
+
+// ========================================
+
+SchXMLStatisticsObjectContext::SchXMLStatisticsObjectContext(
+
+ SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ ::std::list< DataRowPointStyle >& rStyleList,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >& xSeries,
+ ContextType eContextType,
+ const awt::Size & rChartSize ) :
+
+ SvXMLImportContext( rImport, nPrefix, rLocalName ),
+ mrImportHelper( rImpHelper ),
+ mrStyleList( rStyleList ),
+ m_xSeries( xSeries ),
+ meContextType( eContextType ),
+ maChartSize( rChartSize )
+{}
+
+SchXMLStatisticsObjectContext::~SchXMLStatisticsObjectContext()
+{
+}
+
+void SchXMLStatisticsObjectContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
+ ::rtl::OUString aValue;
+ ::rtl::OUString sAutoStyleName;
+
+ for( sal_Int16 i = 0; i < nAttrCount; i++ )
+ {
+ rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
+ rtl::OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+
+ if( nPrefix == XML_NAMESPACE_CHART )
+ {
+ if( IsXMLToken( aLocalName, XML_STYLE_NAME ) )
+ sAutoStyleName = xAttrList->getValueByIndex( i );
+ }
+ }
+
+ // note: regression-curves must get a style-object even if there is no
+ // auto-style set, because they can contain an equation
+ if( sAutoStyleName.getLength() || meContextType == CONTEXT_TYPE_REGRESSION_CURVE )
+ {
+ DataRowPointStyle::StyleType eType = DataRowPointStyle::MEAN_VALUE;
+ switch( meContextType )
+ {
+ case CONTEXT_TYPE_MEAN_VALUE_LINE:
+ eType = DataRowPointStyle::MEAN_VALUE;
+ break;
+ case CONTEXT_TYPE_REGRESSION_CURVE:
+ eType = DataRowPointStyle::REGRESSION;
+ break;
+ case CONTEXT_TYPE_ERROR_INDICATOR:
+ eType = DataRowPointStyle::ERROR_INDICATOR;
+ break;
+ }
+ DataRowPointStyle aStyle(
+ eType, m_xSeries, -1, 1, sAutoStyleName );
+ mrStyleList.push_back( aStyle );
+ }
+}
+
+SvXMLImportContext* SchXMLStatisticsObjectContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ SvXMLImportContext* pContext = 0;
+
+ if( nPrefix == XML_NAMESPACE_CHART &&
+ IsXMLToken( rLocalName, XML_EQUATION ) )
+ {
+ pContext = new SchXMLEquationContext(
+ mrImportHelper, GetImport(), nPrefix, rLocalName, m_xSeries, maChartSize, mrStyleList.back());
+ }
+ else
+ {
+ pContext = SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList );
+ }
+
+ return pContext;
+}
+
+// ========================================
+
+SchXMLEquationContext::SchXMLEquationContext(
+ SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >& xSeries,
+ const awt::Size & rChartSize,
+ DataRowPointStyle & rRegressionStyle ) :
+ SvXMLImportContext( rImport, nPrefix, rLocalName ),
+ mrImportHelper( rImpHelper ),
+ mrRegressionStyle( rRegressionStyle ),
+ m_xSeries( xSeries ),
+ maChartSize( rChartSize )
+{}
+
+SchXMLEquationContext::~SchXMLEquationContext()
+{}
+
+void SchXMLEquationContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ // parse attributes
+ sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
+ SchXMLImport& rImport = ( SchXMLImport& )GetImport();
+ const SvXMLTokenMap& rAttrTokenMap = mrImportHelper.GetRegEquationAttrTokenMap();
+ OUString sAutoStyleName;
+
+ bool bShowEquation = true;
+ bool bShowRSquare = false;
+ awt::Point aPosition;
+ bool bHasXPos = false;
+ bool bHasYPos = false;
+
+ for( sal_Int16 i = 0; i < nAttrCount; i++ )
+ {
+ rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
+ rtl::OUString aLocalName;
+ rtl::OUString aValue = xAttrList->getValueByIndex( i );
+ sal_uInt16 nPrefix = rImport.GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+
+ switch( rAttrTokenMap.Get( nPrefix, aLocalName ))
+ {
+ case XML_TOK_REGEQ_POS_X:
+ rImport.GetMM100UnitConverter().convertMeasure( aPosition.X, aValue );
+ bHasXPos = true;
+ break;
+ case XML_TOK_REGEQ_POS_Y:
+ rImport.GetMM100UnitConverter().convertMeasure( aPosition.Y, aValue );
+ bHasYPos = true;
+ break;
+ case XML_TOK_REGEQ_DISPLAY_EQUATION:
+ rImport.GetMM100UnitConverter().convertBool( bShowEquation, aValue );
+ break;
+ case XML_TOK_REGEQ_DISPLAY_R_SQUARE:
+ rImport.GetMM100UnitConverter().convertBool( bShowRSquare, aValue );
+ break;
+ case XML_TOK_REGEQ_STYLE_NAME:
+ sAutoStyleName = aValue;
+ break;
+ }
+ }
+
+ if( sAutoStyleName.getLength() || bShowEquation || bShowRSquare )
+ {
+ uno::Reference< beans::XPropertySet > xEqProp;
+ uno::Reference< lang::XMultiServiceFactory > xFact( comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
+ if( xFact.is())
+ xEqProp.set( xFact->createInstance(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.RegressionEquation" ))), uno::UNO_QUERY );
+ if( xEqProp.is())
+ {
+ if( sAutoStyleName.getLength() )
+ {
+ const SvXMLStylesContext* pStylesCtxt = mrImportHelper.GetAutoStylesContext();
+ if( pStylesCtxt )
+ {
+ const SvXMLStyleContext* pStyle = pStylesCtxt->FindStyleChildContext(
+ mrImportHelper.GetChartFamilyID(), sAutoStyleName );
+ // note: SvXMLStyleContext::FillPropertySet is not const
+ XMLPropStyleContext * pPropStyleContext =
+ const_cast< XMLPropStyleContext * >( dynamic_cast< const XMLPropStyleContext * >( pStyle ));
+
+ if( pPropStyleContext )
+ pPropStyleContext->FillPropertySet( xEqProp );
+ }
+ }
+ xEqProp->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowEquation")), uno::makeAny( bShowEquation ));
+ xEqProp->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowCorrelationCoefficient")), uno::makeAny( bShowRSquare ));
+
+ if( bHasXPos && bHasYPos )
+ {
+ chart2::RelativePosition aRelPos;
+ aRelPos.Primary = static_cast< double >( aPosition.X ) / static_cast< double >( maChartSize.Width );
+ aRelPos.Secondary = static_cast< double >( aPosition.Y ) / static_cast< double >( maChartSize.Height );
+ xEqProp->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "RelativePosition" )),
+ uno::makeAny( aRelPos ));
+ }
+ OSL_ASSERT( mrRegressionStyle.meType == DataRowPointStyle::REGRESSION );
+ mrRegressionStyle.m_xEquationProperties.set( xEqProp );
+ }
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.hxx b/xmloff/source/chart/SchXMLPlotAreaContext.hxx
new file mode 100644
index 000000000000..0f71542e2074
--- /dev/null
+++ b/xmloff/source/chart/SchXMLPlotAreaContext.hxx
@@ -0,0 +1,333 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _SCH_XMLPLOTAREACONTEXT_HXX_
+#define _SCH_XMLPLOTAREACONTEXT_HXX_
+
+#include "SchXMLImport.hxx"
+#include "SchXMLChartContext.hxx"
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/shapeimport.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/chart/ChartSeriesAddress.hpp>
+#include <com/sun/star/chart/ChartDataRowSource.hpp>
+
+#include "transporttypes.hxx"
+
+class SvXMLImport;
+
+namespace com { namespace sun { namespace star {
+ namespace chart {
+ class XDiagram;
+ class X3DDisplay;
+ class XStatisticDisplay;
+ }
+ namespace chart2 {
+ class XChartDocument;
+ }
+ namespace xml { namespace sax {
+ class XAttributeList;
+}}}}}
+
+// ----------------------------------------
+
+class SchXML3DSceneAttributesHelper : public SdXML3DSceneAttributesHelper
+{
+public:
+ SchXML3DSceneAttributesHelper( SvXMLImport& rImporter );
+ virtual ~SchXML3DSceneAttributesHelper();
+
+ void getCameraDefaultFromDiagram( const ::com::sun::star::uno::Reference< com::sun::star::chart::XDiagram >& xDiagram );
+
+private:
+ SchXML3DSceneAttributesHelper();
+};
+
+// ----------------------------------------
+
+class SchXMLPositonAttributesHelper
+{
+public:
+ SchXMLPositonAttributesHelper( SvXMLImport& rImporter );
+ ~SchXMLPositonAttributesHelper();
+
+ bool readPositioningAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+ void readAutomaticPositioningProperties( XMLPropStyleContext* pPropStyleContext, const SvXMLStylesContext* pStylesCtxt );
+
+ bool hasPosSize() const;
+ bool isAutomatic() const;
+ ::com::sun::star::awt::Rectangle getRectangle() const;
+
+
+private:
+ bool hasSize() const;
+ bool hasPosition() const;
+ ::com::sun::star::awt::Size getSize() const;
+ ::com::sun::star::awt::Point getPosition() const;
+
+ SvXMLImport& m_rImport;
+
+ ::com::sun::star::awt::Point m_aPosition;
+ ::com::sun::star::awt::Size m_aSize;
+
+ bool m_bHasSizeWidth;
+ bool m_bHasSizeHeight;
+ bool m_bHasPositionX;
+ bool m_bHasPositionY;
+ sal_Bool m_bAutoSize;
+ sal_Bool m_bAutoPosition;
+};
+
+// ----------------------------------------
+
+class SchXMLPlotAreaContext : public SvXMLImportContext
+{
+public:
+ SchXMLPlotAreaContext( SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport, const rtl::OUString& rLocalName,
+ const rtl::OUString& rXLinkHRefAttributeToIndicateDataProvider,
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::chart::ChartSeriesAddress >& rSeriesAddresses,
+ ::rtl::OUString& rCategoriesAddress,
+ ::rtl::OUString& rChartAddress,
+ bool& bHasRangeAtPlotArea,
+ sal_Bool & rAllRangeAddressesAvailable,
+ sal_Bool & rColHasLabels,
+ sal_Bool & rRowHasLabels,
+ ::com::sun::star::chart::ChartDataRowSource & rDataRowSource,
+ SeriesDefaultsAndStyles& rSeriesDefaultsAndStyles,
+ const ::rtl::OUString& aChartTypeServiceName,
+ tSchXMLLSequencesPerIndex & rLSequencesPerIndex,
+ const ::com::sun::star::awt::Size & rChartSize );
+ virtual ~SchXMLPlotAreaContext();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+
+private:
+ SchXMLImportHelper& mrImportHelper;
+ ::com::sun::star::uno::Reference< com::sun::star::chart::XDiagram > mxDiagram;
+ ::com::sun::star::uno::Reference< com::sun::star::chart2::XChartDocument > mxNewDoc;
+ ::std::vector< SchXMLAxis > maAxes;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::chart::ChartSeriesAddress >& mrSeriesAddresses;
+ rtl::OUString& mrCategoriesAddress;
+ SeriesDefaultsAndStyles& mrSeriesDefaultsAndStyles;
+ sal_Int32 mnNumOfLinesProp;
+ sal_Bool mbStockHasVolume;
+ sal_Int32 mnSeries;
+ GlobalSeriesImportInfo m_aGlobalSeriesImportInfo;
+
+ SchXML3DSceneAttributesHelper maSceneImportHelper;
+ SchXMLPositonAttributesHelper m_aOuterPositioning;//including axes and axes titles
+ SchXMLPositonAttributesHelper m_aInnerPositioning;//excluding axes and axes titles
+ bool mbPercentStacked;
+ bool m_bAxisPositionAttributeImported;
+ ::rtl::OUString msAutoStyleName;
+ const ::rtl::OUString& m_rXLinkHRefAttributeToIndicateDataProvider;
+ ::rtl::OUString& mrChartAddress;
+ bool& m_rbHasRangeAtPlotArea;
+ sal_Bool & mrColHasLabels;
+ sal_Bool & mrRowHasLabels;
+ ::com::sun::star::chart::ChartDataRowSource & mrDataRowSource;
+ ::rtl::OUString maChartTypeServiceName;
+
+ tSchXMLLSequencesPerIndex & mrLSequencesPerIndex;
+
+ bool mbGlobalChartTypeUsedBySeries;
+ ::com::sun::star::awt::Size maChartSize;
+};
+
+//----------------------------------------
+
+class SchXMLDataPointContext : public SvXMLImportContext
+{
+private:
+ SchXMLImportHelper& mrImportHelper;
+ ::std::list< DataRowPointStyle >& mrStyleList;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > m_xSeries;
+ sal_Int32& mrIndex;
+ bool mbSymbolSizeForSeriesIsMissingInFile;
+
+public:
+ SchXMLDataPointContext( SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport, const rtl::OUString& rLocalName,
+ ::std::list< DataRowPointStyle >& rStyleList,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >& xSeries, sal_Int32& rIndex,
+ bool bSymbolSizeForSeriesIsMissingInFile );
+ virtual ~SchXMLDataPointContext();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+};
+
+// ----------------------------------------
+
+class SchXMLCoordinateRegionContext : public SvXMLImportContext
+{
+public:
+ SchXMLCoordinateRegionContext(
+ SvXMLImport& rImport
+ , sal_uInt16 nPrefix
+ , const rtl::OUString& rLocalName
+ , SchXMLPositonAttributesHelper& rPositioning );
+ virtual ~SchXMLCoordinateRegionContext();
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+private:
+ SchXMLPositonAttributesHelper& m_rPositioning;
+};
+
+// ----------------------------------------
+
+class SchXMLWallFloorContext : public SvXMLImportContext
+{
+public:
+ enum ContextType
+ {
+ CONTEXT_TYPE_WALL,
+ CONTEXT_TYPE_FLOOR
+ };
+
+private:
+ SchXMLImportHelper& mrImportHelper;
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart::X3DDisplay > mxWallFloorSupplier;
+ ContextType meContextType;
+
+public:
+ SchXMLWallFloorContext( SchXMLImportHelper& rImportHelper,
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart::XDiagram >& xDiagram,
+ ContextType eContextType );
+ virtual ~SchXMLWallFloorContext();
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+};
+
+// ----------------------------------------
+
+class SchXMLStockContext : public SvXMLImportContext
+{
+public:
+ enum ContextType
+ {
+ CONTEXT_TYPE_GAIN,
+ CONTEXT_TYPE_LOSS,
+ CONTEXT_TYPE_RANGE
+ };
+
+private:
+ SchXMLImportHelper& mrImportHelper;
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart::XStatisticDisplay > mxStockPropProvider;
+ ContextType meContextType;
+
+public:
+ SchXMLStockContext( SchXMLImportHelper& rImportHelper,
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart::XDiagram >& xDiagram,
+ ContextType eContextType );
+ virtual ~SchXMLStockContext();
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+};
+
+// ----------------------------------------
+
+class SchXMLStatisticsObjectContext : public SvXMLImportContext
+{
+public:
+ enum ContextType
+ {
+ CONTEXT_TYPE_MEAN_VALUE_LINE,
+ CONTEXT_TYPE_REGRESSION_CURVE,
+ CONTEXT_TYPE_ERROR_INDICATOR
+ };
+
+ SchXMLStatisticsObjectContext(
+ SchXMLImportHelper& rImportHelper,
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ ::std::list< DataRowPointStyle >& rStyleList,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >& xSeries,
+ ContextType eContextType,
+ const ::com::sun::star::awt::Size & rChartSize );
+
+ virtual ~SchXMLStatisticsObjectContext();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+private:
+ SchXMLImportHelper & mrImportHelper;
+ ::std::list< DataRowPointStyle > & mrStyleList;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > m_xSeries;
+ ContextType meContextType;
+ ::com::sun::star::awt::Size maChartSize;
+};
+
+// ----------------------------------------
+
+class SchXMLEquationContext : public SvXMLImportContext
+{
+public:
+ SchXMLEquationContext(
+ SchXMLImportHelper& rImportHelper,
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >& xSeries,
+ const ::com::sun::star::awt::Size & rChartSize,
+ DataRowPointStyle & rRegressionStyle );
+
+ virtual ~SchXMLEquationContext();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+private:
+ SchXMLImportHelper & mrImportHelper;
+ DataRowPointStyle & mrRegressionStyle;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > m_xSeries;
+ ::com::sun::star::awt::Size maChartSize;
+};
+
+#endif // _SCH_XMLPLOTAREACONTEXT_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/SchXMLSeries2Context.cxx b/xmloff/source/chart/SchXMLSeries2Context.cxx
new file mode 100644
index 000000000000..db606730354f
--- /dev/null
+++ b/xmloff/source/chart/SchXMLSeries2Context.cxx
@@ -0,0 +1,1079 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "SchXMLSeries2Context.hxx"
+#include "SchXMLPlotAreaContext.hxx"
+#include "SchXMLSeriesHelper.hxx"
+#include "SchXMLTools.hxx"
+#include "PropertyMap.hxx"
+
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/XDataSeries.hpp>
+#include <com/sun/star/chart2/XRegressionCurve.hpp>
+#include <com/sun/star/chart2/data/XDataSink.hpp>
+#include <com/sun/star/chart2/data/XDataReceiver.hpp>
+
+#include <com/sun/star/chart/ChartAxisAssign.hpp>
+#include <com/sun/star/chart/ChartSymbolType.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/chart/ChartLegendPosition.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/embed/Aspects.hpp>
+#include <com/sun/star/embed/XVisualObject.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+// header for define DBG_ERROR1
+#include <tools/debug.hxx>
+#include <rtl/ustrbuf.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "SchXMLImport.hxx"
+// header for class XMLPropStyleContext
+#include <xmloff/prstylei.hxx>
+#include <xmloff/xmlprmap.hxx>
+
+#include <typeinfo>
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+// ================================================================================
+
+namespace
+{
+
+class SchXMLDomain2Context : public SvXMLImportContext
+{
+private:
+ SchXMLImportHelper& mrImportHelper;
+ ::std::vector< OUString > & mrAddresses;
+
+public:
+ SchXMLDomain2Context( SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ ::std::vector< OUString > & rAddresses );
+ virtual ~SchXMLDomain2Context();
+ virtual void StartElement( const Reference< xml::sax::XAttributeList >& xAttrList );
+};
+
+SchXMLDomain2Context::SchXMLDomain2Context(
+ SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ ::std::vector< ::rtl::OUString > & rAddresses ) :
+ SvXMLImportContext( rImport, nPrefix, rLocalName ),
+ mrImportHelper( rImpHelper ),
+ mrAddresses( rAddresses )
+{
+}
+
+SchXMLDomain2Context::~SchXMLDomain2Context()
+{
+}
+
+void SchXMLDomain2Context::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
+
+ for( sal_Int16 i = 0; i < nAttrCount; i++ )
+ {
+ rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
+ rtl::OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+
+ if( nPrefix == XML_NAMESPACE_TABLE &&
+ IsXMLToken( aLocalName, XML_CELL_RANGE_ADDRESS ) )
+ {
+ Reference< chart2::XChartDocument > xNewDoc( GetImport().GetModel(), uno::UNO_QUERY );
+ mrAddresses.push_back( xAttrList->getValueByIndex( i ));
+ }
+ }
+}
+
+void lcl_setAutomaticSymbolSize( const uno::Reference< beans::XPropertySet >& xSeriesOrPointProp, const SvXMLImport& rImport )
+{
+ awt::Size aSymbolSize(140,140);//old default for standard sized charts 7cm height
+
+ double fScale = 1;
+ uno::Reference< chart::XChartDocument > xChartDoc( rImport.GetModel(), uno::UNO_QUERY );
+ if( xChartDoc.is() )
+ {
+ uno::Reference< beans::XPropertySet > xLegendProp( xChartDoc->getLegend(), uno::UNO_QUERY );
+ chart::ChartLegendPosition aLegendPosition = chart::ChartLegendPosition_NONE;
+ if( xLegendProp.is() && (xLegendProp->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Alignment" ))) >>= aLegendPosition)
+ && chart::ChartLegendPosition_NONE != aLegendPosition )
+ {
+
+ double fFontHeight = 6.0;
+ if( xLegendProp->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "CharHeight" ))) >>= fFontHeight )
+ fScale = 0.75*fFontHeight/6.0;
+ }
+ else
+ {
+ uno::Reference< embed::XVisualObject > xVisualObject( rImport.GetModel(), uno::UNO_QUERY );
+ if( xVisualObject.is() )
+ {
+ awt::Size aPageSize( xVisualObject->getVisualAreaSize( embed::Aspects::MSOLE_CONTENT ) );
+ fScale = aPageSize.Height/7000.0;
+ }
+ }
+ if( fScale>0 )
+ {
+ aSymbolSize.Height = static_cast<sal_Int32>( fScale * aSymbolSize.Height );
+ aSymbolSize.Width = aSymbolSize.Height;
+ }
+ }
+ xSeriesOrPointProp->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SymbolSize")),uno::makeAny( aSymbolSize ));
+}
+
+void lcl_setSymbolSizeIfNeeded( const uno::Reference< beans::XPropertySet >& xSeriesOrPointProp, const SvXMLImport& rImport )
+{
+ if( !xSeriesOrPointProp.is() )
+ return;
+
+ sal_Int32 nSymbolType = chart::ChartSymbolType::NONE;
+ if( xSeriesOrPointProp.is() && ( xSeriesOrPointProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SymbolType"))) >>= nSymbolType) )
+ {
+ if(chart::ChartSymbolType::NONE!=nSymbolType)
+ {
+ if( chart::ChartSymbolType::BITMAPURL==nSymbolType )
+ {
+ //set special size for graphics to indicate to use the bitmap size itself
+ xSeriesOrPointProp->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SymbolSize")),uno::makeAny( awt::Size(-1,-1) ));
+ }
+ else
+ {
+ lcl_setAutomaticSymbolSize( xSeriesOrPointProp, rImport );
+ }
+ }
+ }
+}
+
+void lcl_resetSymbolSizeForPointsIfNecessary( const uno::Reference< beans::XPropertySet >& xPointProp, const SvXMLImport& rImport
+ , const XMLPropStyleContext * pPropStyleContext, const SvXMLStylesContext* pStylesCtxt )
+{
+ uno::Any aASymbolSize( SchXMLTools::getPropertyFromContext( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SymbolSize")), pPropStyleContext, pStylesCtxt ) );
+ if( !aASymbolSize.hasValue() )
+ lcl_setSymbolSizeIfNeeded( xPointProp, rImport );
+}
+
+void lcl_insertErrorBarLSequencesToMap(
+ tSchXMLLSequencesPerIndex & rInOutMap,
+ const uno::Reference< beans::XPropertySet > & xSeriesProp,
+ bool bYError = true )
+{
+ Reference< chart2::data::XDataSource > xErrorBarSource;
+ const OUString aPropName(
+ bYError
+ ? ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ErrorBarY" ))
+ : ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ErrorBarX" )));
+ if( ( xSeriesProp->getPropertyValue( aPropName ) >>= xErrorBarSource ) &&
+ xErrorBarSource.is() )
+ {
+ Sequence< Reference< chart2::data::XLabeledDataSequence > > aLSequences(
+ xErrorBarSource->getDataSequences());
+ for( sal_Int32 nIndex = 0; nIndex < aLSequences.getLength(); ++nIndex )
+ {
+ // use "0" as data index. This is ok, as it is not used for error bars
+ rInOutMap.insert(
+ tSchXMLLSequencesPerIndex::value_type(
+ tSchXMLIndexWithPart( 0, SCH_XML_PART_ERROR_BARS ), aLSequences[ nIndex ] ));
+ }
+ }
+}
+
+Reference< chart2::data::XLabeledDataSequence > lcl_createAndAddSequenceToSeries( const rtl::OUString& rRole
+ , const rtl::OUString& rRange
+ , const Reference< chart2::XChartDocument >& xChartDoc
+ , const Reference< chart2::XDataSeries >& xSeries )
+{
+ Reference< chart2::data::XLabeledDataSequence > xLabeledSeq;
+
+ Reference< chart2::data::XDataSource > xSeriesSource( xSeries,uno::UNO_QUERY );
+ Reference< chart2::data::XDataSink > xSeriesSink( xSeries, uno::UNO_QUERY );
+
+ if( !(rRange.getLength() && xChartDoc.is() && xSeriesSource.is() && xSeriesSink.is()) )
+ return xLabeledSeq;
+
+ // create a new sequence
+ xLabeledSeq = SchXMLTools::GetNewLabeledDataSequence();
+
+ // set values at the new sequence
+ Reference< chart2::data::XDataSequence > xSeq = SchXMLTools::CreateDataSequence( rRange, xChartDoc );
+ Reference< beans::XPropertySet > xSeqProp( xSeq, uno::UNO_QUERY );
+ if( xSeqProp.is())
+ xSeqProp->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM( "Role" )), uno::makeAny( rRole));
+ xLabeledSeq->setValues( xSeq );
+
+ // add new sequence to data series / push to front to have the correct sequence order if charttype is changed afterwards
+ Sequence< Reference< chart2::data::XLabeledDataSequence > > aOldSeq( xSeriesSource->getDataSequences());
+ sal_Int32 nOldCount = aOldSeq.getLength();
+ Sequence< Reference< chart2::data::XLabeledDataSequence > > aNewSeq( nOldCount + 1 );
+ aNewSeq[0]=xLabeledSeq;
+ for( sal_Int32 nN=0; nN<nOldCount; nN++ )
+ aNewSeq[nN+1] = aOldSeq[nN];
+ xSeriesSink->setData( aNewSeq );
+
+ return xLabeledSeq;
+}
+
+} // anonymous namespace
+
+// ================================================================================
+
+SchXMLSeries2Context::SchXMLSeries2Context(
+ SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport, const rtl::OUString& rLocalName,
+ const Reference< chart2::XChartDocument > & xNewDoc,
+ std::vector< SchXMLAxis >& rAxes,
+ ::std::list< DataRowPointStyle >& rStyleList,
+ sal_Int32 nSeriesIndex,
+ sal_Bool bStockHasVolume,
+ GlobalSeriesImportInfo& rGlobalSeriesImportInfo,
+ const OUString & aGlobalChartTypeName,
+ tSchXMLLSequencesPerIndex & rLSequencesPerIndex,
+ bool& rGlobalChartTypeUsedBySeries,
+ const awt::Size & rChartSize ) :
+ SvXMLImportContext( rImport, XML_NAMESPACE_CHART, rLocalName ),
+ mrImportHelper( rImpHelper ),
+ mxNewDoc( xNewDoc ),
+ mrAxes( rAxes ),
+ mrStyleList( rStyleList ),
+ m_xSeries(0),
+ mnSeriesIndex( nSeriesIndex ),
+ mnDataPointIndex( 0 ),
+ m_bStockHasVolume( bStockHasVolume ),
+ m_rGlobalSeriesImportInfo(rGlobalSeriesImportInfo),
+ mpAttachedAxis( NULL ),
+ maGlobalChartTypeName( aGlobalChartTypeName ),
+ maSeriesChartTypeName( aGlobalChartTypeName ),
+ m_bHasDomainContext(false),
+ mrLSequencesPerIndex( rLSequencesPerIndex ),
+ mrGlobalChartTypeUsedBySeries( rGlobalChartTypeUsedBySeries ),
+ mbSymbolSizeIsMissingInFile(false),
+ maChartSize( rChartSize )
+{
+ if( 0 == aGlobalChartTypeName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.chart2.DonutChartType" ) ) )
+ {
+ maSeriesChartTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2.PieChartType" ));
+ maGlobalChartTypeName = maSeriesChartTypeName;
+ }
+}
+
+SchXMLSeries2Context::~SchXMLSeries2Context()
+{
+ OSL_ASSERT( maPostponedSequences.empty());
+}
+
+void SchXMLSeries2Context::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ // parse attributes
+ sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
+ const SvXMLTokenMap& rAttrTokenMap = mrImportHelper.GetSeriesAttrTokenMap();
+ mnAttachedAxis = 1;
+
+ bool bHasRange = false;
+ bool bHasLabelRange = false;
+
+ for( sal_Int16 i = 0; i < nAttrCount; i++ )
+ {
+ rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
+ rtl::OUString aLocalName;
+ rtl::OUString aValue = xAttrList->getValueByIndex( i );
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+
+ switch( rAttrTokenMap.Get( nPrefix, aLocalName ))
+ {
+ case XML_TOK_SERIES_CELL_RANGE:
+ m_aSeriesRange = aValue;
+ bHasRange = true;
+ break;
+ case XML_TOK_SERIES_LABEL_ADDRESS:
+ m_aSeriesLabelRange = aValue;
+ bHasLabelRange = true;
+ break;
+ case XML_TOK_SERIES_ATTACHED_AXIS:
+ {
+ sal_Int32 nNumOfAxes = mrAxes.size();
+ for( sal_Int32 nCurrent = 0; nCurrent < nNumOfAxes; nCurrent++ )
+ {
+ if( aValue.equals( mrAxes[ nCurrent ].aName ) &&
+ mrAxes[ nCurrent ].eDimension == SCH_XML_AXIS_Y )
+ {
+ mpAttachedAxis = &( mrAxes[ nCurrent ] );
+ }
+ }
+ }
+ break;
+ case XML_TOK_SERIES_STYLE_NAME:
+ msAutoStyleName = aValue;
+ break;
+ case XML_TOK_SERIES_CHART_CLASS:
+ {
+ OUString aClassName;
+ sal_uInt16 nClassPrefix =
+ GetImport().GetNamespaceMap().GetKeyByAttrName(
+ aValue, &aClassName );
+ if( XML_NAMESPACE_CHART == nClassPrefix )
+ maSeriesChartTypeName = SchXMLTools::GetChartTypeByClassName( aClassName, false /* bUseOldNames */ );
+
+ if( ! maSeriesChartTypeName.getLength())
+ maSeriesChartTypeName = aClassName;
+ }
+ break;
+ }
+ }
+
+ if( mpAttachedAxis )
+ {
+ if( mpAttachedAxis->nAxisIndex > 0 )
+ {
+ // secondary axis => property has to be set (primary is default)
+ mnAttachedAxis = 2;
+ }
+ }
+
+ try
+ {
+ OSL_ASSERT( mxNewDoc.is());
+ if( m_rGlobalSeriesImportInfo.rbAllRangeAddressesAvailable && ! bHasRange )
+ m_rGlobalSeriesImportInfo.rbAllRangeAddressesAvailable = sal_False;
+
+ bool bIsCandleStick = maGlobalChartTypeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.chart2.CandleStickChartType"));
+ if( maSeriesChartTypeName.getLength() )
+ {
+ bIsCandleStick = maSeriesChartTypeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.chart2.CandleStickChartType"));
+ }
+ else
+ {
+ if( bIsCandleStick
+ && m_bStockHasVolume
+ && mnSeriesIndex == 0 )
+ {
+ maSeriesChartTypeName = OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.ColumnChartType" ));
+ bIsCandleStick = false;
+ }
+ else
+ {
+ maSeriesChartTypeName = maGlobalChartTypeName;
+ }
+ }
+ if( ! mrGlobalChartTypeUsedBySeries )
+ mrGlobalChartTypeUsedBySeries = (maSeriesChartTypeName.equals( maGlobalChartTypeName ));
+ sal_Int32 nCoordinateSystemIndex = 0;//so far we can only import one coordinate system
+ m_xSeries.set(
+ mrImportHelper.GetNewDataSeries( mxNewDoc, nCoordinateSystemIndex, maSeriesChartTypeName, ! mrGlobalChartTypeUsedBySeries ));
+ Reference< chart2::data::XLabeledDataSequence > xLabeledSeq(
+ SchXMLTools::GetNewLabeledDataSequence());
+
+ if( bIsCandleStick )
+ {
+ // set default color for range-line to black (before applying styles)
+ Reference< beans::XPropertySet > xSeriesProp( m_xSeries, uno::UNO_QUERY );
+ if( xSeriesProp.is())
+ xSeriesProp->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Color")),
+ uno::makeAny( sal_Int32( 0x000000 ))); // black
+ }
+ else if( maSeriesChartTypeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.chart2.PieChartType")))
+ {
+ //@todo: this property should be saved
+ Reference< beans::XPropertySet > xSeriesProp( m_xSeries, uno::UNO_QUERY );
+ if( xSeriesProp.is())
+ xSeriesProp->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VaryColorsByPoint")),
+ uno::makeAny( true ));
+ }
+
+ // values
+ Reference< chart2::data::XDataSequence > xSeq;
+ if( bHasRange && m_aSeriesRange.getLength() )
+ xSeq = SchXMLTools::CreateDataSequence( m_aSeriesRange, mxNewDoc );
+
+ Reference< beans::XPropertySet > xSeqProp( xSeq, uno::UNO_QUERY );
+ if( xSeqProp.is())
+ {
+ OUString aMainRole(RTL_CONSTASCII_USTRINGPARAM("values-y"));
+ if( maSeriesChartTypeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.chart2.BubbleChartType") ) )
+ aMainRole = OUString(RTL_CONSTASCII_USTRINGPARAM( "values-size" ));
+ xSeqProp->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM( "Role" )), uno::makeAny( aMainRole ));
+ }
+ xLabeledSeq->setValues( xSeq );
+
+ // register for setting local data if external data provider is not present
+ maPostponedSequences.insert(
+ tSchXMLLSequencesPerIndex::value_type(
+ tSchXMLIndexWithPart( m_rGlobalSeriesImportInfo.nCurrentDataIndex, SCH_XML_PART_VALUES ), xLabeledSeq ));
+
+ // label
+ if( bHasLabelRange && m_aSeriesLabelRange.getLength() )
+ {
+ Reference< chart2::data::XDataSequence > xLabelSequence =
+ SchXMLTools::CreateDataSequence( m_aSeriesLabelRange, mxNewDoc );
+ xLabeledSeq->setLabel( xLabelSequence );
+ }
+
+ // Note: Even if we have no label, we have to register the label
+ // for creation, because internal data always has labels. If
+ // they don't exist in the original, auto-generated labels are
+ // used for the internal data.
+ maPostponedSequences.insert(
+ tSchXMLLSequencesPerIndex::value_type(
+ tSchXMLIndexWithPart( m_rGlobalSeriesImportInfo.nCurrentDataIndex, SCH_XML_PART_LABEL ), xLabeledSeq ));
+
+
+ Sequence< Reference< chart2::data::XLabeledDataSequence > > aSeq( &xLabeledSeq, 1 );
+ Reference< chart2::data::XDataSink > xSink( m_xSeries, uno::UNO_QUERY_THROW );
+ xSink->setData( aSeq );
+ }
+ catch( uno::Exception & ex )
+ {
+ (void)ex; // avoid warning for pro build
+ OSL_FAIL( ::rtl::OUStringToOString(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Exception caught. Type: " )) +
+ ::rtl::OUString::createFromAscii( typeid( ex ).name()) +
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ", Message: " )) +
+ ex.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
+ }
+
+ //init mbSymbolSizeIsMissingInFile:
+ try
+ {
+ if( msAutoStyleName.getLength() )
+ {
+ const SvXMLStylesContext* pStylesCtxt = mrImportHelper.GetAutoStylesContext();
+ if( pStylesCtxt )
+ {
+ const SvXMLStyleContext* pStyle = pStylesCtxt->FindStyleChildContext(
+ mrImportHelper.GetChartFamilyID(), msAutoStyleName );
+
+ const XMLPropStyleContext* pPropStyleContext = dynamic_cast< const XMLPropStyleContext * >( pStyle );
+
+ uno::Any aASymbolSize( SchXMLTools::getPropertyFromContext( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SymbolSize"))
+ , pPropStyleContext, pStylesCtxt ) );
+ mbSymbolSizeIsMissingInFile = !aASymbolSize.hasValue();
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ (void)ex; // avoid warning for pro build
+ }
+}
+
+struct DomainInfo
+{
+ DomainInfo( const rtl::OUString& rRole, const rtl::OUString& rRange, sal_Int32 nIndex )
+ : aRole(rRole), aRange(rRange), nIndexForLocalData(nIndex)
+ {}
+
+ rtl::OUString aRole;
+ rtl::OUString aRange;
+ sal_Int32 nIndexForLocalData;
+};
+
+void SchXMLSeries2Context::EndElement()
+{
+ // special handling for different chart types. This is necessary as the
+ // roles are not yet saved in the file format
+ sal_Int32 nDomainCount = maDomainAddresses.size();
+ bool bIsScatterChart = maSeriesChartTypeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.chart2.ScatterChartType"));
+ bool bIsBubbleChart = maSeriesChartTypeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.chart2.BubbleChartType"));
+ bool bDeleteSeries = false;
+ std::vector< DomainInfo > aDomainInfos;
+
+ //different handling for different chart types necessary
+ if( bIsScatterChart || ( nDomainCount==1 && !bIsBubbleChart ) )
+ {
+ DomainInfo aDomainInfo( OUString(RTL_CONSTASCII_USTRINGPARAM( "values-x" )), m_rGlobalSeriesImportInfo.aFirstFirstDomainAddress, m_rGlobalSeriesImportInfo.nFirstFirstDomainIndex ) ;
+ bool bCreateXValues = true;
+ if( !maDomainAddresses.empty() )
+ {
+ if( !m_rGlobalSeriesImportInfo.aFirstFirstDomainAddress.getLength() )
+ {
+ m_rGlobalSeriesImportInfo.aFirstFirstDomainAddress = maDomainAddresses.front();
+ m_rGlobalSeriesImportInfo.nFirstFirstDomainIndex = m_rGlobalSeriesImportInfo.nCurrentDataIndex;
+ }
+ aDomainInfo.aRange = maDomainAddresses.front();
+ aDomainInfo.nIndexForLocalData = m_rGlobalSeriesImportInfo.nCurrentDataIndex;
+ m_rGlobalSeriesImportInfo.nCurrentDataIndex++;
+ }
+ else if( !m_rGlobalSeriesImportInfo.aFirstFirstDomainAddress.getLength() && !m_bHasDomainContext && mnSeriesIndex==0 )
+ {
+ if( SchXMLTools::isDocumentGeneratedWithOpenOfficeOlderThan2_3( GetImport().GetModel() ) ) //wrong old chart files:
+ {
+ //for xy charts the first series needs to have a domain
+ //if this by error iss not the case the first series is taken s x values
+ //needed for wrong files created while having an addin (e.g. BoxPlot)
+ m_rGlobalSeriesImportInfo.aFirstFirstDomainAddress = m_aSeriesRange;
+ m_rGlobalSeriesImportInfo.nFirstFirstDomainIndex = m_rGlobalSeriesImportInfo.nCurrentDataIndex++;
+ bDeleteSeries = true;
+ bCreateXValues = false;//they will be created for the next series
+ }
+ }
+ if( bCreateXValues )
+ aDomainInfos.push_back( aDomainInfo );
+ }
+ else if( bIsBubbleChart )
+ {
+ if( nDomainCount>1 )
+ {
+ DomainInfo aDomainInfo( OUString(RTL_CONSTASCII_USTRINGPARAM( "values-x" )), maDomainAddresses[1], m_rGlobalSeriesImportInfo.nCurrentDataIndex ) ;
+ if( !m_rGlobalSeriesImportInfo.aFirstSecondDomainAddress.getLength() )
+ {
+ //for bubble chart the second domain contains the x values which should become an index smaller than y values for own data table
+ //->so second first
+ m_rGlobalSeriesImportInfo.aFirstSecondDomainAddress = maDomainAddresses[1];
+ m_rGlobalSeriesImportInfo.nFirstSecondDomainIndex = m_rGlobalSeriesImportInfo.nCurrentDataIndex;
+ }
+ aDomainInfos.push_back( aDomainInfo );
+ m_rGlobalSeriesImportInfo.nCurrentDataIndex++;
+ }
+ else if( m_rGlobalSeriesImportInfo.aFirstSecondDomainAddress.getLength() )
+ {
+ DomainInfo aDomainInfo( OUString(RTL_CONSTASCII_USTRINGPARAM( "values-x" )), m_rGlobalSeriesImportInfo.aFirstSecondDomainAddress, m_rGlobalSeriesImportInfo.nFirstSecondDomainIndex ) ;
+ aDomainInfos.push_back( aDomainInfo );
+ }
+ if( nDomainCount>0)
+ {
+ DomainInfo aDomainInfo( OUString(RTL_CONSTASCII_USTRINGPARAM( "values-y" )), maDomainAddresses.front(), m_rGlobalSeriesImportInfo.nCurrentDataIndex ) ;
+ if( !m_rGlobalSeriesImportInfo.aFirstFirstDomainAddress.getLength() )
+ {
+ m_rGlobalSeriesImportInfo.aFirstFirstDomainAddress = maDomainAddresses.front();
+ m_rGlobalSeriesImportInfo.nFirstFirstDomainIndex = m_rGlobalSeriesImportInfo.nCurrentDataIndex;
+ }
+ aDomainInfos.push_back( aDomainInfo );
+ m_rGlobalSeriesImportInfo.nCurrentDataIndex++;
+ }
+ else if( m_rGlobalSeriesImportInfo.aFirstFirstDomainAddress.getLength() )
+ {
+ DomainInfo aDomainInfo( OUString::createFromAscii("values-y"), m_rGlobalSeriesImportInfo.aFirstFirstDomainAddress, m_rGlobalSeriesImportInfo.nFirstFirstDomainIndex ) ;
+ aDomainInfos.push_back( aDomainInfo );
+ }
+ }
+
+ if( bDeleteSeries )
+ {
+ //delete created series
+ SchXMLImportHelper::DeleteDataSeries(
+ m_xSeries, Reference< chart2::XChartDocument >( GetImport().GetModel(), uno::UNO_QUERY ) );
+ }
+ else
+ {
+ //add style
+ if( msAutoStyleName.getLength() ||
+ mnAttachedAxis != 1 )
+ {
+ DataRowPointStyle aStyle(
+ DataRowPointStyle::DATA_SERIES,
+ m_xSeries,
+ -1, 1,
+ msAutoStyleName, mnAttachedAxis );
+ aStyle.mbSymbolSizeForSeriesIsMissingInFile=mbSymbolSizeIsMissingInFile;
+ mrStyleList.push_back( aStyle );
+ }
+ }
+
+ for( std::vector< DomainInfo >::reverse_iterator aIt( aDomainInfos.rbegin() ); aIt!= aDomainInfos.rend(); ++aIt )
+ {
+ DomainInfo aDomainInfo( *aIt );
+ Reference< chart2::data::XLabeledDataSequence > xLabeledSeq =
+ lcl_createAndAddSequenceToSeries( aDomainInfo.aRole, aDomainInfo.aRange, mxNewDoc, m_xSeries );
+ if( xLabeledSeq.is() )
+ {
+ // register for setting local data if external data provider is not present
+ mrLSequencesPerIndex.insert(
+ tSchXMLLSequencesPerIndex::value_type(
+ tSchXMLIndexWithPart( aDomainInfo.nIndexForLocalData, SCH_XML_PART_VALUES ), xLabeledSeq ));
+ }
+ }
+
+ if( !bDeleteSeries )
+ {
+ for( tSchXMLLSequencesPerIndex::const_iterator aIt( maPostponedSequences.begin());
+ aIt != maPostponedSequences.end(); ++aIt )
+ {
+ sal_Int32 nNewIndex = aIt->first.first + nDomainCount;
+ mrLSequencesPerIndex.insert(
+ tSchXMLLSequencesPerIndex::value_type(
+ tSchXMLIndexWithPart( nNewIndex, aIt->first.second ), aIt->second ));
+ }
+ m_rGlobalSeriesImportInfo.nCurrentDataIndex++;
+ }
+ maPostponedSequences.clear();
+}
+
+SvXMLImportContext* SchXMLSeries2Context::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList >& )
+{
+ SvXMLImportContext* pContext = 0;
+ const SvXMLTokenMap& rTokenMap = mrImportHelper.GetSeriesElemTokenMap();
+
+ switch( rTokenMap.Get( nPrefix, rLocalName ))
+ {
+ case XML_TOK_SERIES_DOMAIN:
+ if( m_xSeries.is())
+ {
+ m_bHasDomainContext = true;
+ pContext = new SchXMLDomain2Context(
+ mrImportHelper, GetImport(),
+ nPrefix, rLocalName,
+ maDomainAddresses );
+ }
+ break;
+
+ case XML_TOK_SERIES_MEAN_VALUE_LINE:
+ pContext = new SchXMLStatisticsObjectContext(
+ mrImportHelper, GetImport(),
+ nPrefix, rLocalName,
+ mrStyleList, m_xSeries,
+ SchXMLStatisticsObjectContext::CONTEXT_TYPE_MEAN_VALUE_LINE,
+ maChartSize );
+ break;
+ case XML_TOK_SERIES_REGRESSION_CURVE:
+ pContext = new SchXMLStatisticsObjectContext(
+ mrImportHelper, GetImport(),
+ nPrefix, rLocalName,
+ mrStyleList, m_xSeries,
+ SchXMLStatisticsObjectContext::CONTEXT_TYPE_REGRESSION_CURVE,
+ maChartSize );
+ break;
+ case XML_TOK_SERIES_ERROR_INDICATOR:
+ pContext = new SchXMLStatisticsObjectContext(
+ mrImportHelper, GetImport(),
+ nPrefix, rLocalName,
+ mrStyleList, m_xSeries,
+ SchXMLStatisticsObjectContext::CONTEXT_TYPE_ERROR_INDICATOR,
+ maChartSize );
+ break;
+
+ case XML_TOK_SERIES_DATA_POINT:
+ pContext = new SchXMLDataPointContext( mrImportHelper, GetImport(), rLocalName,
+ mrStyleList, m_xSeries, mnDataPointIndex, mbSymbolSizeIsMissingInFile );
+ break;
+
+ default:
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+ }
+
+ return pContext;
+}
+
+//static
+void SchXMLSeries2Context::initSeriesPropertySets( SeriesDefaultsAndStyles& rSeriesDefaultsAndStyles
+ , const uno::Reference< frame::XModel >& xChartModel )
+{
+ ::std::list< DataRowPointStyle >::iterator iStyle;
+
+ // iterate over series first and remind propertysets in map
+ // new api <-> old api wrapper
+ ::std::map< Reference< chart2::XDataSeries >, Reference< beans::XPropertySet > > aSeriesMap;
+ for( iStyle = rSeriesDefaultsAndStyles.maSeriesStyleList.begin(); iStyle != rSeriesDefaultsAndStyles.maSeriesStyleList.end(); iStyle++ )
+ {
+ if( iStyle->meType != DataRowPointStyle::DATA_SERIES )
+ continue;
+
+ if( !iStyle->m_xOldAPISeries.is() )
+ iStyle->m_xOldAPISeries = SchXMLSeriesHelper::createOldAPISeriesPropertySet( iStyle->m_xSeries, xChartModel );
+
+ aSeriesMap[iStyle->m_xSeries] = iStyle->m_xOldAPISeries;
+
+ }
+
+ //initialize m_xOldAPISeries for all other styles also
+ for( iStyle = rSeriesDefaultsAndStyles.maSeriesStyleList.begin(); iStyle != rSeriesDefaultsAndStyles.maSeriesStyleList.end(); iStyle++ )
+ {
+ if( iStyle->meType == DataRowPointStyle::DATA_SERIES )
+ continue;
+ iStyle->m_xOldAPISeries = aSeriesMap[iStyle->m_xSeries];
+ }
+}
+
+//static
+void SchXMLSeries2Context::setDefaultsToSeries( SeriesDefaultsAndStyles& rSeriesDefaultsAndStyles )
+{
+ ::std::list< DataRowPointStyle >::iterator iStyle;
+ // iterate over series
+ // call initSeriesPropertySets first
+
+ for( iStyle = rSeriesDefaultsAndStyles.maSeriesStyleList.begin(); iStyle != rSeriesDefaultsAndStyles.maSeriesStyleList.end(); iStyle++ )
+ {
+ if( iStyle->meType != DataRowPointStyle::DATA_SERIES )
+ continue;
+
+ try
+ {
+ uno::Reference< beans::XPropertySet > xSeries( iStyle->m_xOldAPISeries );
+ if( !xSeries.is() )
+ continue;
+
+ if( rSeriesDefaultsAndStyles.maSymbolTypeDefault.hasValue() )
+ xSeries->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SymbolType")),rSeriesDefaultsAndStyles.maSymbolTypeDefault);
+ if( rSeriesDefaultsAndStyles.maDataCaptionDefault.hasValue() )
+ xSeries->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataCaption")),rSeriesDefaultsAndStyles.maDataCaptionDefault);
+
+ if( rSeriesDefaultsAndStyles.maErrorIndicatorDefault.hasValue() )
+ xSeries->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ErrorIndicator")),rSeriesDefaultsAndStyles.maErrorIndicatorDefault);
+ if( rSeriesDefaultsAndStyles.maErrorCategoryDefault.hasValue() )
+ xSeries->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ErrorCategory")),rSeriesDefaultsAndStyles.maErrorCategoryDefault);
+ if( rSeriesDefaultsAndStyles.maConstantErrorLowDefault.hasValue() )
+ xSeries->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ConstantErrorLow")),rSeriesDefaultsAndStyles.maConstantErrorLowDefault);
+ if( rSeriesDefaultsAndStyles.maConstantErrorHighDefault.hasValue() )
+ xSeries->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ConstantErrorHigh")),rSeriesDefaultsAndStyles.maConstantErrorHighDefault);
+ if( rSeriesDefaultsAndStyles.maPercentageErrorDefault.hasValue() )
+ xSeries->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PercentageError")),rSeriesDefaultsAndStyles.maPercentageErrorDefault);
+ if( rSeriesDefaultsAndStyles.maErrorMarginDefault.hasValue() )
+ xSeries->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ErrorMargin")),rSeriesDefaultsAndStyles.maErrorMarginDefault);
+
+ if( rSeriesDefaultsAndStyles.maMeanValueDefault.hasValue() )
+ xSeries->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MeanValue")),rSeriesDefaultsAndStyles.maMeanValueDefault);
+ if( rSeriesDefaultsAndStyles.maRegressionCurvesDefault.hasValue() )
+ xSeries->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RegressionCurves")),rSeriesDefaultsAndStyles.maRegressionCurvesDefault);
+ }
+ catch( uno::Exception & )
+ {
+ //end of series reached
+ }
+ }
+}
+
+//static
+void SchXMLSeries2Context::setStylesToSeries( SeriesDefaultsAndStyles& rSeriesDefaultsAndStyles
+ , const SvXMLStylesContext* pStylesCtxt
+ , const SvXMLStyleContext*& rpStyle
+ , ::rtl::OUString& rCurrStyleName
+ , SchXMLImportHelper& rImportHelper
+ , const SvXMLImport& rImport
+ , bool bIsStockChart
+ , tSchXMLLSequencesPerIndex & rInOutLSequencesPerIndex )
+{
+ ::std::list< DataRowPointStyle >::iterator iStyle;
+
+ // iterate over series
+ for( iStyle = rSeriesDefaultsAndStyles.maSeriesStyleList.begin(); iStyle != rSeriesDefaultsAndStyles.maSeriesStyleList.end(); iStyle++ )
+ {
+ if( iStyle->meType == DataRowPointStyle::DATA_SERIES )
+ {
+ try
+ {
+ uno::Reference< beans::XPropertySet > xSeriesProp( iStyle->m_xOldAPISeries );
+ if( !xSeriesProp.is() )
+ continue;
+
+ if( iStyle->mnAttachedAxis != 1 )
+ {
+ xSeriesProp->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Axis" ))
+ , uno::makeAny(chart::ChartAxisAssign::SECONDARY_Y) );
+ }
+
+ if( (iStyle->msStyleName).getLength())
+ {
+ if( ! rCurrStyleName.equals( iStyle->msStyleName ))
+ {
+ rCurrStyleName = iStyle->msStyleName;
+ rpStyle = pStylesCtxt->FindStyleChildContext(
+ rImportHelper.GetChartFamilyID(), rCurrStyleName );
+ }
+
+ //set style to series
+ // note: SvXMLStyleContext::FillPropertySet is not const
+ XMLPropStyleContext * pPropStyleContext =
+ const_cast< XMLPropStyleContext * >(
+ dynamic_cast< const XMLPropStyleContext * >( rpStyle ));
+ if( pPropStyleContext )
+ {
+ // error bar style must be set before the other error
+ // bar properties (which may be alphabetically before
+ // this property)
+ bool bHasErrorBarRangesFromData = false;
+ {
+ const ::rtl::OUString aErrorBarStylePropName( RTL_CONSTASCII_USTRINGPARAM("ErrorBarStyle"));
+ uno::Any aErrorBarStyle(
+ SchXMLTools::getPropertyFromContext( aErrorBarStylePropName, pPropStyleContext, pStylesCtxt ));
+ if( aErrorBarStyle.hasValue())
+ {
+ xSeriesProp->setPropertyValue( aErrorBarStylePropName, aErrorBarStyle );
+ sal_Int32 eEBStyle = chart::ErrorBarStyle::NONE;
+ bHasErrorBarRangesFromData =
+ ( ( aErrorBarStyle >>= eEBStyle ) &&
+ eEBStyle == chart::ErrorBarStyle::FROM_DATA );
+ }
+ }
+
+ //don't set the style to the min max line series of a stock chart
+ //otherwise the min max line properties gets overwritten and the series becomes invisible typically
+ bool bIsMinMaxSeries = false;
+ if( bIsStockChart )
+ {
+ if( SchXMLSeriesHelper::isCandleStickSeries( iStyle->m_xSeries
+ , uno::Reference< frame::XModel >( rImportHelper.GetChartDocument(), uno::UNO_QUERY ) ) )
+ bIsMinMaxSeries = true;
+ }
+ if( !bIsMinMaxSeries )
+ {
+ pPropStyleContext->FillPropertySet( xSeriesProp );
+ if( iStyle->mbSymbolSizeForSeriesIsMissingInFile )
+ lcl_setSymbolSizeIfNeeded( xSeriesProp, rImport );
+ if( bHasErrorBarRangesFromData )
+ lcl_insertErrorBarLSequencesToMap( rInOutLSequencesPerIndex, xSeriesProp );
+ }
+ }
+ }
+ }
+ catch( uno::Exception & rEx )
+ {
+ (void)rEx; // avoid warning for pro build
+ OSL_TRACE( "Exception caught during setting styles to series: %s",
+ OUStringToOString( rEx.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
+ }
+ }
+ }
+}
+
+// static
+void SchXMLSeries2Context::setStylesToStatisticsObjects( SeriesDefaultsAndStyles& rSeriesDefaultsAndStyles
+ , const SvXMLStylesContext* pStylesCtxt
+ , const SvXMLStyleContext*& rpStyle
+ , ::rtl::OUString& rCurrStyleName )
+{
+ ::std::list< DataRowPointStyle >::iterator iStyle;
+
+ // iterate over regession etc
+ for( iStyle = rSeriesDefaultsAndStyles.maSeriesStyleList.begin(); iStyle != rSeriesDefaultsAndStyles.maSeriesStyleList.end(); iStyle++ )
+ {
+ if( iStyle->meType == DataRowPointStyle::REGRESSION ||
+ iStyle->meType == DataRowPointStyle::ERROR_INDICATOR ||
+ iStyle->meType == DataRowPointStyle::MEAN_VALUE )
+ {
+ try
+ {
+ uno::Reference< beans::XPropertySet > xSeriesProp( iStyle->m_xOldAPISeries );
+ if( !xSeriesProp.is() )
+ continue;
+
+ if( (iStyle->msStyleName).getLength())
+ {
+ if( ! rCurrStyleName.equals( iStyle->msStyleName ))
+ {
+ rCurrStyleName = iStyle->msStyleName;
+ rpStyle = pStylesCtxt->FindStyleChildContext(
+ SchXMLImportHelper::GetChartFamilyID(), rCurrStyleName );
+ }
+
+ // note: SvXMLStyleContext::FillPropertySet is not const
+ XMLPropStyleContext * pPropStyleContext =
+ const_cast< XMLPropStyleContext * >(
+ dynamic_cast< const XMLPropStyleContext * >( rpStyle ));
+ if( pPropStyleContext )
+ {
+ Reference< beans::XPropertySet > xStatPropSet;
+ switch( iStyle->meType )
+ {
+ case DataRowPointStyle::MEAN_VALUE:
+ xSeriesProp->getPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "DataMeanValueProperties" ))) >>= xStatPropSet;
+ break;
+ case DataRowPointStyle::REGRESSION:
+ xSeriesProp->getPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "DataRegressionProperties" ))) >>= xStatPropSet;
+ break;
+ case DataRowPointStyle::ERROR_INDICATOR:
+ xSeriesProp->getPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "DataErrorProperties" ))) >>= xStatPropSet;
+ break;
+ default:
+ break;
+ }
+ if( xStatPropSet.is())
+ pPropStyleContext->FillPropertySet( xStatPropSet );
+ }
+ }
+
+ // set equation properties at a regression curve
+ // note: this must be done after setting the regression
+ // properties at the old API, otherwise the curve itself does
+ // not exist here
+ if( iStyle->meType == DataRowPointStyle::REGRESSION && iStyle->m_xEquationProperties.is())
+ {
+ OSL_ASSERT( iStyle->m_xSeries.is());
+ Reference< chart2::XRegressionCurve > xRegCurve( SchXMLTools::getRegressionCurve( iStyle->m_xSeries ));
+ if( xRegCurve.is())
+ xRegCurve->setEquationProperties( iStyle->m_xEquationProperties );
+ }
+ }
+ catch( uno::Exception & rEx )
+ {
+ (void)rEx; // avoid warning for pro build
+ OSL_TRACE( "Exception caught during setting styles to series: %s",
+ OUStringToOString( rEx.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
+ }
+ }
+ }
+}
+
+//static
+void SchXMLSeries2Context::setStylesToDataPoints( SeriesDefaultsAndStyles& rSeriesDefaultsAndStyles
+ , const SvXMLStylesContext* pStylesCtxt
+ , const SvXMLStyleContext*& rpStyle
+ , ::rtl::OUString& rCurrStyleName
+ , SchXMLImportHelper& rImportHelper
+ , const SvXMLImport& rImport
+ , bool bIsStockChart, bool bIsDonutChart, bool bSwitchOffLinesForScatter )
+{
+ ::std::list< DataRowPointStyle >::iterator iStyle;
+ for( iStyle = rSeriesDefaultsAndStyles.maSeriesStyleList.begin(); iStyle != rSeriesDefaultsAndStyles.maSeriesStyleList.end(); iStyle++ )
+ {
+ if( iStyle->meType != DataRowPointStyle::DATA_POINT )
+ continue;
+
+ if( iStyle->m_nPointIndex == -1 )
+ continue;
+
+ //ignore datapoint properties for stock charts
+ //... todo ...
+ if( bIsStockChart )
+ {
+ if( SchXMLSeriesHelper::isCandleStickSeries( iStyle->m_xSeries, uno::Reference< frame::XModel >( rImportHelper.GetChartDocument(), uno::UNO_QUERY ) ) )
+ continue;
+ }
+
+ // data point style
+ for( sal_Int32 i = 0; i < iStyle->m_nPointRepeat; i++ )
+ {
+ try
+ {
+ uno::Reference< beans::XPropertySet > xSeriesProp( iStyle->m_xOldAPISeries );
+ if(!xSeriesProp.is())
+ continue;
+
+ uno::Reference< beans::XPropertySet > xPointProp(
+ SchXMLSeriesHelper::createOldAPIDataPointPropertySet( iStyle->m_xSeries, iStyle->m_nPointIndex + i
+ , uno::Reference< frame::XModel >( rImportHelper.GetChartDocument(), uno::UNO_QUERY ) ) );
+
+ if( !xPointProp.is() )
+ continue;
+
+ if( bIsDonutChart )
+ {
+ //set special series styles for donut charts first
+ if( !rCurrStyleName.equals( iStyle->msSeriesStyleNameForDonuts ) )
+ {
+ rCurrStyleName = iStyle->msSeriesStyleNameForDonuts;
+ rpStyle = pStylesCtxt->FindStyleChildContext(
+ rImportHelper.GetChartFamilyID(), rCurrStyleName );
+ }
+
+ // note: SvXMLStyleContext::FillPropertySet is not const
+ XMLPropStyleContext * pPropStyleContext =
+ const_cast< XMLPropStyleContext * >(
+ dynamic_cast< const XMLPropStyleContext * >( rpStyle ));
+ if( pPropStyleContext )
+ pPropStyleContext->FillPropertySet( xPointProp );
+ }
+
+ try
+ {
+ //need to set this explicitely here for old files as the new api does not support this property fully anymore
+ if( bSwitchOffLinesForScatter )
+ xPointProp->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Lines")),uno::makeAny(sal_False));
+ }
+ catch( uno::Exception & rEx )
+ {
+ (void)rEx; // avoid warning for pro build
+ }
+
+ if( !rCurrStyleName.equals( iStyle->msStyleName ) )
+ {
+ rCurrStyleName = iStyle->msStyleName;
+ rpStyle = pStylesCtxt->FindStyleChildContext(
+ rImportHelper.GetChartFamilyID(), rCurrStyleName );
+ }
+
+ // note: SvXMLStyleContext::FillPropertySet is not const
+ XMLPropStyleContext * pPropStyleContext =
+ const_cast< XMLPropStyleContext * >(
+ dynamic_cast< const XMLPropStyleContext * >( rpStyle ));
+ if( pPropStyleContext )
+ {
+ pPropStyleContext->FillPropertySet( xPointProp );
+ if( iStyle->mbSymbolSizeForSeriesIsMissingInFile )
+ lcl_resetSymbolSizeForPointsIfNecessary( xPointProp, rImport, pPropStyleContext, pStylesCtxt );
+ }
+ }
+ catch( uno::Exception & rEx )
+ {
+ (void)rEx; // avoid warning for pro build
+ OSL_TRACE( "Exception caught during setting styles to data points: %s",
+ OUStringToOString( rEx.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
+ }
+ }
+ } // styles iterator
+}
+
+//static
+void SchXMLSeries2Context::switchSeriesLinesOff( ::std::list< DataRowPointStyle >& rSeriesStyleList )
+{
+ ::std::list< DataRowPointStyle >::iterator iStyle;
+ // iterate over series
+
+ for( iStyle = rSeriesStyleList.begin(); iStyle != rSeriesStyleList.end(); iStyle++ )
+ {
+ if( iStyle->meType != DataRowPointStyle::DATA_SERIES )
+ continue;
+
+ try
+ {
+ uno::Reference< beans::XPropertySet > xSeries( iStyle->m_xOldAPISeries );
+ if( !xSeries.is() )
+ continue;
+
+ xSeries->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Lines")),uno::makeAny(sal_False));
+ }
+ catch( uno::Exception & )
+ {
+ //end of series reached
+ }
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/SchXMLSeries2Context.hxx b/xmloff/source/chart/SchXMLSeries2Context.hxx
new file mode 100644
index 000000000000..0bb17b0519ce
--- /dev/null
+++ b/xmloff/source/chart/SchXMLSeries2Context.hxx
@@ -0,0 +1,138 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 XMLOFF_SCHXMLSERIES2CONTEXT_HXX
+#define XMLOFF_SCHXMLSERIES2CONTEXT_HXX
+
+#include "transporttypes.hxx"
+#include "SchXMLChartContext.hxx"
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/SchXMLImportHelper.hxx>
+// header for class SvXMLStyleContext
+#include <xmloff/xmlstyle.hxx>
+
+#include <vector>
+#include <list>
+
+namespace com { namespace sun { namespace star {
+ namespace chart2 {
+ class XChartDocument;
+ class XDataSeries;
+ }
+ namespace awt {
+ struct Size;
+ }
+}}}
+
+// class for child contexts: series, data point and statistics objects
+class SchXMLSeries2Context : public SvXMLImportContext
+{
+private:
+ SchXMLImportHelper& mrImportHelper;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > mxNewDoc;
+ ::std::vector< SchXMLAxis >& mrAxes;
+ ::std::list< DataRowPointStyle >& mrStyleList;
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > m_xSeries;
+ sal_Int32 mnSeriesIndex;
+ sal_Int32 mnDataPointIndex;
+ sal_Bool m_bStockHasVolume;
+
+ GlobalSeriesImportInfo& m_rGlobalSeriesImportInfo;
+
+ SchXMLAxis* mpAttachedAxis;
+ sal_Int32 mnAttachedAxis;
+ ::rtl::OUString msAutoStyleName;
+ ::std::vector< ::rtl::OUString > maDomainAddresses;
+ ::rtl::OUString maGlobalChartTypeName;
+ ::rtl::OUString maSeriesChartTypeName;
+ ::rtl::OUString m_aSeriesRange;
+ ::rtl::OUString m_aSeriesLabelRange;
+ bool m_bHasDomainContext;
+ tSchXMLLSequencesPerIndex & mrLSequencesPerIndex;
+ tSchXMLLSequencesPerIndex maPostponedSequences;
+ bool& mrGlobalChartTypeUsedBySeries;
+ bool mbSymbolSizeIsMissingInFile;
+ ::com::sun::star::awt::Size maChartSize;
+
+public:
+ SchXMLSeries2Context( SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport, const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > & xNewDoc,
+ std::vector< SchXMLAxis >& rAxes,
+ ::std::list< DataRowPointStyle >& rStyleList,
+ sal_Int32 nSeriesIndex,
+ sal_Bool bStockHasVolume,
+ GlobalSeriesImportInfo& rGlobalSeriesImportInfo,
+ const ::rtl::OUString & aGlobalChartTypeName,
+ tSchXMLLSequencesPerIndex & rLSequencesPerIndex,
+ bool& rGlobalChartTypeUsedBySeries,
+ const ::com::sun::star::awt::Size & rChartSize );
+ virtual ~SchXMLSeries2Context();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+
+ static void initSeriesPropertySets( SeriesDefaultsAndStyles& rSeriesDefaultsAndStyles
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel );
+
+ static void setDefaultsToSeries( SeriesDefaultsAndStyles& rSeriesDefaultsAndStyles );
+
+ static void setStylesToSeries( SeriesDefaultsAndStyles& rSeriesDefaultsAndStyles
+ , const SvXMLStylesContext* pStylesCtxt
+ , const SvXMLStyleContext*& rpStyle
+ , ::rtl::OUString& rCurrStyleName
+ , SchXMLImportHelper& rImportHelper
+ , const SvXMLImport& rImport
+ , bool bIsStockChart
+ , tSchXMLLSequencesPerIndex & rInOutLSequencesPerIndex );
+
+ static void setStylesToStatisticsObjects( SeriesDefaultsAndStyles& rSeriesDefaultsAndStyles
+ , const SvXMLStylesContext* pStylesCtxt
+ , const SvXMLStyleContext*& rpStyle
+ , ::rtl::OUString& rCurrStyleName );
+
+ static void setStylesToDataPoints( SeriesDefaultsAndStyles& rSeriesDefaultsAndStyles
+ , const SvXMLStylesContext* pStylesCtxt
+ , const SvXMLStyleContext*& rpStyle
+ , ::rtl::OUString& rCurrStyleName
+ , SchXMLImportHelper& rImportHelper
+ , const SvXMLImport& rImport
+ , bool bIsStockChart, bool bIsDonutChart, bool bSwitchOffLinesForScatter );
+
+ static void switchSeriesLinesOff( ::std::list< DataRowPointStyle >& rSeriesStyleList );
+};
+
+// XMLOFF_SCHXMLSERIES2CONTEXT_HXX
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/SchXMLSeriesHelper.cxx b/xmloff/source/chart/SchXMLSeriesHelper.cxx
new file mode 100644
index 000000000000..4519b2c12ddd
--- /dev/null
+++ b/xmloff/source/chart/SchXMLSeriesHelper.cxx
@@ -0,0 +1,303 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "SchXMLSeriesHelper.hxx"
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/XChartTypeContainer.hpp>
+#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
+#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+// header for define RTL_CONSTASCII_USTRINGPARAM
+#include <rtl/ustring.h>
+// header for define DBG_ERROR1
+#include <tools/debug.hxx>
+
+#include <typeinfo>
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+using ::rtl::OUStringToOString;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+// ----------------------------------------
+
+::std::vector< Reference< chart2::XDataSeries > >
+ SchXMLSeriesHelper::getDataSeriesFromDiagram(
+ const Reference< chart2::XDiagram > & xDiagram )
+{
+ ::std::vector< Reference< chart2::XDataSeries > > aResult;
+
+ try
+ {
+ Reference< chart2::XCoordinateSystemContainer > xCooSysCnt(
+ xDiagram, uno::UNO_QUERY_THROW );
+ Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq(
+ xCooSysCnt->getCoordinateSystems());
+ for( sal_Int32 i=0; i<aCooSysSeq.getLength(); ++i )
+ {
+ Reference< chart2::XChartTypeContainer > xCTCnt( aCooSysSeq[i], uno::UNO_QUERY_THROW );
+ Sequence< Reference< chart2::XChartType > > aChartTypeSeq( xCTCnt->getChartTypes());
+ for( sal_Int32 j=0; j<aChartTypeSeq.getLength(); ++j )
+ {
+ Reference< chart2::XDataSeriesContainer > xDSCnt( aChartTypeSeq[j], uno::UNO_QUERY_THROW );
+ Sequence< Reference< chart2::XDataSeries > > aSeriesSeq( xDSCnt->getDataSeries() );
+ ::std::copy( aSeriesSeq.getConstArray(), aSeriesSeq.getConstArray() + aSeriesSeq.getLength(),
+ ::std::back_inserter( aResult ));
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ (void)ex; // avoid warning for pro build
+
+ OSL_FAIL( OUStringToOString( OUString(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "Exception caught. Type: " )) +
+ OUString::createFromAscii( typeid( ex ).name()) +
+ OUString( RTL_CONSTASCII_USTRINGPARAM( ", Message: " )) +
+ ex.Message), RTL_TEXTENCODING_ASCII_US ).getStr());
+
+ }
+
+ return aResult;
+}
+
+::std::map< Reference< chart2::XDataSeries >, sal_Int32 > SchXMLSeriesHelper::getDataSeriesIndexMapFromDiagram(
+ const Reference< chart2::XDiagram > & xDiagram )
+{
+ ::std::map< Reference< chart2::XDataSeries >, sal_Int32 > aRet;
+
+ sal_Int32 nIndex=0;
+
+ ::std::vector< Reference< chart2::XDataSeries > > aSeriesVector( SchXMLSeriesHelper::getDataSeriesFromDiagram( xDiagram ));
+ for( ::std::vector< Reference< chart2::XDataSeries > >::const_iterator aSeriesIt( aSeriesVector.begin() )
+ ; aSeriesIt != aSeriesVector.end()
+ ; aSeriesIt++, nIndex++ )
+ {
+ Reference< chart2::XDataSeries > xSeries( *aSeriesIt );
+ if( xSeries.is() )
+ {
+ if( aRet.end() == aRet.find(xSeries) )
+ aRet[xSeries]=nIndex;
+ }
+ }
+ return aRet;
+}
+
+uno::Reference< chart2::XChartType > lcl_getChartTypeOfSeries(
+ const uno::Reference< chart2::XDiagram >& xDiagram
+ , const Reference< chart2::XDataSeries >& xSeries )
+{
+ if(!xDiagram.is())
+ return 0;
+
+ //iterate through the model to find the given xSeries
+ //the found parent indicates the charttype
+
+ //iterate through all coordinate systems
+ uno::Reference< chart2::XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
+ if( !xCooSysContainer.is())
+ return 0;
+
+ uno::Sequence< uno::Reference< chart2::XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
+ for( sal_Int32 nCS = 0; nCS < aCooSysList.getLength(); ++nCS )
+ {
+ uno::Reference< chart2::XCoordinateSystem > xCooSys( aCooSysList[nCS] );
+
+ //iterate through all chart types in the current coordinate system
+ uno::Reference< chart2::XChartTypeContainer > xChartTypeContainer( xCooSys, uno::UNO_QUERY );
+ OSL_ASSERT( xChartTypeContainer.is());
+ if( !xChartTypeContainer.is() )
+ continue;
+ uno::Sequence< uno::Reference< chart2::XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() );
+ for( sal_Int32 nT = 0; nT < aChartTypeList.getLength(); ++nT )
+ {
+ uno::Reference< chart2::XChartType > xChartType( aChartTypeList[nT] );
+
+ //iterate through all series in this chart type
+ uno::Reference< chart2::XDataSeriesContainer > xDataSeriesContainer( xChartType, uno::UNO_QUERY );
+ OSL_ASSERT( xDataSeriesContainer.is());
+ if( !xDataSeriesContainer.is() )
+ continue;
+
+ uno::Sequence< uno::Reference< chart2::XDataSeries > > aSeriesList( xDataSeriesContainer->getDataSeries() );
+ for( sal_Int32 nS = 0; nS < aSeriesList.getLength(); ++nS )
+ {
+ Reference< chart2::XDataSeries > xCurrentSeries( aSeriesList[nS] );
+
+ if( xSeries == xCurrentSeries )
+ return xChartType;
+ }
+ }
+ }
+ return 0;
+}
+
+bool SchXMLSeriesHelper::isCandleStickSeries(
+ const Reference< chart2::XDataSeries >& xSeries
+ , const Reference< frame::XModel >& xChartModel )
+{
+ bool bRet = false;
+
+ uno::Reference< chart2::XChartDocument > xNewDoc( xChartModel, uno::UNO_QUERY );
+ if( xNewDoc.is() )
+ {
+ uno::Reference< chart2::XDiagram > xNewDiagram( xNewDoc->getFirstDiagram() );
+ if( xNewDiagram.is() )
+ {
+ uno::Reference< chart2::XChartType > xChartType( lcl_getChartTypeOfSeries(
+ xNewDiagram, xSeries ) );
+ if( xChartType.is() )
+ {
+ rtl::OUString aServiceName( xChartType->getChartType() );
+ if( aServiceName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.CandleStickChartType" ) ) ) )
+ bRet = true;
+ }
+ }
+ }
+ return bRet;
+}
+
+// static
+Reference< chart2::XDataSeries > SchXMLSeriesHelper::getFirstCandleStickSeries(
+ const Reference< chart2::XDiagram > & xDiagram )
+{
+ Reference< chart2::XDataSeries > xResult;
+
+ try
+ {
+ Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY_THROW );
+ Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems());
+ for( sal_Int32 nCooSysIdx=0; !xResult.is() && nCooSysIdx<aCooSysSeq.getLength(); ++nCooSysIdx )
+ {
+ Reference< chart2::XChartTypeContainer > xCTCnt( aCooSysSeq[nCooSysIdx], uno::UNO_QUERY_THROW );
+ Sequence< Reference< chart2::XChartType > > aCTSeq( xCTCnt->getChartTypes());
+ for( sal_Int32 nCTIdx=0; !xResult.is() && nCTIdx<aCTSeq.getLength(); ++nCTIdx )
+ {
+ if( aCTSeq[nCTIdx]->getChartType().equals(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.CandleStickChartType" ))))
+ {
+ Reference< chart2::XDataSeriesContainer > xSeriesCnt( aCTSeq[nCTIdx], uno::UNO_QUERY_THROW );
+ Sequence< Reference< chart2::XDataSeries > > aSeriesSeq( xSeriesCnt->getDataSeries() );
+ if( aSeriesSeq.getLength())
+ xResult.set( aSeriesSeq[0] );
+ break;
+ }
+ }
+ }
+ }
+ catch( const uno::Exception & )
+ {
+ OSL_FAIL( "Exception caught" );
+ }
+ return xResult;
+}
+
+//static
+uno::Reference< beans::XPropertySet > SchXMLSeriesHelper::createOldAPISeriesPropertySet(
+ const uno::Reference< chart2::XDataSeries >& xSeries
+ , const uno::Reference< frame::XModel >& xChartModel )
+{
+ uno::Reference< beans::XPropertySet > xRet;
+
+ if( xSeries.is() )
+ {
+ try
+ {
+ uno::Reference< lang::XMultiServiceFactory > xFactory( xChartModel, uno::UNO_QUERY );
+ if( xFactory.is() )
+ {
+ xRet = uno::Reference< beans::XPropertySet >( xFactory->createInstance(
+ OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart2.DataSeriesWrapper" )) ), uno::UNO_QUERY );
+ Reference< lang::XInitialization > xInit( xRet, uno::UNO_QUERY );
+ if(xInit.is())
+ {
+ Sequence< uno::Any > aArguments(1);
+ aArguments[0]=uno::makeAny(xSeries);
+ xInit->initialize(aArguments);
+ }
+ }
+ }
+ catch( uno::Exception & rEx )
+ {
+ (void)rEx; // avoid warning for pro build
+ OSL_TRACE( "Exception caught SchXMLSeriesHelper::createOldAPISeriesPropertySet: %s",
+ OUStringToOString( rEx.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
+ }
+ }
+
+ return xRet;
+}
+
+//static
+uno::Reference< beans::XPropertySet > SchXMLSeriesHelper::createOldAPIDataPointPropertySet(
+ const uno::Reference< chart2::XDataSeries >& xSeries
+ , sal_Int32 nPointIndex
+ , const uno::Reference< frame::XModel >& xChartModel )
+{
+ uno::Reference< beans::XPropertySet > xRet;
+
+ if( xSeries.is() )
+ {
+ try
+ {
+ uno::Reference< lang::XMultiServiceFactory > xFactory( xChartModel, uno::UNO_QUERY );
+ if( xFactory.is() )
+ {
+ xRet = uno::Reference< beans::XPropertySet >( xFactory->createInstance(
+ OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart2.DataSeriesWrapper" )) ), uno::UNO_QUERY );
+ Reference< lang::XInitialization > xInit( xRet, uno::UNO_QUERY );
+ if(xInit.is())
+ {
+ Sequence< uno::Any > aArguments(2);
+ aArguments[0]=uno::makeAny(xSeries);
+ aArguments[1]=uno::makeAny(nPointIndex);
+ xInit->initialize(aArguments);
+ }
+ }
+ }
+ catch( uno::Exception & rEx )
+ {
+ (void)rEx; // avoid warning for pro build
+
+ OSL_TRACE( "Exception caught SchXMLSeriesHelper::createOldAPIDataPointPropertySet: %s",
+ OUStringToOString( rEx.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
+ }
+ }
+
+ return xRet;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/SchXMLSeriesHelper.hxx b/xmloff/source/chart/SchXMLSeriesHelper.hxx
new file mode 100644
index 000000000000..b5fc1ad91821
--- /dev/null
+++ b/xmloff/source/chart/SchXMLSeriesHelper.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_SCH_XML_SERIESHELPER_HXX
+#define _XMLOFF_SCH_XML_SERIESHELPER_HXX
+
+#include <com/sun/star/chart2/data/XDataSequence.hpp>
+#include <com/sun/star/chart2/data/XDataSource.hpp>
+#include <com/sun/star/chart2/XDataSeries.hpp>
+#include <com/sun/star/chart2/XDiagram.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+
+#include <vector>
+#include <map>
+
+class SchXMLSeriesHelper
+{
+public:
+ static ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > >
+ getDataSeriesFromDiagram(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram > & xDiagram );
+ static ::std::map< ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >, sal_Int32 >
+ getDataSeriesIndexMapFromDiagram(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram > & xDiagram );
+
+ static bool isCandleStickSeries(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >& xSeries
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel );
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > getFirstCandleStickSeries(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram > & xDiagram );
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > createOldAPISeriesPropertySet(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >& xSeries
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel );
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > createOldAPIDataPointPropertySet(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >& xSeries
+ , sal_Int32 nPointIndex
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel );
+};
+
+// _XMLOFF_SCH_XML_SERIESHELPER_HXX
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/SchXMLTableContext.cxx b/xmloff/source/chart/SchXMLTableContext.cxx
new file mode 100644
index 000000000000..0252117adf4e
--- /dev/null
+++ b/xmloff/source/chart/SchXMLTableContext.cxx
@@ -0,0 +1,1253 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "SchXMLTableContext.hxx"
+#include "SchXMLParagraphContext.hxx"
+#include "SchXMLTextListContext.hxx"
+#include "SchXMLImport.hxx"
+#include "SchXMLTools.hxx"
+#include "transporttypes.hxx"
+#include "XMLStringBufferImportContext.hxx"
+#include <tools/debug.hxx>
+#include <rtl/math.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/chart2/XAnyDescriptionAccess.hpp>
+#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/XChartTypeContainer.hpp>
+#include <com/sun/star/chart2/XInternalDataProvider.hpp>
+#include <com/sun/star/chart/ChartSeriesAddress.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
+#include <com/sun/star/chart2/XDiagram.hpp>
+#include <com/sun/star/chart2/XAxis.hpp>
+#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
+#include <com/sun/star/chart2/AxisType.hpp>
+
+#include <vector>
+#include <algorithm>
+
+using namespace com::sun::star;
+using namespace ::xmloff::token;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::rtl::OUString;
+
+namespace
+{
+
+const OUString lcl_aLabelPrefix( RTL_CONSTASCII_USTRINGPARAM("label "));
+const OUString lcl_aCategoriesRange( RTL_CONSTASCII_USTRINGPARAM("categories"));
+
+typedef ::std::multimap< ::rtl::OUString, ::rtl::OUString >
+ lcl_tOriginalRangeToInternalRangeMap;
+
+Sequence< OUString > lcl_getCategoriesFromTable( const SchXMLTable & rTable, bool bHasLabels )
+{
+ sal_Int32 nNumRows( static_cast< sal_Int32 >( rTable.aData.size()));
+ OSL_ENSURE( static_cast< size_t >( nNumRows ) == rTable.aData.size(), "Table too big" );
+
+ sal_Int32 nOffset(bHasLabels ? 1 : 0);
+ Sequence< OUString > aResult( nNumRows - nOffset );
+ sal_Int32 i=nOffset;
+ for( ; i<nNumRows; ++i )
+ {
+ if( !rTable.aData[i].empty() && (rTable.aData[i].front().eType == SCH_CELL_TYPE_STRING ))
+ aResult[i - nOffset] = rTable.aData[i].front().aString;
+ }
+ return aResult;
+}
+
+std::vector< Reference< chart2::XAxis > > lcl_getAxesHoldingCategoriesFromDiagram(
+ const Reference< chart2::XDiagram > & xDiagram )
+{
+ std::vector< Reference< chart2::XAxis > > aRet;
+
+ Reference< chart2::XAxis > xResult;
+ // return first x-axis as fall-back
+ Reference< chart2::XAxis > xFallBack;
+ try
+ {
+ Reference< chart2::XCoordinateSystemContainer > xCooSysCnt(
+ xDiagram, uno::UNO_QUERY_THROW );
+ Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq(
+ xCooSysCnt->getCoordinateSystems());
+ for( sal_Int32 i=0; i<aCooSysSeq.getLength(); ++i )
+ {
+ Reference< chart2::XCoordinateSystem > xCooSys( aCooSysSeq[i] );
+ OSL_ASSERT( xCooSys.is());
+ for( sal_Int32 nN = xCooSys->getDimension(); nN--; )
+ {
+ const sal_Int32 nMaximumScaleIndex = xCooSys->getMaximumAxisIndexByDimension(nN);
+ for(sal_Int32 nI=0; nI<=nMaximumScaleIndex; ++nI)
+ {
+ Reference< chart2::XAxis > xAxis = xCooSys->getAxisByDimension( nN,nI );
+ OSL_ASSERT( xAxis.is());
+ if( xAxis.is())
+ {
+ chart2::ScaleData aScaleData = xAxis->getScaleData();
+ if( aScaleData.Categories.is() || (aScaleData.AxisType == chart2::AxisType::CATEGORY) )
+ {
+ aRet.push_back(xAxis);
+ }
+ if( (nN == 0) && !xFallBack.is())
+ xFallBack.set( xAxis );
+ }
+ }
+ }
+ }
+ }
+ catch( uno::Exception & )
+ {
+ }
+
+ if( aRet.empty())
+ aRet.push_back(xFallBack);
+
+ return aRet;
+}
+
+struct lcl_ApplyCellToData : public ::std::unary_function< SchXMLCell, void >
+{
+ lcl_ApplyCellToData( Sequence< double > & rOutData ) :
+ m_rData( rOutData ),
+ m_nIndex( 0 ),
+ m_nSize( rOutData.getLength())
+ {
+ ::rtl::math::setNan( &m_fNaN );
+ }
+
+ void operator() ( const SchXMLCell & rCell )
+ {
+ if( m_nIndex < m_nSize )
+ {
+ if( rCell.eType == SCH_CELL_TYPE_FLOAT )
+ m_rData[m_nIndex] = rCell.fValue;
+ else
+ m_rData[m_nIndex] = m_fNaN;
+ }
+ ++m_nIndex;
+ }
+
+ sal_Int32 getCurrentIndex() const
+ {
+ return m_nIndex;
+ }
+
+private:
+ Sequence< double > & m_rData;
+ sal_Int32 m_nIndex;
+ sal_Int32 m_nSize;
+ double m_fNaN;
+};
+
+Sequence< Sequence< double > > lcl_getSwappedArray( const Sequence< Sequence< double > > & rData )
+{
+ sal_Int32 nOldOuterSize = rData.getLength();
+ sal_Int32 nOldInnerSize = (nOldOuterSize == 0 ? 0 : rData[0].getLength());
+ Sequence< Sequence< double > > aResult( nOldInnerSize );
+
+ for( sal_Int32 i=0; i<nOldInnerSize; ++i )
+ aResult[i].realloc( nOldOuterSize );
+
+ for( sal_Int32 nOuter=0; nOuter<nOldOuterSize; ++nOuter )
+ for( sal_Int32 nInner=0; nInner<nOldInnerSize; ++nInner )
+ aResult[nInner][nOuter] = rData[nOuter][nInner];
+
+ return aResult;
+}
+
+void lcl_fillRangeMapping(
+ const SchXMLTable & rTable,
+ lcl_tOriginalRangeToInternalRangeMap & rOutRangeMap,
+ chart::ChartDataRowSource eDataRowSource )
+{
+ sal_Int32 nRowOffset = ( rTable.bHasHeaderRow ? 1 : 0 );
+ sal_Int32 nColOffset = ( rTable.bHasHeaderColumn ? 1 : 0 );
+
+ // Fill range mapping
+ const size_t nTableRowCount( rTable.aData.size());
+ for( size_t nRow = 0; nRow < nTableRowCount; ++nRow )
+ {
+ const ::std::vector< SchXMLCell > & rRow( rTable.aData[nRow] );
+ const size_t nTableColCount( rRow.size());
+ for( size_t nCol = 0; nCol < nTableColCount; ++nCol )
+ {
+ OUString aRangeId( rRow[nCol].aRangeId );
+ if( aRangeId.getLength())
+ {
+ if( eDataRowSource == chart::ChartDataRowSource_COLUMNS )
+ {
+ if( nCol == 0 && rTable.bHasHeaderColumn )
+ {
+ OSL_ASSERT( static_cast< sal_Int32 >( nRow ) == nRowOffset );
+ rOutRangeMap.insert( lcl_tOriginalRangeToInternalRangeMap::value_type(
+ aRangeId, lcl_aCategoriesRange ));
+ }
+ else
+ {
+ OUString aColNumStr = OUString::valueOf( static_cast< sal_Int32 >( nCol - nColOffset ));
+ if( nRow == 0 && rTable.bHasHeaderRow )
+ rOutRangeMap.insert( lcl_tOriginalRangeToInternalRangeMap::value_type(
+ aRangeId, lcl_aLabelPrefix + aColNumStr ));
+ else
+ rOutRangeMap.insert( lcl_tOriginalRangeToInternalRangeMap::value_type(
+ aRangeId, aColNumStr ));
+ }
+ }
+ else // eDataRowSource == chart::ChartDataRowSource_ROWS
+ {
+ if( nRow == 0 && rTable.bHasHeaderRow )
+ {
+ OSL_ASSERT( static_cast< sal_Int32 >( nCol ) == nColOffset );
+ rOutRangeMap.insert( lcl_tOriginalRangeToInternalRangeMap::value_type(
+ aRangeId, lcl_aCategoriesRange ));
+ }
+ else
+ {
+ OUString aRowNumStr = OUString::valueOf( static_cast< sal_Int32 >( nRow - nRowOffset ));
+ if( nCol == 0 && rTable.bHasHeaderColumn )
+ rOutRangeMap.insert( lcl_tOriginalRangeToInternalRangeMap::value_type(
+ aRangeId, lcl_aLabelPrefix + aRowNumStr ));
+ else
+ rOutRangeMap.insert( lcl_tOriginalRangeToInternalRangeMap::value_type(
+ aRangeId, aRowNumStr ));
+ }
+ }
+ }
+ }
+ }
+}
+
+Reference< chart2::data::XDataSequence >
+ lcl_reassignDataSequence(
+ const Reference< chart2::data::XDataSequence > & xSequence,
+ const Reference< chart2::data::XDataProvider > & xDataProvider,
+ lcl_tOriginalRangeToInternalRangeMap & rRangeMap,
+ const OUString & rRange )
+{
+ Reference< chart2::data::XDataSequence > xResult( xSequence );
+ lcl_tOriginalRangeToInternalRangeMap::iterator aIt( rRangeMap.find( rRange ));
+ if( aIt != rRangeMap.end())
+ {
+ // set sequence with correct data
+ xResult.set( xDataProvider->createDataSequenceByRangeRepresentation( aIt->second ));
+ // remove translation, because it was used
+ rRangeMap.erase( aIt );
+ }
+
+ return xResult;
+}
+
+bool lcl_mapContainsRange(
+ lcl_tOriginalRangeToInternalRangeMap & rRangeMap,
+ const OUString & rRange )
+{
+ lcl_tOriginalRangeToInternalRangeMap::iterator aIt( rRangeMap.find( rRange ));
+ return ( aIt != rRangeMap.end());
+}
+
+bool lcl_tableOfRangeMatches(
+ const ::rtl::OUString & rRange,
+ const ::rtl::OUString & rTableName )
+{
+ // both strings are non-empty and the table name is part of the range
+ return ( (rRange.getLength() > 0) &&
+ (rTableName.getLength() > 0) &&
+ (rRange.indexOf( rTableName ) != -1 ));
+}
+
+template< typename T >
+::std::vector< T > lcl_SequenceToVector( const uno::Sequence< T > & rSequence )
+{
+ ::std::vector< T > aResult( rSequence.getLength());
+ ::std::copy( rSequence.getConstArray(), rSequence.getConstArray() + rSequence.getLength(),
+ aResult.begin());
+ return aResult;
+}
+
+} // anonymous namespace
+
+
+// ----------------------------------------
+// class SchXMLTableContext
+// ----------------------------------------
+
+SchXMLTableContext::SchXMLTableContext( SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport,
+ const rtl::OUString& rLName,
+ SchXMLTable& aTable ) :
+ SvXMLImportContext( rImport, XML_NAMESPACE_TABLE, rLName ),
+ mrImportHelper( rImpHelper ),
+ mrTable( aTable ),
+ mbHasRowPermutation( false ),
+ mbHasColumnPermutation( false )
+{
+ mrTable.nColumnIndex = -1;
+ mrTable.nMaxColumnIndex = -1;
+ mrTable.nRowIndex = -1;
+ mrTable.aData.clear();
+}
+
+SchXMLTableContext::~SchXMLTableContext()
+{
+}
+
+SvXMLImportContext *SchXMLTableContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList >& )
+{
+ SvXMLImportContext* pContext = 0;
+ const SvXMLTokenMap& rTokenMap = mrImportHelper.GetTableElemTokenMap();
+
+ switch( rTokenMap.Get( nPrefix, rLocalName ))
+ {
+ case XML_TOK_TABLE_HEADER_COLS:
+ mrTable.bHasHeaderColumn = true;
+ // fall through intended
+ case XML_TOK_TABLE_COLUMNS:
+ pContext = new SchXMLTableColumnsContext( mrImportHelper, GetImport(), rLocalName, mrTable );
+ break;
+
+ case XML_TOK_TABLE_COLUMN:
+ pContext = new SchXMLTableColumnContext( mrImportHelper, GetImport(), rLocalName, mrTable );
+ break;
+
+ case XML_TOK_TABLE_HEADER_ROWS:
+ mrTable.bHasHeaderRow = true;
+ // fall through intended
+ case XML_TOK_TABLE_ROWS:
+ pContext = new SchXMLTableRowsContext( mrImportHelper, GetImport(), rLocalName, mrTable );
+ break;
+
+ case XML_TOK_TABLE_ROW:
+ pContext = new SchXMLTableRowContext( mrImportHelper, GetImport(), rLocalName, mrTable );
+ break;
+
+ default:
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+ }
+
+ return pContext;
+}
+
+void SchXMLTableContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ // get table-name
+ sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
+
+ for( sal_Int16 i = 0; i < nAttrCount; i++ )
+ {
+ rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
+ rtl::OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ if ( nPrefix == XML_NAMESPACE_TABLE )
+ {
+ if ( IsXMLToken( aLocalName, XML_NAME ) )
+ {
+ mrTable.aTableNameOfFile = xAttrList->getValueByIndex( i );
+ }
+ else if ( IsXMLToken( aLocalName, XML_PROTECTED ) )
+ {
+ if ( IsXMLToken( xAttrList->getValueByIndex( i ), XML_TRUE ) )
+ {
+ mrTable.bProtected = true;
+ }
+ }
+ }
+ }
+}
+
+void SchXMLTableContext::EndElement()
+{
+ if( mbHasColumnPermutation )
+ {
+ OSL_ASSERT( !mbHasRowPermutation );
+ ::std::vector< sal_Int32 > aPermutation( lcl_SequenceToVector( maColumnPermutation ));
+ OSL_ASSERT( !aPermutation.empty());
+ if( aPermutation.empty())
+ return;
+
+ // permute the values of all rows according to aPermutation
+ for( ::std::vector< ::std::vector< SchXMLCell > >::iterator aRowIt( mrTable.aData.begin());
+ aRowIt != mrTable.aData.end(); ++aRowIt )
+ {
+ bool bModified = false;
+ ::std::vector< SchXMLCell > aModifiedRow;
+ const size_t nPermSize = aPermutation.size();
+ OSL_ASSERT( static_cast< sal_Int32 >( nPermSize ) - 1 == *(::std::max_element( aPermutation.begin(), aPermutation.end())));
+ const size_t nRowSize = aRowIt->size();
+ const size_t nDestSize = ::std::min( nPermSize, nRowSize );
+ for( size_t nDestinationIndex = 0; nDestinationIndex < nDestSize; ++nDestinationIndex )
+ {
+ const size_t nSourceIndex = static_cast< size_t >( aPermutation[ nDestinationIndex ] );
+ if( nSourceIndex != nDestinationIndex &&
+ nSourceIndex < nRowSize )
+ {
+ // copy original on first real permutation
+ if( !bModified )
+ {
+ OSL_ASSERT( aModifiedRow.empty());
+ aModifiedRow.reserve( aRowIt->size());
+ ::std::copy( aRowIt->begin(), aRowIt->end(), ::std::back_inserter( aModifiedRow ));
+ OSL_ASSERT( !aModifiedRow.empty());
+ }
+ OSL_ASSERT( nDestinationIndex < aModifiedRow.size());
+ aModifiedRow[ nDestinationIndex ] = (*aRowIt)[ nSourceIndex ];
+ bModified = true;
+ }
+ }
+ // copy back
+ if( bModified )
+ ::std::copy( aModifiedRow.begin(), aModifiedRow.end(), aRowIt->begin());
+ }
+ }
+ else if( mbHasRowPermutation )
+ {
+ ::std::vector< sal_Int32 > aPermutation( lcl_SequenceToVector( maRowPermutation ));
+ OSL_ASSERT( !aPermutation.empty());
+ if( aPermutation.empty())
+ return;
+
+ bool bModified = false;
+ const size_t nPermSize = aPermutation.size();
+ OSL_ASSERT( static_cast< sal_Int32 >( nPermSize ) - 1 == *(::std::max_element( aPermutation.begin(), aPermutation.end())));
+ const size_t nTableRowCount = mrTable.aData.size();
+ const size_t nDestSize = ::std::min( nPermSize, nTableRowCount );
+ ::std::vector< ::std::vector< SchXMLCell > > aDestination;
+ for( size_t nDestinationIndex = 0; nDestinationIndex < nDestSize; ++nDestinationIndex )
+ {
+ const size_t nSourceIndex = static_cast< size_t >( aPermutation[ nDestinationIndex ] );
+ if( nSourceIndex != nDestinationIndex &&
+ nSourceIndex < nTableRowCount )
+ {
+ // copy original on first real permutation
+ if( !bModified )
+ {
+ OSL_ASSERT( aDestination.empty());
+ aDestination.reserve( mrTable.aData.size());
+ ::std::copy( mrTable.aData.begin(), mrTable.aData.end(), ::std::back_inserter( aDestination ));
+ OSL_ASSERT( !aDestination.empty());
+ }
+ OSL_ASSERT( nDestinationIndex < aDestination.size());
+ aDestination[ nDestinationIndex ] = mrTable.aData[ nSourceIndex ];
+ bModified = true;
+ }
+ }
+ if( bModified )
+ {
+ // copy back
+ ::std::copy( aDestination.begin(), aDestination.end(), mrTable.aData.begin());
+ }
+ }
+}
+
+void SchXMLTableContext::setRowPermutation( const uno::Sequence< sal_Int32 > & rPermutation )
+{
+ maRowPermutation = rPermutation;
+ mbHasRowPermutation = ( rPermutation.getLength() > 0 );
+
+ if( mbHasRowPermutation && mbHasColumnPermutation )
+ {
+ mbHasColumnPermutation = false;
+ maColumnPermutation.realloc( 0 );
+ }
+}
+
+void SchXMLTableContext::setColumnPermutation( const uno::Sequence< sal_Int32 > & rPermutation )
+{
+ maColumnPermutation = rPermutation;
+ mbHasColumnPermutation = ( rPermutation.getLength() > 0 );
+
+ if( mbHasColumnPermutation && mbHasRowPermutation )
+ {
+ mbHasRowPermutation = false;
+ maRowPermutation.realloc( 0 );
+ }
+}
+
+// ========================================
+// classes for columns
+// ========================================
+
+// ----------------------------------------
+// class SchXMLTableColumnsContext
+// ----------------------------------------
+
+SchXMLTableColumnsContext::SchXMLTableColumnsContext(
+ SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport,
+ const rtl::OUString& rLocalName,
+ SchXMLTable& aTable ) :
+ SvXMLImportContext( rImport, XML_NAMESPACE_TABLE, rLocalName ),
+ mrImportHelper( rImpHelper ),
+ mrTable( aTable )
+{
+}
+
+SchXMLTableColumnsContext::~SchXMLTableColumnsContext()
+{
+}
+
+SvXMLImportContext* SchXMLTableColumnsContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList >& )
+{
+ SvXMLImportContext* pContext = 0;
+
+ if( nPrefix == XML_NAMESPACE_TABLE &&
+ IsXMLToken( rLocalName, XML_TABLE_COLUMN ) )
+ {
+ pContext = new SchXMLTableColumnContext( mrImportHelper, GetImport(), rLocalName, mrTable );
+ }
+ else
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+
+ return pContext;
+}
+
+// ----------------------------------------
+// class SchXMLTableColumnContext
+// ----------------------------------------
+
+SchXMLTableColumnContext::SchXMLTableColumnContext(
+ SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport,
+ const rtl::OUString& rLocalName,
+ SchXMLTable& aTable ) :
+ SvXMLImportContext( rImport, XML_NAMESPACE_TABLE, rLocalName ),
+ mrImportHelper( rImpHelper ),
+ mrTable( aTable )
+{
+}
+
+void SchXMLTableColumnContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ // get number-columns-repeated attribute
+ sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
+ sal_Int32 nRepeated = 1;
+ bool bHidden = false;
+
+ for( sal_Int16 i = 0; i < nAttrCount; i++ )
+ {
+ rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
+ rtl::OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+
+ if( nPrefix == XML_NAMESPACE_TABLE &&
+ IsXMLToken( aLocalName, XML_NUMBER_COLUMNS_REPEATED ) )
+ {
+ rtl::OUString aValue = xAttrList->getValueByIndex( i );
+ if( aValue.getLength())
+ nRepeated = aValue.toInt32();
+ }
+ else if( nPrefix == XML_NAMESPACE_TABLE &&
+ IsXMLToken( aLocalName, XML_VISIBILITY ) )
+ {
+ rtl::OUString aVisibility = xAttrList->getValueByIndex( i );
+ bHidden = aVisibility.equals( GetXMLToken( XML_COLLAPSE ) );
+ }
+ }
+
+ sal_Int32 nOldCount = mrTable.nNumberOfColsEstimate;
+ sal_Int32 nNewCount = nOldCount + nRepeated;
+ mrTable.nNumberOfColsEstimate = nNewCount;
+
+ if( bHidden )
+ {
+ //i91578 display of hidden values (copy paste scenario; use hidden flag during migration to locale table upon paste )
+ sal_Int32 nColOffset = ( mrTable.bHasHeaderColumn ? 1 : 0 );
+ for( sal_Int32 nN = nOldCount; nN<nNewCount; nN++ )
+ {
+ sal_Int32 nHiddenColumnIndex = nN-nColOffset;
+ if( nHiddenColumnIndex>=0 )
+ mrTable.aHiddenColumns.push_back(nHiddenColumnIndex);
+ }
+ }
+}
+
+SchXMLTableColumnContext::~SchXMLTableColumnContext()
+{
+}
+
+// ========================================
+// classes for rows
+// ========================================
+
+// ----------------------------------------
+// class SchXMLTableRowsContext
+// ----------------------------------------
+
+SchXMLTableRowsContext::SchXMLTableRowsContext(
+ SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport,
+ const rtl::OUString& rLocalName,
+ SchXMLTable& aTable ) :
+ SvXMLImportContext( rImport, XML_NAMESPACE_TABLE, rLocalName ),
+ mrImportHelper( rImpHelper ),
+ mrTable( aTable )
+{
+}
+
+SchXMLTableRowsContext::~SchXMLTableRowsContext()
+{
+}
+
+SvXMLImportContext* SchXMLTableRowsContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList >& )
+{
+ SvXMLImportContext* pContext = 0;
+
+ if( nPrefix == XML_NAMESPACE_TABLE &&
+ IsXMLToken( rLocalName, XML_TABLE_ROW ) )
+ {
+ pContext = new SchXMLTableRowContext( mrImportHelper, GetImport(), rLocalName, mrTable );
+ }
+ else
+ {
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+ }
+
+ return pContext;
+}
+
+// ----------------------------------------
+// class SchXMLTableRowContext
+// ----------------------------------------
+
+SchXMLTableRowContext::SchXMLTableRowContext(
+ SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport,
+ const rtl::OUString& rLocalName,
+ SchXMLTable& aTable ) :
+ SvXMLImportContext( rImport, XML_NAMESPACE_TABLE, rLocalName ),
+ mrImportHelper( rImpHelper ),
+ mrTable( aTable )
+{
+ mrTable.nColumnIndex = -1;
+ mrTable.nRowIndex++;
+
+ std::vector< SchXMLCell > aNewRow;
+ aNewRow.reserve( mrTable.nNumberOfColsEstimate );
+ while( mrTable.aData.size() <= (unsigned long)mrTable.nRowIndex )
+ mrTable.aData.push_back( aNewRow );
+}
+
+SchXMLTableRowContext::~SchXMLTableRowContext()
+{
+}
+
+SvXMLImportContext* SchXMLTableRowContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList >& )
+{
+ SvXMLImportContext* pContext = 0;
+
+ // <table:table-cell> element
+ if( nPrefix == XML_NAMESPACE_TABLE &&
+ IsXMLToken(rLocalName, XML_TABLE_CELL ) )
+ {
+ pContext = new SchXMLTableCellContext( mrImportHelper, GetImport(), rLocalName, mrTable );
+ }
+ else
+ {
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+ }
+
+ return pContext;
+}
+
+//---------------------------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------------------------
+
+class SchXMLRangeSomewhereContext : public SvXMLImportContext
+{
+//#i113950# previously the range was exported to attribute text:id,
+//but that attribute does not allow arbitrary strings anymore
+//so we need to find an alternative to save that range info for copy/paste scenario ...
+//-> use description at an empty group element for now
+
+private:
+ ::rtl::OUString& mrRangeString;
+ ::rtl::OUStringBuffer maRangeStringBuffer;
+
+public:
+ SchXMLRangeSomewhereContext( SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ ::rtl::OUString& rRangeString );
+ virtual ~SchXMLRangeSomewhereContext();
+
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+};
+
+//---------------------------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------------------------
+
+// ========================================
+// classes for cells and their content
+// ========================================
+
+// ----------------------------------------
+// class SchXMLTableCellContext
+// ----------------------------------------
+
+SchXMLTableCellContext::SchXMLTableCellContext(
+ SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport,
+ const rtl::OUString& rLocalName,
+ SchXMLTable& aTable ) :
+ SvXMLImportContext( rImport, XML_NAMESPACE_TABLE, rLocalName ),
+ mrImportHelper( rImpHelper ),
+ mrTable( aTable )
+{
+}
+
+SchXMLTableCellContext::~SchXMLTableCellContext()
+{
+}
+
+void SchXMLTableCellContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
+ rtl::OUString aValue;
+ rtl::OUString aLocalName;
+ rtl::OUString aCellContent;
+ SchXMLCellType eValueType = SCH_CELL_TYPE_UNKNOWN;
+ const SvXMLTokenMap& rAttrTokenMap = mrImportHelper.GetCellAttrTokenMap();
+
+ for( sal_Int16 i = 0; i < nAttrCount; i++ )
+ {
+ rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+
+ switch( rAttrTokenMap.Get( nPrefix, aLocalName ))
+ {
+ case XML_TOK_CELL_VAL_TYPE:
+ aValue = xAttrList->getValueByIndex( i );
+ if( IsXMLToken( aValue, XML_FLOAT ) )
+ eValueType = SCH_CELL_TYPE_FLOAT;
+ else if( IsXMLToken( aValue, XML_STRING ) )
+ eValueType = SCH_CELL_TYPE_STRING;
+ break;
+
+ case XML_TOK_CELL_VALUE:
+ aCellContent = xAttrList->getValueByIndex( i );
+ break;
+ }
+ }
+
+ mbReadText = sal_True;
+ SchXMLCell aCell;
+ aCell.eType = eValueType;
+
+ if( eValueType == SCH_CELL_TYPE_FLOAT )
+ {
+ double fData;
+ // the result may be false if a NaN is read, but that's ok
+ SvXMLUnitConverter::convertDouble( fData, aCellContent );
+
+ aCell.fValue = fData;
+ // dont read text from following <text:p> or <text:list> element
+ mbReadText = sal_False;
+ }
+
+ mrTable.aData[ mrTable.nRowIndex ].push_back( aCell );
+ mrTable.nColumnIndex++;
+ if( mrTable.nMaxColumnIndex < mrTable.nColumnIndex )
+ mrTable.nMaxColumnIndex = mrTable.nColumnIndex;
+}
+
+SvXMLImportContext* SchXMLTableCellContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList >& )
+{
+ SvXMLImportContext* pContext = 0;
+
+ // <text:list> element
+ if( nPrefix == XML_NAMESPACE_TEXT && IsXMLToken( rLocalName, XML_LIST ) && mbReadText )
+ {
+ SchXMLCell& rCell = mrTable.aData[ mrTable.nRowIndex ][ mrTable.nColumnIndex ];
+ rCell.pComplexString = new Sequence< OUString >();
+ rCell.eType = SCH_CELL_TYPE_COMPLEX_STRING;
+ pContext = new SchXMLTextListContext( GetImport(), rLocalName, *rCell.pComplexString );
+ mbReadText = sal_False;//don't apply text from <text:p>
+ }
+ // <text:p> element - read text (and range from text:id old version)
+ else if( nPrefix == XML_NAMESPACE_TEXT && IsXMLToken( rLocalName, XML_P ) )
+ {
+ pContext = new SchXMLParagraphContext( GetImport(), rLocalName, maCellContent, &maRangeId );
+ }
+ // <draw:g> element - read range
+ else if( nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( rLocalName, XML_G ) )
+ {
+ //#i113950# previously the range was exported to attribute text:id, but that attribute does not allow arbitrary strings anymore
+ //so we need to find an alternative to save that range info for copy/paste scenario ... -> use description at an empty group element for now
+ pContext = new SchXMLRangeSomewhereContext( GetImport(), nPrefix, rLocalName, maRangeId );
+ }
+ else
+ {
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+ }
+
+ return pContext;
+}
+
+void SchXMLTableCellContext::EndElement()
+{
+ if( mbReadText && maCellContent.getLength() ) //apply text from <text:p> element
+ mrTable.aData[ mrTable.nRowIndex ][ mrTable.nColumnIndex ].aString = maCellContent;
+ if( maRangeId.getLength())
+ mrTable.aData[ mrTable.nRowIndex ][ mrTable.nColumnIndex ].aRangeId = maRangeId;
+}
+
+// ========================================
+
+void lcl_ApplyCellToComplexLabel( const SchXMLCell& rCell, Sequence< uno::Any >& rComplexLabel )
+{
+ if( rCell.eType == SCH_CELL_TYPE_STRING )
+ {
+ rComplexLabel.realloc(1);
+ rComplexLabel[0] = uno::makeAny( rCell.aString );
+ }
+ else if( rCell.pComplexString && rCell.eType == SCH_CELL_TYPE_COMPLEX_STRING )
+ {
+ sal_Int32 nCount = rCell.pComplexString->getLength();
+ rComplexLabel.realloc( nCount );
+ for( sal_Int32 nN=0; nN<nCount; nN++)
+ rComplexLabel[nN] = uno::makeAny((*rCell.pComplexString)[nN]);
+ }
+ else if( rCell.eType == SCH_CELL_TYPE_FLOAT )
+ {
+ rComplexLabel.realloc(1);
+ rComplexLabel[0] = uno::makeAny( rCell.fValue );
+ }
+}
+
+void SchXMLTableHelper::applyTableToInternalDataProvider(
+ const SchXMLTable& rTable,
+ uno::Reference< chart2::XChartDocument > xChartDoc )
+{
+ // apply all data read from the local table to the internal data provider
+ if( !xChartDoc.is() || !xChartDoc->hasInternalDataProvider() )
+ return;
+ Reference< chart2::data::XDataProvider > xDataProv( xChartDoc->getDataProvider() );
+ if( !xDataProv.is() )
+ return;
+
+ //prepare the read local table data
+ sal_Int32 nNumRows( static_cast< sal_Int32 >( rTable.aData.size()));
+ sal_Int32 nRowOffset = 0;
+ if( rTable.bHasHeaderRow )
+ {
+ --nNumRows;
+ nRowOffset = 1;
+ }
+ sal_Int32 nNumColumns( rTable.nMaxColumnIndex + 1 );
+ sal_Int32 nColOffset = 0;
+ if( rTable.bHasHeaderColumn )
+ {
+ --nNumColumns;
+ nColOffset = 1;
+ }
+
+ Sequence< Sequence< double > > aDataInRows( nNumRows );
+ Sequence< Sequence< uno::Any > > aComplexRowDescriptions( nNumRows );
+ Sequence< Sequence< uno::Any > > aComplexColumnDescriptions( nNumColumns );
+ for( sal_Int32 i=0; i<nNumRows; ++i )
+ aDataInRows[i].realloc( nNumColumns );
+
+ if( rTable.aData.begin() != rTable.aData.end())
+ {
+ //apply column labels
+ if( rTable.bHasHeaderRow )
+ {
+ const ::std::vector< SchXMLCell >& rFirstRow = rTable.aData.front();
+ const sal_Int32 nColumnLabelsSize = aComplexColumnDescriptions.getLength();
+ const sal_Int32 nMax = ::std::min< sal_Int32 >( nColumnLabelsSize, static_cast< sal_Int32 >( rFirstRow.size()) - nColOffset );
+ OSL_ASSERT( nMax == nColumnLabelsSize );
+ for( sal_Int32 i=0; i<nMax; ++i )
+ lcl_ApplyCellToComplexLabel( rFirstRow[i+nColOffset], aComplexColumnDescriptions[i] );
+ }
+
+ std::vector< ::std::vector< SchXMLCell > >::const_iterator aRowIter( rTable.aData.begin() + nRowOffset );
+ std::vector< ::std::vector< SchXMLCell > >::const_iterator aEnd( rTable.aData.end() );
+ for( sal_Int32 nRow = 0; aRowIter != aEnd && nRow < nNumRows; ++aRowIter, ++nRow )
+ {
+ const ::std::vector< SchXMLCell >& rRow = *aRowIter;
+ if( !rRow.empty() )
+ {
+ // row label
+ if( rTable.bHasHeaderColumn )
+ lcl_ApplyCellToComplexLabel( rRow.front(), aComplexRowDescriptions[nRow] );
+
+ // values
+ Sequence< double >& rTargetRow = aDataInRows[nRow];
+ lcl_ApplyCellToData aApplyCellToData = ::std::for_each( rRow.begin() + nColOffset, rRow.end(), lcl_ApplyCellToData( rTargetRow ) );
+ double fNaN = 0.0;
+ ::rtl::math::setNan( &fNaN );
+ for( sal_Int32 nCurrentIndex = aApplyCellToData.getCurrentIndex(); nCurrentIndex<nNumColumns; nCurrentIndex++ )
+ rTargetRow[nCurrentIndex] = fNaN;//#i110615#
+ }
+ }
+ }
+
+ //apply the collected data to the chart
+ Reference< chart2::XAnyDescriptionAccess > xDataAccess( xDataProv, uno::UNO_QUERY );
+ if( !xDataAccess.is() )
+ return;
+
+ xDataAccess->setData( aDataInRows );
+ if( rTable.bHasHeaderColumn )
+ xDataAccess->setAnyRowDescriptions( aComplexRowDescriptions );
+ if( rTable.bHasHeaderRow )
+ xDataAccess->setAnyColumnDescriptions( aComplexColumnDescriptions );
+
+ if ( rTable.bProtected )
+ {
+ try
+ {
+ Reference< beans::XPropertySet > xProps( xChartDoc, uno::UNO_QUERY_THROW );
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "DisableDataTableDialog" ) ), uno::makeAny( sal_True ) );
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "DisableComplexChartTypes" ) ), uno::makeAny( sal_True ) );
+ }
+ catch ( uno::Exception& )
+ {
+ }
+ }
+}
+
+void SchXMLTableHelper::switchRangesFromOuterToInternalIfNecessary(
+ const SchXMLTable& rTable,
+ const tSchXMLLSequencesPerIndex & rLSequencesPerIndex,
+ uno::Reference< chart2::XChartDocument > xChartDoc,
+ chart::ChartDataRowSource eDataRowSource )
+{
+ if( ! (xChartDoc.is() && xChartDoc->hasInternalDataProvider()))
+ return;
+
+ // If the range-strings are valid (starting with "local-table") they should
+ // be interpreted like given, otherwise (when the ranges refer to Calc- or
+ // Writer-ranges, but the container is not available like when pasting a
+ // chart from Calc to Impress) the range is ignored, and every object gets
+ // one table column in the order of appearance, which is: 1. categories,
+ // 2. data series: 2.a) domains, 2.b) values (main-role, usually y-values)
+
+ Reference< chart2::data::XDataProvider > xDataProv( xChartDoc->getDataProvider());
+
+ // create a mapping from original ranges to new ranges
+ lcl_tOriginalRangeToInternalRangeMap aRangeMap;
+
+ lcl_fillRangeMapping( rTable, aRangeMap, eDataRowSource );
+
+ bool bCategoriesApplied = false;
+ // translate ranges (using the map created before)
+ for( tSchXMLLSequencesPerIndex::const_iterator aLSeqIt( rLSequencesPerIndex.begin());
+ aLSeqIt != rLSequencesPerIndex.end(); ++aLSeqIt )
+ {
+ if( aLSeqIt->second.is())
+ {
+ // values/error bars/categories
+ if( aLSeqIt->first.second == SCH_XML_PART_VALUES ||
+ aLSeqIt->first.second == SCH_XML_PART_ERROR_BARS )
+ {
+ Reference< chart2::data::XDataSequence > xSeq( aLSeqIt->second->getValues());
+ OUString aRange;
+ if( xSeq.is() &&
+ SchXMLTools::getXMLRangePropertyFromDataSequence( xSeq, aRange, /* bClearProp = */ true ) &&
+ lcl_mapContainsRange( aRangeMap, aRange ))
+ {
+ Reference< chart2::data::XDataSequence > xNewSeq(
+ lcl_reassignDataSequence( xSeq, xDataProv, aRangeMap, aRange ));
+ if( xNewSeq != xSeq )
+ {
+ SchXMLTools::copyProperties( Reference< beans::XPropertySet >( xSeq, uno::UNO_QUERY ),
+ Reference< beans::XPropertySet >( xNewSeq, uno::UNO_QUERY ));
+ aLSeqIt->second->setValues( xNewSeq );
+ }
+ }
+ else
+ {
+ if( lcl_tableOfRangeMatches( aRange, rTable.aTableNameOfFile ))
+ {
+ if( aLSeqIt->first.first == SCH_XML_CATEGORIES_INDEX )
+ bCategoriesApplied = true;
+ }
+ else
+ {
+ if( aLSeqIt->first.first == SCH_XML_CATEGORIES_INDEX )
+ {
+ Reference< beans::XPropertySet > xOldSequenceProp( aLSeqIt->second->getValues(), uno::UNO_QUERY );
+ Reference< chart2::data::XDataSequence > xNewSequence(
+ xDataProv->createDataSequenceByRangeRepresentation(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("categories"))));
+ SchXMLTools::copyProperties(
+ xOldSequenceProp, Reference< beans::XPropertySet >( xNewSequence, uno::UNO_QUERY ));
+ aLSeqIt->second->setValues( xNewSequence );
+ bCategoriesApplied = true;
+ }
+ else
+ {
+ Reference< beans::XPropertySet > xOldSequenceProp( aLSeqIt->second->getValues(), uno::UNO_QUERY );
+ OUString aRep( OUString::valueOf( aLSeqIt->first.first ));
+ Reference< chart2::data::XDataSequence > xNewSequence(
+ xDataProv->createDataSequenceByRangeRepresentation( aRep ));
+ SchXMLTools::copyProperties(
+ xOldSequenceProp, Reference< beans::XPropertySet >( xNewSequence, uno::UNO_QUERY ));
+ aLSeqIt->second->setValues( xNewSequence );
+ }
+ }
+ }
+ }
+ else // labels
+ {
+ OSL_ASSERT( aLSeqIt->first.second == SCH_XML_PART_LABEL );
+ // labels
+ Reference< chart2::data::XDataSequence > xSeq( aLSeqIt->second->getLabel());
+ OUString aRange;
+ if( xSeq.is() &&
+ SchXMLTools::getXMLRangePropertyFromDataSequence( xSeq, aRange, /* bClearProp = */ true ) &&
+ lcl_mapContainsRange( aRangeMap, aRange ))
+ {
+ Reference< chart2::data::XDataSequence > xNewSeq(
+ lcl_reassignDataSequence( xSeq, xDataProv, aRangeMap, aRange ));
+ if( xNewSeq != xSeq )
+ {
+ SchXMLTools::copyProperties( Reference< beans::XPropertySet >( xSeq, uno::UNO_QUERY ),
+ Reference< beans::XPropertySet >( xNewSeq, uno::UNO_QUERY ));
+ aLSeqIt->second->setLabel( xNewSeq );
+ }
+ }
+ else if( ! lcl_tableOfRangeMatches( aRange, rTable.aTableNameOfFile ))
+ {
+ OUString aRep( RTL_CONSTASCII_USTRINGPARAM("label "));
+ aRep += OUString::valueOf( aLSeqIt->first.first );
+
+ Reference< chart2::data::XDataSequence > xNewSeq(
+ xDataProv->createDataSequenceByRangeRepresentation( aRep ));
+ SchXMLTools::copyProperties( Reference< beans::XPropertySet >( xSeq, uno::UNO_QUERY ),
+ Reference< beans::XPropertySet >( xNewSeq, uno::UNO_QUERY ));
+ aLSeqIt->second->setLabel( xNewSeq );
+ }
+ }
+ }
+ }
+
+ // there exist files with own data without a categories element but with row
+ // descriptions. The row descriptions were used as categories even without
+ // the categories element
+ if( ! bCategoriesApplied )
+ {
+ SchXMLTools::CreateCategories(
+ xDataProv, xChartDoc, OUString(RTL_CONSTASCII_USTRINGPARAM("categories")),
+ 0 /* nCooSysIndex */, 0 /* nDimension */ );
+ }
+
+ //i91578 display of hidden values (copy paste scenario; use hidden flag during migration to locale table upon paste )
+ //remove series that consist only of hidden columns
+ Reference< chart2::XInternalDataProvider > xInternalDataProvider( xDataProv, uno::UNO_QUERY );
+ if( xInternalDataProvider.is() && !rTable.aHiddenColumns.empty() )
+ {
+ try
+ {
+ Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xChartDoc->getFirstDiagram(), uno::UNO_QUERY_THROW );
+ Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems() );
+ for( sal_Int32 nC=0; nC<aCooSysSeq.getLength(); ++nC )
+ {
+ Reference< chart2::XChartTypeContainer > xCooSysContainer( aCooSysSeq[nC], uno::UNO_QUERY_THROW );
+ Sequence< Reference< chart2::XChartType > > aChartTypeSeq( xCooSysContainer->getChartTypes());
+ for( sal_Int32 nT=0; nT<aChartTypeSeq.getLength(); ++nT )
+ {
+ Reference< chart2::XDataSeriesContainer > xSeriesContainer( aChartTypeSeq[nT], uno::UNO_QUERY );
+ if(!xSeriesContainer.is())
+ continue;
+ Sequence< Reference< chart2::XDataSeries > > aSeriesSeq( xSeriesContainer->getDataSeries() );
+ std::vector< Reference< chart2::XDataSeries > > aRemainingSeries;
+
+ for( sal_Int32 nS = 0; nS < aSeriesSeq.getLength(); nS++ )
+ {
+ Reference< chart2::data::XDataSource > xDataSource( aSeriesSeq[nS], uno::UNO_QUERY );
+ if( xDataSource.is() )
+ {
+ bool bHasUnhiddenColumns = false;
+ rtl::OUString aRange;
+ uno::Sequence< Reference< chart2::data::XLabeledDataSequence > > aSequences( xDataSource->getDataSequences() );
+ for( sal_Int32 nN=0; nN< aSequences.getLength(); ++nN )
+ {
+ Reference< chart2::data::XLabeledDataSequence > xLabeledSequence( aSequences[nN] );
+ if(!xLabeledSequence.is())
+ continue;
+ Reference< chart2::data::XDataSequence > xValues( xLabeledSequence->getValues() );
+ if( xValues.is() )
+ {
+ aRange = xValues->getSourceRangeRepresentation();
+ if( ::std::find( rTable.aHiddenColumns.begin(), rTable.aHiddenColumns.end(), aRange.toInt32() ) == rTable.aHiddenColumns.end() )
+ bHasUnhiddenColumns = true;
+ }
+ if( !bHasUnhiddenColumns )
+ {
+ Reference< chart2::data::XDataSequence > xLabel( xLabeledSequence->getLabel() );
+ if( xLabel.is() )
+ {
+ aRange = xLabel->getSourceRangeRepresentation();
+ sal_Int32 nSearchIndex = 0;
+ OUString aSecondToken = aRange.getToken( 1, ' ', nSearchIndex );
+ if( ::std::find( rTable.aHiddenColumns.begin(), rTable.aHiddenColumns.end(), aSecondToken.toInt32() ) == rTable.aHiddenColumns.end() )
+ bHasUnhiddenColumns = true;
+ }
+ }
+ }
+ if( bHasUnhiddenColumns )
+ aRemainingSeries.push_back( aSeriesSeq[nS] );
+ }
+ }
+
+ if( static_cast<sal_Int32>(aRemainingSeries.size()) != aSeriesSeq.getLength() )
+ {
+ //remove the series that have only hidden data
+ Sequence< Reference< chart2::XDataSeries > > aRemainingSeriesSeq( aRemainingSeries.size());
+ ::std::copy( aRemainingSeries.begin(), aRemainingSeries.end(), aRemainingSeriesSeq.getArray());
+ xSeriesContainer->setDataSeries( aRemainingSeriesSeq );
+
+ //remove unused sequences
+ Reference< chart2::data::XDataSource > xDataSource( xChartDoc, uno::UNO_QUERY );
+ if( xDataSource.is() )
+ {
+ //first detect which collumns are really used
+ std::map< sal_Int32, bool > aUsageMap;
+ rtl::OUString aRange;
+ Sequence< Reference< chart2::data::XLabeledDataSequence > > aUsedSequences( xDataSource->getDataSequences() );
+ for( sal_Int32 nN=0; nN< aUsedSequences.getLength(); ++nN )
+ {
+ Reference< chart2::data::XLabeledDataSequence > xLabeledSequence( aUsedSequences[nN] );
+ if(!xLabeledSequence.is())
+ continue;
+ Reference< chart2::data::XDataSequence > xValues( xLabeledSequence->getValues() );
+ if( xValues.is() )
+ {
+ aRange = xValues->getSourceRangeRepresentation();
+ sal_Int32 nIndex = aRange.toInt32();
+ if( nIndex!=0 || !aRange.equals(lcl_aCategoriesRange) )
+ aUsageMap[nIndex] = true;
+ }
+ Reference< chart2::data::XDataSequence > xLabel( xLabeledSequence->getLabel() );
+ if( xLabel.is() )
+ {
+ aRange = xLabel->getSourceRangeRepresentation();
+ sal_Int32 nSearchIndex = 0;
+ OUString aSecondToken = aRange.getToken( 1, ' ', nSearchIndex );
+ if( aSecondToken.getLength() )
+ aUsageMap[aSecondToken.toInt32()] = true;
+ }
+ }
+
+ ::std::vector< sal_Int32 > aSequenceIndexesToDelete;
+ for( ::std::vector< sal_Int32 >::const_iterator aIt(
+ rTable.aHiddenColumns.begin()); aIt != rTable.aHiddenColumns.end(); ++aIt )
+ {
+ sal_Int32 nSequenceIndex = *aIt;
+ if( aUsageMap.find(nSequenceIndex) != aUsageMap.end() )
+ continue;
+ aSequenceIndexesToDelete.push_back(nSequenceIndex);
+ }
+
+ // delete unnecessary sequences of the internal data
+ // iterate using greatest index first, so that deletion does not
+ // shift other sequences that will be deleted later
+ ::std::sort( aSequenceIndexesToDelete.begin(), aSequenceIndexesToDelete.end());
+ for( ::std::vector< sal_Int32 >::reverse_iterator aIt(
+ aSequenceIndexesToDelete.rbegin()); aIt != aSequenceIndexesToDelete.rend(); ++aIt )
+ {
+ if( *aIt != -1 )
+ xInternalDataProvider->deleteSequence( *aIt );
+ }
+ }
+ }
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ (void)ex; // avoid warning for pro build
+ }
+ }
+}
+
+//---------------------------------------------------------------------------------------------------
+
+SchXMLRangeSomewhereContext::SchXMLRangeSomewhereContext( SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ OUString& rRangeString ) :
+ SvXMLImportContext( rImport, nPrefix, rLocalName ),
+ mrRangeString( rRangeString )
+{
+}
+
+SchXMLRangeSomewhereContext::~SchXMLRangeSomewhereContext()
+{
+}
+
+SvXMLImportContext* SchXMLRangeSomewhereContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList >& )
+{
+ if( XML_NAMESPACE_SVG == nPrefix && IsXMLToken( rLocalName, XML_DESC ) )
+ {
+ return new XMLStringBufferImportContext(
+ GetImport(), nPrefix, rLocalName, maRangeStringBuffer );
+ }
+ return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+}
+
+void SchXMLRangeSomewhereContext::EndElement()
+{
+ mrRangeString = maRangeStringBuffer.makeStringAndClear();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/SchXMLTableContext.hxx b/xmloff/source/chart/SchXMLTableContext.hxx
new file mode 100644
index 000000000000..5deee981cc9e
--- /dev/null
+++ b/xmloff/source/chart/SchXMLTableContext.hxx
@@ -0,0 +1,231 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _SCH_XMLTABLECONTEXT_HXX_
+#define _SCH_XMLTABLECONTEXT_HXX_
+
+#include <xmloff/xmlictxt.hxx>
+#include "SchXMLImport.hxx"
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <com/sun/star/chart/ChartDataRowSource.hpp>
+
+#include "transporttypes.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace frame {
+ class XModel;
+ }
+ namespace xml { namespace sax {
+ class XAttributeList;
+ }}
+ namespace chart {
+ class XChartDocument;
+ struct ChartSeriesAddress;
+}}}}
+
+// ========================================
+
+class SchXMLTableContext : public SvXMLImportContext
+{
+private:
+ SchXMLImportHelper& mrImportHelper;
+ SchXMLTable& mrTable;
+
+ bool mbHasRowPermutation;
+ bool mbHasColumnPermutation;
+ ::com::sun::star::uno::Sequence< sal_Int32 > maRowPermutation;
+ ::com::sun::star::uno::Sequence< sal_Int32 > maColumnPermutation;
+
+public:
+ SchXMLTableContext( SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport,
+ const rtl::OUString& rLocalName,
+ SchXMLTable& aTable );
+ virtual ~SchXMLTableContext();
+
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+
+ void setRowPermutation( const ::com::sun::star::uno::Sequence< sal_Int32 > & rPermutation );
+ void setColumnPermutation( const ::com::sun::star::uno::Sequence< sal_Int32 > & rPermutation );
+};
+
+// ----------------------------------------
+
+class SchXMLTableHelper
+{
+private:
+ static void GetCellAddress( const rtl::OUString& rStr, sal_Int32& rCol, sal_Int32& rRow );
+ static sal_Bool GetCellRangeAddress( const rtl::OUString& rStr, SchNumericCellRangeAddress& rResult );
+ static void PutTableContentIntoSequence(
+ const SchXMLTable& rTable,
+ SchNumericCellRangeAddress& rAddress,
+ sal_Int32 nSeriesIndex,
+ com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< double > >& aSequence );
+ static void AdjustMax( const SchNumericCellRangeAddress& rAddr,
+ sal_Int32& nRows, sal_Int32& nColumns );
+
+public:
+ static void applyTableToInternalDataProvider( const SchXMLTable& rTable,
+ com::sun::star::uno::Reference< com::sun::star::chart2::XChartDocument > xChartDoc );
+
+ /** This function reorders local data to fit the correct data structure.
+ Call it after the data series got their styles set.
+ */
+ static void switchRangesFromOuterToInternalIfNecessary( const SchXMLTable& rTable,
+ const tSchXMLLSequencesPerIndex & rLSequencesPerIndex,
+ com::sun::star::uno::Reference< com::sun::star::chart2::XChartDocument > xChartDoc,
+ ::com::sun::star::chart::ChartDataRowSource eDataRowSource );
+};
+
+// ========================================
+
+// ----------------------------------------
+// classes for columns
+// ----------------------------------------
+
+/** With this context all column elements are parsed to
+ determine the index of the column containing
+ the row descriptions and probably get an estimate
+ for the altogether number of columns
+ */
+class SchXMLTableColumnsContext : public SvXMLImportContext
+{
+private:
+ SchXMLImportHelper& mrImportHelper;
+ SchXMLTable& mrTable;
+
+public:
+ SchXMLTableColumnsContext( SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport,
+ const rtl::OUString& rLocalName,
+ SchXMLTable& aTable );
+ virtual ~SchXMLTableColumnsContext();
+
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
+};
+
+// ----------------------------------------
+
+class SchXMLTableColumnContext : public SvXMLImportContext
+{
+private:
+ SchXMLImportHelper& mrImportHelper;
+ SchXMLTable& mrTable;
+
+public:
+ SchXMLTableColumnContext( SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport,
+ const rtl::OUString& rLocalName,
+ SchXMLTable& aTable );
+ virtual ~SchXMLTableColumnContext();
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+};
+
+// ----------------------------------------
+// classes for rows
+// ----------------------------------------
+
+class SchXMLTableRowsContext : public SvXMLImportContext
+{
+private:
+ SchXMLImportHelper& mrImportHelper;
+ SchXMLTable& mrTable;
+
+public:
+ SchXMLTableRowsContext( SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport,
+ const rtl::OUString& rLocalName,
+ SchXMLTable& aTable );
+ virtual ~SchXMLTableRowsContext();
+
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
+};
+
+// ----------------------------------------
+
+class SchXMLTableRowContext : public SvXMLImportContext
+{
+private:
+ SchXMLImportHelper& mrImportHelper;
+ SchXMLTable& mrTable;
+
+public:
+ SchXMLTableRowContext( SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport,
+ const rtl::OUString& rLocalName,
+ SchXMLTable& aTable );
+ virtual ~SchXMLTableRowContext();
+
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
+};
+
+// ----------------------------------------
+// classes for cells and their content
+// ----------------------------------------
+
+class SchXMLTableCellContext : public SvXMLImportContext
+{
+private:
+ SchXMLImportHelper& mrImportHelper;
+ SchXMLTable& mrTable;
+ rtl::OUString maCellContent;
+ rtl::OUString maRangeId;
+ sal_Bool mbReadText;
+
+public:
+ SchXMLTableCellContext( SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport,
+ const rtl::OUString& rLocalName,
+ SchXMLTable& aTable );
+ virtual ~SchXMLTableCellContext();
+
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+};
+
+#endif // _SCH_XMLTABLECONTEXT_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/SchXMLTextListContext.cxx b/xmloff/source/chart/SchXMLTextListContext.cxx
new file mode 100644
index 000000000000..21a1d947ec31
--- /dev/null
+++ b/xmloff/source/chart/SchXMLTextListContext.cxx
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "SchXMLImport.hxx"
+#include "SchXMLTextListContext.hxx"
+#include "SchXMLParagraphContext.hxx"
+
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/nmspmap.hxx>
+
+using ::rtl::OUString;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using namespace com::sun::star;
+using namespace ::xmloff::token;
+
+//-------------------------------------------------
+class SchXMLListItemContext : public SvXMLImportContext
+{
+public:
+ SchXMLListItemContext( SvXMLImport& rImport, const OUString& rLocalName, OUString& rText );
+ virtual ~SchXMLListItemContext();
+ virtual void StartElement( const Reference< xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+private:
+ ::rtl::OUString& m_rText;
+};
+
+SchXMLListItemContext::SchXMLListItemContext(
+ SvXMLImport& rImport
+ , const OUString& rLocalName
+ , OUString& rText )
+ : SvXMLImportContext( rImport, XML_NAMESPACE_TEXT, rLocalName )
+ , m_rText( rText )
+{
+}
+
+SchXMLListItemContext::~SchXMLListItemContext()
+{}
+
+void SchXMLListItemContext::StartElement( const Reference< xml::sax::XAttributeList >& /*xAttrList*/ )
+{
+}
+
+void SchXMLListItemContext::EndElement()
+{
+}
+
+SvXMLImportContext* SchXMLListItemContext::CreateChildContext(
+ sal_uInt16 nPrefix, const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList >& )
+{
+ SvXMLImportContext* pContext = 0;
+ if( nPrefix == XML_NAMESPACE_TEXT && IsXMLToken( rLocalName, XML_P ) )
+ pContext = new SchXMLParagraphContext( GetImport(), rLocalName, m_rText );
+ else
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+ return pContext;
+}
+
+//-------------------------------------------------
+
+SchXMLTextListContext::SchXMLTextListContext(
+ SvXMLImport& rImport
+ , const OUString& rLocalName
+ , Sequence< OUString>& rTextList )
+ : SvXMLImportContext( rImport, XML_NAMESPACE_TEXT, rLocalName )
+ , m_rTextList( rTextList )
+ , m_aTextVector()
+{
+}
+
+SchXMLTextListContext::~SchXMLTextListContext()
+{
+}
+
+void SchXMLTextListContext::StartElement( const Reference< xml::sax::XAttributeList >& /*xAttrList*/ )
+{
+}
+
+void SchXMLTextListContext::EndElement()
+{
+ sal_Int32 nCount = m_aTextVector.size();
+ m_rTextList.realloc(nCount);
+ for( sal_Int32 nN=0; nN<nCount; nN++ )
+ m_rTextList[nN]=m_aTextVector[nN];
+}
+
+SvXMLImportContext* SchXMLTextListContext::CreateChildContext(
+ sal_uInt16 nPrefix, const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList >& )
+{
+ SvXMLImportContext* pContext = 0;
+ if( nPrefix == XML_NAMESPACE_TEXT && IsXMLToken( rLocalName, XML_LIST_ITEM ) )
+ {
+ m_aTextVector.push_back( OUString() );
+ pContext = new SchXMLListItemContext( GetImport(), rLocalName, m_aTextVector.back() );
+ }
+ else
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+ return pContext;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/SchXMLTextListContext.hxx b/xmloff/source/chart/SchXMLTextListContext.hxx
new file mode 100644
index 000000000000..25e1de6aa79c
--- /dev/null
+++ b/xmloff/source/chart/SchXMLTextListContext.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _SCH_XMLTEXTLISTCONTEXT_HXX_
+#define _SCH_XMLTEXTLISTCONTEXT_HXX_
+
+#include <xmloff/xmlictxt.hxx>
+#include "rtl/ustring.hxx"
+#include <vector>
+
+namespace com { namespace sun { namespace star { namespace xml { namespace sax {
+ class XAttributeList;
+}}}}}
+
+class SchXMLTextListContext : public SvXMLImportContext
+{
+public:
+ SchXMLTextListContext( SvXMLImport& rImport,
+ const ::rtl::OUString& rLocalName,
+ ::com::sun::star::uno::Sequence< ::rtl::OUString>& rTextList );
+ virtual ~SchXMLTextListContext();
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+private:
+ ::com::sun::star::uno::Sequence< ::rtl::OUString>& m_rTextList;
+ std::vector< ::rtl::OUString> m_aTextVector;
+};
+
+#endif // _SCH_XMLTEXTLISTCONTEXT_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/SchXMLTools.cxx b/xmloff/source/chart/SchXMLTools.cxx
new file mode 100644
index 000000000000..cfe5553b6c56
--- /dev/null
+++ b/xmloff/source/chart/SchXMLTools.cxx
@@ -0,0 +1,896 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "SchXMLTools.hxx"
+
+#include <rtl/ustrbuf.hxx>
+#include <comphelper/InlineContainer.hxx>
+// header for class SvXMLUnitConverter
+#include <xmloff/xmluconv.hxx>
+// header for struct SvXMLEnumMapEntry
+#include <xmloff/xmlement.hxx>
+#include <tools/solar.h>
+
+// header for class SvXMLImportPropertyMapper
+#include <xmloff/xmlimppr.hxx>
+// header for class XMLPropStyleContext
+#include <xmloff/prstylei.hxx>
+// header for class XMLPropertySetMapper
+#include <xmloff/xmlprmap.hxx>
+#include <xmloff/xmlexp.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmlmetai.hxx>
+
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/chart2/data/XDataProvider.hpp>
+#include <com/sun/star/chart2/data/XDataReceiver.hpp>
+#include <com/sun/star/chart2/data/XRangeXMLConversion.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
+#include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+#include <com/sun/star/lang/XServiceName.hpp>
+
+#include <comphelper/processfactory.hxx>
+
+using namespace com::sun::star;
+using namespace ::xmloff::token;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+
+namespace
+{
+Reference< uno::XComponentContext > lcl_getComponentContext()
+{
+ Reference< uno::XComponentContext > xContext;
+ try
+ {
+ Reference< beans::XPropertySet > xFactProp( comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
+ if( xFactProp.is())
+ xFactProp->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xContext;
+ }
+ catch( uno::Exception& )
+ {}
+
+ return xContext;
+}
+
+rtl::OUString lcl_getGeneratorFromModel( const uno::Reference< frame::XModel >& xChartModel )
+{
+ ::rtl::OUString aGenerator;
+ uno::Reference< document::XDocumentPropertiesSupplier> xChartDocumentPropertiesSupplier( xChartModel, uno::UNO_QUERY );
+ if( xChartDocumentPropertiesSupplier.is() )
+ {
+ uno::Reference< document::XDocumentProperties > xChartDocumentProperties(
+ xChartDocumentPropertiesSupplier->getDocumentProperties());
+ if( xChartDocumentProperties.is() )
+ aGenerator = xChartDocumentProperties->getGenerator();
+ }
+ return aGenerator;
+}
+
+rtl::OUString lcl_getGeneratorFromModelOrItsParent( const uno::Reference< frame::XModel >& xChartModel )
+{
+ ::rtl::OUString aGenerator( lcl_getGeneratorFromModel(xChartModel) );
+ if( !aGenerator.getLength() ) //try to get the missing info from the parent document
+ {
+ uno::Reference< container::XChild > xChild( xChartModel, uno::UNO_QUERY );
+ if( xChild.is() )
+ aGenerator = lcl_getGeneratorFromModel( uno::Reference< frame::XModel >( xChild->getParent(), uno::UNO_QUERY) );
+ }
+ return aGenerator;
+}
+
+sal_Int32 lcl_getBuildIDFromGenerator( const ::rtl::OUString& rGenerator )
+{
+ //returns -1 if nothing found
+ sal_Int32 nBuildId = -1;
+ const OUString sBuildCompare( RTL_CONSTASCII_USTRINGPARAM( "$Build-" ) );
+ sal_Int32 nEnd = -1;
+ sal_Int32 nBegin = rGenerator.indexOf( sBuildCompare, nEnd );
+ if( nBegin != -1 )
+ {
+ OUString sBuildId( rGenerator.copy( nBegin + sBuildCompare.getLength() ) );
+ nBuildId = sBuildId.toInt32();
+ }
+ return nBuildId;
+}
+
+OUString lcl_ConvertRange( const ::rtl::OUString & rRange, const Reference< chart2::data::XDataProvider >& xDataProvider )
+{
+ OUString aResult = rRange;
+ Reference< chart2::data::XRangeXMLConversion > xRangeConversion( xDataProvider, uno::UNO_QUERY );
+ if( xRangeConversion.is())
+ aResult = xRangeConversion->convertRangeFromXML( rRange );
+ return aResult;
+}
+
+Reference< chart2::data::XDataSequence > lcl_createNewSequenceFromCachedXMLRange( const Reference< chart2::data::XDataSequence >& xSeq, const Reference< chart2::data::XDataProvider >& xDataProvider )
+{
+ Reference< chart2::data::XDataSequence > xRet;
+ OUString aRange;
+ if( xSeq.is() && SchXMLTools::getXMLRangePropertyFromDataSequence( xSeq, aRange, /* bClearProp = */ true ) )
+ {
+ xRet.set( xDataProvider->createDataSequenceByRangeRepresentation(
+ lcl_ConvertRange( aRange, xDataProvider )) );
+ SchXMLTools::copyProperties( Reference< beans::XPropertySet >( xSeq, uno::UNO_QUERY ),
+ Reference< beans::XPropertySet >( xRet, uno::UNO_QUERY ));
+ }
+ return xRet;
+}
+
+} // anonymous namespace
+
+// ----------------------------------------
+
+namespace SchXMLTools
+{
+
+static SvXMLEnumMapEntry aXMLChartClassMap[] =
+{
+ { XML_LINE, XML_CHART_CLASS_LINE },
+ { XML_AREA, XML_CHART_CLASS_AREA },
+ { XML_CIRCLE, XML_CHART_CLASS_CIRCLE },
+ { XML_RING, XML_CHART_CLASS_RING },
+ { XML_SCATTER, XML_CHART_CLASS_SCATTER },
+ { XML_RADAR, XML_CHART_CLASS_RADAR },
+ { XML_FILLED_RADAR, XML_CHART_CLASS_FILLED_RADAR },
+ { XML_BAR, XML_CHART_CLASS_BAR },
+ { XML_STOCK, XML_CHART_CLASS_STOCK },
+ { XML_BUBBLE, XML_CHART_CLASS_BUBBLE },
+ { XML_SURFACE, XML_CHART_CLASS_BAR }, //@todo change this if a surface chart is available
+ { XML_ADD_IN, XML_CHART_CLASS_ADDIN },
+ { XML_TOKEN_INVALID, XML_CHART_CLASS_UNKNOWN }
+};
+
+SchXMLChartTypeEnum GetChartTypeEnum( const OUString& rClassName )
+{
+ sal_uInt16 nEnumVal = XML_CHART_CLASS_UNKNOWN;
+ if( !SvXMLUnitConverter::convertEnum(
+ nEnumVal, rClassName, aXMLChartClassMap ) )
+ nEnumVal = XML_CHART_CLASS_UNKNOWN;
+ return SchXMLChartTypeEnum(nEnumVal);
+}
+
+typedef ::comphelper::MakeMap< ::rtl::OUString, ::rtl::OUString > tMakeStringStringMap;
+//static
+const tMakeStringStringMap& lcl_getChartTypeNameMap()
+{
+ //shape property -- chart model object property
+ static tMakeStringStringMap g_aChartTypeNameMap =
+ tMakeStringStringMap
+ ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart.LineDiagram" ))
+ , ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.LineChartType" )) )
+
+ ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart.AreaDiagram" ))
+ , ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.AreaChartType" )) )
+
+ ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart.BarDiagram" ))
+ , ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.ColumnChartType" )) )
+
+ ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart.PieDiagram" ))
+ , ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.PieChartType" )) )
+
+ ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart.DonutDiagram" ))
+ , ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.DonutChartType" )) )
+
+ ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart.XYDiagram" ))
+ , ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.ScatterChartType" )) )
+
+ ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart.NetDiagram" ))
+ , ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.NetChartType" )) )
+
+ ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart.FilledNetDiagram" ))
+ , ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.FilledNetChartType" )) )
+
+ ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart.StockDiagram" ))
+ , ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.CandleStickChartType" )) )
+
+ ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart.BubbleDiagram" ))
+ , ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.BubbleChartType" )) )
+
+ ;
+ return g_aChartTypeNameMap;
+}
+
+
+OUString GetNewChartTypeName( const OUString & rOldChartTypeName )
+{
+ OUString aNew(rOldChartTypeName);
+
+ const tMakeStringStringMap& rMap = lcl_getChartTypeNameMap();
+ tMakeStringStringMap::const_iterator aIt( rMap.find( rOldChartTypeName ));
+ if( aIt != rMap.end())
+ {
+ aNew = aIt->second;
+ }
+ return aNew;
+}
+
+OUString GetChartTypeByClassName(
+ const OUString & rClassName, bool bUseOldNames )
+{
+ OUStringBuffer aResultBuffer;
+ bool bInternalType = false;
+
+ if( bUseOldNames )
+ aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("com.sun.star.chart."));
+ else
+ aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("com.sun.star.chart2."));
+
+ bInternalType = true;
+
+ if( IsXMLToken( rClassName, XML_LINE ))
+ aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("Line"));
+ else if( IsXMLToken( rClassName, XML_AREA ))
+ aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("Area"));
+ else if( IsXMLToken( rClassName, XML_BAR ))
+ {
+ if( bUseOldNames )
+ aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("Bar"));
+ else
+ {
+ aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("Column"));
+ // @todo: might be Bar
+ }
+ }
+ else if( IsXMLToken( rClassName, XML_CIRCLE ))
+ aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("Pie"));
+ else if( IsXMLToken( rClassName, XML_RING ))
+ aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("Donut"));
+ else if( IsXMLToken( rClassName, XML_SCATTER ))
+ {
+ if( bUseOldNames )
+ aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("XY"));
+ else
+ aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("Scatter"));
+ }
+
+ else if( IsXMLToken( rClassName, XML_BUBBLE ))
+ aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("Bubble"));
+ else if( IsXMLToken( rClassName, XML_RADAR ))
+ aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("Net"));
+ else if( IsXMLToken( rClassName, XML_FILLED_RADAR ))
+ aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("FilledNet"));
+ else if( IsXMLToken( rClassName, XML_STOCK ))
+ {
+ if( bUseOldNames )
+ aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("Stock"));
+ else
+ aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("CandleStick"));
+ }
+ else if( IsXMLToken( rClassName, XML_SURFACE ))
+ {
+ //@todo change this if a surface chart is available
+ if( bUseOldNames )
+ aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("Bar"));
+ else
+ aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("Column"));
+ }
+ else
+ bInternalType = false;
+
+ if( ! bInternalType )
+ return OUString();
+
+ if( bUseOldNames )
+ aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("Diagram"));
+ else
+ aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("ChartType"));
+
+ return aResultBuffer.makeStringAndClear();
+
+}
+
+XMLTokenEnum getTokenByChartType(
+ const OUString & rChartTypeService, bool bUseOldNames )
+{
+ XMLTokenEnum eResult = XML_TOKEN_INVALID;
+ OUString aPrefix, aPostfix;
+
+ if( bUseOldNames )
+ {
+ aPrefix = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart."));
+ aPostfix = OUString( RTL_CONSTASCII_USTRINGPARAM("Diagram"));
+ }
+ else
+ {
+ aPrefix = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2."));
+ aPostfix = OUString( RTL_CONSTASCII_USTRINGPARAM("ChartType"));
+ }
+
+ if( rChartTypeService.match( aPrefix ))
+ {
+ sal_Int32 nSkip = aPrefix.getLength();
+ OSL_ASSERT( rChartTypeService.getLength() >= nSkip );
+ sal_Int32 nTypeLength = rChartTypeService.getLength() - nSkip - aPostfix.getLength();
+ // if postfix matches and leaves a non-empty type
+ if( nTypeLength > 0 && rChartTypeService.match( aPostfix, nSkip + nTypeLength ))
+ {
+ OUString aServiceName( rChartTypeService.copy( nSkip, nTypeLength ));
+
+ if( aServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Line")))
+ eResult = XML_LINE;
+ else if( aServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Area")))
+ eResult = XML_AREA;
+ else if( aServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Bar")) ||
+ (!bUseOldNames && aServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Column"))))
+ eResult = XML_BAR;
+ else if( aServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Pie")))
+ eResult = XML_CIRCLE;
+ else if( aServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Donut")))
+ eResult = XML_RING;
+ else if( (bUseOldNames && aServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("XY"))) ||
+ (!bUseOldNames && aServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Scatter"))))
+ eResult = XML_SCATTER;
+ else if( aServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Bubble")))
+ eResult = XML_BUBBLE;
+ else if( aServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Net")))
+ eResult = XML_RADAR;
+ else if( aServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("FilledNet")))
+ eResult = XML_FILLED_RADAR;
+ else if( (bUseOldNames && aServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Stock"))) ||
+ (!bUseOldNames && aServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("CandleStick"))))
+ eResult = XML_STOCK;
+ }
+ }
+
+ if( eResult == XML_TOKEN_INVALID && rChartTypeService.getLength() > 0 )
+ eResult = XML_ADD_IN;
+
+ return eResult;
+}
+
+Reference< chart2::data::XLabeledDataSequence > GetNewLabeledDataSequence()
+{
+ Reference< chart2::data::XLabeledDataSequence > xResult;
+ Reference< uno::XComponentContext > xContext( lcl_getComponentContext());
+ if( xContext.is() )
+ xResult.set(
+ xContext->getServiceManager()->createInstanceWithContext(
+ OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.data.LabeledDataSequence" )),
+ xContext ), uno::UNO_QUERY_THROW );
+ return xResult;
+}
+
+Reference< chart2::data::XDataSequence > CreateDataSequence(
+ const OUString & rRange,
+ const Reference< chart2::XChartDocument >& xChartDoc )
+{
+ Reference< chart2::data::XDataSequence > xRet;
+
+ if( !xChartDoc.is() )
+ {
+ OSL_FAIL( "need a chart document" );
+ return xRet;
+ }
+
+ Reference< chart2::data::XDataProvider > xDataProvider( xChartDoc->getDataProvider() );
+ if( !xDataProvider.is() )
+ {
+ OSL_FAIL( "need a data provider" );
+ return xRet;
+ }
+
+ try
+ {
+ xRet.set( xDataProvider->createDataSequenceByRangeRepresentation( lcl_ConvertRange( rRange, xDataProvider )));
+ SchXMLTools::setXMLRangePropertyAtDataSequence( xRet, rRange );
+ }
+ catch( const lang::IllegalArgumentException & )
+ {
+ OSL_FAIL( "could not create data sequence" );
+ }
+
+ if( !xRet.is() && !xChartDoc->hasInternalDataProvider() && rRange.getLength() )
+ {
+ //#i103911# switch to internal data in case the parent cannot provide the requested data
+ xChartDoc->createInternalDataProvider( sal_True /* bCloneExistingData */ );
+ xDataProvider = xChartDoc->getDataProvider();
+ try
+ {
+ xRet.set( xDataProvider->createDataSequenceByRangeRepresentation( lcl_ConvertRange( rRange, xDataProvider )));
+ SchXMLTools::setXMLRangePropertyAtDataSequence( xRet, rRange );
+ }
+ catch( const lang::IllegalArgumentException & )
+ {
+ OSL_FAIL( "could not create data sequence" );
+ }
+ }
+ return xRet;
+}
+
+void CreateCategories(
+ const uno::Reference< chart2::data::XDataProvider > & xDataProvider,
+ const uno::Reference< chart2::XChartDocument > & xNewDoc,
+ const OUString & rRangeAddress,
+ sal_Int32 nCooSysIndex,
+ sal_Int32 nDimensionIndex,
+ tSchXMLLSequencesPerIndex * pLSequencesPerIndex )
+{
+ try
+ {
+ if( xNewDoc.is() && rRangeAddress.getLength())
+ {
+ if( xDataProvider.is())
+ {
+ uno::Reference< chart2::XDiagram > xDia( xNewDoc->getFirstDiagram());
+ if( !xDia.is())
+ return;
+
+ uno::Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xDia, uno::UNO_QUERY_THROW );
+ uno::Sequence< uno::Reference< chart2::XCoordinateSystem > >
+ aCooSysSeq( xCooSysCnt->getCoordinateSystems());
+ if( nCooSysIndex < aCooSysSeq.getLength())
+ {
+ uno::Reference< chart2::XCoordinateSystem > xCooSys( aCooSysSeq[nCooSysIndex] );
+ OSL_ASSERT( xCooSys.is());
+ if( nDimensionIndex < xCooSys->getDimension() )
+ {
+ const sal_Int32 nMaxAxisIndex = xCooSys->getMaximumAxisIndexByDimension(nDimensionIndex);
+ for(sal_Int32 nI=0; nI<=nMaxAxisIndex; ++nI)
+ {
+ uno::Reference< chart2::XAxis > xAxis( xCooSys->getAxisByDimension( nDimensionIndex, nI ));
+ if( xAxis.is() )
+ {
+ chart2::ScaleData aData( xAxis->getScaleData());
+ uno::Reference< chart2::data::XLabeledDataSequence > xLabeledSeq(
+ GetNewLabeledDataSequence());
+ try
+ {
+ OUString aConvertedRange( rRangeAddress );
+ bool bRangeConverted = false;
+ if( ! (xNewDoc->hasInternalDataProvider() &&
+ aConvertedRange.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("categories"))))
+ {
+ Reference< chart2::data::XRangeXMLConversion > xXMLConv( xDataProvider, uno::UNO_QUERY );
+ if( xXMLConv.is())
+ {
+ aConvertedRange = xXMLConv->convertRangeFromXML( rRangeAddress );
+ bRangeConverted = true;
+ }
+ }
+ Reference< chart2::data::XDataSequence > xSeq(
+ xDataProvider->createDataSequenceByRangeRepresentation( aConvertedRange ));
+ xLabeledSeq->setValues( xSeq );
+ if( bRangeConverted )
+ setXMLRangePropertyAtDataSequence( xSeq, rRangeAddress );
+ }
+ catch( const lang::IllegalArgumentException & ex )
+ {
+ (void)ex; // avoid warning for pro build
+ OSL_FAIL( ::rtl::OUStringToOString(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IllegalArgumentException caught, Message: " )) +
+ ex.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
+ }
+ aData.Categories.set( xLabeledSeq );
+ if( pLSequencesPerIndex )
+ {
+ // register for setting local data if external data provider is not present
+ pLSequencesPerIndex->insert(
+ tSchXMLLSequencesPerIndex::value_type(
+ tSchXMLIndexWithPart( SCH_XML_CATEGORIES_INDEX, SCH_XML_PART_VALUES ), xLabeledSeq ));
+ }
+ xAxis->setScaleData( aData );
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ catch( uno::Exception & )
+ {
+ OSL_FAIL( "Exception caught while creating Categories" );
+ }
+}
+
+
+uno::Any getPropertyFromContext( const rtl::OUString& rPropertyName, const XMLPropStyleContext* pPropStyleContext, const SvXMLStylesContext* pStylesCtxt )
+{
+ uno::Any aRet;
+ if( !pPropStyleContext || !pStylesCtxt )
+ return aRet;
+ const ::std::vector< XMLPropertyState >& rProperties = pPropStyleContext->GetProperties();
+ const UniReference< XMLPropertySetMapper >& rMapper = pStylesCtxt->GetImportPropertyMapper( pPropStyleContext->GetFamily()/*XML_STYLE_FAMILY_SCH_CHART_ID*/ )->getPropertySetMapper();
+ ::std::vector< XMLPropertyState >::const_iterator aEnd( rProperties.end() );
+ ::std::vector< XMLPropertyState >::const_iterator aPropIter( rProperties.begin() );
+ for( aPropIter = rProperties.begin(); aPropIter != aEnd; ++aPropIter )
+ {
+ sal_Int32 nIdx = aPropIter->mnIndex;
+ if( nIdx == -1 )
+ continue;
+ OUString aPropName = rMapper->GetEntryAPIName( nIdx );
+ if(rPropertyName.equals(aPropName))
+ return aPropIter->maValue;
+ }
+ return aRet;
+}
+
+void exportText( SvXMLExport& rExport, const OUString& rText, bool bConvertTabsLFs )
+{
+ SvXMLElementExport aPara( rExport, XML_NAMESPACE_TEXT,
+ ::xmloff::token::GetXMLToken( ::xmloff::token::XML_P ),
+ sal_True, sal_False );
+
+ if( bConvertTabsLFs )
+ {
+ sal_Int32 nStartPos = 0;
+ sal_Int32 nEndPos = rText.getLength();
+ sal_Unicode cChar;
+
+ for( sal_Int32 nPos = 0; nPos < nEndPos; nPos++ )
+ {
+ cChar = rText[ nPos ];
+ switch( cChar )
+ {
+ case 0x0009: // tabulator
+ {
+ if( nPos > nStartPos )
+ rExport.GetDocHandler()->characters( rText.copy( nStartPos, (nPos - nStartPos)) );
+ nStartPos = nPos + 1;
+
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_TEXT,
+ ::xmloff::token::GetXMLToken( ::xmloff::token::XML_TAB_STOP ),
+ sal_False, sal_False );
+ }
+ break;
+
+ case 0x000A: // linefeed
+ {
+ if( nPos > nStartPos )
+ rExport.GetDocHandler()->characters( rText.copy( nStartPos, (nPos - nStartPos)) );
+ nStartPos = nPos + 1;
+
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_TEXT,
+ ::xmloff::token::GetXMLToken( ::xmloff::token::XML_LINE_BREAK ),
+ sal_False, sal_False );
+ }
+ break;
+ }
+ }
+ if( nEndPos > nStartPos )
+ {
+ if( nStartPos == 0 )
+ rExport.GetDocHandler()->characters( rText );
+ else
+ rExport.GetDocHandler()->characters( rText.copy( nStartPos, (nEndPos - nStartPos)) );
+ }
+ }
+ else // do not convert tabs and linefeeds (eg for numbers coming from unit converter)
+ {
+ rExport.GetDocHandler()->characters( rText );
+ }
+}
+
+void exportRangeToSomewhere( SvXMLExport& rExport, const ::rtl::OUString& rValue )
+{
+ //with issue #i366# and CWS chart20 ranges for error bars were introduced
+ //to keep them during copy paste from calc to impress for example it
+ //was necessary to introduce a mapping between the used ranges within calc and the data written to the local table
+ //this is why we write this ranges here
+
+ //#i113950# first the range was exported to attribute text:id, but that attribute does not allow arbitrary strings anymore within ODF 1.2
+ //as an alternative the range info is now saved into the description at an empty group element (not very nice, but ODF conform)
+
+ const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() );
+ if( nCurrentODFVersion == SvtSaveOptions::ODFVER_010 || nCurrentODFVersion == SvtSaveOptions::ODFVER_011 )
+ return;//svg:desc is not allowed at draw:g in ODF1.0; but as the ranges for error bars are anyhow not allowed within ODF1.0 nor ODF1.1 we do not need the information
+
+ SvXMLElementExport aEmptyShapeGroup( rExport, XML_NAMESPACE_DRAW,
+ ::xmloff::token::GetXMLToken( ::xmloff::token::XML_G ),
+ sal_True, sal_False );
+ SvXMLElementExport aDescription( rExport, XML_NAMESPACE_SVG,
+ ::xmloff::token::GetXMLToken( ::xmloff::token::XML_DESC ),
+ sal_True, sal_False );
+ rExport.GetDocHandler()->characters( rValue );
+}
+
+Reference< chart2::XRegressionCurve > getRegressionCurve(
+ const Reference< chart2::XDataSeries > & xDataSeries )
+{
+ Reference< chart2::XRegressionCurve > xResult;
+
+ Reference< chart2::XRegressionCurveContainer > xRegCurveCnt( xDataSeries, uno::UNO_QUERY );
+ if( xRegCurveCnt.is())
+ {
+ // find equation properties of first regression curve
+ Sequence< Reference< chart2::XRegressionCurve > > aCurveSeq(
+ xRegCurveCnt->getRegressionCurves() );
+ for( sal_Int32 nI=0; nI<aCurveSeq.getLength(); ++nI )
+ {
+ // skip mean-value line
+ Reference< lang::XServiceName > xServiceName( aCurveSeq[nI], uno::UNO_QUERY );
+ if( xServiceName.is())
+ {
+ OUString aServiceName( xServiceName->getServiceName());
+ if( aServiceName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "com.sun.star.chart2.MeanValueRegressionCurve" )))
+ continue;
+ }
+ // take first non-empty curve
+ if( aCurveSeq[nI].is())
+ {
+ xResult.set( aCurveSeq[nI] );
+ break;
+ }
+ }
+ }
+ return xResult;
+}
+
+void setXMLRangePropertyAtDataSequence(
+ const Reference< chart2::data::XDataSequence > & xDataSequence,
+ const OUString & rXMLRange )
+{
+ if( !xDataSequence.is())
+ return;
+ try
+ {
+ const OUString aXMLRangePropName( RTL_CONSTASCII_USTRINGPARAM( "CachedXMLRange" ));
+ Reference< beans::XPropertySet > xProp( xDataSequence, uno::UNO_QUERY_THROW );
+ Reference< beans::XPropertySetInfo > xInfo( xProp->getPropertySetInfo());
+ if( xInfo.is() && xInfo->hasPropertyByName( aXMLRangePropName ))
+ xProp->setPropertyValue( aXMLRangePropName, uno::makeAny( rXMLRange ));
+ }
+ catch( const uno::Exception & ex )
+ {
+ (void)ex; // avoid warning for pro build
+ OSL_FAIL( ::rtl::OUStringToOString(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Exception caught, Message: " )) +
+ ex.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
+ }
+}
+
+bool getXMLRangePropertyFromDataSequence(
+ const Reference< chart2::data::XDataSequence > & xDataSequence,
+ OUString & rOutXMLRange,
+ bool bClearProp /* = false */)
+{
+ bool bResult = false;
+ if( xDataSequence.is())
+ {
+ try
+ {
+ const OUString aXMLRangePropName( RTL_CONSTASCII_USTRINGPARAM( "CachedXMLRange" ));
+ Reference< beans::XPropertySet > xProp( xDataSequence, uno::UNO_QUERY_THROW );
+ Reference< beans::XPropertySetInfo > xInfo( xProp->getPropertySetInfo());
+ bResult =
+ ( xInfo.is() && xInfo->hasPropertyByName( aXMLRangePropName ) &&
+ ( xProp->getPropertyValue( aXMLRangePropName ) >>= rOutXMLRange ) &&
+ rOutXMLRange.getLength());
+ // clear the property after usage
+ if( bClearProp && bResult )
+ xProp->setPropertyValue( aXMLRangePropName, uno::Any( OUString()));
+ }
+ catch( const uno::Exception & ex )
+ {
+ (void)ex; // avoid warning for pro build
+ OSL_FAIL( ::rtl::OUStringToOString(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Exception caught, Message: " )) +
+ ex.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
+ }
+ }
+ return bResult;
+}
+
+void copyProperties(
+ const Reference< beans::XPropertySet > & xSource,
+ const Reference< beans::XPropertySet > & xDestination )
+{
+ if( ! (xSource.is() && xDestination.is()) )
+ return;
+
+ try
+ {
+ Reference< beans::XPropertySetInfo > xSrcInfo( xSource->getPropertySetInfo(), uno::UNO_QUERY_THROW );
+ Reference< beans::XPropertySetInfo > xDestInfo( xDestination->getPropertySetInfo(), uno::UNO_QUERY_THROW );
+ Sequence< beans::Property > aProperties( xSrcInfo->getProperties());
+ const sal_Int32 nLength = aProperties.getLength();
+ for( sal_Int32 i = 0; i < nLength; ++i )
+ {
+ OUString aName( aProperties[i].Name);
+ if( xDestInfo->hasPropertyByName( aName ))
+ {
+ beans::Property aProp( xDestInfo->getPropertyByName( aName ));
+ if( (aProp.Attributes & beans::PropertyAttribute::READONLY) == 0 )
+ xDestination->setPropertyValue(
+ aName, xSource->getPropertyValue( aName ));
+ }
+ }
+ }
+ catch( const uno::Exception & )
+ {
+ OSL_FAIL( "Copying property sets failed!" );
+ }
+}
+
+bool switchBackToDataProviderFromParent( const Reference< chart2::XChartDocument >& xChartDoc, const tSchXMLLSequencesPerIndex & rLSequencesPerIndex )
+{
+ //return whether the switch is successful
+ if( !xChartDoc.is() || !xChartDoc->hasInternalDataProvider() )
+ return false;
+ Reference< chart2::data::XDataProvider > xDataProviderFromParent( SchXMLTools::getDataProviderFromParent( xChartDoc ) );
+ if( !xDataProviderFromParent.is() )
+ return false;
+ uno::Reference< chart2::data::XDataReceiver > xDataReceiver( xChartDoc, uno::UNO_QUERY );
+ if( !xDataReceiver.is() )
+ return false;
+
+ xDataReceiver->attachDataProvider( xDataProviderFromParent );
+
+ for( tSchXMLLSequencesPerIndex::const_iterator aLSeqIt( rLSequencesPerIndex.begin() );
+ aLSeqIt != rLSequencesPerIndex.end(); ++aLSeqIt )
+ {
+ Reference< chart2::data::XLabeledDataSequence > xLabeledSeq( aLSeqIt->second );
+ if( !xLabeledSeq.is() )
+ continue;
+ Reference< chart2::data::XDataSequence > xNewSeq;
+ xNewSeq = lcl_createNewSequenceFromCachedXMLRange( xLabeledSeq->getValues(), xDataProviderFromParent );
+ if( xNewSeq.is() )
+ xLabeledSeq->setValues( xNewSeq );
+ xNewSeq = lcl_createNewSequenceFromCachedXMLRange( xLabeledSeq->getLabel(), xDataProviderFromParent );
+ if( xNewSeq.is() )
+ xLabeledSeq->setLabel( xNewSeq );
+ }
+ return true;
+}
+
+void setBuildIDAtImportInfo( uno::Reference< frame::XModel > xModel, Reference< beans::XPropertySet > xImportInfo )
+{
+ ::rtl::OUString aGenerator( lcl_getGeneratorFromModelOrItsParent(xModel) );
+ if( aGenerator.getLength() )
+ SvXMLMetaDocumentContext::setBuildId( aGenerator, xImportInfo );
+}
+
+bool isDocumentGeneratedWithOpenOfficeOlderThan3_3( const uno::Reference< frame::XModel >& xChartModel )
+{
+ bool bResult = isDocumentGeneratedWithOpenOfficeOlderThan3_0( xChartModel );
+ if( !bResult )
+ {
+ ::rtl::OUString aGenerator( lcl_getGeneratorFromModel(xChartModel) );
+ if( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org_project/3") ) ) != -1 )
+ {
+ if( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org_project/300m") ) ) != -1 )
+ {
+ sal_Int32 nBuilId = lcl_getBuildIDFromGenerator( lcl_getGeneratorFromModel(xChartModel) );
+ if( nBuilId>0 && nBuilId<9491 ) //9491 is build id of dev300m76
+ bResult= true;
+ }
+ else if( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org_project/310m") ) ) != -1 )
+ bResult= true;
+ else if( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org_project/320m") ) ) != -1 )
+ bResult= true;
+ }
+ }
+ return bResult;
+}
+
+bool isDocumentGeneratedWithOpenOfficeOlderThan3_0( const uno::Reference< frame::XModel >& xChartModel )
+{
+ bool bResult = isDocumentGeneratedWithOpenOfficeOlderThan2_3( xChartModel );
+ if( !bResult )
+ {
+ ::rtl::OUString aGenerator( lcl_getGeneratorFromModel(xChartModel) );
+ if( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org_project/680m") ) ) != -1 )
+ bResult= true;
+ }
+ return bResult;
+}
+
+bool isDocumentGeneratedWithOpenOfficeOlderThan2_4( const uno::Reference< frame::XModel >& xChartModel )
+{
+ if( isDocumentGeneratedWithOpenOfficeOlderThan2_3( xChartModel ) )
+ return true;
+
+ if( isDocumentGeneratedWithOpenOfficeOlderThan3_0( xChartModel ) )
+ {
+ sal_Int32 nBuilId = lcl_getBuildIDFromGenerator( lcl_getGeneratorFromModel(xChartModel) );
+ if( nBuilId>0 && nBuilId<=9238 ) //9238 is build id of OpenOffice.org 2.3.1
+ return true;
+ }
+ return false;
+}
+
+bool isDocumentGeneratedWithOpenOfficeOlderThan2_3( const uno::Reference< frame::XModel >& xChartModel )
+{
+ bool bResult = false;
+ ::rtl::OUString aGenerator( lcl_getGeneratorFromModel(xChartModel) );
+ //if there is a meta stream at the chart object it was not written with an older OpenOffice version < 2.3
+ if( !aGenerator.getLength() )
+ {
+ //if there is no meta stream at the chart object we need to check whether the parent document is OpenOffice at all
+ uno::Reference< container::XChild > xChild( xChartModel, uno::UNO_QUERY );
+ if( xChild.is() )
+ {
+ aGenerator = lcl_getGeneratorFromModel( uno::Reference< frame::XModel >( xChild->getParent(), uno::UNO_QUERY) );
+ if( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org_project") ) ) != -1 )
+ {
+ //the chart application has not created files without a meta stream since OOo 2.3 (OOo 2.3 has written a metastream already)
+ //only the report builder extension has created some files with OOo 3.1 that do not have a meta stream
+ if( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org_project/31") ) ) != -1 )
+ bResult = false;//#i100102# probably generated with OOo 3.1 by the report designer
+ else
+ bResult= true; //in this case the OLE chart was created by an older version, as OLE objects are sometimes stream copied the version can differ from the parents version, so the parents version is not a reliable indicator
+ }
+ else if( isDocumentGeneratedWithOpenOfficeOlderThan2_0(xChartModel) )
+ bResult= true;
+ }
+ }
+ return bResult;
+}
+
+bool isDocumentGeneratedWithOpenOfficeOlderThan2_0( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel)
+{
+ bool bResult = false;
+ ::rtl::OUString aGenerator( lcl_getGeneratorFromModelOrItsParent(xChartModel) );
+ if( ( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org 1") ) ) == 0 )
+ || ( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StarOffice 6") ) ) == 0 )
+ || ( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StarOffice 7") ) ) == 0 )
+ || ( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StarSuite 6") ) ) == 0 )
+ || ( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StarSuite 7") ) ) == 0 )
+ )
+ bResult= true;
+ return bResult;
+}
+
+Reference< chart2::data::XDataProvider > getDataProviderFromParent( const Reference< chart2::XChartDocument >& xChartDoc )
+{
+ Reference< chart2::data::XDataProvider > xRet;
+ uno::Reference< container::XChild > xChild( xChartDoc, uno::UNO_QUERY );
+ if( xChild.is() )
+ {
+ Reference< lang::XMultiServiceFactory > xFact( xChild->getParent(), uno::UNO_QUERY );
+ if( xFact.is() )
+ {
+ const OUString aDataProviderServiceName( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2.data.DataProvider"));
+ const uno::Sequence< OUString > aServiceNames( xFact->getAvailableServiceNames());
+ const OUString * pBegin = aServiceNames.getConstArray();
+ const OUString * pEnd = pBegin + aServiceNames.getLength();
+ if( ::std::find( pBegin, pEnd, aDataProviderServiceName ) != pEnd )
+ {
+ xRet = Reference< chart2::data::XDataProvider >(
+ xFact->createInstance( aDataProviderServiceName ), uno::UNO_QUERY );
+ }
+ }
+ }
+ return xRet;
+}
+
+} // namespace SchXMLTools
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/SchXMLTools.hxx b/xmloff/source/chart/SchXMLTools.hxx
new file mode 100644
index 000000000000..6ac1c2be283b
--- /dev/null
+++ b/xmloff/source/chart/SchXMLTools.hxx
@@ -0,0 +1,155 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 SCH_XML_TOOLS_HXX_
+#define SCH_XML_TOOLS_HXX_
+
+#include <rtl/ustring.hxx>
+#include <xmloff/xmltoken.hxx>
+#include "transporttypes.hxx"
+
+#include <com/sun/star/frame/XModel.hpp>
+
+namespace com { namespace sun { namespace star {
+ namespace chart2 {
+ class XChartDocument;
+ class XRegressionCurve;
+ namespace data {
+ class XDataProvider;
+ class XLabeledDataSequence;
+ }
+ }
+}}}
+
+class XMLPropStyleContext;
+class SvXMLStylesContext;
+class SvXMLExport;
+
+namespace SchXMLTools
+{
+ bool isDocumentGeneratedWithOpenOfficeOlderThan2_0( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel);
+ bool isDocumentGeneratedWithOpenOfficeOlderThan2_3( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel);
+ bool isDocumentGeneratedWithOpenOfficeOlderThan2_4( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel);
+ bool isDocumentGeneratedWithOpenOfficeOlderThan3_0( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel);
+ bool isDocumentGeneratedWithOpenOfficeOlderThan3_3( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel);
+
+ void setBuildIDAtImportInfo( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xModel
+ , ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xImportInfo );
+
+ enum SchXMLChartTypeEnum
+ {
+ XML_CHART_CLASS_LINE,
+ XML_CHART_CLASS_AREA,
+ XML_CHART_CLASS_CIRCLE,
+ XML_CHART_CLASS_RING,
+ XML_CHART_CLASS_SCATTER,
+ XML_CHART_CLASS_RADAR,
+ XML_CHART_CLASS_FILLED_RADAR,
+ XML_CHART_CLASS_BAR,
+ XML_CHART_CLASS_STOCK,
+ XML_CHART_CLASS_BUBBLE,
+ XML_CHART_CLASS_ADDIN,
+ XML_CHART_CLASS_UNKNOWN
+ };
+
+ SchXMLChartTypeEnum GetChartTypeEnum( const ::rtl::OUString& rClassName );
+
+ ::rtl::OUString GetChartTypeByClassName(
+ const ::rtl::OUString & rClassName, bool bUseOldNames );
+
+ ::xmloff::token::XMLTokenEnum getTokenByChartType(
+ const ::rtl::OUString & rChartTypeService, bool bUseOldNames );
+
+ ::rtl::OUString GetNewChartTypeName( const ::rtl::OUString & rOldChartTypeName );
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XLabeledDataSequence > GetNewLabeledDataSequence();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > CreateDataSequence(
+ const ::rtl::OUString& rRange,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument >& xChartDoc );
+
+ void CreateCategories(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider > & xDataProvider,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > & xNewDoc,
+ const ::rtl::OUString & rRangeAddress,
+ sal_Int32 nCooSysIndex,
+ sal_Int32 nDimensionIndex,
+ tSchXMLLSequencesPerIndex * pLSequencesPerIndex = 0 );
+
+ ::com::sun::star::uno::Any getPropertyFromContext( const ::rtl::OUString& rPropertyName, const XMLPropStyleContext * pPropStyleContext, const SvXMLStylesContext* pStylesCtxt );
+
+ void exportText( SvXMLExport& rExport, const ::rtl::OUString& rText, bool bConvertTabsLFs );
+
+ void exportRangeToSomewhere( SvXMLExport& rExport, const ::rtl::OUString& rValue );
+
+ /** returns the properties of the equation of the first regression curve
+ that is no mean-value line
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XRegressionCurve > getRegressionCurve(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > & xDataSeries );
+
+ /** checks if the data sequence has the property "CachedXMLRange" (true for
+ internal data sequences), and if so sets this property to the range
+ given in rXMLRange
+ */
+ void setXMLRangePropertyAtDataSequence(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataSequence > & xDataSequence,
+ const ::rtl::OUString & rXMLRange );
+
+ /** checks if the data sequence has the property "CachedXMLRange" (true for
+ internal data sequences), and if so retrieves this property and applies
+ it to the range given in rOutXMLRange.
+
+ @param bClearProp If true, the property is reset to its default after it
+ was assigned to rOutXMLRange
+
+ @return true, if the property was found, assigned and is non-empty
+ */
+ bool getXMLRangePropertyFromDataSequence(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataSequence > & xDataSequence,
+ ::rtl::OUString & rOutXMLRange,
+ bool bClearProp = false );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider > getDataProviderFromParent( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDoc );
+
+ bool switchBackToDataProviderFromParent( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument >& xChartDoc
+ , const tSchXMLLSequencesPerIndex & rLSequencesPerIndex );
+
+ void copyProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & xSource,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & xDestination );
+}
+
+#endif // SCH_XML_TOOLS_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/XMLAxisPositionPropertyHdl.cxx b/xmloff/source/chart/XMLAxisPositionPropertyHdl.cxx
new file mode 100644
index 000000000000..74700f6b16ab
--- /dev/null
+++ b/xmloff/source/chart/XMLAxisPositionPropertyHdl.cxx
@@ -0,0 +1,131 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLAxisPositionPropertyHdl.hxx"
+#include <xmloff/xmluconv.hxx>
+#include <com/sun/star/chart/ChartAxisPosition.hpp>
+#include <rtl/ustrbuf.hxx>
+
+using namespace ::xmloff::token;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace com::sun::star;
+
+XMLAxisPositionPropertyHdl::XMLAxisPositionPropertyHdl( bool bCrossingValue )
+ : m_bCrossingValue( bCrossingValue )
+{}
+
+XMLAxisPositionPropertyHdl::~XMLAxisPositionPropertyHdl()
+{}
+
+sal_Bool XMLAxisPositionPropertyHdl::importXML( const OUString& rStrImpValue,
+ uno::Any& rValue, const SvXMLUnitConverter& /*rUnitConverter*/ ) const
+{
+ sal_Bool bResult = false;
+
+ if( rStrImpValue.equals( GetXMLToken(XML_START) ) )
+ {
+ if( !m_bCrossingValue )
+ {
+ rValue <<= ::com::sun::star::chart::ChartAxisPosition_START;
+ bResult = true;
+ }
+ }
+ else if( rStrImpValue.equals( GetXMLToken(XML_END) ) )
+ {
+ if( !m_bCrossingValue )
+ {
+ rValue <<= ::com::sun::star::chart::ChartAxisPosition_END;
+ bResult = true;
+ }
+ }
+ else
+ {
+ if( !m_bCrossingValue )
+ {
+ rValue <<= ::com::sun::star::chart::ChartAxisPosition_VALUE;
+ bResult = true;
+ }
+ else
+ {
+ double fDblValue=0.0;
+ bResult = SvXMLUnitConverter::convertDouble( fDblValue, rStrImpValue );
+ rValue <<= fDblValue;
+ }
+ }
+
+ return bResult;
+}
+
+sal_Bool XMLAxisPositionPropertyHdl::exportXML( OUString& rStrExpValue,
+ const uno::Any& rValue, const SvXMLUnitConverter& /*rUnitConverter*/ ) const
+{
+ sal_Bool bResult = sal_False;
+
+ rtl::OUStringBuffer sValueBuffer;
+ if( m_bCrossingValue )
+ {
+ if(rStrExpValue.getLength() == 0)
+ {
+ double fValue = 0.0;
+ rValue >>= fValue;
+ SvXMLUnitConverter::convertDouble( sValueBuffer, fValue );
+ rStrExpValue = sValueBuffer.makeStringAndClear();
+ bResult = true;
+ }
+ }
+ else
+ {
+ ::com::sun::star::chart::ChartAxisPosition ePosition( ::com::sun::star::chart::ChartAxisPosition_ZERO );
+ rValue >>= ePosition;
+ switch(ePosition)
+ {
+ case ::com::sun::star::chart::ChartAxisPosition_START:
+ rStrExpValue = GetXMLToken( XML_START );
+ bResult = true;
+ break;
+ case ::com::sun::star::chart::ChartAxisPosition_END:
+ rStrExpValue = GetXMLToken( XML_END );
+ bResult = true;
+ break;
+ case ::com::sun::star::chart::ChartAxisPosition_ZERO:
+ SvXMLUnitConverter::convertDouble( sValueBuffer, 0.0 );
+ rStrExpValue = sValueBuffer.makeStringAndClear();
+ bResult = true;
+ break;
+ default:
+ break;
+ }
+ }
+ return bResult;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/XMLAxisPositionPropertyHdl.hxx b/xmloff/source/chart/XMLAxisPositionPropertyHdl.hxx
new file mode 100644
index 000000000000..5008ae426187
--- /dev/null
+++ b/xmloff/source/chart/XMLAxisPositionPropertyHdl.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLAXISPOSITIONPROPERTYHDL_HXX_
+#define _XMLAXISPOSITIONPROPERTYHDL_HXX_
+
+#include <xmloff/xmlprhdl.hxx>
+
+class XMLAxisPositionPropertyHdl : public XMLPropertyHandler
+{
+public:
+ XMLAxisPositionPropertyHdl( bool bCrossingValue );
+ virtual ~XMLAxisPositionPropertyHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+
+private:
+ bool m_bCrossingValue;
+};
+
+#endif // _XMLAXISPOSITIONPROPERTYHDL_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/XMLChartPropertyContext.cxx b/xmloff/source/chart/XMLChartPropertyContext.cxx
new file mode 100644
index 000000000000..28c5cd645451
--- /dev/null
+++ b/xmloff/source/chart/XMLChartPropertyContext.cxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLChartPropertyContext.hxx"
+#include "PropertyMap.hxx"
+
+#include "XMLSymbolImageContext.hxx"
+#include "XMLLabelSeparatorContext.hxx"
+
+TYPEINIT1( XMLChartPropertyContext, SvXMLImportContext );
+
+using namespace ::com::sun::star;
+
+XMLChartPropertyContext::XMLChartPropertyContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList,
+ sal_uInt32 nFamily,
+ ::std::vector< XMLPropertyState >& rProps,
+ const UniReference< SvXMLImportPropertyMapper >& rMapper ) :
+ SvXMLPropertySetContext( rImport, nPrfx, rLName, xAttrList, nFamily, rProps, rMapper )
+{
+}
+
+XMLChartPropertyContext::~XMLChartPropertyContext()
+{}
+
+SvXMLImportContext* XMLChartPropertyContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList,
+ ::std::vector< XMLPropertyState > &rProperties,
+ const XMLPropertyState& rProp )
+{
+ SvXMLImportContext *pContext = 0;
+
+ switch( mxMapper->getPropertySetMapper()->GetEntryContextId( rProp.mnIndex ) )
+ {
+ case XML_SCH_CONTEXT_SPECIAL_SYMBOL_IMAGE:
+ pContext = new XMLSymbolImageContext( GetImport(), nPrefix, rLocalName, rProp, rProperties );
+ break;
+ case XML_SCH_CONTEXT_SPECIAL_LABEL_SEPARATOR:
+ pContext = new XMLLabelSeparatorContext( GetImport(), nPrefix, rLocalName, rProp, rProperties );
+ break;
+ }
+
+ // default / no context yet: create child context by base class
+ if( !pContext )
+ {
+ pContext = SvXMLPropertySetContext::CreateChildContext(
+ nPrefix, rLocalName, xAttrList, rProperties, rProp );
+ }
+
+ return pContext;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/XMLChartPropertyContext.hxx b/xmloff/source/chart/XMLChartPropertyContext.hxx
new file mode 100644
index 000000000000..b7eb736c444c
--- /dev/null
+++ b/xmloff/source/chart/XMLChartPropertyContext.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_CHARTPROPERTYCONTEXT_HXX_
+#define _XMLOFF_CHARTPROPERTYCONTEXT_HXX_
+
+#include <xmloff/xmlprcon.hxx>
+
+class XMLChartPropertyContext : public SvXMLPropertySetContext
+{
+public:
+ TYPEINFO();
+
+ XMLChartPropertyContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
+ sal_uInt32 nFamily,
+ ::std::vector< XMLPropertyState >& rProps,
+ const UniReference< SvXMLImportPropertyMapper >& rMapper );
+ virtual ~XMLChartPropertyContext();
+
+ using SvXMLPropertySetContext::CreateChildContext;
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
+ ::std::vector< XMLPropertyState > &rProperties,
+ const XMLPropertyState& rProp );
+
+private:
+};
+
+#endif // _XMLOFF_CHARTPROPERTYCONTEXT_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/XMLChartStyleContext.cxx b/xmloff/source/chart/XMLChartStyleContext.cxx
new file mode 100644
index 000000000000..855f203e6740
--- /dev/null
+++ b/xmloff/source/chart/XMLChartStyleContext.cxx
@@ -0,0 +1,164 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLChartStyleContext.hxx"
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmlnumfi.hxx>
+#include <xmloff/families.hxx>
+
+#include "XMLChartPropertyContext.hxx"
+
+using namespace com::sun::star;
+using ::xmloff::token::IsXMLToken;
+using ::xmloff::token::XML_DATA_STYLE_NAME;
+using ::xmloff::token::XML_PERCENTAGE_DATA_STYLE_NAME;
+using ::xmloff::token::XML_TEXT_PROPERTIES;
+using ::xmloff::token::XML_PARAGRAPH_PROPERTIES;
+using ::xmloff::token::XML_GRAPHIC_PROPERTIES;
+using ::xmloff::token::XML_CHART_PROPERTIES;
+
+
+TYPEINIT1( XMLChartStyleContext, XMLPropStyleContext );
+
+// protected
+
+void XMLChartStyleContext::SetAttribute(
+ sal_uInt16 nPrefixKey,
+ const ::rtl::OUString& rLocalName,
+ const ::rtl::OUString& rValue )
+{
+ if( IsXMLToken( rLocalName, XML_DATA_STYLE_NAME ) )
+ {
+ msDataStyleName =rValue;
+ }
+ else if( IsXMLToken( rLocalName, XML_PERCENTAGE_DATA_STYLE_NAME ) )
+ {
+ msPercentageDataStyleName =rValue;
+ }
+ else
+ {
+ XMLShapeStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
+ }
+}
+
+//public
+
+// CTOR
+XMLChartStyleContext::XMLChartStyleContext(
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList,
+ SvXMLStylesContext& rStyles, sal_uInt16 nFamily ) :
+
+ XMLShapeStyleContext( rImport, nPrfx, rLName, xAttrList, rStyles, nFamily ),
+ mrStyles( rStyles )
+{}
+
+// DTOR
+XMLChartStyleContext::~XMLChartStyleContext()
+{}
+
+namespace
+{
+
+ void lcl_NumberFormatStyleToProperty( const ::rtl::OUString& rStyleName, const ::rtl::OUString& rPropertyName,
+ const SvXMLStylesContext& rStylesContext,
+ const uno::Reference< beans::XPropertySet >& rPropSet )
+{
+ if( rStyleName.getLength())
+ {
+ SvXMLNumFormatContext* pStyle = (SvXMLNumFormatContext *)rStylesContext.FindStyleChildContext(
+ XML_STYLE_FAMILY_DATA_STYLE, rStyleName, sal_True );
+ if( pStyle )
+ {
+ uno::Any aNumberFormat;
+ sal_Int32 nNumberFormat = pStyle->GetKey();
+ aNumberFormat <<= nNumberFormat;
+ rPropSet->setPropertyValue( rPropertyName, aNumberFormat );
+ }
+ }
+}
+
+}// anonymous namespace
+
+void XMLChartStyleContext::FillPropertySet(
+ const uno::Reference< beans::XPropertySet > & rPropSet )
+{
+ try
+ {
+ XMLShapeStyleContext::FillPropertySet( rPropSet );
+ }
+ catch( beans::UnknownPropertyException& )
+ {
+ DBG_ASSERT( false, "unknown property exception -> shape style not completly imported for chart style" );
+ }
+
+ lcl_NumberFormatStyleToProperty( msDataStyleName, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "NumberFormat" )), mrStyles, rPropSet );
+ lcl_NumberFormatStyleToProperty( msPercentageDataStyleName, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PercentageNumberFormat" )), mrStyles, rPropSet );
+}
+
+SvXMLImportContext *XMLChartStyleContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList )
+{
+ SvXMLImportContext* pContext = NULL;
+
+ if( XML_NAMESPACE_STYLE == nPrefix )
+ {
+ sal_uInt32 nFamily = 0;
+ if( IsXMLToken( rLocalName, XML_TEXT_PROPERTIES ) )
+ nFamily = XML_TYPE_PROP_TEXT;
+ else if( IsXMLToken( rLocalName, XML_PARAGRAPH_PROPERTIES ) )
+ nFamily = XML_TYPE_PROP_PARAGRAPH;
+ else if( IsXMLToken( rLocalName, XML_GRAPHIC_PROPERTIES ) )
+ nFamily = XML_TYPE_PROP_GRAPHIC;
+ else if( IsXMLToken( rLocalName, XML_CHART_PROPERTIES ) )
+ nFamily = XML_TYPE_PROP_CHART;
+ if( nFamily )
+ {
+ UniReference < SvXMLImportPropertyMapper > xImpPrMap =
+ GetStyles()->GetImportPropertyMapper( GetFamily() );
+ if( xImpPrMap.is() )
+ pContext = new XMLChartPropertyContext(
+ GetImport(), nPrefix, rLocalName, xAttrList, nFamily,
+ GetProperties(), xImpPrMap );
+ }
+ }
+
+ if( !pContext )
+ pContext = XMLShapeStyleContext::CreateChildContext( nPrefix, rLocalName,
+ xAttrList );
+
+ return pContext;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/XMLErrorBarStylePropertyHdl.cxx b/xmloff/source/chart/XMLErrorBarStylePropertyHdl.cxx
new file mode 100644
index 000000000000..fa88a09957d0
--- /dev/null
+++ b/xmloff/source/chart/XMLErrorBarStylePropertyHdl.cxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLErrorBarStylePropertyHdl.hxx"
+#include <unotools/saveopt.hxx>
+
+#include <com/sun/star/chart/ErrorBarStyle.hpp>
+#include <com/sun/star/uno/Any.hxx>
+
+using ::rtl::OUString;
+using namespace com::sun::star;
+
+XMLErrorBarStylePropertyHdl::XMLErrorBarStylePropertyHdl( const SvXMLEnumMapEntry* pEnumMap, const ::com::sun::star::uno::Type & rType )
+ : XMLEnumPropertyHdl( pEnumMap, rType )
+{
+}
+
+XMLErrorBarStylePropertyHdl::~XMLErrorBarStylePropertyHdl()
+{
+}
+
+sal_Bool XMLErrorBarStylePropertyHdl::exportXML( OUString& rStrExpValue,
+ const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ uno::Any aValue(rValue);
+ const SvtSaveOptions::ODFDefaultVersion nCurrentVersion( SvtSaveOptions().GetODFDefaultVersion() );
+ if( nCurrentVersion < SvtSaveOptions::ODFVER_012 )
+ {
+ sal_Int32 nValue = 0;
+ if(rValue >>= nValue )
+ {
+ if( nValue == ::com::sun::star::chart::ErrorBarStyle::STANDARD_ERROR
+ || nValue == ::com::sun::star::chart::ErrorBarStyle::FROM_DATA )
+ {
+ nValue = ::com::sun::star::chart::ErrorBarStyle::NONE;
+ aValue = uno::makeAny(nValue);
+ }
+ }
+ }
+
+ return XMLEnumPropertyHdl::exportXML( rStrExpValue, aValue, rUnitConverter );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/XMLErrorBarStylePropertyHdl.hxx b/xmloff/source/chart/XMLErrorBarStylePropertyHdl.hxx
new file mode 100644
index 000000000000..09e4dfddba72
--- /dev/null
+++ b/xmloff/source/chart/XMLErrorBarStylePropertyHdl.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLERRORBARSTYLEPROPERTYHDL_HXX_
+#define _XMLERRORBARSTYLEPROPERTYHDL_HXX_
+
+#include <xmloff/EnumPropertyHdl.hxx>
+
+class XMLErrorBarStylePropertyHdl : public XMLEnumPropertyHdl
+{
+public:
+ XMLErrorBarStylePropertyHdl( const SvXMLEnumMapEntry* pEnumMap, const ::com::sun::star::uno::Type & rType );
+ virtual ~XMLErrorBarStylePropertyHdl();
+
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLERRORBARSTYLEPROPERTYHDL_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/XMLErrorIndicatorPropertyHdl.cxx b/xmloff/source/chart/XMLErrorIndicatorPropertyHdl.cxx
new file mode 100644
index 000000000000..966f33ef85d3
--- /dev/null
+++ b/xmloff/source/chart/XMLErrorIndicatorPropertyHdl.cxx
@@ -0,0 +1,108 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLErrorIndicatorPropertyHdl.hxx"
+#include <xmloff/xmluconv.hxx>
+#include <com/sun/star/chart/ChartErrorIndicatorType.hpp>
+#include <rtl/ustrbuf.hxx>
+
+using namespace com::sun::star;
+
+XMLErrorIndicatorPropertyHdl::~XMLErrorIndicatorPropertyHdl()
+{}
+
+sal_Bool XMLErrorIndicatorPropertyHdl::importXML( const ::rtl::OUString& rStrImpValue,
+ uno::Any& rValue, const SvXMLUnitConverter& /*rUnitConverter*/ ) const
+{
+ bool bValue;
+ SvXMLUnitConverter::convertBool( bValue, rStrImpValue );
+
+ // modify existing value
+ chart::ChartErrorIndicatorType eType = chart::ChartErrorIndicatorType_NONE;
+ if( rValue.hasValue())
+ rValue >>= eType;
+
+ if( bValue ) // enable flag
+ {
+ if( eType != chart::ChartErrorIndicatorType_TOP_AND_BOTTOM )
+ {
+ if( mbUpperIndicator )
+ eType = ( eType == chart::ChartErrorIndicatorType_LOWER )
+ ? chart::ChartErrorIndicatorType_TOP_AND_BOTTOM
+ : chart::ChartErrorIndicatorType_UPPER;
+ else
+ eType = ( eType == chart::ChartErrorIndicatorType_UPPER )
+ ? chart::ChartErrorIndicatorType_TOP_AND_BOTTOM
+ : chart::ChartErrorIndicatorType_LOWER;
+ }
+ }
+ else // disable flag
+ {
+ if( eType != chart::ChartErrorIndicatorType_NONE )
+ {
+ if( mbUpperIndicator )
+ eType = ( eType == chart::ChartErrorIndicatorType_UPPER )
+ ? chart::ChartErrorIndicatorType_NONE
+ : chart::ChartErrorIndicatorType_LOWER;
+ else
+ eType = ( eType == chart::ChartErrorIndicatorType_LOWER )
+ ? chart::ChartErrorIndicatorType_NONE
+ : chart::ChartErrorIndicatorType_UPPER;
+ }
+ }
+
+ rValue <<= eType;
+
+ return sal_True;
+}
+
+sal_Bool XMLErrorIndicatorPropertyHdl::exportXML( ::rtl::OUString& rStrExpValue,
+ const uno::Any& rValue, const SvXMLUnitConverter& /*rUnitConverter*/ ) const
+{
+ rtl::OUStringBuffer aBuffer;
+ chart::ChartErrorIndicatorType eType;
+
+ rValue >>= eType;
+ sal_Bool bValue = ( eType == chart::ChartErrorIndicatorType_TOP_AND_BOTTOM ||
+ ( mbUpperIndicator
+ ? ( eType == chart::ChartErrorIndicatorType_UPPER )
+ : ( eType == chart::ChartErrorIndicatorType_LOWER )));
+
+ if( bValue )
+ {
+ SvXMLUnitConverter::convertBool( aBuffer, bValue );
+ rStrExpValue = aBuffer.makeStringAndClear();
+ }
+
+ // only export if set to true
+ return bValue;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/XMLErrorIndicatorPropertyHdl.hxx b/xmloff/source/chart/XMLErrorIndicatorPropertyHdl.hxx
new file mode 100644
index 000000000000..311b3168662a
--- /dev/null
+++ b/xmloff/source/chart/XMLErrorIndicatorPropertyHdl.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLERRORINDICATORPROPERTYHDL_HXX_
+#define _XMLERRORINDICATORPROPERTYHDL_HXX_
+
+#include <xmloff/xmlprhdl.hxx>
+
+class XMLErrorIndicatorPropertyHdl : public XMLPropertyHandler
+{
+private:
+ sal_Bool mbUpperIndicator;
+
+public:
+ XMLErrorIndicatorPropertyHdl( sal_Bool bUpper ) : mbUpperIndicator( bUpper )
+ {}
+ virtual ~XMLErrorIndicatorPropertyHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLERRORINDICATORPROPERTYHDL_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/XMLLabelSeparatorContext.cxx b/xmloff/source/chart/XMLLabelSeparatorContext.cxx
new file mode 100644
index 000000000000..00f1d57a3783
--- /dev/null
+++ b/xmloff/source/chart/XMLLabelSeparatorContext.cxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLLabelSeparatorContext.hxx"
+
+#include "SchXMLParagraphContext.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmltkmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/nmspmap.hxx>
+
+TYPEINIT1( XMLLabelSeparatorContext, XMLElementPropertyContext );
+
+using namespace ::com::sun::star;
+
+XMLLabelSeparatorContext::XMLLabelSeparatorContext(
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName,
+ const XMLPropertyState& rProp,
+ ::std::vector< XMLPropertyState > &rProps ) :
+ XMLElementPropertyContext(
+ rImport, nPrfx, rLocalName, rProp, rProps ),
+ m_aSeparator()
+{
+}
+
+XMLLabelSeparatorContext::~XMLLabelSeparatorContext()
+{}
+
+void XMLLabelSeparatorContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& /*xAttrList*/ )
+{
+}
+
+SvXMLImportContext* XMLLabelSeparatorContext::CreateChildContext(
+ sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > & /*xAttrList*/ )
+{
+ SvXMLImportContext* pContext = NULL;
+ if( xmloff::token::IsXMLToken( rLocalName, xmloff::token::XML_P ) )
+ {
+ pContext = new SchXMLParagraphContext( GetImport(),
+ rLocalName, m_aSeparator );
+ }
+ if( !pContext )
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+
+ return pContext;
+}
+
+void XMLLabelSeparatorContext::EndElement()
+{
+ if( m_aSeparator.getLength() )
+ {
+ // aProp is a member of XMLElementPropertyContext
+ aProp.maValue <<= m_aSeparator;
+ SetInsert( sal_True );
+ }
+
+ XMLElementPropertyContext::EndElement();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/XMLLabelSeparatorContext.hxx b/xmloff/source/chart/XMLLabelSeparatorContext.hxx
new file mode 100644
index 000000000000..e222e195d719
--- /dev/null
+++ b/xmloff/source/chart/XMLLabelSeparatorContext.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 XMLOFF_LABELSEPARATORCONTEXT_HXX_
+#define XMLOFF_LABELSEPARATORCONTEXT_HXX_
+
+#include "XMLElementPropertyContext.hxx"
+
+class XMLLabelSeparatorContext : public XMLElementPropertyContext
+{
+public:
+ TYPEINFO();
+
+ XMLLabelSeparatorContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const XMLPropertyState& rProp,
+ ::std::vector< XMLPropertyState > &rProps );
+ virtual ~XMLLabelSeparatorContext();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+
+private:
+ ::rtl::OUString m_aSeparator;
+};
+
+#endif // _XMLOFF_SYMBOLIMAGECONTEXT_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/XMLSymbolImageContext.cxx b/xmloff/source/chart/XMLSymbolImageContext.cxx
new file mode 100644
index 000000000000..406b1c5491ac
--- /dev/null
+++ b/xmloff/source/chart/XMLSymbolImageContext.cxx
@@ -0,0 +1,153 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLSymbolImageContext.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmltkmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/XMLBase64ImportContext.hxx>
+#include <com/sun/star/io/XOutputStream.hpp>
+
+TYPEINIT1( XMLSymbolImageContext, XMLElementPropertyContext );
+
+using namespace ::com::sun::star;
+
+enum SvXMLTokenMapAttrs
+{
+ XML_TOK_SYMBOL_IMAGE_HREF,
+ XML_TOK_SYMBOL_IMAGE_TYPE,
+ XML_TOK_SYMBOL_IMAGE_ACTUATE,
+ XML_TOK_SYMBOL_IMAGE_SHOW,
+ XML_TOK_SYMBOL_IMAGE_END = XML_TOK_UNKNOWN
+};
+
+static SvXMLTokenMapEntry aSymbolImageAttrTokenMap[] =
+{
+ { XML_NAMESPACE_XLINK, ::xmloff::token::XML_HREF, XML_TOK_SYMBOL_IMAGE_HREF },
+ { XML_NAMESPACE_XLINK, ::xmloff::token::XML_TYPE, XML_TOK_SYMBOL_IMAGE_TYPE },
+ { XML_NAMESPACE_XLINK, ::xmloff::token::XML_ACTUATE, XML_TOK_SYMBOL_IMAGE_ACTUATE },
+ { XML_NAMESPACE_XLINK, ::xmloff::token::XML_SHOW, XML_TOK_SYMBOL_IMAGE_SHOW },
+ XML_TOKEN_MAP_END
+};
+
+XMLSymbolImageContext::XMLSymbolImageContext(
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const XMLPropertyState& rProp,
+ ::std::vector< XMLPropertyState > &rProps ) :
+ XMLElementPropertyContext(
+ rImport, nPrfx, rLName, rProp, rProps )
+{
+}
+
+XMLSymbolImageContext::~XMLSymbolImageContext()
+{}
+
+void XMLSymbolImageContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ SvXMLTokenMap aTokenMap( aSymbolImageAttrTokenMap );
+ ::rtl::OUString aLocalName;
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i = 0; i < nAttrCount; i++ )
+ {
+ const ::rtl::OUString& rAttrName = xAttrList->getNameByIndex( i );
+ sal_uInt16 nPrefix =
+ GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ const ::rtl::OUString& rValue = xAttrList->getValueByIndex( i );
+
+ switch( aTokenMap.Get( nPrefix, aLocalName ) )
+ {
+ case XML_TOK_SYMBOL_IMAGE_HREF:
+ msURL = rValue;
+ break;
+ case XML_TOK_SYMBOL_IMAGE_ACTUATE:
+ case XML_TOK_SYMBOL_IMAGE_TYPE:
+ case XML_TOK_SYMBOL_IMAGE_SHOW:
+ // these values are currently not interpreted
+ // it is always assumed 'actuate=onLoad', 'type=simple', 'show=embed'
+ break;
+ }
+ }
+}
+
+SvXMLImportContext* XMLSymbolImageContext::CreateChildContext(
+ sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList )
+{
+ SvXMLImportContext* pContext = NULL;
+ if( xmloff::token::IsXMLToken( rLocalName,
+ xmloff::token::XML_BINARY_DATA ) )
+ {
+ if( ! msURL.getLength() && ! mxBase64Stream.is() )
+ {
+ mxBase64Stream = GetImport().GetStreamForGraphicObjectURLFromBase64();
+ if( mxBase64Stream.is() )
+ pContext = new XMLBase64ImportContext( GetImport(), nPrefix,
+ rLocalName, xAttrList,
+ mxBase64Stream );
+ }
+ }
+ if( ! pContext )
+ {
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+ }
+
+ return pContext;
+}
+
+void XMLSymbolImageContext::EndElement()
+{
+ ::rtl::OUString sResolvedURL;
+
+ if( msURL.getLength() )
+ {
+ sResolvedURL = GetImport().ResolveGraphicObjectURL( msURL, sal_False );
+ }
+ else if( mxBase64Stream.is() )
+ {
+ sResolvedURL = GetImport().ResolveGraphicObjectURLFromBase64( mxBase64Stream );
+ mxBase64Stream = 0;
+ }
+
+ if( sResolvedURL.getLength())
+ {
+ // aProp is a member of XMLElementPropertyContext
+ aProp.maValue <<= sResolvedURL;
+ SetInsert( sal_True );
+ }
+
+ XMLElementPropertyContext::EndElement();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/XMLSymbolImageContext.hxx b/xmloff/source/chart/XMLSymbolImageContext.hxx
new file mode 100644
index 000000000000..765f92bc5e30
--- /dev/null
+++ b/xmloff/source/chart/XMLSymbolImageContext.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_SYMBOLIMAGECONTEXT_HXX_
+#define _XMLOFF_SYMBOLIMAGECONTEXT_HXX_
+
+#include "XMLElementPropertyContext.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace io { class XOutputStream; }
+} } }
+
+class XMLSymbolImageContext : public XMLElementPropertyContext
+{
+public:
+ TYPEINFO();
+
+ XMLSymbolImageContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const XMLPropertyState& rProp,
+ ::std::vector< XMLPropertyState > &rProps );
+ virtual ~XMLSymbolImageContext();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+
+private:
+ ::rtl::OUString msURL;
+ ::com::sun::star::uno::Reference < ::com::sun::star::io::XOutputStream > mxBase64Stream;
+};
+
+#endif // _XMLOFF_SYMBOLIMAGECONTEXT_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/XMLSymbolTypePropertyHdl.cxx b/xmloff/source/chart/XMLSymbolTypePropertyHdl.cxx
new file mode 100644
index 000000000000..4eba27eb4307
--- /dev/null
+++ b/xmloff/source/chart/XMLSymbolTypePropertyHdl.cxx
@@ -0,0 +1,173 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLSymbolTypePropertyHdl.hxx"
+#include <xmloff/xmluconv.hxx>
+#include <com/sun/star/chart/ChartErrorIndicatorType.hpp>
+#include <rtl/ustrbuf.hxx>
+
+using namespace ::xmloff::token;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+namespace
+{
+struct SvXMLSignedEnumMapEntry
+{
+ ::xmloff::token::XMLTokenEnum eToken;
+ sal_Int32 nValue;
+};
+
+SvXMLSignedEnumMapEntry aXMLChartSymbolTypeEnumMap[] =
+{
+ { XML_NONE, -3 },
+ { XML_AUTOMATIC, -2 },
+ { XML_IMAGE, -1 },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLSignedEnumMapEntry aXMLChartSymbolNameMap[] =
+{
+ { XML_GRADIENTSTYLE_SQUARE, 0 }, // "square"
+ { XML_DIAMOND, 1 },
+ { XML_ARROW_DOWN, 2 },
+ { XML_ARROW_UP, 3 },
+ { XML_ARROW_RIGHT, 4 },
+ { XML_ARROW_LEFT, 5 },
+ { XML_BOW_TIE, 6 },
+ { XML_HOURGLASS, 7 },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+sal_Bool lcl_convertEnum(
+ OUStringBuffer & rBuffer,
+ sal_Int32 nValue,
+ const SvXMLSignedEnumMapEntry *pMap )
+{
+ enum XMLTokenEnum eTok = XML_TOKEN_INVALID;
+
+ while( pMap->eToken != XML_TOKEN_INVALID )
+ {
+ if( pMap->nValue == nValue )
+ {
+ eTok = pMap->eToken;
+ break;
+ }
+ pMap++;
+ }
+
+ if( eTok != XML_TOKEN_INVALID )
+ rBuffer.append( GetXMLToken(eTok) );
+
+ return (eTok != XML_TOKEN_INVALID);
+}
+
+sal_Bool lcl_convertEnum(
+ sal_Int32 & rEnum,
+ const OUString & rValue,
+ const SvXMLSignedEnumMapEntry *pMap )
+{
+ while( pMap->eToken != XML_TOKEN_INVALID )
+ {
+ if( IsXMLToken( rValue, pMap->eToken ) )
+ {
+ rEnum = pMap->nValue;
+ return sal_True;
+ }
+ pMap++;
+ }
+ return sal_False;
+}
+
+} // anonymous namespace
+
+using namespace com::sun::star;
+
+XMLSymbolTypePropertyHdl::XMLSymbolTypePropertyHdl( bool bIsNamedSymbol )
+ : m_bIsNamedSymbol( bIsNamedSymbol )
+{}
+
+XMLSymbolTypePropertyHdl::~XMLSymbolTypePropertyHdl()
+{}
+
+sal_Bool XMLSymbolTypePropertyHdl::importXML( const OUString& rStrImpValue,
+ uno::Any& rValue, const SvXMLUnitConverter& /*rUnitConverter*/ ) const
+{
+ sal_Bool bResult = sal_False;
+
+ if( m_bIsNamedSymbol )
+ {
+ sal_Int32 nValue = -3; // NONE
+ bResult = lcl_convertEnum( nValue, rStrImpValue, aXMLChartSymbolNameMap );
+ rValue <<= nValue;
+ }
+ else
+ {
+ sal_Int32 nValue = -3; // NONE
+ bResult = lcl_convertEnum( nValue, rStrImpValue, aXMLChartSymbolTypeEnumMap );
+ rValue <<= nValue;
+ }
+
+ return bResult;
+}
+
+sal_Bool XMLSymbolTypePropertyHdl::exportXML( OUString& rStrExpValue,
+ const uno::Any& rValue, const SvXMLUnitConverter& /*rUnitConverter*/ ) const
+{
+ sal_Bool bResult = sal_False;
+
+ sal_Int32 nType = -3; // NONE
+ rValue >>= nType;
+
+ if( m_bIsNamedSymbol )
+ {
+ OUStringBuffer aBuf;
+ bResult = lcl_convertEnum( aBuf, nType, aXMLChartSymbolNameMap );
+ rStrExpValue = aBuf.makeStringAndClear();
+ }
+ else
+ {
+ if( nType < 0 )
+ {
+ OUStringBuffer aBuf;
+ bResult = lcl_convertEnum( aBuf, nType, aXMLChartSymbolTypeEnumMap );
+ rStrExpValue = aBuf.makeStringAndClear();
+ }
+ else
+ {
+ bResult = true;
+ rStrExpValue = GetXMLToken( XML_NAMED_SYMBOL );
+ }
+ }
+
+ return bResult;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/XMLSymbolTypePropertyHdl.hxx b/xmloff/source/chart/XMLSymbolTypePropertyHdl.hxx
new file mode 100644
index 000000000000..b7e9698d0db5
--- /dev/null
+++ b/xmloff/source/chart/XMLSymbolTypePropertyHdl.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLSYMBOLTYPEPROPERTYHDL_HXX_
+#define _XMLSYMBOLTYPEPROPERTYHDL_HXX_
+
+#include <xmloff/xmlprhdl.hxx>
+
+class XMLSymbolTypePropertyHdl : public XMLPropertyHandler
+{
+public:
+ XMLSymbolTypePropertyHdl( bool bIsNamedSymbol );
+ virtual ~XMLSymbolTypePropertyHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+
+private:
+ bool m_bIsNamedSymbol;
+ sal_Int32 nSymbolType;
+};
+
+#endif // _XMLSYMBOLTYPEPROPERTYHDL_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/XMLTextOrientationHdl.cxx b/xmloff/source/chart/XMLTextOrientationHdl.cxx
new file mode 100644
index 000000000000..691f0dc7b449
--- /dev/null
+++ b/xmloff/source/chart/XMLTextOrientationHdl.cxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLTextOrientationHdl.hxx"
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmltoken.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+XMLTextOrientationHdl::~XMLTextOrientationHdl()
+{
+}
+
+sal_Bool XMLTextOrientationHdl::importXML(
+ const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& /*rUnitConverter*/ ) const
+{
+ sal_Bool bRetval( sal_False );
+
+ if( IsXMLToken( rStrImpValue, XML_LTR ))
+ {
+ rValue <<= static_cast< sal_Bool >( sal_False );
+ bRetval = sal_True;
+ }
+ else if( IsXMLToken( rStrImpValue, XML_TTB ))
+ {
+ rValue <<= static_cast< sal_Bool >( sal_True );
+ bRetval = sal_True;
+ }
+
+ return bRetval;
+}
+
+sal_Bool XMLTextOrientationHdl::exportXML(
+ ::rtl::OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& /*rUnitConverter*/ ) const
+{
+ sal_Bool bVal (sal_False );
+ sal_Bool bRetval( sal_False );
+
+ if( rValue >>= bVal )
+ {
+ if( bVal )
+ rStrExpValue = GetXMLToken( XML_TTB );
+ else
+ rStrExpValue = GetXMLToken( XML_LTR );
+ bRetval = sal_True;
+ }
+
+ return bRetval;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/XMLTextOrientationHdl.hxx b/xmloff/source/chart/XMLTextOrientationHdl.hxx
new file mode 100644
index 000000000000..9d9a1cf86789
--- /dev/null
+++ b/xmloff/source/chart/XMLTextOrientationHdl.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLTEXTORIENTATIONHDL_HXX_
+#define _XMLTEXTORIENTATIONHDL_HXX_
+
+#include <xmloff/xmlprhdl.hxx>
+
+class XMLTextOrientationHdl : public XMLPropertyHandler
+{
+private:
+public:
+ virtual ~XMLTextOrientationHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLTEXTORIENTATIONHDL_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/contexts.cxx b/xmloff/source/chart/contexts.cxx
new file mode 100644
index 000000000000..1ba23abe24d1
--- /dev/null
+++ b/xmloff/source/chart/contexts.cxx
@@ -0,0 +1,235 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmlmetai.hxx>
+#include <xmloff/xmlstyle.hxx>
+#include "SchXMLImport.hxx"
+#include "SchXMLCalculationSettingsContext.hxx"
+
+#include "contexts.hxx"
+#include "SchXMLChartContext.hxx"
+
+using namespace com::sun::star;
+using namespace ::xmloff::token;
+
+// ==================================================
+
+class SchXMLBodyContext_Impl : public SvXMLImportContext
+{
+private:
+ SchXMLImportHelper& mrImportHelper;
+
+public:
+
+ SchXMLBodyContext_Impl( SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName );
+ virtual ~SchXMLBodyContext_Impl();
+
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList );
+};
+
+SchXMLBodyContext_Impl::SchXMLBodyContext_Impl(
+ SchXMLImportHelper& rImpHelper, SvXMLImport& rImport,
+ sal_uInt16 nPrfx, const ::rtl::OUString& rLName ) :
+ SvXMLImportContext( rImport, nPrfx, rLName ),
+ mrImportHelper( rImpHelper )
+{
+}
+
+SchXMLBodyContext_Impl::~SchXMLBodyContext_Impl()
+{
+}
+
+SvXMLImportContext *SchXMLBodyContext_Impl::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > & )
+{
+ return new SchXMLBodyContext( mrImportHelper, GetImport(), nPrefix,
+ rLocalName );
+}
+
+// ==================================================
+
+SchXMLDocContext::SchXMLDocContext( SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLName ) :
+ SvXMLImportContext( rImport, nPrefix, rLName ),
+ mrImportHelper( rImpHelper )
+{
+ DBG_ASSERT( XML_NAMESPACE_OFFICE == nPrefix &&
+ ( IsXMLToken( rLName, XML_DOCUMENT ) ||
+ IsXMLToken( rLName, XML_DOCUMENT_META) ||
+ IsXMLToken( rLName, XML_DOCUMENT_STYLES) ||
+ IsXMLToken( rLName, XML_DOCUMENT_CONTENT) ),
+ "SchXMLDocContext instanciated with no <office:document> element" );
+}
+
+SchXMLDocContext::~SchXMLDocContext()
+{}
+
+TYPEINIT1( SchXMLDocContext, SvXMLImportContext );
+
+SvXMLImportContext* SchXMLDocContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ SvXMLImportContext* pContext = 0;
+ const SvXMLTokenMap& rTokenMap = mrImportHelper.GetDocElemTokenMap();
+ sal_uInt16 nFlags = GetImport().getImportFlags();
+
+ switch( rTokenMap.Get( nPrefix, rLocalName ))
+ {
+ case XML_TOK_DOC_AUTOSTYLES:
+ if( nFlags & IMPORT_AUTOSTYLES )
+ // not nice, but this is safe, as the SchXMLDocContext class can only by
+ // instantiated by the chart import class SchXMLImport (header is not exported)
+ pContext =
+ static_cast< SchXMLImport& >( GetImport() ).CreateStylesContext( rLocalName, xAttrList );
+ break;
+ case XML_TOK_DOC_STYLES:
+ // for draw styles containing gradients/hatches/markers and dashes
+ if( nFlags & IMPORT_STYLES )
+ pContext = new SvXMLStylesContext( GetImport(), nPrefix, rLocalName, xAttrList );
+ break;
+ case XML_TOK_DOC_META:
+ // we come here in the flat ODF file format,
+ // if XDocumentPropertiesSupplier is not supported at the model
+// DBG_WARNING("XML_TOK_DOC_META: should not have come here, maybe document is invalid?");
+ pContext = SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList );
+ break;
+ case XML_TOK_DOC_BODY:
+ if( nFlags & IMPORT_CONTENT )
+ pContext = new SchXMLBodyContext_Impl( mrImportHelper, GetImport(), nPrefix, rLocalName );
+ break;
+ }
+
+ // call parent when no own context was created
+ if( ! pContext )
+ pContext = SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList );
+
+ return pContext;
+}
+
+// ==================================================
+
+SchXMLFlatDocContext_Impl::SchXMLFlatDocContext_Impl(
+ SchXMLImportHelper& i_rImpHelper,
+ SchXMLImport& i_rImport,
+ sal_uInt16 i_nPrefix, const ::rtl::OUString & i_rLName,
+ const uno::Reference<document::XDocumentProperties>& i_xDocProps,
+ const uno::Reference<xml::sax::XDocumentHandler>& i_xDocBuilder) :
+ SvXMLImportContext(i_rImport, i_nPrefix, i_rLName),
+ SchXMLDocContext(i_rImpHelper, i_rImport, i_nPrefix, i_rLName),
+ SvXMLMetaDocumentContext(i_rImport, i_nPrefix, i_rLName,
+ i_xDocProps, i_xDocBuilder)
+{
+}
+
+SchXMLFlatDocContext_Impl::~SchXMLFlatDocContext_Impl() { }
+
+
+SvXMLImportContext *SchXMLFlatDocContext_Impl::CreateChildContext(
+ sal_uInt16 i_nPrefix, const ::rtl::OUString& i_rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& i_xAttrList)
+{
+ // behave like meta base class iff we encounter office:meta
+ const SvXMLTokenMap& rTokenMap =
+ mrImportHelper.GetDocElemTokenMap();
+ if ( XML_TOK_DOC_META == rTokenMap.Get( i_nPrefix, i_rLocalName ) ) {
+ return SvXMLMetaDocumentContext::CreateChildContext(
+ i_nPrefix, i_rLocalName, i_xAttrList );
+ } else {
+ return SchXMLDocContext::CreateChildContext(
+ i_nPrefix, i_rLocalName, i_xAttrList );
+ }
+}
+
+// ----------------------------------------
+
+SchXMLBodyContext::SchXMLBodyContext( SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLName ) :
+ SvXMLImportContext( rImport, nPrefix, rLName ),
+ mrImportHelper( rImpHelper )
+{
+ DBG_ASSERT( XML_NAMESPACE_OFFICE == nPrefix &&
+ IsXMLToken( rLName, XML_CHART ),
+ "SchXMLBodyContext instanciated with no <office:chart> element" );
+}
+
+SchXMLBodyContext::~SchXMLBodyContext()
+{}
+
+void SchXMLBodyContext::EndElement()
+{
+}
+
+SvXMLImportContext* SchXMLBodyContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ SvXMLImportContext* pContext = 0;
+
+ // <chart:chart> element
+ if( nPrefix == XML_NAMESPACE_CHART &&
+ IsXMLToken( rLocalName, XML_CHART ) )
+ {
+ pContext = mrImportHelper.CreateChartContext( GetImport(),
+ nPrefix, rLocalName,
+ GetImport().GetModel(),
+ xAttrList );
+ }
+ else if(nPrefix == XML_NAMESPACE_TABLE &&
+ IsXMLToken( rLocalName, XML_CALCULATION_SETTINGS ))
+ {
+ // i99104 handle null date correctly
+ pContext = new SchXMLCalculationSettingsContext ( GetImport(), nPrefix, rLocalName, xAttrList);
+ }
+ else
+ {
+ pContext = SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList );
+ }
+
+ return pContext;
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/contexts.hxx b/xmloff/source/chart/contexts.hxx
new file mode 100644
index 000000000000..8cccc0975960
--- /dev/null
+++ b/xmloff/source/chart/contexts.hxx
@@ -0,0 +1,118 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _SCH_XML_CONTEXTS_HXX_
+#define _SCH_XML_CONTEXTS_HXX_
+
+#include "SchXMLImport.hxx"
+#include "SchXMLTableContext.hxx"
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/xmltkmap.hxx>
+
+#include <xmloff/xmlmetai.hxx>
+
+namespace com { namespace sun { namespace star { namespace xml { namespace sax {
+ class XAttributeList;
+}}}}}
+
+/* ========================================
+
+ These contexts are only nedded by
+ SchXMLImport not by the SchXMLImportHelper
+ that is also used by other applications
+
+ ======================================== */
+
+class SchXMLDocContext : public virtual SvXMLImportContext
+{
+protected:
+ SchXMLImportHelper& mrImportHelper;
+
+public:
+ SchXMLDocContext(
+ SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLName );
+ virtual ~SchXMLDocContext();
+
+ TYPEINFO();
+
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
+};
+
+// ========================================
+
+// context for flat file xml format
+class SchXMLFlatDocContext_Impl
+ : public SchXMLDocContext, public SvXMLMetaDocumentContext
+{
+public:
+ SchXMLFlatDocContext_Impl(
+ SchXMLImportHelper& i_rImpHelper,
+ SchXMLImport& i_rImport,
+ sal_uInt16 i_nPrefix, const ::rtl::OUString & i_rLName,
+ const com::sun::star::uno::Reference<com::sun::star::document::XDocumentProperties>& i_xDocProps,
+ const com::sun::star::uno::Reference<com::sun::star::xml::sax::XDocumentHandler>& i_xDocBuilder);
+
+ virtual ~SchXMLFlatDocContext_Impl();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 i_nPrefix, const ::rtl::OUString& i_rLocalName,
+ const com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList>& i_xAttrList);
+};
+
+// ========================================
+
+class SchXMLBodyContext : public SvXMLImportContext
+{
+private:
+ SchXMLImportHelper& mrImportHelper;
+
+public:
+ SchXMLBodyContext(
+ SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLName );
+ virtual ~SchXMLBodyContext();
+
+ virtual void EndElement();
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
+};
+
+// ========================================
+
+#endif // _SCH_XML_CONTEXTS_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/makefile.mk b/xmloff/source/chart/makefile.mk
new file mode 100755
index 000000000000..3151d633d13f
--- /dev/null
+++ b/xmloff/source/chart/makefile.mk
@@ -0,0 +1,73 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ = ..$/..
+PRJNAME = xmloff
+TARGET = chart
+AUTOSEG = true
+ENABLE_EXCEPTIONS = TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE: $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = $(SLO)$/ColorPropertySet.obj \
+ $(SLO)$/SchXMLTools.obj \
+ $(SLO)$/SchXMLExport.obj \
+ $(SLO)$/SchXMLImport.obj \
+ $(SLO)$/contexts.obj \
+ $(SLO)$/SchXMLTableContext.obj \
+ $(SLO)$/SchXMLChartContext.obj \
+ $(SLO)$/SchXMLLegendContext.obj \
+ $(SLO)$/SchXMLPlotAreaContext.obj \
+ $(SLO)$/SchXMLAxisContext.obj \
+ $(SLO)$/SchXMLParagraphContext.obj \
+ $(SLO)$/SchXMLTextListContext.obj \
+ $(SLO)$/SchXMLSeriesHelper.obj \
+ $(SLO)$/SchXMLSeries2Context.obj \
+ $(SLO)$/SchXMLEnumConverter.obj \
+ $(SLO)$/PropertyMaps.obj \
+ $(SLO)$/XMLChartStyleContext.obj \
+ $(SLO)$/XMLErrorIndicatorPropertyHdl.obj \
+ $(SLO)$/XMLErrorBarStylePropertyHdl.obj \
+ $(SLO)$/SchXMLAutoStylePoolP.obj \
+ $(SLO)$/XMLChartPropertyContext.obj \
+ $(SLO)$/XMLSymbolImageContext.obj \
+ $(SLO)$/XMLLabelSeparatorContext.obj \
+ $(SLO)$/XMLTextOrientationHdl.obj \
+ $(SLO)$/XMLSymbolTypePropertyHdl.obj \
+ $(SLO)$/XMLAxisPositionPropertyHdl.obj \
+ $(SLO)$/SchXMLCalculationSettingsContext.obj \
+ $(SLO)$/transporttypes.obj
+
+# --- Targets --------------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/xmloff/source/chart/transporttypes.cxx b/xmloff/source/chart/transporttypes.cxx
new file mode 100644
index 000000000000..66d54b6e8e3c
--- /dev/null
+++ b/xmloff/source/chart/transporttypes.cxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "transporttypes.hxx"
+
+bool operator < ( const tSchXMLIndexWithPart & rFirst, const tSchXMLIndexWithPart & rSecond )
+{
+ if( rFirst.first == rSecond.first )
+ return (static_cast< int >( rFirst.second ) < static_cast< int >( rSecond.second ));
+ return (rFirst.first < rSecond.first);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/transporttypes.hxx b/xmloff/source/chart/transporttypes.hxx
new file mode 100644
index 000000000000..ffa4111a84df
--- /dev/null
+++ b/xmloff/source/chart/transporttypes.hxx
@@ -0,0 +1,228 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 SCH_XML_TRANSPORTTYPES_HXX_
+#define SCH_XML_TRANSPORTTYPES_HXX_
+
+#include <com/sun/star/chart2/XDataSeries.hpp>
+#include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
+
+#include <vector>
+#include <map>
+
+enum SchXMLCellType
+{
+ SCH_CELL_TYPE_UNKNOWN,
+ SCH_CELL_TYPE_FLOAT,
+ SCH_CELL_TYPE_STRING,
+ SCH_CELL_TYPE_COMPLEX_STRING
+};
+
+struct SchXMLCell
+{
+ rtl::OUString aString;
+ ::com::sun::star::uno::Sequence< rtl::OUString >* pComplexString;
+ double fValue;
+ SchXMLCellType eType;
+ rtl::OUString aRangeId;
+
+ SchXMLCell() : pComplexString(0), fValue( 0.0 ), eType( SCH_CELL_TYPE_UNKNOWN )
+ {}
+
+ SchXMLCell( const SchXMLCell& rOther )
+ : aString( rOther.aString )
+ , pComplexString( rOther.pComplexString ? new ::com::sun::star::uno::Sequence< rtl::OUString >( *rOther.pComplexString ) : 0 )
+ , fValue( rOther.fValue )
+ , eType( rOther.eType )
+ , aRangeId( rOther.aRangeId )
+ {}
+
+ ~SchXMLCell()
+ {
+ if(pComplexString)
+ {
+ delete pComplexString;
+ pComplexString=0;
+ }
+ }
+};
+
+struct SchXMLTable
+{
+ std::vector< std::vector< SchXMLCell > > aData; /// an array of rows containing the table contents
+
+ sal_Int32 nRowIndex; /// reflects the index of the row currently parsed
+ sal_Int32 nColumnIndex; /// reflects the index of the column currently parsed
+ sal_Int32 nMaxColumnIndex; /// the greatest number of columns detected
+
+ sal_Int32 nNumberOfColsEstimate; /// parsing column-elements may yield an estimate
+
+ bool bHasHeaderRow;
+ bool bHasHeaderColumn;
+
+ ::rtl::OUString aTableNameOfFile; /// the table name read at the table:table element
+
+ ::std::vector< sal_Int32 > aHiddenColumns;
+
+ bool bProtected;
+
+ SchXMLTable() : nRowIndex( -1 ),
+ nColumnIndex( -1 ),
+ nMaxColumnIndex( -1 ),
+ nNumberOfColsEstimate( 0 ),
+ bHasHeaderRow( false ),
+ bHasHeaderColumn( false ),
+ bProtected( false )
+ {}
+};
+
+typedef sal_Int32 tSchXMLIndex;
+#define SCH_XML_CATEGORIES_INDEX (static_cast<tSchXMLIndex>(-1))
+enum SchXMLLabeledSequencePart
+{
+ SCH_XML_PART_LABEL,
+ SCH_XML_PART_VALUES,
+ SCH_XML_PART_ERROR_BARS
+};
+typedef ::std::pair< tSchXMLIndex, SchXMLLabeledSequencePart > tSchXMLIndexWithPart;
+typedef ::std::multimap< tSchXMLIndexWithPart,
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > >
+ tSchXMLLSequencesPerIndex;
+
+bool operator < ( const tSchXMLIndexWithPart & rFirst, const tSchXMLIndexWithPart & rSecond );
+
+// ----------------------------------------
+
+struct SchNumericCellRangeAddress
+{
+ sal_Int32 nRow1, nRow2;
+ sal_Int32 nCol1, nCol2;
+
+ SchNumericCellRangeAddress() :
+ nRow1( -1 ), nRow2( -1 ),
+ nCol1( -1 ), nCol2( -1 )
+ {}
+
+ SchNumericCellRangeAddress( const SchNumericCellRangeAddress& aOther )
+ {
+ nRow1 = aOther.nRow1; nRow2 = aOther.nRow2;
+ nCol1 = aOther.nCol1; nCol2 = aOther.nCol2;
+ }
+};
+
+// ----------------------------------------
+
+enum SchXMLAxisDimension
+{
+ SCH_XML_AXIS_X = 0,
+ SCH_XML_AXIS_Y,
+ SCH_XML_AXIS_Z,
+ SCH_XML_AXIS_UNDEF
+};
+
+struct SchXMLAxis
+{
+ enum SchXMLAxisDimension eDimension;
+ sal_Int8 nAxisIndex;//0->primary axis; 1->secondary axis
+ rtl::OUString aName;
+ rtl::OUString aTitle;
+ bool bHasCategories;
+
+ SchXMLAxis() : eDimension( SCH_XML_AXIS_UNDEF ), nAxisIndex( 0 ), bHasCategories( false ) {}
+};
+
+// ----------------------------------------
+
+struct GlobalSeriesImportInfo
+{
+ GlobalSeriesImportInfo( sal_Bool& rAllRangeAddressesAvailable )
+ : rbAllRangeAddressesAvailable( rAllRangeAddressesAvailable )
+ , nCurrentDataIndex( 0 )
+ , nFirstFirstDomainIndex( -1 )
+ , nFirstSecondDomainIndex( -1 )
+ {}
+
+ sal_Bool& rbAllRangeAddressesAvailable;
+
+ sal_Int32 nCurrentDataIndex;
+
+ ::rtl::OUString aFirstFirstDomainAddress;
+ sal_Int32 nFirstFirstDomainIndex;
+
+ ::rtl::OUString aFirstSecondDomainAddress;
+ sal_Int32 nFirstSecondDomainIndex;
+};
+
+struct DataRowPointStyle
+{
+ enum StyleType
+ {
+ DATA_POINT,
+ DATA_SERIES,
+ MEAN_VALUE,
+ REGRESSION,
+ ERROR_INDICATOR
+ };
+
+ StyleType meType;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > m_xSeries;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > m_xOldAPISeries;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > m_xEquationProperties;
+ sal_Int32 m_nPointIndex;
+ sal_Int32 m_nPointRepeat;
+ ::rtl::OUString msStyleName;
+ ::rtl::OUString msSeriesStyleNameForDonuts;
+ sal_Int32 mnAttachedAxis;
+ bool mbSymbolSizeForSeriesIsMissingInFile;
+
+ DataRowPointStyle( StyleType eType
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >& xSeries
+ , sal_Int32 nPointIndex
+ , sal_Int32 nPointRepeat
+ , ::rtl::OUString sStyleName
+ , sal_Int32 nAttachedAxis = 0 ) :
+ meType( eType ),
+ m_xSeries( xSeries ),
+ m_xOldAPISeries( 0 ),
+ m_nPointIndex( nPointIndex ),
+ m_nPointRepeat( nPointRepeat ),
+ msStyleName( sStyleName ),
+ mnAttachedAxis( nAttachedAxis ),
+ mbSymbolSizeForSeriesIsMissingInFile( false )
+ {}
+};
+
+typedef ::std::multimap< ::rtl::OUString, ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataSequence > > tSchXMLRangeSequenceMap;
+
+#endif // SCH_XML_TRANSPORTTYPES_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/core/DocumentSettingsContext.cxx b/xmloff/source/core/DocumentSettingsContext.cxx
new file mode 100644
index 000000000000..3727b4d0265c
--- /dev/null
+++ b/xmloff/source/core/DocumentSettingsContext.cxx
@@ -0,0 +1,1018 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+#include <com/sun/star/util/XStringSubstitution.hpp>
+#include <xmloff/DocumentSettingsContext.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <tools/debug.hxx>
+
+#include <list>
+#include <com/sun/star/i18n/XForbiddenCharacters.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/formula/SymbolDescriptor.hpp>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/document/XViewDataSupplier.hpp>
+#include <com/sun/star/document/PrinterIndependentLayout.hpp>
+#include <comphelper/configurationhelper.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <xmlenums.hxx>
+
+using namespace com::sun::star;
+using namespace ::xmloff::token;
+
+#define C2U(cChar) ::rtl::OUString::createFromAscii(cChar)
+
+//------------------------------------------------------------------
+
+class XMLMyList
+{
+ std::list<beans::PropertyValue> aProps;
+ sal_uInt32 nCount;
+
+ // #110680#
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxServiceFactory;
+
+public:
+ // #110680#
+ XMLMyList(const uno::Reference<lang::XMultiServiceFactory>& xServiceFactory);
+ ~XMLMyList();
+
+ void push_back(beans::PropertyValue& aProp) { aProps.push_back(aProp); nCount++; }
+ uno::Sequence<beans::PropertyValue> GetSequence();
+ uno::Reference<container::XNameContainer> GetNameContainer();
+ uno::Reference<container::XIndexContainer> GetIndexContainer();
+};
+
+// #110680#
+XMLMyList::XMLMyList(const uno::Reference<lang::XMultiServiceFactory>& xServiceFactory)
+: nCount(0),
+ mxServiceFactory(xServiceFactory)
+{
+ DBG_ASSERT( mxServiceFactory.is(), "got no service manager" );
+}
+
+// #110680#
+XMLMyList::~XMLMyList()
+{
+}
+
+uno::Sequence<beans::PropertyValue> XMLMyList::GetSequence()
+{
+ uno::Sequence<beans::PropertyValue> aSeq;
+ if(nCount)
+ {
+ DBG_ASSERT(nCount == aProps.size(), "wrong count of PropertyValue");
+ aSeq.realloc(nCount);
+ beans::PropertyValue* pProps = aSeq.getArray();
+ std::list<beans::PropertyValue>::iterator aItr = aProps.begin();
+ while (aItr != aProps.end())
+ {
+ *pProps = *aItr;
+ ++pProps;
+ ++aItr;
+ }
+ }
+ return aSeq;
+}
+
+uno::Reference<container::XNameContainer> XMLMyList::GetNameContainer()
+{
+ uno::Reference<container::XNameContainer> xNameContainer;
+
+ // #110680#
+
+ if( mxServiceFactory.is() )
+ {
+ rtl::OUString sName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.NamedPropertyValues"));
+ xNameContainer = uno::Reference<container::XNameContainer>(mxServiceFactory->createInstance(sName), uno::UNO_QUERY);
+ if (xNameContainer.is())
+ {
+ std::list<beans::PropertyValue>::iterator aItr = aProps.begin();
+ while (aItr != aProps.end())
+ {
+ xNameContainer->insertByName(aItr->Name, aItr->Value);
+ ++aItr;
+ }
+ }
+ }
+ return xNameContainer;
+}
+
+uno::Reference<container::XIndexContainer> XMLMyList::GetIndexContainer()
+{
+ uno::Reference<container::XIndexContainer> xIndexContainer;
+ // #110680#
+
+ if( mxServiceFactory.is() )
+ {
+ rtl::OUString sName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.IndexedPropertyValues"));
+ xIndexContainer = uno::Reference<container::XIndexContainer>(mxServiceFactory->createInstance(sName), uno::UNO_QUERY);
+ if (xIndexContainer.is())
+ {
+ std::list<beans::PropertyValue>::iterator aItr = aProps.begin();
+ sal_uInt32 i(0);
+ while (aItr != aProps.end())
+ {
+ xIndexContainer->insertByIndex(i, aItr->Value);
+ ++aItr;
+ ++i;
+ }
+ }
+ }
+ return xIndexContainer;
+}
+
+//=============================================================================
+
+class XMLConfigBaseContext : public SvXMLImportContext
+{
+protected:
+ XMLMyList maProps;
+ beans::PropertyValue maProp;
+ com::sun::star::uno::Any& mrAny;
+ XMLConfigBaseContext* mpBaseContext;
+public:
+ XMLConfigBaseContext(SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLName,
+ com::sun::star::uno::Any& rAny,
+ XMLConfigBaseContext* pBaseContext);
+ virtual ~XMLConfigBaseContext();
+
+ void AddPropertyValue() { maProps.push_back(maProp); }
+};
+
+//=============================================================================
+
+class XMLConfigItemContext : public SvXMLImportContext
+{
+ rtl::OUString msType;
+ rtl::OUString msValue;
+ uno::Sequence<sal_Int8> maDecoded;
+ com::sun::star::uno::Any& mrAny;
+ const rtl::OUString mrItemName;
+ XMLConfigBaseContext* mpBaseContext;
+
+public:
+ XMLConfigItemContext(SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Any& rAny,
+ const rtl::OUString& rItemName,
+ XMLConfigBaseContext* pBaseContext);
+ virtual ~XMLConfigItemContext();
+
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
+ virtual void Characters( const ::rtl::OUString& rChars );
+
+ virtual void EndElement();
+
+ virtual void ManipulateConfigItem();
+};
+
+//=============================================================================
+
+class XMLConfigItemSetContext : public XMLConfigBaseContext
+{
+public:
+ XMLConfigItemSetContext(SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Any& rAny,
+ XMLConfigBaseContext* pBaseContext);
+ virtual ~XMLConfigItemSetContext();
+
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+ virtual void EndElement();
+};
+
+//=============================================================================
+
+class XMLConfigItemMapNamedContext : public XMLConfigBaseContext
+{
+public:
+ XMLConfigItemMapNamedContext(SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Any& rAny,
+ XMLConfigBaseContext* pBaseContext);
+ virtual ~XMLConfigItemMapNamedContext();
+
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+ virtual void EndElement();
+};
+
+//=============================================================================
+
+class XMLConfigItemMapIndexedContext : public XMLConfigBaseContext
+{
+private:
+ rtl::OUString maConfigItemName;
+
+public:
+ XMLConfigItemMapIndexedContext(SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Any& rAny,
+ const rtl::OUString& rConfigItemName,
+ XMLConfigBaseContext* pBaseContext);
+ virtual ~XMLConfigItemMapIndexedContext();
+
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+ virtual void EndElement();
+};
+
+//=============================================================================
+
+SvXMLImportContext *CreateSettingsContext(SvXMLImport& rImport, sal_uInt16 p_nPrefix,
+ const rtl::OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList,
+ beans::PropertyValue& rProp, XMLConfigBaseContext* pBaseContext)
+{
+ SvXMLImportContext *pContext = 0;
+
+ rProp.Name = rtl::OUString();
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
+ rtl::OUString aLocalName;
+ sal_uInt16 nPrefix = rImport.GetNamespaceMap().GetKeyByAttrName(
+ sAttrName, &aLocalName );
+ rtl::OUString sValue = xAttrList->getValueByIndex( i );
+
+ if (nPrefix == XML_NAMESPACE_CONFIG)
+ {
+ if (IsXMLToken(aLocalName, XML_NAME))
+ rProp.Name = sValue;
+ }
+ }
+
+ if (p_nPrefix == XML_NAMESPACE_CONFIG)
+ {
+ if (IsXMLToken(rLocalName, XML_CONFIG_ITEM))
+ pContext = new XMLConfigItemContext(rImport, p_nPrefix, rLocalName, xAttrList, rProp.Value, rProp.Name, pBaseContext);
+ else if((IsXMLToken(rLocalName, XML_CONFIG_ITEM_SET)) ||
+ (IsXMLToken(rLocalName, XML_CONFIG_ITEM_MAP_ENTRY)) )
+ pContext = new XMLConfigItemSetContext(rImport, p_nPrefix, rLocalName, xAttrList, rProp.Value, pBaseContext);
+ else if(IsXMLToken(rLocalName, XML_CONFIG_ITEM_MAP_NAMED))
+ pContext = new XMLConfigItemMapNamedContext(rImport, p_nPrefix, rLocalName, xAttrList, rProp.Value, pBaseContext);
+ else if(IsXMLToken(rLocalName, XML_CONFIG_ITEM_MAP_INDEXED))
+ pContext = new XMLConfigItemMapIndexedContext(rImport, p_nPrefix, rLocalName, xAttrList, rProp.Value, rProp.Name, pBaseContext);
+ }
+
+ if( !pContext )
+ pContext = new SvXMLImportContext( rImport, p_nPrefix, rLocalName );
+
+ return pContext;
+}
+
+//=============================================================================
+namespace
+{
+ struct SettingsGroup
+ {
+ ::rtl::OUString sGroupName;
+ uno::Any aSettings;
+
+ SettingsGroup()
+ :sGroupName()
+ ,aSettings()
+ {
+ }
+
+ SettingsGroup( const ::rtl::OUString& _rGroupName, const uno::Any& _rSettings )
+ :sGroupName( _rGroupName )
+ ,aSettings( _rSettings )
+ {
+ }
+ };
+}
+
+struct XMLDocumentSettingsContext_Data
+{
+ com::sun::star::uno::Any aViewProps;
+ com::sun::star::uno::Any aConfigProps;
+ ::std::list< SettingsGroup > aDocSpecificSettings;
+};
+
+//=============================================================================
+
+XMLDocumentSettingsContext::XMLDocumentSettingsContext(SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLName,
+ const uno::Reference<xml::sax::XAttributeList>& )
+ : SvXMLImportContext( rImport, nPrfx, rLName )
+ , m_pData( new XMLDocumentSettingsContext_Data )
+{
+ // here are no attributes
+}
+
+XMLDocumentSettingsContext::~XMLDocumentSettingsContext()
+{
+}
+
+SvXMLImportContext *XMLDocumentSettingsContext::CreateChildContext( sal_uInt16 p_nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList )
+{
+ SvXMLImportContext *pContext = 0;
+ rtl::OUString sName;
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
+ rtl::OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(
+ sAttrName, &aLocalName );
+ rtl::OUString sValue = xAttrList->getValueByIndex( i );
+
+ if (nPrefix == XML_NAMESPACE_CONFIG)
+ {
+ if (IsXMLToken(aLocalName, XML_NAME))
+ sName = sValue;
+ }
+ }
+
+ if (p_nPrefix == XML_NAMESPACE_CONFIG)
+ {
+ if (IsXMLToken(rLocalName, XML_CONFIG_ITEM_SET))
+ {
+ ::rtl::OUString aLocalConfigName;
+ sal_uInt16 nConfigPrefix =
+ GetImport().GetNamespaceMap().GetKeyByAttrName(
+ sName, &aLocalConfigName );
+
+ if( XML_NAMESPACE_OOO == nConfigPrefix )
+ {
+ if (IsXMLToken(aLocalConfigName, XML_VIEW_SETTINGS))
+ pContext = new XMLConfigItemSetContext(GetImport(),
+ p_nPrefix, rLocalName, xAttrList,
+ m_pData->aViewProps, NULL);
+ else if (IsXMLToken(aLocalConfigName,
+ XML_CONFIGURATION_SETTINGS))
+ pContext = new XMLConfigItemSetContext(GetImport(),
+ p_nPrefix, rLocalName, xAttrList,
+ m_pData->aConfigProps, NULL);
+ else
+ {
+ m_pData->aDocSpecificSettings.push_back( SettingsGroup( aLocalConfigName, uno::Any() ) );
+
+ ::std::list< SettingsGroup >::reverse_iterator settingsPos =
+ m_pData->aDocSpecificSettings.rbegin();
+
+ pContext = new XMLConfigItemSetContext(GetImport(),
+ p_nPrefix, rLocalName, xAttrList,
+ settingsPos->aSettings, NULL);
+ }
+ }
+ }
+ }
+
+ if( !pContext )
+ pContext = new SvXMLImportContext( GetImport(), p_nPrefix, rLocalName );
+
+ return pContext;
+}
+
+void XMLDocumentSettingsContext::EndElement()
+{
+ uno::Sequence<beans::PropertyValue> aSeqViewProps;
+ if (m_pData->aViewProps >>= aSeqViewProps)
+ {
+ GetImport().SetViewSettings(aSeqViewProps);
+ sal_Int32 i(aSeqViewProps.getLength() - 1);
+ sal_Bool bFound(sal_False);
+ while((i >= 0) && !bFound)
+ {
+ if (aSeqViewProps[i].Name.compareToAscii("Views") == 0)
+ {
+ bFound = sal_True;
+ uno::Reference<container::XIndexAccess> xIndexAccess;
+ if (aSeqViewProps[i].Value >>= xIndexAccess)
+ {
+ uno::Reference<document::XViewDataSupplier> xViewDataSupplier(GetImport().GetModel(), uno::UNO_QUERY);
+ if (xViewDataSupplier.is())
+ xViewDataSupplier->setViewData(xIndexAccess);
+ }
+ }
+ else
+ i--;
+ }
+ }
+
+ sal_Bool bLoadDocPrinter( sal_True );
+
+ try
+ {
+ ::comphelper::ConfigurationHelper::readDirectKey(
+ ::comphelper::getProcessServiceFactory(),
+ C2U("org.openoffice.Office.Common/"), C2U("Save/Document"), C2U("LoadPrinter"),
+ ::comphelper::ConfigurationHelper::E_READONLY ) >>= bLoadDocPrinter;
+ }
+ catch( const uno::Exception& )
+ {
+ }
+
+ uno::Sequence<beans::PropertyValue> aSeqConfigProps;
+ if ( m_pData->aConfigProps >>= aSeqConfigProps )
+ {
+ if ( !bLoadDocPrinter )
+ {
+ sal_Int32 i = aSeqConfigProps.getLength() - 1;
+ int nFound = 0;
+
+ while ( ( i >= 0 ) && nFound < 2 )
+ {
+ rtl::OUString sProp( aSeqConfigProps[i].Name );
+
+ if ( sProp.compareToAscii("PrinterName") == 0 )
+ {
+ rtl::OUString sEmpty;
+ aSeqConfigProps[i].Value = uno::makeAny( sEmpty );
+ nFound++;
+ }
+ else if ( sProp.compareToAscii("PrinterSetup") == 0 )
+ {
+ uno::Sequence< sal_Int8 > aEmpty;
+ aSeqConfigProps[i].Value = uno::makeAny( aEmpty );
+ nFound++;
+ }
+
+ i--;
+ }
+ }
+
+ GetImport().SetConfigurationSettings( aSeqConfigProps );
+ }
+
+ for ( ::std::list< SettingsGroup >::const_iterator settings = m_pData->aDocSpecificSettings.begin();
+ settings != m_pData->aDocSpecificSettings.end();
+ ++settings
+ )
+ {
+ uno::Sequence< beans::PropertyValue > aDocSettings;
+ OSL_VERIFY( settings->aSettings >>= aDocSettings );
+ GetImport().SetDocumentSpecificSettings( settings->sGroupName, aDocSettings );
+ }
+}
+
+//=============================================================================
+
+XMLConfigBaseContext::XMLConfigBaseContext(SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLName, com::sun::star::uno::Any& rTempAny,
+ XMLConfigBaseContext* pTempBaseContext)
+ : SvXMLImportContext( rImport, nPrfx, rLName ),
+ // #110680#
+ maProps(rImport.getServiceFactory()),
+ maProp(),
+ mrAny(rTempAny),
+ mpBaseContext(pTempBaseContext)
+{
+}
+
+XMLConfigBaseContext::~XMLConfigBaseContext()
+{
+}
+
+//=============================================================================
+
+XMLConfigItemSetContext::XMLConfigItemSetContext(SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>&,
+ com::sun::star::uno::Any& rAny,
+ XMLConfigBaseContext* pBaseContext)
+ : XMLConfigBaseContext( rImport, nPrfx, rLName, rAny, pBaseContext )
+{
+ // here are no attributes
+}
+
+XMLConfigItemSetContext::~XMLConfigItemSetContext()
+{
+}
+
+SvXMLImportContext *XMLConfigItemSetContext::CreateChildContext( sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList )
+{
+ return CreateSettingsContext(GetImport(), nPrefix, rLocalName, xAttrList, maProp, this);
+}
+
+void XMLConfigItemSetContext::EndElement()
+{
+ mrAny <<= maProps.GetSequence();
+ if (mpBaseContext)
+ mpBaseContext->AddPropertyValue();
+}
+
+//=============================================================================
+
+XMLConfigItemContext::XMLConfigItemContext(SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Any& rTempAny,
+ const rtl::OUString& rTempItemName,
+ XMLConfigBaseContext* pTempBaseContext)
+ : SvXMLImportContext(rImport, nPrfx, rLName),
+ mrAny(rTempAny),
+ mrItemName(rTempItemName),
+ mpBaseContext(pTempBaseContext)
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
+ rtl::OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(
+ sAttrName, &aLocalName );
+ rtl::OUString sValue = xAttrList->getValueByIndex( i );
+
+ if (nPrefix == XML_NAMESPACE_CONFIG)
+ {
+ if (IsXMLToken(aLocalName, XML_TYPE))
+ msType = sValue;
+ }
+ }
+}
+
+XMLConfigItemContext::~XMLConfigItemContext()
+{
+}
+
+SvXMLImportContext *XMLConfigItemContext::CreateChildContext( sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& )
+{
+ SvXMLImportContext* pContext = new SvXMLImportContext(GetImport(), nPrefix, rLocalName);
+ return pContext;
+}
+
+void XMLConfigItemContext::Characters( const ::rtl::OUString& rChars )
+{
+ if (IsXMLToken(msType, XML_BASE64BINARY))
+ {
+ rtl::OUString sTrimmedChars( rChars.trim() );
+ if( sTrimmedChars.getLength() )
+ {
+ rtl::OUString sChars;
+ if( msValue.getLength() )
+ {
+ sChars = msValue;
+ sChars += sTrimmedChars;
+ msValue = rtl::OUString();
+ }
+ else
+ {
+ sChars = sTrimmedChars;
+ }
+ uno::Sequence<sal_Int8> aBuffer((sChars.getLength() / 4) * 3 );
+ sal_Int32 nCharsDecoded =
+ GetImport().GetMM100UnitConverter().
+ decodeBase64SomeChars( aBuffer, sChars );
+ sal_uInt32 nStartPos(maDecoded.getLength());
+ sal_uInt32 nCount(aBuffer.getLength());
+ maDecoded.realloc(nStartPos + nCount);
+ sal_Int8* pDecoded = maDecoded.getArray();
+ sal_Int8* pBuffer = aBuffer.getArray();
+ for (sal_uInt32 i = 0; i < nCount; i++, pBuffer++)
+ pDecoded[nStartPos + i] = *pBuffer;
+ if( nCharsDecoded != sChars.getLength() )
+ msValue = sChars.copy( nCharsDecoded );
+ }
+ }
+ else
+ msValue += rChars;
+}
+
+
+void XMLConfigItemContext::EndElement()
+{
+ if (mpBaseContext)
+ {
+ if (IsXMLToken(msType, XML_BOOLEAN))
+ {
+ sal_Bool bValue(sal_False);
+ if (IsXMLToken(msValue, XML_TRUE))
+ bValue = sal_True;
+ mrAny <<= bValue;
+ }
+ else if (IsXMLToken(msType, XML_BYTE))
+ {
+ sal_Int32 nValue(0);
+ SvXMLUnitConverter::convertNumber(nValue, msValue);
+ mrAny <<= static_cast<sal_Int8>(nValue);
+ }
+ else if (IsXMLToken(msType, XML_SHORT))
+ {
+ sal_Int32 nValue(0);
+ SvXMLUnitConverter::convertNumber(nValue, msValue);
+ mrAny <<= static_cast<sal_Int16>(nValue);
+ }
+ else if (IsXMLToken(msType, XML_INT))
+ {
+ sal_Int32 nValue(0);
+ SvXMLUnitConverter::convertNumber(nValue, msValue);
+ mrAny <<= nValue;
+ }
+ else if (IsXMLToken(msType, XML_LONG))
+ {
+ sal_Int64 nValue(msValue.toInt64());
+ mrAny <<= nValue;
+ }
+ else if (IsXMLToken(msType, XML_DOUBLE))
+ {
+ double fValue(0.0);
+ SvXMLUnitConverter::convertDouble(fValue, msValue);
+ mrAny <<= fValue;
+ }
+ else if (IsXMLToken(msType, XML_STRING))
+ {
+ mrAny <<= msValue;
+ }
+ else if (IsXMLToken(msType, XML_DATETIME))
+ {
+ util::DateTime aDateTime;
+ SvXMLUnitConverter::convertDateTime(aDateTime, msValue);
+ mrAny <<= aDateTime;
+ }
+ else if (IsXMLToken(msType, XML_BASE64BINARY))
+ {
+ mrAny <<= maDecoded;
+ }
+ else {
+ OSL_FAIL("wrong type");
+ }
+
+ ManipulateConfigItem();
+
+ mpBaseContext->AddPropertyValue();
+ }
+ else {
+ OSL_FAIL("no BaseContext");
+ }
+}
+
+/** There are some instances where there is a mismatch between API and
+ * XML mapping of a setting. In this case, this method allows us to
+ * manipulate the values accordingly. */
+void XMLConfigItemContext::ManipulateConfigItem()
+{
+ if( mrItemName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "PrinterIndependentLayout" ) ) )
+ {
+ rtl::OUString sValue;
+ mrAny >>= sValue;
+
+ sal_Int16 nTmp = document::PrinterIndependentLayout::HIGH_RESOLUTION;
+
+ if( sValue.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("enabled")) ||
+ sValue.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("low-resolution")) )
+ {
+ nTmp = document::PrinterIndependentLayout::LOW_RESOLUTION;
+ }
+ else if( sValue.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("disabled")) )
+ {
+ nTmp = document::PrinterIndependentLayout::DISABLED;
+ }
+ // else: default to high_resolution
+
+ mrAny <<= nTmp;
+ }
+ else if( (mrItemName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ColorTableURL" ) ) ) ||
+ (mrItemName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "LineEndTableURL" ) ) ) ||
+ (mrItemName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "HatchTableURL" ) ) ) ||
+ (mrItemName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DashTableURL" ) ) ) ||
+ (mrItemName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "GradientTableURL") ) ) ||
+ (mrItemName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "BitmapTableURL" ) ) ) )
+ {
+ if( GetImport().getServiceFactory().is() ) try
+ {
+ uno::Reference< util::XStringSubstitution > xStringSubsitution(
+ GetImport().getServiceFactory()->
+ createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.PathSubstitution" ) ) ), uno::UNO_QUERY );
+
+ if( xStringSubsitution.is() )
+ {
+ rtl::OUString aURL;
+ mrAny >>= aURL;
+ aURL = xStringSubsitution->substituteVariables( aURL, sal_False );
+ mrAny <<= aURL;
+ }
+ }
+ catch( uno::Exception& )
+ {
+ }
+ }
+}
+
+
+//=============================================================================
+
+XMLConfigItemMapNamedContext::XMLConfigItemMapNamedContext(SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>&,
+ com::sun::star::uno::Any& rAny,
+ XMLConfigBaseContext* pBaseContext)
+ : XMLConfigBaseContext(rImport, nPrfx, rLName, rAny, pBaseContext)
+{
+}
+
+XMLConfigItemMapNamedContext::~XMLConfigItemMapNamedContext()
+{
+}
+
+SvXMLImportContext *XMLConfigItemMapNamedContext::CreateChildContext( sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList )
+{
+ return CreateSettingsContext(GetImport(), nPrefix, rLocalName, xAttrList, maProp, this);
+}
+
+void XMLConfigItemMapNamedContext::EndElement()
+{
+ if (mpBaseContext)
+ {
+ mrAny <<= maProps.GetNameContainer();
+ mpBaseContext->AddPropertyValue();
+ }
+ else {
+ OSL_FAIL("no BaseContext");
+ }
+}
+
+//=============================================================================
+
+XMLConfigItemMapIndexedContext::XMLConfigItemMapIndexedContext(SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>&,
+ com::sun::star::uno::Any& rAny,
+ const ::rtl::OUString& rConfigItemName,
+ XMLConfigBaseContext* pBaseContext)
+ : XMLConfigBaseContext(rImport, nPrfx, rLName, rAny, pBaseContext),
+ maConfigItemName( rConfigItemName )
+{
+}
+
+XMLConfigItemMapIndexedContext::~XMLConfigItemMapIndexedContext()
+{
+}
+
+SvXMLImportContext *XMLConfigItemMapIndexedContext::CreateChildContext( sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList )
+{
+ return CreateSettingsContext(GetImport(), nPrefix, rLocalName, xAttrList, maProp, this);
+}
+
+void XMLConfigItemMapIndexedContext::EndElement()
+{
+ if (mpBaseContext)
+ {
+ if( maConfigItemName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ForbiddenCharacters" ) ) )
+ {
+ uno::Reference< i18n::XForbiddenCharacters > xForbChars;
+
+ // get the forbidden characters from the document
+ uno::Reference< lang::XMultiServiceFactory > xFac( GetImport().GetModel(), uno::UNO_QUERY );
+ if( xFac.is() )
+ {
+ uno::Reference< beans::XPropertySet > xProps( xFac->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.Settings" ) ) ), uno::UNO_QUERY );
+ if( xProps.is() && xProps->getPropertySetInfo()->hasPropertyByName( maConfigItemName ) )
+ {
+ xProps->getPropertyValue( maConfigItemName ) >>= xForbChars;
+ }
+ }
+
+ if( xForbChars.is() )
+ {
+
+ uno::Reference< container::XIndexAccess > xIndex( maProps.GetIndexContainer(), uno::UNO_QUERY );
+
+ const sal_Int32 nCount = xIndex->getCount();
+ uno::Sequence < beans::PropertyValue > aProps;
+ for (sal_Int32 i = 0; i < nCount; i++)
+ {
+ if ((xIndex->getByIndex( i ) >>= aProps) && (aProps.getLength() == XML_FORBIDDEN_CHARACTER_MAX ) )
+ {
+ beans::PropertyValue *pForChar = aProps.getArray();
+ i18n::ForbiddenCharacters aForbid;
+ lang::Locale aLocale;
+ const rtl::OUString sLanguage ( RTL_CONSTASCII_USTRINGPARAM ( "Language" ) );
+ const rtl::OUString sCountry ( RTL_CONSTASCII_USTRINGPARAM ( "Country" ) );
+ const rtl::OUString sVariant ( RTL_CONSTASCII_USTRINGPARAM ( "Variant" ) );
+ const rtl::OUString sBeginLine ( RTL_CONSTASCII_USTRINGPARAM ( "BeginLine" ) );
+ const rtl::OUString sEndLine ( RTL_CONSTASCII_USTRINGPARAM ( "EndLine" ) );
+ sal_Bool bHaveLanguage = sal_False, bHaveCountry = sal_False, bHaveVariant = sal_False,
+ bHaveBegin = sal_False, bHaveEnd = sal_False;
+
+ for ( sal_Int32 j = 0 ; j < XML_FORBIDDEN_CHARACTER_MAX ; j++ )
+ {
+ if (pForChar->Name.equals (sLanguage ) )
+ {
+ pForChar->Value >>= aLocale.Language;
+ bHaveLanguage = sal_True;
+ }
+ else if (pForChar->Name.equals (sCountry ) )
+ {
+ pForChar->Value >>= aLocale.Country;
+ bHaveCountry = sal_True;
+ }
+ else if (pForChar->Name.equals (sVariant ) )
+ {
+ pForChar->Value >>= aLocale.Variant;
+ bHaveVariant = sal_True;
+ }
+ else if (pForChar->Name.equals (sBeginLine ) )
+ {
+ pForChar->Value >>= aForbid.beginLine;
+ bHaveBegin = sal_True;
+ }
+ else if (pForChar->Name.equals (sEndLine ) )
+ {
+ pForChar->Value >>= aForbid.endLine;
+ bHaveEnd = sal_True;
+ }
+ pForChar++;
+ }
+
+ if ( bHaveLanguage && bHaveCountry && bHaveVariant && bHaveBegin && bHaveEnd )
+ {
+ try
+ {
+ xForbChars->setForbiddenCharacters( aLocale, aForbid );
+ }
+ catch( uno::Exception& )
+ {
+ OSL_FAIL( "Exception while importing forbidden characters" );
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ OSL_FAIL( "could not get the XForbiddenCharacters from document!" );
+ mrAny <<= maProps.GetIndexContainer();
+ }
+ }
+ else if( maConfigItemName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Symbols" ) ) )
+ {
+ uno::Reference< container::XIndexAccess > xIndex( maProps.GetIndexContainer(), uno::UNO_QUERY );
+
+ const sal_Int32 nCount = xIndex->getCount();
+ uno::Sequence < beans::PropertyValue > aProps;
+ uno::Sequence < formula::SymbolDescriptor > aSymbolList ( nCount );
+
+ formula::SymbolDescriptor *pDescriptor = aSymbolList.getArray();
+
+ const rtl::OUString sName ( RTL_CONSTASCII_USTRINGPARAM ( "Name" ) );
+ const rtl::OUString sExportName ( RTL_CONSTASCII_USTRINGPARAM ( "ExportName" ) );
+ const rtl::OUString sFontName ( RTL_CONSTASCII_USTRINGPARAM ( "FontName" ) );
+ const rtl::OUString sSymbolSet ( RTL_CONSTASCII_USTRINGPARAM ( "SymbolSet" ) );
+ const rtl::OUString sCharacter ( RTL_CONSTASCII_USTRINGPARAM ( "Character" ) );
+ const rtl::OUString sCharSet ( RTL_CONSTASCII_USTRINGPARAM ( "CharSet" ) );
+ const rtl::OUString sFamily ( RTL_CONSTASCII_USTRINGPARAM ( "Family" ) );
+ const rtl::OUString sPitch ( RTL_CONSTASCII_USTRINGPARAM ( "Pitch" ) );
+ const rtl::OUString sWeight ( RTL_CONSTASCII_USTRINGPARAM ( "Weight" ) );
+ const rtl::OUString sItalic ( RTL_CONSTASCII_USTRINGPARAM ( "Italic" ) );
+ sal_Int16 nNumFullEntries = 0;
+
+ for ( sal_Int32 i = 0; i < nCount; i++ )
+ {
+ if ((xIndex->getByIndex( i ) >>= aProps) && (aProps.getLength() == XML_SYMBOL_DESCRIPTOR_MAX ) )
+ {
+ sal_Bool bHaveName = sal_False, bHaveExportName = sal_False, bHaveCharSet = sal_False,
+ bHaveFontName = sal_False, bHaveFamily = sal_False, bHavePitch = sal_False,
+ bHaveWeight = sal_False, bHaveItalic = sal_False, bHaveSymbolSet = sal_False,
+ bHaveCharacter = sal_False;
+ beans::PropertyValue *pSymbol = aProps.getArray();
+
+ for ( sal_Int32 j = 0 ; j < XML_SYMBOL_DESCRIPTOR_MAX ; j++ )
+ {
+ if (pSymbol->Name.equals ( sName ) )
+ {
+ pSymbol->Value >>= pDescriptor[nNumFullEntries].sName;
+ bHaveName = sal_True;
+ }
+ else if (pSymbol->Name.equals (sExportName ) )
+ {
+ pSymbol->Value >>= pDescriptor[nNumFullEntries].sExportName;
+ bHaveExportName = sal_True;
+ }
+ else if (pSymbol->Name.equals (sFontName ) )
+ {
+ pSymbol->Value >>= pDescriptor[nNumFullEntries].sFontName;
+ bHaveFontName = sal_True;
+ }
+ else if (pSymbol->Name.equals (sCharSet ) )
+ {
+ pSymbol->Value >>= pDescriptor[nNumFullEntries].nCharSet;
+ bHaveCharSet = sal_True;
+ }
+ else if (pSymbol->Name.equals (sFamily ) )
+ {
+ pSymbol->Value >>= pDescriptor[nNumFullEntries].nFamily;
+ bHaveFamily = sal_True;
+ }
+ else if (pSymbol->Name.equals (sPitch ) )
+ {
+ pSymbol->Value >>= pDescriptor[nNumFullEntries].nPitch;
+ bHavePitch = sal_True;
+ }
+ else if (pSymbol->Name.equals (sWeight ) )
+ {
+ pSymbol->Value >>= pDescriptor[nNumFullEntries].nWeight;
+ bHaveWeight = sal_True;
+ }
+ else if (pSymbol->Name.equals (sItalic ) )
+ {
+ pSymbol->Value >>= pDescriptor[nNumFullEntries].nItalic;
+ bHaveItalic = sal_True;
+ }
+ else if (pSymbol->Name.equals (sSymbolSet ) )
+ {
+ pSymbol->Value >>= pDescriptor[nNumFullEntries].sSymbolSet;
+ bHaveSymbolSet = sal_True;
+ }
+ else if (pSymbol->Name.equals (sCharacter ) )
+ {
+ pSymbol->Value >>= pDescriptor[nNumFullEntries].nCharacter;
+ bHaveCharacter = sal_True;
+ }
+ pSymbol++;
+ }
+ if ( bHaveName && bHaveExportName && bHaveCharSet && bHaveFontName && bHaveCharacter
+ && bHaveFamily && bHavePitch && bHaveWeight && bHaveItalic && bHaveSymbolSet)
+ nNumFullEntries++;
+ }
+ }
+ aSymbolList.realloc (nNumFullEntries);
+ mrAny <<= aSymbolList;
+ }
+ else
+ {
+ mrAny <<= maProps.GetIndexContainer();
+ }
+ mpBaseContext->AddPropertyValue();
+ }
+ else {
+ OSL_FAIL("no BaseContext");
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/core/DomBuilderContext.cxx b/xmloff/source/core/DomBuilderContext.cxx
new file mode 100644
index 000000000000..c669af1733bd
--- /dev/null
+++ b/xmloff/source/core/DomBuilderContext.cxx
@@ -0,0 +1,267 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "DomBuilderContext.hxx"
+
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmlimp.hxx>
+#include "xmloff/xmlerror.hxx"
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/xml/dom/XAttr.hpp>
+#include <com/sun/star/xml/dom/XDocumentBuilder.hpp>
+#include <com/sun/star/xml/dom/XNode.hpp>
+#include <com/sun/star/xml/dom/XElement.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/xml/dom/NodeType.hpp>
+
+#include <rtl/ustring.hxx>
+#include <tools/debug.hxx>
+
+#include <unotools/processfactory.hxx>
+
+
+using com::sun::star::lang::XMultiServiceFactory;
+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::xml::dom::XAttr;
+using com::sun::star::xml::dom::XDocument;
+using com::sun::star::xml::dom::XDocumentBuilder;
+using com::sun::star::xml::dom::XNode;
+using com::sun::star::xml::dom::XElement;
+using com::sun::star::xml::sax::XAttributeList;
+using com::sun::star::xml::dom::NodeType_ELEMENT_NODE;
+using rtl::OUString;
+
+
+// helper functions; implemented below
+Reference<XNode> lcl_createDomInstance();
+Reference<XNode> lcl_createElement( SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString rLocalName,
+ Reference<XNode> xParent);
+
+
+DomBuilderContext::DomBuilderContext( SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName ) :
+ SvXMLImportContext( rImport, nPrefix, rLocalName ),
+ mxNode( lcl_createElement( rImport, nPrefix, rLocalName,
+ lcl_createDomInstance() ) )
+{
+ DBG_ASSERT( mxNode.is(), "empty XNode not allowed" );
+ DBG_ASSERT( Reference<XElement>( mxNode, UNO_QUERY ).is(), "need element" );
+ DBG_ASSERT( mxNode->getNodeType() == NodeType_ELEMENT_NODE, "need element" );
+}
+
+DomBuilderContext::DomBuilderContext( SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ Reference<XNode>& xParent ) :
+ SvXMLImportContext( rImport, nPrefix, rLocalName ),
+ mxNode( lcl_createElement( rImport, nPrefix, rLocalName, xParent ) )
+{
+ DBG_ASSERT( mxNode.is(), "empty XNode not allowed" );
+ DBG_ASSERT( Reference<XElement>( mxNode, UNO_QUERY ).is(), "need element" );
+ DBG_ASSERT( mxNode->getNodeType() == NodeType_ELEMENT_NODE, "need element" );
+}
+
+DomBuilderContext::~DomBuilderContext()
+{
+}
+
+Reference<XDocument> DomBuilderContext::getTree()
+{
+ DBG_ASSERT( mxNode.is(), "empty XNode not allowed" );
+ return mxNode->getOwnerDocument();
+}
+
+Reference<XNode> DomBuilderContext::getNode()
+{
+ return mxNode;
+}
+
+
+SvXMLImportContext* DomBuilderContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList>& )
+{
+ // create DomBuilder for subtree
+ return new DomBuilderContext( GetImport(), nPrefix, rLocalName, mxNode );
+}
+
+
+void DomBuilderContext::StartElement(
+ const Reference<XAttributeList>& xAttrList )
+{
+ DBG_ASSERT( mxNode.is(), "empty XNode not allowed" );
+ DBG_ASSERT( mxNode->getOwnerDocument().is(), "XNode must have XDocument" );
+
+ // add attribute nodes to new node
+ sal_Int16 nAttributeCount = xAttrList->getLength();
+ for( sal_Int16 i = 0; i < nAttributeCount; i++ )
+ {
+ // get name & value for attribute
+ const OUString& rName = xAttrList->getNameByIndex( i );
+ const OUString& rValue = xAttrList->getValueByIndex( i );
+
+ // namespace handling: determine namespace & namespace keykey
+ OUString sNamespace;
+ sal_uInt16 nNamespaceKey =
+ GetImport().GetNamespaceMap()._GetKeyByAttrName(
+ rName, NULL, NULL, &sNamespace );
+
+ // create attribute node and set value
+ Reference<XElement> xElement( mxNode, UNO_QUERY_THROW );
+ switch( nNamespaceKey )
+ {
+ case XML_NAMESPACE_NONE:
+ // no namespace: create a non-namespaced attribute
+ xElement->setAttribute( rName, rValue );
+ break;
+ case XML_NAMESPACE_XMLNS:
+ // namespace declaration: ignore, since the DOM tree handles these
+ // declarations implicitly
+ break;
+ case XML_NAMESPACE_UNKNOWN:
+ // unknown namespace: illegal input. Raise Warning.
+ {
+ Sequence<OUString> aSeq(2);
+ aSeq[0] = rName;
+ aSeq[1] = rValue;
+ GetImport().SetError(
+ XMLERROR_FLAG_WARNING | XMLERROR_NAMESPACE_TROUBLE, aSeq );
+ }
+ break;
+ default:
+ // a real and proper namespace: create namespaced attribute
+ xElement->setAttributeNS( sNamespace, rName, rValue );
+ break;
+ }
+ }
+}
+
+void DomBuilderContext::EndElement()
+{
+ // nothing to be done!
+}
+
+void DomBuilderContext::Characters( const OUString& rCharacters )
+{
+ DBG_ASSERT( mxNode.is(), "empty XNode not allowed" );
+
+ // TODO: I assume adjacent text nodes should be joined, to preserve
+ // processinf model? (I.e., if the SAX parser breaks a string into 2
+ // Characters(..) calls, the DOM model would still see only one child.)
+
+ // create text node and append to parent
+ Reference<XNode> xNew(
+ mxNode->getOwnerDocument()->createTextNode( rCharacters ),
+ UNO_QUERY_THROW );
+ mxNode->appendChild( xNew );
+}
+
+
+//
+// helper function implementations
+//
+
+const sal_Char sDocumentBuilder[] = "com.sun.star.xml.dom.DocumentBuilder";
+
+Reference<XNode> lcl_createDomInstance()
+{
+ Reference<XMultiServiceFactory> xFactory = utl::getProcessServiceFactory();
+ DBG_ASSERT( xFactory.is(), "can't get service factory" );
+
+ Reference<XDocumentBuilder> xBuilder(
+ xFactory->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( sDocumentBuilder ) ) ),
+ UNO_QUERY_THROW );
+
+ return Reference<XNode>( xBuilder->newDocument(), UNO_QUERY_THROW );
+}
+
+Reference<XNode> lcl_createElement( SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString rLocalName,
+ Reference<XNode> xParent)
+{
+ DBG_ASSERT( xParent.is(), "need parent node" );
+
+ Reference<XDocument> xDocument = xParent->getOwnerDocument();
+ DBG_ASSERT( xDocument.is(), "no XDocument found!" );
+
+ // TODO: come up with proper way of handling namespaces; re-creating the
+ // namespace from the key is NOT a good idea, and will not work for
+ // multiple prefixes for the same namespace. Fortunately, those are rare.
+
+ Reference<XElement> xElement;
+ switch( nPrefix )
+ {
+ case XML_NAMESPACE_NONE:
+ // no namespace: use local name
+ xElement = xDocument->createElement( rLocalName );
+ break;
+ case XML_NAMESPACE_XMLNS:
+ case XML_NAMESPACE_UNKNOWN:
+ // both cases are illegal; raise warning (and use only local name)
+ xElement = xDocument->createElement( rLocalName );
+ {
+ Sequence<OUString> aSeq(1);
+ aSeq[0] = rLocalName;
+ rImport.SetError(
+ XMLERROR_FLAG_WARNING | XMLERROR_NAMESPACE_TROUBLE, aSeq );
+ }
+ break;
+ default:
+ // We are only given the prefix and the local name; thus we have to ask
+ // the namespace map to create a qualified name for us. Technically,
+ // this is a bug, since this will fail for multiple prefixes used for
+ // the same namespace.
+ xElement = xDocument->createElementNS(
+ rImport.GetNamespaceMap().GetNameByKey( nPrefix ),
+ rImport.GetNamespaceMap().GetQNameByKey( nPrefix, rLocalName ) );
+ break;
+ }
+ DBG_ASSERT( xElement.is(), "can't create element" );
+
+ // add new element to parent and return
+ Reference<XNode> xNode( xElement, UNO_QUERY_THROW );
+ xParent->appendChild( xNode );
+ return xNode;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/core/DomExport.cxx b/xmloff/source/core/DomExport.cxx
new file mode 100644
index 000000000000..7e3e217b8f1a
--- /dev/null
+++ b/xmloff/source/core/DomExport.cxx
@@ -0,0 +1,308 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "DomExport.hxx"
+
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmlexp.hxx>
+#include "xmloff/xmlerror.hxx"
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/xml/dom/XAttr.hpp>
+#include <com/sun/star/xml/dom/XDocumentBuilder.hpp>
+#include <com/sun/star/xml/dom/XNode.hpp>
+#include <com/sun/star/xml/dom/XElement.hpp>
+#include <com/sun/star/xml/dom/XEntity.hpp>
+#include <com/sun/star/xml/dom/XNotation.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/xml/dom/NodeType.hpp>
+#include <com/sun/star/xml/dom/XNamedNodeMap.hpp>
+
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <tools/debug.hxx>
+
+#include <unotools/processfactory.hxx>
+
+#include <vector>
+
+
+using com::sun::star::lang::XMultiServiceFactory;
+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 std::vector;
+
+using namespace com::sun::star::xml::dom;
+
+using rtl::OUString;
+using rtl::OUStringBuffer;
+
+
+class DomVisitor
+{
+public:
+ DomVisitor() {}
+ virtual ~DomVisitor() {}
+ virtual void element( const Reference<XElement>& ) {}
+ virtual void character( const Reference<XCharacterData>& ) {}
+ virtual void attribute( const Reference<XAttr>& ) {}
+ virtual void cdata( const Reference<XCDATASection>& ) {}
+ virtual void comment( const Reference<XComment>& ) {}
+ virtual void documentFragment( const Reference<XDocumentFragment>& ) {}
+ virtual void document( const Reference<XDocument>& ) {}
+ virtual void documentType( const Reference<XDocumentType>& ) {}
+ virtual void entity( const Reference<XEntity>& ) {}
+ virtual void entityReference( const Reference<XEntityReference>& ) {}
+ virtual void notation( const Reference<XNotation>& ) {}
+ virtual void processingInstruction( const Reference<XProcessingInstruction>& ) {}
+ virtual void endElement( const Reference<XElement>& ) {}
+};
+
+void visit( DomVisitor&, const Reference<XDocument>& );
+void visit( DomVisitor&, const Reference<XNode>& );
+
+
+
+void visitNode( DomVisitor& rVisitor, const Reference<XNode>& xNode )
+{
+ switch( xNode->getNodeType() )
+ {
+ case NodeType_ATTRIBUTE_NODE:
+ rVisitor.attribute( Reference<XAttr>( xNode, UNO_QUERY_THROW ) );
+ break;
+ case NodeType_CDATA_SECTION_NODE:
+ rVisitor.cdata( Reference<XCDATASection>( xNode, UNO_QUERY_THROW ) );
+ break;
+ case NodeType_COMMENT_NODE:
+ rVisitor.comment( Reference<XComment>( xNode, UNO_QUERY_THROW ) );
+ break;
+ case NodeType_DOCUMENT_FRAGMENT_NODE:
+ rVisitor.documentFragment( Reference<XDocumentFragment>( xNode, UNO_QUERY_THROW ) );
+ break;
+ case NodeType_DOCUMENT_NODE:
+ rVisitor.document( Reference<XDocument>( xNode, UNO_QUERY_THROW ) );
+ break;
+ case NodeType_DOCUMENT_TYPE_NODE:
+ rVisitor.documentType( Reference<XDocumentType>( xNode, UNO_QUERY_THROW ) );
+ break;
+ case NodeType_ELEMENT_NODE:
+ rVisitor.element( Reference<XElement>( xNode, UNO_QUERY_THROW ) );
+ break;
+ case NodeType_ENTITY_NODE:
+ rVisitor.entity( Reference<XEntity>( xNode, UNO_QUERY_THROW ) );
+ break;
+ case NodeType_ENTITY_REFERENCE_NODE:
+ rVisitor.entityReference( Reference<XEntityReference>( xNode, UNO_QUERY_THROW ) );
+ break;
+ case NodeType_NOTATION_NODE:
+ rVisitor.notation( Reference<XNotation>( xNode, UNO_QUERY_THROW ) );
+ break;
+ case NodeType_PROCESSING_INSTRUCTION_NODE:
+ rVisitor.processingInstruction( Reference<XProcessingInstruction>( xNode, UNO_QUERY_THROW ) );
+ break;
+ case NodeType_TEXT_NODE:
+ rVisitor.character( Reference<XCharacterData>( xNode, UNO_QUERY_THROW ) );
+ break;
+ default:
+ OSL_FAIL( "unknown DOM node type" );
+ break;
+ }
+}
+
+void visit( DomVisitor& rVisitor, const Reference<XDocument>& xDocument )
+{
+ visit( rVisitor, Reference<XNode>( xDocument, UNO_QUERY_THROW ) );
+}
+
+void visit( DomVisitor& rVisitor, const Reference<XNode>& xNode )
+{
+ visitNode( rVisitor, xNode );
+ for( Reference<XNode> xChild = xNode->getFirstChild();
+ xChild.is();
+ xChild = xChild->getNextSibling() )
+ {
+ visit( rVisitor, xChild );
+ }
+ if( xNode->getNodeType() == NodeType_ELEMENT_NODE )
+ rVisitor.endElement( Reference<XElement>( xNode, UNO_QUERY_THROW ) );
+}
+
+
+
+class DomExport: public DomVisitor
+{
+ SvXMLExport& mrExport;
+ vector<SvXMLNamespaceMap> maNamespaces;
+
+ void pushNamespace();
+ void popNamespace();
+ void addNamespace( const OUString& sPrefix, const OUString& sURI );
+ OUString qualifiedName( const OUString& sPrefix, const OUString& sURI,
+ const OUString& sLocalName );
+ OUString qualifiedName( const Reference<XNode>& );
+ OUString qualifiedName( const Reference<XElement>& );
+ OUString qualifiedName( const Reference<XAttr>& );
+ void addAttribute( const Reference<XAttr>& );
+
+public:
+
+ DomExport( SvXMLExport& rExport );
+ virtual ~DomExport();
+
+ virtual void element( const Reference<XElement>& );
+ virtual void endElement( const Reference<XElement>& );
+ virtual void character( const Reference<XCharacterData>& );
+};
+
+DomExport::DomExport( SvXMLExport& rExport ) :
+ mrExport( rExport )
+{
+ maNamespaces.push_back( rExport.GetNamespaceMap() );
+}
+
+DomExport::~DomExport()
+{
+ DBG_ASSERT( maNamespaces.size() == 1, "namespace missing" );
+ maNamespaces.clear();
+}
+
+void DomExport::pushNamespace()
+{
+ maNamespaces.push_back( maNamespaces.back() );
+}
+
+void DomExport::popNamespace()
+{
+ maNamespaces.pop_back();
+}
+
+void DomExport::addNamespace( const OUString& sPrefix, const OUString& sURI )
+{
+ SvXMLNamespaceMap& rMap = maNamespaces.back();
+ sal_uInt16 nKey = rMap.GetKeyByPrefix( sPrefix );
+
+ // we need to register the namespace, if either the prefix isn't known or
+ // is used for a different namespace
+ if( nKey == XML_NAMESPACE_UNKNOWN ||
+ rMap.GetNameByKey( nKey ) != sURI )
+ {
+ // add prefix to map, and add declaration
+ rMap.Add( sPrefix, sURI );
+ mrExport.AddAttribute(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "xmlns:" ) ) + sPrefix,
+ sURI );
+ }
+}
+
+OUString DomExport::qualifiedName( const OUString& sPrefix,
+ const OUString& sURI,
+ const OUString& sLocalName )
+{
+ OUStringBuffer sBuffer;
+ if( ( sPrefix.getLength() > 0 ) && ( sURI.getLength() > 0 ) )
+ {
+ addNamespace( sPrefix, sURI );
+ sBuffer.append( sPrefix );
+ sBuffer.append( sal_Unicode( ':' ) );
+ }
+ sBuffer.append( sLocalName );
+ return sBuffer.makeStringAndClear();
+}
+
+OUString DomExport::qualifiedName( const Reference<XNode>& xNode )
+{
+ return qualifiedName( xNode->getPrefix(), xNode->getNamespaceURI(),
+ xNode->getNodeName() );
+}
+
+OUString DomExport::qualifiedName( const Reference<XElement>& xElement )
+{
+ return qualifiedName( xElement->getPrefix(), xElement->getNamespaceURI(),
+ xElement->getNodeName() );
+}
+
+OUString DomExport::qualifiedName( const Reference<XAttr>& xAttr )
+{
+ return qualifiedName( xAttr->getPrefix(), xAttr->getNamespaceURI(),
+ xAttr->getNodeName() );
+}
+
+void DomExport::addAttribute( const Reference<XAttr>& xAttribute )
+{
+ mrExport.AddAttribute( qualifiedName( xAttribute ),
+ xAttribute->getNodeValue() );
+}
+
+void DomExport::element( const Reference<XElement>& xElement )
+{
+ pushNamespace();
+
+ // write attributes
+ Reference<XNamedNodeMap> xAttributes = xElement->getAttributes();
+ sal_Int32 nLength = xAttributes.is() ? xAttributes->getLength() : 0;
+ for( sal_Int32 n = 0; n < nLength; n++ )
+ {
+ addAttribute( Reference<XAttr>( xAttributes->item( n ), UNO_QUERY_THROW ) );
+ }
+
+ // write name
+ mrExport.StartElement( qualifiedName( xElement ), sal_False );
+}
+
+void DomExport::endElement( const Reference<XElement>& xElement )
+{
+ mrExport.EndElement( qualifiedName( xElement ), sal_False );
+ popNamespace();
+}
+
+void DomExport::character( const Reference<XCharacterData>& xChars )
+{
+ mrExport.Characters( xChars->getNodeValue() );
+}
+
+
+void exportDom( SvXMLExport& rExport, const Reference<XDocument>& xDocument )
+{
+ DomExport aDomExport( rExport );
+ visit( aDomExport, xDocument );
+}
+
+void exportDom( SvXMLExport& rExport, const Reference<XNode>& xNode )
+{
+ DomExport aDomExport( rExport );
+ visit( aDomExport, xNode );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/core/ProgressBarHelper.cxx b/xmloff/source/core/ProgressBarHelper.cxx
new file mode 100644
index 000000000000..83edfb771f3c
--- /dev/null
+++ b/xmloff/source/core/ProgressBarHelper.cxx
@@ -0,0 +1,133 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+
+
+
+//___________________________________________________________________
+#include <xmloff/ProgressBarHelper.hxx>
+#include <tools/debug.hxx>
+#include <xmloff/xmltoken.hxx>
+
+#include <stdlib.h>
+
+using namespace ::com::sun::star;
+
+const sal_Int32 nDefaultProgressBarRange = 1000000;
+const float fProgressStep = 0.5;
+
+ProgressBarHelper::ProgressBarHelper(const ::com::sun::star::uno::Reference < ::com::sun::star::task::XStatusIndicator>& xTempStatusIndicator,
+ const sal_Bool bTempStrict)
+: xStatusIndicator(xTempStatusIndicator)
+, nRange(nDefaultProgressBarRange)
+, nReference(100)
+, nValue(0)
+, fOldPercent(0.0)
+, bStrict(bTempStrict)
+, bRepeat(sal_True)
+#ifdef DBG_UTIL
+, bFailure(sal_False)
+#endif
+{
+}
+
+ProgressBarHelper::~ProgressBarHelper()
+{
+}
+
+sal_Int32 ProgressBarHelper::ChangeReference(sal_Int32 nNewReference)
+{
+ if((nNewReference > 0) && (nNewReference != nReference))
+ {
+ if (nReference)
+ {
+ double fPercent(nNewReference / nReference);
+ double fValue(nValue * fPercent);
+#if OSL_DEBUG_LEVEL > 0
+ // workaround for toolchain bug on solaris/x86 Sun C++ 5.5
+ // just call some function here
+ (void) abs(nValue);
+#endif
+ nValue = static_cast< sal_Int32 >(fValue);
+ nReference = nNewReference;
+ }
+ else
+ {
+ nReference = nNewReference;
+ nValue = 0;
+ }
+ }
+ return nValue;
+}
+
+void ProgressBarHelper::SetValue(sal_Int32 nTempValue)
+{
+ if (xStatusIndicator.is() && (nReference > 0))
+ {
+ if ((nTempValue >= nValue) && (!bStrict || (bStrict && (nTempValue <= nReference))))
+ {
+ // #91317# no progress bar with values > 100%
+ if (nTempValue > nReference)
+ {
+ if (!bRepeat)
+ nValue = nReference;
+ else
+ {
+ xStatusIndicator->reset();
+ nValue = 0;
+ }
+ }
+ else
+ nValue = nTempValue;
+
+ double fValue(nValue);
+ double fNewValue ((fValue * nRange) / nReference);
+
+ xmloff::token::IncRescheduleCount();
+
+ xStatusIndicator->setValue((sal_Int32)fNewValue);
+
+ xmloff::token::DecRescheduleCount();
+
+ // #95181# disabled, because we want to call setValue very often to enable a good reschedule
+ }
+#ifdef DBG_UTIL
+ else if (!bFailure)
+ {
+ OSL_FAIL("tried to set a wrong value on the progressbar");
+ bFailure = sal_True;
+ }
+#endif
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/core/PropertySetMerger.cxx b/xmloff/source/core/PropertySetMerger.cxx
new file mode 100644
index 000000000000..a6c6f5cf270f
--- /dev/null
+++ b/xmloff/source/core/PropertySetMerger.cxx
@@ -0,0 +1,268 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include "PropertySetMerger.hxx"
+
+using ::rtl::OUString;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+
+#include <cppuhelper/implbase3.hxx>
+
+class SvXMLAttrContainerItem_Impl;
+
+class PropertySetMergerImpl : public ::cppu::WeakAggImplHelper3< XPropertySet, XPropertyState, XPropertySetInfo >
+{
+private:
+ Reference< XPropertySet > mxPropSet1;
+ Reference< XPropertyState > mxPropSet1State;
+ Reference< XPropertySetInfo > mxPropSet1Info;
+
+ Reference< XPropertySet > mxPropSet2;
+ Reference< XPropertyState > mxPropSet2State;
+ Reference< XPropertySetInfo > mxPropSet2Info;
+
+public:
+ PropertySetMergerImpl( const Reference< XPropertySet > rPropSet1, const Reference< XPropertySet > rPropSet2 );
+ virtual ~PropertySetMergerImpl();
+
+ // XPropertySet
+ virtual Reference< XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException);
+ virtual Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& xListener ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& aListener ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException);
+
+ // XPropertyState
+ virtual PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) throw(UnknownPropertyException, RuntimeException);
+ virtual Sequence< PropertyState > SAL_CALL getPropertyStates( const Sequence< OUString >& aPropertyName ) throw(UnknownPropertyException, RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) throw(UnknownPropertyException, RuntimeException);
+ virtual Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException);
+
+ // XPropertySetInfo
+ virtual Sequence< Property > SAL_CALL getProperties( ) throw(RuntimeException);
+ virtual Property SAL_CALL getPropertyByName( const OUString& aName ) throw(UnknownPropertyException, RuntimeException);
+ virtual sal_Bool SAL_CALL hasPropertyByName( const OUString& Name ) throw(RuntimeException);
+};
+
+// --------------------------------------------------------------------
+// Interface implementation
+// --------------------------------------------------------------------
+
+PropertySetMergerImpl::PropertySetMergerImpl( Reference< XPropertySet > rPropSet1, Reference< XPropertySet > rPropSet2 )
+: mxPropSet1( rPropSet1 )
+, mxPropSet1State( rPropSet1, UNO_QUERY )
+, mxPropSet1Info( rPropSet1->getPropertySetInfo() )
+, mxPropSet2( rPropSet2 )
+, mxPropSet2State( rPropSet2, UNO_QUERY )
+, mxPropSet2Info( rPropSet2->getPropertySetInfo() )
+{
+}
+
+PropertySetMergerImpl::~PropertySetMergerImpl()
+{
+}
+
+// XPropertySet
+Reference< XPropertySetInfo > SAL_CALL PropertySetMergerImpl::getPropertySetInfo( ) throw(RuntimeException)
+{
+ return this;
+}
+
+void SAL_CALL PropertySetMergerImpl::setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
+{
+ if( mxPropSet1Info->hasPropertyByName( aPropertyName ) )
+ {
+ mxPropSet1->setPropertyValue( aPropertyName, aValue );
+ }
+ else
+ {
+ mxPropSet2->setPropertyValue( aPropertyName, aValue );
+ }
+}
+
+Any SAL_CALL PropertySetMergerImpl::getPropertyValue( const OUString& PropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ if( mxPropSet1Info->hasPropertyByName( PropertyName ) )
+ {
+ return mxPropSet1->getPropertyValue( PropertyName );
+ }
+ else
+ {
+ return mxPropSet2->getPropertyValue( PropertyName );
+ }
+}
+
+void SAL_CALL PropertySetMergerImpl::addPropertyChangeListener( const OUString& /*aPropertyName*/, const Reference< XPropertyChangeListener >& /*xListener*/ ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+void SAL_CALL PropertySetMergerImpl::removePropertyChangeListener( const OUString& /*aPropertyName*/, const Reference< XPropertyChangeListener >& /*aListener*/ ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+void SAL_CALL PropertySetMergerImpl::addVetoableChangeListener( const OUString& /*PropertyName*/, const Reference< XVetoableChangeListener >& /*aListener*/ ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+void SAL_CALL PropertySetMergerImpl::removeVetoableChangeListener( const OUString& /*PropertyName*/, const Reference< XVetoableChangeListener >& /*aListener*/ ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+// XPropertyState
+PropertyState SAL_CALL PropertySetMergerImpl::getPropertyState( const OUString& PropertyName ) throw(UnknownPropertyException, RuntimeException)
+{
+ if( mxPropSet1Info->hasPropertyByName( PropertyName ) )
+ {
+ if( mxPropSet1State.is() )
+ {
+ return mxPropSet1State->getPropertyState( PropertyName );
+ }
+ else
+ {
+ return PropertyState_DIRECT_VALUE;
+ }
+ }
+ else
+ {
+ if( mxPropSet2State.is() )
+ {
+ return mxPropSet2State->getPropertyState( PropertyName );
+ }
+ else
+ {
+ return PropertyState_DIRECT_VALUE;
+ }
+ }
+}
+
+Sequence< PropertyState > SAL_CALL PropertySetMergerImpl::getPropertyStates( const Sequence< OUString >& aPropertyName ) throw(UnknownPropertyException, RuntimeException)
+{
+ const sal_Int32 nCount = aPropertyName.getLength();
+ Sequence< PropertyState > aPropStates( nCount );
+ PropertyState* pPropStates = aPropStates.getArray();
+ const OUString* pPropNames = aPropertyName.getConstArray();
+
+ sal_Int32 nIndex;
+ for( nIndex = 0; nIndex < nCount; nIndex++ )
+ *pPropStates++ = getPropertyState( *pPropNames++ );
+
+ return aPropStates;
+}
+
+void SAL_CALL PropertySetMergerImpl::setPropertyToDefault( const OUString& PropertyName ) throw(UnknownPropertyException, RuntimeException)
+{
+ if( mxPropSet1State.is() && mxPropSet1Info->hasPropertyByName( PropertyName ) )
+ {
+ mxPropSet1State->setPropertyToDefault( PropertyName );
+ }
+ else
+ {
+ if( mxPropSet2State.is() )
+ {
+ mxPropSet2State->setPropertyToDefault( PropertyName );
+ }
+ }
+}
+
+Any SAL_CALL PropertySetMergerImpl::getPropertyDefault( const OUString& aPropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ if( mxPropSet1State.is() && mxPropSet1Info->hasPropertyByName( aPropertyName ) )
+ {
+ return mxPropSet1State->getPropertyDefault( aPropertyName );
+ }
+ else
+ {
+ if( mxPropSet2State.is() )
+ {
+ return mxPropSet2State->getPropertyDefault( aPropertyName );
+ }
+ else
+ {
+ Any aAny;
+ return aAny;
+ }
+ }
+}
+
+// XPropertySetInfo
+Sequence< Property > SAL_CALL PropertySetMergerImpl::getProperties() throw(RuntimeException)
+{
+ Sequence< Property > aProps1( mxPropSet1Info->getProperties() );
+ const Property* pProps1 = aProps1.getArray();
+ const sal_Int32 nCount1 = aProps1.getLength();
+
+ Sequence< Property > aProps2( mxPropSet1Info->getProperties() );
+ const Property* pProps2 = aProps2.getArray();
+ const sal_Int32 nCount2 = aProps2.getLength();
+
+ Sequence< Property > aProperties( nCount1 + nCount2 );
+
+ sal_Int32 nIndex;
+
+ Property* pProperties = aProperties.getArray();
+
+ for( nIndex = 0; nIndex < nCount1; nIndex++ )
+ *pProperties++ = *pProps1++;
+
+ for( nIndex = 0; nIndex < nCount2; nIndex++ )
+ *pProperties++ = *pProps2++;
+
+ return aProperties;
+}
+
+Property SAL_CALL PropertySetMergerImpl::getPropertyByName( const OUString& aName ) throw(UnknownPropertyException, RuntimeException)
+{
+ if( mxPropSet1Info->hasPropertyByName( aName ) )
+ return mxPropSet1Info->getPropertyByName( aName );
+
+ return mxPropSet2Info->getPropertyByName( aName );
+}
+
+sal_Bool SAL_CALL PropertySetMergerImpl::hasPropertyByName( const OUString& Name ) throw(RuntimeException)
+{
+ if(mxPropSet1Info->hasPropertyByName( Name ) )
+ return sal_True;
+
+ return mxPropSet2Info->hasPropertyByName( Name );
+}
+
+Reference< XPropertySet > PropertySetMerger_CreateInstance( Reference< XPropertySet > rPropSet1, Reference< XPropertySet > rPropSet2 ) throw()
+{
+ return new PropertySetMergerImpl( rPropSet1, rPropSet2 );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/core/RDFaExportHelper.cxx b/xmloff/source/core/RDFaExportHelper.cxx
new file mode 100644
index 000000000000..952c7cf6d229
--- /dev/null
+++ b/xmloff/source/core/RDFaExportHelper.cxx
@@ -0,0 +1,233 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_xmloff.hxx"
+
+#include "RDFaExportHelper.hxx"
+
+#include "xmloff/xmlnmspe.hxx"
+
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmltoken.hxx>
+
+#include <comphelper/stlunosequence.hxx>
+#include <comphelper/stl_types.hxx>
+
+#include <com/sun/star/uri/XUriReference.hpp>
+#include <com/sun/star/uri/XUriReferenceFactory.hpp>
+#include <com/sun/star/rdf/Statement.hpp>
+#include <com/sun/star/rdf/URIs.hpp>
+#include <com/sun/star/rdf/URI.hpp>
+#include <com/sun/star/rdf/XLiteral.hpp>
+#include <com/sun/star/rdf/XRepositorySupplier.hpp>
+#include <com/sun/star/rdf/XDocumentRepository.hpp>
+
+#include <rtl/ustrbuf.hxx>
+
+#include <boost/bind.hpp>
+#include <boost/iterator_adaptors.hpp>
+#ifndef BOOST_ITERATOR_ADAPTOR_DWA053000_HPP_ // from iterator_adaptors.hpp
+// N.B.: the check for the header guard _of a specific version of boost_
+// is here so this may work on different versions of boost,
+// which sadly put the goods in different header files
+#include <boost/iterator/transform_iterator.hpp>
+#endif
+
+#include <functional>
+#include <algorithm>
+
+
+using namespace ::com::sun::star;
+
+namespace xmloff {
+
+static const char s_prefix [] = "_:b";
+
+static ::rtl::OUString
+makeCURIE(SvXMLExport * i_pExport,
+ uno::Reference<rdf::XURI> const & i_xURI)
+{
+ OSL_ENSURE(i_xURI.is(), "makeCURIE: null URI");
+ if (!i_xURI.is()) throw uno::RuntimeException();
+
+ const ::rtl::OUString Namespace( i_xURI->getNamespace() );
+ OSL_ENSURE(Namespace.getLength(), "makeCURIE: no namespace");
+ if (!Namespace.getLength()) throw uno::RuntimeException();
+
+ ::rtl::OUStringBuffer buf;
+ buf.append( i_pExport->EnsureNamespace(Namespace) );
+ buf.append( static_cast<sal_Unicode>(':') );
+ // N.B.: empty LocalName is valid!
+ buf.append( i_xURI->getLocalName() );
+
+ return buf.makeStringAndClear();
+}
+
+// #i112473# SvXMLExport::GetRelativeReference() not right for RDF on SaveAs
+// because the URIs in the repository are not rewritten on SaveAs, the
+// URI of the loaded document has to be used, not the URI of the target doc.
+static ::rtl::OUString
+getRelativeReference(SvXMLExport const& rExport, ::rtl::OUString const& rURI)
+{
+ uno::Reference< rdf::XURI > const xModelURI(
+ rExport.GetModel(), uno::UNO_QUERY_THROW );
+ ::rtl::OUString const baseURI( xModelURI->getStringValue() );
+
+ uno::Reference<uno::XComponentContext> const xContext(
+ rExport.GetComponentContext());
+ uno::Reference<lang::XMultiComponentFactory> const xServiceFactory(
+ xContext->getServiceManager(), uno::UNO_SET_THROW);
+ uno::Reference<uri::XUriReferenceFactory> const xUriFactory(
+ xServiceFactory->createInstanceWithContext(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.uri.UriReferenceFactory")), xContext),
+ uno::UNO_QUERY_THROW);
+
+ uno::Reference< uri::XUriReference > const xBaseURI(
+ xUriFactory->parse(baseURI), uno::UNO_SET_THROW );
+ uno::Reference< uri::XUriReference > const xAbsoluteURI(
+ xUriFactory->parse(rURI), uno::UNO_SET_THROW );
+ uno::Reference< uri::XUriReference > const xRelativeURI(
+ xUriFactory->makeRelative(xBaseURI, xAbsoluteURI, true, true, false),
+ uno::UNO_SET_THROW );
+ ::rtl::OUString const relativeURI(xRelativeURI->getUriReference());
+
+ return relativeURI;
+}
+
+
+////////////////////////////////////////////////////////////////////////////
+
+RDFaExportHelper::RDFaExportHelper(SvXMLExport & i_rExport)
+ : m_rExport(i_rExport), m_xRepository(0), m_Counter(0)
+{
+ const uno::Reference<rdf::XRepositorySupplier> xRS( m_rExport.GetModel(),
+ uno::UNO_QUERY);
+ OSL_ENSURE(xRS.is(), "AddRDFa: model is no rdf::XRepositorySupplier");
+ if (!xRS.is()) throw uno::RuntimeException();
+ m_xRepository.set(xRS->getRDFRepository(), uno::UNO_QUERY_THROW);
+}
+
+::rtl::OUString
+RDFaExportHelper::LookupBlankNode(
+ uno::Reference<rdf::XBlankNode> const & i_xBlankNode)
+{
+ OSL_ENSURE(i_xBlankNode.is(), "null BlankNode?");
+ if (!i_xBlankNode.is()) throw uno::RuntimeException();
+ ::rtl::OUString & rEntry(
+ m_BlankNodeMap[ i_xBlankNode->getStringValue() ] );
+ if (!rEntry.getLength())
+ {
+ ::rtl::OUStringBuffer buf;
+ buf.appendAscii(s_prefix);
+ buf.append(++m_Counter);
+ rEntry = buf.makeStringAndClear();
+ }
+ return rEntry;
+}
+
+////////////////////////////////////////////////////////////////////////////
+
+void
+RDFaExportHelper::AddRDFa(
+ uno::Reference<rdf::XMetadatable> const & i_xMetadatable)
+{
+ try
+ {
+ beans::Pair< uno::Sequence<rdf::Statement>, sal_Bool > const
+ RDFaResult( m_xRepository->getStatementRDFa(i_xMetadatable) );
+
+ uno::Sequence<rdf::Statement> const & rStatements( RDFaResult.First );
+
+ if (0 == rStatements.getLength())
+ {
+ return; // no RDFa
+ }
+
+ // all stmts have the same subject, so we only handle first one
+ const uno::Reference<rdf::XURI> xSubjectURI(rStatements[0].Subject,
+ uno::UNO_QUERY);
+ const uno::Reference<rdf::XBlankNode> xSubjectBNode(
+ rStatements[0].Subject, uno::UNO_QUERY);
+ if (!xSubjectURI.is() && !xSubjectBNode.is())
+ {
+ throw uno::RuntimeException();
+ }
+ static const sal_Unicode s_OpenBracket ('[');
+ static const sal_Unicode s_CloseBracket(']');
+ const ::rtl::OUString about( xSubjectURI.is()
+ ? getRelativeReference(m_rExport, xSubjectURI->getStringValue())
+ : ::rtl::OUStringBuffer().append(s_OpenBracket).append(
+ LookupBlankNode(xSubjectBNode)).append(s_CloseBracket)
+ .makeStringAndClear()
+ );
+
+ const uno::Reference<rdf::XLiteral> xContent(
+ rStatements[0].Object, uno::UNO_QUERY_THROW );
+ const uno::Reference<rdf::XURI> xDatatype(xContent->getDatatype());
+ if (xDatatype.is())
+ {
+ const ::rtl::OUString datatype(
+ makeCURIE(&m_rExport, xDatatype) );
+ m_rExport.AddAttribute(XML_NAMESPACE_XHTML,
+ token::XML_DATATYPE, datatype);
+ }
+ if (RDFaResult.Second) // there is xhtml:content
+ {
+ m_rExport.AddAttribute(XML_NAMESPACE_XHTML, token::XML_CONTENT,
+ xContent->getValue());
+ }
+
+ ::rtl::OUStringBuffer property;
+ ::comphelper::intersperse(
+ ::boost::make_transform_iterator(
+ ::comphelper::stl_begin(rStatements),
+ ::boost::bind(&makeCURIE, &m_rExport,
+ ::boost::bind(&rdf::Statement::Predicate, _1))),
+ // argh, this must be the same type :(
+ ::boost::make_transform_iterator(
+ ::comphelper::stl_end(rStatements),
+ ::boost::bind(&makeCURIE, &m_rExport,
+ ::boost::bind(&rdf::Statement::Predicate, _1))),
+ ::comphelper::OUStringBufferAppender(property),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ")));
+
+ m_rExport.AddAttribute(XML_NAMESPACE_XHTML, token::XML_PROPERTY,
+ property.makeStringAndClear());
+
+ m_rExport.AddAttribute(XML_NAMESPACE_XHTML, token::XML_ABOUT, about);
+ }
+ catch (uno::Exception &)
+ {
+ OSL_FAIL("AddRDFa: exception");
+ }
+}
+
+} // namespace xmloff
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/core/RDFaImportHelper.cxx b/xmloff/source/core/RDFaImportHelper.cxx
new file mode 100644
index 000000000000..043b9f70e5fa
--- /dev/null
+++ b/xmloff/source/core/RDFaImportHelper.cxx
@@ -0,0 +1,501 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_xmloff.hxx"
+
+#include "RDFaImportHelper.hxx"
+
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/nmspmap.hxx>
+
+#include <comphelper/sequenceasvector.hxx>
+
+#include <tools/string.hxx> // for GetAbsoluteReference
+
+#include <com/sun/star/rdf/URI.hpp>
+#include <com/sun/star/rdf/XDocumentMetadataAccess.hpp>
+#include <com/sun/star/rdf/XDocumentRepository.hpp>
+
+#include <rtl/ustring.hxx>
+
+#include <boost/bind.hpp>
+#include <boost/iterator_adaptors.hpp>
+#ifndef BOOST_ITERATOR_ADAPTOR_DWA053000_HPP_ // from iterator_adaptors.hpp
+// N.B.: the check for the header guard _of a specific version of boost_
+// is here so this may work on different versions of boost,
+// which sadly put the goods in different header files
+#include <boost/iterator/transform_iterator.hpp>
+#endif
+
+#include <map>
+#include <iterator>
+#include <functional>
+#include <algorithm>
+
+
+using namespace ::com::sun::star;
+
+namespace xmloff {
+
+/** a bit of context for parsing RDFa attributes */
+class SAL_DLLPRIVATE RDFaReader
+{
+ const SvXMLImport & m_rImport;
+
+ const SvXMLImport & GetImport() const { return m_rImport; }
+
+ //FIXME: this is an ugly hack to workaround buggy SvXMLImport::GetAbsolute
+ ::rtl::OUString GetAbsoluteReference(::rtl::OUString const & i_rURI) const
+ {
+ if (!i_rURI.getLength() || i_rURI[0] == '#')
+ {
+ return GetImport().GetBaseURL() + i_rURI;
+ }
+ else
+ {
+ return GetImport().GetAbsoluteReference(i_rURI);
+ }
+ }
+
+public:
+ RDFaReader(SvXMLImport const & i_rImport)
+ : m_rImport(i_rImport)
+ { }
+
+ // returns URI or blank node!
+ ::rtl::OUString ReadCURIE(::rtl::OUString const & i_rCURIE) const;
+
+ std::vector< ::rtl::OUString >
+ ReadCURIEs(::rtl::OUString const & i_rCURIEs) const;
+
+ ::rtl::OUString
+ ReadURIOrSafeCURIE( ::rtl::OUString const & i_rURIOrSafeCURIE) const;
+};
+
+/** helper to insert RDFa statements into the RDF repository */
+class SAL_DLLPRIVATE RDFaInserter
+{
+ const uno::Reference<uno::XComponentContext> m_xContext;
+ uno::Reference< rdf::XDocumentRepository > m_xRepository;
+
+ typedef ::std::map< ::rtl::OUString, uno::Reference< rdf::XBlankNode > >
+ BlankNodeMap_t;
+
+ BlankNodeMap_t m_BlankNodeMap;
+
+public:
+ RDFaInserter(uno::Reference<uno::XComponentContext> const & i_xContext,
+ uno::Reference< rdf::XDocumentRepository > const & i_xRepository)
+ : m_xContext(i_xContext)
+ , m_xRepository(i_xRepository)
+ {}
+
+ uno::Reference< rdf::XBlankNode >
+ LookupBlankNode(::rtl::OUString const & i_rNodeId );
+
+ uno::Reference< rdf::XURI >
+ MakeURI( ::rtl::OUString const & i_rURI) const;
+
+ uno::Reference< rdf::XResource>
+ MakeResource( ::rtl::OUString const & i_rResource);
+
+ void InsertRDFaEntry(struct RDFaEntry const & i_rEntry);
+};
+
+/** store parsed RDFa attributes */
+struct SAL_DLLPRIVATE ParsedRDFaAttributes
+{
+ ::rtl::OUString m_About;
+ ::std::vector< ::rtl::OUString > m_Properties;
+ ::rtl::OUString m_Content;
+ ::rtl::OUString m_Datatype;
+
+ ParsedRDFaAttributes(
+ ::rtl::OUString const & i_rAbout,
+ ::std::vector< ::rtl::OUString > const & i_rProperties,
+ ::rtl::OUString const & i_rContent,
+ ::rtl::OUString const & i_rDatatype)
+ : m_About(i_rAbout)
+ , m_Properties(i_rProperties)
+ , m_Content(i_rContent)
+ , m_Datatype(i_rDatatype)
+ { }
+};
+
+/** store metadatable object and its RDFa attributes */
+struct SAL_DLLPRIVATE RDFaEntry
+{
+ uno::Reference<rdf::XMetadatable> m_xObject;
+ ::boost::shared_ptr<ParsedRDFaAttributes> m_pRDFaAttributes;
+
+ RDFaEntry(uno::Reference<rdf::XMetadatable> const & i_xObject,
+ ::boost::shared_ptr<ParsedRDFaAttributes> const& i_pRDFaAttributes)
+ : m_xObject(i_xObject)
+ , m_pRDFaAttributes(i_pRDFaAttributes)
+ { }
+};
+
+////////////////////////////////////////////////////////////////////////////
+
+
+static inline bool isWS(const sal_Unicode i_Char)
+{
+ return ('\t' == i_Char) || ('\n' == i_Char) || ('\r' == i_Char)
+ || (' ' == i_Char);
+}
+
+static ::rtl::OUString splitAtWS(::rtl::OUString & io_rString)
+{
+ const sal_Int32 len( io_rString.getLength() );
+ sal_Int32 idxstt(0);
+ while ((idxstt < len) && ( isWS(io_rString[idxstt])))
+ ++idxstt; // skip leading ws
+ sal_Int32 idxend(idxstt);
+ while ((idxend < len) && (!isWS(io_rString[idxend])))
+ ++idxend; // the CURIE
+ const ::rtl::OUString ret(io_rString.copy(idxstt, idxend - idxstt));
+ io_rString = io_rString.copy(idxend); // rest
+ return ret;
+}
+
+::rtl::OUString
+RDFaReader::ReadCURIE(::rtl::OUString const & i_rCURIE) const
+{
+ // the RDFa spec says that a prefix is required (it may be empty: ":foo")
+ const sal_Int32 idx( i_rCURIE.indexOf(':') );
+ if (idx >= 0)
+ {
+ ::rtl::OUString Prefix;
+ ::rtl::OUString LocalName;
+ ::rtl::OUString Namespace;
+ sal_uInt16 nKey( GetImport().GetNamespaceMap()._GetKeyByAttrName(
+ i_rCURIE, &Prefix, &LocalName, &Namespace) );
+ if (Prefix.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("_")))
+ {
+ // eeek, it's a bnode!
+ // "_" is not a valid URI scheme => we can identify bnodes
+ return i_rCURIE;
+ }
+ else
+ {
+ OSL_ENSURE(XML_NAMESPACE_NONE != nKey, "no namespace?");
+ if ((XML_NAMESPACE_UNKNOWN != nKey) &&
+ (XML_NAMESPACE_XMLNS != nKey))
+ {
+ // N.B.: empty LocalName is valid!
+ const ::rtl::OUString URI(Namespace + LocalName);
+ return GetAbsoluteReference(URI);
+ }
+ else
+ {
+ OSL_TRACE( "ReadCURIE: invalid CURIE: invalid prefix" );
+ return ::rtl::OUString();
+ }
+ }
+ }
+ else
+ {
+ OSL_TRACE( "ReadCURIE: invalid CURIE: no prefix" );
+ return ::rtl::OUString();
+ }
+}
+
+::std::vector< ::rtl::OUString >
+RDFaReader::ReadCURIEs(::rtl::OUString const & i_rCURIEs) const
+{
+ std::vector< ::rtl::OUString > vec;
+ ::rtl::OUString CURIEs(i_rCURIEs);
+ do {
+ ::rtl::OUString curie( splitAtWS(CURIEs) );
+ if (curie.getLength())
+ {
+ const ::rtl::OUString uri(ReadCURIE(curie));
+ if (uri.getLength())
+ {
+ vec.push_back(uri);
+ }
+ }
+ }
+ while (CURIEs.getLength());
+ if (!vec.size())
+ {
+ OSL_TRACE( "ReadCURIEs: invalid CURIEs" );
+ }
+ return vec;
+}
+
+::rtl::OUString
+RDFaReader::ReadURIOrSafeCURIE(::rtl::OUString const & i_rURIOrSafeCURIE) const
+{
+ const sal_Int32 len(i_rURIOrSafeCURIE.getLength());
+ if (len && (i_rURIOrSafeCURIE[0] == '['))
+ {
+ if ((len >= 2) && (i_rURIOrSafeCURIE[len - 1] == ']'))
+ {
+ return ReadCURIE(i_rURIOrSafeCURIE.copy(1, len - 2));
+ }
+ else
+ {
+ OSL_TRACE( "ReadURIOrSafeCURIE: invalid SafeCURIE" );
+ return ::rtl::OUString();
+ }
+ }
+ else
+ {
+ if (i_rURIOrSafeCURIE.matchAsciiL("_:", 2)) // blank node
+ {
+ OSL_TRACE( "ReadURIOrSafeCURIE: invalid URI: scheme is _" );
+ return ::rtl::OUString();
+ }
+ else
+ {
+ return GetAbsoluteReference(i_rURIOrSafeCURIE);
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////
+
+uno::Reference< rdf::XBlankNode >
+RDFaInserter::LookupBlankNode(::rtl::OUString const & i_rNodeId )
+{
+ uno::Reference< rdf::XBlankNode > & rEntry( m_BlankNodeMap[ i_rNodeId ] );
+ if (!rEntry.is())
+ {
+ rEntry = m_xRepository->createBlankNode();
+ }
+ return rEntry;
+}
+
+uno::Reference< rdf::XURI >
+RDFaInserter::MakeURI( ::rtl::OUString const & i_rURI) const
+{
+ if (i_rURI.matchAsciiL("_:", 2)) // blank node
+ {
+ OSL_TRACE("MakeURI: cannot create URI for blank node");
+ return 0;
+ }
+ else
+ {
+ try
+ {
+ return rdf::URI::create( m_xContext, i_rURI );
+ }
+ catch (uno::Exception &)
+ {
+ OSL_FAIL("MakeURI: cannot create URI");
+ return 0;
+ }
+ }
+}
+
+uno::Reference< rdf::XResource>
+RDFaInserter::MakeResource( ::rtl::OUString const & i_rResource)
+{
+ if (i_rResource.matchAsciiL("_:", 2)) // blank node
+ {
+ // we cannot use the blank node label as-is: it must be distinct
+ // from labels in other graphs, so create fresh ones per XML stream
+ // N.B.: content.xml and styles.xml are distinct graphs
+ ::rtl::OUString name( i_rResource.copy(2) );
+ const uno::Reference< rdf::XBlankNode > xBNode( LookupBlankNode(name) );
+ OSL_ENSURE(xBNode.is(), "no blank node?");
+ return uno::Reference<rdf::XResource>( xBNode, uno::UNO_QUERY);
+ }
+ else
+ {
+ return uno::Reference<rdf::XResource>( MakeURI( i_rResource ),
+ uno::UNO_QUERY);
+ }
+}
+
+/** i wrote this because c++ implementations cannot agree on which variant
+ of boost::bind and std::mem_fun_ref applied to Reference::is compiles */
+class ref_is_null :
+ public ::std::unary_function<sal_Bool, const uno::Reference<rdf::XURI> & >
+{
+public:
+ sal_Bool operator() (const uno::Reference<rdf::XURI> & i_rRef)
+ {
+ return !i_rRef.is();
+ }
+};
+
+void RDFaInserter::InsertRDFaEntry(
+ struct RDFaEntry const & i_rEntry)
+{
+ OSL_ENSURE(i_rEntry.m_xObject.is(),
+ "InsertRDFaEntry: invalid arg: null object");
+ if (!i_rEntry.m_xObject.is()) return;
+
+ const uno::Reference< rdf::XResource > xSubject(
+ MakeResource( i_rEntry.m_pRDFaAttributes->m_About ) );
+ if (!xSubject.is())
+ {
+ return; // invalid
+ }
+
+ ::comphelper::SequenceAsVector< uno::Reference< rdf::XURI > > predicates;
+
+ predicates.reserve(i_rEntry.m_pRDFaAttributes->m_Properties.size());
+
+ ::std::remove_copy_if(
+ ::boost::make_transform_iterator(
+ i_rEntry.m_pRDFaAttributes->m_Properties.begin(),
+ ::boost::bind(&RDFaInserter::MakeURI, this, _1)),
+ // argh, this must be the same type :(
+ ::boost::make_transform_iterator(
+ i_rEntry.m_pRDFaAttributes->m_Properties.end(),
+ ::boost::bind(&RDFaInserter::MakeURI, this, _1)),
+ ::std::back_inserter(predicates),
+ ref_is_null() );
+ // compiles only on wntmsci12
+// ::boost::bind( ::std::logical_not<sal_Bool>(), ::boost::bind<sal_Bool>(&uno::Reference<rdf::XURI>::is, _1)));
+ // compiles on unxsoli4, wntsci12, but not unxlngi6
+// ::boost::bind( ::std::logical_not<sal_Bool>(), ::boost::bind<sal_Bool, com::sun::star::uno::Reference<rdf::XURI> >(&uno::Reference<rdf::XURI>::is, _1)));
+ // compiles on unxsoli4, unxlngi6, but not wntsci12
+// ::std::not1( ::std::mem_fun_ref(&uno::Reference<rdf::XURI>::is)) );
+
+ if (!predicates.size())
+ {
+ return; // invalid
+ }
+
+ uno::Reference<rdf::XURI> xDatatype;
+ if (i_rEntry.m_pRDFaAttributes->m_Datatype.getLength())
+ {
+ xDatatype = MakeURI( i_rEntry.m_pRDFaAttributes->m_Datatype );
+ }
+
+ try
+ {
+ // N.B.: this will call xMeta->ensureMetadataReference, which is why
+ // this must be done _after_ importing the whole XML file,
+ // to prevent collision between generated ids and ids in the file
+ m_xRepository->setStatementRDFa(xSubject, predicates.getAsConstList(),
+ i_rEntry.m_xObject,
+ i_rEntry.m_pRDFaAttributes->m_Content, xDatatype);
+ }
+ catch (uno::Exception &)
+ {
+ OSL_FAIL("InsertRDFaEntry: setStatementRDFa failed?");
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////
+
+RDFaImportHelper::RDFaImportHelper(const SvXMLImport & i_rImport)
+ : m_rImport(i_rImport)
+{
+}
+
+RDFaImportHelper::~RDFaImportHelper()
+{
+}
+
+::boost::shared_ptr<ParsedRDFaAttributes>
+RDFaImportHelper::ParseRDFa(
+ ::rtl::OUString const & i_rAbout,
+ ::rtl::OUString const & i_rProperty,
+ ::rtl::OUString const & i_rContent,
+ ::rtl::OUString const & i_rDatatype)
+{
+ if (!i_rProperty.getLength())
+ {
+ OSL_TRACE("AddRDFa: invalid input: xhtml:property empty");
+ return ::boost::shared_ptr<ParsedRDFaAttributes>();
+ }
+ // must parse CURIEs here: need namespace declaration context
+ RDFaReader reader(GetImport());
+ const ::rtl::OUString about( reader.ReadURIOrSafeCURIE(i_rAbout) );
+ if (!about.getLength()) {
+ return ::boost::shared_ptr<ParsedRDFaAttributes>();
+ }
+ const ::std::vector< ::rtl::OUString > properties(
+ reader.ReadCURIEs(i_rProperty) );
+ if (!properties.size()) {
+ return ::boost::shared_ptr<ParsedRDFaAttributes>();
+ }
+ const ::rtl::OUString datatype( i_rDatatype.getLength()
+ ? reader.ReadCURIE(i_rDatatype)
+ : ::rtl::OUString() );
+ return ::boost::shared_ptr<ParsedRDFaAttributes>(
+ new ParsedRDFaAttributes(about, properties, i_rContent, datatype));
+}
+
+void
+RDFaImportHelper::AddRDFa(
+ uno::Reference<rdf::XMetadatable> const & i_xObject,
+ ::boost::shared_ptr<ParsedRDFaAttributes> & i_pRDFaAttributes)
+{
+ if (!i_xObject.is())
+ {
+ OSL_FAIL("AddRDFa: invalid arg: null textcontent");
+ return;
+ }
+ if (!i_pRDFaAttributes.get())
+ {
+ OSL_FAIL("AddRDFa: invalid arg: null RDFa attributes");
+ return;
+ }
+ m_RDFaEntries.push_back(RDFaEntry(i_xObject, i_pRDFaAttributes));
+}
+
+void
+RDFaImportHelper::ParseAndAddRDFa(
+ uno::Reference<rdf::XMetadatable> const & i_xObject,
+ ::rtl::OUString const & i_rAbout,
+ ::rtl::OUString const & i_rProperty,
+ ::rtl::OUString const & i_rContent,
+ ::rtl::OUString const & i_rDatatype)
+{
+ ::boost::shared_ptr<ParsedRDFaAttributes> pAttributes(
+ ParseRDFa(i_rAbout, i_rProperty, i_rContent, i_rDatatype) );
+ if (pAttributes.get())
+ {
+ AddRDFa(i_xObject, pAttributes);
+ }
+}
+
+void RDFaImportHelper::InsertRDFa(
+ uno::Reference< rdf::XRepositorySupplier> const & i_xModel)
+{
+ OSL_ENSURE(i_xModel.is(), "InsertRDFa: invalid arg: model null");
+ if (!i_xModel.is()) return;
+ const uno::Reference< rdf::XDocumentRepository > xRepository(
+ i_xModel->getRDFRepository(), uno::UNO_QUERY);
+ OSL_ENSURE(xRepository.is(), "InsertRDFa: no DocumentRepository?");
+ if (!xRepository.is()) return;
+ RDFaInserter inserter(GetImport().GetComponentContext(), xRepository);
+ ::std::for_each(m_RDFaEntries.begin(), m_RDFaEntries.end(),
+ ::boost::bind(&RDFaInserter::InsertRDFaEntry, &inserter, _1));
+}
+
+} // namespace xmloff
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/core/SettingsExportHelper.cxx b/xmloff/source/core/SettingsExportHelper.cxx
new file mode 100644
index 000000000000..7125df8f53c2
--- /dev/null
+++ b/xmloff/source/core/SettingsExportHelper.cxx
@@ -0,0 +1,570 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <xmloff/SettingsExportHelper.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
+#include <comphelper/extract.hxx>
+
+#include <com/sun/star/linguistic2/XSupportedLocales.hpp>
+#include <com/sun/star/i18n/XForbiddenCharacters.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/formula/SymbolDescriptor.hpp>
+#include <com/sun/star/document/PrinterIndependentLayout.hpp>
+#include <xmloff/XMLSettingsExportContext.hxx>
+#include <xmlenums.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+XMLSettingsExportHelper::XMLSettingsExportHelper( ::xmloff::XMLSettingsExportContext& i_rContext )
+: m_rContext( i_rContext )
+, msPrinterIndependentLayout( RTL_CONSTASCII_USTRINGPARAM( "PrinterIndependentLayout" ) )
+, msColorTableURL( RTL_CONSTASCII_USTRINGPARAM( "ColorTableURL" ) )
+, msLineEndTableURL( RTL_CONSTASCII_USTRINGPARAM( "LineEndTableURL" ) )
+, msHatchTableURL( RTL_CONSTASCII_USTRINGPARAM( "HatchTableURL" ) )
+, msDashTableURL( RTL_CONSTASCII_USTRINGPARAM( "DashTableURL" ) )
+, msGradientTableURL( RTL_CONSTASCII_USTRINGPARAM( "GradientTableURL" ) )
+, msBitmapTableURL( RTL_CONSTASCII_USTRINGPARAM( "BitmapTableURL" ) )
+{
+}
+
+XMLSettingsExportHelper::~XMLSettingsExportHelper()
+{
+}
+
+void XMLSettingsExportHelper::CallTypeFunction(const uno::Any& rAny,
+ const rtl::OUString& rName) const
+{
+ uno::Any aAny( rAny );
+ ManipulateSetting( aAny, rName );
+
+ uno::TypeClass eClass = aAny.getValueTypeClass();
+ switch (eClass)
+ {
+ case uno::TypeClass_VOID:
+ {
+ /*
+ * This assertion pops up when exporting values which are set to:
+ * PropertyAttribute::MAYBEVOID, and thus are _supposed_ to have
+ * a VOID value...so I'm removing it ...mtg
+ * OSL_FAIL("no type");
+ */
+ }
+ break;
+ case uno::TypeClass_BOOLEAN:
+ {
+ exportBool(::cppu::any2bool(aAny), rName);
+ }
+ break;
+ case uno::TypeClass_BYTE:
+ {
+ sal_Int8 nInt8 = 0;
+ aAny >>= nInt8;
+ exportByte(nInt8, rName);
+ }
+ break;
+ case uno::TypeClass_SHORT:
+ {
+ sal_Int16 nInt16 = 0;
+ aAny >>= nInt16;
+ exportShort(nInt16, rName);
+ }
+ break;
+ case uno::TypeClass_LONG:
+ {
+ sal_Int32 nInt32 = 0;
+ aAny >>= nInt32;
+ exportInt(nInt32, rName);
+ }
+ break;
+ case uno::TypeClass_HYPER:
+ {
+ sal_Int64 nInt64 = 0;
+ aAny >>= nInt64;
+ exportLong(nInt64, rName);
+ }
+ break;
+ case uno::TypeClass_DOUBLE:
+ {
+ double fDouble = 0.0;
+ aAny >>= fDouble;
+ exportDouble(fDouble, rName);
+ }
+ break;
+ case uno::TypeClass_STRING:
+ {
+ rtl::OUString sString;
+ aAny >>= sString;
+ exportString(sString, rName);
+ }
+ break;
+ default:
+ {
+ uno::Type aType = aAny.getValueType();
+ if (aType.equals(getCppuType( (uno::Sequence<beans::PropertyValue> *)0 ) ) )
+ {
+ uno::Sequence< beans::PropertyValue> aProps;
+ aAny >>= aProps;
+ exportSequencePropertyValue(aProps, rName);
+ }
+ else if( aType.equals(getCppuType( (uno::Sequence<sal_Int8> *)0 ) ) )
+ {
+ uno::Sequence< sal_Int8 > aProps;
+ aAny >>= aProps;
+ exportbase64Binary(aProps, rName);
+ }
+ else if (aType.equals(getCppuType( (uno::Reference<container::XNameContainer> *)0 ) ) ||
+ aType.equals(getCppuType( (uno::Reference<container::XNameAccess> *)0 ) ))
+ {
+ uno::Reference< container::XNameAccess> aNamed;
+ aAny >>= aNamed;
+ exportNameAccess(aNamed, rName);
+ }
+ else if (aType.equals(getCppuType( (uno::Reference<container::XIndexAccess> *)0 ) ) ||
+ aType.equals(getCppuType( (uno::Reference<container::XIndexContainer> *)0 ) ) )
+ {
+ uno::Reference<container::XIndexAccess> aIndexed;
+ aAny >>= aIndexed;
+ exportIndexAccess(aIndexed, rName);
+ }
+ else if (aType.equals(getCppuType( (util::DateTime *)0 ) ) )
+ {
+ util::DateTime aDateTime;
+ aAny >>= aDateTime;
+ exportDateTime(aDateTime, rName);
+ }
+ else if( aType.equals(getCppuType( (uno::Reference<i18n::XForbiddenCharacters> *)0 ) ) )
+ {
+ exportForbiddenCharacters( aAny, rName );
+ }
+ else if( aType.equals(getCppuType( (uno::Sequence<formula::SymbolDescriptor> *)0 ) ) )
+ {
+ uno::Sequence< formula::SymbolDescriptor > aProps;
+ aAny >>= aProps;
+ exportSymbolDescriptors(aProps, rName);
+ }
+ else {
+ OSL_FAIL("this type is not implemented now");
+ }
+ }
+ break;
+ }
+}
+
+void XMLSettingsExportHelper::exportBool(const sal_Bool bValue, const rtl::OUString& rName) const
+{
+ DBG_ASSERT(rName.getLength(), "no name");
+ m_rContext.AddAttribute( XML_NAME, rName );
+ m_rContext.AddAttribute( XML_TYPE, XML_BOOLEAN );
+ m_rContext.StartElement( XML_CONFIG_ITEM, sal_True );
+ rtl::OUString sValue;
+ if (bValue)
+ sValue = GetXMLToken(XML_TRUE);
+ else
+ sValue = GetXMLToken(XML_FALSE);
+ m_rContext.Characters( sValue );
+ m_rContext.EndElement( sal_False );
+}
+
+void XMLSettingsExportHelper::exportByte(const sal_Int8 nValue, const rtl::OUString& rName) const
+{
+#if 0
+ DBG_ASSERT(rName.getLength(), "no name");
+ m_rContext.AddAttribute( XML_NAME, rName );
+ m_rContext.AddAttribute( XML_TYPE, XML_BYTE );
+ m_rContext.StartElement( XML_CONFIG_ITEM, sal_True );
+ rtl::OUStringBuffer sBuffer;
+ SvXMLUnitConverter::convertNumber(sBuffer, sal_Int32(nValue));
+ m_rContext.Characters( sBuffer.makeStringAndClear() );
+ m_rContext.EndElement( sal_False );
+#else
+ (void) nValue; (void) rName;
+ OSL_ENSURE(false, "XMLSettingsExportHelper::exportByte(): #i114162#:\n"
+ "config-items of type \"byte\" are not valid ODF, "
+ "so storing them is disabled!\n"
+ "Use a different type instead (e.g. \"short\").");
+#endif
+}
+void XMLSettingsExportHelper::exportShort(const sal_Int16 nValue, const rtl::OUString& rName) const
+{
+ DBG_ASSERT(rName.getLength(), "no name");
+ m_rContext.AddAttribute( XML_NAME, rName );
+ m_rContext.AddAttribute( XML_TYPE, XML_SHORT );
+ m_rContext.StartElement( XML_CONFIG_ITEM, sal_True );
+ rtl::OUStringBuffer sBuffer;
+ SvXMLUnitConverter::convertNumber(sBuffer, sal_Int32(nValue));
+ m_rContext.Characters( sBuffer.makeStringAndClear() );
+ m_rContext.EndElement( sal_False );
+}
+
+void XMLSettingsExportHelper::exportInt(const sal_Int32 nValue, const rtl::OUString& rName) const
+{
+ DBG_ASSERT(rName.getLength(), "no name");
+ m_rContext.AddAttribute( XML_NAME, rName );
+ m_rContext.AddAttribute( XML_TYPE, XML_INT );
+ m_rContext.StartElement( XML_CONFIG_ITEM, sal_True );
+ rtl::OUStringBuffer sBuffer;
+ SvXMLUnitConverter::convertNumber(sBuffer, nValue);
+ m_rContext.Characters( sBuffer.makeStringAndClear() );
+ m_rContext.EndElement( sal_False );
+}
+
+void XMLSettingsExportHelper::exportLong(const sal_Int64 nValue, const rtl::OUString& rName) const
+{
+ DBG_ASSERT(rName.getLength(), "no name");
+ m_rContext.AddAttribute( XML_NAME, rName );
+ m_rContext.AddAttribute( XML_TYPE, XML_LONG );
+ m_rContext.StartElement( XML_CONFIG_ITEM, sal_True );
+ rtl::OUString sValue(rtl::OUString::valueOf(nValue));
+ m_rContext.Characters( sValue );
+ m_rContext.EndElement( sal_False );
+}
+
+void XMLSettingsExportHelper::exportDouble(const double fValue, const rtl::OUString& rName) const
+{
+ DBG_ASSERT(rName.getLength(), "no name");
+ m_rContext.AddAttribute( XML_NAME, rName );
+ m_rContext.AddAttribute( XML_TYPE, XML_DOUBLE );
+ m_rContext.StartElement( XML_CONFIG_ITEM, sal_True );
+ rtl::OUStringBuffer sBuffer;
+ SvXMLUnitConverter::convertDouble(sBuffer, fValue);
+ m_rContext.Characters( sBuffer.makeStringAndClear() );
+ m_rContext.EndElement( sal_False );
+}
+
+void XMLSettingsExportHelper::exportString(const rtl::OUString& sValue, const rtl::OUString& rName) const
+{
+ DBG_ASSERT(rName.getLength(), "no name");
+ m_rContext.AddAttribute( XML_NAME, rName );
+ m_rContext.AddAttribute( XML_TYPE, XML_STRING );
+ m_rContext.StartElement( XML_CONFIG_ITEM, sal_True );
+ if (sValue.getLength())
+ m_rContext.Characters( sValue );
+ m_rContext.EndElement( sal_False );
+}
+
+void XMLSettingsExportHelper::exportDateTime(const util::DateTime& aValue, const rtl::OUString& rName) const
+{
+ DBG_ASSERT(rName.getLength(), "no name");
+ m_rContext.AddAttribute( XML_NAME, rName );
+ m_rContext.AddAttribute( XML_TYPE, XML_DATETIME );
+ rtl::OUStringBuffer sBuffer;
+ SvXMLUnitConverter::convertDateTime(sBuffer, aValue);
+ m_rContext.StartElement( XML_CONFIG_ITEM, sal_True );
+ m_rContext.Characters( sBuffer.makeStringAndClear() );
+ m_rContext.EndElement( sal_False );
+}
+
+void XMLSettingsExportHelper::exportSequencePropertyValue(
+ const uno::Sequence<beans::PropertyValue>& aProps,
+ const rtl::OUString& rName) const
+{
+ DBG_ASSERT(rName.getLength(), "no name");
+ sal_Int32 nLength(aProps.getLength());
+ if(nLength)
+ {
+ m_rContext.AddAttribute( XML_NAME, rName );
+ m_rContext.StartElement( XML_CONFIG_ITEM_SET, sal_True );
+ for (sal_Int32 i = 0; i < nLength; i++)
+ CallTypeFunction(aProps[i].Value, aProps[i].Name);
+ m_rContext.EndElement( sal_True );
+ }
+}
+void XMLSettingsExportHelper::exportSymbolDescriptors(
+ const uno::Sequence < formula::SymbolDescriptor > &rProps,
+ const rtl::OUString rName) const
+{
+ // #110680#
+ uno::Reference< lang::XMultiServiceFactory > xServiceFactory( m_rContext.GetServiceFactory() );
+ DBG_ASSERT( xServiceFactory.is(), "XMLSettingsExportHelper::exportSymbolDescriptors: got no service manager" );
+
+ if( xServiceFactory.is() )
+ {
+ uno::Reference< container::XIndexContainer > xBox(xServiceFactory->createInstance(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.document.IndexedPropertyValues") ) ), uno::UNO_QUERY);
+ DBG_ASSERT( xBox.is(), "could not create service com.sun.star.document.IndexedPropertyValues" );
+ if (xBox.is() )
+ {
+ const rtl::OUString sName ( RTL_CONSTASCII_USTRINGPARAM ( "Name" ) );
+ const rtl::OUString sExportName ( RTL_CONSTASCII_USTRINGPARAM ( "ExportName" ) );
+ const rtl::OUString sSymbolSet ( RTL_CONSTASCII_USTRINGPARAM ( "SymbolSet" ) );
+ const rtl::OUString sCharacter ( RTL_CONSTASCII_USTRINGPARAM ( "Character" ) );
+ const rtl::OUString sFontName ( RTL_CONSTASCII_USTRINGPARAM ( "FontName" ) );
+ const rtl::OUString sCharSet ( RTL_CONSTASCII_USTRINGPARAM ( "CharSet" ) );
+ const rtl::OUString sFamily ( RTL_CONSTASCII_USTRINGPARAM ( "Family" ) );
+ const rtl::OUString sPitch ( RTL_CONSTASCII_USTRINGPARAM ( "Pitch" ) );
+ const rtl::OUString sWeight ( RTL_CONSTASCII_USTRINGPARAM ( "Weight" ) );
+ const rtl::OUString sItalic ( RTL_CONSTASCII_USTRINGPARAM ( "Italic" ) );
+
+ sal_Int32 nCount = rProps.getLength();
+ const formula::SymbolDescriptor *pDescriptor = rProps.getConstArray();
+
+ for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++, pDescriptor++ )
+ {
+ uno::Sequence < beans::PropertyValue > aSequence ( XML_SYMBOL_DESCRIPTOR_MAX );
+ beans::PropertyValue *pSymbol = aSequence.getArray();
+
+ pSymbol[XML_SYMBOL_DESCRIPTOR_NAME].Name = sName;
+ pSymbol[XML_SYMBOL_DESCRIPTOR_NAME].Value <<= pDescriptor->sName;
+ pSymbol[XML_SYMBOL_DESCRIPTOR_EXPORT_NAME].Name = sExportName;
+ pSymbol[XML_SYMBOL_DESCRIPTOR_EXPORT_NAME].Value<<= pDescriptor->sExportName;
+ pSymbol[XML_SYMBOL_DESCRIPTOR_FONT_NAME].Name = sFontName;
+ pSymbol[XML_SYMBOL_DESCRIPTOR_FONT_NAME].Value <<= pDescriptor->sFontName;
+ pSymbol[XML_SYMBOL_DESCRIPTOR_CHAR_SET].Name = sCharSet;
+ pSymbol[XML_SYMBOL_DESCRIPTOR_CHAR_SET].Value <<= pDescriptor->nCharSet;
+ pSymbol[XML_SYMBOL_DESCRIPTOR_FAMILY].Name = sFamily;
+ pSymbol[XML_SYMBOL_DESCRIPTOR_FAMILY].Value <<= pDescriptor->nFamily;
+ pSymbol[XML_SYMBOL_DESCRIPTOR_PITCH].Name = sPitch;
+ pSymbol[XML_SYMBOL_DESCRIPTOR_PITCH].Value <<= pDescriptor->nPitch;
+ pSymbol[XML_SYMBOL_DESCRIPTOR_WEIGHT].Name = sWeight;
+ pSymbol[XML_SYMBOL_DESCRIPTOR_WEIGHT].Value <<= pDescriptor->nWeight;
+ pSymbol[XML_SYMBOL_DESCRIPTOR_ITALIC].Name = sItalic;
+ pSymbol[XML_SYMBOL_DESCRIPTOR_ITALIC].Value <<= pDescriptor->nItalic;
+ pSymbol[XML_SYMBOL_DESCRIPTOR_SYMBOL_SET].Name = sSymbolSet;
+ pSymbol[XML_SYMBOL_DESCRIPTOR_SYMBOL_SET].Value <<= pDescriptor->sSymbolSet;
+ pSymbol[XML_SYMBOL_DESCRIPTOR_CHARACTER].Name = sCharacter;
+ pSymbol[XML_SYMBOL_DESCRIPTOR_CHARACTER].Value <<= pDescriptor->nCharacter;
+
+ xBox->insertByIndex(nIndex, uno::makeAny( aSequence ));
+ }
+
+ uno::Reference< container::XIndexAccess > xIA( xBox, uno::UNO_QUERY );
+ exportIndexAccess( xIA, rName );
+ }
+ }
+}
+void XMLSettingsExportHelper::exportbase64Binary(
+ const uno::Sequence<sal_Int8>& aProps,
+ const rtl::OUString& rName) const
+{
+ DBG_ASSERT(rName.getLength(), "no name");
+ sal_Int32 nLength(aProps.getLength());
+ m_rContext.AddAttribute( XML_NAME, rName );
+ m_rContext.AddAttribute( XML_TYPE, XML_BASE64BINARY );
+ m_rContext.StartElement( XML_CONFIG_ITEM, sal_True );
+ if(nLength)
+ {
+ rtl::OUStringBuffer sBuffer;
+ SvXMLUnitConverter::encodeBase64(sBuffer, aProps);
+ m_rContext.Characters( sBuffer.makeStringAndClear() );
+ }
+ m_rContext.EndElement( sal_False );
+}
+
+void XMLSettingsExportHelper::exportMapEntry(const uno::Any& rAny,
+ const rtl::OUString& rName,
+ const sal_Bool bNameAccess) const
+{
+ DBG_ASSERT((bNameAccess && rName.getLength()) || !bNameAccess, "no name");
+ uno::Sequence<beans::PropertyValue> aProps;
+ rAny >>= aProps;
+ sal_Int32 nLength = aProps.getLength();
+ if (nLength)
+ {
+ if (bNameAccess)
+ m_rContext.AddAttribute( XML_NAME, rName );
+ m_rContext.StartElement( XML_CONFIG_ITEM_MAP_ENTRY, sal_True );
+ for (sal_Int32 i = 0; i < nLength; i++)
+ CallTypeFunction(aProps[i].Value, aProps[i].Name);
+ m_rContext.EndElement( sal_True );
+ }
+}
+
+void XMLSettingsExportHelper::exportNameAccess(
+ const uno::Reference<container::XNameAccess>& aNamed,
+ const rtl::OUString& rName) const
+{
+ DBG_ASSERT(rName.getLength(), "no name");
+ DBG_ASSERT(aNamed->getElementType().equals(getCppuType( (uno::Sequence<beans::PropertyValue> *)0 ) ),
+ "wrong NameAccess" );
+ if(aNamed->hasElements())
+ {
+ m_rContext.AddAttribute( XML_NAME, rName );
+ m_rContext.StartElement( XML_CONFIG_ITEM_MAP_NAMED, sal_True );
+ uno::Sequence< rtl::OUString > aNames(aNamed->getElementNames());
+ for (sal_Int32 i = 0; i < aNames.getLength(); i++)
+ exportMapEntry(aNamed->getByName(aNames[i]), aNames[i], sal_True);
+ m_rContext.EndElement( sal_True );
+ }
+}
+
+void XMLSettingsExportHelper::exportIndexAccess(
+ const uno::Reference<container::XIndexAccess> aIndexed,
+ const rtl::OUString rName) const
+{
+ DBG_ASSERT(rName.getLength(), "no name");
+ DBG_ASSERT(aIndexed->getElementType().equals(getCppuType( (uno::Sequence<beans::PropertyValue> *)0 ) ),
+ "wrong IndexAccess" );
+ rtl::OUString sEmpty;
+ if(aIndexed->hasElements())
+ {
+ m_rContext.AddAttribute( XML_NAME, rName );
+ m_rContext.StartElement( XML_CONFIG_ITEM_MAP_INDEXED, sal_True );
+ sal_Int32 nCount = aIndexed->getCount();
+ for (sal_Int32 i = 0; i < nCount; i++)
+ {
+ exportMapEntry(aIndexed->getByIndex(i), sEmpty, sal_False);
+ }
+ m_rContext.EndElement( sal_True );
+ }
+}
+
+void XMLSettingsExportHelper::exportForbiddenCharacters(
+ const uno::Any &rAny,
+ const rtl::OUString rName) const
+{
+ uno::Reference<i18n::XForbiddenCharacters> xForbChars;
+ uno::Reference<linguistic2::XSupportedLocales> xLocales;
+
+ rAny >>= xForbChars;
+ rAny >>= xLocales;
+
+ DBG_ASSERT( xForbChars.is() && xLocales.is(),"XMLSettingsExportHelper::exportForbiddenCharacters: got illegal forbidden characters!" );
+
+ if( !xForbChars.is() || !xLocales.is() )
+ return;
+
+ // #110680#
+ uno::Reference< lang::XMultiServiceFactory > xServiceFactory( m_rContext.GetServiceFactory() );
+ DBG_ASSERT( xServiceFactory.is(), "XMLSettingsExportHelper::exportForbiddenCharacters: got no service manager" );
+
+ if( xServiceFactory.is() )
+ {
+ uno::Reference< container::XIndexContainer > xBox(xServiceFactory->createInstance(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.document.IndexedPropertyValues") ) ), uno::UNO_QUERY);
+ DBG_ASSERT( xBox.is(), "could not create service com.sun.star.document.IndexedPropertyValues" );
+ if (xBox.is() )
+ {
+ const uno::Sequence< lang::Locale > aLocales( xLocales->getLocales() );
+ const lang::Locale* pLocales = aLocales.getConstArray();
+
+ const sal_Int32 nCount = aLocales.getLength();
+
+ const rtl::OUString sLanguage ( RTL_CONSTASCII_USTRINGPARAM ( "Language" ) );
+ const rtl::OUString sCountry ( RTL_CONSTASCII_USTRINGPARAM ( "Country" ) );
+ const rtl::OUString sVariant ( RTL_CONSTASCII_USTRINGPARAM ( "Variant" ) );
+ const rtl::OUString sBeginLine ( RTL_CONSTASCII_USTRINGPARAM ( "BeginLine" ) );
+ const rtl::OUString sEndLine ( RTL_CONSTASCII_USTRINGPARAM ( "EndLine" ) );
+
+ sal_Int32 nPos = 0;
+ for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++, pLocales++ )
+ {
+ if( xForbChars->hasForbiddenCharacters( *pLocales ) )
+ {
+ const i18n::ForbiddenCharacters aChars( xForbChars->getForbiddenCharacters( *pLocales ) );
+
+
+ uno::Sequence < beans::PropertyValue > aSequence ( XML_FORBIDDEN_CHARACTER_MAX );
+ beans::PropertyValue *pForChar = aSequence.getArray();
+
+ pForChar[XML_FORBIDDEN_CHARACTER_LANGUAGE].Name = sLanguage;
+ pForChar[XML_FORBIDDEN_CHARACTER_LANGUAGE].Value <<= pLocales->Language;
+ pForChar[XML_FORBIDDEN_CHARACTER_COUNTRY].Name = sCountry;
+ pForChar[XML_FORBIDDEN_CHARACTER_COUNTRY].Value <<= pLocales->Country;
+ pForChar[XML_FORBIDDEN_CHARACTER_VARIANT].Name = sVariant;
+ pForChar[XML_FORBIDDEN_CHARACTER_VARIANT].Value <<= pLocales->Variant;
+ pForChar[XML_FORBIDDEN_CHARACTER_BEGIN_LINE].Name = sBeginLine;
+ pForChar[XML_FORBIDDEN_CHARACTER_BEGIN_LINE].Value <<= aChars.beginLine;
+ pForChar[XML_FORBIDDEN_CHARACTER_END_LINE].Name = sEndLine;
+ pForChar[XML_FORBIDDEN_CHARACTER_END_LINE].Value <<= aChars.endLine;
+ xBox->insertByIndex(nPos++, uno::makeAny( aSequence ));
+ }
+ }
+
+ uno::Reference< container::XIndexAccess > xIA( xBox, uno::UNO_QUERY );
+ exportIndexAccess( xIA, rName );
+ }
+ }
+}
+
+void XMLSettingsExportHelper::exportAllSettings(
+ const uno::Sequence<beans::PropertyValue>& aProps,
+ const rtl::OUString& rName) const
+{
+ DBG_ASSERT(rName.getLength(), "no name");
+ exportSequencePropertyValue(aProps, rName);
+}
+
+
+/** For some settings we may want to change their API representation
+ * from their XML settings representation. This is your chance to do
+ * so!
+ */
+void XMLSettingsExportHelper::ManipulateSetting( uno::Any& rAny, const rtl::OUString& rName ) const
+{
+ if( rName == msPrinterIndependentLayout )
+ {
+ sal_Int16 nTmp = sal_Int16();
+ if( rAny >>= nTmp )
+ {
+ if( nTmp == document::PrinterIndependentLayout::LOW_RESOLUTION )
+ rAny <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("low-resolution"));
+ else if( nTmp == document::PrinterIndependentLayout::DISABLED )
+ rAny <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("disabled"));
+ else if( nTmp == document::PrinterIndependentLayout::HIGH_RESOLUTION )
+ rAny <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("high-resolution"));
+ }
+ }
+ else if( (rName == msColorTableURL) || (rName == msLineEndTableURL) || (rName == msHatchTableURL) ||
+ (rName == msDashTableURL) || (rName == msGradientTableURL) || (rName == msBitmapTableURL ) )
+ {
+ if( !mxStringSubsitution.is() )
+ {
+ if( m_rContext.GetServiceFactory().is() ) try
+ {
+ const_cast< XMLSettingsExportHelper* >(this)->mxStringSubsitution =
+ uno::Reference< util::XStringSubstitution >::query(
+ m_rContext.GetServiceFactory()->
+ createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.PathSubstitution" ) ) ) );
+ }
+ catch( uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ if( mxStringSubsitution.is() )
+ {
+ ::rtl::OUString aURL;
+ rAny >>= aURL;
+ aURL = mxStringSubsitution->reSubstituteVariables( aURL );
+ rAny <<= aURL;
+ }
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/core/XMLBase64Export.cxx b/xmloff/source/core/XMLBase64Export.cxx
new file mode 100644
index 000000000000..cca38edbe776
--- /dev/null
+++ b/xmloff/source/core/XMLBase64Export.cxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmlexp.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include "XMLBase64Export.hxx"
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::io;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+#define INPUT_BUFFER_SIZE 54
+#define OUTPUT_BUFFER_SIZE 72
+
+XMLBase64Export::XMLBase64Export( SvXMLExport& rExp ) :
+ rExport( rExp ){
+}
+
+sal_Bool XMLBase64Export::exportXML( const Reference < XInputStream> & rIn )
+{
+ sal_Bool bRet = sal_True;
+ try
+ {
+ Sequence < sal_Int8 > aInBuff( INPUT_BUFFER_SIZE );
+ OUStringBuffer aOutBuff( OUTPUT_BUFFER_SIZE );
+ sal_Int32 nRead;
+ do
+ {
+ nRead = rIn->readBytes( aInBuff, INPUT_BUFFER_SIZE );
+ if( nRead > 0 )
+ {
+ GetExport().GetMM100UnitConverter().encodeBase64( aOutBuff,
+ aInBuff );
+ GetExport().Characters( aOutBuff.makeStringAndClear() );
+ if( nRead == INPUT_BUFFER_SIZE )
+ GetExport().IgnorableWhitespace();
+ }
+ }
+ while( nRead == INPUT_BUFFER_SIZE );
+ }
+ catch( ... )
+ {
+ bRet = sal_False;
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLBase64Export::exportElement(
+ const Reference < XInputStream > & rIn,
+ sal_uInt16 nNamespace,
+ enum ::xmloff::token::XMLTokenEnum eName )
+{
+ SvXMLElementExport aElem( GetExport(), nNamespace, eName, sal_True,
+ sal_True );
+ return exportXML( rIn );
+}
+
+sal_Bool XMLBase64Export::exportOfficeBinaryDataElement(
+ const Reference < XInputStream > & rIn )
+{
+ return exportElement( rIn, XML_NAMESPACE_OFFICE,
+ ::xmloff::token::XML_BINARY_DATA );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/core/XMLBase64ImportContext.cxx b/xmloff/source/core/XMLBase64ImportContext.cxx
new file mode 100644
index 000000000000..cdbbe4eaa50d
--- /dev/null
+++ b/xmloff/source/core/XMLBase64ImportContext.cxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <xmloff/XMLBase64ImportContext.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::io;
+
+//-----------------------------------------------------------------------------
+
+TYPEINIT1( XMLBase64ImportContext, SvXMLImportContext );
+
+
+XMLBase64ImportContext::XMLBase64ImportContext(
+ SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName,
+ const Reference< XAttributeList >&,
+ const Reference< XOutputStream >& rOut ) :
+ SvXMLImportContext( rImport, nPrfx, rLName ),
+ xOut( rOut )
+{
+}
+
+XMLBase64ImportContext::~XMLBase64ImportContext()
+{
+}
+
+
+void XMLBase64ImportContext::EndElement()
+{
+ xOut->closeOutput();
+}
+
+void XMLBase64ImportContext::Characters( const ::rtl::OUString& rChars )
+{
+ OUString sTrimmedChars( rChars. trim() );
+ if( sTrimmedChars.getLength() )
+ {
+ OUString sChars;
+ if( sBase64CharsLeft.getLength() )
+ {
+ sChars = sBase64CharsLeft;
+ sChars += sTrimmedChars;
+ sBase64CharsLeft = OUString();
+ }
+ else
+ {
+ sChars = sTrimmedChars;
+ }
+ Sequence< sal_Int8 > aBuffer( (sChars.getLength() / 4) * 3 );
+ sal_Int32 nCharsDecoded =
+ GetImport().GetMM100UnitConverter().
+ decodeBase64SomeChars( aBuffer, sChars );
+ xOut->writeBytes( aBuffer );
+ if( nCharsDecoded != sChars.getLength() )
+ sBase64CharsLeft = sChars.copy( nCharsDecoded );
+ }
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/core/XMLBasicExportFilter.cxx b/xmloff/source/core/XMLBasicExportFilter.cxx
new file mode 100644
index 000000000000..b9d7e8c078d5
--- /dev/null
+++ b/xmloff/source/core/XMLBasicExportFilter.cxx
@@ -0,0 +1,128 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLBasicExportFilter.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+
+// =============================================================================
+// XMLBasicExportFilter
+// =============================================================================
+
+XMLBasicExportFilter::XMLBasicExportFilter( const Reference< xml::sax::XDocumentHandler >& rxHandler )
+ :m_xHandler( rxHandler )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+XMLBasicExportFilter::~XMLBasicExportFilter()
+{
+}
+
+// -----------------------------------------------------------------------------
+// XDocumentHandler
+// -----------------------------------------------------------------------------
+
+void XMLBasicExportFilter::startDocument()
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ // do nothing, filter this
+}
+
+// -----------------------------------------------------------------------------
+
+void XMLBasicExportFilter::endDocument()
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ // do nothing, filter this
+}
+
+// -----------------------------------------------------------------------------
+
+void XMLBasicExportFilter::startElement( const ::rtl::OUString& aName,
+ const Reference< xml::sax::XAttributeList >& xAttribs )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ if ( m_xHandler.is() )
+ m_xHandler->startElement( aName, xAttribs );
+}
+
+// -----------------------------------------------------------------------------
+
+void XMLBasicExportFilter::endElement( const ::rtl::OUString& aName )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ if ( m_xHandler.is() )
+ m_xHandler->endElement( aName );
+}
+
+// -----------------------------------------------------------------------------
+
+void XMLBasicExportFilter::characters( const ::rtl::OUString& aChars )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ if ( m_xHandler.is() )
+ m_xHandler->characters( aChars );
+}
+
+// -----------------------------------------------------------------------------
+
+void XMLBasicExportFilter::ignorableWhitespace( const ::rtl::OUString& aWhitespaces )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ if ( m_xHandler.is() )
+ m_xHandler->ignorableWhitespace( aWhitespaces );
+}
+
+// -----------------------------------------------------------------------------
+
+void XMLBasicExportFilter::processingInstruction( const ::rtl::OUString& aTarget,
+ const ::rtl::OUString& aData )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ if ( m_xHandler.is() )
+ m_xHandler->processingInstruction( aTarget, aData );
+}
+
+// -----------------------------------------------------------------------------
+
+void XMLBasicExportFilter::setDocumentLocator( const Reference< xml::sax::XLocator >& xLocator )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ if ( m_xHandler.is() )
+ m_xHandler->setDocumentLocator( xLocator );
+}
+
+// -----------------------------------------------------------------------------
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/core/XMLEmbeddedObjectExportFilter.cxx b/xmloff/source/core/XMLEmbeddedObjectExportFilter.cxx
new file mode 100644
index 000000000000..088eae39807b
--- /dev/null
+++ b/xmloff/source/core/XMLEmbeddedObjectExportFilter.cxx
@@ -0,0 +1,185 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "xmloff/XMLEmbeddedObjectExportFilter.hxx"
+
+using ::rtl::OUString;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+
+
+XMLEmbeddedObjectExportFilter::XMLEmbeddedObjectExportFilter() throw()
+{
+}
+
+XMLEmbeddedObjectExportFilter::XMLEmbeddedObjectExportFilter(
+ const Reference< XDocumentHandler > & rHandler ) throw() :
+ xHandler( rHandler ),
+ xExtHandler( rHandler, UNO_QUERY )
+{
+}
+
+XMLEmbeddedObjectExportFilter::~XMLEmbeddedObjectExportFilter () throw()
+{
+}
+
+
+void SAL_CALL XMLEmbeddedObjectExportFilter::startDocument( void )
+ throw( SAXException, RuntimeException )
+{
+ // do nothing, filter this
+}
+
+void SAL_CALL XMLEmbeddedObjectExportFilter::endDocument( void )
+ throw( SAXException, RuntimeException)
+{
+ // do nothing, filter this
+}
+
+void SAL_CALL XMLEmbeddedObjectExportFilter::startElement(
+ const OUString& rName,
+ const Reference< XAttributeList >& xAttrList )
+ throw(SAXException, RuntimeException)
+{
+ xHandler->startElement( rName, xAttrList );
+}
+
+void SAL_CALL XMLEmbeddedObjectExportFilter::endElement( const OUString& rName )
+ throw(SAXException, RuntimeException)
+{
+ xHandler->endElement( rName );
+}
+
+void SAL_CALL XMLEmbeddedObjectExportFilter::characters( const OUString& rChars )
+ throw(SAXException, RuntimeException)
+{
+ xHandler->characters( rChars );
+}
+
+void SAL_CALL XMLEmbeddedObjectExportFilter::ignorableWhitespace(
+ const OUString& rWhitespaces )
+ throw(SAXException, RuntimeException)
+{
+ xHandler->ignorableWhitespace( rWhitespaces );
+}
+
+void SAL_CALL XMLEmbeddedObjectExportFilter::processingInstruction(
+ const OUString& rTarget,
+ const OUString& rData )
+ throw(SAXException, RuntimeException)
+{
+ xHandler->processingInstruction( rTarget, rData );
+}
+
+void SAL_CALL XMLEmbeddedObjectExportFilter::setDocumentLocator(
+ const Reference< XLocator >& rLocator )
+ throw(SAXException, RuntimeException)
+{
+ xHandler->setDocumentLocator( rLocator );
+}
+
+// XExtendedDocumentHandler
+void SAL_CALL XMLEmbeddedObjectExportFilter::startCDATA( void )
+ throw(SAXException, RuntimeException)
+{
+ if( xExtHandler.is() )
+ xExtHandler->startCDATA();
+}
+
+void SAL_CALL XMLEmbeddedObjectExportFilter::endCDATA( void )
+ throw(RuntimeException)
+{
+ if( xExtHandler.is() )
+ xExtHandler->endCDATA();
+}
+
+void SAL_CALL XMLEmbeddedObjectExportFilter::comment( const OUString& rComment )
+ throw(SAXException, RuntimeException)
+{
+ if( xExtHandler.is() )
+ xExtHandler->comment( rComment );
+}
+
+void SAL_CALL XMLEmbeddedObjectExportFilter::allowLineBreak( void )
+ throw(SAXException, RuntimeException)
+{
+ if( xExtHandler.is() )
+ xExtHandler->allowLineBreak();
+}
+
+void SAL_CALL XMLEmbeddedObjectExportFilter::unknown( const OUString& rString )
+ throw(SAXException, RuntimeException)
+{
+ if( xExtHandler.is() )
+ xExtHandler->unknown( rString );
+}
+
+// XInitialize
+void SAL_CALL XMLEmbeddedObjectExportFilter::initialize(
+ const Sequence< Any >& aArguments )
+ throw(Exception, RuntimeException)
+{
+ const sal_Int32 nAnyCount = aArguments.getLength();
+ const Any* pAny = aArguments.getConstArray();
+
+ for( sal_Int32 nIndex = 0; nIndex < nAnyCount; nIndex++, pAny++ )
+ {
+ if( pAny->getValueType() ==
+ ::getCppuType((const Reference< XDocumentHandler >*)0))
+ {
+ *pAny >>= xHandler;
+ *pAny >>= xExtHandler;
+ }
+ }
+}
+
+// XServiceInfo
+OUString SAL_CALL XMLEmbeddedObjectExportFilter::getImplementationName()
+ throw(RuntimeException)
+{
+ OUString aStr;
+ return aStr;
+}
+
+sal_Bool SAL_CALL XMLEmbeddedObjectExportFilter::supportsService( const OUString& )
+ throw(RuntimeException)
+{
+ return sal_False;
+}
+
+Sequence< OUString > SAL_CALL XMLEmbeddedObjectExportFilter::getSupportedServiceNames( )
+ throw(RuntimeException)
+{
+ Sequence< OUString > aSeq;
+ return aSeq;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx b/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx
new file mode 100644
index 000000000000..72ecefabcc5b
--- /dev/null
+++ b/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx
@@ -0,0 +1,347 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/document/XImporter.hpp>
+#include <com/sun/star/util/XModifiable.hpp>
+#include <com/sun/star/util/XModifiable2.hpp>
+#include <com/sun/star/frame/XStorable.hpp>
+#include <tools/globname.hxx>
+#include <sot/clsids.hxx>
+#include <tools/globname.hxx>
+#include <sot/clsids.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmlimp.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlerror.hxx"
+#include <xmloff/attrlist.hxx>
+#include "xmloff/XMLFilterServiceNames.h"
+#include "XMLEmbeddedObjectImportContext.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::document;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::xmloff::token;
+
+struct XMLServiceMapEntry_Impl
+{
+ enum XMLTokenEnum eClass;
+ const sal_Char *sFilterService;
+ sal_Int32 nFilterServiceLen;
+};
+
+#define SERVICE_MAP_ENTRY( cls, app ) \
+ { XML_##cls, \
+ XML_IMPORT_FILTER_##app, sizeof(XML_IMPORT_FILTER_##app)-1}
+
+const XMLServiceMapEntry_Impl aServiceMap[] =
+{
+ SERVICE_MAP_ENTRY( TEXT, WRITER ),
+ SERVICE_MAP_ENTRY( ONLINE_TEXT, WRITER ),
+ SERVICE_MAP_ENTRY( SPREADSHEET, CALC ),
+ SERVICE_MAP_ENTRY( DRAWING, DRAW ),
+ SERVICE_MAP_ENTRY( GRAPHICS, DRAW ),
+ SERVICE_MAP_ENTRY( PRESENTATION, IMPRESS ),
+ SERVICE_MAP_ENTRY( CHART, CHART ),
+ { XML_TOKEN_INVALID, 0, 0 }
+};
+
+class XMLEmbeddedObjectImportContext_Impl : public SvXMLImportContext
+{
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XDocumentHandler > xHandler;
+
+public:
+ TYPEINFO();
+
+ XMLEmbeddedObjectImportContext_Impl( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XDocumentHandler >& rHandler );
+
+ virtual ~XMLEmbeddedObjectImportContext_Impl();
+
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void EndElement();
+
+ virtual void Characters( const ::rtl::OUString& rChars );
+};
+
+TYPEINIT1( XMLEmbeddedObjectImportContext_Impl, SvXMLImportContext );
+
+XMLEmbeddedObjectImportContext_Impl::XMLEmbeddedObjectImportContext_Impl(
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const Reference< XDocumentHandler >& rHandler ) :
+ SvXMLImportContext( rImport, nPrfx, rLName ),
+ xHandler( rHandler )
+{
+}
+
+XMLEmbeddedObjectImportContext_Impl::~XMLEmbeddedObjectImportContext_Impl()
+{
+}
+
+SvXMLImportContext *XMLEmbeddedObjectImportContext_Impl::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference< XAttributeList >& )
+{
+ return new XMLEmbeddedObjectImportContext_Impl( GetImport(),
+ nPrefix, rLocalName,
+ xHandler );
+}
+
+void XMLEmbeddedObjectImportContext_Impl::StartElement(
+ const Reference< XAttributeList >& xAttrList )
+{
+ xHandler->startElement( GetImport().GetNamespaceMap().GetQNameByKey(
+ GetPrefix(), GetLocalName() ),
+ xAttrList );
+}
+
+void XMLEmbeddedObjectImportContext_Impl::EndElement()
+{
+ xHandler->endElement( GetImport().GetNamespaceMap().GetQNameByKey(
+ GetPrefix(), GetLocalName() ) );
+}
+
+void XMLEmbeddedObjectImportContext_Impl::Characters( const OUString& rChars )
+{
+ xHandler->characters( rChars );
+}
+
+//-----------------------------------------------------------------------------
+
+TYPEINIT1( XMLEmbeddedObjectImportContext, SvXMLImportContext );
+
+sal_Bool XMLEmbeddedObjectImportContext::SetComponent(
+ Reference< XComponent >& rComp )
+{
+ if( !rComp.is() || !sFilterService.getLength() )
+ return sal_False;
+
+
+ Sequence<Any> aArgs( 0 );
+
+ Reference< XMultiServiceFactory > xServiceFactory = GetImport().getServiceFactory();
+
+ xHandler = Reference < XDocumentHandler >(
+ xServiceFactory->createInstanceWithArguments( sFilterService, aArgs),
+ UNO_QUERY);
+
+ if( !xHandler.is() )
+ return sal_False;
+
+ try
+ {
+ Reference < XModifiable2 > xModifiable2( rComp, UNO_QUERY_THROW );
+ xModifiable2->disableSetModified();
+ }
+ catch( Exception& )
+ {
+ }
+
+ Reference < XImporter > xImporter( xHandler, UNO_QUERY );
+ xImporter->setTargetDocument( rComp );
+
+ xComp = rComp; // keep ref to component only if there is a handler
+
+ return sal_True;
+}
+
+XMLEmbeddedObjectImportContext::XMLEmbeddedObjectImportContext(
+ SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName,
+ const Reference< XAttributeList >& xAttrList ) :
+ SvXMLImportContext( rImport, nPrfx, rLName )
+{
+ SvGlobalName aName;
+
+ if( nPrfx == XML_NAMESPACE_MATH &&
+ IsXMLToken( rLName, XML_MATH ) )
+ {
+ sFilterService = OUString( RTL_CONSTASCII_USTRINGPARAM(XML_IMPORT_FILTER_MATH) );
+ aName = SvGlobalName(SO3_SM_CLASSID);
+ }
+ else if( nPrfx == XML_NAMESPACE_OFFICE &&
+ IsXMLToken( rLName, XML_DOCUMENT ) )
+ {
+ OUString sMime;
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName );
+ if( nPrefix == XML_NAMESPACE_OFFICE &&
+ IsXMLToken( aLocalName, XML_MIMETYPE ) )
+ {
+ sMime = xAttrList->getValueByIndex( i );
+ break;
+ }
+ }
+
+ OUString sClass;
+ static const char * aTmp[] =
+ {
+ "application/vnd.oasis.openoffice.",
+ "application/x-vnd.oasis.openoffice.",
+ "application/vnd.oasis.opendocument.",
+ "application/x-vnd.oasis.opendocument.",
+ NULL
+ };
+ for (int k=0; aTmp[k]; k++)
+ {
+ ::rtl::OUString sTmpString = ::rtl::OUString::createFromAscii(aTmp[k]);
+ if( sMime.matchAsciiL( aTmp[k], sTmpString.getLength() ) )
+ {
+ sClass = sMime.copy( sTmpString.getLength() );
+ break;
+ }
+ }
+
+ if( sClass.getLength() )
+ {
+ const XMLServiceMapEntry_Impl *pEntry = aServiceMap;
+ while( pEntry->eClass != XML_TOKEN_INVALID )
+ {
+ if( IsXMLToken( sClass, pEntry->eClass ) )
+ {
+ sFilterService = OUString( pEntry->sFilterService,
+ pEntry->nFilterServiceLen,
+ RTL_TEXTENCODING_ASCII_US );
+
+ switch( pEntry->eClass )
+ {
+ case XML_TEXT: aName = SvGlobalName(SO3_SW_CLASSID); break;
+ case XML_ONLINE_TEXT: aName = SvGlobalName(SO3_SWWEB_CLASSID); break;
+ case XML_SPREADSHEET: aName = SvGlobalName(SO3_SC_CLASSID); break;
+ case XML_DRAWING:
+ case XML_GRAPHICS:
+ case XML_IMAGE: aName = SvGlobalName(SO3_SDRAW_CLASSID); break;
+ case XML_PRESENTATION: aName = SvGlobalName(SO3_SIMPRESS_CLASSID); break;
+ case XML_CHART: aName = SvGlobalName(SO3_SCH_CLASSID); break;
+ default:
+ break;
+ }
+
+ break;
+ }
+ pEntry++;
+ }
+ }
+ }
+
+ sCLSID = aName.GetHexName();
+}
+
+XMLEmbeddedObjectImportContext::~XMLEmbeddedObjectImportContext()
+{
+}
+
+SvXMLImportContext *XMLEmbeddedObjectImportContext::CreateChildContext(
+ sal_uInt16 nPrefix, const OUString& rLocalName,
+ const Reference< XAttributeList >& )
+{
+ if( xHandler.is() )
+ return new XMLEmbeddedObjectImportContext_Impl( GetImport(),
+ nPrefix, rLocalName,
+ xHandler );
+ else
+ return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+}
+
+void XMLEmbeddedObjectImportContext::StartElement(
+ const Reference< XAttributeList >& rAttrList )
+{
+ if( xHandler.is() )
+ {
+ xHandler->startDocument();
+ // #i34042: copy namepspace declarations
+ SvXMLAttributeList *pAttrList = new SvXMLAttributeList( rAttrList );
+ Reference< XAttributeList > xAttrList( pAttrList );
+ const SvXMLNamespaceMap& rNamespaceMap = GetImport().GetNamespaceMap();
+ sal_uInt16 nPos = rNamespaceMap.GetFirstKey();
+ while( USHRT_MAX != nPos )
+ {
+ OUString aAttrName( rNamespaceMap.GetAttrNameByKey( nPos ) );
+ if( 0 == xAttrList->getValueByName( aAttrName ).getLength() )
+ {
+ pAttrList->AddAttribute( aAttrName,
+ rNamespaceMap.GetNameByKey( nPos ) );
+ }
+ nPos = rNamespaceMap.GetNextKey( nPos );
+ }
+ xHandler->startElement( GetImport().GetNamespaceMap().GetQNameByKey(
+ GetPrefix(), GetLocalName() ),
+ xAttrList );
+ }
+}
+
+void XMLEmbeddedObjectImportContext::EndElement()
+{
+ if( xHandler.is() )
+ {
+ xHandler->endElement( GetImport().GetNamespaceMap().GetQNameByKey(
+ GetPrefix(), GetLocalName() ) );
+ xHandler->endDocument();
+
+ try
+ {
+ Reference < XModifiable2 > xModifiable2( xComp, UNO_QUERY_THROW );
+ xModifiable2->enableSetModified();
+ xModifiable2->setModified( sal_True ); // trigger new replacement image generation
+ }
+ catch( Exception& )
+ {
+ }
+ }
+}
+
+void XMLEmbeddedObjectImportContext::Characters( const ::rtl::OUString& rChars )
+{
+ if( xHandler.is() )
+ xHandler->characters( rChars );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/core/attrlist.cxx b/xmloff/source/core/attrlist.cxx
new file mode 100644
index 000000000000..3da996ee5220
--- /dev/null
+++ b/xmloff/source/core/attrlist.cxx
@@ -0,0 +1,303 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <vector>
+#include <osl/mutex.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <rtl/uuid.h>
+#include <rtl/memory.h>
+
+#include <xmloff/attrlist.hxx>
+
+using ::rtl::OUString;
+
+using namespace ::osl;
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+struct SvXMLTagAttribute_Impl
+{
+ SvXMLTagAttribute_Impl(){}
+ SvXMLTagAttribute_Impl( const OUString &rName,
+ const OUString &rValue )
+ : sName(rName),
+ sValue(rValue)
+ {
+ }
+
+ SvXMLTagAttribute_Impl( const SvXMLTagAttribute_Impl& r ) :
+ sName(r.sName),
+ sValue(r.sValue)
+ {
+ }
+
+ OUString sName;
+ OUString sValue;
+};
+
+struct SvXMLAttributeList_Impl
+{
+ SvXMLAttributeList_Impl()
+ {
+ // performance improvement during adding
+ vecAttribute.reserve(20);
+ }
+
+ SvXMLAttributeList_Impl( const SvXMLAttributeList_Impl& r ) :
+ vecAttribute( r.vecAttribute )
+ {
+ }
+
+ ::std::vector<struct SvXMLTagAttribute_Impl> vecAttribute;
+ typedef ::std::vector<struct SvXMLTagAttribute_Impl>::size_type size_type;
+};
+
+
+
+sal_Int16 SAL_CALL SvXMLAttributeList::getLength(void) throw( ::com::sun::star::uno::RuntimeException )
+{
+ return sal::static_int_cast< sal_Int16 >(m_pImpl->vecAttribute.size());
+}
+
+
+SvXMLAttributeList::SvXMLAttributeList( const SvXMLAttributeList &r ) :
+ cppu::WeakImplHelper3<com::sun::star::xml::sax::XAttributeList, com::sun::star::util::XCloneable, com::sun::star::lang::XUnoTunnel>(r),
+ m_pImpl( new SvXMLAttributeList_Impl( *r.m_pImpl ) )
+{
+}
+
+SvXMLAttributeList::SvXMLAttributeList( const uno::Reference<
+ xml::sax::XAttributeList> & rAttrList )
+ : sType( GetXMLToken(XML_CDATA) )
+{
+ m_pImpl = new SvXMLAttributeList_Impl;
+
+ SvXMLAttributeList* pImpl =
+ SvXMLAttributeList::getImplementation( rAttrList );
+
+ if( pImpl )
+ *m_pImpl = *(pImpl->m_pImpl);
+ else
+ AppendAttributeList( rAttrList );
+}
+
+OUString SAL_CALL SvXMLAttributeList::getNameByIndex(sal_Int16 i) throw( ::com::sun::star::uno::RuntimeException )
+{
+ return ( static_cast< SvXMLAttributeList_Impl::size_type >( i ) < m_pImpl->vecAttribute.size() ) ? m_pImpl->vecAttribute[i].sName : OUString();
+}
+
+
+OUString SAL_CALL SvXMLAttributeList::getTypeByIndex(sal_Int16) throw( ::com::sun::star::uno::RuntimeException )
+{
+ return sType;
+}
+
+OUString SAL_CALL SvXMLAttributeList::getValueByIndex(sal_Int16 i) throw( ::com::sun::star::uno::RuntimeException )
+{
+ return ( static_cast< SvXMLAttributeList_Impl::size_type >( i ) < m_pImpl->vecAttribute.size() ) ? m_pImpl->vecAttribute[i].sValue : OUString();
+}
+
+OUString SAL_CALL SvXMLAttributeList::getTypeByName( const OUString& ) throw( ::com::sun::star::uno::RuntimeException )
+{
+ return sType;
+}
+
+OUString SAL_CALL SvXMLAttributeList::getValueByName(const OUString& sName) throw( ::com::sun::star::uno::RuntimeException )
+{
+ ::std::vector<struct SvXMLTagAttribute_Impl>::iterator ii = m_pImpl->vecAttribute.begin();
+
+ for( ; ii != m_pImpl->vecAttribute.end() ; ++ii ) {
+ if( (*ii).sName == sName ) {
+ return (*ii).sValue;
+ }
+ }
+ return OUString();
+}
+
+
+uno::Reference< ::com::sun::star::util::XCloneable > SvXMLAttributeList::createClone() throw( ::com::sun::star::uno::RuntimeException )
+{
+ uno::Reference< ::com::sun::star::util::XCloneable > r = new SvXMLAttributeList( *this );
+ return r;
+}
+
+
+SvXMLAttributeList::SvXMLAttributeList()
+ : sType( GetXMLToken(XML_CDATA) )
+{
+ m_pImpl = new SvXMLAttributeList_Impl;
+}
+
+
+
+SvXMLAttributeList::~SvXMLAttributeList()
+{
+ delete m_pImpl;
+}
+
+
+void SvXMLAttributeList::AddAttribute( const OUString &sName ,
+ const OUString &sValue )
+{
+ m_pImpl->vecAttribute.push_back( SvXMLTagAttribute_Impl( sName , sValue ) );
+}
+
+void SvXMLAttributeList::Clear()
+{
+ m_pImpl->vecAttribute.clear();
+
+ OSL_ASSERT( ! getLength() );
+}
+
+void SvXMLAttributeList::RemoveAttribute( const OUString sName )
+{
+ ::std::vector<struct SvXMLTagAttribute_Impl>::iterator ii = m_pImpl->vecAttribute.begin();
+
+ for( ; ii != m_pImpl->vecAttribute.end() ; ++ii ) {
+ if( (*ii).sName == sName ) {
+ m_pImpl->vecAttribute.erase( ii );
+ break;
+ }
+ }
+}
+
+
+void SvXMLAttributeList::SetAttributeList( const uno::Reference< ::com::sun::star::xml::sax::XAttributeList > &r )
+{
+ Clear();
+ AppendAttributeList( r );
+}
+
+void SvXMLAttributeList::AppendAttributeList( const uno::Reference< ::com::sun::star::xml::sax::XAttributeList > &r )
+{
+ OSL_ASSERT( r.is() );
+
+ sal_Int16 nMax = r->getLength();
+ SvXMLAttributeList_Impl::size_type nTotalSize =
+ m_pImpl->vecAttribute.size() + nMax;
+ m_pImpl->vecAttribute.reserve( nTotalSize );
+
+ for( sal_Int16 i = 0 ; i < nMax ; ++i ) {
+ m_pImpl->vecAttribute.push_back( SvXMLTagAttribute_Impl(
+ r->getNameByIndex( i ) ,
+ r->getValueByIndex( i )));
+ }
+
+ OSL_ASSERT( nTotalSize == (SvXMLAttributeList_Impl::size_type)getLength());
+}
+
+void SvXMLAttributeList::SetValueByIndex( sal_Int16 i,
+ const ::rtl::OUString& rValue )
+{
+ if( static_cast< SvXMLAttributeList_Impl::size_type >( i )
+ < m_pImpl->vecAttribute.size() )
+ {
+ m_pImpl->vecAttribute[i].sValue = rValue;
+ }
+}
+
+void SvXMLAttributeList::RemoveAttributeByIndex( sal_Int16 i )
+{
+ if( static_cast< SvXMLAttributeList_Impl::size_type >( i )
+ < m_pImpl->vecAttribute.size() )
+ m_pImpl->vecAttribute.erase( m_pImpl->vecAttribute.begin() + i );
+}
+
+void SvXMLAttributeList::RenameAttributeByIndex( sal_Int16 i,
+ const OUString& rNewName )
+{
+ if( static_cast< SvXMLAttributeList_Impl::size_type >( i )
+ < m_pImpl->vecAttribute.size() )
+ {
+ m_pImpl->vecAttribute[i].sName = rNewName;
+ }
+}
+
+sal_Int16 SvXMLAttributeList::GetIndexByName( const OUString& rName ) const
+{
+ ::std::vector<struct SvXMLTagAttribute_Impl>::iterator ii =
+ m_pImpl->vecAttribute.begin();
+
+ for( sal_Int16 nIndex=0; ii!=m_pImpl->vecAttribute.end(); ++ii, ++nIndex )
+ {
+ if( (*ii).sName == rName )
+ {
+ return nIndex;
+ }
+ }
+ return -1;
+}
+
+// XUnoTunnel & co
+const uno::Sequence< sal_Int8 > & SvXMLAttributeList::getUnoTunnelId() throw()
+{
+ static uno::Sequence< sal_Int8 > * pSeq = 0;
+ if( !pSeq )
+ {
+ Guard< Mutex > aGuard( Mutex::getGlobalMutex() );
+ if( !pSeq )
+ {
+ static uno::Sequence< sal_Int8 > aSeq( 16 );
+ rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
+ pSeq = &aSeq;
+ }
+ }
+ return *pSeq;
+}
+
+SvXMLAttributeList* SvXMLAttributeList::getImplementation( uno::Reference< uno::XInterface > xInt ) throw()
+{
+ uno::Reference< lang::XUnoTunnel > xUT( xInt, uno::UNO_QUERY );
+ if( xUT.is() )
+ {
+ return
+ reinterpret_cast<SvXMLAttributeList*>(
+ sal::static_int_cast<sal_IntPtr>(
+ xUT->getSomething( SvXMLAttributeList::getUnoTunnelId())));
+ }
+ else
+ return NULL;
+}
+
+// XUnoTunnel
+sal_Int64 SAL_CALL SvXMLAttributeList::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw( uno::RuntimeException )
+{
+ if( rId.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
+ }
+ return 0;
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/core/facreg.cxx b/xmloff/source/core/facreg.cxx
new file mode 100644
index 000000000000..e50ecad6710d
--- /dev/null
+++ b/xmloff/source/core/facreg.cxx
@@ -0,0 +1,286 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "sal/config.h"
+
+#include "xmloff/dllapi.h"
+
+#include <string.h>
+#include <com/sun/star/container/XSet.hpp>
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#include <osl/diagnose.h>
+#include <tools/debug.hxx>
+
+#include <cppuhelper/factory.hxx>
+#include <uno/lbnames.h>
+#include "xmloff/xmlreg.hxx"
+
+using namespace com::sun::star;
+
+using ::rtl::OUString;
+
+#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 )
+
+// impress oasis import
+SERVICE( XMLImpressImportOasis );
+SERVICE( XMLImpressStylesImportOasis );
+SERVICE( XMLImpressContentImportOasis );
+SERVICE( XMLImpressMetaImportOasis );
+SERVICE( XMLImpressSettingsImportOasis );
+
+// impress oasis export
+SERVICE( XMLImpressExportOasis );
+SERVICE( XMLImpressStylesExportOasis );
+SERVICE( XMLImpressContentExportOasis );
+SERVICE( XMLImpressMetaExportOasis );
+SERVICE( XMLImpressSettingsExportOasis );
+
+// impress OOo import
+
+// impress OOo export
+SERVICE( XMLImpressExportOOO );
+SERVICE( XMLImpressStylesExportOOO );
+SERVICE( XMLImpressContentExportOOO );
+SERVICE( XMLImpressMetaExportOOO );
+SERVICE( XMLImpressSettingsExportOOO );
+
+// draw oasis import
+SERVICE( XMLDrawImportOasis );
+SERVICE( XMLDrawStylesImportOasis );
+SERVICE( XMLDrawContentImportOasis );
+SERVICE( XMLDrawMetaImportOasis );
+SERVICE( XMLDrawSettingsImportOasis );
+
+// draw oasis export
+SERVICE( XMLDrawExportOasis );
+SERVICE( XMLDrawStylesExportOasis );
+SERVICE( XMLDrawContentExportOasis );
+SERVICE( XMLDrawMetaExportOasis );
+SERVICE( XMLDrawSettingsExportOasis );
+
+// draw OOo import
+
+// draw OOo export
+SERVICE( XMLDrawExportOOO );
+SERVICE( XMLDrawStylesExportOOO );
+SERVICE( XMLDrawContentExportOOO );
+SERVICE( XMLDrawMetaExportOOO );
+SERVICE( XMLDrawSettingsExportOOO );
+
+// impress animation import
+SERVICE( AnimationsImport );
+
+// drawing layer export
+SERVICE( XMLDrawingLayerExport );
+
+// impress xml clipboard export
+SERVICE( XMLImpressClipboardExport );
+
+// chart oasis import
+SERVICE( SchXMLImport );
+SERVICE( SchXMLImport_Meta );
+SERVICE( SchXMLImport_Styles );
+SERVICE( SchXMLImport_Content );
+
+// chart oasis export
+SERVICE( SchXMLExport_Oasis );
+SERVICE( SchXMLExport_Oasis_Meta );
+SERVICE( SchXMLExport_Oasis_Styles );
+SERVICE( SchXMLExport_Oasis_Content );
+
+// chart OOo import
+
+// chart OOo export
+SERVICE( SchXMLExport );
+SERVICE( SchXMLExport_Styles );
+SERVICE( SchXMLExport_Content );
+
+// version list import/export
+SERVICE( XMLVersionListPersistence );
+
+// meta export
+SERVICE( XMLMetaExportComponent );
+
+// meta import
+SERVICE( XMLMetaImportComponent );
+
+// meta export OOo
+SERVICE( XMLMetaExportOOO );
+
+// writer autotext event export
+SERVICE( XMLAutoTextEventExport );
+
+// writer autotext event import
+SERVICE( XMLAutoTextEventImport );
+
+// writer autotext event export OOo
+SERVICE( XMLAutoTextEventExportOOO );
+
+// writer autotext event import OOo
+SERVICE( XMLAutoTextEventImportOOO );
+
+// Oasis2OOo transformer
+SERVICE( Oasis2OOoTransformer );
+
+// OOo2Oasis transformer
+SERVICE( OOo2OasisTransformer );
+
+//
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+XMLOFF_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() );\
+ }
+
+XMLOFF_DLLPUBLIC void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
+{
+ void * pRet = 0;
+ if( pServiceManager )
+ {
+ uno::Reference< lang::XMultiServiceFactory > xMSF( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ) );
+
+ uno::Reference< lang::XSingleServiceFactory > xFactory;
+
+ const sal_Int32 nImplNameLen = strlen( pImplName );
+
+ // impress oasis import
+ SINGLEFACTORY( XMLImpressImportOasis )
+ else SINGLEFACTORY( XMLImpressStylesImportOasis )
+ else SINGLEFACTORY( XMLImpressContentImportOasis )
+ else SINGLEFACTORY( XMLImpressMetaImportOasis )
+ else SINGLEFACTORY( XMLImpressSettingsImportOasis )
+
+ // impress oasis export
+ else SINGLEFACTORY( XMLImpressExportOasis )
+ else SINGLEFACTORY( XMLImpressStylesExportOasis )
+ else SINGLEFACTORY( XMLImpressContentExportOasis )
+ else SINGLEFACTORY( XMLImpressMetaExportOasis )
+ else SINGLEFACTORY( XMLImpressSettingsExportOasis )
+
+ else SINGLEFACTORY( AnimationsImport )
+
+ // impress OOo export
+ else SINGLEFACTORY( XMLImpressExportOOO )
+ else SINGLEFACTORY( XMLImpressStylesExportOOO )
+ else SINGLEFACTORY( XMLImpressContentExportOOO )
+ else SINGLEFACTORY( XMLImpressMetaExportOOO )
+ else SINGLEFACTORY( XMLImpressSettingsExportOOO )
+
+ // draw oasis import
+ else SINGLEFACTORY( XMLDrawImportOasis )
+ else SINGLEFACTORY( XMLDrawStylesImportOasis )
+ else SINGLEFACTORY( XMLDrawContentImportOasis )
+ else SINGLEFACTORY( XMLDrawMetaImportOasis )
+ else SINGLEFACTORY( XMLDrawSettingsImportOasis )
+
+ // draw oasis export
+ else SINGLEFACTORY( XMLDrawExportOasis )
+ else SINGLEFACTORY( XMLDrawStylesExportOasis )
+ else SINGLEFACTORY( XMLDrawContentExportOasis )
+ else SINGLEFACTORY( XMLDrawMetaExportOasis )
+ else SINGLEFACTORY( XMLDrawSettingsExportOasis )
+
+ // draw OOo export
+ else SINGLEFACTORY( XMLDrawExportOOO )
+ else SINGLEFACTORY( XMLDrawStylesExportOOO )
+ else SINGLEFACTORY( XMLDrawContentExportOOO )
+ else SINGLEFACTORY( XMLDrawMetaExportOOO )
+ else SINGLEFACTORY( XMLDrawSettingsExportOOO )
+
+ // drawing layer export
+ else SINGLEFACTORY( XMLDrawingLayerExport )
+
+ // impress xml clipboard export
+ else SINGLEFACTORY( XMLImpressClipboardExport )
+
+ // chart oasis import
+ else SINGLEFACTORY( SchXMLImport )
+ else SINGLEFACTORY( SchXMLImport_Meta )
+ else SINGLEFACTORY( SchXMLImport_Styles )
+ else SINGLEFACTORY( SchXMLImport_Content )
+
+ // chart oasis export
+ else SINGLEFACTORY( SchXMLExport_Oasis )
+ else SINGLEFACTORY( SchXMLExport_Oasis_Meta )
+ else SINGLEFACTORY( SchXMLExport_Oasis_Styles )
+ else SINGLEFACTORY( SchXMLExport_Oasis_Content )
+
+ // chart OOo export
+ else SINGLEFACTORY( SchXMLExport )
+ else SINGLEFACTORY( SchXMLExport_Styles )
+ else SINGLEFACTORY( SchXMLExport_Content )
+
+ // meta import/export
+ else SINGLEFACTORY( XMLMetaExportComponent )
+ else SINGLEFACTORY( XMLMetaImportComponent )
+
+ else SINGLEFACTORY( XMLVersionListPersistence )
+
+ // meta import/export OOo
+ else SINGLEFACTORY( XMLMetaExportOOO )
+
+ // auto text import/export
+ else SINGLEFACTORY( XMLAutoTextEventExport )
+ else SINGLEFACTORY( XMLAutoTextEventImport )
+ else SINGLEFACTORY( XMLAutoTextEventExportOOO )
+
+ if( xFactory.is())
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+ }
+ return pRet;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/core/i18nmap.cxx b/xmloff/source/core/i18nmap.cxx
new file mode 100644
index 000000000000..bf615a02e645
--- /dev/null
+++ b/xmloff/source/core/i18nmap.cxx
@@ -0,0 +1,128 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <rtl/ustring.hxx>
+#include <tools/debug.hxx>
+#include <svl/svarray.hxx>
+#include "xmloff/i18nmap.hxx"
+
+using ::rtl::OUString;
+
+class SvI18NMapEntry_Impl
+{
+ sal_uInt16 nKind;
+ OUString aName;
+ OUString aNewName;
+
+public:
+
+ const OUString& GetNewName() const { return aNewName; }
+
+ SvI18NMapEntry_Impl( sal_uInt16 nKnd, const OUString& rName,
+ const OUString& rNewName ) :
+ nKind( nKnd ),
+ aName( rName ),
+ aNewName( rNewName )
+ {}
+
+ SvI18NMapEntry_Impl( sal_uInt16 nKnd, const OUString& rName ) :
+ nKind( nKnd ),
+ aName( rName )
+ {}
+
+ sal_Bool operator==( const SvI18NMapEntry_Impl& r ) const
+ {
+ return nKind == r.nKind &&
+ aName == r.aName;
+ }
+
+ sal_Bool operator<( const SvI18NMapEntry_Impl& r ) const
+ {
+ return nKind < r.nKind ||
+ ( nKind == r.nKind &&
+ aName < r.aName);
+ }
+};
+
+typedef SvI18NMapEntry_Impl *SvI18NMapEntry_ImplPtr;
+SV_DECL_PTRARR_SORT_DEL( SvI18NMap_Impl, SvI18NMapEntry_ImplPtr, 20, 5 )
+SV_IMPL_OP_PTRARR_SORT( SvI18NMap_Impl, SvI18NMapEntry_ImplPtr )
+
+// ---------------------------------------------------------------------
+
+SvI18NMapEntry_Impl *SvI18NMap::_Find( sal_uInt16 nKind,
+ const OUString& rName ) const
+{
+ SvI18NMapEntry_Impl *pRet = 0;
+ SvI18NMapEntry_Impl aTst( nKind, rName );
+
+ sal_uInt16 nPos;
+ if( pImpl->Seek_Entry( &aTst, &nPos ) )
+ {
+ pRet = (*pImpl)[nPos];
+ }
+
+ return pRet;
+}
+
+SvI18NMap::SvI18NMap() :
+ pImpl( 0 )
+{
+ pImpl = new SvI18NMap_Impl;
+}
+
+SvI18NMap::~SvI18NMap()
+{
+ delete pImpl;
+}
+
+void SvI18NMap::Add( sal_uInt16 nKind, const OUString& rName,
+ const OUString& rNewName )
+{
+ SvI18NMapEntry_Impl *pEntry = _Find( nKind, rName );
+ DBG_ASSERT( !pEntry, "SvI18NMap::Add: item registered already" );
+ if( !pEntry )
+ {
+ pEntry = new SvI18NMapEntry_Impl( nKind, rName, rNewName );
+ pImpl->Insert( pEntry );
+ }
+}
+
+const OUString& SvI18NMap::Get( sal_uInt16 nKind, const OUString& rName ) const
+{
+ SvI18NMapEntry_Impl *pEntry = _Find( nKind, rName );
+ if( pEntry )
+ return pEntry->GetNewName();
+ else
+ return rName;
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/core/nmspmap.cxx b/xmloff/source/core/nmspmap.cxx
new file mode 100644
index 000000000000..977bf46b175b
--- /dev/null
+++ b/xmloff/source/core/nmspmap.cxx
@@ -0,0 +1,594 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/nmspmap.hxx>
+
+#include "xmloff/xmlnmspe.hxx"
+
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using namespace ::xmloff::token;
+
+/* The basic idea of this class is that we have two two ways to search our
+ * data...by prefix and by key. We use an STL boost::unordered_map for fast prefix
+ * searching and an STL map for fast key searching.
+ *
+ * The references to an 'Index' refer to an earlier implementation of the
+ * name space map and remain to support code which uses these interfaces.
+ *
+ * In this implementation, key and index should always be the same number.
+ *
+ * All references to Indices are now deprecated and the corresponding
+ * 'Key' methods should be used instead
+ *
+ * Martin 13/06/01
+ */
+
+SvXMLNamespaceMap::SvXMLNamespaceMap()
+: sXMLNS( GetXMLToken ( XML_XMLNS ) )
+{
+}
+
+SvXMLNamespaceMap::SvXMLNamespaceMap( const SvXMLNamespaceMap& rMap )
+: sXMLNS( GetXMLToken ( XML_XMLNS ) )
+{
+ aNameHash = rMap.aNameHash;
+ aNameMap = rMap.aNameMap;
+}
+
+void SvXMLNamespaceMap::operator=( const SvXMLNamespaceMap& rMap )
+{
+ aNameHash = rMap.aNameHash;
+ aNameMap = rMap.aNameMap;
+}
+
+SvXMLNamespaceMap::~SvXMLNamespaceMap()
+{
+ QNameCache::iterator aIter = aQNameCache.begin(), aEnd = aQNameCache.end();
+ while ( aIter != aEnd )
+ {
+ const OUString *pString = (*aIter).first.second;
+ ++aIter;
+ delete pString;
+ }
+}
+
+int SvXMLNamespaceMap::operator ==( const SvXMLNamespaceMap& rCmp ) const
+{
+ return static_cast < int > (aNameHash == rCmp.aNameHash);
+}
+
+sal_uInt16 SvXMLNamespaceMap::_Add( const OUString& rPrefix, const OUString &rName, sal_uInt16 nKey )
+{
+ if( XML_NAMESPACE_UNKNOWN == nKey )
+ {
+ // create a new unique key with UNKNOWN flag set
+ nKey = XML_NAMESPACE_UNKNOWN_FLAG;
+ do
+ {
+ NameSpaceMap::const_iterator aIter = aNameMap.find ( nKey );
+ if( aIter == aNameMap.end() )
+ break;
+ nKey++;
+ }
+ while ( sal_True );
+ }
+ ::rtl::Reference<NameSpaceEntry> pEntry(new NameSpaceEntry);
+ pEntry->sName = rName;
+ pEntry->nKey = nKey;
+ pEntry->sPrefix = rPrefix;
+ aNameHash[ rPrefix ] = pEntry;
+ aNameMap [ nKey ] = pEntry;
+ return nKey;
+}
+
+sal_uInt16 SvXMLNamespaceMap::Add( const OUString& rPrefix, const OUString& rName,
+ sal_uInt16 nKey )
+{
+ if( XML_NAMESPACE_UNKNOWN == nKey )
+ nKey = GetKeyByName( rName );
+
+ DBG_ASSERT( XML_NAMESPACE_NONE != nKey,
+ "SvXMLNamespaceMap::Add: invalid namespace key" );
+
+ if( XML_NAMESPACE_NONE == nKey )
+ return USHRT_MAX;
+
+ if ( aNameHash.find ( rPrefix ) == aNameHash.end() )
+ nKey = _Add( rPrefix, rName, nKey );
+
+ return nKey;
+}
+
+sal_uInt16 SvXMLNamespaceMap::AddIfKnown( const OUString& rPrefix, const OUString& rName )
+{
+ sal_uInt16 nKey = GetKeyByName( rName );
+
+ DBG_ASSERT( XML_NAMESPACE_NONE != nKey,
+ "SvXMLNamespaceMap::AddIfKnown: invalid namespace key" );
+
+ if( XML_NAMESPACE_NONE == nKey )
+ return XML_NAMESPACE_UNKNOWN;
+
+ if( XML_NAMESPACE_UNKNOWN != nKey )
+ {
+ NameSpaceHash::const_iterator aIter = aNameHash.find( rPrefix );
+ if( aIter == aNameHash.end() || (*aIter).second->sName != rName )
+ nKey = _Add( rPrefix, rName, nKey );
+ }
+
+ return nKey;
+}
+
+
+sal_uInt16 SvXMLNamespaceMap::GetKeyByPrefix( const OUString& rPrefix ) const
+{
+ NameSpaceHash::const_iterator aIter = aNameHash.find(rPrefix);
+ return (aIter != aNameHash.end()) ? (*aIter).second->nKey : USHRT_MAX;
+}
+
+sal_uInt16 SvXMLNamespaceMap::GetKeyByName( const OUString& rName ) const
+{
+ sal_uInt16 nKey = XML_NAMESPACE_UNKNOWN;
+ NameSpaceHash::const_iterator aIter = aNameHash.begin(), aEnd = aNameHash.end();
+ while (aIter != aEnd )
+ {
+ if ((*aIter).second->sName == rName)
+ {
+ nKey = (*aIter).second->nKey;
+ break;
+ }
+ ++aIter;
+ }
+ return nKey;
+}
+
+const OUString& SvXMLNamespaceMap::GetPrefixByKey( sal_uInt16 nKey ) const
+{
+ NameSpaceMap::const_iterator aIter = aNameMap.find (nKey);
+ return (aIter != aNameMap.end()) ? (*aIter).second->sPrefix : sEmpty;
+}
+
+const OUString& SvXMLNamespaceMap::GetNameByKey( sal_uInt16 nKey ) const
+{
+ NameSpaceMap::const_iterator aIter = aNameMap.find (nKey);
+ return (aIter != aNameMap.end()) ? (*aIter).second->sName : sEmpty;
+}
+
+OUString SvXMLNamespaceMap::GetAttrNameByKey( sal_uInt16 nKey ) const
+{
+ OUStringBuffer sAttrName;
+ NameSpaceMap::const_iterator aIter = aNameMap.find ( nKey );
+ if (aIter != aNameMap.end())
+ {
+ sAttrName.append( sXMLNS );
+ const ::rtl::OUString & prefix( (*aIter).second->sPrefix );
+ if (prefix.getLength()) // not default namespace
+ {
+ sAttrName.append( sal_Unicode(':') );
+ sAttrName.append( prefix );
+ }
+ }
+ return sAttrName.makeStringAndClear();
+}
+
+OUString SvXMLNamespaceMap::GetQNameByKey( sal_uInt16 nKey,
+ const OUString& rLocalName,
+ sal_Bool bCache) const
+{
+ // We always want to return at least the rLocalName...
+
+ switch ( nKey )
+ {
+ case XML_NAMESPACE_UNKNOWN:
+ // ...if it's a completely unknown namespace, assert and return the local name
+ DBG_ASSERT( sal_False, "SvXMLNamespaceMap::GetQNameByKey: invalid namespace key" );
+ case XML_NAMESPACE_NONE:
+ // ...if there isn't one, return the local name
+ return rLocalName;
+ case XML_NAMESPACE_XMLNS:
+ {
+ // ...if it's in the xmlns namespace, make the prefix
+ // don't bother caching this, it rarely happens
+ OUStringBuffer sQName;
+ sQName.append ( sXMLNS );
+ if (rLocalName.getLength()) // not default namespace
+ {
+ sQName.append ( sal_Unicode(':') );
+ sQName.append ( rLocalName );
+ }
+ return sQName.makeStringAndClear();;
+ }
+ case XML_NAMESPACE_XML:
+ {
+ // this namespace is reserved, and needs not to be declared
+ OUStringBuffer sQName;
+ sQName.append ( GetXMLToken(XML_XML) );
+ sQName.append ( sal_Unicode(':') );
+ sQName.append ( rLocalName );
+ return sQName.makeStringAndClear();;
+ }
+ default:
+ {
+ QNameCache::const_iterator aQCacheIter;
+ if (bCache)
+ aQCacheIter = aQNameCache.find ( QNamePair ( nKey, &rLocalName ) );
+ else
+ aQCacheIter = aQNameCache.end();
+ if ( aQCacheIter != aQNameCache.end() )
+ return (*aQCacheIter).second;
+ else
+ {
+ NameSpaceMap::const_iterator aIter = aNameMap.find ( nKey );
+ if ( aIter != aNameMap.end() )
+ {
+ OUStringBuffer sQName;
+ // ...if it's in our map, make the prefix
+ const OUString & prefix( (*aIter).second->sPrefix );
+ if (prefix.getLength()) // not default namespace
+ {
+ sQName.append( prefix );
+ sQName.append( sal_Unicode(':') );
+ }
+ sQName.append ( rLocalName );
+ if (bCache)
+ {
+ OUString sString(sQName.makeStringAndClear());
+ OUString *pString = new OUString ( rLocalName );
+ const_cast < QNameCache * > (&aQNameCache)->operator[] ( QNamePair ( nKey, pString ) ) = sString;
+ return sString;
+ }
+ else
+ return sQName.makeStringAndClear();
+ }
+ else
+ {
+ // ... if it isn't, this is a Bad Thing, assert and return the local name
+ DBG_ASSERT( sal_False, "SvXMLNamespaceMap::GetQNameByKey: invalid namespace key" );
+ return rLocalName;
+ }
+ }
+ }
+ }
+}
+
+sal_uInt16 SvXMLNamespaceMap::_GetKeyByAttrName(
+ const OUString& rAttrName,
+ OUString *pLocalName,
+ sal_Bool bCache) const
+{
+ return _GetKeyByAttrName( rAttrName, 0, pLocalName, 0, bCache );
+}
+
+sal_uInt16 SvXMLNamespaceMap::_GetKeyByAttrName( const OUString& rAttrName,
+ OUString *pPrefix,
+ OUString *pLocalName,
+ OUString *pNamespace,
+ sal_Bool bCache) const
+{
+ sal_uInt16 nKey = XML_NAMESPACE_UNKNOWN;
+
+ NameSpaceHash::const_iterator it;
+ if (bCache)
+ it = aNameCache.find ( rAttrName );
+ else
+ it = aNameCache.end();
+ if ( it != aNameCache.end() )
+ {
+ const NameSpaceEntry &rEntry = *((*it).second);
+ if ( pPrefix )
+ *pPrefix = rEntry.sPrefix;
+ if ( pLocalName )
+ *pLocalName = rEntry.sName;
+ nKey = rEntry.nKey;
+ if ( pNamespace )
+ {
+ NameSpaceMap::const_iterator aMapIter = aNameMap.find (nKey);
+ *pNamespace = aMapIter != aNameMap.end() ? (*aMapIter).second->sName : sEmpty;
+ }
+ }
+ else
+ {
+ rtl::Reference<NameSpaceEntry> xEntry(new NameSpaceEntry());
+
+ sal_Int32 nColonPos = rAttrName.indexOf( sal_Unicode(':') );
+ if( -1L == nColonPos )
+ {
+ // case: no ':' found -> default namespace
+ xEntry->sPrefix = OUString();
+ xEntry->sName = rAttrName;
+ }
+ else
+ {
+ // normal case: ':' found -> get prefix/suffix
+ xEntry->sPrefix = rAttrName.copy( 0L, nColonPos );
+ xEntry->sName = rAttrName.copy( nColonPos + 1L );
+ }
+
+ if( pPrefix )
+ *pPrefix = xEntry->sPrefix;
+ if( pLocalName )
+ *pLocalName = xEntry->sName;
+
+ NameSpaceHash::const_iterator aIter = aNameHash.find( xEntry->sPrefix );
+ if ( aIter != aNameHash.end() )
+ {
+ // found: retrieve namespace key
+ nKey = xEntry->nKey = (*aIter).second->nKey;
+ if ( pNamespace )
+ *pNamespace = (*aIter).second->sName;
+ }
+ else if ( xEntry->sPrefix == sXMLNS )
+ // not found, but xmlns prefix: return xmlns 'namespace'
+ nKey = xEntry->nKey = XML_NAMESPACE_XMLNS;
+ else if( nColonPos == -1L )
+ // not found, and no namespace: 'namespace' none
+ nKey = xEntry->nKey = XML_NAMESPACE_NONE;
+
+ if (bCache)
+ {
+ typedef std::pair< const rtl::OUString, rtl::Reference<NameSpaceEntry> > value_type;
+ (void) const_cast<NameSpaceHash*>(&aNameCache)->insert (value_type (rAttrName, xEntry));
+ }
+ }
+
+ return nKey;
+}
+
+sal_uInt16 SvXMLNamespaceMap::GetFirstKey() const
+{
+ return aNameMap.empty() ? USHRT_MAX : (*aNameMap.begin()).second->nKey;
+}
+
+sal_uInt16 SvXMLNamespaceMap::GetNextKey( sal_uInt16 nLastKey ) const
+{
+ NameSpaceMap::const_iterator aIter = aNameMap.find ( nLastKey );
+ return (++aIter == aNameMap.end()) ? USHRT_MAX : (*aIter).second->nKey;
+}
+
+
+// All methods after this are deprecated...
+
+sal_uInt16 SvXMLNamespaceMap::GetKeyByIndex( sal_uInt16 nIdx ) const
+{
+ return nIdx;
+}
+
+sal_uInt16 SvXMLNamespaceMap::GetIndexByKey( sal_uInt16 nKey ) const
+{
+ return nKey;
+}
+sal_uInt16 SvXMLNamespaceMap::GetFirstIndex() const
+{
+ return aNameMap.empty() ? USHRT_MAX : (*aNameMap.begin()).second->nKey;
+}
+
+sal_uInt16 SvXMLNamespaceMap::GetNextIndex( sal_uInt16 nOldIdx ) const
+{
+ NameSpaceMap::const_iterator aIter = aNameMap.find ( nOldIdx );
+ return (++aIter == aNameMap.end()) ? USHRT_MAX : (*aIter).second->nKey;
+}
+
+sal_Bool SvXMLNamespaceMap::AddAtIndex( sal_uInt16 /*nIdx*/, const OUString& rPrefix,
+ const OUString& rName, sal_uInt16 nKey )
+{
+ sal_Bool bRet = sal_False;
+
+ if( XML_NAMESPACE_UNKNOWN == nKey )
+ nKey = GetKeyByName( rName );
+
+ DBG_ASSERT( XML_NAMESPACE_NONE != nKey,
+ "SvXMLNamespaceMap::AddAtIndex: invalid namespace key" );
+ if( XML_NAMESPACE_NONE != nKey && ! ( aNameHash.count ( rPrefix ) ) )
+ {
+ _Add( rPrefix, rName, nKey );
+ bRet = sal_True;
+ }
+ return bRet;
+}
+
+sal_Bool SvXMLNamespaceMap::AddAtIndex( sal_uInt16 nIdx, const sal_Char *pPrefix,
+ const sal_Char *pName, sal_uInt16 nKey )
+{
+ OUString sPrefix( OUString::createFromAscii(pPrefix) );
+ OUString sName( OUString::createFromAscii(pName) );
+
+ return AddAtIndex( nIdx, sPrefix, sName, nKey );
+}
+
+OUString SvXMLNamespaceMap::GetAttrNameByIndex( sal_uInt16 nIdx ) const
+{
+ return GetAttrNameByKey( nIdx );
+}
+
+OUString SvXMLNamespaceMap::GetQNameByIndex( sal_uInt16 nIdx,
+ const OUString& rLocalName ) const
+{
+ return GetQNameByKey( nIdx, rLocalName );
+}
+
+const OUString& SvXMLNamespaceMap::GetPrefixByIndex( sal_uInt16 nIdx ) const
+{
+ NameSpaceMap::const_iterator aIter = aNameMap.find (nIdx);
+ return (aIter != aNameMap.end()) ? (*aIter).second->sPrefix : sEmpty;
+}
+
+const OUString& SvXMLNamespaceMap::GetNameByIndex( sal_uInt16 nIdx ) const
+{
+ NameSpaceMap::const_iterator aIter = aNameMap.find (nIdx);
+ return (aIter != aNameMap.end()) ? (*aIter).second->sName : sEmpty;
+}
+
+sal_uInt16 SvXMLNamespaceMap::GetIndexByPrefix( const OUString& rPrefix ) const
+{
+ NameSpaceHash::const_iterator aIter = aNameHash.find(rPrefix);
+ return (aIter != aNameHash.end()) ? (*aIter).second->nKey : USHRT_MAX;
+}
+sal_uInt16 SvXMLNamespaceMap::GetKeyByAttrName(
+ const OUString& rAttrName,
+ OUString *pLocalName,
+ sal_uInt16 /*nIdxGuess*/) const
+{
+ return _GetKeyByAttrName( rAttrName, 0, pLocalName, 0 );
+}
+
+sal_uInt16 SvXMLNamespaceMap::GetKeyByAttrName( const OUString& rAttrName,
+ OUString *pPrefix,
+ OUString *pLocalName,
+ OUString *pNamespace,
+ sal_uInt16 /*nIdxGuess*/ ) const
+{
+ return _GetKeyByAttrName ( rAttrName, pPrefix, pLocalName, pNamespace );
+}
+
+sal_Bool SvXMLNamespaceMap::NormalizeURI( ::rtl::OUString& rName )
+{
+ // try OASIS + W3 URI normalization
+ sal_Bool bSuccess = NormalizeOasisURN( rName );
+ if( ! bSuccess )
+ bSuccess = NormalizeW3URI( rName );
+ return bSuccess;
+}
+
+sal_Bool SvXMLNamespaceMap::NormalizeW3URI( ::rtl::OUString& rName )
+{
+ // check if URI matches:
+ // http://www.w3.org/[0-9]*/[:letter:]*
+ // (year)/(WG name)
+ // For the following WG/standards names:
+ // - xforms
+
+ sal_Bool bSuccess = sal_False;
+ const OUString sURIPrefix = GetXMLToken( XML_URI_W3_PREFIX );
+ if( rName.compareTo( sURIPrefix, sURIPrefix.getLength() ) == 0 )
+ {
+ const OUString sURISuffix = GetXMLToken( XML_URI_XFORMS_SUFFIX );
+ sal_Int32 nCompareFrom = rName.getLength() - sURISuffix.getLength();
+ if( rName.copy( nCompareFrom ).equals( sURISuffix ) )
+ {
+ // found W3 prefix, and xforms suffix
+ rName = GetXMLToken( XML_N_XFORMS_1_0 );
+ bSuccess = sal_True;
+ }
+ }
+ return bSuccess;
+}
+
+sal_Bool SvXMLNamespaceMap::NormalizeOasisURN( ::rtl::OUString& rName )
+{
+ // #i38644#
+ // we exported the wrong namespace for smil, so we correct this here on load
+ // for older documents
+ if( IsXMLToken( rName, ::xmloff::token::XML_N_SVG ) )
+ {
+ rName = GetXMLToken( ::xmloff::token::XML_N_SVG_COMPAT );
+ return sal_True;
+ }
+ else if( IsXMLToken( rName, ::xmloff::token::XML_N_FO ) )
+ {
+ rName = GetXMLToken( ::xmloff::token::XML_N_FO_COMPAT );
+ return sal_True;
+ }
+ else if( IsXMLToken( rName, ::xmloff::token::XML_N_SMIL ) ||
+ IsXMLToken( rName, ::xmloff::token::XML_N_SMIL_OLD ) )
+ {
+ rName = GetXMLToken( ::xmloff::token::XML_N_SMIL_COMPAT );
+ return sal_True;
+ }
+
+ //
+ // Check if URN matches
+ // :urn:oasis:names:tc:[^:]*:xmlns:[^:]*:1.[^:]*
+ // |---| |---| |-----|
+ // TC-Id Sub-Id Version
+
+ sal_Int32 nNameLen = rName.getLength();
+ // :urn:oasis:names:tc.*
+ const OUString& rOasisURN = GetXMLToken( XML_URN_OASIS_NAMES_TC );
+ if( 0 != rName.compareTo( rOasisURN, rOasisURN.getLength() ) )
+ return sal_False;
+
+ // :urn:oasis:names:tc:.*
+ sal_Int32 nPos = rOasisURN.getLength();
+ if( nPos >= nNameLen || rName[nPos] != ':' )
+ return sal_False;
+
+ // :urn:oasis:names:tc:[^:]:.*
+ sal_Int32 nTCIdStart = nPos+1;
+ sal_Int32 nTCIdEnd = rName.indexOf( ':', nTCIdStart );
+ if( -1 == nTCIdEnd )
+ return sal_False;
+
+ // :urn:oasis:names:tc:[^:]:xmlns.*
+ nPos = nTCIdEnd + 1;
+ OUString sTmp( rName.copy( nPos ) );
+ const OUString& rXMLNS = GetXMLToken( XML_XMLNS );
+ if( 0!= sTmp.compareTo( rXMLNS, rXMLNS.getLength() ) )
+ return sal_False;
+
+ // :urn:oasis:names:tc:[^:]:xmlns:.*
+ nPos += rXMLNS.getLength();
+ if( nPos >= nNameLen || rName[nPos] != ':' )
+ return sal_False;
+
+ // :urn:oasis:names:tc:[^:]:xmlns:[^:]*:.*
+ nPos = rName.indexOf( ':', nPos+1 );
+ if( -1 == nPos )
+ return sal_False;
+
+ // :urn:oasis:names:tc:[^:]:xmlns:[^:]*:[^:][^:][^:][^:]*
+ sal_Int32 nVersionStart = nPos+1;
+ if( nVersionStart+2 >= nNameLen ||
+ -1 != rName.indexOf( ':', nVersionStart ) )
+ return sal_False;
+
+ // :urn:oasis:names:tc:[^:]:xmlns:[^:]*:1\.[^:][^:]*
+ if( rName[nVersionStart] != '1' || rName[nVersionStart+1] != '.' )
+ return sal_False;
+
+ // replace [tcid] with current TCID and version with current version.
+ OUStringBuffer aNewName( nNameLen +20 );
+ aNewName.append( rName.copy( 0, nTCIdStart ) );
+ aNewName.append( GetXMLToken( XML_OPENDOCUMENT ) );
+ aNewName.append( rName.copy( nTCIdEnd, nVersionStart-nTCIdEnd ) );
+ aNewName.append( GetXMLToken( XML_1_0 ) );
+
+ rName = aNewName.makeStringAndClear();
+
+ return sal_True;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/core/unoatrcn.cxx b/xmloff/source/core/unoatrcn.cxx
new file mode 100644
index 000000000000..7889d3d62f7d
--- /dev/null
+++ b/xmloff/source/core/unoatrcn.cxx
@@ -0,0 +1,317 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#include <com/sun/star/xml/AttributeData.hpp>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/uuid.h>
+#include <rtl/memory.h>
+
+#include <xmloff/xmlcnimp.hxx>
+
+#include "xmloff/unoatrcn.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+
+// --------------------------------------------------------------------
+// Interface implementation
+// --------------------------------------------------------------------
+
+#define IMPL ((AttrContainerImpl*)mpData)
+
+uno::Reference< uno::XInterface > SvUnoAttributeContainer_CreateInstance()
+{
+ return *(new SvUnoAttributeContainer);
+}
+
+SvUnoAttributeContainer::SvUnoAttributeContainer( SvXMLAttrContainerData* pContainer)
+: mpContainer( pContainer )
+{
+ if( mpContainer == NULL )
+ mpContainer = new SvXMLAttrContainerData;
+}
+
+SvUnoAttributeContainer::~SvUnoAttributeContainer()
+{
+ delete mpContainer;
+}
+
+// container::XElementAccess
+uno::Type SAL_CALL SvUnoAttributeContainer::getElementType(void)
+ throw( uno::RuntimeException )
+{
+ return ::getCppuType((const xml::AttributeData*)0);
+}
+
+sal_Bool SAL_CALL SvUnoAttributeContainer::hasElements(void)
+ throw( uno::RuntimeException )
+{
+ return mpContainer->GetAttrCount() != 0;
+}
+
+sal_uInt16 SvUnoAttributeContainer::getIndexByName(const OUString& aName ) const
+{
+ const sal_uInt16 nAttrCount = mpContainer->GetAttrCount();
+
+ sal_Int32 nPos = aName.indexOf( sal_Unicode(':') );
+ if( nPos == -1L )
+ {
+ for( sal_uInt16 nAttr = 0; nAttr < nAttrCount; nAttr++ )
+ {
+ if( mpContainer->GetAttrLName(nAttr) == aName &&
+ mpContainer->GetAttrPrefix(nAttr).getLength() == 0L )
+ return nAttr;
+ }
+ }
+ else
+ {
+ const OUString aPrefix( aName.copy( 0L, nPos ) );
+ const OUString aLName( aName.copy( nPos+1L ) );
+
+ for( sal_uInt16 nAttr = 0; nAttr < nAttrCount; nAttr++ )
+ {
+ if( mpContainer->GetAttrLName(nAttr) == aLName &&
+ mpContainer->GetAttrPrefix(nAttr) == aPrefix )
+ return nAttr;
+ }
+ }
+
+ return USHRT_MAX;
+}
+
+const ::com::sun::star::uno::Sequence< sal_Int8 > & SvUnoAttributeContainer::getUnoTunnelId() throw()
+{
+ static ::com::sun::star::uno::Sequence< sal_Int8 > * pSeq = 0;
+ if( !pSeq )
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !pSeq )
+ {
+ static ::com::sun::star::uno::Sequence< sal_Int8 > aSeq( 16 );
+ rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
+ pSeq = &aSeq;
+ }
+ }
+ return *pSeq;
+}
+
+SvUnoAttributeContainer* SvUnoAttributeContainer::getImplementation( uno::Reference< uno::XInterface > xInt ) throw()
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > xUT( xInt, ::com::sun::star::uno::UNO_QUERY );
+ if( xUT.is() )
+ {
+ return
+ reinterpret_cast<SvUnoAttributeContainer*>(
+ sal::static_int_cast<sal_IntPtr>(
+ xUT->getSomething( SvUnoAttributeContainer::getUnoTunnelId())));
+ }
+ else
+ return NULL;
+}
+
+sal_Int64 SAL_CALL SvUnoAttributeContainer::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException)
+{
+ if( rId.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
+ }
+ return 0;
+}
+
+// container::XNameAccess
+uno::Any SAL_CALL SvUnoAttributeContainer::getByName(const OUString& aName)
+ throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ sal_uInt16 nAttr = getIndexByName(aName );
+
+ if( nAttr == USHRT_MAX )
+ throw container::NoSuchElementException();
+
+ xml::AttributeData aData;
+ aData.Namespace = mpContainer->GetAttrNamespace(nAttr);
+ aData.Type = OUString(RTL_CONSTASCII_USTRINGPARAM("CDATA"));
+ aData.Value = mpContainer->GetAttrValue(nAttr);
+
+ uno::Any aAny;
+ aAny <<= aData;
+ return aAny;
+}
+
+uno::Sequence< OUString > SAL_CALL SvUnoAttributeContainer::getElementNames(void) throw( uno::RuntimeException )
+{
+ const sal_uInt16 nAttrCount = mpContainer->GetAttrCount();
+
+ uno::Sequence< OUString > aElementNames( (sal_Int32)nAttrCount );
+ OUString *pNames = aElementNames.getArray();
+
+ for( sal_uInt16 nAttr = 0; nAttr < nAttrCount; nAttr++ )
+ {
+ OUStringBuffer sBuffer( mpContainer->GetAttrPrefix(nAttr) );
+ if( sBuffer.getLength() != 0L )
+ sBuffer.append( (sal_Unicode)':' );
+ sBuffer.append( mpContainer->GetAttrLName(nAttr) );
+ *pNames++ = sBuffer.makeStringAndClear();
+ }
+
+ return aElementNames;
+}
+
+sal_Bool SAL_CALL SvUnoAttributeContainer::hasByName(const OUString& aName) throw( uno::RuntimeException )
+{
+ return getIndexByName(aName ) != USHRT_MAX;
+}
+
+// container::XNameReplace
+void SAL_CALL SvUnoAttributeContainer::replaceByName(const OUString& aName, const uno::Any& aElement)
+ throw( lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ if( aElement.hasValue() && aElement.getValueType() == ::getCppuType((const xml::AttributeData*)0) )
+ {
+ sal_uInt16 nAttr = getIndexByName(aName );
+ if( nAttr == USHRT_MAX )
+ throw container::NoSuchElementException();
+
+ xml::AttributeData* pData = (xml::AttributeData*)aElement.getValue();
+
+ sal_Int32 nPos = aName.indexOf( sal_Unicode(':') );
+ if( nPos != -1L )
+ {
+ const OUString aPrefix( aName.copy( 0L, nPos ));
+ const OUString aLName( aName.copy( nPos+1L ));
+
+ if( pData->Namespace.getLength() == 0L )
+ {
+ if( mpContainer->SetAt( nAttr, aPrefix, aLName, pData->Value ) )
+ return;
+ }
+ else
+ {
+ if( mpContainer->SetAt( nAttr, aPrefix, pData->Namespace, aLName, pData->Value ) )
+ return;
+ }
+ }
+ else
+ {
+ if( pData->Namespace.getLength() == 0L )
+ {
+ if( mpContainer->SetAt( nAttr, aName, pData->Value ) )
+ return;
+ }
+ }
+ }
+
+ throw lang::IllegalArgumentException();
+}
+
+// container::XNameContainer
+void SAL_CALL SvUnoAttributeContainer::insertByName(const OUString& aName, const uno::Any& aElement)
+throw( lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ if( !aElement.hasValue() || aElement.getValueType() != ::getCppuType((const xml::AttributeData*)0) )
+ throw lang::IllegalArgumentException();
+
+ sal_uInt16 nAttr = getIndexByName(aName );
+ if( nAttr != USHRT_MAX )
+ throw container::ElementExistException();
+
+ xml::AttributeData* pData = (xml::AttributeData*)aElement.getValue();
+
+ sal_Int32 nPos = aName.indexOf( sal_Unicode(':') );
+ if( nPos != -1L )
+ {
+ const OUString aPrefix( aName.copy( 0L, nPos ));
+ const OUString aLName( aName.copy( nPos+1L ));
+
+ if( pData->Namespace.getLength() == 0L )
+ {
+ if( mpContainer->AddAttr( aPrefix, aLName, pData->Value ) )
+ return;
+ }
+ else
+ {
+ if( mpContainer->AddAttr( aPrefix, pData->Namespace, aLName, pData->Value ) )
+ return;
+ }
+ }
+ else
+ {
+ if( pData->Namespace.getLength() == 0L )
+ {
+ if( mpContainer->AddAttr( aName, pData->Value ) )
+ return;
+ }
+ }
+}
+
+void SAL_CALL SvUnoAttributeContainer::removeByName(const OUString& Name)
+ throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ sal_uInt16 nAttr = getIndexByName(Name);
+ if( nAttr == USHRT_MAX )
+ throw container::NoSuchElementException();
+
+ mpContainer->Remove( nAttr );
+}
+
+//XServiceInfo
+OUString SAL_CALL SvUnoAttributeContainer::getImplementationName(void) throw( uno::RuntimeException )
+{
+ return OUString(RTL_CONSTASCII_USTRINGPARAM( "SvUnoAttributeContainer" ));
+}
+
+uno::Sequence< OUString > SvUnoAttributeContainer::getSupportedServiceNames(void)
+ throw( uno::RuntimeException )
+{
+ OUString aSN( OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.AttributeContainer" )) );
+ uno::Sequence< OUString > aNS( &aSN, 1L );
+ return aNS;
+}
+
+sal_Bool SvUnoAttributeContainer::supportsService(const OUString& ServiceName)
+ throw( uno::RuntimeException )
+{
+ const uno::Sequence < OUString > aServiceNames( getSupportedServiceNames() );
+ const OUString* pNames = aServiceNames.getConstArray();
+ sal_Int32 nCount = aServiceNames.getLength();
+ while( nCount-- )
+ {
+ if( *pNames++ == ServiceName )
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx b/xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx
new file mode 100644
index 000000000000..6503a97bee03
--- /dev/null
+++ b/xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx
@@ -0,0 +1,173 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "unointerfacetouniqueidentifiermapper.hxx"
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::XInterface;
+using ::rtl::OUString;
+
+namespace comphelper
+{
+
+UnoInterfaceToUniqueIdentifierMapper::UnoInterfaceToUniqueIdentifierMapper()
+: mnNextId( 1 )
+{
+}
+
+/** returns a unique identifier for the given uno object. IF a uno object is
+ registered more than once, the returned identifier is always the same.
+*/
+const OUString& UnoInterfaceToUniqueIdentifierMapper::registerReference( const Reference< XInterface >& rInterface )
+{
+ IdMap_t::const_iterator aIter;
+ if( findReference( rInterface, aIter ) )
+ {
+ return (*aIter).first;
+ }
+ else
+ {
+ OUString aId( RTL_CONSTASCII_USTRINGPARAM( "id" ) );
+ aId += OUString::valueOf( mnNextId++ );
+ return (*maEntries.insert( IdMap_t::value_type( aId, rInterface ) ).first).first;
+ }
+}
+
+/** registers the given uno object with the given identifier.
+
+ @returns
+ false, if the given identifier already exists and is not associated with the given interface
+*/
+bool UnoInterfaceToUniqueIdentifierMapper::registerReference( const OUString& rIdentifier, const Reference< XInterface >& rInterface )
+{
+ IdMap_t::const_iterator aIter;
+ if( findReference( rInterface, aIter ) )
+ {
+ return rIdentifier != (*aIter).first;
+ }
+ else if( findIdentifier( rIdentifier, aIter ) )
+ {
+ return false;
+ }
+ else
+ {
+ maEntries.insert( IdMap_t::value_type( rIdentifier, rInterface ) );
+
+ // see if this is a reference like something we would generate in the future
+ const sal_Unicode *p = rIdentifier.getStr();
+ sal_Int32 nLength = rIdentifier.getLength();
+
+ // see if the identifier is 'id' followed by a pure integer value
+ if( nLength < 2 || p[0] != 'i' || p[1] != 'd' )
+ return true;
+
+ nLength -= 2;
+ p += 2;
+
+ while(nLength--)
+ {
+ if( (*p < '0') || (*p > '9') )
+ return true; // a custom id, that will never conflict with genereated id's
+
+ p++;
+ }
+
+ // the identifier is a pure integer value
+ // so we make sure we will never generate
+ // an integer value like this one
+ sal_Int32 nId = rIdentifier.copy(2).toInt32();
+ if( mnNextId <= nId )
+ mnNextId = nId + 1;
+
+ return true;
+ }
+}
+
+/** @returns
+ the identifier for the given uno object. If this uno object is not already
+ registered, an empty string is returned
+*/
+const OUString& UnoInterfaceToUniqueIdentifierMapper::getIdentifier( const Reference< XInterface >& rInterface ) const
+{
+ IdMap_t::const_iterator aIter;
+ if( findReference( rInterface, aIter ) )
+ {
+ return (*aIter).first;
+ }
+ else
+ {
+ static const OUString aEmpty;
+ return aEmpty;
+ }
+}
+
+/** @returns
+ the uno object that is registered with the given identifier. If no uno object
+ is registered with the given identifier, an empty reference is returned.
+*/
+const Reference< XInterface >& UnoInterfaceToUniqueIdentifierMapper::getReference( const OUString& rIdentifier ) const
+{
+ IdMap_t::const_iterator aIter;
+ if( findIdentifier( rIdentifier, aIter ) )
+ {
+ return (*aIter).second;
+ }
+ else
+ {
+ static const Reference< XInterface > aEmpty;
+ return aEmpty;
+ }
+}
+
+bool UnoInterfaceToUniqueIdentifierMapper::findReference( const Reference< XInterface >& rInterface, IdMap_t::const_iterator& rIter ) const
+{
+ rIter = maEntries.begin();
+ const IdMap_t::const_iterator aEnd( maEntries.end() );
+ while( rIter != aEnd )
+ {
+ if( (*rIter).second == rInterface )
+ return true;
+
+ rIter++;
+ }
+
+ return false;
+}
+
+bool UnoInterfaceToUniqueIdentifierMapper::findIdentifier( const OUString& rIdentifier, IdMap_t::const_iterator& rIter ) const
+{
+ rIter = maEntries.find( rIdentifier );
+ return rIter != maEntries.end();
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/core/xmlcnitm.cxx b/xmloff/source/core/xmlcnitm.cxx
new file mode 100644
index 000000000000..7c7864b5df5f
--- /dev/null
+++ b/xmloff/source/core/xmlcnitm.cxx
@@ -0,0 +1,221 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#include <com/sun/star/xml/AttributeData.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+
+#include <xmloff/xmlcnimp.hxx>
+#include "xmloff/unoatrcn.hxx"
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::xml;
+
+using ::rtl::OUString;
+
+typedef ::rtl::OUString *OUStringPtr;
+SV_DECL_PTRARR_DEL( SvXMLAttrContainerData_Impl, OUStringPtr, 5, 5 )
+SV_IMPL_PTRARR( SvXMLAttrContainerData_Impl, OUStringPtr )
+
+
+SvXMLAttrContainerData::SvXMLAttrContainerData(
+ const SvXMLAttrContainerData& rImpl ) :
+ aNamespaceMap( rImpl.aNamespaceMap ),
+ pLNames( new SvXMLAttrContainerData_Impl ),
+ pValues( new SvXMLAttrContainerData_Impl )
+{
+ sal_uInt16 nCount = rImpl.pLNames->Count();
+ for( sal_uInt16 i=0; i<nCount; i++ )
+ {
+ aPrefixPoss.Insert( rImpl.aPrefixPoss[i], i );
+ pLNames->Insert( new OUString( *(*rImpl.pLNames)[i] ), i );
+ pValues->Insert( new OUString( *(*rImpl.pValues)[i] ), i );
+ }
+}
+
+SvXMLAttrContainerData::SvXMLAttrContainerData() :
+ pLNames( new SvXMLAttrContainerData_Impl ),
+ pValues( new SvXMLAttrContainerData_Impl )
+{
+}
+
+SvXMLAttrContainerData::~SvXMLAttrContainerData()
+{
+ delete pLNames;
+ delete pValues;
+}
+
+int SvXMLAttrContainerData::operator ==(
+ const SvXMLAttrContainerData& rCmp ) const
+{
+ sal_Bool bRet = pLNames->Count() == rCmp.pLNames->Count() &&
+ aNamespaceMap == rCmp.aNamespaceMap;
+ if( bRet )
+ {
+ sal_uInt16 nCount = pLNames->Count();
+ sal_uInt16 i;
+ for( i=0; bRet && i < nCount; i++ )
+ bRet = aPrefixPoss[i] == rCmp.aPrefixPoss[i];
+
+ if( bRet )
+ {
+ for( i=0; bRet && i < nCount; i++ )
+ bRet = *(*pLNames)[i] == *(*rCmp.pLNames)[i] &&
+ *(*pValues)[i] == *(*rCmp.pValues)[i];
+ }
+ }
+
+ return (int)bRet;
+}
+
+sal_Bool SvXMLAttrContainerData::AddAttr( const OUString& rLName,
+ const OUString& rValue )
+{
+ aPrefixPoss.Insert( USHRT_MAX, aPrefixPoss.Count() );
+ pLNames->Insert( new OUString(rLName), pLNames->Count() );
+ pValues->Insert( new OUString(rValue), pValues->Count() );
+
+ return sal_True;
+}
+
+sal_Bool SvXMLAttrContainerData::AddAttr( const OUString& rPrefix,
+ const OUString& rNamespace,
+ const OUString& rLName,
+ const OUString& rValue )
+{
+ sal_uInt16 nPos = aNamespaceMap.Add( rPrefix, rNamespace );
+ aPrefixPoss.Insert( nPos, aPrefixPoss.Count() );
+ pLNames->Insert( new OUString(rLName), pLNames->Count() );
+ pValues->Insert( new OUString(rValue), pValues->Count() );
+
+ return sal_True;
+}
+
+sal_Bool SvXMLAttrContainerData::AddAttr( const OUString& rPrefix,
+ const OUString& rLName,
+ const OUString& rValue )
+{
+ sal_uInt16 nPos = aNamespaceMap.GetIndexByPrefix( rPrefix );
+ if( USHRT_MAX == nPos )
+ return sal_False;
+
+ aPrefixPoss.Insert( nPos, aPrefixPoss.Count() );
+ pLNames->Insert( new OUString(rLName), pLNames->Count() );
+ pValues->Insert( new OUString(rValue), pValues->Count() );
+
+ return sal_True;
+}
+
+sal_Bool SvXMLAttrContainerData::SetAt( sal_uInt16 i,
+ const rtl::OUString& rLName, const rtl::OUString& rValue )
+{
+ if( i >= GetAttrCount() )
+ return sal_False;
+
+ *(*pLNames)[i] = rLName;
+ *(*pValues)[i] = rValue;
+ aPrefixPoss[i] = USHRT_MAX;
+
+ return sal_True;
+}
+
+sal_Bool SvXMLAttrContainerData::SetAt( sal_uInt16 i,
+ const rtl::OUString& rPrefix, const rtl::OUString& rNamespace,
+ const rtl::OUString& rLName, const rtl::OUString& rValue )
+{
+ if( i >= GetAttrCount() )
+ return sal_False;
+
+ sal_uInt16 nPos = aNamespaceMap.Add( rPrefix, rNamespace );
+ if( USHRT_MAX == nPos )
+ return sal_False;
+
+ *(*pLNames)[i] = rLName;
+ *(*pValues)[i] = rValue;
+ aPrefixPoss[i] = nPos;
+
+ return sal_True;
+}
+
+sal_Bool SvXMLAttrContainerData::SetAt( sal_uInt16 i,
+ const rtl::OUString& rPrefix,
+ const rtl::OUString& rLName,
+ const rtl::OUString& rValue )
+{
+ if( i >= GetAttrCount() )
+ return sal_False;
+
+ sal_uInt16 nPos = aNamespaceMap.GetIndexByPrefix( rPrefix );
+ if( USHRT_MAX == nPos )
+ return sal_False;
+
+ *(*pLNames)[i] = rLName;
+ *(*pValues)[i] = rValue;
+ aPrefixPoss[i] = nPos;
+
+ return sal_True;
+}
+
+void SvXMLAttrContainerData::Remove( sal_uInt16 i )
+{
+ if( i < GetAttrCount() )
+ {
+ delete (*pLNames)[i];
+ pLNames->Remove( i );
+ delete (*pValues)[i];
+ pValues->Remove( i );
+ aPrefixPoss.Remove( i );
+ }
+ else
+ {
+ OSL_FAIL( "illegal index" );
+ }
+}
+
+sal_uInt16 SvXMLAttrContainerData::GetAttrCount() const
+{
+ return pLNames->Count();
+}
+
+const ::rtl::OUString& SvXMLAttrContainerData::GetAttrLName(sal_uInt16 i) const
+{
+ OSL_ENSURE( i < pLNames->Count(), "SvXMLAttrContainerData::GetLName: illegal index" );
+ return *(*pLNames)[i];
+}
+
+const ::rtl::OUString& SvXMLAttrContainerData::GetAttrValue(sal_uInt16 i) const
+{
+ OSL_ENSURE( i < pValues->Count(), "SvXMLAttrContainerData::GetValue: illegal index" );
+ return *(*pValues)[i];
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/core/xmlehelp.cxx b/xmloff/source/core/xmlehelp.cxx
new file mode 100644
index 000000000000..fe38c798921b
--- /dev/null
+++ b/xmloff/source/core/xmlehelp.cxx
@@ -0,0 +1,501 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <limits.h>
+#include <tools/debug.hxx>
+#include <tools/bigint.hxx>
+#include <rtl/ustrbuf.hxx>
+#include "xmlehelp.hxx"
+
+#include <xmloff/xmltoken.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::xmloff::token;
+
+void SvXMLExportHelper::AddLength( sal_Int32 nValue, MapUnit eValueUnit,
+ OUStringBuffer& rOut,
+ MapUnit eOutUnit )
+{
+ // the sign is processed seperatly
+ if( nValue < 0 )
+ {
+ nValue = -nValue;
+ rOut.append( sal_Unicode('-') );
+ }
+
+ // The new length is (nVal * nMul)/(nDiv*nFac*10)
+ sal_Int32 nMul = 1000;
+ sal_Int32 nDiv = 1;
+ sal_Int32 nFac = 100;
+ enum XMLTokenEnum eUnit = XML_TOKEN_INVALID;
+ switch( eValueUnit )
+ {
+ case MAP_TWIP:
+ switch( eOutUnit )
+ {
+ case MAP_100TH_MM:
+ case MAP_10TH_MM:
+ DBG_ASSERT( MAP_INCH == eOutUnit,
+ "output unit not supported for twip values" );
+ case MAP_MM:
+ // 0.01mm = 0.57twip (exactly)
+ nMul = 25400; // 25.4 * 1000
+ nDiv = 1440; // 72 * 20;
+ nFac = 100;
+ eUnit = XML_UNIT_MM;
+ break;
+
+ case MAP_CM:
+ // 0.001cm = 0.57twip (exactly)
+ nMul = 25400; // 2.54 * 10000
+ nDiv = 1440; // 72 * 20;
+ nFac = 1000;
+ eUnit = XML_UNIT_CM;
+ break;
+
+ case MAP_POINT:
+ // 0.01pt = 0.2twip (exactly)
+ nMul = 1000;
+ nDiv = 20;
+ nFac = 100;
+ eUnit = XML_UNIT_PT;
+ break;
+
+ case MAP_INCH:
+ default:
+ DBG_ASSERT( MAP_INCH == eOutUnit,
+ "output unit not supported for twip values" );
+ // 0.0001in = 0.144twip (exactly)
+ nMul = 100000;
+ nDiv = 1440; // 72 * 20;
+ nFac = 10000;
+ eUnit = XML_UNIT_INCH;
+ break;
+ }
+ break;
+
+ case MAP_POINT:
+ // 1pt = 1pt (exactly)
+ DBG_ASSERT( MAP_POINT == eOutUnit,
+ "output unit not supported for pt values" );
+ nMul = 10;
+ nDiv = 1;
+ nFac = 1;
+ eUnit = XML_UNIT_PT;
+ break;
+ case MAP_10TH_MM:
+ case MAP_100TH_MM:
+ {
+ long nFac2 = (MAP_100TH_MM == eValueUnit) ? 100 : 10;
+ switch( eOutUnit )
+ {
+ case MAP_100TH_MM:
+ case MAP_10TH_MM:
+ DBG_ASSERT( MAP_INCH == eOutUnit,
+ "output unit not supported for 1/100mm values" );
+ case MAP_MM:
+ // 0.01mm = 1 mm/100 (exactly)
+ nMul = 10;
+ nDiv = 1;
+ nFac = nFac2;
+ eUnit = XML_UNIT_MM;
+ break;
+
+ case MAP_CM:
+ // 0.001mm = 1 mm/100 (exactly)
+ nMul = 10;
+ nDiv = 1; // 72 * 20;
+ nFac = 10*nFac2;
+ eUnit = XML_UNIT_CM;
+ break;
+
+ case MAP_POINT:
+ // 0.01pt = 0.35 mm/100 (exactly)
+ nMul = 72000;
+ nDiv = 2540;
+ nFac = nFac2;
+ eUnit = XML_UNIT_PT;
+ break;
+
+ case MAP_INCH:
+ default:
+ DBG_ASSERT( MAP_INCH == eOutUnit,
+ "output unit not supported for 1/100mm values" );
+ // 0.0001in = 0.254 mm/100 (exactly)
+ nMul = 100000;
+ nDiv = 2540;
+ nFac = 100*nFac2;
+ eUnit = XML_UNIT_INCH;
+ break;
+ }
+ break;
+ }
+ default:
+ DBG_ASSERT( 0, "input unit not handled" );
+ break;
+ }
+
+
+ sal_Int32 nLongVal = 0;
+ sal_Bool bOutLongVal = sal_True;
+ if( nValue > SAL_MAX_INT32 / nMul )
+ {
+ // A big int is required for calculation
+ BigInt nBigVal( nValue );
+ nBigVal *= nMul;
+ nBigVal /= nDiv;
+ nBigVal += 5;
+ nBigVal /= 10;
+
+ if( nBigVal.IsLong() )
+ {
+ // To convert the value into a string a sal_Int32 is sufficient
+ nLongVal = sal_Int32( nBigVal );
+ }
+ else
+ {
+ BigInt nBigFac( nFac );
+ BigInt nBig10( 10 );
+ rOut.append( (sal_Int32)(nBigVal / nBigFac) );
+ if( !(nBigVal % nBigFac).IsZero() )
+ {
+ rOut.append( sal_Unicode('.') );
+ while( nFac > 1 && !(nBigVal % nBigFac).IsZero() )
+ {
+ nFac /= 10;
+ nBigFac = nFac;
+ rOut.append( (sal_Int32)((nBigVal / nBigFac) % nBig10 ) );
+ }
+ }
+ bOutLongVal = sal_False;
+ }
+ }
+ else
+ {
+ nLongVal = nValue * nMul;
+ nLongVal /= nDiv;
+ nLongVal += 5;
+ nLongVal /= 10;
+ }
+
+ if( bOutLongVal )
+ {
+ rOut.append( (sal_Int32)(nLongVal / nFac) );
+ if( nFac > 1 && (nLongVal % nFac) != 0 )
+ {
+ rOut.append( sal_Unicode('.') );
+ while( nFac > 1 && (nLongVal % nFac) != 0 )
+ {
+ nFac /= 10;
+ rOut.append( (sal_Int32)((nLongVal / nFac) % 10) );
+ }
+ }
+ }
+
+ if( eUnit != XML_TOKEN_INVALID )
+ rOut.append( GetXMLToken(eUnit) );
+}
+
+void SvXMLExportHelper::AddPercentage( sal_Int32 nValue, OUStringBuffer& rOut )
+{
+ rOut.append( nValue );
+ rOut.append( sal_Unicode('%' ) );
+}
+
+double SvXMLExportHelper::GetConversionFactor(::rtl::OUStringBuffer& rUnit,
+ const MapUnit eCoreUnit, const MapUnit eDestUnit)
+{
+ double fRetval(1.0);
+ rUnit.setLength(0L);
+
+ if(eCoreUnit != eDestUnit)
+ {
+ enum XMLTokenEnum eUnit = XML_TOKEN_INVALID;
+
+ switch(eCoreUnit)
+ {
+ case MAP_TWIP:
+ {
+ switch(eDestUnit)
+ {
+ case MAP_100TH_MM:
+ case MAP_10TH_MM:
+ {
+ DBG_ASSERT(MAP_INCH == eDestUnit, "output unit not supported for twip values");
+ }
+ case MAP_MM:
+ {
+ // 0.01mm = 0.57twip (exactly)
+ fRetval = ((25400.0 / 1440.0) / 1000.0);
+ eUnit = XML_UNIT_MM;
+ break;
+ }
+ case MAP_CM:
+ {
+ // 0.001cm = 0.57twip (exactly)
+ fRetval = ((25400.0 / 1440.0) / 10000.0);
+ eUnit = XML_UNIT_CM;
+ break;
+ }
+ case MAP_POINT:
+ {
+ // 0.01pt = 0.2twip (exactly)
+ fRetval = ((1000.0 / 20.0) / 1000.0);
+ eUnit = XML_UNIT_PT;
+ break;
+ }
+ case MAP_INCH:
+ default:
+ {
+ DBG_ASSERT(MAP_INCH == eDestUnit, "output unit not supported for twip values");
+ // 0.0001in = 0.144twip (exactly)
+ fRetval = ((100000.0 / 1440.0) / 100000.0);
+ eUnit = XML_UNIT_INCH;
+ break;
+ }
+ }
+ break;
+ }
+ case MAP_POINT:
+ {
+ switch(eDestUnit)
+ {
+ case MAP_MM:
+ // 1mm = 72 / 25.4 pt (exactly)
+ fRetval = ( 25.4 / 72.0 );
+ eUnit = XML_UNIT_MM;
+ break;
+
+ case MAP_CM:
+ // 1cm = 72 / 2.54 pt (exactly)
+ fRetval = ( 2.54 / 72.0 );
+ eUnit = XML_UNIT_CM;
+ break;
+
+ case MAP_TWIP:
+ // 1twip = 72 / 1440 pt (exactly)
+ fRetval = 20.0; // 1440.0 / 72.0
+ eUnit = XML_UNIT_PC;
+ break;
+
+ case MAP_INCH:
+ default:
+ DBG_ASSERT(MAP_INCH == eDestUnit, "output unit not supported for pt values");
+ // 1in = 72 pt (exactly)
+ fRetval = ( 1.0 / 72.0 );
+ eUnit = XML_UNIT_INCH;
+ break;
+ }
+ break;
+ }
+ case MAP_10TH_MM:
+ {
+ switch(eDestUnit)
+ {
+ case MAP_100TH_MM:
+ case MAP_10TH_MM:
+ {
+ DBG_ASSERT(MAP_INCH == eDestUnit, "output unit not supported for 1/100mm values");
+ }
+ case MAP_MM:
+ {
+ // 0.01mm = 1 mm/100 (exactly)
+ fRetval = ((10.0 / 1.0) / 100.0);
+ eUnit = XML_UNIT_MM;
+ break;
+ }
+ case MAP_CM:
+ {
+ // 0.001mm = 1 mm/100 (exactly)
+ fRetval = ((10.0 / 1.0) / 1000.0);
+ eUnit = XML_UNIT_CM;
+ break;
+ }
+ case MAP_POINT:
+ {
+ // 0.01pt = 0.35 mm/100 (exactly)
+ fRetval = ((72000.0 / 2540.0) / 100.0);
+ eUnit = XML_UNIT_PT;
+ break;
+ }
+ case MAP_INCH:
+ default:
+ {
+ DBG_ASSERT(MAP_INCH == eDestUnit, "output unit not supported for 1/100mm values");
+ // 0.0001in = 0.254 mm/100 (exactly)
+ fRetval = ((100000.0 / 2540.0) / 10000.0);
+ eUnit = XML_UNIT_INCH;
+ break;
+ }
+ }
+ break;
+ }
+ case MAP_100TH_MM:
+ {
+ switch(eDestUnit)
+ {
+ case MAP_100TH_MM:
+ case MAP_10TH_MM:
+ {
+ DBG_ASSERT(MAP_INCH == eDestUnit, "output unit not supported for 1/100mm values");
+ }
+ case MAP_MM:
+ {
+ // 0.01mm = 1 mm/100 (exactly)
+ fRetval = ((10.0 / 1.0) / 1000.0);
+ eUnit = XML_UNIT_MM;
+ break;
+ }
+ case MAP_CM:
+ {
+ // 0.001mm = 1 mm/100 (exactly)
+ fRetval = ((10.0 / 1.0) / 10000.0);
+ eUnit = XML_UNIT_CM;
+ break;
+ }
+ case MAP_POINT:
+ {
+ // 0.01pt = 0.35 mm/100 (exactly)
+ fRetval = ((72000.0 / 2540.0) / 1000.0);
+ eUnit = XML_UNIT_PT;
+ break;
+ }
+ case MAP_INCH:
+ default:
+ {
+ DBG_ASSERT(MAP_INCH == eDestUnit, "output unit not supported for 1/100mm values");
+ // 0.0001in = 0.254 mm/100 (exactly)
+ fRetval = ((100000.0 / 2540.0) / 100000.0);
+ eUnit = XML_UNIT_INCH;
+ break;
+ }
+ }
+ break;
+ }
+ default:
+ OSL_FAIL("xmloff::SvXMLExportHelper::GetConversionFactor(), illegal eCoreUnit value!");
+ break;
+ }
+
+ if(eUnit != XML_TOKEN_INVALID)
+ rUnit.append(GetXMLToken(eUnit));
+ }
+
+ return fRetval;
+}
+
+MapUnit SvXMLExportHelper::GetUnitFromString(const ::rtl::OUString& rString, MapUnit eDefaultUnit)
+{
+ sal_Int32 nPos = 0;
+ sal_Int32 nLen = rString.getLength();
+ MapUnit eRetUnit = eDefaultUnit;
+
+ // skip white space
+ while( nPos < nLen && sal_Unicode(' ') == rString[nPos] )
+ nPos++;
+
+ // skip negative
+ if( nPos < nLen && sal_Unicode('-') == rString[nPos] )
+ nPos++;
+
+ // skip number
+ while( nPos < nLen && sal_Unicode('0') <= rString[nPos] && sal_Unicode('9') >= rString[nPos] )
+ nPos++;
+
+ if( nPos < nLen && sal_Unicode('.') == rString[nPos] )
+ {
+ nPos++;
+ while( nPos < nLen && sal_Unicode('0') <= rString[nPos] && sal_Unicode('9') >= rString[nPos] )
+ nPos++;
+ }
+
+ // skip white space
+ while( nPos < nLen && sal_Unicode(' ') == rString[nPos] )
+ nPos++;
+
+ if( nPos < nLen )
+ {
+ switch(rString[nPos])
+ {
+ case sal_Unicode('%') :
+ {
+ eRetUnit = MAP_RELATIVE;
+ break;
+ }
+ case sal_Unicode('c'):
+ case sal_Unicode('C'):
+ {
+ if(nPos+1 < nLen && (rString[nPos+1] == sal_Unicode('m')
+ || rString[nPos+1] == sal_Unicode('M')))
+ eRetUnit = MAP_CM;
+ break;
+ }
+ case sal_Unicode('e'):
+ case sal_Unicode('E'):
+ {
+ // CSS1_EMS or CSS1_EMX later
+ break;
+ }
+ case sal_Unicode('i'):
+ case sal_Unicode('I'):
+ {
+ if(nPos+1 < nLen && (rString[nPos+1] == sal_Unicode('n')
+ || rString[nPos+1] == sal_Unicode('n')))
+ eRetUnit = MAP_INCH;
+ break;
+ }
+ case sal_Unicode('m'):
+ case sal_Unicode('M'):
+ {
+ if(nPos+1 < nLen && (rString[nPos+1] == sal_Unicode('m')
+ || rString[nPos+1] == sal_Unicode('M')))
+ eRetUnit = MAP_MM;
+ break;
+ }
+ case sal_Unicode('p'):
+ case sal_Unicode('P'):
+ {
+ if(nPos+1 < nLen && (rString[nPos+1] == sal_Unicode('t')
+ || rString[nPos+1] == sal_Unicode('T')))
+ eRetUnit = MAP_POINT;
+ if(nPos+1 < nLen && (rString[nPos+1] == sal_Unicode('c')
+ || rString[nPos+1] == sal_Unicode('C')))
+ eRetUnit = MAP_TWIP;
+ break;
+ }
+ }
+ }
+
+ return eRetUnit;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/core/xmlenums.hxx b/xmloff/source/core/xmlenums.hxx
new file mode 100644
index 000000000000..5a4a881da446
--- /dev/null
+++ b/xmloff/source/core/xmlenums.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLENUMS_HXX_
+#define _XMLENUMS_HXX_
+
+enum XMLForbiddenCharactersEnum
+{
+ XML_FORBIDDEN_CHARACTER_LANGUAGE,
+ XML_FORBIDDEN_CHARACTER_COUNTRY,
+ XML_FORBIDDEN_CHARACTER_VARIANT,
+ XML_FORBIDDEN_CHARACTER_BEGIN_LINE,
+ XML_FORBIDDEN_CHARACTER_END_LINE,
+ XML_FORBIDDEN_CHARACTER_MAX
+};
+
+enum XMLSymbolDescriptorsEnum
+{
+ XML_SYMBOL_DESCRIPTOR_NAME,
+ XML_SYMBOL_DESCRIPTOR_EXPORT_NAME,
+ XML_SYMBOL_DESCRIPTOR_SYMBOL_SET,
+ XML_SYMBOL_DESCRIPTOR_CHARACTER,
+ XML_SYMBOL_DESCRIPTOR_FONT_NAME,
+ XML_SYMBOL_DESCRIPTOR_CHAR_SET,
+ XML_SYMBOL_DESCRIPTOR_FAMILY,
+ XML_SYMBOL_DESCRIPTOR_PITCH,
+ XML_SYMBOL_DESCRIPTOR_WEIGHT,
+ XML_SYMBOL_DESCRIPTOR_ITALIC,
+ XML_SYMBOL_DESCRIPTOR_MAX
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/core/xmlerror.cxx b/xmloff/source/core/xmlerror.cxx
new file mode 100644
index 000000000000..640720166428
--- /dev/null
+++ b/xmloff/source/core/xmlerror.cxx
@@ -0,0 +1,260 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "xmloff/xmlerror.hxx"
+#include <tools/debug.hxx>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/xml/sax/XLocator.hpp>
+#include <com/sun/star/xml/sax/SAXParseException.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+
+
+#include <rtl/ustrbuf.hxx>
+#include <tools/string.hxx>
+
+
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::xml::sax::XLocator;
+using ::com::sun::star::xml::sax::SAXParseException;
+
+
+//
+/// ErrorRecord: contains all information for one error
+//
+
+class ErrorRecord
+{
+public:
+
+ ErrorRecord( sal_Int32 nId,
+ const Sequence<OUString>& rParams,
+ const OUString& rExceptionMessage,
+ sal_Int32 nRow,
+ sal_Int32 nColumn,
+ const OUString& rPublicId,
+ const OUString& rSystemId);
+ ~ErrorRecord();
+
+ sal_Int32 nId; /// error ID
+
+ OUString sExceptionMessage;/// message of original exception (if available)
+
+ // XLocator information:
+ sal_Int32 nRow; /// row number where error occurred (or -1 for unknown)
+ sal_Int32 nColumn; /// column number where error occurred (or -1)
+ OUString sPublicId; /// public identifier
+ OUString sSystemId; /// public identifier
+
+ /// message Parameters
+ Sequence<OUString> aParams;
+};
+
+
+ErrorRecord::ErrorRecord( sal_Int32 nID, const Sequence<OUString>& rParams,
+ const OUString& rExceptionMessage, sal_Int32 nRowNumber, sal_Int32 nCol,
+ const OUString& rPublicId, const OUString& rSystemId) :
+ nId(nID),
+ sExceptionMessage(rExceptionMessage),
+ nRow(nRowNumber),
+ nColumn(nCol),
+ sPublicId(rPublicId),
+ sSystemId(rSystemId),
+ aParams(rParams)
+{
+}
+
+ErrorRecord::~ErrorRecord()
+{
+}
+
+
+
+
+XMLErrors::XMLErrors()
+{
+}
+
+XMLErrors::~XMLErrors()
+{
+}
+
+void XMLErrors::AddRecord(
+ sal_Int32 nId,
+ const Sequence<OUString> & rParams,
+ const OUString& rExceptionMessage,
+ sal_Int32 nRow,
+ sal_Int32 nColumn,
+ const OUString& rPublicId,
+ const OUString& rSystemId )
+{
+ aErrors.push_back( ErrorRecord( nId, rParams, rExceptionMessage,
+ nRow, nColumn, rPublicId, rSystemId ) );
+
+#ifdef DBG_UTIL
+
+ // give detailed assertion on this message
+
+ OUStringBuffer sMessage;
+
+ sMessage.appendAscii( "An error or a warning has occurred during XML import/export!\n" );
+
+ // ID & flags
+ sMessage.appendAscii( "Error-Id: 0x");
+ sMessage.append( nId, 16 );
+ sMessage.appendAscii( "\n Flags: " );
+ sal_Int32 nFlags = (nId & XMLERROR_MASK_FLAG);
+ sMessage.append( nFlags >> 28, 16 );
+ if( (nFlags & XMLERROR_FLAG_WARNING) != 0 )
+ sMessage.appendAscii( " WARNING" );
+ if( (nFlags & XMLERROR_FLAG_ERROR) != 0 )
+ sMessage.appendAscii( " ERRROR" );
+ if( (nFlags & XMLERROR_FLAG_SEVERE) != 0 )
+ sMessage.appendAscii( " SEVERE" );
+ sMessage.appendAscii( "\n Class: " );
+ sal_Int32 nClass = (nId & XMLERROR_MASK_CLASS);
+ sMessage.append( nClass >> 16, 16 );
+ if( (nClass & XMLERROR_CLASS_IO) != 0 )
+ sMessage.appendAscii( " IO" );
+ if( (nClass & XMLERROR_CLASS_FORMAT) != 0 )
+ sMessage.appendAscii( " FORMAT" );
+ if( (nClass & XMLERROR_CLASS_API) != 0 )
+ sMessage.appendAscii( " API" );
+ if( (nClass & XMLERROR_CLASS_OTHER) != 0 )
+ sMessage.appendAscii( " OTHER" );
+ sMessage.appendAscii( "\n Number: " );
+ sal_Int32 nNumber = (nId & XMLERROR_MASK_NUMBER);
+ sMessage.append( nNumber, 16 );
+ sMessage.appendAscii( "\n");
+
+ // the parameters
+ sMessage.appendAscii( "Parameters:\n" );
+ sal_Int32 nLength = rParams.getLength();
+ const OUString* pParams = rParams.getConstArray();
+ for( sal_Int32 i = 0; i < nLength; i++ )
+ {
+ sMessage.appendAscii( " " );
+ sMessage.append( i );
+ sMessage.appendAscii( ": " );
+ sMessage.append( pParams[i] );
+ sMessage.appendAscii( "\n" );
+ }
+
+ // the exception message
+ sMessage.appendAscii( "Exception-Message: " );
+ sMessage.append( rExceptionMessage );
+ sMessage.appendAscii( "\n" );
+
+ // position (if given)
+ if( (nRow != -1) || (nColumn != -1) )
+ {
+ sMessage.appendAscii( "Position:\n Public Identifier: " );
+ sMessage.append( rPublicId );
+ sMessage.appendAscii( "\n System Identifier: " );
+ sMessage.append( rSystemId );
+ sMessage.appendAscii( "\n Row, Column: " );
+ sMessage.append( nRow );
+ sMessage.appendAscii( "," );
+ sMessage.append( nColumn );
+ sMessage.appendAscii( "\n" );
+ }
+
+ // convert to byte string and signal the error
+ ByteString aError( String( sMessage.makeStringAndClear() ),
+ RTL_TEXTENCODING_ASCII_US );
+ OSL_FAIL( aError.GetBuffer() );
+#endif
+}
+
+void XMLErrors::AddRecord(
+ sal_Int32 nId,
+ const Sequence<OUString> & rParams,
+ const OUString& rExceptionMessage,
+ const Reference<XLocator> & rLocator)
+{
+ if ( rLocator.is() )
+ {
+ AddRecord( nId, rParams, rExceptionMessage,
+ rLocator->getLineNumber(), rLocator->getColumnNumber(),
+ rLocator->getPublicId(), rLocator->getSystemId() );
+ }
+ else
+ {
+ OUString sEmpty;
+ AddRecord( nId, rParams, rExceptionMessage,
+ -1, -1, sEmpty, sEmpty );
+ }
+}
+
+void XMLErrors::AddRecord(
+ sal_Int32 nId,
+ const Sequence<OUString> & rParams,
+ const OUString& rExceptionMessage)
+{
+ OUString sEmpty;
+ AddRecord( nId, rParams, rExceptionMessage, -1, -1, sEmpty, sEmpty );
+}
+
+void XMLErrors::AddRecord(
+ sal_Int32 nId,
+ const Sequence<OUString> & rParams)
+{
+ OUString sEmpty;
+ AddRecord( nId, rParams, sEmpty, -1, -1, sEmpty, sEmpty );
+}
+
+void XMLErrors::ThrowErrorAsSAXException(sal_Int32 nIdMask)
+ throw( SAXParseException )
+{
+ // search first error/warning that matches the nIdMask
+ for( ErrorList::iterator aIter = aErrors.begin();
+ aIter != aErrors.end();
+ ++aIter )
+ {
+ if ( (aIter->nId & nIdMask) != 0 )
+ {
+ // we throw the error
+ ErrorRecord& rErr = aErrors[0];
+ Any aAny;
+ aAny <<= rErr.aParams;
+ throw SAXParseException(
+ rErr.sExceptionMessage, NULL, aAny,
+ rErr.sPublicId, rErr.sSystemId, rErr.nRow, rErr.nColumn );
+ }
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
new file mode 100644
index 000000000000..03659c39b2dd
--- /dev/null
+++ b/xmloff/source/core/xmlexp.cxx
@@ -0,0 +1,2687 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#ifdef PRECOMPILED
+#include "filt_pch.hxx"
+#endif
+#include "unointerfacetouniqueidentifiermapper.hxx"
+#include <osl/mutex.hxx>
+#include <rtl/uuid.h>
+#include <tools/debug.hxx>
+#include <tools/urlobj.hxx>
+#include <comphelper/genericpropertyset.hxx>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/document/XBinaryStreamResolver.hpp>
+#include <com/sun/star/xml/sax/SAXInvalidCharacterException.hpp>
+#include <com/sun/star/uri/XUriReferenceFactory.hpp>
+#include <com/sun/star/uri/UriReferenceFactory.hpp>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/configurationhelper.hxx>
+#include <xmloff/attrlist.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmlnumfe.hxx>
+#include <xmloff/xmlmetae.hxx>
+#include <xmloff/XMLSettingsExportContext.hxx>
+#include <xmloff/families.hxx>
+#include <xmloff/XMLEventExport.hxx>
+#include "XMLStarBasicExportHandler.hxx"
+#include "XMLScriptExportHandler.hxx"
+#include <xmloff/SettingsExportHelper.hxx>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#include <com/sun/star/document/XViewDataSupplier.hpp>
+#include <xmloff/GradientStyle.hxx>
+#include <xmloff/HatchStyle.hxx>
+#include <xmloff/ImageStyle.hxx>
+#include <TransGradientStyle.hxx>
+#include <xmloff/MarkerStyle.hxx>
+#include <xmloff/DashStyle.hxx>
+#include <xmloff/XMLFontAutoStylePool.hxx>
+#include "XMLImageMapExport.hxx"
+#include "XMLBase64Export.hxx"
+#include "xmloff/xmlerror.hxx"
+#include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include "xmloff/XMLFilterServiceNames.h"
+#include "xmloff/XMLEmbeddedObjectExportFilter.hxx"
+#include "XMLBasicExportFilter.hxx"
+#include <osl/mutex.hxx>
+#include <rtl/logfile.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/extract.hxx>
+#include "PropertySetMerger.hxx"
+
+#include "svl/urihelper.hxx"
+#include "xmloff/xformsexport.hxx"
+
+#include <unotools/docinfohelper.hxx>
+#include <unotools/bootstrap.hxx>
+#include <unotools/configmgr.hxx>
+#include <tools/inetdef.hxx>
+#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+
+#include <com/sun/star/rdf/XMetadatable.hpp>
+#include "RDFaExportHelper.hxx"
+
+
+using ::rtl::OUString;
+
+using namespace ::osl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::document;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::io;
+using namespace ::xmloff::token;
+
+sal_Char const sXML_1_1[] = "1.1";
+sal_Char const sXML_1_2[] = "1.2";
+
+// #i115030#: the XSLT is not finished, and not available via HTTP
+const sal_Char s_grddl_xsl[] = "http://FIXME";
+
+#define LOGFILE_AUTHOR "mb93740"
+
+#define XML_MODEL_SERVICE_WRITER "com.sun.star.text.TextDocument"
+#define XML_MODEL_SERVICE_CALC "com.sun.star.sheet.SpreadsheetDocument"
+#define XML_MODEL_SERVICE_DRAW "com.sun.star.drawing.DrawingDocument"
+#define XML_MODEL_SERVICE_IMPRESS "com.sun.star.presentation.PresentationDocument"
+#define XML_MODEL_SERVICE_MATH "com.sun.star.formula.FormulaProperties"
+#define XML_MODEL_SERVICE_CHART "com.sun.star.chart.ChartDocument"
+
+#define XML_USEPRETTYPRINTING "UsePrettyPrinting"
+
+#define C2U(cChar) OUString( RTL_CONSTASCII_USTRINGPARAM(cChar) )
+
+struct XMLServiceMapEntry_Impl
+{
+ const sal_Char *sModelService;
+ sal_Int32 nModelServiceLen;
+ const sal_Char *sFilterService;
+ sal_Int32 nFilterServiceLen;
+};
+
+#define SERVICE_MAP_ENTRY( app ) \
+ { XML_MODEL_SERVICE_##app, sizeof(XML_MODEL_SERVICE_##app)-1, \
+ XML_EXPORT_FILTER_##app, sizeof(XML_EXPORT_FILTER_##app)-1 }
+
+const XMLServiceMapEntry_Impl aServiceMap[] =
+{
+ SERVICE_MAP_ENTRY( WRITER ),
+ SERVICE_MAP_ENTRY( CALC ),
+ SERVICE_MAP_ENTRY( IMPRESS ),// Impress supports DrawingDocument, too, so
+ SERVICE_MAP_ENTRY( DRAW ), // it must appear before Draw
+ SERVICE_MAP_ENTRY( MATH ),
+ SERVICE_MAP_ENTRY( CHART ),
+ { 0, 0, 0, 0 }
+};
+
+//==============================================================================
+
+class SAL_DLLPRIVATE SettingsExportFacade : public ::xmloff::XMLSettingsExportContext
+{
+public:
+ SettingsExportFacade( SvXMLExport& i_rExport )
+ :m_rExport( i_rExport )
+ {
+ }
+
+ virtual ~SettingsExportFacade()
+ {
+ }
+
+ virtual void AddAttribute( enum ::xmloff::token::XMLTokenEnum i_eName,
+ const ::rtl::OUString& i_rValue );
+ virtual void AddAttribute( enum ::xmloff::token::XMLTokenEnum i_eName,
+ enum ::xmloff::token::XMLTokenEnum i_eValue );
+
+ virtual void StartElement( enum ::xmloff::token::XMLTokenEnum i_eName,
+ const sal_Bool i_bIgnoreWhitespace );
+ virtual void EndElement( const sal_Bool i_bIgnoreWhitespace );
+
+ virtual void Characters( const ::rtl::OUString& i_rCharacters );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
+ GetServiceFactory() const;
+private:
+ SvXMLExport& m_rExport;
+ ::std::stack< ::rtl::OUString > m_aElements;
+};
+
+void SettingsExportFacade::AddAttribute( enum ::xmloff::token::XMLTokenEnum i_eName, const ::rtl::OUString& i_rValue )
+{
+ m_rExport.AddAttribute( XML_NAMESPACE_CONFIG, i_eName, i_rValue );
+}
+
+void SettingsExportFacade::AddAttribute( enum ::xmloff::token::XMLTokenEnum i_eName, enum ::xmloff::token::XMLTokenEnum i_eValue )
+{
+ m_rExport.AddAttribute( XML_NAMESPACE_CONFIG, i_eName, i_eValue );
+}
+
+void SettingsExportFacade::StartElement( enum ::xmloff::token::XMLTokenEnum i_eName, const sal_Bool i_bIgnoreWhitespace )
+{
+ const ::rtl::OUString sElementName( m_rExport.GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_CONFIG, GetXMLToken( i_eName ) ) );
+ m_rExport.StartElement( sElementName, i_bIgnoreWhitespace );
+ m_aElements.push( sElementName );
+}
+
+void SettingsExportFacade::EndElement( const sal_Bool i_bIgnoreWhitespace )
+{
+ const ::rtl::OUString sElementName( m_aElements.top() );
+ m_rExport.EndElement( sElementName, i_bIgnoreWhitespace );
+ m_aElements.pop();
+}
+
+void SettingsExportFacade::Characters( const ::rtl::OUString& i_rCharacters )
+{
+ m_rExport.GetDocHandler()->characters( i_rCharacters );
+}
+
+Reference< XMultiServiceFactory > SettingsExportFacade::GetServiceFactory() const
+{
+ return m_rExport.getServiceFactory();
+}
+
+//==============================================================================
+
+class SvXMLExportEventListener : public cppu::WeakImplHelper1<
+ com::sun::star::lang::XEventListener >
+{
+private:
+ SvXMLExport* pExport;
+
+public:
+ SvXMLExportEventListener(SvXMLExport* pExport);
+ virtual ~SvXMLExportEventListener();
+
+ // XEventListener
+ virtual void SAL_CALL disposing(const lang::EventObject& rEventObject) throw(::com::sun::star::uno::RuntimeException);
+};
+
+SvXMLExportEventListener::SvXMLExportEventListener(SvXMLExport* pTempExport)
+ : pExport(pTempExport)
+{
+}
+
+SvXMLExportEventListener::~SvXMLExportEventListener()
+{
+}
+
+// XEventListener
+void SAL_CALL SvXMLExportEventListener::disposing( const lang::EventObject& )
+ throw(uno::RuntimeException)
+{
+ if (pExport)
+ {
+ pExport->DisposingModel();
+ pExport = NULL;
+ }
+}
+
+//==============================================================================
+
+class SvXMLExport_Impl
+{
+public:
+ SvXMLExport_Impl();
+
+ ::comphelper::UnoInterfaceToUniqueIdentifierMapper maInterfaceToIdentifierMapper;
+ uno::Reference< uri::XUriReferenceFactory > mxUriReferenceFactory;
+ rtl::OUString msPackageURI;
+ rtl::OUString msPackageURIScheme;
+ // Written OpenDocument file format doesn't fit to the created text document (#i69627#)
+ sal_Bool mbOutlineStyleAsNormalListStyle;
+ sal_Bool mbSaveBackwardCompatibleODF;
+
+ uno::Reference< embed::XStorage > mxTargetStorage;
+
+ SvtSaveOptions maSaveOptions;
+
+ /// relative path of stream in package, e.g. "someobject/content.xml"
+ ::rtl::OUString mStreamPath;
+
+ const uno::Reference< uno::XComponentContext > mxComponentContext;
+
+ /// name of stream in package, e.g., "content.xml"
+ ::rtl::OUString mStreamName;
+
+ /// stack of backed up namespace maps
+ /// long: depth at which namespace map has been backed up into the stack
+ ::std::stack< ::std::pair< SvXMLNamespaceMap *, long > > mNamespaceMaps;
+ /// counts depth (number of open elements/start tags)
+ long mDepth;
+
+ ::std::auto_ptr< ::xmloff::RDFaExportHelper> mpRDFaHelper;
+
+ sal_Bool mbExportTextNumberElement;
+ sal_Bool mbNullDateInitialized;
+
+ void SetSchemeOf( const ::rtl::OUString& rOrigFileName )
+ {
+ sal_Int32 nSep = rOrigFileName.indexOf(':');
+ if( nSep != -1 )
+ msPackageURIScheme = rOrigFileName.copy( 0, nSep );
+ }
+};
+
+SvXMLExport_Impl::SvXMLExport_Impl()
+ // Written OpenDocument file format doesn't fit to the created text document (#i69627#)
+ : mbOutlineStyleAsNormalListStyle( false )
+ ,mbSaveBackwardCompatibleODF( sal_True )
+ ,mxComponentContext( ::comphelper::getProcessComponentContext() )
+ ,mStreamName()
+ ,mNamespaceMaps()
+ ,mDepth(0)
+ ,mpRDFaHelper() // lazy
+ ,mbExportTextNumberElement( sal_False )
+ ,mbNullDateInitialized( sal_False )
+{
+ OSL_ENSURE(mxComponentContext.is(), "SvXMLExport: no ComponentContext");
+ if (!mxComponentContext.is()) throw uno::RuntimeException();
+ mxUriReferenceFactory = uri::UriReferenceFactory::create(
+ mxComponentContext );
+}
+
+//==============================================================================
+
+void SvXMLExport::SetDocHandler( const uno::Reference< xml::sax::XDocumentHandler > &rHandler )
+{
+ mxHandler = rHandler;
+ mxExtHandler = uno::Reference<xml::sax::XExtendedDocumentHandler>( mxHandler, UNO_QUERY );
+}
+
+void SvXMLExport::_InitCtor()
+{
+ // note: it is not necessary to add XML_NP_XML (it is declared implicitly)
+ if( (getExportFlags() & ~EXPORT_OASIS) != 0 )
+ {
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_OFFICE), GetXMLToken(XML_N_OFFICE), XML_NAMESPACE_OFFICE );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_OOO), GetXMLToken(XML_N_OOO), XML_NAMESPACE_OOO );
+ }
+ if( (getExportFlags() & (EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_FONTDECLS) ) != 0 )
+ {
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_FO), GetXMLToken(XML_N_FO_COMPAT), XML_NAMESPACE_FO );
+ }
+ if( (getExportFlags() & (EXPORT_META|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_SETTINGS) ) != 0 )
+ {
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_XLINK), GetXMLToken(XML_N_XLINK), XML_NAMESPACE_XLINK );
+ }
+ if( (getExportFlags() & EXPORT_SETTINGS) != 0 )
+ {
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_CONFIG), GetXMLToken(XML_N_CONFIG), XML_NAMESPACE_CONFIG );
+ }
+
+ if( (getExportFlags() & (EXPORT_META|EXPORT_MASTERSTYLES|EXPORT_CONTENT) ) != 0 )
+ {
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_DC), GetXMLToken(XML_N_DC), XML_NAMESPACE_DC );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_META), GetXMLToken(XML_N_META), XML_NAMESPACE_META );
+ }
+ if( (getExportFlags() & (EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_FONTDECLS) ) != 0 )
+ {
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_STYLE), GetXMLToken(XML_N_STYLE), XML_NAMESPACE_STYLE );
+ }
+
+ // namespaces for documents
+ if( (getExportFlags() & (EXPORT_STYLES|EXPORT_AUTOSTYLES|EXPORT_MASTERSTYLES|EXPORT_CONTENT) ) != 0 )
+ {
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_DC), GetXMLToken(XML_N_DC), XML_NAMESPACE_DC );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_TEXT), GetXMLToken(XML_N_TEXT), XML_NAMESPACE_TEXT );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_DRAW), GetXMLToken(XML_N_DRAW), XML_NAMESPACE_DRAW );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_DR3D), GetXMLToken(XML_N_DR3D), XML_NAMESPACE_DR3D );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_SVG), GetXMLToken(XML_N_SVG_COMPAT), XML_NAMESPACE_SVG );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_CHART), GetXMLToken(XML_N_CHART), XML_NAMESPACE_CHART );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_RPT), GetXMLToken(XML_N_RPT), XML_NAMESPACE_REPORT );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_TABLE), GetXMLToken(XML_N_TABLE), XML_NAMESPACE_TABLE );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_NUMBER),GetXMLToken(XML_N_NUMBER), XML_NAMESPACE_NUMBER );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_OOOW), GetXMLToken(XML_N_OOOW), XML_NAMESPACE_OOOW );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_OOOC), GetXMLToken(XML_N_OOOC), XML_NAMESPACE_OOOC );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_OF), GetXMLToken(XML_N_OF), XML_NAMESPACE_OF );
+
+ if (getDefaultVersion() > SvtSaveOptions::ODFVER_012)
+ {
+ mpNamespaceMap->Add(
+ GetXMLToken(XML_NP_TABLE_EXT), GetXMLToken(XML_N_TABLE_EXT), XML_NAMESPACE_TABLE_EXT);
+ }
+ }
+ if( (getExportFlags() & (EXPORT_MASTERSTYLES|EXPORT_CONTENT) ) != 0 )
+ {
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_MATH), GetXMLToken(XML_N_MATH), XML_NAMESPACE_MATH );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_FORM), GetXMLToken(XML_N_FORM), XML_NAMESPACE_FORM );
+ }
+ if( (getExportFlags() & (EXPORT_STYLES|EXPORT_AUTOSTYLES|EXPORT_MASTERSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS) ) != 0 )
+ {
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_SCRIPT), GetXMLToken(XML_N_SCRIPT), XML_NAMESPACE_SCRIPT );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_DOM), GetXMLToken(XML_N_DOM), XML_NAMESPACE_DOM );
+ }
+ if( (getExportFlags() & EXPORT_CONTENT ) != 0 )
+ {
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_XFORMS_1_0), GetXMLToken(XML_N_XFORMS_1_0), XML_NAMESPACE_XFORMS );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_XSD), GetXMLToken(XML_N_XSD), XML_NAMESPACE_XSD );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_XSI), GetXMLToken(XML_N_XSI), XML_NAMESPACE_XSI );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_FIELD), GetXMLToken(XML_N_FIELD), XML_NAMESPACE_FIELD );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_FORMX), GetXMLToken(XML_N_FORMX), XML_NAMESPACE_FORMX );
+ }
+ // RDFa: needed for content and header/footer styles
+ if( (getExportFlags() & (EXPORT_STYLES|EXPORT_AUTOSTYLES|EXPORT_MASTERSTYLES|EXPORT_CONTENT) ) != 0 )
+ {
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_XHTML),
+ GetXMLToken(XML_N_XHTML), XML_NAMESPACE_XHTML );
+ }
+ // GRDDL: to convert RDFa and meta.xml to RDF
+ if( (getExportFlags() & (EXPORT_META|EXPORT_STYLES|EXPORT_AUTOSTYLES|EXPORT_MASTERSTYLES|EXPORT_CONTENT) ) != 0 )
+ {
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_GRDDL),
+ GetXMLToken(XML_N_GRDDL), XML_NAMESPACE_GRDDL );
+ }
+ // CSS Text Level 3 for distributed text justification.
+ if ( (getExportFlags() & (EXPORT_STYLES|EXPORT_AUTOSTYLES|EXPORT_MASTERSTYLES)) != 0 )
+ {
+ mpNamespaceMap->Add(
+ GetXMLToken(XML_NP_CSS3TEXT), GetXMLToken(XML_N_CSS3TEXT), XML_NAMESPACE_CSS3TEXT );
+ }
+
+ mxAttrList = (xml::sax::XAttributeList*)mpAttrList;
+
+ msPicturesPath = OUString( RTL_CONSTASCII_USTRINGPARAM( "#Pictures/" ) );
+ msObjectsPath = OUString( RTL_CONSTASCII_USTRINGPARAM( "#./" ) );
+ msGraphicObjectProtocol = OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.GraphicObject:" ) );
+ msEmbeddedObjectProtocol = OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.EmbeddedObject:" ) );
+
+ if (mxModel.is() && !mxEventListener.is())
+ {
+ mxEventListener.set( new SvXMLExportEventListener(this));
+ mxModel->addEventListener(mxEventListener);
+ }
+
+ // Determine model type (#i51726#)
+ _DetermineModelType();
+
+ mbEnableExperimentalOdfExport = getenv("ENABLE_EXPERIMENTAL_ODF_EXPORT") != NULL;
+
+ // cl: but only if we do export to current oasis format, old openoffice format *must* always be compatible
+ if( (getExportFlags() & EXPORT_OASIS) != 0 )
+ {
+ sal_Bool bTemp = sal_True;
+ if ( ::comphelper::ConfigurationHelper::readDirectKey(
+ getServiceFactory(),
+ C2U("org.openoffice.Office.Common/"), C2U("Save/Document"), C2U("SaveBackwardCompatibleODF"),
+ ::comphelper::ConfigurationHelper::E_READONLY ) >>= bTemp )
+ {
+ mpImpl->mbSaveBackwardCompatibleODF = bTemp;
+ }
+ }
+ // <--
+}
+
+// Shapes in Writer cannot be named via context menu (#i51726#)
+void SvXMLExport::_DetermineModelType()
+{
+ meModelType = SvtModuleOptions::E_UNKNOWN_FACTORY;
+
+ if ( mxModel.is() )
+ {
+ meModelType = SvtModuleOptions::ClassifyFactoryByModel( mxModel );
+ }
+}
+
+SvXMLExport::SvXMLExport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ MapUnit eDfltUnit, const enum XMLTokenEnum eClass, sal_uInt16 nExportFlags )
+: mpImpl( new SvXMLExport_Impl ),
+ mxServiceFactory(xServiceFactory),
+ mpAttrList( new SvXMLAttributeList ),
+ mpNamespaceMap( new SvXMLNamespaceMap ),
+ mpUnitConv( new SvXMLUnitConverter( MAP_100TH_MM, eDfltUnit, getServiceFactory() ) ),
+ mpNumExport(0L),
+ mpProgressBarHelper( NULL ),
+ mpEventExport( NULL ),
+ mpImageMapExport( NULL ),
+ mpXMLErrors( NULL ),
+ mbExtended( sal_False ),
+ meClass( eClass ),
+ mnExportFlags( nExportFlags ),
+ mnErrorFlags( ERROR_NO ),
+ msWS( GetXMLToken(XML_WS) ),
+ mbSaveLinkedSections(sal_True)
+{
+ DBG_ASSERT( mxServiceFactory.is(), "got no service manager" );
+ _InitCtor();
+}
+
+SvXMLExport::SvXMLExport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ const OUString &rFileName,
+ const uno::Reference< xml::sax::XDocumentHandler > & rHandler,
+ MapUnit eDfltUnit )
+: mpImpl( new SvXMLExport_Impl ),
+ mxServiceFactory(xServiceFactory),
+ mxHandler( rHandler ),
+ mxExtHandler( rHandler, uno::UNO_QUERY ),
+ mpAttrList( new SvXMLAttributeList ),
+ msOrigFileName( rFileName ),
+ mpNamespaceMap( new SvXMLNamespaceMap ),
+ mpUnitConv( new SvXMLUnitConverter( MAP_100TH_MM, eDfltUnit, getServiceFactory() ) ),
+ mpNumExport(0L),
+ mpProgressBarHelper( NULL ),
+ mpEventExport( NULL ),
+ mpImageMapExport( NULL ),
+ mpXMLErrors( NULL ),
+ mbExtended( sal_False ),
+ meClass( XML_TOKEN_INVALID ),
+ mnExportFlags( 0 ),
+ mnErrorFlags( ERROR_NO ),
+ msWS( GetXMLToken(XML_WS) ),
+ mbSaveLinkedSections(sal_True)
+{
+ mpImpl->SetSchemeOf( msOrigFileName );
+ DBG_ASSERT( mxServiceFactory.is(), "got no service manager" );
+ _InitCtor();
+
+ if (mxNumberFormatsSupplier.is())
+ mpNumExport = new SvXMLNumFmtExport(*this, mxNumberFormatsSupplier);
+}
+
+SvXMLExport::SvXMLExport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ const OUString &rFileName,
+ const uno::Reference< xml::sax::XDocumentHandler > & rHandler,
+ const Reference< XModel >& rModel,
+ sal_Int16 eDfltUnit )
+: mpImpl( new SvXMLExport_Impl ),
+ mxServiceFactory(xServiceFactory),
+ mxModel( rModel ),
+ mxHandler( rHandler ),
+ mxExtHandler( rHandler, uno::UNO_QUERY ),
+ mxNumberFormatsSupplier (rModel, uno::UNO_QUERY),
+ mpAttrList( new SvXMLAttributeList ),
+ msOrigFileName( rFileName ),
+ mpNamespaceMap( new SvXMLNamespaceMap ),
+ mpUnitConv( new SvXMLUnitConverter( MAP_100TH_MM, SvXMLUnitConverter::GetMapUnit(eDfltUnit), getServiceFactory() ) ),
+ mpNumExport(0L),
+ mpProgressBarHelper( NULL ),
+ mpEventExport( NULL ),
+ mpImageMapExport( NULL ),
+ mpXMLErrors( NULL ),
+ mbExtended( sal_False ),
+ meClass( XML_TOKEN_INVALID ),
+ mnExportFlags( 0 ),
+ mnErrorFlags( ERROR_NO ),
+ msWS( GetXMLToken(XML_WS) ),
+ mbSaveLinkedSections(sal_True)
+{
+ mpImpl->SetSchemeOf( msOrigFileName );
+ DBG_ASSERT( mxServiceFactory.is(), "got no service manager" );
+ _InitCtor();
+
+ if (mxNumberFormatsSupplier.is())
+ mpNumExport = new SvXMLNumFmtExport(*this, mxNumberFormatsSupplier);
+}
+
+SvXMLExport::SvXMLExport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ const OUString &rFileName,
+ const uno::Reference< xml::sax::XDocumentHandler > & rHandler,
+ const Reference< XModel >& rModel,
+ const Reference< document::XGraphicObjectResolver >& rEmbeddedGraphicObjects,
+ sal_Int16 eDfltUnit )
+: mpImpl( new SvXMLExport_Impl ),
+ mxServiceFactory(xServiceFactory),
+ mxModel( rModel ),
+ mxHandler( rHandler ),
+ mxExtHandler( rHandler, uno::UNO_QUERY ),
+ mxNumberFormatsSupplier (rModel, uno::UNO_QUERY),
+ mxGraphicResolver( rEmbeddedGraphicObjects ),
+ mpAttrList( new SvXMLAttributeList ),
+ msOrigFileName( rFileName ),
+ mpNamespaceMap( new SvXMLNamespaceMap ),
+ mpUnitConv( new SvXMLUnitConverter( MAP_100TH_MM, SvXMLUnitConverter::GetMapUnit(eDfltUnit), getServiceFactory() ) ),
+ mpNumExport(0L),
+ mpProgressBarHelper( NULL ),
+ mpEventExport( NULL ),
+ mpImageMapExport( NULL ),
+ mpXMLErrors( NULL ),
+ mbExtended( sal_False ),
+ meClass( XML_TOKEN_INVALID ),
+ mnExportFlags( 0 ),
+ mnErrorFlags( ERROR_NO ),
+ msWS( GetXMLToken(XML_WS) ),
+ mbSaveLinkedSections(sal_True)
+{
+ mpImpl->SetSchemeOf( msOrigFileName );
+ DBG_ASSERT( mxServiceFactory.is(), "got no service manager" );
+ _InitCtor();
+
+ if (mxNumberFormatsSupplier.is())
+ mpNumExport = new SvXMLNumFmtExport(*this, mxNumberFormatsSupplier);
+}
+
+SvXMLExport::~SvXMLExport()
+{
+ delete mpXMLErrors;
+ delete mpImageMapExport;
+ delete mpEventExport;
+ delete mpNamespaceMap;
+ delete mpUnitConv;
+ if (mpProgressBarHelper || mpNumExport)
+ {
+ if (mxExportInfo.is())
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = mxExportInfo->getPropertySetInfo();
+ if (xPropertySetInfo.is())
+ {
+ if (mpProgressBarHelper)
+ {
+ OUString sProgressMax(RTL_CONSTASCII_USTRINGPARAM(XML_PROGRESSMAX));
+ OUString sProgressCurrent(RTL_CONSTASCII_USTRINGPARAM(XML_PROGRESSCURRENT));
+ OUString sRepeat(RTL_CONSTASCII_USTRINGPARAM(XML_PROGRESSREPEAT));
+ if (xPropertySetInfo->hasPropertyByName(sProgressMax) &&
+ xPropertySetInfo->hasPropertyByName(sProgressCurrent))
+ {
+ sal_Int32 nProgressMax(mpProgressBarHelper->GetReference());
+ sal_Int32 nProgressCurrent(mpProgressBarHelper->GetValue());
+ uno::Any aAny;
+ aAny <<= nProgressMax;
+ mxExportInfo->setPropertyValue(sProgressMax, aAny);
+ aAny <<= nProgressCurrent;
+ mxExportInfo->setPropertyValue(sProgressCurrent, aAny);
+ }
+ if (xPropertySetInfo->hasPropertyByName(sRepeat))
+ mxExportInfo->setPropertyValue(sRepeat, cppu::bool2any(mpProgressBarHelper->GetRepeat()));
+ }
+ if (mpNumExport && (mnExportFlags & (EXPORT_AUTOSTYLES | EXPORT_STYLES)))
+ {
+ OUString sWrittenNumberFormats(RTL_CONSTASCII_USTRINGPARAM(XML_WRITTENNUMBERSTYLES));
+ if (xPropertySetInfo->hasPropertyByName(sWrittenNumberFormats))
+ {
+ uno::Sequence<sal_Int32> aWasUsed;
+ mpNumExport->GetWasUsed(aWasUsed);
+ uno::Any aAny;
+ aAny <<= aWasUsed;
+ mxExportInfo->setPropertyValue(sWrittenNumberFormats, aAny);
+ }
+ }
+ }
+ }
+ delete mpProgressBarHelper;
+ delete mpNumExport;
+ }
+
+ xmloff::token::ResetTokens();
+
+ if (mxEventListener.is() && mxModel.is())
+ mxModel->removeEventListener(mxEventListener);
+
+ delete mpImpl;
+}
+
+///////////////////////////////////////////////////////////////////////
+
+// XExporter
+void SAL_CALL SvXMLExport::setSourceDocument( const uno::Reference< lang::XComponent >& xDoc )
+ throw(lang::IllegalArgumentException, uno::RuntimeException)
+{
+ mxModel = uno::Reference< frame::XModel >::query( xDoc );
+ if( !mxModel.is() )
+ throw lang::IllegalArgumentException();
+ if (mxModel.is() && ! mxEventListener.is())
+ {
+ mxEventListener.set( new SvXMLExportEventListener(this));
+ mxModel->addEventListener(mxEventListener);
+ }
+
+ if(!mxNumberFormatsSupplier.is() )
+ {
+ mxNumberFormatsSupplier = mxNumberFormatsSupplier.query( mxModel );
+ if(mxNumberFormatsSupplier.is() && mxHandler.is())
+ mpNumExport = new SvXMLNumFmtExport(*this, mxNumberFormatsSupplier);
+ }
+ if (mxExportInfo.is())
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = mxExportInfo->getPropertySetInfo();
+ if (xPropertySetInfo.is())
+ {
+ OUString sUsePrettyPrinting(RTL_CONSTASCII_USTRINGPARAM(XML_USEPRETTYPRINTING));
+ if (xPropertySetInfo->hasPropertyByName(sUsePrettyPrinting))
+ {
+ uno::Any aAny = mxExportInfo->getPropertyValue(sUsePrettyPrinting);
+ if (::cppu::any2bool(aAny))
+ mnExportFlags |= EXPORT_PRETTY;
+ else
+ mnExportFlags &= ~EXPORT_PRETTY;
+ }
+
+ if (mpNumExport && (mnExportFlags & (EXPORT_AUTOSTYLES | EXPORT_STYLES)))
+ {
+ OUString sWrittenNumberFormats(RTL_CONSTASCII_USTRINGPARAM(XML_WRITTENNUMBERSTYLES));
+ if (xPropertySetInfo->hasPropertyByName(sWrittenNumberFormats))
+ {
+ uno::Any aAny = mxExportInfo->getPropertyValue(sWrittenNumberFormats);
+ uno::Sequence<sal_Int32> aWasUsed;
+ if(aAny >>= aWasUsed)
+ mpNumExport->SetWasUsed(aWasUsed);
+ }
+ }
+ }
+ }
+
+ if ( mpImpl->mbSaveBackwardCompatibleODF )
+ mnExportFlags |= EXPORT_SAVEBACKWARDCOMPATIBLE;
+ else
+ mnExportFlags &= ~EXPORT_SAVEBACKWARDCOMPATIBLE;
+
+ // namespaces for user defined attributes
+ Reference< XMultiServiceFactory > xFactory( mxModel, UNO_QUERY );
+ if( xFactory.is() )
+ {
+ try
+ {
+ Reference < XInterface > xIfc =
+ xFactory->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.xml.NamespaceMap")) );
+ if( xIfc.is() )
+ {
+ Reference< XNameAccess > xNamespaceMap( xIfc, UNO_QUERY );
+ if( xNamespaceMap.is() )
+ {
+ Sequence< OUString > aPrefixes( xNamespaceMap->getElementNames() );
+
+ OUString* pPrefix = aPrefixes.getArray();
+ const sal_Int32 nCount = aPrefixes.getLength();
+ sal_Int32 nIndex;
+ OUString aURL;
+
+ for( nIndex = 0; nIndex < nCount; ++nIndex, ++pPrefix )
+ {
+ if( xNamespaceMap->getByName( *pPrefix ) >>= aURL )
+ _GetNamespaceMap().Add( *pPrefix, aURL, XML_NAMESPACE_UNKNOWN );
+ }
+ }
+ }
+ }
+ catch( com::sun::star::uno::Exception& )
+ {
+ }
+ }
+
+ // Determine model type (#i51726#)
+ _DetermineModelType();
+}
+
+// XInitialize
+void SAL_CALL SvXMLExport::initialize( const uno::Sequence< uno::Any >& aArguments )
+ throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+{
+ // #93186# we need to queryInterface every single Any with any expected outcome. This variable hold the queryInterface results.
+
+ const sal_Int32 nAnyCount = aArguments.getLength();
+ const uno::Any* pAny = aArguments.getConstArray();
+
+ for( sal_Int32 nIndex = 0; nIndex < nAnyCount; nIndex++, pAny++ )
+ {
+ Reference<XInterface> xValue;
+ *pAny >>= xValue;
+
+ // status indicator
+ uno::Reference<task::XStatusIndicator> xTmpStatus( xValue, UNO_QUERY );
+ if ( xTmpStatus.is() )
+ mxStatusIndicator = xTmpStatus;
+
+ // graphic resolver
+ uno::Reference<document::XGraphicObjectResolver> xTmpGraphic(
+ xValue, UNO_QUERY );
+ if ( xTmpGraphic.is() )
+ mxGraphicResolver = xTmpGraphic;
+
+ // object resolver
+ uno::Reference<document::XEmbeddedObjectResolver> xTmpObjectResolver(
+ xValue, UNO_QUERY );
+ if ( xTmpObjectResolver.is() )
+ mxEmbeddedResolver = xTmpObjectResolver;
+
+ // document handler
+ uno::Reference<xml::sax::XDocumentHandler> xTmpDocHandler(
+ xValue, UNO_QUERY );
+ if( xTmpDocHandler.is() )
+ {
+ mxHandler = xTmpDocHandler;
+ *pAny >>= mxExtHandler;
+
+ if (mxNumberFormatsSupplier.is() && mpNumExport == NULL)
+ mpNumExport = new SvXMLNumFmtExport(*this, mxNumberFormatsSupplier);
+ }
+
+ // property set to transport data across
+ uno::Reference<beans::XPropertySet> xTmpPropertySet(
+ xValue, UNO_QUERY );
+ if( xTmpPropertySet.is() )
+ mxExportInfo = xTmpPropertySet;
+ }
+
+ if( mxExportInfo.is() )
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropertySetInfo =
+ mxExportInfo->getPropertySetInfo();
+ OUString sPropName(
+ RTL_CONSTASCII_USTRINGPARAM("BaseURI" ) );
+ if( xPropertySetInfo->hasPropertyByName(sPropName) )
+ {
+ uno::Any aAny = mxExportInfo->getPropertyValue(sPropName);
+ aAny >>= msOrigFileName;
+ mpImpl->msPackageURI = msOrigFileName;
+ mpImpl->SetSchemeOf( msOrigFileName );
+ }
+ OUString sRelPath;
+ sPropName = OUString( RTL_CONSTASCII_USTRINGPARAM("StreamRelPath" ) );
+ if( xPropertySetInfo->hasPropertyByName(sPropName) )
+ {
+ uno::Any aAny = mxExportInfo->getPropertyValue(sPropName);
+ aAny >>= sRelPath;
+ }
+ OUString sName;
+ sPropName = OUString( RTL_CONSTASCII_USTRINGPARAM("StreamName" ) );
+ if( xPropertySetInfo->hasPropertyByName(sPropName) )
+ {
+ uno::Any aAny = mxExportInfo->getPropertyValue(sPropName);
+ aAny >>= sName;
+ }
+ if( msOrigFileName.getLength() && sName.getLength() )
+ {
+ INetURLObject aBaseURL( msOrigFileName );
+ if( sRelPath.getLength() )
+ aBaseURL.insertName( sRelPath );
+ aBaseURL.insertName( sName );
+ msOrigFileName = aBaseURL.GetMainURL(INetURLObject::DECODE_TO_IURI);
+ }
+ mpImpl->mStreamName = sName; // Note: may be empty (XSLT)
+
+ // Written OpenDocument file format doesn't fit to the created text document (#i69627#)
+ const ::rtl::OUString sOutlineStyleAsNormalListStyle(
+ RTL_CONSTASCII_USTRINGPARAM("OutlineStyleAsNormalListStyle") );
+ if( xPropertySetInfo->hasPropertyByName( sOutlineStyleAsNormalListStyle ) )
+ {
+ uno::Any aAny = mxExportInfo->getPropertyValue( sOutlineStyleAsNormalListStyle );
+ aAny >>= (mpImpl->mbOutlineStyleAsNormalListStyle);
+ }
+
+ OUString sTargetStorage( RTL_CONSTASCII_USTRINGPARAM("TargetStorage") );
+ if( xPropertySetInfo->hasPropertyByName( sTargetStorage ) )
+ mxExportInfo->getPropertyValue( sTargetStorage ) >>= mpImpl->mxTargetStorage;
+
+ const ::rtl::OUString sExportTextNumberElement(
+ RTL_CONSTASCII_USTRINGPARAM("ExportTextNumberElement") );
+ if( xPropertySetInfo->hasPropertyByName( sExportTextNumberElement ) )
+ {
+ uno::Any aAny = mxExportInfo->getPropertyValue( sExportTextNumberElement );
+ aAny >>= (mpImpl->mbExportTextNumberElement);
+ }
+ }
+
+}
+
+// XFilter
+sal_Bool SAL_CALL SvXMLExport::filter( const uno::Sequence< beans::PropertyValue >& aDescriptor ) throw(uno::RuntimeException)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogContext, "xmloff", LOGFILE_AUTHOR,
+ "SvXMLExport::filter" );
+
+ // check for xHandler first... should have been supplied in initialize
+ if( !mxHandler.is() )
+ return sal_False;
+
+ try
+ {
+ const sal_uInt32 nTest =
+ EXPORT_META|EXPORT_STYLES|EXPORT_CONTENT|EXPORT_SETTINGS;
+ if( (mnExportFlags & nTest) == nTest && !msOrigFileName.getLength() )
+ {
+ // evaluate descriptor only for flat files and if a base URI
+ // has not been provided already
+ const sal_Int32 nPropCount = aDescriptor.getLength();
+ const beans::PropertyValue* pProps = aDescriptor.getConstArray();
+
+ for( sal_Int32 nIndex = 0; nIndex < nPropCount; nIndex++, pProps++ )
+ {
+ const OUString& rPropName = pProps->Name;
+ const Any& rValue = pProps->Value;
+
+ if( rPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FileName" ) ) )
+ {
+ if( !(rValue >>= msOrigFileName ) )
+ return sal_False;
+ }
+ else if (rPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FilterName" ) ) )
+ {
+ if( !(rValue >>= msFilterName ) )
+ return sal_False;
+ }
+ }
+ }
+
+#ifdef TIMELOG
+ if (GetModel().is())
+ {
+ // print a trace message with the URL
+ ByteString aUrl( (String) GetModel()->getURL(),
+ RTL_TEXTENCODING_ASCII_US );
+ RTL_LOGFILE_CONTEXT_TRACE1( aLogContext, "%s", aUrl.GetBuffer() );
+
+ // we also want a trace message with the document class
+ ByteString aClass( (String)GetXMLToken(meClass),
+ RTL_TEXTENCODING_ASCII_US );
+ RTL_LOGFILE_CONTEXT_TRACE1( aLogContext, "class=\"%s\"",
+ aClass.GetBuffer() );
+ }
+#endif
+
+ exportDoc( meClass );
+ }
+ catch( uno::Exception e )
+ {
+ // We must catch exceptions, because according to the
+ // API definition export must not throw one!
+ Sequence<OUString> aSeq(0);
+ SetError( XMLERROR_FLAG_ERROR | XMLERROR_FLAG_SEVERE | XMLERROR_API,
+ aSeq, e.Message, NULL );
+ }
+
+ // return true only if no error occurred
+ return (GetErrorFlags() & (ERROR_DO_NOTHING|ERROR_ERROR_OCCURRED)) == 0;
+}
+
+void SAL_CALL SvXMLExport::cancel() throw(uno::RuntimeException)
+{
+ // stop export
+ Sequence<OUString> aEmptySeq;
+ SetError(XMLERROR_CANCEL|XMLERROR_FLAG_SEVERE, aEmptySeq);
+}
+
+::rtl::OUString SAL_CALL SvXMLExport::getName( )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return msFilterName;
+}
+
+void SAL_CALL SvXMLExport::setName( const ::rtl::OUString& )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ // do nothing, because it is not possible to set the FilterName
+}
+
+
+// XServiceInfo
+OUString SAL_CALL SvXMLExport::getImplementationName( ) throw(uno::RuntimeException)
+{
+ OUString aStr;
+ return aStr;
+}
+
+sal_Bool SAL_CALL SvXMLExport::supportsService( const OUString& rServiceName ) throw(uno::RuntimeException)
+{
+ return
+ rServiceName.equalsAsciiL(
+ "com.sun.star.document.ExportFilter",
+ sizeof("com.sun.star.document.ExportFilter")-1 ) ||
+ rServiceName.equalsAsciiL(
+ "com.sun.star.xml.XMLExportFilter",
+ sizeof("com.sun.star.xml.XMLExportFilter")-1);
+}
+
+uno::Sequence< OUString > SAL_CALL SvXMLExport::getSupportedServiceNames( )
+ throw(uno::RuntimeException)
+{
+ uno::Sequence<OUString> aSeq(2);
+ aSeq[0] = OUString(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ExportFilter"));
+ aSeq[1] = OUString(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.XMLExportFilter"));
+ return aSeq;
+}
+
+///////////////////////////////////////////////////////////////////////
+
+::rtl::OUString
+SvXMLExport::EnsureNamespace(::rtl::OUString const & i_rNamespace,
+ ::rtl::OUString const & i_rPreferredPrefix)
+{
+ ::rtl::OUString sPrefix;
+ sal_uInt16 nKey( _GetNamespaceMap().GetKeyByName( i_rNamespace ) );
+ if( XML_NAMESPACE_UNKNOWN == nKey )
+ {
+ // There is no prefix for the namespace, so
+ // we have to generate one and have to add it.
+ sPrefix = i_rPreferredPrefix;
+ nKey = _GetNamespaceMap().GetKeyByPrefix( sPrefix );
+ sal_Int32 n( 0 );
+ ::rtl::OUStringBuffer buf;
+ while( nKey != USHRT_MAX )
+ {
+ buf.append( i_rPreferredPrefix );
+ buf.append( ++n );
+ sPrefix = buf.makeStringAndClear();
+ nKey = _GetNamespaceMap().GetKeyByPrefix( sPrefix );
+ }
+
+ if (mpImpl->mNamespaceMaps.empty()
+ || (mpImpl->mNamespaceMaps.top().second != mpImpl->mDepth))
+ {
+ // top was created for lower depth... need a new namespace map!
+ mpImpl->mNamespaceMaps.push(
+ ::std::make_pair(mpNamespaceMap, mpImpl->mDepth) );
+ mpNamespaceMap = new SvXMLNamespaceMap( *mpNamespaceMap );
+ }
+
+ // add the namespace to the map and as attribute
+ mpNamespaceMap->Add( sPrefix, i_rNamespace );
+ buf.append( GetXMLToken(XML_XMLNS) );
+ buf.append( sal_Unicode(':') );
+ buf.append( sPrefix );
+ AddAttribute( buf.makeStringAndClear(), i_rNamespace );
+ }
+ else
+ {
+ // If there is a prefix for the namespace, reuse that.
+ sPrefix = _GetNamespaceMap().GetPrefixByKey( nKey );
+ }
+ return sPrefix;
+}
+
+///////////////////////////////////////////////////////////////////////
+
+void SvXMLExport::AddAttributeASCII( sal_uInt16 nPrefixKey,
+ const sal_Char *pName,
+ const sal_Char *pValue )
+{
+ OUString sName( OUString::createFromAscii( pName ) );
+ OUString sValue( OUString::createFromAscii( pValue ) );
+
+ mpAttrList->AddAttribute(
+ _GetNamespaceMap().GetQNameByKey( nPrefixKey, sName ), sValue );
+}
+
+void SvXMLExport::AddAttribute( sal_uInt16 nPrefixKey, const sal_Char *pName,
+ const OUString& rValue )
+{
+ OUString sName( OUString::createFromAscii( pName ) );
+
+ mpAttrList->AddAttribute(
+ _GetNamespaceMap().GetQNameByKey( nPrefixKey, sName ), rValue );
+}
+
+void SvXMLExport::AddAttribute( sal_uInt16 nPrefixKey, const OUString& rName,
+ const OUString& rValue )
+{
+ mpAttrList->AddAttribute(
+ _GetNamespaceMap().GetQNameByKey( nPrefixKey, rName ), rValue );
+}
+
+void SvXMLExport::AddAttribute( sal_uInt16 nPrefixKey,
+ enum XMLTokenEnum eName,
+ const OUString& rValue )
+{
+ mpAttrList->AddAttribute(
+ _GetNamespaceMap().GetQNameByKey( nPrefixKey, GetXMLToken(eName) ),
+ rValue );
+}
+
+void SvXMLExport::AddAttribute( sal_uInt16 nPrefixKey,
+ enum XMLTokenEnum eName,
+ enum XMLTokenEnum eValue)
+{
+ mpAttrList->AddAttribute(
+ _GetNamespaceMap().GetQNameByKey( nPrefixKey, GetXMLToken(eName) ),
+ GetXMLToken(eValue) );
+}
+
+void SvXMLExport::AddAttribute( const ::rtl::OUString& rQName,
+ const ::rtl::OUString& rValue )
+{
+ mpAttrList->AddAttribute(
+ rQName,
+ rValue );
+}
+
+void SvXMLExport::AddAttribute( const ::rtl::OUString& rQName,
+ enum ::xmloff::token::XMLTokenEnum eValue )
+{
+ mpAttrList->AddAttribute(
+ rQName,
+ GetXMLToken(eValue) );
+}
+
+void SvXMLExport::AddAttributeList( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ if( xAttrList.is())
+ mpAttrList->AppendAttributeList( xAttrList );
+}
+
+void SvXMLExport::ClearAttrList()
+{
+ mpAttrList->Clear();
+}
+
+#ifdef DBG_UTIL
+void SvXMLExport::CheckAttrList()
+{
+ DBG_ASSERT( !mpAttrList->getLength(),
+ "XMLExport::CheckAttrList: list is not empty" );
+}
+#endif
+
+void SvXMLExport::ImplExportMeta()
+{
+ CheckAttrList();
+
+ _ExportMeta();
+}
+
+void SvXMLExport::ImplExportSettings()
+{
+ CheckAttrList();
+
+ ::std::list< SettingsGroup > aSettings;
+ sal_Int32 nSettingsCount = 0;
+
+ // view settings
+ uno::Sequence< beans::PropertyValue > aViewSettings;
+ GetViewSettingsAndViews( aViewSettings );
+ aSettings.push_back( SettingsGroup( XML_VIEW_SETTINGS, aViewSettings ) );
+ nSettingsCount += aViewSettings.getLength();
+
+ // configuration settings
+ uno::Sequence<beans::PropertyValue> aConfigSettings;
+ GetConfigurationSettings( aConfigSettings );
+ aSettings.push_back( SettingsGroup( XML_CONFIGURATION_SETTINGS, aConfigSettings ) );
+ nSettingsCount += aConfigSettings.getLength();
+
+ // any document specific settings
+ nSettingsCount += GetDocumentSpecificSettings( aSettings );
+
+ {
+ SvXMLElementExport aElem( *this,
+ nSettingsCount != 0,
+ XML_NAMESPACE_OFFICE, XML_SETTINGS,
+ sal_True, sal_True );
+
+ SettingsExportFacade aSettingsExportContext( *this );
+ XMLSettingsExportHelper aSettingsExportHelper( aSettingsExportContext );
+
+ for ( ::std::list< SettingsGroup >::const_iterator settings = aSettings.begin();
+ settings != aSettings.end();
+ ++settings
+ )
+ {
+ if ( !settings->aSettings.getLength() )
+ continue;
+
+ OUString sSettingsName( GetXMLToken( settings->eGroupName ) );
+ OUString sQName = GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_OOO, sSettingsName );
+ aSettingsExportHelper.exportAllSettings( settings->aSettings, sQName );
+ }
+ }
+}
+
+void SvXMLExport::ImplExportStyles( sal_Bool )
+{
+ CheckAttrList();
+
+ {
+ // <style:styles>
+ SvXMLElementExport aElem( *this, XML_NAMESPACE_OFFICE, XML_STYLES,
+ sal_True, sal_True );
+
+ _ExportStyles( sal_False );
+ }
+
+ // transfer style names (+ families) TO other components (if appropriate)
+ if( ( ( mnExportFlags & EXPORT_CONTENT ) == 0 ) && mxExportInfo.is() )
+ {
+ static OUString sStyleNames( RTL_CONSTASCII_USTRINGPARAM("StyleNames") );
+ static OUString sStyleFamilies( RTL_CONSTASCII_USTRINGPARAM("StyleFamilies") );
+ uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = mxExportInfo->getPropertySetInfo();
+ if ( xPropertySetInfo->hasPropertyByName( sStyleNames ) && xPropertySetInfo->hasPropertyByName( sStyleFamilies ) )
+ {
+ Sequence<sal_Int32> aStyleFamilies;
+ Sequence<OUString> aStyleNames;
+ mxAutoStylePool->GetRegisteredNames( aStyleFamilies, aStyleNames );
+ mxExportInfo->setPropertyValue( sStyleNames, makeAny( aStyleNames ) );
+ mxExportInfo->setPropertyValue( sStyleFamilies,
+ makeAny( aStyleFamilies ) );
+ }
+ }
+}
+
+void SvXMLExport::ImplExportAutoStyles( sal_Bool )
+{
+ // transfer style names (+ families) FROM other components (if appropriate)
+ OUString sStyleNames( RTL_CONSTASCII_USTRINGPARAM("StyleNames") );
+ OUString sStyleFamilies( RTL_CONSTASCII_USTRINGPARAM("StyleFamilies") );
+ if( ( ( mnExportFlags & EXPORT_STYLES ) == 0 )
+ && mxExportInfo.is()
+ && mxExportInfo->getPropertySetInfo()->hasPropertyByName( sStyleNames )
+ && mxExportInfo->getPropertySetInfo()->hasPropertyByName( sStyleFamilies ) )
+ {
+ Sequence<sal_Int32> aStyleFamilies;
+ mxExportInfo->getPropertyValue( sStyleFamilies ) >>= aStyleFamilies;
+ Sequence<OUString> aStyleNames;
+ mxExportInfo->getPropertyValue( sStyleNames ) >>= aStyleNames;
+ mxAutoStylePool->RegisterNames( aStyleFamilies, aStyleNames );
+ }
+
+ {
+ // <style:automatic-styles>
+ SvXMLElementExport aElem( *this, XML_NAMESPACE_OFFICE,
+ XML_AUTOMATIC_STYLES, sal_True, sal_True );
+
+ _ExportAutoStyles();
+ }
+}
+
+void SvXMLExport::ImplExportMasterStyles( sal_Bool )
+{
+ {
+ // <style:master-styles>
+ SvXMLElementExport aElem( *this, XML_NAMESPACE_OFFICE, XML_MASTER_STYLES,
+ sal_True, sal_True );
+
+ _ExportMasterStyles();
+ }
+
+}
+
+void SvXMLExport::ImplExportContent()
+{
+ CheckAttrList();
+
+ CheckAttrList();
+
+ {
+ SvXMLElementExport aElemrnt( *this, XML_NAMESPACE_OFFICE, XML_BODY,
+ sal_True, sal_True );
+ {
+ XMLTokenEnum eClass = meClass;
+ if( XML_TEXT_GLOBAL == eClass )
+ {
+ AddAttribute( XML_NAMESPACE_TEXT, XML_GLOBAL,
+ GetXMLToken( XML_TRUE ) );
+ eClass = XML_TEXT;
+ }
+ // <office:body ...>
+ SetBodyAttributes();
+ SvXMLElementExport aElem( *this, meClass != XML_TOKEN_INVALID,
+ XML_NAMESPACE_OFFICE, eClass,
+ sal_True, sal_True );
+
+ _ExportContent();
+ }
+ }
+}
+
+void SvXMLExport::SetBodyAttributes()
+{
+}
+
+static void
+lcl_AddGrddl(SvXMLExport & rExport, const sal_Int32 /*nExportMode*/)
+{
+ // check version >= 1.2
+ switch (rExport.getDefaultVersion()) {
+ case SvtSaveOptions::ODFVER_011: // fall thru
+ case SvtSaveOptions::ODFVER_010: return;
+ default: break;
+ }
+
+ // #i115030#: disabled
+#if 0
+ if (EXPORT_SETTINGS != nExportMode) // meta, content, styles
+ {
+ rExport.AddAttribute( XML_NAMESPACE_GRDDL, XML_TRANSFORMATION,
+ OUString(RTL_CONSTASCII_USTRINGPARAM(s_grddl_xsl)) );
+ }
+#endif
+}
+
+sal_uInt32 SvXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass )
+{
+ bool bOwnGraphicResolver = false;
+ bool bOwnEmbeddedResolver = false;
+
+ if( !mxGraphicResolver.is() || !mxEmbeddedResolver.is() )
+ {
+ Reference< XMultiServiceFactory > xFactory( mxModel, UNO_QUERY );
+ if( xFactory.is() )
+ {
+ try
+ {
+ if( !mxGraphicResolver.is() )
+ {
+ mxGraphicResolver = Reference< XGraphicObjectResolver >::query(
+ xFactory->createInstance(
+ OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.document.ExportGraphicObjectResolver"))));
+ bOwnGraphicResolver = mxGraphicResolver.is();
+ }
+
+ if( !mxEmbeddedResolver.is() )
+ {
+ mxEmbeddedResolver = Reference< XEmbeddedObjectResolver >::query(
+ xFactory->createInstance(
+ OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.document.ExportEmbeddedObjectResolver"))));
+ bOwnEmbeddedResolver = mxEmbeddedResolver.is();
+ }
+ }
+ catch( com::sun::star::uno::Exception& )
+ {
+ }
+ }
+ }
+ if( (getExportFlags() & EXPORT_OASIS) == 0 )
+ {
+ Reference< lang::XMultiServiceFactory > xFactory = getServiceFactory();
+ if( xFactory.is() )
+ {
+ try
+ {
+ ::comphelper::PropertyMapEntry aInfoMap[] =
+ {
+ { "Class", sizeof("Class")-1, 0,
+ &::getCppuType((::rtl::OUString*)0),
+ PropertyAttribute::MAYBEVOID, 0},
+ { NULL, 0, 0, NULL, 0, 0 }
+ };
+ Reference< XPropertySet > xConvPropSet(
+ ::comphelper::GenericPropertySet_CreateInstance(
+ new ::comphelper::PropertySetInfo( aInfoMap ) ) );
+
+ Any aAny;
+ aAny <<= GetXMLToken( eClass );
+ xConvPropSet->setPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Class")), aAny );
+
+ Reference< XPropertySet > xPropSet =
+ mxExportInfo.is()
+ ? PropertySetMerger_CreateInstance( mxExportInfo,
+ xConvPropSet )
+ : xConvPropSet;
+
+ Sequence<Any> aArgs( 3 );
+ aArgs[0] <<= mxHandler;
+ aArgs[1] <<= xPropSet;
+ aArgs[2] <<= mxModel;
+
+ // get filter component
+ Reference< xml::sax::XDocumentHandler > xTmpDocHandler(
+ xFactory->createInstanceWithArguments(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Oasis2OOoTransformer")),
+ aArgs), UNO_QUERY);
+ OSL_ENSURE( xTmpDocHandler.is(),
+ "can't instantiate OASIS transformer component" );
+ if( xTmpDocHandler.is() )
+ {
+ mxHandler = xTmpDocHandler;
+ mxExtHandler = uno::Reference<xml::sax::XExtendedDocumentHandler>( mxHandler, UNO_QUERY );
+ }
+ }
+ catch( com::sun::star::uno::Exception& )
+ {
+ }
+ }
+ }
+
+
+ mxHandler->startDocument();
+
+ // <?xml version="1.0" encoding="UTF-8"?>
+// xHandler->processingInstruction( S2U( sXML_xml ), S2U( sXML_xml_pi ) );
+
+ // <office:document ...>
+ CheckAttrList();
+
+ // namespace attributes
+ // ( The namespace decls should be first attributes in the element;
+ // some faulty XML parsers (JAXP1.1) have a problem with this,
+ // also it's more elegant )
+ sal_uInt16 nPos = mpNamespaceMap->GetFirstKey();
+ while( USHRT_MAX != nPos )
+ {
+ mpAttrList->AddAttribute( mpNamespaceMap->GetAttrNameByKey( nPos ),
+ mpNamespaceMap->GetNameByKey( nPos ) );
+ nPos = mpNamespaceMap->GetNextKey( nPos );
+ }
+
+
+
+ // office:version = ...
+ if( !mbExtended )
+ {
+ const sal_Char* pVersion = 0;
+ switch( getDefaultVersion() )
+ {
+ case SvtSaveOptions::ODFVER_LATEST: pVersion = sXML_1_2; break;
+ case SvtSaveOptions::ODFVER_012: pVersion = sXML_1_2; break;
+ case SvtSaveOptions::ODFVER_011: pVersion = sXML_1_1; break;
+ case SvtSaveOptions::ODFVER_010: break;
+
+ default:
+ OSL_FAIL("xmloff::SvXMLExport::exportDoc(), unexpected odf default version!");
+ }
+
+ if( pVersion )
+ AddAttribute( XML_NAMESPACE_OFFICE, XML_VERSION,
+ OUString::createFromAscii(pVersion) );
+ }
+
+ {
+ enum XMLTokenEnum eRootService = XML_TOKEN_INVALID;
+ const sal_Int32 nExportMode = mnExportFlags & (EXPORT_META|EXPORT_STYLES|EXPORT_CONTENT|EXPORT_SETTINGS);
+
+ lcl_AddGrddl(*this, nExportMode);
+
+ if( EXPORT_META == nExportMode )
+ {
+ // export only meta
+ eRootService = XML_DOCUMENT_META;
+ }
+ else if ( EXPORT_SETTINGS == nExportMode )
+ {
+ // export only settings
+ eRootService = XML_DOCUMENT_SETTINGS;
+ }
+ else if( EXPORT_STYLES == nExportMode )
+ {
+ // export only styles
+ eRootService = XML_DOCUMENT_STYLES;
+ }
+ else if( EXPORT_CONTENT == nExportMode )
+ {
+ // export only content
+ eRootService = XML_DOCUMENT_CONTENT;
+ }
+ else
+ {
+ // the god'ol one4all element
+ eRootService = XML_DOCUMENT;
+ // office:mimetype = ... (only for stream containing the content)
+ if( eClass != XML_TOKEN_INVALID )
+ {
+ OUString aTmp( RTL_CONSTASCII_USTRINGPARAM("application/vnd.oasis.opendocument.") );
+ aTmp += GetXMLToken( eClass );
+ AddAttribute( XML_NAMESPACE_OFFICE, XML_MIMETYPE, aTmp );
+ }
+ }
+
+ SvXMLElementExport aElem( *this, XML_NAMESPACE_OFFICE, eRootService, sal_True, sal_True );
+
+ // meta information
+ if( mnExportFlags & EXPORT_META )
+ ImplExportMeta();
+
+ // settings
+ if( mnExportFlags & EXPORT_SETTINGS )
+ ImplExportSettings();
+
+ // scripts
+ if( mnExportFlags & EXPORT_SCRIPTS )
+ _ExportScripts();
+
+ // font declerations
+ if( mnExportFlags & EXPORT_FONTDECLS )
+ _ExportFontDecls();
+
+ // styles
+ if( mnExportFlags & EXPORT_STYLES )
+ ImplExportStyles( sal_False );
+
+ // autostyles
+ if( mnExportFlags & EXPORT_AUTOSTYLES )
+ ImplExportAutoStyles( sal_False );
+
+ // masterstyles
+ if( mnExportFlags & EXPORT_MASTERSTYLES )
+ ImplExportMasterStyles( sal_False );
+
+ // contnt
+ if( mnExportFlags & EXPORT_CONTENT )
+ ImplExportContent();
+ }
+
+
+ mxHandler->endDocument();
+
+ if( bOwnGraphicResolver )
+ {
+ Reference< XComponent > xComp( mxGraphicResolver, UNO_QUERY );
+ xComp->dispose();
+ }
+
+ if( bOwnEmbeddedResolver )
+ {
+ Reference< XComponent > xComp( mxEmbeddedResolver, UNO_QUERY );
+ xComp->dispose();
+ }
+
+ return 0;
+}
+
+void SvXMLExport::ResetNamespaceMap()
+{
+ delete mpNamespaceMap; mpNamespaceMap = new SvXMLNamespaceMap;
+}
+
+void SvXMLExport::_ExportMeta()
+{
+ OUString generator( ::utl::DocInfoHelper::GetGeneratorString() );
+ Reference< XDocumentPropertiesSupplier > xDocPropsSupplier(mxModel,
+ UNO_QUERY);
+ if (xDocPropsSupplier.is()) {
+ Reference<XDocumentProperties> xDocProps(
+ xDocPropsSupplier->getDocumentProperties());
+ if (!xDocProps.is()) throw;
+ // update generator here
+ xDocProps->setGenerator(generator);
+ SvXMLMetaExport * pMeta = new SvXMLMetaExport(*this, xDocProps);
+ uno::Reference<xml::sax::XDocumentHandler> xMeta(pMeta);
+ pMeta->Export();
+ } else {
+ // office:meta
+ SvXMLElementExport aElem( *this, XML_NAMESPACE_OFFICE, XML_META,
+ sal_True, sal_True );
+ {
+ // BM: #i60323# export generator even if xInfoProp is empty (which is the
+ // case for charts). The generator does not depend on xInfoProp
+ SvXMLElementExport anElem( *this, XML_NAMESPACE_META, XML_GENERATOR,
+ sal_True, sal_True );
+ Characters(generator);
+ }
+ }
+}
+
+void SvXMLExport::_ExportScripts()
+{
+ SvXMLElementExport aElement( *this, XML_NAMESPACE_OFFICE, XML_SCRIPTS, sal_True, sal_True );
+
+ // export Basic macros (only for FlatXML)
+ if ( mnExportFlags & EXPORT_EMBEDDED )
+ {
+ ::rtl::OUString aValue( GetNamespaceMap().GetPrefixByKey( XML_NAMESPACE_OOO ) );
+ aValue += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ":Basic" ) );
+ AddAttribute( XML_NAMESPACE_SCRIPT, XML_LANGUAGE, aValue );
+
+ SvXMLElementExport aElem( *this, XML_NAMESPACE_OFFICE, XML_SCRIPT, sal_True, sal_True );
+
+ // initialize Basic
+ if ( mxModel.is() )
+ {
+ Reference< beans::XPropertySet > xPSet( mxModel, UNO_QUERY );
+ if ( xPSet.is() )
+ xPSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BasicLibraries" ) ) );
+ }
+
+ Reference< document::XExporter > xExporter;
+ Reference< lang::XMultiServiceFactory > xMSF( getServiceFactory() );
+ if ( xMSF.is() )
+ {
+ Reference < XDocumentHandler > xHdl( new XMLBasicExportFilter( mxHandler ) );
+ Sequence < Any > aArgs( 1 );
+ aArgs[0] <<= xHdl;
+ xExporter.set( xMSF->createInstanceWithArguments(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.XMLOasisBasicExporter" ) ), aArgs ),
+ UNO_QUERY );
+ }
+
+ OSL_ENSURE( xExporter.is(),
+ "SvXMLExport::_ExportScripts: can't instantiate export filter component for Basic macros" );
+
+ if ( xExporter.is() )
+ {
+ Reference< XComponent > xComp( mxModel, UNO_QUERY );
+ xExporter->setSourceDocument( xComp );
+ Reference< XFilter > xFilter( xExporter, UNO_QUERY );
+ if ( xFilter.is() )
+ {
+ Sequence < PropertyValue > aMediaDesc( 0 );
+ xFilter->filter( aMediaDesc );
+ }
+ }
+ }
+
+ // export document events
+ Reference< document::XEventsSupplier > xEvents( GetModel(), UNO_QUERY );
+ GetEventExport().Export( xEvents, sal_True );
+}
+
+void SvXMLExport::_ExportFontDecls()
+{
+ if( mxFontAutoStylePool.is() )
+ mxFontAutoStylePool->exportXML();
+}
+
+void SvXMLExport::_ExportStyles( sal_Bool )
+{
+ uno::Reference< lang::XMultiServiceFactory > xFact( GetModel(), uno::UNO_QUERY );
+ if( xFact.is())
+ {
+ // export (fill-)gradient-styles
+ try
+ {
+ uno::Reference< container::XNameAccess > xGradient( xFact->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GradientTable") ) ), uno::UNO_QUERY );
+ if( xGradient.is() )
+ {
+ XMLGradientStyleExport aGradientStyle( *this );
+
+ if( xGradient->hasElements() )
+ {
+ uno::Sequence< OUString > aNamesSeq ( xGradient->getElementNames() );
+ sal_Int32 nCount = aNamesSeq.getLength();
+ for( sal_Int32 i=0; i<nCount; i++ )
+ {
+ const OUString& rStrName = aNamesSeq[ i ];
+
+ try
+ {
+ uno::Any aValue = xGradient->getByName( rStrName );
+
+ aGradientStyle.exportXML( rStrName, aValue );
+ }
+ catch( container::NoSuchElementException& )
+ {}
+ }
+ }
+ }
+ }
+ catch( lang::ServiceNotRegisteredException& )
+ {}
+
+ // export (fill-)hatch-styles
+ try
+ {
+ uno::Reference< container::XNameAccess > xHatch( xFact->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.HatchTable") ) ), uno::UNO_QUERY );
+ if( xHatch.is() )
+ {
+ XMLHatchStyleExport aHatchStyle( *this );
+
+ if( xHatch->hasElements() )
+ {
+ uno::Sequence< OUString > aNamesSeq ( xHatch->getElementNames() );
+ sal_Int32 nCount = aNamesSeq.getLength();
+ for( sal_Int32 i=0; i<nCount; i++ )
+ {
+ const OUString& rStrName = aNamesSeq[ i ];
+
+ try
+ {
+ uno::Any aValue = xHatch->getByName( rStrName );
+
+ aHatchStyle.exportXML( rStrName, aValue );
+ }
+ catch( container::NoSuchElementException& )
+ {}
+ }
+ }
+ }
+ }
+ catch( lang::ServiceNotRegisteredException& )
+ {}
+
+ // export (fill-)bitmap-styles
+ try
+ {
+ uno::Reference< container::XNameAccess > xBitmap( xFact->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.BitmapTable") ) ), uno::UNO_QUERY );
+ if( xBitmap.is() )
+ {
+ XMLImageStyle aImageStyle;
+
+ if( xBitmap->hasElements() )
+ {
+ uno::Sequence< OUString > aNamesSeq ( xBitmap->getElementNames() );
+ sal_Int32 nCount = aNamesSeq.getLength();
+ for( sal_Int32 i=0; i<nCount; i++ )
+ {
+ const OUString& rStrName = aNamesSeq[ i ];
+
+ try
+ {
+ uno::Any aValue = xBitmap->getByName( rStrName );
+
+ aImageStyle.exportXML( rStrName, aValue, *this );
+ }
+ catch( container::NoSuchElementException& )
+ {}
+ }
+ }
+ }
+ }
+ catch( lang::ServiceNotRegisteredException& )
+ {}
+
+ // export transparency-gradient -styles
+ try
+ {
+ uno::Reference< container::XNameAccess > xTransGradient( xFact->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.TransparencyGradientTable") ) ), uno::UNO_QUERY );
+ if( xTransGradient.is() )
+ {
+ XMLTransGradientStyleExport aTransGradientstyle( *this );
+
+ if( xTransGradient->hasElements() )
+ {
+ uno::Sequence< OUString > aNamesSeq ( xTransGradient->getElementNames() );
+ sal_Int32 nCount = aNamesSeq.getLength();
+ for( sal_Int32 i=0; i<nCount; i++ )
+ {
+ const OUString& rStrName = aNamesSeq[ i ];
+
+ try
+ {
+ uno::Any aValue = xTransGradient->getByName( rStrName );
+
+ aTransGradientstyle.exportXML( rStrName, aValue );
+ }
+ catch( container::NoSuchElementException& )
+ {}
+ }
+ }
+ }
+ }
+ catch( lang::ServiceNotRegisteredException& )
+ {}
+
+ // export marker-styles
+ try
+ {
+ uno::Reference< container::XNameAccess > xMarker( xFact->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.MarkerTable") ) ), uno::UNO_QUERY );
+ if( xMarker.is() )
+ {
+ XMLMarkerStyleExport aMarkerStyle( *this );
+
+ if( xMarker->hasElements() )
+ {
+ uno::Sequence< OUString > aNamesSeq ( xMarker->getElementNames() );
+ sal_Int32 nCount = aNamesSeq.getLength();
+ for( sal_Int32 i=0; i<nCount; i++ )
+ {
+ const OUString& rStrName = aNamesSeq[ i ];
+
+ try
+ {
+ uno::Any aValue = xMarker->getByName( rStrName );
+
+ aMarkerStyle.exportXML( rStrName, aValue );
+ }
+ catch( container::NoSuchElementException& )
+ {}
+ }
+ }
+ }
+ }
+ catch( lang::ServiceNotRegisteredException& )
+ {}
+
+ // export dash-styles
+ try
+ {
+ uno::Reference< container::XNameAccess > xDashes( xFact->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DashTable") ) ), uno::UNO_QUERY );
+ if( xDashes.is() )
+ {
+ XMLDashStyleExport aDashStyle( *this );
+
+ if( xDashes->hasElements() )
+ {
+ uno::Sequence< OUString > aNamesSeq ( xDashes->getElementNames() );
+ sal_Int32 nCount = aNamesSeq.getLength();
+ for( sal_Int32 i=0; i<nCount; i++ )
+ {
+ const OUString& rStrName = aNamesSeq[ i ];
+
+ try
+ {
+ uno::Any aValue = xDashes->getByName( rStrName );
+
+ aDashStyle.exportXML( rStrName, aValue );
+ }
+ catch( container::NoSuchElementException& )
+ {}
+ }
+ }
+ }
+ }
+ catch( lang::ServiceNotRegisteredException& )
+ {}
+ }
+}
+
+XMLTextParagraphExport* SvXMLExport::CreateTextParagraphExport()
+{
+ return new XMLTextParagraphExport( *this, *(GetAutoStylePool().get()) );
+}
+
+XMLShapeExport* SvXMLExport::CreateShapeExport()
+{
+ return new XMLShapeExport(*this);
+}
+
+SvXMLAutoStylePoolP* SvXMLExport::CreateAutoStylePool()
+{
+ return new SvXMLAutoStylePoolP(*this);
+}
+
+XMLPageExport* SvXMLExport::CreatePageExport()
+{
+ return new XMLPageExport( *this );
+}
+
+SchXMLExportHelper* SvXMLExport::CreateChartExport()
+{
+ return new SchXMLExportHelper(*this,*GetAutoStylePool().get());
+}
+
+XMLFontAutoStylePool* SvXMLExport::CreateFontAutoStylePool()
+{
+ return new XMLFontAutoStylePool( *this );
+}
+
+xmloff::OFormLayerXMLExport* SvXMLExport::CreateFormExport()
+{
+ return new xmloff::OFormLayerXMLExport(*this);
+}
+
+void SvXMLExport::GetViewSettingsAndViews(uno::Sequence<beans::PropertyValue>& rProps)
+{
+ GetViewSettings(rProps);
+ uno::Reference<document::XViewDataSupplier> xViewDataSupplier(GetModel(), uno::UNO_QUERY);
+ if(xViewDataSupplier.is())
+ {
+ uno::Reference<container::XIndexAccess> xIndexAccess;
+ xViewDataSupplier->setViewData( xIndexAccess ); // make sure we get a newly created sequence
+ xIndexAccess = xViewDataSupplier->getViewData();
+ sal_Bool bAdd = sal_False;
+ uno::Any aAny;
+ if(xIndexAccess.is() && xIndexAccess->hasElements() )
+ {
+ sal_Int32 nCount = xIndexAccess->getCount();
+ for (sal_Int32 i = 0; i < nCount; i++)
+ {
+ aAny = xIndexAccess->getByIndex(i);
+ uno::Sequence<beans::PropertyValue> aProps;
+ if( aAny >>= aProps )
+ {
+ if( aProps.getLength() > 0 )
+ {
+ bAdd = sal_True;
+ break;
+ }
+ }
+ }
+ }
+
+ if( bAdd )
+ {
+ sal_Int32 nOldLength(rProps.getLength());
+ rProps.realloc(nOldLength + 1);
+ beans::PropertyValue aProp;
+ aProp.Name = OUString(RTL_CONSTASCII_USTRINGPARAM("Views"));
+ aProp.Value <<= xIndexAccess;
+ rProps[nOldLength] = aProp;
+ }
+ }
+}
+
+void SvXMLExport::GetViewSettings(uno::Sequence<beans::PropertyValue>&)
+{
+}
+
+void SvXMLExport::GetConfigurationSettings(uno::Sequence<beans::PropertyValue>&)
+{
+}
+
+sal_Int32 SvXMLExport::GetDocumentSpecificSettings( ::std::list< SettingsGroup >& _out_rSettings )
+{
+ (void)_out_rSettings;
+ return 0;
+}
+
+void SvXMLExport::addDataStyle(const sal_Int32 nNumberFormat, sal_Bool /*bTimeFormat*/ )
+{
+ if(mpNumExport)
+ mpNumExport->SetUsed(nNumberFormat);
+}
+
+void SvXMLExport::exportDataStyles()
+{
+ if(mpNumExport)
+ mpNumExport->Export(sal_False);
+}
+
+void SvXMLExport::exportAutoDataStyles()
+{
+ if(mpNumExport)
+ mpNumExport->Export(sal_True);
+
+ if (mxFormExport.is())
+ mxFormExport->exportAutoControlNumberStyles();
+}
+
+OUString SvXMLExport::getDataStyleName(const sal_Int32 nNumberFormat, sal_Bool /*bTimeFormat*/ ) const
+{
+ OUString sTemp;
+ if(mpNumExport)
+ sTemp = mpNumExport->GetStyleName(nNumberFormat);
+ return sTemp;
+}
+
+void SvXMLExport::exportAnnotationMeta(const uno::Reference<drawing::XShape>&)
+{
+}
+
+sal_Int32 SvXMLExport::dataStyleForceSystemLanguage(sal_Int32 nFormat) const
+{
+ return ( mpNumExport != NULL )
+ ? mpNumExport->ForceSystemLanguage( nFormat ) : nFormat;
+}
+
+
+OUString SvXMLExport::AddEmbeddedGraphicObject( const OUString& rGraphicObjectURL )
+{
+ OUString sRet( rGraphicObjectURL );
+ if( 0 == rGraphicObjectURL.compareTo( msGraphicObjectProtocol,
+ msGraphicObjectProtocol.getLength() ) &&
+ mxGraphicResolver.is() )
+ {
+ if( (getExportFlags() & EXPORT_EMBEDDED) == 0 )
+ sRet = mxGraphicResolver->resolveGraphicObjectURL( rGraphicObjectURL );
+ else
+ sRet = OUString();
+ }
+ else
+ sRet = GetRelativeReference( sRet );
+
+ return sRet;
+}
+
+sal_Bool SvXMLExport::AddEmbeddedGraphicObjectAsBase64( const OUString& rGraphicObjectURL )
+{
+ sal_Bool bRet = sal_False;
+
+ if( (getExportFlags() & EXPORT_EMBEDDED) != 0 &&
+ 0 == rGraphicObjectURL.compareTo( msGraphicObjectProtocol,
+ msGraphicObjectProtocol.getLength() ) &&
+ mxGraphicResolver.is() )
+ {
+ Reference< XBinaryStreamResolver > xStmResolver( mxGraphicResolver, UNO_QUERY );
+
+ if( xStmResolver.is() )
+ {
+ Reference< XInputStream > xIn( xStmResolver->getInputStream( rGraphicObjectURL ) );
+
+ if( xIn.is() )
+ {
+ XMLBase64Export aBase64Exp( *this );
+ bRet = aBase64Exp.exportOfficeBinaryDataElement( xIn );
+ }
+ }
+ }
+
+ return bRet;
+}
+
+OUString SvXMLExport::AddEmbeddedObject( const OUString& rEmbeddedObjectURL )
+{
+ OUString sRet;
+ if( (0 == rEmbeddedObjectURL.compareTo( msEmbeddedObjectProtocol,
+ msEmbeddedObjectProtocol.getLength() ) ||
+ 0 == rEmbeddedObjectURL.compareTo( msGraphicObjectProtocol,
+ msGraphicObjectProtocol.getLength() ) ) &&
+ mxEmbeddedResolver.is() )
+ {
+ sRet =
+ mxEmbeddedResolver->resolveEmbeddedObjectURL( rEmbeddedObjectURL );
+ }
+ else
+ sRet = GetRelativeReference( rEmbeddedObjectURL );
+
+ return sRet;
+}
+
+sal_Bool SvXMLExport::AddEmbeddedObjectAsBase64( const OUString& rEmbeddedObjectURL )
+{
+ sal_Bool bRet = sal_False;
+ if( (0 == rEmbeddedObjectURL.compareTo( msEmbeddedObjectProtocol,
+ msEmbeddedObjectProtocol.getLength() ) ||
+ 0 == rEmbeddedObjectURL.compareTo( msGraphicObjectProtocol,
+ msGraphicObjectProtocol.getLength() ) ) &&
+ mxEmbeddedResolver.is() )
+ {
+ Reference < XNameAccess > xNA( mxEmbeddedResolver, UNO_QUERY );
+ if( xNA.is() )
+ {
+ Any aAny = xNA->getByName( rEmbeddedObjectURL );
+ Reference < XInputStream > xIn;
+ aAny >>= xIn;
+ if( xIn.is() )
+ {
+ XMLBase64Export aBase64Exp( *this );
+ bRet = aBase64Exp.exportOfficeBinaryDataElement( xIn );
+ }
+ }
+ }
+
+ return bRet;
+}
+
+OUString SvXMLExport::EncodeStyleName(
+ const OUString& rName,
+ sal_Bool *pEncoded ) const
+{
+ return GetMM100UnitConverter().encodeStyleName( rName, pEncoded );
+}
+
+ProgressBarHelper* SvXMLExport::GetProgressBarHelper()
+{
+ if (!mpProgressBarHelper)
+ {
+ mpProgressBarHelper = new ProgressBarHelper(mxStatusIndicator, sal_True);
+
+ if (mxExportInfo.is())
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = mxExportInfo->getPropertySetInfo();
+ if (xPropertySetInfo.is())
+ {
+ OUString sProgressRange(RTL_CONSTASCII_USTRINGPARAM(XML_PROGRESSRANGE));
+ OUString sProgressMax(RTL_CONSTASCII_USTRINGPARAM(XML_PROGRESSMAX));
+ OUString sProgressCurrent(RTL_CONSTASCII_USTRINGPARAM(XML_PROGRESSCURRENT));
+ OUString sRepeat(RTL_CONSTASCII_USTRINGPARAM(XML_PROGRESSREPEAT));
+ if (xPropertySetInfo->hasPropertyByName(sProgressMax) &&
+ xPropertySetInfo->hasPropertyByName(sProgressCurrent) &&
+ xPropertySetInfo->hasPropertyByName(sProgressRange))
+ {
+ uno::Any aAny;
+ sal_Int32 nProgressMax(0);
+ sal_Int32 nProgressCurrent(0);
+ sal_Int32 nProgressRange(0);
+ aAny = mxExportInfo->getPropertyValue(sProgressRange);
+ if (aAny >>= nProgressRange)
+ mpProgressBarHelper->SetRange(nProgressRange);
+ aAny = mxExportInfo->getPropertyValue(sProgressMax);
+ if (aAny >>= nProgressMax)
+ mpProgressBarHelper->SetReference(nProgressMax);
+ aAny = mxExportInfo->getPropertyValue(sProgressCurrent);
+ if (aAny >>= nProgressCurrent)
+ mpProgressBarHelper->SetValue(nProgressCurrent);
+ }
+ if (xPropertySetInfo->hasPropertyByName(sRepeat))
+ {
+ uno::Any aAny = mxExportInfo->getPropertyValue(sRepeat);
+ if (aAny.getValueType() == getBooleanCppuType())
+ mpProgressBarHelper->SetRepeat(::cppu::any2bool(aAny));
+ else {
+ DBG_ERRORFILE("why is it no boolean?");
+ }
+ }
+ }
+ }
+ }
+ return mpProgressBarHelper;
+}
+
+XMLEventExport& SvXMLExport::GetEventExport()
+{
+ if( NULL == mpEventExport)
+ {
+ // create EventExport on demand
+ mpEventExport = new XMLEventExport(*this, NULL);
+
+ // and register standard handlers + names
+ OUString sStarBasic(RTL_CONSTASCII_USTRINGPARAM("StarBasic"));
+ mpEventExport->AddHandler(sStarBasic, new XMLStarBasicExportHandler());
+ OUString sScript(RTL_CONSTASCII_USTRINGPARAM("Script"));
+ mpEventExport->AddHandler(sScript, new XMLScriptExportHandler());
+ mpEventExport->AddTranslationTable(aStandardEventTable);
+ }
+
+ return *mpEventExport;
+}
+
+XMLImageMapExport& SvXMLExport::GetImageMapExport()
+{
+ // image map export, create on-demand
+ if( NULL == mpImageMapExport )
+ {
+ mpImageMapExport = new XMLImageMapExport(*this);
+ }
+
+ return *mpImageMapExport;
+}
+
+// XUnoTunnel & co
+const uno::Sequence< sal_Int8 > & SvXMLExport::getUnoTunnelId() throw()
+{
+ static uno::Sequence< sal_Int8 > * pSeq = 0;
+ if( !pSeq )
+ {
+ Guard< Mutex > aGuard( Mutex::getGlobalMutex() );
+ if( !pSeq )
+ {
+ static uno::Sequence< sal_Int8 > aSeq( 16 );
+ rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
+ pSeq = &aSeq;
+ }
+ }
+ return *pSeq;
+}
+
+SvXMLExport* SvXMLExport::getImplementation( uno::Reference< uno::XInterface > xInt ) throw()
+{
+ uno::Reference< lang::XUnoTunnel > xUT( xInt, uno::UNO_QUERY );
+ if( xUT.is() )
+ {
+ return
+ reinterpret_cast<SvXMLExport*>(
+ sal::static_int_cast<sal_IntPtr>(
+ xUT->getSomething( SvXMLExport::getUnoTunnelId())));
+ }
+ else
+ return NULL;
+}
+
+// XUnoTunnel
+sal_Int64 SAL_CALL SvXMLExport::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw( uno::RuntimeException )
+{
+ if( rId.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
+ }
+ return 0;
+}
+
+sal_Bool SvXMLExport::ExportEmbeddedOwnObject( Reference< XComponent >& rComp )
+{
+ OUString sFilterService;
+ bool bIsChart = false;
+
+ Reference < lang::XServiceInfo > xServiceInfo( rComp, UNO_QUERY );
+ if( xServiceInfo.is() )
+ {
+ const XMLServiceMapEntry_Impl *pEntry = aServiceMap;
+ while( pEntry->sModelService )
+ {
+ OUString sModelService( pEntry->sModelService,
+ pEntry->nModelServiceLen,
+ RTL_TEXTENCODING_ASCII_US );
+ if( xServiceInfo->supportsService( sModelService ) )
+ {
+ sFilterService = OUString( pEntry->sFilterService,
+ pEntry->nFilterServiceLen,
+ RTL_TEXTENCODING_ASCII_US );
+ bIsChart = sModelService.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( XML_MODEL_SERVICE_CHART ));
+ break;
+ }
+ pEntry++;
+ }
+ }
+
+ OSL_ENSURE( sFilterService.getLength(), "no export filter for own object" );
+
+ if( !sFilterService.getLength() )
+ return sal_False;
+
+ Reference < XDocumentHandler > xHdl =
+ new XMLEmbeddedObjectExportFilter( mxHandler );
+
+ Sequence < Any > aArgs( 1 );
+ // #144135# the filters for embedded objects in flat format are always
+ // instantiated as Oasis filters and transformed afterwards. Therefore, all
+ // special handling that is done if the exportFlags do not contain
+ // EXPORT_OASIS must be changed to properties being passed in the info
+ // propertyset
+
+ if( ! (getExportFlags() & EXPORT_OASIS) &&
+ bIsChart )
+ {
+ static ::comphelper::PropertyMapEntry aInfoMap[] =
+ {
+ { RTL_CONSTASCII_STRINGPARAM("ExportTableNumberList"), 0, &::getBooleanCppuType(), PropertyAttribute::MAYBEVOID, 0},
+ { NULL, 0, 0, NULL, 0, 0 }
+ };
+ Reference< XPropertySet > xInfoProp(
+ ::comphelper::GenericPropertySet_CreateInstance(
+ new ::comphelper::PropertySetInfo( aInfoMap )));
+
+ if( bIsChart )
+ xInfoProp->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("ExportTableNumberList")), makeAny( true ));
+
+ aArgs.realloc( 2 );
+ aArgs[1] <<= xInfoProp;
+ }
+ aArgs[0] <<= xHdl;
+
+ // #110680#
+ // Reference< lang::XMultiServiceFactory > xServiceFactory = comphelper::getProcessServiceFactory();
+ Reference< lang::XMultiServiceFactory > xServiceFactory = getServiceFactory();
+
+ Reference< document::XExporter > xExporter(
+ xServiceFactory->createInstanceWithArguments( sFilterService, aArgs),
+ UNO_QUERY);
+ OSL_ENSURE( xExporter.is(),
+ "can't instantiate export filter component for own object" );
+ if( !xExporter.is() )
+ return sal_False;
+
+ xExporter->setSourceDocument( rComp );
+
+ Reference<XFilter> xFilter( xExporter, UNO_QUERY );
+
+ Sequence < PropertyValue > aMediaDesc( 0 );
+ return xFilter->filter( aMediaDesc );
+}
+
+OUString SvXMLExport::GetRelativeReference(const OUString& rValue)
+{
+ OUString sValue( rValue );
+ // #i65474# handling of fragment URLs ("#....") is undefined
+ // they are stored 'as is'
+ uno::Reference< uri::XUriReference > xUriRef;
+ if(sValue.getLength() && sValue.getStr()[0] != '#')
+ {
+ try
+ {
+ xUriRef = mpImpl->mxUriReferenceFactory->parse( rValue );
+ if( xUriRef.is() && !xUriRef->isAbsolute() )
+ {
+ //#i61943# relative URLs need special handling
+ INetURLObject aTemp( mpImpl->msPackageURI );
+ bool bWasAbsolute = false;
+ sValue = aTemp.smartRel2Abs(sValue, bWasAbsolute ).GetMainURL(INetURLObject::DECODE_TO_IURI);
+ }
+ }
+ catch( uno::Exception& )
+ {
+ }
+ }
+ OUString sRet = sValue;
+ if( xUriRef.is() )//no conversion for empty values or for fragments
+ {
+ //conversion for matching schemes only
+ if( xUriRef->getScheme() == mpImpl->msPackageURIScheme )
+ {
+ sValue = INetURLObject::GetRelURL( msOrigFileName, sValue,
+ INetURLObject::WAS_ENCODED, INetURLObject::DECODE_TO_IURI, RTL_TEXTENCODING_UTF8, INetURLObject::FSYS_DETECT);
+ }
+ }
+ return sValue;
+}
+
+void SvXMLExport::StartElement(sal_uInt16 nPrefix,
+ enum ::xmloff::token::XMLTokenEnum eName,
+ sal_Bool bIgnWSOutside )
+{
+ StartElement(_GetNamespaceMap().GetQNameByKey( nPrefix,
+ GetXMLToken(eName) ), bIgnWSOutside);
+}
+
+void SvXMLExport::StartElement(const OUString& rName,
+ sal_Bool bIgnWSOutside )
+{
+ if ((mnErrorFlags & ERROR_DO_NOTHING) != ERROR_DO_NOTHING)
+ {
+ try
+ {
+ if( bIgnWSOutside && ((mnExportFlags & EXPORT_PRETTY) == EXPORT_PRETTY))
+ mxHandler->ignorableWhitespace( msWS );
+ mxHandler->startElement( rName, GetXAttrList() );
+ }
+ catch ( SAXInvalidCharacterException& e )
+ {
+ Sequence<OUString> aPars(1);
+ aPars[0] = rName;
+ SetError( XMLERROR_SAX|XMLERROR_FLAG_WARNING, aPars, e.Message, NULL );
+ }
+ catch ( SAXException& e )
+ {
+ Sequence<OUString> aPars(1);
+ aPars[0] = rName;
+ SetError( XMLERROR_SAX|XMLERROR_FLAG_ERROR|XMLERROR_FLAG_SEVERE,
+ aPars, e.Message, NULL );
+ }
+ }
+ ClearAttrList();
+ ++mpImpl->mDepth; // increment nesting depth counter
+}
+
+void SvXMLExport::Characters(const ::rtl::OUString& rChars)
+{
+ if ((mnErrorFlags & ERROR_DO_NOTHING) != ERROR_DO_NOTHING)
+ {
+ try
+ {
+ mxHandler->characters(rChars);
+ }
+ catch ( SAXInvalidCharacterException& e )
+ {
+ Sequence<OUString> aPars(1);
+ aPars[0] = rChars;
+ SetError( XMLERROR_SAX|XMLERROR_FLAG_WARNING, aPars, e.Message, NULL );
+ }
+ catch ( SAXException& e )
+ {
+ Sequence<OUString> aPars(1);
+ aPars[0] = rChars;
+ SetError( XMLERROR_SAX|XMLERROR_FLAG_ERROR|XMLERROR_FLAG_SEVERE,
+ aPars, e.Message, NULL );
+ }
+ }
+}
+
+void SvXMLExport::EndElement(sal_uInt16 nPrefix,
+ enum ::xmloff::token::XMLTokenEnum eName,
+ sal_Bool bIgnWSInside )
+{
+ EndElement(_GetNamespaceMap().GetQNameByKey( nPrefix, GetXMLToken(eName) ),
+ bIgnWSInside);
+}
+
+void SvXMLExport::EndElement(const OUString& rName,
+ sal_Bool bIgnWSInside )
+{
+ // decrement nesting depth counter & (maybe) restore namespace map
+ --mpImpl->mDepth;
+ if (!mpImpl->mNamespaceMaps.empty() &&
+ (mpImpl->mNamespaceMaps.top().second == mpImpl->mDepth))
+ {
+ delete mpNamespaceMap;
+ mpNamespaceMap = mpImpl->mNamespaceMaps.top().first;
+ mpImpl->mNamespaceMaps.pop();
+ }
+ OSL_ENSURE(mpImpl->mNamespaceMaps.empty() ||
+ (mpImpl->mNamespaceMaps.top().second < mpImpl->mDepth),
+ "SvXMLExport: NamespaceMaps corrupted");
+
+ if ((mnErrorFlags & ERROR_DO_NOTHING) != ERROR_DO_NOTHING)
+ {
+ try
+ {
+ if( bIgnWSInside && ((mnExportFlags & EXPORT_PRETTY) == EXPORT_PRETTY))
+ mxHandler->ignorableWhitespace( msWS );
+ mxHandler->endElement( rName );
+ }
+ catch ( SAXException& e )
+ {
+ Sequence<OUString> aPars(1);
+ aPars[0] = rName;
+ SetError( XMLERROR_SAX|XMLERROR_FLAG_ERROR|XMLERROR_FLAG_SEVERE,
+ aPars, e.Message, NULL );
+ }
+ }
+}
+
+void SvXMLExport::IgnorableWhitespace()
+{
+ if ((mnExportFlags & EXPORT_PRETTY) != EXPORT_PRETTY)
+ return;
+
+ if ((mnErrorFlags & ERROR_DO_NOTHING) != ERROR_DO_NOTHING)
+ {
+ try
+ {
+ mxHandler->ignorableWhitespace( msWS );
+ }
+ catch ( SAXException& e )
+ {
+ Sequence<OUString> aPars(0);
+ SetError( XMLERROR_SAX|XMLERROR_FLAG_ERROR|XMLERROR_FLAG_SEVERE,
+ aPars, e.Message, NULL );
+ }
+ }
+}
+
+
+void SvXMLExport::SetError(
+ sal_Int32 nId,
+ const Sequence<OUString>& rMsgParams,
+ const OUString& rExceptionMessage,
+ const Reference<XLocator>& rLocator )
+{
+ // allow multi-threaded access to the cancel() method
+ static osl::Mutex aMutex;
+ osl::MutexGuard aGuard(aMutex);
+
+ // maintain error flags
+ if ( ( nId & XMLERROR_FLAG_ERROR ) != 0 )
+ mnErrorFlags |= ERROR_ERROR_OCCURRED;
+ if ( ( nId & XMLERROR_FLAG_WARNING ) != 0 )
+ mnErrorFlags |= ERROR_WARNING_OCCURRED;
+ if ( ( nId & XMLERROR_FLAG_SEVERE ) != 0 )
+ mnErrorFlags |= ERROR_DO_NOTHING;
+
+ // create error lsit on demand
+ if ( mpXMLErrors == NULL )
+ mpXMLErrors = new XMLErrors();
+
+ // save error information
+ mpXMLErrors->AddRecord( nId, rMsgParams, rExceptionMessage, rLocator );
+}
+
+void SvXMLExport::SetError(
+ sal_Int32 nId,
+ const Sequence<OUString>& rMsgParams)
+{
+ OUString sEmpty;
+ SetError( nId, rMsgParams, sEmpty, NULL );
+}
+
+
+XMLErrors* SvXMLExport::GetErrors()
+{
+ return mpXMLErrors;
+}
+
+void SvXMLExport::DisposingModel()
+{
+ mxModel.clear();
+ // Shapes in Writer cannot be named via context menu (#i51726#)
+ meModelType = SvtModuleOptions::E_UNKNOWN_FACTORY;;
+ mxEventListener.clear();
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > SvXMLExport::getServiceFactory()
+{
+ return mxServiceFactory;
+}
+
+uno::Reference< uno::XComponentContext >
+SvXMLExport::GetComponentContext() const
+{
+ return mpImpl->mxComponentContext;
+}
+
+::comphelper::UnoInterfaceToUniqueIdentifierMapper& SvXMLExport::getInterfaceToIdentifierMapper()
+{
+ return mpImpl->maInterfaceToIdentifierMapper;
+}
+
+// Written OpenDocument file format doesn't fit to the created text document (#i69627#)
+sal_Bool SvXMLExport::writeOutlineStyleAsNormalListStyle() const
+{
+ return mpImpl->mbOutlineStyleAsNormalListStyle;
+}
+
+uno::Reference< embed::XStorage > SvXMLExport::GetTargetStorage()
+{
+ return mpImpl->mxTargetStorage;
+}
+
+/// returns the currently configured default version for odf export
+SvtSaveOptions::ODFDefaultVersion SvXMLExport::getDefaultVersion() const
+{
+ if( mpImpl )
+ return mpImpl->maSaveOptions.GetODFDefaultVersion();
+
+ // fatal error, use current version as default
+ return SvtSaveOptions::ODFVER_012;
+}
+
+::rtl::OUString SvXMLExport::GetStreamName() const
+{
+ return mpImpl->mStreamName;
+}
+
+void
+SvXMLExport::AddAttributeIdLegacy(
+ sal_uInt16 const nLegacyPrefix, ::rtl::OUString const& rValue)
+{
+ switch (getDefaultVersion()) {
+ case SvtSaveOptions::ODFVER_011: // fall thru
+ case SvtSaveOptions::ODFVER_010: break;
+ default: // ODF 1.2: xml:id
+ AddAttribute(XML_NAMESPACE_XML, XML_ID, rValue);
+ }
+ // in ODF 1.1 this was form:id, anim:id, draw:id, or text:id
+ // backward compatibility: in ODF 1.2 write _both_ id attrs
+ AddAttribute(nLegacyPrefix, XML_ID, rValue);
+ // FIXME: this function simply assumes that rValue is unique
+}
+
+void
+SvXMLExport::AddAttributeXmlId(uno::Reference<uno::XInterface> const & i_xIfc)
+{
+ // check version >= 1.2
+ switch (getDefaultVersion()) {
+ case SvtSaveOptions::ODFVER_011: // fall thru
+ case SvtSaveOptions::ODFVER_010: return;
+ default: break;
+ }
+ const uno::Reference<rdf::XMetadatable> xMeta(i_xIfc,
+ uno::UNO_QUERY);
+//FIXME not yet...
+ if ( xMeta.is() )
+ {
+ const beans::StringPair mdref( xMeta->getMetadataReference() );
+ if ( mdref.Second.getLength() )
+ {
+ const ::rtl::OUString streamName( GetStreamName() );
+ if ( streamName.getLength() )
+ {
+ if ( streamName.equals(mdref.First) )
+ {
+ AddAttribute( XML_NAMESPACE_XML, XML_ID, mdref.Second );
+ }
+ else
+ {
+ OSL_FAIL("SvXMLExport::AddAttributeXmlId: "
+ "invalid stream name");
+ }
+ }
+ else
+ {
+ // FIXME: this is ugly
+ // there is no stream name (e.g. XSLT, flat-xml format)!
+ // but how do we ensure uniqueness in this case?
+ // a) just omit styles.xml ids -- they are unlikely anyway...
+ // b) somehow find out whether we are currently exporting styles
+ // or content, and prefix "s" or "c" => unique
+ if ( mdref.First.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("content.xml")) )
+ {
+ AddAttribute( XML_NAMESPACE_XML, XML_ID, mdref.Second );
+ }
+ else
+ {
+ OSL_TRACE("SvXMLExport::AddAttributeXmlId: "
+ "no stream name given: dropping styles.xml xml:id");
+ }
+ }
+ }
+ }
+}
+
+void
+SvXMLExport::AddAttributesRDFa(
+ uno::Reference<text::XTextContent> const & i_xTextContent)
+{
+ // check version >= 1.2
+ switch (getDefaultVersion()) {
+ case SvtSaveOptions::ODFVER_011: // fall thru
+ case SvtSaveOptions::ODFVER_010: return;
+ default: break;
+ }
+
+ const uno::Reference<rdf::XMetadatable> xMeta(
+ i_xTextContent, uno::UNO_QUERY);
+ if (!xMeta.is() || !xMeta->getMetadataReference().Second.getLength())
+ {
+ return; // no xml:id => no RDFa
+ }
+
+ if (!mpImpl->mpRDFaHelper.get())
+ {
+ mpImpl->mpRDFaHelper.reset( new ::xmloff::RDFaExportHelper(*this) );
+ }
+ mpImpl->mpRDFaHelper->AddRDFa(xMeta);
+}
+
+sal_Bool SvXMLExport::exportTextNumberElement() const
+{
+ return mpImpl->mbExportTextNumberElement;
+}
+
+sal_Bool SvXMLExport::SetNullDateOnUnitConverter()
+{
+ // if the null date has already been set, don't set it again (performance)
+ if (!mpImpl->mbNullDateInitialized)
+ mpImpl->mbNullDateInitialized = GetMM100UnitConverter().setNullDate(GetModel());
+
+ return mpImpl->mbNullDateInitialized;
+}
+
+//=============================================================================
+
+void SvXMLElementExport::StartElement( SvXMLExport& rExp,
+ sal_uInt16 nPrefixKey,
+ const OUString& rLName,
+ sal_Bool bIWSOutside )
+{
+ aName = rExp.GetNamespaceMap().GetQNameByKey(nPrefixKey, rLName);
+ rExp.StartElement(aName, bIWSOutside);
+}
+
+SvXMLElementExport::SvXMLElementExport( SvXMLExport& rExp,
+ sal_uInt16 nPrefixKey,
+ const sal_Char *pLName,
+ sal_Bool bIWSOutside,
+ sal_Bool bIWSInside ) :
+ rExport( rExp ),
+ bIgnWS( bIWSInside ),
+ bDoSomething( sal_True )
+{
+ OUString sLName( OUString::createFromAscii(pLName) );
+ StartElement( rExp, nPrefixKey, sLName, bIWSOutside );
+}
+
+SvXMLElementExport::SvXMLElementExport( SvXMLExport& rExp,
+ sal_uInt16 nPrefixKey,
+ const OUString& rLName,
+ sal_Bool bIWSOutside,
+ sal_Bool bIWSInside ) :
+ rExport( rExp ),
+ bIgnWS( bIWSInside ),
+ bDoSomething( sal_True )
+{
+ StartElement( rExp, nPrefixKey, rLName, bIWSOutside );
+}
+
+SvXMLElementExport::SvXMLElementExport( SvXMLExport& rExp,
+ sal_uInt16 nPrefixKey,
+ enum XMLTokenEnum eLName,
+ sal_Bool bIWSOutside,
+ sal_Bool bIWSInside ) :
+ rExport( rExp ),
+ bIgnWS( bIWSInside ),
+ bDoSomething( sal_True )
+{
+ StartElement( rExp, nPrefixKey, GetXMLToken(eLName), bIWSOutside );
+}
+
+SvXMLElementExport::SvXMLElementExport( SvXMLExport& rExp,
+ sal_Bool bDoSth,
+ sal_uInt16 nPrefixKey,
+ const sal_Char *pLName,
+ sal_Bool bIWSOutside,
+ sal_Bool bIWSInside ) :
+ rExport( rExp ),
+ bIgnWS( bIWSInside ),
+ bDoSomething( bDoSth )
+{
+ if( bDoSomething )
+ {
+ OUString sLName( OUString::createFromAscii(pLName) );
+ StartElement( rExp, nPrefixKey, sLName, bIWSOutside );
+ }
+}
+
+SvXMLElementExport::SvXMLElementExport( SvXMLExport& rExp,
+ sal_Bool bDoSth,
+ sal_uInt16 nPrefixKey,
+ const OUString& rLName,
+ sal_Bool bIWSOutside,
+ sal_Bool bIWSInside ) :
+ rExport( rExp ),
+ bIgnWS( bIWSInside ),
+ bDoSomething( bDoSth )
+{
+ if( bDoSomething )
+ StartElement( rExp, nPrefixKey, rLName, bIWSOutside );
+}
+
+SvXMLElementExport::SvXMLElementExport( SvXMLExport& rExp,
+ sal_Bool bDoSth,
+ sal_uInt16 nPrefixKey,
+ enum XMLTokenEnum eLName,
+ sal_Bool bIWSOutside,
+ sal_Bool bIWSInside ) :
+ rExport( rExp ),
+ bIgnWS( bIWSInside ),
+ bDoSomething( bDoSth )
+{
+ if( bDoSomething )
+ StartElement( rExport, nPrefixKey, GetXMLToken(eLName), bIWSOutside );
+}
+
+SvXMLElementExport::SvXMLElementExport( SvXMLExport& rExp,
+ const OUString& rQName,
+ sal_Bool bIWSOutside,
+ sal_Bool bIWSInside ) :
+ rExport( rExp ),
+ bIgnWS( bIWSInside ),
+ bDoSomething( sal_True )
+{
+ aName = rQName;
+ rExp.StartElement( rQName, bIWSOutside );
+}
+
+SvXMLElementExport::~SvXMLElementExport()
+{
+ if( bDoSomething )
+ {
+ rExport.EndElement( aName, bIgnWS );
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/core/xmlictxt.cxx b/xmloff/source/core/xmlictxt.cxx
new file mode 100644
index 000000000000..35fddeb25957
--- /dev/null
+++ b/xmloff/source/core/xmlictxt.cxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/xml/sax/SAXParseException.hpp>
+#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/SAXException.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/xml/sax/XLocator.hpp>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmlictxt.hxx>
+#include <tools/debug.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+
+DBG_NAME(SvXMLImportContext)
+TYPEINIT0( SvXMLImportContext );
+SvXMLImportContext::SvXMLImportContext( SvXMLImport& rImp, sal_uInt16 nPrfx,
+ const OUString& rLName ) :
+ mrImport( rImp ),
+ mnPrefix( nPrfx ),
+ maLocalName( rLName ),
+ mpRewindMap( 0 )
+{
+ DBG_CTOR(SvXMLImportContext,NULL);
+
+}
+
+SvXMLImportContext::~SvXMLImportContext()
+{
+
+ DBG_DTOR(SvXMLImportContext,NULL);
+}
+
+SvXMLImportContext *SvXMLImportContext::CreateChildContext( sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ return mrImport.CreateContext( nPrefix, rLocalName, xAttrList );
+}
+
+void SvXMLImportContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& )
+{
+}
+
+void SvXMLImportContext::EndElement()
+{
+}
+
+void SvXMLImportContext::Characters( const OUString& )
+{
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
new file mode 100644
index 000000000000..44a8adc7c824
--- /dev/null
+++ b/xmloff/source/core/xmlimp.cxx
@@ -0,0 +1,1998 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <tools/debug.hxx>
+#include <tools/urlobj.hxx>
+#include <osl/mutex.hxx>
+#include <rtl/uuid.h>
+#include <rtl/memory.h>
+#include <svl/svarray.hxx>
+#include "unointerfacetouniqueidentifiermapper.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/XMLFontStylesContext.hxx>
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmlnumfi.hxx>
+#include "XMLEventImportHelper.hxx"
+#include "XMLStarBasicContextFactory.hxx"
+#include "XMLScriptContextFactory.hxx"
+#include "StyleMap.hxx"
+#include <xmloff/ProgressBarHelper.hxx>
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlerror.hxx"
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/document/XBinaryStreamResolver.hpp>
+#include <com/sun/star/document/XStorageBasedDocument.hpp>
+#include <com/sun/star/xml/sax/XLocator.hpp>
+#include <com/sun/star/packages/zip/ZipIOException.hpp>
+#include <comphelper/namecontainer.hxx>
+#include <rtl/logfile.hxx>
+#include <tools/string.hxx> // used in StartElement for logging
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/extract.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/documentconstants.hxx>
+#include <comphelper/storagehelper.hxx>
+#include <unotools/fontcvt.hxx>
+
+#include <com/sun/star/rdf/XMetadatable.hpp>
+#include <com/sun/star/rdf/XRepositorySupplier.hpp>
+#include "RDFaImportHelper.hxx"
+
+#define LOGFILE_AUTHOR "unknown"
+
+using ::com::sun::star::beans::XPropertySetInfo;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::osl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::document;
+using namespace ::xmloff::token;
+
+sal_Char const sXML_np__office[] = "_office";
+sal_Char const sXML_np__office_ext[] = "_office_ooo";
+sal_Char const sXML_np__ooo[] = "_ooo";
+sal_Char const sXML_np__ooow[] = "_ooow";
+sal_Char const sXML_np__oooc[] = "_oooc";
+sal_Char const sXML_np__of[] = "_of";
+sal_Char const sXML_np__style[] = "_style";
+sal_Char const sXML_np__text[] = "_text";
+sal_Char const sXML_np__table[] = "_table";
+sal_Char const sXML_np__table_ext[] = "_table_ooo";
+sal_Char const sXML_np__draw[] = "_draw";
+sal_Char const sXML_np__draw_ext[] = "_draw_ooo";
+sal_Char const sXML_np__dr3d[] = "_dr3d";
+sal_Char const sXML_np__fo[] = "_fo";
+sal_Char const sXML_np__xlink[] = "_xlink";
+sal_Char const sXML_np__dc[] = "_dc";
+sal_Char const sXML_np__dom[] = "_dom";
+sal_Char const sXML_np__meta[] = "_meta";
+sal_Char const sXML_np__number[] = "_number";
+sal_Char const sXML_np__svg[] = "_svg";
+sal_Char const sXML_np__chart[] = "_chart";
+sal_Char const sXML_np__math[] = "_math";
+sal_Char const sXML_np__form[] = "_form";
+sal_Char const sXML_np__script[] = "_script";
+sal_Char const sXML_np__config[] = "_config";
+sal_Char const sXML_np__db[] = "_db";
+sal_Char const sXML_np__xforms[] = "_xforms";
+sal_Char const sXML_np__formx[] = "_formx";
+sal_Char const sXML_np__xsd[] = "_xsd";
+sal_Char const sXML_np__xsi[] = "_xsi";
+sal_Char const sXML_np__field[] = "_field";
+sal_Char const sXML_np__xhtml[] = "_xhtml";
+sal_Char const sXML_np__css3text[] = "_css3text";
+
+sal_Char const sXML_np__fo_old[] = "__fo";
+sal_Char const sXML_np__xlink_old[] = "__xlink";
+sal_Char const sXML_np__office_old[] = "__office";
+sal_Char const sXML_np__style_old[] = "__style";
+sal_Char const sXML_np__text_old[] = "__text";
+sal_Char const sXML_np__table_old[] = "__table";
+sal_Char const sXML_np__meta_old[] = "__meta";
+
+
+
+class SvXMLImportEventListener : public cppu::WeakImplHelper1<
+ com::sun::star::lang::XEventListener >
+{
+private:
+ SvXMLImport* pImport;
+
+public:
+ SvXMLImportEventListener(SvXMLImport* pImport);
+ virtual ~SvXMLImportEventListener();
+
+ // XEventListener
+ virtual void SAL_CALL disposing(const lang::EventObject& rEventObject) throw(::com::sun::star::uno::RuntimeException);
+};
+
+SvXMLImportEventListener::SvXMLImportEventListener(SvXMLImport* pTempImport)
+ : pImport(pTempImport)
+{
+}
+
+SvXMLImportEventListener::~SvXMLImportEventListener()
+{
+}
+
+// XEventListener
+void SAL_CALL SvXMLImportEventListener::disposing( const lang::EventObject& )
+ throw(uno::RuntimeException)
+{
+ if (pImport)
+ {
+ pImport->DisposingModel();
+ pImport = NULL;
+ }
+}
+
+//==============================================================================
+
+class SvXMLImport_Impl
+{
+public:
+ FontToSubsFontConverter hBatsFontConv;
+ FontToSubsFontConverter hMathFontConv;
+
+ bool mbOwnGraphicResolver;
+ bool mbOwnEmbeddedResolver;
+ INetURLObject aBaseURL;
+ INetURLObject aDocBase;
+
+ /// name of stream in package, e.g., "content.xml"
+ ::rtl::OUString mStreamName;
+
+ ::rtl::OUString aODFVersion;
+
+ // Boolean, indicating that position attributes
+ // of shapes are given in horizontal left-to-right layout. This is the case
+ // for the OpenOffice.org file format. (#i28749#)
+ sal_Bool mbShapePositionInHoriL2R;
+ sal_Bool mbTextDocInOOoFileFormat;
+
+ const uno::Reference< uno::XComponentContext > mxComponentContext;
+
+ std::auto_ptr< xmloff::RDFaImportHelper > mpRDFaHelper;
+
+ SvXMLImport_Impl() :
+ hBatsFontConv( 0 ), hMathFontConv( 0 ),
+ mbOwnGraphicResolver( false ),
+ mbOwnEmbeddedResolver( false ),
+ mStreamName(),
+ // Convert drawing object positions from OOo file format to OASIS (#i28749#)
+ mbShapePositionInHoriL2R( sal_False ),
+ mbTextDocInOOoFileFormat( sal_False ),
+ mxComponentContext( ::comphelper::getProcessComponentContext() ),
+ mpRDFaHelper() // lazy
+ {
+ OSL_ENSURE(mxComponentContext.is(), "SvXMLImport: no ComponentContext");
+ if (!mxComponentContext.is()) throw uno::RuntimeException();
+ }
+
+ ~SvXMLImport_Impl()
+ {
+ if( hBatsFontConv )
+ DestroyFontToSubsFontConverter( hBatsFontConv );
+ if( hMathFontConv )
+ DestroyFontToSubsFontConverter( hMathFontConv );
+ }
+
+ ::comphelper::UnoInterfaceToUniqueIdentifierMapper maInterfaceToIdentifierMapper;
+};
+
+typedef SvXMLImportContext *SvXMLImportContextPtr;
+SV_DECL_PTRARR( SvXMLImportContexts_Impl, SvXMLImportContextPtr, 20, 5 )
+SV_IMPL_PTRARR( SvXMLImportContexts_Impl, SvXMLImportContextPtr )
+
+SvXMLImportContext *SvXMLImport::CreateContext( sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList >& )
+{
+ return new SvXMLImportContext( *this, nPrefix, rLocalName );
+}
+
+void SvXMLImport::_InitCtor()
+{
+ if( mnImportFlags != 0 )
+ {
+ // implicit "xml" namespace prefix
+ mpNamespaceMap->Add( GetXMLToken(XML_XML), GetXMLToken(XML_N_XML),
+ XML_NAMESPACE_XML );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__office ) ),
+ GetXMLToken(XML_N_OFFICE),
+ XML_NAMESPACE_OFFICE );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__office_ext ) ),
+ GetXMLToken(XML_N_OFFICE_EXT),
+ XML_NAMESPACE_OFFICE_EXT );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__ooo ) ), GetXMLToken(XML_N_OOO), XML_NAMESPACE_OOO );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__style) ),
+ GetXMLToken(XML_N_STYLE),
+ XML_NAMESPACE_STYLE );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__text) ),
+ GetXMLToken(XML_N_TEXT),
+ XML_NAMESPACE_TEXT );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__table ) ),
+ GetXMLToken(XML_N_TABLE),
+ XML_NAMESPACE_TABLE );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__table_ext ) ),
+ GetXMLToken(XML_N_TABLE_EXT),
+ XML_NAMESPACE_TABLE_EXT );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__draw ) ),
+ GetXMLToken(XML_N_DRAW),
+ XML_NAMESPACE_DRAW );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__draw_ext ) ),
+ GetXMLToken(XML_N_DRAW_EXT),
+ XML_NAMESPACE_DRAW_EXT );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM (sXML_np__dr3d ) ),
+ GetXMLToken(XML_N_DR3D),
+ XML_NAMESPACE_DR3D );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__fo) ),
+ GetXMLToken(XML_N_FO_COMPAT),
+ XML_NAMESPACE_FO );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__xlink) ),
+ GetXMLToken(XML_N_XLINK),
+ XML_NAMESPACE_XLINK );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__dc) ),
+ GetXMLToken(XML_N_DC),
+ XML_NAMESPACE_DC );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__dom ) ),
+ GetXMLToken(XML_N_DOM),
+ XML_NAMESPACE_DOM );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__meta) ),
+ GetXMLToken(XML_N_META),
+ XML_NAMESPACE_META );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__number) ),
+ GetXMLToken(XML_N_NUMBER),
+ XML_NAMESPACE_NUMBER );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__svg) ),
+ GetXMLToken(XML_N_SVG_COMPAT),
+ XML_NAMESPACE_SVG );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__chart) ),
+ GetXMLToken(XML_N_CHART),
+ XML_NAMESPACE_CHART );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__math) ),
+ GetXMLToken(XML_N_MATH),
+ XML_NAMESPACE_MATH );
+ mpNamespaceMap->Add(OUString(RTL_CONSTASCII_USTRINGPARAM( sXML_np__form )),
+ GetXMLToken(XML_N_FORM),
+ XML_NAMESPACE_FORM );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__script) ),
+ GetXMLToken(XML_N_SCRIPT),
+ XML_NAMESPACE_SCRIPT );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__config) ),
+ GetXMLToken(XML_N_CONFIG),
+ XML_NAMESPACE_CONFIG );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__xforms) ),
+ GetXMLToken(XML_N_XFORMS_1_0),
+ XML_NAMESPACE_XFORMS );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__formx) ),
+ GetXMLToken( XML_N_FORMX ),
+ XML_NAMESPACE_FORMX );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__xsd) ),
+ GetXMLToken(XML_N_XSD),
+ XML_NAMESPACE_XSD );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__xsi) ),
+ GetXMLToken(XML_N_XSI),
+ XML_NAMESPACE_XFORMS );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__ooow ) ), GetXMLToken(XML_N_OOOW), XML_NAMESPACE_OOOW );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__oooc ) ), GetXMLToken(XML_N_OOOC), XML_NAMESPACE_OOOC );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__field ) ), GetXMLToken(XML_N_FIELD), XML_NAMESPACE_FIELD );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__of ) ),
+ GetXMLToken(XML_N_OF), XML_NAMESPACE_OF );
+ mpNamespaceMap->Add(
+ OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__xhtml ) ),
+ GetXMLToken(XML_N_XHTML), XML_NAMESPACE_XHTML );
+ mpNamespaceMap->Add(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( sXML_np__css3text ) ),
+ GetXMLToken(XML_N_CSS3TEXT), XML_NAMESPACE_CSS3TEXT );
+ }
+
+ msPackageProtocol = OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package:" ) );
+
+ if (mxNumberFormatsSupplier.is())
+ mpNumImport = new SvXMLNumFmtHelper(mxNumberFormatsSupplier, getServiceFactory());
+
+ if (mxModel.is() && !mxEventListener.is())
+ {
+ mxEventListener.set(new SvXMLImportEventListener(this));
+ mxModel->addEventListener(mxEventListener);
+ }
+
+ ::comphelper::UnoInterfaceToUniqueIdentifierMapper maInterfaceToIdentifierMapper;
+
+}
+
+// #110680#
+SvXMLImport::SvXMLImport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ sal_uInt16 nImportFlags ) throw ()
+: mpImpl( new SvXMLImport_Impl() ),
+ mpNamespaceMap( new SvXMLNamespaceMap ),
+
+ // #110680#
+ mpUnitConv( new SvXMLUnitConverter( MAP_100TH_MM, MAP_100TH_MM, xServiceFactory ) ),
+
+ mpContexts( new SvXMLImportContexts_Impl ),
+ mpNumImport( NULL ),
+ mpProgressBarHelper( NULL ),
+ mpEventImportHelper( NULL ),
+ mpXMLErrors( NULL ),
+ mpStyleMap(0),
+ mnImportFlags( nImportFlags ),
+ mnErrorFlags(0),
+ // #110680#
+ mxServiceFactory(xServiceFactory),
+ mbIsFormsSupported( sal_True ),
+ mbIsTableShapeSupported( false ),
+ mbIsGraphicLoadOnDemandSupported( true )
+{
+ DBG_ASSERT( mxServiceFactory.is(), "got no service manager" );
+ _InitCtor();
+}
+
+// #110680#
+SvXMLImport::SvXMLImport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ const Reference< XModel > & rModel ) throw ()
+: mxModel( rModel ),
+ mxNumberFormatsSupplier (rModel, uno::UNO_QUERY),
+ mpImpl( new SvXMLImport_Impl() ),
+ mpNamespaceMap( new SvXMLNamespaceMap ),
+ // #110680#
+ mpUnitConv( new SvXMLUnitConverter( MAP_100TH_MM, MAP_100TH_MM, xServiceFactory ) ),
+ mpContexts( new SvXMLImportContexts_Impl ),
+ mpNumImport( NULL ),
+ mpProgressBarHelper( NULL ),
+ mpEventImportHelper( NULL ),
+ mpXMLErrors( NULL ),
+ mpStyleMap(0),
+ mnImportFlags( IMPORT_ALL ),
+ mnErrorFlags(0),
+ // #110680#
+ mxServiceFactory(xServiceFactory),
+ mbIsFormsSupported( sal_True ),
+ mbIsTableShapeSupported( false ),
+ mbIsGraphicLoadOnDemandSupported( true )
+{
+ DBG_ASSERT( mxServiceFactory.is(), "got no service manager" );
+ _InitCtor();
+}
+
+// #110680#
+SvXMLImport::SvXMLImport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ const Reference< XModel > & rModel,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::document::XGraphicObjectResolver > & rGraphicObjects ) throw ()
+: mxModel( rModel ),
+ mxNumberFormatsSupplier (rModel, uno::UNO_QUERY),
+ mxGraphicResolver( rGraphicObjects ),
+ mpImpl( new SvXMLImport_Impl() ),
+ mpNamespaceMap( new SvXMLNamespaceMap ),
+ // #110680#
+ mpUnitConv( new SvXMLUnitConverter( MAP_100TH_MM, MAP_100TH_MM, xServiceFactory ) ),
+ mpContexts( new SvXMLImportContexts_Impl ),
+ mpNumImport( NULL ),
+ mpProgressBarHelper( NULL ),
+ mpEventImportHelper( NULL ),
+ mpXMLErrors( NULL ),
+ mpStyleMap(0),
+ mnImportFlags( IMPORT_ALL ),
+ mnErrorFlags(0),
+ // #110680#
+ mxServiceFactory(xServiceFactory),
+ mbIsFormsSupported( sal_True ),
+ mbIsGraphicLoadOnDemandSupported( true )
+{
+ DBG_ASSERT( mxServiceFactory.is(), "got no service manager" );
+ _InitCtor();
+}
+
+SvXMLImport::~SvXMLImport() throw ()
+{
+ delete mpXMLErrors;
+ delete mpNamespaceMap;
+ delete mpUnitConv;
+ delete mpEventImportHelper;
+ if( mpContexts )
+ {
+ while( mpContexts->Count() )
+ {
+ sal_uInt16 n = mpContexts->Count() - 1;
+ SvXMLImportContext *pContext = (*mpContexts)[n];
+ mpContexts->Remove( n, 1 );
+ if( pContext )
+ pContext->ReleaseRef();
+ }
+ delete mpContexts;
+ }
+
+ // #i9518# the import component might not be deleted until after the document has been closed,
+ // so the stuff that accesses the document has been moved to endDocument.
+
+ // pNumImport is allocated in the ctor, so it must also be deleted here in case the component
+ // is created and deleted without actually importing.
+ delete mpNumImport;
+ delete mpProgressBarHelper;
+
+ xmloff::token::ResetTokens();
+
+ if( mpImpl )
+ delete mpImpl;
+
+ if (mxEventListener.is() && mxModel.is())
+ mxModel->removeEventListener(mxEventListener);
+}
+
+// XUnoTunnel & co
+const uno::Sequence< sal_Int8 > & SvXMLImport::getUnoTunnelId() throw()
+{
+ static uno::Sequence< sal_Int8 > * pSeq = 0;
+ if( !pSeq )
+ {
+ Guard< Mutex > aGuard( Mutex::getGlobalMutex() );
+ if( !pSeq )
+ {
+ static uno::Sequence< sal_Int8 > aSeq( 16 );
+ rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
+ pSeq = &aSeq;
+ }
+ }
+ return *pSeq;
+}
+
+SvXMLImport* SvXMLImport::getImplementation( uno::Reference< uno::XInterface > xInt ) throw()
+{
+ uno::Reference< lang::XUnoTunnel > xUT( xInt, uno::UNO_QUERY );
+ if( xUT.is() )
+ {
+ return
+ reinterpret_cast<SvXMLImport*>(
+ sal::static_int_cast<sal_IntPtr>(
+ xUT->getSomething( SvXMLImport::getUnoTunnelId())));
+ }
+ else
+ return NULL;
+}
+
+// XUnoTunnel
+sal_Int64 SAL_CALL SvXMLImport::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw( uno::RuntimeException )
+{
+ if( rId.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
+ }
+ return 0;
+}
+
+void SAL_CALL SvXMLImport::startDocument( void )
+ throw( xml::sax::SAXException, uno::RuntimeException )
+{
+ RTL_LOGFILE_TRACE_AUTHOR( "xmloff", LOGFILE_AUTHOR, "{ SvXMLImport::startDocument" );
+
+ if( !mxGraphicResolver.is() || !mxEmbeddedResolver.is() )
+ {
+ Reference< lang::XMultiServiceFactory > xFactory( mxModel, UNO_QUERY );
+ if( xFactory.is() )
+ {
+ try
+ {
+ if( !mxGraphicResolver.is() )
+ {
+ mxGraphicResolver = Reference< XGraphicObjectResolver >::query(
+ xFactory->createInstance(
+ OUString(RTL_CONSTASCII_USTRINGPARAM(
+ // #99870# Import... instead of Export...
+ "com.sun.star.document.ImportGraphicObjectResolver"))));
+ mpImpl->mbOwnGraphicResolver = mxGraphicResolver.is();
+ }
+
+ if( !mxEmbeddedResolver.is() )
+ {
+ mxEmbeddedResolver = Reference< XEmbeddedObjectResolver >::query(
+ xFactory->createInstance(
+ OUString(RTL_CONSTASCII_USTRINGPARAM(
+ // #99870# Import... instead of Export...
+ "com.sun.star.document.ImportEmbeddedObjectResolver"))));
+ mpImpl->mbOwnEmbeddedResolver = mxEmbeddedResolver.is();
+ }
+ }
+ catch( com::sun::star::uno::Exception& )
+ {
+ }
+ }
+ }
+}
+
+void SAL_CALL SvXMLImport::endDocument( void )
+ throw( xml::sax::SAXException, uno::RuntimeException)
+{
+ RTL_LOGFILE_TRACE_AUTHOR( "xmloff", LOGFILE_AUTHOR, "} SvXMLImport::startDocument" );
+
+ // #i9518# All the stuff that accesses the document has to be done here, not in the dtor,
+ // because the SvXMLImport dtor might not be called until after the document has been closed.
+
+ if (mpImpl->mpRDFaHelper.get())
+ {
+ const uno::Reference<rdf::XRepositorySupplier> xRS(mxModel,
+ uno::UNO_QUERY);
+ if (xRS.is())
+ {
+ mpImpl->mpRDFaHelper->InsertRDFa( xRS );
+ }
+ }
+
+ if (mpNumImport)
+ {
+ delete mpNumImport;
+ mpNumImport = NULL;
+ }
+ if (mxImportInfo.is())
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = mxImportInfo->getPropertySetInfo();
+ if (xPropertySetInfo.is())
+ {
+ if (mpProgressBarHelper)
+ {
+ OUString sProgressMax(RTL_CONSTASCII_USTRINGPARAM(XML_PROGRESSMAX));
+ OUString sProgressCurrent(RTL_CONSTASCII_USTRINGPARAM(XML_PROGRESSCURRENT));
+ OUString sRepeat(RTL_CONSTASCII_USTRINGPARAM(XML_PROGRESSREPEAT));
+ if (xPropertySetInfo->hasPropertyByName(sProgressMax) &&
+ xPropertySetInfo->hasPropertyByName(sProgressCurrent))
+ {
+ sal_Int32 nProgressMax(mpProgressBarHelper->GetReference());
+ sal_Int32 nProgressCurrent(mpProgressBarHelper->GetValue());
+ uno::Any aAny;
+ aAny <<= nProgressMax;
+ mxImportInfo->setPropertyValue(sProgressMax, aAny);
+ aAny <<= nProgressCurrent;
+ mxImportInfo->setPropertyValue(sProgressCurrent, aAny);
+ }
+ if (xPropertySetInfo->hasPropertyByName(sRepeat))
+ mxImportInfo->setPropertyValue(sRepeat, cppu::bool2any(mpProgressBarHelper->GetRepeat()));
+ // pProgressBarHelper is deleted in dtor
+ }
+ OUString sNumberStyles(RTL_CONSTASCII_USTRINGPARAM(XML_NUMBERSTYLES));
+ if (mxNumberStyles.is() && xPropertySetInfo->hasPropertyByName(sNumberStyles))
+ {
+ uno::Any aAny;
+ aAny <<= mxNumberStyles;
+ mxImportInfo->setPropertyValue(sNumberStyles, aAny);
+ }
+ }
+ }
+
+ if( mxFontDecls.Is() )
+ ((SvXMLStylesContext *)&mxFontDecls)->Clear();
+ if( mxStyles.Is() )
+ ((SvXMLStylesContext *)&mxStyles)->Clear();
+ if( mxAutoStyles.Is() )
+ ((SvXMLStylesContext *)&mxAutoStyles)->Clear();
+ if( mxMasterStyles.Is() )
+ ((SvXMLStylesContext *)&mxMasterStyles)->Clear();
+
+ // possible form-layer related knittings which can only be done when
+ // the whole document exists
+ if ( mxFormImport.is() )
+ mxFormImport->documentDone();
+
+ // The shape import helper does the z-order sorting in the dtor,
+ // so it must be deleted here, too.
+ mxShapeImport = NULL;
+
+ if( mpImpl->mbOwnGraphicResolver )
+ {
+ Reference< lang::XComponent > xComp( mxGraphicResolver, UNO_QUERY );
+ xComp->dispose();
+ }
+
+ if( mpImpl->mbOwnEmbeddedResolver )
+ {
+ Reference< lang::XComponent > xComp( mxEmbeddedResolver, UNO_QUERY );
+ xComp->dispose();
+ }
+ if( mpStyleMap )
+ {
+ mpStyleMap->release();
+ mpStyleMap = 0;
+ }
+
+ if ( mpXMLErrors != NULL )
+ {
+ mpXMLErrors->ThrowErrorAsSAXException( XMLERROR_FLAG_SEVERE );
+ }
+}
+
+void SAL_CALL SvXMLImport::startElement( const OUString& rName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+ throw(xml::sax::SAXException, uno::RuntimeException)
+{
+ SvXMLNamespaceMap *pRewindMap = 0;
+
+ // Process namespace attributes. This must happen before creating the
+ // context, because namespace decaration apply to the element name itself.
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ if ( rAttrName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("office:version")) )
+ {
+ mpImpl->aODFVersion = xAttrList->getValueByIndex( i );
+
+ // the ODF version in content.xml and manifest.xml must be the same starting from ODF1.2
+ if ( mpImpl->mStreamName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "content.xml" ) ) )
+ && !IsODFVersionConsistent( mpImpl->aODFVersion ) )
+ {
+ throw xml::sax::SAXException(
+ ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "Inconsistent ODF versions in content.xml and manifest.xml!" ) ),
+ uno::Reference< uno::XInterface >(),
+ uno::makeAny(
+ packages::zip::ZipIOException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "Inconsistent ODF versions in content.xml and manifest.xml!" ) ),
+ Reference< XInterface >() ) ) );
+ }
+ }
+ else if( ( rAttrName.getLength() >= 5 ) &&
+ ( rAttrName.compareTo( GetXMLToken(XML_XMLNS), 5 ) == 0 ) &&
+ ( rAttrName.getLength() == 5 || ':' == rAttrName[5] ) )
+ {
+ if( !pRewindMap )
+ {
+ pRewindMap = mpNamespaceMap;
+ mpNamespaceMap = new SvXMLNamespaceMap( *mpNamespaceMap );
+ }
+ const OUString& rAttrValue = xAttrList->getValueByIndex( i );
+
+ OUString aPrefix( ( rAttrName.getLength() == 5 )
+ ? OUString()
+ : rAttrName.copy( 6 ) );
+ // Add namespace, but only if it is known.
+ sal_uInt16 nKey = mpNamespaceMap->AddIfKnown( aPrefix, rAttrValue );
+ // If namespace is unknwon, try to match a name with similar
+ // TC Id an version
+ if( XML_NAMESPACE_UNKNOWN == nKey )
+ {
+ OUString aTestName( rAttrValue );
+ if( SvXMLNamespaceMap::NormalizeURI( aTestName ) )
+ nKey = mpNamespaceMap->AddIfKnown( aPrefix, aTestName );
+ }
+ // If that namespace is not known, too, add it as unknown
+ if( XML_NAMESPACE_UNKNOWN == nKey )
+ mpNamespaceMap->Add( aPrefix, rAttrValue );
+
+ }
+ }
+
+ // Get element's namespace and local name.
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ mpNamespaceMap->GetKeyByAttrName( rName, &aLocalName );
+
+ // If there are contexts already, call a CreateChildContext at the topmost
+ // context. Otherwise, create a default context.
+ SvXMLImportContext *pContext;
+ sal_uInt16 nCount = mpContexts->Count();
+ if( nCount > 0 )
+ {
+ pContext = (*mpContexts)[nCount - 1]->CreateChildContext( nPrefix,
+ aLocalName,
+ xAttrList );
+ DBG_ASSERT( pContext && pContext->GetPrefix() == nPrefix,
+ "SvXMLImport::startElement: created context has wrong prefix" );
+ }
+ else
+ {
+#ifdef TIMELOG
+ // If we do profiling, we want a trace message for the first element
+ // in order to identify the stream.
+ ByteString aString( (String)rName, RTL_TEXTENCODING_ASCII_US );
+ RTL_LOGFILE_TRACE_AUTHOR1( "xmloff", LOGFILE_AUTHOR,
+ "SvXMLImport::StartElement( \"%s\", ... )",
+ aString.GetBuffer() );
+#endif
+
+ pContext = CreateContext( nPrefix, aLocalName, xAttrList );
+ if( (nPrefix & XML_NAMESPACE_UNKNOWN_FLAG) != 0 &&
+ IS_TYPE( SvXMLImportContext, pContext ) )
+ {
+ OUString aMsg( RTL_CONSTASCII_USTRINGPARAM( "Root element unknown" ) );
+ Reference<xml::sax::XLocator> xDummyLocator;
+ Sequence < OUString > aParams(1);
+ aParams.getArray()[0] = rName;
+
+ SetError( XMLERROR_FLAG_SEVERE|XMLERROR_UNKNWON_ROOT,
+ aParams, aMsg, xDummyLocator );
+ }
+ }
+
+ DBG_ASSERT( pContext, "SvXMLImport::startElement: missing context" );
+ if( !pContext )
+ pContext = new SvXMLImportContext( *this, nPrefix, aLocalName );
+
+ pContext->AddRef();
+
+ // Remeber old namespace map.
+ if( pRewindMap )
+ pContext->SetRewindMap( pRewindMap );
+
+ // Call a startElement at the new context.
+ pContext->StartElement( xAttrList );
+
+ // Push context on stack.
+ mpContexts->Insert( pContext, nCount );
+}
+
+void SAL_CALL SvXMLImport::endElement( const OUString&
+#ifdef DBG_UTIL
+rName
+#endif
+)
+ throw(xml::sax::SAXException, uno::RuntimeException)
+{
+ sal_uInt16 nCount = mpContexts->Count();
+ DBG_ASSERT( nCount, "SvXMLImport::endElement: no context left" );
+ if( nCount > 0 )
+ {
+ // Get topmost context and remove it from the stack.
+ SvXMLImportContext *pContext = (*mpContexts)[nCount-1];
+ mpContexts->Remove( nCount-1, 1 );
+
+#ifdef DBG_UTIL
+ // Non product only: check if endElement call matches startELement call.
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ mpNamespaceMap->GetKeyByAttrName( rName, &aLocalName );
+ DBG_ASSERT( pContext->GetPrefix() == nPrefix,
+ "SvXMLImport::endElement: popped context has wrong prefix" );
+ DBG_ASSERT( pContext->GetLocalName() == aLocalName,
+ "SvXMLImport::endElement: popped context has wrong lname" );
+#endif
+
+ // Call a EndElement at the current context.
+ pContext->EndElement();
+
+ // Get a namespace map to rewind.
+ SvXMLNamespaceMap *pRewindMap = pContext->GetRewindMap();
+
+ // Delete the current context.
+ pContext->ReleaseRef();
+ pContext = 0;
+
+ // Rewind a namespace map.
+ if( pRewindMap )
+ {
+ delete mpNamespaceMap;
+ mpNamespaceMap = pRewindMap;
+ }
+ }
+}
+
+void SAL_CALL SvXMLImport::characters( const OUString& rChars )
+ throw(xml::sax::SAXException, uno::RuntimeException)
+{
+ sal_uInt16 nCount = mpContexts->Count();
+ if( nCount > 0 )
+ {
+ (*mpContexts)[nCount - 1]->Characters( rChars );
+ }
+}
+
+void SAL_CALL SvXMLImport::ignorableWhitespace( const OUString& )
+ throw(xml::sax::SAXException, uno::RuntimeException)
+{
+}
+
+void SAL_CALL SvXMLImport::processingInstruction( const OUString&,
+ const OUString& )
+ throw(xml::sax::SAXException, uno::RuntimeException)
+{
+}
+
+void SAL_CALL SvXMLImport::setDocumentLocator( const uno::Reference< xml::sax::XLocator >& rLocator )
+ throw(xml::sax::SAXException, uno::RuntimeException)
+{
+ mxLocator = rLocator;
+}
+
+// XExtendedDocumentHandler
+void SAL_CALL SvXMLImport::startCDATA( void ) throw(xml::sax::SAXException, uno::RuntimeException)
+{
+}
+
+void SAL_CALL SvXMLImport::endCDATA( void ) throw(uno::RuntimeException)
+{
+}
+
+void SAL_CALL SvXMLImport::comment( const OUString& )
+ throw(xml::sax::SAXException, uno::RuntimeException)
+{
+}
+
+void SAL_CALL SvXMLImport::allowLineBreak( void )
+ throw(xml::sax::SAXException, uno::RuntimeException)
+{
+}
+
+void SAL_CALL SvXMLImport::unknown( const OUString& )
+ throw(xml::sax::SAXException, uno::RuntimeException)
+{
+}
+
+void SvXMLImport::SetStatistics(const uno::Sequence< beans::NamedValue> &)
+{
+ GetProgressBarHelper()->SetRepeat(sal_False);
+ GetProgressBarHelper()->SetReference(0);
+}
+
+///////////////////////////////////////////////////////////////////////
+
+// XImporter
+void SAL_CALL SvXMLImport::setTargetDocument( const uno::Reference< lang::XComponent >& xDoc )
+ throw(lang::IllegalArgumentException, uno::RuntimeException)
+{
+ mxModel = uno::Reference< frame::XModel >::query( xDoc );
+ if( !mxModel.is() )
+ throw lang::IllegalArgumentException();
+ if (mxModel.is() && !mxEventListener.is())
+ {
+ mxEventListener.set(new SvXMLImportEventListener(this));
+ mxModel->addEventListener(mxEventListener);
+ }
+
+ DBG_ASSERT( !mpNumImport, "number format import already exists." );
+ if( mpNumImport )
+ {
+ delete mpNumImport;
+ mpNumImport = 0;
+ }
+}
+
+// XFilter
+sal_Bool SAL_CALL SvXMLImport::filter( const uno::Sequence< beans::PropertyValue >& )
+ throw (uno::RuntimeException)
+{
+ return sal_False;
+}
+
+void SAL_CALL SvXMLImport::cancel( )
+ throw (uno::RuntimeException)
+{
+}
+
+// XInitialize
+void SAL_CALL SvXMLImport::initialize( const uno::Sequence< uno::Any >& aArguments )
+ throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+{
+ const sal_Int32 nAnyCount = aArguments.getLength();
+ const uno::Any* pAny = aArguments.getConstArray();
+
+ for( sal_Int32 nIndex = 0; nIndex < nAnyCount; nIndex++, pAny++ )
+ {
+ Reference<XInterface> xValue;
+ *pAny >>= xValue;
+
+ uno::Reference<task::XStatusIndicator> xTmpStatusIndicator(
+ xValue, UNO_QUERY );
+ if( xTmpStatusIndicator.is() )
+ mxStatusIndicator = xTmpStatusIndicator;
+
+ uno::Reference<document::XGraphicObjectResolver> xTmpGraphicResolver(
+ xValue, UNO_QUERY );
+ if( xTmpGraphicResolver.is() )
+ mxGraphicResolver = xTmpGraphicResolver;
+
+ uno::Reference<document::XEmbeddedObjectResolver> xTmpObjectResolver(
+ xValue, UNO_QUERY );
+ if( xTmpObjectResolver.is() )
+ mxEmbeddedResolver = xTmpObjectResolver;
+
+ uno::Reference<beans::XPropertySet> xTmpPropSet( xValue, UNO_QUERY );
+ if( xTmpPropSet.is() )
+ {
+ mxImportInfo = xTmpPropSet;
+ uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = mxImportInfo->getPropertySetInfo();
+ if (xPropertySetInfo.is())
+ {
+ OUString sPropName(RTL_CONSTASCII_USTRINGPARAM(XML_NUMBERSTYLES));
+ if (xPropertySetInfo->hasPropertyByName(sPropName))
+ {
+ uno::Any aAny = mxImportInfo->getPropertyValue(sPropName);
+ aAny >>= mxNumberStyles;
+ }
+
+ sPropName = OUString( RTL_CONSTASCII_USTRINGPARAM("PrivateData" ) );
+ if (xPropertySetInfo->hasPropertyByName(sPropName))
+ {
+ Reference < XInterface > xIfc;
+ uno::Any aAny = mxImportInfo->getPropertyValue(sPropName);
+ aAny >>= xIfc;
+
+ StyleMap *pSMap = StyleMap::getImplementation( xIfc );
+ if( pSMap )
+ {
+ mpStyleMap = pSMap;
+ mpStyleMap->acquire();
+ }
+ }
+ OUString sBaseURI;
+ sPropName = OUString( RTL_CONSTASCII_USTRINGPARAM("BaseURI" ) );
+ if (xPropertySetInfo->hasPropertyByName(sPropName))
+ {
+ uno::Any aAny = mxImportInfo->getPropertyValue(sPropName);
+ aAny >>= sBaseURI;
+ mpImpl->aBaseURL.SetURL( sBaseURI );
+ mpImpl->aDocBase.SetURL( sBaseURI );
+ }
+ OUString sRelPath;
+ sPropName = OUString( RTL_CONSTASCII_USTRINGPARAM("StreamRelPath" ) );
+ if( xPropertySetInfo->hasPropertyByName(sPropName) )
+ {
+ uno::Any aAny = mxImportInfo->getPropertyValue(sPropName);
+ aAny >>= sRelPath;
+ }
+ OUString sName;
+ sPropName = OUString( RTL_CONSTASCII_USTRINGPARAM("StreamName" ) );
+ if( xPropertySetInfo->hasPropertyByName(sPropName) )
+ {
+ uno::Any aAny = mxImportInfo->getPropertyValue(sPropName);
+ aAny >>= sName;
+ }
+ if( sBaseURI.getLength() && sName.getLength() )
+ {
+ if( sRelPath.getLength() )
+ mpImpl->aBaseURL.insertName( sRelPath );
+ mpImpl->aBaseURL.insertName( sName );
+ }
+ mpImpl->mStreamName = sName; // Note: may be empty (XSLT)
+ // Retrieve property <ShapePositionInHoriL2R> (#i28749#)
+ sPropName = OUString( RTL_CONSTASCII_USTRINGPARAM("ShapePositionInHoriL2R" ) );
+ if( xPropertySetInfo->hasPropertyByName(sPropName) )
+ {
+ uno::Any aAny = mxImportInfo->getPropertyValue(sPropName);
+ aAny >>= (mpImpl->mbShapePositionInHoriL2R);
+ }
+ sPropName = OUString( RTL_CONSTASCII_USTRINGPARAM("TextDocInOOoFileFormat" ) );
+ if( xPropertySetInfo->hasPropertyByName(sPropName) )
+ {
+ uno::Any aAny = mxImportInfo->getPropertyValue(sPropName);
+ aAny >>= (mpImpl->mbTextDocInOOoFileFormat);
+ }
+ }
+ }
+ }
+}
+
+// XServiceInfo
+OUString SAL_CALL SvXMLImport::getImplementationName()
+ throw(uno::RuntimeException)
+{
+ OUString aStr;
+ return aStr;
+}
+
+sal_Bool SAL_CALL SvXMLImport::supportsService( const OUString& rServiceName )
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ return
+ rServiceName.equalsAsciiL(
+ "com.sun.star.document.ImportFilter",
+ sizeof("com.sun.star.document.ImportFilter")-1 ) ||
+ rServiceName.equalsAsciiL(
+ "com.sun.star.xml.XMLImportFilter",
+ sizeof("com.sun.star.xml.XMLImportFilter")-1);
+}
+
+uno::Sequence< OUString > SAL_CALL SvXMLImport::getSupportedServiceNames( )
+ throw(uno::RuntimeException)
+{
+ uno::Sequence<OUString> aSeq(2);
+ aSeq[0] = OUString(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ImportFilter"));
+ aSeq[1] = OUString(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.XMLImportFilter"));
+ return aSeq;
+}
+
+///////////////////////////////////////////////////////////////////////
+
+XMLTextImportHelper* SvXMLImport::CreateTextImport()
+{
+ return new XMLTextImportHelper( mxModel, *this );
+}
+
+XMLShapeImportHelper* SvXMLImport::CreateShapeImport()
+{
+ return new XMLShapeImportHelper( *this, mxModel );
+}
+
+SchXMLImportHelper* SvXMLImport::CreateChartImport()
+{
+ return new SchXMLImportHelper();
+}
+
+::xmloff::OFormLayerXMLImport* SvXMLImport::CreateFormImport()
+{
+ return new ::xmloff::OFormLayerXMLImport(*this);
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Get or create fill/line/lineend-style-helper
+//
+
+const Reference< container::XNameContainer > & SvXMLImport::GetGradientHelper()
+{
+ if( !mxGradientHelper.is() )
+ {
+ if( mxModel.is() )
+ {
+ Reference< lang::XMultiServiceFactory > xServiceFact( mxModel, UNO_QUERY);
+ if( xServiceFact.is() )
+ {
+ try
+ {
+ mxGradientHelper = Reference< container::XNameContainer >( xServiceFact->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.GradientTable" ) ) ), UNO_QUERY);
+ }
+ catch( lang::ServiceNotRegisteredException& )
+ {}
+ }
+ }
+ }
+
+ return mxGradientHelper;
+}
+
+const Reference< container::XNameContainer > & SvXMLImport::GetHatchHelper()
+{
+ if( !mxHatchHelper.is() )
+ {
+ if( mxModel.is() )
+ {
+ Reference< lang::XMultiServiceFactory > xServiceFact( mxModel, UNO_QUERY);
+ if( xServiceFact.is() )
+ {
+ try
+ {
+ mxHatchHelper = Reference< container::XNameContainer >( xServiceFact->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.HatchTable" ) ) ), UNO_QUERY);
+ }
+ catch( lang::ServiceNotRegisteredException& )
+ {}
+ }
+ }
+ }
+
+ return mxHatchHelper;
+}
+
+const Reference< container::XNameContainer > & SvXMLImport::GetBitmapHelper()
+{
+ if( !mxBitmapHelper.is() )
+ {
+ if( mxModel.is() )
+ {
+ Reference< lang::XMultiServiceFactory > xServiceFact( mxModel, UNO_QUERY);
+ if( xServiceFact.is() )
+ {
+ try
+ {
+ mxBitmapHelper = Reference< container::XNameContainer >( xServiceFact->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.BitmapTable" ) ) ), UNO_QUERY);
+ }
+ catch( lang::ServiceNotRegisteredException& )
+ {}
+ }
+ }
+ }
+
+ return mxBitmapHelper;
+}
+
+const Reference< container::XNameContainer > & SvXMLImport::GetTransGradientHelper()
+{
+ if( !mxTransGradientHelper.is() )
+ {
+ if( mxModel.is() )
+ {
+ Reference< lang::XMultiServiceFactory > xServiceFact( mxModel, UNO_QUERY);
+ if( xServiceFact.is() )
+ {
+ try
+ {
+ mxTransGradientHelper = Reference< container::XNameContainer >( xServiceFact->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.TransparencyGradientTable" ) ) ), UNO_QUERY);
+ }
+ catch( lang::ServiceNotRegisteredException& )
+ {}
+ }
+ }
+ }
+
+ return mxTransGradientHelper;
+}
+
+const Reference< container::XNameContainer > & SvXMLImport::GetMarkerHelper()
+{
+ if( !mxMarkerHelper.is() )
+ {
+ if( mxModel.is() )
+ {
+ Reference< lang::XMultiServiceFactory > xServiceFact( mxModel, UNO_QUERY);
+ if( xServiceFact.is() )
+ {
+ try
+ {
+ mxMarkerHelper = Reference< container::XNameContainer >( xServiceFact->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.MarkerTable" ) ) ), UNO_QUERY);
+ }
+ catch( lang::ServiceNotRegisteredException& )
+ {}
+ }
+ }
+ }
+
+ return mxMarkerHelper;
+}
+
+const Reference< container::XNameContainer > & SvXMLImport::GetDashHelper()
+{
+ if( !mxDashHelper.is() )
+ {
+ if( mxModel.is() )
+ {
+ Reference< lang::XMultiServiceFactory > xServiceFact( mxModel, UNO_QUERY);
+ if( xServiceFact.is() )
+ {
+ try
+ {
+ mxDashHelper = Reference< container::XNameContainer >( xServiceFact->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.DashTable" ) ) ), UNO_QUERY);
+ }
+ catch( lang::ServiceNotRegisteredException& )
+ {}
+ }
+ }
+ }
+
+ return mxDashHelper;
+}
+
+sal_Bool SvXMLImport::IsPackageURL( const ::rtl::OUString& rURL ) const
+{
+
+ // if, and only if, only parts are imported, then we're in a package
+ const sal_uInt32 nTest = IMPORT_META|IMPORT_STYLES|IMPORT_CONTENT|IMPORT_SETTINGS;
+ if( (mnImportFlags & nTest) == nTest )
+ return sal_False;
+
+ // Some quick tests: Some may rely on the package structure!
+ sal_Int32 nLen = rURL.getLength();
+ if( (nLen > 0 && '/' == rURL[0]) )
+ // RFC2396 net_path or abs_path
+ return sal_False;
+ else if( nLen > 1 && '.' == rURL[0] )
+ {
+ if( '.' == rURL[1] )
+ // ../: We are never going up one level, so we know
+ // it's not an external URI
+ return sal_False;
+ else if( '/' == rURL[1] )
+ // we are remaining on a level, so it's an package URI
+ return sal_True;
+ }
+
+ // Now check for a RFC2396 schema
+ sal_Int32 nPos = 1;
+ while( nPos < nLen )
+ {
+ switch( rURL[nPos] )
+ {
+ case '/':
+ // a relative path segement
+ return sal_True;
+ case ':':
+ // a schema
+ return sal_False;
+ default:
+ break;
+ // we don't care about any other characters
+ }
+ ++nPos;
+ }
+
+ return sal_True;
+}
+
+::rtl::OUString SvXMLImport::ResolveGraphicObjectURL( const ::rtl::OUString& rURL,
+ sal_Bool bLoadOnDemand )
+{
+ ::rtl::OUString sRet;
+
+ if( IsPackageURL( rURL ) )
+ {
+ if( !bLoadOnDemand && mxGraphicResolver.is() )
+ {
+ ::rtl::OUString aTmp( msPackageProtocol );
+ aTmp += rURL;
+ sRet = mxGraphicResolver->resolveGraphicObjectURL( aTmp );
+ }
+
+ if( !sRet.getLength() )
+ {
+ sRet = msPackageProtocol;
+ sRet += rURL;
+ }
+ }
+
+ if( !sRet.getLength() )
+ sRet = GetAbsoluteReference( rURL );
+
+ return sRet;
+}
+
+Reference< XOutputStream > SvXMLImport::GetStreamForGraphicObjectURLFromBase64()
+{
+ Reference< XOutputStream > xOStm;
+ Reference< document::XBinaryStreamResolver > xStmResolver( mxGraphicResolver, UNO_QUERY );
+
+ if( xStmResolver.is() )
+ xOStm = xStmResolver->createOutputStream();
+
+ return xOStm;
+}
+
+::rtl::OUString SvXMLImport::ResolveGraphicObjectURLFromBase64(
+ const Reference < XOutputStream >& rOut )
+{
+ OUString sURL;
+ Reference< document::XBinaryStreamResolver > xStmResolver( mxGraphicResolver, UNO_QUERY );
+ if( xStmResolver.is() )
+ sURL = xStmResolver->resolveOutputStream( rOut );
+
+ return sURL;
+}
+
+::rtl::OUString SvXMLImport::ResolveEmbeddedObjectURL(
+ const ::rtl::OUString& rURL,
+ const ::rtl::OUString& rClassId )
+{
+ ::rtl::OUString sRet;
+
+ if( IsPackageURL( rURL ) )
+ {
+ if ( mxEmbeddedResolver.is() )
+ {
+ OUString sURL( rURL );
+ if( rClassId.getLength() )
+ {
+ sURL += OUString( sal_Unicode('!') );
+ sURL += rClassId;
+ }
+ sRet = mxEmbeddedResolver->resolveEmbeddedObjectURL( sURL );
+ }
+ }
+ else
+ sRet = GetAbsoluteReference( rURL );
+
+ return sRet;
+}
+
+Reference < XOutputStream >
+ SvXMLImport::GetStreamForEmbeddedObjectURLFromBase64()
+{
+ Reference < XOutputStream > xOLEStream;
+
+ if( mxEmbeddedResolver.is() )
+ {
+ Reference< XNameAccess > xNA( mxEmbeddedResolver, UNO_QUERY );
+ if( xNA.is() )
+ {
+ OUString aURL( RTL_CONSTASCII_USTRINGPARAM( "Obj12345678" ) );
+ Any aAny = xNA->getByName( aURL );
+ aAny >>= xOLEStream;
+ }
+ }
+
+ return xOLEStream;
+}
+
+::rtl::OUString SvXMLImport::ResolveEmbeddedObjectURLFromBase64()
+{
+ ::rtl::OUString sRet;
+
+ if( mxEmbeddedResolver.is() )
+ {
+ OUString aURL( RTL_CONSTASCII_USTRINGPARAM( "Obj12345678" ) );
+ sRet = mxEmbeddedResolver->resolveEmbeddedObjectURL( aURL );
+ }
+
+ return sRet;
+}
+
+void SvXMLImport::AddStyleDisplayName( sal_uInt16 nFamily,
+ const OUString& rName,
+ const OUString& rDisplayName )
+{
+ if( !mpStyleMap )
+ {
+ mpStyleMap = new StyleMap;
+ mpStyleMap->acquire();
+ if( mxImportInfo.is() )
+ {
+ OUString sPrivateData(
+ RTL_CONSTASCII_USTRINGPARAM("PrivateData" ) );
+ Reference< beans::XPropertySetInfo > xPropertySetInfo =
+ mxImportInfo->getPropertySetInfo();
+ if( xPropertySetInfo.is() &&
+ xPropertySetInfo->hasPropertyByName(sPrivateData) )
+ {
+ Reference < XInterface > xIfc(
+ static_cast< XUnoTunnel *>( mpStyleMap ) );
+ Any aAny;
+ aAny <<= xIfc;
+ mxImportInfo->setPropertyValue( sPrivateData, aAny );
+ }
+ }
+ }
+
+ StyleMap::key_type aKey( nFamily, rName );
+ StyleMap::value_type aValue( aKey, rDisplayName );
+ ::std::pair<StyleMap::iterator,bool> aRes( mpStyleMap->insert( aValue ) );
+ OSL_ENSURE( aRes.second, "duplicate style name" );
+
+}
+
+OUString SvXMLImport::GetStyleDisplayName( sal_uInt16 nFamily,
+ const OUString& rName ) const
+{
+ OUString sName( rName );
+ if( mpStyleMap && rName.getLength() )
+ {
+ StyleMap::key_type aKey( nFamily, rName );
+ StyleMap::const_iterator aIter = mpStyleMap->find( aKey );
+ if( aIter != mpStyleMap->end() )
+ sName = (*aIter).second;
+ }
+ return sName;
+}
+
+void SvXMLImport::SetViewSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>&)
+{
+}
+
+void SvXMLImport::SetConfigurationSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>&)
+{
+}
+
+void SvXMLImport::SetDocumentSpecificSettings(const ::rtl::OUString& _rSettingsGroupName, const uno::Sequence<beans::PropertyValue>& _rSettings)
+{
+ (void)_rSettingsGroupName;
+ (void)_rSettings;
+}
+
+ProgressBarHelper* SvXMLImport::GetProgressBarHelper()
+{
+ if (!mpProgressBarHelper)
+ {
+ mpProgressBarHelper = new ProgressBarHelper(mxStatusIndicator, sal_False);
+
+ if (mxImportInfo.is())
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = mxImportInfo->getPropertySetInfo();
+ if (xPropertySetInfo.is())
+ {
+ OUString sProgressRange(RTL_CONSTASCII_USTRINGPARAM(XML_PROGRESSRANGE));
+ OUString sProgressMax(RTL_CONSTASCII_USTRINGPARAM(XML_PROGRESSMAX));
+ OUString sProgressCurrent(RTL_CONSTASCII_USTRINGPARAM(XML_PROGRESSCURRENT));
+ OUString sRepeat(RTL_CONSTASCII_USTRINGPARAM(XML_PROGRESSREPEAT));
+ if (xPropertySetInfo->hasPropertyByName(sProgressMax) &&
+ xPropertySetInfo->hasPropertyByName(sProgressCurrent) &&
+ xPropertySetInfo->hasPropertyByName(sProgressRange))
+ {
+ uno::Any aAny;
+ sal_Int32 nProgressMax(0);
+ sal_Int32 nProgressCurrent(0);
+ sal_Int32 nProgressRange(0);
+ aAny = mxImportInfo->getPropertyValue(sProgressRange);
+ if (aAny >>= nProgressRange)
+ mpProgressBarHelper->SetRange(nProgressRange);
+ aAny = mxImportInfo->getPropertyValue(sProgressMax);
+ if (aAny >>= nProgressMax)
+ mpProgressBarHelper->SetReference(nProgressMax);
+ aAny = mxImportInfo->getPropertyValue(sProgressCurrent);
+ if (aAny >>= nProgressCurrent)
+ mpProgressBarHelper->SetValue(nProgressCurrent);
+ }
+ if (xPropertySetInfo->hasPropertyByName(sRepeat))
+ {
+ uno::Any aAny = mxImportInfo->getPropertyValue(sRepeat);
+ if (aAny.getValueType() == getBooleanCppuType())
+ mpProgressBarHelper->SetRepeat(::cppu::any2bool(aAny));
+ else {
+ DBG_ERRORFILE("why is it no boolean?");
+ }
+ }
+ }
+ }
+ }
+ return mpProgressBarHelper;
+}
+
+void SvXMLImport::AddNumberStyle(sal_Int32 nKey, const OUString& rName)
+{
+ if (!mxNumberStyles.is())
+ mxNumberStyles = uno::Reference< container::XNameContainer >( comphelper::NameContainer_createInstance( ::getCppuType((const sal_Int32*)0)) );
+ if (mxNumberStyles.is())
+ {
+ uno::Any aAny;
+ aAny <<= nKey;
+ try
+ {
+ mxNumberStyles->insertByName(rName, aAny);
+ }
+ catch ( uno::Exception& )
+ {
+ OSL_FAIL("Numberformat could not be inserted");
+ }
+ }
+ else {
+ OSL_FAIL("not possible to create NameContainer");
+ }
+}
+
+XMLEventImportHelper& SvXMLImport::GetEventImport()
+{
+ if (!mpEventImportHelper)
+ {
+ // construct event helper and register StarBasic handler and standard
+ // event tables
+ mpEventImportHelper = new XMLEventImportHelper();
+ OUString sStarBasic(GetXMLToken(XML_STARBASIC));
+ mpEventImportHelper->RegisterFactory(sStarBasic,
+ new XMLStarBasicContextFactory());
+ OUString sScript(GetXMLToken(XML_SCRIPT));
+ mpEventImportHelper->RegisterFactory(sScript,
+ new XMLScriptContextFactory());
+ mpEventImportHelper->AddTranslationTable(aStandardEventTable);
+
+ // register StarBasic event handler with capitalized spelling
+ OUString sStarBasicCap(RTL_CONSTASCII_USTRINGPARAM("StarBasic"));
+ mpEventImportHelper->RegisterFactory(sStarBasicCap,
+ new XMLStarBasicContextFactory());
+ }
+
+ return *mpEventImportHelper;
+}
+
+void SvXMLImport::SetFontDecls( XMLFontStylesContext *pFontDecls )
+{
+ mxFontDecls = pFontDecls;
+ GetTextImport()->SetFontDecls( pFontDecls );
+}
+
+void SvXMLImport::SetStyles( SvXMLStylesContext *pStyles )
+{
+ mxStyles = pStyles;
+}
+
+void SvXMLImport::SetAutoStyles( SvXMLStylesContext *pAutoStyles )
+{
+ if (pAutoStyles && mxNumberStyles.is() && (mnImportFlags & IMPORT_CONTENT) )
+ {
+ uno::Reference<xml::sax::XAttributeList> xAttrList;
+ uno::Sequence< ::rtl::OUString > aNames = mxNumberStyles->getElementNames();
+ sal_uInt32 nCount(aNames.getLength());
+ if (nCount)
+ {
+ const OUString* pNames = aNames.getConstArray();
+ if ( pNames )
+ {
+ SvXMLStyleContext* pContext;
+ uno::Any aAny;
+ sal_Int32 nKey(0);
+ for (sal_uInt32 i = 0; i < nCount; i++, pNames++)
+ {
+ aAny = mxNumberStyles->getByName(*pNames);
+ if (aAny >>= nKey)
+ {
+ pContext = new SvXMLNumFormatContext( *this, XML_NAMESPACE_NUMBER,
+ *pNames, xAttrList, nKey, *pAutoStyles );
+ pAutoStyles->AddStyle(*pContext);
+ }
+ }
+ }
+ }
+ }
+ mxAutoStyles = pAutoStyles;
+ GetTextImport()->SetAutoStyles( pAutoStyles );
+ GetShapeImport()->SetAutoStylesContext( pAutoStyles );
+ GetChartImport()->SetAutoStylesContext( pAutoStyles );
+ GetFormImport()->setAutoStyleContext( pAutoStyles );
+}
+
+void SvXMLImport::SetMasterStyles( SvXMLStylesContext *pMasterStyles )
+{
+ mxMasterStyles = pMasterStyles;
+}
+
+XMLFontStylesContext *SvXMLImport::GetFontDecls()
+{
+ return (XMLFontStylesContext *)&mxFontDecls;
+}
+
+SvXMLStylesContext *SvXMLImport::GetStyles()
+{
+ return (SvXMLStylesContext *)&mxStyles;
+}
+
+SvXMLStylesContext *SvXMLImport::GetAutoStyles()
+{
+ return (SvXMLStylesContext *)&mxAutoStyles;
+}
+
+SvXMLStylesContext *SvXMLImport::GetMasterStyles()
+{
+ return (SvXMLStylesContext *)&mxMasterStyles;
+}
+
+const XMLFontStylesContext *SvXMLImport::GetFontDecls() const
+{
+ return (const XMLFontStylesContext *)&mxFontDecls;
+}
+
+const SvXMLStylesContext *SvXMLImport::GetStyles() const
+{
+ return (const SvXMLStylesContext *)&mxStyles;
+}
+
+const SvXMLStylesContext *SvXMLImport::GetAutoStyles() const
+{
+ return (const SvXMLStylesContext *)&mxAutoStyles;
+}
+
+const SvXMLStylesContext *SvXMLImport::GetMasterStyles() const
+{
+ return (const SvXMLStylesContext *)&mxMasterStyles;
+}
+
+OUString SvXMLImport::GetAbsoluteReference(const OUString& rValue) const
+{
+ if( rValue.getLength() == 0 || rValue[0] == '#' )
+ return rValue;
+
+ INetURLObject aAbsURL;
+ if( mpImpl->aBaseURL.GetNewAbsURL( rValue, &aAbsURL ) )
+ return aAbsURL.GetMainURL( INetURLObject::DECODE_TO_IURI );
+ else
+ return rValue;
+}
+
+sal_Bool SvXMLImport::IsODFVersionConsistent( const ::rtl::OUString& aODFVersion )
+{
+ // the check returns sal_False only if the storage version could be retrieved
+ sal_Bool bResult = sal_True;
+
+ if ( aODFVersion.getLength() && aODFVersion.compareTo( ODFVER_012_TEXT ) >= 0 )
+ {
+ // check the consistency only for the ODF1.2 and later ( according to content.xml )
+ // manifest.xml might have no version, it should be checked here and the correct version should be set
+ try
+ {
+ uno::Reference< document::XStorageBasedDocument > xDoc( mxModel, uno::UNO_QUERY_THROW );
+ uno::Reference< embed::XStorage > xStor = xDoc->getDocumentStorage();
+ uno::Reference< beans::XPropertySet > xStorProps( xStor, uno::UNO_QUERY_THROW );
+
+ // the check should be done only for OASIS format
+ ::rtl::OUString aMediaType;
+ xStorProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ) ) >>= aMediaType;
+ if ( ::comphelper::OStorageHelper::GetXStorageFormat( xStor ) >= SOFFICE_FILEFORMAT_8 )
+ {
+ sal_Bool bRepairPackage = sal_False;
+ try
+ {
+ xStorProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RepairPackage" ) ) )
+ >>= bRepairPackage;
+ } catch ( uno::Exception& )
+ {}
+
+ // check only if not in Repair mode
+ if ( !bRepairPackage )
+ {
+ ::rtl::OUString aStorVersion;
+ xStorProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ) )
+ >>= aStorVersion;
+
+ // if the storage version is set in manifest.xml, it must be the same as in content.xml
+ // if not, set it explicitly to be used further ( it will work even for readonly storage )
+ // This workaround is not nice, but I see no other way to handle it, since there are
+ // ODF1.2 documents without version in manifest.xml
+ if ( aStorVersion.getLength() )
+ bResult = aODFVersion.equals( aStorVersion );
+ else
+ xStorProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ),
+ uno::makeAny( aODFVersion ) );
+
+ if ( bResult )
+ {
+ sal_Bool bInconsistent = sal_False;
+ xStorProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsInconsistent" ) ) )
+ >>= bInconsistent;
+ bResult = !bInconsistent;
+ }
+ }
+ }
+ }
+ catch( uno::Exception& )
+ {}
+ }
+
+ return bResult;
+}
+
+void SvXMLImport::_CreateNumberFormatsSupplier()
+{
+ DBG_ASSERT( !mxNumberFormatsSupplier.is(),
+ "number formats supplier already exists!" );
+ if(mxModel.is())
+ mxNumberFormatsSupplier =
+ uno::Reference< util::XNumberFormatsSupplier> (mxModel, uno::UNO_QUERY);
+}
+
+
+void SvXMLImport::_CreateDataStylesImport()
+{
+ DBG_ASSERT( mpNumImport == NULL, "data styles import already exists!" );
+ uno::Reference<util::XNumberFormatsSupplier> xNum =
+ GetNumberFormatsSupplier();
+ if ( xNum.is() )
+ mpNumImport = new SvXMLNumFmtHelper(xNum, getServiceFactory());
+}
+
+
+sal_Unicode SvXMLImport::ConvStarBatsCharToStarSymbol( sal_Unicode c )
+{
+ sal_Unicode cNew = c;
+ if( !mpImpl->hBatsFontConv )
+ {
+ OUString sStarBats( RTL_CONSTASCII_USTRINGPARAM( "StarBats" ) );
+ mpImpl->hBatsFontConv = CreateFontToSubsFontConverter( sStarBats,
+ FONTTOSUBSFONT_IMPORT|FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS );
+ OSL_ENSURE( mpImpl->hBatsFontConv, "Got no symbol font converter" );
+ }
+ if( mpImpl->hBatsFontConv )
+ {
+ cNew = ConvertFontToSubsFontChar( mpImpl->hBatsFontConv, c );
+ }
+
+ return cNew;
+}
+
+sal_Unicode SvXMLImport::ConvStarMathCharToStarSymbol( sal_Unicode c )
+{
+ sal_Unicode cNew = c;
+ if( !mpImpl->hMathFontConv )
+ {
+ OUString sStarMath( RTL_CONSTASCII_USTRINGPARAM( "StarMath" ) );
+ mpImpl->hMathFontConv = CreateFontToSubsFontConverter( sStarMath,
+ FONTTOSUBSFONT_IMPORT|FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS );
+ OSL_ENSURE( mpImpl->hMathFontConv, "Got no symbol font converter" );
+ }
+ if( mpImpl->hMathFontConv )
+ {
+ cNew = ConvertFontToSubsFontChar( mpImpl->hMathFontConv, c );
+ }
+
+ return cNew;
+}
+
+
+
+void SvXMLImport::SetError(
+ sal_Int32 nId,
+ const Sequence<OUString>& rMsgParams,
+ const OUString& rExceptionMessage,
+ const Reference<xml::sax::XLocator>& rLocator )
+{
+ // maintain error flags
+ if ( ( nId & XMLERROR_FLAG_ERROR ) != 0 )
+ mnErrorFlags |= ERROR_ERROR_OCCURRED;
+ if ( ( nId & XMLERROR_FLAG_WARNING ) != 0 )
+ mnErrorFlags |= ERROR_WARNING_OCCURRED;
+ if ( ( nId & XMLERROR_FLAG_SEVERE ) != 0 )
+ mnErrorFlags |= ERROR_DO_NOTHING;
+
+ // create error list on demand
+ if ( mpXMLErrors == NULL )
+ mpXMLErrors = new XMLErrors();
+
+ // save error information
+ // use document locator (if none supplied)
+ mpXMLErrors->AddRecord( nId, rMsgParams, rExceptionMessage,
+ rLocator.is() ? rLocator : mxLocator );
+}
+
+void SvXMLImport::SetError(
+ sal_Int32 nId,
+ const Sequence<OUString>& rMsgParams)
+{
+ OUString sEmpty;
+ SetError( nId, rMsgParams, sEmpty, NULL );
+}
+
+void SvXMLImport::SetError(
+ sal_Int32 nId)
+{
+ Sequence<OUString> aSeq(0);
+ SetError( nId, aSeq );
+}
+
+void SvXMLImport::SetError(
+ sal_Int32 nId,
+ const OUString& rMsg1)
+{
+ Sequence<OUString> aSeq(1);
+ OUString* pSeq = aSeq.getArray();
+ pSeq[0] = rMsg1;
+ SetError( nId, aSeq );
+}
+
+void SvXMLImport::SetError(
+ sal_Int32 nId,
+ const OUString& rMsg1,
+ const OUString& rMsg2)
+{
+ Sequence<OUString> aSeq(2);
+ OUString* pSeq = aSeq.getArray();
+ pSeq[0] = rMsg1;
+ pSeq[1] = rMsg2;
+ SetError( nId, aSeq );
+}
+
+void SvXMLImport::SetError(
+ sal_Int32 nId,
+ const OUString& rMsg1,
+ const OUString& rMsg2,
+ const OUString& rMsg3)
+{
+ Sequence<OUString> aSeq(3);
+ OUString* pSeq = aSeq.getArray();
+ pSeq[0] = rMsg1;
+ pSeq[1] = rMsg2;
+ pSeq[2] = rMsg3;
+ SetError( nId, aSeq );
+}
+
+void SvXMLImport::SetError(
+ sal_Int32 nId,
+ const OUString& rMsg1,
+ const OUString& rMsg2,
+ const OUString& rMsg3,
+ const OUString& rMsg4)
+{
+ Sequence<OUString> aSeq(4);
+ OUString* pSeq = aSeq.getArray();
+ pSeq[0] = rMsg1;
+ pSeq[1] = rMsg2;
+ pSeq[2] = rMsg3;
+ pSeq[3] = rMsg4;
+ SetError( nId, aSeq );
+}
+
+XMLErrors* SvXMLImport::GetErrors()
+{
+ return mpXMLErrors;
+}
+
+void SvXMLImport::DisposingModel()
+{
+ if( mxFontDecls.Is() )
+ ((SvXMLStylesContext *)&mxFontDecls)->Clear();
+ if( mxStyles.Is() )
+ ((SvXMLStylesContext *)&mxStyles)->Clear();
+ if( mxAutoStyles.Is() )
+ ((SvXMLStylesContext *)&mxAutoStyles)->Clear();
+ if( mxMasterStyles.Is() )
+ ((SvXMLStylesContext *)&mxMasterStyles)->Clear();
+
+ mxModel.set(0);
+ mxEventListener.set(NULL);
+}
+
+::comphelper::UnoInterfaceToUniqueIdentifierMapper& SvXMLImport::getInterfaceToIdentifierMapper()
+{
+ return mpImpl->maInterfaceToIdentifierMapper;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > SvXMLImport::getServiceFactory()
+{
+ // #110680#
+ return mxServiceFactory;
+}
+
+uno::Reference< uno::XComponentContext >
+SvXMLImport::GetComponentContext() const
+{
+ return mpImpl->mxComponentContext;
+}
+
+String SvXMLImport::GetBaseURL() const
+{
+ return mpImpl->aBaseURL.GetMainURL( INetURLObject::NO_DECODE );
+}
+
+String SvXMLImport::GetDocumentBase() const
+{
+ return mpImpl->aDocBase.GetMainURL( INetURLObject::NO_DECODE );
+}
+
+::rtl::OUString SvXMLImport::GetStreamName() const
+{
+ return mpImpl->mStreamName;
+}
+
+// Convert drawing object positions from OOo file format to OASIS (#i28749#)
+sal_Bool SvXMLImport::IsShapePositionInHoriL2R() const
+{
+ return mpImpl->mbShapePositionInHoriL2R;
+}
+
+sal_Bool SvXMLImport::IsTextDocInOOoFileFormat() const
+{
+ return mpImpl->mbTextDocInOOoFileFormat;
+}
+
+void SvXMLImport::initXForms()
+{
+ // dummy method; to be implemented by derived classes supporting XForms
+}
+
+bool SvXMLImport::getBuildIds( sal_Int32& rUPD, sal_Int32& rBuild ) const
+{
+ bool bRet = false;
+ if( mxImportInfo.is() ) try
+ {
+ const OUString aPropName(RTL_CONSTASCII_USTRINGPARAM("BuildId"));
+ Reference< XPropertySetInfo > xSetInfo( mxImportInfo->getPropertySetInfo() );
+ if( xSetInfo.is() && xSetInfo->hasPropertyByName( aPropName ) )
+ {
+ OUString aBuildId;
+ mxImportInfo->getPropertyValue( aPropName ) >>= aBuildId;
+ if( aBuildId.getLength() )
+ {
+ sal_Int32 nIndex = aBuildId.indexOf('$');
+ if( nIndex != -1 )
+ {
+ rUPD = aBuildId.copy( 0, nIndex ).toInt32();
+ rBuild = aBuildId.copy( nIndex+1 ).toInt32();
+ bRet = true;
+ }
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ }
+ return bRet;
+}
+
+sal_uInt16 SvXMLImport::getGeneratorVersion() const
+{
+ sal_Int32 nUPD, nBuild;
+
+ if( getBuildIds( nUPD, nBuild ) )
+ {
+ if( nUPD == 680 )
+ return OOo_2x;
+
+ if( nUPD >= 640 && nUPD <= 645 )
+ return OOo_1x;
+ }
+
+ return OOo_Current;
+}
+
+bool SvXMLImport::isGraphicLoadOnDemandSupported() const
+{
+ return mbIsGraphicLoadOnDemandSupported;
+}
+
+::rtl::OUString SvXMLImport::GetODFVersion() const
+{
+ return mpImpl->aODFVersion;
+}
+
+// xml:id for RDF metadata
+void SvXMLImport::SetXmlId(uno::Reference<uno::XInterface> const & i_xIfc,
+ ::rtl::OUString const & i_rXmlId)
+{
+ if (i_rXmlId.getLength() > 0) {
+ try {
+ const uno::Reference<rdf::XMetadatable> xMeta(i_xIfc,
+ uno::UNO_QUERY);
+//FIXME: not yet
+ if (xMeta.is()) {
+ const beans::StringPair mdref( GetStreamName(), i_rXmlId );
+ try {
+ xMeta->setMetadataReference(mdref);
+ } catch (lang::IllegalArgumentException &) {
+ // probably duplicate; ignore
+ OSL_TRACE("SvXMLImport::SetXmlId: cannot set xml:id");
+ }
+ }
+ } catch (uno::Exception &) {
+ OSL_FAIL("SvXMLImport::SetXmlId: exception?");
+ }
+ }
+}
+
+SAL_DLLPRIVATE ::xmloff::RDFaImportHelper &
+SvXMLImport::GetRDFaImportHelper()
+{
+ if (!mpImpl->mpRDFaHelper.get())
+ {
+ mpImpl->mpRDFaHelper.reset( new ::xmloff::RDFaImportHelper(*this) );
+ }
+ return *mpImpl->mpRDFaHelper;
+}
+
+void
+SvXMLImport::AddRDFa(uno::Reference<rdf::XMetadatable> i_xObject,
+ ::rtl::OUString const & i_rAbout,
+ ::rtl::OUString const & i_rProperty,
+ ::rtl::OUString const & i_rContent,
+ ::rtl::OUString const & i_rDatatype)
+{
+ // N.B.: we only get called if i_xObject had xhtml:about attribute
+ // (an empty attribute value is valid)
+ ::xmloff::RDFaImportHelper & rRDFaHelper( GetRDFaImportHelper() );
+ rRDFaHelper.ParseAndAddRDFa(i_xObject,
+ i_rAbout, i_rProperty, i_rContent, i_rDatatype);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/core/xmltkmap.cxx b/xmloff/source/core/xmltkmap.cxx
new file mode 100644
index 000000000000..7a96814eee41
--- /dev/null
+++ b/xmloff/source/core/xmltkmap.cxx
@@ -0,0 +1,125 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#include <rtl/ustring.hxx>
+#include <svl/svarray.hxx>
+#include <xmloff/xmltkmap.hxx>
+#include <xmloff/xmltoken.hxx>
+
+using namespace ::xmloff::token;
+
+using ::rtl::OUString;
+
+class SvXMLTokenMapEntry_Impl
+{
+ sal_uInt16 nPrefixKey;
+ OUString sLocalName;
+ sal_uInt16 nToken;
+
+public:
+
+ sal_uInt16 GetToken() const { return nToken; }
+
+ SvXMLTokenMapEntry_Impl( sal_uInt16 nPrefix, const OUString& rLName,
+ sal_uInt16 nTok=XML_TOK_UNKNOWN ) :
+ nPrefixKey( nPrefix ),
+ sLocalName( rLName ),
+ nToken( nTok )
+ {}
+
+ SvXMLTokenMapEntry_Impl( const SvXMLTokenMapEntry& rEntry ) :
+ nPrefixKey( rEntry.nPrefixKey ),
+ sLocalName( GetXMLToken( rEntry.eLocalName ) ),
+ nToken( rEntry.nToken )
+ {}
+
+ sal_Bool operator==( const SvXMLTokenMapEntry_Impl& r ) const
+ {
+ return nPrefixKey == r.nPrefixKey &&
+ sLocalName == r.sLocalName;
+ }
+
+ sal_Bool operator<( const SvXMLTokenMapEntry_Impl& r ) const
+ {
+ return nPrefixKey < r.nPrefixKey ||
+ ( nPrefixKey == r.nPrefixKey &&
+ sLocalName < r.sLocalName);
+ }
+};
+
+typedef SvXMLTokenMapEntry_Impl *SvXMLTokenMapEntry_ImplPtr;
+SV_DECL_PTRARR_SORT_DEL( SvXMLTokenMap_Impl, SvXMLTokenMapEntry_ImplPtr, 5, 5 )
+SV_IMPL_OP_PTRARR_SORT( SvXMLTokenMap_Impl, SvXMLTokenMapEntry_ImplPtr )
+
+// ---------------------------------------------------------------------
+
+SvXMLTokenMapEntry_Impl *SvXMLTokenMap::_Find( sal_uInt16 nKeyPrefix,
+ const OUString& rLName ) const
+{
+ SvXMLTokenMapEntry_Impl *pRet = 0;
+ SvXMLTokenMapEntry_Impl aTst( nKeyPrefix, rLName );
+
+ sal_uInt16 nPos;
+ if( pImpl->Seek_Entry( &aTst, &nPos ) )
+ {
+ pRet = (*pImpl)[nPos];
+ }
+
+ return pRet;
+}
+
+SvXMLTokenMap::SvXMLTokenMap( const SvXMLTokenMapEntry *pMap ) :
+ pImpl( new SvXMLTokenMap_Impl )
+{
+ while( pMap->eLocalName != XML_TOKEN_INVALID )
+ {
+ pImpl->Insert( new SvXMLTokenMapEntry_Impl( *pMap ) );
+ pMap++;
+ }
+}
+
+SvXMLTokenMap::~SvXMLTokenMap()
+{
+ delete pImpl;
+}
+
+sal_uInt16 SvXMLTokenMap::Get( sal_uInt16 nKeyPrefix,
+ const OUString& rLName ) const
+{
+ SvXMLTokenMapEntry_Impl *pEntry = _Find( nKeyPrefix, rLName );
+ if( pEntry )
+ return pEntry->GetToken();
+ else
+ return XML_TOK_UNKNOWN;
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
new file mode 100644
index 000000000000..26d4344ac67b
--- /dev/null
+++ b/xmloff/source/core/xmltoken.cxx
@@ -0,0 +1,3219 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <sal/macros.h>
+#include <xmloff/xmltoken.hxx>
+#include <tools/debug.hxx>
+#include <rtl/ustring.hxx>
+
+using ::rtl::OUString;
+
+namespace xmloff { namespace token {
+
+ // keep the tokens (and their length)
+ namespace
+ {
+ struct XMLTokenEntry
+ {
+ sal_Int32 nLength;
+ const sal_Char* pChar;
+ ::rtl::OUString* pOUString;
+#if OSL_DEBUG_LEVEL > 0
+ XMLTokenEnum eToken;
+#endif
+ };
+ }
+
+
+
+
+#if OSL_DEBUG_LEVEL > 0
+ #define TOKEN( s, e ) { sizeof(s)-1, s, NULL, e }
+#else
+ #define TOKEN( s, e ) { sizeof(s)-1, s, NULL }
+#endif
+
+ struct XMLTokenEntry aTokenList[] =
+ {
+#if OSL_DEBUG_LEVEL > 0
+ { 0, NULL, NULL, XML_TOKEN_START },
+#else
+ { 0, NULL, NULL }, // XML_TOKEN_START
+#endif
+
+ // common XML
+ TOKEN( "CDATA", XML_CDATA ),
+ TOKEN( " ", XML_WS ),
+ TOKEN( "xml", XML_XML ),
+ TOKEN( "xmlns", XML_XMLNS ),
+ TOKEN( "version=\"1.0\" encoding=\"UTF-8\"", XML_XML_PI ),
+ TOKEN( "<!DOCTYPE ", XML_XML_DOCTYPE_PREFIX ),
+ TOKEN( " PUBLIC \"-//OpenOffice.org//DTD OfficeDocument 1.0//EN\" \"office.dtd\">", XML_XML_DOCTYPE_SUFFIX ),
+
+ // namespace prefixes and names
+ TOKEN( "http://www.w3.org/XML/1998/namespace", XML_N_XML ),
+ TOKEN( "office", XML_NP_OFFICE ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:office:1.0", XML_N_OFFICE ),
+ TOKEN( "http://sun.com/xmlns/staroffice/office", XML_N_OFFICE_OLD ),
+ TOKEN( "meta", XML_NP_META ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:meta:1.0", XML_N_META ),
+ TOKEN( "http://sun.com/xmlns/staroffice/meta", XML_N_META_OLD ),
+ TOKEN( "style", XML_NP_STYLE ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:style:1.0", XML_N_STYLE ),
+ TOKEN( "http://sun.com/xmlns/staroffice/style", XML_N_STYLE_OLD ),
+ TOKEN( "number", XML_NP_NUMBER ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0", XML_N_NUMBER ),
+ TOKEN( "http://sun.com/xmlns/staroffice/number", XML_N_NUMBER_OLD ),
+ TOKEN( "text", XML_NP_TEXT ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:text:1.0", XML_N_TEXT ),
+ TOKEN( "http://sun.com/xmlns/staroffice/text", XML_N_TEXT_OLD ),
+ TOKEN( "table", XML_NP_TABLE ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:table:1.0", XML_N_TABLE ),
+ TOKEN( "http://sun.com/xmlns/staroffice/table", XML_N_TABLE_OLD ),
+ TOKEN( "draw", XML_NP_DRAW ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0", XML_N_DRAW ),
+ TOKEN( "dr3d", XML_NP_DR3D ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0", XML_N_DR3D ),
+ TOKEN( "http://sun.com/xmlns/staroffice/draw", XML_N_DRAW_OLD ),
+ TOKEN( "presentation", XML_NP_PRESENTATION ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:presentation:1.0", XML_N_PRESENTATION ),
+ TOKEN( "http://sun.com/xmlns/staroffice/presentation", XML_N_PRESENTATION_OLD ),
+ TOKEN( "chart", XML_NP_CHART ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:chart:1.0", XML_N_CHART ),
+ TOKEN( "config", XML_NP_CONFIG ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:config:1.0", XML_N_CONFIG ),
+ TOKEN( "http://sun.com/xmlns/staroffice/chart", XML_N_CHART_OLD ),
+ TOKEN( "fo", XML_NP_FO ),
+ TOKEN( "http://www.w3.org/1999/XSL/Format/", XML_N_FO_OLD ),
+ TOKEN( "http://www.w3.org/1999/XSL/Format", XML_N_FO ),
+ TOKEN( "xlink", XML_NP_XLINK ),
+ TOKEN( "http://www.w3.org/1999/xlink", XML_N_XLINK ),
+ TOKEN( "http://www.w3.org/1999/xlink/namespace", XML_N_XLINK_OLD ),
+ TOKEN( "dc", XML_NP_DC ),
+ TOKEN( "http://purl.org/dc/elements/1.1/", XML_N_DC ),
+ TOKEN( "svg", XML_NP_SVG ),
+ TOKEN( "http://www.w3.org/2000/svg", XML_N_SVG ),
+ TOKEN( "form", XML_NP_FORM ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:form:1.0", XML_N_FORM ),
+ TOKEN( "script", XML_NP_SCRIPT ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:script:1.0", XML_N_SCRIPT ),
+ TOKEN( "xforms", XML_NP_XFORMS_1_0 ),
+ TOKEN( "http://www.w3.org/2002/xforms", XML_N_XFORMS_1_0 ),
+ TOKEN( "xsd", XML_NP_XSD ),
+ TOKEN( "http://www.w3.org/2001/XMLSchema", XML_N_XSD ),
+ TOKEN( "xsi", XML_NP_XSI ),
+ TOKEN( "http://www.w3.org/2001/XMLSchema-instance", XML_N_XSI ),
+
+ TOKEN( "block-list", XML_NP_BLOCK_LIST ),
+ TOKEN( "http://openoffice.org/2001/block-list", XML_N_BLOCK_LIST ),
+
+ TOKEN( "math", XML_NP_MATH ),
+ TOKEN( "http://www.w3.org/1998/Math/MathML", XML_N_MATH ),
+
+ TOKEN( "VL", XML_NP_VERSIONS_LIST ),
+ TOKEN( "http://openoffice.org/2001/versions-list", XML_N_VERSIONS_LIST ),
+
+ // erAck: 2008-04-09T20:12+0200 OpenFormula aka ODFF
+ TOKEN( "of", XML_NP_OF ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:of:1.2", XML_N_OF ),
+
+ // ODF 1.2 metadata: RDFa and GRDDL
+ TOKEN( "xhtml", XML_NP_XHTML ),
+ TOKEN( "http://www.w3.org/1999/xhtml", XML_N_XHTML ),
+ TOKEN( "grddl", XML_NP_GRDDL ),
+ TOKEN( "http://www.w3.org/2003/g/data-view#", XML_N_GRDDL ),
+
+ // ODF Enhanced namespaces
+ TOKEN( "officeooo", XML_NP_OFFICE_EXT ),
+ TOKEN( "http://openoffice.org/2009/office", XML_N_OFFICE_EXT ),
+
+ // jonp: 2008-09-24 Excel Interop
+ TOKEN( "formx", XML_NP_FORMX ),
+ TOKEN( "urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0", XML_N_FORMX ),
+ TOKEN( "tableooo", XML_NP_TABLE_EXT ),
+ TOKEN( "http://openoffice.org/2009/table", XML_N_TABLE_EXT ),
+
+ TOKEN( "drawooo", XML_NP_DRAW_EXT ),
+ TOKEN( "http://openoffice.org/2010/draw", XML_N_DRAW_EXT ),
+
+ TOKEN( "css3t", XML_NP_CSS3TEXT ),
+ TOKEN( "http://www.w3.org/TR/css3-text/", XML_N_CSS3TEXT ),
+
+ // units
+ TOKEN( "mm", XML_UNIT_MM ),
+ TOKEN( "m", XML_UNIT_M ),
+ TOKEN( "km", XML_UNIT_KM ),
+ TOKEN( "cm", XML_UNIT_CM ),
+ TOKEN( "pt", XML_UNIT_PT ),
+ TOKEN( "pc", XML_UNIT_PC ),
+ TOKEN( "ft", XML_UNIT_FOOT ),
+ TOKEN( "mi", XML_UNIT_MILES ),
+ TOKEN( "in", XML_UNIT_INCH ),
+
+ // any other
+ TOKEN( "1", XML_1 ),
+ TOKEN( "10", XML_10 ),
+ TOKEN( "2", XML_2 ),
+ TOKEN( "3", XML_3 ),
+ TOKEN( "4", XML_4 ),
+ TOKEN( "5", XML_5 ),
+ TOKEN( "6", XML_6 ),
+ TOKEN( "7", XML_7 ),
+ TOKEN( "8", XML_8 ),
+ TOKEN( "9", XML_9 ),
+ TOKEN( "A", XML_A_UPCASE ),
+ TOKEN( "I", XML_I_UPCASE ),
+ TOKEN( "IBM437", XML_IBM437 ),
+ TOKEN( "IBM850", XML_IBM850 ),
+ TOKEN( "IBM860", XML_IBM860 ),
+ TOKEN( "IBM861", XML_IBM861 ),
+ TOKEN( "IBM863", XML_IBM863 ),
+ TOKEN( "IBM865", XML_IBM865 ),
+ TOKEN( "ISO-8859-1", XML_ISO_8859_1 ),
+ TOKEN( "ole2", XML_OLE2 ),
+ TOKEN( ":", XML__COLON ),
+ TOKEN( "", XML__EMPTY ),
+ TOKEN( "_unknown_", XML__UNKNOWN_ ),
+
+ TOKEN( "a", XML_A ),
+ TOKEN( "abbreviated-name", XML_ABBREVIATED_NAME ),
+ TOKEN( "above", XML_ABOVE ),
+ TOKEN( "abs", XML_ABS ),
+ TOKEN( "accent", XML_ACCENT ),
+ TOKEN( "accentunder", XML_ACCENTUNDER ),
+ TOKEN( "acceptance-state", XML_ACCEPTANCE_STATE ),
+ TOKEN( "accepted", XML_ACCEPTED ),
+ TOKEN( "action", XML_ACTION ),
+ TOKEN( "active", XML_ACTIVE ),
+ TOKEN( "active-split-range", XML_ACTIVE_SPLIT_RANGE ),
+ TOKEN( "active-table", XML_ACTIVE_TABLE ),
+ TOKEN( "actuate", XML_ACTUATE ),
+ TOKEN( "add-in", XML_ADD_IN ),
+ TOKEN( "add-in-name", XML_ADD_IN_NAME ),
+ TOKEN( "address", XML_ADDRESS ),
+ TOKEN( "adjustment", XML_ADJUSTMENT ),
+ TOKEN( "algorithm", XML_ALGORITHM ),
+ TOKEN( "align", XML_ALIGN ),
+ TOKEN( "all", XML_ALL ),
+ TOKEN( "allow-empty-cell", XML_ALLOW_EMPTY_CELL ),
+ TOKEN( "alphabetical-index", XML_ALPHABETICAL_INDEX ),
+ TOKEN( "alphabetical-index-auto-mark-file", XML_ALPHABETICAL_INDEX_AUTO_MARK_FILE ),
+ TOKEN( "alphabetical-index-entry-template", XML_ALPHABETICAL_INDEX_ENTRY_TEMPLATE ),
+ TOKEN( "alphabetical-index-mark", XML_ALPHABETICAL_INDEX_MARK ),
+ TOKEN( "alphabetical-index-mark-end", XML_ALPHABETICAL_INDEX_MARK_END ),
+ TOKEN( "alphabetical-index-mark-start", XML_ALPHABETICAL_INDEX_MARK_START ),
+ TOKEN( "alphabetical-index-source", XML_ALPHABETICAL_INDEX_SOURCE ),
+ TOKEN( "alphabetical-separators", XML_ALPHABETICAL_SEPARATORS ),
+ TOKEN( "alternate", XML_ALTERNATE ),
+ TOKEN( "am-pm", XML_AM_PM ),
+ TOKEN( "ambient-color", XML_AMBIENT_COLOR ),
+ TOKEN( "anchor-page-number", XML_ANCHOR_PAGE_NUMBER ),
+ TOKEN( "anchor-type", XML_ANCHOR_TYPE ),
+ TOKEN( "and", XML_AND ),
+ TOKEN( "animation", XML_ANIMATION ),
+ TOKEN( "animation-delay", XML_ANIMATION_DELAY ),
+ TOKEN( "animation-direction", XML_ANIMATION_DIRECTION ),
+ TOKEN( "animation-repeat", XML_ANIMATION_REPEAT ),
+ TOKEN( "animation-start-inside", XML_ANIMATION_START_INSIDE ),
+ TOKEN( "animation-steps", XML_ANIMATION_STEPS ),
+ TOKEN( "animation-stop-inside", XML_ANIMATION_STOP_INSIDE ),
+ TOKEN( "animations", XML_ANIMATIONS ),
+ TOKEN( "annotation", XML_ANNOTATION ),
+ TOKEN( "annotations", XML_ANNOTATIONS ),
+ TOKEN( "annote", XML_ANNOTE ),
+ TOKEN( "appear", XML_APPEAR ),
+ TOKEN( "applet", XML_APPLET ),
+ TOKEN( "applet-name", XML_APPLET_NAME ),
+ TOKEN( "application-data", XML_APPLICATION_DATA ),
+ TOKEN( "application-xml", XML_APPLICATION_XML ),
+ TOKEN( "apply", XML_APPLY ),
+ TOKEN( "apply-style-name", XML_APPLY_STYLE_NAME ),
+ TOKEN( "aqua", XML_AQUA ),
+ TOKEN( "arc", XML_ARC ),
+ TOKEN( "arccos", XML_ARCCOS ),
+ TOKEN( "archive", XML_ARCHIVE ),
+ TOKEN( "arcsin", XML_ARCSIN ),
+ TOKEN( "arctan", XML_ARCTAN ),
+ TOKEN( "area", XML_AREA ),
+ TOKEN( "area-circle", XML_AREA_CIRCLE ),
+ TOKEN( "area-polygon", XML_AREA_POLYGON ),
+ TOKEN( "area-rectangle", XML_AREA_RECTANGLE ),
+ TOKEN( "article", XML_ARTICLE ),
+ TOKEN( "as-char", XML_AS_CHAR ),
+ TOKEN( "ascending", XML_ASCENDING ),
+ TOKEN( "attached-axis", XML_ATTACHED_AXIS ),
+ TOKEN( "attractive", XML_ATTRACTIVE ),
+ TOKEN( "author", XML_AUTHOR ),
+ TOKEN( "author-initials", XML_AUTHOR_INITIALS ),
+ TOKEN( "author-name", XML_AUTHOR_NAME ),
+ TOKEN( "auto", XML_AUTO ),
+ TOKEN( "auto-grow-height", XML_AUTO_GROW_HEIGHT ),
+ TOKEN( "auto-grow-width", XML_AUTO_GROW_WIDTH ),
+ TOKEN( "auto-reload", XML_AUTO_RELOAD ),
+ TOKEN( "auto-text", XML_AUTO_TEXT ),
+ TOKEN( "auto-text-events", XML_AUTO_TEXT_EVENTS ),
+ TOKEN( "auto-text-group", XML_AUTO_TEXT_GROUP ),
+ TOKEN( "auto-text-indent", XML_AUTO_TEXT_INDENT ),
+ TOKEN( "auto-update", XML_AUTO_UPDATE ),
+ TOKEN( "automatic", XML_AUTOMATIC ),
+ TOKEN( "automatic-find-labels", XML_AUTOMATIC_FIND_LABELS ),
+ TOKEN( "automatic-order", XML_AUTOMATIC_ORDER ),
+ TOKEN( "automatic-styles", XML_AUTOMATIC_STYLES ),
+ TOKEN( "automatic-update", XML_AUTOMATIC_UPDATE ),
+ TOKEN( "autosize", XML_AUTOSIZE ),
+ TOKEN( "average", XML_AVERAGE ),
+ TOKEN( "axis", XML_AXIS ),
+ TOKEN( "back-scale", XML_BACK_SCALE ),
+ TOKEN( "backface-culling", XML_BACKFACE_CULLING ),
+ TOKEN( "background", XML_BACKGROUND ),
+ TOKEN( "background-color", XML_BACKGROUND_COLOR ),
+ TOKEN( "background-image", XML_BACKGROUND_IMAGE ),
+ TOKEN( "no-repeat", XML_BACKGROUND_NO_REPEAT ),
+ TOKEN( "repeat", XML_BACKGROUND_REPEAT ),
+ TOKEN( "stretch", XML_BACKGROUND_STRETCH ),
+ TOKEN( "bar", XML_BAR ),
+ TOKEN( "base64Binary", XML_BASE64BINARY ),
+ TOKEN( "base-cell-address", XML_BASE_CELL_ADDRESS ),
+ TOKEN( "baseline", XML_BASELINE ),
+ TOKEN( "before-date-time", XML_BEFORE_DATE_TIME ),
+ TOKEN( "below", XML_BELOW ),
+ TOKEN( "between-date-times", XML_BETWEEN_DATE_TIMES ),
+ TOKEN( "bevel", XML_BEVEL ),
+ TOKEN( "bibiliographic-type", XML_BIBILIOGRAPHIC_TYPE ),
+ TOKEN( "bibliography", XML_BIBLIOGRAPHY ),
+ TOKEN( "bibliography-configuration", XML_BIBLIOGRAPHY_CONFIGURATION ),
+ TOKEN( "bibliography-data-field", XML_BIBLIOGRAPHY_DATA_FIELD ),
+ TOKEN( "bibliography-entry-template", XML_BIBLIOGRAPHY_ENTRY_TEMPLATE ),
+ TOKEN( "bibliography-mark", XML_BIBLIOGRAPHY_MARK ),
+ TOKEN( "bibliography-source", XML_BIBLIOGRAPHY_SOURCE ),
+ TOKEN( "bibliography-type", XML_BIBLIOGRAPHY_TYPE ),
+ TOKEN( "bind-styles-to-content", XML_BIND_STYLES_TO_CONTENT ),
+ TOKEN( "bitmap", XML_BITMAP ),
+ TOKEN( "black", XML_BLACK ),
+ TOKEN( "blend", XML_BLEND ),
+ TOKEN( "blinking", XML_BLINKING ),
+ TOKEN( "block", XML_BLOCK ),
+ TOKEN( "block-list", XML_BLOCK_LIST ),
+ TOKEN( "blue", XML_BLUE ),
+ TOKEN( "body", XML_BODY ),
+ TOKEN( "bold", XML_BOLD ),
+ TOKEN( "book", XML_BOOK ),
+ TOKEN( "booklet", XML_BOOKLET ),
+ TOKEN( "bookmark", XML_BOOKMARK ),
+ TOKEN( "bookmark-end", XML_BOOKMARK_END ),
+ TOKEN( "bookmark-ref", XML_BOOKMARK_REF ),
+ TOKEN( "bookmark-start", XML_BOOKMARK_START ),
+ TOKEN( "booktitle", XML_BOOKTITLE ),
+ TOKEN( "boolean", XML_BOOLEAN ),
+ TOKEN( "boolean-style", XML_BOOLEAN_STYLE ),
+ TOKEN( "boolean-value", XML_BOOLEAN_VALUE ),
+ TOKEN( "border", XML_BORDER ),
+ TOKEN( "border-bottom", XML_BORDER_BOTTOM ),
+ TOKEN( "border-color", XML_BORDER_COLOR ),
+ TOKEN( "border-left", XML_BORDER_LEFT ),
+ TOKEN( "border-line-width", XML_BORDER_LINE_WIDTH ),
+ TOKEN( "border-line-width-bottom", XML_BORDER_LINE_WIDTH_BOTTOM ),
+ TOKEN( "border-line-width-left", XML_BORDER_LINE_WIDTH_LEFT ),
+ TOKEN( "border-line-width-right", XML_BORDER_LINE_WIDTH_RIGHT ),
+ TOKEN( "border-line-width-top", XML_BORDER_LINE_WIDTH_TOP ),
+ TOKEN( "border-right", XML_BORDER_RIGHT ),
+ TOKEN( "border-top", XML_BORDER_TOP ),
+ TOKEN( "both", XML_BOTH ),
+ TOKEN( "bottom", XML_BOTTOM ),
+ TOKEN( "bottom-left", XML_BOTTOM_LEFT ),
+ TOKEN( "bottom percent", XML_BOTTOM_PERCENT ),
+ TOKEN( "bottom-right", XML_BOTTOM_RIGHT ),
+ TOKEN( "bottom values", XML_BOTTOM_VALUES ),
+ TOKEN( "bottom-arc", XML_BOTTOMARC ),
+ TOKEN( "bottom-circle", XML_BOTTOMCIRCLE ),
+ TOKEN( "break-after", XML_BREAK_AFTER ),
+ TOKEN( "break-before", XML_BREAK_BEFORE ),
+ TOKEN( "break-inside", XML_BREAK_INSIDE ),
+ TOKEN( "bubble", XML_BUBBLE ),
+ TOKEN( "bullet-char", XML_BULLET_CHAR ),
+ TOKEN( "bullet-relative-size", XML_BULLET_RELATIVE_SIZE ),
+ TOKEN( "button1", XML_BUTTON1 ),
+ TOKEN( "button2", XML_BUTTON2 ),
+ TOKEN( "button3", XML_BUTTON3 ),
+ TOKEN( "button4", XML_BUTTON4 ),
+ TOKEN( "buttons", XML_BUTTONS ),
+ TOKEN( "bvar", XML_BVAR ),
+ TOKEN( "c", XML_C ),
+ TOKEN( "calculation-settings", XML_CALCULATION_SETTINGS ),
+ TOKEN( "calendar", XML_CALENDAR ),
+ TOKEN( "capitalize-entries", XML_CAPITALIZE_ENTRIES ),
+ TOKEN( "caption", XML_CAPTION ),
+ TOKEN( "caption-point-x", XML_CAPTION_POINT_X ),
+ TOKEN( "caption-point-y", XML_CAPTION_POINT_Y ),
+ TOKEN( "caption-sequence-format", XML_CAPTION_SEQUENCE_FORMAT ),
+ TOKEN( "caption-sequence-name", XML_CAPTION_SEQUENCE_NAME ),
+ TOKEN( "case-sensitive", XML_CASE_SENSITIVE ),
+ TOKEN( "capitalize", XML_CASEMAP_CAPITALIZE ),
+ TOKEN( "lowercase", XML_CASEMAP_LOWERCASE ),
+ TOKEN( "normal", XML_CASEMAP_NORMAL ),
+ TOKEN( "small-caps", XML_CASEMAP_SMALL_CAPS ),
+ TOKEN( "uppercase", XML_CASEMAP_UPPERCASE ),
+ TOKEN( "categories", XML_CATEGORIES ),
+ TOKEN( "category", XML_CATEGORY ),
+ TOKEN( "category-and-value", XML_CATEGORY_AND_VALUE ),
+ TOKEN( "cell-address", XML_CELL_ADDRESS ),
+ TOKEN( "cell-content-change", XML_CELL_CONTENT_CHANGE ),
+ TOKEN( "cell-content-deletion", XML_CELL_CONTENT_DELETION ),
+ TOKEN( "cell-count", XML_CELL_COUNT ),
+ TOKEN( "cell-protect", XML_CELL_PROTECT ),
+ TOKEN( "cell-range-address", XML_CELL_RANGE_ADDRESS ),
+ TOKEN( "cell-range-address-list", XML_CELL_RANGE_ADDRESS_LIST ),
+ TOKEN( "cell-range-source", XML_CELL_RANGE_SOURCE ),
+ TOKEN( "center", XML_CENTER ),
+ TOKEN( "chain-next-name", XML_CHAIN_NEXT_NAME ),
+ TOKEN( "change", XML_CHANGE ),
+ TOKEN( "change-deletion", XML_CHANGE_DELETION ),
+ TOKEN( "change-end", XML_CHANGE_END ),
+ TOKEN( "change-id", XML_CHANGE_ID ),
+ TOKEN( "change-info", XML_CHANGE_INFO ),
+ TOKEN( "change-start", XML_CHANGE_START ),
+ TOKEN( "change-track-table-cell", XML_CHANGE_TRACK_TABLE_CELL ),
+ TOKEN( "change-view-conditions", XML_CHANGE_VIEW_CONDITIONS ),
+ TOKEN( "change-view-settings", XML_CHANGE_VIEW_SETTINGS ),
+ TOKEN( "changed-region", XML_CHANGED_REGION ),
+ TOKEN( "chapter", XML_CHAPTER ),
+ TOKEN( "char", XML_CHAR ),
+ TOKEN( "character-count", XML_CHARACTER_COUNT ),
+ TOKEN( "chart", XML_CHART ),
+ TOKEN( "charts", XML_CHARTS ),
+ TOKEN( "checkerboard", XML_CHECKERBOARD ),
+ TOKEN( "chg-author", XML_CHG_AUTHOR ),
+ TOKEN( "chg-comment", XML_CHG_COMMENT ),
+ TOKEN( "chg-date-time", XML_CHG_DATE_TIME ),
+ TOKEN( "ci", XML_CI ),
+ TOKEN( "circle", XML_CIRCLE ),
+ TOKEN( "citation-body-style-name", XML_CITATION_BODY_STYLE_NAME ),
+ TOKEN( "citation-style-name", XML_CITATION_STYLE_NAME ),
+ TOKEN( "class", XML_CLASS ),
+ TOKEN( "class-id", XML_CLASS_ID ),
+ TOKEN( "clip", XML_CLIP ),
+ TOKEN( "clockwise", XML_CLOCKWISE ),
+ TOKEN( "close", XML_CLOSE ),
+ TOKEN( "close-horizontal", XML_CLOSE_HORIZONTAL ),
+ TOKEN( "close-vertical", XML_CLOSE_VERTICAL ),
+ TOKEN( "cm", XML_CM ),
+ TOKEN( "cn", XML_CN ),
+ TOKEN( "code", XML_CODE ),
+ TOKEN( "codebase", XML_CODEBASE ),
+ TOKEN( "collapse", XML_COLLAPSE ),
+ TOKEN( "color", XML_COLOR ),
+ TOKEN( "color-inversion", XML_COLOR_INVERSION ),
+ TOKEN( "color-mode", XML_COLOR_MODE ),
+ TOKEN( "column", XML_COLUMN ),
+ TOKEN( "column-count", XML_COLUMN_COUNT ),
+ TOKEN( "column-gap", XML_COLUMN_GAP ),
+ TOKEN( "column-name", XML_COLUMN_NAME ),
+ TOKEN( "column-sep", XML_COLUMN_SEP ),
+ TOKEN( "column-width", XML_COLUMN_WIDTH ),
+ TOKEN( "columns", XML_COLUMNS ),
+ TOKEN( "auto", XML_COLUMNSPLIT_AUTO ),
+ TOKEN( "avoid", XML_COLUMNSPLIT_AVOID ),
+ TOKEN( "combine-entries", XML_COMBINE_ENTRIES ),
+ TOKEN( "combine-entries-with-dash", XML_COMBINE_ENTRIES_WITH_DASH ),
+ TOKEN( "combine-entries-with-pp", XML_COMBINE_ENTRIES_WITH_PP ),
+ TOKEN( "comma-separated", XML_COMMA_SEPARATED ),
+ TOKEN( "command", XML_COMMAND ),
+ TOKEN( "comment", XML_COMMENT ),
+ TOKEN( "compose", XML_COMPOSE ),
+ TOKEN( "cond-style-name", XML_COND_STYLE_NAME ),
+ TOKEN( "condition", XML_CONDITION ),
+ TOKEN( "condition-source", XML_CONDITION_SOURCE ),
+ TOKEN( "condition-source-range-address", XML_CONDITION_SOURCE_RANGE_ADDRESS ),
+ TOKEN( "conditional-text", XML_CONDITIONAL_TEXT ),
+ TOKEN( "cone", XML_CONE ),
+ TOKEN( "conference", XML_CONFERENCE ),
+ TOKEN( "config-item", XML_CONFIG_ITEM ),
+ TOKEN( "config-item-map-entry", XML_CONFIG_ITEM_MAP_ENTRY ),
+ TOKEN( "config-item-map-indexed", XML_CONFIG_ITEM_MAP_INDEXED ),
+ TOKEN( "config-item-map-named", XML_CONFIG_ITEM_MAP_NAMED ),
+ TOKEN( "config-item-set", XML_CONFIG_ITEM_SET ),
+ TOKEN( "configuration-settings", XML_CONFIGURATION_SETTINGS ),
+ TOKEN( "conjugate", XML_CONJUGATE ),
+ TOKEN( "connect-bars", XML_CONNECT_BARS ),
+ TOKEN( "connection-name", XML_CONNECTION_NAME ),
+ TOKEN( "connector", XML_CONNECTOR ),
+ TOKEN( "consecutive-numbering", XML_CONSECUTIVE_NUMBERING ),
+ TOKEN( "consolidation", XML_CONSOLIDATION ),
+ TOKEN( "constant", XML_CONSTANT ),
+ TOKEN( "contains-error", XML_CONTAINS_ERROR ),
+ TOKEN( "contains-header", XML_CONTAINS_HEADER ),
+ TOKEN( "content", XML_CONTENT ),
+ TOKEN( "content-validation", XML_CONTENT_VALIDATION ),
+ TOKEN( "content-validation-name", XML_CONTENT_VALIDATION_NAME ),
+ TOKEN( "content-validations", XML_CONTENT_VALIDATIONS ),
+ TOKEN( "continue", XML_CONTINUE ),
+ TOKEN( "continue-numbering", XML_CONTINUE_NUMBERING ),
+ TOKEN( "contour-path", XML_CONTOUR_PATH ),
+ TOKEN( "contour-polygon", XML_CONTOUR_POLYGON ),
+ TOKEN( "contrast", XML_CONTRAST ),
+ TOKEN( "control", XML_CONTROL ),
+ TOKEN( "conversion-mode", XML_CONVERSION_MODE ),
+ TOKEN( "copy-back", XML_COPY_BACK ),
+ TOKEN( "copy-formulas", XML_COPY_FORMULAS ),
+ TOKEN( "copy-outline-levels", XML_COPY_OUTLINE_LEVELS ),
+ TOKEN( "copy-results-only", XML_COPY_RESULTS_ONLY ),
+ TOKEN( "copy-styles", XML_COPY_STYLES ),
+ TOKEN( "corner-radius", XML_CORNER_RADIUS ),
+ TOKEN( "correct", XML_CORRECT ),
+ TOKEN( "cos", XML_COS ),
+ TOKEN( "cosh", XML_COSH ),
+ TOKEN( "cot", XML_COT ),
+ TOKEN( "coth", XML_COTH ),
+ TOKEN( "count", XML_COUNT ),
+ TOKEN( "count-empty-lines", XML_COUNT_EMPTY_LINES ),
+ TOKEN( "count-in-floating-frames", XML_COUNT_IN_FLOATING_FRAMES ),
+ TOKEN( "counter-clockwise", XML_COUNTER_CLOCKWISE ),
+ TOKEN( "counterclockwise", XML_COUNTERCLOCKWISE ),
+ TOKEN( "countnums", XML_COUNTNUMS ),
+ TOKEN( "country", XML_COUNTRY ),
+ TOKEN( "country-asian", XML_COUNTRY_ASIAN ),
+ TOKEN( "country-complex", XML_COUNTRY_COMPLEX ),
+ TOKEN( "covered-table-cell", XML_COVERED_TABLE_CELL ),
+ TOKEN( "create-date", XML_CREATE_DATE ),
+ TOKEN( "create-date-string", XML_CREATE_DATE_STRING ),
+ TOKEN( "creation-date", XML_CREATION_DATE ),
+ TOKEN( "creation-time", XML_CREATION_TIME ),
+ TOKEN( "creator", XML_CREATOR ),
+ TOKEN( "csc", XML_CSC ),
+ TOKEN( "csch", XML_CSCH ),
+ TOKEN( "cube", XML_CUBE ),
+ TOKEN( "cuboid", XML_CUBOID ),
+ TOKEN( "currency", XML_CURRENCY ),
+ TOKEN( "currency-style", XML_CURRENCY_STYLE ),
+ TOKEN( "currency-symbol", XML_CURRENCY_SYMBOL ),
+ TOKEN( "current", XML_CURRENT ),
+ TOKEN( "current-value", XML_CURRENT_VALUE ),
+ TOKEN( "cursor-position", XML_CURSOR_POSITION ),
+ TOKEN( "cursor-position-x", XML_CURSOR_POSITION_X ),
+ TOKEN( "cursor-position-y", XML_CURSOR_POSITION_Y ),
+ TOKEN( "curve", XML_CURVE ),
+ TOKEN( "custom1", XML_CUSTOM1 ),
+ TOKEN( "custom2", XML_CUSTOM2 ),
+ TOKEN( "custom3", XML_CUSTOM3 ),
+ TOKEN( "custom4", XML_CUSTOM4 ),
+ TOKEN( "custom5", XML_CUSTOM5 ),
+ TOKEN( "cut", XML_CUT ),
+ TOKEN( "cut-offs", XML_CUT_OFFS ),
+ TOKEN( "cx", XML_CX ),
+ TOKEN( "cy", XML_CY ),
+ TOKEN( "cylinder", XML_CYLINDER ),
+ TOKEN( "d", XML_D ),
+ TOKEN( "dash", XML_DASH ),
+ TOKEN( "dashed", XML_DASHED ),
+ TOKEN( "data", XML_DATA ),
+ TOKEN( "data-cell-range-address", XML_DATA_CELL_RANGE_ADDRESS ),
+ TOKEN( "data-label-number", XML_DATA_LABEL_NUMBER ),
+ TOKEN( "data-label-symbol", XML_DATA_LABEL_SYMBOL ),
+ TOKEN( "data-label-text", XML_DATA_LABEL_TEXT ),
+ TOKEN( "data-pilot-field", XML_DATA_PILOT_FIELD ),
+ TOKEN( "data-pilot-grand-total", XML_DATA_PILOT_GRAND_TOTAL ),
+ TOKEN( "data-pilot-level", XML_DATA_PILOT_LEVEL ),
+ TOKEN( "data-pilot-member", XML_DATA_PILOT_MEMBER ),
+ TOKEN( "data-pilot-members", XML_DATA_PILOT_MEMBERS ),
+ TOKEN( "data-pilot-subtotal", XML_DATA_PILOT_SUBTOTAL ),
+ TOKEN( "data-pilot-subtotals", XML_DATA_PILOT_SUBTOTALS ),
+ TOKEN( "data-pilot-table", XML_DATA_PILOT_TABLE ),
+ TOKEN( "data-pilot-tables", XML_DATA_PILOT_TABLES ),
+ TOKEN( "data-point", XML_DATA_POINT ),
+ TOKEN( "data-style", XML_DATA_STYLE ),
+ TOKEN( "data-style-name", XML_DATA_STYLE_NAME ),
+ TOKEN( "data-type", XML_DATA_TYPE ),
+ TOKEN( "database-display", XML_DATABASE_DISPLAY ),
+ TOKEN( "database-name", XML_DATABASE_NAME ),
+ TOKEN( "database-next", XML_DATABASE_NEXT ),
+ TOKEN( "database-range", XML_DATABASE_RANGE ),
+ TOKEN( "database-ranges", XML_DATABASE_RANGES ),
+ TOKEN( "database-row-number", XML_DATABASE_ROW_NUMBER ),
+ TOKEN( "database-select", XML_DATABASE_SELECT ),
+ TOKEN( "database-source-query", XML_DATABASE_SOURCE_QUERY ),
+ TOKEN( "database-source-sql", XML_DATABASE_SOURCE_SQL ),
+ TOKEN( "database-source-table", XML_DATABASE_SOURCE_TABLE ),
+ TOKEN( "date", XML_DATE ),
+ TOKEN( "date-adjust", XML_DATE_ADJUST ),
+ TOKEN( "date-style", XML_DATE_STYLE ),
+ TOKEN( "date-time", XML_DATE_TIME ),
+ TOKEN( "date-value", XML_DATE_VALUE ),
+ TOKEN( "datetime", XML_DATETIME ),
+ TOKEN( "day", XML_DAY ),
+ TOKEN( "day-of-week", XML_DAY_OF_WEEK ),
+ TOKEN( "dde-application", XML_DDE_APPLICATION ),
+ TOKEN( "dde-connection", XML_DDE_CONNECTION ),
+ TOKEN( "dde-connection-decl", XML_DDE_CONNECTION_DECL ),
+ TOKEN( "dde-connection-decls", XML_DDE_CONNECTION_DECLS ),
+ TOKEN( "dde-item", XML_DDE_ITEM ),
+ TOKEN( "dde-link", XML_DDE_LINK ),
+ TOKEN( "dde-links", XML_DDE_LINKS ),
+ TOKEN( "dde-source", XML_DDE_SOURCE ),
+ TOKEN( "dde-topic", XML_DDE_TOPIC ),
+ TOKEN( "decimal-places", XML_DECIMAL_PLACES ),
+ TOKEN( "decimal-replacement", XML_DECIMAL_REPLACEMENT ),
+ TOKEN( "declare", XML_DECLARE ),
+ TOKEN( "decorate-words-only", XML_DECORATE_WORDS_ONLY ),
+ TOKEN( "decorative", XML_DECORATIVE ),
+ TOKEN( "deep", XML_DEEP ),
+ TOKEN( "default", XML_DEFAULT ),
+ TOKEN( "default-cell-style-name", XML_DEFAULT_CELL_STYLE_NAME ),
+ TOKEN( "default-style", XML_DEFAULT_STYLE ),
+ TOKEN( "default-style-name", XML_DEFAULT_STYLE_NAME ),
+ TOKEN( "degree", XML_DEGREE ),
+ TOKEN( "delay", XML_DELAY ),
+ TOKEN( "deletion", XML_DELETION ),
+ TOKEN( "deletions", XML_DELETIONS ),
+ TOKEN( "dependence", XML_DEPENDENCE ),
+ TOKEN( "dependences", XML_DEPENDENCES ),
+ TOKEN( "dependencies", XML_DEPENDENCIES ),
+ TOKEN( "depth", XML_DEPTH ),
+ TOKEN( "desc", XML_DESC ),
+ TOKEN( "descending", XML_DESCENDING ),
+ TOKEN( "description", XML_DESCRIPTION ),
+ TOKEN( "detective", XML_DETECTIVE ),
+ TOKEN( "determinant", XML_DETERMINANT ),
+ TOKEN( "diff", XML_DIFF ),
+ TOKEN( "diffuse-color", XML_DIFFUSE_COLOR ),
+ TOKEN( "dim", XML_DIM ),
+ TOKEN( "direction", XML_DIRECTION ),
+ TOKEN( "disabled", XML_DISABLED ),
+ TOKEN( "disc", XML_DISC ),
+ TOKEN( "display", XML_DISPLAY ),
+ TOKEN( "display-border", XML_DISPLAY_BORDER ),
+ TOKEN( "display-details", XML_DISPLAY_DETAILS ),
+ TOKEN( "display-duplicates", XML_DISPLAY_DUPLICATES ),
+ TOKEN( "display-empty", XML_DISPLAY_EMPTY ),
+ TOKEN( "display-filter-buttons", XML_DISPLAY_FILTER_BUTTONS ),
+ TOKEN( "display-formula", XML_DISPLAY_FORMULA ),
+ TOKEN( "display-label", XML_DISPLAY_LABEL ),
+ TOKEN( "display-levels", XML_DISPLAY_LEVELS ),
+ TOKEN( "display-name", XML_DISPLAY_NAME ),
+ TOKEN( "display-outline-level", XML_DISPLAY_OUTLINE_LEVEL ),
+ TOKEN( "dissolve", XML_DISSOLVE ),
+ TOKEN( "distance", XML_DISTANCE ),
+ TOKEN( "distance-after-sep", XML_DISTANCE_AFTER_SEP ),
+ TOKEN( "distance-before-sep", XML_DISTANCE_BEFORE_SEP ),
+ TOKEN( "distribute", XML_DISTRIBUTE ),
+ TOKEN( "distribute-letter", XML_DISTRIBUTE_LETTER ),
+ TOKEN( "distribute-space", XML_DISTRIBUTE_SPACE ),
+ TOKEN( "divide", XML_DIVIDE ),
+ TOKEN( "document", XML_DOCUMENT ),
+ TOKEN( "document-content", XML_DOCUMENT_CONTENT ),
+ TOKEN( "document-meta", XML_DOCUMENT_META ),
+ TOKEN( "document-settings", XML_DOCUMENT_SETTINGS ),
+ TOKEN( "document-statistic", XML_DOCUMENT_STATISTIC ),
+ TOKEN( "document-styles", XML_DOCUMENT_STYLES ),
+ TOKEN( "domain", XML_DOMAIN ),
+ TOKEN( "dot", XML_DOT ),
+ TOKEN( "dots1", XML_DOTS1 ),
+ TOKEN( "dots1-length", XML_DOTS1_LENGTH ),
+ TOKEN( "dots2", XML_DOTS2 ),
+ TOKEN( "dots2-length", XML_DOTS2_LENGTH ),
+ TOKEN( "dotted", XML_DOTTED ),
+ TOKEN( "double", XML_DOUBLE ),
+ TOKEN( "double-sided", XML_DOUBLE_SIDED ),
+ TOKEN( "down", XML_DOWN ),
+ TOKEN( "draft", XML_DRAFT ),
+ TOKEN( "draw", XML_DRAW ),
+ TOKEN( "ole-draw-aspect", XML_DRAW_ASPECT ),
+ TOKEN( "drawing", XML_DRAWING ),
+ TOKEN( "drawings", XML_DRAWINGS ),
+ TOKEN( "drawpool", XML_DRAWPOOL ),
+ TOKEN( "drop-cap", XML_DROP_CAP ),
+ TOKEN( "dynamic", XML_DYNAMIC ),
+ TOKEN( "edge-rounding", XML_EDGE_ROUNDING ),
+ TOKEN( "editable", XML_EDITABLE ),
+ TOKEN( "editing-cycles", XML_EDITING_CYCLES ),
+ TOKEN( "editing-duration", XML_EDITING_DURATION ),
+ TOKEN( "edition", XML_EDITION ),
+ TOKEN( "editor", XML_EDITOR ),
+ TOKEN( "effect", XML_EFFECT ),
+ TOKEN( "ellipse", XML_ELLIPSE ),
+ TOKEN( "email", XML_EMAIL ),
+ TOKEN( "embed", XML_EMBED ),
+ TOKEN( "embedded-visible-area", XML_EMBEDDED_VISIBLE_AREA ),
+ TOKEN( "embossed", XML_EMBOSSED ),
+ TOKEN( "emissive-color", XML_EMISSIVE_COLOR ),
+ TOKEN( "empty", XML_EMPTY ),
+ TOKEN( "enable-numbering", XML_ENABLE_NUMBERING ),
+ TOKEN( "enabled", XML_ENABLED ),
+ TOKEN( "encoding", XML_ENCODING ),
+ TOKEN( "end", XML_END ),
+ TOKEN( "end-angle", XML_END_ANGLE ),
+ TOKEN( "end-cell-address", XML_END_CELL_ADDRESS ),
+ TOKEN( "end-color", XML_END_COLOR ),
+ TOKEN( "end-column", XML_END_COLUMN ),
+ TOKEN( "end-glue-point", XML_END_GLUE_POINT ),
+ TOKEN( "end-guide", XML_END_GUIDE ),
+ TOKEN( "end-intensity", XML_END_INTENSITY ),
+ TOKEN( "end-line-spacing-horizontal", XML_END_LINE_SPACING_HORIZONTAL ),
+ TOKEN( "end-line-spacing-vertical", XML_END_LINE_SPACING_VERTICAL ),
+ TOKEN( "end-position", XML_END_POSITION ),
+ TOKEN( "end-row", XML_END_ROW ),
+ TOKEN( "end-shape", XML_END_SHAPE ),
+ TOKEN( "end-table", XML_END_TABLE ),
+ TOKEN( "end-x", XML_END_X ),
+ TOKEN( "end-y", XML_END_Y ),
+ TOKEN( "endless", XML_ENDLESS ),
+ TOKEN( "endnote", XML_ENDNOTE ),
+ TOKEN( "endnote-body", XML_ENDNOTE_BODY ),
+ TOKEN( "endnote-citation", XML_ENDNOTE_CITATION ),
+ TOKEN( "endnote-ref", XML_ENDNOTE_REF ),
+ TOKEN( "endnotes-configuration", XML_ENDNOTES_CONFIGURATION ),
+ TOKEN( "engraved", XML_ENGRAVED ),
+ TOKEN( "eq", XML_EQ ),
+ TOKEN( "equal-author", XML_EQUAL_AUTHOR ),
+ TOKEN( "equal-comment", XML_EQUAL_COMMENT ),
+ TOKEN( "equal-date", XML_EQUAL_DATE ),
+ TOKEN( "era", XML_ERA ),
+ TOKEN( "ergo-sum", XML_ERGO_SUM ),
+ TOKEN( "error-category", XML_ERROR_CATEGORY ),
+ TOKEN( "error-lower-indicator", XML_ERROR_LOWER_INDICATOR ),
+ TOKEN( "error-lower-limit", XML_ERROR_LOWER_LIMIT ),
+ TOKEN( "error-macro", XML_ERROR_MACRO ),
+ TOKEN( "error-margin", XML_ERROR_MARGIN ),
+ TOKEN( "error-message", XML_ERROR_MESSAGE ),
+ TOKEN( "error-percentage", XML_ERROR_PERCENTAGE ),
+ TOKEN( "error-upper-indicator", XML_ERROR_UPPER_INDICATOR ),
+ TOKEN( "error-upper-limit", XML_ERROR_UPPER_LIMIT ),
+ TOKEN( "sub", XML_ESCAPEMENT_SUB ),
+ TOKEN( "super", XML_ESCAPEMENT_SUPER ),
+ TOKEN( "even-page", XML_EVEN_PAGE ),
+ TOKEN( "event", XML_EVENT ),
+ TOKEN( "event-name", XML_EVENT_NAME ),
+ TOKEN( "events", XML_EVENTS ),
+ TOKEN( "execute", XML_EXECUTE ),
+ TOKEN( "execute-macro", XML_EXECUTE_MACRO ),
+ TOKEN( "exists", XML_EXISTS ),
+ TOKEN( "exp", XML_EXP ),
+ TOKEN( "exponential", XML_EXPONENTIAL ),
+ TOKEN( "expression", XML_EXPRESSION ),
+ TOKEN( "extra", XML_EXTRA ),
+ TOKEN( "extrude", XML_EXTRUDE ),
+ TOKEN( "factorial", XML_FACTORIAL ),
+ TOKEN( "fade", XML_FADE ),
+ TOKEN( "fade-from-bottom", XML_FADE_FROM_BOTTOM ),
+ TOKEN( "fade-from-center", XML_FADE_FROM_CENTER ),
+ TOKEN( "fade-from-left", XML_FADE_FROM_LEFT ),
+ TOKEN( "fade-from-lowerleft", XML_FADE_FROM_LOWERLEFT ),
+ TOKEN( "fade-from-lowerright", XML_FADE_FROM_LOWERRIGHT ),
+ TOKEN( "fade-from-right", XML_FADE_FROM_RIGHT ),
+ TOKEN( "fade-from-top", XML_FADE_FROM_TOP ),
+ TOKEN( "fade-from-upperleft", XML_FADE_FROM_UPPERLEFT ),
+ TOKEN( "fade-from-upperright", XML_FADE_FROM_UPPERRIGHT ),
+ TOKEN( "fade-out", XML_FADE_OUT ),
+ TOKEN( "fade-to-center", XML_FADE_TO_CENTER ),
+ TOKEN( "false", XML_FALSE ),
+ TOKEN( "family", XML_FAMILY ),
+ TOKEN( "fast", XML_FAST ),
+ TOKEN( "field-number", XML_FIELD_NUMBER ),
+ TOKEN( "file-name", XML_FILE_NAME ),
+ TOKEN( "fill", XML_FILL ),
+ TOKEN( "fill-color", XML_FILL_COLOR ),
+ TOKEN( "fill-gradient-name", XML_FILL_GRADIENT_NAME ),
+ TOKEN( "fill-hatch-name", XML_FILL_HATCH_NAME ),
+ TOKEN( "fill-hatch-solid", XML_FILL_HATCH_SOLID ),
+ TOKEN( "fill-image", XML_FILL_IMAGE ),
+ TOKEN( "fill-image-height", XML_FILL_IMAGE_HEIGHT ),
+ TOKEN( "fill-image-name", XML_FILL_IMAGE_NAME ),
+ TOKEN( "fill-image-ref-point", XML_FILL_IMAGE_REF_POINT ),
+ TOKEN( "fill-image-ref-point-x", XML_FILL_IMAGE_REF_POINT_X ),
+ TOKEN( "fill-image-ref-point-y", XML_FILL_IMAGE_REF_POINT_Y ),
+ TOKEN( "fill-image-width", XML_FILL_IMAGE_WIDTH ),
+ TOKEN( "filter", XML_FILTER ),
+ TOKEN( "filter-and", XML_FILTER_AND ),
+ TOKEN( "filter-condition", XML_FILTER_CONDITION ),
+ TOKEN( "filter-name", XML_FILTER_NAME ),
+ TOKEN( "filter-options", XML_FILTER_OPTIONS ),
+ TOKEN( "filter-or", XML_FILTER_OR ),
+ TOKEN( "first-date-time", XML_FIRST_DATE_TIME ),
+ TOKEN( "first-page", XML_FIRST_PAGE ),
+ TOKEN( "first-page-number", XML_FIRST_PAGE_NUMBER ),
+ TOKEN( "fit-to-contour", XML_FIT_TO_CONTOUR ),
+ TOKEN( "fit-to-size", XML_FIT_TO_SIZE ),
+ TOKEN( "fix", XML_FIX ),
+ TOKEN( "fixed", XML_FIXED ),
+ TOKEN( "flat", XML_FLAT ),
+ TOKEN( "float", XML_FLOAT ),
+ TOKEN( "floating-frame", XML_FLOATING_FRAME ),
+ TOKEN( "floor", XML_FLOOR ),
+ TOKEN( "fn", XML_FN ),
+ TOKEN( "focal-length", XML_FOCAL_LENGTH ),
+ TOKEN( "font-char-width", XML_FONT_CHAR_WIDTH ),
+ TOKEN( "font-charset", XML_FONT_CHARSET ),
+ TOKEN( "font-charset-asian", XML_FONT_CHARSET_ASIAN ),
+ TOKEN( "font-charset-complex", XML_FONT_CHARSET_COMPLEX ),
+ TOKEN( "font-color", XML_FONT_COLOR ),
+ TOKEN( "font-decl", XML_FONT_DECL ),
+ TOKEN( "font-decls", XML_FONT_DECLS ),
+ TOKEN( "font-family", XML_FONT_FAMILY ),
+ TOKEN( "font-family-asian", XML_FONT_FAMILY_ASIAN ),
+ TOKEN( "font-family-complex", XML_FONT_FAMILY_COMPLEX ),
+ TOKEN( "font-family-generic", XML_FONT_FAMILY_GENERIC ),
+ TOKEN( "font-family-generic-asian", XML_FONT_FAMILY_GENERIC_ASIAN ),
+ TOKEN( "font-family-generic-complex", XML_FONT_FAMILY_GENERIC_COMPLEX ),
+ TOKEN( "font-kerning", XML_FONT_KERNING ),
+ TOKEN( "font-name", XML_FONT_NAME ),
+ TOKEN( "font-name-asian", XML_FONT_NAME_ASIAN ),
+ TOKEN( "font-name-complex", XML_FONT_NAME_COMPLEX ),
+ TOKEN( "font-pitch", XML_FONT_PITCH ),
+ TOKEN( "font-pitch-asian", XML_FONT_PITCH_ASIAN ),
+ TOKEN( "font-pitch-complex", XML_FONT_PITCH_COMPLEX ),
+ TOKEN( "font-relief", XML_FONT_RELIEF ),
+ TOKEN( "font-size", XML_FONT_SIZE ),
+ TOKEN( "font-size-asian", XML_FONT_SIZE_ASIAN ),
+ TOKEN( "font-size-complex", XML_FONT_SIZE_COMPLEX ),
+ TOKEN( "font-size-rel", XML_FONT_SIZE_REL ),
+ TOKEN( "font-size-rel-asian", XML_FONT_SIZE_REL_ASIAN ),
+ TOKEN( "font-size-rel-complex", XML_FONT_SIZE_REL_COMPLEX ),
+ TOKEN( "font-style", XML_FONT_STYLE ),
+ TOKEN( "font-style-asian", XML_FONT_STYLE_ASIAN ),
+ TOKEN( "font-style-complex", XML_FONT_STYLE_COMPLEX ),
+ TOKEN( "font-style-name", XML_FONT_STYLE_NAME ),
+ TOKEN( "font-style-name-asian", XML_FONT_STYLE_NAME_ASIAN ),
+ TOKEN( "font-style-name-complex", XML_FONT_STYLE_NAME_COMPLEX ),
+ TOKEN( "font-variant", XML_FONT_VARIANT ),
+ TOKEN( "font-weight", XML_FONT_WEIGHT ),
+ TOKEN( "font-weight-asian", XML_FONT_WEIGHT_ASIAN ),
+ TOKEN( "font-weight-complex", XML_FONT_WEIGHT_COMPLEX ),
+ TOKEN( "font-width", XML_FONT_WIDTH ),
+ TOKEN( "font-word-line-mode", XML_FONT_WORD_LINE_MODE ),
+ TOKEN( "fontfamily", XML_FONTFAMILY ),
+ TOKEN( "fontsize", XML_FONTSIZE ),
+ TOKEN( "fontstyle", XML_FONTSTYLE ),
+ TOKEN( "fontweight", XML_FONTWEIGHT ),
+ TOKEN( "fontwork-adjust", XML_FONTWORK_ADJUST ),
+ TOKEN( "fontwork-distance", XML_FONTWORK_DISTANCE ),
+ TOKEN( "fontwork-form", XML_FONTWORK_FORM ),
+ TOKEN( "fontwork-hide-form", XML_FONTWORK_HIDE_FORM ),
+ TOKEN( "fontwork-mirror", XML_FONTWORK_MIRROR ),
+ TOKEN( "fontwork-outline", XML_FONTWORK_OUTLINE ),
+ TOKEN( "fontwork-shadow", XML_FONTWORK_SHADOW ),
+ TOKEN( "fontwork-shadow-color", XML_FONTWORK_SHADOW_COLOR ),
+ TOKEN( "fontwork-shadow-offset-x", XML_FONTWORK_SHADOW_OFFSET_X ),
+ TOKEN( "fontwork-shadow-offset-y", XML_FONTWORK_SHADOW_OFFSET_Y ),
+ TOKEN( "fontwork-shadow-transparence", XML_FONTWORK_SHADOW_TRANSPARENCE ),
+ TOKEN( "fontwork-start", XML_FONTWORK_START ),
+ TOKEN( "fontwork-style", XML_FONTWORK_STYLE ),
+ TOKEN( "footer", XML_FOOTER ),
+ TOKEN( "footer-left", XML_FOOTER_LEFT ),
+ TOKEN( "footer-style", XML_FOOTER_STYLE ),
+ TOKEN( "footnote", XML_FOOTNOTE ),
+ TOKEN( "footnote-body", XML_FOOTNOTE_BODY ),
+ TOKEN( "footnote-citation", XML_FOOTNOTE_CITATION ),
+ TOKEN( "footnote-continuation-notice-backward", XML_FOOTNOTE_CONTINUATION_NOTICE_BACKWARD ),
+ TOKEN( "footnote-continuation-notice-forward", XML_FOOTNOTE_CONTINUATION_NOTICE_FORWARD ),
+ TOKEN( "footnote-max-height", XML_FOOTNOTE_MAX_HEIGHT ),
+ TOKEN( "footnote-ref", XML_FOOTNOTE_REF ),
+ TOKEN( "footnote-sep", XML_FOOTNOTE_SEP ),
+ TOKEN( "footnotes-configuration", XML_FOOTNOTES_CONFIGURATION ),
+ TOKEN( "footnotes-position", XML_FOOTNOTES_POSITION ),
+ TOKEN( "forall", XML_FORALL ),
+ TOKEN( "force-manual", XML_FORCE_MANUAL ),
+ TOKEN( "foreground", XML_FOREGROUND ),
+ TOKEN( "foreign-object", XML_FOREIGN_OBJECT ),
+ TOKEN( "format-change", XML_FORMAT_CHANGE ),
+ TOKEN( "format-source", XML_FORMAT_SOURCE ),
+ TOKEN( "forms", XML_FORMS ),
+ TOKEN( "formula", XML_FORMULA ),
+ TOKEN( "formula-hidden", XML_FORMULA_HIDDEN ),
+ TOKEN( "formulas", XML_FORMULAS ),
+ TOKEN( "fraction", XML_FRACTION ),
+ TOKEN( "frame", XML_FRAME ),
+ TOKEN( "frame-content", XML_FRAME_CONTENT ),
+ TOKEN( "frame-display-border", XML_FRAME_DISPLAY_BORDER ),
+ TOKEN( "frame-display-scrollbar", XML_FRAME_DISPLAY_SCROLLBAR ),
+ TOKEN( "frame-end-margin", XML_FRAME_END_MARGIN ),
+ TOKEN( "frame-margin-horizontal", XML_FRAME_MARGIN_HORIZONTAL ),
+ TOKEN( "frame-margin-vertical", XML_FRAME_MARGIN_VERTICAL ),
+ TOKEN( "frame-name", XML_FRAME_NAME ),
+ TOKEN( "frame-start-margin", XML_FRAME_START_MARGIN ),
+ TOKEN( "freeze", XML_FREEZE ),
+ TOKEN( "freeze-position", XML_FREEZE_POSITION ),
+ TOKEN( "from-another-table", XML_FROM_ANOTHER_TABLE ),
+ TOKEN( "from-bottom", XML_FROM_BOTTOM ),
+ TOKEN( "from-center", XML_FROM_CENTER ),
+ TOKEN( "from-inside", XML_FROM_INSIDE ),
+ TOKEN( "from-left", XML_FROM_LEFT ),
+ TOKEN( "from-lower-left", XML_FROM_LOWER_LEFT ),
+ TOKEN( "from-lower-right", XML_FROM_LOWER_RIGHT ),
+ TOKEN( "from-right", XML_FROM_RIGHT ),
+ TOKEN( "from-same-table", XML_FROM_SAME_TABLE ),
+ TOKEN( "from-top", XML_FROM_TOP ),
+ TOKEN( "from-upper-left", XML_FROM_UPPER_LEFT ),
+ TOKEN( "from-upper-right", XML_FROM_UPPER_RIGHT ),
+ TOKEN( "fuchsia", XML_FUCHSIA ),
+ TOKEN( "full", XML_FULL ),
+ TOKEN( "full-screen", XML_FULL_SCREEN ),
+ TOKEN( "function", XML_FUNCTION ),
+ TOKEN( "g", XML_G ),
+ TOKEN( "gamma", XML_GAMMA ),
+ TOKEN( "gap", XML_GAP ),
+ TOKEN( "gap-width", XML_GAP_WIDTH ),
+ TOKEN( "gcd", XML_GCD ),
+ TOKEN( "generator", XML_GENERATOR ),
+ TOKEN( "geq", XML_GEQ ),
+ TOKEN( "gouraud", XML_GOURAUD ),
+ TOKEN( "gradient", XML_GRADIENT ),
+ TOKEN( "angle", XML_GRADIENT_ANGLE ),
+ TOKEN( "border", XML_GRADIENT_BORDER ),
+ TOKEN( "gradient-step-count", XML_GRADIENT_STEP_COUNT ),
+ TOKEN( "gradient-style", XML_GRADIENT_STYLE ),
+ TOKEN( "axial", XML_GRADIENTSTYLE_AXIAL ),
+ TOKEN( "ellipsoid", XML_GRADIENTSTYLE_ELLIPSOID ),
+ TOKEN( "linear", XML_GRADIENTSTYLE_LINEAR ),
+ TOKEN( "radial", XML_GRADIENTSTYLE_RADIAL ),
+ TOKEN( "rectangular", XML_GRADIENTSTYLE_RECTANGULAR ),
+ TOKEN( "square", XML_GRADIENTSTYLE_SQUARE ),
+ TOKEN( "grand-total", XML_GRAND_TOTAL ),
+ TOKEN( "graphic", XML_GRAPHIC ),
+ TOKEN( "gray", XML_GRAY ),
+ TOKEN( "green", XML_GREEN ),
+ TOKEN( "greyscale", XML_GREYSCALE ),
+ TOKEN( "grid", XML_GRID ),
+ TOKEN( "groove", XML_GROOVE ),
+ TOKEN( "group-by-field-number", XML_GROUP_BY_FIELD_NUMBER ),
+ TOKEN( "group-name", XML_GROUP_NAME ),
+ TOKEN( "grouping", XML_GROUPING ),
+ TOKEN( "gt", XML_GT ),
+ TOKEN( "guide-distance", XML_GUIDE_DISTANCE ),
+ TOKEN( "guide-overhang", XML_GUIDE_OVERHANG ),
+ TOKEN( "h", XML_H ),
+ TOKEN( "hanging", XML_HANGING ),
+ TOKEN( "has-persistent-data", XML_HAS_PERSISTENT_DATA ),
+ TOKEN( "hatch", XML_HATCH ),
+ TOKEN( "distance", XML_HATCH_DISTANCE ),
+ TOKEN( "style", XML_HATCH_STYLE ),
+ TOKEN( "double", XML_HATCHSTYLE_DOUBLE ),
+ TOKEN( "single", XML_HATCHSTYLE_SINGLE ),
+ TOKEN( "triple", XML_HATCHSTYLE_TRIPLE ),
+ TOKEN( "header", XML_HEADER ),
+ TOKEN( "header-left", XML_HEADER_LEFT ),
+ TOKEN( "header-style", XML_HEADER_STYLE ),
+ TOKEN( "headers", XML_HEADERS ),
+ TOKEN( "height", XML_HEIGHT ),
+ TOKEN( "help", XML_HELP),
+ TOKEN( "help-file-name", XML_HELP_FILE_NAME ),
+ TOKEN( "help-id", XML_HELP_ID ),
+ TOKEN( "help-message", XML_HELP_MESSAGE ),
+ TOKEN( "hidden", XML_HIDDEN ),
+ TOKEN( "hidden-and-protected", XML_HIDDEN_AND_PROTECTED ),
+ TOKEN( "hidden-paragraph", XML_HIDDEN_PARAGRAPH ),
+ TOKEN( "hidden-text", XML_HIDDEN_TEXT ),
+ TOKEN( "hide", XML_HIDE ),
+ TOKEN( "hide-shape", XML_HIDE_SHAPE ),
+ TOKEN( "hide-text", XML_HIDE_TEXT ),
+ TOKEN( "highlighted-range", XML_HIGHLIGHTED_RANGE ),
+ TOKEN( "hint", XML_HINT),
+ TOKEN( "horizontal", XML_HORIZONTAL ),
+ TOKEN( "horizontal-lines", XML_HORIZONTAL_LINES ),
+ /* XML_HORIZONTAL_ON_LEFT_PAGES and XML_HORIZONTAL_ON_RIGHT_PAGES
+ are replaced by XML_HORIZONTAL_ON_EVEN and XML_HORIZONTAL_ON_ODD.
+ Usage is deprecated, but the old token are needed for the
+ OpenOffice.org file format import/export filter for the renaming (#i49139#)
+ */
+ TOKEN( "horizontal-on-left-pages", XML_HORIZONTAL_ON_LEFT_PAGES ),
+ TOKEN( "horizontal-on-right-pages", XML_HORIZONTAL_ON_RIGHT_PAGES ),
+ TOKEN( "horizontal-pos", XML_HORIZONTAL_POS ),
+ TOKEN( "horizontal-rel", XML_HORIZONTAL_REL ),
+ TOKEN( "horizontal-scrollbar-width", XML_HORIZONTAL_SCROLLBAR_WIDTH ),
+ TOKEN( "horizontal-segments", XML_HORIZONTAL_SEGMENTS ),
+ TOKEN( "horizontal-split-mode", XML_HORIZONTAL_SPLIT_MODE ),
+ TOKEN( "horizontal-split-position", XML_HORIZONTAL_SPLIT_POSITION ),
+ TOKEN( "horizontal-stripes", XML_HORIZONTAL_STRIPES ),
+ TOKEN( "hours", XML_HOURS ),
+ TOKEN( "howpublished", XML_HOWPUBLISHED ),
+ TOKEN( "href", XML_HREF ),
+ TOKEN( "html", XML_HTML ),
+ TOKEN( "hyperlink-behaviour", XML_HYPERLINK_BEHAVIOUR ),
+ TOKEN( "hyphenate", XML_HYPHENATE ),
+ TOKEN( "hyphenation-keep", XML_HYPHENATION_KEEP ),
+ TOKEN( "hyphenation-ladder-count", XML_HYPHENATION_LADDER_COUNT ),
+ TOKEN( "hyphenation-push-char-count", XML_HYPHENATION_PUSH_CHAR_COUNT ),
+ TOKEN( "hyphenation-remain-char-count", XML_HYPHENATION_REMAIN_CHAR_COUNT ),
+ TOKEN( "i", XML_I ),
+ TOKEN( "icon", XML_ICON ),
+ TOKEN( "id", XML_ID ),
+ TOKEN( "ident", XML_IDENT ),
+ TOKEN( "identifier", XML_IDENTIFIER ),
+ TOKEN( "identify-categories", XML_IDENTIFY_CATEGORIES ),
+ TOKEN( "ideograph-alpha", XML_IDEOGRAPH_ALPHA ),
+ TOKEN( "ignore-case", XML_IGNORE_CASE ),
+ TOKEN( "ignore-empty-rows", XML_IGNORE_EMPTY_ROWS ),
+ TOKEN( "illustration-index", XML_ILLUSTRATION_INDEX ),
+ TOKEN( "illustration-index-entry-template", XML_ILLUSTRATION_INDEX_ENTRY_TEMPLATE ),
+ TOKEN( "illustration-index-source", XML_ILLUSTRATION_INDEX_SOURCE ),
+ TOKEN( "image", XML_IMAGE ),
+ TOKEN( "image-count", XML_IMAGE_COUNT ),
+ TOKEN( "image-map", XML_IMAGE_MAP ),
+ TOKEN( "implies", XML_IMPLIES ),
+ TOKEN( "in", XML_IN ),
+ TOKEN( "in-range", XML_IN_RANGE ),
+ TOKEN( "inbook", XML_INBOOK ),
+ TOKEN( "incollection", XML_INCOLLECTION ),
+ TOKEN( "increment", XML_INCREMENT ),
+ TOKEN( "index", XML_INDEX ),
+ TOKEN( "index-body", XML_INDEX_BODY ),
+ TOKEN( "index-entry-bibliography", XML_INDEX_ENTRY_BIBLIOGRAPHY ),
+ TOKEN( "index-entry-chapter", XML_INDEX_ENTRY_CHAPTER ),
+ TOKEN( "index-entry-chapter-number", XML_INDEX_ENTRY_CHAPTER_NUMBER ),
+ TOKEN( "index-entry-link-end", XML_INDEX_ENTRY_LINK_END ),
+ TOKEN( "index-entry-link-start", XML_INDEX_ENTRY_LINK_START ),
+ TOKEN( "index-entry-page-number", XML_INDEX_ENTRY_PAGE_NUMBER ),
+ TOKEN( "index-entry-span", XML_INDEX_ENTRY_SPAN ),
+ TOKEN( "index-entry-tab-stop", XML_INDEX_ENTRY_TAB_STOP ),
+ TOKEN( "index-entry-template", XML_INDEX_ENTRY_TEMPLATE ),
+ TOKEN( "index-entry-text", XML_INDEX_ENTRY_TEXT ),
+ TOKEN( "index-name", XML_INDEX_NAME ),
+ TOKEN( "index-scope", XML_INDEX_SCOPE ),
+ TOKEN( "index-source-style", XML_INDEX_SOURCE_STYLE ),
+ TOKEN( "index-source-styles", XML_INDEX_SOURCE_STYLES ),
+ TOKEN( "index-title", XML_INDEX_TITLE ),
+ TOKEN( "index-title-template", XML_INDEX_TITLE_TEMPLATE ),
+ TOKEN( "information", XML_INFORMATION ),
+ TOKEN( "initial-creator", XML_INITIAL_CREATOR ),
+ TOKEN( "inproceedings", XML_INPROCEEDINGS ),
+ TOKEN( "insertion", XML_INSERTION ),
+ TOKEN( "insertion-cut-off", XML_INSERTION_CUT_OFF ),
+ TOKEN( "inset", XML_INSET ),
+ TOKEN( "inside", XML_INSIDE ),
+ TOKEN( "institution", XML_INSTITUTION ),
+ TOKEN( "int", XML_INT ),
+ TOKEN( "intensity", XML_INTENSITY ),
+ TOKEN( "intersect", XML_INTERSECT ),
+ TOKEN( "interval", XML_INTERVAL ),
+ TOKEN( "interval-major", XML_INTERVAL_MAJOR ),
+ TOKEN( "interval-minor", XML_INTERVAL_MINOR ),
+ TOKEN( "into-english-number", XML_INTO_ENGLISH_NUMBER ),
+ TOKEN( "inverse", XML_INVERSE ),
+ TOKEN( "is-active", XML_IS_ACTIVE ),
+ TOKEN( "is-data-layout-field", XML_IS_DATA_LAYOUT_FIELD ),
+ TOKEN( "is-hidden", XML_IS_HIDDEN ),
+ TOKEN( "is-selection", XML_IS_SELECTION ),
+ TOKEN( "isbn", XML_ISBN ),
+ TOKEN( "italic", XML_ITALIC ),
+ TOKEN( "iteration", XML_ITERATION ),
+ TOKEN( "journal", XML_JOURNAL ),
+ TOKEN( "justified", XML_JUSTIFIED ),
+ TOKEN( "justify", XML_JUSTIFY ),
+ TOKEN( "justify-single-word", XML_JUSTIFY_SINGLE_WORD ),
+ TOKEN( "keep-with-next", XML_KEEP_WITH_NEXT ),
+ TOKEN( "normal", XML_KERNING_NORMAL ),
+ TOKEN( "key", XML_KEY ),
+ TOKEN( "key1", XML_KEY1 ),
+ TOKEN( "key2", XML_KEY2 ),
+ TOKEN( "keyword", XML_KEYWORD ),
+ TOKEN( "keywords", XML_KEYWORDS ),
+ TOKEN( "kind", XML_KIND ),
+ TOKEN( "km", XML_KM ),
+ TOKEN( "label", XML_LABEL ),
+ TOKEN( "label-arrangement", XML_LABEL_ARRANGEMENT ),
+ TOKEN( "label-cell-address", XML_LABEL_CELL_ADDRESS ),
+ TOKEN( "label-cell-range-address", XML_LABEL_CELL_RANGE_ADDRESS ),
+ TOKEN( "label-range", XML_LABEL_RANGE ),
+ TOKEN( "label-ranges", XML_LABEL_RANGES ),
+ TOKEN( "lambda", XML_LAMBDA ),
+ TOKEN( "landscape", XML_LANDSCAPE ),
+ TOKEN( "language", XML_LANGUAGE ),
+ TOKEN( "language-asian", XML_LANGUAGE_ASIAN ),
+ TOKEN( "language-complex", XML_LANGUAGE_COMPLEX ),
+ TOKEN( "laser", XML_LASER ),
+ TOKEN( "last-column-spanned", XML_LAST_COLUMN_SPANNED ),
+ TOKEN( "last-page", XML_LAST_PAGE ),
+ TOKEN( "last-row-spanned", XML_LAST_ROW_SPANNED ),
+ TOKEN( "layer", XML_LAYER ),
+ TOKEN( "layer-set", XML_LAYER_SET ),
+ TOKEN( "leader-char", XML_LEADER_CHAR ),
+ TOKEN( "left", XML_LEFT ),
+ TOKEN( "left-outside", XML_LEFT_OUTSIDE ),
+ TOKEN( "left-top-position", XML_LEFT_TOP_POSITION ),
+ TOKEN( "left-arc", XML_LEFTARC ),
+ TOKEN( "left-circle", XML_LEFTCIRCLE ),
+ TOKEN( "legend", XML_LEGEND ),
+ TOKEN( "legend-position", XML_LEGEND_POSITION ),
+ TOKEN( "length", XML_LENGTH ),
+ TOKEN( "leq", XML_LEQ ),
+ TOKEN( "let-text", XML_LET_TEXT ),
+ TOKEN( "keep-text", XML_KEEP_TEXT ),
+ TOKEN( "letter-kerning", XML_LETTER_KERNING ),
+ TOKEN( "letter-spacing", XML_LETTER_SPACING ),
+ TOKEN( "letters", XML_LETTERS ),
+ TOKEN( "level", XML_LEVEL ),
+ TOKEN( "library", XML_LIBRARY ),
+ TOKEN( "library-embedded", XML_LIBRARY_EMBEDDED ),
+ TOKEN( "library-linked", XML_LIBRARY_LINKED ),
+ TOKEN( "light", XML_LIGHT ),
+ TOKEN( "lighting-mode", XML_LIGHTING_MODE ),
+ TOKEN( "lime", XML_LIME ),
+ TOKEN( "limit", XML_LIMIT ),
+ TOKEN( "line", XML_LINE ),
+ TOKEN( "line-break", XML_LINE_BREAK ),
+ TOKEN( "line-distance", XML_LINE_DISTANCE ),
+ TOKEN( "line-height", XML_LINE_HEIGHT ),
+ TOKEN( "line-height-at-least", XML_LINE_HEIGHT_AT_LEAST ),
+ TOKEN( "line-number", XML_LINE_NUMBER ),
+ TOKEN( "line-skew", XML_LINE_SKEW ),
+ TOKEN( "line-spacing", XML_LINE_SPACING ),
+ TOKEN( "line-style", XML_LINE_STYLE ),
+ TOKEN( "linear", XML_LINEAR ),
+ TOKEN( "linenumbering-configuration", XML_LINENUMBERING_CONFIGURATION ),
+ TOKEN( "linenumbering-separator", XML_LINENUMBERING_SEPARATOR ),
+ TOKEN( "lines", XML_LINES ),
+ TOKEN( "lines-used", XML_LINES_USED ),
+ TOKEN( "link-to-source-data", XML_LINK_TO_SOURCE_DATA ),
+ TOKEN( "list", XML_LIST ),
+ TOKEN( "list-block", XML_LIST_BLOCK ),
+ TOKEN( "list-header", XML_LIST_HEADER ),
+ TOKEN( "list-info", XML_LIST_INFO ),
+ TOKEN( "list-item", XML_LIST_ITEM ),
+ TOKEN( "list-level", XML_LIST_LEVEL ),
+ TOKEN( "list-level-style-bullet", XML_LIST_LEVEL_STYLE_BULLET ),
+ TOKEN( "list-level-style-image", XML_LIST_LEVEL_STYLE_IMAGE ),
+ TOKEN( "list-level-style-number", XML_LIST_LEVEL_STYLE_NUMBER ),
+ TOKEN( "list-name", XML_LIST_NAME ),
+ TOKEN( "list-style", XML_LIST_STYLE ),
+ TOKEN( "list-style-name", XML_LIST_STYLE_NAME ),
+ TOKEN( "ln", XML_LN ),
+ TOKEN( "locked", XML_LOCKED ),
+ TOKEN( "log", XML_LOG ),
+ TOKEN( "logarithmic", XML_LOGARITHMIC ),
+ TOKEN( "logbase", XML_LOGBASE ),
+ TOKEN( "long", XML_LONG ),
+ TOKEN( "lowlimit", XML_LOWLIMIT ),
+ TOKEN( "lr-tb", XML_LR_TB ),
+ TOKEN( "lt", XML_LT ),
+ TOKEN( "ltr", XML_LTR ),
+ TOKEN( "luminance", XML_LUMINANCE ),
+ TOKEN( "macro-name", XML_MACRO_NAME ),
+ TOKEN( "maction", XML_MACTION ),
+ TOKEN( "main-entry-style-name", XML_MAIN_ENTRY_STYLE_NAME ),
+ TOKEN( "major", XML_MAJOR ),
+ TOKEN( "maligngroup", XML_MALIGNGROUP ),
+ TOKEN( "malignmark", XML_MALIGNMARK ),
+ TOKEN( "manual", XML_MANUAL ),
+ TOKEN( "map", XML_MAP ),
+ TOKEN( "margin-bottom", XML_MARGIN_BOTTOM ),
+ TOKEN( "margin-left", XML_MARGIN_LEFT ),
+ TOKEN( "margin-right", XML_MARGIN_RIGHT ),
+ TOKEN( "margin-top", XML_MARGIN_TOP ),
+ TOKEN( "margins", XML_MARGINS ),
+ TOKEN( "marker", XML_MARKER ),
+ TOKEN( "marker-end", XML_MARKER_END ),
+ TOKEN( "marker-end-center", XML_MARKER_END_CENTER ),
+ TOKEN( "marker-end-width", XML_MARKER_END_WIDTH ),
+ TOKEN( "marker-start", XML_MARKER_START ),
+ TOKEN( "marker-start-center", XML_MARKER_START_CENTER ),
+ TOKEN( "marker-start-width", XML_MARKER_START_WIDTH ),
+ TOKEN( "maroon", XML_MAROON ),
+ TOKEN( "master-page", XML_MASTER_PAGE ),
+ TOKEN( "master-page-name", XML_MASTER_PAGE_NAME ),
+ TOKEN( "master-styles", XML_MASTER_STYLES ),
+ TOKEN( "mastersthesis", XML_MASTERSTHESIS ),
+ TOKEN( "match", XML_MATCH ),
+ TOKEN( "math", XML_MATH ),
+ TOKEN( "matrix", XML_MATRIX ),
+ TOKEN( "matrix-covered", XML_MATRIX_COVERED ),
+ TOKEN( "matrixrow", XML_MATRIXROW ),
+ TOKEN( "max", XML_MAX ),
+ TOKEN( "max-edge", XML_MAX_EDGE ),
+ TOKEN( "max-height", XML_MAX_HEIGHT ),
+ TOKEN( "max-width", XML_MAX_WIDTH ),
+ TOKEN( "maximum", XML_MAXIMUM ),
+ TOKEN( "maximum-difference", XML_MAXIMUM_DIFFERENCE ),
+ TOKEN( "may-break-between-rows", XML_MAY_BREAK_BETWEEN_ROWS ),
+ TOKEN( "may-script", XML_MAY_SCRIPT ),
+ TOKEN( "mean", XML_MEAN ),
+ TOKEN( "mean-value", XML_MEAN_VALUE ),
+ TOKEN( "measure", XML_MEASURE ),
+ TOKEN( "measure-align", XML_MEASURE_ALIGN ),
+ TOKEN( "measure-vertical-align", XML_MEASURE_VERTICAL_ALIGN ),
+ TOKEN( "median", XML_MEDIAN ),
+ TOKEN( "medium", XML_MEDIUM ),
+ TOKEN( "merror", XML_MERROR ),
+ TOKEN( "message-type", XML_MESSAGE_TYPE ),
+ TOKEN( "meta", XML_META ),
+ TOKEN( "mfenced", XML_MFENCED ),
+ TOKEN( "mfrac", XML_MFRAC ),
+ TOKEN( "mi", XML_MI ),
+ TOKEN( "middle", XML_MIDDLE ),
+ TOKEN( "mime-type", XML_MIME_TYPE ),
+ TOKEN( "min", XML_MIN ),
+ TOKEN( "min-denominator-digits", XML_MIN_DENOMINATOR_DIGITS ),
+ TOKEN( "min-edge", XML_MIN_EDGE ),
+ TOKEN( "min-exponent-digits", XML_MIN_EXPONENT_DIGITS ),
+ TOKEN( "min-height", XML_MIN_HEIGHT ),
+ TOKEN( "min-integer-digits", XML_MIN_INTEGER_DIGITS ),
+ TOKEN( "min-label-distance", XML_MIN_LABEL_DISTANCE ),
+ TOKEN( "min-label-width", XML_MIN_LABEL_WIDTH ),
+ TOKEN( "min-line-height", XML_MIN_LINE_HEIGHT ),
+ TOKEN( "min-numerator-digits", XML_MIN_NUMERATOR_DIGITS ),
+ TOKEN( "min-row-height", XML_MIN_ROW_HEIGHT ),
+ TOKEN( "min-width", XML_MIN_WIDTH ),
+ TOKEN( "minimum", XML_MINIMUM ),
+ TOKEN( "minor", XML_MINOR ),
+ TOKEN( "minus", XML_MINUS ),
+ TOKEN( "minutes", XML_MINUTES ),
+ TOKEN( "mirror", XML_MIRROR ),
+ TOKEN( "mirrored", XML_MIRRORED ),
+ TOKEN( "misc", XML_MISC ),
+ TOKEN( "miter", XML_MITER ),
+ TOKEN( "mm", XML_MM ),
+ TOKEN( "mmultiscripts", XML_MMULTISCRIPTS ),
+ TOKEN( "mn", XML_MN ),
+ TOKEN( "mo", XML_MO ),
+ TOKEN( "mode", XML_MODE ),
+ TOKEN( "modern", XML_MODERN ),
+ TOKEN( "modification-date", XML_MODIFICATION_DATE ),
+ TOKEN( "modification-time", XML_MODIFICATION_TIME ),
+ TOKEN( "modulate", XML_MODULATE ),
+ TOKEN( "module", XML_MODULE ),
+ TOKEN( "moment", XML_MOMENT ),
+ TOKEN( "mono", XML_MONO ),
+ TOKEN( "month", XML_MONTH ),
+ TOKEN( "mouse-as-pen", XML_MOUSE_AS_PEN ),
+ TOKEN( "mouse-visible", XML_MOUSE_VISIBLE ),
+ TOKEN( "move", XML_MOVE ),
+ TOKEN( "move-from-bottom", XML_MOVE_FROM_BOTTOM ),
+ TOKEN( "move-from-left", XML_MOVE_FROM_LEFT ),
+ TOKEN( "move-from-right", XML_MOVE_FROM_RIGHT ),
+ TOKEN( "move-from-top", XML_MOVE_FROM_TOP ),
+ TOKEN( "move-protect", XML_MOVE_PROTECT ),
+ TOKEN( "move-short", XML_MOVE_SHORT ),
+ TOKEN( "movement", XML_MOVEMENT ),
+ TOKEN( "movement-cut-off", XML_MOVEMENT_CUT_OFF ),
+ TOKEN( "mover", XML_MOVER ),
+ TOKEN( "mpadded", XML_MPADDED ),
+ TOKEN( "mphantom", XML_MPHANTOM ),
+ TOKEN( "mprescripts", XML_MPRESCRIPTS ),
+ TOKEN( "mroot", XML_MROOT ),
+ TOKEN( "mrow", XML_MROW ),
+ TOKEN( "ms", XML_MS ),
+ TOKEN( "mspace", XML_MSPACE ),
+ TOKEN( "msqrt", XML_MSQRT ),
+ TOKEN( "mstyle", XML_MSTYLE ),
+ TOKEN( "msub", XML_MSUB ),
+ TOKEN( "msubsup", XML_MSUBSUP ),
+ TOKEN( "msup", XML_MSUP ),
+ TOKEN( "mtable", XML_MTABLE ),
+ TOKEN( "mtd", XML_MTD ),
+ TOKEN( "mtext", XML_MTEXT ),
+ TOKEN( "mtr", XML_MTR ),
+ TOKEN( "multi-deletion-spanned", XML_MULTI_DELETION_SPANNED ),
+ TOKEN( "munder", XML_MUNDER ),
+ TOKEN( "munderover", XML_MUNDEROVER ),
+ TOKEN( "name", XML_NAME ),
+ TOKEN( "name-and-extension", XML_NAME_AND_EXTENSION ),
+ TOKEN( "named-expression", XML_NAMED_EXPRESSION ),
+ TOKEN( "named-expressions", XML_NAMED_EXPRESSIONS ),
+ TOKEN( "named-range", XML_NAMED_RANGE ),
+ TOKEN( "navy", XML_NAVY ),
+ TOKEN( "neq", XML_NEQ ),
+ TOKEN( "new", XML_NEW ),
+ TOKEN( "next", XML_NEXT ),
+ TOKEN( "next-page", XML_NEXT_PAGE ),
+ TOKEN( "next-style-name", XML_NEXT_STYLE_NAME ),
+ TOKEN( "no-limit", XML_NO_LIMIT ),
+ TOKEN( "no-wrap", XML_NO_WRAP ),
+ TOKEN( "!empty", XML_NOEMPTY ),
+ TOKEN( "nohref", XML_NOHREF ),
+ TOKEN( "!match", XML_NOMATCH ),
+ TOKEN( "none", XML_NONE ),
+ TOKEN( "notprsubset", XML_NOPRTSUBSET ),
+ TOKEN( "normal", XML_NORMAL ),
+ TOKEN( "normals-direction", XML_NORMALS_DIRECTION ),
+ TOKEN( "normals-kind", XML_NORMALS_KIND ),
+ TOKEN( "not", XML_NOT ),
+ TOKEN( "not-equal-date", XML_NOT_EQUAL_DATE ),
+ TOKEN( "note", XML_NOTE ),
+ TOKEN( "notes", XML_NOTES ),
+ TOKEN( "notin", XML_NOTIN ),
+ TOKEN( "notsubset", XML_NOTSUBSET ),
+ TOKEN( "null-date", XML_NULL_DATE ),
+ TOKEN( "null-year", XML_NULL_YEAR ),
+ TOKEN( "num-format", XML_NUM_FORMAT ),
+ TOKEN( "num-letter-sync", XML_NUM_LETTER_SYNC ),
+ TOKEN( "num-prefix", XML_NUM_PREFIX ),
+ TOKEN( "num-suffix", XML_NUM_SUFFIX ),
+ TOKEN( "number", XML_NUMBER ),
+ TOKEN( "number-and-name", XML_NUMBER_AND_NAME ),
+ TOKEN( "number-columns-repeated", XML_NUMBER_COLUMNS_REPEATED ),
+ TOKEN( "number-columns-spanned", XML_NUMBER_COLUMNS_SPANNED ),
+ TOKEN( "number-lines", XML_NUMBER_LINES ),
+ TOKEN( "number-matrix-columns-spanned", XML_NUMBER_MATRIX_COLUMNS_SPANNED ),
+ TOKEN( "number-matrix-rows-spanned", XML_NUMBER_MATRIX_ROWS_SPANNED ),
+ TOKEN( "number-position", XML_NUMBER_POSITION ),
+ TOKEN( "number-rows-repeated", XML_NUMBER_ROWS_REPEATED ),
+ TOKEN( "number-rows-spanned", XML_NUMBER_ROWS_SPANNED ),
+ TOKEN( "number-style", XML_NUMBER_STYLE ),
+ TOKEN( "number-wrapped-paragraphs", XML_NUMBER_WRAPPED_PARAGRAPHS ),
+ TOKEN( "numbered-entries", XML_NUMBERED_ENTRIES ),
+ TOKEN( "object", XML_OBJECT ),
+ TOKEN( "object-count", XML_OBJECT_COUNT ),
+ TOKEN( "object-index", XML_OBJECT_INDEX ),
+ TOKEN( "object-index-entry-template", XML_OBJECT_INDEX_ENTRY_TEMPLATE ),
+ TOKEN( "object-index-source", XML_OBJECT_INDEX_SOURCE ),
+ TOKEN( "object-name", XML_OBJECT_NAME ),
+ TOKEN( "object-ole", XML_OBJECT_OLE ),
+ TOKEN( "objects", XML_OBJECTS ),
+ TOKEN( "odd-page", XML_ODD_PAGE ),
+ TOKEN( "offset", XML_OFFSET ),
+ TOKEN( "olive", XML_OLIVE ),
+ TOKEN( "onLoad", XML_ONLOAD ),
+ TOKEN( "onRequest", XML_ONREQUEST ),
+ TOKEN( "on-update-keep-size", XML_ON_UPDATE_KEEP_SIZE ),
+ TOKEN( "on-update-keep-styles", XML_ON_UPDATE_KEEP_STYLES ),
+ TOKEN( "online", XML_ONLINE ),
+ TOKEN( "online-text", XML_ONLINE_TEXT ),
+ TOKEN( "background", XML_OPAQUE_BACKGROUND ),
+ TOKEN( "foreground", XML_OPAQUE_FOREGROUND ),
+ TOKEN( "open", XML_OPEN ),
+ TOKEN( "open-horizontal", XML_OPEN_HORIZONTAL ),
+ TOKEN( "open-vertical", XML_OPEN_VERTICAL ),
+ TOKEN( "operation", XML_OPERATION ),
+ TOKEN( "operator", XML_OPERATOR ),
+ TOKEN( "optimal", XML_OPTIMAL ),
+ TOKEN( "or", XML_OR ),
+ TOKEN( "order", XML_ORDER ),
+ TOKEN( "ordered-list", XML_ORDERED_LIST ),
+ TOKEN( "organizations", XML_ORGANIZATIONS ),
+ TOKEN( "orientation", XML_ORIENTATION ),
+ TOKEN( "orientation-landscape", XML_ORIENTATION_LANDSCAPE ),
+ TOKEN( "orientation-portrait", XML_ORIENTATION_PORTRAIT ),
+ TOKEN( "origin", XML_ORIGIN ),
+ TOKEN( "orphans", XML_ORPHANS ),
+ TOKEN( "outline-level", XML_OUTLINE_LEVEL ),
+ TOKEN( "outline-level-style", XML_OUTLINE_LEVEL_STYLE ),
+ TOKEN( "outline-style", XML_OUTLINE_STYLE ),
+ TOKEN( "outset", XML_OUTSET ),
+ TOKEN( "outside", XML_OUTSIDE ),
+ TOKEN( "overlap", XML_OVERLAP ),
+ TOKEN( "p", XML_P ),
+ TOKEN( "package-name", XML_PACKAGE_NAME ),
+ TOKEN( "padding", XML_PADDING ),
+ TOKEN( "padding-bottom", XML_PADDING_BOTTOM ),
+ TOKEN( "padding-left", XML_PADDING_LEFT ),
+ TOKEN( "padding-right", XML_PADDING_RIGHT ),
+ TOKEN( "padding-top", XML_PADDING_TOP ),
+ TOKEN( "page", XML_PAGE ),
+ TOKEN( "page-adjust", XML_PAGE_ADJUST ),
+ TOKEN( "page-breaks-on-group-change", XML_PAGE_BREAKS_ON_GROUP_CHANGE ),
+ TOKEN( "page-content", XML_PAGE_CONTENT ),
+ TOKEN( "page-continuation-string", XML_PAGE_CONTINUATION_STRING ),
+ TOKEN( "page-count", XML_PAGE_COUNT ),
+ TOKEN( "page-end-margin", XML_PAGE_END_MARGIN ),
+ TOKEN( "page-height", XML_PAGE_HEIGHT ),
+ TOKEN( "page-master", XML_PAGE_MASTER ),
+ TOKEN( "page-master-name", XML_PAGE_MASTER_NAME ),
+ TOKEN( "page-number", XML_PAGE_NUMBER ),
+ TOKEN( "page-start-margin", XML_PAGE_START_MARGIN ),
+ TOKEN( "page-style-name", XML_PAGE_STYLE_NAME ),
+ TOKEN( "page-thumbnail", XML_PAGE_THUMBNAIL ),
+ TOKEN( "page-usage", XML_PAGE_USAGE ),
+ TOKEN( "page-variable-get", XML_PAGE_VARIABLE_GET ),
+ TOKEN( "page-variable-set", XML_PAGE_VARIABLE_SET ),
+ TOKEN( "page-view-zoom-value", XML_PAGE_VIEW_ZOOM_VALUE ),
+ TOKEN( "page-width", XML_PAGE_WIDTH ),
+ TOKEN( "pages", XML_PAGES ),
+ TOKEN( "paper-tray-number", XML_PAPER_TRAY_NUMBER ),
+ TOKEN( "paragraph", XML_PARAGRAPH ),
+ TOKEN( "paragraph-content", XML_PARAGRAPH_CONTENT ),
+ TOKEN( "paragraph-count", XML_PARAGRAPH_COUNT ),
+ TOKEN( "paragraph-end-margin", XML_PARAGRAPH_END_MARGIN ),
+ TOKEN( "paragraph-start-margin", XML_PARAGRAPH_START_MARGIN ),
+ TOKEN( "parallel", XML_PARALLEL ),
+ TOKEN( "param", XML_PARAM ),
+ TOKEN( "parent-style-name", XML_PARENT_STYLE_NAME ),
+ TOKEN( "parse-sql-statement", XML_PARSE_SQL_STATEMENT ),
+ TOKEN( "parsed", XML_PARSED ),
+ TOKEN( "partialdiff", XML_PARTIALDIFF ),
+ TOKEN( "password", XML_PASSWORD ),
+ TOKEN( "passwort", XML_PASSWORT ),
+ TOKEN( "path", XML_PATH ),
+ TOKEN( "path-id", XML_PATH_ID ),
+ TOKEN( "pause", XML_PAUSE ),
+ TOKEN( "pending", XML_PENDING ),
+ TOKEN( "percentage", XML_PERCENTAGE ),
+ TOKEN( "percentage-style", XML_PERCENTAGE_STYLE ),
+ TOKEN( "perspective", XML_PERSPECTIVE ),
+ TOKEN( "phdthesis", XML_PHDTHESIS ),
+ TOKEN( "phong", XML_PHONG ),
+ TOKEN( "pie-offset", XML_PIE_OFFSET ),
+ TOKEN( "placeholder", XML_PLACEHOLDER ),
+ TOKEN( "placeholder-type", XML_PLACEHOLDER_TYPE ),
+ TOKEN( "placing", XML_PLACING ),
+ TOKEN( "plain-number", XML_PLAIN_NUMBER ),
+ TOKEN( "plain-number-and-name", XML_PLAIN_NUMBER_AND_NAME ),
+ TOKEN( "play-full", XML_PLAY_FULL ),
+ TOKEN( "plot-area", XML_PLOT_AREA ),
+ TOKEN( "plugin", XML_PLUGIN ),
+ TOKEN( "plus", XML_PLUS ),
+ TOKEN( "points", XML_POINTS ),
+ TOKEN( "polygon", XML_POLYGON ),
+ TOKEN( "polyline", XML_POLYLINE ),
+ TOKEN( "polynomial", XML_POLYNOMIAL ),
+ TOKEN( "pool-id", XML_POOL_ID ),
+ TOKEN( "portrait", XML_PORTRAIT ),
+ TOKEN( "position", XML_POSITION ),
+ TOKEN( "position-bottom", XML_POSITION_BOTTOM ),
+ TOKEN( "position-left", XML_POSITION_LEFT ),
+ TOKEN( "position-right", XML_POSITION_RIGHT ),
+ TOKEN( "position-top", XML_POSITION_TOP ),
+ TOKEN( "italic", XML_POSTURE_ITALIC ),
+ TOKEN( "normal", XML_POSTURE_NORMAL ),
+ TOKEN( "oblique", XML_POSTURE_OBLIQUE ),
+ TOKEN( "power", XML_POWER ),
+ TOKEN( "precision-as-shown", XML_PRECISION_AS_SHOWN ),
+ TOKEN( "prefix", XML_PREFIX ),
+ TOKEN( "presentation", XML_PRESENTATION ),
+ TOKEN( "chart", XML_PRESENTATION_CHART ),
+ TOKEN( "graphic", XML_PRESENTATION_GRAPHIC ),
+ TOKEN( "notes", XML_PRESENTATION_NOTES ),
+ TOKEN( "object", XML_PRESENTATION_OBJECT ),
+ TOKEN( "orgchart", XML_PRESENTATION_ORGCHART ),
+ TOKEN( "outline", XML_PRESENTATION_OUTLINE ),
+ TOKEN( "page", XML_PRESENTATION_PAGE ),
+ TOKEN( "presentation-page-layout", XML_PRESENTATION_PAGE_LAYOUT ),
+ TOKEN( "presentation-page-layout-name", XML_PRESENTATION_PAGE_LAYOUT_NAME ),
+ TOKEN( "subtitle", XML_PRESENTATION_SUBTITLE ),
+ TOKEN( "table", XML_PRESENTATION_TABLE ),
+ TOKEN( "title", XML_PRESENTATION_TITLE ),
+ TOKEN( "previous", XML_PREVIOUS ),
+ TOKEN( "previous-page", XML_PREVIOUS_PAGE ),
+ TOKEN( "print", XML_PRINT ),
+ TOKEN( "print-content", XML_PRINT_CONTENT ),
+ TOKEN( "print-date", XML_PRINT_DATE ),
+ TOKEN( "print-orientation", XML_PRINT_ORIENTATION ),
+ TOKEN( "print-page-order", XML_PRINT_PAGE_ORDER ),
+ TOKEN( "print-range", XML_PRINT_RANGE ),
+ TOKEN( "print-ranges", XML_PRINT_RANGES ),
+ TOKEN( "print-time", XML_PRINT_TIME ),
+ TOKEN( "printable", XML_PRINTABLE ),
+ TOKEN( "printed-by", XML_PRINTED_BY ),
+ TOKEN( "proceedings", XML_PROCEEDINGS ),
+ TOKEN( "product", XML_PRODUCT ),
+ TOKEN( "projection", XML_PROJECTION ),
+ TOKEN( "properties", XML_PROPERTIES ),
+ TOKEN( "protect", XML_PROTECT ),
+ TOKEN( "content", XML_PROTECT_CONTENT ),
+ TOKEN( "position", XML_PROTECT_POSITION ),
+ TOKEN( "size", XML_PROTECT_SIZE ),
+ TOKEN( "protected", XML_PROTECTED ),
+ TOKEN( "protection-key", XML_PROTECTION_KEY ),
+ TOKEN( "protection-key-digest-algorithm", XML_PROTECTION_KEY_DIGEST_ALGORITHM ),
+ TOKEN( "protection-key-digest-algorithm-2", XML_PROTECTION_KEY_DIGEST_ALGORITHM_2 ),
+ TOKEN( "prsubset", XML_PRSUBSET ),
+ TOKEN( "publisher", XML_PUBLISHER ),
+ TOKEN( "punctuation-wrap", XML_PUNCTUATION_WRAP ),
+ TOKEN( "purple", XML_PURPLE ),
+ TOKEN( "pyramid", XML_PYRAMID ),
+ TOKEN( "quarter", XML_QUARTER ),
+ TOKEN( "query-name", XML_QUERY_NAME ),
+ TOKEN( "quo-vadis", XML_QUO_VADIS ),
+ TOKEN( "quotient", XML_QUOTIENT ),
+ TOKEN( "r", XML_R ),
+ TOKEN( "radar", XML_RADAR ),
+ TOKEN( "random", XML_RANDOM ),
+ TOKEN( "range-address", XML_RANGE_ADDRESS ),
+ TOKEN( "range-usable-as", XML_RANGE_USABLE_AS ),
+ TOKEN( "recreate-on-edit", XML_RECREATE_ON_EDIT ),
+ TOKEN( "rect", XML_RECT ),
+ TOKEN( "red", XML_RED ),
+ TOKEN( "ref-name", XML_REF_NAME ),
+ TOKEN( "reference", XML_REFERENCE ),
+ TOKEN( "reference-end", XML_REFERENCE_END ),
+ TOKEN( "reference-format", XML_REFERENCE_FORMAT ),
+ TOKEN( "reference-mark", XML_REFERENCE_MARK ),
+ TOKEN( "reference-mark-end", XML_REFERENCE_MARK_END ),
+ TOKEN( "reference-mark-start", XML_REFERENCE_MARK_START ),
+ TOKEN( "reference-ref", XML_REFERENCE_REF ),
+ TOKEN( "reference-start", XML_REFERENCE_START ),
+ TOKEN( "reference-type", XML_REFERENCE_TYPE ),
+ TOKEN( "refresh-delay", XML_REFRESH_DELAY ),
+ TOKEN( "region-center", XML_REGION_CENTER ),
+ TOKEN( "region-left", XML_REGION_LEFT ),
+ TOKEN( "region-right", XML_REGION_RIGHT ),
+ TOKEN( "register-true", XML_REGISTER_TRUE ),
+ TOKEN( "register-truth-ref-style-name", XML_REGISTER_TRUTH_REF_STYLE_NAME ),
+ TOKEN( "regression-type", XML_REGRESSION_TYPE ),
+ TOKEN( "rejected", XML_REJECTED ),
+ TOKEN( "rejecting-change-id", XML_REJECTING_CHANGE_ID ),
+ TOKEN( "rejection", XML_REJECTION ),
+ TOKEN( "rel-column-width", XML_REL_COLUMN_WIDTH ),
+ TOKEN( "rel-height", XML_REL_HEIGHT ),
+ TOKEN( "rel-width", XML_REL_WIDTH ),
+ TOKEN( "relative", XML_RELATIVE ),
+ TOKEN( "relative-tab-stop-position", XML_RELATIVE_TAB_STOP_POSITION ),
+ TOKEN( "reln", XML_RELN ),
+ TOKEN( "rem", XML_REM ),
+ TOKEN( "remove-dependents", XML_REMOVE_DEPENDENTS ),
+ TOKEN( "remove-precedents", XML_REMOVE_PRECEDENTS ),
+ TOKEN( "repeat", XML_REPEAT ),
+ TOKEN( "repeat-column", XML_REPEAT_COLUMN ),
+ TOKEN( "repeat-row", XML_REPEAT_ROW ),
+ TOKEN( "repeated", XML_REPEATED ),
+ TOKEN( "replace", XML_REPLACE ),
+ TOKEN( "report-type", XML_REPORT_TYPE ),
+ TOKEN( "restart-on-page", XML_RESTART_ON_PAGE ),
+ TOKEN( "revision", XML_REVISION ),
+ TOKEN( "ridge", XML_RIDGE ),
+ TOKEN( "right", XML_RIGHT ),
+ TOKEN( "right-outside", XML_RIGHT_OUTSIDE ),
+ TOKEN( "right-arc", XML_RIGHTARC ),
+ TOKEN( "right-circle", XML_RIGHTCIRCLE ),
+ TOKEN( "ring", XML_RING ),
+ TOKEN( "role", XML_ROLE ),
+ TOKEN( "roll-from-bottom", XML_ROLL_FROM_BOTTOM ),
+ TOKEN( "roll-from-left", XML_ROLL_FROM_LEFT ),
+ TOKEN( "roll-from-right", XML_ROLL_FROM_RIGHT ),
+ TOKEN( "roman", XML_ROMAN ),
+ TOKEN( "root", XML_ROOT ),
+ TOKEN( "rotate", XML_ROTATE ),
+ TOKEN( "rotation", XML_ROTATION ),
+ TOKEN( "rotation-align", XML_ROTATION_ALIGN ),
+ TOKEN( "rotation-angle", XML_ROTATION_ANGLE ),
+ TOKEN( "round", XML_ROUND ),
+ TOKEN( "row", XML_ROW ),
+ TOKEN( "row-height", XML_ROW_HEIGHT ),
+ TOKEN( "row-number", XML_ROW_NUMBER ),
+ TOKEN( "rows", XML_ROWS ),
+ TOKEN( "ruby", XML_RUBY ),
+ TOKEN( "ruby-align", XML_RUBY_ALIGN ),
+ TOKEN( "ruby-base", XML_RUBY_BASE ),
+ TOKEN( "ruby-position", XML_RUBY_POSITION ),
+ TOKEN( "ruby-text", XML_RUBY_TEXT ),
+ TOKEN( "run-through", XML_RUN_THROUGH ),
+ TOKEN( "rx", XML_RX ),
+ TOKEN( "ry", XML_RY ),
+ TOKEN( "s", XML_S ),
+ TOKEN( "scale", XML_SCALE ),
+ TOKEN( "scale-min", XML_SCALE_MIN ),
+ TOKEN( "scale-text", XML_SCALE_TEXT ),
+ TOKEN( "scale-to", XML_SCALE_TO ),
+ TOKEN( "scale-to-pages", XML_SCALE_TO_PAGES ),
+ TOKEN( "scatter", XML_SCATTER ),
+ TOKEN( "scenario", XML_SCENARIO ),
+ TOKEN( "scenario-ranges", XML_SCENARIO_RANGES ),
+ TOKEN( "scene", XML_SCENE ),
+ TOKEN( "school", XML_SCHOOL ),
+ TOKEN( "scientific-number", XML_SCIENTIFIC_NUMBER ),
+ TOKEN( "score-spaces", XML_SCORE_SPACES ),
+ TOKEN( "script", XML_SCRIPT ),
+ TOKEN( "scroll", XML_SCROLL ),
+ TOKEN( "sdev", XML_SDEV ),
+ TOKEN( "search-criteria-must-apply-to-whole-cell", XML_SEARCH_CRITERIA_MUST_APPLY_TO_WHOLE_CELL ),
+ TOKEN( "sec", XML_SEC ),
+ TOKEN( "sech", XML_SECH ),
+ TOKEN( "second-date-time", XML_SECOND_DATE_TIME ),
+ TOKEN( "seconds", XML_SECONDS ),
+ TOKEN( "section", XML_SECTION ),
+ TOKEN( "section-desc", XML_SECTION_DESC ),
+ TOKEN( "section-name", XML_SECTION_NAME ),
+ TOKEN( "section-source", XML_SECTION_SOURCE ),
+ TOKEN( "select-page", XML_SELECT_PAGE ),
+ TOKEN( "select-protected-cells", XML_SELECT_PROTECTED_CELLS ),
+ TOKEN( "select-unprotected-cells", XML_SELECT_UNPROTECTED_CELLS ),
+ TOKEN( "selector", XML_SELECTOR ),
+ TOKEN( "semantics", XML_SEMANTICS ),
+ TOKEN( "semi-automatic", XML_SEMI_AUTOMATIC ),
+ TOKEN( "sender-city", XML_SENDER_CITY ),
+ TOKEN( "sender-company", XML_SENDER_COMPANY ),
+ TOKEN( "sender-country", XML_SENDER_COUNTRY ),
+ TOKEN( "sender-email", XML_SENDER_EMAIL ),
+ TOKEN( "sender-fax", XML_SENDER_FAX ),
+ TOKEN( "sender-firstname", XML_SENDER_FIRSTNAME ),
+ TOKEN( "sender-initials", XML_SENDER_INITIALS ),
+ TOKEN( "sender-lastname", XML_SENDER_LASTNAME ),
+ TOKEN( "sender-phone-private", XML_SENDER_PHONE_PRIVATE ),
+ TOKEN( "sender-phone-work", XML_SENDER_PHONE_WORK ),
+ TOKEN( "sender-position", XML_SENDER_POSITION ),
+ TOKEN( "sender-postal-code", XML_SENDER_POSTAL_CODE ),
+ TOKEN( "sender-state-or-province", XML_SENDER_STATE_OR_PROVINCE ),
+ TOKEN( "sender-street", XML_SENDER_STREET ),
+ TOKEN( "sender-title", XML_SENDER_TITLE ),
+ TOKEN( "sep", XML_SEP ),
+ TOKEN( "separation-character", XML_SEPARATION_CHARACTER ),
+ TOKEN( "separator", XML_SEPARATOR ),
+ TOKEN( "sequence", XML_SEQUENCE ),
+ TOKEN( "sequence-decl", XML_SEQUENCE_DECL ),
+ TOKEN( "sequence-decls", XML_SEQUENCE_DECLS ),
+ TOKEN( "sequence-ref", XML_SEQUENCE_REF ),
+ TOKEN( "series", XML_SERIES ),
+ TOKEN( "series-source", XML_SERIES_SOURCE ),
+ TOKEN( "server-map", XML_SERVER_MAP ),
+ TOKEN( "set", XML_SET ),
+ TOKEN( "setdiff", XML_SETDIFF ),
+ TOKEN( "settings", XML_SETTINGS ),
+ TOKEN( "shade-mode", XML_SHADE_MODE ),
+ TOKEN( "shadow", XML_SHADOW ),
+ TOKEN( "shadow-color", XML_SHADOW_COLOR ),
+ TOKEN( "shadow-offset-x", XML_SHADOW_OFFSET_X ),
+ TOKEN( "shadow-offset-y", XML_SHADOW_OFFSET_Y ),
+ TOKEN( "shadow-slant", XML_SHADOW_SLANT ),
+ TOKEN( "shadow-transparency", XML_SHADOW_TRANSPARENCY ),
+ TOKEN( "shape", XML_SHAPE ),
+ TOKEN( "shape-id", XML_SHAPE_ID ),
+ TOKEN( "shapes", XML_SHAPES ),
+ TOKEN( "sheet-name", XML_SHEET_NAME ),
+ TOKEN( "shininess", XML_SHININESS ),
+ TOKEN( "short", XML_SHORT ),
+ TOKEN( "show", XML_SHOW ),
+ TOKEN( "show-accepted-changes", XML_SHOW_ACCEPTED_CHANGES ),
+ TOKEN( "show-changes", XML_SHOW_CHANGES ),
+ TOKEN( "show-changes-by-author", XML_SHOW_CHANGES_BY_AUTHOR ),
+ TOKEN( "show-changes-by-author-name", XML_SHOW_CHANGES_BY_AUTHOR_NAME ),
+ TOKEN( "show-changes-by-comment", XML_SHOW_CHANGES_BY_COMMENT ),
+ TOKEN( "show-changes-by-comment-text", XML_SHOW_CHANGES_BY_COMMENT_TEXT ),
+ TOKEN( "show-changes-by-datetime", XML_SHOW_CHANGES_BY_DATETIME ),
+ TOKEN( "show-changes-by-datetime-first-datetime", XML_SHOW_CHANGES_BY_DATETIME_FIRST_DATETIME ),
+ TOKEN( "show-changes-by-datetime-mode", XML_SHOW_CHANGES_BY_DATETIME_MODE ),
+ TOKEN( "show-changes-by-datetime-second-datetime", XML_SHOW_CHANGES_BY_DATETIME_SECOND_DATETIME ),
+ TOKEN( "show-changes-by-ranges", XML_SHOW_CHANGES_BY_RANGES ),
+ TOKEN( "show-changes-by-ranges-list", XML_SHOW_CHANGES_BY_RANGES_LIST ),
+ TOKEN( "show-logo", XML_SHOW_LOGO ),
+ TOKEN( "show-rejected-changes", XML_SHOW_REJECTED_CHANGES ),
+ TOKEN( "show-shape", XML_SHOW_SHAPE ),
+ TOKEN( "show-text", XML_SHOW_TEXT ),
+ TOKEN( "show-unit", XML_SHOW_UNIT ),
+ TOKEN( "shows", XML_SHOWS ),
+ TOKEN( "side-by-side", XML_SIDE_BY_SIDE ),
+ TOKEN( "silver", XML_SILVER ),
+ TOKEN( "simple", XML_SIMPLE ),
+ TOKEN( "sin", XML_SIN ),
+ TOKEN( "since-date-time", XML_SINCE_DATE_TIME ),
+ TOKEN( "since-save", XML_SINCE_SAVE ),
+ TOKEN( "sinh", XML_SINH ),
+ TOKEN( "size", XML_SIZE ),
+ TOKEN( "size-protect", XML_SIZE_PROTECT ),
+ TOKEN( "slant", XML_SLANT ),
+ TOKEN( "slant-x", XML_SLANT_X ),
+ TOKEN( "slant-y", XML_SLANT_Y ),
+ TOKEN( "slide", XML_SLIDE ),
+ TOKEN( "slow", XML_SLOW ),
+ TOKEN( "solid", XML_SOLID ),
+ TOKEN( "solid-type", XML_SOLID_TYPE ),
+ TOKEN( "sort", XML_SORT ),
+ TOKEN( "sort-ascending", XML_SORT_ASCENDING ),
+ TOKEN( "sort-by", XML_SORT_BY ),
+ TOKEN( "sort-by-position", XML_SORT_BY_POSITION ),
+ TOKEN( "sort-groups", XML_SORT_GROUPS ),
+ TOKEN( "sort-key", XML_SORT_KEY ),
+ TOKEN( "sound", XML_SOUND ),
+ TOKEN( "source-cell-range", XML_SOURCE_CELL_RANGE ),
+ TOKEN( "source-cell-range-addresses", XML_SOURCE_CELL_RANGE_ADDRESSES ),
+ TOKEN( "source-field-name", XML_SOURCE_FIELD_NAME ),
+ TOKEN( "source-name", XML_SOURCE_NAME ),
+ TOKEN( "source-range-address", XML_SOURCE_RANGE_ADDRESS ),
+ TOKEN( "source-service", XML_SOURCE_SERVICE ),
+ TOKEN( "space-before", XML_SPACE_BEFORE ),
+ TOKEN( "span", XML_SPAN ),
+ TOKEN( "specular", XML_SPECULAR ),
+ TOKEN( "specular-color", XML_SPECULAR_COLOR ),
+ TOKEN( "speed", XML_SPEED ),
+ TOKEN( "sphere", XML_SPHERE ),
+ TOKEN( "spiral", XML_SPIRAL ),
+ TOKEN( "spiral-in", XML_SPIRAL_IN ),
+ TOKEN( "spiral-inward-left", XML_SPIRAL_INWARD_LEFT ),
+ TOKEN( "spiral-inward-right", XML_SPIRAL_INWARD_RIGHT ),
+ TOKEN( "spiral-out", XML_SPIRAL_OUT ),
+ TOKEN( "spiral-outward-left", XML_SPIRAL_OUTWARD_LEFT ),
+ TOKEN( "spiral-outward-right", XML_SPIRAL_OUTWARD_RIGHT ),
+ TOKEN( "spiralin-left", XML_SPIRALIN_LEFT ),
+ TOKEN( "spiralin-right", XML_SPIRALIN_RIGHT ),
+ TOKEN( "spiralout-left", XML_SPIRALOUT_LEFT ),
+ TOKEN( "spiralout-right", XML_SPIRALOUT_RIGHT ),
+ TOKEN( "splines", XML_SPLINES ),
+ TOKEN( "split", XML_SPLIT ),
+ TOKEN( "split-column", XML_SPLIT_COLUMN ),
+ TOKEN( "split-position", XML_SPLIT_POSITION ),
+ TOKEN( "split-row", XML_SPLIT_ROW ),
+ TOKEN( "spreadsheet", XML_SPREADSHEET ),
+ TOKEN( "sql-statement", XML_SQL_STATEMENT ),
+ TOKEN( "stacked", XML_STACKED ),
+ TOKEN( "stagger-even", XML_STAGGER_EVEN ),
+ TOKEN( "stagger-odd", XML_STAGGER_ODD ),
+ TOKEN( "standard", XML_STANDARD ),
+ TOKEN( "standard-deviation", XML_STANDARD_DEVIATION ),
+ TOKEN( "starbasic", XML_STARBASIC ),
+ TOKEN( "start", XML_START ),
+ TOKEN( "start-angle", XML_START_ANGLE ),
+ TOKEN( "start-color", XML_START_COLOR ),
+ TOKEN( "start-column", XML_START_COLUMN ),
+ TOKEN( "start-glue-point", XML_START_GLUE_POINT ),
+ TOKEN( "start-guide", XML_START_GUIDE ),
+ TOKEN( "start-intensity", XML_START_INTENSITY ),
+ TOKEN( "start-line-spacing-horizontal", XML_START_LINE_SPACING_HORIZONTAL ),
+ TOKEN( "start-line-spacing-vertical", XML_START_LINE_SPACING_VERTICAL ),
+ TOKEN( "start-numbering-at", XML_START_NUMBERING_AT ),
+ TOKEN( "start-page", XML_START_PAGE ),
+ TOKEN( "start-position", XML_START_POSITION ),
+ TOKEN( "start-row", XML_START_ROW ),
+ TOKEN( "start-scale", XML_START_SCALE ),
+ TOKEN( "start-shape", XML_START_SHAPE ),
+ TOKEN( "start-table", XML_START_TABLE ),
+ TOKEN( "start-value", XML_START_VALUE ),
+ TOKEN( "start-with-navigator", XML_START_WITH_NAVIGATOR ),
+ TOKEN( "statistics", XML_STATISTICS ),
+ TOKEN( "status", XML_STATUS ),
+ TOKEN( "stay-on-top", XML_STAY_ON_TOP ),
+ TOKEN( "stdev", XML_STDEV ),
+ TOKEN( "stdevp", XML_STDEVP ),
+ TOKEN( "steps", XML_STEPS ),
+ TOKEN( "stock", XML_STOCK ),
+ TOKEN( "stock-updown-bars", XML_STOCK_UPDOWN_BARS ),
+ TOKEN( "stock-with-volume", XML_STOCK_WITH_VOLUME ),
+ TOKEN( "stop", XML_STOP ),
+ TOKEN( "stretch", XML_STRETCH ),
+ TOKEN( "stretch-from-bottom", XML_STRETCH_FROM_BOTTOM ),
+ TOKEN( "stretch-from-left", XML_STRETCH_FROM_LEFT ),
+ TOKEN( "stretch-from-right", XML_STRETCH_FROM_RIGHT ),
+ TOKEN( "stretch-from-top", XML_STRETCH_FROM_TOP ),
+ TOKEN( "stretchy", XML_STRETCHY ),
+ TOKEN( "strict", XML_STRICT ),
+ TOKEN( "string", XML_STRING ),
+ TOKEN( "string-value", XML_STRING_VALUE ),
+ TOKEN( "string-value-if-false", XML_STRING_VALUE_IF_FALSE ),
+ TOKEN( "string-value-if-true", XML_STRING_VALUE_IF_TRUE ),
+ TOKEN( "stripes", XML_STRIPES ),
+ TOKEN( "stroke", XML_STROKE ),
+ TOKEN( "stroke-color", XML_STROKE_COLOR ),
+ TOKEN( "stroke-dash", XML_STROKE_DASH ),
+ TOKEN( "stroke-linejoin", XML_STROKE_LINEJOIN ),
+ TOKEN( "stroke-opacity", XML_STROKE_OPACITY ),
+ TOKEN( "stroke-width", XML_STROKE_WIDTH ),
+ TOKEN( "structure-protected", XML_STRUCTURE_PROTECTED ),
+ TOKEN( "style", XML_STYLE ),
+ TOKEN( "style-name", XML_STYLE_NAME ),
+ TOKEN( "styles", XML_STYLES ),
+ TOKEN( "stylesheet", XML_STYLESHEET ),
+ TOKEN( "sub-table", XML_SUB_TABLE ),
+ TOKEN( "subject", XML_SUBJECT ),
+ TOKEN( "subset", XML_SUBSET ),
+ TOKEN( "subtitle", XML_SUBTITLE ),
+ TOKEN( "subtotal-field", XML_SUBTOTAL_FIELD ),
+ TOKEN( "subtotal-rule", XML_SUBTOTAL_RULE ),
+ TOKEN( "subtotal-rules", XML_SUBTOTAL_RULES ),
+ TOKEN( "suffix", XML_SUFFIX ),
+ TOKEN( "sum", XML_SUM ),
+ TOKEN( "swiss", XML_SWISS ),
+ TOKEN( "symbol", XML_SYMBOL ),
+ TOKEN( "symbol-height", XML_SYMBOL_HEIGHT ),
+ TOKEN( "symbol-image-name", XML_SYMBOL_IMAGE_NAME ),
+ TOKEN( "symbol-width", XML_SYMBOL_WIDTH ),
+ TOKEN( "system", XML_SYSTEM ),
+ TOKEN( "tab-color", XML_TAB_COLOR ),
+ TOKEN( "tab-stop", XML_TAB_STOP ),
+ TOKEN( "tab-stop-distance", XML_TAB_STOP_DISTANCE ),
+ TOKEN( "tab-stops", XML_TAB_STOPS ),
+ TOKEN( "table", XML_TABLE ),
+ TOKEN( "table-background", XML_TABLE_BACKGROUND ),
+ TOKEN( "table-cell", XML_TABLE_CELL ),
+ TOKEN( "table-centering", XML_TABLE_CENTERING ),
+ TOKEN( "table-column", XML_TABLE_COLUMN ),
+ TOKEN( "table-column-group", XML_TABLE_COLUMN_GROUP ),
+ TOKEN( "table-columns", XML_TABLE_COLUMNS ),
+ TOKEN( "table-count", XML_TABLE_COUNT ),
+ TOKEN( "table-header", XML_TABLE_HEADER ),
+ TOKEN( "table-header-columns", XML_TABLE_HEADER_COLUMNS ),
+ TOKEN( "table-header-rows", XML_TABLE_HEADER_ROWS ),
+ TOKEN( "table-index", XML_TABLE_INDEX ),
+ TOKEN( "table-index-entry-template", XML_TABLE_INDEX_ENTRY_TEMPLATE ),
+ TOKEN( "table-index-source", XML_TABLE_INDEX_SOURCE ),
+ TOKEN( "table-name", XML_TABLE_NAME ),
+ TOKEN( "table-number-list", XML_TABLE_NUMBER_LIST ),
+ TOKEN( "table-of-content", XML_TABLE_OF_CONTENT ),
+ TOKEN( "table-of-content-entry-template", XML_TABLE_OF_CONTENT_ENTRY_TEMPLATE ),
+ TOKEN( "table-of-content-source", XML_TABLE_OF_CONTENT_SOURCE ),
+ TOKEN( "table-page", XML_TABLE_PAGE ),
+ TOKEN( "table-protection", XML_TABLE_PROTECTION ),
+ TOKEN( "table-row", XML_TABLE_ROW ),
+ TOKEN( "table-row-group", XML_TABLE_ROW_GROUP ),
+ TOKEN( "table-rows", XML_TABLE_ROWS ),
+ TOKEN( "table-source", XML_TABLE_SOURCE ),
+ TOKEN( "table-view", XML_TABLE_VIEW ),
+ TOKEN( "tables", XML_TABLES ),
+ TOKEN( "tan", XML_TAN ),
+ TOKEN( "tanh", XML_TANH ),
+ TOKEN( "target-cell-address", XML_TARGET_CELL_ADDRESS ),
+ TOKEN( "target-frame-name", XML_TARGET_FRAME_NAME ),
+ TOKEN( "target-range-address", XML_TARGET_RANGE_ADDRESS ),
+ TOKEN( "tb-rl", XML_TB_RL ),
+ TOKEN( "teal", XML_TEAL ),
+ TOKEN( "techreport", XML_TECHREPORT ),
+ TOKEN( "template", XML_TEMPLATE ),
+ TOKEN( "template-name", XML_TEMPLATE_NAME ),
+ TOKEN( "tendsto", XML_TENDSTO ),
+ TOKEN( "texture-filter", XML_TEX_FILTER ),
+ TOKEN( "texture-generation-mode-x", XML_TEX_GENERATION_MODE_X ),
+ TOKEN( "texture-generation-mode-y", XML_TEX_GENERATION_MODE_Y ),
+ TOKEN( "texture-kind", XML_TEX_KIND ),
+ TOKEN( "texture-mode", XML_TEX_MODE ),
+ TOKEN( "text", XML_TEXT ),
+ TOKEN( "text-align", XML_TEXT_ALIGN ),
+ TOKEN( "text-align-last", XML_TEXT_ALIGN_LAST ),
+ TOKEN( "text-align-source", XML_TEXT_ALIGN_SOURCE ),
+ TOKEN( "text-autospace", XML_TEXT_AUTOSPACE ),
+ TOKEN( "text-background-color", XML_TEXT_BACKGROUND_COLOR ),
+ TOKEN( "text-blinking", XML_TEXT_BLINKING ),
+ TOKEN( "text-box", XML_TEXT_BOX ),
+ TOKEN( "text-combine", XML_TEXT_COMBINE ),
+ TOKEN( "text-combine-end-char", XML_TEXT_COMBINE_END_CHAR ),
+ TOKEN( "text-combine-start-char", XML_TEXT_COMBINE_START_CHAR ),
+ TOKEN( "text-content", XML_TEXT_CONTENT ),
+ TOKEN( "text-crossing-out", XML_TEXT_CROSSING_OUT ),
+ TOKEN( "text-emphasize", XML_TEXT_EMPHASIZE ),
+ TOKEN( "text-global", XML_TEXT_GLOBAL ),
+ TOKEN( "text-indent", XML_TEXT_INDENT ),
+ TOKEN( "text-input", XML_TEXT_INPUT ),
+ TOKEN( "text-justify", XML_TEXT_JUSTIFY ),
+ TOKEN( "text-outline", XML_TEXT_OUTLINE ),
+ TOKEN( "text-position", XML_TEXT_POSITION ),
+ TOKEN( "text-rotation-angle", XML_TEXT_ROTATION_ANGLE ),
+ TOKEN( "text-rotation-scale", XML_TEXT_ROTATION_SCALE ),
+ TOKEN( "text-scale", XML_TEXT_SCALE ),
+ TOKEN( "text-shadow", XML_TEXT_SHADOW ),
+ TOKEN( "text-style", XML_TEXT_STYLE ),
+ TOKEN( "text-transform", XML_TEXT_TRANSFORM ),
+ TOKEN( "text-underline", XML_TEXT_UNDERLINE ),
+ TOKEN( "text-underline-color", XML_TEXT_UNDERLINE_COLOR ),
+ TOKEN( "textarea-horizontal-align", XML_TEXTAREA_HORIZONTAL_ALIGN ),
+ TOKEN( "textarea-vertical-align", XML_TEXTAREA_VERTICAL_ALIGN ),
+ TOKEN( "textual", XML_TEXTUAL ),
+ TOKEN( "thick", XML_THICK ),
+ TOKEN( "thin", XML_THIN ),
+ TOKEN( "three-dimensional", XML_THREE_DIMENSIONAL ),
+ TOKEN( "thumbnail", XML_THUMBNAIL ),
+ TOKEN( "tick-marks-major-inner", XML_TICK_MARKS_MAJOR_INNER ),
+ TOKEN( "tick-marks-major-outer", XML_TICK_MARKS_MAJOR_OUTER ),
+ TOKEN( "tick-marks-minor-inner", XML_TICK_MARKS_MINOR_INNER ),
+ TOKEN( "tick-marks-minor-outer", XML_TICK_MARKS_MINOR_OUTER ),
+ TOKEN( "tile-repeat-offset", XML_TILE_REPEAT_OFFSET ),
+ TOKEN( "time", XML_TIME ),
+ TOKEN( "time-adjust", XML_TIME_ADJUST ),
+ TOKEN( "time-style", XML_TIME_STYLE ),
+ TOKEN( "time-value", XML_TIME_VALUE ),
+ TOKEN( "times", XML_TIMES ),
+ TOKEN( "title", XML_TITLE ),
+ TOKEN( "to-another-table", XML_TO_ANOTHER_TABLE ),
+ TOKEN( "to-bottom", XML_TO_BOTTOM ),
+ TOKEN( "to-center", XML_TO_CENTER ),
+ TOKEN( "to-left", XML_TO_LEFT ),
+ TOKEN( "to-lower-left", XML_TO_LOWER_LEFT ),
+ TOKEN( "to-lower-right", XML_TO_LOWER_RIGHT ),
+ TOKEN( "to-right", XML_TO_RIGHT ),
+ TOKEN( "to-top", XML_TO_TOP ),
+ TOKEN( "to-upper-left", XML_TO_UPPER_LEFT ),
+ TOKEN( "to-upper-right", XML_TO_UPPER_RIGHT ),
+ TOKEN( "toc-mark", XML_TOC_MARK ),
+ TOKEN( "toc-mark-end", XML_TOC_MARK_END ),
+ TOKEN( "toc-mark-start", XML_TOC_MARK_START ),
+ TOKEN( "top", XML_TOP ),
+ TOKEN( "top-left", XML_TOP_LEFT ),
+ TOKEN( "top percent", XML_TOP_PERCENT ),
+ TOKEN( "top-right", XML_TOP_RIGHT ),
+ TOKEN( "top values", XML_TOP_VALUES ),
+ TOKEN( "top-arc", XML_TOPARC ),
+ TOKEN( "top-circle", XML_TOPCIRCLE ),
+ TOKEN( "trace-dependents", XML_TRACE_DEPENDENTS ),
+ TOKEN( "trace-errors", XML_TRACE_ERRORS ),
+ TOKEN( "trace-precedents", XML_TRACE_PRECEDENTS ),
+ TOKEN( "track-changes", XML_TRACK_CHANGES ),
+ TOKEN( "tracked-changes", XML_TRACKED_CHANGES ),
+ TOKEN( "tracked-changes-view-settings", XML_TRACKED_CHANGES_VIEW_SETTINGS ),
+ TOKEN( "transform", XML_TRANSFORM ),
+ TOKEN( "transition-on-click", XML_TRANSITION_ON_CLICK ),
+ TOKEN( "transparency", XML_TRANSPARENCY ),
+ TOKEN( "transparency-name", XML_TRANSPARENCY_NAME ),
+ TOKEN( "transparent", XML_TRANSPARENT ),
+ TOKEN( "transpose", XML_TRANSPOSE ),
+ TOKEN( "true", XML_TRUE ),
+ TOKEN( "truncate-on-overflow", XML_TRUNCATE_ON_OVERFLOW ),
+ TOKEN( "ttb", XML_TTB ),
+ TOKEN( "type", XML_TYPE ),
+ TOKEN( "dot-dash", XML_DOT_DASH ),
+ TOKEN( "dot-dot-dash", XML_DOT_DOT_DASH ),
+ TOKEN( "long-dash", XML_LONG_DASH ),
+ TOKEN( "single", XML_SINGLE ),
+ TOKEN( "small-wave", XML_SMALL_WAVE ),
+ TOKEN( "wave", XML_WAVE ),
+ TOKEN( "unformatted-text", XML_UNFORMATTED_TEXT ),
+ TOKEN( "union", XML_UNION ),
+ TOKEN( "unit", XML_UNIT ),
+ TOKEN( "unordered-list", XML_UNORDERED_LIST ),
+ TOKEN( "unpublished", XML_UNPUBLISHED ),
+ TOKEN( "up", XML_UP ),
+ TOKEN( "uplimit", XML_UPLIMIT ),
+ TOKEN( "upright", XML_UPRIGHT ),
+ TOKEN( "url", XML_URL ),
+ TOKEN( "use-caption", XML_USE_CAPTION ),
+ TOKEN( "use-cell-protection", XML_USE_CELL_PROTECTION ),
+ TOKEN( "use-chart-objects", XML_USE_CHART_OBJECTS ),
+ TOKEN( "use-condition", XML_USE_CONDITION ),
+ TOKEN( "use-draw-objects", XML_USE_DRAW_OBJECTS ),
+ TOKEN( "use-floating-frames", XML_USE_FLOATING_FRAMES ),
+ TOKEN( "use-graphics", XML_USE_GRAPHICS ),
+ TOKEN( "use-image-objects", XML_USE_IMAGE_OBJECTS ),
+ TOKEN( "use-index-marks", XML_USE_INDEX_MARKS ),
+ TOKEN( "use-index-source-styles", XML_USE_INDEX_SOURCE_STYLES ),
+ TOKEN( "use-keys-as-entries", XML_USE_KEYS_AS_ENTRIES ),
+ TOKEN( "use-label", XML_USE_LABEL ),
+ TOKEN( "use-math-objects", XML_USE_MATH_OBJECTS ),
+ TOKEN( "use-objects", XML_USE_OBJECTS ),
+ TOKEN( "use-optimal-column-width", XML_USE_OPTIMAL_COLUMN_WIDTH ),
+ TOKEN( "use-optimal-row-height", XML_USE_OPTIMAL_ROW_HEIGHT ),
+ TOKEN( "use-other-objects", XML_USE_OTHER_OBJECTS ),
+ TOKEN( "use-spreadsheet-objects", XML_USE_SPREADSHEET_OBJECTS ),
+ TOKEN( "use-styles", XML_USE_STYLES ),
+ TOKEN( "use-tables", XML_USE_TABLES ),
+ TOKEN( "use-window-font-color", XML_USE_WINDOW_FONT_COLOR ),
+ TOKEN( "used-hierarchy", XML_USED_HIERARCHY ),
+ TOKEN( "user-defined", XML_USER_DEFINED ),
+ TOKEN( "user-field-decl", XML_USER_FIELD_DECL ),
+ TOKEN( "user-field-decls", XML_USER_FIELD_DECLS ),
+ TOKEN( "user-field-get", XML_USER_FIELD_GET ),
+ TOKEN( "user-field-input", XML_USER_FIELD_INPUT ),
+ TOKEN( "user-index", XML_USER_INDEX ),
+ TOKEN( "user-index-entry-template", XML_USER_INDEX_ENTRY_TEMPLATE ),
+ TOKEN( "user-index-mark", XML_USER_INDEX_MARK ),
+ TOKEN( "user-index-mark-end", XML_USER_INDEX_MARK_END ),
+ TOKEN( "user-index-mark-start", XML_USER_INDEX_MARK_START ),
+ TOKEN( "user-index-source", XML_USER_INDEX_SOURCE ),
+ TOKEN( "user-transformed", XML_USER_TRANSFORMED ),
+ TOKEN( "username", XML_USERNAME ),
+ TOKEN( "value", XML_VALUE ),
+ TOKEN( "value-type", XML_VALUE_TYPE ),
+ TOKEN( "values-cell-range-address", XML_VALUES_CELL_RANGE_ADDRESS ),
+ TOKEN( "var", XML_VAR ),
+ TOKEN( "variable", XML_VARIABLE ),
+ TOKEN( "variable-decl", XML_VARIABLE_DECL ),
+ TOKEN( "variable-decls", XML_VARIABLE_DECLS ),
+ TOKEN( "variable-get", XML_VARIABLE_GET ),
+ TOKEN( "variable-input", XML_VARIABLE_INPUT ),
+ TOKEN( "variable-set", XML_VARIABLE_SET ),
+ TOKEN( "variance", XML_VARIANCE ),
+ TOKEN( "varp", XML_VARP ),
+ TOKEN( "vector", XML_VECTOR ),
+ TOKEN( "verb", XML_VERB ),
+ TOKEN( "version", XML_VERSION ),
+ TOKEN( "version-entry", XML_VERSION_ENTRY ),
+ TOKEN( "version-list", XML_VERSION_LIST ),
+ TOKEN( "vertical", XML_VERTICAL ),
+ TOKEN( "vertical-align", XML_VERTICAL_ALIGN ),
+ TOKEN( "vertical-justify", XML_VERTICAL_JUSTIFY ),
+ TOKEN( "vertical-lines", XML_VERTICAL_LINES ),
+ TOKEN( "vertical-pos", XML_VERTICAL_POS ),
+ TOKEN( "vertical-rel", XML_VERTICAL_REL ),
+ TOKEN( "vertical-segments", XML_VERTICAL_SEGMENTS ),
+ TOKEN( "vertical-split-mode", XML_VERTICAL_SPLIT_MODE ),
+ TOKEN( "vertical-split-position", XML_VERTICAL_SPLIT_POSITION ),
+ TOKEN( "vertical-stripes", XML_VERTICAL_STRIPES ),
+ TOKEN( "view", XML_VIEW ),
+ TOKEN( "viewBox", XML_VIEWBOX ),
+ TOKEN( "view-id", XML_VIEW_ID ),
+ TOKEN( "view-settings", XML_VIEW_SETTINGS ),
+ TOKEN( "visibility", XML_VISIBILITY ),
+ TOKEN( "visible", XML_VISIBLE ),
+ TOKEN( "visible-area", XML_VISIBLE_AREA ),
+ TOKEN( "visible-area-height", XML_VISIBLE_AREA_HEIGHT ),
+ TOKEN( "visible-area-left", XML_VISIBLE_AREA_LEFT ),
+ TOKEN( "visible-area-top", XML_VISIBLE_AREA_TOP ),
+ TOKEN( "visible-area-width", XML_VISIBLE_AREA_WIDTH ),
+ TOKEN( "visited-style-name", XML_VISITED_STYLE_NAME ),
+ TOKEN( "volatile", XML_VOLATILE ),
+ TOKEN( "volume", XML_VOLUME ),
+ TOKEN( "vpn", XML_VPN ),
+ TOKEN( "vrp", XML_VRP ),
+ TOKEN( "vup", XML_VUP ),
+ TOKEN( "wall", XML_WALL ),
+ TOKEN( "warning", XML_WARNING ),
+ TOKEN( "watermark", XML_WATERMARK ),
+ TOKEN( "wavyline", XML_WAVYLINE ),
+ TOKEN( "wavyline-from-bottom", XML_WAVYLINE_FROM_BOTTOM ),
+ TOKEN( "wavyline-from-left", XML_WAVYLINE_FROM_LEFT ),
+ TOKEN( "wavyline-from-right", XML_WAVYLINE_FROM_RIGHT ),
+ TOKEN( "wavyline-from-top", XML_WAVYLINE_FROM_TOP ),
+ TOKEN( "week-of-year", XML_WEEK_OF_YEAR ),
+ TOKEN( "bold", XML_WEIGHT_BOLD ),
+ TOKEN( "normal", XML_WEIGHT_NORMAL ),
+ TOKEN( "white", XML_WHITE ),
+ TOKEN( "whole-page", XML_WHOLE_PAGE ),
+ TOKEN( "widows", XML_WIDOWS ),
+ TOKEN( "width", XML_WIDTH ),
+ TOKEN( "word", XML_WORD ),
+ TOKEN( "word-count", XML_WORD_COUNT ),
+ TOKEN( "wrap", XML_WRAP ),
+ TOKEN( "wrap-contour", XML_WRAP_CONTOUR ),
+ TOKEN( "wrap-contour-mode", XML_WRAP_CONTOUR_MODE ),
+ TOKEN( "wrap-option", XML_WRAP_OPTION ),
+ TOKEN( "writing-mode", XML_WRITING_MODE ),
+ TOKEN( "www", XML_WWW ),
+ TOKEN( "x", XML_X ),
+ TOKEN( "x1", XML_X1 ),
+ TOKEN( "x2", XML_X2 ),
+ TOKEN( "x-mac-roman", XML_X_MAC_ROMAN ),
+ TOKEN( "x-symbol", XML_X_SYMBOL ),
+ TOKEN( "x-system", XML_X_SYSTEM ),
+ TOKEN( "xor", XML_XOR ),
+ TOKEN( "y", XML_Y ),
+ TOKEN( "y1", XML_Y1 ),
+ TOKEN( "y2", XML_Y2 ),
+ TOKEN( "year", XML_YEAR ),
+ TOKEN( "yellow", XML_YELLOW ),
+ TOKEN( "zero-values", XML_ZERO_VALUES ),
+ TOKEN( "z-index", XML_ZINDEX ),
+ TOKEN( "zoom-type", XML_ZOOM_TYPE ),
+ TOKEN( "zoom-value", XML_ZOOM_VALUE ),
+
+ TOKEN( "enable", XML_ENABLE ),
+ TOKEN( "use-regular-expressions", XML_USE_REGULAR_EXPRESSIONS ),
+ TOKEN( "data-source-has-labels", XML_DATA_SOURCE_HAS_LABELS ),
+ TOKEN( "link-data-style-to-source", XML_LINK_DATA_STYLE_TO_SOURCE ),
+ TOKEN( "sort-algorithm", XML_SORT_ALGORITHM ),
+ TOKEN( "straight-line", XML_STRAIGHT_LINE ),
+ TOKEN( "angled-line", XML_ANGLED_LINE ),
+ TOKEN( "angled-connector-line", XML_ANGLED_CONNECTOR_LINE ),
+
+ TOKEN( "application/x-www-form-urlencoded", XML_APPLICATION_X_WWW_FORM_URLENCODED ),
+ TOKEN( "multipart/formdata", XML_MULTIPART_FORMDATA ),
+ TOKEN( "application/text", XML_APPLICATION_TEXT ),
+ TOKEN( "get", XML_GET ),
+ TOKEN( "post", XML_POST ),
+ TOKEN( "query", XML_QUERY ),
+ TOKEN( "parent", XML_PARENT ),
+ TOKEN( "records", XML_RECORDS ),
+ TOKEN( "push", XML_PUSH ),
+ TOKEN( "submit", XML_SUBMIT ),
+ TOKEN( "reset", XML_RESET ),
+ TOKEN( "value-list", XML_VALUE_LIST ),
+ TOKEN( "sql", XML_SQL ),
+ TOKEN( "sql-pass-through", XML_SQL_PASS_THROUGH ),
+ TOKEN( "table-fields", XML_TABLE_FIELDS ),
+ TOKEN( "unchecked", XML_UNCHECKED ),
+ TOKEN( "checked", XML_CHECKED ),
+ TOKEN( "unknown", XML_UNKNOWN ),
+
+ TOKEN( "roll-from-top", XML_ROLL_FROM_TOP ),
+
+ TOKEN( "binary-data", XML_BINARY_DATA ),
+ TOKEN( "notify-on-update-of-table", XML_NOTIFY_ON_UPDATE_OF_TABLE ),
+
+ TOKEN( "0", XML_0 ),
+ TOKEN( "play", XML_PLAY ),
+ TOKEN( "handout-master", XML_HANDOUT_MASTER ),
+ TOKEN( "text-style-name", XML_TEXT_STYLE_NAME ),
+ TOKEN( "escape-direction", XML_ESCAPE_DIRECTION ),
+ TOKEN( "glue-point", XML_GLUE_POINT ),
+ TOKEN( "primary-x", XML_PRIMARY_X ),
+ TOKEN( "secondary-x", XML_SECONDARY_X ),
+ TOKEN( "primary-y", XML_PRIMARY_Y ),
+ TOKEN( "secondary-y", XML_SECONDARY_Y ),
+ TOKEN( "primary-z", XML_PRIMARY_Z ),
+
+ TOKEN( "caption-type", XML_CAPTION_TYPE ),
+ TOKEN( "caption-angle-type", XML_CAPTION_ANGLE_TYPE ),
+ TOKEN( "caption-angle", XML_CAPTION_ANGLE ),
+ TOKEN( "caption-gap", XML_CAPTION_GAP ),
+ TOKEN( "caption-escape-direction", XML_CAPTION_ESCAPE_DIRECTION ),
+ TOKEN( "caption-escape", XML_CAPTION_ESCAPE ),
+ TOKEN( "caption-line-length", XML_CAPTION_LINE_LENGTH ),
+ TOKEN( "caption-fit-line-length", XML_CAPTION_FIT_LINE_LENGTH ),
+ TOKEN( "free", XML_FREE ),
+ TOKEN( "transition-type", XML_TRANSITION_TYPE ),
+ TOKEN( "transition-style", XML_TRANSITION_STYLE ),
+ TOKEN( "transition-speed", XML_TRANSITION_SPEED ),
+ TOKEN( "duration", XML_DURATION ),
+ TOKEN( "background-size", XML_BACKGROUND_SIZE ),
+ TOKEN( "background-objects-visible", XML_BACKGROUND_OBJECTS_VISIBLE ),
+ TOKEN( "background-visible", XML_BACKGROUND_VISIBLE ),
+
+ TOKEN( "move-from-upperleft", XML_MOVE_FROM_UPPERLEFT ),
+ TOKEN( "move-from-upperright", XML_MOVE_FROM_UPPERRIGHT ),
+ TOKEN( "move-from-lowerright", XML_MOVE_FROM_LOWERRIGHT ),
+ TOKEN( "move-from-lowerleft", XML_MOVE_FROM_LOWERLEFT ),
+ TOKEN( "uncover-to-left", XML_UNCOVER_TO_LEFT ),
+ TOKEN( "uncover-to-upperleft", XML_UNCOVER_TO_UPPERLEFT ),
+ TOKEN( "uncover-to-top", XML_UNCOVER_TO_TOP ),
+ TOKEN( "uncover-to-upperright", XML_UNCOVER_TO_UPPERRIGHT ),
+ TOKEN( "uncover-to-right", XML_UNCOVER_TO_RIGHT ),
+ TOKEN( "uncover-to-lowerright", XML_UNCOVER_TO_LOWERRIGHT ),
+ TOKEN( "uncover-to-bottom", XML_UNCOVER_TO_BOTTOM ),
+ TOKEN( "uncover-to-lowerleft", XML_UNCOVER_TO_LOWERLEFT ),
+ TOKEN( "vertical-checkerboard", XML_VERTICAL_CHECKERBOARD ),
+ TOKEN( "horizontal-checkerboard", XML_HORIZONTAL_CHECKERBOARD ),
+
+ TOKEN( "notify-on-update-of-ranges", XML_NOTIFY_ON_UPDATE_OF_RANGES ),
+
+ TOKEN( "byte", XML_BYTE ),
+ TOKEN( "macro", XML_MACRO ),
+ TOKEN( "location", XML_LOCATION ),
+ TOKEN( "application", XML_APPLICATION ),
+
+ TOKEN( "symbol-image", XML_SYMBOL_IMAGE ),
+ TOKEN( "text-overlap", XML_TEXT_OVERLAP ),
+ TOKEN( "spline-order", XML_SPLINE_ORDER ),
+ TOKEN( "spline-resolution", XML_SPLINE_RESOLUTION ),
+ TOKEN( "paper-tray-name", XML_PAPER_TRAY_NAME ),
+
+ TOKEN( "column-mapping", XML_COLUMN_MAPPING ),
+ TOKEN( "row-mapping", XML_ROW_MAPPING ),
+
+ TOKEN( "table-formula", XML_TABLE_FORMULA ),
+
+ TOKEN( "embedded-text", XML_EMBEDDED_TEXT ),
+
+ TOKEN( "merge-last-paragraph", XML_MERGE_LAST_PARAGRAPH ),
+
+ TOKEN( "stock-loss-marker", XML_STOCK_LOSS_MARKER ),
+ TOKEN( "stock-gain-marker", XML_STOCK_GAIN_MARKER ),
+ TOKEN( "stock-range-line", XML_STOCK_RANGE_LINE ),
+
+ TOKEN( "rl-tb", XML_RL_TB ),
+ TOKEN( "tb-lr", XML_TB_LR ),
+ TOKEN( "lr", XML_LR ),
+ TOKEN( "rl", XML_RL ),
+ TOKEN( "tb", XML_TB ),
+
+ TOKEN( "layout-grid-color", XML_LAYOUT_GRID_COLOR ),
+ TOKEN( "layout-grid-lines", XML_LAYOUT_GRID_LINES ),
+ TOKEN( "layout-grid-base-height", XML_LAYOUT_GRID_BASE_HEIGHT ),
+ TOKEN( "layout-grid-ruby-height", XML_LAYOUT_GRID_RUBY_HEIGHT ),
+ TOKEN( "layout-grid-mode", XML_LAYOUT_GRID_MODE ),
+ TOKEN( "layout-grid-ruby-below", XML_LAYOUT_GRID_RUBY_BELOW ),
+ TOKEN( "layout-grid-print", XML_LAYOUT_GRID_PRINT ),
+ TOKEN( "layout-grid-display", XML_LAYOUT_GRID_DISPLAY ),
+
+ //text grid enhancement for better CJK support
+ TOKEN( "default-page-layout", XML_DEFAULT_PAGE_LAYOUT ),
+ TOKEN( "layout-grid-standard-mode", XML_LAYOUT_GRID_STANDARD_MODE ),
+ TOKEN( "layout-grid-base-width", XML_LAYOUT_GRID_BASE_WIDTH ),
+ TOKEN( "layout-grid-snap-to-characters", XML_LAYOUT_GRID_SNAP_TO_CHARS ),
+ TOKEN( "layout-grid-snap-to", XML_LAYOUT_GRID_SNAP_TO ),
+
+ TOKEN( "snap-to-layout-grid", XML_SNAP_TO_LAYOUT_GRID ),
+
+ TOKEN( "dont-balance-text-columns", XML_DONT_BALANCE_TEXT_COLUMNS ),
+
+ TOKEN( "glyph-orientation-vertical", XML_GLYPH_ORIENTATION_VERTICAL ),
+
+ TOKEN( "marked-invalid", XML_MARKED_INVALID ),
+
+ TOKEN( "regression-curve", XML_REGRESSION_CURVE ),
+ TOKEN( "error-indicator", XML_ERROR_INDICATOR ),
+
+ TOKEN( "table-type", XML_TABLE_TYPE ),
+
+ TOKEN( "display-factor", XML_DISPLAY_FACTOR ),
+
+ TOKEN( "transliteration-format", XML_TRANSLITERATION_FORMAT ),
+ TOKEN( "transliteration-language", XML_TRANSLITERATION_LANGUAGE ),
+ TOKEN( "transliteration-country", XML_TRANSLITERATION_COUNTRY ),
+ TOKEN( "transliteration-style", XML_TRANSLITERATION_STYLE ),
+
+ TOKEN( "key1-phonetic", XML_KEY1_PHONETIC ),
+ TOKEN( "key2-phonetic", XML_KEY2_PHONETIC ),
+ TOKEN( "string-value-phonetic", XML_STRING_VALUE_PHONETIC ),
+
+ TOKEN( "background-transparency", XML_BACKGROUND_TRANSPARENCY ),
+ TOKEN( "background-image-transparency", XML_BACKGROUND_IMAGE_TRANSPARENCY ),
+
+ TOKEN( "dynamic-spacing", XML_DYNAMIC_SPACING ),
+
+ TOKEN( "main-entry", XML_MAIN_ENTRY ),
+
+ TOKEN( "use-outline-level", XML_USE_OUTLINE_LEVEL ),
+
+ // #107245# New 3D properties which are possible for lathe and extrude 3d objects
+ TOKEN( "close-front", XML_CLOSE_FRONT ),
+ TOKEN( "close-back", XML_CLOSE_BACK ),
+
+ TOKEN( "drop-down", XML_DROPDOWN ),
+ TOKEN( "current-selected", XML_CURRENT_SELECTED ),
+
+ TOKEN( "join-border", XML_JOIN_BORDER ),
+
+ TOKEN( "display-list", XML_DISPLAY_LIST ),
+ TOKEN( "no", XML_NO ),
+ TOKEN( "unsorted", XML_UNSORTED ),
+ TOKEN( "sorted-ascending", XML_SORTED_ASCENDING ),
+ TOKEN( "font-independent-line-spacing", XML_FONT_INDEPENDENT_LINE_SPACING ),
+
+ TOKEN( "database", XML_DATABASE ),
+ TOKEN( "data-source", XML_DATASOURCE ),
+ TOKEN( "queries", XML_QUERIES ),
+ TOKEN( "reports", XML_REPORTS ),
+ TOKEN( "report", XML_REPORT ),
+ TOKEN( "as-template", XML_AS_TEMPLATE ),
+
+ TOKEN( "connection-resource", XML_CONNECTION_RESOURCE ),
+ TOKEN( "suppress-version-columns", XML_SUPPRESS_VERSION_COLUMNS ),
+ TOKEN( "java-driver-class", XML_JAVA_DRIVER_CLASS ),
+ TOKEN( "extension", XML_EXTENSION ),
+ TOKEN( "is-first-row-header-line", XML_IS_FIRST_ROW_HEADER_LINE ),
+ TOKEN( "show-deleted", XML_SHOW_DELETED ),
+ TOKEN( "is-table-name-length-limited", XML_IS_TABLE_NAME_LENGTH_LIMITED ),
+ TOKEN( "system-driver-settings", XML_SYSTEM_DRIVER_SETTINGS ),
+ TOKEN( "enable-sql92-check", XML_ENABLE_SQL92_CHECK ),
+ TOKEN( "append-table-alias-name", XML_APPEND_TABLE_ALIAS_NAME ),
+ TOKEN( "parameter-name-substitution", XML_PARAMETER_NAME_SUBSTITUTION ),
+ TOKEN( "ignore-driver-privileges", XML_IGNORE_DRIVER_PRIVILEGES ),
+ TOKEN( "boolean-comparison-mode", XML_BOOLEAN_COMPARISON_MODE ),
+ TOKEN( "use-catalog", XML_USE_CATALOG ),
+ TOKEN( "base-dn", XML_BASE_DN ),
+ TOKEN( "max-row-count", XML_MAX_ROW_COUNT ),
+ TOKEN( "login", XML_LOGIN ),
+ TOKEN( "user-name", XML_USER_NAME ),
+ TOKEN( "is-password-required", XML_IS_PASSWORD_REQUIRED ),
+ TOKEN( "login-timeout", XML_LOGIN_TIMEOUT ),
+ TOKEN( "delimiter", XML_DELIMITER ),
+ TOKEN( "field", XML_FIELD ),
+ TOKEN( "decimal", XML_DECIMAL ),
+ TOKEN( "thousand", XML_THOUSAND ),
+ TOKEN( "table-filter", XML_TABLE_FILTER ),
+ TOKEN( "table-filter-pattern", XML_TABLE_FILTER_PATTERN ),
+ TOKEN( "table-type-filter", XML_TABLE_TYPE_FILTER ),
+ TOKEN( "auto-increment", XML_AUTO_INCREMENT ),
+ TOKEN( "additional-column-statement", XML_ADDITIONAL_COLUMN_STATEMENT ),
+ TOKEN( "row-retrieving-statement", XML_ROW_RETRIEVING_STATEMENT ),
+ TOKEN( "data-source-settings", XML_DATA_SOURCE_SETTINGS ),
+ TOKEN( "data-source-setting", XML_DATA_SOURCE_SETTING ),
+ TOKEN( "data-source-setting-value", XML_DATA_SOURCE_SETTING_VALUE ),
+ TOKEN( "data-source-setting-is-list", XML_DATA_SOURCE_SETTING_IS_LIST ),
+ TOKEN( "data-source-setting-type", XML_DATA_SOURCE_SETTING_TYPE ),
+ TOKEN( "data-source-setting-name", XML_DATA_SOURCE_SETTING_NAME ),
+ TOKEN( "component", XML_COMPONENT ),
+ TOKEN( "component-collection", XML_COMPONENT_COLLECTION ),
+ TOKEN( "query-collection", XML_QUERY_COLLECTION ),
+ TOKEN( "update-table", XML_UPDATE_TABLE ),
+ TOKEN( "filter-statement", XML_FILTER_STATEMENT ),
+ TOKEN( "order-statement", XML_ORDER_STATEMENT ),
+ TOKEN( "escape-processing", XML_ESCAPE_PROCESSING ),
+ TOKEN( "keys", XML_KEYS ),
+ TOKEN( "indices", XML_INDICES ),
+ TOKEN( "type-name", XML_TYPE_NAME ),
+ TOKEN( "precision", XML_PRECISION ),
+ TOKEN( "is-nullable", XML_IS_NULLABLE ),
+ TOKEN( "is-autoincrement", XML_IS_AUTOINCREMENT ),
+ TOKEN( "default-value", XML_DEFAULT_VALUE ),
+ TOKEN( "referenced-table-name", XML_REFERENCED_TABLE_NAME ),
+ TOKEN( "update-rule", XML_UPDATE_RULE ),
+ TOKEN( "delete-rule", XML_DELETE_RULE ),
+ TOKEN( "key-columns", XML_KEY_COLUMNS ),
+ TOKEN( "key-column", XML_KEY_COLUMN ),
+ TOKEN( "related-column-name", XML_RELATED_COLUMN_NAME ),
+ TOKEN( "catalog-name", XML_CATALOG_NAME ),
+ TOKEN( "is-unique", XML_IS_UNIQUE ),
+ TOKEN( "is-clustered", XML_IS_CLUSTERED ),
+ TOKEN( "index-columns", XML_INDEX_COLUMNS ),
+ TOKEN( "index-column", XML_INDEX_COLUMN ),
+ TOKEN( "is-ascending", XML_IS_ASCENDING ),
+ TOKEN( "schema-name", XML_SCHEMA_NAME ),
+ TOKEN( "db", XML_NP_DB ),
+ TOKEN( "http://openoffice.org/2004/database", XML_N_DB ),
+ TOKEN( "apply-filter", XML_APPLY_FILTER ),
+ TOKEN( "apply-order", XML_APPLY_ORDER ),
+ TOKEN( "automatic-print-range", XML_AUTOMATIC_PRINT_RANGE ),
+
+ TOKEN( "selection", XML_SELECTION ),
+ TOKEN( "selection-indexes", XML_SELECTION_INDEXES ),
+
+ TOKEN( "scale-to-X", XML_SCALE_TO_X ),
+ TOKEN( "scale-to-Y", XML_SCALE_TO_Y ),
+
+ TOKEN( "keep-together", XML_KEEP_TOGETHER ),
+
+ TOKEN( "use-header-name", XML_USE_HEADER_NAME ),
+ TOKEN( "use-footer-name", XML_USE_FOOTER_NAME ),
+ TOKEN( "use-date-time-name", XML_USE_DATE_TIME_NAME ),
+ TOKEN( "display-header", XML_DISPLAY_HEADER ),
+ TOKEN( "display-footer", XML_DISPLAY_FOOTER ),
+ TOKEN( "display-page-number", XML_DISPLAY_PAGE_NUMBER ),
+ TOKEN( "display-date-time", XML_DISPLAY_DATE_TIME ),
+ TOKEN( "source" , XML_SOURCE ),
+ TOKEN( "current-date", XML_CURRENT_DATE ),
+
+ TOKEN( "header-decl", XML_HEADER_DECL ),
+ TOKEN( "footer-decl", XML_FOOTER_DECL ),
+ TOKEN( "date-time-decl", XML_DATE_TIME_DECL ),
+
+ TOKEN( "selected-page", XML_SELECTED_PAGE ),
+
+ // DVO, OD 01.10.2003 #i18732#
+ TOKEN( "flow-with-text", XML_FLOW_WITH_TEXT ),
+ TOKEN( "with-tab", XML_WITH_TAB ), // #i21237#
+
+ TOKEN( "custom-shape" , XML_CUSTOM_SHAPE ),
+ TOKEN( "engine" , XML_ENGINE ),
+ TOKEN( "enhanced-geometry" , XML_ENHANCED_GEOMETRY ),
+ TOKEN( "text-rotate-angle" , XML_TEXT_ROTATE_ANGLE ),
+ TOKEN( "mirror-vertical" , XML_MIRROR_VERTICAL ),
+ TOKEN( "mirror-horizontal" , XML_MIRROR_HORIZONTAL ),
+ TOKEN( "extrusion-allowed" , XML_EXTRUSION_ALLOWED ),
+ TOKEN( "text-path-allowed" , XML_TEXT_PATH_ALLOWED ),
+ TOKEN( "concentric-gradient-fill-allowed" , XML_CONCENTRIC_GRADIENT_FILL_ALLOWED ),
+ TOKEN( "extrusion" , XML_EXTRUSION ),
+ TOKEN( "extrusion-brightness" , XML_EXTRUSION_BRIGHTNESS ),
+ TOKEN( "extrusion-depth" , XML_EXTRUSION_DEPTH ),
+ TOKEN( "extrusion-diffusion" , XML_EXTRUSION_DIFFUSION ),
+ TOKEN( "extrusion-number-of-line-segments" , XML_EXTRUSION_NUMBER_OF_LINE_SEGMENTS ),
+ TOKEN( "extrusion-light-face" , XML_EXTRUSION_LIGHT_FACE ),
+ TOKEN( "extrusion-first-light-harsh" , XML_EXTRUSION_FIRST_LIGHT_HARSH ),
+ TOKEN( "extrusion-second-light-harsh" , XML_EXTRUSION_SECOND_LIGHT_HARSH ),
+ TOKEN( "extrusion-first-light-level" , XML_EXTRUSION_FIRST_LIGHT_LEVEL ),
+ TOKEN( "extrusion-second-light-level" , XML_EXTRUSION_SECOND_LIGHT_LEVEL ),
+ TOKEN( "extrusion-first-light-direction" , XML_EXTRUSION_FIRST_LIGHT_DIRECTION ),
+ TOKEN( "extrusion-second-light-direction" , XML_EXTRUSION_SECOND_LIGHT_DIRECTION ),
+ TOKEN( "extrusion-metal" , XML_EXTRUSION_METAL ),
+ TOKEN( "extrusion-rotation-angle" , XML_EXTRUSION_ROTATION_ANGLE ),
+ TOKEN( "extrusion-rotation-center" , XML_EXTRUSION_ROTATION_CENTER ),
+ TOKEN( "extrusion-shininess" , XML_EXTRUSION_SHININESS ),
+ TOKEN( "extrusion-skew" , XML_EXTRUSION_SKEW ),
+ TOKEN( "extrusion-specularity" , XML_EXTRUSION_SPECULARITY ),
+ TOKEN( "extrusion-projection-mode" , XML_EXTRUSION_PROJECTION_MODE ),
+ TOKEN( "extrusion-viewpoint" , XML_EXTRUSION_VIEWPOINT ),
+ TOKEN( "extrusion-origin" , XML_EXTRUSION_ORIGIN ),
+ TOKEN( "extrusion-color" , XML_EXTRUSION_COLOR ),
+ TOKEN( "secondary-fill-color" , XML_SECONDARY_FILL_COLOR ),
+ TOKEN( "enhanced-path" , XML_ENHANCED_PATH ),
+ TOKEN( "path-stretchpoint-x" , XML_PATH_STRETCHPOINT_X ),
+ TOKEN( "path-stretchpoint-y" , XML_PATH_STRETCHPOINT_Y ),
+ TOKEN( "text-areas" , XML_TEXT_AREAS ),
+ TOKEN( "glue-points" , XML_GLUE_POINTS ),
+ TOKEN( "glue-point-type" , XML_GLUE_POINT_TYPE ),
+ TOKEN( "glue-point-leaving-direction" , XML_GLUE_POINT_LEAVING_DIRECTIONS ),
+ TOKEN( "text-path" , XML_TEXT_PATH ),
+ TOKEN( "text-path-mode" , XML_TEXT_PATH_MODE ),
+ TOKEN( "text-path-scale" , XML_TEXT_PATH_SCALE ),
+ TOKEN( "text-path-same-letter-heights" , XML_TEXT_PATH_SAME_LETTER_HEIGHTS ),
+ TOKEN( "modifiers" , XML_MODIFIERS ),
+ TOKEN( "equation" , XML_EQUATION ),
+ TOKEN( "xstretch", XML_XSTRETCH ),
+ TOKEN( "ystretch", XML_YSTRETCH ),
+ TOKEN( "hasstroke", XML_HASSTROKE ),
+ TOKEN( "hasfill", XML_HASFILL ),
+ TOKEN( "logwidth", XML_LOGWIDTH ),
+ TOKEN( "logheight", XML_LOGHEIGHT ),
+ TOKEN( "handle" , XML_HANDLE ),
+ TOKEN( "handle-mirror-vertical" , XML_HANDLE_MIRROR_VERTICAL ),
+ TOKEN( "handle-mirror-horizontal" , XML_HANDLE_MIRROR_HORIZONTAL ),
+ TOKEN( "handle-switched" , XML_HANDLE_SWITCHED ),
+ TOKEN( "handle-position" , XML_HANDLE_POSITION ),
+ TOKEN( "handle-range-x-minimum" , XML_HANDLE_RANGE_X_MINIMUM ),
+ TOKEN( "handle-range-x-maximum" , XML_HANDLE_RANGE_X_MAXIMUM ),
+ TOKEN( "handle-range-y-minimum" , XML_HANDLE_RANGE_Y_MINIMUM ),
+ TOKEN( "handle-range-y-maximum" , XML_HANDLE_RANGE_Y_MAXIMUM ),
+ TOKEN( "handle-polar" , XML_HANDLE_POLAR ),
+ TOKEN( "handle-radius-range-minimum" , XML_HANDLE_RADIUS_RANGE_MINIMUM ),
+ TOKEN( "handle-radius-range-maximum" , XML_HANDLE_RADIUS_RANGE_MAXIMUM ),
+ TOKEN( "rectangle" , XML_RECTANGLE ),
+ TOKEN( "roundrectangle" , XML_ROUNDRECTANGLE ),
+ TOKEN( "oval" , XML_OVAL ),
+ TOKEN( "cloud" , XML_CLOUD ),
+ TOKEN( "boundingcube" , XML_BOUNDINGCUBE ),
+ TOKEN( "wireframe" , XML_WIREFRAME ),
+ TOKEN( "segments" , XML_SEGMENTS ),
+ TOKEN( "word-wrap" , XML_WORD_WRAP ),
+ TOKEN( "collapsing" , XML_COLLAPSING ),
+ TOKEN( "separating" , XML_SEPARATING ),
+ TOKEN( "border-model" , XML_BORDER_MODEL ),
+ TOKEN( "data-pilot-field-reference", XML_DATA_PILOT_FIELD_REFERENCE ),
+ TOKEN( "member-difference", XML_MEMBER_DIFFERENCE ),
+ TOKEN( "member-percentage", XML_MEMBER_PERCENTAGE ),
+ TOKEN( "member-percentage-difference", XML_MEMBER_PERCENTAGE_DIFFERENCE ),
+ TOKEN( "running-total", XML_RUNNING_TOTAL ),
+ TOKEN( "row-percentage", XML_ROW_PERCENTAGE ),
+ TOKEN( "column-percentage", XML_COLUMN_PERCENTAGE ),
+ TOKEN( "total-percentage", XML_TOTAL_PERCENTAGE ),
+ TOKEN( "field-name", XML_FIELD_NAME ),
+ TOKEN( "member-type", XML_MEMBER_TYPE ),
+ TOKEN( "named", XML_NAMED ),
+ TOKEN( "member-name", XML_MEMBER_NAME ),
+ TOKEN( "display-member-mode", XML_DISPLAY_MEMBER_MODE ),
+ TOKEN( "member-count", XML_MEMBER_COUNT ),
+ TOKEN( "data-field", XML_DATA_FIELD ),
+ TOKEN( "data-pilot-display-info", XML_DATA_PILOT_DISPLAY_INFO ),
+ TOKEN( "sort-mode", XML_SORT_MODE ),
+ TOKEN( "data-pilot-sort-info", XML_DATA_PILOT_SORT_INFO ),
+ TOKEN( "add-empty-lines", XML_ADD_EMPTY_LINES ),
+ TOKEN( "tabular-layout", XML_TABULAR_LAYOUT ),
+ TOKEN( "outline-subtotals-top", XML_OUTLINE_SUBTOTALS_TOP ),
+ TOKEN( "outline-subtotals-bottom", XML_OUTLINE_SUBTOTALS_BOTTOM ),
+ TOKEN( "layout-mode", XML_LAYOUT_MODE ),
+ TOKEN( "data-pilot-layout-info", XML_DATA_PILOT_LAYOUT_INFO ),
+ TOKEN( "symbol-color", XML_SYMBOL_COLOR ),
+ TOKEN( "3d" , XML_3D ),
+ TOKEN( "image-position" , XML_IMAGE_POSITION ),
+ TOKEN( "image-align" , XML_IMAGE_ALIGN ),
+ TOKEN( "diagonal-bl-tr", XML_DIAGONAL_BL_TR ),
+ TOKEN( "diagonal-bl-tr-width", XML_DIAGONAL_BL_TR_WIDTH ),
+ TOKEN( "diagonal-tl-br", XML_DIAGONAL_TL_BR ),
+ TOKEN( "diagonal-tl-br-width", XML_DIAGONAL_TL_BR_WIDTH ),
+ TOKEN( "repeat-content", XML_REPEAT_CONTENT ),
+ TOKEN( "shrink-to-fit", XML_SHRINK_TO_FIT ),
+
+ // OD 2004-05-05 #i28701#
+ TOKEN( "wrap-influence-on-position", XML_WRAP_INFLUENCE_ON_POSITION ),
+ // Tokens have been renamed and <XML_ITERATIVE> has been added (#i35017#)
+ TOKEN( "once-successive", XML_ONCE_SUCCESSIVE ),
+ TOKEN( "once-concurrent", XML_ONCE_CONCURRENT ),
+
+ // Names for OOo format only
+ TOKEN( "http://openoffice.org/2000/office", XML_N_OFFICE_OOO ),
+ TOKEN( "http://openoffice.org/2000/meta", XML_N_META_OOO ),
+ TOKEN( "http://openoffice.org/2000/style", XML_N_STYLE_OOO ),
+ TOKEN( "http://openoffice.org/2000/datastyle", XML_N_NUMBER_OOO ),
+ TOKEN( "http://openoffice.org/2000/text", XML_N_TEXT_OOO ),
+ TOKEN( "http://openoffice.org/2000/table", XML_N_TABLE_OOO ),
+ TOKEN( "http://openoffice.org/2000/drawing", XML_N_DRAW_OOO ),
+ TOKEN( "http://openoffice.org/2000/dr3d", XML_N_DR3D_OOO ),
+ TOKEN( "http://openoffice.org/2000/presentation",XML_N_PRESENTATION_OOO ),
+ TOKEN( "http://openoffice.org/2000/chart", XML_N_CHART_OOO ),
+ TOKEN( "http://openoffice.org/2001/config", XML_N_CONFIG_OOO ),
+ TOKEN( "http://openoffice.org/2000/form", XML_N_FORM_OOO ),
+ TOKEN( "http://openoffice.org/2000/script", XML_N_SCRIPT_OOO ),
+
+ TOKEN( "global", XML_GLOBAL ),
+
+ TOKEN( "note-class", XML_NOTE_CLASS ),
+ TOKEN( "note-citation", XML_NOTE_CITATION ),
+ TOKEN( "note-body", XML_NOTE_BODY ),
+ TOKEN( "notes-configuration", XML_NOTES_CONFIGURATION ),
+ TOKEN( "note-ref", XML_NOTE_REF ),
+ TOKEN( "is-sub-table", XML_IS_SUB_TABLE ),
+ TOKEN( "page-layout", XML_PAGE_LAYOUT ),
+ TOKEN( "page-layout-name", XML_PAGE_LAYOUT_NAME ),
+ TOKEN( "graphic-properties", XML_GRAPHIC_PROPERTIES ),
+ TOKEN( "drawing-page-properties", XML_DRAWING_PAGE_PROPERTIES ),
+ TOKEN( "page-layout-properties", XML_PAGE_LAYOUT_PROPERTIES ),
+ TOKEN( "header-footer-properties", XML_HEADER_FOOTER_PROPERTIES ),
+ TOKEN( "text-properties", XML_TEXT_PROPERTIES ),
+ TOKEN( "paragraph-properties", XML_PARAGRAPH_PROPERTIES ),
+ TOKEN( "ruby-properties", XML_RUBY_PROPERTIES ),
+ TOKEN( "section-properties", XML_SECTION_PROPERTIES ),
+ TOKEN( "table-properties", XML_TABLE_PROPERTIES ),
+ TOKEN( "table-column-properties", XML_TABLE_COLUMN_PROPERTIES ),
+ TOKEN( "table-row-properties", XML_TABLE_ROW_PROPERTIES ),
+ TOKEN( "table-cell-properties", XML_TABLE_CELL_PROPERTIES ),
+ TOKEN( "list-level-properties", XML_LIST_LEVEL_PROPERTIES ),
+ TOKEN( "chart-properties", XML_CHART_PROPERTIES ),
+ TOKEN( "drawing-page", XML_DRAWING_PAGE ),
+ TOKEN( "graphics", XML_GRAPHICS ),
+ TOKEN( "tab", XML_TAB ),
+ TOKEN( "text-underline-mode", XML_TEXT_UNDERLINE_MODE ),
+ TOKEN( "text-line-through-mode", XML_TEXT_LINE_THROUGH_MODE ),
+ TOKEN( "continuous", XML_CONTINUOUS ),
+ TOKEN( "skip-white-space", XML_SKIP_WHITE_SPACE ),
+ TOKEN( "scripts", XML_SCRIPTS ),
+ TOKEN( "font-face-decls", XML_FONT_FACE_DECLS ),
+ TOKEN( "font-face", XML_FONT_FACE ),
+ TOKEN( "font-adornments", XML_FONT_ADORNMENTS ),
+ TOKEN( "inch", XML_INCH ),
+ TOKEN( "space-after", XML_SPACE_AFTER ),
+ TOKEN( "start-indent", XML_START_INDENT ),
+ TOKEN( "end-indent", XML_END_INDENT ),
+
+ // chart Oasis format additions
+ TOKEN( "interval-minor-divisor", XML_INTERVAL_MINOR_DIVISOR ),
+ TOKEN( "date-string", XML_DATE_STRING ),
+
+ TOKEN( "text-underline-style", XML_TEXT_UNDERLINE_STYLE ),
+ TOKEN( "text-underline-type", XML_TEXT_UNDERLINE_TYPE ),
+ TOKEN( "text-underline-width", XML_TEXT_UNDERLINE_WIDTH ),
+
+ TOKEN( "text-overline-type", XML_TEXT_OVERLINE_TYPE ),
+ TOKEN( "text-overline-style", XML_TEXT_OVERLINE_STYLE ),
+ TOKEN( "text-overline-width", XML_TEXT_OVERLINE_WIDTH ),
+ TOKEN( "text-overline-color", XML_TEXT_OVERLINE_COLOR ),
+ TOKEN( "text-overline-mode", XML_TEXT_OVERLINE_MODE ),
+
+ TOKEN( "text-line-through-style", XML_TEXT_LINE_THROUGH_STYLE ),
+ TOKEN( "text-line-through-type", XML_TEXT_LINE_THROUGH_TYPE ),
+ TOKEN( "text-line-through-width", XML_TEXT_LINE_THROUGH_WIDTH ),
+ TOKEN( "text-line-through-text", XML_TEXT_LINE_THROUGH_TEXT ),
+
+ TOKEN( "leader-style", XML_LEADER_STYLE ),
+ TOKEN( "leader-text", XML_LEADER_TEXT ),
+
+ TOKEN( "bold-dotted", XML_BOLD_DOTTED ),
+ TOKEN( "bold-dash", XML_BOLD_DASH ),
+ TOKEN( "bold-long-dash", XML_BOLD_LONG_DASH ),
+ TOKEN( "bold-dot-dash", XML_BOLD_DOT_DASH ),
+ TOKEN( "bold-dot-dot-dash", XML_BOLD_DOT_DOT_DASH ),
+ TOKEN( "bold-wave", XML_BOLD_WAVE ),
+ TOKEN( "double-wave", XML_DOUBLE_WAVE ),
+ TOKEN( "double-line", XML_DOUBLE_LINE ),
+ TOKEN( "thick-line", XML_THICK_LINE ),
+ TOKEN( "single-line", XML_SINGLE_LINE ),
+ TOKEN( "slash", XML_SLASH ),
+ TOKEN( "text-line-through-color", XML_TEXT_LINE_THROUGH_COLOR ),
+ TOKEN( "text-line-through-text-style", XML_TEXT_LINE_THROUGH_TEXT_STYLE ),
+ TOKEN( "leader-color", XML_LEADER_COLOR ),
+ TOKEN( "leader-type", XML_LEADER_TYPE ),
+ TOKEN( "leader-width", XML_LEADER_WIDTH ),
+ TOKEN( "leader-text-style", XML_LEADER_TEXT_STYLE ),
+
+ TOKEN( "opacity", XML_OPACITY ),
+ TOKEN( "opacity-name", XML_OPACITY_NAME ),
+ TOKEN( "shadow-opacity", XML_SHADOW_OPACITY ),
+ TOKEN( "always", XML_ALWAYS ),
+ TOKEN( "count-in-text-boxes", XML_COUNT_IN_TEXT_BOXES ),
+
+ TOKEN( "ooo", XML_NP_OOO ),
+ TOKEN( "http://openoffice.org/2004/office", XML_N_OOO ),
+ TOKEN( "ooow", XML_NP_OOOW ),
+ TOKEN( "http://openoffice.org/2004/writer", XML_N_OOOW ),
+ TOKEN( "oooc", XML_NP_OOOC ),
+ TOKEN( "http://openoffice.org/2004/calc", XML_N_OOOC ),
+ TOKEN( "dom", XML_NP_DOM ),
+ TOKEN( "http://www.w3.org/2001/xml-events", XML_N_DOM ),
+
+ TOKEN( "event-listeners", XML_EVENT_LISTENERS ),
+ TOKEN( "event-listener", XML_EVENT_LISTENER ),
+
+ TOKEN( "form", XML_FORM ),
+ TOKEN( "void", XML_VOID ),
+ TOKEN( "property", XML_PROPERTY ),
+ TOKEN( "property-name", XML_PROPERTY_NAME ),
+ TOKEN( "list-property", XML_LIST_PROPERTY ),
+ TOKEN( "list-value", XML_LIST_VALUE ),
+ TOKEN( "column-style-name", XML_COLUMN_STYLE_NAME ),
+ TOKEN( "textarea", XML_TEXTAREA ),
+ TOKEN( "fixed-text", XML_FIXED_TEXT ),
+ TOKEN( "file", XML_FILE ),
+ TOKEN( "formatted-text", XML_FORMATTED_TEXT ),
+ TOKEN( "button", XML_BUTTON ),
+ TOKEN( "checkbox", XML_CHECKBOX ),
+ TOKEN( "radio", XML_RADIO ),
+ TOKEN( "listbox", XML_LISTBOX ),
+ TOKEN( "combobox", XML_COMBOBOX ),
+ TOKEN( "image-frame", XML_IMAGE_FRAME ),
+ TOKEN( "value-range", XML_VALUE_RANGE ),
+ TOKEN( "generic-control", XML_GENERIC_CONTROL ),
+ TOKEN( "service-name", XML_SERVICE_NAME ),
+ TOKEN( "property-type", XML_PROPERTY_TYPE ),
+ TOKEN( "integer", XML_INTEGER ),
+ TOKEN( "property-is-void", XML_PROPERTY_IS_VOID ),
+ TOKEN( "property-is-list", XML_PROPERTY_IS_LIST ),
+ TOKEN( "property-value", XML_PROPERTY_VALUE ),
+ TOKEN( "mimetype", XML_MIMETYPE ),
+ TOKEN( "database-row-select", XML_DATABASE_ROW_SELECT ),
+ TOKEN( "control-implementation", XML_CONTROL_IMPLEMENTATION ),
+ TOKEN( "interpolation", XML_INTERPOLATION ),
+ TOKEN( "cubic-spline", XML_CUBIC_SPLINE ),
+ TOKEN( "b-spline", XML_B_SPLINE ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:database:1.0", XML_N_DB_OASIS ),
+
+ TOKEN( "show-filter-button", XML_SHOW_FILTER_BUTTON ),
+ TOKEN( "drill-down-on-double-click", XML_DRILL_DOWN_ON_DOUBLE_CLICK ),
+ TOKEN( "header-grid-layout", XML_HEADER_GRID_LAYOUT ),
+ TOKEN( "grouped-by", XML_GROUPED_BY ),
+ TOKEN( "days", XML_DAYS ),
+ TOKEN( "months", XML_MONTHS ),
+ TOKEN( "quarters", XML_QUARTERS ),
+ TOKEN( "years", XML_YEARS ),
+ TOKEN( "date-start", XML_DATE_START ),
+ TOKEN( "date-end", XML_DATE_END ),
+ TOKEN( "step", XML_STEP ),
+ TOKEN( "is-group-field", XML_IS_GROUP_FIELD ),
+ TOKEN( "data-pilot-groups", XML_DATA_PILOT_GROUPS ),
+ TOKEN( "data-pilot-group", XML_DATA_PILOT_GROUP ),
+ TOKEN( "japanese-candle-stick", XML_JAPANESE_CANDLE_STICK ),
+ TOKEN( "named-symbol", XML_NAMED_SYMBOL ),
+ TOKEN( "diamond", XML_DIAMOND ),
+ TOKEN( "arrow-down", XML_ARROW_DOWN ),
+ TOKEN( "arrow-up", XML_ARROW_UP ),
+ TOKEN( "arrow-right", XML_ARROW_RIGHT ),
+ TOKEN( "arrow-left", XML_ARROW_LEFT ),
+ TOKEN( "bow-tie", XML_BOW_TIE ),
+ TOKEN( "hourglass", XML_HOURGLASS ),
+ TOKEN( "symbol-name", XML_SYMBOL_NAME ),
+ TOKEN( "symbol-type", XML_SYMBOL_TYPE ),
+ TOKEN( "image-opacity", XML_IMAGE_OPACITY ), // #i25616#
+
+ TOKEN( "default-outline-level", XML_DEFAULT_OUTLINE_LEVEL ),
+ TOKEN( "show-details", XML_SHOW_DETAILS ),
+ TOKEN( "show-empty", XML_SHOW_EMPTY ),
+ TOKEN( "iterative", XML_ITERATIVE ),
+
+ TOKEN( "X", XML_uX ),
+ TOKEN( "dlg", XML_NP_DLG ),
+ TOKEN( "http://openoffice.org/2000/dialog", XML_N_DLG ),
+ TOKEN( "script-data", XML_SCRIPT_DATA ),
+ TOKEN( "libraries", XML_LIBRARIES ),
+ TOKEN( "source-code", XML_SOURCE_CODE ),
+ TOKEN( "readonly", XML_READONLY ),
+ TOKEN( "z", XML_Z ),
+ TOKEN( "dimension", XML_DIMENSION ),
+ TOKEN( "validation-name", XML_VALIDATION_NAME ),
+
+ TOKEN( "screen", XML_SCREEN ),
+ TOKEN( "printer", XML_PRINTER ),
+
+ // XForms token
+ TOKEN( "model", XML_MODEL ),
+ TOKEN( "schema", XML_SCHEMA ),
+ TOKEN( "bind", XML_BIND ),
+ TOKEN( "instance", XML_INSTANCE ),
+ TOKEN( "submission", XML_SUBMISSION ),
+ TOKEN( "ref", XML_REF ),
+ TOKEN( "src", XML_SRC ),
+ TOKEN( "method", XML_METHOD ),
+ TOKEN( "nodeset", XML_NODESET ),
+ TOKEN( "indent", XML_INDENT ),
+ TOKEN( "omit-xml-declaration", XML_OMIT_XML_DECLARATION ),
+ TOKEN( "standalone", XML_STANDALONE ),
+ TOKEN( "cdata-section-elements", XML_CDATA_SECTION_ELEMENTS ),
+ TOKEN( "required", XML_REQUIRED ),
+ TOKEN( "relevant", XML_RELEVANT ),
+ TOKEN( "calculate", XML_CALCULATE ),
+ TOKEN( "constraint", XML_CONSTRAINT ),
+ TOKEN( "maxOccurs", XML_MAXOCCURS /* (maxOccurs) */ ),
+ TOKEN( "minOccurs", XML_MINOCCURS /* (minOccurs) */ ),
+ TOKEN( "p3ptype", XML_P3PTYPE ),
+ TOKEN( "mediatype", XML_MEDIATYPE ),
+ TOKEN( "includenamespaceprefixes", XML_INCLUDENAMESPACEPREFIXES ),
+
+ // XForms/XSD Schema tokens
+ TOKEN( "base", XML_BASE ),
+ TOKEN( "targetNamespace", XML_TARGETNAMESPACE ),
+ TOKEN( "simpleType", XML_SIMPLETYPE ),
+ TOKEN( "restriction", XML_RESTRICTION ),
+ TOKEN( "maxLength", XML_MAXLENGTH ),
+ TOKEN( "minLength", XML_MINLENGTH ),
+ TOKEN( "minInclusive", XML_MININCLUSIVE ),
+ TOKEN( "minExclusive", XML_MINEXCLUSIVE ),
+ TOKEN( "maxInclusive", XML_MAXINCLUSIVE ),
+ TOKEN( "maxExclusive", XML_MAXEXCLUSIVE ),
+ TOKEN( "pattern", XML_PATTERN ),
+ TOKEN( "enumeration", XML_ENUMERATION ),
+ TOKEN( "whiteSpace", XML_WHITESPACE ),
+ TOKEN( "totalDigits", XML_TOTALDIGITS ),
+ TOKEN( "fractionDigits", XML_FRACTIONDIGITS ),
+ TOKEN( "preserve", XML_PRESERVE ),
+ TOKEN( "anyURI", XML_ANYURI ),
+ TOKEN( "dateTime", XML_DATETIME_XSD ),
+ TOKEN( "main-etry", XML_MAIN_ETRY),
+
+ TOKEN( "remove", XML_REMOVE ),
+ TOKEN( "hold", XML_HOLD ),
+ TOKEN( "transition", XML_TRANSITION ),
+ TOKEN( "inherit", XML_INHERIT ),
+ TOKEN( "fillDefault", XML_FILLDEFAULT ),
+ TOKEN( "restart", XML_RESTART ),
+ TOKEN( "restartDefault", XML_RESTARTDEFAULT ),
+ TOKEN( "whenNotActive", XML_WHENNOTACTIVE ),
+ TOKEN( "never", XML_NEVER ),
+ TOKEN( "accelerate", XML_ACCELERATE ),
+ TOKEN( "decelerate", XML_DECELERATE ),
+ TOKEN( "autoReverse", XML_AUTOREVERSE ),
+ TOKEN( "indefinite", XML_INDEFINITE ),
+ TOKEN( "repeatCount", XML_REPEATCOUNT ),
+ TOKEN( "repeatDur", XML_REPEATDUR ),
+ TOKEN( "endsync", XML_ENDSYNC ),
+ TOKEN( "first", XML_FIRST ),
+ TOKEN( "last", XML_LAST ),
+ TOKEN( "media", XML_MEDIA ),
+ TOKEN( "dur", XML_DUR ),
+ TOKEN( "begin", XML_BEGIN ),
+ TOKEN( "whole", XML_WHOLE ),
+ TOKEN( "from", XML_FROM ),
+ TOKEN( "to", XML_TO ),
+ TOKEN( "by", XML_BY ),
+ TOKEN( "values", XML_VALUES ),
+ TOKEN( "keyTimes", XML_KEYTIMES ),
+ TOKEN( "keySplines", XML_KEYSPLINES ),
+ TOKEN( "calcMode", XML_CALCMODE ),
+ TOKEN( "discrete", XML_DISCRETE ),
+ TOKEN( "paced", XML_PACED ),
+ TOKEN( "spline", XML_SPLINE ),
+ TOKEN( "accumulate", XML_ACCUMULATE ),
+ TOKEN( "additive", XML_ADDITIVE ),
+ TOKEN( "multiply", XML_MULTIPLY ),
+ TOKEN( "animate", XML_ANIMATE ),
+ TOKEN( "animateMotion", XML_ANIMATEMOTION ),
+ TOKEN( "animateTransform", XML_ANIMATETRANSFORM ),
+ TOKEN( "animateColor", XML_ANIMATECOLOR ),
+ TOKEN( "transitionFilter", XML_TRANSITIONFILTER ),
+ TOKEN( "attributeName", XML_ATTRIBUTENAME ),
+
+ TOKEN( "smil", XML_NP_SMIL ),
+ TOKEN( "http://www.w3.org/2001/SMIL20/", XML_N_SMIL ),
+
+ TOKEN( "anim", XML_NP_ANIMATION ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:animation:1.0", XML_N_ANIMATION ),
+
+ TOKEN( "par", XML_PAR ),
+ TOKEN( "seq", XML_SEQ ),
+
+ TOKEN( "translate", XML_TRANSLATE ),
+ TOKEN( "skewX", XML_SKEWX ),
+ TOKEN( "skewY", XML_SKEWY ),
+
+ TOKEN( "audio", XML_AUDIO ),
+
+ TOKEN( "color-interpolation", XML_COLOR_INTERPOLATION ),
+ TOKEN( "color-interpolation-direction", XML_COLOR_INTERPOLATION_DIRECTION ),
+ TOKEN( "hsl", XML_HSL ),
+ TOKEN( "rgb", XML_RGB ),
+
+ TOKEN( "barWipe", XML_BARWIPE ),
+ TOKEN( "boxWipe", XML_BOXWIPE ),
+ TOKEN( "fourBoxWipe", XML_FOURBOXWIPE ),
+ TOKEN( "barnDoorWipe", XML_BARNDOORWIPE ),
+ TOKEN( "diagonalWipe", XML_DIAGONALWIPE ),
+ TOKEN( "bowTieWipe", XML_BOWTIEWIPE ),
+ TOKEN( "miscDiagonalWipe", XML_MISCDIAGONALWIPE ),
+ TOKEN( "veeWipe", XML_VEEWIPE ),
+ TOKEN( "barnVeeWipe", XML_BARNVEEWIPE ),
+ TOKEN( "zigZagWipe", XML_ZIGZAGWIPE ),
+ TOKEN( "barnZigZagWipe", XML_BARNZIGZAGWIPE ),
+ TOKEN( "irisWipe", XML_IRISWIPE ),
+ TOKEN( "triangleWipe", XML_TRIANGLEWIPE ),
+ TOKEN( "arrowHeadWipe", XML_ARROWHEADWIPE ),
+ TOKEN( "pentagonWipe", XML_PENTAGONWIPE ),
+ TOKEN( "hexagonWipe", XML_HEXAGONWIPE ),
+ TOKEN( "ellipseWipe", XML_ELLIPSEWIPE ),
+ TOKEN( "eyeWipe", XML_EYEWIPE ),
+ TOKEN( "roundRectWipe", XML_ROUNDRECTWIPE ),
+ TOKEN( "starWipe", XML_STARWIPE ),
+ TOKEN( "miscShapeWipe", XML_MISCSHAPEWIPE ),
+ TOKEN( "clockWipe", XML_CLOCKWIPE ),
+ TOKEN( "pinWheelWipe", XML_PINWHEELWIPE ),
+ TOKEN( "singleSweepWipe", XML_SINGLESWEEPWIPE ),
+ TOKEN( "fanWipe", XML_FANWIPE ),
+ TOKEN( "doubleFanWipe", XML_DOUBLEFANWIPE ),
+ TOKEN( "doubleSweepWipe", XML_DOUBLESWEEPWIPE ),
+ TOKEN( "saloonDoorWipe", XML_SALOONDOORWIPE ),
+ TOKEN( "windshieldWipe", XML_WINDSHIELDWIPE ),
+ TOKEN( "snakeWipe", XML_SNAKEWIPE ),
+ TOKEN( "spiralWipe", XML_SPIRALWIPE ),
+ TOKEN( "parallelSnakesWipe", XML_PARALLELSNAKESWIPE ),
+ TOKEN( "boxSnakesWipe", XML_BOXSNAKESWIPE ),
+ TOKEN( "waterfallWipe", XML_WATERFALLWIPE ),
+ TOKEN( "pushWipe", XML_PUSHWIPE ),
+ TOKEN( "slideWipe", XML_SLIDEWIPE ),
+ TOKEN( "blindsWipe", XML_BLINDSWIPE ),
+ TOKEN( "randomBarWipe", XML_RANDOMBARWIPE ),
+ TOKEN( "checkerBoardWipe", XML_CHECKERBOARDWIPE ),
+ TOKEN( "zoom", XML_ZOOM ),
+
+ TOKEN( "leftToRight", XML_LEFTTORIGHT ),
+ TOKEN( "topToBottom", XML_TOPTOBOTTOM ),
+ TOKEN( "topLeft", XML_TOPLEFT ),
+ TOKEN( "topRight", XML_TOPRIGHT ),
+ TOKEN( "bottomRight", XML_BOTTOMRIGHT ),
+ TOKEN( "bottomLeft", XML_BOTTOMLEFT ),
+ TOKEN( "topCenter", XML_TOPCENTER ),
+ TOKEN( "rightCenter", XML_RIGHTCENTER ),
+ TOKEN( "bottomCenter", XML_BOTTOMCENTER ),
+ TOKEN( "leftCenter", XML_LEFTCENTER ),
+ TOKEN( "cornersIn", XML_CORNERSIN ),
+ TOKEN( "cornersOut", XML_CORNERSOUT ),
+ TOKEN( "diagonalBottomLeft", XML_DIAGONALBOTTOMLEFT ),
+ TOKEN( "diagonalTopLeft", XML_DIAGONALTOPLEFT ),
+ TOKEN( "doubleBarnDoor", XML_DOUBLEBARNDOOR ),
+ TOKEN( "doubleDiamond", XML_DOUBLEDIAMOND ),
+ TOKEN( "fourPoint", XML_FOURPOINT ),
+ TOKEN( "fivePoint", XML_FIVEPOINT ),
+ TOKEN( "sixPoint", XML_SIXPOINT ),
+ TOKEN( "heart", XML_HEART ),
+ TOKEN( "keyhole", XML_KEYHOLE ),
+ TOKEN( "clockwiseTwelve", XML_CLOCKWISETWELVE ),
+ TOKEN( "clockwiseThree", XML_CLOCKWISETHREE ),
+ TOKEN( "clockwiseSix", XML_CLOCKWISESIX ),
+ TOKEN( "clockwiseNine", XML_CLOCKWISENINE ),
+ TOKEN( "twoBladeVertical", XML_TWOBLADEVERTICAL ),
+ TOKEN( "twoBladeHorizontal", XML_TWOBLADEHORIZONTAL ),
+ TOKEN( "fourBlade", XML_FOURBLADE ),
+ TOKEN( "clockwiseTop", XML_CLOCKWISETOP ),
+ TOKEN( "clockwiseRight", XML_CLOCKWISERIGHT ),
+ TOKEN( "clockwiseBottom", XML_CLOCKWISEBOTTOM ),
+ TOKEN( "clockwiseLeft", XML_CLOCKWISELEFT ),
+ TOKEN( "clockwiseTopLeft", XML_CLOCKWISETOPLEFT ),
+ TOKEN( "counterClockwiseBottomLeft", XML_COUNTERCLOCKWISEBOTTOMLEFT ),
+ TOKEN( "clockwiseBottomRight", XML_CLOCKWISEBOTTOMRIGHT ),
+ TOKEN( "counterClockwiseTopRight", XML_COUNTERCLOCKWISETOPRIGHT ),
+ TOKEN( "centerTop", XML_CENTERTOP ),
+ TOKEN( "centerRight", XML_CENTERRIGHT ),
+ TOKEN( "fanOutVertical", XML_FANOUTVERTICAL ),
+ TOKEN( "fanOutHorizontal", XML_FANOUTHORIZONTAL ),
+ TOKEN( "fanInVertical", XML_FANINVERTICAL ),
+ TOKEN( "fanInHorizontal", XML_FANINHORIZONTAL ),
+ TOKEN( "parallelVertical", XML_PARALLELVERTICAL ),
+ TOKEN( "parallelDiagonal", XML_PARALLELDIAGONAL ),
+ TOKEN( "oppositeVertical", XML_OPPOSITEVERTICAL ),
+ TOKEN( "oppositeHorizontal", XML_OPPOSITEHORIZONTAL ),
+ TOKEN( "parallelDiagonalTopLeft", XML_PARALLELDIAGONALTOPLEFT ),
+ TOKEN( "parallelDiagonalBottomLeft", XML_PARALLELDIAGONALBOTTOMLEFT ),
+ TOKEN( "topLeftHorizontal", XML_TOPLEFTHORIZONTAL ),
+ TOKEN( "topLeftDiagonal", XML_TOPLEFTDIAGONAL ),
+ TOKEN( "topLeftVertical", XML_TOPLEFTVERTICAL ),
+ TOKEN( "topRightDiagonal", XML_TOPRIGHTDIAGONAL ),
+ TOKEN( "bottomRightDiagonal", XML_BOTTOMRIGHTDIAGONAL ),
+ TOKEN( "bottomLeftDiagonal", XML_BOTTOMLEFTDIAGONAL ),
+ TOKEN( "topLeftClockwise", XML_TOPLEFTCLOCKWISE ),
+ TOKEN( "topRightClockwise", XML_TOPRIGHTCLOCKWISE ),
+ TOKEN( "bottomRightClockwise", XML_BOTTOMRIGHTCLOCKWISE ),
+ TOKEN( "bottomLeftClockwise", XML_BOTTOMLEFTCLOCKWISE ),
+ TOKEN( "topLeftCounterClockwise", XML_TOPLEFTCOUNTERCLOCKWISE ),
+ TOKEN( "topRightCounterClockwise", XML_TOPRIGHTCOUNTERCLOCKWISE ),
+ TOKEN( "bottomRightCounterClockwise", XML_BOTTOMRIGHTCOUNTERCLOCKWISE ),
+ TOKEN( "bottomLeftCounterClockwise", XML_BOTTOMLEFTCOUNTERCLOCKWISE ),
+ TOKEN( "verticalTopSame", XML_VERTICALTOPSAME ),
+ TOKEN( "verticalBottomSame", XML_VERTICALBOTTOMSAME ),
+ TOKEN( "verticalTopLeftOpposite", XML_VERTICALTOPLEFTOPPOSITE ),
+ TOKEN( "verticalBottomLeftOpposite", XML_VERTICALBOTTOMLEFTOPPOSITE ),
+ TOKEN( "horizontalLeftSame", XML_HORIZONTALLEFTSAME ),
+ TOKEN( "horizontalRightSame", XML_HORIZONTALRIGHTSAME ),
+ TOKEN( "horizontalTopLeftOpposite", XML_HORIZONTALTOPLEFTOPPOSITE ),
+ TOKEN( "horizontalTopRightOpposite", XML_HORIZONTALTOPRIGHTOPPOSITE ),
+ TOKEN( "diagonalBottomLeftOpposite", XML_DIAGONALBOTTOMLEFTOPPOSITE ),
+ TOKEN( "diagonalTopLeftOpposite", XML_DIAGONALTOPLEFTOPPOSITE ),
+ TOKEN( "twoBoxTop", XML_TWOBOXTOP ),
+ TOKEN( "twoBoxBottom", XML_TWOBOXBOTTOM ),
+ TOKEN( "twoBoxLeft", XML_TWOBOXLEFT ),
+ TOKEN( "twoBoxRight", XML_TWOBOXRIGHT ),
+ TOKEN( "fourBoxVertical", XML_FOURBOXVERTICAL ),
+ TOKEN( "fourBoxHorizontal", XML_FOURBOXHORIZONTAL ),
+ TOKEN( "verticalLeft", XML_VERTICALLEFT ),
+ TOKEN( "verticalRight", XML_VERTICALRIGHT ),
+ TOKEN( "horizontalLeft", XML_HORIZONTALLEFT ),
+ TOKEN( "horizontalRight", XML_HORIZONTALRIGHT ),
+ TOKEN( "fromLeft", XML_FROMLEFT ),
+ TOKEN( "fromTop", XML_FROMTOP ),
+ TOKEN( "fromRight", XML_FROMRIGHT ),
+ TOKEN( "fromBottom", XML_FROMBOTTOM ),
+ TOKEN( "crossfade", XML_CROSSFADE ),
+ TOKEN( "fadeToColor", XML_FADETOCOLOR ),
+ TOKEN( "fadeFromColor", XML_FADEFROMCOLOR ),
+ TOKEN( "fadeOverColor", XML_FADEOVERCOLOR ),
+ TOKEN( "threeBlade", XML_THREEBLADE ),
+ TOKEN( "eightBlade", XML_EIGHTBLADE ),
+ TOKEN( "oneBlade", XML_ONEBLADE ),
+ TOKEN( "across", XML_ACROSS ),
+ TOKEN( "combHorizontal", XML_COMBHORIZONTAL ),
+ TOKEN( "combVertical", XML_COMBVERTICAL ),
+ TOKEN( "rotateIn", XML_ROTATEIN ),
+ TOKEN( "rotateOut", XML_ROTATEOUT ),
+ TOKEN( "fromTopLeft", XML_FROMTOPLEFT ),
+ TOKEN( "fromTopRight", XML_FROMTOPRIGHT ),
+ TOKEN( "fromBottomLeft", XML_FROMBOTTOMLEFT ),
+ TOKEN( "fromBottomRight", XML_FROMBOTTOMRIGHT ),
+
+ TOKEN( "subtype", XML_SUBTYPE ),
+ TOKEN( "out", XML_OUT ),
+
+ TOKEN( "forward", XML_FORWARD ),
+ TOKEN( "reverse", XML_REVERSE ),
+
+ TOKEN( "fadeColor", XML_FADECOLOR ),
+
+ TOKEN( "onbegin", XML_ONBEGIN ),
+ TOKEN( "onend", XML_ONEND ),
+ TOKEN( "click", XML_CLICK ),
+ TOKEN( "doubleclick", XML_DOUBLECLICK ),
+ TOKEN( "mouseover", XML_MOUSEOVER ),
+ TOKEN( "mouseout", XML_MOUSEOUT ),
+
+ TOKEN( "node-type", XML_NODE_TYPE ),
+ TOKEN( "preset-id", XML_PRESET_ID ),
+ TOKEN( "preset-sub-type", XML_PRESET_SUB_TYPE ),
+ TOKEN( "preset-class", XML_PRESET_CLASS ),
+ TOKEN( "custom", XML_CUSTOM ),
+ TOKEN( "entrance", XML_ENTRANCE ),
+ TOKEN( "exit", XML_EXIT ),
+ TOKEN( "emphasis", XML_EMPHASIS ),
+ TOKEN( "motion-path", XML_MOTION_PATH ),
+ TOKEN( "ole-action", XML_OLE_ACTION ),
+ TOKEN( "media-call", XML_MEDIA_CALL ),
+ TOKEN( "on-click", XML_ON_CLICK ),
+ TOKEN( "with-previous", XML_WITH_PREVIOUS ),
+ TOKEN( "after-previous", XML_AFTER_PREVIOUS ),
+ TOKEN( "main-sequence", XML_MAIN_SEQUENCE ),
+ TOKEN( "timing-root", XML_TIMING_ROOT ),
+ TOKEN( "interactive-sequence",XML_INTERACTIVE_SEQUENCE ),
+
+ TOKEN( "sub-item", XML_SUB_ITEM ),
+ TOKEN( "iterate-type", XML_ITERATE_TYPE ),
+ TOKEN( "iterate-interval", XML_ITERATE_INTERVAL ),
+ TOKEN( "iterate", XML_ITERATE ),
+ TOKEN( "by-paragraph", XML_BY_PARAGRAPH ),
+ TOKEN( "by-word", XML_BY_WORD ),
+ TOKEN( "by-letter", XML_BY_LETTER ),
+
+ TOKEN( "after-effect", XML_AFTER_EFFECT ),
+ TOKEN( "master", XML_MASTER ),
+
+ TOKEN( "group-id", XML_GROUP_ID ),
+ TOKEN( "targetElement", XML_TARGETELEMENT ),
+ TOKEN( "toggle-pause", XML_TOGGLE_PAUSE ),
+ TOKEN( "master-element", XML_MASTER_ELEMENT ),
+ TOKEN( "stop-audio", XML_STOP_AUDIO ),
+
+ TOKEN( "audio-level", XML_AUDIO_LEVEL ),
+
+ TOKEN( "urn:oasis:names:tc", XML_URN_OASIS_NAMES_TC ),
+ TOKEN( "opendocument", XML_OPENDOCUMENT),
+ TOKEN( "1.0", XML_1_0 ),
+
+ TOKEN( "is-list-header", XML_IS_LIST_HEADER ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0", XML_N_SVG_COMPAT ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0", XML_N_FO_COMPAT ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0", XML_N_SMIL_COMPAT ),
+ TOKEN( "http://www.w3.org/2001/SMIL20", XML_N_SMIL_OLD ),
+ TOKEN( "xforms-submission", XML_XFORMS_SUBMISSION ),
+ TOKEN( "xforms-list-source", XML_XFORMS_LIST_SOURCE ),
+
+ TOKEN( "http://www.w3.org/", XML_URI_W3_PREFIX ),
+ TOKEN( "/xforms", XML_URI_XFORMS_SUFFIX ),
+ /* XML_HORIZONTAL_ON_LEFT_PAGES and XML_HORIZONTAL_ON_RIGHT_PAGES
+ are replaced by XML_HORIZONTAL_ON_EVEN and XML_HORIZONTAL_ON_ODD. (#i49139#)
+ */
+ TOKEN( "horizontal-on-even", XML_HORIZONTAL_ON_EVEN ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:report:1.0", XML_N_RPT_OASIS ),
+ TOKEN( "http://openoffice.org/2005/report", XML_N_RPT ),
+ TOKEN( "group", XML_GROUP ),
+ TOKEN( "groups", XML_GROUPS ),
+ TOKEN( "report-header", XML_REPORT_HEADER ),
+ TOKEN( "page-header", XML_PAGE_HEADER ),
+ TOKEN( "detail", XML_DETAIL ),
+ TOKEN( "page-footer", XML_PAGE_FOOTER ),
+ TOKEN( "report-footer", XML_REPORT_FOOTER ),
+ TOKEN( "start-new-column", XML_START_NEW_COLUMN ),
+ TOKEN( "reset-page-number", XML_RESET_PAGE_NUMBER ),
+ TOKEN( "print-header-on-each-page", XML_PRINT_HEADER_ON_EACH_PAGE ),
+ TOKEN( "group-expression", XML_GROUP_EXPRESSION ),
+ TOKEN( "group-header", XML_GROUP_HEADER ),
+ TOKEN( "group-footer", XML_GROUP_FOOTER ),
+ TOKEN( "header-on-new-page", XML_HEADER_ON_NEW_PAGE),
+ TOKEN( "footer-on-new-page", XML_FOOTER_ON_NEW_PAGE),
+ TOKEN( "page-print-option", XML_PAGE_PRINT_OPTION ),
+ TOKEN( "pre-evaluated", XML_PRE_EVALUATED),
+ TOKEN( "command-type", XML_COMMAND_TYPE ),
+ TOKEN( "master-fields", XML_MASTER_FIELDS ),
+ TOKEN( "detail-fields", XML_DETAIL_FIELDS ),
+ TOKEN( "conditional-print-expression", XML_CONDITIONAL_PRINT_EXPRESSION ),
+ TOKEN( "report-component", XML_REPORT_COMPONENT ),
+ TOKEN( "print-repeated-values", XML_PRINT_REPEATED_VALUES ),
+ TOKEN( "repeat-section", XML_REPEAT_SECTION ),
+ TOKEN( "force-new-column", XML_FORCE_NEW_COLUMN ),
+ TOKEN( "group-on", XML_GROUP_ON),
+ TOKEN( "force-new-page", XML_FORCE_NEW_PAGE),
+ TOKEN( "group-interval", XML_GROUP_INTERVAL),
+ TOKEN( "print-only-when-group-change", XML_PRINT_ONLY_WHEN_GROUP_CHANGE),
+ TOKEN( "report-element", XML_REPORT_ELEMENT),
+ TOKEN( "list-source", XML_LIST_SOURCE),
+ TOKEN( "list-source-type", XML_LIST_SOURCE_TYPE),
+ TOKEN( "image-data", XML_IMAGE_DATA),
+ TOKEN( "selected", XML_SELECTED),
+ TOKEN( "current-state", XML_CURRENT_STATE),
+ TOKEN( "is-tristate", XML_IS_TRISTATE),
+ TOKEN( "all-pages", XML_ALL_PAGES),
+ TOKEN( "not-with-report-header", XML_NOT_WITH_REPORT_HEADER ),
+ TOKEN( "not-with-report-footer", XML_NOT_WITH_REPORT_FOOTER ),
+ TOKEN( "not-with-report-header-nor-footer", XML_NOT_WITH_REPORT_HEADER_NOR_FOOTER ),
+ TOKEN( "before-section", XML_BEFORE_SECTION ),
+ TOKEN( "after-section", XML_AFTER_SECTION ),
+ TOKEN( "before-after-section", XML_BEFORE_AFTER_SECTION),
+ TOKEN( "prefix-characters", XML_PREFIX_CHARACTERS ),
+ TOKEN( "quartal", XML_QUARTAL ),
+ TOKEN( "week", XML_WEEK ),
+ TOKEN( "whole-group", XML_WHOLE_GROUP ),
+ TOKEN( "with-first-detail", XML_WITH_FIRST_DETAIL ),
+ TOKEN( "top-down", XML_TOP_DOWN ),
+ TOKEN( "bottom-up", XML_BOTTOM_UP ),
+ TOKEN( "hour", XML_HOUR ),
+ TOKEN( "minute", XML_MINUTE ),
+ TOKEN( "rpt", XML_NP_RPT ),
+ TOKEN( "format-condition", XML_FORMAT_CONDITION ),
+ TOKEN( "expression1", XML_EXPRESSION1 ),
+ TOKEN( "expression2", XML_EXPRESSION2 ),
+ TOKEN( "equal", XML_EQUAL ),
+ TOKEN( "not_equal", XML_NOT_EQUAL ),
+ TOKEN( "less", XML_LESS ),
+ TOKEN( "greater", XML_GREATER ),
+ TOKEN( "less_equal", XML_LESS_EQUAL ),
+ TOKEN( "greater_equal", XML_GREATER_EQUAL ),
+ TOKEN( "between", XML_BETWEEN ),
+ TOKEN( "not_between", XML_NOT_BETWEEN ),
+ TOKEN( "table-template", XML_TABLE_TEMPLATE ),
+ TOKEN( "first-row", XML_FIRST_ROW ),
+ TOKEN( "last-row", XML_LAST_ROW ),
+ TOKEN( "first-column", XML_FIRST_COLUMN ),
+ TOKEN( "last-column", XML_LAST_COLUMN ),
+ TOKEN( "even-rows", XML_EVEN_ROWS ),
+ TOKEN( "odd-rows", XML_ODD_ROWS ),
+ TOKEN( "even-columns", XML_EVEN_COLUMNS ),
+ TOKEN( "odd-columns", XML_ODD_COLUMNS ),
+ TOKEN( "horizontal-on-odd", XML_HORIZONTAL_ON_ODD ),
+ // Password error from 1.4 to 2.0 Beta (#i45874#)
+ TOKEN( "restart-numbering", XML_RESTART_NUMBERING),
+ // OpenDocument <text:numbered-paragraph> element not supported on OpenDocument import (#i52127#)
+ TOKEN( "numbered-paragraph", XML_NUMBERED_PARAGRAPH),
+ TOKEN( "master-detail-fields", XML_MASTER_DETAIL_FIELDS),
+ TOKEN( "master-detail-field", XML_MASTER_DETAIL_FIELD),
+ TOKEN( "sub-document", XML_SUB_DOCUMENT),
+ TOKEN( "fixed-content", XML_FIXED_CONTENT),
+ TOKEN( "initial-formula", XML_INITIAL_FORMULA),
+ TOKEN( "deep-traversing", XML_DEEP_TRAVERSING),
+ TOKEN( "preserve-IRI", XML_PRESERVE_IRI),
+ TOKEN( "sort-by-x-values", XML_SORT_BY_X_VALUES ),
+ TOKEN( "page-continuation", XML_PAGE_CONTINUATION ),
+ TOKEN( "right-angled-axes", XML_RIGHT_ANGLED_AXES ),
+ TOKEN( "soft-page-break", XML_SOFT_PAGE_BREAK ),
+ TOKEN( "use-soft-page-breaks", XML_USE_SOFT_PAGE_BREAKS ),
+ TOKEN( "percentage-data-style-name", XML_PERCENTAGE_DATA_STYLE_NAME ),
+ TOKEN( "value-and-percentage", XML_VALUE_AND_PERCENTAGE ),
+ TOKEN( "group-bars-per-axis", XML_GROUP_BARS_PER_AXIS ),
+ TOKEN( "include-hidden-cells", XML_INCLUDE_HIDDEN_CELLS ),
+ TOKEN( "auto-position", XML_AUTOMATIC_POSITION ),
+ TOKEN( "auto-size", XML_AUTOMATIC_SIZE ),
+ TOKEN( "reverse-direction", XML_REVERSE_DIRECTION ),
+ TOKEN( "label-separator", XML_LABEL_SEPARATOR ),
+ TOKEN( "label-position", XML_LABEL_POSITION ),
+ TOKEN( "avoid-overlap", XML_AVOID_OVERLAP ),
+ TOKEN( "near-origin", XML_NEAR_ORIGIN ),
+ TOKEN( "dependency", XML_DEPENDENCY ),
+ TOKEN( "nav-order", XML_NAV_ORDER ),
+
+ TOKEN( "use-first-row-styles", XML_USE_FIRST_ROW_STYLES ),
+ TOKEN( "use-last-row-styles", XML_USE_LAST_ROW_STYLES ),
+ TOKEN( "use-first-column-styles", XML_USE_FIRST_COLUMN_STYLES ),
+ TOKEN( "use-last-column-styles", XML_USE_LAST_COLUMN_STYLES ),
+ TOKEN( "use-banding-rows-styles", XML_USE_BANDING_ROWS_STYLES ),
+ TOKEN( "use-banding-columns-styles", XML_USE_BANDING_COLUMNS_STYLES ),
+
+ TOKEN( "automatic-content", XML_AUTOMATIC_CONTENT ),
+ TOKEN( "display-r-square", XML_DISPLAY_R_SQUARE ),
+ TOKEN( "display-equation", XML_DISPLAY_EQUATION ),
+ // db odf 12
+ TOKEN( "table-representations", XML_TABLE_REPRESENTATIONS ),
+ TOKEN( "table-representation", XML_TABLE_REPRESENTATION ),
+ TOKEN( "schema-definition", XML_SCHEMA_DEFINITION ),
+ TOKEN( "connection-data", XML_CONNECTION_DATA ),
+ TOKEN( "database-description", XML_DATABASE_DESCRIPTION ),
+ TOKEN( "compound-database", XML_COMPOUND_DATABASE ),
+ TOKEN( "file-based-database", XML_FILE_BASED_DATABASE ),
+ TOKEN( "server-database", XML_SERVER_DATABASE ),
+ TOKEN( "media-type", XML_MEDIA_TYPE ),
+ TOKEN( "hostname", XML_HOSTNAME ),
+ TOKEN( "port", XML_PORT ),
+ TOKEN( "local-socket", XML_LOCAL_SOCKET ),
+ TOKEN( "use-system-user", XML_USE_SYSTEM_USER ),
+ TOKEN( "driver-settings", XML_DRIVER_SETTINGS ),
+ TOKEN( "java-classpath", XML_JAVA_CLASSPATH ),
+ TOKEN( "character-set", XML_CHARACTER_SET ),
+ TOKEN( "application-connection-settings", XML_APPLICATION_CONNECTION_SETTINGS ),
+ TOKEN( "table-include-filter", XML_TABLE_INCLUDE_FILTER ),
+ TOKEN( "default-row-style-name", XML_DEFAULT_ROW_STYLE_NAME),
+ TOKEN( "angle-offset", XML_ANGLE_OFFSET ),
+ // Core implementation for direct cross-references (#i81002#)
+ TOKEN( "number-no-superior", XML_NUMBER_NO_SUPERIOR ),
+ TOKEN( "number-all-superior", XML_NUMBER_ALL_SUPERIOR ),
+ TOKEN( "list-level-position-and-space-mode", XML_LIST_LEVEL_POSITION_AND_SPACE_MODE ),
+ TOKEN( "label-width-and-position", XML_LABEL_WIDTH_AND_POSITION ),
+ TOKEN( "label-alignment", XML_LABEL_ALIGNMENT ),
+ TOKEN( "list-level-label-alignment", XML_LIST_LEVEL_LABEL_ALIGNMENT ),
+ TOKEN( "label-followed-by", XML_LABEL_FOLLOWED_BY ),
+ TOKEN( "listtab", XML_LISTTAB ),
+ TOKEN( "space", XML_SPACE ),
+ TOKEN( "nothing", XML_NOTHING ),
+ TOKEN( "list-tab-stop-position", XML_LIST_TAB_STOP_POSITION ),
+
+ // bm: chart error bar extensions (ODF 1.2)
+ TOKEN( "standard-error", XML_STANDARD_ERROR ),
+ TOKEN( "cell-range" , XML_CELL_RANGE ),
+ TOKEN( "error-lower-range", XML_ERROR_LOWER_RANGE ),
+ TOKEN( "error-upper-range", XML_ERROR_UPPER_RANGE ),
+
+ TOKEN( "continue-list", XML_CONTINUE_LIST ),
+ TOKEN( "style-override", XML_STYLE_OVERRIDE ),
+
+ // XForms: Changes to model should optionally set document's modified state. (#i90243#)
+ TOKEN( "xforms-settings", XML_XFORM_MODEL_SETTINGS ),
+
+ // ODF 1.2 metadata
+ TOKEN( "meta-field", XML_META_FIELD ),
+ TOKEN( "about", XML_ABOUT ),
+ TOKEN( "datatype", XML_DATATYPE ),
+ TOKEN( "transformation", XML_TRANSFORMATION ),
+
+ // ODF 1.2 numbered-paragraph
+ TOKEN( "list-id", XML_LIST_ID ),
+
+ TOKEN( "treat-empty-cells", XML_TREAT_EMPTY_CELLS ),
+ TOKEN( "leave-gap", XML_LEAVE_GAP ),
+ TOKEN( "use-zero", XML_USE_ZERO ),
+ TOKEN( "ignore", XML_IGNORE ),
+
+ // enhanced fields
+ TOKEN( "fieldmark", XML_FIELDMARK ),
+ TOKEN( "fieldmark-start", XML_FIELDMARK_START ),
+ TOKEN( "fieldmark-end", XML_FIELDMARK_END ),
+ TOKEN( "urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0", XML_N_FIELD ),
+ TOKEN( "field", XML_NP_FIELD ),
+
+ TOKEN( "image-scale", XML_IMAGE_SCALE ),
+ TOKEN( "isotropic", XML_ISOTROPIC ),
+ TOKEN( "anisotropic", XML_ANISOTROPIC ),
+
+ TOKEN( "axis-position", XML_AXIS_POSITION ),
+ TOKEN( "axis-label-position", XML_AXIS_LABEL_POSITION ),
+ TOKEN( "near-axis", XML_NEAR_AXIS ),
+ TOKEN( "near-axis-other-side", XML_NEAR_AXIS_OTHER_SIDE ),
+ TOKEN( "outside-start", XML_OUTSIDE_START ),
+ TOKEN( "outside-end", XML_OUTSIDE_END ),
+ TOKEN( "tick-mark-position", XML_TICK_MARK_POSITION ),
+ TOKEN( "at-labels", XML_AT_LABELS ),
+ TOKEN( "at-axis", XML_AT_AXIS ),
+ TOKEN( "at-labels-and-axis", XML_AT_LABELS_AND_AXIS ),
+ TOKEN( "filled-radar", XML_FILLED_RADAR ),
+ TOKEN( "surface", XML_SURFACE ),
+
+ TOKEN( "mathvariant", XML_MATHVARIANT ),
+ TOKEN( "mathsize", XML_MATHSIZE ),
+ TOKEN( "mathweight", XML_MATHWEIGHT ),
+ TOKEN( "mathcolor", XML_MATHCOLOR ),
+
+ TOKEN( "contains", XML_CONTAINS ),
+ TOKEN( "does-not-contain", XML_DOES_NOT_CONTAIN ),
+ TOKEN( "begins-with", XML_BEGINS_WITH ),
+ TOKEN( "does-not-begin-with", XML_DOES_NOT_BEGIN_WITH ),
+ TOKEN( "ends-with", XML_ENDS_WITH ),
+ TOKEN( "does-not-end-with", XML_DOES_NOT_END_WITH ),
+
+ TOKEN( "chartooo", XML_NP_CHART_EXT ),
+ TOKEN( "http://openoffice.org/2010/chart", XML_N_CHART_EXT ),
+ TOKEN( "coordinate-region", XML_COORDINATE_REGION ),
+
+ TOKEN( "diagonal-bl-tr-widths", XML_DIAGONAL_BL_TR_WIDTHS ),
+ TOKEN( "diagonal-tl-br-widths", XML_DIAGONAL_TL_BR_WIDTHS ),
+
+ TOKEN( "outside-minimum", XML_OUTSIDE_MINIMUM ),
+ TOKEN( "outside-maximum", XML_OUTSIDE_MAXIMUM ),
+
+ TOKEN( "legend-expansion", XML_LEGEND_EXPANSION),
+ TOKEN( "legend-expansion-aspect-ratio", XML_LEGEND_EXPANSION_ASPECT_RATIO),
+ TOKEN( "balanced", XML_BALANCED),
+ TOKEN( "high", XML_HIGH),
+ TOKEN( "wide", XML_WIDE),
+
+ TOKEN( "axis-type", XML_AXIS_TYPE ), //#i25706#
+ TOKEN( "date-scale", XML_DATE_SCALE ),
+ TOKEN( "base-time-unit", XML_BASE_TIME_UNIT ),
+ TOKEN( "major-interval-value", XML_MAJOR_INTERVAL_VALUE ),
+ TOKEN( "minor-interval-value", XML_MINOR_INTERVAL_VALUE ),
+ TOKEN( "major-interval-unit", XML_MAJOR_INTERVAL_UNIT ),
+ TOKEN( "minor-interval-unit", XML_MINOR_INTERVAL_UNIT ),
+
+ TOKEN( "min-value", XML_MIN_VALUE ),
+ TOKEN( "max-value", XML_MAX_VALUE ),
+
+#if OSL_DEBUG_LEVEL > 0
+ { 0, NULL, NULL, XML_TOKEN_END }
+#else
+ { 0, NULL, NULL /* XML_TOKEN_END */ }
+#endif
+ };
+
+ sal_Int32 nRescheduleCount = 0;
+
+ // get OUString representation of token
+ const OUString& GetXMLToken( enum XMLTokenEnum eToken )
+ {
+#if OSL_DEBUG_LEVEL > 0
+ // check the consistency of the token list. Below, we use the ordinal value of
+ // the token as index into the token list, so we should make sure that every
+ // entry is at the proper position
+ const XMLTokenEntry* pEntry = aTokenList;
+ const XMLTokenEntry* pEntryEnd = pEntry + sizeof ( aTokenList ) / sizeof ( XMLTokenEntry );
+ sal_uInt16 nPos = 0;
+ while ( pEntry < pEntryEnd )
+ {
+ OSL_ENSURE( nPos == (sal_uInt16)(pEntry->eToken),
+ "xmloff::GetXMLToken: inconsistency in the token list!" );
+ ++pEntry, ++nPos;
+ }
+#endif
+ DBG_ASSERT( eToken > XML_TOKEN_INVALID, "token value too low!" );
+ DBG_ASSERT( eToken < XML_TOKEN_END, "token value too high!" );
+ DBG_ASSERT(sal_uInt16(eToken) < SAL_N_ELEMENTS(aTokenList),"Illegal position!");
+
+ XMLTokenEntry* pToken = &aTokenList[(sal_uInt16)eToken];
+ if (!pToken->pOUString)
+ pToken->pOUString = new OUString( pToken->pChar, pToken->nLength,
+ RTL_TEXTENCODING_ASCII_US );
+ return *pToken->pOUString;
+ }
+
+ // does rString represent eToken?
+ sal_Bool IsXMLToken(
+ const OUString& rString,
+ enum XMLTokenEnum eToken )
+ {
+ DBG_ASSERT( eToken > XML_TOKEN_INVALID, "token value too low!" );
+ DBG_ASSERT( eToken < XML_TOKEN_END, "token value too high!" );
+
+ const XMLTokenEntry* pToken = &aTokenList[(sal_uInt16)eToken];
+ return rString.equalsAsciiL( pToken->pChar, pToken->nLength );
+ }
+
+ // gives all allocated memory for OUString* back
+ void ResetTokens()
+ {
+ if (nRescheduleCount == 0)
+ {
+ for (sal_Int16 i=0, nEnd = sizeof ( aTokenList ) / sizeof ( XMLTokenEntry );
+ i < nEnd;
+ i++)
+ {
+ delete aTokenList[i].pOUString;
+ aTokenList[i].pOUString = NULL;
+ }
+ }
+ }
+
+ void IncRescheduleCount()
+ {
+ ++nRescheduleCount;
+ }
+
+ void DecRescheduleCount()
+ {
+ if (nRescheduleCount > 0)
+ --nRescheduleCount;
+ else {
+ OSL_FAIL("RescheduleCount not increased");
+ }
+ }
+
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/core/xmluconv.cxx b/xmloff/source/core/xmluconv.cxx
new file mode 100644
index 000000000000..89a94aeeb146
--- /dev/null
+++ b/xmloff/source/core/xmluconv.cxx
@@ -0,0 +1,2262 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/util/Time.hpp>
+#include <tools/debug.hxx>
+#include <rtl/ustrbuf.hxx>
+#include "xmlehelp.hxx"
+#include <xmloff/xmlement.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <rtl/math.hxx>
+#include <rtl/logfile.hxx>
+
+#ifndef _TOOLS_DATE_HXX
+#include <tools/date.hxx>
+#include <tools/string.hxx>
+#endif
+
+#include <tools/time.hxx>
+#include <tools/fldunit.hxx>
+
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include <com/sun/star/style/NumberingType.hpp>
+#include <com/sun/star/text/XNumberingTypeInfo.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/i18n/XCharacterClassification.hpp>
+#include <com/sun/star/i18n/UnicodeType.hpp>
+#include <basegfx/vector/b3dvector.hxx>
+
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::text;
+using namespace com::sun::star::style;
+using namespace ::com::sun::star::i18n;
+using namespace ::xmloff::token;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+const sal_Int8 XML_MAXDIGITSCOUNT_TIME = 11;
+const sal_Int8 XML_MAXDIGITSCOUNT_DATETIME = 6;
+#define XML_NULLDATE "NullDate"
+
+OUString SvXMLUnitConverter::msXML_true;
+OUString SvXMLUnitConverter::msXML_false;
+
+void SvXMLUnitConverter::initXMLStrings()
+{
+ if( msXML_true.getLength() == 0 )
+ {
+ msXML_true = GetXMLToken(XML_TRUE);
+ msXML_false = GetXMLToken(XML_FALSE);
+ }
+}
+
+void SvXMLUnitConverter::createNumTypeInfo() const
+{
+ if( mxServiceFactory.is() )
+ {
+ ((SvXMLUnitConverter *)this)->xNumTypeInfo =
+ Reference < XNumberingTypeInfo > (
+ mxServiceFactory->createInstance(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.DefaultNumberingProvider") ) ), UNO_QUERY );
+ }
+}
+
+/** constructs a SvXMLUnitConverter. The core measure unit is the
+ default unit for numerical measures, the XML measure unit is
+ the default unit for textual measures
+*/
+
+SvXMLUnitConverter::SvXMLUnitConverter(
+ MapUnit eCoreMeasureUnit,
+ MapUnit eXMLMeasureUnit,
+ const uno::Reference<lang::XMultiServiceFactory>& xServiceFactory ) :
+ aNullDate(30, 12, 1899),
+ mxServiceFactory( xServiceFactory )
+{
+ DBG_ASSERT( mxServiceFactory.is(), "got no service manager" );
+
+ meCoreMeasureUnit = eCoreMeasureUnit;
+ meXMLMeasureUnit = eXMLMeasureUnit;
+}
+
+SvXMLUnitConverter::~SvXMLUnitConverter()
+{
+}
+
+MapUnit SvXMLUnitConverter::GetMapUnit(sal_Int16 nFieldUnit)
+{
+ MapUnit eUnit = MAP_INCH;
+ switch( nFieldUnit )
+ {
+ case FUNIT_MM:
+ eUnit = MAP_MM;
+ break;
+ case FUNIT_CM:
+ case FUNIT_M:
+ case FUNIT_KM:
+ eUnit = MAP_CM;
+ break;
+ case FUNIT_TWIP:
+ eUnit = MAP_TWIP;
+ break;
+ case FUNIT_POINT:
+ case FUNIT_PICA:
+ eUnit = MAP_POINT;
+ break;
+ case FUNIT_100TH_MM:
+ eUnit = MAP_100TH_MM;
+ break;
+ }
+ return eUnit;
+}
+
+/** convert string to measure using optional min and max values*/
+sal_Bool SvXMLUnitConverter::convertMeasure( sal_Int32& nValue,
+ const OUString& rString,
+ sal_Int32 nMin, sal_Int32 nMax ) const
+{
+ return SvXMLUnitConverter::convertMeasure( nValue, rString,
+ meCoreMeasureUnit,
+ nMin, nMax );
+}
+
+/** convert measure to string */
+void SvXMLUnitConverter::convertMeasure( OUStringBuffer& rString,
+ sal_Int32 nMeasure ) const
+{
+ SvXMLUnitConverter::convertMeasure( rString, nMeasure,
+ meCoreMeasureUnit,
+ meXMLMeasureUnit );
+}
+
+/** convert measure with given unit to string */
+void SvXMLUnitConverter::convertMeasure( OUStringBuffer& rString,
+ sal_Int32 nMeasure,
+ MapUnit eSrcUnit ) const
+{
+ SvXMLUnitConverter::convertMeasure( rString, nMeasure,
+ eSrcUnit,
+ meXMLMeasureUnit );
+}
+
+/** convert the value from the given string to an int value
+ with the given map unit using optional min and max values
+*/
+sal_Bool SvXMLUnitConverter::convertMeasure( sal_Int32& rValue,
+ const OUString& rString,
+ MapUnit eDstUnit,
+ sal_Int32 nMin, sal_Int32 nMax )
+{
+ sal_Bool bNeg = sal_False;
+ double nVal = 0;
+
+ sal_Int32 nPos = 0;
+ const sal_Int32 nLen = rString.getLength();
+
+ // skip white space
+ while( (nPos < nLen) && (rString[nPos] <= sal_Unicode(' ')) )
+ nPos++;
+
+ if( nPos < nLen && sal_Unicode('-') == rString[nPos] )
+ {
+ bNeg = sal_True;
+ ++nPos;
+ }
+
+ // get number
+ while( nPos < nLen &&
+ sal_Unicode('0') <= rString[nPos] &&
+ sal_Unicode('9') >= rString[nPos] )
+ {
+ // TODO: check overflow!
+ nVal *= 10;
+ nVal += (rString[nPos] - sal_Unicode('0'));
+ ++nPos;
+ }
+ double nDiv = 1.;
+ if( nPos < nLen && sal_Unicode('.') == rString[nPos] )
+ {
+ ++nPos;
+
+ while( nPos < nLen &&
+ sal_Unicode('0') <= rString[nPos] &&
+ sal_Unicode('9') >= rString[nPos] )
+ {
+ // TODO: check overflow!
+ nDiv *= 10;
+ nVal += ( ((double)(rString[nPos] - sal_Unicode('0'))) / nDiv );
+ ++nPos;
+ }
+ }
+
+ // skip white space
+ while( (nPos < nLen) && (rString[nPos] <= sal_Unicode(' ')) )
+ ++nPos;
+
+ if( nPos < nLen )
+ {
+
+ if( MAP_RELATIVE == eDstUnit )
+ {
+ if( sal_Unicode('%') != rString[nPos] )
+ return sal_False;
+ }
+ else if( MAP_PIXEL == eDstUnit )
+ {
+ if( nPos + 1 >= nLen ||
+ (sal_Unicode('p') != rString[nPos] &&
+ sal_Unicode('P') != rString[nPos])||
+ (sal_Unicode('x') != rString[nPos+1] &&
+ sal_Unicode('X') != rString[nPos+1]) )
+ return sal_False;
+ }
+ else
+ {
+ DBG_ASSERT( MAP_TWIP == eDstUnit || MAP_POINT == eDstUnit ||
+ MAP_100TH_MM == eDstUnit || MAP_10TH_MM == eDstUnit, "unit is not supported");
+ const sal_Char *aCmpsL[2] = { 0, 0 };
+ const sal_Char *aCmpsU[2] = { 0, 0 };
+ double aScales[2] = { 1., 1. };
+
+ if( MAP_TWIP == eDstUnit )
+ {
+ switch( rString[nPos] )
+ {
+ case sal_Unicode('c'):
+ case sal_Unicode('C'):
+ aCmpsL[0] = "cm";
+ aCmpsU[0] = "CM";
+ aScales[0] = (72.*20.)/2.54; // twip
+ break;
+ case sal_Unicode('e'):
+ case sal_Unicode('E'):
+ break;
+ case sal_Unicode('i'):
+ case sal_Unicode('I'):
+ aCmpsL[0] = "in";
+ aCmpsU[0] = "IN";
+ aScales[0] = 72.*20.; // twip
+ break;
+ case sal_Unicode('m'):
+ case sal_Unicode('M'):
+ aCmpsL[0] = "mm";
+ aCmpsU[0] = "MM";
+ aScales[0] = (72.*20.)/25.4; // twip
+ break;
+ case sal_Unicode('p'):
+ case sal_Unicode('P'):
+ aCmpsL[0] = "pt";
+ aCmpsU[0] = "PT";
+ aScales[0] = 20.; // twip
+
+ aCmpsL[1] = "pc";
+ aCmpsU[1] = "PC";
+ aScales[1] = 12.*20.; // twip
+ break;
+ }
+ }
+ else if( MAP_100TH_MM == eDstUnit || MAP_10TH_MM == eDstUnit )
+ {
+ double nScaleFactor = (MAP_100TH_MM == eDstUnit) ? 100.0 : 10.0;
+ switch( rString[nPos] )
+ {
+ case sal_Unicode('c'):
+ case sal_Unicode('C'):
+ aCmpsL[0] = "cm";
+ aCmpsU[0] = "CM";
+ aScales[0] = 10.0 * nScaleFactor; // mm/100
+ break;
+ case sal_Unicode('e'):
+ case sal_Unicode('E'):
+ break;
+ case sal_Unicode('i'):
+ case sal_Unicode('I'):
+ aCmpsL[0] = "in";
+ aCmpsU[0] = "IN";
+ aScales[0] = 1000.*2.54; // mm/100
+ break;
+ case sal_Unicode('m'):
+ case sal_Unicode('M'):
+ aCmpsL[0] = "mm";
+ aCmpsU[0] = "MM";
+ aScales[0] = 1.0 * nScaleFactor; // mm/100
+ break;
+ case sal_Unicode('p'):
+ case sal_Unicode('P'):
+ aCmpsL[0] = "pt";
+ aCmpsU[0] = "PT";
+ aScales[0] = (10.0 * nScaleFactor*2.54)/72.; // mm/100
+
+ aCmpsL[1] = "pc";
+ aCmpsU[1] = "PC";
+ aScales[1] = (10.0 * nScaleFactor*2.54)/12.; // mm/100
+ break;
+ }
+ }
+ else if( MAP_POINT == eDstUnit )
+ {
+ if( rString[nPos] == 'p' || rString[nPos] == 'P' )
+ {
+ aCmpsL[0] = "pt";
+ aCmpsU[0] = "PT";
+ aScales[0] = 1;
+ }
+ }
+
+ if( aCmpsL[0] == NULL )
+ return sal_False;
+
+ double nScale = 0.;
+ for( sal_uInt16 i= 0; i < 2; ++i )
+ {
+ const sal_Char *pL = aCmpsL[i];
+ if( pL )
+ {
+ const sal_Char *pU = aCmpsU[i];
+ while( nPos < nLen && *pL )
+ {
+ sal_Unicode c = rString[nPos];
+ if( c != *pL && c != *pU )
+ break;
+ ++pL;
+ ++pU;
+ ++nPos;
+ }
+ if( !*pL && (nPos == nLen || ' ' == rString[nPos]) )
+ {
+ nScale = aScales[i];
+ break;
+ }
+ }
+ }
+
+ if( 0. == nScale )
+ return sal_False;
+
+ // TODO: check overflow
+ if( nScale != 1. )
+ nVal *= nScale;
+ }
+ }
+
+ nVal += .5;
+ if( bNeg )
+ nVal = -nVal;
+
+ if( nVal <= (double)nMin )
+ rValue = nMin;
+ else if( nVal >= (double)nMax )
+ rValue = nMax;
+ else
+ rValue = (sal_Int32)nVal;
+
+ return sal_True;
+}
+
+/** convert measure in given unit to string with given unit */
+void SvXMLUnitConverter::convertMeasure( OUStringBuffer& rBuffer,
+ sal_Int32 nMeasure,
+ MapUnit eSrcUnit,
+ MapUnit eDstUnit )
+{
+ if( eSrcUnit == MAP_RELATIVE )
+ {
+ DBG_ASSERT( eDstUnit == MAP_RELATIVE,
+ "MAP_RELATIVE only maps to MAP_RELATIVE!" );
+
+ rBuffer.append( nMeasure );
+ rBuffer.append( sal_Unicode('%' ) );
+ }
+ else
+ {
+ SvXMLExportHelper::AddLength( nMeasure, eSrcUnit,
+ rBuffer, eDstUnit );
+ }
+}
+
+/** convert string to boolean */
+sal_Bool SvXMLUnitConverter::convertBool( bool& rBool,
+ const OUString& rString )
+{
+ rBool = IsXMLToken(rString, XML_TRUE);
+
+ return rBool || IsXMLToken(rString, XML_FALSE);
+}
+
+/** convert boolean to string */
+void SvXMLUnitConverter::convertBool( OUStringBuffer& rBuffer,
+ sal_Bool bValue )
+{
+ rBuffer.append( GetXMLToken( bValue ? XML_TRUE : XML_FALSE ) );
+}
+
+/** convert string to percent */
+sal_Bool SvXMLUnitConverter::convertPercent( sal_Int32& rPercent,
+ const OUString& rString )
+{
+ return convertMeasure( rPercent, rString, MAP_RELATIVE );
+}
+
+/** convert percent to string */
+void SvXMLUnitConverter::convertPercent( OUStringBuffer& rBuffer,
+ sal_Int32 nValue )
+{
+ rBuffer.append( nValue );
+ rBuffer.append( sal_Unicode('%' ) );
+}
+
+/** convert string to pixel measure */
+sal_Bool SvXMLUnitConverter::convertMeasurePx( sal_Int32& rPixel,
+ const OUString& rString )
+{
+ return convertMeasure( rPixel, rString, MAP_PIXEL );
+}
+
+/** convert pixel measure to string */
+void SvXMLUnitConverter::convertMeasurePx( OUStringBuffer& rBuffer,
+ sal_Int32 nValue )
+{
+ rBuffer.append( nValue );
+ rBuffer.append( sal_Unicode('p' ) );
+ rBuffer.append( sal_Unicode('x' ) );
+}
+
+/** convert string to enum using given enum map, if the enum is
+ not found in the map, this method will return false
+*/
+sal_Bool SvXMLUnitConverter::convertEnum( sal_uInt16& rEnum,
+ const OUString& rValue,
+ const SvXMLEnumStringMapEntry *pMap )
+{
+ while( pMap->pName )
+ {
+ if( rValue.equalsAsciiL( pMap->pName, pMap->nNameLength ) )
+ {
+ rEnum = pMap->nValue;
+ return sal_True;
+ }
+ ++pMap;
+ }
+
+ return sal_False;
+}
+
+/** convert string to enum using given token map, if the enum is
+ not found in the map, this method will return false */
+sal_Bool SvXMLUnitConverter::convertEnum(
+ sal_uInt16& rEnum,
+ const OUString& rValue,
+ const SvXMLEnumMapEntry *pMap )
+{
+ while( pMap->eToken != XML_TOKEN_INVALID )
+ {
+ if( IsXMLToken( rValue, pMap->eToken ) )
+ {
+ rEnum = pMap->nValue;
+ return sal_True;
+ }
+ ++pMap;
+ }
+ return sal_False;
+}
+
+/** convert enum to string using given enum map with optional
+ default string. If the enum is not found in the map,
+ this method will either use the given default or return
+ false if not default is set
+*/
+sal_Bool SvXMLUnitConverter::convertEnum( OUStringBuffer& rBuffer,
+ sal_uInt16 nValue,
+ const SvXMLEnumStringMapEntry *pMap,
+ sal_Char * pDefault /* = NULL */ )
+{
+ const sal_Char *pStr = pDefault;
+
+ while( pMap->pName )
+ {
+ if( pMap->nValue == nValue )
+ {
+ pStr = pMap->pName;
+ break;
+ }
+ ++pMap;
+ }
+
+ if( NULL == pStr )
+ pStr = pDefault;
+
+ if( NULL != pStr )
+ rBuffer.appendAscii( pStr );
+
+ return NULL != pStr;
+}
+
+/** convert enum to string using given token map with an optional
+ default token. If the enum is not found in the map,
+ this method will either use the given default or return
+ false if no default is set */
+sal_Bool SvXMLUnitConverter::convertEnum(
+ OUStringBuffer& rBuffer,
+ unsigned int nValue,
+ const SvXMLEnumMapEntry *pMap,
+ enum XMLTokenEnum eDefault)
+{
+ enum XMLTokenEnum eTok = eDefault;
+
+ while( pMap->eToken != XML_TOKEN_INVALID )
+ {
+ if( pMap->nValue == nValue )
+ {
+ eTok = pMap->eToken;
+ break;
+ }
+ ++pMap;
+ }
+
+ // the map may have contained XML_TOKEN_INVALID
+ if( eTok == XML_TOKEN_INVALID )
+ eTok = eDefault;
+
+ if( eTok != XML_TOKEN_INVALID )
+ rBuffer.append( GetXMLToken(eTok) );
+
+ return (eTok != XML_TOKEN_INVALID);
+}
+
+int lcl_gethex( int nChar )
+{
+ if( nChar >= '0' && nChar <= '9' )
+ return nChar - '0';
+ else if( nChar >= 'a' && nChar <= 'f' )
+ return nChar - 'a' + 10;
+ else if( nChar >= 'A' && nChar <= 'F' )
+ return nChar - 'A' + 10;
+ else
+ return 0;
+}
+
+/** convert string to color */
+sal_Bool SvXMLUnitConverter::convertColor( Color& rColor,
+ const OUString& rValue )
+{
+ if( rValue.getLength() != 7 || rValue[0] != '#' )
+ return sal_False;
+
+ rColor.SetRed(
+ sal::static_int_cast< sal_uInt8 >(
+ lcl_gethex( rValue[1] ) * 16 + lcl_gethex( rValue[2] ) ) );
+
+ rColor.SetGreen(
+ sal::static_int_cast< sal_uInt8 >(
+ lcl_gethex( rValue[3] ) * 16 + lcl_gethex( rValue[4] ) ) );
+
+ rColor.SetBlue(
+ sal::static_int_cast< sal_uInt8 >(
+ lcl_gethex( rValue[5] ) * 16 + lcl_gethex( rValue[6] ) ) );
+
+ return sal_True;
+}
+
+static sal_Char aHexTab[] = "0123456789abcdef";
+
+/** convert color to string */
+void SvXMLUnitConverter::convertColor( OUStringBuffer& rBuffer,
+ const Color& rCol )
+{
+ rBuffer.append( sal_Unicode( '#' ) );
+
+ sal_uInt8 nCol = rCol.GetRed();
+ rBuffer.append( sal_Unicode( aHexTab[ nCol >> 4 ] ) );
+ rBuffer.append( sal_Unicode( aHexTab[ nCol & 0xf ] ) );
+
+ nCol = rCol.GetGreen();
+ rBuffer.append( sal_Unicode( aHexTab[ nCol >> 4 ] ) );
+ rBuffer.append( sal_Unicode( aHexTab[ nCol & 0xf ] ) );
+
+ nCol = rCol.GetBlue();
+ rBuffer.append( sal_Unicode( aHexTab[ nCol >> 4 ] ) );
+ rBuffer.append( sal_Unicode( aHexTab[ nCol & 0xf ] ) );
+}
+
+/** convert number to string */
+void SvXMLUnitConverter::convertNumber( OUStringBuffer& rBuffer,
+ sal_Int32 nNumber )
+{
+ rBuffer.append( sal_Int32( nNumber ) );
+}
+
+/** convert string to number with optional min and max values */
+sal_Bool SvXMLUnitConverter::convertNumber( sal_Int32& rValue,
+ const OUString& rString,
+ sal_Int32 nMin, sal_Int32 nMax )
+{
+ rValue = 0;
+ sal_Int64 nNumber = 0;
+ sal_Bool bRet = convertNumber64(nNumber,rString,nMin,nMax);
+ if ( bRet )
+ rValue = static_cast<sal_Int32>(nNumber);
+ return bRet;
+}
+
+/** convert 64-bit number to string */
+void SvXMLUnitConverter::convertNumber64( OUStringBuffer& rBuffer,
+ sal_Int64 nNumber )
+{
+ rBuffer.append( nNumber );
+}
+
+/** convert string to 64-bit number with optional min and max values */
+sal_Bool SvXMLUnitConverter::convertNumber64( sal_Int64& rValue,
+ const OUString& rString,
+ sal_Int64 nMin, sal_Int64 nMax )
+{
+ sal_Bool bNeg = sal_False;
+ rValue = 0;
+
+ sal_Int32 nPos = 0;
+ const sal_Int32 nLen = rString.getLength();
+
+ // skip white space
+ while( (nPos < nLen) && (rString[nPos] <= sal_Unicode(' ')) )
+ ++nPos;
+
+ if( nPos < nLen && sal_Unicode('-') == rString[nPos] )
+ {
+ bNeg = sal_True;
+ ++nPos;
+ }
+
+ // get number
+ while( nPos < nLen &&
+ sal_Unicode('0') <= rString[nPos] &&
+ sal_Unicode('9') >= rString[nPos] )
+ {
+ // TODO: check overflow!
+ rValue *= 10;
+ rValue += (rString[nPos] - sal_Unicode('0'));
+ ++nPos;
+ }
+
+ if( bNeg )
+ rValue *= -1;
+
+ return ( nPos == nLen && rValue >= nMin && rValue <= nMax );
+}
+
+/** convert double number to string (using ::rtl::math) */
+void SvXMLUnitConverter::convertDouble(OUStringBuffer& rBuffer,
+ double fNumber, sal_Bool bWriteUnits) const
+{
+ SvXMLUnitConverter::convertDouble(rBuffer, fNumber,
+ bWriteUnits, meCoreMeasureUnit, meXMLMeasureUnit);
+}
+
+/** convert double number to string (using ::rtl::math) */
+void SvXMLUnitConverter::convertDouble( OUStringBuffer& rBuffer,
+ double fNumber, sal_Bool bWriteUnits, MapUnit eCoreUnit, MapUnit eDstUnit)
+{
+ if(MAP_RELATIVE == eCoreUnit)
+ {
+ DBG_ASSERT(eDstUnit == MAP_RELATIVE, "MAP_RELATIVE only maps to MAP_RELATIVE!" );
+ ::rtl::math::doubleToUStringBuffer( rBuffer, fNumber, rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, '.', sal_True);
+ if(bWriteUnits)
+ rBuffer.append(sal_Unicode('%'));
+ }
+ else
+ {
+ OUStringBuffer sUnit;
+ double fFactor = SvXMLExportHelper::GetConversionFactor(sUnit, eCoreUnit, eDstUnit);
+ if(fFactor != 1.0)
+ fNumber *= fFactor;
+ ::rtl::math::doubleToUStringBuffer( rBuffer, fNumber, rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, '.', sal_True);
+ if(bWriteUnits)
+ rBuffer.append(sUnit);
+ }
+}
+
+/** convert double number to string (using ::rtl::math) */
+void SvXMLUnitConverter::convertDouble( OUStringBuffer& rBuffer, double fNumber)
+{
+ ::rtl::math::doubleToUStringBuffer( rBuffer, fNumber, rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, '.', sal_True);
+}
+
+/** convert string to double number (using ::rtl::math) */
+sal_Bool SvXMLUnitConverter::convertDouble(double& rValue,
+ const ::rtl::OUString& rString, sal_Bool bLookForUnits) const
+{
+ if(bLookForUnits)
+ {
+ MapUnit eSrcUnit = SvXMLExportHelper::GetUnitFromString(rString, meCoreMeasureUnit);
+
+ return SvXMLUnitConverter::convertDouble(rValue, rString,
+ eSrcUnit, meCoreMeasureUnit);
+ }
+ else
+ {
+ return SvXMLUnitConverter::convertDouble(rValue, rString);
+ }
+}
+
+/** convert string to double number (using ::rtl::math) */
+sal_Bool SvXMLUnitConverter::convertDouble(double& rValue,
+ const OUString& rString, MapUnit eSrcUnit, MapUnit eCoreUnit)
+{
+ rtl_math_ConversionStatus eStatus;
+ rValue = ::rtl::math::stringToDouble( rString, (sal_Unicode)('.'), (sal_Unicode)(','), &eStatus, NULL );
+
+ if(eStatus == rtl_math_ConversionStatus_Ok)
+ {
+ OUStringBuffer sUnit;
+ const double fFactor = SvXMLExportHelper::GetConversionFactor(sUnit, eCoreUnit, eSrcUnit);
+ if(fFactor != 1.0 && fFactor != 0.0)
+ rValue /= fFactor;
+ }
+
+ return ( eStatus == rtl_math_ConversionStatus_Ok );
+}
+
+/** convert string to double number (using ::rtl::math) */
+sal_Bool SvXMLUnitConverter::convertDouble(double& rValue, const OUString& rString)
+{
+ rtl_math_ConversionStatus eStatus;
+ rValue = ::rtl::math::stringToDouble( rString, (sal_Unicode)('.'), (sal_Unicode)(','), &eStatus, NULL );
+ return ( eStatus == rtl_math_ConversionStatus_Ok );
+}
+
+/** get the Null Date of the XModel and set it to the UnitConverter */
+sal_Bool SvXMLUnitConverter::setNullDate(const com::sun::star::uno::Reference <com::sun::star::frame::XModel>& xModel)
+{
+ com::sun::star::uno::Reference <com::sun::star::util::XNumberFormatsSupplier> xNumberFormatsSupplier (xModel, com::sun::star::uno::UNO_QUERY);
+ if (xNumberFormatsSupplier.is())
+ {
+ const com::sun::star::uno::Reference <com::sun::star::beans::XPropertySet> xPropertySet = xNumberFormatsSupplier->getNumberFormatSettings();
+ return xPropertySet.is() && (xPropertySet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM(XML_NULLDATE))) >>= aNullDate);
+ }
+ return sal_False;
+}
+
+/** convert double to ISO Time String; negative durations allowed */
+void SvXMLUnitConverter::convertTime( OUStringBuffer& rBuffer,
+ const double& fTime)
+{
+
+ double fValue = fTime;
+
+ // take care of negative durations as specified in:
+ // XML Schema, W3C Working Draft 07 April 2000, section 3.2.6.1
+ if (fValue < 0.0)
+ {
+ rBuffer.append(sal_Unicode('-'));
+ fValue = - fValue;
+ }
+
+ rBuffer.appendAscii(RTL_CONSTASCII_STRINGPARAM( "PT" ));
+ fValue *= 24;
+ double fHoursValue = ::rtl::math::approxFloor (fValue);
+ fValue -= fHoursValue;
+ fValue *= 60;
+ double fMinsValue = ::rtl::math::approxFloor (fValue);
+ fValue -= fMinsValue;
+ fValue *= 60;
+ double fSecsValue = ::rtl::math::approxFloor (fValue);
+ fValue -= fSecsValue;
+ double f100SecsValue;
+ if (fValue > 0.00001)
+ f100SecsValue = ::rtl::math::round( fValue, XML_MAXDIGITSCOUNT_TIME - 5);
+ else
+ f100SecsValue = 0.0;
+
+ if (f100SecsValue == 1.0)
+ {
+ f100SecsValue = 0.0;
+ fSecsValue += 1.0;
+ }
+ if (fSecsValue >= 60.0)
+ {
+ fSecsValue -= 60.0;
+ fMinsValue += 1.0;
+ }
+ if (fMinsValue >= 60.0)
+ {
+ fMinsValue -= 60.0;
+ fHoursValue += 1.0;
+ }
+
+ if (fHoursValue < 10)
+ rBuffer.append( sal_Unicode('0'));
+ rBuffer.append( sal_Int32( fHoursValue));
+ rBuffer.append( sal_Unicode('H'));
+ if (fMinsValue < 10)
+ rBuffer.append( sal_Unicode('0'));
+ rBuffer.append( sal_Int32( fMinsValue));
+ rBuffer.append( sal_Unicode('M'));
+ if (fSecsValue < 10)
+ rBuffer.append( sal_Unicode('0'));
+ rBuffer.append( sal_Int32( fSecsValue));
+ if (f100SecsValue > 0.0)
+ {
+ OUString a100th( ::rtl::math::doubleToUString( fValue,
+ rtl_math_StringFormat_F, XML_MAXDIGITSCOUNT_TIME - 5, '.',
+ sal_True));
+ if ( a100th.getLength() > 2 )
+ {
+ rBuffer.append( sal_Unicode('.'));
+ rBuffer.append( a100th.copy( 2 ) ); // strip 0.
+ }
+ }
+ rBuffer.append( sal_Unicode('S'));
+}
+
+/** convert ISO Time String to double; negative durations allowed */
+static bool lcl_convertTime( const ::rtl::OUString& rString, sal_Int32& o_rDays, sal_Int32& o_rHours, sal_Int32& o_rMins,
+ sal_Int32& o_rSecs, sal_Bool& o_rIsNegativeTime, double& o_rFractionalSecs )
+{
+ OUString aTrimmed = rString.trim().toAsciiUpperCase();
+ const sal_Unicode* pStr = aTrimmed.getStr();
+
+ // negative time duration?
+ if ( sal_Unicode('-') == (*pStr) )
+ {
+ o_rIsNegativeTime = sal_True;
+ pStr++;
+ }
+
+ if ( *(pStr++) != sal_Unicode('P') ) // duration must start with "P"
+ return false;
+
+ ::rtl::OUString sDoubleStr;
+ sal_Bool bSuccess = true;
+ sal_Bool bDone = sal_False;
+ sal_Bool bTimePart = sal_False;
+ sal_Bool bIsFraction = sal_False;
+ sal_Int32 nTemp = 0;
+
+ while ( bSuccess && !bDone )
+ {
+ sal_Unicode c = *(pStr++);
+ if ( !c ) // end
+ bDone = sal_True;
+ else if ( sal_Unicode('0') <= c && sal_Unicode('9') >= c )
+ {
+ if ( nTemp >= SAL_MAX_INT32 / 10 )
+ bSuccess = false;
+ else
+ {
+ if ( !bIsFraction )
+ {
+ nTemp *= 10;
+ nTemp += (c - sal_Unicode('0'));
+ }
+ else
+ {
+ sDoubleStr += OUString::valueOf(c);
+ }
+ }
+ }
+ else if ( bTimePart )
+ {
+ if ( c == sal_Unicode('H') )
+ {
+ o_rHours = nTemp;
+ nTemp = 0;
+ }
+ else if ( c == sal_Unicode('M') )
+ {
+ o_rMins = nTemp;
+ nTemp = 0;
+ }
+ else if ( (c == sal_Unicode(',')) || (c == sal_Unicode('.')) )
+ {
+ o_rSecs = nTemp;
+ nTemp = 0;
+ bIsFraction = sal_True;
+ sDoubleStr = OUString(RTL_CONSTASCII_USTRINGPARAM("0."));
+ }
+ else if ( c == sal_Unicode('S') )
+ {
+ if ( !bIsFraction )
+ {
+ o_rSecs = nTemp;
+ nTemp = 0;
+ sDoubleStr = OUString(RTL_CONSTASCII_USTRINGPARAM("0.0"));
+ }
+ }
+ else
+ bSuccess = false; // invalid character
+ }
+ else
+ {
+ if ( c == sal_Unicode('T') ) // "T" starts time part
+ bTimePart = sal_True;
+ else if ( c == sal_Unicode('D') )
+ {
+ o_rDays = nTemp;
+ nTemp = 0;
+ }
+ else if ( c == sal_Unicode('Y') || c == sal_Unicode('M') )
+ {
+ //! how many days is a year or month?
+
+ OSL_FAIL("years or months in duration: not implemented");
+ bSuccess = false;
+ }
+ else
+ bSuccess = false; // invalid character
+ }
+ }
+
+ if ( bSuccess )
+ o_rFractionalSecs = sDoubleStr.toDouble();
+ return bSuccess;
+}
+
+sal_Bool SvXMLUnitConverter::convertTime( double& fTime,
+ const ::rtl::OUString& rString)
+{
+ sal_Int32 nDays = 0;
+ sal_Int32 nHours = 0;
+ sal_Int32 nMins = 0;
+ sal_Int32 nSecs = 0;
+ sal_Bool bIsNegativeDuration = sal_False;
+ double fFractionalSecs = 0.0;
+ if ( lcl_convertTime( rString, nDays, nHours, nMins, nSecs, bIsNegativeDuration, fFractionalSecs ) )
+ {
+ if ( nDays )
+ nHours += nDays * 24; // add the days to the hours part
+ double fTempTime = 0.0;
+ double fHour = nHours;
+ double fMin = nMins;
+ double fSec = nSecs;
+ double fSec100 = 0.0;
+ fTempTime = fHour / 24;
+ fTempTime += fMin / (24 * 60);
+ fTempTime += fSec / (24 * 60 * 60);
+ fTempTime += fSec100 / (24 * 60 * 60 * 60);
+ fTempTime += fFractionalSecs / (24 * 60 * 60);
+
+ // negative duration?
+ if ( bIsNegativeDuration )
+ {
+ fTempTime = -fTempTime;
+ }
+
+ fTime = fTempTime;
+ return sal_True;
+ }
+ return sal_False;
+}
+
+/** convert util::DateTime to ISO Time String */
+void SvXMLUnitConverter::convertTime( OUStringBuffer& rBuffer,
+ const ::com::sun::star::util::DateTime& rDateTime )
+{
+ double fHour = rDateTime.Hours;
+ double fMin = rDateTime.Minutes;
+ double fSec = rDateTime.Seconds;
+ double fSec100 = rDateTime.HundredthSeconds;
+ double fTempTime = fHour / 24;
+ fTempTime += fMin / (24 * 60);
+ fTempTime += fSec / (24 * 60 * 60);
+ fTempTime += fSec100 / (24 * 60 * 60 * 100);
+ convertTime( rBuffer, fTempTime );
+}
+
+/** convert ISO Time String to util::DateTime */
+sal_Bool SvXMLUnitConverter::convertTime( ::com::sun::star::util::DateTime& rDateTime,
+ const OUString& rString )
+{
+ sal_Int32 nDays = 0, nHours = 0, nMins = 0, nSecs = 0;
+ sal_Bool bIsNegativeDuration = sal_False;
+ double fFractionalSecs = 0.0;
+ if ( lcl_convertTime( rString, nDays, nHours, nMins, nSecs, bIsNegativeDuration, fFractionalSecs ) )
+ {
+ rDateTime.Year = 0;
+ rDateTime.Month = 0;
+ rDateTime.Day = 0;
+ rDateTime.Hours = static_cast < sal_uInt16 > ( nHours );
+ rDateTime.Minutes = static_cast < sal_uInt16 > ( nMins );
+ rDateTime.Seconds = static_cast < sal_uInt16 > ( nSecs );
+ rDateTime.HundredthSeconds = static_cast < sal_uInt16 > ( fFractionalSecs * 100.0 );
+
+ return sal_True;
+ }
+ return sal_False;
+}
+
+/** convert double to ISO Date Time String */
+void SvXMLUnitConverter::convertDateTime( OUStringBuffer& rBuffer,
+ const double& fDateTime,
+ const com::sun::star::util::Date& aTempNullDate,
+ sal_Bool bAddTimeIf0AM )
+{
+ double fValue = fDateTime;
+ sal_Int32 nValue = static_cast <sal_Int32> (::rtl::math::approxFloor (fValue));
+ Date aDate (aTempNullDate.Day, aTempNullDate.Month, aTempNullDate.Year);
+ aDate += nValue;
+ fValue -= nValue;
+ double fCount;
+ if (nValue > 0)
+ fCount = ::rtl::math::approxFloor (log10((double)nValue)) + 1;
+ else if (nValue < 0)
+ fCount = ::rtl::math::approxFloor (log10((double)(nValue * -1))) + 1;
+ else
+ fCount = 0.0;
+ sal_Int16 nCount = sal_Int16(fCount);
+ sal_Bool bHasTime(sal_False);
+ double fHoursValue = 0;
+ double fMinsValue = 0;
+ double fSecsValue = 0;
+ double f100SecsValue = 0;
+ if (fValue > 0.0)
+ {
+ bHasTime = sal_True;
+ fValue *= 24;
+ fHoursValue = ::rtl::math::approxFloor (fValue);
+ fValue -= fHoursValue;
+ fValue *= 60;
+ fMinsValue = ::rtl::math::approxFloor (fValue);
+ fValue -= fMinsValue;
+ fValue *= 60;
+ fSecsValue = ::rtl::math::approxFloor (fValue);
+ fValue -= fSecsValue;
+ if (fValue > 0.0)
+ f100SecsValue = ::rtl::math::round( fValue, XML_MAXDIGITSCOUNT_TIME - nCount);
+ else
+ f100SecsValue = 0.0;
+
+ if (f100SecsValue == 1.0)
+ {
+ f100SecsValue = 0.0;
+ fSecsValue += 1.0;
+ }
+ if (fSecsValue >= 60.0)
+ {
+ fSecsValue -= 60.0;
+ fMinsValue += 1.0;
+ }
+ if (fMinsValue >= 60.0)
+ {
+ fMinsValue -= 60.0;
+ fHoursValue += 1.0;
+ }
+ if (fHoursValue >= 24.0)
+ {
+ fHoursValue -= 24.0;
+ aDate += 1;
+ }
+ }
+ rBuffer.append( sal_Int32( aDate.GetYear()));
+ rBuffer.append( sal_Unicode('-'));
+ sal_uInt16 nTemp = aDate.GetMonth();
+ if (nTemp < 10)
+ rBuffer.append( sal_Unicode('0'));
+ rBuffer.append( sal_Int32( nTemp));
+ rBuffer.append( sal_Unicode('-'));
+ nTemp = aDate.GetDay();
+ if (nTemp < 10)
+ rBuffer.append( sal_Unicode('0'));
+ rBuffer.append( sal_Int32( nTemp));
+ if(bHasTime || bAddTimeIf0AM)
+ {
+ rBuffer.append( sal_Unicode('T'));
+ if (fHoursValue < 10)
+ rBuffer.append( sal_Unicode('0'));
+ rBuffer.append( sal_Int32( fHoursValue));
+ rBuffer.append( sal_Unicode(':'));
+ if (fMinsValue < 10)
+ rBuffer.append( sal_Unicode('0'));
+ rBuffer.append( sal_Int32( fMinsValue));
+ rBuffer.append( sal_Unicode(':'));
+ if (fSecsValue < 10)
+ rBuffer.append( sal_Unicode('0'));
+ rBuffer.append( sal_Int32( fSecsValue));
+ if (f100SecsValue > 0.0)
+ {
+ OUString a100th( ::rtl::math::doubleToUString( fValue,
+ rtl_math_StringFormat_F,
+ XML_MAXDIGITSCOUNT_TIME - nCount, '.', sal_True));
+ if ( a100th.getLength() > 2 )
+ {
+ rBuffer.append( sal_Unicode('.'));
+ rBuffer.append( a100th.copy( 2 ) ); // strip 0.
+ }
+ }
+ }
+}
+
+/** convert ISO Date Time String to double */
+sal_Bool SvXMLUnitConverter::convertDateTime( double& fDateTime,
+ const OUString& rString, const com::sun::star::util::Date& aTempNullDate)
+{
+ com::sun::star::util::DateTime aDateTime;
+ sal_Bool bSuccess = convertDateTime(aDateTime,rString);
+
+ if (bSuccess)
+ {
+ double fTempDateTime = 0.0;
+ const Date aTmpNullDate(aTempNullDate.Day, aTempNullDate.Month, aTempNullDate.Year);
+ const Date aTempDate((sal_uInt16)aDateTime.Day, (sal_uInt16)aDateTime.Month, (sal_uInt16)aDateTime.Year);
+ const sal_Int32 nTage = aTempDate - aTmpNullDate;
+ fTempDateTime = nTage;
+ double Hour = aDateTime.Hours;
+ double Min = aDateTime.Minutes;
+ double Sec = aDateTime.Seconds;
+ double Sec100 = aDateTime.HundredthSeconds;
+ fTempDateTime += Hour / 24;
+ fTempDateTime += Min / (24 * 60);
+ fTempDateTime += Sec / (24 * 60 * 60);
+ fTempDateTime += Sec100 / (24 * 60 * 60 * 100);
+ fDateTime = fTempDateTime;
+ }
+ return bSuccess;
+}
+
+/** convert util::DateTime to ISO Date String */
+void SvXMLUnitConverter::convertDateTime(
+ OUStringBuffer& rBuffer,
+ const com::sun::star::util::DateTime& rDateTime,
+ sal_Bool bAddTimeIf0AM )
+{
+ String aString( String::CreateFromInt32( rDateTime.Year ) );
+ aString += '-';
+ if( rDateTime.Month < 10 )
+ aString += '0';
+ aString += String::CreateFromInt32( rDateTime.Month );
+ aString += '-';
+ if( rDateTime.Day < 10 )
+ aString += '0';
+ aString += String::CreateFromInt32( rDateTime.Day );
+
+ if( rDateTime.Seconds != 0 ||
+ rDateTime.Minutes != 0 ||
+ rDateTime.Hours != 0 ||
+ bAddTimeIf0AM )
+ {
+ aString += 'T';
+ if( rDateTime.Hours < 10 )
+ aString += '0';
+ aString += String::CreateFromInt32( rDateTime.Hours );
+ aString += ':';
+ if( rDateTime.Minutes < 10 )
+ aString += '0';
+ aString += String::CreateFromInt32( rDateTime.Minutes );
+ aString += ':';
+ if( rDateTime.Seconds < 10 )
+ aString += '0';
+ aString += String::CreateFromInt32( rDateTime.Seconds );
+ if ( rDateTime.HundredthSeconds > 0)
+ {
+ aString += '.';
+ if (rDateTime.HundredthSeconds < 10)
+ aString += '0';
+ aString += String::CreateFromInt32( rDateTime.HundredthSeconds );
+ }
+ }
+
+ rBuffer.append( aString );
+}
+
+/** convert ISO Date String to util::DateTime */
+sal_Bool SvXMLUnitConverter::convertDateTime( com::sun::star::util::DateTime& rDateTime,
+ const OUString& rString )
+{
+ sal_Bool bSuccess = sal_True;
+
+ OUString aDateStr, aTimeStr, sDoubleStr;
+ sal_Int32 nPos = rString.indexOf( (sal_Unicode) 'T' );
+ sal_Int32 nPos2 = rString.indexOf( (sal_Unicode) ',' );
+ if (nPos2 < 0)
+ nPos2 = rString.indexOf( (sal_Unicode) '.' );
+ if ( nPos >= 0 )
+ {
+ aDateStr = rString.copy( 0, nPos );
+ if ( nPos2 >= 0 )
+ {
+ aTimeStr = rString.copy( nPos + 1, nPos2 - nPos - 1 );
+ sDoubleStr = OUString(RTL_CONSTASCII_USTRINGPARAM("0."));
+ sDoubleStr += rString.copy( nPos2 + 1 );
+ }
+ else
+ {
+ aTimeStr = rString.copy(nPos + 1);
+ sDoubleStr = OUString(RTL_CONSTASCII_USTRINGPARAM("0.0"));
+ }
+ }
+ else
+ aDateStr = rString; // no separator: only date part
+
+ sal_Int32 nYear = 1899;
+ sal_Int32 nMonth = 12;
+ sal_Int32 nDay = 30;
+ sal_Int32 nHour = 0;
+ sal_Int32 nMin = 0;
+ sal_Int32 nSec = 0;
+
+ const sal_Unicode* pStr = aDateStr.getStr();
+ sal_Int32 nDateTokens = 1;
+ while ( *pStr )
+ {
+ if ( *pStr == '-' )
+ nDateTokens++;
+ pStr++;
+ }
+ if ( nDateTokens > 3 || aDateStr.getLength() == 0 )
+ bSuccess = sal_False;
+ else
+ {
+ sal_Int32 n = 0;
+ if ( !convertNumber( nYear, aDateStr.getToken( 0, '-', n ), 0, 9999 ) )
+ bSuccess = sal_False;
+ if ( nDateTokens >= 2 )
+ if ( !convertNumber( nMonth, aDateStr.getToken( 0, '-', n ), 0, 12 ) )
+ bSuccess = sal_False;
+ if ( nDateTokens >= 3 )
+ if ( !convertNumber( nDay, aDateStr.getToken( 0, '-', n ), 0, 31 ) )
+ bSuccess = sal_False;
+ }
+
+ if ( aTimeStr.getLength() > 0 ) // time is optional
+ {
+ pStr = aTimeStr.getStr();
+ sal_Int32 nTimeTokens = 1;
+ while ( *pStr )
+ {
+ if ( *pStr == ':' )
+ nTimeTokens++;
+ pStr++;
+ }
+ if ( nTimeTokens > 3 )
+ bSuccess = sal_False;
+ else
+ {
+ sal_Int32 n = 0;
+ if ( !convertNumber( nHour, aTimeStr.getToken( 0, ':', n ), 0, 23 ) )
+ bSuccess = sal_False;
+ if ( nTimeTokens >= 2 )
+ if ( !convertNumber( nMin, aTimeStr.getToken( 0, ':', n ), 0, 59 ) )
+ bSuccess = sal_False;
+ if ( nTimeTokens >= 3 )
+ if ( !convertNumber( nSec, aTimeStr.getToken( 0, ':', n ), 0, 59 ) )
+ bSuccess = sal_False;
+ }
+ }
+
+ if (bSuccess)
+ {
+ rDateTime.Year = (sal_uInt16)nYear;
+ rDateTime.Month = (sal_uInt16)nMonth;
+ rDateTime.Day = (sal_uInt16)nDay;
+ rDateTime.Hours = (sal_uInt16)nHour;
+ rDateTime.Minutes = (sal_uInt16)nMin;
+ rDateTime.Seconds = (sal_uInt16)nSec;
+ rDateTime.HundredthSeconds = (sal_uInt16)(sDoubleStr.toDouble() * 100);
+ }
+ return bSuccess;
+}
+
+/** gets the position of the first comma after npos in the string
+ rStr. Commas inside '"' pairs are not matched */
+sal_Int32 SvXMLUnitConverter::indexOfComma( const OUString& rStr,
+ sal_Int32 nPos )
+{
+ sal_Unicode cQuote = 0;
+ sal_Int32 nLen = rStr.getLength();
+ for( ; nPos < nLen; nPos++ )
+ {
+ sal_Unicode c = rStr[nPos];
+ switch( c )
+ {
+ case sal_Unicode('\''):
+ if( 0 == cQuote )
+ cQuote = c;
+ else if( '\'' == cQuote )
+ cQuote = 0;
+ break;
+
+ case sal_Unicode('"'):
+ if( 0 == cQuote )
+ cQuote = c;
+ else if( '\"' == cQuote )
+ cQuote = 0;
+ break;
+
+ case sal_Unicode(','):
+ if( 0 == cQuote )
+ return nPos;
+ break;
+ }
+ }
+
+ return -1;
+}
+
+SvXMLTokenEnumerator::SvXMLTokenEnumerator( const OUString& rString, sal_Unicode cSeperator /* = sal_Unicode(' ') */ )
+: maTokenString( rString ), mnNextTokenPos(0), mcSeperator( cSeperator )
+{
+}
+
+sal_Bool SvXMLTokenEnumerator::getNextToken( OUString& rToken )
+{
+ if( -1 == mnNextTokenPos )
+ return sal_False;
+
+ int nTokenEndPos = maTokenString.indexOf( mcSeperator, mnNextTokenPos );
+ if( nTokenEndPos != -1 )
+ {
+ rToken = maTokenString.copy( mnNextTokenPos,
+ nTokenEndPos - mnNextTokenPos );
+ mnNextTokenPos = nTokenEndPos + 1;
+
+ // if the mnNextTokenPos is at the end of the string, we have
+ // to deliver an empty token
+ if( mnNextTokenPos > maTokenString.getLength() )
+ mnNextTokenPos = -1;
+ }
+ else
+ {
+ rToken = maTokenString.copy( mnNextTokenPos );
+ mnNextTokenPos = -1;
+ }
+
+ return sal_True;
+}
+
+bool lcl_getPositions(const OUString& _sValue,OUString& _rContentX,OUString& _rContentY,OUString& _rContentZ)
+{
+ if(!_sValue.getLength() || _sValue[0] != '(')
+ return false;
+
+ sal_Int32 nPos(1L);
+ sal_Int32 nFound = _sValue.indexOf(sal_Unicode(' '), nPos);
+
+ if(nFound == -1 || nFound <= nPos)
+ return false;
+
+ _rContentX = _sValue.copy(nPos, nFound - nPos);
+
+ nPos = nFound + 1;
+ nFound = _sValue.indexOf(sal_Unicode(' '), nPos);
+
+ if(nFound == -1 || nFound <= nPos)
+ return false;
+
+ _rContentY = _sValue.copy(nPos, nFound - nPos);
+
+ nPos = nFound + 1;
+ nFound = _sValue.indexOf(sal_Unicode(')'), nPos);
+
+ if(nFound == -1 || nFound <= nPos)
+ return false;
+
+ _rContentZ = _sValue.copy(nPos, nFound - nPos);
+ return true;
+
+}
+/** convert string to ::basegfx::B3DVector */
+sal_Bool SvXMLUnitConverter::convertB3DVector( ::basegfx::B3DVector& rVector, const OUString& rValue )
+{
+ OUString aContentX,aContentY,aContentZ;
+ if ( !lcl_getPositions(rValue,aContentX,aContentY,aContentZ) )
+ return sal_False;
+
+ rtl_math_ConversionStatus eStatus;
+
+ rVector.setX(::rtl::math::stringToDouble(aContentX, sal_Unicode('.'),
+ sal_Unicode(','), &eStatus, NULL));
+
+ if( eStatus != rtl_math_ConversionStatus_Ok )
+ return sal_False;
+
+ rVector.setY(::rtl::math::stringToDouble(aContentY, sal_Unicode('.'),
+ sal_Unicode(','), &eStatus, NULL));
+
+ if( eStatus != rtl_math_ConversionStatus_Ok )
+ return sal_False;
+
+ rVector.setZ(::rtl::math::stringToDouble(aContentZ, sal_Unicode('.'),
+ sal_Unicode(','), &eStatus, NULL));
+
+
+ return ( eStatus == rtl_math_ConversionStatus_Ok );
+}
+
+/** convert ::basegfx::B3DVector to string */
+void SvXMLUnitConverter::convertB3DVector( OUStringBuffer &rBuffer, const ::basegfx::B3DVector& rVector )
+{
+ rBuffer.append(sal_Unicode('('));
+ convertDouble(rBuffer, rVector.getX());
+ rBuffer.append(sal_Unicode(' '));
+ convertDouble(rBuffer, rVector.getY());
+ rBuffer.append(sal_Unicode(' '));
+ convertDouble(rBuffer, rVector.getZ());
+ rBuffer.append(sal_Unicode(')'));
+}
+
+/** convert string to Position3D */
+sal_Bool SvXMLUnitConverter::convertPosition3D( drawing::Position3D& rPosition,
+ const OUString& rValue )
+{
+ OUString aContentX,aContentY,aContentZ;
+ if ( !lcl_getPositions(rValue,aContentX,aContentY,aContentZ) )
+ return sal_False;
+
+ if ( !convertDouble( rPosition.PositionX, aContentX, sal_True ) )
+ return sal_False;
+ if ( !convertDouble( rPosition.PositionY, aContentY, sal_True ) )
+ return sal_False;
+ return convertDouble( rPosition.PositionZ, aContentZ, sal_True );
+}
+
+/** convert Position3D to string */
+void SvXMLUnitConverter::convertPosition3D( OUStringBuffer &rBuffer,
+ const drawing::Position3D& rPosition )
+{
+ rBuffer.append( sal_Unicode('(') );
+ convertDouble( rBuffer, rPosition.PositionX, sal_True );
+ rBuffer.append( sal_Unicode(' ') );
+ convertDouble( rBuffer, rPosition.PositionY, sal_True );
+ rBuffer.append( sal_Unicode(' ') );
+ convertDouble( rBuffer, rPosition.PositionZ, sal_True );
+ rBuffer.append( sal_Unicode(')') );
+}
+
+const
+ sal_Char aBase64EncodeTable[] =
+ { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
+ 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
+ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
+ 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/' };
+
+const
+ sal_uInt8 aBase64DecodeTable[] =
+ { 62,255,255,255, 63, // 43-47
+// + /
+
+ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,255,255,255, 0,255,255, // 48-63
+// 0 1 2 3 4 5 6 7 8 9 =
+
+ 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, // 64-79
+// A B C D E F G H I J K L M N O
+
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,255,255,255,255,255, // 80-95
+// P Q R S T U V W X Y Z
+
+ 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, // 96-111
+// a b c d e f g h i j k l m n o
+
+ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51 }; // 112-123
+// p q r s t u v w x y z
+
+
+
+void ThreeByteToFourByte (const sal_Int8* pBuffer, const sal_Int32 nStart, const sal_Int32 nFullLen, OUStringBuffer& sBuffer)
+{
+ sal_Int32 nLen(nFullLen - nStart);
+ if (nLen > 3)
+ nLen = 3;
+ if (nLen == 0)
+ {
+ sBuffer.setLength(0);
+ return;
+ }
+
+ sal_Int32 nBinaer;
+ switch (nLen)
+ {
+ case 1:
+ {
+ nBinaer = ((sal_uInt8)pBuffer[nStart + 0]) << 16;
+ }
+ break;
+ case 2:
+ {
+ nBinaer = (((sal_uInt8)pBuffer[nStart + 0]) << 16) +
+ (((sal_uInt8)pBuffer[nStart + 1]) << 8);
+ }
+ break;
+ default:
+ {
+ nBinaer = (((sal_uInt8)pBuffer[nStart + 0]) << 16) +
+ (((sal_uInt8)pBuffer[nStart + 1]) << 8) +
+ ((sal_uInt8)pBuffer[nStart + 2]);
+ }
+ break;
+ }
+
+ sBuffer.appendAscii("====");
+
+ sal_uInt8 nIndex (static_cast<sal_uInt8>((nBinaer & 0xFC0000) >> 18));
+ sBuffer.setCharAt(0, aBase64EncodeTable [nIndex]);
+
+ nIndex = static_cast<sal_uInt8>((nBinaer & 0x3F000) >> 12);
+ sBuffer.setCharAt(1, aBase64EncodeTable [nIndex]);
+ if (nLen == 1)
+ return;
+
+ nIndex = static_cast<sal_uInt8>((nBinaer & 0xFC0) >> 6);
+ sBuffer.setCharAt(2, aBase64EncodeTable [nIndex]);
+ if (nLen == 2)
+ return;
+
+ nIndex = static_cast<sal_uInt8>((nBinaer & 0x3F));
+ sBuffer.setCharAt(3, aBase64EncodeTable [nIndex]);
+}
+
+void SvXMLUnitConverter::encodeBase64(OUStringBuffer& aStrBuffer, const uno::Sequence<sal_Int8>& aPass)
+{
+ sal_Int32 i(0);
+ sal_Int32 nBufferLength(aPass.getLength());
+ const sal_Int8* pBuffer = aPass.getConstArray();
+ while (i < nBufferLength)
+ {
+ OUStringBuffer sBuffer;
+ ThreeByteToFourByte (pBuffer, i, nBufferLength, sBuffer);
+ aStrBuffer.append(sBuffer);
+ i += 3;
+ }
+}
+
+void SvXMLUnitConverter::decodeBase64(uno::Sequence<sal_Int8>& aBuffer, const OUString& sBuffer)
+{
+ sal_Int32 nCharsDecoded = decodeBase64SomeChars( aBuffer, sBuffer );
+ OSL_ENSURE( nCharsDecoded == sBuffer.getLength(),
+ "some bytes left in base64 decoding!" );
+ (void)nCharsDecoded;
+}
+
+sal_Int32 SvXMLUnitConverter::decodeBase64SomeChars(
+ uno::Sequence<sal_Int8>& rOutBuffer,
+ const OUString& rInBuffer)
+{
+ sal_Int32 nInBufferLen = rInBuffer.getLength();
+ sal_Int32 nMinOutBufferLen = (nInBufferLen / 4) * 3;
+ if( rOutBuffer.getLength() < nMinOutBufferLen )
+ rOutBuffer.realloc( nMinOutBufferLen );
+
+ const sal_Unicode *pInBuffer = rInBuffer.getStr();
+ sal_Int8 *pOutBuffer = rOutBuffer.getArray();
+ sal_Int8 *pOutBufferStart = pOutBuffer;
+ sal_Int32 nCharsDecoded = 0;
+
+ sal_uInt8 aDecodeBuffer[4];
+ sal_Int32 nBytesToDecode = 0;
+ sal_Int32 nBytesGotFromDecoding = 3;
+ sal_Int32 nInBufferPos= 0;
+ while( nInBufferPos < nInBufferLen )
+ {
+ sal_Unicode cChar = *pInBuffer;
+ if( cChar >= '+' && cChar <= 'z' )
+ {
+ sal_uInt8 nByte = aBase64DecodeTable[cChar-'+'];
+ if( nByte != 255 )
+ {
+ // We have found a valid character!
+ aDecodeBuffer[nBytesToDecode++] = nByte;
+
+ // One '=' character at the end means 2 out bytes
+ // Two '=' characters at the end mean 1 out bytes
+ if( '=' == cChar && nBytesToDecode > 2 )
+ nBytesGotFromDecoding--;
+ if( 4 == nBytesToDecode )
+ {
+ // Four characters found, so we may convert now!
+ sal_uInt32 nOut = (aDecodeBuffer[0] << 18) +
+ (aDecodeBuffer[1] << 12) +
+ (aDecodeBuffer[2] << 6) +
+ aDecodeBuffer[3];
+
+ *pOutBuffer++ = (sal_Int8)((nOut & 0xff0000) >> 16);
+ if( nBytesGotFromDecoding > 1 )
+ *pOutBuffer++ = (sal_Int8)((nOut & 0xff00) >> 8);
+ if( nBytesGotFromDecoding > 2 )
+ *pOutBuffer++ = (sal_Int8)(nOut & 0xff);
+ nCharsDecoded = nInBufferPos + 1;
+ nBytesToDecode = 0;
+ nBytesGotFromDecoding = 3;
+ }
+ }
+ else
+ {
+ nCharsDecoded++;
+ }
+ }
+ else
+ {
+ nCharsDecoded++;
+ }
+
+ nInBufferPos++;
+ pInBuffer++;
+ }
+ if( (pOutBuffer - pOutBufferStart) != rOutBuffer.getLength() )
+ rOutBuffer.realloc( pOutBuffer - pOutBufferStart );
+
+ return nCharsDecoded;
+}
+
+sal_Bool SvXMLUnitConverter::convertNumFormat(
+ sal_Int16& rType,
+ const OUString& rNumFmt,
+ const OUString& rNumLetterSync,
+ sal_Bool bNumberNone ) const
+{
+ sal_Bool bRet = sal_True;
+ sal_Bool bExt = sal_False;
+
+ sal_Int32 nLen = rNumFmt.getLength();
+ if( 0 == nLen )
+ {
+ if( bNumberNone )
+ rType = NumberingType::NUMBER_NONE;
+ else
+ bRet = sal_False;
+ }
+ else if( 1 == nLen )
+ {
+ switch( rNumFmt[0] )
+ {
+ case sal_Unicode('1'): rType = NumberingType::ARABIC; break;
+ case sal_Unicode('a'): rType = NumberingType::CHARS_LOWER_LETTER; break;
+ case sal_Unicode('A'): rType = NumberingType::CHARS_UPPER_LETTER; break;
+ case sal_Unicode('i'): rType = NumberingType::ROMAN_LOWER; break;
+ case sal_Unicode('I'): rType = NumberingType::ROMAN_UPPER; break;
+ default: bExt = sal_True; break;
+ }
+ if( !bExt && IsXMLToken( rNumLetterSync, XML_TRUE ) )
+ {
+ switch( rType )
+ {
+ case NumberingType::CHARS_LOWER_LETTER:
+ rType = NumberingType::CHARS_LOWER_LETTER_N;
+ break;
+ case NumberingType::CHARS_UPPER_LETTER:
+ rType = NumberingType::CHARS_UPPER_LETTER_N;
+ break;
+ }
+ }
+ }
+ else
+ {
+ bExt = sal_True;
+ }
+ if( bExt )
+ {
+ Reference < XNumberingTypeInfo > xInfo = getNumTypeInfo();
+ if( xInfo.is() && xInfo->hasNumberingType( rNumFmt ) )
+ {
+ rType = xInfo->getNumberingType( rNumFmt );
+ }
+ else
+ {
+ rType = NumberingType::ARABIC;
+ }
+ }
+
+ return bRet;
+}
+
+void SvXMLUnitConverter::convertNumFormat( OUStringBuffer& rBuffer,
+ sal_Int16 nType ) const
+{
+ enum XMLTokenEnum eFormat = XML_TOKEN_INVALID;
+ switch( nType )
+ {
+ case NumberingType::CHARS_UPPER_LETTER: eFormat = XML_A_UPCASE; break;
+ case NumberingType::CHARS_LOWER_LETTER: eFormat = XML_A; break;
+ case NumberingType::ROMAN_UPPER: eFormat = XML_I_UPCASE; break;
+ case NumberingType::ROMAN_LOWER: eFormat = XML_I; break;
+ case NumberingType::ARABIC: eFormat = XML_1; break;
+ case NumberingType::CHARS_UPPER_LETTER_N: eFormat = XML_A_UPCASE; break;
+ case NumberingType::CHARS_LOWER_LETTER_N: eFormat = XML_A; break;
+ case NumberingType::NUMBER_NONE: eFormat = XML__EMPTY; break;
+
+ case NumberingType::CHAR_SPECIAL:
+ case NumberingType::PAGE_DESCRIPTOR:
+ case NumberingType::BITMAP:
+ DBG_ASSERT( eFormat != XML_TOKEN_INVALID, "invalid number format" );
+ break;
+ default:
+ break;
+ }
+
+ if( eFormat != XML_TOKEN_INVALID )
+ {
+ rBuffer.append( GetXMLToken(eFormat) );
+ }
+ else
+ {
+ Reference < XNumberingTypeInfo > xInfo = getNumTypeInfo();
+ if( xInfo.is() )
+ rBuffer.append( xInfo->getNumberingIdentifier( nType ) );
+ }
+}
+
+void SvXMLUnitConverter::convertNumLetterSync( OUStringBuffer& rBuffer,
+ sal_Int16 nType ) const
+{
+ enum XMLTokenEnum eSync = XML_TOKEN_INVALID;
+ switch( nType )
+ {
+ case NumberingType::CHARS_UPPER_LETTER:
+ case NumberingType::CHARS_LOWER_LETTER:
+ case NumberingType::ROMAN_UPPER:
+ case NumberingType::ROMAN_LOWER:
+ case NumberingType::ARABIC:
+ case NumberingType::NUMBER_NONE:
+ break;
+
+ case NumberingType::CHARS_UPPER_LETTER_N:
+ case NumberingType::CHARS_LOWER_LETTER_N:
+ eSync = XML_TRUE;
+ break;
+
+ case NumberingType::CHAR_SPECIAL:
+ case NumberingType::PAGE_DESCRIPTOR:
+ case NumberingType::BITMAP:
+ DBG_ASSERT( eSync != XML_TOKEN_INVALID, "invalid number format" );
+ break;
+ }
+ if( eSync != XML_TOKEN_INVALID )
+ rBuffer.append( GetXMLToken(eSync) );
+}
+
+void SvXMLUnitConverter::convertPropertySet(uno::Sequence<beans::PropertyValue>& rProps,
+ const uno::Reference<beans::XPropertySet>& aProperties)
+{
+ uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = aProperties->getPropertySetInfo();
+ if (xPropertySetInfo.is())
+ {
+ uno::Sequence< beans::Property > aProps = xPropertySetInfo->getProperties();
+ const sal_Int32 nCount(aProps.getLength());
+ if (nCount)
+ {
+ rProps.realloc(nCount);
+ beans::PropertyValue* pProps = rProps.getArray();
+ for (sal_Int32 i = 0; i < nCount; i++, ++pProps)
+ {
+ pProps->Name = aProps[i].Name;
+ pProps->Value = aProperties->getPropertyValue(aProps[i].Name);
+ }
+ }
+ }
+}
+
+void SvXMLUnitConverter::convertPropertySet(uno::Reference<beans::XPropertySet>& rProperties,
+ const uno::Sequence<beans::PropertyValue>& aProps)
+{
+ sal_Int32 nCount(aProps.getLength());
+ if (nCount)
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = rProperties->getPropertySetInfo();
+ if (xPropertySetInfo.is())
+ {
+ for (sal_Int32 i = 0; i < nCount; i++)
+ {
+ if (xPropertySetInfo->hasPropertyByName(aProps[i].Name))
+ rProperties->setPropertyValue(aProps[i].Name, aProps[i].Value);
+ }
+ }
+ }
+}
+
+void SvXMLUnitConverter::clearUndefinedChars(OUString& rTarget, const OUString& rSource)
+{
+ sal_uInt32 nLength(rSource.getLength());
+ OUStringBuffer sBuffer(nLength);
+ for (sal_uInt32 i = 0; i < nLength; i++)
+ {
+ sal_Unicode cChar = rSource[i];
+ if (!(cChar < 0x0020) ||
+ (cChar == 0x0009) || // TAB
+ (cChar == 0x000A) || // LF
+ (cChar == 0x000D)) // legal character
+ sBuffer.append(cChar);
+ }
+ rTarget = sBuffer.makeStringAndClear();
+}
+
+OUString SvXMLUnitConverter::encodeStyleName(
+ const OUString& rName,
+ sal_Bool *pEncoded ) const
+{
+ if( pEncoded )
+ *pEncoded = sal_False;
+
+ sal_Int32 nLen = rName.getLength();
+ OUStringBuffer aBuffer( nLen );
+
+ for( sal_Int32 i = 0; i < nLen; i++ )
+ {
+ sal_Unicode c = rName[i];
+ sal_Bool bValidChar = sal_False;
+ if( c < 0x00ffU )
+ {
+ bValidChar =
+ (c >= 0x0041 && c <= 0x005a) ||
+ (c >= 0x0061 && c <= 0x007a) ||
+ (c >= 0x00c0 && c <= 0x00d6) ||
+ (c >= 0x00d8 && c <= 0x00f6) ||
+ (c >= 0x00f8 && c <= 0x00ff) ||
+ ( i > 0 && ( (c >= 0x0030 && c <= 0x0039) ||
+ c == 0x00b7 || c == '-' || c == '.') );
+ }
+ else
+ {
+ if( (c >= 0xf900U && c <= 0xfffeU) ||
+ (c >= 0x20ddU && c <= 0x20e0U))
+ {
+ bValidChar = sal_False;
+ }
+ else if( (c >= 0x02bbU && c <= 0x02c1U) || c == 0x0559 ||
+ c == 0x06e5 || c == 0x06e6 )
+ {
+ bValidChar = sal_True;
+ }
+ else if( c == 0x0387 )
+ {
+ bValidChar = i > 0;
+ }
+ else
+ {
+ if( !xCharClass.is() )
+ {
+ if( mxServiceFactory.is() )
+ {
+ try
+ {
+ const_cast < SvXMLUnitConverter * >(this)
+ ->xCharClass =
+ Reference < XCharacterClassification >(
+ mxServiceFactory->createInstance(
+ OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.i18n.CharacterClassification_Unicode")) ),
+ UNO_QUERY );
+
+ OSL_ENSURE( xCharClass.is(),
+ "can't instantiate character clossification component" );
+ }
+ catch( com::sun::star::uno::Exception& )
+ {
+ }
+ }
+ }
+ if( xCharClass.is() )
+ {
+ sal_Int16 nType = xCharClass->getType( rName, i );
+
+ switch( nType )
+ {
+ case UnicodeType::UPPERCASE_LETTER: // Lu
+ case UnicodeType::LOWERCASE_LETTER: // Ll
+ case UnicodeType::TITLECASE_LETTER: // Lt
+ case UnicodeType::OTHER_LETTER: // Lo
+ case UnicodeType::LETTER_NUMBER: // Nl
+ bValidChar = sal_True;
+ break;
+ case UnicodeType::NON_SPACING_MARK: // Ms
+ case UnicodeType::ENCLOSING_MARK: // Me
+ case UnicodeType::COMBINING_SPACING_MARK: //Mc
+ case UnicodeType::MODIFIER_LETTER: // Lm
+ case UnicodeType::DECIMAL_DIGIT_NUMBER: // Nd
+ bValidChar = i > 0;
+ break;
+ }
+ }
+ }
+ }
+ if( bValidChar )
+ {
+ aBuffer.append( c );
+ }
+ else
+ {
+ aBuffer.append( static_cast< sal_Unicode >( '_' ) );
+ if( c > 0x0fff )
+ aBuffer.append( static_cast< sal_Unicode >(
+ aHexTab[ (c >> 12) & 0x0f ] ) );
+ if( c > 0x00ff )
+ aBuffer.append( static_cast< sal_Unicode >(
+ aHexTab[ (c >> 8) & 0x0f ] ) );
+ if( c > 0x000f )
+ aBuffer.append( static_cast< sal_Unicode >(
+ aHexTab[ (c >> 4) & 0x0f ] ) );
+ aBuffer.append( static_cast< sal_Unicode >(
+ aHexTab[ c & 0x0f ] ) );
+ aBuffer.append( static_cast< sal_Unicode >( '_' ) );
+ if( pEncoded )
+ *pEncoded = sal_True;
+ }
+ }
+
+ // check for length
+ if( aBuffer.getLength() > ((1<<15)-1) )
+ {
+ aBuffer = rName;
+ if( pEncoded )
+ *pEncoded = sal_False;
+ }
+
+
+ return aBuffer.makeStringAndClear();
+}
+
+// static
+OUString SvXMLUnitConverter::convertTimeDuration( const Time& rTime, sal_Int32 nSecondsFraction )
+{
+ // return ISO time period string
+ OUStringBuffer sTmp;
+ sTmp.append( sal_Unicode('P') ); // "period"
+
+ sal_uInt16 nHours = rTime.GetHour();
+ sal_Bool bHasHours = ( nHours > 0 );
+ if ( nHours >= 24 )
+ {
+ // add days
+
+ sal_uInt16 nDays = nHours / 24;
+ sTmp.append( (sal_Int32) nDays );
+ sTmp.append( sal_Unicode('D') ); // "days"
+
+ nHours -= nDays * 24;
+ }
+ sTmp.append( sal_Unicode('T') ); // "time"
+
+ if ( bHasHours )
+ {
+ sTmp.append( (sal_Int32) nHours );
+ sTmp.append( sal_Unicode('H') ); // "hours"
+ }
+ sal_uInt16 nMinutes = rTime.GetMin();
+ if ( bHasHours || nMinutes > 0 )
+ {
+ sTmp.append( (sal_Int32) nMinutes );
+ sTmp.append( sal_Unicode('M') ); // "minutes"
+ }
+ sal_uInt16 nSeconds = rTime.GetSec();
+ sTmp.append( (sal_Int32) nSeconds );
+ if ( nSecondsFraction )
+ {
+ sTmp.append( sal_Unicode( '.' ) );
+ OUStringBuffer aFractional;
+ convertNumber( aFractional, nSecondsFraction );
+ sTmp.append( aFractional.getStr() );
+ }
+ sTmp.append( sal_Unicode('S') ); // "seconds"
+
+ return sTmp.makeStringAndClear();
+}
+
+// static
+bool SvXMLUnitConverter::convertTimeDuration( const OUString& rString, Time& rTime, sal_Int32* pSecondsFraction )
+{
+ OUString aTrimmed = rString.trim().toAsciiUpperCase();
+ const sal_Unicode* pStr = aTrimmed.getStr();
+
+ if ( *(pStr++) != sal_Unicode('P') ) // duration must start with "P"
+ return false;
+
+ bool bSuccess = true;
+ sal_Bool bDone = sal_False;
+ sal_Bool bTimePart = sal_False;
+ sal_Bool bFractional = sal_False;
+ sal_Int32 nDays = 0;
+ sal_Int32 nHours = 0;
+ sal_Int32 nMins = 0;
+ sal_Int32 nSecs = 0;
+ sal_Int32 nTemp = 0;
+ sal_Int32 nSecondsFraction = 0;
+
+ while ( bSuccess && !bDone )
+ {
+ sal_Unicode c = *(pStr++);
+ if ( !c ) // end
+ bDone = sal_True;
+ else if ( sal_Unicode('0') <= c && sal_Unicode('9') >= c )
+ {
+ if ( bFractional )
+ {
+ if ( nSecondsFraction >= SAL_MAX_INT32 / 10 )
+ bSuccess = false;
+ else
+ {
+ nSecondsFraction *= 10;
+ nSecondsFraction += (c - sal_Unicode('0'));
+ }
+ }
+ else
+ {
+ if ( nTemp >= SAL_MAX_INT32 / 10 )
+ bSuccess = false;
+ else
+ {
+ nTemp *= 10;
+ nTemp += (c - sal_Unicode('0'));
+ }
+ }
+ }
+ else if ( bTimePart )
+ {
+ if ( c == sal_Unicode('H') )
+ {
+ nHours = nTemp;
+ nTemp = 0;
+ }
+ else if ( c == sal_Unicode('M') )
+ {
+ nMins = nTemp;
+ nTemp = 0;
+ }
+ else if ( c == sal_Unicode('S') )
+ {
+ nSecs = nTemp;
+ nTemp = 0;
+ }
+ else if ( c == '.' )
+ {
+ bFractional = sal_True;
+ }
+ else
+ bSuccess = false; // invalid characted
+ }
+ else
+ {
+ if ( c == sal_Unicode('T') ) // "T" starts time part
+ bTimePart = sal_True;
+ else if ( c == sal_Unicode('D') )
+ {
+ nDays = nTemp;
+ nTemp = 0;
+ }
+ else if ( c == sal_Unicode('Y') || c == sal_Unicode('M') )
+ {
+ //! how many days is a year or month?
+
+ OSL_FAIL("years or months in duration: not implemented");
+ bSuccess = false;
+ }
+ else
+ bSuccess = false; // invalid characted
+ }
+ }
+
+ if ( bSuccess )
+ {
+ if ( nDays )
+ nHours += nDays * 24; // add the days to the hours part
+ rTime = Time( nHours, nMins, nSecs );
+ if ( pSecondsFraction )
+ *pSecondsFraction = nSecondsFraction % 1000;
+ }
+ return bSuccess;
+}
+
+sal_Bool SvXMLUnitConverter::convertAny( OUStringBuffer& sValue,
+ OUStringBuffer& sType ,
+ const com::sun::star::uno::Any& aValue)
+{
+ sal_Bool bConverted = sal_False;
+
+ sValue.setLength(0);
+ sType.setLength (0);
+
+ switch(aValue.getValueTypeClass())
+ {
+ case com::sun::star::uno::TypeClass_BYTE :
+ case com::sun::star::uno::TypeClass_SHORT :
+ case com::sun::star::uno::TypeClass_UNSIGNED_SHORT :
+ case com::sun::star::uno::TypeClass_LONG :
+ case com::sun::star::uno::TypeClass_UNSIGNED_LONG :
+ {
+ sal_Int32 nTempValue = 0;
+ if (aValue >>= nTempValue)
+ {
+ sType.appendAscii("integer");
+ bConverted = sal_True;
+ SvXMLUnitConverter::convertNumber(sValue, nTempValue);
+ }
+ }
+ break;
+
+ case com::sun::star::uno::TypeClass_BOOLEAN :
+ {
+ sal_Bool bTempValue = sal_False;
+ if (aValue >>= bTempValue)
+ {
+ sType.appendAscii("boolean");
+ bConverted = sal_True;
+ SvXMLUnitConverter::convertBool(sValue, bTempValue);
+ }
+ }
+ break;
+
+ case com::sun::star::uno::TypeClass_FLOAT :
+ case com::sun::star::uno::TypeClass_DOUBLE :
+ {
+ double fTempValue = 0.0;
+ if (aValue >>= fTempValue)
+ {
+ sType.appendAscii("float");
+ bConverted = sal_True;
+ SvXMLUnitConverter::convertDouble(sValue, fTempValue);
+ }
+ }
+ break;
+
+ case com::sun::star::uno::TypeClass_STRING :
+ {
+ OUString sTempValue;
+ if (aValue >>= sTempValue)
+ {
+ sType.appendAscii("string");
+ bConverted = sal_True;
+ sValue.append(sTempValue);
+ }
+ }
+ break;
+
+ case com::sun::star::uno::TypeClass_STRUCT :
+ {
+ com::sun::star::util::Date aDate ;
+ com::sun::star::util::Time aTime ;
+ com::sun::star::util::DateTime aDateTime;
+
+ if (aValue >>= aDate)
+ {
+ sType.appendAscii("date");
+ bConverted = sal_True;
+ com::sun::star::util::DateTime aTempValue;
+ aTempValue.Day = aDate.Day;
+ aTempValue.Month = aDate.Month;
+ aTempValue.Year = aDate.Year;
+ aTempValue.HundredthSeconds = 0;
+ aTempValue.Seconds = 0;
+ aTempValue.Minutes = 0;
+ aTempValue.Hours = 0;
+ SvXMLUnitConverter::convertDateTime(sValue, aTempValue);
+ }
+ else
+ if (aValue >>= aTime)
+ {
+ sType.appendAscii("time");
+ bConverted = sal_True;
+ com::sun::star::util::DateTime aTempValue;
+ aTempValue.Day = 0;
+ aTempValue.Month = 0;
+ aTempValue.Year = 0;
+ aTempValue.HundredthSeconds = aTime.HundredthSeconds;
+ aTempValue.Seconds = aTime.Seconds;
+ aTempValue.Minutes = aTime.Minutes;
+ aTempValue.Hours = aTime.Hours;
+ SvXMLUnitConverter::convertTime(sValue, aTempValue);
+ }
+ else
+ if (aValue >>= aDateTime)
+ {
+ sType.appendAscii("date");
+ bConverted = sal_True;
+ SvXMLUnitConverter::convertDateTime(sValue, aDateTime);
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ return bConverted;
+}
+
+sal_Bool SvXMLUnitConverter::convertAny( com::sun::star::uno::Any& aValue,
+ const OUString& sType ,
+ const OUString& sValue)
+{
+ sal_Bool bConverted = sal_False;
+
+ if (sType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("boolean")))
+ {
+ bool bTempValue = false;
+ SvXMLUnitConverter::convertBool(bTempValue, sValue);
+ aValue <<= bTempValue;
+ bConverted = sal_True;
+ }
+ else
+ if (sType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("integer")))
+ {
+ sal_Int32 nTempValue = 0;
+ SvXMLUnitConverter::convertNumber(nTempValue, sValue);
+ aValue <<= nTempValue;
+ bConverted = sal_True;
+ }
+ else
+ if (sType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("float")))
+ {
+ double fTempValue = 0.0;
+ SvXMLUnitConverter::convertDouble(fTempValue, sValue);
+ aValue <<= fTempValue;
+ bConverted = sal_True;
+ }
+ else
+ if (sType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("string")))
+ {
+ aValue <<= sValue;
+ bConverted = sal_True;
+ }
+ else
+ if (sType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("date")))
+ {
+ com::sun::star::util::DateTime aTempValue;
+ SvXMLUnitConverter::convertDateTime(aTempValue, sValue);
+ aValue <<= aTempValue;
+ bConverted = sal_True;
+ }
+ else
+ if (sType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("time")))
+ {
+ com::sun::star::util::DateTime aTempValue;
+ com::sun::star::util::Time aConvValue;
+ SvXMLUnitConverter::convertTime(aTempValue, sValue);
+ aConvValue.HundredthSeconds = aTempValue.HundredthSeconds;
+ aConvValue.Seconds = aTempValue.Seconds;
+ aConvValue.Minutes = aTempValue.Minutes;
+ aConvValue.Hours = aTempValue.Hours;
+ aValue <<= aConvValue;
+ bConverted = sal_True;
+ }
+
+ return bConverted;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/EnhancedCustomShapeToken.cxx b/xmloff/source/draw/EnhancedCustomShapeToken.cxx
new file mode 100644
index 000000000000..169872ba6c86
--- /dev/null
+++ b/xmloff/source/draw/EnhancedCustomShapeToken.cxx
@@ -0,0 +1,231 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "EnhancedCustomShapeToken.hxx"
+#include <osl/mutex.hxx>
+#include <boost/unordered_map.hpp>
+#include <string.h>
+
+namespace xmloff { namespace EnhancedCustomShapeToken {
+
+struct THash
+{
+ size_t operator()( const char* s ) const
+ {
+ return rtl_str_hashCode(s);
+ }
+};
+struct TCheck
+{
+ bool operator()( const char* s1, const char* s2 ) const
+ {
+ return strcmp( s1, s2 ) == 0;
+ }
+};
+typedef boost::unordered_map< const char*, EnhancedCustomShapeTokenEnum, THash, TCheck> TypeNameHashMap;
+static TypeNameHashMap* pHashMap = NULL;
+static ::osl::Mutex& getHashMapMutex()
+{
+ static osl::Mutex s_aHashMapProtection;
+ return s_aHashMapProtection;
+}
+
+struct TokenTable
+{
+ const char* pS;
+ EnhancedCustomShapeTokenEnum pE;
+};
+
+static const TokenTable pTokenTableArray[] =
+{
+ { "type", EAS_type },
+ { "name", EAS_name },
+ { "mirror-horizontal", EAS_mirror_horizontal },
+ { "mirror-vertical", EAS_mirror_vertical },
+ { "viewBox", EAS_viewBox },
+ { "text-rotate-angle", EAS_text_rotate_angle },
+ { "extrusion-allowed", EAS_extrusion_allowed },
+ { "extrusion-text-path-allowed", EAS_text_path_allowed },
+ { "extrusion-concentric-gradient-fill", EAS_concentric_gradient_fill_allowed },
+ { "extrusion", EAS_extrusion },
+ { "extrusion-brightness", EAS_extrusion_brightness },
+ { "extrusion-depth", EAS_extrusion_depth },
+ { "extrusion-diffusion", EAS_extrusion_diffusion },
+ { "extrusion-number-of-line-segments", EAS_extrusion_number_of_line_segments },
+ { "extrusion-light-face", EAS_extrusion_light_face },
+ { "extrusion-first-light-harsh", EAS_extrusion_first_light_harsh },
+ { "extrusion-second-light-harsh", EAS_extrusion_second_light_harsh },
+ { "extrusion-first-light-livel", EAS_extrusion_first_light_level },
+ { "extrusion-second-light-level", EAS_extrusion_second_light_level },
+ { "extrusion-first-light-direction", EAS_extrusion_first_light_direction },
+ { "extrusion-second-light-direction", EAS_extrusion_second_light_direction },
+ { "extrusion-metal", EAS_extrusion_metal },
+ { "shade-mode", EAS_shade_mode },
+ { "extrusion-rotation-angle", EAS_extrusion_rotation_angle },
+ { "extrusion-rotation-center", EAS_extrusion_rotation_center },
+ { "extrusion-shininess", EAS_extrusion_shininess },
+ { "extrusion-skew", EAS_extrusion_skew },
+ { "extrusion-specularity", EAS_extrusion_specularity },
+ { "projection", EAS_projection },
+ { "extrusion-viewpoint", EAS_extrusion_viewpoint },
+ { "extrusion-origin", EAS_extrusion_origin },
+ { "extrusion-color", EAS_extrusion_color },
+ { "enhanced-path", EAS_enhanced_path },
+ { "path-stretchpoint-x", EAS_path_stretchpoint_x },
+ { "path-stretchpoint-y", EAS_path_stretchpoint_y },
+ { "text-areas", EAS_text_areas },
+ { "glue-points", EAS_glue_points },
+ { "glue-point-type", EAS_glue_point_type },
+ { "glue-point-leaving-directions", EAS_glue_point_leaving_directions },
+ { "text-path", EAS_text_path },
+ { "text-path-mode", EAS_text_path_mode },
+ { "text-path-scale", EAS_text_path_scale },
+ { "text-path-same-letter-heights", EAS_text_path_same_letter_heights },
+ { "modifiers", EAS_modifiers },
+ { "equation", EAS_equation },
+ { "formula", EAS_formula },
+ { "handle", EAS_handle },
+ { "handle-mirror-horizontal", EAS_handle_mirror_horizontal },
+ { "handle-mirror-vertical", EAS_handle_mirror_vertical },
+ { "handle-switched", EAS_handle_switched },
+ { "handle-position", EAS_handle_position },
+ { "handle-range-x-minimum", EAS_handle_range_x_minimum },
+ { "handle-range-x-maximum", EAS_handle_range_x_maximum },
+ { "handle-range-y-minimum", EAS_handle_range_y_minimum },
+ { "handle-range-y-maximum", EAS_handle_range_y_maximum },
+ { "handle-polar", EAS_handle_polar },
+ { "handle-radius-range-minimum", EAS_handle_radius_range_minimum },
+ { "handle-radius-range-maximum", EAS_handle_radius_range_maximum },
+
+ { "CustomShapeEngine", EAS_CustomShapeEngine },
+ { "CustomShapeData", EAS_CustomShapeData },
+ { "Type", EAS_Type },
+ { "MirroredX", EAS_MirroredX },
+ { "MirroredY", EAS_MirroredY },
+ { "ViewBox", EAS_ViewBox },
+ { "TextRotateAngle", EAS_TextRotateAngle },
+ { "ExtrusionAllowed", EAS_ExtrusionAllowed },
+ { "TextPathAllowed", EAS_TextPathAllowed },
+ { "ConcentricGradientFillAllowed", EAS_ConcentricGradientFillAllowed },
+ { "Extrusion", EAS_Extrusion },
+ { "Equations", EAS_Equations },
+ { "Equation", EAS_Equation },
+ { "Path", EAS_Path },
+ { "TextPath", EAS_TextPath },
+ { "Handles", EAS_Handles },
+ { "Handle", EAS_Handle },
+ { "Brightness", EAS_Brightness },
+ { "Depth", EAS_Depth },
+ { "Diffusion", EAS_Diffusion },
+ { "NumberOfLineSegments", EAS_NumberOfLineSegments },
+ { "LightFace", EAS_LightFace },
+ { "FirstLightHarsh", EAS_FirstLightHarsh },
+ { "SecondLightHarsh", EAS_SecondLightHarsh },
+ { "FirstLightLevel", EAS_FirstLightLevel },
+ { "SecondLightLevel", EAS_SecondLightLevel },
+ { "FirstLightDirection", EAS_FirstLightDirection },
+ { "SecondLightDirection", EAS_SecondLightDirection },
+ { "Metal", EAS_Metal },
+ { "ShadeMode", EAS_ShadeMode },
+ { "RotateAngle", EAS_RotateAngle },
+ { "RotationCenter", EAS_RotationCenter },
+ { "Shininess", EAS_Shininess },
+ { "Skew", EAS_Skew },
+ { "Specularity", EAS_Specularity },
+ { "ProjectionMode", EAS_ProjectionMode },
+ { "ViewPoint", EAS_ViewPoint },
+ { "Origin", EAS_Origin },
+ { "Color", EAS_Color },
+ { "Switched", EAS_Switched },
+ { "Polar", EAS_Polar },
+ { "RangeXMinimum", EAS_RangeXMinimum },
+ { "RangeXMaximum", EAS_RangeXMaximum },
+ { "RangeYMinimum", EAS_RangeYMinimum },
+ { "RangeYMaximum", EAS_RangeYMaximum },
+ { "RadiusRangeMinimum", EAS_RadiusRangeMinimum },
+ { "RadiusRangeMaximum", EAS_RadiusRangeMaximum },
+ { "Coordinates", EAS_Coordinates },
+ { "Segments", EAS_Segments },
+ { "StretchX", EAS_StretchX },
+ { "StretchY", EAS_StretchY },
+ { "TextFrames", EAS_TextFrames },
+ { "GluePoints", EAS_GluePoints },
+ { "GluePointLeavingDirections", EAS_GluePointLeavingDirections },
+ { "GluePointType", EAS_GluePointType },
+ { "TextPathMode", EAS_TextPathMode },
+ { "ScaleX", EAS_ScaleX },
+ { "SameLetterHeights", EAS_SameLetterHeights },
+ { "Position", EAS_Position },
+ { "AdjustmentValues", EAS_AdjustmentValues },
+
+ { "Last", EAS_Last },
+ { "NotFound", EAS_NotFound }
+};
+
+EnhancedCustomShapeTokenEnum EASGet( const rtl::OUString& rShapeType )
+{
+ if ( !pHashMap )
+ { // init hash map
+ ::osl::MutexGuard aGuard( getHashMapMutex() );
+ if ( !pHashMap )
+ {
+ TypeNameHashMap* pH = new TypeNameHashMap;
+ const TokenTable* pPtr = pTokenTableArray;
+ const TokenTable* pEnd = pPtr + ( sizeof( pTokenTableArray ) / sizeof( TokenTable ) );
+ for ( ; pPtr < pEnd; pPtr++ )
+ (*pH)[ pPtr->pS ] = pPtr->pE;
+ pHashMap = pH;
+ }
+ }
+ EnhancedCustomShapeTokenEnum eRetValue = EAS_NotFound;
+ int i, nLen = rShapeType.getLength();
+ char* pBuf = new char[ nLen + 1 ];
+ for ( i = 0; i < nLen; i++ )
+ pBuf[ i ] = (char)rShapeType[ i ];
+ pBuf[ i ] = 0;
+ TypeNameHashMap::iterator aHashIter( pHashMap->find( pBuf ) );
+ delete[] pBuf;
+ if ( aHashIter != pHashMap->end() )
+ eRetValue = (*aHashIter).second;
+ return eRetValue;
+}
+
+rtl::OUString EASGet( const EnhancedCustomShapeTokenEnum eToken )
+{
+ sal_uInt32 i = eToken >= EAS_Last
+ ? (sal_uInt32)EAS_NotFound
+ : (sal_uInt32)eToken;
+ return rtl::OUString::createFromAscii( pTokenTableArray[ i ].pS );
+}
+
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx b/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx
new file mode 100644
index 000000000000..11f46ef4c230
--- /dev/null
+++ b/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx
@@ -0,0 +1,129 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <tools/debug.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+
+#include <xmloff/families.hxx>
+#include "XMLShapePropertySetContext.hxx"
+#include <xmloff/XMLGraphicsDefaultStyle.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::xml::sax;
+
+using ::xmloff::token::IsXMLToken;
+using ::xmloff::token::XML_TEXT_PROPERTIES;
+using ::xmloff::token::XML_GRAPHIC_PROPERTIES;
+using ::xmloff::token::XML_PARAGRAPH_PROPERTIES;
+
+// ---------------------------------------------------------------------
+
+TYPEINIT1( XMLGraphicsDefaultStyle, XMLPropStyleContext );
+
+XMLGraphicsDefaultStyle::XMLGraphicsDefaultStyle( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, const Reference< XAttributeList >& xAttrList, SvXMLStylesContext& rStyles )
+: XMLPropStyleContext( rImport, nPrfx, rLName, xAttrList, rStyles, XML_STYLE_FAMILY_SD_GRAPHICS_ID, sal_True )
+{
+}
+
+XMLGraphicsDefaultStyle::~XMLGraphicsDefaultStyle()
+{
+}
+
+SvXMLImportContext *XMLGraphicsDefaultStyle::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< XAttributeList > & xAttrList )
+{
+ SvXMLImportContext *pContext = 0;
+
+ if( XML_NAMESPACE_STYLE == nPrefix )
+ {
+ sal_uInt32 nFamily = 0;
+ if( IsXMLToken( rLocalName, XML_TEXT_PROPERTIES ) )
+ nFamily = XML_TYPE_PROP_TEXT;
+ else if( IsXMLToken( rLocalName, XML_PARAGRAPH_PROPERTIES ) )
+ nFamily = XML_TYPE_PROP_PARAGRAPH;
+ else if( IsXMLToken( rLocalName, XML_GRAPHIC_PROPERTIES ) )
+ nFamily = XML_TYPE_PROP_GRAPHIC;
+ if( nFamily )
+ {
+ UniReference < SvXMLImportPropertyMapper > xImpPrMap = GetStyles()->GetImportPropertyMapper( GetFamily() );
+ if( xImpPrMap.is() )
+ pContext = new XMLShapePropertySetContext( GetImport(), nPrefix, rLocalName, xAttrList, nFamily, GetProperties(), xImpPrMap );
+ }
+ }
+
+ if( !pContext )
+ pContext = XMLPropStyleContext::CreateChildContext( nPrefix, rLocalName, xAttrList );
+
+ return pContext;
+}
+
+// This method is called for every default style
+void XMLGraphicsDefaultStyle::SetDefaults()
+{
+ Reference< XMultiServiceFactory > xFact( GetImport().GetModel(), UNO_QUERY );
+ if( !xFact.is() )
+ return;
+
+ Reference< XPropertySet > xDefaults( xFact->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.Defaults") ) ), UNO_QUERY );
+ if( !xDefaults.is() )
+ return;
+ // SJ: #i114750#
+ sal_Bool bWordWrapDefault = sal_True; // initializing with correct odf fo:wrap-option default
+ sal_Int32 nUPD( 0 );
+ sal_Int32 nBuild( 0 );
+ const bool bBuildIdFound = GetImport().getBuildIds( nUPD, nBuild );
+ if ( bBuildIdFound && (
+ ((nUPD >= 600) && (nUPD < 700))
+ ||
+ ((nUPD == 300) && (nBuild <= 9535))
+ ||
+ ((nUPD > 300) && (nUPD <= 330))
+ ) )
+ bWordWrapDefault = sal_False;
+
+ const OUString sTextWordWrap( RTL_CONSTASCII_USTRINGPARAM( "TextWordWrap" ) );
+ Reference< XPropertySetInfo > xInfo( xDefaults->getPropertySetInfo() );
+ if ( xInfo->hasPropertyByName( sTextWordWrap ) )
+ xDefaults->setPropertyValue( sTextWordWrap, Any( bWordWrapDefault ) );
+
+ FillPropertySet( xDefaults );
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/XMLImageMapContext.cxx b/xmloff/source/draw/XMLImageMapContext.cxx
new file mode 100644
index 000000000000..92d1b9a8e408
--- /dev/null
+++ b/xmloff/source/draw/XMLImageMapContext.cxx
@@ -0,0 +1,721 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLImageMapContext.hxx"
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/drawing/PointSequenceSequence.hpp>
+
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmltkmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "xexptran.hxx"
+#include "xmloff/xmlerror.hxx"
+#include <xmloff/XMLEventsImportContext.hxx>
+#include "XMLStringBufferImportContext.hxx"
+#include <tools/debug.hxx>
+
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::beans::XPropertySetInfo;
+using ::com::sun::star::container::XIndexContainer;
+using ::com::sun::star::lang::XMultiServiceFactory;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::xml::sax::XAttributeList;
+using ::com::sun::star::uno::XInterface;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::drawing::PointSequenceSequence;
+using ::com::sun::star::document::XEventsSupplier;
+
+
+enum XMLImageMapToken
+{
+ XML_TOK_IMAP_URL,
+ XML_TOK_IMAP_X,
+ XML_TOK_IMAP_Y,
+ XML_TOK_IMAP_CENTER_X,
+ XML_TOK_IMAP_CENTER_Y,
+ XML_TOK_IMAP_WIDTH,
+ XML_TOK_IMAP_HEIGTH,
+ XML_TOK_IMAP_POINTS,
+ XML_TOK_IMAP_VIEWBOX,
+ XML_TOK_IMAP_NOHREF,
+ XML_TOK_IMAP_NAME,
+ XML_TOK_IMAP_RADIUS,
+ XML_TOK_IMAP_TARGET
+};
+
+static SvXMLTokenMapEntry aImageMapObjectTokenMap[] =
+{
+ { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_IMAP_URL },
+ { XML_NAMESPACE_OFFICE, XML_NAME, XML_TOK_IMAP_NAME },
+ { XML_NAMESPACE_DRAW, XML_NOHREF, XML_TOK_IMAP_NOHREF },
+ { XML_NAMESPACE_SVG, XML_X, XML_TOK_IMAP_X },
+ { XML_NAMESPACE_SVG, XML_Y, XML_TOK_IMAP_Y },
+ { XML_NAMESPACE_SVG, XML_CX, XML_TOK_IMAP_CENTER_X },
+ { XML_NAMESPACE_SVG, XML_CY, XML_TOK_IMAP_CENTER_Y },
+ { XML_NAMESPACE_SVG, XML_WIDTH, XML_TOK_IMAP_WIDTH },
+ { XML_NAMESPACE_SVG, XML_HEIGHT, XML_TOK_IMAP_HEIGTH },
+ { XML_NAMESPACE_SVG, XML_R, XML_TOK_IMAP_RADIUS },
+ { XML_NAMESPACE_SVG, XML_VIEWBOX, XML_TOK_IMAP_VIEWBOX },
+ { XML_NAMESPACE_DRAW, XML_POINTS, XML_TOK_IMAP_POINTS },
+ { XML_NAMESPACE_OFFICE, XML_TARGET_FRAME_NAME, XML_TOK_IMAP_TARGET },
+ XML_TOKEN_MAP_END
+};
+
+
+
+class XMLImageMapObjectContext : public SvXMLImportContext
+{
+
+protected:
+
+ const ::rtl::OUString sBoundary;
+ const ::rtl::OUString sCenter;
+ const ::rtl::OUString sTitle;
+ const ::rtl::OUString sDescription;
+ const ::rtl::OUString sImageMap;
+ const ::rtl::OUString sIsActive;
+ const ::rtl::OUString sName;
+ const ::rtl::OUString sPolygon;
+ const ::rtl::OUString sRadius;
+ const ::rtl::OUString sTarget;
+ const ::rtl::OUString sURL;
+
+ ::rtl::OUString sServiceName;
+
+ Reference<XIndexContainer> xImageMap; /// the image map
+ Reference<XPropertySet> xMapEntry; /// one map-entry (one area)
+
+ ::rtl::OUString sUrl;
+ ::rtl::OUString sTargt;
+ ::rtl::OUStringBuffer sDescriptionBuffer;
+ ::rtl::OUStringBuffer sTitleBuffer;
+ ::rtl::OUString sNam;
+ sal_Bool bIsActive;
+
+ sal_Bool bValid;
+
+public:
+ TYPEINFO();
+
+ XMLImageMapObjectContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XIndexContainer> xMap,
+ const sal_Char* pServiceName);
+
+ void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ void EndElement();
+
+ SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+
+protected:
+
+ virtual void ProcessAttribute(
+ enum XMLImageMapToken eToken,
+ const ::rtl::OUString& rValue);
+
+ virtual void Prepare(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropertySet);
+};
+
+
+TYPEINIT1( XMLImageMapObjectContext, SvXMLImportContext );
+
+XMLImageMapObjectContext::XMLImageMapObjectContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ Reference<XIndexContainer> xMap,
+ const sal_Char* pServiceName) :
+ SvXMLImportContext(rImport, nPrefix, rLocalName),
+ sBoundary(RTL_CONSTASCII_USTRINGPARAM("Boundary")),
+ sCenter(RTL_CONSTASCII_USTRINGPARAM("Center")),
+ sTitle(RTL_CONSTASCII_USTRINGPARAM("Title")),
+ sDescription(RTL_CONSTASCII_USTRINGPARAM("Description")),
+ sImageMap(RTL_CONSTASCII_USTRINGPARAM("ImageMap")),
+ sIsActive(RTL_CONSTASCII_USTRINGPARAM("IsActive")),
+ sName(RTL_CONSTASCII_USTRINGPARAM("Name")),
+ sPolygon(RTL_CONSTASCII_USTRINGPARAM("Polygon")),
+ sRadius(RTL_CONSTASCII_USTRINGPARAM("Radius")),
+ sTarget(RTL_CONSTASCII_USTRINGPARAM("Target")),
+ sURL(RTL_CONSTASCII_USTRINGPARAM("URL")),
+ xImageMap(xMap),
+ bIsActive(sal_True),
+ bValid(sal_False)
+{
+ DBG_ASSERT(NULL != pServiceName,
+ "Please supply the image map object service name");
+
+ Reference<XMultiServiceFactory> xFactory(GetImport().GetModel(),UNO_QUERY);
+ if( xFactory.is() )
+ {
+ Reference<XInterface> xIfc = xFactory->createInstance(
+ OUString::createFromAscii(pServiceName));
+ DBG_ASSERT(xIfc.is(), "can't create image map object!");
+ if( xIfc.is() )
+ {
+ Reference<XPropertySet> xPropertySet( xIfc, UNO_QUERY );
+
+ xMapEntry = xPropertySet;
+ }
+ // else: can't create service -> ignore
+ }
+ // else: can't even get factory -> ignore
+}
+
+void XMLImageMapObjectContext::StartElement(
+ const Reference<XAttributeList >& xAttrList )
+{
+ SvXMLTokenMap aMap(aImageMapObjectTokenMap);
+
+ sal_Int16 nLength = xAttrList->getLength();
+ for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++)
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
+ &sLocalName );
+ OUString sValue = xAttrList->getValueByIndex(nAttr);
+
+ ProcessAttribute(
+ (enum XMLImageMapToken)aMap.Get(nPrefix, sLocalName), sValue);
+ }
+}
+
+void XMLImageMapObjectContext::EndElement()
+{
+ // only create and insert image map object if validity flag is set
+ // (and we actually have an image map)
+ if ( bValid && xImageMap.is() && xMapEntry.is() )
+ {
+ // set values
+ Prepare( xMapEntry );
+
+ // insert into image map
+ Any aAny;
+ aAny <<= xMapEntry;
+ xImageMap->insertByIndex( xImageMap->getCount(), aAny );
+ }
+ // else: not valid -> don't create and insert
+}
+
+SvXMLImportContext* XMLImageMapObjectContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList )
+{
+ if ( (XML_NAMESPACE_OFFICE == nPrefix) &&
+ IsXMLToken(rLocalName, XML_EVENT_LISTENERS) )
+ {
+ Reference<XEventsSupplier> xEvents( xMapEntry, UNO_QUERY );
+ return new XMLEventsImportContext(
+ GetImport(), nPrefix, rLocalName, xEvents);
+ }
+ else if ( (XML_NAMESPACE_SVG == nPrefix) &&
+ IsXMLToken(rLocalName, XML_TITLE) )
+ {
+ return new XMLStringBufferImportContext(
+ GetImport(), nPrefix, rLocalName, sTitleBuffer);
+ }
+ else if ( (XML_NAMESPACE_SVG == nPrefix) &&
+ IsXMLToken(rLocalName, XML_DESC) )
+ {
+ return new XMLStringBufferImportContext(
+ GetImport(), nPrefix, rLocalName, sDescriptionBuffer);
+ }
+ else
+ return SvXMLImportContext::CreateChildContext(nPrefix, rLocalName,
+ xAttrList);
+
+}
+
+void XMLImageMapObjectContext::ProcessAttribute(
+ enum XMLImageMapToken eToken,
+ const OUString& rValue)
+{
+ switch (eToken)
+ {
+ case XML_TOK_IMAP_URL:
+ sUrl = GetImport().GetAbsoluteReference(rValue);
+ break;
+
+ case XML_TOK_IMAP_TARGET:
+ sTargt = rValue;
+ break;
+
+ case XML_TOK_IMAP_NOHREF:
+ bIsActive = ! IsXMLToken(rValue, XML_NOHREF);
+ break;
+
+ case XML_TOK_IMAP_NAME:
+ sNam = rValue;
+ break;
+ default:
+ // do nothing
+ break;
+ }
+}
+
+void XMLImageMapObjectContext::Prepare(
+ Reference<XPropertySet> & rPropertySet)
+{
+ rPropertySet->setPropertyValue( sURL, Any( sUrl ) );
+ rPropertySet->setPropertyValue( sTitle, Any( sTitleBuffer.makeStringAndClear() ) );
+ rPropertySet->setPropertyValue( sDescription, Any( sDescriptionBuffer.makeStringAndClear() ) );
+ rPropertySet->setPropertyValue( sTarget, Any( sTargt ) );
+ rPropertySet->setPropertyValue( sIsActive, Any( bIsActive ) );
+ rPropertySet->setPropertyValue( sName, Any( sNam ) );
+}
+
+
+
+class XMLImageMapRectangleContext : public XMLImageMapObjectContext
+{
+ awt::Rectangle aRectangle;
+
+ sal_Bool bXOK;
+ sal_Bool bYOK;
+ sal_Bool bWidthOK;
+ sal_Bool bHeightOK;
+
+public:
+ TYPEINFO();
+
+ XMLImageMapRectangleContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XIndexContainer> xMap);
+
+ virtual ~XMLImageMapRectangleContext();
+
+protected:
+ virtual void ProcessAttribute(
+ enum XMLImageMapToken eToken,
+ const ::rtl::OUString& rValue);
+
+ virtual void Prepare(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropertySet);
+};
+
+
+
+TYPEINIT1(XMLImageMapRectangleContext, XMLImageMapObjectContext);
+
+XMLImageMapRectangleContext::XMLImageMapRectangleContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ Reference<XIndexContainer> xMap) :
+ XMLImageMapObjectContext(rImport, nPrefix, rLocalName, xMap,
+ "com.sun.star.image.ImageMapRectangleObject"),
+ bXOK(sal_False),
+ bYOK(sal_False),
+ bWidthOK(sal_False),
+ bHeightOK(sal_False)
+{
+}
+
+XMLImageMapRectangleContext::~XMLImageMapRectangleContext()
+{
+}
+
+void XMLImageMapRectangleContext::ProcessAttribute(
+ enum XMLImageMapToken eToken,
+ const OUString& rValue)
+{
+ sal_Int32 nTmp;
+ switch (eToken)
+ {
+ case XML_TOK_IMAP_X:
+ if (GetImport().GetMM100UnitConverter().convertMeasure(nTmp,
+ rValue))
+ {
+ aRectangle.X = nTmp;
+ bXOK = sal_True;
+ }
+ break;
+ case XML_TOK_IMAP_Y:
+ if (GetImport().GetMM100UnitConverter().convertMeasure(nTmp,
+ rValue))
+ {
+ aRectangle.Y = nTmp;
+ bYOK = sal_True;
+ }
+ break;
+ case XML_TOK_IMAP_WIDTH:
+ if (GetImport().GetMM100UnitConverter().convertMeasure(nTmp,
+ rValue))
+ {
+ aRectangle.Width = nTmp;
+ bWidthOK = sal_True;
+ }
+ break;
+ case XML_TOK_IMAP_HEIGTH:
+ if (GetImport().GetMM100UnitConverter().convertMeasure(nTmp,
+ rValue))
+ {
+ aRectangle.Height = nTmp;
+ bHeightOK = sal_True;
+ }
+ break;
+ default:
+ XMLImageMapObjectContext::ProcessAttribute(eToken, rValue);
+ }
+
+ bValid = bHeightOK && bXOK && bYOK && bWidthOK;
+}
+
+void XMLImageMapRectangleContext::Prepare(
+ Reference<XPropertySet> & rPropertySet)
+{
+ Any aAny;
+ aAny <<= aRectangle;
+ rPropertySet->setPropertyValue( sBoundary, aAny );
+
+ // common properties handled by super class
+ XMLImageMapObjectContext::Prepare(rPropertySet);
+}
+
+
+class XMLImageMapPolygonContext : public XMLImageMapObjectContext
+{
+ ::rtl::OUString sViewBoxString;
+ ::rtl::OUString sPointsString;
+
+ sal_Bool bViewBoxOK;
+ sal_Bool bPointsOK;
+
+public:
+ TYPEINFO();
+
+ XMLImageMapPolygonContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XIndexContainer> xMap);
+
+ virtual ~XMLImageMapPolygonContext();
+
+protected:
+ virtual void ProcessAttribute(
+ enum XMLImageMapToken eToken,
+ const ::rtl::OUString& rValue);
+
+ virtual void Prepare(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropertySet);
+};
+
+
+
+TYPEINIT1(XMLImageMapPolygonContext, XMLImageMapObjectContext);
+
+XMLImageMapPolygonContext::XMLImageMapPolygonContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ Reference<XIndexContainer> xMap) :
+ XMLImageMapObjectContext(rImport, nPrefix, rLocalName, xMap,
+ "com.sun.star.image.ImageMapPolygonObject"),
+ bViewBoxOK(sal_False),
+ bPointsOK(sal_False)
+{
+}
+
+XMLImageMapPolygonContext::~XMLImageMapPolygonContext()
+{
+}
+
+void XMLImageMapPolygonContext::ProcessAttribute(
+ enum XMLImageMapToken eToken,
+ const OUString& rValue)
+{
+ switch (eToken)
+ {
+ case XML_TOK_IMAP_POINTS:
+ sPointsString = rValue;
+ bPointsOK = sal_True;
+ break;
+ case XML_TOK_IMAP_VIEWBOX:
+ sViewBoxString = rValue;
+ bViewBoxOK = sal_True;
+ break;
+ default:
+ XMLImageMapObjectContext::ProcessAttribute(eToken, rValue);
+ break;
+ }
+
+ bValid = bViewBoxOK && bPointsOK;
+}
+
+void XMLImageMapPolygonContext::Prepare(
+ Reference<XPropertySet> & rPropertySet)
+{
+ // process view box
+ SdXMLImExViewBox aViewBox(sViewBoxString,
+ GetImport().GetMM100UnitConverter());
+
+ // get polygon sequence
+ awt::Point aPoint(aViewBox.GetX(), aViewBox.GetY());
+ awt::Size aSize(aViewBox.GetWidth(), aViewBox.GetHeight());
+ SdXMLImExPointsElement aPoints( sPointsString, aViewBox, aPoint, aSize,
+ GetImport().GetMM100UnitConverter() );
+ PointSequenceSequence aPointSeqSeq = aPoints.GetPointSequenceSequence();
+
+ // only use first element of sequence-sequence
+ if (aPointSeqSeq.getLength() > 0)
+ {
+ Any aAny;
+ aAny <<= aPointSeqSeq[0];
+ rPropertySet->setPropertyValue(sPolygon, aAny);
+ }
+
+ // parent properties
+ XMLImageMapObjectContext::Prepare(rPropertySet);
+}
+
+
+
+class XMLImageMapCircleContext : public XMLImageMapObjectContext
+{
+ awt::Point aCenter;
+ sal_Int32 nRadius;
+
+ sal_Bool bXOK;
+ sal_Bool bYOK;
+ sal_Bool bRadiusOK;
+
+public:
+ TYPEINFO();
+
+ XMLImageMapCircleContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XIndexContainer> xMap);
+
+ virtual ~XMLImageMapCircleContext();
+
+protected:
+ virtual void ProcessAttribute(
+ enum XMLImageMapToken eToken,
+ const ::rtl::OUString& rValue);
+
+ virtual void Prepare(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropertySet);
+};
+
+TYPEINIT1(XMLImageMapCircleContext, XMLImageMapObjectContext);
+
+XMLImageMapCircleContext::XMLImageMapCircleContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ Reference<XIndexContainer> xMap) :
+ XMLImageMapObjectContext(rImport, nPrefix, rLocalName, xMap,
+ "com.sun.star.image.ImageMapCircleObject"),
+ bXOK(sal_False),
+ bYOK(sal_False),
+ bRadiusOK(sal_False)
+{
+}
+
+XMLImageMapCircleContext::~XMLImageMapCircleContext()
+{
+}
+
+void XMLImageMapCircleContext::ProcessAttribute(
+ enum XMLImageMapToken eToken,
+ const OUString& rValue)
+{
+ sal_Int32 nTmp;
+ switch (eToken)
+ {
+ case XML_TOK_IMAP_CENTER_X:
+ if (GetImport().GetMM100UnitConverter().convertMeasure(nTmp,
+ rValue))
+ {
+ aCenter.X = nTmp;
+ bXOK = sal_True;
+ }
+ break;
+ case XML_TOK_IMAP_CENTER_Y:
+ if (GetImport().GetMM100UnitConverter().convertMeasure(nTmp,
+ rValue))
+ {
+ aCenter.Y = nTmp;
+ bYOK = sal_True;
+ }
+ break;
+ case XML_TOK_IMAP_RADIUS:
+ if (GetImport().GetMM100UnitConverter().convertMeasure(nTmp,
+ rValue))
+ {
+ nRadius = nTmp;
+ bRadiusOK = sal_True;
+ }
+ break;
+ default:
+ XMLImageMapObjectContext::ProcessAttribute(eToken, rValue);
+ }
+
+ bValid = bRadiusOK && bXOK && bYOK;
+}
+
+void XMLImageMapCircleContext::Prepare(
+ Reference<XPropertySet> & rPropertySet)
+{
+ // center (x,y)
+ Any aAny;
+ aAny <<= aCenter;
+ rPropertySet->setPropertyValue( sCenter, aAny );
+
+ // radius
+ aAny <<= nRadius;
+ rPropertySet->setPropertyValue( sRadius, aAny );
+
+ // common properties handled by super class
+ XMLImageMapObjectContext::Prepare(rPropertySet);
+}
+
+
+
+
+
+
+
+
+
+
+TYPEINIT1(XMLImageMapContext, SvXMLImportContext);
+
+XMLImageMapContext::XMLImageMapContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ Reference<XPropertySet> & rPropertySet) :
+ SvXMLImportContext(rImport, nPrefix, rLocalName),
+ sImageMap(RTL_CONSTASCII_USTRINGPARAM("ImageMap")),
+ xPropertySet(rPropertySet)
+
+{
+ try
+ {
+ Reference < XPropertySetInfo > xInfo =
+ xPropertySet->getPropertySetInfo();
+ if( xInfo.is() && xInfo->hasPropertyByName( sImageMap ) )
+ xPropertySet->getPropertyValue(sImageMap) >>= xImageMap;
+ }
+ catch( com::sun::star::uno::Exception e )
+ {
+ uno::Sequence<OUString> aSeq(0);
+ rImport.SetError( XMLERROR_FLAG_WARNING | XMLERROR_API, aSeq, e.Message, NULL );
+ }
+}
+
+XMLImageMapContext::~XMLImageMapContext()
+{
+}
+
+SvXMLImportContext *XMLImageMapContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList )
+{
+ SvXMLImportContext* pContext = NULL;
+
+ if ( XML_NAMESPACE_DRAW == nPrefix )
+ {
+ if ( IsXMLToken(rLocalName, XML_AREA_RECTANGLE) )
+ {
+ pContext = new XMLImageMapRectangleContext(
+ GetImport(), nPrefix, rLocalName, xImageMap);
+ }
+ else if ( IsXMLToken(rLocalName, XML_AREA_POLYGON) )
+ {
+ pContext = new XMLImageMapPolygonContext(
+ GetImport(), nPrefix, rLocalName, xImageMap);
+ }
+ else if ( IsXMLToken(rLocalName, XML_AREA_CIRCLE) )
+ {
+ pContext = new XMLImageMapCircleContext(
+ GetImport(), nPrefix, rLocalName, xImageMap);
+ }
+ }
+ else
+ pContext = SvXMLImportContext::CreateChildContext(nPrefix, rLocalName,
+ xAttrList);
+
+ return pContext;
+}
+
+void XMLImageMapContext::EndElement()
+{
+ Reference < XPropertySetInfo > xInfo =
+ xPropertySet->getPropertySetInfo();
+ if( xInfo.is() && xInfo->hasPropertyByName( sImageMap ) )
+ xPropertySet->setPropertyValue(sImageMap, uno::makeAny( xImageMap ) );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/XMLImageMapExport.cxx b/xmloff/source/draw/XMLImageMapExport.cxx
new file mode 100644
index 000000000000..40ae2660d066
--- /dev/null
+++ b/xmloff/source/draw/XMLImageMapExport.cxx
@@ -0,0 +1,387 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLImageMapExport.hxx"
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <tools/debug.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/drawing/PointSequence.hpp>
+#include <xmloff/xmlexp.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/XMLEventExport.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "xexptran.hxx"
+
+
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::container::XIndexContainer;
+using ::com::sun::star::document::XEventsSupplier;
+using ::com::sun::star::lang::XServiceInfo;
+using ::com::sun::star::drawing::PointSequence;
+
+
+const sal_Char sAPI_ImageMapRectangleObject[] = "com.sun.star.image.ImageMapRectangleObject";
+const sal_Char sAPI_ImageMapCircleObject[] = "com.sun.star.image.ImageMapCircleObject";
+const sal_Char sAPI_ImageMapPolygonObject[] = "com.sun.star.image.ImageMapPolygonObject";
+
+XMLImageMapExport::XMLImageMapExport(SvXMLExport& rExp) :
+ msBoundary(RTL_CONSTASCII_USTRINGPARAM("Boundary")),
+ msCenter(RTL_CONSTASCII_USTRINGPARAM("Center")),
+ msDescription(RTL_CONSTASCII_USTRINGPARAM("Description")),
+ msImageMap(RTL_CONSTASCII_USTRINGPARAM("ImageMap")),
+ msIsActive(RTL_CONSTASCII_USTRINGPARAM("IsActive")),
+ msName(RTL_CONSTASCII_USTRINGPARAM("Name")),
+ msPolygon(RTL_CONSTASCII_USTRINGPARAM("Polygon")),
+ msRadius(RTL_CONSTASCII_USTRINGPARAM("Radius")),
+ msTarget(RTL_CONSTASCII_USTRINGPARAM("Target")),
+ msURL(RTL_CONSTASCII_USTRINGPARAM("URL")),
+ msTitle(RTL_CONSTASCII_USTRINGPARAM("Title")),
+ mrExport(rExp),
+ mbWhiteSpace(sal_True)
+{
+}
+
+XMLImageMapExport::~XMLImageMapExport()
+{
+
+}
+
+void XMLImageMapExport::Export(
+ const Reference<XPropertySet> & rPropertySet)
+{
+ if (rPropertySet->getPropertySetInfo()->hasPropertyByName(msImageMap))
+ {
+ Any aAny = rPropertySet->getPropertyValue(msImageMap);
+ Reference<XIndexContainer> aContainer;
+ aAny >>= aContainer;
+
+ Export(aContainer);
+ }
+ // else: no ImageMap property -> nothing to do
+}
+
+void XMLImageMapExport::Export(
+ const Reference<XIndexContainer> & rContainer)
+{
+ if (rContainer.is())
+ {
+ if (rContainer->hasElements())
+ {
+ // image map container element
+ SvXMLElementExport aImageMapElement(
+ mrExport, XML_NAMESPACE_DRAW, XML_IMAGE_MAP,
+ mbWhiteSpace, mbWhiteSpace);
+
+ // iterate over image map elements and call ExportMapEntry(...)
+ // for each
+ sal_Int32 nLength = rContainer->getCount();
+ for(sal_Int32 i = 0; i < nLength; i++)
+ {
+ Any aAny = rContainer->getByIndex(i);
+ Reference<XPropertySet> rElement;
+ aAny >>= rElement;
+
+ DBG_ASSERT(rElement.is(), "Image map element is empty!");
+ if (rElement.is())
+ {
+ ExportMapEntry(rElement);
+ }
+ }
+ }
+ // else: container is empty -> nothing to do
+ }
+ // else: no container -> nothign to do
+}
+
+
+void XMLImageMapExport::ExportMapEntry(
+ const Reference<XPropertySet> & rPropertySet)
+{
+ Reference<XServiceInfo> xServiceInfo(rPropertySet, UNO_QUERY);
+ if (xServiceInfo.is())
+ {
+ enum XMLTokenEnum eType = XML_TOKEN_INVALID;
+
+ // distinguish map entries by their service name
+ Sequence<OUString> sServiceNames =
+ xServiceInfo->getSupportedServiceNames();
+ sal_Int32 nLength = sServiceNames.getLength();
+ for( sal_Int32 i=0; i<nLength; i++ )
+ {
+ OUString& rName = sServiceNames[i];
+
+ if ( rName.equalsAsciiL(sAPI_ImageMapRectangleObject,
+ sizeof(sAPI_ImageMapRectangleObject)-1) )
+ {
+ eType = XML_AREA_RECTANGLE;
+ break;
+ }
+ else if ( rName.equalsAsciiL(sAPI_ImageMapCircleObject,
+ sizeof(sAPI_ImageMapCircleObject)-1) )
+ {
+ eType = XML_AREA_CIRCLE;
+ break;
+ }
+ else if ( rName.equalsAsciiL(sAPI_ImageMapPolygonObject,
+ sizeof(sAPI_ImageMapPolygonObject)-1))
+ {
+ eType = XML_AREA_POLYGON;
+ break;
+ }
+ }
+
+ // return from method if no proper service is found!
+ DBG_ASSERT(XML_TOKEN_INVALID != eType,
+ "Image map element doesn't support appropriate service!");
+ if (XML_TOKEN_INVALID == eType)
+ return;
+
+ // now: handle ImageMapObject properties (those for all types)
+
+ // XLINK (URL property)
+ Any aAny = rPropertySet->getPropertyValue(msURL);
+ OUString sHref;
+ aAny >>= sHref;
+ if (sHref.getLength() > 0)
+ {
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, mrExport.GetRelativeReference(sHref));
+ }
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+
+ // Target property (and xlink:show)
+ aAny = rPropertySet->getPropertyValue(msTarget);
+ OUString sTargt;
+ aAny >>= sTargt;
+ if (sTargt.getLength() > 0)
+ {
+ mrExport.AddAttribute(
+ XML_NAMESPACE_OFFICE, XML_TARGET_FRAME_NAME, sTargt);
+
+ mrExport.AddAttribute(
+ XML_NAMESPACE_XLINK, XML_SHOW,
+ sTargt.equalsAsciiL( "_blank", sizeof("_blank")-1 )
+ ? XML_NEW : XML_REPLACE );
+ }
+
+ // name
+ aAny = rPropertySet->getPropertyValue(msName);
+ OUString sItemName;
+ aAny >>= sItemName;
+ if (sItemName.getLength() > 0)
+ {
+ mrExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_NAME, sItemName);
+ }
+
+ // is-active
+ aAny = rPropertySet->getPropertyValue(msIsActive);
+ if (! *(sal_Bool*)aAny.getValue())
+ {
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_NOHREF, XML_NOHREF);
+ }
+
+ // call specific rectangle/circle/... method
+ // also prepare element name
+ switch (eType)
+ {
+ case XML_AREA_RECTANGLE:
+ ExportRectangle(rPropertySet);
+ break;
+ case XML_AREA_CIRCLE:
+ ExportCircle(rPropertySet);
+ break;
+ case XML_AREA_POLYGON:
+ ExportPolygon(rPropertySet);
+ break;
+ default:
+ break;
+ }
+
+ // write element
+ DBG_ASSERT(XML_TOKEN_INVALID != eType,
+ "No name?! How did this happen?");
+ SvXMLElementExport aAreaElement(mrExport, XML_NAMESPACE_DRAW, eType,
+ mbWhiteSpace, mbWhiteSpace);
+
+ // title property (as <svg:title> element)
+ OUString sTitle;
+ rPropertySet->getPropertyValue(msTitle) >>= sTitle;
+ if(sTitle.getLength())
+ {
+ SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SVG, XML_TITLE, mbWhiteSpace, sal_False);
+ mrExport.Characters(sTitle);
+ }
+
+ // description property (as <svg:desc> element)
+ OUString sDescription;
+ rPropertySet->getPropertyValue(msDescription) >>= sDescription;
+ if (sDescription.getLength() > 0)
+ {
+ SvXMLElementExport aDesc(mrExport, XML_NAMESPACE_SVG, XML_DESC, mbWhiteSpace, sal_False);
+ mrExport.Characters(sDescription);
+ }
+
+ // export events attached to this
+ Reference<XEventsSupplier> xSupplier(rPropertySet, UNO_QUERY);
+ mrExport.GetEventExport().Export(xSupplier, mbWhiteSpace);
+ }
+ // else: no service info -> can't determine type -> ignore entry
+}
+
+void XMLImageMapExport::ExportRectangle(
+ const Reference<XPropertySet> & rPropertySet)
+{
+ // get boundary rectangle
+ Any aAny = rPropertySet->getPropertyValue(msBoundary);
+ awt::Rectangle aRectangle;
+ aAny >>= aRectangle;
+
+ // parameters svg:x, svg:y, svg:width, svg:height
+ OUStringBuffer aBuffer;
+ mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, aRectangle.X);
+ mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_X,
+ aBuffer.makeStringAndClear() );
+ mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, aRectangle.Y);
+ mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_Y,
+ aBuffer.makeStringAndClear() );
+ mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, aRectangle.Width);
+ mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_WIDTH,
+ aBuffer.makeStringAndClear() );
+ mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, aRectangle.Height);
+ mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_HEIGHT,
+ aBuffer.makeStringAndClear() );
+}
+
+void XMLImageMapExport::ExportCircle(
+ const Reference<XPropertySet> & rPropertySet)
+{
+ // get boundary rectangle
+ Any aAny = rPropertySet->getPropertyValue(msCenter);
+ awt::Point aCenter;
+ aAny >>= aCenter;
+
+ // parameters svg:cx, svg:cy
+ OUStringBuffer aBuffer;
+ mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, aCenter.X);
+ mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_CX,
+ aBuffer.makeStringAndClear() );
+ mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, aCenter.Y);
+ mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_CY,
+ aBuffer.makeStringAndClear() );
+
+ // radius
+ aAny = rPropertySet->getPropertyValue(msRadius);
+ sal_Int32 nRadius = 0;
+ aAny >>= nRadius;
+ mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, nRadius);
+ mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_R,
+ aBuffer.makeStringAndClear() );
+}
+
+void XMLImageMapExport::ExportPolygon(
+ const Reference<XPropertySet> & rPropertySet)
+{
+ // polygons get exported as bounding box, viewbox, and coordinate
+ // pair sequence. The bounding box is always the entire image.
+
+ // get polygon point sequence
+ Any aAny = rPropertySet->getPropertyValue(msPolygon);
+ PointSequence aPoly;
+ aAny >>= aPoly;
+
+ // get bounding box (assume top-left to be 0,0)
+ sal_Int32 nWidth = 0;
+ sal_Int32 nHeight = 0;
+ sal_Int32 nLength = aPoly.getLength();
+ const struct awt::Point* pPointPtr = aPoly.getConstArray();
+ for ( sal_Int32 i = 0; i < nLength; i++ )
+ {
+ sal_Int32 nPolyX = pPointPtr->X;
+ sal_Int32 nPolyY = pPointPtr->Y;
+
+ if ( nPolyX > nWidth )
+ nWidth = nPolyX;
+ if ( nPolyY > nHeight )
+ nHeight = nPolyY;
+
+ pPointPtr++;
+ }
+ DBG_ASSERT(nWidth > 0, "impossible Polygon found");
+ DBG_ASSERT(nHeight > 0, "impossible Polygon found");
+
+ // parameters svg:x, svg:y, svg:width, svg:height
+ OUStringBuffer aBuffer;
+ mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, 0);
+ mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_X,
+ aBuffer.makeStringAndClear() );
+ mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, 0);
+ mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_Y,
+ aBuffer.makeStringAndClear() );
+ mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, nWidth);
+ mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_WIDTH,
+ aBuffer.makeStringAndClear() );
+ mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, nHeight);
+ mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_HEIGHT,
+ aBuffer.makeStringAndClear() );
+
+ // svg:viewbox
+ SdXMLImExViewBox aViewBox(0, 0, nWidth, nHeight);
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX,
+ aViewBox.GetExportString());
+
+ // export point sequence
+ awt::Point aPoint(0, 0);
+ awt::Size aSize(nWidth, nHeight);
+ SdXMLImExPointsElement aPoints( &aPoly, aViewBox, aPoint, aSize );
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_POINTS,
+ aPoints.GetExportString());
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/XMLNumberStyles.cxx b/xmloff/source/draw/XMLNumberStyles.cxx
new file mode 100644
index 000000000000..70db6e776a39
--- /dev/null
+++ b/xmloff/source/draw/XMLNumberStyles.cxx
@@ -0,0 +1,743 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#include <XMLNumberStylesExport.hxx>
+#include <XMLNumberStylesImport.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmltoken.hxx>
+
+#include "sdxmlexp_impl.hxx"
+#include "sdxmlimp_impl.hxx"
+
+using namespace ::xmloff::token;
+
+using ::rtl::OUString;
+
+struct SdXMLDataStyleNumber
+{
+ enum XMLTokenEnum meNumberStyle;
+ sal_Bool mbLong;
+ sal_Bool mbTextual;
+ sal_Bool mbDecimal02;
+ const char* mpText;
+}
+ aSdXMLDataStyleNumbers[] =
+{
+ { XML_DAY, sal_False, sal_False, sal_False, NULL },
+ { XML_DAY, sal_True, sal_False, sal_False, NULL },
+ { XML_MONTH, sal_True, sal_False, sal_False, NULL },
+ { XML_MONTH, sal_False, sal_True, sal_False, NULL },
+ { XML_MONTH, sal_True, sal_True, sal_False, NULL },
+ { XML_YEAR, sal_False, sal_False, sal_False, NULL },
+ { XML_YEAR, sal_True, sal_False, sal_False, NULL },
+ { XML_DAY_OF_WEEK, sal_False, sal_False, sal_False, NULL },
+ { XML_DAY_OF_WEEK, sal_True, sal_False, sal_False, NULL },
+ { XML_TEXT, sal_False, sal_False, sal_False, "." },
+ { XML_TEXT, sal_False, sal_False, sal_False, " " },
+ { XML_TEXT, sal_False, sal_False, sal_False, ", " },
+ { XML_TEXT, sal_False, sal_False, sal_False, ". " },
+ { XML_HOURS, sal_False, sal_False, sal_False, NULL },
+ { XML_MINUTES, sal_False, sal_False, sal_False, NULL },
+ { XML_TEXT, sal_False, sal_False, sal_False, ":" },
+ { XML_AM_PM, sal_False, sal_False, sal_False, NULL },
+ { XML_SECONDS, sal_False, sal_False, sal_False, NULL },
+ { XML_SECONDS, sal_False, sal_False, sal_True, NULL },
+ { XML_TOKEN_INVALID, 0, 0, 0, NULL }
+};
+
+// date
+
+#define DATA_STYLE_NUMBER_END 0
+#define DATA_STYLE_NUMBER_DAY 1 // <number:day/>
+#define DATA_STYLE_NUMBER_DAY_LONG 2 // <number:day number:style="long"/>
+#define DATA_STYLE_NUMBER_MONTH_LONG 3 // <number:month number:style="long"/>
+#define DATA_STYLE_NUMBER_MONTH_TEXT 4 // <number:month number:textual="true"/>
+#define DATA_STYLE_NUMBER_MONTH_LONG_TEXT 5 // <number:month number:style="long" number:textual="true"/>
+#define DATA_STYLE_NUMBER_YEAR 6 // <number:year/>
+#define DATA_STYLE_NUMBER_YEAR_LONG 7 // <number:year number:style="long"/>
+#define DATA_STYLE_NUMBER_DAYOFWEEK 8 // <number:day-of-week/>
+#define DATA_STYLE_NUMBER_DAYOFWEEK_LONG 9 // <number:day-of-week number:style="long"/>
+#define DATA_STYLE_NUMBER_TEXT_POINT 10 // <number:text>.</number:text>
+#define DATA_STYLE_NUMBER_TEXT_SPACE 11 // <number:text> </number:text>
+#define DATA_STYLE_NUMBER_TEXT_COMMASPACE 12 // <number:text>, </number:text>
+#define DATA_STYLE_NUMBER_TEXT_POINTSPACE 13 // <number:text>. </number:text>
+#define DATA_STYLE_NUMBER_HOURS 14 // <number:hours/>
+#define DATA_STYLE_NUMBER_MINUTES 15 // <number:minutes/>
+#define DATA_STYLE_NUMBER_TEXT_COLON 16 // <number:text>:</number:text>
+#define DATA_STYLE_NUMBER_AMPM 17 // <number:am-pm/>
+#define DATA_STYLE_NUMBER_SECONDS 18 // <number:seconds/>
+#define DATA_STYLE_NUMBER_SECONDS_02 19 // <number:seconds number:/>
+
+
+struct SdXMLFixedDataStyle
+{
+ const char* mpName;
+ sal_Bool mbAutomatic;
+ sal_Bool mbDateStyle;
+ sal_uInt8 mpFormat[8];
+};
+
+const SdXMLFixedDataStyle aSdXML_Standard_Short =
+{
+ "D1", sal_True, sal_True,
+ {
+ DATA_STYLE_NUMBER_DAY_LONG,
+ DATA_STYLE_NUMBER_TEXT_POINT,
+ DATA_STYLE_NUMBER_MONTH_LONG,
+ DATA_STYLE_NUMBER_TEXT_POINT,
+ DATA_STYLE_NUMBER_YEAR_LONG,
+ 0, 0, 0
+ }
+};
+
+const SdXMLFixedDataStyle aSdXML_Standard_Long =
+{
+ "D2", sal_True, sal_True,
+ {
+ DATA_STYLE_NUMBER_DAYOFWEEK_LONG,
+ DATA_STYLE_NUMBER_TEXT_COMMASPACE,
+ DATA_STYLE_NUMBER_DAY,
+ DATA_STYLE_NUMBER_TEXT_POINTSPACE,
+ DATA_STYLE_NUMBER_MONTH_LONG_TEXT,
+ DATA_STYLE_NUMBER_TEXT_SPACE,
+ DATA_STYLE_NUMBER_YEAR_LONG,
+ 0
+ }
+};
+
+const SdXMLFixedDataStyle aSdXML_DateStyle_1 =
+{
+ "D3", sal_False, sal_True,
+ {
+ DATA_STYLE_NUMBER_DAY_LONG,
+ DATA_STYLE_NUMBER_TEXT_POINT,
+ DATA_STYLE_NUMBER_MONTH_LONG,
+ DATA_STYLE_NUMBER_TEXT_POINT,
+ DATA_STYLE_NUMBER_YEAR,
+ 0, 0, 0
+ }
+};
+
+const SdXMLFixedDataStyle aSdXML_DateStyle_2 =
+{
+ "D4", sal_False, sal_True,
+ {
+ DATA_STYLE_NUMBER_DAY_LONG,
+ DATA_STYLE_NUMBER_TEXT_POINT,
+ DATA_STYLE_NUMBER_MONTH_LONG,
+ DATA_STYLE_NUMBER_TEXT_POINT,
+ DATA_STYLE_NUMBER_YEAR_LONG,
+ 0, 0, 0
+ }
+};
+
+const SdXMLFixedDataStyle aSdXML_DateStyle_3 =
+{
+ "D5", sal_False, sal_True,
+ {
+ DATA_STYLE_NUMBER_DAY,
+ DATA_STYLE_NUMBER_TEXT_POINTSPACE,
+ DATA_STYLE_NUMBER_MONTH_TEXT,
+ DATA_STYLE_NUMBER_TEXT_SPACE,
+ DATA_STYLE_NUMBER_YEAR_LONG,
+ 0, 0, 0
+ }
+};
+
+const SdXMLFixedDataStyle aSdXML_DateStyle_4 =
+{
+ "D6", sal_False, sal_True,
+ {
+ DATA_STYLE_NUMBER_DAY,
+ DATA_STYLE_NUMBER_TEXT_POINTSPACE,
+ DATA_STYLE_NUMBER_MONTH_LONG_TEXT,
+ DATA_STYLE_NUMBER_TEXT_SPACE,
+ DATA_STYLE_NUMBER_YEAR_LONG,
+ 0, 0, 0
+ }
+};
+
+const SdXMLFixedDataStyle aSdXML_DateStyle_5 =
+{
+ "D7", sal_False, sal_True,
+ {
+ DATA_STYLE_NUMBER_DAYOFWEEK,
+ DATA_STYLE_NUMBER_TEXT_COMMASPACE,
+ DATA_STYLE_NUMBER_DAY,
+ DATA_STYLE_NUMBER_TEXT_POINTSPACE,
+ DATA_STYLE_NUMBER_MONTH_LONG_TEXT,
+ DATA_STYLE_NUMBER_TEXT_SPACE,
+ DATA_STYLE_NUMBER_YEAR_LONG,
+ 0
+ }
+};
+
+const SdXMLFixedDataStyle aSdXML_DateStyle_6 =
+{
+ "D8", sal_False, sal_True,
+ {
+ DATA_STYLE_NUMBER_DAYOFWEEK_LONG,
+ DATA_STYLE_NUMBER_TEXT_COMMASPACE,
+ DATA_STYLE_NUMBER_DAY,
+ DATA_STYLE_NUMBER_TEXT_POINTSPACE,
+ DATA_STYLE_NUMBER_MONTH_LONG_TEXT,
+ DATA_STYLE_NUMBER_TEXT_SPACE,
+ DATA_STYLE_NUMBER_YEAR_LONG,
+ 0
+ }
+};
+
+const SdXMLFixedDataStyle aSdXML_TimeStyle_1 =
+{ "T1", sal_True, sal_False,
+ {
+ DATA_STYLE_NUMBER_HOURS,
+ DATA_STYLE_NUMBER_TEXT_COLON,
+ DATA_STYLE_NUMBER_MINUTES,
+ DATA_STYLE_NUMBER_TEXT_COLON,
+ DATA_STYLE_NUMBER_SECONDS,
+ DATA_STYLE_NUMBER_AMPM,
+ 0, 0,
+ }
+};
+
+const SdXMLFixedDataStyle aSdXML_TimeStyle_2 =
+{ "T2", sal_False, sal_False,
+ {
+ DATA_STYLE_NUMBER_HOURS,
+ DATA_STYLE_NUMBER_TEXT_COLON,
+ DATA_STYLE_NUMBER_MINUTES,
+ 0, 0, 0, 0, 0
+ }
+};
+
+const SdXMLFixedDataStyle aSdXML_TimeStyle_3 =
+{ "T3", sal_False, sal_False,
+ {
+ DATA_STYLE_NUMBER_HOURS,
+ DATA_STYLE_NUMBER_TEXT_COLON,
+ DATA_STYLE_NUMBER_MINUTES,
+ DATA_STYLE_NUMBER_TEXT_COLON,
+ DATA_STYLE_NUMBER_SECONDS,
+ 0, 0, 0
+ }
+};
+
+const SdXMLFixedDataStyle aSdXML_TimeStyle_4 =
+{ "T4", sal_False, sal_False,
+ {
+ DATA_STYLE_NUMBER_HOURS,
+ DATA_STYLE_NUMBER_TEXT_COLON,
+ DATA_STYLE_NUMBER_MINUTES,
+ DATA_STYLE_NUMBER_TEXT_COLON,
+ DATA_STYLE_NUMBER_SECONDS_02,
+ 0, 0, 0
+ }
+};
+
+const SdXMLFixedDataStyle aSdXML_TimeStyle_5 =
+{ "T5", sal_False, sal_False,
+ {
+ DATA_STYLE_NUMBER_HOURS,
+ DATA_STYLE_NUMBER_TEXT_COLON,
+ DATA_STYLE_NUMBER_MINUTES,
+ DATA_STYLE_NUMBER_AMPM,
+ 0, 0, 0, 0
+ }
+};
+
+const SdXMLFixedDataStyle aSdXML_TimeStyle_6 =
+{ "T6", sal_False, sal_False,
+ {
+ DATA_STYLE_NUMBER_HOURS,
+ DATA_STYLE_NUMBER_TEXT_COLON,
+ DATA_STYLE_NUMBER_MINUTES,
+ DATA_STYLE_NUMBER_TEXT_COLON,
+ DATA_STYLE_NUMBER_SECONDS,
+ DATA_STYLE_NUMBER_AMPM,
+ 0, 0
+ }
+};
+
+const SdXMLFixedDataStyle aSdXML_TimeStyle_7 =
+{ "T7", sal_False, sal_False,
+ {
+ DATA_STYLE_NUMBER_HOURS,
+ DATA_STYLE_NUMBER_TEXT_COLON,
+ DATA_STYLE_NUMBER_MINUTES,
+ DATA_STYLE_NUMBER_TEXT_COLON,
+ DATA_STYLE_NUMBER_SECONDS_02,
+ DATA_STYLE_NUMBER_AMPM,
+ 0, 0
+ }
+};
+
+const SdXMLFixedDataStyle* aSdXMLFixedDateFormats[SdXMLDateFormatCount] =
+{
+ &aSdXML_Standard_Short,
+ &aSdXML_Standard_Long,
+ &aSdXML_DateStyle_1,
+ &aSdXML_DateStyle_2,
+ &aSdXML_DateStyle_3,
+ &aSdXML_DateStyle_4,
+ &aSdXML_DateStyle_5,
+ &aSdXML_DateStyle_6,
+};
+
+const SdXMLFixedDataStyle* aSdXMLFixedTimeFormats[SdXMLTimeFormatCount] =
+{
+ &aSdXML_TimeStyle_1,
+ &aSdXML_TimeStyle_2,
+ &aSdXML_TimeStyle_3,
+ &aSdXML_TimeStyle_4,
+ &aSdXML_TimeStyle_5,
+ &aSdXML_TimeStyle_6,
+ &aSdXML_TimeStyle_7
+};
+
+
+///////////////////////////////////////////////////////////////////////
+// export
+
+static void SdXMLExportDataStyleNumber( SdXMLExport& rExport, SdXMLDataStyleNumber& rElement )
+{
+ if( rElement.mbDecimal02 )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_DECIMAL_PLACES, XML_2 );
+ }
+
+ if( rElement.mbLong )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_STYLE, XML_LONG );
+ }
+
+ if( rElement.mbTextual )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_TEXTUAL, XML_TRUE );
+ }
+
+ SvXMLElementExport aNumberStyle( rExport, XML_NAMESPACE_NUMBER, rElement.meNumberStyle, sal_True, sal_False );
+ if( rElement.mpText )
+ {
+ OUString sAttrValue( OUString::createFromAscii( rElement.mpText ) );
+ rExport.GetDocHandler()->characters( sAttrValue );
+ }
+}
+
+static void SdXMLExportStyle( SdXMLExport& rExport, const SdXMLFixedDataStyle* pStyle, const SdXMLFixedDataStyle* pStyle2 = NULL )
+{
+ OUString sAttrValue;
+
+ // name
+ sAttrValue = OUString::createFromAscii( pStyle->mpName );
+ if( pStyle2 )
+ sAttrValue += OUString::createFromAscii( pStyle2->mpName );
+
+ rExport.AddAttribute( XML_NAMESPACE_STYLE, XML_NAME, sAttrValue );
+
+ if( pStyle->mbAutomatic )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_AUTOMATIC_ORDER, XML_TRUE );
+ }
+
+ SvXMLElementExport aElement( rExport, XML_NAMESPACE_NUMBER, pStyle->mbDateStyle ? XML_DATE_STYLE : XML_TIME_STYLE, sal_True, sal_True );
+
+ do
+ {
+
+ const sal_uInt8* pElements = (const sal_uInt8*)&pStyle->mpFormat[0];
+
+ while( *pElements )
+ {
+ SdXMLDataStyleNumber& rElement = aSdXMLDataStyleNumbers[ (*pElements++) - 1 ];
+ SdXMLExportDataStyleNumber( rExport, rElement );
+ }
+
+ if( pStyle2 )
+ {
+ SdXMLDataStyleNumber& rElement = aSdXMLDataStyleNumbers[ DATA_STYLE_NUMBER_TEXT_SPACE - 1 ];
+ SdXMLExportDataStyleNumber( rExport, rElement );
+ }
+
+ pStyle = pStyle2;
+ pStyle2 = NULL;
+ }
+ while( pStyle );
+}
+
+void SdXMLNumberStylesExporter::exportTimeStyle( SdXMLExport& rExport, sal_Int32 nStyle )
+{
+ DBG_ASSERT( (nStyle >= 0) && (nStyle < SdXMLTimeFormatCount), "Unknown time style!" );
+ if( (nStyle >= 0) && (nStyle < SdXMLTimeFormatCount) )
+ SdXMLExportStyle( rExport, aSdXMLFixedTimeFormats[ nStyle ] );
+}
+
+void SdXMLNumberStylesExporter::exportDateStyle( SdXMLExport& rExport, sal_Int32 nStyle )
+{
+ if( nStyle > 0x0f )
+ {
+ int nDateStyle = nStyle & 0x0f;
+ bool bHasDate = nDateStyle != 0;
+
+ if( nDateStyle > 1 )
+ nDateStyle -= 2;
+
+ DBG_ASSERT( (nDateStyle >= 0) && (nDateStyle < SdXMLDateFormatCount), "unknown date style!" );
+
+ int nTimeStyle = (nStyle >> 4) & 0x0f;
+ bool bHasTime = nTimeStyle != 0;
+
+ if( nTimeStyle > 1 )
+ nTimeStyle -= 2;
+
+ DBG_ASSERT( (nTimeStyle >= 0) && (nTimeStyle < SdXMLTimeFormatCount), "Unknown time style!" );
+
+ if( (nDateStyle >= 0) && (nDateStyle < SdXMLDateFormatCount) && (nTimeStyle >= 0) && (nTimeStyle < SdXMLTimeFormatCount) )
+ {
+ if( bHasDate )
+ {
+ if( bHasTime )
+ {
+ SdXMLExportStyle( rExport, aSdXMLFixedDateFormats[ nDateStyle ], aSdXMLFixedTimeFormats[ nTimeStyle ] );
+ }
+ else
+ {
+ SdXMLExportStyle( rExport, aSdXMLFixedDateFormats[ nDateStyle ] );
+ }
+ }
+ else if( bHasTime )
+ {
+ SdXMLExportStyle( rExport, aSdXMLFixedTimeFormats[ nTimeStyle ] );
+ }
+ }
+ }
+ else
+ {
+ DBG_ASSERT( (nStyle >= 0) && (nStyle < SdXMLDateFormatCount), "unknown date style!" );
+ if( (nStyle >= 0) && (nStyle < SdXMLDateFormatCount) )
+ SdXMLExportStyle( rExport, aSdXMLFixedDateFormats[ nStyle ] );
+ }
+}
+
+OUString SdXMLNumberStylesExporter::getTimeStyleName(const sal_Int32 nTimeFormat )
+{
+ sal_Int32 nFormat = nTimeFormat;
+ if( nFormat > 1 )
+ nFormat -= 2;
+
+ if( (nFormat >= 0) && (nFormat < SdXMLTimeFormatCount) )
+ {
+ return OUString::createFromAscii(aSdXMLFixedTimeFormats[nFormat]->mpName );
+ }
+ else
+ {
+ return OUString();
+ }
+}
+
+OUString SdXMLNumberStylesExporter::getDateStyleName(const sal_Int32 nDateFormat )
+{
+ sal_Int32 nFormat = nDateFormat;
+
+ if( nFormat > 0x0f )
+ {
+ OUString aStr;
+ if( nFormat & 0x0f )
+ aStr = getDateStyleName( nFormat & 0x0f );
+ aStr += getTimeStyleName( (nFormat >> 4) & 0x0f );
+ return aStr;
+ }
+
+ if( nFormat > 1 )
+ nFormat -= 2;
+
+ if( (nFormat >= 0) && (nFormat < SdXMLDateFormatCount) )
+ {
+ return OUString::createFromAscii(aSdXMLFixedDateFormats[nFormat]->mpName );
+ }
+ else
+ {
+ return OUString();
+ }
+}
+
+
+///////////////////////////////////////////////////////////////////////
+// import
+
+class SdXMLNumberFormatMemberImportContext : public SvXMLImportContext
+{
+private:
+ SdXMLNumberFormatImportContext* mpParent;
+
+ OUString maNumberStyle;
+ sal_Bool mbLong;
+ sal_Bool mbTextual;
+ sal_Bool mbDecimal02;
+ OUString maText;
+ SvXMLImportContext* mpSlaveContext;
+
+public:
+ TYPEINFO();
+
+ SdXMLNumberFormatMemberImportContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ SdXMLNumberFormatImportContext* pParent,
+ SvXMLImportContext* pSlaveContext );
+ virtual ~SdXMLNumberFormatMemberImportContext();
+
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void EndElement();
+
+ virtual void Characters( const ::rtl::OUString& rChars );
+};
+
+TYPEINIT1( SdXMLNumberFormatMemberImportContext, SvXMLImportContext );
+
+SdXMLNumberFormatMemberImportContext::SdXMLNumberFormatMemberImportContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLocalName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, SdXMLNumberFormatImportContext* pParent, SvXMLImportContext* pSlaveContext )
+: SvXMLImportContext(rImport, nPrfx, rLocalName),
+ mpParent( pParent ),
+ maNumberStyle( rLocalName ),
+ mpSlaveContext( pSlaveContext )
+{
+ mbLong = sal_False;
+ mbTextual = sal_False;
+ mbDecimal02 = sal_False;
+
+ const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ OUString sValue = xAttrList->getValueByIndex( i );
+
+ if( nPrefix == XML_NAMESPACE_NUMBER )
+ {
+ if( IsXMLToken( aLocalName, XML_DECIMAL_PLACES ) )
+ {
+ mbDecimal02 = IsXMLToken( sValue, XML_2 );
+ }
+ else if( IsXMLToken( aLocalName, XML_STYLE ) )
+ {
+ mbLong = IsXMLToken( sValue, XML_LONG );
+ }
+ else if( IsXMLToken( aLocalName, XML_TEXTUAL ) )
+ {
+ mbTextual = IsXMLToken( sValue, XML_TRUE );
+ }
+ }
+ }
+
+}
+
+SdXMLNumberFormatMemberImportContext::~SdXMLNumberFormatMemberImportContext()
+{
+}
+
+SvXMLImportContext *SdXMLNumberFormatMemberImportContext::CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList )
+{
+ return mpSlaveContext->CreateChildContext( nPrefix, rLocalName, xAttrList );
+}
+
+void SdXMLNumberFormatMemberImportContext::StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList )
+{
+ mpSlaveContext->StartElement( xAttrList );
+}
+
+void SdXMLNumberFormatMemberImportContext::EndElement()
+{
+ mpSlaveContext->EndElement();
+
+ if( mpParent )
+ mpParent->add( maNumberStyle, mbLong, mbTextual, mbDecimal02, maText );
+}
+
+void SdXMLNumberFormatMemberImportContext::Characters( const ::rtl::OUString& rChars )
+{
+ mpSlaveContext->Characters( rChars );
+ maText += rChars;
+}
+
+TYPEINIT1( SdXMLNumberFormatImportContext, SvXMLImportContext );
+
+
+SdXMLNumberFormatImportContext::SdXMLNumberFormatImportContext( SdXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLocalName, SvXMLNumImpData* pNewData, sal_uInt16 nNewType, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, SvXMLStylesContext& rStyles)
+: SvXMLNumFormatContext(rImport, nPrfx, rLocalName, pNewData, nNewType, xAttrList, rStyles),
+ mrImport( rImport ),
+ mbAutomatic( sal_False ),
+ mnIndex(0),
+ mnKey( -1 )
+{
+ mbTimeStyle = IsXMLToken( rLocalName, XML_TIME_STYLE );
+
+ const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ OUString sValue = xAttrList->getValueByIndex( i );
+
+ if( nPrefix == XML_NAMESPACE_NUMBER )
+ {
+ if( IsXMLToken( aLocalName, XML_AUTOMATIC_ORDER ) )
+ {
+ mbAutomatic = IsXMLToken( sValue, XML_TRUE );
+ }
+ }
+ }
+}
+
+SdXMLNumberFormatImportContext::~SdXMLNumberFormatImportContext()
+{
+}
+
+void SdXMLNumberFormatImportContext::add( OUString& rNumberStyle, sal_Bool bLong, sal_Bool bTextual, sal_Bool bDecimal02, OUString& rText )
+{
+ if( mnIndex == -1 || mnIndex == 16 )
+ {
+ mnIndex = -1;
+ return;
+ }
+
+ const SdXMLDataStyleNumber* pStyleMember = aSdXMLDataStyleNumbers;
+ for( sal_uInt8 nIndex = 0; pStyleMember->meNumberStyle != XML_TOKEN_INVALID; nIndex++, pStyleMember++ )
+ {
+ if( (IsXMLToken(rNumberStyle, pStyleMember->meNumberStyle) &&
+ (pStyleMember->mbLong == bLong) &&
+ (pStyleMember->mbTextual == bTextual) &&
+ (pStyleMember->mbDecimal02 == bDecimal02) &&
+ ( ( (pStyleMember->mpText == NULL) && (rText.getLength() == 0) ) ||
+ ( pStyleMember->mpText && (rText.compareToAscii( pStyleMember->mpText ) == 0 )) ) ) )
+ {
+ mnElements[mnIndex++] = nIndex + 1;
+ return;
+ }
+ }
+}
+
+bool SdXMLNumberFormatImportContext::compareStyle( const SdXMLFixedDataStyle* pStyle, sal_Int16& nIndex ) const
+{
+ if( (pStyle->mbAutomatic != mbAutomatic) && (nIndex == 0))
+ return sal_False;
+
+ sal_Int16 nCompareIndex;
+ for( nCompareIndex = 0; nCompareIndex < 8; nIndex++, nCompareIndex++ )
+ {
+ if( pStyle->mpFormat[nCompareIndex] != mnElements[nIndex] )
+ return sal_False;
+ }
+
+ return sal_True;
+}
+
+void SdXMLNumberFormatImportContext::EndElement()
+{
+ SvXMLNumFormatContext::EndElement();
+
+ for( ; mnIndex < 16; mnIndex++ )
+ {
+ mnElements[mnIndex] = 0;
+ }
+
+ if( mbTimeStyle )
+ {
+ // compare import with all time styles
+ for( sal_Int16 nFormat = 0; nFormat < SdXMLTimeFormatCount; nFormat++ )
+ {
+ sal_Int16 nIndex = 0;
+ if( compareStyle( aSdXMLFixedTimeFormats[nFormat], nIndex ) )
+ {
+ mnKey = nFormat + 2;
+ break;
+ }
+ }
+ }
+ else
+ {
+ // compare import with all date styles
+ for( sal_Int16 nFormat = 0; nFormat < SdXMLDateFormatCount; nFormat++ )
+ {
+ sal_Int16 nIndex = 0;
+ if( compareStyle( aSdXMLFixedDateFormats[nFormat], nIndex ) )
+ {
+ mnKey = nFormat + 2;
+ break;
+ }
+ else if( mnElements[nIndex] == DATA_STYLE_NUMBER_TEXT_SPACE )
+ {
+ // if its a valid date ending with a space, see if a time style follows
+ for( sal_Int16 nTimeFormat = 0; nTimeFormat < SdXMLTimeFormatCount; nTimeFormat++ )
+ {
+ sal_Int16 nIndex2 = nIndex + 1;
+ if( compareStyle( aSdXMLFixedTimeFormats[nTimeFormat], nIndex2 ) )
+ {
+ mnKey = (nFormat + 2) | ((nTimeFormat + 2) << 4);
+ break;
+ }
+ }
+ }
+ }
+
+ // no date style found? maybe its an extended time style
+ if( mnKey == -1 )
+ {
+ // compare import with all time styles
+ for( sal_Int16 nFormat = 0; nFormat < SdXMLTimeFormatCount; nFormat++ )
+ {
+ sal_Int16 nIndex = 0;
+ if( compareStyle( aSdXMLFixedTimeFormats[nFormat], nIndex ) )
+ {
+ mnKey = (nFormat + 2) << 4;
+ break;
+ }
+ }
+ }
+ }
+}
+
+SvXMLImportContext * SdXMLNumberFormatImportContext::CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList )
+{
+ return new SdXMLNumberFormatMemberImportContext( GetImport(), nPrefix, rLocalName, xAttrList, this, SvXMLNumFormatContext::CreateChildContext( nPrefix, rLocalName, xAttrList ) );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/XMLNumberStylesExport.hxx b/xmloff/source/draw/XMLNumberStylesExport.hxx
new file mode 100644
index 000000000000..f905770f814e
--- /dev/null
+++ b/xmloff/source/draw/XMLNumberStylesExport.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_NUMBERSTYLESEXPORT_HXX
+#define _XMLOFF_NUMBERSTYLESEXPORT_HXX
+
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+
+class SdXMLExport;
+
+const sal_Int16 SdXMLDateFormatCount = 8;
+const sal_Int16 SdXMLTimeFormatCount = 7;
+
+class SdXMLNumberStylesExporter
+{
+public:
+ static void exportTimeStyle( SdXMLExport& rExport, sal_Int32 nStyle );
+ static void exportDateStyle( SdXMLExport& rExport, sal_Int32 nStyle );
+
+ static sal_Int32 getDateStyleCount() { return SdXMLDateFormatCount; }
+ static sal_Int32 getTimeStyleCount() { return SdXMLTimeFormatCount; }
+
+ static rtl::OUString getTimeStyleName(const sal_Int32 nTimeFormat );
+ static rtl::OUString getDateStyleName(const sal_Int32 nDateFormat );
+};
+
+#endif // _XMLOFF_NUMBERSTYLESEXPORT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/XMLReplacementImageContext.cxx b/xmloff/source/draw/XMLReplacementImageContext.cxx
new file mode 100644
index 000000000000..fae186ca94d9
--- /dev/null
+++ b/xmloff/source/draw/XMLReplacementImageContext.cxx
@@ -0,0 +1,138 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/XMLBase64ImportContext.hxx>
+#include "XMLReplacementImageContext.hxx"
+
+using ::rtl::OUString;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::makeAny;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::beans;
+
+TYPEINIT1( XMLReplacementImageContext, SvXMLImportContext );
+
+XMLReplacementImageContext::XMLReplacementImageContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx, const OUString& rLName,
+ const Reference< XAttributeList > & rAttrList,
+ const Reference< XPropertySet > & rPropSet ) :
+ SvXMLImportContext( rImport, nPrfx, rLName ),
+ m_xPropSet( rPropSet ),
+ m_sGraphicURL(RTL_CONSTASCII_USTRINGPARAM("GraphicURL"))
+{
+ UniReference < XMLTextImportHelper > xTxtImport =
+ GetImport().GetTextImport();
+ const SvXMLTokenMap& rTokenMap =
+ xTxtImport->GetTextFrameAttrTokenMap();
+
+ sal_Int16 nAttrCount = rAttrList.is() ? rAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = rAttrList->getNameByIndex( i );
+ const OUString& rValue = rAttrList->getValueByIndex( i );
+
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ switch( rTokenMap.Get( nPrefix, aLocalName ) )
+ {
+ case XML_TOK_TEXT_FRAME_HREF:
+ m_sHRef = rValue;
+ break;
+ }
+ }
+}
+
+XMLReplacementImageContext::~XMLReplacementImageContext()
+{
+}
+
+void XMLReplacementImageContext::EndElement()
+{
+ OSL_ENSURE( m_sHRef.getLength() > 0 || m_xBase64Stream.is(),
+ "neither URL nor base64 image data given" );
+ UniReference < XMLTextImportHelper > xTxtImport =
+ GetImport().GetTextImport();
+ OUString sHRef;
+ if( m_sHRef.getLength() )
+ {
+ sal_Bool bForceLoad = xTxtImport->IsInsertMode() ||
+ xTxtImport->IsBlockMode() ||
+ xTxtImport->IsStylesOnlyMode() ||
+ xTxtImport->IsOrganizerMode();
+ sHRef = GetImport().ResolveGraphicObjectURL( m_sHRef, !bForceLoad );
+ }
+ else if( m_xBase64Stream.is() )
+ {
+ sHRef = GetImport().ResolveGraphicObjectURLFromBase64( m_xBase64Stream );
+ m_xBase64Stream = 0;
+ }
+
+ Reference < XPropertySetInfo > xPropSetInfo =
+ m_xPropSet->getPropertySetInfo();
+ if( xPropSetInfo->hasPropertyByName( m_sGraphicURL ) )
+ m_xPropSet->setPropertyValue( m_sGraphicURL, makeAny( sHRef ) );
+}
+
+SvXMLImportContext *XMLReplacementImageContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference< XAttributeList > & xAttrList )
+{
+ SvXMLImportContext *pContext = 0;
+
+ if( XML_NAMESPACE_OFFICE == nPrefix &&
+ IsXMLToken( rLocalName, ::xmloff::token::XML_BINARY_DATA ) &&
+ !m_xBase64Stream.is() )
+ {
+ m_xBase64Stream = GetImport().GetStreamForGraphicObjectURLFromBase64();
+ if( m_xBase64Stream.is() )
+ pContext = new XMLBase64ImportContext( GetImport(), nPrefix,
+ rLocalName, xAttrList,
+ m_xBase64Stream );
+ }
+
+ if( !pContext )
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+
+ return pContext;
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/XMLShapePropertySetContext.cxx b/xmloff/source/draw/XMLShapePropertySetContext.cxx
new file mode 100644
index 000000000000..9783cc916292
--- /dev/null
+++ b/xmloff/source/draw/XMLShapePropertySetContext.cxx
@@ -0,0 +1,117 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "XMLShapePropertySetContext.hxx"
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmlnumi.hxx>
+#include "xmltabi.hxx"
+#include <xmloff/txtprmap.hxx>
+
+#include "sdpropls.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( XMLShapePropertySetContext, SvXMLPropertySetContext );
+
+XMLShapePropertySetContext::XMLShapePropertySetContext(
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const Reference< xml::sax::XAttributeList > & xAttrList,
+ sal_uInt32 nFam,
+ ::std::vector< XMLPropertyState > &rProps,
+ const UniReference < SvXMLImportPropertyMapper > &rMap ) :
+ SvXMLPropertySetContext( rImport, nPrfx, rLName, xAttrList, nFam,
+ rProps, rMap ),
+ mnBulletIndex(-1)
+{
+}
+
+XMLShapePropertySetContext::~XMLShapePropertySetContext()
+{
+}
+
+void XMLShapePropertySetContext::EndElement()
+{
+ Reference< container::XIndexReplace > xNumRule;
+ if( mxBulletStyle.Is() )
+ {
+ SvxXMLListStyleContext* pBulletStyle = (SvxXMLListStyleContext*)&mxBulletStyle;
+ xNumRule = pBulletStyle->CreateNumRule( GetImport().GetModel() );
+ if( xNumRule.is() )
+ pBulletStyle->FillUnoNumRule(xNumRule, NULL /* const SvI18NMap * ??? */ );
+ }
+
+ Any aAny;
+ aAny <<= xNumRule;
+
+ XMLPropertyState aPropState( mnBulletIndex, aAny );
+ mrProperties.push_back( aPropState );
+
+ SvXMLPropertySetContext::EndElement();
+}
+
+SvXMLImportContext *XMLShapePropertySetContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference< xml::sax::XAttributeList > & xAttrList,
+ ::std::vector< XMLPropertyState > &rProperties,
+ const XMLPropertyState& rProp )
+{
+ SvXMLImportContext *pContext = 0;
+
+ switch( mxMapper->getPropertySetMapper()->GetEntryContextId( rProp.mnIndex ) )
+ {
+ case CTF_NUMBERINGRULES:
+ mnBulletIndex = rProp.mnIndex;
+ mxBulletStyle = pContext = new SvxXMLListStyleContext( GetImport(), nPrefix, rLocalName, xAttrList );
+ break;
+ case CTF_TABSTOP:
+ pContext = new SvxXMLTabStopImportContext( GetImport(), nPrefix,
+ rLocalName, rProp,
+ rProperties );
+ break;
+ }
+
+ if( !pContext )
+ pContext = SvXMLPropertySetContext::CreateChildContext( nPrefix, rLocalName,
+ xAttrList,
+ rProperties, rProp );
+
+ return pContext;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/XMLShapeStyleContext.cxx b/xmloff/source/draw/XMLShapeStyleContext.cxx
new file mode 100644
index 000000000000..313691dd31f6
--- /dev/null
+++ b/xmloff/source/draw/XMLShapeStyleContext.cxx
@@ -0,0 +1,328 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <tools/debug.hxx>
+#include <xmloff/XMLShapeStyleContext.hxx>
+#include "XMLShapePropertySetContext.hxx"
+#include <xmloff/contextid.hxx>
+#include <com/sun/star/drawing/XControlShape.hpp>
+#include "com/sun/star/beans/XPropertySetInfo.hpp"
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmlnumi.hxx>
+#include <xmloff/xmlnmspe.hxx>
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlerror.hxx"
+#include <xmloff/maptype.hxx>
+
+#include "sdpropls.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using ::xmloff::token::IsXMLToken;
+using ::xmloff::token::XML_TEXT_PROPERTIES;
+using ::xmloff::token::XML_GRAPHIC_PROPERTIES;
+using ::xmloff::token::XML_PARAGRAPH_PROPERTIES;
+
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( XMLShapeStyleContext, XMLPropStyleContext );
+
+XMLShapeStyleContext::XMLShapeStyleContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList,
+ SvXMLStylesContext& rStyles,
+ sal_uInt16 nFamily)
+: XMLPropStyleContext(rImport, nPrfx, rLName, xAttrList, rStyles, nFamily ),
+ m_bIsNumRuleAlreadyConverted( sal_False )
+{
+}
+
+XMLShapeStyleContext::~XMLShapeStyleContext()
+{
+}
+
+void XMLShapeStyleContext::SetAttribute( sal_uInt16 nPrefixKey, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ if ((0 == m_sControlDataStyleName.getLength()) && (::xmloff::token::GetXMLToken(::xmloff::token::XML_DATA_STYLE_NAME) == rLocalName))
+ {
+ m_sControlDataStyleName = rValue;
+ }
+ else if( (XML_NAMESPACE_STYLE == nPrefixKey) && IsXMLToken( rLocalName, ::xmloff::token::XML_LIST_STYLE_NAME ) )
+ {
+ m_sListStyleName = rValue;
+ }
+ else
+ {
+ XMLPropStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
+
+ if( (XML_NAMESPACE_STYLE == nPrefixKey) &&
+ ( IsXMLToken( rLocalName, ::xmloff::token::XML_NAME ) || IsXMLToken( rLocalName, ::xmloff::token::XML_DISPLAY_NAME ) ) )
+ {
+ if( GetName().getLength() && GetDisplayName().getLength() && GetName() != GetDisplayName() )
+ {
+ const_cast< SvXMLImport&>( GetImport() ).
+ AddStyleDisplayName( GetFamily(), GetName(), GetDisplayName() );
+ }
+ }
+ }
+}
+
+SvXMLImportContext *XMLShapeStyleContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference< xml::sax::XAttributeList > & xAttrList )
+{
+ SvXMLImportContext *pContext = 0;
+
+ if( XML_NAMESPACE_STYLE == nPrefix )
+ {
+ sal_uInt32 nFamily = 0;
+ if( IsXMLToken( rLocalName, XML_TEXT_PROPERTIES ) )
+ nFamily = XML_TYPE_PROP_TEXT;
+ else if( IsXMLToken( rLocalName, XML_PARAGRAPH_PROPERTIES ) )
+ nFamily = XML_TYPE_PROP_PARAGRAPH;
+ else if( IsXMLToken( rLocalName, XML_GRAPHIC_PROPERTIES ) )
+ nFamily = XML_TYPE_PROP_GRAPHIC;
+ if( nFamily )
+ {
+ UniReference < SvXMLImportPropertyMapper > xImpPrMap =
+ GetStyles()->GetImportPropertyMapper( GetFamily() );
+ if( xImpPrMap.is() )
+ pContext = new XMLShapePropertySetContext( GetImport(), nPrefix,
+ rLocalName, xAttrList,
+ nFamily,
+ GetProperties(),
+ xImpPrMap );
+ }
+ }
+
+ if( !pContext )
+ pContext = XMLPropStyleContext::CreateChildContext( nPrefix, rLocalName,
+ xAttrList );
+
+ return pContext;
+}
+
+void XMLShapeStyleContext::FillPropertySet( const Reference< beans::XPropertySet > & rPropSet )
+{
+ if( !m_bIsNumRuleAlreadyConverted )
+ {
+ m_bIsNumRuleAlreadyConverted = sal_True;
+
+ // for compatibility to beta files, search for CTF_SD_NUMBERINGRULES_NAME to
+ // import numbering rules from the style:properties element
+ const UniReference< XMLPropertySetMapper >&rMapper = GetStyles()->GetImportPropertyMapper( GetFamily() )->getPropertySetMapper();
+
+ ::std::vector< XMLPropertyState > &rProperties = GetProperties();
+ ::std::vector< XMLPropertyState >::iterator end( rProperties.end() );
+ ::std::vector< XMLPropertyState >::iterator property;
+
+ // first, look for the old format, where we had a text:list-style-name
+ // attribute in the style:properties element
+ for( property = rProperties.begin(); property != end; property++ )
+ {
+ // find properties with context
+ if( (property->mnIndex != -1) && (rMapper->GetEntryContextId( property->mnIndex ) == CTF_SD_NUMBERINGRULES_NAME) )
+ break;
+ }
+
+ // if we did not find an old list-style-name in the properties, and we need one
+ // because we got a style:list-style attribute in the style-style element
+ // we generate one
+ if( (property == end) && ( 0 != m_sListStyleName.getLength() ) )
+ {
+ sal_Int32 nIndex = rMapper->FindEntryIndex( CTF_SD_NUMBERINGRULES_NAME );
+ DBG_ASSERT( -1 != nIndex, "can't find numbering rules property entry, can't set numbering rule!" );
+
+ XMLPropertyState aNewState( nIndex );
+ rProperties.push_back( aNewState );
+ end = rProperties.end();
+ property = end - 1;
+ }
+
+ // so, if we have an old or a new list style name, we set its value to
+ // a numbering rule
+ if( property != end )
+ {
+ if( 0 == m_sListStyleName.getLength() )
+ {
+ property->maValue >>= m_sListStyleName;
+ }
+
+ const SvxXMLListStyleContext *pListStyle = GetImport().GetTextImport()->FindAutoListStyle( m_sListStyleName );
+
+ DBG_ASSERT( pListStyle, "list-style not found for shape style" );
+ if( pListStyle )
+ {
+ uno::Reference< container::XIndexReplace > xNumRule( pListStyle->CreateNumRule( GetImport().GetModel() ) );
+ pListStyle->FillUnoNumRule(xNumRule, NULL /* const SvI18NMap * ??? */ );
+ property->maValue <<= xNumRule;
+ }
+ else
+ {
+ property->mnIndex = -1;
+ }
+ }
+ }
+
+ struct _ContextID_Index_Pair aContextIDs[] =
+ {
+ { CTF_DASHNAME , -1 },
+ { CTF_LINESTARTNAME , -1 },
+ { CTF_LINEENDNAME , -1 },
+ { CTF_FILLGRADIENTNAME, -1 },
+ { CTF_FILLTRANSNAME , -1 },
+ { CTF_FILLHATCHNAME , -1 },
+ { CTF_FILLBITMAPNAME , -1 },
+ { CTF_SD_OLE_VIS_AREA_IMPORT_LEFT, -1 },
+ { CTF_SD_OLE_VIS_AREA_IMPORT_TOP, -1 },
+ { CTF_SD_OLE_VIS_AREA_IMPORT_WIDTH, -1 },
+ { CTF_SD_OLE_VIS_AREA_IMPORT_HEIGHT, -1 },
+ { -1, -1 }
+ };
+ static sal_uInt16 aFamilies[] =
+ {
+ XML_STYLE_FAMILY_SD_STROKE_DASH_ID,
+ XML_STYLE_FAMILY_SD_MARKER_ID,
+ XML_STYLE_FAMILY_SD_MARKER_ID,
+ XML_STYLE_FAMILY_SD_GRADIENT_ID,
+ XML_STYLE_FAMILY_SD_GRADIENT_ID,
+ XML_STYLE_FAMILY_SD_HATCH_ID,
+ XML_STYLE_FAMILY_SD_FILL_IMAGE_ID
+ };
+
+ UniReference < SvXMLImportPropertyMapper > xImpPrMap =
+ GetStyles()->GetImportPropertyMapper( GetFamily() );
+ DBG_ASSERT( xImpPrMap.is(), "There is the import prop mapper" );
+ if( xImpPrMap.is() )
+ xImpPrMap->FillPropertySet( GetProperties(), rPropSet, aContextIDs );
+
+ Reference< XPropertySetInfo > xInfo;
+ // get property set mapper
+ UniReference<XMLPropertySetMapper> xPropMapper( xImpPrMap->getPropertySetMapper() );
+
+ for( sal_uInt16 i=0; aContextIDs[i].nContextID != -1; i++ )
+ {
+ sal_Int32 nIndex = aContextIDs[i].nIndex;
+ if( nIndex != -1 ) switch( aContextIDs[i].nContextID )
+ {
+ case CTF_DASHNAME:
+ case CTF_LINESTARTNAME:
+ case CTF_LINEENDNAME:
+ case CTF_FILLGRADIENTNAME:
+ case CTF_FILLTRANSNAME:
+ case CTF_FILLHATCHNAME:
+ case CTF_FILLBITMAPNAME:
+ {
+ struct XMLPropertyState& rState = GetProperties()[nIndex];
+ OUString sStyleName;
+ rState.maValue >>= sStyleName;
+ sStyleName = GetImport().GetStyleDisplayName( aFamilies[i], sStyleName );
+ try
+ {
+
+ // set property
+ const OUString& rPropertyName = xPropMapper->GetEntryAPIName(rState.mnIndex);
+ if( !xInfo.is() )
+ xInfo = rPropSet->getPropertySetInfo();
+ if ( xInfo->hasPropertyByName( rPropertyName ) )
+ {
+ rPropSet->setPropertyValue( rPropertyName, Any( sStyleName ) );
+ }
+ }
+ catch ( ::com::sun::star::lang::IllegalArgumentException& e )
+ {
+ Sequence<OUString> aSeq(1);
+ aSeq[0] = sStyleName;
+ GetImport().SetError(
+ XMLERROR_STYLE_PROP_VALUE | XMLERROR_FLAG_WARNING,
+ aSeq, e.Message, NULL );
+ }
+ break;
+ }
+ case CTF_SD_OLE_VIS_AREA_IMPORT_LEFT:
+ case CTF_SD_OLE_VIS_AREA_IMPORT_TOP:
+ case CTF_SD_OLE_VIS_AREA_IMPORT_WIDTH:
+ case CTF_SD_OLE_VIS_AREA_IMPORT_HEIGHT:
+ {
+ struct XMLPropertyState& rState = GetProperties()[nIndex];
+ const OUString& rPropertyName = xPropMapper->GetEntryAPIName(rState.mnIndex);
+ try
+ {
+ if( !xInfo.is() )
+ xInfo = rPropSet->getPropertySetInfo();
+ if ( xInfo->hasPropertyByName( rPropertyName ) )
+ {
+ rPropSet->setPropertyValue( rPropertyName, rState.maValue );
+ }
+ }
+ catch ( ::com::sun::star::lang::IllegalArgumentException& e )
+ {
+ Sequence<OUString> aSeq;
+ GetImport().SetError(
+ XMLERROR_STYLE_PROP_VALUE | XMLERROR_FLAG_WARNING,
+ aSeq, e.Message, NULL );
+ }
+ break;
+ }
+ }
+ }
+
+ if (m_sControlDataStyleName.getLength())
+ { // we had a data-style-name attribute
+
+ // set the formatting on the control model of the control shape
+ uno::Reference< drawing::XControlShape > xControlShape(rPropSet, uno::UNO_QUERY);
+ DBG_ASSERT(xControlShape.is(), "XMLShapeStyleContext::FillPropertySet: data style for a non-control shape!");
+ if (xControlShape.is())
+ {
+ uno::Reference< beans::XPropertySet > xControlModel(xControlShape->getControl(), uno::UNO_QUERY);
+ DBG_ASSERT(xControlModel.is(), "XMLShapeStyleContext::FillPropertySet: no control model for the shape!");
+ if (xControlModel.is())
+ {
+ GetImport().GetFormImport()->applyControlNumberStyle(xControlModel, m_sControlDataStyleName);
+ }
+ }
+ }
+}
+
+void XMLShapeStyleContext::Finish( sal_Bool /*bOverwrite*/ )
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/animationexport.cxx b/xmloff/source/draw/animationexport.cxx
new file mode 100644
index 000000000000..eeeead7374af
--- /dev/null
+++ b/xmloff/source/draw/animationexport.cxx
@@ -0,0 +1,1739 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <com/sun/star/animations/XAnimateColor.hpp>
+#include <com/sun/star/animations/XAnimateSet.hpp>
+#include <com/sun/star/animations/XCommand.hpp>
+#include <com/sun/star/animations/Timing.hpp>
+#include <com/sun/star/animations/Event.hpp>
+#include <com/sun/star/animations/XAnimateMotion.hpp>
+#include <com/sun/star/animations/XAnimateTransform.hpp>
+#include <com/sun/star/animations/XTransitionFilter.hpp>
+#include <com/sun/star/animations/XIterateContainer.hpp>
+#include <com/sun/star/animations/XAudio.hpp>
+#include <com/sun/star/animations/AnimationColorSpace.hpp>
+#include <com/sun/star/animations/AnimationNodeType.hpp>
+#include <com/sun/star/animations/AnimationRestart.hpp>
+#include <com/sun/star/animations/EventTrigger.hpp>
+#include <com/sun/star/animations/AnimationFill.hpp>
+#include <com/sun/star/animations/AnimationEndSync.hpp>
+#include <com/sun/star/animations/AnimationNodeType.hpp>
+#include <com/sun/star/animations/AnimationCalcMode.hpp>
+#include <com/sun/star/animations/AnimationAdditiveMode.hpp>
+#include <com/sun/star/animations/AnimationTransformType.hpp>
+#include <com/sun/star/animations/TransitionType.hpp>
+#include <com/sun/star/animations/TransitionSubType.hpp>
+#include <com/sun/star/animations/ValuePair.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/presentation/EffectNodeType.hpp>
+#include <com/sun/star/presentation/EffectPresetClass.hpp>
+#include <com/sun/star/presentation/ParagraphTarget.hpp>
+#include <com/sun/star/presentation/TextAnimationType.hpp>
+#include <com/sun/star/presentation/ShapeAnimationSubType.hpp>
+#include <com/sun/star/presentation/EffectCommands.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+
+#include <tools/debug.hxx>
+#include <tools/time.hxx>
+#include "unointerfacetouniqueidentifiermapper.hxx"
+#include "sdxmlexp_impl.hxx"
+#include "sdpropls.hxx"
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmlement.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/shapeexport.hxx>
+
+#include "animations.hxx"
+#include "animationexport.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::std;
+using namespace ::cppu;
+using namespace ::com::sun::star::animations;
+using namespace ::com::sun::star::presentation;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::beans;
+using namespace ::xmloff::token;
+
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::UNO_QUERY_THROW;
+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::beans::NamedValue;
+using ::com::sun::star::container::XEnumerationAccess;
+using ::com::sun::star::container::XEnumeration;
+
+namespace xmloff
+{
+
+SvXMLEnumMapEntry* getAnimationsEnumMap( sal_uInt16 nMap )
+{
+ switch( nMap )
+ {
+ case Animations_EnumMap_Fill:
+ {
+ static SvXMLEnumMapEntry aAnimations_EnumMap_Fill[] =
+ {
+ { XML_DEFAULT, AnimationFill::DEFAULT },
+ { XML_REMOVE, AnimationFill::REMOVE },
+ { XML_FREEZE, AnimationFill::FREEZE },
+ { XML_HOLD, AnimationFill::HOLD },
+ { XML_TRANSITION, AnimationFill::TRANSITION },
+ { XML_AUTO, AnimationFill::AUTO },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ return aAnimations_EnumMap_Fill;
+ }
+ case Animations_EnumMap_FillDefault:
+ {
+ static SvXMLEnumMapEntry aAnimations_EnumMap_Fill[] =
+ {
+ { XML_INHERIT, AnimationFill::INHERIT },
+ { XML_REMOVE, AnimationFill::REMOVE },
+ { XML_FREEZE, AnimationFill::FREEZE },
+ { XML_HOLD, AnimationFill::HOLD },
+ { XML_TRANSITION, AnimationFill::TRANSITION },
+ { XML_AUTO, AnimationFill::AUTO },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ return aAnimations_EnumMap_Fill;
+ }
+ case Animations_EnumMap_Restart:
+ {
+ static SvXMLEnumMapEntry aAnimations_EnumMap_Restart[] =
+ {
+ { XML_DEFAULT, AnimationRestart::DEFAULT },
+ { XML_ALWAYS, AnimationRestart::ALWAYS },
+ { XML_WHENNOTACTIVE,AnimationRestart::WHEN_NOT_ACTIVE },
+ { XML_NEVER, AnimationRestart::NEVER },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ return aAnimations_EnumMap_Restart;
+ }
+ case Animations_EnumMap_RestartDefault:
+ {
+ static SvXMLEnumMapEntry aAnimations_EnumMap_RestartDefault[] =
+ {
+ { XML_INHERIT, AnimationRestart::INHERIT },
+ { XML_ALWAYS, AnimationRestart::ALWAYS },
+ { XML_WHENNOTACTIVE,AnimationRestart::WHEN_NOT_ACTIVE },
+ { XML_NEVER, AnimationRestart::NEVER },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ return aAnimations_EnumMap_RestartDefault;
+ }
+ case Animations_EnumMap_Endsync:
+ {
+ static SvXMLEnumMapEntry aAnimations_EnumMap_Endsync[] =
+ {
+ { XML_FIRST, AnimationEndSync::FIRST },
+ { XML_LAST, AnimationEndSync::LAST },
+ { XML_ALL, AnimationEndSync::ALL },
+ { XML_MEDIA, AnimationEndSync::MEDIA },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ return aAnimations_EnumMap_Endsync;
+ }
+ case Animations_EnumMap_CalcMode:
+ {
+ static SvXMLEnumMapEntry aAnimations_EnumMap_CalcMode[] =
+ {
+ { XML_DISCRETE, AnimationCalcMode::DISCRETE },
+ { XML_LINEAR, AnimationCalcMode::LINEAR },
+ { XML_PACED, AnimationCalcMode::PACED },
+ { XML_SPLINE, AnimationCalcMode::SPLINE },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ return aAnimations_EnumMap_CalcMode;
+ }
+ case Animations_EnumMap_AdditiveMode:
+ {
+ static SvXMLEnumMapEntry aAnimations_EnumMap_AdditiveMode[] =
+ {
+ { XML_BASE, AnimationAdditiveMode::BASE },
+ { XML_SUM, AnimationAdditiveMode::SUM },
+ { XML_REPLACE, AnimationAdditiveMode::REPLACE },
+ { XML_MULTIPLY, AnimationAdditiveMode::MULTIPLY },
+ { XML_NONE, AnimationAdditiveMode::NONE },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ return aAnimations_EnumMap_AdditiveMode;
+ }
+ case Animations_EnumMap_TransformType:
+ {
+ static SvXMLEnumMapEntry aAnimations_EnumMap_TransformType[] =
+ {
+ { XML_TRANSLATE, AnimationTransformType::TRANSLATE },
+ { XML_SCALE, AnimationTransformType::SCALE },
+ { XML_ROTATE, AnimationTransformType::ROTATE },
+ { XML_SKEWX, AnimationTransformType::SKEWX },
+ { XML_SKEWY, AnimationTransformType::SKEWY },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ return aAnimations_EnumMap_TransformType;
+ }
+ case Animations_EnumMap_TransitionType:
+ {
+ static SvXMLEnumMapEntry aAnimations_EnumMap_TransitionType[] =
+ {
+ { XML_BARWIPE, TransitionType::BARWIPE },
+ { XML_BOXWIPE, TransitionType::BOXWIPE },
+ { XML_FOURBOXWIPE, TransitionType::FOURBOXWIPE },
+ { XML_BARNDOORWIPE, TransitionType::BARNDOORWIPE },
+ { XML_DIAGONALWIPE, TransitionType::DIAGONALWIPE },
+ { XML_BOWTIEWIPE, TransitionType::BOWTIEWIPE },
+ { XML_MISCDIAGONALWIPE, TransitionType::MISCDIAGONALWIPE },
+ { XML_VEEWIPE, TransitionType::VEEWIPE },
+ { XML_BARNVEEWIPE, TransitionType::BARNVEEWIPE },
+ { XML_ZIGZAGWIPE, TransitionType::ZIGZAGWIPE },
+ { XML_BARNZIGZAGWIPE, TransitionType::BARNZIGZAGWIPE },
+ { XML_IRISWIPE, TransitionType::IRISWIPE },
+ { XML_TRIANGLEWIPE, TransitionType::TRIANGLEWIPE },
+ { XML_ARROWHEADWIPE, TransitionType::ARROWHEADWIPE },
+ { XML_PENTAGONWIPE, TransitionType::PENTAGONWIPE },
+ { XML_HEXAGONWIPE, TransitionType::HEXAGONWIPE },
+ { XML_ELLIPSEWIPE, TransitionType::ELLIPSEWIPE },
+ { XML_EYEWIPE, TransitionType::EYEWIPE },
+ { XML_ROUNDRECTWIPE, TransitionType::ROUNDRECTWIPE },
+ { XML_STARWIPE, TransitionType::STARWIPE },
+ { XML_MISCSHAPEWIPE, TransitionType::MISCSHAPEWIPE },
+ { XML_CLOCKWIPE, TransitionType::CLOCKWIPE },
+ { XML_PINWHEELWIPE, TransitionType::PINWHEELWIPE },
+ { XML_SINGLESWEEPWIPE, TransitionType::SINGLESWEEPWIPE },
+ { XML_FANWIPE, TransitionType::FANWIPE },
+ { XML_DOUBLEFANWIPE, TransitionType::DOUBLEFANWIPE },
+ { XML_DOUBLESWEEPWIPE, TransitionType::DOUBLESWEEPWIPE },
+ { XML_SALOONDOORWIPE, TransitionType::SALOONDOORWIPE },
+ { XML_WINDSHIELDWIPE, TransitionType::WINDSHIELDWIPE },
+ { XML_SNAKEWIPE, TransitionType::SNAKEWIPE },
+ { XML_SPIRALWIPE, TransitionType::SPIRALWIPE },
+ { XML_PARALLELSNAKESWIPE,TransitionType::PARALLELSNAKESWIPE },
+ { XML_BOXSNAKESWIPE, TransitionType::BOXSNAKESWIPE },
+ { XML_WATERFALLWIPE, TransitionType::WATERFALLWIPE },
+ { XML_PUSHWIPE, TransitionType::PUSHWIPE },
+ { XML_SLIDEWIPE, TransitionType::SLIDEWIPE },
+ { XML_FADE, TransitionType::FADE },
+ { XML_RANDOMBARWIPE, TransitionType::RANDOMBARWIPE },
+ { XML_CHECKERBOARDWIPE, TransitionType::CHECKERBOARDWIPE },
+ { XML_DISSOLVE, TransitionType::DISSOLVE },
+ { XML_BLINDSWIPE, TransitionType::BLINDSWIPE },
+ { XML_RANDOM, TransitionType::RANDOM },
+ { XML_ZOOM, TransitionType::ZOOM },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ return aAnimations_EnumMap_TransitionType;
+ }
+ case Animations_EnumMap_TransitionSubType:
+ {
+ static SvXMLEnumMapEntry aAnimations_EnumMap_TransitionSubType[] =
+ {
+ { XML_DEFAULT, TransitionSubType::DEFAULT },
+ { XML_LEFTTORIGHT, TransitionSubType::LEFTTORIGHT },
+ { XML_TOPTOBOTTOM, TransitionSubType::TOPTOBOTTOM },
+ { XML_TOPLEFT, TransitionSubType::TOPLEFT },
+ { XML_TOPRIGHT, TransitionSubType::TOPRIGHT },
+ { XML_BOTTOMRIGHT, TransitionSubType::BOTTOMRIGHT },
+ { XML_BOTTOMLEFT, TransitionSubType::BOTTOMLEFT },
+ { XML_TOPCENTER, TransitionSubType::TOPCENTER },
+ { XML_RIGHTCENTER, TransitionSubType::RIGHTCENTER },
+ { XML_BOTTOMCENTER, TransitionSubType::BOTTOMCENTER },
+ { XML_LEFTCENTER, TransitionSubType::LEFTCENTER },
+ { XML_CORNERSIN, TransitionSubType::CORNERSIN },
+ { XML_CORNERSOUT, TransitionSubType::CORNERSOUT },
+ { XML_VERTICAL, TransitionSubType::VERTICAL },
+ { XML_HORIZONTAL, TransitionSubType::HORIZONTAL },
+ { XML_DIAGONALBOTTOMLEFT, TransitionSubType::DIAGONALBOTTOMLEFT },
+ { XML_DIAGONALTOPLEFT, TransitionSubType::DIAGONALTOPLEFT },
+ { XML_DOUBLEBARNDOOR, TransitionSubType::DOUBLEBARNDOOR },
+ { XML_DOUBLEDIAMOND, TransitionSubType::DOUBLEDIAMOND },
+ { XML_DOWN, TransitionSubType::DOWN },
+ { XML_LEFT, TransitionSubType::LEFT },
+ { XML_UP, TransitionSubType::UP },
+ { XML_RIGHT, TransitionSubType::RIGHT },
+ { XML_RECTANGLE, TransitionSubType::RECTANGLE },
+ { XML_DIAMOND, TransitionSubType::DIAMOND },
+ { XML_CIRCLE, TransitionSubType::CIRCLE },
+ { XML_FOURPOINT, TransitionSubType::FOURPOINT },
+ { XML_FIVEPOINT, TransitionSubType::FIVEPOINT },
+ { XML_SIXPOINT, TransitionSubType::SIXPOINT },
+ { XML_HEART, TransitionSubType::HEART },
+ { XML_KEYHOLE, TransitionSubType::KEYHOLE },
+ { XML_CLOCKWISETWELVE, TransitionSubType::CLOCKWISETWELVE },
+ { XML_CLOCKWISETHREE, TransitionSubType::CLOCKWISETHREE },
+ { XML_CLOCKWISESIX, TransitionSubType::CLOCKWISESIX },
+ { XML_CLOCKWISENINE, TransitionSubType::CLOCKWISENINE },
+ { XML_TWOBLADEVERTICAL, TransitionSubType::TWOBLADEVERTICAL },
+ { XML_TWOBLADEHORIZONTAL, TransitionSubType::TWOBLADEHORIZONTAL },
+ { XML_FOURBLADE, TransitionSubType::FOURBLADE },
+ { XML_CLOCKWISETOP, TransitionSubType::CLOCKWISETOP },
+ { XML_CLOCKWISERIGHT, TransitionSubType::CLOCKWISERIGHT },
+ { XML_CLOCKWISEBOTTOM, TransitionSubType::CLOCKWISEBOTTOM },
+ { XML_CLOCKWISELEFT, TransitionSubType::CLOCKWISELEFT },
+ { XML_CLOCKWISETOPLEFT, TransitionSubType::CLOCKWISETOPLEFT },
+ { XML_COUNTERCLOCKWISEBOTTOMLEFT,TransitionSubType::COUNTERCLOCKWISEBOTTOMLEFT },
+ { XML_CLOCKWISEBOTTOMRIGHT, TransitionSubType::CLOCKWISEBOTTOMRIGHT },
+ { XML_COUNTERCLOCKWISETOPRIGHT,TransitionSubType::COUNTERCLOCKWISETOPRIGHT },
+ { XML_CENTERTOP, TransitionSubType::CENTERTOP },
+ { XML_CENTERRIGHT, TransitionSubType::CENTERRIGHT },
+ { XML_TOP, TransitionSubType::TOP },
+ { XML_BOTTOM, TransitionSubType::BOTTOM },
+ { XML_FANOUTVERTICAL, TransitionSubType::FANOUTVERTICAL },
+ { XML_FANOUTHORIZONTAL, TransitionSubType::FANOUTHORIZONTAL },
+ { XML_FANINVERTICAL, TransitionSubType::FANINVERTICAL },
+ { XML_FANINHORIZONTAL, TransitionSubType::FANINHORIZONTAL },
+ { XML_PARALLELVERTICAL, TransitionSubType::PARALLELVERTICAL },
+ { XML_PARALLELDIAGONAL, TransitionSubType::PARALLELDIAGONAL },
+ { XML_OPPOSITEVERTICAL, TransitionSubType::OPPOSITEVERTICAL },
+ { XML_OPPOSITEHORIZONTAL, TransitionSubType::OPPOSITEHORIZONTAL },
+ { XML_PARALLELDIAGONALTOPLEFT,TransitionSubType::PARALLELDIAGONALTOPLEFT },
+ { XML_PARALLELDIAGONALBOTTOMLEFT,TransitionSubType::PARALLELDIAGONALBOTTOMLEFT },
+ { XML_TOPLEFTHORIZONTAL, TransitionSubType::TOPLEFTHORIZONTAL },
+ { XML_TOPLEFTDIAGONAL, TransitionSubType::TOPLEFTDIAGONAL },
+ { XML_TOPRIGHTDIAGONAL, TransitionSubType::TOPRIGHTDIAGONAL },
+ { XML_BOTTOMRIGHTDIAGONAL, TransitionSubType::BOTTOMRIGHTDIAGONAL },
+ { XML_BOTTOMLEFTDIAGONAL, TransitionSubType::BOTTOMLEFTDIAGONAL },
+ { XML_TOPLEFTCLOCKWISE, TransitionSubType::TOPLEFTCLOCKWISE },
+ { XML_TOPRIGHTCLOCKWISE, TransitionSubType::TOPRIGHTCLOCKWISE },
+ { XML_BOTTOMRIGHTCLOCKWISE, TransitionSubType::BOTTOMRIGHTCLOCKWISE },
+ { XML_BOTTOMLEFTCLOCKWISE, TransitionSubType::BOTTOMLEFTCLOCKWISE },
+ { XML_TOPLEFTCOUNTERCLOCKWISE,TransitionSubType::TOPLEFTCOUNTERCLOCKWISE },
+ { XML_TOPRIGHTCOUNTERCLOCKWISE,TransitionSubType::TOPRIGHTCOUNTERCLOCKWISE },
+ { XML_BOTTOMRIGHTCOUNTERCLOCKWISE,TransitionSubType::BOTTOMRIGHTCOUNTERCLOCKWISE },
+ { XML_BOTTOMLEFTCOUNTERCLOCKWISE,TransitionSubType::BOTTOMLEFTCOUNTERCLOCKWISE },
+ { XML_VERTICALTOPSAME, TransitionSubType::VERTICALTOPSAME },
+ { XML_VERTICALBOTTOMSAME, TransitionSubType::VERTICALBOTTOMSAME },
+ { XML_VERTICALTOPLEFTOPPOSITE,TransitionSubType::VERTICALTOPLEFTOPPOSITE },
+ { XML_VERTICALBOTTOMLEFTOPPOSITE,TransitionSubType::VERTICALBOTTOMLEFTOPPOSITE },
+ { XML_HORIZONTALLEFTSAME, TransitionSubType::HORIZONTALLEFTSAME },
+ { XML_HORIZONTALRIGHTSAME, TransitionSubType::HORIZONTALRIGHTSAME },
+ { XML_HORIZONTALTOPLEFTOPPOSITE,TransitionSubType::HORIZONTALTOPLEFTOPPOSITE },
+ { XML_HORIZONTALTOPRIGHTOPPOSITE,TransitionSubType::HORIZONTALTOPRIGHTOPPOSITE },
+ { XML_DIAGONALBOTTOMLEFTOPPOSITE,TransitionSubType::DIAGONALBOTTOMLEFTOPPOSITE },
+ { XML_DIAGONALTOPLEFTOPPOSITE,TransitionSubType::DIAGONALTOPLEFTOPPOSITE },
+ { XML_TWOBOXTOP, TransitionSubType::TWOBOXTOP },
+ { XML_TWOBOXBOTTOM, TransitionSubType::TWOBOXBOTTOM },
+ { XML_TWOBOXLEFT, TransitionSubType::TWOBOXLEFT },
+ { XML_TWOBOXRIGHT, TransitionSubType::TWOBOXRIGHT },
+ { XML_FOURBOXVERTICAL, TransitionSubType::FOURBOXVERTICAL },
+ { XML_FOURBOXHORIZONTAL, TransitionSubType::FOURBOXHORIZONTAL },
+ { XML_VERTICALLEFT, TransitionSubType::VERTICALLEFT },
+ { XML_VERTICALRIGHT, TransitionSubType::VERTICALRIGHT },
+ { XML_HORIZONTALLEFT, TransitionSubType::HORIZONTALLEFT },
+ { XML_HORIZONTALRIGHT, TransitionSubType::HORIZONTALRIGHT },
+ { XML_FROMLEFT, TransitionSubType::FROMLEFT },
+ { XML_FROMTOP, TransitionSubType::FROMTOP },
+ { XML_FROMRIGHT, TransitionSubType::FROMRIGHT },
+ { XML_FROMBOTTOM, TransitionSubType::FROMBOTTOM },
+ { XML_CROSSFADE, TransitionSubType::CROSSFADE },
+ { XML_FADETOCOLOR, TransitionSubType::FADETOCOLOR },
+ { XML_FADEFROMCOLOR, TransitionSubType::FADEFROMCOLOR },
+ { XML_FADEOVERCOLOR, TransitionSubType::FADEOVERCOLOR },
+ { XML_THREEBLADE, TransitionSubType::THREEBLADE },
+ { XML_EIGHTBLADE, TransitionSubType::EIGHTBLADE },
+ { XML_ONEBLADE, TransitionSubType::ONEBLADE },
+ { XML_ACROSS, TransitionSubType::ACROSS },
+ { XML_TOPLEFTVERTICAL, TransitionSubType::TOPLEFTVERTICAL },
+ { XML_COMBHORIZONTAL, TransitionSubType::COMBHORIZONTAL },
+ { XML_COMBVERTICAL, TransitionSubType::COMBVERTICAL },
+ { XML_IN, TransitionSubType::IN },
+ { XML_OUT, TransitionSubType::OUT },
+ { XML_ROTATEIN, TransitionSubType::ROTATEIN },
+ { XML_ROTATEOUT, TransitionSubType::ROTATEOUT },
+ { XML_FROMTOPLEFT, TransitionSubType::FROMTOPLEFT },
+ { XML_FROMTOPRIGHT, TransitionSubType::FROMTOPRIGHT },
+ { XML_FROMBOTTOMLEFT, TransitionSubType::FROMBOTTOMLEFT },
+ { XML_FROMBOTTOMRIGHT, TransitionSubType::FROMBOTTOMRIGHT },
+
+ { XML_TOKEN_INVALID, 0 }
+ };
+ return aAnimations_EnumMap_TransitionSubType;
+ }
+ case Animations_EnumMap_EventTrigger:
+ {
+ static SvXMLEnumMapEntry aAnimations_EnumMap_EventTrigger[] =
+ {
+ { XML_ONBEGIN, EventTrigger::ON_BEGIN },
+ { XML_ONEND, EventTrigger::ON_END },
+ { XML_BEGIN, EventTrigger::BEGIN_EVENT },
+ { XML_END, EventTrigger::END_EVENT },
+ { XML_CLICK, EventTrigger::ON_CLICK },
+ { XML_DOUBLECLICK, EventTrigger::ON_DBL_CLICK },
+ { XML_MOUSEOVER, EventTrigger::ON_MOUSE_ENTER },
+ { XML_MOUSEOUT, EventTrigger::ON_MOUSE_LEAVE },
+ { XML_NEXT, EventTrigger::ON_NEXT },
+ { XML_PREVIOUS, EventTrigger::ON_PREV },
+ { XML_STOP_AUDIO, EventTrigger::ON_STOP_AUDIO },
+ { XML_REPEAT, EventTrigger::REPEAT },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ return aAnimations_EnumMap_EventTrigger;
+ }
+
+ case Animations_EnumMap_EffectPresetClass:
+ {
+ static SvXMLEnumMapEntry aAnimations_EnumMap_EffectPresetClass[] =
+ {
+ { XML_CUSTOM, EffectPresetClass::CUSTOM },
+ { XML_ENTRANCE, EffectPresetClass::ENTRANCE },
+ { XML_EXIT, EffectPresetClass::EXIT },
+ { XML_EMPHASIS, EffectPresetClass::EMPHASIS },
+ { XML_MOTION_PATH, EffectPresetClass::MOTIONPATH },
+ { XML_OLE_ACTION, EffectPresetClass::OLEACTION },
+ { XML_MEDIA_CALL, EffectPresetClass::MEDIACALL },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ return aAnimations_EnumMap_EffectPresetClass;
+ }
+
+ case Animations_EnumMap_EffectNodeType:
+ {
+ static SvXMLEnumMapEntry aAnimations_EnumMap_EffectNodeType[] =
+ {
+ { XML_DEFAULT, EffectNodeType::DEFAULT },
+ { XML_ON_CLICK, EffectNodeType::ON_CLICK },
+ { XML_WITH_PREVIOUS, EffectNodeType::WITH_PREVIOUS },
+ { XML_AFTER_PREVIOUS, EffectNodeType::AFTER_PREVIOUS },
+ { XML_MAIN_SEQUENCE, EffectNodeType::MAIN_SEQUENCE },
+ { XML_TIMING_ROOT, EffectNodeType::TIMING_ROOT },
+ { XML_INTERACTIVE_SEQUENCE, EffectNodeType::INTERACTIVE_SEQUENCE },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ return aAnimations_EnumMap_EffectNodeType;
+ }
+ case Animations_EnumMap_SubItem:
+ {
+ static SvXMLEnumMapEntry aAnimations_EnumMap_SubItem[] =
+ {
+ { XML_WHOLE, ShapeAnimationSubType::AS_WHOLE },
+ { XML_BACKGROUND, ShapeAnimationSubType::ONLY_BACKGROUND },
+ { XML_TEXT, ShapeAnimationSubType::ONLY_TEXT },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ return aAnimations_EnumMap_SubItem;
+ }
+ case Animations_EnumMap_IterateType:
+ {
+ static SvXMLEnumMapEntry aAnimations_EnumMap_IterateType[] =
+ {
+ { XML_BY_PARAGRAPH, TextAnimationType::BY_PARAGRAPH },
+ { XML_BY_WORD, TextAnimationType::BY_WORD },
+ { XML_BY_LETTER, TextAnimationType::BY_LETTER },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ return aAnimations_EnumMap_IterateType;
+ }
+ case Animations_EnumMap_Command:
+ {
+ static SvXMLEnumMapEntry aAnimations_EnumMap_Command[] =
+ {
+ { XML_CUSTOM, EffectCommands::CUSTOM },
+ { XML_VERB, EffectCommands::VERB },
+ { XML_PLAY, EffectCommands::PLAY },
+ { XML_TOGGLE_PAUSE, EffectCommands::TOGGLEPAUSE },
+ { XML_STOP, EffectCommands::STOP },
+ { XML_STOP_AUDIO, EffectCommands::STOPAUDIO },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ return aAnimations_EnumMap_Command;
+ }
+ }
+
+ OSL_FAIL( "xmloff::getAnimationsEnumMap(), invalid map!" );
+ return NULL;
+}
+
+struct ImplAttributeNameConversion* getAnimationAttributeNamesConversionList()
+{
+ static struct ImplAttributeNameConversion gImplConversionList[] =
+ {
+ { XML_X, "X" },
+ { XML_Y, "Y" },
+ { XML_WIDTH, "Width" },
+ { XML_HEIGHT, "Height" },
+ { XML_ROTATE, "Rotate" },
+ { XML_SKEWX, "SkewX" },
+ { XML_FILL_COLOR, "FillColor" },
+ { XML_FILL, "FillStyle" },
+ { XML_STROKE_COLOR, "LineColor" },
+ { XML_STROKE, "LineStyle" },
+ { XML_COLOR, "CharColor" },
+ { XML_TEXT_ROTATION_ANGLE, "CharRotation" },
+ { XML_FONT_WEIGHT, "CharWeight" },
+ { XML_TEXT_UNDERLINE, "CharUnderline" },
+ { XML_FONT_FAMILY, "CharFontName" },
+ { XML_FONT_SIZE, "CharHeight" },
+ { XML_FONT_STYLE, "CharPosture" },
+ { XML_VISIBILITY, "Visibility" },
+ { XML_OPACITY, "Opacity" },
+ { XML_DIM, "DimColor" },
+ { XML_TOKEN_INVALID, NULL }
+ };
+
+ return gImplConversionList;
+}
+
+
+class AnimationsExporterImpl
+{
+public:
+ AnimationsExporterImpl( SvXMLExport& rExport, const Reference< XPropertySet >& xPageProps );
+
+ void prepareNode( const Reference< XAnimationNode >& xNode );
+ void exportNode( const Reference< XAnimationNode >& xNode );
+
+ void exportContainer( const Reference< XTimeContainer >& xNode, sal_Int16 nContainerNodeType );
+ void exportAnimate( const Reference< XAnimate >& xNode );
+ void exportAudio( const Reference< XAudio >& xAudio );
+ void exportCommand( const Reference< XCommand >& xCommand );
+
+ Reference< XInterface > getParagraphTarget( const ParagraphTarget* pTarget ) const;
+
+ void convertPath( OUStringBuffer& sTmp, const Any& rPath ) const;
+ void convertValue( XMLTokenEnum eAttributeName, OUStringBuffer& sTmp, const Any& rValue ) const;
+ void convertTiming( OUStringBuffer& sTmp, const Any& rTiming ) const;
+ void convertSource( OUStringBuffer& sTmp, const Any& rSource ) const;
+ void convertTarget( OUStringBuffer& sTmp, const Any& rTarget ) const;
+
+ void prepareValue( const Any& rValue );
+
+ void exportTransitionNode();
+ void prepareTransitionNode();
+
+ bool mbHasTransition;
+private:
+ SvXMLExport& mrExport;
+ Reference< XInterface > mxExport;
+ Reference< XPropertySet > mxPageProps;
+};
+
+AnimationsExporterImpl::AnimationsExporterImpl( SvXMLExport& rExport, const Reference< XPropertySet >& xPageProps )
+: mbHasTransition(false)
+, mrExport( rExport )
+, mxPageProps( xPageProps )
+{
+ try
+ {
+ mxExport = static_cast< ::com::sun::star::document::XFilter *>(&rExport);
+ }
+ catch( RuntimeException& )
+ {
+ OSL_FAIL( "xmloff::AnimationsExporterImpl::AnimationsExporterImpl(), RuntimeException catched!" );
+ }
+}
+
+void AnimationsExporterImpl::exportTransitionNode()
+{
+ if( mbHasTransition && mxPageProps.is() )
+ {
+ sal_Int16 nTransition = 0;
+ mxPageProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TransitionType" ) ) ) >>= nTransition;
+
+ Any aSound( mxPageProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Sound" ) ) ) );
+ OUString sSoundURL;
+ aSound >>= sSoundURL;
+ sal_Bool bStopSound = sal_False;
+ if( !(aSound >>= bStopSound) )
+ bStopSound = sal_False;
+
+
+ OUStringBuffer sTmp;
+ if( (nTransition != 0) || (sSoundURL.getLength() != 0) || bStopSound )
+ {
+ Reference< XInterface > xSource( mxPageProps.get() );
+ Event aEvent;
+ aEvent.Source <<= xSource;
+ aEvent.Trigger = EventTrigger::BEGIN_EVENT;
+ aEvent.Repeat = 0;
+
+ convertTiming( sTmp, Any( aEvent ) );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_BEGIN, sTmp.makeStringAndClear() );
+
+ SvXMLElementExport aElement( mrExport, XML_NAMESPACE_ANIMATION, XML_PAR, sal_True, sal_True );
+
+ if( nTransition != 0 )
+ {
+ sal_Int16 nSubtype = 0;
+ sal_Bool bDirection = sal_False;
+ sal_Int32 nFadeColor = 0;
+ double fDuration = 0.0;
+ mxPageProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TransitionSubtype" ) ) ) >>= nSubtype;
+ mxPageProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TransitionDirection" ) ) ) >>= bDirection;
+ mxPageProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TransitionFadeColor" ) ) ) >>= nFadeColor;
+ mxPageProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TransitionDuration" ) ) ) >>= fDuration;
+
+ SvXMLUnitConverter::convertDouble( sTmp, fDuration );
+ sTmp.append( sal_Unicode('s'));
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_DUR, sTmp.makeStringAndClear() );
+
+ SvXMLUnitConverter::convertEnum( sTmp, (sal_uInt16)nTransition, getAnimationsEnumMap(Animations_EnumMap_TransitionType) );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_TYPE, sTmp.makeStringAndClear() );
+
+ if( nSubtype != TransitionSubType::DEFAULT )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, (sal_uInt16)nSubtype, getAnimationsEnumMap(Animations_EnumMap_TransitionSubType) );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_SUBTYPE, sTmp.makeStringAndClear() );
+ }
+
+ if( !bDirection )
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_DIRECTION, XML_REVERSE );
+
+ if( (nTransition == TransitionType::FADE) && ((nSubtype == TransitionSubType::FADETOCOLOR) || (nSubtype == TransitionSubType::FADEFROMCOLOR) ))
+ {
+ SvXMLUnitConverter::convertColor( sTmp, nFadeColor );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_FADECOLOR, sTmp.makeStringAndClear() );
+ }
+ SvXMLElementExport aElement2( mrExport, XML_NAMESPACE_ANIMATION, XML_TRANSITIONFILTER, sal_True, sal_True );
+ }
+
+ if( bStopSound )
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_ANIMATION, XML_COMMAND, XML_STOP_AUDIO );
+ SvXMLElementExport aElement2( mrExport, XML_NAMESPACE_ANIMATION, XML_COMMAND, sal_True, sal_True );
+ }
+ else if( sSoundURL.getLength() != 0)
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, mrExport.GetRelativeReference( sSoundURL ) );
+
+ sal_Bool bLoopSound = sal_False;
+ mxPageProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "LoopSound" ) ) ) >>= bLoopSound;
+
+ if( bLoopSound )
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_REPEATCOUNT, XML_INDEFINITE );
+ SvXMLElementExport aElement2( mrExport, XML_NAMESPACE_ANIMATION, XML_AUDIO, sal_True, sal_True );
+ }
+ }
+ }
+}
+
+void AnimationsExporterImpl::prepareTransitionNode()
+{
+ if( mxPageProps.is() ) try
+ {
+ sal_Int16 nTransition = 0;
+ mxPageProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TransitionType" ) ) ) >>= nTransition;
+
+ sal_Bool bStopSound = sal_False;
+ OUString sSoundURL;
+
+ if( nTransition == 0 )
+ {
+ Any aSound( mxPageProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Sound" ) ) ) );
+ aSound >>= sSoundURL;
+
+ if( !(aSound >>= bStopSound) )
+ bStopSound = sal_False;
+ }
+
+ if( (nTransition != 0) || (sSoundURL.getLength() != 0) || bStopSound )
+ {
+ mbHasTransition = true;
+ Reference< XInterface > xInt( mxPageProps.get() );
+ mrExport.getInterfaceToIdentifierMapper().registerReference( xInt );
+ }
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL( "xmloff::AnimationsExporterImpl::prepareNode(), Exception caught!" );
+ }
+
+}
+
+void AnimationsExporterImpl::prepareNode( const Reference< XAnimationNode >& xNode )
+{
+ try
+ {
+ prepareValue( xNode->getBegin() );
+ prepareValue( xNode->getEnd() );
+
+ sal_Int16 nNodeType = xNode->getType();
+ switch( nNodeType )
+ {
+ case AnimationNodeType::ITERATE:
+ {
+ Reference< XIterateContainer > xIter( xNode, UNO_QUERY_THROW );
+ prepareValue( xIter->getTarget() );
+ }
+ // its intended that here is no break!
+ case AnimationNodeType::PAR:
+ case AnimationNodeType::SEQ:
+ {
+ Reference< XEnumerationAccess > xEnumerationAccess( xNode, UNO_QUERY_THROW );
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY_THROW );
+ while( xEnumeration->hasMoreElements() )
+ {
+ Reference< XAnimationNode > xChildNode( xEnumeration->nextElement(), UNO_QUERY_THROW );
+ prepareNode( xChildNode );
+ }
+ }
+ break;
+
+ case AnimationNodeType::ANIMATE:
+ case AnimationNodeType::SET:
+ case AnimationNodeType::ANIMATEMOTION:
+ case AnimationNodeType::ANIMATECOLOR:
+ case AnimationNodeType::ANIMATETRANSFORM:
+ case AnimationNodeType::TRANSITIONFILTER:
+ {
+ Reference< XAnimate > xAnimate( xNode, UNO_QUERY_THROW );
+ prepareValue( xAnimate->getTarget() );
+ }
+ break;
+
+ case AnimationNodeType::COMMAND:
+ {
+ Reference< XCommand > xCommand( xNode, UNO_QUERY_THROW );
+ prepareValue( xCommand->getTarget() );
+ }
+ break;
+
+ case AnimationNodeType::AUDIO:
+ {
+ Reference< XAudio > xAudio( xNode, UNO_QUERY_THROW );
+ prepareValue( xAudio->getSource() );
+ }
+ break;
+ }
+
+ Sequence< NamedValue > aUserData( xNode->getUserData() );
+ if( aUserData.hasElements() )
+ {
+ const NamedValue* pValue = aUserData.getConstArray();
+ const sal_Int32 nLength = aUserData.getLength();
+ sal_Int32 nElement;
+ for( nElement = 0; nElement < nLength; nElement++, pValue++ )
+ {
+ if( IsXMLToken( pValue->Name, XML_MASTER_ELEMENT ) )
+ {
+ Reference< XInterface > xMaster;
+ pValue->Value >>= xMaster;
+ if( xMaster.is() )
+ mrExport.getInterfaceToIdentifierMapper().registerReference( xMaster );
+ }
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL( "xmloff::AnimationsExporterImpl::prepareNode(), RuntimeException catched!" );
+ }
+}
+
+void AnimationsExporterImpl::exportNode( const Reference< XAnimationNode >& xNode )
+{
+ try
+ {
+ OUStringBuffer sTmp;
+
+ const OUString& rExportIdentifier = mrExport.getInterfaceToIdentifierMapper().getIdentifier( xNode );
+ if( rExportIdentifier.getLength() )
+ {
+ mrExport.AddAttributeIdLegacy(
+ XML_NAMESPACE_ANIMATION, rExportIdentifier);
+ }
+
+ Any aTemp( xNode->getBegin() );
+ if( aTemp.hasValue() )
+ {
+ convertTiming( sTmp, aTemp );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_BEGIN, sTmp.makeStringAndClear() );
+ }
+
+ double fTemp = 0;
+ sal_Int32 nTemp;
+
+ aTemp = xNode->getDuration();
+ if( aTemp.hasValue() )
+ {
+ if( aTemp >>= fTemp )
+ {
+ SvXMLUnitConverter::convertDouble( sTmp, fTemp );
+ sTmp.append( sal_Unicode('s'));
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_DUR, sTmp.makeStringAndClear() );
+ }
+ else
+ {
+ Timing eTiming;
+ if( aTemp >>= eTiming )
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_DUR, eTiming == Timing_INDEFINITE ? XML_INDEFINITE : XML_MEDIA );
+ }
+ }
+
+ aTemp = xNode->getEnd();
+ if( aTemp.hasValue() )
+ {
+ convertTiming( sTmp, aTemp );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_END, sTmp.makeStringAndClear() );
+ }
+
+ nTemp = xNode->getFill();
+ if( nTemp != AnimationFill::DEFAULT )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, (sal_uInt16)nTemp, getAnimationsEnumMap(Animations_EnumMap_Fill) );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_FILL, sTmp.makeStringAndClear() );
+ }
+
+ nTemp = xNode->getFillDefault();
+ if( nTemp != AnimationFill::INHERIT )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, (sal_uInt16)nTemp, getAnimationsEnumMap(Animations_EnumMap_FillDefault) );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_FILLDEFAULT, sTmp.makeStringAndClear() );
+ }
+
+ nTemp = xNode->getRestart();
+ if( nTemp != AnimationRestart::DEFAULT )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, (sal_uInt16)nTemp, getAnimationsEnumMap(Animations_EnumMap_Restart) );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_RESTART, sTmp.makeStringAndClear() );
+ }
+
+ nTemp = xNode->getRestartDefault();
+ if( nTemp != AnimationRestart::INHERIT )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, (sal_uInt16)nTemp, getAnimationsEnumMap(Animations_EnumMap_RestartDefault) );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_RESTARTDEFAULT, sTmp.makeStringAndClear() );
+ }
+
+ fTemp = xNode->getAcceleration();
+ if( fTemp != 0.0 )
+ {
+ SvXMLUnitConverter::convertDouble( sTmp, fTemp );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_ACCELERATE, sTmp.makeStringAndClear() );
+ }
+
+ fTemp = xNode->getDecelerate();
+ if( fTemp != 0.0 )
+ {
+ SvXMLUnitConverter::convertDouble( sTmp, fTemp );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_DECELERATE, sTmp.makeStringAndClear() );
+ }
+
+ sal_Bool bTemp = xNode->getAutoReverse();
+ if( bTemp )
+ {
+ SvXMLUnitConverter::convertBool( sTmp, bTemp );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_AUTOREVERSE, sTmp.makeStringAndClear() );
+ }
+
+ aTemp = xNode->getRepeatCount();
+ if( aTemp.hasValue() )
+ {
+ Timing eTiming;
+ if( (aTemp >>= eTiming ) && (eTiming == Timing_INDEFINITE ) )
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_REPEATCOUNT, XML_INDEFINITE );
+ else if( aTemp >>= fTemp )
+ {
+ SvXMLUnitConverter::convertDouble( sTmp, fTemp );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_REPEATCOUNT, sTmp.makeStringAndClear() );
+ }
+ }
+
+ aTemp = xNode->getRepeatDuration();
+ if( aTemp.hasValue() )
+ {
+ Timing eTiming;
+ if( ( aTemp >>= eTiming ) && (eTiming == Timing_INDEFINITE) )
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_REPEATDUR, XML_INDEFINITE );
+ }
+ else if( aTemp >>= fTemp )
+ {
+ SvXMLUnitConverter::convertDouble( sTmp, fTemp );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_REPEATDUR, sTmp.makeStringAndClear() );
+ }
+ }
+
+ aTemp = xNode->getEndSync();
+ if( aTemp.hasValue() )
+ {
+ if( aTemp >>= nTemp )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, (sal_uInt16)nTemp, getAnimationsEnumMap(Animations_EnumMap_Endsync) );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_ENDSYNC, sTmp.makeStringAndClear() );
+ }
+ }
+
+ sal_Int16 nContainerNodeType = EffectNodeType::DEFAULT;
+ OUString aPresetId;
+ Sequence< NamedValue > aUserData( xNode->getUserData() );
+ if( aUserData.hasElements() )
+ {
+ const NamedValue* pValue = aUserData.getConstArray();
+ const sal_Int32 nLength = aUserData.getLength();
+ sal_Int32 nElement;
+ for( nElement = 0; nElement < nLength; nElement++, pValue++ )
+ {
+ if( IsXMLToken( pValue->Name, XML_NODE_TYPE ) )
+ {
+ if( (pValue->Value >>= nContainerNodeType) && (nContainerNodeType != EffectNodeType::DEFAULT) )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, (sal_uInt16)nContainerNodeType, getAnimationsEnumMap(Animations_EnumMap_EffectNodeType) );
+ mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_NODE_TYPE, sTmp.makeStringAndClear() );
+ }
+ }
+ else if( IsXMLToken( pValue->Name, XML_PRESET_ID ) )
+ {
+ if( pValue->Value >>= aPresetId )
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_PRESET_ID, aPresetId );
+ }
+ }
+ else if( IsXMLToken( pValue->Name, XML_PRESET_SUB_TYPE ) )
+ {
+ OUString aPresetSubType;
+ if( pValue->Value >>= aPresetSubType )
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_PRESET_SUB_TYPE, aPresetSubType );
+ }
+ }
+ else if( IsXMLToken( pValue->Name, XML_PRESET_CLASS ) )
+ {
+ sal_Int16 nEffectPresetClass = sal_Int16();
+ if( pValue->Value >>= nEffectPresetClass )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, (sal_uInt16)nEffectPresetClass, getAnimationsEnumMap(Animations_EnumMap_EffectPresetClass) );
+ mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_PRESET_CLASS, sTmp.makeStringAndClear() );
+ }
+ }
+ else if( IsXMLToken( pValue->Name, XML_MASTER_ELEMENT ) )
+ {
+ Reference< XInterface > xMaster;
+ pValue->Value >>= xMaster;
+ if( xMaster.is() )
+ {
+ const OUString& rIdentifier = mrExport.getInterfaceToIdentifierMapper().getIdentifier(xMaster);
+ if( rIdentifier.getLength() )
+ mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_MASTER_ELEMENT, rIdentifier );
+ }
+ }
+ else if( IsXMLToken( pValue->Name, XML_GROUP_ID ) )
+ {
+ sal_Int32 nGroupId = 0;
+ if( pValue->Value >>= nGroupId )
+ mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_GROUP_ID, OUString::valueOf( nGroupId ) );
+ }
+ else
+ {
+ OUString aTmp;
+ if( pValue->Value >>= aTmp )
+ mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, pValue->Name, aTmp );
+ }
+ }
+ }
+
+ nTemp = xNode->getType();
+ switch( nTemp )
+ {
+ case AnimationNodeType::PAR:
+ case AnimationNodeType::SEQ:
+ case AnimationNodeType::ITERATE:
+ {
+ Reference< XTimeContainer > xContainer( xNode, UNO_QUERY_THROW );
+ exportContainer( xContainer, nContainerNodeType );
+ }
+ break;
+
+ case AnimationNodeType::ANIMATE:
+ case AnimationNodeType::SET:
+ case AnimationNodeType::ANIMATEMOTION:
+ case AnimationNodeType::ANIMATECOLOR:
+ case AnimationNodeType::ANIMATETRANSFORM:
+ case AnimationNodeType::TRANSITIONFILTER:
+ {
+ Reference< XAnimate > xAnimate( xNode, UNO_QUERY_THROW );
+ exportAnimate( xAnimate );
+ }
+ break;
+ case AnimationNodeType::AUDIO:
+ {
+ Reference< XAudio > xAudio( xNode, UNO_QUERY_THROW );
+ exportAudio( xAudio );
+ }
+ break;
+ case AnimationNodeType::COMMAND:
+ {
+ Reference< XCommand > xCommand( xNode, UNO_QUERY_THROW );
+ exportCommand( xCommand );
+ }
+ break;
+ default:
+ OSL_FAIL( "xmloff::AnimationsExporterImpl::exportNode(), invalid AnimationNodeType!" );
+ }
+ }
+ catch( RuntimeException& )
+ {
+ OSL_FAIL( "xmloff::AnimationsExporterImpl::exportNode(), RuntimeException catched!" );
+ }
+
+ // if something goes wrong, its always a good idea to clear the attribute list
+ mrExport.ClearAttrList();
+}
+
+void AnimationsExporterImpl::exportContainer( const Reference< XTimeContainer >& xContainer, sal_Int16 nContainerNodeType )
+{
+ try
+ {
+ const sal_Int32 nNodeType = xContainer->getType();
+
+ if( nNodeType == AnimationNodeType::ITERATE )
+ {
+ OUStringBuffer sTmp;
+ Reference< XIterateContainer > xIter( xContainer, UNO_QUERY_THROW );
+
+ Any aTemp( xIter->getTarget() );
+ if( aTemp.hasValue() )
+ {
+ convertTarget( sTmp, aTemp );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_TARGETELEMENT, sTmp.makeStringAndClear() );
+ }
+
+ sal_Int16 nTemp = xIter->getSubItem();
+ if( nTemp )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, (sal_uInt16)nTemp, getAnimationsEnumMap(Animations_EnumMap_SubItem) );
+ mrExport.AddAttribute( XML_NAMESPACE_ANIMATION, XML_SUB_ITEM, sTmp.makeStringAndClear() );
+ }
+
+ nTemp = xIter->getIterateType();
+ if( nTemp )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, (sal_uInt16)nTemp, getAnimationsEnumMap(Animations_EnumMap_IterateType) );
+ mrExport.AddAttribute( XML_NAMESPACE_ANIMATION, XML_ITERATE_TYPE, sTmp.makeStringAndClear() );
+ }
+
+ double fTemp = xIter->getIterateInterval();
+ if( fTemp )
+ {
+ if( 0 == ( mrExport.getExportFlags() & EXPORT_SAVEBACKWARDCOMPATIBLE ) )
+ {
+ // issue 146582
+ sal_Int32 nSecondsFraction = static_cast<sal_Int32>(fTemp * 1000 ) % 1000;
+ ::Time aTime( static_cast<sal_Int32>( fTemp * 100 ) );
+ mrExport.AddAttribute( XML_NAMESPACE_ANIMATION, XML_ITERATE_INTERVAL, SvXMLUnitConverter::convertTimeDuration( aTime, nSecondsFraction ) );
+ }
+ else
+ {
+ sTmp.append( fTemp );
+ sTmp.append( (sal_Unicode)'s' );
+ mrExport.AddAttribute( XML_NAMESPACE_ANIMATION, XML_ITERATE_INTERVAL, sTmp.makeStringAndClear() );
+ }
+ }
+ }
+
+ XMLTokenEnum eElementToken;
+ switch( nNodeType )
+ {
+ case AnimationNodeType::PAR: eElementToken = XML_PAR; break;
+ case AnimationNodeType::SEQ: eElementToken = XML_SEQ; break;
+ case AnimationNodeType::ITERATE:eElementToken = XML_ITERATE; break;
+ default:
+ OSL_FAIL( "xmloff::AnimationsExporterImpl::exportContainer(), invalid TimeContainerType!" );
+ return;
+ }
+ SvXMLElementExport aElement( mrExport, XML_NAMESPACE_ANIMATION, eElementToken, sal_True, sal_True );
+
+ if( nContainerNodeType == EffectNodeType::TIMING_ROOT )
+ exportTransitionNode();
+
+ Reference< XEnumerationAccess > xEnumerationAccess( xContainer, UNO_QUERY_THROW );
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY_THROW );
+ while( xEnumeration->hasMoreElements() )
+ {
+ Reference< XAnimationNode > xChildNode( xEnumeration->nextElement(), UNO_QUERY_THROW );
+ exportNode( xChildNode );
+ }
+ }
+ catch( RuntimeException& )
+ {
+ OSL_FAIL( "xmloff::AnimationsExporterImpl::exportContainer(), RuntimeException catched!" );
+ }
+}
+
+void AnimationsExporterImpl::exportAnimate( const Reference< XAnimate >& xAnimate )
+{
+ try
+ {
+ const sal_Int16 nNodeType = xAnimate->getType();
+
+ OUStringBuffer sTmp;
+ sal_Int32 nTemp;
+ sal_Bool bTemp;
+
+ Any aTemp( xAnimate->getTarget() );
+ if( aTemp.hasValue() )
+ {
+ convertTarget( sTmp, aTemp );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_TARGETELEMENT, sTmp.makeStringAndClear() );
+ }
+
+ nTemp = xAnimate->getSubItem();
+ if( nTemp )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, (sal_uInt16)nTemp, getAnimationsEnumMap(Animations_EnumMap_SubItem) );
+ mrExport.AddAttribute( XML_NAMESPACE_ANIMATION, XML_SUB_ITEM, sTmp.makeStringAndClear() );
+ }
+
+ XMLTokenEnum eAttributeName = XML_TOKEN_INVALID;
+
+ if( nNodeType == AnimationNodeType::TRANSITIONFILTER )
+ {
+ eAttributeName = XML_TRANSITIONFILTER;
+ }
+ else if( nNodeType == AnimationNodeType::ANIMATETRANSFORM )
+ {
+ eAttributeName = XML_ANIMATETRANSFORM;
+ }
+ else if( nNodeType == AnimationNodeType::ANIMATEMOTION )
+ {
+ eAttributeName = XML_ANIMATEMOTION;
+ }
+ else
+ {
+ OUString sTemp( xAnimate->getAttributeName() );
+ if( sTemp.getLength() )
+ {
+ ImplAttributeNameConversion* p = getAnimationAttributeNamesConversionList();
+ while( p->mpAPIName )
+ {
+ if( sTemp.compareToAscii( p->mpAPIName ) == 0 )
+ {
+ sTemp = GetXMLToken( p->meXMLToken );
+ eAttributeName = p->meXMLToken;
+ break;
+ }
+
+ p++;
+ }
+
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_ATTRIBUTENAME, sTemp );
+ }
+ else
+ {
+ OUString aStr( RTL_CONSTASCII_USTRINGPARAM( "invalid" ) );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_ATTRIBUTENAME, aStr );
+ }
+ }
+
+ Sequence< Any > aValues( xAnimate->getValues() );
+ if( aValues.getLength() )
+ {
+ aTemp <<= aValues;
+ convertValue( eAttributeName, sTmp, aTemp );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_VALUES, sTmp.makeStringAndClear() );
+ }
+ else
+ {
+ aTemp = xAnimate->getFrom();
+ if( aTemp.hasValue() )
+ {
+ convertValue( eAttributeName, sTmp, aTemp );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_FROM, sTmp.makeStringAndClear() );
+ }
+
+ aTemp = xAnimate->getBy();
+ if( aTemp.hasValue() )
+ {
+ convertValue( eAttributeName, sTmp, aTemp );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_BY, sTmp.makeStringAndClear() );
+ }
+
+ aTemp = xAnimate->getTo();
+ if( aTemp.hasValue() )
+ {
+ convertValue( eAttributeName, sTmp, aTemp );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_TO, sTmp.makeStringAndClear() );
+ }
+ }
+
+ if(nNodeType != AnimationNodeType::SET)
+ {
+ Sequence< double > aKeyTimes( xAnimate->getKeyTimes() );
+ if( aKeyTimes.getLength() )
+ {
+ sal_Int32 nLength = aKeyTimes.getLength();
+ const double* p = aKeyTimes.getConstArray();
+
+ while( nLength-- )
+ {
+ if( sTmp.getLength() )
+ sTmp.append( (sal_Unicode)';' );
+
+ sTmp.append( *p++ );
+ }
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_KEYTIMES, sTmp.makeStringAndClear() );
+ }
+
+ OUString sTemp( xAnimate->getFormula() );
+ if( sTemp.getLength() )
+ mrExport.AddAttribute( XML_NAMESPACE_ANIMATION, XML_FORMULA, sTemp );
+
+ if( (nNodeType != AnimationNodeType::TRANSITIONFILTER) &&
+ (nNodeType != AnimationNodeType::AUDIO ) )
+ {
+ // calcMode = "discrete | linear | paced | spline"
+ nTemp = xAnimate->getCalcMode();
+ if( ((nNodeType == AnimationNodeType::ANIMATEMOTION ) && (nTemp != AnimationCalcMode::PACED)) ||
+ ((nNodeType != AnimationNodeType::ANIMATEMOTION ) && (nTemp != AnimationCalcMode::LINEAR)) )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, (sal_uInt16)nTemp, getAnimationsEnumMap(Animations_EnumMap_CalcMode) );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_CALCMODE, sTmp.makeStringAndClear() );
+ }
+
+ bTemp = xAnimate->getAccumulate();
+ if( bTemp )
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_ACCUMULATE, XML_SUM );
+
+ nTemp = xAnimate->getAdditive();
+ if( nTemp != AnimationAdditiveMode::REPLACE )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, (sal_uInt16)nTemp, getAnimationsEnumMap(Animations_EnumMap_AdditiveMode) );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_ADDITIVE, sTmp.makeStringAndClear() );
+ }
+ }
+
+ Sequence< TimeFilterPair > aTimeFilter( xAnimate->getTimeFilter() );
+ if( aTimeFilter.getLength() )
+ {
+ sal_Int32 nLength = aTimeFilter.getLength();
+ const TimeFilterPair* p = aTimeFilter.getConstArray();
+
+ while( nLength-- )
+ {
+ if( sTmp.getLength() )
+ sTmp.append( (sal_Unicode)';' );
+
+ sTmp.append( p->Time );
+ sTmp.append( (sal_Unicode)',' );
+ sTmp.append( p->Progress );
+
+ p++;
+ }
+
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_KEYSPLINES, sTmp.makeStringAndClear() );
+ }
+ }
+
+ XMLTokenEnum eElementToken = XML_ANIMATE;
+
+ switch( nNodeType )
+ {
+ case AnimationNodeType::ANIMATE:
+ eElementToken = XML_ANIMATE;
+ break;
+
+ case AnimationNodeType::SET:
+ eElementToken = XML_SET;
+ break;
+
+ case AnimationNodeType::ANIMATEMOTION:
+ {
+ eElementToken = XML_ANIMATEMOTION;
+
+ Reference< XAnimateMotion > xAnimateMotion( xAnimate, UNO_QUERY_THROW );
+
+ aTemp = xAnimateMotion->getPath();
+ if( aTemp.hasValue() )
+ {
+ convertPath( sTmp, aTemp );
+ mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_PATH, sTmp.makeStringAndClear() );
+ }
+
+ // TODO: origin = ( parent | layout )
+ aTemp = xAnimateMotion->getOrigin();
+ }
+ break;
+
+ case AnimationNodeType::ANIMATECOLOR:
+ {
+ eElementToken = XML_ANIMATECOLOR;
+
+ Reference< XAnimateColor > xAnimateColor( xAnimate, UNO_QUERY_THROW );
+
+ nTemp = xAnimateColor->getColorInterpolation();
+ mrExport.AddAttribute( XML_NAMESPACE_ANIMATION, XML_COLOR_INTERPOLATION, (nTemp == AnimationColorSpace::RGB) ? XML_RGB : XML_HSL );
+
+ bTemp = xAnimateColor->getDirection();
+ mrExport.AddAttribute( XML_NAMESPACE_ANIMATION, XML_COLOR_INTERPOLATION_DIRECTION, bTemp ? XML_CLOCKWISE : XML_COUNTER_CLOCKWISE );
+ }
+ break;
+
+ case AnimationNodeType::ANIMATETRANSFORM:
+ {
+ eElementToken = XML_ANIMATETRANSFORM;
+
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_ATTRIBUTENAME, XML_TRANSFORM );
+
+ Reference< XAnimateTransform > xTransform( xAnimate, UNO_QUERY_THROW );
+ nTemp = xTransform->getTransformType();
+ SvXMLUnitConverter::convertEnum( sTmp, (sal_uInt16)nTemp, getAnimationsEnumMap(Animations_EnumMap_TransformType) );
+ mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_TYPE, sTmp.makeStringAndClear() );
+ }
+ break;
+
+ case AnimationNodeType::TRANSITIONFILTER:
+ {
+ Reference< XTransitionFilter > xTransitionFilter( xAnimate, UNO_QUERY );
+ eElementToken = XML_TRANSITIONFILTER;
+
+ sal_Int16 nTransition = xTransitionFilter->getTransition();
+ SvXMLUnitConverter::convertEnum( sTmp, (sal_uInt16)nTransition, getAnimationsEnumMap(Animations_EnumMap_TransitionType) );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_TYPE, sTmp.makeStringAndClear() );
+
+ sal_Int16 nSubtype = xTransitionFilter->getSubtype();
+ if( nSubtype != TransitionSubType::DEFAULT )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, (sal_uInt16)nSubtype, getAnimationsEnumMap(Animations_EnumMap_TransitionSubType) );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_SUBTYPE, sTmp.makeStringAndClear() );
+ }
+
+ bTemp = xTransitionFilter->getMode();
+ if( !bTemp )
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_MODE, XML_OUT );
+
+ bTemp = xTransitionFilter->getDirection();
+ if( !bTemp )
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_DIRECTION, XML_REVERSE );
+
+ if( (nTransition == TransitionType::FADE) && ((nSubtype == TransitionSubType::FADETOCOLOR) || (nSubtype == TransitionSubType::FADEFROMCOLOR) ))
+ {
+ nTemp = xTransitionFilter->getFadeColor();
+ SvXMLUnitConverter::convertColor( sTmp, nTemp );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_FADECOLOR, sTmp.makeStringAndClear() );
+ }
+ }
+ break;
+ }
+
+ SvXMLElementExport aElement( mrExport, XML_NAMESPACE_ANIMATION, eElementToken, sal_True, sal_True );
+
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL( "xmloff::AnimationsExporterImpl::exportAnimate(), Exception cought!" );
+ }
+}
+
+void AnimationsExporterImpl::exportAudio( const Reference< XAudio >& xAudio )
+{
+ if( xAudio.is() ) try
+ {
+ OUString aSourceURL;
+ xAudio->getSource() >>= aSourceURL;
+ if( aSourceURL.getLength() )
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, mrExport.GetRelativeReference( aSourceURL ) );
+
+ const double fVolume = xAudio->getVolume();
+ if( fVolume != 1.0 )
+ {
+ OUStringBuffer sTmp;
+ SvXMLUnitConverter::convertDouble( sTmp, fVolume );
+ mrExport.AddAttribute( XML_NAMESPACE_ANIMATION, XML_AUDIO_LEVEL, sTmp.makeStringAndClear() );
+ }
+
+/* todo?
+ sal_Int32 nEndAfterSlide = 0;
+ xAudio->getEndAfterSlide() >>= nEndAfterSlide;
+ if( nEndAfterSlide != 0 )
+ mrExport.AddAttribute( );
+*/
+ SvXMLElementExport aElement( mrExport, XML_NAMESPACE_ANIMATION, XML_AUDIO, sal_True, sal_True );
+
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL( "xmloff::AnimationsExporterImpl::exportAudio(), exception caught!" );
+ }
+}
+
+void AnimationsExporterImpl::exportCommand( const Reference< XCommand >& xCommand )
+{
+ if( xCommand.is() ) try
+ {
+ OUStringBuffer sTmp;
+ Any aTemp( xCommand->getTarget() );
+ if( aTemp.hasValue() )
+ {
+ convertTarget( sTmp, aTemp );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_TARGETELEMENT, sTmp.makeStringAndClear() );
+ }
+
+ sal_Int16 nCommand = xCommand->getCommand();
+ SvXMLUnitConverter::convertEnum( sTmp, (sal_uInt16)nCommand, getAnimationsEnumMap(Animations_EnumMap_Command) );
+ mrExport.AddAttribute( XML_NAMESPACE_ANIMATION, XML_COMMAND, sTmp.makeStringAndClear() );
+
+// todo virtual ::com::sun::star::uno::Any SAL_CALL getParameter() throw (::com::sun::star::uno::RuntimeException) = 0;
+
+ SvXMLElementExport aElement( mrExport, XML_NAMESPACE_ANIMATION, XML_COMMAND, sal_True, sal_True );
+
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL( "xmloff::AnimationsExporterImpl::exportCommand(), exception caught!" );
+ }
+}
+
+Reference< XInterface > AnimationsExporterImpl::getParagraphTarget( const ParagraphTarget* pTarget ) const
+{
+ if( pTarget ) try
+ {
+ Reference< XEnumerationAccess > xParaEnumAccess( pTarget->Shape, UNO_QUERY_THROW );
+
+ Reference< XEnumeration > xEnumeration( xParaEnumAccess->createEnumeration(), UNO_QUERY_THROW );
+ sal_Int32 nParagraph = pTarget->Paragraph;
+
+ while( xEnumeration->hasMoreElements() )
+ {
+ Reference< XInterface > xRef( xEnumeration->nextElement(), UNO_QUERY );
+ if( nParagraph-- == 0 )
+ return xRef;
+ }
+ }
+ catch( RuntimeException& )
+ {
+ OSL_FAIL( "xmloff::AnimationsExporterImpl::getParagraphTarget(), RuntimeException catched!" );
+ }
+
+ Reference< XInterface > xRef;
+ return xRef;
+}
+
+void AnimationsExporterImpl::convertPath( OUStringBuffer& sTmp, const Any& rPath ) const
+{
+ OUString aStr;
+ rPath >>= aStr;
+
+ sTmp = aStr;
+}
+
+void AnimationsExporterImpl::convertValue( XMLTokenEnum eAttributeName, OUStringBuffer& sTmp, const Any& rValue ) const
+{
+ if( !rValue.hasValue() )
+ return;
+
+ if( rValue.getValueType() == ::getCppuType((const ValuePair*)0) )
+ {
+ const ValuePair* pValuePair = static_cast< const ValuePair* >( rValue.getValue() );
+ OUStringBuffer sTmp2;
+ convertValue( eAttributeName, sTmp, pValuePair->First );
+ sTmp.append( (sal_Unicode)',' );
+ convertValue( eAttributeName, sTmp2, pValuePair->Second );
+ sTmp.append( sTmp2.makeStringAndClear() );
+ }
+ else if( rValue.getValueType() == ::getCppuType((Sequence<Any>*)0) )
+ {
+ const Sequence<Any>* pSequence = static_cast< const Sequence<Any>* >( rValue.getValue() );
+ const sal_Int32 nLength = pSequence->getLength();
+ sal_Int32 nElement;
+ const Any* pAny = pSequence->getConstArray();
+
+ OUStringBuffer sTmp2;
+
+ for( nElement = 0; nElement < nLength; nElement++, pAny++ )
+ {
+ if( sTmp.getLength() )
+ sTmp.append( (sal_Unicode)';' );
+ convertValue( eAttributeName, sTmp2, *pAny );
+ sTmp.append( sTmp2.makeStringAndClear() );
+ }
+ }
+ else
+ {
+ OUString aString;
+ sal_Int32 nType;
+
+ switch( eAttributeName )
+ {
+ case XML_X:
+ case XML_Y:
+ case XML_WIDTH:
+ case XML_HEIGHT:
+ case XML_ANIMATETRANSFORM:
+ case XML_ANIMATEMOTION:
+ {
+ if( rValue >>= aString )
+ {
+ sTmp.append( aString );
+ }
+ else if( rValue.getValueType() == ::getCppuType((const double*)0) )
+ {
+ sTmp.append( *(static_cast< const double* >( rValue.getValue() )) );
+ }
+ else
+ {
+ OSL_FAIL( "xmloff::AnimationsExporterImpl::convertValue(), invalid value type!" );
+ }
+ return;
+ }
+
+ case XML_SKEWX:
+ case XML_ROTATE: nType = XML_TYPE_DOUBLE; break;
+ case XML_TEXT_ROTATION_ANGLE: nType = XML_TYPE_NUMBER16; break;
+ case XML_FILL_COLOR:
+ case XML_STROKE_COLOR:
+ case XML_DIM:
+ case XML_COLOR: nType = XML_TYPE_COLOR; break;
+ case XML_FILL: nType = XML_SD_TYPE_FILLSTYLE; break;
+ case XML_STROKE: nType = XML_SD_TYPE_STROKE; break;
+ case XML_FONT_WEIGHT: nType = XML_TYPE_TEXT_WEIGHT; break;
+ case XML_FONT_STYLE: nType = XML_TYPE_TEXT_POSTURE; break;
+ case XML_TEXT_UNDERLINE: nType = XML_TYPE_TEXT_UNDERLINE_STYLE; break;
+ case XML_FONT_SIZE: nType = XML_TYPE_DOUBLE_PERCENT; break;
+ case XML_VISIBILITY: nType = XML_SD_TYPE_PRESPAGE_VISIBILITY; break;
+ case XML_OPACITY:
+ case XML_TRANSITIONFILTER: nType = XML_TYPE_DOUBLE; break;
+ default:
+ OSL_FAIL( "xmloff::AnimationsExporterImpl::convertValue(), invalid AttributeName!" );
+ nType = XML_TYPE_STRING;
+ }
+
+ const XMLPropertyHandler* pHandler = static_cast<SdXMLExport*>(&mrExport)->GetSdPropHdlFactory()->GetPropertyHandler( nType );
+ if( pHandler )
+ {
+ pHandler->exportXML( aString, rValue, mrExport.GetMM100UnitConverter() );
+ sTmp.append( aString );
+ }
+ }
+}
+
+void AnimationsExporterImpl::convertTiming( OUStringBuffer& sTmp, const Any& rValue ) const
+{
+ if( !rValue.hasValue() )
+ return;
+
+ if( rValue.getValueType() == ::getCppuType((Sequence<Any>*)0) )
+ {
+ const Sequence<Any>* pSequence = static_cast< const Sequence<Any>* >( rValue.getValue() );
+ const sal_Int32 nLength = pSequence->getLength();
+ sal_Int32 nElement;
+ const Any* pAny = pSequence->getConstArray();
+
+ OUStringBuffer sTmp2;
+
+ for( nElement = 0; nElement < nLength; nElement++, pAny++ )
+ {
+ if( sTmp.getLength() )
+ sTmp.append( (sal_Unicode)';' );
+ convertTiming( sTmp2, *pAny );
+ sTmp.append( sTmp2.makeStringAndClear() );
+ }
+ }
+ else if( rValue.getValueType() == ::getCppuType((const double*)0) )
+ {
+ sTmp.append( *(static_cast< const double* >( rValue.getValue() )) );
+ sTmp.append( sal_Unicode('s'));
+ }
+ else if( rValue.getValueType() == ::getCppuType((const Timing*)0) )
+ {
+ const Timing* pTiming = static_cast< const Timing* >( rValue.getValue() );
+ sTmp.append( GetXMLToken( (*pTiming == Timing_MEDIA) ? XML_MEDIA : XML_INDEFINITE ) );
+ }
+ else if( rValue.getValueType() == ::getCppuType((const Event*)0) )
+ {
+ OUStringBuffer sTmp2;
+
+ const Event* pEvent = static_cast< const Event* >( rValue.getValue() );
+
+ if( pEvent->Trigger != EventTrigger::NONE )
+ {
+ if( pEvent->Source.hasValue() )
+ {
+ convertSource( sTmp, pEvent->Source );
+ sTmp.append( (sal_Unicode)'.' );
+ }
+
+ SvXMLUnitConverter::convertEnum( sTmp2, (sal_uInt16)pEvent->Trigger, getAnimationsEnumMap(Animations_EnumMap_EventTrigger) );
+
+ sTmp.append( sTmp2.makeStringAndClear() );
+ }
+
+ if( pEvent->Offset.hasValue() )
+ {
+ convertTiming( sTmp2, pEvent->Offset );
+
+ if( sTmp.getLength() )
+ sTmp.append( (sal_Unicode)'+' );
+
+ sTmp.append( sTmp2.makeStringAndClear() );
+ }
+ }
+ else
+ {
+ OSL_FAIL( "xmloff::AnimationsExporterImpl::convertTiming(), invalid value type!" );
+ }
+}
+
+void AnimationsExporterImpl::convertSource( OUStringBuffer& sTmp, const Any& rSource ) const
+{
+ convertTarget( sTmp, rSource );
+}
+
+void AnimationsExporterImpl::convertTarget( OUStringBuffer& sTmp, const Any& rTarget ) const
+{
+ if( !rTarget.hasValue() )
+ return;
+
+ Reference< XInterface > xRef;
+
+ if( rTarget.getValueTypeClass() == ::com::sun::star::uno::TypeClass_INTERFACE )
+ {
+ rTarget >>= xRef;
+ }
+ else if( rTarget.getValueType() == ::getCppuType((const ParagraphTarget*)0) )
+ {
+ xRef = getParagraphTarget( static_cast< const ParagraphTarget* >( rTarget.getValue() ) );
+ }
+
+ DBG_ASSERT( xRef.is(), "xmloff::AnimationsExporterImpl::convertTarget(), invalid target type!" );
+ if( xRef.is() )
+ {
+ const OUString& rIdentifier = mrExport.getInterfaceToIdentifierMapper().getIdentifier(xRef);
+ if( rIdentifier.getLength() )
+ sTmp.append( rIdentifier );
+ }
+}
+
+void AnimationsExporterImpl::prepareValue( const Any& rValue )
+{
+ if( !rValue.hasValue() )
+ return;
+
+ if( rValue.getValueType() == ::getCppuType((const ValuePair*)0) )
+ {
+ const ValuePair* pValuePair = static_cast< const ValuePair* >( rValue.getValue() );
+ prepareValue( pValuePair->First );
+ prepareValue( pValuePair->Second );
+ }
+ else if( rValue.getValueType() == ::getCppuType((Sequence<Any>*)0) )
+ {
+ const Sequence<Any>* pSequence = static_cast< const Sequence<Any>* >( rValue.getValue() );
+ const sal_Int32 nLength = pSequence->getLength();
+ sal_Int32 nElement;
+ const Any* pAny = pSequence->getConstArray();
+
+ for( nElement = 0; nElement < nLength; nElement++, pAny++ )
+ prepareValue( *pAny );
+ }
+ else if( rValue.getValueTypeClass() == ::com::sun::star::uno::TypeClass_INTERFACE )
+ {
+ Reference< XInterface> xRef( rValue, UNO_QUERY );
+ if( xRef.is() )
+ mrExport.getInterfaceToIdentifierMapper().registerReference( xRef );
+ }
+ else if( rValue.getValueType() == ::getCppuType((const ParagraphTarget*)0) )
+ {
+ Reference< XInterface> xRef( getParagraphTarget( static_cast< const ParagraphTarget* >( rValue.getValue() ) ) );
+ if( xRef.is() )
+ mrExport.getInterfaceToIdentifierMapper().registerReference( xRef );
+ }
+ else if( rValue.getValueType() == ::getCppuType((const Event*)0) )
+ {
+ const Event* pEvent = static_cast< const Event* >( rValue.getValue() );
+ prepareValue( pEvent->Source );
+ }
+}
+
+AnimationsExporter::AnimationsExporter( SvXMLExport& rExport, const Reference< XPropertySet >& xPageProps )
+{
+ mpImpl = new AnimationsExporterImpl( rExport, xPageProps );
+}
+
+AnimationsExporter::~AnimationsExporter()
+{
+ delete mpImpl;
+}
+
+void AnimationsExporter::prepare( Reference< XAnimationNode > xRootNode )
+{
+ try
+ {
+ if( xRootNode.is() )
+ {
+ mpImpl->prepareTransitionNode();
+ mpImpl->prepareNode( xRootNode );
+ }
+ }
+ catch( RuntimeException& )
+ {
+ OSL_FAIL( "xmloff::AnimationsExporter::prepare(), exception catched" );
+ }
+}
+
+void AnimationsExporter::exportAnimations( Reference< XAnimationNode > xRootNode )
+{
+ try
+ {
+ if( xRootNode.is() )
+ {
+ bool bHasEffects = mpImpl->mbHasTransition;
+
+ if( !bHasEffects )
+ {
+ // first check if there are no animations
+ Reference< XEnumerationAccess > xEnumerationAccess( xRootNode, UNO_QUERY_THROW );
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY_THROW );
+ if( xEnumeration->hasMoreElements() )
+ {
+ // first child node may be an empty main sequence, check this
+ Reference< XAnimationNode > xMainNode( xEnumeration->nextElement(), UNO_QUERY_THROW );
+ Reference< XEnumerationAccess > xMainEnumerationAccess( xMainNode, UNO_QUERY_THROW );
+ Reference< XEnumeration > xMainEnumeration( xMainEnumerationAccess->createEnumeration(), UNO_QUERY_THROW );
+
+ // only export if the main sequence is not empty or if there are additional
+ // trigger sequences
+ bHasEffects = xMainEnumeration->hasMoreElements() || xEnumeration->hasMoreElements();
+ }
+ }
+
+ if( bHasEffects )
+ mpImpl->exportNode( xRootNode );
+ }
+ }
+ catch( RuntimeException& )
+ {
+ OSL_FAIL( "xmloff::AnimationsExporter::exportAnimations(), exception catched" );
+ }
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/animationimport.cxx b/xmloff/source/draw/animationimport.cxx
new file mode 100644
index 000000000000..0b4ec5178206
--- /dev/null
+++ b/xmloff/source/draw/animationimport.cxx
@@ -0,0 +1,1493 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <tools/debug.hxx>
+#include <tools/time.hxx>
+#include "unointerfacetouniqueidentifiermapper.hxx"
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/animations/AnimationTransformType.hpp>
+#include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
+#include <com/sun/star/presentation/AnimationEffect.hpp>
+#include <com/sun/star/presentation/AnimationSpeed.hpp>
+#include <com/sun/star/animations/AnimationNodeType.hpp>
+#include <com/sun/star/animations/XIterateContainer.hpp>
+#include <com/sun/star/animations/XAnimateMotion.hpp>
+#include <com/sun/star/animations/XAnimateColor.hpp>
+#include <com/sun/star/animations/XAnimateTransform.hpp>
+#include <com/sun/star/animations/XTransitionFilter.hpp>
+#include <com/sun/star/animations/XCommand.hpp>
+#include <com/sun/star/animations/XAudio.hpp>
+#include <com/sun/star/animations/ValuePair.hpp>
+#include <com/sun/star/animations/AnimationColorSpace.hpp>
+#include <com/sun/star/presentation/EffectPresetClass.hpp>
+#include <com/sun/star/animations/Timing.hpp>
+#include <com/sun/star/animations/Event.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/text/XTextCursor.hpp>
+#include <com/sun/star/text/XTextRangeCompare.hpp>
+#include <com/sun/star/presentation/ParagraphTarget.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/animations/EventTrigger.hpp>
+#include <com/sun/star/presentation/EffectCommands.hpp>
+#include <comphelper/processfactory.hxx>
+#include <cppuhelper/implbase1.hxx>
+
+#include <list>
+#include <xmloff/xmltypes.hxx>
+#include "sdpropls.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlimp.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmluconv.hxx>
+#include <osl/mutex.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "anim.hxx"
+
+#include "animations.hxx"
+#include "animationimport.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::std;
+using namespace ::cppu;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::animations;
+using namespace ::com::sun::star::presentation;
+using namespace ::com::sun::star::drawing;
+using namespace ::xmloff::token;
+
+using ::com::sun::star::xml::sax::XAttributeList;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::makeAny;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::RuntimeException;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::uno::XInterface;
+using ::com::sun::star::uno::Type;
+using ::com::sun::star::beans::NamedValue;
+using ::com::sun::star::text::XTextRange;
+using ::com::sun::star::text::XTextCursor;
+using ::com::sun::star::text::XTextRangeCompare;
+using ::com::sun::star::container::XEnumerationAccess;
+using ::com::sun::star::container::XEnumeration;
+using ::com::sun::star::lang::XMultiServiceFactory;
+using ::com::sun::star::lang::XInitialization;
+
+namespace xmloff
+{
+
+///////////////////////////////////////////////////////////////////////
+
+
+
+///////////////////////////////////////////////////////////////////////
+
+
+///////////////////////////////////////////////////////////////////////
+
+class AnimationsImportHelperImpl
+{
+private:
+ SvXMLImport& mrImport;
+
+ SvXMLTokenMap* mpAnimationNodeTokenMap;
+ SvXMLTokenMap* mpAnimationNodeAttributeTokenMap;
+
+public:
+ AnimationsImportHelperImpl( SvXMLImport& rImport );
+ ~AnimationsImportHelperImpl();
+
+ const SvXMLTokenMap& getAnimationNodeTokenMap();
+ const SvXMLTokenMap& getAnimationNodeAttributeTokenMap();
+
+ Any convertValue( XMLTokenEnum eAttributeName, const OUString& rValue );
+ Sequence< Any > convertValueSequence( XMLTokenEnum eAttributeName, const OUString& rValue );
+
+ Any convertTarget( const OUString& rValue );
+ Any convertPath( const OUString& rValue );
+ Any convertTiming( const OUString& rValue );
+ Sequence< double > convertKeyTimes( const OUString& rValue );
+ Sequence< TimeFilterPair > convertTimeFilter( const OUString& rValue );
+
+ bool convertAnimationValue( XMLTokenEnum eAttributeName, Any& rValue );
+ const OUString mastrHSL;
+};
+
+AnimationsImportHelperImpl::AnimationsImportHelperImpl( SvXMLImport& rImport )
+: mrImport( rImport ),
+ mpAnimationNodeTokenMap( NULL ),
+ mpAnimationNodeAttributeTokenMap( NULL ),
+ mastrHSL( RTL_CONSTASCII_USTRINGPARAM( "hsl" ) )
+{
+}
+
+AnimationsImportHelperImpl::~AnimationsImportHelperImpl()
+{
+ delete mpAnimationNodeTokenMap;
+ delete mpAnimationNodeAttributeTokenMap;
+}
+
+const SvXMLTokenMap& AnimationsImportHelperImpl::getAnimationNodeTokenMap()
+{
+ if( mpAnimationNodeTokenMap == NULL )
+ {
+ static SvXMLTokenMapEntry aAnimationNodeTokenMap[] =
+ {
+ { XML_NAMESPACE_ANIMATION, XML_PAR, (sal_uInt16)AnimationNodeType::PAR },
+ { XML_NAMESPACE_ANIMATION, XML_SEQ, (sal_uInt16)AnimationNodeType::SEQ },
+ { XML_NAMESPACE_ANIMATION, XML_ITERATE, (sal_uInt16)AnimationNodeType::ITERATE },
+ { XML_NAMESPACE_ANIMATION, XML_ANIMATE, (sal_uInt16)AnimationNodeType::ANIMATE },
+ { XML_NAMESPACE_ANIMATION, XML_SET, (sal_uInt16)AnimationNodeType::SET },
+ { XML_NAMESPACE_ANIMATION, XML_ANIMATEMOTION, (sal_uInt16)AnimationNodeType::ANIMATEMOTION },
+ { XML_NAMESPACE_ANIMATION, XML_ANIMATECOLOR, (sal_uInt16)AnimationNodeType::ANIMATECOLOR },
+ { XML_NAMESPACE_ANIMATION, XML_ANIMATETRANSFORM, (sal_uInt16)AnimationNodeType::ANIMATETRANSFORM },
+ { XML_NAMESPACE_ANIMATION, XML_TRANSITIONFILTER, (sal_uInt16)AnimationNodeType::TRANSITIONFILTER },
+ { XML_NAMESPACE_ANIMATION, XML_AUDIO, (sal_uInt16)AnimationNodeType::AUDIO },
+ { XML_NAMESPACE_ANIMATION, XML_COMMAND, (sal_uInt16)AnimationNodeType::COMMAND },
+ XML_TOKEN_MAP_END
+ };
+
+ mpAnimationNodeTokenMap = new SvXMLTokenMap( aAnimationNodeTokenMap );
+ }
+
+ return *mpAnimationNodeTokenMap;
+}
+
+enum AnimationNodeAttributes
+{
+ ANA_Begin,
+ ANA_Dur,
+ ANA_End,
+ ANA_Fill,
+ ANA_FillDefault,
+ ANA_Restart,
+ ANA_RestartDefault,
+ ANA_Accelerate,
+ ANA_Decelerate,
+ ANA_AutoReverse,
+ ANA_RepeatCount,
+ ANA_RepeatDur,
+ ANA_EndSync,
+ ANA_Node_Type,
+ ANA_Preset_ID,
+ ANA_Preset_Sub_Type,
+ ANA_Preset_Class,
+ ANA_After_Effect,
+ ANA_Target,
+ ANA_XLink,
+ ANA_MasterElement,
+ ANA_SubItem,
+ ANA_AttributeName,
+ ANA_Values,
+ ANA_From,
+ ANA_By,
+ ANA_To,
+ ANA_KeyTimes,
+ ANA_CalcMode,
+ ANA_Accumulate,
+ ANA_AdditiveMode,
+ ANA_KeySplines,
+ ANA_Path,
+ ANA_ColorSpace,
+ ANA_ColorDirection,
+ ANA_TransformType,
+ ANA_TransitionType,
+ ANA_TransitionSubType,
+ ANA_Mode,
+ ANA_Direction,
+ ANA_FadeColor,
+ ANA_IterateType,
+ ANA_IterateInterval,
+ ANA_Formula,
+ ANA_ANIMID,
+ ANA_XMLID,
+ ANA_Group_Id,
+ ANA_Command,
+ ANA_Volume
+};
+
+const SvXMLTokenMap& AnimationsImportHelperImpl::getAnimationNodeAttributeTokenMap()
+{
+ if( mpAnimationNodeAttributeTokenMap == NULL )
+ {
+ static SvXMLTokenMapEntry aAnimationNodeAttributeTokenMap[] =
+ {
+ { XML_NAMESPACE_SMIL, XML_BEGIN, (sal_uInt16)ANA_Begin },
+ { XML_NAMESPACE_SMIL, XML_DUR, (sal_uInt16)ANA_Dur },
+ { XML_NAMESPACE_SMIL, XML_END, (sal_uInt16)ANA_End },
+ { XML_NAMESPACE_SMIL, XML_FILL, (sal_uInt16)ANA_Fill },
+ { XML_NAMESPACE_SMIL, XML_FILLDEFAULT, (sal_uInt16)ANA_FillDefault },
+ { XML_NAMESPACE_SMIL, XML_RESTART, (sal_uInt16)ANA_Restart },
+ { XML_NAMESPACE_SMIL, XML_RESTARTDEFAULT, (sal_uInt16)ANA_RestartDefault },
+ { XML_NAMESPACE_SMIL, XML_ACCELERATE, (sal_uInt16)ANA_Accelerate },
+ { XML_NAMESPACE_SMIL, XML_DECELERATE, (sal_uInt16)ANA_Decelerate },
+ { XML_NAMESPACE_SMIL, XML_AUTOREVERSE, (sal_uInt16)ANA_AutoReverse },
+ { XML_NAMESPACE_SMIL, XML_REPEATCOUNT, (sal_uInt16)ANA_RepeatCount },
+ { XML_NAMESPACE_SMIL, XML_REPEATDUR, (sal_uInt16)ANA_RepeatDur },
+ { XML_NAMESPACE_SMIL, XML_ENDSYNC, (sal_uInt16)ANA_EndSync },
+ { XML_NAMESPACE_PRESENTATION, XML_NODE_TYPE, (sal_uInt16)ANA_Node_Type },
+ { XML_NAMESPACE_PRESENTATION, XML_PRESET_ID, (sal_uInt16)ANA_Preset_ID },
+ { XML_NAMESPACE_PRESENTATION, XML_PRESET_SUB_TYPE, (sal_uInt16)ANA_Preset_Sub_Type },
+ { XML_NAMESPACE_PRESENTATION, XML_PRESET_CLASS, (sal_uInt16)ANA_Preset_Class },
+ { XML_NAMESPACE_PRESENTATION, XML_AFTER_EFFECT, (sal_uInt16)ANA_After_Effect },
+ { XML_NAMESPACE_SMIL, XML_TARGETELEMENT, (sal_uInt16)ANA_Target },
+ { XML_NAMESPACE_XLINK, XML_HREF, (sal_uInt16)ANA_XLink },
+ { XML_NAMESPACE_PRESENTATION, XML_MASTER_ELEMENT, (sal_uInt16)ANA_MasterElement },
+ { XML_NAMESPACE_ANIMATION, XML_SUB_ITEM, (sal_uInt16)ANA_SubItem },
+ { XML_NAMESPACE_SMIL, XML_ATTRIBUTENAME, (sal_uInt16)ANA_AttributeName },
+ { XML_NAMESPACE_SMIL, XML_VALUES, (sal_uInt16)ANA_Values },
+ { XML_NAMESPACE_SMIL, XML_FROM, (sal_uInt16)ANA_From },
+ { XML_NAMESPACE_SMIL, XML_BY, (sal_uInt16)ANA_By },
+ { XML_NAMESPACE_SMIL, XML_TO, (sal_uInt16)ANA_To },
+ { XML_NAMESPACE_SMIL, XML_KEYTIMES, (sal_uInt16)ANA_KeyTimes },
+ { XML_NAMESPACE_SMIL, XML_CALCMODE, (sal_uInt16)ANA_CalcMode },
+ { XML_NAMESPACE_SMIL, XML_ACCUMULATE, (sal_uInt16)ANA_Accumulate },
+ { XML_NAMESPACE_PRESENTATION, XML_ADDITIVE, (sal_uInt16)ANA_AdditiveMode },
+ { XML_NAMESPACE_SMIL, XML_ADDITIVE, (sal_uInt16)ANA_AdditiveMode },
+ { XML_NAMESPACE_SMIL, XML_KEYSPLINES, (sal_uInt16)ANA_KeySplines },
+ { XML_NAMESPACE_SVG, XML_PATH, (sal_uInt16)ANA_Path },
+ { XML_NAMESPACE_ANIMATION, XML_COLOR_INTERPOLATION, (sal_uInt16)ANA_ColorSpace },
+ { XML_NAMESPACE_ANIMATION, XML_COLOR_INTERPOLATION_DIRECTION, (sal_uInt16)ANA_ColorDirection },
+ { XML_NAMESPACE_SVG, XML_TYPE, (sal_uInt16)ANA_TransformType },
+ { XML_NAMESPACE_SMIL, XML_TYPE, (sal_uInt16)ANA_TransitionType },
+ { XML_NAMESPACE_SMIL, XML_SUBTYPE, (sal_uInt16)ANA_TransitionSubType },
+ { XML_NAMESPACE_SMIL, XML_MODE, (sal_uInt16)ANA_Mode },
+ { XML_NAMESPACE_SMIL, XML_DIRECTION, (sal_uInt16)ANA_Direction },
+ { XML_NAMESPACE_SMIL, XML_FADECOLOR, (sal_uInt16)ANA_FadeColor },
+ { XML_NAMESPACE_ANIMATION, XML_ITERATE_TYPE, (sal_uInt16)ANA_IterateType },
+ { XML_NAMESPACE_ANIMATION, XML_ITERATE_INTERVAL, (sal_uInt16)ANA_IterateInterval },
+ { XML_NAMESPACE_ANIMATION, XML_FORMULA, (sal_uInt16)ANA_Formula },
+ { XML_NAMESPACE_ANIMATION, XML_ID, (sal_uInt16)ANA_ANIMID },
+ { XML_NAMESPACE_XML, XML_ID, (sal_uInt16)ANA_XMLID },
+ { XML_NAMESPACE_PRESENTATION, XML_GROUP_ID, (sal_uInt16)ANA_Group_Id },
+ { XML_NAMESPACE_ANIMATION, XML_AUDIO_LEVEL, (sal_uInt16)ANA_Volume },
+ { XML_NAMESPACE_ANIMATION, XML_COMMAND, (sal_uInt16)ANA_Command },
+
+ XML_TOKEN_MAP_END
+ };
+
+ mpAnimationNodeAttributeTokenMap = new SvXMLTokenMap( aAnimationNodeAttributeTokenMap );
+ }
+
+ return *mpAnimationNodeAttributeTokenMap;
+}
+
+static bool isDouble( const OUString& rValue )
+{
+ sal_Int32 nLength = rValue.getLength();
+ const sal_Unicode * pStr = rValue.getStr();
+ while( nLength )
+ {
+ if( (*pStr >= '0' && *pStr <= '9') || *pStr == '-' || *pStr == '.' || *pStr == '+' || *pStr == 'e' || *pStr == 'E' )
+ {
+ pStr++;
+ nLength--;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+static bool isTime( const OUString& rValue )
+{
+ sal_Int32 nLength = rValue.getLength();
+ const sal_Unicode * pStr;
+ for( pStr = rValue.getStr(); nLength; pStr++, nLength-- )
+ {
+ if( !( (*pStr >= '0' && *pStr <= '9') || *pStr == '-' || *pStr == '.' || *pStr == '+' || *pStr == 'e' || *pStr == 'E' ) )
+ break;
+ }
+
+ // return true if this is a double (if someone forgot the 's' we silently ignore it)
+ // or if its a double that ends with a 's' or 'S'
+ return (nLength == 0) || ((*pStr == 's' || *pStr == 'S') && (nLength == 1));
+}
+
+static sal_Int32 count_codes( const OUString& rString, sal_Unicode nCode )
+{
+ sal_Int32 nCount = 0;
+ sal_Int32 fromIndex = 0;
+
+ while(true)
+ {
+ fromIndex = rString.indexOf( nCode, fromIndex );
+ if( fromIndex == -1 )
+ break;
+
+ fromIndex++;
+ nCount++;
+ }
+
+ return nCount;
+}
+
+Any AnimationsImportHelperImpl::convertTarget( const OUString& rValue )
+{
+ try
+ {
+ Reference< XInterface > xRef( mrImport.getInterfaceToIdentifierMapper().getReference( rValue ) );
+
+ Reference< XShape > _xShape( xRef, UNO_QUERY );
+ if( _xShape.is() )
+ return makeAny( _xShape );
+
+ Reference< XTextCursor > xTextCursor( xRef, UNO_QUERY );
+ if( xTextCursor.is() )
+ {
+ Reference< XTextRange > xStart( xTextCursor->getStart() ), xRange;
+ Reference< XShape > xShape( xTextCursor->getText(), UNO_QUERY_THROW );
+ Reference< XTextRangeCompare > xTextRangeCompare( xShape, UNO_QUERY_THROW );
+
+ Reference< XEnumerationAccess > xParaEnumAccess( xShape, UNO_QUERY_THROW );
+ Reference< XEnumeration > xEnumeration( xParaEnumAccess->createEnumeration(), UNO_QUERY_THROW );
+ sal_Int16 nParagraph = 0;
+
+ while( xEnumeration->hasMoreElements() )
+ {
+ xEnumeration->nextElement() >>= xRange;
+
+ // break if start of selection is prior to end of current paragraph
+ if( xRange.is() && (xTextRangeCompare->compareRegionEnds( xStart, xRange ) >= 0 ) )
+ {
+ return makeAny( ParagraphTarget( xShape, nParagraph ) );
+ }
+
+ nParagraph++;
+ }
+ }
+ }
+ catch( RuntimeException& )
+ {
+ OSL_FAIL( "xmloff::AnimationsImportImpl::convertTarget(), RuntimeException catched!" );
+ }
+
+ Any aAny;
+ return aAny;
+}
+
+Any AnimationsImportHelperImpl::convertValue( XMLTokenEnum eAttributeName, const OUString& rValue )
+{
+ sal_Int32 nCommaPos = -1, nPos;
+ sal_Int32 nOpenBrakets = 0;
+ for( nPos = 0; (nPos < rValue.getLength()) && (nCommaPos == -1); nPos++ )
+ {
+ switch( rValue[nPos] )
+ {
+ case ',':
+ if( nOpenBrakets == 0 )
+ nCommaPos = nPos;
+ break;
+ case '(':
+ case '[':
+ case '{':
+ nOpenBrakets++;
+ break;
+ case ')':
+ case ']':
+ case '}':
+ nOpenBrakets--;
+ break;
+ }
+ }
+
+ if( nCommaPos >= 0 )
+ {
+ ValuePair aPair;
+ aPair.First = convertValue( eAttributeName, rValue.copy( 0, nCommaPos ) );
+ aPair.Second = convertValue( eAttributeName, rValue.copy( nCommaPos+1, rValue.getLength() - nCommaPos - 1 ) );
+ return makeAny( aPair );
+ }
+ else
+ {
+ Any aAny;
+ sal_Int32 nType = XML_TYPE_STRING;
+
+ if( rValue.getLength() ) switch( eAttributeName )
+ {
+ case XML_X:
+ case XML_Y:
+ case XML_WIDTH:
+ case XML_HEIGHT:
+ case XML_TRANSLATE:
+ {
+ return makeAny( rValue );
+ }
+
+ case XML_SCALE:
+ case XML_SKEWY:
+ case XML_SKEWX:
+ case XML_OPACITY:
+ case XML_ROTATE: nType = XML_TYPE_DOUBLE; break;
+ case XML_TEXT_ROTATION_ANGLE:nType = XML_TYPE_TEXT_ROTATION_ANGLE; break;
+ case XML_FILL_COLOR:
+ case XML_STROKE_COLOR:
+ case XML_DIM:
+ case XML_COLOR: nType = XML_TYPE_COLOR; break;
+ case XML_FILL: nType = XML_SD_TYPE_FILLSTYLE; break;
+ case XML_STROKE: nType = XML_SD_TYPE_STROKE; break;
+ case XML_FONT_WEIGHT: nType = XML_TYPE_TEXT_WEIGHT; break;
+ case XML_FONT_STYLE: nType = XML_TYPE_TEXT_POSTURE; break;
+ case XML_TEXT_UNDERLINE: nType = XML_TYPE_TEXT_UNDERLINE_STYLE; break;
+ case XML_FONT_SIZE: nType = XML_TYPE_DOUBLE_PERCENT; break;
+ case XML_VISIBILITY: nType = XML_SD_TYPE_PRESPAGE_VISIBILITY; break;
+
+ default:
+ if( rValue.getLength() )
+ aAny <<= rValue;
+ return aAny;
+ }
+
+ const XMLPropertyHandler* pHandler = mrImport.GetShapeImport()->GetSdPropHdlFactory()->GetPropertyHandler( nType );
+ if( pHandler )
+ pHandler->importXML( rValue, aAny, mrImport.GetMM100UnitConverter() );
+
+ return aAny;
+ }
+}
+
+Sequence< Any > AnimationsImportHelperImpl::convertValueSequence( XMLTokenEnum eAttributeName, const OUString& rValue )
+{
+ Sequence< Any > aValues;
+
+ // do we have any value at all?
+ if( rValue.getLength() )
+ {
+ sal_Int32 nElements = count_codes( rValue, (sal_Unicode)';') + 1; // a non empty string has at least one value
+
+ // prepare the sequence
+ aValues.realloc( nElements );
+
+ // fill the sequence
+ Any* pValues = aValues.getArray();
+ sal_Int32 nIndex;
+ for( nIndex = 0; nElements && (nIndex >= 0); nElements-- )
+ {
+ *pValues++ = convertValue( eAttributeName, rValue.getToken( 0, ';', nIndex ) );
+ }
+ }
+
+ return aValues;
+}
+
+Any AnimationsImportHelperImpl::convertTiming( const OUString& rValue )
+{
+ Any aAny;
+
+ // do we have any value at all?
+ if( rValue.getLength() )
+ {
+ // count the values
+ sal_Int32 nElements = count_codes( rValue, (sal_Unicode)';' ) + 1; // a non empty string has at least one value
+
+ if( nElements == 1 )
+ {
+ if( IsXMLToken( rValue, XML_MEDIA ) )
+ {
+ aAny <<= Timing_MEDIA;
+ }
+ else if( IsXMLToken( rValue, XML_INDEFINITE ) )
+ {
+ aAny <<= Timing_INDEFINITE;
+ }
+ else if( isTime( rValue ) )
+ {
+ aAny <<= rValue.toDouble();
+ }
+ else
+ {
+ Event aEvent;
+ aEvent.Repeat = 0;
+ aEvent.Trigger = 0;
+
+ OUString aEventTrigger;
+
+ sal_Int32 nPos = rValue.indexOf( (sal_Unicode)'+' );
+ if( nPos == -1 )
+ {
+ aEventTrigger = rValue;
+ }
+ else
+ {
+ aEventTrigger = rValue.copy( 0, nPos );
+
+ // convert offset
+ aEvent.Offset <<= convertTiming( rValue.copy( nPos + 1 ) );
+ }
+
+ nPos = aEventTrigger.indexOf( (sal_Unicode)'.' );
+ if( nPos != -1 )
+ {
+ aEvent.Source <<= mrImport.getInterfaceToIdentifierMapper().getReference( aEventTrigger.copy( 0, nPos ) );
+ aEventTrigger = aEventTrigger.copy( nPos + 1 );
+ }
+
+ sal_uInt16 nEnum;
+ if( SvXMLUnitConverter::convertEnum( nEnum, aEventTrigger, getAnimationsEnumMap(Animations_EnumMap_EventTrigger) ) )
+ {
+ aEvent.Trigger = (sal_Int16)nEnum;
+ }
+ else
+ {
+ OSL_FAIL("AnimationsImportHelperImpl::convertTiming(), unknown event trigger!");
+ }
+
+ aAny <<= aEvent;
+ }
+ }
+ else
+ {
+ // fill the sequence
+ Sequence< Any > aValues( nElements );
+ Any* pValues = aValues.getArray();
+ sal_Int32 nIndex = 0;
+ while( (nElements--) && (nIndex >= 0) )
+ *pValues++ = convertTiming( rValue.getToken( 0, ';', nIndex ) );
+
+ aAny <<= aValues;
+ }
+ }
+ return aAny;
+}
+
+Sequence< double > AnimationsImportHelperImpl::convertKeyTimes( const OUString& rValue )
+{
+ sal_Int32 nElements = 0;
+
+ if( rValue.getLength() )
+ nElements = count_codes( rValue, (sal_Unicode)';' ) + 1; // a non empty string has at least one value
+
+ Sequence< double > aKeyTimes( nElements );
+
+ if( nElements )
+ {
+ double* pValues = aKeyTimes.getArray();
+ sal_Int32 nIndex = 0;
+ while( (nElements--) && (nIndex >= 0) )
+ *pValues++ = rValue.getToken( 0, ';', nIndex ).toDouble();
+ }
+
+ return aKeyTimes;
+}
+
+Sequence< TimeFilterPair > AnimationsImportHelperImpl::convertTimeFilter( const OUString& rValue )
+{
+ sal_Int32 nElements = 0;
+
+ if( rValue.getLength() )
+ nElements = count_codes( rValue, (sal_Unicode)';' ) + 1; // a non empty string has at least one value
+
+ Sequence< TimeFilterPair > aTimeFilter( nElements );
+
+ if( nElements )
+ {
+ TimeFilterPair* pValues = aTimeFilter.getArray();
+ sal_Int32 nIndex = 0;
+ while( (nElements--) && (nIndex >= 0) )
+ {
+ const OUString aToken( rValue.getToken( 0, ';', nIndex ) );
+
+ sal_Int32 nPos = aToken.indexOf( ',' );
+ if( nPos >= 0 )
+ {
+ pValues->Time = aToken.copy( 0, nPos ).toDouble();
+ pValues->Progress = aToken.copy( nPos+1, aToken.getLength() - nPos - 1 ).toDouble();
+ }
+ pValues++;
+ }
+ }
+
+ return aTimeFilter;
+}
+
+Any AnimationsImportHelperImpl::convertPath( const OUString& rValue )
+{
+ return makeAny( rValue );
+}
+
+///////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( AnimationNodeContext, SvXMLImportContext );
+
+AnimationNodeContext::AnimationNodeContext(
+ const Reference< XAnimationNode >& xParentNode,
+ SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ AnimationsImportHelperImpl* pHelper /* = NULL */ )
+: SvXMLImportContext(rImport, nPrfx, rLocalName),
+ mpHelper( pHelper ),
+ mbRootContext( pHelper == NULL )
+{
+ try
+ {
+ if( mbRootContext )
+ {
+ mpHelper = new AnimationsImportHelperImpl( rImport );
+ mxNode = xParentNode;
+ }
+ else
+ {
+ Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+
+ sal_Int16 nPresetClass = EffectPresetClass::CUSTOM;
+
+ const sal_Char* pServiceName = 0;
+
+ sal_Int16 nNodeType = (sal_Int16)mpHelper->getAnimationNodeTokenMap().Get( nPrfx, rLocalName );
+ switch( nNodeType )
+ {
+ case AnimationNodeType::SEQ: pServiceName = "com.sun.star.animations.SequenceTimeContainer"; break;
+ case AnimationNodeType::ITERATE: pServiceName = "com.sun.star.animations.IterateContainer"; break;
+ case AnimationNodeType::ANIMATE: pServiceName = "com.sun.star.animations.Animate"; break;
+ case AnimationNodeType::SET: pServiceName = "com.sun.star.animations.AnimateSet"; break;
+ case AnimationNodeType::ANIMATEMOTION: pServiceName = "com.sun.star.animations.AnimateMotion"; break;
+ case AnimationNodeType::ANIMATECOLOR: pServiceName = "com.sun.star.animations.AnimateColor"; break;
+ case AnimationNodeType::ANIMATETRANSFORM: pServiceName = "com.sun.star.animations.AnimateTransform"; break;
+ case AnimationNodeType::TRANSITIONFILTER: pServiceName = "com.sun.star.animations.TransitionFilter"; break;
+ case AnimationNodeType::AUDIO: pServiceName = "com.sun.star.animations.Audio"; break;
+ case AnimationNodeType::COMMAND: pServiceName = "com.sun.star.animations.Command"; break;
+ case AnimationNodeType::PAR:
+ {
+ const sal_Int16 nCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ sal_Int16 nAttribute;
+ for( nAttribute = 0; nAttribute < nCount; nAttribute++ )
+ {
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( xAttrList->getNameByIndex( nAttribute ), &aLocalName );
+ if( (nPrefix == XML_NAMESPACE_PRESENTATION) && IsXMLToken( aLocalName, XML_PRESET_ID ) )
+ {
+ const OUString& rValue = xAttrList->getValueByIndex( nAttribute );
+ if( rValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ooo-entrance-random" ) ) )
+ {
+ nPresetClass = EffectPresetClass::ENTRANCE;
+ }
+ else if( rValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ooo-exit-random" ) ) )
+ {
+ nPresetClass = EffectPresetClass::EXIT;
+ }
+
+ if( nPresetClass != EffectPresetClass::CUSTOM )
+ {
+ pServiceName = "com.sun.star.comp.sd.RandomAnimationNode";
+ break;
+ }
+ }
+ }
+ if( !pServiceName )
+ pServiceName = "com.sun.star.animations.ParallelTimeContainer";
+ }
+ break;
+ default:
+ pServiceName = 0;
+ }
+
+ if( pServiceName && xFactory.is() )
+ {
+ mxNode = Reference< XAnimationNode >( xFactory->createInstance(
+ OUString::createFromAscii(pServiceName) ), UNO_QUERY_THROW );
+
+ if( nPresetClass != EffectPresetClass::CUSTOM )
+ {
+ Reference< XInitialization > xInit( mxNode, UNO_QUERY_THROW );
+ const Any aAny( makeAny( nPresetClass ) );
+ Sequence< Any > aArgs( &aAny, 1 ) ;
+ xInit->initialize( aArgs );
+ }
+
+ init_node( xAttrList );
+
+ Reference< XTimeContainer > xParentContainer( xParentNode, UNO_QUERY_THROW );
+ xParentContainer->appendChild( mxNode );
+ }
+ }
+ }
+ catch( RuntimeException& )
+ {
+ OSL_FAIL( "xmloff::AnimationsImportImpl::AnimationsImportImpl(), RuntimeException catched!" );
+ }
+}
+
+AnimationNodeContext::~AnimationNodeContext()
+{
+ if( mbRootContext )
+ delete mpHelper;
+}
+
+void AnimationNodeContext::StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& )
+{
+ // code of StartElement is moved to init_node that is now called
+ // in c'tor before appending this node to its parent.
+ // This is needed for random nodes that need the correct target
+ // set when child nodes are appended.
+}
+
+void AnimationNodeContext::init_node( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList )
+{
+ if( mxNode.is() ) try
+ {
+ const sal_Int16 nNodeType = mxNode->getType();
+
+ // query for optional interfaces that are often used later
+ Reference< XAnimate > xAnimate( mxNode, UNO_QUERY );
+ Reference< XCommand > xCommand( mxNode, UNO_QUERY );
+ Reference< XTransitionFilter > xTransitionFilter( mxNode, UNO_QUERY );
+ Reference< XIterateContainer > xIter( mxNode, UNO_QUERY );
+
+ std::list< NamedValue > aUserData;
+ XMLTokenEnum meAttributeName = XML_TOKEN_INVALID;
+ OUString aFrom, aBy, aTo, aValues;
+ bool bHaveXmlId( false );
+ OUString sXmlId;
+
+ const sal_Int16 nCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ sal_uInt16 nEnum;
+ sal_Int16 nAttribute;
+ for( nAttribute = 0; nAttribute < nCount; nAttribute++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( nAttribute );
+ const OUString& rValue = xAttrList->getValueByIndex( nAttribute );
+
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName );
+ switch( mpHelper->getAnimationNodeAttributeTokenMap().Get( nPrefix, aLocalName ) )
+ {
+ case ANA_Begin:
+ {
+ mxNode->setBegin( mpHelper->convertTiming( rValue ) );
+ }
+ break;
+ case ANA_Dur:
+ {
+ mxNode->setDuration( mpHelper->convertTiming( rValue ) );
+ }
+ break;
+ case ANA_End:
+ {
+ mxNode->setEnd( mpHelper->convertTiming( rValue ) );
+ }
+ break;
+ case ANA_Fill:
+ {
+ if( SvXMLUnitConverter::convertEnum( nEnum, rValue, getAnimationsEnumMap(Animations_EnumMap_Fill) ) )
+ mxNode->setFill( (sal_Int16)nEnum );
+ }
+ break;
+ case ANA_FillDefault:
+ {
+ if( SvXMLUnitConverter::convertEnum( nEnum, rValue, getAnimationsEnumMap(Animations_EnumMap_FillDefault) ) )
+ mxNode->setFillDefault( (sal_Int16)nEnum );
+ }
+ break;
+ case ANA_Restart:
+ {
+ if( SvXMLUnitConverter::convertEnum( nEnum, rValue, getAnimationsEnumMap(Animations_EnumMap_Restart) ) )
+ mxNode->setRestart( (sal_Int16)nEnum );
+ }
+ break;
+ case ANA_RestartDefault:
+ {
+ if( SvXMLUnitConverter::convertEnum( nEnum, rValue, getAnimationsEnumMap(Animations_EnumMap_RestartDefault) ) )
+ mxNode->setRestartDefault( (sal_Int16)nEnum );
+ }
+ break;
+ case ANA_Accelerate:
+ {
+ if( isDouble( rValue ) )
+ mxNode->setAcceleration( rValue.toDouble() );
+ }
+ break;
+ case ANA_Decelerate:
+ {
+ if( isDouble( rValue ) )
+ mxNode->setDecelerate( rValue.toDouble() );
+ }
+ break;
+ case ANA_AutoReverse:
+ {
+ bool bTemp;
+ if( SvXMLUnitConverter::convertBool( bTemp, rValue ) )
+ mxNode->setAutoReverse( bTemp );
+ }
+ break;
+ case ANA_RepeatCount:
+ {
+ mxNode->setRepeatCount( mpHelper->convertTiming( rValue ) );
+ }
+ break;
+ case ANA_RepeatDur:
+ {
+ mxNode->setRepeatDuration( mpHelper->convertTiming( rValue ) );
+ }
+ break;
+ case ANA_EndSync:
+ {
+ if( SvXMLUnitConverter::convertEnum( nEnum, rValue, getAnimationsEnumMap(Animations_EnumMap_Endsync) ) )
+ mxNode->setEndSync( makeAny( (sal_Int16)nEnum ) );
+ }
+ break;
+ case ANA_Node_Type:
+ {
+ if( SvXMLUnitConverter::convertEnum( nEnum, rValue, getAnimationsEnumMap(Animations_EnumMap_EffectNodeType) ) )
+ aUserData.push_back( NamedValue( GetXMLToken( XML_NODE_TYPE ), makeAny( (sal_Int16)nEnum ) ) );
+ }
+ break;
+ case ANA_Preset_ID:
+ {
+ aUserData.push_back( NamedValue( GetXMLToken( XML_PRESET_ID ), makeAny( rValue ) ) );
+ }
+ break;
+ case ANA_Preset_Sub_Type:
+ {
+ aUserData.push_back( NamedValue( GetXMLToken( XML_PRESET_SUB_TYPE ), makeAny( rValue ) ) );
+ }
+ break;
+ case ANA_Preset_Class:
+ {
+ if( SvXMLUnitConverter::convertEnum( nEnum, rValue, getAnimationsEnumMap(Animations_EnumMap_EffectPresetClass) ) )
+ aUserData.push_back( NamedValue( GetXMLToken( XML_PRESET_CLASS ), makeAny( (sal_Int16)nEnum ) ) );
+ }
+ break;
+ case ANA_After_Effect:
+ {
+ bool bTemp;
+ if( SvXMLUnitConverter::convertBool( bTemp, rValue ) )
+ aUserData.push_back( NamedValue( GetXMLToken( XML_AFTER_EFFECT ), makeAny( bTemp ) ) );
+ }
+ break;
+ case ANA_XLink:
+ {
+ if( nNodeType == AnimationNodeType::AUDIO )
+ {
+ Reference< XAudio > xAudio( mxNode, UNO_QUERY_THROW );
+ xAudio->setSource( makeAny( GetImport().GetAbsoluteReference( rValue ) ) );
+ break;
+ }
+
+ }
+ // fall through intented!
+ case ANA_Target:
+ {
+ {
+ Any aTarget( mpHelper->convertTarget( rValue ) );
+
+ if( xAnimate.is() )
+ {
+ xAnimate->setTarget( aTarget );
+ }
+ else if( xIter.is() )
+ {
+ xIter->setTarget( aTarget );
+ }
+ else if( xCommand.is() )
+ {
+ xCommand->setTarget( aTarget );
+ }
+ }
+ }
+ break;
+
+ case ANA_Volume:
+ {
+ if( nNodeType == AnimationNodeType::AUDIO )
+ {
+ if( isDouble( rValue ) )
+ {
+ Reference< XAudio > xAudio( mxNode, UNO_QUERY_THROW );
+ xAudio->setVolume( rValue.toDouble() );
+ }
+ }
+ }
+ break;
+
+ case ANA_MasterElement:
+ {
+ Reference< XAnimationNode > xMaster( GetImport().getInterfaceToIdentifierMapper().getReference( rValue ), UNO_QUERY );
+ aUserData.push_back( NamedValue( GetXMLToken( XML_MASTER_ELEMENT ), makeAny( xMaster ) ) );
+ }
+ break;
+
+ case ANA_SubItem:
+ {
+ if( SvXMLUnitConverter::convertEnum( nEnum, rValue, getAnimationsEnumMap(Animations_EnumMap_SubItem) ) )
+ {
+ if( xAnimate.is() )
+ {
+ xAnimate->setSubItem( (sal_Int16)nEnum );
+ }
+ else if( xIter.is() )
+ {
+ xIter->setSubItem( (sal_Int16)nEnum );
+ }
+ }
+ }
+ break;
+
+ case ANA_AttributeName:
+ {
+ if( xAnimate.is() )
+ {
+ OUString aName( rValue );
+
+ ImplAttributeNameConversion* p = getAnimationAttributeNamesConversionList();
+ while( p->mpAPIName )
+ {
+ if( IsXMLToken( aName, p->meXMLToken ) )
+ {
+ aName = OUString::createFromAscii( p->mpAPIName );
+ meAttributeName = p->meXMLToken;
+ break;
+ }
+
+ p++;
+ }
+
+ xAnimate->setAttributeName( aName );
+ }
+ }
+ break;
+
+ case ANA_Values:
+ {
+ aValues = rValue;
+ }
+ break;
+
+ case ANA_From:
+ {
+ aFrom = rValue;
+ }
+ break;
+
+ case ANA_By:
+ {
+ aBy = rValue;
+ }
+ break;
+
+ case ANA_To:
+ {
+ aTo = rValue;
+ }
+ break;
+
+ case ANA_KeyTimes:
+ {
+ if( xAnimate.is() )
+ xAnimate->setKeyTimes( mpHelper->convertKeyTimes( rValue ) );
+ }
+ break;
+
+ case ANA_Formula:
+ {
+ if( xAnimate.is() )
+ xAnimate->setFormula( rValue );
+ }
+ break;
+
+ case ANA_ANIMID:
+ {
+ if (!bHaveXmlId) { sXmlId = rValue; }
+ }
+ break;
+ case ANA_XMLID:
+ {
+ sXmlId = rValue;
+ bHaveXmlId = true;
+ }
+ break;
+
+ case ANA_CalcMode:
+ {
+ if( xAnimate.is() )
+ {
+ if( SvXMLUnitConverter::convertEnum( nEnum, rValue, getAnimationsEnumMap(Animations_EnumMap_CalcMode) ) )
+ xAnimate->setCalcMode( (sal_Int16)nEnum );
+ }
+ }
+ break;
+
+ case ANA_Accumulate:
+ {
+ if( xAnimate.is() )
+ xAnimate->setAccumulate( IsXMLToken( rValue, XML_SUM ) );
+ }
+ break;
+
+ case ANA_AdditiveMode:
+ {
+ if( xAnimate.is() )
+ {
+ if( SvXMLUnitConverter::convertEnum( nEnum, rValue, getAnimationsEnumMap(Animations_EnumMap_AdditiveMode) ) )
+ xAnimate->setAdditive( (sal_Int16)nEnum );
+ }
+ }
+ break;
+
+ case ANA_KeySplines:
+ {
+ if( xAnimate.is() )
+ xAnimate->setTimeFilter( mpHelper->convertTimeFilter( rValue ) );
+ }
+ break;
+
+ case ANA_Path:
+ {
+ Reference< XAnimateMotion > xAnimateMotion( mxNode, UNO_QUERY );
+ if( xAnimateMotion.is() )
+ xAnimateMotion->setPath( mpHelper->convertPath( rValue ) );
+ }
+ break;
+
+ case ANA_ColorSpace:
+ {
+ Reference< XAnimateColor > xAnimateColor( mxNode, UNO_QUERY );
+ if( xAnimateColor.is() )
+ xAnimateColor->setColorInterpolation( IsXMLToken( rValue, XML_HSL ) ? AnimationColorSpace::HSL : AnimationColorSpace::RGB );
+ }
+ break;
+
+ case ANA_ColorDirection:
+ {
+ Reference< XAnimateColor > xAnimateColor( mxNode, UNO_QUERY );
+ if( xAnimateColor.is() )
+ xAnimateColor->setDirection( IsXMLToken( rValue, XML_CLOCKWISE ) );
+ }
+ break;
+
+ case ANA_TransformType:
+ {
+ Reference< XAnimateTransform > xTransform( mxNode, UNO_QUERY );
+ if( xTransform.is() )
+ {
+ if( SvXMLUnitConverter::convertEnum( nEnum, rValue, getAnimationsEnumMap(Animations_EnumMap_TransformType) ) )
+ {
+ xTransform->setTransformType( (sal_Int16)nEnum );
+ switch( nEnum )
+ {
+ case AnimationTransformType::SCALE: meAttributeName = XML_SCALE; break;
+ case AnimationTransformType::ROTATE: meAttributeName = XML_ROTATE; break;
+ case AnimationTransformType::SKEWX: meAttributeName = XML_SKEWX; break;
+ case AnimationTransformType::SKEWY: meAttributeName = XML_SKEWY; break;
+ //case AnimationTransformType::TRANSLATE:
+ default:
+ meAttributeName = XML_TRANSLATE; break;
+ }
+ }
+ }
+ }
+ break;
+
+ case ANA_TransitionType:
+ {
+ if( xTransitionFilter.is() )
+ {
+ if( SvXMLUnitConverter::convertEnum( nEnum, rValue, getAnimationsEnumMap(Animations_EnumMap_TransitionType) ) )
+ xTransitionFilter->setTransition( (sal_Int16)nEnum );
+ }
+ }
+ break;
+
+ case ANA_TransitionSubType:
+ {
+ if( xTransitionFilter.is() )
+ {
+ if( SvXMLUnitConverter::convertEnum( nEnum, rValue, getAnimationsEnumMap(Animations_EnumMap_TransitionSubType) ) )
+ xTransitionFilter->setSubtype( (sal_Int16)nEnum );
+ }
+ }
+ break;
+
+ case ANA_Mode:
+ {
+ if( xTransitionFilter.is() )
+ xTransitionFilter->setMode( IsXMLToken( rValue, XML_IN ) );
+ }
+ break;
+
+ case ANA_Direction:
+ {
+ if( xTransitionFilter.is() )
+ xTransitionFilter->setDirection( IsXMLToken( rValue, XML_FORWARD ) );
+ }
+ break;
+
+ case ANA_FadeColor:
+ {
+ if( xTransitionFilter.is() )
+ {
+ Color aColor;
+ SvXMLUnitConverter::convertColor( aColor, rValue );
+ xTransitionFilter->setFadeColor( static_cast< sal_Int32 >( aColor.GetRGBColor() ) );
+ }
+ }
+ break;
+
+ case ANA_IterateType:
+ {
+ if( SvXMLUnitConverter::convertEnum( nEnum, rValue, getAnimationsEnumMap(Animations_EnumMap_IterateType) ) )
+ {
+ if( xIter.is() )
+ xIter->setIterateType( (sal_Int16)nEnum );
+ }
+ }
+ break;
+
+ case ANA_IterateInterval:
+ {
+ if( xIter.is() )
+ {
+ double fInterval = 0.0;
+ if( rValue.matchAsciiL(RTL_CONSTASCII_STRINGPARAM("P")) )
+ {
+ ::Time aTime;
+ sal_Int32 nSecondsFraction = 0;
+ if( SvXMLUnitConverter::convertTimeDuration( rValue, aTime, &nSecondsFraction ) )
+ {
+ fInterval = ((((aTime.GetHour() * 60) + aTime.GetMin()) * 60) + aTime.GetSec()) + (nSecondsFraction / 1000.0);
+ }
+ }
+ else
+ {
+ fInterval = rValue.toDouble();
+ }
+
+ xIter->setIterateInterval( fInterval );
+ }
+ }
+ break;
+
+ case ANA_Group_Id:
+ {
+ aUserData.push_back( NamedValue( aLocalName, makeAny( rValue.toInt32() ) ) );
+ }
+ break;
+
+ case ANA_Command:
+ {
+ if( xCommand.is() && nNodeType == AnimationNodeType::COMMAND )
+ {
+ if( SvXMLUnitConverter::convertEnum( nEnum, rValue, getAnimationsEnumMap(Animations_EnumMap_Command) ) )
+ {
+ xCommand->setCommand( (sal_Int16)nEnum );
+ }
+ }
+ }
+ break;
+
+ default:
+ // push all unknown attributes within the presentation namespace as user data
+ if( nPrefix == XML_NAMESPACE_PRESENTATION )
+ {
+ aUserData.push_back( NamedValue( aLocalName, makeAny( rValue ) ) );
+ }
+ }
+ }
+
+ if (sXmlId.getLength())
+ {
+ Reference< XInterface > const xRef( mxNode, UNO_QUERY );
+ GetImport().getInterfaceToIdentifierMapper().registerReference(
+ sXmlId, xRef );
+ }
+
+ sal_Int32 nUserDataCount = aUserData.size();
+ if( nUserDataCount )
+ {
+ Sequence< NamedValue > aUnoUserData( nUserDataCount );
+ NamedValue* pData = aUnoUserData.getArray();
+ std::list< NamedValue >::iterator aIter( aUserData.begin() );
+ const std::list< NamedValue >::iterator aEnd( aUserData.end() );
+ while( aIter != aEnd )
+ *pData++ = (*aIter++);
+
+ mxNode->setUserData( aUnoUserData );
+ }
+
+ // convert values
+ if( xAnimate.is() )
+ {
+ if( aFrom.getLength() )
+ xAnimate->setFrom( mpHelper->convertValue( meAttributeName, aFrom ) );
+
+ if( aBy.getLength() )
+ xAnimate->setBy( mpHelper->convertValue( meAttributeName, aBy ) );
+
+ if( aTo.getLength() )
+ xAnimate->setTo( mpHelper->convertValue( meAttributeName, aTo ) );
+
+ if( aValues.getLength() )
+ xAnimate->setValues( mpHelper->convertValueSequence( meAttributeName, aValues ) );
+ }
+ }
+ catch( RuntimeException& )
+ {
+ OSL_FAIL( "xmloff::AnimationNodeContext::StartElement(), RuntimeException catched!" );
+ }
+}
+
+SvXMLImportContext * AnimationNodeContext::CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList )
+{
+ if( mxNode.is())
+ return new AnimationNodeContext( mxNode, GetImport(), nPrefix, rLocalName, xAttrList, mpHelper );
+ else
+ return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+}
+
+// --------------------------------------------------------------------
+
+class AnimationsImport: public SvXMLImport, public XAnimationNodeSupplier
+{
+public:
+ AnimationsImport( const Reference< XMultiServiceFactory > & rSMgr );
+ ~AnimationsImport() throw ();
+
+ SvXMLImportContext* CreateContext(sal_uInt16 nPrefix, const OUString& rLocalName, const Reference<XAttributeList>& xAttrList);
+
+ // XInterface
+ virtual Any SAL_CALL queryInterface( const Type& aType ) throw (RuntimeException);
+ virtual void SAL_CALL acquire() throw ();
+ virtual void SAL_CALL release() throw ();
+
+ // XAnimationNodeSupplier
+ Reference< XAnimationNode > SAL_CALL getAnimationNode() throw (RuntimeException);
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(RuntimeException);
+ virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException);
+
+private:
+ Reference< XAnimationNode > mxRootNode;
+};
+
+AnimationsImport::AnimationsImport( const Reference< XMultiServiceFactory > & rSMgr )
+: SvXMLImport( rSMgr, true )
+{
+ // add namespaces
+ GetNamespaceMap().Add(
+ GetXMLToken(XML_NP_PRESENTATION),
+ GetXMLToken(XML_N_PRESENTATION),
+ XML_NAMESPACE_PRESENTATION);
+
+ GetNamespaceMap().Add(
+ GetXMLToken(XML_NP_SMIL),
+ GetXMLToken(XML_N_SMIL),
+ XML_NAMESPACE_SMIL);
+
+ GetNamespaceMap().Add(
+ GetXMLToken(XML_NP_ANIMATION),
+ GetXMLToken(XML_N_ANIMATION),
+ XML_NAMESPACE_ANIMATION);
+
+ mxRootNode = Reference< XAnimationNode >::query(rSMgr->createInstance(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.animations.SequenceTimeContainer"))));
+}
+
+AnimationsImport::~AnimationsImport() throw ()
+{
+}
+
+// XInterface
+Any SAL_CALL AnimationsImport::queryInterface( const Type& aType ) throw (RuntimeException)
+{
+ if ( aType == ::getCppuType((Reference<XAnimationNodeSupplier> *)0) )
+ {
+ return makeAny( Reference<XAnimationNodeSupplier>( this ) );
+ }
+ else
+ {
+ return SvXMLImport::queryInterface( aType );
+ }
+}
+
+void SAL_CALL AnimationsImport::acquire() throw ()
+{
+ SvXMLImport::acquire();
+}
+
+void SAL_CALL AnimationsImport::release() throw ()
+{
+ SvXMLImport::release();
+}
+
+SvXMLImportContext *AnimationsImport::CreateContext(sal_uInt16 nPrefix, const OUString& rLocalName, const Reference<XAttributeList>& xAttrList)
+{
+ SvXMLImportContext* pContext = 0;
+
+ if( (XML_NAMESPACE_ANIMATION == nPrefix) && IsXMLToken( rLocalName, XML_SEQ ) )
+ {
+ pContext = new AnimationNodeContext( mxRootNode, *this, nPrefix, rLocalName, xAttrList );
+ }
+ else
+ {
+ pContext = SvXMLImport::CreateContext(nPrefix, rLocalName, xAttrList);
+ }
+
+ return pContext;
+}
+
+// XAnimationNodeSupplier
+Reference< XAnimationNode > SAL_CALL AnimationsImport::getAnimationNode() throw (RuntimeException)
+{
+ return mxRootNode;
+}
+
+void AnimationNodeContext::postProcessRootNode( SvXMLImport& /*rImport*/, const Reference< XAnimationNode >& xRootNode, Reference< XPropertySet >& xPageProps )
+{
+ if( xRootNode.is() && xPageProps.is() ) try
+ {
+ Reference< XEnumerationAccess > xEnumerationAccess( xRootNode, UNO_QUERY_THROW );
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY_THROW );
+ if( xEnumeration->hasMoreElements() )
+ {
+ Reference< XAnimationNode > xNode( xEnumeration->nextElement(), UNO_QUERY_THROW );
+ if( xNode->getType() == AnimationNodeType::PAR )
+ {
+ Event aEvent;
+ if( (xNode->getBegin() >>= aEvent) && (aEvent.Trigger == EventTrigger::BEGIN_EVENT) )
+ {
+ // found transition node
+ Reference< XEnumerationAccess > xChildEnumerationAccess( xNode, UNO_QUERY_THROW );
+ Reference< XEnumeration > xChildEnumeration( xChildEnumerationAccess->createEnumeration(), UNO_QUERY_THROW );
+ while( xChildEnumeration->hasMoreElements() )
+ {
+ Reference< XAnimationNode > xChildNode( xChildEnumeration->nextElement(), UNO_QUERY_THROW );
+ switch( xChildNode->getType() )
+ {
+ case AnimationNodeType::TRANSITIONFILTER:
+ {
+ Reference< XTransitionFilter > xTransFilter( xChildNode, UNO_QUERY_THROW );
+
+
+ xPageProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TransitionType" ) ), Any( xTransFilter->getTransition() ) );
+ xPageProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TransitionSubtype" ) ), Any( xTransFilter->getSubtype() ) );
+ xPageProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TransitionDirection" ) ), Any( xTransFilter->getDirection() ) );
+ xPageProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TransitionFadeColor" ) ), Any( xTransFilter->getFadeColor() ) );
+
+ double fDuration;
+ if( xTransFilter->getDuration() >>= fDuration )
+ xPageProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TransitionDuration" ) ), Any( fDuration ) );
+
+ }
+ break;
+
+ case AnimationNodeType::COMMAND:
+ {
+ Reference< XCommand > xCommand( xChildNode, UNO_QUERY_THROW );
+ if( xCommand->getCommand() == EffectCommands::STOPAUDIO )
+ {
+ xPageProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Sound" ) ), Any(sal_True) );
+ }
+ }
+ break;
+
+ case AnimationNodeType::AUDIO:
+ {
+ Reference< XAudio > xAudio( xChildNode, UNO_QUERY_THROW );
+ OUString sSoundURL;
+ if( (xAudio->getSource() >>= sSoundURL) && (sSoundURL.getLength() != 0) )
+ {
+ xPageProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Sound" ) ), Any(sSoundURL) );
+
+ Timing eTiming;
+ if( (xAudio->getRepeatCount() >>= eTiming) && (eTiming == Timing_INDEFINITE) )
+ xPageProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "LoopSound" ) ), Any( sal_True ) );
+ }
+ }
+ break;
+
+ }
+ }
+
+ Reference< XTimeContainer > xRootContainer( xRootNode, UNO_QUERY_THROW );
+ xRootContainer->removeChild( xNode );
+ }
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL("xmloff::AnimationsImport::postProcessRootNode(), exception caught!");
+ }
+}
+
+} // namespace xmloff
+
+Sequence< OUString > SAL_CALL AnimationsImport_getSupportedServiceNames() throw()
+{
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Xmloff.AnimationsImport" ) );
+ const Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+OUString SAL_CALL AnimationsImport_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "xmloff::AnimationsImport" ) );
+}
+
+Reference< XInterface > SAL_CALL AnimationsImport_createInstance(const Reference< XMultiServiceFactory > & rSMgr) throw( Exception )
+{
+ return (cppu::OWeakObject*)new xmloff::AnimationsImport( rSMgr );
+
+}
+
+namespace xmloff
+{
+
+OUString SAL_CALL AnimationsImport::getImplementationName() throw(RuntimeException)
+{
+ return AnimationsImport_getImplementationName();
+}
+
+sal_Bool SAL_CALL AnimationsImport::supportsService( const OUString& ServiceName ) throw(RuntimeException)
+{
+ return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.comp.Xmloff.AnimationsImport" ) );
+}
+
+Sequence< OUString > SAL_CALL AnimationsImport::getSupportedServiceNames() throw(RuntimeException)
+{
+ return AnimationsImport_getSupportedServiceNames();
+}
+
+} // namespace xmloff
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/animexp.cxx b/xmloff/source/draw/animexp.cxx
new file mode 100644
index 000000000000..312b7d7ab5fc
--- /dev/null
+++ b/xmloff/source/draw/animexp.cxx
@@ -0,0 +1,556 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <tools/debug.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/presentation/AnimationSpeed.hpp>
+#include "unointerfacetouniqueidentifiermapper.hxx"
+
+#include <list>
+#include <comphelper/extract.hxx>
+#include <tools/color.hxx>
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmlement.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/shapeexport.hxx>
+#include "anim.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::std;
+using namespace ::cppu;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::presentation;
+using namespace ::xmloff::token;
+
+
+const struct Effect
+{
+ XMLEffect meKind;
+ XMLEffectDirection meDirection;
+ sal_Int16 mnStartScale;
+ sal_Bool mbIn;
+}
+ AnimationEffectMap[] =
+{
+ { EK_none, ED_none, -1, sal_True }, // AnimationEffect_NONE
+ { EK_fade, ED_from_left, -1, sal_True }, // AnimationEffect_FADE_FROM_LEFT
+ { EK_fade, ED_from_top, -1, sal_True }, // AnimationEffect_FADE_FROM_TOP
+ { EK_fade, ED_from_right, -1, sal_True }, // AnimationEffect_FADE_FROM_RIGHT
+ { EK_fade, ED_from_bottom, -1, sal_True }, // AnimationEffect_FADE_FROM_BOTTOM
+ { EK_fade, ED_to_center, -1, sal_True }, // AnimationEffect_FADE_TO_CENTER
+ { EK_fade, ED_from_center, -1, sal_True }, // AnimationEffect_FADE_FROM_CENTER
+ { EK_move, ED_from_left, -1, sal_True }, // AnimationEffect_MOVE_FROM_LEFT
+ { EK_move, ED_from_top, -1, sal_True }, // AnimationEffect_MOVE_FROM_TOP
+ { EK_move, ED_from_right, -1, sal_True }, // AnimationEffect_MOVE_FROM_RIGHT
+ { EK_move, ED_from_bottom, -1, sal_True }, // AnimationEffect_MOVE_FROM_BOTTOM
+ { EK_stripes, ED_vertical, -1, sal_True }, // AnimationEffect_VERTICAL_STRIPES
+ { EK_stripes, ED_horizontal, -1, sal_True }, // AnimationEffect_HORIZONTAL_STRIPES
+ { EK_fade, ED_clockwise, -1, sal_True }, // AnimationEffect_CLOCKWISE
+ { EK_fade, ED_cclockwise, -1, sal_True }, // AnimationEffect_COUNTERCLOCKWISE
+ { EK_fade, ED_from_upperleft, -1, sal_True }, // AnimationEffect_FADE_FROM_UPPERLEFT
+ { EK_fade, ED_from_upperright, -1, sal_True }, // AnimationEffect_FADE_FROM_UPPERRIGHT
+ { EK_fade, ED_from_lowerleft, -1, sal_True }, // AnimationEffect_FADE_FROM_LOWERLEFT
+ { EK_fade, ED_from_lowerright, -1, sal_True }, // AnimationEffect_FADE_FROM_LOWERRIGHT
+ { EK_close,ED_vertical, -1, sal_True }, // AnimationEffect_CLOSE_VERTICAL
+ { EK_close,ED_horizontal, -1, sal_True }, // AnimationEffect_CLOSE_HORIZONTAL
+ { EK_open, ED_vertical, -1, sal_True }, // AnimationEffect_OPEN_VERTICAL
+ { EK_open, ED_horizontal, -1, sal_True }, // AnimationEffect_OPEN_HORIZONTAL
+ { EK_move, ED_path, -1, sal_True }, // AnimationEffect_PATH
+ { EK_move, ED_to_left, -1, sal_False },// AnimationEffect_MOVE_TO_LEFT
+ { EK_move, ED_to_top, -1, sal_False },// AnimationEffect_MOVE_TO_TOP
+ { EK_move, ED_to_right, -1, sal_False },// AnimationEffect_MOVE_TO_RIGHT
+ { EK_move, ED_to_bottom, -1, sal_False },// AnimationEffect_MOVE_TO_BOTTOM
+ { EK_fade, ED_spiral_inward_left, -1, sal_True }, // AnimationEffect_SPIRALIN_LEFT
+ { EK_fade, ED_spiral_inward_right, -1, sal_True }, // AnimationEffect_SPIRALIN_RIGHT
+ { EK_fade, ED_spiral_outward_left, -1, sal_True }, // AnimationEffect_SPIRALOUT_LEFT
+ { EK_fade, ED_spiral_outward_right, -1, sal_True }, // AnimationEffect_SPIRALOUT_RIGHT
+ { EK_dissolve, ED_none, -1, sal_True }, // AnimationEffect_DISSOLVE
+ { EK_wavyline, ED_from_left, -1, sal_True }, // AnimationEffect_WAVYLINE_FROM_LEFT
+ { EK_wavyline, ED_from_top, -1, sal_True }, // AnimationEffect_WAVYLINE_FROM_TOP
+ { EK_wavyline, ED_from_right, -1, sal_True }, // AnimationEffect_WAVYLINE_FROM_RIGHT
+ { EK_wavyline, ED_from_bottom, -1, sal_True }, // AnimationEffect_WAVYLINE_FROM_BOTTOM
+ { EK_random, ED_none, -1, sal_True }, // AnimationEffect_RANDOM
+ { EK_lines, ED_vertical, -1, sal_True }, // AnimationEffect_VERTICAL_LINES
+ { EK_lines, ED_horizontal, -1, sal_True }, // AnimationEffect_HORIZONTAL_LINES
+ { EK_laser, ED_from_left, -1, sal_True }, // AnimationEffect_LASER_FROM_LEFT
+ { EK_laser, ED_from_top, -1, sal_True }, // AnimationEffect_LASER_FROM_TOP
+ { EK_laser, ED_from_right, -1, sal_True }, // AnimationEffect_LASER_FROM_RIGHT
+ { EK_laser, ED_from_bottom, -1, sal_True }, // AnimationEffect_LASER_FROM_BOTTOM
+ { EK_laser, ED_from_upperleft, -1, sal_True }, // AnimationEffect_LASER_FROM_UPPERLEFT
+ { EK_laser, ED_from_upperright, -1, sal_True }, // AnimationEffect_LASER_FROM_UPPERRIGHT
+ { EK_laser, ED_from_lowerleft, -1, sal_True }, // AnimationEffect_LASER_FROM_LOWERLEFT
+ { EK_laser, ED_from_lowerright, -1, sal_True }, // AnimationEffect_LASER_FROM_LOWERRIGHT
+ { EK_appear,ED_none, -1, sal_True }, // AnimationEffect_APPEAR
+ { EK_hide, ED_none, -1, sal_False },// AnimationEffect_HIDE
+ { EK_move, ED_from_upperleft, -1, sal_True }, // AnimationEffect_MOVE_FROM_UPPERLEFT
+ { EK_move, ED_from_upperright, -1, sal_True }, // AnimationEffect_MOVE_FROM_UPPERRIGHT
+ { EK_move, ED_from_lowerright, -1, sal_True }, // AnimationEffect_MOVE_FROM_LOWERRIGHT
+ { EK_move, ED_from_lowerleft, -1, sal_True }, // AnimationEffect_MOVE_FROM_LOWERLEFT
+ { EK_move, ED_to_upperleft, -1, sal_False },// AnimationEffect_MOVE_TO_UPPERLEFT
+ { EK_move, ED_to_upperright, -1, sal_False },// AnimationEffect_MOVE_TO_UPPERRIGHT
+ { EK_move, ED_to_lowerright, -1, sal_False },// AnimationEffect_MOVE_TO_LOWERRIGHT
+ { EK_move, ED_to_lowerleft, -1, sal_False },// AnimationEffect_MOVE_TO_LOWERLEFT
+ { EK_move_short, ED_from_left, -1, sal_True }, // AnimationEffect_MOVE_SHORT_FROM_LEFT
+ { EK_move_short, ED_from_upperleft, -1, sal_True }, // AnimationEffect_MOVE_SHORT_FROM_UPPERLEFT
+ { EK_move_short, ED_from_top, -1, sal_True }, // AnimationEffect_MOVE_SHORT_FROM_TOP
+ { EK_move_short, ED_from_upperright,-1, sal_True }, // AnimationEffect_MOVE_SHORT_FROM_UPPERRIGHT
+ { EK_move_short, ED_from_right, -1, sal_True }, // AnimationEffect_MOVE_SHORT_FROM_RIGHT
+ { EK_move_short, ED_from_lowerright,-1, sal_True }, // AnimationEffect_MOVE_SHORT_FROM_LOWERRIGHT
+ { EK_move_short, ED_from_bottom, -1, sal_True }, // AnimationEffect_MOVE_SHORT_FROM_BOTTOM
+ { EK_move_short, ED_from_lowerleft, -1, sal_True }, // AnimationEffect_MOVE_SHORT_FROM_LOWERLEFT
+ { EK_move_short, ED_to_left, -1, sal_False },// AnimationEffect_MOVE_SHORT_TO_LEFT
+ { EK_move_short, ED_to_upperleft, -1, sal_False },// AnimationEffect_MOVE_SHORT_TO_UPPERLEFT
+ { EK_move_short, ED_to_top, -1, sal_False },// AnimationEffect_MOVE_SHORT_TO_TOP
+ { EK_move_short, ED_to_upperright, -1, sal_False },// AnimationEffect_MOVE_SHORT_TO_UPPERRIGHT
+ { EK_move_short, ED_to_right, -1, sal_False },// AnimationEffect_MOVE_SHORT_TO_RIGHT
+ { EK_move_short, ED_to_lowerright, -1, sal_False },// AnimationEffect_MOVE_SHORT_TO_LOWERRIGHT
+ { EK_move_short, ED_to_bottom, -1, sal_False },// AnimationEffect_MOVE_SHORT_TO_BOTTOM
+ { EK_move_short, ED_to_lowerleft, -1, sal_False },// AnimationEffect_MOVE_SHORT_TO_LOWERLEFT
+ { EK_checkerboard, ED_vertical, -1, sal_True }, // AnimationEffect_VERTICAL_CHECKERBOARD
+ { EK_checkerboard, ED_horizontal, -1, sal_True }, // AnimationEffect_HORIZONTAL_CHECKERBOARD
+ { EK_rotate, ED_horizontal, -1, sal_True }, // AnimationEffect_HORIZONTAL_ROTATE
+ { EK_rotate, ED_vertical, -1, sal_True }, // AnimationEffect_VERTICAL_ROTATE
+ { EK_stretch,ED_horizontal, -1, sal_True }, // AnimationEffect_HORIZONTAL_STRETCH
+ { EK_stretch,ED_vertical, -1, sal_True }, // AnimationEffect_VERTICAL_STRETCH
+ { EK_stretch,ED_from_left, -1, sal_True }, // AnimationEffect_STRETCH_FROM_LEFT
+ { EK_stretch,ED_from_upperleft, -1, sal_True }, // AnimationEffect_STRETCH_FROM_UPPERLEFT
+ { EK_stretch,ED_from_top, -1, sal_True }, // AnimationEffect_STRETCH_FROM_TOP
+ { EK_stretch,ED_from_upperright,-1, sal_True }, // AnimationEffect_STRETCH_FROM_UPPERRIGHT
+ { EK_stretch,ED_from_right, -1, sal_True }, // AnimationEffect_STRETCH_FROM_RIGHT
+ { EK_stretch,ED_from_lowerright,-1, sal_True }, // AnimationEffect_STRETCH_FROM_LOWERRIGHT
+ { EK_stretch,ED_from_bottom, -1, sal_True }, // AnimationEffect_STRETCH_FROM_BOTTOM
+ { EK_stretch,ED_from_lowerleft, -1, sal_True }, // AnimationEffect_STRETCH_FROM_LOWERLEFT
+ { EK_move, ED_none, 0, sal_True }, // AnimationEffect_ZOOM_IN
+ { EK_move, ED_none, 50, sal_True }, // AnimationEffect_ZOOM_IN_SMALL
+ { EK_move, ED_spiral_inward_left, 0, sal_True }, // AnimationEffect_ZOOM_IN_SPIRAL
+ { EK_move, ED_none, 400, sal_True }, // AnimationEffect_ZOOM_OUT
+ { EK_move, ED_none, 200, sal_True }, // AnimationEffect_ZOOM_OUT_SMALL
+ { EK_move, ED_spiral_inward_left, 400, sal_True }, // AnimationEffect_ZOOM_OUT_SPIRAL
+ { EK_move, ED_from_left, 0, sal_True }, // AnimationEffect_ZOOM_IN_FROM_LEFT
+ { EK_move, ED_from_upperleft, 0, sal_True }, // AnimationEffect_ZOOM_IN_FROM_UPPERLEFT
+ { EK_move, ED_from_top, 0, sal_True }, // AnimationEffect_ZOOM_IN_FROM_TOP
+ { EK_move, ED_from_upperright, 0, sal_True }, // AnimationEffect_ZOOM_IN_FROM_UPPERRIGHT
+ { EK_move, ED_from_right, 0, sal_True }, // AnimationEffect_ZOOM_IN_FROM_RIGHT
+ { EK_move, ED_from_lowerright, 0, sal_True }, // AnimationEffect_ZOOM_IN_FROM_LOWERRIGHT
+ { EK_move, ED_from_bottom, 0, sal_True }, // AnimationEffect_ZOOM_IN_FROM_BOTTOM
+ { EK_move, ED_from_lowerleft, 0, sal_True }, // AnimationEffect_ZOOM_IN_FROM_LOWERLEFT
+ { EK_move, ED_from_center, 0, sal_True }, // AnimationEffect_ZOOM_IN_FROM_CENTER
+ { EK_move, ED_from_left, 400, sal_True }, // AnimationEffect_ZOOM_OUT_FROM_LEFT
+ { EK_move, ED_from_upperleft, 400, sal_True }, // AnimationEffect_ZOOM_OUT_FROM_UPPERLEFT
+ { EK_move, ED_from_top, 400, sal_True }, // AnimationEffect_ZOOM_OUT_FROM_TOP
+ { EK_move, ED_from_upperright,400, sal_True }, // AnimationEffect_ZOOM_OUT_FROM_UPPERRIGHT
+ { EK_move, ED_from_right, 400, sal_True }, // AnimationEffect_ZOOM_OUT_FROM_RIGHT
+ { EK_move, ED_from_lowerright,400, sal_True }, // AnimationEffect_ZOOM_OUT_FROM_LOWERRIGHT
+ { EK_move, ED_from_bottom, 400, sal_True }, // AnimationEffect_ZOOM_OUT_FROM_BOTTOM
+ { EK_move, ED_from_lowerleft, 400, sal_True }, // AnimationEffect_ZOOM_OUT_FROM_LOWERLEFT
+ { EK_move, ED_from_center, 400, sal_True } // AnimationEffect_ZOOM_OUT_FROM_CENTER
+};
+
+void SdXMLImplSetEffect( AnimationEffect eEffect, XMLEffect& eKind, XMLEffectDirection& eDirection, sal_Int16& nStartScale, sal_Bool& bIn )
+{
+ if( eEffect < AnimationEffect_NONE || eEffect > AnimationEffect_ZOOM_OUT_FROM_CENTER )
+ {
+ OSL_FAIL( "unknown animation effect!" );
+ eEffect = AnimationEffect_NONE;
+ }
+
+ const Effect& rEffect = AnimationEffectMap[eEffect];
+ eKind = rEffect.meKind;
+ eDirection = rEffect.meDirection;
+ nStartScale = rEffect.mnStartScale;
+ bIn = rEffect.mbIn;
+}
+
+enum XMLActionKind
+{
+ XMLE_SHOW,
+ XMLE_HIDE,
+ XMLE_DIM,
+ XMLE_PLAY
+};
+
+struct XMLEffectHint
+{
+ XMLActionKind meKind;
+ sal_Bool mbTextEffect;
+ Reference<XShape> mxShape;
+
+ XMLEffect meEffect;
+ XMLEffectDirection meDirection;
+ sal_Int16 mnStartScale;
+
+ AnimationSpeed meSpeed;
+ Color maDimColor;
+ OUString maSoundURL;
+ sal_Bool mbPlayFull;
+ sal_Int32 mnPresId;
+ sal_Int32 mnPathShapeId;
+
+ int operator<(const XMLEffectHint& rComp) const { return mnPresId < rComp.mnPresId; }
+
+ XMLEffectHint()
+ : meKind( XMLE_SHOW ), mbTextEffect( sal_False ),
+ meEffect( EK_none ), meDirection( ED_none ), mnStartScale( -1 ),
+ meSpeed( AnimationSpeed_SLOW ), maDimColor(0), mbPlayFull( sal_False ),
+ mnPresId( 0 ), mnPathShapeId( -1 )
+ {}
+};
+
+class AnimExpImpl
+{
+public:
+ list<XMLEffectHint> maEffects;
+ UniReference< XMLShapeExport > mxShapeExp;
+
+ OUString msDimColor;
+ OUString msDimHide;
+ OUString msDimPrev;
+ OUString msEffect;
+ OUString msPlayFull;
+ OUString msPresOrder;
+ OUString msSound;
+ OUString msSoundOn;
+ OUString msSpeed;
+ OUString msTextEffect;
+ OUString msIsAnimation;
+ OUString msAnimPath;
+
+ AnimExpImpl()
+ : msDimColor( RTL_CONSTASCII_USTRINGPARAM( "DimColor" ) ),
+ msDimHide( RTL_CONSTASCII_USTRINGPARAM( "DimHide" ) ),
+ msDimPrev( RTL_CONSTASCII_USTRINGPARAM( "DimPrevious" ) ),
+ msEffect( RTL_CONSTASCII_USTRINGPARAM( "Effect" ) ),
+ msPlayFull( RTL_CONSTASCII_USTRINGPARAM( "PlayFull" ) ),
+ msPresOrder( RTL_CONSTASCII_USTRINGPARAM( "PresentationOrder" ) ),
+ msSound( RTL_CONSTASCII_USTRINGPARAM( "Sound" ) ),
+ msSoundOn( RTL_CONSTASCII_USTRINGPARAM( "SoundOn" ) ),
+ msSpeed( RTL_CONSTASCII_USTRINGPARAM( "Speed" ) ),
+ msTextEffect( RTL_CONSTASCII_USTRINGPARAM( "TextEffect" ) ),
+ msIsAnimation( RTL_CONSTASCII_USTRINGPARAM( "IsAnimation" ) ),
+ msAnimPath( RTL_CONSTASCII_USTRINGPARAM( "AnimationPath" ) )
+ {}
+};
+
+XMLAnimationsExporter::XMLAnimationsExporter( XMLShapeExport* pShapeExp )
+{
+ mpImpl = new AnimExpImpl;
+ mpImpl->mxShapeExp = pShapeExp;
+}
+
+XMLAnimationsExporter::~XMLAnimationsExporter()
+{
+ delete mpImpl;
+ mpImpl = NULL;
+}
+
+void XMLAnimationsExporter::prepare( Reference< XShape > xShape, SvXMLExport& )
+{
+ try
+ {
+ // check for presentation shape service
+ {
+ Reference< XServiceInfo > xServiceInfo( xShape, UNO_QUERY );
+ if( !xServiceInfo.is() || !xServiceInfo->supportsService( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.Shape" ) ) ) )
+ return;
+ }
+
+ Reference< XPropertySet > xProps( xShape, UNO_QUERY );
+ if( xProps.is() )
+ {
+ AnimationEffect eEffect;
+ xProps->getPropertyValue( mpImpl->msEffect ) >>= eEffect;
+ if( eEffect == AnimationEffect_PATH )
+ {
+ Reference< XShape > xPath;
+ xProps->getPropertyValue( mpImpl->msAnimPath ) >>= xPath;
+// strip if( xPath.is() )
+// strip mrExport.getInterfaceToIdentifierMapper()->registerReference( xShape );
+// strip mpImpl->mxShapeExp->createShapeId( xPath );
+ }
+ }
+ }
+ catch( Exception e )
+ {
+ OSL_FAIL("exception catched while collection animation information!");
+ }
+}
+
+void XMLAnimationsExporter::collect( Reference< XShape > xShape, SvXMLExport& rExport )
+{
+ try
+ {
+ // check for presentation shape service
+ {
+ Reference< XServiceInfo > xServiceInfo( xShape, UNO_QUERY );
+ if( !xServiceInfo.is() || !xServiceInfo->supportsService( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.Shape" ) ) ) )
+ return;
+ }
+
+ Reference< XPropertySet > xProps( xShape, UNO_QUERY );
+ if( xProps.is() )
+ {
+ const OUString aEmptyStr;
+
+ Reference< XPropertySetInfo > xInfo( xProps->getPropertySetInfo() );
+ AnimationEffect eEffect;
+ XMLEffectHint aEffect;
+
+ if( any2bool( xProps->getPropertyValue( mpImpl->msSoundOn ) ) )
+ {
+ xProps->getPropertyValue( mpImpl->msSound ) >>= aEffect.maSoundURL;
+ xProps->getPropertyValue( mpImpl->msPlayFull ) >>= aEffect.mbPlayFull;
+ }
+
+ xProps->getPropertyValue( mpImpl->msPresOrder ) >>= aEffect.mnPresId;
+ xProps->getPropertyValue( mpImpl->msSpeed ) >>= aEffect.meSpeed;
+
+
+ sal_Bool bIsAnimation = false;
+ xProps->getPropertyValue( mpImpl->msIsAnimation ) >>= bIsAnimation;
+ if( bIsAnimation )
+ {
+ aEffect.meKind = XMLE_PLAY;
+
+ if( !aEffect.mxShape.is() )
+ {
+ rExport.getInterfaceToIdentifierMapper().registerReference( xShape );
+ aEffect.mxShape = xShape;
+ }
+
+ mpImpl->maEffects.push_back( aEffect );
+ }
+
+ {
+
+ xProps->getPropertyValue( mpImpl->msEffect ) >>= eEffect;
+ if( eEffect != AnimationEffect_NONE )
+ {
+ sal_Bool bIn = sal_True;
+ SdXMLImplSetEffect( eEffect, aEffect.meEffect, aEffect.meDirection, aEffect.mnStartScale, bIn );
+
+ aEffect.meKind = bIn ? XMLE_SHOW : XMLE_HIDE;
+
+ if( !aEffect.mxShape.is() )
+ {
+ rExport.getInterfaceToIdentifierMapper().registerReference( xShape );
+ aEffect.mxShape = xShape;
+ }
+
+ if( eEffect == AnimationEffect_PATH )
+ {
+ Reference< XShape > xPath;
+ xProps->getPropertyValue( mpImpl->msAnimPath ) >>= xPath;
+ if( xPath.is() )
+ {
+// strip mpImpl->mxShapeExp->createShapeId( xPath );
+// strip aEffect.mnPathShapeId = mpImpl->mxShapeExp->getShapeId( xPath );
+ }
+ }
+ mpImpl->maEffects.push_back( aEffect );
+
+ aEffect.mnPathShapeId = -1;
+ aEffect.maSoundURL = aEmptyStr;
+ }
+
+ xProps->getPropertyValue( mpImpl->msTextEffect ) >>= eEffect;
+ if( eEffect != AnimationEffect_NONE )
+ {
+ sal_Bool bIn = sal_True;
+ SdXMLImplSetEffect( eEffect, aEffect.meEffect, aEffect.meDirection, aEffect.mnStartScale, bIn );
+ aEffect.meKind = bIn ? XMLE_SHOW : XMLE_HIDE;
+ aEffect.mbTextEffect = sal_True;
+
+ if( !aEffect.mxShape.is() )
+ {
+ rExport.getInterfaceToIdentifierMapper().registerReference( xShape );
+ aEffect.mxShape = xShape;
+ }
+
+ mpImpl->maEffects.push_back( aEffect );
+ aEffect.mbTextEffect = sal_False;
+ aEffect.maSoundURL = aEmptyStr;
+ }
+
+ sal_Bool bDimPrev = false;
+ sal_Bool bDimHide = false;
+ xProps->getPropertyValue( mpImpl->msDimPrev ) >>= bDimPrev;
+ xProps->getPropertyValue( mpImpl->msDimHide ) >>= bDimHide;
+ if( bDimPrev || bDimHide )
+ {
+ aEffect.meKind = bDimPrev ? XMLE_DIM : XMLE_HIDE;
+ aEffect.meEffect = EK_none;
+ aEffect.meDirection = ED_none;
+ aEffect.meSpeed = AnimationSpeed_MEDIUM;
+ if( bDimPrev )
+ {
+ sal_Int32 nColor = 0;
+ xProps->getPropertyValue( mpImpl->msDimColor ) >>= nColor;
+ aEffect.maDimColor.SetColor( nColor );
+ }
+
+ if( !aEffect.mxShape.is() )
+ {
+ rExport.getInterfaceToIdentifierMapper().registerReference( xShape );
+ aEffect.mxShape = xShape;
+ }
+
+ mpImpl->maEffects.push_back( aEffect );
+ aEffect.maSoundURL = aEmptyStr;
+ }
+ }
+ }
+ }
+ catch( Exception e )
+ {
+ OSL_FAIL("exception catched while collection animation information!");
+ }
+}
+
+void XMLAnimationsExporter::exportAnimations( SvXMLExport& rExport )
+{
+ mpImpl->maEffects.sort();
+
+ list<XMLEffectHint>::iterator aIter = mpImpl->maEffects.begin();
+ const list<XMLEffectHint>::iterator aEnd = mpImpl->maEffects.end();
+
+ OUStringBuffer sTmp;
+
+ if( aIter != aEnd )
+ {
+ SvXMLElementExport aElement( rExport, XML_NAMESPACE_PRESENTATION, XML_ANIMATIONS, sal_True, sal_True );
+
+ do
+ {
+ XMLEffectHint& rEffect = *aIter;
+
+ DBG_ASSERT( rEffect.mxShape.is(), "shape id creation failed for animation effect?" );
+
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_SHAPE_ID, rExport.getInterfaceToIdentifierMapper().getIdentifier( rEffect.mxShape ) );
+
+ if( rEffect.meKind == XMLE_DIM )
+ {
+ // export a dim action;
+
+ SvXMLUnitConverter::convertColor( sTmp, rEffect.maDimColor );
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_COLOR, sTmp.makeStringAndClear() );
+
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_PRESENTATION, XML_DIM, sal_True, sal_True );
+ }
+ else if( rEffect.meKind == XMLE_PLAY )
+ {
+ if( rEffect.meSpeed != AnimationSpeed_MEDIUM )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, rEffect.meSpeed, aXML_AnimationSpeed_EnumMap );
+ rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_SPEED, sTmp.makeStringAndClear() );
+ }
+
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_PRESENTATION, XML_PLAY, sal_True, sal_True );
+ }
+ else
+ {
+
+ if( rEffect.meEffect != EK_none )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, rEffect.meEffect, aXML_AnimationEffect_EnumMap );
+ rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_EFFECT, sTmp.makeStringAndClear() );
+ }
+
+ if( rEffect.meDirection != ED_none )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, rEffect.meDirection, aXML_AnimationDirection_EnumMap );
+ rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_DIRECTION, sTmp.makeStringAndClear() );
+ }
+
+ if( rEffect.mnStartScale != -1 )
+ {
+ SvXMLUnitConverter::convertPercent( sTmp, rEffect.mnStartScale );
+ rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_START_SCALE, sTmp.makeStringAndClear() );
+ }
+
+ if( rEffect.meSpeed != AnimationSpeed_MEDIUM )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, rEffect.meSpeed, aXML_AnimationSpeed_EnumMap );
+ rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_SPEED, sTmp.makeStringAndClear() );
+ }
+
+ if( rEffect.mnPathShapeId != -1 )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_PATH_ID, OUString::valueOf( rEffect.mnPathShapeId ) );
+ }
+
+ enum XMLTokenEnum eLocalName;
+ if( rEffect.meKind == XMLE_SHOW )
+ {
+ if( rEffect.mbTextEffect )
+ eLocalName = XML_SHOW_TEXT;
+ else
+ eLocalName = XML_SHOW_SHAPE;
+ }
+ else
+ {
+ if( rEffect.mbTextEffect )
+ eLocalName = XML_HIDE_TEXT;
+ else
+ eLocalName = XML_HIDE_SHAPE;
+ }
+
+ SvXMLElementExport aEle( rExport, XML_NAMESPACE_PRESENTATION, eLocalName, sal_True, sal_True );
+ if( rEffect.maSoundURL.getLength() != 0 )
+ {
+ rExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, rExport.GetRelativeReference(rEffect.maSoundURL) );
+ rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_NEW );
+ rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONREQUEST );
+ if( rEffect.mbPlayFull )
+ rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_PLAY_FULL, XML_TRUE );
+
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_PRESENTATION, XML_SOUND, sal_True, sal_True );
+ }
+ }
+
+ ++aIter;
+ }
+ while( aIter != aEnd );
+ }
+
+ mpImpl->maEffects.clear();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/animimp.cxx b/xmloff/source/draw/animimp.cxx
new file mode 100644
index 000000000000..d785725203fa
--- /dev/null
+++ b/xmloff/source/draw/animimp.cxx
@@ -0,0 +1,697 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <tools/debug.hxx>
+#include "unointerfacetouniqueidentifiermapper.hxx"
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/presentation/AnimationEffect.hpp>
+#include <com/sun/star/presentation/AnimationSpeed.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+
+#include <list>
+#include <tools/color.hxx>
+#include <comphelper/extract.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlimp.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmluconv.hxx>
+/*
+#include <xmloff/xmlement.hxx>
+*/
+#include <xmloff/nmspmap.hxx>
+#include "anim.hxx"
+#include "animimp.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::std;
+using namespace ::cppu;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::xml;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::presentation;
+using namespace ::xmloff::token;
+
+SvXMLEnumMapEntry aXML_AnimationEffect_EnumMap[] =
+{
+ { XML_NONE, EK_none },
+ { XML_FADE, EK_fade },
+ { XML_MOVE, EK_move },
+ { XML_STRIPES, EK_stripes },
+ { XML_OPEN, EK_open },
+ { XML_CLOSE, EK_close },
+ { XML_DISSOLVE, EK_dissolve },
+ { XML_WAVYLINE, EK_wavyline },
+ { XML_RANDOM, EK_random },
+ { XML_LINES, EK_lines },
+ { XML_LASER, EK_laser },
+ { XML_APPEAR, EK_appear },
+ { XML_HIDE, EK_hide },
+ { XML_MOVE_SHORT, EK_move_short },
+ { XML_CHECKERBOARD, EK_checkerboard },
+ { XML_ROTATE, EK_rotate },
+ { XML_STRETCH, EK_stretch },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXML_AnimationDirection_EnumMap[] =
+{
+ { XML_NONE, ED_none },
+ { XML_FROM_LEFT, ED_from_left },
+ { XML_FROM_TOP, ED_from_top },
+ { XML_FROM_RIGHT, ED_from_right },
+ { XML_FROM_BOTTOM, ED_from_bottom },
+ { XML_FROM_CENTER, ED_from_center },
+ { XML_FROM_UPPER_LEFT, ED_from_upperleft },
+ { XML_FROM_UPPER_RIGHT, ED_from_upperright },
+ { XML_FROM_LOWER_LEFT, ED_from_lowerleft },
+ { XML_FROM_LOWER_RIGHT, ED_from_lowerright },
+ { XML_TO_LEFT, ED_to_left },
+ { XML_TO_TOP, ED_to_top },
+ { XML_TO_RIGHT, ED_to_right },
+ { XML_TO_BOTTOM, ED_to_bottom },
+ { XML_TO_UPPER_LEFT, ED_to_upperleft },
+ { XML_TO_UPPER_RIGHT, ED_to_upperright },
+ { XML_TO_LOWER_RIGHT, ED_to_lowerright },
+ { XML_TO_LOWER_LEFT, ED_to_lowerleft },
+ { XML_PATH, ED_path },
+ { XML_SPIRAL_INWARD_LEFT, ED_spiral_inward_left },
+ { XML_SPIRAL_INWARD_RIGHT,ED_spiral_inward_right },
+ { XML_SPIRAL_OUTWARD_LEFT, ED_spiral_outward_left },
+ { XML_SPIRAL_OUTWARD_RIGHT, ED_spiral_outward_right },
+ { XML_VERTICAL, ED_vertical },
+ { XML_HORIZONTAL, ED_horizontal },
+ { XML_TO_CENTER, ED_to_center },
+ { XML_CLOCKWISE, ED_clockwise },
+ { XML_COUNTER_CLOCKWISE,ED_cclockwise },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXML_AnimationSpeed_EnumMap[] =
+{
+ { XML_SLOW, AnimationSpeed_SLOW },
+ { XML_MEDIUM, AnimationSpeed_MEDIUM },
+ { XML_FAST, AnimationSpeed_FAST },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+AnimationEffect ImplSdXMLgetEffect( XMLEffect eKind, XMLEffectDirection eDirection, sal_Int16 nStartScale, sal_Bool /*bIn*/ )
+{
+ switch( eKind )
+ {
+ case EK_fade:
+ switch( eDirection )
+ {
+ case ED_from_left: return AnimationEffect_FADE_FROM_LEFT;
+ case ED_from_top: return AnimationEffect_FADE_FROM_TOP;
+ case ED_from_right: return AnimationEffect_FADE_FROM_RIGHT;
+ case ED_from_bottom: return AnimationEffect_FADE_FROM_BOTTOM;
+ case ED_from_center: return AnimationEffect_FADE_FROM_CENTER;
+ case ED_from_upperleft: return AnimationEffect_FADE_FROM_UPPERLEFT;
+ case ED_from_upperright: return AnimationEffect_FADE_FROM_UPPERRIGHT;
+ case ED_from_lowerleft: return AnimationEffect_FADE_FROM_LOWERLEFT;
+ case ED_from_lowerright: return AnimationEffect_FADE_FROM_LOWERRIGHT;
+ case ED_to_center: return AnimationEffect_FADE_TO_CENTER;
+ case ED_clockwise: return AnimationEffect_CLOCKWISE;
+ case ED_cclockwise: return AnimationEffect_COUNTERCLOCKWISE;
+ case ED_spiral_inward_left: return AnimationEffect_SPIRALIN_LEFT;
+ case ED_spiral_inward_right:return AnimationEffect_SPIRALIN_RIGHT;
+ case ED_spiral_outward_left:return AnimationEffect_SPIRALOUT_LEFT;
+ case ED_spiral_outward_right:return AnimationEffect_SPIRALOUT_RIGHT;
+ default: return AnimationEffect_FADE_FROM_LEFT;
+ }
+ case EK_move:
+ if( nStartScale == 200 )
+ {
+ return AnimationEffect_ZOOM_OUT_SMALL;
+ }
+ else if( nStartScale == 50 )
+ {
+ return AnimationEffect_ZOOM_IN_SMALL;
+ }
+ else if( nStartScale < 100 )
+ {
+ switch( eDirection )
+ {
+ case ED_from_left: return AnimationEffect_ZOOM_IN_FROM_LEFT;
+ case ED_from_top: return AnimationEffect_ZOOM_IN_FROM_TOP;
+ case ED_from_right: return AnimationEffect_ZOOM_IN_FROM_RIGHT;
+ case ED_from_bottom: return AnimationEffect_ZOOM_IN_FROM_BOTTOM;
+ case ED_from_upperleft: return AnimationEffect_ZOOM_IN_FROM_UPPERLEFT;
+ case ED_from_upperright: return AnimationEffect_ZOOM_IN_FROM_UPPERRIGHT;
+ case ED_from_lowerleft: return AnimationEffect_ZOOM_IN_FROM_LOWERLEFT;
+ case ED_from_lowerright: return AnimationEffect_ZOOM_IN_FROM_LOWERRIGHT;
+ case ED_from_center: return AnimationEffect_ZOOM_IN_FROM_CENTER;
+ case ED_spiral_inward_left: return AnimationEffect_ZOOM_IN_SPIRAL;
+ case ED_to_left: return AnimationEffect_MOVE_TO_LEFT;
+ case ED_to_top: return AnimationEffect_MOVE_TO_TOP;
+ case ED_to_right: return AnimationEffect_MOVE_TO_RIGHT;
+ case ED_to_bottom: return AnimationEffect_MOVE_TO_BOTTOM;
+ case ED_to_upperleft: return AnimationEffect_MOVE_TO_UPPERLEFT;
+ case ED_to_upperright: return AnimationEffect_MOVE_TO_UPPERRIGHT;
+ case ED_to_lowerright: return AnimationEffect_MOVE_TO_LOWERRIGHT;
+ case ED_to_lowerleft: return AnimationEffect_MOVE_TO_LOWERLEFT;
+ default: return AnimationEffect_ZOOM_IN;
+ }
+ }
+ else if( nStartScale > 100 )
+ {
+ switch( eDirection )
+ {
+ case ED_from_left: return AnimationEffect_ZOOM_OUT_FROM_LEFT;
+ case ED_from_top: return AnimationEffect_ZOOM_OUT_FROM_TOP;
+ case ED_from_right: return AnimationEffect_ZOOM_OUT_FROM_RIGHT;
+ case ED_from_bottom: return AnimationEffect_ZOOM_OUT_FROM_BOTTOM;
+ case ED_from_upperleft: return AnimationEffect_ZOOM_OUT_FROM_UPPERLEFT;
+ case ED_from_upperright: return AnimationEffect_ZOOM_OUT_FROM_UPPERRIGHT;
+ case ED_from_lowerleft: return AnimationEffect_ZOOM_OUT_FROM_LOWERLEFT;
+ case ED_from_lowerright: return AnimationEffect_ZOOM_OUT_FROM_LOWERRIGHT;
+ case ED_from_center: return AnimationEffect_ZOOM_OUT_FROM_CENTER;
+ case ED_spiral_inward_left: return AnimationEffect_ZOOM_OUT_SPIRAL;
+ default: return AnimationEffect_ZOOM_OUT;
+ }
+ }
+ else
+ {
+ switch( eDirection )
+ {
+ case ED_from_left: return AnimationEffect_MOVE_FROM_LEFT;
+ case ED_from_top: return AnimationEffect_MOVE_FROM_TOP;
+ case ED_from_right: return AnimationEffect_MOVE_FROM_RIGHT;
+ case ED_from_bottom: return AnimationEffect_MOVE_FROM_BOTTOM;
+ case ED_from_upperleft: return AnimationEffect_MOVE_FROM_UPPERLEFT;
+ case ED_from_upperright: return AnimationEffect_MOVE_FROM_UPPERRIGHT;
+ case ED_from_lowerleft: return AnimationEffect_MOVE_FROM_LOWERLEFT;
+ case ED_from_lowerright: return AnimationEffect_MOVE_FROM_LOWERRIGHT;
+ case ED_path: return AnimationEffect_PATH;
+ case ED_to_top: return AnimationEffect_MOVE_TO_TOP;
+ case ED_to_right: return AnimationEffect_MOVE_TO_RIGHT;
+ case ED_to_bottom: return AnimationEffect_MOVE_TO_BOTTOM;
+ case ED_to_upperleft: return AnimationEffect_MOVE_TO_UPPERLEFT;
+ case ED_to_upperright: return AnimationEffect_MOVE_TO_UPPERRIGHT;
+ case ED_to_lowerright: return AnimationEffect_MOVE_TO_LOWERRIGHT;
+ case ED_to_lowerleft: return AnimationEffect_MOVE_TO_LOWERLEFT;
+ default:
+ break;
+ }
+ }
+ return AnimationEffect_MOVE_FROM_LEFT;
+ case EK_stripes:
+ if( eDirection == ED_vertical )
+ return AnimationEffect_VERTICAL_STRIPES;
+ else
+ return AnimationEffect_HORIZONTAL_STRIPES;
+ case EK_open:
+ if( eDirection == ED_vertical )
+ return AnimationEffect_OPEN_VERTICAL;
+ else
+ return AnimationEffect_OPEN_HORIZONTAL;
+ case EK_close:
+ if( eDirection == ED_vertical )
+ return AnimationEffect_CLOSE_VERTICAL;
+ else
+ return AnimationEffect_CLOSE_HORIZONTAL;
+ case EK_dissolve:
+ return AnimationEffect_DISSOLVE;
+ case EK_wavyline:
+ switch( eDirection )
+ {
+ case ED_from_left: return AnimationEffect_WAVYLINE_FROM_LEFT;
+ case ED_from_top: return AnimationEffect_WAVYLINE_FROM_TOP;
+ case ED_from_right: return AnimationEffect_WAVYLINE_FROM_RIGHT;
+ case ED_from_bottom: return AnimationEffect_WAVYLINE_FROM_BOTTOM;
+ default: return AnimationEffect_WAVYLINE_FROM_LEFT;
+ }
+ case EK_random:
+ return AnimationEffect_RANDOM;
+ case EK_lines:
+ if( eDirection == ED_vertical )
+ return AnimationEffect_VERTICAL_LINES;
+ else
+ return AnimationEffect_HORIZONTAL_LINES;
+ case EK_laser:
+ switch( eDirection )
+ {
+ case ED_from_left: return AnimationEffect_LASER_FROM_LEFT;
+ case ED_from_top: return AnimationEffect_LASER_FROM_TOP;
+ case ED_from_right: return AnimationEffect_LASER_FROM_RIGHT;
+ case ED_from_bottom: return AnimationEffect_LASER_FROM_BOTTOM;
+ case ED_from_upperleft: return AnimationEffect_LASER_FROM_UPPERLEFT;
+ case ED_from_upperright: return AnimationEffect_LASER_FROM_UPPERRIGHT;
+ case ED_from_lowerleft: return AnimationEffect_LASER_FROM_LOWERLEFT;
+ case ED_from_lowerright: return AnimationEffect_LASER_FROM_LOWERRIGHT;
+ default: return AnimationEffect_LASER_FROM_LEFT;
+ }
+ case EK_appear:
+ return AnimationEffect_APPEAR;
+ case EK_hide:
+ return AnimationEffect_HIDE;
+ case EK_move_short:
+ switch( eDirection )
+ {
+ case ED_from_left: return AnimationEffect_MOVE_SHORT_FROM_LEFT;
+ case ED_from_top: return AnimationEffect_MOVE_SHORT_FROM_TOP;
+ case ED_from_right: return AnimationEffect_MOVE_SHORT_FROM_RIGHT;
+ case ED_from_bottom: return AnimationEffect_MOVE_SHORT_FROM_BOTTOM;
+ case ED_from_upperleft: return AnimationEffect_MOVE_SHORT_FROM_UPPERLEFT;
+ case ED_from_upperright: return AnimationEffect_MOVE_SHORT_FROM_UPPERRIGHT;
+ case ED_from_lowerleft: return AnimationEffect_MOVE_SHORT_FROM_LOWERLEFT;
+ case ED_from_lowerright: return AnimationEffect_MOVE_SHORT_FROM_LOWERRIGHT;
+ case ED_to_left: return AnimationEffect_MOVE_SHORT_TO_LEFT;
+ case ED_to_upperleft: return AnimationEffect_MOVE_SHORT_TO_UPPERLEFT;
+ case ED_to_top: return AnimationEffect_MOVE_SHORT_TO_TOP;
+ case ED_to_upperright: return AnimationEffect_MOVE_SHORT_TO_UPPERRIGHT;
+ case ED_to_right: return AnimationEffect_MOVE_SHORT_TO_RIGHT;
+ case ED_to_lowerright: return AnimationEffect_MOVE_SHORT_TO_LOWERRIGHT;
+ case ED_to_bottom: return AnimationEffect_MOVE_SHORT_TO_BOTTOM;
+ case ED_to_lowerleft: return AnimationEffect_MOVE_SHORT_TO_LOWERLEFT;
+ default: return AnimationEffect_MOVE_SHORT_FROM_LEFT;
+ }
+ case EK_checkerboard:
+ if( eDirection == ED_vertical )
+ return AnimationEffect_VERTICAL_CHECKERBOARD;
+ else
+ return AnimationEffect_HORIZONTAL_CHECKERBOARD;
+ case EK_rotate:
+ if( eDirection == ED_vertical )
+ return AnimationEffect_VERTICAL_ROTATE;
+ else
+ return AnimationEffect_HORIZONTAL_ROTATE;
+ case EK_stretch:
+ switch( eDirection )
+ {
+ case ED_from_left: return AnimationEffect_STRETCH_FROM_LEFT;
+ case ED_from_top: return AnimationEffect_STRETCH_FROM_TOP;
+ case ED_from_right: return AnimationEffect_STRETCH_FROM_RIGHT;
+ case ED_from_bottom: return AnimationEffect_STRETCH_FROM_BOTTOM;
+ case ED_from_upperleft: return AnimationEffect_STRETCH_FROM_UPPERLEFT;
+ case ED_from_upperright: return AnimationEffect_STRETCH_FROM_UPPERRIGHT;
+ case ED_from_lowerleft: return AnimationEffect_STRETCH_FROM_LOWERLEFT;
+ case ED_from_lowerright: return AnimationEffect_STRETCH_FROM_LOWERRIGHT;
+ case ED_vertical: return AnimationEffect_VERTICAL_STRETCH;
+ case ED_horizontal: return AnimationEffect_HORIZONTAL_STRETCH;
+ default:
+ break;
+ }
+ return AnimationEffect_STRETCH_FROM_LEFT;
+ default:
+ return AnimationEffect_NONE;
+ }
+}
+
+///////////////////////////////////////////////////////////////////////
+
+class AnimImpImpl
+{
+public:
+ Reference< XPropertySet > mxLastShape;
+ OUString maLastShapeId;
+
+ OUString msDimColor;
+ OUString msDimHide;
+ OUString msDimPrev;
+ OUString msEffect;
+ OUString msPlayFull;
+ OUString msPresOrder;
+ OUString msSound;
+ OUString msSoundOn;
+ OUString msSpeed;
+ OUString msTextEffect;
+ OUString msPresShapeService;
+ OUString msAnimPath;
+ OUString msIsAnimation;
+
+ AnimImpImpl()
+ : msDimColor( RTL_CONSTASCII_USTRINGPARAM( "DimColor" ) ),
+ msDimHide( RTL_CONSTASCII_USTRINGPARAM( "DimHide" ) ),
+ msDimPrev( RTL_CONSTASCII_USTRINGPARAM( "DimPrevious" ) ),
+ msEffect( RTL_CONSTASCII_USTRINGPARAM( "Effect" ) ),
+ msPlayFull( RTL_CONSTASCII_USTRINGPARAM( "PlayFull" ) ),
+ msPresOrder( RTL_CONSTASCII_USTRINGPARAM( "PresentationOrder" ) ),
+ msSound( RTL_CONSTASCII_USTRINGPARAM( "Sound" ) ),
+ msSoundOn( RTL_CONSTASCII_USTRINGPARAM( "SoundOn" ) ),
+ msSpeed( RTL_CONSTASCII_USTRINGPARAM( "Speed" ) ),
+ msTextEffect( RTL_CONSTASCII_USTRINGPARAM( "TextEffect" ) ),
+ msPresShapeService( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.Shape" ) ),
+ msAnimPath( RTL_CONSTASCII_USTRINGPARAM( "AnimationPath" ) ),
+ msIsAnimation( RTL_CONSTASCII_USTRINGPARAM( "IsAnimation" ) )
+ {}
+};
+
+///////////////////////////////////////////////////////////////////////
+
+enum XMLActionKind
+{
+ XMLE_SHOW,
+ XMLE_HIDE,
+ XMLE_DIM,
+ XMLE_PLAY
+};
+
+class XMLAnimationsEffectContext : public SvXMLImportContext
+{
+public:
+ AnimImpImpl* mpImpl;
+
+ XMLActionKind meKind;
+ sal_Bool mbTextEffect;
+ OUString maShapeId;
+
+ XMLEffect meEffect;
+ XMLEffectDirection meDirection;
+ sal_Int16 mnStartScale;
+
+ AnimationSpeed meSpeed;
+ Color maDimColor;
+ OUString maSoundURL;
+ sal_Bool mbPlayFull;
+ OUString maPathShapeId;
+
+public:
+ TYPEINFO();
+
+ XMLAnimationsEffectContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const Reference< XAttributeList >& xAttrList,
+ AnimImpImpl* pImpl);
+ virtual ~XMLAnimationsEffectContext();
+
+ virtual void EndElement();
+
+ virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName,
+ const Reference< XAttributeList >& xAttrList );
+};
+
+class XMLAnimationsSoundContext : public SvXMLImportContext
+{
+ XMLAnimationsEffectContext* mpParent;
+
+public:
+ TYPEINFO();
+
+ XMLAnimationsSoundContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, XMLAnimationsEffectContext* pParent );
+ virtual ~XMLAnimationsSoundContext();
+};
+
+TYPEINIT1( XMLAnimationsSoundContext, SvXMLImportContext );
+
+XMLAnimationsSoundContext::XMLAnimationsSoundContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, XMLAnimationsEffectContext* pParent )
+: SvXMLImportContext( rImport, nPrfx, rLocalName ), mpParent( pParent )
+{
+ if( mpParent && nPrfx == XML_NAMESPACE_PRESENTATION && IsXMLToken( rLocalName, XML_SOUND ) )
+ {
+ const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ OUString sValue = xAttrList->getValueByIndex( i );
+
+ switch( nPrefix )
+ {
+ case XML_NAMESPACE_XLINK:
+ if( IsXMLToken( aLocalName, XML_HREF ) )
+ {
+ mpParent->maSoundURL = rImport.GetAbsoluteReference(sValue);
+ }
+ break;
+ case XML_NAMESPACE_PRESENTATION:
+ if( IsXMLToken( aLocalName, XML_PLAY_FULL ) )
+ {
+ mpParent->mbPlayFull = IsXMLToken( sValue, XML_TRUE );
+ }
+ }
+ }
+ }
+}
+
+XMLAnimationsSoundContext::~XMLAnimationsSoundContext()
+{
+}
+
+
+TYPEINIT1( XMLAnimationsEffectContext, SvXMLImportContext );
+
+XMLAnimationsEffectContext::XMLAnimationsEffectContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, AnimImpImpl* pImpl )
+: SvXMLImportContext(rImport, nPrfx, rLocalName),
+ mpImpl( pImpl ),
+ meKind( XMLE_SHOW ), mbTextEffect( sal_False ),
+ meEffect( EK_none ), meDirection( ED_none ), mnStartScale( 100 ),
+ meSpeed( AnimationSpeed_MEDIUM ), maDimColor(0), mbPlayFull( sal_False )
+{
+ if( IsXMLToken( rLocalName, XML_SHOW_SHAPE ) )
+ {
+ meKind = XMLE_SHOW;
+ }
+ else if( IsXMLToken( rLocalName, XML_SHOW_TEXT ) )
+ {
+ meKind = XMLE_SHOW;
+ mbTextEffect = sal_True;
+ }
+ else if( IsXMLToken( rLocalName, XML_HIDE_SHAPE ) )
+ {
+ meKind = XMLE_HIDE;
+ }
+ else if( IsXMLToken( rLocalName, XML_HIDE_TEXT ) )
+ {
+ meKind = XMLE_HIDE;
+ mbTextEffect = sal_True;
+ }
+ else if( IsXMLToken( rLocalName, XML_DIM ) )
+ {
+ meKind = XMLE_DIM;
+ }
+ else if( IsXMLToken( rLocalName, XML_PLAY ) )
+ {
+ meKind = XMLE_PLAY;
+ }
+ else
+ {
+ // unknown action, overread
+ return;
+ }
+
+ // read attributes
+ const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ OUString sValue = xAttrList->getValueByIndex( i );
+
+ switch( nPrefix )
+ {
+ case XML_NAMESPACE_DRAW:
+ if( IsXMLToken( aLocalName, XML_SHAPE_ID ) )
+ {
+ maShapeId = sValue;
+ }
+ else if( IsXMLToken( aLocalName, XML_COLOR ) )
+ {
+ SvXMLUnitConverter::convertColor(maDimColor, sValue);
+ }
+ break;
+
+ case XML_NAMESPACE_PRESENTATION:
+ if( IsXMLToken( aLocalName, XML_EFFECT ) )
+ {
+ sal_uInt16 eEnum;
+ if( SvXMLUnitConverter::convertEnum( eEnum, sValue, aXML_AnimationEffect_EnumMap ) )
+ meEffect = (XMLEffect)eEnum;
+ }
+ else if( IsXMLToken(aLocalName, XML_DIRECTION ) )
+ {
+ sal_uInt16 eEnum;
+ if( SvXMLUnitConverter::convertEnum( eEnum, sValue, aXML_AnimationDirection_EnumMap ) )
+ meDirection = (XMLEffectDirection)eEnum;
+ }
+ else if( IsXMLToken( aLocalName, XML_START_SCALE ) )
+ {
+ sal_Int32 nScale;
+ if( SvXMLUnitConverter::convertPercent( nScale, sValue ) )
+ mnStartScale = (sal_Int16)nScale;
+ }
+ else if( IsXMLToken( aLocalName, XML_SPEED ) )
+ {
+ sal_uInt16 eEnum;
+ if( SvXMLUnitConverter::convertEnum( eEnum, sValue, aXML_AnimationSpeed_EnumMap ) )
+ meSpeed = (AnimationSpeed)eEnum;
+ }
+ else if( IsXMLToken( aLocalName, XML_PATH_ID ) )
+ {
+ maPathShapeId = sValue;
+ }
+ break;
+ }
+ }
+}
+
+XMLAnimationsEffectContext::~XMLAnimationsEffectContext()
+{
+}
+
+SvXMLImportContext * XMLAnimationsEffectContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< XAttributeList>& xAttrList )
+{
+ return new XMLAnimationsSoundContext( GetImport(), nPrefix, rLocalName, xAttrList, this );
+}
+
+void XMLAnimationsEffectContext::EndElement()
+{
+ // set effect on shape
+
+ try
+ {
+ UniReference< XMLShapeImportHelper > xShapeImport( GetImport().GetShapeImport() );
+ Any aAny;
+
+ if( maShapeId.getLength() )
+ {
+ Reference< XPropertySet > xSet;
+ if( mpImpl->maLastShapeId != maShapeId )
+ {
+ xSet = Reference< XPropertySet >::query( GetImport().getInterfaceToIdentifierMapper().getReference( maShapeId ) );
+ if( xSet.is() )
+ {
+ // check for presentation shape service
+ {
+ Reference< XServiceInfo > xServiceInfo( xSet, UNO_QUERY );
+ if( !xServiceInfo.is() || !xServiceInfo->supportsService( mpImpl->msPresShapeService ) )
+ return;
+ }
+
+ mpImpl->maLastShapeId = maShapeId;
+ mpImpl->mxLastShape = xSet;
+ }
+ }
+ else
+ {
+ xSet = mpImpl->mxLastShape;
+ }
+
+ if( xSet.is() )
+ {
+ if( meKind == XMLE_DIM )
+ {
+ aAny <<= (sal_Bool)sal_True;
+ xSet->setPropertyValue( mpImpl->msDimPrev, aAny );
+
+ aAny <<= (sal_Int32)maDimColor.GetColor();
+ xSet->setPropertyValue( mpImpl->msDimColor, aAny );
+ }
+ else if( meKind == XMLE_PLAY )
+ {
+ aAny <<= (sal_Bool)sal_True;
+ xSet->setPropertyValue( mpImpl->msIsAnimation, aAny );
+
+ aAny <<= meSpeed;
+ xSet->setPropertyValue( mpImpl->msSpeed, aAny );
+ }
+ else
+ {
+ if( meKind == XMLE_HIDE && !mbTextEffect && meEffect == EK_none )
+ {
+ aAny = bool2any( sal_True );
+ xSet->setPropertyValue( mpImpl->msDimHide, aAny );
+ }
+ else
+ {
+ const AnimationEffect eEffect = ImplSdXMLgetEffect( meEffect, meDirection, mnStartScale, meKind == XMLE_SHOW );
+
+ xSet->setPropertyValue( mbTextEffect ? mpImpl->msTextEffect : mpImpl->msEffect, makeAny( eEffect ) );
+ xSet->setPropertyValue( mpImpl->msSpeed, makeAny( meSpeed ) );
+
+ if( eEffect == AnimationEffect_PATH && maPathShapeId.getLength() )
+ {
+ Reference< XShape > xPath( GetImport().getInterfaceToIdentifierMapper().getReference( maPathShapeId ), UNO_QUERY );
+ if( xPath.is() )
+ xSet->setPropertyValue( mpImpl->msAnimPath, makeAny( xPath ) );
+ }
+ }
+ }
+ }
+ if( maSoundURL.getLength() != 0 )
+ {
+ if( xSet.is() )
+ {
+ aAny <<= maSoundURL;
+ xSet->setPropertyValue( mpImpl->msSound, aAny );
+
+ aAny <<= bool2any( mbPlayFull );
+ xSet->setPropertyValue( mpImpl->msPlayFull, aAny );
+
+ aAny <<= bool2any( sal_True );
+ xSet->setPropertyValue( mpImpl->msSoundOn, aAny );
+ }
+ else
+ {
+ OSL_FAIL("XMLAnimationsEffectContext::EndElement - Sound URL without a XPropertySet!");
+ }
+ }
+ }
+ }
+ catch( Exception e )
+ {
+ OSL_FAIL( "exception catched while importing animation information!" );
+ }
+}
+
+///////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( XMLAnimationsContext, SvXMLImportContext );
+
+XMLAnimationsContext::XMLAnimationsContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& )
+: SvXMLImportContext(rImport, nPrfx, rLocalName)
+{
+ mpImpl = new AnimImpImpl();
+}
+
+XMLAnimationsContext::~XMLAnimationsContext()
+{
+ delete mpImpl;
+}
+
+SvXMLImportContext * XMLAnimationsContext::CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList )
+{
+ return new XMLAnimationsEffectContext( GetImport(), nPrefix, rLocalName, xAttrList, mpImpl );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/descriptionimp.cxx b/xmloff/source/draw/descriptionimp.cxx
new file mode 100644
index 000000000000..6d1799957802
--- /dev/null
+++ b/xmloff/source/draw/descriptionimp.cxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <tools/debug.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlimp.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+
+#include "descriptionimp.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::std;
+using namespace ::cppu;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::xml;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::beans;
+using namespace ::xmloff::token;
+
+///////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLDescriptionContext, SvXMLImportContext );
+
+SdXMLDescriptionContext::SdXMLDescriptionContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName,
+ const Reference< XAttributeList>&, const Reference< XShape >& rxShape)
+: SvXMLImportContext(rImport, nPrfx, rLocalName), mxShape( rxShape )
+{
+}
+
+SdXMLDescriptionContext::~SdXMLDescriptionContext()
+{
+}
+
+void SdXMLDescriptionContext::EndElement()
+{
+ if( msText.getLength() ) try
+ {
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY_THROW);
+ if(IsXMLToken(GetLocalName(),XML_TITLE))
+ {
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Title")), Any(msText));
+ }
+ else
+ {
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Description")), Any(msText));
+ }
+ }
+ catch( uno::Exception& )
+ {
+ }
+}
+
+// This method is called for all characters that are contained in the
+// current element. The default is to ignore them.
+void SdXMLDescriptionContext::Characters( const ::rtl::OUString& rChars )
+{
+ msText += rChars;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/descriptionimp.hxx b/xmloff/source/draw/descriptionimp.hxx
new file mode 100644
index 000000000000..f73f00cb28de
--- /dev/null
+++ b/xmloff/source/draw/descriptionimp.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_DESCRIPTIONIMP_HXX
+#define _XMLOFF_DESCRIPTIONIMP_HXX
+
+#include <xmloff/xmlictxt.hxx>
+#include <com/sun/star/drawing/XShape.hpp>
+
+//////////////////////////////////////////////////////////////////////////////
+// office:events inside a shape
+
+class SdXMLDescriptionContext : public SvXMLImportContext
+{
+private:
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShape > mxShape;
+ ::rtl::OUString msText;
+public:
+ TYPEINFO();
+
+ SdXMLDescriptionContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rxShape );
+ virtual ~SdXMLDescriptionContext();
+
+ virtual void EndElement();
+
+ // This method is called for all characters that are contained in the
+ // current element. The default is to ignore them.
+ virtual void Characters( const ::rtl::OUString& rChars );
+};
+
+#endif // _XMLOFF_EVENTIMP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/eventimp.cxx b/xmloff/source/draw/eventimp.cxx
new file mode 100644
index 000000000000..6d82798bd283
--- /dev/null
+++ b/xmloff/source/draw/eventimp.cxx
@@ -0,0 +1,528 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <tools/debug.hxx>
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#include <com/sun/star/container/XNameReplace.hpp>
+#include <com/sun/star/presentation/AnimationSpeed.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/presentation/ClickAction.hpp>
+#include <tools/urlobj.hxx>
+#include <comphelper/extract.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlimp.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "eventimp.hxx"
+#include "anim.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::std;
+using namespace ::cppu;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::xml;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::document;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::presentation;
+using namespace ::xmloff::token;
+
+///////////////////////////////////////////////////////////////////////
+
+SvXMLEnumMapEntry const aXML_EventActions_EnumMap[] =
+{
+ { XML_NONE, ClickAction_NONE },
+ { XML_PREVIOUS_PAGE, ClickAction_PREVPAGE },
+ { XML_NEXT_PAGE, ClickAction_NEXTPAGE },
+ { XML_FIRST_PAGE, ClickAction_FIRSTPAGE },
+ { XML_LAST_PAGE, ClickAction_LASTPAGE },
+ { XML_HIDE, ClickAction_INVISIBLE },
+ { XML_STOP, ClickAction_STOPPRESENTATION },
+ { XML_EXECUTE, ClickAction_PROGRAM },
+ { XML_SHOW, ClickAction_BOOKMARK },
+ { XML_SHOW, ClickAction_DOCUMENT },
+ { XML_EXECUTE_MACRO, ClickAction_MACRO },
+ { XML_VERB, ClickAction_VERB },
+ { XML_FADE_OUT, ClickAction_VANISH },
+ { XML_SOUND, ClickAction_SOUND },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+///////////////////////////////////////////////////////////////////////
+
+class SdXMLEventContext : public SvXMLImportContext
+{
+private:
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShape > mxShape;
+
+public:
+ TYPEINFO();
+
+ SdXMLEventContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList>& xAttrList, const Reference< XShape >& rxShape );
+ virtual ~SdXMLEventContext();
+
+ virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< XAttributeList>& xAttrList );
+ virtual void EndElement();
+
+ sal_Bool mbValid;
+ sal_Bool mbScript;
+ ClickAction meClickAction;
+ XMLEffect meEffect;
+ XMLEffectDirection meDirection;
+ sal_Int16 mnStartScale;
+ AnimationSpeed meSpeed;
+ sal_Int32 mnVerb;
+ OUString msSoundURL;
+ sal_Bool mbPlayFull;
+ OUString msMacroName;
+ OUString msBookmark;
+ OUString msLanguage;
+};
+
+///////////////////////////////////////////////////////////////////////
+
+class XMLEventSoundContext : public SvXMLImportContext
+{
+ SdXMLEventContext* mpParent;
+
+public:
+ TYPEINFO();
+
+ XMLEventSoundContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, SdXMLEventContext* pParent );
+ virtual ~XMLEventSoundContext();
+};
+
+TYPEINIT1( XMLEventSoundContext, SvXMLImportContext );
+
+XMLEventSoundContext::XMLEventSoundContext( SvXMLImport& rImp, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, SdXMLEventContext* pParent )
+: SvXMLImportContext( rImp, nPrfx, rLocalName ), mpParent( pParent )
+{
+ if( mpParent && nPrfx == XML_NAMESPACE_PRESENTATION && IsXMLToken( rLocalName, XML_SOUND ) )
+ {
+ const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aAttrLocalName;
+ sal_uInt16 nAttrPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aAttrLocalName );
+ OUString sValue = xAttrList->getValueByIndex( i );
+
+ switch( nAttrPrefix )
+ {
+ case XML_NAMESPACE_XLINK:
+ if( IsXMLToken( aAttrLocalName, XML_HREF ) )
+ {
+ mpParent->msSoundURL = rImp.GetAbsoluteReference(sValue);
+ }
+ break;
+ case XML_NAMESPACE_PRESENTATION:
+ if( IsXMLToken( aAttrLocalName, XML_PLAY_FULL ) )
+ {
+ mpParent->mbPlayFull = IsXMLToken( sValue, XML_TRUE );
+ }
+ }
+ }
+ }
+}
+
+XMLEventSoundContext::~XMLEventSoundContext()
+{
+}
+
+///////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLEventContext, SvXMLImportContext );
+
+SdXMLEventContext::SdXMLEventContext( SvXMLImport& rImp, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, const Reference< XShape >& rxShape )
+: SvXMLImportContext(rImp, nPrfx, rLocalName),
+ mxShape( rxShape ), mbScript( sal_False ), meClickAction( ClickAction_NONE ),
+ meEffect( EK_none ), meDirection( ED_none ), mnStartScale( 100 ),
+ meSpeed( AnimationSpeed_MEDIUM ), mnVerb(0), mbPlayFull( sal_False )
+{
+ static const OUString sXMLClickName( RTL_CONSTASCII_USTRINGPARAM( "click" ) );
+
+ if( nPrfx == XML_NAMESPACE_PRESENTATION && IsXMLToken( rLocalName, XML_EVENT_LISTENER ) )
+ {
+ mbValid = sal_True;
+ }
+ else if( nPrfx == XML_NAMESPACE_SCRIPT && IsXMLToken( rLocalName, XML_EVENT_LISTENER ) )
+ {
+ mbScript = sal_True;
+ mbValid = sal_True;
+ }
+ else
+ {
+ return;
+ }
+
+ // read attributes
+ OUString sEventName;
+ const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; (i < nAttrCount) && mbValid; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aAttrLocalName;
+ sal_uInt16 nAttrPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aAttrLocalName );
+ OUString sValue = xAttrList->getValueByIndex( i );
+
+ switch( nAttrPrefix )
+ {
+ case XML_NAMESPACE_PRESENTATION:
+ if( IsXMLToken( aAttrLocalName, XML_ACTION ) )
+ {
+ sal_uInt16 eEnum;
+ if( SvXMLUnitConverter::convertEnum( eEnum, sValue, aXML_EventActions_EnumMap ) )
+ meClickAction = (ClickAction)eEnum;
+ }
+ if( IsXMLToken( aAttrLocalName, XML_EFFECT ) )
+ {
+ sal_uInt16 eEnum;
+ if( SvXMLUnitConverter::convertEnum( eEnum, sValue, aXML_AnimationEffect_EnumMap ) )
+ meEffect = (XMLEffect)eEnum;
+ }
+ else if( IsXMLToken( aAttrLocalName, XML_DIRECTION ) )
+ {
+ sal_uInt16 eEnum;
+ if( SvXMLUnitConverter::convertEnum( eEnum, sValue, aXML_AnimationDirection_EnumMap ) )
+ meDirection = (XMLEffectDirection)eEnum;
+ }
+ else if( IsXMLToken( aAttrLocalName, XML_START_SCALE ) )
+ {
+ sal_Int32 nScale;
+ if( SvXMLUnitConverter::convertPercent( nScale, sValue ) )
+ mnStartScale = (sal_Int16)nScale;
+ }
+ else if( IsXMLToken( aAttrLocalName, XML_SPEED ) )
+ {
+ sal_uInt16 eEnum;
+ if( SvXMLUnitConverter::convertEnum( eEnum, sValue, aXML_AnimationSpeed_EnumMap ) )
+ meSpeed = (AnimationSpeed)eEnum;
+ }
+ else if( IsXMLToken( aAttrLocalName, XML_VERB ) )
+ {
+ SvXMLUnitConverter::convertNumber( mnVerb, sValue );
+ }
+ break;
+
+ case XML_NAMESPACE_SCRIPT:
+ if( IsXMLToken( aAttrLocalName, XML_EVENT_NAME ) )
+ {
+ sEventName = sValue;
+ sal_uInt16 nScriptPrefix =
+ GetImport().GetNamespaceMap().GetKeyByAttrName( sValue, &sEventName );
+ mbValid = XML_NAMESPACE_DOM == nScriptPrefix && sEventName == sXMLClickName;
+ }
+ else if( IsXMLToken( aAttrLocalName, XML_LANGUAGE ) )
+ {
+ // language is not evaluated!
+ OUString aScriptLanguage;
+ msLanguage = sValue;
+ sal_uInt16 nScriptPrefix = rImp.GetNamespaceMap().
+ GetKeyByAttrName( msLanguage, &aScriptLanguage );
+ if( XML_NAMESPACE_OOO == nScriptPrefix )
+ msLanguage = aScriptLanguage;
+ }
+ else if( IsXMLToken( aAttrLocalName, XML_MACRO_NAME ) )
+ {
+ msMacroName = sValue;
+ }
+ break;
+
+ case XML_NAMESPACE_XLINK:
+ if( IsXMLToken( aAttrLocalName, XML_HREF ) )
+ {
+ if ( mbScript )
+ {
+ msMacroName = sValue;
+ }
+ else
+ {
+ const rtl::OUString &rTmp =
+ rImp.GetAbsoluteReference(sValue);
+ INetURLObject::translateToInternal( rTmp, msBookmark,
+ INetURLObject::DECODE_UNAMBIGUOUS,
+ RTL_TEXTENCODING_UTF8 );
+ }
+ }
+ break;
+ }
+ }
+
+ if( mbValid )
+ mbValid = sEventName.getLength() != 0;
+}
+
+SdXMLEventContext::~SdXMLEventContext()
+{
+}
+
+SvXMLImportContext * SdXMLEventContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< XAttributeList>& xAttrList )
+{
+ return new XMLEventSoundContext( GetImport(), nPrefix, rLocalName, xAttrList, this );
+}
+
+void SdXMLEventContext::EndElement()
+{
+ if( !mbValid )
+ return;
+
+ do
+ {
+ Reference< XEventsSupplier > xEventsSupplier( mxShape, UNO_QUERY );
+ if( !xEventsSupplier.is() )
+ break;
+
+ Reference< XNameReplace > xEvents( xEventsSupplier->getEvents() );
+ DBG_ASSERT( xEvents.is(), "XEventsSupplier::getEvents() returned NULL" );
+ if( !xEvents.is() )
+ break;
+
+ OUString sAPIEventName;
+ uno::Sequence< beans::PropertyValue > aProperties;
+
+ sAPIEventName = OUString( RTL_CONSTASCII_USTRINGPARAM( "OnClick" ) );
+
+ if( mbScript )
+ meClickAction = ClickAction_MACRO;
+
+ sal_Int32 nPropertyCount = 2;
+ switch( meClickAction )
+ {
+ case ClickAction_NONE:
+ case ClickAction_PREVPAGE:
+ case ClickAction_NEXTPAGE:
+ case ClickAction_FIRSTPAGE:
+ case ClickAction_LASTPAGE:
+ case ClickAction_INVISIBLE:
+ case ClickAction_STOPPRESENTATION:
+ break;
+ case ClickAction_PROGRAM:
+ case ClickAction_VERB:
+ case ClickAction_BOOKMARK:
+ case ClickAction_DOCUMENT:
+ nPropertyCount += 1;
+ break;
+ case ClickAction_MACRO:
+ if ( msLanguage.equalsIgnoreAsciiCaseAscii("starbasic") )
+ nPropertyCount += 1;
+ break;
+
+ case ClickAction_SOUND:
+ nPropertyCount += 2;
+ break;
+
+ case ClickAction_VANISH:
+ nPropertyCount += 4;
+ break;
+ default:
+ break;
+ }
+
+ aProperties.realloc( nPropertyCount );
+ beans::PropertyValue* pProperties = aProperties.getArray();
+
+ if( ClickAction_MACRO == meClickAction )
+ {
+ if ( msLanguage.equalsIgnoreAsciiCaseAscii("starbasic") )
+ {
+ OUString sLibrary;
+ const OUString& rApp = GetXMLToken( XML_APPLICATION );
+ const OUString& rDoc = GetXMLToken( XML_DOCUMENT );
+ if( msMacroName.getLength() > rApp.getLength()+1 &&
+ msMacroName.copy(0,rApp.getLength()).equalsIgnoreAsciiCase( rApp ) &&
+ ':' == msMacroName[rApp.getLength()] )
+ {
+ sLibrary = OUString(RTL_CONSTASCII_USTRINGPARAM("StarOffice"));
+ msMacroName = msMacroName.copy( rApp.getLength()+1 );
+ }
+ else if( msMacroName.getLength() > rDoc.getLength()+1 &&
+ msMacroName.copy(0,rDoc.getLength()).equalsIgnoreAsciiCase( rDoc ) &&
+ ':' == msMacroName[rDoc.getLength()] )
+ {
+ sLibrary = rDoc;
+ msMacroName = msMacroName.copy( rDoc.getLength()+1 );
+ }
+
+ pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "EventType" ) );
+ pProperties->Handle = -1;
+ pProperties->Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM("StarBasic") );
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ pProperties++;
+
+ pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "MacroName" ) );
+ pProperties->Handle = -1;
+ pProperties->Value <<= msMacroName;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ pProperties++;
+
+ pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Library" ) );
+ pProperties->Handle = -1;
+ pProperties->Value <<= sLibrary;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ }
+ else
+ {
+ pProperties->Name =
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "EventType" ) );
+ pProperties->Handle = -1;
+ pProperties->Value <<= OUString(
+ RTL_CONSTASCII_USTRINGPARAM("Script") );
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ pProperties++;
+
+ pProperties->Name = OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "Script" ) );
+ pProperties->Handle = -1;
+ pProperties->Value <<= msMacroName;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ }
+ }
+ else
+ {
+ pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "EventType" ) );
+ pProperties->Handle = -1;
+ pProperties->Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM("Presentation") );
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ pProperties++;
+
+ // ClickAction_BOOKMARK and ClickAction_DOCUMENT share the same xml event
+ // so check here if its realy a bookmark or maybe a document
+ if( meClickAction == ClickAction_BOOKMARK )
+ {
+ if( msBookmark.compareToAscii( "#", 1 ) != 0 )
+ meClickAction = ClickAction_DOCUMENT;
+ }
+
+ pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("ClickAction") );
+ pProperties->Handle = -1;
+ pProperties->Value <<= meClickAction;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ pProperties++;
+
+ switch( meClickAction )
+ {
+ case ClickAction_NONE:
+ case ClickAction_PREVPAGE:
+ case ClickAction_NEXTPAGE:
+ case ClickAction_FIRSTPAGE:
+ case ClickAction_LASTPAGE:
+ case ClickAction_INVISIBLE:
+ case ClickAction_STOPPRESENTATION:
+ break;
+
+ case ClickAction_BOOKMARK:
+ msBookmark = msBookmark.copy(1);
+
+ // Note: no break here!!!
+
+ case ClickAction_DOCUMENT:
+ case ClickAction_PROGRAM:
+ pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Bookmark") );
+ pProperties->Handle = -1;
+ pProperties->Value <<= msBookmark;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ break;
+
+ case ClickAction_VANISH:
+ pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Effect") );
+ pProperties->Handle = -1;
+ pProperties->Value <<= ImplSdXMLgetEffect( meEffect, meDirection, mnStartScale, sal_True );
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ pProperties++;
+
+ pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Speed") );
+ pProperties->Handle = -1;
+ pProperties->Value <<= meSpeed;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ pProperties++;
+
+ // NOTE: no break here!!!
+
+ case ClickAction_SOUND:
+ pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("SoundURL") );
+ pProperties->Handle = -1;
+ pProperties->Value <<= msSoundURL;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ pProperties++;
+
+ pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("PlayFull") );
+ pProperties->Handle = -1;
+ pProperties->Value = ::cppu::bool2any(mbPlayFull);
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ break;
+
+ case ClickAction_VERB:
+ pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Verb") );
+ pProperties->Handle = -1;
+ pProperties->Value <<= mnVerb;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ break;
+ case ClickAction_MACRO:
+ OSL_FAIL("xmloff::SdXMLEventContext::EndElement(), ClickAction_MACRO must be handled in different if case");
+ break;
+ default:
+ break;
+ }
+ }
+ xEvents->replaceByName( sAPIEventName, uno::Any( aProperties ) );
+
+ } while(0);
+}
+
+///////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLEventsContext, SvXMLImportContext );
+
+SdXMLEventsContext::SdXMLEventsContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName,
+ const Reference< XAttributeList>&, const Reference< XShape >& rxShape)
+: SvXMLImportContext(rImport, nPrfx, rLocalName), mxShape( rxShape )
+{
+}
+
+SdXMLEventsContext::~SdXMLEventsContext()
+{
+}
+
+SvXMLImportContext * SdXMLEventsContext::CreateChildContext( sal_uInt16 nPrfx, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList )
+{
+ return new SdXMLEventContext( GetImport(), nPrfx, rLocalName, xAttrList, mxShape );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/eventimp.hxx b/xmloff/source/draw/eventimp.hxx
new file mode 100644
index 000000000000..6d22bd836a6c
--- /dev/null
+++ b/xmloff/source/draw/eventimp.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_EVENTIMP_HXX
+#define _XMLOFF_EVENTIMP_HXX
+
+#include <xmloff/xmlictxt.hxx>
+#include <com/sun/star/drawing/XShape.hpp>
+
+//////////////////////////////////////////////////////////////////////////////
+// office:events inside a shape
+
+class SdXMLEventsContext : public SvXMLImportContext
+{
+private:
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShape > mxShape;
+
+public:
+ TYPEINFO();
+
+ SdXMLEventsContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rxShape );
+ virtual ~SdXMLEventsContext();
+
+ virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+};
+
+#endif // _XMLOFF_EVENTIMP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/layerexp.cxx b/xmloff/source/draw/layerexp.cxx
new file mode 100644
index 000000000000..9d2667a7c0e7
--- /dev/null
+++ b/xmloff/source/draw/layerexp.cxx
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <tools/debug.hxx>
+#include <com/sun/star/drawing/XLayerSupplier.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmlement.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "layerexp.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::com::sun::star::uno::Reference;
+
+using namespace ::cppu;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+using namespace ::xmloff::token;
+
+void SdXMLayerExporter::exportLayer( SvXMLExport& rExport )
+{
+ Reference< XLayerSupplier > xLayerSupplier( rExport.GetModel(), UNO_QUERY );
+ if( !xLayerSupplier.is() )
+ return;
+
+ Reference< XIndexAccess > xLayerManager( xLayerSupplier->getLayerManager(), UNO_QUERY );
+ if( !xLayerManager.is() )
+ return;
+
+ const sal_Int32 nCount = xLayerManager->getCount();
+ if( nCount == 0 )
+ return;
+
+ const OUString strName( RTL_CONSTASCII_USTRINGPARAM( "Name" ) );
+ const OUString strTitle( RTL_CONSTASCII_USTRINGPARAM( "Title" ) );
+ const OUString strDescription( RTL_CONSTASCII_USTRINGPARAM( "Description" ) );
+
+ OUString sTmp;
+
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_DRAW, XML_LAYER_SET, sal_True, sal_True );
+
+ for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
+ {
+ try
+ {
+ Reference< XPropertySet> xLayer( xLayerManager->getByIndex( nIndex ), UNO_QUERY_THROW );
+ xLayer->getPropertyValue( strName ) >>= sTmp;
+ if(sTmp.getLength())
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, sTmp );
+
+ SvXMLElementExport aEle( rExport, XML_NAMESPACE_DRAW, XML_LAYER, sal_True, sal_True );
+
+ // title property (as <svg:title> element)
+ xLayer->getPropertyValue(strTitle) >>= sTmp;
+ if(sTmp.getLength())
+ {
+ SvXMLElementExport aEventElemt(rExport, XML_NAMESPACE_SVG, XML_TITLE, sal_True, sal_False);
+ rExport.Characters(sTmp);
+ }
+
+ // description property (as <svg:desc> element)
+ xLayer->getPropertyValue(strDescription) >>= sTmp;
+ if(sTmp.getLength() > 0)
+ {
+ SvXMLElementExport aDesc(rExport, XML_NAMESPACE_SVG, XML_DESC, sal_True, sal_False);
+ rExport.Characters(sTmp);
+ }
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL("SdXMLayerExporter::exportLayer(), exception caught during export of one layer!");
+ }
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/layerexp.hxx b/xmloff/source/draw/layerexp.hxx
new file mode 100644
index 000000000000..1a4f9afbd0c2
--- /dev/null
+++ b/xmloff/source/draw/layerexp.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_LAYEREXP_HXX
+#define _XMLOFF_LAYEREXP_HXX
+
+class SvXMLExport;
+
+class SdXMLayerExporter
+{
+public:
+ static void exportLayer( SvXMLExport& rExport );
+};
+
+#endif // _XMLOFF_ANIMEXP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/layerimp.cxx b/xmloff/source/draw/layerimp.cxx
new file mode 100644
index 000000000000..c5c98a6dfed8
--- /dev/null
+++ b/xmloff/source/draw/layerimp.cxx
@@ -0,0 +1,183 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <tools/debug.hxx>
+#include <com/sun/star/drawing/XLayerManager.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/drawing/XLayerSupplier.hpp>
+#include <comphelper/extract.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlimp.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "layerimp.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+#include "XMLStringBufferImportContext.hxx"
+
+using namespace ::std;
+using namespace ::cppu;
+using namespace ::xmloff::token;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::xml;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+using ::xmloff::token::IsXMLToken;
+
+class SdXMLLayerContext : public SvXMLImportContext
+{
+public:
+ SdXMLLayerContext( SvXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, const Reference< XNameAccess >& xLayerManager );
+ virtual ~SdXMLLayerContext();
+
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const Reference< XAttributeList >& xAttrList );
+ virtual void EndElement();
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > mxLayerManager;
+ ::rtl::OUString msName;
+ ::rtl::OUStringBuffer sDescriptionBuffer;
+ ::rtl::OUStringBuffer sTitleBuffer;
+};
+
+SdXMLLayerContext::SdXMLLayerContext( SvXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, const Reference< XNameAccess >& xLayerManager )
+: SvXMLImportContext(rImport, nPrefix, rLocalName)
+, mxLayerManager( xLayerManager )
+{
+ const OUString strName( RTL_CONSTASCII_USTRINGPARAM( "Name" ) );
+
+ OUString aName;
+
+ const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString aLocalName;
+ if( GetImport().GetNamespaceMap().GetKeyByAttrName( xAttrList->getNameByIndex( i ), &aLocalName ) == XML_NAMESPACE_DRAW )
+ {
+ const OUString sValue( xAttrList->getValueByIndex( i ) );
+
+ if( IsXMLToken( aLocalName, XML_NAME ) )
+ {
+ msName = sValue;
+ break; // no more attributes needed
+ }
+ }
+ }
+
+}
+
+SdXMLLayerContext::~SdXMLLayerContext()
+{
+}
+
+SvXMLImportContext * SdXMLLayerContext::CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const Reference< XAttributeList >& )
+{
+ if( (XML_NAMESPACE_SVG == nPrefix) && IsXMLToken(rLocalName, XML_TITLE) )
+ {
+ return new XMLStringBufferImportContext( GetImport(), nPrefix, rLocalName, sTitleBuffer);
+ }
+ else if( (XML_NAMESPACE_SVG == nPrefix) && IsXMLToken(rLocalName, XML_DESC) )
+ {
+ return new XMLStringBufferImportContext( GetImport(), nPrefix, rLocalName, sDescriptionBuffer);
+ }
+ else
+ {
+ return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+ }
+}
+
+void SdXMLLayerContext::EndElement()
+{
+ DBG_ASSERT( msName.getLength(), "xmloff::SdXMLLayerContext::EndElement(), draw:layer element without draw:name!" );
+ if( msName.getLength() ) try
+ {
+ Reference< XPropertySet > xLayer;
+
+ if( mxLayerManager->hasByName( msName ) )
+ {
+ mxLayerManager->getByName( msName ) >>= xLayer;
+ DBG_ASSERT( xLayer.is(), "xmloff::SdXMLLayerContext::EndElement(), failed to get existing XLayer!" );
+ }
+ else
+ {
+ Reference< XLayerManager > xLayerManager( mxLayerManager, UNO_QUERY );
+ if( xLayerManager.is() )
+ xLayer = Reference< XPropertySet >::query( xLayerManager->insertNewByIndex( xLayerManager->getCount() ) );
+ DBG_ASSERT( xLayer.is(), "xmloff::SdXMLLayerContext::EndElement(), failed to create new XLayer!" );
+
+ if( xLayer.is() )
+ xLayer->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ), Any( msName ) );
+ }
+
+ if( xLayer.is() )
+ {
+ xLayer->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ), Any( sTitleBuffer.makeStringAndClear() ) );
+ xLayer->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Description") ), Any( sDescriptionBuffer.makeStringAndClear() ) );
+ }
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL("SdXMLLayerContext::EndElement(), exception caught!");
+ }
+}
+
+
+TYPEINIT1( SdXMLLayerSetContext, SvXMLImportContext );
+
+SdXMLLayerSetContext::SdXMLLayerSetContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>&)
+: SvXMLImportContext(rImport, nPrfx, rLocalName)
+{
+ Reference< XLayerSupplier > xLayerSupplier( rImport.GetModel(), UNO_QUERY );
+ DBG_ASSERT( xLayerSupplier.is(), "xmloff::SdXMLLayerSetContext::SdXMLLayerSetContext(), XModel is not supporting XLayerSupplier!" );
+ if( xLayerSupplier.is() )
+ mxLayerManager = xLayerSupplier->getLayerManager();
+}
+
+SdXMLLayerSetContext::~SdXMLLayerSetContext()
+{
+}
+
+SvXMLImportContext * SdXMLLayerSetContext::CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList )
+{
+ return new SdXMLLayerContext( GetImport(), nPrefix, rLocalName, xAttrList, mxLayerManager );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/layerimp.hxx b/xmloff/source/draw/layerimp.hxx
new file mode 100644
index 000000000000..456d57ca8ade
--- /dev/null
+++ b/xmloff/source/draw/layerimp.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_LAYERIMP_HXX
+#define _XMLOFF_LAYERIMP_HXX
+
+#include <xmloff/xmlictxt.hxx>
+#include <com/sun/star/container/XNameAccess.hpp>
+
+class AnimImpImpl;
+
+//////////////////////////////////////////////////////////////////////////////
+// presentations:animations
+
+class SdXMLLayerSetContext : public SvXMLImportContext
+{
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > mxLayerManager;
+
+public:
+ TYPEINFO();
+
+ SdXMLLayerSetContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+ virtual ~SdXMLLayerSetContext();
+
+ virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+};
+
+#endif // _XMLOFF_ANIMIMP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/numithdl.cxx b/xmloff/source/draw/numithdl.cxx
new file mode 100644
index 000000000000..83b9609c5400
--- /dev/null
+++ b/xmloff/source/draw/numithdl.cxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <numithdl.hxx>
+
+using namespace ::com::sun::star;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLNumRulePropHdl
+//
+
+XMLNumRulePropHdl::XMLNumRulePropHdl( ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XAnyCompare > xNumRuleCompare )
+: mxNumRuleCompare( xNumRuleCompare )
+{
+}
+
+XMLNumRulePropHdl::~XMLNumRulePropHdl()
+{
+ // Nothing to do
+}
+
+bool XMLNumRulePropHdl::equals( const uno::Any& r1, const uno::Any& r2 ) const
+{
+ return mxNumRuleCompare.is() && mxNumRuleCompare->compare( r1, r2 ) == 0;
+}
+
+sal_Bool XMLNumRulePropHdl::importXML( const ::rtl::OUString& /*rStrImpValue*/, ::com::sun::star::uno::Any& /*rValue*/, const SvXMLUnitConverter& /*rUnitConverter*/ ) const
+{
+ return sal_False;
+}
+
+sal_Bool XMLNumRulePropHdl::exportXML( ::rtl::OUString& /*rStrExpValue*/, const ::com::sun::star::uno::Any& /*rValue*/, const SvXMLUnitConverter& /*rUnitConverter*/ ) const
+{
+ return sal_False;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/numithdl.hxx b/xmloff/source/draw/numithdl.hxx
new file mode 100644
index 000000000000..bda9850f3b60
--- /dev/null
+++ b/xmloff/source/draw/numithdl.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PROPERTYHANDLER_NUMRULE_HXX
+#define _XMLOFF_PROPERTYHANDLER_NUMRULE_HXX
+
+#include <com/sun/star/ucb/XAnyCompare.hpp>
+#include <xmloff/xmlprhdl.hxx>
+
+/**
+ PropertyHandler for the list-style
+*/
+class XMLNumRulePropHdl : public XMLPropertyHandler
+{
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XAnyCompare > mxNumRuleCompare;
+public:
+ XMLNumRulePropHdl( ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XAnyCompare > xNumRuleCompare );
+ virtual ~XMLNumRulePropHdl();
+
+ virtual bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const;
+
+ /// NumRules will be imported/exported as XML-Elements. So the Import/Export-work must be done at another place.
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_NUMRULE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/propimp0.cxx b/xmloff/source/draw/propimp0.cxx
new file mode 100644
index 000000000000..c1e97269427e
--- /dev/null
+++ b/xmloff/source/draw/propimp0.cxx
@@ -0,0 +1,275 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/string.hxx>
+#include <rtl/ustrbuf.hxx>
+#include "propimp0.hxx"
+#include <com/sun/star/drawing/LineDash.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmlimp.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+// implementation of graphic property Stroke
+
+
+//////////////////////////////////////////////////////////////////////////////
+// implementation of presentation page property Change
+
+//////////////////////////////////////////////////////////////////////////////
+// implementation of an effect duration property handler
+
+
+XMLDurationPropertyHdl::~XMLDurationPropertyHdl()
+{
+}
+
+sal_Bool XMLDurationPropertyHdl::importXML(
+ const OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ util::DateTime aTime;
+ SvXMLUnitConverter::convertTime( aTime, rStrImpValue );
+
+ const sal_Int32 nSeconds = ( aTime.Hours * 60 + aTime.Minutes ) * 60 + aTime.Seconds;
+ rValue <<= nSeconds;
+
+ return sal_True;
+}
+
+sal_Bool XMLDurationPropertyHdl::exportXML(
+ OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ sal_Int32 nVal = 0;
+
+ if(rValue >>= nVal)
+ {
+ util::DateTime aTime( 0, (sal_uInt16)nVal, 0, 0, 0, 0, 0 );
+
+ OUStringBuffer aOut;
+ SvXMLUnitConverter::convertTime( aOut, aTime );
+ rStrExpValue = aOut.makeStringAndClear();
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// implementation of an opacity property handler
+
+
+XMLOpacityPropertyHdl::XMLOpacityPropertyHdl( SvXMLImport* pImport )
+: mpImport( pImport )
+{
+}
+
+XMLOpacityPropertyHdl::~XMLOpacityPropertyHdl()
+{
+}
+
+sal_Bool XMLOpacityPropertyHdl::importXML(
+ const OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int32 nValue = 0;
+
+ if( rStrImpValue.indexOf( sal_Unicode('%') ) != -1 )
+ {
+ if( SvXMLUnitConverter::convertPercent( nValue, rStrImpValue ) )
+ bRet = sal_True;
+ }
+ else
+ {
+ nValue = sal_Int32( rStrImpValue.toDouble() * 100.0 );
+ bRet = sal_True;
+ }
+
+ if( bRet )
+ {
+ // check ranges
+ if( nValue < 0 )
+ nValue = 0;
+ if( nValue > 100 )
+ nValue = 100;
+
+ // convert xml opacity to api transparency
+ nValue = 100 - nValue;
+
+ // #i42959#
+ if( mpImport )
+ {
+ sal_Int32 nUPD, nBuild;
+ if( mpImport->getBuildIds( nUPD, nBuild ) )
+ {
+ // correct import of documents written prior to StarOffice 8/OOO 2.0 final
+ if( (nUPD == 680) && (nBuild < 8951) )
+ nValue = 100 - nValue;
+ }
+ }
+
+ rValue <<= sal_uInt16(nValue);
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLOpacityPropertyHdl::exportXML(
+ OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_uInt16 nVal = sal_uInt16();
+
+ if( rValue >>= nVal )
+ {
+ OUStringBuffer aOut;
+
+ nVal = 100 - nVal;
+ SvXMLUnitConverter::convertPercent( aOut, nVal );
+ rStrExpValue = aOut.makeStringAndClear();
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// implementation of an text animation step amount
+
+XMLTextAnimationStepPropertyHdl::~XMLTextAnimationStepPropertyHdl()
+{
+}
+
+sal_Bool XMLTextAnimationStepPropertyHdl::importXML(
+ const OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int32 nValue = 0;
+
+ const OUString aPX( RTL_CONSTASCII_USTRINGPARAM( "px" ) );
+ sal_Int32 nPos = rStrImpValue.indexOf( aPX );
+ if( nPos != -1 )
+ {
+ if( rUnitConverter.convertNumber( nValue, rStrImpValue.copy( 0, nPos ) ) )
+ {
+ rValue <<= sal_Int16( -nValue );
+ bRet = sal_True;
+ }
+ }
+ else
+ {
+ if( rUnitConverter.convertMeasure( nValue, rStrImpValue ) )
+ {
+ rValue <<= sal_Int16( nValue );
+ bRet = sal_True;
+ }
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLTextAnimationStepPropertyHdl::exportXML(
+ OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int16 nVal = sal_Int16();
+
+ if( rValue >>= nVal )
+ {
+ OUStringBuffer aOut;
+
+ if( nVal < 0 )
+ {
+ const OUString aPX( RTL_CONSTASCII_USTRINGPARAM( "px" ) );
+ rUnitConverter.convertNumber( aOut, (sal_Int32)-nVal );
+ aOut.append( aPX );
+ }
+ else
+ {
+ rUnitConverter.convertMeasure( aOut, nVal );
+ }
+
+ rStrExpValue = aOut.makeStringAndClear();
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+#include "sdxmlexp_impl.hxx"
+
+XMLDateTimeFormatHdl::XMLDateTimeFormatHdl( SvXMLExport* pExport )
+: mpExport( pExport )
+{
+}
+
+XMLDateTimeFormatHdl::~XMLDateTimeFormatHdl()
+{
+}
+
+sal_Bool XMLDateTimeFormatHdl::importXML( const rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ rValue <<= rStrImpValue;
+ return true;
+}
+
+sal_Bool XMLDateTimeFormatHdl::exportXML( rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Int32 nNumberFormat = 0;
+ if( mpExport && (rValue >>= nNumberFormat) )
+ {
+ mpExport->addDataStyle( nNumberFormat );
+ rStrExpValue = mpExport->getDataStyleName( nNumberFormat );
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/propimp0.hxx b/xmloff/source/draw/propimp0.hxx
new file mode 100644
index 000000000000..81794228e584
--- /dev/null
+++ b/xmloff/source/draw/propimp0.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _PROPIMP0_HXX
+#define _PROPIMP0_HXX
+
+#include <xmloff/xmlprhdl.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// graphic property Stroke
+
+class XMLDurationPropertyHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLDurationPropertyHdl();
+ virtual sal_Bool importXML( const rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+class SvXMLImport;
+class XMLOpacityPropertyHdl : public XMLPropertyHandler
+{
+private:
+ SvXMLImport* mpImport;
+public:
+ XMLOpacityPropertyHdl( SvXMLImport* pImport );
+ virtual ~XMLOpacityPropertyHdl();
+ virtual sal_Bool importXML( const rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+class XMLTextAnimationStepPropertyHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLTextAnimationStepPropertyHdl();
+ virtual sal_Bool importXML( const rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+class SvXMLExport;
+class XMLDateTimeFormatHdl : public XMLPropertyHandler
+{
+private:
+ SvXMLExport* mpExport;
+
+public:
+ XMLDateTimeFormatHdl( SvXMLExport* pExport );
+ virtual ~XMLDateTimeFormatHdl();
+ virtual sal_Bool importXML( const rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+
+#endif // _PROPIMP0_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/sdpropls.cxx b/xmloff/source/draw/sdpropls.cxx
new file mode 100644
index 000000000000..d70b6cf9221e
--- /dev/null
+++ b/xmloff/source/draw/sdpropls.cxx
@@ -0,0 +1,1759 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/animations/TransitionType.hpp>
+#include <com/sun/star/ucb/XAnyCompareFactory.hpp>
+#include <com/sun/star/container/XIndexReplace.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/drawing/LineJoint.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/presentation/AnimationSpeed.hpp>
+#include <com/sun/star/presentation/FadeEffect.hpp>
+#include <com/sun/star/drawing/ConnectorType.hpp>
+#include <com/sun/star/drawing/RectanglePoint.hpp>
+#include <com/sun/star/drawing/CircleKind.hpp>
+
+#include <com/sun/star/drawing/BitmapMode.hpp>
+#include <com/sun/star/text/WritingMode.hpp>
+#include <xmloff/EnumPropertyHdl.hxx>
+#include <xmloff/NamedBoolPropertyHdl.hxx>
+#include <xmloff/WordWrapPropertyHdl.hxx>
+#include "numithdl.hxx"
+#include "XMLBitmapRepeatOffsetPropertyHandler.hxx"
+#include "XMLFillBitmapSizePropertyHandler.hxx"
+#include "XMLBitmapLogicalSizePropertyHandler.hxx"
+#include <com/sun/star/drawing/TextAnimationKind.hpp>
+#include <com/sun/star/drawing/TextAnimationDirection.hpp>
+#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
+#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
+#include <com/sun/star/drawing/TextFitToSizeType.hpp>
+#include <com/sun/star/drawing/MeasureTextHorzPos.hpp>
+#include <com/sun/star/drawing/MeasureTextVertPos.hpp>
+#include <xmloff/controlpropertyhdl.hxx>
+#include <xmloff/xmltoken.hxx>
+#include "sdpropls.hxx"
+#include "propimp0.hxx"
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmlnmspe.hxx>
+#include <com/sun/star/drawing/NormalsKind.hpp>
+#include <com/sun/star/drawing/TextureProjectionMode.hpp>
+#include <com/sun/star/drawing/TextureKind.hpp>
+#include <com/sun/star/drawing/TextureMode.hpp>
+#include <xmloff/txtprmap.hxx>
+#include "XMLClipPropertyHandler.hxx"
+#include "XMLIsPercentagePropertyHandler.hxx"
+#include "XMLPercentOrMeasurePropertyHandler.hxx"
+#include "animations.hxx"
+#include <xmloff/xmluconv.hxx>
+
+#include "sdxmlexp_impl.hxx"
+
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+#define _MAP(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, type, context, SvtSaveOptions::ODFVER_010 }
+#define _MAPV(name,prefix,token,type,context,version) { name, sizeof(name)-1, prefix, token, type, context, version }
+#define GMAP(name,prefix,token,type,context) _MAP(name,prefix,token,type|XML_TYPE_PROP_GRAPHIC,context)
+#define GMAPV(name,prefix,token,type,context,version) _MAPV(name,prefix,token,type|XML_TYPE_PROP_GRAPHIC,context,version)
+#define DPMAP(name,prefix,token,type,context) _MAP(name,prefix,token,type|XML_TYPE_PROP_DRAWING_PAGE,context)
+#define TMAP(name,prefix,token,type,context) _MAP(name,prefix,token,type|XML_TYPE_PROP_TEXT,context)
+#define PMAP(name,prefix,token,type,context) _MAP(name,prefix,token,type|XML_TYPE_PROP_PARAGRAPH,context)
+#define MAP_END() { 0L, 0, 0, XML_EMPTY, 0 ,0, SvtSaveOptions::ODFVER_010}
+
+//////////////////////////////////////////////////////////////////////////////
+// entry list for graphic properties
+
+const XMLPropertyMapEntry aXMLSDProperties[] =
+{
+ // this entry must be first! this is needed for XMLShapeImportHelper::CreateExternalShapePropMapper
+ GMAP( "UserDefinedAttributes", XML_NAMESPACE_TEXT, XML_XMLNS, XML_TYPE_ATTRIBUTE_CONTAINER | MID_FLAG_SPECIAL_ITEM, 0 ),
+
+ // stroke attributes
+ GMAP( "LineStyle", XML_NAMESPACE_DRAW, XML_STROKE, XML_SD_TYPE_STROKE, 0 ),
+ GMAP( "LineDashName", XML_NAMESPACE_DRAW, XML_STROKE_DASH, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT , CTF_DASHNAME ),
+ GMAP( "LineWidth", XML_NAMESPACE_SVG, XML_STROKE_WIDTH, XML_TYPE_MEASURE, 0 ),
+ GMAP( "LineColor", XML_NAMESPACE_SVG, XML_STROKE_COLOR, XML_TYPE_COLOR, 0 ),
+ GMAP( "LineStartName", XML_NAMESPACE_DRAW, XML_MARKER_START, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_LINESTARTNAME ),
+ GMAP( "LineStartWidth", XML_NAMESPACE_DRAW, XML_MARKER_START_WIDTH, XML_TYPE_MEASURE, 0 ),
+ GMAP( "LineStartCenter", XML_NAMESPACE_DRAW, XML_MARKER_START_CENTER, XML_TYPE_BOOL, 0 ),
+ GMAP( "LineEndName", XML_NAMESPACE_DRAW, XML_MARKER_END, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_LINEENDNAME ),
+ GMAP( "LineEndWidth", XML_NAMESPACE_DRAW, XML_MARKER_END_WIDTH, XML_TYPE_MEASURE, 0 ),
+ GMAP( "LineEndCenter", XML_NAMESPACE_DRAW, XML_MARKER_END_CENTER, XML_TYPE_BOOL, 0 ),
+ GMAP( "LineTransparence", XML_NAMESPACE_SVG, XML_STROKE_OPACITY, XML_SD_TYPE_OPACITY, 0 ),
+ GMAP( "LineJoint", XML_NAMESPACE_DRAW, XML_STROKE_LINEJOIN, XML_SD_TYPE_LINEJOIN, 0 ),
+
+ // fill attributes
+ GMAP( "FillStyle", XML_NAMESPACE_DRAW, XML_FILL, XML_SD_TYPE_FILLSTYLE, 0 ),
+ GMAP( "FillColor", XML_NAMESPACE_DRAW, XML_FILL_COLOR, XML_TYPE_COLOR, 0 ),
+ GMAP( "FillColor2", XML_NAMESPACE_DRAW, XML_SECONDARY_FILL_COLOR, XML_TYPE_COLOR, 0 ),
+ GMAP( "FillGradientName", XML_NAMESPACE_DRAW, XML_FILL_GRADIENT_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLGRADIENTNAME ),
+ GMAP( "FillGradientStepCount", XML_NAMESPACE_DRAW, XML_GRADIENT_STEP_COUNT, XML_TYPE_NUMBER16, 0 ),
+ GMAP( "FillHatchName", XML_NAMESPACE_DRAW, XML_FILL_HATCH_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLHATCHNAME ),
+ GMAP( "FillBackground", XML_NAMESPACE_DRAW, XML_FILL_HATCH_SOLID, XML_TYPE_BOOL, 0 ),
+ GMAP( "FillBitmapName", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLBITMAPNAME ),
+ GMAP( "FillTransparence", XML_NAMESPACE_DRAW, XML_OPACITY, XML_TYPE_NEG_PERCENT16|MID_FLAG_MULTI_PROPERTY, 0 ), // exists in SW, too
+ GMAP( "FillTransparenceGradientName", XML_NAMESPACE_DRAW, XML_OPACITY_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLTRANSNAME ),
+
+ GMAP( "FillBitmapSizeX", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_WIDTH, XML_SD_TYPE_FILLBITMAPSIZE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ GMAP( "FillBitmapLogicalSize", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_WIDTH, XML_SD_TYPE_LOGICAL_SIZE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ GMAP( "FillBitmapSizeY", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_HEIGHT, XML_SD_TYPE_FILLBITMAPSIZE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ GMAP( "FillBitmapLogicalSize", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_HEIGHT, XML_SD_TYPE_LOGICAL_SIZE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ GMAP( "FillBitmapMode", XML_NAMESPACE_STYLE,XML_REPEAT, XML_SD_TYPE_BITMAP_MODE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ GMAP( "FillBitmapPositionOffsetX", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT_X, XML_TYPE_PERCENT, 0 ),
+ GMAP( "FillBitmapPositionOffsetY", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT_Y, XML_TYPE_PERCENT, 0 ),
+ GMAP( "FillBitmapRectanglePoint", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT, XML_SD_TYPE_BITMAP_REFPOINT, 0 ),
+ GMAP( "FillBitmapOffsetX", XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET, XML_SD_TYPE_BITMAPREPOFFSETX|MID_FLAG_MULTI_PROPERTY, CTF_REPEAT_OFFSET_X ),
+ GMAP( "FillBitmapOffsetY", XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET, XML_SD_TYPE_BITMAPREPOFFSETY|MID_FLAG_MULTI_PROPERTY, CTF_REPEAT_OFFSET_Y ),
+
+ // text frame attributes
+ GMAP( "TextHorizontalAdjust", XML_NAMESPACE_DRAW, XML_TEXTAREA_HORIZONTAL_ALIGN, XML_SD_TYPE_TEXT_ALIGN, 0 ),
+ GMAP( "TextVerticalAdjust", XML_NAMESPACE_DRAW, XML_TEXTAREA_VERTICAL_ALIGN, XML_SD_TYPE_VERTICAL_ALIGN, 0 ),
+ GMAP( "TextAutoGrowHeight", XML_NAMESPACE_DRAW, XML_AUTO_GROW_HEIGHT, XML_TYPE_BOOL, 0 ),
+ GMAP( "TextAutoGrowWidth", XML_NAMESPACE_DRAW, XML_AUTO_GROW_WIDTH, XML_TYPE_BOOL, 0 ),
+ GMAP( "TextFitToSize", XML_NAMESPACE_DRAW, XML_FIT_TO_SIZE, XML_SD_TYPE_FITTOSIZE, 0 ),
+ GMAP( "TextContourFrame", XML_NAMESPACE_DRAW, XML_FIT_TO_CONTOUR, XML_TYPE_BOOL, 0 ),
+ GMAP( "TextMaximumFrameHeight", XML_NAMESPACE_FO, XML_MAX_HEIGHT, XML_TYPE_MEASURE, 0 ),
+ GMAP( "TextMaximumFrameWidth", XML_NAMESPACE_FO, XML_MAX_WIDTH, XML_TYPE_MEASURE, 0 ),
+ GMAP( "TextMinimumFrameHeight", XML_NAMESPACE_FO, XML_MIN_HEIGHT, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, 0 ), // exists in SW, too
+ GMAP( "TextMinimumFrameWidth", XML_NAMESPACE_FO, XML_MIN_WIDTH, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ GMAP( "TextUpperDistance", XML_NAMESPACE_FO, XML_PADDING_TOP, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, 0 ), // exists in SW, too
+ GMAP( "TextLowerDistance", XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, 0 ), // exists in SW, too
+ GMAP( "TextLeftDistance", XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, 0 ), // exists in SW, too
+ GMAP( "TextRightDistance", XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, 0 ), // exists in SW, too
+ PMAP( "TextWritingMode", XML_NAMESPACE_STYLE,XML_WRITING_MODE, XML_SD_TYPE_WRITINGMODE|MID_FLAG_MULTI_PROPERTY, CTF_WRITINGMODE ),
+ GMAP( "NumberingRules", XML_NAMESPACE_TEXT, XML_LIST_STYLE, XML_SD_TYPE_NUMBULLET|MID_FLAG_ELEMENT_ITEM, CTF_NUMBERINGRULES ),
+ GMAP( "NumberingRules", XML_NAMESPACE_TEXT, XML_LIST_STYLE_NAME, XML_TYPE_STRING, CTF_SD_NUMBERINGRULES_NAME ),
+ GMAP( "TextWordWrap", XML_NAMESPACE_FO, XML_WRAP_OPTION, XML_TYPE_WRAP_OPTION, 0 ),
+
+ // shadow attributes
+ GMAP( "Shadow", XML_NAMESPACE_DRAW, XML_SHADOW, XML_SD_TYPE_SHADOW, 0 ),
+ GMAP( "ShadowXDistance", XML_NAMESPACE_DRAW, XML_SHADOW_OFFSET_X, XML_TYPE_MEASURE, 0 ),
+ GMAP( "ShadowYDistance", XML_NAMESPACE_DRAW, XML_SHADOW_OFFSET_Y, XML_TYPE_MEASURE, 0 ),
+ GMAP( "ShadowColor", XML_NAMESPACE_DRAW, XML_SHADOW_COLOR, XML_TYPE_COLOR, 0 ),
+ GMAP( "ShadowTransparence", XML_NAMESPACE_DRAW, XML_SHADOW_OPACITY, XML_TYPE_NEG_PERCENT, 0 ),
+
+ // graphic attributes
+ GMAP( "GraphicColorMode", XML_NAMESPACE_DRAW, XML_COLOR_MODE, XML_TYPE_COLOR_MODE, 0 ), // exists in SW, too, with same property name
+ GMAP( "AdjustLuminance", XML_NAMESPACE_DRAW, XML_LUMINANCE, XML_TYPE_PERCENT16, 0 ), // signed? exists in SW, too, with same property name
+ GMAP( "AdjustContrast", XML_NAMESPACE_DRAW, XML_CONTRAST, XML_TYPE_PERCENT16, 0 ), // signed? exists in SW, too, with same property name
+ GMAP( "Gamma", XML_NAMESPACE_DRAW, XML_GAMMA, XML_TYPE_DOUBLE_PERCENT, 0 ), // signed? exists in SW, too, with same property name
+ GMAP( "AdjustRed", XML_NAMESPACE_DRAW, XML_RED, XML_TYPE_PERCENT16, 0 ), // signed? exists in SW, too, with same property name
+ GMAP( "AdjustGreen", XML_NAMESPACE_DRAW, XML_GREEN, XML_TYPE_PERCENT16, 0 ), // signed? exists in SW, too, with same property name
+ GMAP( "AdjustBlue", XML_NAMESPACE_DRAW, XML_BLUE, XML_TYPE_PERCENT16, 0 ), // signed? exists in SW, too, with same property name
+ GMAPV( "GraphicCrop", XML_NAMESPACE_FO, XML_CLIP, XML_TYPE_TEXT_CLIP, CTF_TEXT_CLIP, SvtSaveOptions::ODFVER_012 ), // exists in SW, too, with same property name
+ GMAP( "GraphicCrop", XML_NAMESPACE_FO, XML_CLIP, XML_TYPE_TEXT_CLIP11, CTF_TEXT_CLIP11 ), // exists in SW, too, with same property name
+ GMAP( "Transparency", XML_NAMESPACE_DRAW, XML_IMAGE_OPACITY, XML_TYPE_NEG_PERCENT16|MID_FLAG_MULTI_PROPERTY, 0 ), // exists in SW, too, with same property name // #i25616#
+ GMAP( "IsMirrored", XML_NAMESPACE_STYLE, XML_MIRROR, XML_TYPE_SD_MIRROR|MID_FLAG_MULTI_PROPERTY, 0 ), // exists in SW, too // #i40214#
+
+ // animation text attributes
+ TMAP( "TextAnimationKind", XML_NAMESPACE_STYLE,XML_TEXT_BLINKING, XML_TYPE_TEXT_ANIMATION_BLINKING, CTF_TEXTANIMATION_BLINKING ),
+ GMAP( "TextAnimationKind", XML_NAMESPACE_TEXT, XML_ANIMATION, XML_TYPE_TEXT_ANIMATION, CTF_TEXTANIMATION_KIND ),
+ GMAP( "TextAnimationDirection", XML_NAMESPACE_TEXT, XML_ANIMATION_DIRECTION, XML_TYPE_TEXT_ANIMATION_DIRECTION, 0 ),
+ GMAP( "TextAnimationStartInside", XML_NAMESPACE_TEXT, XML_ANIMATION_START_INSIDE, XML_TYPE_BOOL, 0 ),
+ GMAP( "TextAnimationStopInside", XML_NAMESPACE_TEXT, XML_ANIMATION_STOP_INSIDE, XML_TYPE_BOOL, 0 ),
+ GMAP( "TextAnimationCount", XML_NAMESPACE_TEXT, XML_ANIMATION_REPEAT, XML_TYPE_NUMBER16, 0 ),
+ GMAP( "TextAnimationDelay", XML_NAMESPACE_TEXT, XML_ANIMATION_DELAY, XML_TYPE_DURATION16_MS, 0 ),
+ GMAP( "TextAnimationAmount", XML_NAMESPACE_TEXT, XML_ANIMATION_STEPS, XML_TYPE_TEXT_ANIMATION_STEPS, 0 ),
+
+ // connector attributes
+ GMAP( "EdgeNode1HorzDist", XML_NAMESPACE_DRAW, XML_START_LINE_SPACING_HORIZONTAL, XML_TYPE_MEASURE, 0 ),
+ GMAP( "EdgeNode1VertDist", XML_NAMESPACE_DRAW, XML_START_LINE_SPACING_VERTICAL, XML_TYPE_MEASURE, 0 ),
+ GMAP( "EdgeNode2HorzDist", XML_NAMESPACE_DRAW, XML_END_LINE_SPACING_HORIZONTAL, XML_TYPE_MEASURE, 0 ),
+ GMAP( "EdgeNode2VertDist", XML_NAMESPACE_DRAW, XML_END_LINE_SPACING_VERTICAL, XML_TYPE_MEASURE, 0 ),
+
+ // measure attributes
+ GMAP( "MeasureLineDistance", XML_NAMESPACE_DRAW, XML_LINE_DISTANCE, XML_TYPE_MEASURE, 0 ),
+ GMAP( "MeasureHelpLineOverhang", XML_NAMESPACE_DRAW, XML_GUIDE_OVERHANG, XML_TYPE_MEASURE, 0 ),
+ GMAP( "MeasureHelpLineDistance", XML_NAMESPACE_DRAW, XML_GUIDE_DISTANCE, XML_TYPE_MEASURE, 0 ),
+ GMAP( "MeasureHelpLine1Length", XML_NAMESPACE_DRAW, XML_START_GUIDE, XML_TYPE_MEASURE, 0 ),
+ GMAP( "MeasureHelpLine2Length", XML_NAMESPACE_DRAW, XML_END_GUIDE, XML_TYPE_MEASURE, 0 ),
+ GMAP( "MeasureTextHorizontalPosition", XML_NAMESPACE_DRAW, XML_MEASURE_ALIGN, XML_SD_TYPE_MEASURE_HALIGN, 0 ),
+ GMAP( "MeasureTextVerticalPosition", XML_NAMESPACE_DRAW, XML_MEASURE_VERTICAL_ALIGN, XML_SD_TYPE_MEASURE_VALIGN, 0 ),
+ GMAP( "MeasureUnit", XML_NAMESPACE_DRAW, XML_UNIT, XML_SD_TYPE_MEASURE_UNIT, 0 ),
+ GMAP( "MeasureShowUnit", XML_NAMESPACE_DRAW, XML_SHOW_UNIT, XML_TYPE_BOOL, 0 ),
+ GMAP( "MeasureBelowReferenceEdge", XML_NAMESPACE_DRAW, XML_PLACING, XML_SD_TYPE_MEASURE_PLACING, 0 ),
+ GMAP( "MeasureTextRotate90", XML_NAMESPACE_DRAW, XML_PARALLEL, XML_TYPE_BOOL, 0 ),
+ GMAP( "MeasureDecimalPlaces", XML_NAMESPACE_DRAW, XML_DECIMAL_PLACES, XML_TYPE_NUMBER16, 0 ),
+
+ // 3D geometry attributes
+ GMAP( "D3DHorizontalSegments", XML_NAMESPACE_DR3D, XML_HORIZONTAL_SEGMENTS, XML_TYPE_NUMBER, 0 ),
+ GMAP( "D3DVerticalSegments", XML_NAMESPACE_DR3D, XML_VERTICAL_SEGMENTS, XML_TYPE_NUMBER, 0 ),
+ GMAP( "D3DPercentDiagonal", XML_NAMESPACE_DR3D, XML_EDGE_ROUNDING, XML_TYPE_PERCENT, 0 ),
+ GMAP( "D3DBackscale", XML_NAMESPACE_DR3D, XML_BACK_SCALE, XML_TYPE_PERCENT, 0 ),
+ GMAP( "D3DEndAngle", XML_NAMESPACE_DR3D, XML_END_ANGLE, XML_TYPE_NUMBER, 0 ),
+ GMAP( "D3DDepth", XML_NAMESPACE_DR3D, XML_DEPTH, XML_TYPE_MEASURE, 0 ),
+ GMAP( "D3DDoubleSided", XML_NAMESPACE_DR3D, XML_BACKFACE_CULLING, XML_SD_TYPE_BACKFACE_CULLING, 0 ),
+
+ // #107245# New 3D properties which are possible for lathe and extrude 3d objects
+ GMAP( "D3DCloseFront", XML_NAMESPACE_DR3D, XML_CLOSE_FRONT, XML_TYPE_BOOL, 0 ),
+ GMAP( "D3DCloseBack", XML_NAMESPACE_DR3D, XML_CLOSE_BACK, XML_TYPE_BOOL, 0 ),
+
+ // 3D lighting attributes
+ GMAP( "D3DNormalsKind", XML_NAMESPACE_DR3D, XML_NORMALS_KIND, XML_SD_TYPE_NORMALS_KIND, 0 ),
+ GMAP( "D3DNormalsInvert", XML_NAMESPACE_DR3D, XML_NORMALS_DIRECTION, XML_SD_TYPE_NORMALS_DIRECTION, 0 ),
+
+ // 3D texture attributes
+ GMAP( "D3DTextureProjectionX", XML_NAMESPACE_DR3D, XML_TEX_GENERATION_MODE_X, XML_SD_TYPE_TEX_GENERATION_MODE_X, 0 ),
+ GMAP( "D3DTextureProjectionY", XML_NAMESPACE_DR3D, XML_TEX_GENERATION_MODE_Y, XML_SD_TYPE_TEX_GENERATION_MODE_Y, 0 ),
+ GMAP( "D3DTextureKind", XML_NAMESPACE_DR3D, XML_TEX_KIND, XML_SD_TYPE_TEX_KIND, 0 ),
+ GMAP( "D3DTextureMode", XML_NAMESPACE_DR3D, XML_TEX_MODE, XML_SD_TYPE_TEX_MODE, 0 ),
+ GMAP( "D3DTextureFilter", XML_NAMESPACE_DR3D, XML_TEX_FILTER, XML_SD_TYPE_BACKFACE_CULLING, 0 ),
+
+ // 3D material attributes
+ GMAP( "D3DMaterialColor", XML_NAMESPACE_DR3D, XML_DIFFUSE_COLOR, XML_TYPE_COLOR, 0 ),
+ GMAP( "D3DMaterialEmission", XML_NAMESPACE_DR3D, XML_EMISSIVE_COLOR, XML_TYPE_COLOR, 0 ),
+ GMAP( "D3DMaterialSpecular", XML_NAMESPACE_DR3D, XML_SPECULAR_COLOR, XML_TYPE_COLOR, 0 ),
+ GMAP( "D3DMaterialSpecularIntensity", XML_NAMESPACE_DR3D, XML_SHININESS, XML_TYPE_PERCENT, 0 ),
+
+ // 3D shadow attributes
+ GMAP( "D3DShadow3D", XML_NAMESPACE_DR3D, XML_SHADOW, XML_SD_TYPE_SHADOW, 0 ),
+
+ // #FontWork# attributes
+ GMAP( "FontWorkStyle", XML_NAMESPACE_DRAW, XML_FONTWORK_STYLE, XML_SD_TYPE_FONTWORK_STYLE, CTF_FONTWORK_STYLE ),
+ GMAP( "FontWorkAdjust", XML_NAMESPACE_DRAW, XML_FONTWORK_ADJUST, XML_SD_TYPE_FONTWORK_ADJUST,CTF_FONTWORK_ADJUST ),
+ GMAP( "FontWorkDistance", XML_NAMESPACE_DRAW, XML_FONTWORK_DISTANCE, XML_TYPE_MEASURE, CTF_FONTWORK_DISTANCE ),
+ GMAP( "FontWorkStart", XML_NAMESPACE_DRAW, XML_FONTWORK_START, XML_TYPE_MEASURE, CTF_FONTWORK_START ),
+ GMAP( "FontWorkMirror", XML_NAMESPACE_DRAW, XML_FONTWORK_MIRROR, XML_TYPE_BOOL, CTF_FONTWORK_MIRROR ),
+ GMAP( "FontWorkOutline", XML_NAMESPACE_DRAW, XML_FONTWORK_OUTLINE, XML_TYPE_BOOL, CTF_FONTWORK_OUTLINE ),
+ GMAP( "FontWorkShadow", XML_NAMESPACE_DRAW, XML_FONTWORK_SHADOW, XML_SD_TYPE_FONTWORK_SHADOW,CTF_FONTWORK_SHADOW ),
+ GMAP( "FontWorkShadowColor", XML_NAMESPACE_DRAW, XML_FONTWORK_SHADOW_COLOR, XML_TYPE_COLOR, CTF_FONTWORK_SHADOWCOLOR ),
+ GMAP( "FontWorkShadowOffsetX", XML_NAMESPACE_DRAW, XML_FONTWORK_SHADOW_OFFSET_X, XML_TYPE_MEASURE, CTF_FONTWORK_SHADOWOFFSETX ),
+ GMAP( "FontWorkShadowOffsetY", XML_NAMESPACE_DRAW, XML_FONTWORK_SHADOW_OFFSET_Y, XML_TYPE_MEASURE, CTF_FONTWORK_SHADOWOFFSETY ),
+ GMAP( "FontWorkForm", XML_NAMESPACE_DRAW, XML_FONTWORK_FORM, XML_SD_TYPE_FONTWORK_FORM, CTF_FONTWORK_FORM ),
+ GMAP( "FontWorkHideForm", XML_NAMESPACE_DRAW, XML_FONTWORK_HIDE_FORM, XML_TYPE_BOOL, CTF_FONTWORK_HIDEFORM ),
+ GMAP( "FontWorkShadowTransparence", XML_NAMESPACE_DRAW, XML_FONTWORK_SHADOW_TRANSPARENCE, XML_TYPE_PERCENT, CTF_FONTWORK_SHADOWTRANSPARENCE ),
+
+ // control attributes (border exists one mor time for the text additions of shapes)
+ GMAP( "ControlSymbolColor", XML_NAMESPACE_DRAW, XML_SYMBOL_COLOR, XML_TYPE_COLOR, 0 ),
+ GMAP( "ControlBackground", XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_COLOR|MID_FLAG_MULTI_PROPERTY, 0 ),
+ GMAP( "ControlBorder", XML_NAMESPACE_FO, XML_BORDER, XML_SD_TYPE_CONTROL_BORDER|MID_FLAG_MULTI_PROPERTY|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
+ GMAP( "ControlBorderColor", XML_NAMESPACE_FO, XML_BORDER, XML_SD_TYPE_CONTROL_BORDER_COLOR|MID_FLAG_MULTI_PROPERTY|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
+ GMAP( "ControlDataStyle", XML_NAMESPACE_STYLE,XML_DATA_STYLE_NAME, XML_TYPE_STRING|MID_FLAG_NO_PROPERTY_EXPORT|MID_FLAG_SPECIAL_ITEM, CTF_SD_CONTROL_SHAPE_DATA_STYLE ),
+ GMAP( "ControlTextEmphasis", XML_NAMESPACE_STYLE,XML_TEXT_EMPHASIZE, XML_TYPE_CONTROL_TEXT_EMPHASIZE, 0 ),
+ GMAP( "ImageScaleMode", XML_NAMESPACE_STYLE,XML_REPEAT, XML_SD_TYPE_IMAGE_SCALE_MODE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ GMAP( "ControlWritingMode", XML_NAMESPACE_STYLE,XML_WRITING_MODE, XML_TYPE_TEXT_WRITING_MODE_WITH_DEFAULT|MID_FLAG_MULTI_PROPERTY, CTF_CONTROLWRITINGMODE ),
+
+ // special entries for floating frames
+ GMAP( "FrameIsAutoScroll", XML_NAMESPACE_DRAW, XML_FRAME_DISPLAY_SCROLLBAR, XML_TYPE_BOOL|MID_FLAG_MULTI_PROPERTY, CTF_FRAME_DISPLAY_SCROLLBAR ),
+ GMAP( "FrameIsBorder", XML_NAMESPACE_DRAW, XML_FRAME_DISPLAY_BORDER, XML_TYPE_BOOL|MID_FLAG_MULTI_PROPERTY, CTF_FRAME_DISPLAY_BORDER ),
+ GMAP( "FrameMarginWidth", XML_NAMESPACE_DRAW, XML_FRAME_MARGIN_HORIZONTAL, XML_TYPE_MEASURE_PX|MID_FLAG_MULTI_PROPERTY, CTF_FRAME_MARGIN_HORI ),
+ GMAP( "FrameMarginHeight", XML_NAMESPACE_DRAW, XML_FRAME_MARGIN_VERTICAL, XML_TYPE_MEASURE_PX|MID_FLAG_MULTI_PROPERTY, CTF_FRAME_MARGIN_VERT ),
+ GMAP( "VisibleArea", XML_NAMESPACE_DRAW, XML_VISIBLE_AREA_LEFT, XML_TYPE_RECTANGLE_LEFT|MID_FLAG_MERGE_PROPERTY|MID_FLAG_MULTI_PROPERTY|MID_FLAG_NO_PROPERTY, CTF_SD_OLE_VIS_AREA_IMPORT_LEFT ),
+ GMAP( "VisibleArea", XML_NAMESPACE_DRAW, XML_VISIBLE_AREA_TOP, XML_TYPE_RECTANGLE_TOP|MID_FLAG_MERGE_PROPERTY|MID_FLAG_MULTI_PROPERTY|MID_FLAG_NO_PROPERTY, CTF_SD_OLE_VIS_AREA_IMPORT_TOP ),
+ GMAP( "VisibleArea", XML_NAMESPACE_DRAW, XML_VISIBLE_AREA_WIDTH, XML_TYPE_RECTANGLE_WIDTH|MID_FLAG_MERGE_PROPERTY|MID_FLAG_MULTI_PROPERTY|MID_FLAG_NO_PROPERTY, CTF_SD_OLE_VIS_AREA_IMPORT_WIDTH ),
+ GMAP( "VisibleArea", XML_NAMESPACE_DRAW, XML_VISIBLE_AREA_HEIGHT, XML_TYPE_RECTANGLE_HEIGHT|MID_FLAG_MERGE_PROPERTY|MID_FLAG_MULTI_PROPERTY|MID_FLAG_NO_PROPERTY, CTF_SD_OLE_VIS_AREA_IMPORT_HEIGHT ),
+ GMAP( "IsInternal", XML_NAMESPACE_DRAW, XML__EMPTY, XML_TYPE_BUILDIN_CMP_ONLY, CTF_SD_OLE_ISINTERNAL ),
+ GMAP( "IsInternal", XML_NAMESPACE_DRAW, XML_VISIBLE_AREA_LEFT, XML_TYPE_RECTANGLE_LEFT|MID_FLAG_MERGE_PROPERTY|MID_FLAG_MULTI_PROPERTY|MID_FLAG_NO_PROPERTY_IMPORT, CTF_SD_OLE_VIS_AREA_EXPORT_LEFT ),
+ GMAP( "IsInternal", XML_NAMESPACE_DRAW, XML_VISIBLE_AREA_TOP, XML_TYPE_RECTANGLE_TOP|MID_FLAG_MERGE_PROPERTY|MID_FLAG_MULTI_PROPERTY|MID_FLAG_NO_PROPERTY_IMPORT, CTF_SD_OLE_VIS_AREA_EXPORT_TOP ),
+ GMAP( "IsInternal", XML_NAMESPACE_DRAW, XML_VISIBLE_AREA_WIDTH, XML_TYPE_RECTANGLE_WIDTH|MID_FLAG_MERGE_PROPERTY|MID_FLAG_MULTI_PROPERTY|MID_FLAG_NO_PROPERTY_IMPORT, CTF_SD_OLE_VIS_AREA_EXPORT_WIDTH ),
+ GMAP( "IsInternal", XML_NAMESPACE_DRAW, XML_VISIBLE_AREA_HEIGHT, XML_TYPE_RECTANGLE_HEIGHT|MID_FLAG_MERGE_PROPERTY|MID_FLAG_MULTI_PROPERTY|MID_FLAG_NO_PROPERTY_IMPORT, CTF_SD_OLE_VIS_AREA_EXPORT_HEIGHT ),
+
+ GMAP( "Aspect", XML_NAMESPACE_DRAW, XML_DRAW_ASPECT, XML_TYPE_TEXT_DRAW_ASPECT|MID_FLAG_MULTI_PROPERTY, CTF_SD_OLE_ASPECT ),
+
+ // caption properties
+ GMAP( "CaptionType", XML_NAMESPACE_DRAW, XML_CAPTION_TYPE, XML_SD_TYPE_CAPTION_TYPE, 0 ),
+ GMAP( "CaptionIsFixedAngle", XML_NAMESPACE_DRAW, XML_CAPTION_ANGLE_TYPE, XML_SD_TYPE_CAPTION_ANGLE_TYPE, 0 ),
+ GMAP( "CaptionAngle", XML_NAMESPACE_DRAW, XML_CAPTION_ANGLE, XML_TYPE_NUMBER, 0 ),
+ GMAP( "CaptionGap", XML_NAMESPACE_DRAW, XML_CAPTION_GAP, XML_TYPE_MEASURE, 0 ),
+ GMAP( "CaptionEscapeDirection", XML_NAMESPACE_DRAW, XML_CAPTION_ESCAPE_DIRECTION, XML_SD_TYPE_CAPTION_ESC_DIR, 0 ),
+ GMAP( "CaptionIsEscapeRelative", XML_NAMESPACE_DRAW, XML_CAPTION_ESCAPE, XML_SD_TYPE_CAPTION_IS_ESC_REL|MID_FLAG_MULTI_PROPERTY, CTF_CAPTION_ISESCREL ),
+ GMAP( "CaptionEscapeRelative", XML_NAMESPACE_DRAW, XML_CAPTION_ESCAPE, XML_SD_TYPE_CAPTION_ESC_REL|MID_FLAG_MULTI_PROPERTY, CTF_CAPTION_ESCREL ),
+ GMAP( "CaptionEscapeAbsolute", XML_NAMESPACE_DRAW, XML_CAPTION_ESCAPE, XML_SD_TYPE_CAPTION_ESC_ABS|MID_FLAG_MULTI_PROPERTY, CTF_CAPTION_ESCABS ),
+ GMAP( "CaptionLineLength", XML_NAMESPACE_DRAW, XML_CAPTION_LINE_LENGTH, XML_TYPE_MEASURE, 0 ),
+ GMAP( "CaptionIsFitLineLength", XML_NAMESPACE_DRAW, XML_CAPTION_FIT_LINE_LENGTH, XML_TYPE_BOOL, 0 ),
+
+ // misc object properties
+ GMAP( "MoveProtect", XML_NAMESPACE_STYLE, XML_PROTECT, XML_SD_TYPE_MOVE_PROTECT|MID_FLAG_MULTI_PROPERTY|MID_FLAG_MERGE_ATTRIBUTE, CTF_SD_MOVE_PROTECT ),
+ GMAP( "SizeProtect", XML_NAMESPACE_STYLE, XML_PROTECT, XML_SD_TYPE_SIZE_PROTECT|MID_FLAG_MULTI_PROPERTY|MID_FLAG_MERGE_ATTRIBUTE, CTF_SD_SIZE_PROTECT ),
+ MAP_END()
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// entry list for presentation page properties
+
+const XMLPropertyMapEntry aXMLSDPresPageProps[] =
+{
+ DPMAP( "UserDefinedAttributes", XML_NAMESPACE_TEXT, XML_XMLNS, XML_TYPE_ATTRIBUTE_CONTAINER | MID_FLAG_SPECIAL_ITEM, 0 ),
+
+ DPMAP( "Change", XML_NAMESPACE_PRESENTATION, XML_TRANSITION_TYPE, XML_SD_TYPE_PRESPAGE_TYPE, CTF_PAGE_TRANS_TYPE ),
+ DPMAP( "Effect", XML_NAMESPACE_PRESENTATION, XML_TRANSITION_STYLE, XML_SD_TYPE_PRESPAGE_STYLE, CTF_PAGE_TRANS_STYLE ),
+ DPMAP( "Speed", XML_NAMESPACE_PRESENTATION, XML_TRANSITION_SPEED, XML_SD_TYPE_PRESPAGE_SPEED, CTF_PAGE_TRANS_SPEED ),
+ DPMAP( "Duration", XML_NAMESPACE_PRESENTATION, XML_DURATION, XML_SD_TYPE_PRESPAGE_DURATION, CTF_PAGE_TRANS_DURATION ),
+ DPMAP( "Visible", XML_NAMESPACE_PRESENTATION, XML_VISIBILITY, XML_SD_TYPE_PRESPAGE_VISIBILITY, CTF_PAGE_VISIBLE ),
+ DPMAP( "Sound", XML_NAMESPACE_PRESENTATION, XML_SOUND, XML_TYPE_STRING|MID_FLAG_ELEMENT_ITEM, CTF_PAGE_SOUND_URL ),
+ DPMAP( "BackgroundFullSize", XML_NAMESPACE_DRAW, XML_BACKGROUND_SIZE, XML_SD_TYPE_PRESPAGE_BACKSIZE, CTF_PAGE_BACKSIZE ),
+
+ DPMAP( "IsBackgroundVisible", XML_NAMESPACE_PRESENTATION, XML_BACKGROUND_VISIBLE, XML_TYPE_BOOL, 0 ),
+ DPMAP( "IsBackgroundObjectsVisible", XML_NAMESPACE_PRESENTATION, XML_BACKGROUND_OBJECTS_VISIBLE, XML_TYPE_BOOL, 0 ),
+
+ DPMAP( "FillStyle", XML_NAMESPACE_DRAW, XML_FILL, XML_SD_TYPE_FILLSTYLE, 0 ),
+ DPMAP( "FillColor", XML_NAMESPACE_DRAW, XML_FILL_COLOR, XML_TYPE_COLOR, 0 ),
+ DPMAP( "FillGradientName", XML_NAMESPACE_DRAW, XML_FILL_GRADIENT_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLGRADIENTNAME ),
+ DPMAP( "FillGradientStepCount", XML_NAMESPACE_DRAW, XML_GRADIENT_STEP_COUNT, XML_TYPE_NUMBER, 0 ),
+ DPMAP( "FillHatchName", XML_NAMESPACE_DRAW, XML_FILL_HATCH_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLHATCHNAME ),
+ GMAP( "FillBackground", XML_NAMESPACE_DRAW, XML_FILL_HATCH_SOLID, XML_TYPE_BOOL, 0 ),
+ DPMAP( "FillBitmapName", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLBITMAPNAME ),
+ DPMAP( "FillTransparenceGradientName", XML_NAMESPACE_DRAW, XML_OPACITY_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLTRANSNAME ),
+ DPMAP( "FillBitmapSizeX", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_WIDTH, XML_SD_TYPE_FILLBITMAPSIZE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ DPMAP( "FillBitmapLogicalSize", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_WIDTH, XML_SD_TYPE_LOGICAL_SIZE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ DPMAP( "FillBitmapSizeY", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_HEIGHT, XML_SD_TYPE_FILLBITMAPSIZE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ DPMAP( "FillBitmapLogicalSize", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_HEIGHT, XML_SD_TYPE_LOGICAL_SIZE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ DPMAP( "FillBitmapMode", XML_NAMESPACE_STYLE,XML_REPEAT, XML_SD_TYPE_BITMAP_MODE, 0 ),
+ DPMAP( "FillBitmapPositionOffsetX", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT_X, XML_TYPE_PERCENT, 0 ),
+ DPMAP( "FillBitmapPositionOffsetY", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT_Y, XML_TYPE_PERCENT, 0 ),
+ DPMAP( "FillBitmapRectanglePoint", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT, XML_SD_TYPE_BITMAP_REFPOINT, 0 ),
+ DPMAP( "FillBitmapOffsetX", XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET, XML_SD_TYPE_BITMAPREPOFFSETX|MID_FLAG_MULTI_PROPERTY, CTF_REPEAT_OFFSET_X ),
+ DPMAP( "FillBitmapOffsetY", XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET, XML_SD_TYPE_BITMAPREPOFFSETY|MID_FLAG_MULTI_PROPERTY, CTF_REPEAT_OFFSET_Y ),
+
+ DPMAP( "IsHeaderVisible", XML_NAMESPACE_PRESENTATION, XML_DISPLAY_HEADER, XML_SD_TYPE_HEADER_FOOTER_VISIBILITY_TYPE, CTF_HEADER_VISIBLE ),
+ DPMAP( "IsFooterVisible", XML_NAMESPACE_PRESENTATION, XML_DISPLAY_FOOTER, XML_SD_TYPE_HEADER_FOOTER_VISIBILITY_TYPE, CTF_FOOTER_VISIBLE ),
+ DPMAP( "IsPageNumberVisible", XML_NAMESPACE_PRESENTATION, XML_DISPLAY_PAGE_NUMBER, XML_SD_TYPE_HEADER_FOOTER_VISIBILITY_TYPE, CTF_PAGE_NUMBER_VISIBLE ),
+ DPMAP( "IsDateTimeVisible", XML_NAMESPACE_PRESENTATION, XML_DISPLAY_DATE_TIME, XML_SD_TYPE_HEADER_FOOTER_VISIBILITY_TYPE, CTF_DATE_TIME_VISIBLE ),
+
+ DPMAP( "TransitionType", XML_NAMESPACE_SMIL, XML_TYPE, XML_SD_TYPE_TRANSITION_TYPE, CTF_PAGE_TRANSITION_TYPE ),
+ DPMAP( "TransitionSubtype", XML_NAMESPACE_SMIL, XML_SUBTYPE, XML_SD_TYPE_TRANSTIION_SUBTYPE, CTF_PAGE_TRANSITION_SUBTYPE ),
+ DPMAP( "TransitionDirection", XML_NAMESPACE_SMIL, XML_DIRECTION, XML_SD_TYPE_TRANSTIION_DIRECTION, CTF_PAGE_TRANSITION_DIRECTION ),
+ DPMAP( "TransitionFadeColor", XML_NAMESPACE_SMIL, XML_FADECOLOR, XML_TYPE_COLOR, CTF_PAGE_TRANSITION_FADECOLOR ),
+ MAP_END()
+};
+
+const XMLPropertyMapEntry aXMLSDPresPageProps_onlyHeadersFooter[] =
+{
+ DPMAP( "IsHeaderVisible", XML_NAMESPACE_PRESENTATION, XML_DISPLAY_HEADER, XML_SD_TYPE_HEADER_FOOTER_VISIBILITY_TYPE, CTF_HEADER_VISIBLE ),
+ DPMAP( "IsFooterVisible", XML_NAMESPACE_PRESENTATION, XML_DISPLAY_FOOTER, XML_SD_TYPE_HEADER_FOOTER_VISIBILITY_TYPE, CTF_FOOTER_VISIBLE ),
+ DPMAP( "IsPageNumberVisible", XML_NAMESPACE_PRESENTATION, XML_DISPLAY_PAGE_NUMBER, XML_SD_TYPE_HEADER_FOOTER_VISIBILITY_TYPE, CTF_PAGE_NUMBER_VISIBLE ),
+ DPMAP( "IsDateTimeVisible", XML_NAMESPACE_PRESENTATION, XML_DISPLAY_DATE_TIME, XML_SD_TYPE_HEADER_FOOTER_VISIBILITY_TYPE, CTF_DATE_TIME_VISIBLE ),
+
+ MAP_END()
+};
+
+/** contains the attribute to property mapping for a drawing layer table
+ WARNING: if attributes are added, SdXMLTableShapeContext::processAttribute needs to be updated!
+*/
+const XMLPropertyMapEntry aXMLTableShapeAttributes[] =
+{
+ _MAP( "UseFirstRowStyle", XML_NAMESPACE_TABLE, XML_USE_FIRST_ROW_STYLES, XML_TYPE_BOOL, 0 ),
+ _MAP( "UseLastRowStyle", XML_NAMESPACE_TABLE, XML_USE_LAST_ROW_STYLES, XML_TYPE_BOOL, 0 ),
+ _MAP( "UseFirstColumnStyle", XML_NAMESPACE_TABLE, XML_USE_FIRST_COLUMN_STYLES, XML_TYPE_BOOL, 0 ),
+ _MAP( "UseLastColumnStyle", XML_NAMESPACE_TABLE, XML_USE_LAST_COLUMN_STYLES, XML_TYPE_BOOL, 0 ),
+ _MAP( "UseBandingRowStyle", XML_NAMESPACE_TABLE, XML_USE_BANDING_ROWS_STYLES, XML_TYPE_BOOL, 0 ),
+ _MAP( "UseBandingColumnStyle", XML_NAMESPACE_TABLE, XML_USE_BANDING_COLUMNS_STYLES, XML_TYPE_BOOL, 0 ),
+ MAP_END()
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// implementation of factory for own graphic properties
+
+SvXMLEnumMapEntry aXML_LineStyle_EnumMap[] =
+{
+ { XML_NONE, drawing::LineStyle_NONE },
+ { XML_SOLID, drawing::LineStyle_SOLID },
+ { XML_DASH, drawing::LineStyle_DASH },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXML_LineJoint_EnumMap[] =
+{
+ { XML_NONE, drawing::LineJoint_NONE },
+ { XML_MITER, drawing::LineJoint_MITER },
+ { XML_ROUND, drawing::LineJoint_ROUND },
+ { XML_BEVEL, drawing::LineJoint_BEVEL },
+ { XML_MIDDLE, drawing::LineJoint_MIDDLE },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXML_FillStyle_EnumMap[] =
+{
+ { XML_NONE, drawing::FillStyle_NONE },
+ { XML_SOLID, drawing::FillStyle_SOLID },
+ { XML_BITMAP, drawing::FillStyle_BITMAP },
+ { XML_GRADIENT, drawing::FillStyle_GRADIENT },
+ { XML_HATCH, drawing::FillStyle_HATCH },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXML_PresChange_EnumMap[] =
+{
+ { XML_MANUAL, 0 },
+ { XML_AUTOMATIC, 1 },
+ { XML_SEMI_AUTOMATIC, 2 },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXML_TransSpeed_EnumMap[] =
+{
+ { XML_FAST, presentation::AnimationSpeed_FAST },
+ { XML_MEDIUM, presentation::AnimationSpeed_MEDIUM },
+ { XML_SLOW, presentation::AnimationSpeed_SLOW },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXML_FadeEffect_EnumMap[] =
+{
+ { XML_NONE, presentation::FadeEffect_NONE },
+ { XML_FADE_FROM_LEFT, presentation::FadeEffect_FADE_FROM_LEFT },
+ { XML_FADE_FROM_TOP, presentation::FadeEffect_FADE_FROM_TOP },
+ { XML_FADE_FROM_RIGHT, presentation::FadeEffect_FADE_FROM_RIGHT },
+ { XML_FADE_FROM_BOTTOM, presentation::FadeEffect_FADE_FROM_BOTTOM },
+ { XML_FADE_TO_CENTER, presentation::FadeEffect_FADE_TO_CENTER },
+ { XML_FADE_FROM_CENTER, presentation::FadeEffect_FADE_FROM_CENTER },
+ { XML_MOVE_FROM_LEFT, presentation::FadeEffect_MOVE_FROM_LEFT },
+ { XML_MOVE_FROM_TOP, presentation::FadeEffect_MOVE_FROM_TOP },
+ { XML_MOVE_FROM_RIGHT, presentation::FadeEffect_MOVE_FROM_RIGHT },
+ { XML_MOVE_FROM_BOTTOM, presentation::FadeEffect_MOVE_FROM_BOTTOM },
+ { XML_ROLL_FROM_TOP, presentation::FadeEffect_ROLL_FROM_TOP },
+ { XML_ROLL_FROM_LEFT, presentation::FadeEffect_ROLL_FROM_LEFT },
+ { XML_ROLL_FROM_RIGHT, presentation::FadeEffect_ROLL_FROM_RIGHT },
+ { XML_ROLL_FROM_BOTTOM, presentation::FadeEffect_ROLL_FROM_BOTTOM },
+ { XML_VERTICAL_STRIPES, presentation::FadeEffect_VERTICAL_STRIPES },
+ { XML_HORIZONTAL_STRIPES, presentation::FadeEffect_HORIZONTAL_STRIPES },
+ { XML_CLOCKWISE, presentation::FadeEffect_CLOCKWISE },
+ { XML_COUNTERCLOCKWISE, presentation::FadeEffect_COUNTERCLOCKWISE },
+ { XML_FADE_FROM_UPPERLEFT, presentation::FadeEffect_FADE_FROM_UPPERLEFT },
+ { XML_FADE_FROM_UPPERRIGHT, presentation::FadeEffect_FADE_FROM_UPPERRIGHT },
+ { XML_FADE_FROM_LOWERLEFT, presentation::FadeEffect_FADE_FROM_LOWERLEFT },
+ { XML_FADE_FROM_LOWERRIGHT, presentation::FadeEffect_FADE_FROM_LOWERRIGHT },
+ { XML_CLOSE_VERTICAL, presentation::FadeEffect_CLOSE_VERTICAL },
+ { XML_CLOSE_HORIZONTAL, presentation::FadeEffect_CLOSE_HORIZONTAL },
+ { XML_OPEN_VERTICAL, presentation::FadeEffect_OPEN_VERTICAL },
+ { XML_OPEN_HORIZONTAL, presentation::FadeEffect_OPEN_HORIZONTAL },
+ { XML_SPIRALIN_LEFT, presentation::FadeEffect_SPIRALIN_LEFT },
+ { XML_SPIRALIN_RIGHT, presentation::FadeEffect_SPIRALIN_RIGHT },
+ { XML_SPIRALOUT_LEFT, presentation::FadeEffect_SPIRALOUT_LEFT },
+ { XML_SPIRALOUT_RIGHT, presentation::FadeEffect_SPIRALOUT_RIGHT },
+ { XML_DISSOLVE, presentation::FadeEffect_DISSOLVE },
+ { XML_WAVYLINE_FROM_LEFT, presentation::FadeEffect_WAVYLINE_FROM_LEFT },
+ { XML_WAVYLINE_FROM_TOP, presentation::FadeEffect_WAVYLINE_FROM_TOP },
+ { XML_WAVYLINE_FROM_RIGHT, presentation::FadeEffect_WAVYLINE_FROM_RIGHT },
+ { XML_WAVYLINE_FROM_BOTTOM, presentation::FadeEffect_WAVYLINE_FROM_BOTTOM },
+ { XML_RANDOM, presentation::FadeEffect_RANDOM },
+ { XML_STRETCH_FROM_LEFT, presentation::FadeEffect_STRETCH_FROM_LEFT },
+ { XML_STRETCH_FROM_TOP, presentation::FadeEffect_STRETCH_FROM_TOP },
+ { XML_STRETCH_FROM_RIGHT, presentation::FadeEffect_STRETCH_FROM_RIGHT },
+ { XML_STRETCH_FROM_BOTTOM, presentation::FadeEffect_STRETCH_FROM_BOTTOM },
+ { XML_VERTICAL_LINES, presentation::FadeEffect_VERTICAL_LINES },
+ { XML_HORIZONTAL_LINES, presentation::FadeEffect_HORIZONTAL_LINES },
+ { XML_MOVE_FROM_UPPERLEFT, presentation::FadeEffect_MOVE_FROM_UPPERLEFT },
+ { XML_MOVE_FROM_UPPERRIGHT, presentation::FadeEffect_MOVE_FROM_UPPERRIGHT },
+ { XML_MOVE_FROM_LOWERRIGHT, presentation::FadeEffect_MOVE_FROM_LOWERRIGHT },
+ { XML_MOVE_FROM_LOWERLEFT, presentation::FadeEffect_MOVE_FROM_LOWERLEFT },
+ { XML_UNCOVER_TO_LEFT, presentation::FadeEffect_UNCOVER_TO_LEFT },
+ { XML_UNCOVER_TO_UPPERLEFT, presentation::FadeEffect_UNCOVER_TO_UPPERLEFT },
+ { XML_UNCOVER_TO_TOP, presentation::FadeEffect_UNCOVER_TO_TOP },
+ { XML_UNCOVER_TO_UPPERRIGHT,presentation::FadeEffect_UNCOVER_TO_UPPERRIGHT },
+ { XML_UNCOVER_TO_RIGHT, presentation::FadeEffect_UNCOVER_TO_RIGHT },
+ { XML_UNCOVER_TO_LOWERRIGHT,presentation::FadeEffect_UNCOVER_TO_LOWERRIGHT },
+ { XML_UNCOVER_TO_BOTTOM, presentation::FadeEffect_UNCOVER_TO_BOTTOM },
+ { XML_UNCOVER_TO_LOWERLEFT, presentation::FadeEffect_UNCOVER_TO_LOWERLEFT },
+ { XML_VERTICAL_CHECKERBOARD,presentation::FadeEffect_VERTICAL_CHECKERBOARD },
+ { XML_HORIZONTAL_CHECKERBOARD,presentation::FadeEffect_HORIZONTAL_CHECKERBOARD },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXML_ConnectionKind_EnumMap[] =
+{
+ { XML_STANDARD, drawing::ConnectorType_STANDARD },
+ { XML_CURVE, drawing::ConnectorType_CURVE },
+ { XML_LINE, drawing::ConnectorType_LINE },
+ { XML_LINES, drawing::ConnectorType_LINES },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXML_BitmapMode_EnumMap[] =
+{
+ { XML_REPEAT, drawing::BitmapMode_REPEAT },
+ { XML_STRETCH, drawing::BitmapMode_STRETCH },
+ { XML_BACKGROUND_NO_REPEAT, drawing::BitmapMode_NO_REPEAT },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// 3D EnumMaps
+
+SvXMLEnumMapEntry aXML_NormalsKind_EnumMap[] =
+{
+ { XML_OBJECT, drawing::NormalsKind_SPECIFIC },
+ { XML_FLAT, drawing::NormalsKind_FLAT },
+ { XML_SPHERE, drawing::NormalsKind_SPHERE },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXML_TexGenerationX_EnumMap[] =
+{
+ { XML_OBJECT, drawing::TextureProjectionMode_OBJECTSPECIFIC },
+ { XML_PARALLEL, drawing::TextureProjectionMode_PARALLEL },
+ { XML_SPHERE, drawing::TextureProjectionMode_SPHERE },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXML_TexGenerationY_EnumMap[] =
+{
+ { XML_OBJECT, drawing::TextureProjectionMode_OBJECTSPECIFIC },
+ { XML_PARALLEL, drawing::TextureProjectionMode_PARALLEL },
+ { XML_SPHERE, drawing::TextureProjectionMode_SPHERE },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXML_TexKind_EnumMap[] =
+{
+ { XML_LUMINANCE, drawing::TextureKind_LUMINANCE },
+ { XML_COLOR, drawing::TextureKind_COLOR },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXML_TexMode_EnumMap[] =
+{
+ { XML_REPLACE, drawing::TextureMode_REPLACE },
+ { XML_MODULATE, drawing::TextureMode_MODULATE },
+ { XML_BLEND, drawing::TextureMode_BLEND },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXML_RefPoint_EnumMap[] =
+{
+ { XML_TOP_LEFT, drawing::RectanglePoint_LEFT_TOP },
+ { XML_TOP, drawing::RectanglePoint_MIDDLE_TOP },
+ { XML_TOP_RIGHT, drawing::RectanglePoint_RIGHT_TOP },
+ { XML_LEFT, drawing::RectanglePoint_LEFT_MIDDLE },
+ { XML_CENTER, drawing::RectanglePoint_MIDDLE_MIDDLE },
+ { XML_RIGHT, drawing::RectanglePoint_RIGHT_MIDDLE },
+ { XML_BOTTOM_LEFT, drawing::RectanglePoint_LEFT_BOTTOM },
+ { XML_BOTTOM, drawing::RectanglePoint_MIDDLE_BOTTOM },
+ { XML_BOTTOM_RIGHT, drawing::RectanglePoint_RIGHT_BOTTOM },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXML_CircleKind_EnumMap[] =
+{
+ { XML_FULL, drawing::CircleKind_FULL },
+ { XML_SECTION, drawing::CircleKind_SECTION },
+ { XML_CUT, drawing::CircleKind_CUT },
+ { XML_ARC, drawing::CircleKind_ARC },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXML_WritingMode_EnumMap[] =
+{
+ { XML_TB_RL, text::WritingMode_TB_RL },
+ { XML_LR_TB, text::WritingMode_LR_TB },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry const pXML_TextAnimation_Enum[] =
+{
+ { XML_NONE, drawing::TextAnimationKind_NONE },
+ { XML_BLINKING, drawing::TextAnimationKind_BLINK }, // will be filtered
+ { XML_SCROLL, drawing::TextAnimationKind_SCROLL },
+ { XML_ALTERNATE, drawing::TextAnimationKind_ALTERNATE },
+ { XML_SLIDE, drawing::TextAnimationKind_SLIDE },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry const pXML_TextAnimation_Blinking_Enum[] =
+{
+ { XML_FALSE, drawing::TextAnimationKind_NONE },
+ { XML_TRUE, drawing::TextAnimationKind_BLINK },
+ { XML_FALSE, drawing::TextAnimationKind_SCROLL },
+ { XML_FALSE, drawing::TextAnimationKind_ALTERNATE },
+ { XML_FALSE, drawing::TextAnimationKind_SLIDE },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry const pXML_TextAnimationDirection_Enum[] =
+{
+ { XML_LEFT, drawing::TextAnimationDirection_LEFT },
+ { XML_RIGHT, drawing::TextAnimationDirection_RIGHT }, // will be filtered
+ { XML_UP, drawing::TextAnimationDirection_UP },
+ { XML_DOWN, drawing::TextAnimationDirection_DOWN },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry const pXML_TextAlign_Enum[] =
+{
+ { XML_LEFT, drawing::TextHorizontalAdjust_LEFT },
+ { XML_CENTER, drawing::TextHorizontalAdjust_CENTER },
+ { XML_RIGHT, drawing::TextHorizontalAdjust_RIGHT },
+ { XML_JUSTIFY, drawing::TextHorizontalAdjust_BLOCK },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry const pXML_VerticalAlign_Enum[] =
+{
+ { XML_TOP, drawing::TextVerticalAdjust_TOP },
+ { XML_MIDDLE, drawing::TextVerticalAdjust_CENTER },
+ { XML_BOTTOM, drawing::TextVerticalAdjust_BOTTOM },
+ { XML_JUSTIFY, drawing::TextVerticalAdjust_BLOCK },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry const pXML_FitToSize_Enum[] =
+{
+ { XML_FALSE, drawing::TextFitToSizeType_NONE },
+ { XML_TRUE, drawing::TextFitToSizeType_PROPORTIONAL },
+ { XML_ALL, drawing::TextFitToSizeType_ALLLINES },
+ { XML_SHRINK_TO_FIT,drawing::TextFitToSizeType_AUTOFIT },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry const pXML_MeasureUnit_Enum[] =
+{
+ { XML_AUTOMATIC, 0 },
+ { XML_UNIT_MM, 1 },
+ { XML_UNIT_CM, 2 },
+ { XML_UNIT_M, 3 },
+ { XML_UNIT_KM, 4 },
+ { XML_UNIT_PT, 6 },
+ { XML_UNIT_PC, 7 },
+ { XML_UNIT_INCH, 8 },
+ { XML_UNIT_FOOT, 9 },
+ { XML_UNIT_MILES, 10 },
+ { XML_TOKEN_INVALID,0 }
+};
+
+SvXMLEnumMapEntry const pXML_Measure_HAlign_Enum[] =
+{
+ { XML_AUTOMATIC, drawing::MeasureTextHorzPos_AUTO },
+ { XML_LEFT_OUTSIDE, drawing::MeasureTextHorzPos_LEFTOUTSIDE },
+ { XML_INSIDE, drawing::MeasureTextHorzPos_INSIDE },
+ { XML_RIGHT_OUTSIDE, drawing::MeasureTextHorzPos_RIGHTOUTSIDE},
+ { XML_TOKEN_INVALID,0 }
+};
+
+SvXMLEnumMapEntry const pXML_Measure_VAlign_Enum[] =
+{
+ { XML_AUTOMATIC, drawing::MeasureTextVertPos_AUTO },
+ { XML_ABOVE, drawing::MeasureTextVertPos_EAST },
+ { XML_BELOW, drawing::MeasureTextVertPos_WEST },
+ { XML_CENTER, drawing::MeasureTextVertPos_CENTERED },
+ { XML_TOKEN_INVALID,0 }
+};
+
+// #FontWork#
+SvXMLEnumMapEntry const pXML_Fontwork_Style_Enum[] =
+{
+ { XML_ROTATE, 0 }, //XFT_ROTATE,
+ { XML_UPRIGHT, 1 }, //XFT_UPRIGHT,
+ { XML_SLANT_X, 2 }, //XFT_SLANTX,
+ { XML_SLANT_Y, 3 }, //XFT_SLANTY,
+ { XML_NONE, 4 }, //XFT_NONE
+ { XML_TOKEN_INVALID,0 }
+};
+
+SvXMLEnumMapEntry const pXML_Fontwork_Adjust_Enum[] =
+{
+ { XML_LEFT, 0 }, //XFT_LEFT,
+ { XML_RIGHT, 1 }, //XFT_RIGHT,
+ { XML_AUTOSIZE, 2 }, //XFT_AUTOSIZE,
+ { XML_CENTER, 3 }, //XFT_CENTER
+ { XML_TOKEN_INVALID,0 }
+};
+
+SvXMLEnumMapEntry const pXML_Fontwork_Shadow_Enum[] =
+{
+ { XML_NORMAL, 0 }, //XFTSHADOW_NORMAL,
+ { XML_SLANT, 1 }, //XFTSHADOW_SLANT,
+ { XML_NONE, 2 }, //XFTSHADOW_NONE
+ { XML_TOKEN_INVALID,0 }
+};
+
+SvXMLEnumMapEntry const pXML_Fontwork_Form_Enum[] =
+{
+ { XML_NONE, 0 }, //XFTFORM_NONE,
+ { XML_TOPCIRCLE, 1 }, //XFTFORM_TOPCIRC,
+ { XML_BOTTOMCIRCLE, 2 }, //XFTFORM_BOTCIRC,
+ { XML_LEFTCIRCLE, 3 }, //XFTFORM_LFTCIRC,
+ { XML_RIGHTCIRCLE, 4 }, //XFTFORM_RGTCIRC,
+ { XML_TOPARC, 5 }, //XFTFORM_TOPARC,
+ { XML_BOTTOMARC, 6 }, //XFTFORM_BOTARC,
+ { XML_LEFTARC, 7 }, //XFTFORM_LFTARC,
+ { XML_RIGHTARC, 8 }, //XFTFORM_RGTARC,
+ { XML_BUTTON1, 9 }, //XFTFORM_BUTTON1,
+ { XML_BUTTON2, 10 }, //XFTFORM_BUTTON2,
+ { XML_BUTTON3, 11 }, //XFTFORM_BUTTON3,
+ { XML_BUTTON4, 12 }, //XFTFORM_BUTTON4
+ { XML_TOKEN_INVALID,0 }
+};
+
+SvXMLEnumMapEntry const pXML_Caption_Esc_Dir_Enum[] =
+{
+ { XML_HORIZONTAL, 0 }, //SDRCAPT_ESCHORIZONTAL,
+ { XML_VERTICAL, 1 }, //SDRCAPT_ESCVERTICAL,
+ { XML_AUTO, 2 }, //SDRCAPT_ESCBESTFIT,
+ { XML_TOKEN_INVALID,0 }
+};
+
+SvXMLEnumMapEntry const pXML_Caption_Type_Enum[] =
+{
+ { XML_STRAIGHT_LINE, 0 }, //SDRCAPT_TYPE1,
+ { XML_ANGLED_LINE, 1 }, //SDRCAPT_TYPE2,
+ { XML_ANGLED_CONNECTOR_LINE, 2 }, //SDRCAPT_TYPE3,
+ { XML_TOKEN_INVALID,0 }
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+class XMLCaptionEscapeRelative : public XMLPropertyHandler
+{
+public:
+ virtual sal_Bool importXML(
+ const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML(
+ ::rtl::OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+sal_Bool XMLCaptionEscapeRelative::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Int32 nValue;
+
+ if( !SvXMLUnitConverter::convertPercent( nValue, rStrImpValue ) )
+ return sal_False;
+
+ nValue *= 100;
+ rValue <<= nValue;
+ return sal_True;
+}
+
+sal_Bool XMLCaptionEscapeRelative::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Int32 nValue = 0;
+ if( !(rValue >>= nValue ) )
+ return sal_False;
+
+ nValue /= 100;
+ OUStringBuffer aOut;
+ SvXMLUnitConverter::convertPercent( aOut, nValue );
+ rStrExpValue = aOut.makeStringAndClear();
+ return sal_True;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+class XMLMoveSizeProtectHdl : public XMLPropertyHandler
+{
+public:
+ XMLMoveSizeProtectHdl( sal_Int32 nType ) : mnType( nType ) {}
+
+ virtual sal_Bool importXML(
+ const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML(
+ ::rtl::OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const;
+private:
+ const sal_Int32 mnType;
+};
+
+sal_Bool XMLMoveSizeProtectHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& ) const
+{
+ const sal_Bool bValue = rStrImpValue.indexOf( GetXMLToken( mnType == XML_SD_TYPE_MOVE_PROTECT ? XML_POSITION : XML_SIZE ) ) != -1;
+ rValue <<= bValue;
+ return sal_True;
+}
+
+sal_Bool XMLMoveSizeProtectHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bValue = sal_Bool();
+ if( !(rValue >>= bValue ) )
+ return sal_False;
+
+ if( bValue )
+ {
+ if( rStrExpValue.getLength() )
+ rStrExpValue += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " " ) );
+
+ rStrExpValue += GetXMLToken( mnType == XML_SD_TYPE_MOVE_PROTECT ? XML_POSITION : XML_SIZE );
+ }
+
+ return sal_True;
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+class XMLSdHeaderFooterVisibilityTypeHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLSdHeaderFooterVisibilityTypeHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+XMLSdHeaderFooterVisibilityTypeHdl::~XMLSdHeaderFooterVisibilityTypeHdl()
+{
+}
+
+sal_Bool XMLSdHeaderFooterVisibilityTypeHdl::importXML(
+ const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ // #i38644#
+ // attributes with this type where saved with VISIBLE|HIDDEN prior
+ // to src680m67. So we have to import that correctly
+ const sal_Bool bBool = IsXMLToken(rStrImpValue, XML_TRUE) || IsXMLToken(rStrImpValue, XML_VISIBLE);
+ rValue <<= bBool;
+ return bBool || IsXMLToken(rStrImpValue, XML_FALSE) || IsXMLToken(rStrImpValue, XML_HIDDEN);
+}
+
+sal_Bool XMLSdHeaderFooterVisibilityTypeHdl::exportXML(
+ OUString& rStrExpValue,
+ const Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ OUStringBuffer aOut;
+ sal_Bool bValue = sal_Bool();
+
+ if (rValue >>= bValue)
+ {
+ SvXMLUnitConverter::convertBool( aOut, bValue );
+ rStrExpValue = aOut.makeStringAndClear();
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+XMLSdPropHdlFactory::XMLSdPropHdlFactory( uno::Reference< frame::XModel > xModel, SvXMLImport& rImport )
+: mxModel( xModel ), mpExport(0), mpImport( &rImport )
+{
+}
+
+XMLSdPropHdlFactory::XMLSdPropHdlFactory( uno::Reference< frame::XModel > xModel, SvXMLExport& rExport )
+: mxModel( xModel ), mpExport( &rExport ), mpImport(0)
+{
+}
+
+XMLSdPropHdlFactory::~XMLSdPropHdlFactory()
+{
+}
+
+const XMLPropertyHandler* XMLSdPropHdlFactory::GetPropertyHandler( sal_Int32 nType ) const
+{
+ const XMLPropertyHandler* pHdl = XMLPropertyHandlerFactory::GetPropertyHandler( nType );
+ if(!pHdl)
+ {
+ switch(nType)
+ {
+ case XML_SD_TYPE_STROKE :
+ {
+ pHdl = new XMLEnumPropertyHdl( aXML_LineStyle_EnumMap, ::getCppuType((const drawing::LineStyle*)0) );
+ break;
+ }
+ case XML_SD_TYPE_LINEJOIN :
+ {
+ pHdl = new XMLEnumPropertyHdl( aXML_LineJoint_EnumMap, ::getCppuType((const drawing::LineJoint*)0) );
+ break;
+ }
+ case XML_SD_TYPE_FILLSTYLE :
+ {
+ pHdl = new XMLEnumPropertyHdl( aXML_FillStyle_EnumMap, ::getCppuType((const drawing::FillStyle*)0) );
+ break;
+ }
+ case XML_SD_TYPE_PRESPAGE_TYPE :
+ {
+ pHdl = new XMLEnumPropertyHdl( aXML_PresChange_EnumMap, ::getCppuType((const sal_Int32*)0) );
+ break;
+ }
+ case XML_SD_TYPE_SHADOW :
+ {
+ pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken(XML_VISIBLE), GetXMLToken(XML_HIDDEN) );
+ break;
+ }
+ case XML_TYPE_SD_MIRROR:
+ {
+ pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken(XML_HORIZONTAL), GetXMLToken(XML_NONE) );
+ break;
+ }
+ case XML_SD_TYPE_PRESPAGE_STYLE :
+ {
+ pHdl = new XMLEnumPropertyHdl( aXML_FadeEffect_EnumMap, ::getCppuType((const presentation::FadeEffect*)0) );
+ break;
+ }
+ case XML_SD_TYPE_PRESPAGE_SPEED :
+ {
+ pHdl = new XMLEnumPropertyHdl( aXML_TransSpeed_EnumMap, ::getCppuType((const presentation::AnimationSpeed*)0) );
+ break;
+ }
+ case XML_SD_TYPE_PRESPAGE_DURATION :
+ {
+ pHdl = new XMLDurationPropertyHdl();
+ break;
+ }
+ case XML_SD_TYPE_TEXT_CROSSEDOUT :
+ {
+ pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken(XML_SOLID), GetXMLToken(XML_NONE) );
+ break;
+ }
+ case XML_SD_TYPE_OPACITY :
+ {
+ pHdl = new XMLOpacityPropertyHdl(mpImport);
+ break;
+ }
+ case XML_SD_TYPE_WRITINGMODE :
+ {
+ pHdl = new XMLEnumPropertyHdl( aXML_WritingMode_EnumMap, ::getCppuType((const text::WritingMode*)0) );
+ break;
+ }
+ case XML_SD_TYPE_PRESPAGE_VISIBILITY :
+ {
+ pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken(XML_VISIBLE), GetXMLToken(XML_HIDDEN) );
+ break;
+ }
+ case XML_SD_TYPE_PRESPAGE_BACKSIZE:
+ {
+ pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken(XML_FULL), GetXMLToken(XML_BORDER) );
+ break;
+ }
+
+ //////////////////////////////////////////////////////////////////
+ // 3D Properties
+
+ case XML_SD_TYPE_BACKFACE_CULLING:
+ {
+ // #87922# DoubleSided -> BackfaceCulling
+ // This sal_Bool needs to be flipped, DoubleSided sal_True -> NO Backface culling
+ // and vice versa.
+ pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken(XML_DISABLED), GetXMLToken(XML_ENABLED) );
+ break;
+ }
+
+ case XML_SD_TYPE_NORMALS_KIND:
+ {
+ pHdl = new XMLEnumPropertyHdl( aXML_NormalsKind_EnumMap, ::getCppuType((const drawing::NormalsKind*)0) );
+ break;
+ }
+ case XML_SD_TYPE_NORMALS_DIRECTION:
+ {
+ pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken(XML_NORMAL), GetXMLToken(XML_INVERSE) );
+ break;
+ }
+ case XML_SD_TYPE_TEX_GENERATION_MODE_X:
+ {
+ pHdl = new XMLEnumPropertyHdl( aXML_TexGenerationX_EnumMap, ::getCppuType((const drawing::TextureProjectionMode*)0) );
+ break;
+ }
+ case XML_SD_TYPE_TEX_GENERATION_MODE_Y:
+ {
+ pHdl = new XMLEnumPropertyHdl( aXML_TexGenerationY_EnumMap, ::getCppuType((const drawing::TextureProjectionMode*)0) );
+ break;
+ }
+ case XML_SD_TYPE_TEX_KIND:
+ {
+ pHdl = new XMLEnumPropertyHdl( aXML_TexKind_EnumMap, ::getCppuType((const drawing::TextureKind*)0) );
+ break;
+ }
+ case XML_SD_TYPE_TEX_MODE:
+ {
+ pHdl = new XMLEnumPropertyHdl( aXML_TexMode_EnumMap, ::getCppuType((const drawing::TextureMode*)0) );
+ break;
+ }
+ case XML_SD_TYPE_NUMBULLET:
+ {
+ uno::Reference<ucb::XAnyCompareFactory> xCompareFac( mxModel, uno::UNO_QUERY );
+ uno::Reference<ucb::XAnyCompare> xCompare;
+ if( xCompareFac.is() )
+ xCompare = xCompareFac->createAnyCompareByName( OUString( RTL_CONSTASCII_USTRINGPARAM( "NumberingRules" ) ) );
+
+ pHdl = new XMLNumRulePropHdl( xCompare );
+ break;
+ }
+ case XML_SD_TYPE_BITMAP_MODE:
+ {
+ pHdl = new XMLEnumPropertyHdl( aXML_BitmapMode_EnumMap, getCppuType((const drawing::BitmapMode*)0) );
+ break;
+ }
+ case XML_SD_TYPE_BITMAPREPOFFSETX:
+ case XML_SD_TYPE_BITMAPREPOFFSETY:
+ {
+ pHdl = new XMLBitmapRepeatOffsetPropertyHandler( nType == XML_SD_TYPE_BITMAPREPOFFSETX );
+ break;
+ }
+ case XML_SD_TYPE_FILLBITMAPSIZE:
+ {
+ pHdl = new XMLFillBitmapSizePropertyHandler();
+ break;
+ }
+ case XML_SD_TYPE_LOGICAL_SIZE:
+ {
+ pHdl = new XMLBitmapLogicalSizePropertyHandler();
+ break;
+ }
+ case XML_SD_TYPE_BITMAP_REFPOINT:
+ {
+ pHdl = new XMLEnumPropertyHdl( aXML_RefPoint_EnumMap, getCppuType((const ::com::sun::star::drawing::RectanglePoint*)0) );
+ break;
+ }
+ case XML_TYPE_TEXT_ANIMATION:
+ pHdl = new XMLEnumPropertyHdl( pXML_TextAnimation_Enum, ::getCppuType((const com::sun::star::drawing::TextAnimationKind*)0) );
+ break;
+ case XML_TYPE_TEXT_ANIMATION_BLINKING:
+ pHdl = new XMLEnumPropertyHdl( pXML_TextAnimation_Blinking_Enum, ::getCppuType((const com::sun::star::drawing::TextAnimationKind*)0) );
+ break;
+ case XML_TYPE_TEXT_ANIMATION_DIRECTION:
+ pHdl = new XMLEnumPropertyHdl( pXML_TextAnimationDirection_Enum, ::getCppuType((const com::sun::star::drawing::TextAnimationDirection*)0) );
+ break;
+ case XML_TYPE_TEXT_ANIMATION_STEPS:
+ pHdl = new XMLTextAnimationStepPropertyHdl;
+ break;
+ case XML_SD_TYPE_TEXT_ALIGN:
+ pHdl = new XMLEnumPropertyHdl( pXML_TextAlign_Enum, ::getCppuType((const com::sun::star::drawing::TextHorizontalAdjust*)0) );
+ break;
+ case XML_SD_TYPE_VERTICAL_ALIGN:
+ pHdl = new XMLEnumPropertyHdl( pXML_VerticalAlign_Enum, ::getCppuType((const com::sun::star::drawing::TextVerticalAdjust*)0) );
+ break;
+ case XML_SD_TYPE_FITTOSIZE:
+ pHdl = new XMLEnumPropertyHdl( pXML_FitToSize_Enum, ::getCppuType((const com::sun::star::drawing::TextFitToSizeType*)0) );
+ break;
+ case XML_SD_TYPE_MEASURE_UNIT:
+ pHdl = new XMLEnumPropertyHdl( pXML_MeasureUnit_Enum, ::getCppuType((const sal_Int32*)0) );
+ break;
+ case XML_SD_TYPE_MEASURE_HALIGN:
+ pHdl = new XMLEnumPropertyHdl( pXML_Measure_HAlign_Enum, ::getCppuType((const com::sun::star::drawing::MeasureTextHorzPos*)0) );
+ break;
+ case XML_SD_TYPE_MEASURE_VALIGN:
+ pHdl = new XMLEnumPropertyHdl( pXML_Measure_VAlign_Enum, ::getCppuType((const com::sun::star::drawing::MeasureTextVertPos*)0) );
+ break;
+ case XML_SD_TYPE_MEASURE_PLACING:
+ {
+ pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken(XML_BELOW), GetXMLToken(XML_ABOVE) );
+ }
+ break;
+ case XML_TYPE_TEXT_CLIP11:
+ pHdl = new XMLClipPropertyHandler( sal_True );
+ break;
+ case XML_TYPE_TEXT_CLIP:
+ pHdl = new XMLClipPropertyHandler( sal_False );
+ break;
+
+ // #FontWork#
+ case XML_SD_TYPE_FONTWORK_STYLE :
+ pHdl = new XMLEnumPropertyHdl( pXML_Fontwork_Style_Enum , ::getCppuType((const sal_Int32*)0));
+ break;
+ case XML_SD_TYPE_FONTWORK_ADJUST :
+ pHdl = new XMLEnumPropertyHdl( pXML_Fontwork_Adjust_Enum , ::getCppuType((const sal_Int32*)0));
+ break;
+ case XML_SD_TYPE_FONTWORK_SHADOW :
+ pHdl = new XMLEnumPropertyHdl( pXML_Fontwork_Shadow_Enum , ::getCppuType((const sal_Int32*)0));
+ break;
+ case XML_SD_TYPE_FONTWORK_FORM :
+ pHdl = new XMLEnumPropertyHdl( pXML_Fontwork_Form_Enum , ::getCppuType((const sal_Int32*)0));
+ break;
+
+ case XML_SD_TYPE_CONTROL_BORDER:
+ pHdl = new ::xmloff::OControlBorderHandler( ::xmloff::OControlBorderHandler::STYLE );
+ break;
+ case XML_SD_TYPE_CONTROL_BORDER_COLOR:
+ pHdl = new ::xmloff::OControlBorderHandler( ::xmloff::OControlBorderHandler::COLOR );
+ break;
+ case XML_SD_TYPE_IMAGE_SCALE_MODE:
+ pHdl = new ::xmloff::ImageScaleModeHandler;
+ break;
+ case XML_TYPE_CONTROL_TEXT_EMPHASIZE:
+ pHdl = new ::xmloff::OControlTextEmphasisHandler;
+ break;
+
+ case XML_SD_TYPE_CAPTION_ANGLE_TYPE:
+ {
+ pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken(XML_FIXED), GetXMLToken(XML_FREE) );
+ break;
+ }
+ case XML_SD_TYPE_CAPTION_IS_ESC_REL:
+ pHdl = new XMLIsPercentagePropertyHandler();
+ break;
+ case XML_SD_TYPE_CAPTION_ESC_REL:
+ pHdl = new XMLCaptionEscapeRelative();
+ break;
+ case XML_SD_TYPE_CAPTION_ESC_ABS:
+ pHdl = new XMLPercentOrMeasurePropertyHandler( sal_False );
+ break;
+ case XML_SD_TYPE_CAPTION_ESC_DIR:
+ pHdl = new XMLEnumPropertyHdl( pXML_Caption_Esc_Dir_Enum , ::getCppuType((const sal_Int32*)0));
+ break;
+ case XML_SD_TYPE_CAPTION_TYPE:
+ pHdl = new XMLEnumPropertyHdl( pXML_Caption_Type_Enum , ::getCppuType((const sal_Int32*)0));
+ break;
+ case XML_SD_TYPE_DATETIMEUPDATE:
+ pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken(XML_FIXED), GetXMLToken(XML_VARIABLE) );
+ break;
+ case XML_SD_TYPE_DATETIME_FORMAT:
+ pHdl = new XMLDateTimeFormatHdl( mpExport );
+ break;
+ case XML_SD_TYPE_TRANSITION_TYPE:
+ pHdl = new XMLEnumPropertyHdl( xmloff::getAnimationsEnumMap(xmloff::Animations_EnumMap_TransitionType) , ::getCppuType((const sal_Int16*)0));
+ break;
+ case XML_SD_TYPE_TRANSTIION_SUBTYPE:
+ pHdl = new XMLEnumPropertyHdl( xmloff::getAnimationsEnumMap(xmloff::Animations_EnumMap_TransitionSubType) , ::getCppuType((const sal_Int16*)0));
+ break;
+ case XML_SD_TYPE_TRANSTIION_DIRECTION:
+ pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken(XML_FORWARD), GetXMLToken(XML_REVERSE) );
+ break;
+ case XML_TYPE_WRAP_OPTION:
+ pHdl = new XMLWordWrapPropertyHdl( mpImport );
+ break;
+
+ case XML_SD_TYPE_MOVE_PROTECT:
+ case XML_SD_TYPE_SIZE_PROTECT:
+ pHdl = new XMLMoveSizeProtectHdl( nType );
+ break;
+ case XML_SD_TYPE_HEADER_FOOTER_VISIBILITY_TYPE:
+ pHdl = new XMLSdHeaderFooterVisibilityTypeHdl();
+ break;
+ }
+
+ if(pHdl)
+ PutHdlCache(nType, pHdl);
+ }
+
+ return pHdl;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+XMLShapePropertySetMapper::XMLShapePropertySetMapper(const UniReference< XMLPropertyHandlerFactory >& rFactoryRef)
+: XMLPropertySetMapper( aXMLSDProperties, rFactoryRef )
+{
+}
+
+XMLShapePropertySetMapper::XMLShapePropertySetMapper(const UniReference< XMLPropertyHandlerFactory >& rFactoryRef, sal_uInt16 nOffset)
+: XMLPropertySetMapper( &aXMLSDProperties[nOffset], rFactoryRef )
+{
+}
+
+XMLShapePropertySetMapper::~XMLShapePropertySetMapper()
+{
+}
+
+// ----------------------------------------
+
+XMLShapeExportPropertyMapper::XMLShapeExportPropertyMapper( const UniReference< XMLPropertySetMapper >& rMapper, XMLTextListAutoStylePool *pListAutoPool, SvXMLExport& rExport )
+: SvXMLExportPropertyMapper( rMapper )
+, mpListAutoPool( pListAutoPool )
+, mrExport( rExport )
+, maNumRuleExp( rExport )
+, mbIsInAutoStyles( sal_True )
+, msCDATA( GetXMLToken(XML_CDATA))
+, msTrue( GetXMLToken(XML_TRUE))
+, msFalse( GetXMLToken(XML_FALSE))
+{
+}
+
+XMLShapeExportPropertyMapper::~XMLShapeExportPropertyMapper()
+{
+}
+
+void XMLShapeExportPropertyMapper::ContextFilter(
+ std::vector< XMLPropertyState >& rProperties,
+ uno::Reference< beans::XPropertySet > rPropSet ) const
+{
+ XMLPropertyState* pRepeatOffsetX = NULL;
+ XMLPropertyState* pRepeatOffsetY = NULL;
+ XMLPropertyState* pTextAnimationBlinking = NULL;
+ XMLPropertyState* pTextAnimationKind = NULL;
+
+ // #FontWork#
+ XMLPropertyState* pFontWorkStyle = NULL;
+ XMLPropertyState* pFontWorkAdjust = NULL;
+ XMLPropertyState* pFontWorkDistance = NULL;
+ XMLPropertyState* pFontWorkStart = NULL;
+ XMLPropertyState* pFontWorkMirror = NULL;
+ XMLPropertyState* pFontWorkOutline = NULL;
+ XMLPropertyState* pFontWorkShadow = NULL;
+ XMLPropertyState* pFontWorkShadowColor = NULL;
+ XMLPropertyState* pFontWorkShadowOffsetx = NULL;
+ XMLPropertyState* pFontWorkShadowOffsety = NULL;
+ XMLPropertyState* pFontWorkForm = NULL;
+ XMLPropertyState* pFontWorkHideform = NULL;
+ XMLPropertyState* pFontWorkShadowTransparence = NULL;
+
+ // OLE
+ XMLPropertyState* pOLEVisAreaLeft = NULL;
+ XMLPropertyState* pOLEVisAreaTop = NULL;
+ XMLPropertyState* pOLEVisAreaWidth = NULL;
+ XMLPropertyState* pOLEVisAreaHeight = NULL;
+ XMLPropertyState* pOLEIsInternal = NULL;
+
+ // caption
+ XMLPropertyState* pCaptionIsEscRel = NULL;
+ XMLPropertyState* pCaptionEscRel = NULL;
+ XMLPropertyState* pCaptionEscAbs = NULL;
+
+ // filter fo:clip
+ XMLPropertyState* pClip11State = NULL;
+ XMLPropertyState* pClipState = NULL;
+
+ XMLPropertyState* pShapeWritingMode = NULL;
+ XMLPropertyState* pTextWritingMode = NULL;
+ XMLPropertyState* pControlWritingMode = NULL;
+
+ // filter properties
+ for( std::vector< XMLPropertyState >::iterator aIter = rProperties.begin();
+ aIter != rProperties.end();
+ ++aIter )
+ {
+ XMLPropertyState *property = &(*aIter);
+ if( property->mnIndex == -1 )
+ continue;
+
+ // find properties with context
+ // to prevent writing this property set mnIndex member to -1
+ switch( getPropertySetMapper()->GetEntryContextId( property->mnIndex ))
+ {
+ case CTF_NUMBERINGRULES:
+ {
+ if( mbIsInAutoStyles )
+ property->mnIndex = -1;
+ }
+ break;
+ case CTF_SD_NUMBERINGRULES_NAME:
+ {
+ // this property is not exported in the style:properties element
+ // because its an XIndexAccess and not a string.
+ // This will be handled in SvXMLAutoStylePoolP::exportStyleAttributes
+ // This is suboptimal
+ if( !mbIsInAutoStyles )
+ property->mnIndex = -1;
+ }
+ break;
+ case CTF_WRITINGMODE:
+ {
+ pShapeWritingMode = property;
+ text::WritingMode eWritingMode;
+ if( property->maValue >>= eWritingMode )
+ {
+ if( text::WritingMode_LR_TB == eWritingMode )
+ {
+ property->mnIndex = -1;
+ pShapeWritingMode = 0;
+ }
+ }
+ }
+ break;
+ case CTF_CONTROLWRITINGMODE:
+ pControlWritingMode = property;
+ break;
+ case CTF_TEXTWRITINGMODE:
+ pTextWritingMode = property;
+ break;
+ case CTF_REPEAT_OFFSET_X:
+ pRepeatOffsetX = property;
+ break;
+
+ case CTF_REPEAT_OFFSET_Y:
+ pRepeatOffsetY = property;
+ break;
+
+ case CTF_DASHNAME:
+ case CTF_FILLGRADIENTNAME:
+ case CTF_FILLHATCHNAME:
+ case CTF_FILLBITMAPNAME:
+ {
+ OUString aStr;
+ if( (property->maValue >>= aStr) && 0 == aStr.getLength() )
+ property->mnIndex = -1;
+ }
+ break;
+ case CTF_TEXTANIMATION_BLINKING:
+ pTextAnimationBlinking = property;
+ break;
+ case CTF_TEXTANIMATION_KIND:
+ pTextAnimationKind = property;
+ break;
+
+ // #FontWork#
+ case CTF_FONTWORK_STYLE: pFontWorkStyle = property; break;
+ case CTF_FONTWORK_ADJUST: pFontWorkAdjust = property; break;
+ case CTF_FONTWORK_DISTANCE: pFontWorkDistance = property; break;
+ case CTF_FONTWORK_START: pFontWorkStart = property; break;
+ case CTF_FONTWORK_MIRROR: pFontWorkMirror = property; break;
+ case CTF_FONTWORK_OUTLINE: pFontWorkOutline = property; break;
+ case CTF_FONTWORK_SHADOW: pFontWorkShadow = property; break;
+ case CTF_FONTWORK_SHADOWCOLOR: pFontWorkShadowColor = property; break;
+ case CTF_FONTWORK_SHADOWOFFSETX: pFontWorkShadowOffsetx = property; break;
+ case CTF_FONTWORK_SHADOWOFFSETY: pFontWorkShadowOffsety = property; break;
+ case CTF_FONTWORK_FORM: pFontWorkForm = property; break;
+ case CTF_FONTWORK_HIDEFORM: pFontWorkHideform = property; break;
+ case CTF_FONTWORK_SHADOWTRANSPARENCE: pFontWorkShadowTransparence = property; break;
+
+ // OLE
+ case CTF_SD_OLE_VIS_AREA_EXPORT_LEFT: pOLEVisAreaLeft = property; break;
+ case CTF_SD_OLE_VIS_AREA_EXPORT_TOP: pOLEVisAreaTop = property; break;
+ case CTF_SD_OLE_VIS_AREA_EXPORT_WIDTH: pOLEVisAreaWidth = property; break;
+ case CTF_SD_OLE_VIS_AREA_EXPORT_HEIGHT: pOLEVisAreaHeight = property; break;
+ case CTF_SD_OLE_ISINTERNAL: pOLEIsInternal = property; break;
+
+ case CTF_FRAME_DISPLAY_SCROLLBAR:
+ {
+ if( !property->maValue.hasValue() )
+ property->mnIndex = -1;
+ }
+ break;
+ case CTF_FRAME_MARGIN_HORI:
+ case CTF_FRAME_MARGIN_VERT:
+ {
+ sal_Int32 nValue = 0;
+ if( (property->maValue >>= nValue) && (nValue < 0) )
+ property->mnIndex = -1;
+ }
+ break;
+
+ case CTF_SD_MOVE_PROTECT:
+ {
+ sal_Bool bProtected = sal_Bool();
+ if( (property->maValue >>= bProtected) && !bProtected )
+ property->mnIndex = -1;
+ }
+ break;
+ case CTF_SD_SIZE_PROTECT:
+ {
+ sal_Bool bProtected = sal_Bool();
+ if( (property->maValue >>= bProtected) && !bProtected )
+ property->mnIndex = -1;
+ }
+ break;
+ case CTF_CAPTION_ISESCREL: pCaptionIsEscRel = property; break;
+ case CTF_CAPTION_ESCREL: pCaptionEscRel = property; break;
+ case CTF_CAPTION_ESCABS: pCaptionEscAbs = property; break;
+ case CTF_TEXT_CLIP11: pClip11State = property; break;
+ case CTF_TEXT_CLIP: pClipState = property; break;
+ }
+ }
+
+ // check for duplicate writing mode
+ if( pShapeWritingMode && (pTextWritingMode || pControlWritingMode) )
+ {
+ if( pTextWritingMode )
+ pTextWritingMode->mnIndex = -1;
+ if( pControlWritingMode )
+ pControlWritingMode->mnIndex = -1;
+ }
+ else if( pTextWritingMode && pControlWritingMode )
+ {
+ pControlWritingMode->mnIndex = -1;
+ }
+
+ // do not export visual area for internal ole objects
+ if( pOLEIsInternal )
+ {
+ sal_Bool bInternal = sal_Bool();
+ if( (pOLEIsInternal->maValue >>= bInternal) && !bInternal )
+ {
+ try
+ {
+ const OUString sVisibleArea( RTL_CONSTASCII_USTRINGPARAM("VisibleArea") );
+ awt::Rectangle aRect;
+ if( rPropSet->getPropertyValue( sVisibleArea ) >>= aRect )
+ {
+ if( pOLEVisAreaLeft )
+ {
+ pOLEVisAreaLeft->mnIndex = getPropertySetMapper()->FindEntryIndex( CTF_SD_OLE_VIS_AREA_IMPORT_LEFT );
+ pOLEVisAreaLeft->maValue <<= aRect;
+ }
+ if( pOLEVisAreaTop )
+ {
+ pOLEVisAreaTop->mnIndex = getPropertySetMapper()->FindEntryIndex( CTF_SD_OLE_VIS_AREA_IMPORT_TOP );
+ pOLEVisAreaTop->maValue <<= aRect;
+ }
+ if( pOLEVisAreaWidth )
+ {
+ pOLEVisAreaWidth->mnIndex = getPropertySetMapper()->FindEntryIndex( CTF_SD_OLE_VIS_AREA_IMPORT_WIDTH );
+ pOLEVisAreaWidth->maValue <<= aRect;
+ }
+ if( pOLEVisAreaHeight )
+ {
+ pOLEVisAreaHeight->mnIndex = getPropertySetMapper()->FindEntryIndex( CTF_SD_OLE_VIS_AREA_IMPORT_HEIGHT );
+ pOLEVisAreaHeight->maValue <<= aRect;
+ }
+ }
+ }
+ catch( uno::Exception& )
+ {
+ }
+ }
+ else
+ {
+ if( pOLEVisAreaLeft ) pOLEVisAreaLeft->mnIndex = -1;
+ if( pOLEVisAreaTop ) pOLEVisAreaTop->mnIndex = -1;
+ if( pOLEVisAreaWidth ) pOLEVisAreaWidth->mnIndex = -1;
+ if( pOLEVisAreaHeight ) pOLEVisAreaHeight->mnIndex = -1;
+ }
+
+ pOLEIsInternal->mnIndex = -1;
+ }
+
+ if( pTextAnimationBlinking && pTextAnimationKind )
+ {
+ drawing::TextAnimationKind eKind;
+ if( (pTextAnimationKind->maValue >>= eKind) && eKind != drawing::TextAnimationKind_BLINK )
+ {
+ pTextAnimationBlinking->mnIndex = -1;
+ }
+ else
+ {
+ pTextAnimationKind->mnIndex = -1;
+ }
+ }
+
+ if( pRepeatOffsetX && pRepeatOffsetY )
+ {
+ sal_Int32 nOffset = 0;
+ if( ( pRepeatOffsetX->maValue >>= nOffset ) && ( nOffset == 0 ) )
+ pRepeatOffsetX->mnIndex = -1;
+ else
+ pRepeatOffsetY->mnIndex = -1;
+ }
+
+ if(pFontWorkStyle)
+ {
+ // #FontWork#
+ sal_Int32 nStyle = 0;
+
+ if(pFontWorkStyle->maValue >>= nStyle)
+ {
+ if(/*XFT_NONE*/4 == nStyle)
+ {
+ pFontWorkStyle->mnIndex = -1;
+ if(pFontWorkAdjust)
+ pFontWorkAdjust->mnIndex = -1;
+ if(pFontWorkDistance)
+ pFontWorkDistance->mnIndex = -1;
+ if(pFontWorkStart)
+ pFontWorkStart->mnIndex = -1;
+ if(pFontWorkMirror)
+ pFontWorkMirror->mnIndex = -1;
+ if(pFontWorkOutline)
+ pFontWorkOutline->mnIndex = -1;
+ if(pFontWorkShadow)
+ pFontWorkShadow->mnIndex = -1;
+ if(pFontWorkShadowColor)
+ pFontWorkShadowColor->mnIndex = -1;
+ if(pFontWorkShadowOffsetx)
+ pFontWorkShadowOffsetx->mnIndex = -1;
+ if(pFontWorkShadowOffsety)
+ pFontWorkShadowOffsety->mnIndex = -1;
+ if(pFontWorkForm)
+ pFontWorkForm->mnIndex = -1;
+ if(pFontWorkHideform)
+ pFontWorkHideform->mnIndex = -1;
+ if(pFontWorkShadowTransparence)
+ pFontWorkShadowTransparence->mnIndex = -1;
+ }
+ }
+ }
+
+ if( pCaptionIsEscRel )
+ {
+ sal_Bool bIsRel = false;
+ pCaptionIsEscRel->maValue >>= bIsRel;
+
+ if( bIsRel )
+ {
+ if( pCaptionEscAbs )
+ pCaptionEscAbs->mnIndex = -1;
+ }
+ else
+ {
+ if( pCaptionEscRel )
+ pCaptionEscRel->mnIndex = -1;
+ }
+
+ pCaptionIsEscRel->mnIndex = -1;
+ }
+
+ if( pClipState != NULL && pClip11State != NULL )
+ pClip11State->mnIndex = -1;
+
+ SvXMLExportPropertyMapper::ContextFilter(rProperties, rPropSet);
+}
+
+void XMLShapeExportPropertyMapper::handleSpecialItem(
+ SvXMLAttributeList& rAttrList,
+ const XMLPropertyState& rProperty,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ const ::std::vector< XMLPropertyState > *pProperties,
+ sal_uInt32 nIdx ) const
+{
+ switch( getPropertySetMapper()->GetEntryContextId( rProperty.mnIndex ) )
+ {
+ case CTF_SD_CONTROL_SHAPE_DATA_STYLE:
+ // not to be handled by the base class
+ break;
+
+ default:
+ SvXMLExportPropertyMapper::handleSpecialItem( rAttrList, rProperty, rUnitConverter, rNamespaceMap, pProperties, nIdx );
+ break;
+ }
+}
+
+void XMLShapeExportPropertyMapper::handleElementItem(
+ SvXMLExport& rExport,
+ const XMLPropertyState& rProperty,
+ sal_uInt16 nFlags,
+ const ::std::vector< XMLPropertyState > *pProperties,
+ sal_uInt32 nIdx) const
+{
+ switch( getPropertySetMapper()->GetEntryContextId( rProperty.mnIndex ) )
+ {
+ case CTF_NUMBERINGRULES:
+ {
+ // only export list-styles as elements in styles section
+ if( !mbIsInAutoStyles )
+ {
+ uno::Reference< container::XIndexReplace > xNumRule( rProperty.maValue, uno::UNO_QUERY );
+ if( xNumRule.is() )
+ const_cast<XMLShapeExportPropertyMapper*>(this)->maNumRuleExp.exportNumberingRule( maStyleName, xNumRule );
+ }
+ }
+ break;
+ default:
+ SvXMLExportPropertyMapper::handleElementItem( rExport, rProperty, nFlags, pProperties, nIdx );
+ break;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+XMLPagePropertySetMapper::XMLPagePropertySetMapper(const UniReference< XMLPropertyHandlerFactory >& rFactoryRef)
+: XMLPropertySetMapper( aXMLSDPresPageProps, rFactoryRef )
+{
+}
+
+XMLPagePropertySetMapper::~XMLPagePropertySetMapper()
+{
+}
+
+// ----------------------------------------
+
+XMLPageExportPropertyMapper::XMLPageExportPropertyMapper( const UniReference< XMLPropertySetMapper >& rMapper, SvXMLExport& rExport ) :
+ SvXMLExportPropertyMapper( rMapper ),
+ mrExport( rExport ),
+ msCDATA( GetXMLToken(XML_CDATA))
+{
+}
+
+XMLPageExportPropertyMapper::~XMLPageExportPropertyMapper()
+{
+}
+
+void XMLPageExportPropertyMapper::ContextFilter(
+ std::vector< XMLPropertyState >& rProperties,
+ uno::Reference< beans::XPropertySet > rPropSet ) const
+{
+ XMLPropertyState* pRepeatOffsetX = NULL;
+ XMLPropertyState* pRepeatOffsetY = NULL;
+ XMLPropertyState* pTransType = NULL;
+ XMLPropertyState* pTransDuration = NULL;
+ XMLPropertyState* pDateTimeUpdate = NULL;
+ XMLPropertyState* pDateTimeFormat = NULL;
+ XMLPropertyState* pTransitionFadeColor = NULL;
+
+ sal_Int16 nTransitionType = 0;
+
+ // filter properties
+ for( std::vector< XMLPropertyState >::iterator aIter = rProperties.begin();
+ aIter != rProperties.end();
+ ++aIter )
+ {
+ XMLPropertyState *property = &(*aIter);
+ if( property->mnIndex == -1 )
+ continue;
+
+ // find properties with context
+ // to prevent writing this property set mnIndex member to -1
+ switch( getPropertySetMapper()->GetEntryContextId( property->mnIndex ))
+ {
+
+ case CTF_REPEAT_OFFSET_X:
+ pRepeatOffsetX = property;
+ break;
+
+ case CTF_REPEAT_OFFSET_Y:
+ pRepeatOffsetY = property;
+ break;
+ case CTF_PAGE_TRANS_TYPE:
+ pTransType = property;
+ break;
+ case CTF_PAGE_TRANS_STYLE:
+ if( mrExport.getExportFlags() & EXPORT_OASIS )
+ (*property).mnIndex = -1;
+ break;
+ case CTF_PAGE_TRANSITION_TYPE:
+ {
+ if( ((mrExport.getExportFlags() & EXPORT_OASIS) == 0) ||
+ (((*property).maValue >>= nTransitionType) && (nTransitionType == 0)) )
+ (*property).mnIndex = -1;
+ }
+ break;
+ case CTF_PAGE_TRANSITION_SUBTYPE:
+ {
+ sal_Int16 nTransitionSubtype = sal_Int16();
+ if( ((mrExport.getExportFlags() & EXPORT_OASIS) == 0) ||
+ (((*property).maValue >>= nTransitionSubtype) && (nTransitionSubtype == 0)) )
+ (*property).mnIndex = -1;
+
+ }
+ break;
+ case CTF_PAGE_TRANSITION_DIRECTION:
+ {
+ sal_Bool bDirection = sal_Bool();
+ if( ((mrExport.getExportFlags() & EXPORT_OASIS) == 0) ||
+ (((*property).maValue >>= bDirection) && bDirection) )
+ (*property).mnIndex = -1;
+ }
+ break;
+ case CTF_PAGE_TRANSITION_FADECOLOR:
+ if( ((mrExport.getExportFlags() & EXPORT_OASIS) == 0) )
+ (*property).mnIndex = -1;
+ else
+ pTransitionFadeColor = property;
+ break;
+ case CTF_PAGE_TRANS_SPEED:
+ {
+ presentation::AnimationSpeed aEnum;
+ if( ((*property).maValue >>= aEnum) && aEnum == presentation::AnimationSpeed_MEDIUM )
+ (*property).mnIndex = -1;
+ }
+ break;
+ case CTF_PAGE_VISIBLE:
+ {
+ sal_Bool bVisible = false;
+ (*property).maValue >>= bVisible;
+ if( bVisible )
+ (*property).mnIndex = -1;
+ }
+ break;
+ case CTF_PAGE_TRANS_DURATION:
+ pTransDuration = property;
+ break;
+ case CTF_HEADER_TEXT:
+ case CTF_FOOTER_TEXT:
+ case CTF_DATE_TIME_TEXT:
+ {
+ OUString aValue;
+ (*property).maValue >>= aValue;
+ if( aValue.getLength() == 0 )
+ (*property).mnIndex = -1;
+ }
+ break;
+
+ case CTF_DATE_TIME_UPDATE:
+ pDateTimeUpdate = property;
+ break;
+
+ case CTF_DATE_TIME_FORMAT:
+ pDateTimeFormat = property;
+ break;
+ }
+ }
+
+ if( pTransitionFadeColor && nTransitionType != ::com::sun::star::animations::TransitionType::FADE )
+ pTransitionFadeColor->mnIndex = -1;
+
+ if( pDateTimeFormat && pDateTimeUpdate )
+ {
+ sal_Bool bIsFixed = false;
+ pDateTimeUpdate->maValue >>= bIsFixed;
+ if( bIsFixed )
+ pDateTimeFormat->mnIndex = -1;
+ }
+
+ if( pRepeatOffsetX && pRepeatOffsetY )
+ {
+ sal_Int32 nOffset = 0;
+ if( ( pRepeatOffsetX->maValue >>= nOffset ) && ( nOffset == 0 ) )
+ pRepeatOffsetX->mnIndex = -1;
+ else
+ pRepeatOffsetY->mnIndex = -1;
+ }
+
+ if( pTransType && pTransDuration )
+ {
+ sal_Int32 nChange = 0;
+ pTransType->maValue >>= nChange;
+
+ // only export duration for automatic
+ if( nChange != 1 )
+ pTransDuration->mnIndex = -1;
+
+ // do not export default transition change
+ if( nChange == 0 )
+ pTransType->mnIndex = -1;
+ }
+
+ SvXMLExportPropertyMapper::ContextFilter(rProperties, rPropSet);
+}
+
+void XMLPageExportPropertyMapper::handleElementItem(
+ SvXMLExport& rExport,
+ const XMLPropertyState& rProperty,
+ sal_uInt16 nFlags,
+ const ::std::vector< XMLPropertyState > *pProperties,
+ sal_uInt32 nIdx) const
+{
+ switch( getPropertySetMapper()->GetEntryContextId( rProperty.mnIndex ) )
+ {
+ case CTF_PAGE_SOUND_URL:
+ {
+ OUString aSoundURL;
+ if( (rProperty.maValue >>= aSoundURL) && aSoundURL.getLength() != 0 )
+ {
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, mrExport.GetRelativeReference(aSoundURL) );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_NEW );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONREQUEST );
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_PRESENTATION, XML_SOUND, sal_True, sal_True );
+ }
+ }
+ break;
+ default:
+ SvXMLExportPropertyMapper::handleElementItem( rExport, rProperty, nFlags, pProperties, nIdx );
+ break;
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/sdpropls.hxx b/xmloff/source/draw/sdpropls.hxx
new file mode 100644
index 000000000000..80b6e17d507a
--- /dev/null
+++ b/xmloff/source/draw/sdpropls.hxx
@@ -0,0 +1,337 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _SDPROPLS_HXX
+#define _SDPROPLS_HXX
+
+#include <com/sun/star/frame/XModel.hpp>
+#include <xmloff/xmlnume.hxx>
+#include <xmloff/maptype.hxx>
+#include <xmloff/xmltypes.hxx>
+#include <xmloff/xmlement.hxx>
+#include <xmloff/prhdlfac.hxx>
+#include <xmloff/xmlprmap.hxx>
+#include "xmloff/XMLTextListAutoStylePool.hxx"
+#include <xmloff/xmlexppr.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// entry list for graphic properties
+
+extern const XMLPropertyMapEntry aXMLSDProperties[];
+
+//////////////////////////////////////////////////////////////////////////////
+// entry list for presentation page properties
+
+extern const XMLPropertyMapEntry aXMLSDPresPageProps[];
+extern const XMLPropertyMapEntry aXMLSDPresPageProps_onlyHeadersFooter[];
+
+//////////////////////////////////////////////////////////////////////////////
+// types of own properties
+
+#define XML_SD_TYPE_STROKE (XML_SD_TYPES_START + 0)
+#define XML_SD_TYPE_PRESPAGE_TYPE (XML_SD_TYPES_START + 1)
+#define XML_SD_TYPE_PRESPAGE_STYLE (XML_SD_TYPES_START + 2)
+#define XML_SD_TYPE_PRESPAGE_SPEED (XML_SD_TYPES_START + 3)
+#define XML_SD_TYPE_PRESPAGE_DURATION (XML_SD_TYPES_START + 4)
+#define XML_SD_TYPE_PRESPAGE_VISIBILITY (XML_SD_TYPES_START + 5)
+#define XML_SD_TYPE_MARKER (XML_SD_TYPES_START + 6 )
+#define XML_SD_TYPE_OPACITY (XML_SD_TYPES_START + 7 )
+#define XML_SD_TYPE_LINEJOIN (XML_SD_TYPES_START + 8 )
+#define XML_SD_TYPE_FILLSTYLE (XML_SD_TYPES_START + 9 )
+#define XML_SD_TYPE_GRADIENT (XML_SD_TYPES_START + 10 )
+#define XML_SD_TYPE_GRADIENT_STEPCOUNT (XML_SD_TYPES_START + 11 )
+#define XML_SD_TYPE_SHADOW (XML_SD_TYPES_START + 12 )
+#define XML_SD_TYPE_TEXT_CROSSEDOUT (XML_SD_TYPES_START + 13 )
+#define XML_SD_TYPE_NUMBULLET (XML_SD_TYPES_START + 14 )
+#define XML_SD_TYPE_WRITINGMODE (XML_SD_TYPES_START + 15 )
+#define XML_SD_TYPE_BITMAP_MODE (XML_SD_TYPES_START + 16 )
+#define XML_SD_TYPE_BITMAPREPOFFSETX (XML_SD_TYPES_START + 17 )
+#define XML_SD_TYPE_BITMAPREPOFFSETY (XML_SD_TYPES_START + 18 )
+#define XML_SD_TYPE_FILLBITMAPSIZE (XML_SD_TYPES_START + 19 )
+#define XML_SD_TYPE_LOGICAL_SIZE (XML_SD_TYPES_START + 20 )
+#define XML_SD_TYPE_BITMAP_REFPOINT (XML_SD_TYPES_START + 21 )
+#define XML_SD_TYPE_PRESPAGE_BACKSIZE (XML_SD_TYPES_START + 22 )
+#define XML_TYPE_TEXT_ANIMATION_BLINKING (XML_SD_TYPES_START + 23 )
+#define XML_TYPE_TEXT_ANIMATION_STEPS (XML_SD_TYPES_START + 24 )
+#define XML_SD_TYPE_TEXT_ALIGN (XML_SD_TYPES_START + 25 )
+#define XML_SD_TYPE_VERTICAL_ALIGN (XML_SD_TYPES_START + 26 )
+#define XML_SD_TYPE_FITTOSIZE (XML_SD_TYPES_START + 27 )
+#define XML_SD_TYPE_MEASURE_HALIGN (XML_SD_TYPES_START + 28 )
+#define XML_SD_TYPE_MEASURE_VALIGN (XML_SD_TYPES_START + 29 )
+#define XML_SD_TYPE_MEASURE_UNIT (XML_SD_TYPES_START + 30 )
+#define XML_SD_TYPE_MEASURE_PLACING (XML_SD_TYPES_START + 31 )
+#define XML_SD_TYPE_CONTROL_BORDER (XML_SD_TYPES_START + 32 )
+#define XML_SD_TYPE_CONTROL_BORDER_COLOR (XML_SD_TYPES_START + 33 )
+#define XML_SD_TYPE_IMAGE_SCALE_MODE (XML_SD_TYPES_START + 34 )
+
+// 3D property types
+#define XML_SD_TYPE_BACKFACE_CULLING (XML_SD_TYPES_START + 40 )
+#define XML_SD_TYPE_NORMALS_KIND (XML_SD_TYPES_START + 41 )
+#define XML_SD_TYPE_NORMALS_DIRECTION (XML_SD_TYPES_START + 42 )
+#define XML_SD_TYPE_TEX_GENERATION_MODE_X (XML_SD_TYPES_START + 43 )
+#define XML_SD_TYPE_TEX_GENERATION_MODE_Y (XML_SD_TYPES_START + 44 )
+#define XML_SD_TYPE_TEX_KIND (XML_SD_TYPES_START + 45 )
+#define XML_SD_TYPE_TEX_MODE (XML_SD_TYPES_START + 46 )
+
+//////////////////////////////////////////////////////////////////////////////
+// #FontWork# types
+#define XML_SD_TYPE_FONTWORK_STYLE (XML_SD_TYPES_START + 47 )
+#define XML_SD_TYPE_FONTWORK_ADJUST (XML_SD_TYPES_START + 48 )
+#define XML_SD_TYPE_FONTWORK_SHADOW (XML_SD_TYPES_START + 49 )
+#define XML_SD_TYPE_FONTWORK_FORM (XML_SD_TYPES_START + 50 )
+
+//////////////////////////////////////////////////////////////////////////////
+// Caption types
+#define XML_SD_TYPE_CAPTION_ANGLE_TYPE (XML_SD_TYPES_START + 60 )
+#define XML_SD_TYPE_CAPTION_IS_ESC_REL (XML_SD_TYPES_START + 61 )
+#define XML_SD_TYPE_CAPTION_ESC_REL (XML_SD_TYPES_START + 62 )
+#define XML_SD_TYPE_CAPTION_ESC_ABS (XML_SD_TYPES_START + 63 )
+#define XML_SD_TYPE_CAPTION_ESC_DIR (XML_SD_TYPES_START + 64 )
+#define XML_SD_TYPE_CAPTION_TYPE (XML_SD_TYPES_START + 65 )
+
+//////////////////////////////////////////////////////////////////////////////
+// header & footer types
+#define XML_SD_TYPE_DATETIMEUPDATE (XML_SD_TYPES_START + 70 )
+#define XML_SD_TYPE_DATETIME_FORMAT (XML_SD_TYPES_START + 71 )
+
+//////////////////////////////////////////////////////////////////////////////
+
+// new types for merged style:protect attribute
+#define XML_SD_TYPE_MOVE_PROTECT (XML_SD_TYPES_START + 72 )
+#define XML_SD_TYPE_SIZE_PROTECT (XML_SD_TYPES_START + 73 )
+
+// new type for style:mirror attribute
+#define XML_TYPE_SD_MIRROR (XML_SD_TYPES_START + 74 )
+
+//////////////////////////////////////////////////////////////////////////////
+
+// new smil transition types for pages
+#define XML_SD_TYPE_TRANSITION_TYPE (XML_SD_TYPES_START + 75 )
+#define XML_SD_TYPE_TRANSTIION_SUBTYPE (XML_SD_TYPES_START + 76 )
+#define XML_SD_TYPE_TRANSTIION_DIRECTION (XML_SD_TYPES_START + 77 )
+
+#define XML_SD_TYPE_HEADER_FOOTER_VISIBILITY_TYPE (XML_SD_TYPES_START + 78 )
+
+//////////////////////////////////////////////////////////////////////////////
+
+#define CTF_NUMBERINGRULES 1000
+#define CTF_CONTROLWRITINGMODE 1001
+#define CTF_WRITINGMODE 1002
+#define CTF_REPEAT_OFFSET_X 1003
+#define CTF_REPEAT_OFFSET_Y 1004
+#define CTF_PAGE_SOUND_URL 1005
+#define CTF_PAGE_VISIBLE 1006
+#define CTF_PAGE_TRANS_TYPE 1007
+#define CTF_PAGE_TRANS_STYLE 1008
+#define CTF_PAGE_TRANS_SPEED 1009
+#define CTF_PAGE_TRANS_DURATION 1010
+#define CTF_PAGE_BACKSIZE 1011
+#define CTF_DASHNAME 1012
+#define CTF_LINESTARTNAME 1013
+#define CTF_LINEENDNAME 1014
+#define CTF_FILLGRADIENTNAME 1015
+#define CTF_FILLHATCHNAME 1016
+#define CTF_FILLBITMAPNAME 1017
+#define CTF_FILLTRANSNAME 1018
+#define CTF_TEXTANIMATION_BLINKING 1019
+#define CTF_TEXTANIMATION_KIND 1020
+
+#define CTF_PAGE_TRANSITION_TYPE 1021
+#define CTF_PAGE_TRANSITION_SUBTYPE 1022
+#define CTF_PAGE_TRANSITION_DIRECTION 1023
+#define CTF_PAGE_TRANSITION_FADECOLOR 1024
+
+//////////////////////////////////////////////////////////////////////////////
+// #FontWork#
+#define CTF_FONTWORK_STYLE 1021
+#define CTF_FONTWORK_ADJUST 1022
+#define CTF_FONTWORK_DISTANCE 1023
+#define CTF_FONTWORK_START 1024
+#define CTF_FONTWORK_MIRROR 1025
+#define CTF_FONTWORK_OUTLINE 1026
+#define CTF_FONTWORK_SHADOW 1027
+#define CTF_FONTWORK_SHADOWCOLOR 1028
+#define CTF_FONTWORK_SHADOWOFFSETX 1029
+#define CTF_FONTWORK_SHADOWOFFSETY 1030
+#define CTF_FONTWORK_FORM 1031
+#define CTF_FONTWORK_HIDEFORM 1032
+#define CTF_FONTWORK_SHADOWTRANSPARENCE 1033
+
+//////////////////////////////////////////////////////////////////////////////
+// OLE part 1
+#define CTF_SD_OLE_VIS_AREA_IMPORT_LEFT 1040
+#define CTF_SD_OLE_VIS_AREA_IMPORT_TOP 1041
+#define CTF_SD_OLE_VIS_AREA_IMPORT_WIDTH 1042
+#define CTF_SD_OLE_VIS_AREA_IMPORT_HEIGHT 1043
+#define CTF_SD_OLE_ISINTERNAL 1044
+
+#define CTF_SD_MOVE_PROTECT 1045
+#define CTF_SD_SIZE_PROTECT 1046
+
+//////////////////////////////////////////////////////////////////////////////
+// caption
+#define CTF_CAPTION_ISESCREL 1047
+#define CTF_CAPTION_ESCREL 1048
+#define CTF_CAPTION_ESCABS 1049
+
+//////////////////////////////////////////////////////////////////////////////
+// header&footer
+#define CTF_HEADER_VISIBLE 1050
+#define CTF_FOOTER_VISIBLE 1051
+#define CTF_PAGE_NUMBER_VISIBLE 1052
+#define CTF_DATE_TIME_VISIBLE 1053
+#define CTF_HEADER_TEXT 1054
+#define CTF_FOOTER_TEXT 1055
+#define CTF_DATE_TIME_TEXT 1056
+#define CTF_DATE_TIME_FORMAT 1057
+#define CTF_DATE_TIME_UPDATE 1058
+
+//////////////////////////////////////////////////////////////////////////////
+// OLE part 2
+#define CTF_SD_OLE_ASPECT 1059
+#define CTF_SD_OLE_VIS_AREA_EXPORT_LEFT 1060
+#define CTF_SD_OLE_VIS_AREA_EXPORT_TOP 1061
+#define CTF_SD_OLE_VIS_AREA_EXPORT_WIDTH 1062
+#define CTF_SD_OLE_VIS_AREA_EXPORT_HEIGHT 1063
+
+//////////////////////////////////////////////////////////////////////////////
+// enum maps for attributes
+
+extern SvXMLEnumMapEntry aXML_ConnectionKind_EnumMap[];
+extern SvXMLEnumMapEntry aXML_CircleKind_EnumMap[];
+
+//////////////////////////////////////////////////////////////////////////////
+
+/** contains the attribute to property mapping for a drawing layer table */
+extern const XMLPropertyMapEntry aXMLTableShapeAttributes[];
+
+//////////////////////////////////////////////////////////////////////////////
+// factory for own graphic properties
+
+class SvXMLExport;
+class SvXMLImport;
+
+class XMLSdPropHdlFactory : public XMLPropertyHandlerFactory
+{
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxModel;
+ SvXMLExport* mpExport;
+ SvXMLImport* mpImport;
+
+public:
+ XMLSdPropHdlFactory( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >, SvXMLExport& rExport );
+ XMLSdPropHdlFactory( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >, SvXMLImport& rImport );
+ virtual ~XMLSdPropHdlFactory();
+ virtual const XMLPropertyHandler* GetPropertyHandler( sal_Int32 nType ) const;
+};
+
+class XMLShapePropertySetMapper : public XMLPropertySetMapper
+{
+public:
+ XMLShapePropertySetMapper(const UniReference< XMLPropertyHandlerFactory >& rFactoryRef);
+ XMLShapePropertySetMapper(const UniReference< XMLPropertyHandlerFactory >& rFactoryRef, sal_uInt16 nOffset);
+ ~XMLShapePropertySetMapper();
+};
+
+class XMLShapeExportPropertyMapper : public SvXMLExportPropertyMapper
+{
+private:
+ XMLTextListAutoStylePool *mpListAutoPool;
+ SvXMLExport& mrExport;
+ SvxXMLNumRuleExport maNumRuleExp;
+ sal_Bool mbIsInAutoStyles;
+
+ const rtl::OUString msCDATA;
+ const rtl::OUString msTrue;
+ const rtl::OUString msFalse;
+
+protected:
+ virtual void ContextFilter(
+ ::std::vector< XMLPropertyState >& rProperties,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > rPropSet ) const;
+public:
+ XMLShapeExportPropertyMapper( const UniReference< XMLPropertySetMapper >& rMapper, XMLTextListAutoStylePool *pListAutoPool, SvXMLExport& rExport );
+ virtual ~XMLShapeExportPropertyMapper();
+
+ virtual void handleElementItem(
+ SvXMLExport& rExport,
+ const XMLPropertyState& rProperty,
+ sal_uInt16 nFlags,
+ const ::std::vector< XMLPropertyState >* pProperties = 0,
+ sal_uInt32 nIdx = 0
+ ) const;
+
+ void SetAutoStyles( sal_Bool bIsInAutoStyles ) { mbIsInAutoStyles = bIsInAutoStyles; }
+
+ virtual void handleSpecialItem(
+ SvXMLAttributeList& rAttrList,
+ const XMLPropertyState& rProperty,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ const ::std::vector< XMLPropertyState > *pProperties = 0,
+ sal_uInt32 nIdx = 0 ) const;
+};
+
+class XMLPagePropertySetMapper : public XMLPropertySetMapper
+{
+public:
+ XMLPagePropertySetMapper(const UniReference< XMLPropertyHandlerFactory >& rFactoryRef);
+ ~XMLPagePropertySetMapper();
+};
+
+class XMLPageExportPropertyMapper : public SvXMLExportPropertyMapper
+{
+private:
+ SvXMLExport& mrExport;
+
+ const rtl::OUString msCDATA;
+ const rtl::OUString msTrue;
+ const rtl::OUString msFalse;
+
+protected:
+ virtual void ContextFilter(
+ ::std::vector< XMLPropertyState >& rProperties,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > rPropSet ) const;
+public:
+ XMLPageExportPropertyMapper( const UniReference< XMLPropertySetMapper >& rMapper, SvXMLExport& rExport );
+ virtual ~XMLPageExportPropertyMapper();
+
+ virtual void handleElementItem(
+ SvXMLExport& rExport,
+ const XMLPropertyState& rProperty,
+ sal_uInt16 nFlags,
+ const ::std::vector< XMLPropertyState >* pProperties = 0,
+ sal_uInt32 nIdx = 0
+ ) const;
+};
+
+#endif // _SDPROPLS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx
new file mode 100644
index 000000000000..29db93ca8226
--- /dev/null
+++ b/xmloff/source/draw/sdxmlexp.cxx
@@ -0,0 +1,2961 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "unointerfacetouniqueidentifiermapper.hxx"
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlmetae.hxx>
+#include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
+#include <com/sun/star/presentation/XPresentationSupplier.hpp>
+#include <com/sun/star/presentation/XCustomPresentationSupplier.hpp>
+#include <com/sun/star/geometry/RealPoint2D.hpp>
+#include <com/sun/star/task/XStatusIndicatorSupplier.hpp>
+#include <com/sun/star/office/XAnnotationAccess.hpp>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include "sdxmlexp_impl.hxx"
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
+#include <com/sun/star/presentation/XHandoutMasterSupplier.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/view/PaperOrientation.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/style/XStyle.hpp>
+
+#include <com/sun/star/form/XFormsSupplier2.hpp>
+#include <com/sun/star/presentation/XPresentationPage.hpp>
+#include <com/sun/star/drawing/XMasterPageTarget.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/chart/XChartDocument.hpp>
+#include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <rtl/ustrbuf.hxx>
+#include <tools/gen.hxx>
+#include <tools/debug.hxx>
+#include <xmloff/xmlaustp.hxx>
+#include <xmloff/families.hxx>
+#include <xmloff/styleexp.hxx>
+#include "sdpropls.hxx"
+#include <xmloff/xmlexppr.hxx>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include "xexptran.hxx"
+
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/extract.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include "PropertySetMerger.hxx"
+#include "layerexp.hxx"
+
+
+#include "xmloff/VisAreaExport.hxx"
+#include "XMLNumberStylesExport.hxx"
+#include <tools/string.hxx>
+
+#include "animationexport.hxx"
+
+#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::office;
+using namespace ::com::sun::star::presentation;
+using namespace ::com::sun::star::geometry;
+using namespace ::com::sun::star::text;
+using namespace ::xmloff::token;
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+class ImpXMLEXPPageMasterInfo
+{
+ sal_Int32 mnBorderBottom;
+ sal_Int32 mnBorderLeft;
+ sal_Int32 mnBorderRight;
+ sal_Int32 mnBorderTop;
+ sal_Int32 mnWidth;
+ sal_Int32 mnHeight;
+ view::PaperOrientation meOrientation;
+ OUString msName;
+ OUString msMasterPageName;
+
+public:
+ ImpXMLEXPPageMasterInfo(const SdXMLExport& rExp, const Reference<XDrawPage>& xPage);
+ sal_Bool operator==(const ImpXMLEXPPageMasterInfo& rInfo) const;
+ void SetName(const OUString& rStr);
+
+ const OUString& GetName() const { return msName; }
+ const OUString& GetMasterPageName() const { return msMasterPageName; }
+
+ sal_Int32 GetBorderBottom() const { return mnBorderBottom; }
+ sal_Int32 GetBorderLeft() const { return mnBorderLeft; }
+ sal_Int32 GetBorderRight() const { return mnBorderRight; }
+ sal_Int32 GetBorderTop() const { return mnBorderTop; }
+ sal_Int32 GetWidth() const { return mnWidth; }
+ sal_Int32 GetHeight() const { return mnHeight; }
+ view::PaperOrientation GetOrientation() const { return meOrientation; }
+};
+
+ImpXMLEXPPageMasterInfo::ImpXMLEXPPageMasterInfo(
+ const SdXMLExport& rExp,
+ const Reference<XDrawPage>& xPage)
+: mnBorderBottom(0),
+ mnBorderLeft(0),
+ mnBorderRight(0),
+ mnBorderTop(0),
+ mnWidth(0),
+ mnHeight(0),
+ meOrientation(rExp.IsDraw() ? view::PaperOrientation_PORTRAIT : view::PaperOrientation_LANDSCAPE)
+{
+ Reference <beans::XPropertySet> xPropSet(xPage, UNO_QUERY);
+ if(xPropSet.is())
+ {
+ Any aAny;
+
+ Reference< beans::XPropertySetInfo > xPropsInfo( xPropSet->getPropertySetInfo() );
+ if( xPropsInfo.is() && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("BorderBottom") )))
+ {
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("BorderBottom")));
+ aAny >>= mnBorderBottom;
+
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("BorderLeft")));
+ aAny >>= mnBorderLeft;
+
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("BorderRight")));
+ aAny >>= mnBorderRight;
+
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("BorderTop")));
+ aAny >>= mnBorderTop;
+ }
+
+ if( xPropsInfo.is() && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("Width") )))
+ {
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Width")));
+ aAny >>= mnWidth;
+
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Height")));
+ aAny >>= mnHeight;
+ }
+
+ if( xPropsInfo.is() && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("Orientation") )))
+ {
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Orientation")));
+ aAny >>= meOrientation;
+ }
+ }
+
+ Reference <container::XNamed> xMasterNamed(xPage, UNO_QUERY);
+ if(xMasterNamed.is())
+ {
+ msMasterPageName = xMasterNamed->getName();
+ }
+}
+
+sal_Bool ImpXMLEXPPageMasterInfo::operator==(const ImpXMLEXPPageMasterInfo& rInfo) const
+{
+ return ((mnBorderBottom == rInfo.mnBorderBottom)
+ && (mnBorderLeft == rInfo.mnBorderLeft)
+ && (mnBorderRight == rInfo.mnBorderRight)
+ && (mnBorderTop == rInfo.mnBorderTop)
+ && (mnWidth == rInfo.mnWidth)
+ && (mnHeight == rInfo.mnHeight)
+ && (meOrientation == rInfo.meOrientation));
+}
+
+void ImpXMLEXPPageMasterInfo::SetName(const OUString& rStr)
+{
+ msName = rStr;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+#define IMP_AUTOLAYOUT_INFO_MAX (35L)
+
+class ImpXMLAutoLayoutInfo
+{
+ sal_uInt16 mnType;
+ ImpXMLEXPPageMasterInfo* mpPageMasterInfo;
+ OUString msLayoutName;
+ Rectangle maTitleRect;
+ Rectangle maPresRect;
+ sal_Int32 mnGapX;
+ sal_Int32 mnGapY;
+
+public:
+ ImpXMLAutoLayoutInfo(sal_uInt16 nTyp, ImpXMLEXPPageMasterInfo* pInf);
+
+ sal_Bool operator==(const ImpXMLAutoLayoutInfo& rInfo) const;
+
+ sal_uInt16 GetLayoutType() const { return mnType; }
+ sal_Int32 GetGapX() const { return mnGapX; }
+ sal_Int32 GetGapY() const { return mnGapY; }
+
+ const OUString& GetLayoutName() const { return msLayoutName; }
+ void SetLayoutName(const OUString& rNew) { msLayoutName = rNew; }
+
+ const Rectangle& GetTitleRectangle() const { return maTitleRect; }
+ const Rectangle& GetPresRectangle() const { return maPresRect; }
+
+ static sal_Bool IsCreateNecessary(sal_uInt16 nTyp);
+};
+
+sal_Bool ImpXMLAutoLayoutInfo::IsCreateNecessary(sal_uInt16 nTyp)
+{
+ if(nTyp == 5 /* AUTOLAYOUT_ORG */
+ || nTyp == 20 /* AUTOLAYOUT_NONE */
+ || nTyp >= IMP_AUTOLAYOUT_INFO_MAX)
+ return sal_False;
+ return sal_True;
+}
+
+sal_Bool ImpXMLAutoLayoutInfo::operator==(const ImpXMLAutoLayoutInfo& rInfo) const
+{
+ return ((mnType == rInfo.mnType
+ && mpPageMasterInfo == rInfo.mpPageMasterInfo));
+}
+
+ImpXMLAutoLayoutInfo::ImpXMLAutoLayoutInfo(sal_uInt16 nTyp, ImpXMLEXPPageMasterInfo* pInf)
+: mnType(nTyp),
+ mpPageMasterInfo(pInf)
+{
+ // create full info (initialze with typical values)
+ Point aPagePos(0,0);
+ Size aPageSize(28000, 21000);
+ Size aPageInnerSize(28000, 21000);
+
+ if(mpPageMasterInfo)
+ {
+ aPagePos = Point(mpPageMasterInfo->GetBorderLeft(), mpPageMasterInfo->GetBorderTop());
+ aPageSize = Size(mpPageMasterInfo->GetWidth(), mpPageMasterInfo->GetHeight());
+ aPageInnerSize = aPageSize;
+ aPageInnerSize.Width() -= mpPageMasterInfo->GetBorderLeft() + mpPageMasterInfo->GetBorderRight();
+ aPageInnerSize.Height() -= mpPageMasterInfo->GetBorderTop() + mpPageMasterInfo->GetBorderBottom();
+ }
+
+ // title rectangle aligning
+ Point aTitlePos(aPagePos);
+ Size aTitleSize(aPageInnerSize);
+
+ if(mnType == 21 /* AUTOLAYOUT_NOTES */)
+ {
+ aTitleSize.Height() = (long) (aTitleSize.Height() / 2.5);
+ Point aPos = aTitlePos;
+ aPos.Y() += long( aTitleSize.Height() * 0.083 );
+ Size aPartArea = aTitleSize;
+ Size aSize;
+
+ // tatsaechliche Seitengroesse in das Handout-Rechteck skalieren
+ double fH = (double) aPartArea.Width() / aPageSize.Width();
+ double fV = (double) aPartArea.Height() / aPageSize.Height();
+
+ if ( fH > fV )
+ fH = fV;
+ aSize.Width() = (long) (fH * aPageSize.Width());
+ aSize.Height() = (long) (fH * aPageSize.Height());
+
+ aPos.X() += (aPartArea.Width() - aSize.Width()) / 2;
+ aPos.Y() += (aPartArea.Height()- aSize.Height())/ 2;
+
+ aTitlePos = aPos;
+ aTitleSize = aSize;
+ }
+ else if(mnType == 27 || mnType == 28)
+ {
+ // AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART or
+ // AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE
+ Point aClassicTPos(
+ aTitlePos.X() + long( aTitleSize.Width() * 0.0735 ),
+ aTitlePos.Y() + long( aTitleSize.Height() * 0.083 ));
+ Size aClassicTSize(
+ long( aTitleSize.Width() * 0.854 ),
+ long( aTitleSize.Height() * 0.167 ));
+ Point aLPos(aPagePos);
+ Size aLSize(aPageInnerSize);
+ Point aClassicLPos(
+ aLPos.X() + long( aLSize.Width() * 0.0735 ),
+ aLPos.Y() + long( aLSize.Height() * 0.472 ));
+ Size aClassicLSize(
+ long( aLSize.Width() * 0.854 ),
+ long( aLSize.Height() * 0.444 ));
+
+ aTitlePos.X() = (aClassicTPos.X() + aClassicTSize.Width()) - aClassicTSize.Height();
+ aTitlePos.Y() = aClassicTPos.Y();
+ aTitleSize.Width() = aClassicTSize.Height();
+ aTitleSize.Height() = (aClassicLPos.Y() + aClassicLSize.Height()) - aClassicTPos.Y();
+ }
+ else
+ {
+ aTitlePos.X() += long( aTitleSize.Width() * 0.0735 );
+ aTitlePos.Y() += long( aTitleSize.Height() * 0.083 );
+ aTitleSize.Width() = long( aTitleSize.Width() * 0.854 );
+ aTitleSize.Height() = long( aTitleSize.Height() * 0.167 );
+ }
+
+ maTitleRect.SetPos(aTitlePos);
+ maTitleRect.SetSize(aTitleSize);
+
+ // layout rectangle aligning
+ Point aLayoutPos(aPagePos);
+ Size aLayoutSize(aPageInnerSize);
+
+ if(mnType == 21 /* AUTOLAYOUT_NOTES */)
+ {
+ aLayoutPos.X() += long( aLayoutSize.Width() * 0.0735 );
+ aLayoutPos.Y() += long( aLayoutSize.Height() * 0.472 );
+ aLayoutSize.Width() = long( aLayoutSize.Width() * 0.854 );
+ aLayoutSize.Height() = long( aLayoutSize.Height() * 0.444 );
+ }
+ else if((mnType >= 22 && mnType <= 26) || (mnType == 31)) // AUTOLAYOUT_HANDOUT
+ {
+ // keep info for inner area in maPresRect, put info for gap size
+ // to maTitleRect position
+ mnGapX = (aPageSize.Width() - aPageInnerSize.Width()) / 2;
+ mnGapY = (aPageSize.Height() - aPageInnerSize.Height()) / 2;
+
+ if(!mnGapX)
+ mnGapX = aPageSize.Width() / 10;
+
+ if(!mnGapY)
+ mnGapY = aPageSize.Height() / 10;
+
+ if(mnGapX < aPageInnerSize.Width() / 10)
+ mnGapX = aPageInnerSize.Width() / 10;
+
+ if(mnGapY < aPageInnerSize.Height() / 10)
+ mnGapY = aPageInnerSize.Height() / 10;
+ }
+ else if(mnType == 27 || mnType == 28)
+ {
+ // AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART or
+ // AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE
+ Point aClassicTPos(
+ aTitlePos.X() + long( aTitleSize.Width() * 0.0735 ),
+ aTitlePos.Y() + long( aTitleSize.Height() * 0.083 ));
+ Size aClassicTSize(
+ long( aTitleSize.Width() * 0.854 ),
+ long( aTitleSize.Height() * 0.167 ));
+ Point aClassicLPos(
+ aLayoutPos.X() + long( aLayoutSize.Width() * 0.0735 ),
+ aLayoutPos.Y() + long( aLayoutSize.Height() * 0.472 ));
+ Size aClassicLSize(
+ long( aLayoutSize.Width() * 0.854 ),
+ long( aLayoutSize.Height() * 0.444 ));
+
+ aLayoutPos.X() = aClassicLPos.X();
+ aLayoutPos.Y() = aClassicTPos.Y();
+ aLayoutSize.Width() = (aClassicLPos.X() + aClassicLSize.Width())
+ - (aClassicTSize.Height() + (aClassicLPos.Y() - (aClassicTPos.Y() + aClassicTSize.Height())));
+ aLayoutSize.Height() = (aClassicLPos.Y() + aClassicLSize.Height()) - aClassicTPos.Y();
+ }
+ else if( mnType == 32 )
+ {
+ // AUTOLAYOUT_ONLY_TEXT
+ aLayoutPos = aTitlePos;
+ aLayoutSize.Width() = aTitleSize.Width();
+ aLayoutSize.Height() = long( aLayoutSize.Height() * 0.825 );
+ }
+ else
+ {
+ aLayoutPos.X() += long( aLayoutSize.Width() * 0.0735 );
+ aLayoutPos.Y() += long( aLayoutSize.Height() * 0.278 );
+ aLayoutSize.Width() = long( aLayoutSize.Width() * 0.854 );
+ aLayoutSize.Height() = long( aLayoutSize.Height() * 0.630 );
+ }
+
+ maPresRect.SetPos(aLayoutPos);
+ maPresRect.SetSize(aLayoutSize);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+// #110680#
+SdXMLExport::SdXMLExport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ sal_Bool bIsDraw, sal_uInt16 nExportFlags )
+: SvXMLExport( xServiceFactory, MAP_CM, bIsDraw ? XML_DRAWING : XML_PRESENTATION, nExportFlags ),
+ mnDocMasterPageCount(0L),
+ mnDocDrawPageCount(0L),
+ mnShapeStyleInfoIndex(0L),
+ mnObjectCount(0L),
+ mpPageMasterInfoList(new ImpXMLEXPPageMasterList()),
+ mpPageMasterUsageList(new ImpXMLEXPPageMasterList()),
+ mpNotesPageMasterUsageList(new ImpXMLEXPPageMasterList()),
+ mpHandoutPageMaster(NULL),
+ mpAutoLayoutInfoList(new ImpXMLAutoLayoutInfoList()),
+ mpSdPropHdlFactory(0L),
+ mpPropertySetMapper(0L),
+ mpPresPagePropsMapper(0L),
+ mbIsDraw(bIsDraw),
+ mbFamilyGraphicUsed(sal_False),
+ mbFamilyPresentationUsed(sal_False),
+ msZIndex( GetXMLToken(XML_ZINDEX) ),
+ msEmptyPres( RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ),
+ msModel( RTL_CONSTASCII_USTRINGPARAM("Model") ),
+ msStartShape( RTL_CONSTASCII_USTRINGPARAM("StartShape") ),
+ msEndShape( RTL_CONSTASCII_USTRINGPARAM("EndShape") ),
+ msPageLayoutNames( RTL_CONSTASCII_USTRINGPARAM("PageLayoutNames") )
+{
+
+
+}
+
+// XExporter
+void SAL_CALL SdXMLExport::setSourceDocument( const Reference< lang::XComponent >& xDoc )
+ throw(lang::IllegalArgumentException, uno::RuntimeException)
+{
+ SvXMLExport::setSourceDocument( xDoc );
+
+ const OUString aEmpty;
+
+ // prepare factory parts
+ mpSdPropHdlFactory = new XMLSdPropHdlFactory( GetModel(), *this );
+ if(mpSdPropHdlFactory)
+ {
+ // set lock to avoid deletion
+ mpSdPropHdlFactory->acquire();
+
+ // build one ref
+ const UniReference< XMLPropertyHandlerFactory > aFactoryRef = mpSdPropHdlFactory;
+
+ // construct PropertySetMapper
+ UniReference < XMLPropertySetMapper > xMapper = new XMLShapePropertySetMapper( aFactoryRef);
+
+ mpPropertySetMapper = new XMLShapeExportPropertyMapper( xMapper, (XMLTextListAutoStylePool*)&GetTextParagraphExport()->GetListAutoStylePool(), *this );
+ // set lock to avoid deletion
+ mpPropertySetMapper->acquire();
+
+ // chain text attributes
+ mpPropertySetMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaExtPropMapper(*this));
+
+ // construct PresPagePropsMapper
+ xMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLSDPresPageProps, aFactoryRef);
+
+ mpPresPagePropsMapper = new XMLPageExportPropertyMapper( xMapper, *this );
+ if(mpPresPagePropsMapper)
+ {
+ // set lock to avoid deletion
+ mpPresPagePropsMapper->acquire();
+ }
+ }
+
+ // add family name
+ GetAutoStylePool()->AddFamily(
+ XML_STYLE_FAMILY_SD_GRAPHICS_ID,
+ OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_NAME)),
+ GetPropertySetMapper(),
+ OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_PREFIX)));
+ GetAutoStylePool()->AddFamily(
+ XML_STYLE_FAMILY_SD_PRESENTATION_ID,
+ OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_PRESENTATION_NAME)),
+ GetPropertySetMapper(),
+ OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_PRESENTATION_PREFIX)));
+ GetAutoStylePool()->AddFamily(
+ XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID,
+ OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME)),
+ GetPresPagePropsMapper(),
+ OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_DRAWINGPAGE_PREFIX)));
+ // prepare access to styles
+ Reference< style::XStyleFamiliesSupplier > xFamSup( GetModel(), UNO_QUERY );
+ if(xFamSup.is())
+ {
+ mxDocStyleFamilies = xFamSup->getStyleFamilies();
+ }
+
+ // prepare access to master pages
+ Reference < drawing::XMasterPagesSupplier > xMasterPagesSupplier(GetModel(), UNO_QUERY);
+ if(xMasterPagesSupplier.is())
+ {
+ mxDocMasterPages = mxDocMasterPages.query( xMasterPagesSupplier->getMasterPages() );
+ if(mxDocMasterPages.is())
+ {
+ mnDocMasterPageCount = mxDocMasterPages->getCount();
+ maMasterPagesStyleNames.insert( maMasterPagesStyleNames.begin(), mnDocMasterPageCount, aEmpty );
+ }
+ }
+
+ // prepare access to draw pages
+ Reference <XDrawPagesSupplier> xDrawPagesSupplier(GetModel(), UNO_QUERY);
+ if(xDrawPagesSupplier.is())
+ {
+ mxDocDrawPages = mxDocDrawPages.query( xDrawPagesSupplier->getDrawPages() );
+ if(mxDocDrawPages.is())
+ {
+ mnDocDrawPageCount = mxDocDrawPages->getCount();
+ maDrawPagesStyleNames.insert( maDrawPagesStyleNames.begin(), mnDocDrawPageCount, aEmpty );
+ maDrawNotesPagesStyleNames.insert( maDrawNotesPagesStyleNames.begin(), mnDocDrawPageCount, aEmpty );
+ if( !mbIsDraw )
+ maDrawPagesAutoLayoutNames.realloc( mnDocDrawPageCount + 1 );
+
+ HeaderFooterPageSettingsImpl aEmptySettings;
+ maDrawPagesHeaderFooterSettings.insert( maDrawPagesHeaderFooterSettings.begin(), mnDocDrawPageCount, aEmptySettings );
+ maDrawNotesPagesHeaderFooterSettings.insert( maDrawNotesPagesHeaderFooterSettings.begin(), mnDocDrawPageCount, aEmptySettings );
+ }
+ }
+
+ // #82003# count all draw objects for use with progress bar.
+ // #88245# init mnObjectCount once, use counter itself as flag. It
+ // is initialized to 0.
+ if(!mnObjectCount)
+ {
+ if( IsImpress() )
+ {
+ // #91587# add handout master count
+ Reference<presentation::XHandoutMasterSupplier> xHandoutSupp(GetModel(), UNO_QUERY);
+ if(xHandoutSupp.is())
+ {
+ Reference<XDrawPage> xHandoutPage(xHandoutSupp->getHandoutMasterPage());
+ if(xHandoutPage.is())
+ {
+ Reference<drawing::XShapes> xShapes(xHandoutPage, UNO_QUERY);
+ if(xShapes.is() && xShapes->getCount())
+ {
+ mnObjectCount += ImpRecursiveObjectCount(xShapes);
+ }
+ }
+ }
+ }
+
+ if(mxDocMasterPages.is())
+ {
+ for(sal_Int32 a(0); a < mnDocMasterPageCount; a++)
+ {
+ Any aAny(mxDocMasterPages->getByIndex(a));
+ Reference< drawing::XShapes > xMasterPage;
+
+ if((aAny >>= xMasterPage) && xMasterPage.is())
+ {
+ mnObjectCount += ImpRecursiveObjectCount(xMasterPage);
+ }
+
+ if( IsImpress() )
+ {
+ // #91587# take notes pages from master pages into account
+ Reference<presentation::XPresentationPage> xPresPage;
+ if((aAny >>= xPresPage) && xPresPage.is())
+ {
+ Reference<XDrawPage> xNotesPage(xPresPage->getNotesPage());
+ if(xNotesPage.is())
+ {
+ Reference<drawing::XShapes> xShapes(xNotesPage, UNO_QUERY);
+ if(xShapes.is() && xShapes->getCount())
+ {
+ mnObjectCount += ImpRecursiveObjectCount(xShapes);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if(mxDocDrawPages.is())
+ {
+ for(sal_Int32 a(0); a < mnDocDrawPageCount; a++)
+ {
+ Any aAny(mxDocDrawPages->getByIndex(a));
+ Reference< drawing::XShapes > xPage;
+
+ if((aAny >>= xPage) && xPage.is())
+ {
+ mnObjectCount += ImpRecursiveObjectCount(xPage);
+ }
+
+ if( IsImpress() )
+ {
+ // #91587# take notes pages from draw pages into account
+ Reference<presentation::XPresentationPage> xPresPage;
+ if((aAny >>= xPresPage) && xPresPage.is())
+ {
+ Reference<XDrawPage> xNotesPage(xPresPage->getNotesPage());
+ if(xNotesPage.is())
+ {
+ Reference<drawing::XShapes> xShapes(xNotesPage, UNO_QUERY);
+ if(xShapes.is() && xShapes->getCount())
+ {
+ mnObjectCount += ImpRecursiveObjectCount(xShapes);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // #82003# init progress bar
+ GetProgressBarHelper()->SetReference(mnObjectCount);
+ }
+
+ // add namespaces
+ _GetNamespaceMap().Add(
+ GetXMLToken(XML_NP_PRESENTATION),
+ GetXMLToken(XML_N_PRESENTATION),
+ XML_NAMESPACE_PRESENTATION);
+
+ _GetNamespaceMap().Add(
+ GetXMLToken(XML_NP_SMIL),
+ GetXMLToken(XML_N_SMIL_COMPAT),
+ XML_NAMESPACE_SMIL);
+
+ _GetNamespaceMap().Add(
+ GetXMLToken(XML_NP_ANIMATION),
+ GetXMLToken(XML_N_ANIMATION),
+ XML_NAMESPACE_ANIMATION);
+
+ if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 )
+ {
+ _GetNamespaceMap().Add(
+ GetXMLToken(XML_NP_OFFICE_EXT),
+ GetXMLToken(XML_N_OFFICE_EXT),
+ XML_NAMESPACE_OFFICE_EXT);
+
+ _GetNamespaceMap().Add(
+ GetXMLToken(XML_NP_DRAW_EXT),
+ GetXMLToken(XML_N_DRAW_EXT),
+ XML_NAMESPACE_DRAW_EXT);
+ }
+
+ GetShapeExport()->enableLayerExport();
+
+ // #88546# enable progress bar increments
+ GetShapeExport()->enableHandleProgressBar();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// #82003# helper function for recursive object count
+sal_uInt32 SdXMLExport::ImpRecursiveObjectCount(Reference< drawing::XShapes > xShapes)
+{
+ sal_uInt32 nRetval(0L);
+
+ if(xShapes.is())
+ {
+ sal_Int32 nCount = xShapes->getCount();
+
+ for(sal_Int32 a(0L); a < nCount; a++)
+ {
+ Any aAny(xShapes->getByIndex(a));
+ Reference< drawing::XShapes > xGroup;
+
+ if((aAny >>= xGroup) && xGroup.is())
+ {
+ // #93180# count group objects, too.
+ nRetval += 1 + ImpRecursiveObjectCount(xGroup);
+ }
+ else
+ {
+ nRetval++;
+ }
+ }
+ }
+
+ return nRetval;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLExport::~SdXMLExport()
+{
+ // cleanup factory, decrease refcount. Should lead to destruction.
+ if(mpSdPropHdlFactory)
+ {
+ mpSdPropHdlFactory->release();
+ mpSdPropHdlFactory = 0L;
+ }
+
+ // cleanup mapper, decrease refcount. Should lead to destruction.
+ if(mpPropertySetMapper)
+ {
+ mpPropertySetMapper->release();
+ mpPropertySetMapper = 0L;
+ }
+
+ // cleanup presPage mapper, decrease refcount. Should lead to destruction.
+ if(mpPresPagePropsMapper)
+ {
+ mpPresPagePropsMapper->release();
+ mpPresPagePropsMapper = 0L;
+ }
+
+ // clear evtl. temporary page master infos
+ if(mpPageMasterUsageList)
+ {
+ // note: all items in this list are also in mpPageMasterInfoList
+ delete mpPageMasterUsageList;
+ mpPageMasterUsageList = 0L;
+ }
+
+ if(mpNotesPageMasterUsageList)
+ {
+ // note: all items in this list are also in mpPageMasterInfoList
+ delete mpNotesPageMasterUsageList;
+ mpNotesPageMasterUsageList = 0L;
+ }
+
+ if(mpPageMasterInfoList)
+ {
+ for ( size_t i = 0, n = mpPageMasterInfoList->size(); i < n; ++i )
+ delete mpPageMasterInfoList->at( i );
+ mpPageMasterInfoList->clear();
+ delete mpPageMasterInfoList;
+ mpPageMasterInfoList = 0L;
+ }
+
+ // clear auto-layout infos
+ if(mpAutoLayoutInfoList)
+ {
+ for ( size_t i = 0, n = mpAutoLayoutInfoList->size(); i < n; ++i )
+ delete mpAutoLayoutInfoList->at( i );
+ mpAutoLayoutInfoList->clear();
+ delete mpAutoLayoutInfoList;
+ mpAutoLayoutInfoList = 0L;
+ }
+
+// #82003# status indicator stop is called exclusively
+// from SdXMLFilter::Export() now.
+//
+// stop progress view
+// if(GetStatusIndicator().is())
+// {
+// GetStatusIndicator()->end();
+// GetStatusIndicator()->reset();
+// }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// to get default values in XPropertySet use this wrapper class
+
+class ImpDefaultMapper : public ::cppu::WeakAggImplHelper1< beans::XPropertySet >
+{
+ Reference< beans::XPropertyState > mxState;
+ Reference< beans::XPropertySet > mxSet;
+
+public:
+ ImpDefaultMapper( Reference< beans::XPropertyState >& rxState );
+
+ // Methods
+ virtual Reference< beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException);
+ virtual Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
+
+ // empty implementations
+ virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const Reference< beans::XPropertyChangeListener >& xListener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const Reference< beans::XPropertyChangeListener >& aListener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const Reference< beans::XVetoableChangeListener >& aListener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const Reference< beans::XVetoableChangeListener >& aListener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
+};
+
+ImpDefaultMapper::ImpDefaultMapper( Reference< beans::XPropertyState >& rxState )
+: mxState( rxState ),
+ mxSet( rxState, UNO_QUERY )
+{
+}
+
+Reference< beans::XPropertySetInfo > SAL_CALL ImpDefaultMapper::getPropertySetInfo() throw(uno::RuntimeException)
+{
+ return mxSet->getPropertySetInfo();
+}
+
+void SAL_CALL ImpDefaultMapper::setPropertyValue( const OUString& aPropertyName, const Any& /*aValue*/ ) throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ mxState->setPropertyToDefault( aPropertyName /*, aValue */ );
+}
+
+Any SAL_CALL ImpDefaultMapper::getPropertyValue( const OUString& PropertyName ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ return mxState->getPropertyDefault( PropertyName );
+}
+
+// empty implementations
+void SAL_CALL ImpDefaultMapper::addPropertyChangeListener( const OUString&, const Reference< beans::XPropertyChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+void SAL_CALL ImpDefaultMapper::removePropertyChangeListener( const OUString&, const Reference< beans::XPropertyChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+void SAL_CALL ImpDefaultMapper::addVetoableChangeListener( const OUString&, const Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+void SAL_CALL ImpDefaultMapper::removeVetoableChangeListener( const OUString&, const Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLExport::ImpPrepAutoLayoutInfos()
+{
+ if(IsImpress())
+ {
+ OUString aStr;
+
+ Reference< presentation::XHandoutMasterSupplier > xHandoutSupp( GetModel(), UNO_QUERY );
+ if( xHandoutSupp.is() )
+ {
+ Reference< XDrawPage > xHandoutPage( xHandoutSupp->getHandoutMasterPage() );
+ if( xHandoutPage.is() )
+ {
+ if(ImpPrepAutoLayoutInfo(xHandoutPage, aStr))
+ maDrawPagesAutoLayoutNames[0] = aStr;
+ }
+ }
+
+ // prepare name creation
+ for (sal_Int32 nCnt = 0; nCnt < mnDocDrawPageCount; nCnt++)
+ {
+ Any aAny(mxDocDrawPages->getByIndex(nCnt));
+ Reference<XDrawPage> xDrawPage;
+
+ if((aAny >>= xDrawPage) && xDrawPage.is())
+ {
+ if(ImpPrepAutoLayoutInfo(xDrawPage, aStr))
+ maDrawPagesAutoLayoutNames[nCnt+1] = aStr;
+ }
+ }
+ }
+}
+
+sal_Bool SdXMLExport::ImpPrepAutoLayoutInfo(const Reference<XDrawPage>& xPage, OUString& rName)
+{
+ rName = OUString();
+ sal_Bool bRetval(sal_False);
+
+ Reference <beans::XPropertySet> xPropSet(xPage, UNO_QUERY);
+ if(xPropSet.is())
+ {
+ sal_uInt16 nType = sal_uInt16();
+ Any aAny;
+
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Layout")));
+ if(aAny >>= nType)
+ {
+ if(ImpXMLAutoLayoutInfo::IsCreateNecessary(nType))
+ {
+ ImpXMLEXPPageMasterInfo* pInfo = 0L;
+
+ // get master-page info
+ Reference < drawing::XMasterPageTarget > xMasterPageInt(xPage, UNO_QUERY);
+ if(xMasterPageInt.is())
+ {
+ Reference<XDrawPage> xUsedMasterPage(xMasterPageInt->getMasterPage());
+ if(xUsedMasterPage.is())
+ {
+ Reference < container::XNamed > xMasterNamed(xUsedMasterPage, UNO_QUERY);
+ if(xMasterNamed.is())
+ {
+ OUString sMasterPageName = xMasterNamed->getName();
+ pInfo = ImpGetPageMasterInfoByName(sMasterPageName);
+ }
+ }
+ }
+
+ // create entry and look for existance
+ ImpXMLAutoLayoutInfo* pNew = new ImpXMLAutoLayoutInfo(nType, pInfo);
+ sal_Bool bDidExist(sal_False);
+
+ for( size_t nCnt = 0; !bDidExist && nCnt < mpAutoLayoutInfoList->size(); nCnt++)
+ {
+ if( *mpAutoLayoutInfoList->at( nCnt ) == *pNew)
+ {
+ delete pNew;
+ pNew = mpAutoLayoutInfoList->at( nCnt );
+ bDidExist = sal_True;
+ }
+ }
+
+ if(!bDidExist)
+ {
+ mpAutoLayoutInfoList->push_back( pNew );
+ OUString sNewName = OUString(RTL_CONSTASCII_USTRINGPARAM("AL"));
+ sNewName += OUString::valueOf(sal_Int32( mpAutoLayoutInfoList->size() - 1 ));
+ sNewName += OUString(RTL_CONSTASCII_USTRINGPARAM("T"));
+ sNewName += OUString::valueOf(sal_Int32(nType));
+ pNew->SetLayoutName(sNewName);
+ }
+
+ rName = pNew->GetLayoutName();
+ bRetval = sal_True;
+ }
+ }
+ }
+
+ return bRetval;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLExport::ImpWriteAutoLayoutInfos()
+{
+ if( !mpAutoLayoutInfoList->empty() )
+ {
+ for(size_t nCnt = 0; nCnt < mpAutoLayoutInfoList->size(); nCnt++)
+ {
+ ImpXMLAutoLayoutInfo* pInfo = mpAutoLayoutInfoList->at( nCnt );
+ if(pInfo)
+ {
+ // prepare presentation-page layout attributes, style-name
+ AddAttribute(XML_NAMESPACE_STYLE, XML_NAME, pInfo->GetLayoutName());
+
+ // write draw-style attributes
+ SvXMLElementExport aDSE(*this, XML_NAMESPACE_STYLE, XML_PRESENTATION_PAGE_LAYOUT, sal_True, sal_True);
+
+ // write presentation placeholders
+ switch(pInfo->GetLayoutType())
+ {
+ case 0 : // AUTOLAYOUT_TITLE
+ {
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderSubtitle, pInfo->GetPresRectangle());
+ break;
+ }
+ case 1 : // AUTOLAYOUT_ENUM
+ {
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, pInfo->GetPresRectangle());
+ break;
+ }
+ case 2 : // AUTOLAYOUT_CHART
+ {
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart, pInfo->GetPresRectangle());
+ break;
+ }
+ case 3 : // AUTOLAYOUT_2TEXT
+ {
+ Rectangle aLeft(pInfo->GetPresRectangle());
+ aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
+ Rectangle aRight(aLeft);
+ aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
+
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight);
+ break;
+ }
+ case 4 : // AUTOLAYOUT_TEXTCHART
+ {
+ Rectangle aLeft(pInfo->GetPresRectangle());
+ aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
+ Rectangle aRight(aLeft);
+ aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
+
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart, aRight);
+ break;
+ }
+ case 6 : // AUTOLAYOUT_TEXTCLIP
+ {
+ Rectangle aLeft(pInfo->GetPresRectangle());
+ aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
+ Rectangle aRight(aLeft);
+ aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
+
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aRight);
+ break;
+ }
+ case 7 : // AUTOLAYOUT_CHARTTEXT
+ {
+ Rectangle aLeft(pInfo->GetPresRectangle());
+ aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
+ Rectangle aRight(aLeft);
+ aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
+
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart, aLeft);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight);
+ break;
+ }
+ case 8 : // AUTOLAYOUT_TAB
+ {
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTable, pInfo->GetPresRectangle());
+ break;
+ }
+ case 9 : // AUTOLAYOUT_CLIPTEXT
+ {
+ Rectangle aLeft(pInfo->GetPresRectangle());
+ aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
+ Rectangle aRight(aLeft);
+ aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
+
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aLeft);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight);
+ break;
+ }
+ case 10 : // AUTOLAYOUT_TEXTOBJ
+ {
+ Rectangle aLeft(pInfo->GetPresRectangle());
+ aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
+ Rectangle aRight(aLeft);
+ aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
+
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aRight);
+ break;
+ }
+ case 11 : // AUTOLAYOUT_OBJ
+ {
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, pInfo->GetPresRectangle());
+ break;
+ }
+ case 12 : // AUTOLAYOUT_TEXT2OBJ
+ {
+ Rectangle aLeft(pInfo->GetPresRectangle());
+ aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
+ Rectangle aRightTop(aLeft);
+ aRightTop.Left() = long(aRightTop.Left() + aRightTop.GetWidth() * 1.05);
+ aRightTop.setHeight(long(aRightTop.GetHeight() * 0.477));
+ Rectangle aRightBottom(aRightTop);
+ aRightBottom.Top() = long(aRightBottom.Top() + aRightBottom.GetHeight() * 1.095);
+
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aRightTop);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aRightBottom);
+ break;
+ }
+ case 13 : // AUTOLAYOUT_OBJTEXT
+ {
+ Rectangle aLeft(pInfo->GetPresRectangle());
+ aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
+ Rectangle aRight(aLeft);
+ aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
+
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aLeft);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight);
+ break;
+ }
+ case 14 : // AUTOLAYOUT_OBJOVERTEXT
+ {
+ Rectangle aTop(pInfo->GetPresRectangle());
+ aTop.setHeight(long(aTop.GetHeight() * 0.477));
+ Rectangle aBottom(aTop);
+ aBottom.Top() = long(aBottom.Top() + aBottom.GetHeight() * 1.095);
+
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTop);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aBottom);
+ break;
+ }
+ case 15 : // AUTOLAYOUT_2OBJTEXT
+ {
+ Rectangle aLeftTop(pInfo->GetPresRectangle());
+ aLeftTop.setWidth(long(aLeftTop.GetWidth() * 0.488));
+ Rectangle aRight(aLeftTop);
+ aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
+ aLeftTop.setHeight(long(aLeftTop.GetHeight() * 0.477));
+ Rectangle aLeftBottom(aLeftTop);
+ aLeftBottom.Top() = long(aLeftBottom.Top() + aLeftBottom.GetHeight() * 1.095);
+
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aLeftTop);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aLeftBottom);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight);
+ break;
+ }
+ case 16 : // AUTOLAYOUT_2OBJOVERTEXT
+ {
+ Rectangle aTopLeft(pInfo->GetPresRectangle());
+ aTopLeft.setHeight(long(aTopLeft.GetHeight() * 0.477));
+ Rectangle aBottom(aTopLeft);
+ aBottom.Top() = long(aBottom.Top() + aBottom.GetHeight() * 1.095);
+ aTopLeft.setWidth(long(aTopLeft.GetWidth() * 0.488));
+ Rectangle aTopRight(aTopLeft);
+ aTopRight.Left() = long(aTopRight.Left() + aTopRight.GetWidth() * 1.05);
+
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTopLeft);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTopRight);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aBottom);
+ break;
+ }
+ case 17 : // AUTOLAYOUT_TEXTOVEROBJ
+ {
+ Rectangle aTop(pInfo->GetPresRectangle());
+ aTop.setHeight(long(aTop.GetHeight() * 0.477));
+ Rectangle aBottom(aTop);
+ aBottom.Top() = long(aBottom.Top() + aBottom.GetHeight() * 1.095);
+
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aTop);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aBottom);
+ break;
+ }
+ case 18 : // AUTOLAYOUT_4OBJ
+ {
+ Rectangle aTopLeft(pInfo->GetPresRectangle());
+ aTopLeft.setHeight(long(aTopLeft.GetHeight() * 0.477));
+ aTopLeft.setWidth(long(aTopLeft.GetWidth() * 0.488));
+ Rectangle aBottomLeft(aTopLeft);
+ aBottomLeft.Top() = long(aBottomLeft.Top() + aBottomLeft.GetHeight() * 1.095);
+ Rectangle aTopRight(aTopLeft);
+ aTopRight.Left() = long(aTopRight.Left() + aTopRight.GetWidth() * 1.05);
+ Rectangle aBottomRight(aTopRight);
+ aBottomRight.Top() = long(aBottomRight.Top() + aBottomRight.GetHeight() * 1.095);
+
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTopLeft);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTopRight);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aBottomLeft);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aBottomRight);
+ break;
+ }
+ case 19 : // AUTOLAYOUT_ONLY_TITLE
+ {
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ break;
+ }
+ case 21 : // AUTOLAYOUT_NOTES
+ {
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderPage, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderNotes, pInfo->GetPresRectangle());
+ break;
+ }
+ case 22 : // AUTOLAYOUT_HANDOUT1
+ case 23 : // AUTOLAYOUT_HANDOUT2
+ case 24 : // AUTOLAYOUT_HANDOUT3
+ case 25 : // AUTOLAYOUT_HANDOUT4
+ case 26 : // AUTOLAYOUT_HANDOUT6
+ case 31 : // AUTOLAYOUT_HANDOUT9
+ {
+ sal_Int32 nColCnt, nRowCnt;
+ sal_Int32 nGapX = pInfo->GetGapX();
+ sal_Int32 nGapY = pInfo->GetGapY();
+
+ switch(pInfo->GetLayoutType())
+ {
+ case 22 : nColCnt = 1; nRowCnt = 1; break;
+ case 23 : nColCnt = 1; nRowCnt = 2; break;
+ case 24 : nColCnt = 1; nRowCnt = 3; break;
+ case 25 : nColCnt = 2; nRowCnt = 2; break;
+ case 26 : nColCnt = 3; nRowCnt = 2; break;
+ case 31 : nColCnt = 3; nRowCnt = 3; break;
+ default: nColCnt = 0; nRowCnt = 0; break; // FIXME - What is correct values?
+ }
+
+ Size aPartSize(pInfo->GetTitleRectangle().GetSize());
+ Point aPartPos(pInfo->GetTitleRectangle().TopLeft());
+
+ if(aPartSize.Width() > aPartSize.Height())
+ {
+ sal_Int32 nZwi(nColCnt);
+ nColCnt = nRowCnt;
+ nRowCnt = nZwi;
+ }
+
+ aPartSize.Width() = (aPartSize.Width() - ((nColCnt - 1) * nGapX)) / nColCnt;
+ aPartSize.Height() = (aPartSize.Height() - ((nRowCnt - 1) * nGapY)) / nRowCnt;
+
+ Point aTmpPos(aPartPos);
+
+ for (sal_Int32 a = 0; a < nRowCnt; a++)
+ {
+ aTmpPos.X() = aPartPos.X();
+
+ for (sal_Int32 b = 0; b < nColCnt; b++)
+ {
+ Rectangle aTmpRect(aTmpPos, aPartSize);
+
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderHandout, aTmpRect);
+ aTmpPos.X() += aPartSize.Width() + nGapX;
+ }
+
+ aTmpPos.Y() += aPartSize.Height() + nGapY;
+ }
+ break;
+ }
+ case 27 : // AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART
+ {
+ Rectangle aTop(pInfo->GetPresRectangle());
+ aTop.setHeight(long(aTop.GetHeight() * 0.488));
+ Rectangle aBottom(aTop);
+ aBottom.Top() = long(aBottom.Top() + aBottom.GetHeight() * 1.05);
+
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline, aTop);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart, aBottom);
+ break;
+ }
+ case 28 : // AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE
+ {
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline, pInfo->GetPresRectangle());
+ break;
+ }
+ case 29 : // AUTOLAYOUT_TITLE_VERTICAL_OUTLINE
+ {
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline, pInfo->GetPresRectangle());
+ break;
+ }
+ case 30 : // AUTOLAYOUT_TITLE_VERTICAL_OUTLINE_CLIPART
+ {
+ Rectangle aLeft(pInfo->GetPresRectangle());
+ aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
+ Rectangle aRight(aLeft);
+ aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
+
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aLeft);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline, aRight);
+ break;
+ }
+ case 32 : // AUTOLAYOUT_TITLE
+ {
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderSubtitle, pInfo->GetPresRectangle());
+ break;
+ }
+
+ case 33 : // AUTOLAYOUT_4CLIPART
+ {
+ Rectangle aTopLeft(pInfo->GetPresRectangle());
+ aTopLeft.setHeight(long(aTopLeft.GetHeight() * 0.477));
+ aTopLeft.setWidth(long(aTopLeft.GetWidth() * 0.488));
+ Rectangle aBottomLeft(aTopLeft);
+ aBottomLeft.Top() = long(aBottomLeft.Top() + aBottomLeft.GetHeight() * 1.095);
+ Rectangle aTopRight(aTopLeft);
+ aTopRight.Left() = long(aTopRight.Left() + aTopRight.GetWidth() * 1.05);
+ Rectangle aBottomRight(aTopRight);
+ aBottomRight.Top() = long(aBottomRight.Top() + aBottomRight.GetHeight() * 1.095);
+
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopLeft);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopRight);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomLeft);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomRight);
+ break;
+ }
+
+ case 34 : // AUTOLAYOUT_6CLIPART
+ {
+ Rectangle aTopLeft(pInfo->GetPresRectangle());
+ aTopLeft.setHeight(long(aTopLeft.GetHeight() * 0.477));
+ aTopLeft.setWidth(long(aTopLeft.GetWidth() * 0.322));
+ Rectangle aTopCenter(aTopLeft);
+ aTopCenter.Left() = long(aTopCenter.Left() + aTopCenter.GetWidth() * 1.05);
+ Rectangle aTopRight(aTopLeft);
+ aTopRight.Left() = long(aTopRight.Left() + aTopRight.GetWidth() * 2 * 1.05);
+
+ Rectangle aBottomLeft(aTopLeft);
+ aBottomLeft.Top() = long(aBottomLeft.Top() + aBottomLeft.GetHeight() * 1.095);
+ Rectangle aBottomCenter(aTopCenter);
+ aBottomCenter.Top() = long(aBottomCenter.Top() + aBottomCenter.GetHeight() * 1.095);
+ Rectangle aBottomRight(aTopRight);
+ aBottomRight.Top() = long(aBottomRight.Top() + aBottomRight.GetHeight() * 1.095);
+
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopLeft);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopCenter);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopRight);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomLeft);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomCenter);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomRight);
+ break;
+ }
+ default:
+ {
+ OSL_FAIL("XMLEXP: unknown autolayout export");
+ break;
+ }
+ }
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLExport::ImpWriteAutoLayoutPlaceholder(XmlPlaceholder ePl, const Rectangle& rRect)
+{
+ OUString aStr;
+ OUStringBuffer sStringBuffer;
+
+ // prepare presentation-placeholder attributes, presentation:object
+ switch(ePl)
+ {
+ case XmlPlaceholderTitle: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("title")); break;
+ case XmlPlaceholderOutline: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("outline")); break;
+ case XmlPlaceholderSubtitle: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("subtitle")); break;
+ case XmlPlaceholderText: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("text")); break;
+ case XmlPlaceholderGraphic: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("graphic")); break;
+ case XmlPlaceholderObject: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("object")); break;
+ case XmlPlaceholderChart: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("chart")); break;
+ case XmlPlaceholderOrgchart: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("orgchart")); break;
+ case XmlPlaceholderTable: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("table")); break;
+ case XmlPlaceholderPage: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("page")); break;
+ case XmlPlaceholderNotes: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("notes")); break;
+ case XmlPlaceholderHandout: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("handout")); break;
+ case XmlPlaceholderVerticalTitle: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("vertical_title")); break;
+ case XmlPlaceholderVerticalOutline: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("vertical_outline")); break;
+ }
+
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_OBJECT, aStr);
+
+ // svg:x,y,width,height
+ GetMM100UnitConverter().convertMeasure(sStringBuffer, rRect.Left());
+ aStr = sStringBuffer.makeStringAndClear();
+ AddAttribute(XML_NAMESPACE_SVG, XML_X, aStr);
+
+ GetMM100UnitConverter().convertMeasure(sStringBuffer, rRect.Top());
+ aStr = sStringBuffer.makeStringAndClear();
+ AddAttribute(XML_NAMESPACE_SVG, XML_Y, aStr);
+
+ GetMM100UnitConverter().convertMeasure(sStringBuffer, rRect.GetWidth());
+ aStr = sStringBuffer.makeStringAndClear();
+ AddAttribute(XML_NAMESPACE_SVG, XML_WIDTH, aStr);
+
+ GetMM100UnitConverter().convertMeasure(sStringBuffer, rRect.GetHeight());
+ aStr = sStringBuffer.makeStringAndClear();
+ AddAttribute(XML_NAMESPACE_SVG, XML_HEIGHT, aStr);
+
+ // write presentation-placeholder
+ SvXMLElementExport aPPL(*this, XML_NAMESPACE_PRESENTATION, XML_PLACEHOLDER, sal_True, sal_True);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+ImpXMLEXPPageMasterInfo* SdXMLExport::ImpGetOrCreatePageMasterInfo( Reference< XDrawPage > xMasterPage )
+{
+ bool bDoesExist = false;
+
+ ImpXMLEXPPageMasterInfo* pNewInfo = new ImpXMLEXPPageMasterInfo(*this, xMasterPage);
+
+ // compare with prev page-master infos
+ for( size_t a = 0; !bDoesExist && a < mpPageMasterInfoList->size(); a++)
+ {
+ if ( mpPageMasterInfoList->at(a)
+ && *mpPageMasterInfoList->at(a) == *pNewInfo
+ )
+ {
+ delete pNewInfo;
+ pNewInfo = mpPageMasterInfoList->at(a);
+ bDoesExist = true;
+ }
+ }
+ // add entry when not found same page-master infos
+ if(!bDoesExist)
+ mpPageMasterInfoList->push_back( pNewInfo );
+
+ return pNewInfo;
+}
+
+void SdXMLExport::ImpPrepPageMasterInfos()
+{
+ if( IsImpress() )
+ {
+ // create page master info for handout master page
+
+ Reference< XHandoutMasterSupplier > xHMS( GetModel(), UNO_QUERY );
+ if( xHMS.is() )
+ {
+ Reference< XDrawPage > xMasterPage( xHMS->getHandoutMasterPage() );
+ if( xMasterPage.is() )
+ mpHandoutPageMaster = ImpGetOrCreatePageMasterInfo(xMasterPage);
+ }
+ }
+
+ // create page master infos for master pages
+ if(mnDocMasterPageCount)
+ {
+ // look for needed page-masters, create these
+ for (sal_Int32 nMPageId = 0; nMPageId < mnDocMasterPageCount; nMPageId++)
+ {
+ Reference< XDrawPage > xMasterPage( mxDocMasterPages->getByIndex(nMPageId), UNO_QUERY );
+ ImpXMLEXPPageMasterInfo* pNewInfo = 0L;
+
+ if(xMasterPage.is())
+ pNewInfo = ImpGetOrCreatePageMasterInfo(xMasterPage);
+
+ mpPageMasterUsageList->push_back( pNewInfo );
+
+ // look for page master of handout page
+ if(IsImpress())
+ {
+ pNewInfo = NULL;
+ Reference< presentation::XPresentationPage > xPresPage(xMasterPage, UNO_QUERY);
+ if(xPresPage.is())
+ {
+ Reference< XDrawPage > xNotesPage(xPresPage->getNotesPage());
+ if(xNotesPage.is())
+ {
+ pNewInfo = ImpGetOrCreatePageMasterInfo(xNotesPage);
+ }
+ }
+ mpNotesPageMasterUsageList->push_back( pNewInfo );
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLExport::ImpWritePageMasterInfos()
+{
+ // write created page-masters, create names for these
+ for( size_t nCnt = 0; nCnt < mpPageMasterInfoList->size(); nCnt++)
+ {
+ ImpXMLEXPPageMasterInfo* pInfo = mpPageMasterInfoList->at(nCnt);
+ if(pInfo)
+ {
+ // create name
+ OUString sNewName = OUString(RTL_CONSTASCII_USTRINGPARAM("PM"));
+
+ sNewName += OUString::valueOf((sal_Int32)nCnt);
+ pInfo->SetName(sNewName);
+
+ // prepare page-master attributes
+ OUString sString;
+ OUStringBuffer sStringBuffer;
+
+ sString = sNewName;
+ AddAttribute(XML_NAMESPACE_STYLE, XML_NAME, sString);
+
+ // write page-layout
+ SvXMLElementExport aPME(*this, XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT, sal_True, sal_True);
+
+ // prepare style:properties inside page-master
+ GetMM100UnitConverter().convertMeasure(sStringBuffer, pInfo->GetBorderTop());
+ sString = sStringBuffer.makeStringAndClear();
+ AddAttribute(XML_NAMESPACE_FO, XML_MARGIN_TOP, sString);
+
+ GetMM100UnitConverter().convertMeasure(sStringBuffer, pInfo->GetBorderBottom());
+ sString = sStringBuffer.makeStringAndClear();
+ AddAttribute(XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, sString);
+
+ GetMM100UnitConverter().convertMeasure(sStringBuffer, pInfo->GetBorderLeft());
+ sString = sStringBuffer.makeStringAndClear();
+ AddAttribute(XML_NAMESPACE_FO, XML_MARGIN_LEFT, sString);
+
+ GetMM100UnitConverter().convertMeasure(sStringBuffer, pInfo->GetBorderRight());
+ sString = sStringBuffer.makeStringAndClear();
+ AddAttribute(XML_NAMESPACE_FO, XML_MARGIN_RIGHT, sString);
+
+ GetMM100UnitConverter().convertMeasure(sStringBuffer, pInfo->GetWidth());
+ sString = sStringBuffer.makeStringAndClear();
+ AddAttribute(XML_NAMESPACE_FO, XML_PAGE_WIDTH, sString);
+
+ GetMM100UnitConverter().convertMeasure(sStringBuffer, pInfo->GetHeight());
+ sString = sStringBuffer.makeStringAndClear();
+ AddAttribute(XML_NAMESPACE_FO, XML_PAGE_HEIGHT, sString);
+
+ if(pInfo->GetOrientation() == view::PaperOrientation_PORTRAIT)
+ AddAttribute(XML_NAMESPACE_STYLE, XML_PRINT_ORIENTATION, XML_PORTRAIT);
+ else
+ AddAttribute(XML_NAMESPACE_STYLE, XML_PRINT_ORIENTATION, XML_LANDSCAPE);
+
+ // write style:properties
+ SvXMLElementExport aPMF(*this, XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_PROPERTIES, sal_True, sal_True);
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+ImpXMLEXPPageMasterInfo* SdXMLExport::ImpGetPageMasterInfoByName(const OUString& rName)
+{
+ if(rName.getLength() && !mpPageMasterInfoList->empty())
+ {
+ for( size_t nCnt = 0; nCnt < mpPageMasterInfoList->size(); nCnt++)
+ {
+ ImpXMLEXPPageMasterInfo* pInfo = mpPageMasterInfoList->at(nCnt);
+ if(pInfo)
+ {
+ if(pInfo->GetMasterPageName().getLength() && rName.equals(pInfo->GetMasterPageName()))
+ {
+ return pInfo;
+ }
+ }
+ }
+ }
+ return 0L;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLExport::ImpPrepDrawPageInfos()
+{
+ // create draw:style-name entries for page export
+ // containing presentation page attributes AND background attributes
+ // fixed family for page-styles is "drawing-page" (XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME)
+
+ sal_Int32 nCnt;
+ for(nCnt = 0; nCnt < mnDocDrawPageCount; nCnt++)
+ {
+ Reference<XDrawPage> xDrawPage;
+ mxDocDrawPages->getByIndex(nCnt) >>= xDrawPage;
+ maDrawPagesStyleNames[nCnt] = ImpCreatePresPageStyleName( xDrawPage );
+
+ Reference< presentation::XPresentationPage > xPresPage(xDrawPage, UNO_QUERY);
+ if(xPresPage.is())
+ {
+ maDrawNotesPagesStyleNames[nCnt] = ImpCreatePresPageStyleName( xPresPage->getNotesPage(), false );
+
+ maDrawPagesHeaderFooterSettings[nCnt] = ImpPrepDrawPageHeaderFooterDecls( xDrawPage );
+ maDrawNotesPagesHeaderFooterSettings[nCnt] = ImpPrepDrawPageHeaderFooterDecls( xPresPage->getNotesPage() );
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+static OUString findOrAppendImpl( std::vector< OUString >& rVector, const OUString& rText, const sal_Char* pPrefix )
+{
+ // search rVector if there is already a string that equals rText
+ std::vector< OUString >::iterator aIter;
+ sal_Int32 nIndex;
+ for( nIndex = 1, aIter = rVector.begin(); aIter != rVector.end(); ++aIter, ++nIndex )
+ {
+ if( (*aIter) == rText )
+ break;
+ }
+
+ // if nothing is found, append the string at the end of rVector
+ if( aIter == rVector.end() )
+ rVector.push_back( rText );
+
+ // create a reference string with pPrefix and the index of the
+ // found or created rText
+ OUString aStr( OUString::createFromAscii( pPrefix ) );
+ aStr += OUString::valueOf( nIndex );
+ return aStr;
+}
+
+static OUString findOrAppendImpl( std::vector< DateTimeDeclImpl >& rVector, const OUString& rText, sal_Bool bFixed, sal_Int32 nFormat, const sal_Char* pPrefix )
+{
+ // search rVector if there is already a DateTimeDeclImpl with rText,bFixed and nFormat
+ std::vector< DateTimeDeclImpl >::iterator aIter;
+ sal_Int32 nIndex;
+ for( nIndex = 1, aIter = rVector.begin(); aIter != rVector.end(); ++aIter, ++nIndex )
+ {
+ const DateTimeDeclImpl& rDecl = (*aIter);
+ if( (rDecl.mbFixed == bFixed ) &&
+ (!bFixed || rDecl.maStrText == rText) &&
+ (bFixed || (rDecl.mnFormat == nFormat) ) )
+ break;
+ }
+
+ // if nothing is found, append a new DateTimeDeclImpl
+ if( aIter == rVector.end() )
+ {
+ DateTimeDeclImpl aDecl;
+ aDecl.maStrText = rText;
+ aDecl.mbFixed = bFixed;
+ aDecl.mnFormat = nFormat;
+ rVector.push_back( aDecl );
+ }
+
+ // create a reference string with pPrefix and the index of the
+ // found or created DateTimeDeclImpl
+ OUString aStr( OUString::createFromAscii( pPrefix ) );
+ aStr += OUString::valueOf( nIndex );
+ return aStr;
+
+}
+
+static const sal_Char* gpStrHeaderTextPrefix = "hdr";
+static const sal_Char* gpStrFooterTextPrefix = "ftr";
+static const sal_Char* gpStrDateTimeTextPrefix = "dtd";
+
+HeaderFooterPageSettingsImpl SdXMLExport::ImpPrepDrawPageHeaderFooterDecls( const Reference<XDrawPage>& xDrawPage )
+{
+ HeaderFooterPageSettingsImpl aSettings;
+
+ if( xDrawPage.is() ) try
+ {
+ Reference< XPropertySet > xSet( xDrawPage, UNO_QUERY_THROW );
+ Reference< XPropertySetInfo > xInfo( xSet->getPropertySetInfo() );
+
+ OUString aStrText;
+
+ const OUString aStrHeaderTextProp( RTL_CONSTASCII_USTRINGPARAM( "HeaderText" ) );
+ if( xInfo->hasPropertyByName( aStrHeaderTextProp ) )
+ {
+ xSet->getPropertyValue( aStrHeaderTextProp ) >>= aStrText;
+ if( aStrText.getLength() )
+ aSettings.maStrHeaderDeclName = findOrAppendImpl( maHeaderDeclsVector, aStrText, gpStrHeaderTextPrefix );
+ }
+
+ const OUString aStrFooterTextProp( RTL_CONSTASCII_USTRINGPARAM( "FooterText" ) );
+ if( xInfo->hasPropertyByName( aStrFooterTextProp ) )
+ {
+ xSet->getPropertyValue( aStrFooterTextProp ) >>= aStrText;
+ if( aStrText.getLength() )
+ aSettings.maStrFooterDeclName = findOrAppendImpl( maFooterDeclsVector, aStrText, gpStrFooterTextPrefix );
+ }
+
+ const OUString aStrDateTimeTextProp( RTL_CONSTASCII_USTRINGPARAM( "DateTimeText" ) );
+ if( xInfo->hasPropertyByName( aStrDateTimeTextProp ) )
+ {
+ sal_Bool bFixed = false;
+ sal_Int32 nFormat = 0;
+ xSet->getPropertyValue( aStrDateTimeTextProp ) >>= aStrText;
+ xSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsDateTimeFixed" ) ) ) >>= bFixed;
+ xSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "DateTimeFormat" ) ) ) >>= nFormat;
+
+ if( !bFixed || aStrText.getLength() )
+ {
+ aSettings.maStrDateTimeDeclName = findOrAppendImpl( maDateTimeDeclsVector, aStrText, bFixed, nFormat, gpStrDateTimeTextPrefix );
+ if( !bFixed )
+ addDataStyle( nFormat );
+ }
+ }
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ OSL_FAIL( "SdXMLExport::ImpPrepDrawPageHeaderFooterDecls(), unexpected exception cought!" );
+ }
+
+ return aSettings;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLExport::ImpWriteHeaderFooterDecls()
+{
+ OUStringBuffer sBuffer;
+
+ if( !maHeaderDeclsVector.empty() )
+ {
+ // export header decls
+ const OUString aPrefix( OUString::createFromAscii( gpStrHeaderTextPrefix ) );
+ std::vector< OUString >::iterator aIter;
+ sal_Int32 nIndex;
+ for( nIndex = 1, aIter = maHeaderDeclsVector.begin(); aIter != maHeaderDeclsVector.end(); ++aIter, ++nIndex )
+ {
+ sBuffer.append( aPrefix );
+ sBuffer.append( nIndex );
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_NAME, sBuffer.makeStringAndClear());
+
+ SvXMLElementExport aElem(*this, XML_NAMESPACE_PRESENTATION, XML_HEADER_DECL, sal_True, sal_True);
+ Characters((*aIter));
+ }
+ }
+
+ if( !maFooterDeclsVector.empty() )
+ {
+ // export footer decls
+ const OUString aPrefix( OUString::createFromAscii( gpStrFooterTextPrefix ) );
+ std::vector< OUString >::iterator aIter;
+ sal_Int32 nIndex;
+ for( nIndex = 1, aIter = maFooterDeclsVector.begin(); aIter != maFooterDeclsVector.end(); ++aIter, ++nIndex )
+ {
+ sBuffer.append( aPrefix );
+ sBuffer.append( nIndex );
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_NAME, sBuffer.makeStringAndClear());
+
+ SvXMLElementExport aElem(*this, XML_NAMESPACE_PRESENTATION, XML_FOOTER_DECL, sal_False, sal_False);
+ Characters((*aIter));
+ }
+ }
+
+ if( !maDateTimeDeclsVector.empty() )
+ {
+ // export footer decls
+ const OUString aPrefix( OUString::createFromAscii( gpStrDateTimeTextPrefix ) );
+ std::vector< DateTimeDeclImpl >::iterator aIter;
+ sal_Int32 nIndex;
+ for( nIndex = 1, aIter = maDateTimeDeclsVector.begin(); aIter != maDateTimeDeclsVector.end(); ++aIter, ++nIndex )
+ {
+ const DateTimeDeclImpl& rDecl = (*aIter);
+
+ sBuffer.append( aPrefix );
+ sBuffer.append( nIndex );
+ AddAttribute( XML_NAMESPACE_PRESENTATION, XML_NAME, sBuffer.makeStringAndClear());
+
+ AddAttribute( XML_NAMESPACE_PRESENTATION, XML_SOURCE, rDecl.mbFixed ? XML_FIXED : XML_CURRENT_DATE );
+
+ if( !rDecl.mbFixed )
+ AddAttribute( XML_NAMESPACE_STYLE, XML_DATA_STYLE_NAME, getDataStyleName( rDecl.mnFormat ) );
+
+ SvXMLElementExport aElem(*this, XML_NAMESPACE_PRESENTATION, XML_DATE_TIME_DECL, sal_False, sal_False);
+ if( rDecl.mbFixed )
+ Characters(rDecl.maStrText);
+ }
+ }
+}
+
+void SdXMLExport::ImplExportHeaderFooterDeclAttributes( const HeaderFooterPageSettingsImpl& aSettings )
+{
+ if( aSettings.maStrHeaderDeclName.getLength() )
+ AddAttribute( XML_NAMESPACE_PRESENTATION, XML_USE_HEADER_NAME, aSettings.maStrHeaderDeclName );
+
+ if( aSettings.maStrFooterDeclName.getLength() )
+ AddAttribute( XML_NAMESPACE_PRESENTATION, XML_USE_FOOTER_NAME, aSettings.maStrFooterDeclName );
+
+ if( aSettings.maStrDateTimeDeclName.getLength() )
+ AddAttribute( XML_NAMESPACE_PRESENTATION, XML_USE_DATE_TIME_NAME, aSettings.maStrDateTimeDeclName );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+OUString SdXMLExport::ImpCreatePresPageStyleName( Reference<XDrawPage> xDrawPage, bool bExportBackground /* = true */ )
+{
+ // create name
+ OUString sStyleName;
+
+ // create style for this page and add to auto style pool
+
+ Reference< beans::XPropertySet > xPropSet1(xDrawPage, UNO_QUERY);
+ if(xPropSet1.is())
+ {
+ Reference< beans::XPropertySet > xPropSet;
+
+ if( bExportBackground )
+ {
+ // since the background items are in a different propertyset
+ // which itself is a property of the pages property set
+ // we now merge these two propertysets if possible to simulate
+ // a single propertyset with all draw page properties
+ const OUString aBackground(RTL_CONSTASCII_USTRINGPARAM("Background"));
+ Reference< beans::XPropertySet > xPropSet2;
+ Reference< beans::XPropertySetInfo > xInfo( xPropSet1->getPropertySetInfo() );
+ if( xInfo.is() && xInfo->hasPropertyByName( aBackground ) )
+ {
+ Any aAny( xPropSet1->getPropertyValue( aBackground ) );
+ aAny >>= xPropSet2;
+ }
+
+ if( xPropSet2.is() )
+ xPropSet = PropertySetMerger_CreateInstance( xPropSet1, xPropSet2 );
+ else
+ xPropSet = xPropSet1;
+ }
+ else
+ {
+ xPropSet = xPropSet1;
+ }
+
+ const UniReference< SvXMLExportPropertyMapper > aMapperRef( GetPresPagePropsMapper() );
+
+ std::vector< XMLPropertyState > xPropStates( aMapperRef->Filter( xPropSet ) );
+
+ if( !xPropStates.empty() )
+ {
+ // there are filtered properties -> hard attributes
+ // try to find this style in AutoStylePool
+ sStyleName = GetAutoStylePool()->Find(XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID, sStyleName, xPropStates);
+
+ if(!sStyleName.getLength())
+ {
+ // Style did not exist, add it to AutoStalePool
+ sStyleName = GetAutoStylePool()->Add(XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID, sStyleName, xPropStates);
+ }
+ }
+ }
+
+ return sStyleName;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLExport::ImpPrepMasterPageInfos()
+{
+ // create draw:style-name entries for master page export
+ // containing only background attributes
+ // fixed family for page-styles is "drawing-page" (XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME)
+
+ sal_Int32 nCnt;
+ for( nCnt = 0; nCnt < mnDocMasterPageCount; nCnt++)
+ {
+ Reference<XDrawPage> xDrawPage;
+ mxDocMasterPages->getByIndex(nCnt) >>= xDrawPage;
+ maMasterPagesStyleNames[nCnt] = ImpCreatePresPageStyleName( xDrawPage );
+ }
+
+ if( IsImpress() )
+ {
+ Reference< presentation::XHandoutMasterSupplier > xHandoutSupp( GetModel(), UNO_QUERY );
+ if( xHandoutSupp.is() )
+ {
+ Reference< XDrawPage > xHandoutPage( xHandoutSupp->getHandoutMasterPage() );
+ if( xHandoutPage.is() )
+ {
+ maHandoutPageHeaderFooterSettings = ImpPrepDrawPageHeaderFooterDecls( xHandoutPage );
+ maHandoutMasterStyleName = ImpCreatePresPageStyleName( xHandoutPage, false );
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+void SdXMLExport::ImpWritePresentationStyles()
+{
+ if(IsImpress())
+ {
+ for (sal_Int32 nCnt = 0; nCnt < mnDocMasterPageCount; nCnt++)
+ {
+ Any aAny(mxDocMasterPages->getByIndex(nCnt));
+ Reference<container::XNamed> xNamed;
+
+ if(aAny >>= xNamed)
+ {
+ // write presentation styles (ONLY if presentation)
+ if(IsImpress() && mxDocStyleFamilies.is() && xNamed.is())
+ {
+ XMLStyleExport aStEx(*this, OUString(), GetAutoStylePool().get());
+ const UniReference< SvXMLExportPropertyMapper > aMapperRef( GetPropertySetMapper() );
+
+ OUString aPrefix( xNamed->getName() );
+
+ aPrefix += OUString(RTL_CONSTASCII_USTRINGPARAM("-"));
+ aStEx.exportStyleFamily(xNamed->getName(),
+ OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_PRESENTATION_NAME)),
+ aMapperRef, sal_False,
+ XML_STYLE_FAMILY_SD_PRESENTATION_ID, &aPrefix);
+ }
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLExport::SetProgress(sal_Int32 nProg)
+{
+ // set progress view
+ if(GetStatusIndicator().is())
+ GetStatusIndicator()->setValue(nProg);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// #82003#
+
+void SdXMLExport::_ExportMeta()
+{
+ uno::Sequence<beans::NamedValue> stats(1);
+ stats[0] = beans::NamedValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ObjectCount" )),
+ uno::makeAny(mnObjectCount));
+
+ // update document statistics at the model
+ uno::Reference<document::XDocumentPropertiesSupplier> xPropSup(GetModel(),
+ uno::UNO_QUERY_THROW);
+ uno::Reference<document::XDocumentProperties> xDocProps(
+ xPropSup->getDocumentProperties());
+ if (xDocProps.is()) {
+ xDocProps->setDocumentStatistics(stats);
+ }
+
+ // call parent
+ SvXMLExport::_ExportMeta();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLExport::_ExportContent()
+{
+ // export <pres:header-decl>, <pres:footer-decl> and <pres:date-time-decl> elements
+ ImpWriteHeaderFooterDecls();
+
+ // page export
+ for(sal_Int32 nPageInd(0); nPageInd < mnDocDrawPageCount; nPageInd++)
+ {
+ uno::Reference<drawing::XDrawPage> xDrawPage( mxDocDrawPages->getByIndex(nPageInd), uno::UNO_QUERY );
+
+ SetProgress(((nPageInd + 1) * 100) / mnDocDrawPageCount);
+
+ if(xDrawPage.is())
+ {
+ // prepare page attributes, name of page
+ Reference < container::XNamed > xNamed(xDrawPage, UNO_QUERY);
+ if(xNamed.is())
+ AddAttribute(XML_NAMESPACE_DRAW, XML_NAME, xNamed->getName());
+
+ // draw:style-name (presentation page attributes AND background attributes)
+ if( maDrawPagesStyleNames[nPageInd].getLength() )
+ AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME,
+ maDrawPagesStyleNames[nPageInd]);
+
+ // draw:master-page-name
+ Reference < drawing::XMasterPageTarget > xMasterPageInt(xDrawPage, UNO_QUERY);
+ if(xMasterPageInt.is())
+ {
+ Reference<XDrawPage> xUsedMasterPage(xMasterPageInt->getMasterPage());
+ if(xUsedMasterPage.is())
+ {
+ Reference < container::XNamed > xMasterNamed(xUsedMasterPage, UNO_QUERY);
+ if(xMasterNamed.is())
+ {
+ AddAttribute(XML_NAMESPACE_DRAW, XML_MASTER_PAGE_NAME,
+ EncodeStyleName( xMasterNamed->getName()) );
+ }
+ }
+ }
+
+ // presentation:page-layout-name
+ if( IsImpress() && maDrawPagesAutoLayoutNames[nPageInd+1].getLength())
+ {
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_PRESENTATION_PAGE_LAYOUT_NAME, maDrawPagesAutoLayoutNames[nPageInd+1] );
+ }
+
+ Reference< beans::XPropertySet > xProps( xDrawPage, UNO_QUERY );
+ if( xProps.is() )
+ {
+ try
+ {
+ OUString aBookmarkURL;
+ xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "BookmarkURL" ) ) ) >>= aBookmarkURL;
+
+ if( aBookmarkURL.getLength() )
+ {
+ sal_Int32 nIndex = aBookmarkURL.lastIndexOf( (sal_Unicode)'#' );
+ if( nIndex != -1 )
+ {
+ OUString aFileName( aBookmarkURL.copy( 0, nIndex ) );
+ OUString aBookmarkName( aBookmarkURL.copy( nIndex+1 ) );
+
+ aBookmarkURL = GetRelativeReference( aFileName );
+ aBookmarkURL += String( '#' );
+ aBookmarkURL += aBookmarkName;
+ }
+
+ AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, aBookmarkURL);
+ AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_REPLACE );
+ AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONREQUEST );
+ }
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL(" no \"BookmarkURL\" property at page?" );
+ }
+ }
+
+ if( IsImpress() )
+ ImplExportHeaderFooterDeclAttributes( maDrawPagesHeaderFooterSettings[nPageInd] );
+
+
+ OUString sNavigationOrder( getNavigationOrder( xDrawPage ) );
+ if( sNavigationOrder.getLength() != 0 )
+ AddAttribute ( XML_NAMESPACE_DRAW, XML_NAV_ORDER, sNavigationOrder );
+
+ UniReference< xmloff::AnimationsExporter > xAnimationsExporter;
+ uno::Reference< ::com::sun::star::animations::XAnimationNodeSupplier > xAnimNodeSupplier;
+
+ // prepare animation export
+ if(IsImpress())
+ {
+ if( getExportFlags() & EXPORT_OASIS )
+ {
+ // export new animations for oasis format
+ xAnimNodeSupplier.set( xDrawPage, UNO_QUERY );
+
+ // prepare animations exporter if impress
+ if(xAnimNodeSupplier.is())
+ {
+ xAnimationsExporter = new xmloff::AnimationsExporter( *this, xProps );
+ xAnimationsExporter->prepare( xAnimNodeSupplier->getAnimationNode() );
+ }
+ }
+ else
+ {
+ // export old animations for ooo format
+ UniReference< XMLAnimationsExporter > xAnimExport = new XMLAnimationsExporter( GetShapeExport().get() );
+ GetShapeExport()->setAnimationsExporter( xAnimExport );
+ }
+ }
+
+ // write draw:id
+ const OUString aPageId = getInterfaceToIdentifierMapper().getIdentifier( xDrawPage );
+ if( aPageId.getLength() != 0 )
+ {
+ AddAttributeIdLegacy(XML_NAMESPACE_DRAW, aPageId);
+ }
+
+ // write page
+ SvXMLElementExport aDPG(*this, XML_NAMESPACE_DRAW, XML_PAGE, sal_True, sal_True);
+
+ // write optional office:forms
+ exportFormsElement( xDrawPage );
+
+ // write graphic objects on this page (if any)
+ Reference< drawing::XShapes > xExportShapes(xDrawPage, UNO_QUERY);
+ if(xExportShapes.is() && xExportShapes->getCount())
+ GetShapeExport()->exportShapes( xExportShapes );
+
+ // write animations and presentation notes (ONLY if presentation)
+ if(IsImpress())
+ {
+ if(xAnimNodeSupplier.is())
+ {
+ xAnimationsExporter->exportAnimations( xAnimNodeSupplier->getAnimationNode() );
+ }
+ else
+ {
+ // animations
+ UniReference< XMLAnimationsExporter > xAnimExport( GetShapeExport()->getAnimationsExporter() );
+ if( xAnimExport.is() )
+ xAnimExport->exportAnimations( *this );
+
+ xAnimExport = NULL;
+ GetShapeExport()->setAnimationsExporter( xAnimExport );
+ }
+
+ // presentations
+ Reference< presentation::XPresentationPage > xPresPage(xDrawPage, UNO_QUERY);
+ if(xPresPage.is())
+ {
+ Reference< XDrawPage > xNotesPage(xPresPage->getNotesPage());
+ if(xNotesPage.is())
+ {
+ Reference< drawing::XShapes > xShapes(xNotesPage, UNO_QUERY);
+ if(xShapes.is())
+ {
+ if( maDrawNotesPagesStyleNames[nPageInd].getLength() )
+ AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME, maDrawNotesPagesStyleNames[nPageInd]);
+
+ ImplExportHeaderFooterDeclAttributes( maDrawNotesPagesHeaderFooterSettings[nPageInd] );
+
+ // write presentation notes
+ SvXMLElementExport aPSY(*this, XML_NAMESPACE_PRESENTATION, XML_NOTES, sal_True, sal_True);
+
+ // write optional office:forms
+ exportFormsElement( xNotesPage );
+
+ // write shapes per se
+ GetShapeExport()->exportShapes( xShapes );
+ }
+ }
+ }
+ }
+
+ exportAnnotations( xDrawPage );
+ }
+ }
+
+ if( IsImpress() )
+ exportPresentationSettings();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLExport::exportPresentationSettings()
+{
+ try
+ {
+ Reference< XPresentationSupplier > xPresSupplier( GetModel(), UNO_QUERY );
+ if( !xPresSupplier.is() )
+ return;
+
+ Reference< XPropertySet > xPresProps( xPresSupplier->getPresentation(), UNO_QUERY );
+ if( !xPresProps.is() )
+ return;
+
+ sal_Bool bHasAttr = sal_False;
+
+ sal_Bool bTemp = false;
+
+ // export range
+ xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsShowAll" ) ) ) >>= bTemp;
+ if( !bTemp )
+ {
+ OUString aFirstPage;
+ xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "FirstPage" ) ) ) >>= aFirstPage;
+ if( aFirstPage.getLength() )
+ {
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_START_PAGE, aFirstPage );
+ bHasAttr = sal_True;
+ }
+ else
+ {
+ OUString aCustomShow;
+ xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "CustomShow" ) ) ) >>= aCustomShow;
+ if( aCustomShow.getLength() )
+ {
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_SHOW, aCustomShow );
+ bHasAttr = sal_True;
+ }
+ }
+ }
+
+ xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsEndless" ) ) ) >>= bTemp;
+ if( bTemp )
+ {
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_ENDLESS, XML_TRUE );
+ bHasAttr = sal_True;
+
+ sal_Int32 nPause = 0;
+ xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Pause" ) ) ) >>= nPause;
+
+ util::DateTime aTime( 0, (sal_uInt16)nPause, 0, 0, 0, 0, 0 );
+
+ OUStringBuffer aOut;
+ SvXMLUnitConverter::convertTime( aOut, aTime );
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_PAUSE, aOut.makeStringAndClear() );
+ }
+
+ xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AllowAnimations" ) ) ) >>= bTemp;
+ if( !bTemp )
+ {
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_ANIMATIONS, XML_DISABLED );
+ bHasAttr = sal_True;
+ }
+
+ xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsAlwaysOnTop" ) ) ) >>= bTemp;
+ if( bTemp )
+ {
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_STAY_ON_TOP, XML_TRUE );
+ bHasAttr = sal_True;
+ }
+
+ xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsAutomatic" ) ) ) >>= bTemp;
+ if( bTemp )
+ {
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_FORCE_MANUAL, XML_TRUE );
+ bHasAttr = sal_True;
+ }
+
+ xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFullScreen" ) ) ) >>= bTemp;
+ if( !bTemp )
+ {
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_FULL_SCREEN, XML_FALSE );
+ bHasAttr = sal_True;
+ }
+
+ xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsMouseVisible" ) ) ) >>= bTemp;
+ if( !bTemp )
+ {
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_MOUSE_VISIBLE, XML_FALSE );
+ bHasAttr = sal_True;
+ }
+
+ xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "StartWithNavigator" ) ) ) >>= bTemp;
+ if( bTemp )
+ {
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_START_WITH_NAVIGATOR, XML_TRUE );
+ bHasAttr = sal_True;
+ }
+
+ xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "UsePen" ) ) ) >>= bTemp;
+ if( bTemp )
+ {
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_MOUSE_AS_PEN, XML_TRUE );
+ bHasAttr = sal_True;
+ }
+
+ xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsTransitionOnClick" ) ) ) >>= bTemp;
+ if( !bTemp )
+ {
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_TRANSITION_ON_CLICK, XML_DISABLED );
+ bHasAttr = sal_True;
+ }
+
+ xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsShowLogo" ) ) ) >>= bTemp;
+ if( bTemp )
+ {
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_SHOW_LOGO, XML_TRUE );
+ bHasAttr = sal_True;
+ }
+
+ Reference< container::XNameContainer > xShows;
+ Sequence< OUString > aShowNames;
+ const OUString* pShowNames = NULL;
+ sal_Int32 nShowCount = 0;
+
+ Reference< XCustomPresentationSupplier > xSup( GetModel(), UNO_QUERY );
+ if( xSup.is() )
+ {
+ xShows = xSup->getCustomPresentations();
+ if( xShows.is() )
+ {
+ aShowNames = xShows->getElementNames();
+ pShowNames = aShowNames.getArray();
+ nShowCount = aShowNames.getLength();
+ }
+ }
+
+ if( bHasAttr || nShowCount != 0 )
+ {
+ SvXMLElementExport aSettings(*this, XML_NAMESPACE_PRESENTATION, XML_SETTINGS, sal_True, sal_True);
+
+ if( nShowCount == 0 )
+ return;
+
+ Reference< XIndexContainer > xShow;
+ Reference< XNamed > xPageName;
+
+ OUStringBuffer sTmp;
+
+ for( sal_Int32 nIndex = 0; nIndex < nShowCount; nIndex++, pShowNames++ )
+ {
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_NAME, *pShowNames );
+
+ xShows->getByName( *pShowNames ) >>= xShow;
+ DBG_ASSERT( xShow.is(), "invalid custom show!" );
+ if( !xShow.is() )
+ continue;
+
+ const sal_Int32 nPageCount = xShow->getCount();
+ for( sal_Int32 nPage = 0; nPage < nPageCount; nPage++ )
+ {
+ xShow->getByIndex( nPage ) >>= xPageName;
+
+ if( !xPageName.is() )
+ continue;
+
+ if( sTmp.getLength() != 0 )
+ sTmp.append( sal_Unicode( ',' ) );
+ sTmp.append( xPageName->getName() );
+
+ }
+
+ if( sTmp.getLength() )
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_PAGES, sTmp.makeStringAndClear() );
+
+ SvXMLElementExport aShows(*this, XML_NAMESPACE_PRESENTATION, XML_SHOW, sal_True, sal_True);
+ }
+ }
+ }
+ catch( uno::Exception )
+ {
+ OSL_FAIL( "uno::Exception while exporting <presentation:settings>" );
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLExport::_ExportStyles(sal_Bool bUsed)
+{
+ GetPropertySetMapper()->SetAutoStyles( sal_False );
+
+ // export fill styles
+ SvXMLExport::_ExportStyles( bUsed );
+
+ // write draw:style-name for object graphic-styles
+ GetShapeExport()->ExportGraphicDefaults();
+
+ // do not export in ODF 1.1 or older
+ if( getDefaultVersion() >= SvtSaveOptions::ODFVER_012 )
+ GetShapeExport()->GetShapeTableExport()->exportTableStyles();
+
+ // write presentation styles
+ ImpWritePresentationStyles();
+
+ // prepare draw:auto-layout-name for page export
+ ImpPrepAutoLayoutInfos();
+
+ // write draw:auto-layout-name for page export
+ ImpWriteAutoLayoutInfos();
+
+ Reference< beans::XPropertySet > xInfoSet( getExportInfo() );
+ if( xInfoSet.is() )
+ {
+ Reference< beans::XPropertySetInfo > xInfoSetInfo( xInfoSet->getPropertySetInfo() );
+
+ Any aAny;
+
+ if( xInfoSetInfo->hasPropertyByName( msPageLayoutNames ) )
+ {
+ aAny <<= maDrawPagesAutoLayoutNames;
+ xInfoSet->setPropertyValue( msPageLayoutNames, aAny );
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLExport::_ExportAutoStyles()
+{
+ Reference< beans::XPropertySet > xInfoSet( getExportInfo() );
+ if( xInfoSet.is() )
+ {
+ Reference< beans::XPropertySetInfo > xInfoSetInfo( xInfoSet->getPropertySetInfo() );
+
+ if( xInfoSetInfo->hasPropertyByName( msPageLayoutNames ) )
+ {
+ xInfoSet->getPropertyValue( msPageLayoutNames ) >>= maDrawPagesAutoLayoutNames;
+ }
+ }
+
+ GetPropertySetMapper()->SetAutoStyles( sal_True );
+
+ if( getExportFlags() & EXPORT_STYLES )
+ {
+ // #80012# PageMaster export moved from _ExportStyles
+ // prepare page-master infos
+ ImpPrepPageMasterInfos();
+
+ // write page-master infos
+ ImpWritePageMasterInfos();
+
+ // prepare draw:style-name for master page export
+ ImpPrepMasterPageInfos();
+ }
+
+ if( getExportFlags() & EXPORT_CONTENT )
+ {
+ // prepare draw:style-name for page export
+ ImpPrepDrawPageInfos();
+ }
+
+ // export draw-page styles
+ GetAutoStylePool()->exportXML(
+ XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID
+ , GetDocHandler(),
+ GetMM100UnitConverter(),
+ GetNamespaceMap()
+ );
+
+ if( getExportFlags() & EXPORT_STYLES )
+ {
+ // create auto style infos for shapes on master handout page
+ if( IsImpress() )
+ {
+ Reference< presentation::XHandoutMasterSupplier > xHandoutSupp( GetModel(), UNO_QUERY );
+ if( xHandoutSupp.is() )
+ {
+ Reference< XDrawPage > xHandoutPage( xHandoutSupp->getHandoutMasterPage() );
+ if( xHandoutPage.is() )
+ {
+ Reference< drawing::XShapes > xShapes(xHandoutPage, UNO_QUERY);
+ if(xShapes.is() && xShapes->getCount())
+ GetShapeExport()->collectShapesAutoStyles( xShapes );
+ }
+ }
+ }
+
+ // create auto style infos for objects on master pages
+ for(sal_Int32 nMPageId(0L); nMPageId < mnDocMasterPageCount; nMPageId++)
+ {
+ Reference< XDrawPage > xMasterPage(mxDocMasterPages->getByIndex(nMPageId), UNO_QUERY );
+
+ if( xMasterPage.is() )
+ {
+ // collect layer information
+ GetFormExport()->examineForms( xMasterPage );
+
+ // get MasterPage Name
+ OUString aMasterPageNamePrefix;
+ Reference < container::XNamed > xNamed(xMasterPage, UNO_QUERY);
+ if(xNamed.is())
+ {
+ aMasterPageNamePrefix = xNamed->getName();
+ }
+ if(aMasterPageNamePrefix.getLength())
+ {
+ aMasterPageNamePrefix += OUString(RTL_CONSTASCII_USTRINGPARAM("-"));
+ }
+ GetShapeExport()->setPresentationStylePrefix( aMasterPageNamePrefix );
+
+ Reference< drawing::XShapes > xMasterShapes(xMasterPage, UNO_QUERY);
+ if(xMasterShapes.is() && xMasterShapes->getCount())
+ GetShapeExport()->collectShapesAutoStyles( xMasterShapes );
+
+ if(IsImpress())
+ {
+ Reference< presentation::XPresentationPage > xPresPage(xMasterPage, UNO_QUERY);
+ if(xPresPage.is())
+ {
+ Reference< XDrawPage > xNotesPage(xPresPage->getNotesPage());
+ if(xNotesPage.is())
+ {
+ // collect layer information
+ GetFormExport()->examineForms( xNotesPage );
+
+ Reference< drawing::XShapes > xShapes(xNotesPage, UNO_QUERY);
+ if(xShapes.is() && xShapes->getCount())
+ GetShapeExport()->collectShapesAutoStyles( xShapes );
+ }
+ }
+ }
+ collectAnnotationAutoStyles(xMasterPage);
+ }
+ }
+ }
+
+ if( getExportFlags() & EXPORT_CONTENT )
+ {
+ // prepare animations exporter if impress
+ if(IsImpress() && ((getExportFlags() & EXPORT_OASIS) == 0) )
+ {
+ UniReference< XMLAnimationsExporter > xAnimExport = new XMLAnimationsExporter( GetShapeExport().get() );
+ GetShapeExport()->setAnimationsExporter( xAnimExport );
+ }
+
+ // create auto style infos for objects on pages
+ for(sal_Int32 nPageInd(0); nPageInd < mnDocDrawPageCount; nPageInd++)
+ {
+ Reference<XDrawPage> xDrawPage( mxDocDrawPages->getByIndex(nPageInd), UNO_QUERY );
+ if( xDrawPage.is() )
+ {
+ // collect layer information
+ GetFormExport()->examineForms( xDrawPage );
+
+ // get MasterPage Name
+ OUString aMasterPageNamePrefix;
+ Reference < drawing::XMasterPageTarget > xMasterPageInt(xDrawPage, UNO_QUERY);
+ if(xMasterPageInt.is())
+ {
+ Reference<XDrawPage> xUsedMasterPage(xMasterPageInt->getMasterPage());
+ if(xUsedMasterPage.is())
+ {
+ Reference < container::XNamed > xMasterNamed(xUsedMasterPage, UNO_QUERY);
+ if(xMasterNamed.is())
+ {
+ aMasterPageNamePrefix = xMasterNamed->getName();
+ }
+ }
+ }
+ if(aMasterPageNamePrefix.getLength())
+ {
+ aMasterPageNamePrefix += OUString(RTL_CONSTASCII_USTRINGPARAM("-"));
+ }
+
+ GetShapeExport()->setPresentationStylePrefix( aMasterPageNamePrefix );
+
+ // prepare object infos
+ Reference< drawing::XShapes > xDrawShapes(xDrawPage, UNO_QUERY);
+ if(xDrawShapes.is() && xDrawShapes->getCount())
+ GetShapeExport()->collectShapesAutoStyles( xDrawShapes );
+
+ // prepare presentation notes page object infos (ONLY if presentation)
+ if(IsImpress())
+ {
+ Reference< presentation::XPresentationPage > xPresPage(xDrawPage, UNO_QUERY);
+ if(xPresPage.is())
+ {
+ Reference< XDrawPage > xNotesPage(xPresPage->getNotesPage());
+ if(xNotesPage.is())
+ {
+ // collect layer information
+ GetFormExport()->examineForms( xNotesPage );
+
+ Reference< drawing::XShapes > xShapes(xNotesPage, UNO_QUERY);
+ if(xShapes.is() && xShapes->getCount())
+ GetShapeExport()->collectShapesAutoStyles( xShapes );
+ }
+ }
+ }
+
+ collectAnnotationAutoStyles( xDrawPage );
+ }
+ }
+ if(IsImpress())
+ {
+ UniReference< XMLAnimationsExporter > xAnimExport;
+ GetShapeExport()->setAnimationsExporter( xAnimExport );
+ }
+ }
+
+ exportAutoDataStyles();
+
+ GetShapeExport()->exportAutoStyles();
+
+ sal_uInt16 nContentAutostyles = EXPORT_CONTENT | EXPORT_AUTOSTYLES;
+ if ( ( getExportFlags() & nContentAutostyles ) == nContentAutostyles )
+ GetFormExport()->exportAutoStyles( );
+
+ // ...for text
+ GetTextParagraphExport()->exportTextAutoStyles();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLExport::_ExportMasterStyles()
+{
+ // export layer
+ SdXMLayerExporter::exportLayer( *this );
+
+ // export handout master page if impress
+ if( IsImpress() )
+ {
+ Reference< presentation::XHandoutMasterSupplier > xHandoutSupp( GetModel(), UNO_QUERY );
+ if( xHandoutSupp.is() )
+ {
+ Reference< XDrawPage > xHandoutPage( xHandoutSupp->getHandoutMasterPage() );
+ if( xHandoutPage.is() )
+ {
+ // presentation:page-layout-name
+ if( IsImpress() && maDrawPagesAutoLayoutNames[0].getLength())
+ {
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_PRESENTATION_PAGE_LAYOUT_NAME, EncodeStyleName( maDrawPagesAutoLayoutNames[0] ));
+ }
+
+ ImpXMLEXPPageMasterInfo* pInfo = mpHandoutPageMaster;
+ if(pInfo)
+ {
+ OUString sString = pInfo->GetName();
+ AddAttribute(XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_NAME, sString );
+ }
+
+ // draw:style-name
+ if( maHandoutMasterStyleName.getLength() )
+ AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME, maHandoutMasterStyleName);
+
+ ImplExportHeaderFooterDeclAttributes( maHandoutPageHeaderFooterSettings );
+
+ // write masterpage
+ SvXMLElementExport aMPG(*this, XML_NAMESPACE_STYLE, XML_HANDOUT_MASTER, sal_True, sal_True);
+
+ // write graphic objects on this master page (if any)
+ Reference< drawing::XShapes > xShapes(xHandoutPage, UNO_QUERY);
+ if(xShapes.is() && xShapes->getCount())
+ GetShapeExport()->exportShapes( xShapes );
+ }
+ }
+ }
+
+ // export MasterPages in master-styles section
+ for (sal_Int32 nMPageId = 0; nMPageId < mnDocMasterPageCount; nMPageId++)
+ {
+ Reference< XDrawPage > xMasterPage( mxDocMasterPages->getByIndex(nMPageId), UNO_QUERY );
+ if(xMasterPage.is())
+ {
+ // prepare masterpage attributes
+ OUString sMasterPageName;
+ Reference < container::XNamed > xNamed(xMasterPage, UNO_QUERY);
+ if(xNamed.is())
+ {
+ sal_Bool bEncoded = sal_False;
+ sMasterPageName = xNamed->getName();
+ AddAttribute(XML_NAMESPACE_STYLE, XML_NAME,
+ EncodeStyleName( sMasterPageName, &bEncoded ));
+ if( bEncoded )
+ AddAttribute(
+ XML_NAMESPACE_STYLE, XML_DISPLAY_NAME,
+ sMasterPageName );
+ }
+
+ ImpXMLEXPPageMasterInfo* pInfo = mpPageMasterUsageList->at( nMPageId );
+ if(pInfo)
+ {
+ OUString sString = pInfo->GetName();
+ AddAttribute(XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_NAME, sString );
+ }
+
+ // draw:style-name (background attributes)
+ if( maMasterPagesStyleNames[nMPageId].getLength() )
+ AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME,
+ maMasterPagesStyleNames[nMPageId]);
+
+ // write masterpage
+ SvXMLElementExport aMPG(*this, XML_NAMESPACE_STYLE, XML_MASTER_PAGE, sal_True, sal_True);
+
+ // write optional office:forms
+ exportFormsElement( xMasterPage );
+
+ // write graphic objects on this master page (if any)
+ Reference< drawing::XShapes > xMasterShapes(xMasterPage, UNO_QUERY);
+ if(xMasterShapes.is() && xMasterShapes->getCount())
+ GetShapeExport()->exportShapes( xMasterShapes );
+
+ // write presentation notes (ONLY if presentation)
+ if(IsImpress())
+ {
+ Reference< presentation::XPresentationPage > xPresPage(xMasterPage, UNO_QUERY);
+ if(xPresPage.is())
+ {
+ Reference< XDrawPage > xNotesPage(xPresPage->getNotesPage());
+ if(xNotesPage.is())
+ {
+ Reference< drawing::XShapes > xShapes(xNotesPage, UNO_QUERY);
+ if(xShapes.is())
+ {
+ ImpXMLEXPPageMasterInfo* pMasterInfo = mpNotesPageMasterUsageList->at( nMPageId );
+ if(pMasterInfo)
+ {
+ OUString sString = pMasterInfo->GetName();
+ AddAttribute(XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_NAME, sString);
+ }
+
+ // write presentation notes
+ SvXMLElementExport aPSY(*this, XML_NAMESPACE_PRESENTATION, XML_NOTES, sal_True, sal_True);
+
+ // write optional office:forms
+ exportFormsElement( xNotesPage );
+
+ // write shapes per se
+ GetShapeExport()->exportShapes( xShapes );
+ }
+ }
+ }
+ }
+ exportAnnotations( xMasterPage );
+ }
+ }
+}
+
+void SdXMLExport::exportFormsElement( Reference< XDrawPage > xDrawPage )
+{
+ if( xDrawPage.is() )
+ {
+ Reference< form::XFormsSupplier2 > xFormsSupplier( xDrawPage, UNO_QUERY );
+ if ( xFormsSupplier.is() && xFormsSupplier->hasForms() )
+ {
+ // write masterpage
+ ::xmloff::OOfficeFormsExport aForms(*this);
+ GetFormExport()->exportForms( xDrawPage );
+ }
+
+ if(! GetFormExport()->seekPage( xDrawPage ) )
+ {
+ OSL_FAIL( "OFormLayerXMLExport::seekPage failed!" );
+ }
+ }
+}
+
+void SdXMLExport::GetViewSettings(uno::Sequence<beans::PropertyValue>& rProps)
+{
+ rProps.realloc(4);
+ beans::PropertyValue* pProps = rProps.getArray();
+ if(pProps)
+ {
+ Reference< beans::XPropertySet > xPropSet( GetModel(), UNO_QUERY );
+ if( !xPropSet.is() )
+ return;
+
+ awt::Rectangle aVisArea;
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "VisibleArea" ) ) ) >>= aVisArea;
+
+ sal_uInt16 i = 0;
+ pProps[i].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VisibleAreaTop"));
+ pProps[i++].Value <<= aVisArea.Y;
+ pProps[i].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VisibleAreaLeft"));
+ pProps[i++].Value <<= aVisArea.X;
+ pProps[i].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VisibleAreaWidth"));
+ pProps[i++].Value <<= aVisArea.Width;
+ pProps[i].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VisibleAreaHeight"));
+ pProps[i++].Value <<= aVisArea.Height;
+ }
+}
+
+void SdXMLExport::GetConfigurationSettings(uno::Sequence<beans::PropertyValue>& rProps)
+{
+ Reference< lang::XMultiServiceFactory > xFac( GetModel(), UNO_QUERY );
+ if( xFac.is() )
+ {
+ Reference< beans::XPropertySet > xProps( xFac->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.Settings" ) ) ), UNO_QUERY );
+ if( xProps.is() )
+ SvXMLUnitConverter::convertPropertySet( rProps, xProps );
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLExport::addDataStyle(const sal_Int32 nNumberFormat, sal_Bool bTimeFormat )
+{
+ sal_Int32 nFormat = nNumberFormat;
+ if( (nNumberFormat > 1) && (nNumberFormat <= 0x0f) )
+ nFormat -= 2;
+
+ if( bTimeFormat )
+ {
+ if( maUsedTimeStyles.count( nFormat ) == 0 )
+ maUsedTimeStyles.insert( nFormat );
+ }
+ else
+ {
+ if( maUsedDateStyles.count( nFormat ) == 0 )
+ maUsedDateStyles.insert( nFormat );
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLExport::exportDataStyles()
+{
+ // there are no data styles to export in draw/impress yet
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLExport::exportAutoDataStyles()
+{
+ SdXMLFormatMap::iterator aIter( maUsedDateStyles.begin() );
+ SdXMLFormatMap::iterator aEnd( maUsedDateStyles.end() );
+
+ while( aIter != aEnd )
+ SdXMLNumberStylesExporter::exportDateStyle( *this, (*aIter++) );
+
+ aIter = maUsedTimeStyles.begin();
+ aEnd = maUsedTimeStyles.end();
+ while( aIter != aEnd )
+ SdXMLNumberStylesExporter::exportTimeStyle( *this, (*aIter++) );
+
+ if(HasFormExport())
+ GetFormExport()->exportAutoControlNumberStyles();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+OUString SdXMLExport::getDataStyleName(const sal_Int32 nNumberFormat, sal_Bool bTimeFormat ) const
+{
+ if( bTimeFormat )
+ {
+ return SdXMLNumberStylesExporter::getTimeStyleName( nNumberFormat );
+ }
+ else
+ {
+ return SdXMLNumberStylesExporter::getDateStyleName( nNumberFormat );
+ }
+}
+
+OUString SdXMLExport::getNavigationOrder( const Reference< XDrawPage >& xDrawPage )
+{
+ OUStringBuffer sNavOrder;
+ try
+ {
+ Reference< XPropertySet > xSet( xDrawPage, UNO_QUERY_THROW );
+ Reference< XIndexAccess > xNavOrder( xSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "NavigationOrder" ) ) ), UNO_QUERY_THROW );
+
+ Reference< XIndexAccess > xZOrderAccess( xDrawPage, UNO_QUERY );
+
+ // only export navigation order if it is different from the z-order
+ if( (xNavOrder.get() != xZOrderAccess.get()) && (xNavOrder->getCount() == xDrawPage->getCount()) )
+ {
+ sal_Int32 nIndex;
+ const sal_Int32 nCount = xNavOrder->getCount();
+ for( nIndex = 0; nIndex < nCount; ++nIndex )
+ {
+ OUString sId( getInterfaceToIdentifierMapper().registerReference( Reference< XInterface >( xNavOrder->getByIndex( nIndex ), UNO_QUERY ) ) );
+ if( sId.getLength() != 0 )
+ {
+ if( sNavOrder.getLength() != 0 )
+ sNavOrder.append( (sal_Unicode)' ' );
+ sNavOrder.append( sId );
+ }
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ }
+ return sNavOrder.makeStringAndClear();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLExport::collectAnnotationAutoStyles( const Reference<XDrawPage>& xDrawPage )
+{
+ Reference< XAnnotationAccess > xAnnotationAccess( xDrawPage, UNO_QUERY );
+ if( xAnnotationAccess.is() ) try
+ {
+ Reference< XAnnotationEnumeration > xAnnotationEnumeration( xAnnotationAccess->createAnnotationEnumeration() );
+ if( xAnnotationEnumeration.is() )
+ {
+ while( xAnnotationEnumeration->hasMoreElements() )
+ {
+ Reference< XAnnotation > xAnnotation( xAnnotationEnumeration->nextElement(), UNO_QUERY_THROW );
+ Reference< XText > xText( xAnnotation->getTextRange() );
+ if(xText.is() && xText->getString().getLength())
+ GetTextParagraphExport()->collectTextAutoStyles( xText );
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL("SdXMLExport::collectAnnotationAutoStyles(), exception caught during export of annotation auto styles");
+ }
+}
+
+void SdXMLExport::exportAnnotations( const Reference<XDrawPage>& xDrawPage )
+{
+ // do not export in ODF 1.2 or older
+ if( getDefaultVersion() <= SvtSaveOptions::ODFVER_012 )
+ return;
+
+ Reference< XAnnotationAccess > xAnnotationAccess( xDrawPage, UNO_QUERY );
+ if( xAnnotationAccess.is() ) try
+ {
+ Reference< XAnnotationEnumeration > xAnnotationEnumeration( xAnnotationAccess->createAnnotationEnumeration() );
+ if( xAnnotationEnumeration.is() && xAnnotationEnumeration->hasMoreElements() )
+ {
+ OUStringBuffer sStringBuffer;
+ do
+ {
+ Reference< XAnnotation > xAnnotation( xAnnotationEnumeration->nextElement(), UNO_QUERY_THROW );
+
+ RealPoint2D aPosition( xAnnotation->getPosition() );
+
+ GetMM100UnitConverter().convertMeasure(sStringBuffer, static_cast<sal_Int32>( aPosition.X * 100 ) );
+ AddAttribute(XML_NAMESPACE_SVG, XML_X, sStringBuffer.makeStringAndClear());
+
+ GetMM100UnitConverter().convertMeasure(sStringBuffer, static_cast<sal_Int32>( aPosition.Y * 100 ) );
+ AddAttribute(XML_NAMESPACE_SVG, XML_Y, sStringBuffer.makeStringAndClear());
+
+ RealSize2D aSize( xAnnotation->getSize() );
+
+ if( aSize.Width || aSize.Height )
+ {
+ GetMM100UnitConverter().convertMeasure(sStringBuffer, static_cast<sal_Int32>( aSize.Width * 100 ) );
+ AddAttribute(XML_NAMESPACE_SVG, XML_WIDTH, sStringBuffer.makeStringAndClear());
+ GetMM100UnitConverter().convertMeasure(sStringBuffer, static_cast<sal_Int32>( aSize.Height * 100 ) );
+ AddAttribute(XML_NAMESPACE_SVG, XML_HEIGHT, sStringBuffer.makeStringAndClear());
+ }
+
+ // annotation element + content
+ SvXMLElementExport aElem(*this, XML_NAMESPACE_OFFICE_EXT, XML_ANNOTATION, sal_False, sal_True);
+
+ // author
+ OUString aAuthor( xAnnotation->getAuthor() );
+ if( aAuthor.getLength() )
+ {
+ SvXMLElementExport aCreatorElem( *this, XML_NAMESPACE_DC, XML_CREATOR, sal_True, sal_False );
+ this->Characters(aAuthor);
+ }
+
+ {
+ // date time
+ DateTime aDate( xAnnotation->getDateTime() );
+ GetMM100UnitConverter().convertDateTime(sStringBuffer, aDate, sal_True);
+ SvXMLElementExport aDateElem( *this, XML_NAMESPACE_DC, XML_DATE, sal_True, sal_False );
+ Characters(sStringBuffer.makeStringAndClear());
+ }
+
+ com::sun::star::uno::Reference < com::sun::star::text::XText > xText( xAnnotation->getTextRange() );
+ if( xText.is() )
+ this->GetTextParagraphExport()->exportText( xText );
+ }
+ while( xAnnotationEnumeration->hasMoreElements() );
+ }
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL("SdXMLExport::exportAnnotations(), exception caught during export of annotations");
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+#define SERVICE( classname, servicename, implementationname, draw, flags )\
+uno::Sequence< OUString > SAL_CALL classname##_getSupportedServiceNames() throw()\
+{\
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( servicename ) );\
+ const uno::Sequence< OUString > aSeq( &aServiceName, 1 );\
+ return aSeq;\
+}\
+OUString SAL_CALL classname##_getImplementationName() throw()\
+{\
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( implementationname ) );\
+}\
+uno::Reference< uno::XInterface > SAL_CALL classname##_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )\
+{\
+ return (cppu::OWeakObject*)new SdXMLExport( rSMgr, draw, flags );\
+}
+
+SERVICE( XMLImpressExportOasis, "com.sun.star.comp.Impress.XMLOasisExporter", "XMLImpressExportOasis", sal_False, EXPORT_OASIS|EXPORT_META|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_SETTINGS|EXPORT_FONTDECLS|EXPORT_EMBEDDED );
+SERVICE( XMLImpressStylesExportOasis, "com.sun.star.comp.Impress.XMLOasisStylesExporter", "XMLImpressStylesExportOasis", sal_False, EXPORT_OASIS|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES );
+SERVICE( XMLImpressContentExportOasis, "com.sun.star.comp.Impress.XMLOasisContentExporter", "XMLImpressContentExportOasis", sal_False, EXPORT_OASIS|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS );
+SERVICE( XMLImpressMetaExportOasis, "com.sun.star.comp.Impress.XMLOasisMetaExporter", "XMLImpressMetaExportOasis", sal_False, EXPORT_OASIS|EXPORT_META );
+SERVICE( XMLImpressSettingsExportOasis, "com.sun.star.comp.Impress.XMLOasisSettingsExporter", "XMLImpressSettingsExportOasis", sal_False, EXPORT_OASIS|EXPORT_SETTINGS );
+
+SERVICE( XMLImpressExportOOO, "com.sun.star.comp.Impress.XMLExporter", "XMLImpressExportOOO", sal_False, EXPORT_META|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_SETTINGS|EXPORT_FONTDECLS|EXPORT_EMBEDDED );
+SERVICE( XMLImpressStylesExportOOO, "com.sun.star.comp.Impress.XMLStylesExporter", "XMLImpressStylesExportOOO", sal_False, EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES );
+SERVICE( XMLImpressContentExportOOO, "com.sun.star.comp.Impress.XMLContentExporter", "XMLImpressContentExportOOO", sal_False, EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS );
+SERVICE( XMLImpressMetaExportOOO, "com.sun.star.comp.Impress.XMLMetaExporter", "XMLImpressMetaExportOOO", sal_False, EXPORT_META );
+SERVICE( XMLImpressSettingsExportOOO, "com.sun.star.comp.Impress.XMLSettingsExporter", "XMLImpressSettingsExportOOO", sal_False, EXPORT_SETTINGS );
+
+SERVICE( XMLDrawExportOasis, "com.sun.star.comp.Draw.XMLOasisExporter", "XMLDrawExportOasis", sal_True, EXPORT_OASIS|EXPORT_META|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_SETTINGS|EXPORT_FONTDECLS|EXPORT_EMBEDDED );
+SERVICE( XMLDrawStylesExportOasis, "com.sun.star.comp.Draw.XMLOasisStylesExporter", "XMLDrawStylesExportOasis", sal_True, EXPORT_OASIS|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES );
+SERVICE( XMLDrawContentExportOasis, "com.sun.star.comp.Draw.XMLOasisContentExporter", "XMLDrawContentExportOasis", sal_True, EXPORT_OASIS|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS );
+SERVICE( XMLDrawMetaExportOasis, "com.sun.star.comp.Draw.XMLOasisMetaExporter", "XMLDrawMetaExportOasis", sal_True, EXPORT_OASIS|EXPORT_META );
+SERVICE( XMLDrawSettingsExportOasis, "com.sun.star.comp.Draw.XMLOasisSettingsExporter", "XMLDrawSettingsExportOasis", sal_True, EXPORT_OASIS|EXPORT_SETTINGS );
+
+SERVICE( XMLDrawExportOOO, "com.sun.star.comp.Draw.XMLExporter", "XMLDrawExportOOO", sal_True, EXPORT_META|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_SETTINGS|EXPORT_FONTDECLS|EXPORT_EMBEDDED );
+SERVICE( XMLDrawStylesExportOOO, "com.sun.star.comp.Draw.XMLStylesExporter", "XMLDrawStylesExportOOO", sal_True, EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES );
+SERVICE( XMLDrawContentExportOOO, "com.sun.star.comp.Draw.XMLContentExporter", "XMLDrawContentExportOOO", sal_True, EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS );
+SERVICE( XMLDrawMetaExportOOO, "com.sun.star.comp.Draw.XMLMetaExporter", "XMLDrawMetaExportOOO", sal_True, EXPORT_META );
+SERVICE( XMLDrawSettingsExportOOO, "com.sun.star.comp.Draw.XMLSettingsExporter", "XMLDrawSettingsExportOOO", sal_True, EXPORT_SETTINGS );
+
+SERVICE( XMLDrawingLayerExport, "com.sun.star.comp.DrawingLayer.XMLExporter", "XMLDrawingLayerExport", sal_True, EXPORT_OASIS|EXPORT_STYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_FONTDECLS|EXPORT_EMBEDDED );
+SERVICE( XMLImpressClipboardExport, "com.sun.star.comp.Impress.XMLClipboardExporter", "XMLImpressClipboardExport", sal_False, EXPORT_OASIS|EXPORT_STYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_FONTDECLS|EXPORT_EMBEDDED );
+
+// XServiceInfo
+OUString SAL_CALL SdXMLExport::getImplementationName() throw( uno::RuntimeException )
+{
+ if( IsDraw())
+ {
+ // Draw
+
+ switch( getExportFlags())
+ {
+ case EXPORT_META|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_SETTINGS|EXPORT_FONTDECLS|EXPORT_EMBEDDED:
+ return XMLDrawExportOOO_getImplementationName();
+ case EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES:
+ return XMLDrawStylesExportOOO_getImplementationName();
+ case EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS:
+ return XMLDrawContentExportOOO_getImplementationName();
+ case EXPORT_META:
+ return XMLDrawMetaExportOOO_getImplementationName();
+ case EXPORT_SETTINGS:
+ return XMLDrawSettingsExportOOO_getImplementationName();
+
+ case EXPORT_OASIS|EXPORT_META|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_SETTINGS|EXPORT_FONTDECLS|EXPORT_EMBEDDED:
+ return XMLDrawExportOasis_getImplementationName();
+ case EXPORT_OASIS|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES:
+ return XMLDrawStylesExportOasis_getImplementationName();
+ case EXPORT_OASIS|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS:
+ return XMLDrawContentExportOasis_getImplementationName();
+ case EXPORT_OASIS|EXPORT_META:
+ return XMLDrawMetaExportOasis_getImplementationName();
+ case EXPORT_OASIS|EXPORT_SETTINGS:
+ return XMLDrawSettingsExportOasis_getImplementationName();
+
+ default:
+ return XMLDrawExportOOO_getImplementationName();
+ }
+ }
+ else
+ {
+ // Impress
+
+ switch( getExportFlags())
+ {
+ case EXPORT_META|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_SETTINGS|EXPORT_FONTDECLS|EXPORT_EMBEDDED:
+ return XMLImpressExportOOO_getImplementationName();
+ case EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES:
+ return XMLImpressStylesExportOOO_getImplementationName();
+ case EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS:
+ return XMLImpressContentExportOOO_getImplementationName();
+ case EXPORT_META:
+ return XMLImpressMetaExportOOO_getImplementationName();
+ case EXPORT_SETTINGS:
+ return XMLImpressSettingsExportOOO_getImplementationName();
+ case EXPORT_OASIS|EXPORT_META|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_SETTINGS|EXPORT_FONTDECLS|EXPORT_EMBEDDED:
+ return XMLImpressExportOasis_getImplementationName();
+ case EXPORT_OASIS|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES:
+ return XMLImpressStylesExportOasis_getImplementationName();
+ case EXPORT_OASIS|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS:
+ return XMLImpressContentExportOasis_getImplementationName();
+ case EXPORT_OASIS|EXPORT_META:
+ return XMLImpressMetaExportOasis_getImplementationName();
+ case EXPORT_OASIS|EXPORT_SETTINGS:
+ return XMLImpressSettingsExportOasis_getImplementationName();
+
+ default:
+ return XMLImpressExportOOO_getImplementationName();
+ }
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/sdxmlexp_impl.hxx b/xmloff/source/draw/sdxmlexp_impl.hxx
new file mode 100644
index 000000000000..252c3b267270
--- /dev/null
+++ b/xmloff/source/draw/sdxmlexp_impl.hxx
@@ -0,0 +1,233 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _SDXMLEXP_IMPL_HXX
+#define _SDXMLEXP_IMPL_HXX
+
+#include <xmloff/xmlexp.hxx>
+
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/task/XStatusIndicator.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <comphelper/stl_types.hxx>
+
+#include <vector>
+
+//////////////////////////////////////////////////////////////////////////////
+
+class SvXMLUnitConverter;
+class SvXMLExportItemMapper;
+class SfxPoolItem;
+class SfxItemSet;
+class OUStrings_Impl;
+class OUStringsSort_Impl;
+class Rectangle;
+
+class ImpPresPageDrawStylePropMapper;
+class ImpXMLEXPPageMasterInfo;
+class ImpXMLDrawPageInfoList;
+class ImpXMLAutoLayoutInfo;
+class SvXMLAutoStylePoolP;
+class XMLSdPropHdlFactory;
+class ImpXMLShapeStyleInfo;
+class XMLShapeExportPropertyMapper;
+class XMLPageExportPropertyMapper;
+
+typedef ::std::vector< ImpXMLEXPPageMasterInfo* > ImpXMLEXPPageMasterList;
+typedef ::std::vector< ImpXMLAutoLayoutInfo* > ImpXMLAutoLayoutInfoList;
+
+//////////////////////////////////////////////////////////////////////////////
+
+enum XmlPlaceholder
+{
+ XmlPlaceholderTitle,
+ XmlPlaceholderOutline,
+ XmlPlaceholderSubtitle,
+ XmlPlaceholderText,
+ XmlPlaceholderGraphic,
+ XmlPlaceholderObject,
+ XmlPlaceholderChart,
+ XmlPlaceholderOrgchart,
+ XmlPlaceholderTable,
+ XmlPlaceholderPage,
+ XmlPlaceholderNotes,
+ XmlPlaceholderHandout,
+ XmlPlaceholderVerticalTitle,
+ XmlPlaceholderVerticalOutline
+};
+
+DECLARE_STL_STDKEY_SET( sal_Int32, SdXMLFormatMap );
+
+//////////////////////////////////////////////////////////////////////////////
+
+struct HeaderFooterPageSettingsImpl
+{
+ rtl::OUString maStrHeaderDeclName;
+ rtl::OUString maStrFooterDeclName;
+ rtl::OUString maStrDateTimeDeclName;
+};
+
+struct DateTimeDeclImpl
+{
+ rtl::OUString maStrText;
+ sal_Bool mbFixed;
+ sal_Int32 mnFormat;
+};
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+class SdXMLExport : public SvXMLExport
+{
+ com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > mxDocStyleFamilies;
+ com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > mxDocMasterPages;
+ com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > mxDocDrawPages;
+ sal_Int32 mnDocMasterPageCount;
+ sal_Int32 mnDocDrawPageCount;
+ sal_uInt32 mnShapeStyleInfoIndex;
+ sal_uInt32 mnObjectCount;
+
+ // temporary infos
+ ImpXMLEXPPageMasterList* mpPageMasterInfoList;
+ ImpXMLEXPPageMasterList* mpPageMasterUsageList;
+ ImpXMLEXPPageMasterList* mpNotesPageMasterUsageList;
+ ImpXMLEXPPageMasterInfo* mpHandoutPageMaster;
+ ImpXMLAutoLayoutInfoList* mpAutoLayoutInfoList;
+
+ com::sun::star::uno::Sequence< ::rtl::OUString > maDrawPagesAutoLayoutNames;
+
+ ::std::vector< ::rtl::OUString > maDrawPagesStyleNames;
+ ::std::vector< ::rtl::OUString > maDrawNotesPagesStyleNames;
+ ::std::vector< ::rtl::OUString > maMasterPagesStyleNames;
+ ::rtl::OUString maHandoutMasterStyleName;
+ ::std::vector< HeaderFooterPageSettingsImpl > maDrawPagesHeaderFooterSettings;
+ ::std::vector< HeaderFooterPageSettingsImpl > maDrawNotesPagesHeaderFooterSettings;
+
+ ::std::vector< ::rtl::OUString > maHeaderDeclsVector;
+ ::std::vector< ::rtl::OUString > maFooterDeclsVector;
+ ::std::vector< DateTimeDeclImpl > maDateTimeDeclsVector;
+
+ HeaderFooterPageSettingsImpl maHandoutPageHeaderFooterSettings;
+
+ XMLSdPropHdlFactory* mpSdPropHdlFactory;
+ XMLShapeExportPropertyMapper* mpPropertySetMapper;
+ XMLPageExportPropertyMapper* mpPresPagePropsMapper;
+
+ SdXMLFormatMap maUsedDateStyles; // this is a vector with the used formatings for date fields
+ SdXMLFormatMap maUsedTimeStyles; // this is a vector with the used formatings for time fields
+
+ sal_Bool mbIsDraw;
+ sal_Bool mbFamilyGraphicUsed;
+ sal_Bool mbFamilyPresentationUsed;
+
+ const rtl::OUString msZIndex;
+ const rtl::OUString msEmptyPres;
+ const rtl::OUString msModel;
+ const rtl::OUString msStartShape;
+ const rtl::OUString msEndShape;
+ const rtl::OUString msPageLayoutNames;
+
+ virtual void _ExportStyles(sal_Bool bUsed);
+ virtual void _ExportAutoStyles();
+ virtual void _ExportMasterStyles();
+ virtual void _ExportContent();
+ // #82003#
+ virtual void _ExportMeta();
+
+ ImpXMLEXPPageMasterInfo* ImpGetOrCreatePageMasterInfo( com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > xMasterPage );
+ void ImpPrepPageMasterInfos();
+ void ImpPrepDrawMasterInfos();
+ void ImpWritePageMasterInfos();
+ void ImpPrepAutoLayoutInfos();
+ HeaderFooterPageSettingsImpl ImpPrepDrawPageHeaderFooterDecls( const com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage >& xDrawPage );
+ ImpXMLEXPPageMasterInfo* ImpGetPageMasterInfoByName(const rtl::OUString& rName);
+
+ void ImpPrepDrawPageInfos();
+ void ImpPrepMasterPageInfos();
+ void ImpWritePresentationStyles();
+ ::rtl::OUString ImpCreatePresPageStyleName( com::sun::star::uno::Reference<com::sun::star::drawing::XDrawPage> xDrawPage, bool bExportBackground = true );
+
+ sal_Bool ImpPrepAutoLayoutInfo(const com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage >& xPage, rtl::OUString& rName);
+ void ImpWriteAutoLayoutInfos();
+ void ImpWriteAutoLayoutPlaceholder(XmlPlaceholder ePl, const Rectangle& rRect);
+ void ImpWriteHeaderFooterDecls();
+ void ImplExportHeaderFooterDeclAttributes( const HeaderFooterPageSettingsImpl& aSettings );
+
+ void exportFormsElement( com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > xDrawPage );
+ void exportPresentationSettings();
+
+ // #82003# helper function for recursive object count
+ sal_uInt32 ImpRecursiveObjectCount( com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > xShapes);
+
+ rtl::OUString getNavigationOrder( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xDrawPage );
+
+ void collectAnnotationAutoStyles( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xDrawPage );
+ void exportAnnotations( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xDrawPage );
+
+protected:
+ virtual void GetViewSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps);
+ virtual void GetConfigurationSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps);
+
+public:
+ // #110680#
+ SdXMLExport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ sal_Bool bIsDraw, sal_uInt16 nExportFlags = EXPORT_ALL );
+ virtual ~SdXMLExport();
+
+ void SetProgress(sal_Int32 nProg);
+
+ // XExporter
+ virtual void SAL_CALL setSourceDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ // get factories and mappers
+ XMLSdPropHdlFactory* GetSdPropHdlFactory() const { return mpSdPropHdlFactory; }
+ XMLShapeExportPropertyMapper* GetPropertySetMapper() const { return mpPropertySetMapper; }
+ XMLPageExportPropertyMapper* GetPresPagePropsMapper() const { return mpPresPagePropsMapper; }
+
+ sal_Bool IsDraw() const { return mbIsDraw; }
+ sal_Bool IsImpress() const { return !mbIsDraw; }
+
+ sal_Bool IsFamilyGraphicUsed() const { return mbFamilyGraphicUsed; }
+ void SetFamilyGraphicUsed() { mbFamilyGraphicUsed = sal_True; }
+ sal_Bool IsFamilyPresentationUsed() const { return mbFamilyPresentationUsed; }
+ void SetFamilyPresentationUsed() { mbFamilyPresentationUsed = sal_True; }
+
+ virtual void addDataStyle(const sal_Int32 nNumberFormat, sal_Bool bTimeFormat = sal_False );
+ virtual void exportDataStyles();
+ virtual void exportAutoDataStyles();
+ virtual rtl::OUString getDataStyleName(const sal_Int32 nNumberFormat, sal_Bool bTimeFormat = sal_False ) const;
+
+ // XServiceInfo ( : SvXMLExport )
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
+};
+
+#endif // _SDXMLEXP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/sdxmlimp.cxx b/xmloff/source/draw/sdxmlimp.cxx
new file mode 100644
index 000000000000..bba4b8f40e36
--- /dev/null
+++ b/xmloff/source/draw/sdxmlimp.cxx
@@ -0,0 +1,1091 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <tools/string.hxx>
+
+#include <xmloff/xmlscripti.hxx>
+#include "sdxmlimp_impl.hxx"
+#include "ximpbody.hxx"
+
+#include <xmloff/xmlmetai.hxx>
+#include "ximpstyl.hxx"
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/DocumentSettingsContext.hxx>
+#include <com/sun/star/form/XFormsSupplier.hpp>
+#include <com/sun/star/task/XStatusIndicatorSupplier.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include "sdpropls.hxx"
+#include <xmloff/xmlexppr.hxx>
+#include "xmloff/xmlerror.hxx"
+#include <tools/debug.hxx>
+#include <com/sun/star/style/XStyle.hpp>
+
+#include <xmloff/XMLFontStylesContext.hxx>
+
+#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+//////////////////////////////////////////////////////////////////////////////
+
+
+
+
+
+
+
+
+
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+class SdXMLBodyContext_Impl : public SvXMLImportContext
+{
+ const SdXMLImport& GetSdImport() const
+ { return (const SdXMLImport&)GetImport(); }
+ SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
+
+public:
+
+ SdXMLBodyContext_Impl( SdXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList );
+ virtual ~SdXMLBodyContext_Impl();
+
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList );
+};
+
+SdXMLBodyContext_Impl::SdXMLBodyContext_Impl( SdXMLImport& rImport,
+ sal_uInt16 nPrfx, const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList > & ) :
+ SvXMLImportContext( rImport, nPrfx, rLName )
+{
+}
+
+SdXMLBodyContext_Impl::~SdXMLBodyContext_Impl()
+{
+}
+
+SvXMLImportContext *SdXMLBodyContext_Impl::CreateChildContext(
+ sal_uInt16 /*nPrefix*/,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList )
+{
+ return GetSdImport().CreateBodyContext(rLocalName, xAttrList);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+// NB: virtually inherit so we can multiply inherit properly
+// in SdXMLFlatDocContext_Impl
+class SdXMLDocContext_Impl : public virtual SvXMLImportContext
+{
+protected:
+ const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
+ SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
+
+public:
+ SdXMLDocContext_Impl(
+ SdXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList);
+ virtual ~SdXMLDocContext_Impl();
+
+ TYPEINFO();
+
+ virtual SvXMLImportContext *CreateChildContext(sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList);
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLDocContext_Impl::SdXMLDocContext_Impl(
+ SdXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference<xml::sax::XAttributeList>&)
+: SvXMLImportContext(rImport, nPrfx, rLName)
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLDocContext_Impl::~SdXMLDocContext_Impl()
+{
+}
+
+TYPEINIT1( SdXMLDocContext_Impl, SvXMLImportContext );
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLImportContext *SdXMLDocContext_Impl::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList)
+{
+ SvXMLImportContext* pContext = 0L;
+
+ const SvXMLTokenMap& rTokenMap = GetSdImport().GetDocElemTokenMap();
+ switch(rTokenMap.Get(nPrefix, rLocalName))
+ {
+ case XML_TOK_DOC_FONTDECLS:
+ {
+ pContext = GetSdImport().CreateFontDeclsContext( rLocalName, xAttrList );
+ break;
+ }
+ case XML_TOK_DOC_SETTINGS:
+ {
+ if( GetImport().getImportFlags() & IMPORT_SETTINGS )
+ {
+ pContext = new XMLDocumentSettingsContext(GetImport(), nPrefix, rLocalName, xAttrList );
+ }
+ break;
+ }
+ case XML_TOK_DOC_STYLES:
+ {
+ if( GetImport().getImportFlags() & IMPORT_STYLES )
+ {
+ // office:styles inside office:document
+ pContext = GetSdImport().CreateStylesContext(rLocalName, xAttrList);
+ }
+ break;
+ }
+ case XML_TOK_DOC_AUTOSTYLES:
+ {
+ if( GetImport().getImportFlags() & IMPORT_AUTOSTYLES )
+ {
+ // office:automatic-styles inside office:document
+ pContext = GetSdImport().CreateAutoStylesContext(rLocalName, xAttrList);
+ }
+ break;
+ }
+ case XML_TOK_DOC_MASTERSTYLES:
+ {
+ if( GetImport().getImportFlags() & IMPORT_MASTERSTYLES )
+ {
+ // office:master-styles inside office:document
+ pContext = GetSdImport().CreateMasterStylesContext(rLocalName, xAttrList);
+ }
+ break;
+ }
+ case XML_TOK_DOC_META:
+ {
+ DBG_WARNING("XML_TOK_DOC_META: should not have come here, maybe document is invalid?");
+ break;
+ }
+ case XML_TOK_DOC_SCRIPT:
+ {
+ if( GetImport().getImportFlags() & IMPORT_SCRIPTS )
+ {
+ // office:script inside office:document
+ pContext = GetSdImport().CreateScriptContext( rLocalName );
+ }
+ break;
+ }
+ case XML_TOK_DOC_BODY:
+ {
+ if( GetImport().getImportFlags() & IMPORT_CONTENT )
+ {
+ // office:body inside office:document
+ pContext = new SdXMLBodyContext_Impl(GetSdImport(),nPrefix,
+ rLocalName, xAttrList);
+ }
+ break;
+ }
+ }
+
+ // call parent when no own context was created
+ if(!pContext)
+ pContext = SvXMLImportContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
+
+ return pContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+// context for flat file xml format
+class SdXMLFlatDocContext_Impl
+ : public SdXMLDocContext_Impl, public SvXMLMetaDocumentContext
+{
+public:
+ SdXMLFlatDocContext_Impl( SdXMLImport& i_rImport,
+ sal_uInt16 i_nPrefix, const OUString & i_rLName,
+ const uno::Reference<xml::sax::XAttributeList>& i_xAttrList,
+ const uno::Reference<document::XDocumentProperties>& i_xDocProps,
+ const uno::Reference<xml::sax::XDocumentHandler>& i_xDocBuilder);
+
+ virtual ~SdXMLFlatDocContext_Impl();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 i_nPrefix, const OUString& i_rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& i_xAttrList);
+};
+
+SdXMLFlatDocContext_Impl::SdXMLFlatDocContext_Impl( SdXMLImport& i_rImport,
+ sal_uInt16 i_nPrefix, const OUString & i_rLName,
+ const uno::Reference<xml::sax::XAttributeList>& i_xAttrList,
+ const uno::Reference<document::XDocumentProperties>& i_xDocProps,
+ const uno::Reference<xml::sax::XDocumentHandler>& i_xDocBuilder) :
+ SvXMLImportContext(i_rImport, i_nPrefix, i_rLName),
+ SdXMLDocContext_Impl(i_rImport, i_nPrefix, i_rLName, i_xAttrList),
+ SvXMLMetaDocumentContext(i_rImport, i_nPrefix, i_rLName,
+ i_xDocProps, i_xDocBuilder)
+{
+}
+
+SdXMLFlatDocContext_Impl::~SdXMLFlatDocContext_Impl() { }
+
+SvXMLImportContext *SdXMLFlatDocContext_Impl::CreateChildContext(
+ sal_uInt16 i_nPrefix, const OUString& i_rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& i_xAttrList)
+{
+ // behave like meta base class iff we encounter office:meta
+ const SvXMLTokenMap& rTokenMap = GetSdImport().GetDocElemTokenMap();
+ if ( XML_TOK_DOC_META == rTokenMap.Get( i_nPrefix, i_rLocalName ) ) {
+ return SvXMLMetaDocumentContext::CreateChildContext(
+ i_nPrefix, i_rLocalName, i_xAttrList );
+ } else {
+ return SdXMLDocContext_Impl::CreateChildContext(
+ i_nPrefix, i_rLocalName, i_xAttrList );
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+#define SERVICE(classname,servicename,implementationname,draw,flags)\
+uno::Sequence< OUString > SAL_CALL classname##_getSupportedServiceNames() throw()\
+{\
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( servicename ) );\
+ const uno::Sequence< OUString > aSeq( &aServiceName, 1 );\
+ return aSeq;\
+}\
+OUString SAL_CALL classname##_getImplementationName() throw()\
+{\
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( implementationname ) );\
+}\
+uno::Reference< uno::XInterface > SAL_CALL classname##_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )\
+{\
+ return (cppu::OWeakObject*)new SdXMLImport( rSMgr, draw, flags );\
+}
+
+SERVICE( XMLImpressImportOasis, "com.sun.star.comp.Impress.XMLOasisImporter", "XMLImpressImportOasis", sal_False, IMPORT_ALL )
+SERVICE( XMLDrawImportOasis, "com.sun.star.comp.Draw.XMLOasisImporter", "XMLDrawImportOasis", sal_True, IMPORT_ALL )
+
+SERVICE( XMLImpressStylesImportOasis, "com.sun.star.comp.Impress.XMLOasisStylesImporter", "XMLImpressStylesImportOasis", sal_False, IMPORT_STYLES|IMPORT_AUTOSTYLES|IMPORT_MASTERSTYLES )
+SERVICE( XMLDrawStylesImportOasis, "com.sun.star.comp.Draw.XMLOasisStylesImporter", "XMLImpressStylesImportOasis", sal_True, IMPORT_STYLES|IMPORT_AUTOSTYLES|IMPORT_MASTERSTYLES )
+
+SERVICE( XMLImpressContentImportOasis, "com.sun.star.comp.Impress.XMLOasisContentImporter", "XMLImpressContentImportOasis", sal_False, IMPORT_AUTOSTYLES|IMPORT_CONTENT|IMPORT_SCRIPTS|IMPORT_FONTDECLS )
+SERVICE( XMLDrawContentImportOasis, "com.sun.star.comp.Draw.XMLOasisContentImporter", "XMLImpressContentImportOasis", sal_True, IMPORT_AUTOSTYLES|IMPORT_CONTENT|IMPORT_SCRIPTS|IMPORT_FONTDECLS )
+
+SERVICE( XMLImpressMetaImportOasis, "com.sun.star.comp.Impress.XMLOasisMetaImporter", "XMLImpressMetaImportOasis", sal_False, IMPORT_META )
+SERVICE( XMLDrawMetaImportOasis, "com.sun.star.comp.Draw.XMLOasisMetaImporter", "XMLImpressMetaImportOasis", sal_True, IMPORT_META )
+
+SERVICE( XMLImpressSettingsImportOasis, "com.sun.star.comp.Impress.XMLOasisSettingsImporter", "XMLImpressSettingsImportOasis", sal_False, IMPORT_SETTINGS )
+SERVICE( XMLDrawSettingsImportOasis, "com.sun.star.comp.Draw.XMLOasisSettingsImporter", "XMLImpressSettingsImportOasis", sal_True, IMPORT_SETTINGS )
+
+//////////////////////////////////////////////////////////////////////////////
+
+// #110680#
+SdXMLImport::SdXMLImport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ sal_Bool bIsDraw, sal_uInt16 nImportFlags )
+: SvXMLImport( xServiceFactory, nImportFlags ),
+ mpMasterStylesContext(0L),
+ mpDocElemTokenMap(0L),
+ mpBodyElemTokenMap(0L),
+ mpStylesElemTokenMap(0L),
+ mpMasterPageElemTokenMap(0L),
+ mpMasterPageAttrTokenMap(0L),
+ mpPageMasterAttrTokenMap(0L),
+ mpPageMasterStyleAttrTokenMap(0L),
+ mpDrawPageAttrTokenMap(0L),
+ mpDrawPageElemTokenMap(0L),
+ mpPresentationPlaceholderAttrTokenMap(0L),
+ mnStyleFamilyMask(0),
+ mnNewPageCount(0L),
+ mnNewMasterPageCount(0L),
+ mbIsDraw(bIsDraw),
+ mbLoadDoc(sal_True),
+ mbPreview(sal_False),
+ msPageLayouts( RTL_CONSTASCII_USTRINGPARAM( "PageLayouts" ) ),
+ msPreview( RTL_CONSTASCII_USTRINGPARAM( "Preview" ) )
+{
+ // add namespaces
+ GetNamespaceMap().Add(
+ GetXMLToken(XML_NP_PRESENTATION),
+ GetXMLToken(XML_N_PRESENTATION),
+ XML_NAMESPACE_PRESENTATION);
+
+ GetNamespaceMap().Add(
+ GetXMLToken(XML_NP_SMIL),
+ GetXMLToken(XML_N_SMIL_COMPAT),
+ XML_NAMESPACE_SMIL);
+
+ GetNamespaceMap().Add(
+ GetXMLToken(XML_NP_ANIMATION),
+ GetXMLToken(XML_N_ANIMATION),
+ XML_NAMESPACE_ANIMATION);
+}
+
+// XImporter
+void SAL_CALL SdXMLImport::setTargetDocument( const uno::Reference< lang::XComponent >& xDoc )
+ throw(lang::IllegalArgumentException, uno::RuntimeException)
+{
+ SvXMLImport::setTargetDocument( xDoc );
+
+ uno::Reference< lang::XServiceInfo > xDocServices( GetModel(), uno::UNO_QUERY );
+ if( !xDocServices.is() )
+ throw lang::IllegalArgumentException();
+
+ mbIsDraw = !xDocServices->supportsService( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) ) );
+
+ // prepare access to styles
+ uno::Reference< style::XStyleFamiliesSupplier > xFamSup( GetModel(), uno::UNO_QUERY );
+ if(xFamSup.is())
+ mxDocStyleFamilies = xFamSup->getStyleFamilies();
+
+ // prepare access to master pages
+ uno::Reference < drawing::XMasterPagesSupplier > xMasterPagesSupplier(GetModel(), uno::UNO_QUERY);
+ if(xMasterPagesSupplier.is())
+ mxDocMasterPages = mxDocMasterPages.query( xMasterPagesSupplier->getMasterPages() );
+
+ // prepare access to draw pages
+ uno::Reference <drawing::XDrawPagesSupplier> xDrawPagesSupplier(GetModel(), uno::UNO_QUERY);
+ if(!xDrawPagesSupplier.is())
+ throw lang::IllegalArgumentException();
+
+ mxDocDrawPages = mxDocDrawPages.query( xDrawPagesSupplier->getDrawPages() );
+ if(!mxDocDrawPages.is())
+ throw lang::IllegalArgumentException();
+
+ if( mxDocDrawPages.is() && mxDocDrawPages->getCount() > 0 )
+ {
+ uno::Reference< form::XFormsSupplier > xFormsSupp;
+ mxDocDrawPages->getByIndex(0) >>= xFormsSupp;
+ mbIsFormsSupported = xFormsSupp.is();
+ }
+
+ // #88546# enable progress bar increments, SdXMLImport is only used for
+ // draw/impress import
+ GetShapeImport()->enableHandleProgressBar();
+
+ uno::Reference< lang::XMultiServiceFactory > xFac( GetModel(), uno::UNO_QUERY );
+ if( xFac.is() )
+ {
+ uno::Sequence< OUString > sSNS( xFac->getAvailableServiceNames() );
+ sal_Int32 n = sSNS.getLength();
+ const OUString* pSNS( sSNS.getConstArray() );
+ while( --n > 0 )
+ {
+ if( (*pSNS++).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.TableShape") ) )
+ {
+ mbIsTableShapeSupported = true;
+ break;
+ }
+ }
+ }
+}
+
+// XInitialization
+void SAL_CALL SdXMLImport::initialize( const uno::Sequence< uno::Any >& aArguments )
+ throw( uno::Exception, uno::RuntimeException)
+{
+ SvXMLImport::initialize( aArguments );
+
+ uno::Reference< beans::XPropertySet > xInfoSet( getImportInfo() );
+ if( xInfoSet.is() )
+ {
+ uno::Reference< beans::XPropertySetInfo > xInfoSetInfo( xInfoSet->getPropertySetInfo() );
+
+ if( xInfoSetInfo->hasPropertyByName( msPageLayouts ) )
+ xInfoSet->getPropertyValue( msPageLayouts ) >>= mxPageLayouts;
+
+ if( xInfoSetInfo->hasPropertyByName( msPreview ) )
+ xInfoSet->getPropertyValue( msPreview ) >>= mbPreview;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLImport::~SdXMLImport() throw ()
+{
+ // Styles or AutoStyles context?
+ if(mpMasterStylesContext)
+ mpMasterStylesContext->ReleaseRef();
+
+ // delete all token maps
+ if(mpDocElemTokenMap)
+ delete mpDocElemTokenMap;
+ if(mpBodyElemTokenMap)
+ delete mpBodyElemTokenMap;
+ if(mpStylesElemTokenMap)
+ delete mpStylesElemTokenMap;
+ if(mpMasterPageElemTokenMap)
+ delete mpMasterPageElemTokenMap;
+ if(mpMasterPageAttrTokenMap)
+ delete mpMasterPageAttrTokenMap;
+ if(mpPageMasterAttrTokenMap)
+ delete mpPageMasterAttrTokenMap;
+ if(mpPageMasterStyleAttrTokenMap)
+ delete mpPageMasterStyleAttrTokenMap;
+ if(mpDrawPageAttrTokenMap)
+ delete mpDrawPageAttrTokenMap;
+ if(mpDrawPageElemTokenMap)
+ delete mpDrawPageElemTokenMap;
+ if(mpPresentationPlaceholderAttrTokenMap)
+ delete mpPresentationPlaceholderAttrTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLImport::SetProgress(sal_Int32 nProg)
+{
+ // set progress view
+ if(mxStatusIndicator.is())
+ mxStatusIndicator->setValue(nProg);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+const SvXMLTokenMap& SdXMLImport::GetDocElemTokenMap()
+{
+ if(!mpDocElemTokenMap)
+ {
+ static SvXMLTokenMapEntry aDocElemTokenMap[] =
+{
+ { XML_NAMESPACE_OFFICE, XML_FONT_FACE_DECLS, XML_TOK_DOC_FONTDECLS },
+ { XML_NAMESPACE_OFFICE, XML_STYLES, XML_TOK_DOC_STYLES },
+ { XML_NAMESPACE_OFFICE, XML_AUTOMATIC_STYLES, XML_TOK_DOC_AUTOSTYLES },
+ { XML_NAMESPACE_OFFICE, XML_MASTER_STYLES, XML_TOK_DOC_MASTERSTYLES },
+ { XML_NAMESPACE_OFFICE, XML_META, XML_TOK_DOC_META },
+ { XML_NAMESPACE_OFFICE, XML_SCRIPTS, XML_TOK_DOC_SCRIPT },
+ { XML_NAMESPACE_OFFICE, XML_BODY, XML_TOK_DOC_BODY },
+ { XML_NAMESPACE_OFFICE, XML_SETTINGS, XML_TOK_DOC_SETTINGS },
+ XML_TOKEN_MAP_END
+};
+
+ mpDocElemTokenMap = new SvXMLTokenMap(aDocElemTokenMap);
+ } // if(!mpDocElemTokenMap)
+
+ return *mpDocElemTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+const SvXMLTokenMap& SdXMLImport::GetBodyElemTokenMap()
+{
+ if(!mpBodyElemTokenMap)
+ {
+ static SvXMLTokenMapEntry aBodyElemTokenMap[] =
+{
+ { XML_NAMESPACE_DRAW, XML_PAGE, XML_TOK_BODY_PAGE },
+ { XML_NAMESPACE_PRESENTATION, XML_SETTINGS, XML_TOK_BODY_SETTINGS },
+ { XML_NAMESPACE_PRESENTATION, XML_HEADER_DECL, XML_TOK_BODY_HEADER_DECL },
+ { XML_NAMESPACE_PRESENTATION, XML_FOOTER_DECL, XML_TOK_BODY_FOOTER_DECL },
+ { XML_NAMESPACE_PRESENTATION, XML_DATE_TIME_DECL,XML_TOK_BODY_DATE_TIME_DECL },
+
+ XML_TOKEN_MAP_END
+};
+
+ mpBodyElemTokenMap = new SvXMLTokenMap(aBodyElemTokenMap);
+ } // if(!mpBodyElemTokenMap)
+
+ return *mpBodyElemTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+const SvXMLTokenMap& SdXMLImport::GetStylesElemTokenMap()
+{
+ if(!mpStylesElemTokenMap)
+ {
+ static SvXMLTokenMapEntry aStylesElemTokenMap[] =
+{
+ { XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT, XML_TOK_STYLES_PAGE_MASTER },
+ { XML_NAMESPACE_STYLE, XML_PRESENTATION_PAGE_LAYOUT, XML_TOK_STYLES_PRESENTATION_PAGE_LAYOUT },
+ { XML_NAMESPACE_STYLE, XML_STYLE, XML_TOK_STYLES_STYLE },
+ XML_TOKEN_MAP_END
+};
+
+ mpStylesElemTokenMap = new SvXMLTokenMap(aStylesElemTokenMap);
+ } // if(!mpStylesElemTokenMap)
+
+ return *mpStylesElemTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+const SvXMLTokenMap& SdXMLImport::GetMasterPageElemTokenMap()
+{
+ if(!mpMasterPageElemTokenMap)
+ {
+ static SvXMLTokenMapEntry aMasterPageElemTokenMap[] =
+{
+ { XML_NAMESPACE_STYLE, XML_STYLE, XML_TOK_MASTERPAGE_STYLE },
+ { XML_NAMESPACE_PRESENTATION, XML_NOTES, XML_TOK_MASTERPAGE_NOTES },
+ XML_TOKEN_MAP_END
+};
+
+ mpMasterPageElemTokenMap = new SvXMLTokenMap(aMasterPageElemTokenMap);
+ } // if(!mpMasterPageElemTokenMap)
+
+ return *mpMasterPageElemTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+const SvXMLTokenMap& SdXMLImport::GetMasterPageAttrTokenMap()
+{
+ if(!mpMasterPageAttrTokenMap)
+ {
+ static SvXMLTokenMapEntry aMasterPageAttrTokenMap[] =
+{
+ { XML_NAMESPACE_STYLE, XML_NAME, XML_TOK_MASTERPAGE_NAME },
+ { XML_NAMESPACE_STYLE, XML_DISPLAY_NAME, XML_TOK_MASTERPAGE_DISPLAY_NAME },
+ { XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_NAME, XML_TOK_MASTERPAGE_PAGE_MASTER_NAME },
+ { XML_NAMESPACE_DRAW, XML_STYLE_NAME, XML_TOK_MASTERPAGE_STYLE_NAME },
+ { XML_NAMESPACE_PRESENTATION, XML_PRESENTATION_PAGE_LAYOUT_NAME, XML_TOK_MASTERPAGE_PAGE_LAYOUT_NAME },
+ { XML_NAMESPACE_PRESENTATION, XML_USE_HEADER_NAME, XML_TOK_MASTERPAGE_USE_HEADER_NAME },
+ { XML_NAMESPACE_PRESENTATION, XML_USE_FOOTER_NAME, XML_TOK_MASTERPAGE_USE_FOOTER_NAME },
+ { XML_NAMESPACE_PRESENTATION, XML_USE_DATE_TIME_NAME, XML_TOK_MASTERPAGE_USE_DATE_TIME_NAME },
+ XML_TOKEN_MAP_END
+};
+
+ mpMasterPageAttrTokenMap = new SvXMLTokenMap(aMasterPageAttrTokenMap);
+ } // if(!mpMasterPageAttrTokenMap)
+
+ return *mpMasterPageAttrTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+const SvXMLTokenMap& SdXMLImport::GetPageMasterAttrTokenMap()
+{
+ if(!mpPageMasterAttrTokenMap)
+ {
+ static SvXMLTokenMapEntry aPageMasterAttrTokenMap[] =
+{
+ { XML_NAMESPACE_STYLE, XML_NAME, XML_TOK_PAGEMASTER_NAME },
+ XML_TOKEN_MAP_END
+};
+
+ mpPageMasterAttrTokenMap = new SvXMLTokenMap(aPageMasterAttrTokenMap);
+ } // if(!mpPageMasterAttrTokenMap)
+
+ return *mpPageMasterAttrTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+const SvXMLTokenMap& SdXMLImport::GetPageMasterStyleAttrTokenMap()
+{
+ if(!mpPageMasterStyleAttrTokenMap)
+ {
+ static SvXMLTokenMapEntry aPageMasterStyleAttrTokenMap[] =
+{
+ { XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_TOK_PAGEMASTERSTYLE_MARGIN_TOP },
+ { XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_TOK_PAGEMASTERSTYLE_MARGIN_BOTTOM },
+ { XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TOK_PAGEMASTERSTYLE_MARGIN_LEFT },
+ { XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_TOK_PAGEMASTERSTYLE_MARGIN_RIGHT },
+ { XML_NAMESPACE_FO, XML_PAGE_WIDTH, XML_TOK_PAGEMASTERSTYLE_PAGE_WIDTH },
+ { XML_NAMESPACE_FO, XML_PAGE_HEIGHT, XML_TOK_PAGEMASTERSTYLE_PAGE_HEIGHT },
+ { XML_NAMESPACE_STYLE, XML_PRINT_ORIENTATION, XML_TOK_PAGEMASTERSTYLE_PAGE_ORIENTATION },
+ XML_TOKEN_MAP_END
+};
+
+ mpPageMasterStyleAttrTokenMap = new SvXMLTokenMap(aPageMasterStyleAttrTokenMap);
+ } // if(!mpPageMasterStyleAttrTokenMap)
+
+ return *mpPageMasterStyleAttrTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+const SvXMLTokenMap& SdXMLImport::GetDrawPageAttrTokenMap()
+{
+ if(!mpDrawPageAttrTokenMap)
+ {
+ static SvXMLTokenMapEntry aDrawPageAttrTokenMap[] =
+{
+ { XML_NAMESPACE_DRAW, XML_NAME, XML_TOK_DRAWPAGE_NAME },
+ { XML_NAMESPACE_DRAW, XML_STYLE_NAME, XML_TOK_DRAWPAGE_STYLE_NAME },
+ { XML_NAMESPACE_DRAW, XML_MASTER_PAGE_NAME, XML_TOK_DRAWPAGE_MASTER_PAGE_NAME },
+ { XML_NAMESPACE_PRESENTATION, XML_PRESENTATION_PAGE_LAYOUT_NAME, XML_TOK_DRAWPAGE_PAGE_LAYOUT_NAME },
+ { XML_NAMESPACE_DRAW, XML_ID, XML_TOK_DRAWPAGE_DRAWID },
+ { XML_NAMESPACE_XML, XML_ID, XML_TOK_DRAWPAGE_XMLID },
+ { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_DRAWPAGE_HREF },
+ { XML_NAMESPACE_PRESENTATION, XML_USE_HEADER_NAME, XML_TOK_DRAWPAGE_USE_HEADER_NAME },
+ { XML_NAMESPACE_PRESENTATION, XML_USE_FOOTER_NAME, XML_TOK_DRAWPAGE_USE_FOOTER_NAME },
+ { XML_NAMESPACE_PRESENTATION, XML_USE_DATE_TIME_NAME, XML_TOK_DRAWPAGE_USE_DATE_TIME_NAME },
+
+ XML_TOKEN_MAP_END
+};
+
+ mpDrawPageAttrTokenMap = new SvXMLTokenMap(aDrawPageAttrTokenMap);
+ } // if(!mpDrawPageAttrTokenMap)
+
+ return *mpDrawPageAttrTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+const SvXMLTokenMap& SdXMLImport::GetDrawPageElemTokenMap()
+{
+ if(!mpDrawPageElemTokenMap)
+ {
+ static SvXMLTokenMapEntry aDrawPageElemTokenMap[] =
+{
+ { XML_NAMESPACE_PRESENTATION, XML_NOTES, XML_TOK_DRAWPAGE_NOTES },
+ { XML_NAMESPACE_ANIMATION, XML_PAR, XML_TOK_DRAWPAGE_PAR },
+ { XML_NAMESPACE_ANIMATION, XML_SEQ, XML_TOK_DRAWPAGE_SEQ },
+ XML_TOKEN_MAP_END
+};
+
+ mpDrawPageElemTokenMap = new SvXMLTokenMap(aDrawPageElemTokenMap);
+ } // if(!mpDrawPageElemTokenMap)
+
+ return *mpDrawPageElemTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+const SvXMLTokenMap& SdXMLImport::GetPresentationPlaceholderAttrTokenMap()
+{
+ if(!mpPresentationPlaceholderAttrTokenMap)
+ {
+ static SvXMLTokenMapEntry aPresentationPlaceholderAttrTokenMap[] =
+{
+ { XML_NAMESPACE_PRESENTATION, XML_OBJECT, XML_TOK_PRESENTATIONPLACEHOLDER_OBJECTNAME },
+ { XML_NAMESPACE_SVG, XML_X, XML_TOK_PRESENTATIONPLACEHOLDER_X },
+ { XML_NAMESPACE_SVG, XML_Y, XML_TOK_PRESENTATIONPLACEHOLDER_Y },
+ { XML_NAMESPACE_SVG, XML_WIDTH, XML_TOK_PRESENTATIONPLACEHOLDER_WIDTH },
+ { XML_NAMESPACE_SVG, XML_HEIGHT, XML_TOK_PRESENTATIONPLACEHOLDER_HEIGHT },
+ XML_TOKEN_MAP_END
+};
+
+ mpPresentationPlaceholderAttrTokenMap = new SvXMLTokenMap(aPresentationPlaceholderAttrTokenMap);
+ } // if(!mpPresentationPlaceholderAttrTokenMap)
+
+ return *mpPresentationPlaceholderAttrTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLImportContext *SdXMLImport::CreateContext(sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList)
+{
+ SvXMLImportContext* pContext = 0;
+
+ if(XML_NAMESPACE_OFFICE == nPrefix &&
+ ( IsXMLToken( rLocalName, XML_DOCUMENT_STYLES ) ||
+ IsXMLToken( rLocalName, XML_DOCUMENT_CONTENT ) ||
+ IsXMLToken( rLocalName, XML_DOCUMENT_SETTINGS ) ))
+ {
+ pContext = new SdXMLDocContext_Impl(*this, nPrefix, rLocalName, xAttrList);
+ } else if ( (XML_NAMESPACE_OFFICE == nPrefix) &&
+ ( IsXMLToken(rLocalName, XML_DOCUMENT_META)) ) {
+ pContext = CreateMetaContext(rLocalName, xAttrList);
+ } else if ( (XML_NAMESPACE_OFFICE == nPrefix) &&
+ ( IsXMLToken(rLocalName, XML_DOCUMENT)) ) {
+ uno::Reference<xml::sax::XDocumentHandler> xDocBuilder(
+ mxServiceFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.xml.dom.SAXDocumentBuilder"))),
+ uno::UNO_QUERY_THROW);
+ uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
+ GetModel(), uno::UNO_QUERY_THROW);
+ // flat OpenDocument file format
+ pContext = new SdXMLFlatDocContext_Impl( *this, nPrefix, rLocalName,
+ xAttrList, xDPS->getDocumentProperties(), xDocBuilder);
+ } else {
+ pContext = SvXMLImport::CreateContext(nPrefix, rLocalName, xAttrList);
+ }
+
+ return pContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLImportContext *SdXMLImport::CreateMetaContext(const OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>&)
+{
+ SvXMLImportContext* pContext = 0L;
+
+ if (!IsStylesOnlyMode() && (getImportFlags() & IMPORT_META))
+ {
+ uno::Reference<xml::sax::XDocumentHandler> xDocBuilder(
+ mxServiceFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.xml.dom.SAXDocumentBuilder"))),
+ uno::UNO_QUERY_THROW);
+ uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
+ GetModel(), uno::UNO_QUERY_THROW);
+ pContext = new SvXMLMetaDocumentContext(*this,
+ XML_NAMESPACE_OFFICE, rLocalName,
+ xDPS->getDocumentProperties(), xDocBuilder);
+ }
+
+ if(!pContext)
+ {
+ pContext = new SvXMLImportContext(*this, XML_NAMESPACE_OFFICE, rLocalName);
+ }
+
+ return pContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLImportContext *SdXMLImport::CreateBodyContext(const OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>&)
+{
+ SvXMLImportContext *pContext = 0;
+ pContext = new SdXMLBodyContext(*this, XML_NAMESPACE_OFFICE, rLocalName);
+ return pContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLStylesContext *SdXMLImport::CreateStylesContext(const OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList)
+{
+ if(GetShapeImport()->GetStylesContext())
+ return GetShapeImport()->GetStylesContext();
+
+ GetShapeImport()->SetStylesContext(new SdXMLStylesContext(
+ *this, XML_NAMESPACE_OFFICE, rLocalName, xAttrList, sal_False));
+
+ return GetShapeImport()->GetStylesContext();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLStylesContext *SdXMLImport::CreateAutoStylesContext(const OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList)
+{
+ if(GetShapeImport()->GetAutoStylesContext())
+ return GetShapeImport()->GetAutoStylesContext();
+
+ GetShapeImport()->SetAutoStylesContext(new SdXMLStylesContext(
+ *this, XML_NAMESPACE_OFFICE, rLocalName, xAttrList, sal_True));
+
+ return GetShapeImport()->GetAutoStylesContext();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLImportContext* SdXMLImport::CreateMasterStylesContext(const OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>&)
+{
+ if(mpMasterStylesContext)
+ return mpMasterStylesContext;
+
+ mpMasterStylesContext = new SdXMLMasterStylesContext(
+ *this, XML_NAMESPACE_OFFICE, rLocalName);
+ mpMasterStylesContext->AddRef();
+
+ return mpMasterStylesContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLImportContext *SdXMLImport::CreateFontDeclsContext(const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList )
+{
+ XMLFontStylesContext *pFSContext =
+ new XMLFontStylesContext( *this, XML_NAMESPACE_OFFICE,
+ rLocalName, xAttrList,
+ gsl_getSystemTextEncoding() );
+ SetFontDecls( pFSContext );
+ return pFSContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// import pool defaults. Parameter contains pool defaults read
+// from input data. These data needs to be set at the model.
+//
+void SdXMLImport::ImportPoolDefaults(const XMLPropStyleContext*)
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLImportContext *SdXMLImport::CreateScriptContext(
+ const OUString& rLocalName )
+{
+ SvXMLImportContext *pContext = 0;
+
+ pContext = new XMLScriptContext( *this,
+ XML_NAMESPACE_OFFICE, rLocalName,
+ GetModel() );
+ return pContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLImport::SetViewSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aViewProps)
+{
+ uno::Reference< beans::XPropertySet > xPropSet( GetModel(), uno::UNO_QUERY );
+ if( !xPropSet.is() )
+ return;
+
+ awt::Rectangle aVisArea( 0,0, 28000, 21000 );
+ sal_Int32 nCount = aViewProps.getLength();
+
+ const beans::PropertyValue* pValues = aViewProps.getConstArray();
+
+ while( nCount-- )
+ {
+ const OUString& rName = pValues->Name;
+ const uno::Any rValue = pValues->Value;
+
+ if( rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("VisibleAreaTop") ) )
+ {
+ rValue >>= aVisArea.Y;
+ }
+ else if( rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("VisibleAreaLeft") ) )
+ {
+ rValue >>= aVisArea.X;
+ }
+ else if( rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("VisibleAreaWidth") ) )
+ {
+ rValue >>= aVisArea.Width;
+ }
+ else if( rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("VisibleAreaHeight") ) )
+ {
+ rValue >>= aVisArea.Height;
+ }
+
+ pValues++;
+ }
+
+ try
+ {
+ xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "VisibleArea" ) ), uno::makeAny( aVisArea ) );
+ }
+ catch( com::sun::star::uno::Exception /*e*/ )
+ {
+/* #i79978# since old documents may contain invalid view settings, this is nothing to worry the user about.
+ uno::Sequence<OUString> aSeq(0);
+ SetError( XMLERROR_FLAG_WARNING | XMLERROR_API, aSeq, e.Message, NULL );
+*/
+ }
+}
+
+void SdXMLImport::SetConfigurationSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aConfigProps)
+{
+ uno::Reference< lang::XMultiServiceFactory > xFac( GetModel(), uno::UNO_QUERY );
+ if( !xFac.is() )
+ return;
+
+ uno::Reference< beans::XPropertySet > xProps( xFac->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.Settings" ) ) ), uno::UNO_QUERY );
+ if( !xProps.is() )
+ return;
+
+ uno::Reference< beans::XPropertySetInfo > xInfo( xProps->getPropertySetInfo() );
+ if( !xInfo.is() )
+ return;
+
+ sal_Int32 nCount = aConfigProps.getLength();
+ const beans::PropertyValue* pValues = aConfigProps.getConstArray();
+
+ while( nCount-- )
+ {
+ try
+ {
+ const OUString& rProperty = pValues->Name;
+ if( xInfo->hasPropertyByName( rProperty ) )
+ xProps->setPropertyValue( rProperty, pValues->Value );
+ }
+ catch( uno::Exception& e )
+ {
+ (void)e;
+ OSL_TRACE( "#SdXMLImport::SetConfigurationSettings: Exception!" );
+ }
+
+ pValues++;
+ }
+}
+
+// #80365# overload this method to read and use the hint value from the
+// written meta information. If no info is found, guess 10 draw objects
+//void SdXMLImport::SetStatisticAttributes(const uno::Reference<xml::sax::XAttributeList>& xAttrList)
+void SdXMLImport::SetStatistics(
+ const uno::Sequence<beans::NamedValue> & i_rStats)
+{
+ static const char* s_stats[] =
+ { "ObjectCount", 0 };
+
+ SvXMLImport::SetStatistics(i_rStats);
+
+ sal_uInt32 nCount(10);
+ for (sal_Int32 i = 0; i < i_rStats.getLength(); ++i) {
+ for (const char** pStat = s_stats; *pStat != 0; ++pStat) {
+ if (i_rStats[i].Name.equalsAscii(*pStat)) {
+ sal_Int32 val = 0;
+ if (i_rStats[i].Value >>= val) {
+ nCount = val;
+ } else {
+ OSL_FAIL("SdXMLImport::SetStatistics: invalid entry");
+ }
+ }
+ }
+ }
+
+ if(nCount)
+ {
+ GetProgressBarHelper()->SetReference(nCount);
+ GetProgressBarHelper()->SetValue(0);
+ }
+}
+
+
+// XServiceInfo
+OUString SAL_CALL SdXMLImport::getImplementationName() throw( uno::RuntimeException )
+{
+ if( IsDraw())
+ {
+ // Draw
+
+ switch( getImportFlags())
+ {
+ case IMPORT_ALL:
+ return XMLDrawImportOasis_getImplementationName();
+ case (IMPORT_STYLES|IMPORT_AUTOSTYLES|IMPORT_MASTERSTYLES):
+ return XMLDrawStylesImportOasis_getImplementationName();
+ case (IMPORT_AUTOSTYLES|IMPORT_CONTENT|IMPORT_SCRIPTS|IMPORT_FONTDECLS):
+ return XMLDrawContentImportOasis_getImplementationName();
+ case IMPORT_META:
+ return XMLDrawMetaImportOasis_getImplementationName();
+ case IMPORT_SETTINGS:
+ return XMLDrawSettingsImportOasis_getImplementationName();
+ default:
+ return XMLDrawImportOasis_getImplementationName();
+ }
+ }
+ else
+ {
+ // Impress
+
+ switch( getImportFlags())
+ {
+ case IMPORT_ALL:
+ return XMLImpressImportOasis_getImplementationName();
+ case (IMPORT_STYLES|IMPORT_AUTOSTYLES|IMPORT_MASTERSTYLES):
+ return XMLImpressStylesImportOasis_getImplementationName();
+ case (IMPORT_AUTOSTYLES|IMPORT_CONTENT|IMPORT_SCRIPTS|IMPORT_FONTDECLS):
+ return XMLImpressContentImportOasis_getImplementationName();
+ case IMPORT_META:
+ return XMLImpressMetaImportOasis_getImplementationName();
+ case IMPORT_SETTINGS:
+ return XMLImpressSettingsImportOasis_getImplementationName();
+ default:
+ return XMLImpressImportOasis_getImplementationName();
+ }
+ }
+}
+
+ HeaderFooterDeclMap maHeaderDeclsMap;
+ HeaderFooterDeclMap maFooterDeclsMap;
+ DateTimeDeclMap maDateTimeDeclsMap;
+
+void SdXMLImport::AddHeaderDecl( const ::rtl::OUString& rName, const ::rtl::OUString& rText )
+{
+ if( rName.getLength() && rText.getLength() )
+ maHeaderDeclsMap[rName] = rText;
+}
+
+void SdXMLImport::AddFooterDecl( const ::rtl::OUString& rName, const ::rtl::OUString& rText )
+{
+ if( rName.getLength() && rText.getLength() )
+ maFooterDeclsMap[rName] = rText;
+}
+
+void SdXMLImport::AddDateTimeDecl( const ::rtl::OUString& rName, const ::rtl::OUString& rText, sal_Bool bFixed, const ::rtl::OUString& rDateTimeFormat )
+{
+ if( rName.getLength() && (rText.getLength() || !bFixed) )
+ {
+ DateTimeDeclContextImpl aDecl;
+ aDecl.maStrText = rText;
+ aDecl.mbFixed = bFixed;
+ aDecl.maStrDateTimeFormat = rDateTimeFormat;
+ maDateTimeDeclsMap[rName] = aDecl;
+ }
+}
+
+::rtl::OUString SdXMLImport::GetHeaderDecl( const ::rtl::OUString& rName ) const
+{
+ ::rtl::OUString aRet;
+ HeaderFooterDeclMap::const_iterator aIter( maHeaderDeclsMap.find( rName ) );
+ if( aIter != maHeaderDeclsMap.end() )
+ aRet = (*aIter).second;
+
+ return aRet;
+}
+
+::rtl::OUString SdXMLImport::GetFooterDecl( const ::rtl::OUString& rName ) const
+{
+ ::rtl::OUString aRet;
+ HeaderFooterDeclMap::const_iterator aIter( maFooterDeclsMap.find( rName ) );
+ if( aIter != maFooterDeclsMap.end() )
+ aRet = (*aIter).second;
+
+ return aRet;
+}
+
+::rtl::OUString SdXMLImport::GetDateTimeDecl( const ::rtl::OUString& rName, sal_Bool& rbFixed, ::rtl::OUString& rDateTimeFormat )
+{
+ DateTimeDeclContextImpl aDecl;
+
+ DateTimeDeclMap::const_iterator aIter( maDateTimeDeclsMap.find( rName ) );
+ if( aIter != maDateTimeDeclsMap.end() )
+ aDecl = (*aIter).second;
+
+ rbFixed = aDecl.mbFixed;
+ rDateTimeFormat = aDecl.maStrDateTimeFormat;
+ return aDecl.maStrText;
+}
+
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/sdxmlimp_impl.hxx b/xmloff/source/draw/sdxmlimp_impl.hxx
new file mode 100644
index 000000000000..17cabd288616
--- /dev/null
+++ b/xmloff/source/draw/sdxmlimp_impl.hxx
@@ -0,0 +1,340 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _SDXMLIMP_IMPL_HXX
+#define _SDXMLIMP_IMPL_HXX
+
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/task/XStatusIndicator.hpp>
+#include <xmloff/xmltkmap.hxx>
+#include <com/sun/star/container/XNameAccess.hpp>
+
+#include <vector>
+#include <xmloff/xmlimp.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+enum SdXMLDocElemTokenMap
+{
+ XML_TOK_DOC_FONTDECLS,
+ XML_TOK_DOC_STYLES,
+ XML_TOK_DOC_AUTOSTYLES,
+ XML_TOK_DOC_MASTERSTYLES,
+ XML_TOK_DOC_META,
+ XML_TOK_DOC_BODY,
+ XML_TOK_DOC_SCRIPT,
+ XML_TOK_DOC_SETTINGS,
+ XML_TOK_OFFICE_END = XML_TOK_UNKNOWN
+};
+
+enum SdXMLBodyElemTokenMap
+{
+ XML_TOK_BODY_PAGE,
+ XML_TOK_BODY_SETTINGS,
+ XML_TOK_BODY_HEADER_DECL,
+ XML_TOK_BODY_FOOTER_DECL,
+ XML_TOK_BODY_DATE_TIME_DECL
+};
+
+enum SdXMLStylesElemTokenMap
+{
+ XML_TOK_STYLES_MASTER_PAGE,
+ XML_TOK_STYLES_STYLE,
+ XML_TOK_STYLES_PAGE_MASTER,
+ XML_TOK_STYLES_PRESENTATION_PAGE_LAYOUT
+};
+
+enum SdXMLAutoStylesElemTokenMap
+{
+ XML_TOK_AUTOSTYLES_STYLE
+};
+
+enum SdXMLMasterPageElemTokenMap
+{
+ XML_TOK_MASTERPAGE_STYLE,
+ XML_TOK_MASTERPAGE_NOTES
+};
+
+enum SdXMLMasterPageAttrTokenMap
+{
+ XML_TOK_MASTERPAGE_NAME,
+ XML_TOK_MASTERPAGE_DISPLAY_NAME,
+ XML_TOK_MASTERPAGE_PAGE_MASTER_NAME,
+ XML_TOK_MASTERPAGE_STYLE_NAME,
+ XML_TOK_MASTERPAGE_PAGE_LAYOUT_NAME,
+ XML_TOK_MASTERPAGE_USE_HEADER_NAME,
+ XML_TOK_MASTERPAGE_USE_FOOTER_NAME,
+ XML_TOK_MASTERPAGE_USE_DATE_TIME_NAME
+};
+
+enum SdXMLPageMasterAttrTokenMap
+{
+ XML_TOK_PAGEMASTER_NAME
+};
+
+enum SdXMLPageMasterStyleAttrTokenMap
+{
+ XML_TOK_PAGEMASTERSTYLE_MARGIN_TOP,
+ XML_TOK_PAGEMASTERSTYLE_MARGIN_BOTTOM,
+ XML_TOK_PAGEMASTERSTYLE_MARGIN_LEFT,
+ XML_TOK_PAGEMASTERSTYLE_MARGIN_RIGHT,
+ XML_TOK_PAGEMASTERSTYLE_PAGE_WIDTH,
+ XML_TOK_PAGEMASTERSTYLE_PAGE_HEIGHT,
+ XML_TOK_PAGEMASTERSTYLE_PAGE_ORIENTATION
+};
+
+enum SdXMLDocStyleAttrTokenMap
+{
+ XML_TOK_DOCSTYLE_NAME,
+ XML_TOK_DOCSTYLE_FAMILY,
+ XML_TOK_DOCSTYLE_PARENT_STYLE_NAME,
+ XML_TOK_DOCSTYLE_AUTOMATIC
+};
+
+enum SdXMLDocStyleElemTokenMap
+{
+ XML_TOK_DOCSTYLE_PROPERTIES,
+ XML_TOK_DOCSTYLE_PRESENTATION_PLACEHOLDER
+};
+
+enum SdXMLDrawPageAttrTokenMap
+{
+ XML_TOK_DRAWPAGE_NAME,
+ XML_TOK_DRAWPAGE_STYLE_NAME,
+ XML_TOK_DRAWPAGE_MASTER_PAGE_NAME,
+ XML_TOK_DRAWPAGE_PAGE_LAYOUT_NAME,
+ XML_TOK_DRAWPAGE_DRAWID,
+ XML_TOK_DRAWPAGE_XMLID,
+ XML_TOK_DRAWPAGE_HREF,
+ XML_TOK_DRAWPAGE_USE_HEADER_NAME,
+ XML_TOK_DRAWPAGE_USE_FOOTER_NAME,
+ XML_TOK_DRAWPAGE_USE_DATE_TIME_NAME
+};
+
+enum SdXMLDrawPageElemTokenMap
+{
+ XML_TOK_DRAWPAGE_NOTES,
+ XML_TOK_DRAWPAGE_PAR,
+ XML_TOK_DRAWPAGE_SEQ
+};
+
+enum SdXMLPresentationPlaceholderAttrTokenMap
+{
+ XML_TOK_PRESENTATIONPLACEHOLDER_OBJECTNAME,
+ XML_TOK_PRESENTATIONPLACEHOLDER_X,
+ XML_TOK_PRESENTATIONPLACEHOLDER_Y,
+ XML_TOK_PRESENTATIONPLACEHOLDER_WIDTH,
+ XML_TOK_PRESENTATIONPLACEHOLDER_HEIGHT
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+struct SdXMLltXDrawPageId
+{
+ bool operator()(sal_Int32 nId1, sal_Int32 nId2 ) const
+ {
+ return nId1 < nId2;
+ }
+};
+
+typedef std::map< sal_Int32, com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage >, SdXMLltXDrawPageId > DrawPageIdMap;
+
+//////////////////////////////////////////////////////////////////////////////
+
+class SvXMLUnitConverter;
+class SvXMLTokenMap;
+class XMLSdPropHdlFactory;
+class XMLPropertySetMapper;
+class XMLPropStyleContext;
+class SdXMLStylesContext;
+class SdXMLMasterStylesContext;
+
+//////////////////////////////////////////////////////////////////////////////
+
+struct DateTimeDeclContextImpl
+{
+ rtl::OUString maStrText;
+ sal_Bool mbFixed;
+ rtl::OUString maStrDateTimeFormat;
+
+ DateTimeDeclContextImpl() : mbFixed(sal_True) {}
+};
+
+DECLARE_STL_USTRINGACCESS_MAP( ::rtl::OUString, HeaderFooterDeclMap );
+DECLARE_STL_USTRINGACCESS_MAP( DateTimeDeclContextImpl, DateTimeDeclMap );
+
+//////////////////////////////////////////////////////////////////////////////
+
+class SdXMLImport: public SvXMLImport
+{
+ com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > mxDocStyleFamilies;
+ com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > mxDocMasterPages;
+ com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > mxDocDrawPages;
+ com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > mxPageLayouts;
+
+ // contexts for Style and AutoStyle import
+ SdXMLMasterStylesContext* mpMasterStylesContext;
+
+ // token map lists
+ SvXMLTokenMap* mpDocElemTokenMap;
+ SvXMLTokenMap* mpBodyElemTokenMap;
+ SvXMLTokenMap* mpStylesElemTokenMap;
+ SvXMLTokenMap* mpAutoStylesElemTokenMap;
+ SvXMLTokenMap* mpMasterPageElemTokenMap;
+ SvXMLTokenMap* mpMasterPageAttrTokenMap;
+ SvXMLTokenMap* mpPageMasterAttrTokenMap;
+ SvXMLTokenMap* mpPageMasterStyleAttrTokenMap;
+ SvXMLTokenMap* mpDocStyleAttrTokenMap;
+ SvXMLTokenMap* mpDocStyleElemTokenMap;
+ SvXMLTokenMap* mpDrawPageAttrTokenMap;
+ SvXMLTokenMap* mpDrawPageElemTokenMap;
+ SvXMLTokenMap* mpPresentationPlaceholderAttrTokenMap;
+
+ sal_uInt16 mnStyleFamilyMask;
+
+ sal_Int32 mnNewPageCount;
+ sal_Int32 mnNewMasterPageCount;
+
+ sal_Bool mbIsDraw;
+ sal_Bool mbLoadDoc;
+ sal_Bool mbPreview;
+
+ DrawPageIdMap maDrawPageIds;
+
+ ::rtl::OUString msPageLayouts;
+ ::rtl::OUString msPreview;
+
+ HeaderFooterDeclMap maHeaderDeclsMap;
+ HeaderFooterDeclMap maFooterDeclsMap;
+ DateTimeDeclMap maDateTimeDeclsMap;
+
+protected:
+ // This method is called after the namespace map has been updated, but
+ // before a context for the current element has been pushed.
+ virtual SvXMLImportContext *CreateContext(sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference<
+ com::sun::star::xml::sax::XAttributeList>& xAttrList);
+
+public:
+ // #110680#
+ SdXMLImport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ sal_Bool bIsDraw, sal_uInt16 nImportFlags = IMPORT_ALL );
+ ~SdXMLImport() throw ();
+
+ // XImporter
+ virtual void SAL_CALL setTargetDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ void SetProgress(sal_Int32 nProg);
+
+ virtual void SetViewSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aViewProps);
+ virtual void SetConfigurationSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aConfigProps);
+
+ // namespace office
+ // NB: in contrast to other CreateFooContexts, this particular one handles
+ // the root element (i.e. office:document-meta)
+ SvXMLImportContext* CreateMetaContext(const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
+ SvXMLImportContext* CreateScriptContext( const ::rtl::OUString& rLocalName );
+ SvXMLImportContext* CreateBodyContext(const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
+ SvXMLStylesContext* CreateStylesContext(const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
+ SvXMLStylesContext* CreateAutoStylesContext(const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
+ SvXMLImportContext* CreateMasterStylesContext(const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
+ SvXMLImportContext *CreateFontDeclsContext(const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+ // Styles and AutoStyles contexts
+ const SdXMLMasterStylesContext* GetMasterStylesContext() const { return mpMasterStylesContext; }
+
+ sal_uInt16 GetStyleFamilyMask() const { return mnStyleFamilyMask; }
+ sal_Bool IsStylesOnlyMode() const { return !mbLoadDoc; }
+
+ const SvXMLTokenMap& GetDocElemTokenMap();
+ const SvXMLTokenMap& GetBodyElemTokenMap();
+ const SvXMLTokenMap& GetStylesElemTokenMap();
+ const SvXMLTokenMap& GetMasterPageElemTokenMap();
+ const SvXMLTokenMap& GetMasterPageAttrTokenMap();
+ const SvXMLTokenMap& GetPageMasterAttrTokenMap();
+ const SvXMLTokenMap& GetPageMasterStyleAttrTokenMap();
+ const SvXMLTokenMap& GetDrawPageAttrTokenMap();
+ const SvXMLTokenMap& GetDrawPageElemTokenMap();
+ const SvXMLTokenMap& GetPresentationPlaceholderAttrTokenMap();
+
+ // export local parameters concerning page access and similar
+ const com::sun::star::uno::Reference<
+ com::sun::star::container::XNameAccess >& GetLocalDocStyleFamilies() const { return mxDocStyleFamilies; }
+ const com::sun::star::uno::Reference<
+ com::sun::star::container::XIndexAccess >& GetLocalMasterPages() const { return mxDocMasterPages; }
+ const com::sun::star::uno::Reference<
+ com::sun::star::container::XIndexAccess >& GetLocalDrawPages() const { return mxDocDrawPages; }
+
+ sal_Int32 GetNewPageCount() const { return mnNewPageCount; }
+ void IncrementNewPageCount() { mnNewPageCount++; }
+ sal_Int32 GetNewMasterPageCount() const { return mnNewMasterPageCount; }
+ void IncrementNewMasterPageCount() { mnNewMasterPageCount++; }
+
+ com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > getPageLayouts() const { return mxPageLayouts; }
+
+ sal_Bool IsDraw() const { return mbIsDraw; }
+ sal_Bool IsImpress() const { return !mbIsDraw; }
+
+ // import pool defaults. Parameter contains pool defaults read
+ // from input data. These data needs to be set at the model.
+ void ImportPoolDefaults(const XMLPropStyleContext* pPool);
+
+ // #80365#
+ virtual void SetStatistics(
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue> & i_rStats);
+
+ sal_Bool IsPreview() const { return mbPreview; }
+
+ // XServiceInfo ( : SvXMLExport )
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
+
+ void AddHeaderDecl( const ::rtl::OUString& rName, const ::rtl::OUString& rText );
+ void AddFooterDecl( const ::rtl::OUString& rName, const ::rtl::OUString& rText );
+ void AddDateTimeDecl( const ::rtl::OUString& rName, const ::rtl::OUString& rText, sal_Bool bFixed, const ::rtl::OUString& rDateTimeFormat );
+
+ ::rtl::OUString GetHeaderDecl( const ::rtl::OUString& rName ) const;
+ ::rtl::OUString GetFooterDecl( const ::rtl::OUString& rName ) const;
+ ::rtl::OUString GetDateTimeDecl( const ::rtl::OUString& rName, sal_Bool& rbFixed, ::rtl::OUString& rDateTimeFormat );
+
+};
+
+#endif // _SDXMLIMP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx
new file mode 100644
index 000000000000..c3f66197a403
--- /dev/null
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -0,0 +1,1286 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <memory>
+
+#include "unointerfacetouniqueidentifiermapper.hxx"
+#include <com/sun/star/presentation/ClickAction.hpp>
+#include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/chart/XChartDocument.hpp>
+#include <com/sun/star/drawing/XControlShape.hpp>
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/drawing/XGluePointsSupplier.hpp>
+#include <com/sun/star/container/XIdentifierAccess.hpp>
+#include <com/sun/star/drawing/GluePoint2.hpp>
+#include <com/sun/star/drawing/Alignment.hpp>
+#include <com/sun/star/drawing/EscapeDirection.hpp>
+#include <com/sun/star/table/XColumnRowRange.hpp>
+#include <xmloff/xmluconv.hxx>
+#include "PropertySetMerger.hxx"
+
+#include <xmloff/shapeexport.hxx>
+#include "sdpropls.hxx"
+#include "sdxmlexp_impl.hxx"
+#include <xmloff/families.hxx>
+#include <tools/debug.hxx>
+#include <xmloff/contextid.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <tools/string.hxx>
+#include <sot/clsids.hxx>
+#include <tools/globname.hxx>
+#include <com/sun/star/beans/XPropertyState.hpp>
+
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/drawing/XCustomShapeEngine.hpp>
+
+#include "xmloff/xmlnmspe.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+//////////////////////////////////////////////////////////////////////////////
+
+XMLShapeExport::XMLShapeExport(SvXMLExport& rExp,
+ SvXMLExportPropertyMapper *pExtMapper )
+: mrExport( rExp ),
+ mnNextUniqueShapeId(1),
+ maShapesInfos(),
+ maCurrentShapesIter(maShapesInfos.end()),
+ mbExportLayer( sal_False ),
+ // #88546# init to sal_False
+ mbHandleProgressBar( sal_False ),
+ msZIndex( RTL_CONSTASCII_USTRINGPARAM("ZOrder") ),
+ msPrintable( RTL_CONSTASCII_USTRINGPARAM("Printable") ),
+ msVisible( RTL_CONSTASCII_USTRINGPARAM("Visible") ),
+ msEmptyPres( RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ),
+ msModel( RTL_CONSTASCII_USTRINGPARAM("Model") ),
+ msStartShape( RTL_CONSTASCII_USTRINGPARAM("StartShape") ),
+ msEndShape( RTL_CONSTASCII_USTRINGPARAM("EndShape") ),
+ msOnClick( RTL_CONSTASCII_USTRINGPARAM("OnClick") ),
+ msEventType( RTL_CONSTASCII_USTRINGPARAM("EventType") ),
+ msPresentation( RTL_CONSTASCII_USTRINGPARAM("Presentation") ),
+ msMacroName( RTL_CONSTASCII_USTRINGPARAM("MacroName") ),
+ msScript( RTL_CONSTASCII_USTRINGPARAM("Script") ),
+ msLibrary( RTL_CONSTASCII_USTRINGPARAM("Library") ),
+ msClickAction( RTL_CONSTASCII_USTRINGPARAM("ClickAction") ),
+ msBookmark( RTL_CONSTASCII_USTRINGPARAM("Bookmark") ),
+ msEffect( RTL_CONSTASCII_USTRINGPARAM("Effect") ),
+ msPlayFull( RTL_CONSTASCII_USTRINGPARAM("PlayFull") ),
+ msVerb( RTL_CONSTASCII_USTRINGPARAM("Verb") ),
+ msSoundURL( RTL_CONSTASCII_USTRINGPARAM("SoundURL") ),
+ msSpeed( RTL_CONSTASCII_USTRINGPARAM("Speed") ),
+ msStarBasic( RTL_CONSTASCII_USTRINGPARAM("StarBasic") )
+{
+ // construct PropertyHandlerFactory
+ mxSdPropHdlFactory = new XMLSdPropHdlFactory( mrExport.GetModel(), rExp );
+ // construct PropertySetMapper
+ mxPropertySetMapper = CreateShapePropMapper( mrExport );
+ if( pExtMapper )
+ {
+ UniReference < SvXMLExportPropertyMapper > xExtMapper( pExtMapper );
+ mxPropertySetMapper->ChainExportMapper( xExtMapper );
+ }
+
+/*
+ // chain text attributes
+ xPropertySetMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaExtPropMapper(rExp));
+*/
+
+ mrExport.GetAutoStylePool()->AddFamily(
+ XML_STYLE_FAMILY_SD_GRAPHICS_ID,
+ OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_NAME)),
+ GetPropertySetMapper(),
+ OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_PREFIX)));
+ mrExport.GetAutoStylePool()->AddFamily(
+ XML_STYLE_FAMILY_SD_PRESENTATION_ID,
+ OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_PRESENTATION_NAME)),
+ GetPropertySetMapper(),
+ OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_PRESENTATION_PREFIX)));
+
+ maCurrentInfo = maShapeInfos.end();
+
+ // create table export helper and let him add his families in time
+ GetShapeTableExport();
+}
+
+///////////////////////////////////////////////////////////////////////
+
+XMLShapeExport::~XMLShapeExport()
+{
+}
+
+///////////////////////////////////////////////////////////////////////
+
+// sj: replacing CustomShapes with standard objects that are also supported in OpenOffice.org format
+uno::Reference< drawing::XShape > XMLShapeExport::checkForCustomShapeReplacement( const uno::Reference< drawing::XShape >& xShape )
+{
+ uno::Reference< drawing::XShape > xCustomShapeReplacement;
+
+ if( ( GetExport().getExportFlags() & EXPORT_OASIS ) == 0 )
+ {
+ String aType( (OUString)xShape->getShapeType() );
+ if( aType.EqualsAscii( (const sal_Char*)"com.sun.star.drawing.CustomShape" ) )
+ {
+ uno::Reference< beans::XPropertySet > xSet( xShape, uno::UNO_QUERY );
+ if( xSet.is() )
+ {
+ rtl::OUString aEngine;
+ xSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "CustomShapeEngine" ) ) ) >>= aEngine;
+ if ( !aEngine.getLength() )
+ aEngine = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.EnhancedCustomShapeEngine" ) );
+
+ uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+
+ if ( aEngine.getLength() && xFactory.is() )
+ {
+ uno::Sequence< uno::Any > aArgument( 1 );
+ uno::Sequence< beans::PropertyValue > aPropValues( 2 );
+ aPropValues[ 0 ].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "CustomShape" ));
+ aPropValues[ 0 ].Value <<= xShape;
+ sal_Bool bForceGroupWithText = sal_True;
+ aPropValues[ 1 ].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ForceGroupWithText" ));
+ aPropValues[ 1 ].Value <<= bForceGroupWithText;
+ aArgument[ 0 ] <<= aPropValues;
+ uno::Reference< uno::XInterface > xInterface( xFactory->createInstanceWithArguments( aEngine, aArgument ) );
+ if ( xInterface.is() )
+ {
+ uno::Reference< drawing::XCustomShapeEngine > xCustomShapeEngine(
+ uno::Reference< drawing::XCustomShapeEngine >( xInterface, uno::UNO_QUERY ) );
+ if ( xCustomShapeEngine.is() )
+ xCustomShapeReplacement = xCustomShapeEngine->render();
+ }
+ }
+ }
+ }
+ }
+ return xCustomShapeReplacement;
+}
+
+// This method collects all automatic styles for the given XShape
+void XMLShapeExport::collectShapeAutoStyles(const uno::Reference< drawing::XShape >& xShape )
+{
+ if( maCurrentShapesIter == maShapesInfos.end() )
+ {
+ OSL_FAIL( "XMLShapeExport::collectShapeAutoStyles(): no call to seekShapes()!" );
+ return;
+ }
+ sal_Int32 nZIndex = 0;
+ uno::Reference< beans::XPropertySet > xSet( xShape, uno::UNO_QUERY );
+ if( xSet.is() )
+ xSet->getPropertyValue(msZIndex) >>= nZIndex;
+
+ ImplXMLShapeExportInfoVector& aShapeInfoVector = (*maCurrentShapesIter).second;
+
+ if( (sal_Int32)aShapeInfoVector.size() <= nZIndex )
+ {
+ OSL_FAIL( "XMLShapeExport::collectShapeAutoStyles(): no shape info allocated for a given shape" );
+ return;
+ }
+
+ ImplXMLShapeExportInfo& aShapeInfo = aShapeInfoVector[nZIndex];
+
+ uno::Reference< drawing::XShape > xCustomShapeReplacement = checkForCustomShapeReplacement( xShape );
+ if ( xCustomShapeReplacement.is() )
+ aShapeInfo.xCustomShapeReplacement = xCustomShapeReplacement;
+
+ // -----------------------------
+ // first compute the shapes type
+ // -----------------------------
+ ImpCalcShapeType(xShape, aShapeInfo.meShapeType);
+
+ const bool bObjSupportsText =
+ aShapeInfo.meShapeType != XmlShapeTypeDrawChartShape &&
+ aShapeInfo.meShapeType != XmlShapeTypePresChartShape &&
+ aShapeInfo.meShapeType != XmlShapeTypeDrawOLE2Shape &&
+ aShapeInfo.meShapeType != XmlShapeTypePresOLE2Shape &&
+ aShapeInfo.meShapeType != XmlShapeTypeDrawSheetShape &&
+ aShapeInfo.meShapeType != XmlShapeTypePresSheetShape &&
+ aShapeInfo.meShapeType != XmlShapeTypeDraw3DSceneObject &&
+ aShapeInfo.meShapeType != XmlShapeTypeDraw3DCubeObject &&
+ aShapeInfo.meShapeType != XmlShapeTypeDraw3DSphereObject &&
+ aShapeInfo.meShapeType != XmlShapeTypeDraw3DLatheObject &&
+ aShapeInfo.meShapeType != XmlShapeTypeDraw3DExtrudeObject &&
+ aShapeInfo.meShapeType != XmlShapeTypeDrawPageShape &&
+ aShapeInfo.meShapeType != XmlShapeTypePresPageShape &&
+ aShapeInfo.meShapeType != XmlShapeTypeDrawGroupShape;
+
+ const bool bObjSupportsStyle =
+ aShapeInfo.meShapeType != XmlShapeTypeDrawGroupShape;
+
+ sal_Bool bIsEmptyPresObj = sal_False;
+
+ uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
+ if ( aShapeInfo.xCustomShapeReplacement.is() )
+ xPropSet.clear();
+
+ // ----------------
+ // prep text styles
+ // ----------------
+ if( xPropSet.is() && bObjSupportsText )
+ {
+ uno::Reference< text::XText > xText(xShape, uno::UNO_QUERY);
+ if(xText.is() && xText->getString().getLength())
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
+
+ if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(msEmptyPres) )
+ {
+ uno::Any aAny = xPropSet->getPropertyValue(msEmptyPres);
+ aAny >>= bIsEmptyPresObj;
+ }
+
+ if(!bIsEmptyPresObj)
+ {
+ GetExport().GetTextParagraphExport()->collectTextAutoStyles( xText );
+ }
+ }
+ }
+
+ // ------------------------------
+ // compute the shape parent style
+ // ------------------------------
+ if( xPropSet.is() )
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( xPropSet->getPropertySetInfo() );
+
+ OUString aParentName;
+ uno::Reference< style::XStyle > xStyle;
+
+ if( bObjSupportsStyle )
+ {
+ if( xPropertySetInfo.is() && xPropertySetInfo->hasPropertyByName( OUString(RTL_CONSTASCII_USTRINGPARAM("Style"))) )
+ xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Style"))) >>= xStyle;
+
+ if(xStyle.is())
+ {
+ // get family ID
+ uno::Reference< beans::XPropertySet > xStylePropSet(xStyle, uno::UNO_QUERY);
+ DBG_ASSERT( xStylePropSet.is(), "style without a XPropertySet?" );
+ try
+ {
+ if(xStylePropSet.is())
+ {
+ OUString aFamilyName;
+ xStylePropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Family"))) >>= aFamilyName;
+ if(aFamilyName.getLength() && !aFamilyName.equals(OUString(RTL_CONSTASCII_USTRINGPARAM("graphics"))))
+ aShapeInfo.mnFamily = XML_STYLE_FAMILY_SD_PRESENTATION_ID;
+ }
+ }
+ catch(beans::UnknownPropertyException aException)
+ {
+ // Ignored.
+ DBG_ASSERT(false,
+ "XMLShapeExport::collectShapeAutoStyles: style has no 'Family' property");
+ }
+
+ // get parent-style name
+ if(XML_STYLE_FAMILY_SD_PRESENTATION_ID == aShapeInfo.mnFamily)
+ {
+ aParentName = msPresentationStylePrefix;
+ }
+
+ aParentName += xStyle->getName();
+ }
+ }
+
+ // filter propset
+ std::vector< XMLPropertyState > xPropStates;
+
+ sal_Int32 nCount = 0;
+ if( (!bIsEmptyPresObj || (aShapeInfo.meShapeType != XmlShapeTypePresPageShape)) )
+ {
+ xPropStates = GetPropertySetMapper()->Filter( xPropSet );
+
+ if (XmlShapeTypeDrawControlShape == aShapeInfo.meShapeType)
+ {
+ // for control shapes, we additionally need the number format style (if any)
+ uno::Reference< drawing::XControlShape > xControl(xShape, uno::UNO_QUERY);
+ DBG_ASSERT(xControl.is(), "XMLShapeExport::collectShapeAutoStyles: ShapeType control, but no XControlShape!");
+ if (xControl.is())
+ {
+ uno::Reference< beans::XPropertySet > xControlModel(xControl->getControl(), uno::UNO_QUERY);
+ DBG_ASSERT(xControlModel.is(), "XMLShapeExport::collectShapeAutoStyles: no control model on the control shape!");
+
+ ::rtl::OUString sNumberStyle = mrExport.GetFormExport()->getControlNumberStyle(xControlModel);
+ if (0 != sNumberStyle.getLength())
+ {
+ sal_Int32 nIndex = GetPropertySetMapper()->getPropertySetMapper()->FindEntryIndex(CTF_SD_CONTROL_SHAPE_DATA_STYLE);
+ // TODO : this retrieval of the index could be moved into the ctor, holding the index
+ // as member, thus saving time.
+ DBG_ASSERT(-1 != nIndex, "XMLShapeExport::collectShapeAutoStyles: could not obtain the index for our context id!");
+
+ XMLPropertyState aNewState(nIndex, uno::makeAny(sNumberStyle));
+ xPropStates.push_back(aNewState);
+ }
+ }
+ }
+
+ std::vector< XMLPropertyState >::iterator aIter = xPropStates.begin();
+ std::vector< XMLPropertyState >::iterator aEnd = xPropStates.end();
+ while( aIter != aEnd )
+ {
+ if( aIter->mnIndex != -1 )
+ nCount++;
+ ++aIter;
+ }
+ }
+
+ if(nCount == 0)
+ {
+ // no hard attributes, use parent style name for export
+ aShapeInfo.msStyleName = aParentName;
+ }
+ else
+ {
+ // there are filtered properties -> hard attributes
+ // try to find this style in AutoStylePool
+ aShapeInfo.msStyleName = mrExport.GetAutoStylePool()->Find(aShapeInfo.mnFamily, aParentName, xPropStates);
+
+ if(!aShapeInfo.msStyleName.getLength())
+ {
+ // Style did not exist, add it to AutoStalePool
+ aShapeInfo.msStyleName = mrExport.GetAutoStylePool()->Add(aShapeInfo.mnFamily, aParentName, xPropStates);
+ }
+ }
+
+ // optionaly generate auto style for text attributes
+ if( (!bIsEmptyPresObj || (aShapeInfo.meShapeType != XmlShapeTypePresPageShape)) && bObjSupportsText )
+ {
+ xPropStates = GetExport().GetTextParagraphExport()->GetParagraphPropertyMapper()->Filter( xPropSet );
+
+ // ----------------------------------------------------------------------
+ // yet more additionally, we need to care for the ParaAdjust property
+ if ( XmlShapeTypeDrawControlShape == aShapeInfo.meShapeType )
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
+ uno::Reference< beans::XPropertyState > xPropState( xPropSet, uno::UNO_QUERY );
+ if ( xPropSetInfo.is() && xPropState.is() )
+ {
+ // this is because:
+ // * if controls shapes have a ParaAdjust property, then this is the Align property of the control model
+ // * control models are allowed to have an Align of "void"
+ // * the Default for control model's Align is TextAlign_LEFT
+ // * defaults for style properties are not written, but we need to write the "left",
+ // because we need to distiguish this "left" from the case where not align attribute
+ // is present which means "void"
+ static const ::rtl::OUString s_sParaAdjustPropertyName( RTL_CONSTASCII_USTRINGPARAM( "ParaAdjust" ) );
+ if ( xPropSetInfo->hasPropertyByName( s_sParaAdjustPropertyName )
+ && ( beans::PropertyState_DEFAULT_VALUE == xPropState->getPropertyState( s_sParaAdjustPropertyName ) )
+ )
+ {
+ sal_Int32 nIndex = GetExport().GetTextParagraphExport()->GetParagraphPropertyMapper()->getPropertySetMapper()->FindEntryIndex( CTF_SD_SHAPE_PARA_ADJUST );
+ // TODO : this retrieval of the index should be moved into the ctor, holding the index
+ // as member, thus saving time.
+ DBG_ASSERT(-1 != nIndex, "XMLShapeExport::collectShapeAutoStyles: could not obtain the index for the ParaAdjust context id!");
+
+ uno::Any aParaAdjustValue = xPropSet->getPropertyValue( s_sParaAdjustPropertyName );
+ XMLPropertyState aAlignDefaultState( nIndex, aParaAdjustValue );
+
+ xPropStates.push_back( aAlignDefaultState );
+ }
+ }
+ }
+ // ----------------------------------------------------------------------
+
+ nCount = 0;
+ std::vector< XMLPropertyState >::iterator aIter = xPropStates.begin();
+ std::vector< XMLPropertyState >::iterator aEnd = xPropStates.end();
+ while( aIter != aEnd )
+ {
+ if( aIter->mnIndex != -1 )
+ nCount++;
+ ++aIter;
+ }
+
+ if( nCount )
+ {
+ const OUString aEmpty;
+ aShapeInfo.msTextStyleName = mrExport.GetAutoStylePool()->Find( XML_STYLE_FAMILY_TEXT_PARAGRAPH, aEmpty, xPropStates );
+ if(!aShapeInfo.msTextStyleName.getLength())
+ {
+ // Style did not exist, add it to AutoStalePool
+ aShapeInfo.msTextStyleName = mrExport.GetAutoStylePool()->Add(XML_STYLE_FAMILY_TEXT_PARAGRAPH, aEmpty, xPropStates);
+ }
+ }
+ }
+ }
+
+ // ----------------------------------------
+ // prepare animation informations if needed
+ // ----------------------------------------
+ if( mxAnimationsExporter.is() )
+ mxAnimationsExporter->prepare( xShape, mrExport );
+
+ // check for special shapes
+
+ switch( aShapeInfo.meShapeType )
+ {
+ case XmlShapeTypeDrawConnectorShape:
+ {
+ uno::Reference< uno::XInterface > xConnection;
+
+ // create shape ids for export later
+ xPropSet->getPropertyValue( msStartShape ) >>= xConnection;
+ if( xConnection.is() )
+ mrExport.getInterfaceToIdentifierMapper().registerReference( xConnection );
+
+ xPropSet->getPropertyValue( msEndShape ) >>= xConnection;
+ if( xConnection.is() )
+ mrExport.getInterfaceToIdentifierMapper().registerReference( xConnection );
+ break;
+ }
+ case XmlShapeTypePresTableShape:
+ case XmlShapeTypeDrawTableShape:
+ {
+ try
+ {
+ uno::Reference< table::XColumnRowRange > xRange( xSet->getPropertyValue( msModel ), uno::UNO_QUERY_THROW );
+ GetShapeTableExport()->collectTableAutoStyles( xRange );
+ }
+ catch( uno::Exception& )
+ {
+ OSL_FAIL( "XMLShapeExport::collectShapeAutoStyles(): exception caught while collection auto styles for a table!" );
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ maShapeInfos.push_back( aShapeInfo );
+ maCurrentInfo = maShapeInfos.begin();
+
+ // -----------------------------------------------------
+ // check for shape collections (group shape or 3d scene)
+ // and collect contained shapes style infos
+ // -----------------------------------------------------
+ const uno::Reference< drawing::XShape >& xCollection = aShapeInfo.xCustomShapeReplacement.is()
+ ? aShapeInfo.xCustomShapeReplacement : xShape;
+ {
+ uno::Reference< drawing::XShapes > xShapes( xCollection, uno::UNO_QUERY );
+ if( xShapes.is() )
+ {
+ collectShapesAutoStyles( xShapes );
+ }
+ }
+}
+
+///////////////////////////////////////////////////////////////////////
+
+namespace
+{
+ class NewTextListsHelper
+ {
+ public:
+ NewTextListsHelper( SvXMLExport& rExp )
+ : mrExport( rExp )
+ {
+ mrExport.GetTextParagraphExport()->PushNewTextListsHelper();
+ }
+
+ ~NewTextListsHelper()
+ {
+ mrExport.GetTextParagraphExport()->PopTextListsHelper();
+ }
+
+ private:
+ SvXMLExport& mrExport;
+ };
+}
+// This method exports the given XShape
+void XMLShapeExport::exportShape(const uno::Reference< drawing::XShape >& xShape,
+ sal_Int32 nFeatures /* = SEF_DEFAULT */,
+ com::sun::star::awt::Point* pRefPoint /* = NULL */,
+ SvXMLAttributeList* pAttrList /* = NULL */ )
+{
+ if( maCurrentShapesIter == maShapesInfos.end() )
+ {
+ OSL_FAIL( "XMLShapeExport::exportShape(): no auto styles where collected before export" );
+ return;
+ }
+ sal_Int32 nZIndex = 0;
+ uno::Reference< beans::XPropertySet > xSet( xShape, uno::UNO_QUERY );
+
+
+ ::std::auto_ptr< SvXMLElementExport > mpHyperlinkElement;
+
+ // export hyperlinks with <a><shape/></a>. Currently only in draw since draw
+ // does not support document events
+ if( xSet.is() && (GetExport().GetModelType() == SvtModuleOptions::E_DRAW) ) try
+ {
+ presentation::ClickAction eAction = presentation::ClickAction_NONE;
+ xSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("OnClick"))) >>= eAction;
+
+ if( (eAction == presentation::ClickAction_DOCUMENT) ||
+ (eAction == presentation::ClickAction_BOOKMARK) )
+ {
+ OUString sURL;
+ xSet->getPropertyValue(msBookmark) >>= sURL;
+
+ if( sURL.getLength() )
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, sURL );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+ mpHyperlinkElement.reset( new SvXMLElementExport(mrExport, XML_NAMESPACE_DRAW, XML_A, sal_True, sal_True) );
+ }
+ }
+ }
+ catch( uno::Exception& )
+ {
+ OSL_FAIL("XMLShapeExport::exportShape(): exception during hyperlink export");
+ }
+
+
+ if( xSet.is() )
+ xSet->getPropertyValue(msZIndex) >>= nZIndex;
+
+ ImplXMLShapeExportInfoVector& aShapeInfoVector = (*maCurrentShapesIter).second;
+
+ if( (sal_Int32)aShapeInfoVector.size() <= nZIndex )
+ {
+ OSL_FAIL( "XMLShapeExport::exportShape(): no shape info collected for a given shape" );
+ return;
+ }
+
+ NewTextListsHelper aNewTextListsHelper( mrExport );
+
+ const ImplXMLShapeExportInfo& aShapeInfo = aShapeInfoVector[nZIndex];
+
+
+#ifdef DBG_UTIL
+ // ---------------------------------------
+ // check if this is the correct ShapesInfo
+ // ---------------------------------------
+ uno::Reference< container::XChild > xChild( xShape, uno::UNO_QUERY );
+ if( xChild.is() )
+ {
+ uno::Reference< drawing::XShapes > xParent( xChild->getParent(), uno::UNO_QUERY );
+ DBG_ASSERT( xParent.is() && xParent.get() == (*maCurrentShapesIter).first.get(), "XMLShapeExport::exportShape(): Wrong call to XMLShapeExport::seekShapes()" );
+ }
+
+ // -----------------------------
+ // first compute the shapes type
+ // -----------------------------
+ {
+ XmlShapeType eShapeType(XmlShapeTypeNotYetSet);
+ ImpCalcShapeType(xShape, eShapeType);
+
+ DBG_ASSERT( eShapeType == aShapeInfo.meShapeType, "exportShape callings do not correspond to collectShapeAutoStyles calls!" );
+ }
+#endif
+
+ // ----------------------------------------
+ // collect animation informations if needed
+ // ----------------------------------------
+ if( mxAnimationsExporter.is() )
+ mxAnimationsExporter->collect( xShape, mrExport );
+
+ /* Export shapes name if he has one (#i51726#)
+ Export of the shape name for text documents only if the OpenDocument
+ file format is written - exceptions are group shapes.
+ Note: Writer documents in OpenOffice.org file format doesn't contain
+ any names for shapes, except for group shapes.
+ */
+ {
+ if ( ( GetExport().GetModelType() != SvtModuleOptions::E_WRITER &&
+ GetExport().GetModelType() != SvtModuleOptions::E_WRITERWEB &&
+ GetExport().GetModelType() != SvtModuleOptions::E_WRITERGLOBAL ) ||
+ ( GetExport().getExportFlags() & EXPORT_OASIS ) != 0 ||
+ aShapeInfo.meShapeType == XmlShapeTypeDrawGroupShape ||
+ ( aShapeInfo.meShapeType == XmlShapeTypeDrawCustomShape &&
+ aShapeInfo.xCustomShapeReplacement.is() ) )
+ {
+ uno::Reference< container::XNamed > xNamed( xShape, uno::UNO_QUERY );
+ if( xNamed.is() )
+ {
+ const OUString aName( xNamed->getName() );
+ if( aName.getLength() )
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_NAME, aName );
+ }
+ }
+ }
+
+ // ------------------
+ // export style name
+ // ------------------
+ if( aShapeInfo.msStyleName.getLength() != 0 )
+ {
+ if(XML_STYLE_FAMILY_SD_GRAPHICS_ID == aShapeInfo.mnFamily)
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME, mrExport.EncodeStyleName( aShapeInfo.msStyleName) );
+ else
+ mrExport.AddAttribute(XML_NAMESPACE_PRESENTATION, XML_STYLE_NAME, mrExport.EncodeStyleName( aShapeInfo.msStyleName) );
+ }
+
+ // ------------------
+ // export text style name
+ // ------------------
+ if( aShapeInfo.msTextStyleName.getLength() != 0 )
+ {
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_TEXT_STYLE_NAME, aShapeInfo.msTextStyleName );
+ }
+
+ // --------------------------
+ // export shapes id if needed
+ // --------------------------
+ {
+ uno::Reference< uno::XInterface > xRef( xShape, uno::UNO_QUERY );
+ const OUString& rShapeId = mrExport.getInterfaceToIdentifierMapper().getIdentifier( xRef );
+ if( rShapeId.getLength() )
+ {
+ mrExport.AddAttributeIdLegacy(XML_NAMESPACE_DRAW, rShapeId);
+ }
+ }
+
+ // --------------------------
+ // export layer information
+ // --------------------------
+ if( IsLayerExportEnabled() )
+ {
+ // check for group or scene shape and not export layer if this is one
+ uno::Reference< drawing::XShapes > xShapes( xShape, uno::UNO_QUERY );
+ if( !xShapes.is() )
+ {
+ try
+ {
+ uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY );
+ OUString aLayerName;
+ xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM( "LayerName" )) ) >>= aLayerName;
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_LAYER, aLayerName );
+
+ }
+ catch( uno::Exception e )
+ {
+ OSL_FAIL( "could not export layer name for shape!" );
+ }
+ }
+ }
+
+ // export draw:display (do not export in ODF 1.2 or older)
+ if( xSet.is() && ( mrExport.getDefaultVersion() > SvtSaveOptions::ODFVER_012 ) )
+ {
+ if( aShapeInfo.meShapeType != XmlShapeTypeDrawPageShape && aShapeInfo.meShapeType != XmlShapeTypePresPageShape &&
+ aShapeInfo.meShapeType != XmlShapeTypeHandoutShape && aShapeInfo.meShapeType != XmlShapeTypeDrawChartShape )
+
+ try
+ {
+ sal_Bool bVisible = sal_True;
+ sal_Bool bPrintable = sal_True;
+
+ xSet->getPropertyValue(msVisible) >>= bVisible;
+ xSet->getPropertyValue(msPrintable) >>= bPrintable;
+
+ XMLTokenEnum eDisplayToken = XML_TOKEN_INVALID;
+ const unsigned short nDisplay = (bVisible ? 2 : 0) | (bPrintable ? 1 : 0);
+ switch( nDisplay )
+ {
+ case 0: eDisplayToken = XML_NONE; break;
+ case 1: eDisplayToken = XML_PRINTER; break;
+ case 2: eDisplayToken = XML_SCREEN; break;
+ // case 3: eDisplayToken = XML_ALWAYS break; this is the default
+ }
+
+ if( eDisplayToken != XML_TOKEN_INVALID )
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW_EXT, XML_DISPLAY, eDisplayToken );
+ }
+ catch( uno::Exception& )
+ {
+ OSL_FAIL( "XMLShapeExport::exportShape(), exception caught!" );
+ }
+ }
+
+ // #82003# test export count
+ // #91587# ALWAYS increment since now ALL to be exported shapes are counted.
+ if(mrExport.GetShapeExport()->IsHandleProgressBarEnabled())
+ {
+ mrExport.GetProgressBarHelper()->Increment();
+ }
+
+ onExport( xShape );
+
+ // --------------------
+ // export shape element
+ // --------------------
+ switch(aShapeInfo.meShapeType)
+ {
+ case XmlShapeTypeDrawRectangleShape:
+ {
+ ImpExportRectangleShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+ case XmlShapeTypeDrawEllipseShape:
+ {
+ ImpExportEllipseShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+ case XmlShapeTypeDrawLineShape:
+ {
+ ImpExportLineShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+ case XmlShapeTypeDrawPolyPolygonShape: // closed PolyPolygon
+ case XmlShapeTypeDrawPolyLineShape: // open PolyPolygon
+ case XmlShapeTypeDrawClosedBezierShape: // closed PolyPolygon containing curves
+ case XmlShapeTypeDrawOpenBezierShape: // open PolyPolygon containing curves
+ {
+ ImpExportPolygonShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+
+ case XmlShapeTypeDrawTextShape:
+ case XmlShapeTypePresTitleTextShape:
+ case XmlShapeTypePresOutlinerShape:
+ case XmlShapeTypePresSubtitleShape:
+ case XmlShapeTypePresNotesShape:
+ case XmlShapeTypePresHeaderShape:
+ case XmlShapeTypePresFooterShape:
+ case XmlShapeTypePresSlideNumberShape:
+ case XmlShapeTypePresDateTimeShape:
+ {
+ ImpExportTextBoxShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+
+ case XmlShapeTypeDrawGraphicObjectShape:
+ case XmlShapeTypePresGraphicObjectShape:
+ {
+ ImpExportGraphicObjectShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+
+ case XmlShapeTypeDrawChartShape:
+ case XmlShapeTypePresChartShape:
+ {
+ ImpExportChartShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint, pAttrList );
+ break;
+ }
+
+ case XmlShapeTypeDrawControlShape:
+ {
+ ImpExportControlShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+
+ case XmlShapeTypeDrawConnectorShape:
+ {
+ ImpExportConnectorShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+
+ case XmlShapeTypeDrawMeasureShape:
+ {
+ ImpExportMeasureShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+
+ case XmlShapeTypeDrawOLE2Shape:
+ case XmlShapeTypePresOLE2Shape:
+ case XmlShapeTypeDrawSheetShape:
+ case XmlShapeTypePresSheetShape:
+ {
+ ImpExportOLE2Shape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+
+ case XmlShapeTypePresTableShape:
+ case XmlShapeTypeDrawTableShape:
+ {
+ ImpExportTableShape( xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+
+ case XmlShapeTypeDrawPageShape:
+ case XmlShapeTypePresPageShape:
+ case XmlShapeTypeHandoutShape:
+ {
+ ImpExportPageShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+
+ case XmlShapeTypeDrawCaptionShape:
+ {
+ ImpExportCaptionShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+
+ case XmlShapeTypeDraw3DCubeObject:
+ case XmlShapeTypeDraw3DSphereObject:
+ case XmlShapeTypeDraw3DLatheObject:
+ case XmlShapeTypeDraw3DExtrudeObject:
+ {
+ ImpExport3DShape(xShape, aShapeInfo.meShapeType);
+ break;
+ }
+
+ case XmlShapeTypeDraw3DSceneObject:
+ {
+ ImpExport3DSceneShape( xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+
+ case XmlShapeTypeDrawGroupShape:
+ {
+ // empty group
+ ImpExportGroupShape( xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+
+ case XmlShapeTypeDrawFrameShape:
+ {
+ ImpExportFrameShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+
+ case XmlShapeTypeDrawAppletShape:
+ {
+ ImpExportAppletShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+
+ case XmlShapeTypeDrawPluginShape:
+ {
+ ImpExportPluginShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+
+ case XmlShapeTypeDrawCustomShape:
+ {
+ if ( aShapeInfo.xCustomShapeReplacement.is() )
+ ImpExportGroupShape( aShapeInfo.xCustomShapeReplacement, XmlShapeTypeDrawGroupShape, nFeatures, pRefPoint );
+ else
+ ImpExportCustomShape( xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+
+ case XmlShapeTypePresMediaShape:
+ case XmlShapeTypeDrawMediaShape:
+ {
+ ImpExportMediaShape( xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+
+ case XmlShapeTypePresOrgChartShape:
+ case XmlShapeTypeUnknown:
+ case XmlShapeTypeNotYetSet:
+ default:
+ {
+ // this should never happen and is an error
+ OSL_FAIL("XMLEXP: WriteShape: unknown or unexpected type of shape in export!");
+ break;
+ }
+ }
+
+ mpHyperlinkElement.reset();
+
+ // #97489# #97111#
+ // if there was an error and no element for the shape was exported
+ // we need to clear the attribute list or the attributes will be
+ // set on the next exported element, which can result in corrupt
+ // xml files due to duplicate attributes
+
+ mrExport.CheckAttrList(); // asserts in non pro if we have attributes left
+ mrExport.ClearAttrList(); // clears the attributes
+}
+
+///////////////////////////////////////////////////////////////////////
+
+// This method collects all automatic styles for the shapes inside the given XShapes collection
+void XMLShapeExport::collectShapesAutoStyles( const uno::Reference < drawing::XShapes >& xShapes )
+{
+ ShapesInfos::iterator aOldCurrentShapesIter = maCurrentShapesIter;
+ seekShapes( xShapes );
+
+ uno::Reference< drawing::XShape > xShape;
+ const sal_Int32 nShapeCount(xShapes->getCount());
+ for(sal_Int32 nShapeId = 0; nShapeId < nShapeCount; nShapeId++)
+ {
+ xShapes->getByIndex(nShapeId) >>= xShape;
+ DBG_ASSERT( xShape.is(), "Shape without a XShape?" );
+ if(!xShape.is())
+ continue;
+
+ collectShapeAutoStyles( xShape );
+ }
+
+ maCurrentShapesIter = aOldCurrentShapesIter;
+}
+
+///////////////////////////////////////////////////////////////////////
+
+// This method exports all XShape inside the given XShapes collection
+void XMLShapeExport::exportShapes( const uno::Reference < drawing::XShapes >& xShapes, sal_Int32 nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */ )
+{
+ ShapesInfos::iterator aOldCurrentShapesIter = maCurrentShapesIter;
+ seekShapes( xShapes );
+
+ uno::Reference< drawing::XShape > xShape;
+ const sal_Int32 nShapeCount(xShapes->getCount());
+ for(sal_Int32 nShapeId = 0; nShapeId < nShapeCount; nShapeId++)
+ {
+ xShapes->getByIndex(nShapeId) >>= xShape;
+ DBG_ASSERT( xShape.is(), "Shape without a XShape?" );
+ if(!xShape.is())
+ continue;
+
+ exportShape( xShape, nFeatures, pRefPoint );
+ }
+
+ maCurrentShapesIter = aOldCurrentShapesIter;
+}
+
+///////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::seekShapes( const uno::Reference< drawing::XShapes >& xShapes ) throw()
+{
+ if( xShapes.is() )
+ {
+ maCurrentShapesIter = maShapesInfos.find( xShapes );
+ if( maCurrentShapesIter == maShapesInfos.end() )
+ {
+ ImplXMLShapeExportInfoVector aNewInfoVector;
+ aNewInfoVector.resize( (ShapesInfos::size_type) xShapes->getCount() );
+ maShapesInfos[ xShapes ] = aNewInfoVector;
+
+ maCurrentShapesIter = maShapesInfos.find( xShapes );
+
+ DBG_ASSERT( maCurrentShapesIter != maShapesInfos.end(), "XMLShapeExport::seekShapes(): insert into stl::map failed" );
+ }
+
+ DBG_ASSERT( (*maCurrentShapesIter).second.size() == (ShapesInfos::size_type)xShapes->getCount(), "XMLShapeExport::seekShapes(): XShapes size varied between calls" );
+
+ }
+ else
+ {
+ maCurrentShapesIter = maShapesInfos.end();
+ }
+}
+
+///////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::exportAutoStyles()
+{
+ // export all autostyle infos
+
+ // ...for graphic
+ {
+ GetExport().GetAutoStylePool()->exportXML(
+ XML_STYLE_FAMILY_SD_GRAPHICS_ID
+ , GetExport().GetDocHandler(),
+ GetExport().GetMM100UnitConverter(),
+ GetExport().GetNamespaceMap()
+ );
+ }
+
+ // ...for presentation
+ {
+ GetExport().GetAutoStylePool()->exportXML(
+ XML_STYLE_FAMILY_SD_PRESENTATION_ID
+ , GetExport().GetDocHandler(),
+ GetExport().GetMM100UnitConverter(),
+ GetExport().GetNamespaceMap()
+ );
+ }
+
+ if( mxShapeTableExport.is() )
+ mxShapeTableExport->exportAutoStyles();
+}
+
+///////////////////////////////////////////////////////////////////////
+
+/// returns the export property mapper for external chaining
+SvXMLExportPropertyMapper* XMLShapeExport::CreateShapePropMapper(
+ SvXMLExport& rExport )
+{
+ UniReference< XMLPropertyHandlerFactory > xFactory = new XMLSdPropHdlFactory( rExport.GetModel(), rExport );
+ UniReference < XMLPropertySetMapper > xMapper = new XMLShapePropertySetMapper( xFactory );
+ SvXMLExportPropertyMapper* pResult =
+ new XMLShapeExportPropertyMapper( xMapper,
+ (XMLTextListAutoStylePool*)&rExport.GetTextParagraphExport()->GetListAutoStylePool(),
+ rExport );
+ // chain text attributes
+ return pResult;
+}
+
+///////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpCalcShapeType(const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType& eShapeType)
+{
+ // set in every case, so init here
+ eShapeType = XmlShapeTypeUnknown;
+
+ uno::Reference< drawing::XShapeDescriptor > xShapeDescriptor(xShape, uno::UNO_QUERY);
+ if(xShapeDescriptor.is())
+ {
+ String aType((OUString)xShapeDescriptor->getShapeType());
+
+ if(aType.EqualsAscii((const sal_Char*)"com.sun.star.", 0, 13))
+ {
+ if(aType.EqualsAscii("drawing.", 13, 8))
+ {
+ // drawing shapes
+ if (aType.EqualsAscii("Rectangle", 21, 9)) { eShapeType = XmlShapeTypeDrawRectangleShape; }
+
+ // #i72177# Note: Correcting CustomShape, CustomShape->Custom, len from 9 (was wrong anyways) to 6.
+ // As can be seen at the other compares, the appendix "Shape" is left out of the comparison.
+ else if(aType.EqualsAscii("Custom", 21, 6)) { eShapeType = XmlShapeTypeDrawCustomShape; }
+
+ else if(aType.EqualsAscii("Ellipse", 21, 7)) { eShapeType = XmlShapeTypeDrawEllipseShape; }
+ else if(aType.EqualsAscii("Control", 21, 7)) { eShapeType = XmlShapeTypeDrawControlShape; }
+ else if(aType.EqualsAscii("Connector", 21, 9)) { eShapeType = XmlShapeTypeDrawConnectorShape; }
+ else if(aType.EqualsAscii("Measure", 21, 7)) { eShapeType = XmlShapeTypeDrawMeasureShape; }
+ else if(aType.EqualsAscii("Line", 21, 4)) { eShapeType = XmlShapeTypeDrawLineShape; }
+
+ // #i72177# Note: This covers two types by purpose, PolyPolygonShape and PolyPolygonPathShape
+ else if(aType.EqualsAscii("PolyPolygon", 21, 11)) { eShapeType = XmlShapeTypeDrawPolyPolygonShape; }
+
+ // #i72177# Note: This covers two types by purpose, PolyLineShape and PolyLinePathShape
+ else if(aType.EqualsAscii("PolyLine", 21, 8)) { eShapeType = XmlShapeTypeDrawPolyLineShape; }
+
+ else if(aType.EqualsAscii("OpenBezier", 21, 10)) { eShapeType = XmlShapeTypeDrawOpenBezierShape; }
+ else if(aType.EqualsAscii("ClosedBezier", 21, 12)) { eShapeType = XmlShapeTypeDrawClosedBezierShape; }
+
+ // #i72177# FreeHand (opened and closed) now supports the types OpenFreeHandShape and
+ // ClosedFreeHandShape respectively. Represent them as bezier shapes
+ else if(aType.EqualsAscii("OpenFreeHand", 21, 12)) { eShapeType = XmlShapeTypeDrawOpenBezierShape; }
+ else if(aType.EqualsAscii("ClosedFreeHand", 21, 14)) { eShapeType = XmlShapeTypeDrawClosedBezierShape; }
+
+ else if(aType.EqualsAscii("GraphicObject", 21, 13)) { eShapeType = XmlShapeTypeDrawGraphicObjectShape; }
+ else if(aType.EqualsAscii("Group", 21, 5)) { eShapeType = XmlShapeTypeDrawGroupShape; }
+ else if(aType.EqualsAscii("Text", 21, 4)) { eShapeType = XmlShapeTypeDrawTextShape; }
+ else if(aType.EqualsAscii("OLE2", 21, 4))
+ {
+ eShapeType = XmlShapeTypeDrawOLE2Shape;
+
+ // get info about presentation shape
+ uno::Reference <beans::XPropertySet> xPropSet(xShape, uno::UNO_QUERY);
+
+ if(xPropSet.is())
+ {
+ rtl::OUString sCLSID;
+ if(xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CLSID"))) >>= sCLSID)
+ {
+ if (sCLSID.equals(mrExport.GetChartExport()->getChartCLSID()))
+ {
+ eShapeType = XmlShapeTypeDrawChartShape;
+ }
+ else if (
+ sCLSID.equals(rtl::OUString( SvGlobalName( SO3_SC_CLASSID ).GetHexName()))
+ // #110680#
+ // same reaction for binfilter
+ || sCLSID.equals(rtl::OUString( SvGlobalName( BF_SO3_SC_CLASSID ).GetHexName()))
+ )
+ {
+ eShapeType = XmlShapeTypeDrawSheetShape;
+ }
+ else
+ {
+ // general OLE2 Object
+ }
+ }
+ }
+ }
+ else if(aType.EqualsAscii("Page", 21, 4)) { eShapeType = XmlShapeTypeDrawPageShape; }
+ else if(aType.EqualsAscii("Frame", 21, 5)) { eShapeType = XmlShapeTypeDrawFrameShape; }
+ else if(aType.EqualsAscii("Caption", 21, 7)) { eShapeType = XmlShapeTypeDrawCaptionShape; }
+ else if(aType.EqualsAscii("Plugin", 21, 6)) { eShapeType = XmlShapeTypeDrawPluginShape; }
+ else if(aType.EqualsAscii("Applet", 21, 6)) { eShapeType = XmlShapeTypeDrawAppletShape; }
+ else if(aType.EqualsAscii("MediaShape", 21, 10)) { eShapeType = XmlShapeTypeDrawMediaShape; }
+ else if(aType.EqualsAscii("TableShape", 21, 10)) { eShapeType = XmlShapeTypeDrawTableShape; }
+
+ // 3D shapes
+ else if(aType.EqualsAscii("Scene", 21 + 7, 5)) { eShapeType = XmlShapeTypeDraw3DSceneObject; }
+ else if(aType.EqualsAscii("Cube", 21 + 7, 4)) { eShapeType = XmlShapeTypeDraw3DCubeObject; }
+ else if(aType.EqualsAscii("Sphere", 21 + 7, 6)) { eShapeType = XmlShapeTypeDraw3DSphereObject; }
+ else if(aType.EqualsAscii("Lathe", 21 + 7, 5)) { eShapeType = XmlShapeTypeDraw3DLatheObject; }
+ else if(aType.EqualsAscii("Extrude", 21 + 7, 7)) { eShapeType = XmlShapeTypeDraw3DExtrudeObject; }
+ }
+ else if(aType.EqualsAscii("presentation.", 13, 13))
+ {
+ // presentation shapes
+ if (aType.EqualsAscii("TitleText", 26, 9)) { eShapeType = XmlShapeTypePresTitleTextShape; }
+ else if(aType.EqualsAscii("Outliner", 26, 8)) { eShapeType = XmlShapeTypePresOutlinerShape; }
+ else if(aType.EqualsAscii("Subtitle", 26, 8)) { eShapeType = XmlShapeTypePresSubtitleShape; }
+ else if(aType.EqualsAscii("GraphicObject", 26, 13)) { eShapeType = XmlShapeTypePresGraphicObjectShape; }
+ else if(aType.EqualsAscii("Page", 26, 4)) { eShapeType = XmlShapeTypePresPageShape; }
+ else if(aType.EqualsAscii("OLE2", 26, 4))
+ {
+ eShapeType = XmlShapeTypePresOLE2Shape;
+
+ // get info about presentation shape
+ uno::Reference <beans::XPropertySet> xPropSet(xShape, uno::UNO_QUERY);
+
+ if(xPropSet.is()) try
+ {
+ rtl::OUString sCLSID;
+ if(xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CLSID"))) >>= sCLSID)
+ {
+ if( sCLSID.equals(rtl::OUString( SvGlobalName( SO3_SC_CLASSID ).GetHexName())) ||
+ sCLSID.equals(rtl::OUString( SvGlobalName( BF_SO3_SC_CLASSID ).GetHexName())) )
+ {
+ eShapeType = XmlShapeTypePresSheetShape;
+ }
+ }
+ }
+ catch( uno::Exception& )
+ {
+ OSL_FAIL( "XMLShapeExport::ImpCalcShapeType(), expected ole shape to have the CLSID property?" );
+ }
+ }
+ else if(aType.EqualsAscii("Chart", 26, 5)) { eShapeType = XmlShapeTypePresChartShape; }
+ else if(aType.EqualsAscii("OrgChart", 26, 8)) { eShapeType = XmlShapeTypePresOrgChartShape; }
+ else if(aType.EqualsAscii("CalcShape", 26, 9)) { eShapeType = XmlShapeTypePresSheetShape; }
+ else if(aType.EqualsAscii("TableShape", 26, 10)) { eShapeType = XmlShapeTypePresTableShape; }
+ else if(aType.EqualsAscii("Notes", 26, 5)) { eShapeType = XmlShapeTypePresNotesShape; }
+ else if(aType.EqualsAscii("HandoutShape", 26, 12)) { eShapeType = XmlShapeTypeHandoutShape; }
+ else if(aType.EqualsAscii("HeaderShape", 26, 11)) { eShapeType = XmlShapeTypePresHeaderShape; }
+ else if(aType.EqualsAscii("FooterShape", 26, 11)) { eShapeType = XmlShapeTypePresFooterShape; }
+ else if(aType.EqualsAscii("SlideNumberShape", 26, 16)) { eShapeType = XmlShapeTypePresSlideNumberShape; }
+ else if(aType.EqualsAscii("DateTimeShape", 26, 13)) { eShapeType = XmlShapeTypePresDateTimeShape; }
+ else if(aType.EqualsAscii("MediaShape", 26, 10)) { eShapeType = XmlShapeTypePresMediaShape; }
+ }
+ }
+ }
+}
+
+///////////////////////////////////////////////////////////////////////
+
+extern SvXMLEnumMapEntry aXML_GlueAlignment_EnumMap[];
+extern SvXMLEnumMapEntry aXML_GlueEscapeDirection_EnumMap[];
+
+/** exports all user defined glue points */
+void XMLShapeExport::ImpExportGluePoints( const uno::Reference< drawing::XShape >& xShape )
+{
+ uno::Reference< drawing::XGluePointsSupplier > xSupplier( xShape, uno::UNO_QUERY );
+ if( !xSupplier.is() )
+ return;
+
+ uno::Reference< container::XIdentifierAccess > xGluePoints( xSupplier->getGluePoints(), uno::UNO_QUERY );
+ if( !xGluePoints.is() )
+ return;
+
+ drawing::GluePoint2 aGluePoint;
+
+ uno::Sequence< sal_Int32 > aIdSequence( xGluePoints->getIdentifiers() );
+
+ const sal_Int32 nCount = aIdSequence.getLength();
+ for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
+ {
+ const sal_Int32 nIdentifier = aIdSequence[nIndex];
+ if( (xGluePoints->getByIdentifier( nIdentifier ) >>= aGluePoint) && aGluePoint.IsUserDefined )
+ {
+ // export only user defined glue points
+
+ const OUString sId( OUString::valueOf( nIdentifier ) );
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_ID, sId );
+
+ mrExport.GetMM100UnitConverter().convertMeasure(msBuffer, aGluePoint.Position.X);
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X, msBuffer.makeStringAndClear());
+
+ mrExport.GetMM100UnitConverter().convertMeasure(msBuffer, aGluePoint.Position.Y);
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y, msBuffer.makeStringAndClear());
+
+ if( !aGluePoint.IsRelative )
+ {
+ SvXMLUnitConverter::convertEnum( msBuffer, aGluePoint.PositionAlignment, aXML_GlueAlignment_EnumMap );
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_ALIGN, msBuffer.makeStringAndClear() );
+ }
+
+ if( aGluePoint.Escape != drawing::EscapeDirection_SMART )
+ {
+ SvXMLUnitConverter::convertEnum( msBuffer, aGluePoint.Escape, aXML_GlueEscapeDirection_EnumMap );
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_ESCAPE_DIRECTION, msBuffer.makeStringAndClear() );
+ }
+
+ SvXMLElementExport aEventsElemt(mrExport, XML_NAMESPACE_DRAW, XML_GLUE_POINT, sal_True, sal_True);
+ }
+ }
+}
+
+void XMLShapeExport::ExportGraphicDefaults()
+{
+ XMLStyleExport aStEx(mrExport, OUString(), mrExport.GetAutoStylePool().get());
+
+ // construct PropertySetMapper
+ UniReference< SvXMLExportPropertyMapper > xPropertySetMapper( CreateShapePropMapper( mrExport ) );
+ ((XMLShapeExportPropertyMapper*)xPropertySetMapper.get())->SetAutoStyles( sal_False );
+
+ // chain text attributes
+ xPropertySetMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaExtPropMapper(mrExport));
+
+ // chain special Writer/text frame default attributes
+ xPropertySetMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaDefaultExtPropMapper(mrExport));
+
+ // write graphic family default style
+ uno::Reference< lang::XMultiServiceFactory > xFact( mrExport.GetModel(), uno::UNO_QUERY );
+ if( xFact.is() )
+ {
+ try
+ {
+ uno::Reference< beans::XPropertySet > xDefaults( xFact->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.Defaults") ) ), uno::UNO_QUERY );
+ if( xDefaults.is() )
+ {
+ aStEx.exportDefaultStyle( xDefaults, OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_NAME)), xPropertySetMapper );
+
+ // write graphic family styles
+ aStEx.exportStyleFamily("graphics", OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_NAME)), xPropertySetMapper, sal_False, XML_STYLE_FAMILY_SD_GRAPHICS_ID);
+ }
+ }
+ catch( lang::ServiceNotRegisteredException& )
+ {
+ }
+ }
+}
+
+void XMLShapeExport::onExport( const com::sun::star::uno::Reference < com::sun::star::drawing::XShape >& )
+{
+}
+
+const rtl::Reference< XMLTableExport >& XMLShapeExport::GetShapeTableExport()
+{
+ if( !mxShapeTableExport.is() )
+ {
+ rtl::Reference< XMLPropertyHandlerFactory > xFactory( new XMLSdPropHdlFactory( mrExport.GetModel(), mrExport ) );
+ UniReference < XMLPropertySetMapper > xMapper( new XMLShapePropertySetMapper( xFactory.get() ) );
+ rtl::Reference< SvXMLExportPropertyMapper > xPropertySetMapper( new XMLShapeExportPropertyMapper( xMapper, (XMLTextListAutoStylePool*)&mrExport.GetTextParagraphExport()->GetListAutoStylePool(), mrExport ) );
+ mxShapeTableExport = new XMLTableExport( mrExport, xPropertySetMapper, xFactory );
+ }
+
+ return mxShapeTableExport;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/shapeexport2.cxx b/xmloff/source/draw/shapeexport2.cxx
new file mode 100644
index 000000000000..b50c03db813a
--- /dev/null
+++ b/xmloff/source/draw/shapeexport2.cxx
@@ -0,0 +1,2009 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "unointerfacetouniqueidentifiermapper.hxx"
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/drawing/CircleKind.hpp>
+#include <com/sun/star/drawing/ConnectorType.hpp>
+#include <com/sun/star/drawing/XControlShape.hpp>
+#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#include <com/sun/star/drawing/HomogenMatrix3.hpp>
+#include <com/sun/star/media/ZoomLevel.hpp>
+#include "anim.hxx"
+
+#include <xmloff/shapeexport.hxx>
+#include "sdpropls.hxx"
+#include <tools/debug.hxx>
+#include <tools/urlobj.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "XMLImageMapExport.hxx"
+#include "xexptran.hxx"
+#include <tools/gen.hxx> // FRound
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/nmspmap.hxx>
+
+#include "xmloff/xmlnmspe.hxx"
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/tuple/b2dtuple.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportNewTrans(const uno::Reference< beans::XPropertySet >& xPropSet,
+ sal_Int32 nFeatures, awt::Point* pRefPoint)
+{
+ // get matrix
+ ::basegfx::B2DHomMatrix aMatrix;
+ ImpExportNewTrans_GetB2DHomMatrix(aMatrix, xPropSet);
+
+ // decompose and correct abour pRefPoint
+ ::basegfx::B2DTuple aTRScale;
+ double fTRShear(0.0);
+ double fTRRotate(0.0);
+ ::basegfx::B2DTuple aTRTranslate;
+ ImpExportNewTrans_DecomposeAndRefPoint(aMatrix, aTRScale, fTRShear, fTRRotate, aTRTranslate, pRefPoint);
+
+ // use features and write
+ ImpExportNewTrans_FeaturesAndWrite(aTRScale, fTRShear, fTRRotate, aTRTranslate, nFeatures);
+}
+
+void XMLShapeExport::ImpExportNewTrans_GetB2DHomMatrix(::basegfx::B2DHomMatrix& rMatrix,
+ const uno::Reference< beans::XPropertySet >& xPropSet)
+{
+ /* Get <TransformationInHoriL2R>, if it exist
+ and if the document is exported into the OpenOffice.org file format.
+ This property only exists at service com::sun::star::text::Shape - the
+ Writer UNO service for shapes.
+ This code is needed, because the positioning attributes in the
+ OpenOffice.org file format are given in horizontal left-to-right layout
+ regardless the layout direction the shape is in. In the OASIS Open Office
+ file format the positioning attributes are correctly given in the layout
+ direction the shape is in. Thus, this code provides the conversion from
+ the OASIS Open Office file format to the OpenOffice.org file format. (#i28749#)
+ */
+ uno::Any aAny;
+ if ( ( GetExport().getExportFlags() & EXPORT_OASIS ) == 0 &&
+ xPropSet->getPropertySetInfo()->hasPropertyByName(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("TransformationInHoriL2R"))) )
+ {
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("TransformationInHoriL2R")));
+ }
+ else
+ {
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Transformation")));
+ }
+ drawing::HomogenMatrix3 aMatrix;
+ aAny >>= aMatrix;
+
+ rMatrix.set(0, 0, aMatrix.Line1.Column1);
+ rMatrix.set(0, 1, aMatrix.Line1.Column2);
+ rMatrix.set(0, 2, aMatrix.Line1.Column3);
+ rMatrix.set(1, 0, aMatrix.Line2.Column1);
+ rMatrix.set(1, 1, aMatrix.Line2.Column2);
+ rMatrix.set(1, 2, aMatrix.Line2.Column3);
+ rMatrix.set(2, 0, aMatrix.Line3.Column1);
+ rMatrix.set(2, 1, aMatrix.Line3.Column2);
+ rMatrix.set(2, 2, aMatrix.Line3.Column3);
+}
+
+void XMLShapeExport::ImpExportNewTrans_DecomposeAndRefPoint(const ::basegfx::B2DHomMatrix& rMatrix, ::basegfx::B2DTuple& rTRScale,
+ double& fTRShear, double& fTRRotate, ::basegfx::B2DTuple& rTRTranslate, com::sun::star::awt::Point* pRefPoint)
+{
+ // decompose matrix
+ rMatrix.decompose(rTRScale, rTRTranslate, fTRRotate, fTRShear);
+
+ // correct translation about pRefPoint
+ if(pRefPoint)
+ {
+ rTRTranslate -= ::basegfx::B2DTuple(pRefPoint->X, pRefPoint->Y);
+ }
+}
+
+void XMLShapeExport::ImpExportNewTrans_FeaturesAndWrite(::basegfx::B2DTuple& rTRScale, double fTRShear,
+ double fTRRotate, ::basegfx::B2DTuple& rTRTranslate, const sal_Int32 nFeatures)
+{
+ // allways write Size (rTRScale) since this statement carries the union
+ // of the object
+ OUString aStr;
+ OUStringBuffer sStringBuffer;
+ ::basegfx::B2DTuple aTRScale(rTRScale);
+
+ // svg: width
+ if(!(nFeatures & SEF_EXPORT_WIDTH))
+ {
+ aTRScale.setX(1.0);
+ }
+ else
+ {
+ if( aTRScale.getX() > 0.0 )
+ aTRScale.setX(aTRScale.getX() - 1.0);
+ else if( aTRScale.getX() < 0.0 )
+ aTRScale.setX(aTRScale.getX() + 1.0);
+ }
+
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, FRound(aTRScale.getX()));
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_WIDTH, aStr);
+
+ // svg: height
+ if(!(nFeatures & SEF_EXPORT_HEIGHT))
+ {
+ aTRScale.setY(1.0);
+ }
+ else
+ {
+ if( aTRScale.getY() > 0.0 )
+ aTRScale.setY(aTRScale.getY() - 1.0);
+ else if( aTRScale.getY() < 0.0 )
+ aTRScale.setY(aTRScale.getY() + 1.0);
+ }
+
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, FRound(aTRScale.getY()));
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_HEIGHT, aStr);
+
+ // decide if transformation is neccessary
+ sal_Bool bTransformationIsNeccessary(fTRShear != 0.0 || fTRRotate != 0.0);
+
+ if(bTransformationIsNeccessary)
+ {
+ // write transformation, but WITHOUT scale which is exported as size above
+ SdXMLImExTransform2D aTransform;
+
+ aTransform.AddSkewX(atan(fTRShear));
+
+ // #i78696#
+ // fTRRotate is mathematically correct, but due to the error
+ // we export/import it mirrored. Since the API implementation is fixed and
+ // uses the correctly oriented angle, it is necessary for compatibility to
+ // mirror the angle here to stay at the old behaviour. There is a follow-up
+ // task (#i78698#) to fix this in the next ODF FileFormat version
+ aTransform.AddRotate(-fTRRotate);
+
+ aTransform.AddTranslate(rTRTranslate);
+
+ // does transformation need to be exported?
+ if(aTransform.NeedsAction())
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_TRANSFORM, aTransform.GetExportString(mrExport.GetMM100UnitConverter()));
+ }
+ else
+ {
+ // no shear, no rotate; just add object position to export and we are done
+ if(nFeatures & SEF_EXPORT_X)
+ {
+ // svg: x
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, FRound(rTRTranslate.getX()));
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X, aStr);
+ }
+
+ if(nFeatures & SEF_EXPORT_Y)
+ {
+ // svg: y
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, FRound(rTRTranslate.getY()));
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y, aStr);
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+sal_Bool XMLShapeExport::ImpExportPresentationAttributes( const uno::Reference< beans::XPropertySet >& xPropSet, const rtl::OUString& rClass )
+{
+ sal_Bool bIsEmpty = sal_False;
+
+ OUStringBuffer sStringBuffer;
+
+ // write presentation class entry
+ mrExport.AddAttribute(XML_NAMESPACE_PRESENTATION, XML_CLASS, rClass);
+
+ if( xPropSet.is() )
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
+
+ sal_Bool bTemp = false;
+
+ // is empty pes shape?
+ if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject"))))
+ {
+ xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject"))) >>= bIsEmpty;
+ if( bIsEmpty )
+ mrExport.AddAttribute(XML_NAMESPACE_PRESENTATION, XML_PLACEHOLDER, XML_TRUE);
+ }
+
+ // is user-transformed?
+ if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent"))))
+ {
+ xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent"))) >>= bTemp;
+ if(!bTemp)
+ mrExport.AddAttribute(XML_NAMESPACE_PRESENTATION, XML_USER_TRANSFORMED, XML_TRUE);
+ }
+ }
+
+ return bIsEmpty;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportText( const uno::Reference< drawing::XShape >& xShape )
+{
+ uno::Reference< text::XText > xText( xShape, uno::UNO_QUERY );
+ if( xText.is() )
+ {
+ uno::Reference< container::XEnumerationAccess > xEnumAccess( xShape, uno::UNO_QUERY );
+ if( xEnumAccess.is() && xEnumAccess->hasElements() )
+ mrExport.GetTextParagraphExport()->exportText( xText );
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+#include <com/sun/star/presentation/ClickAction.hpp>
+#include <com/sun/star/presentation/AnimationSpeed.hpp>
+
+namespace {
+
+const sal_Int32 FOUND_CLICKACTION = 0x00000001;
+const sal_Int32 FOUND_BOOKMARK = 0x00000002;
+const sal_Int32 FOUND_EFFECT = 0x00000004;
+const sal_Int32 FOUND_PLAYFULL = 0x00000008;
+const sal_Int32 FOUND_VERB = 0x00000010;
+const sal_Int32 FOUND_SOUNDURL = 0x00000020;
+const sal_Int32 FOUND_SPEED = 0x00000040;
+const sal_Int32 FOUND_CLICKEVENTTYPE = 0x00000080;
+const sal_Int32 FOUND_MACRO = 0x00000100;
+const sal_Int32 FOUND_LIBRARY = 0x00000200;
+const sal_Int32 FOUND_ACTIONEVENTTYPE = 0x00000400;
+
+} // namespace
+
+void XMLShapeExport::ImpExportEvents( const uno::Reference< drawing::XShape >& xShape )
+{
+ uno::Reference< document::XEventsSupplier > xEventsSupplier( xShape, uno::UNO_QUERY );
+ if( !xEventsSupplier.is() )
+ return;
+
+ uno::Reference< container::XNameAccess > xEvents( xEventsSupplier->getEvents(), uno::UNO_QUERY );
+ DBG_ASSERT( xEvents.is(), "XEventsSupplier::getEvents() returned NULL" );
+ if( !xEvents.is() )
+ return;
+
+ sal_Int32 nFound = 0;
+
+ // extract properties from "OnClick" event --------------------------------
+
+ OUString aClickEventType;
+ presentation::ClickAction eClickAction = presentation::ClickAction_NONE;
+ presentation::AnimationEffect eEffect = presentation::AnimationEffect_NONE;
+ presentation::AnimationSpeed eSpeed = presentation::AnimationSpeed_SLOW;
+ OUString aStrSoundURL;
+ sal_Bool bPlayFull = false;
+ sal_Int32 nVerb = 0;
+ OUString aStrMacro;
+ OUString aStrLibrary;
+ OUString aStrBookmark;
+
+ uno::Sequence< beans::PropertyValue > aClickProperties;
+ if( xEvents->hasByName( msOnClick ) && (xEvents->getByName( msOnClick ) >>= aClickProperties) )
+ {
+ const beans::PropertyValue* pProperty = aClickProperties.getConstArray();
+ const beans::PropertyValue* pPropertyEnd = pProperty + aClickProperties.getLength();
+ for( ; pProperty != pPropertyEnd; ++pProperty )
+ {
+ if( ( ( nFound & FOUND_CLICKEVENTTYPE ) == 0 ) && pProperty->Name == msEventType )
+ {
+ if( pProperty->Value >>= aClickEventType )
+ nFound |= FOUND_CLICKEVENTTYPE;
+ }
+ else if( ( ( nFound & FOUND_CLICKACTION ) == 0 ) && pProperty->Name == msClickAction )
+ {
+ if( pProperty->Value >>= eClickAction )
+ nFound |= FOUND_CLICKACTION;
+ }
+ else if( ( ( nFound & FOUND_MACRO ) == 0 ) && ( pProperty->Name == msMacroName || pProperty->Name == msScript ) )
+ {
+ if( pProperty->Value >>= aStrMacro )
+ nFound |= FOUND_MACRO;
+ }
+ else if( ( ( nFound & FOUND_LIBRARY ) == 0 ) && pProperty->Name == msLibrary )
+ {
+ if( pProperty->Value >>= aStrLibrary )
+ nFound |= FOUND_LIBRARY;
+ }
+ else if( ( ( nFound & FOUND_EFFECT ) == 0 ) && pProperty->Name == msEffect )
+ {
+ if( pProperty->Value >>= eEffect )
+ nFound |= FOUND_EFFECT;
+ }
+ else if( ( ( nFound & FOUND_BOOKMARK ) == 0 ) && pProperty->Name == msBookmark )
+ {
+ if( pProperty->Value >>= aStrBookmark )
+ nFound |= FOUND_BOOKMARK;
+ }
+ else if( ( ( nFound & FOUND_SPEED ) == 0 ) && pProperty->Name == msSpeed )
+ {
+ if( pProperty->Value >>= eSpeed )
+ nFound |= FOUND_SPEED;
+ }
+ else if( ( ( nFound & FOUND_SOUNDURL ) == 0 ) && pProperty->Name == msSoundURL )
+ {
+ if( pProperty->Value >>= aStrSoundURL )
+ nFound |= FOUND_SOUNDURL;
+ }
+ else if( ( ( nFound & FOUND_PLAYFULL ) == 0 ) && pProperty->Name == msPlayFull )
+ {
+ if( pProperty->Value >>= bPlayFull )
+ nFound |= FOUND_PLAYFULL;
+ }
+ else if( ( ( nFound & FOUND_VERB ) == 0 ) && pProperty->Name == msVerb )
+ {
+ if( pProperty->Value >>= nVerb )
+ nFound |= FOUND_VERB;
+ }
+ }
+ }
+
+ // create the XML elements
+
+ if( aClickEventType == msPresentation )
+ {
+ if( ((nFound & FOUND_CLICKACTION) == 0) || (eClickAction == presentation::ClickAction_NONE) )
+ return;
+
+ SvXMLElementExport aEventsElemt(mrExport, XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS, sal_True, sal_True);
+
+ enum XMLTokenEnum eStrAction;
+
+ switch( eClickAction )
+ {
+ case presentation::ClickAction_PREVPAGE: eStrAction = XML_PREVIOUS_PAGE; break;
+ case presentation::ClickAction_NEXTPAGE: eStrAction = XML_NEXT_PAGE; break;
+ case presentation::ClickAction_FIRSTPAGE: eStrAction = XML_FIRST_PAGE; break;
+ case presentation::ClickAction_LASTPAGE: eStrAction = XML_LAST_PAGE; break;
+ case presentation::ClickAction_INVISIBLE: eStrAction = XML_HIDE; break;
+ case presentation::ClickAction_STOPPRESENTATION:eStrAction = XML_STOP; break;
+ case presentation::ClickAction_PROGRAM: eStrAction = XML_EXECUTE; break;
+ case presentation::ClickAction_BOOKMARK: eStrAction = XML_SHOW; break;
+ case presentation::ClickAction_DOCUMENT: eStrAction = XML_SHOW; break;
+ case presentation::ClickAction_MACRO: eStrAction = XML_EXECUTE_MACRO; break;
+ case presentation::ClickAction_VERB: eStrAction = XML_VERB; break;
+ case presentation::ClickAction_VANISH: eStrAction = XML_FADE_OUT; break;
+ case presentation::ClickAction_SOUND: eStrAction = XML_SOUND; break;
+ default:
+ OSL_FAIL( "unknown presentation::ClickAction found!" );
+ eStrAction = XML_UNKNOWN;
+ }
+
+ OUString aEventQName(
+ mrExport.GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_DOM, OUString( RTL_CONSTASCII_USTRINGPARAM( "click" ) ) ) );
+ mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_EVENT_NAME, aEventQName );
+ mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_ACTION, eStrAction );
+
+ if( eClickAction == presentation::ClickAction_VANISH )
+ {
+ if( nFound & FOUND_EFFECT )
+ {
+ XMLEffect eKind;
+ XMLEffectDirection eDirection;
+ sal_Int16 nStartScale;
+ sal_Bool bIn;
+
+ SdXMLImplSetEffect( eEffect, eKind, eDirection, nStartScale, bIn );
+
+ if( eKind != EK_none )
+ {
+ SvXMLUnitConverter::convertEnum( msBuffer, eKind, aXML_AnimationEffect_EnumMap );
+ mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_EFFECT, msBuffer.makeStringAndClear() );
+ }
+
+ if( eDirection != ED_none )
+ {
+ SvXMLUnitConverter::convertEnum( msBuffer, eDirection, aXML_AnimationDirection_EnumMap );
+ mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_DIRECTION, msBuffer.makeStringAndClear() );
+ }
+
+ if( nStartScale != -1 )
+ {
+ SvXMLUnitConverter::convertPercent( msBuffer, nStartScale );
+ mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_START_SCALE, msBuffer.makeStringAndClear() );
+ }
+ }
+
+ if( nFound & FOUND_SPEED && eEffect != presentation::AnimationEffect_NONE )
+ {
+ if( eSpeed != presentation::AnimationSpeed_MEDIUM )
+ {
+ SvXMLUnitConverter::convertEnum( msBuffer, eSpeed, aXML_AnimationSpeed_EnumMap );
+ mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_SPEED, msBuffer.makeStringAndClear() );
+ }
+ }
+ }
+
+ if( eClickAction == presentation::ClickAction_PROGRAM ||
+ eClickAction == presentation::ClickAction_BOOKMARK ||
+ eClickAction == presentation::ClickAction_DOCUMENT )
+ {
+ if( eClickAction == presentation::ClickAction_BOOKMARK )
+ msBuffer.append( sal_Unicode('#') );
+
+ msBuffer.append( aStrBookmark );
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(msBuffer.makeStringAndClear()) );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONREQUEST );
+ }
+
+ if( ( nFound & FOUND_VERB ) && eClickAction == presentation::ClickAction_VERB )
+ {
+ msBuffer.append( nVerb );
+ mrExport.AddAttribute(XML_NAMESPACE_PRESENTATION, XML_VERB, msBuffer.makeStringAndClear());
+ }
+
+ SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_PRESENTATION, XML_EVENT_LISTENER, sal_True, sal_True);
+
+ if( eClickAction == presentation::ClickAction_VANISH || eClickAction == presentation::ClickAction_SOUND )
+ {
+ if( ( nFound & FOUND_SOUNDURL ) && aStrSoundURL.getLength() != 0 )
+ {
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(aStrSoundURL) );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_NEW );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONREQUEST );
+ if( nFound & FOUND_PLAYFULL && bPlayFull )
+ mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_PLAY_FULL, XML_TRUE );
+
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_PRESENTATION, XML_SOUND, sal_True, sal_True );
+ }
+ }
+ }
+ else if( aClickEventType == msStarBasic )
+ {
+ if( nFound & FOUND_MACRO )
+ {
+ SvXMLElementExport aEventsElemt(mrExport, XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS, sal_True, sal_True);
+
+ mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_LANGUAGE,
+ mrExport.GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_OOO,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "starbasic" ) ) ) );
+ OUString aEventQName(
+ mrExport.GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_DOM, OUString( RTL_CONSTASCII_USTRINGPARAM( "click" ) ) ) );
+ mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_EVENT_NAME, aEventQName );
+
+ if( nFound & FOUND_LIBRARY )
+ {
+ OUString sLocation( GetXMLToken(
+ (aStrLibrary.equalsIgnoreAsciiCaseAscii("StarOffice") ||
+ aStrLibrary.equalsIgnoreAsciiCaseAscii("application") ) ? XML_APPLICATION
+ : XML_DOCUMENT ) );
+ OUStringBuffer sTmp( sLocation.getLength() + aStrMacro.getLength() + 1 );
+ sTmp = sLocation;
+ sTmp.append( sal_Unicode( ':' ) );
+ sTmp.append( aStrMacro );
+ mrExport.AddAttribute(XML_NAMESPACE_SCRIPT, XML_MACRO_NAME,
+ sTmp.makeStringAndClear());
+ }
+ else
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_MACRO_NAME, aStrMacro );
+ }
+
+ SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SCRIPT, XML_EVENT_LISTENER, sal_True, sal_True);
+ }
+ }
+ else if( aClickEventType == msScript )
+ {
+ if( nFound & FOUND_MACRO )
+ {
+ SvXMLElementExport aEventsElemt(mrExport, XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS, sal_True, sal_True);
+ if ( nFound & FOUND_MACRO )
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_LANGUAGE, mrExport.GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_OOO, GetXMLToken(XML_SCRIPT) ) );
+ OUString aEventQName(
+ mrExport.GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_DOM, OUString( RTL_CONSTASCII_USTRINGPARAM( "click" ) ) ) );
+ mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_EVENT_NAME, aEventQName );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, aStrMacro );
+
+ SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SCRIPT, XML_EVENT_LISTENER, sal_True, sal_True);
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+/** #i68101# export shape Title and Description */
+void XMLShapeExport::ImpExportDescription( const uno::Reference< drawing::XShape >& xShape )
+{
+ try
+ {
+ OUString aTitle;
+ OUString aDescription;
+
+ uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY_THROW );
+ xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM( "Title" )) ) >>= aTitle;
+ xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM( "Description" )) ) >>= aDescription;
+
+ if(aTitle.getLength())
+ {
+ SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SVG, XML_TITLE, sal_True, sal_False);
+ mrExport.Characters( aTitle );
+ }
+
+ if(aDescription.getLength())
+ {
+ SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SVG, XML_DESC, sal_True, sal_False );
+ mrExport.Characters( aDescription );
+ }
+ }
+ catch( uno::Exception& )
+ {
+ OSL_FAIL( "could not export Title and/or Description for shape!" );
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportGroupShape( const uno::Reference< drawing::XShape >& xShape, XmlShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint)
+{
+ uno::Reference< drawing::XShapes > xShapes(xShape, uno::UNO_QUERY);
+ if(xShapes.is() && xShapes->getCount())
+ {
+ // write group shape
+ sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
+ SvXMLElementExport aPGR(mrExport, XML_NAMESPACE_DRAW, XML_G, bCreateNewline, sal_True);
+
+ ImpExportDescription( xShape ); // #i68101#
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+
+ // #89764# if export of position is supressed for group shape,
+ // positions of contained objects should be written relative to
+ // the upper left edge of the group.
+ awt::Point aUpperLeft;
+
+ if(!(nFeatures & SEF_EXPORT_POSITION))
+ {
+ nFeatures |= SEF_EXPORT_POSITION;
+ aUpperLeft = xShape->getPosition();
+ pRefPoint = &aUpperLeft;
+ }
+
+ // write members
+ exportShapes( xShapes, nFeatures, pRefPoint );
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportTextBoxShape(
+ const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType eShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint)
+{
+ const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
+
+ // presentation attribute (if presentation)
+ sal_Bool bIsPresShape(sal_False);
+ sal_Bool bIsEmptyPresObj(sal_False);
+ OUString aStr;
+
+ switch(eShapeType)
+ {
+ case XmlShapeTypePresSubtitleShape:
+ {
+ aStr = GetXMLToken(XML_PRESENTATION_SUBTITLE);
+ bIsPresShape = sal_True;
+ break;
+ }
+ case XmlShapeTypePresTitleTextShape:
+ {
+ aStr = GetXMLToken(XML_PRESENTATION_TITLE);
+ bIsPresShape = sal_True;
+ break;
+ }
+ case XmlShapeTypePresOutlinerShape:
+ {
+ aStr = GetXMLToken(XML_PRESENTATION_OUTLINE);
+ bIsPresShape = sal_True;
+ break;
+ }
+ case XmlShapeTypePresNotesShape:
+ {
+ aStr = GetXMLToken(XML_PRESENTATION_NOTES);
+ bIsPresShape = sal_True;
+ break;
+ }
+ case XmlShapeTypePresHeaderShape:
+ {
+ aStr = GetXMLToken(XML_HEADER);
+ bIsPresShape = sal_True;
+ break;
+ }
+ case XmlShapeTypePresFooterShape:
+ {
+ aStr = GetXMLToken(XML_FOOTER);
+ bIsPresShape = sal_True;
+ break;
+ }
+ case XmlShapeTypePresSlideNumberShape:
+ {
+ aStr = GetXMLToken(XML_PAGE_NUMBER);
+ bIsPresShape = sal_True;
+ break;
+ }
+ case XmlShapeTypePresDateTimeShape:
+ {
+ aStr = GetXMLToken(XML_DATE_TIME);
+ bIsPresShape = sal_True;
+ break;
+ }
+ default:
+ break;
+ }
+
+ // Transformation
+ ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
+
+ if(bIsPresShape)
+ bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, aStr );
+
+
+ sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW,
+ XML_FRAME, bCreateNewline, sal_True );
+
+ // evtl. corner radius?
+ sal_Int32 nCornerRadius(0L);
+ xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CornerRadius"))) >>= nCornerRadius;
+ if(nCornerRadius)
+ {
+ OUStringBuffer sStringBuffer;
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nCornerRadius);
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_CORNER_RADIUS, sStringBuffer.makeStringAndClear());
+ }
+
+ {
+ // write text-box
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_TEXT_BOX, sal_True, sal_True);
+ if(!bIsEmptyPresObj)
+ ImpExportText( xShape );
+ }
+
+ ImpExportDescription( xShape ); // #i68101#
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportRectangleShape(
+ const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint)
+{
+ const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ // Transformation
+ ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
+
+ // evtl. corner radius?
+ sal_Int32 nCornerRadius(0L);
+ xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CornerRadius"))) >>= nCornerRadius;
+ if(nCornerRadius)
+ {
+ OUStringBuffer sStringBuffer;
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nCornerRadius);
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_CORNER_RADIUS, sStringBuffer.makeStringAndClear());
+ }
+
+ // write rectangle
+ sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_RECT, bCreateNewline, sal_True);
+
+ ImpExportDescription( xShape ); // #i68101#
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+ ImpExportText( xShape );
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportLineShape(
+ const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint)
+{
+ const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ OUString aStr;
+ OUStringBuffer sStringBuffer;
+ awt::Point aStart(0,0);
+ awt::Point aEnd(1,1);
+
+ // #85920# use 'Geometry' to get the points of the line
+ // since this slot take anchor pos into account.
+
+ // get matrix
+ ::basegfx::B2DHomMatrix aMatrix;
+ ImpExportNewTrans_GetB2DHomMatrix(aMatrix, xPropSet);
+
+ // decompose and correct about pRefPoint
+ ::basegfx::B2DTuple aTRScale;
+ double fTRShear(0.0);
+ double fTRRotate(0.0);
+ ::basegfx::B2DTuple aTRTranslate;
+ ImpExportNewTrans_DecomposeAndRefPoint(aMatrix, aTRScale, fTRShear, fTRRotate, aTRTranslate, pRefPoint);
+
+ // create base position
+ awt::Point aBasePosition(FRound(aTRTranslate.getX()), FRound(aTRTranslate.getY()));
+
+ // get the two points
+ uno::Any aAny(xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry"))));
+ drawing::PointSequenceSequence* pSourcePolyPolygon = (drawing::PointSequenceSequence*)aAny.getValue();
+
+ if(pSourcePolyPolygon)
+ {
+ drawing::PointSequence* pOuterSequence = pSourcePolyPolygon->getArray();
+ if(pOuterSequence)
+ {
+ drawing::PointSequence* pInnerSequence = pOuterSequence++;
+ if(pInnerSequence)
+ {
+ awt::Point* pArray = pInnerSequence->getArray();
+ if(pArray)
+ {
+ if(pInnerSequence->getLength() > 0)
+ {
+ aStart = awt::Point(
+ pArray->X + aBasePosition.X,
+ pArray->Y + aBasePosition.Y);
+ pArray++;
+ }
+
+ if(pInnerSequence->getLength() > 1)
+ {
+ aEnd = awt::Point(
+ pArray->X + aBasePosition.X,
+ pArray->Y + aBasePosition.Y);
+ }
+ }
+ }
+ }
+ }
+
+ if( nFeatures & SEF_EXPORT_X )
+ {
+ // svg: x1
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aStart.X);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X1, aStr);
+ }
+ else
+ {
+ aEnd.X -= aStart.X;
+ }
+
+ if( nFeatures & SEF_EXPORT_Y )
+ {
+ // svg: y1
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aStart.Y);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y1, aStr);
+ }
+ else
+ {
+ aEnd.Y -= aStart.Y;
+ }
+
+ // svg: x2
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aEnd.X);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X2, aStr);
+
+ // svg: y2
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aEnd.Y);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y2, aStr);
+
+ // write line
+ sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_LINE, bCreateNewline, sal_True);
+
+ ImpExportDescription( xShape ); // #i68101#
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+ ImpExportText( xShape );
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportEllipseShape(
+ const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint)
+{
+ const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ // get size to decide between Circle and Ellipse
+ awt::Size aSize = xShape->getSize();
+ sal_Int32 nRx((aSize.Width + 1) / 2);
+ sal_Int32 nRy((aSize.Height + 1) / 2);
+ sal_Bool bCircle(nRx == nRy);
+
+ // Transformation
+ ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
+
+ drawing::CircleKind eKind = drawing::CircleKind_FULL;
+ xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CircleKind")) ) >>= eKind;
+ if( eKind != drawing::CircleKind_FULL )
+ {
+ OUStringBuffer sStringBuffer;
+ sal_Int32 nStartAngle = 0;
+ sal_Int32 nEndAngle = 0;
+ xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CircleStartAngle")) ) >>= nStartAngle;
+ xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CircleEndAngle")) ) >>= nEndAngle;
+
+ const double dStartAngle = nStartAngle / 100.0;
+ const double dEndAngle = nEndAngle / 100.0;
+
+ // export circle kind
+ SvXMLUnitConverter::convertEnum( sStringBuffer, (sal_uInt16)eKind, aXML_CircleKind_EnumMap );
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_KIND, sStringBuffer.makeStringAndClear() );
+
+ // export start angle
+ SvXMLUnitConverter::convertDouble( sStringBuffer, dStartAngle );
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_START_ANGLE, sStringBuffer.makeStringAndClear() );
+
+ // export end angle
+ SvXMLUnitConverter::convertDouble( sStringBuffer, dEndAngle );
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_END_ANGLE, sStringBuffer.makeStringAndClear() );
+ }
+
+ sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
+
+ if(bCircle)
+ {
+ // write circle
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_CIRCLE, bCreateNewline, sal_True);
+
+ ImpExportDescription( xShape ); // #i68101#
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+ ImpExportText( xShape );
+ }
+ else
+ {
+ // write ellipse
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_ELLIPSE, bCreateNewline, sal_True);
+
+ ImpExportDescription( xShape ); // #i68101#
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+ ImpExportText( xShape );
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportPolygonShape(
+ const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType eShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint)
+{
+ const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ sal_Bool bClosed(eShapeType == XmlShapeTypeDrawPolyPolygonShape
+ || eShapeType == XmlShapeTypeDrawClosedBezierShape);
+ sal_Bool bBezier(eShapeType == XmlShapeTypeDrawClosedBezierShape
+ || eShapeType == XmlShapeTypeDrawOpenBezierShape);
+
+ // get matrix
+ ::basegfx::B2DHomMatrix aMatrix;
+ ImpExportNewTrans_GetB2DHomMatrix(aMatrix, xPropSet);
+
+ // decompose and correct abour pRefPoint
+ ::basegfx::B2DTuple aTRScale;
+ double fTRShear(0.0);
+ double fTRRotate(0.0);
+ ::basegfx::B2DTuple aTRTranslate;
+ ImpExportNewTrans_DecomposeAndRefPoint(aMatrix, aTRScale, fTRShear, fTRRotate, aTRTranslate, pRefPoint);
+
+ // use features and write
+ ImpExportNewTrans_FeaturesAndWrite(aTRScale, fTRShear, fTRRotate, aTRTranslate, nFeatures);
+
+ // create and export ViewBox
+ awt::Point aPoint(0, 0);
+ awt::Size aSize(FRound(aTRScale.getX()), FRound(aTRScale.getY()));
+ SdXMLImExViewBox aViewBox(0, 0, aSize.Width, aSize.Height);
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX, aViewBox.GetExportString());
+
+ sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
+
+ if(bBezier)
+ {
+ // get PolygonBezier
+ uno::Any aAny( xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry"))) );
+ drawing::PolyPolygonBezierCoords* pSourcePolyPolygon =
+ (drawing::PolyPolygonBezierCoords*)aAny.getValue();
+
+ if(pSourcePolyPolygon && pSourcePolyPolygon->Coordinates.getLength())
+ {
+ sal_Int32 nOuterCnt(pSourcePolyPolygon->Coordinates.getLength());
+ drawing::PointSequence* pOuterSequence = pSourcePolyPolygon->Coordinates.getArray();
+ drawing::FlagSequence* pOuterFlags = pSourcePolyPolygon->Flags.getArray();
+
+ if(pOuterSequence && pOuterFlags)
+ {
+ // prepare svx:d element export
+ SdXMLImExSvgDElement aSvgDElement(aViewBox);
+
+ for(sal_Int32 a(0L); a < nOuterCnt; a++)
+ {
+ drawing::PointSequence* pSequence = pOuterSequence++;
+ drawing::FlagSequence* pFlags = pOuterFlags++;
+
+ if(pSequence && pFlags)
+ {
+ aSvgDElement.AddPolygon(pSequence, pFlags,
+ aPoint, aSize, bClosed);
+ }
+ }
+
+ // write point array
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aSvgDElement.GetExportString());
+ }
+
+ // write object now
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_PATH, bCreateNewline, sal_True);
+
+ ImpExportDescription( xShape ); // #i68101#
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+ ImpExportText( xShape );
+ }
+ }
+ else
+ {
+ // get non-bezier polygon
+ uno::Any aAny( xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry"))) );
+ drawing::PointSequenceSequence* pSourcePolyPolygon = (drawing::PointSequenceSequence*)aAny.getValue();
+
+ if(pSourcePolyPolygon && pSourcePolyPolygon->getLength())
+ {
+ sal_Int32 nOuterCnt(pSourcePolyPolygon->getLength());
+
+ if(1L == nOuterCnt && !bBezier)
+ {
+ // simple polygon shape, can be written as svg:points sequence
+ drawing::PointSequence* pSequence = pSourcePolyPolygon->getArray();
+ if(pSequence)
+ {
+ SdXMLImExPointsElement aPoints(pSequence, aViewBox, aPoint, aSize,
+ // #96328#
+ bClosed);
+
+ // write point array
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_POINTS, aPoints.GetExportString());
+ }
+
+ // write object now
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW,
+ bClosed ? XML_POLYGON : XML_POLYLINE , bCreateNewline, sal_True);
+
+ ImpExportDescription( xShape ); // #i68101#
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+ ImpExportText( xShape );
+ }
+ else
+ {
+ // polypolygon or bezier, needs to be written as a svg:path sequence
+ drawing::PointSequence* pOuterSequence = pSourcePolyPolygon->getArray();
+ if(pOuterSequence)
+ {
+ // prepare svx:d element export
+ SdXMLImExSvgDElement aSvgDElement(aViewBox);
+
+ for(sal_Int32 a(0L); a < nOuterCnt; a++)
+ {
+ drawing::PointSequence* pSequence = pOuterSequence++;
+ if(pSequence)
+ {
+ aSvgDElement.AddPolygon(pSequence, 0L, aPoint,
+ aSize, bClosed);
+ }
+ }
+
+ // write point array
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aSvgDElement.GetExportString());
+ }
+
+ // write object now
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_PATH, bCreateNewline, sal_True);
+
+ ImpExportDescription( xShape ); // #i68101#
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+ ImpExportText( xShape );
+ }
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportGraphicObjectShape(
+ const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType eShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint)
+{
+ const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ sal_Bool bIsEmptyPresObj = sal_False;
+ uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
+
+ // Transformation
+ ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
+
+ OUString sImageURL;
+
+ if(eShapeType == XmlShapeTypePresGraphicObjectShape)
+ bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_GRAPHIC) );
+
+ sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW,
+ XML_FRAME, bCreateNewline, sal_True );
+
+ const bool bSaveBackwardsCompatible = ( mrExport.getExportFlags() & EXPORT_SAVEBACKWARDCOMPATIBLE );
+
+ if( !bIsEmptyPresObj || bSaveBackwardsCompatible )
+ {
+ if( !bIsEmptyPresObj )
+ {
+ OUString aStreamURL;
+ OUString aStr;
+
+ xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicStreamURL"))) >>= aStreamURL;
+ xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicURL"))) >>= sImageURL;
+
+ OUString aResolveURL( sImageURL );
+ const rtl::OUString sPackageURL( RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.Package:") );
+
+ // sj: trying to preserve the filename
+ if ( aStreamURL.match( sPackageURL, 0 ) )
+ {
+ rtl::OUString sRequestedName( aStreamURL.copy( sPackageURL.getLength(), aStreamURL.getLength() - sPackageURL.getLength() ) );
+ sal_Int32 nLastIndex = sRequestedName.lastIndexOf( '/' ) + 1;
+ if ( ( nLastIndex > 0 ) && ( nLastIndex < sRequestedName.getLength() ) )
+ sRequestedName = sRequestedName.copy( nLastIndex, sRequestedName.getLength() - nLastIndex );
+ nLastIndex = sRequestedName.lastIndexOf( '.' );
+ if ( nLastIndex >= 0 )
+ sRequestedName = sRequestedName.copy( 0, nLastIndex );
+ if ( sRequestedName.getLength() )
+ {
+ aResolveURL = aResolveURL.concat( OUString(RTL_CONSTASCII_USTRINGPARAM("?requestedName=")));
+ aResolveURL = aResolveURL.concat( sRequestedName );
+ }
+ }
+
+ aStr = mrExport.AddEmbeddedGraphicObject( aResolveURL );
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, aStr );
+
+ if( aStr.getLength() )
+ {
+ if( aStr[ 0 ] == '#' )
+ {
+ aStreamURL = OUString(RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package:" ));
+ aStreamURL = aStreamURL.concat( aStr.copy( 1, aStr.getLength() - 1 ) );
+ }
+
+ // update stream URL for load on demand
+ uno::Any aAny;
+ aAny <<= aStreamURL;
+ xPropSet->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicStreamURL")), aAny );
+
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
+ }
+ }
+ else
+ {
+ OUString aStr;
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, aStr );
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
+ }
+
+ {
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_IMAGE, sal_True, sal_True);
+
+ if( sImageURL.getLength() )
+ {
+ // optional office:binary-data
+ mrExport.AddEmbeddedGraphicObjectAsBase64( sImageURL );
+ }
+ if( !bIsEmptyPresObj )
+ ImpExportText( xShape );
+ }
+ }
+
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+
+ // image map
+ GetExport().GetImageMapExport().Export( xPropSet );
+ ImpExportDescription( xShape ); // #i68101#
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportChartShape(
+ const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType eShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint,
+ SvXMLAttributeList* pAttrList )
+{
+ ImpExportOLE2Shape( xShape, eShapeType, nFeatures, pRefPoint, pAttrList );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportControlShape(
+ const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint)
+{
+ const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ // Transformation
+ ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
+ }
+
+ uno::Reference< drawing::XControlShape > xControl( xShape, uno::UNO_QUERY );
+ DBG_ASSERT( xControl.is(), "Control shape is not supporting XControlShape" );
+ if( xControl.is() )
+ {
+ uno::Reference< beans::XPropertySet > xControlModel( xControl->getControl(), uno::UNO_QUERY );
+ DBG_ASSERT( xControlModel.is(), "Control shape has not XControlModel" );
+ if( xControlModel.is() )
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CONTROL, mrExport.GetFormExport()->getControlId( xControlModel ) );
+ }
+ }
+
+ sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_CONTROL, bCreateNewline, sal_True);
+
+ ImpExportDescription( xShape ); // #i68101#
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportConnectorShape(
+ const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType, sal_Int32 nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */)
+{
+ uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY );
+
+ OUString aStr;
+ OUStringBuffer sStringBuffer;
+
+ // export connection kind
+ drawing::ConnectorType eType = drawing::ConnectorType_STANDARD;
+ uno::Any aAny = xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeKind")));
+ aAny >>= eType;
+
+ if( eType != drawing::ConnectorType_STANDARD )
+ {
+ SvXMLUnitConverter::convertEnum( sStringBuffer, (sal_uInt16)eType, aXML_ConnectionKind_EnumMap );
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_TYPE, aStr);
+ }
+
+ // export line skew
+ sal_Int32 nDelta1 = 0, nDelta2 = 0, nDelta3 = 0;
+
+ aAny = xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeLine1Delta")));
+ aAny >>= nDelta1;
+ aAny = xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeLine2Delta")));
+ aAny >>= nDelta2;
+ aAny = xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeLine3Delta")));
+ aAny >>= nDelta3;
+
+ if( nDelta1 != 0 || nDelta2 != 0 || nDelta3 != 0 )
+ {
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nDelta1);
+ if( nDelta2 != 0 || nDelta3 != 0 )
+ {
+ const char aSpace = ' ';
+ sStringBuffer.appendAscii( &aSpace, 1 );
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nDelta2);
+ if( nDelta3 != 0 )
+ {
+ sStringBuffer.appendAscii( &aSpace, 1 );
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nDelta3);
+ }
+ }
+
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_LINE_SKEW, aStr);
+ }
+
+ // export start and end point
+ awt::Point aStart(0,0);
+ awt::Point aEnd(1,1);
+
+ /* Get <StartPositionInHoriL2R> and
+ <EndPositionInHoriL2R>, if they exist and if the document is exported
+ into the OpenOffice.org file format.
+ These properties only exist at service com::sun::star::text::Shape - the
+ Writer UNO service for shapes.
+ This code is needed, because the positioning attributes in the
+ OpenOffice.org file format are given in horizontal left-to-right layout
+ regardless the layout direction the shape is in. In the OASIS Open Office
+ file format the positioning attributes are correctly given in the layout
+ direction the shape is in. Thus, this code provides the conversion from
+ the OASIS Open Office file format to the OpenOffice.org file format. (#i36248#)
+ */
+ if ( ( GetExport().getExportFlags() & EXPORT_OASIS ) == 0 &&
+ xProps->getPropertySetInfo()->hasPropertyByName(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("StartPositionInHoriL2R"))) &&
+ xProps->getPropertySetInfo()->hasPropertyByName(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("EndPositionInHoriL2R"))) )
+ {
+ xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartPositionInHoriL2R"))) >>= aStart;
+ xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndPositionInHoriL2R"))) >>= aEnd;
+ }
+ else
+ {
+ xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartPosition"))) >>= aStart;
+ xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndPosition"))) >>= aEnd;
+ }
+
+ if( pRefPoint )
+ {
+ aStart.X -= pRefPoint->X;
+ aStart.Y -= pRefPoint->Y;
+ aEnd.X -= pRefPoint->X;
+ aEnd.Y -= pRefPoint->Y;
+ }
+
+ if( nFeatures & SEF_EXPORT_X )
+ {
+ // svg: x1
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aStart.X);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X1, aStr);
+ }
+ else
+ {
+ aEnd.X -= aStart.X;
+ }
+
+ if( nFeatures & SEF_EXPORT_Y )
+ {
+ // svg: y1
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aStart.Y);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y1, aStr);
+ }
+ else
+ {
+ aEnd.Y -= aStart.Y;
+ }
+
+ // svg: x2
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aEnd.X);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X2, aStr);
+
+ // svg: y2
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aEnd.Y);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y2, aStr);
+
+ // #i39320#
+ uno::Reference< uno::XInterface > xRefS;
+ uno::Reference< uno::XInterface > xRefE;
+
+ // export start connection
+ xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartShape") ) ) >>= xRefS;
+ if( xRefS.is() )
+ {
+ const OUString& rShapeId = mrExport.getInterfaceToIdentifierMapper().getIdentifier( xRefS );
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_START_SHAPE, rShapeId);
+
+ aAny = xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartGluePointIndex")) );
+ sal_Int32 nGluePointId = 0;
+ if( aAny >>= nGluePointId )
+ {
+ if( nGluePointId != -1 )
+ {
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_START_GLUE_POINT, OUString::valueOf( nGluePointId ));
+ }
+ }
+ }
+
+ // export end connection
+ xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndShape")) ) >>= xRefE;
+ if( xRefE.is() )
+ {
+ const OUString& rShapeId = mrExport.getInterfaceToIdentifierMapper().getIdentifier( xRefE );
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_END_SHAPE, rShapeId);
+
+ aAny = xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndGluePointIndex")) );
+ sal_Int32 nGluePointId = 0;
+ if( aAny >>= nGluePointId )
+ {
+ if( nGluePointId != -1 )
+ {
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_END_GLUE_POINT, OUString::valueOf( nGluePointId ));
+ }
+ }
+ }
+
+ if( xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("PolyPolygonBezier") ) ) >>= aAny )
+ {
+ // get PolygonBezier
+ drawing::PolyPolygonBezierCoords* pSourcePolyPolygon =
+ (drawing::PolyPolygonBezierCoords*)aAny.getValue();
+
+ if(pSourcePolyPolygon && pSourcePolyPolygon->Coordinates.getLength())
+ {
+ sal_Int32 nOuterCnt(pSourcePolyPolygon->Coordinates.getLength());
+ drawing::PointSequence* pOuterSequence = pSourcePolyPolygon->Coordinates.getArray();
+ drawing::FlagSequence* pOuterFlags = pSourcePolyPolygon->Flags.getArray();
+
+ if(pOuterSequence && pOuterFlags)
+ {
+ // prepare svx:d element export
+ awt::Point aPoint( 0, 0 );
+ awt::Size aSize( 1, 1 );
+ SdXMLImExViewBox aViewBox( 0, 0, 1, 1 );
+ SdXMLImExSvgDElement aSvgDElement(aViewBox);
+
+ for(sal_Int32 a(0L); a < nOuterCnt; a++)
+ {
+ drawing::PointSequence* pSequence = pOuterSequence++;
+ drawing::FlagSequence* pFlags = pOuterFlags++;
+
+ if(pSequence && pFlags)
+ {
+ aSvgDElement.AddPolygon(pSequence, pFlags,
+ aPoint, aSize, sal_False );
+ }
+ }
+
+ // write point array
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aSvgDElement.GetExportString());
+ }
+ }
+ }
+
+ // write connector shape. Add Export later.
+ sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_CONNECTOR, bCreateNewline, sal_True);
+
+ ImpExportDescription( xShape ); // #i68101#
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+ ImpExportText( xShape );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportMeasureShape(
+ const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType, sal_Int32 nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */)
+{
+ uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY );
+
+ OUString aStr;
+ OUStringBuffer sStringBuffer;
+
+ // export start and end point
+ awt::Point aStart(0,0);
+ awt::Point aEnd(1,1);
+
+ /* Get <StartPositionInHoriL2R> and
+ <EndPositionInHoriL2R>, if they exist and if the document is exported
+ into the OpenOffice.org file format.
+ These properties only exist at service com::sun::star::text::Shape - the
+ Writer UNO service for shapes.
+ This code is needed, because the positioning attributes in the
+ OpenOffice.org file format are given in horizontal left-to-right layout
+ regardless the layout direction the shape is in. In the OASIS Open Office
+ file format the positioning attributes are correctly given in the layout
+ direction the shape is in. Thus, this code provides the conversion from
+ the OASIS Open Office file format to the OpenOffice.org file format. (#i36248#)
+ */
+ if ( ( GetExport().getExportFlags() & EXPORT_OASIS ) == 0 &&
+ xProps->getPropertySetInfo()->hasPropertyByName(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("StartPositionInHoriL2R"))) &&
+ xProps->getPropertySetInfo()->hasPropertyByName(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("EndPositionInHoriL2R"))) )
+ {
+ xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartPositionInHoriL2R"))) >>= aStart;
+ xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndPositionInHoriL2R"))) >>= aEnd;
+ }
+ else
+ {
+ xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartPosition"))) >>= aStart;
+ xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndPosition"))) >>= aEnd;
+ }
+
+ if( pRefPoint )
+ {
+ aStart.X -= pRefPoint->X;
+ aStart.Y -= pRefPoint->Y;
+ aEnd.X -= pRefPoint->X;
+ aEnd.Y -= pRefPoint->Y;
+ }
+
+ if( nFeatures & SEF_EXPORT_X )
+ {
+ // svg: x1
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aStart.X);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X1, aStr);
+ }
+ else
+ {
+ aEnd.X -= aStart.X;
+ }
+
+ if( nFeatures & SEF_EXPORT_Y )
+ {
+ // svg: y1
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aStart.Y);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y1, aStr);
+ }
+ else
+ {
+ aEnd.Y -= aStart.Y;
+ }
+
+ // svg: x2
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aEnd.X);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X2, aStr);
+
+ // svg: y2
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aEnd.Y);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y2, aStr);
+
+ // write measure shape
+ sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_MEASURE, bCreateNewline, sal_True);
+
+ ImpExportDescription( xShape ); // #i68101#
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+
+ uno::Reference< text::XText > xText( xShape, uno::UNO_QUERY );
+ if( xText.is() )
+ mrExport.GetTextParagraphExport()->exportText( xText );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportOLE2Shape(
+ const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType eShapeType, sal_Int32 nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */,
+ SvXMLAttributeList* pAttrList /* = NULL */ )
+{
+ uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
+ uno::Reference< container::XNamed > xNamed(xShape, uno::UNO_QUERY);
+
+ DBG_ASSERT( xPropSet.is() && xNamed.is(), "ole shape is not implementing needed interfaces");
+ if(xPropSet.is() && xNamed.is())
+ {
+ // Transformation
+ ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
+
+ sal_Bool bIsEmptyPresObj = sal_False;
+
+ // presentation settings
+ if(eShapeType == XmlShapeTypePresOLE2Shape)
+ bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_OBJECT) );
+ else if(eShapeType == XmlShapeTypePresChartShape)
+ bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_CHART) );
+ else if(eShapeType == XmlShapeTypePresSheetShape)
+ bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_TABLE) );
+
+ sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
+ sal_Bool bExportEmbedded(0 != (mrExport.getExportFlags() & EXPORT_EMBEDDED));
+ OUString sPersistName;
+ SvXMLElementExport aElement( mrExport, XML_NAMESPACE_DRAW,
+ XML_FRAME, bCreateNewline, sal_True );
+
+ const bool bSaveBackwardsCompatible = ( mrExport.getExportFlags() & EXPORT_SAVEBACKWARDCOMPATIBLE );
+
+ if( !bIsEmptyPresObj || bSaveBackwardsCompatible )
+ {
+ if (pAttrList)
+ {
+ mrExport.AddAttributeList(pAttrList);
+ }
+
+ OUString sClassId;
+ OUString sURL;
+ sal_Bool bInternal = false;
+ xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("IsInternal"))) >>= bInternal;
+
+ if( !bIsEmptyPresObj )
+ {
+
+ if ( bInternal )
+ {
+ // OOo internal links have no storage persistance, URL is stored in the XML file
+ // the result LinkURL is empty in case the object is not a link
+ xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM( "LinkURL" )) ) >>= sURL;
+ }
+
+ xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM( "PersistName" ) ) ) >>= sPersistName;
+ if ( !sURL.getLength() )
+ {
+ if( sPersistName.getLength() )
+ {
+ sURL = OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.EmbeddedObject:" ) );
+ sURL += sPersistName;
+ }
+ }
+
+ if( !bInternal )
+ xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CLSID"))) >>= sClassId;
+
+ if( sClassId.getLength() )
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_CLASS_ID, sClassId );
+ if(!bExportEmbedded)
+ {
+ // xlink:href
+ if( sURL.getLength() )
+ {
+ // #96717# in theorie, if we don't have a url we shouldn't even
+ // export this ole shape. But practical its to risky right now
+ // to change this so we better dispose this on load
+ sURL = mrExport.AddEmbeddedObject( sURL );
+
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, sURL );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
+ }
+ }
+ }
+ else
+ {
+ // export empty href for empty placeholders to be valid odf
+ OUString sEmptyURL;
+
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, sEmptyURL );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
+ }
+
+ enum XMLTokenEnum eElem = sClassId.getLength() ? XML_OBJECT_OLE : XML_OBJECT;
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, eElem, sal_True, sal_True );
+
+ if(bExportEmbedded && !bIsEmptyPresObj)
+ {
+ // #100592#
+ if(bInternal)
+ {
+ // embedded XML
+ uno::Reference< lang::XComponent > xComp;
+ xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("Model") ) ) >>= xComp;
+ DBG_ASSERT( xComp.is(), "no xModel for own OLE format" );
+ mrExport.ExportEmbeddedOwnObject( xComp );
+ }
+ else
+ {
+ // embed as Base64
+ // this is an alien object ( currently MSOLE is the only supported type of such objects )
+ // in case it is not an OASIS format the object should be asked to store replacement image if possible
+
+ ::rtl::OUString sURLRequest( sURL );
+ if ( ( mrExport.getExportFlags() & EXPORT_OASIS ) == 0 )
+ sURLRequest += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "?oasis=false" ) );
+ mrExport.AddEmbeddedObjectAsBase64( sURLRequest );
+ }
+ }
+ }
+ if( !bIsEmptyPresObj )
+ {
+ OUString sURL( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.GraphicObject:" ) );
+ sURL += sPersistName;
+ if( !bExportEmbedded )
+ {
+ sURL = GetExport().AddEmbeddedObject( sURL );
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, sURL );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
+ }
+
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_DRAW,
+ XML_IMAGE, sal_False, sal_True );
+
+ if( bExportEmbedded )
+ GetExport().AddEmbeddedObjectAsBase64( sURL );
+ }
+
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+ ImpExportDescription( xShape ); // #i68101#
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportPageShape(
+ const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType eShapeType, sal_Int32 nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */)
+{
+ const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ // #86163# Transformation
+ ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
+
+ // export page number used for this page
+ uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
+ const OUString aPageNumberStr(RTL_CONSTASCII_USTRINGPARAM("PageNumber"));
+ if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(aPageNumberStr))
+ {
+ sal_Int32 nPageNumber = 0;
+ xPropSet->getPropertyValue(aPageNumberStr) >>= nPageNumber;
+ if( nPageNumber )
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_PAGE_NUMBER, OUString::valueOf(nPageNumber));
+ }
+
+ // a presentation page shape, normally used on notes pages only. If
+ // it is used not as presentation shape, it may have been created with
+ // copy-paste exchange between draw and impress (this IS possible...)
+ if(eShapeType == XmlShapeTypePresPageShape)
+ {
+ mrExport.AddAttribute(XML_NAMESPACE_PRESENTATION, XML_CLASS,
+ XML_PRESENTATION_PAGE);
+ }
+
+ // write Page shape
+ sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_PAGE_THUMBNAIL, bCreateNewline, sal_True);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportCaptionShape(
+ const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType, sal_Int32 nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */)
+{
+ const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ // Transformation
+ ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
+
+ // evtl. corner radius?
+ sal_Int32 nCornerRadius(0L);
+ xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CornerRadius"))) >>= nCornerRadius;
+ if(nCornerRadius)
+ {
+ OUStringBuffer sStringBuffer;
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nCornerRadius);
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_CORNER_RADIUS, sStringBuffer.makeStringAndClear());
+ }
+
+ awt::Point aCaptionPoint;
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "CaptionPoint" ) ) ) >>= aCaptionPoint;
+
+ mrExport.GetMM100UnitConverter().convertMeasure(msBuffer, aCaptionPoint.X);
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CAPTION_POINT_X, msBuffer.makeStringAndClear() );
+ mrExport.GetMM100UnitConverter().convertMeasure(msBuffer, aCaptionPoint.Y);
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CAPTION_POINT_Y, msBuffer.makeStringAndClear() );
+
+ // write Caption shape. Add export later.
+ sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
+ sal_Bool bAnnotation( (nFeatures & SEF_EXPORT_ANNOTATION) == SEF_EXPORT_ANNOTATION );
+
+ SvXMLElementExport aObj( mrExport,
+ (bAnnotation ? XML_NAMESPACE_OFFICE
+ : XML_NAMESPACE_DRAW),
+ (bAnnotation ? XML_ANNOTATION : XML_CAPTION),
+ bCreateNewline, sal_True );
+
+ ImpExportDescription( xShape ); // #i68101#
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+ if( bAnnotation )
+ mrExport.exportAnnotationMeta( xShape );
+ ImpExportText( xShape );
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportFrameShape(
+ const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint)
+{
+ const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ // Transformation
+ ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
+
+ sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW,
+ XML_FRAME, bCreateNewline, sal_True );
+
+ // export frame url
+ OUString aStr;
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "FrameURL" ) ) ) >>= aStr;
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(aStr) );
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
+
+ // export name
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "FrameName" ) ) ) >>= aStr;
+ if( aStr.getLength() )
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_FRAME_NAME, aStr );
+
+ // write floating frame
+ {
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_FLOATING_FRAME, sal_True, sal_True);
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportAppletShape(
+ const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint)
+{
+ const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ // Transformation
+ ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
+
+ sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
+ SvXMLElementExport aElement( mrExport, XML_NAMESPACE_DRAW,
+ XML_FRAME, bCreateNewline, sal_True );
+
+ // export frame url
+ OUString aStr;
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletCodeBase" ) ) ) >>= aStr;
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(aStr) );
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
+
+ // export draw:applet-name
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletName" ) ) ) >>= aStr;
+ if( aStr.getLength() )
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_APPLET_NAME, aStr );
+
+ // export draw:code
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletCode" ) ) ) >>= aStr;
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CODE, aStr );
+
+ // export draw:may-script
+ sal_Bool bIsScript = false;
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletIsScript" ) ) ) >>= bIsScript;
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MAY_SCRIPT, bIsScript ? XML_TRUE : XML_FALSE );
+
+ {
+ // write applet
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_APPLET, sal_True, sal_True);
+
+ // export parameters
+ uno::Sequence< beans::PropertyValue > aCommands;
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletCommands" ) ) ) >>= aCommands;
+ const sal_Int32 nCount = aCommands.getLength();
+ for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
+ {
+ aCommands[nIndex].Value >>= aStr;
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aCommands[nIndex].Name );
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, aStr );
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True );
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportPluginShape(
+ const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint)
+{
+ const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ // Transformation
+ ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
+
+ sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
+ SvXMLElementExport aElement( mrExport, XML_NAMESPACE_DRAW,
+ XML_FRAME, bCreateNewline, sal_True );
+
+ // export plugin url
+ OUString aStr;
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "PluginURL" ) ) ) >>= aStr;
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(aStr) );
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
+
+
+ // export mime-type
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "PluginMimeType" ) ) ) >>= aStr;
+ if(aStr.getLength())
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MIME_TYPE, aStr );
+
+ {
+ // write plugin
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_PLUGIN, sal_True, sal_True);
+
+ // export parameters
+ uno::Sequence< beans::PropertyValue > aCommands;
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "PluginCommands" ) ) ) >>= aCommands;
+ const sal_Int32 nCount = aCommands.getLength();
+ for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
+ {
+ aCommands[nIndex].Value >>= aStr;
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aCommands[nIndex].Name );
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, aStr );
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True );
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportMediaShape(
+ const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType eShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint)
+{
+ const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ // Transformation
+ ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
+
+ if(eShapeType == XmlShapeTypePresMediaShape)
+ ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_OBJECT) );
+
+ sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW,
+ XML_FRAME, bCreateNewline, sal_True );
+
+ // export media url
+ OUString aMediaURL;
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaURL" ) ) ) >>= aMediaURL;
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference( aMediaURL ) );
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
+
+ // export mime-type
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MIME_TYPE, OUString( RTL_CONSTASCII_USTRINGPARAM( "application/vnd.sun.star.media" ) ) );
+
+ // write plugin
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_PLUGIN, !( nFeatures & SEF_EXPORT_NO_WS ), sal_True);
+
+ // export parameters
+ const OUString aFalseStr( RTL_CONSTASCII_USTRINGPARAM( "false" ) ), aTrueStr( RTL_CONSTASCII_USTRINGPARAM( "true" ) );
+
+ sal_Bool bLoop = false;
+ const OUString aLoopStr( RTL_CONSTASCII_USTRINGPARAM( "Loop" ) );
+ xPropSet->getPropertyValue( aLoopStr ) >>= bLoop;
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aLoopStr );
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, bLoop ? aTrueStr : aFalseStr );
+ delete( new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True ) );
+
+ sal_Bool bMute = false;
+ const OUString aMuteStr( RTL_CONSTASCII_USTRINGPARAM( "Mute" ) );
+ xPropSet->getPropertyValue( aMuteStr ) >>= bMute;
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aMuteStr );
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, bMute ? aTrueStr : aFalseStr );
+ delete( new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True ) );
+
+ sal_Int16 nVolumeDB = 0;
+ const OUString aVolumeDBStr( RTL_CONSTASCII_USTRINGPARAM( "VolumeDB" ) );
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "VolumeDB" ) ) ) >>= nVolumeDB;
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aVolumeDBStr );
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, OUString::valueOf( static_cast< sal_Int32 >( nVolumeDB ) ) );
+ delete( new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True ) );
+
+ media::ZoomLevel eZoom;
+ const OUString aZoomStr( RTL_CONSTASCII_USTRINGPARAM( "Zoom" ) );
+ OUString aZoomValue;
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Zoom" ) ) ) >>= eZoom;
+ switch( eZoom )
+ {
+ case( media::ZoomLevel_ZOOM_1_TO_4 ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "25%" ) ); break;
+ case( media::ZoomLevel_ZOOM_1_TO_2 ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "50%" ) ); break;
+ case( media::ZoomLevel_ORIGINAL ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "100%" ) ); break;
+ case( media::ZoomLevel_ZOOM_2_TO_1 ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "200%" ) ); break;
+ case( media::ZoomLevel_ZOOM_4_TO_1 ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "400%" ) ); break;
+ case( media::ZoomLevel_FIT_TO_WINDOW ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "fit" ) ); break;
+ case( media::ZoomLevel_FIT_TO_WINDOW_FIXED_ASPECT ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "fixedfit" ) ); break;
+ case( media::ZoomLevel_FULLSCREEN ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "fullscreen" ) ); break;
+
+ default:
+ break;
+ }
+
+ if( aZoomValue.getLength() )
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aZoomStr );
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, aZoomValue );
+ delete( new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True ) );
+ }
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/shapeexport3.cxx b/xmloff/source/draw/shapeexport3.cxx
new file mode 100644
index 000000000000..759509f112d8
--- /dev/null
+++ b/xmloff/source/draw/shapeexport3.cxx
@@ -0,0 +1,499 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/drawing/HomogenMatrix.hpp>
+#include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
+#include <com/sun/star/drawing/ProjectionMode.hpp>
+#include <com/sun/star/drawing/ShadeMode.hpp>
+#include <com/sun/star/drawing/Direction3D.hpp>
+#include <com/sun/star/drawing/Position3D.hpp>
+#include <com/sun/star/drawing/CameraGeometry.hpp>
+#include <com/sun/star/drawing/DoubleSequence.hpp>
+#include <tools/gen.hxx>
+
+#include <xmloff/shapeexport.hxx>
+#include "sdpropls.hxx"
+#include <tools/debug.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "xexptran.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <basegfx/vector/b3dvector.hxx>
+
+#include "xmloff/xmlnmspe.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExport3DSceneShape( const uno::Reference< drawing::XShape >& xShape, XmlShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint)
+{
+ uno::Reference< drawing::XShapes > xShapes(xShape, uno::UNO_QUERY);
+ if(xShapes.is() && xShapes->getCount())
+ {
+ uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY );
+ DBG_ASSERT( xPropSet.is(), "XMLShapeExport::ImpExport3DSceneShape can't export a scene without a propertyset" );
+ if( xPropSet.is() )
+ {
+ // Transformation
+ ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
+
+ // 3d attributes
+ export3DSceneAttributes( xPropSet );
+
+ // write 3DScene shape
+ sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
+ SvXMLElementExport aOBJ( mrExport, XML_NAMESPACE_DR3D, XML_SCENE, bCreateNewline, sal_True);
+
+ ImpExportDescription( xShape ); // #i68101#
+ ImpExportEvents( xShape );
+
+ // write 3DSceneLights
+ export3DLamps( xPropSet );
+
+ // #89764# if export of position is supressed for group shape,
+ // positions of contained objects should be written relative to
+ // the upper left edge of the group.
+ awt::Point aUpperLeft;
+
+ if(!(nFeatures & SEF_EXPORT_POSITION))
+ {
+ nFeatures |= SEF_EXPORT_POSITION;
+ aUpperLeft = xShape->getPosition();
+ pRefPoint = &aUpperLeft;
+ }
+
+ // write members
+ exportShapes( xShapes, nFeatures, pRefPoint );
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExport3DShape(
+ const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType eShapeType, sal_Int32 /* nFeatures = SEF_DEFAULT */, awt::Point* /*pRefPoint = NULL */)
+{
+ const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ OUString aStr;
+ OUStringBuffer sStringBuffer;
+
+ // transformation (UNO_NAME_3D_TRANSFORM_MATRIX == "D3DTransformMatrix")
+ uno::Any aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DTransformMatrix")));
+ drawing::HomogenMatrix xHomMat;
+ aAny >>= xHomMat;
+ SdXMLImExTransform3D aTransform;
+ aTransform.AddHomogenMatrix(xHomMat);
+ if(aTransform.NeedsAction())
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_TRANSFORM, aTransform.GetExportString(mrExport.GetMM100UnitConverter()));
+
+ switch(eShapeType)
+ {
+ case XmlShapeTypeDraw3DCubeObject:
+ {
+ // write 3DCube shape
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DR3D, XML_CUBE, sal_True, sal_True);
+
+ // minEdge
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DPosition")));
+ drawing::Position3D aPosition3D;
+ aAny >>= aPosition3D;
+ ::basegfx::B3DVector aPos3D(aPosition3D.PositionX, aPosition3D.PositionY, aPosition3D.PositionZ);
+
+ // maxEdge
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSize")));
+ drawing::Direction3D aDirection3D;
+ aAny >>= aDirection3D;
+ ::basegfx::B3DVector aDir3D(aDirection3D.DirectionX, aDirection3D.DirectionY, aDirection3D.DirectionZ);
+
+ // transform maxEdge from distance to pos
+ aDir3D = aPos3D + aDir3D;
+
+ // write minEdge
+ if(aPos3D != ::basegfx::B3DVector(-2500.0, -2500.0, -2500.0)) // write only when not default
+ {
+ mrExport.GetMM100UnitConverter().convertB3DVector(sStringBuffer, aPos3D);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_MIN_EDGE, aStr);
+ }
+
+ // write maxEdge
+ if(aDir3D != ::basegfx::B3DVector(2500.0, 2500.0, 2500.0)) // write only when not default
+ {
+ mrExport.GetMM100UnitConverter().convertB3DVector(sStringBuffer, aDir3D);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_MAX_EDGE, aStr);
+ }
+
+ break;
+ }
+ case XmlShapeTypeDraw3DSphereObject:
+ {
+ // write 3DSphere shape
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DR3D, XML_SPHERE, sal_True, sal_True);
+
+ // Center
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DPosition")));
+ drawing::Position3D aPosition3D;
+ aAny >>= aPosition3D;
+ ::basegfx::B3DVector aPos3D(aPosition3D.PositionX, aPosition3D.PositionY, aPosition3D.PositionZ);
+
+ // Size
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSize")));
+ drawing::Direction3D aDirection3D;
+ aAny >>= aDirection3D;
+ ::basegfx::B3DVector aDir3D(aDirection3D.DirectionX, aDirection3D.DirectionY, aDirection3D.DirectionZ);
+
+ // write Center
+ if(aPos3D != ::basegfx::B3DVector(0.0, 0.0, 0.0)) // write only when not default
+ {
+ mrExport.GetMM100UnitConverter().convertB3DVector(sStringBuffer, aPos3D);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_CENTER, aStr);
+ }
+
+ // write Size
+ if(aDir3D != ::basegfx::B3DVector(5000.0, 5000.0, 5000.0)) // write only when not default
+ {
+ mrExport.GetMM100UnitConverter().convertB3DVector(sStringBuffer, aDir3D);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_SIZE, aStr);
+ }
+
+ break;
+ }
+ case XmlShapeTypeDraw3DLatheObject:
+ case XmlShapeTypeDraw3DExtrudeObject:
+ {
+ // write special 3DLathe/3DExtrude attributes
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DPolyPolygon3D")));
+ drawing::PolyPolygonShape3D xPolyPolygon3D;
+ aAny >>= xPolyPolygon3D;
+
+ // look for maximal values
+ double fXMin = 0;
+ double fXMax = 0;
+ double fYMin = 0;
+ double fYMax = 0;
+ sal_Bool bInit(sal_False);
+ sal_Int32 nOuterSequenceCount(xPolyPolygon3D.SequenceX.getLength());
+ drawing::DoubleSequence* pInnerSequenceX = xPolyPolygon3D.SequenceX.getArray();
+ drawing::DoubleSequence* pInnerSequenceY = xPolyPolygon3D.SequenceY.getArray();
+
+ sal_Int32 a;
+ for (a = 0; a < nOuterSequenceCount; a++)
+ {
+ sal_Int32 nInnerSequenceCount(pInnerSequenceX->getLength());
+ double* pArrayX = pInnerSequenceX->getArray();
+ double* pArrayY = pInnerSequenceY->getArray();
+
+ for(sal_Int32 b(0L); b < nInnerSequenceCount; b++)
+ {
+ double fX = *pArrayX++;
+ double fY = *pArrayY++;
+
+ if(bInit)
+ {
+ if(fX > fXMax)
+ fXMax = fX;
+
+ if(fX < fXMin)
+ fXMin = fX;
+
+ if(fY > fYMax)
+ fYMax = fY;
+
+ if(fY < fYMin)
+ fYMin = fY;
+ }
+ else
+ {
+ fXMin = fXMax = fX;
+ fYMin = fYMax = fY;
+ bInit = sal_True;
+ }
+ }
+
+ pInnerSequenceX++;
+ pInnerSequenceY++;
+ }
+
+ // export ViewBox
+ awt::Point aMinPoint(FRound(fXMin), FRound(fYMin));
+ awt::Size aMaxSize(FRound(fXMax) - aMinPoint.X, FRound(fYMax) - aMinPoint.Y);
+ SdXMLImExViewBox aViewBox(
+ aMinPoint.X, aMinPoint.Y, aMaxSize.Width, aMaxSize.Height);
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX,
+ aViewBox.GetExportString());
+
+ // prepare svx:d element export
+ SdXMLImExSvgDElement aSvgDElement(aViewBox);
+ pInnerSequenceX = xPolyPolygon3D.SequenceX.getArray();
+ pInnerSequenceY = xPolyPolygon3D.SequenceY.getArray();
+
+ for (a = 0; a < nOuterSequenceCount; a++)
+ {
+ sal_Int32 nInnerSequenceCount(pInnerSequenceX->getLength());
+ double* pArrayX = pInnerSequenceX->getArray();
+ double* pArrayY = pInnerSequenceY->getArray();
+ drawing::PointSequence aPoly(nInnerSequenceCount);
+ awt::Point* pInnerSequence = aPoly.getArray();
+
+ for(sal_Int32 b(0L); b < nInnerSequenceCount; b++)
+ {
+ double fX = *pArrayX++;
+ double fY = *pArrayY++;
+
+ *pInnerSequence = awt::Point(FRound(fX), FRound(fY));
+ pInnerSequence++;
+ }
+
+ // calculate closed flag
+ awt::Point* pFirst = aPoly.getArray();
+ awt::Point* pLast = pFirst + (nInnerSequenceCount - 1);
+ sal_Bool bClosed = (pFirst->X == pLast->X && pFirst->Y == pLast->Y);
+
+ aSvgDElement.AddPolygon(&aPoly, 0L, aMinPoint,
+ aMaxSize, bClosed);
+
+ // #80594# corrected error in PolyPolygon3D export for 3D XML
+ pInnerSequenceX++;
+ pInnerSequenceY++;
+ }
+
+ // write point array
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aSvgDElement.GetExportString());
+
+ if(eShapeType == XmlShapeTypeDraw3DLatheObject)
+ {
+ // write 3DLathe shape
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DR3D, XML_ROTATE, sal_True, sal_True);
+ }
+ else
+ {
+ // write 3DExtrude shape
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DR3D, XML_EXTRUDE, sal_True, sal_True);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+/** helper for chart that adds all attributes of a 3d scene element to the export */
+void XMLShapeExport::export3DSceneAttributes( const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xPropSet )
+{
+ OUString aStr;
+ OUStringBuffer sStringBuffer;
+
+ // world transformation (UNO_NAME_3D_TRANSFORM_MATRIX == "D3DTransformMatrix")
+ uno::Any aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DTransformMatrix")));
+ drawing::HomogenMatrix xHomMat;
+ aAny >>= xHomMat;
+ SdXMLImExTransform3D aTransform;
+ aTransform.AddHomogenMatrix(xHomMat);
+ if(aTransform.NeedsAction())
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_TRANSFORM, aTransform.GetExportString(mrExport.GetMM100UnitConverter()));
+
+ // VRP, VPN, VUP
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DCameraGeometry")));
+ drawing::CameraGeometry aCamGeo;
+ aAny >>= aCamGeo;
+
+ ::basegfx::B3DVector aVRP(aCamGeo.vrp.PositionX, aCamGeo.vrp.PositionY, aCamGeo.vrp.PositionZ);
+ if(aVRP != ::basegfx::B3DVector(0.0, 0.0, 1.0)) // write only when not default
+ {
+ mrExport.GetMM100UnitConverter().convertB3DVector(sStringBuffer, aVRP);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_VRP, aStr);
+ }
+
+ ::basegfx::B3DVector aVPN(aCamGeo.vpn.DirectionX, aCamGeo.vpn.DirectionY, aCamGeo.vpn.DirectionZ);
+ if(aVPN != ::basegfx::B3DVector(0.0, 0.0, 1.0)) // write only when not default
+ {
+ mrExport.GetMM100UnitConverter().convertB3DVector(sStringBuffer, aVPN);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_VPN, aStr);
+ }
+
+ ::basegfx::B3DVector aVUP(aCamGeo.vup.DirectionX, aCamGeo.vup.DirectionY, aCamGeo.vup.DirectionZ);
+ if(aVUP != ::basegfx::B3DVector(0.0, 1.0, 0.0)) // write only when not default
+ {
+ mrExport.GetMM100UnitConverter().convertB3DVector(sStringBuffer, aVUP);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_VUP, aStr);
+ }
+
+ // projection "D3DScenePerspective" drawing::ProjectionMode
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DScenePerspective")));
+ drawing::ProjectionMode xPrjMode;
+ aAny >>= xPrjMode;
+ if(xPrjMode == drawing::ProjectionMode_PARALLEL)
+ aStr = GetXMLToken(XML_PARALLEL);
+ else
+ aStr = GetXMLToken(XML_PERSPECTIVE);
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_PROJECTION, aStr);
+
+ // distance
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneDistance")));
+ sal_Int32 nDistance = 0;
+ aAny >>= nDistance;
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nDistance);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_DISTANCE, aStr);
+
+ // focalLength
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneFocalLength")));
+ sal_Int32 nFocalLength = 0;
+ aAny >>= nFocalLength;
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nFocalLength);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_FOCAL_LENGTH, aStr);
+
+ // shadowSlant
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneShadowSlant")));
+ sal_Int16 nShadowSlant = 0;
+ aAny >>= nShadowSlant;
+ mrExport.GetMM100UnitConverter().convertNumber(sStringBuffer, (sal_Int32)nShadowSlant);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_SHADOW_SLANT, aStr);
+
+ // shadeMode
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneShadeMode")));
+ drawing::ShadeMode xShadeMode;
+ if(aAny >>= xShadeMode)
+ {
+ if(xShadeMode == drawing::ShadeMode_FLAT)
+ aStr = GetXMLToken(XML_FLAT);
+ else if(xShadeMode == drawing::ShadeMode_PHONG)
+ aStr = GetXMLToken(XML_PHONG);
+ else if(xShadeMode == drawing::ShadeMode_SMOOTH)
+ aStr = GetXMLToken(XML_GOURAUD);
+ else
+ aStr = GetXMLToken(XML_DRAFT);
+ }
+ else
+ {
+ // ShadeMode enum not there, write default
+ aStr = GetXMLToken(XML_GOURAUD);
+ }
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_SHADE_MODE, aStr);
+
+ // ambientColor
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneAmbientColor")));
+ sal_Int32 aColTemp = 0;
+ Color aAmbientColor;
+ aAny >>= aColTemp; aAmbientColor.SetColor(aColTemp);
+ mrExport.GetMM100UnitConverter().convertColor(sStringBuffer, aAmbientColor);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_AMBIENT_COLOR, aStr);
+
+ // lightingMode
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneTwoSidedLighting")));
+ sal_Bool bTwoSidedLighting = false;
+ aAny >>= bTwoSidedLighting;
+ mrExport.GetMM100UnitConverter().convertBool(sStringBuffer, bTwoSidedLighting);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_LIGHTING_MODE, aStr);
+}
+
+/** helper for chart that exports all lamps from the propertyset */
+void XMLShapeExport::export3DLamps( const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xPropSet )
+{
+ // write lamps 1..8 as content
+ OUString aStr;
+ OUStringBuffer sStringBuffer;
+
+ const OUString aColorPropName(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor") );
+ const OUString aDirectionPropName(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection") );
+ const OUString aLightOnPropName(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn") );
+
+ OUString aPropName;
+ OUString aIndexStr;
+ sal_Int32 aColTemp = 0;
+ Color aLightColor;
+ ::basegfx::B3DVector aLightDirection;
+ drawing::Direction3D xLightDir;
+ sal_Bool bLightOnOff = false;
+ for(sal_Int32 nLamp = 1; nLamp <= 8; nLamp++)
+ {
+ aIndexStr = OUString::valueOf( nLamp );
+
+ // lightcolor
+ aPropName = aColorPropName;
+ aPropName += aIndexStr;
+ xPropSet->getPropertyValue( aPropName ) >>= aColTemp;
+ aLightColor.SetColor(aColTemp);
+ mrExport.GetMM100UnitConverter().convertColor(sStringBuffer, aLightColor);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_DIFFUSE_COLOR, aStr);
+
+ // lightdirection
+ aPropName = aDirectionPropName;
+ aPropName += aIndexStr;
+ xPropSet->getPropertyValue(aPropName) >>= xLightDir;
+ aLightDirection = ::basegfx::B3DVector(xLightDir.DirectionX, xLightDir.DirectionY, xLightDir.DirectionZ);
+ mrExport.GetMM100UnitConverter().convertB3DVector(sStringBuffer, aLightDirection);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_DIRECTION, aStr);
+
+ // lighton
+ aPropName = aLightOnPropName;
+ aPropName += aIndexStr;
+ xPropSet->getPropertyValue(aPropName) >>= bLightOnOff;
+ mrExport.GetMM100UnitConverter().convertBool(sStringBuffer, bLightOnOff);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_ENABLED, aStr);
+
+ // specular
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_SPECULAR,
+ nLamp == 1 ? XML_TRUE : XML_FALSE);
+
+ // write light entry
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DR3D, XML_LIGHT, sal_True, sal_True);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/shapeexport4.cxx b/xmloff/source/draw/shapeexport4.cxx
new file mode 100644
index 000000000000..13d6730a028a
--- /dev/null
+++ b/xmloff/source/draw/shapeexport4.cxx
@@ -0,0 +1,1243 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/graphic/XGraphicProvider.hpp>
+#include <com/sun/star/embed/ElementModes.hpp>
+#include <com/sun/star/embed/XTransactedObject.hpp>
+#include <com/sun/star/io/XSeekableInputStream.hpp>
+#include <com/sun/star/drawing/HomogenMatrix.hpp>
+#include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
+#include <com/sun/star/drawing/ProjectionMode.hpp>
+#include <com/sun/star/drawing/ShadeMode.hpp>
+#include <com/sun/star/drawing/Direction3D.hpp>
+#include <com/sun/star/drawing/Position3D.hpp>
+#include <com/sun/star/drawing/CameraGeometry.hpp>
+#include <com/sun/star/drawing/DoubleSequence.hpp>
+
+#include <com/sun/star/table/XColumnRowRange.hpp>
+
+#include <xmloff/shapeexport.hxx>
+#include "sdpropls.hxx"
+#include <tools/debug.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "xexptran.hxx"
+#include <xmloff/xmltoken.hxx>
+#include "EnhancedCustomShapeToken.hxx"
+#include <com/sun/star/container/XIdentifierContainer.hpp>
+#include <com/sun/star/drawing/ShadeMode.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeGluePointType.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeTextPathMode.hpp>
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <rtl/math.hxx>
+#include <tools/string.hxx>
+#include <basegfx/vector/b3dvector.hxx>
+
+#include "xmloff/xmlnmspe.hxx"
+#include "XMLBase64Export.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::io;
+using namespace ::xmloff::token;
+using namespace ::xmloff::EnhancedCustomShapeToken;
+
+using ::com::sun::star::embed::XStorage;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+
+//////////////////////////////////////////////////////////////////////////////
+
+void ExportParameter( rtl::OUStringBuffer& rStrBuffer, const com::sun::star::drawing::EnhancedCustomShapeParameter& rParameter )
+{
+ if ( rStrBuffer.getLength() )
+ rStrBuffer.append( (sal_Unicode)' ' );
+ if ( rParameter.Value.getValueTypeClass() == uno::TypeClass_DOUBLE )
+ {
+ double fNumber = 0.0;
+ rParameter.Value >>= fNumber;
+ ::rtl::math::doubleToUStringBuffer( rStrBuffer, fNumber, rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, '.', sal_True );
+ }
+ else
+ {
+ sal_Int32 nValue = 0;
+ rParameter.Value >>= nValue;
+
+ switch( rParameter.Type )
+ {
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::EQUATION :
+ {
+ rStrBuffer.append( (sal_Unicode)'?' );
+ rStrBuffer.append( (sal_Unicode)'f' );
+ rStrBuffer.append( rtl::OUString::valueOf( nValue ) );
+ }
+ break;
+
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::ADJUSTMENT :
+ {
+ rStrBuffer.append( (sal_Unicode)'$' );
+ rStrBuffer.append( rtl::OUString::valueOf( nValue ) );
+ }
+ break;
+
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::BOTTOM :
+ rStrBuffer.append( GetXMLToken( XML_BOTTOM ) ); break;
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::RIGHT :
+ rStrBuffer.append( GetXMLToken( XML_RIGHT ) ); break;
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::TOP :
+ rStrBuffer.append( GetXMLToken( XML_TOP ) ); break;
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::LEFT :
+ rStrBuffer.append( GetXMLToken( XML_LEFT ) ); break;
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::XSTRETCH :
+ rStrBuffer.append( GetXMLToken( XML_XSTRETCH ) ); break;
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::YSTRETCH :
+ rStrBuffer.append( GetXMLToken( XML_YSTRETCH ) ); break;
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::HASSTROKE :
+ rStrBuffer.append( GetXMLToken( XML_HASSTROKE ) ); break;
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::HASFILL :
+ rStrBuffer.append( GetXMLToken( XML_HASFILL ) ); break;
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::WIDTH :
+ rStrBuffer.append( GetXMLToken( XML_WIDTH ) ); break;
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::HEIGHT :
+ rStrBuffer.append( GetXMLToken( XML_HEIGHT ) ); break;
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::LOGWIDTH :
+ rStrBuffer.append( GetXMLToken( XML_LOGWIDTH ) ); break;
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::LOGHEIGHT :
+ rStrBuffer.append( GetXMLToken( XML_LOGHEIGHT ) ); break;
+ default :
+ rStrBuffer.append( rtl::OUString::valueOf( nValue ) );
+ }
+ }
+}
+
+void ImpExportEquations( SvXMLExport& rExport, const uno::Sequence< rtl::OUString >& rEquations )
+{
+ sal_Int32 i;
+ for ( i = 0; i < rEquations.getLength(); i++ )
+ {
+ rtl::OUString aStr( String( 'f' ) );
+ aStr += rtl::OUString::valueOf( i );
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aStr );
+
+ aStr = rEquations[ i ];
+ sal_Int32 nIndex = 0;
+ do
+ {
+ nIndex = aStr.indexOf( (sal_Unicode)'?', nIndex );
+ if ( nIndex != -1 )
+ {
+ rtl::OUString aNew( aStr.copy( 0, nIndex + 1 ) );
+ aNew += String( 'f' );
+ aNew += aStr.copy( nIndex + 1, ( aStr.getLength() - nIndex ) - 1 );
+ aStr = aNew;
+ nIndex++;
+ }
+ } while( nIndex != -1 );
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_FORMULA, aStr );
+ SvXMLElementExport aOBJ( rExport, XML_NAMESPACE_DRAW, XML_EQUATION, sal_True, sal_True );
+ }
+}
+
+void ImpExportHandles( SvXMLExport& rExport, const uno::Sequence< beans::PropertyValues >& rHandles )
+{
+ sal_uInt32 i, j, nElements = rHandles.getLength();
+ if ( nElements )
+ {
+ rtl::OUString aStr;
+ rtl::OUStringBuffer aStrBuffer;
+
+ for ( i = 0; i < nElements; i++ )
+ {
+ sal_Bool bPosition = sal_False;
+ const uno::Sequence< beans::PropertyValue >& rPropSeq = rHandles[ i ];
+ for ( j = 0; j < (sal_uInt32)rPropSeq.getLength(); j++ )
+ {
+ const beans::PropertyValue& rPropVal = rPropSeq[ j ];
+ switch( EASGet( rPropVal.Name ) )
+ {
+ case EAS_Position :
+ {
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair aPosition;
+ if ( rPropVal.Value >>= aPosition )
+ {
+ ExportParameter( aStrBuffer, aPosition.First );
+ ExportParameter( aStrBuffer, aPosition.Second );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_POSITION, aStr );
+ bPosition = sal_True;
+ }
+ }
+ break;
+ case EAS_MirroredX :
+ {
+ sal_Bool bMirroredX = sal_Bool();
+ if ( rPropVal.Value >>= bMirroredX )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_MIRROR_HORIZONTAL,
+ bMirroredX ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
+ }
+ break;
+ case EAS_MirroredY :
+ {
+ sal_Bool bMirroredY = sal_Bool();
+ if ( rPropVal.Value >>= bMirroredY )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_MIRROR_VERTICAL,
+ bMirroredY ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
+ }
+ break;
+ case EAS_Switched :
+ {
+ sal_Bool bSwitched = sal_Bool();
+ if ( rPropVal.Value >>= bSwitched )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_SWITCHED,
+ bSwitched ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
+ }
+ break;
+ case EAS_Polar :
+ {
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair aPolar;
+ if ( rPropVal.Value >>= aPolar )
+ {
+ ExportParameter( aStrBuffer, aPolar.First );
+ ExportParameter( aStrBuffer, aPolar.Second );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_POLAR, aStr );
+ }
+ }
+ break;
+ case EAS_RadiusRangeMinimum :
+ {
+ com::sun::star::drawing::EnhancedCustomShapeParameter aRadiusRangeMinimum;
+ if ( rPropVal.Value >>= aRadiusRangeMinimum )
+ {
+ ExportParameter( aStrBuffer, aRadiusRangeMinimum );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_RADIUS_RANGE_MINIMUM, aStr );
+ }
+ }
+ break;
+ case EAS_RadiusRangeMaximum :
+ {
+ com::sun::star::drawing::EnhancedCustomShapeParameter aRadiusRangeMaximum;
+ if ( rPropVal.Value >>= aRadiusRangeMaximum )
+ {
+ ExportParameter( aStrBuffer, aRadiusRangeMaximum );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_RADIUS_RANGE_MAXIMUM, aStr );
+ }
+ }
+ break;
+ case EAS_RangeXMinimum :
+ {
+ com::sun::star::drawing::EnhancedCustomShapeParameter aXRangeMinimum;
+ if ( rPropVal.Value >>= aXRangeMinimum )
+ {
+ ExportParameter( aStrBuffer, aXRangeMinimum );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_RANGE_X_MINIMUM, aStr );
+ }
+ }
+ break;
+ case EAS_RangeXMaximum :
+ {
+ com::sun::star::drawing::EnhancedCustomShapeParameter aXRangeMaximum;
+ if ( rPropVal.Value >>= aXRangeMaximum )
+ {
+ ExportParameter( aStrBuffer, aXRangeMaximum );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_RANGE_X_MAXIMUM, aStr );
+ }
+ }
+ break;
+ case EAS_RangeYMinimum :
+ {
+ com::sun::star::drawing::EnhancedCustomShapeParameter aYRangeMinimum;
+ if ( rPropVal.Value >>= aYRangeMinimum )
+ {
+ ExportParameter( aStrBuffer, aYRangeMinimum );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_RANGE_Y_MINIMUM, aStr );
+ }
+ }
+ break;
+ case EAS_RangeYMaximum :
+ {
+ com::sun::star::drawing::EnhancedCustomShapeParameter aYRangeMaximum;
+ if ( rPropVal.Value >>= aYRangeMaximum )
+ {
+ ExportParameter( aStrBuffer, aYRangeMaximum );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_RANGE_Y_MAXIMUM, aStr );
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ if ( bPosition )
+ SvXMLElementExport aOBJ( rExport, XML_NAMESPACE_DRAW, XML_HANDLE, sal_True, sal_True );
+ else
+ rExport.ClearAttrList();
+ }
+ }
+}
+
+void ImpExportEnhancedPath( SvXMLExport& rExport,
+ const uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair >& rCoordinates,
+ const uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment >& rSegments )
+{
+
+ rtl::OUString aStr;
+ rtl::OUStringBuffer aStrBuffer;
+
+ sal_Int32 i, j, k, l;
+
+ sal_Int32 nCoords = rCoordinates.getLength();
+ sal_Int32 nSegments = rSegments.getLength();
+ sal_Bool bSimpleSegments = nSegments == 0;
+ if ( bSimpleSegments )
+ nSegments = 4;
+ for ( j = i = 0; j < nSegments; j++ )
+ {
+ com::sun::star::drawing::EnhancedCustomShapeSegment aSegment;
+ if ( bSimpleSegments )
+ {
+ // if there are not enough segments we will default them
+ switch( j )
+ {
+ case 0 :
+ {
+ aSegment.Count = 1;
+ aSegment.Command = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::MOVETO;
+ }
+ break;
+ case 1 :
+ {
+ aSegment.Count = (sal_Int16)Min( nCoords - 1, (sal_Int32)32767 );
+ aSegment.Command = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::LINETO;
+ }
+ break;
+ case 2 :
+ {
+ aSegment.Count = 1;
+ aSegment.Command = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CLOSESUBPATH;
+ }
+ break;
+ case 3 :
+ {
+ aSegment.Count = 1;
+ aSegment.Command = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ENDSUBPATH;
+ }
+ break;
+ }
+ }
+ else
+ aSegment = rSegments[ j ];
+
+ if ( aStrBuffer.getLength() )
+ aStrBuffer.append( (sal_Unicode)' ' );
+
+ sal_Int32 nParameter = 0;
+ switch( aSegment.Command )
+ {
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CLOSESUBPATH :
+ aStrBuffer.append( (sal_Unicode)'Z' ); break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ENDSUBPATH :
+ aStrBuffer.append( (sal_Unicode)'N' ); break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::NOFILL :
+ aStrBuffer.append( (sal_Unicode)'F' ); break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::NOSTROKE :
+ aStrBuffer.append( (sal_Unicode)'S' ); break;
+
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::MOVETO :
+ aStrBuffer.append( (sal_Unicode)'M' ); nParameter = 1; break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::LINETO :
+ aStrBuffer.append( (sal_Unicode)'L' ); nParameter = 1; break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CURVETO :
+ aStrBuffer.append( (sal_Unicode)'C' ); nParameter = 3; break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ANGLEELLIPSETO :
+ aStrBuffer.append( (sal_Unicode)'T' ); nParameter = 3; break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ANGLEELLIPSE :
+ aStrBuffer.append( (sal_Unicode)'U' ); nParameter = 3; break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ARCTO :
+ aStrBuffer.append( (sal_Unicode)'A' ); nParameter = 4; break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ARC :
+ aStrBuffer.append( (sal_Unicode)'B' ); nParameter = 4; break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CLOCKWISEARCTO :
+ aStrBuffer.append( (sal_Unicode)'W' ); nParameter = 4; break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CLOCKWISEARC :
+ aStrBuffer.append( (sal_Unicode)'V' ); nParameter = 4; break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTX :
+ aStrBuffer.append( (sal_Unicode)'X' ); nParameter = 1; break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTY :
+ aStrBuffer.append( (sal_Unicode)'Y' ); nParameter = 1; break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::QUADRATICCURVETO :
+ aStrBuffer.append( (sal_Unicode)'Q' ); nParameter = 2; break;
+
+ default : // ups, seems to be something wrong
+ {
+ aSegment.Count = 1;
+ aSegment.Command = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::LINETO;
+ }
+ break;
+ }
+ if ( nParameter )
+ {
+ for ( k = 0; k < aSegment.Count; k++ )
+ {
+ if ( ( i + nParameter ) <= nCoords )
+ {
+ for ( l = 0; l < nParameter; l++ )
+ {
+ ExportParameter( aStrBuffer, rCoordinates[ i ].First );
+ ExportParameter( aStrBuffer, rCoordinates[ i++ ].Second );
+ }
+ }
+ else
+ {
+ j = nSegments; // error -> exiting
+ break;
+ }
+ }
+ }
+ }
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_ENHANCED_PATH, aStr );
+}
+
+void ImpExportEnhancedGeometry( SvXMLExport& rExport, const uno::Reference< beans::XPropertySet >& xPropSet )
+{
+ sal_Bool bEquations = sal_False;
+ uno::Sequence< rtl::OUString > aEquations;
+
+ sal_Bool bHandles = sal_False;
+ uno::Sequence< beans::PropertyValues > aHandles;
+
+ sal_Bool bCoordinates = sal_False;
+ uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment > aSegments;
+ uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair > aCoordinates;
+
+ uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue > aAdjustmentValues;
+
+ rtl::OUString aStr;
+ rtl::OUStringBuffer aStrBuffer;
+ SvXMLUnitConverter& rUnitConverter = rExport.GetMM100UnitConverter();
+
+ uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
+
+ // geometry
+ const rtl::OUString sCustomShapeGeometry( RTL_CONSTASCII_USTRINGPARAM( "CustomShapeGeometry" ) );
+ if ( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName( sCustomShapeGeometry ) )
+ {
+ uno::Any aGeoPropSet( xPropSet->getPropertyValue( sCustomShapeGeometry ) );
+ uno::Sequence< beans::PropertyValue > aGeoPropSeq;
+
+ if ( aGeoPropSet >>= aGeoPropSeq )
+ {
+ const rtl::OUString sCustomShapeType( RTL_CONSTASCII_USTRINGPARAM( "NonPrimitive" ) );
+ rtl::OUString aCustomShapeType( sCustomShapeType );
+
+ sal_Int32 j, nGeoPropCount = aGeoPropSeq.getLength();
+ for ( j = 0; j < nGeoPropCount; j++ )
+ {
+ const beans::PropertyValue& rGeoProp = aGeoPropSeq[ j ];
+ switch( EASGet( rGeoProp.Name ) )
+ {
+ case EAS_Type :
+ {
+ rGeoProp.Value >>= aCustomShapeType;
+ }
+ break;
+ case EAS_MirroredX :
+ {
+ sal_Bool bMirroredX = sal_Bool();
+ if ( rGeoProp.Value >>= bMirroredX )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MIRROR_HORIZONTAL,
+ bMirroredX ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
+ }
+ break;
+ case EAS_MirroredY :
+ {
+ sal_Bool bMirroredY = sal_Bool();
+ if ( rGeoProp.Value >>= bMirroredY )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MIRROR_VERTICAL,
+ bMirroredY ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
+ }
+ break;
+ case EAS_ViewBox :
+ {
+ awt::Rectangle aRect;
+ if ( rGeoProp.Value >>= aRect )
+ {
+ SdXMLImExViewBox aViewBox( aRect.X, aRect.Y, aRect.Width, aRect.Height );
+ rExport.AddAttribute( XML_NAMESPACE_SVG, XML_VIEWBOX, aViewBox.GetExportString() );
+ }
+ }
+ break;
+ case EAS_TextRotateAngle :
+ {
+ double fTextRotateAngle = 0;
+ if ( rGeoProp.Value >>= fTextRotateAngle )
+ {
+ rUnitConverter.convertDouble( aStrBuffer, fTextRotateAngle );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_TEXT_ROTATE_ANGLE, aStr );
+ }
+ }
+ break;
+ case EAS_Extrusion :
+ {
+ uno::Sequence< beans::PropertyValue > aExtrusionPropSeq;
+ if ( rGeoProp.Value >>= aExtrusionPropSeq )
+ {
+ sal_Int32 i, nCount = aExtrusionPropSeq.getLength();
+ for ( i = 0; i < nCount; i++ )
+ {
+ const beans::PropertyValue& rProp = aExtrusionPropSeq[ i ];
+ switch( EASGet( rProp.Name ) )
+ {
+ case EAS_Extrusion :
+ {
+ sal_Bool bExtrusionOn = sal_Bool();
+ if ( rProp.Value >>= bExtrusionOn )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION,
+ bExtrusionOn ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
+ }
+ break;
+ case EAS_Brightness :
+ {
+ double fExtrusionBrightness = 0;
+ if ( rProp.Value >>= fExtrusionBrightness )
+ {
+ rUnitConverter.convertDouble( aStrBuffer, fExtrusionBrightness, sal_False, MAP_RELATIVE, MAP_RELATIVE );
+ aStrBuffer.append( (sal_Unicode)'%' );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_BRIGHTNESS, aStr );
+ }
+ }
+ break;
+ case EAS_Depth :
+ {
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair aDepthParaPair;
+ if ( rProp.Value >>= aDepthParaPair )
+ {
+ double fDepth = 0;
+ if ( aDepthParaPair.First.Value >>= fDepth )
+ {
+ rExport.GetMM100UnitConverter().convertDouble( aStrBuffer, fDepth, sal_True );
+ ExportParameter( aStrBuffer, aDepthParaPair.Second );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_DEPTH, aStr );
+ }
+ }
+ }
+ break;
+ case EAS_Diffusion :
+ {
+ double fExtrusionDiffusion = 0;
+ if ( rProp.Value >>= fExtrusionDiffusion )
+ {
+ rUnitConverter.convertDouble( aStrBuffer, fExtrusionDiffusion, sal_False, MAP_RELATIVE, MAP_RELATIVE );
+ aStrBuffer.append( (sal_Unicode)'%' );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_DIFFUSION, aStr );
+ }
+ }
+ break;
+ case EAS_NumberOfLineSegments :
+ {
+ sal_Int32 nExtrusionNumberOfLineSegments = 0;
+ if ( rProp.Value >>= nExtrusionNumberOfLineSegments )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_NUMBER_OF_LINE_SEGMENTS, rtl::OUString::valueOf( nExtrusionNumberOfLineSegments ) );
+ }
+ break;
+ case EAS_LightFace :
+ {
+ sal_Bool bExtrusionLightFace = sal_Bool();
+ if ( rProp.Value >>= bExtrusionLightFace )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_LIGHT_FACE,
+ bExtrusionLightFace ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
+ }
+ break;
+ case EAS_FirstLightHarsh :
+ {
+ sal_Bool bExtrusionFirstLightHarsh = sal_Bool();
+ if ( rProp.Value >>= bExtrusionFirstLightHarsh )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_FIRST_LIGHT_HARSH,
+ bExtrusionFirstLightHarsh ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
+ }
+ break;
+ case EAS_SecondLightHarsh :
+ {
+ sal_Bool bExtrusionSecondLightHarsh = sal_Bool();
+ if ( rProp.Value >>= bExtrusionSecondLightHarsh )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_SECOND_LIGHT_HARSH,
+ bExtrusionSecondLightHarsh ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
+ }
+ break;
+ case EAS_FirstLightLevel :
+ {
+ double fExtrusionFirstLightLevel = 0;
+ if ( rProp.Value >>= fExtrusionFirstLightLevel )
+ {
+ rUnitConverter.convertDouble( aStrBuffer, fExtrusionFirstLightLevel, sal_False, MAP_RELATIVE, MAP_RELATIVE );
+ aStrBuffer.append( (sal_Unicode)'%' );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_FIRST_LIGHT_LEVEL, aStr );
+ }
+ }
+ break;
+ case EAS_SecondLightLevel :
+ {
+ double fExtrusionSecondLightLevel = 0;
+ if ( rProp.Value >>= fExtrusionSecondLightLevel )
+ {
+ rUnitConverter.convertDouble( aStrBuffer, fExtrusionSecondLightLevel, sal_False, MAP_RELATIVE, MAP_RELATIVE );
+ aStrBuffer.append( (sal_Unicode)'%' );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_SECOND_LIGHT_LEVEL, aStr );
+ }
+ }
+ break;
+ case EAS_FirstLightDirection :
+ {
+ drawing::Direction3D aExtrusionFirstLightDirection;
+ if ( rProp.Value >>= aExtrusionFirstLightDirection )
+ {
+ ::basegfx::B3DVector aVec3D( aExtrusionFirstLightDirection.DirectionX, aExtrusionFirstLightDirection.DirectionY,
+ aExtrusionFirstLightDirection.DirectionZ );
+ rUnitConverter.convertB3DVector( aStrBuffer, aVec3D );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_FIRST_LIGHT_DIRECTION, aStr );
+ }
+ }
+ break;
+ case EAS_SecondLightDirection :
+ {
+ drawing::Direction3D aExtrusionSecondLightDirection;
+ if ( rProp.Value >>= aExtrusionSecondLightDirection )
+ {
+ ::basegfx::B3DVector aVec3D( aExtrusionSecondLightDirection.DirectionX, aExtrusionSecondLightDirection.DirectionY,
+ aExtrusionSecondLightDirection.DirectionZ );
+ rUnitConverter.convertB3DVector( aStrBuffer, aVec3D );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_SECOND_LIGHT_DIRECTION, aStr );
+ }
+ }
+ break;
+ case EAS_Metal :
+ {
+ sal_Bool bExtrusionMetal = sal_Bool();
+ if ( rProp.Value >>= bExtrusionMetal )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_METAL,
+ bExtrusionMetal ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
+ }
+ break;
+ case EAS_ShadeMode :
+ {
+ // shadeMode
+ drawing::ShadeMode eShadeMode;
+ if( rProp.Value >>= eShadeMode )
+ {
+ if( eShadeMode == drawing::ShadeMode_FLAT )
+ aStr = GetXMLToken( XML_FLAT );
+ else if( eShadeMode == drawing::ShadeMode_PHONG )
+ aStr = GetXMLToken( XML_PHONG );
+ else if( eShadeMode == drawing::ShadeMode_SMOOTH )
+ aStr = GetXMLToken( XML_GOURAUD );
+ else
+ aStr = GetXMLToken( XML_DRAFT );
+ }
+ else
+ {
+ // ShadeMode enum not there, write default
+ aStr = GetXMLToken( XML_FLAT);
+ }
+ rExport.AddAttribute( XML_NAMESPACE_DR3D, XML_SHADE_MODE, aStr );
+ }
+ break;
+ case EAS_RotateAngle :
+ {
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair aRotateAngleParaPair;
+ if ( rProp.Value >>= aRotateAngleParaPair )
+ {
+ ExportParameter( aStrBuffer, aRotateAngleParaPair.First );
+ ExportParameter( aStrBuffer, aRotateAngleParaPair.Second );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_ROTATION_ANGLE, aStr );
+ }
+ }
+ break;
+ case EAS_RotationCenter :
+ {
+ drawing::Direction3D aExtrusionRotationCenter;
+ if ( rProp.Value >>= aExtrusionRotationCenter )
+ {
+ ::basegfx::B3DVector aVec3D( aExtrusionRotationCenter.DirectionX, aExtrusionRotationCenter.DirectionY,
+ aExtrusionRotationCenter.DirectionZ );
+ rUnitConverter.convertB3DVector( aStrBuffer, aVec3D );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_ROTATION_CENTER, aStr );
+ }
+ }
+ break;
+ case EAS_Shininess :
+ {
+ double fExtrusionShininess = 0;
+ if ( rProp.Value >>= fExtrusionShininess )
+ {
+ rUnitConverter.convertDouble( aStrBuffer, fExtrusionShininess, sal_False, MAP_RELATIVE, MAP_RELATIVE );
+ aStrBuffer.append( (sal_Unicode)'%' );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_SHININESS, aStr );
+ }
+ }
+ break;
+ case EAS_Skew :
+ {
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair aSkewParaPair;
+ if ( rProp.Value >>= aSkewParaPair )
+ {
+ ExportParameter( aStrBuffer, aSkewParaPair.First );
+ ExportParameter( aStrBuffer, aSkewParaPair.Second );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_SKEW, aStr );
+ }
+ }
+ break;
+ case EAS_Specularity :
+ {
+ double fExtrusionSpecularity = 0;
+ if ( rProp.Value >>= fExtrusionSpecularity )
+ {
+ rUnitConverter.convertDouble( aStrBuffer, fExtrusionSpecularity, sal_False, MAP_RELATIVE, MAP_RELATIVE );
+ aStrBuffer.append( (sal_Unicode)'%' );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_SPECULARITY, aStr );
+ }
+ }
+ break;
+ case EAS_ProjectionMode :
+ {
+ drawing::ProjectionMode eProjectionMode;
+ if ( rProp.Value >>= eProjectionMode )
+ rExport.AddAttribute( XML_NAMESPACE_DR3D, XML_PROJECTION,
+ eProjectionMode == drawing::ProjectionMode_PARALLEL ? GetXMLToken( XML_PARALLEL ) : GetXMLToken( XML_PERSPECTIVE ) );
+ }
+ break;
+ case EAS_ViewPoint :
+ {
+ drawing::Position3D aExtrusionViewPoint;
+ if ( rProp.Value >>= aExtrusionViewPoint )
+ {
+ rUnitConverter.convertPosition3D( aStrBuffer, aExtrusionViewPoint );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_VIEWPOINT, aStr );
+ }
+ }
+ break;
+ case EAS_Origin :
+ {
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair aOriginParaPair;
+ if ( rProp.Value >>= aOriginParaPair )
+ {
+ ExportParameter( aStrBuffer, aOriginParaPair.First );
+ ExportParameter( aStrBuffer, aOriginParaPair.Second );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_ORIGIN, aStr );
+ }
+ }
+ break;
+ case EAS_Color :
+ {
+ sal_Bool bExtrusionColor = sal_Bool();
+ if ( rProp.Value >>= bExtrusionColor )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_COLOR,
+ bExtrusionColor ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ }
+ break;
+ case EAS_TextPath :
+ {
+ uno::Sequence< beans::PropertyValue > aTextPathPropSeq;
+ if ( rGeoProp.Value >>= aTextPathPropSeq )
+ {
+ sal_Int32 i, nCount = aTextPathPropSeq.getLength();
+ for ( i = 0; i < nCount; i++ )
+ {
+ const beans::PropertyValue& rProp = aTextPathPropSeq[ i ];
+ switch( EASGet( rProp.Name ) )
+ {
+ case EAS_TextPath :
+ {
+ sal_Bool bTextPathOn = sal_Bool();
+ if ( rProp.Value >>= bTextPathOn )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_TEXT_PATH,
+ bTextPathOn ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
+ }
+ break;
+ case EAS_TextPathMode :
+ {
+ com::sun::star::drawing::EnhancedCustomShapeTextPathMode eTextPathMode;
+ if ( rProp.Value >>= eTextPathMode )
+ {
+ switch ( eTextPathMode )
+ {
+ case com::sun::star::drawing::EnhancedCustomShapeTextPathMode_NORMAL: aStr = GetXMLToken( XML_NORMAL ); break;
+ case com::sun::star::drawing::EnhancedCustomShapeTextPathMode_PATH : aStr = GetXMLToken( XML_PATH ); break;
+ case com::sun::star::drawing::EnhancedCustomShapeTextPathMode_SHAPE : aStr = GetXMLToken( XML_SHAPE ); break;
+ default:
+ break;
+ }
+ if ( aStr.getLength() )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_TEXT_PATH_MODE, aStr );
+ }
+ }
+ break;
+ case EAS_ScaleX :
+ {
+ sal_Bool bScaleX = sal_Bool();
+ if ( rProp.Value >>= bScaleX )
+ {
+ aStr = bScaleX ? GetXMLToken( XML_SHAPE ) : GetXMLToken( XML_PATH );
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_TEXT_PATH_SCALE, aStr );
+ }
+ }
+ break;
+ case EAS_SameLetterHeights :
+ {
+ sal_Bool bSameLetterHeights = sal_Bool();
+ if ( rProp.Value >>= bSameLetterHeights )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_TEXT_PATH_SAME_LETTER_HEIGHTS,
+ bSameLetterHeights ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ }
+ break;
+ case EAS_Path :
+ {
+ uno::Sequence< beans::PropertyValue > aPathPropSeq;
+ if ( rGeoProp.Value >>= aPathPropSeq )
+ {
+ sal_Int32 i, nCount = aPathPropSeq.getLength();
+ for ( i = 0; i < nCount; i++ )
+ {
+ const beans::PropertyValue& rProp = aPathPropSeq[ i ];
+ switch( EASGet( rProp.Name ) )
+ {
+ case EAS_ExtrusionAllowed :
+ {
+ sal_Bool bExtrusionAllowed = sal_Bool();
+ if ( rProp.Value >>= bExtrusionAllowed )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_ALLOWED,
+ bExtrusionAllowed ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
+ }
+ break;
+ case EAS_ConcentricGradientFillAllowed :
+ {
+ sal_Bool bConcentricGradientFillAllowed = sal_Bool();
+ if ( rProp.Value >>= bConcentricGradientFillAllowed )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CONCENTRIC_GRADIENT_FILL_ALLOWED,
+ bConcentricGradientFillAllowed ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
+ }
+ break;
+ case EAS_TextPathAllowed :
+ {
+ sal_Bool bTextPathAllowed = sal_Bool();
+ if ( rProp.Value >>= bTextPathAllowed )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_TEXT_PATH_ALLOWED,
+ bTextPathAllowed ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
+ }
+ break;
+ case EAS_GluePoints :
+ {
+ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair> aGluePoints;
+ if ( rProp.Value >>= aGluePoints )
+ {
+ sal_Int32 k, nElements = aGluePoints.getLength();
+ if ( nElements )
+ {
+ for( k = 0; k < nElements; k++ )
+ {
+ ExportParameter( aStrBuffer, aGluePoints[ k ].First );
+ ExportParameter( aStrBuffer, aGluePoints[ k ].Second );
+ }
+ aStr = aStrBuffer.makeStringAndClear();
+ }
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_GLUE_POINTS, aStr );
+ }
+ }
+ break;
+ case EAS_GluePointType :
+ {
+ sal_Int16 nGluePointType = sal_Int16();
+ if ( rProp.Value >>= nGluePointType )
+ {
+ switch ( nGluePointType )
+ {
+ case com::sun::star::drawing::EnhancedCustomShapeGluePointType::NONE : aStr = GetXMLToken( XML_NONE ); break;
+ case com::sun::star::drawing::EnhancedCustomShapeGluePointType::SEGMENTS : aStr = GetXMLToken( XML_SEGMENTS ); break;
+ case com::sun::star::drawing::EnhancedCustomShapeGluePointType::RECT : aStr = GetXMLToken( XML_RECTANGLE ); break;
+ }
+ if ( aStr.getLength() )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_GLUE_POINT_TYPE, aStr );
+ }
+ }
+ break;
+ case EAS_Coordinates :
+ {
+ bCoordinates = ( rProp.Value >>= aCoordinates );
+ }
+ break;
+ case EAS_Segments :
+ {
+ rProp.Value >>= aSegments;
+ }
+ break;
+ case EAS_StretchX :
+ {
+ sal_Int32 nStretchPoint = 0;
+ if ( rProp.Value >>= nStretchPoint )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_PATH_STRETCHPOINT_X, rtl::OUString::valueOf( nStretchPoint ) );
+ }
+ break;
+ case EAS_StretchY :
+ {
+ sal_Int32 nStretchPoint = 0;
+ if ( rProp.Value >>= nStretchPoint )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_PATH_STRETCHPOINT_Y, rtl::OUString::valueOf( nStretchPoint ) );
+ }
+ break;
+ case EAS_TextFrames :
+ {
+ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeTextFrame > aPathTextFrames;
+ if ( rProp.Value >>= aPathTextFrames )
+ {
+ if ( (sal_uInt16)aPathTextFrames.getLength() )
+ {
+ sal_uInt16 k, nElements = (sal_uInt16)aPathTextFrames.getLength();
+ for ( k = 0; k < nElements; k++ )
+ {
+ ExportParameter( aStrBuffer, aPathTextFrames[ k ].TopLeft.First );
+ ExportParameter( aStrBuffer, aPathTextFrames[ k ].TopLeft.Second );
+ ExportParameter( aStrBuffer, aPathTextFrames[ k ].BottomRight.First );
+ ExportParameter( aStrBuffer, aPathTextFrames[ k ].BottomRight.Second );
+ }
+ aStr = aStrBuffer.makeStringAndClear();
+ }
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_TEXT_AREAS, aStr );
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ }
+ break;
+ case EAS_Equations :
+ {
+ bEquations = ( rGeoProp.Value >>= aEquations );
+ }
+ break;
+ case EAS_Handles :
+ {
+ bHandles = ( rGeoProp.Value >>= aHandles );
+ }
+ break;
+ case EAS_AdjustmentValues :
+ {
+ rGeoProp.Value >>= aAdjustmentValues;
+ }
+ break;
+ default:
+ break;
+ }
+ } // for
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_TYPE, aCustomShapeType );
+
+ // adjustments
+ sal_Int32 nAdjustmentValues = aAdjustmentValues.getLength();
+ if ( nAdjustmentValues )
+ {
+ sal_Int32 i, nValue = 0;
+ for ( i = 0; i < nAdjustmentValues; i++ )
+ {
+ if ( i )
+ aStrBuffer.append( (sal_Unicode)' ' );
+
+ const com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue& rAdj = aAdjustmentValues[ i ];
+ if ( rAdj.State == beans::PropertyState_DIRECT_VALUE )
+ {
+ if ( rAdj.Value.getValueTypeClass() == uno::TypeClass_DOUBLE )
+ {
+ double fValue = 0.0;
+ rAdj.Value >>= fValue;
+ rUnitConverter.convertDouble( aStrBuffer, fValue );
+ }
+ else
+ {
+ rAdj.Value >>= nValue;
+ rUnitConverter.convertNumber( aStrBuffer, nValue );
+ }
+ }
+ else
+ rUnitConverter.convertNumber( aStrBuffer, 0 ); // this should not be, but better than setting nothing
+ }
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MODIFIERS, aStr );
+ }
+ if ( bCoordinates )
+ ImpExportEnhancedPath( rExport, aCoordinates, aSegments );
+ }
+ }
+ SvXMLElementExport aOBJ( rExport, XML_NAMESPACE_DRAW, XML_ENHANCED_GEOMETRY, sal_True, sal_True );
+ if ( bEquations )
+ ImpExportEquations( rExport, aEquations );
+ if ( bHandles )
+ ImpExportHandles( rExport, aHandles );
+}
+
+void XMLShapeExport::ImpExportCustomShape(
+ const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint )
+{
+ const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
+ if ( xPropSet.is() )
+ {
+ rtl::OUString aStr;
+ uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
+
+ // Transformation
+ ImpExportNewTrans( xPropSet, nFeatures, pRefPoint );
+
+ if ( xPropSetInfo.is() )
+ {
+ const rtl::OUString sCustomShapeEngine( RTL_CONSTASCII_USTRINGPARAM( "CustomShapeEngine" ) );
+ if ( xPropSetInfo->hasPropertyByName( sCustomShapeEngine ) )
+ {
+ uno::Any aEngine( xPropSet->getPropertyValue( sCustomShapeEngine ) );
+ if ( ( aEngine >>= aStr ) && aStr.getLength() )
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_ENGINE, aStr );
+ }
+ const rtl::OUString sCustomShapeData( RTL_CONSTASCII_USTRINGPARAM( "CustomShapeData" ) );
+ if ( xPropSetInfo->hasPropertyByName( sCustomShapeData ) )
+ {
+ uno::Any aData( xPropSet->getPropertyValue( sCustomShapeData ) );
+ if ( ( aData >>= aStr ) && aStr.getLength() )
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DATA, aStr );
+ }
+ }
+ sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
+ SvXMLElementExport aOBJ( mrExport, XML_NAMESPACE_DRAW, XML_CUSTOM_SHAPE, bCreateNewline, sal_True );
+ ImpExportDescription( xShape ); // #i68101#
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+ ImpExportText( xShape );
+ ImpExportEnhancedGeometry( mrExport, xPropSet );
+ }
+}
+
+void XMLShapeExport::ImpExportTableShape( const uno::Reference< drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint )
+{
+ uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
+ uno::Reference< container::XNamed > xNamed(xShape, uno::UNO_QUERY);
+
+ DBG_ASSERT( xPropSet.is() && xNamed.is(), "xmloff::XMLShapeExport::ImpExportTableShape(), tabe shape is not implementing needed interfaces");
+ if(xPropSet.is() && xNamed.is()) try
+ {
+ // Transformation
+ ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
+
+ sal_Bool bIsEmptyPresObj = sal_False;
+
+ // presentation settings
+ if(eShapeType == XmlShapeTypePresTableShape)
+ bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_TABLE) );
+
+ const bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 );
+ const bool bExportEmbedded(0 != (mrExport.getExportFlags() & EXPORT_EMBEDDED));
+
+ SvXMLElementExport aElement( mrExport, XML_NAMESPACE_DRAW, XML_FRAME, bCreateNewline, sal_True );
+
+ // do not export in ODF 1.1 or older
+ if( mrExport.getDefaultVersion() >= SvtSaveOptions::ODFVER_012 )
+ {
+ if( !bIsEmptyPresObj )
+ {
+ uno::Reference< container::XNamed > xTemplate( xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TableTemplate" ) ) ), uno::UNO_QUERY );
+ if( xTemplate.is() )
+ {
+ const OUString sTemplate( xTemplate->getName() );
+ if( sTemplate.getLength() )
+ {
+ mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_TEMPLATE_NAME, sTemplate );
+
+ for( const XMLPropertyMapEntry* pEntry = &aXMLTableShapeAttributes[0]; pEntry->msApiName; pEntry++ )
+ {
+ try
+ {
+ sal_Bool bBool = sal_False;
+ const OUString sAPIPropertyName( OUString(pEntry->msApiName, pEntry->nApiNameLength, RTL_TEXTENCODING_ASCII_US ) );
+
+ xPropSet->getPropertyValue( sAPIPropertyName ) >>= bBool;
+ if( bBool )
+ mrExport.AddAttribute(pEntry->mnNameSpace, pEntry->meXMLName, XML_TRUE );
+ }
+ catch( uno::Exception& )
+ {
+ OSL_FAIL("XMLShapeExport::ImpExportTableShape(), exception caught!");
+ }
+ }
+ }
+ }
+
+
+ uno::Reference< table::XColumnRowRange > xRange( xPropSet->getPropertyValue( msModel ), uno::UNO_QUERY_THROW );
+ GetShapeTableExport()->exportTable( xRange );
+ }
+ }
+
+ if( !bIsEmptyPresObj )
+ {
+ uno::Reference< graphic::XGraphic > xGraphic( xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "ReplacementGraphic" ) ) ), uno::UNO_QUERY );
+ if( xGraphic.is() ) try
+ {
+ Reference< lang::XMultiServiceFactory > xSM( GetExport().getServiceFactory(), UNO_QUERY_THROW );
+
+ uno::Reference< embed::XStorage > xPictureStorage;
+ uno::Reference< embed::XStorage > xStorage;
+ uno::Reference< io::XStream > xPictureStream;
+
+ OUString sPictureName;
+ if( bExportEmbedded )
+ {
+ xPictureStream.set( xSM->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.MemoryStream" ) ) ), UNO_QUERY_THROW );
+ }
+ else
+ {
+ xStorage.set( GetExport().GetTargetStorage(), UNO_QUERY_THROW );
+
+ xPictureStorage.set( xStorage->openStorageElement( OUString( RTL_CONSTASCII_USTRINGPARAM( "Pictures" ) ), ::embed::ElementModes::READWRITE ), uno::UNO_QUERY_THROW );
+ const OUString sPrefix( RTL_CONSTASCII_USTRINGPARAM("TablePreview") );
+ const OUString sSuffix( RTL_CONSTASCII_USTRINGPARAM(".svm") );
+
+ sal_Int32 nIndex = 0;
+ do
+ {
+ sPictureName = sPrefix;
+ sPictureName += OUString::valueOf( ++nIndex );
+ sPictureName += sSuffix;
+ }
+ while( xPictureStorage->hasByName( sPictureName ) );
+
+ xPictureStream.set( xPictureStorage->openStreamElement( sPictureName, ::embed::ElementModes::READWRITE ), UNO_QUERY_THROW );
+ }
+
+ Reference< graphic::XGraphicProvider > xProvider( xSM->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.graphic.GraphicProvider" ) ) ), UNO_QUERY_THROW );
+ Sequence< beans::PropertyValue > aArgs( 2 );
+ aArgs[ 0 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "MimeType" ) );
+ aArgs[ 0 ].Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "image/x-vclgraphic" ) );
+ aArgs[ 1 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "OutputStream" ) );
+ aArgs[ 1 ].Value <<= xPictureStream->getOutputStream();
+ xProvider->storeGraphic( xGraphic, aArgs );
+
+ if( xPictureStorage.is() )
+ {
+ Reference< embed::XTransactedObject > xTrans( xPictureStorage, UNO_QUERY );
+ if( xTrans.is() )
+ xTrans->commit();
+ }
+
+ if( !bExportEmbedded )
+ {
+ OUString sURL( RTL_CONSTASCII_USTRINGPARAM( "Pictures/" ) );
+ sURL += sPictureName;
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, sURL );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
+ }
+
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_DRAW, XML_IMAGE, sal_False, sal_True );
+
+ if( bExportEmbedded )
+ {
+ Reference< XSeekableInputStream > xSeekable( xPictureStream, UNO_QUERY_THROW );
+ xSeekable->seek(0);
+
+ XMLBase64Export aBase64Exp( GetExport() );
+ aBase64Exp.exportOfficeBinaryDataElement( Reference < XInputStream >( xPictureStream, UNO_QUERY_THROW ) );
+ }
+ }
+ catch( uno::Exception& )
+ {
+ OSL_FAIL("xmloff::XMLShapeExport::ImpExportTableShape(), exception caught!");
+ }
+ }
+
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+ ImpExportDescription( xShape ); // #i68101#
+ }
+ catch( uno::Exception& )
+ {
+ OSL_FAIL( "xmloff::XMLShapeExport::ImpExportTableShape(), exception caught!" );
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/shapeimport.cxx b/xmloff/source/draw/shapeimport.cxx
new file mode 100644
index 000000000000..7b581b662a45
--- /dev/null
+++ b/xmloff/source/draw/shapeimport.cxx
@@ -0,0 +1,1272 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <tools/debug.hxx>
+
+#include <com/sun/star/text/PositionLayoutDir.hpp>
+#include <com/sun/star/chart/XChartDocument.hpp>
+
+#include "unointerfacetouniqueidentifiermapper.hxx"
+
+#include <list>
+
+#include <xmloff/shapeimport.hxx>
+#include <xmloff/xmltkmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include "ximpstyl.hxx"
+#include "ximpshap.hxx"
+#include "sdpropls.hxx"
+#include <xmloff/xmlprmap.hxx>
+#include "ximp3dscene.hxx"
+#include "ximp3dobject.hxx"
+#include "ximpgrp.hxx"
+#include "ximplink.hxx"
+
+#include <map>
+#include <vector>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::std;
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+//////////////////////////////////////////////////////////////////////////////
+
+struct ltint32
+{
+ bool operator()(const sal_Int32 p, sal_Int32 q) const
+ {
+ return p < q;
+ }
+};
+
+typedef std::map<sal_Int32,com::sun::star::uno::Reference< com::sun::star::drawing::XShape >,ltint32> IdShapeMap;
+
+struct ConnectionHint
+{
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShape > mxConnector;
+ sal_Bool bStart;
+ OUString aDestShapeId;
+ sal_Int32 nDestGlueId;
+};
+
+struct XShapeCompareHelper
+{
+ bool operator()(com::sun::star::uno::Reference < com::sun::star::drawing::XShape > x1,
+ com::sun::star::uno::Reference < com::sun::star::drawing::XShape > x2 ) const
+ {
+ return x1.get() < x2.get();
+ }
+};
+
+/** this map store all glue point id mappings for shapes that had user defined glue points. This
+ is needed because on insertion the glue points will get a new and unique id */
+typedef std::map<sal_Int32,sal_Int32,ltint32> GluePointIdMap;
+typedef std::map< com::sun::star::uno::Reference < com::sun::star::drawing::XShape >, GluePointIdMap, XShapeCompareHelper > ShapeGluePointsMap;
+
+/** this struct is created for each startPage() call and stores information that is needed during
+ import of shapes for one page. Since pages could be nested ( notes pages inside impress ) there
+ is a pointer so one can build up a stack of this structs */
+struct XMLShapeImportPageContextImpl
+{
+ ShapeGluePointsMap maShapeGluePointsMap;
+
+ uno::Reference < drawing::XShapes > mxShapes;
+
+ struct XMLShapeImportPageContextImpl* mpNext;
+};
+
+/** this class is to enable adding members to the XMLShapeImportHelper without getting incompatible */
+struct XMLShapeImportHelperImpl
+{
+ // context for sorting shapes
+ ShapeSortContext* mpSortContext;
+
+ IdShapeMap maShapeIds;
+
+ std::vector<ConnectionHint> maConnections;
+
+ // #88546# possibility to swich progress bar handling on/off
+ sal_Bool mbHandleProgressBar;
+
+ // stores the capability of the current model to create presentation shapes
+ sal_Bool mbIsPresentationShapesSupported;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+XMLShapeImportHelper::XMLShapeImportHelper(
+ SvXMLImport& rImporter,
+ const uno::Reference< frame::XModel>& rModel,
+ SvXMLImportPropertyMapper *pExtMapper )
+: mpPageContext(NULL),
+ mxModel(rModel),
+
+ mpPropertySetMapper(0L),
+ mpPresPagePropsMapper(0L),
+ mpStylesContext(0L),
+ mpAutoStylesContext(0L),
+ mpGroupShapeElemTokenMap(0L),
+ mpFrameShapeElemTokenMap(0L),
+ mp3DSceneShapeElemTokenMap(0L),
+ mp3DObjectAttrTokenMap(0L),
+ mp3DPolygonBasedAttrTokenMap(0L),
+ mp3DCubeObjectAttrTokenMap(0L),
+ mp3DSphereObjectAttrTokenMap(0L),
+ mp3DSceneShapeAttrTokenMap(0L),
+ mp3DLightAttrTokenMap(0L),
+ mpPathShapeAttrTokenMap(0L),
+ mpPolygonShapeAttrTokenMap(0L),
+ msStartShape(RTL_CONSTASCII_USTRINGPARAM("StartShape")),
+ msEndShape(RTL_CONSTASCII_USTRINGPARAM("EndShape")),
+ msStartGluePointIndex(RTL_CONSTASCII_USTRINGPARAM("StartGluePointIndex")),
+ msEndGluePointIndex(RTL_CONSTASCII_USTRINGPARAM("EndGluePointIndex")),
+
+ mrImporter( rImporter )
+{
+ mpImpl = new XMLShapeImportHelperImpl();
+ mpImpl->mpSortContext = 0;
+
+ // #88546# init to sal_False
+ mpImpl->mbHandleProgressBar = sal_False;
+
+ mpSdPropHdlFactory = new XMLSdPropHdlFactory( rModel, rImporter );
+
+ // set lock to avoid deletion
+ mpSdPropHdlFactory->acquire();
+
+ // construct PropertySetMapper
+ UniReference < XMLPropertySetMapper > xMapper = new XMLShapePropertySetMapper(mpSdPropHdlFactory);
+ mpPropertySetMapper = new SvXMLImportPropertyMapper( xMapper, rImporter );
+ // set lock to avoid deletion
+ mpPropertySetMapper->acquire();
+
+ if( pExtMapper )
+ {
+ UniReference < SvXMLImportPropertyMapper > xExtMapper( pExtMapper );
+ mpPropertySetMapper->ChainImportMapper( xExtMapper );
+ }
+
+ // chain text attributes
+ mpPropertySetMapper->ChainImportMapper(XMLTextImportHelper::CreateParaExtPropMapper(rImporter));
+ mpPropertySetMapper->ChainImportMapper(XMLTextImportHelper::CreateParaDefaultExtPropMapper(rImporter));
+
+ // construct PresPagePropsMapper
+ xMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLSDPresPageProps, mpSdPropHdlFactory);
+ mpPresPagePropsMapper = new SvXMLImportPropertyMapper( xMapper, rImporter );
+ if(mpPresPagePropsMapper)
+ {
+ // set lock to avoid deletion
+ mpPresPagePropsMapper->acquire();
+ }
+
+ uno::Reference< lang::XServiceInfo > xInfo( rImporter.GetModel(), uno::UNO_QUERY );
+ const OUString aSName( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PresentationDocument") );
+ mpImpl->mbIsPresentationShapesSupported = xInfo.is() && xInfo->supportsService( aSName );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+XMLShapeImportHelper::~XMLShapeImportHelper()
+{
+ DBG_ASSERT( mpImpl->maConnections.empty(), "XMLShapeImportHelper::restoreConnections() was not called!" );
+
+ // cleanup factory, decrease refcount. Should lead to destruction.
+ if(mpSdPropHdlFactory)
+ {
+ mpSdPropHdlFactory->release();
+ mpSdPropHdlFactory = 0L;
+ }
+
+ // cleanup mapper, decrease refcount. Should lead to destruction.
+ if(mpPropertySetMapper)
+ {
+ mpPropertySetMapper->release();
+ mpPropertySetMapper = 0L;
+ }
+
+ // cleanup presPage mapper, decrease refcount. Should lead to destruction.
+ if(mpPresPagePropsMapper)
+ {
+ mpPresPagePropsMapper->release();
+ mpPresPagePropsMapper = 0L;
+ }
+
+ if(mpGroupShapeElemTokenMap) delete mpGroupShapeElemTokenMap;
+ if(mpFrameShapeElemTokenMap) delete mpFrameShapeElemTokenMap;
+
+ if(mpPolygonShapeAttrTokenMap) delete mpPolygonShapeAttrTokenMap;
+ if(mpPathShapeAttrTokenMap) delete mpPathShapeAttrTokenMap;
+ if(mp3DSceneShapeElemTokenMap) delete mp3DSceneShapeElemTokenMap;
+ if(mp3DObjectAttrTokenMap) delete mp3DObjectAttrTokenMap;
+ if(mp3DPolygonBasedAttrTokenMap) delete mp3DPolygonBasedAttrTokenMap;
+ if(mp3DCubeObjectAttrTokenMap) delete mp3DCubeObjectAttrTokenMap;
+ if(mp3DSphereObjectAttrTokenMap) delete mp3DSphereObjectAttrTokenMap;
+ if(mp3DSceneShapeAttrTokenMap) delete mp3DSceneShapeAttrTokenMap;
+ if(mp3DLightAttrTokenMap) delete mp3DLightAttrTokenMap;
+
+ // Styles or AutoStyles context?
+ if(mpStylesContext)
+ {
+ mpStylesContext->Clear();
+ mpStylesContext->ReleaseRef();
+ }
+
+ if(mpAutoStylesContext)
+ {
+ mpAutoStylesContext->Clear();
+ mpAutoStylesContext->ReleaseRef();
+ }
+
+ delete mpImpl;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+
+
+const SvXMLTokenMap& XMLShapeImportHelper::GetGroupShapeElemTokenMap()
+{
+ if(!mpGroupShapeElemTokenMap)
+ {
+ static SvXMLTokenMapEntry aGroupShapeElemTokenMap[] =
+{
+ { XML_NAMESPACE_DRAW, XML_G, XML_TOK_GROUP_GROUP },
+ { XML_NAMESPACE_DRAW, XML_RECT, XML_TOK_GROUP_RECT },
+ { XML_NAMESPACE_DRAW, XML_LINE, XML_TOK_GROUP_LINE },
+ { XML_NAMESPACE_DRAW, XML_CIRCLE, XML_TOK_GROUP_CIRCLE },
+ { XML_NAMESPACE_DRAW, XML_ELLIPSE, XML_TOK_GROUP_ELLIPSE },
+ { XML_NAMESPACE_DRAW, XML_POLYGON, XML_TOK_GROUP_POLYGON },
+ { XML_NAMESPACE_DRAW, XML_POLYLINE, XML_TOK_GROUP_POLYLINE },
+ { XML_NAMESPACE_DRAW, XML_PATH, XML_TOK_GROUP_PATH },
+
+ { XML_NAMESPACE_DRAW, XML_CONTROL, XML_TOK_GROUP_CONTROL },
+ { XML_NAMESPACE_DRAW, XML_CONNECTOR, XML_TOK_GROUP_CONNECTOR },
+ { XML_NAMESPACE_DRAW, XML_MEASURE, XML_TOK_GROUP_MEASURE },
+ { XML_NAMESPACE_DRAW, XML_PAGE_THUMBNAIL, XML_TOK_GROUP_PAGE },
+ { XML_NAMESPACE_DRAW, XML_CAPTION, XML_TOK_GROUP_CAPTION },
+
+ { XML_NAMESPACE_CHART, XML_CHART, XML_TOK_GROUP_CHART },
+ { XML_NAMESPACE_DR3D, XML_SCENE, XML_TOK_GROUP_3DSCENE },
+
+ { XML_NAMESPACE_DRAW, XML_FRAME, XML_TOK_GROUP_FRAME },
+ { XML_NAMESPACE_DRAW, XML_CUSTOM_SHAPE, XML_TOK_GROUP_CUSTOM_SHAPE },
+
+ { XML_NAMESPACE_DRAW, XML_CUSTOM_SHAPE, XML_TOK_GROUP_CUSTOM_SHAPE },
+ { XML_NAMESPACE_OFFICE, XML_ANNOTATION, XML_TOK_GROUP_ANNOTATION },
+ { XML_NAMESPACE_DRAW, XML_A, XML_TOK_GROUP_A },
+
+ XML_TOKEN_MAP_END
+};
+
+ mpGroupShapeElemTokenMap = new SvXMLTokenMap(aGroupShapeElemTokenMap);
+ } // if(!mpGroupShapeElemTokenMap)
+
+ return *mpGroupShapeElemTokenMap;
+}
+
+const SvXMLTokenMap& XMLShapeImportHelper::GetFrameShapeElemTokenMap()
+{
+ if(!mpFrameShapeElemTokenMap)
+ {
+ static SvXMLTokenMapEntry aFrameShapeElemTokenMap[] =
+{
+ { XML_NAMESPACE_DRAW, XML_TEXT_BOX, XML_TOK_FRAME_TEXT_BOX },
+ { XML_NAMESPACE_DRAW, XML_IMAGE, XML_TOK_FRAME_IMAGE },
+ { XML_NAMESPACE_DRAW, XML_OBJECT, XML_TOK_FRAME_OBJECT },
+ { XML_NAMESPACE_DRAW, XML_OBJECT_OLE, XML_TOK_FRAME_OBJECT_OLE },
+ { XML_NAMESPACE_DRAW, XML_PLUGIN, XML_TOK_FRAME_PLUGIN },
+ { XML_NAMESPACE_DRAW, XML_FLOATING_FRAME, XML_TOK_FRAME_FLOATING_FRAME},
+ { XML_NAMESPACE_DRAW, XML_APPLET, XML_TOK_FRAME_APPLET },
+ { XML_NAMESPACE_TABLE, XML_TABLE, XML_TOK_FRAME_TABLE },
+ XML_TOKEN_MAP_END
+};
+
+ mpFrameShapeElemTokenMap = new SvXMLTokenMap(aFrameShapeElemTokenMap);
+ } // if(!mpFrameShapeElemTokenMap)
+
+ return *mpFrameShapeElemTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+
+const SvXMLTokenMap& XMLShapeImportHelper::Get3DSceneShapeElemTokenMap()
+{
+ if(!mp3DSceneShapeElemTokenMap)
+ {
+ static SvXMLTokenMapEntry a3DSceneShapeElemTokenMap[] =
+{
+ { XML_NAMESPACE_DR3D, XML_SCENE, XML_TOK_3DSCENE_3DSCENE },
+ { XML_NAMESPACE_DR3D, XML_CUBE, XML_TOK_3DSCENE_3DCUBE },
+ { XML_NAMESPACE_DR3D, XML_SPHERE, XML_TOK_3DSCENE_3DSPHERE },
+ { XML_NAMESPACE_DR3D, XML_ROTATE, XML_TOK_3DSCENE_3DLATHE },
+ { XML_NAMESPACE_DR3D, XML_EXTRUDE, XML_TOK_3DSCENE_3DEXTRUDE },
+ XML_TOKEN_MAP_END
+};
+
+ mp3DSceneShapeElemTokenMap = new SvXMLTokenMap(a3DSceneShapeElemTokenMap);
+ } // if(!mp3DSceneShapeElemTokenMap)
+
+ return *mp3DSceneShapeElemTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+
+const SvXMLTokenMap& XMLShapeImportHelper::Get3DObjectAttrTokenMap()
+{
+ if(!mp3DObjectAttrTokenMap)
+ {
+ static SvXMLTokenMapEntry a3DObjectAttrTokenMap[] =
+{
+ { XML_NAMESPACE_DRAW, XML_STYLE_NAME, XML_TOK_3DOBJECT_DRAWSTYLE_NAME },
+ { XML_NAMESPACE_DR3D, XML_TRANSFORM, XML_TOK_3DOBJECT_TRANSFORM },
+ XML_TOKEN_MAP_END
+};
+
+ mp3DObjectAttrTokenMap = new SvXMLTokenMap(a3DObjectAttrTokenMap);
+ } // if(!mp3DObjectAttrTokenMap)
+
+ return *mp3DObjectAttrTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+
+const SvXMLTokenMap& XMLShapeImportHelper::Get3DPolygonBasedAttrTokenMap()
+{
+ if(!mp3DPolygonBasedAttrTokenMap)
+ {
+ static SvXMLTokenMapEntry a3DPolygonBasedAttrTokenMap[] =
+{
+ { XML_NAMESPACE_SVG, XML_VIEWBOX, XML_TOK_3DPOLYGONBASED_VIEWBOX },
+ { XML_NAMESPACE_SVG, XML_D, XML_TOK_3DPOLYGONBASED_D },
+ XML_TOKEN_MAP_END
+};
+
+ mp3DPolygonBasedAttrTokenMap = new SvXMLTokenMap(a3DPolygonBasedAttrTokenMap);
+ } // if(!mp3DPolygonBasedAttrTokenMap)
+
+ return *mp3DPolygonBasedAttrTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+
+const SvXMLTokenMap& XMLShapeImportHelper::Get3DCubeObjectAttrTokenMap()
+{
+ if(!mp3DCubeObjectAttrTokenMap)
+ {
+ static SvXMLTokenMapEntry a3DCubeObjectAttrTokenMap[] =
+{
+ { XML_NAMESPACE_DR3D, XML_MIN_EDGE, XML_TOK_3DCUBEOBJ_MINEDGE },
+ { XML_NAMESPACE_DR3D, XML_MAX_EDGE, XML_TOK_3DCUBEOBJ_MAXEDGE },
+ XML_TOKEN_MAP_END
+};
+
+ mp3DCubeObjectAttrTokenMap = new SvXMLTokenMap(a3DCubeObjectAttrTokenMap);
+ } // if(!mp3DCubeObjectAttrTokenMap)
+
+ return *mp3DCubeObjectAttrTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+
+const SvXMLTokenMap& XMLShapeImportHelper::Get3DSphereObjectAttrTokenMap()
+{
+ if(!mp3DSphereObjectAttrTokenMap)
+ {
+ static SvXMLTokenMapEntry a3DSphereObjectAttrTokenMap[] =
+{
+ { XML_NAMESPACE_DR3D, XML_CENTER, XML_TOK_3DSPHEREOBJ_CENTER },
+ { XML_NAMESPACE_DR3D, XML_SIZE, XML_TOK_3DSPHEREOBJ_SIZE },
+ XML_TOKEN_MAP_END
+};
+
+ mp3DSphereObjectAttrTokenMap = new SvXMLTokenMap(a3DSphereObjectAttrTokenMap);
+ } // if(!mp3DSphereObjectAttrTokenMap)
+
+ return *mp3DSphereObjectAttrTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+
+const SvXMLTokenMap& XMLShapeImportHelper::GetPolygonShapeAttrTokenMap()
+{
+ if(!mpPolygonShapeAttrTokenMap)
+ {
+ static SvXMLTokenMapEntry aPolygonShapeAttrTokenMap[] =
+{
+ { XML_NAMESPACE_SVG, XML_VIEWBOX, XML_TOK_POLYGONSHAPE_VIEWBOX },
+ { XML_NAMESPACE_DRAW, XML_POINTS, XML_TOK_POLYGONSHAPE_POINTS },
+ XML_TOKEN_MAP_END
+};
+
+ mpPolygonShapeAttrTokenMap = new SvXMLTokenMap(aPolygonShapeAttrTokenMap);
+ } // if(!mpPolygonShapeAttrTokenMap)
+
+ return *mpPolygonShapeAttrTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+
+const SvXMLTokenMap& XMLShapeImportHelper::GetPathShapeAttrTokenMap()
+{
+ if(!mpPathShapeAttrTokenMap)
+ {
+ static SvXMLTokenMapEntry aPathShapeAttrTokenMap[] =
+{
+ { XML_NAMESPACE_SVG, XML_VIEWBOX, XML_TOK_PATHSHAPE_VIEWBOX },
+ { XML_NAMESPACE_SVG, XML_D, XML_TOK_PATHSHAPE_D },
+ XML_TOKEN_MAP_END
+};
+
+ mpPathShapeAttrTokenMap = new SvXMLTokenMap(aPathShapeAttrTokenMap);
+ } // if(!mpPathShapeAttrTokenMap)
+
+ return *mpPathShapeAttrTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+
+const SvXMLTokenMap& XMLShapeImportHelper::Get3DSceneShapeAttrTokenMap()
+{
+ if(!mp3DSceneShapeAttrTokenMap)
+ {
+ static SvXMLTokenMapEntry a3DSceneShapeAttrTokenMap[] =
+{
+ { XML_NAMESPACE_DR3D, XML_TRANSFORM, XML_TOK_3DSCENESHAPE_TRANSFORM },
+ { XML_NAMESPACE_DR3D, XML_VRP, XML_TOK_3DSCENESHAPE_VRP },
+ { XML_NAMESPACE_DR3D, XML_VPN, XML_TOK_3DSCENESHAPE_VPN },
+ { XML_NAMESPACE_DR3D, XML_VUP, XML_TOK_3DSCENESHAPE_VUP },
+ { XML_NAMESPACE_DR3D, XML_PROJECTION, XML_TOK_3DSCENESHAPE_PROJECTION },
+ { XML_NAMESPACE_DR3D, XML_DISTANCE, XML_TOK_3DSCENESHAPE_DISTANCE },
+ { XML_NAMESPACE_DR3D, XML_FOCAL_LENGTH, XML_TOK_3DSCENESHAPE_FOCAL_LENGTH },
+ { XML_NAMESPACE_DR3D, XML_SHADOW_SLANT, XML_TOK_3DSCENESHAPE_SHADOW_SLANT },
+ { XML_NAMESPACE_DR3D, XML_SHADE_MODE, XML_TOK_3DSCENESHAPE_SHADE_MODE },
+ { XML_NAMESPACE_DR3D, XML_AMBIENT_COLOR, XML_TOK_3DSCENESHAPE_AMBIENT_COLOR },
+ { XML_NAMESPACE_DR3D, XML_LIGHTING_MODE, XML_TOK_3DSCENESHAPE_LIGHTING_MODE },
+ XML_TOKEN_MAP_END
+};
+
+ mp3DSceneShapeAttrTokenMap = new SvXMLTokenMap(a3DSceneShapeAttrTokenMap);
+ } // if(!mp3DSceneShapeAttrTokenMap)
+
+ return *mp3DSceneShapeAttrTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+
+const SvXMLTokenMap& XMLShapeImportHelper::Get3DLightAttrTokenMap()
+{
+ if(!mp3DLightAttrTokenMap)
+ {
+ static SvXMLTokenMapEntry a3DLightAttrTokenMap[] =
+{
+ { XML_NAMESPACE_DR3D, XML_DIFFUSE_COLOR, XML_TOK_3DLIGHT_DIFFUSE_COLOR },
+ { XML_NAMESPACE_DR3D, XML_DIRECTION, XML_TOK_3DLIGHT_DIRECTION },
+ { XML_NAMESPACE_DR3D, XML_ENABLED, XML_TOK_3DLIGHT_ENABLED },
+ { XML_NAMESPACE_DR3D, XML_SPECULAR, XML_TOK_3DLIGHT_SPECULAR },
+ XML_TOKEN_MAP_END
+};
+
+ mp3DLightAttrTokenMap = new SvXMLTokenMap(a3DLightAttrTokenMap);
+ } // if(!mp3DLightAttrTokenMap)
+
+ return *mp3DLightAttrTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+
+SvXMLShapeContext* XMLShapeImportHelper::Create3DSceneChildContext(
+ SvXMLImport& rImport,
+ sal_uInt16 p_nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes)
+{
+ SdXMLShapeContext *pContext = 0L;
+
+ if(rShapes.is())
+ {
+ const SvXMLTokenMap& rTokenMap = Get3DSceneShapeElemTokenMap();
+ switch(rTokenMap.Get(p_nPrefix, rLocalName))
+ {
+ case XML_TOK_3DSCENE_3DSCENE:
+ {
+ // dr3d:3dscene inside dr3d:3dscene context
+ pContext = new SdXML3DSceneShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, sal_False);
+ break;
+ }
+ case XML_TOK_3DSCENE_3DCUBE:
+ {
+ // dr3d:3dcube inside dr3d:3dscene context
+ pContext = new SdXML3DCubeObjectShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, sal_False);
+ break;
+ }
+ case XML_TOK_3DSCENE_3DSPHERE:
+ {
+ // dr3d:3dsphere inside dr3d:3dscene context
+ pContext = new SdXML3DSphereObjectShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, sal_False);
+ break;
+ }
+ case XML_TOK_3DSCENE_3DLATHE:
+ {
+ // dr3d:3dlathe inside dr3d:3dscene context
+ pContext = new SdXML3DLatheObjectShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, sal_False);
+ break;
+ }
+ case XML_TOK_3DSCENE_3DEXTRUDE:
+ {
+ // dr3d:3dextrude inside dr3d:3dscene context
+ pContext = new SdXML3DExtrudeObjectShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, sal_False);
+ break;
+ }
+ }
+ }
+
+ // now parse the attribute list and call the child context for each unknown attribute
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 a(0); a < nAttrCount; a++)
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex(a);
+ OUString aLocalName;
+ sal_uInt16 nPrefix = rImport.GetNamespaceMap().GetKeyByAttrName(rAttrName, &aLocalName);
+ const OUString aValue( xAttrList->getValueByIndex(a) );
+
+ pContext->processAttribute( nPrefix, aLocalName, aValue );
+ }
+
+ return pContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeImportHelper::SetStylesContext(SvXMLStylesContext* pNew)
+{
+ mpStylesContext = pNew;
+ mpStylesContext->AddRef();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeImportHelper::SetAutoStylesContext(SvXMLStylesContext* pNew)
+{
+ mpAutoStylesContext = pNew;
+ mpAutoStylesContext->AddRef();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLShapeContext* XMLShapeImportHelper::CreateGroupChildContext(
+ SvXMLImport& rImport,
+ sal_uInt16 p_nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+{
+ SdXMLShapeContext *pContext = 0L;
+
+ const SvXMLTokenMap& rTokenMap = GetGroupShapeElemTokenMap();
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+
+ switch(rTokenMap.Get(p_nPrefix, rLocalName))
+ {
+ case XML_TOK_GROUP_GROUP:
+ {
+ // draw:g inside group context (RECURSIVE)
+ pContext = new SdXMLGroupShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape);
+ break;
+ }
+ case XML_TOK_GROUP_3DSCENE:
+ {
+ // dr3d:3dscene inside group context
+ pContext = new SdXML3DSceneShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape);
+ break;
+ }
+ case XML_TOK_GROUP_RECT:
+ {
+ // draw:rect inside group context
+ pContext = new SdXMLRectShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape );
+ break;
+ }
+ case XML_TOK_GROUP_LINE:
+ {
+ // draw:line inside group context
+ pContext = new SdXMLLineShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape );
+ break;
+ }
+ case XML_TOK_GROUP_CIRCLE:
+ case XML_TOK_GROUP_ELLIPSE:
+ {
+ // draw:circle or draw:ellipse inside group context
+ pContext = new SdXMLEllipseShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape );
+ break;
+ }
+ case XML_TOK_GROUP_POLYGON:
+ case XML_TOK_GROUP_POLYLINE:
+ {
+ // draw:polygon or draw:polyline inside group context
+ pContext = new SdXMLPolygonShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes,
+ rTokenMap.Get(p_nPrefix, rLocalName) == XML_TOK_GROUP_POLYGON ? sal_True : sal_False, bTemporaryShape );
+ break;
+ }
+ case XML_TOK_GROUP_PATH:
+ {
+ // draw:path inside group context
+ pContext = new SdXMLPathShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape);
+ break;
+ }
+ case XML_TOK_GROUP_FRAME:
+ {
+ // text:text-box inside group context
+ pContext = new SdXMLFrameShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape );
+ break;
+ }
+ case XML_TOK_GROUP_CONTROL:
+ {
+ // draw:control inside group context
+ pContext = new SdXMLControlShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape );
+ break;
+ }
+ case XML_TOK_GROUP_CONNECTOR:
+ {
+ // draw:connector inside group context
+ pContext = new SdXMLConnectorShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape );
+ break;
+ }
+ case XML_TOK_GROUP_MEASURE:
+ {
+ // draw:measure inside group context
+ pContext = new SdXMLMeasureShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape );
+ break;
+ }
+ case XML_TOK_GROUP_PAGE:
+ {
+ // draw:page inside group context
+ pContext = new SdXMLPageShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape );
+ break;
+ }
+ case XML_TOK_GROUP_CAPTION:
+ case XML_TOK_GROUP_ANNOTATION:
+ {
+ // draw:caption inside group context
+ pContext = new SdXMLCaptionShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape );
+ break;
+ }
+ case XML_TOK_GROUP_CHART:
+ {
+ // chart:chart inside group context
+ pContext = new SdXMLChartShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape );
+ break;
+ }
+ case XML_TOK_GROUP_CUSTOM_SHAPE:
+ {
+ // draw:customshape
+ pContext = new SdXMLCustomShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, sal_False );
+ break;
+ }
+ case XML_TOK_GROUP_A:
+ {
+ return new SdXMLShapeLinkContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes );
+ }
+ // add other shapes here...
+ default:
+ return new SvXMLShapeContext( rImport, p_nPrefix, rLocalName, bTemporaryShape );
+ }
+
+ // now parse the attribute list and call the child context for each unknown attribute
+ for(sal_Int16 a(0); a < nAttrCount; a++)
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex(a);
+ OUString aLocalName;
+ sal_uInt16 nPrefix = rImport.GetNamespaceMap().GetKeyByAttrName(rAttrName, &aLocalName);
+ const OUString aValue( xAttrList->getValueByIndex(a) );
+
+ pContext->processAttribute( nPrefix, aLocalName, aValue );
+ }
+
+ return pContext;
+}
+
+// This method is called from SdXMLFrameContext to create children of drawe:frame
+SvXMLShapeContext* XMLShapeImportHelper::CreateFrameChildContext(
+ SvXMLImport& rImport,
+ sal_uInt16 p_nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList>& rAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ const uno::Reference< xml::sax::XAttributeList>& rFrameAttrList)
+{
+ SdXMLShapeContext *pContext = 0L;
+
+ const SvXMLTokenMap& rTokenMap = GetFrameShapeElemTokenMap();
+
+ SvXMLAttributeList *pAttrList = new SvXMLAttributeList( rAttrList );
+ if( rFrameAttrList.is() )
+ pAttrList->AppendAttributeList( rFrameAttrList );
+ uno::Reference < xml::sax::XAttributeList > xAttrList = pAttrList;
+
+
+ switch(rTokenMap.Get(p_nPrefix, rLocalName))
+ {
+ case XML_TOK_FRAME_TEXT_BOX:
+ {
+ // text:text-box inside group context
+ pContext = new SdXMLTextBoxShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, sal_False );
+ break;
+ }
+ case XML_TOK_FRAME_IMAGE:
+ {
+ // office:image inside group context
+ pContext = new SdXMLGraphicObjectShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, sal_False );
+ break;
+ }
+ case XML_TOK_FRAME_OBJECT:
+ case XML_TOK_FRAME_OBJECT_OLE:
+ {
+ // draw:object or draw:object_ole
+ pContext = new SdXMLObjectShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, sal_False );
+ break;
+ }
+ case XML_TOK_FRAME_TABLE:
+ {
+ // draw:object or draw:object_ole
+ if( rImport.IsTableShapeSupported() )
+ pContext = new SdXMLTableShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes );
+ break;
+
+ }
+ case XML_TOK_FRAME_PLUGIN:
+ {
+ // draw:plugin
+ pContext = new SdXMLPluginShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, sal_False );
+ break;
+ }
+ case XML_TOK_FRAME_FLOATING_FRAME:
+ {
+ // draw:floating-frame
+ pContext = new SdXMLFloatingFrameShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, sal_False );
+ break;
+ }
+ case XML_TOK_FRAME_APPLET:
+ {
+ // draw:applet
+ pContext = new SdXMLAppletShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, sal_False );
+ break;
+ }
+ // add other shapes here...
+ default:
+ break;
+ }
+
+ if( pContext )
+ {
+ // now parse the attribute list and call the child context for each unknown attribute
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 a(0); a < nAttrCount; a++)
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex(a);
+ OUString aLocalName;
+ sal_uInt16 nPrefix = rImport.GetNamespaceMap().GetKeyByAttrName(rAttrName, &aLocalName);
+ const OUString aValue( xAttrList->getValueByIndex(a) );
+
+ pContext->processAttribute( nPrefix, aLocalName, aValue );
+ }
+ }
+
+ return pContext;
+}
+
+SvXMLImportContext *XMLShapeImportHelper::CreateFrameChildContext(
+ SvXMLImportContext *pThisContext,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList>& xAttrList )
+{
+ SvXMLImportContext * pContext = NULL;
+
+ SdXMLFrameShapeContext *pFrameContext = PTR_CAST( SdXMLFrameShapeContext, pThisContext );
+ if( pFrameContext )
+ pContext = pFrameContext->CreateChildContext( nPrefix, rLocalName, xAttrList );
+
+ return pContext;
+}
+
+
+/** this function is called whenever the implementation classes like to add this new
+ shape to the given XShapes.
+*/
+void XMLShapeImportHelper::addShape( uno::Reference< drawing::XShape >& rShape,
+ const uno::Reference< xml::sax::XAttributeList >&,
+ uno::Reference< drawing::XShapes >& rShapes)
+{
+ if( rShape.is() && rShapes.is() )
+ {
+ // add new shape to parent
+ rShapes->add( rShape );
+ }
+}
+
+/** this function is called whenever the implementation classes have finished importing
+ a shape to the given XShapes. The shape is already inserted into its XShapes and
+ all properties and styles are set.
+*/
+void XMLShapeImportHelper::finishShape(
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rShape,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >&,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >&)
+{
+ /* Set property <PositionLayoutDir>
+ to <PositionInHoriL2R>, if it exists and the import states that
+ the shape positioning attributes are in horizontal left-to-right
+ layout. This is the case for the OpenOffice.org file format.
+ This setting is done for Writer documents, because the property
+ only exists at service com::sun::star::text::Shape - the Writer
+ UNO service for shapes.
+ The value indicates that the positioning attributes are given
+ in horizontal left-to-right layout. The property is evaluated
+ during the first positioning of the shape in order to convert
+ the shape position given in the OpenOffice.org file format to
+ the one for the OASIS Open Office file format. (#i28749#, #i36248#)
+ */
+ uno::Reference< beans::XPropertySet > xPropSet(rShape, uno::UNO_QUERY);
+ if ( xPropSet.is() )
+ {
+ if ( mrImporter.IsShapePositionInHoriL2R() &&
+ xPropSet->getPropertySetInfo()->hasPropertyByName(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("PositionLayoutDir"))) )
+ {
+ uno::Any aPosLayoutDir;
+ aPosLayoutDir <<= text::PositionLayoutDir::PositionInHoriL2R;
+ xPropSet->setPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("PositionLayoutDir")),
+ aPosLayoutDir );
+ }
+ }
+ // <--
+}
+
+// helper functions for z-order sorting
+struct ZOrderHint
+{
+ sal_Int32 nIs;
+ sal_Int32 nShould;
+
+ int operator<(const ZOrderHint& rComp) const { return nShould < rComp.nShould; }
+};
+
+class ShapeSortContext
+{
+public:
+ uno::Reference< drawing::XShapes > mxShapes;
+ list<ZOrderHint> maZOrderList;
+ list<ZOrderHint> maUnsortedList;
+
+ sal_Int32 mnCurrentZ;
+ ShapeSortContext* mpParentContext;
+ const OUString msZOrder;
+
+ ShapeSortContext( uno::Reference< drawing::XShapes >& rShapes, ShapeSortContext* pParentContext = NULL );
+
+ void moveShape( sal_Int32 nSourcePos, sal_Int32 nDestPos );
+};
+
+ShapeSortContext::ShapeSortContext( uno::Reference< drawing::XShapes >& rShapes, ShapeSortContext* pParentContext )
+: mxShapes( rShapes ), mnCurrentZ( 0 ), mpParentContext( pParentContext ),
+ msZOrder(RTL_CONSTASCII_USTRINGPARAM("ZOrder"))
+{
+}
+
+void ShapeSortContext::moveShape( sal_Int32 nSourcePos, sal_Int32 nDestPos )
+{
+ uno::Any aAny( mxShapes->getByIndex( nSourcePos ) );
+ uno::Reference< beans::XPropertySet > xPropSet;
+ aAny >>= xPropSet;
+
+ if( xPropSet.is() && xPropSet->getPropertySetInfo()->hasPropertyByName( msZOrder ) )
+ {
+ aAny <<= nDestPos;
+ xPropSet->setPropertyValue( msZOrder, aAny );
+
+ list<ZOrderHint>::iterator aIter = maZOrderList.begin();
+ list<ZOrderHint>::iterator aEnd = maZOrderList.end();
+
+ while( aIter != aEnd )
+ {
+ if( (*aIter).nIs < nSourcePos )
+ {
+ DBG_ASSERT( (*aIter).nIs >= nDestPos, "Shape sorting failed" );
+ (*aIter).nIs++;
+ }
+ ++aIter;
+ }
+
+ aIter = maUnsortedList.begin();
+ aEnd = maUnsortedList.end();
+
+ while( aIter != aEnd )
+ {
+ if( (*aIter).nIs < nSourcePos )
+ {
+ DBG_ASSERT( (*aIter).nIs >= nDestPos, "shape sorting failed" );
+ (*aIter).nIs++;
+ }
+ ++aIter;
+ }
+ }
+}
+
+void XMLShapeImportHelper::pushGroupForSorting( uno::Reference< drawing::XShapes >& rShapes )
+{
+ mpImpl->mpSortContext = new ShapeSortContext( rShapes, mpImpl->mpSortContext );
+}
+
+void XMLShapeImportHelper::popGroupAndSort()
+{
+ DBG_ASSERT( mpImpl->mpSortContext, "No context to sort!" );
+ if( mpImpl->mpSortContext == NULL )
+ return;
+
+ try
+ {
+ list<ZOrderHint>& rZList = mpImpl->mpSortContext->maZOrderList;
+ list<ZOrderHint>& rUnsortedList = mpImpl->mpSortContext->maUnsortedList;
+
+ // sort shapes
+ if( !rZList.empty() )
+ {
+ // only do something if we have shapes to sort
+
+ // check if there are more shapes than inserted with ::shapeWithZIndexAdded()
+ // This can happen if there where already shapes on the page before import
+ // Since the writer may delete some of this shapes during import, we need
+ // to do this here and not in our c'tor anymore
+
+ // check if we have more shapes than we know of
+ sal_Int32 nCount = mpImpl->mpSortContext->mxShapes->getCount();
+
+ nCount -= rZList.size();
+ nCount -= rUnsortedList.size();
+
+
+ if( nCount > 0 )
+ {
+ // first update offsets of added shapes
+ list<ZOrderHint>::iterator aIter( rZList.begin() );
+ while( aIter != rZList.end() )
+ (*aIter++).nIs += nCount;
+
+ aIter = rUnsortedList.begin();
+ while( aIter != rUnsortedList.end() )
+ (*aIter++).nIs += nCount;
+
+ // second add the already existing shapes in the unsorted list
+ ZOrderHint aNewHint;
+
+ do
+ {
+ nCount--;
+
+ aNewHint.nIs = nCount;
+ aNewHint.nShould = -1;
+
+ rUnsortedList.insert(rUnsortedList.begin(), aNewHint);
+ }
+ while( nCount );
+ }
+
+ // sort z ordered shapes
+ rZList.sort();
+
+ // this is the current index, all shapes before that
+ // index are finished
+ sal_Int32 nIndex = 0;
+ while( !rZList.empty() )
+ {
+ list<ZOrderHint>::iterator aIter( rZList.begin() );
+
+ while( nIndex < (*aIter).nShould && !rUnsortedList.empty() )
+ {
+ ZOrderHint aGapHint( *rUnsortedList.begin() );
+ rUnsortedList.pop_front();
+
+ mpImpl->mpSortContext->moveShape( aGapHint.nIs, nIndex++ );
+ }
+
+ if( (*aIter).nIs != nIndex )
+ mpImpl->mpSortContext->moveShape( (*aIter).nIs, nIndex );
+
+ rZList.pop_front();
+ nIndex++;
+ }
+ }
+ }
+ catch( uno::Exception& )
+ {
+ OSL_FAIL("exception while sorting shapes, sorting failed!");
+ }
+
+ // put parent on top and delete current context, were done
+ ShapeSortContext* pContext = mpImpl->mpSortContext;
+ mpImpl->mpSortContext = pContext->mpParentContext;
+ delete pContext;
+}
+
+void XMLShapeImportHelper::shapeWithZIndexAdded( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >&, sal_Int32 nZIndex )
+{
+ if( mpImpl->mpSortContext)
+ {
+ ZOrderHint aNewHint;
+ aNewHint.nIs = mpImpl->mpSortContext->mnCurrentZ++;
+ aNewHint.nShould = nZIndex;
+
+ if( nZIndex == -1 )
+ {
+ // don't care, so add to unsorted list
+ mpImpl->mpSortContext->maUnsortedList.push_back(aNewHint);
+ }
+ else
+ {
+ // insert into sort list
+ mpImpl->mpSortContext->maZOrderList.push_back(aNewHint);
+ }
+ }
+}
+
+void XMLShapeImportHelper::addShapeConnection( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rConnectorShape,
+ sal_Bool bStart,
+ const rtl::OUString& rDestShapeId,
+ sal_Int32 nDestGlueId )
+{
+ ConnectionHint aHint;
+ aHint.mxConnector = rConnectorShape;
+ aHint.bStart = bStart;
+ aHint.aDestShapeId = rDestShapeId;
+ aHint.nDestGlueId = nDestGlueId;
+
+ mpImpl->maConnections.push_back( aHint );
+}
+
+void XMLShapeImportHelper::restoreConnections()
+{
+ if( !mpImpl->maConnections.empty() )
+ {
+ uno::Any aAny;
+
+ const vector<ConnectionHint>::size_type nCount = mpImpl->maConnections.size();
+ for( vector<ConnectionHint>::size_type i = 0; i < nCount; i++ )
+ {
+ ConnectionHint& rHint = mpImpl->maConnections[i];
+ uno::Reference< beans::XPropertySet > xConnector( rHint.mxConnector, uno::UNO_QUERY );
+ if( xConnector.is() )
+ {
+ // #86637# remember line deltas
+ uno::Any aLine1Delta;
+ uno::Any aLine2Delta;
+ uno::Any aLine3Delta;
+ OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("EdgeLine1Delta"));
+ OUString aStr2(RTL_CONSTASCII_USTRINGPARAM("EdgeLine2Delta"));
+ OUString aStr3(RTL_CONSTASCII_USTRINGPARAM("EdgeLine3Delta"));
+ aLine1Delta = xConnector->getPropertyValue(aStr1);
+ aLine2Delta = xConnector->getPropertyValue(aStr2);
+ aLine3Delta = xConnector->getPropertyValue(aStr3);
+
+ // #86637# simply setting these values WILL force the connector to do
+ // an new layout promptly. So the line delta values have to be rescued
+ // and restored around connector changes.
+ uno::Reference< drawing::XShape > xShape(
+ mrImporter.getInterfaceToIdentifierMapper().getReference( rHint.aDestShapeId ), uno::UNO_QUERY );
+ if( xShape.is() )
+ {
+ aAny <<= xShape;
+ xConnector->setPropertyValue( rHint.bStart ? msStartShape : msEndShape, aAny );
+
+ sal_Int32 nGlueId = rHint.nDestGlueId < 4 ? rHint.nDestGlueId : getGluePointId( xShape, rHint.nDestGlueId );
+ aAny <<= nGlueId;
+ xConnector->setPropertyValue( rHint.bStart ? msStartGluePointIndex : msEndGluePointIndex, aAny );
+ }
+
+ // #86637# restore line deltas
+ xConnector->setPropertyValue(aStr1, aLine1Delta );
+ xConnector->setPropertyValue(aStr2, aLine2Delta );
+ xConnector->setPropertyValue(aStr3, aLine3Delta );
+ }
+ }
+ mpImpl->maConnections.clear();
+ }
+}
+
+SvXMLImportPropertyMapper* XMLShapeImportHelper::CreateShapePropMapper( const uno::Reference< frame::XModel>& rModel, SvXMLImport& rImport )
+{
+ UniReference< XMLPropertyHandlerFactory > xFactory = new XMLSdPropHdlFactory( rModel, rImport );
+ UniReference < XMLPropertySetMapper > xMapper = new XMLShapePropertySetMapper( xFactory );
+ SvXMLImportPropertyMapper* pResult = new SvXMLImportPropertyMapper( xMapper, rImport );
+
+ // chain text attributes
+ pResult->ChainImportMapper( XMLTextImportHelper::CreateParaExtPropMapper( rImport ) );
+ return pResult;
+}
+
+/** creates a shape property set mapper that can be used for non shape elements.
+ Only current feature is that the ShapeUserDefinedAttributes property is not included in this one. */
+SvXMLImportPropertyMapper* XMLShapeImportHelper::CreateExternalShapePropMapper( const uno::Reference< frame::XModel>& rModel, SvXMLImport& rImport )
+{
+ UniReference< XMLPropertyHandlerFactory > xFactory = new XMLSdPropHdlFactory( rModel, rImport );
+ UniReference < XMLPropertySetMapper > xMapper = new XMLShapePropertySetMapper( xFactory, 1 );
+ SvXMLImportPropertyMapper* pResult = new SvXMLImportPropertyMapper( xMapper, rImport );
+
+ // chain text attributes
+ pResult->ChainImportMapper( XMLTextImportHelper::CreateParaExtPropMapper( rImport ) );
+ return pResult;
+}
+
+/** adds a mapping for a glue point identifier from an xml file to the identifier created after inserting
+ the new glue point into the core. The saved mappings can be retrieved by getGluePointId() */
+void XMLShapeImportHelper::addGluePointMapping( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape,
+ sal_Int32 nSourceId, sal_Int32 nDestinnationId )
+{
+ if( mpPageContext )
+ mpPageContext->maShapeGluePointsMap[xShape][nSourceId] = nDestinnationId;
+}
+
+/** moves all current DestinationId's by n */
+void XMLShapeImportHelper::moveGluePointMapping( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, const sal_Int32 n )
+{
+ if( mpPageContext )
+ {
+ ShapeGluePointsMap::iterator aShapeIter( mpPageContext->maShapeGluePointsMap.find( xShape ) );
+ if( aShapeIter != mpPageContext->maShapeGluePointsMap.end() )
+ {
+ GluePointIdMap::iterator aShapeIdIter = (*aShapeIter).second.begin();
+ GluePointIdMap::iterator aShapeIdEnd = (*aShapeIter).second.end();
+ while ( aShapeIdIter != aShapeIdEnd )
+ {
+ if ( (*aShapeIdIter).second != -1 )
+ (*aShapeIdIter).second += n;
+ ++aShapeIdIter;
+ }
+ }
+ }
+}
+
+/** retrieves a mapping for a glue point identifier from the current xml file to the identifier created after
+ inserting the new glue point into the core. The mapping must be initialized first with addGluePointMapping() */
+sal_Int32 XMLShapeImportHelper::getGluePointId( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, sal_Int32 nSourceId )
+{
+ if( mpPageContext )
+ {
+ ShapeGluePointsMap::iterator aShapeIter( mpPageContext->maShapeGluePointsMap.find( xShape ) );
+ if( aShapeIter != mpPageContext->maShapeGluePointsMap.end() )
+ {
+ GluePointIdMap::iterator aIdIter = (*aShapeIter).second.find(nSourceId);
+ if( aIdIter != (*aShapeIter).second.end() )
+ return (*aIdIter).second;
+ }
+ }
+
+ return -1;
+}
+
+/** this method must be calling before the first shape is imported for the given page */
+void XMLShapeImportHelper::startPage( com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes )
+{
+ XMLShapeImportPageContextImpl* pOldContext = mpPageContext;
+ mpPageContext = new XMLShapeImportPageContextImpl();
+ mpPageContext->mpNext = pOldContext;
+ mpPageContext->mxShapes = rShapes;
+}
+
+/** this method must be calling after the last shape is imported for the given page */
+void XMLShapeImportHelper::endPage( com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >&
+#ifdef DBG_UTIL
+rShapes
+#endif
+)
+{
+ DBG_ASSERT( mpPageContext && (mpPageContext->mxShapes == rShapes), "wrong call to endPage(), no startPage called or wrong page" );
+ if( NULL == mpPageContext )
+ return;
+
+ restoreConnections();
+
+ XMLShapeImportPageContextImpl* pNextContext = mpPageContext->mpNext;
+ delete mpPageContext;
+ mpPageContext = pNextContext;
+}
+
+// #88546#
+/** defines if the import should increment the progress bar or not */
+void XMLShapeImportHelper::enableHandleProgressBar( sal_Bool bEnable )
+{
+ mpImpl->mbHandleProgressBar = bEnable;
+}
+
+sal_Bool XMLShapeImportHelper::IsHandleProgressBarEnabled() const
+{
+ return mpImpl->mbHandleProgressBar;
+}
+
+/** queries the capability of the current model to create presentation shapes */
+sal_Bool XMLShapeImportHelper::IsPresentationShapesSupported()
+{
+ return mpImpl->mbIsPresentationShapesSupported;
+}
+
+const rtl::Reference< XMLTableImport >& XMLShapeImportHelper::GetShapeTableImport()
+{
+ if( !mxShapeTableImport.is() )
+ {
+ rtl::Reference< XMLPropertyHandlerFactory > xFactory( new XMLSdPropHdlFactory( mrImporter.GetModel(), mrImporter ) );
+ rtl::Reference< XMLPropertySetMapper > xPropertySetMapper( new XMLShapePropertySetMapper( xFactory.get() ) );
+ mxShapeTableImport = new XMLTableImport( mrImporter, xPropertySetMapper, xFactory );
+ }
+
+ return mxShapeTableImport;
+}
+
+void SvXMLShapeContext::setHyperlink( const OUString& rHyperlink )
+{
+ msHyperlink = rHyperlink;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/viewcontext.cxx b/xmloff/source/draw/viewcontext.cxx
new file mode 100644
index 000000000000..0670e971afad
--- /dev/null
+++ b/xmloff/source/draw/viewcontext.cxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "viewcontext.hxx"
+#include "sdxmlimp_impl.hxx"
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/VisAreaContext.hxx"
+
+using namespace com::sun::star;
+using ::xmloff::token::IsXMLToken;
+
+using ::xmloff::token::XML_EMBEDDED_VISIBLE_AREA;
+
+using ::rtl::OUString;
+
+//------------------------------------------------------------------
+
+SdXMLViewSettingsContext::SdXMLViewSettingsContext( SdXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, const uno::Reference<xml::sax::XAttributeList>& ) :
+ SvXMLImportContext( rImport, nPrfx, rLName )
+{
+}
+
+SdXMLViewSettingsContext::~SdXMLViewSettingsContext()
+{
+}
+
+SvXMLImportContext *SdXMLViewSettingsContext::CreateChildContext( sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList )
+{
+ SvXMLImportContext *pContext = 0;
+
+ if (nPrefix == XML_NAMESPACE_OFFICE)
+ {
+ if ( IsXMLToken( rLocalName, XML_EMBEDDED_VISIBLE_AREA ) )
+ {
+ sal_Int16 nMeasureUnit = 0;
+
+ uno::Reference< beans::XPropertySet > xProps( GetImport().GetModel(), uno::UNO_QUERY );
+ if( xProps.is() )
+ xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "MapUnit" ) ) ) >>= nMeasureUnit;
+
+ pContext = new XMLVisAreaContext(GetImport(), nPrefix, rLocalName, xAttrList, maVisArea, nMeasureUnit);
+ }
+ }
+
+ if( !pContext )
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+
+ return pContext;
+}
+
+void SdXMLViewSettingsContext::EndElement()
+{
+ uno::Reference< beans::XPropertySet > xProps( GetImport().GetModel(), uno::UNO_QUERY );
+ if( xProps.is() )
+ {
+ uno::Any aAny;
+ aAny <<= maVisArea;
+
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "VisibleArea" ) ), aAny );
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/viewcontext.hxx b/xmloff/source/draw/viewcontext.hxx
new file mode 100644
index 000000000000..fbc88b5d2115
--- /dev/null
+++ b/xmloff/source/draw/viewcontext.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _SD_XMLVIEWSETTINGSCONTEXT_HXX
+#define _SD_XMLVIEWSETTINGSCONTEXT_HXX
+
+
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <xmloff/xmlictxt.hxx>
+
+class SdXMLImport;
+
+class SdXMLViewSettingsContext : public SvXMLImportContext
+{
+ ::com::sun::star::awt::Rectangle maVisArea;
+
+public:
+ SdXMLViewSettingsContext( SdXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList);
+ virtual ~SdXMLViewSettingsContext();
+
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
+ virtual void EndElement();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/xexptran.cxx b/xmloff/source/draw/xexptran.cxx
new file mode 100644
index 000000000000..0834ea1218ec
--- /dev/null
+++ b/xmloff/source/draw/xexptran.cxx
@@ -0,0 +1,3116 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "xexptran.hxx"
+#include <tools/debug.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <tools/gen.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/tuple/b3dtuple.hxx>
+#include <basegfx/matrix/b3dhommatrix.hxx>
+#include <tools/string.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+// Defines
+
+#define BORDER_INTEGERS_ARE_EQUAL (4)
+
+//////////////////////////////////////////////////////////////////////////////
+// Predeclarations
+
+void Imp_SkipDouble(const OUString& rStr, sal_Int32& rPos, const sal_Int32 nLen);
+void Imp_CalcVectorValues(::basegfx::B2DVector& aVec1, ::basegfx::B2DVector& aVec2, bool& bSameLength, bool& bSameDirection);
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+// parsing help functions for simple chars
+void Imp_SkipSpaces(const OUString& rStr, sal_Int32& rPos, const sal_Int32 nLen)
+{
+ while(rPos < nLen
+ && sal_Unicode(' ') == rStr[rPos])
+ rPos++;
+}
+
+void Imp_SkipSpacesAndOpeningBraces(const OUString& rStr, sal_Int32& rPos, const sal_Int32 nLen)
+{
+ while(rPos < nLen
+ && (sal_Unicode(' ') == rStr[rPos] || sal_Unicode('(') == rStr[rPos]))
+ rPos++;
+}
+
+void Imp_SkipSpacesAndCommas(const OUString& rStr, sal_Int32& rPos, const sal_Int32 nLen)
+{
+ while(rPos < nLen
+ && (sal_Unicode(' ') == rStr[rPos] || sal_Unicode(',') == rStr[rPos]))
+ rPos++;
+}
+
+void Imp_SkipSpacesAndClosingBraces(const OUString& rStr, sal_Int32& rPos, const sal_Int32 nLen)
+{
+ while(rPos < nLen
+ && (sal_Unicode(' ') == rStr[rPos] || sal_Unicode(')') == rStr[rPos]))
+ rPos++;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+// parsing help functions for integer numbers
+
+bool Imp_IsOnNumberChar(const OUString& rStr, const sal_Int32 nPos, bool bSignAllowed = true)
+{
+ sal_Unicode aChar(rStr[nPos]);
+
+ if((sal_Unicode('0') <= aChar && sal_Unicode('9') >= aChar)
+ || (bSignAllowed && sal_Unicode('+') == aChar)
+ || (bSignAllowed && sal_Unicode('-') == aChar)
+ )
+ return true;
+ return false;
+}
+
+bool Imp_IsOnUnitChar(const OUString& rStr, const sal_Int32 nPos)
+{
+ sal_Unicode aChar(rStr[nPos]);
+
+ if((sal_Unicode('a') <= aChar && sal_Unicode('z') >= aChar)
+ || (sal_Unicode('A') <= aChar && sal_Unicode('Z') >= aChar)
+ || sal_Unicode('%') == aChar
+ )
+ return true;
+ return false;
+}
+
+void Imp_SkipNumber(const OUString& rStr, sal_Int32& rPos, const sal_Int32 nLen)
+{
+ bool bSignAllowed(true);
+
+ while(rPos < nLen && Imp_IsOnNumberChar(rStr, rPos, bSignAllowed))
+ {
+ bSignAllowed = false;
+ rPos++;
+ }
+}
+
+void Imp_SkipNumberAndSpacesAndCommas(const OUString& rStr, sal_Int32& rPos,
+ const sal_Int32 nLen)
+{
+ Imp_SkipNumber(rStr, rPos, nLen);
+ Imp_SkipSpacesAndCommas(rStr, rPos, nLen);
+}
+
+// #100617# Allow to skip doubles, too.
+void Imp_SkipDoubleAndSpacesAndCommas(const OUString& rStr, sal_Int32& rPos,
+ const sal_Int32 nLen)
+{
+ Imp_SkipDouble(rStr, rPos, nLen);
+ Imp_SkipSpacesAndCommas(rStr, rPos, nLen);
+}
+
+void Imp_PutNumberChar(OUString& rStr, sal_Int32 nValue)
+{
+ OUStringBuffer sStringBuffer;
+ SvXMLUnitConverter::convertNumber(sStringBuffer, nValue);
+ rStr += OUString(sStringBuffer.makeStringAndClear());
+}
+
+void Imp_PutNumberCharWithSpace(OUString& rStr, sal_Int32 nValue)
+{
+ const sal_Int32 aLen(rStr.getLength());
+ if(aLen)
+ if(Imp_IsOnNumberChar(rStr, aLen - 1, false) && nValue >= 0)
+ rStr += String(sal_Unicode(' '));
+ Imp_PutNumberChar(rStr, nValue);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+// parsing help functions for double numbers
+
+void Imp_SkipDouble(const OUString& rStr, sal_Int32& rPos, const sal_Int32)
+{
+ sal_Unicode aChar(rStr[rPos]);
+
+ if(sal_Unicode('+') == aChar || sal_Unicode('-') == aChar)
+ aChar = rStr[++rPos];
+
+ while((sal_Unicode('0') <= aChar && sal_Unicode('9') >= aChar)
+ || sal_Unicode('.') == aChar)
+ {
+ aChar = rStr[++rPos];
+ }
+
+ if(sal_Unicode('e') == aChar || sal_Unicode('E') == aChar)
+ {
+ aChar = rStr[++rPos];
+
+ if(sal_Unicode('+') == aChar || sal_Unicode('-') == aChar)
+ aChar = rStr[++rPos];
+
+ while(sal_Unicode('0') <= aChar && sal_Unicode('9') >= aChar)
+ {
+ aChar = rStr[++rPos];
+ }
+ }
+}
+
+double Imp_GetDoubleChar(const OUString& rStr, sal_Int32& rPos, const sal_Int32 nLen,
+ const SvXMLUnitConverter& rConv, double fRetval, bool bLookForUnits = false)
+{
+ sal_Unicode aChar(rStr[rPos]);
+ OUStringBuffer sNumberString;
+
+ if(sal_Unicode('+') == aChar || sal_Unicode('-') == aChar)
+ {
+ sNumberString.append(rStr[rPos]);
+ aChar = rStr[++rPos];
+ }
+
+ while((sal_Unicode('0') <= aChar && sal_Unicode('9') >= aChar)
+ || sal_Unicode('.') == aChar)
+ {
+ sNumberString.append(rStr[rPos]);
+ aChar = rStr[++rPos];
+ }
+
+ if(sal_Unicode('e') == aChar || sal_Unicode('E') == aChar)
+ {
+ sNumberString.append(rStr[rPos]);
+ aChar = rStr[++rPos];
+
+ if(sal_Unicode('+') == aChar || sal_Unicode('-') == aChar)
+ {
+ sNumberString.append(rStr[rPos]);
+ aChar = rStr[++rPos];
+ }
+
+ while(sal_Unicode('0') <= aChar && sal_Unicode('9') >= aChar)
+ {
+ sNumberString.append(rStr[rPos]);
+ aChar = rStr[++rPos];
+ }
+ }
+
+ if(bLookForUnits)
+ {
+ Imp_SkipSpaces(rStr, rPos, nLen);
+ while(rPos < nLen && Imp_IsOnUnitChar(rStr, rPos))
+ sNumberString.append(rStr[rPos++]);
+ }
+
+ if(sNumberString.getLength())
+ {
+ if(bLookForUnits)
+ rConv.convertDouble(fRetval, sNumberString.makeStringAndClear(), true);
+ else
+ rConv.convertDouble(fRetval, sNumberString.makeStringAndClear());
+ }
+
+ return fRetval;
+}
+
+void Imp_PutDoubleChar(OUString& rStr, const SvXMLUnitConverter& rConv, double fValue,
+ bool bConvertUnits = false)
+{
+ OUStringBuffer sStringBuffer;
+
+ if(bConvertUnits)
+ rConv.convertDouble(sStringBuffer, fValue, true);
+ else
+ rConv.convertDouble(sStringBuffer, fValue);
+
+ rStr += OUString(sStringBuffer.makeStringAndClear());
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+// base class of all 2D transform objects
+
+struct ImpSdXMLExpTransObj2DBase
+{
+ sal_uInt16 mnType;
+ ImpSdXMLExpTransObj2DBase(sal_uInt16 nType)
+ : mnType(nType) {}
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// possible object types for 2D
+
+#define IMP_SDXMLEXP_TRANSOBJ2D_ROTATE 0x0000
+#define IMP_SDXMLEXP_TRANSOBJ2D_SCALE 0x0001
+#define IMP_SDXMLEXP_TRANSOBJ2D_TRANSLATE 0x0002
+#define IMP_SDXMLEXP_TRANSOBJ2D_SKEWX 0x0003
+#define IMP_SDXMLEXP_TRANSOBJ2D_SKEWY 0x0004
+#define IMP_SDXMLEXP_TRANSOBJ2D_MATRIX 0x0005
+
+//////////////////////////////////////////////////////////////////////////////
+// classes of objects, different sizes
+
+struct ImpSdXMLExpTransObj2DRotate : public ImpSdXMLExpTransObj2DBase
+{
+ double mfRotate;
+ ImpSdXMLExpTransObj2DRotate(double fVal)
+ : ImpSdXMLExpTransObj2DBase(IMP_SDXMLEXP_TRANSOBJ2D_ROTATE), mfRotate(fVal) {}
+};
+struct ImpSdXMLExpTransObj2DScale : public ImpSdXMLExpTransObj2DBase
+{
+ ::basegfx::B2DTuple maScale;
+ ImpSdXMLExpTransObj2DScale(const ::basegfx::B2DTuple& rNew)
+ : ImpSdXMLExpTransObj2DBase(IMP_SDXMLEXP_TRANSOBJ2D_SCALE), maScale(rNew) {}
+};
+struct ImpSdXMLExpTransObj2DTranslate : public ImpSdXMLExpTransObj2DBase
+{
+ ::basegfx::B2DTuple maTranslate;
+ ImpSdXMLExpTransObj2DTranslate(const ::basegfx::B2DTuple& rNew)
+ : ImpSdXMLExpTransObj2DBase(IMP_SDXMLEXP_TRANSOBJ2D_TRANSLATE), maTranslate(rNew) {}
+};
+struct ImpSdXMLExpTransObj2DSkewX : public ImpSdXMLExpTransObj2DBase
+{
+ double mfSkewX;
+ ImpSdXMLExpTransObj2DSkewX(double fVal)
+ : ImpSdXMLExpTransObj2DBase(IMP_SDXMLEXP_TRANSOBJ2D_SKEWX), mfSkewX(fVal) {}
+};
+struct ImpSdXMLExpTransObj2DSkewY : public ImpSdXMLExpTransObj2DBase
+{
+ double mfSkewY;
+ ImpSdXMLExpTransObj2DSkewY(double fVal)
+ : ImpSdXMLExpTransObj2DBase(IMP_SDXMLEXP_TRANSOBJ2D_SKEWY), mfSkewY(fVal) {}
+};
+struct ImpSdXMLExpTransObj2DMatrix : public ImpSdXMLExpTransObj2DBase
+{
+ ::basegfx::B2DHomMatrix maMatrix;
+ ImpSdXMLExpTransObj2DMatrix(const ::basegfx::B2DHomMatrix& rNew)
+ : ImpSdXMLExpTransObj2DBase(IMP_SDXMLEXP_TRANSOBJ2D_MATRIX), maMatrix(rNew) {}
+};
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+// delete all entries in list
+
+void SdXMLImExTransform2D::EmptyList()
+{
+ const sal_uInt32 nCount = maList.size();
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ ImpSdXMLExpTransObj2DBase* pObj = maList[a];
+
+ switch(pObj->mnType)
+ {
+ case IMP_SDXMLEXP_TRANSOBJ2D_ROTATE :
+ {
+ delete (ImpSdXMLExpTransObj2DRotate*)pObj;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ2D_SCALE :
+ {
+ delete (ImpSdXMLExpTransObj2DScale*)pObj;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ2D_TRANSLATE :
+ {
+ delete (ImpSdXMLExpTransObj2DTranslate*)pObj;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ2D_SKEWX :
+ {
+ delete (ImpSdXMLExpTransObj2DSkewX*)pObj;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ2D_SKEWY :
+ {
+ delete (ImpSdXMLExpTransObj2DSkewY*)pObj;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ2D_MATRIX :
+ {
+ delete (ImpSdXMLExpTransObj2DMatrix*)pObj;
+ break;
+ }
+ default :
+ {
+ OSL_FAIL("SdXMLImExTransform2D: impossible entry!");
+ break;
+ }
+ }
+ }
+
+ maList.clear();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// add members
+
+void SdXMLImExTransform2D::AddRotate(double fNew)
+{
+ if(fNew != 0.0)
+ maList.push_back(new ImpSdXMLExpTransObj2DRotate(fNew));
+}
+
+void SdXMLImExTransform2D::AddScale(const ::basegfx::B2DTuple& rNew)
+{
+ if(1.0 != rNew.getX() || 1.0 != rNew.getY())
+ maList.push_back(new ImpSdXMLExpTransObj2DScale(rNew));
+}
+
+void SdXMLImExTransform2D::AddTranslate(const ::basegfx::B2DTuple& rNew)
+{
+ if(!rNew.equalZero())
+ maList.push_back(new ImpSdXMLExpTransObj2DTranslate(rNew));
+}
+
+void SdXMLImExTransform2D::AddSkewX(double fNew)
+{
+ if(fNew != 0.0)
+ maList.push_back(new ImpSdXMLExpTransObj2DSkewX(fNew));
+}
+
+void SdXMLImExTransform2D::AddSkewY(double fNew)
+{
+ if(fNew != 0.0)
+ maList.push_back(new ImpSdXMLExpTransObj2DSkewY(fNew));
+}
+
+void SdXMLImExTransform2D::AddMatrix(const ::basegfx::B2DHomMatrix& rNew)
+{
+ if(!rNew.isIdentity())
+ maList.push_back(new ImpSdXMLExpTransObj2DMatrix(rNew));
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// gen string for export
+const OUString& SdXMLImExTransform2D::GetExportString(const SvXMLUnitConverter& rConv)
+{
+ OUString aNewString;
+ OUString aClosingBrace(sal_Unicode(')'));
+ OUString aEmptySpace(sal_Unicode(' '));
+
+ const sal_uInt32 nCount = maList.size();
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ ImpSdXMLExpTransObj2DBase* pObj = maList[a];
+ switch(pObj->mnType)
+ {
+ case IMP_SDXMLEXP_TRANSOBJ2D_ROTATE :
+ {
+ aNewString += OUString(RTL_CONSTASCII_USTRINGPARAM( "rotate (" ));
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj2DRotate*)pObj)->mfRotate);
+ aNewString += aClosingBrace;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ2D_SCALE :
+ {
+ aNewString += OUString(RTL_CONSTASCII_USTRINGPARAM( "scale (" ));
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj2DScale*)pObj)->maScale.getX());
+ aNewString += aEmptySpace;
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj2DScale*)pObj)->maScale.getY());
+ aNewString += aClosingBrace;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ2D_TRANSLATE :
+ {
+ aNewString += OUString(RTL_CONSTASCII_USTRINGPARAM( "translate (" ));
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj2DTranslate*)pObj)->maTranslate.getX(), true);
+ aNewString += aEmptySpace;
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj2DTranslate*)pObj)->maTranslate.getY(), true);
+ aNewString += aClosingBrace;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ2D_SKEWX :
+ {
+ aNewString += OUString(RTL_CONSTASCII_USTRINGPARAM( "skewX (" ));
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj2DSkewX*)pObj)->mfSkewX);
+ aNewString += aClosingBrace;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ2D_SKEWY :
+ {
+ aNewString += OUString(RTL_CONSTASCII_USTRINGPARAM( "skewY (" ));
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj2DSkewY*)pObj)->mfSkewY);
+ aNewString += aClosingBrace;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ2D_MATRIX :
+ {
+ aNewString += OUString(RTL_CONSTASCII_USTRINGPARAM( "matrix (" ));
+
+ // a
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj2DMatrix*)pObj)->maMatrix.get(0, 0));
+ aNewString += aEmptySpace;
+
+ // b
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj2DMatrix*)pObj)->maMatrix.get(1, 0));
+ aNewString += aEmptySpace;
+
+ // c
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj2DMatrix*)pObj)->maMatrix.get(0, 1));
+ aNewString += aEmptySpace;
+
+ // d
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj2DMatrix*)pObj)->maMatrix.get(1, 1));
+ aNewString += aEmptySpace;
+
+ // e
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj2DMatrix*)pObj)->maMatrix.get(0, 2), true);
+ aNewString += aEmptySpace;
+
+ // f
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj2DMatrix*)pObj)->maMatrix.get(1, 2), true);
+
+ aNewString += aClosingBrace;
+ break;
+ }
+ default :
+ {
+ OSL_FAIL("SdXMLImExTransform2D: impossible entry!");
+ break;
+ }
+ }
+
+ // if not the last entry, add one space to next tag
+ if(a + 1UL != maList.size())
+ {
+ aNewString += aEmptySpace;
+ }
+ }
+
+ // fill string form OUString
+ msString = aNewString;
+
+ return msString;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// for Import: constructor with string, parses it and generates entries
+SdXMLImExTransform2D::SdXMLImExTransform2D(const OUString& rNew, const SvXMLUnitConverter& rConv)
+{
+ SetString(rNew, rConv);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// sets new string, parses it and generates entries
+void SdXMLImExTransform2D::SetString(const OUString& rNew, const SvXMLUnitConverter& rConv)
+{
+ msString = rNew;
+ EmptyList();
+
+ if(msString.getLength())
+ {
+ const OUString aStr(msString.getStr(), (sal_uInt16)msString.getLength());
+ const sal_Int32 nLen(aStr.getLength());
+
+ const OUString aString_rotate(RTL_CONSTASCII_USTRINGPARAM( "rotate" ));
+ const OUString aString_scale(RTL_CONSTASCII_USTRINGPARAM( "scale" ));
+ const OUString aString_translate(RTL_CONSTASCII_USTRINGPARAM( "translate" ));
+ const OUString aString_skewX(RTL_CONSTASCII_USTRINGPARAM( "skewX" ));
+ const OUString aString_skewY(RTL_CONSTASCII_USTRINGPARAM( "skewY" ));
+ const OUString aString_matrix(RTL_CONSTASCII_USTRINGPARAM( "matrix" ));
+
+ sal_Int32 nPos(0);
+
+ while(nPos < nLen)
+ {
+ // skip spaces
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ // look for tag
+ if(nPos < nLen)
+ {
+ if(nPos == aStr.indexOf(aString_rotate, nPos))
+ {
+ double fValue(0.0);
+ nPos += 6;
+ Imp_SkipSpacesAndOpeningBraces(aStr, nPos, nLen);
+ fValue = Imp_GetDoubleChar(aStr, nPos, nLen, rConv, fValue);
+ if(fValue != 0.0)
+ maList.push_back(new ImpSdXMLExpTransObj2DRotate(fValue));
+
+ Imp_SkipSpacesAndClosingBraces(aStr, nPos, nLen);
+ }
+ else if(nPos == aStr.indexOf(aString_scale, nPos))
+ {
+ ::basegfx::B2DTuple aValue(1.0, 1.0);
+ nPos += 5;
+ Imp_SkipSpacesAndOpeningBraces(aStr, nPos, nLen);
+ aValue.setX(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.getX()));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+ aValue.setY(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.getY()));
+
+ if(aValue.getX() != 1.0 || aValue.getY() != 1.0)
+ maList.push_back(new ImpSdXMLExpTransObj2DScale(aValue));
+
+ Imp_SkipSpacesAndClosingBraces(aStr, nPos, nLen);
+ }
+ else if(nPos == aStr.indexOf(aString_translate, nPos))
+ {
+ ::basegfx::B2DTuple aValue;
+ nPos += 9;
+ Imp_SkipSpacesAndOpeningBraces(aStr, nPos, nLen);
+ aValue.setX(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.getX(), true));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+ aValue.setY(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.getY(), true));
+
+ if(!aValue.equalZero())
+ maList.push_back(new ImpSdXMLExpTransObj2DTranslate(aValue));
+
+ Imp_SkipSpacesAndClosingBraces(aStr, nPos, nLen);
+ }
+ else if(nPos == aStr.indexOf(aString_skewX, nPos))
+ {
+ double fValue(0.0);
+ nPos += 5;
+ Imp_SkipSpacesAndOpeningBraces(aStr, nPos, nLen);
+ fValue = Imp_GetDoubleChar(aStr, nPos, nLen, rConv, fValue);
+ if(fValue != 0.0)
+ maList.push_back(new ImpSdXMLExpTransObj2DSkewX(fValue));
+
+ Imp_SkipSpacesAndClosingBraces(aStr, nPos, nLen);
+ }
+ else if(nPos == aStr.indexOf(aString_skewY, nPos))
+ {
+ double fValue(0.0);
+ nPos += 5;
+ Imp_SkipSpacesAndOpeningBraces(aStr, nPos, nLen);
+ fValue = Imp_GetDoubleChar(aStr, nPos, nLen, rConv, fValue);
+ if(fValue != 0.0)
+ maList.push_back(new ImpSdXMLExpTransObj2DSkewY(fValue));
+
+ Imp_SkipSpacesAndClosingBraces(aStr, nPos, nLen);
+ }
+ else if(nPos == aStr.indexOf(aString_matrix, nPos))
+ {
+ ::basegfx::B2DHomMatrix aValue;
+
+ nPos += 6;
+ Imp_SkipSpacesAndOpeningBraces(aStr, nPos, nLen);
+
+ // a
+ aValue.set(0, 0, Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.get(0, 0)));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // b
+ aValue.set(1, 0, Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.get(1, 0)));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // c
+ aValue.set(0, 1, Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.get(0, 1)));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // d
+ aValue.set(1, 1, Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.get(1, 1)));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // e
+ aValue.set(0, 2, Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.get(0, 2), true));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // f
+ aValue.set(1, 2, Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.get(1, 2), true));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ if(!aValue.isIdentity())
+ maList.push_back(new ImpSdXMLExpTransObj2DMatrix(aValue));
+
+ Imp_SkipSpacesAndClosingBraces(aStr, nPos, nLen);
+ }
+ else
+ {
+ nPos++;
+ }
+ }
+ }
+ }
+}
+
+void SdXMLImExTransform2D::GetFullTransform(::basegfx::B2DHomMatrix& rFullTrans)
+{
+ rFullTrans.identity();
+
+ const sal_uInt32 nCount = maList.size();
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ ImpSdXMLExpTransObj2DBase* pObj = maList[a];
+ switch(pObj->mnType)
+ {
+ case IMP_SDXMLEXP_TRANSOBJ2D_ROTATE :
+ {
+ // #i78696#
+ // mfRotate is mathematically wrong oriented since we export/import the angle
+ // values mirrored. This error is fixed in the API, but not yet in the FileFormat.
+ // For the FileFormat there is a follow-up task (#i78698#) to fix this in the next
+ // ODF FileFormat version. For now - to emulate the old behaviour - it is necessary
+ // to mirror the value here
+ rFullTrans.rotate(((ImpSdXMLExpTransObj2DRotate*)pObj)->mfRotate * -1.0);
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ2D_SCALE :
+ {
+ const ::basegfx::B2DTuple& rScale = ((ImpSdXMLExpTransObj2DScale*)pObj)->maScale;
+ rFullTrans.scale(rScale.getX(), rScale.getY());
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ2D_TRANSLATE :
+ {
+ const ::basegfx::B2DTuple& rTranslate = ((ImpSdXMLExpTransObj2DTranslate*)pObj)->maTranslate;
+ rFullTrans.translate(rTranslate.getX(), rTranslate.getY());
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ2D_SKEWX :
+ {
+ rFullTrans.shearX(tan(((ImpSdXMLExpTransObj2DSkewX*)pObj)->mfSkewX));
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ2D_SKEWY :
+ {
+ rFullTrans.shearY(tan(((ImpSdXMLExpTransObj2DSkewY*)pObj)->mfSkewY));
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ2D_MATRIX :
+ {
+ rFullTrans *= ((ImpSdXMLExpTransObj2DMatrix*)pObj)->maMatrix;
+ break;
+ }
+ default :
+ {
+ OSL_FAIL("SdXMLImExTransform2D: impossible entry!");
+ break;
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+// base class of all 3D transform objects
+
+struct ImpSdXMLExpTransObj3DBase
+{
+ sal_uInt16 mnType;
+ ImpSdXMLExpTransObj3DBase(sal_uInt16 nType)
+ : mnType(nType) {}
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// possible object types for 3D
+
+#define IMP_SDXMLEXP_TRANSOBJ3D_ROTATE_X 0x0000
+#define IMP_SDXMLEXP_TRANSOBJ3D_ROTATE_Y 0x0001
+#define IMP_SDXMLEXP_TRANSOBJ3D_ROTATE_Z 0x0002
+#define IMP_SDXMLEXP_TRANSOBJ3D_SCALE 0x0003
+#define IMP_SDXMLEXP_TRANSOBJ3D_TRANSLATE 0x0004
+#define IMP_SDXMLEXP_TRANSOBJ3D_MATRIX 0x0005
+
+//////////////////////////////////////////////////////////////////////////////
+// classes of objects, different sizes
+
+struct ImpSdXMLExpTransObj3DRotateX : public ImpSdXMLExpTransObj3DBase
+{
+ double mfRotateX;
+ ImpSdXMLExpTransObj3DRotateX(double fVal)
+ : ImpSdXMLExpTransObj3DBase(IMP_SDXMLEXP_TRANSOBJ3D_ROTATE_X), mfRotateX(fVal) {}
+};
+struct ImpSdXMLExpTransObj3DRotateY : public ImpSdXMLExpTransObj3DBase
+{
+ double mfRotateY;
+ ImpSdXMLExpTransObj3DRotateY(double fVal)
+ : ImpSdXMLExpTransObj3DBase(IMP_SDXMLEXP_TRANSOBJ3D_ROTATE_Y), mfRotateY(fVal) {}
+};
+struct ImpSdXMLExpTransObj3DRotateZ : public ImpSdXMLExpTransObj3DBase
+{
+ double mfRotateZ;
+ ImpSdXMLExpTransObj3DRotateZ(double fVal)
+ : ImpSdXMLExpTransObj3DBase(IMP_SDXMLEXP_TRANSOBJ3D_ROTATE_Z), mfRotateZ(fVal) {}
+};
+struct ImpSdXMLExpTransObj3DScale : public ImpSdXMLExpTransObj3DBase
+{
+ ::basegfx::B3DTuple maScale;
+ ImpSdXMLExpTransObj3DScale(const ::basegfx::B3DTuple& rNew)
+ : ImpSdXMLExpTransObj3DBase(IMP_SDXMLEXP_TRANSOBJ3D_SCALE), maScale(rNew) {}
+};
+struct ImpSdXMLExpTransObj3DTranslate : public ImpSdXMLExpTransObj3DBase
+{
+ ::basegfx::B3DTuple maTranslate;
+ ImpSdXMLExpTransObj3DTranslate(const ::basegfx::B3DTuple& rNew)
+ : ImpSdXMLExpTransObj3DBase(IMP_SDXMLEXP_TRANSOBJ3D_TRANSLATE), maTranslate(rNew) {}
+};
+struct ImpSdXMLExpTransObj3DMatrix : public ImpSdXMLExpTransObj3DBase
+{
+ ::basegfx::B3DHomMatrix maMatrix;
+ ImpSdXMLExpTransObj3DMatrix(const ::basegfx::B3DHomMatrix& rNew)
+ : ImpSdXMLExpTransObj3DBase(IMP_SDXMLEXP_TRANSOBJ3D_MATRIX), maMatrix(rNew) {}
+};
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+// delete all entries in list
+
+void SdXMLImExTransform3D::EmptyList()
+{
+ const sal_uInt32 nCount = maList.size();
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ ImpSdXMLExpTransObj3DBase* pObj = maList[a];
+
+ switch(pObj->mnType)
+ {
+ case IMP_SDXMLEXP_TRANSOBJ3D_ROTATE_X :
+ {
+ delete (ImpSdXMLExpTransObj3DRotateX*)pObj;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ3D_ROTATE_Y :
+ {
+ delete (ImpSdXMLExpTransObj3DRotateY*)pObj;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ3D_ROTATE_Z :
+ {
+ delete (ImpSdXMLExpTransObj3DRotateZ*)pObj;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ3D_SCALE :
+ {
+ delete (ImpSdXMLExpTransObj3DScale*)pObj;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ3D_TRANSLATE :
+ {
+ delete (ImpSdXMLExpTransObj3DTranslate*)pObj;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ3D_MATRIX :
+ {
+ delete (ImpSdXMLExpTransObj3DMatrix*)pObj;
+ break;
+ }
+ default :
+ {
+ OSL_FAIL("SdXMLImExTransform3D: impossible entry!");
+ break;
+ }
+ }
+ }
+
+ maList.clear();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// add members
+
+void SdXMLImExTransform3D::AddRotateX(double fNew)
+{
+ if(fNew != 0.0)
+ maList.push_back(new ImpSdXMLExpTransObj3DRotateX(fNew));
+}
+
+void SdXMLImExTransform3D::AddRotateY(double fNew)
+{
+ if(fNew != 0.0)
+ maList.push_back(new ImpSdXMLExpTransObj3DRotateY(fNew));
+}
+
+void SdXMLImExTransform3D::AddRotateZ(double fNew)
+{
+ if(fNew != 0.0)
+ maList.push_back(new ImpSdXMLExpTransObj3DRotateZ(fNew));
+}
+
+void SdXMLImExTransform3D::AddScale(const ::basegfx::B3DTuple& rNew)
+{
+ if(1.0 != rNew.getX() || 1.0 != rNew.getY() || 1.0 != rNew.getZ())
+ maList.push_back(new ImpSdXMLExpTransObj3DScale(rNew));
+}
+
+void SdXMLImExTransform3D::AddTranslate(const ::basegfx::B3DTuple& rNew)
+{
+ if(!rNew.equalZero())
+ maList.push_back(new ImpSdXMLExpTransObj3DTranslate(rNew));
+}
+
+void SdXMLImExTransform3D::AddMatrix(const ::basegfx::B3DHomMatrix& rNew)
+{
+ if(!rNew.isIdentity())
+ maList.push_back(new ImpSdXMLExpTransObj3DMatrix(rNew));
+}
+
+void SdXMLImExTransform3D::AddHomogenMatrix(const drawing::HomogenMatrix& xHomMat)
+{
+ ::basegfx::B3DHomMatrix aExportMatrix;
+
+ aExportMatrix.set(0, 0, xHomMat.Line1.Column1);
+ aExportMatrix.set(0, 1, xHomMat.Line1.Column2);
+ aExportMatrix.set(0, 2, xHomMat.Line1.Column3);
+ aExportMatrix.set(0, 3, xHomMat.Line1.Column4);
+ aExportMatrix.set(1, 0, xHomMat.Line2.Column1);
+ aExportMatrix.set(1, 1, xHomMat.Line2.Column2);
+ aExportMatrix.set(1, 2, xHomMat.Line2.Column3);
+ aExportMatrix.set(1, 3, xHomMat.Line2.Column4);
+ aExportMatrix.set(2, 0, xHomMat.Line3.Column1);
+ aExportMatrix.set(2, 1, xHomMat.Line3.Column2);
+ aExportMatrix.set(2, 2, xHomMat.Line3.Column3);
+ aExportMatrix.set(2, 3, xHomMat.Line3.Column4);
+
+ AddMatrix(aExportMatrix);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// gen string for export
+const OUString& SdXMLImExTransform3D::GetExportString(const SvXMLUnitConverter& rConv)
+{
+ OUString aNewString;
+ OUString aClosingBrace(sal_Unicode(')'));
+ OUString aEmptySpace(sal_Unicode(' '));
+
+ const sal_uInt32 nCount = maList.size();
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ ImpSdXMLExpTransObj3DBase* pObj = maList[a];
+ switch(pObj->mnType)
+ {
+ case IMP_SDXMLEXP_TRANSOBJ3D_ROTATE_X :
+ {
+ aNewString += OUString(RTL_CONSTASCII_USTRINGPARAM( "rotatex (" ));
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DRotateX*)pObj)->mfRotateX);
+ aNewString += aClosingBrace;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ3D_ROTATE_Y :
+ {
+ aNewString += OUString(RTL_CONSTASCII_USTRINGPARAM( "rotatey (" ));
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DRotateY*)pObj)->mfRotateY);
+ aNewString += aClosingBrace;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ3D_ROTATE_Z :
+ {
+ aNewString += OUString(RTL_CONSTASCII_USTRINGPARAM( "rotatez (" ));
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DRotateZ*)pObj)->mfRotateZ);
+ aNewString += aClosingBrace;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ3D_SCALE :
+ {
+ aNewString += OUString(RTL_CONSTASCII_USTRINGPARAM( "scale (" ));
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DScale*)pObj)->maScale.getX());
+ aNewString += aEmptySpace;
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DScale*)pObj)->maScale.getY());
+ aNewString += aEmptySpace;
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DScale*)pObj)->maScale.getZ());
+ aNewString += aClosingBrace;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ3D_TRANSLATE :
+ {
+ aNewString += OUString(RTL_CONSTASCII_USTRINGPARAM( "translate (" ));
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DTranslate*)pObj)->maTranslate.getX(), true);
+ aNewString += aEmptySpace;
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DTranslate*)pObj)->maTranslate.getY(), true);
+ aNewString += aEmptySpace;
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DTranslate*)pObj)->maTranslate.getZ(), true);
+ aNewString += aClosingBrace;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ3D_MATRIX :
+ {
+ aNewString += OUString(RTL_CONSTASCII_USTRINGPARAM( "matrix (" ));
+
+ // a
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DMatrix*)pObj)->maMatrix.get(0, 0));
+ aNewString += aEmptySpace;
+
+ // b
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DMatrix*)pObj)->maMatrix.get(1, 0));
+ aNewString += aEmptySpace;
+
+ // c
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DMatrix*)pObj)->maMatrix.get(2, 0));
+ aNewString += aEmptySpace;
+
+ // d
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DMatrix*)pObj)->maMatrix.get(0, 1));
+ aNewString += aEmptySpace;
+
+ // e
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DMatrix*)pObj)->maMatrix.get(1, 1));
+ aNewString += aEmptySpace;
+
+ // f
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DMatrix*)pObj)->maMatrix.get(2, 1));
+ aNewString += aEmptySpace;
+
+ // g
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DMatrix*)pObj)->maMatrix.get(0, 2));
+ aNewString += aEmptySpace;
+
+ // h
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DMatrix*)pObj)->maMatrix.get(1, 2));
+ aNewString += aEmptySpace;
+
+ // i
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DMatrix*)pObj)->maMatrix.get(2, 2));
+ aNewString += aEmptySpace;
+
+ // j
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DMatrix*)pObj)->maMatrix.get(0, 3), true);
+ aNewString += aEmptySpace;
+
+ // k
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DMatrix*)pObj)->maMatrix.get(1, 3), true);
+ aNewString += aEmptySpace;
+
+ // l
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DMatrix*)pObj)->maMatrix.get(2, 3), true);
+
+ aNewString += aClosingBrace;
+ break;
+ }
+ default :
+ {
+ OSL_FAIL("SdXMLImExTransform3D: impossible entry!");
+ break;
+ }
+ }
+
+ // if not the last entry, add one space to next tag
+ if(a + 1UL != maList.size())
+ {
+ aNewString += aEmptySpace;
+ }
+ }
+
+ // fill string form OUString
+ msString = aNewString;
+
+ return msString;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// for Import: constructor with string, parses it and generates entries
+SdXMLImExTransform3D::SdXMLImExTransform3D(const OUString& rNew, const SvXMLUnitConverter& rConv)
+{
+ SetString(rNew, rConv);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// sets new string, parses it and generates entries
+void SdXMLImExTransform3D::SetString(const OUString& rNew, const SvXMLUnitConverter& rConv)
+{
+ msString = rNew;
+ EmptyList();
+
+ if(msString.getLength())
+ {
+ const OUString aStr(msString.getStr(), (sal_uInt16)msString.getLength());
+ const sal_Int32 nLen(aStr.getLength());
+
+ const OUString aString_rotatex(RTL_CONSTASCII_USTRINGPARAM( "rotatex" ));
+ const OUString aString_rotatey(RTL_CONSTASCII_USTRINGPARAM( "rotatey" ));
+ const OUString aString_rotatez(RTL_CONSTASCII_USTRINGPARAM( "rotatez" ));
+ const OUString aString_scale(RTL_CONSTASCII_USTRINGPARAM( "scale" ));
+ const OUString aString_translate(RTL_CONSTASCII_USTRINGPARAM( "translate" ));
+ const OUString aString_matrix(RTL_CONSTASCII_USTRINGPARAM( "matrix" ));
+
+ sal_Int32 nPos(0);
+
+ while(nPos < nLen)
+ {
+ // skip spaces
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ // look for tag
+ if(nPos < nLen)
+ {
+ if(nPos == aStr.indexOf(aString_rotatex, nPos))
+ {
+ double fValue(0.0);
+
+ nPos += 7;
+ Imp_SkipSpacesAndOpeningBraces(aStr, nPos, nLen);
+ fValue = Imp_GetDoubleChar(aStr, nPos, nLen, rConv, fValue);
+ if(fValue != 0.0)
+ maList.push_back(new ImpSdXMLExpTransObj3DRotateX(fValue));
+
+ Imp_SkipSpacesAndClosingBraces(aStr, nPos, nLen);
+ }
+ else if(nPos == aStr.indexOf(aString_rotatey, nPos))
+ {
+ double fValue(0.0);
+
+ nPos += 7;
+ Imp_SkipSpacesAndOpeningBraces(aStr, nPos, nLen);
+ fValue = Imp_GetDoubleChar(aStr, nPos, nLen, rConv, fValue);
+ if(fValue != 0.0)
+ maList.push_back(new ImpSdXMLExpTransObj3DRotateY(fValue));
+
+ Imp_SkipSpacesAndClosingBraces(aStr, nPos, nLen);
+ }
+ else if(nPos == aStr.indexOf(aString_rotatez, nPos))
+ {
+ double fValue(0.0);
+
+ nPos += 7;
+ Imp_SkipSpacesAndOpeningBraces(aStr, nPos, nLen);
+ fValue = Imp_GetDoubleChar(aStr, nPos, nLen, rConv, fValue);
+ if(fValue != 0.0)
+ maList.push_back(new ImpSdXMLExpTransObj3DRotateZ(fValue));
+
+ Imp_SkipSpacesAndClosingBraces(aStr, nPos, nLen);
+ }
+ else if(nPos == aStr.indexOf(aString_scale, nPos))
+ {
+ ::basegfx::B3DTuple aValue(1.0, 1.0, 1.0);
+
+ nPos += 5;
+ Imp_SkipSpacesAndOpeningBraces(aStr, nPos, nLen);
+ aValue.setX(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.getX()));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+ aValue.setY(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.getY()));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+ aValue.setZ(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.getZ()));
+
+ if(1.0 != aValue.getX() || 1.0 != aValue.getY() || 1.0 != aValue.getZ())
+ maList.push_back(new ImpSdXMLExpTransObj3DScale(aValue));
+
+ Imp_SkipSpacesAndClosingBraces(aStr, nPos, nLen);
+ }
+ else if(nPos == aStr.indexOf(aString_translate, nPos))
+ {
+ ::basegfx::B3DTuple aValue;
+
+ nPos += 9;
+ Imp_SkipSpacesAndOpeningBraces(aStr, nPos, nLen);
+ aValue.setX(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.getX(), true));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+ aValue.setY(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.getY(), true));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+ aValue.setZ(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.getZ(), true));
+
+ if(!aValue.equalZero())
+ maList.push_back(new ImpSdXMLExpTransObj3DTranslate(aValue));
+
+ Imp_SkipSpacesAndClosingBraces(aStr, nPos, nLen);
+ }
+ else if(nPos == aStr.indexOf(aString_matrix, nPos))
+ {
+ ::basegfx::B3DHomMatrix aValue;
+
+ nPos += 6;
+ Imp_SkipSpacesAndOpeningBraces(aStr, nPos, nLen);
+
+ // a
+ aValue.set(0, 0, Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.get(0, 0)));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // b
+ aValue.set(1, 0, Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.get(1, 0)));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // c
+ aValue.set(2, 0, Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.get(2, 0)));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // d
+ aValue.set(0, 1, Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.get(0, 1)));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // e
+ aValue.set(1, 1, Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.get(1, 1)));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // f
+ aValue.set(2, 1, Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.get(2, 1)));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // g
+ aValue.set(0, 2, Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.get(0, 2)));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // h
+ aValue.set(1, 2, Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.get(1, 2)));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // i
+ aValue.set(2, 2, Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.get(2, 2)));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // j
+ aValue.set(0, 3, Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.get(0, 3), true));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // k
+ aValue.set(1, 3, Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.get(1, 3), true));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // l
+ aValue.set(2, 3, Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.get(2, 3), true));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ if(!aValue.isIdentity())
+ maList.push_back(new ImpSdXMLExpTransObj3DMatrix(aValue));
+
+ Imp_SkipSpacesAndClosingBraces(aStr, nPos, nLen);
+ }
+ else
+ {
+ nPos++;
+ }
+ }
+ }
+ }
+}
+
+bool SdXMLImExTransform3D::GetFullHomogenTransform(com::sun::star::drawing::HomogenMatrix& xHomMat)
+{
+ ::basegfx::B3DHomMatrix aFullTransform;
+ GetFullTransform(aFullTransform);
+
+ if(!aFullTransform.isIdentity())
+ {
+ xHomMat.Line1.Column1 = aFullTransform.get(0, 0);
+ xHomMat.Line1.Column2 = aFullTransform.get(0, 1);
+ xHomMat.Line1.Column3 = aFullTransform.get(0, 2);
+ xHomMat.Line1.Column4 = aFullTransform.get(0, 3);
+
+ xHomMat.Line2.Column1 = aFullTransform.get(1, 0);
+ xHomMat.Line2.Column2 = aFullTransform.get(1, 1);
+ xHomMat.Line2.Column3 = aFullTransform.get(1, 2);
+ xHomMat.Line2.Column4 = aFullTransform.get(1, 3);
+
+ xHomMat.Line3.Column1 = aFullTransform.get(2, 0);
+ xHomMat.Line3.Column2 = aFullTransform.get(2, 1);
+ xHomMat.Line3.Column3 = aFullTransform.get(2, 2);
+ xHomMat.Line3.Column4 = aFullTransform.get(2, 3);
+
+ xHomMat.Line4.Column1 = aFullTransform.get(3, 0);
+ xHomMat.Line4.Column2 = aFullTransform.get(3, 1);
+ xHomMat.Line4.Column3 = aFullTransform.get(3, 2);
+ xHomMat.Line4.Column4 = aFullTransform.get(3, 3);
+
+ return true;
+ }
+
+ return false;
+}
+
+void SdXMLImExTransform3D::GetFullTransform(::basegfx::B3DHomMatrix& rFullTrans)
+{
+ rFullTrans.identity();
+
+ const sal_uInt32 nCount = maList.size();
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ ImpSdXMLExpTransObj3DBase* pObj = maList[a];
+ switch(pObj->mnType)
+ {
+ case IMP_SDXMLEXP_TRANSOBJ3D_ROTATE_X :
+ {
+ rFullTrans.rotate(((ImpSdXMLExpTransObj3DRotateX*)pObj)->mfRotateX, 0.0, 0.0);
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ3D_ROTATE_Y :
+ {
+ rFullTrans.rotate(0.0, ((ImpSdXMLExpTransObj3DRotateY*)pObj)->mfRotateY, 0.0);
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ3D_ROTATE_Z :
+ {
+ rFullTrans.rotate(0.0, 0.0, ((ImpSdXMLExpTransObj3DRotateZ*)pObj)->mfRotateZ);
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ3D_SCALE :
+ {
+ const ::basegfx::B3DTuple& rScale = ((ImpSdXMLExpTransObj3DScale*)pObj)->maScale;
+ rFullTrans.scale(rScale.getX(), rScale.getY(), rScale.getZ());
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ3D_TRANSLATE :
+ {
+ const ::basegfx::B3DTuple& rTranslate = ((ImpSdXMLExpTransObj3DTranslate*)pObj)->maTranslate;
+ rFullTrans.translate(rTranslate.getX(), rTranslate.getY(), rTranslate.getZ());
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ3D_MATRIX :
+ {
+ rFullTrans *= ((ImpSdXMLExpTransObj3DMatrix*)pObj)->maMatrix;
+ break;
+ }
+ default :
+ {
+ OSL_FAIL("SdXMLImExTransform3D: impossible entry!");
+ break;
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLImExViewBox::SdXMLImExViewBox(sal_Int32 nX, sal_Int32 nY, sal_Int32 nW, sal_Int32 nH)
+: mnX( nX ),
+ mnY( nY ),
+ mnW( nW ),
+ mnH( nH )
+{
+}
+
+// #100617# Asked vincent hardy: svg:viewBox values may be double precision.
+SdXMLImExViewBox::SdXMLImExViewBox(const OUString& rNew, const SvXMLUnitConverter& rConv)
+: msString(rNew),
+ mnX( 0L ),
+ mnY( 0L ),
+ mnW( 1000L ),
+ mnH( 1000L )
+{
+ if(msString.getLength())
+ {
+ const OUString aStr(msString.getStr(), (sal_uInt16)msString.getLength());
+ const sal_Int32 nLen(aStr.getLength());
+ sal_Int32 nPos(0);
+
+ // skip starting spaces
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ // get mX, #100617# be prepared for doubles
+ mnX = FRound(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, (double)mnX));
+
+ // skip spaces and commas
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // get mY, #100617# be prepared for doubles
+ mnY = FRound(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, (double)mnY));
+
+ // skip spaces and commas
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // get mW, #100617# be prepared for doubles
+ mnW = FRound(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, (double)mnW));
+
+ // skip spaces and commas
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // get mH, #100617# be prepared for doubles
+ mnH = FRound(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, (double)mnH));
+ }
+}
+
+const OUString& SdXMLImExViewBox::GetExportString()
+{
+ OUString aNewString;
+ OUString aEmptySpace(sal_Unicode(' '));
+
+ Imp_PutNumberChar(aNewString, mnX);
+ aNewString += aEmptySpace;
+
+ Imp_PutNumberChar(aNewString, mnY);
+ aNewString += aEmptySpace;
+
+ Imp_PutNumberChar(aNewString, mnW);
+ aNewString += aEmptySpace;
+
+ Imp_PutNumberChar(aNewString, mnH);
+
+ // set new string
+ msString = aNewString;
+
+ return msString;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLImExPointsElement::SdXMLImExPointsElement(drawing::PointSequence* pPoints,
+ const SdXMLImExViewBox& rViewBox,
+ const awt::Point& rObjectPos,
+ const awt::Size& rObjectSize,
+ // #96328#
+ const bool bClosed)
+: maPoly( 0L )
+{
+ DBG_ASSERT(pPoints, "Empty PointSequence handed over to SdXMLImExPointsElement(!)");
+
+ // add polygon to string
+ sal_Int32 nCnt(pPoints->getLength());
+
+ // #104076# Convert to string only when at last one point included
+ if(nCnt > 0)
+ {
+ OUString aNewString;
+ awt::Point* pArray = pPoints->getArray();
+
+ // last point same? Ignore it.
+ // #96328# ...but only when polygon is CLOSED
+ if(bClosed && (pArray->X == (pArray + (nCnt - 1))->X) && (pArray->Y == (pArray + (nCnt - 1))->Y))
+ nCnt--;
+
+ // object size and ViewBox size different?
+ bool bScale(rObjectSize.Width != rViewBox.GetWidth()
+ || rObjectSize.Height != rViewBox.GetHeight());
+ bool bTranslate(rViewBox.GetX() != 0L || rViewBox.GetY() != 0L);
+
+ for(sal_Int32 a(0L); a < nCnt; a++)
+ {
+ // prepare coordinates
+ sal_Int32 nX( pArray->X - rObjectPos.X );
+ sal_Int32 nY( pArray->Y - rObjectPos.Y );
+
+ if(bScale && rObjectSize.Width && rObjectSize.Height)
+ {
+ nX = (nX * rViewBox.GetWidth()) / rObjectSize.Width;
+ nY = (nY * rViewBox.GetHeight()) / rObjectSize.Height;
+ }
+
+ if(bTranslate)
+ {
+ nX += rViewBox.GetX();
+ nY += rViewBox.GetY();
+ }
+
+ // X and comma
+ Imp_PutNumberChar(aNewString, nX);
+ aNewString += String(sal_Unicode(','));
+
+ // Y and space (not for last)
+ Imp_PutNumberChar(aNewString, nY);
+ if(a + 1 != nCnt)
+ aNewString += String(sal_Unicode(' '));
+
+ // next point
+ pArray++;
+ }
+
+ // set new string
+ msString = aNewString;
+ }
+}
+
+// #100617# svg:polyline or svg:polygon values may be double precision.
+SdXMLImExPointsElement::SdXMLImExPointsElement(const OUString& rNew,
+ const SdXMLImExViewBox& rViewBox,
+ const awt::Point& rObjectPos,
+ const awt::Size& rObjectSize,
+ const SvXMLUnitConverter& rConv)
+: msString( rNew ),
+ maPoly( 0L )
+{
+ // convert string to polygon
+ const OUString aStr(msString.getStr(), (sal_uInt16)msString.getLength());
+ const sal_Int32 nLen(aStr.getLength());
+ sal_Int32 nPos(0);
+ sal_Int32 nNumPoints(0L);
+
+ // skip starting spaces
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ // count points in first loop
+ while(nPos < nLen)
+ {
+ // skip number, #100617# be prepared for doubles
+ Imp_SkipDouble(aStr, nPos, nLen);
+
+ // skip spaces and commas
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // skip number, #100617# be prepared for doubles
+ Imp_SkipDouble(aStr, nPos, nLen);
+
+ // skip spaces and commas
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // one more point
+ nNumPoints++;
+ }
+
+ // second loop
+ if(nNumPoints)
+ {
+ nPos = 0;
+ maPoly.realloc(1);
+ drawing::PointSequence* pOuterSequence = maPoly.getArray();
+ pOuterSequence->realloc(nNumPoints);
+ awt::Point* pInnerSequence = pOuterSequence->getArray();
+
+ // object size and ViewBox size different?
+ bool bScale(rObjectSize.Width != rViewBox.GetWidth()
+ || rObjectSize.Height != rViewBox.GetHeight());
+ bool bTranslate(rViewBox.GetX() != 0L || rViewBox.GetY() != 0L);
+
+ // skip starting spaces
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ while(nPos < nLen)
+ {
+ // prepare new parameter pair
+ sal_Int32 nX(0L);
+ sal_Int32 nY(0L);
+
+ // get mX, #100617# be prepared for doubles
+ nX = FRound(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, (double)nX));
+
+ // skip spaces and commas
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // get mY, #100617# be prepared for doubles
+ nY = FRound(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, (double)nY));
+
+ // skip spaces and commas
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // prepare parameters
+ if(bTranslate)
+ {
+ nX -= rViewBox.GetX();
+ nY -= rViewBox.GetY();
+ }
+
+ if(bScale && rViewBox.GetWidth() && rViewBox.GetHeight() )
+ {
+ nX = (nX * rObjectSize.Width) / rViewBox.GetWidth();
+ nY = (nY * rObjectSize.Height) / rViewBox.GetHeight();
+ }
+
+ nX += rObjectPos.X;
+ nY += rObjectPos.Y;
+
+ // add new point
+ *pInnerSequence = awt::Point( nX, nY );
+ pInnerSequence++;
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLImExSvgDElement::SdXMLImExSvgDElement(const SdXMLImExViewBox& rViewBox)
+: mrViewBox( rViewBox ),
+ mbIsClosed( false ),
+ mbIsCurve( false ),
+ mnLastX( 0L ),
+ mnLastY( 0L ),
+ maPoly( 0L ),
+ maFlag( 0L )
+{
+}
+
+void Imp_GetPrevPos(awt::Point*& pPrevPos1,
+ drawing::PolygonFlags& aPrevFlag1,
+ const bool bClosed, awt::Point* pPoints,
+ drawing::PolygonFlags* pFlags, const sal_Int32 nPos,
+ const sal_Int32 nCnt, const sal_Int32 nAdd)
+{
+ if(bClosed)
+ {
+ pPrevPos1 = pPoints + ((nPos + nCnt - nAdd) % nCnt);
+ aPrevFlag1 = *(pFlags + ((nPos + nCnt - nAdd) % nCnt));
+ }
+ else if(nPos > (nAdd - 1))
+ {
+ pPrevPos1 = pPoints + (nPos - nAdd);
+ aPrevFlag1 = *(pFlags + (nPos - nAdd));
+ }
+ else
+ pPrevPos1 = 0L;
+}
+
+void Imp_PrepareCoorExport(sal_Int32& nX, sal_Int32& nY,
+ const awt::Point* pPointArray, const awt::Point& rObjectPos,
+ const awt::Size& rObjectSize, const SdXMLImExViewBox& mrViewBox,
+ const bool bScale, const bool bTranslate)
+{
+ nX = pPointArray->X - rObjectPos.X;
+ nY = pPointArray->Y - rObjectPos.Y;
+
+ if(bScale && rObjectSize.Width && rObjectSize.Height )
+ {
+ nX = (nX * mrViewBox.GetWidth()) / rObjectSize.Width;
+ nY = (nY * mrViewBox.GetHeight()) / rObjectSize.Height;
+ }
+
+ if(bTranslate)
+ {
+ nX += mrViewBox.GetX();
+ nY += mrViewBox.GetY();
+ }
+}
+
+//#define TEST_QUADRATIC_CURVES
+#ifdef TEST_QUADRATIC_CURVES
+// To be able to test quadratic curve code: The code concerning to
+// bDoTestHere can be used (see below). Construct shapes which have their control
+// points on equal coordinates. When these are written, they can be
+// forced to create correct 'Q' and 'T' statements using this flag.
+// These may then be tested for import/exporting.
+static bool bDoTestHere(true);
+#endif // TEST_QUADRATIC_CURVES
+
+void SdXMLImExSvgDElement::AddPolygon(
+ drawing::PointSequence* pPoints,
+ drawing::FlagSequence* pFlags,
+ const awt::Point& rObjectPos,
+ const awt::Size& rObjectSize,
+ bool bClosed, bool bRelative)
+{
+ DBG_ASSERT(pPoints, "Empty PointSequence handed over to SdXMLImExSvgDElement(!)");
+
+ sal_Int32 nCnt(pPoints->getLength());
+
+ // #104076# Convert to string only when at last one point included
+ if(nCnt > 0)
+ {
+ // append polygon to string
+ OUString aNewString;
+ sal_Unicode aLastCommand = ' ';
+ awt::Point* pPointArray = pPoints->getArray();
+
+ // are the flags used at all? If not forget about them
+ if(pFlags)
+ {
+ sal_Int32 nFlagCnt(pFlags->getLength());
+
+ if(nFlagCnt)
+ {
+ bool bFlagsUsed(false);
+ drawing::PolygonFlags* pFlagArray = pFlags->getArray();
+
+ for(sal_Int32 a(0); !bFlagsUsed && a < nFlagCnt; a++)
+ if(drawing::PolygonFlags_NORMAL != *pFlagArray++)
+ bFlagsUsed = true;
+
+ if(!bFlagsUsed)
+ pFlags = 0L;
+ }
+ else
+ {
+ pFlags = 0L;
+ }
+ }
+
+ // object size and ViewBox size different?
+ bool bScale(rObjectSize.Width != mrViewBox.GetWidth()
+ || rObjectSize.Height != mrViewBox.GetHeight());
+ bool bTranslate(mrViewBox.GetX() != 0L || mrViewBox.GetY() != 0L);
+
+ // #87202# rework of point reduction:
+ // Test for Last point same -> closed, ignore last point. Take
+ // some more circumstances in account when looking at curve segments.
+ drawing::PolygonFlags* pFlagArray = (pFlags) ? pFlags->getArray() : 0L;
+ if((pPointArray->X == (pPointArray + (nCnt - 1))->X) && (pPointArray->Y == (pPointArray + (nCnt - 1))->Y))
+ {
+ if(pFlags)
+ {
+ // point needs to be ignored if point before it is
+ // NO control point. Else the last point is needed
+ // for exporting the last segment of the curve. That means
+ // that the last and the first point will be saved double,
+ // but SVG does not support a better solution here.
+ if(nCnt >= 2 && drawing::PolygonFlags_CONTROL != *(pFlagArray + (nCnt - 2)))
+ {
+ nCnt--;
+ }
+ }
+ else
+ {
+ // no curve, ignore last point
+ nCnt--;
+ }
+ }
+
+ // bezier poly, handle curves
+ bool bDidWriteStart(false);
+
+ for(sal_Int32 a(0L); a < nCnt; a++)
+ {
+ if(!pFlags || drawing::PolygonFlags_CONTROL != *pFlagArray)
+ {
+ bool bDidWriteAsCurve(false);
+
+ if(bDidWriteStart)
+ {
+ if(pFlags)
+ {
+ // real curve point, get previous to see if it's a control point
+ awt::Point* pPrevPos1;
+ drawing::PolygonFlags aPrevFlag1;
+
+ Imp_GetPrevPos(pPrevPos1, aPrevFlag1, bClosed, pPoints->getArray(),
+ pFlags->getArray(), a, nCnt, 1);
+
+ if(pPrevPos1 && drawing::PolygonFlags_CONTROL == aPrevFlag1)
+ {
+ // get previous2 to see if it's a control point, too
+ awt::Point* pPrevPos2;
+ drawing::PolygonFlags aPrevFlag2;
+
+ Imp_GetPrevPos(pPrevPos2, aPrevFlag2, bClosed, pPoints->getArray(),
+ pFlags->getArray(), a, nCnt, 2);
+
+ if(pPrevPos2 && drawing::PolygonFlags_CONTROL == aPrevFlag2)
+ {
+ // get previous3 to see if it's a curve point and if,
+ // if it is fully symmetric or not
+ awt::Point* pPrevPos3;
+ drawing::PolygonFlags aPrevFlag3;
+
+ Imp_GetPrevPos(pPrevPos3, aPrevFlag3, bClosed, pPoints->getArray(),
+ pFlags->getArray(), a, nCnt, 3);
+
+ if(pPrevPos3)
+ {
+ // prepare coordinates
+ sal_Int32 nX, nY;
+
+ Imp_PrepareCoorExport(nX, nY, pPointArray, rObjectPos, rObjectSize,
+ mrViewBox, bScale, bTranslate);
+
+ // #100617# test if this curve segment may be written as
+ // a quadratic bezier
+ // That's the case if both control points are in the same place
+ // when they are prolonged to the common quadratic control point
+ // Left: P = (3P1 - P0) / 2
+ // Right: P = (3P2 - P3) / 2
+ bool bIsQuadratic(false);
+ const bool bEnableSaveQuadratic(false);
+
+ sal_Int32 nPX_L(FRound((double)((3 * pPrevPos2->X) - pPrevPos3->X) / 2.0));
+ sal_Int32 nPY_L(FRound((double)((3 * pPrevPos2->Y) - pPrevPos3->Y) / 2.0));
+ sal_Int32 nPX_R(FRound((double)((3 * pPrevPos1->X) - pPointArray->X) / 2.0));
+ sal_Int32 nPY_R(FRound((double)((3 * pPrevPos1->Y) - pPointArray->Y) / 2.0));
+ sal_Int32 nDist(0);
+
+ if(nPX_L != nPX_R)
+ {
+ nDist += abs(nPX_L - nPX_R);
+ }
+
+ if(nPY_L != nPY_R)
+ {
+ nDist += abs(nPY_L - nPY_R);
+ }
+
+ if(nDist <= BORDER_INTEGERS_ARE_EQUAL)
+ {
+ if(bEnableSaveQuadratic)
+ {
+ bIsQuadratic = true;
+ }
+ }
+
+#ifdef TEST_QUADRATIC_CURVES
+ if(bDoTestHere)
+ {
+ bIsQuadratic = false;
+
+ if(pPrevPos1->X == pPrevPos2->X && pPrevPos1->Y == pPrevPos2->Y)
+ bIsQuadratic = true;
+ }
+#endif // TEST_QUADRATIC_CURVES
+
+ if(bIsQuadratic)
+ {
+#ifdef TEST_QUADRATIC_CURVES
+ if(bDoTestHere)
+ {
+ bool bPrevPointIsSymmetric(false);
+
+ if(drawing::PolygonFlags_SYMMETRIC == aPrevFlag3)
+ {
+ // get previous4 to see if it's a control point
+ awt::Point* pPrevPos4;
+ drawing::PolygonFlags aPrevFlag4;
+
+ Imp_GetPrevPos(pPrevPos4, aPrevFlag4, bClosed, pPoints->getArray(),
+ pFlags->getArray(), a, nCnt, 4);
+
+ if(drawing::PolygonFlags_CONTROL == aPrevFlag4)
+ {
+ // okay, prevPos3 is symmetric (c2) and prevPos4
+ // is existing control point, the 's' statement can be used
+ bPrevPointIsSymmetric = true;
+ }
+ }
+
+ if(bPrevPointIsSymmetric)
+ {
+ // write a shorthand/smooth quadratic curveto entry (T)
+ if(bRelative)
+ {
+ if(aLastCommand != sal_Unicode('t'))
+ aNewString += OUString(sal_Unicode('t'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nX - mnLastX);
+ Imp_PutNumberCharWithSpace(aNewString, nY - mnLastY);
+
+ aLastCommand = sal_Unicode('t');
+ }
+ else
+ {
+ if(aLastCommand != sal_Unicode('T'))
+ aNewString += OUString(sal_Unicode('T'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nX);
+ Imp_PutNumberCharWithSpace(aNewString, nY);
+
+ aLastCommand = sal_Unicode('T');
+ }
+ }
+ else
+ {
+ // prepare coordinates
+ sal_Int32 nX1, nY1;
+
+ Imp_PrepareCoorExport(nX1, nY1, pPrevPos1, rObjectPos, rObjectSize,
+ mrViewBox, bScale, bTranslate);
+
+ // write a quadratic curveto entry (Q)
+ if(bRelative)
+ {
+ if(aLastCommand != sal_Unicode('q'))
+ aNewString += OUString(sal_Unicode('q'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nX1 - mnLastX);
+ Imp_PutNumberCharWithSpace(aNewString, nY1 - mnLastY);
+ Imp_PutNumberCharWithSpace(aNewString, nX - mnLastX);
+ Imp_PutNumberCharWithSpace(aNewString, nY - mnLastY);
+
+ aLastCommand = sal_Unicode('q');
+ }
+ else
+ {
+ if(aLastCommand != sal_Unicode('Q'))
+ aNewString += OUString(sal_Unicode('Q'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nX1);
+ Imp_PutNumberCharWithSpace(aNewString, nY1);
+ Imp_PutNumberCharWithSpace(aNewString, nX);
+ Imp_PutNumberCharWithSpace(aNewString, nY);
+
+ aLastCommand = sal_Unicode('Q');
+ }
+ }
+ }
+ else
+ {
+#endif // TEST_QUADRATIC_CURVES
+ awt::Point aNewPoint(nPX_L, nPY_L);
+ bool bPrevPointIsSmooth(false);
+
+ if(drawing::PolygonFlags_SMOOTH == aPrevFlag3)
+ {
+ // get previous4 to see if it's a control point
+ awt::Point* pPrevPos4;
+ drawing::PolygonFlags aPrevFlag4;
+
+ Imp_GetPrevPos(pPrevPos4, aPrevFlag4, bClosed, pPoints->getArray(),
+ pFlags->getArray(), a, nCnt, 4);
+
+ if(drawing::PolygonFlags_CONTROL == aPrevFlag4)
+ {
+ // okay, prevPos3 is smooth (c1) and prevPos4
+ // is existing control point. Test if it's even symmetric
+ // and thus the 'T' statement may be used.
+ ::basegfx::B2DVector aVec1(pPrevPos4->X - pPrevPos3->X, pPrevPos4->Y - pPrevPos3->Y);
+ ::basegfx::B2DVector aVec2(aNewPoint.X - pPrevPos3->X, aNewPoint.Y - pPrevPos3->Y);
+ bool bSameLength(false);
+ bool bSameDirection(false);
+
+ // get vector values
+ Imp_CalcVectorValues(aVec1, aVec2, bSameLength, bSameDirection);
+
+ if(bSameLength && bSameDirection)
+ bPrevPointIsSmooth = true;
+ }
+ }
+
+ if(bPrevPointIsSmooth)
+ {
+ // write a shorthand/smooth quadratic curveto entry (T)
+ if(bRelative)
+ {
+ if(aLastCommand != sal_Unicode('t'))
+ aNewString += String(sal_Unicode('t'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nX - mnLastX);
+ Imp_PutNumberCharWithSpace(aNewString, nY - mnLastY);
+
+ aLastCommand = sal_Unicode('t');
+ }
+ else
+ {
+ if(aLastCommand != sal_Unicode('T'))
+ aNewString += String(sal_Unicode('T'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nX);
+ Imp_PutNumberCharWithSpace(aNewString, nY);
+
+ aLastCommand = sal_Unicode('T');
+ }
+ }
+ else
+ {
+ // prepare coordinates
+ sal_Int32 nX1, nY1;
+
+ Imp_PrepareCoorExport(nX1, nY1, &aNewPoint, rObjectPos, rObjectSize,
+ mrViewBox, bScale, bTranslate);
+
+ // write a quadratic curveto entry (Q)
+ if(bRelative)
+ {
+ if(aLastCommand != sal_Unicode('q'))
+ aNewString += String(sal_Unicode('q'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nX1 - mnLastX);
+ Imp_PutNumberCharWithSpace(aNewString, nY1 - mnLastY);
+ Imp_PutNumberCharWithSpace(aNewString, nX - mnLastX);
+ Imp_PutNumberCharWithSpace(aNewString, nY - mnLastY);
+
+ aLastCommand = sal_Unicode('q');
+ }
+ else
+ {
+ if(aLastCommand != sal_Unicode('Q'))
+ aNewString += String(sal_Unicode('Q'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nX1);
+ Imp_PutNumberCharWithSpace(aNewString, nY1);
+ Imp_PutNumberCharWithSpace(aNewString, nX);
+ Imp_PutNumberCharWithSpace(aNewString, nY);
+
+ aLastCommand = sal_Unicode('Q');
+ }
+ }
+#ifdef TEST_QUADRATIC_CURVES
+ }
+#endif // TEST_QUADRATIC_CURVES
+ }
+ else
+ {
+ bool bPrevPointIsSymmetric(false);
+
+ if(drawing::PolygonFlags_SYMMETRIC == aPrevFlag3)
+ {
+ // get previous4 to see if it's a control point
+ awt::Point* pPrevPos4;
+ drawing::PolygonFlags aPrevFlag4;
+
+ Imp_GetPrevPos(pPrevPos4, aPrevFlag4, bClosed, pPoints->getArray(),
+ pFlags->getArray(), a, nCnt, 4);
+
+ if(drawing::PolygonFlags_CONTROL == aPrevFlag4)
+ {
+ // okay, prevPos3 is symmetric (c2) and prevPos4
+ // is existing control point, the 's' statement can be used
+ bPrevPointIsSymmetric = true;
+ }
+ }
+
+ // prepare coordinates
+ sal_Int32 nX2, nY2;
+
+ Imp_PrepareCoorExport(nX2, nY2, pPrevPos1, rObjectPos, rObjectSize,
+ mrViewBox, bScale, bTranslate);
+
+ if(bPrevPointIsSymmetric)
+ {
+ // write a shorthand/smooth curveto entry (S)
+ if(bRelative)
+ {
+ if(aLastCommand != sal_Unicode('s'))
+ aNewString += String(sal_Unicode('s'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nX2 - mnLastX);
+ Imp_PutNumberCharWithSpace(aNewString, nY2 - mnLastY);
+ Imp_PutNumberCharWithSpace(aNewString, nX - mnLastX);
+ Imp_PutNumberCharWithSpace(aNewString, nY - mnLastY);
+
+ aLastCommand = sal_Unicode('s');
+ }
+ else
+ {
+ if(aLastCommand != sal_Unicode('S'))
+ aNewString += String(sal_Unicode('S'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nX2);
+ Imp_PutNumberCharWithSpace(aNewString, nY2);
+ Imp_PutNumberCharWithSpace(aNewString, nX);
+ Imp_PutNumberCharWithSpace(aNewString, nY);
+
+ aLastCommand = sal_Unicode('S');
+ }
+ }
+ else
+ {
+ // prepare coordinates
+ sal_Int32 nX1, nY1;
+
+ Imp_PrepareCoorExport(nX1, nY1, pPrevPos2, rObjectPos, rObjectSize,
+ mrViewBox, bScale, bTranslate);
+
+ // write a curveto entry (C)
+ if(bRelative)
+ {
+ if(aLastCommand != sal_Unicode('c'))
+ aNewString += String(sal_Unicode('c'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nX1 - mnLastX);
+ Imp_PutNumberCharWithSpace(aNewString, nY1 - mnLastY);
+ Imp_PutNumberCharWithSpace(aNewString, nX2 - mnLastX);
+ Imp_PutNumberCharWithSpace(aNewString, nY2 - mnLastY);
+ Imp_PutNumberCharWithSpace(aNewString, nX - mnLastX);
+ Imp_PutNumberCharWithSpace(aNewString, nY - mnLastY);
+
+ aLastCommand = sal_Unicode('c');
+ }
+ else
+ {
+ if(aLastCommand != sal_Unicode('C'))
+ aNewString += String(sal_Unicode('C'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nX1);
+ Imp_PutNumberCharWithSpace(aNewString, nY1);
+ Imp_PutNumberCharWithSpace(aNewString, nX2);
+ Imp_PutNumberCharWithSpace(aNewString, nY2);
+ Imp_PutNumberCharWithSpace(aNewString, nX);
+ Imp_PutNumberCharWithSpace(aNewString, nY);
+
+ aLastCommand = sal_Unicode('C');
+ }
+ }
+ }
+
+ // remember that current point IS written
+ bDidWriteAsCurve = true;
+
+ // remember new last position
+ mnLastX = nX;
+ mnLastY = nY;
+ }
+ }
+ }
+ }
+ }
+
+ if(!bDidWriteAsCurve)
+ {
+ // current point not yet written, prepare coordinates
+ sal_Int32 nX, nY;
+
+ Imp_PrepareCoorExport(nX, nY, pPointArray, rObjectPos, rObjectSize,
+ mrViewBox, bScale, bTranslate);
+
+ if(bDidWriteStart)
+ {
+ // write as normal point
+ if(mnLastX == nX)
+ {
+ if(bRelative)
+ {
+ if(aLastCommand != sal_Unicode('v'))
+ aNewString += String(sal_Unicode('v'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nY - mnLastY);
+
+ aLastCommand = sal_Unicode('v');
+ }
+ else
+ {
+ if(aLastCommand != sal_Unicode('V'))
+ aNewString += String(sal_Unicode('V'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nY);
+
+ aLastCommand = sal_Unicode('V');
+ }
+ }
+ else if(mnLastY == nY)
+ {
+ if(bRelative)
+ {
+ if(aLastCommand != sal_Unicode('h'))
+ aNewString += String(sal_Unicode('h'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nX - mnLastX);
+
+ aLastCommand = sal_Unicode('h');
+ }
+ else
+ {
+ if(aLastCommand != sal_Unicode('H'))
+ aNewString += String(sal_Unicode('H'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nX);
+
+ aLastCommand = sal_Unicode('H');
+ }
+ }
+ else
+ {
+ if(bRelative)
+ {
+ if(aLastCommand != sal_Unicode('l'))
+ aNewString += String(sal_Unicode('l'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nX - mnLastX);
+ Imp_PutNumberCharWithSpace(aNewString, nY - mnLastY);
+
+ aLastCommand = sal_Unicode('l');
+ }
+ else
+ {
+ if(aLastCommand != sal_Unicode('L'))
+ aNewString += String(sal_Unicode('L'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nX);
+ Imp_PutNumberCharWithSpace(aNewString, nY);
+
+ aLastCommand = sal_Unicode('L');
+ }
+ }
+ }
+ else
+ {
+ // write as start point
+ if(bRelative)
+ {
+ aNewString += String(sal_Unicode('m'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nX - mnLastX);
+ Imp_PutNumberCharWithSpace(aNewString, nY - mnLastY);
+
+ aLastCommand = sal_Unicode('l');
+ }
+ else
+ {
+ aNewString += String(sal_Unicode('M'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nX);
+ Imp_PutNumberCharWithSpace(aNewString, nY);
+
+ aLastCommand = sal_Unicode('L');
+ }
+
+ // remember start written
+ bDidWriteStart = true;
+ }
+
+ // remember new last position
+ mnLastX = nX;
+ mnLastY = nY;
+ }
+ }
+
+ // next point
+ pPointArray++;
+ pFlagArray++;
+ }
+
+ // close path if closed poly
+ if(bClosed)
+ {
+ if(bRelative)
+ aNewString += String(sal_Unicode('z'));
+ else
+ aNewString += String(sal_Unicode('Z'));
+ }
+
+ // append new string
+ msString += aNewString;
+ }
+}
+
+// #100617# Linear double reader
+double Imp_ImportDoubleAndSpaces(
+ double fRetval, const OUString& rStr, sal_Int32& rPos,
+ const sal_Int32 nLen, const SvXMLUnitConverter& rConv)
+{
+ fRetval = Imp_GetDoubleChar(rStr, rPos, nLen, rConv, fRetval);
+ Imp_SkipSpacesAndCommas(rStr, rPos, nLen);
+ return fRetval;
+}
+
+// #100617# Allow to read doubles, too. This will need to be changed to
+// the usage of Imp_ImportDoubleAndSpaces(...). For now, this is sufficient
+// since the interface cannot transport doubles.
+sal_Int32 Imp_ImportNumberAndSpaces(
+ sal_Int32 nRetval, const OUString& rStr, sal_Int32& rPos,
+ const sal_Int32 nLen, const SvXMLUnitConverter& rConv)
+{
+ nRetval = FRound(Imp_ImportDoubleAndSpaces(double(nRetval), rStr, rPos, nLen, rConv));
+ Imp_SkipSpacesAndCommas(rStr, rPos, nLen);
+ return nRetval;
+}
+
+void Imp_PrepareCoorImport(sal_Int32& nX, sal_Int32& nY,
+ const awt::Point& rObjectPos, const awt::Size& rObjectSize,
+ const SdXMLImExViewBox& rViewBox, const bool bScale, const bool bTranslate)
+{
+ if(bTranslate)
+ {
+ nX -= rViewBox.GetX();
+ nY -= rViewBox.GetY();
+ }
+
+ if(bScale && rViewBox.GetWidth() && rViewBox.GetHeight())
+ {
+ nX = (nX * rObjectSize.Width) / rViewBox.GetWidth();
+ nY = (nY * rObjectSize.Height) / rViewBox.GetHeight();
+ }
+
+ nX += rObjectPos.X;
+ nY += rObjectPos.Y;
+}
+
+void Imp_AddExportPoints(sal_Int32 nX, sal_Int32 nY,
+ awt::Point* pPoints, drawing::PolygonFlags* pFlags,
+ const sal_Int32 nInnerIndex,
+ drawing::PolygonFlags eFlag)
+{
+ if(pPoints)
+ pPoints[nInnerIndex] = awt::Point( nX, nY );
+
+ if(pFlags)
+ pFlags[nInnerIndex] = eFlag;
+}
+
+void Imp_CalcVectorValues(::basegfx::B2DVector& aVec1, ::basegfx::B2DVector& aVec2, bool& bSameLength, bool& bSameDirection)
+{
+ const sal_Int32 nLen1(FRound(aVec1.getLength()));
+ const sal_Int32 nLen2(FRound(aVec2.getLength()));
+ aVec1.normalize();
+ aVec2.normalize();
+ aVec1 += aVec2;
+ const sal_Int32 nLen3(FRound(aVec1.getLength() * ((nLen1 + nLen2) / 2.0)));
+
+ bSameLength = (abs(nLen1 - nLen2) <= BORDER_INTEGERS_ARE_EQUAL);
+ bSameDirection = (nLen3 <= BORDER_INTEGERS_ARE_EQUAL);
+}
+
+void Imp_CorrectPolygonFlag(const sal_uInt32 nInnerIndex, const awt::Point* const pInnerSequence,
+ drawing::PolygonFlags* const pInnerFlags, const sal_Int32 nX1, const sal_Int32 nY1)
+{
+ if(nInnerIndex)
+ {
+ const awt::Point aPPrev1 = pInnerSequence[nInnerIndex - 1];
+
+ if(nInnerIndex > 1)
+ {
+ const awt::Point aPPrev2 = pInnerSequence[nInnerIndex - 2];
+ const drawing::PolygonFlags aFPrev2 = pInnerFlags[nInnerIndex - 2];
+ ::basegfx::B2DVector aVec1(aPPrev2.X - aPPrev1.X, aPPrev2.Y - aPPrev1.Y);
+ ::basegfx::B2DVector aVec2(nX1 - aPPrev1.X, nY1 - aPPrev1.Y);
+ bool bSameLength(false);
+ bool bSameDirection(false);
+
+ // get vector values
+ Imp_CalcVectorValues(aVec1, aVec2, bSameLength, bSameDirection);
+
+ if(drawing::PolygonFlags_CONTROL == aFPrev2)
+ {
+ // point before is a control point
+ if(bSameDirection)
+ {
+ if(bSameLength)
+ {
+ // set to PolygonFlags_SYMMETRIC
+ pInnerFlags[nInnerIndex - 1] = drawing::PolygonFlags_SYMMETRIC;
+ }
+ else
+ {
+ // set to PolygonFlags_SMOOTH
+ pInnerFlags[nInnerIndex - 1] = drawing::PolygonFlags_SMOOTH;
+ }
+ }
+ else
+ {
+ // set to PolygonFlags_NORMAL
+ pInnerFlags[nInnerIndex - 1] = drawing::PolygonFlags_NORMAL;
+ }
+ }
+ else
+ {
+ // point before is a simple curve point
+ if(bSameDirection)
+ {
+ // set to PolygonFlags_SMOOTH
+ pInnerFlags[nInnerIndex - 1] = drawing::PolygonFlags_SMOOTH;
+ }
+ else
+ {
+ // set to PolygonFlags_NORMAL
+ pInnerFlags[nInnerIndex - 1] = drawing::PolygonFlags_NORMAL;
+ }
+ }
+ }
+ else
+ {
+ // no point before starpoint, set type to PolygonFlags_NORMAL
+ pInnerFlags[nInnerIndex - 1] = drawing::PolygonFlags_NORMAL;
+ }
+ }
+}
+
+SdXMLImExSvgDElement::SdXMLImExSvgDElement(const OUString& rNew,
+ const SdXMLImExViewBox& rViewBox,
+ const awt::Point& rObjectPos,
+ const awt::Size& rObjectSize,
+ const SvXMLUnitConverter& rConv)
+: msString( rNew ),
+ mrViewBox( rViewBox ),
+ mbIsClosed( false ),
+ mbIsCurve( false ),
+ mnLastX( 0L ),
+ mnLastY( 0L ),
+ maPoly( 0L ),
+ maFlag( 0L )
+{
+ // convert string to polygon
+ const OUString aStr(msString.getStr(), msString.getLength());
+ const sal_Int32 nLen(aStr.getLength());
+ sal_Int32 nPos(0);
+ sal_Int32 nNumPolys(0L);
+ bool bEllipticalArc(false);
+
+ // object size and ViewBox size different?
+ bool bScale(rObjectSize.Width != mrViewBox.GetWidth()
+ || rObjectSize.Height != mrViewBox.GetHeight());
+ bool bTranslate(mrViewBox.GetX() != 0L || mrViewBox.GetY() != 0L);
+
+ // first loop: count polys and get flags
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ while(nPos < nLen)
+ {
+ switch(aStr[nPos++])
+ {
+ case 'Z' :
+ case 'z' :
+ {
+ break;
+ }
+ case 'M' :
+ case 'm' :
+ {
+ nNumPolys++;
+ break;
+ }
+ case 'S' :
+ case 's' :
+ case 'C' :
+ case 'c' :
+ case 'Q' :
+ case 'q' :
+ case 'T' :
+ case 't' :
+ {
+ mbIsCurve = true;
+ break;
+ }
+ case 'L' :
+ case 'l' :
+ case 'H' :
+ case 'h' :
+ case 'V' :
+ case 'v' :
+ {
+ // normal, interpreted values. All okay.
+ break;
+ }
+ case 'A' :
+ case 'a' :
+ {
+ // Not yet interpreted value.
+ bEllipticalArc = true;
+ break;
+ }
+ }
+ }
+
+ DBG_ASSERT(!bEllipticalArc, "XMLIMP: non-interpreted tags in svg:d element!");
+ (void)bEllipticalArc;
+
+ if(nNumPolys)
+ {
+ // alloc arrays
+ maPoly.realloc(nNumPolys);
+ if(IsCurve())
+ maFlag.realloc(nNumPolys);
+
+ // get outer sequences
+ drawing::PointSequence* pOuterSequence = maPoly.getArray();
+ drawing::FlagSequence* pOuterFlags = (IsCurve()) ? maFlag.getArray() : 0L;
+
+ // prepare new loop, count
+ sal_uInt32 nPointCount(0L);
+ nPos = 0;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ // #104076# reset closed flag for next to be started polygon
+ mbIsClosed = false;
+
+ while(nPos < nLen)
+ {
+ switch(aStr[nPos])
+ {
+ case 'z' :
+ case 'Z' :
+ {
+ nPos++;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ // #104076# remember closed state of current polygon
+ mbIsClosed = true;
+
+ break;
+ }
+ case 'm' :
+ case 'M' :
+ {
+ // new poly starts, end-process current poly
+ if(nPointCount)
+ {
+ // #104076# If this partial polygon is closed, use one more point
+ // to represent that
+ if(mbIsClosed)
+ {
+ nPointCount++;
+ }
+
+ pOuterSequence->realloc(nPointCount);
+ pOuterSequence++;
+
+ if(pOuterFlags)
+ {
+ pOuterFlags->realloc(nPointCount);
+ pOuterFlags++;
+ }
+
+ // reset point count for next polygon
+ nPointCount = 0L;
+ }
+
+ // #104076# reset closed flag for next to be started polygon
+ mbIsClosed = false;
+
+ // NO break, continue in next case
+ }
+ case 'L' :
+ case 'l' :
+ {
+ nPos++;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
+ {
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ nPointCount++;
+ }
+ break;
+ }
+ case 'H' :
+ case 'h' :
+ case 'V' :
+ case 'v' :
+ {
+ nPos++;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
+ {
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ nPointCount++;
+ }
+ break;
+ }
+ case 'S' :
+ case 's' :
+ {
+ nPos++;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
+ {
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ nPointCount += 3;
+ }
+ break;
+ }
+ case 'C' :
+ case 'c' :
+ {
+ nPos++;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
+ {
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ nPointCount += 3;
+ }
+ break;
+ }
+
+ // #100617# quadratic beziers, supported as cubic ones
+ case 'Q' :
+ case 'q' :
+ {
+ nPos++;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
+ {
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+
+ // use three points since quadratic is imported as cubic
+ nPointCount += 3;
+ }
+ break;
+ }
+
+ // #100617# relative quadratic beziers, supported as cubic ones
+ case 'T' :
+ case 't' :
+ {
+ nPos++;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
+ {
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+
+ // use three points since quadratic is imported as cubic
+ nPointCount += 3;
+ }
+ break;
+ }
+
+ // #100617# not yet supported: elliptical arc
+ case 'A' :
+ case 'a' :
+ {
+ OSL_FAIL("XMLIMP: non-interpreted tags in svg:d element (elliptical arc)!");
+ nPos++;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
+ {
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipNumberAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipNumberAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ }
+ break;
+ }
+
+ default:
+ {
+ nPos++;
+ OSL_FAIL("XMLIMP: non-interpreted tags in svg:d element (unknown)!");
+ break;
+ }
+ }
+ }
+
+ // alloc last poly (when points used)
+ if(nPointCount)
+ {
+ // #104076# If this partial polygon is closed, use one more point
+ // to represent that
+ if(mbIsClosed)
+ {
+ nPointCount++;
+ }
+
+ pOuterSequence->realloc(nPointCount);
+ pOuterSequence++;
+
+ if(pOuterFlags)
+ {
+ pOuterFlags->realloc(nPointCount);
+ pOuterFlags++;
+ }
+ }
+
+ // set pointers back
+ pOuterSequence = maPoly.getArray();
+ pOuterFlags = (IsCurve()) ? maFlag.getArray() : 0L;
+ awt::Point* pNotSoInnerSequence = 0L;
+ drawing::PolygonFlags* pNotSoInnerFlags = 0L;
+ sal_uInt32 nInnerIndex(0L);
+
+ // prepare new loop, read points
+ nPos = 0;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ // #104076# reset closed flag for next to be started polygon
+ mbIsClosed = false;
+
+ while(nPos < nLen)
+ {
+ bool bRelative(false);
+
+ switch(aStr[nPos])
+ {
+ case 'z' :
+ case 'Z' :
+ {
+ nPos++;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ // #104076# remember closed state of current polygon
+ mbIsClosed = true;
+
+ break;
+ }
+
+ case 'm' :
+ {
+ bRelative = true;
+ }
+ case 'M' :
+ {
+ // #104076# end-process current poly
+ if(mbIsClosed)
+ {
+ if(pNotSoInnerSequence)
+ {
+ // closed: add first point again
+ sal_Int32 nX(pNotSoInnerSequence[0].X);
+ sal_Int32 nY(pNotSoInnerSequence[0].Y);
+ Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_NORMAL);
+ }
+
+ // reset closed flag for next to be started polygon
+ mbIsClosed = false;
+ }
+
+ // next poly
+ pNotSoInnerSequence = pOuterSequence->getArray();
+ pOuterSequence++;
+
+ if(pOuterFlags)
+ {
+ pNotSoInnerFlags = pOuterFlags->getArray();
+ pOuterFlags++;
+ }
+
+ nInnerIndex = 0L;
+
+ nPos++;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
+ {
+ sal_Int32 nX(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
+ sal_Int32 nY(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
+
+ if(bRelative)
+ {
+ nX += mnLastX;
+ nY += mnLastY;
+ }
+
+ // set last position
+ mnLastX = nX;
+ mnLastY = nY;
+
+ // calc transform and add point and flag
+ Imp_PrepareCoorImport(nX, nY, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate);
+ Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_NORMAL);
+ }
+ break;
+ }
+
+ case 'l' :
+ {
+ bRelative = true;
+ }
+ case 'L' :
+ {
+ nPos++;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
+ {
+ sal_Int32 nX(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
+ sal_Int32 nY(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
+
+ if(bRelative)
+ {
+ nX += mnLastX;
+ nY += mnLastY;
+ }
+
+ // set last position
+ mnLastX = nX;
+ mnLastY = nY;
+
+ // calc transform and add point and flag
+ Imp_PrepareCoorImport(nX, nY, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate);
+ Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_NORMAL);
+ }
+ break;
+ }
+
+ case 'h' :
+ {
+ bRelative = true;
+ }
+ case 'H' :
+ {
+ nPos++;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
+ {
+ sal_Int32 nX(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
+ sal_Int32 nY(mnLastY);
+
+ if(bRelative)
+ nX += mnLastX;
+
+ // set last position
+ mnLastX = nX;
+
+ // calc transform and add point and flag
+ Imp_PrepareCoorImport(nX, nY, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate);
+ Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_NORMAL);
+ }
+ break;
+ }
+
+ case 'v' :
+ {
+ bRelative = true;
+ }
+ case 'V' :
+ {
+ nPos++;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
+ {
+ sal_Int32 nX(mnLastX);
+ sal_Int32 nY(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
+
+ if(bRelative)
+ nY += mnLastY;
+
+ // set last position
+ mnLastY = nY;
+
+ // calc transform and add point and flag
+ Imp_PrepareCoorImport(nX, nY, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate);
+ Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_NORMAL);
+ }
+ break;
+ }
+
+ case 's' :
+ {
+ bRelative = true;
+ }
+ case 'S' :
+ {
+ nPos++;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
+ {
+ sal_Int32 nX1;
+ sal_Int32 nY1;
+ sal_Int32 nX2(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
+ sal_Int32 nY2(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
+ sal_Int32 nX(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
+ sal_Int32 nY(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
+
+ if(bRelative)
+ {
+ nX2 += mnLastX;
+ nY2 += mnLastY;
+ nX += mnLastX;
+ nY += mnLastY;
+ }
+
+ // set last position
+ mnLastX = nX;
+ mnLastY = nY;
+
+ // calc transform for new points
+ Imp_PrepareCoorImport(nX2, nY2, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate);
+ Imp_PrepareCoorImport(nX, nY, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate);
+
+ // one more thing is known: the previous real point is PolygonFlags_SYMMETRIC
+ // and the Point X1,Y1 can be constructed by mirroring the point before it.
+ nX1 = nX2;
+ nY1 = nY2;
+ if(nInnerIndex)
+ {
+ awt::Point aPPrev1 = pNotSoInnerSequence[nInnerIndex - 1];
+
+ if(nInnerIndex > 1)
+ {
+ awt::Point aPPrev2 = pNotSoInnerSequence[nInnerIndex - 2];
+ nX1 = aPPrev1.X -(aPPrev2.X - aPPrev1.X);
+ nY1 = aPPrev1.Y -(aPPrev2.Y - aPPrev1.Y);
+ }
+
+ // set curve point to symmetric
+ pNotSoInnerFlags[nInnerIndex - 1] = drawing::PolygonFlags_SYMMETRIC;
+ }
+
+ // add calculated control point
+ Imp_AddExportPoints(nX1, nY1, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_CONTROL);
+
+ // add new points and set flags
+ Imp_AddExportPoints(nX2, nY2, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_CONTROL);
+ Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_SMOOTH);
+ }
+ break;
+ }
+
+ case 'c' :
+ {
+ bRelative = true;
+ }
+ case 'C' :
+ {
+ nPos++;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
+ {
+ sal_Int32 nX1(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
+ sal_Int32 nY1(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
+ sal_Int32 nX2(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
+ sal_Int32 nY2(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
+ sal_Int32 nX(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
+ sal_Int32 nY(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
+
+ if(bRelative)
+ {
+ nX1 += mnLastX;
+ nY1 += mnLastY;
+ nX2 += mnLastX;
+ nY2 += mnLastY;
+ nX += mnLastX;
+ nY += mnLastY;
+ }
+
+ // set last position
+ mnLastX = nX;
+ mnLastY = nY;
+
+ // calc transform for new points
+ Imp_PrepareCoorImport(nX1, nY1, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate);
+ Imp_PrepareCoorImport(nX2, nY2, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate);
+ Imp_PrepareCoorImport(nX, nY, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate);
+
+ // correct polygon flag for previous point
+ Imp_CorrectPolygonFlag(nInnerIndex, pNotSoInnerSequence, pNotSoInnerFlags, nX1, nY1);
+
+ // add new points and set flags
+ Imp_AddExportPoints(nX1, nY1, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_CONTROL);
+ Imp_AddExportPoints(nX2, nY2, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_CONTROL);
+ Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_SMOOTH);
+ }
+ break;
+ }
+
+ // #100617# quadratic beziers are imported as cubic
+ case 'q' :
+ {
+ bRelative = true;
+ }
+ case 'Q' :
+ {
+ nPos++;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
+ {
+ sal_Int32 nXX(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
+ sal_Int32 nYY(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
+ sal_Int32 nX(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
+ sal_Int32 nY(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
+
+ if(bRelative)
+ {
+ nXX += mnLastX;
+ nYY += mnLastY;
+ nX += mnLastX;
+ nY += mnLastY;
+ }
+
+ // set last position
+ mnLastX = nX;
+ mnLastY = nY;
+
+ // calc transform for new points
+ Imp_PrepareCoorImport(nXX, nYY, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate);
+ Imp_PrepareCoorImport(nX, nY, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate);
+
+ // calculate X1,X2
+ awt::Point aPPrev1 = (nInnerIndex) ? pNotSoInnerSequence[nInnerIndex-1] : pNotSoInnerSequence[0];
+ sal_Int32 nX1 = FRound((double)((nXX * 2) + aPPrev1.X) / 3.0);
+ sal_Int32 nY1 = FRound((double)((nYY * 2) + aPPrev1.Y) / 3.0);
+ sal_Int32 nX2 = FRound((double)((nXX * 2) + nX) / 3.0);
+ sal_Int32 nY2 = FRound((double)((nYY * 2) + nY) / 3.0);
+
+ // correct polygon flag for previous point
+ Imp_CorrectPolygonFlag(nInnerIndex, pNotSoInnerSequence, pNotSoInnerFlags, nX1, nY1);
+
+ // add new points and set flags
+ Imp_AddExportPoints(nX1, nY1, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_CONTROL);
+ Imp_AddExportPoints(nX2, nY2, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_CONTROL);
+ Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_SMOOTH);
+ }
+ break;
+ }
+
+ // #100617# relative quadratic beziers are imported as cubic
+ case 't' :
+ {
+ bRelative = true;
+ }
+ case 'T' :
+ {
+ nPos++;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
+ {
+ sal_Int32 nXX;
+ sal_Int32 nYY;
+ sal_Int32 nX(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
+ sal_Int32 nY(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
+
+ if(bRelative)
+ {
+ nX += mnLastX;
+ nY += mnLastY;
+ }
+
+ // set last position
+ mnLastX = nX;
+ mnLastY = nY;
+
+ // calc transform for new points
+ Imp_PrepareCoorImport(nX, nY, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate);
+
+ // one more thing is known: the previous real point is PolygonFlags_SYMMETRIC
+ // and the Point X1,Y1 can be constructed by mirroring the point before it.
+ nXX = nX;
+ nYY = nY;
+ awt::Point aPPrev1 = pNotSoInnerSequence[0];
+
+ if(nInnerIndex)
+ {
+ aPPrev1 = pNotSoInnerSequence[nInnerIndex - 1];
+
+ if(nInnerIndex > 1)
+ {
+ awt::Point aPPrev2 = pNotSoInnerSequence[nInnerIndex - 2];
+ nXX = aPPrev1.X -(aPPrev2.X - aPPrev1.X);
+ nYY = aPPrev1.Y -(aPPrev2.Y - aPPrev1.Y);
+ }
+
+ // set curve point to smooth here, since length
+ // is changed and thus only c1 can be used.
+ pNotSoInnerFlags[nInnerIndex - 1] = drawing::PolygonFlags_SMOOTH;
+ }
+
+ // calculate X1,X2
+ sal_Int32 nX1 = FRound((double)((nXX * 2) + aPPrev1.X) / 3.0);
+ sal_Int32 nY1 = FRound((double)((nYY * 2) + aPPrev1.Y) / 3.0);
+ sal_Int32 nX2 = FRound((double)((nXX * 2) + nX) / 3.0);
+ sal_Int32 nY2 = FRound((double)((nYY * 2) + nY) / 3.0);
+
+ // correct polygon flag for previous point
+ Imp_CorrectPolygonFlag(nInnerIndex, pNotSoInnerSequence, pNotSoInnerFlags, nX1, nY1);
+
+ // add new points and set flags
+ Imp_AddExportPoints(nX1, nY1, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_CONTROL);
+ Imp_AddExportPoints(nX2, nY2, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_CONTROL);
+ Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_SMOOTH);
+ }
+ break;
+ }
+
+ // #100617# not yet supported: elliptical arc
+ case 'A' :
+ case 'a' :
+ {
+ OSL_FAIL("XMLIMP: non-interpreted tags in svg:d element (elliptical arc)!");
+ nPos++;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
+ {
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipNumberAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipNumberAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ }
+ break;
+ }
+
+ default:
+ {
+ nPos++;
+ OSL_FAIL("XMLIMP: non-interpreted tags in svg:d element (unknown)!");
+ break;
+ }
+ }
+ }
+
+ // #104076# end-process closed state of last poly
+ if(mbIsClosed)
+ {
+ if(pNotSoInnerSequence)
+ {
+ // closed: add first point again
+ sal_Int32 nX(pNotSoInnerSequence[0].X);
+ sal_Int32 nY(pNotSoInnerSequence[0].Y);
+ Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_NORMAL);
+ }
+ }
+
+ // #87202# If it's a curve and it's closed the last point maybe too much
+ // and just exported since SVG does not allow special handling of same
+ // start and end point, remove this last point.
+ // Evtl. correct the last curve flags, too.
+ if(IsCurve() && IsClosed())
+ {
+ // make one more loop over the PolyPolygon
+ pOuterSequence = maPoly.getArray();
+ pOuterFlags = maFlag.getArray();
+ sal_Int32 nOuterCnt(maPoly.getLength());
+
+ for(sal_Int32 a(0); a < nOuterCnt; a++)
+ {
+ // get Polygon pointers
+ awt::Point* pInnerSequence = pOuterSequence->getArray();
+ drawing::PolygonFlags* pInnerFlags = pOuterFlags->getArray();
+ sal_Int32 nInnerCnt(pOuterSequence->getLength());
+
+ while( nInnerCnt >= 2
+ && ((pInnerSequence + (nInnerCnt - 2))->X == (pInnerSequence + (nInnerCnt - 1))->X)
+ && ((pInnerSequence + (nInnerCnt - 2))->Y == (pInnerSequence + (nInnerCnt - 1))->Y)
+ && drawing::PolygonFlags_CONTROL != *(pInnerFlags + (nInnerCnt - 2)))
+ {
+ // remove last point from array
+ pOuterSequence->realloc(nInnerCnt - 1);
+ pOuterFlags->realloc(nInnerCnt - 1);
+
+ // get new pointers
+ pInnerSequence = pOuterSequence->getArray();
+ pInnerFlags = pOuterFlags->getArray();
+ nInnerCnt = pOuterSequence->getLength();
+ }
+
+ // now evtl. correct the last curve flags
+ if(nInnerCnt >= 4)
+ {
+ if( pInnerSequence->X == (pInnerSequence + (nInnerCnt - 1))->X
+ && pInnerSequence->Y == (pInnerSequence + (nInnerCnt - 1))->Y
+ && drawing::PolygonFlags_CONTROL == *(pInnerFlags + 1)
+ && drawing::PolygonFlags_CONTROL == *(pInnerFlags + (nInnerCnt - 2)))
+ {
+ awt::Point aPrev = *(pInnerSequence + (nInnerCnt - 2));
+ awt::Point aCurr = *pInnerSequence;
+ awt::Point aNext = *(pInnerSequence + 1);
+ ::basegfx::B2DVector aVec1(aPrev.X - aCurr.X, aPrev.Y - aCurr.Y);
+ ::basegfx::B2DVector aVec2(aNext.X - aCurr.X, aNext.Y - aCurr.Y);
+ bool bSameLength(false);
+ bool bSameDirection(false);
+
+ // get vector values
+ Imp_CalcVectorValues(aVec1, aVec2, bSameLength, bSameDirection);
+
+ // set correct flag value
+ if(bSameDirection)
+ {
+ if(bSameLength)
+ {
+ // set to PolygonFlags_SYMMETRIC
+ *pInnerFlags = drawing::PolygonFlags_SYMMETRIC;
+ *(pInnerFlags + (nInnerCnt - 1)) = drawing::PolygonFlags_SYMMETRIC;
+ }
+ else
+ {
+ // set to PolygonFlags_SMOOTH
+ *pInnerFlags = drawing::PolygonFlags_SMOOTH;
+ *(pInnerFlags + (nInnerCnt - 1)) = drawing::PolygonFlags_SMOOTH;
+ }
+ }
+ else
+ {
+ // set to PolygonFlags_NORMAL
+ *pInnerFlags = drawing::PolygonFlags_NORMAL;
+ *(pInnerFlags + (nInnerCnt - 1)) = drawing::PolygonFlags_NORMAL;
+ }
+ }
+ }
+
+ // switch to next Polygon
+ pOuterSequence++;
+ pOuterFlags++;
+ }
+ }
+ }
+}
+
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/ximp3dobject.cxx b/xmloff/source/draw/ximp3dobject.cxx
new file mode 100644
index 000000000000..3a0a65d27f8a
--- /dev/null
+++ b/xmloff/source/draw/ximp3dobject.cxx
@@ -0,0 +1,556 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <comphelper/extract.hxx>
+#include "ximp3dobject.hxx"
+#include <xmloff/XMLShapeStyleContext.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/drawing/PointSequenceSequence.hpp>
+#include <com/sun/star/drawing/PointSequence.hpp>
+#include "xexptran.hxx"
+#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
+#include <xmloff/families.hxx>
+#include "ximpstyl.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
+#include <com/sun/star/drawing/DoubleSequence.hpp>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXML3DObjectContext, SdXMLShapeContext );
+
+SdXML3DObjectContext::SdXML3DObjectContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
+ mbSetTransform( sal_False )
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ OUString sValue = xAttrList->getValueByIndex( i );
+ const SvXMLTokenMap& rAttrTokenMap = GetImport().GetShapeImport()->Get3DObjectAttrTokenMap();
+
+ switch(rAttrTokenMap.Get(nPrefix, aLocalName))
+ {
+ case XML_TOK_3DOBJECT_DRAWSTYLE_NAME:
+ {
+ maDrawStyleName = sValue;
+ break;
+ }
+ case XML_TOK_3DOBJECT_TRANSFORM:
+ {
+ SdXMLImExTransform3D aTransform(sValue, GetImport().GetMM100UnitConverter());
+ if(aTransform.NeedsAction())
+ mbSetTransform = aTransform.GetFullHomogenTransform(mxHomMat);
+ break;
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXML3DObjectContext::~SdXML3DObjectContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXML3DObjectContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+{
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ // set parameters
+ if(mbSetTransform)
+ {
+ uno::Any aAny;
+ aAny <<= mxHomMat;
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DTransformMatrix")), aAny);
+ }
+
+ // call parent
+ SdXMLShapeContext::StartElement(xAttrList);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXML3DObjectContext::EndElement()
+{
+ // call parent
+ SdXMLShapeContext::EndElement();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXML3DCubeObjectShapeContext, SdXML3DObjectContext);
+
+SdXML3DCubeObjectShapeContext::SdXML3DCubeObjectShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXML3DObjectContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
+ maMinEdge(-2500.0, -2500.0, -2500.0),
+ maMaxEdge(2500.0, 2500.0, 2500.0),
+ mbMinEdgeUsed(sal_False),
+ mbMaxEdgeUsed(sal_False)
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ OUString sValue = xAttrList->getValueByIndex( i );
+ const SvXMLTokenMap& rAttrTokenMap = GetImport().GetShapeImport()->Get3DCubeObjectAttrTokenMap();
+
+ switch(rAttrTokenMap.Get(nPrefix, aLocalName))
+ {
+ case XML_TOK_3DCUBEOBJ_MINEDGE:
+ {
+ ::basegfx::B3DVector aNewVec;
+ GetImport().GetMM100UnitConverter().convertB3DVector(aNewVec, sValue);
+
+ if(aNewVec != maMinEdge)
+ {
+ maMinEdge = aNewVec;
+ mbMinEdgeUsed = sal_True;
+ }
+ break;
+ }
+ case XML_TOK_3DCUBEOBJ_MAXEDGE:
+ {
+ ::basegfx::B3DVector aNewVec;
+ GetImport().GetMM100UnitConverter().convertB3DVector(aNewVec, sValue);
+
+ if(aNewVec != maMaxEdge)
+ {
+ maMaxEdge = aNewVec;
+ mbMaxEdgeUsed = sal_True;
+ }
+ break;
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXML3DCubeObjectShapeContext::~SdXML3DCubeObjectShapeContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXML3DCubeObjectShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+{
+ // create shape
+ AddShape( "com.sun.star.drawing.Shape3DCubeObject" );
+ if(mxShape.is())
+ {
+ // add, set style and properties from base shape
+ SetStyle();
+ SdXML3DObjectContext::StartElement(xAttrList);
+
+ // set local parameters on shape
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ // set parameters
+ drawing::Position3D aPosition3D;
+ drawing::Direction3D aDirection3D;
+
+ // convert from min, max to size to be set
+ maMaxEdge = maMaxEdge - maMinEdge;
+
+ aPosition3D.PositionX = maMinEdge.getX();
+ aPosition3D.PositionY = maMinEdge.getY();
+ aPosition3D.PositionZ = maMinEdge.getZ();
+
+ aDirection3D.DirectionX = maMaxEdge.getX();
+ aDirection3D.DirectionY = maMaxEdge.getY();
+ aDirection3D.DirectionZ = maMaxEdge.getZ();
+
+ uno::Any aAny;
+ aAny <<= aPosition3D;
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DPosition")), aAny);
+ aAny <<= aDirection3D;
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSize")), aAny);
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXML3DCubeObjectShapeContext::EndElement()
+{
+ // call parent
+ SdXML3DObjectContext::EndElement();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXML3DSphereObjectShapeContext, SdXML3DObjectContext);
+
+SdXML3DSphereObjectShapeContext::SdXML3DSphereObjectShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXML3DObjectContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
+ maCenter(0.0, 0.0, 0.0),
+ maSize(5000.0, 5000.0, 5000.0),
+ mbCenterUsed(sal_False),
+ mbSizeUsed(sal_False)
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ OUString sValue = xAttrList->getValueByIndex( i );
+ const SvXMLTokenMap& rAttrTokenMap = GetImport().GetShapeImport()->Get3DSphereObjectAttrTokenMap();
+
+ switch(rAttrTokenMap.Get(nPrefix, aLocalName))
+ {
+ case XML_TOK_3DSPHEREOBJ_CENTER:
+ {
+ ::basegfx::B3DVector aNewVec;
+ GetImport().GetMM100UnitConverter().convertB3DVector(aNewVec, sValue);
+
+ if(aNewVec != maCenter)
+ {
+ maCenter = aNewVec;
+ mbCenterUsed = sal_True;
+ }
+ break;
+ }
+ case XML_TOK_3DSPHEREOBJ_SIZE:
+ {
+ ::basegfx::B3DVector aNewVec;
+ GetImport().GetMM100UnitConverter().convertB3DVector(aNewVec, sValue);
+
+ if(aNewVec != maSize)
+ {
+ maSize = aNewVec;
+ mbSizeUsed = sal_True;
+ }
+ break;
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXML3DSphereObjectShapeContext::~SdXML3DSphereObjectShapeContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXML3DSphereObjectShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+{
+ // create shape
+ AddShape( "com.sun.star.drawing.Shape3DSphereObject" );
+ if(mxShape.is())
+ {
+ // add, set style and properties from base shape
+ SetStyle();
+ SdXML3DObjectContext::StartElement(xAttrList);
+
+ // set local parameters on shape
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ // set parameters
+ drawing::Position3D aPosition3D;
+ drawing::Direction3D aDirection3D;
+
+ aPosition3D.PositionX = maCenter.getX();
+ aPosition3D.PositionY = maCenter.getY();
+ aPosition3D.PositionZ = maCenter.getZ();
+
+ aDirection3D.DirectionX = maSize.getX();
+ aDirection3D.DirectionY = maSize.getY();
+ aDirection3D.DirectionZ = maSize.getZ();
+
+ uno::Any aAny;
+ aAny <<= aPosition3D;
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DPosition")), aAny);
+ aAny <<= aDirection3D;
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSize")), aAny);
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXML3DSphereObjectShapeContext::EndElement()
+{
+ // call parent
+ SdXML3DObjectContext::EndElement();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXML3DPolygonBasedShapeContext, SdXML3DObjectContext );
+
+SdXML3DPolygonBasedShapeContext::SdXML3DPolygonBasedShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXML3DObjectContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape )
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ OUString sValue = xAttrList->getValueByIndex( i );
+ const SvXMLTokenMap& rAttrTokenMap = GetImport().GetShapeImport()->Get3DPolygonBasedAttrTokenMap();
+
+ switch(rAttrTokenMap.Get(nPrefix, aLocalName))
+ {
+ case XML_TOK_3DPOLYGONBASED_VIEWBOX:
+ {
+ maViewBox = sValue;
+ break;
+ }
+ case XML_TOK_3DPOLYGONBASED_D:
+ {
+ maPoints = sValue;
+ break;
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXML3DPolygonBasedShapeContext::~SdXML3DPolygonBasedShapeContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXML3DPolygonBasedShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+{
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ // set parameters
+ if(maPoints.getLength() && maViewBox.getLength())
+ {
+ SdXMLImExViewBox aViewBox(maViewBox, GetImport().GetMM100UnitConverter());
+ awt::Point aMinPoint(aViewBox.GetX(), aViewBox.GetY());
+ awt::Size aMaxSize(aViewBox.GetWidth(), aViewBox.GetHeight());
+ SdXMLImExSvgDElement aPoints(maPoints, aViewBox,
+ aMinPoint, aMaxSize, GetImport().GetMM100UnitConverter());
+
+ // convert to double sequences
+ drawing::PointSequenceSequence& xPoSeSe =
+ (drawing::PointSequenceSequence&)aPoints.GetPointSequenceSequence();
+ sal_Int32 nOuterSequenceCount = xPoSeSe.getLength();
+ drawing::PointSequence* pInnerSequence = xPoSeSe.getArray();
+
+ drawing::PolyPolygonShape3D xPolyPolygon3D;
+ xPolyPolygon3D.SequenceX.realloc(nOuterSequenceCount);
+ xPolyPolygon3D.SequenceY.realloc(nOuterSequenceCount);
+ xPolyPolygon3D.SequenceZ.realloc(nOuterSequenceCount);
+ drawing::DoubleSequence* pOuterSequenceX = xPolyPolygon3D.SequenceX.getArray();
+ drawing::DoubleSequence* pOuterSequenceY = xPolyPolygon3D.SequenceY.getArray();
+ drawing::DoubleSequence* pOuterSequenceZ = xPolyPolygon3D.SequenceZ.getArray();
+
+ for(sal_Int32 a(0L); a < nOuterSequenceCount; a++)
+ {
+ sal_Int32 nInnerSequenceCount(pInnerSequence->getLength());
+ awt::Point* pArray = pInnerSequence->getArray();
+
+ pOuterSequenceX->realloc(nInnerSequenceCount);
+ pOuterSequenceY->realloc(nInnerSequenceCount);
+ pOuterSequenceZ->realloc(nInnerSequenceCount);
+ double* pInnerSequenceX = pOuterSequenceX->getArray();
+ double* pInnerSequenceY = pOuterSequenceY->getArray();
+ double* pInnerSequenceZ = pOuterSequenceZ->getArray();
+
+ for(sal_Int32 b(0L); b < nInnerSequenceCount; b++)
+ {
+ *pInnerSequenceX++ = pArray->X;
+ *pInnerSequenceY++ = pArray->Y;
+ *pInnerSequenceZ++ = 0.0;
+ pArray++;
+ }
+ pInnerSequence++;
+
+ pOuterSequenceX++;
+ pOuterSequenceY++;
+ pOuterSequenceZ++;
+ }
+
+ // set poly
+ uno::Any aAny;
+ aAny <<= xPolyPolygon3D;
+ xPropSet->setPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("D3DPolyPolygon3D")), aAny);
+ }
+
+ // call parent
+ SdXML3DObjectContext::StartElement(xAttrList);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXML3DPolygonBasedShapeContext::EndElement()
+{
+ // call parent
+ SdXML3DObjectContext::EndElement();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXML3DLatheObjectShapeContext, SdXML3DPolygonBasedShapeContext);
+
+SdXML3DLatheObjectShapeContext::SdXML3DLatheObjectShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXML3DPolygonBasedShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape )
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXML3DLatheObjectShapeContext::~SdXML3DLatheObjectShapeContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXML3DLatheObjectShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+{
+ // create shape
+ AddShape( "com.sun.star.drawing.Shape3DLatheObject" );
+ if(mxShape.is())
+ {
+ // add, set style and properties from base shape
+ SetStyle();
+ SdXML3DPolygonBasedShapeContext::StartElement(xAttrList);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXML3DLatheObjectShapeContext::EndElement()
+{
+ // call parent
+ SdXML3DPolygonBasedShapeContext::EndElement();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXML3DExtrudeObjectShapeContext, SdXML3DPolygonBasedShapeContext);
+
+SdXML3DExtrudeObjectShapeContext::SdXML3DExtrudeObjectShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXML3DPolygonBasedShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape )
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXML3DExtrudeObjectShapeContext::~SdXML3DExtrudeObjectShapeContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXML3DExtrudeObjectShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+{
+ AddShape( "com.sun.star.drawing.Shape3DExtrudeObject" );
+ if(mxShape.is())
+ {
+ // add, set style and properties from base shape
+ SetStyle();
+ SdXML3DPolygonBasedShapeContext::StartElement(xAttrList);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXML3DExtrudeObjectShapeContext::EndElement()
+{
+ // call parent
+ SdXML3DPolygonBasedShapeContext::EndElement();
+}
+
+// EOF
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/ximp3dobject.hxx b/xmloff/source/draw/ximp3dobject.hxx
new file mode 100644
index 000000000000..05273a16cc6e
--- /dev/null
+++ b/xmloff/source/draw/ximp3dobject.hxx
@@ -0,0 +1,178 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XIMP3DOBJECT_HXX
+#define _XIMP3DOBJECT_HXX
+
+#include <xmloff/xmlictxt.hxx>
+#include "sdxmlimp_impl.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <tools/rtti.hxx>
+#include <com/sun/star/drawing/HomogenMatrix.hpp>
+#include <com/sun/star/drawing/Direction3D.hpp>
+#include <com/sun/star/drawing/Position3D.hpp>
+#include "ximpshap.hxx"
+
+//////////////////////////////////////////////////////////////////////////////
+// common shape context
+
+class SdXML3DObjectContext : public SdXMLShapeContext
+{
+protected:
+ // the shape group this object should be created inside
+
+ com::sun::star::drawing::HomogenMatrix mxHomMat;
+ sal_Bool mbSetTransform;
+
+public:
+ TYPEINFO();
+
+ SdXML3DObjectContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXML3DObjectContext();
+
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+ virtual void EndElement();
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// dr3d:3dcube context
+
+class SdXML3DCubeObjectShapeContext : public SdXML3DObjectContext
+{
+ ::basegfx::B3DVector maMinEdge;
+ ::basegfx::B3DVector maMaxEdge;
+ sal_Bool mbMinEdgeUsed;
+ sal_Bool mbMaxEdgeUsed;
+
+public:
+ TYPEINFO();
+
+ SdXML3DCubeObjectShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXML3DCubeObjectShapeContext();
+
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+ virtual void EndElement();
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// dr3d:3dsphere context
+
+class SdXML3DSphereObjectShapeContext : public SdXML3DObjectContext
+{
+ ::basegfx::B3DVector maCenter;
+ ::basegfx::B3DVector maSize;
+ sal_Bool mbCenterUsed;
+ sal_Bool mbSizeUsed;
+
+public:
+ TYPEINFO();
+
+ SdXML3DSphereObjectShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXML3DSphereObjectShapeContext();
+
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+ virtual void EndElement();
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// polygonbased context
+
+class SdXML3DPolygonBasedShapeContext : public SdXML3DObjectContext
+{
+ rtl::OUString maPoints;
+ rtl::OUString maViewBox;
+
+public:
+ TYPEINFO();
+
+ SdXML3DPolygonBasedShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXML3DPolygonBasedShapeContext();
+
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+ virtual void EndElement();
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// dr3d:3dlathe context
+
+class SdXML3DLatheObjectShapeContext : public SdXML3DPolygonBasedShapeContext
+{
+public:
+ TYPEINFO();
+
+ SdXML3DLatheObjectShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXML3DLatheObjectShapeContext();
+
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+ virtual void EndElement();
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// dr3d:3dextrude context
+
+class SdXML3DExtrudeObjectShapeContext : public SdXML3DPolygonBasedShapeContext
+{
+public:
+ TYPEINFO();
+
+ SdXML3DExtrudeObjectShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXML3DExtrudeObjectShapeContext();
+
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+ virtual void EndElement();
+};
+
+#endif // _XIMP3DOBJECT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/ximp3dscene.cxx b/xmloff/source/draw/ximp3dscene.cxx
new file mode 100644
index 000000000000..e82c5635c784
--- /dev/null
+++ b/xmloff/source/draw/ximp3dscene.cxx
@@ -0,0 +1,501 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "ximp3dscene.hxx"
+#include <xmloff/xmluconv.hxx>
+#include "xexptran.hxx"
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <com/sun/star/drawing/Direction3D.hpp>
+#include <com/sun/star/drawing/CameraGeometry.hpp>
+#include "eventimp.hxx"
+#include "descriptionimp.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+//////////////////////////////////////////////////////////////////////////////
+// dr3d:3dlight context
+
+SdXML3DLightContext::SdXML3DLightContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList)
+: SvXMLImportContext( rImport, nPrfx, rLName),
+ maDiffuseColor(0x00000000),
+ maDirection(0.0, 0.0, 1.0),
+ mbEnabled(false),
+ mbSpecular(false)
+{
+ // read attributes for the 3DScene
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ OUString sValue = xAttrList->getValueByIndex( i );
+ const SvXMLTokenMap& rAttrTokenMap = GetImport().GetShapeImport()->Get3DLightAttrTokenMap();
+
+ switch(rAttrTokenMap.Get(nPrefix, aLocalName))
+ {
+ case XML_TOK_3DLIGHT_DIFFUSE_COLOR:
+ {
+ GetImport().GetMM100UnitConverter().convertColor(maDiffuseColor, sValue);
+ break;
+ }
+ case XML_TOK_3DLIGHT_DIRECTION:
+ {
+ GetImport().GetMM100UnitConverter().convertB3DVector(maDirection, sValue);
+ break;
+ }
+ case XML_TOK_3DLIGHT_ENABLED:
+ {
+ GetImport().GetMM100UnitConverter().convertBool(mbEnabled, sValue);
+ break;
+ }
+ case XML_TOK_3DLIGHT_SPECULAR:
+ {
+ GetImport().GetMM100UnitConverter().convertBool(mbSpecular, sValue);
+ break;
+ }
+ }
+ }
+}
+
+SdXML3DLightContext::~SdXML3DLightContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXML3DSceneShapeContext, SdXMLShapeContext );
+
+SdXML3DSceneShapeContext::SdXML3DSceneShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShapes)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShapes ), SdXML3DSceneAttributesHelper( rImport )
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXML3DSceneShapeContext::~SdXML3DSceneShapeContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXML3DSceneShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+{
+ // create new 3DScene shape and add it to rShapes, use it
+ // as base for the new 3DScene import
+ AddShape( "com.sun.star.drawing.Shape3DSceneObject" );
+ if( mxShape.is() )
+ {
+ SetStyle();
+
+ mxChilds = uno::Reference< drawing::XShapes >::query( mxShape );
+ if( mxChilds.is() )
+ GetImport().GetShapeImport()->pushGroupForSorting( mxChilds );
+
+ SetLayer();
+
+ // set pos, size, shear and rotate
+ SetTransformation();
+ }
+
+ // read attributes for the 3DScene
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ OUString sValue = xAttrList->getValueByIndex( i );
+ processSceneAttribute( nPrefix, aLocalName, sValue );
+ }
+
+ // #91047# call parent function is missing here, added it
+ if(mxShape.is())
+ {
+ // call parent
+ SdXMLShapeContext::StartElement(xAttrList);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXML3DSceneShapeContext::EndElement()
+{
+ if(mxShape.is())
+ {
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ setSceneAttributes( xPropSet );
+ }
+
+ if( mxChilds.is() )
+ GetImport().GetShapeImport()->popGroupAndSort();
+
+ // call parent
+ SdXMLShapeContext::EndElement();
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLImportContext* SdXML3DSceneShapeContext::CreateChildContext( sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList>& xAttrList )
+{
+ SvXMLImportContext* pContext = 0L;
+
+ // #i68101#
+ if( nPrefix == XML_NAMESPACE_SVG &&
+ (IsXMLToken( rLocalName, XML_TITLE ) || IsXMLToken( rLocalName, XML_DESC ) ) )
+ {
+ pContext = new SdXMLDescriptionContext( GetImport(), nPrefix, rLocalName, xAttrList, mxShape );
+ }
+ else if( nPrefix == XML_NAMESPACE_OFFICE && IsXMLToken( rLocalName, XML_EVENT_LISTENERS ) )
+ {
+ pContext = new SdXMLEventsContext( GetImport(), nPrefix, rLocalName, xAttrList, mxShape );
+ }
+ // look for local light context first
+ else if(nPrefix == XML_NAMESPACE_DR3D && IsXMLToken( rLocalName, XML_LIGHT ) )
+ {
+ // dr3d:light inside dr3d:scene context
+ pContext = create3DLightContext( nPrefix, rLocalName, xAttrList );
+ }
+
+ // call GroupChildContext function at common ShapeImport
+ if(!pContext)
+ {
+ pContext = GetImport().GetShapeImport()->Create3DSceneChildContext(
+ GetImport(), nPrefix, rLocalName, xAttrList, mxChilds);
+ }
+
+ // call parent when no own context was created
+ if(!pContext)
+ {
+ pContext = SvXMLImportContext::CreateChildContext(
+ nPrefix, rLocalName, xAttrList);
+ }
+
+ return pContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXML3DSceneAttributesHelper::SdXML3DSceneAttributesHelper( SvXMLImport& rImporter )
+: mrImport( rImporter ),
+ mbSetTransform( sal_False ),
+ mxPrjMode(drawing::ProjectionMode_PERSPECTIVE),
+ mnDistance(1000),
+ mnFocalLength(1000),
+ mnShadowSlant(0),
+ mxShadeMode(drawing::ShadeMode_SMOOTH),
+ maAmbientColor(0x00666666),
+ mbLightingMode(false),
+ maVRP(0.0, 0.0, 1.0),
+ maVPN(0.0, 0.0, 1.0),
+ maVUP(0.0, 1.0, 0.0),
+ mbVRPUsed(sal_False),
+ mbVPNUsed(sal_False),
+ mbVUPUsed(sal_False)
+{
+}
+
+SdXML3DSceneAttributesHelper::~SdXML3DSceneAttributesHelper()
+{
+ // release remembered light contexts, they are no longer needed
+ for ( size_t i = maList.size(); i > 0; )
+ maList[ --i ]->ReleaseRef();
+ maList.clear();
+}
+
+/** creates a 3d ligth context and adds it to the internal list for later processing */
+SvXMLImportContext * SdXML3DSceneAttributesHelper::create3DLightContext( sal_uInt16 nPrfx, const rtl::OUString& rLName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList)
+{
+ SvXMLImportContext* pContext = new SdXML3DLightContext(mrImport, nPrfx, rLName, xAttrList);
+
+ // remember SdXML3DLightContext for later evaluation
+ if(pContext)
+ {
+ pContext->AddRef();
+ maList.push_back( (SdXML3DLightContext*)pContext );
+ }
+
+ return pContext;
+}
+
+/** this should be called for each scene attribute */
+void SdXML3DSceneAttributesHelper::processSceneAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ if( XML_NAMESPACE_DR3D == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_TRANSFORM ) )
+ {
+ SdXMLImExTransform3D aTransform(rValue, mrImport.GetMM100UnitConverter());
+ if(aTransform.NeedsAction())
+ mbSetTransform = aTransform.GetFullHomogenTransform(mxHomMat);
+ return;
+ }
+ else if( IsXMLToken( rLocalName, XML_VRP ) )
+ {
+ ::basegfx::B3DVector aNewVec;
+ mrImport.GetMM100UnitConverter().convertB3DVector(aNewVec, rValue);
+
+ if(aNewVec != maVRP)
+ {
+ maVRP = aNewVec;
+ mbVRPUsed = sal_True;
+ }
+ return;
+ }
+ else if( IsXMLToken( rLocalName, XML_VPN ) )
+ {
+ ::basegfx::B3DVector aNewVec;
+ mrImport.GetMM100UnitConverter().convertB3DVector(aNewVec, rValue);
+
+ if(aNewVec != maVPN)
+ {
+ maVPN = aNewVec;
+ mbVPNUsed = sal_True;
+ }
+ return;
+ }
+ else if( IsXMLToken( rLocalName, XML_VUP ) )
+ {
+ ::basegfx::B3DVector aNewVec;
+ mrImport.GetMM100UnitConverter().convertB3DVector(aNewVec, rValue);
+
+ if(aNewVec != maVUP)
+ {
+ maVUP = aNewVec;
+ mbVUPUsed = sal_True;
+ }
+ return;
+ }
+ else if( IsXMLToken( rLocalName, XML_PROJECTION ) )
+ {
+ if( IsXMLToken( rValue, XML_PARALLEL ) )
+ mxPrjMode = drawing::ProjectionMode_PARALLEL;
+ else
+ mxPrjMode = drawing::ProjectionMode_PERSPECTIVE;
+ return;
+ }
+ else if( IsXMLToken( rLocalName, XML_DISTANCE ) )
+ {
+ mrImport.GetMM100UnitConverter().convertMeasure(mnDistance, rValue);
+ return;
+ }
+ else if( IsXMLToken( rLocalName, XML_FOCAL_LENGTH ) )
+ {
+ mrImport.GetMM100UnitConverter().convertMeasure(mnFocalLength, rValue);
+ return;
+ }
+ else if( IsXMLToken( rLocalName, XML_SHADOW_SLANT ) )
+ {
+ mrImport.GetMM100UnitConverter().convertNumber(mnShadowSlant, rValue);
+ return;
+ }
+ else if( IsXMLToken( rLocalName, XML_SHADE_MODE ) )
+ {
+ if( IsXMLToken( rValue, XML_FLAT ) )
+ mxShadeMode = drawing::ShadeMode_FLAT;
+ else if( IsXMLToken( rValue, XML_PHONG ) )
+ mxShadeMode = drawing::ShadeMode_PHONG;
+ else if( IsXMLToken( rValue, XML_GOURAUD ) )
+ mxShadeMode = drawing::ShadeMode_SMOOTH;
+ else
+ mxShadeMode = drawing::ShadeMode_DRAFT;
+ return;
+ }
+ else if( IsXMLToken( rLocalName, XML_AMBIENT_COLOR ) )
+ {
+ mrImport.GetMM100UnitConverter().convertColor(maAmbientColor, rValue);
+ return;
+ }
+ else if( IsXMLToken( rLocalName, XML_LIGHTING_MODE ) )
+ {
+ mrImport.GetMM100UnitConverter().convertBool(mbLightingMode, rValue);
+ return;
+ }
+ }
+}
+
+/** this sets the scene attributes at this propertyset */
+void SdXML3DSceneAttributesHelper::setSceneAttributes( const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xPropSet )
+{
+ uno::Any aAny;
+
+ // world transformation
+ if(mbSetTransform)
+ {
+ aAny <<= mxHomMat;
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DTransformMatrix")), aAny);
+ }
+
+ // distance
+ aAny <<= mnDistance;
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneDistance")), aAny);
+
+ // focalLength
+ aAny <<= mnFocalLength;
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneFocalLength")), aAny);
+
+ // shadowSlant
+ aAny <<= (sal_Int16)mnShadowSlant;
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneShadowSlant")), aAny);
+
+ // shadeMode
+ aAny <<= mxShadeMode;
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneShadeMode")), aAny);
+
+ // ambientColor
+ aAny <<= maAmbientColor.GetColor();
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneAmbientColor")), aAny);
+
+ // lightingMode
+ aAny <<= mbLightingMode;
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneTwoSidedLighting")), aAny);
+
+ if( !maList.empty() )
+ {
+ uno::Any aAny2;
+ uno::Any aAny3;
+
+ // set lights
+ for( size_t a = 0; a < maList.size(); a++)
+ {
+ SdXML3DLightContext* pCtx = (SdXML3DLightContext*)maList[ a ];
+
+ // set anys
+ aAny <<= pCtx->GetDiffuseColor().GetColor();
+ drawing::Direction3D xLightDir;
+ xLightDir.DirectionX = pCtx->GetDirection().getX();
+ xLightDir.DirectionY = pCtx->GetDirection().getY();
+ xLightDir.DirectionZ = pCtx->GetDirection().getZ();
+ aAny2 <<= xLightDir;
+ aAny3 <<= pCtx->GetEnabled();
+
+ switch(a)
+ {
+ case 0:
+ {
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor1")), aAny);
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection1")), aAny2);
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn1")), aAny3);
+ break;
+ }
+ case 1:
+ {
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor2")), aAny);
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection2")), aAny2);
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn2")), aAny3);
+ break;
+ }
+ case 2:
+ {
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor3")), aAny);
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection3")), aAny2);
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn3")), aAny3);
+ break;
+ }
+ case 3:
+ {
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor4")), aAny);
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection4")), aAny2);
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn4")), aAny3);
+ break;
+ }
+ case 4:
+ {
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor5")), aAny);
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection5")), aAny2);
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn5")), aAny3);
+ break;
+ }
+ case 5:
+ {
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor6")), aAny);
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection6")), aAny2);
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn6")), aAny3);
+ break;
+ }
+ case 6:
+ {
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor7")), aAny);
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection7")), aAny2);
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn7")), aAny3);
+ break;
+ }
+ case 7:
+ {
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor8")), aAny);
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection8")), aAny2);
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn8")), aAny3);
+ break;
+ }
+ }
+ }
+ }
+
+ // CameraGeometry and camera settings
+ drawing::CameraGeometry aCamGeo;
+ aCamGeo.vrp.PositionX = maVRP.getX();
+ aCamGeo.vrp.PositionY = maVRP.getY();
+ aCamGeo.vrp.PositionZ = maVRP.getZ();
+ aCamGeo.vpn.DirectionX = maVPN.getX();
+ aCamGeo.vpn.DirectionY = maVPN.getY();
+ aCamGeo.vpn.DirectionZ = maVPN.getZ();
+ aCamGeo.vup.DirectionX = maVUP.getX();
+ aCamGeo.vup.DirectionY = maVUP.getY();
+ aCamGeo.vup.DirectionZ = maVUP.getZ();
+ aAny <<= aCamGeo;
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DCameraGeometry")), aAny);
+
+ // #91047# set drawing::ProjectionMode AFTER camera geometry is set
+ // projection "D3DScenePerspective" drawing::ProjectionMode
+ aAny <<= mxPrjMode;
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DScenePerspective")), aAny);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/ximp3dscene.hxx b/xmloff/source/draw/ximp3dscene.hxx
new file mode 100644
index 000000000000..7ed5d9363476
--- /dev/null
+++ b/xmloff/source/draw/ximp3dscene.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XIMP3DSCENE_HXX
+#define _XIMP3DSCENE_HXX
+
+#include <xmloff/xmlictxt.hxx>
+#include "sdxmlimp_impl.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <tools/rtti.hxx>
+#include <tools/color.hxx>
+#include <ximpshap.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// dr3d:3dscene context
+
+class SdXML3DSceneShapeContext : public SdXMLShapeContext, public SdXML3DSceneAttributesHelper
+{
+ // the shape group this group is working on
+ // this is the scene at the same time
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > mxChilds;
+
+ const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
+ SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
+
+protected:
+ void SetLocalShapesContext(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rNew)
+ { mxChilds = rNew; }
+
+public:
+ TYPEINFO();
+
+ SdXML3DSceneShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXML3DSceneShapeContext();
+
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+ virtual void EndElement();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+ const com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& GetLocalShapesContext() const
+ { return mxShapes; }
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& GetLocalShapesContext()
+ { return mxShapes; }
+};
+
+
+#endif // _XIMPGROUP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/ximpbody.cxx b/xmloff/source/draw/ximpbody.cxx
new file mode 100644
index 000000000000..38c82700e8e4
--- /dev/null
+++ b/xmloff/source/draw/ximpbody.cxx
@@ -0,0 +1,391 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "ximpbody.hxx"
+#include <xmloff/prstylei.hxx>
+#include "ximpnote.hxx"
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/drawing/XDrawPages.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/presentation/XPresentationPage.hpp>
+#include "ximpstyl.hxx"
+#include <com/sun/star/drawing/XMasterPageTarget.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
+
+#include "unointerfacetouniqueidentifiermapper.hxx"
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmlprmap.hxx>
+#include <xmloff/families.hxx>
+#include "ximpshow.hxx"
+#include "PropertySetMerger.hxx"
+#include "animationimport.hxx"
+#include <tools/string.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLDrawPageContext::SdXMLDrawPageContext( SdXMLImport& rImport,
+ sal_uInt16 nPrfx, const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes)
+: SdXMLGenericPageContext( rImport, nPrfx, rLocalName, xAttrList, rShapes )
+, mbHadSMILNodes( false )
+{
+ bool bHaveXmlId( false );
+ OUString sXmlId;
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetSdImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ OUString sValue = xAttrList->getValueByIndex( i );
+ const SvXMLTokenMap& rAttrTokenMap = GetSdImport().GetDrawPageAttrTokenMap();
+
+ switch(rAttrTokenMap.Get(nPrefix, aLocalName))
+ {
+ case XML_TOK_DRAWPAGE_NAME:
+ {
+ maName = sValue;
+ break;
+ }
+ case XML_TOK_DRAWPAGE_STYLE_NAME:
+ {
+ maStyleName = sValue;
+ break;
+ }
+ case XML_TOK_DRAWPAGE_MASTER_PAGE_NAME:
+ {
+ maMasterPageName = sValue;
+ break;
+ }
+ case XML_TOK_DRAWPAGE_PAGE_LAYOUT_NAME:
+ {
+ maPageLayoutName = sValue;
+ break;
+ }
+ case XML_TOK_DRAWPAGE_USE_HEADER_NAME:
+ {
+ maUseHeaderDeclName = sValue;
+ break;
+ }
+ case XML_TOK_DRAWPAGE_USE_FOOTER_NAME:
+ {
+ maUseFooterDeclName = sValue;
+ break;
+ }
+ case XML_TOK_DRAWPAGE_USE_DATE_TIME_NAME:
+ {
+ maUseDateTimeDeclName = sValue;
+ break;
+ }
+ case XML_TOK_DRAWPAGE_DRAWID:
+ {
+ if (!bHaveXmlId) { sXmlId = sValue; }
+ }
+ break;
+ case XML_TOK_DRAWPAGE_XMLID:
+ {
+ sXmlId = sValue;
+ bHaveXmlId = true;
+ }
+ break;
+ case XML_TOK_DRAWPAGE_HREF:
+ {
+ maHREF = sValue;
+ break;
+ }
+ }
+ }
+
+ if (sXmlId.getLength())
+ {
+ uno::Reference< uno::XInterface > const xRef( rShapes.get() );
+ GetImport().getInterfaceToIdentifierMapper().registerReference(
+ sXmlId, xRef );
+ }
+ GetImport().GetShapeImport()->startPage( rShapes );
+
+ uno::Reference< drawing::XDrawPage > xShapeDrawPage(rShapes, uno::UNO_QUERY);
+
+ // set PageName?
+ if(maName.getLength())
+ {
+ if(xShapeDrawPage.is())
+ {
+ uno::Reference < container::XNamed > xNamed(xShapeDrawPage, uno::UNO_QUERY);
+ if(xNamed.is())
+ xNamed->setName(maName);
+ }
+ }
+
+ // set MasterPage?
+ if(maMasterPageName.getLength())
+ {
+ // #85906# Code for setting masterpage needs complete rework
+ // since GetSdImport().GetMasterStylesContext() gives always ZERO
+ // because of content/style file split. Now the nechanism is to
+ // compare the wanted masterpage-name with the existing masterpages
+ // which were loaded and created in the styles section loading.
+ uno::Reference< drawing::XDrawPages > xMasterPages(GetSdImport().GetLocalMasterPages(), uno::UNO_QUERY);
+ uno::Reference < drawing::XMasterPageTarget > xDrawPage(rShapes, uno::UNO_QUERY);
+ uno::Reference< drawing::XDrawPage > xMasterPage;
+
+ if(xDrawPage.is() && xMasterPages.is())
+ {
+ sal_Bool bDone(sal_False);
+ OUString sDisplayName( rImport.GetStyleDisplayName(
+ XML_STYLE_FAMILY_MASTER_PAGE, maMasterPageName ) );
+
+ for(sal_Int32 a = 0; !bDone && a < xMasterPages->getCount(); a++)
+ {
+ uno::Any aAny(xMasterPages->getByIndex(a));
+ aAny >>= xMasterPage;
+
+ if(xMasterPage.is())
+ {
+ uno::Reference < container::XNamed > xMasterNamed(xMasterPage, uno::UNO_QUERY);
+ if(xMasterNamed.is())
+ {
+ OUString sMasterPageName = xMasterNamed->getName();
+
+ if(sMasterPageName.getLength() &&
+ sMasterPageName.equals(sDisplayName))
+ {
+ xDrawPage->setMasterPage(xMasterPage);
+ bDone = sal_True;
+ }
+ }
+ }
+ }
+
+ DBG_ASSERT( bDone, "xmloff::SdXMLDrawPageContext::SdXMLDrawPageContext(), could not find a slide master!" );
+ }
+ }
+
+ SetStyle( maStyleName );
+
+ if( maHREF.getLength() )
+ {
+ uno::Reference< beans::XPropertySet > xProps( xShapeDrawPage, uno::UNO_QUERY );
+ if( xProps.is() )
+ {
+ sal_Int32 nIndex = maHREF.lastIndexOf( (sal_Unicode)'#' );
+ if( nIndex != -1 )
+ {
+ OUString aFileName( maHREF.copy( 0, nIndex ) );
+ OUString aBookmarkName( maHREF.copy( nIndex+1 ) );
+
+ maHREF = GetImport().GetAbsoluteReference( aFileName );
+ maHREF += String( (sal_Unicode)'#' );
+ maHREF += aBookmarkName;
+ }
+
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "BookmarkURL" ) ), uno::makeAny( maHREF ) );
+ }
+ }
+
+ SetLayout();
+
+ DeleteAllShapes();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLDrawPageContext::~SdXMLDrawPageContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLImportContext *SdXMLDrawPageContext::CreateChildContext( sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList )
+{
+ SvXMLImportContext *pContext = 0L;
+ const SvXMLTokenMap& rTokenMap = GetSdImport().GetDrawPageElemTokenMap();
+
+ // some special objects inside draw:page context
+ switch(rTokenMap.Get(nPrefix, rLocalName))
+ {
+ case XML_TOK_DRAWPAGE_NOTES:
+ {
+ if( GetSdImport().IsImpress() )
+ {
+ // get notes page
+ uno::Reference< presentation::XPresentationPage > xPresPage(GetLocalShapesContext(), uno::UNO_QUERY);
+ if(xPresPage.is())
+ {
+ uno::Reference< drawing::XDrawPage > xNotesDrawPage(xPresPage->getNotesPage(), uno::UNO_QUERY);
+ if(xNotesDrawPage.is())
+ {
+ uno::Reference< drawing::XShapes > xNewShapes(xNotesDrawPage, uno::UNO_QUERY);
+ if(xNewShapes.is())
+ {
+ // presentation:notes inside draw:page context
+ pContext = new SdXMLNotesContext( GetSdImport(), nPrefix, rLocalName, xAttrList, xNewShapes);
+ }
+ }
+ }
+ }
+ break;
+ }
+ case XML_TOK_DRAWPAGE_PAR:
+ case XML_TOK_DRAWPAGE_SEQ:
+ {
+ if( GetSdImport().IsImpress() )
+ {
+ uno::Reference< animations::XAnimationNodeSupplier > xNodeSupplier(GetLocalShapesContext(), uno::UNO_QUERY);
+ if(xNodeSupplier.is())
+ {
+ pContext = new xmloff::AnimationNodeContext( xNodeSupplier->getAnimationNode(), GetSdImport(), nPrefix, rLocalName, xAttrList );
+ mbHadSMILNodes = true;
+ }
+ }
+ break;
+ }
+ }
+
+ // call parent when no own context was created
+ if(!pContext)
+ pContext = SdXMLGenericPageContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
+
+ return pContext;
+}
+
+void SdXMLDrawPageContext::EndElement()
+{
+ SdXMLGenericPageContext::EndElement();
+ GetImport().GetShapeImport()->endPage(GetLocalShapesContext());
+
+ if( mbHadSMILNodes )
+ {
+ uno::Reference< animations::XAnimationNodeSupplier > xNodeSupplier(GetLocalShapesContext(), uno::UNO_QUERY);
+ uno::Reference< beans::XPropertySet > xPageProps( GetLocalShapesContext(), uno::UNO_QUERY );
+ if(xNodeSupplier.is())
+ xmloff::AnimationNodeContext::postProcessRootNode( GetSdImport(), xNodeSupplier->getAnimationNode(), xPageProps );
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLBodyContext::SdXMLBodyContext( SdXMLImport& rImport,
+ sal_uInt16 nPrfx, const OUString& rLocalName )
+: SvXMLImportContext( rImport, nPrfx, rLocalName )
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLBodyContext::~SdXMLBodyContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLImportContext *SdXMLBodyContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList>& xAttrList )
+{
+ SvXMLImportContext *pContext = 0L;
+ const SvXMLTokenMap& rTokenMap = GetSdImport().GetBodyElemTokenMap();
+
+ switch(rTokenMap.Get(nPrefix, rLocalName))
+ {
+ case XML_TOK_BODY_HEADER_DECL:
+ case XML_TOK_BODY_FOOTER_DECL:
+ case XML_TOK_BODY_DATE_TIME_DECL:
+ {
+ pContext = new SdXMLHeaderFooterDeclContext( GetImport(), nPrefix, rLocalName, xAttrList );
+ break;
+ }
+ case XML_TOK_BODY_PAGE:
+ {
+ // only read the first page in preview mode
+ if( (GetSdImport().GetNewPageCount() == 0) || !GetSdImport().IsPreview() )
+ {
+ // import this page
+ uno::Reference< drawing::XDrawPage > xNewDrawPage;
+ uno::Reference< drawing::XDrawPages > xDrawPages(GetSdImport().GetLocalDrawPages(), uno::UNO_QUERY);
+
+ if( !xDrawPages.is() )
+ break;
+
+ if(GetSdImport().GetNewPageCount() + 1 > xDrawPages->getCount())
+ {
+ // new page, create and insert
+ xNewDrawPage = xDrawPages->insertNewByIndex(xDrawPages->getCount());
+ }
+ else
+ {
+ // existing page, use it
+ uno::Any aAny(xDrawPages->getByIndex(GetSdImport().GetNewPageCount()));
+ aAny >>= xNewDrawPage;
+ }
+
+ // increment global import page counter
+ GetSdImport().IncrementNewPageCount();
+
+ if(xNewDrawPage.is())
+ {
+ uno::Reference< drawing::XShapes > xNewShapes(xNewDrawPage, uno::UNO_QUERY);
+ if(xNewShapes.is())
+ {
+ // draw:page inside office:body context
+ pContext = new SdXMLDrawPageContext(GetSdImport(), nPrefix, rLocalName, xAttrList,
+ xNewShapes);
+ }
+ }
+ }
+ break;
+ }
+ case XML_TOK_BODY_SETTINGS:
+ {
+ pContext = new SdXMLShowsContext( GetSdImport(), nPrefix, rLocalName, xAttrList );
+ }
+ }
+
+ // call parent when no own context was created
+ if(!pContext)
+ pContext = SvXMLImportContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
+
+ return pContext;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/ximpbody.hxx b/xmloff/source/draw/ximpbody.hxx
new file mode 100644
index 000000000000..28fa1a985e0a
--- /dev/null
+++ b/xmloff/source/draw/ximpbody.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XIMPBODY_HXX
+#define _XIMPBODY_HXX
+
+#include <xmloff/xmlictxt.hxx>
+#include "sdxmlimp_impl.hxx"
+#include <xmloff/nmspmap.hxx>
+#include "ximppage.hxx"
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:page context
+
+class SdXMLDrawPageContext : public SdXMLGenericPageContext
+{
+ rtl::OUString maName;
+ rtl::OUString maMasterPageName;
+ rtl::OUString maStyleName;
+ rtl::OUString maHREF;
+
+ bool mbHadSMILNodes;
+public:
+ SdXMLDrawPageContext( SdXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes);
+ virtual ~SdXMLDrawPageContext();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+ virtual void EndElement();
+
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// office:body context
+
+class SdXMLBodyContext : public SvXMLImportContext
+{
+ const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
+ SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
+
+public:
+ SdXMLBodyContext( SdXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLocalName );
+ virtual ~SdXMLBodyContext();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+};
+
+
+#endif // _XIMPBODY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/ximpcustomshape.cxx b/xmloff/source/draw/ximpcustomshape.cxx
new file mode 100644
index 000000000000..c593cab5cafa
--- /dev/null
+++ b/xmloff/source/draw/ximpcustomshape.cxx
@@ -0,0 +1,1399 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "ximpcustomshape.hxx"
+#include "ximpshap.hxx"
+#include "xmlehelp.hxx"
+#include <rtl/math.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <xmloff/xmltoken.hxx>
+#include "EnhancedCustomShapeToken.hxx"
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmltkmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "xexptran.hxx"
+#include "xmloff/xmlerror.hxx"
+#include <tools/debug.hxx>
+#include <com/sun/star/drawing/Direction3D.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeTextPathMode.hpp>
+#include <com/sun/star/drawing/ProjectionMode.hpp>
+#include <boost/unordered_map.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+using namespace ::xmloff::EnhancedCustomShapeToken;
+
+TYPEINIT1( XMLEnhancedCustomShapeContext, SvXMLImportContext );
+
+XMLEnhancedCustomShapeContext::XMLEnhancedCustomShapeContext( SvXMLImport& rImport,
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape,
+ sal_uInt16 nPrefix, const rtl::OUString& rLocalName,
+ std::vector< com::sun::star::beans::PropertyValue >& rCustomShapeGeometry ) :
+ SvXMLImportContext( rImport, nPrefix, rLocalName ),
+ mrUnitConverter( rImport.GetMM100UnitConverter() ),
+ mrxShape( rxShape ),
+ mrCustomShapeGeometry( rCustomShapeGeometry )
+{
+}
+
+const SvXMLEnumMapEntry aXML_GluePointEnumMap[] =
+{
+ { XML_NONE, 0 },
+ { XML_SEGMENTS, 1 },
+ { XML_NONE, 2 },
+ { XML_RECTANGLE, 3 },
+ { XML_TOKEN_INVALID, 0 }
+};
+void GetBool( std::vector< com::sun::star::beans::PropertyValue >& rDest,
+ const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp )
+{
+ bool bAttrBool;
+ if ( SvXMLUnitConverter::convertBool( bAttrBool, rValue ) )
+ {
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( eDestProp );
+ aProp.Value <<= bAttrBool;
+ rDest.push_back( aProp );
+ }
+}
+
+void GetInt32( std::vector< com::sun::star::beans::PropertyValue >& rDest,
+ const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp )
+{
+ sal_Int32 nAttrNumber;
+ if ( SvXMLUnitConverter::convertNumber( nAttrNumber, rValue ) )
+ {
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( eDestProp );
+ aProp.Value <<= nAttrNumber;
+ rDest.push_back( aProp );
+ }
+}
+
+void GetDouble( std::vector< com::sun::star::beans::PropertyValue >& rDest,
+ const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp )
+{
+ double fAttrDouble;
+ if ( SvXMLUnitConverter::convertDouble( fAttrDouble, rValue ) )
+ {
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( eDestProp );
+ aProp.Value <<= fAttrDouble;
+ rDest.push_back( aProp );
+ }
+}
+
+void GetDistance( std::vector< com::sun::star::beans::PropertyValue >& rDest,
+ const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp )
+{
+ double fAttrDouble;
+ MapUnit eSrcUnit( SvXMLExportHelper::GetUnitFromString( rValue, MAP_100TH_MM ) );
+ if ( SvXMLUnitConverter::convertDouble( fAttrDouble, rValue, eSrcUnit, MAP_100TH_MM ) )
+ {
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( eDestProp );
+ aProp.Value <<= fAttrDouble;
+ rDest.push_back( aProp );
+ }
+}
+
+void GetString( std::vector< com::sun::star::beans::PropertyValue >& rDest,
+ const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp )
+{
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( eDestProp );
+ aProp.Value <<= rValue;
+ rDest.push_back( aProp );
+}
+
+void GetEnum( std::vector< com::sun::star::beans::PropertyValue >& rDest,
+ const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp,
+ const SvXMLEnumMapEntry& rMap )
+{
+ sal_uInt16 eKind;
+ if( SvXMLUnitConverter::convertEnum( eKind, rValue, &rMap ) )
+ {
+ sal_Int16 nEnum = (sal_Int16)eKind;
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( eDestProp );
+ aProp.Value <<= nEnum;
+ rDest.push_back( aProp );
+ }
+}
+
+void GetDoublePercentage( std::vector< com::sun::star::beans::PropertyValue >& rDest,
+ const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp )
+{
+ MapUnit eSrcUnit = SvXMLExportHelper::GetUnitFromString( rValue, MAP_100TH_MM );
+ if ( eSrcUnit == MAP_RELATIVE )
+ {
+ rtl_math_ConversionStatus eStatus;
+ double fAttrDouble = ::rtl::math::stringToDouble( rValue,
+ (sal_Unicode)('.'), (sal_Unicode)(','), &eStatus, NULL );
+ if ( eStatus == rtl_math_ConversionStatus_Ok )
+ {
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( eDestProp );
+ aProp.Value <<= fAttrDouble;
+ rDest.push_back( aProp );
+ }
+ }
+}
+
+void GetB3DVector( std::vector< com::sun::star::beans::PropertyValue >& rDest,
+ const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp )
+{
+ ::basegfx::B3DVector aB3DVector;
+ if ( SvXMLUnitConverter::convertB3DVector( aB3DVector, rValue ) )
+ {
+ drawing::Direction3D aDirection3D( aB3DVector.getX(), aB3DVector.getY(), aB3DVector.getZ() );
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( eDestProp );
+ aProp.Value <<= aDirection3D;
+ rDest.push_back( aProp );
+ }
+}
+
+sal_Bool GetEquationName( const rtl::OUString& rEquation, const sal_Int32 nStart, rtl::OUString& rEquationName )
+{
+ sal_Int32 nIndex = nStart;
+ while( nIndex < rEquation.getLength() )
+ {
+ sal_Unicode nChar = rEquation[ nIndex ];
+ if (
+ ( ( nChar >= 'a' ) && ( nChar <= 'z' ) )
+ || ( ( nChar >= 'A' ) && ( nChar <= 'Z' ) )
+ || ( ( nChar >= '0' ) && ( nChar <= '9' ) )
+ )
+ {
+ nIndex++;
+ }
+ else
+ break;
+ }
+ sal_Bool bValid = ( nIndex - nStart ) != 0;
+ if ( bValid )
+ rEquationName = rEquation.copy( nStart, nIndex - nStart );
+ return bValid;
+}
+
+sal_Bool GetNextParameter( com::sun::star::drawing::EnhancedCustomShapeParameter& rParameter, sal_Int32& nIndex, const rtl::OUString& rParaString )
+{
+ if ( nIndex >= rParaString.getLength() )
+ return sal_False;
+
+ sal_Bool bValid = sal_True;
+ sal_Bool bNumberRequired = sal_True;
+ sal_Bool bMustBePositiveWholeNumbered = sal_False;
+
+ rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::NORMAL;
+ if ( rParaString[ nIndex ] == (sal_Unicode)'$' )
+ {
+ rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::ADJUSTMENT;
+ bMustBePositiveWholeNumbered = sal_True;
+ nIndex++;
+ }
+ else if ( rParaString[ nIndex ] == (sal_Unicode)'?' )
+ {
+ nIndex++;
+ bNumberRequired = sal_False;
+ rtl::OUString aEquationName;
+ bValid = GetEquationName( rParaString, nIndex, aEquationName );
+ if ( bValid )
+ {
+ rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::EQUATION;
+ rParameter.Value <<= aEquationName;
+ nIndex += aEquationName.getLength();
+ }
+ }
+ else if ( rParaString[ nIndex ] > (sal_Unicode)'9' )
+ {
+ bNumberRequired = sal_False;
+ if ( rParaString.matchIgnoreAsciiCaseAsciiL( "left", 4, nIndex ) )
+ {
+ rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::LEFT;
+ nIndex += 4;
+ }
+ else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "top", 3, nIndex ) )
+ {
+ rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::TOP;
+ nIndex += 3;
+ }
+ else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "right", 5, nIndex ) )
+ {
+ rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::RIGHT;
+ nIndex += 5;
+ }
+ else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "bottom", 6, nIndex ) )
+ {
+ rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::BOTTOM;
+ nIndex += 6;
+ }
+ else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "xstretch", 8, nIndex ) )
+ {
+ rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::XSTRETCH;
+ nIndex += 8;
+ }
+ else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "ystretch", 8, nIndex ) )
+ {
+ rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::YSTRETCH;
+ nIndex += 8;
+ }
+ else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "hasstroke", 9, nIndex ) )
+ {
+ rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::HASSTROKE;
+ nIndex += 9;
+ }
+ else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "hasfill", 7, nIndex ) )
+ {
+ rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::HASFILL;
+ nIndex += 7;
+ }
+ else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "width", 5, nIndex ) )
+ {
+ rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::WIDTH;
+ nIndex += 5;
+ }
+ else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "height", 6, nIndex ) )
+ {
+ rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::HEIGHT;
+ nIndex += 6;
+ }
+ else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "logwidth", 8, nIndex ) )
+ {
+ rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::LOGWIDTH;
+ nIndex += 8;
+ }
+ else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "logheight", 9, nIndex ) )
+ {
+ rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::LOGHEIGHT;
+ nIndex += 9;
+ }
+ else
+ bValid = sal_False;
+ }
+ if ( bValid )
+ {
+ if ( bNumberRequired )
+ {
+ sal_Int32 nStartIndex = nIndex;
+ sal_Int32 nEIndex = 0; // index of "E" in double
+
+ sal_Bool bE = sal_False; // set if a double is including a "E" statement
+ sal_Bool bENum = sal_False; // there is at least one number after "E"
+ sal_Bool bDot = sal_False; // set if there is a dot included
+ sal_Bool bEnd = sal_False; // set for each value that can not be part of a double/integer
+
+ while( ( nIndex < rParaString.getLength() ) && bValid )
+ {
+ switch( rParaString[ nIndex ] )
+ {
+ case '.' :
+ {
+ if ( bMustBePositiveWholeNumbered )
+ bValid = sal_False;
+ else
+ {
+ if ( bDot )
+ bValid = sal_False;
+ else
+ bDot = sal_True;
+ }
+ }
+ break;
+ case '-' :
+ {
+ if ( bMustBePositiveWholeNumbered )
+ bValid = sal_False;
+ else
+ {
+ if ( nStartIndex == nIndex )
+ bValid = sal_True;
+ else if ( bE )
+ {
+ if ( nEIndex + 1 == nIndex )
+ bValid = sal_True;
+ else if ( bENum )
+ bEnd = sal_True;
+ else
+ bValid = sal_False;
+ }
+ }
+ }
+ break;
+
+ case 'e' :
+ case 'E' :
+ {
+ if ( bMustBePositiveWholeNumbered )
+ bEnd = sal_True;
+ else
+ {
+ if ( !bE )
+ {
+ bE = sal_True;
+ nEIndex = nIndex;
+ }
+ else
+ bEnd = sal_True;
+ }
+ }
+ break;
+ case '0' :
+ case '1' :
+ case '2' :
+ case '3' :
+ case '4' :
+ case '5' :
+ case '6' :
+ case '7' :
+ case '8' :
+ case '9' :
+ {
+ if ( bE && ! bENum )
+ bENum = sal_True;
+ }
+ break;
+ default:
+ bEnd = sal_True;
+ }
+ if ( !bEnd )
+ nIndex++;
+ else
+ break;
+ }
+ if ( nIndex == nStartIndex )
+ bValid = sal_False;
+ if ( bValid )
+ {
+ rtl::OUString aNumber( rParaString.copy( nStartIndex, nIndex - nStartIndex ) );
+ if ( bE || bDot )
+ {
+ double fAttrDouble;
+ if ( SvXMLUnitConverter::convertDouble( fAttrDouble, aNumber ) )
+ rParameter.Value <<= fAttrDouble;
+ else
+ bValid = sal_False;
+ }
+ else
+ {
+ sal_Int32 nValue;
+ if ( SvXMLUnitConverter::convertNumber( nValue, aNumber ) )
+ rParameter.Value <<= nValue;
+ else
+ bValid = sal_False;
+ }
+ }
+ }
+ }
+ if ( bValid )
+ { // skipping white spaces
+ while( ( nIndex < rParaString.getLength() ) && rParaString[ nIndex ] == (sal_Unicode)' ' )
+ nIndex++;
+ }
+ return bValid;
+}
+
+void GetPosition3D( std::vector< com::sun::star::beans::PropertyValue >& rDest, // e.g. draw:extrusion-viewpoint
+ const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp,
+ SvXMLUnitConverter& rUnitConverter )
+{
+ drawing::Position3D aPosition3D;
+ if ( rUnitConverter.convertPosition3D( aPosition3D, rValue ) )
+ {
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( eDestProp );
+ aProp.Value <<= aPosition3D;
+ rDest.push_back( aProp );
+ }
+}
+
+void GetDoubleSequence( std::vector< com::sun::star::beans::PropertyValue >& rDest, // e.g. draw:glue-point-leaving-directions
+ const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp )
+{
+ std::vector< double > vDirection;
+ sal_Int32 nIndex = 0;
+ do
+ {
+ double fAttrDouble;
+ rtl::OUString aToken( rValue.getToken( 0, ',', nIndex ) );
+ if ( !SvXMLUnitConverter::convertDouble( fAttrDouble, aToken ) )
+ break;
+ else
+ vDirection.push_back( fAttrDouble );
+ }
+ while ( nIndex >= 0 );
+
+ if ( !vDirection.empty() )
+ {
+ uno::Sequence< double > aDirectionsSeq( vDirection.size() );
+ std::vector< double >::const_iterator aIter = vDirection.begin();
+ std::vector< double >::const_iterator aEnd = vDirection.end();
+ double* pValues = aDirectionsSeq.getArray();
+
+ while ( aIter != aEnd )
+ *pValues++ = *aIter++;
+
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( eDestProp );
+ aProp.Value <<= aDirectionsSeq;
+ rDest.push_back( aProp );
+ }
+}
+
+void GetEnhancedParameter( std::vector< com::sun::star::beans::PropertyValue >& rDest, // e.g. draw:handle-position
+ const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp )
+{
+ sal_Int32 nIndex = 0;
+ com::sun::star::drawing::EnhancedCustomShapeParameter aParameter;
+ if ( GetNextParameter( aParameter, nIndex, rValue ) )
+ {
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( eDestProp );
+ aProp.Value <<= aParameter;
+ rDest.push_back( aProp );
+ }
+}
+
+void GetEnhancedParameterPair( std::vector< com::sun::star::beans::PropertyValue >& rDest, // e.g. draw:handle-position
+ const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp )
+{
+ sal_Int32 nIndex = 0;
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair aParameterPair;
+ if ( GetNextParameter( aParameterPair.First, nIndex, rValue )
+ && GetNextParameter( aParameterPair.Second, nIndex, rValue ) )
+ {
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( eDestProp );
+ aProp.Value <<= aParameterPair;
+ rDest.push_back( aProp );
+ }
+}
+
+sal_Int32 GetEnhancedParameterPairSequence( std::vector< com::sun::star::beans::PropertyValue >& rDest, // e.g. draw:glue-points
+ const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp )
+{
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeParameterPair > vParameter;
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair aParameter;
+
+ sal_Int32 nIndex = 0;
+ while ( GetNextParameter( aParameter.First, nIndex, rValue )
+ && GetNextParameter( aParameter.Second, nIndex, rValue ) )
+ {
+ vParameter.push_back( aParameter );
+ }
+ if ( !vParameter.empty() )
+ {
+ uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair > aParameterSeq( vParameter.size() );
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeParameterPair >::const_iterator aIter = vParameter.begin();
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeParameterPair >::const_iterator aEnd = vParameter.end();
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair* pValues = aParameterSeq.getArray();
+
+ while ( aIter != aEnd )
+ *pValues++ = *aIter++;
+
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( eDestProp );
+ aProp.Value <<= aParameterSeq;
+ rDest.push_back( aProp );
+ }
+ return vParameter.size();
+}
+
+void GetEnhancedRectangleSequence( std::vector< com::sun::star::beans::PropertyValue >& rDest, // e.g. draw:text-areas
+ const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp )
+{
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeTextFrame > vTextFrame;
+ com::sun::star::drawing::EnhancedCustomShapeTextFrame aParameter;
+
+ sal_Int32 nIndex = 0;
+
+ while ( GetNextParameter( aParameter.TopLeft.First, nIndex, rValue )
+ && GetNextParameter( aParameter.TopLeft.Second, nIndex, rValue )
+ && GetNextParameter( aParameter.BottomRight.First, nIndex, rValue )
+ && GetNextParameter( aParameter.BottomRight.Second, nIndex, rValue ) )
+ {
+ vTextFrame.push_back( aParameter );
+ }
+ if ( !vTextFrame.empty() )
+ {
+ uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeTextFrame > aTextFrameSeq( vTextFrame.size() );
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeTextFrame >::const_iterator aIter = vTextFrame.begin();
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeTextFrame >::const_iterator aEnd = vTextFrame.end();
+ com::sun::star::drawing::EnhancedCustomShapeTextFrame* pValues = aTextFrameSeq.getArray();
+
+ while ( aIter != aEnd )
+ *pValues++ = *aIter++;
+
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( eDestProp );
+ aProp.Value <<= aTextFrameSeq;
+ rDest.push_back( aProp );
+ }
+}
+
+void GetEnhancedPath( std::vector< com::sun::star::beans::PropertyValue >& rDest, // e.g. draw:enhanced-path
+ const rtl::OUString& rValue )
+{
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeParameterPair > vCoordinates;
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment > vSegments;
+
+ sal_Int32 nIndex = 0;
+ sal_Int32 nParameterCount = 0;
+
+ sal_Int32 nParametersNeeded = 1;
+ sal_Int16 nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::MOVETO;
+
+ sal_Bool bValid = sal_True;
+
+ while( bValid && ( nIndex < rValue.getLength() ) )
+ {
+ switch( rValue[ nIndex ] )
+ {
+ case 'M' :
+ {
+ nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::MOVETO;
+ nParametersNeeded = 1;
+ nIndex++;
+ }
+ break;
+ case 'L' :
+ {
+ nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::LINETO;
+ nParametersNeeded = 1;
+ nIndex++;
+ }
+ break;
+ case 'C' :
+ {
+ nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CURVETO;
+ nParametersNeeded = 3;
+ nIndex++;
+ }
+ break;
+ case 'Z' :
+ {
+ nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CLOSESUBPATH;
+ nParametersNeeded = 0;
+ nIndex++;
+ }
+ break;
+ case 'N' :
+ {
+ nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ENDSUBPATH;
+ nParametersNeeded = 0;
+ nIndex++;
+ }
+ break;
+ case 'F' :
+ {
+ nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::NOFILL;
+ nParametersNeeded = 0;
+ nIndex++;
+ }
+ break;
+ case 'S' :
+ {
+ nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::NOSTROKE;
+ nParametersNeeded = 0;
+ nIndex++;
+ }
+ break;
+ case 'T' :
+ {
+ nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ANGLEELLIPSETO;
+ nParametersNeeded = 3;
+ nIndex++;
+ }
+ break;
+ case 'U' :
+ {
+ nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ANGLEELLIPSE;
+ nParametersNeeded = 3;
+ nIndex++;
+ }
+ break;
+ case 'A' :
+ {
+ nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ARCTO;
+ nParametersNeeded = 4;
+ nIndex++;
+ }
+ break;
+ case 'B' :
+ {
+ nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ARC;
+ nParametersNeeded = 4;
+ nIndex++;
+ }
+ break;
+ case 'W' :
+ {
+ nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CLOCKWISEARCTO;
+ nParametersNeeded = 4;
+ nIndex++;
+ }
+ break;
+ case 'V' :
+ {
+ nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CLOCKWISEARC;
+ nParametersNeeded = 4;
+ nIndex++;
+ }
+ break;
+ case 'X' :
+ {
+ nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTX;
+ nParametersNeeded = 1;
+ nIndex++;
+ }
+ break;
+ case 'Y' :
+ {
+ nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTY;
+ nParametersNeeded = 1;
+ nIndex++;
+ }
+ break;
+ case 'Q' :
+ {
+ nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::QUADRATICCURVETO;
+ nParametersNeeded = 2;
+ nIndex++;
+ }
+ break;
+ case ' ' :
+ {
+ nIndex++;
+ }
+ break;
+
+ case '$' :
+ case '?' :
+ case '0' :
+ case '1' :
+ case '2' :
+ case '3' :
+ case '4' :
+ case '5' :
+ case '6' :
+ case '7' :
+ case '8' :
+ case '9' :
+ case '.' :
+ case '-' :
+ {
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair aPair;
+ if ( GetNextParameter( aPair.First, nIndex, rValue ) &&
+ GetNextParameter( aPair.Second, nIndex, rValue ) )
+ {
+ vCoordinates.push_back( aPair );
+ nParameterCount++;
+ }
+ else
+ bValid = sal_False;
+ }
+ break;
+ default:
+ nIndex++;
+ break;
+ }
+ if ( !nParameterCount && !nParametersNeeded )
+ {
+ com::sun::star::drawing::EnhancedCustomShapeSegment aSegment;
+ aSegment.Command = nLatestSegmentCommand;
+ aSegment.Count = 0;
+ vSegments.push_back( aSegment );
+ nParametersNeeded = 0x7fffffff;
+ }
+ else if ( nParameterCount >= nParametersNeeded )
+ {
+ // check if the last command is identical,
+ // if so, we just need to increment the count
+ if ( !vSegments.empty() && ( vSegments[ vSegments.size() - 1 ].Command == nLatestSegmentCommand ) )
+ vSegments[ vSegments.size() -1 ].Count++;
+ else
+ {
+ com::sun::star::drawing::EnhancedCustomShapeSegment aSegment;
+ aSegment.Command = nLatestSegmentCommand;
+ aSegment.Count = 1;
+ vSegments.push_back( aSegment );
+ }
+ nParameterCount = 0;
+ }
+ }
+ // adding the Coordinates property
+ uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair > seqCoordinates( vCoordinates.size() );
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeParameterPair >::const_iterator aCoordinatesIter = vCoordinates.begin();
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeParameterPair >::const_iterator aCoordinatesEnd = vCoordinates.end();
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair* pCoordinateValues = seqCoordinates.getArray();
+
+ while ( aCoordinatesIter != aCoordinatesEnd )
+ *pCoordinateValues++ = *aCoordinatesIter++;
+
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( EAS_Coordinates );
+ aProp.Value <<= seqCoordinates;
+ rDest.push_back( aProp );
+
+
+ // adding the Segments property
+ uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment > seqSegments( vSegments.size() );
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment >::const_iterator aSegmentsIter = vSegments.begin();
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment >::const_iterator aSegmentsEnd = vSegments.end();
+ com::sun::star::drawing::EnhancedCustomShapeSegment* pSegmentValues = seqSegments.getArray();
+
+ while ( aSegmentsIter != aSegmentsEnd )
+ *pSegmentValues++ = *aSegmentsIter++;
+
+ aProp.Name = EASGet( EAS_Segments );
+ aProp.Value <<= seqSegments;
+ rDest.push_back( aProp );
+}
+
+void GetAdjustmentValues( std::vector< com::sun::star::beans::PropertyValue >& rDest, // draw:adjustments
+ const rtl::OUString& rValue )
+{
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue > vAdjustmentValue;
+ com::sun::star::drawing::EnhancedCustomShapeParameter aParameter;
+ sal_Int32 nIndex = 0;
+ while ( GetNextParameter( aParameter, nIndex, rValue ) )
+ {
+ com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue aAdj;
+ if ( aParameter.Type == com::sun::star::drawing::EnhancedCustomShapeParameterType::NORMAL )
+ {
+ aAdj.Value <<= aParameter.Value;
+ aAdj.State = beans::PropertyState_DIRECT_VALUE;
+ }
+ else
+ aAdj.State = beans::PropertyState_DEFAULT_VALUE; // this should not be, but better than setting nothing
+
+ vAdjustmentValue.push_back( aAdj );
+ }
+
+ sal_Int32 nAdjustmentValues = vAdjustmentValue.size();
+ if ( nAdjustmentValues )
+ {
+ uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue > aAdjustmentValues( nAdjustmentValues );
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue >::const_iterator aIter = vAdjustmentValue.begin();
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue >::const_iterator aEnd = vAdjustmentValue.end();
+ com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue* pValues = aAdjustmentValues.getArray();
+
+ while ( aIter != aEnd )
+ *pValues++ = *aIter++;
+
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( EAS_AdjustmentValues );
+ aProp.Value <<= aAdjustmentValues;
+ rDest.push_back( aProp );
+ }
+}
+
+void XMLEnhancedCustomShapeContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ sal_Int16 nLength = xAttrList->getLength();
+ if ( nLength )
+ {
+ sal_Int32 nAttrNumber;
+ for( sal_Int16 nAttr = 0; nAttr < nLength; nAttr++ )
+ {
+ rtl::OUString aLocalName;
+ const rtl::OUString& rValue = xAttrList->getValueByIndex( nAttr );
+ /* sven fixme, this must be checked! sal_uInt16 nPrefix = */ GetImport().GetNamespaceMap().GetKeyByAttrName( xAttrList->getNameByIndex( nAttr ), &aLocalName );
+
+ switch( EASGet( aLocalName ) )
+ {
+ case EAS_type :
+ GetString( mrCustomShapeGeometry, rValue, EAS_Type );
+ break;
+ case EAS_mirror_horizontal :
+ GetBool( mrCustomShapeGeometry, rValue, EAS_MirroredX );
+ break;
+ case EAS_mirror_vertical :
+ GetBool( mrCustomShapeGeometry, rValue, EAS_MirroredY );
+ break;
+ case EAS_viewBox :
+ {
+ SdXMLImExViewBox aViewBox( rValue, GetImport().GetMM100UnitConverter() );
+ awt::Rectangle aRect( aViewBox.GetX(), aViewBox.GetY(), aViewBox.GetWidth(), aViewBox.GetHeight() );
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( EAS_ViewBox );
+ aProp.Value <<= aRect;
+ mrCustomShapeGeometry.push_back( aProp );
+ }
+ break;
+ case EAS_text_rotate_angle :
+ GetDouble( mrCustomShapeGeometry, rValue, EAS_TextRotateAngle );
+ break;
+ case EAS_extrusion_allowed :
+ GetBool( maPath, rValue, EAS_ExtrusionAllowed );
+ break;
+ case EAS_text_path_allowed :
+ GetBool( maPath, rValue, EAS_TextPathAllowed );
+ break;
+ case EAS_concentric_gradient_fill_allowed :
+ GetBool( maPath, rValue, EAS_ConcentricGradientFillAllowed );
+ break;
+ case EAS_extrusion :
+ GetBool( maExtrusion, rValue, EAS_Extrusion );
+ break;
+ case EAS_extrusion_brightness :
+ GetDoublePercentage( maExtrusion, rValue, EAS_Brightness );
+ break;
+ case EAS_extrusion_depth :
+ {
+ sal_Int32 nIndex = 0;
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair aParameterPair;
+ com::sun::star::drawing::EnhancedCustomShapeParameter& rDepth = aParameterPair.First;
+ com::sun::star::drawing::EnhancedCustomShapeParameter& rFraction = aParameterPair.Second;
+ if ( GetNextParameter( rDepth, nIndex, rValue ) )
+ {
+ // try to catch the unit for the depth
+ MapUnit eSrcUnit( SvXMLExportHelper::GetUnitFromString( rValue, MAP_100TH_MM ) );
+
+ rtl::OUStringBuffer aUnitStr;
+ double fFactor = SvXMLExportHelper::GetConversionFactor( aUnitStr, MAP_100TH_MM, eSrcUnit );
+ if ( ( fFactor != 1.0 ) && ( fFactor != 0.0 ) )
+ {
+ double fDepth(0.0);
+ if ( rDepth.Value >>= fDepth )
+ {
+ fDepth /= fFactor;
+ rDepth.Value <<= fDepth;
+ }
+ }
+ if ( rValue.matchIgnoreAsciiCase( rtl::OUString( aUnitStr ), nIndex ) )
+ nIndex += aUnitStr.getLength();
+
+ // skipping white spaces
+ while( ( nIndex < rValue.getLength() ) && rValue[ nIndex ] == (sal_Unicode)' ' )
+ nIndex++;
+
+ if ( GetNextParameter( rFraction, nIndex, rValue ) )
+ {
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( EAS_Depth );
+ aProp.Value <<= aParameterPair;
+ maExtrusion.push_back( aProp );
+ }
+ }
+ }
+ break;
+ case EAS_extrusion_diffusion :
+ GetDoublePercentage( maExtrusion, rValue, EAS_Diffusion );
+ break;
+ case EAS_extrusion_number_of_line_segments :
+ GetInt32( maExtrusion, rValue, EAS_NumberOfLineSegments );
+ break;
+ case EAS_extrusion_light_face :
+ GetBool( maExtrusion, rValue, EAS_LightFace );
+ break;
+ case EAS_extrusion_first_light_harsh :
+ GetBool( maExtrusion, rValue, EAS_FirstLightHarsh );
+ break;
+ case EAS_extrusion_second_light_harsh :
+ GetBool( maExtrusion, rValue, EAS_SecondLightHarsh );
+ break;
+ case EAS_extrusion_first_light_level :
+ GetDoublePercentage( maExtrusion, rValue, EAS_FirstLightLevel );
+ break;
+ case EAS_extrusion_second_light_level :
+ GetDoublePercentage( maExtrusion, rValue, EAS_SecondLightLevel );
+ break;
+ case EAS_extrusion_first_light_direction :
+ GetB3DVector( maExtrusion, rValue, EAS_FirstLightDirection );
+ break;
+ case EAS_extrusion_second_light_direction :
+ GetB3DVector( maExtrusion, rValue, EAS_SecondLightDirection );
+ break;
+ case EAS_extrusion_metal :
+ GetBool( maExtrusion, rValue, EAS_Metal );
+ break;
+ case EAS_shade_mode :
+ {
+ drawing::ShadeMode eShadeMode( drawing::ShadeMode_FLAT );
+ if( IsXMLToken( rValue, XML_PHONG ) )
+ eShadeMode = drawing::ShadeMode_PHONG;
+ else if ( IsXMLToken( rValue, XML_GOURAUD ) )
+ eShadeMode = drawing::ShadeMode_SMOOTH;
+ else if ( IsXMLToken( rValue, XML_DRAFT ) )
+ eShadeMode = drawing::ShadeMode_DRAFT;
+
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( EAS_ShadeMode );
+ aProp.Value <<= eShadeMode;
+ maExtrusion.push_back( aProp );
+ }
+ break;
+ case EAS_extrusion_rotation_angle :
+ GetEnhancedParameterPair( maExtrusion, rValue, EAS_RotateAngle );
+ break;
+ case EAS_extrusion_rotation_center :
+ GetB3DVector( maExtrusion, rValue, EAS_RotationCenter );
+ break;
+ case EAS_extrusion_shininess :
+ GetDoublePercentage( maExtrusion, rValue, EAS_Shininess );
+ break;
+ case EAS_extrusion_skew :
+ GetEnhancedParameterPair( maExtrusion, rValue, EAS_Skew );
+ break;
+ case EAS_extrusion_specularity :
+ GetDoublePercentage( maExtrusion, rValue, EAS_Specularity );
+ break;
+ case EAS_projection :
+ {
+ drawing::ProjectionMode eProjectionMode( drawing::ProjectionMode_PERSPECTIVE );
+ if( IsXMLToken( rValue, XML_PARALLEL ) )
+ eProjectionMode = drawing::ProjectionMode_PARALLEL;
+
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( EAS_ProjectionMode );
+ aProp.Value <<= eProjectionMode;
+ maExtrusion.push_back( aProp );
+ }
+ break;
+ case EAS_extrusion_viewpoint :
+ GetPosition3D( maExtrusion, rValue, EAS_ViewPoint, mrUnitConverter );
+ break;
+ case EAS_extrusion_origin :
+ GetEnhancedParameterPair( maExtrusion, rValue, EAS_Origin );
+ break;
+ case EAS_extrusion_color :
+ GetBool( maExtrusion, rValue, EAS_Color );
+ break;
+ case EAS_enhanced_path :
+ GetEnhancedPath( maPath, rValue );
+ break;
+ case EAS_path_stretchpoint_x :
+ {
+ if ( SvXMLUnitConverter::convertNumber( nAttrNumber, rValue ) )
+ {
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( EAS_StretchX );
+ aProp.Value <<= nAttrNumber;
+ maPath.push_back( aProp );
+ }
+ }
+ break;
+ case EAS_path_stretchpoint_y :
+ {
+ if ( SvXMLUnitConverter::convertNumber( nAttrNumber, rValue ) )
+ {
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( EAS_StretchY );
+ aProp.Value <<= nAttrNumber;
+ maPath.push_back( aProp );
+ }
+ }
+ break;
+ case EAS_text_areas :
+ GetEnhancedRectangleSequence( maPath, rValue, EAS_TextFrames );
+ break;
+ case EAS_glue_points :
+ {
+ sal_Int32 i, nPairs = GetEnhancedParameterPairSequence( maPath, rValue, EAS_GluePoints );
+ GetImport().GetShapeImport()->moveGluePointMapping( mrxShape, nPairs );
+ for ( i = 0; i < nPairs; i++ )
+ GetImport().GetShapeImport()->addGluePointMapping( mrxShape, i + 4, i + 4 );
+ }
+ break;
+ case EAS_glue_point_type :
+ GetEnum( maPath, rValue, EAS_GluePointType, *aXML_GluePointEnumMap );
+ break;
+ case EAS_glue_point_leaving_directions :
+ GetDoubleSequence( maPath, rValue, EAS_GluePointLeavingDirections );
+ break;
+ case EAS_text_path :
+ GetBool( maTextPath, rValue, EAS_TextPath );
+ break;
+ case EAS_text_path_mode :
+ {
+ com::sun::star::drawing::EnhancedCustomShapeTextPathMode eTextPathMode( com::sun::star::drawing::EnhancedCustomShapeTextPathMode_NORMAL );
+ if( IsXMLToken( rValue, XML_PATH ) )
+ eTextPathMode = com::sun::star::drawing::EnhancedCustomShapeTextPathMode_PATH;
+ else if ( IsXMLToken( rValue, XML_SHAPE ) )
+ eTextPathMode = com::sun::star::drawing::EnhancedCustomShapeTextPathMode_SHAPE;
+
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( EAS_TextPathMode );
+ aProp.Value <<= eTextPathMode;
+ maTextPath.push_back( aProp );
+ }
+ break;
+ case EAS_text_path_scale :
+ {
+ sal_Bool bScaleX = IsXMLToken( rValue, XML_SHAPE );
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( EAS_ScaleX );
+ aProp.Value <<= bScaleX;
+ maTextPath.push_back( aProp );
+ }
+ break;
+ case EAS_text_path_same_letter_heights :
+ GetBool( maTextPath, rValue, EAS_SameLetterHeights );
+ break;
+ case EAS_modifiers :
+ GetAdjustmentValues( mrCustomShapeGeometry, rValue );
+ break;
+ default:
+ break;
+ }
+ }
+ }
+}
+
+void SdXMLCustomShapePropertyMerge( std::vector< com::sun::star::beans::PropertyValue >& rPropVec,
+ const std::vector< beans::PropertyValues >& rElement,
+ const rtl::OUString& rElementName )
+{
+ if ( !rElement.empty() )
+ {
+ uno::Sequence< beans::PropertyValues > aPropSeq( rElement.size() );
+ std::vector< beans::PropertyValues >::const_iterator aIter = rElement.begin();
+ std::vector< beans::PropertyValues >::const_iterator aEnd = rElement.end();
+ beans::PropertyValues* pValues = aPropSeq.getArray();
+
+ while ( aIter != aEnd )
+ *pValues++ = *aIter++;
+
+ beans::PropertyValue aProp;
+ aProp.Name = rElementName;
+ aProp.Value <<= aPropSeq;
+ rPropVec.push_back( aProp );
+ }
+}
+
+void SdXMLCustomShapePropertyMerge( std::vector< com::sun::star::beans::PropertyValue >& rPropVec,
+ const std::vector< rtl::OUString >& rElement,
+ const rtl::OUString& rElementName )
+{
+ if ( !rElement.empty() )
+ {
+ uno::Sequence< rtl::OUString > aPropSeq( rElement.size() );
+ std::vector< rtl::OUString >::const_iterator aIter = rElement.begin();
+ std::vector< rtl::OUString >::const_iterator aEnd = rElement.end();
+ rtl::OUString* pValues = aPropSeq.getArray();
+
+ while ( aIter != aEnd )
+ *pValues++ = *aIter++;
+
+ beans::PropertyValue aProp;
+ aProp.Name = rElementName;
+ aProp.Value <<= aPropSeq;
+ rPropVec.push_back( aProp );
+ }
+}
+
+void SdXMLCustomShapePropertyMerge( std::vector< com::sun::star::beans::PropertyValue >& rPropVec,
+ const std::vector< com::sun::star::beans::PropertyValue >& rElement,
+ const rtl::OUString& rElementName )
+{
+ if ( !rElement.empty() )
+ {
+ uno::Sequence< beans::PropertyValue > aPropSeq( rElement.size() );
+ std::vector< beans::PropertyValue >::const_iterator aIter = rElement.begin();
+ std::vector< beans::PropertyValue >::const_iterator aEnd = rElement.end();
+ beans::PropertyValue* pValues = aPropSeq.getArray();
+
+ while ( aIter != aEnd )
+ *pValues++ = *aIter++;
+
+ beans::PropertyValue aProp;
+ aProp.Name = rElementName;
+ aProp.Value <<= aPropSeq;
+ rPropVec.push_back( aProp );
+ }
+}
+
+typedef boost::unordered_map< rtl::OUString, sal_Int32, rtl::OUStringHash, OUStringEqFunc> EquationHashMap;
+
+/* if rPara.Type is from type EnhancedCustomShapeParameterType::EQUATION, the name of the equation
+ will be converted from rtl::OUString to index */
+void CheckAndResolveEquationParameter( com::sun::star::drawing::EnhancedCustomShapeParameter& rPara, EquationHashMap* pH )
+{
+ if ( rPara.Type == com::sun::star::drawing::EnhancedCustomShapeParameterType::EQUATION )
+ {
+ rtl::OUString aEquationName;
+ if ( rPara.Value >>= aEquationName )
+ {
+ sal_Int32 nIndex = 0;
+ EquationHashMap::iterator aHashIter( pH->find( aEquationName ) );
+ if ( aHashIter != pH->end() )
+ nIndex = (*aHashIter).second;
+ rPara.Value <<= nIndex;
+ }
+ }
+}
+
+void XMLEnhancedCustomShapeContext::EndElement()
+{
+ // resolve properties that are indexing a Equation
+ if ( !maEquations.empty() )
+ {
+ // creating hash map containing the name and index of each equation
+ EquationHashMap* pH = new EquationHashMap;
+ std::vector< rtl::OUString >::iterator aEquationNameIter = maEquationNames.begin();
+ std::vector< rtl::OUString >::iterator aEquationNameEnd = maEquationNames.end();
+ while( aEquationNameIter != aEquationNameEnd )
+ {
+ (*pH)[ *aEquationNameIter ] = (sal_Int32)( aEquationNameIter - maEquationNames.begin() );
+ ++aEquationNameIter;
+ }
+
+ // resolve equation
+ std::vector< rtl::OUString >::iterator aEquationIter = maEquations.begin();
+ std::vector< rtl::OUString >::iterator aEquationEnd = maEquations.end();
+ while( aEquationIter != aEquationEnd )
+ {
+ sal_Int32 nIndexOf = 0;
+ do
+ {
+ nIndexOf = aEquationIter->indexOf( '?', nIndexOf );
+ if ( nIndexOf != -1 )
+ {
+ rtl::OUString aEquationName;
+ if ( GetEquationName( *aEquationIter, nIndexOf + 1, aEquationName ) )
+ {
+ // copying first characters inclusive '?'
+ rtl::OUString aNew( aEquationIter->copy( 0, nIndexOf + 1 ) );
+ sal_Int32 nIndex = 0;
+ EquationHashMap::iterator aHashIter( pH->find( aEquationName ) );
+ if ( aHashIter != pH->end() )
+ nIndex = (*aHashIter).second;
+ aNew += rtl::OUString::valueOf( nIndex );
+ aNew += aEquationIter->copy( nIndexOf + aEquationName.getLength() + 1 );
+ *aEquationIter = aNew;
+ }
+ nIndexOf++;
+ }
+ }
+ while( nIndexOf != -1 );
+ ++aEquationIter;
+ }
+
+ // Path
+ sal_Int32 i;
+ std::vector< beans::PropertyValue >::iterator aPathIter = maPath.begin();
+ std::vector< beans::PropertyValue >::iterator aPathEnd = maPath.end();
+ while ( aPathIter != aPathEnd )
+ {
+ switch( EASGet( aPathIter->Name ) )
+ {
+ case EAS_Coordinates :
+ case EAS_GluePoints :
+ {
+ uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair >& rSeq =
+ *((uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair >*)
+ aPathIter->Value.getValue());
+ for ( i = 0; i < rSeq.getLength(); i++ )
+ {
+ CheckAndResolveEquationParameter( rSeq[ i ].First, pH );
+ CheckAndResolveEquationParameter( rSeq[ i ].Second, pH );
+ }
+ }
+ break;
+ case EAS_TextFrames :
+ {
+ uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeTextFrame >& rSeq =
+ *((uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeTextFrame >*)
+ aPathIter->Value.getValue());
+ for ( i = 0; i < rSeq.getLength(); i++ )
+ {
+ CheckAndResolveEquationParameter( rSeq[ i ].TopLeft.First, pH );
+ CheckAndResolveEquationParameter( rSeq[ i ].TopLeft.Second, pH );
+ CheckAndResolveEquationParameter( rSeq[ i ].BottomRight.First, pH );
+ CheckAndResolveEquationParameter( rSeq[ i ].BottomRight.Second, pH );
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ ++aPathIter;
+ }
+ std::vector< beans::PropertyValues >::iterator aHandleIter = maHandles.begin();
+ std::vector< beans::PropertyValues >::iterator aHandleEnd = maHandles.end();
+ while ( aHandleIter != aHandleEnd )
+ {
+ beans::PropertyValue* pValues = aHandleIter->getArray();
+ for ( i = 0; i < aHandleIter->getLength(); i++ )
+ {
+ switch( EASGet( pValues->Name ) )
+ {
+ case EAS_RangeYMinimum :
+ case EAS_RangeYMaximum :
+ case EAS_RangeXMinimum :
+ case EAS_RangeXMaximum :
+ case EAS_RadiusRangeMinimum :
+ case EAS_RadiusRangeMaximum :
+ {
+ CheckAndResolveEquationParameter( *((com::sun::star::drawing::EnhancedCustomShapeParameter*)
+ pValues->Value.getValue()), pH );
+ }
+ break;
+
+ case EAS_Position :
+ case EAS_Polar :
+ {
+ CheckAndResolveEquationParameter( (*((com::sun::star::drawing::EnhancedCustomShapeParameterPair*)
+ pValues->Value.getValue())).First, pH );
+ CheckAndResolveEquationParameter( (*((com::sun::star::drawing::EnhancedCustomShapeParameterPair*)
+ pValues->Value.getValue())).Second, pH );
+ }
+ break;
+ default:
+ break;
+ }
+ pValues++;
+ }
+ ++aHandleIter;
+ }
+ delete pH;
+ }
+
+ SdXMLCustomShapePropertyMerge( mrCustomShapeGeometry, maExtrusion, EASGet( EAS_Extrusion ) );
+ SdXMLCustomShapePropertyMerge( mrCustomShapeGeometry, maPath, EASGet( EAS_Path ) );
+ SdXMLCustomShapePropertyMerge( mrCustomShapeGeometry, maTextPath, EASGet( EAS_TextPath ) );
+ SdXMLCustomShapePropertyMerge( mrCustomShapeGeometry, maEquations, EASGet( EAS_Equations ) );
+ if ( !maHandles.empty() )
+ SdXMLCustomShapePropertyMerge( mrCustomShapeGeometry, maHandles, EASGet( EAS_Handles ) );
+}
+
+SvXMLImportContext* XMLEnhancedCustomShapeContext::CreateChildContext( sal_uInt16 nPrefix,const rtl::OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList> & xAttrList )
+{
+ EnhancedCustomShapeTokenEnum aTokenEnum = EASGet( rLocalName );
+ if ( aTokenEnum == EAS_equation )
+ {
+ sal_Int16 nLength = xAttrList->getLength();
+ if ( nLength )
+ {
+ rtl::OUString aFormula;
+ rtl::OUString aFormulaName;
+ for( sal_Int16 nAttr = 0; nAttr < nLength; nAttr++ )
+ {
+ rtl::OUString aLocalName;
+ const rtl::OUString& rValue = xAttrList->getValueByIndex( nAttr );
+ /* fixme sven, this needs to be chekced! sal_uInt16 nPrefix = */ GetImport().GetNamespaceMap().GetKeyByAttrName( xAttrList->getNameByIndex( nAttr ), &aLocalName );
+
+ switch( EASGet( aLocalName ) )
+ {
+ case EAS_formula :
+ aFormula = rValue;
+ break;
+ case EAS_name :
+ aFormulaName = rValue;
+ break;
+ default:
+ break;
+ }
+ }
+ if ( aFormulaName.getLength() || aFormula.getLength() )
+ {
+ maEquations.push_back( aFormula );
+ maEquationNames.push_back( aFormulaName );
+ }
+ }
+ }
+ else if ( aTokenEnum == EAS_handle )
+ {
+ std::vector< com::sun::star::beans::PropertyValue > aHandle;
+ const sal_Int16 nLength = xAttrList->getLength();
+ for( sal_Int16 nAttr = 0; nAttr < nLength; nAttr++ )
+ {
+ rtl::OUString aLocalName;
+ const rtl::OUString& rValue = xAttrList->getValueByIndex( nAttr );
+ /* fixme sven, this needs to be chekced! sal_uInt16 nPrefix = */ GetImport().GetNamespaceMap().GetKeyByAttrName( xAttrList->getNameByIndex( nAttr ), &aLocalName );
+ switch( EASGet( aLocalName ) )
+ {
+ case EAS_handle_mirror_vertical :
+ GetBool( aHandle, rValue, EAS_MirroredY );
+ break;
+ case EAS_handle_mirror_horizontal :
+ GetBool( aHandle, rValue, EAS_MirroredX );
+ break;
+ case EAS_handle_switched :
+ GetBool( aHandle, rValue, EAS_Switched );
+ break;
+ case EAS_handle_position :
+ GetEnhancedParameterPair( aHandle, rValue, EAS_Position );
+ break;
+ case EAS_handle_range_x_minimum :
+ GetEnhancedParameter( aHandle, rValue, EAS_RangeXMinimum );
+ break;
+ case EAS_handle_range_x_maximum :
+ GetEnhancedParameter( aHandle, rValue, EAS_RangeXMaximum );
+ break;
+ case EAS_handle_range_y_minimum :
+ GetEnhancedParameter( aHandle, rValue, EAS_RangeYMinimum );
+ break;
+ case EAS_handle_range_y_maximum :
+ GetEnhancedParameter( aHandle, rValue, EAS_RangeYMaximum );
+ break;
+ case EAS_handle_polar :
+ GetEnhancedParameterPair( aHandle, rValue, EAS_Polar );
+ break;
+ case EAS_handle_radius_range_minimum :
+ GetEnhancedParameter( aHandle, rValue, EAS_RadiusRangeMinimum );
+ break;
+ case EAS_handle_radius_range_maximum :
+ GetEnhancedParameter( aHandle, rValue, EAS_RadiusRangeMaximum );
+ break;
+ default:
+ break;
+ }
+ }
+ beans::PropertyValues aPropSeq( aHandle.size() );
+ std::vector< beans::PropertyValue >::const_iterator aIter = aHandle.begin();
+ std::vector< beans::PropertyValue >::const_iterator aEnd = aHandle.end();
+ beans::PropertyValue* pValues = aPropSeq.getArray();
+
+ while ( aIter != aEnd )
+ *pValues++ = *aIter++;
+
+ maHandles.push_back( aPropSeq );
+ }
+ return SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/ximpcustomshape.hxx b/xmloff/source/draw/ximpcustomshape.hxx
new file mode 100644
index 000000000000..dd12d2f39d6b
--- /dev/null
+++ b/xmloff/source/draw/ximpcustomshape.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XIMPCUSTOMSHAPE_HXX_
+#define _XMLOFF_XIMPCUSTOMSHAPE_HXX_
+
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <rtl/ustring.hxx>
+#include <vector>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#ifndef __com_sun_star_beans_PropertyValues_hpp__
+#include <com/sun/star/beans/PropertyValues.hpp>
+#endif
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeParameter.hpp>
+
+namespace com { namespace sun { namespace star {
+ namespace container { class XIndexContainer; }
+ namespace beans { class XPropertySet; }
+ namespace xml { namespace sax { class XAttributeList; } }
+} } }
+
+class SdXMLCustomShapeContext;
+class XMLEnhancedCustomShapeContext : public SvXMLImportContext
+{
+ SvXMLUnitConverter& mrUnitConverter;
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& mrxShape;
+ std::vector< com::sun::star::beans::PropertyValue >& mrCustomShapeGeometry;
+
+ std::vector< com::sun::star::beans::PropertyValue > maExtrusion;
+ std::vector< com::sun::star::beans::PropertyValue > maPath;
+ std::vector< com::sun::star::beans::PropertyValue > maTextPath;
+ std::vector< com::sun::star::beans::PropertyValues > maHandles;
+ std::vector< rtl::OUString > maEquations;
+ std::vector< rtl::OUString > maEquationNames;
+
+public:
+
+ TYPEINFO();
+
+ XMLEnhancedCustomShapeContext( SvXMLImport& rImport, ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > &, sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName, std::vector< com::sun::star::beans::PropertyValue >& rCustomShapeGeometry );
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+
+ SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/ximpgrp.cxx b/xmloff/source/draw/ximpgrp.cxx
new file mode 100644
index 000000000000..c582e03d9a28
--- /dev/null
+++ b/xmloff/source/draw/ximpgrp.cxx
@@ -0,0 +1,132 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include"xmloff/xmlnmspe.hxx"
+#include "ximpgrp.hxx"
+#include <xmloff/xmltoken.hxx>
+#include "ximpshap.hxx"
+#include "eventimp.hxx"
+#include "descriptionimp.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLGroupShapeContext, SvXMLImportContext );
+
+SdXMLGroupShapeContext::SdXMLGroupShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx, const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape )
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLGroupShapeContext::~SdXMLGroupShapeContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLImportContext* SdXMLGroupShapeContext::CreateChildContext( sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList>& xAttrList )
+{
+ SvXMLImportContext* pContext = 0L;
+
+ // #i68101#
+ if( nPrefix == XML_NAMESPACE_SVG &&
+ (IsXMLToken( rLocalName, XML_TITLE ) || IsXMLToken( rLocalName, XML_DESC ) ) )
+ {
+ pContext = new SdXMLDescriptionContext( GetImport(), nPrefix, rLocalName, xAttrList, mxShape );
+ }
+ else if( nPrefix == XML_NAMESPACE_OFFICE && IsXMLToken( rLocalName, XML_EVENT_LISTENERS ) )
+ {
+ pContext = new SdXMLEventsContext( GetImport(), nPrefix, rLocalName, xAttrList, mxShape );
+ }
+ else if( nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( rLocalName, XML_GLUE_POINT ) )
+ {
+ addGluePoint( xAttrList );
+ }
+ else
+ {
+ // call GroupChildContext function at common ShapeImport
+ pContext = GetImport().GetShapeImport()->CreateGroupChildContext(
+ GetImport(), nPrefix, rLocalName, xAttrList, mxChilds);
+ }
+
+ // call parent when no own context was created
+ if(!pContext)
+ pContext = SvXMLImportContext::CreateChildContext(
+ nPrefix, rLocalName, xAttrList);
+
+ return pContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLGroupShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>&)
+{
+ // create new group shape and add it to rShapes, use it
+ // as base for the new group import
+ AddShape( "com.sun.star.drawing.GroupShape" );
+
+ if(mxShape.is())
+ {
+ SetStyle( false );
+
+ mxChilds = uno::Reference< drawing::XShapes >::query( mxShape );
+ if( mxChilds.is() )
+ GetImport().GetShapeImport()->pushGroupForSorting( mxChilds );
+ }
+
+ GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLGroupShapeContext::EndElement()
+{
+ if( mxChilds.is() )
+ GetImport().GetShapeImport()->popGroupAndSort();
+
+ SdXMLShapeContext::EndElement();
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/ximpgrp.hxx b/xmloff/source/draw/ximpgrp.hxx
new file mode 100644
index 000000000000..9295a75fe1f9
--- /dev/null
+++ b/xmloff/source/draw/ximpgrp.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XIMPGROUP_HXX
+#define _XIMPGROUP_HXX
+
+#include <xmloff/xmlictxt.hxx>
+#include "sdxmlimp_impl.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <tools/rtti.hxx>
+#include "ximpshap.hxx"
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:g context (RECURSIVE)
+
+class SdXMLGroupShapeContext : public SdXMLShapeContext
+{
+ // the shape group this group is working on
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > mxChilds;
+
+protected:
+ void SetLocalShapesContext(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rNew)
+ { mxShapes = rNew; }
+
+public:
+ TYPEINFO();
+
+ SdXMLGroupShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLGroupShapeContext();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+ virtual void EndElement();
+
+ const com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& GetLocalShapesContext() const
+ { return mxShapes; }
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& GetLocalShapesContext()
+ { return mxShapes; }
+};
+
+
+#endif // _XIMPGROUP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/ximplink.cxx b/xmloff/source/draw/ximplink.cxx
new file mode 100644
index 000000000000..4228a0ec6153
--- /dev/null
+++ b/xmloff/source/draw/ximplink.cxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include"xmloff/xmlnmspe.hxx"
+#include "ximplink.hxx"
+#include <xmloff/xmltoken.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLShapeLinkContext, SvXMLImportContext );
+
+SdXMLShapeLinkContext::SdXMLShapeLinkContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, const uno::Reference< xml::sax::XAttributeList>& xAttrList, uno::Reference< drawing::XShapes >& rShapes)
+: SvXMLShapeContext( rImport, nPrfx, rLocalName, false )
+, mxParent( rShapes )
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = rImport.GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ if( (nPrefix == XML_NAMESPACE_XLINK) && IsXMLToken( aLocalName, XML_HREF ) )
+ {
+ msHyperlink = xAttrList->getValueByIndex( i );
+ break;
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLShapeLinkContext::~SdXMLShapeLinkContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLImportContext* SdXMLShapeLinkContext::CreateChildContext( sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList>& xAttrList )
+{
+ SvXMLShapeContext* pContext = GetImport().GetShapeImport()->CreateGroupChildContext( GetImport(), nPrefix, rLocalName, xAttrList, mxParent);
+
+ if( pContext )
+ {
+ pContext->setHyperlink( msHyperlink );
+ return pContext;
+ }
+
+ // call parent when no own context was created
+ return SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList);
+
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLShapeLinkContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttr )
+{
+ SvXMLImportContext::StartElement( xAttr );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLShapeLinkContext::EndElement()
+{
+ SvXMLImportContext::EndElement();
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/ximplink.hxx b/xmloff/source/draw/ximplink.hxx
new file mode 100644
index 000000000000..10a33bfdc3fd
--- /dev/null
+++ b/xmloff/source/draw/ximplink.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XIMPLINK_HXX
+#define _XIMPLINK_HXX
+
+#include <xmloff/xmlictxt.hxx>
+#include "sdxmlimp_impl.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <tools/rtti.hxx>
+#include "ximpshap.hxx"
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:a context
+
+// this should have been a SvXMLImportContext but CreateGroupChildContext() returns
+// an unneeded derivation. Should be changed sometime during refactoring.
+
+class SdXMLShapeLinkContext : public SvXMLShapeContext
+{
+ // the parent shape group this link is placed in
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > mxParent;
+ rtl::OUString msHyperlink;
+
+public:
+ TYPEINFO();
+
+ SdXMLShapeLinkContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes);
+ virtual ~SdXMLShapeLinkContext();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+ virtual void EndElement();
+};
+
+
+#endif // _XIMPLINK_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/ximpnote.cxx b/xmloff/source/draw/ximpnote.cxx
new file mode 100644
index 000000000000..af85ef818978
--- /dev/null
+++ b/xmloff/source/draw/ximpnote.cxx
@@ -0,0 +1,145 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "ximpnote.hxx"
+#include <com/sun/star/presentation/XPresentationPage.hpp>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLNotesContext::SdXMLNotesContext( SdXMLImport& rImport,
+ sal_uInt16 nPrfx, const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes)
+: SdXMLGenericPageContext( rImport, nPrfx, rLocalName, xAttrList, rShapes )
+{
+ OUString sStyleName;
+
+ const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetSdImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ OUString sValue = xAttrList->getValueByIndex( i );
+ const SvXMLTokenMap& rAttrTokenMap = GetSdImport().GetMasterPageAttrTokenMap();
+
+ switch(rAttrTokenMap.Get(nPrefix, aLocalName))
+ {
+ case XML_TOK_MASTERPAGE_PAGE_MASTER_NAME:
+ {
+ msPageMasterName = sValue;
+ break;
+ }
+ case XML_TOK_MASTERPAGE_STYLE_NAME:
+ {
+ sStyleName = sValue;
+ break;
+ }
+ case XML_TOK_MASTERPAGE_USE_HEADER_NAME:
+ {
+ maUseHeaderDeclName = sValue;
+ break;
+ }
+ case XML_TOK_MASTERPAGE_USE_FOOTER_NAME:
+ {
+ maUseFooterDeclName = sValue;
+ break;
+ }
+ case XML_TOK_MASTERPAGE_USE_DATE_TIME_NAME:
+ {
+ maUseDateTimeDeclName = sValue;
+ break;
+ }
+
+ }
+ }
+
+ SetStyle( sStyleName );
+
+ // now delete all up-to-now contained shapes from this notes page
+ uno::Reference< drawing::XShape > xShape;
+ while(rShapes->getCount())
+ {
+ rShapes->getByIndex(0L) >>= xShape;
+ if(xShape.is())
+ rShapes->remove(xShape);
+ }
+
+ // set page-master?
+ if(msPageMasterName.getLength())
+ {
+ SetPageMaster( msPageMasterName );
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLNotesContext::~SdXMLNotesContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLImportContext *SdXMLNotesContext::CreateChildContext( sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList>& xAttrList )
+{
+ // OK, notes page is set on base class, objects can be imported on notes page
+ SvXMLImportContext *pContext = 0L;
+
+ // some special objects inside presentation:notes context
+ // ...
+
+
+
+
+
+
+
+ // call parent when no own context was created
+ if(!pContext)
+ pContext = SdXMLGenericPageContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
+
+ return pContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLNotesContext::EndElement()
+{
+ SdXMLGenericPageContext::EndElement();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/ximpnote.hxx b/xmloff/source/draw/ximpnote.hxx
new file mode 100644
index 000000000000..ad9b654ac3db
--- /dev/null
+++ b/xmloff/source/draw/ximpnote.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XIMPNOTES_HXX
+#define _XIMPNOTES_HXX
+
+#include <xmloff/xmlictxt.hxx>
+#include "sdxmlimp_impl.hxx"
+#include <xmloff/nmspmap.hxx>
+#include "ximppage.hxx"
+
+//////////////////////////////////////////////////////////////////////////////
+// presentation:notes context
+
+class SdXMLNotesContext : public SdXMLGenericPageContext
+{
+private:
+ rtl::OUString msPageMasterName;
+
+public:
+ SdXMLNotesContext( SdXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes);
+ virtual ~SdXMLNotesContext();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+ virtual void EndElement();
+};
+
+
+#endif // _XIMPNOTES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/ximppage.cxx b/xmloff/source/draw/ximppage.cxx
new file mode 100644
index 000000000000..04d750776971
--- /dev/null
+++ b/xmloff/source/draw/ximppage.cxx
@@ -0,0 +1,650 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+
+#include <com/sun/star/geometry/RealPoint2D.hpp>
+#include <com/sun/star/text/XTextCursor.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include "XMLNumberStylesImport.hxx"
+#include <xmloff/xmlstyle.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlstyle.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include "ximppage.hxx"
+#include "ximpshap.hxx"
+#include "animimp.hxx"
+#include "XMLStringBufferImportContext.hxx"
+#include <xmloff/formsimp.hxx>
+#include <xmloff/xmlictxt.hxx>
+#include "ximpstyl.hxx"
+#include <xmloff/prstylei.hxx>
+#include "PropertySetMerger.hxx"
+
+#include "unointerfacetouniqueidentifiermapper.hxx"
+#include <xmloff/xmluconv.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::office;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::geometry;
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+class DrawAnnotationContext : public SvXMLImportContext
+{
+
+public:
+ DrawAnnotationContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName,const Reference< xml::sax::XAttributeList>& xAttrList, const Reference< XAnnotationAccess >& xAnnotationAccess );
+
+ virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+ virtual void EndElement();
+
+private:
+ Reference< XAnnotation > mxAnnotation;
+ Reference< XTextCursor > mxCursor;
+
+ OUStringBuffer maAuthorBuffer;
+ OUStringBuffer maDateBuffer;
+};
+
+DrawAnnotationContext::DrawAnnotationContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName,const Reference< xml::sax::XAttributeList>& xAttrList, const Reference< XAnnotationAccess >& xAnnotationAccess )
+: SvXMLImportContext( rImport, nPrfx, rLocalName )
+, mxAnnotation( xAnnotationAccess->createAndInsertAnnotation() )
+{
+ if( mxAnnotation.is() )
+ {
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+
+ RealPoint2D aPosition;
+ RealSize2D aSize;
+
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sValue( xAttrList->getValueByIndex( i ) );
+ OUString sAttrName( xAttrList->getNameByIndex( i ) );
+ OUString aLocalName;
+ switch( GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName ) )
+ {
+ case XML_NAMESPACE_SVG:
+ if( IsXMLToken( aLocalName, XML_X ) )
+ {
+ sal_Int32 x;
+ GetImport().GetMM100UnitConverter().convertMeasure(x, sValue);
+ aPosition.X = static_cast<double>(x) / 100.0;
+ }
+ else if( IsXMLToken( aLocalName, XML_Y ) )
+ {
+ sal_Int32 y;
+ GetImport().GetMM100UnitConverter().convertMeasure(y, sValue);
+ aPosition.Y = static_cast<double>(y) / 100.0;
+ }
+ else if( IsXMLToken( aLocalName, XML_WIDTH ) )
+ {
+ sal_Int32 w;
+ GetImport().GetMM100UnitConverter().convertMeasure(w, sValue);
+ aSize.Width = static_cast<double>(w) / 100.0;
+ }
+ else if( IsXMLToken( aLocalName, XML_HEIGHT ) )
+ {
+ sal_Int32 h;
+ GetImport().GetMM100UnitConverter().convertMeasure(h, sValue);
+ aSize.Height = static_cast<double>(h) / 100.0;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ mxAnnotation->setPosition( aPosition );
+ mxAnnotation->setSize( aSize );
+ }
+}
+
+SvXMLImportContext * DrawAnnotationContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList )
+{
+ SvXMLImportContext * pContext = NULL;
+
+ if( mxAnnotation.is() )
+ {
+ if( XML_NAMESPACE_DC == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_CREATOR ) )
+ pContext = new XMLStringBufferImportContext(GetImport(), nPrefix, rLocalName, maAuthorBuffer);
+ else if( IsXMLToken( rLocalName, XML_DATE ) )
+ pContext = new XMLStringBufferImportContext(GetImport(), nPrefix, rLocalName, maDateBuffer);
+ }
+ else
+ {
+ // create text cursor on demand
+ if( !mxCursor.is() )
+ {
+ uno::Reference< text::XText > xText( mxAnnotation->getTextRange() );
+ if( xText.is() )
+ {
+ UniReference < XMLTextImportHelper > xTxtImport = GetImport().GetTextImport();
+ mxCursor = xText->createTextCursor();
+ if( mxCursor.is() )
+ xTxtImport->SetCursor( mxCursor );
+ }
+ }
+
+ // if we have a text cursor, lets try to import some text
+ if( mxCursor.is() )
+ {
+ pContext = GetImport().GetTextImport()->CreateTextChildContext( GetImport(), nPrefix, rLocalName, xAttrList );
+ }
+ }
+ }
+
+ // call parent for content
+ if(!pContext)
+ pContext = SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList );
+
+ return pContext;
+}
+
+void DrawAnnotationContext::EndElement()
+{
+ if(mxCursor.is())
+ {
+ // delete addition newline
+ const OUString aEmpty;
+ mxCursor->gotoEnd( sal_False );
+ mxCursor->goLeft( 1, sal_True );
+ mxCursor->setString( aEmpty );
+
+ // reset cursor
+ GetImport().GetTextImport()->ResetCursor();
+ }
+
+ if( mxAnnotation.is() )
+ {
+ mxAnnotation->setAuthor( maAuthorBuffer.makeStringAndClear() );
+
+ DateTime aDateTime;
+ if(SvXMLUnitConverter::convertDateTime(aDateTime, maDateBuffer.makeStringAndClear()))
+ mxAnnotation->setDateTime(aDateTime);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLGenericPageContext, SvXMLImportContext );
+
+SdXMLGenericPageContext::SdXMLGenericPageContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx, const OUString& rLocalName,
+ const Reference< xml::sax::XAttributeList>& xAttrList,
+ Reference< drawing::XShapes >& rShapes)
+: SvXMLImportContext( rImport, nPrfx, rLocalName )
+, mxShapes( rShapes )
+, mxAnnotationAccess( rShapes, UNO_QUERY )
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetSdImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ if( (nPrefix == XML_NAMESPACE_DRAW) && IsXMLToken( aLocalName, XML_NAV_ORDER ) )
+ {
+ msNavOrder = xAttrList->getValueByIndex( i );
+ break;
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLGenericPageContext::~SdXMLGenericPageContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLGenericPageContext::StartElement( const Reference< ::com::sun::star::xml::sax::XAttributeList >& )
+{
+ GetImport().GetShapeImport()->pushGroupForSorting( mxShapes );
+
+ if( GetImport().IsFormsSupported() )
+ GetImport().GetFormImport()->startPage( Reference< drawing::XDrawPage >::query( mxShapes ) );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLImportContext* SdXMLGenericPageContext::CreateChildContext( sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference< xml::sax::XAttributeList>& xAttrList )
+{
+ SvXMLImportContext* pContext = 0L;
+
+ if( nPrefix == XML_NAMESPACE_PRESENTATION && IsXMLToken( rLocalName, XML_ANIMATIONS ) )
+ {
+ pContext = new XMLAnimationsContext( GetImport(), nPrefix, rLocalName, xAttrList );
+ }
+ else if( nPrefix == XML_NAMESPACE_OFFICE && IsXMLToken( rLocalName, XML_FORMS ) )
+ {
+ if( GetImport().IsFormsSupported() )
+ pContext = GetImport().GetFormImport()->createOfficeFormsContext( GetImport(), nPrefix, rLocalName );
+ }
+ else if( ((nPrefix == XML_NAMESPACE_OFFICE) || (nPrefix == XML_NAMESPACE_OFFICE_EXT)) && IsXMLToken( rLocalName, XML_ANNOTATION ) )
+ {
+ if( mxAnnotationAccess.is() )
+ pContext = new DrawAnnotationContext( GetImport(), nPrefix, rLocalName, xAttrList, mxAnnotationAccess );
+ }
+ else
+ {
+ // call GroupChildContext function at common ShapeImport
+ pContext = GetImport().GetShapeImport()->CreateGroupChildContext(
+ GetImport(), nPrefix, rLocalName, xAttrList, mxShapes);
+ }
+
+ // call parent when no own context was created
+ if(!pContext)
+ pContext = SvXMLImportContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
+
+ return pContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLGenericPageContext::EndElement()
+{
+ GetImport().GetShapeImport()->popGroupAndSort();
+
+ if( GetImport().IsFormsSupported() )
+ GetImport().GetFormImport()->endPage();
+
+ if( maUseHeaderDeclName.getLength() || maUseFooterDeclName.getLength() || maUseDateTimeDeclName.getLength() )
+ {
+ try
+ {
+ Reference <beans::XPropertySet> xSet(mxShapes, uno::UNO_QUERY_THROW );
+ Reference< beans::XPropertySetInfo > xInfo( xSet->getPropertySetInfo() );
+
+ if( maUseHeaderDeclName.getLength() )
+ {
+ const OUString aStrHeaderTextProp( RTL_CONSTASCII_USTRINGPARAM( "HeaderText" ) );
+ if( xInfo->hasPropertyByName( aStrHeaderTextProp ) )
+ xSet->setPropertyValue( aStrHeaderTextProp,
+ makeAny( GetSdImport().GetHeaderDecl( maUseHeaderDeclName ) ) );
+ }
+
+ if( maUseFooterDeclName.getLength() )
+ {
+ const OUString aStrFooterTextProp( RTL_CONSTASCII_USTRINGPARAM( "FooterText" ) );
+ if( xInfo->hasPropertyByName( aStrFooterTextProp ) )
+ xSet->setPropertyValue( aStrFooterTextProp,
+ makeAny( GetSdImport().GetFooterDecl( maUseFooterDeclName ) ) );
+ }
+
+ if( maUseDateTimeDeclName.getLength() )
+ {
+ const OUString aStrDateTimeTextProp( RTL_CONSTASCII_USTRINGPARAM( "DateTimeText" ) );
+ if( xInfo->hasPropertyByName( aStrDateTimeTextProp ) )
+ {
+ sal_Bool bFixed;
+ OUString aDateTimeFormat;
+ const OUString aText( GetSdImport().GetDateTimeDecl( maUseDateTimeDeclName, bFixed, aDateTimeFormat ) );
+
+ xSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("IsDateTimeFixed") ),
+ makeAny( bFixed ) );
+
+ if( bFixed )
+ {
+ xSet->setPropertyValue( aStrDateTimeTextProp, makeAny( aText ) );
+ }
+ else if( aDateTimeFormat.getLength() )
+ {
+ const SdXMLStylesContext* pStyles = dynamic_cast< const SdXMLStylesContext* >( GetSdImport().GetShapeImport()->GetStylesContext() );
+ if( !pStyles )
+ pStyles = dynamic_cast< const SdXMLStylesContext* >( GetSdImport().GetShapeImport()->GetAutoStylesContext() );
+
+ if( pStyles )
+ {
+ const SdXMLNumberFormatImportContext* pSdNumStyle =
+ dynamic_cast< const SdXMLNumberFormatImportContext* >( pStyles->FindStyleChildContext( XML_STYLE_FAMILY_DATA_STYLE, aDateTimeFormat, sal_True ) );
+
+ if( pSdNumStyle )
+ {
+ xSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("DateTimeFormat") ),
+ makeAny( pSdNumStyle->GetDrawKey() ) );
+ }
+ }
+ }
+ }
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ (void)e;
+ OSL_FAIL("xmloff::SdXMLGenericPageContext::EndElement(), unexpected exception cought!");
+ }
+ }
+
+ SetNavigationOrder();
+}
+
+void SdXMLGenericPageContext::SetStyle( rtl::OUString& rStyleName )
+{
+ // set PageProperties?
+ if(rStyleName.getLength())
+ {
+ try
+ {
+ const SvXMLImportContext* pContext = GetSdImport().GetShapeImport()->GetAutoStylesContext();
+
+ if( pContext && pContext->ISA( SvXMLStyleContext ) )
+ {
+ const SdXMLStylesContext* pStyles = (SdXMLStylesContext*)pContext;
+ if(pStyles)
+ {
+ const SvXMLStyleContext* pStyle = pStyles->FindStyleChildContext(
+ XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID, rStyleName);
+
+ if(pStyle && pStyle->ISA(XMLPropStyleContext))
+ {
+ XMLPropStyleContext* pPropStyle = (XMLPropStyleContext*)pStyle;
+
+ Reference <beans::XPropertySet> xPropSet1(mxShapes, uno::UNO_QUERY);
+ if(xPropSet1.is())
+ {
+ Reference< beans::XPropertySet > xPropSet( xPropSet1 );
+ Reference< beans::XPropertySet > xBackgroundSet;
+
+ const OUString aBackground(RTL_CONSTASCII_USTRINGPARAM("Background"));
+ if( xPropSet1->getPropertySetInfo()->hasPropertyByName( aBackground ) )
+ {
+ Reference< beans::XPropertySetInfo > xInfo( xPropSet1->getPropertySetInfo() );
+ if( xInfo.is() && xInfo->hasPropertyByName( aBackground ) )
+ {
+ Reference< lang::XMultiServiceFactory > xServiceFact(GetSdImport().GetModel(), uno::UNO_QUERY);
+ if(xServiceFact.is())
+ {
+ xBackgroundSet = Reference< beans::XPropertySet >::query(
+ xServiceFact->createInstance(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.Background"))));
+ }
+ }
+
+ if( xBackgroundSet.is() )
+ xPropSet = PropertySetMerger_CreateInstance( xPropSet1, xBackgroundSet );
+ }
+
+ if(xPropSet.is())
+ {
+ pPropStyle->FillPropertySet(xPropSet);
+
+ if( xBackgroundSet.is() )
+ xPropSet1->setPropertyValue( aBackground, uno::makeAny( xBackgroundSet ) );
+ }
+ }
+ }
+ }
+ }
+ }
+ catch( uno::Exception )
+ {
+ OSL_FAIL( "SdXMLGenericPageContext::SetStyle(): uno::Exception catched!" );
+ }
+ }
+}
+
+void SdXMLGenericPageContext::SetLayout()
+{
+ // set PresentationPageLayout?
+ if(GetSdImport().IsImpress() && maPageLayoutName.getLength())
+ {
+ sal_Int32 nType = -1;
+
+ const SvXMLImportContext* pContext = GetSdImport().GetShapeImport()->GetStylesContext();
+
+ if( pContext && pContext->ISA( SvXMLStyleContext ) )
+ {
+ const SdXMLStylesContext* pStyles = (SdXMLStylesContext*)pContext;
+ if(pStyles)
+ {
+ const SvXMLStyleContext* pStyle = pStyles->FindStyleChildContext( XML_STYLE_FAMILY_SD_PRESENTATIONPAGELAYOUT_ID, maPageLayoutName);
+
+ if(pStyle && pStyle->ISA(SdXMLPresentationPageLayoutContext))
+ {
+ SdXMLPresentationPageLayoutContext* pLayout = (SdXMLPresentationPageLayoutContext*)pStyle;
+ nType = pLayout->GetTypeId();
+ }
+ }
+
+ }
+ if( -1 == nType )
+ {
+ Reference< container::XNameAccess > xPageLayouts( GetSdImport().getPageLayouts() );
+ if( xPageLayouts.is() )
+ {
+ if( xPageLayouts->hasByName( maPageLayoutName ) )
+ xPageLayouts->getByName( maPageLayoutName ) >>= nType;
+ }
+
+ }
+
+ if( -1 != nType )
+ {
+ Reference <beans::XPropertySet> xPropSet(mxShapes, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ OUString aPropName(RTL_CONSTASCII_USTRINGPARAM("Layout"));
+ Reference< beans::XPropertySetInfo > xInfo( xPropSet->getPropertySetInfo() );
+ if( xInfo.is() && xInfo->hasPropertyByName( aPropName ) )
+ xPropSet->setPropertyValue(aPropName, uno::makeAny( (sal_Int16)nType ) );
+ }
+ }
+ }
+}
+
+void SdXMLGenericPageContext::DeleteAllShapes()
+{
+ // now delete all up-to-now contained shapes; they have been created
+ // when setting the presentation page layout.
+ while(mxShapes->getCount())
+ {
+ Reference< drawing::XShape > xShape;
+ uno::Any aAny(mxShapes->getByIndex(0L));
+
+ aAny >>= xShape;
+
+ if(xShape.is())
+ {
+ mxShapes->remove(xShape);
+ }
+ }
+}
+
+void SdXMLGenericPageContext::SetPageMaster( OUString& rsPageMasterName )
+{
+ if( GetSdImport().GetShapeImport()->GetStylesContext() )
+ {
+ // look for PageMaster with this name
+
+ // #80012# GetStylesContext() replaced with GetAutoStylesContext()
+ const SvXMLStylesContext* pAutoStyles = GetSdImport().GetShapeImport()->GetAutoStylesContext();
+
+ const SvXMLStyleContext* pStyle = pAutoStyles ? pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_SD_PAGEMASTERCONEXT_ID, rsPageMasterName) : NULL;
+
+ if(pStyle && pStyle->ISA(SdXMLPageMasterContext))
+ {
+ const SdXMLPageMasterContext* pPageMaster = (SdXMLPageMasterContext*)pStyle;
+ const SdXMLPageMasterStyleContext* pPageMasterContext = pPageMaster->GetPageMasterStyle();
+
+ if(pPageMasterContext)
+ {
+ Reference< drawing::XDrawPage > xMasterPage(GetLocalShapesContext(), uno::UNO_QUERY);
+ if(xMasterPage.is())
+ {
+ // set sizes for this masterpage
+ Reference <beans::XPropertySet> xPropSet(xMasterPage, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ uno::Any aAny;
+
+ aAny <<= pPageMasterContext->GetBorderBottom();
+ xPropSet->setPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("BorderBottom")), aAny);
+
+ aAny <<= pPageMasterContext->GetBorderLeft();
+ xPropSet->setPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("BorderLeft")), aAny);
+
+ aAny <<= pPageMasterContext->GetBorderRight();
+ xPropSet->setPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("BorderRight")), aAny);
+
+ aAny <<= pPageMasterContext->GetBorderTop();
+ xPropSet->setPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("BorderTop")), aAny);
+
+ aAny <<= pPageMasterContext->GetWidth();
+ xPropSet->setPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Width")), aAny);
+
+ aAny <<= pPageMasterContext->GetHeight();
+ xPropSet->setPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Height")), aAny);
+
+ aAny <<= pPageMasterContext->GetOrientation();
+ xPropSet->setPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Orientation")), aAny);
+ }
+ }
+ }
+ }
+
+ }
+}
+
+class NavigationOrderAccess : public ::cppu::WeakImplHelper1< XIndexAccess >
+{
+public:
+ NavigationOrderAccess( std::vector< Reference< XShape > >& rShapes );
+
+ // XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount( ) throw (RuntimeException);
+ virtual Any SAL_CALL getByIndex( sal_Int32 Index ) throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException);
+
+ // XElementAccess
+ virtual Type SAL_CALL getElementType( ) throw (RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw (RuntimeException);
+
+private:
+ std::vector< Reference< XShape > > maShapes;
+};
+
+NavigationOrderAccess::NavigationOrderAccess( std::vector< Reference< XShape > >& rShapes )
+{
+ maShapes.swap( rShapes );
+}
+
+// XIndexAccess
+sal_Int32 SAL_CALL NavigationOrderAccess::getCount( ) throw (RuntimeException)
+{
+ return static_cast< sal_Int32 >( maShapes.size() );
+}
+
+Any SAL_CALL NavigationOrderAccess::getByIndex( sal_Int32 Index ) throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
+{
+ if( (Index < 0) || (Index > getCount()) )
+ throw IndexOutOfBoundsException();
+
+ return Any( maShapes[Index] );
+}
+
+// XElementAccess
+Type SAL_CALL NavigationOrderAccess::getElementType( ) throw (RuntimeException)
+{
+ return XShape::static_type();
+}
+
+sal_Bool SAL_CALL NavigationOrderAccess::hasElements( ) throw (RuntimeException)
+{
+ return maShapes.empty() ? sal_False : sal_True;
+}
+
+void SdXMLGenericPageContext::SetNavigationOrder()
+{
+ if( msNavOrder.getLength() != 0 ) try
+ {
+ sal_uInt32 nIndex;
+ const sal_uInt32 nCount = static_cast< sal_uInt32 >( mxShapes->getCount() );
+ std::vector< Reference< XShape > > aShapes( nCount );
+
+ ::comphelper::UnoInterfaceToUniqueIdentifierMapper& rIdMapper = GetSdImport().getInterfaceToIdentifierMapper();
+ SvXMLTokenEnumerator aEnumerator( msNavOrder );
+ OUString sId;
+ for( nIndex = 0; nIndex < nCount; ++nIndex )
+ {
+ if( !aEnumerator.getNextToken(sId) )
+ break;
+
+ aShapes[nIndex] = Reference< XShape >( rIdMapper.getReference( sId ), UNO_QUERY );
+ }
+
+ for( nIndex = 0; nIndex < nCount; ++nIndex )
+ {
+ if( !aShapes[nIndex].is() )
+ {
+ OSL_FAIL("xmloff::SdXMLGenericPageContext::SetNavigationOrder(), draw:nav-order attribute incomplete!");
+ // todo: warning?
+ return;
+ }
+ }
+
+ Reference< XPropertySet > xSet( mxShapes, UNO_QUERY_THROW );
+ xSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "NavigationOrder" ) ), Any( Reference< XIndexAccess >( new NavigationOrderAccess( aShapes ) ) ) );
+ }
+ catch( uno::Exception& )
+ {
+ OSL_FAIL("xmloff::SdXMLGenericPageContext::SetNavigationOrder(), unexpected exception cought while importing shape navigation order!");
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/ximppage.hxx b/xmloff/source/draw/ximppage.hxx
new file mode 100644
index 000000000000..697db6aa1a96
--- /dev/null
+++ b/xmloff/source/draw/ximppage.hxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XIMPPAGE_HXX
+#define _XIMPPAGE_HXX
+
+#include <xmloff/xmlictxt.hxx>
+#include "sdxmlimp_impl.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/office/XAnnotationAccess.hpp>
+#include <tools/rtti.hxx>
+#include "ximpshap.hxx"
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:g context (RECURSIVE)
+
+class SdXMLGenericPageContext : public SvXMLImportContext
+{
+ // the shape group this group is working on
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mxShapes;
+ ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotationAccess > mxAnnotationAccess;
+
+protected:
+ rtl::OUString maPageLayoutName;
+ rtl::OUString maUseHeaderDeclName;
+ rtl::OUString maUseFooterDeclName;
+ rtl::OUString maUseDateTimeDeclName;
+ rtl::OUString msNavOrder;
+
+ void SetLocalShapesContext(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rNew)
+ { mxShapes = rNew; }
+
+ /** sets the page style on this page */
+ void SetStyle( rtl::OUString& rStyleName );
+
+ /** sets the presentation layout at this page. It is used for drawing pages and for the handout master */
+ void SetLayout();
+
+ /** deletes all shapes on this drawing page */
+ void DeleteAllShapes();
+
+ const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
+ SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
+
+ /** sets the properties from a page master style with the given name on this contexts page */
+ void SetPageMaster( rtl::OUString& rsPageMasterName );
+
+ void SetNavigationOrder();
+
+public:
+ TYPEINFO();
+
+ SdXMLGenericPageContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes);
+ virtual ~SdXMLGenericPageContext();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+ virtual void EndElement();
+
+ const com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& GetLocalShapesContext() const
+ { return mxShapes; }
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& GetLocalShapesContext()
+ { return mxShapes; }
+};
+
+
+#endif // _XIMPGROUP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
new file mode 100644
index 000000000000..7a04bdca2e03
--- /dev/null
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -0,0 +1,3777 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+
+#include <tools/debug.hxx>
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#include <com/sun/star/container/XNameReplace.hpp>
+#include <com/sun/star/presentation/ClickAction.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include "unointerfacetouniqueidentifiermapper.hxx"
+#include <com/sun/star/drawing/XGluePointsSupplier.hpp>
+#include <com/sun/star/container/XIdentifierAccess.hpp>
+#include <com/sun/star/drawing/GluePoint2.hpp>
+#include <com/sun/star/drawing/Alignment.hpp>
+#include <com/sun/star/drawing/EscapeDirection.hpp>
+#include <com/sun/star/media/ZoomLevel.hpp>
+#include <com/sun/star/awt/Rectangle.hpp>
+
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <comphelper/extract.hxx>
+#include "ximpshap.hxx"
+#include <xmloff/XMLBase64ImportContext.hxx>
+#include <xmloff/XMLShapeStyleContext.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/drawing/CircleKind.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/awt/XControlModel.hpp>
+#include <com/sun/star/drawing/XControlShape.hpp>
+#include <com/sun/star/drawing/PointSequenceSequence.hpp>
+#include <com/sun/star/drawing/PointSequence.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/beans/XMultiPropertyStates.hpp>
+#include "xexptran.hxx"
+#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/drawing/ConnectorType.hpp>
+#include <com/sun/star/drawing/HomogenMatrix3.hpp>
+#include "PropertySetMerger.hxx"
+#include <xmloff/families.hxx>
+#include "ximpstyl.hxx"
+#include"xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include "EnhancedCustomShapeToken.hxx"
+#include "XMLReplacementImageContext.hxx"
+#include "XMLImageMapContext.hxx"
+#include "sdpropls.hxx"
+#include "eventimp.hxx"
+
+#include "descriptionimp.hxx"
+#include "ximpcustomshape.hxx"
+#include "XMLEmbeddedObjectImportContext.hxx"
+#include "xmloff/xmlerror.hxx"
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <tools/string.hxx>
+#include <com/sun/star/drawing/XEnhancedCustomShapeDefaulter.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::document;
+using namespace ::xmloff::token;
+using namespace ::xmloff::EnhancedCustomShapeToken;
+
+SvXMLEnumMapEntry aXML_GlueAlignment_EnumMap[] =
+{
+ { XML_TOP_LEFT, drawing::Alignment_TOP_LEFT },
+ { XML_TOP, drawing::Alignment_TOP },
+ { XML_TOP_RIGHT, drawing::Alignment_TOP_RIGHT },
+ { XML_LEFT, drawing::Alignment_LEFT },
+ { XML_CENTER, drawing::Alignment_CENTER },
+ { XML_RIGHT, drawing::Alignment_RIGHT },
+ { XML_BOTTOM_LEFT, drawing::Alignment_BOTTOM_LEFT },
+ { XML_BOTTOM, drawing::Alignment_BOTTOM },
+ { XML_BOTTOM_RIGHT, drawing::Alignment_BOTTOM_RIGHT },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXML_GlueEscapeDirection_EnumMap[] =
+{
+ { XML_AUTO, drawing::EscapeDirection_SMART },
+ { XML_LEFT, drawing::EscapeDirection_LEFT },
+ { XML_RIGHT, drawing::EscapeDirection_RIGHT },
+ { XML_UP, drawing::EscapeDirection_UP },
+ { XML_DOWN, drawing::EscapeDirection_DOWN },
+ { XML_HORIZONTAL, drawing::EscapeDirection_HORIZONTAL },
+ { XML_VERTICAL, drawing::EscapeDirection_VERTICAL },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+static bool ImpIsEmptyURL( const ::rtl::OUString& rURL )
+{
+ if( rURL.getLength() == 0 )
+ return true;
+
+ // #i13140# Also compare against 'toplevel' URLs. which also
+ // result in empty filename strings.
+ if( 0 == rURL.compareToAscii( "#./" ) )
+ return true;
+
+ return false;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SvXMLShapeContext, SvXMLImportContext );
+TYPEINIT1( SdXMLShapeContext, SvXMLShapeContext );
+
+SdXMLShapeContext::SdXMLShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SvXMLShapeContext( rImport, nPrfx, rLocalName, bTemporaryShape )
+, mxShapes( rShapes )
+, mxAttrList(xAttrList)
+, mbListContextPushed( false )
+, mnStyleFamily(XML_STYLE_FAMILY_SD_GRAPHICS_ID)
+, mbIsPlaceholder(sal_False)
+, mbClearDefaultAttributes( true )
+, mbIsUserTransformed(sal_False)
+, mnZOrder(-1)
+, maSize(1, 1)
+, maPosition(0, 0)
+, mbVisible(true)
+, mbPrintable(true)
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLShapeContext::~SdXMLShapeContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLImportContext *SdXMLShapeContext::CreateChildContext( sal_uInt16 p_nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList>& xAttrList )
+{
+ SvXMLImportContext * pContext = NULL;
+
+ // #i68101#
+ if( p_nPrefix == XML_NAMESPACE_SVG &&
+ (IsXMLToken( rLocalName, XML_TITLE ) || IsXMLToken( rLocalName, XML_DESC ) ) )
+ {
+ pContext = new SdXMLDescriptionContext( GetImport(), p_nPrefix, rLocalName, xAttrList, mxShape );
+ }
+ else if( p_nPrefix == XML_NAMESPACE_OFFICE && IsXMLToken( rLocalName, XML_EVENT_LISTENERS ) )
+ {
+ pContext = new SdXMLEventsContext( GetImport(), p_nPrefix, rLocalName, xAttrList, mxShape );
+ }
+ else if( p_nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( rLocalName, XML_GLUE_POINT ) )
+ {
+ addGluePoint( xAttrList );
+ }
+ else if( p_nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( rLocalName, XML_THUMBNAIL ) )
+ {
+ // search attributes for xlink:href
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+
+ if( nPrefix == XML_NAMESPACE_XLINK )
+ {
+ if( IsXMLToken( aLocalName, XML_HREF ) )
+ {
+ maThumbnailURL = xAttrList->getValueByIndex( i );
+ break;
+ }
+ }
+ }
+ }
+ else
+ {
+ // create text cursor on demand
+ if( !mxCursor.is() )
+ {
+ uno::Reference< text::XText > xText( mxShape, uno::UNO_QUERY );
+ if( xText.is() )
+ {
+ UniReference < XMLTextImportHelper > xTxtImport =
+ GetImport().GetTextImport();
+ mxOldCursor = xTxtImport->GetCursor();
+ mxCursor = xText->createTextCursor();
+ if( mxCursor.is() )
+ {
+ xTxtImport->SetCursor( mxCursor );
+ }
+
+ // remember old list item and block (#91964#) and reset them
+ // for the text frame
+ xTxtImport->PushListContext();
+ mbListContextPushed = true;
+ }
+ }
+
+ // if we have a text cursor, lets try to import some text
+ if( mxCursor.is() )
+ {
+ pContext = GetImport().GetTextImport()->CreateTextChildContext(
+ GetImport(), p_nPrefix, rLocalName, xAttrList );
+ }
+ }
+
+ // call parent for content
+ if(!pContext)
+ pContext = SvXMLImportContext::CreateChildContext( p_nPrefix, rLocalName, xAttrList );
+
+ return pContext;
+}
+
+void SdXMLShapeContext::addGluePoint( const uno::Reference< xml::sax::XAttributeList>& xAttrList )
+{
+ // get the glue points container for this shape if its not already there
+ if( !mxGluePoints.is() )
+ {
+ uno::Reference< drawing::XGluePointsSupplier > xSupplier( mxShape, uno::UNO_QUERY );
+ if( !xSupplier.is() )
+ return;
+
+ mxGluePoints = uno::Reference< container::XIdentifierContainer >::query( xSupplier->getGluePoints() );
+
+ if( !mxGluePoints.is() )
+ return;
+ }
+
+ drawing::GluePoint2 aGluePoint;
+ aGluePoint.IsUserDefined = sal_True;
+ aGluePoint.Position.X = 0;
+ aGluePoint.Position.Y = 0;
+ aGluePoint.Escape = drawing::EscapeDirection_SMART;
+ aGluePoint.PositionAlignment = drawing::Alignment_CENTER;
+ aGluePoint.IsRelative = sal_True;
+
+ sal_Int32 nId = -1;
+
+ // read attributes for the 3DScene
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ const OUString sValue( xAttrList->getValueByIndex( i ) );
+
+ if( nPrefix == XML_NAMESPACE_SVG )
+ {
+ if( IsXMLToken( aLocalName, XML_X ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(aGluePoint.Position.X, sValue);
+ }
+ else if( IsXMLToken( aLocalName, XML_Y ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(aGluePoint.Position.Y, sValue);
+ }
+ }
+ else if( nPrefix == XML_NAMESPACE_DRAW )
+ {
+ if( IsXMLToken( aLocalName, XML_ID ) )
+ {
+ nId = sValue.toInt32();
+ }
+ else if( IsXMLToken( aLocalName, XML_ALIGN ) )
+ {
+ sal_uInt16 eKind;
+ if( SvXMLUnitConverter::convertEnum( eKind, sValue, aXML_GlueAlignment_EnumMap ) )
+ {
+ aGluePoint.PositionAlignment = (drawing::Alignment)eKind;
+ aGluePoint.IsRelative = sal_False;
+ }
+ }
+ else if( IsXMLToken( aLocalName, XML_ESCAPE_DIRECTION ) )
+ {
+ sal_uInt16 eKind;
+ if( SvXMLUnitConverter::convertEnum( eKind, sValue, aXML_GlueEscapeDirection_EnumMap ) )
+ {
+ aGluePoint.Escape = (drawing::EscapeDirection)eKind;
+ }
+ }
+ }
+ }
+
+ if( nId != -1 )
+ {
+ try
+ {
+ sal_Int32 nInternalId = mxGluePoints->insert( uno::makeAny( aGluePoint ) );
+ GetImport().GetShapeImport()->addGluePointMapping( mxShape, nId, nInternalId );
+ }
+ catch( uno::Exception& )
+ {
+ OSL_FAIL( "exception during setting of glue points!");
+ }
+ }
+}
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>&)
+{
+ GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes );
+}
+
+void SdXMLShapeContext::EndElement()
+{
+ if(mxCursor.is())
+ {
+ // delete addition newline
+ const OUString aEmpty;
+ mxCursor->gotoEnd( sal_False );
+ mxCursor->goLeft( 1, sal_True );
+ mxCursor->setString( aEmpty );
+
+ // reset cursor
+ GetImport().GetTextImport()->ResetCursor();
+ }
+
+ if(mxOldCursor.is())
+ GetImport().GetTextImport()->SetCursor( mxOldCursor );
+
+ // reinstall old list item (if necessary) #91964#
+ if (mbListContextPushed) {
+ GetImport().GetTextImport()->PopListContext();
+ }
+
+ if( msHyperlink.getLength() != 0 ) try
+ {
+ uno::Reference< beans::XPropertySet > xProp( mxShape, uno::UNO_QUERY );
+
+ rtl::OUString sLink( RTL_CONSTASCII_USTRINGPARAM( "Hyperlink" ) );
+ if ( xProp.is() && xProp->getPropertySetInfo()->hasPropertyByName( sLink ) )
+ xProp->setPropertyValue( sLink, uno::Any( msHyperlink ) );
+ Reference< XEventsSupplier > xEventsSupplier( mxShape, UNO_QUERY_THROW );
+ const OUString sBookmark( RTL_CONSTASCII_USTRINGPARAM( "Bookmark" ) );
+
+ if( xEventsSupplier.is() )
+ {
+ const OUString sEventType( RTL_CONSTASCII_USTRINGPARAM( "EventType" ) );
+ const OUString sClickAction( RTL_CONSTASCII_USTRINGPARAM( "ClickAction" ) );
+
+ Reference< XNameReplace > xEvents( xEventsSupplier->getEvents(), UNO_QUERY_THROW );
+
+ uno::Sequence< beans::PropertyValue > aProperties( 3 );
+ aProperties[0].Name = sEventType;
+ aProperties[0].Handle = -1;
+ aProperties[0].Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM("Presentation") );
+ aProperties[0].State = beans::PropertyState_DIRECT_VALUE;
+
+ aProperties[1].Name = sClickAction;
+ aProperties[1].Handle = -1;
+ aProperties[1].Value <<= ::com::sun::star::presentation::ClickAction_DOCUMENT;
+ aProperties[1].State = beans::PropertyState_DIRECT_VALUE;
+
+ aProperties[2].Name = sBookmark;
+ aProperties[2].Handle = -1;
+ aProperties[2].Value <<= msHyperlink;
+ aProperties[2].State = beans::PropertyState_DIRECT_VALUE;
+
+ const OUString sAPIEventName( RTL_CONSTASCII_USTRINGPARAM( "OnClick" ) );
+ xEvents->replaceByName( sAPIEventName, Any( aProperties ) );
+ }
+ else
+ {
+ // in draw use the Bookmark property
+ Reference< beans::XPropertySet > xSet( mxShape, UNO_QUERY_THROW );
+ xSet->setPropertyValue( sBookmark, Any( msHyperlink ) );
+ xSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "OnClick" ) ), Any( ::com::sun::star::presentation::ClickAction_DOCUMENT ) );
+ }
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL("xmloff::SdXMLShapeContext::EndElement(), exception caught while setting hyperlink!");
+ }
+
+ if( mxLockable.is() )
+ mxLockable->removeActionLock();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLShapeContext::AddShape(uno::Reference< drawing::XShape >& xShape)
+{
+ if(xShape.is())
+ {
+ // set shape local
+ mxShape = xShape;
+
+ if(maShapeName.getLength())
+ {
+ uno::Reference< container::XNamed > xNamed( mxShape, uno::UNO_QUERY );
+ if( xNamed.is() )
+ xNamed->setName( maShapeName );
+ }
+
+ UniReference< XMLShapeImportHelper > xImp( GetImport().GetShapeImport() );
+ xImp->addShape( xShape, mxAttrList, mxShapes );
+
+ if( mbClearDefaultAttributes )
+ {
+ uno::Reference<beans::XMultiPropertyStates> xMultiPropertyStates(xShape, uno::UNO_QUERY );
+ if (xMultiPropertyStates.is())
+ xMultiPropertyStates->setAllPropertiesToDefault();
+ }
+
+ if( !mbVisible || !mbPrintable ) try
+ {
+ uno::Reference< beans::XPropertySet > xSet( xShape, uno::UNO_QUERY_THROW );
+ if( !mbVisible )
+ xSet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Visible" ) ), uno::Any( sal_False ) );
+
+ if( !mbPrintable )
+ xSet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Printable" ) ), uno::Any( sal_False ) );
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL( "SdXMLShapeContext::AddShape(), exception caught!" );
+ }
+
+ // #107848#
+ if(!mbTemporaryShape && (!GetImport().HasTextImport()
+ || !GetImport().GetTextImport()->IsInsideDeleteContext()))
+ {
+ xImp->shapeWithZIndexAdded( xShape, mnZOrder );
+ }
+
+ if( maShapeId.getLength() )
+ {
+ uno::Reference< uno::XInterface > xRef( xShape, uno::UNO_QUERY );
+ GetImport().getInterfaceToIdentifierMapper().registerReference( maShapeId, xRef );
+ }
+
+ // #91065# count only if counting for shape import is enabled
+ if(GetImport().GetShapeImport()->IsHandleProgressBarEnabled())
+ {
+ // #80365# increment progress bar at load once for each draw object
+ GetImport().GetProgressBarHelper()->Increment();
+ }
+ }
+
+ mxLockable = uno::Reference< document::XActionLockable >::query( xShape );
+
+ if( mxLockable.is() )
+ mxLockable->addActionLock();
+
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLShapeContext::AddShape(const char* pServiceName )
+{
+ uno::Reference< lang::XMultiServiceFactory > xServiceFact(GetImport().GetModel(), uno::UNO_QUERY);
+ if(xServiceFact.is())
+ {
+ try
+ {
+ /* Since fix for issue i33294 the Writer model doesn't support
+ com.sun.star.drawing.OLE2Shape anymore.
+ To handle Draw OLE objects it's decided to import these
+ objects as com.sun.star.drawing.OLE2Shape and convert these
+ objects after the import into com.sun.star.drawing.GraphicObjectShape.
+ */
+ uno::Reference< drawing::XShape > xShape;
+ if ( OUString::createFromAscii(pServiceName).compareToAscii( "com.sun.star.drawing.OLE2Shape" ) == 0 &&
+ uno::Reference< text::XTextDocument >(GetImport().GetModel(), uno::UNO_QUERY).is() )
+ {
+ xShape = uno::Reference< drawing::XShape >(xServiceFact->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.temporaryForXMLImportOLE2Shape"))), uno::UNO_QUERY);
+ }
+ else
+ {
+ xShape = uno::Reference< drawing::XShape >(xServiceFact->createInstance(OUString::createFromAscii(pServiceName)), uno::UNO_QUERY);
+ }
+ if( xShape.is() )
+ AddShape( xShape );
+ }
+ catch( const uno::Exception& e )
+ {
+ uno::Sequence<rtl::OUString> aSeq( 1 );
+ aSeq[0] = OUString::createFromAscii(pServiceName);
+ GetImport().SetError( XMLERROR_FLAG_ERROR | XMLERROR_API,
+ aSeq, e.Message, NULL );
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLShapeContext::SetTransformation()
+{
+ if(mxShape.is())
+ {
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ ::basegfx::B2DHomMatrix aTransformation;
+
+ if(maSize.Width != 1 || maSize.Height != 1)
+ {
+ // take care there are no zeros used by error
+ if(0 == maSize.Width)
+ maSize.Width = 1;
+ if(0 == maSize.Height)
+ maSize.Height = 1;
+
+ // set global size. This should always be used.
+ aTransformation.scale(maSize.Width, maSize.Height);
+ }
+
+ if(maPosition.X != 0 || maPosition.Y != 0)
+ {
+ // if global position is used, add it to transformation
+ aTransformation.translate(maPosition.X, maPosition.Y);
+ }
+
+ if(mnTransform.NeedsAction())
+ {
+ // transformation is used, apply to object.
+ // NOTICE: The transformation is applied AFTER evtl. used
+ // global positioning and scaling is used, so any shear or
+ // rotate used herein is applied around the (0,0) position
+ // of the PAGE object !!!
+ ::basegfx::B2DHomMatrix aMat;
+ mnTransform.GetFullTransform(aMat);
+
+ // now add to transformation
+ aTransformation *= aMat;
+ }
+
+ // now set transformation for this object
+ uno::Any aAny;
+ drawing::HomogenMatrix3 aMatrix;
+
+ aMatrix.Line1.Column1 = aTransformation.get(0, 0);
+ aMatrix.Line1.Column2 = aTransformation.get(0, 1);
+ aMatrix.Line1.Column3 = aTransformation.get(0, 2);
+
+ aMatrix.Line2.Column1 = aTransformation.get(1, 0);
+ aMatrix.Line2.Column2 = aTransformation.get(1, 1);
+ aMatrix.Line2.Column3 = aTransformation.get(1, 2);
+
+ aMatrix.Line3.Column1 = aTransformation.get(2, 0);
+ aMatrix.Line3.Column2 = aTransformation.get(2, 1);
+ aMatrix.Line3.Column3 = aTransformation.get(2, 2);
+
+ aAny <<= aMatrix;
+
+ xPropSet->setPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Transformation")), aAny);
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLShapeContext::SetStyle( bool bSupportsStyle /* = true */)
+{
+ try
+ {
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
+ if( !xPropSet.is() )
+ return;
+
+ do
+ {
+ XMLPropStyleContext* pDocStyle = NULL;
+
+ // set style on shape
+ if(maDrawStyleName.getLength() == 0)
+ break;
+
+ const SvXMLStyleContext* pStyle = 0L;
+ sal_Bool bAutoStyle(sal_False);
+
+ if(GetImport().GetShapeImport()->GetAutoStylesContext())
+ pStyle = GetImport().GetShapeImport()->GetAutoStylesContext()->FindStyleChildContext(mnStyleFamily, maDrawStyleName);
+
+ if(pStyle)
+ bAutoStyle = sal_True;
+
+ if(!pStyle && GetImport().GetShapeImport()->GetStylesContext())
+ pStyle = GetImport().GetShapeImport()->GetStylesContext()->FindStyleChildContext(mnStyleFamily, maDrawStyleName);
+
+ OUString aStyleName = maDrawStyleName;
+ uno::Reference< style::XStyle > xStyle;
+
+ if( pStyle && pStyle->ISA(XMLShapeStyleContext) )
+ {
+ pDocStyle = PTR_CAST( XMLShapeStyleContext, pStyle );
+
+ if( pDocStyle->GetStyle().is() )
+ {
+ xStyle = pDocStyle->GetStyle();
+ }
+ else
+ {
+ aStyleName = pDocStyle->GetParentName();
+ }
+ }
+
+ if( !xStyle.is() && aStyleName.getLength() )
+ {
+ try
+ {
+
+ uno::Reference< style::XStyleFamiliesSupplier > xFamiliesSupplier( GetImport().GetModel(), uno::UNO_QUERY );
+
+ if( xFamiliesSupplier.is() )
+ {
+ uno::Reference< container::XNameAccess > xFamilies( xFamiliesSupplier->getStyleFamilies() );
+ if( xFamilies.is() )
+ {
+
+ uno::Reference< container::XNameAccess > xFamily;
+
+ if( XML_STYLE_FAMILY_SD_PRESENTATION_ID == mnStyleFamily )
+ {
+ aStyleName = GetImport().GetStyleDisplayName(
+ XML_STYLE_FAMILY_SD_PRESENTATION_ID,
+ aStyleName );
+ sal_Int32 nPos = aStyleName.lastIndexOf( sal_Unicode('-') );
+ if( -1 != nPos )
+ {
+ OUString aFamily( aStyleName.copy( 0, nPos ) );
+
+ xFamilies->getByName( aFamily ) >>= xFamily;
+ aStyleName = aStyleName.copy( nPos + 1 );
+ }
+ }
+ else
+ {
+ // get graphics familie
+ xFamilies->getByName( OUString( RTL_CONSTASCII_USTRINGPARAM( "graphics" ) ) ) >>= xFamily;
+ aStyleName = GetImport().GetStyleDisplayName(
+ XML_STYLE_FAMILY_SD_GRAPHICS_ID,
+ aStyleName );
+ }
+
+ if( xFamily.is() )
+ xFamily->getByName( aStyleName ) >>= xStyle;
+ }
+ }
+ }
+ catch( uno::Exception& )
+ {
+ OSL_FAIL( "could not find style for shape!" );
+ }
+ }
+
+ if( bSupportsStyle && xStyle.is() )
+ {
+ try
+ {
+ // set style on object
+ uno::Any aAny;
+ aAny <<= xStyle;
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Style")), aAny);
+ }
+ catch( uno::Exception& )
+ {
+ OSL_FAIL( "could not find style for shape!" );
+ }
+ }
+
+ // if this is an auto style, set its properties
+ if(bAutoStyle && pDocStyle)
+ {
+ // set PropertySet on object
+ pDocStyle->FillPropertySet(xPropSet);
+ }
+
+ } while(0);
+
+ // try to set text auto style
+ do
+ {
+ // set style on shape
+ if( 0 == maTextStyleName.getLength() )
+ break;
+
+ if( NULL == GetImport().GetShapeImport()->GetAutoStylesContext())
+ break;
+
+ const SvXMLStyleContext* pTempStyle = GetImport().GetShapeImport()->GetAutoStylesContext()->FindStyleChildContext(XML_STYLE_FAMILY_TEXT_PARAGRAPH, maTextStyleName);
+ XMLPropStyleContext* pStyle = PTR_CAST( XMLPropStyleContext, pTempStyle ); // use temp var, PTR_CAST is a bad macro, FindStyleChildContext will be called twice
+ if( pStyle == NULL )
+ break;
+
+ // set PropertySet on object
+ pStyle->FillPropertySet(xPropSet);
+
+ } while(0);
+ }
+ catch( uno::Exception& )
+ {
+ }
+}
+
+void SdXMLShapeContext::SetLayer()
+{
+ if( maLayerName.getLength() )
+ {
+ try
+ {
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
+ if(xPropSet.is() )
+ {
+ uno::Any aAny;
+ aAny <<= maLayerName;
+
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("LayerName")), aAny);
+ return;
+ }
+ }
+ catch( uno::Exception e )
+ {
+ }
+ }
+}
+
+void SdXMLShapeContext::SetThumbnail()
+{
+ if( 0 == maThumbnailURL.getLength() )
+ return;
+
+ try
+ {
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
+ if( !xPropSet.is() )
+ return;
+
+ const OUString sProperty(RTL_CONSTASCII_USTRINGPARAM("ThumbnailGraphicURL"));
+
+ uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
+ if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName( sProperty ) )
+ {
+ // load the thumbnail graphic and export it to a wmf stream so we can set
+ // it at the api
+
+ const OUString aInternalURL( GetImport().ResolveGraphicObjectURL( maThumbnailURL, sal_False ) );
+ xPropSet->setPropertyValue( sProperty, uno::makeAny( aInternalURL ) );
+ }
+ }
+ catch( uno::Exception e )
+ {
+ }
+}
+
+// this is called from the parent group for each unparsed attribute in the attribute list
+void SdXMLShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ bool bHaveXmlId( false );
+ if( (XML_NAMESPACE_DRAW == nPrefix) || (XML_NAMESPACE_DRAW_EXT == nPrefix) )
+ {
+ if( IsXMLToken( rLocalName, XML_ZINDEX ) )
+ {
+ mnZOrder = rValue.toInt32();
+ }
+ else if( IsXMLToken( rLocalName, XML_ID ) )
+ {
+ if (!bHaveXmlId) { maShapeId = rValue; };
+ }
+ else if( IsXMLToken( rLocalName, XML_NAME ) )
+ {
+ maShapeName = rValue;
+ }
+ else if( IsXMLToken( rLocalName, XML_STYLE_NAME ) )
+ {
+ maDrawStyleName = rValue;
+ }
+ else if( IsXMLToken( rLocalName, XML_TEXT_STYLE_NAME ) )
+ {
+ maTextStyleName = rValue;
+ }
+ else if( IsXMLToken( rLocalName, XML_LAYER ) )
+ {
+ maLayerName = rValue;
+ }
+ else if( IsXMLToken( rLocalName, XML_TRANSFORM ) )
+ {
+ mnTransform.SetString(rValue, GetImport().GetMM100UnitConverter());
+ }
+ else if( IsXMLToken( rLocalName, XML_DISPLAY ) )
+ {
+ mbVisible = IsXMLToken( rValue, XML_ALWAYS ) || IsXMLToken( rValue, XML_SCREEN );
+ mbPrintable = IsXMLToken( rValue, XML_ALWAYS ) || IsXMLToken( rValue, XML_PRINTER );
+ }
+ }
+ else if( XML_NAMESPACE_PRESENTATION == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_USER_TRANSFORMED ) )
+ {
+ mbIsUserTransformed = IsXMLToken( rValue, XML_TRUE );
+ }
+ else if( IsXMLToken( rLocalName, XML_PLACEHOLDER ) )
+ {
+ mbIsPlaceholder = IsXMLToken( rValue, XML_TRUE );
+ if( mbIsPlaceholder )
+ mbClearDefaultAttributes = false;
+ }
+ else if( IsXMLToken( rLocalName, XML_CLASS ) )
+ {
+ maPresentationClass = rValue;
+ }
+ else if( IsXMLToken( rLocalName, XML_STYLE_NAME ) )
+ {
+ maDrawStyleName = rValue;
+ mnStyleFamily = XML_STYLE_FAMILY_SD_PRESENTATION_ID;
+ }
+ }
+ else if( XML_NAMESPACE_SVG == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_X ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(maPosition.X, rValue);
+ }
+ else if( IsXMLToken( rLocalName, XML_Y ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(maPosition.Y, rValue);
+ }
+ else if( IsXMLToken( rLocalName, XML_WIDTH ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(maSize.Width, rValue);
+ if( maSize.Width > 0 )
+ maSize.Width += 1;
+ else if( maSize.Width < 0 )
+ maSize.Width -= 1;
+ }
+ else if( IsXMLToken( rLocalName, XML_HEIGHT ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(maSize.Height, rValue);
+ if( maSize.Height > 0 )
+ maSize.Height += 1;
+ else if( maSize.Height < 0 )
+ maSize.Height -= 1;
+ }
+ else if( IsXMLToken( rLocalName, XML_TRANSFORM ) )
+ {
+ // because of #85127# take svg:transform into account and hanle like
+ // draw:transform for compatibility
+ mnTransform.SetString(rValue, GetImport().GetMM100UnitConverter());
+ }
+
+ // #i68101#
+ else if( IsXMLToken( rLocalName, XML_TITLE ) )
+ {
+ maShapeTitle = rValue;
+ }
+ else if( IsXMLToken( rLocalName, XML_DESC ) )
+ {
+ maShapeDescription = rValue;
+ }
+ }
+ else if( (XML_NAMESPACE_NONE == nPrefix) || (XML_NAMESPACE_XML == nPrefix) )
+ {
+ if( IsXMLToken( rLocalName, XML_ID ) )
+ {
+ maShapeId = rValue;
+ bHaveXmlId = true;
+ }
+ }
+}
+
+sal_Bool SdXMLShapeContext::isPresentationShape() const
+{
+ if( maPresentationClass.getLength() && (const_cast<SdXMLShapeContext*>(this))->GetImport().GetShapeImport()->IsPresentationShapesSupported() )
+ {
+ if(XML_STYLE_FAMILY_SD_PRESENTATION_ID == mnStyleFamily)
+ {
+ return sal_True;
+ }
+
+ if( IsXMLToken( maPresentationClass, XML_HEADER ) || IsXMLToken( maPresentationClass, XML_FOOTER ) ||
+ IsXMLToken( maPresentationClass, XML_PAGE_NUMBER ) || IsXMLToken( maPresentationClass, XML_DATE_TIME ) )
+ {
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLRectShapeContext, SdXMLShapeContext );
+
+SdXMLRectShapeContext::SdXMLRectShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
+ mnRadius( 0L )
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLRectShapeContext::~SdXMLRectShapeContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+// this is called from the parent group for each unparsed attribute in the attribute list
+void SdXMLRectShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ if( XML_NAMESPACE_DRAW == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_CORNER_RADIUS ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(mnRadius, rValue);
+ return;
+ }
+ }
+
+ SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLRectShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+{
+ // create rectangle shape
+ AddShape("com.sun.star.drawing.RectangleShape");
+ if(mxShape.is())
+ {
+ // Add, set Style and properties from base shape
+ SetStyle();
+ SetLayer();
+
+ // set pos, size, shear and rotate
+ SetTransformation();
+
+ if(mnRadius)
+ {
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ try
+ {
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CornerRadius")), uno::makeAny( mnRadius ) );
+ }
+ catch( uno::Exception& )
+ {
+ OSL_FAIL( "exception during setting of corner radius!");
+ }
+ }
+ }
+ SdXMLShapeContext::StartElement(xAttrList);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////3////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLLineShapeContext, SdXMLShapeContext );
+
+SdXMLLineShapeContext::SdXMLLineShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
+ mnX1( 0L ),
+ mnY1( 0L ),
+ mnX2( 1L ),
+ mnY2( 1L )
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLLineShapeContext::~SdXMLLineShapeContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+// this is called from the parent group for each unparsed attribute in the attribute list
+void SdXMLLineShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ if( XML_NAMESPACE_SVG == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_X1 ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(mnX1, rValue);
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_Y1 ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(mnY1, rValue);
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_X2 ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(mnX2, rValue);
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_Y2 ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(mnY2, rValue);
+ return;
+ }
+ }
+
+ SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLLineShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+{
+ // #85920# use SetTransformation() to handle import of simple lines.
+ // This is necessary to kake into account all anchor positions and
+ // other things. All shape imports use the same import schemata now.
+ // create necessary shape (Line Shape)
+ AddShape("com.sun.star.drawing.PolyLineShape");
+
+ if(mxShape.is())
+ {
+ // Add, set Style and properties from base shape
+ SetStyle();
+ SetLayer();
+
+ // get sizes and offsets
+ awt::Point aTopLeft(mnX1, mnY1);
+ awt::Point aBottomRight(mnX2, mnY2);
+
+ if(mnX1 > mnX2)
+ {
+ aTopLeft.X = mnX2;
+ aBottomRight.X = mnX1;
+ }
+
+ if(mnY1 > mnY2)
+ {
+ aTopLeft.Y = mnY2;
+ aBottomRight.Y = mnY1;
+ }
+
+ // set local parameters on shape
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ drawing::PointSequenceSequence aPolyPoly(1L);
+ drawing::PointSequence* pOuterSequence = aPolyPoly.getArray();
+ pOuterSequence->realloc(2L);
+ awt::Point* pInnerSequence = pOuterSequence->getArray();
+ uno::Any aAny;
+
+ *pInnerSequence = awt::Point( mnX1 - aTopLeft.X, mnY1 - aTopLeft.Y);
+ pInnerSequence++;
+ *pInnerSequence = awt::Point( mnX2 - aTopLeft.X, mnY2 - aTopLeft.Y);
+
+ aAny <<= aPolyPoly;
+ xPropSet->setPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry")), aAny);
+ }
+
+ // set sizes for transformation
+ maSize.Width = aBottomRight.X - aTopLeft.X;
+ maSize.Height = aBottomRight.Y - aTopLeft.Y;
+ maPosition.X = aTopLeft.X;
+ maPosition.Y = aTopLeft.Y;
+
+ // set pos, size, shear and rotate and get copy of matrix
+ SetTransformation();
+
+ SdXMLShapeContext::StartElement(xAttrList);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLEllipseShapeContext, SdXMLShapeContext );
+
+SdXMLEllipseShapeContext::SdXMLEllipseShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
+ mnCX( 0L ),
+ mnCY( 0L ),
+ mnRX( 1L ),
+ mnRY( 1L ),
+ meKind( drawing::CircleKind_FULL ),
+ mnStartAngle( 0 ),
+ mnEndAngle( 0 )
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLEllipseShapeContext::~SdXMLEllipseShapeContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+// this is called from the parent group for each unparsed attribute in the attribute list
+void SdXMLEllipseShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ if( XML_NAMESPACE_SVG == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_RX ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(mnRX, rValue);
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_RY ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(mnRY, rValue);
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_CX ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(mnCX, rValue);
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_CY ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(mnCY, rValue);
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_R ) )
+ {
+ // single radius, it's a circle and both radii are the same
+ GetImport().GetMM100UnitConverter().convertMeasure(mnRX, rValue);
+ mnRY = mnRX;
+ return;
+ }
+ }
+ else if( XML_NAMESPACE_DRAW == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_KIND ) )
+ {
+ sal_uInt16 eKind;
+ if( SvXMLUnitConverter::convertEnum( eKind, rValue, aXML_CircleKind_EnumMap ) )
+ {
+ meKind = eKind;
+ }
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_START_ANGLE ) )
+ {
+ double dStartAngle;
+ if( SvXMLUnitConverter::convertDouble( dStartAngle, rValue ) )
+ mnStartAngle = (sal_Int32)(dStartAngle * 100.0);
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_END_ANGLE ) )
+ {
+ double dEndAngle;
+ if( SvXMLUnitConverter::convertDouble( dEndAngle, rValue ) )
+ mnEndAngle = (sal_Int32)(dEndAngle * 100.0);
+ return;
+ }
+ }
+
+ SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLEllipseShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+{
+ // create rectangle shape
+ AddShape("com.sun.star.drawing.EllipseShape");
+ if(mxShape.is())
+ {
+ // Add, set Style and properties from base shape
+ SetStyle();
+ SetLayer();
+
+ // set pos, size, shear and rotate
+ SetTransformation();
+
+ if( meKind != drawing::CircleKind_FULL )
+ {
+ uno::Reference< beans::XPropertySet > xPropSet( mxShape, uno::UNO_QUERY );
+ if( xPropSet.is() )
+ {
+ uno::Any aAny;
+ aAny <<= (drawing::CircleKind)meKind;
+ xPropSet->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CircleKind")), aAny );
+
+ aAny <<= mnStartAngle;
+ xPropSet->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CircleStartAngle")), aAny );
+
+ aAny <<= mnEndAngle;
+ xPropSet->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CircleEndAngle")), aAny );
+ }
+ }
+
+ SdXMLShapeContext::StartElement(xAttrList);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLPolygonShapeContext, SdXMLShapeContext );
+
+SdXMLPolygonShapeContext::SdXMLPolygonShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes, sal_Bool bClosed, sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
+ mbClosed( bClosed )
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+// this is called from the parent group for each unparsed attribute in the attribute list
+void SdXMLPolygonShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ if( XML_NAMESPACE_SVG == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_VIEWBOX ) )
+ {
+ maViewBox = rValue;
+ return;
+ }
+ }
+ else if( XML_NAMESPACE_DRAW == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_POINTS ) )
+ {
+ maPoints = rValue;
+ return;
+ }
+ }
+
+ SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLPolygonShapeContext::~SdXMLPolygonShapeContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLPolygonShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+{
+ // Add, set Style and properties from base shape
+ if(mbClosed)
+ AddShape("com.sun.star.drawing.PolyPolygonShape");
+ else
+ AddShape("com.sun.star.drawing.PolyLineShape");
+
+ if( mxShape.is() )
+ {
+ SetStyle();
+ SetLayer();
+
+ // set local parameters on shape
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ // set polygon
+ if(maPoints.getLength() && maViewBox.getLength())
+ {
+ SdXMLImExViewBox aViewBox(maViewBox, GetImport().GetMM100UnitConverter());
+ awt::Size aSize(aViewBox.GetWidth(), aViewBox.GetHeight());
+ if (maSize.Width != 0 && maSize.Height !=0)
+ {
+ aSize = maSize;
+ }
+ awt::Point aPosition(aViewBox.GetX(), aViewBox.GetY());
+ SdXMLImExPointsElement aPoints(maPoints, aViewBox,
+ aPosition, aSize, GetImport().GetMM100UnitConverter());
+
+ uno::Any aAny;
+ aAny <<= aPoints.GetPointSequenceSequence();
+ xPropSet->setPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry")), aAny);
+ }
+ }
+
+ // set pos, size, shear and rotate and get copy of matrix
+ SetTransformation();
+
+ SdXMLShapeContext::StartElement(xAttrList);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLPathShapeContext, SdXMLShapeContext );
+
+SdXMLPathShapeContext::SdXMLPathShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
+ mbClosed( sal_True )
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLPathShapeContext::~SdXMLPathShapeContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+// this is called from the parent group for each unparsed attribute in the attribute list
+void SdXMLPathShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ if( XML_NAMESPACE_SVG == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_VIEWBOX ) )
+ {
+ maViewBox = rValue;
+ return;
+ }
+ else if( IsXMLToken( rLocalName, XML_D ) )
+ {
+ maD = rValue;
+ return;
+ }
+ }
+
+ SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLPathShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+{
+ // create polygon shape
+ if(maD.getLength())
+ {
+ // prepare some of the parameters
+ SdXMLImExViewBox aViewBox(maViewBox, GetImport().GetMM100UnitConverter());
+ awt::Size aSize(aViewBox.GetWidth(), aViewBox.GetHeight());
+ awt::Point aPosition(aViewBox.GetX(), aViewBox.GetY());
+ if (maSize.Width != 0 && maSize.Height !=0)
+ {
+ aSize = maSize;
+ }
+ SdXMLImExSvgDElement aPoints(maD, aViewBox,
+ aPosition, aSize, GetImport().GetMM100UnitConverter());
+
+ const char* pService;
+ // now create shape
+ if(aPoints.IsCurve())
+ {
+ if(aPoints.IsClosed())
+ {
+ pService = "com.sun.star.drawing.ClosedBezierShape";
+ }
+ else
+ {
+ pService = "com.sun.star.drawing.OpenBezierShape";
+ }
+ }
+ else
+ {
+ if(aPoints.IsClosed())
+ {
+ pService = "com.sun.star.drawing.PolyPolygonShape";
+ }
+ else
+ {
+ pService = "com.sun.star.drawing.PolyLineShape";
+ }
+ }
+
+ // Add, set Style and properties from base shape
+ AddShape(pService);
+
+ // #89344# test for mxShape.is() and not for mxShapes.is() to support
+ // shape import helper classes WITHOUT XShapes (member mxShapes). This
+ // is used by the writer.
+ if( mxShape.is() )
+ {
+ SetStyle();
+ SetLayer();
+
+ // set local parameters on shape
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ uno::Any aAny;
+
+ // set svg:d
+ if(maD.getLength())
+ {
+ if(aPoints.IsCurve())
+ {
+ drawing::PolyPolygonBezierCoords aSourcePolyPolygon(
+ aPoints.GetPointSequenceSequence(),
+ aPoints.GetFlagSequenceSequence());
+
+ aAny <<= aSourcePolyPolygon;
+ xPropSet->setPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry")), aAny);
+ }
+ else
+ {
+ aAny <<= aPoints.GetPointSequenceSequence();
+ xPropSet->setPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry")), aAny);
+ }
+ }
+ }
+
+ // set pos, size, shear and rotate
+ SetTransformation();
+
+ SdXMLShapeContext::StartElement(xAttrList);
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLTextBoxShapeContext, SdXMLShapeContext );
+
+SdXMLTextBoxShapeContext::SdXMLTextBoxShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
+ mnRadius(0)
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLTextBoxShapeContext::~SdXMLTextBoxShapeContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+// this is called from the parent group for each unparsed attribute in the attribute list
+void SdXMLTextBoxShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ if( XML_NAMESPACE_DRAW == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_CORNER_RADIUS ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(mnRadius, rValue);
+ return;
+ }
+ }
+
+ SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLTextBoxShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>&)
+{
+ // create textbox shape
+ sal_Bool bIsPresShape = sal_False;
+ bool bClearText = false;
+
+ const char *pService = NULL;
+
+ if( isPresentationShape() )
+ {
+ // check if the current document supports presentation shapes
+ if( GetImport().GetShapeImport()->IsPresentationShapesSupported() )
+ {
+ if( IsXMLToken( maPresentationClass, XML_PRESENTATION_SUBTITLE ))
+ {
+ // XmlShapeTypePresSubtitleShape
+ pService = "com.sun.star.presentation.SubtitleShape";
+ }
+ else if( IsXMLToken( maPresentationClass, XML_PRESENTATION_OUTLINE ) )
+ {
+ // XmlShapeTypePresOutlinerShape
+ pService = "com.sun.star.presentation.OutlinerShape";
+ }
+ else if( IsXMLToken( maPresentationClass, XML_PRESENTATION_NOTES ) )
+ {
+ // XmlShapeTypePresNotesShape
+ pService = "com.sun.star.presentation.NotesShape";
+ }
+ else if( IsXMLToken( maPresentationClass, XML_HEADER ) )
+ {
+ // XmlShapeTypePresHeaderShape
+ pService = "com.sun.star.presentation.HeaderShape";
+ bClearText = true;
+ }
+ else if( IsXMLToken( maPresentationClass, XML_FOOTER ) )
+ {
+ // XmlShapeTypePresFooterShape
+ pService = "com.sun.star.presentation.FooterShape";
+ bClearText = true;
+ }
+ else if( IsXMLToken( maPresentationClass, XML_PAGE_NUMBER ) )
+ {
+ // XmlShapeTypePresSlideNumberShape
+ pService = "com.sun.star.presentation.SlideNumberShape";
+ bClearText = true;
+ }
+ else if( IsXMLToken( maPresentationClass, XML_DATE_TIME ) )
+ {
+ // XmlShapeTypePresDateTimeShape
+ pService = "com.sun.star.presentation.DateTimeShape";
+ bClearText = true;
+ }
+ else // IsXMLToken( maPresentationClass, XML_PRESENTATION_TITLE ) )
+ {
+ // XmlShapeTypePresTitleTextShape
+ pService = "com.sun.star.presentation.TitleTextShape";
+ }
+ bIsPresShape = sal_True;
+ }
+ }
+
+ if( NULL == pService )
+ {
+ // normal text shape
+ pService = "com.sun.star.drawing.TextShape";
+ }
+
+ // Add, set Style and properties from base shape
+ AddShape(pService);
+
+ if( mxShape.is() )
+ {
+ SetStyle();
+ SetLayer();
+
+ if(bIsPresShape)
+ {
+ uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY);
+ if(xProps.is())
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() );
+ if( xPropsInfo.is() )
+ {
+ if( !mbIsPlaceholder && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") )))
+ xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ), ::cppu::bool2any( sal_False ) );
+
+ if( mbIsUserTransformed && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") )))
+ xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") ), ::cppu::bool2any( sal_False ) );
+ }
+ }
+ }
+
+ if( bClearText )
+ {
+ uno::Reference< text::XText > xText( mxShape, uno::UNO_QUERY );
+ OUString aEmpty;
+ xText->setString( aEmpty );
+ }
+
+ // set parameters on shape
+//A AW->CL: Eventually You need to strip scale and translate from the transformation
+//A to reach the same goal again.
+//A if(!bIsPresShape || mbIsUserTransformed)
+//A {
+//A // set pos and size on shape, this should remove binding
+//A // to pres object on masterpage
+//A SetSizeAndPosition();
+//A }
+
+ // set pos, size, shear and rotate
+ SetTransformation();
+
+ if(mnRadius)
+ {
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ try
+ {
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CornerRadius")), uno::makeAny( mnRadius ) );
+ }
+ catch( uno::Exception& )
+ {
+ OSL_FAIL( "exception during setting of corner radius!");
+ }
+ }
+ }
+
+ SdXMLShapeContext::StartElement(mxAttrList);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLControlShapeContext, SdXMLShapeContext );
+
+SdXMLControlShapeContext::SdXMLControlShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape )
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLControlShapeContext::~SdXMLControlShapeContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+// this is called from the parent group for each unparsed attribute in the attribute list
+void SdXMLControlShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ if( XML_NAMESPACE_DRAW == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_CONTROL ) )
+ {
+ maFormId = rValue;
+ return;
+ }
+ }
+
+ SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+}
+
+void SdXMLControlShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+{
+ // create Control shape
+ // add, set style and properties from base shape
+ AddShape("com.sun.star.drawing.ControlShape");
+ if( mxShape.is() )
+ {
+ DBG_ASSERT( maFormId.getLength(), "draw:control without a form:id attribute!" );
+ if( maFormId.getLength() )
+ {
+ if( GetImport().IsFormsSupported() )
+ {
+ uno::Reference< awt::XControlModel > xControlModel( GetImport().GetFormImport()->lookupControl( maFormId ), uno::UNO_QUERY );
+ if( xControlModel.is() )
+ {
+ uno::Reference< drawing::XControlShape > xControl( mxShape, uno::UNO_QUERY );
+ if( xControl.is() )
+ xControl->setControl( xControlModel );
+
+ }
+ }
+ }
+
+ SetStyle();
+ SetLayer();
+
+ // set pos, size, shear and rotate
+ SetTransformation();
+
+ SdXMLShapeContext::StartElement(xAttrList);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLConnectorShapeContext, SdXMLShapeContext );
+
+SdXMLConnectorShapeContext::SdXMLConnectorShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
+ maStart(0,0),
+ maEnd(1,1),
+ mnType( (sal_uInt16)drawing::ConnectorType_STANDARD ),
+ mnStartGlueId(-1),
+ mnEndGlueId(-1),
+ mnDelta1(0),
+ mnDelta2(0),
+ mnDelta3(0)
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLConnectorShapeContext::~SdXMLConnectorShapeContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+// this is called from the parent group for each unparsed attribute in the attribute list
+void SdXMLConnectorShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ switch( nPrefix )
+ {
+ case XML_NAMESPACE_DRAW:
+ {
+ if( IsXMLToken( rLocalName, XML_START_SHAPE ) )
+ {
+ maStartShapeId = rValue;
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_START_GLUE_POINT ) )
+ {
+ mnStartGlueId = rValue.toInt32();
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_END_SHAPE ) )
+ {
+ maEndShapeId = rValue;
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_END_GLUE_POINT ) )
+ {
+ mnEndGlueId = rValue.toInt32();
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_LINE_SKEW ) )
+ {
+ SvXMLTokenEnumerator aTokenEnum( rValue );
+ OUString aToken;
+ if( aTokenEnum.getNextToken( aToken ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(mnDelta1, aToken);
+ if( aTokenEnum.getNextToken( aToken ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(mnDelta2, aToken);
+ if( aTokenEnum.getNextToken( aToken ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(mnDelta3, aToken);
+ }
+ }
+ }
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_TYPE ) )
+ {
+ SvXMLUnitConverter::convertEnum( mnType, rValue, aXML_ConnectionKind_EnumMap );
+ return;
+ }
+ }
+ case XML_NAMESPACE_SVG:
+ {
+ if( IsXMLToken( rLocalName, XML_X1 ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(maStart.X, rValue);
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_Y1 ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(maStart.Y, rValue);
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_X2 ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(maEnd.X, rValue);
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_Y2 ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(maEnd.Y, rValue);
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_D ) )
+ {
+ SdXMLImExViewBox aViewBox( 0, 0, 1, 1 );
+ awt::Point aPoint( 0, 0 );
+ awt::Size aSize( 1, 1 );
+
+ SdXMLImExSvgDElement aPoints( rValue, aViewBox,
+ aPoint, aSize, GetImport().GetMM100UnitConverter() );
+
+ if ( aPoints.IsCurve() )
+ {
+ drawing::PolyPolygonBezierCoords aSourcePolyPolygon(
+ aPoints.GetPointSequenceSequence(),
+ aPoints.GetFlagSequenceSequence());
+ maPath <<= aSourcePolyPolygon;
+ }
+ else
+ {
+ const drawing::PointSequenceSequence& rOuterSeq = aPoints.GetPointSequenceSequence();
+ drawing::FlagSequenceSequence aFlagSeqSeq( rOuterSeq.getLength() );
+ for ( int a = 0; a < rOuterSeq.getLength(); a++ )
+ aFlagSeqSeq[ a ] = drawing::FlagSequence( rOuterSeq[ a ].getLength() );
+
+ drawing::PolyPolygonBezierCoords aSourcePolyPolygon(
+ aPoints.GetPointSequenceSequence(),
+ aFlagSeqSeq );
+ maPath <<= aSourcePolyPolygon;
+ }
+ }
+ }
+ }
+
+ SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLConnectorShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+{
+ // #107928#
+ // For security reasons, do not add empty connectors. There may have been an error in EA2
+ // that created empty, far set off connectors (e.g. 63 meters below top of document). This
+ // is not guaranteed, but it's definitely safe to not add empty connectors.
+ sal_Bool bDoAdd(sal_True);
+
+ if( 0 == maStartShapeId.getLength()
+ && 0 == maEndShapeId.getLength()
+ && maStart.X == maEnd.X
+ && maStart.Y == maEnd.Y
+ && 0 == mnDelta1
+ && 0 == mnDelta2
+ && 0 == mnDelta3
+ )
+ {
+ bDoAdd = sal_False;
+ }
+
+ if(bDoAdd)
+ {
+ // create Connector shape
+ // add, set style and properties from base shape
+ AddShape("com.sun.star.drawing.ConnectorShape");
+ if(mxShape.is())
+ {
+ // add connection ids
+ if( maStartShapeId.getLength() )
+ GetImport().GetShapeImport()->addShapeConnection( mxShape, sal_True, maStartShapeId, mnStartGlueId );
+ if( maEndShapeId.getLength() )
+ GetImport().GetShapeImport()->addShapeConnection( mxShape, sal_False, maEndShapeId, mnEndGlueId );
+
+ uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY );
+ if( xProps.is() )
+ {
+ uno::Any aAny;
+ aAny <<= maStart;
+ xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartPosition")), aAny);
+
+ aAny <<= maEnd;
+ xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndPosition")), aAny );
+
+ aAny <<= (drawing::ConnectorType)mnType;
+ xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeKind")), aAny );
+
+ aAny <<= mnDelta1;
+ xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeLine1Delta")), aAny );
+
+ aAny <<= mnDelta2;
+ xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeLine2Delta")), aAny );
+
+ aAny <<= mnDelta3;
+ xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeLine3Delta")), aAny );
+ }
+ SetStyle();
+ SetLayer();
+
+ if ( maPath.hasValue() )
+ {
+ // --> OD #i115492#
+ // Ignore svg:d attribute for text documents created by OpenOffice.org
+ // versions before OOo 3.3, because these OOo versions are storing
+ // svg:d values not using the correct unit.
+ bool bApplySVGD( true );
+ if ( uno::Reference< text::XTextDocument >(GetImport().GetModel(), uno::UNO_QUERY).is() )
+ {
+ sal_Int32 nUPD( 0 );
+ sal_Int32 nBuild( 0 );
+ const bool bBuildIdFound = GetImport().getBuildIds( nUPD, nBuild );
+ if ( GetImport().IsTextDocInOOoFileFormat() ||
+ ( bBuildIdFound &&
+ ( ( nUPD == 641 ) || ( nUPD == 645 ) || // prior OOo 2.0
+ ( nUPD == 680 ) || // OOo 2.x
+ ( nUPD == 300 ) || // OOo 3.0 - OOo 3.0.1
+ ( nUPD == 310 ) || // OOo 3.1 - OOo 3.1.1
+ ( nUPD == 320 ) ) ) ) // OOo 3.2 - OOo 3.2.1
+ {
+ bApplySVGD = false;
+ }
+ }
+
+ if ( bApplySVGD )
+ {
+ xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("PolyPolygonBezier") ), maPath );
+ }
+ // <--
+ }
+
+ SdXMLShapeContext::StartElement(xAttrList);
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLMeasureShapeContext, SdXMLShapeContext );
+
+SdXMLMeasureShapeContext::SdXMLMeasureShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
+ maStart(0,0),
+ maEnd(1,1)
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLMeasureShapeContext::~SdXMLMeasureShapeContext()
+{
+}
+
+// this is called from the parent group for each unparsed attribute in the attribute list
+void SdXMLMeasureShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ switch( nPrefix )
+ {
+ case XML_NAMESPACE_SVG:
+ {
+ if( IsXMLToken( rLocalName, XML_X1 ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(maStart.X, rValue);
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_Y1 ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(maStart.Y, rValue);
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_X2 ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(maEnd.X, rValue);
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_Y2 ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(maEnd.Y, rValue);
+ return;
+ }
+ }
+ }
+
+ SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLMeasureShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+{
+ // create Measure shape
+ // add, set style and properties from base shape
+ AddShape("com.sun.star.drawing.MeasureShape");
+ if(mxShape.is())
+ {
+ SetStyle();
+ SetLayer();
+
+ uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY );
+ if( xProps.is() )
+ {
+ uno::Any aAny;
+ aAny <<= maStart;
+ xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartPosition")), aAny);
+
+ aAny <<= maEnd;
+ xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndPosition")), aAny );
+ }
+
+ // delete pre created fields
+ uno::Reference< text::XText > xText( mxShape, uno::UNO_QUERY );
+ if( xText.is() )
+ {
+ const OUString aEmpty( RTL_CONSTASCII_USTRINGPARAM( " " ) );
+ xText->setString( aEmpty );
+ }
+
+ SdXMLShapeContext::StartElement(xAttrList);
+ }
+}
+
+void SdXMLMeasureShapeContext::EndElement()
+{
+ do
+ {
+ // delete pre created fields
+ uno::Reference< text::XText > xText( mxShape, uno::UNO_QUERY );
+ if( !xText.is() )
+ break;
+
+ uno::Reference< text::XTextCursor > xCursor( xText->createTextCursor() );
+ if( !xCursor.is() )
+ break;
+
+ const OUString aEmpty;
+ xCursor->collapseToStart();
+ xCursor->goRight( 1, sal_True );
+ xCursor->setString( aEmpty );
+ }
+ while(0);
+
+ SdXMLShapeContext::EndElement();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLPageShapeContext, SdXMLShapeContext );
+
+SdXMLPageShapeContext::SdXMLPageShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ), mnPageNumber(0)
+{
+ mbClearDefaultAttributes = false;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLPageShapeContext::~SdXMLPageShapeContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+// this is called from the parent group for each unparsed attribute in the attribute list
+void SdXMLPageShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ if( XML_NAMESPACE_DRAW == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_PAGE_NUMBER ) )
+ {
+ mnPageNumber = rValue.toInt32();
+ return;
+ }
+ }
+
+ SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLPageShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+{
+ // create Page shape
+ // add, set style and properties from base shape
+
+ // #86163# take into account which type of PageShape needs to
+ // be constructed. It's an pres shape if presentation:XML_CLASS == XML_PRESENTATION_PAGE.
+ sal_Bool bIsPresentation = maPresentationClass.getLength() &&
+ GetImport().GetShapeImport()->IsPresentationShapesSupported();
+
+ uno::Reference< lang::XServiceInfo > xInfo( mxShapes, uno::UNO_QUERY );
+ const sal_Bool bIsOnHandoutPage = xInfo.is() && xInfo->supportsService( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.HandoutMasterPage")) );
+
+ if( bIsOnHandoutPage )
+ {
+ AddShape("com.sun.star.presentation.HandoutShape");
+ }
+ else
+ {
+ if(bIsPresentation && !IsXMLToken( maPresentationClass, XML_PRESENTATION_PAGE ) )
+ {
+ bIsPresentation = sal_False;
+ }
+
+ if(bIsPresentation)
+ {
+ AddShape("com.sun.star.presentation.PageShape");
+ }
+ else
+ {
+ AddShape("com.sun.star.drawing.PageShape");
+ }
+ }
+
+ if(mxShape.is())
+ {
+ SetStyle();
+ SetLayer();
+
+ // set pos, size, shear and rotate
+ SetTransformation();
+
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
+ const OUString aPageNumberStr(RTL_CONSTASCII_USTRINGPARAM("PageNumber"));
+ if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(aPageNumberStr))
+ xPropSet->setPropertyValue(aPageNumberStr, uno::makeAny( mnPageNumber ));
+ }
+
+ SdXMLShapeContext::StartElement(xAttrList);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLCaptionShapeContext, SdXMLShapeContext );
+
+SdXMLCaptionShapeContext::SdXMLCaptionShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
+ // #86616# for correct edge rounding import mnRadius needs to be initialized
+ mnRadius( 0L )
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLCaptionShapeContext::~SdXMLCaptionShapeContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLCaptionShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+{
+ // create Caption shape
+ // add, set style and properties from base shape
+ AddShape("com.sun.star.drawing.CaptionShape");
+ if( mxShape.is() )
+ {
+ SetStyle();
+ SetLayer();
+
+ uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY );
+
+ // SJ: If AutoGrowWidthItem is set, SetTransformation will lead to the wrong SnapRect
+ // because NbcAdjustTextFrameWidthAndHeight() is called (text is set later and center alignment
+ // is the default setting, so the top left reference point that is used by the caption point is
+ // no longer correct) There are two ways to solve this problem, temporarily disabling the
+ // autogrowwith as we are doing here or to apply the CaptionPoint after setting text
+ sal_Bool bIsAutoGrowWidth = sal_False;
+ if ( xProps.is() )
+ {
+ uno::Any aAny( xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("TextAutoGrowWidth") ) ) );
+ aAny >>= bIsAutoGrowWidth;
+
+ if ( bIsAutoGrowWidth )
+ xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("TextAutoGrowWidth")), uno::makeAny( sal_False ) );
+ }
+
+ // set pos, size, shear and rotate
+ SetTransformation();
+ if( xProps.is() )
+ xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CaptionPoint")), uno::makeAny( maCaptionPoint ) );
+
+ if ( bIsAutoGrowWidth )
+ xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("TextAutoGrowWidth")), uno::makeAny( sal_True ) );
+
+ if(mnRadius)
+ {
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ try
+ {
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CornerRadius")), uno::makeAny( mnRadius ) );
+ }
+ catch( uno::Exception& )
+ {
+ OSL_FAIL( "exception during setting of corner radius!");
+ }
+ }
+ }
+
+ SdXMLShapeContext::StartElement(xAttrList);
+ }
+}
+
+// this is called from the parent group for each unparsed attribute in the attribute list
+void SdXMLCaptionShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ if( XML_NAMESPACE_DRAW == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_CAPTION_POINT_X ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(maCaptionPoint.X, rValue);
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_CAPTION_POINT_Y ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(maCaptionPoint.Y, rValue);
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_CORNER_RADIUS ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(mnRadius, rValue);
+ return;
+ }
+ }
+ SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLGraphicObjectShapeContext, SdXMLShapeContext );
+
+SdXMLGraphicObjectShapeContext::SdXMLGraphicObjectShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
+ maURL()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+// this is called from the parent group for each unparsed attribute in the attribute list
+void SdXMLGraphicObjectShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ if( XML_NAMESPACE_XLINK == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_HREF ) )
+ {
+ maURL = rValue;
+ return;
+ }
+ }
+
+ SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLGraphicObjectShapeContext::StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& )
+{
+ // create graphic object shape
+ const char *pService;
+
+ if( IsXMLToken( maPresentationClass, XML_GRAPHIC ) && GetImport().GetShapeImport()->IsPresentationShapesSupported() )
+ {
+ pService = "com.sun.star.presentation.GraphicObjectShape";
+ }
+ else
+ {
+ pService = "com.sun.star.drawing.GraphicObjectShape";
+ }
+
+ AddShape( pService );
+
+ if(mxShape.is())
+ {
+ SetStyle();
+ SetLayer();
+
+ uno::Reference< beans::XPropertySet > xPropset(mxShape, uno::UNO_QUERY);
+ if(xPropset.is())
+ {
+ // since OOo 1.x had no line or fill style for graphics, but may create
+ // documents with them, we have to override them here
+ sal_Int32 nUPD, nBuildId;
+ if( GetImport().getBuildIds( nUPD, nBuildId ) && (nUPD == 645) ) try
+ {
+ xPropset->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("FillStyle")), Any( FillStyle_NONE ) );
+ xPropset->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("LineStyle")), Any( LineStyle_NONE ) );
+ }
+ catch( Exception& )
+ {
+ }
+
+ uno::Reference< beans::XPropertySetInfo > xPropsInfo( xPropset->getPropertySetInfo() );
+ if( xPropsInfo.is() && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") )))
+ xPropset->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ), ::cppu::bool2any( mbIsPlaceholder ) );
+
+ if( !mbIsPlaceholder )
+ {
+ if( maURL.getLength() )
+ {
+ uno::Any aAny;
+ aAny <<= GetImport().ResolveGraphicObjectURL( maURL, GetImport().isGraphicLoadOnDemandSupported() );
+ try
+ {
+ xPropset->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicURL") ), aAny );
+ xPropset->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicStreamURL") ), aAny );
+ }
+ catch (lang::IllegalArgumentException const &)
+ {
+ }
+ }
+ }
+ }
+
+ if(mbIsUserTransformed)
+ {
+ uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY);
+ if(xProps.is())
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() );
+ if( xPropsInfo.is() )
+ {
+ if( xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") )))
+ xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") ), ::cppu::bool2any( sal_False ) );
+ }
+ }
+ }
+
+ // set pos, size, shear and rotate
+ SetTransformation();
+
+ SdXMLShapeContext::StartElement(mxAttrList);
+ }
+}
+
+void SdXMLGraphicObjectShapeContext::EndElement()
+{
+ if( mxBase64Stream.is() )
+ {
+ OUString sURL( GetImport().ResolveGraphicObjectURLFromBase64( mxBase64Stream ) );
+ if( sURL.getLength() )
+ {
+ try
+ {
+ uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY);
+ if(xProps.is())
+ {
+ const uno::Any aAny( uno::makeAny( sURL ) );
+ xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicURL") ), aAny );
+ xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicStreamURL") ), aAny );
+ }
+ }
+ catch (lang::IllegalArgumentException const &)
+ {
+ }
+ }
+ }
+
+ SdXMLShapeContext::EndElement();
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLImportContext* SdXMLGraphicObjectShapeContext::CreateChildContext(
+ sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList )
+{
+ SvXMLImportContext* pContext = NULL;
+
+ if( (XML_NAMESPACE_OFFICE == nPrefix) &&
+ xmloff::token::IsXMLToken( rLocalName, xmloff::token::XML_BINARY_DATA ) )
+ {
+ if( !maURL.getLength() && !mxBase64Stream.is() )
+ {
+ mxBase64Stream = GetImport().GetStreamForGraphicObjectURLFromBase64();
+ if( mxBase64Stream.is() )
+ pContext = new XMLBase64ImportContext( GetImport(), nPrefix,
+ rLocalName, xAttrList,
+ mxBase64Stream );
+ }
+ }
+
+ // delegate to parent class if no context could be created
+ if ( NULL == pContext )
+ pContext = SdXMLShapeContext::CreateChildContext(nPrefix, rLocalName,
+ xAttrList);
+
+ return pContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLGraphicObjectShapeContext::~SdXMLGraphicObjectShapeContext()
+{
+
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLChartShapeContext, SdXMLShapeContext );
+
+SdXMLChartShapeContext::SdXMLChartShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
+ mpChartContext( NULL )
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLChartShapeContext::~SdXMLChartShapeContext()
+{
+ if( mpChartContext )
+ delete mpChartContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLChartShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+{
+ const sal_Bool bIsPresentation = isPresentationShape();
+
+ AddShape( bIsPresentation ? "com.sun.star.presentation.ChartShape" : "com.sun.star.drawing.OLE2Shape" );
+
+ if(mxShape.is())
+ {
+ SetStyle();
+ SetLayer();
+
+ if( !mbIsPlaceholder )
+ {
+ uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY);
+ if(xProps.is())
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() );
+ if( xPropsInfo.is() && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") )))
+ xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ), ::cppu::bool2any( sal_False ) );
+
+ uno::Any aAny;
+
+ const OUString aCLSID( RTL_CONSTASCII_USTRINGPARAM("12DCAE26-281F-416F-a234-c3086127382e"));
+
+ aAny <<= aCLSID;
+ xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CLSID") ), aAny );
+
+ aAny = xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("Model") ) );
+ uno::Reference< frame::XModel > xChartModel;
+ if( aAny >>= xChartModel )
+ {
+ mpChartContext = GetImport().GetChartImport()->CreateChartContext( GetImport(), XML_NAMESPACE_SVG, GetXMLToken(XML_CHART), xChartModel, xAttrList );
+ }
+ }
+ }
+
+ if(mbIsUserTransformed)
+ {
+ uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY);
+ if(xProps.is())
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() );
+ if( xPropsInfo.is() )
+ {
+ if( xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") )))
+ xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") ), ::cppu::bool2any( sal_False ) );
+ }
+ }
+ }
+
+
+ // set pos, size, shear and rotate
+ SetTransformation();
+
+ SdXMLShapeContext::StartElement(xAttrList);
+
+ if( mpChartContext )
+ mpChartContext->StartElement( xAttrList );
+ }
+}
+
+void SdXMLChartShapeContext::EndElement()
+{
+ if( mpChartContext )
+ mpChartContext->EndElement();
+
+ SdXMLShapeContext::EndElement();
+}
+
+void SdXMLChartShapeContext::Characters( const ::rtl::OUString& rChars )
+{
+ if( mpChartContext )
+ mpChartContext->Characters( rChars );
+}
+
+SvXMLImportContext * SdXMLChartShapeContext::CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList )
+{
+ if( mpChartContext )
+ return mpChartContext->CreateChildContext( nPrefix, rLocalName, xAttrList );
+
+ return NULL;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLObjectShapeContext, SdXMLShapeContext );
+
+SdXMLObjectShapeContext::SdXMLObjectShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape )
+{
+}
+
+SdXMLObjectShapeContext::~SdXMLObjectShapeContext()
+{
+}
+
+void SdXMLObjectShapeContext::StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& )
+{
+ // #96717# in theorie, if we don't have a url we shouldn't even
+ // export this ole shape. But practical its to risky right now
+ // to change this so we better dispose this on load
+ //if( !mbIsPlaceholder && ImpIsEmptyURL(maHref) )
+ // return;
+
+ // #100592# this BugFix prevents that a shape is created. CL
+ // is thinking about an alternative.
+ // #i13140# Check for more than empty string in maHref, there are
+ // other possibilities that maHref results in empty container
+ // storage names
+ if( !(GetImport().getImportFlags() & IMPORT_EMBEDDED) && !mbIsPlaceholder && ImpIsEmptyURL(maHref) )
+ return;
+
+ const char* pService = "com.sun.star.drawing.OLE2Shape";
+
+ sal_Bool bIsPresShape = maPresentationClass.getLength() && GetImport().GetShapeImport()->IsPresentationShapesSupported();
+
+ if( bIsPresShape )
+ {
+ if( IsXMLToken( maPresentationClass, XML_PRESENTATION_CHART ) )
+ {
+ pService = "com.sun.star.presentation.ChartShape";
+ }
+ else if( IsXMLToken( maPresentationClass, XML_PRESENTATION_TABLE ) )
+ {
+ pService = "com.sun.star.presentation.CalcShape";
+ }
+ else if( IsXMLToken( maPresentationClass, XML_PRESENTATION_OBJECT ) )
+ {
+ pService = "com.sun.star.presentation.OLE2Shape";
+ }
+ }
+
+ AddShape( pService );
+
+ if( mxShape.is() )
+ {
+ SetLayer();
+
+ if(bIsPresShape)
+ {
+ uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY);
+ if(xProps.is())
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() );
+ if( xPropsInfo.is() )
+ {
+ if( !mbIsPlaceholder && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") )))
+ xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ), ::cppu::bool2any( sal_False ) );
+
+ if( mbIsUserTransformed && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") )))
+ xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") ), ::cppu::bool2any( sal_False ) );
+ }
+ }
+ }
+
+ if( !mbIsPlaceholder && maHref.getLength() )
+ {
+ uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY );
+
+ if( xProps.is() )
+ {
+ OUString aPersistName = GetImport().ResolveEmbeddedObjectURL( maHref, maCLSID );
+
+ if ( GetImport().IsPackageURL( maHref ) )
+ {
+ const OUString sURL(RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.EmbeddedObject:" ));
+
+ if ( aPersistName.compareTo( sURL, sURL.getLength() ) == 0 )
+ aPersistName = aPersistName.copy( sURL.getLength() );
+
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "PersistName" ) ),
+ uno::makeAny( aPersistName ) );
+ }
+ else
+ {
+ // this is OOo link object
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "LinkURL" ) ),
+ uno::makeAny( aPersistName ) );
+ }
+ }
+ }
+
+ // set pos, size, shear and rotate
+ SetTransformation();
+
+ SetStyle();
+
+ GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes );
+ }
+}
+
+void SdXMLObjectShapeContext::EndElement()
+{
+ // #100592#
+ if( mxBase64Stream.is() )
+ {
+ OUString aPersistName( GetImport().ResolveEmbeddedObjectURLFromBase64() );
+ const OUString sURL(RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.EmbeddedObject:" ));
+
+ aPersistName = aPersistName.copy( sURL.getLength() );
+
+ uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY);
+ if( xProps.is() )
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "PersistName" ) ), uno::makeAny( aPersistName ) );
+ }
+
+ SdXMLShapeContext::EndElement();
+}
+
+// this is called from the parent group for each unparsed attribute in the attribute list
+void SdXMLObjectShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ switch( nPrefix )
+ {
+ case XML_NAMESPACE_DRAW:
+ if( IsXMLToken( rLocalName, XML_CLASS_ID ) )
+ {
+ maCLSID = rValue;
+ return;
+ }
+ break;
+ case XML_NAMESPACE_XLINK:
+ if( IsXMLToken( rLocalName, XML_HREF ) )
+ {
+ maHref = rValue;
+ return;
+ }
+ break;
+ }
+
+ SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+}
+
+SvXMLImportContext* SdXMLObjectShapeContext::CreateChildContext(
+ sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList )
+{
+ // #100592#
+ SvXMLImportContext* pContext = NULL;
+
+ if((XML_NAMESPACE_OFFICE == nPrefix) && IsXMLToken(rLocalName, XML_BINARY_DATA))
+ {
+ mxBase64Stream = GetImport().GetStreamForEmbeddedObjectURLFromBase64();
+ if( mxBase64Stream.is() )
+ pContext = new XMLBase64ImportContext( GetImport(), nPrefix,
+ rLocalName, xAttrList,
+ mxBase64Stream );
+ }
+ else if( ((XML_NAMESPACE_OFFICE == nPrefix) && IsXMLToken(rLocalName, XML_DOCUMENT)) ||
+ ((XML_NAMESPACE_MATH == nPrefix) && IsXMLToken(rLocalName, XML_MATH)) )
+ {
+ XMLEmbeddedObjectImportContext *pEContext =
+ new XMLEmbeddedObjectImportContext( GetImport(), nPrefix,
+ rLocalName, xAttrList );
+ maCLSID = pEContext->GetFilterCLSID();
+ if( maCLSID.getLength() != 0 )
+ {
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
+ if( xPropSet.is() )
+ {
+ xPropSet->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CLSID") ), uno::makeAny( maCLSID ) );
+
+ uno::Reference< lang::XComponent > xComp;
+ xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("Model") ) ) >>= xComp;
+ DBG_ASSERT( xComp.is(), "no xModel for own OLE format" );
+ pEContext->SetComponent( xComp );
+ }
+ }
+ pContext = pEContext;
+ }
+
+ // delegate to parent class if no context could be created
+ if(!pContext)
+ pContext = SdXMLShapeContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
+
+ return pContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLAppletShapeContext, SdXMLShapeContext );
+
+SdXMLAppletShapeContext::SdXMLAppletShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
+ mbIsScript( sal_False )
+{
+}
+
+SdXMLAppletShapeContext::~SdXMLAppletShapeContext()
+{
+}
+
+void SdXMLAppletShapeContext::StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& )
+{
+ const char* pService = "com.sun.star.drawing.AppletShape";
+ AddShape( pService );
+
+ if( mxShape.is() )
+ {
+ SetLayer();
+
+ // set pos, size, shear and rotate
+ SetTransformation();
+ GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes );
+ }
+}
+
+// this is called from the parent group for each unparsed attribute in the attribute list
+void SdXMLAppletShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ switch( nPrefix )
+ {
+ case XML_NAMESPACE_DRAW:
+ if( IsXMLToken( rLocalName, XML_APPLET_NAME ) )
+ {
+ maAppletName = rValue;
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_CODE ) )
+ {
+ maAppletCode = rValue;
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_MAY_SCRIPT ) )
+ {
+ mbIsScript = IsXMLToken( rValue, XML_TRUE );
+ return;
+ }
+ break;
+ case XML_NAMESPACE_XLINK:
+ if( IsXMLToken( rLocalName, XML_HREF ) )
+ {
+ maHref = GetImport().GetAbsoluteReference(rValue);
+ return;
+ }
+ break;
+ }
+
+ SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+}
+
+void SdXMLAppletShapeContext::EndElement()
+{
+ uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY );
+ if( xProps.is() )
+ {
+ uno::Any aAny;
+
+ if ( maSize.Width && maSize.Height )
+ {
+ // the visual area for applet must be set on loading
+ awt::Rectangle aRect( 0, 0, maSize.Width, maSize.Height );
+ aAny <<= aRect;
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "VisibleArea" ) ), aAny );
+ }
+
+ if( maParams.getLength() )
+ {
+ aAny <<= maParams;
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletCommands" ) ), aAny );
+ }
+
+ if( maHref.getLength() )
+ {
+ aAny <<= maHref;
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletCodeBase" ) ), aAny );
+ }
+
+ if( maAppletName.getLength() )
+ {
+ aAny <<= maAppletName;
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletName" ) ), aAny );
+ }
+
+ if( mbIsScript )
+ {
+ aAny <<= mbIsScript;
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletIsScript" ) ), aAny );
+
+ }
+
+ if( maAppletCode.getLength() )
+ {
+ aAny <<= maAppletCode;
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletCode" ) ), aAny );
+ }
+
+ aAny <<= ::rtl::OUString( GetImport().GetDocumentBase() );
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletDocBase" ) ), aAny );
+
+ SetThumbnail();
+ }
+
+ SdXMLShapeContext::EndElement();
+}
+
+SvXMLImportContext * SdXMLAppletShapeContext::CreateChildContext( sal_uInt16 p_nPrefix, const ::rtl::OUString& rLocalName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList )
+{
+ if( p_nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( rLocalName, XML_PARAM ) )
+ {
+ OUString aParamName, aParamValue;
+ const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ // now parse the attribute list and look for draw:name and draw:value
+ for(sal_Int16 a(0); a < nAttrCount; a++)
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex(a);
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(rAttrName, &aLocalName);
+ const OUString aValue( xAttrList->getValueByIndex(a) );
+
+ if( nPrefix == XML_NAMESPACE_DRAW )
+ {
+ if( IsXMLToken( aLocalName, XML_NAME ) )
+ {
+ aParamName = aValue;
+ }
+ else if( IsXMLToken( aLocalName, XML_VALUE ) )
+ {
+ aParamValue = aValue;
+ }
+ }
+ }
+
+ if( aParamName.getLength() )
+ {
+ sal_Int32 nIndex = maParams.getLength();
+ maParams.realloc( nIndex + 1 );
+ maParams[nIndex].Name = aParamName;
+ maParams[nIndex].Handle = -1;
+ maParams[nIndex].Value <<= aParamValue;
+ maParams[nIndex].State = beans::PropertyState_DIRECT_VALUE;
+ }
+
+ return new SvXMLImportContext( GetImport(), p_nPrefix, rLocalName );
+ }
+
+ return SdXMLShapeContext::CreateChildContext( p_nPrefix, rLocalName, xAttrList );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLPluginShapeContext, SdXMLShapeContext );
+
+SdXMLPluginShapeContext::SdXMLPluginShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape) :
+SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
+mbMedia( false )
+{
+}
+
+SdXMLPluginShapeContext::~SdXMLPluginShapeContext()
+{
+}
+
+void SdXMLPluginShapeContext::StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList)
+{
+ // watch for MimeType attribute to see if we have a media object
+ for( sal_Int16 n = 0, nAttrCount = ( xAttrList.is() ? xAttrList->getLength() : 0 ); n < nAttrCount; ++n )
+ {
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( xAttrList->getNameByIndex( n ), &aLocalName );
+
+ if( nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( aLocalName, XML_MIME_TYPE ) )
+ {
+ if( 0 == xAttrList->getValueByIndex( n ).compareToAscii( "application/vnd.sun.star.media" ) )
+ mbMedia = true;
+
+ // leave this loop
+ n = nAttrCount - 1;
+ }
+ }
+
+ const char* pService;
+
+ sal_Bool bIsPresShape = sal_False;
+
+ if( mbMedia )
+ {
+ pService = "com.sun.star.drawing.MediaShape";
+
+ bIsPresShape = maPresentationClass.getLength() && GetImport().GetShapeImport()->IsPresentationShapesSupported();
+ if( bIsPresShape )
+ {
+ if( IsXMLToken( maPresentationClass, XML_PRESENTATION_OBJECT ) )
+ {
+ pService = "com.sun.star.presentation.MediaShape";
+ }
+ }
+ }
+ else
+ pService = "com.sun.star.drawing.PluginShape";
+
+ AddShape( pService );
+
+ if( mxShape.is() )
+ {
+ SetLayer();
+
+ if(bIsPresShape)
+ {
+ uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY );
+ if(xProps.is())
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() );
+ if( xPropsInfo.is() )
+ {
+ if( !mbIsPlaceholder && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") )))
+ xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ), ::cppu::bool2any( sal_False ) );
+
+ if( mbIsUserTransformed && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") )))
+ xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") ), ::cppu::bool2any( sal_False ) );
+ }
+ }
+ }
+
+ // set pos, size, shear and rotate
+ SetTransformation();
+ GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes );
+ }
+}
+
+// this is called from the parent group for each unparsed attribute in the attribute list
+void SdXMLPluginShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ switch( nPrefix )
+ {
+ case XML_NAMESPACE_DRAW:
+ if( IsXMLToken( rLocalName, XML_MIME_TYPE ) )
+ {
+ maMimeType = rValue;
+ return;
+ }
+ break;
+ case XML_NAMESPACE_XLINK:
+ if( IsXMLToken( rLocalName, XML_HREF ) )
+ {
+ maHref = GetImport().GetAbsoluteReference(rValue);
+ return;
+ }
+ break;
+ }
+
+ SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+}
+
+void SdXMLPluginShapeContext::EndElement()
+{
+ uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY );
+
+ if( xProps.is() )
+ {
+ uno::Any aAny;
+
+ if ( maSize.Width && maSize.Height )
+ {
+ const rtl::OUString sVisibleArea( RTL_CONSTASCII_USTRINGPARAM( "VisibleArea" ) );
+ uno::Reference< beans::XPropertySetInfo > aXPropSetInfo( xProps->getPropertySetInfo() );
+ if ( !aXPropSetInfo.is() || aXPropSetInfo->hasPropertyByName( sVisibleArea ) )
+ {
+ // the visual area for a plugin must be set on loading
+ awt::Rectangle aRect( 0, 0, maSize.Width, maSize.Height );
+ aAny <<= aRect;
+ xProps->setPropertyValue( sVisibleArea, aAny );
+ }
+ }
+
+ if( !mbMedia )
+ {
+ // in case we have a plugin object
+ if( maParams.getLength() )
+ {
+ aAny <<= maParams;
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "PluginCommands" ) ), aAny );
+ }
+
+ if( maMimeType.getLength() )
+ {
+ aAny <<= maMimeType;
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "PluginMimeType" ) ), aAny );
+ }
+
+ if( maHref.getLength() )
+ {
+ aAny <<= maHref;
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "PluginURL" ) ), aAny );
+ }
+ }
+ else
+ {
+ // in case we have a media object
+
+ OUString sTempRef;
+
+ // check for package URL
+ if( GetImport().IsPackageURL( maHref ) )
+ {
+ sTempRef = OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package:" ) );
+ }
+
+ sTempRef += maHref;
+
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaURL" ) ), uno::makeAny( sTempRef ) );
+
+ for( sal_Int32 nParam = 0; nParam < maParams.getLength(); ++nParam )
+ {
+ const OUString& rName = maParams[ nParam ].Name;
+
+ if( 0 == rName.compareToAscii( "Loop" ) )
+ {
+ OUString aValueStr;
+ maParams[ nParam ].Value >>= aValueStr;
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Loop" ) ),
+ uno::makeAny( static_cast< sal_Bool >( 0 == aValueStr.compareToAscii( "true" ) ) ) );
+ }
+ else if( 0 == rName.compareToAscii( "Mute" ) )
+ {
+ OUString aValueStr;
+ maParams[ nParam ].Value >>= aValueStr;
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Mute" ) ),
+ uno::makeAny( static_cast< sal_Bool >( 0 == aValueStr.compareToAscii( "true" ) ) ) );
+ }
+ else if( 0 == rName.compareToAscii( "VolumeDB" ) )
+ {
+ OUString aValueStr;
+ maParams[ nParam ].Value >>= aValueStr;
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "VolumeDB" ) ),
+ uno::makeAny( static_cast< sal_Int16 >( aValueStr.toInt32() ) ) );
+ }
+ else if( 0 == rName.compareToAscii( "Zoom" ) )
+ {
+ OUString aZoomStr;
+ media::ZoomLevel eZoomLevel;
+
+ maParams[ nParam ].Value >>= aZoomStr;
+
+ if( 0 == aZoomStr.compareToAscii( "25%" ) )
+ eZoomLevel = media::ZoomLevel_ZOOM_1_TO_4;
+ else if( 0 == aZoomStr.compareToAscii( "50%" ) )
+ eZoomLevel = media::ZoomLevel_ZOOM_1_TO_2;
+ else if( 0 == aZoomStr.compareToAscii( "100%" ) )
+ eZoomLevel = media::ZoomLevel_ORIGINAL;
+ else if( 0 == aZoomStr.compareToAscii( "200%" ) )
+ eZoomLevel = media::ZoomLevel_ZOOM_2_TO_1;
+ else if( 0 == aZoomStr.compareToAscii( "400%" ) )
+ eZoomLevel = media::ZoomLevel_ZOOM_4_TO_1;
+ else if( 0 == aZoomStr.compareToAscii( "fit" ) )
+ eZoomLevel = media::ZoomLevel_FIT_TO_WINDOW;
+ else if( 0 == aZoomStr.compareToAscii( "fixedfit" ) )
+ eZoomLevel = media::ZoomLevel_FIT_TO_WINDOW_FIXED_ASPECT;
+ else if( 0 == aZoomStr.compareToAscii( "fullscreen" ) )
+ eZoomLevel = media::ZoomLevel_FULLSCREEN;
+ else
+ eZoomLevel = media::ZoomLevel_NOT_AVAILABLE;
+
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Zoom" ) ), uno::makeAny( eZoomLevel ) );
+ }
+ }
+ }
+
+ SetThumbnail();
+ }
+
+ SdXMLShapeContext::EndElement();
+}
+
+SvXMLImportContext * SdXMLPluginShapeContext::CreateChildContext( sal_uInt16 p_nPrefix, const ::rtl::OUString& rLocalName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList )
+{
+ if( p_nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( rLocalName, XML_PARAM ) )
+ {
+ OUString aParamName, aParamValue;
+ const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ // now parse the attribute list and look for draw:name and draw:value
+ for(sal_Int16 a(0); a < nAttrCount; a++)
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex(a);
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(rAttrName, &aLocalName);
+ const OUString aValue( xAttrList->getValueByIndex(a) );
+
+ if( nPrefix == XML_NAMESPACE_DRAW )
+ {
+ if( IsXMLToken( aLocalName, XML_NAME ) )
+ {
+ aParamName = aValue;
+ }
+ else if( IsXMLToken( aLocalName, XML_VALUE ) )
+ {
+ aParamValue = aValue;
+ }
+ }
+
+ if( aParamName.getLength() )
+ {
+ sal_Int32 nIndex = maParams.getLength();
+ maParams.realloc( nIndex + 1 );
+ maParams[nIndex].Name = aParamName;
+ maParams[nIndex].Handle = -1;
+ maParams[nIndex].Value <<= aParamValue;
+ maParams[nIndex].State = beans::PropertyState_DIRECT_VALUE;
+ }
+ }
+
+ return new SvXMLImportContext( GetImport(), p_nPrefix, rLocalName );
+ }
+
+ return SdXMLShapeContext::CreateChildContext( p_nPrefix, rLocalName, xAttrList );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLFloatingFrameShapeContext, SdXMLShapeContext );
+
+SdXMLFloatingFrameShapeContext::SdXMLFloatingFrameShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape )
+{
+}
+
+SdXMLFloatingFrameShapeContext::~SdXMLFloatingFrameShapeContext()
+{
+}
+
+void SdXMLFloatingFrameShapeContext::StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& )
+{
+ const char* pService = "com.sun.star.drawing.FrameShape";
+ AddShape( pService );
+
+ if( mxShape.is() )
+ {
+ SetLayer();
+
+ // set pos, size, shear and rotate
+ SetTransformation();
+
+ uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY );
+ if( xProps.is() )
+ {
+ uno::Any aAny;
+
+ if( maFrameName.getLength() )
+ {
+ aAny <<= maFrameName;
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "FrameName" ) ), aAny );
+ }
+
+ if( maHref.getLength() )
+ {
+ aAny <<= maHref;
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "FrameURL" ) ), aAny );
+ }
+ }
+
+ SetStyle();
+
+ GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes );
+ }
+}
+
+// this is called from the parent group for each unparsed attribute in the attribute list
+void SdXMLFloatingFrameShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ switch( nPrefix )
+ {
+ case XML_NAMESPACE_DRAW:
+ if( IsXMLToken( rLocalName, XML_FRAME_NAME ) )
+ {
+ maFrameName = rValue;
+ return;
+ }
+ break;
+ case XML_NAMESPACE_XLINK:
+ if( IsXMLToken( rLocalName, XML_HREF ) )
+ {
+ maHref = GetImport().GetAbsoluteReference(rValue);
+ return;
+ }
+ break;
+ }
+
+ SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+}
+
+void SdXMLFloatingFrameShapeContext::EndElement()
+{
+ uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY );
+
+ if( xProps.is() )
+ {
+ if ( maSize.Width && maSize.Height )
+ {
+ // the visual area for a floating frame must be set on loading
+ awt::Rectangle aRect( 0, 0, maSize.Width, maSize.Height );
+ uno::Any aAny;
+ aAny <<= aRect;
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "VisibleArea" ) ), aAny );
+ }
+ }
+
+ SetThumbnail();
+ SdXMLShapeContext::EndElement();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLFrameShapeContext, SdXMLShapeContext );
+
+SdXMLFrameShapeContext::SdXMLFrameShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
+ mbSupportsReplacement( sal_False )
+{
+ uno::Reference < util::XCloneable > xClone( xAttrList, uno::UNO_QUERY );
+ if( xClone.is() )
+ mxAttrList.set( xClone->createClone(), uno::UNO_QUERY );
+ else
+ mxAttrList = new SvXMLAttributeList( xAttrList );
+
+}
+
+SdXMLFrameShapeContext::~SdXMLFrameShapeContext()
+{
+}
+
+SvXMLImportContext *SdXMLFrameShapeContext::CreateChildContext( sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList>& xAttrList )
+{
+ SvXMLImportContext * pContext = 0;
+
+ if( !mxImplContext.Is() )
+ {
+
+ SvXMLShapeContext* pShapeContext= GetImport().GetShapeImport()->CreateFrameChildContext(
+ GetImport(), nPrefix, rLocalName, xAttrList, mxShapes, mxAttrList );
+
+ pContext = pShapeContext;
+
+ // propagate the hyperlink to child context
+ if ( msHyperlink.getLength() > 0 )
+ pShapeContext->setHyperlink( msHyperlink );
+
+ mxImplContext = pContext;
+ mbSupportsReplacement = IsXMLToken( rLocalName, XML_OBJECT ) ||
+ IsXMLToken( rLocalName, XML_OBJECT_OLE );
+ }
+ else if( mbSupportsReplacement && !mxReplImplContext &&
+ XML_NAMESPACE_DRAW == nPrefix &&
+ IsXMLToken( rLocalName, XML_IMAGE ) )
+ {
+ // read replacement image
+ SvXMLImportContext *pImplContext = &mxImplContext;
+ SdXMLShapeContext *pSContext =
+ PTR_CAST( SdXMLShapeContext, pImplContext );
+ if( pSContext )
+ {
+ uno::Reference < beans::XPropertySet > xPropSet(
+ pSContext->getShape(), uno::UNO_QUERY );
+ if( xPropSet.is() )
+ {
+ pContext = new XMLReplacementImageContext( GetImport(),
+ nPrefix, rLocalName, xAttrList, xPropSet );
+ mxReplImplContext = pContext;
+ }
+ }
+ }
+ else if(
+ ( nPrefix == XML_NAMESPACE_SVG && // #i68101#
+ (IsXMLToken( rLocalName, XML_TITLE ) || IsXMLToken( rLocalName, XML_DESC ) ) ) ||
+ (nPrefix == XML_NAMESPACE_OFFICE && IsXMLToken( rLocalName, XML_EVENT_LISTENERS ) ) ||
+ (nPrefix == XML_NAMESPACE_DRAW && (IsXMLToken( rLocalName, XML_GLUE_POINT ) ||
+ IsXMLToken( rLocalName, XML_THUMBNAIL ) ) ) )
+ {
+ SvXMLImportContext *pImplContext = &mxImplContext;
+ pContext = PTR_CAST( SdXMLShapeContext, pImplContext )->CreateChildContext( nPrefix,
+ rLocalName, xAttrList );
+ }
+ else if ( (XML_NAMESPACE_DRAW == nPrefix) && IsXMLToken( rLocalName, XML_IMAGE_MAP ) )
+ {
+ SdXMLShapeContext *pSContext = dynamic_cast< SdXMLShapeContext* >( &mxImplContext );
+ if( pSContext )
+ {
+ uno::Reference < beans::XPropertySet > xPropSet( pSContext->getShape(), uno::UNO_QUERY );
+ if (xPropSet.is())
+ {
+ pContext = new XMLImageMapContext(GetImport(), nPrefix, rLocalName, xPropSet);
+ }
+ }
+ }
+
+ // call parent for content
+ if(!pContext)
+ pContext = SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList );
+
+ return pContext;
+}
+
+void SdXMLFrameShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>&)
+{
+ // ignore
+}
+
+void SdXMLFrameShapeContext::EndElement()
+{
+ if( !mxImplContext.Is() )
+ {
+ // now check if this is an empty presentation object
+ sal_Int16 nAttrCount = mxAttrList.is() ? mxAttrList->getLength() : 0;
+ for(sal_Int16 a(0); a < nAttrCount; a++)
+ {
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(mxAttrList->getNameByIndex(a), &aLocalName);
+
+ if( nPrefix == XML_NAMESPACE_PRESENTATION )
+ {
+ if( IsXMLToken( aLocalName, XML_PLACEHOLDER ) )
+ {
+ mbIsPlaceholder = IsXMLToken( mxAttrList->getValueByIndex(a), XML_TRUE );
+ }
+ else if( IsXMLToken( aLocalName, XML_CLASS ) )
+ {
+ maPresentationClass = mxAttrList->getValueByIndex(a);
+ }
+ }
+ }
+
+ if( (maPresentationClass.getLength() != 0) && mbIsPlaceholder )
+ {
+ uno::Reference< xml::sax::XAttributeList> xEmpty;
+
+ enum XMLTokenEnum eToken = XML_TEXT_BOX;
+
+ if( IsXMLToken( maPresentationClass, XML_GRAPHIC ) )
+ {
+ eToken = XML_IMAGE;
+
+ }
+ else if( IsXMLToken( maPresentationClass, XML_PRESENTATION_PAGE ) )
+ {
+ eToken = XML_PAGE_THUMBNAIL;
+ }
+ else if( IsXMLToken( maPresentationClass, XML_PRESENTATION_CHART ) ||
+ IsXMLToken( maPresentationClass, XML_PRESENTATION_TABLE ) ||
+ IsXMLToken( maPresentationClass, XML_PRESENTATION_OBJECT ) )
+ {
+ eToken = XML_OBJECT;
+ }
+
+ mxImplContext = GetImport().GetShapeImport()->CreateFrameChildContext(
+ GetImport(), XML_NAMESPACE_DRAW, GetXMLToken( eToken ), mxAttrList, mxShapes, xEmpty );
+
+ if( mxImplContext.Is() )
+ {
+ mxImplContext->StartElement( mxAttrList );
+ mxImplContext->EndElement();
+ }
+ }
+ }
+
+ mxImplContext = 0;
+ SdXMLShapeContext::EndElement();
+}
+
+void SdXMLFrameShapeContext::processAttribute( sal_uInt16,
+ const ::rtl::OUString&, const ::rtl::OUString& )
+{
+ // ignore
+}
+
+TYPEINIT1( SdXMLCustomShapeContext, SdXMLShapeContext );
+
+SdXMLCustomShapeContext::SdXMLCustomShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape )
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLCustomShapeContext::~SdXMLCustomShapeContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+// this is called from the parent group for each unparsed attribute in the attribute list
+void SdXMLCustomShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ if( XML_NAMESPACE_DRAW == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_ENGINE ) )
+ {
+ maCustomShapeEngine = rValue;
+ return;
+ }
+ if ( IsXMLToken( rLocalName, XML_DATA ) )
+ {
+ maCustomShapeData = rValue;
+ return;
+ }
+ }
+ SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLCustomShapeContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ // create rectangle shape
+ AddShape("com.sun.star.drawing.CustomShape");
+ if ( mxShape.is() )
+ {
+ // Add, set Style and properties from base shape
+ SetStyle();
+ SetLayer();
+
+ // set pos, size, shear and rotate
+ SetTransformation();
+
+ try
+ {
+ uno::Reference< beans::XPropertySet > xPropSet( mxShape, uno::UNO_QUERY );
+ if( xPropSet.is() )
+ {
+ if ( maCustomShapeEngine.getLength() )
+ {
+ uno::Any aAny;
+ aAny <<= maCustomShapeEngine;
+ xPropSet->setPropertyValue( EASGet( EAS_CustomShapeEngine ), aAny );
+ }
+ if ( maCustomShapeData.getLength() )
+ {
+ uno::Any aAny;
+ aAny <<= maCustomShapeData;
+ xPropSet->setPropertyValue( EASGet( EAS_CustomShapeData ), aAny );
+ }
+ }
+ }
+ catch( uno::Exception& )
+ {
+ OSL_FAIL( "could not set enhanced customshape geometry" );
+ }
+ SdXMLShapeContext::StartElement(xAttrList);
+ }
+}
+
+void SdXMLCustomShapeContext::EndElement()
+{
+ if ( !maCustomShapeGeometry.empty() )
+ {
+ const rtl::OUString sCustomShapeGeometry ( RTL_CONSTASCII_USTRINGPARAM( "CustomShapeGeometry" ) );
+
+ // converting the vector to a sequence
+ uno::Sequence< beans::PropertyValue > aSeq( maCustomShapeGeometry.size() );
+ beans::PropertyValue* pValues = aSeq.getArray();
+ std::vector< beans::PropertyValue >::const_iterator aIter( maCustomShapeGeometry.begin() );
+ std::vector< beans::PropertyValue >::const_iterator aEnd( maCustomShapeGeometry.end() );
+ while ( aIter != aEnd )
+ *pValues++ = *aIter++;
+
+ try
+ {
+ uno::Reference< beans::XPropertySet > xPropSet( mxShape, uno::UNO_QUERY );
+ if( xPropSet.is() )
+ {
+ uno::Any aAny;
+ aAny <<= aSeq;
+ xPropSet->setPropertyValue( sCustomShapeGeometry, aAny );
+ }
+ }
+ catch( uno::Exception& )
+ {
+ OSL_FAIL( "could not set enhanced customshape geometry" );
+ }
+
+ sal_Int32 nUPD( 0 );
+ sal_Int32 nBuild( 0 );
+ GetImport().getBuildIds( nUPD, nBuild );
+ if( ((nUPD >= 640 && nUPD <= 645) || (nUPD == 680)) && (nBuild <= 9221) )
+ {
+ Reference< drawing::XEnhancedCustomShapeDefaulter > xDefaulter( mxShape, UNO_QUERY );
+ if( xDefaulter.is() )
+ {
+ rtl::OUString aEmptyType;
+ xDefaulter->createCustomShapeDefaults( aEmptyType );
+ }
+ }
+ }
+
+ SdXMLShapeContext::EndElement();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLImportContext* SdXMLCustomShapeContext::CreateChildContext(
+ sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList )
+{
+ SvXMLImportContext* pContext = NULL;
+ if ( XML_NAMESPACE_DRAW == nPrefix )
+ {
+ if ( IsXMLToken( rLocalName, XML_ENHANCED_GEOMETRY ) )
+ {
+ uno::Reference< beans::XPropertySet > xPropSet( mxShape,uno::UNO_QUERY );
+ if ( xPropSet.is() )
+ pContext = new XMLEnhancedCustomShapeContext( GetImport(), mxShape, nPrefix, rLocalName, maCustomShapeGeometry );
+ }
+ }
+ // delegate to parent class if no context could be created
+ if ( NULL == pContext )
+ pContext = SdXMLShapeContext::CreateChildContext( nPrefix, rLocalName,
+ xAttrList);
+ return pContext;
+}
+
+///////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLTableShapeContext, SdXMLShapeContext );
+
+SdXMLTableShapeContext::SdXMLTableShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLocalName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes )
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, sal_False )
+{
+ memset( &maTemplateStylesUsed, 0, sizeof( maTemplateStylesUsed ) );
+}
+
+SdXMLTableShapeContext::~SdXMLTableShapeContext()
+{
+}
+
+void SdXMLTableShapeContext::StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList )
+{
+ const char* pService = "com.sun.star.drawing.TableShape";
+
+ sal_Bool bIsPresShape = maPresentationClass.getLength() && GetImport().GetShapeImport()->IsPresentationShapesSupported();
+ if( bIsPresShape )
+ {
+ if( IsXMLToken( maPresentationClass, XML_PRESENTATION_TABLE ) )
+ {
+ pService = "com.sun.star.presentation.TableShape";
+ }
+ }
+
+ AddShape( pService );
+
+ if( mxShape.is() )
+ {
+ SetLayer();
+
+ uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY);
+
+ if(bIsPresShape)
+ {
+ if(xProps.is())
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() );
+ if( xPropsInfo.is() )
+ {
+ if( !mbIsPlaceholder && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") )))
+ xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ), ::cppu::bool2any( sal_False ) );
+
+ if( mbIsUserTransformed && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") )))
+ xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") ), ::cppu::bool2any( sal_False ) );
+ }
+ }
+ }
+
+ SetStyle();
+
+ if( xProps.is() )
+ {
+ if( msTemplateStyleName.getLength() ) try
+ {
+ Reference< XStyleFamiliesSupplier > xFamiliesSupp( GetImport().GetModel(), UNO_QUERY_THROW );
+ Reference< XNameAccess > xFamilies( xFamiliesSupp->getStyleFamilies() );
+ const OUString sFamilyName( RTL_CONSTASCII_USTRINGPARAM("table" ) );
+ Reference< XNameAccess > xTableFamily( xFamilies->getByName( sFamilyName ), UNO_QUERY_THROW );
+ Reference< XStyle > xTableStyle( xTableFamily->getByName( msTemplateStyleName ), UNO_QUERY_THROW );
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TableTemplate" ) ), Any( xTableStyle ) );
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL("SdXMLTableShapeContext::StartElement(), exception caught!");
+ }
+
+ const XMLPropertyMapEntry* pEntry = &aXMLTableShapeAttributes[0];
+ for( int i = 0; pEntry->msApiName && (i < 6); i++, pEntry++ )
+ {
+ try
+ {
+ const OUString sAPIPropertyName( OUString(pEntry->msApiName, pEntry->nApiNameLength, RTL_TEXTENCODING_ASCII_US ) );
+ xProps->setPropertyValue( sAPIPropertyName, Any( maTemplateStylesUsed[i] ) );
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL("SdXMLTableShapeContext::StartElement(), exception caught!");
+ }
+ }
+ }
+
+ GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes );
+
+ const rtl::Reference< XMLTableImport >& xTableImport( GetImport().GetShapeImport()->GetShapeTableImport() );
+ if( xTableImport.is() && xProps.is() )
+ {
+ uno::Reference< table::XColumnRowRange > xColumnRowRange(
+ xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("Model") ) ), uno::UNO_QUERY );
+
+ if( xColumnRowRange.is() )
+ mxTableImportContext = xTableImport->CreateTableContext( GetPrefix(), GetLocalName(), xColumnRowRange );
+
+ if( mxTableImportContext.Is() )
+ mxTableImportContext->StartElement( xAttrList );
+ }
+ }
+}
+
+void SdXMLTableShapeContext::EndElement()
+{
+ if( mxTableImportContext.Is() )
+ mxTableImportContext->EndElement();
+
+ SdXMLShapeContext::EndElement();
+
+ if( mxShape.is() )
+ {
+ // set pos, size, shear and rotate
+ SetTransformation();
+ }
+}
+
+// this is called from the parent group for each unparsed attribute in the attribute list
+void SdXMLTableShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ if( nPrefix == XML_NAMESPACE_TABLE )
+ {
+ if( IsXMLToken( rLocalName, XML_TEMPLATE_NAME ) )
+ {
+ msTemplateStyleName = rValue;
+ }
+ else
+ {
+ int i = 0;
+ const XMLPropertyMapEntry* pEntry = &aXMLTableShapeAttributes[0];
+ while( pEntry->msApiName && (i < 6) )
+ {
+ if( IsXMLToken( rLocalName, pEntry->meXMLName ) )
+ {
+ if( IsXMLToken( rValue, XML_TRUE ) )
+ maTemplateStylesUsed[i] = sal_True;
+ break;
+ }
+ pEntry++;
+ i++;
+ }
+ }
+ }
+ SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+}
+
+SvXMLImportContext* SdXMLTableShapeContext::CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const uno::Reference<xml::sax::XAttributeList>& xAttrList )
+{
+ if( mxTableImportContext.Is() && (nPrefix == XML_NAMESPACE_TABLE) )
+ return mxTableImportContext->CreateChildContext(nPrefix, rLocalName, xAttrList);
+ else
+ return SdXMLShapeContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/ximpshap.hxx b/xmloff/source/draw/ximpshap.hxx
new file mode 100644
index 000000000000..c86ed7915950
--- /dev/null
+++ b/xmloff/source/draw/ximpshap.hxx
@@ -0,0 +1,667 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XIMPSHAPE_HXX
+#define _XIMPSHAPE_HXX
+
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/document/XActionLockable.hpp>
+#include <com/sun/star/container/XIdentifierContainer.hpp>
+#include <xmloff/xmlictxt.hxx>
+#include "sdxmlimp_impl.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/text/XTextCursor.hpp>
+#include <com/sun/star/awt/Point.hpp>
+#include <tools/rtti.hxx>
+#include "xexptran.hxx"
+
+#include <vector>
+#include <xmloff/shapeimport.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// common shape context
+
+class SdXMLShapeContext : public SvXMLShapeContext
+{
+protected:
+ // the shape group this object should be created inside
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > mxShapes;
+ com::sun::star::uno::Reference< com::sun::star::text::XTextCursor > mxCursor;
+ com::sun::star::uno::Reference< com::sun::star::text::XTextCursor > mxOldCursor;
+ com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList> mxAttrList;
+ com::sun::star::uno::Reference< com::sun::star::container::XIdentifierContainer > mxGluePoints;
+ com::sun::star::uno::Reference< com::sun::star::document::XActionLockable > mxLockable;
+
+ rtl::OUString maDrawStyleName;
+ rtl::OUString maTextStyleName;
+ rtl::OUString maPresentationClass;
+ rtl::OUString maShapeName;
+ rtl::OUString maThumbnailURL;
+
+ /// whether to restore list context (#91964#)
+ bool mbListContextPushed;
+
+ sal_uInt16 mnStyleFamily;
+ sal_uInt16 mnClass;
+ sal_Bool mbIsPlaceholder;
+ bool mbClearDefaultAttributes;
+ sal_Bool mbIsUserTransformed;
+ sal_Int32 mnZOrder;
+ rtl::OUString maShapeId;
+ rtl::OUString maLayerName;
+
+ // #i68101#
+ rtl::OUString maShapeTitle;
+ rtl::OUString maShapeDescription;
+
+ SdXMLImExTransform2D mnTransform;
+ com::sun::star::awt::Size maSize;
+ com::sun::star::awt::Point maPosition;
+
+ bool mbVisible;
+ bool mbPrintable;
+
+ /** if bSupportsStyle is false, auto styles will be set but not a style */
+ void SetStyle( bool bSupportsStyle = true );
+ void SetLayer();
+ void SetThumbnail();
+
+ void AddShape(com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape);
+ void AddShape(const char* pServiceName );
+ void SetTransformation();
+
+ SvXMLImport& GetImport() { return SvXMLImportContext::GetImport(); }
+ const SvXMLImport& GetImport() const { return SvXMLImportContext::GetImport(); }
+
+ void addGluePoint( const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+ sal_Bool isPresentationShape() const;
+
+public:
+ TYPEINFO();
+
+ SdXMLShapeContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLShapeContext();
+
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+ virtual void EndElement();
+
+ virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+ // this is called from the parent group for each unparsed attribute in the attribute list
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:rect context
+
+class SdXMLRectShapeContext : public SdXMLShapeContext
+{
+ sal_Int32 mnRadius;
+
+public:
+ TYPEINFO();
+
+ SdXMLRectShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLRectShapeContext();
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+
+ // this is called from the parent group for each unparsed attribute in the attribute list
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:line context
+
+class SdXMLLineShapeContext : public SdXMLShapeContext
+{
+ sal_Int32 mnX1;
+ sal_Int32 mnY1;
+ sal_Int32 mnX2;
+ sal_Int32 mnY2;
+
+public:
+ TYPEINFO();
+
+ SdXMLLineShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLLineShapeContext();
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+
+ // this is called from the parent group for each unparsed attribute in the attribute list
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:ellipse and draw:circle context
+
+class SdXMLEllipseShapeContext : public SdXMLShapeContext
+{
+ sal_Int32 mnCX;
+ sal_Int32 mnCY;
+ sal_Int32 mnRX;
+ sal_Int32 mnRY;
+
+ sal_uInt16 meKind;
+ sal_Int32 mnStartAngle;
+ sal_Int32 mnEndAngle;
+public:
+ TYPEINFO();
+
+ SdXMLEllipseShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLEllipseShapeContext();
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+
+ // this is called from the parent group for each unparsed attribute in the attribute list
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:polyline and draw:polygon context
+
+class SdXMLPolygonShapeContext : public SdXMLShapeContext
+{
+ rtl::OUString maPoints;
+ rtl::OUString maViewBox;
+ sal_Bool mbClosed;
+
+public:
+ TYPEINFO();
+
+ SdXMLPolygonShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes, sal_Bool bClosed, sal_Bool bTemporaryShape);
+ virtual ~SdXMLPolygonShapeContext();
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+
+ // this is called from the parent group for each unparsed attribute in the attribute list
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:path context
+
+class SdXMLPathShapeContext : public SdXMLShapeContext
+{
+ rtl::OUString maD;
+ rtl::OUString maViewBox;
+ sal_Bool mbClosed;
+
+public:
+ TYPEINFO();
+
+ SdXMLPathShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLPathShapeContext();
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+
+ // this is called from the parent group for each unparsed attribute in the attribute list
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:text-box context
+
+class SdXMLTextBoxShapeContext : public SdXMLShapeContext
+{
+ sal_Int32 mnRadius;
+
+public:
+ TYPEINFO();
+
+ SdXMLTextBoxShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLTextBoxShapeContext();
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+
+ // this is called from the parent group for each unparsed attribute in the attribute list
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:control context
+
+class SdXMLControlShapeContext : public SdXMLShapeContext
+{
+private:
+ rtl::OUString maFormId;
+
+public:
+ TYPEINFO();
+
+ SdXMLControlShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLControlShapeContext();
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+
+ // this is called from the parent group for each unparsed attribute in the attribute list
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:connector context
+
+class SdXMLConnectorShapeContext : public SdXMLShapeContext
+{
+private:
+ ::com::sun::star::awt::Point maStart;
+ ::com::sun::star::awt::Point maEnd;
+
+ sal_uInt16 mnType;
+
+ rtl::OUString maStartShapeId;
+ sal_Int32 mnStartGlueId;
+ rtl::OUString maEndShapeId;
+ sal_Int32 mnEndGlueId;
+
+ sal_Int32 mnDelta1;
+ sal_Int32 mnDelta2;
+ sal_Int32 mnDelta3;
+
+ com::sun::star::uno::Any maPath;
+
+public:
+ TYPEINFO();
+
+ SdXMLConnectorShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLConnectorShapeContext();
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+
+ // this is called from the parent group for each unparsed attribute in the attribute list
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:measure context
+
+class SdXMLMeasureShapeContext : public SdXMLShapeContext
+{
+private:
+ ::com::sun::star::awt::Point maStart;
+ ::com::sun::star::awt::Point maEnd;
+
+public:
+ TYPEINFO();
+
+ SdXMLMeasureShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLMeasureShapeContext();
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+ virtual void EndElement();
+
+ // this is called from the parent group for each unparsed attribute in the attribute list
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:page context
+
+class SdXMLPageShapeContext : public SdXMLShapeContext
+{
+private:
+ sal_Int32 mnPageNumber;
+public:
+ TYPEINFO();
+
+ SdXMLPageShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLPageShapeContext();
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+
+ // this is called from the parent group for each unparsed attribute in the attribute list
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:caption context
+
+class SdXMLCaptionShapeContext : public SdXMLShapeContext
+{
+private:
+ com::sun::star::awt::Point maCaptionPoint;
+ sal_Int32 mnRadius;
+
+public:
+ TYPEINFO();
+
+ SdXMLCaptionShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLCaptionShapeContext();
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+
+ // this is called from the parent group for each unparsed attribute in the attribute list
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// office:image context
+
+class SdXMLGraphicObjectShapeContext : public SdXMLShapeContext
+{
+private:
+ ::rtl::OUString maURL;
+ ::com::sun::star::uno::Reference < ::com::sun::star::io::XOutputStream > mxBase64Stream;
+
+public:
+ TYPEINFO();
+
+ SdXMLGraphicObjectShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLGraphicObjectShapeContext();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+ virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+ // this is called from the parent group for each unparsed attribute in the attribute list
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// chart:chart context
+
+class SdXMLChartShapeContext : public SdXMLShapeContext
+{
+ SvXMLImportContext* mpChartContext;
+
+public:
+ TYPEINFO();
+
+ SdXMLChartShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLChartShapeContext();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+ virtual void Characters( const ::rtl::OUString& rChars );
+ virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:object and draw:object_ole context
+
+class SdXMLObjectShapeContext : public SdXMLShapeContext
+{
+private:
+ rtl::OUString maCLSID;
+ rtl::OUString maHref;
+
+ // #100592#
+ ::com::sun::star::uno::Reference < ::com::sun::star::io::XOutputStream > mxBase64Stream;
+
+public:
+ TYPEINFO();
+
+ SdXMLObjectShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLObjectShapeContext();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+
+ // #100592#
+ virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+ // this is called from the parent group for each unparsed attribute in the attribute list
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:applet
+
+class SdXMLAppletShapeContext : public SdXMLShapeContext
+{
+private:
+ rtl::OUString maAppletName;
+ rtl::OUString maAppletCode;
+ rtl::OUString maHref;
+ sal_Bool mbIsScript;
+
+ com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > maParams;
+
+public:
+ TYPEINFO();
+
+ SdXMLAppletShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLAppletShapeContext();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+
+ virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+ // this is called from the parent group for each unparsed attribute in the attribute list
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:plugin
+
+class SdXMLPluginShapeContext : public SdXMLShapeContext
+{
+private:
+ rtl::OUString maMimeType;
+ rtl::OUString maHref;
+ bool mbMedia;
+
+ com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > maParams;
+
+public:
+ TYPEINFO();
+
+ SdXMLPluginShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLPluginShapeContext();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+
+ virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+ // this is called from the parent group for each unparsed attribute in the attribute list
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:floating-frame
+
+class SdXMLFloatingFrameShapeContext : public SdXMLShapeContext
+{
+private:
+ rtl::OUString maFrameName;
+ rtl::OUString maHref;
+
+public:
+ TYPEINFO();
+
+ SdXMLFloatingFrameShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLFloatingFrameShapeContext();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+
+ // this is called from the parent group for each unparsed attribute in the attribute list
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:-frame
+
+class SdXMLFrameShapeContext : public SdXMLShapeContext
+{
+private:
+ sal_Bool mbSupportsReplacement;
+ SvXMLImportContextRef mxImplContext;
+ SvXMLImportContextRef mxReplImplContext;
+
+public:
+ TYPEINFO();
+
+ SdXMLFrameShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLFrameShapeContext();
+
+ virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+};
+
+class SdXMLCustomShapeContext : public SdXMLShapeContext
+{
+
+protected :
+
+ rtl::OUString maCustomShapeEngine;
+ rtl::OUString maCustomShapeData;
+
+ std::vector< com::sun::star::beans::PropertyValue > maCustomShapeGeometry;
+
+public:
+
+ TYPEINFO();
+
+ SdXMLCustomShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLCustomShapeContext();
+
+ virtual void StartElement( const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+ virtual void EndElement();
+
+ virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+ // this is called from the parent group for each unparsed attribute in the attribute list
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:table
+
+class SdXMLTableShapeContext : public SdXMLShapeContext
+{
+public:
+ TYPEINFO();
+
+ SdXMLTableShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes );
+ virtual ~SdXMLTableShapeContext();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+
+ virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+ // this is called from the parent group for each unparsed attribute in the attribute list
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+
+private:
+ SvXMLImportContextRef mxTableImportContext;
+ rtl::OUString msTemplateStyleName;
+ sal_Bool maTemplateStylesUsed[6];
+};
+
+#endif // _XIMPSHAPE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/ximpshow.cxx b/xmloff/source/draw/ximpshow.cxx
new file mode 100644
index 000000000000..02717ace72d5
--- /dev/null
+++ b/xmloff/source/draw/ximpshow.cxx
@@ -0,0 +1,284 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <tools/debug.hxx>
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/presentation/XCustomPresentationSupplier.hpp>
+#include <com/sun/star/presentation/XPresentationSupplier.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <xmloff/xmltoken.hxx>
+#include <comphelper/extract.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "ximpshow.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::std;
+using namespace ::cppu;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::xml;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::presentation;
+using namespace ::xmloff::token;
+
+///////////////////////////////////////////////////////////////////////
+
+class ShowsImpImpl
+{
+public:
+ Reference< XSingleServiceFactory > mxShowFactory;
+ Reference< XNameContainer > mxShows;
+ Reference< XPropertySet > mxPresProps;
+ Reference< XNameAccess > mxPages;
+ OUString maCustomShowName;
+ SdXMLImport& mrImport;
+
+ ShowsImpImpl( SdXMLImport& rImport )
+ : mrImport( rImport )
+ {}
+};
+
+///////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLShowsContext, SvXMLImportContext );
+
+SdXMLShowsContext::SdXMLShowsContext( SdXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList )
+: SvXMLImportContext(rImport, nPrfx, rLocalName)
+{
+ mpImpl = new ShowsImpImpl( rImport );
+
+ Reference< XCustomPresentationSupplier > xShowsSupplier( rImport.GetModel(), UNO_QUERY );
+ if( xShowsSupplier.is() )
+ {
+ mpImpl->mxShows = xShowsSupplier->getCustomPresentations();
+ mpImpl->mxShowFactory = Reference< XSingleServiceFactory >::query( mpImpl->mxShows );
+ }
+
+ Reference< XDrawPagesSupplier > xDrawPagesSupplier( rImport.GetModel(), UNO_QUERY );
+ if( xDrawPagesSupplier.is() )
+ mpImpl->mxPages = Reference< XNameAccess >::query( xDrawPagesSupplier->getDrawPages() );
+
+ Reference< XPresentationSupplier > xPresentationSupplier( rImport.GetModel(), UNO_QUERY );
+ if( xPresentationSupplier.is() )
+ mpImpl->mxPresProps = Reference< XPropertySet >::query( xPresentationSupplier->getPresentation() );
+
+
+ if( mpImpl->mxPresProps.is() )
+ {
+ sal_Bool bAll = sal_True;
+ uno::Any aAny;
+
+ // read attributes
+ const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ OUString sValue = xAttrList->getValueByIndex( i );
+
+ switch( nPrefix )
+ {
+ case XML_NAMESPACE_PRESENTATION:
+ if( IsXMLToken( aLocalName, XML_START_PAGE ) )
+ {
+ aAny <<= sValue;
+ mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "FirstPage" ) ), aAny );
+ bAll = sal_False;
+ }
+ else if( IsXMLToken( aLocalName, XML_SHOW ) )
+ {
+ mpImpl->maCustomShowName = sValue;
+ bAll = sal_False;
+ }
+ else if( IsXMLToken( aLocalName, XML_PAUSE ) )
+ {
+ DateTime aTime;
+ if( !SvXMLUnitConverter::convertTime( aTime, sValue ) )
+ continue;
+
+ const sal_Int32 nMS = ( aTime.Hours * 60 + aTime.Minutes ) * 60 + aTime.Seconds;
+ aAny <<= nMS;
+ mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Pause" ) ), aAny );
+ }
+ else if( IsXMLToken( aLocalName, XML_ANIMATIONS ) )
+ {
+ aAny = bool2any( IsXMLToken( sValue, XML_ENABLED ) );
+ mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AllowAnimations" ) ), aAny );
+ }
+ else if( IsXMLToken( aLocalName, XML_STAY_ON_TOP ) )
+ {
+ aAny = bool2any( IsXMLToken( sValue, XML_TRUE ) );
+ mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsAlwaysOnTop" ) ), aAny );
+ }
+ else if( IsXMLToken( aLocalName, XML_FORCE_MANUAL ) )
+ {
+ aAny = bool2any( IsXMLToken( sValue, XML_TRUE ) );
+ mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsAutomatic" ) ), aAny );
+ }
+ else if( IsXMLToken( aLocalName, XML_ENDLESS ) )
+ {
+ aAny = bool2any( IsXMLToken( sValue, XML_TRUE ) );
+ mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsEndless" ) ), aAny );
+ }
+ else if( IsXMLToken( aLocalName, XML_FULL_SCREEN ) )
+ {
+ aAny = bool2any( IsXMLToken( sValue, XML_TRUE ) );
+ mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFullScreen" ) ), aAny );
+ }
+ else if( IsXMLToken( aLocalName, XML_MOUSE_VISIBLE ) )
+ {
+ aAny = bool2any( IsXMLToken( sValue, XML_TRUE ) );
+ mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsMouseVisible" ) ), aAny );
+ }
+ else if( IsXMLToken( aLocalName, XML_START_WITH_NAVIGATOR ) )
+ {
+ aAny = bool2any( IsXMLToken( sValue, XML_TRUE ) );
+ mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "StartWithNavigator" ) ), aAny );
+ }
+ else if( IsXMLToken( aLocalName, XML_MOUSE_AS_PEN ) )
+ {
+ aAny = bool2any( IsXMLToken( sValue, XML_TRUE ) );
+ mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "UsePen" ) ), aAny );
+ }
+ else if( IsXMLToken( aLocalName, XML_TRANSITION_ON_CLICK ) )
+ {
+ aAny = bool2any( IsXMLToken( sValue, XML_ENABLED ) );
+ mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsTransitionOnClick" ) ), aAny );
+ }
+ else if( IsXMLToken( aLocalName, XML_SHOW_LOGO ) )
+ {
+ aAny = bool2any( IsXMLToken( sValue, XML_TRUE ) );
+ mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsShowLogo" ) ), aAny );
+ }
+ }
+ }
+ aAny = bool2any( bAll );
+ mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsShowAll" ) ), aAny );
+ }
+}
+
+SdXMLShowsContext::~SdXMLShowsContext()
+{
+ if( mpImpl && mpImpl->maCustomShowName.getLength() )
+ {
+ uno::Any aAny;
+ aAny <<= mpImpl->maCustomShowName;
+ mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "CustomShow" ) ), aAny );
+ }
+
+ delete mpImpl;
+}
+
+SvXMLImportContext * SdXMLShowsContext::CreateChildContext( sal_uInt16 p_nPrefix, const OUString& rLocalName, const Reference< XAttributeList>& xAttrList )
+{
+ if( mpImpl && p_nPrefix == XML_NAMESPACE_PRESENTATION && IsXMLToken( rLocalName, XML_SHOW ) )
+ {
+ OUString aName;
+ OUString aPages;
+
+ // read attributes
+ const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ OUString sValue = xAttrList->getValueByIndex( i );
+
+ switch( nPrefix )
+ {
+ case XML_NAMESPACE_PRESENTATION:
+ if( IsXMLToken( aLocalName, XML_NAME ) )
+ {
+ aName = sValue;
+ }
+ else if( IsXMLToken( aLocalName, XML_PAGES ) )
+ {
+ aPages = sValue;
+ }
+ }
+ }
+
+ if( aName.getLength() != 0 && aPages.getLength() != 0 )
+ {
+ Reference< XIndexContainer > xShow( mpImpl->mxShowFactory->createInstance(), UNO_QUERY );
+ if( xShow.is() )
+ {
+ SvXMLTokenEnumerator aPageNames( aPages, sal_Unicode(',') );
+ OUString sPageName;
+ Any aAny;
+
+ while( aPageNames.getNextToken( sPageName ) )
+ {
+ if( !mpImpl->mxPages->hasByName( sPageName ) )
+ continue;
+
+ Reference< XDrawPage > xPage;
+ mpImpl->mxPages->getByName( sPageName ) >>= xPage;
+ if( xPage.is() )
+ {
+ aAny <<= xPage;
+ xShow->insertByIndex( xShow->getCount(), aAny );
+ }
+ }
+
+ aAny <<= xShow;
+
+ if( mpImpl->mxShows->hasByName( aName ) )
+ {
+ mpImpl->mxShows->replaceByName( aName, aAny );
+ }
+ else
+ {
+ mpImpl->mxShows->insertByName( aName, aAny );
+ }
+ }
+ }
+ }
+
+ return new SvXMLImportContext( GetImport(), p_nPrefix, rLocalName );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/ximpshow.hxx b/xmloff/source/draw/ximpshow.hxx
new file mode 100644
index 000000000000..79109ce260b6
--- /dev/null
+++ b/xmloff/source/draw/ximpshow.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XIMPSHOW_HXX
+#define _XMLOFF_XIMPSHOW_HXX
+
+#include <xmloff/xmlictxt.hxx>
+#include "sdxmlimp_impl.hxx"
+
+class ShowsImpImpl;
+
+//////////////////////////////////////////////////////////////////////////////
+// presentations:animations
+
+class SdXMLShowsContext : public SvXMLImportContext
+{
+ ShowsImpImpl* mpImpl;
+
+public:
+ TYPEINFO();
+
+ SdXMLShowsContext( SdXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+ virtual ~SdXMLShowsContext();
+
+ virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+};
+
+#endif // _XMLOFF_XIMPSHOW_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/ximpstyl.cxx b/xmloff/source/draw/ximpstyl.cxx
new file mode 100644
index 000000000000..dad2aa296dee
--- /dev/null
+++ b/xmloff/source/draw/ximpstyl.cxx
@@ -0,0 +1,1660 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+#include "ximpstyl.hxx"
+#include <xmloff/XMLShapeStyleContext.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "ximpnote.hxx"
+#include <tools/debug.hxx>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/presentation/XPresentationPage.hpp>
+#include <com/sun/star/drawing/XDrawPages.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/presentation/XHandoutMasterSupplier.hpp>
+#include <comphelper/namecontainer.hxx>
+#include <xmloff/xmlprcon.hxx>
+#include <xmloff/families.hxx>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <svl/zforlist.hxx>
+#include "PropertySetMerger.hxx"
+#include "sdpropls.hxx"
+#include "layerimp.hxx"
+#include <xmloff/XMLGraphicsDefaultStyle.hxx>
+#include "XMLNumberStylesImport.hxx"
+#include "xmloff/xmlerror.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::xmloff::token;
+
+//////////////////////////////////////////////////////////////////////////////
+
+class SdXMLDrawingPagePropertySetContext : public SvXMLPropertySetContext
+{
+public:
+
+ TYPEINFO();
+
+ SdXMLDrawingPagePropertySetContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList >& xAttrList,
+ ::std::vector< XMLPropertyState > &rProps,
+ const UniReference < SvXMLImportPropertyMapper > &rMap );
+
+ virtual ~SdXMLDrawingPagePropertySetContext();
+
+ using SvXMLPropertySetContext::CreateChildContext;
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList,
+ ::std::vector< XMLPropertyState > &rProperties,
+ const XMLPropertyState& rProp);
+};
+
+TYPEINIT1( SdXMLDrawingPagePropertySetContext, SvXMLPropertySetContext );
+
+SdXMLDrawingPagePropertySetContext::SdXMLDrawingPagePropertySetContext(
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList,
+ ::std::vector< XMLPropertyState > &rProps,
+ const UniReference < SvXMLImportPropertyMapper > &rMap ) :
+ SvXMLPropertySetContext( rImport, nPrfx, rLName, xAttrList,
+ XML_TYPE_PROP_DRAWING_PAGE, rProps, rMap )
+{
+}
+
+SdXMLDrawingPagePropertySetContext::~SdXMLDrawingPagePropertySetContext()
+{
+}
+
+SvXMLImportContext *SdXMLDrawingPagePropertySetContext::CreateChildContext(
+ sal_uInt16 p_nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList,
+ ::std::vector< XMLPropertyState > &rProperties,
+ const XMLPropertyState& rProp )
+{
+ SvXMLImportContext *pContext = 0;
+
+ switch( mxMapper->getPropertySetMapper()->GetEntryContextId( rProp.mnIndex ) )
+ {
+ case CTF_PAGE_SOUND_URL:
+ {
+ const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(xAttrList->getNameByIndex(i), &aLocalName);
+
+ if( (nPrefix == XML_NAMESPACE_XLINK) && IsXMLToken( aLocalName, XML_HREF ) )
+ {
+ uno::Any aAny( GetImport().GetAbsoluteReference( xAttrList->getValueByIndex(i) ) );
+ XMLPropertyState aPropState( rProp.mnIndex, aAny );
+ rProperties.push_back( aPropState );
+ }
+ }
+ break;
+ }
+ }
+
+ if( !pContext )
+ pContext = SvXMLPropertySetContext::CreateChildContext( p_nPrefix, rLocalName,
+ xAttrList,
+ rProperties, rProp );
+
+ return pContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+class SdXMLDrawingPageStyleContext : public XMLPropStyleContext
+{
+public:
+ TYPEINFO();
+
+ SdXMLDrawingPageStyleContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList,
+ SvXMLStylesContext& rStyles,
+ sal_uInt16 nFamily = XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID);
+ virtual ~SdXMLDrawingPageStyleContext();
+
+ SvXMLImportContext * CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+ virtual void Finish( sal_Bool bOverwrite );
+
+ // #i35918#
+ virtual void FillPropertySet(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rPropSet );
+};
+
+TYPEINIT1( SdXMLDrawingPageStyleContext, XMLPropStyleContext );
+
+SdXMLDrawingPageStyleContext::SdXMLDrawingPageStyleContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList,
+ SvXMLStylesContext& rStyles,
+ sal_uInt16 nFamily)
+: XMLPropStyleContext(rImport, nPrfx, rLName, xAttrList, rStyles, nFamily )
+{
+}
+
+SdXMLDrawingPageStyleContext::~SdXMLDrawingPageStyleContext()
+{
+}
+
+SvXMLImportContext *SdXMLDrawingPageStyleContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList )
+{
+ SvXMLImportContext *pContext = 0;
+
+ if( XML_NAMESPACE_STYLE == nPrefix &&
+ IsXMLToken( rLocalName, XML_DRAWING_PAGE_PROPERTIES ) )
+ {
+ UniReference < SvXMLImportPropertyMapper > xImpPrMap =
+ GetStyles()->GetImportPropertyMapper( GetFamily() );
+ if( xImpPrMap.is() )
+ pContext = new SdXMLDrawingPagePropertySetContext( GetImport(), nPrefix,
+ rLocalName, xAttrList,
+ GetProperties(),
+ xImpPrMap );
+ }
+
+ if( !pContext )
+ pContext = XMLPropStyleContext::CreateChildContext( nPrefix, rLocalName,
+ xAttrList );
+
+ return pContext;
+}
+
+void SdXMLDrawingPageStyleContext::Finish( sal_Bool bOverwrite )
+{
+ XMLPropStyleContext::Finish( bOverwrite );
+
+ ::std::vector< XMLPropertyState > &rProperties = GetProperties();
+
+ const UniReference< XMLPropertySetMapper >& rImpPrMap = GetStyles()->GetImportPropertyMapper( GetFamily() )->getPropertySetMapper();
+
+ ::std::vector< XMLPropertyState >::iterator property = rProperties.begin();
+ for(; property != rProperties.end(); property++)
+ {
+ if( property->mnIndex == -1 )
+ continue;
+
+ sal_Int16 nContextID = rImpPrMap->GetEntryContextId(property->mnIndex);
+ switch( nContextID )
+ {
+ case CTF_DATE_TIME_FORMAT:
+ {
+ OUString sStyleName;
+ (*property).maValue >>= sStyleName;
+
+ sal_Int32 nStyle = 0;
+
+ SdXMLNumberFormatImportContext* pSdNumStyle =
+ PTR_CAST( SdXMLNumberFormatImportContext,
+ GetStyles()->FindStyleChildContext( XML_STYLE_FAMILY_DATA_STYLE, sStyleName, sal_True ) );
+
+ if( pSdNumStyle )
+ nStyle = pSdNumStyle->GetDrawKey();
+
+ (*property).maValue <<= nStyle;
+ }
+ break;
+ }
+ }
+
+}
+
+// #i35918#
+void SdXMLDrawingPageStyleContext::FillPropertySet(
+ const Reference< beans::XPropertySet > & rPropSet )
+{
+ const sal_uInt16 MAX_SPECIAL_DRAW_STYLES = 7;
+ struct _ContextID_Index_Pair aContextIDs[MAX_SPECIAL_DRAW_STYLES+1] =
+ {
+ { CTF_DASHNAME , -1 },
+ { CTF_LINESTARTNAME , -1 },
+ { CTF_LINEENDNAME , -1 },
+ { CTF_FILLGRADIENTNAME, -1 },
+ { CTF_FILLTRANSNAME , -1 },
+ { CTF_FILLHATCHNAME , -1 },
+ { CTF_FILLBITMAPNAME , -1 },
+ { -1, -1 }
+ };
+ static sal_uInt16 aFamilies[MAX_SPECIAL_DRAW_STYLES] =
+ {
+ XML_STYLE_FAMILY_SD_STROKE_DASH_ID,
+ XML_STYLE_FAMILY_SD_MARKER_ID,
+ XML_STYLE_FAMILY_SD_MARKER_ID,
+ XML_STYLE_FAMILY_SD_GRADIENT_ID,
+ XML_STYLE_FAMILY_SD_GRADIENT_ID,
+ XML_STYLE_FAMILY_SD_HATCH_ID,
+ XML_STYLE_FAMILY_SD_FILL_IMAGE_ID
+ };
+
+ UniReference < SvXMLImportPropertyMapper > xImpPrMap =
+ GetStyles()->GetImportPropertyMapper( GetFamily() );
+ DBG_ASSERT( xImpPrMap.is(), "There is the import prop mapper" );
+ if( xImpPrMap.is() )
+ xImpPrMap->FillPropertySet( GetProperties(), rPropSet, aContextIDs );
+
+ Reference< beans::XPropertySetInfo > xInfo;
+ for( sal_uInt16 i=0; i<MAX_SPECIAL_DRAW_STYLES; i++ )
+ {
+ sal_Int32 nIndex = aContextIDs[i].nIndex;
+ if( nIndex != -1 )
+ {
+ struct XMLPropertyState& rState = GetProperties()[nIndex];
+ OUString sStyleName;
+ rState.maValue >>= sStyleName;
+ sStyleName = GetImport().GetStyleDisplayName( aFamilies[i],
+ sStyleName );
+ // get property set mapper
+ UniReference<XMLPropertySetMapper> rPropMapper =
+ xImpPrMap->getPropertySetMapper();
+
+ // set property
+ const OUString& rPropertyName =
+ rPropMapper->GetEntryAPIName(rState.mnIndex);
+ if( !xInfo.is() )
+ xInfo = rPropSet->getPropertySetInfo();
+ if ( xInfo->hasPropertyByName( rPropertyName ) )
+ {
+ rPropSet->setPropertyValue( rPropertyName, Any( sStyleName ) );
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLPageMasterStyleContext, SvXMLStyleContext );
+
+SdXMLPageMasterStyleContext::SdXMLPageMasterStyleContext(
+ SdXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+: SvXMLStyleContext(rImport, nPrfx, rLName, xAttrList, XML_STYLE_FAMILY_SD_PAGEMASTERSTYLECONEXT_ID),
+ mnBorderBottom( 0L ),
+ mnBorderLeft( 0L ),
+ mnBorderRight( 0L ),
+ mnBorderTop( 0L ),
+ mnWidth( 0L ),
+ mnHeight( 0L ),
+ meOrientation(GetSdImport().IsDraw() ? view::PaperOrientation_PORTRAIT : view::PaperOrientation_LANDSCAPE)
+{
+ // set family to something special at SvXMLStyleContext
+ // for differences in search-methods
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex(i);
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetSdImport().GetNamespaceMap().GetKeyByAttrName(sAttrName, &aLocalName);
+ OUString sValue = xAttrList->getValueByIndex(i);
+ const SvXMLTokenMap& rAttrTokenMap = GetSdImport().GetPageMasterStyleAttrTokenMap();
+
+ switch(rAttrTokenMap.Get(nPrefix, aLocalName))
+ {
+ case XML_TOK_PAGEMASTERSTYLE_MARGIN_TOP:
+ {
+ GetSdImport().GetMM100UnitConverter().convertMeasure(mnBorderTop, sValue);
+ break;
+ }
+ case XML_TOK_PAGEMASTERSTYLE_MARGIN_BOTTOM:
+ {
+ GetSdImport().GetMM100UnitConverter().convertMeasure(mnBorderBottom, sValue);
+ break;
+ }
+ case XML_TOK_PAGEMASTERSTYLE_MARGIN_LEFT:
+ {
+ GetSdImport().GetMM100UnitConverter().convertMeasure(mnBorderLeft, sValue);
+ break;
+ }
+ case XML_TOK_PAGEMASTERSTYLE_MARGIN_RIGHT:
+ {
+ GetSdImport().GetMM100UnitConverter().convertMeasure(mnBorderRight, sValue);
+ break;
+ }
+ case XML_TOK_PAGEMASTERSTYLE_PAGE_WIDTH:
+ {
+ GetSdImport().GetMM100UnitConverter().convertMeasure(mnWidth, sValue);
+ break;
+ }
+ case XML_TOK_PAGEMASTERSTYLE_PAGE_HEIGHT:
+ {
+ GetSdImport().GetMM100UnitConverter().convertMeasure(mnHeight, sValue);
+ break;
+ }
+ case XML_TOK_PAGEMASTERSTYLE_PAGE_ORIENTATION:
+ {
+ if( IsXMLToken( sValue, XML_PORTRAIT ) )
+ meOrientation = view::PaperOrientation_PORTRAIT;
+ else
+ meOrientation = view::PaperOrientation_LANDSCAPE;
+ break;
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLPageMasterStyleContext::~SdXMLPageMasterStyleContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLPageMasterContext, SvXMLStyleContext );
+
+SdXMLPageMasterContext::SdXMLPageMasterContext(
+ SdXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+: SvXMLStyleContext(rImport, nPrfx, rLName, xAttrList, XML_STYLE_FAMILY_SD_PAGEMASTERCONEXT_ID),
+ mpPageMasterStyle( 0L )
+{
+ // set family to something special at SvXMLStyleContext
+ // for differences in search-methods
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex(i);
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetSdImport().GetNamespaceMap().GetKeyByAttrName(sAttrName, &aLocalName);
+ OUString sValue = xAttrList->getValueByIndex(i);
+ const SvXMLTokenMap& rAttrTokenMap = GetSdImport().GetPageMasterAttrTokenMap();
+
+ switch(rAttrTokenMap.Get(nPrefix, aLocalName))
+ {
+ case XML_TOK_PAGEMASTER_NAME:
+ {
+ msName = sValue;
+ break;
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLPageMasterContext::~SdXMLPageMasterContext()
+{
+ // release remembered contexts, they are no longer needed
+ if(mpPageMasterStyle)
+ {
+ mpPageMasterStyle->ReleaseRef();
+ mpPageMasterStyle = 0L;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLImportContext *SdXMLPageMasterContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ SvXMLImportContext* pContext = 0;
+
+ if(nPrefix == XML_NAMESPACE_STYLE && IsXMLToken( rLocalName, XML_PAGE_LAYOUT_PROPERTIES) )
+ {
+ pContext = new SdXMLPageMasterStyleContext(GetSdImport(), nPrefix, rLocalName, xAttrList);
+
+ // remember SdXMLPresentationPlaceholderContext for later evaluation
+ if(pContext)
+ {
+ pContext->AddRef();
+ DBG_ASSERT(!mpPageMasterStyle, "PageMasterStyle is set, there seem to be two of them (!)");
+ mpPageMasterStyle = (SdXMLPageMasterStyleContext*)pContext;
+ }
+ }
+
+ // call base class
+ if(!pContext)
+ pContext = SvXMLStyleContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
+
+ return pContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLPresentationPageLayoutContext, SvXMLStyleContext );
+
+SdXMLPresentationPageLayoutContext::SdXMLPresentationPageLayoutContext(
+ SdXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList)
+: SvXMLStyleContext(rImport, nPrfx, rLName, xAttrList, XML_STYLE_FAMILY_SD_PRESENTATIONPAGELAYOUT_ID),
+ mnTypeId( 20 ) // AUTOLAYOUT_NONE
+{
+ // set family to somethiong special at SvXMLStyleContext
+ // for differences in search-methods
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName );
+
+ if(nPrefix == XML_NAMESPACE_STYLE && IsXMLToken( aLocalName, XML_NAME ) )
+ {
+ msName = xAttrList->getValueByIndex( i );
+ }
+ }
+}
+
+SdXMLPresentationPageLayoutContext::~SdXMLPresentationPageLayoutContext()
+{
+}
+
+SvXMLImportContext *SdXMLPresentationPageLayoutContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ SvXMLImportContext* pContext = 0;
+
+ if(nPrefix == XML_NAMESPACE_PRESENTATION && IsXMLToken( rLocalName, XML_PLACEHOLDER ) )
+ {
+ // presentation:placeholder inside style:presentation-page-layout context
+ pContext = new SdXMLPresentationPlaceholderContext(
+ GetSdImport(), nPrefix, rLocalName, xAttrList);
+
+ // remember SdXMLPresentationPlaceholderContext for later evaluation
+ if(pContext)
+ {
+ pContext->AddRef();
+ maList.push_back( (SdXMLPresentationPlaceholderContext*)pContext );
+ }
+ }
+
+ // call base class
+ if(!pContext)
+ pContext = SvXMLStyleContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
+
+ return pContext;
+}
+
+void SdXMLPresentationPageLayoutContext::EndElement()
+{
+ // build presentation page layout type here
+ // calc mnTpeId due to content of maList
+ // at the moment only use number of types used there
+ if( !maList.empty() )
+ {
+ SdXMLPresentationPlaceholderContext* pObj0 = maList[ 0 ];
+ if(pObj0->GetName().equals(OUString(RTL_CONSTASCII_USTRINGPARAM("handout"))))
+ {
+ switch( maList.size() )
+ {
+ case 1:
+ mnTypeId = 22; // AUTOLAYOUT_HANDOUT1
+ break;
+ case 2:
+ mnTypeId = 23; // AUTOLAYOUT_HANDOUT2
+ break;
+ case 3:
+ mnTypeId = 24; // AUTOLAYOUT_HANDOUT3
+ break;
+ case 4:
+ mnTypeId = 25; // AUTOLAYOUT_HANDOUT4
+ break;
+ case 9:
+ mnTypeId = 31; // AUTOLAYOUT_HANDOUT9
+ break;
+ default:
+ mnTypeId = 26; // AUTOLAYOUT_HANDOUT6
+ }
+ }
+ else
+ {
+ switch( maList.size() )
+ {
+ case 1:
+ {
+ if(pObj0->GetName().equals(OUString(RTL_CONSTASCII_USTRINGPARAM("title"))))
+ {
+ mnTypeId = 19; // AUTOLAYOUT_ONLY_TITLE
+ }
+ else
+ {
+ mnTypeId = 32; // AUTOLAYOUT_ONLY_TEXT
+ }
+ break;
+ }
+ case 2:
+ {
+ SdXMLPresentationPlaceholderContext* pObj1 = maList[ 1 ];
+
+ if(pObj1->GetName().equals(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("subtitle"))))
+ {
+ mnTypeId = 0; // AUTOLAYOUT_TITLE
+ }
+ else if(pObj1->GetName().equals(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("outline"))))
+ {
+ mnTypeId = 1; // AUTOLAYOUT_ENUM
+ }
+ else if(pObj1->GetName().equals(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("chart"))))
+ {
+ mnTypeId = 2; // AUTOLAYOUT_CHART
+ }
+ else if(pObj1->GetName().equals(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("table"))))
+ {
+ mnTypeId = 8; // AUTOLAYOUT_TAB
+ }
+ else if(pObj1->GetName().equals(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("object"))))
+ {
+ mnTypeId = 11; // AUTOLAYOUT_OBJ
+ }
+ else if(pObj1->GetName().equals(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("vertical_outline"))))
+ {
+ if(pObj0->GetName().equals(OUString(RTL_CONSTASCII_USTRINGPARAM("vertical_title"))))
+ {
+ // AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE
+ mnTypeId = 28;
+ }
+ else
+ {
+ // AUTOLAYOUT_TITLE_VERTICAL_OUTLINE
+ mnTypeId = 29;
+ }
+ }
+ else
+ {
+ mnTypeId = 21; // AUTOLAYOUT_NOTES
+ }
+ break;
+ }
+ case 3:
+ {
+ SdXMLPresentationPlaceholderContext* pObj1 = maList[ 1 ];
+ SdXMLPresentationPlaceholderContext* pObj2 = maList[ 2 ];
+
+ if(pObj1->GetName().equals(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("outline"))))
+ {
+ if(pObj2->GetName().equals(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("outline"))))
+ {
+ mnTypeId = 3; // AUTOLAYOUT_2TEXT
+ }
+ else if(pObj2->GetName().equals(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("chart"))))
+ {
+ mnTypeId = 4; // AUTOLAYOUT_TEXTCHART
+ }
+ else if(pObj2->GetName().equals(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("graphic"))))
+ {
+ mnTypeId = 6; // AUTOLAYOUT_TEXTCLIP
+ }
+ else
+ {
+ if(pObj1->GetX() < pObj2->GetX())
+ {
+ mnTypeId = 10; // AUTOLAYOUT_TEXTOBJ -> outline left, object right
+ }
+ else
+ {
+ mnTypeId = 17; // AUTOLAYOUT_TEXTOVEROBJ -> outline top, object right
+ }
+ }
+ }
+ else if(pObj1->GetName().equals(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("chart"))))
+ {
+ mnTypeId = 7; // AUTOLAYOUT_CHARTTEXT
+ }
+ else if(pObj1->GetName().equals(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("graphic"))))
+ {
+ if(pObj2->GetName().equals(OUString(RTL_CONSTASCII_USTRINGPARAM("vertical_outline"))))
+ {
+ // AUTOLAYOUT_TITLE_VERTICAL_OUTLINE_CLIPART
+ mnTypeId = 30;
+ }
+ else
+ {
+ mnTypeId = 9; // AUTOLAYOUT_CLIPTEXT
+ }
+ }
+ else if(pObj1->GetName().equals(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("vertical_outline"))))
+ {
+ // AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART
+ mnTypeId = 27;
+ }
+ else
+ {
+ if(pObj1->GetX() < pObj2->GetX())
+ {
+ mnTypeId = 13; // AUTOLAYOUT_OBJTEXT -> left, right
+ }
+ else
+ {
+ mnTypeId = 14; // AUTOLAYOUT_OBJOVERTEXT -> top, bottom
+ }
+ }
+ break;
+ }
+ case 4:
+ {
+ SdXMLPresentationPlaceholderContext* pObj1 = maList[ 1 ];
+ SdXMLPresentationPlaceholderContext* pObj2 = maList[ 2 ];
+
+ if(pObj1->GetName().equals(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("object"))))
+ {
+ if(pObj1->GetX() < pObj2->GetX())
+ {
+ mnTypeId = 16; // AUTOLAYOUT_2OBJOVERTEXT
+ }
+ else
+ {
+ mnTypeId = 15; // AUTOLAYOUT_2OBJTEXT
+ }
+ }
+ else
+ {
+ mnTypeId = 12; // AUTOLAYOUT_TEXT2OBJ
+ }
+ break;
+ }
+ case 5:
+ {
+ SdXMLPresentationPlaceholderContext* pObj1 = maList[ 1 ];
+
+ if(pObj1->GetName().equals(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("object"))))
+ {
+ mnTypeId = 18; // AUTOLAYOUT_4OBJ
+ }
+ else
+ {
+ mnTypeId = 33; // AUTOLAYOUT_4CLIPART
+ }
+ break;
+
+ }
+ case 7:
+ {
+ mnTypeId = 33; // AUTOLAYOUT_6CLIPART
+ break;
+ }
+ default:
+ {
+ mnTypeId = 20; // AUTOLAYOUT_NONE
+ break;
+ }
+ }
+ }
+
+ // release remembered contexts, they are no longer needed
+ for ( size_t i = maList.size(); i > 0; )
+ maList[ --i ]->ReleaseRef();
+ maList.clear();
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLPresentationPlaceholderContext::SdXMLPresentationPlaceholderContext(
+ SdXMLImport& rImport,
+ sal_uInt16 nPrfx, const
+ OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+: SvXMLImportContext( rImport, nPrfx, rLName),
+ mnX(0L),
+ mnY(0L),
+ mnWidth(1L),
+ mnHeight(1L)
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex(i);
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetSdImport().GetNamespaceMap().GetKeyByAttrName(sAttrName, &aLocalName);
+ OUString sValue = xAttrList->getValueByIndex(i);
+ const SvXMLTokenMap& rAttrTokenMap = GetSdImport().GetPresentationPlaceholderAttrTokenMap();
+
+ switch(rAttrTokenMap.Get(nPrefix, aLocalName))
+ {
+ case XML_TOK_PRESENTATIONPLACEHOLDER_OBJECTNAME:
+ {
+ msName = sValue;
+ break;
+ }
+ case XML_TOK_PRESENTATIONPLACEHOLDER_X:
+ {
+ GetSdImport().GetMM100UnitConverter().convertMeasure(mnX, sValue);
+ break;
+ }
+ case XML_TOK_PRESENTATIONPLACEHOLDER_Y:
+ {
+ GetSdImport().GetMM100UnitConverter().convertMeasure(mnY, sValue);
+ break;
+ }
+ case XML_TOK_PRESENTATIONPLACEHOLDER_WIDTH:
+ {
+ GetSdImport().GetMM100UnitConverter().convertMeasure(mnWidth, sValue);
+ break;
+ }
+ case XML_TOK_PRESENTATIONPLACEHOLDER_HEIGHT:
+ {
+ GetSdImport().GetMM100UnitConverter().convertMeasure(mnHeight, sValue);
+ break;
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLPresentationPlaceholderContext::~SdXMLPresentationPlaceholderContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLMasterPageContext, SdXMLGenericPageContext );
+
+SdXMLMasterPageContext::SdXMLMasterPageContext(
+ SdXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes)
+: SdXMLGenericPageContext( rImport, nPrfx, rLName, xAttrList, rShapes )
+{
+ const sal_Bool bHandoutMaster = IsXMLToken( rLName, XML_HANDOUT_MASTER );
+
+ const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetSdImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ OUString sValue = xAttrList->getValueByIndex( i );
+ const SvXMLTokenMap& rAttrTokenMap = GetSdImport().GetMasterPageAttrTokenMap();
+
+ switch(rAttrTokenMap.Get(nPrefix, aLocalName))
+ {
+ case XML_TOK_MASTERPAGE_NAME:
+ {
+ msName = sValue;
+ break;
+ }
+ case XML_TOK_MASTERPAGE_DISPLAY_NAME:
+ {
+ msDisplayName = sValue;
+ break;
+ }
+ case XML_TOK_MASTERPAGE_PAGE_MASTER_NAME:
+ {
+ msPageMasterName = sValue;
+ break;
+ }
+ case XML_TOK_MASTERPAGE_STYLE_NAME:
+ {
+ msStyleName = sValue;
+ break;
+ }
+ case XML_TOK_MASTERPAGE_PAGE_LAYOUT_NAME:
+ {
+ maPageLayoutName = sValue;
+ break;
+ }
+ case XML_TOK_MASTERPAGE_USE_HEADER_NAME:
+ {
+ maUseHeaderDeclName = sValue;
+ break;
+ }
+ case XML_TOK_MASTERPAGE_USE_FOOTER_NAME:
+ {
+ maUseFooterDeclName = sValue;
+ break;
+ }
+ case XML_TOK_MASTERPAGE_USE_DATE_TIME_NAME:
+ {
+ maUseDateTimeDeclName = sValue;
+ break;
+ }
+ }
+ }
+
+ if( !msDisplayName.getLength() )
+ msDisplayName = msName;
+ else if( msDisplayName != msName )
+ GetImport().AddStyleDisplayName( XML_STYLE_FAMILY_MASTER_PAGE, msName, msDisplayName );
+
+ GetImport().GetShapeImport()->startPage( GetLocalShapesContext() );
+
+ // set page name?
+ if(!bHandoutMaster && msDisplayName.getLength() && GetLocalShapesContext().is())
+ {
+ uno::Reference < container::XNamed > xNamed(GetLocalShapesContext(), uno::UNO_QUERY);
+ if(xNamed.is())
+ xNamed->setName(msDisplayName);
+ }
+
+ // set page-master?
+ if(msPageMasterName.getLength())
+ {
+ SetPageMaster( msPageMasterName );
+ }
+
+ SetStyle( msStyleName );
+
+ SetLayout();
+
+ DeleteAllShapes();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLMasterPageContext::~SdXMLMasterPageContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLMasterPageContext::EndElement()
+{
+ // set styles on master-page
+ if(msName.getLength() && GetSdImport().GetShapeImport()->GetStylesContext())
+ {
+ SvXMLImportContext* pContext = GetSdImport().GetShapeImport()->GetStylesContext();
+ if( pContext && pContext->ISA( SvXMLStyleContext ) )
+ ((SdXMLStylesContext*)pContext)->SetMasterPageStyles(*this);
+ }
+
+ SdXMLGenericPageContext::EndElement();
+ GetImport().GetShapeImport()->endPage(GetLocalShapesContext());
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLImportContext* SdXMLMasterPageContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList>& xAttrList )
+{
+ SvXMLImportContext* pContext = 0;
+ const SvXMLTokenMap& rTokenMap = GetSdImport().GetMasterPageElemTokenMap();
+
+ // some special objects inside style:masterpage context
+ switch(rTokenMap.Get(nPrefix, rLocalName))
+ {
+ case XML_TOK_MASTERPAGE_STYLE:
+ {
+ if(GetSdImport().GetShapeImport()->GetStylesContext())
+ {
+ // style:style inside master-page context -> presentation style
+ XMLShapeStyleContext* pNew = new XMLShapeStyleContext(
+ GetSdImport(), nPrefix, rLocalName, xAttrList,
+ *GetSdImport().GetShapeImport()->GetStylesContext(),
+ XML_STYLE_FAMILY_SD_PRESENTATION_ID);
+
+ // add this style to the outer StylesContext class for later processing
+ if(pNew)
+ {
+ pContext = pNew;
+ GetSdImport().GetShapeImport()->GetStylesContext()->AddStyle(*pNew);
+ }
+ }
+ break;
+ }
+ case XML_TOK_MASTERPAGE_NOTES:
+ {
+ if( GetSdImport().IsImpress() )
+ {
+ // get notes page
+ uno::Reference< presentation::XPresentationPage > xPresPage(GetLocalShapesContext(), uno::UNO_QUERY);
+ if(xPresPage.is())
+ {
+ uno::Reference< drawing::XDrawPage > xNotesDrawPage(xPresPage->getNotesPage(), uno::UNO_QUERY);
+ if(xNotesDrawPage.is())
+ {
+ uno::Reference< drawing::XShapes > xNewShapes(xNotesDrawPage, uno::UNO_QUERY);
+ if(xNewShapes.is())
+ {
+ // presentation:notes inside master-page context
+ pContext = new SdXMLNotesContext( GetSdImport(), nPrefix, rLocalName, xAttrList, xNewShapes);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // call base class
+ if(!pContext)
+ pContext = SdXMLGenericPageContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
+
+ return pContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLStylesContext, SvXMLStyleContext );
+
+SdXMLStylesContext::SdXMLStylesContext(
+ SdXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList,
+ sal_Bool bIsAutoStyle)
+: SvXMLStylesContext(rImport, nPrfx, rLName, xAttrList),
+ mbIsAutoStyle(bIsAutoStyle)
+{
+ Reference< lang::XMultiServiceFactory > xMSF = rImport.getServiceFactory();
+ mpNumFormatter = new SvNumberFormatter( xMSF, LANGUAGE_SYSTEM );
+ mpNumFmtHelper = new SvXMLNumFmtHelper( mpNumFormatter, xMSF );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLStylesContext::~SdXMLStylesContext()
+{
+ delete mpNumFmtHelper;
+ delete mpNumFormatter;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLStyleContext* SdXMLStylesContext::CreateStyleChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList)
+{
+ SvXMLStyleContext* pContext = 0;
+ const SvXMLTokenMap& rStyleTokenMap = GetSdImport().GetStylesElemTokenMap();
+
+ switch(rStyleTokenMap.Get(nPrefix, rLocalName))
+ {
+ case XML_TOK_STYLES_PAGE_MASTER:
+ {
+ // style:page-master inside office:styles context
+ pContext = new SdXMLPageMasterContext(GetSdImport(), nPrefix, rLocalName, xAttrList);
+ break;
+ }
+ case XML_TOK_STYLES_PRESENTATION_PAGE_LAYOUT:
+ {
+ // style:presentation-page-layout inside office:styles context
+ pContext = new SdXMLPresentationPageLayoutContext(GetSdImport(), nPrefix, rLocalName, xAttrList);
+ break;
+ }
+ }
+
+ if(!pContext)
+ {
+ const SvXMLTokenMap& rTokenMap = mpNumFmtHelper->GetStylesElemTokenMap();
+ sal_uInt16 nToken = rTokenMap.Get( nPrefix, rLocalName );
+ switch (nToken)
+ {
+ case XML_TOK_STYLES_DATE_STYLE:
+ case XML_TOK_STYLES_TIME_STYLE:
+ // number:date-style or number:time-style
+ pContext = new SdXMLNumberFormatImportContext( GetSdImport(), nPrefix, rLocalName, mpNumFmtHelper->getData(), nToken, xAttrList, *this );
+ break;
+
+ case XML_TOK_STYLES_NUMBER_STYLE:
+ case XML_TOK_STYLES_CURRENCY_STYLE:
+ case XML_TOK_STYLES_PERCENTAGE_STYLE:
+ case XML_TOK_STYLES_BOOLEAN_STYLE:
+ case XML_TOK_STYLES_TEXT_STYLE:
+ pContext = new SvXMLNumFormatContext( GetSdImport(), nPrefix, rLocalName,
+ mpNumFmtHelper->getData(), nToken, xAttrList, *this );
+ break;
+ }
+ }
+
+ if(!pContext && nPrefix == XML_NAMESPACE_PRESENTATION )
+ {
+ if( IsXMLToken( rLocalName, XML_HEADER_DECL ) ||
+ IsXMLToken( rLocalName, XML_FOOTER_DECL ) ||
+ IsXMLToken( rLocalName, XML_DATE_TIME_DECL ) )
+ {
+ pContext = new SdXMLHeaderFooterDeclContext( GetImport(), nPrefix, rLocalName, xAttrList );
+ }
+ }
+
+ if(!pContext && (nPrefix == XML_NAMESPACE_TABLE) && IsXMLToken( rLocalName, XML_TABLE_TEMPLATE ) )
+ {
+ pContext = GetImport().GetShapeImport()->GetShapeTableImport()->CreateTableTemplateContext(nPrefix, rLocalName, xAttrList );
+ }
+
+ // call base class
+ if(!pContext)
+ pContext = SvXMLStylesContext::CreateStyleChildContext(nPrefix, rLocalName, xAttrList);
+
+ return pContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLStyleContext* SdXMLStylesContext::CreateStyleStyleChildContext(
+ sal_uInt16 nFamily,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList)
+{
+ SvXMLStyleContext* pContext = 0;
+
+ switch( nFamily )
+ {
+ case XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID:
+ pContext = new SdXMLDrawingPageStyleContext(GetSdImport(), nPrefix, rLocalName, xAttrList, *this );
+ break;
+ case XML_STYLE_FAMILY_TABLE_CELL:
+ case XML_STYLE_FAMILY_TABLE_COLUMN:
+ case XML_STYLE_FAMILY_TABLE_ROW:
+ pContext = new XMLShapeStyleContext( GetSdImport(), nPrefix, rLocalName, xAttrList, *this, nFamily );
+ break;
+ }
+
+ // call base class
+ if(!pContext)
+ pContext = SvXMLStylesContext::CreateStyleStyleChildContext(nFamily, nPrefix, rLocalName, xAttrList);
+
+ return pContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLStyleContext* SdXMLStylesContext::CreateDefaultStyleStyleChildContext(
+ sal_uInt16 nFamily,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference< XAttributeList > & xAttrList )
+{
+ SvXMLStyleContext* pContext = 0;
+
+ switch( nFamily )
+ {
+ case XML_STYLE_FAMILY_SD_GRAPHICS_ID:
+ pContext = new XMLGraphicsDefaultStyle(GetSdImport(), nPrefix, rLocalName, xAttrList, *this );
+ break;
+ }
+
+ // call base class
+ if(!pContext)
+ pContext = SvXMLStylesContext::CreateDefaultStyleStyleChildContext(nFamily, nPrefix, rLocalName, xAttrList);
+
+ return pContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+sal_uInt16 SdXMLStylesContext::GetFamily( const OUString& rFamily ) const
+{
+ // call base class
+ return SvXMLStylesContext::GetFamily(rFamily);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+UniReference< SvXMLImportPropertyMapper > SdXMLStylesContext::GetImportPropertyMapper(
+ sal_uInt16 nFamily) const
+{
+ UniReference < SvXMLImportPropertyMapper > xMapper;
+
+ switch( nFamily )
+ {
+ case XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID:
+ {
+ if(!xPresImpPropMapper.is())
+ {
+ UniReference< XMLShapeImportHelper > aImpHelper = ((SvXMLImport&)GetImport()).GetShapeImport();
+ ((SdXMLStylesContext*)this)->xPresImpPropMapper =
+ aImpHelper->GetPresPagePropsMapper();
+ }
+ xMapper = xPresImpPropMapper;
+ break;
+ }
+
+ case XML_STYLE_FAMILY_TABLE_COLUMN:
+ case XML_STYLE_FAMILY_TABLE_ROW:
+ case XML_STYLE_FAMILY_TABLE_CELL:
+ {
+ const rtl::Reference< XMLTableImport >& xTableImport( const_cast< SvXMLImport& >( GetImport() ).GetShapeImport()->GetShapeTableImport() );
+
+ switch( nFamily )
+ {
+ case XML_STYLE_FAMILY_TABLE_COLUMN: xMapper = xTableImport->GetColumnImportPropertySetMapper().get(); break;
+ case XML_STYLE_FAMILY_TABLE_ROW: xMapper = xTableImport->GetRowImportPropertySetMapper().get(); break;
+ case XML_STYLE_FAMILY_TABLE_CELL: xMapper = xTableImport->GetCellImportPropertySetMapper().get(); break;
+ }
+ break;
+ }
+ }
+
+ // call base class
+ if( !xMapper.is() )
+ xMapper = SvXMLStylesContext::GetImportPropertyMapper(nFamily);
+ return xMapper;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// Process all style and object info
+//
+void SdXMLStylesContext::EndElement()
+{
+ if(mbIsAutoStyle)
+ {
+ // AutoStyles for text import
+ GetImport().GetTextImport()->SetAutoStyles( this );
+
+ // AutoStyles for chart
+ GetImport().GetChartImport()->SetAutoStylesContext( this );
+
+ // AutoStyles for forms
+ GetImport().GetFormImport()->setAutoStyleContext( this );
+
+ // associate AutoStyles with styles in preparation to setting Styles on shapes
+ for(sal_uInt32 a(0L); a < GetStyleCount(); a++)
+ {
+ const SvXMLStyleContext* pStyle = GetStyle(a);
+ if(pStyle && pStyle->ISA(XMLShapeStyleContext))
+ {
+ XMLShapeStyleContext* pDocStyle = (XMLShapeStyleContext*)pStyle;
+
+ SvXMLStylesContext* pStylesContext = GetSdImport().GetShapeImport()->GetStylesContext();
+ if( pStylesContext )
+ {
+ pStyle = pStylesContext->FindStyleChildContext(pStyle->GetFamily(), pStyle->GetParentName());
+
+ if(pStyle && pStyle->ISA(XMLShapeStyleContext))
+ {
+ XMLShapeStyleContext* pParentStyle = (XMLShapeStyleContext*)pStyle;
+ if(pParentStyle->GetStyle().is())
+ {
+ pDocStyle->SetStyle(pParentStyle->GetStyle());
+ }
+ }
+ }
+ }
+ }
+
+ FinishStyles( false );
+ }
+ else
+ {
+ // Process styles list
+ ImpSetGraphicStyles();
+ ImpSetCellStyles();
+ GetImport().GetShapeImport()->GetShapeTableImport()->finishStyles();
+
+ // put style infos in the info set for other components ( content import f.e. )
+ uno::Reference< beans::XPropertySet > xInfoSet( GetImport().getImportInfo() );
+ if( xInfoSet.is() )
+ {
+ uno::Reference< beans::XPropertySetInfo > xInfoSetInfo( xInfoSet->getPropertySetInfo() );
+
+ if( xInfoSetInfo->hasPropertyByName( OUString( RTL_CONSTASCII_USTRINGPARAM( "PageLayouts" ) ) ) )
+ xInfoSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "PageLayouts" ) ), uno::makeAny( getPageLayouts() ) );
+ }
+
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// set master-page styles (all with family="presentation" and a special
+// prefix) on given master-page.
+//
+void SdXMLStylesContext::SetMasterPageStyles(SdXMLMasterPageContext& rMaster) const
+{
+ UniString sPrefix(rMaster.GetDisplayName());
+ sPrefix += sal_Unicode('-');
+
+ if(GetSdImport().GetLocalDocStyleFamilies().is() && GetSdImport().GetLocalDocStyleFamilies()->hasByName(rMaster.GetDisplayName())) try
+ {
+ uno::Reference< container::XNameAccess > xMasterPageStyles( GetSdImport().GetLocalDocStyleFamilies()->getByName(rMaster.GetDisplayName()), UNO_QUERY_THROW );
+ ImpSetGraphicStyles(xMasterPageStyles, XML_STYLE_FAMILY_SD_PRESENTATION_ID, sPrefix);
+ }
+ catch( uno::Exception& )
+ {
+ OSL_FAIL( "xmloff::SdXMLStylesContext::SetMasterPageStyles(), exception caught!" );
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// Process styles list:
+// set graphic styles (all with family="graphics"). Remember xStyle at list element.
+//
+void SdXMLStylesContext::ImpSetGraphicStyles() const
+{
+ if(GetSdImport().GetLocalDocStyleFamilies().is()) try
+ {
+ const OUString sGraphicStyleName(OUString(RTL_CONSTASCII_USTRINGPARAM("graphics")));
+ uno::Reference< container::XNameAccess > xGraphicPageStyles( GetSdImport().GetLocalDocStyleFamilies()->getByName(sGraphicStyleName), uno::UNO_QUERY_THROW );
+
+ UniString aPrefix;
+ ImpSetGraphicStyles(xGraphicPageStyles, XML_STYLE_FAMILY_SD_GRAPHICS_ID, aPrefix);
+ }
+ catch( uno::Exception& )
+ {
+ OSL_FAIL( "xmloff::SdXMLStylesContext::ImpSetGraphicStyles(), exception caught!" );
+ }
+}
+
+void SdXMLStylesContext::ImpSetCellStyles() const
+{
+ if(GetSdImport().GetLocalDocStyleFamilies().is()) try
+ {
+ const OUString sCellStyleName(OUString(RTL_CONSTASCII_USTRINGPARAM("cell")));
+ uno::Reference< container::XNameAccess > xGraphicPageStyles( GetSdImport().GetLocalDocStyleFamilies()->getByName(sCellStyleName), uno::UNO_QUERY_THROW );
+
+ UniString aPrefix;
+ ImpSetGraphicStyles(xGraphicPageStyles, XML_STYLE_FAMILY_TABLE_CELL, aPrefix);
+ }
+ catch( uno::Exception& )
+ {
+ OSL_FAIL( "xmloff::SdXMLStylesContext::ImpSetCellStyles(), exception caught!" );
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// help function used by ImpSetGraphicStyles() and ImpSetMasterPageStyles()
+//
+void SdXMLStylesContext::ImpSetGraphicStyles( uno::Reference< container::XNameAccess >& xPageStyles, sal_uInt16 nFamily, const UniString& rPrefix) const
+{
+ xub_StrLen nPrefLen(rPrefix.Len());
+
+ sal_uInt32 a;
+
+ // set defaults
+ for( a = 0; a < GetStyleCount(); a++)
+ {
+ const SvXMLStyleContext* pStyle = GetStyle(a);
+
+ if(nFamily == pStyle->GetFamily() && pStyle->IsDefaultStyle())
+ {
+ ((SvXMLStyleContext*)pStyle)->SetDefaults();
+ }
+ }
+
+ // create all styles and set properties
+ for( a = 0; a < GetStyleCount(); a++)
+ {
+ try
+ {
+ const SvXMLStyleContext* pStyle = GetStyle(a);
+ if(nFamily == pStyle->GetFamily() && !pStyle->IsDefaultStyle())
+ {
+ OUString aStyleName(pStyle->GetDisplayName());
+ if( nPrefLen )
+ {
+ sal_Int32 nStylePrefLen = aStyleName.lastIndexOf( sal_Unicode('-') ) + 1;
+ if( (nPrefLen != nStylePrefLen) || (aStyleName.compareTo( rPrefix, nPrefLen ) != 0) )
+ continue;
+
+ aStyleName = aStyleName.copy( nPrefLen );
+ }
+
+ uno::Reference< style::XStyle > xStyle;
+ if(xPageStyles->hasByName(aStyleName))
+ {
+ xPageStyles->getByName(aStyleName) >>= xStyle;
+
+ // set properties of existing styles to default
+ uno::Reference< beans::XPropertySet > xPropSet( xStyle, uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySetInfo > xPropSetInfo;
+ if( xPropSet.is() )
+ xPropSetInfo = xPropSet->getPropertySetInfo();
+
+ uno::Reference< beans::XPropertyState > xPropState( xStyle, uno::UNO_QUERY );
+
+ if( xPropState.is() )
+ {
+ UniReference < XMLPropertySetMapper > xPrMap;
+ UniReference < SvXMLImportPropertyMapper > xImpPrMap = GetImportPropertyMapper( nFamily );
+ DBG_ASSERT( xImpPrMap.is(), "There is the import prop mapper" );
+ if( xImpPrMap.is() )
+ xPrMap = xImpPrMap->getPropertySetMapper();
+ if( xPrMap.is() )
+ {
+ const sal_Int32 nCount = xPrMap->GetEntryCount();
+ for( sal_Int32 i = 0; i < nCount; i++ )
+ {
+ const OUString& rName = xPrMap->GetEntryAPIName( i );
+ if( xPropSetInfo->hasPropertyByName( rName ) && beans::PropertyState_DIRECT_VALUE == xPropState->getPropertyState( rName ) )
+ {
+ xPropState->setPropertyToDefault( rName );
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ // graphics style does not exist, create and add it
+ uno::Reference< lang::XSingleServiceFactory > xServiceFact(xPageStyles, uno::UNO_QUERY);
+ if(xServiceFact.is())
+ {
+ uno::Reference< style::XStyle > xNewStyle( xServiceFact->createInstance(), uno::UNO_QUERY);
+
+ if(xNewStyle.is())
+ {
+ // remember style
+ xStyle = xNewStyle;
+
+ // add new style to graphics style pool
+ uno::Reference< container::XNameContainer > xInsertContainer(xPageStyles, uno::UNO_QUERY);
+ if(xInsertContainer.is())
+ xInsertContainer->insertByName(aStyleName, uno::Any( xStyle ) );
+ }
+ }
+ }
+
+ if(xStyle.is())
+ {
+ // set properties at style
+ XMLPropStyleContext* pPropStyle = dynamic_cast< XMLPropStyleContext* >( const_cast< SvXMLStyleContext* >( pStyle ) );
+ uno::Reference< beans::XPropertySet > xPropSet(xStyle, uno::UNO_QUERY);
+
+ if(xPropSet.is() && pPropStyle)
+ {
+ pPropStyle->FillPropertySet(xPropSet);
+ pPropStyle->SetStyle(xStyle);
+ }
+ }
+ }
+ }
+ catch( Exception& e)
+ {
+ uno::Sequence<OUString> aSeq(0);
+ const_cast<SdXMLImport*>(&GetSdImport())->SetError( XMLERROR_FLAG_WARNING | XMLERROR_API, aSeq, e.Message, NULL );
+ }
+ }
+
+ // now set parents for all styles (when necessary)
+ for(a = 0L; a < GetStyleCount(); a++)
+ {
+ const SvXMLStyleContext* pStyle = GetStyle(a);
+
+ if(pStyle && pStyle->GetName().getLength() && (nFamily == pStyle->GetFamily())) try
+ {
+ OUString aStyleName(pStyle->GetDisplayName());
+ if( nPrefLen )
+ {
+ sal_Int32 nStylePrefLen = aStyleName.lastIndexOf( sal_Unicode('-') ) + 1;
+ if( (nPrefLen != nStylePrefLen) || (aStyleName.compareTo( rPrefix, nPrefLen ) != 0) )
+ continue;
+
+ aStyleName = aStyleName.copy( nPrefLen );
+ }
+
+ uno::Reference< style::XStyle > xStyle( xPageStyles->getByName(aStyleName), UNO_QUERY );
+ if(xStyle.is())
+ {
+ // set parent style name
+ ::rtl::OUString sParentStyleDisplayName( const_cast< SvXMLImport& >( GetImport() ).GetStyleDisplayName( pStyle->GetFamily(), pStyle->GetParentName() ) );
+ if( nPrefLen )
+ {
+ sal_Int32 nStylePrefLen = sParentStyleDisplayName.lastIndexOf( sal_Unicode('-') ) + 1;
+ if( (nPrefLen != nStylePrefLen) || (sParentStyleDisplayName.compareTo( rPrefix, nPrefLen ) != 0) )
+ continue;
+
+ sParentStyleDisplayName = sParentStyleDisplayName.copy( nPrefLen );
+ }
+ xStyle->setParentStyle( sParentStyleDisplayName );
+ }
+ }
+ catch( Exception& e )
+ {
+ uno::Sequence<OUString> aSeq(0);
+ const_cast<SdXMLImport*>(&GetSdImport())->SetError( XMLERROR_FLAG_WARNING | XMLERROR_API, aSeq, e.Message, NULL );
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// helper function to create the uno component that hold the mappings from
+// xml auto layout name to internal autolayout id
+
+uno::Reference< container::XNameAccess > SdXMLStylesContext::getPageLayouts() const
+{
+ uno::Reference< container::XNameContainer > xLayouts( comphelper::NameContainer_createInstance( ::getCppuType((const sal_Int32*)0)) );
+
+ for(sal_uInt32 a(0L); a < GetStyleCount(); a++)
+ {
+ const SvXMLStyleContext* pStyle = GetStyle(a);
+ if(pStyle && pStyle->ISA(SdXMLPresentationPageLayoutContext))
+ {
+ xLayouts->insertByName( pStyle->GetName(), uno::makeAny(
+ (sal_Int32)((SdXMLPresentationPageLayoutContext*)pStyle)->GetTypeId() ) );
+ }
+ }
+
+ return uno::Reference< container::XNameAccess >::query( xLayouts );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
+//
+TYPEINIT1( SdXMLMasterStylesContext, SvXMLImportContext );
+
+SdXMLMasterStylesContext::SdXMLMasterStylesContext(
+ SdXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLName)
+: SvXMLImportContext( rImport, nPrfx, rLName)
+{
+}
+
+SdXMLMasterStylesContext::~SdXMLMasterStylesContext()
+{
+ for ( size_t i = maMasterPageList.size(); i > 0; )
+ maMasterPageList[ --i ]->ReleaseRef();
+ maMasterPageList.clear();
+}
+
+SvXMLImportContext* SdXMLMasterStylesContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList)
+{
+ SvXMLImportContext* pContext = 0;
+
+ if(nPrefix == XML_NAMESPACE_STYLE
+ && IsXMLToken( rLocalName, XML_MASTER_PAGE ) )
+ {
+ // style:masterpage inside office:styles context
+ uno::Reference< drawing::XDrawPage > xNewMasterPage;
+ uno::Reference< drawing::XDrawPages > xMasterPages(GetSdImport().GetLocalMasterPages(), uno::UNO_QUERY);
+
+ if( xMasterPages.is() )
+ {
+ if(GetSdImport().GetNewMasterPageCount() + 1 > xMasterPages->getCount())
+ {
+ // new page, create and insert
+ xNewMasterPage = xMasterPages->insertNewByIndex(xMasterPages->getCount());
+ }
+ else
+ {
+ // existing page, use it
+ xMasterPages->getByIndex(GetSdImport().GetNewMasterPageCount()) >>= xNewMasterPage;
+ }
+
+ // increment global import page counter
+ GetSdImport().IncrementNewMasterPageCount();
+
+ if(xNewMasterPage.is())
+ {
+ uno::Reference< drawing::XShapes > xNewShapes(xNewMasterPage, uno::UNO_QUERY);
+ if(xNewShapes.is() && GetSdImport().GetShapeImport()->GetStylesContext())
+ {
+ pContext = new SdXMLMasterPageContext(GetSdImport(),
+ nPrefix, rLocalName, xAttrList, xNewShapes);
+
+ if(pContext)
+ {
+ pContext->AddRef();
+ maMasterPageList.push_back( (SdXMLMasterPageContext*)pContext );
+ }
+ }
+ }
+ }
+ }
+ else if(nPrefix == XML_NAMESPACE_STYLE
+ && IsXMLToken( rLocalName, XML_HANDOUT_MASTER ) )
+ {
+ uno::Reference< presentation::XHandoutMasterSupplier > xHandoutSupp( GetSdImport().GetModel(), uno::UNO_QUERY );
+ if( xHandoutSupp.is() )
+ {
+ uno::Reference< drawing::XShapes > xHandoutPage( xHandoutSupp->getHandoutMasterPage(), uno::UNO_QUERY );
+ if(xHandoutPage.is() && GetSdImport().GetShapeImport()->GetStylesContext())
+ {
+ pContext = new SdXMLMasterPageContext(GetSdImport(),
+ nPrefix, rLocalName, xAttrList, xHandoutPage);
+ }
+ }
+ }
+ else if( (nPrefix == XML_NAMESPACE_DRAW )&& IsXMLToken( rLocalName, XML_LAYER_SET ) )
+ {
+ pContext = new SdXMLLayerSetContext( GetImport(), nPrefix, rLocalName, xAttrList );
+ }
+
+ // call base class
+ if(!pContext)
+ pContext = SvXMLImportContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
+
+ return pContext;
+}
+
+///////////////////////////////////////////////////////////////////////
+
+SdXMLHeaderFooterDeclContext::SdXMLHeaderFooterDeclContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList )
+: SvXMLStyleContext( rImport, nPrfx, rLName, xAttrList )
+{
+ const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString aLocalName;
+ const OUString aValue( xAttrList->getValueByIndex(i) );
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(xAttrList->getNameByIndex(i), &aLocalName);
+
+ if( nPrefix == XML_NAMESPACE_PRESENTATION )
+ {
+ if( IsXMLToken( aLocalName, XML_NAME ) )
+ {
+ maStrName = aValue;
+ }
+ else if( IsXMLToken( aLocalName, XML_SOURCE ) )
+ {
+ mbFixed = IsXMLToken( aValue, XML_FIXED );
+ }
+ }
+ else if( nPrefix == XML_NAMESPACE_STYLE )
+ {
+ if( IsXMLToken( aLocalName, XML_DATA_STYLE_NAME ) )
+ {
+ maStrDateTimeFormat = aValue;
+ }
+ }
+ }
+}
+
+sal_Bool SdXMLHeaderFooterDeclContext::IsTransient() const
+{
+ return sal_True;
+}
+
+void SdXMLHeaderFooterDeclContext::EndElement()
+{
+ SdXMLImport& rImport = *dynamic_cast< SdXMLImport* >( &GetImport() );
+ if( IsXMLToken( GetLocalName(), XML_HEADER_DECL ) )
+ {
+ rImport.AddHeaderDecl( maStrName, maStrText );
+ }
+ else if( IsXMLToken( GetLocalName(), XML_FOOTER_DECL ) )
+ {
+ rImport.AddFooterDecl( maStrName, maStrText );
+ }
+ else if( IsXMLToken( GetLocalName(), XML_DATE_TIME_DECL ) )
+ {
+ rImport.AddDateTimeDecl( maStrName, maStrText, mbFixed, maStrDateTimeFormat );
+ }
+}
+
+void SdXMLHeaderFooterDeclContext::Characters( const ::rtl::OUString& rChars )
+{
+ maStrText += rChars;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/ximpstyl.hxx b/xmloff/source/draw/ximpstyl.hxx
new file mode 100644
index 000000000000..fc8cfcf25142
--- /dev/null
+++ b/xmloff/source/draw/ximpstyl.hxx
@@ -0,0 +1,306 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XIMPSTYLE_HXX
+#define _XIMPSTYLE_HXX
+
+#include <xmloff/xmlictxt.hxx>
+#include "sdxmlimp_impl.hxx"
+#include "ximppage.hxx"
+#include <xmloff/xmlstyle.hxx>
+#include <com/sun/star/view/PaperOrientation.hpp>
+#include <vector>
+
+class SvNumberFormatter;
+class SvXMLNumFmtHelper;
+
+//////////////////////////////////////////////////////////////////////////////
+// special style:style context inside style:page-master context
+
+class SdXMLPageMasterStyleContext: public SvXMLStyleContext
+{
+ sal_Int32 mnBorderBottom;
+ sal_Int32 mnBorderLeft;
+ sal_Int32 mnBorderRight;
+ sal_Int32 mnBorderTop;
+ sal_Int32 mnWidth;
+ sal_Int32 mnHeight;
+ com::sun::star::view::PaperOrientation meOrientation;
+
+ const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
+ SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
+
+public:
+ TYPEINFO();
+
+ SdXMLPageMasterStyleContext(
+ SdXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
+ virtual ~SdXMLPageMasterStyleContext();
+
+ sal_Int32 GetBorderBottom() const { return mnBorderBottom; }
+ sal_Int32 GetBorderLeft() const { return mnBorderLeft; }
+ sal_Int32 GetBorderRight() const { return mnBorderRight; }
+ sal_Int32 GetBorderTop() const { return mnBorderTop; }
+ sal_Int32 GetWidth() const { return mnWidth; }
+ sal_Int32 GetHeight() const { return mnHeight; }
+ com::sun::star::view::PaperOrientation GetOrientation() const { return meOrientation; }
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// style:page-master context
+
+class SdXMLPageMasterContext: public SvXMLStyleContext
+{
+ rtl::OUString msName;
+ SdXMLPageMasterStyleContext*mpPageMasterStyle;
+
+ const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
+ SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
+
+public:
+ TYPEINFO();
+
+ SdXMLPageMasterContext(
+ SdXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
+ virtual ~SdXMLPageMasterContext();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ const rtl::OUString& GetName() const { return msName; }
+ const SdXMLPageMasterStyleContext* GetPageMasterStyle() const { return mpPageMasterStyle; }
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// style:masterpage context
+
+class SdXMLMasterPageContext: public SdXMLGenericPageContext
+{
+ rtl::OUString msPageMasterName;
+ rtl::OUString msName;
+ rtl::OUString msDisplayName;
+ rtl::OUString msStyleName;
+
+public:
+ TYPEINFO();
+
+ SdXMLMasterPageContext(
+ SdXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes);
+ virtual ~SdXMLMasterPageContext();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void EndElement();
+
+ const rtl::OUString& GetPageMasterName() const { return msPageMasterName; }
+ const rtl::OUString& GetEncodedName() const { return msName; }
+ const rtl::OUString& GetDisplayName() const { return msDisplayName; }
+
+};
+typedef ::std::vector< SdXMLMasterPageContext* > ImpMasterPageList;
+
+//////////////////////////////////////////////////////////////////////////////
+// presentation:placeholder context
+
+class SdXMLPresentationPlaceholderContext: public SvXMLImportContext
+{
+ rtl::OUString msName;
+ sal_Int32 mnX;
+ sal_Int32 mnY;
+ sal_Int32 mnWidth;
+ sal_Int32 mnHeight;
+
+ const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
+ SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
+
+public:
+ SdXMLPresentationPlaceholderContext(
+ SdXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
+ virtual ~SdXMLPresentationPlaceholderContext();
+
+ const rtl::OUString& GetName() const { return msName; }
+ sal_Int32 GetX() const { return mnX; }
+ sal_Int32 GetY() const { return mnY; }
+ sal_Int32 GetWidth() const { return mnWidth; }
+ sal_Int32 GetHeight() const { return mnHeight; }
+};
+typedef ::std::vector< SdXMLPresentationPlaceholderContext* > ImpPlaceholderList;
+
+//////////////////////////////////////////////////////////////////////////////
+// style:presentation-page-layout context
+
+class SdXMLPresentationPageLayoutContext: public SvXMLStyleContext
+{
+ rtl::OUString msName;
+ ImpPlaceholderList maList;
+ sal_uInt16 mnTypeId;
+
+ const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
+ SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
+
+public:
+ TYPEINFO();
+
+ SdXMLPresentationPageLayoutContext(
+ SdXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
+ virtual ~SdXMLPresentationPageLayoutContext();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void EndElement();
+ sal_uInt16 GetTypeId() const { return mnTypeId; }
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// office:styles context
+
+class SdXMLStylesContext : public SvXMLStylesContext
+{
+ UniReference< SvXMLImportPropertyMapper > xPresImpPropMapper;
+ sal_Bool mbIsAutoStyle;
+ SvXMLNumFmtHelper* mpNumFmtHelper;
+ SvNumberFormatter* mpNumFormatter;
+
+ const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
+ SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
+
+ void ImpSetGraphicStyles() const;
+ void ImpSetCellStyles() const;
+ void ImpSetGraphicStyles( com::sun::star::uno::Reference< com::sun::star::container::XNameAccess >& xPageStyles,
+ sal_uInt16 nFamily, const UniString& rPrefix) const;
+
+protected:
+ virtual SvXMLStyleContext* CreateStyleChildContext(
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
+
+ virtual SvXMLStyleContext *CreateStyleStyleChildContext(
+ sal_uInt16 nFamily,
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
+
+ virtual SvXMLStyleContext *CreateDefaultStyleStyleChildContext(
+ sal_uInt16 nFamily, sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+public:
+ TYPEINFO();
+
+ SdXMLStylesContext(
+ SdXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList,
+ sal_Bool bIsAutoStyle);
+ virtual ~SdXMLStylesContext();
+
+ virtual sal_uInt16 GetFamily( const rtl::OUString& rFamily ) const;
+ virtual void EndElement();
+ virtual UniReference< SvXMLImportPropertyMapper > GetImportPropertyMapper(sal_uInt16 nFamily) const;
+
+ void SetMasterPageStyles(SdXMLMasterPageContext& rMaster) const;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > getPageLayouts() const;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// office:master-styles context
+//
+class SdXMLMasterStylesContext : public SvXMLImportContext
+{
+ ImpMasterPageList maMasterPageList;
+
+ const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
+ SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
+
+public:
+ TYPEINFO();
+
+ SdXMLMasterStylesContext(
+ SdXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLName);
+ virtual ~SdXMLMasterStylesContext();
+
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ const ImpMasterPageList& GetMasterPageList() const { return maMasterPageList; }
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// <pres:header-decl>, <pres:footer-decl> and <pres:date-time-decl>
+
+class SdXMLHeaderFooterDeclContext : public SvXMLStyleContext
+{
+public:
+ SdXMLHeaderFooterDeclContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual sal_Bool IsTransient() const;
+ virtual void EndElement();
+ virtual void Characters( const ::rtl::OUString& rChars );
+
+private:
+ ::rtl::OUString maStrName;
+ ::rtl::OUString maStrText;
+ ::rtl::OUString maStrDateTimeFormat;
+ sal_Bool mbFixed;
+};
+
+
+#endif // _XIMPSTYLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/attriblistmerge.cxx b/xmloff/source/forms/attriblistmerge.cxx
new file mode 100644
index 000000000000..776e74d9aed3
--- /dev/null
+++ b/xmloff/source/forms/attriblistmerge.cxx
@@ -0,0 +1,172 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "attriblistmerge.hxx"
+
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::xml;
+
+ //=====================================================================
+ //= OAttribListMerger
+ //=====================================================================
+ //---------------------------------------------------------------------
+ void OAttribListMerger::addList(const Reference< sax::XAttributeList >& _rxList)
+ {
+ OSL_ENSURE(_rxList.is(), "OAttribListMerger::addList: invalid list!");
+ if (_rxList.is())
+ m_aLists.push_back(_rxList);
+ }
+
+ //---------------------------------------------------------------------
+ sal_Bool OAttribListMerger::seekToIndex(sal_Int16 _nGlobalIndex, Reference< sax::XAttributeList >& _rSubList, sal_Int16& _rLocalIndex)
+ {
+ sal_Int16 nLeftOver = _nGlobalIndex;
+ ConstAttributeListArrayIterator aLookupSublist = m_aLists.begin();
+
+ for ( ; (aLookupSublist != m_aLists.end()) && (nLeftOver >= (*aLookupSublist)->getLength());
+ ++aLookupSublist
+ )
+ nLeftOver = nLeftOver - (*aLookupSublist)->getLength();
+
+ if (aLookupSublist == m_aLists.end())
+ {
+ OSL_FAIL("OAttribListMerger::seekToIndex: invalid index!");
+ return sal_False;
+ }
+ _rSubList = *aLookupSublist;
+ _rLocalIndex = nLeftOver;
+ return sal_True;
+ }
+
+ //---------------------------------------------------------------------
+ sal_Bool OAttribListMerger::seekToName(const ::rtl::OUString& _rName, Reference< sax::XAttributeList >& _rSubList, sal_Int16& _rLocalIndex)
+ {
+ for ( ConstAttributeListArrayIterator aLookupSublist = m_aLists.begin();
+ aLookupSublist != m_aLists.end();
+ ++aLookupSublist
+ )
+ for (sal_Int16 i=0; i<(*aLookupSublist)->getLength(); ++i)
+ if ((*aLookupSublist)->getNameByIndex(i) == _rName)
+ {
+ _rSubList = *aLookupSublist;
+ _rLocalIndex = i;
+ return sal_True;
+ }
+
+ OSL_FAIL("OAttribListMerger::seekToName: did not find the name!");
+ return sal_False;
+ }
+
+ //---------------------------------------------------------------------
+ sal_Int16 SAL_CALL OAttribListMerger::getLength( ) throw(RuntimeException)
+ {
+ sal_Int16 nCount = 0;
+ for ( ConstAttributeListArrayIterator aAccumulate = m_aLists.begin();
+ aAccumulate != m_aLists.end();
+ ++aAccumulate
+ )
+ nCount = nCount + (*aAccumulate)->getLength();
+ return nCount;
+ }
+
+ //---------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL OAttribListMerger::getNameByIndex( sal_Int16 i ) throw(RuntimeException)
+ {
+ Reference< sax::XAttributeList > xSubList;
+ sal_Int16 nLocalIndex;
+
+ if (!seekToIndex(i, xSubList, nLocalIndex))
+ return ::rtl::OUString();
+
+ return xSubList->getNameByIndex(nLocalIndex);
+ }
+
+ //---------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL OAttribListMerger::getTypeByIndex( sal_Int16 i ) throw(RuntimeException)
+ {
+ Reference< sax::XAttributeList > xSubList;
+ sal_Int16 nLocalIndex;
+
+ if (!seekToIndex(i, xSubList, nLocalIndex))
+ return ::rtl::OUString();
+
+ return xSubList->getTypeByIndex(nLocalIndex);
+ }
+
+ //---------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL OAttribListMerger::getTypeByName( const ::rtl::OUString& _rName ) throw(RuntimeException)
+ {
+ Reference< sax::XAttributeList > xSubList;
+ sal_Int16 nLocalIndex;
+
+ if (!seekToName(_rName, xSubList, nLocalIndex))
+ return ::rtl::OUString();
+
+ // though we're in getTypeByName here, we reroute this to the getTypeByIndex of the sub list,
+ // assuming that this is faster
+ return xSubList->getTypeByIndex(nLocalIndex);
+ }
+
+ //---------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL OAttribListMerger::getValueByIndex( sal_Int16 i ) throw(RuntimeException)
+ {
+ Reference< sax::XAttributeList > xSubList;
+ sal_Int16 nLocalIndex;
+
+ if (!seekToIndex(i, xSubList, nLocalIndex))
+ return ::rtl::OUString();
+
+ return xSubList->getValueByIndex(nLocalIndex);
+ }
+
+ //---------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL OAttribListMerger::getValueByName( const ::rtl::OUString& _rName ) throw(RuntimeException)
+ {
+ Reference< sax::XAttributeList > xSubList;
+ sal_Int16 nLocalIndex;
+
+ if (!seekToName(_rName, xSubList, nLocalIndex))
+ return ::rtl::OUString();
+
+ // though we're in getValueByName here, we reroute this to the getValueByIndex of the sub list,
+ // assuming that this is faster
+ return xSubList->getValueByIndex(nLocalIndex);
+ }
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/attriblistmerge.hxx b/xmloff/source/forms/attriblistmerge.hxx
new file mode 100644
index 000000000000..d91917365309
--- /dev/null
+++ b/xmloff/source/forms/attriblistmerge.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_FORMS_ATTRIBLISTMERGE_HXX_
+#define _XMLOFF_FORMS_ATTRIBLISTMERGE_HXX_
+
+#include <comphelper/stl_types.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <osl/mutex.hxx>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ //=====================================================================
+ //= OAttribListMerger
+ //=====================================================================
+ typedef ::cppu::WeakImplHelper1 < ::com::sun::star::xml::sax::XAttributeList
+ > OAttribListMerger_Base;
+ /** implements the XAttributeList list by merging different source attribute lists
+
+ <p>Currently, the time behavious is O(n), though it would be possible to change it to O(log n).</p>
+ */
+ class OAttribListMerger : public OAttribListMerger_Base
+ {
+ protected:
+ ::osl::Mutex m_aMutex;
+ DECLARE_STL_VECTOR( ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >, AttributeListArray );
+ AttributeListArray m_aLists;
+
+ ~OAttribListMerger() { }
+
+ public:
+ OAttribListMerger() { }
+
+ // attribute list handling
+ // (very thinn at the moment ... only adding lists is allowed ... add more if you need it :)
+ void addList(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rList);
+
+ // XAttributeList
+ virtual sal_Int16 SAL_CALL getLength( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getNameByIndex( sal_Int16 i ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTypeByIndex( sal_Int16 i ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTypeByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getValueByIndex( sal_Int16 i ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getValueByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
+
+ protected:
+ sal_Bool seekToIndex(sal_Int16 _nGlobalIndex, ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rSubList, sal_Int16& _rLocalIndex);
+ sal_Bool seekToName(const ::rtl::OUString& _rName, ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rSubList, sal_Int16& _rLocalIndex);
+ };
+
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+#endif // _XMLOFF_FORMS_ATTRIBLISTMERGE_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/callbacks.hxx b/xmloff/source/forms/callbacks.hxx
new file mode 100644
index 000000000000..4bf0f7de2690
--- /dev/null
+++ b/xmloff/source/forms/callbacks.hxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_FORMS_CALLBACKS_HXX_
+#define _XMLOFF_FORMS_CALLBACKS_HXX_
+
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/script/ScriptEventDescriptor.hpp>
+#include <rtl/ref.hxx>
+
+class SvXMLImport;
+class SvXMLExport;
+class SvXMLExportPropertyMapper;
+class SvXMLStyleContext;
+
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ class OAttribute2Property;
+
+ //=====================================================================
+ //= IFormsExportContext
+ //=====================================================================
+ class IFormsExportContext
+ {
+ public:
+ virtual SvXMLExport& getGlobalContext() = 0;
+ virtual ::rtl::Reference< SvXMLExportPropertyMapper > getStylePropertyMapper() = 0;
+
+ /** steps through a collection and exports all children of this collection
+ */
+ virtual void exportCollectionElements(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& _rxCollection) = 0;
+
+ virtual ::rtl::OUString getObjectStyleName(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObject ) = 0;
+ };
+
+ //=====================================================================
+ //= IEventAttacherManager
+ //=====================================================================
+ class IEventAttacherManager
+ {
+ public:
+ virtual void registerEvents(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxElement,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& _rEvents
+ ) = 0;
+ };
+
+ //=====================================================================
+ //= IEventAttacher
+ //=====================================================================
+ class IEventAttacher
+ {
+ public:
+ virtual void registerEvents(
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& _rEvents
+ ) = 0;
+ };
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+#endif // _XMLOFF_FORMS_CALLBACKS_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/controlelement.cxx b/xmloff/source/forms/controlelement.cxx
new file mode 100644
index 000000000000..7c7e82b9b9a8
--- /dev/null
+++ b/xmloff/source/forms/controlelement.cxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "controlelement.hxx"
+
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ //=====================================================================
+ //= OControlElement
+ //=====================================================================
+ //---------------------------------------------------------------------
+ const sal_Char* OControlElement::getElementName(ElementType _eType)
+ {
+ switch (_eType)
+ {
+ case TEXT: return "text";
+ case TEXT_AREA: return "textarea";
+ case PASSWORD: return "password";
+ case FILE: return "file";
+ case FORMATTED_TEXT: return "formatted-text";
+ case FIXED_TEXT: return "fixed-text";
+ case COMBOBOX: return "combobox";
+ case LISTBOX: return "listbox";
+ case BUTTON: return "button";
+ case IMAGE: return "image";
+ case CHECKBOX: return "checkbox";
+ case RADIO: return "radio";
+ case FRAME: return "frame";
+ case IMAGE_FRAME: return "image-frame";
+ case HIDDEN: return "hidden";
+ case GRID: return "grid";
+ case VALUERANGE: return "value-range";
+ case TIME: return "time";
+ case DATE: return "date";
+
+ default: return "generic-control";
+ }
+ }
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/controlelement.hxx b/xmloff/source/forms/controlelement.hxx
new file mode 100644
index 000000000000..3da3d6874ccc
--- /dev/null
+++ b/xmloff/source/forms/controlelement.hxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_FORMS_CONTROLELEMENT_HXX_
+#define _XMLOFF_FORMS_CONTROLELEMENT_HXX_
+
+#include <sal/types.h>
+
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ //=====================================================================
+ //= OControlElement
+ //=====================================================================
+ /** helper for translating between control types and XML tags
+ */
+ class OControlElement
+ {
+ public:
+ enum ElementType
+ {
+ TEXT = 0,
+ TEXT_AREA,
+ PASSWORD,
+ FILE,
+ FORMATTED_TEXT,
+ FIXED_TEXT,
+ COMBOBOX,
+ LISTBOX,
+ BUTTON,
+ IMAGE,
+ CHECKBOX,
+ RADIO,
+ FRAME,
+ IMAGE_FRAME,
+ HIDDEN,
+ GRID,
+ VALUERANGE,
+ GENERIC_CONTROL,
+ TIME,
+ DATE,
+
+ UNKNOWN // must be the last element
+ };
+
+ protected:
+ /** ctor.
+ <p>This default constructor is protected, 'cause this class is not intended to be instantiated
+ directly. Instead, the derived classes should be used.</p>
+ */
+ OControlElement() { }
+
+ public:
+ /** retrieves the tag name to be used to describe a control of the given type
+
+ <p>The retuned string is the pure element name, without any namespace.</p>
+
+ @param _eType
+ the element type
+ */
+ static const sal_Char* getElementName(ElementType _eType);
+ };
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+#endif // _XMLOFF_FORMS_CONTROLELEMENT_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/controlpropertyhdl.cxx b/xmloff/source/forms/controlpropertyhdl.cxx
new file mode 100644
index 000000000000..8823e7623765
--- /dev/null
+++ b/xmloff/source/forms/controlpropertyhdl.cxx
@@ -0,0 +1,392 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <xmloff/controlpropertyhdl.hxx>
+#include <com/sun/star/awt/TextAlign.hpp>
+#include <com/sun/star/awt/FontWidth.hpp>
+#include <com/sun/star/awt/FontEmphasisMark.hpp>
+#include <xmloff/xmltypes.hxx>
+#include "xmloff/NamedBoolPropertyHdl.hxx"
+#include "formenums.hxx"
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <osl/diagnose.h>
+#include "callbacks.hxx"
+#include <xmloff/XMLConstantsPropertyHandler.hxx>
+
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::awt;
+ using namespace ::com::sun::star::beans;
+ using namespace ::xmloff::token;
+
+ //=====================================================================
+ //= OControlPropertyHandlerFactory
+ //=====================================================================
+ //---------------------------------------------------------------------
+ OControlPropertyHandlerFactory::OControlPropertyHandlerFactory()
+ :m_pTextAlignHandler(NULL)
+ ,m_pControlBorderStyleHandler(NULL)
+ ,m_pControlBorderColorHandler(NULL)
+ ,m_pRotationAngleHandler(NULL)
+ ,m_pFontWidthHandler(NULL)
+ ,m_pFontEmphasisHandler(NULL)
+ ,m_pFontReliefHandler(NULL)
+ {
+ }
+
+ //---------------------------------------------------------------------
+ OControlPropertyHandlerFactory::~OControlPropertyHandlerFactory()
+ {
+ delete m_pTextAlignHandler;
+ delete m_pControlBorderStyleHandler;
+ delete m_pControlBorderColorHandler;
+ delete m_pRotationAngleHandler;
+ delete m_pFontWidthHandler;
+ delete m_pFontEmphasisHandler;
+ delete m_pFontReliefHandler;
+ }
+
+ //---------------------------------------------------------------------
+ const XMLPropertyHandler* OControlPropertyHandlerFactory::GetPropertyHandler(sal_Int32 _nType) const
+ {
+ const XMLPropertyHandler* pHandler = NULL;
+
+ switch (_nType)
+ {
+ case XML_TYPE_TEXT_ALIGN:
+ if (!m_pTextAlignHandler)
+ m_pTextAlignHandler = new XMLConstantsPropertyHandler(OEnumMapper::getEnumMap(OEnumMapper::epTextAlign), XML_TOKEN_INVALID );
+ pHandler = m_pTextAlignHandler;
+ break;
+
+ case XML_TYPE_CONTROL_BORDER:
+ if (!m_pControlBorderStyleHandler)
+ m_pControlBorderStyleHandler = new OControlBorderHandler( OControlBorderHandler::STYLE );
+ pHandler = m_pControlBorderStyleHandler;
+ break;
+
+ case XML_TYPE_CONTROL_BORDER_COLOR:
+ if ( !m_pControlBorderColorHandler )
+ m_pControlBorderColorHandler = new OControlBorderHandler( OControlBorderHandler::COLOR );
+ pHandler = m_pControlBorderColorHandler;
+ break;
+
+ case XML_TYPE_ROTATION_ANGLE:
+ if (!m_pRotationAngleHandler)
+ m_pRotationAngleHandler = new ORotationAngleHandler;
+ pHandler = m_pRotationAngleHandler;
+ break;
+
+ case XML_TYPE_FONT_WIDTH:
+ if (!m_pFontWidthHandler)
+ m_pFontWidthHandler = new OFontWidthHandler;
+ pHandler = m_pFontWidthHandler;
+ break;
+
+ case XML_TYPE_CONTROL_TEXT_EMPHASIZE:
+ if (!m_pFontEmphasisHandler)
+ m_pFontEmphasisHandler = new XMLConstantsPropertyHandler( OEnumMapper::getEnumMap(OEnumMapper::epFontEmphasis), XML_NONE );
+ pHandler = m_pFontEmphasisHandler;
+ break;
+
+ case XML_TYPE_TEXT_FONT_RELIEF:
+ if (!m_pFontReliefHandler)
+ m_pFontReliefHandler = new XMLConstantsPropertyHandler( OEnumMapper::getEnumMap(OEnumMapper::epFontRelief), XML_NONE );
+ pHandler = m_pFontReliefHandler;
+ break;
+ case XML_TYPE_TEXT_LINE_MODE:
+ pHandler = new XMLNamedBoolPropertyHdl(
+ ::xmloff::token::XML_SKIP_WHITE_SPACE,
+ ::xmloff::token::XML_CONTINUOUS);
+ break;
+ }
+
+ if (!pHandler)
+ pHandler = XMLPropertyHandlerFactory::GetPropertyHandler(_nType);
+ return pHandler;
+ }
+
+ //=====================================================================
+ //= OControlTextEmphasisHandler
+ //=====================================================================
+ OControlTextEmphasisHandler::OControlTextEmphasisHandler()
+ {
+ }
+
+ //---------------------------------------------------------------------
+ sal_Bool OControlTextEmphasisHandler::exportXML( ::rtl::OUString& _rStrExpValue, const Any& _rValue, const SvXMLUnitConverter& ) const
+ {
+ ::rtl::OUStringBuffer aReturn;
+ sal_Bool bSuccess = sal_False;
+ sal_Int16 nFontEmphasis = sal_Int16();
+ if (_rValue >>= nFontEmphasis)
+ {
+ // the type
+ sal_Int16 nType = nFontEmphasis & ~(FontEmphasisMark::ABOVE | FontEmphasisMark::BELOW);
+ // the position of the mark
+ sal_Bool bBelow = 0 != (nFontEmphasis & FontEmphasisMark::BELOW);
+
+ // convert
+ bSuccess = SvXMLUnitConverter::convertEnum(aReturn, nType, OEnumMapper::getEnumMap(OEnumMapper::epFontEmphasis), XML_NONE);
+ if (bSuccess)
+ {
+ aReturn.append( (sal_Unicode)' ' );
+ aReturn.append( GetXMLToken(bBelow ? XML_BELOW : XML_ABOVE) );
+
+ _rStrExpValue = aReturn.makeStringAndClear();
+ }
+ }
+
+ return bSuccess;
+ }
+
+ //---------------------------------------------------------------------
+ sal_Bool OControlTextEmphasisHandler::importXML( const ::rtl::OUString& _rStrImpValue, Any& _rValue, const SvXMLUnitConverter& ) const
+ {
+ sal_Bool bSuccess = sal_True;
+ sal_uInt16 nEmphasis = FontEmphasisMark::NONE;
+
+ sal_Bool bBelow = sal_False;
+ sal_Bool bHasPos = sal_False, bHasType = sal_False;
+
+ ::rtl::OUString sToken;
+ SvXMLTokenEnumerator aTokenEnum(_rStrImpValue);
+ while (aTokenEnum.getNextToken(sToken))
+ {
+ if (!bHasPos)
+ {
+ if (IsXMLToken(sToken, XML_ABOVE))
+ {
+ bBelow = sal_False;
+ bHasPos = sal_True;
+ }
+ else if (IsXMLToken(sToken, XML_BELOW))
+ {
+ bBelow = sal_True;
+ bHasPos = sal_True;
+ }
+ }
+ if (!bHasType)
+ {
+ if (SvXMLUnitConverter::convertEnum(nEmphasis, sToken, OEnumMapper::getEnumMap(OEnumMapper::epFontEmphasis)))
+ {
+ bHasType = sal_True;
+ }
+ else
+ {
+ bSuccess = sal_False;
+ break;
+ }
+ }
+ }
+
+ if (bSuccess)
+ {
+ nEmphasis |= bBelow ? FontEmphasisMark::BELOW : FontEmphasisMark::ABOVE;
+ _rValue <<= (sal_Int16)nEmphasis;
+ }
+
+ return bSuccess;
+ }
+
+ //=====================================================================
+ //= OControlBorderHandlerBase
+ //=====================================================================
+ //---------------------------------------------------------------------
+ OControlBorderHandler::OControlBorderHandler( const OControlBorderHandler::BorderFacet _eFacet )
+ :m_eFacet( _eFacet )
+ {
+ }
+
+ //---------------------------------------------------------------------
+ sal_Bool OControlBorderHandler::importXML( const ::rtl::OUString& _rStrImpValue, Any& _rValue, const SvXMLUnitConverter& ) const
+ {
+ ::rtl::OUString sToken;
+ SvXMLTokenEnumerator aTokens(_rStrImpValue);
+
+ sal_uInt16 nStyle = 1;
+ Color aColor;
+
+ while ( aTokens.getNextToken(sToken) // have a new token
+ && (0 != sToken.getLength()) // really have a new token
+ )
+ {
+ // try interpreting the token as border style
+ if ( m_eFacet == STYLE )
+ {
+ // is it a valid enum value?
+ if ( SvXMLUnitConverter::convertEnum( nStyle, sToken, OEnumMapper::getEnumMap( OEnumMapper::epBorderWidth ) ) )
+ {
+ _rValue <<= nStyle;
+ return sal_True;
+ }
+ }
+
+ // try interpreting it as color value
+ if ( m_eFacet == COLOR )
+ {
+ if ( SvXMLUnitConverter::convertColor( aColor, sToken ) )
+ {
+ _rValue <<= (sal_Int32)aColor.GetColor();
+ return sal_True;
+ }
+ }
+ }
+
+ return sal_False;
+ }
+
+ //---------------------------------------------------------------------
+ sal_Bool OControlBorderHandler::exportXML( ::rtl::OUString& _rStrExpValue, const Any& _rValue, const SvXMLUnitConverter& ) const
+ {
+ sal_Bool bSuccess = sal_False;
+
+ ::rtl::OUStringBuffer aOut;
+ switch ( m_eFacet )
+ {
+ case STYLE:
+ {
+ sal_Int16 nBorder = 0;
+ bSuccess = (_rValue >>= nBorder)
+ && SvXMLUnitConverter::convertEnum( aOut, nBorder, OEnumMapper::getEnumMap( OEnumMapper::epBorderWidth ) );
+ }
+ break;
+ case COLOR:
+ {
+ sal_Int32 nBorderColor = 0;
+ if ( _rValue >>= nBorderColor )
+ {
+ SvXMLUnitConverter::convertColor( aOut, Color( nBorderColor ) );
+ bSuccess = sal_True;
+ }
+ }
+ break;
+ } // switch ( m_eFacet )
+
+ if ( !bSuccess )
+ return sal_False;
+
+ if ( _rStrExpValue.getLength() )
+ _rStrExpValue += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " " ) );
+ _rStrExpValue += aOut.makeStringAndClear();
+
+ return sal_True;
+ }
+
+ //=====================================================================
+ //= OFontWidthHandler
+ //=====================================================================
+ //---------------------------------------------------------------------
+ OFontWidthHandler::OFontWidthHandler()
+ {
+ }
+
+ //---------------------------------------------------------------------
+ sal_Bool OFontWidthHandler::importXML( const ::rtl::OUString& _rStrImpValue, Any& _rValue, const SvXMLUnitConverter& ) const
+ {
+ sal_Int32 nWidth = 0;
+ sal_Bool bSuccess = SvXMLUnitConverter::convertMeasure(nWidth, _rStrImpValue, MAP_POINT);
+ if (bSuccess)
+ _rValue <<= (sal_Int16)nWidth;
+
+ return bSuccess;
+ }
+
+ //---------------------------------------------------------------------
+ sal_Bool OFontWidthHandler::exportXML( ::rtl::OUString& _rStrExpValue, const Any& _rValue, const SvXMLUnitConverter& ) const
+ {
+ sal_Int16 nWidth = 0;
+ ::rtl::OUStringBuffer aResult;
+ if (_rValue >>= nWidth)
+ SvXMLUnitConverter::convertMeasure(aResult, nWidth, MAP_POINT, MAP_POINT);
+ _rStrExpValue = aResult.makeStringAndClear();
+
+ return _rStrExpValue.getLength() != 0;
+ }
+
+ //=====================================================================
+ //= ORotationAngleHandler
+ //=====================================================================
+ //---------------------------------------------------------------------
+ ORotationAngleHandler::ORotationAngleHandler()
+ {
+ }
+
+ //---------------------------------------------------------------------
+ sal_Bool ORotationAngleHandler::importXML( const ::rtl::OUString& _rStrImpValue, Any& _rValue, const SvXMLUnitConverter& ) const
+ {
+ double fValue;
+ sal_Bool bSucces =
+ SvXMLUnitConverter::convertDouble(fValue, _rStrImpValue);
+ if (bSucces)
+ {
+ fValue *= 10;
+ _rValue <<= (float)fValue;
+ }
+
+ return bSucces;
+ }
+
+ //---------------------------------------------------------------------
+ sal_Bool ORotationAngleHandler::exportXML( ::rtl::OUString& _rStrExpValue, const Any& _rValue, const SvXMLUnitConverter& ) const
+ {
+ float fAngle = 0;
+ sal_Bool bSuccess = (_rValue >>= fAngle);
+
+ if (bSuccess)
+ {
+ rtl::OUStringBuffer sValue;
+ SvXMLUnitConverter::convertDouble(sValue, ((double)fAngle) / 10);
+ _rStrExpValue = sValue.makeStringAndClear();
+ }
+
+ return bSuccess;
+ }
+
+ //=====================================================================
+ //= ImageScaleModeHandler
+ //=====================================================================
+ //---------------------------------------------------------------------
+ ImageScaleModeHandler::ImageScaleModeHandler()
+ :XMLConstantsPropertyHandler( OEnumMapper::getEnumMap( OEnumMapper::epImageScaleMode ), XML_STRETCH )
+ {
+ }
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/controlpropertymap.cxx b/xmloff/source/forms/controlpropertymap.cxx
new file mode 100644
index 000000000000..abc9f60a14e4
--- /dev/null
+++ b/xmloff/source/forms/controlpropertymap.cxx
@@ -0,0 +1,156 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/maptype.hxx>
+#include <xmloff/xmltypes.hxx>
+#include <algorithm>
+#include "strings.hxx"
+#include <xmloff/contextid.hxx>
+#include "controlpropertymap.hxx"
+
+#include <string.h>
+
+using namespace ::xmloff::token;
+
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+#define MAP_ASCII( name, prefix, token, type, context ) { name, sizeof(name)-1, prefix, token, type|XML_TYPE_PROP_TEXT, context, SvtSaveOptions::ODFVER_010 }
+#define MAP_CONST( name, prefix, token, type, context ) { name.ascii, name.length, prefix, token, type|XML_TYPE_PROP_TEXT, context, SvtSaveOptions::ODFVER_010 }
+#define MAP_CONST_P( name, prefix, token, type, context ) { name.ascii, name.length, prefix, token, type|XML_TYPE_PROP_PARAGRAPH, context, SvtSaveOptions::ODFVER_010 }
+#define MAP_END() { NULL, 0, 0, XML_TOKEN_INVALID, 0, 0, SvtSaveOptions::ODFVER_010 }
+
+ XMLPropertyMapEntry* getControlStylePropertyMap_Access( )
+ {
+ static XMLPropertyMapEntry aControlStyleProperties[] =
+ {
+ MAP_CONST( PROPERTY_BACKGROUNDCOLOR, XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_COLOR, 0 ),
+ MAP_CONST_P( PROPERTY_ALIGN, XML_NAMESPACE_FO, XML_TEXT_ALIGN, XML_TYPE_TEXT_ALIGN, 0 ),
+ MAP_CONST( PROPERTY_BORDER, XML_NAMESPACE_FO, XML_BORDER, XML_TYPE_CONTROL_BORDER|MID_FLAG_MULTI_PROPERTY|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
+ MAP_ASCII( "FontCharWidth", XML_NAMESPACE_STYLE, XML_FONT_CHAR_WIDTH, XML_TYPE_NUMBER16, 0 ),
+ MAP_ASCII( "FontCharset", XML_NAMESPACE_STYLE, XML_FONT_CHARSET, XML_TYPE_TEXT_FONTENCODING, 0 ),
+ MAP_ASCII( "FontFamily", XML_NAMESPACE_STYLE, XML_FONT_FAMILY_GENERIC, XML_TYPE_TEXT_FONTFAMILY, 0 ),
+ MAP_ASCII( "FontHeight", XML_NAMESPACE_FO, XML_FONT_SIZE, XML_TYPE_CHAR_HEIGHT, 0 ),
+ MAP_ASCII( "FontKerning", XML_NAMESPACE_STYLE, XML_LETTER_KERNING, XML_TYPE_BOOL, 0 ),
+ MAP_ASCII( "FontName", XML_NAMESPACE_STYLE, XML_FONT_NAME, XML_TYPE_STRING, 0 ),
+ MAP_ASCII( "FontOrientation", XML_NAMESPACE_STYLE, XML_ROTATION_ANGLE, XML_TYPE_ROTATION_ANGLE, 0 ),
+ MAP_ASCII( "FontPitch", XML_NAMESPACE_STYLE, XML_FONT_PITCH, XML_TYPE_TEXT_FONTPITCH, 0 ),
+ MAP_ASCII( "FontSlant", XML_NAMESPACE_FO, XML_FONT_STYLE, XML_TYPE_TEXT_POSTURE, 0 ),
+
+ MAP_ASCII( "FontStrikeout", XML_NAMESPACE_STYLE, XML_TEXT_LINE_THROUGH_STYLE, XML_TYPE_TEXT_CROSSEDOUT_STYLE|MID_FLAG_MERGE_PROPERTY, 0),
+ MAP_ASCII( "FontStrikeout", XML_NAMESPACE_STYLE, XML_TEXT_LINE_THROUGH_TYPE, XML_TYPE_TEXT_CROSSEDOUT_TYPE|MID_FLAG_MERGE_PROPERTY, 0),
+ MAP_ASCII( "FontStrikeout", XML_NAMESPACE_STYLE, XML_TEXT_LINE_THROUGH_WIDTH, XML_TYPE_TEXT_CROSSEDOUT_WIDTH|MID_FLAG_MERGE_PROPERTY, 0),
+ MAP_ASCII( "FontStrikeout", XML_NAMESPACE_STYLE, XML_TEXT_LINE_THROUGH_TEXT, XML_TYPE_TEXT_CROSSEDOUT_TEXT|MID_FLAG_MERGE_PROPERTY, 0),
+
+ MAP_ASCII( "FontStyleName", XML_NAMESPACE_STYLE, XML_FONT_STYLE_NAME, XML_TYPE_STRING, 0 ),
+ MAP_ASCII( "FontUnderline", XML_NAMESPACE_STYLE, XML_TEXT_UNDERLINE_STYLE, XML_TYPE_TEXT_UNDERLINE_STYLE|MID_FLAG_MERGE_PROPERTY, 0 ),
+ MAP_ASCII( "FontUnderline", XML_NAMESPACE_STYLE, XML_TEXT_UNDERLINE_TYPE, XML_TYPE_TEXT_UNDERLINE_TYPE|MID_FLAG_MERGE_PROPERTY, 0 ),
+ MAP_ASCII( "FontUnderline", XML_NAMESPACE_STYLE, XML_TEXT_UNDERLINE_WIDTH, XML_TYPE_TEXT_UNDERLINE_WIDTH|MID_FLAG_MERGE_PROPERTY, 0 ),
+ MAP_ASCII( "FontWeight", XML_NAMESPACE_FO, XML_FONT_WEIGHT, XML_TYPE_TEXT_WEIGHT, 0 ),
+ MAP_ASCII( "FontWidth", XML_NAMESPACE_STYLE, XML_FONT_WIDTH, XML_TYPE_FONT_WIDTH, 0 ),
+ MAP_ASCII( "FontWordLineMode", XML_NAMESPACE_FO, XML_SCORE_SPACES, XML_TYPE_NBOOL, 0 ),
+ MAP_ASCII( "SymbolColor", XML_NAMESPACE_STYLE, XML_COLOR, XML_TYPE_COLOR, 0 ),
+ MAP_ASCII( "BorderColor", XML_NAMESPACE_FO, XML_BORDER, XML_TYPE_CONTROL_BORDER_COLOR|MID_FLAG_MULTI_PROPERTY|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
+ MAP_ASCII( "TextColor", XML_NAMESPACE_FO, XML_COLOR, XML_TYPE_COLOR, 0 ),
+ MAP_CONST( PROPERTY_FORMATKEY, XML_NAMESPACE_STYLE, XML_DATA_STYLE_NAME, XML_TYPE_STRING | MID_FLAG_NO_PROPERTY_EXPORT | MID_FLAG_SPECIAL_ITEM, CTF_FORMS_DATA_STYLE ),
+ MAP_ASCII( "FontEmphasisMark", XML_NAMESPACE_STYLE, XML_TEXT_EMPHASIZE, XML_TYPE_CONTROL_TEXT_EMPHASIZE, 0 ),
+ MAP_ASCII( "FontRelief", XML_NAMESPACE_STYLE, XML_FONT_RELIEF, XML_TYPE_TEXT_FONT_RELIEF|MID_FLAG_MULTI_PROPERTY, 0 ),
+ MAP_ASCII( "TextLineColor", XML_NAMESPACE_STYLE, XML_TEXT_UNDERLINE_COLOR, XML_TYPE_TEXT_UNDERLINE_COLOR|MID_FLAG_MULTI_PROPERTY, 0 ),
+ MAP_END()
+ };
+
+ return aControlStyleProperties;
+ }
+
+ const XMLPropertyMapEntry* getControlStylePropertyMap( )
+ {
+ return getControlStylePropertyMap_Access();
+ }
+
+ //=====================================================================
+ //---------------------------------------------------------------------
+ struct XMLPropertyMapEntryLess
+ {
+ sal_Bool operator()(const XMLPropertyMapEntry& _rLeft, const XMLPropertyMapEntry& _rRight)
+ {
+ return strcmp(_rLeft.msApiName, _rRight.msApiName) < 0;
+ }
+ };
+
+ //---------------------------------------------------------------------
+ void implSortMap(XMLPropertyMapEntry* _pMap)
+ {
+ XMLPropertyMapEntry* pEnd;
+ // determine the last element
+ for ( pEnd = _pMap; pEnd->msApiName; ++pEnd)
+ ;
+ ::std::sort(_pMap, pEnd, XMLPropertyMapEntryLess());
+ }
+
+ //---------------------------------------------------------------------
+ void initializePropertyMaps()
+ {
+ static sal_Bool bSorted = sal_False;
+ if (!bSorted)
+ {
+ implSortMap(getControlStylePropertyMap_Access());
+ bSorted = sal_True;
+ }
+ }
+
+ //=====================================================================
+ //= OFormComponentStyleExportMapper
+ //=====================================================================
+ //---------------------------------------------------------------------
+ OFormComponentStyleExportMapper::OFormComponentStyleExportMapper( const UniReference< XMLPropertySetMapper >& _rMapper )
+ :SvXMLExportPropertyMapper( _rMapper )
+ {
+ }
+
+ //---------------------------------------------------------------------
+ void OFormComponentStyleExportMapper::handleSpecialItem( SvXMLAttributeList& _rAttrList, const XMLPropertyState& _rProperty, const SvXMLUnitConverter& _rUnitConverter,
+ const SvXMLNamespaceMap& _rNamespaceMap, const ::std::vector< XMLPropertyState >* _pProperties,
+ sal_uInt32 _nIdx ) const
+ {
+ // ignore the number style of grid columns - this is formatted elsewhere
+ if ( CTF_FORMS_DATA_STYLE != getPropertySetMapper()->GetEntryContextId( _rProperty.mnIndex ) )
+ SvXMLExportPropertyMapper::handleSpecialItem( _rAttrList, _rProperty, _rUnitConverter, _rNamespaceMap, _pProperties, _nIdx );
+ }
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/controlpropertymap.hxx b/xmloff/source/forms/controlpropertymap.hxx
new file mode 100644
index 000000000000..16975e2560bd
--- /dev/null
+++ b/xmloff/source/forms/controlpropertymap.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_FORMS_CONTROLPROPERTYMAP_HXX_
+#define _XMLOFF_FORMS_CONTROLPROPERTYMAP_HXX_
+
+#include <xmloff/xmlprmap.hxx>
+#include <xmloff/xmlexppr.hxx>
+
+struct XMLPropertyMapEntry;
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ const XMLPropertyMapEntry* getControlStylePropertyMap( );
+
+ void initializePropertyMaps();
+
+ //=====================================================================
+ //= OFormComponentStyleExportMapper
+ //=====================================================================
+ class OFormComponentStyleExportMapper : public SvXMLExportPropertyMapper
+ {
+ public:
+ OFormComponentStyleExportMapper( const UniReference< XMLPropertySetMapper >& _rMapper );
+
+ void handleSpecialItem(
+ SvXMLAttributeList& _rAttrList,
+ const XMLPropertyState& _rProperty,
+ const SvXMLUnitConverter& _rUnitConverter,
+ const SvXMLNamespaceMap& _rNamespaceMap,
+ const ::std::vector< XMLPropertyState >* _pProperties,
+ sal_uInt32 _nIdx
+ ) const;
+ };
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+#endif // _XMLOFF_FORMS_CONTROLPROPERTYMAP_HXX_
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/elementexport.cxx b/xmloff/source/forms/elementexport.cxx
new file mode 100644
index 000000000000..ca97ad0d6d47
--- /dev/null
+++ b/xmloff/source/forms/elementexport.cxx
@@ -0,0 +1,2298 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "elementexport.hxx"
+#include "strings.hxx"
+#include "xmloff/xmlnmspe.hxx"
+#include "eventexport.hxx"
+#include "formenums.hxx"
+#include "formcellbinding.hxx"
+#include "formcellbinding.hxx"
+#include "xmloff/xformsexport.hxx"
+#include "property_meta_data.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/io/XPersistObject.hpp>
+#include <com/sun/star/form/FormComponentType.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/form/FormSubmitEncoding.hpp>
+#include <com/sun/star/form/FormSubmitMethod.hpp>
+#include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/form/NavigationBarMode.hpp>
+#include <com/sun/star/form/TabulatorCycle.hpp>
+#include <com/sun/star/form/FormButtonType.hpp>
+#include <com/sun/star/awt/ScrollBarOrientation.hpp>
+#include <com/sun/star/awt/VisualEffect.hpp>
+#include <com/sun/star/form/ListSourceType.hpp>
+#include <com/sun/star/awt/ImagePosition.hpp>
+/** === end UNO includes === **/
+
+#include <tools/wintypes.hxx> // for check states
+#include <xmloff/txtprmap.hxx>
+#include <com/sun/star/form/binding/XBindableValue.hpp>
+#include <com/sun/star/form/binding/XListEntrySink.hpp>
+#include <tools/urlobj.hxx>
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/XMLEventExport.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <tools/time.hxx>
+#include <tools/diagnose_ex.h>
+#include <comphelper/extract.hxx>
+#include <sal/macros.h>
+
+#include <stdio.h>
+#include <algorithm>
+
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ #if OSL_DEBUG_LEVEL > 0
+ #define RESET_BIT( bitfield, bit ) \
+ bitfield = bitfield & ~bit
+ #else
+ #define RESET_BIT( bitfield, bit )
+ #endif
+
+ using namespace ::xmloff::token;
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::sdb;
+ using namespace ::com::sun::star::awt;
+ using namespace ::com::sun::star::form;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::beans;
+ using namespace ::com::sun::star::container;
+ using namespace ::com::sun::star::script;
+ using namespace ::com::sun::star::io;
+ using namespace ::com::sun::star::table;
+ using namespace ::com::sun::star::text;
+ using namespace ::com::sun::star::form::binding;
+
+ //=====================================================================
+ //= OElementExport
+ //=====================================================================
+ OElementExport::OElementExport(IFormsExportContext& _rContext, const Reference< XPropertySet >& _rxProps,
+ const Sequence< ScriptEventDescriptor >& _rEvents)
+ :OPropertyExport(_rContext, _rxProps)
+ ,m_aEvents(_rEvents)
+ ,m_pXMLElement(NULL)
+ {
+ }
+
+ //---------------------------------------------------------------------
+ OElementExport::~OElementExport()
+ {
+ implEndElement();
+ }
+
+ //---------------------------------------------------------------------
+ void OElementExport::doExport()
+ {
+ // collect some general information about the element
+ examine();
+
+ // first add the attributes necessary for the element
+ m_rContext.getGlobalContext().ClearAttrList();
+
+ // add the attributes
+ exportAttributes();
+
+ // start the XML element
+ implStartElement(getXMLElementName());
+
+ // the sub elements (mostly control type dependent)
+ exportSubTags();
+
+ implEndElement();
+ }
+
+ //---------------------------------------------------------------------
+ void OElementExport::examine()
+ {
+ // nothing to do here
+ }
+
+ //---------------------------------------------------------------------
+ void OElementExport::exportAttributes()
+ {
+ // nothing to do here
+ }
+
+ //---------------------------------------------------------------------
+ void OElementExport::exportSubTags()
+ {
+ // the properties which where not exported 'til now
+ exportRemainingProperties();
+
+ // the script:events sub tags
+ exportEvents();
+ }
+
+ //---------------------------------------------------------------------
+ void OElementExport::implStartElement(const sal_Char* _pName)
+ {
+ m_pXMLElement = new SvXMLElementExport(m_rContext.getGlobalContext(), XML_NAMESPACE_FORM, _pName, sal_True, sal_True);
+ }
+
+ //---------------------------------------------------------------------
+ void OElementExport::implEndElement()
+ {
+ delete m_pXMLElement;
+ m_pXMLElement = NULL;
+ }
+
+ //---------------------------------------------------------------------
+ void OElementExport::exportServiceNameAttribute()
+ {
+ Reference< XPersistObject > xPersistence(m_xProps, UNO_QUERY);
+ if (!xPersistence.is())
+ {
+ OSL_FAIL("OElementExport::exportServiceNameAttribute: no XPersistObject!");
+ return;
+ }
+
+ ::rtl::OUString sServiceName = xPersistence->getServiceName();
+ // we don't want to write the old service name directly: it's a name used for compatibility reasons, but
+ // as we start some kind of new file format here (with this xml export), we don't care about
+ // compatibility ...
+ // So we translate the old persistence service name into new ones, if possible
+
+ ::rtl::OUString sToWriteServiceName = sServiceName;
+#define CHECK_N_TRANSLATE( name ) \
+ else if (0 == sServiceName.compareToAscii(SERVICE_PERSISTENT_COMPONENT_##name)) \
+ sToWriteServiceName = SERVICE_##name
+
+ if (sal_False)
+ ;
+ CHECK_N_TRANSLATE( FORM );
+ CHECK_N_TRANSLATE( FORM );
+ CHECK_N_TRANSLATE( LISTBOX );
+ CHECK_N_TRANSLATE( COMBOBOX );
+ CHECK_N_TRANSLATE( RADIOBUTTON );
+ CHECK_N_TRANSLATE( GROUPBOX );
+ CHECK_N_TRANSLATE( FIXEDTEXT );
+ CHECK_N_TRANSLATE( COMMANDBUTTON );
+ CHECK_N_TRANSLATE( CHECKBOX );
+ CHECK_N_TRANSLATE( GRID );
+ CHECK_N_TRANSLATE( IMAGEBUTTON );
+ CHECK_N_TRANSLATE( FILECONTROL );
+ CHECK_N_TRANSLATE( TIMEFIELD );
+ CHECK_N_TRANSLATE( DATEFIELD );
+ CHECK_N_TRANSLATE( NUMERICFIELD );
+ CHECK_N_TRANSLATE( CURRENCYFIELD );
+ CHECK_N_TRANSLATE( PATTERNFIELD );
+ CHECK_N_TRANSLATE( HIDDENCONTROL );
+ CHECK_N_TRANSLATE( IMAGECONTROL );
+ CHECK_N_TRANSLATE( FORMATTEDFIELD );
+ else if (0 == sServiceName.compareToAscii(SERVICE_PERSISTENT_COMPONENT_EDIT))
+ { // special handling for the edit field: we have two controls using this as persistence service name
+ sToWriteServiceName = SERVICE_EDIT;
+ Reference< XServiceInfo > xSI(m_xProps, UNO_QUERY);
+ if (xSI.is() && xSI->supportsService(SERVICE_FORMATTEDFIELD))
+ sToWriteServiceName = SERVICE_FORMATTEDFIELD;
+ }
+#if OSL_DEBUG_LEVEL > 0
+ Reference< XServiceInfo > xSI(m_xProps, UNO_QUERY);
+ OSL_ENSURE(xSI.is() && xSI->supportsService(sToWriteServiceName),
+ "OElementExport::exportServiceNameAttribute: wrong service name translation!");
+
+#endif
+ sToWriteServiceName =
+ m_rContext.getGlobalContext().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_OOO, sToWriteServiceName );
+
+ // now write this
+ AddAttribute(
+ OAttributeMetaData::getCommonControlAttributeNamespace(CCA_SERVICE_NAME),
+ OAttributeMetaData::getCommonControlAttributeName(CCA_SERVICE_NAME),
+ sToWriteServiceName);
+ }
+
+ //---------------------------------------------------------------------
+ void OElementExport::exportEvents()
+ {
+ if (!m_aEvents.getLength())
+ // nothing to do
+ return;
+
+ Reference< XNameReplace > xWrapper = new OEventDescriptorMapper(m_aEvents);
+ m_rContext.getGlobalContext().GetEventExport().Export(xWrapper);
+ }
+
+ //=====================================================================
+ //= OControlExport
+ //=====================================================================
+ //---------------------------------------------------------------------
+ OControlExport::OControlExport(IFormsExportContext& _rContext, const Reference< XPropertySet >& _rxControl,
+ const ::rtl::OUString& _rControlId, const ::rtl::OUString& _rReferringControls,
+ const Sequence< ScriptEventDescriptor >& _rEvents)
+ :OElementExport(_rContext, _rxControl, _rEvents)
+ ,m_sControlId(_rControlId)
+ ,m_sReferringControls(_rReferringControls)
+ ,m_nClassId(FormComponentType::CONTROL)
+ ,m_eType( UNKNOWN )
+ ,m_nIncludeCommon(0)
+ ,m_nIncludeDatabase(0)
+ ,m_nIncludeSpecial(0)
+ ,m_nIncludeEvents(0)
+ ,m_nIncludeBindings(0)
+ ,m_pOuterElement(NULL)
+ {
+ OSL_ENSURE(m_xProps.is(), "OControlExport::OControlExport: invalid arguments!");
+ }
+
+ //---------------------------------------------------------------------
+ OControlExport::~OControlExport()
+ {
+ implEndElement();
+ }
+
+ //---------------------------------------------------------------------
+ void OControlExport::exportOuterAttributes()
+ {
+ // the control id
+ if (CCA_NAME & m_nIncludeCommon)
+ {
+ exportStringPropertyAttribute(
+ OAttributeMetaData::getCommonControlAttributeNamespace(CCA_NAME),
+ OAttributeMetaData::getCommonControlAttributeName(CCA_NAME),
+ PROPERTY_NAME
+ );
+ #if OSL_DEBUG_LEVEL > 0
+ // reset the bit for later checking
+ m_nIncludeCommon = m_nIncludeCommon & ~CCA_NAME;
+ #endif
+ }
+
+ // the service name
+ if (m_nIncludeCommon & CCA_SERVICE_NAME)
+ {
+ exportServiceNameAttribute();
+ #if OSL_DEBUG_LEVEL > 0
+ // reset the bit for later checking
+ m_nIncludeCommon = m_nIncludeCommon & ~CCA_SERVICE_NAME;
+ #endif
+ }
+ }
+
+ //---------------------------------------------------------------------
+ void OControlExport::exportInnerAttributes()
+ {
+ // the control id
+ if (CCA_CONTROL_ID & m_nIncludeCommon)
+ {
+ OSL_ENSURE(m_sControlId.getLength(), "OControlExport::exportInnerAttributes: have no control id for the control!");
+ m_rContext.getGlobalContext().AddAttributeIdLegacy(
+ XML_NAMESPACE_FORM, m_sControlId);
+ #if OSL_DEBUG_LEVEL > 0
+ // reset the bit for later checking
+ m_nIncludeCommon = m_nIncludeCommon & ~CCA_CONTROL_ID;
+ #endif
+ }
+
+ // "new-style" properties ...
+ exportGenericHandlerAttributes();
+
+ // common control attributes
+ exportCommonControlAttributes();
+
+ // common database attributes
+ exportDatabaseAttributes();
+
+ // attributes related to external bindings
+ exportBindingAtributes();
+
+ // attributes special to the respective control type
+ exportSpecialAttributes();
+
+ // add the style references to the attributes
+ flagStyleProperties();
+ }
+
+ //---------------------------------------------------------------------
+ void OControlExport::exportAttributes()
+ {
+ exportOuterAttributes();
+ }
+
+ //---------------------------------------------------------------------
+ void OControlExport::exportSubTags() throw (Exception)
+ {
+ // for the upcoming exportRemainingProperties:
+ // if a control has the LabelControl property, this is not stored with the control itself, but instead with
+ // the control which is referenced by this property. As the base class' exportRemainingProperties doesn't
+ // know anything about this, we need to prevent that it tries to export this property
+ exportedProperty(PROPERTY_CONTROLLABEL);
+
+ // if it's a control supporting XText, then we need to declare all text-related properties
+ // as "already exported". This prevents them from being exported as generic "form:property"-tags.
+ // *If* we would export them this way, they would be completely superfluous, and sometimes even
+ // disastrous, since they may, at import time, override paragraph properties which already have
+ // been set before
+ Reference< XText > xControlText( m_xProps, UNO_QUERY );
+ if ( xControlText.is() )
+ {
+ const XMLPropertyMapEntry* pCharAttributeProperties = XMLTextPropertySetMapper::getPropertyMapForType( TEXT_PROP_MAP_TEXT );
+ while ( pCharAttributeProperties->msApiName )
+ {
+ exportedProperty( ::rtl::OUString::createFromAscii( pCharAttributeProperties->msApiName ) );
+ ++pCharAttributeProperties;
+ }
+
+ const XMLPropertyMapEntry* pParaAttributeProperties = XMLTextPropertySetMapper::getPropertyMapForType( TEXT_PROP_MAP_SHAPE_PARA );
+ while ( pParaAttributeProperties->msApiName )
+ {
+ exportedProperty( ::rtl::OUString::createFromAscii( pParaAttributeProperties->msApiName ) );
+ ++pParaAttributeProperties;
+ }
+
+ // the RichText property is not exported. The presence of the text:p element
+ // will be used - upon reading - as indicator for the value of the RichText property
+ exportedProperty( PROPERTY_RICH_TEXT );
+
+ // strange thing: paragraphs support both a CharStrikeout and a CharCrossedOut property
+ // The former is a short/enum value, the latter a boolean. The former has a real meaning
+ // (the strikeout type), the latter hasn't. But, when the CharCrossedOut is exported and
+ // later on imported, it overwrites anything which has previously been imported for
+ // CharStrikeout.
+ // #i27729#
+ exportedProperty( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharCrossedOut" ) ) );
+ }
+
+ if ( m_eType == LISTBOX )
+ {
+ // will be exported in exportListSourceAsElements:
+ if ( controlHasUserSuppliedListEntries() )
+ exportedProperty( PROPERTY_DEFAULT_SELECT_SEQ );
+
+ // will not be exported in a generic way. Either exportListSourceAsElements cares
+ // for them, or we don't need them
+ exportedProperty( PROPERTY_STRING_ITEM_LIST );
+ exportedProperty( PROPERTY_VALUE_SEQ );
+ exportedProperty( PROPERTY_SELECT_SEQ );
+ exportedProperty( PROPERTY_LISTSOURCE );
+ }
+ if ( m_eType == COMBOBOX )
+ exportedProperty( PROPERTY_STRING_ITEM_LIST );
+
+ // let the base class export the remaining properties and the events
+ OElementExport::exportSubTags();
+
+ // special sub tags for some controls
+ switch (m_eType)
+ {
+ case LISTBOX:
+ // don't export the list entries if the are not provided by the user, but obtained implicitly
+ // from other sources
+ // #i26944#
+ if ( controlHasUserSuppliedListEntries() )
+ exportListSourceAsElements();
+ break;
+ case GRID:
+ { // a grid control requires us to store all columns as sub elements
+ Reference< XIndexAccess > xColumnContainer(m_xProps, UNO_QUERY);
+ OSL_ENSURE(xColumnContainer.is(), "OControlExport::exportSubTags: a grid control which is no IndexAccess?!!");
+ if (xColumnContainer.is())
+ m_rContext.exportCollectionElements(xColumnContainer);
+ }
+ break;
+ case COMBOBOX:
+ { // a combox box description has sub elements: the items
+ DBG_CHECK_PROPERTY( PROPERTY_STRING_ITEM_LIST, Sequence< ::rtl::OUString > );
+
+ // don't export the list entries if the are not provided by the user, but obtained implicitly
+ // from other sources
+ // #i26944#
+ if ( controlHasUserSuppliedListEntries() )
+ {
+ // get the item list
+ Sequence< ::rtl::OUString > aListItems;
+ m_xProps->getPropertyValue(PROPERTY_STRING_ITEM_LIST) >>= aListItems;
+ // loop through it and write the sub elements
+ const ::rtl::OUString* pListItems = aListItems.getConstArray();
+ for (sal_Int32 i=0; i<aListItems.getLength(); ++i, ++pListItems)
+ {
+ m_rContext.getGlobalContext().ClearAttrList();
+ AddAttribute(
+ OAttributeMetaData::getCommonControlAttributeNamespace(CCA_LABEL),
+ OAttributeMetaData::getCommonControlAttributeName(CCA_LABEL),
+ *pListItems);
+ SvXMLElementExport aFormElement(m_rContext.getGlobalContext(), XML_NAMESPACE_FORM, "item", sal_True, sal_True);
+ }
+ }
+ }
+ break;
+
+ case TEXT_AREA:
+ {
+ // if we act as rich text control, we need to export some text:p elements
+ if ( xControlText.is() )
+ {
+ sal_Bool bActingAsRichText = sal_False;
+ if ( m_xPropertyInfo->hasPropertyByName( PROPERTY_RICH_TEXT ) )
+ {
+ OSL_VERIFY(m_xProps->getPropertyValue( PROPERTY_RICH_TEXT ) >>= bActingAsRichText );
+ }
+
+ if ( bActingAsRichText )
+ m_rContext.getGlobalContext().GetTextParagraphExport()->exportText( xControlText );
+ }
+ }
+ break;
+ default:
+ // nothing do to
+ break;
+ }
+ }
+
+ //---------------------------------------------------------------------
+ void OControlExport::exportGenericHandlerAttributes()
+ {
+ const Sequence< Property > aProperties = m_xPropertyInfo->getProperties();
+ for ( const Property* prop = aProperties.getConstArray();
+ prop != aProperties.getConstArray() + aProperties.getLength();
+ ++prop
+ )
+ {
+ try
+ {
+ // see if this property can already be handled with an IPropertyHandler (which, on the long
+ // term, should be the case for most, if not all, properties)
+ const PropertyDescription* propDescription = metadata::getPropertyDescription( prop->Name );
+ if ( propDescription == NULL )
+ continue;
+
+ // let the factory provide the concrete handler. Note that caching, if desired, is the task
+ // of the factory
+ PPropertyHandler handler = (*propDescription->factory)( propDescription->propertyId );
+ ENSURE_OR_CONTINUE( handler.get() != NULL,
+ "OControlExport::exportGenericHandlerAttributes: invalid property handler provided by the factory!" );
+
+ ::rtl::OUString attributeValue;
+ if ( propDescription->propertyGroup == NO_GROUP )
+ {
+ // that's a property which has a direct mapping to an attribute
+ if ( !shouldExportProperty( prop->Name ) )
+ // TODO: in the future, we surely need a more sophisticated approach to this, involving the property
+ // handler, or the property description
+ {
+ exportedProperty( prop->Name );
+ continue;
+ }
+
+ const Any propValue = m_xProps->getPropertyValue( prop->Name );
+ attributeValue = handler->getAttributeValue( propValue );
+ }
+ else
+ {
+ // that's a property which is part of a group of properties, whose values, in their entity, comprise
+ // a single attribute value
+
+ // retrieve the descriptions of all other properties which add to the attribute value
+ PropertyDescriptionList descriptions;
+ metadata::getPropertyGroup( propDescription->propertyGroup, descriptions );
+
+ // retrieve the values for all those properties
+ PropertyValues aValues;
+ for ( PropertyDescriptionList::iterator desc = descriptions.begin();
+ desc != descriptions.end();
+ ++desc
+ )
+ {
+ // TODO: XMultiPropertySet?
+ const Any propValue = m_xProps->getPropertyValue( (*desc)->propertyName );
+ aValues[ (*desc)->propertyId ] = propValue;
+ }
+
+ // let the handler translate into an XML attribute value
+ attributeValue = handler->getAttributeValue( aValues );
+ }
+
+ AddAttribute(
+ propDescription->attribute.namespacePrefix,
+ token::GetXMLToken( propDescription->attribute.attributeToken ),
+ attributeValue
+ );
+
+ exportedProperty( prop->Name );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ }
+
+ //---------------------------------------------------------------------
+ void OControlExport::exportCommonControlAttributes()
+ {
+ size_t i=0;
+
+ // I decided to handle all the properties here with some static arrays describing the property-attribute
+ // relations. This leads to somewhat ugly code :), but the only alternative I can think of right now
+ // would require maps and O(log n) searches, which seems somewhat expensive as this code is used
+ // very frequently.
+
+ // the extra indents for the respective blocks are to ensure that there is no copy'n'paste error, using
+ // map identifiers from the wrong block
+
+ // --------------------------------------------------------------------
+ // some string properties
+ {
+ // the attribute ids of all properties which are expected to be of type string
+ static sal_Int32 nStringPropertyAttributeIds[] =
+ {
+ CCA_LABEL, CCA_TITLE
+ };
+ // the names of all properties which are expected to be of type string
+ static ::rtl::OUString aStringPropertyNames[] =
+ {
+ PROPERTY_LABEL, PROPERTY_TITLE
+ };
+ OSL_ENSURE( SAL_N_ELEMENTS(aStringPropertyNames) == SAL_N_ELEMENTS(nStringPropertyAttributeIds),
+ "OControlExport::exportCommonControlAttributes: somebody tampered with the maps (1)!");
+
+ for (i=0; i < SAL_N_ELEMENTS(nStringPropertyAttributeIds); ++i)
+ if (nStringPropertyAttributeIds[i] & m_nIncludeCommon)
+ {
+ exportStringPropertyAttribute(
+ OAttributeMetaData::getCommonControlAttributeNamespace(nStringPropertyAttributeIds[i]),
+ OAttributeMetaData::getCommonControlAttributeName(nStringPropertyAttributeIds[i]),
+ aStringPropertyNames[i]
+ );
+ #if OSL_DEBUG_LEVEL > 0
+ // reset the bit for later checking
+ m_nIncludeCommon = m_nIncludeCommon & ~nStringPropertyAttributeIds[i];
+ #endif
+ }
+ }
+
+ // --------------------------------------------------------------------
+ // some boolean properties
+ {
+ static sal_Int32 nBooleanPropertyAttributeIds[] =
+ { // attribute flags
+ CCA_CURRENT_SELECTED, CCA_DISABLED, CCA_DROPDOWN, CCA_PRINTABLE, CCA_READONLY, CCA_SELECTED, CCA_TAB_STOP, CCA_ENABLEVISIBLE
+ };
+ static const ::rtl::OUString* pBooleanPropertyNames[] =
+ { // property names
+ &PROPERTY_STATE, &PROPERTY_ENABLED, &PROPERTY_DROPDOWN, &PROPERTY_PRINTABLE, &PROPERTY_READONLY, &PROPERTY_DEFAULT_STATE, &PROPERTY_TABSTOP, &PROPERTY_ENABLEVISIBLE
+ };
+ static sal_Bool nBooleanPropertyAttrFlags[] =
+ { // attribute defaults
+ BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_FALSE | BOOLATTR_INVERSE_SEMANTICS, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_VOID, BOOLATTR_DEFAULT_FALSE
+ };
+ #if OSL_DEBUG_LEVEL > 0
+ sal_Int32 nIdCount = SAL_N_ELEMENTS(nBooleanPropertyAttributeIds);
+ sal_Int32 nNameCount = SAL_N_ELEMENTS(pBooleanPropertyNames);
+ sal_Int32 nFlagsCount = SAL_N_ELEMENTS(nBooleanPropertyAttrFlags);
+ OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nFlagsCount),
+ "OControlExport::exportCommonControlAttributes: somebody tampered with the maps (2)!");
+ #endif
+ for (i=0; i < SAL_N_ELEMENTS(nBooleanPropertyAttributeIds); ++i)
+ if (nBooleanPropertyAttributeIds[i] & m_nIncludeCommon)
+ {
+ exportBooleanPropertyAttribute(
+ OAttributeMetaData::getCommonControlAttributeNamespace(nBooleanPropertyAttributeIds[i]),
+ OAttributeMetaData::getCommonControlAttributeName(nBooleanPropertyAttributeIds[i]),
+ *(pBooleanPropertyNames[i]),
+ nBooleanPropertyAttrFlags[i]);
+ #if OSL_DEBUG_LEVEL > 0
+ // reset the bit for later checking
+ m_nIncludeCommon = m_nIncludeCommon & ~nBooleanPropertyAttributeIds[i];
+ #endif
+ }
+ }
+
+
+ // --------------------------------------------------------------------
+ // some integer properties
+ {
+ // now the common handling
+ static sal_Int32 nIntegerPropertyAttributeIds[] =
+ { // attribute flags
+ CCA_SIZE, CCA_TAB_INDEX
+ };
+ static const ::rtl::OUString* pIntegerPropertyNames[] =
+ { // property names
+ &PROPERTY_LINECOUNT, &PROPERTY_TABINDEX
+ };
+ static const sal_Int16 nIntegerPropertyAttrDefaults[] =
+ { // attribute defaults
+ 5, 0
+ };
+
+ if ( m_nIncludeCommon & CCA_MAX_LENGTH )
+ exportedProperty(PROPERTY_MAXTEXTLENGTH);
+
+ #if OSL_DEBUG_LEVEL > 0
+ sal_Int32 nIdCount = SAL_N_ELEMENTS(nIntegerPropertyAttributeIds);
+ sal_Int32 nNameCount = SAL_N_ELEMENTS(pIntegerPropertyNames);
+ sal_Int32 nDefaultCount = SAL_N_ELEMENTS(nIntegerPropertyAttrDefaults);
+ OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nDefaultCount),
+ "OControlExport::exportCommonControlAttributes: somebody tampered with the maps (3)!");
+ #endif
+ for (i=0; i < SAL_N_ELEMENTS(nIntegerPropertyAttributeIds); ++i)
+ if (nIntegerPropertyAttributeIds[i] & m_nIncludeCommon)
+ {
+ exportInt16PropertyAttribute(
+ OAttributeMetaData::getCommonControlAttributeNamespace(nIntegerPropertyAttributeIds[i]),
+ OAttributeMetaData::getCommonControlAttributeName(nIntegerPropertyAttributeIds[i]),
+ *(pIntegerPropertyNames[i]),
+ nIntegerPropertyAttrDefaults[i]);
+ #if OSL_DEBUG_LEVEL > 0
+ // reset the bit for later checking
+ m_nIncludeCommon = m_nIncludeCommon & ~nIntegerPropertyAttributeIds[i];
+ #endif
+ }
+
+
+ }
+
+ // --------------------------------------------------------------------
+ // some enum properties
+ {
+ if (m_nIncludeCommon & CCA_BUTTON_TYPE)
+ {
+ exportEnumPropertyAttribute(
+ OAttributeMetaData::getCommonControlAttributeNamespace(CCA_BUTTON_TYPE),
+ OAttributeMetaData::getCommonControlAttributeName(CCA_BUTTON_TYPE),
+ PROPERTY_BUTTONTYPE,
+ OEnumMapper::getEnumMap(OEnumMapper::epButtonType),
+ FormButtonType_PUSH);
+ #if OSL_DEBUG_LEVEL > 0
+ // reset the bit for later checking
+ m_nIncludeCommon = m_nIncludeCommon & ~CCA_BUTTON_TYPE;
+ #endif
+ }
+ if ( m_nIncludeCommon & CCA_ORIENTATION )
+ {
+ exportEnumPropertyAttribute(
+ OAttributeMetaData::getCommonControlAttributeNamespace( CCA_ORIENTATION ),
+ OAttributeMetaData::getCommonControlAttributeName( CCA_ORIENTATION ),
+ PROPERTY_ORIENTATION,
+ OEnumMapper::getEnumMap( OEnumMapper::epOrientation ),
+ ScrollBarOrientation::HORIZONTAL
+ );
+ #if OSL_DEBUG_LEVEL > 0
+ // reset the bit for later checking
+ m_nIncludeCommon = m_nIncludeCommon & ~CCA_ORIENTATION;
+ #endif
+ }
+
+ if ( m_nIncludeCommon & CCA_VISUAL_EFFECT )
+ {
+ exportEnumPropertyAttribute(
+ OAttributeMetaData::getCommonControlAttributeNamespace( CCA_VISUAL_EFFECT ),
+ OAttributeMetaData::getCommonControlAttributeName( CCA_VISUAL_EFFECT ),
+ PROPERTY_VISUAL_EFFECT,
+ OEnumMapper::getEnumMap( OEnumMapper::epVisualEffect ),
+ VisualEffect::LOOK3D
+ );
+ #if OSL_DEBUG_LEVEL > 0
+ // reset the bit for later checking
+ m_nIncludeCommon = m_nIncludeCommon & ~CCA_VISUAL_EFFECT;
+ #endif
+ }
+ }
+
+ // --------------------------------------------------------------------
+ // some properties which require a special handling
+
+ // the target frame
+ if (m_nIncludeCommon & CCA_TARGET_FRAME)
+ {
+ exportTargetFrameAttribute();
+ #if OSL_DEBUG_LEVEL > 0
+ // reset the bit for later checking
+ m_nIncludeCommon = m_nIncludeCommon & ~CCA_TARGET_FRAME;
+ #endif
+ }
+
+ // max text length
+ if ( m_nIncludeCommon & CCA_MAX_LENGTH )
+ {
+ // normally, the respective property would be "MaxTextLen"
+ // However, if the model has a property "PersistenceMaxTextLength", then we prefer this
+
+ // determine the name of the property to export
+ ::rtl::OUString sTextLenPropertyName( PROPERTY_MAXTEXTLENGTH );
+ if ( m_xPropertyInfo->hasPropertyByName( PROPERTY_PERSISTENCE_MAXTEXTLENGTH ) )
+ sTextLenPropertyName = PROPERTY_PERSISTENCE_MAXTEXTLENGTH;
+
+ // export it
+ exportInt16PropertyAttribute(
+ OAttributeMetaData::getCommonControlAttributeNamespace( CCA_MAX_LENGTH ),
+ OAttributeMetaData::getCommonControlAttributeName( CCA_MAX_LENGTH ),
+ sTextLenPropertyName,
+ 0
+ );
+
+ // in either way, both properties count as "exported"
+ exportedProperty( PROPERTY_MAXTEXTLENGTH );
+ exportedProperty( PROPERTY_PERSISTENCE_MAXTEXTLENGTH );
+
+ #if OSL_DEBUG_LEVEL > 0
+ // reset the bit for later checking
+ m_nIncludeCommon = m_nIncludeCommon & ~CCA_MAX_LENGTH;
+ #endif
+ }
+
+ if (m_nIncludeCommon & CCA_TARGET_LOCATION)
+ {
+ exportTargetLocationAttribute(false);
+ #if OSL_DEBUG_LEVEL > 0
+ // reset the bit for later checking
+ m_nIncludeCommon = m_nIncludeCommon & ~CCA_TARGET_LOCATION;
+ #endif
+ }
+
+ // OJ #99721#
+ if (m_nIncludeCommon & CCA_IMAGE_DATA)
+ {
+ exportImageDataAttribute();
+ #if OSL_DEBUG_LEVEL > 0
+ // reset the bit for later checking
+ m_nIncludeCommon = m_nIncludeCommon & ~CCA_IMAGE_DATA;
+ #endif
+ }
+
+ // the for attribute
+ // the target frame
+ if (m_nIncludeCommon & CCA_FOR)
+ {
+ if (m_sReferringControls.getLength())
+ { // there is at least one control referring to the one we're handling currently
+ AddAttribute(
+ OAttributeMetaData::getCommonControlAttributeNamespace(CCA_FOR),
+ OAttributeMetaData::getCommonControlAttributeName(CCA_FOR),
+ m_sReferringControls);
+ }
+ #if OSL_DEBUG_LEVEL > 0
+ // reset the bit for later checking
+ m_nIncludeCommon = m_nIncludeCommon & ~CCA_FOR;
+ #endif
+ }
+
+ if ((CCA_CURRENT_VALUE | CCA_VALUE) & m_nIncludeCommon)
+ {
+ const sal_Char* pCurrentValuePropertyName = NULL;
+ const sal_Char* pValuePropertyName = NULL;
+
+ // get the property names
+ getValuePropertyNames(m_eType, m_nClassId, pCurrentValuePropertyName, pValuePropertyName);
+
+ static const sal_Char* pCurrentValueAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCA_CURRENT_VALUE);
+ static const sal_Char* pValueAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCA_VALUE);
+ static const sal_uInt16 nCurrentValueAttributeNamespaceKey = OAttributeMetaData::getCommonControlAttributeNamespace(CCA_CURRENT_VALUE);
+ static const sal_uInt16 nValueAttributeNamespaceKey = OAttributeMetaData::getCommonControlAttributeNamespace(CCA_VALUE);
+
+ // add the atrtributes if necessary and possible
+ if (pCurrentValuePropertyName && (CCA_CURRENT_VALUE & m_nIncludeCommon))
+ {
+ // don't export the current-value if this value originates from a data binding
+ // #i26944#
+ if ( controlHasActiveDataBinding() )
+ exportedProperty( ::rtl::OUString::createFromAscii( pCurrentValuePropertyName ) );
+ else
+ exportGenericPropertyAttribute(
+ nCurrentValueAttributeNamespaceKey,
+ pCurrentValueAttributeName,
+ pCurrentValuePropertyName
+ );
+ }
+
+ if (pValuePropertyName && (CCA_VALUE & m_nIncludeCommon))
+ exportGenericPropertyAttribute(
+ nValueAttributeNamespaceKey,
+ pValueAttributeName,
+ pValuePropertyName);
+
+ OSL_ENSURE((NULL == pValuePropertyName) == (0 == (CCA_VALUE & m_nIncludeCommon)),
+ "OControlExport::exportCommonControlAttributes: no property found for the value attribute!");
+ OSL_ENSURE((NULL == pCurrentValuePropertyName ) == (0 == (CCA_CURRENT_VALUE & m_nIncludeCommon)),
+ "OControlExport::exportCommonControlAttributes: no property found for the current-value attribute!");
+
+ #if OSL_DEBUG_LEVEL > 0
+ // reset the bit for later checking
+ m_nIncludeCommon = m_nIncludeCommon & ~(CCA_CURRENT_VALUE | CCA_VALUE);
+ #endif
+ }
+
+ OSL_ENSURE(0 == m_nIncludeCommon,
+ "OControlExport::exportCommonControlAttributes: forgot some flags!");
+ // in the dbg_util version, we should have removed every bit we handled from the mask, so it should
+ // be 0 now ...
+ }
+
+ //---------------------------------------------------------------------
+ void OControlExport::exportDatabaseAttributes()
+ {
+#if OSL_DEBUG_LEVEL > 0
+ sal_Int32 nIncludeDatabase = m_nIncludeDatabase;
+#endif
+ // the only string property: DataField
+ if (DA_DATA_FIELD & m_nIncludeDatabase)
+ {
+ exportStringPropertyAttribute(
+ OAttributeMetaData::getDatabaseAttributeNamespace(DA_DATA_FIELD),
+ OAttributeMetaData::getDatabaseAttributeName(DA_DATA_FIELD),
+ PROPERTY_DATAFIELD);
+ RESET_BIT( nIncludeDatabase, DA_DATA_FIELD );
+ }
+
+ // InputRequired
+ if ( DA_INPUT_REQUIRED & m_nIncludeDatabase )
+ {
+ exportBooleanPropertyAttribute(
+ OAttributeMetaData::getDatabaseAttributeNamespace( DA_INPUT_REQUIRED ),
+ OAttributeMetaData::getDatabaseAttributeName( DA_INPUT_REQUIRED ),
+ PROPERTY_INPUT_REQUIRED,
+ BOOLATTR_DEFAULT_TRUE
+ );
+ RESET_BIT( nIncludeDatabase, DA_INPUT_REQUIRED );
+ }
+
+ // the only int16 property: BoundColumn
+ if (DA_BOUND_COLUMN & m_nIncludeDatabase)
+ {
+ exportInt16PropertyAttribute(
+ OAttributeMetaData::getDatabaseAttributeNamespace(DA_BOUND_COLUMN),
+ OAttributeMetaData::getDatabaseAttributeName(DA_BOUND_COLUMN),
+ PROPERTY_BOUNDCOLUMN,
+ 0);
+ RESET_BIT( nIncludeDatabase, DA_BOUND_COLUMN );
+ }
+
+ // ConvertEmptyToNull
+ if (DA_CONVERT_EMPTY & m_nIncludeDatabase)
+ {
+ exportBooleanPropertyAttribute(
+ OAttributeMetaData::getDatabaseAttributeNamespace(DA_CONVERT_EMPTY),
+ OAttributeMetaData::getDatabaseAttributeName(DA_CONVERT_EMPTY),
+ PROPERTY_EMPTY_IS_NULL,
+ BOOLATTR_DEFAULT_FALSE
+ );
+ RESET_BIT( nIncludeDatabase, DA_CONVERT_EMPTY );
+ }
+
+ // the only enum property: ListSourceType
+ if (DA_LIST_SOURCE_TYPE & m_nIncludeDatabase)
+ {
+ exportEnumPropertyAttribute(
+ OAttributeMetaData::getDatabaseAttributeNamespace(DA_LIST_SOURCE_TYPE),
+ OAttributeMetaData::getDatabaseAttributeName(DA_LIST_SOURCE_TYPE),
+ PROPERTY_LISTSOURCETYPE,
+ OEnumMapper::getEnumMap(OEnumMapper::epListSourceType),
+ ListSourceType_VALUELIST
+ );
+ RESET_BIT( nIncludeDatabase, DA_LIST_SOURCE_TYPE );
+ }
+
+ if (m_nIncludeDatabase & DA_LIST_SOURCE)
+ {
+ exportListSourceAsAttribute();
+ RESET_BIT( nIncludeDatabase, DA_LIST_SOURCE );
+ }
+
+#if OSL_DEBUG_LEVEL > 0
+ OSL_ENSURE(0 == nIncludeDatabase,
+ "OControlExport::exportDatabaseAttributes: forgot some flags!");
+ // in the dbg_util version, we should have removed every bit we handled from the mask, so it should
+ // be 0 now ...
+#endif
+ }
+
+ //---------------------------------------------------------------------
+ void OControlExport::exportBindingAtributes()
+ {
+#if OSL_DEBUG_LEVEL > 0
+ sal_Int32 nIncludeBinding = m_nIncludeBindings;
+#endif
+
+ // ....................................................
+ if ( m_nIncludeBindings & BA_LINKED_CELL )
+ {
+ exportCellBindingAttributes( ( m_nIncludeBindings & BA_LIST_LINKING_TYPE ) != 0 );
+ #if OSL_DEBUG_LEVEL > 0
+ // reset the bit for later checking
+ nIncludeBinding = nIncludeBinding & ~( BA_LINKED_CELL | BA_LIST_LINKING_TYPE );
+ #endif
+ }
+
+ // ....................................................
+ if ( m_nIncludeBindings & BA_LIST_CELL_RANGE )
+ {
+ exportCellListSourceRange();
+ #if OSL_DEBUG_LEVEL > 0
+ // reset the bit for later checking
+ nIncludeBinding = nIncludeBinding & ~BA_LIST_CELL_RANGE;
+ #endif
+ }
+
+ if ( m_nIncludeBindings & BA_XFORMS_BIND )
+ {
+ exportXFormsBindAttributes();
+ #if OSL_DEBUG_LEVEL > 0
+ // reset the bit for later checking
+ nIncludeBinding = nIncludeBinding & ~BA_XFORMS_BIND;
+ #endif
+ }
+
+ if ( m_nIncludeBindings & BA_XFORMS_LISTBIND )
+ {
+ exportXFormsListAttributes();
+ #if OSL_DEBUG_LEVEL > 0
+ // reset the bit for later checking
+ nIncludeBinding = nIncludeBinding & ~BA_XFORMS_LISTBIND;
+ #endif
+ }
+
+ if ( m_nIncludeBindings & BA_XFORMS_SUBMISSION )
+ {
+ exportXFormsSubmissionAttributes();
+ #if OSL_DEBUG_LEVEL > 0
+ // reset the bit for later checking
+ nIncludeBinding = nIncludeBinding & ~BA_XFORMS_SUBMISSION;
+ #endif
+ }
+
+ OSL_ENSURE( 0 == nIncludeBinding,
+ "OControlExport::exportBindingAtributes: forgot some flags!");
+ // in the debug version, we should have removed every bit we handled from the mask, so it should
+ // be 0 now ...
+ }
+
+ //---------------------------------------------------------------------
+ void OControlExport::exportSpecialAttributes()
+ {
+ sal_Int32 i=0;
+
+ // ----------------------
+ // the boolean properties
+ {
+ static const sal_Int32 nBooleanPropertyAttributeIds[] =
+ { // attribute flags
+ SCA_VALIDATION, SCA_MULTI_LINE, SCA_AUTOMATIC_COMPLETION, SCA_MULTIPLE, SCA_DEFAULT_BUTTON, SCA_IS_TRISTATE,
+ SCA_TOGGLE, SCA_FOCUS_ON_CLICK
+ };
+ static const ::rtl::OUString* pBooleanPropertyNames[] =
+ { // property names
+ &PROPERTY_STRICTFORMAT, &PROPERTY_MULTILINE, &PROPERTY_AUTOCOMPLETE, &PROPERTY_MULTISELECTION, &PROPERTY_DEFAULTBUTTON, &PROPERTY_TRISTATE,
+ &PROPERTY_TOGGLE, &PROPERTY_FOCUS_ON_CLICK
+ };
+ sal_Int32 nIdCount = SAL_N_ELEMENTS(nBooleanPropertyAttributeIds);
+ #if OSL_DEBUG_LEVEL > 0
+ sal_Int32 nNameCount = SAL_N_ELEMENTS(pBooleanPropertyNames);
+ OSL_ENSURE((nIdCount == nNameCount),
+ "OControlExport::exportSpecialAttributes: somebody tampered with the maps (1)!");
+ #endif
+ const sal_Int32* pAttributeId = nBooleanPropertyAttributeIds;
+ const ::rtl::OUString** pPropertyName = pBooleanPropertyNames;
+ for ( i = 0; i < nIdCount; ++i, ++pAttributeId, ++pPropertyName )
+ {
+ if ( *pAttributeId& m_nIncludeSpecial)
+ {
+ exportBooleanPropertyAttribute(
+ OAttributeMetaData::getSpecialAttributeNamespace( *pAttributeId ),
+ OAttributeMetaData::getSpecialAttributeName( *pAttributeId ),
+ *(*pPropertyName),
+ ( *pAttributeId == SCA_FOCUS_ON_CLICK ) ? BOOLATTR_DEFAULT_TRUE : BOOLATTR_DEFAULT_FALSE
+ );
+ #if OSL_DEBUG_LEVEL > 0
+ // reset the bit for later checking
+ m_nIncludeSpecial = m_nIncludeSpecial & ~*pAttributeId;
+ #endif
+ }
+ }
+ }
+
+ // ----------------------
+ // the integer properties
+ {
+ static sal_Int32 nIntegerPropertyAttributeIds[] =
+ { // attribute flags
+ SCA_PAGE_STEP_SIZE
+ };
+ static const ::rtl::OUString* pIntegerPropertyNames[] =
+ { // property names
+ &PROPERTY_BLOCK_INCREMENT
+ };
+ static const sal_Int32 nIntegerPropertyAttrDefaults[] =
+ { // attribute defaults (XML defaults, not runtime defaults!)
+ 10
+ };
+
+ sal_Int32 nIdCount = SAL_N_ELEMENTS( nIntegerPropertyAttributeIds );
+ #if OSL_DEBUG_LEVEL > 0
+ sal_Int32 nNameCount = SAL_N_ELEMENTS( pIntegerPropertyNames );
+ OSL_ENSURE( ( nIdCount == nNameCount ),
+ "OControlExport::exportSpecialAttributes: somebody tampered with the maps (2)!" );
+ sal_Int32 nDefaultCount = SAL_N_ELEMENTS( nIntegerPropertyAttrDefaults );
+ OSL_ENSURE( ( nIdCount == nDefaultCount ),
+ "OControlExport::exportSpecialAttributes: somebody tampered with the maps (3)!" );
+ #endif
+ for ( i = 0; i < nIdCount; ++i )
+ if ( nIntegerPropertyAttributeIds[i] & m_nIncludeSpecial )
+ {
+ exportInt32PropertyAttribute(
+ OAttributeMetaData::getSpecialAttributeNamespace( nIntegerPropertyAttributeIds[i] ),
+ OAttributeMetaData::getSpecialAttributeName( nIntegerPropertyAttributeIds[i] ),
+ *( pIntegerPropertyNames[i] ),
+ nIntegerPropertyAttrDefaults[i]
+ );
+ #if OSL_DEBUG_LEVEL > 0
+ // reset the bit for later checking
+ m_nIncludeSpecial = m_nIncludeSpecial & ~nIntegerPropertyAttributeIds[i];
+ #endif
+ }
+
+ if ( SCA_STEP_SIZE & m_nIncludeSpecial )
+ {
+ ::rtl::OUString sPropertyName;
+ if ( m_xPropertyInfo->hasPropertyByName( PROPERTY_LINE_INCREMENT ) )
+ sPropertyName = PROPERTY_LINE_INCREMENT;
+ else if ( m_xPropertyInfo->hasPropertyByName( PROPERTY_SPIN_INCREMENT ) )
+ sPropertyName = PROPERTY_SPIN_INCREMENT;
+ else
+ OSL_FAIL( "OControlExport::exportSpecialAttributes: not property which can be mapped to step-size attribute!" );
+
+ if ( sPropertyName.getLength() )
+ exportInt32PropertyAttribute(
+ OAttributeMetaData::getSpecialAttributeNamespace( SCA_STEP_SIZE ),
+ OAttributeMetaData::getSpecialAttributeName( SCA_STEP_SIZE ),
+ sPropertyName,
+ 1
+ );
+
+ #if OSL_DEBUG_LEVEL > 0
+ // reset the bit for later checking
+ m_nIncludeSpecial = m_nIncludeSpecial & ~SCA_STEP_SIZE;
+ #endif
+ }
+
+ }
+
+ // -------------------
+ // the enum properties
+ {
+ if (SCA_STATE & m_nIncludeSpecial)
+ {
+ exportEnumPropertyAttribute(
+ OAttributeMetaData::getSpecialAttributeNamespace(SCA_STATE),
+ OAttributeMetaData::getSpecialAttributeName(SCA_STATE),
+ PROPERTY_DEFAULT_STATE,
+ OEnumMapper::getEnumMap(OEnumMapper::epCheckState),
+ STATE_NOCHECK);
+ #if OSL_DEBUG_LEVEL > 0
+ // reset the bit for later checking
+ m_nIncludeSpecial = m_nIncludeSpecial & ~SCA_STATE;
+ #endif
+ }
+
+ if (SCA_CURRENT_STATE & m_nIncludeSpecial)
+ {
+ exportEnumPropertyAttribute(
+ OAttributeMetaData::getSpecialAttributeNamespace(SCA_CURRENT_STATE),
+ OAttributeMetaData::getSpecialAttributeName(SCA_CURRENT_STATE),
+ PROPERTY_STATE,
+ OEnumMapper::getEnumMap(OEnumMapper::epCheckState),
+ STATE_NOCHECK);
+ #if OSL_DEBUG_LEVEL > 0
+ // reset the bit for later checking
+ m_nIncludeSpecial = m_nIncludeSpecial & ~SCA_CURRENT_STATE;
+ #endif
+ }
+ }
+
+ // --------------------------------------------------------------------
+ // some properties which require a special handling
+ // the repeat delay
+ {
+ if ( m_nIncludeSpecial & SCA_REPEAT_DELAY )
+ {
+ DBG_CHECK_PROPERTY( PROPERTY_REPEAT_DELAY, sal_Int32 );
+
+ sal_Int32 nRepeatDelay = 0;
+ m_xProps->getPropertyValue( PROPERTY_REPEAT_DELAY ) >>= nRepeatDelay;
+ Time aTime;
+ aTime.MakeTimeFromMS( nRepeatDelay );
+
+ AddAttribute(OAttributeMetaData::getSpecialAttributeNamespace( SCA_REPEAT_DELAY )
+ ,OAttributeMetaData::getSpecialAttributeName( SCA_REPEAT_DELAY )
+ ,SvXMLUnitConverter::convertTimeDuration( aTime, nRepeatDelay % 1000 ) );
+
+ exportedProperty( PROPERTY_REPEAT_DELAY );
+
+ #if OSL_DEBUG_LEVEL > 0
+ // reset the bit for later checking
+ m_nIncludeSpecial = m_nIncludeSpecial & ~SCA_REPEAT_DELAY;
+ #endif
+ }
+ }
+
+ // ----------------------------------
+ // the EchoChar property needs special handling, cause it's a Int16, but must be stored as one-character-string
+ {
+ if (SCA_ECHO_CHAR & m_nIncludeSpecial)
+ {
+ DBG_CHECK_PROPERTY( PROPERTY_ECHO_CHAR, sal_Int16 );
+ sal_Int16 nValue(0);
+ m_xProps->getPropertyValue(PROPERTY_ECHO_CHAR) >>= nValue;
+ if (nValue)
+ {
+ ::rtl::OUString sCharacter(reinterpret_cast<const sal_Unicode*>(&nValue), 1);
+ AddAttribute(
+ OAttributeMetaData::getSpecialAttributeNamespace(SCA_ECHO_CHAR),
+ OAttributeMetaData::getSpecialAttributeName(SCA_ECHO_CHAR),
+ sCharacter);
+ }
+ exportedProperty(PROPERTY_ECHO_CHAR);
+ #if OSL_DEBUG_LEVEL > 0
+ // reset the bit for later checking
+ m_nIncludeSpecial = m_nIncludeSpecial & ~SCA_ECHO_CHAR;
+ #endif
+ }
+ }
+
+ // ----------------------------------
+ // the string properties
+ {
+ static sal_Int32 nStringPropertyAttributeIds[] =
+ { // attribute flags
+ SCA_GROUP_NAME
+ };
+ static const ::rtl::OUString* pStringPropertyNames[] =
+ { // property names
+ &PROPERTY_GROUP_NAME
+ };
+
+ sal_Int32 nIdCount = SAL_N_ELEMENTS( nStringPropertyAttributeIds );
+ #if OSL_DEBUG_LEVEL > 0
+ sal_Int32 nNameCount = SAL_N_ELEMENTS( pStringPropertyNames );
+ OSL_ENSURE( ( nIdCount == nNameCount ),
+ "OControlExport::exportSpecialAttributes: somebody tampered with the maps (2)!" );
+ #endif
+ for ( i = 0; i < nIdCount; ++i )
+ if ( nStringPropertyAttributeIds[i] & m_nIncludeSpecial )
+ {
+ exportStringPropertyAttribute(
+ OAttributeMetaData::getSpecialAttributeNamespace( nStringPropertyAttributeIds[i] ),
+ OAttributeMetaData::getSpecialAttributeName( nStringPropertyAttributeIds[i] ),
+ *( pStringPropertyNames[i] )
+ );
+ #if OSL_DEBUG_LEVEL > 0
+ // reset the bit for later checking
+ m_nIncludeSpecial = m_nIncludeSpecial & ~nStringPropertyAttributeIds[i];
+ #endif
+ }
+ }
+
+ // ----------------------------------
+ if ((SCA_MIN_VALUE | SCA_MAX_VALUE) & m_nIncludeSpecial)
+ {
+ // need to export the min value and the max value as attributes
+ // It depends on the real type (FormComponentType) of the control, which properties hold these
+ // values
+ const sal_Char* pMinValuePropertyName = NULL;
+ const sal_Char* pMaxValuePropertyName = NULL;
+ getValueLimitPropertyNames(m_nClassId, pMinValuePropertyName, pMaxValuePropertyName);
+
+ OSL_ENSURE((NULL == pMinValuePropertyName) == (0 == (SCA_MIN_VALUE & m_nIncludeSpecial)),
+ "OControlExport::exportCommonControlAttributes: no property found for the min value attribute!");
+ OSL_ENSURE((NULL == pMaxValuePropertyName) == (0 == (SCA_MAX_VALUE & m_nIncludeSpecial)),
+ "OControlExport::exportCommonControlAttributes: no property found for the max value attribute!");
+
+ // add the two attributes
+ static const sal_Char* pMinValueAttributeName = OAttributeMetaData::getSpecialAttributeName(SCA_MIN_VALUE);
+ static const sal_Char* pMaxValueAttributeName = OAttributeMetaData::getSpecialAttributeName(SCA_MAX_VALUE);
+ static const sal_uInt16 nMinValueNamespaceKey = OAttributeMetaData::getSpecialAttributeNamespace(SCA_MIN_VALUE);
+ static const sal_uInt16 nMaxValueNamespaceKey = OAttributeMetaData::getSpecialAttributeNamespace(SCA_MAX_VALUE);
+
+ if (pMinValuePropertyName && (SCA_MIN_VALUE & m_nIncludeSpecial))
+ exportGenericPropertyAttribute(
+ nMinValueNamespaceKey,
+ pMinValueAttributeName,
+ pMinValuePropertyName);
+
+ if (pMaxValuePropertyName && (SCA_MAX_VALUE & m_nIncludeSpecial))
+ exportGenericPropertyAttribute(
+ nMaxValueNamespaceKey,
+ pMaxValueAttributeName,
+ pMaxValuePropertyName);
+ #if OSL_DEBUG_LEVEL > 0
+ // reset the bit for later checking
+ m_nIncludeSpecial = m_nIncludeSpecial & ~(SCA_MIN_VALUE | SCA_MAX_VALUE);
+ #endif
+ }
+
+ // ----------------------------------
+ if ( SCA_IMAGE_POSITION & m_nIncludeSpecial )
+ {
+ exportImagePositionAttributes();
+ RESET_BIT( m_nIncludeSpecial, SCA_IMAGE_POSITION );
+ }
+
+ OSL_ENSURE(0 == m_nIncludeSpecial,
+ "OControlExport::exportSpecialAttributes: forgot some flags!");
+ // in the dbg_util version, we should have removed every bit we handled from the mask, so it should
+ // be 0 now ...
+ }
+
+ //---------------------------------------------------------------------
+ ::rtl::OUString OControlExport::getScalarListSourceValue() const
+ {
+ ::rtl::OUString sListSource;
+ Any aListSource = m_xProps->getPropertyValue( PROPERTY_LISTSOURCE );
+ if ( !( aListSource >>= sListSource ) )
+ {
+ Sequence< ::rtl::OUString > aListSourceSequence;
+ aListSource >>= aListSourceSequence;
+ if ( aListSourceSequence.getLength() )
+ sListSource = aListSourceSequence[ 0 ];
+ }
+ return sListSource;
+ }
+
+ //---------------------------------------------------------------------
+ void OControlExport::exportListSourceAsAttribute()
+ {
+ // DA_LIST_SOURCE needs some special handling
+ DBG_CHECK_PROPERTY_NO_TYPE( PROPERTY_LISTSOURCE );
+
+ ::rtl::OUString sListSource = getScalarListSourceValue();
+ if ( sListSource.getLength() )
+ { // the ListSource property needs to be exported as attribute, and it is not empty
+ AddAttribute(
+ OAttributeMetaData::getDatabaseAttributeNamespace(DA_LIST_SOURCE),
+ OAttributeMetaData::getDatabaseAttributeName(DA_LIST_SOURCE),
+ sListSource);
+ }
+
+ exportedProperty( PROPERTY_LISTSOURCE );
+ }
+
+ //---------------------------------------------------------------------
+ void OControlExport::getSequenceInt16PropertyAsSet(const ::rtl::OUString& _rPropertyName, Int16Set& _rOut)
+ {
+ Sequence< sal_Int16 > aValueSequence;
+ DBG_CHECK_PROPERTY(_rPropertyName, Sequence< sal_Int16 >);
+ m_xProps->getPropertyValue(_rPropertyName) >>= aValueSequence;
+
+ const sal_Int16* pValues = aValueSequence.getConstArray();
+ for (sal_Int32 i=0; i<aValueSequence.getLength(); ++i, ++pValues)
+ _rOut.insert(*pValues);
+ }
+
+ //---------------------------------------------------------------------
+ void OControlExport::exportListSourceAsElements()
+ {
+ // the string lists
+ Sequence< ::rtl::OUString > aItems, aValues;
+ DBG_CHECK_PROPERTY( PROPERTY_STRING_ITEM_LIST, Sequence< ::rtl::OUString > );
+ m_xProps->getPropertyValue(PROPERTY_STRING_ITEM_LIST) >>= aItems;
+
+ DBG_CHECK_PROPERTY( PROPERTY_LISTSOURCE, Sequence< ::rtl::OUString > );
+ if ( 0 == ( m_nIncludeDatabase & DA_LIST_SOURCE ) )
+ m_xProps->getPropertyValue(PROPERTY_LISTSOURCE) >>= aValues;
+ // if we exported the list source as attribute, we do not repeat it as sub elements
+
+ // the selection lists
+ Int16Set aSelection, aDefaultSelection;
+ getSequenceInt16PropertyAsSet(PROPERTY_SELECT_SEQ, aSelection);
+ getSequenceInt16PropertyAsSet(PROPERTY_DEFAULT_SELECT_SEQ, aDefaultSelection);
+
+ // the string for "true"
+ ::rtl::OUString sTrue;
+ ::rtl::OUStringBuffer sBuffer;
+ m_rContext.getGlobalContext().GetMM100UnitConverter().convertBool(sBuffer, sal_True);
+ sTrue = sBuffer.makeStringAndClear();
+
+ // loop through both lists ('til the maximum of both lengths)
+ const ::rtl::OUString* pItems = aItems.getConstArray();
+ const ::rtl::OUString* pValues = aValues.getConstArray();
+
+ sal_Int32 nItems = aItems.getLength();
+ sal_Int32 nValues = aValues.getLength();
+
+ sal_Int16 nMaxLen = (sal_Int16)std::max(nItems, nValues);
+
+ for (sal_Int16 i=0; i<nMaxLen; ++i )
+ {
+ m_rContext.getGlobalContext().ClearAttrList();
+ if (i < nItems)
+ {
+ // there is an item at this position
+ AddAttribute(
+ OAttributeMetaData::getCommonControlAttributeNamespace(CCA_LABEL),
+ OAttributeMetaData::getCommonControlAttributeName(CCA_LABEL),
+ *pItems);
+ ++pItems;
+ }
+ if (i < nValues)
+ {
+ // there is an value at this position
+ AddAttribute(
+ OAttributeMetaData::getCommonControlAttributeNamespace(CCA_VALUE),
+ OAttributeMetaData::getCommonControlAttributeName(CCA_VALUE),
+ *pValues);
+ ++pValues;
+ }
+
+ Int16SetIterator aSelectedPos = aSelection.find(i);
+ if (aSelection.end() != aSelectedPos)
+ { // the item at this position is selected
+ AddAttribute(
+ OAttributeMetaData::getCommonControlAttributeNamespace(CCA_CURRENT_SELECTED),
+ OAttributeMetaData::getCommonControlAttributeName(CCA_CURRENT_SELECTED),
+ sTrue
+ );
+ aSelection.erase(aSelectedPos);
+ }
+
+ Int16SetIterator aDefaultSelectedPos = aDefaultSelection.find(i);
+ if (aDefaultSelection.end() != aDefaultSelectedPos)
+ { // the item at this position is selected as default
+ AddAttribute(
+ OAttributeMetaData::getCommonControlAttributeNamespace(CCA_SELECTED),
+ OAttributeMetaData::getCommonControlAttributeName(CCA_SELECTED),
+ sTrue
+ );
+ aDefaultSelection.erase(aDefaultSelectedPos);
+ }
+ SvXMLElementExport aFormElement(m_rContext.getGlobalContext(), XML_NAMESPACE_FORM, "option", sal_True, sal_True);
+ }
+
+ // There may be more "selected" or "default-selected" items than there are in the lists in real,
+ // so we need to store some additional "form:option" items which have no name and no label, but
+ // one or both of the selected flags.
+ // 21.05.2001 - 85388 - frank.schoenheit@germany.sun.com
+
+ if ( !aSelection.empty() || !aDefaultSelection.empty() )
+ {
+ sal_Int16 nLastSelected = -1;
+ if ( !aSelection.empty() )
+ nLastSelected = *(--aSelection.end());
+
+ sal_Int16 nLastDefaultSelected = -1;
+ if ( !aDefaultSelection.empty() )
+ nLastDefaultSelected = *(--aDefaultSelection.end());
+
+ // the maximum element in both sets
+ sal_Int16 nLastReferredEntry = std::max(nLastSelected, nLastDefaultSelected);
+ OSL_ENSURE(nLastReferredEntry >= nMaxLen, "OControlExport::exportListSourceAsElements: inconsistence!");
+ // if the maximum (selected or default selected) entry number is less than the maximum item count
+ // in both lists, the entry number should have been removed from the set
+
+ for (sal_Int16 i=nMaxLen; i<=nLastReferredEntry; ++i)
+ {
+ if (aSelection.end() != aSelection.find(i))
+ { // the (not existent) item at this position is selected
+ AddAttribute(
+ OAttributeMetaData::getCommonControlAttributeNamespace(CCA_CURRENT_SELECTED),
+ OAttributeMetaData::getCommonControlAttributeName(CCA_CURRENT_SELECTED),
+ sTrue
+ );
+ }
+
+ if (aDefaultSelection.end() != aDefaultSelection.find(i))
+ { // the (not existent) item at this position is selected as default
+ AddAttribute(
+ OAttributeMetaData::getCommonControlAttributeNamespace(CCA_SELECTED),
+ OAttributeMetaData::getCommonControlAttributeName(CCA_SELECTED),
+ sTrue
+ );
+ }
+ SvXMLElementExport aFormElement(m_rContext.getGlobalContext(), XML_NAMESPACE_FORM, "option", sal_True, sal_True);
+ }
+ }
+ }
+
+ //---------------------------------------------------------------------
+ void OControlExport::implStartElement(const sal_Char* _pName)
+ {
+ // before we let the base class start it's outer element, we add a wrapper element
+ const sal_Char *pOuterElementName = getOuterXMLElementName();
+ m_pOuterElement = pOuterElementName
+ ? new SvXMLElementExport(
+ m_rContext.getGlobalContext(),
+ XML_NAMESPACE_FORM,
+ pOuterElementName, sal_True,
+ sal_True)
+ : 0;
+
+ // add the attributes for the inner element
+ exportInnerAttributes();
+
+ // and start the inner element
+ OElementExport::implStartElement(_pName);
+ }
+
+ //---------------------------------------------------------------------
+ void OControlExport::implEndElement()
+ {
+ // end the inner element
+ OElementExport::implEndElement();
+
+ // end the outer element if it exists
+ delete m_pOuterElement;
+ m_pOuterElement = NULL;
+ }
+
+ //---------------------------------------------------------------------
+ const sal_Char* OControlExport::getOuterXMLElementName() const
+ {
+ return 0;
+ }
+
+ //---------------------------------------------------------------------
+ const sal_Char* OControlExport::getXMLElementName() const
+ {
+ return getElementName(m_eType);
+ }
+
+ //---------------------------------------------------------------------
+ void OControlExport::examine()
+ {
+ OSL_ENSURE( ( m_nIncludeCommon == 0 ) && ( m_nIncludeSpecial == 0 ) && ( m_nIncludeDatabase == 0 )
+ && ( m_nIncludeEvents == 0 ) && ( m_nIncludeBindings == 0),
+ "OControlExport::examine: called me twice? Not initialized?" );
+
+ // get the class id to decide which kind of element we need in the XML stream
+ m_nClassId = FormComponentType::CONTROL;
+ DBG_CHECK_PROPERTY( PROPERTY_CLASSID, sal_Int16 );
+ m_xProps->getPropertyValue(PROPERTY_CLASSID) >>= m_nClassId;
+ bool knownType = false;
+ switch (m_nClassId)
+ {
+ case FormComponentType::DATEFIELD:
+ m_eType = DATE;
+ knownType = true;
+ // NO BREAK
+ case FormComponentType::TIMEFIELD:
+ if ( !knownType )
+ {
+ m_eType = TIME;
+ knownType = true;
+ }
+ m_nIncludeSpecial |= SCA_VALIDATION;
+ // NO BREAK
+ case FormComponentType::NUMERICFIELD:
+ case FormComponentType::CURRENCYFIELD:
+ case FormComponentType::PATTERNFIELD:
+ if ( !knownType )
+ {
+ m_eType = FORMATTED_TEXT;
+ knownType = true;
+ }
+ // NO BREAK
+ case FormComponentType::TEXTFIELD:
+ { // it's some kind of edit. To know which type we need further investigation
+
+ if ( !knownType )
+ {
+ // check if it's a formatted field
+ if (m_xPropertyInfo->hasPropertyByName(PROPERTY_FORMATKEY))
+ {
+ m_eType = FORMATTED_TEXT;
+ }
+ else
+ {
+ // all other controls are represented by an ordinary edit control, but which XML control type
+ // it is depends on the current values of some properties
+
+ // if the EchoChar string is not empty, it is a password field
+ sal_Int16 nEchoChar = 0;
+ if (m_xPropertyInfo->hasPropertyByName(PROPERTY_ECHOCHAR))
+ // grid columns do not have this property ....
+ m_xProps->getPropertyValue(PROPERTY_ECHOCHAR) >>= nEchoChar;
+ if (nEchoChar)
+ {
+ m_eType = PASSWORD;
+ m_nIncludeSpecial |= SCA_ECHO_CHAR;
+ }
+ else
+ {
+ // if the MultiLine property is sal_True, it is a TextArea
+ sal_Bool bMultiLine = sal_False;
+ if (m_xPropertyInfo->hasPropertyByName(PROPERTY_MULTILINE))
+ // grid columns do not have this property ....
+ bMultiLine = ::cppu::any2bool(m_xProps->getPropertyValue(PROPERTY_MULTILINE));
+
+ if ( bMultiLine )
+ m_eType = TEXT_AREA;
+ else
+ // the only case left is represented by a Text element
+ m_eType = TEXT;
+ }
+ }
+ knownType = true;
+ }
+
+ // attributes which are common to all the types:
+ // common attributes
+ m_nIncludeCommon =
+ CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED |
+ CCA_PRINTABLE | CCA_TAB_INDEX | CCA_TAB_STOP | CCA_TITLE;
+
+ if ( ( m_nClassId != FormComponentType::DATEFIELD )
+ && ( m_nClassId != FormComponentType::TIMEFIELD )
+ )
+ // date and time field values are handled differently nowadays
+ m_nIncludeCommon |= CCA_VALUE;
+
+ // database attributes
+ m_nIncludeDatabase = DA_DATA_FIELD | DA_INPUT_REQUIRED;
+
+ // event attributes
+ m_nIncludeEvents = EA_CONTROL_EVENTS | EA_ON_CHANGE | EA_ON_SELECT;
+
+ // only text and pattern fields have a ConvertEmptyToNull property
+ if ( ( m_nClassId == FormComponentType::TEXTFIELD )
+ || ( m_nClassId == FormComponentType::PATTERNFIELD )
+ )
+ m_nIncludeDatabase |= DA_CONVERT_EMPTY;
+
+ // all controls but the file control fields have a readonly property
+ if ( m_nClassId != FormComponentType::FILECONTROL )
+ m_nIncludeCommon |= CCA_READONLY;
+
+ // a text field has a max text len
+ if ( m_nClassId == FormComponentType::TEXTFIELD )
+ m_nIncludeCommon |= CCA_MAX_LENGTH;
+
+ // max and min values and validation:
+ if (FORMATTED_TEXT == m_eType)
+ { // in general all controls represented as formatted-text have these props
+ if ( FormComponentType::PATTERNFIELD != m_nClassId ) // except the PatternField
+ m_nIncludeSpecial |= SCA_MAX_VALUE | SCA_MIN_VALUE;
+
+ if (FormComponentType::TEXTFIELD != m_nClassId)
+ // and the FormattedField does not have a validation flag
+ m_nIncludeSpecial |= SCA_VALIDATION;
+ }
+
+ // if it's not a password field or rich text control, the CurrentValue needs to be stored, too
+ if ( ( PASSWORD != m_eType )
+ && ( DATE != m_eType )
+ && ( TIME != m_eType )
+ )
+ {
+ m_nIncludeCommon |= CCA_CURRENT_VALUE;
+ }
+ }
+ break;
+
+ case FormComponentType::FILECONTROL:
+ m_eType = FILE;
+ m_nIncludeCommon =
+ CCA_NAME | CCA_SERVICE_NAME | CCA_CURRENT_VALUE | CCA_DISABLED |
+ CCA_PRINTABLE | CCA_TAB_INDEX | CCA_TAB_STOP | CCA_TITLE |
+ CCA_VALUE;
+ m_nIncludeEvents = EA_CONTROL_EVENTS | EA_ON_CHANGE | EA_ON_SELECT;
+ break;
+
+ case FormComponentType::FIXEDTEXT:
+ m_eType = FIXED_TEXT;
+ m_nIncludeCommon =
+ CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED | CCA_LABEL |
+ CCA_PRINTABLE | CCA_TITLE | CCA_FOR;
+ m_nIncludeSpecial = SCA_MULTI_LINE;
+ m_nIncludeEvents = EA_CONTROL_EVENTS;
+ break;
+
+ case FormComponentType::COMBOBOX:
+ m_eType = COMBOBOX;
+ m_nIncludeCommon =
+ CCA_NAME | CCA_SERVICE_NAME | CCA_CURRENT_VALUE |
+ CCA_DISABLED | CCA_DROPDOWN | CCA_MAX_LENGTH | CCA_PRINTABLE | CCA_READONLY | CCA_SIZE |
+ CCA_TAB_INDEX | CCA_TAB_STOP | CCA_TITLE | CCA_VALUE;
+ m_nIncludeSpecial = SCA_AUTOMATIC_COMPLETION;
+ m_nIncludeDatabase = DA_CONVERT_EMPTY | DA_DATA_FIELD | DA_INPUT_REQUIRED | DA_LIST_SOURCE | DA_LIST_SOURCE_TYPE;
+ m_nIncludeEvents = EA_CONTROL_EVENTS | EA_ON_CHANGE | EA_ON_SELECT;
+ break;
+
+ case FormComponentType::LISTBOX:
+ m_eType = LISTBOX;
+ m_nIncludeCommon =
+ CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED | CCA_DROPDOWN |
+ CCA_PRINTABLE | CCA_SIZE | CCA_TAB_INDEX | CCA_TAB_STOP | CCA_TITLE;
+ m_nIncludeSpecial = SCA_MULTIPLE;
+ m_nIncludeDatabase = DA_BOUND_COLUMN | DA_DATA_FIELD | DA_INPUT_REQUIRED | DA_LIST_SOURCE_TYPE;
+ m_nIncludeEvents = EA_CONTROL_EVENTS | EA_ON_CHANGE | EA_ON_CLICK | EA_ON_DBLCLICK;
+ // check if we need to export the ListSource as attribute
+ {
+ // for a list box, if the ListSourceType is VALUE_LIST, no ListSource is stored, but instead
+ // a sequence of pairs which is build from the StringItemList and the ValueList
+ ListSourceType eListSourceType = ListSourceType_VALUELIST;
+ #if OSL_DEBUG_LEVEL > 0
+ sal_Bool bSuccess =
+ #endif
+ m_xProps->getPropertyValue(PROPERTY_LISTSOURCETYPE) >>= eListSourceType;
+ OSL_ENSURE(bSuccess, "OControlExport::examineControl: could not retrieve the ListSourceType!");
+ if (ListSourceType_VALUELIST != eListSourceType)
+ {
+ m_nIncludeDatabase |= DA_LIST_SOURCE;
+ }
+ }
+
+ break;
+
+ case FormComponentType::COMMANDBUTTON:
+ m_eType = BUTTON;
+ m_nIncludeCommon |= CCA_TAB_STOP | CCA_LABEL;
+ m_nIncludeSpecial = SCA_DEFAULT_BUTTON | SCA_TOGGLE | SCA_FOCUS_ON_CLICK | SCA_IMAGE_POSITION | SCA_REPEAT_DELAY;
+ // NO BREAK !
+ case FormComponentType::IMAGEBUTTON:
+ if (BUTTON != m_eType)
+ {
+ // not coming from the previous case
+ m_eType = IMAGE;
+ }
+ m_nIncludeCommon |=
+ CCA_NAME | CCA_SERVICE_NAME | CCA_BUTTON_TYPE | CCA_DISABLED |
+ CCA_IMAGE_DATA | CCA_PRINTABLE | CCA_TAB_INDEX | CCA_TARGET_FRAME |
+ CCA_TARGET_LOCATION | CCA_TITLE;
+ m_nIncludeEvents = EA_CONTROL_EVENTS | EA_ON_CLICK | EA_ON_DBLCLICK;
+ break;
+
+ case FormComponentType::CHECKBOX:
+ m_eType = CHECKBOX;
+ m_nIncludeSpecial = SCA_CURRENT_STATE | SCA_IS_TRISTATE | SCA_STATE;
+ // NO BREAK !
+ case FormComponentType::RADIOBUTTON:
+ m_nIncludeCommon =
+ CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED | CCA_LABEL | CCA_PRINTABLE |
+ CCA_TAB_INDEX | CCA_TAB_STOP | CCA_TITLE | CCA_VALUE | CCA_VISUAL_EFFECT;
+ if (CHECKBOX != m_eType)
+ { // not coming from the previous case
+ m_eType = RADIO;
+ m_nIncludeCommon |= CCA_CURRENT_SELECTED | CCA_SELECTED;
+ }
+ if ( m_xPropertyInfo->hasPropertyByName( PROPERTY_IMAGE_POSITION ) )
+ m_nIncludeSpecial |= SCA_IMAGE_POSITION;
+ if ( m_xPropertyInfo->hasPropertyByName( PROPERTY_GROUP_NAME ) )
+ m_nIncludeSpecial |= SCA_GROUP_NAME;
+ m_nIncludeDatabase = DA_DATA_FIELD | DA_INPUT_REQUIRED;
+ m_nIncludeEvents = EA_CONTROL_EVENTS | EA_ON_CHANGE;
+ break;
+
+ case FormComponentType::GROUPBOX:
+ m_eType = FRAME;
+ m_nIncludeCommon =
+ CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED | CCA_LABEL |
+ CCA_PRINTABLE | CCA_TITLE | CCA_FOR;
+ m_nIncludeEvents = EA_CONTROL_EVENTS;
+ break;
+
+ case FormComponentType::IMAGECONTROL:
+ m_eType = IMAGE_FRAME;
+ m_nIncludeCommon =
+ CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED | CCA_IMAGE_DATA |
+ CCA_PRINTABLE | CCA_READONLY | CCA_TITLE;
+ m_nIncludeDatabase = DA_DATA_FIELD | DA_INPUT_REQUIRED;
+ m_nIncludeEvents = EA_CONTROL_EVENTS;
+ break;
+
+ case FormComponentType::HIDDENCONTROL:
+ m_eType = HIDDEN;
+ m_nIncludeCommon =
+ CCA_NAME | CCA_SERVICE_NAME | CCA_VALUE;
+ break;
+
+ case FormComponentType::GRIDCONTROL:
+ m_eType = GRID;
+ m_nIncludeCommon =
+ CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED | CCA_PRINTABLE |
+ CCA_TAB_INDEX | CCA_TAB_STOP | CCA_TITLE;
+ m_nIncludeEvents = EA_CONTROL_EVENTS;
+ break;
+
+ case FormComponentType::SCROLLBAR:
+ case FormComponentType::SPINBUTTON:
+ m_eType = VALUERANGE;
+ m_nIncludeCommon =
+ CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED | CCA_PRINTABLE |
+ CCA_TITLE | CCA_CURRENT_VALUE | CCA_VALUE | CCA_ORIENTATION;
+ m_nIncludeSpecial = SCA_MAX_VALUE | SCA_STEP_SIZE | SCA_MIN_VALUE | SCA_REPEAT_DELAY;
+
+ if ( m_nClassId == FormComponentType::SCROLLBAR )
+ m_nIncludeSpecial |= SCA_PAGE_STEP_SIZE ;
+
+ m_nIncludeEvents = EA_CONTROL_EVENTS;
+ break;
+
+ default:
+ OSL_FAIL("OControlExport::examineControl: unknown control type (class id)!");
+ // NO break!
+
+ case FormComponentType::NAVIGATIONBAR:
+ // TODO: should we have an own file format for this?
+ // NO break
+
+ case FormComponentType::CONTROL:
+ m_eType = GENERIC_CONTROL;
+ // unknown control type
+ m_nIncludeCommon = CCA_NAME | CCA_SERVICE_NAME;
+ // at least a name should be there, 'cause without a name the control could never have been
+ // inserted into it's parent container
+ // In addition, the service name is absolutely necessary to create the control upon reading.
+ m_nIncludeEvents = EA_CONTROL_EVENTS;
+ // we always should be able to export events - this is not control type dependent
+ break;
+ }
+
+ // in general, all control types need to export the control id
+ m_nIncludeCommon |= CCA_CONTROL_ID;
+
+ // is is a control bound to a calc cell?
+ if ( FormCellBindingHelper::livesInSpreadsheetDocument( m_xProps ) )
+ {
+ FormCellBindingHelper aHelper( m_xProps, NULL );
+ {
+ if ( aHelper.isCellBinding( aHelper.getCurrentBinding( ) ) )
+ {
+ m_nIncludeBindings |= BA_LINKED_CELL;
+ if ( m_nClassId == FormComponentType::LISTBOX )
+ m_nIncludeBindings |= BA_LIST_LINKING_TYPE;
+ }
+ }
+
+ // is it a list-like control which uses a calc cell range as list source?
+ {
+ if ( aHelper.isCellRangeListSource( aHelper.getCurrentListSource( ) ) )
+ m_nIncludeBindings |= BA_LIST_CELL_RANGE;
+ }
+ }
+
+ // is control bound to XForms?
+ if( getXFormsBindName( m_xProps ).getLength() > 0 )
+ {
+ m_nIncludeBindings |= BA_XFORMS_BIND;
+ }
+
+ // is (list-)control bound to XForms list?
+ if( getXFormsListBindName( m_xProps ).getLength() > 0 )
+ {
+ m_nIncludeBindings |= BA_XFORMS_LISTBIND;
+ }
+
+ // does the control have an XForms submission?
+ if( getXFormsSubmissionName( m_xProps ).getLength() > 0 )
+ {
+ m_nIncludeBindings |= BA_XFORMS_SUBMISSION;
+ }
+ }
+
+ //---------------------------------------------------------------------
+ void OControlExport::exportCellBindingAttributes( bool _bIncludeListLinkageType )
+ {
+ try
+ {
+ FormCellBindingHelper aHelper( m_xProps, NULL );
+ Reference< XValueBinding > xBinding( aHelper.getCurrentBinding() );
+ OSL_ENSURE( xBinding.is(), "OControlExport::exportCellBindingAttributes: invalid bindable or invalid binding!" );
+ if ( xBinding.is() )
+ {
+ // ....................................................
+ AddAttribute(
+ OAttributeMetaData::getBindingAttributeNamespace( BA_LINKED_CELL ),
+ OAttributeMetaData::getBindingAttributeName( BA_LINKED_CELL ),
+ aHelper.getStringAddressFromCellBinding( xBinding )
+ );
+
+ // ....................................................
+ if ( _bIncludeListLinkageType )
+ {
+ sal_Int16 nLinkageType = aHelper.isCellIntegerBinding( xBinding ) ? 1 : 0;
+
+ ::rtl::OUStringBuffer sBuffer;
+ m_rContext.getGlobalContext().GetMM100UnitConverter().convertEnum(
+ sBuffer,
+ (sal_uInt16)nLinkageType,
+ OEnumMapper::getEnumMap( OEnumMapper::epListLinkageType )
+ );
+
+ AddAttribute(
+ OAttributeMetaData::getBindingAttributeNamespace( BA_LIST_LINKING_TYPE ),
+ OAttributeMetaData::getBindingAttributeName( BA_LIST_LINKING_TYPE ),
+ sBuffer.makeStringAndClear()
+ );
+ }
+
+ }
+ }
+ catch( const Exception& )
+ {
+ OSL_FAIL( "OControlExport::exportCellBindingAttributes: caught an exception!" );
+ }
+ }
+
+ //---------------------------------------------------------------------
+ void OControlExport::exportXFormsBindAttributes()
+ {
+ rtl::OUString sBindName = getXFormsBindName( m_xProps );
+ AddAttribute( XML_NAMESPACE_XFORMS, XML_BIND, sBindName );
+ }
+ //---------------------------------------------------------------------
+ void OControlExport::exportXFormsListAttributes()
+ {
+ rtl::OUString sBindName = getXFormsListBindName( m_xProps );
+ AddAttribute( XML_NAMESPACE_FORM, XML_XFORMS_LIST_SOURCE, sBindName );
+ }
+ //---------------------------------------------------------------------
+ void OControlExport::exportXFormsSubmissionAttributes()
+ {
+ rtl::OUString sSubmission = getXFormsSubmissionName( m_xProps );
+ AddAttribute( XML_NAMESPACE_FORM, XML_XFORMS_SUBMISSION, sSubmission );
+ }
+ //---------------------------------------------------------------------
+ void OControlExport::exportCellListSourceRange( )
+ {
+ try
+ {
+ Reference< XListEntrySink > xSink( m_xProps, UNO_QUERY );
+ Reference< XListEntrySource > xSource;
+ if ( xSink.is() )
+ xSource = xSource.query( xSink->getListEntrySource() );
+ OSL_ENSURE( xSource.is(), "OControlExport::exportCellListSourceRange: list source or sink!" );
+ if ( xSource.is() )
+ {
+ FormCellBindingHelper aHelper( m_xProps, NULL );
+
+ AddAttribute(
+ OAttributeMetaData::getBindingAttributeNamespace( BA_LIST_CELL_RANGE ),
+ OAttributeMetaData::getBindingAttributeName( BA_LIST_CELL_RANGE ),
+ aHelper.getStringAddressFromCellListSource( xSource )
+ );
+ }
+ }
+ catch( const Exception& )
+ {
+ OSL_FAIL( "OControlExport::exportCellListSourceRange: caught an exception!" );
+ }
+ }
+
+ //---------------------------------------------------------------------
+ void OControlExport::exportImagePositionAttributes()
+ {
+ try
+ {
+ sal_Int16 nImagePosition = ImagePosition::Centered;
+ OSL_VERIFY( m_xProps->getPropertyValue( PROPERTY_IMAGE_POSITION ) >>= nImagePosition );
+ OSL_ENSURE( ( nImagePosition >= ImagePosition::LeftTop ) && ( nImagePosition <= ImagePosition::Centered ),
+ "OControlExport::exportImagePositionAttributes: don't know this image position!" );
+
+ if ( ( nImagePosition < ImagePosition::LeftTop ) || ( nImagePosition > ImagePosition::Centered ) )
+ // this is important to prevent potential buffer overflows below, so don't optimize
+ nImagePosition = ImagePosition::Centered;
+
+ if ( nImagePosition == ImagePosition::Centered )
+ {
+ AddAttribute( XML_NAMESPACE_FORM, GetXMLToken( XML_IMAGE_POSITION ), GetXMLToken( XML_CENTER ) );
+ }
+ else
+ {
+ XMLTokenEnum eXmlImagePositions[] =
+ {
+ XML_START, XML_END, XML_TOP, XML_BOTTOM
+ };
+ XMLTokenEnum eXmlImageAligns[] =
+ {
+ XML_START, XML_CENTER, XML_END
+ };
+
+ XMLTokenEnum eXmlImagePosition = eXmlImagePositions[ nImagePosition / 3 ];
+ XMLTokenEnum eXmlImageAlign = eXmlImageAligns [ nImagePosition % 3 ];
+
+ AddAttribute( XML_NAMESPACE_FORM, GetXMLToken( XML_IMAGE_POSITION ), GetXMLToken( eXmlImagePosition ) );
+ AddAttribute( XML_NAMESPACE_FORM, GetXMLToken( XML_IMAGE_ALIGN ), GetXMLToken( eXmlImageAlign ) );
+ }
+
+ exportedProperty( PROPERTY_IMAGE_POSITION );
+ // some of the controls which have an ImagePosition also have an ImageAlign for compatibility
+ // reasons. Since the ImageAlign values simply represent a sub set of the ImagePosition values,
+ // we don't need to export ImageAlign anymore
+ exportedProperty( PROPERTY_IMAGE_ALIGN );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //---------------------------------------------------------------------
+ bool OControlExport::controlHasActiveDataBinding() const
+ {
+ try
+ {
+ // currently exchanging the data with a database column?
+ ::rtl::OUString sBoundFieldPropertyName( RTL_CONSTASCII_USTRINGPARAM( "BoundField" ) );
+ if ( m_xPropertyInfo.is() && m_xPropertyInfo->hasPropertyByName( sBoundFieldPropertyName ) )
+ {
+ Reference< XPropertySet > xBoundField;
+ m_xProps->getPropertyValue( sBoundFieldPropertyName ) >>= xBoundField;
+ if ( xBoundField.is() )
+ return true;
+ }
+
+ // currently exchanging data with an external binding?
+ Reference< XBindableValue > xBindable( m_xProps, UNO_QUERY );
+ if ( xBindable.is() && xBindable->getValueBinding().is() )
+ return true;
+ }
+ catch( const Exception& )
+ {
+ OSL_FAIL( "OColumnExport::controlHasActiveDataBinding: caught an exception!" );
+ }
+
+ return false;
+ }
+
+ //---------------------------------------------------------------------
+ bool OControlExport::controlHasUserSuppliedListEntries() const
+ {
+ try
+ {
+ // an external list source?
+ Reference< XListEntrySink > xEntrySink( m_xProps, UNO_QUERY );
+ if ( xEntrySink.is() && xEntrySink->getListEntrySource().is() )
+ return false;
+
+ if ( m_xPropertyInfo.is() && m_xPropertyInfo->hasPropertyByName( PROPERTY_LISTSOURCETYPE ) )
+ {
+ ListSourceType eListSourceType = ListSourceType_VALUELIST;
+ OSL_VERIFY( m_xProps->getPropertyValue( PROPERTY_LISTSOURCETYPE ) >>= eListSourceType );
+ if ( eListSourceType == ListSourceType_VALUELIST )
+ // for value lists, the list entries as entered by the user are used
+ return true;
+
+ // for every other type, the list entries are filled with some data obtained
+ // from a database - if and only if the ListSource property is not empty
+ return ( 0 == getScalarListSourceValue().getLength() );
+ }
+ }
+ catch( const Exception& )
+ {
+ OSL_FAIL( "OControlExport::controlHasUserSuppliedListEntries: caught an exception!" );
+ }
+
+ OSL_FAIL( "OControlExport::controlHasUserSuppliedListEntries: unreachable code!" );
+ // this method should be called for list and combo boxes only
+ return true;
+ }
+
+ //=====================================================================
+ //= OColumnExport
+ //=====================================================================
+ //---------------------------------------------------------------------
+ OColumnExport::OColumnExport(IFormsExportContext& _rContext, const Reference< XPropertySet >& _rxControl, const ::rtl::OUString& _rControlId,
+ const Sequence< ScriptEventDescriptor >& _rEvents)
+ :OControlExport(_rContext, _rxControl, _rControlId, ::rtl::OUString(), _rEvents)
+ {
+ }
+
+ //---------------------------------------------------------------------
+ OColumnExport::~OColumnExport()
+ {
+ implEndElement();
+ }
+
+ //---------------------------------------------------------------------
+ void OColumnExport::exportServiceNameAttribute()
+ {
+ // the attribute "service name" (which has a slightly different meaning for columns
+ DBG_CHECK_PROPERTY( PROPERTY_COLUMNSERVICENAME, ::rtl::OUString );
+ ::rtl::OUString sColumnServiceName;
+ m_xProps->getPropertyValue(PROPERTY_COLUMNSERVICENAME) >>= sColumnServiceName;
+ // the service name is a full qualified one (i.e. com.sun.star.form.TextField), but the
+ // real service name for the column (for use with the XGridColumnFactory) is only the last
+ // token of this complete name.
+ sal_Int32 nLastSep = sColumnServiceName.lastIndexOf('.');
+ OSL_ENSURE(-1 != nLastSep, "OColumnExport::startExportElement: invalid service name!");
+ sColumnServiceName = sColumnServiceName.copy(nLastSep + 1);
+ sColumnServiceName =
+ m_rContext.getGlobalContext().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_OOO, sColumnServiceName );
+ // add the attribute
+ AddAttribute( OAttributeMetaData::getCommonControlAttributeNamespace(CCA_SERVICE_NAME)
+ , OAttributeMetaData::getCommonControlAttributeName(CCA_SERVICE_NAME)
+ , sColumnServiceName);
+ // flag the property as "handled"
+ exportedProperty(PROPERTY_COLUMNSERVICENAME);
+
+ }
+
+ //---------------------------------------------------------------------
+ const sal_Char* OColumnExport::getOuterXMLElementName() const
+ {
+ return "column";
+ }
+
+ //---------------------------------------------------------------------
+ void OColumnExport::exportAttributes()
+ {
+ OControlExport::exportAttributes();
+
+ // the attribute "label"
+ exportStringPropertyAttribute(
+ OAttributeMetaData::getCommonControlAttributeNamespace(CCA_LABEL),
+ OAttributeMetaData::getCommonControlAttributeName(CCA_LABEL),
+ PROPERTY_LABEL);
+
+ // the style attribute
+ ::rtl::OUString sStyleName = m_rContext.getObjectStyleName( m_xProps );
+ if ( sStyleName.getLength() )
+ {
+ AddAttribute(
+ OAttributeMetaData::getSpecialAttributeNamespace( SCA_COLUMN_STYLE_NAME ),
+ OAttributeMetaData::getSpecialAttributeName( SCA_COLUMN_STYLE_NAME ),
+ sStyleName
+ );
+ }
+ }
+
+ //---------------------------------------------------------------------
+ void OColumnExport::examine()
+ {
+ OControlExport::examine();
+
+ // grid columns miss some properties of the controls they're representing
+ m_nIncludeCommon &= ~(CCA_FOR | CCA_PRINTABLE | CCA_TAB_INDEX | CCA_TAB_STOP | CCA_LABEL);
+ m_nIncludeSpecial &= ~(SCA_ECHO_CHAR | SCA_AUTOMATIC_COMPLETION | SCA_MULTIPLE | SCA_MULTI_LINE);
+
+ if (FormComponentType::DATEFIELD != m_nClassId)
+ // except date fields, no column has the DropDown property
+ m_nIncludeCommon &= ~CCA_DROPDOWN;
+ }
+
+ //=====================================================================
+ //= OFormExport
+ //=====================================================================
+ //---------------------------------------------------------------------
+ OFormExport::OFormExport(IFormsExportContext& _rContext, const Reference< XPropertySet >& _rxForm,
+ const Sequence< ScriptEventDescriptor >& _rEvents)
+ :OElementExport(_rContext, _rxForm, _rEvents)
+ ,m_bCreateConnectionResourceElement(sal_False)
+ {
+ OSL_ENSURE(m_xProps.is(), "OFormExport::OFormExport: invalid arguments!");
+ }
+
+ //---------------------------------------------------------------------
+ const sal_Char* OFormExport::getXMLElementName() const
+ {
+ return "form";
+ }
+
+ //---------------------------------------------------------------------
+ void OFormExport::exportSubTags()
+ {
+ if ( m_bCreateConnectionResourceElement && m_xProps.is() )
+ {
+ m_rContext.getGlobalContext().ClearAttrList();
+ ::rtl::OUString sPropValue;
+ m_xProps->getPropertyValue( PROPERTY_DATASOURCENAME ) >>= sPropValue; // if set it is a file url
+ if ( !sPropValue.getLength() )
+ m_xProps->getPropertyValue( PROPERTY_URL ) >>= sPropValue;
+ if ( sPropValue.getLength() )
+ AddAttribute(
+ OAttributeMetaData::getCommonControlAttributeNamespace(CCA_TARGET_LOCATION),
+ OAttributeMetaData::getCommonControlAttributeName(CCA_TARGET_LOCATION),
+ sPropValue);
+ if ( m_rContext.getGlobalContext().GetAttrList().getLength() )
+ {
+ SvXMLElementExport aFormElement(m_rContext.getGlobalContext(), XML_NAMESPACE_FORM, xmloff::token::XML_CONNECTION_RESOURCE, sal_True, sal_True);
+ }
+ }
+
+ // let the base class export the remaining properties and the events
+ OElementExport::exportSubTags();
+ // loop through all children
+ Reference< XIndexAccess > xCollection(m_xProps, UNO_QUERY);
+ OSL_ENSURE(xCollection.is(), "OFormLayerXMLExport::implExportForm: a form which is not an index access? Suspic�ous!");
+
+ if (xCollection.is())
+ m_rContext.exportCollectionElements(xCollection);
+ }
+
+ //---------------------------------------------------------------------
+ void OFormExport::exportAttributes()
+ {
+ sal_Int32 i=0;
+
+ // ---------------------
+ // the string properties
+ {
+ static FormAttributes eStringPropertyIds[] =
+ {
+ faName, /*faAction,*/ faCommand, faFilter, faOrder
+ };
+ static ::rtl::OUString aStringPropertyNames[] =
+ {
+ PROPERTY_NAME, /*PROPERTY_TARGETURL,*/ PROPERTY_COMMAND, PROPERTY_FILTER, PROPERTY_ORDER
+ };
+ sal_Int32 nIdCount = SAL_N_ELEMENTS(eStringPropertyIds);
+ #if OSL_DEBUG_LEVEL > 0
+ sal_Int32 nNameCount = SAL_N_ELEMENTS(aStringPropertyNames);
+ OSL_ENSURE((nIdCount == nNameCount),
+ "OFormExport::exportAttributes: somebody tampered with the maps (1)!");
+ #endif
+ for (i=0; i<nIdCount; ++i)
+ exportStringPropertyAttribute(
+ OAttributeMetaData::getFormAttributeNamespace(eStringPropertyIds[i]),
+ OAttributeMetaData::getFormAttributeName(eStringPropertyIds[i]),
+ aStringPropertyNames[i]);
+
+ // #i112082# xlink:type is added as part of exportTargetLocationAttribute
+
+ // now export the data source name or databaselocation or connection resource
+ ::rtl::OUString sPropValue;
+ m_xProps->getPropertyValue( PROPERTY_DATASOURCENAME ) >>= sPropValue;
+ m_bCreateConnectionResourceElement = !sPropValue.getLength();
+ if ( !m_bCreateConnectionResourceElement )
+ {
+ INetURLObject aURL(sPropValue);
+ m_bCreateConnectionResourceElement = ( aURL.GetProtocol() == INET_PROT_FILE );
+ if ( !m_bCreateConnectionResourceElement )
+ exportStringPropertyAttribute(
+ OAttributeMetaData::getFormAttributeNamespace(faDatasource),
+ OAttributeMetaData::getFormAttributeName(faDatasource),
+ PROPERTY_DATASOURCENAME);
+ }
+ else
+ exportedProperty(PROPERTY_URL);
+ if ( m_bCreateConnectionResourceElement )
+ exportedProperty(PROPERTY_DATASOURCENAME);
+ }
+
+ // ----------------------
+ // the boolean properties
+ {
+ static FormAttributes eBooleanPropertyIds[] =
+ {
+ faAllowDeletes, faAllowInserts, faAllowUpdates, faApplyFilter, faEscapeProcessing, faIgnoreResult
+ };
+ static const ::rtl::OUString* pBooleanPropertyNames[] =
+ {
+ &PROPERTY_ALLOWDELETES, &PROPERTY_ALLOWINSERTS, &PROPERTY_ALLOWUPDATES, &PROPERTY_APPLYFILTER, &PROPERTY_ESCAPEPROCESSING, &PROPERTY_IGNORERESULT
+ };
+ static sal_Int8 nBooleanPropertyAttrFlags[] =
+ {
+ BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_FALSE
+ };
+ sal_Int32 nIdCount = SAL_N_ELEMENTS(eBooleanPropertyIds);
+ #if OSL_DEBUG_LEVEL > 0
+ sal_Int32 nNameCount = SAL_N_ELEMENTS(pBooleanPropertyNames);
+ sal_Int32 nFlagsCount = SAL_N_ELEMENTS(nBooleanPropertyAttrFlags);
+ OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nFlagsCount),
+ "OFormExport::exportAttributes: somebody tampered with the maps (2)!");
+ #endif
+ for (i=0; i<nIdCount; ++i)
+ exportBooleanPropertyAttribute(
+ OAttributeMetaData::getFormAttributeNamespace(eBooleanPropertyIds[i]),
+ OAttributeMetaData::getFormAttributeName(eBooleanPropertyIds[i]),
+ *(pBooleanPropertyNames[i]),
+ nBooleanPropertyAttrFlags[i]
+ );
+ }
+
+ // -------------------
+ // the enum properties
+ {
+ static FormAttributes eEnumPropertyIds[] =
+ {
+ faEnctype, faMethod, faCommandType, faNavigationMode, faTabbingCycle
+ };
+ static const sal_Char* pEnumPropertyNames[] =
+ {
+ PROPERTY_SUBMIT_ENCODING, PROPERTY_SUBMIT_METHOD, PROPERTY_COMMAND_TYPE, PROPERTY_NAVIGATION, PROPERTY_CYCLE
+ };
+ static OEnumMapper::EnumProperties eEnumPropertyMaps[] =
+ {
+ OEnumMapper::epSubmitEncoding, OEnumMapper::epSubmitMethod, OEnumMapper::epCommandType, OEnumMapper::epNavigationType, OEnumMapper::epTabCyle
+ };
+ static sal_Int32 nEnumPropertyAttrDefaults[] =
+ {
+ FormSubmitEncoding_URL, FormSubmitMethod_GET, CommandType::COMMAND, NavigationBarMode_CURRENT, TabulatorCycle_RECORDS
+ };
+ static sal_Bool nEnumPropertyAttrDefaultFlags[] =
+ {
+ sal_False, sal_False, sal_False, sal_False, sal_True
+ };
+ sal_Int32 nIdCount = SAL_N_ELEMENTS(eEnumPropertyIds);
+ #if OSL_DEBUG_LEVEL > 0
+ sal_Int32 nNameCount = SAL_N_ELEMENTS(pEnumPropertyNames);
+ sal_Int32 nDefaultCount = SAL_N_ELEMENTS(nEnumPropertyAttrDefaults);
+ sal_Int32 nDefaultFlagCount = SAL_N_ELEMENTS(nEnumPropertyAttrDefaultFlags);
+ sal_Int32 nMapCount = SAL_N_ELEMENTS(eEnumPropertyMaps);
+ OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nDefaultCount) && (nDefaultCount == nDefaultFlagCount) && (nDefaultFlagCount == nMapCount),
+ "OFormExport::exportAttributes: somebody tampered with the maps (3)!");
+ #endif
+ for (i=0; i<nIdCount; ++i)
+ exportEnumPropertyAttribute(
+ OAttributeMetaData::getFormAttributeNamespace(eEnumPropertyIds[i]),
+ OAttributeMetaData::getFormAttributeName(eEnumPropertyIds[i]),
+ pEnumPropertyNames[i],
+ OEnumMapper::getEnumMap(eEnumPropertyMaps[i]),
+ nEnumPropertyAttrDefaults[i],
+ nEnumPropertyAttrDefaultFlags[i]
+ );
+ }
+
+ // the service name
+ exportServiceNameAttribute();
+ // the target frame
+ exportTargetFrameAttribute();
+ // the target URL
+ exportTargetLocationAttribute(true); // #i110911# add type attribute (for form, but not for control)
+
+ // master fields
+ exportStringSequenceAttribute(
+ OAttributeMetaData::getFormAttributeNamespace(faMasterFields),
+ OAttributeMetaData::getFormAttributeName(faMasterFields),
+ PROPERTY_MASTERFIELDS);
+ // detail fields
+ exportStringSequenceAttribute(
+ OAttributeMetaData::getFormAttributeNamespace(faDetailFiels),
+ OAttributeMetaData::getFormAttributeName(faDetailFiels),
+ PROPERTY_DETAILFIELDS);
+ }
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/elementexport.hxx b/xmloff/source/forms/elementexport.hxx
new file mode 100644
index 000000000000..979812b0c3ad
--- /dev/null
+++ b/xmloff/source/forms/elementexport.hxx
@@ -0,0 +1,331 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_ELEMENTEXPORT_HXX_
+#define _XMLOFF_ELEMENTEXPORT_HXX_
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/script/ScriptEventDescriptor.hpp>
+#include "propertyexport.hxx"
+#include "callbacks.hxx"
+#include "controlelement.hxx"
+#include "valueproperties.hxx"
+
+class SvXMLElementExport;
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ //=====================================================================
+ //= OElementExport
+ //=====================================================================
+ class OElementExport : public OPropertyExport
+ {
+ protected:
+ ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >
+ m_aEvents;
+
+ SvXMLElementExport* m_pXMLElement; // XML element doing the concrete startElement etc.
+
+ public:
+ OElementExport(IFormsExportContext& _rContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxProps,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& _rEvents);
+ virtual ~OElementExport();
+
+ void doExport();
+
+ protected:
+ /// get the name of the XML element
+ virtual const sal_Char* getXMLElementName() const = 0;
+ /// examine the element we're exporting
+ virtual void examine();
+ /// export the attributes
+ virtual void exportAttributes();
+ /// export any sub tags
+ virtual void exportSubTags();
+
+ /** exports the events (as script:events tag)
+ */
+ void exportEvents();
+
+ /** add the service-name attribute to the export context
+ */
+ virtual void exportServiceNameAttribute();
+
+ /// start the XML element
+ virtual void implStartElement(const sal_Char* _pName);
+
+ /// ends the XML element
+ virtual void implEndElement();
+ };
+
+ //=====================================================================
+ //= OControlExport
+ //=====================================================================
+ /** Helper class for handling xml elements representing a form control
+ */
+ class OControlExport
+ :public OControlElement
+ ,public OValuePropertiesMetaData
+ ,public OElementExport
+ {
+ protected:
+ DECLARE_STL_STDKEY_SET(sal_Int16, Int16Set);
+ // used below
+
+ ::rtl::OUString m_sControlId; // the control id to use when exporting
+ ::rtl::OUString m_sReferringControls; // list of referring controls (i.e. their id's)
+ sal_Int16 m_nClassId; // class id of the control we're representing
+ ElementType m_eType; // (XML) type of the control we're representing
+ sal_Int32 m_nIncludeCommon; // common control attributes to include
+ sal_Int32 m_nIncludeDatabase; // common database attributes to include
+ sal_Int32 m_nIncludeSpecial; // special attributes to include
+ sal_Int32 m_nIncludeEvents; // events to include
+ sal_Int32 m_nIncludeBindings; // binding attributes to include
+
+ SvXMLElementExport* m_pOuterElement; // XML element doing the concrete startElement etc. for the outer element
+
+ public:
+ /** constructs an object capable of exporting controls
+
+ <p>You need at least two pre-requisites from outside: The control to be exported needs to have a class id
+ assigned, and you need the list control-ids of all the controls referring to this one as LabelControl.<br/>
+ This information can't be collected when known only the control itself and not it's complete context.</p>
+
+ @param _rControlId
+ the control id to use when exporting the control
+ @param _rReferringControls
+ the comma-separated list of control-ids of all the controls referring to this one as LabelControl
+ */
+ OControlExport(IFormsExportContext& _rContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControl,
+ const ::rtl::OUString& _rControlId,
+ const ::rtl::OUString& _rReferringControls,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& _rxEvents);
+ ~OControlExport();
+
+ protected:
+ /// start the XML element
+ virtual void implStartElement(const sal_Char* _pName);
+
+ /// ends the XML element
+ virtual void implEndElement();
+
+ /// get the name of the outer XML element
+ virtual const sal_Char* getOuterXMLElementName() const;
+
+ // get the name of the XML element
+ virtual const sal_Char* getXMLElementName() const;
+
+ /** examine the control. Some kind of CtorImpl.
+ */
+ virtual void examine();
+
+ /// exports the attributes for the outer element
+ void exportOuterAttributes();
+
+ /// exports the attributes for the inner element
+ void exportInnerAttributes();
+
+ /// export the attributes
+ virtual void exportAttributes();
+
+ /** writes everything which needs to be represented as sub tag
+ */
+ void exportSubTags() throw (::com::sun::star::uno::Exception);
+
+ /** adds the attributes which are handled via generic IPropertyHandlers
+
+ <p>In the future, this really should be *all* attribiutes, instead of this shitload of
+ hand-crafted code we have currently ...</p>
+ */
+ void exportGenericHandlerAttributes();
+
+ /** adds common control attributes to the XMLExport context given
+
+ <p>The attribute list of the context is not cleared initially, this is the responsibility of the caller.</p>
+ */
+ void exportCommonControlAttributes();
+
+ /** adds database attributes to the XMLExport context given
+
+ <p>The attribute list of the context is not cleared initially, this is the responsibility of the caller.</p>
+ */
+ void exportDatabaseAttributes();
+
+ /** adds the XML attributes which are related to binding controls to
+ external values and/or list sources
+ */
+ void exportBindingAtributes();
+
+ /** adds attributes which are special to a control type to the export context's attribute list
+ */
+ void exportSpecialAttributes();
+
+ /** exports the ListSource property of a control as attribute
+
+ The ListSource property may be exported in different ways: For a ComboBox, it is an attribute
+ of the form:combobox element.
+
+ For a ListBox, it's an attribute if the ListSourceType states that the ListBox does <em>not</em>
+ display a value list. In case of a value list, the ListSource is not exported, and the pairs of
+ StringItem/ValueItem are exported as sub-elements.
+
+ This method does the attribute part: It exports the ListSource property as attribute, not caring
+ about whether the object is a ComboBox or a ListBox.
+ */
+ void exportListSourceAsAttribute();
+
+ /** exports the ListSource property of a control as XML elements
+
+ @see exportListSourceAsAttribute
+ */
+ void exportListSourceAsElements();
+
+ /** get's a Sequence&lt; sal_Int16 &gt; property value as set of sal_Int16's
+ @param _rPropertyName
+ the property name to use
+ @param _rOut
+ out parameter. The set of integers.
+ */
+ void getSequenceInt16PropertyAsSet(const ::rtl::OUString& _rPropertyName, Int16Set& _rOut);
+
+ /** exports the attribute which descrives a cell value binding of a control
+ in a spreadsheet document
+ */
+ void exportCellBindingAttributes( bool _bIncludeListLinkageType );
+
+ /** exports the attribute(s) which bind this control to XForms */
+ void exportXFormsBindAttributes();
+
+ /** exports the attribute(s) which bind the list of a list
+ control to XForms */
+ void exportXFormsListAttributes();
+
+ /** exports the attribute(s) for an XForms submission */
+ void exportXFormsSubmissionAttributes();
+
+ /** exports the attribute which descrives a cell range which acts as list source for
+ a list-like control
+ */
+ void exportCellListSourceRange( );
+
+ /** exports the attribut(s) for the ImagePosition property
+ */
+ void exportImagePositionAttributes();
+
+ /** determines whether the control we're exporting has an active data binding.
+
+ Bindings which count here are:
+ <ul><li>an established connection to a database field</li>
+ <li>a binding to an external value supplier (<type scope="com::sun::star::form::binding">XValueBinding</type>)</li>
+ </ul>
+ */
+ bool controlHasActiveDataBinding() const;
+
+ /** retrieves the string specifying the ListSource of a list or combo box
+ */
+ ::rtl::OUString getScalarListSourceValue() const;
+
+ /** determines whether the list entries (of a combo or list box) are supplied by the user
+
+ List entries may be
+ <ul><li>specified by the user</li>
+ <li>specified by an external list source (<type scope="com::sun::star::form::binding">XListEntrySource</type>)</li>
+ <li>obtained from a database query (in various ways)</li>
+ </ul>
+
+ In the latter two cases, this method will return <FALSE/>
+ */
+ bool controlHasUserSuppliedListEntries() const;
+ };
+
+ //=====================================================================
+ //= OColumnExport
+ //=====================================================================
+ /** Helper class for exporting a grid column
+ */
+ class OColumnExport : public OControlExport
+ {
+ public:
+ /** ctor
+ @see OColumnExport::OColumnExport
+ */
+ OColumnExport(IFormsExportContext& _rContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControl,
+ const ::rtl::OUString& _rControlId,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& _rxEvents);
+
+ ~OColumnExport();
+
+ protected:
+ // OControlExport overridables
+ virtual const sal_Char* getOuterXMLElementName() const;
+ virtual void exportServiceNameAttribute();
+ virtual void exportAttributes();
+
+ // OElementExport overridables
+ virtual void examine();
+ };
+
+ //=====================================================================
+ //= OFormExport
+ //=====================================================================
+ /** Helper class for handling xml elements representing a form
+
+ <p>In opposite to the class <type>OControlExport</type>, OFormExport is unable to export a <em>complete</em>
+ form. Instead the client has to care for sub elements of the form itself.</p>
+ */
+ class OFormExport
+ :public OControlElement
+ ,public OElementExport
+ {
+ sal_Bool m_bCreateConnectionResourceElement;
+ public:
+ /** constructs an object capable of exporting controls
+ */
+ OFormExport(IFormsExportContext& _rContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxForm,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& _rxEvents
+ );
+
+ protected:
+ virtual const sal_Char* getXMLElementName() const;
+ virtual void exportSubTags();
+ virtual void exportAttributes();
+ };
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+#endif // _XMLOFF_ELEMENTEXPORT_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/elementimport.cxx b/xmloff/source/forms/elementimport.cxx
new file mode 100644
index 000000000000..6104b64e20d4
--- /dev/null
+++ b/xmloff/source/forms/elementimport.cxx
@@ -0,0 +1,2232 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "elementimport.hxx"
+#include "xmloff/xmlimp.hxx"
+#include "xmloff/nmspmap.hxx"
+#include "xmloff/xmluconv.hxx"
+#include "strings.hxx"
+#include "callbacks.hxx"
+#include "attriblistmerge.hxx"
+#include "xmloff/xmlnmspe.hxx"
+#include "eventimport.hxx"
+#include "xmloff/txtstyli.hxx"
+#include "formenums.hxx"
+#include "xmloff/xmltoken.hxx"
+#include "gridcolumnproptranslator.hxx"
+#include "property_description.hxx"
+#include "property_meta_data.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/form/FormComponentType.hpp>
+#include <com/sun/star/awt/ImagePosition.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyContainer.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+/** === end UNO includes === **/
+
+#include <tools/urlobj.hxx>
+#include <tools/diagnose_ex.h>
+#include <tools/time.hxx>
+#include <rtl/logfile.hxx>
+#include <comphelper/extract.hxx>
+#include <comphelper/types.hxx>
+
+#include <algorithm>
+#include <functional>
+
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ using namespace ::xmloff::token;
+ using namespace ::com::sun::star;
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::awt;
+ using namespace ::com::sun::star::container;
+ using namespace ::com::sun::star::beans;
+ using namespace ::com::sun::star::script;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::form;
+ using namespace ::com::sun::star::xml;
+ using namespace ::com::sun::star::util;
+ using namespace ::com::sun::star::text;
+ using namespace ::comphelper;
+
+#define PROPID_VALUE 1
+#define PROPID_CURRENT_VALUE 2
+#define PROPID_MIN_VALUE 3
+#define PROPID_MAX_VALUE 4
+
+ //=====================================================================
+ struct PropertyValueLess
+ {
+ sal_Bool operator()(const PropertyValue& _rLeft, const PropertyValue& _rRight)
+ {
+ return _rLeft.Name < _rRight.Name;
+ }
+ };
+
+ //=====================================================================
+ struct PropertyValueCompare : public ::std::binary_function< PropertyValue, ::rtl::OUString, bool>
+ {
+ bool operator() (const PropertyValue& lhs, const ::rtl::OUString& rhs) const
+ {
+ return lhs.Name == rhs;
+ }
+ bool operator() (const ::rtl::OUString& lhs, const PropertyValue& rhs) const
+ {
+ return lhs == rhs.Name;
+ }
+ };
+
+ //=====================================================================
+ template <class ELEMENT>
+ void pushBackSequenceElement(Sequence< ELEMENT >& _rContainer, const ELEMENT& _rElement)
+ {
+ sal_Int32 nLen = _rContainer.getLength();
+ _rContainer.realloc(nLen + 1);
+ _rContainer[nLen] = _rElement;
+ }
+
+ //=====================================================================
+ //= OElementNameMap
+ //=====================================================================
+ //---------------------------------------------------------------------
+ OElementNameMap::MapString2Element OElementNameMap::s_sElementTranslations;
+
+ //---------------------------------------------------------------------
+ const OControlElement::ElementType& operator ++(OControlElement::ElementType& _e)
+ {
+ OControlElement::ElementType e = _e;
+ sal_Int32 nAsInt = static_cast<sal_Int32>(e);
+ _e = static_cast<OControlElement::ElementType>( ++nAsInt );
+ return _e;
+ }
+
+ //---------------------------------------------------------------------
+ OControlElement::ElementType OElementNameMap::getElementType(const ::rtl::OUString& _rName)
+ {
+ if ( s_sElementTranslations.empty() )
+ { // initialize
+ for (ElementType eType=(ElementType)0; eType<UNKNOWN; ++eType)
+ s_sElementTranslations[::rtl::OUString::createFromAscii(getElementName(eType))] = eType;
+ }
+ ConstMapString2ElementIterator aPos = s_sElementTranslations.find(_rName);
+ if (s_sElementTranslations.end() != aPos)
+ return aPos->second;
+
+ return UNKNOWN;
+ }
+
+ //=====================================================================
+ //= OElementImport
+ //=====================================================================
+ //---------------------------------------------------------------------
+ OElementImport::OElementImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const Reference< XNameContainer >& _rxParentContainer)
+ :OPropertyImport(_rImport, _nPrefix, _rName)
+ ,m_rFormImport(_rImport)
+ ,m_rEventManager(_rEventManager)
+ ,m_pStyleElement( NULL )
+ ,m_xParentContainer(_rxParentContainer)
+ ,m_bImplicitGenericAttributeHandling( true )
+ {
+ OSL_ENSURE(m_xParentContainer.is(), "OElementImport::OElementImport: invalid parent container!");
+ }
+
+ //---------------------------------------------------------------------
+ OElementImport::~OElementImport()
+ {
+ }
+
+ //---------------------------------------------------------------------
+ ::rtl::OUString OElementImport::determineDefaultServiceName() const
+ {
+ return ::rtl::OUString();
+ }
+
+ //---------------------------------------------------------------------
+ void OElementImport::StartElement(const Reference< sax::XAttributeList >& _rxAttrList)
+ {
+ ENTER_LOG_CONTEXT( "xmloff::OElementImport - importing one element" );
+
+ const SvXMLNamespaceMap& rMap = m_rContext.getGlobalContext().GetNamespaceMap();
+ const ::rtl::OUString sImplNameAttribute = rMap.GetQNameByKey( XML_NAMESPACE_FORM, GetXMLToken( XML_CONTROL_IMPLEMENTATION ) );
+ const ::rtl::OUString sControlImplementation = _rxAttrList->getValueByName( sImplNameAttribute );
+
+ // retrieve the service name
+ if ( sControlImplementation.getLength() > 0 )
+ {
+ ::rtl::OUString sOOoImplementationName;
+ const sal_uInt16 nImplPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sControlImplementation, &sOOoImplementationName );
+ m_sServiceName = ( nImplPrefix == XML_NAMESPACE_OOO ) ? sOOoImplementationName : sControlImplementation;
+ }
+
+ if ( !m_sServiceName.getLength() )
+ determineDefaultServiceName();
+
+ // create the object *now*. This allows setting properties in the various handleAttribute methods.
+ // (Though currently not all code is migrated to this pattern, most attributes are still handled
+ // by remembering the value (via implPushBackPropertyValue), and setting the correct property value
+ // later (in OControlImport::StartElement).)
+ m_xElement = createElement();
+ if ( m_xElement.is() )
+ m_xInfo = m_xElement->getPropertySetInfo();
+
+ // call the base class
+ OPropertyImport::StartElement( _rxAttrList );
+ }
+
+ //---------------------------------------------------------------------
+ SvXMLImportContext* OElementImport::CreateChildContext(sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
+ const Reference< sax::XAttributeList >& _rxAttrList)
+ {
+ if( token::IsXMLToken(_rLocalName, token::XML_EVENT_LISTENERS) && (XML_NAMESPACE_OFFICE == _nPrefix))
+ return new OFormEventsImportContext(m_rFormImport.getGlobalContext(), _nPrefix, _rLocalName, *this);
+
+ return OPropertyImport::CreateChildContext(_nPrefix, _rLocalName, _rxAttrList);
+ }
+
+ //---------------------------------------------------------------------
+ void OElementImport::EndElement()
+ {
+ OSL_ENSURE(m_xElement.is(), "OElementImport::EndElement: invalid element created!");
+ if (!m_xElement.is())
+ return;
+
+ // apply the non-generic properties
+ implApplySpecificProperties();
+
+ // set the generic properties
+ implApplyGenericProperties();
+
+ // set the style properties
+ if ( m_pStyleElement && m_xElement.is() )
+ {
+ Reference< XPropertySet > xPropTranslation =
+ new OGridColumnPropertyTranslator( Reference< XMultiPropertySet >( m_xElement, UNO_QUERY ) );
+ const_cast< XMLTextStyleContext* >( m_pStyleElement )->FillPropertySet( xPropTranslation );
+
+ const ::rtl::OUString sNumberStyleName = const_cast< XMLTextStyleContext* >( m_pStyleElement )->GetDataStyleName( );
+ if ( sNumberStyleName.getLength() )
+ // the style also has a number (sub) style
+ m_rContext.applyControlNumberStyle( m_xElement, sNumberStyleName );
+ }
+
+ // insert the element into the parent container
+ if (!m_sName.getLength())
+ {
+ OSL_FAIL("OElementImport::EndElement: did not find a name attribute!");
+ m_sName = implGetDefaultName();
+ }
+
+ if (m_xParentContainer.is())
+ m_xParentContainer->insertByName(m_sName, makeAny(m_xElement));
+
+ LEAVE_LOG_CONTEXT( );
+ }
+
+ //---------------------------------------------------------------------
+ void OElementImport::implApplySpecificProperties()
+ {
+ if ( m_aValues.empty() )
+ return;
+
+ // set all the properties we collected
+#if OSL_DEBUG_LEVEL > 0
+ // check if the object has all the properties
+ // (We do this in the non-pro version only. Doing it all the time would be much to expensive)
+ if ( m_xInfo.is() )
+ {
+ PropertyValueArray::const_iterator aEnd = m_aValues.end();
+ for ( PropertyValueArray::iterator aCheck = m_aValues.begin();
+ aCheck != aEnd;
+ ++aCheck
+ )
+ {
+ OSL_ENSURE(m_xInfo->hasPropertyByName(aCheck->Name),
+ ::rtl::OString("OElementImport::implApplySpecificProperties: read a property (")
+ += ::rtl::OString(aCheck->Name.getStr(), aCheck->Name.getLength(), RTL_TEXTENCODING_ASCII_US)
+ += ::rtl::OString(") which does not exist on the element!"));
+ }
+ }
+#endif
+
+ // set the properties
+ const Reference< XMultiPropertySet > xMultiProps(m_xElement, UNO_QUERY);
+ sal_Bool bSuccess = sal_False;
+ if (xMultiProps.is())
+ {
+ // translate our properties so that the XMultiPropertySet can handle them
+
+ // sort our property value array so that we can use it in a setPropertyValues
+ ::std::sort( m_aValues.begin(), m_aValues.end(), PropertyValueLess());
+
+ // the names
+ Sequence< ::rtl::OUString > aNames(m_aValues.size());
+ ::rtl::OUString* pNames = aNames.getArray();
+ // the values
+ Sequence< Any > aValues(m_aValues.size());
+ Any* pValues = aValues.getArray();
+ // copy
+
+ PropertyValueArray::iterator aEnd = m_aValues.end();
+ for ( PropertyValueArray::iterator aPropValues = m_aValues.begin();
+ aPropValues != aEnd;
+ ++aPropValues, ++pNames, ++pValues
+ )
+ {
+ *pNames = aPropValues->Name;
+ *pValues = aPropValues->Value;
+ }
+
+ try
+ {
+ xMultiProps->setPropertyValues(aNames, aValues);
+ bSuccess = sal_True;
+ }
+ catch(Exception&)
+ {
+ OSL_FAIL("OElementImport::implApplySpecificProperties: could not set the properties (using the XMultiPropertySet)!");
+ }
+ }
+
+ if (!bSuccess)
+ { // no XMultiPropertySet or setting all properties at once failed
+ PropertyValueArray::iterator aEnd = m_aValues.end();
+ for ( PropertyValueArray::iterator aPropValues = m_aValues.begin();
+ aPropValues != aEnd;
+ ++aPropValues
+ )
+ {
+ // this try/catch here is expensive, but because this is just a fallback which should normally not be
+ // used it's acceptable this way ...
+ try
+ {
+ m_xElement->setPropertyValue(aPropValues->Name, aPropValues->Value);
+ }
+ catch(Exception&)
+ {
+ OSL_FAIL(::rtl::OString("OElementImport::implApplySpecificProperties: could not set the property \"")
+ += ::rtl::OString(aPropValues->Name.getStr(), aPropValues->Name.getLength(), RTL_TEXTENCODING_ASCII_US)
+ += ::rtl::OString("\"!"));
+ }
+ }
+ }
+ }
+
+ //---------------------------------------------------------------------
+ void OElementImport::implApplyGenericProperties()
+ {
+ if ( m_aGenericValues.empty() )
+ return;
+
+ Reference< XPropertyContainer > xDynamicProperties( m_xElement, UNO_QUERY );
+
+ PropertyValueArray::iterator aEnd = m_aGenericValues.end();
+ for ( PropertyValueArray::iterator aPropValues =
+ m_aGenericValues.begin();
+ aPropValues != aEnd;
+ ++aPropValues
+ )
+ {
+ // check property type for numeric types before setting
+ // the property
+ try
+ {
+ // if such a property does not yet exist at the element, create it if necessary
+ const bool bExistentProperty = m_xInfo->hasPropertyByName( aPropValues->Name );
+ if ( !bExistentProperty )
+ {
+ if ( !xDynamicProperties.is() )
+ {
+ #if OSL_DEBUG_LEVEL > 0
+ ::rtl::OString aMessage( "OElementImport::implApplyGenericProperties: encountered an unknown property (" );
+ aMessage += ::rtl::OUStringToOString( aPropValues->Name, RTL_TEXTENCODING_ASCII_US );
+ aMessage += "), but component is no PropertyBag!";
+ OSL_FAIL( aMessage.getStr() );
+ #endif
+ continue;
+ }
+
+ xDynamicProperties->addProperty(
+ aPropValues->Name,
+ PropertyAttribute::BOUND | PropertyAttribute::REMOVEABLE,
+ aPropValues->Value
+ );
+
+ // re-fetch the PropertySetInfo
+ m_xInfo = m_xElement->getPropertySetInfo();
+ }
+
+ // determine the type of the value (source for the following conversion)
+ TypeClass eValueTypeClass = aPropValues->Value.getValueTypeClass();
+ const sal_Bool bValueIsSequence = TypeClass_SEQUENCE == eValueTypeClass;
+ if ( bValueIsSequence )
+ {
+ uno::Type aSimpleType( getSequenceElementType( aPropValues->Value.getValueType() ) );
+ eValueTypeClass = aSimpleType.getTypeClass();
+ }
+
+ // determine the type of the property (target for the following conversion)
+ const Property aProperty( m_xInfo->getPropertyByName( aPropValues->Name ) );
+ TypeClass ePropTypeClass = aProperty.Type.getTypeClass();
+ const sal_Bool bPropIsSequence = TypeClass_SEQUENCE == ePropTypeClass;
+ if( bPropIsSequence )
+ {
+ uno::Type aSimpleType( ::comphelper::getSequenceElementType( aProperty.Type ) );
+ ePropTypeClass = aSimpleType.getTypeClass();
+ }
+
+ if ( bPropIsSequence != bValueIsSequence )
+ {
+ OSL_FAIL( "OElementImport::implImportGenericProperties: either both value and property should be a sequence, or none of them!" );
+ continue;
+ }
+
+ if ( bValueIsSequence )
+ {
+ OSL_ENSURE( eValueTypeClass == TypeClass_ANY,
+ "OElementImport::implApplyGenericProperties: only ANYs should have been imported as generic list property!" );
+ // (OPropertyImport should produce only Sequencer< Any >, since it cannot know the real type
+
+ OSL_ENSURE( ePropTypeClass == TypeClass_SHORT,
+ "OElementImport::implApplyGenericProperties: conversion to sequences other than 'sequence< short >' not implemented, yet!" );
+
+ Sequence< Any > aXMLValueList;
+ aPropValues->Value >>= aXMLValueList;
+ Sequence< sal_Int16 > aPropertyValueList( aXMLValueList.getLength() );
+
+ const Any* pXMLValue = aXMLValueList.getConstArray();
+ sal_Int16* pPropValue = aPropertyValueList.getArray();
+
+ for ( sal_Int32 i=0; i<aXMLValueList.getLength(); ++i, ++pXMLValue, ++pPropValue )
+ {
+ // only value sequences of numeric types implemented so far.
+ double nVal( 0 );
+ OSL_VERIFY( *pXMLValue >>= nVal );
+ *pPropValue = static_cast< sal_Int16 >( nVal );
+ }
+
+ aPropValues->Value <<= aPropertyValueList;
+ }
+ else if ( ePropTypeClass != eValueTypeClass )
+ {
+ switch ( eValueTypeClass )
+ {
+ case TypeClass_DOUBLE:
+ {
+ double nVal = 0;
+ aPropValues->Value >>= nVal;
+ switch( ePropTypeClass )
+ {
+ case TypeClass_BYTE:
+ aPropValues->Value <<= static_cast< sal_Int8 >( nVal );
+ break;
+ case TypeClass_SHORT:
+ aPropValues->Value <<= static_cast< sal_Int16 >( nVal );
+ break;
+ case TypeClass_LONG:
+ case TypeClass_ENUM:
+ aPropValues->Value <<= static_cast< sal_Int32 >( nVal );
+ break;
+ case TypeClass_HYPER:
+ aPropValues->Value <<= static_cast< sal_Int64 >( nVal );
+ break;
+ default:
+ OSL_FAIL( "OElementImport::implImportGenericProperties: unsupported value type!" );
+ break;
+ }
+ }
+ break;
+ default:
+ OSL_FAIL( "OElementImport::implImportGenericProperties: non-double values not supported!" );
+ break;
+ }
+ }
+
+ m_xElement->setPropertyValue( aPropValues->Name, aPropValues->Value );
+ }
+ catch(Exception&)
+ {
+ OSL_FAIL(::rtl::OString("OElementImport::EndElement: could not set the property \"")
+ += ::rtl::OString(aPropValues->Name.getStr(), aPropValues->Name.getLength(), RTL_TEXTENCODING_ASCII_US)
+ += ::rtl::OString("\"!"));
+ }
+ }
+ }
+
+ //---------------------------------------------------------------------
+ ::rtl::OUString OElementImport::implGetDefaultName() const
+ {
+ // no optimization here. If this method gets called, the XML stream did not contain a name for the
+ // element, which is a heavy error. So in this case we don't care for performance
+ Sequence< ::rtl::OUString > aNames = m_xParentContainer->getElementNames();
+ static const ::rtl::OUString sUnnamedName(RTL_CONSTASCII_USTRINGPARAM("unnamed"));
+
+ ::rtl::OUString sReturn;
+ const ::rtl::OUString* pNames = NULL;
+ const ::rtl::OUString* pNamesEnd = aNames.getConstArray() + aNames.getLength();
+ for (sal_Int32 i=0; i<32768; ++i) // the limit is nearly arbitrary ...
+ {
+ // assemble the new name (suggestion)
+ sReturn = sUnnamedName;
+ sReturn += ::rtl::OUString::valueOf(i);
+ // check the existence (this is the bad performance part ....)
+ for (pNames = aNames.getConstArray(); pNames<pNamesEnd; ++pNames)
+ {
+ if (*pNames == sReturn)
+ {
+ break;
+ }
+ }
+ if (pNames<pNamesEnd)
+ // found the name
+ continue;
+ return sReturn;
+ }
+ OSL_FAIL("OElementImport::implGetDefaultName: did not find a free name!");
+ return sUnnamedName;
+ }
+
+ //---------------------------------------------------------------------
+ PropertyGroups::const_iterator OElementImport::impl_matchPropertyGroup( const PropertyGroups& i_propertyGroups ) const
+ {
+ ENSURE_OR_RETURN( m_xInfo.is(), "OElementImport::impl_matchPropertyGroup: no property set info!", i_propertyGroups.end() );
+
+ for ( PropertyGroups::const_iterator group = i_propertyGroups.begin();
+ group != i_propertyGroups.end();
+ ++group
+ )
+ {
+ bool missingProp = false;
+ for ( PropertyDescriptionList::const_iterator prop = group->begin();
+ prop != group->end();
+ ++prop
+ )
+ {
+ if ( !m_xInfo->hasPropertyByName( (*prop)->propertyName ) )
+ {
+ missingProp = true;
+ break;
+ }
+ }
+
+ if ( missingProp )
+ // try next group
+ continue;
+
+ return group;
+ }
+
+ return i_propertyGroups.end();
+ }
+
+ //---------------------------------------------------------------------
+ bool OElementImport::tryGenericAttribute( sal_uInt16 _nNamespaceKey, const ::rtl::OUString& _rLocalName, const ::rtl::OUString& _rValue )
+ {
+ // the generic approach (which I hope all props will be migrated to, on the medium term): property handlers
+ const AttributeDescription attribute( metadata::getAttributeDescription( _nNamespaceKey, _rLocalName ) );
+ if ( attribute.attributeToken != XML_TOKEN_INVALID )
+ {
+ PropertyGroups propertyGroups;
+ metadata::getPropertyGroupList( attribute, propertyGroups );
+ const PropertyGroups::const_iterator pos = impl_matchPropertyGroup( propertyGroups );
+ if ( pos == propertyGroups.end() )
+ return false;
+
+ do
+ {
+ const PropertyDescriptionList& rProperties( *pos );
+ const PropertyDescription* first = *rProperties.begin();
+ ENSURE_OR_BREAK( first != NULL, "OElementImport::handleAttribute: invalid property description!" );
+ const PPropertyHandler handler = (*first->factory)( first->propertyId );
+ ENSURE_OR_BREAK( handler.get() != NULL, "OElementImport::handleAttribute: invalid property handler!" );
+
+ PropertyValues aValues;
+ for ( PropertyDescriptionList::const_iterator propDesc = rProperties.begin();
+ propDesc != rProperties.end();
+ ++propDesc
+ )
+ {
+ aValues[ (*propDesc)->propertyId ] = Any();
+ }
+ if ( handler->getPropertyValues( _rValue, aValues ) )
+ {
+ for ( PropertyDescriptionList::const_iterator propDesc = rProperties.begin();
+ propDesc != rProperties.end();
+ ++propDesc
+ )
+ {
+ implPushBackPropertyValue( (*propDesc)->propertyName, aValues[ (*propDesc)->propertyId ] );
+ }
+ }
+ }
+ while ( false );
+
+ // handled
+ return true;
+ }
+ return false;
+ }
+
+ //---------------------------------------------------------------------
+ bool OElementImport::handleAttribute(sal_uInt16 _nNamespaceKey, const ::rtl::OUString& _rLocalName, const ::rtl::OUString& _rValue)
+ {
+ if ( token::IsXMLToken( _rLocalName, token::XML_CONTROL_IMPLEMENTATION ) )
+ // ignore this, it has already been handled in OElementImport::StartElement
+ return true;
+
+ if ( token::IsXMLToken( _rLocalName, token::XML_NAME ) )
+ {
+ if ( !m_sName.getLength() )
+ // remember the name for later use in EndElement
+ m_sName = _rValue;
+ return true;
+ }
+
+ // maybe it's the style attribute?
+ if ( token::IsXMLToken( _rLocalName, token::XML_TEXT_STYLE_NAME ) )
+ {
+ const SvXMLStyleContext* pStyleContext = m_rContext.getStyleElement( _rValue );
+ OSL_ENSURE( pStyleContext, "OElementImport::handleAttribute: do not know the style!" );
+ // remember the element for later usage.
+ m_pStyleElement = PTR_CAST( XMLTextStyleContext, pStyleContext );
+ return true;
+ }
+
+ if ( m_bImplicitGenericAttributeHandling )
+ if ( tryGenericAttribute( _nNamespaceKey, _rLocalName, _rValue ) )
+ return true;
+
+ // let the base class handle it
+ return OPropertyImport::handleAttribute(_nNamespaceKey, _rLocalName, _rValue);
+ }
+
+ //---------------------------------------------------------------------
+ Reference< XPropertySet > OElementImport::createElement()
+ {
+ Reference< XPropertySet > xReturn;
+ if (m_sServiceName.getLength())
+ {
+ Reference< XInterface > xPure = m_rFormImport.getGlobalContext().getServiceFactory()->createInstance(m_sServiceName);
+ OSL_ENSURE(xPure.is(),
+ ::rtl::OString("OElementImport::createElement: service factory gave me no object (service name: ")
+ += ::rtl::OString(m_sServiceName.getStr(), m_sServiceName.getLength(), RTL_TEXTENCODING_ASCII_US)
+ += ::rtl::OString(")!"));
+ xReturn = Reference< XPropertySet >(xPure, UNO_QUERY);
+ }
+ else
+ OSL_FAIL("OElementImport::createElement: no service name to create an element!");
+
+ return xReturn;
+ }
+
+ //---------------------------------------------------------------------
+ void OElementImport::registerEvents(const Sequence< ScriptEventDescriptor >& _rEvents)
+ {
+ OSL_ENSURE(m_xElement.is(), "OElementImport::registerEvents: no element to register events for!");
+ m_rEventManager.registerEvents(m_xElement, _rEvents);
+ }
+
+ //---------------------------------------------------------------------
+ void OElementImport::simulateDefaultedAttribute(const sal_Char* _pAttributeName, const ::rtl::OUString& _rPropertyName, const sal_Char* _pAttributeDefault)
+ {
+ OSL_ENSURE( m_xInfo.is(), "OPropertyImport::simulateDefaultedAttribute: the component should be more gossipy about it's properties!" );
+
+ if ( !m_xInfo.is() || m_xInfo->hasPropertyByName( _rPropertyName ) )
+ {
+ ::rtl::OUString sLocalAttrName = ::rtl::OUString::createFromAscii(_pAttributeName);
+ if ( !encounteredAttribute( sLocalAttrName ) )
+ OSL_VERIFY( handleAttribute( XML_NAMESPACE_FORM, sLocalAttrName, ::rtl::OUString::createFromAscii( _pAttributeDefault ) ) );
+ }
+ }
+
+ //=====================================================================
+ //= OControlImport
+ //=====================================================================
+ //---------------------------------------------------------------------
+ OControlImport::OControlImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const Reference< XNameContainer >& _rxParentContainer)
+ :OElementImport(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer)
+ ,m_eElementType(OControlElement::UNKNOWN)
+ {
+ disableImplicitGenericAttributeHandling();
+ }
+
+ //---------------------------------------------------------------------
+ OControlImport::OControlImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const Reference< XNameContainer >& _rxParentContainer, OControlElement::ElementType _eType)
+ :OElementImport(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer)
+ ,m_eElementType(_eType)
+ {
+ disableImplicitGenericAttributeHandling();
+ }
+
+ //---------------------------------------------------------------------
+ ::rtl::OUString OControlImport::determineDefaultServiceName() const
+ {
+ const sal_Char* pServiceName = NULL;
+ switch ( m_eElementType )
+ {
+ case OControlElement::TEXT:
+ case OControlElement::TEXT_AREA:
+ case OControlElement::PASSWORD: pServiceName = "com.sun.star.form.component.TextField"; break;
+ case OControlElement::FILE: pServiceName = "com.sun.star.form.component.FileControl"; break;
+ case OControlElement::FORMATTED_TEXT: pServiceName = "com.sun.star.form.component.FormattedField"; break;
+ case OControlElement::FIXED_TEXT: pServiceName = "com.sun.star.form.component.FixedText"; break;
+ case OControlElement::COMBOBOX: pServiceName = "com.sun.star.form.component.ComboBox"; break;
+ case OControlElement::LISTBOX: pServiceName = "com.sun.star.form.component.ListBox"; break;
+ case OControlElement::BUTTON: pServiceName = "com.sun.star.form.component.CommandButton"; break;
+ case OControlElement::IMAGE: pServiceName = "com.sun.star.form.component.ImageButton"; break;
+ case OControlElement::CHECKBOX: pServiceName = "com.sun.star.form.component.CheckBox"; break;
+ case OControlElement::RADIO: pServiceName = "com.sun.star.form.component.RadioButton"; break;
+ case OControlElement::FRAME: pServiceName = "com.sun.star.form.component.GroupBox"; break;
+ case OControlElement::IMAGE_FRAME: pServiceName = "com.sun.star.form.component.DatabaseImageControl"; break;
+ case OControlElement::HIDDEN: pServiceName = "com.sun.star.form.component.HiddenControl"; break;
+ case OControlElement::GRID: pServiceName = "com.sun.star.form.component.GridControl"; break;
+ case OControlElement::TIME: pServiceName = "com.sun.star.form.component.DateField"; break;
+ case OControlElement::DATE: pServiceName = "com.sun.star.form.component.TimeField"; break;
+ default: break;
+ }
+ if ( pServiceName != NULL )
+ return ::rtl::OUString::createFromAscii( pServiceName );
+ return ::rtl::OUString();
+ }
+
+ //---------------------------------------------------------------------
+ void OControlImport::addOuterAttributes(const Reference< sax::XAttributeList >& _rxOuterAttribs)
+ {
+ OSL_ENSURE(!m_xOuterAttributes.is(), "OControlImport::addOuterAttributes: already have these attributes!");
+ m_xOuterAttributes = _rxOuterAttribs;
+ }
+
+ //---------------------------------------------------------------------
+ bool OControlImport::handleAttribute(sal_uInt16 _nNamespaceKey, const ::rtl::OUString& _rLocalName, const ::rtl::OUString& _rValue)
+ {
+ static const sal_Char* pLinkedCellAttributeName = OAttributeMetaData::getBindingAttributeName(BA_LINKED_CELL);
+
+ if (IsXMLToken(_rLocalName, XML_ID))
+ { // it's the control id
+ if (XML_NAMESPACE_XML == _nNamespaceKey)
+ {
+ m_sControlId = _rValue;
+ }
+ else if (XML_NAMESPACE_FORM == _nNamespaceKey)
+ {
+ if (!m_sControlId.getLength())
+ {
+ m_sControlId = _rValue;
+ }
+ }
+ return true;
+ }
+
+ if ( _rLocalName.equalsAscii( pLinkedCellAttributeName ) )
+ { // it's the address of a spreadsheet cell
+ m_sBoundCellAddress = _rValue;
+ return true;
+ }
+
+ if ( _nNamespaceKey == XML_NAMESPACE_XFORMS && IsXMLToken( _rLocalName, XML_BIND ) )
+ {
+ m_sBindingID = _rValue;
+ return true;
+ }
+
+ if ( _nNamespaceKey == XML_NAMESPACE_FORM && IsXMLToken( _rLocalName, XML_XFORMS_LIST_SOURCE ) )
+ {
+ m_sListBindingID = _rValue;
+ return true;
+ }
+
+ if ( ( ( _nNamespaceKey == XML_NAMESPACE_FORM )
+ && IsXMLToken( _rLocalName, XML_XFORMS_SUBMISSION )
+ )
+ || ( ( _nNamespaceKey == XML_NAMESPACE_XFORMS )
+ && IsXMLToken( _rLocalName, XML_SUBMISSION )
+ )
+ )
+ {
+ m_sSubmissionID = _rValue;
+ return true;
+ }
+
+ if ( OElementImport::tryGenericAttribute( _nNamespaceKey, _rLocalName, _rValue ) )
+ return true;
+
+ static const sal_Char* pValueAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCA_VALUE);
+ static const sal_Char* pCurrentValueAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCA_CURRENT_VALUE);
+ static const sal_Char* pMinValueAttributeName = OAttributeMetaData::getSpecialAttributeName(SCA_MIN_VALUE);
+ static const sal_Char* pMaxValueAttributeName = OAttributeMetaData::getSpecialAttributeName(SCA_MAX_VALUE);
+ static const sal_Char* pRepeatDelayAttributeName = OAttributeMetaData::getSpecialAttributeName( SCA_REPEAT_DELAY );
+
+ sal_Int32 nHandle = -1;
+ if ( _rLocalName.equalsAscii( pValueAttributeName ) )
+ nHandle = PROPID_VALUE;
+ else if ( _rLocalName.equalsAscii( pCurrentValueAttributeName ) )
+ nHandle = PROPID_CURRENT_VALUE;
+ else if ( _rLocalName.equalsAscii( pMinValueAttributeName ) )
+ nHandle = PROPID_MIN_VALUE;
+ else if ( _rLocalName.equalsAscii( pMaxValueAttributeName ) )
+ nHandle = PROPID_MAX_VALUE;
+ if ( nHandle != -1 )
+ {
+ // for the moment, simply remember the name and the value
+ PropertyValue aProp;
+ aProp.Name = _rLocalName;
+ aProp.Handle = nHandle;
+ aProp.Value <<= _rValue;
+ m_aValueProperties.push_back(aProp);
+ return true;
+ }
+
+ if ( _rLocalName.equalsAscii( pRepeatDelayAttributeName ) )
+ {
+ ::Time aTime;
+ sal_Int32 nFractions = 0;
+ if ( SvXMLUnitConverter::convertTimeDuration( _rValue, aTime, &nFractions ) )
+ {
+ PropertyValue aProp;
+ aProp.Name = PROPERTY_REPEAT_DELAY;
+ aProp.Value <<= (sal_Int32)( ( ( aTime.GetMSFromTime() / 1000 ) * 1000 ) + nFractions );
+
+ implPushBackPropertyValue(aProp);
+ }
+ return true;
+ }
+
+ return OElementImport::handleAttribute( _nNamespaceKey, _rLocalName, _rValue );
+ }
+
+ //---------------------------------------------------------------------
+ void OControlImport::StartElement(const Reference< sax::XAttributeList >& _rxAttrList)
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > xAttributes;
+ if( m_xOuterAttributes.is() )
+ {
+ // merge the attribute lists
+ OAttribListMerger* pMerger = new OAttribListMerger;
+ // our own one
+ pMerger->addList(_rxAttrList);
+ // and the ones of our enclosing element
+ pMerger->addList(m_xOuterAttributes);
+ xAttributes = pMerger;
+ }
+ else
+ {
+ xAttributes = _rxAttrList;
+ }
+
+ // let the base class handle all the attributes
+ OElementImport::StartElement(xAttributes);
+
+ if ( !m_aValueProperties.empty() && m_xElement.is())
+ {
+ // get the property set info
+ if (!m_xInfo.is())
+ {
+ OSL_FAIL("OControlImport::StartElement: no PropertySetInfo!");
+ return;
+ }
+
+ const sal_Char* pValueProperty = NULL;
+ const sal_Char* pCurrentValueProperty = NULL;
+ const sal_Char* pMinValueProperty = NULL;
+ const sal_Char* pMaxValueProperty = NULL;
+
+ sal_Bool bRetrievedValues = sal_False;
+ sal_Bool bRetrievedValueLimits = sal_False;
+
+ // get the class id of our element
+ sal_Int16 nClassId = FormComponentType::CONTROL;
+ m_xElement->getPropertyValue(PROPERTY_CLASSID) >>= nClassId;
+
+ // translate the value properties we collected in handleAttributes
+ PropertyValueArray::iterator aEnd = m_aValueProperties.end();
+ for ( PropertyValueArray::iterator aValueProps = m_aValueProperties.begin();
+ aValueProps != aEnd;
+ ++aValueProps
+ )
+ {
+ bool bSuccess = false;
+ switch (aValueProps->Handle)
+ {
+ case PROPID_VALUE:
+ case PROPID_CURRENT_VALUE:
+ {
+ // get the property names
+ if (!bRetrievedValues)
+ {
+ getValuePropertyNames(m_eElementType, nClassId, pCurrentValueProperty, pValueProperty);
+ ENSURE_OR_BREAK( pCurrentValueProperty || pValueProperty, "OControlImport::StartElement: illegal value property names!" );
+ bRetrievedValues = sal_True;
+ }
+ OSL_ENSURE((PROPID_VALUE != aValueProps->Handle) || pValueProperty,
+ "OControlImport::StartElement: the control does not have a value property!");
+ OSL_ENSURE((PROPID_CURRENT_VALUE != aValueProps->Handle) || pCurrentValueProperty,
+ "OControlImport::StartElement: the control does not have a current-value property!");
+
+ // transfer the name
+ if (PROPID_VALUE == aValueProps->Handle)
+ aValueProps->Name = ::rtl::OUString::createFromAscii(pValueProperty);
+ else
+ aValueProps->Name = ::rtl::OUString::createFromAscii(pCurrentValueProperty);
+ bSuccess = true;
+ }
+ break;
+ case PROPID_MIN_VALUE:
+ case PROPID_MAX_VALUE:
+ {
+ // get the property names
+ if (!bRetrievedValueLimits)
+ {
+ getValueLimitPropertyNames(nClassId, pMinValueProperty, pMaxValueProperty);
+ ENSURE_OR_BREAK( pMinValueProperty && pMaxValueProperty, "OControlImport::StartElement: illegal value limit property names!" );
+ bRetrievedValueLimits = sal_True;
+ }
+ OSL_ENSURE((PROPID_MIN_VALUE != aValueProps->Handle) || pMinValueProperty,
+ "OControlImport::StartElement: the control does not have a value property!");
+ OSL_ENSURE((PROPID_MAX_VALUE != aValueProps->Handle) || pMaxValueProperty,
+ "OControlImport::StartElement: the control does not have a current-value property!");
+
+ // transfer the name
+ if (PROPID_MIN_VALUE == aValueProps->Handle)
+ aValueProps->Name = ::rtl::OUString::createFromAscii(pMinValueProperty);
+ else
+ aValueProps->Name = ::rtl::OUString::createFromAscii(pMaxValueProperty);
+ bSuccess = true;
+ }
+ break;
+ }
+
+ if ( !bSuccess )
+ continue;
+
+ // translate the value
+ implTranslateValueProperty(m_xInfo, *aValueProps);
+ // add the property to the base class' array
+ implPushBackPropertyValue(*aValueProps);
+ }
+ }
+ }
+
+ //---------------------------------------------------------------------
+ void OControlImport::implTranslateValueProperty(const Reference< XPropertySetInfo >& _rxPropInfo,
+ PropertyValue& _rPropValue)
+ {
+ OSL_ENSURE(_rxPropInfo->hasPropertyByName(_rPropValue.Name),
+ "OControlImport::implTranslateValueProperty: invalid property name!");
+
+ // retrieve the type of the property
+ Property aProp = _rxPropInfo->getPropertyByName(_rPropValue.Name);
+ // the untranslated string value as read in handleAttribute
+ ::rtl::OUString sValue;
+ #if OSL_DEBUG_LEVEL > 0
+ sal_Bool bSuccess =
+ #endif
+ _rPropValue.Value >>= sValue;
+ OSL_ENSURE(bSuccess, "OControlImport::implTranslateValueProperty: supposed to be called with non-translated string values!");
+
+ if (TypeClass_ANY == aProp.Type.getTypeClass())
+ {
+ // we have exactly 2 properties where this type class is allowed:
+ OSL_ENSURE(
+ (0 == _rPropValue.Name.compareToAscii(PROPERTY_EFFECTIVE_VALUE))
+ || (0 == _rPropValue.Name.compareToAscii(PROPERTY_EFFECTIVE_DEFAULT)),
+ "OControlImport::implTranslateValueProperty: invalid property type/name combination!");
+
+ // Both properties are allowed to have a double or a string value,
+ // so first try to convert the string into a number
+ double nValue;
+ if (GetImport().GetMM100UnitConverter().convertDouble(nValue, sValue))
+ _rPropValue.Value <<= nValue;
+ else
+ _rPropValue.Value <<= sValue;
+ }
+ else
+ _rPropValue.Value = PropertyConversion::convertString(GetImport(), aProp.Type, sValue);
+ }
+
+ //---------------------------------------------------------------------
+ void OControlImport::EndElement()
+ {
+ OSL_ENSURE(m_xElement.is(), "OControlImport::EndElement: invalid control!");
+ if ( !m_xElement.is() )
+ return;
+
+ // register our control with it's id
+ if (m_sControlId.getLength())
+ m_rFormImport.registerControlId(m_xElement, m_sControlId);
+ // it's allowed to have no control id. In this case we're importing a column
+
+ // one more pre-work to do:
+ // when we set default values, then by definition the respective value is set
+ // to this default value, too. This means if the sequence contains for example
+ // a DefaultText value, then the Text will be affected by this, too.
+ // In case the Text is not part of the property sequence (or occurs _before_
+ // the DefaultText, which can happen for other value/default-value property names),
+ // this means that the Text (the value property) is incorrectly imported.
+
+ sal_Bool bRestoreValuePropertyValue = sal_False;
+ Any aValuePropertyValue;
+
+ sal_Int16 nClassId = FormComponentType::CONTROL;
+ try
+ {
+ // get the class id of our element
+ m_xElement->getPropertyValue(PROPERTY_CLASSID) >>= nClassId;
+ }
+ catch( const Exception& )
+ {
+ OSL_FAIL( "OControlImport::EndElement: caught an exception while retrieving the class id!" );
+ }
+
+ const sal_Char* pValueProperty = NULL;
+ const sal_Char* pDefaultValueProperty = NULL;
+ getRuntimeValuePropertyNames(m_eElementType, nClassId, pValueProperty, pDefaultValueProperty);
+ if ( pDefaultValueProperty && pValueProperty )
+ {
+ sal_Bool bNonDefaultValuePropertyValue = sal_False;
+ // is the "value property" part of the sequence?
+
+ // look up this property in our sequence
+ PropertyValueArray::iterator aEnd = m_aValues.end();
+ for ( PropertyValueArray::iterator aCheck = m_aValues.begin();
+ ( aCheck != aEnd );
+ ++aCheck
+ )
+ {
+ if ( aCheck->Name.equalsAscii( pDefaultValueProperty ) )
+ bRestoreValuePropertyValue = sal_True;
+ else if ( aCheck->Name.equalsAscii( pValueProperty ) )
+ {
+ bNonDefaultValuePropertyValue = sal_True;
+ // we need to restore the value property we found here, nothing else
+ aValuePropertyValue = aCheck->Value;
+ }
+ }
+
+ if ( bRestoreValuePropertyValue && !bNonDefaultValuePropertyValue )
+ {
+ // found it -> need to remember (and restore) the "value property value", which is not set explicitly
+ try
+ {
+ aValuePropertyValue = m_xElement->getPropertyValue( ::rtl::OUString::createFromAscii( pValueProperty ) );
+ }
+ catch( const Exception& )
+ {
+ OSL_FAIL( "OControlImport::EndElement: caught an exception while retrieving the current value property!" );
+ }
+ }
+ }
+
+ // let the base class set all the values
+ OElementImport::EndElement();
+
+ // restore the "value property value", if necessary
+ if ( bRestoreValuePropertyValue && pValueProperty )
+ {
+ try
+ {
+ m_xElement->setPropertyValue( ::rtl::OUString::createFromAscii( pValueProperty ), aValuePropertyValue );
+ }
+ catch( const Exception& )
+ {
+ OSL_FAIL( "OControlImport::EndElement: caught an exception while restoring the value property!" );
+ }
+ }
+
+ // the external cell binding, if applicable
+ if ( m_xElement.is() && m_sBoundCellAddress.getLength() )
+ doRegisterCellValueBinding( m_sBoundCellAddress );
+
+ // XForms binding, if applicable
+ if ( m_xElement.is() && m_sBindingID.getLength() )
+ doRegisterXFormsValueBinding( m_sBindingID );
+
+ // XForms list binding, if applicable
+ if ( m_xElement.is() && m_sListBindingID.getLength() )
+ doRegisterXFormsListBinding( m_sListBindingID );
+
+ // XForms submission, if applicable
+ if ( m_xElement.is() && m_sSubmissionID.getLength() )
+ doRegisterXFormsSubmission( m_sSubmissionID );
+ }
+
+ //---------------------------------------------------------------------
+ void OControlImport::doRegisterCellValueBinding( const ::rtl::OUString& _rBoundCellAddress )
+ {
+ OSL_PRECOND( m_xElement.is(), "OControlImport::doRegisterCellValueBinding: invalid element!" );
+ OSL_PRECOND( _rBoundCellAddress.getLength(),
+ "OControlImport::doRegisterCellValueBinding: invalid address!" );
+
+ m_rContext.registerCellValueBinding( m_xElement, _rBoundCellAddress );
+ }
+
+ //---------------------------------------------------------------------
+ void OControlImport::doRegisterXFormsValueBinding( const ::rtl::OUString& _rBindingID )
+ {
+ OSL_PRECOND( m_xElement.is(), "need element" );
+ OSL_PRECOND( _rBindingID.getLength() > 0, "binding ID is not valid" );
+
+ m_rContext.registerXFormsValueBinding( m_xElement, _rBindingID );
+ }
+
+ //---------------------------------------------------------------------
+ void OControlImport::doRegisterXFormsListBinding( const ::rtl::OUString& _rBindingID )
+ {
+ OSL_PRECOND( m_xElement.is(), "need element" );
+ OSL_PRECOND( _rBindingID.getLength() > 0, "binding ID is not valid" );
+
+ m_rContext.registerXFormsListBinding( m_xElement, _rBindingID );
+ }
+
+ //---------------------------------------------------------------------
+ void OControlImport::doRegisterXFormsSubmission( const ::rtl::OUString& _rSubmissionID )
+ {
+ OSL_PRECOND( m_xElement.is(), "need element" );
+ OSL_PRECOND( _rSubmissionID.getLength() > 0, "binding ID is not valid" );
+
+ m_rContext.registerXFormsSubmission( m_xElement, _rSubmissionID );
+ }
+
+ //---------------------------------------------------------------------
+
+ Reference< XPropertySet > OControlImport::createElement()
+ {
+ const Reference<XPropertySet> xPropSet = OElementImport::createElement();
+ if ( xPropSet.is() )
+ {
+ m_xInfo = xPropSet->getPropertySetInfo();
+ if ( m_xInfo.is() && m_xInfo->hasPropertyByName(PROPERTY_ALIGN) )
+ {
+ Any aValue;
+ xPropSet->setPropertyValue(PROPERTY_ALIGN,aValue);
+ }
+ }
+ return xPropSet;
+ }
+
+ //=====================================================================
+ //= OImagePositionImport
+ //=====================================================================
+ //---------------------------------------------------------------------
+ OImagePositionImport::OImagePositionImport( OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager,
+ sal_uInt16 _nPrefix, const ::rtl::OUString& _rName, const Reference< XNameContainer >& _rxParentContainer,
+ OControlElement::ElementType _eType )
+ :OControlImport( _rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer, _eType )
+ ,m_nImagePosition( -1 )
+ ,m_nImageAlign( 0 )
+ ,m_bHaveImagePosition( sal_False )
+ {
+ }
+
+ //---------------------------------------------------------------------
+ bool OImagePositionImport::handleAttribute( sal_uInt16 _nNamespaceKey, const ::rtl::OUString& _rLocalName,
+ const ::rtl::OUString& _rValue )
+ {
+ if ( _rLocalName == GetXMLToken( XML_IMAGE_POSITION ) )
+ {
+ OSL_VERIFY( PropertyConversion::convertString(
+ m_rContext.getGlobalContext(), ::getCppuType( &m_nImagePosition ),
+ _rValue, OEnumMapper::getEnumMap( OEnumMapper::epImagePosition )
+ ) >>= m_nImagePosition );
+ m_bHaveImagePosition = sal_True;
+ return true;
+ }
+
+ if ( _rLocalName == GetXMLToken( XML_IMAGE_ALIGN ) )
+ {
+ OSL_VERIFY( PropertyConversion::convertString(
+ m_rContext.getGlobalContext(), ::getCppuType( &m_nImageAlign ),
+ _rValue, OEnumMapper::getEnumMap( OEnumMapper::epImageAlign )
+ ) >>= m_nImageAlign );
+ return true;
+ }
+
+ return OControlImport::handleAttribute( _nNamespaceKey, _rLocalName, _rValue );
+ }
+
+ //---------------------------------------------------------------------
+ void OImagePositionImport::StartElement(const Reference< sax::XAttributeList >& _rxAttrList)
+ {
+ OControlImport::StartElement( _rxAttrList );
+
+ if ( m_bHaveImagePosition )
+ {
+ sal_Int16 nUnoImagePosition = ImagePosition::Centered;
+ if ( m_nImagePosition >= 0 )
+ {
+ OSL_ENSURE( ( m_nImagePosition <= 3 ) && ( m_nImageAlign >= 0 ) && ( m_nImageAlign < 3 ),
+ "OImagePositionImport::StartElement: unknown image align and/or position!" );
+ nUnoImagePosition = m_nImagePosition * 3 + m_nImageAlign;
+ }
+
+ PropertyValue aImagePosition;
+ aImagePosition.Name = PROPERTY_IMAGE_POSITION;
+ aImagePosition.Value <<= nUnoImagePosition;
+ implPushBackPropertyValue( aImagePosition );
+ }
+ }
+
+ //=====================================================================
+ //= OReferredControlImport
+ //=====================================================================
+ //---------------------------------------------------------------------
+ OReferredControlImport::OReferredControlImport(
+ OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const Reference< XNameContainer >& _rxParentContainer,
+ OControlElement::ElementType )
+ :OControlImport(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer)
+ {
+ }
+
+ //---------------------------------------------------------------------
+ void OReferredControlImport::StartElement(const Reference< sax::XAttributeList >& _rxAttrList)
+ {
+ OControlImport::StartElement(_rxAttrList);
+
+ // the base class should have created the control, so we can register it
+ if ( m_sReferringControls.getLength() )
+ m_rFormImport.registerControlReferences(m_xElement, m_sReferringControls);
+ }
+
+ //---------------------------------------------------------------------
+ bool OReferredControlImport::handleAttribute(sal_uInt16 _nNamespaceKey, const ::rtl::OUString& _rLocalName,
+ const ::rtl::OUString& _rValue)
+ {
+ static const ::rtl::OUString s_sReferenceAttributeName = ::rtl::OUString::createFromAscii(OAttributeMetaData::getCommonControlAttributeName(CCA_FOR));
+ if (_rLocalName == s_sReferenceAttributeName)
+ {
+ m_sReferringControls = _rValue;
+ return true;
+ }
+ return OControlImport::handleAttribute(_nNamespaceKey, _rLocalName, _rValue);
+ }
+
+ //=====================================================================
+ //= OPasswordImport
+ //=====================================================================
+ //---------------------------------------------------------------------
+ OPasswordImport::OPasswordImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const Reference< XNameContainer >& _rxParentContainer, OControlElement::ElementType _eType)
+ :OControlImport(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer, _eType)
+ {
+ }
+
+ //---------------------------------------------------------------------
+ bool OPasswordImport::handleAttribute(sal_uInt16 _nNamespaceKey, const ::rtl::OUString& _rLocalName, const ::rtl::OUString& _rValue)
+ {
+ static const ::rtl::OUString s_sEchoCharAttributeName = ::rtl::OUString::createFromAscii(OAttributeMetaData::getSpecialAttributeName(SCA_ECHO_CHAR));
+ if (_rLocalName == s_sEchoCharAttributeName)
+ {
+ // need a special handling for the EchoChar property
+ PropertyValue aEchoChar;
+ aEchoChar.Name = PROPERTY_ECHOCHAR;
+ OSL_ENSURE(_rValue.getLength() == 1, "OPasswordImport::handleAttribute: invalid echo char attribute!");
+ // we ourself should not have written values other than of length 1
+ if (_rValue.getLength() >= 1)
+ aEchoChar.Value <<= (sal_Int16)_rValue.getStr()[0];
+ else
+ aEchoChar.Value <<= (sal_Int16)0;
+ implPushBackPropertyValue(aEchoChar);
+ return true;
+ }
+ return OControlImport::handleAttribute(_nNamespaceKey, _rLocalName, _rValue);
+ }
+
+ //=====================================================================
+ //= ORadioImport
+ //=====================================================================
+ //---------------------------------------------------------------------
+ ORadioImport::ORadioImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const Reference< XNameContainer >& _rxParentContainer, OControlElement::ElementType _eType)
+ :OImagePositionImport( _rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer, _eType )
+ {
+ }
+
+ //---------------------------------------------------------------------
+ bool ORadioImport::handleAttribute(sal_uInt16 _nNamespaceKey, const ::rtl::OUString& _rLocalName, const ::rtl::OUString& _rValue)
+ {
+ // need special handling for the State & CurrentState properties:
+ // they're stored as booleans, but expected to be int16 properties
+ static const sal_Char* pCurrentSelectedAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCA_CURRENT_SELECTED);
+ static const sal_Char* pSelectedAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCA_SELECTED);
+ if ( _rLocalName.equalsAscii( pCurrentSelectedAttributeName )
+ || _rLocalName.equalsAscii( pSelectedAttributeName )
+ )
+ {
+ const OAttribute2Property::AttributeAssignment* pProperty = m_rContext.getAttributeMap().getAttributeTranslation(_rLocalName);
+ OSL_ENSURE(pProperty, "ORadioImport::handleAttribute: invalid property map!");
+ if (pProperty)
+ {
+ const Any aBooleanValue( PropertyConversion::convertString(m_rContext.getGlobalContext(), pProperty->aPropertyType, _rValue, pProperty->pEnumMap) );
+
+ // create and store a new PropertyValue
+ PropertyValue aNewValue;
+ aNewValue.Name = pProperty->sPropertyName;
+ aNewValue.Value <<= (sal_Int16)::cppu::any2bool(aBooleanValue);
+
+ implPushBackPropertyValue(aNewValue);
+ }
+ return true;
+ }
+ return OImagePositionImport::handleAttribute( _nNamespaceKey, _rLocalName, _rValue );
+ }
+
+ //=====================================================================
+ //= OURLReferenceImport
+ //=====================================================================
+ OURLReferenceImport::OURLReferenceImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const Reference< XNameContainer >& _rxParentContainer,
+ OControlElement::ElementType _eType)
+ :OImagePositionImport(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer, _eType)
+ {
+ }
+
+ //---------------------------------------------------------------------
+ bool OURLReferenceImport::handleAttribute(sal_uInt16 _nNamespaceKey, const ::rtl::OUString& _rLocalName, const ::rtl::OUString& _rValue)
+ {
+ static const sal_Char* s_pTargetLocationAttributeName = OAttributeMetaData::getCommonControlAttributeName( CCA_TARGET_LOCATION );
+ static const sal_Char* s_pImageDataAttributeName = OAttributeMetaData::getCommonControlAttributeName( CCA_IMAGE_DATA );
+
+ // need to make the URL absolute if
+ // * it's the image-data attribute
+ // * it's the target-location attribute, and we're dealign with an object which has the respective property
+ sal_Bool bMakeAbsolute =
+ ( 0 == _rLocalName.compareToAscii( s_pImageDataAttributeName ) )
+ || ( ( 0 == _rLocalName.compareToAscii( s_pTargetLocationAttributeName ) )
+ && ( ( OControlElement::BUTTON == m_eElementType )
+ || ( OControlElement::IMAGE == m_eElementType )
+ )
+ );
+
+ if ( bMakeAbsolute && ( _rValue.getLength() > 0 ) )
+ {
+ // make a global URL out of the local one
+ ::rtl::OUString sAdjustedValue;
+ // only resolve image related url
+ // we don't want say form url targets to be resolved
+ // using ResolveGraphicObjectURL
+ if ( 0 == _rLocalName.compareToAscii( s_pImageDataAttributeName ) )
+ sAdjustedValue = m_rContext.getGlobalContext().ResolveGraphicObjectURL( _rValue, sal_False );
+ else
+ sAdjustedValue = m_rContext.getGlobalContext().GetAbsoluteReference( _rValue );
+ return OImagePositionImport::handleAttribute( _nNamespaceKey, _rLocalName, sAdjustedValue );
+ }
+
+ return OImagePositionImport::handleAttribute( _nNamespaceKey, _rLocalName, _rValue );
+ }
+
+ //=====================================================================
+ //= OButtonImport
+ //=====================================================================
+ //---------------------------------------------------------------------
+ OButtonImport::OButtonImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const Reference< XNameContainer >& _rxParentContainer,
+ OControlElement::ElementType _eType)
+ :OURLReferenceImport(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer, _eType)
+ {
+ enableTrackAttributes();
+ }
+
+ //---------------------------------------------------------------------
+ void OButtonImport::StartElement(const Reference< sax::XAttributeList >& _rxAttrList)
+ {
+ OURLReferenceImport::StartElement(_rxAttrList);
+
+ // handle the target-frame attribute
+ simulateDefaultedAttribute(OAttributeMetaData::getCommonControlAttributeName(CCA_TARGET_FRAME), PROPERTY_TARGETFRAME, "_blank");
+ }
+
+ //=====================================================================
+ //= OValueRangeImport
+ //=====================================================================
+ //---------------------------------------------------------------------
+ OValueRangeImport::OValueRangeImport( OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const Reference< XNameContainer >& _rxParentContainer, OControlElement::ElementType _eType )
+ :OControlImport( _rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer, _eType )
+ ,m_nStepSizeValue( 1 )
+ {
+
+ }
+
+ //---------------------------------------------------------------------
+ bool OValueRangeImport::handleAttribute( sal_uInt16 _nNamespaceKey, const ::rtl::OUString& _rLocalName, const ::rtl::OUString& _rValue )
+ {
+ if ( _rLocalName.equalsAscii( OAttributeMetaData::getSpecialAttributeName( SCA_STEP_SIZE ) ) )
+ {
+ GetImport().GetMM100UnitConverter().convertNumber( m_nStepSizeValue, _rValue );
+ return true;
+ }
+ return OControlImport::handleAttribute( _nNamespaceKey, _rLocalName, _rValue );
+ }
+
+ //---------------------------------------------------------------------
+ void OValueRangeImport::StartElement( const Reference< sax::XAttributeList >& _rxAttrList )
+ {
+ OControlImport::StartElement( _rxAttrList );
+
+ if ( m_xInfo.is() )
+ {
+ if ( m_xInfo->hasPropertyByName( PROPERTY_SPIN_INCREMENT ) )
+ m_xElement->setPropertyValue( PROPERTY_SPIN_INCREMENT, makeAny( m_nStepSizeValue ) );
+ else if ( m_xInfo->hasPropertyByName( PROPERTY_LINE_INCREMENT ) )
+ m_xElement->setPropertyValue( PROPERTY_LINE_INCREMENT, makeAny( m_nStepSizeValue ) );
+ }
+ }
+
+ //=====================================================================
+ //= OTextLikeImport
+ //=====================================================================
+ //---------------------------------------------------------------------
+ OTextLikeImport::OTextLikeImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const Reference< XNameContainer >& _rxParentContainer,
+ OControlElement::ElementType _eType)
+ :OControlImport(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer, _eType)
+ ,m_bEncounteredTextPara( false )
+ {
+ enableTrackAttributes();
+ }
+
+ //---------------------------------------------------------------------
+ SvXMLImportContext* OTextLikeImport::CreateChildContext( sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
+ const Reference< sax::XAttributeList >& _rxAttrList )
+ {
+ if ( ( XML_NAMESPACE_TEXT == _nPrefix ) && _rLocalName.equalsIgnoreAsciiCaseAscii( "p" ) )
+ {
+ OSL_ENSURE( m_eElementType == OControlElement::TEXT_AREA,
+ "OTextLikeImport::CreateChildContext: text paragraphs in a non-text-area?" );
+
+ if ( m_eElementType == OControlElement::TEXT_AREA )
+ {
+ Reference< XText > xTextElement( m_xElement, UNO_QUERY );
+ if ( xTextElement.is() )
+ {
+ UniReference < XMLTextImportHelper > xTextImportHelper( m_rContext.getGlobalContext().GetTextImport() );
+
+ if ( !m_xCursor.is() )
+ {
+ m_xOldCursor = xTextImportHelper->GetCursor();
+ m_xCursor = xTextElement->createTextCursor();
+
+ if ( m_xCursor.is() )
+ xTextImportHelper->SetCursor( m_xCursor );
+ }
+ if ( m_xCursor.is() )
+ {
+ m_bEncounteredTextPara = true;
+ return xTextImportHelper->CreateTextChildContext( m_rContext.getGlobalContext(), _nPrefix, _rLocalName, _rxAttrList );
+ }
+ }
+ else
+ {
+ // in theory, we could accumulate all the text portions (without formatting),
+ // and set it as Text property at the model ...
+ }
+ }
+ }
+
+ return OControlImport::CreateChildContext( _nPrefix, _rLocalName, _rxAttrList );
+ }
+
+ //---------------------------------------------------------------------
+ void OTextLikeImport::StartElement(const Reference< sax::XAttributeList >& _rxAttrList)
+ {
+ OControlImport::StartElement(_rxAttrList);
+
+ // handle the convert-empty-to-null attribute, whose default is different from the property default
+ // unfortunately, different classes are imported by this class ('cause they're represented by the
+ // same XML element), though not all of them know this property.
+ // So we have to do a check ...
+ if (m_xElement.is() && m_xInfo.is() && m_xInfo->hasPropertyByName(PROPERTY_EMPTY_IS_NULL) )
+ simulateDefaultedAttribute(OAttributeMetaData::getDatabaseAttributeName(DA_CONVERT_EMPTY), PROPERTY_EMPTY_IS_NULL, "false");
+ }
+
+ //---------------------------------------------------------------------
+ struct EqualHandle : public ::std::unary_function< PropertyValue, bool >
+ {
+ const sal_Int32 m_nHandle;
+ EqualHandle( sal_Int32 _nHandle ) : m_nHandle( _nHandle ) { }
+
+ inline bool operator()( const PropertyValue& _rProp )
+ {
+ return _rProp.Handle == m_nHandle;
+ }
+ };
+
+ //---------------------------------------------------------------------
+ void OTextLikeImport::removeRedundantCurrentValue()
+ {
+ if ( m_bEncounteredTextPara )
+ {
+ // In case the text is written in the text:p elements, we need to ignore what we read as
+ // current-value attribute, since it's redundant.
+ // fortunately, OElementImport tagged the value property with the PROPID_CURRENT_VALUE
+ // handle, so we do not need to determine the name of our value property here
+ // (normally, it should be "Text", since no other controls than the edit field should
+ // have the text:p elements)
+ PropertyValueArray::iterator aValuePropertyPos = ::std::find_if(
+ m_aValues.begin(),
+ m_aValues.end(),
+ EqualHandle( PROPID_CURRENT_VALUE )
+ );
+ if ( aValuePropertyPos != m_aValues.end() )
+ {
+ OSL_ENSURE( aValuePropertyPos->Name == PROPERTY_TEXT, "OTextLikeImport::EndElement: text:p was present, but our value property is *not* 'Text'!" );
+ if ( aValuePropertyPos->Name == PROPERTY_TEXT )
+ {
+ ::std::copy(
+ aValuePropertyPos + 1,
+ m_aValues.end(),
+ aValuePropertyPos
+ );
+ m_aValues.resize( m_aValues.size() - 1 );
+ }
+ }
+
+ // additionally, we need to set the "RichText" property of our element to sal_True
+ // (the presence of the text:p is used as indicator for the value of the RichText property)
+ sal_Bool bHasRichTextProperty = sal_False;
+ if ( m_xInfo.is() )
+ bHasRichTextProperty = m_xInfo->hasPropertyByName( PROPERTY_RICH_TEXT );
+ OSL_ENSURE( bHasRichTextProperty, "OTextLikeImport::EndElement: text:p, but no rich text control?" );
+ if ( bHasRichTextProperty )
+ m_xElement->setPropertyValue( PROPERTY_RICH_TEXT, makeAny( (sal_Bool)sal_True ) );
+ }
+ // Note that we do *not* set the RichText property (in case our element has one) to sal_False here
+ // since this is the default of this property, anyway.
+ }
+
+ //---------------------------------------------------------------------
+ struct EqualName : public ::std::unary_function< PropertyValue, bool >
+ {
+ const ::rtl::OUString m_sName;
+ EqualName( const ::rtl::OUString& _rName ) : m_sName( _rName ) { }
+
+ inline bool operator()( const PropertyValue& _rProp )
+ {
+ return _rProp.Name == m_sName;
+ }
+ };
+
+ //---------------------------------------------------------------------
+ void OTextLikeImport::adjustDefaultControlProperty()
+ {
+ // In OpenOffice.org 2.0, we changed the implementation of the css.form.component.TextField (the model of a text field control),
+ // so that it now uses another default control. So if we encounter a text field where the *old* default
+ // control property is writting, we are not allowed to use it
+ PropertyValueArray::iterator aDefaultControlPropertyPos = ::std::find_if(
+ m_aValues.begin(),
+ m_aValues.end(),
+ EqualName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultControl" ) ) )
+ );
+ if ( aDefaultControlPropertyPos != m_aValues.end() )
+ {
+ ::rtl::OUString sDefaultControl;
+ OSL_VERIFY( aDefaultControlPropertyPos->Value >>= sDefaultControl );
+ if ( sDefaultControl.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "stardiv.one.form.control.Edit" ) ) )
+ {
+ // complete remove this property value from the array. Today's "default value" of the "DefaultControl"
+ // property is sufficient
+ ::std::copy(
+ aDefaultControlPropertyPos + 1,
+ m_aValues.end(),
+ aDefaultControlPropertyPos
+ );
+ m_aValues.resize( m_aValues.size() - 1 );
+ }
+ }
+ }
+
+ //---------------------------------------------------------------------
+ void OTextLikeImport::EndElement()
+ {
+ removeRedundantCurrentValue();
+ adjustDefaultControlProperty();
+
+ // let the base class do the stuff
+ OControlImport::EndElement();
+
+ // some cleanups
+ UniReference < XMLTextImportHelper > xTextImportHelper( m_rContext.getGlobalContext().GetTextImport() );
+ if ( m_xCursor.is() )
+ {
+ // delete the newline which has been imported errornously
+ // TODO (fs): stole this code somewhere - why don't we fix the text import??
+ m_xCursor->gotoEnd( sal_False );
+ m_xCursor->goLeft( 1, sal_True );
+ m_xCursor->setString( ::rtl::OUString() );
+
+ // reset cursor
+ xTextImportHelper->ResetCursor();
+ }
+
+ if ( m_xOldCursor.is() )
+ xTextImportHelper->SetCursor( m_xOldCursor );
+
+ }
+
+ //=====================================================================
+ //= OListAndComboImport
+ //=====================================================================
+ //---------------------------------------------------------------------
+ OListAndComboImport::OListAndComboImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const Reference< XNameContainer >& _rxParentContainer,
+ OControlElement::ElementType _eType)
+ :OControlImport(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer, _eType)
+ ,m_nEmptyListItems( 0 )
+ ,m_nEmptyValueItems( 0 )
+ ,m_bEncounteredLSAttrib( sal_False )
+ ,m_bLinkWithIndexes( sal_False )
+ {
+ if (OControlElement::COMBOBOX == m_eElementType)
+ enableTrackAttributes();
+ }
+
+ //---------------------------------------------------------------------
+ SvXMLImportContext* OListAndComboImport::CreateChildContext(sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
+ const Reference< sax::XAttributeList >& _rxAttrList)
+ {
+ // is it the "option" sub tag of a listbox ?
+ static const ::rtl::OUString s_sOptionElementName(RTL_CONSTASCII_USTRINGPARAM("option"));
+ if (s_sOptionElementName == _rLocalName)
+ return new OListOptionImport(GetImport(), _nPrefix, _rLocalName, this);
+
+ // is it the "item" sub tag of a combobox ?
+ static const ::rtl::OUString s_sItemElementName(RTL_CONSTASCII_USTRINGPARAM("item"));
+ if (s_sItemElementName == _rLocalName)
+ return new OComboItemImport(GetImport(), _nPrefix, _rLocalName, this);
+
+ // everything else
+ return OControlImport::CreateChildContext(_nPrefix, _rLocalName, _rxAttrList);
+ }
+
+ //---------------------------------------------------------------------
+ void OListAndComboImport::StartElement(const Reference< sax::XAttributeList >& _rxAttrList)
+ {
+ m_bLinkWithIndexes = sal_False;
+
+ OControlImport::StartElement(_rxAttrList);
+
+ if (OControlElement::COMBOBOX == m_eElementType)
+ {
+ // for the auto-completion
+ // the attribute default does not equal the property default, so in case we did not read this attribute,
+ // we have to simulate it
+ simulateDefaultedAttribute( OAttributeMetaData::getSpecialAttributeName( SCA_AUTOMATIC_COMPLETION ), PROPERTY_AUTOCOMPLETE, "false");
+
+ // same for the convert-empty-to-null attribute, which's default is different from the property default
+ simulateDefaultedAttribute( OAttributeMetaData::getDatabaseAttributeName( DA_CONVERT_EMPTY ), PROPERTY_EMPTY_IS_NULL, "false");
+ }
+ }
+
+ //---------------------------------------------------------------------
+ void OListAndComboImport::EndElement()
+ {
+ // append the list source property the the properties sequence of our importer
+ // the string item list
+ PropertyValue aItemList;
+ aItemList.Name = PROPERTY_STRING_ITEM_LIST;
+ aItemList.Value <<= m_aListSource;
+ implPushBackPropertyValue(aItemList);
+
+ if (OControlElement::LISTBOX == m_eElementType)
+ {
+ OSL_ENSURE((m_aListSource.getLength() + m_nEmptyListItems) == (m_aValueList.getLength() + m_nEmptyValueItems),
+ "OListAndComboImport::EndElement: inconsistence between labels and values!");
+
+ if ( !m_bEncounteredLSAttrib )
+ {
+ // the value sequence
+ PropertyValue aValueList;
+ aValueList.Name = PROPERTY_LISTSOURCE;
+ aValueList.Value <<= m_aValueList;
+ implPushBackPropertyValue(aValueList);
+ }
+
+ // the select sequence
+ PropertyValue aSelected;
+ aSelected.Name = PROPERTY_SELECT_SEQ;
+ aSelected.Value <<= m_aSelectedSeq;
+ implPushBackPropertyValue(aSelected);
+
+ // the default select sequence
+ PropertyValue aDefaultSelected;
+ aDefaultSelected.Name = PROPERTY_DEFAULT_SELECT_SEQ;
+ aDefaultSelected.Value <<= m_aDefaultSelectedSeq;
+ implPushBackPropertyValue(aDefaultSelected);
+ }
+
+ OControlImport::EndElement();
+
+ // the external list source, if applicable
+ if ( m_xElement.is() && m_sCellListSource.getLength() )
+ m_rContext.registerCellRangeListSource( m_xElement, m_sCellListSource );
+ }
+
+ //---------------------------------------------------------------------
+ void OListAndComboImport::doRegisterCellValueBinding( const ::rtl::OUString& _rBoundCellAddress )
+ {
+ ::rtl::OUString sBoundCellAddress( _rBoundCellAddress );
+ if ( m_bLinkWithIndexes )
+ {
+ // This is a HACK. We register a string which is no valid address, but allows
+ // (somewhere else) to determine that a non-standard binding should be created.
+ // This hack is acceptable for OOo 1.1.1, since the file format for value
+ // bindings of form controls is to be changed afterwards, anyway.
+ sBoundCellAddress += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ":index" ) );
+ }
+
+ OControlImport::doRegisterCellValueBinding( sBoundCellAddress );
+ }
+
+ //---------------------------------------------------------------------
+ bool OListAndComboImport::handleAttribute(sal_uInt16 _nNamespaceKey, const ::rtl::OUString& _rLocalName, const ::rtl::OUString& _rValue)
+ {
+ static const sal_Char* pListSourceAttributeName = OAttributeMetaData::getDatabaseAttributeName(DA_LIST_SOURCE);
+ if ( _rLocalName.equalsAscii(pListSourceAttributeName) )
+ {
+ PropertyValue aListSource;
+ aListSource.Name = PROPERTY_LISTSOURCE;
+
+ // it's the ListSource attribute
+ m_bEncounteredLSAttrib = sal_True;
+ if ( OControlElement::COMBOBOX == m_eElementType )
+ {
+ aListSource.Value <<= _rValue;
+ }
+ else
+ {
+ // a listbox which has a list-source attribute must have a list-source-type of something
+ // not equal to ValueList.
+ // In this case, the list-source value is simply the one and only element of the ListSource property.
+ Sequence< ::rtl::OUString > aListSourcePropValue( 1 );
+ aListSourcePropValue[0] = _rValue;
+ aListSource.Value <<= aListSourcePropValue;
+ }
+
+ implPushBackPropertyValue( aListSource );
+ return true;
+ }
+
+ if ( _rLocalName.equalsAscii( OAttributeMetaData::getBindingAttributeName( BA_LIST_CELL_RANGE ) ) )
+ {
+ m_sCellListSource = _rValue;
+ return true;
+ }
+
+ if ( _rLocalName.equalsAscii( OAttributeMetaData::getBindingAttributeName( BA_LIST_LINKING_TYPE ) ) )
+ {
+ sal_Int16 nLinkageType = 0;
+ PropertyConversion::convertString(
+ m_rContext.getGlobalContext(),
+ ::getCppuType( static_cast< sal_Int16* >( NULL ) ),
+ _rValue,
+ OEnumMapper::getEnumMap( OEnumMapper::epListLinkageType )
+ ) >>= nLinkageType;
+
+ m_bLinkWithIndexes = ( nLinkageType != 0 );
+ return true;
+ }
+
+ return OControlImport::handleAttribute(_nNamespaceKey, _rLocalName, _rValue);
+ }
+
+ //---------------------------------------------------------------------
+ void OListAndComboImport::implPushBackLabel(const ::rtl::OUString& _rLabel)
+ {
+ OSL_ENSURE(!m_nEmptyListItems, "OListAndComboImport::implPushBackValue: label list is already done!");
+ if (!m_nEmptyListItems)
+ pushBackSequenceElement(m_aListSource, _rLabel);
+ }
+
+ //---------------------------------------------------------------------
+ void OListAndComboImport::implPushBackValue(const ::rtl::OUString& _rValue)
+ {
+ OSL_ENSURE(!m_nEmptyValueItems, "OListAndComboImport::implPushBackValue: value list is already done!");
+ if (!m_nEmptyValueItems)
+ {
+ OSL_ENSURE( !m_bEncounteredLSAttrib, "OListAndComboImport::implPushBackValue: invalid structure! Did you save this document with a version prior SRC641 m?" );
+ // We already had the list-source attribute, which means that the ListSourceType is
+ // not ValueList, which means that the ListSource should contain only one string in
+ // the first element of the sequence
+ // All other values in the file are invalid
+
+ pushBackSequenceElement( m_aValueList, _rValue );
+ }
+ }
+
+ //---------------------------------------------------------------------
+ void OListAndComboImport::implEmptyLabelFound()
+ {
+ ++m_nEmptyListItems;
+ }
+
+ //---------------------------------------------------------------------
+ void OListAndComboImport::implEmptyValueFound()
+ {
+ ++m_nEmptyValueItems;
+ }
+
+ //---------------------------------------------------------------------
+ void OListAndComboImport::implSelectCurrentItem()
+ {
+ OSL_ENSURE((m_aListSource.getLength() + m_nEmptyListItems) == (m_aValueList.getLength() + m_nEmptyValueItems),
+ "OListAndComboImport::implSelectCurrentItem: inconsistence between labels and values!");
+
+ sal_Int16 nItemNumber = (sal_Int16)(m_aListSource.getLength() - 1 + m_nEmptyListItems);
+ pushBackSequenceElement(m_aSelectedSeq, nItemNumber);
+ }
+
+ //---------------------------------------------------------------------
+ void OListAndComboImport::implDefaultSelectCurrentItem()
+ {
+ OSL_ENSURE((m_aListSource.getLength() + m_nEmptyListItems) == (m_aValueList.getLength() + m_nEmptyValueItems),
+ "OListAndComboImport::implDefaultSelectCurrentItem: inconsistence between labels and values!");
+
+ sal_Int16 nItemNumber = (sal_Int16)(m_aListSource.getLength() - 1 + m_nEmptyListItems);
+ pushBackSequenceElement(m_aDefaultSelectedSeq, nItemNumber);
+ }
+
+ //=====================================================================
+ //= OListOptionImport
+ //=====================================================================
+ //---------------------------------------------------------------------
+ OListOptionImport::OListOptionImport(SvXMLImport& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const OListAndComboImportRef& _rListBox)
+ :SvXMLImportContext(_rImport, _nPrefix, _rName)
+ ,m_xListBoxImport(_rListBox)
+ {
+ }
+
+ //---------------------------------------------------------------------
+ void OListOptionImport::StartElement(const Reference< sax::XAttributeList >& _rxAttrList)
+ {
+ // the label and the value
+ const SvXMLNamespaceMap& rMap = GetImport().GetNamespaceMap();
+ const ::rtl::OUString sLabelAttribute = rMap.GetQNameByKey(
+ GetPrefix(), ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("label")));
+ const ::rtl::OUString sValueAttribute = rMap.GetQNameByKey(
+ GetPrefix(), ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value")));
+
+ // -------------------
+ // the label attribute
+ ::rtl::OUString sValue = _rxAttrList->getValueByName(sLabelAttribute);
+ sal_Bool bNonexistentAttribute = sal_False;
+ if (!sValue.getLength())
+ if (0 == _rxAttrList->getTypeByName(sLabelAttribute).getLength())
+ // this attribute does not really exist
+ bNonexistentAttribute = sal_True;
+
+ if (bNonexistentAttribute)
+ m_xListBoxImport->implEmptyLabelFound();
+ else
+ m_xListBoxImport->implPushBackLabel( sValue );
+
+ // -------------------
+ // the value attribute
+ sValue = _rxAttrList->getValueByName(sValueAttribute);
+ bNonexistentAttribute = sal_False;
+ if (!sValue.getLength())
+ if (0 == _rxAttrList->getTypeByName(sValueAttribute).getLength())
+ // this attribute does not really exist
+ bNonexistentAttribute = sal_True;
+
+ if (bNonexistentAttribute)
+ m_xListBoxImport->implEmptyValueFound();
+ else
+ m_xListBoxImport->implPushBackValue( sValue );
+
+ // the current-selected and selected
+ const ::rtl::OUString sSelectedAttribute = rMap.GetQNameByKey(
+ GetPrefix(), ::rtl::OUString::createFromAscii(OAttributeMetaData::getCommonControlAttributeName(CCA_CURRENT_SELECTED)));
+ const ::rtl::OUString sDefaultSelectedAttribute = rMap.GetQNameByKey(
+ GetPrefix(), ::rtl::OUString::createFromAscii(OAttributeMetaData::getCommonControlAttributeName(CCA_SELECTED)));
+
+ // propagate the selected flag
+ bool bSelected;
+ GetImport().GetMM100UnitConverter().convertBool(bSelected, _rxAttrList->getValueByName(sSelectedAttribute));
+ if (bSelected)
+ m_xListBoxImport->implSelectCurrentItem();
+
+ // same for the default selected
+ bool bDefaultSelected;
+ GetImport().GetMM100UnitConverter().convertBool(bDefaultSelected, _rxAttrList->getValueByName(sDefaultSelectedAttribute));
+ if (bDefaultSelected)
+ m_xListBoxImport->implDefaultSelectCurrentItem();
+
+ SvXMLImportContext::StartElement(_rxAttrList);
+ }
+
+ //=====================================================================
+ //= OComboItemImport
+ //=====================================================================
+ //---------------------------------------------------------------------
+ OComboItemImport::OComboItemImport(SvXMLImport& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const OListAndComboImportRef& _rListBox)
+ :SvXMLImportContext(_rImport, _nPrefix, _rName)
+ ,m_xListBoxImport(_rListBox)
+ {
+ }
+
+ //---------------------------------------------------------------------
+ void OComboItemImport::StartElement(const Reference< sax::XAttributeList >& _rxAttrList)
+ {
+ const ::rtl::OUString sLabelAttributeName = GetImport().GetNamespaceMap().GetQNameByKey(
+ GetPrefix(), ::rtl::OUString::createFromAscii(OAttributeMetaData::getCommonControlAttributeName(CCA_LABEL)));
+ m_xListBoxImport->implPushBackLabel(_rxAttrList->getValueByName(sLabelAttributeName));
+
+ SvXMLImportContext::StartElement(_rxAttrList);
+ }
+
+
+ //=====================================================================
+ //= OColumnWrapperImport
+ //=====================================================================
+ //---------------------------------------------------------------------
+ OColumnWrapperImport::OColumnWrapperImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const Reference< XNameContainer >& _rxParentContainer)
+ :SvXMLImportContext(_rImport.getGlobalContext(), _nPrefix, _rName)
+ ,m_xParentContainer(_rxParentContainer)
+ ,m_rFormImport(_rImport)
+ ,m_rEventManager(_rEventManager)
+ {
+ }
+ //---------------------------------------------------------------------
+ SvXMLImportContext* OColumnWrapperImport::CreateChildContext(sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
+ const Reference< sax::XAttributeList >&)
+ {
+ OControlImport* pReturn = implCreateChildContext(_nPrefix, _rLocalName, OElementNameMap::getElementType(_rLocalName));
+ if (pReturn)
+ {
+ OSL_ENSURE(m_xOwnAttributes.is(), "OColumnWrapperImport::CreateChildContext: had no form:column element!");
+ pReturn->addOuterAttributes(m_xOwnAttributes);
+ }
+ return pReturn;
+ }
+ //---------------------------------------------------------------------
+ void OColumnWrapperImport::StartElement(const Reference< sax::XAttributeList >& _rxAttrList)
+ {
+ OSL_ENSURE(!m_xOwnAttributes.is(), "OColumnWrapperImport::StartElement: aready have the cloned list!");
+
+ // clone the attributes
+ Reference< XCloneable > xCloneList(_rxAttrList, UNO_QUERY);
+ OSL_ENSURE(xCloneList.is(), "OColumnWrapperImport::StartElement: AttributeList not cloneable!");
+ if ( xCloneList.is() )
+ m_xOwnAttributes = Reference< sax::XAttributeList >(xCloneList->createClone(), UNO_QUERY);
+ OSL_ENSURE(m_xOwnAttributes.is(), "OColumnWrapperImport::StartElement: no cloned list!");
+ }
+
+ //---------------------------------------------------------------------
+ OControlImport* OColumnWrapperImport::implCreateChildContext(
+ sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
+ OControlElement::ElementType _eType)
+ {
+ OSL_ENSURE( (OControlElement::TEXT == _eType)
+ || (OControlElement::TEXT_AREA == _eType)
+ || (OControlElement::FORMATTED_TEXT == _eType)
+ || (OControlElement::CHECKBOX == _eType)
+ || (OControlElement::LISTBOX == _eType)
+ || (OControlElement::COMBOBOX == _eType)
+ || (OControlElement::TIME == _eType)
+ || (OControlElement::DATE == _eType),
+ "OColumnWrapperImport::implCreateChildContext: invalid or unrecognized sub element!");
+
+ switch (_eType)
+ {
+ case OControlElement::COMBOBOX:
+ case OControlElement::LISTBOX:
+ return new OColumnImport<OListAndComboImport>(m_rFormImport, m_rEventManager, _nPrefix, _rLocalName, m_xParentContainer, _eType );
+
+ case OControlElement::PASSWORD:
+ return new OColumnImport<OPasswordImport>(m_rFormImport, m_rEventManager, _nPrefix, _rLocalName, m_xParentContainer, _eType );
+
+ case OControlElement::TEXT:
+ case OControlElement::TEXT_AREA:
+ case OControlElement::FORMATTED_TEXT:
+ return new OColumnImport< OTextLikeImport >( m_rFormImport, m_rEventManager, _nPrefix, _rLocalName, m_xParentContainer, _eType );
+
+ default:
+ return new OColumnImport<OControlImport>(m_rFormImport, m_rEventManager, _nPrefix, _rLocalName, m_xParentContainer, _eType );
+ }
+ }
+
+ //=====================================================================
+ //= OGridImport
+ //=====================================================================
+ //---------------------------------------------------------------------
+ OGridImport::OGridImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const Reference< XNameContainer >& _rxParentContainer,
+ OControlElement::ElementType _eType)
+ :OGridImport_Base(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer, "column")
+ {
+ setElementType(_eType);
+ }
+
+ //---------------------------------------------------------------------
+ SvXMLImportContext* OGridImport::implCreateControlWrapper(sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName)
+ {
+ return new OColumnWrapperImport(m_rFormImport, *this, _nPrefix, _rLocalName, m_xMeAsContainer);
+ }
+
+ //=====================================================================
+ //= OFormImport
+ //=====================================================================
+ //---------------------------------------------------------------------
+ OFormImport::OFormImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const Reference< XNameContainer >& _rxParentContainer)
+ :OFormImport_Base(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer, "control")
+ {
+ enableTrackAttributes();
+ }
+
+ //---------------------------------------------------------------------
+ SvXMLImportContext* OFormImport::CreateChildContext(sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
+ const Reference< sax::XAttributeList >& _rxAttrList)
+ {
+ if( token::IsXMLToken(_rLocalName, token::XML_FORM) )
+ return new OFormImport( m_rFormImport, *this, _nPrefix, _rLocalName,
+ m_xMeAsContainer);
+ else if ( token::IsXMLToken(_rLocalName, token::XML_CONNECTION_RESOURCE) )
+ return new OXMLDataSourceImport(GetImport(), _nPrefix, _rLocalName, _rxAttrList,m_xElement);
+ else if( (token::IsXMLToken(_rLocalName, token::XML_EVENT_LISTENERS) &&
+ (XML_NAMESPACE_OFFICE == _nPrefix)) ||
+ token::IsXMLToken( _rLocalName, token::XML_PROPERTIES) )
+ return OElementImport::CreateChildContext( _nPrefix, _rLocalName,
+ _rxAttrList );
+ else
+ return implCreateChildContext( _nPrefix, _rLocalName,
+ OElementNameMap::getElementType(_rLocalName) );
+ }
+
+ //---------------------------------------------------------------------
+ void OFormImport::StartElement(const Reference< sax::XAttributeList >& _rxAttrList)
+ {
+ m_rFormImport.enterEventContext();
+ OFormImport_Base::StartElement(_rxAttrList);
+
+ // handle the target-frame attribute
+ simulateDefaultedAttribute(OAttributeMetaData::getCommonControlAttributeName(CCA_TARGET_FRAME), PROPERTY_TARGETFRAME, "_blank");
+ }
+
+ //---------------------------------------------------------------------
+ void OFormImport::EndElement()
+ {
+ OFormImport_Base::EndElement();
+ m_rFormImport.leaveEventContext();
+ }
+
+ //---------------------------------------------------------------------
+ SvXMLImportContext* OFormImport::implCreateControlWrapper(sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName)
+ {
+ OSL_ENSURE( !this, "illegal call to OFormImport::implCreateControlWrapper" );
+ return new SvXMLImportContext(GetImport(), _nPrefix, _rLocalName );
+ }
+
+ //---------------------------------------------------------------------
+ bool OFormImport::handleAttribute(sal_uInt16 _nNamespaceKey, const ::rtl::OUString& _rLocalName, const ::rtl::OUString& _rValue)
+ {
+ // handle the master/details field attributes (they're way too special to let the OPropertyImport handle them)
+ static const ::rtl::OUString s_sMasterFieldsAttributeName = ::rtl::OUString::createFromAscii(OAttributeMetaData::getFormAttributeName(faMasterFields));
+ static const ::rtl::OUString s_sDetailFieldsAttributeName = ::rtl::OUString::createFromAscii(OAttributeMetaData::getFormAttributeName(faDetailFiels));
+
+ if ( s_sMasterFieldsAttributeName == _rLocalName )
+ {
+ implTranslateStringListProperty(PROPERTY_MASTERFIELDS, _rValue);
+ return true;
+ }
+
+ if ( s_sDetailFieldsAttributeName == _rLocalName )
+ {
+ implTranslateStringListProperty(PROPERTY_DETAILFIELDS, _rValue);
+ return true;
+ }
+
+ return OFormImport_Base::handleAttribute(_nNamespaceKey, _rLocalName, _rValue);
+ }
+
+ //---------------------------------------------------------------------
+ void OFormImport::implTranslateStringListProperty(const ::rtl::OUString& _rPropertyName, const ::rtl::OUString& _rValue)
+ {
+ PropertyValue aProp;
+ aProp.Name = _rPropertyName;
+
+ Sequence< ::rtl::OUString > aList;
+
+ // split up the value string
+ if (_rValue.getLength())
+ {
+ // For the moment, we build a vector instead of a Sequence. It's easier to handle because of it's
+ // push_back method
+ ::std::vector< ::rtl::OUString > aElements;
+ // estimate the number of tokens
+ sal_Int32 nEstimate = 0, nLength = _rValue.getLength();
+ const sal_Unicode* pChars = _rValue.getStr();
+ for (sal_Int32 i=0; i<nLength; ++i, ++pChars)
+ if (*pChars == ',')
+ ++nEstimate;
+ aElements.reserve(nEstimate + 1);
+ // that's the worst case. If the string contains the separator character _quoted_, we reserved to much ...
+
+
+ sal_Int32 nElementStart = 0;
+ sal_Int32 nNextSep = 0;
+ sal_Int32 nElementLength;
+ ::rtl::OUString sElement;
+ do
+ {
+ // extract the current element
+ nNextSep = SvXMLUnitConverter::indexOfComma(
+ _rValue, nElementStart);
+ if (-1 == nNextSep)
+ nNextSep = nLength;
+ sElement = _rValue.copy(nElementStart, nNextSep - nElementStart);
+
+ nElementLength = sElement.getLength();
+ // when writing the sequence, we quoted the single elements with " characters
+ OSL_ENSURE( (nElementLength >= 2)
+ && (sElement.getStr()[0] == '"')
+ && (sElement.getStr()[nElementLength - 1] == '"'),
+ "OFormImport::implTranslateStringListProperty: invalid quoted element name.");
+ sElement = sElement.copy(1, nElementLength - 2);
+
+ aElements.push_back(sElement);
+
+ // swith to the next element
+ nElementStart = 1 + nNextSep;
+ }
+ while (nElementStart < nLength);
+
+ ::rtl::OUString *pElements = aElements.empty() ? 0 : &aElements[0];
+ aList = Sequence< ::rtl::OUString >(pElements, aElements.size());
+ }
+ else
+ {
+ OSL_FAIL("OFormImport::implTranslateStringListProperty: invalid value (empty)!");
+ }
+
+ aProp.Value <<= aList;
+
+ // add the property to the base class' array
+ implPushBackPropertyValue(aProp);
+ }
+ //=====================================================================
+ //= OXMLDataSourceImport
+ //=====================================================================
+ OXMLDataSourceImport::OXMLDataSourceImport(
+ SvXMLImport& _rImport
+ ,sal_uInt16 nPrfx
+ , const ::rtl::OUString& _sLocalName
+ ,const Reference< ::com::sun::star::xml::sax::XAttributeList > & _xAttrList
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xElement) :
+ SvXMLImportContext( _rImport, nPrfx, _sLocalName )
+ {
+ OSL_ENSURE(_xAttrList.is(),"Attribute list is NULL!");
+ const SvXMLNamespaceMap& rMap = _rImport.GetNamespaceMap();
+
+ sal_Int16 nLength = (_xElement.is() && _xAttrList.is()) ? _xAttrList->getLength() : 0;
+ for(sal_Int16 i = 0; i < nLength; ++i)
+ {
+ ::rtl::OUString sLocalName;
+ ::rtl::OUString sAttrName = _xAttrList->getNameByIndex( i );
+ sal_uInt16 nPrefix = rMap.GetKeyByAttrName( sAttrName, &sLocalName );
+
+ if ( ( nPrefix == OAttributeMetaData::getCommonControlAttributeNamespace( CCA_TARGET_LOCATION ) )
+ && ( sLocalName.equalsAscii( OAttributeMetaData::getCommonControlAttributeName( CCA_TARGET_LOCATION ) ) )
+ )
+ {
+ ::rtl::OUString sValue = _xAttrList->getValueByIndex( i );
+
+ INetURLObject aURL(sValue);
+ if ( aURL.GetProtocol() == INET_PROT_FILE )
+ _xElement->setPropertyValue(PROPERTY_DATASOURCENAME,makeAny(sValue));
+ else
+ _xElement->setPropertyValue(PROPERTY_URL,makeAny(sValue)); // the url is the "sdbc:" string
+ break;
+ }
+ }
+ }
+ //---------------------------------------------------------------------
+ OControlImport* OFormImport::implCreateChildContext(
+ sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
+ OControlElement::ElementType _eType )
+ {
+ switch (_eType)
+ {
+ case OControlElement::TEXT:
+ case OControlElement::TEXT_AREA:
+ case OControlElement::FORMATTED_TEXT:
+ return new OTextLikeImport(m_rFormImport, *this, _nPrefix, _rLocalName, m_xMeAsContainer, _eType);
+
+ case OControlElement::BUTTON:
+ case OControlElement::IMAGE:
+ case OControlElement::IMAGE_FRAME:
+ return new OButtonImport( m_rFormImport, *this, _nPrefix, _rLocalName, m_xMeAsContainer, _eType );
+
+ case OControlElement::COMBOBOX:
+ case OControlElement::LISTBOX:
+ return new OListAndComboImport(m_rFormImport, *this, _nPrefix, _rLocalName, m_xMeAsContainer, _eType);
+
+ case OControlElement::RADIO:
+ return new ORadioImport(m_rFormImport, *this, _nPrefix, _rLocalName, m_xMeAsContainer, _eType);
+
+ case OControlElement::CHECKBOX:
+ return new OImagePositionImport(m_rFormImport, *this, _nPrefix, _rLocalName, m_xMeAsContainer, _eType);
+
+ case OControlElement::PASSWORD:
+ return new OPasswordImport(m_rFormImport, *this, _nPrefix, _rLocalName, m_xMeAsContainer, _eType);
+
+ case OControlElement::FRAME:
+ case OControlElement::FIXED_TEXT:
+ return new OReferredControlImport(m_rFormImport, *this, _nPrefix, _rLocalName, m_xMeAsContainer, _eType);
+
+ case OControlElement::GRID:
+ return new OGridImport(m_rFormImport, *this, _nPrefix, _rLocalName, m_xMeAsContainer, _eType);
+
+ case OControlElement::VALUERANGE:
+ return new OValueRangeImport( m_rFormImport, *this, _nPrefix, _rLocalName, m_xMeAsContainer, _eType );
+
+ default:
+ return new OControlImport(m_rFormImport, *this, _nPrefix, _rLocalName, m_xMeAsContainer, _eType);
+ }
+ }
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/elementimport.hxx b/xmloff/source/forms/elementimport.hxx
new file mode 100644
index 000000000000..f5c7cd7740c9
--- /dev/null
+++ b/xmloff/source/forms/elementimport.hxx
@@ -0,0 +1,775 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_FORMS_ELEMENTIMPORT_HXX_
+#define _XMLOFF_FORMS_ELEMENTIMPORT_HXX_
+
+#include "propertyimport.hxx"
+#include "controlelement.hxx"
+#include "valueproperties.hxx"
+#include "eventimport.hxx"
+#include "logging.hxx"
+#include "property_description.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/text/XTextCursor.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/form/XGridColumnFactory.hpp>
+#include <com/sun/star/script/XEventAttacherManager.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/stl_types.hxx>
+
+class XMLTextStyleContext;
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ class IControlIdMap;
+ class OFormLayerXMLImport_Impl;
+
+ //=====================================================================
+ //= OElementNameMap
+ //=====================================================================
+ const OControlElement::ElementType& operator ++(OControlElement::ElementType& _e);
+
+ /** helper class which allows fast translation of xml tag names into element types.
+ */
+ class OElementNameMap : public OControlElement
+ {
+ protected:
+ DECLARE_STL_USTRINGACCESS_MAP( ElementType, MapString2Element );
+ static MapString2Element s_sElementTranslations;
+
+ protected:
+ OElementNameMap() { }
+
+ public:
+ static ElementType getElementType(const ::rtl::OUString& _rName);
+ };
+
+ //=====================================================================
+ //= OElementImport
+ //=====================================================================
+ /** implements common behaviour for importing forms, controls and columns
+ */
+ class OElementImport
+ :public OPropertyImport
+ ,public IEventAttacher
+ ,public OStackedLogging
+ {
+ protected:
+ ::rtl::OUString m_sServiceName; // the service name as extracted from the service-name attribute
+ ::rtl::OUString m_sName; // the name of the object (redundant, already contained in the base class' array)
+ OFormLayerXMLImport_Impl& m_rFormImport; // the form import context
+ IEventAttacherManager& m_rEventManager; // the event attacher manager
+
+ const XMLTextStyleContext* m_pStyleElement; // the XML element which describes the style we encountered
+ // while reading our element
+
+ /// the parent container to insert the new element into
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
+ m_xParentContainer;
+
+ /// the element we're creating. Valid after StartElement
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ m_xElement;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
+ m_xInfo;
+
+ bool m_bImplicitGenericAttributeHandling;
+
+ public:
+ /** ctor
+ @param _rImport
+ the importer
+ @param _rEventManager
+ the event attacher manager for the control beeing imported
+ @param _nPrefix
+ the namespace prefix
+ @param _rName
+ the element name
+ @param _rAttributeMap
+ the attribute map to be used for translating attributes into properties
+ @param _rxParentContainer
+ the container in which the new element should be inserted
+ */
+ OElementImport(
+ OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager,
+ sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer
+ );
+ virtual ~OElementImport();
+
+ protected:
+ // SvXMLImportContext overridables
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
+ virtual void EndElement();
+
+ // OPropertyImport overridables
+ virtual bool handleAttribute(sal_uInt16 _nNamespaceKey,
+ const ::rtl::OUString& _rLocalName,
+ const ::rtl::OUString& _rValue);
+
+ // IEventAttacher
+ virtual void registerEvents(
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& _rEvents
+ );
+
+ /** create the (uninitialized) element which is to represent the read data
+
+ <p>The default implementation uses <member>m_xORB</member> to create a object with <member>m_sServiceName</member>.
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ createElement();
+
+ protected:
+ /** can be used to handle properties where the attribute default and the property default differ.
+ <p>In such case, if the property had the attribute default upon writing, nothing is read, so upon reading,
+ the property is still at it's own default (which is not the attribute default).<p/>
+ <p>This method, if told the attribute and the property, and the (implied) attribute default, sets the
+ property value as if the attribute was encountered.</p>
+ @see encounteredAttribute
+ */
+ void simulateDefaultedAttribute(const sal_Char* _pAttributeName, const ::rtl::OUString& _rPropertyName, const sal_Char* _pAttributeDefault);
+
+ /** to be called from within handleAttribute, checks whether the given attribute is covered by our generic
+ attribute handler mechanisms
+ */
+ bool tryGenericAttribute( sal_uInt16 _nNamespaceKey, const ::rtl::OUString& _rLocalName, const ::rtl::OUString& _rValue );
+
+ /** controls whether |handleAttribute| implicitly calls |tryGenericAttribute|, or whether the derived class
+ must do this explicitly at a suitable place in its own |handleAttribute|
+ */
+ void disableImplicitGenericAttributeHandling() { m_bImplicitGenericAttributeHandling = false; }
+
+ private:
+ ::rtl::OUString implGetDefaultName() const;
+ void implApplyGenericProperties();
+ void implApplySpecificProperties();
+
+ /** sets the style properties which have been read for the element (if any)
+ */
+ void implSetStyleProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObject );
+
+ PropertyGroups::const_iterator impl_matchPropertyGroup( const PropertyGroups& i_propertyGroups ) const;
+
+ virtual ::rtl::OUString determineDefaultServiceName() const;
+ };
+
+ //=====================================================================
+ //= OControlImport
+ //=====================================================================
+ /** helper class for importing the description of a single control
+ */
+ class OControlImport
+ :public OElementImport
+ ,public OValuePropertiesMetaData
+ {
+ protected:
+ ::rtl::OUString m_sControlId;
+ OControlElement::ElementType m_eElementType;
+
+ PropertyValueArray m_aValueProperties;
+ // the value properties (value, current-value, min-value, max-value) require some special
+ // handling
+
+ // we fake the attributes our base class gets: we add the attributes of the outer wrapper
+ // element which encloses us
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >
+ m_xOuterAttributes;
+
+ /** the address of the calc cell which the control model should be bound to,
+ if applicable
+ */
+ ::rtl::OUString m_sBoundCellAddress;
+
+ /** name of a value binding (xforms:bind attribute) */
+ ::rtl::OUString m_sBindingID;
+
+ /** name of a list binding (form:xforms-list-source attribute) */
+ ::rtl::OUString m_sListBindingID;
+
+ /** name of a submission (xforms:submission attribute) */
+ ::rtl::OUString m_sSubmissionID;
+
+ protected:
+ // for use by derived classes only
+ OControlImport(
+ OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager,
+ sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer
+ );
+
+ public:
+ OControlImport(
+ OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager,
+ sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
+ OControlElement::ElementType _eType
+ );
+
+ // SvXMLImportContext overridables
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
+ virtual void EndElement();
+
+ // OPropertyImport overridables
+ virtual bool handleAttribute(sal_uInt16 _nNamespaceKey,
+ const ::rtl::OUString& _rLocalName,
+ const ::rtl::OUString& _rValue);
+
+ void addOuterAttributes(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxOuterAttribs);
+
+ protected:
+ void setElementType(OControlElement::ElementType _eType) { m_eElementType = _eType; }
+
+ protected:
+ void implTranslateValueProperty(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >& _rxPropInfo,
+ ::com::sun::star::beans::PropertyValue& /* [in/out] */ _rPropValue);
+
+ virtual ::rtl::OUString determineDefaultServiceName() const;
+
+ /** registers the given cell address as value binding address for our element
+
+ <p>The default implementation simply calls registerCellValueBinding at our import
+ context, but you may want to override this behaviour.</p>
+
+ @param _rBoundCellAddress
+ the cell address to register for our element. Must not be <NULL/>.
+ @precond
+ we have a valid element (m_xElement)
+ */
+ virtual void doRegisterCellValueBinding( const ::rtl::OUString& _rBoundCellAddress );
+
+ /** register the given XForms binding */
+ virtual void doRegisterXFormsValueBinding( const ::rtl::OUString& );
+
+ /** register the given XForms list binding */
+ virtual void doRegisterXFormsListBinding( const ::rtl::OUString& );
+
+ /** register the given XForms submission */
+ virtual void doRegisterXFormsSubmission( const ::rtl::OUString& );
+
+ protected:
+
+ // OElementImport overridables
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ createElement();
+ };
+
+ // TODO:
+ // this whole mechanism doesn't scale. Instead of deriving even more classes for every new attribute,
+ // we should have dedicated attribute handlers
+ // The rest of xmloff implements it this way - why don't we do, too?
+
+ //=====================================================================
+ //= OImagePositionImport
+ //=====================================================================
+ class OImagePositionImport : public OControlImport
+ {
+ sal_Int16 m_nImagePosition;
+ sal_Int16 m_nImageAlign;
+ sal_Bool m_bHaveImagePosition;
+
+ public:
+ OImagePositionImport(
+ OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
+ OControlElement::ElementType _eType
+ );
+
+ protected:
+ // SvXMLImportContext overridables
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
+
+ // OPropertyImport overridables
+ virtual bool handleAttribute( sal_uInt16 _nNamespaceKey,
+ const ::rtl::OUString& _rLocalName,
+ const ::rtl::OUString& _rValue
+ );
+ };
+
+ //=====================================================================
+ //= OReferredControlImport
+ //=====================================================================
+ class OReferredControlImport : public OControlImport
+ {
+ protected:
+ ::rtl::OUString m_sReferringControls; // the list of ids of controls referring to the one beeing imported
+
+ public:
+ OReferredControlImport(
+ OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
+ OControlElement::ElementType _eType
+ );
+
+ // SvXMLImportContext overridables
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
+
+ // OPropertyImport overridables
+ virtual bool handleAttribute(sal_uInt16 _nNamespaceKey,
+ const ::rtl::OUString& _rLocalName,
+ const ::rtl::OUString& _rValue);
+ };
+
+ //=====================================================================
+ //= OPasswordImport
+ //=====================================================================
+ class OPasswordImport : public OControlImport
+ {
+ public:
+ OPasswordImport(
+ OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
+ OControlElement::ElementType _eType
+ );
+
+ // OPropertyImport overridables
+ virtual bool handleAttribute(sal_uInt16 _nNamespaceKey,
+ const ::rtl::OUString& _rLocalName,
+ const ::rtl::OUString& _rValue);
+ };
+
+ //=====================================================================
+ //= ORadioImport
+ //=====================================================================
+ class ORadioImport : public OImagePositionImport
+ {
+ public:
+ ORadioImport(
+ OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
+ OControlElement::ElementType _eType
+ );
+
+ protected:
+ // OPropertyImport overridables
+ virtual bool handleAttribute(sal_uInt16 _nNamespaceKey,
+ const ::rtl::OUString& _rLocalName,
+ const ::rtl::OUString& _rValue);
+ };
+
+ //=====================================================================
+ //= OURLReferenceImport
+ //=====================================================================
+ /** a specialized version of the <type>OControlImport</type> class, which is able
+ to handle attributes which denote URLs (and stored relative)
+ */
+ class OURLReferenceImport : public OImagePositionImport
+ {
+ public:
+ OURLReferenceImport(
+ OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
+ OControlElement::ElementType _eType
+ );
+
+ protected:
+ // OPropertyImport overridables
+ virtual bool handleAttribute(sal_uInt16 _nNamespaceKey,
+ const ::rtl::OUString& _rLocalName,
+ const ::rtl::OUString& _rValue);
+ };
+
+ //=====================================================================
+ //= OButtonImport
+ //=====================================================================
+ /** A specialized version of the <type>OControlImport</type> class, which handles
+ the target frame for image and command buttons
+ */
+ class OButtonImport : public OURLReferenceImport
+ {
+ public:
+ OButtonImport(
+ OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
+ OControlElement::ElementType _eType
+ );
+
+ protected:
+ // SvXMLImportContext overridables
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
+ };
+
+ //=====================================================================
+ //= OValueRangeImport
+ //=====================================================================
+ /** A specialized version of the <type>OControlImport</type> class, which imports
+ the value-range elements
+ */
+ class OValueRangeImport : public OControlImport
+ {
+ private:
+ sal_Int32 m_nStepSizeValue;
+
+ public:
+ OValueRangeImport(
+ OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
+ OControlElement::ElementType _eType
+ );
+
+ protected:
+ // SvXMLImportContext overridables
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList );
+
+ // OPropertyImport overridables
+ virtual bool handleAttribute( sal_uInt16 _nNamespaceKey,
+ const ::rtl::OUString& _rLocalName,
+ const ::rtl::OUString& _rValue );
+ };
+
+ //=====================================================================
+ //= OTextLikeImport
+ //=====================================================================
+ /** A specialized version of the <type>OControlImport</type> class, which handles
+ text like controls which have the convert-empty-to-null attribute</p>
+ */
+ class OTextLikeImport : public OControlImport
+ {
+ private:
+ ::com::sun::star::uno::Reference< com::sun::star::text::XTextCursor > m_xCursor;
+ ::com::sun::star::uno::Reference< com::sun::star::text::XTextCursor > m_xOldCursor;
+ bool m_bEncounteredTextPara;
+
+ public:
+ OTextLikeImport(
+ OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
+ OControlElement::ElementType _eType
+ );
+
+ // SvXMLImportContext overridables
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
+ virtual void EndElement();
+
+ private:
+ void adjustDefaultControlProperty();
+ void removeRedundantCurrentValue();
+ };
+
+ //=====================================================================
+ //= OListAndComboImport
+ //=====================================================================
+ /** A specialized version of the <type>OControlImport</type> class, which handles
+ attributes / sub elements which are special to list and combo boxes
+ */
+ class OListAndComboImport : public OControlImport
+ {
+ friend class OListOptionImport;
+ friend class OComboItemImport;
+
+ protected:
+ ::com::sun::star::uno::Sequence< ::rtl::OUString >
+ m_aListSource;
+ ::com::sun::star::uno::Sequence< ::rtl::OUString >
+ m_aValueList;
+
+ ::com::sun::star::uno::Sequence< sal_Int16 >
+ m_aSelectedSeq;
+ ::com::sun::star::uno::Sequence< sal_Int16 >
+ m_aDefaultSelectedSeq;
+
+ ::rtl::OUString m_sCellListSource; /// the cell range which acts as list source for the control
+
+ sal_Int32 m_nEmptyListItems; /// number of empty list items encountered during reading
+ sal_Int32 m_nEmptyValueItems; /// number of empty value items encountered during reading
+
+ sal_Bool m_bEncounteredLSAttrib;
+ sal_Bool m_bLinkWithIndexes; /** <TRUE/> if and only if we should use a cell value binding
+ which exchanges the selection index (instead of the selection text
+ */
+
+ public:
+ OListAndComboImport(
+ OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
+ OControlElement::ElementType _eType
+ );
+
+ // SvXMLImportContext overridables
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
+ virtual void EndElement();
+
+ // OPropertyImport overridables
+ virtual bool handleAttribute(sal_uInt16 _nNamespaceKey,
+ const ::rtl::OUString& _rLocalName,
+ const ::rtl::OUString& _rValue);
+
+ // OControlImport ovrridables
+ virtual void doRegisterCellValueBinding( const ::rtl::OUString& _rBoundCellAddress );
+
+ protected:
+ void implPushBackLabel(const ::rtl::OUString& _rLabel);
+ void implPushBackValue(const ::rtl::OUString& _rValue);
+
+ void implEmptyLabelFound();
+ void implEmptyValueFound();
+
+ void implSelectCurrentItem();
+ void implDefaultSelectCurrentItem();
+ };
+ SV_DECL_IMPL_REF(OListAndComboImport);
+
+ //=====================================================================
+ //= OListOptionImport
+ //=====================================================================
+ /** helper class for importing a single &lt;form:option&gt; element.
+ */
+ class OListOptionImport
+ :public SvXMLImportContext
+ {
+ OListAndComboImportRef m_xListBoxImport;
+
+ public:
+ OListOptionImport(SvXMLImport& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const OListAndComboImportRef& _rListBox);
+
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
+ };
+
+ //=====================================================================
+ //= OComboItemImport
+ //=====================================================================
+ /** helper class for importing a single &lt;form:item&gt; element.
+ */
+ class OComboItemImport
+ :public SvXMLImportContext
+ {
+ OListAndComboImportRef m_xListBoxImport;
+
+ public:
+ OComboItemImport(SvXMLImport& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const OListAndComboImportRef& _rListBox);
+
+ protected:
+ // SvXMLImportContext overridables
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
+ };
+
+ //=====================================================================
+ //= OContainerImport
+ //=====================================================================
+ // BASE must be a derivee of OElementImport
+ template <class BASE>
+ class OContainerImport
+ :public BASE
+ ,public ODefaultEventAttacherManager
+ {
+ protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
+ m_xMeAsContainer;
+ ::rtl::OUString m_sWrapperElementName;
+
+ protected:
+ OContainerImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
+ const sal_Char* _pWrapperElementName)
+ :BASE(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer)
+ ,m_sWrapperElementName(::rtl::OUString::createFromAscii(_pWrapperElementName))
+ {
+ }
+
+ // SvXMLImportContext overridables
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
+ virtual void EndElement();
+
+ protected:
+ // OElementImport overridables
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ createElement();
+
+ // create the child context for the given control type
+ virtual SvXMLImportContext* implCreateControlWrapper(
+ sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName) = 0;
+ };
+
+ //=====================================================================
+ //= OColumnImport
+ //=====================================================================
+ /** helper class importing a single grid column (without the &lt;form:column&gt; element wrapping
+ the column).
+
+ <p>BASE (the template argument) must be a derivee of OControlImport</p>
+ */
+ template <class BASE>
+ class OColumnImport : public BASE
+ {
+ protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::XGridColumnFactory >
+ m_xColumnFactory;
+
+ public:
+ OColumnImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
+ OControlElement::ElementType _eType);
+
+ protected:
+ // OElementImport overridables
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ createElement();
+ };
+
+ //=====================================================================
+ //= OColumnWrapperImport
+ //=====================================================================
+ class OColumnWrapperImport : public SvXMLImportContext
+ {
+ protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >
+ m_xOwnAttributes;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
+ m_xParentContainer;
+ OFormLayerXMLImport_Impl& m_rFormImport;
+ IEventAttacherManager& m_rEventManager;
+
+ public:
+ OColumnWrapperImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer);
+
+ // SvXMLImportContext overridables
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
+ protected:
+ OControlImport* implCreateChildContext(
+ sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
+ OControlElement::ElementType _eType);
+ };
+
+ //=====================================================================
+ //= OGridImport
+ //=====================================================================
+ typedef OContainerImport< OControlImport > OGridImport_Base;
+ /** helper class importing a single &lt;form:grid&gt; element
+ */
+ class OGridImport : public OGridImport_Base
+ {
+ public:
+ OGridImport(
+ OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
+ OControlElement::ElementType _eType);
+
+ protected:
+ // OContainerImport overridables
+ virtual SvXMLImportContext* implCreateControlWrapper(
+ sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName);
+ };
+
+ //=====================================================================
+ //= OFormImport
+ //=====================================================================
+ typedef OContainerImport< OElementImport > OFormImport_Base;
+ /** helper class importing a single &lt;form:form&gt; element
+ */
+ class OFormImport : public OFormImport_Base
+ {
+ public:
+ OFormImport(
+ OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer
+ );
+
+ protected:
+ // SvXMLImportContext overridables
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
+ virtual void EndElement();
+
+ // OContainerImport overridables
+ virtual SvXMLImportContext* implCreateControlWrapper(
+ sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName);
+
+ // OPropertyImport overridables
+ virtual bool handleAttribute(sal_uInt16 _nNamespaceKey,
+ const ::rtl::OUString& _rLocalName,
+ const ::rtl::OUString& _rValue);
+
+ OControlImport* implCreateChildContext(
+ sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
+ OControlElement::ElementType _eType );
+
+
+ void implTranslateStringListProperty(const ::rtl::OUString& _rPropertyName, const ::rtl::OUString& _rValue);
+ };
+
+ //=====================================================================
+ //= OXMLDataSourceImport
+ //=====================================================================
+ class OXMLDataSourceImport : public SvXMLImportContext
+ {
+ public:
+ OXMLDataSourceImport( SvXMLImport& _rImport
+ ,sal_uInt16 nPrfx
+ ,const ::rtl::OUString& rLName
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xElement);
+ };
+
+#define _INCLUDING_FROM_ELEMENTIMPORT_HXX_
+#include "elementimport_impl.hxx"
+#undef _INCLUDING_FROM_ELEMENTIMPORT_HXX_
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+#endif // _XMLOFF_FORMS_ELEMENTIMPORT_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/elementimport_impl.hxx b/xmloff/source/forms/elementimport_impl.hxx
new file mode 100644
index 000000000000..1e34727903f8
--- /dev/null
+++ b/xmloff/source/forms/elementimport_impl.hxx
@@ -0,0 +1,125 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// no include protection. This file is included from elementimport.hxx only.
+
+#ifndef _INCLUDING_FROM_ELEMENTIMPORT_HXX_
+#error "do not include this file directly!"
+#endif
+
+// no namespace. Same as above: this file is included from elementimport.hxx only,
+// and this is done inside the namespace
+
+//=========================================================================
+//= OContainerImport
+//=========================================================================
+//-------------------------------------------------------------------------
+template <class BASE>
+inline SvXMLImportContext* OContainerImport< BASE >::CreateChildContext(
+ sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList)
+{
+ // maybe it's a sub control
+ if (_rLocalName == m_sWrapperElementName)
+ {
+ if (m_xMeAsContainer.is())
+ return implCreateControlWrapper(_nPrefix, _rLocalName);
+ else
+ {
+ OSL_FAIL("OContainerImport::CreateChildContext: don't have an element!");
+ return NULL;
+ }
+ }
+
+ return BASE::CreateChildContext(_nPrefix, _rLocalName, _rxAttrList);
+}
+
+//-------------------------------------------------------------------------
+template <class BASE>
+inline ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ OContainerImport< BASE >::createElement()
+{
+ // let the base class create the object
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xReturn = BASE::createElement();
+ if (!xReturn.is())
+ return xReturn;
+
+ // ensure that the object is a XNameContainer (we strongly need this for inserting child elements)
+ m_xMeAsContainer = ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >(xReturn, ::com::sun::star::uno::UNO_QUERY);
+ if (!m_xMeAsContainer.is())
+ {
+ OSL_FAIL("OContainerImport::createElement: invalid element (no XNameContainer) created!");
+ xReturn.clear();
+ }
+
+ return xReturn;
+}
+
+//-------------------------------------------------------------------------
+template <class BASE>
+inline void OContainerImport< BASE >::EndElement()
+{
+ BASE::EndElement();
+
+ // now that we have all children, attach the events
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > xIndexContainer(m_xMeAsContainer, ::com::sun::star::uno::UNO_QUERY);
+ if (xIndexContainer.is())
+ ODefaultEventAttacherManager::setEvents(xIndexContainer);
+}
+
+//=========================================================================
+//= OColumnImport
+//=========================================================================
+//-------------------------------------------------------------------------
+template <class BASE>
+OColumnImport< BASE >::OColumnImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
+ OControlElement::ElementType _eType)
+ :BASE(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer, _eType)
+ ,m_xColumnFactory(_rxParentContainer, ::com::sun::star::uno::UNO_QUERY)
+{
+ OSL_ENSURE(m_xColumnFactory.is(), "OColumnImport::OColumnImport: invalid parent container (no factory)!");
+}
+
+//-------------------------------------------------------------------------
+// OElementImport overridables
+template <class BASE>
+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > OColumnImport< BASE >::createElement()
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xReturn;
+ // no call to the base class' method. We have to use the grid column factory
+ if (m_xColumnFactory.is())
+ {
+ // create the column
+ xReturn = m_xColumnFactory->createColumn(this->m_sServiceName);
+ OSL_ENSURE(xReturn.is(), "OColumnImport::createElement: the factory returned an invalid object!");
+ }
+ return xReturn;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/eventexport.cxx b/xmloff/source/forms/eventexport.cxx
new file mode 100644
index 000000000000..5a6d84f16fea
--- /dev/null
+++ b/xmloff/source/forms/eventexport.cxx
@@ -0,0 +1,162 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "eventexport.hxx"
+#include <osl/diagnose.h>
+#include "strings.hxx"
+#include <tools/debug.hxx>
+
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::script;
+ using namespace ::com::sun::star::container;
+ using namespace ::com::sun::star::beans;
+ using namespace ::com::sun::star::lang;
+
+ //=====================================================================
+ //= OEventDescriptorMapper
+ //=====================================================================
+ //---------------------------------------------------------------------
+ OEventDescriptorMapper::OEventDescriptorMapper(const Sequence< ScriptEventDescriptor >& _rEvents)
+ {
+ sal_Int32 nEvents = _rEvents.getLength();
+
+ // translate the events
+ const ScriptEventDescriptor* pEvents = _rEvents.getConstArray();
+ ::rtl::OUString sName;
+ ::rtl::OUString sLibrary, sLocalMacroName;
+ for (sal_Int32 i=0; i<nEvents; ++i, ++pEvents)
+ {
+ // the name of the event is build from listener interface and listener method name
+ sName = pEvents->ListenerType;
+ sName += EVENT_NAME_SEPARATOR;
+ sName += pEvents->EventMethod;
+
+ Sequence< PropertyValue >& rMappedEvent = m_aMappedEvents[sName];
+
+ sLocalMacroName = pEvents->ScriptCode;
+ sLibrary = ::rtl::OUString();
+ if ( 0 == pEvents->ScriptType.compareToAscii( EVENT_STARBASIC ) )
+ { // for StarBasic, the library name is part of the ScriptCode
+ sal_Int32 nPrefixLen = sLocalMacroName.indexOf( ':' );
+ DBG_ASSERT( 0 <= nPrefixLen, "OEventDescriptorMapper::OEventDescriptorMapper: invalid script code prefix!" );
+ if ( 0 <= nPrefixLen )
+ {
+ // the export handler for StarBasic expects "StarOffice", not "application" for application modules ...
+ sLibrary = sLocalMacroName.copy( 0, nPrefixLen );
+ if ( sLibrary.equalsAscii( EVENT_APPLICATION ) )
+ sLibrary = EVENT_STAROFFICE;
+
+ sLocalMacroName = sLocalMacroName.copy( nPrefixLen + 1 );
+ }
+ // tree property values to describe one event ...
+ rMappedEvent.realloc( sLibrary.getLength() ? 3 : 2 );
+
+ // ... the type
+ rMappedEvent[0] = PropertyValue(EVENT_TYPE, -1, makeAny(pEvents->ScriptType), PropertyState_DIRECT_VALUE);
+
+ // and the macro name
+ rMappedEvent[1] = PropertyValue(EVENT_LOCALMACRONAME, -1, makeAny(sLocalMacroName), PropertyState_DIRECT_VALUE);
+
+ // the library
+ if ( sLibrary.getLength() )
+ rMappedEvent[2] = PropertyValue(EVENT_LIBRARY, -1, makeAny(sLibrary), PropertyState_DIRECT_VALUE);
+ }
+ else
+ {
+ rMappedEvent.realloc( 2 );
+ rMappedEvent[0] = PropertyValue(EVENT_TYPE, -1, makeAny(pEvents->ScriptType), PropertyState_DIRECT_VALUE);
+ // and the macro name
+ rMappedEvent[1] = PropertyValue(EVENT_SCRIPTURL, -1, makeAny(pEvents->ScriptCode), PropertyState_DIRECT_VALUE);
+ }
+ }
+ }
+
+ //---------------------------------------------------------------------
+ void SAL_CALL OEventDescriptorMapper::replaceByName( const ::rtl::OUString&, const Any& ) throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
+ {
+ throw IllegalArgumentException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("replacing is not implemented for this wrapper class.")), static_cast< ::cppu::OWeakObject* >(this), 1);
+ }
+
+ //---------------------------------------------------------------------
+ Any SAL_CALL OEventDescriptorMapper::getByName( const ::rtl::OUString& _rName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
+ {
+ ConstMapString2PropertyValueSequenceIterator aPos = m_aMappedEvents.find(_rName);
+ if (m_aMappedEvents.end() == aPos)
+ throw NoSuchElementException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("There is no element named ")) += _rName,
+ static_cast< ::cppu::OWeakObject* >(this));
+
+ return makeAny(aPos->second);
+ }
+
+ //---------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL OEventDescriptorMapper::getElementNames( ) throw(RuntimeException)
+ {
+ Sequence< ::rtl::OUString > aReturn(m_aMappedEvents.size());
+ ::rtl::OUString* pReturn = aReturn.getArray();
+ for ( ConstMapString2PropertyValueSequenceIterator aCollect = m_aMappedEvents.begin();
+ aCollect != m_aMappedEvents.end();
+ ++aCollect, ++pReturn
+ )
+ *pReturn = aCollect->first;
+
+ return aReturn;
+ }
+
+ //---------------------------------------------------------------------
+ sal_Bool SAL_CALL OEventDescriptorMapper::hasByName( const ::rtl::OUString& _rName ) throw(RuntimeException)
+ {
+ ConstMapString2PropertyValueSequenceIterator aPos = m_aMappedEvents.find(_rName);
+ return m_aMappedEvents.end() != aPos;
+ }
+
+ //---------------------------------------------------------------------
+ Type SAL_CALL OEventDescriptorMapper::getElementType( ) throw(RuntimeException)
+ {
+ return ::getCppuType(static_cast< PropertyValue* >(NULL));
+ }
+
+ //---------------------------------------------------------------------
+ sal_Bool SAL_CALL OEventDescriptorMapper::hasElements( ) throw(RuntimeException)
+ {
+ return !m_aMappedEvents.empty();
+ }
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/eventexport.hxx b/xmloff/source/forms/eventexport.hxx
new file mode 100644
index 000000000000..fdddab0df44f
--- /dev/null
+++ b/xmloff/source/forms/eventexport.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_FORMS_EVENTEXPORT_HXX_
+#define _XMLOFF_FORMS_EVENTEXPORT_HXX_
+
+#include <com/sun/star/container/XNameReplace.hpp>
+#include <com/sun/star/script/ScriptEventDescriptor.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/stl_types.hxx>
+
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ //=====================================================================
+ //= OEventDescriptorMapper
+ //=====================================================================
+ typedef ::cppu::WeakImplHelper1 < ::com::sun::star::container::XNameReplace
+ > OEventDescriptorMapper_Base;
+ /** helper class wrapping different script event representations
+
+ <p>In the form layer, the script events are represented by <type scope="com.sun.star.script">ScriptEventDescriptor</type>
+ instances. The office applications, on the other hand, represent their a single script event as sequence
+ of <type scope="com.sun.star.beans">PropertyValue</type>s, where all events of a given object are
+ accessible through a <type scope="com.sun.star.container">XNameReplace</type> interface.</p>
+ <p>This class maps the first representation of events of a single object to the second one.</p>
+ <p>This way, we can use the helper classes here in the project.</p>
+ */
+ class OEventDescriptorMapper : public OEventDescriptorMapper_Base
+ {
+ protected:
+ DECLARE_STL_USTRINGACCESS_MAP( ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >, MapString2PropertyValueSequence );
+ MapString2PropertyValueSequence m_aMappedEvents;
+
+ public:
+ OEventDescriptorMapper(
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& _rEvents);
+
+ // XNameReplace
+ virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XNameAccess
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
+ };
+
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+#endif // _XMLOFF_FORMS_EVENTEXPORT_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/eventimport.cxx b/xmloff/source/forms/eventimport.cxx
new file mode 100644
index 000000000000..9edc1242ea0f
--- /dev/null
+++ b/xmloff/source/forms/eventimport.cxx
@@ -0,0 +1,165 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "eventimport.hxx"
+#include <com/sun/star/script/XEventAttacherManager.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <comphelper/extract.hxx>
+#include "strings.hxx"
+
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::beans;
+ using namespace ::com::sun::star::script;
+ using namespace ::com::sun::star::container;
+
+ //=====================================================================
+ //= OFormEventsImportContext
+ //=====================================================================
+ //---------------------------------------------------------------------
+ OFormEventsImportContext::OFormEventsImportContext(SvXMLImport& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName, IEventAttacher& _rEventAttacher)
+ :XMLEventsImportContext(_rImport, _nPrefix, _rLocalName)
+ ,m_rEventAttacher(_rEventAttacher)
+ {
+ }
+
+ //---------------------------------------------------------------------
+ void OFormEventsImportContext::EndElement()
+ {
+ Sequence< ScriptEventDescriptor > aTranslated(aCollectEvents.size());
+ ScriptEventDescriptor* pTranslated = aTranslated.getArray();
+
+ // loop through the collected events and translate them
+ const PropertyValue* pEventDescription;
+ const PropertyValue* pEventDescriptionEnd;
+ sal_Int32 nSeparatorPos = -1;
+ for ( EventsVector::const_iterator aEvent = aCollectEvents.begin();
+ aEvent != aCollectEvents.end();
+ ++aEvent, ++pTranslated
+ )
+ {
+ // the name of the event is built from ListenerType::EventMethod
+ nSeparatorPos = aEvent->first.indexOf(EVENT_NAME_SEPARATOR);
+ OSL_ENSURE(-1 != nSeparatorPos, "OFormEventsImportContext::EndElement: invalid (unrecognized) event name!");
+ pTranslated->ListenerType = aEvent->first.copy(0, nSeparatorPos);
+ pTranslated->EventMethod = aEvent->first.copy(nSeparatorPos + EVENT_NAME_SEPARATOR.length);
+
+ ::rtl::OUString sLibrary;
+
+ // the local macro name and the event type are specified as properties
+ pEventDescription = aEvent->second.getConstArray();
+ pEventDescriptionEnd = pEventDescription + aEvent->second.getLength();
+ for (;pEventDescription != pEventDescriptionEnd; ++pEventDescription)
+ {
+ if ((0 == pEventDescription->Name.compareToAscii(EVENT_LOCALMACRONAME)) ||
+ (0 == pEventDescription->Name.compareToAscii(EVENT_SCRIPTURL)))
+ pEventDescription->Value >>= pTranslated->ScriptCode;
+ else if (0 == pEventDescription->Name.compareToAscii(EVENT_TYPE))
+ pEventDescription->Value >>= pTranslated->ScriptType;
+ else if ( 0 == pEventDescription->Name.compareToAscii( EVENT_LIBRARY ) )
+ pEventDescription->Value >>= sLibrary;
+ }
+
+ if ( 0 == pTranslated->ScriptType.compareToAscii( EVENT_STARBASIC ) )
+ {
+ if ( 0 == sLibrary.compareToAscii( EVENT_STAROFFICE ) )
+ sLibrary = EVENT_APPLICATION;
+
+ if ( sLibrary.getLength() )
+ {
+ // for StarBasic, the library is prepended
+ sal_Unicode cLibSeparator = ':';
+ sLibrary += ::rtl::OUString( &cLibSeparator, 1 );
+ }
+ sLibrary += pTranslated->ScriptCode;
+ pTranslated->ScriptCode = sLibrary;
+ }
+ }
+
+ // register the events
+ m_rEventAttacher.registerEvents(aTranslated);
+
+ XMLEventsImportContext::EndElement();
+ }
+
+ //=====================================================================
+ //= ODefaultEventAttacherManager
+ //=====================================================================
+
+ ODefaultEventAttacherManager::~ODefaultEventAttacherManager()
+ {
+ }
+
+ //-------------------------------------------------------------------------
+ void ODefaultEventAttacherManager::registerEvents(const Reference< XPropertySet >& _rxElement,
+ const Sequence< ScriptEventDescriptor >& _rEvents)
+ {
+ OSL_ENSURE(m_aEvents.end() == m_aEvents.find(_rxElement),
+ "ODefaultEventAttacherManager::registerEvents: already have events for this object!");
+ // for the moment, only remember the script events
+ m_aEvents[_rxElement] = _rEvents;
+ }
+
+ //-------------------------------------------------------------------------
+ void ODefaultEventAttacherManager::setEvents(const Reference< XIndexAccess >& _rxContainer)
+ {
+ Reference< XEventAttacherManager > xEventManager(_rxContainer, UNO_QUERY);
+ if (!xEventManager.is())
+ {
+ OSL_FAIL("ODefaultEventAttacherManager::setEvents: invalid argument!");
+ return;
+ }
+
+ // loop through all elements
+ sal_Int32 nCount = _rxContainer->getCount();
+ Reference< XPropertySet > xCurrent;
+ ConstMapPropertySet2ScriptSequenceIterator aRegisteredEventsPos;
+ for (sal_Int32 i=0; i<nCount; ++i)
+ {
+ ::cppu::extractInterface(xCurrent, _rxContainer->getByIndex(i));
+ if (xCurrent.is())
+ {
+ aRegisteredEventsPos = m_aEvents.find(xCurrent);
+ if (m_aEvents.end() != aRegisteredEventsPos)
+ xEventManager->registerScriptEvents(i, aRegisteredEventsPos->second);
+ }
+ }
+ }
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/eventimport.hxx b/xmloff/source/forms/eventimport.hxx
new file mode 100644
index 000000000000..b8e21782860c
--- /dev/null
+++ b/xmloff/source/forms/eventimport.hxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_FORMS_EVENTIMPORT_HXX_
+#define _XMLOFF_FORMS_EVENTIMPORT_HXX_
+
+#include <xmloff/XMLEventsImportContext.hxx>
+#include "callbacks.hxx"
+#include "ifacecompare.hxx"
+#include <com/sun/star/container/XIndexAccess.hpp>
+
+class SvXMLImport;
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ //=====================================================================
+ //= OFormEventsImportContext
+ //=====================================================================
+ class OFormEventsImportContext : public XMLEventsImportContext
+ {
+ protected:
+ IEventAttacher& m_rEventAttacher;
+
+ public:
+ OFormEventsImportContext(SvXMLImport& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
+ IEventAttacher& _rEventAttacher);
+
+ protected:
+ virtual void EndElement();
+ };
+
+ //=====================================================================
+ //= ODefaultEventAttacherManager
+ //=====================================================================
+ class ODefaultEventAttacherManager : public IEventAttacherManager
+ {
+ protected:
+ DECLARE_STL_MAP(
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >, // map from
+ ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >, // map to
+ OPropertySetCompare, // compare method
+ MapPropertySet2ScriptSequence); // class name
+ // usually an event attacher manager will need to collect all script events registered, 'cause
+ // the _real_ XEventAttacherManager handles it's events by index, but out indicies are not fixed
+ // until _all_ controls have been inserted.
+
+ MapPropertySet2ScriptSequence m_aEvents;
+
+ public:
+ // IEventAttacherManager
+ virtual void registerEvents(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxElement,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& _rEvents
+ );
+
+ protected:
+ void setEvents(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& _rxContainer
+ );
+
+ virtual ~ODefaultEventAttacherManager();
+ };
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+#endif // _XMLOFF_FORMS_EVENTIMPORT_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/formattributes.cxx b/xmloff/source/forms/formattributes.cxx
new file mode 100644
index 000000000000..e65f3c0bf488
--- /dev/null
+++ b/xmloff/source/forms/formattributes.cxx
@@ -0,0 +1,347 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "formattributes.hxx"
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmluconv.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/logfile.hxx>
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::beans;
+
+
+ //=====================================================================
+ //= OAttributeMetaData
+ //=====================================================================
+ //---------------------------------------------------------------------
+ const sal_Char* OAttributeMetaData::getCommonControlAttributeName(sal_Int32 _nId)
+ {
+ switch (_nId)
+ {
+ case CCA_NAME: return "name";
+ case CCA_SERVICE_NAME: return "control-implementation";
+ case CCA_BUTTON_TYPE: return "button-type";
+// disabled(AddAttributeIdLegacy) case CCA_CONTROL_ID: return "id";
+ case CCA_CURRENT_SELECTED: return "current-selected";
+ case CCA_CURRENT_VALUE: return "current-value";
+ case CCA_DISABLED: return "disabled";
+ case CCA_ENABLEVISIBLE: return "visible";
+ case CCA_DROPDOWN: return "dropdown";
+ case CCA_FOR: return "for";
+ case CCA_IMAGE_DATA: return "image-data";
+ case CCA_LABEL: return "label";
+ case CCA_MAX_LENGTH: return "max-length";
+ case CCA_PRINTABLE: return "printable";
+ case CCA_READONLY: return "readonly";
+ case CCA_SELECTED: return "selected";
+ case CCA_SIZE: return "size";
+ case CCA_TAB_INDEX: return "tab-index";
+ case CCA_TARGET_FRAME: return "target-frame";
+ case CCA_TARGET_LOCATION: return "href"; // the only special thing here: TargetLocation is represented by an xlink:href attribute
+ case CCA_TAB_STOP: return "tab-stop";
+ case CCA_TITLE: return "title";
+ case CCA_VALUE: return "value";
+ case CCA_ORIENTATION: return "orientation";
+ case CCA_VISUAL_EFFECT: return "visual-effect";
+ default:
+ OSL_FAIL("OAttributeMetaData::getCommonControlAttributeName: invalid id (maybe you or-ed two flags?)!");
+ }
+ return "";
+ }
+
+ //---------------------------------------------------------------------
+ sal_uInt16 OAttributeMetaData::getCommonControlAttributeNamespace(sal_Int32 _nId)
+ {
+ if (CCA_TARGET_LOCATION == _nId)
+ return XML_NAMESPACE_XLINK;
+
+ if (CCA_TARGET_FRAME == _nId)
+ return XML_NAMESPACE_OFFICE;
+
+ return XML_NAMESPACE_FORM;
+ }
+
+ //---------------------------------------------------------------------
+ const sal_Char* OAttributeMetaData::getFormAttributeName(FormAttributes _eAttrib)
+ {
+ switch (_eAttrib)
+ {
+ case faName: return "name";
+ case faServiceName: return "service-name";
+ case faAction: return "href"; // the only special thing here: Action is represented by an xlink:href attribute
+ case faEnctype: return "enctype";
+ case faMethod: return "method";
+ case faTargetFrame: return "target-frame";
+ case faAllowDeletes: return "allow-deletes";
+ case faAllowInserts: return "allow-inserts";
+ case faAllowUpdates: return "allow-updates";
+ case faApplyFilter: return "apply-filter";
+ case faCommand: return "command";
+ case faCommandType: return "command-type";
+ case faEscapeProcessing: return "escape-processing";
+ case faDatasource: return "datasource";
+ case faConnectionResource: return "connection-resource";
+ case faDetailFiels: return "detail-fields";
+ case faFilter: return "filter";
+ case faIgnoreResult: return "ignore-result";
+ case faMasterFields: return "master-fields";
+ case faNavigationMode: return "navigation-mode";
+ case faOrder: return "order";
+ case faTabbingCycle: return "tab-cycle";
+ default:
+ OSL_FAIL("OAttributeMetaData::getFormAttributeName: invalid id!");
+ }
+ return "";
+ }
+
+ //---------------------------------------------------------------------
+ sal_uInt16 OAttributeMetaData::getFormAttributeNamespace(FormAttributes _eAttrib)
+ {
+ if (faAction == _eAttrib)
+ return XML_NAMESPACE_XLINK;
+
+ if (faTargetFrame == _eAttrib)
+ return XML_NAMESPACE_OFFICE;
+
+ return XML_NAMESPACE_FORM;
+ }
+
+ //---------------------------------------------------------------------
+ const sal_Char* OAttributeMetaData::getDatabaseAttributeName(sal_Int32 _nId)
+ {
+ switch (_nId)
+ {
+ case DA_BOUND_COLUMN: return "bound-column";
+ case DA_CONVERT_EMPTY: return "convert-empty-to-null";
+ case DA_DATA_FIELD: return "data-field";
+ case DA_LIST_SOURCE: return "list-source";
+ case DA_LIST_SOURCE_TYPE: return "list-source-type";
+ case DA_INPUT_REQUIRED: return "input-required";
+ default:
+ OSL_FAIL("OAttributeMetaData::getDatabaseAttributeName: invalid id (maybe you or-ed two flags?)!");
+ }
+ return "";
+ }
+
+ //---------------------------------------------------------------------
+ sal_uInt16 OAttributeMetaData::getDatabaseAttributeNamespace(sal_Int32 /*_nId*/)
+ {
+ // nothing special here
+ return XML_NAMESPACE_FORM;
+ }
+
+ //---------------------------------------------------------------------
+ const sal_Char* OAttributeMetaData::getBindingAttributeName(sal_Int32 _nId)
+ {
+ switch (_nId)
+ {
+ case BA_LINKED_CELL: return "linked-cell";
+ case BA_LIST_LINKING_TYPE: return "list-linkage-type";
+ case BA_LIST_CELL_RANGE: return "source-cell-range";
+ default:
+ OSL_FAIL("OAttributeMetaData::getBindingAttributeName: invalid id (maybe you or-ed two flags?)!");
+ }
+ return "";
+ }
+
+ //---------------------------------------------------------------------
+ sal_uInt16 OAttributeMetaData::getBindingAttributeNamespace(sal_Int32)
+ {
+ // nothing special here
+ return XML_NAMESPACE_FORM;
+ }
+
+ //---------------------------------------------------------------------
+ const sal_Char* OAttributeMetaData::getSpecialAttributeName(sal_Int32 _nId)
+ {
+ switch (_nId)
+ {
+ case SCA_ECHO_CHAR: return "echo-char";
+ case SCA_MAX_VALUE: return "max-value";
+ case SCA_MIN_VALUE: return "min-value";
+ case SCA_VALIDATION: return "validation";
+ case SCA_GROUP_NAME: return "group-name";
+ case SCA_MULTI_LINE: return "multi-line";
+ case SCA_AUTOMATIC_COMPLETION: return "auto-complete";
+ case SCA_MULTIPLE: return "multiple";
+ case SCA_DEFAULT_BUTTON: return "default-button";
+ case SCA_CURRENT_STATE: return "current-state";
+ case SCA_IS_TRISTATE: return "is-tristate";
+ case SCA_STATE: return "state";
+ case SCA_COLUMN_STYLE_NAME: return "text-style-name";
+ case SCA_STEP_SIZE: return "step-size";
+ case SCA_PAGE_STEP_SIZE: return "page-step-size";
+ case SCA_REPEAT_DELAY: return "delay-for-repeat";
+ case SCA_TOGGLE: return "toggle";
+ case SCA_FOCUS_ON_CLICK: return "focus-on-click";
+ default:
+ OSL_FAIL("OAttributeMetaData::getSpecialAttributeName: invalid id (maybe you or-ed two flags?)!");
+ }
+ return "";
+ }
+
+ //---------------------------------------------------------------------
+ sal_uInt16 OAttributeMetaData::getSpecialAttributeNamespace(sal_Int32 _nId)
+ {
+ switch( _nId )
+ {
+ case SCA_GROUP_NAME: return XML_NAMESPACE_FORMX;
+ }
+ return XML_NAMESPACE_FORM;
+ }
+
+ //---------------------------------------------------------------------
+ const sal_Char* OAttributeMetaData::getOfficeFormsAttributeName(OfficeFormsAttributes _eAttrib)
+ {
+ switch (_eAttrib)
+ {
+ case ofaAutomaticFocus: return "automatic-focus";
+ case ofaApplyDesignMode: return "apply-design-mode";
+ default:
+ OSL_FAIL("OAttributeMetaData::getOfficeFormsAttributeName: invalid id!");
+ }
+ return "";
+ }
+
+ //---------------------------------------------------------------------
+ sal_uInt16 OAttributeMetaData::getOfficeFormsAttributeNamespace(OfficeFormsAttributes /* _eAttrib */)
+ {
+ // nothing special here
+ return XML_NAMESPACE_FORM;
+ }
+
+ //=====================================================================
+ //= OAttribute2Property
+ //=====================================================================
+ //---------------------------------------------------------------------
+ OAttribute2Property::OAttribute2Property()
+ {
+ }
+
+ //---------------------------------------------------------------------
+ OAttribute2Property::~OAttribute2Property()
+ {
+ }
+
+ //---------------------------------------------------------------------
+ const OAttribute2Property::AttributeAssignment* OAttribute2Property::getAttributeTranslation(
+ const ::rtl::OUString& _rAttribName)
+ {
+ ConstAttributeAssignmentsIterator aPos = m_aKnownProperties.find(_rAttribName);
+ if (m_aKnownProperties.end() != aPos)
+ return &aPos->second;
+ return NULL;
+ }
+
+ //---------------------------------------------------------------------
+ void OAttribute2Property::addStringProperty(
+ const sal_Char* _pAttributeName, const ::rtl::OUString& _rPropertyName,
+ const sal_Char* _pAttributeDefault)
+ {
+ implAdd(_pAttributeName, _rPropertyName, ::getCppuType( static_cast< ::rtl::OUString* >(NULL) ),
+ _pAttributeDefault ? ::rtl::OUString::createFromAscii(_pAttributeDefault) : ::rtl::OUString());
+ }
+
+ //---------------------------------------------------------------------
+ void OAttribute2Property::addBooleanProperty(
+ const sal_Char* _pAttributeName, const ::rtl::OUString& _rPropertyName,
+ const sal_Bool _bAttributeDefault, const sal_Bool _bInverseSemantics)
+ {
+ ::rtl::OUStringBuffer aDefault;
+ SvXMLUnitConverter::convertBool(aDefault, _bAttributeDefault);
+ AttributeAssignment& aAssignment = implAdd(_pAttributeName, _rPropertyName, ::getBooleanCppuType(), aDefault.makeStringAndClear());
+ aAssignment.bInverseSemantics = _bInverseSemantics;
+ }
+
+ //---------------------------------------------------------------------
+ void OAttribute2Property::addInt16Property(
+ const sal_Char* _pAttributeName, const ::rtl::OUString& _rPropertyName,
+ const sal_Int16 _nAttributeDefault)
+ {
+ ::rtl::OUStringBuffer aDefault;
+ SvXMLUnitConverter::convertNumber(aDefault, (sal_Int32)_nAttributeDefault);
+ implAdd(_pAttributeName, _rPropertyName, ::getCppuType( static_cast< sal_Int16* >(NULL) ), aDefault.makeStringAndClear());
+ }
+
+ //---------------------------------------------------------------------
+ void OAttribute2Property::addInt32Property(
+ const sal_Char* _pAttributeName, const ::rtl::OUString& _rPropertyName,
+ const sal_Int32 _nAttributeDefault)
+ {
+ ::rtl::OUStringBuffer aDefault;
+ SvXMLUnitConverter::convertNumber( aDefault, _nAttributeDefault );
+ implAdd( _pAttributeName, _rPropertyName, ::getCppuType( static_cast< sal_Int32* >(NULL) ), aDefault.makeStringAndClear() );
+ }
+
+ //---------------------------------------------------------------------
+ void OAttribute2Property::addEnumProperty(
+ const sal_Char* _pAttributeName, const ::rtl::OUString& _rPropertyName,
+ const sal_uInt16 _nAttributeDefault, const SvXMLEnumMapEntry* _pValueMap,
+ const ::com::sun::star::uno::Type* _pType)
+ {
+ ::rtl::OUStringBuffer aDefault;
+ SvXMLUnitConverter::convertEnum(aDefault, _nAttributeDefault, _pValueMap);
+ AttributeAssignment& aAssignment = implAdd(_pAttributeName, _rPropertyName,
+ _pType ? *_pType : ::getCppuType( static_cast< sal_Int32* >(NULL) ),
+ // this assumes that the setPropertyValue for enums can handle int32's ....
+ aDefault.makeStringAndClear());
+ aAssignment.pEnumMap = _pValueMap;
+ }
+
+ //---------------------------------------------------------------------
+ OAttribute2Property::AttributeAssignment& OAttribute2Property::implAdd(
+ const sal_Char* _pAttributeName, const ::rtl::OUString& _rPropertyName,
+ const ::com::sun::star::uno::Type& _rType, const ::rtl::OUString& /*_rDefaultString*/)
+ {
+ OSL_ENSURE(m_aKnownProperties.end() == m_aKnownProperties.find(::rtl::OUString::createFromAscii(_pAttributeName)),
+ "OAttribute2Property::implAdd: already have this attribute!");
+
+ ::rtl::OUString sAttributeName = ::rtl::OUString::createFromAscii(_pAttributeName);
+
+ AttributeAssignment aAssignment;
+ aAssignment.sAttributeName = sAttributeName;
+ aAssignment.sPropertyName = _rPropertyName;
+ aAssignment.aPropertyType = _rType;
+
+ // redundance, the accessor is stored in aAssignment.sAttributeName, too
+ return m_aKnownProperties[sAttributeName] = aAssignment;
+ }
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/formattributes.hxx b/xmloff/source/forms/formattributes.hxx
new file mode 100644
index 000000000000..28cfb8655ab8
--- /dev/null
+++ b/xmloff/source/forms/formattributes.hxx
@@ -0,0 +1,366 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_FORMATTRIBUTES_HXX_
+#define _XMLOFF_FORMATTRIBUTES_HXX_
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <sal/types.h>
+#include <salhelper/simplereferenceobject.hxx>
+#include <comphelper/stl_types.hxx>
+
+class SvXMLExport;
+struct SvXMLEnumMapEntry;
+
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ // flags for common control attributes
+ #define CCA_NAME 0x00000001
+ #define CCA_SERVICE_NAME 0x00000002
+ #define CCA_BUTTON_TYPE 0x00000004
+ #define CCA_CONTROL_ID 0x00000008
+ #define CCA_CURRENT_SELECTED 0x00000010
+ #define CCA_CURRENT_VALUE 0x00000020
+ #define CCA_DISABLED 0x00000040
+ #define CCA_DROPDOWN 0x00000080
+ #define CCA_FOR 0x00000100
+ #define CCA_IMAGE_DATA 0x00000200
+ #define CCA_LABEL 0x00000400
+ #define CCA_MAX_LENGTH 0x00000800
+ #define CCA_PRINTABLE 0x00001000
+ #define CCA_READONLY 0x00002000
+ #define CCA_SELECTED 0x00004000
+ #define CCA_SIZE 0x00008000
+ #define CCA_TAB_INDEX 0x00010000
+ #define CCA_TARGET_FRAME 0x00020000
+ #define CCA_TARGET_LOCATION 0x00040000
+ #define CCA_TAB_STOP 0x00080000
+ #define CCA_TITLE 0x00100000
+ #define CCA_VALUE 0x00200000
+ #define CCA_ORIENTATION 0x00400000
+ #define CCA_VISUAL_EFFECT 0x00800000
+ #define CCA_ENABLEVISIBLE 0x01000000
+
+ // flags for database control atttributes
+ #define DA_BOUND_COLUMN 0x00000001
+ #define DA_CONVERT_EMPTY 0x00000002
+ #define DA_DATA_FIELD 0x00000004
+ #define DA_LIST_SOURCE 0x00000008
+ #define DA_LIST_SOURCE_TYPE 0x00000010
+ #define DA_INPUT_REQUIRED 0x00000020
+
+ // flags for binding related control attributes
+ #define BA_LINKED_CELL 0x00000001
+ #define BA_LIST_LINKING_TYPE 0x00000002
+ #define BA_LIST_CELL_RANGE 0x00000004
+ #define BA_XFORMS_BIND 0x00000008
+ #define BA_XFORMS_LISTBIND 0x00000010
+ #define BA_XFORMS_SUBMISSION 0x00000020
+
+ // flags for event attributes
+ #define EA_CONTROL_EVENTS 0x00000001
+ #define EA_ON_CHANGE 0x00000002
+ #define EA_ON_CLICK 0x00000004
+ #define EA_ON_DBLCLICK 0x00000008
+ #define EA_ON_SELECT 0x00000010
+
+ /// attributes in the xml tag representing a form
+ enum FormAttributes
+ {
+ faName,
+ faServiceName,
+ faAction,
+ faEnctype,
+ faMethod,
+ faTargetFrame,
+ faAllowDeletes,
+ faAllowInserts,
+ faAllowUpdates,
+ faApplyFilter,
+ faCommand,
+ faCommandType,
+ faEscapeProcessing,
+ faDatasource,
+ faConnectionResource,
+ faDetailFiels,
+ faFilter,
+ faIgnoreResult,
+ faMasterFields,
+ faNavigationMode,
+ faOrder,
+ faTabbingCycle
+ };
+
+ // any other attributes, which are special to some control types
+ #define SCA_ECHO_CHAR 0x00000001
+ #define SCA_MAX_VALUE 0x00000002
+ #define SCA_MIN_VALUE 0x00000004
+ #define SCA_VALIDATION 0x00000008
+ #define SCA_GROUP_NAME 0x00000010
+ #define SCA_MULTI_LINE 0x00000020
+ #define SCA_AUTOMATIC_COMPLETION 0x00000080
+ #define SCA_MULTIPLE 0x00000100
+ #define SCA_DEFAULT_BUTTON 0x00000200
+ #define SCA_CURRENT_STATE 0x00000400
+ #define SCA_IS_TRISTATE 0x00000800
+ #define SCA_STATE 0x00001000
+ #define SCA_COLUMN_STYLE_NAME 0x00002000
+ #define SCA_STEP_SIZE 0x00004000
+ #define SCA_PAGE_STEP_SIZE 0x00008000
+ #define SCA_REPEAT_DELAY 0x00010000
+ #define SCA_TOGGLE 0x00020000
+ #define SCA_FOCUS_ON_CLICK 0x00040000
+ #define SCA_IMAGE_POSITION 0x00080000
+
+ // attributes of the office:forms element
+ enum OfficeFormsAttributes
+ {
+ ofaAutomaticFocus,
+ ofaApplyDesignMode
+ };
+
+ //=====================================================================
+ //= OAttributeMetaData
+ //=====================================================================
+ /** allows the translation of attribute ids into strings.
+
+ <p>This class does not allow to connect xml attributes to property names or
+ something like that, it only deals with the xml side</p>
+ */
+ class OAttributeMetaData
+ {
+ public:
+ /** calculates the xml attribute representation of a common control attribute.
+ @param _nId
+ the id of the attribute. Has to be one of the CCA_* constants.
+ */
+ static const sal_Char* getCommonControlAttributeName(sal_Int32 _nId);
+
+ /** calculates the xml namespace key to use for a common control attribute
+ @param _nId
+ the id of the attribute. Has to be one of the CCA_* constants.
+ */
+ static sal_uInt16 getCommonControlAttributeNamespace(sal_Int32 _nId);
+
+ /** retrieves the name of an attribute of a form xml representation
+ @param _eAttrib
+ enum value specifying the attribute
+ */
+ static const sal_Char* getFormAttributeName(FormAttributes _eAttrib);
+
+ /** calculates the xml namespace key to use for a attribute of a form xml representation
+ @param _eAttrib
+ enum value specifying the attribute
+ */
+ static sal_uInt16 getFormAttributeNamespace(FormAttributes _eAttrib);
+
+ /** calculates the xml attribute representation of a database attribute.
+ @param _nId
+ the id of the attribute. Has to be one of the DA_* constants.
+ */
+ static const sal_Char* getDatabaseAttributeName(sal_Int32 _nId);
+
+ /** calculates the xml namespace key to use for a database attribute.
+ @param _nId
+ the id of the attribute. Has to be one of the DA_* constants.
+ */
+ static sal_uInt16 getDatabaseAttributeNamespace(sal_Int32 _nId);
+
+ /** calculates the xml attribute representation of a special attribute.
+ @param _nId
+ the id of the attribute. Has to be one of the SCA_* constants.
+ */
+ static const sal_Char* getSpecialAttributeName(sal_Int32 _nId);
+
+ /** calculates the xml attribute representation of a binding attribute.
+ @param _nId
+ the id of the attribute. Has to be one of the BA_* constants.
+ */
+ static const sal_Char* getBindingAttributeName(sal_Int32 _nId);
+
+ /** calculates the xml namespace key to use for a binding attribute.
+ @param _nId
+ the id of the attribute. Has to be one of the BA_* constants.
+ */
+ static sal_uInt16 getBindingAttributeNamespace(sal_Int32 _nId);
+
+ /** calculates the xml namespace key to use for a special attribute.
+ @param _nId
+ the id of the attribute. Has to be one of the SCA_* constants.
+ */
+ static sal_uInt16 getSpecialAttributeNamespace(sal_Int32 _nId);
+
+ /** calculates the xml attribute representation of a attribute of the office:forms element
+ @param _nId
+ the id of the attribute
+ */
+ static const sal_Char* getOfficeFormsAttributeName(OfficeFormsAttributes _eAttrib);
+
+ /** calculates the xml namedspace key of a attribute of the office:forms element
+ @param _nId
+ the id of the attribute
+ */
+ static sal_uInt16 getOfficeFormsAttributeNamespace(OfficeFormsAttributes _eAttrib);
+ };
+
+ //=====================================================================
+ //= OAttribute2Property
+ //=====================================================================
+ /** some kind of opposite to the OAttributeMetaData class. Able to translate
+ attributes into property names/types
+
+ <p>The construction of this class is rather expensive (or at least it's initialization from outside),
+ so it should be shared</p>
+ */
+ class OAttribute2Property
+ {
+ public:
+ // TODO: maybe the following struct should be used for exports, too. In this case we would not need to
+ // store it's instances in a map, but in a vector for faster access.
+ struct AttributeAssignment
+ {
+ ::rtl::OUString sAttributeName; // the attribute name
+ ::rtl::OUString sPropertyName; // the property name
+ ::com::sun::star::uno::Type aPropertyType; // the property type
+ ::rtl::OUString sAttributeDefault; // the default if the attribute is not present
+
+ // entries which are special to some value types
+ const SvXMLEnumMapEntry* pEnumMap; // the enum map, if appliable
+ sal_Bool bInverseSemantics; // for booleanss: attribute and property value have the same or an inverse semantics?
+
+ AttributeAssignment() : pEnumMap(NULL), bInverseSemantics(sal_False) { }
+ };
+
+ protected:
+ DECLARE_STL_USTRINGACCESS_MAP( AttributeAssignment, AttributeAssignments );
+ AttributeAssignments m_aKnownProperties;
+
+ public:
+ OAttribute2Property();
+ virtual ~OAttribute2Property();
+
+ /** return the AttributeAssignment which corresponds to the given attribute
+
+ @param _rAttribName
+ the name of the attrribute
+ @return
+ a pointer to the <type>AttributeAssignment</type> structure as requested, NULL if the attribute
+ does not represent a property.
+ */
+ const AttributeAssignment* getAttributeTranslation(
+ const ::rtl::OUString& _rAttribName);
+
+ /** add a attribute assignment referring to a string property to the map
+ @param _pAttributeName
+ the name of the attrribute
+ @param _rPropertyName
+ the name of the property assigned to the attribute
+ @param _pAttributeDefault
+ the default value for the attribute, if any. May be NULL, in this case the default is assumed to be
+ an empty string.
+ */
+ void addStringProperty(
+ const sal_Char* _pAttributeName, const ::rtl::OUString& _rPropertyName,
+ const sal_Char* _pAttributeDefault = NULL);
+
+ /** add a attribute assignment referring to a boolean property to the map
+
+ @param _pAttributeName
+ the name of the attrribute
+ @param _rPropertyName
+ the name of the property assigned to the attribute
+ @param _bAttributeDefault
+ the default value for the attribute.
+ @param _bInverseSemantics
+ if <TRUE/>, a attribute value of <TRUE/> means a property value of <FALSE/> and vice verse.<br/>
+ if <FALSE/>, the attribute value is used as property value directly
+ */
+ void addBooleanProperty(
+ const sal_Char* _pAttributeName, const ::rtl::OUString& _rPropertyName,
+ const sal_Bool _bAttributeDefault, const sal_Bool _bInverseSemantics = sal_False);
+
+ /** add a attribute assignment referring to an int16 property to the map
+
+ @param _pAttributeName
+ the name of the attrribute
+ @param _rPropertyName
+ the name of the property assigned to the attribute
+ @param _nAttributeDefault
+ the default value for the attribute.
+ */
+ void addInt16Property(
+ const sal_Char* _pAttributeName, const ::rtl::OUString& _rPropertyName,
+ const sal_Int16 _nAttributeDefault);
+
+ /** add a attribute assignment referring to an int32 property to the map
+
+ @param _pAttributeName
+ the name of the attrribute
+ @param _rPropertyName
+ the name of the property assigned to the attribute
+ @param _nAttributeDefault
+ the default value for the attribute.
+ */
+ void addInt32Property(
+ const sal_Char* _pAttributeName, const ::rtl::OUString& _rPropertyName,
+ const sal_Int32 _nAttributeDefault );
+
+ /** add a attribute assignment referring to an enum property to the map
+
+ @param _pAttributeName
+ the name of the attrribute
+ @param _rPropertyName
+ the name of the property assigned to the attribute
+ @param _nAttributeDefault
+ the default value for the attribute, as (32bit) integer
+ @param _pValueMap
+ the map to translate strings into enum values
+ @param _pType
+ the type of the property. May be NULL, in this case 32bit integer is assumed.
+ */
+ void addEnumProperty(
+ const sal_Char* _pAttributeName, const ::rtl::OUString& _rPropertyName,
+ const sal_uInt16 _nAttributeDefault, const SvXMLEnumMapEntry* _pValueMap,
+ const ::com::sun::star::uno::Type* _pType = NULL);
+
+ protected:
+ /// some common code for the various add*Property methods
+ AttributeAssignment& implAdd(
+ const sal_Char* _pAttributeName, const ::rtl::OUString& _rPropertyName,
+ const ::com::sun::star::uno::Type& _rType, const ::rtl::OUString& _rDefaultString);
+ };
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+#endif // _XMLOFF_FORMATTRIBUTES_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/formcellbinding.cxx b/xmloff/source/forms/formcellbinding.cxx
new file mode 100644
index 000000000000..3e980611abcd
--- /dev/null
+++ b/xmloff/source/forms/formcellbinding.cxx
@@ -0,0 +1,493 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "formcellbinding.hxx"
+#include <com/sun/star/form/binding/XBindableValue.hpp>
+#include <com/sun/star/form/binding/XListEntrySink.hpp>
+#include <com/sun/star/form/XGridColumnFactory.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+#include <com/sun/star/table/XCellRange.hpp>
+#include <com/sun/star/form/XFormsSupplier.hpp>
+#include <com/sun/star/form/XForm.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include "strings.hxx"
+#include <osl/diagnose.h>
+#include <rtl/logfile.hxx>
+
+#include <functional>
+#include <algorithm>
+
+//............................................................................
+namespace xmloff
+{
+//............................................................................
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::beans;
+ using namespace ::com::sun::star::frame;
+ using namespace ::com::sun::star::sheet;
+ using namespace ::com::sun::star::container;
+ using namespace ::com::sun::star::drawing;
+ using namespace ::com::sun::star::table;
+ using namespace ::com::sun::star::form;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::form::binding;
+
+namespace
+{
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::container::XChild;
+ using ::com::sun::star::frame::XModel;
+ using ::com::sun::star::uno::UNO_QUERY;
+
+ //....................................................................
+ template< class TYPE >
+ Reference< TYPE > getTypedModelNode( const Reference< XInterface >& _rxModelNode )
+ {
+ Reference< TYPE > xTypedNode( _rxModelNode, UNO_QUERY );
+ if ( xTypedNode.is() )
+ return xTypedNode;
+ else
+ {
+ Reference< XChild > xChild( _rxModelNode, UNO_QUERY );
+ if ( xChild.is() )
+ return getTypedModelNode< TYPE >( xChild->getParent() );
+ else
+ return NULL;
+ }
+ }
+
+ //....................................................................
+ Reference< XModel > getDocument( const Reference< XInterface >& _rxModelNode )
+ {
+ return getTypedModelNode< XModel >( _rxModelNode );
+ }
+
+ //....................................................................
+ struct StringCompare : public ::std::unary_function< ::rtl::OUString, bool >
+ {
+ private:
+ const ::rtl::OUString m_sReference;
+
+ public:
+ StringCompare( const ::rtl::OUString& _rReference ) : m_sReference( _rReference ) { }
+
+ inline bool operator()( const ::rtl::OUString& _rCompare )
+ {
+ return ( _rCompare == m_sReference );
+ }
+ };
+}
+
+//========================================================================
+//= FormCellBindingHelper
+//========================================================================
+//------------------------------------------------------------------------
+FormCellBindingHelper::FormCellBindingHelper( const Reference< XPropertySet >& _rxControlModel, const Reference< XModel >& _rxDocument )
+ :m_xControlModel( _rxControlModel )
+ ,m_xDocument( _rxDocument, UNO_QUERY )
+{
+ OSL_ENSURE( m_xControlModel.is(), "FormCellBindingHelper::FormCellBindingHelper: invalid control model!" );
+
+ if ( !m_xDocument.is() )
+ m_xDocument = m_xDocument.query( getDocument( m_xControlModel ) );
+ OSL_ENSURE( m_xDocument.is(), "FormCellBindingHelper::FormCellBindingHelper: Did not find the spreadsheet document!" );
+}
+
+//------------------------------------------------------------------------
+sal_Bool FormCellBindingHelper::livesInSpreadsheetDocument( const Reference< XPropertySet >& _rxControlModel )
+{
+ Reference< XSpreadsheetDocument > xDocument( getDocument( _rxControlModel ), UNO_QUERY );
+ return xDocument.is();
+}
+
+//------------------------------------------------------------------------
+bool FormCellBindingHelper::convertStringAddress( const ::rtl::OUString& _rAddressDescription, CellAddress& /* [out] */ _rAddress, sal_Int16 /*_nAssumeSheet*/ ) const
+{
+ Any aAddress;
+ return doConvertAddressRepresentations(
+ PROPERTY_FILE_REPRESENTATION,
+ makeAny( _rAddressDescription ),
+ PROPERTY_ADDRESS,
+ aAddress,
+ false
+ )
+ && ( aAddress >>= _rAddress );
+}
+
+//------------------------------------------------------------------------
+bool FormCellBindingHelper::convertStringAddress( const ::rtl::OUString& _rAddressDescription,
+ CellRangeAddress& /* [out] */ _rAddress ) const
+{
+ Any aAddress;
+ return doConvertAddressRepresentations(
+ PROPERTY_FILE_REPRESENTATION,
+ makeAny( _rAddressDescription ),
+ PROPERTY_ADDRESS,
+ aAddress,
+ true
+ )
+ && ( aAddress >>= _rAddress );
+}
+
+//------------------------------------------------------------------------
+Reference< XValueBinding > FormCellBindingHelper::createCellBindingFromStringAddress( const ::rtl::OUString& _rAddress, bool _bUseIntegerBinding ) const
+{
+ Reference< XValueBinding > xBinding;
+ if ( !m_xDocument.is() )
+ // very bad ...
+ return xBinding;
+
+ // get the UNO representation of the address
+ CellAddress aAddress;
+ if ( !_rAddress.getLength() || !convertStringAddress( _rAddress, aAddress ) )
+ return xBinding;
+
+ xBinding = xBinding.query( createDocumentDependentInstance(
+ _bUseIntegerBinding ? SERVICE_LISTINDEXCELLBINDING : SERVICE_CELLVALUEBINDING,
+ PROPERTY_BOUND_CELL,
+ makeAny( aAddress )
+ ) );
+
+ return xBinding;
+}
+
+//------------------------------------------------------------------------
+Reference< XListEntrySource > FormCellBindingHelper::createCellListSourceFromStringAddress( const ::rtl::OUString& _rAddress ) const
+{
+ Reference< XListEntrySource > xSource;
+
+ CellRangeAddress aRangeAddress;
+ if ( !convertStringAddress( _rAddress, aRangeAddress ) )
+ return xSource;
+
+ // create a range object for this address
+ xSource = xSource.query( createDocumentDependentInstance(
+ SERVICE_CELLRANGELISTSOURCE,
+ PROPERTY_LIST_CELL_RANGE,
+ makeAny( aRangeAddress )
+ ) );
+
+ return xSource;
+}
+
+//------------------------------------------------------------------------
+::rtl::OUString FormCellBindingHelper::getStringAddressFromCellBinding( const Reference< XValueBinding >& _rxBinding ) const
+{
+ OSL_PRECOND( !_rxBinding.is() || isCellBinding( _rxBinding ), "FormCellBindingHelper::getStringAddressFromCellBinding: this is no cell binding!" );
+
+ ::rtl::OUString sAddress;
+ try
+ {
+ Reference< XPropertySet > xBindingProps( _rxBinding, UNO_QUERY );
+ OSL_ENSURE( xBindingProps.is() || !_rxBinding.is(), "FormCellBindingHelper::getStringAddressFromCellBinding: no property set for the binding!" );
+ if ( xBindingProps.is() )
+ {
+ CellAddress aAddress;
+ xBindingProps->getPropertyValue( PROPERTY_BOUND_CELL ) >>= aAddress;
+
+ Any aStringAddress;
+ doConvertAddressRepresentations( PROPERTY_ADDRESS, makeAny( aAddress ),
+ PROPERTY_FILE_REPRESENTATION, aStringAddress, false );
+
+ aStringAddress >>= sAddress;
+ }
+ }
+ catch( const Exception& )
+ {
+ OSL_FAIL( "FormCellBindingHelper::getStringAddressFromCellBinding: caught an exception!" );
+ }
+
+ return sAddress;
+}
+
+//------------------------------------------------------------------------
+::rtl::OUString FormCellBindingHelper::getStringAddressFromCellListSource( const Reference< XListEntrySource >& _rxSource ) const
+{
+ OSL_PRECOND( !_rxSource.is() || isCellRangeListSource( _rxSource ), "FormCellBindingHelper::getStringAddressFromCellListSource: this is no cell list source!" );
+
+ ::rtl::OUString sAddress;
+ try
+ {
+ Reference< XPropertySet > xSourceProps( _rxSource, UNO_QUERY );
+ OSL_ENSURE( xSourceProps.is() || !_rxSource.is(), "FormCellBindingHelper::getStringAddressFromCellListSource: no property set for the list source!" );
+ if ( xSourceProps.is() )
+ {
+ CellRangeAddress aRangeAddress;
+ xSourceProps->getPropertyValue( PROPERTY_LIST_CELL_RANGE ) >>= aRangeAddress;
+
+ Any aStringAddress;
+ doConvertAddressRepresentations( PROPERTY_ADDRESS, makeAny( aRangeAddress ),
+ PROPERTY_FILE_REPRESENTATION, aStringAddress, true );
+ aStringAddress >>= sAddress;
+ }
+ }
+ catch( const Exception& )
+ {
+ OSL_FAIL( "FormCellBindingHelper::getStringAddressFromCellListSource: caught an exception!" );
+ }
+
+ return sAddress;
+}
+
+//------------------------------------------------------------------------
+bool FormCellBindingHelper::isSpreadsheetDocumentWhichSupplies( const Reference< XSpreadsheetDocument >& _rxDocument, const ::rtl::OUString& _rService ) SAL_THROW(())
+{
+ bool bYesItIs = false;
+
+ try
+ {
+ Reference< XServiceInfo > xSI( _rxDocument, UNO_QUERY );
+ if ( xSI.is() && xSI->supportsService( SERVICE_SPREADSHEET_DOCUMENT ) )
+ {
+ Reference< XMultiServiceFactory > xDocumentFactory( _rxDocument, UNO_QUERY );
+ OSL_ENSURE( xDocumentFactory.is(), "FormCellBindingHelper::isSpreadsheetDocumentWhichSupplies: spreadsheet document, but no factory?" );
+
+ Sequence< ::rtl::OUString > aAvailableServices;
+ if ( xDocumentFactory.is() )
+ aAvailableServices = xDocumentFactory->getAvailableServiceNames( );
+
+ const ::rtl::OUString* pFound = ::std::find_if(
+ aAvailableServices.getConstArray(),
+ aAvailableServices.getConstArray() + aAvailableServices.getLength(),
+ StringCompare( _rService )
+ );
+ if ( pFound - aAvailableServices.getConstArray() < aAvailableServices.getLength() )
+ {
+ bYesItIs = true;
+ }
+ }
+ }
+ catch( const Exception& )
+ {
+ OSL_FAIL( "FormCellBindingHelper::isSpreadsheetDocumentWhichSupplies: caught an exception!" );
+ }
+
+ return bYesItIs;
+}
+
+//------------------------------------------------------------------------
+bool FormCellBindingHelper::isSpreadsheetDocumentWhichSupplies( const ::rtl::OUString& _rService ) const SAL_THROW(())
+{
+ return isSpreadsheetDocumentWhichSupplies( m_xDocument, _rService );
+}
+
+//------------------------------------------------------------------------
+bool FormCellBindingHelper::isListCellRangeAllowed( const Reference< XModel >& _rxDocument )
+{
+ return isSpreadsheetDocumentWhichSupplies(
+ Reference< XSpreadsheetDocument >( _rxDocument, UNO_QUERY ),
+ SERVICE_CELLRANGELISTSOURCE
+ );
+}
+
+//------------------------------------------------------------------------
+bool FormCellBindingHelper::isListCellRangeAllowed( ) const
+{
+ bool bAllow( false );
+
+ Reference< XListEntrySink > xSink( m_xControlModel, UNO_QUERY );
+ if ( xSink.is() )
+ {
+ bAllow = isSpreadsheetDocumentWhichSupplies( SERVICE_CELLRANGELISTSOURCE );
+ }
+
+ return bAllow;
+}
+
+//------------------------------------------------------------------------
+bool FormCellBindingHelper::isCellBindingAllowed( ) const
+{
+ bool bAllow( false );
+
+ Reference< XBindableValue > xBindable( m_xControlModel, UNO_QUERY );
+ if ( xBindable.is() )
+ {
+ // the control can potentially be bound to an external value
+ // Does it live within a Calc document, and is able to supply CellBindings?
+ bAllow = isSpreadsheetDocumentWhichSupplies( SERVICE_CELLVALUEBINDING );
+ }
+
+ return bAllow;
+}
+
+//------------------------------------------------------------------------
+bool FormCellBindingHelper::isCellBindingAllowed( const Reference< XModel >& _rxDocument )
+{
+ return isSpreadsheetDocumentWhichSupplies(
+ Reference< XSpreadsheetDocument >( _rxDocument, UNO_QUERY ),
+ SERVICE_CELLVALUEBINDING
+ );
+}
+
+//------------------------------------------------------------------------
+bool FormCellBindingHelper::isCellBinding( const Reference< XValueBinding >& _rxBinding ) const
+{
+ return doesComponentSupport( _rxBinding.get(), SERVICE_CELLVALUEBINDING );
+}
+
+//------------------------------------------------------------------------
+bool FormCellBindingHelper::isCellIntegerBinding( const Reference< XValueBinding >& _rxBinding ) const
+{
+ return doesComponentSupport( _rxBinding.get(), SERVICE_LISTINDEXCELLBINDING );
+}
+
+//------------------------------------------------------------------------
+bool FormCellBindingHelper::isCellRangeListSource( const Reference< XListEntrySource >& _rxSource ) const
+{
+ return doesComponentSupport( _rxSource.get(), SERVICE_CELLRANGELISTSOURCE );
+}
+
+//------------------------------------------------------------------------
+bool FormCellBindingHelper::doesComponentSupport( const Reference< XInterface >& _rxComponent, const ::rtl::OUString& _rService ) const
+{
+ bool bDoes = false;
+ Reference< XServiceInfo > xSI( _rxComponent, UNO_QUERY );
+ bDoes = xSI.is() && xSI->supportsService( _rService );
+ return bDoes;
+}
+
+//------------------------------------------------------------------------
+Reference< XValueBinding > FormCellBindingHelper::getCurrentBinding( ) const
+{
+ Reference< XValueBinding > xBinding;
+ Reference< XBindableValue > xBindable( m_xControlModel, UNO_QUERY );
+ if ( xBindable.is() )
+ xBinding = xBindable->getValueBinding();
+ return xBinding;
+}
+
+//------------------------------------------------------------------------
+Reference< XListEntrySource > FormCellBindingHelper::getCurrentListSource( ) const
+{
+ Reference< XListEntrySource > xSource;
+ Reference< XListEntrySink > xSink( m_xControlModel, UNO_QUERY );
+ if ( xSink.is() )
+ xSource = xSink->getListEntrySource();
+ return xSource;
+}
+
+//------------------------------------------------------------------------
+void FormCellBindingHelper::setBinding( const Reference< XValueBinding >& _rxBinding )
+{
+ Reference< XBindableValue > xBindable( m_xControlModel, UNO_QUERY );
+ OSL_PRECOND( xBindable.is(), "FormCellBindingHelper::setBinding: the object is not bindable!" );
+ if ( xBindable.is() )
+ xBindable->setValueBinding( _rxBinding );
+}
+
+//------------------------------------------------------------------------
+void FormCellBindingHelper::setListSource( const Reference< XListEntrySource >& _rxSource )
+{
+ Reference< XListEntrySink > xSink( m_xControlModel, UNO_QUERY );
+ OSL_PRECOND( xSink.is(), "FormCellBindingHelper::setListSource: the object is no list entry sink!" );
+ if ( xSink.is() )
+ xSink->setListEntrySource( _rxSource );
+}
+
+//------------------------------------------------------------------------
+Reference< XInterface > FormCellBindingHelper::createDocumentDependentInstance( const ::rtl::OUString& _rService, const ::rtl::OUString& _rArgumentName,
+ const Any& _rArgumentValue ) const
+{
+ Reference< XInterface > xReturn;
+
+ Reference< XMultiServiceFactory > xDocumentFactory( m_xDocument, UNO_QUERY );
+ OSL_ENSURE( xDocumentFactory.is(), "FormCellBindingHelper::createDocumentDependentInstance: no document service factory!" );
+ if ( xDocumentFactory.is() )
+ {
+ try
+ {
+ if ( _rArgumentName.getLength() )
+ {
+ NamedValue aArg;
+ aArg.Name = _rArgumentName;
+ aArg.Value = _rArgumentValue;
+
+ Sequence< Any > aArgs( 1 );
+ aArgs[ 0 ] <<= aArg;
+
+ xReturn = xDocumentFactory->createInstanceWithArguments( _rService, aArgs );
+ }
+ else
+ {
+ xReturn = xDocumentFactory->createInstance( _rService );
+ }
+ }
+ catch ( const Exception& )
+ {
+ OSL_FAIL( "FormCellBindingHelper::createDocumentDependentInstance: could not create the binding at the document!" );
+ }
+ }
+ return xReturn;
+}
+
+//------------------------------------------------------------------------
+bool FormCellBindingHelper::doConvertAddressRepresentations( const ::rtl::OUString& _rInputProperty, const Any& _rInputValue,
+ const ::rtl::OUString& _rOutputProperty, Any& _rOutputValue, bool _bIsRange ) const SAL_THROW(())
+{
+ bool bSuccess = false;
+
+ Reference< XPropertySet > xConverter(
+ createDocumentDependentInstance(
+ _bIsRange ? SERVICE_RANGEADDRESS_CONVERSION : SERVICE_ADDRESS_CONVERSION,
+ ::rtl::OUString(),
+ Any()
+ ),
+ UNO_QUERY
+ );
+ OSL_ENSURE( xConverter.is(), "FormCellBindingHelper::doConvertAddressRepresentations: could not get a converter service!" );
+ if ( xConverter.is() )
+ {
+ try
+ {
+ xConverter->setPropertyValue( _rInputProperty, _rInputValue );
+ _rOutputValue = xConverter->getPropertyValue( _rOutputProperty );
+ bSuccess = true;
+ }
+ catch( const Exception& )
+ {
+ OSL_FAIL( "FormCellBindingHelper::doConvertAddressRepresentations: caught an exception!" );
+ }
+ }
+
+ return bSuccess;
+}
+
+//............................................................................
+} // namespace xmloff
+//............................................................................
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/formcellbinding.hxx b/xmloff/source/forms/formcellbinding.hxx
new file mode 100644
index 000000000000..85fe2fb272ec
--- /dev/null
+++ b/xmloff/source/forms/formcellbinding.hxx
@@ -0,0 +1,282 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 XMLOFF_FORMS_FORMCELLBINDING
+#define XMLOFF_FORMS_FORMCELLBINDING
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include <com/sun/star/table/CellAddress.hpp>
+#include <com/sun/star/table/CellRangeAddress.hpp>
+#include <com/sun/star/form/binding/XValueBinding.hpp>
+#include <com/sun/star/form/binding/XListEntrySource.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+
+//............................................................................
+namespace xmloff
+{
+//............................................................................
+
+ //========================================================================
+ //= FormCellBindingHelper
+ //========================================================================
+ /** encapsulates functionality related to binding a form control to a spreadsheet cell
+ */
+ class FormCellBindingHelper
+ {
+ protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ m_xControlModel; // the model we work for
+ ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheetDocument >
+ m_xDocument; // the document where the model lives
+
+ public:
+ /** determines whether the given control model lives in a spreadsheet document
+ <p>If this method returns <FALSE/>, you cannot instantiate a CellBindingHelper with
+ this model, since then no of it's functionality will be available.</p>
+ */
+ static sal_Bool livesInSpreadsheetDocument(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel
+ );
+
+ /** ctor
+ @param _rxControlModel
+ the control model which is or will be bound
+ @param _rxDocument
+ the document. If this is <NULL/>, the document will be obtained from the model
+ itself by walkong up the chain of its ancestors.<br/>
+ This parameter can be used if the control model is not (yet) part of a document
+ model.
+ */
+ FormCellBindingHelper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxDocument
+ );
+
+ public:
+ /** gets a cell binding for the given address
+ @precond
+ isCellBindingAllowed returns <TRUE/>
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XValueBinding >
+ createCellBindingFromStringAddress(
+ const ::rtl::OUString& _rAddress,
+ bool _bUseIntegerBinding
+ ) const;
+
+ /** gets a cell range list source binding for the given address
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XListEntrySource >
+ createCellListSourceFromStringAddress( const ::rtl::OUString& _rAddress ) const;
+
+ /** creates a string representation for the given value binding's address
+
+ <p>If the sheet of the bound cell is the same as the sheet which our control belongs
+ to, then the sheet name is omitted in the resulting string representation.</p>
+
+ @precond
+ The binding is a valid cell binding, or <NULL/>
+ @see isCellBinding
+ */
+ ::rtl::OUString getStringAddressFromCellBinding(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XValueBinding >& _rxBinding
+ ) const;
+
+ /** creates a string representation for the given list source's range address
+
+ <p>If the sheet of the cell range which acts as list source is the same as the
+ sheet which our control belongs to, then the sheet name is omitted in the
+ resulting string representation.</p>
+
+ @precond
+ The object is a valid cell range list source, or <NULL/>
+ @see isCellRangeListSource
+ */
+ ::rtl::OUString getStringAddressFromCellListSource(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XListEntrySource >& _rxSource
+ ) const;
+
+ /** returns the current binding of our control model, if any.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XValueBinding >
+ getCurrentBinding( ) const;
+
+ /** returns the current external list source of the control model, if any
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XListEntrySource >
+ getCurrentListSource( ) const;
+
+ /** sets a new binding for our control model
+ @precond
+ the control model is bindable (which is implied by <member>isCellBindingAllowed</member>
+ returning <TRUE/>)
+ */
+ void setBinding(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XValueBinding >& _rxBinding
+ );
+
+ /** sets a list source for our control model
+ @precond
+ the control model is a list sink (which is implied by <member>isListCellRangeAllowed</member>
+ returning <TRUE/>)
+ */
+ void setListSource(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XListEntrySource >& _rxSource
+ );
+
+ /** checks whether it's possible to bind the control model to a spreadsheet cell
+ */
+ bool isCellBindingAllowed( ) const;
+
+ /** checks whether within the given document, it's possible to bind control models to spreadsheet cells
+ */
+ static bool isCellBindingAllowed(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxDocument
+ );
+
+ /** checks whether it's possible to bind the control model to a range of spreadsheet cells
+ supplying the list entries
+ */
+ bool isListCellRangeAllowed( ) const;
+
+ /** checks whether within the given document, it's possible to bind the control model to a range of
+ spreadsheet cells supplying the list entries
+ */
+ static bool isListCellRangeAllowed(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxDocument
+ );
+
+ /** checks whether a given binding is a spreadsheet cell binding
+ */
+ bool isCellBinding(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XValueBinding >& _rxBinding
+ ) const;
+
+ /** checks whether a given binding is a spreadsheet cell binding, exchanging
+ integer values
+ */
+ bool isCellIntegerBinding(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XValueBinding >& _rxBinding
+ ) const;
+
+ /** checks whether a given list source is a spreadsheet cell list source
+ */
+ bool isCellRangeListSource(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XListEntrySource >& _rxSource
+ ) const;
+
+ protected:
+ /** creates an address object from a string representation of a cell address
+ */
+ bool convertStringAddress(
+ const ::rtl::OUString& _rAddressDescription,
+ ::com::sun::star::table::CellAddress& /* [out] */ _rAddress,
+ sal_Int16 _nAssumeSheet = -1
+ ) const;
+
+ /** creates an address range object from a string representation of a cell range address
+ */
+ bool convertStringAddress(
+ const ::rtl::OUString& _rAddressDescription,
+ ::com::sun::star::table::CellRangeAddress& /* [out] */ _rAddress
+ ) const;
+
+ /** determines if our document is a spreadsheet document, *and* can supply
+ the given service
+ */
+ bool isSpreadsheetDocumentWhichSupplies( const ::rtl::OUString& _rService ) const SAL_THROW(());
+
+ /** determines if our document is a spreadsheet document, *and* can supply
+ the given service
+ */
+ static bool isSpreadsheetDocumentWhichSupplies(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheetDocument >& _rxDocument,
+ const ::rtl::OUString& _rService
+ ) SAL_THROW(());
+
+ /** checkes whether a given component supports a given servive
+ */
+ bool doesComponentSupport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent,
+ const ::rtl::OUString& _rService
+ ) const;
+
+ /** uses the document (it's factory interface, respectively) to create a component instance
+ @param _rService
+ the service name
+ @param _rArgumentName
+ the name of the single argument to pass during creation. May be empty, in this case
+ no arguments are passed
+ @param _rArgumentValue
+ the value of the instantiation argument. Not evaluated if <arg>_rArgumentName</arg>
+ is empty.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+ createDocumentDependentInstance(
+ const ::rtl::OUString& _rService,
+ const ::rtl::OUString& _rArgumentName,
+ const ::com::sun::star::uno::Any& _rArgumentValue
+ ) const;
+
+ /** converts an address representation into another one
+
+ @param _rInputProperty
+ the input property name for the conversion service
+ @param _rInputValue
+ the input property value for the conversion service
+ @param _rOutputProperty
+ the output property name for the conversion service
+ @param _rOutputValue
+ the output property value for the conversion service
+ @param _bIsRange
+ if <TRUE/>, the RangeAddressConversion service will be used, else
+ the AddressConversion service
+
+ @return
+ <TRUE/> if any only if the conversion was successfull
+
+ @see com::sun::star::table::CellAddressConversion
+ @see com::sun::star::table::CellRangeAddressConversion
+ */
+ bool doConvertAddressRepresentations(
+ const ::rtl::OUString& _rInputProperty,
+ const ::com::sun::star::uno::Any& _rInputValue,
+ const ::rtl::OUString& _rOutputProperty,
+ ::com::sun::star::uno::Any& _rOutputValue,
+ bool _bIsRange
+ ) const SAL_THROW(());
+ };
+
+//............................................................................
+} // namespace xmloff
+//............................................................................
+
+#endif // XMLOFF_FORMS_FORMCELLBINDING
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/formenums.cxx b/xmloff/source/forms/formenums.cxx
new file mode 100644
index 000000000000..e90d4901b093
--- /dev/null
+++ b/xmloff/source/forms/formenums.cxx
@@ -0,0 +1,350 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "formenums.hxx"
+#include <osl/diagnose.h>
+#include <com/sun/star/form/FormSubmitEncoding.hpp>
+#include <com/sun/star/form/FormSubmitMethod.hpp>
+#include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/form/NavigationBarMode.hpp>
+#include <com/sun/star/form/TabulatorCycle.hpp>
+#include <com/sun/star/form/FormButtonType.hpp>
+#include <com/sun/star/form/ListSourceType.hpp>
+#include <com/sun/star/awt/TextAlign.hpp>
+#include <com/sun/star/awt/FontWidth.hpp>
+#include <com/sun/star/awt/FontEmphasisMark.hpp>
+#include <com/sun/star/awt/FontRelief.hpp>
+#include <com/sun/star/awt/ScrollBarOrientation.hpp>
+#include <com/sun/star/awt/VisualEffect.hpp>
+#include <com/sun/star/awt/ImageScaleMode.hpp>
+#include <tools/wintypes.hxx> // for check states
+#include <xmloff/xmltoken.hxx>
+
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ using namespace ::com::sun::star::form;
+ using namespace ::com::sun::star::sdb;
+ using namespace ::com::sun::star::awt;
+ using namespace ::xmloff::token;
+
+ const SvXMLEnumMapEntry* OEnumMapper::s_pEnumMap[OEnumMapper::KNOWN_ENUM_PROPERTIES] =
+ {
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+ };
+
+ //---------------------------------------------------------------------
+ const SvXMLEnumMapEntry* OEnumMapper::getEnumMap(EnumProperties _eProperty)
+ {
+ OSL_ENSURE(_eProperty < KNOWN_ENUM_PROPERTIES, "OEnumMapper::getEnumMap: invalid index (this will crash)!");
+
+ const SvXMLEnumMapEntry*& rReturn = s_pEnumMap[_eProperty];
+ if (!rReturn)
+ {
+ // the map for this property is not initialized yet
+ switch (_eProperty)
+ {
+ // FormSubmitEncoding
+ case epSubmitEncoding:
+ {
+ static SvXMLEnumMapEntry aSubmitEncodingMap[] =
+ {
+ { XML_APPLICATION_X_WWW_FORM_URLENCODED, FormSubmitEncoding_URL },
+ { XML_MULTIPART_FORMDATA, FormSubmitEncoding_MULTIPART },
+ { XML_APPLICATION_TEXT, FormSubmitEncoding_TEXT },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ rReturn = aSubmitEncodingMap;
+ }
+ break;
+ // FormSubmitMethod
+ case epSubmitMethod:
+ {
+ static SvXMLEnumMapEntry aSubmitMethodMap[] =
+ {
+ { XML_GET, FormSubmitMethod_GET },
+ { XML_POST, FormSubmitMethod_POST },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ rReturn = aSubmitMethodMap;
+ }
+ break;
+ // CommandType
+ case epCommandType:
+ {
+ static SvXMLEnumMapEntry aCommandTypeMap[] =
+ {
+ { XML_TABLE, CommandType::TABLE },
+ { XML_QUERY, CommandType::QUERY },
+ { XML_COMMAND, CommandType::COMMAND },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ rReturn = aCommandTypeMap;
+ }
+ break;
+ // NavigationBarMode
+ case epNavigationType:
+ {
+ static SvXMLEnumMapEntry aNavigationTypeMap[] =
+ {
+ { XML_NONE, NavigationBarMode_NONE },
+ { XML_CURRENT, NavigationBarMode_CURRENT },
+ { XML_PARENT, NavigationBarMode_PARENT },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ rReturn = aNavigationTypeMap;
+ };
+ break;
+ // TabulatorCycle
+ case epTabCyle:
+ {
+ static SvXMLEnumMapEntry aTabulytorCycleMap[] =
+ {
+ { XML_RECORDS, TabulatorCycle_RECORDS },
+ { XML_CURRENT, TabulatorCycle_CURRENT },
+ { XML_PAGE, TabulatorCycle_PAGE },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ rReturn = aTabulytorCycleMap;
+ };
+ break;
+ // FormButtonType
+ case epButtonType:
+ {
+ static SvXMLEnumMapEntry aFormButtonTypeMap[] =
+ {
+ { XML_PUSH, FormButtonType_PUSH },
+ { XML_SUBMIT, FormButtonType_SUBMIT },
+ { XML_RESET, FormButtonType_RESET },
+ { XML_URL, FormButtonType_URL },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ rReturn = aFormButtonTypeMap;
+ };
+ break;
+ // ListSourceType
+ case epListSourceType:
+ {
+ static SvXMLEnumMapEntry aListSourceTypeMap[] =
+ {
+ { XML_VALUE_LIST, ListSourceType_VALUELIST },
+ { XML_TABLE, ListSourceType_TABLE },
+ { XML_QUERY, ListSourceType_QUERY },
+ { XML_SQL, ListSourceType_SQL },
+ { XML_SQL_PASS_THROUGH, ListSourceType_SQLPASSTHROUGH },
+ { XML_TABLE_FIELDS, ListSourceType_TABLEFIELDS },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ rReturn = aListSourceTypeMap;
+ };
+ break;
+ // check state of a checkbox
+ case epCheckState:
+ {
+ static SvXMLEnumMapEntry aCheckStateMap[] =
+ {
+ { XML_UNCHECKED, STATE_NOCHECK },
+ { XML_CHECKED, STATE_CHECK },
+ { XML_UNKNOWN, STATE_DONTKNOW },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ rReturn = aCheckStateMap;
+ };
+ break;
+ case epTextAlign:
+ {
+ static SvXMLEnumMapEntry aTextAlignMap[] =
+ {
+ { XML_START, TextAlign::LEFT },
+ { XML_CENTER, TextAlign::CENTER },
+ { XML_END, TextAlign::RIGHT },
+ { XML_JUSTIFY, (sal_uInt16)-1 },
+ { XML_JUSTIFIED, (sal_uInt16)-1 },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ rReturn = aTextAlignMap;
+ };
+ break;
+ case epBorderWidth:
+ {
+ static SvXMLEnumMapEntry aBorderTypeMap[] =
+ {
+ { XML_NONE, 0 },
+ { XML_HIDDEN, 0 },
+ { XML_SOLID, 2 },
+ { XML_DOUBLE, 2 },
+ { XML_DOTTED, 2 },
+ { XML_DASHED, 2 },
+ { XML_GROOVE, 1 },
+ { XML_RIDGE, 1 },
+ { XML_INSET, 1 },
+ { XML_OUTSET, 1 },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ rReturn = aBorderTypeMap;
+ };
+ break;
+
+ case epFontEmphasis:
+ {
+ static SvXMLEnumMapEntry aFontEmphasisMap[] =
+ {
+ { XML_NONE, FontEmphasisMark::NONE },
+ { XML_DOT, FontEmphasisMark::DOT },
+ { XML_CIRCLE, FontEmphasisMark::CIRCLE },
+ { XML_DISC, FontEmphasisMark::DISC },
+ { XML_ACCENT, FontEmphasisMark::ACCENT },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ rReturn = aFontEmphasisMap;
+ }
+ break;
+
+ case epFontRelief:
+ {
+ static SvXMLEnumMapEntry aFontReliefMap[] =
+ {
+ { XML_NONE, FontRelief::NONE },
+ { XML_ENGRAVED, FontRelief::ENGRAVED },
+ { XML_EMBOSSED, FontRelief::EMBOSSED },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ rReturn = aFontReliefMap;
+ }
+ break;
+
+ case epListLinkageType:
+ {
+ static SvXMLEnumMapEntry aListLinkageMap[] =
+ {
+ { XML_SELECTION, 0 },
+ { XML_SELECTION_INDEXES, 1 },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ rReturn = aListLinkageMap;
+ }
+ break;
+
+ case epOrientation:
+ {
+ static SvXMLEnumMapEntry aOrientationMap[] =
+ {
+ { XML_HORIZONTAL, ScrollBarOrientation::HORIZONTAL },
+ { XML_VERTICAL, ScrollBarOrientation::VERTICAL },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ rReturn = aOrientationMap;
+ }
+ break;
+
+ case epVisualEffect:
+ {
+ static SvXMLEnumMapEntry aVisualEffectMap[] =
+ {
+ { XML_NONE, VisualEffect::NONE },
+ { XML_3D, VisualEffect::LOOK3D },
+ { XML_FLAT, VisualEffect::FLAT },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ rReturn = aVisualEffectMap;
+ }
+ break;
+
+ case epImagePosition:
+ {
+ static SvXMLEnumMapEntry aImagePositionMap[] =
+ {
+ { XML_START, 0 },
+ { XML_END, 1 },
+ { XML_TOP, 2 },
+ { XML_BOTTOM, 3 },
+ { XML_CENTER, (sal_uInt16)-1 },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ rReturn = aImagePositionMap;
+ }
+ break;
+
+ case epImageAlign:
+ {
+ static SvXMLEnumMapEntry aImageAlignMap[] =
+ {
+ { XML_START, 0 },
+ { XML_CENTER, 1 },
+ { XML_END, 2 },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ rReturn = aImageAlignMap;
+ }
+ break;
+
+ case epImageScaleMode:
+ {
+ static const SvXMLEnumMapEntry aScaleModeMap[] =
+ {
+ { XML_BACKGROUND_NO_REPEAT, ImageScaleMode::None },
+ { XML_REPEAT, ImageScaleMode::None }, // repeating the image is not supported
+ { XML_STRETCH, ImageScaleMode::Anisotropic },
+ { XML_SCALE, ImageScaleMode::Isotropic },
+ { XML_TOKEN_INVALID, ImageScaleMode::None }
+ };
+ rReturn = aScaleModeMap;
+ }
+ break;
+
+ case KNOWN_ENUM_PROPERTIES:
+ break;
+ }
+ }
+
+ return rReturn;
+ }
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/formenums.hxx b/xmloff/source/forms/formenums.hxx
new file mode 100644
index 000000000000..88313e28f109
--- /dev/null
+++ b/xmloff/source/forms/formenums.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_FORMENUMS_HXX_
+#define _XMLOFF_FORMENUMS_HXX_
+
+#include <xmloff/xmlement.hxx>
+
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ //=====================================================================
+ //= OEnumMapper
+ //=====================================================================
+ class OEnumMapper
+ {
+ public:
+ enum EnumProperties
+ {
+ epSubmitEncoding = 0,
+ epSubmitMethod,
+ epCommandType,
+ epNavigationType,
+ epTabCyle,
+ epButtonType,
+ epListSourceType,
+ epCheckState,
+ epTextAlign,
+ epBorderWidth,
+ epFontEmphasis,
+ epFontRelief,
+ epListLinkageType,
+ epOrientation,
+ epVisualEffect,
+ epImagePosition,
+ epImageAlign,
+ epImageScaleMode,
+
+ KNOWN_ENUM_PROPERTIES
+ };
+
+ private:
+ static const SvXMLEnumMapEntry* s_pEnumMap[KNOWN_ENUM_PROPERTIES];
+
+ public:
+ static const SvXMLEnumMapEntry* getEnumMap(EnumProperties _eProperty);
+ };
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+#endif // _XMLOFF_FORMENUMS_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/formevents.cxx b/xmloff/source/forms/formevents.cxx
new file mode 100644
index 000000000000..9353d540f8fd
--- /dev/null
+++ b/xmloff/source/forms/formevents.cxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "formevents.hxx"
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmlevent.hxx>
+
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ //=====================================================================
+ //= event translation table
+ //=====================================================================
+ static const XMLEventNameTranslation aEventTranslations[] =
+ {
+ { "XApproveActionListener::approveAction", XML_NAMESPACE_FORM, "approveaction" }, // "on-approveaction"
+ { "XActionListener::actionPerformed", XML_NAMESPACE_FORM, "performaction" }, // "on-performaction"
+ { "XChangeListener::changed", XML_NAMESPACE_DOM, "change" }, // "on-change"
+ { "XTextListener::textChanged", XML_NAMESPACE_FORM, "textchange" }, // "on-textchange"
+ { "XItemListener::itemStateChanged", XML_NAMESPACE_FORM, "itemstatechange" }, // "on-itemstatechange"
+ { "XFocusListener::focusGained", XML_NAMESPACE_DOM, "DOMFocusIn" }, // "on-focus"
+ { "XFocusListener::focusLost", XML_NAMESPACE_DOM, "DOMFocusOut" }, // "on-blur"
+ { "XKeyListener::keyPressed", XML_NAMESPACE_DOM, "keydown" }, // "on-keydown"
+ { "XKeyListener::keyReleased", XML_NAMESPACE_DOM, "keyup" }, // "on-keyup"
+ { "XMouseListener::mouseEntered", XML_NAMESPACE_DOM, "mouseover" }, // "on-mouseover"
+ { "XMouseMotionListener::mouseDragged", XML_NAMESPACE_FORM, "mousedrag" }, // "on-mousedrag"
+ { "XMouseMotionListener::mouseMoved", XML_NAMESPACE_DOM, "mousemove" }, // "on-mousemove"
+ { "XMouseListener::mousePressed", XML_NAMESPACE_DOM, "mousedown" }, // "on-mousedown"
+ { "XMouseListener::mouseReleased", XML_NAMESPACE_DOM, "mouseup" }, // "on-mouseup"
+ { "XMouseListener::mouseExited", XML_NAMESPACE_DOM, "mouseout" }, // "on-mouseout"
+ { "XResetListener::approveReset", XML_NAMESPACE_FORM, "approvereset" }, // "on-approvereset"
+ { "XResetListener::resetted", XML_NAMESPACE_DOM, "reset" }, // "on-reset"
+ { "XSubmitListener::approveSubmit", XML_NAMESPACE_DOM, "submit" }, // "on-submit"
+ { "XUpdateListener::approveUpdate", XML_NAMESPACE_FORM, "approveupdate" }, // "on-approveupdate"
+ { "XUpdateListener::updated", XML_NAMESPACE_FORM, "update" }, // "on-update"
+ { "XLoadListener::loaded", XML_NAMESPACE_DOM, "load" }, // "on-load"
+ { "XLoadListener::reloading", XML_NAMESPACE_FORM, "startreload" }, // "on-startreload"
+ { "XLoadListener::reloaded", XML_NAMESPACE_FORM, "reload" }, // "on-reload"
+ { "XLoadListener::unloading", XML_NAMESPACE_FORM, "startunload" }, // "on-startunload"
+ { "XLoadListener::unloaded", XML_NAMESPACE_DOM, "unload" }, // "on-unload"
+ { "XConfirmDeleteListener::confirmDelete", XML_NAMESPACE_FORM, "confirmdelete" }, // "on-confirmdelete"
+ { "XRowSetApproveListener::approveRowChange", XML_NAMESPACE_FORM, "approverowchange" }, // "on-approverowchange"
+ { "XRowSetListener::rowChanged", XML_NAMESPACE_FORM, "rowchange" }, // "on-rowchange"
+ { "XRowSetApproveListener::approveCursorMove", XML_NAMESPACE_FORM, "approvecursormove" }, // "on-approvecursormove"
+ { "XRowSetListener::cursorMoved", XML_NAMESPACE_FORM, "cursormove" }, // "on-cursormove"
+ { "XDatabaseParameterListener::approveParameter",XML_NAMESPACE_FORM, "supplyparameter" }, // "on-supplyparameter"
+ { "XSQLErrorListener::errorOccured", XML_NAMESPACE_DOM, "error" }, // "on-error"
+ { "XAdjustmentListener::adjustmentValueChanged",XML_NAMESPACE_FORM, "adjust" }, // "on-adjust"
+ { 0, 0, 0 }
+ };
+
+ const XMLEventNameTranslation* g_pFormsEventTranslation = aEventTranslations;
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/formevents.hxx b/xmloff/source/forms/formevents.hxx
new file mode 100644
index 000000000000..5f2fea968144
--- /dev/null
+++ b/xmloff/source/forms/formevents.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_FORMS_FORMEVENTS_HXX_
+#define _XMLOFF_FORMS_FORMEVENTS_HXX_
+
+struct XMLEventNameTranslation;
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ //=====================================================================
+ //= event translation table
+ //=====================================================================
+ extern const XMLEventNameTranslation* g_pFormsEventTranslation;
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+#endif // _XMLOFF_FORMS_FORMEVENTS_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/formlayerexport.cxx b/xmloff/source/forms/formlayerexport.cxx
new file mode 100644
index 000000000000..ea5ebc93a1b6
--- /dev/null
+++ b/xmloff/source/forms/formlayerexport.cxx
@@ -0,0 +1,183 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <stdio.h>
+#include <xmloff/formlayerexport.hxx>
+#include "strings.hxx"
+#include "elementexport.hxx"
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmlexp.hxx>
+#include "layerexport.hxx"
+#include "propertyexport.hxx"
+#include <osl/diagnose.h>
+#include <comphelper/extract.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <comphelper/stl_types.hxx>
+#include "officeforms.hxx"
+
+
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::lang;
+ 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::frame;
+
+ //=====================================================================
+ //= OFormLayerXMLExport
+ //=====================================================================
+
+ //---------------------------------------------------------------------
+ OFormLayerXMLExport::OFormLayerXMLExport(SvXMLExport& _rContext)
+ :m_rContext(_rContext)
+ ,m_pImpl(new OFormLayerXMLExport_Impl(_rContext))
+ {
+ }
+
+ //---------------------------------------------------------------------
+ OFormLayerXMLExport::~OFormLayerXMLExport()
+ {
+ delete m_pImpl;
+ m_pImpl = NULL;
+ }
+
+ //---------------------------------------------------------------------
+ sal_Bool OFormLayerXMLExport::seekPage(const Reference< XDrawPage >& _rxDrawPage)
+ {
+ return m_pImpl->seekPage(_rxDrawPage);
+ }
+
+ //---------------------------------------------------------------------
+ ::rtl::OUString OFormLayerXMLExport::getControlId(const Reference< XPropertySet >& _rxControl)
+ {
+ return m_pImpl->getControlId(_rxControl);
+ }
+
+ //---------------------------------------------------------------------
+ ::rtl::OUString OFormLayerXMLExport::getControlNumberStyle( const Reference< XPropertySet >& _rxControl )
+ {
+ return m_pImpl->getControlNumberStyle(_rxControl);
+ }
+
+ //---------------------------------------------------------------------
+ void OFormLayerXMLExport::initialize()
+ {
+ m_pImpl->clear();
+ }
+
+ //---------------------------------------------------------------------
+ void OFormLayerXMLExport::examineForms(const Reference< XDrawPage >& _rxDrawPage)
+ {
+ try
+ {
+ m_pImpl->examineForms(_rxDrawPage);
+ }
+ catch(Exception&)
+ {
+ OSL_FAIL("OFormLayerXMLExport::examine: could not examine the draw page!");
+ }
+ }
+
+ //---------------------------------------------------------------------
+ void OFormLayerXMLExport::exportForms(const Reference< XDrawPage >& _rxDrawPage)
+ {
+ m_pImpl->exportForms(_rxDrawPage);
+ }
+
+ //---------------------------------------------------------------------
+ void OFormLayerXMLExport::exportXForms() const
+ {
+ m_pImpl->exportXForms();
+ }
+
+ //---------------------------------------------------------------------
+ bool OFormLayerXMLExport::pageContainsForms( const Reference< XDrawPage >& _rxDrawPage ) const
+ {
+ return m_pImpl->pageContainsForms( _rxDrawPage );
+ }
+
+ //---------------------------------------------------------------------
+ bool OFormLayerXMLExport::documentContainsXForms() const
+ {
+ return m_pImpl->documentContainsXForms();
+ }
+
+ //---------------------------------------------------------------------
+ void OFormLayerXMLExport::exportControlNumberStyles()
+ {
+ m_pImpl->exportControlNumberStyles();
+ }
+
+ //---------------------------------------------------------------------
+ void OFormLayerXMLExport::exportAutoControlNumberStyles()
+ {
+ m_pImpl->exportAutoControlNumberStyles();
+ }
+
+ //---------------------------------------------------------------------
+ void OFormLayerXMLExport::exportAutoStyles()
+ {
+ m_pImpl->exportAutoStyles();
+ }
+
+ //---------------------------------------------------------------------
+ void OFormLayerXMLExport::excludeFromExport( const Reference< XControlModel > _rxControl )
+ {
+ m_pImpl->excludeFromExport( _rxControl );
+ }
+
+ //=========================================================================
+ //= OOfficeFormsExport
+ //=========================================================================
+ //-------------------------------------------------------------------------
+ OOfficeFormsExport::OOfficeFormsExport( SvXMLExport& _rExp )
+ :m_pImpl(NULL)
+ {
+ m_pImpl = new OFormsRootExport(_rExp);
+ }
+
+ //-------------------------------------------------------------------------
+ OOfficeFormsExport::~OOfficeFormsExport()
+ {
+ delete m_pImpl;
+ }
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/formlayerimport.cxx b/xmloff/source/forms/formlayerimport.cxx
new file mode 100644
index 000000000000..718c3120c481
--- /dev/null
+++ b/xmloff/source/forms/formlayerimport.cxx
@@ -0,0 +1,125 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <xmloff/formlayerimport.hxx>
+#include "layerimport.hxx"
+
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::beans;
+ using namespace ::com::sun::star::container;
+ using namespace ::com::sun::star::drawing;
+ using namespace ::com::sun::star::xml;
+
+ //=====================================================================
+ //= OFormLayerXMLExport
+ //=====================================================================
+
+ //---------------------------------------------------------------------
+ OFormLayerXMLImport::OFormLayerXMLImport(SvXMLImport& _rImporter)
+ :m_pImpl(NULL)
+ {
+ m_pImpl = new OFormLayerXMLImport_Impl(_rImporter);
+ }
+
+ //---------------------------------------------------------------------
+ OFormLayerXMLImport::~OFormLayerXMLImport()
+ {
+ delete m_pImpl;
+ }
+
+ //---------------------------------------------------------------------
+ void OFormLayerXMLImport::setAutoStyleContext(SvXMLStylesContext* _pNewContext)
+ {
+ m_pImpl->setAutoStyleContext(_pNewContext);
+ }
+
+ //---------------------------------------------------------------------
+ void OFormLayerXMLImport::seekPage(const Reference< XDrawPage >& _rxDrawPage)
+ {
+ m_pImpl->seekPage(_rxDrawPage);
+ }
+
+ //---------------------------------------------------------------------
+ void OFormLayerXMLImport::startPage(const Reference< XDrawPage >& _rxDrawPage)
+ {
+ m_pImpl->startPage(_rxDrawPage);
+ }
+
+ //---------------------------------------------------------------------
+ void OFormLayerXMLImport::endPage()
+ {
+ m_pImpl->endPage();
+ }
+
+ //---------------------------------------------------------------------
+ Reference< XPropertySet > OFormLayerXMLImport::lookupControl(const ::rtl::OUString& _rId)
+ {
+ return m_pImpl->lookupControlId(_rId);
+ }
+
+ //---------------------------------------------------------------------
+ SvXMLImportContext* OFormLayerXMLImport::createOfficeFormsContext(
+ SvXMLImport& _rImport,
+ sal_uInt16 _nPrefix,
+ const rtl::OUString& _rLocalName)
+ {
+ return m_pImpl->createOfficeFormsContext(_rImport, _nPrefix, _rLocalName);
+ }
+
+ //---------------------------------------------------------------------
+ SvXMLImportContext* OFormLayerXMLImport::createContext(const sal_uInt16 _nPrefix, const rtl::OUString& _rLocalName,
+ const Reference< sax::XAttributeList >& _rxAttribs)
+ {
+ return m_pImpl->createContext(_nPrefix, _rLocalName, _rxAttribs);
+ }
+
+ //---------------------------------------------------------------------
+ void OFormLayerXMLImport::applyControlNumberStyle(const Reference< XPropertySet >& _rxControlModel, const ::rtl::OUString& _rControlNumerStyleName)
+ {
+ m_pImpl->applyControlNumberStyle(_rxControlModel, _rControlNumerStyleName);
+ }
+
+ //---------------------------------------------------------------------
+ void OFormLayerXMLImport::documentDone( )
+ {
+ m_pImpl->documentDone( );
+ }
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/formsimp.cxx b/xmloff/source/forms/formsimp.cxx
new file mode 100644
index 000000000000..cc9b588aed62
--- /dev/null
+++ b/xmloff/source/forms/formsimp.cxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <xmloff/xmlimp.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+
+#include <xmloff/formsimp.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+
+TYPEINIT1( XMLFormsContext, SvXMLImportContext );
+
+XMLFormsContext::XMLFormsContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLocalName )
+: SvXMLImportContext(rImport, nPrfx, rLocalName)
+{
+}
+
+XMLFormsContext::~XMLFormsContext()
+{
+}
+
+SvXMLImportContext * XMLFormsContext::CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList )
+{
+ return GetImport().GetFormImport()->createContext( nPrefix, rLocalName, xAttrList );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/formstyles.cxx b/xmloff/source/forms/formstyles.cxx
new file mode 100644
index 000000000000..bd00be5fbf43
--- /dev/null
+++ b/xmloff/source/forms/formstyles.cxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "formstyles.hxx"
+#include <xmloff/xmltoken.hxx>
+
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ using namespace token;
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::xml;
+
+ //=====================================================================
+ //= OControlStyleContext
+ //=====================================================================
+ //---------------------------------------------------------------------
+ OControlStyleContext::OControlStyleContext( SvXMLImport& _rImport, const sal_uInt16 _Prefix, const ::rtl::OUString& _rLocalName,
+ const Reference< sax::XAttributeList >& _rxAttrList, SvXMLStylesContext& _rParentStyles,
+ const sal_uInt16 _nFamily, const sal_Bool _bDefaultStyle )
+ :XMLPropStyleContext( _rImport, _Prefix, _rLocalName, _rxAttrList, _rParentStyles, _nFamily, _bDefaultStyle )
+ {
+ }
+
+ //---------------------------------------------------------------------
+ void OControlStyleContext::SetAttribute( sal_uInt16 _nPrefixKey, const ::rtl::OUString& _rLocalName, const ::rtl::OUString& _rValue )
+ {
+ if ( _rLocalName == GetXMLToken( XML_DATA_STYLE_NAME ) )
+ m_sNumberStyleName = _rValue;
+ else
+ XMLPropStyleContext::SetAttribute( _nPrefixKey, _rLocalName, _rValue );
+ }
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/formstyles.hxx b/xmloff/source/forms/formstyles.hxx
new file mode 100644
index 000000000000..fc055df24a1a
--- /dev/null
+++ b/xmloff/source/forms/formstyles.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 XMLOFF_FORMSTYLES_HXX
+#define XMLOFF_FORMSTYLES_HXX
+
+#include <xmloff/prstylei.hxx>
+
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ //=====================================================================
+ //= OControlStyleContext
+ //=====================================================================
+ class OControlStyleContext : public XMLPropStyleContext
+ {
+ protected:
+ ::rtl::OUString m_sNumberStyleName;
+
+ public:
+ OControlStyleContext(
+ SvXMLImport& _rImport,
+ const sal_uInt16 _Prefix,
+ const ::rtl::OUString& _rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList,
+ SvXMLStylesContext& _rParentStyles,
+ const sal_uInt16 _nFamily,
+ const sal_Bool _bDefaultStyle
+ );
+
+ inline const ::rtl::OUString& getNumberStyleName( ) const { return m_sNumberStyleName; }
+
+ protected:
+ virtual void SetAttribute(
+ sal_uInt16 _nPrefixKey,
+ const ::rtl::OUString& _rLocalName,
+ const ::rtl::OUString& _rValue
+ );
+ };
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+#endif // XMLOFF_FORMSTYLES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/gridcolumnproptranslator.cxx b/xmloff/source/forms/gridcolumnproptranslator.cxx
new file mode 100644
index 000000000000..32dbbf01c727
--- /dev/null
+++ b/xmloff/source/forms/gridcolumnproptranslator.cxx
@@ -0,0 +1,347 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "gridcolumnproptranslator.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/awt/TextAlign.hpp>
+#include <com/sun/star/style/ParagraphAdjust.hpp>
+/** === end UNO includes === **/
+#include <osl/diagnose.h>
+#include <cppuhelper/implbase1.hxx>
+
+#include <algorithm>
+
+//........................................................................
+namespace xmloff
+{
+//........................................................................
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::awt;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::beans;
+ using namespace ::com::sun::star::style;
+
+ namespace
+ {
+ //----------------------------------------------------------------
+ ::rtl::OUString getParaAlignProperty()
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParaAdjust" ) );
+ }
+
+ //----------------------------------------------------------------
+ ::rtl::OUString getAlignProperty()
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Align" ) );
+ }
+
+ //----------------------------------------------------------------
+ sal_Int32 findStringElement( const Sequence< ::rtl::OUString >& _rNames, const ::rtl::OUString& _rName )
+ {
+ const ::rtl::OUString* pStart = _rNames.getConstArray();
+ const ::rtl::OUString* pEnd = _rNames.getConstArray() + _rNames.getLength();
+ const ::rtl::OUString* pPos = ::std::find( pStart, pEnd, _rName );
+ if ( pPos != pEnd )
+ return pPos - pStart;
+ return -1;
+ }
+
+ //----------------------------------------------------------------
+ struct AlignmentTranslationEntry
+ {
+ ParagraphAdjust nParagraphValue;
+ sal_Int16 nControlValue;
+ }
+ AlignmentTranslations[] =
+ {
+ // note that order matters:
+ // valueAlignToParaAdjust and valueParaAdjustToAlign search this map from the _beginning_
+ // and use the first matching entry
+ { ParagraphAdjust_LEFT, TextAlign::LEFT },
+ { ParagraphAdjust_CENTER, TextAlign::CENTER },
+ { ParagraphAdjust_RIGHT, TextAlign::RIGHT },
+ { ParagraphAdjust_BLOCK, TextAlign::RIGHT },
+ { ParagraphAdjust_STRETCH, TextAlign::LEFT },
+ { ParagraphAdjust_MAKE_FIXED_SIZE, TextAlign::LEFT },
+ { ParagraphAdjust_MAKE_FIXED_SIZE, -1 }
+ };
+
+ //----------------------------------------------------------------
+ void valueAlignToParaAdjust(Any& rValue)
+ {
+ sal_Int16 nValue = 0;
+ rValue >>= nValue;
+ const AlignmentTranslationEntry* pTranslation = AlignmentTranslations;
+ while (-1 != pTranslation->nControlValue)
+ {
+ if ( nValue == pTranslation->nControlValue )
+ {
+ rValue <<= pTranslation->nParagraphValue;
+ return;
+ }
+ ++pTranslation;
+ }
+ OSL_FAIL( "valueAlignToParaAdjust: unreachable!" );
+ }
+
+ //----------------------------------------------------------------
+ void valueParaAdjustToAlign(Any& rValue)
+ {
+ sal_Int32 nValue = 0;
+ rValue >>= nValue;
+ const AlignmentTranslationEntry* pTranslation = AlignmentTranslations;
+ while ( ParagraphAdjust_MAKE_FIXED_SIZE != pTranslation->nParagraphValue)
+ {
+ if ( nValue == pTranslation->nParagraphValue)
+ {
+ rValue <<= pTranslation->nControlValue;
+ return;
+ }
+ ++pTranslation;
+ }
+ OSL_FAIL( "valueParaAdjustToAlign: unreachable!" );
+ }
+
+ //====================================================================
+ //= OMergedPropertySetInfo
+ //====================================================================
+ typedef ::cppu::WeakAggImplHelper1 < XPropertySetInfo
+ > OMergedPropertySetInfo_Base;
+ class OMergedPropertySetInfo : public OMergedPropertySetInfo_Base
+ {
+ private:
+ Reference< XPropertySetInfo > m_xMasterInfo;
+
+ public:
+ OMergedPropertySetInfo( const Reference< XPropertySetInfo >& _rxMasterInfo );
+
+ protected:
+ virtual ~OMergedPropertySetInfo();
+
+ // XPropertySetInfo
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getProperties( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::beans::Property SAL_CALL getPropertyByName( const ::rtl::OUString& aName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL hasPropertyByName( const ::rtl::OUString& Name ) throw (::com::sun::star::uno::RuntimeException);
+ };
+
+ //----------------------------------------------------------------
+ OMergedPropertySetInfo::OMergedPropertySetInfo( const Reference< XPropertySetInfo >& _rxMasterInfo )
+ :m_xMasterInfo( _rxMasterInfo )
+ {
+ OSL_ENSURE( m_xMasterInfo.is(), "OMergedPropertySetInfo::OMergedPropertySetInfo: hmm?" );
+ }
+
+ //----------------------------------------------------------------
+ OMergedPropertySetInfo::~OMergedPropertySetInfo()
+ {
+ }
+
+ //----------------------------------------------------------------
+ Sequence< Property > SAL_CALL OMergedPropertySetInfo::getProperties( ) throw (RuntimeException)
+ {
+ // add a "ParaAdjust" property to the master properties
+ Sequence< Property > aProperties;
+ if ( m_xMasterInfo.is() )
+ aProperties = m_xMasterInfo->getProperties();
+
+ sal_Int32 nOldLength = aProperties.getLength();
+ aProperties.realloc( nOldLength + 1 );
+ aProperties[ nOldLength ] = getPropertyByName( getParaAlignProperty() );
+
+ return aProperties;
+ }
+
+ //----------------------------------------------------------------
+ Property SAL_CALL OMergedPropertySetInfo::getPropertyByName( const ::rtl::OUString& aName ) throw (UnknownPropertyException, RuntimeException)
+ {
+ if ( aName == getParaAlignProperty() )
+ return Property( getParaAlignProperty(), -1,
+ ::getCppuType( static_cast< const ParagraphAdjust* >( NULL ) ), 0 );
+
+ if ( !m_xMasterInfo.is() )
+ return Property();
+
+ return m_xMasterInfo->getPropertyByName( aName );
+ }
+
+ //----------------------------------------------------------------
+ ::sal_Bool SAL_CALL OMergedPropertySetInfo::hasPropertyByName( const ::rtl::OUString& Name ) throw (RuntimeException)
+ {
+ if ( Name == getParaAlignProperty() )
+ return sal_True;
+
+ if ( !m_xMasterInfo.is() )
+ return sal_False;
+
+ return m_xMasterInfo->hasPropertyByName( Name );
+ }
+ }
+
+
+ //====================================================================
+ //= OGridColumnPropertyTranslator
+ //====================================================================
+ //--------------------------------------------------------------------
+ OGridColumnPropertyTranslator::OGridColumnPropertyTranslator( const Reference< XMultiPropertySet >& _rxGridColumn )
+ :m_xGridColumn( _rxGridColumn )
+ {
+ OSL_ENSURE( m_xGridColumn.is(), "OGridColumnPropertyTranslator: invalid grid column!" );
+ }
+
+ //--------------------------------------------------------------------
+ OGridColumnPropertyTranslator::~OGridColumnPropertyTranslator()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XPropertySetInfo > SAL_CALL OGridColumnPropertyTranslator::getPropertySetInfo( ) throw (RuntimeException)
+ {
+ Reference< XPropertySetInfo > xColumnPropInfo;
+ if ( m_xGridColumn.is() )
+ xColumnPropInfo = m_xGridColumn->getPropertySetInfo();
+ return new OMergedPropertySetInfo( xColumnPropInfo );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL OGridColumnPropertyTranslator::setPropertyValue( const ::rtl::OUString& _rPropertyName, const Any& aValue ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
+ {
+ // we implement this by delegating it to setPropertyValues, which is to ignore unknown properties. On the other hand, our
+ // contract requires us to throw a UnknownPropertyException for unknown properties, so check this first.
+
+ if ( !getPropertySetInfo()->hasPropertyByName( _rPropertyName ) )
+ throw UnknownPropertyException( _rPropertyName, *this );
+
+ Sequence< ::rtl::OUString > aNames( &_rPropertyName, 1 );
+ Sequence< Any > aValues( &aValue, 1 );
+ setPropertyValues( aNames, aValues );
+ }
+
+ //--------------------------------------------------------------------
+ Any SAL_CALL OGridColumnPropertyTranslator::getPropertyValue( const ::rtl::OUString& PropertyName ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+ {
+ Sequence< ::rtl::OUString > aNames( &PropertyName, 1 );
+ Sequence< Any > aValues = getPropertyValues( aNames );
+ OSL_ENSURE( aValues.getLength() == 1, "OGridColumnPropertyTranslator::getPropertyValue: nonsense!" );
+ if ( aValues.getLength() == 1 )
+ return aValues[0];
+ return Any();
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL OGridColumnPropertyTranslator::addPropertyChangeListener( const ::rtl::OUString&, const Reference< XPropertyChangeListener >& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+ {
+ OSL_FAIL( "OGridColumnPropertyTranslator::addPropertyChangeListener: not implemented - this should not be needed!" );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL OGridColumnPropertyTranslator::removePropertyChangeListener( const ::rtl::OUString&, const Reference< XPropertyChangeListener >& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+ {
+ OSL_FAIL( "OGridColumnPropertyTranslator::removePropertyChangeListener: not implemented - this should not be needed!" );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL OGridColumnPropertyTranslator::addVetoableChangeListener( const ::rtl::OUString&, const Reference< XVetoableChangeListener >& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+ {
+ OSL_FAIL( "OGridColumnPropertyTranslator::addVetoableChangeListener: not implemented - this should not be needed!" );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL OGridColumnPropertyTranslator::removeVetoableChangeListener( const ::rtl::OUString&, const Reference< XVetoableChangeListener >& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+ {
+ OSL_FAIL( "OGridColumnPropertyTranslator::removeVetoableChangeListener: not implemented - this should not be needed!" );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL OGridColumnPropertyTranslator::setPropertyValues( const Sequence< ::rtl::OUString >& aPropertyNames, const Sequence< Any >& aValues ) throw (PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
+ {
+ if ( !m_xGridColumn.is() )
+ return;
+
+ // if there's ever the need for more than one property being translated, then we should
+ // certainly have a more clever implementation than this ...
+
+ Sequence< ::rtl::OUString > aTranslatedNames( aPropertyNames );
+ Sequence< Any > aTranslatedValues( aValues );
+
+ sal_Int32 nParaAlignPos = findStringElement( aTranslatedNames, getParaAlignProperty() );
+ if ( nParaAlignPos != -1 )
+ {
+ aTranslatedNames[ nParaAlignPos ] = getAlignProperty();
+ valueParaAdjustToAlign( aTranslatedValues[ nParaAlignPos ] );
+ }
+
+ m_xGridColumn->setPropertyValues( aTranslatedNames, aTranslatedValues );
+ }
+
+ //--------------------------------------------------------------------
+ Sequence< Any > SAL_CALL OGridColumnPropertyTranslator::getPropertyValues( const Sequence< ::rtl::OUString >& aPropertyNames ) throw (RuntimeException)
+ {
+ Sequence< Any > aValues( aPropertyNames.getLength() );
+ if ( !m_xGridColumn.is() )
+ return aValues;
+
+ Sequence< ::rtl::OUString > aTranslatedNames( aPropertyNames );
+ sal_Int32 nAlignPos = findStringElement( aTranslatedNames, getParaAlignProperty() );
+ if ( nAlignPos != -1 )
+ aTranslatedNames[ nAlignPos ] = getAlignProperty();
+
+ aValues = m_xGridColumn->getPropertyValues( aPropertyNames );
+ if ( nAlignPos != -1 )
+ valueAlignToParaAdjust( aValues[ nAlignPos ] );
+
+ return aValues;
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL OGridColumnPropertyTranslator::addPropertiesChangeListener( const Sequence< ::rtl::OUString >&, const Reference< XPropertiesChangeListener >& ) throw (RuntimeException)
+ {
+ OSL_FAIL( "OGridColumnPropertyTranslator::addPropertiesChangeListener: not implemented - this should not be needed!" );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL OGridColumnPropertyTranslator::removePropertiesChangeListener( const Reference< XPropertiesChangeListener >& ) throw (RuntimeException)
+ {
+ OSL_FAIL( "OGridColumnPropertyTranslator::removePropertiesChangeListener: not implemented - this should not be needed!" );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL OGridColumnPropertyTranslator::firePropertiesChangeEvent( const Sequence< ::rtl::OUString >&, const Reference< XPropertiesChangeListener >& ) throw (RuntimeException)
+ {
+ OSL_FAIL( "OGridColumnPropertyTranslator::firePropertiesChangeEvent: not implemented - this should not be needed!" );
+ }
+
+//........................................................................
+} // namespace xmloff
+//........................................................................
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/gridcolumnproptranslator.hxx b/xmloff/source/forms/gridcolumnproptranslator.hxx
new file mode 100644
index 000000000000..b45cd08988a8
--- /dev/null
+++ b/xmloff/source/forms/gridcolumnproptranslator.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 XMLOFF_SOURCE_FORMS_GRIDCOLUMNPROPTRANSLATOR_HXX
+#define XMLOFF_SOURCE_FORMS_GRIDCOLUMNPROPTRANSLATOR_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+/** === end UNO includes === **/
+#include <cppuhelper/implbase2.hxx>
+
+//........................................................................
+namespace xmloff
+{
+//........................................................................
+
+ //====================================================================
+ //= OGridColumnPropertyTranslator
+ //====================================================================
+ typedef ::cppu::WeakImplHelper2 < ::com::sun::star::beans::XPropertySet
+ , ::com::sun::star::beans::XMultiPropertySet
+ > OGridColumnPropertyTranslator_Base;
+ class OGridColumnPropertyTranslator : public OGridColumnPropertyTranslator_Base
+ {
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet >
+ m_xGridColumn;
+
+ public:
+ OGridColumnPropertyTranslator(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet >& _rxGridColumn
+ );
+
+ protected:
+ virtual ~OGridColumnPropertyTranslator();
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XMultiPropertySet
+ virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ };
+
+//........................................................................
+} // namespace xmloff
+//........................................................................
+
+#endif // XMLOFF_SOURCE_FORMS_GRIDCOLUMNPROPTRANSLATOR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/handler/form_handler_factory.cxx b/xmloff/source/forms/handler/form_handler_factory.cxx
new file mode 100644
index 000000000000..72a9edf38f42
--- /dev/null
+++ b/xmloff/source/forms/handler/form_handler_factory.cxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_xmloff.hxx"
+
+#include "forms/form_handler_factory.hxx"
+#include "vcl_date_handler.hxx"
+#include "vcl_time_handler.hxx"
+
+//......................................................................................................................
+namespace xmloff
+{
+//......................................................................................................................
+
+ namespace
+ {
+ static PPropertyHandler s_pVCLDateHandler = NULL;
+ static PPropertyHandler s_pVCLTimeHandler = NULL;
+ }
+
+ //==================================================================================================================
+ //= FormHandlerFactory
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ PPropertyHandler FormHandlerFactory::getFormPropertyHandler( const PropertyId i_propertyId )
+ {
+ PPropertyHandler pHandler( NULL );
+
+ switch ( i_propertyId )
+ {
+ case PID_DATE_MIN:
+ case PID_DATE_MAX:
+ case PID_DEFAULT_DATE:
+ case PID_DATE:
+ if ( s_pVCLDateHandler.get() == NULL )
+ {
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if ( s_pVCLDateHandler == NULL )
+ s_pVCLDateHandler = new VCLDateHandler();
+ }
+ pHandler = s_pVCLDateHandler;
+ break;
+
+ case PID_TIME_MIN:
+ case PID_TIME_MAX:
+ case PID_DEFAULT_TIME:
+ case PID_TIME:
+ if ( s_pVCLTimeHandler.get() == NULL )
+ {
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if ( s_pVCLTimeHandler == NULL )
+ s_pVCLTimeHandler = new VCLTimeHandler();
+ }
+ pHandler = s_pVCLTimeHandler;
+ break;
+
+ default:
+ OSL_ENSURE( false, "FormHandlerFactory::getFormPropertyHandler: unknown property ID!" );
+ break;
+ }
+
+ return pHandler;
+ }
+
+//......................................................................................................................
+} // namespace xmloff
+//......................................................................................................................
diff --git a/xmloff/source/forms/handler/property_handler_base.cxx b/xmloff/source/forms/handler/property_handler_base.cxx
new file mode 100644
index 000000000000..d599e0e259fe
--- /dev/null
+++ b/xmloff/source/forms/handler/property_handler_base.cxx
@@ -0,0 +1,61 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_xmloff.hxx"
+
+#include "property_handler_base.hxx"
+
+//......................................................................................................................
+namespace xmloff
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= PropertyHandlerBase
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ PropertyHandlerBase::~PropertyHandlerBase()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ oslInterlockedCount SAL_CALL PropertyHandlerBase::acquire()
+ {
+ return osl_incrementInterlockedCount( &m_refCount );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ oslInterlockedCount SAL_CALL PropertyHandlerBase::release()
+ {
+ oslInterlockedCount decremented = osl_decrementInterlockedCount( &m_refCount );
+ if ( 0 == decremented )
+ delete this;
+ return decremented;
+ }
+
+//......................................................................................................................
+} // namespace xmloff
+//......................................................................................................................
diff --git a/xmloff/source/forms/handler/property_handler_base.hxx b/xmloff/source/forms/handler/property_handler_base.hxx
new file mode 100644
index 000000000000..01f2a9e843f6
--- /dev/null
+++ b/xmloff/source/forms/handler/property_handler_base.hxx
@@ -0,0 +1,64 @@
+/*************************************************************************
+ * 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 XMLOFF_PROPERTY_HANDLER_BASE_HXX
+#define XMLOFF_PROPERTY_HANDLER_BASE_HXX
+
+#include "forms/property_handler.hxx"
+
+#include <osl/interlck.h>
+
+//......................................................................................................................
+namespace xmloff
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= PropertyHandlerBase
+ //==================================================================================================================
+ class PropertyHandlerBase : public IPropertyHandler
+ {
+ protected:
+ PropertyHandlerBase()
+ :m_refCount( 0 )
+ {
+ }
+
+ virtual ~PropertyHandlerBase();
+
+ // IReference
+ virtual oslInterlockedCount SAL_CALL acquire();
+ virtual oslInterlockedCount SAL_CALL release();
+
+ private:
+ oslInterlockedCount m_refCount;
+ };
+
+//......................................................................................................................
+} // namespace xmloff
+//......................................................................................................................
+
+#endif // XMLOFF_PROPERTY_HANDLER_BASE_HXX
diff --git a/xmloff/source/forms/handler/vcl_date_handler.cxx b/xmloff/source/forms/handler/vcl_date_handler.cxx
new file mode 100644
index 000000000000..a8404ed04e05
--- /dev/null
+++ b/xmloff/source/forms/handler/vcl_date_handler.cxx
@@ -0,0 +1,114 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_xmloff.hxx"
+
+#include "vcl_date_handler.hxx"
+#include "xmloff/xmluconv.hxx"
+
+#include <com/sun/star/util/DateTime.hpp>
+
+#include <tools/diagnose_ex.h>
+#include <tools/date.hxx>
+
+//......................................................................................................................
+namespace xmloff
+{
+//......................................................................................................................
+
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::util::DateTime;
+
+ //==================================================================================================================
+ //= VCLDateHandler
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ VCLDateHandler::VCLDateHandler()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString VCLDateHandler::getAttributeValue( const PropertyValues& /*i_propertyValues*/ ) const
+ {
+ OSL_ENSURE( false, "VCLDateHandler::getAttributeValue: unexpected call!" );
+ return ::rtl::OUString();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString VCLDateHandler::getAttributeValue( const Any& i_propertyValue ) const
+ {
+ sal_Int32 nVCLDate(0);
+ OSL_VERIFY( i_propertyValue >>= nVCLDate );
+ ::Date aVCLDate( nVCLDate );
+
+ DateTime aDateTime; // default-inited to 0
+ aDateTime.Day = aVCLDate.GetDay();
+ aDateTime.Month = aVCLDate.GetMonth();
+ aDateTime.Year = aVCLDate.GetYear();
+
+ ::rtl::OUStringBuffer aBuffer;
+ SvXMLUnitConverter::convertDateTime( aBuffer, aDateTime, sal_False );
+ return aBuffer.makeStringAndClear();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ bool VCLDateHandler::getPropertyValues( const ::rtl::OUString i_attributeValue, PropertyValues& o_propertyValues ) const
+ {
+ sal_Int32 nVCLDate(0);
+
+ DateTime aDateTime;
+ if ( SvXMLUnitConverter::convertDateTime( aDateTime, i_attributeValue ) )
+ {
+ ::Date aVCLDate( aDateTime.Day, aDateTime.Month, aDateTime.Year );
+ nVCLDate = aVCLDate.GetDate();
+ }
+ else
+ {
+ // compatibility format, before we wrote those values in XML-schema compatible form
+ if ( !SvXMLUnitConverter::convertNumber( nVCLDate, i_attributeValue ) )
+ {
+ OSL_ENSURE( false, "VCLDateHandler::getPropertyValues: unknown date format (no XML-schema date, no legacy integer)!" );
+ return false;
+ }
+ }
+
+ const Any aPropertyValue( makeAny( nVCLDate ) );
+
+ OSL_ENSURE( o_propertyValues.size() == 1, "VCLDateHandler::getPropertyValues: date strings represent exactly one property - not more, not less!" );
+ for ( PropertyValues::iterator prop = o_propertyValues.begin();
+ prop != o_propertyValues.end();
+ ++prop
+ )
+ {
+ prop->second = aPropertyValue;
+ }
+ return true;
+ }
+
+//......................................................................................................................
+} // namespace xmloff
+//......................................................................................................................
diff --git a/xmloff/source/forms/handler/vcl_date_handler.hxx b/xmloff/source/forms/handler/vcl_date_handler.hxx
new file mode 100644
index 000000000000..44a7f7395ceb
--- /dev/null
+++ b/xmloff/source/forms/handler/vcl_date_handler.hxx
@@ -0,0 +1,55 @@
+/*************************************************************************
+ * 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 XMLOFF_VCL_DATE_HANDLER_HXX
+#define XMLOFF_VCL_DATE_HANDLER_HXX
+
+#include "property_handler_base.hxx"
+
+//......................................................................................................................
+namespace xmloff
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= VCLDateHandler
+ //==================================================================================================================
+ class VCLDateHandler : public PropertyHandlerBase
+ {
+ public:
+ VCLDateHandler();
+
+ // IPropertyHandler
+ virtual ::rtl::OUString getAttributeValue( const PropertyValues& i_propertyValues ) const;
+ virtual ::rtl::OUString getAttributeValue( const ::com::sun::star::uno::Any& i_propertyValue ) const;
+ virtual bool getPropertyValues( const ::rtl::OUString i_attributeValue, PropertyValues& o_propertyValues ) const;
+ };
+
+//......................................................................................................................
+} // namespace xmloff
+//......................................................................................................................
+
+#endif // XMLOFF_VCL_DATE_HANDLER_HXX
diff --git a/xmloff/source/forms/handler/vcl_time_handler.cxx b/xmloff/source/forms/handler/vcl_time_handler.cxx
new file mode 100644
index 000000000000..98ea739d04a4
--- /dev/null
+++ b/xmloff/source/forms/handler/vcl_time_handler.cxx
@@ -0,0 +1,115 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_xmloff.hxx"
+
+#include "vcl_time_handler.hxx"
+#include "xmloff/xmluconv.hxx"
+
+#include <com/sun/star/util/DateTime.hpp>
+
+#include <tools/diagnose_ex.h>
+#include <tools/time.hxx>
+
+//......................................................................................................................
+namespace xmloff
+{
+//......................................................................................................................
+
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::util::DateTime;
+
+ //==================================================================================================================
+ //= VCLTimeHandler
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ VCLTimeHandler::VCLTimeHandler()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString VCLTimeHandler::getAttributeValue( const PropertyValues& /*i_propertyValues*/ ) const
+ {
+ OSL_ENSURE( false, "VCLTimeHandler::getAttributeValue: unexpected call!" );
+ return ::rtl::OUString();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString VCLTimeHandler::getAttributeValue( const Any& i_propertyValue ) const
+ {
+ sal_Int32 nVCLTime(0);
+ OSL_VERIFY( i_propertyValue >>= nVCLTime );
+ ::Time aVCLTime( nVCLTime );
+
+ DateTime aDateTime; // default-inited to 0
+ aDateTime.Hours = aVCLTime.GetHour();
+ aDateTime.Minutes = aVCLTime.GetMin();
+ aDateTime.Seconds = aVCLTime.GetSec();
+ aDateTime.HundredthSeconds = aVCLTime.Get100Sec();
+
+ ::rtl::OUStringBuffer aBuffer;
+ SvXMLUnitConverter::convertTime( aBuffer, aDateTime );
+ return aBuffer.makeStringAndClear();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ bool VCLTimeHandler::getPropertyValues( const ::rtl::OUString i_attributeValue, PropertyValues& o_propertyValues ) const
+ {
+ sal_Int32 nVCLTime(0);
+
+ DateTime aDateTime;
+ if ( SvXMLUnitConverter::convertTime( aDateTime, i_attributeValue ) )
+ {
+ ::Time aVCLTime( aDateTime.Hours, aDateTime.Minutes, aDateTime.Seconds, aDateTime.HundredthSeconds );
+ nVCLTime = aVCLTime.GetTime();
+ }
+ else
+ {
+ // compatibility format, before we wrote those values in XML-schema compatible form
+ if ( !SvXMLUnitConverter::convertNumber( nVCLTime, i_attributeValue ) )
+ {
+ OSL_ENSURE( false, "VCLTimeHandler::getPropertyValues: unknown time format (no XML-schema time, no legacy integer)!" );
+ return false;
+ }
+ }
+
+ const Any aPropertyValue( makeAny( nVCLTime ) );
+
+ OSL_ENSURE( o_propertyValues.size() == 1, "VCLTimeHandler::getPropertyValues: time strings represent exactly one property - not more, not less!" );
+ for ( PropertyValues::iterator prop = o_propertyValues.begin();
+ prop != o_propertyValues.end();
+ ++prop
+ )
+ {
+ prop->second = aPropertyValue;
+ }
+ return true;
+ }
+
+//......................................................................................................................
+} // namespace xmloff
+//......................................................................................................................
diff --git a/xmloff/source/forms/handler/vcl_time_handler.hxx b/xmloff/source/forms/handler/vcl_time_handler.hxx
new file mode 100644
index 000000000000..0d84be983b01
--- /dev/null
+++ b/xmloff/source/forms/handler/vcl_time_handler.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ * 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 XMLOFF_VCL_TIME_HANDLER_HXX
+#define XMLOFF_VCL_TIME_HANDLER_HXX
+
+#include "property_handler_base.hxx"
+
+//......................................................................................................................
+namespace xmloff
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= VCLTimeHandler
+ //==================================================================================================================
+ class VCLTimeHandler : public PropertyHandlerBase
+ {
+ public:
+ VCLTimeHandler();
+
+ // IPropertyHandler
+ virtual ::rtl::OUString getAttributeValue( const PropertyValues& i_propertyValues ) const;
+ virtual ::rtl::OUString getAttributeValue( const ::com::sun::star::uno::Any& i_propertyValue ) const;
+ virtual bool getPropertyValues( const ::rtl::OUString i_attributeValue, PropertyValues& o_propertyValues ) const;
+ };
+
+//......................................................................................................................
+} // namespace xmloff
+//......................................................................................................................
+
+#endif // XMLOFF_VCL_TIME_HANDLER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/ifacecompare.hxx b/xmloff/source/forms/ifacecompare.hxx
new file mode 100644
index 000000000000..e84cd27eaa8d
--- /dev/null
+++ b/xmloff/source/forms/ifacecompare.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_FORMS_IFACECOMPARE_HXX_
+#define _XMLOFF_FORMS_IFACECOMPARE_HXX_
+
+#include <comphelper/stl_types.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ //=====================================================================
+ //= OInterfaceCompare
+ //=====================================================================
+ /** is stl-compliant structure for comparing Reference&lt; &lt;iface&gt; &gt; instances
+ */
+ template < class IAFCE >
+ struct OInterfaceCompare
+ :public ::std::binary_function < ::com::sun::star::uno::Reference< IAFCE >
+ , ::com::sun::star::uno::Reference< IAFCE >
+ , bool
+ >
+ {
+ bool operator() (const ::com::sun::star::uno::Reference< IAFCE >& lhs, const ::com::sun::star::uno::Reference< IAFCE >& rhs) const
+ {
+ return lhs.get() < rhs.get();
+ // this does not make any sense if you see the semantics of the pointer returned by get:
+ // It's a pointer to a point in memory where an interface implementation lies.
+ // But for our purpose (provide a reliable less-operator which can be used with the STL), this is
+ // sufficient ....
+ }
+ };
+
+ typedef OInterfaceCompare< ::com::sun::star::beans::XPropertySet > OPropertySetCompare;
+ typedef OInterfaceCompare< ::com::sun::star::drawing::XDrawPage > ODrawPageCompare;
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+#endif // _XMLOFF_FORMS_IFACECOMPARE_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/layerexport.cxx b/xmloff/source/forms/layerexport.cxx
new file mode 100644
index 000000000000..21950c9c3517
--- /dev/null
+++ b/xmloff/source/forms/layerexport.cxx
@@ -0,0 +1,835 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <stdio.h>
+#include "layerexport.hxx"
+#include "strings.hxx"
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmlprmap.hxx>
+#include <xmloff/prhdlfac.hxx>
+#include "elementexport.hxx"
+#include <xmloff/families.hxx>
+#include <xmloff/contextid.hxx>
+#include <xmloff/controlpropertyhdl.hxx>
+#include <tools/diagnose_ex.h>
+#include "controlpropertymap.hxx"
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/form/XFormsSupplier2.hpp>
+#include <com/sun/star/xforms/XFormsSupplier.hpp>
+#include <com/sun/star/form/FormComponentType.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/script/XEventAttacherManager.hpp>
+#include "eventexport.hxx"
+#include <xmloff/XMLEventExport.hxx>
+#include "formevents.hxx"
+#include <xmloff/xmlnumfe.hxx>
+#include "xmloff/xformsexport.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/text/XText.hpp>
+/** === end UNO includes === **/
+
+#include <numeric>
+
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::awt;
+ using namespace ::com::sun::star::lang;
+ 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::script;
+ using namespace ::com::sun::star::util;
+ using namespace ::com::sun::star::text;
+
+ typedef ::com::sun::star::xforms::XFormsSupplier XXFormsSupplier;
+
+ //=====================================================================
+ //= OFormLayerXMLExport_Impl
+ //=====================================================================
+ //---------------------------------------------------------------------
+ const ::rtl::OUString& OFormLayerXMLExport_Impl::getControlNumberStyleNamePrefix()
+ {
+ static const ::rtl::OUString s_sControlNumberStyleNamePrefix(RTL_CONSTASCII_USTRINGPARAM("C"));
+ return s_sControlNumberStyleNamePrefix;
+ }
+
+ //---------------------------------------------------------------------
+ OFormLayerXMLExport_Impl::OFormLayerXMLExport_Impl(SvXMLExport& _rContext)
+ :m_rContext(_rContext)
+ ,m_pControlNumberStyles(NULL)
+ {
+ initializePropertyMaps();
+
+ // add our style family to the export context's style pool
+ m_xPropertyHandlerFactory = new OControlPropertyHandlerFactory();
+ ::rtl::Reference< XMLPropertySetMapper > xStylePropertiesMapper = new XMLPropertySetMapper( getControlStylePropertyMap(), m_xPropertyHandlerFactory.get() );
+ m_xStyleExportMapper = new OFormComponentStyleExportMapper( xStylePropertiesMapper.get() );
+
+ // our style family
+ m_rContext.GetAutoStylePool()->AddFamily(
+ XML_STYLE_FAMILY_CONTROL_ID, token::GetXMLToken(token::XML_PARAGRAPH),
+ m_xStyleExportMapper.get(),
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( XML_STYLE_FAMILY_CONTROL_PREFIX) )
+ );
+
+ // add our event translation table
+ m_rContext.GetEventExport().AddTranslationTable(g_pFormsEventTranslation);
+
+ clear();
+ }
+
+ OFormLayerXMLExport_Impl::~OFormLayerXMLExport_Impl()
+ {
+ }
+
+ //---------------------------------------------------------------------
+ sal_Bool OFormLayerXMLExport_Impl::impl_isFormPageContainingForms(const Reference< XDrawPage >& _rxDrawPage, Reference< XIndexAccess >& _rxForms)
+ {
+ Reference< XFormsSupplier2 > xFormsSupp(_rxDrawPage, UNO_QUERY);
+ OSL_ENSURE(xFormsSupp.is(), "OFormLayerXMLExport_Impl::impl_isFormPageContainingForms: invalid draw page (no XFormsSupplier)! Doin' nothing!");
+ if (!xFormsSupp.is())
+ return sal_False;
+
+ if ( !xFormsSupp->hasForms() )
+ // nothing to do at all
+ return sal_False;
+
+ _rxForms = Reference< XIndexAccess >(xFormsSupp->getForms(), UNO_QUERY);
+ Reference< XServiceInfo > xSI(_rxForms, UNO_QUERY); // order is important!
+ OSL_ENSURE(xSI.is(), "OFormLayerXMLExport_Impl::impl_isFormPageContainingForms: invalid collection (must not be NULL and must have a ServiceInfo)!");
+ if (!xSI.is())
+ return sal_False;
+
+ if (!xSI->supportsService(SERVICE_FORMSCOLLECTION))
+ {
+ OSL_FAIL("OFormLayerXMLExport_Impl::impl_isFormPageContainingForms: invalid collection (is no com.sun.star.form.Forms)!");
+ // nothing to do
+ return sal_False;
+ }
+ return sal_True;
+ }
+
+ //---------------------------------------------------------------------
+ void OFormLayerXMLExport_Impl::exportGridColumn(const Reference< XPropertySet >& _rxColumn,
+ const Sequence< ScriptEventDescriptor >& _rEvents)
+ {
+ // do the exporting
+ OColumnExport aExportImpl(*this, _rxColumn, getControlId( _rxColumn ), _rEvents);
+ aExportImpl.doExport();
+ }
+
+ //---------------------------------------------------------------------
+ void OFormLayerXMLExport_Impl::exportControl(const Reference< XPropertySet >& _rxControl,
+ const Sequence< ScriptEventDescriptor >& _rEvents)
+ {
+ // the list of the referring controls
+ ::rtl::OUString sReferringControls;
+ MapPropertySet2String::const_iterator aReferring = m_aCurrentPageReferring->second.find(_rxControl);
+ if (aReferring != m_aCurrentPageReferring->second.end())
+ sReferringControls = aReferring->second;
+
+ // the control id (should already have been created in examineForms)
+ ::rtl::OUString sControlId( getControlId( _rxControl ) );
+
+ // do the exporting
+ OControlExport aExportImpl(*this, _rxControl, sControlId, sReferringControls, _rEvents);
+ aExportImpl.doExport();
+ }
+
+ //---------------------------------------------------------------------
+ void OFormLayerXMLExport_Impl::exportForm(const Reference< XPropertySet >& _rxProps,
+ const Sequence< ScriptEventDescriptor >& _rEvents)
+ {
+ OSL_ENSURE(_rxProps.is(), "OFormLayerXMLExport_Impl::exportForm: invalid property set!");
+ OFormExport aAttributeHandler(*this, _rxProps, _rEvents);
+ aAttributeHandler.doExport();
+ }
+
+ //---------------------------------------------------------------------
+ ::rtl::Reference< SvXMLExportPropertyMapper > OFormLayerXMLExport_Impl::getStylePropertyMapper()
+ {
+ return m_xStyleExportMapper;
+ }
+
+ //---------------------------------------------------------------------
+ SvXMLExport& OFormLayerXMLExport_Impl::getGlobalContext()
+ {
+ return m_rContext;
+ }
+
+ //---------------------------------------------------------------------
+ void OFormLayerXMLExport_Impl::exportCollectionElements(const Reference< XIndexAccess >& _rxCollection)
+ {
+ // step through all the elements of the collection
+ sal_Int32 nElements = _rxCollection->getCount();
+
+ Reference< XEventAttacherManager > xElementEventManager(_rxCollection, UNO_QUERY);
+ Sequence< ScriptEventDescriptor > aElementEvents;
+
+ Reference< XPropertySetInfo > xPropsInfo;
+ Reference< XIndexAccess > xCurrentContainer;
+ for (sal_Int32 i=0; i<nElements; ++i)
+ {
+ try
+ {
+ // extract the current element
+ Reference< XPropertySet > xCurrentProps( _rxCollection->getByIndex(i), UNO_QUERY );
+ OSL_ENSURE(xCurrentProps.is(), "OFormLayerXMLExport_Impl::exportCollectionElements: invalid child element, skipping!");
+ if (!xCurrentProps.is())
+ continue;
+
+ // check if there is a ClassId property on the current element. If so, we assume it to be a control
+ xPropsInfo = xCurrentProps->getPropertySetInfo();
+ OSL_ENSURE(xPropsInfo.is(), "OFormLayerXMLExport_Impl::exportCollectionElements: no property set info!");
+ if (!xPropsInfo.is())
+ // without this, a lot of stuff in the export routines may fail
+ continue;
+
+ // if the element is part of a ignore list, we are not allowed to export it
+ if ( m_aIgnoreList.end() != m_aIgnoreList.find( xCurrentProps ) )
+ continue;
+
+ if (xElementEventManager.is())
+ aElementEvents = xElementEventManager->getScriptEvents(i);
+
+ if (xPropsInfo->hasPropertyByName(PROPERTY_COLUMNSERVICENAME))
+ {
+ exportGridColumn(xCurrentProps, aElementEvents);
+ }
+ else if (xPropsInfo->hasPropertyByName(PROPERTY_CLASSID))
+ {
+ exportControl(xCurrentProps, aElementEvents);
+ }
+ else
+ {
+ exportForm(xCurrentProps, aElementEvents);
+ }
+ }
+ catch(Exception&)
+ {
+ OSL_FAIL("OFormLayerXMLExport_Impl::exportCollectionElements: caught an exception ... skipping the current element!");
+ continue;
+ }
+ }
+ }
+
+ //---------------------------------------------------------------------
+ ::rtl::OUString OFormLayerXMLExport_Impl::getObjectStyleName( const Reference< XPropertySet >& _rxObject )
+ {
+ ::rtl::OUString aObjectStyle;
+
+ MapPropertySet2String::const_iterator aObjectStylePos = m_aGridColumnStyles.find( _rxObject );
+ if ( m_aGridColumnStyles.end() != aObjectStylePos )
+ aObjectStyle = aObjectStylePos->second;
+ return aObjectStyle;
+ }
+
+ //---------------------------------------------------------------------
+ void OFormLayerXMLExport_Impl::clear()
+ {
+ m_aControlIds.clear();
+ m_aReferringControls.clear();
+ m_aCurrentPageIds = m_aControlIds.end();
+ m_aCurrentPageReferring = m_aReferringControls.end();
+
+ m_aControlNumberFormats.clear();
+ m_aGridColumnStyles.clear();
+
+ m_aIgnoreList.clear();
+ }
+
+ //---------------------------------------------------------------------
+ void OFormLayerXMLExport_Impl::exportControlNumberStyles()
+ {
+ if (m_pControlNumberStyles)
+ m_pControlNumberStyles->Export(sal_False);
+ }
+
+ //---------------------------------------------------------------------
+ void OFormLayerXMLExport_Impl::exportAutoControlNumberStyles()
+ {
+ if ( m_pControlNumberStyles )
+ m_pControlNumberStyles->Export( sal_True );
+ }
+
+ //---------------------------------------------------------------------
+ void OFormLayerXMLExport_Impl::exportAutoStyles()
+ {
+ m_rContext.GetAutoStylePool()->exportXML(
+ XML_STYLE_FAMILY_CONTROL_ID,
+ m_rContext.GetDocHandler(),
+ m_rContext.GetMM100UnitConverter(),
+ m_rContext.GetNamespaceMap()
+ );
+ }
+
+ //---------------------------------------------------------------------
+ void OFormLayerXMLExport_Impl::exportForms(const Reference< XDrawPage >& _rxDrawPage)
+ {
+ // get the forms collection of the page
+ Reference< XIndexAccess > xCollectionIndex;
+ if (!impl_isFormPageContainingForms(_rxDrawPage, xCollectionIndex))
+ return;
+
+#if OSL_DEBUG_LEVEL > 0
+ sal_Bool bPageIsKnown =
+#endif
+ implMoveIterators(_rxDrawPage, sal_False);
+ OSL_ENSURE(bPageIsKnown, "OFormLayerXMLExport_Impl::exportForms: exporting a page which has not been examined!");
+
+ // export forms collection
+ exportCollectionElements(xCollectionIndex);
+ }
+
+ //---------------------------------------------------------------------
+ void OFormLayerXMLExport_Impl::exportXForms() const
+ {
+ // export XForms models
+ ::exportXForms( m_rContext );
+ }
+
+ //---------------------------------------------------------------------
+ bool OFormLayerXMLExport_Impl::pageContainsForms( const Reference< XDrawPage >& _rxDrawPage ) const
+ {
+ Reference< XFormsSupplier2 > xFormsSupp( _rxDrawPage, UNO_QUERY );
+ DBG_ASSERT( xFormsSupp.is(), "OFormLayerXMLExport_Impl::pageContainsForms: no XFormsSupplier2!" );
+ return xFormsSupp.is() && xFormsSupp->hasForms();
+ }
+
+ //---------------------------------------------------------------------
+ bool OFormLayerXMLExport_Impl::documentContainsXForms() const
+ {
+ Reference< XXFormsSupplier > xXFormSupp( m_rContext.GetModel(), UNO_QUERY );
+ Reference< XNameContainer > xForms;
+ if ( xXFormSupp.is() )
+ xForms = xXFormSupp->getXForms();
+ return xForms.is() && xForms->hasElements();
+ }
+
+ //---------------------------------------------------------------------
+ sal_Bool OFormLayerXMLExport_Impl::implMoveIterators(const Reference< XDrawPage >& _rxDrawPage, sal_Bool _bClear)
+ {
+ if (!_rxDrawPage.is())
+ return false;
+
+ sal_Bool bKnownPage = sal_False;
+
+ // the one for the ids
+ m_aCurrentPageIds = m_aControlIds.find(_rxDrawPage);
+ if (m_aControlIds.end() == m_aCurrentPageIds)
+ {
+ m_aControlIds[_rxDrawPage] = MapPropertySet2String();
+ m_aCurrentPageIds = m_aControlIds.find(_rxDrawPage);
+ }
+ else
+ {
+ bKnownPage = sal_True;
+ if (_bClear && !m_aCurrentPageIds->second.empty() )
+ m_aCurrentPageIds->second.clear();
+ }
+
+ // the one for the ids of the referring controls
+ m_aCurrentPageReferring = m_aReferringControls.find(_rxDrawPage);
+ if (m_aReferringControls.end() == m_aCurrentPageReferring)
+ {
+ m_aReferringControls[_rxDrawPage] = MapPropertySet2String();
+ m_aCurrentPageReferring = m_aReferringControls.find(_rxDrawPage);
+ }
+ else
+ {
+ bKnownPage = sal_True;
+ if (_bClear && !m_aCurrentPageReferring->second.empty() )
+ m_aCurrentPageReferring->second.clear();
+ }
+ return bKnownPage;
+ }
+
+ //---------------------------------------------------------------------
+ sal_Bool OFormLayerXMLExport_Impl::seekPage(const Reference< XDrawPage >& _rxDrawPage)
+ {
+ sal_Bool bKnownPage = implMoveIterators( _rxDrawPage, sal_False );
+ if ( bKnownPage )
+ return sal_True;
+
+ // if the page is not yet known, this does not automatically mean that it has
+ // not been examined. Instead, examineForms returns silently and successfully
+ // if a page is a XFormsPageSupplier2, but does not have a forms collection
+ // (This behaviour of examineForms is a performance optimization, to not force
+ // the page to create a forms container just to see that it's empty.)
+
+ // So, in such a case, seekPage is considered to be successfull, too, though the
+ // page was not yet known
+ Reference< XFormsSupplier2 > xFormsSupp( _rxDrawPage, UNO_QUERY );
+ if ( xFormsSupp.is() && !xFormsSupp->hasForms() )
+ return sal_True;
+
+ // anything else means that the page has not been examined before, or it's no
+ // valid form page. Both cases are Bad (TM).
+ return sal_False;
+ }
+
+ //---------------------------------------------------------------------
+ ::rtl::OUString OFormLayerXMLExport_Impl::getControlId(const Reference< XPropertySet >& _rxControl)
+ {
+ if (m_aCurrentPageIds == m_aControlIds.end())
+ return ::rtl::OUString();
+
+ OSL_ENSURE(m_aCurrentPageIds->second.end() != m_aCurrentPageIds->second.find(_rxControl),
+ "OFormLayerXMLExport_Impl::getControlId: can not find the control!");
+ return m_aCurrentPageIds->second[_rxControl];
+ }
+
+ //---------------------------------------------------------------------
+ ::rtl::OUString OFormLayerXMLExport_Impl::getImmediateNumberStyle( const Reference< XPropertySet >& _rxObject )
+ {
+ ::rtl::OUString sNumberStyle;
+
+ sal_Int32 nOwnFormatKey = implExamineControlNumberFormat( _rxObject );
+ if ( -1 != nOwnFormatKey )
+ sNumberStyle = getControlNumberStyleExport()->GetStyleName( nOwnFormatKey );
+
+ return sNumberStyle;
+ }
+
+ //---------------------------------------------------------------------
+ ::rtl::OUString OFormLayerXMLExport_Impl::getControlNumberStyle( const Reference< XPropertySet >& _rxControl )
+ {
+ ::rtl::OUString sNumberStyle;
+
+ ConstMapPropertySet2IntIterator aControlFormatPos = m_aControlNumberFormats.find(_rxControl);
+ if (m_aControlNumberFormats.end() != aControlFormatPos)
+ {
+ OSL_ENSURE(m_pControlNumberStyles, "OFormLayerXMLExport_Impl::getControlNumberStyle: have a control which has a format style, but no style exporter!");
+ sNumberStyle = getControlNumberStyleExport()->GetStyleName(aControlFormatPos->second);
+ }
+ // it's allowed to ask for a control which does not have format information.
+ // (This is for performance reasons)
+
+ return sNumberStyle;
+ }
+
+ //---------------------------------------------------------------------
+ void OFormLayerXMLExport_Impl::examineForms(const Reference< XDrawPage >& _rxDrawPage)
+ {
+ // get the forms collection of the page
+ Reference< XIndexAccess > xCollectionIndex;
+ if (!impl_isFormPageContainingForms(_rxDrawPage, xCollectionIndex))
+ return;
+
+ // move the iterator which specify the currently handled page
+#if OSL_DEBUG_LEVEL > 0
+ sal_Bool bPageIsKnown =
+#endif
+ implMoveIterators(_rxDrawPage, sal_True);
+ OSL_ENSURE(!bPageIsKnown, "OFormLayerXMLExport_Impl::examineForms: examining a page twice!");
+
+ ::std::stack< Reference< XIndexAccess > > aContainerHistory;
+ ::std::stack< sal_Int32 > aIndexHistory;
+
+ Reference< XIndexAccess > xLoop = xCollectionIndex;
+ sal_Int32 nChildPos = 0;
+ do
+ {
+ if (nChildPos < xLoop->getCount())
+ {
+ Reference< XPropertySet > xCurrent( xLoop->getByIndex( nChildPos ), UNO_QUERY );
+ OSL_ENSURE(xCurrent.is(), "OFormLayerXMLExport_Impl::examineForms: invalid child object");
+ if (!xCurrent.is())
+ continue;
+
+ if (!checkExamineControl(xCurrent))
+ {
+ // step down
+ Reference< XIndexAccess > xNextContainer(xCurrent, UNO_QUERY);
+ OSL_ENSURE(xNextContainer.is(), "OFormLayerXMLExport_Impl::examineForms: what the heck is this ... no control, no container?");
+ aContainerHistory.push(xLoop);
+ aIndexHistory.push(nChildPos);
+
+ xLoop = xNextContainer;
+ nChildPos = -1; // will be incremented below
+ }
+ ++nChildPos;
+ }
+ else
+ {
+ // step up
+ while ((nChildPos >= xLoop->getCount()) && !aContainerHistory.empty() )
+ {
+ xLoop = aContainerHistory.top();
+ aContainerHistory.pop();
+ nChildPos = aIndexHistory.top();
+ aIndexHistory.pop();
+
+ ++nChildPos;
+ }
+ if (nChildPos >= xLoop->getCount())
+ // exited the loop above because we have no history anymore (0 == aContainerHistory.size()),
+ // and on the current level there are no more children
+ // -> leave
+ break;
+ }
+ }
+ while (xLoop.is());
+ }
+
+ //---------------------------------------------------------------------
+ namespace
+ {
+ struct AccumulateSize : public ::std::binary_function< size_t, MapPropertySet2Map::value_type, size_t >
+ {
+ size_t operator()( size_t _size, const MapPropertySet2Map::value_type& _map ) const
+ {
+ return _size + _map.second.size();
+ }
+ };
+
+ ::rtl::OUString lcl_findFreeControlId( const MapPropertySet2Map& _rAllPagesControlIds )
+ {
+ static const ::rtl::OUString sControlIdBase( RTL_CONSTASCII_USTRINGPARAM( "control" ) );
+ ::rtl::OUString sControlId = sControlIdBase;
+
+ size_t nKnownControlCount = ::std::accumulate( _rAllPagesControlIds.begin(), _rAllPagesControlIds.end(), (size_t)0, AccumulateSize() );
+ sControlId += ::rtl::OUString::valueOf( (sal_Int32)nKnownControlCount + 1 );
+
+ #ifdef DBG_UTIL
+ // Check if the id is already used. It shouldn't, as we currently have no mechanism for removing entries
+ // from the map, so the approach used above (take the accumulated map size) should be sufficient. But if
+ // somebody changes this (e.g. allows removing entries from the map), the assertion below probably will fail.
+ for ( MapPropertySet2Map::const_iterator outer = _rAllPagesControlIds.begin();
+ outer != _rAllPagesControlIds.end();
+ ++outer
+ )
+ for ( MapPropertySet2String::const_iterator inner = outer->second.begin();
+ inner != outer->second.end();
+ ++inner
+ )
+ {
+ OSL_ENSURE( inner->second != sControlId,
+ "lcl_findFreeControlId: auto-generated control ID is already used!" );
+ }
+ #endif
+ return sControlId;
+ }
+ }
+
+ //---------------------------------------------------------------------
+ sal_Bool OFormLayerXMLExport_Impl::checkExamineControl(const Reference< XPropertySet >& _rxObject)
+ {
+ Reference< XPropertySetInfo > xCurrentInfo = _rxObject->getPropertySetInfo();
+ OSL_ENSURE(xCurrentInfo.is(), "OFormLayerXMLExport_Impl::checkExamineControl: no property set info");
+
+ sal_Bool bIsControl = xCurrentInfo->hasPropertyByName( PROPERTY_CLASSID );
+ if (bIsControl)
+ {
+ // ----------------------------------
+ // generate a new control id
+
+ // find a free id
+ ::rtl::OUString sCurrentId = lcl_findFreeControlId( m_aControlIds );
+ // add it to the map
+ m_aCurrentPageIds->second[_rxObject] = sCurrentId;
+
+ // ----------------------------------
+ // check if this control has a "LabelControl" property referring another control
+ if ( xCurrentInfo->hasPropertyByName( PROPERTY_CONTROLLABEL ) )
+ {
+ Reference< XPropertySet > xCurrentReference( _rxObject->getPropertyValue( PROPERTY_CONTROLLABEL ), UNO_QUERY );
+ if (xCurrentReference.is())
+ {
+ ::rtl::OUString& sReferencedBy = m_aCurrentPageReferring->second[xCurrentReference];
+ if (sReferencedBy.getLength())
+ // it's not the first _rxObject referring to the xCurrentReference
+ // -> separate the id
+ sReferencedBy += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(","));
+ sReferencedBy += sCurrentId;
+ }
+ }
+
+ // ----------------------------------
+ // check if the control needs a number format style
+ if ( xCurrentInfo->hasPropertyByName( PROPERTY_FORMATKEY ) )
+ {
+ examineControlNumberFormat(_rxObject);
+ }
+
+ // ----------------------------------
+ // check if it's a control providing text
+ Reference< XText > xControlText( _rxObject, UNO_QUERY );
+ if ( xControlText.is() )
+ {
+ m_rContext.GetTextParagraphExport()->collectTextAutoStyles( xControlText );
+ }
+
+ // ----------------------------------
+ // check if it is a grid control - in this case, we need special handling for the columns
+ sal_Int16 nControlType = FormComponentType::CONTROL;
+ _rxObject->getPropertyValue( PROPERTY_CLASSID ) >>= nControlType;
+ if ( FormComponentType::GRIDCONTROL == nControlType )
+ {
+ collectGridColumnStylesAndIds( _rxObject );
+ }
+ }
+
+ return bIsControl;
+ }
+
+ //---------------------------------------------------------------------
+ void OFormLayerXMLExport_Impl::collectGridColumnStylesAndIds( const Reference< XPropertySet >& _rxControl )
+ {
+ // loop through all columns of the grid
+ try
+ {
+ Reference< XIndexAccess > xContainer( _rxControl, UNO_QUERY );
+ OSL_ENSURE( xContainer.is(), "OFormLayerXMLExport_Impl::collectGridColumnStylesAndIds: grid control not being a container?!" );
+ if ( !xContainer.is() )
+ return;
+
+ Reference< XPropertySetInfo > xColumnPropertiesMeta;
+
+ sal_Int32 nCount = xContainer->getCount();
+ for ( sal_Int32 i=0; i<nCount; ++i )
+ {
+ Reference< XPropertySet > xColumnProperties( xContainer->getByIndex( i ), UNO_QUERY );
+ OSL_ENSURE( xColumnProperties.is(), "OFormLayerXMLExport_Impl::collectGridColumnStylesAndIds: invalid grid column encountered!" );
+ if ( !xColumnProperties.is() )
+ continue;
+
+ // ----------------------------------
+ // generate a new control id
+
+ // find a free id
+ ::rtl::OUString sCurrentId = lcl_findFreeControlId( m_aControlIds );
+ // add it to the map
+ m_aCurrentPageIds->second[ xColumnProperties ] = sCurrentId;
+
+ // ----------------------------------
+ // determine a number style, if needed
+ xColumnPropertiesMeta = xColumnProperties->getPropertySetInfo();
+ // get the styles of the column
+ ::std::vector< XMLPropertyState > aPropertyStates = m_xStyleExportMapper->Filter( xColumnProperties );
+
+ // care for the number format, additionally
+ ::rtl::OUString sColumnNumberStyle;
+ if ( xColumnPropertiesMeta.is() && xColumnPropertiesMeta->hasPropertyByName( PROPERTY_FORMATKEY ) )
+ sColumnNumberStyle = getImmediateNumberStyle( xColumnProperties );
+
+ if ( sColumnNumberStyle.getLength() )
+ { // the column indeed has a formatting
+ sal_Int32 nStyleMapIndex = m_xStyleExportMapper->getPropertySetMapper()->FindEntryIndex( CTF_FORMS_DATA_STYLE );
+ // TODO: move this to the ctor
+ OSL_ENSURE ( -1 != nStyleMapIndex, "XMLShapeExport::collectShapeAutoStyles: could not obtain the index for our context id!");
+
+ XMLPropertyState aNumberStyleState( nStyleMapIndex, makeAny( sColumnNumberStyle ) );
+ aPropertyStates.push_back( aNumberStyleState );
+ }
+
+#if OSL_DEBUG_LEVEL > 0
+ ::std::vector< XMLPropertyState >::const_iterator aHaveALook = aPropertyStates.begin();
+ for ( ; aHaveALook != aPropertyStates.end(); ++aHaveALook )
+ {
+ (void)aHaveALook;
+ }
+#endif
+
+ // ----------------------------------
+ // determine the column style
+
+ if ( !aPropertyStates.empty() )
+ { // add to the style pool
+ ::rtl::OUString sColumnStyleName = m_rContext.GetAutoStylePool()->Add( XML_STYLE_FAMILY_CONTROL_ID, aPropertyStates );
+
+ OSL_ENSURE( m_aGridColumnStyles.end() == m_aGridColumnStyles.find( xColumnProperties ),
+ "OFormLayerXMLExport_Impl::collectGridColumnStylesAndIds: already have a style for this column!" );
+
+ m_aGridColumnStyles.insert( MapPropertySet2String::value_type( xColumnProperties, sColumnStyleName ) );
+ }
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //---------------------------------------------------------------------
+ sal_Int32 OFormLayerXMLExport_Impl::implExamineControlNumberFormat( const Reference< XPropertySet >& _rxObject )
+ {
+ // get the format key relative to our own formats supplier
+ sal_Int32 nOwnFormatKey = ensureTranslateFormat( _rxObject );
+
+ if ( -1 != nOwnFormatKey )
+ // tell the exporter that we used this format
+ getControlNumberStyleExport()->SetUsed( nOwnFormatKey );
+
+ return nOwnFormatKey;
+ }
+
+ //---------------------------------------------------------------------
+ void OFormLayerXMLExport_Impl::examineControlNumberFormat( const Reference< XPropertySet >& _rxControl )
+ {
+ sal_Int32 nOwnFormatKey = implExamineControlNumberFormat( _rxControl );
+
+ if ( -1 == nOwnFormatKey )
+ // nothing to do, the number format of this control is void
+ return;
+
+ // remember the format key for this control (we'll be asked in getControlNumberStyle for this)
+ OSL_ENSURE(m_aControlNumberFormats.end() == m_aControlNumberFormats.find(_rxControl),
+ "OFormLayerXMLExport_Impl::examineControlNumberFormat: already handled this control!");
+ m_aControlNumberFormats[_rxControl] = nOwnFormatKey;
+ }
+
+ //---------------------------------------------------------------------
+ sal_Int32 OFormLayerXMLExport_Impl::ensureTranslateFormat(const Reference< XPropertySet >& _rxFormattedControl)
+ {
+ ensureControlNumberStyleExport();
+ OSL_ENSURE(m_xControlNumberFormats.is(), "OFormLayerXMLExport_Impl::ensureTranslateFormat: no own formats supplier!");
+ // (should have been created in ensureControlNumberStyleExport)
+
+ sal_Int32 nOwnFormatKey = -1;
+
+ // the format key (relative to the control's supplier)
+ sal_Int32 nControlFormatKey = -1;
+ Any aControlFormatKey = _rxFormattedControl->getPropertyValue(PROPERTY_FORMATKEY);
+ if (aControlFormatKey >>= nControlFormatKey)
+ {
+ // the control's number format
+ Reference< XNumberFormatsSupplier > xControlFormatsSupplier;
+ _rxFormattedControl->getPropertyValue(PROPERTY_FORMATSSUPPLIER) >>= xControlFormatsSupplier;
+ Reference< XNumberFormats > xControlFormats;
+ if (xControlFormatsSupplier.is())
+ xControlFormats = xControlFormatsSupplier->getNumberFormats();
+ OSL_ENSURE(xControlFormats.is(), "OFormLayerXMLExport_Impl::ensureTranslateFormat: formatted control without supplier!");
+
+ // obtain the persistent (does not depend on the formats supplier) representation of the control's format
+ Locale aFormatLocale;
+ ::rtl::OUString sFormatDescription;
+ if (xControlFormats.is())
+ {
+ Reference< XPropertySet > xControlFormat = xControlFormats->getByKey(nControlFormatKey);
+
+ xControlFormat->getPropertyValue(PROPERTY_LOCALE) >>= aFormatLocale;
+ xControlFormat->getPropertyValue(PROPERTY_FORMATSTRING) >>= sFormatDescription;
+ }
+
+ // check if our own formats collection already knows the format
+ nOwnFormatKey = m_xControlNumberFormats->queryKey(sFormatDescription, aFormatLocale, sal_False);
+ if (-1 == nOwnFormatKey)
+ { // no, we don't
+ // -> create a new format
+ nOwnFormatKey = m_xControlNumberFormats->addNew(sFormatDescription, aFormatLocale);
+ }
+ OSL_ENSURE(-1 != nOwnFormatKey, "OFormLayerXMLExport_Impl::ensureTranslateFormat: could not translate the controls format key!");
+ }
+ else
+ OSL_ENSURE(!aControlFormatKey.hasValue(), "OFormLayerXMLExport_Impl::ensureTranslateFormat: invalid number format property value!");
+
+ return nOwnFormatKey;
+ }
+
+ //---------------------------------------------------------------------
+ void OFormLayerXMLExport_Impl::ensureControlNumberStyleExport()
+ {
+ if (!m_pControlNumberStyles)
+ {
+ // create our number formats supplier (if necessary)
+ Reference< XNumberFormatsSupplier > xFormatsSupplier;
+
+ OSL_ENSURE(!m_xControlNumberFormats.is(), "OFormLayerXMLExport_Impl::getControlNumberStyleExport: inconsistence!");
+ // the m_xControlNumberFormats and m_pControlNumberStyles should be maintained together
+
+ try
+ {
+ // create it for en-US (does not really matter, as we will specify a locale for every
+ // concrete language to use)
+ Sequence< Any > aSupplierArgs(1);
+ aSupplierArgs[0] <<= Locale ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en")),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("US")),
+ ::rtl::OUString()
+ );
+
+ Reference< XInterface > xFormatsSupplierUntyped =
+ m_rContext.getServiceFactory()->createInstanceWithArguments(
+ SERVICE_NUMBERFORMATSSUPPLIER,
+ aSupplierArgs
+ );
+ OSL_ENSURE(xFormatsSupplierUntyped.is(), "OFormLayerXMLExport_Impl::getControlNumberStyleExport: could not instantiate a number formats supplier!");
+
+ xFormatsSupplier = Reference< XNumberFormatsSupplier >(xFormatsSupplierUntyped, UNO_QUERY);
+ if (xFormatsSupplier.is())
+ m_xControlNumberFormats = xFormatsSupplier->getNumberFormats();
+ }
+ catch(const Exception&)
+ {
+ }
+
+ OSL_ENSURE(m_xControlNumberFormats.is(), "OFormLayerXMLExport_Impl::getControlNumberStyleExport: could not obtain my default number formats!");
+
+ // create the exporter
+ m_pControlNumberStyles = new SvXMLNumFmtExport(m_rContext, xFormatsSupplier, getControlNumberStyleNamePrefix());
+ }
+ }
+
+ //---------------------------------------------------------------------
+ SvXMLNumFmtExport* OFormLayerXMLExport_Impl::getControlNumberStyleExport()
+ {
+ ensureControlNumberStyleExport();
+ return m_pControlNumberStyles;
+ }
+
+ //---------------------------------------------------------------------
+ void OFormLayerXMLExport_Impl::excludeFromExport( const Reference< XControlModel > _rxControl )
+ {
+ Reference< XPropertySet > xProps( _rxControl, UNO_QUERY );
+ OSL_ENSURE( xProps.is(), "OFormLayerXMLExport_Impl::excludeFromExport: invalid control model!" );
+#if OSL_DEBUG_LEVEL > 0
+ ::std::pair< PropertySetBag::iterator, bool > aPos =
+#endif
+ m_aIgnoreList.insert( xProps );
+ OSL_ENSURE( aPos.second, "OFormLayerXMLExport_Impl::excludeFromExport: element already exists in the ignore list!" );
+ }
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/layerexport.hxx b/xmloff/source/forms/layerexport.hxx
new file mode 100644
index 000000000000..30d89ced4343
--- /dev/null
+++ b/xmloff/source/forms/layerexport.hxx
@@ -0,0 +1,322 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_FORMS_LAYEREXPORT_HXX_
+#define _XMLOFF_FORMS_LAYEREXPORT_HXX_
+
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/script/ScriptEventDescriptor.hpp>
+#include <com/sun/star/util/XNumberFormats.hpp>
+#include <com/sun/star/awt/XControlModel.hpp>
+#include "callbacks.hxx"
+#include "ifacecompare.hxx"
+#include <rtl/ref.hxx>
+
+class SvXMLExport;
+class SvXMLNumFmtExport;
+class XMLPropertyHandlerFactory;
+class SvXMLExportPropertyMapper;
+
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ typedef ::std::set < ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ , OPropertySetCompare
+ > PropertySetBag;
+
+ // maps objects (property sets) to strings, e.g. control ids.
+ typedef ::std::map < ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ , ::rtl::OUString
+ , OPropertySetCompare
+ > MapPropertySet2String;
+
+ // map pages to maps (of property sets to strings)
+ typedef ::std::map < ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >
+ , MapPropertySet2String
+ , ODrawPageCompare
+ > MapPropertySet2Map;
+
+ //=====================================================================
+ //= OFormLayerXMLExport_Impl
+ //=====================================================================
+ /** the implementation class for OFormLayerXMLExport
+ */
+ class OFormLayerXMLExport_Impl
+ :public IFormsExportContext
+ {
+ friend class OFormLayerXMLExport;
+
+ protected:
+ SvXMLExport& m_rContext;
+ SvXMLNumFmtExport* m_pControlNumberStyles;
+
+ // ignore list for control models
+ PropertySetBag m_aIgnoreList;
+
+ // style handling
+ ::rtl::Reference< XMLPropertyHandlerFactory > m_xPropertyHandlerFactory;
+ ::rtl::Reference< SvXMLExportPropertyMapper > m_xStyleExportMapper;
+
+ // we need our own number formats supplier:
+ // Controls which have a number formats do not work with the formats supplier of the document they reside
+ // in, instead they use the formats of the data source their form is associated with. If there is no
+ // such form or no such data source, they work with an own formatter.
+ // Even more, time and date fields do not work with a central formatter at all, they have their own one
+ // (which is shared internally, but this is a (hidden) implementation detail.)
+ //
+ // To not contaminate the global (document) number formats supplier (which could be obtained from the context),
+ // we have an own one.
+ // (Contaminate means: If a user adds a user-defined format to a formatted field, this format is stored in
+ // in the data source's formats supplier. To export this _and_ reuse existing structures, we would need to
+ // add this format to the global (document) formats supplier.
+ // In case of an export we could do some cleanup afterwards, but in case of an import, there is no such
+ // chance, as (if other user-defined formats exist in the document as well) we can't distinguish
+ // between user-defined formats really needed for the doc (i.e. in a calc cell) and formats only added
+ // to the supplier because the controls needed it.
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats >
+ m_xControlNumberFormats;
+
+ MapPropertySet2Map m_aControlIds;
+ // the control ids of all controls on all pages we ever examined
+
+ MapPropertySet2Map m_aReferringControls;
+ // for a given page (iter->first), and a given control (iter->second->first), this is the comma-separated
+ // lists of ids of the controls refering to the control given.
+
+ MapPropertySet2Map::iterator
+ m_aCurrentPageIds;
+ // the iterator for the control id map for the page beeing handled
+ MapPropertySet2Map::iterator
+ m_aCurrentPageReferring;
+ // the same for the map of referring controls
+
+ // TODO: To avoid this construct above, and to have a cleaner implementation, an class encapsulating the
+ // export of a single page should be introduced.
+
+ DECLARE_STL_MAP( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >, sal_Int32, OPropertySetCompare, MapPropertySet2Int);
+ MapPropertySet2Int m_aControlNumberFormats;
+ // maps controls to format keys, which are relative to our own formats supplier
+
+ MapPropertySet2String m_aGridColumnStyles;
+ // style names of grid columns
+
+ public:
+ OFormLayerXMLExport_Impl(SvXMLExport& _rContext);
+ virtual ~OFormLayerXMLExport_Impl();
+
+ protected:
+ /** exports one single grid column
+ */
+ void exportGridColumn(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& _rEvents
+ );
+
+ /** exports one single control
+ */
+ void exportControl(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControl,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& _rEvents
+ );
+
+ /** exports one single form
+ */
+ void exportForm(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxProps,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& _rEvents
+ );
+
+ /** seek to the page given.
+
+ <p>This must be called before you can retrieve any ids for controls on the page.</p>
+
+ @see
+ getControlId
+ */
+ sal_Bool seekPage(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& _rxDrawPage);
+
+ /** get the id of the given control.
+
+ <p>You must have sought to the page of the control before calling this.</p>
+ */
+ ::rtl::OUString
+ getControlId(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControl);
+
+ /** retrieves the style name for the control's number style.
+
+ <p>For performance reasons, this method is allowed to be called for any controls, even those which
+ do not have a number style. In this case, an empty string is returned.</p>
+ */
+ ::rtl::OUString
+ getControlNumberStyle( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControl );
+
+ // IFormsExportContext
+ virtual void exportCollectionElements(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& _rxCollection);
+ virtual SvXMLExport& getGlobalContext();
+ virtual ::rtl::OUString getObjectStyleName(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObject );
+ virtual ::rtl::Reference< SvXMLExportPropertyMapper > getStylePropertyMapper();
+
+ /** clear any structures which have been build in the recent <method>examine</method> calls.
+ */
+ void clear();
+
+ /** examine a forms collection.
+
+ <p>The method will collect control ids and add styles to the export context as necessary.</p>
+
+ <p>Every control in the object hierarchy given will be assigned to a unique id, which is stored for later
+ use.</p>
+
+ <p>In addition, any references the controls may have between each other, are collected and stored for
+ later use.</p>
+
+ <p>Upon calling this method, the id map will be cleared before collecting the new ids, so any ids
+ you collected previously will be lost</p>
+
+ @param _rxDrawPage
+ the draw page which's forms collection should be examined
+
+ @see getControlId
+ @see exportControl
+ @see exportForms
+ */
+ void examineForms(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& _rxDrawPage);
+
+ /** export a forms collection of a draw page
+
+ <p>The method will obtain the forms collection of the page and call
+ <method>exportCollectionElements</method>.</p>
+ */
+ void exportForms(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& _rxDrawPage);
+
+ /** exports the XForms model data
+ */
+ void exportXForms() const;
+
+ /** determines whether the given page contains logical forms
+ */
+ bool pageContainsForms( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& _rxDrawPage ) const;
+
+ /** determines whether the given page contains XForm instances
+ */
+ bool documentContainsXForms() const;
+
+ /** exports the controls number styles
+ */
+ void exportControlNumberStyles();
+
+ /** exports the automatic control number styles
+ */
+ void exportAutoControlNumberStyles();
+
+ /** exports the auto-styles collected during the examineForms calls
+ */
+ void exportAutoStyles();
+
+ protected:
+ sal_Bool impl_isFormPageContainingForms(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& _rxDrawPage,
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& _rxForms);
+
+ /** moves the m_aCurrentPage* members to the positions specifying the given page.
+
+ @return <TRUE/> if there already were structures for the given page
+ */
+ sal_Bool implMoveIterators(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& _rxDrawPage,
+ sal_Bool _bClear);
+
+ /** check the object given if it's a control, if so, examine it.
+ @return <TRUE/> if the object has been handled
+ */
+ sal_Bool checkExamineControl(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObject);
+
+ /** examines the control's number format, so later the format style can be referred
+
+ <p>remembers the format key for the control, so it can later be asked for in getControlNumberStyle</p>
+ */
+ void examineControlNumberFormat(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControl);
+
+ /** examines the control's number format, so later the format style can be referred
+
+ <p>does not remember the information returned in any way</p>
+ */
+ sal_Int32 implExamineControlNumberFormat( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObject );
+
+ /** collects AutoStyles for grid columns
+ */
+ void collectGridColumnStylesAndIds( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControl );
+
+ /** ensures that the number format of the given control exist in our own formats supplier.
+
+ <p>The given control is examined for it's format (i.e. it's FormatKey/FormatsSupplier properties),
+ and the format is added (if necessary) to m_xControlNumberFormats</p>.
+
+ @return
+ the format key of the control's format relative to our own formats supplier
+
+ */
+ sal_Int32 ensureTranslateFormat(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxFormattedControl);
+
+ /// returns the instance exporting our control's number styles
+ SvXMLNumFmtExport* getControlNumberStyleExport();
+
+ /// ensures that the instance exporting our control's number styles exists
+ void ensureControlNumberStyleExport();
+
+ /** determines the number format style for the given object without remembering it
+ */
+ ::rtl::OUString
+ getImmediateNumberStyle( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObject );
+
+ /** returns the prefix to be used for control number styles
+ */
+ static const ::rtl::OUString& getControlNumberStyleNamePrefix();
+
+ /** exclude the given control (model) from export.
+
+ <p>If your document contains form controls which are not to be exported for whatever reason,
+ you need to announce the models of these controls (can be retrieved from XControlShape::getControl)
+ to the form layer exporter.<br/>
+ Of course you have to do this before calling <member>exportForms</member></p>
+ */
+ void excludeFromExport( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > _rxControl );
+ };
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+#endif // _XMLOFF_FORMS_LAYEREXPORT_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/layerimport.cxx b/xmloff/source/forms/layerimport.cxx
new file mode 100644
index 000000000000..c277969c51ab
--- /dev/null
+++ b/xmloff/source/forms/layerimport.cxx
@@ -0,0 +1,650 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "layerimport.hxx"
+#include "formenums.hxx"
+#include "elementimport.hxx"
+#include "officeforms.hxx"
+#include "strings.hxx"
+#include "formstyles.hxx"
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/xmlstyle.hxx>
+#include <xmloff/families.hxx>
+#include <xmloff/xmlprmap.hxx>
+#include <xmloff/prstylei.hxx>
+#include <xmloff/xmlimp.hxx>
+#include "XMLEventImportHelper.hxx"
+#include <xmloff/xmlimppr.hxx>
+#include <xmloff/xmlnumfi.hxx>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include <com/sun/star/form/FormSubmitEncoding.hpp>
+#include <com/sun/star/form/FormSubmitMethod.hpp>
+#include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/form/NavigationBarMode.hpp>
+#include <com/sun/star/form/TabulatorCycle.hpp>
+#include <com/sun/star/form/FormButtonType.hpp>
+#include <com/sun/star/awt/ScrollBarOrientation.hpp>
+#include <com/sun/star/awt/VisualEffect.hpp>
+#include <com/sun/star/form/ListSourceType.hpp>
+#include <tools/wintypes.hxx> // for check states
+#include <com/sun/star/lang/Locale.hpp>
+#include <xmloff/controlpropertyhdl.hxx>
+#include "controlpropertymap.hxx"
+#include "formevents.hxx"
+#include "formcellbinding.hxx"
+#include "xmloff/xformsimport.hxx"
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <rtl/logfile.hxx>
+#include <algorithm>
+
+SV_IMPL_REF( SvXMLStylesContext );
+
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::xml;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::form;
+using namespace ::com::sun::star::sdb;
+
+//=====================================================================
+//= OFormLayerXMLImport_Impl
+//=====================================================================
+//---------------------------------------------------------------------
+OFormLayerXMLImport_Impl::OFormLayerXMLImport_Impl(SvXMLImport& _rImporter)
+ :m_rImporter(_rImporter)
+ ,m_pAutoStyles(NULL)
+{
+ // build the attribute2property map
+ // string properties which are exported as attributes
+ m_aAttributeMetaData.addStringProperty(
+ OAttributeMetaData::getCommonControlAttributeName(CCA_NAME), PROPERTY_NAME);
+ m_aAttributeMetaData.addStringProperty(
+ OAttributeMetaData::getSpecialAttributeName(SCA_GROUP_NAME), PROPERTY_GROUP_NAME);
+ m_aAttributeMetaData.addStringProperty(
+ OAttributeMetaData::getCommonControlAttributeName(CCA_IMAGE_DATA), PROPERTY_IMAGEURL);
+ m_aAttributeMetaData.addStringProperty(
+ OAttributeMetaData::getCommonControlAttributeName(CCA_LABEL), PROPERTY_LABEL);
+ m_aAttributeMetaData.addStringProperty(
+ OAttributeMetaData::getCommonControlAttributeName(CCA_TARGET_LOCATION), PROPERTY_TARGETURL);
+ m_aAttributeMetaData.addStringProperty(
+ OAttributeMetaData::getCommonControlAttributeName(CCA_TITLE), PROPERTY_TITLE);
+ m_aAttributeMetaData.addStringProperty(
+ OAttributeMetaData::getCommonControlAttributeName(CCA_TARGET_FRAME), PROPERTY_TARGETFRAME, "_blank");
+ m_aAttributeMetaData.addStringProperty(
+ OAttributeMetaData::getDatabaseAttributeName(DA_DATA_FIELD), PROPERTY_DATAFIELD);
+ m_aAttributeMetaData.addStringProperty(
+ OAttributeMetaData::getFormAttributeName(faCommand), PROPERTY_COMMAND);
+ m_aAttributeMetaData.addStringProperty(
+ OAttributeMetaData::getFormAttributeName(faDatasource), PROPERTY_DATASOURCENAME);
+ m_aAttributeMetaData.addStringProperty(
+ OAttributeMetaData::getFormAttributeName(faFilter), PROPERTY_FILTER);
+ m_aAttributeMetaData.addStringProperty(
+ OAttributeMetaData::getFormAttributeName(faOrder), PROPERTY_ORDER);
+
+ // properties not added because they're already present in another form
+ OSL_ENSURE(
+ 0 == ::rtl::OUString::createFromAscii(OAttributeMetaData::getCommonControlAttributeName(CCA_TARGET_LOCATION)).compareToAscii(
+ OAttributeMetaData::getFormAttributeName(faAction)),
+ "OFormLayerXMLImport_Impl::OFormLayerXMLImport_Impl: invalid attribute names (1)!");
+ // if this fails, we would have to add a translation from faAction->PROPERTY_TARGETURL
+ // We did not because we already have one CCA_TARGET_LOCATION->PROPERTY_TARGETURL,
+ // and CCA_TARGET_LOCATION and faAction should be represented by the same attribute
+
+ OSL_ENSURE(
+ 0 == ::rtl::OUString::createFromAscii(OAttributeMetaData::getCommonControlAttributeName(CCA_NAME)).compareToAscii(
+ OAttributeMetaData::getFormAttributeName(faName)),
+ "OFormLayerXMLImport_Impl::OFormLayerXMLImport_Impl: invalid attribute names (2)!");
+ // the same for faName, CCA_NAME and PROPERTY_NAME
+
+ // boolean properties which are exported as attributes
+ m_aAttributeMetaData.addBooleanProperty(
+ OAttributeMetaData::getCommonControlAttributeName(CCA_CURRENT_SELECTED), PROPERTY_STATE, sal_False);
+ m_aAttributeMetaData.addBooleanProperty(
+ OAttributeMetaData::getCommonControlAttributeName(CCA_DISABLED), PROPERTY_ENABLED, sal_False, sal_True);
+ m_aAttributeMetaData.addBooleanProperty(
+ OAttributeMetaData::getCommonControlAttributeName(CCA_DROPDOWN), PROPERTY_DROPDOWN, sal_False);
+ m_aAttributeMetaData.addBooleanProperty(
+ OAttributeMetaData::getCommonControlAttributeName(CCA_PRINTABLE), PROPERTY_PRINTABLE, sal_True);
+ m_aAttributeMetaData.addBooleanProperty(
+ OAttributeMetaData::getCommonControlAttributeName(CCA_READONLY), PROPERTY_READONLY, sal_False);
+ m_aAttributeMetaData.addBooleanProperty(
+ OAttributeMetaData::getCommonControlAttributeName(CCA_SELECTED), PROPERTY_DEFAULT_STATE, sal_False);
+ m_aAttributeMetaData.addBooleanProperty(
+ OAttributeMetaData::getCommonControlAttributeName(CCA_TAB_STOP), PROPERTY_TABSTOP, sal_True);
+ m_aAttributeMetaData.addBooleanProperty(
+ OAttributeMetaData::getDatabaseAttributeName(DA_CONVERT_EMPTY), PROPERTY_EMPTY_IS_NULL, sal_False);
+ m_aAttributeMetaData.addBooleanProperty(
+ OAttributeMetaData::getSpecialAttributeName(SCA_VALIDATION), PROPERTY_STRICTFORMAT, sal_False);
+ m_aAttributeMetaData.addBooleanProperty(
+ OAttributeMetaData::getSpecialAttributeName(SCA_MULTI_LINE), PROPERTY_MULTILINE, sal_False);
+ m_aAttributeMetaData.addBooleanProperty(
+ OAttributeMetaData::getSpecialAttributeName(SCA_AUTOMATIC_COMPLETION), PROPERTY_AUTOCOMPLETE, sal_False);
+ m_aAttributeMetaData.addBooleanProperty(
+ OAttributeMetaData::getSpecialAttributeName(SCA_MULTIPLE), PROPERTY_MULTISELECTION, sal_False);
+ m_aAttributeMetaData.addBooleanProperty(
+ OAttributeMetaData::getSpecialAttributeName(SCA_DEFAULT_BUTTON), PROPERTY_DEFAULTBUTTON, sal_False);
+ m_aAttributeMetaData.addBooleanProperty(
+ OAttributeMetaData::getSpecialAttributeName(SCA_IS_TRISTATE), PROPERTY_TRISTATE, sal_False);
+ m_aAttributeMetaData.addBooleanProperty(
+ OAttributeMetaData::getFormAttributeName(faAllowDeletes), PROPERTY_ALLOWDELETES, sal_True);
+ m_aAttributeMetaData.addBooleanProperty(
+ OAttributeMetaData::getFormAttributeName(faAllowInserts), PROPERTY_ALLOWINSERTS, sal_True);
+ m_aAttributeMetaData.addBooleanProperty(
+ OAttributeMetaData::getFormAttributeName(faAllowUpdates), PROPERTY_ALLOWUPDATES, sal_True);
+ m_aAttributeMetaData.addBooleanProperty(
+ OAttributeMetaData::getFormAttributeName(faApplyFilter), PROPERTY_APPLYFILTER, sal_False);
+ m_aAttributeMetaData.addBooleanProperty(
+ OAttributeMetaData::getFormAttributeName(faEscapeProcessing), PROPERTY_ESCAPEPROCESSING, sal_True);
+ m_aAttributeMetaData.addBooleanProperty(
+ OAttributeMetaData::getFormAttributeName(faIgnoreResult), PROPERTY_IGNORERESULT, sal_False);
+ m_aAttributeMetaData.addBooleanProperty(
+ OAttributeMetaData::getSpecialAttributeName( SCA_TOGGLE ), PROPERTY_TOGGLE, sal_False );
+ m_aAttributeMetaData.addBooleanProperty(
+ OAttributeMetaData::getSpecialAttributeName( SCA_FOCUS_ON_CLICK ), PROPERTY_FOCUS_ON_CLICK, sal_True );
+ m_aAttributeMetaData.addBooleanProperty(
+ OAttributeMetaData::getDatabaseAttributeName( DA_INPUT_REQUIRED ), PROPERTY_INPUT_REQUIRED, sal_False );
+
+ // the int16 attributes
+ m_aAttributeMetaData.addInt16Property(
+ OAttributeMetaData::getCommonControlAttributeName(CCA_MAX_LENGTH), PROPERTY_MAXTEXTLENGTH, 0);
+ m_aAttributeMetaData.addInt16Property(
+ OAttributeMetaData::getCommonControlAttributeName(CCA_SIZE), PROPERTY_LINECOUNT, 5);
+ m_aAttributeMetaData.addInt16Property(
+ OAttributeMetaData::getCommonControlAttributeName(CCA_TAB_INDEX), PROPERTY_TABINDEX, 0);
+ m_aAttributeMetaData.addInt16Property(
+ OAttributeMetaData::getDatabaseAttributeName(DA_BOUND_COLUMN), PROPERTY_BOUNDCOLUMN, 0);
+
+ // the int32 attributes
+ m_aAttributeMetaData.addInt32Property(
+ OAttributeMetaData::getSpecialAttributeName( SCA_PAGE_STEP_SIZE ), PROPERTY_BLOCK_INCREMENT, 10 );
+
+ // the enum attributes
+ m_aAttributeMetaData.addEnumProperty(
+ OAttributeMetaData::getCommonControlAttributeName( CCA_VISUAL_EFFECT ), PROPERTY_VISUAL_EFFECT,
+ VisualEffect::LOOK3D, OEnumMapper::getEnumMap( OEnumMapper::epVisualEffect ),
+ &::getCppuType( static_cast< sal_Int16* >( NULL ) ) );
+ m_aAttributeMetaData.addEnumProperty(
+ OAttributeMetaData::getCommonControlAttributeName( CCA_ORIENTATION ), PROPERTY_ORIENTATION,
+ ScrollBarOrientation::HORIZONTAL, OEnumMapper::getEnumMap( OEnumMapper::epOrientation ),
+ &::getCppuType( static_cast< sal_Int32* >( NULL ) ) );
+ m_aAttributeMetaData.addEnumProperty(
+ OAttributeMetaData::getCommonControlAttributeName(CCA_BUTTON_TYPE), PROPERTY_BUTTONTYPE,
+ FormButtonType_PUSH, OEnumMapper::getEnumMap(OEnumMapper::epButtonType),
+ &::getCppuType( static_cast<FormButtonType*>(NULL) ));
+ m_aAttributeMetaData.addEnumProperty(
+ OAttributeMetaData::getDatabaseAttributeName(DA_LIST_SOURCE_TYPE), PROPERTY_LISTSOURCETYPE,
+ ListSourceType_VALUELIST, OEnumMapper::getEnumMap(OEnumMapper::epListSourceType),
+ &::getCppuType( static_cast<ListSourceType*>(NULL) ));
+ m_aAttributeMetaData.addEnumProperty(
+ OAttributeMetaData::getSpecialAttributeName(SCA_STATE), PROPERTY_DEFAULT_STATE, STATE_NOCHECK,
+ OEnumMapper::getEnumMap(OEnumMapper::epCheckState),
+ &::getCppuType( static_cast< sal_Int16* >(NULL)));
+ m_aAttributeMetaData.addEnumProperty(
+ OAttributeMetaData::getSpecialAttributeName(SCA_CURRENT_STATE), PROPERTY_STATE, STATE_NOCHECK,
+ OEnumMapper::getEnumMap(OEnumMapper::epCheckState),
+ &::getCppuType( static_cast< sal_Int16* >(NULL)));
+ m_aAttributeMetaData.addEnumProperty(
+ OAttributeMetaData::getFormAttributeName(faEnctype), PROPERTY_SUBMIT_ENCODING,
+ FormSubmitEncoding_URL, OEnumMapper::getEnumMap(OEnumMapper::epSubmitEncoding),
+ &::getCppuType( static_cast<FormSubmitEncoding*>(NULL) ));
+ m_aAttributeMetaData.addEnumProperty(
+ OAttributeMetaData::getFormAttributeName(faMethod), PROPERTY_SUBMIT_METHOD,
+ FormSubmitMethod_GET, OEnumMapper::getEnumMap(OEnumMapper::epSubmitMethod),
+ &::getCppuType( static_cast<FormSubmitMethod*>(NULL) ));
+ m_aAttributeMetaData.addEnumProperty(
+ OAttributeMetaData::getFormAttributeName(faCommandType), PROPERTY_COMMAND_TYPE,
+ CommandType::COMMAND, OEnumMapper::getEnumMap(OEnumMapper::epCommandType));
+ m_aAttributeMetaData.addEnumProperty(
+ OAttributeMetaData::getFormAttributeName(faNavigationMode), PROPERTY_NAVIGATION,
+ NavigationBarMode_NONE, OEnumMapper::getEnumMap(OEnumMapper::epNavigationType),
+ &::getCppuType( static_cast<NavigationBarMode*>(NULL) ));
+ m_aAttributeMetaData.addEnumProperty(
+ OAttributeMetaData::getFormAttributeName(faTabbingCycle), PROPERTY_CYCLE,
+ TabulatorCycle_RECORDS, OEnumMapper::getEnumMap(OEnumMapper::epTabCyle),
+ &::getCppuType( static_cast<TabulatorCycle*>(NULL) ));
+
+ // 'initialize'
+ m_aCurrentPageIds = m_aControlIds.end();
+}
+
+//---------------------------------------------------------------------
+OFormLayerXMLImport_Impl::~OFormLayerXMLImport_Impl()
+{
+ // outlined to allow forward declaration of OAttribute2Property in the header
+
+ if (m_pAutoStyles)
+ m_pAutoStyles->ReleaseRef();
+}
+
+//---------------------------------------------------------------------
+void OFormLayerXMLImport_Impl::setAutoStyleContext(SvXMLStylesContext* _pNewContext)
+{
+ OSL_ENSURE(!m_pAutoStyles, "OFormLayerXMLImport_Impl::setAutoStyleContext: not to be called twice!");
+ m_pAutoStyles = _pNewContext;
+ if (m_pAutoStyles)
+ m_pAutoStyles->AddRef();
+}
+
+//---------------------------------------------------------------------
+void OFormLayerXMLImport_Impl::applyControlNumberStyle(const Reference< XPropertySet >& _rxControlModel, const ::rtl::OUString& _rControlNumerStyleName)
+{
+ OSL_ENSURE(_rxControlModel.is() && (0 != _rControlNumerStyleName.getLength()),
+ "OFormLayerXMLImport_Impl::applyControlNumberStyle: invalid arguments (this will crash)!");
+
+ OSL_ENSURE(m_pAutoStyles, "OFormLayerXMLImport_Impl::applyControlNumberStyle: have no auto style context!");
+ if (!m_pAutoStyles)
+ {
+ m_pAutoStyles = m_rImporter.GetShapeImport()->GetAutoStylesContext();
+ if (m_pAutoStyles)
+ m_pAutoStyles->AddRef();
+ }
+
+ if (m_pAutoStyles)
+ {
+ const SvXMLStyleContext* pStyle = m_pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_DATA_STYLE, _rControlNumerStyleName);
+ if (pStyle)
+ {
+ const SvXMLNumFormatContext* pDataStyle = static_cast<const SvXMLNumFormatContext*>(pStyle);
+
+ // set this format at the control model
+ try
+ {
+ // the models number format supplier and formats
+ Reference< XNumberFormatsSupplier > xFormatsSupplier;
+ _rxControlModel->getPropertyValue(PROPERTY_FORMATSSUPPLIER) >>= xFormatsSupplier;
+ Reference< XNumberFormats > xFormats;
+ if (xFormatsSupplier.is())
+ xFormats = xFormatsSupplier->getNumberFormats();
+ OSL_ENSURE(xFormats.is(), "OFormLayerXMLImport_Impl::applyControlNumberStyle: could not obtain the controls number formats!");
+
+ // obtain a key
+ if (xFormats.is())
+ {
+ sal_Int32 nFormatKey = const_cast<SvXMLNumFormatContext*>(pDataStyle)->CreateAndInsert( xFormatsSupplier );
+ OSL_ENSURE(-1 != nFormatKey, "OFormLayerXMLImport_Impl::applyControlNumberStyle: could not obtain a format key!");
+
+ // set the format on the control model
+ _rxControlModel->setPropertyValue(PROPERTY_FORMATKEY, makeAny(nFormatKey));
+ }
+ }
+ catch(const Exception&)
+ {
+ OSL_FAIL("OFormLayerXMLImport_Impl::applyControlNumberStyle: couldn't set the format!");
+ }
+ }
+ else
+ OSL_FAIL("OFormLayerXMLImport_Impl::applyControlNumberStyle: did not find the style with the given name!");
+ }
+}
+
+//---------------------------------------------------------------------
+void OFormLayerXMLImport_Impl::registerCellValueBinding( const Reference< XPropertySet >& _rxControlModel, const ::rtl::OUString& _rCellAddress )
+{
+ OSL_ENSURE( _rxControlModel.is() && _rCellAddress.getLength(),
+ "OFormLayerXMLImport_Impl::registerCellValueBinding: invalid arguments!" );
+ m_aCellValueBindings.push_back( ModelStringPair( _rxControlModel, _rCellAddress ) );
+}
+
+//---------------------------------------------------------------------
+void OFormLayerXMLImport_Impl::registerXFormsValueBinding(
+ const Reference< XPropertySet >& _rxControlModel,
+ const ::rtl::OUString& _rBindingID )
+{
+ // TODO: is an empty binding name allowed?
+ OSL_ENSURE( _rxControlModel.is(), "need model" );
+
+ m_aXFormsValueBindings.push_back(
+ ModelStringPair( _rxControlModel, _rBindingID ) );
+}
+
+//---------------------------------------------------------------------
+void OFormLayerXMLImport_Impl::registerXFormsListBinding(
+ const Reference< XPropertySet >& _rxControlModel,
+ const ::rtl::OUString& _rBindingID )
+{
+ // TODO: is an empty binding name allowed?
+ OSL_ENSURE( _rxControlModel.is(), "need model" );
+
+ m_aXFormsListBindings.push_back(
+ ModelStringPair( _rxControlModel, _rBindingID ) );
+}
+
+//---------------------------------------------------------------------
+void OFormLayerXMLImport_Impl::registerXFormsSubmission(
+ const Reference< XPropertySet >& _rxControlModel,
+ const ::rtl::OUString& _rSubmissionID )
+{
+ // TODO: is an empty binding name allowed?
+ OSL_ENSURE( _rxControlModel.is(), "need model" );
+
+ m_aXFormsSubmissions.push_back(
+ ModelStringPair( _rxControlModel, _rSubmissionID ) );
+}
+
+//---------------------------------------------------------------------
+void OFormLayerXMLImport_Impl::registerCellRangeListSource( const Reference< XPropertySet >& _rxControlModel, const ::rtl::OUString& _rCellRangeAddress )
+{
+ OSL_ENSURE( _rxControlModel.is() && _rCellRangeAddress.getLength(),
+ "OFormLayerXMLImport_Impl::registerCellRangeListSource: invalid arguments!" );
+ m_aCellRangeListSources.push_back( ModelStringPair( _rxControlModel, _rCellRangeAddress ) );
+}
+//---------------------------------------------------------------------
+const SvXMLStyleContext* OFormLayerXMLImport_Impl::getStyleElement(const ::rtl::OUString& _rStyleName) const
+{
+ OSL_ENSURE( m_pAutoStyles, "OFormLayerXMLImport_Impl::getStyleElement: have no auto style context!" );
+ // did you use setAutoStyleContext?
+
+ const SvXMLStyleContext* pControlStyle =
+ m_pAutoStyles ? m_pAutoStyles->FindStyleChildContext( XML_STYLE_FAMILY_TEXT_PARAGRAPH, _rStyleName ) : NULL;
+ OSL_ENSURE( pControlStyle || !m_pAutoStyles,
+ ::rtl::OString( "OFormLayerXMLImport_Impl::getStyleElement: did not find the style named \"" )
+ += ::rtl::OString( _rStyleName.getStr(), _rStyleName.getLength(), RTL_TEXTENCODING_ASCII_US )
+ += ::rtl::OString( "\"!" ) );
+ return pControlStyle;
+}
+
+//---------------------------------------------------------------------
+void OFormLayerXMLImport_Impl::enterEventContext()
+{
+ // install our own translation table. We need to disable the other tables because of name conflicts.
+ m_rImporter.GetEventImport().PushTranslationTable();
+ m_rImporter.GetEventImport().AddTranslationTable(g_pFormsEventTranslation);
+}
+
+//---------------------------------------------------------------------
+void OFormLayerXMLImport_Impl::leaveEventContext()
+{
+ // install the original event tables.
+ m_rImporter.GetEventImport().PopTranslationTable();
+}
+
+//---------------------------------------------------------------------
+void OFormLayerXMLImport_Impl::registerControlId(const Reference< XPropertySet >& _rxControl, const ::rtl::OUString& _rId)
+{
+ OSL_ENSURE(m_aCurrentPageIds != m_aControlIds.end(), "OFormLayerXMLImport_Impl::registerControlId: no current page!");
+ OSL_ENSURE(_rId.getLength(), "OFormLayerXMLImport_Impl::registerControlId: invalid (empty) control id!");
+
+ OSL_ENSURE(m_aCurrentPageIds->second.end() == m_aCurrentPageIds->second.find(_rId), "OFormLayerXMLImport_Impl::registerControlId: control id already used!");
+ m_aCurrentPageIds->second[_rId] = _rxControl;
+}
+
+//---------------------------------------------------------------------
+void OFormLayerXMLImport_Impl::registerControlReferences(const Reference< XPropertySet >& _rxControl, const ::rtl::OUString& _rReferringControls)
+{
+ OSL_ENSURE(_rReferringControls.getLength(), "OFormLayerXMLImport_Impl::registerControlReferences: invalid (empty) control id list!");
+ OSL_ENSURE(_rxControl.is(), "OFormLayerXMLImport_Impl::registerControlReferences: invalid (NULL) control!");
+ m_aControlReferences.push_back( ModelStringPair( _rxControl, _rReferringControls ) );
+}
+
+//---------------------------------------------------------------------
+void OFormLayerXMLImport_Impl::startPage(const Reference< XDrawPage >& _rxDrawPage)
+{
+ m_xCurrentPageFormsSupp.clear();
+
+ OSL_ENSURE(_rxDrawPage.is(), "OFormLayerXMLImport_Impl::startPage: NULL page!");
+ m_xCurrentPageFormsSupp = m_xCurrentPageFormsSupp.query( _rxDrawPage );
+ OSL_ENSURE( m_xCurrentPageFormsSupp.is(), "OFormLayerXMLImport_Impl::startPage: invalid draw page (no XFormsSupplier)!" );
+ if ( !m_xCurrentPageFormsSupp.is() )
+ return;
+
+ // add a new entry to our page map
+ ::std::pair< MapDrawPage2MapIterator, bool > aPagePosition;
+ aPagePosition =
+ m_aControlIds.insert(MapDrawPage2Map::value_type(_rxDrawPage, MapString2PropertySet()));
+ OSL_ENSURE(aPagePosition.second, "OFormLayerXMLImport_Impl::startPage: already imported this page!");
+ m_aCurrentPageIds = aPagePosition.first;
+}
+
+//---------------------------------------------------------------------
+void OFormLayerXMLImport_Impl::endPage()
+{
+ OSL_ENSURE( m_xCurrentPageFormsSupp.is(), "OFormLayerXMLImport_Impl::endPage: sure you called startPage before?" );
+
+ // do some knittings for the controls which are referring to each other
+ try
+ {
+ static const sal_Unicode s_nSeparator = ',';
+ ::rtl::OUString sReferring;
+ ::rtl::OUString sCurrentReferring;
+ ::rtl::OUString sSeparator(&s_nSeparator, 1);
+ Reference< XPropertySet > xCurrentReferring;
+ sal_Int32 nSeparator, nPrevSep;
+ ::std::vector< ModelStringPair >::const_iterator aEnd = m_aControlReferences.end();
+ for ( ::std::vector< ModelStringPair >::const_iterator aReferences = m_aControlReferences.begin();
+ aReferences != aEnd;
+ ++aReferences
+ )
+ {
+ // the list of control ids is comma separated
+
+ // in a list of n ids there are only n-1 separators ... have to catch this last id
+ // -> normalize the list
+ sReferring = aReferences->second;
+ sReferring += sSeparator;
+
+ nPrevSep = -1;
+ while (-1 != (nSeparator = sReferring.indexOf(s_nSeparator, nPrevSep + 1)))
+ {
+ sCurrentReferring = sReferring.copy(nPrevSep + 1, nSeparator - nPrevSep - 1);
+ xCurrentReferring = lookupControlId(sCurrentReferring);
+ if (xCurrentReferring.is())
+ // if this condition fails, this is an error, but lookupControlId should have asserted this ...
+ xCurrentReferring->setPropertyValue( PROPERTY_CONTROLLABEL, makeAny( aReferences->first ) );
+
+ nPrevSep = nSeparator;
+ }
+ }
+ }
+ catch(Exception&)
+ {
+ OSL_FAIL("OFormLayerXMLImport_Impl::endPage: unable to knit the control references (caught an exception)!");
+ }
+
+ // now that we have all children of the forms collection, attach the events
+ Reference< XIndexAccess > xIndexContainer;
+ if ( m_xCurrentPageFormsSupp.is() && m_xCurrentPageFormsSupp->hasForms() )
+ xIndexContainer = xIndexContainer.query( m_xCurrentPageFormsSupp->getForms() );
+ if ( xIndexContainer.is() )
+ ODefaultEventAttacherManager::setEvents( xIndexContainer );
+
+ // clear the structures for the control references.
+ m_aControlReferences.clear();
+
+ // and no we have no current page anymore
+ m_aCurrentPageIds = m_aControlIds.end();
+}
+
+//---------------------------------------------------------------------
+Reference< XPropertySet > OFormLayerXMLImport_Impl::lookupControlId(const ::rtl::OUString& _rControlId)
+{
+ OSL_ENSURE(m_aCurrentPageIds != m_aControlIds.end(), "OFormLayerXMLImport_Impl::lookupControlId: no current page!");
+ Reference< XPropertySet > xReturn;
+ if (m_aCurrentPageIds != m_aControlIds.end())
+ {
+ ConstMapString2PropertySetIterator aPos = m_aCurrentPageIds->second.find(_rControlId);
+ if (m_aCurrentPageIds->second.end() != aPos)
+ xReturn = aPos->second;
+ else
+ OSL_FAIL("OFormLayerXMLImport_Impl::lookupControlId: invalid control id (did not find it)!");
+ }
+ return xReturn;
+}
+
+//---------------------------------------------------------------------
+SvXMLImportContext* OFormLayerXMLImport_Impl::createOfficeFormsContext(
+ SvXMLImport& _rImport,
+ sal_uInt16 _nPrefix,
+ const rtl::OUString& _rLocalName)
+{
+ return new OFormsRootImport( _rImport, _nPrefix, _rLocalName );
+}
+
+//---------------------------------------------------------------------
+SvXMLImportContext* OFormLayerXMLImport_Impl::createContext(const sal_uInt16 _nPrefix, const rtl::OUString& _rLocalName,
+ const Reference< sax::XAttributeList >&)
+{
+ SvXMLImportContext* pContext = NULL;
+ if ( 0 == _rLocalName.compareToAscii( "form" ) )
+ {
+ if ( m_xCurrentPageFormsSupp.is() )
+ pContext = new OFormImport(*this, *this, _nPrefix, _rLocalName, m_xCurrentPageFormsSupp->getForms() );
+ }
+ else if ( ( _nPrefix == XML_NAMESPACE_XFORMS
+ && ( xmloff::token::IsXMLToken( _rLocalName, xmloff::token::XML_MODEL ) ) )
+ )
+ {
+ pContext = createXFormsModelContext( m_rImporter, _nPrefix, _rLocalName );
+ }
+
+ if ( !pContext )
+ {
+ OSL_FAIL( "unknown element" );
+ pContext =
+ new SvXMLImportContext(m_rImporter, _nPrefix, _rLocalName);
+ }
+
+ return pContext;
+}
+
+//---------------------------------------------------------------------
+void OFormLayerXMLImport_Impl::seekPage(const Reference< XDrawPage >& _rxDrawPage)
+{
+ OSL_ENSURE(m_aCurrentPageIds == m_aControlIds.end(), "OFormLayerXMLImport_Impl::seekPage: importing another page currently! This will smash your import!");
+ m_aCurrentPageIds = m_aControlIds.find(_rxDrawPage);
+ OSL_ENSURE(m_aCurrentPageIds != m_aControlIds.end(), "OFormLayerXMLImport_Impl::seekPage: did not find the given page (perhaps it has not been imported, yet?)!");
+}
+
+//---------------------------------------------------------------------
+void OFormLayerXMLImport_Impl::documentDone( )
+{
+ SvXMLImport& rImport = getGlobalContext();
+ if ( ( rImport.getImportFlags() & IMPORT_CONTENT ) == 0 )
+ return;
+
+ // create (and bind) the spreadsheet cell bindings
+ if ( !m_aCellValueBindings.empty()
+ && FormCellBindingHelper::isCellBindingAllowed( rImport.GetModel() )
+ )
+ {
+ static ::rtl::OUString s_sIndex( RTL_CONSTASCII_USTRINGPARAM( ":index" ) );
+ ::std::vector< ModelStringPair >::const_iterator aEnd = m_aCellValueBindings.end();
+ for ( ::std::vector< ModelStringPair >::const_iterator aCellBindings = m_aCellValueBindings.begin();
+ aCellBindings != aEnd;
+ ++aCellBindings
+ )
+ {
+ try
+ {
+ FormCellBindingHelper aHelper( aCellBindings->first, rImport.GetModel() );
+ OSL_ENSURE( aHelper.isCellBindingAllowed(), "OFormLayerXMLImport_Impl::documentDone: can't bind this control model!" );
+ if ( aHelper.isCellBindingAllowed() )
+ {
+ // There are special bindings for listboxes. See
+ // OListAndComboImport::doRegisterCellValueBinding for a comment on this HACK.
+ ::rtl::OUString sBoundCellAddress( aCellBindings->second );
+ sal_Int32 nIndicator = sBoundCellAddress.lastIndexOf( s_sIndex );
+
+ bool bUseIndexBinding = false;
+ if ( nIndicator != -1 )
+ {
+ sBoundCellAddress = sBoundCellAddress.copy( 0, nIndicator );
+ bUseIndexBinding = true;
+ }
+
+ aHelper.setBinding( aHelper.createCellBindingFromStringAddress( sBoundCellAddress, bUseIndexBinding ) );
+ }
+ }
+ catch( const Exception& )
+ {
+ OSL_FAIL( "OFormLayerXMLImport_Impl::documentDone: caught an exception while binding to a cell!" );
+ }
+ }
+ m_aCellValueBindings.clear();
+ }
+
+ // the same for the spreadsheet cell range list sources
+ if ( !m_aCellRangeListSources.empty()
+ && FormCellBindingHelper::isListCellRangeAllowed( rImport.GetModel() )
+ )
+ {
+ for ( ::std::vector< ModelStringPair >::const_iterator aRangeBindings = m_aCellRangeListSources.begin();
+ aRangeBindings != m_aCellRangeListSources.end();
+ ++aRangeBindings
+ )
+ {
+ try
+ {
+ FormCellBindingHelper aHelper( aRangeBindings->first, rImport.GetModel() );
+ OSL_ENSURE( aHelper.isListCellRangeAllowed(), "OFormLayerXMLImport_Impl::documentDone: can't bind this control model!" );
+ if ( aHelper.isListCellRangeAllowed() )
+ {
+ aHelper.setListSource( aHelper.createCellListSourceFromStringAddress( aRangeBindings->second ) );
+ }
+ }
+ catch( const Exception& )
+ {
+ OSL_FAIL( "OFormLayerXMLImport_Impl::documentDone: caught an exception while binding to a cell range!" );
+ }
+ }
+ m_aCellRangeListSources.clear();
+ }
+
+ // process XForms-bindings; call registerXFormsValueBinding for each
+ std::for_each( m_aXFormsValueBindings.begin(),
+ m_aXFormsValueBindings.end(),
+ bind1st( ptr_fun( bindXFormsValueBinding ),
+ rImport.GetModel() ) );
+ // same for list bindings
+ std::for_each( m_aXFormsListBindings.begin(),
+ m_aXFormsListBindings.end(),
+ bind1st( ptr_fun( bindXFormsListBinding ),
+ rImport.GetModel() ) );
+ // same for submissions
+ std::for_each( m_aXFormsSubmissions.begin(),
+ m_aXFormsSubmissions.end(),
+ bind1st( ptr_fun( bindXFormsSubmission ),
+ rImport.GetModel() ) );
+}
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/layerimport.hxx b/xmloff/source/forms/layerimport.hxx
new file mode 100644
index 000000000000..34cbbe6d1b6c
--- /dev/null
+++ b/xmloff/source/forms/layerimport.hxx
@@ -0,0 +1,200 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_FORMS_LAYERIMPORT_HXX_
+#define _XMLOFF_FORMS_LAYERIMPORT_HXX_
+
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/form/XFormsSupplier2.hpp>
+#include <rtl/ref.hxx>
+#include "formattributes.hxx"
+#include "callbacks.hxx"
+#include "eventimport.hxx"
+#include <tools/ref.hxx>
+
+class SvXMLImport;
+class SvXMLImportContext;
+class XMLPropertyHandlerFactory;
+class SvXMLImportPropertyMapper;
+class XMLPropStyleContext;
+
+SV_DECL_REF( SvXMLStylesContext )
+ // unfortunately, we can't put this into our namespace, as the macro expands to (amongst others) a forward
+ // declaration of the class name, which then would be in the namespace, too
+
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ class OAttribute2Property;
+
+ //=====================================================================
+ //= OFormLayerXMLImport_Impl
+ //=====================================================================
+ class OFormLayerXMLImport_Impl
+ : public ODefaultEventAttacherManager
+ {
+ friend class OFormLayerXMLImport;
+
+ protected:
+ SvXMLImport& m_rImporter;
+ OAttribute2Property m_aAttributeMetaData;
+
+ /// the supplier for the forms of the currently imported page
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormsSupplier2 >
+ m_xCurrentPageFormsSupp;
+ SvXMLStylesContext* m_pAutoStyles;
+
+ protected:
+ DECLARE_STL_USTRINGACCESS_MAP( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >, MapString2PropertySet );
+ DECLARE_STL_MAP( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >, MapString2PropertySet, ODrawPageCompare, MapDrawPage2Map);
+
+ MapDrawPage2Map m_aControlIds; // ids of the controls on all known page
+ MapDrawPage2MapIterator m_aCurrentPageIds; // ifs of the controls on the current page
+
+ typedef ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >, ::rtl::OUString >
+ ModelStringPair;
+ ::std::vector< ModelStringPair >
+ m_aControlReferences; // control reference descriptions for current page
+ ::std::vector< ModelStringPair >
+ m_aCellValueBindings; // information about controls bound to spreadsheet cells
+ ::std::vector< ModelStringPair >
+ m_aCellRangeListSources;// information about controls bound to spreadsheet cell range list sources
+
+ ::std::vector< ModelStringPair >
+ m_aXFormsValueBindings; // collect xforms:bind attributes to be resolved
+
+ ::std::vector< ModelStringPair >
+ m_aXFormsListBindings; // collect forms:xforms-list-source attributes to be resolved
+
+ ::std::vector< ModelStringPair >
+ m_aXFormsSubmissions; // collect xforms:submission attributes to be resolved
+
+ public:
+ // IControlIdMap
+ void registerControlId(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControl,
+ const ::rtl::OUString& _rId);
+ void registerControlReferences(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControl,
+ const ::rtl::OUString& _rReferringControls);
+
+ // OFormLayerXMLImport_Impl
+ inline OAttribute2Property& getAttributeMap() { return m_aAttributeMetaData; }
+ inline SvXMLImport& getGlobalContext() { return m_rImporter; }
+ const SvXMLStyleContext* getStyleElement(const ::rtl::OUString& _rStyleName) const;
+ void enterEventContext();
+ void leaveEventContext();
+ void applyControlNumberStyle(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel,
+ const ::rtl::OUString& _rControlNumerStyleName
+ );
+ void registerCellValueBinding(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel,
+ const ::rtl::OUString& _rCellAddress
+ );
+
+ void registerCellRangeListSource(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel,
+ const ::rtl::OUString& _rCellRangeAddress
+ );
+
+ void registerXFormsValueBinding(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel,
+ const ::rtl::OUString& _rBindingID
+ );
+
+ void registerXFormsListBinding(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel,
+ const ::rtl::OUString& _rBindingID
+ );
+
+ void registerXFormsSubmission(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel,
+ const ::rtl::OUString& _rSubmissionID
+ );
+
+ protected:
+ OFormLayerXMLImport_Impl(SvXMLImport& _rImporter);
+ virtual ~OFormLayerXMLImport_Impl();
+
+ /** start importing the forms of the given page
+ */
+ void startPage(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& _rxDrawPage);
+
+ /** end importing the forms of the current page
+ */
+ void endPage();
+
+ /** creates an import context for the office:forms element
+ */
+ SvXMLImportContext* createOfficeFormsContext(
+ SvXMLImport& _rImport,
+ sal_uInt16 _nPrefix,
+ const rtl::OUString& _rLocalName);
+
+ /** create an <type>SvXMLImportContext</type> instance which is able to import the &lt;form:form&gt;
+ element.
+ */
+ SvXMLImportContext* createContext(
+ const sal_uInt16 _nPrefix,
+ const rtl::OUString& _rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttribs);
+
+ /** get the control with the given id
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ lookupControlId(const ::rtl::OUString& _rControlId);
+
+ /** seek to the given page
+ */
+ void seekPage(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& _rxDrawPage);
+
+ /** announces the auto-style context to the form importer
+ */
+ void setAutoStyleContext(SvXMLStylesContext* _pNewContext);
+
+ /** to be called when the document has been completely imported
+
+ <p>For some documents (currently: only some spreadsheet documents) it's necessary
+ do to a post processing, since not all information from the file can be processed
+ if the document is not completed, yet.</p>
+ */
+ void documentDone( );
+ };
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+#endif // _XMLOFF_FORMS_LAYERIMPORT_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/logging.cxx b/xmloff/source/forms/logging.cxx
new file mode 100644
index 000000000000..00ae8fe18f0e
--- /dev/null
+++ b/xmloff/source/forms/logging.cxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "logging.hxx"
+#include <rtl/logfile.hxx>
+
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+#ifdef TIMELOG
+ //=====================================================================
+ //= OStackedLogging
+ //=====================================================================
+ //---------------------------------------------------------------------
+ void OStackedLogging::enterContext( const sal_Char* _pContextName )
+ {
+ m_aLogger.push( new ::rtl::Logfile( _pContextName ) );
+ }
+
+ //---------------------------------------------------------------------
+ void OStackedLogging::leaveTopContext( )
+ {
+ delete m_aLogger.top();
+ m_aLogger.pop();
+ }
+#endif
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/logging.hxx b/xmloff/source/forms/logging.hxx
new file mode 100644
index 000000000000..9f355358fc91
--- /dev/null
+++ b/xmloff/source/forms/logging.hxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 XMLOFF_FORMS_LOGGING_HXX
+#define XMLOFF_FORMS_LOGGING_HXX
+
+#include <sal/types.h>
+#include <stack>
+
+namespace rtl { class Logfile; }
+
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+#ifdef TIMELOG
+
+ //=====================================================================
+ //= OStackedLogging
+ //=====================================================================
+ class OStackedLogging
+ {
+ private:
+ ::std::stack< ::rtl::Logfile* > m_aLogger;
+
+ protected:
+ OStackedLogging() { }
+
+ protected:
+ void enterContext( const sal_Char* _pContextName );
+ void leaveTopContext( );
+ };
+
+#define ENTER_LOG_CONTEXT( name ) enterContext( name )
+#define LEAVE_LOG_CONTEXT( ) leaveTopContext( )
+
+#else
+ struct OStackedLogging { };
+
+#define ENTER_LOG_CONTEXT( name )
+#define LEAVE_LOG_CONTEXT( )
+
+#endif
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+#endif // XMLOFF_FORMS_LOGGING_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/officeforms.cxx b/xmloff/source/forms/officeforms.cxx
new file mode 100644
index 000000000000..614ca54796bd
--- /dev/null
+++ b/xmloff/source/forms/officeforms.cxx
@@ -0,0 +1,195 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "officeforms.hxx"
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <comphelper/extract.hxx>
+#include "strings.hxx"
+#include <rtl/logfile.hxx>
+
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::beans;
+ using namespace ::com::sun::star::frame;
+ using namespace ::com::sun::star::xml;
+ using ::xmloff::token::XML_FORMS;
+
+ //=========================================================================
+ //= OFormsRootImport
+ //=========================================================================
+ TYPEINIT1(OFormsRootImport, SvXMLImportContext);
+ //-------------------------------------------------------------------------
+ OFormsRootImport::OFormsRootImport( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLocalName )
+ :SvXMLImportContext(rImport, nPrfx, rLocalName)
+ {
+ }
+
+ //-------------------------------------------------------------------------
+ OFormsRootImport::~OFormsRootImport()
+ {
+ }
+
+ //-------------------------------------------------------------------------
+ SvXMLImportContext* OFormsRootImport::CreateChildContext( sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
+ const Reference< sax::XAttributeList>& xAttrList )
+ {
+ return GetImport().GetFormImport()->createContext( _nPrefix, _rLocalName, xAttrList );
+ }
+
+ //-------------------------------------------------------------------------
+ void OFormsRootImport::implImportBool(const Reference< sax::XAttributeList >& _rxAttributes, OfficeFormsAttributes _eAttribute,
+ const Reference< XPropertySet >& _rxProps, const Reference< XPropertySetInfo >& _rxPropInfo,
+ const ::rtl::OUString& _rPropName, sal_Bool _bDefault)
+ {
+ // the complete attribute name to look for
+ ::rtl::OUString sCompleteAttributeName = GetImport().GetNamespaceMap().GetQNameByIndex(
+ OAttributeMetaData::getOfficeFormsAttributeNamespace(_eAttribute),
+ ::rtl::OUString::createFromAscii(OAttributeMetaData::getOfficeFormsAttributeName(_eAttribute)));
+
+ // get and convert the value
+ ::rtl::OUString sAttributeValue = _rxAttributes->getValueByName(sCompleteAttributeName);
+ bool bValue = _bDefault;
+ GetImport().GetMM100UnitConverter().convertBool(bValue, sAttributeValue);
+
+ // set the property
+ if (_rxPropInfo->hasPropertyByName(_rPropName))
+ _rxProps->setPropertyValue(_rPropName, ::cppu::bool2any(bValue));
+ }
+
+ //-------------------------------------------------------------------------
+ void OFormsRootImport::StartElement( const Reference< sax::XAttributeList >& _rxAttrList )
+ {
+ ENTER_LOG_CONTEXT( "xmloff::OFormsRootImport - importing the complete tree" );
+ SvXMLImportContext::StartElement( _rxAttrList );
+
+ try
+ {
+ Reference< XPropertySet > xDocProperties(GetImport().GetModel(), UNO_QUERY);
+ if ( xDocProperties.is() )
+ { // an empty model is allowed: when doing a copy'n'paste from e.g. Writer to Calc,
+ // this is done via streaming the controls as XML.
+ Reference< XPropertySetInfo > xDocPropInfo;
+ if (xDocProperties.is())
+ xDocPropInfo = xDocProperties->getPropertySetInfo();
+
+ implImportBool(_rxAttrList, ofaAutomaticFocus, xDocProperties, xDocPropInfo, PROPERTY_AUTOCONTROLFOCUS, sal_False);
+ implImportBool(_rxAttrList, ofaApplyDesignMode, xDocProperties, xDocPropInfo, PROPERTY_APPLYDESIGNMODE, sal_True);
+ }
+ }
+ catch(Exception&)
+ {
+ OSL_FAIL("OFormsRootImport::StartElement: caught an exception while setting the document properties!");
+ }
+ }
+
+ //-------------------------------------------------------------------------
+ void OFormsRootImport::EndElement()
+ {
+ SvXMLImportContext::EndElement();
+ LEAVE_LOG_CONTEXT( );
+ }
+
+ //=====================================================================
+ //= OFormsRootExport
+ //=====================================================================
+ //---------------------------------------------------------------------
+ OFormsRootExport::OFormsRootExport( SvXMLExport& _rExp )
+ :m_pImplElement(NULL)
+ {
+ addModelAttributes(_rExp);
+
+ m_pImplElement = new SvXMLElementExport(_rExp, XML_NAMESPACE_OFFICE, XML_FORMS, sal_True, sal_True);
+ }
+
+ //---------------------------------------------------------------------
+ OFormsRootExport::~OFormsRootExport( )
+ {
+ delete m_pImplElement;
+ }
+
+ //-------------------------------------------------------------------------
+ void OFormsRootExport::implExportBool(SvXMLExport& _rExp, OfficeFormsAttributes _eAttribute,
+ const Reference< XPropertySet >& _rxProps, const Reference< XPropertySetInfo >& _rxPropInfo,
+ const ::rtl::OUString& _rPropName, sal_Bool _bDefault)
+ {
+ // retrieve the property value
+ sal_Bool bValue = _bDefault;
+ if (_rxPropInfo->hasPropertyByName(_rPropName))
+ bValue = ::cppu::any2bool(_rxProps->getPropertyValue(_rPropName));
+
+ // convert into a string
+ ::rtl::OUStringBuffer aValue;
+ _rExp.GetMM100UnitConverter().convertBool(aValue, bValue);
+
+ // add the attribute
+ _rExp.AddAttribute(
+ OAttributeMetaData::getOfficeFormsAttributeNamespace(_eAttribute),
+ OAttributeMetaData::getOfficeFormsAttributeName(_eAttribute),
+ aValue.makeStringAndClear());
+ }
+
+ //-------------------------------------------------------------------------
+ void OFormsRootExport::addModelAttributes(SvXMLExport& _rExp) SAL_THROW(())
+ {
+ try
+ {
+ Reference< XPropertySet > xDocProperties(_rExp.GetModel(), UNO_QUERY);
+ if ( xDocProperties.is() )
+ { // an empty model is allowed: when doing a copy'n'paste from e.g. Writer to Calc,
+ // this is done via streaming the controls as XML.
+ Reference< XPropertySetInfo > xDocPropInfo;
+ if (xDocProperties.is())
+ xDocPropInfo = xDocProperties->getPropertySetInfo();
+
+ implExportBool(_rExp, ofaAutomaticFocus, xDocProperties, xDocPropInfo, PROPERTY_AUTOCONTROLFOCUS, sal_False);
+ implExportBool(_rExp, ofaApplyDesignMode, xDocProperties, xDocPropInfo, PROPERTY_APPLYDESIGNMODE, sal_True);
+ }
+ }
+ catch(Exception&)
+ {
+ OSL_FAIL("OFormsRootExport::addModelAttributes: caught an exception while retrieving the document properties!");
+ }
+ }
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/officeforms.hxx b/xmloff/source/forms/officeforms.hxx
new file mode 100644
index 000000000000..59473641f964
--- /dev/null
+++ b/xmloff/source/forms/officeforms.hxx
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_FORMS_OFFICEFORMS_HXX_
+#define _XMLOFF_FORMS_OFFICEFORMS_HXX_
+
+#include "formattributes.hxx"
+#include <xmloff/xmlictxt.hxx>
+#include "logging.hxx"
+
+class SvXMLElementExport;
+class SvXMLExport;
+
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ //=====================================================================
+ //= OFormsRootImport
+ //=====================================================================
+ class OFormsRootImport
+ :public SvXMLImportContext
+ ,public OStackedLogging
+ {
+ public:
+ TYPEINFO();
+
+ OFormsRootImport( SvXMLImport& _rImport, sal_uInt16 _nPrfx, const rtl::OUString& _rLocalName);
+ virtual ~OFormsRootImport();
+
+ // SvXMLImportContext overriabled
+ virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList );
+ virtual void EndElement();
+
+ protected:
+ void implImportBool(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttributes,
+ OfficeFormsAttributes _eAttribute,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxProps,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >& _rxPropInfo,
+ const ::rtl::OUString& _rPropName,
+ sal_Bool _bDefault
+ );
+ };
+
+ //=====================================================================
+ //= OFormsRootExport
+ //=====================================================================
+ class OFormsRootExport
+ {
+ private:
+ SvXMLElementExport* m_pImplElement;
+
+ public:
+ OFormsRootExport( SvXMLExport& _rExp );
+ ~OFormsRootExport();
+
+ private:
+ void addModelAttributes(SvXMLExport& _rExp) SAL_THROW(());
+
+ void implExportBool(
+ SvXMLExport& _rExp,
+ OfficeFormsAttributes _eAttribute,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxProps,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >& _rxPropInfo,
+ const ::rtl::OUString& _rPropName,
+ sal_Bool _bDefault
+ );
+ };
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+#endif // _XMLOFF_FORMS_OFFICEFORMS_HXX_
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/property_description.hxx b/xmloff/source/forms/property_description.hxx
new file mode 100644
index 000000000000..4edab2e649f7
--- /dev/null
+++ b/xmloff/source/forms/property_description.hxx
@@ -0,0 +1,140 @@
+/*************************************************************************
+ * 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 XMLOFF_PROPERTY_DESCRIPTION_HXX
+#define XMLOFF_PROPERTY_DESCRIPTION_HXX
+
+#include "forms/property_handler.hxx"
+#include "property_group.hxx"
+
+#include "xmloff/xmltoken.hxx"
+
+#include <vector>
+#include <list>
+
+//......................................................................................................................
+namespace xmloff
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= PropertyDescription
+ //==================================================================================================================
+ struct AttributeDescription
+ {
+ sal_uInt16 namespacePrefix; // usually XML_NAMESPACE_FORM
+ ::xmloff::token::XMLTokenEnum attributeToken;
+
+ AttributeDescription()
+ :namespacePrefix( 0 )
+ ,attributeToken( ::xmloff::token::XML_TOKEN_INVALID )
+ {
+ }
+
+ AttributeDescription(
+ const sal_uInt16 i_namespacePrefix,
+ const ::xmloff::token::XMLTokenEnum i_attributeToken
+ )
+ :namespacePrefix( i_namespacePrefix )
+ ,attributeToken( i_attributeToken )
+ {
+ }
+ };
+
+ //..................................................................................................................
+ inline bool operator==( const AttributeDescription& i_lhs, const AttributeDescription& i_rhs )
+ {
+ return ( i_lhs.namespacePrefix == i_rhs.namespacePrefix )
+ && ( i_lhs.attributeToken == i_rhs.attributeToken );
+ }
+
+ //==================================================================================================================
+ //= PropertyDescription
+ //==================================================================================================================
+ struct PropertyDescription
+ {
+ /// is the name of the property
+ const ::rtl::OUString propertyName;
+ /** denotes the attribute which represents the property. Note that multiple properties might comprise a single
+ attribute value.
+ */
+ const AttributeDescription attribute;
+ /// is the factory for creating a handler for reading and writing the property
+ const PropertyHandlerFactory factory;
+ /// the unique ID of the property. The property meta data table must not contain two entries with the same property ID
+ const PropertyId propertyId;
+ /** the group which the property belongs to. Multiple properties belonging to the same group will, all together,
+ define the attribute value to be written into the ODF file.
+
+ Consequently, properties which have the same |propertyGroup| value must also have the same |attribute|
+ and the same |factory| value, with the only exception being NO_GROUP properties.
+
+ Note that the other direction is not given: It is perfectly legitimate to map the same attribute to different
+ (disjunct) property groups.
+ */
+ const PropertyGroup propertyGroup;
+
+ PropertyDescription()
+ :propertyName()
+ ,attribute()
+ ,factory( NULL )
+ ,propertyId( PID_INVALID )
+ ,propertyGroup( NO_GROUP )
+ {
+ }
+
+ PropertyDescription(
+ const ::rtl::OUString& i_propertyName,
+ const sal_uInt16 i_namespacePrefix,
+ const ::xmloff::token::XMLTokenEnum i_attributeToken,
+ const PropertyHandlerFactory i_factory,
+ const PropertyId i_propertyId,
+ const PropertyGroup i_propertyGroup
+ )
+ :propertyName( i_propertyName )
+ ,attribute( i_namespacePrefix, i_attributeToken )
+ ,factory( i_factory )
+ ,propertyId( i_propertyId )
+ ,propertyGroup( i_propertyGroup )
+ {
+ }
+ };
+
+ //==================================================================================================================
+ //= PropertyDescriptionList
+ //==================================================================================================================
+ typedef ::std::vector< const PropertyDescription* > PropertyDescriptionList;
+
+ //==================================================================================================================
+ //= PropertyGroups
+ //==================================================================================================================
+ typedef ::std::list< PropertyDescriptionList > PropertyGroups;
+
+//......................................................................................................................
+} // namespace xmloff
+//......................................................................................................................
+
+#endif // XMLOFF_PROPERTY_DESCRIPTION_HXX
diff --git a/xmloff/source/forms/property_group.hxx b/xmloff/source/forms/property_group.hxx
new file mode 100644
index 000000000000..bca354f14e92
--- /dev/null
+++ b/xmloff/source/forms/property_group.hxx
@@ -0,0 +1,47 @@
+/*************************************************************************
+ * 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 XMLOFF_PROPERTY_GROUP_HXX
+#define XMLOFF_PROPERTY_GROUP_HXX
+
+//......................................................................................................................
+namespace xmloff
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= PropertyGroup
+ //==================================================================================================================
+ enum PropertyGroup
+ {
+ NO_GROUP
+ };
+
+//......................................................................................................................
+} // namespace xmloff
+//......................................................................................................................
+
+#endif // XMLOFF_PROPERTY_GROUP_HXX
diff --git a/xmloff/source/forms/property_meta_data.cxx b/xmloff/source/forms/property_meta_data.cxx
new file mode 100644
index 000000000000..442ad50b00bb
--- /dev/null
+++ b/xmloff/source/forms/property_meta_data.cxx
@@ -0,0 +1,270 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_xmloff.hxx"
+
+#include "property_description.hxx"
+#include "forms/form_handler_factory.hxx"
+#include "strings.hxx"
+#include "xmloff/xmltoken.hxx"
+#include "xmloff/xmlnmspe.hxx"
+
+#include <tools/diagnose_ex.h>
+#include <tools/debug.hxx>
+
+#include <boost/unordered_map.hpp>
+
+//......................................................................................................................
+namespace xmloff { namespace metadata
+{
+//......................................................................................................................
+
+ using namespace ::xmloff::token;
+
+#define FORM_SINGLE_PROPERTY( id, att ) \
+ PropertyDescription( PROPERTY_##id, XML_NAMESPACE_FORM, att, &FormHandlerFactory::getFormPropertyHandler, PID_##id, NO_GROUP )
+
+ //==================================================================================================================
+ //= property meta data
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ namespace
+ {
+ const PropertyDescription* lcl_getPropertyMetaData()
+ {
+ static const PropertyDescription s_propertyMetaData[] =
+ {
+ FORM_SINGLE_PROPERTY( DATE_MIN, XML_MIN_VALUE ),
+ FORM_SINGLE_PROPERTY( DATE_MAX, XML_MAX_VALUE ),
+ FORM_SINGLE_PROPERTY( DEFAULT_DATE, XML_VALUE ),
+ FORM_SINGLE_PROPERTY( DATE, XML_CURRENT_VALUE ),
+ FORM_SINGLE_PROPERTY( TIME_MIN, XML_MIN_VALUE ),
+ FORM_SINGLE_PROPERTY( TIME_MAX, XML_MAX_VALUE ),
+ FORM_SINGLE_PROPERTY( DEFAULT_TIME, XML_VALUE ),
+ FORM_SINGLE_PROPERTY( TIME, XML_CURRENT_VALUE ),
+
+ PropertyDescription()
+ };
+ return s_propertyMetaData;
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ namespace
+ {
+ // TODO: instead of having all of the below static, it should be some per-instance data. This way, the
+ // approach used here would scale much better.
+ // That is, if you have multiple "meta data instances", which manage a small, but closed set of properties,
+ // then looking looking through those multiple instances would probably be faster than searching within
+ // one big instance, since in this case, every instance can quickly decide whether it is responsible
+ // for some attribute or property, and otherwise delegate to the next instance.
+
+ //..............................................................................................................
+ typedef ::boost::unordered_map< ::rtl::OUString, const PropertyDescription*, ::rtl::OUStringHash > DescriptionsByName;
+
+ //..............................................................................................................
+ const DescriptionsByName& lcl_getPropertyDescriptions()
+ {
+ DBG_TESTSOLARMUTEX();
+ static DescriptionsByName s_propertyDescriptionsByName;
+ if ( s_propertyDescriptionsByName.empty() )
+ {
+ const PropertyDescription* desc = lcl_getPropertyMetaData();
+ while ( desc->propertyName.getLength() != 0 )
+ {
+ s_propertyDescriptionsByName[ desc->propertyName ] = desc;
+ ++desc;
+ }
+ }
+ return s_propertyDescriptionsByName;
+ }
+
+ //..............................................................................................................
+ typedef ::std::map< PropertyGroup, PropertyDescriptionList > IndexedPropertyGroups;
+
+ //..............................................................................................................
+ const IndexedPropertyGroups& lcl_getIndexedPropertyGroups()
+ {
+ DBG_TESTSOLARMUTEX();
+ static IndexedPropertyGroups s_indexedPropertyGroups;
+ if ( s_indexedPropertyGroups.empty() )
+ {
+ const PropertyDescription* desc = lcl_getPropertyMetaData();
+ while ( desc->propertyName.getLength() != 0 )
+ {
+ if ( desc->propertyGroup != NO_GROUP )
+ s_indexedPropertyGroups[ desc->propertyGroup ].push_back( desc );
+ ++desc;
+ }
+ }
+ return s_indexedPropertyGroups;
+ }
+
+ //..............................................................................................................
+ typedef ::boost::unordered_map< ::rtl::OUString, XMLTokenEnum, ::rtl::OUStringHash > ReverseTokenLookup;
+
+ //..............................................................................................................
+ const ReverseTokenLookup& getReverseTokenLookup()
+ {
+ DBG_TESTSOLARMUTEX();
+ static ReverseTokenLookup s_reverseTokenLookup;
+ if ( s_reverseTokenLookup.empty() )
+ {
+ const PropertyDescription* desc = lcl_getPropertyMetaData();
+ while ( desc->propertyName.getLength() != 0 )
+ {
+ s_reverseTokenLookup[ token::GetXMLToken( desc->attribute.attributeToken ) ] = desc->attribute.attributeToken;
+ ++desc;
+ }
+ }
+ return s_reverseTokenLookup;
+ }
+
+ //..............................................................................................................
+ struct AttributeHash : public ::std::unary_function< AttributeDescription, size_t >
+ {
+ size_t operator()( const AttributeDescription& i_attribute ) const
+ {
+ return size_t( i_attribute.attributeToken * 100 ) + size_t( i_attribute.namespacePrefix );
+ }
+ };
+
+ //..............................................................................................................
+ typedef ::boost::unordered_multimap< AttributeDescription, PropertyGroup, AttributeHash > AttributeGroups;
+
+ //..............................................................................................................
+ const AttributeGroups& lcl_getAttributeGroups()
+ {
+ DBG_TESTSOLARMUTEX();
+ static AttributeGroups s_attributeGroups;
+ if ( s_attributeGroups.empty() )
+ {
+ const PropertyDescription* desc = lcl_getPropertyMetaData();
+ while ( desc->propertyName.getLength() != 0 )
+ {
+ if ( desc->propertyGroup != NO_GROUP )
+ s_attributeGroups.insert( AttributeGroups::value_type( desc->attribute, desc->propertyGroup ) );
+ ++desc;
+ }
+ }
+ return s_attributeGroups;
+ }
+
+ //..............................................................................................................
+ typedef ::boost::unordered_map< AttributeDescription, PropertyGroups, AttributeHash > AttributesWithoutGroup;
+
+ //..............................................................................................................
+ const AttributesWithoutGroup& lcl_getAttributesWithoutGroups()
+ {
+ DBG_TESTSOLARMUTEX();
+ static AttributesWithoutGroup s_attributesWithoutGroup;
+ if ( s_attributesWithoutGroup.empty() )
+ {
+ const PropertyDescription* desc = lcl_getPropertyMetaData();
+ while ( desc->propertyName.getLength() != 0 )
+ {
+ if ( desc->propertyGroup == NO_GROUP )
+ {
+ PropertyDescriptionList singleElementList;
+ singleElementList.push_back( desc );
+
+ s_attributesWithoutGroup[ desc->attribute ].push_back( singleElementList );
+ }
+ ++desc;
+ }
+ }
+ return s_attributesWithoutGroup;
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ const PropertyDescription* getPropertyDescription( const ::rtl::OUString& i_propertyName )
+ {
+ const DescriptionsByName& rAllDescriptions( lcl_getPropertyDescriptions() );
+ DescriptionsByName::const_iterator pos = rAllDescriptions.find( i_propertyName );
+ if ( pos != rAllDescriptions.end() )
+ return pos->second;
+ return NULL;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void getPropertyGroup( const PropertyGroup i_propertyGroup, PropertyDescriptionList& o_propertyDescriptions )
+ {
+ OSL_ENSURE( i_propertyGroup != NO_GROUP, "xmloff::metadata::getPropertyGroup: illegal group!" );
+
+ const IndexedPropertyGroups& rPropertyGroups( lcl_getIndexedPropertyGroups() );
+ const IndexedPropertyGroups::const_iterator pos = rPropertyGroups.find( i_propertyGroup );
+ if ( pos != rPropertyGroups.end() )
+ o_propertyDescriptions = pos->second;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void getPropertyGroupList( const AttributeDescription& i_attribute, PropertyGroups& o_propertyGroups )
+ {
+ const AttributeGroups& rAttributeGroups = lcl_getAttributeGroups();
+
+ ::std::pair< AttributeGroups::const_iterator, AttributeGroups::const_iterator >
+ range = rAttributeGroups.equal_range( i_attribute );
+
+ if ( range.first == range.second )
+ {
+ // the attribute is not used for any non-trivial group, which means it is mapped directly to
+ // a single property
+ const AttributesWithoutGroup& attributesWithoutGroups( lcl_getAttributesWithoutGroups() );
+ const AttributesWithoutGroup::const_iterator pos = attributesWithoutGroups.find( i_attribute );
+ if ( pos != attributesWithoutGroups.end() )
+ o_propertyGroups = pos->second;
+ }
+ else
+ {
+ const IndexedPropertyGroups& rPropertyGroups = lcl_getIndexedPropertyGroups();
+ for ( AttributeGroups::const_iterator group = range.first; group != range.second; ++group )
+ {
+ const PropertyGroup propGroup = group->second;
+ const IndexedPropertyGroups::const_iterator groupPos = rPropertyGroups.find( propGroup );
+ ENSURE_OR_CONTINUE( groupPos != rPropertyGroups.end(), "getPropertyGroupList: inconsistency!" );
+ o_propertyGroups.push_back( groupPos->second );
+ }
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ AttributeDescription getAttributeDescription( const sal_uInt16 i_namespacePrefix, const ::rtl::OUString& i_attributeName )
+ {
+ AttributeDescription attribute;
+ const ReverseTokenLookup& rTokenLookup( getReverseTokenLookup() );
+ const ReverseTokenLookup::const_iterator pos = rTokenLookup.find( i_attributeName );
+ if ( pos != rTokenLookup.end() )
+ {
+ attribute.namespacePrefix = i_namespacePrefix;
+ attribute.attributeToken = pos->second;
+ }
+ return attribute;
+ }
+
+//......................................................................................................................
+} } // namespace xmloff::metadata
+//......................................................................................................................
diff --git a/xmloff/source/forms/property_meta_data.hxx b/xmloff/source/forms/property_meta_data.hxx
new file mode 100644
index 000000000000..a0f2aa6a1046
--- /dev/null
+++ b/xmloff/source/forms/property_meta_data.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ * 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 XMLOFF_PROPERTY_META_DATA_HXX
+#define XMLOFF_PROPERTY_META_DATA_HXX
+
+#include "property_description.hxx"
+
+//......................................................................................................................
+namespace xmloff { namespace metadata
+{
+//......................................................................................................................
+
+ const PropertyDescription* getPropertyDescription( const ::rtl::OUString& i_propertyName );
+
+ /** retries the descriptions of all properties which add to the given XML attribute
+
+ <p>Effectively, the complete property map is search for all entries which have the given
+ namespace/attribute values.</p>
+ */
+ void getPropertyGroup(
+ const PropertyGroup i_propertyGroup,
+ PropertyDescriptionList& o_propertyDescriptions
+ );
+
+ /** retrieves all known property groups which are mapped to the given attribute
+ */
+ void getPropertyGroupList(
+ const AttributeDescription& i_attribute,
+ PropertyGroups& o_propertyGroups
+ );
+
+ /** retrieves the attribute descriptor for the attribute given by namespace prefix and attribute name
+ */
+ AttributeDescription
+ getAttributeDescription( const sal_uInt16 i_namespacePrefix, const ::rtl::OUString& i_attributeName );
+
+//......................................................................................................................
+} } // namespace xmloff::metadata
+//......................................................................................................................
+
+#endif // XMLOFF_PROPERTY_META_DATA_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/propertyexport.cxx b/xmloff/source/forms/propertyexport.cxx
new file mode 100644
index 000000000000..28e53e133562
--- /dev/null
+++ b/xmloff/source/forms/propertyexport.cxx
@@ -0,0 +1,733 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <stdio.h>
+#include "propertyexport.hxx"
+#include <xmloff/xmlexp.hxx>
+#include "strings.hxx"
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/families.hxx>
+#include <osl/diagnose.h>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/util/Time.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+#include <osl/diagnose.h>
+#include <comphelper/extract.hxx>
+#include <comphelper/sequence.hxx>
+#include <comphelper/types.hxx>
+#include "callbacks.hxx"
+#include <unotools/datetime.hxx>
+#include <tools/date.hxx>
+#include <tools/time.hxx>
+#include <tools/datetime.hxx>
+
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::beans;
+
+ // NO using namespace ...util !!!
+ // need a tools Date/Time/DateTime below, which would conflict with the uno types then
+
+ using namespace ::comphelper;
+
+ //=====================================================================
+ //= OPropertyExport
+ //=====================================================================
+ //---------------------------------------------------------------------
+ OPropertyExport::OPropertyExport(IFormsExportContext& _rContext, const Reference< XPropertySet >& _rxProps)
+ :m_rContext(_rContext)
+ ,m_xProps(_rxProps)
+ ,m_xPropertyInfo( m_xProps->getPropertySetInfo() )
+ ,m_xPropertyState( _rxProps, UNO_QUERY )
+ {
+ // caching
+ ::rtl::OUStringBuffer aBuffer;
+ m_rContext.getGlobalContext().GetMM100UnitConverter().convertBool(aBuffer, sal_True);
+ m_sValueTrue = aBuffer.makeStringAndClear();
+ m_rContext.getGlobalContext().GetMM100UnitConverter().convertBool(aBuffer, sal_False);
+ m_sValueFalse = aBuffer.makeStringAndClear();
+
+ OSL_ENSURE(m_xPropertyInfo.is(), "OPropertyExport::OPropertyExport: need an XPropertySetInfo!");
+
+ // collect the properties which need to be exported
+ examinePersistence();
+ }
+
+ //---------------------------------------------------------------------
+ bool OPropertyExport::shouldExportProperty( const ::rtl::OUString& i_propertyName ) const
+ {
+ // if the property state is DEFAULT, it does not need to be written - at least
+ // if it's a built-in property, and not a dynamically-added one.
+ bool bIsDefaultValue = m_xPropertyState.is()
+ && ( PropertyState_DEFAULT_VALUE == m_xPropertyState->getPropertyState( i_propertyName ) );
+ bool bIsDynamicProperty = m_xPropertyInfo.is()
+ && ( ( m_xPropertyInfo->getPropertyByName( i_propertyName ).Attributes & PropertyAttribute::REMOVEABLE ) != 0 );
+ return ( !bIsDefaultValue || bIsDynamicProperty );
+ }
+
+ //---------------------------------------------------------------------
+ void OPropertyExport::exportRemainingProperties()
+ {
+ // the properties tag (will be created if we have at least one no-default property)
+ SvXMLElementExport* pPropertiesTag = NULL;
+
+ try
+ {
+ Any aValue;
+ ::rtl::OUString sValue;
+
+ // loop through all the properties which are yet to be exported
+ for ( ConstStringSetIterator aProperty = m_aRemainingProps.begin();
+ aProperty != m_aRemainingProps.end();
+ ++aProperty
+ )
+ {
+ DBG_CHECK_PROPERTY_NO_TYPE(*aProperty);
+
+ #if OSL_DEBUG_LEVEL > 0
+ const ::rtl::OUString sPropertyName = *aProperty; (void)sPropertyName;
+ #endif
+ if ( !shouldExportProperty( *aProperty ) )
+ continue;
+
+ // now that we have the first sub-tag we need the form:properties element
+ if (!pPropertiesTag)
+ pPropertiesTag = new SvXMLElementExport(m_rContext.getGlobalContext(), XML_NAMESPACE_FORM, token::XML_PROPERTIES, sal_True, sal_True);
+
+ // add the name attribute
+ AddAttribute(XML_NAMESPACE_FORM, token::XML_PROPERTY_NAME, *aProperty);
+
+ // get the value
+ aValue = m_xProps->getPropertyValue(*aProperty);
+
+ // the type to export
+ Type aExportType;
+
+ // is it a sequence
+ sal_Bool bIsSequence = TypeClass_SEQUENCE == aValue.getValueTypeClass();
+ // the type of the property, maybe reduced to the element type of a sequence
+ if (bIsSequence)
+ aExportType = getSequenceElementType( aValue.getValueType() );
+ else
+ aExportType = aValue.getValueType();
+
+ // the type attribute
+
+ bool bIsEmptyValue = TypeClass_VOID == aValue.getValueType().getTypeClass();
+ if ( bIsEmptyValue )
+ {
+ com::sun::star::beans::Property aPropDesc;
+ aPropDesc = m_xPropertyInfo->getPropertyByName( *aProperty );
+ aExportType = aPropDesc.Type;
+ }
+ token::XMLTokenEnum eValueType = implGetPropertyXMLType( aExportType );
+
+ if ( bIsEmptyValue )
+ AddAttribute( XML_NAMESPACE_OFFICE, token::XML_VALUE_TYPE, token::XML_VOID );
+ else
+ AddAttribute( XML_NAMESPACE_OFFICE, token::XML_VALUE_TYPE, eValueType );
+
+ token::XMLTokenEnum eValueAttName( token::XML_VALUE );
+ switch ( eValueType )
+ {
+ case token::XML_BOOLEAN: eValueAttName = token::XML_BOOLEAN_VALUE; break;
+ case token::XML_STRING: eValueAttName = token::XML_STRING_VALUE; break;
+ default: break;
+ }
+
+ if( !bIsSequence && !bIsEmptyValue )
+ { // the simple case
+
+ sValue = implConvertAny(aValue);
+ AddAttribute(XML_NAMESPACE_OFFICE, eValueAttName, sValue );
+ }
+
+
+ // start the property tag
+ SvXMLElementExport aValueTag1(m_rContext.getGlobalContext(),
+ XML_NAMESPACE_FORM,
+ bIsSequence ? token::XML_LIST_PROPERTY
+ : token::XML_PROPERTY, sal_True, sal_True);
+
+ if (!bIsSequence)
+ continue;
+
+ // the not-that-simple case, we need to iterate through the sequence elements
+ IIterator* pSequenceIterator = NULL;
+
+ switch ( aExportType.getTypeClass() )
+ {
+ case TypeClass_STRING:
+ pSequenceIterator = new OSequenceIterator< ::rtl::OUString >(aValue);
+ break;
+ case TypeClass_DOUBLE:
+ pSequenceIterator = new OSequenceIterator< double >(aValue);
+ break;
+ case TypeClass_BOOLEAN:
+ pSequenceIterator = new OSequenceIterator< sal_Bool >(aValue);
+ break;
+ case TypeClass_BYTE:
+ pSequenceIterator = new OSequenceIterator< sal_Int8 >(aValue);
+ break;
+ case TypeClass_SHORT:
+ pSequenceIterator = new OSequenceIterator< sal_Int16 >(aValue);
+ break;
+ case TypeClass_LONG:
+ pSequenceIterator = new OSequenceIterator< sal_Int32 >(aValue);
+ break;
+ case TypeClass_HYPER:
+ pSequenceIterator = new OSequenceIterator< sal_Int64 >(aValue);
+ break;
+ default:
+ OSL_FAIL("OPropertyExport::exportRemainingProperties: unsupported sequence tyoe !");
+ break;
+ }
+ if (pSequenceIterator)
+ {
+ while (pSequenceIterator->hasMoreElements())
+ {
+ sValue =
+ implConvertAny(pSequenceIterator->nextElement());
+ AddAttribute(XML_NAMESPACE_OFFICE, eValueAttName, sValue );
+ SvXMLElementExport aValueTag(
+ m_rContext.getGlobalContext(),
+ XML_NAMESPACE_FORM, token::XML_LIST_VALUE,
+ sal_True, sal_False);
+ }
+ }
+ delete pSequenceIterator;
+ }
+ }
+ catch(...)
+ {
+ delete pPropertiesTag;
+ throw;
+ }
+ delete pPropertiesTag;
+ }
+
+ //---------------------------------------------------------------------
+ void OPropertyExport::examinePersistence()
+ {
+ m_aRemainingProps.clear();
+ Sequence< Property > aProperties = m_xPropertyInfo->getProperties();
+ const Property* pProperties = aProperties.getConstArray();
+ for (sal_Int32 i=0; i<aProperties.getLength(); ++i, ++pProperties)
+ {
+ // no transient props
+ if ( pProperties->Attributes & PropertyAttribute::TRANSIENT )
+ continue;
+ // no read-only props
+ if ( ( pProperties->Attributes & PropertyAttribute::READONLY ) != 0 )
+ // except they're dynamically added
+ if ( ( pProperties->Attributes & PropertyAttribute::REMOVEABLE ) == 0 )
+ continue;
+ m_aRemainingProps.insert(pProperties->Name);
+ }
+ }
+
+ //---------------------------------------------------------------------
+ void OPropertyExport::exportStringPropertyAttribute( const sal_uInt16 _nNamespaceKey, const sal_Char* _pAttributeName,
+ const ::rtl::OUString& _rPropertyName )
+ {
+ DBG_CHECK_PROPERTY( _rPropertyName, ::rtl::OUString );
+
+ // no try-catch here, this would be to expensive. The outer scope has to handle exceptions (which should not
+ // happen if we're used correctly :)
+
+ // this is way simple, as we don't need to convert anything (the property already is a string)
+
+ // get the string
+ ::rtl::OUString sPropValue;
+ m_xProps->getPropertyValue( _rPropertyName ) >>= sPropValue;
+
+ // add the attribute
+ if ( sPropValue.getLength() )
+ AddAttribute( _nNamespaceKey, _pAttributeName, sPropValue );
+
+ // the property does not need to be handled anymore
+ exportedProperty( _rPropertyName );
+ }
+
+ //---------------------------------------------------------------------
+ void OPropertyExport::exportBooleanPropertyAttribute(const sal_uInt16 _nNamespaceKey, const sal_Char* _pAttributeName,
+ const ::rtl::OUString& _rPropertyName, const sal_Int8 _nBooleanAttributeFlags)
+ {
+ DBG_CHECK_PROPERTY_NO_TYPE( _rPropertyName );
+ // no check of the property value type: this method is allowed to be called with any interger properties
+ // (e.g. sal_Int32, sal_uInt16 etc)
+
+ sal_Bool bDefault = (BOOLATTR_DEFAULT_TRUE == (BOOLATTR_DEFAULT_MASK & _nBooleanAttributeFlags));
+ sal_Bool bDefaultVoid = (BOOLATTR_DEFAULT_VOID == (BOOLATTR_DEFAULT_MASK & _nBooleanAttributeFlags));
+
+ // get the value
+ sal_Bool bCurrentValue = bDefault;
+ Any aCurrentValue = m_xProps->getPropertyValue( _rPropertyName );
+ if (aCurrentValue.hasValue())
+ {
+ bCurrentValue = ::cppu::any2bool(aCurrentValue);
+ // this will extract a boolean value even if the Any contains a int or short or something like that ...
+
+ if (_nBooleanAttributeFlags & BOOLATTR_INVERSE_SEMANTICS)
+ bCurrentValue = !bCurrentValue;
+
+ // we have a non-void current value
+ if (bDefaultVoid || (bDefault != bCurrentValue))
+ // and (the default is void, or the non-void default does not equal the current value)
+ // -> write the attribute
+ AddAttribute(_nNamespaceKey, _pAttributeName, bCurrentValue ? m_sValueTrue : m_sValueFalse);
+ }
+ else
+ // we have a void current value
+ if (!bDefaultVoid)
+ // and we have a non-void default
+ // -> write the attribute
+ AddAttribute(_nNamespaceKey, _pAttributeName, bCurrentValue ? m_sValueTrue : m_sValueFalse);
+
+ // the property does not need to be handled anymore
+ exportedProperty( _rPropertyName );
+ }
+
+ //---------------------------------------------------------------------
+ void OPropertyExport::exportInt16PropertyAttribute(const sal_uInt16 _nNamespaceKey, const sal_Char* _pAttributeName,
+ const ::rtl::OUString& _rPropertyName, const sal_Int16 _nDefault)
+ {
+ DBG_CHECK_PROPERTY( _rPropertyName, sal_Int16 );
+
+ // get the value
+ sal_Int16 nCurrentValue(_nDefault);
+ m_xProps->getPropertyValue( _rPropertyName ) >>= nCurrentValue;
+
+ // add the attribute
+ if (_nDefault != nCurrentValue)
+ {
+ // let the formatter of the export context build a string
+ ::rtl::OUStringBuffer sBuffer;
+ m_rContext.getGlobalContext().GetMM100UnitConverter().convertNumber(sBuffer, (sal_Int32)nCurrentValue);
+
+ AddAttribute(_nNamespaceKey, _pAttributeName, sBuffer.makeStringAndClear());
+ }
+
+ // the property does not need to be handled anymore
+ exportedProperty( _rPropertyName );
+ }
+
+ //---------------------------------------------------------------------
+ void OPropertyExport::exportInt32PropertyAttribute( const sal_uInt16 _nNamespaceKey, const sal_Char* _pAttributeName,
+ const ::rtl::OUString& _rPropertyName, const sal_Int32 _nDefault )
+ {
+ DBG_CHECK_PROPERTY( _rPropertyName, sal_Int32 );
+
+ // get the value
+ sal_Int32 nCurrentValue( _nDefault );
+ m_xProps->getPropertyValue( _rPropertyName ) >>= nCurrentValue;
+
+ // add the attribute
+ if ( _nDefault != nCurrentValue )
+ {
+ // let the formatter of the export context build a string
+ ::rtl::OUStringBuffer sBuffer;
+ m_rContext.getGlobalContext().GetMM100UnitConverter().convertNumber( sBuffer, nCurrentValue );
+
+ AddAttribute( _nNamespaceKey, _pAttributeName, sBuffer.makeStringAndClear() );
+ }
+
+ // the property does not need to be handled anymore
+ exportedProperty( _rPropertyName );
+ }
+
+ //---------------------------------------------------------------------
+ void OPropertyExport::exportEnumPropertyAttribute(
+ const sal_uInt16 _nNamespaceKey, const sal_Char* _pAttributeName,
+ const sal_Char* _pPropertyName, const SvXMLEnumMapEntry* _pValueMap,
+ const sal_Int32 _nDefault, const sal_Bool _bVoidDefault)
+ {
+ // get the value
+ sal_Int32 nCurrentValue(_nDefault);
+ ::rtl::OUString sPropertyName(::rtl::OUString::createFromAscii(_pPropertyName));
+ Any aValue = m_xProps->getPropertyValue(sPropertyName);
+
+ if (aValue.hasValue())
+ { // we have a non-void current value
+ ::cppu::enum2int(nCurrentValue, aValue);
+
+ // add the attribute
+ if ((_nDefault != nCurrentValue) || _bVoidDefault)
+ { // the default does not equal the value, or the default is void and the value isn't
+
+ // let the formatter of the export context build a string
+ ::rtl::OUStringBuffer sBuffer;
+ m_rContext.getGlobalContext().GetMM100UnitConverter().convertEnum(sBuffer, (sal_uInt16)nCurrentValue, _pValueMap);
+
+ AddAttribute(_nNamespaceKey, _pAttributeName, sBuffer.makeStringAndClear());
+ }
+ }
+ else
+ {
+ if (!_bVoidDefault)
+ AddAttributeASCII(_nNamespaceKey, _pAttributeName, "");
+ }
+
+ // the property does not need to be handled anymore
+ exportedProperty(sPropertyName);
+ }
+
+ //---------------------------------------------------------------------
+ void OPropertyExport::exportTargetFrameAttribute()
+ {
+ DBG_CHECK_PROPERTY( PROPERTY_TARGETFRAME, ::rtl::OUString );
+
+ ::rtl::OUString sTargetFrame = comphelper::getString(m_xProps->getPropertyValue(PROPERTY_TARGETFRAME));
+ if (0 != sTargetFrame.compareToAscii("_blank"))
+ { // an empty string and "_blank" have the same meaning and don't have to be written
+ AddAttribute(OAttributeMetaData::getCommonControlAttributeNamespace(CCA_TARGET_FRAME)
+ ,OAttributeMetaData::getCommonControlAttributeName(CCA_TARGET_FRAME)
+ ,sTargetFrame);
+ }
+
+ exportedProperty(PROPERTY_TARGETFRAME);
+ }
+
+ //---------------------------------------------------------------------
+ void OPropertyExport::exportRelativeTargetLocation(const ConstAsciiString& _sPropertyName,sal_Int32 _nProperty,bool _bAddType)
+ {
+ DBG_CHECK_PROPERTY( _sPropertyName, ::rtl::OUString );
+
+ ::rtl::OUString sTargetLocation = comphelper::getString(m_xProps->getPropertyValue(_sPropertyName));
+ if ( sTargetLocation.getLength() )
+ // If this isn't a GraphicObject then GetRelativeReference
+ // will be called anyway ( in AddEmbeddedGraphic )
+ sTargetLocation = m_rContext.getGlobalContext().AddEmbeddedGraphicObject(sTargetLocation);
+ AddAttribute(OAttributeMetaData::getCommonControlAttributeNamespace(_nProperty)
+ ,OAttributeMetaData::getCommonControlAttributeName(_nProperty)
+ , sTargetLocation);
+
+ // #i110911# add xlink:type="simple" if required
+ if (_bAddType)
+ AddAttribute(XML_NAMESPACE_XLINK, token::XML_TYPE, token::XML_SIMPLE);
+
+ exportedProperty(_sPropertyName);
+ }
+ //---------------------------------------------------------------------
+ void OPropertyExport::flagStyleProperties()
+ {
+ // flag all the properties which are part of the style as "handled"
+ UniReference< XMLPropertySetMapper > xStylePropertiesSupplier = m_rContext.getStylePropertyMapper()->getPropertySetMapper();
+ for (sal_Int32 i=0; i<xStylePropertiesSupplier->GetEntryCount(); ++i)
+ exportedProperty(xStylePropertiesSupplier->GetEntryAPIName(i));
+
+ // the font properties are exported as single properties, but there is a FontDescriptor property which
+ // collects them all-in-one, this has been exported implicitly
+ exportedProperty(PROPERTY_FONT);
+
+ // for the DateFormat and TimeFormat, there exist wrapper properties which has been exported as
+ // style, too
+ exportedProperty(PROPERTY_DATEFORMAT);
+ exportedProperty(PROPERTY_TIMEFORMAT);
+
+ // the following properties should have been exported at the shape already:
+ exportedProperty( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VerticalAlign" ) ) );
+ exportedProperty( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "WritingMode" ) ) );
+ exportedProperty( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ScaleMode" ) ) );
+ // ditto the TextWritingMode
+ exportedProperty( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "WritingMode" ) ) );
+ }
+
+ //---------------------------------------------------------------------
+ void OPropertyExport::exportGenericPropertyAttribute(
+ const sal_uInt16 _nAttributeNamespaceKey, const sal_Char* _pAttributeName, const sal_Char* _pPropertyName)
+ {
+ DBG_CHECK_PROPERTY_ASCII_NO_TYPE( _pPropertyName );
+
+ ::rtl::OUString sPropertyName = ::rtl::OUString::createFromAscii(_pPropertyName);
+ exportedProperty(sPropertyName);
+
+ Any aCurrentValue = m_xProps->getPropertyValue(sPropertyName);
+ if (!aCurrentValue.hasValue())
+ // nothing to do without a concrete value
+ return;
+
+ ::rtl::OUString sValue = implConvertAny(aCurrentValue);
+ if (!sValue.getLength() && (TypeClass_STRING == aCurrentValue.getValueTypeClass()))
+ {
+ // check whether or not the property is allowed to be VOID
+ Property aProperty = m_xPropertyInfo->getPropertyByName(sPropertyName);
+ if ((aProperty.Attributes & PropertyAttribute::MAYBEVOID) == 0)
+ // the string is empty, and the property is not allowed to be void
+ // -> don't need to write the attibute, 'cause missing it is unambiguous
+ return;
+ }
+
+ // finally add the attribuite to the context
+ AddAttribute(_nAttributeNamespaceKey, _pAttributeName, sValue);
+ }
+
+ //---------------------------------------------------------------------
+ void OPropertyExport::exportStringSequenceAttribute(const sal_uInt16 _nAttributeNamespaceKey, const sal_Char* _pAttributeName,
+ const ::rtl::OUString& _rPropertyName,
+ const sal_Unicode _aQuoteCharacter, const sal_Unicode _aListSeparator)
+ {
+ DBG_CHECK_PROPERTY( _rPropertyName, Sequence< ::rtl::OUString > );
+ OSL_ENSURE(_aListSeparator != 0, "OPropertyExport::exportStringSequenceAttribute: invalid separator character!");
+
+ Sequence< ::rtl::OUString > aItems;
+ m_xProps->getPropertyValue( _rPropertyName ) >>= aItems;
+
+ ::rtl::OUString sFinalList;
+
+ // unfortunately the OUString can't append single sal_Unicode characters ...
+ const ::rtl::OUString sQuote(&_aQuoteCharacter, 1);
+ const ::rtl::OUString sSeparator(&_aListSeparator, 1);
+ const sal_Bool bQuote = 0 != sQuote.getLength();
+
+ // concatenate the string items
+ const ::rtl::OUString* pItems = aItems.getConstArray();
+ const ::rtl::OUString* pEnd = pItems + aItems.getLength();
+ const ::rtl::OUString* pLastElement = pEnd - 1;
+ for ( ;
+ pItems != pEnd;
+ ++pItems
+ )
+ {
+ OSL_ENSURE(!_aQuoteCharacter || (-1 == pItems->indexOf(_aQuoteCharacter)),
+ "OPropertyExport::exportStringSequenceAttribute: there is an item which contains the quote character!");
+ OSL_ENSURE(_aQuoteCharacter || (-1 == pItems->indexOf(_aListSeparator)),
+ "OPropertyExport::exportStringSequenceAttribute: no quote character, but there is an item containing the separator character!");
+
+ if (bQuote)
+ sFinalList += sQuote;
+ sFinalList += *pItems;
+ if (bQuote)
+ sFinalList += sQuote;
+
+ if (pItems != pLastElement)
+ sFinalList += sSeparator;
+ }
+
+ if (sFinalList.getLength())
+ AddAttribute(_nAttributeNamespaceKey, _pAttributeName, sFinalList);
+
+ exportedProperty( _rPropertyName );
+ }
+
+ //---------------------------------------------------------------------
+ ::rtl::OUString OPropertyExport::implConvertAny(const Any& _rValue)
+ {
+ ::rtl::OUStringBuffer aBuffer;
+ switch (_rValue.getValueTypeClass())
+ {
+ case TypeClass_STRING:
+ { // extract the string
+ ::rtl::OUString sCurrentValue;
+ _rValue >>= sCurrentValue;
+ aBuffer.append(sCurrentValue);
+ }
+ break;
+ case TypeClass_DOUBLE:
+ // let the unit converter format is as string
+ m_rContext.getGlobalContext().GetMM100UnitConverter().convertDouble(aBuffer, getDouble(_rValue));
+ break;
+ case TypeClass_BOOLEAN:
+ aBuffer = getBOOL(_rValue) ? m_sValueTrue : m_sValueFalse;
+ break;
+ case TypeClass_BYTE:
+ case TypeClass_SHORT:
+ case TypeClass_LONG:
+ // let the unit converter format is as string
+ m_rContext.getGlobalContext().GetMM100UnitConverter().convertNumber(aBuffer, getINT32(_rValue));
+ break;
+ case TypeClass_HYPER:
+ // TODO
+ OSL_FAIL("OPropertyExport::implConvertAny: missing implementation for sal_Int64!");
+ break;
+ case TypeClass_ENUM:
+ {
+ // convert it into an int32
+ sal_Int32 nValue = 0;
+ ::cppu::enum2int(nValue, _rValue);
+ m_rContext.getGlobalContext().GetMM100UnitConverter().convertNumber(aBuffer, nValue);
+ }
+ break;
+ default:
+ { // hmmm .... what else do we know?
+ double fValue = 0;
+ ::com::sun::star::util::Date aDate;
+ ::com::sun::star::util::Time aTime;
+ ::com::sun::star::util::DateTime aDateTime;
+ if (_rValue >>= aDate)
+ {
+ Date aToolsDate;
+ ::utl::typeConvert(aDate, aToolsDate);
+ fValue = aToolsDate.GetDate();
+ }
+ else if (_rValue >>= aTime)
+ {
+ fValue = ((aTime.Hours * 60 + aTime.Minutes) * 60 + aTime.Seconds) * 100 + aTime.HundredthSeconds;
+ fValue = fValue / 8640000.0;
+ }
+ else if (_rValue >>= aDateTime)
+ {
+ DateTime aToolsDateTime;
+ ::utl::typeConvert(aDateTime, aToolsDateTime);
+ // the time part (the digits behind the comma)
+ fValue = ((aDateTime.Hours * 60 + aDateTime.Minutes) * 60 + aDateTime.Seconds) * 100 + aDateTime.HundredthSeconds;
+ fValue = fValue / 8640000.0;
+ // plus the data part (the digits in front of the comma)
+ fValue += aToolsDateTime.GetDate();
+ }
+ else
+ {
+ // if any other types are added here, please remember to adjust implGetPropertyXMLType accordingly
+
+ // no more options ...
+ OSL_FAIL("OPropertyExport::implConvertAny: unsupported value type!");
+ break;
+ }
+ // let the unit converter format is as string
+ m_rContext.getGlobalContext().GetMM100UnitConverter().convertDouble(aBuffer, fValue);
+ }
+ break;
+ }
+
+ return aBuffer.makeStringAndClear();
+ }
+
+
+ //---------------------------------------------------------------------
+ token::XMLTokenEnum OPropertyExport::implGetPropertyXMLType(const ::com::sun::star::uno::Type& _rType)
+ {
+ // handle the type description
+ switch (_rType.getTypeClass())
+ {
+ case TypeClass_STRING:
+ return token::XML_STRING;
+ case TypeClass_DOUBLE:
+ case TypeClass_BYTE:
+ case TypeClass_SHORT:
+ case TypeClass_LONG:
+ case TypeClass_HYPER:
+ case TypeClass_ENUM:
+ return token::XML_FLOAT;
+ case TypeClass_BOOLEAN:
+ return token::XML_BOOLEAN;
+
+ default:
+ return token::XML_FLOAT;
+ }
+ }
+
+#ifdef DBG_UTIL
+ //---------------------------------------------------------------------
+ void OPropertyExport::AddAttribute(sal_uInt16 _nPrefix, const sal_Char* _pName, const ::rtl::OUString& _rValue)
+ {
+ OSL_ENSURE(0 == m_rContext.getGlobalContext().GetXAttrList()->getValueByName(::rtl::OUString::createFromAscii(_pName)).getLength(),
+ "OPropertyExport::AddAttribute: already have such an attribute");
+
+ m_rContext.getGlobalContext().AddAttribute(_nPrefix, _pName, _rValue);
+ }
+
+ //---------------------------------------------------------------------
+ void OPropertyExport::AddAttribute( sal_uInt16 _nPrefix, const ::rtl::OUString& _rName, const ::rtl::OUString& _rValue )
+ {
+ OSL_ENSURE(0 == m_rContext.getGlobalContext().GetXAttrList()->getValueByName( _rName ).getLength(),
+ "OPropertyExport::AddAttribute: already have such an attribute");
+
+ m_rContext.getGlobalContext().AddAttribute( _nPrefix, _rName, _rValue );
+ }
+
+ //---------------------------------------------------------------------
+ void OPropertyExport::AddAttributeASCII(sal_uInt16 _nPrefix, const sal_Char* _pName, const sal_Char *pValue)
+ {
+ OSL_ENSURE(0 == m_rContext.getGlobalContext().GetXAttrList()->getValueByName(::rtl::OUString::createFromAscii(_pName)).getLength(),
+ "OPropertyExport::AddAttributeASCII: already have such an attribute");
+
+ m_rContext.getGlobalContext().AddAttributeASCII(_nPrefix, _pName, pValue);
+ }
+
+ //---------------------------------------------------------------------
+ void OPropertyExport::AddAttribute(sal_uInt16 _nPrefix, ::xmloff::token::XMLTokenEnum _eName, const ::rtl::OUString& _rValue)
+ {
+ OSL_ENSURE(0 == m_rContext.getGlobalContext().GetXAttrList()->getValueByName(::xmloff::token::GetXMLToken(_eName)).getLength(),
+ "OPropertyExport::AddAttribute: already have such an attribute");
+
+ m_rContext.getGlobalContext().AddAttribute(_nPrefix, _eName, _rValue);
+ }
+
+ //---------------------------------------------------------------------
+ void OPropertyExport::AddAttribute(sal_uInt16 _nPrefix, ::xmloff::token::XMLTokenEnum _eName, ::xmloff::token::XMLTokenEnum _eValue )
+ {
+ OSL_ENSURE(0 == m_rContext.getGlobalContext().GetXAttrList()->getValueByName(::xmloff::token::GetXMLToken(_eName)).getLength(),
+ "OPropertyExport::AddAttribute: already have such an attribute");
+
+ m_rContext.getGlobalContext().AddAttribute(_nPrefix, _eName, _eValue);
+ }
+
+ //---------------------------------------------------------------------
+ void OPropertyExport::dbg_implCheckProperty(const ::rtl::OUString& _rPropertyName, const Type* _pType)
+ {
+ try
+ {
+ // the property must exist
+ if (!m_xPropertyInfo->hasPropertyByName(_rPropertyName))
+ {
+ OSL_FAIL(::rtl::OString("OPropertyExport::dbg_implCheckProperty: no property with the name ") +=
+ ::rtl::OString(_rPropertyName.getStr(), _rPropertyName.getLength(), RTL_TEXTENCODING_ASCII_US) +=
+ ::rtl::OString("!"));
+ return;
+ }
+
+ if (_pType)
+ {
+ // and it must have the correct type
+ Property aPropertyDescription = m_xPropertyInfo->getPropertyByName(_rPropertyName);
+ OSL_ENSURE(aPropertyDescription.Type.equals(*_pType), "OPropertyExport::dbg_implCheckProperty: invalid property type!");
+ }
+ }
+ catch(Exception&)
+ {
+ OSL_FAIL("OPropertyExport::dbg_implCheckProperty: caught an exception, could not check the property!");
+ }
+ }
+#endif // DBG_UTIL - dbg_implCheckProperty
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/propertyexport.hxx b/xmloff/source/forms/propertyexport.hxx
new file mode 100644
index 000000000000..e31704c40530
--- /dev/null
+++ b/xmloff/source/forms/propertyexport.hxx
@@ -0,0 +1,423 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_FORMS_PROPERTYEXPORT_HXX_
+#define _XMLOFF_FORMS_PROPERTYEXPORT_HXX_
+
+#include "formattributes.hxx"
+#include <comphelper/stl_types.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <callbacks.hxx>
+#include <xmloff/xmlexp.hxx>
+#include "callbacks.hxx"
+#include "strings.hxx"
+
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+#define BOOLATTR_DEFAULT_FALSE 0x00
+#define BOOLATTR_DEFAULT_TRUE 0x01
+#define BOOLATTR_DEFAULT_VOID 0x02
+#define BOOLATTR_DEFAULT_MASK 0x03
+
+#define BOOLATTR_INVERSE_SEMANTICS 0x04
+ // if sal_True, indicates that the semantic of the property refered by <arg>_pPropertyName</arg>
+ // is inverse to the semantic of the XML attribute.<br/>
+ // I.e. if the property value is <TRUE/>, <FALSE/> has to be written and vice versa.
+ // <p>Be careful with <arg>_bDefault</arg> and <arg>_bInverseSemantics</arg>: if <arg>_bInverseSemantics</arg>
+ // is <TRUE/>, the current property value is inverted <em>before</em> comparing it to the default.</p>
+
+ class IFormsExportContext;
+ //=====================================================================
+ //= OPropertyExport
+ //=====================================================================
+ /** provides export related tools for attribute handling
+
+ <p>(The name is somewhat misleading. It's not only a PropertyExport, but in real a ElementExport.
+ Anyway.)</p>
+ */
+ class OPropertyExport
+ {
+ private:
+ DECLARE_STL_STDKEY_SET(::rtl::OUString, StringSet);
+ StringSet m_aRemainingProps;
+ // see examinePersistence
+
+ void exportRelativeTargetLocation(const ConstAsciiString& _sPropertyName,sal_Int32 _nProperty,bool _bAddType);
+
+ protected:
+ IFormsExportContext& m_rContext;
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ m_xProps;
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
+ m_xPropertyInfo;
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >
+ m_xPropertyState;
+
+ // caching
+ ::rtl::OUString m_sValueTrue;
+ ::rtl::OUString m_sValueFalse;
+
+ public:
+ /** constructs an object capable of handling attributes for export
+ @param _rContext
+ the export context to which's attribute list the property translation should be added
+ @param m_xControl
+ the property set to be exported
+ */
+ OPropertyExport(IFormsExportContext& _rContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxProps);
+
+ protected:
+ /** examines a property set given for all properties which's value are to made persistent
+
+ <p>upon return the <method>m_aRemainingProps</method> will be filled with the names of all properties
+ which need to be stored</p>
+ */
+ void examinePersistence();
+
+ /**
+ */
+ void exportRemainingProperties();
+
+ /** indicates that a property has been handled by a derived class, without using the helper methods of this
+ class.
+
+ <p>Calling this method is necessary in case you use the suggested mechanism for the generic export of
+ properties. This means that you want to use <method>exportRemainingProperties</method>, which exports
+ all properties which need to ('cause they haven't been exported with one of the other type-specific
+ methods).</p>
+
+ <p>In this case you should call exportedProperty for every property you export yourself, so the property
+ will be flagged as <em>already handled</em></p>
+ */
+ void exportedProperty(const ::rtl::OUString& _rPropertyName)
+ { m_aRemainingProps.erase(_rPropertyName); }
+
+ /** add an attribute which is represented by a string property to the export context
+
+ @param _nNamespaceKey
+ the key of the namespace to use for the attribute name. Is used with the namespace map
+ provided by the export context.
+ @param _pAttributeName
+ the name of the attribute to add. Must not contain any namespace
+ @param _pPropertyName
+ the name of the property to ask the control for
+ */
+ void exportStringPropertyAttribute(
+ const sal_uInt16 _nNamespaceKey,
+ const sal_Char* _pAttributeName,
+ const ::rtl::OUString& _rPropertyName
+ );
+
+ /** add an attribute which is represented by a boolean property to the export context
+
+ @param _nNamespaceKey
+ the key of the namespace to use for the attribute name. Is used with the namespace map
+ provided by the export context.
+ @param _pAttributeName
+ the name of the attribute to add. Must not contain any namespace (it's added automatically)
+ @param _pPropertyName
+ the name of the property to ask the control for
+ @param _nBooleanAttributeFlags
+ specifies the default and the "alignment" (inverse semantics) of the boolean property
+ */
+ void exportBooleanPropertyAttribute(
+ const sal_uInt16 _nNamespaceKey,
+ const sal_Char* _pAttributeName,
+ const ::rtl::OUString& _rPropertyName,
+ const sal_Int8 _nBooleanAttributeFlags);
+
+ /** add an attribute which is represented by a sal_Int16 property to the export context
+
+ @param _nNamespaceKey
+ the key of the namespace to use for the attribute name. Is used with the namespace map
+ provided by the export context.
+ @param _pAttributeName
+ the name of the attribute to add. Must not contain any namespace (it's added automatically)
+ @param _pPropertyName
+ the name of the property to ask the control for
+ @param _nDefault
+ the default of the attribute. If the current property value equals this default, no
+ attribute is added.
+ */
+ void exportInt16PropertyAttribute(
+ const sal_uInt16 _nNamespaceKey,
+ const sal_Char* _pAttributeName,
+ const ::rtl::OUString& _rPropertyName,
+ const sal_Int16 _nDefault);
+
+ /** add an attribute which is represented by a sal_Int32 property to the export context
+
+ @param _nNamespaceKey
+ the key of the namespace to use for the attribute name. Is used with the namespace map
+ provided by the export context.
+ @param _pAttributeName
+ the name of the attribute to add. Must not contain any namespace (it's added automatically)
+ @param _pPropertyName
+ the name of the property to ask the control for
+ @param _nDefault
+ the default of the attribute. If the current property value equals this default, no
+ attribute is added.
+ */
+ void exportInt32PropertyAttribute(
+ const sal_uInt16 _nNamespaceKey,
+ const sal_Char* _pAttributeName,
+ const ::rtl::OUString& _rPropertyName,
+ const sal_Int32 _nDefault);
+
+ /** add an attribute which is represented by a enum property to the export context
+
+ @param _nNamespaceKey
+ the key of the namespace to use for the attribute name. Is used with the namespace map
+ provided by the export context.
+ @param _pAttributeName
+ the name of the attribute to add. Must not contain any namespace (it's added automatically)
+ @param _pPropertyName
+ the name of the property to ask the control for
+ @param _pValueMap
+ the map to use when converting the property value to an attribute value
+ @param _nDefault
+ the default of the attribute. If the current property value equals this default, no
+ attribute is added.
+ */
+ void exportEnumPropertyAttribute(
+ const sal_uInt16 _nNamespaceKey,
+ const sal_Char* _pAttributeName,
+ const sal_Char* _pPropertyName,
+ const SvXMLEnumMapEntry* _pValueMap,
+ const sal_Int32 _nDefault,
+ const sal_Bool _bVoidDefault = sal_False);
+
+ // some very special methods for some very special attribute/property pairs
+
+ /** add the hlink:target-frame attribute to the export context.
+
+ <p>The value of this attribute is extracted from the TargetFrame property of the object given.</p>
+
+ <p>The property needs a special handling because conflicts between the default values for the attribute
+ and the property.</p>
+ */
+ void exportTargetFrameAttribute();
+
+ /** add the form:href attribute to the export context.
+
+ <p>The value of this attribute is extracted from the TargetURL property of the object given.</p>
+
+ <p>The property needs a special handling because the URL's need to be made relative</p>
+
+ <p>If _bAddType is set, an additional xlink:type="simple" attribute is also added.</p>
+ */
+ inline void exportTargetLocationAttribute(bool _bAddType) { exportRelativeTargetLocation(PROPERTY_TARGETURL,CCA_TARGET_LOCATION,_bAddType); }
+
+ /** add the form:image attribute to the export context.
+
+ <p>The value of this attribute is extracted from the ImageURL property of the object given.</p>
+
+ <p>The property needs a special handling because the URL's need to be made relative</p>
+ */
+ inline void exportImageDataAttribute() { exportRelativeTargetLocation(PROPERTY_IMAGEURL,CCA_IMAGE_DATA,false); }
+
+ /** flag the style properties as 'already exported'
+
+ <p>We don't have style support right now, so the only thing the method does is removing the style-relevant
+ properties from the list of yet-to-be-exported properties (<member>m_aRemainingProps</member>)</p>
+ */
+ void flagStyleProperties();
+
+ /** add an arbitrary attribute extracted from an arbitrary property to the export context
+
+ <p>The current value of the property specified wiht <arg>_pPropertyName</arg> is taken and converted
+ into a string, no matter what type it has. (Okay, there are the usual limitations: We know Date, Datetime,
+ double, integer ... to name just a few).</p>
+
+ <p>In case the property value is <NULL/> (void), no attribute is added</p>
+
+ <p>In case the property value is an empty string, and the property is a not allowed to be <NULL/> (void),
+ no attribute is added</p>
+
+ <p>In case the property value is a sequence of any type, no attribute is added, 'cause sequences can't be
+ transported as attribute. In the debug version, an additional assertion will occur if you nonetheless try
+ to do this.</p>
+
+ @param _nNamespaceKey
+ the key of the namespace to use for the attribute name. Is used with the namespace map
+ provided by the export context.
+ @param _pAttributeName
+ the name of the attribute to add. Must not contain any namespace (it's added automatically)
+ @param _pPropertyName
+ the name of the property to ask the object for
+ */
+ void exportGenericPropertyAttribute(
+ const sal_uInt16 _nAttributeNamespaceKey,
+ const sal_Char* _pAttributeName,
+ const sal_Char* _pPropertyName);
+
+ /** exports a property value, which is a string sequence, as attribute
+
+ <p>The elements of the string sequence given are quoted and concatenated, with the characters used for
+ this to be choosen by the caller</p>
+
+ <p>If you use the quote character, no check (except assertions) is made if one of the list items
+ containes the quote character</p>
+
+ <p>If you don't use the quote character, no check (except assertions) is made if one of the list items
+ containes the separator character (which would be deadly when reimporting the string)</p>
+
+ @param _nNamespaceKey
+ the key of the namespace to use for the attribute name. Is used with the namespace map
+ provided by the export context.
+ @param _pAttributeName
+ the name of the attribute to add. Must not contain any namespace (it's added automatically)
+ @param _pPropertyName
+ the name of the property to ask the object for
+ @param _aQuoteCharacter
+ the character to use to quote the sequence elements with. May be 0, in this case no quoting happens
+ @param _aListSeparator
+ the character to use to separate the list entries
+ */
+ void exportStringSequenceAttribute(
+ const sal_uInt16 _nAttributeNamespaceKey,
+ const sal_Char* _pAttributeName,
+ const ::rtl::OUString& _rPropertyName,
+ const sal_Unicode _aQuoteCharacter = '"',
+ const sal_Unicode _aListSeparator = ',');
+
+ /** determines whether the given property is to be exported
+
+ <p>Currently, the method simply checks whether the property's state is <em>not</em> PropertyState.DEFAULT,
+ or whether the property is a dynamic property (i.e. added via an <code>XPropertyContainer</code>).
+ So, take care when using the method - the heuristics is not applicable for all properties.</p>
+ */
+ bool shouldExportProperty( const ::rtl::OUString& i_propertyName ) const;
+
+ /** tries to convert an arbitrary <type scope="com.sun:star.uno">Any</type> into an string
+
+ <p>If the type contained in the Any is not supported, the returned string will be empty. In the
+ debug version, an additional assertion occurs.</p>
+
+ @param _rValue
+ the value to convert
+ */
+ ::rtl::OUString implConvertAny(
+ const ::com::sun::star::uno::Any& _rValue);
+
+ /**
+ @return
+ token which can be used in the <code>form:property</code> element's <code>type</code> attribute
+ to describe the type of a value.<br/>
+ Possible types returned are
+ <ul>
+ <li><b>boolean</b>: <arg>_rValue</arg> was interpreted as boolean value before converting
+ it into a string</li>
+ <li><b>float</b>: <arg>_rValue</arg> was interpreted as 64 bit floating point 16bit integer, 32bit integer or 64 bit integer value before
+ converting it into a string</li>
+ <li><b>string</b>: <arg>_rValue</arg> did not need any conversion as it already was a string</li>
+ </ul>
+ If the type is not convertable, float is returned
+ */
+ ::xmloff::token::XMLTokenEnum implGetPropertyXMLType(const ::com::sun::star::uno::Type& _rType);
+
+#ifdef DBG_UTIL
+ void AddAttribute(sal_uInt16 _nPrefix, const sal_Char* _pName, const ::rtl::OUString& _rValue);
+ void AddAttribute( sal_uInt16 _nPrefix, const ::rtl::OUString& _rName, const ::rtl::OUString& _rValue );
+ void AddAttributeASCII( sal_uInt16 nPrefix, const sal_Char *pName, const sal_Char *pValue );
+ void AddAttribute(sal_uInt16 _nPrefix, ::xmloff::token::XMLTokenEnum _eName, const ::rtl::OUString& _rValue);
+ void AddAttribute(sal_uInt16 _nPrefix, ::xmloff::token::XMLTokenEnum _eName, ::xmloff::token::XMLTokenEnum _eValue );
+#else
+ // in the product version, inline this, so it does not cost us extra time calling into our method
+ inline void AddAttribute(sal_uInt16 _nPrefix, const sal_Char* _pName, const ::rtl::OUString& _rValue)
+ { m_rContext.getGlobalContext().AddAttribute(_nPrefix, _pName, _rValue); }
+ inline void AddAttribute( sal_uInt16 _nPrefix, const ::rtl::OUString& _rName, const ::rtl::OUString& _rValue )
+ { m_rContext.getGlobalContext().AddAttribute( _nPrefix, _rName, _rValue ); }
+ inline void AddAttributeASCII( sal_uInt16 _nPrefix, const sal_Char* _pName, const sal_Char *pValue )
+ { m_rContext.getGlobalContext().AddAttributeASCII(_nPrefix, _pName, pValue); }
+ inline void AddAttribute(sal_uInt16 _nPrefix, ::xmloff::token::XMLTokenEnum _eName, const ::rtl::OUString& _rValue)
+ { m_rContext.getGlobalContext().AddAttribute(_nPrefix, _eName, _rValue); }
+ inline void AddAttribute(sal_uInt16 _nPrefix, ::xmloff::token::XMLTokenEnum _eName, ::xmloff::token::XMLTokenEnum _eValue )
+ { m_rContext.getGlobalContext().AddAttribute(_nPrefix, _eName, _eValue); }
+#endif
+
+#ifdef DBG_UTIL
+ protected:
+ /** check a given property set for the existence and type correctness of a given property
+
+ <p>This method is available in the non-product version only.</p>
+
+ @param _rPropertyName
+ the name of the property to ask the control model for
+ @param _pType
+ the expected type of the property. May be NULL, in this case no type check is made.
+ @return sal_True, if the property exists and is of the correct type
+ */
+ void dbg_implCheckProperty(
+ const ::rtl::OUString& _rPropertyName,
+ const ::com::sun::star::uno::Type* _pType);
+
+// void dbg_implCheckProperty(
+// const sal_Char* _rPropertyName,
+// const ::com::sun::star::uno::Type* _pType)
+// {
+// dbg_implCheckProperty(::rtl::OUString::createFromAscii(_rPropertyName), _pType);
+// }
+#endif
+ };
+
+ //=====================================================================
+ //= helper
+ //=====================================================================
+#ifdef DBG_UTIL
+ #define DBG_CHECK_PROPERTY(name, type) \
+ dbg_implCheckProperty(name, &::getCppuType(static_cast< type* >(NULL)))
+
+ #define DBG_CHECK_PROPERTY_NO_TYPE(name) \
+ dbg_implCheckProperty(name, NULL)
+
+ #define DBG_CHECK_PROPERTY_ASCII( name, type ) \
+ dbg_implCheckProperty( ::rtl::OUString::createFromAscii( name ), &::getCppuType(static_cast< type* >(NULL)))
+
+ #define DBG_CHECK_PROPERTY_ASCII_NO_TYPE( name ) \
+ dbg_implCheckProperty( ::rtl::OUString::createFromAscii( name ), NULL )
+#else
+ #define DBG_CHECK_PROPERTY(name, type)
+ #define DBG_CHECK_PROPERTY_NO_TYPE(name)
+ #define DBG_CHECK_PROPERTY_ASCII_NO_TYPE( name )
+#endif
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+#endif // _XMLOFF_FORMS_PROPERTYEXPORT_HXX_
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/propertyimport.cxx b/xmloff/source/forms/propertyimport.cxx
new file mode 100644
index 000000000000..daea3d95fcfd
--- /dev/null
+++ b/xmloff/source/forms/propertyimport.cxx
@@ -0,0 +1,639 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "propertyimport.hxx"
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <osl/diagnose.h>
+#include <comphelper/extract.hxx>
+#include "callbacks.hxx"
+#include "xmloff/xmlnmspe.hxx"
+#include <tools/date.hxx>
+#include <tools/time.hxx>
+#include <tools/datetime.hxx>
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/util/Time.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+#include <unotools/datetime.hxx>
+#include <rtl/logfile.hxx>
+
+#if OSL_DEBUG_LEVEL > 0
+ #ifndef _OSL_THREAD_H_
+ #include <osl/thread.h>
+ #endif
+#endif
+
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::beans;
+ using namespace ::com::sun::star::xml;
+
+ // NO using namespace ...util !!!
+ // need a tools Date/Time/DateTime below, which would conflict with the uno types then
+
+#define TYPE_DATE 1
+#define TYPE_TIME 2
+#define TYPE_DATETIME 3
+
+//=====================================================================
+//= PropertyConversion
+//=====================================================================
+namespace
+{
+ //---------------------------------------------------------------------
+ ::com::sun::star::util::Time lcl_getTime(double _nValue)
+ {
+ ::com::sun::star::util::Time aTime;
+ sal_uInt32 nIntValue = sal_Int32(_nValue * 8640000);
+ nIntValue *= 8640000;
+ aTime.HundredthSeconds = (sal_uInt16)( nIntValue % 100 );
+ nIntValue /= 100;
+ aTime.Seconds = (sal_uInt16)( nIntValue % 60 );
+ nIntValue /= 60;
+ aTime.Minutes = (sal_uInt16)( nIntValue % 60 );
+ nIntValue /= 60;
+ OSL_ENSURE(nIntValue < 24, "lcl_getTime: more than a day?");
+ aTime.Hours = static_cast< sal_uInt16 >( nIntValue );
+
+ return aTime;
+ }
+
+ //---------------------------------------------------------------------
+ static ::com::sun::star::util::Date lcl_getDate( double _nValue )
+ {
+ Date aToolsDate((sal_uInt32)_nValue);
+ ::com::sun::star::util::Date aDate;
+ ::utl::typeConvert(aToolsDate, aDate);
+ return aDate;
+ }
+}
+
+//---------------------------------------------------------------------
+Any PropertyConversion::convertString( SvXMLImport& _rImporter, const ::com::sun::star::uno::Type& _rExpectedType,
+ const ::rtl::OUString& _rReadCharacters, const SvXMLEnumMapEntry* _pEnumMap, const sal_Bool _bInvertBoolean )
+{
+ Any aReturn;
+ sal_Bool bEnumAsInt = sal_False;
+ switch (_rExpectedType.getTypeClass())
+ {
+ case TypeClass_BOOLEAN: // sal_Bool
+ {
+ bool bValue;
+ #if OSL_DEBUG_LEVEL > 0
+ sal_Bool bSuccess =
+ #endif
+ _rImporter.GetMM100UnitConverter().convertBool(bValue, _rReadCharacters);
+ OSL_ENSURE(bSuccess,
+ ::rtl::OString("PropertyConversion::convertString: could not convert \"")
+ += ::rtl::OString(_rReadCharacters.getStr(), _rReadCharacters.getLength(), RTL_TEXTENCODING_ASCII_US)
+ += ::rtl::OString("\" into a boolean!"));
+ aReturn = ::cppu::bool2any(_bInvertBoolean ? !bValue : bValue);
+ }
+ break;
+ case TypeClass_SHORT: // sal_Int16
+ case TypeClass_LONG: // sal_Int32
+ if (!_pEnumMap)
+ { // it's a real int32/16 property
+ sal_Int32 nValue(0);
+ #if OSL_DEBUG_LEVEL > 0
+ sal_Bool bSuccess =
+ #endif
+ _rImporter.GetMM100UnitConverter().convertNumber(nValue, _rReadCharacters);
+ OSL_ENSURE(bSuccess,
+ ::rtl::OString("PropertyConversion::convertString: could not convert \"")
+ += ::rtl::OString(_rReadCharacters.getStr(), _rReadCharacters.getLength(), RTL_TEXTENCODING_ASCII_US)
+ += ::rtl::OString("\" into an integer!"));
+ if (TypeClass_SHORT == _rExpectedType.getTypeClass())
+ aReturn <<= (sal_Int16)nValue;
+ else
+ aReturn <<= (sal_Int32)nValue;
+ break;
+ }
+ bEnumAsInt = sal_True;
+ // NO BREAK! handle it as enum
+ case TypeClass_ENUM:
+ {
+ sal_uInt16 nEnumValue(0);
+ #if OSL_DEBUG_LEVEL > 0
+ sal_Bool bSuccess =
+ #endif
+ _rImporter.GetMM100UnitConverter().convertEnum(nEnumValue, _rReadCharacters, _pEnumMap);
+ OSL_ENSURE(bSuccess, "PropertyConversion::convertString: could not convert to an enum value!");
+ if (bEnumAsInt)
+ if (TypeClass_SHORT == _rExpectedType.getTypeClass())
+ aReturn <<= (sal_Int16)nEnumValue;
+ else
+ aReturn <<= (sal_Int32)nEnumValue;
+ else
+ aReturn = ::cppu::int2enum((sal_Int32)nEnumValue, _rExpectedType);
+ }
+ break;
+ case TypeClass_HYPER:
+ {
+ OSL_FAIL("PropertyConversion::convertString: 64-bit integers not implemented yet!");
+ }
+ break;
+ case TypeClass_DOUBLE:
+ {
+ double nValue;
+ #if OSL_DEBUG_LEVEL > 0
+ sal_Bool bSuccess =
+ #endif
+ _rImporter.GetMM100UnitConverter().convertDouble(nValue, _rReadCharacters);
+ OSL_ENSURE(bSuccess,
+ ::rtl::OString("PropertyConversion::convertString: could not convert \"")
+ += ::rtl::OString(_rReadCharacters.getStr(), _rReadCharacters.getLength(), RTL_TEXTENCODING_ASCII_US)
+ += ::rtl::OString("\" into a double!"));
+ aReturn <<= (double)nValue;
+ }
+ break;
+ case TypeClass_STRING:
+ aReturn <<= _rReadCharacters;
+ break;
+ case TypeClass_STRUCT:
+ {
+ sal_Int32 nType = 0;
+ if ( _rExpectedType.equals( ::cppu::UnoType< ::com::sun::star::util::Date >::get() ) )
+ nType = TYPE_DATE;
+ else if ( _rExpectedType.equals( ::cppu::UnoType< ::com::sun::star::util::Time >::get() ) )
+ nType = TYPE_TIME;
+ else if ( _rExpectedType.equals( ::cppu::UnoType< ::com::sun::star::util::DateTime >::get() ) )
+ nType = TYPE_DATETIME;
+
+ if ( nType )
+ {
+ // first extract the double
+ double nValue = 0;
+ #if OSL_DEBUG_LEVEL > 0
+ sal_Bool bSuccess =
+ #endif
+ _rImporter.GetMM100UnitConverter().convertDouble(nValue, _rReadCharacters);
+ OSL_ENSURE(bSuccess,
+ ::rtl::OString("PropertyConversion::convertString: could not convert \"")
+ += ::rtl::OString(_rReadCharacters.getStr(), _rReadCharacters.getLength(), RTL_TEXTENCODING_ASCII_US)
+ += ::rtl::OString("\" into a double!"));
+
+ // then convert it into the target type
+ switch (nType)
+ {
+ case TYPE_DATE:
+ {
+ OSL_ENSURE(((sal_uInt32)nValue) - nValue == 0,
+ "PropertyConversion::convertString: a Date value with a fractional part?");
+ aReturn <<= lcl_getDate(nValue);
+ }
+ break;
+ case TYPE_TIME:
+ {
+ OSL_ENSURE(((sal_uInt32)nValue) == 0,
+ "PropertyConversion::convertString: a Time value with more than a fractional part?");
+ aReturn <<= lcl_getTime(nValue);
+ }
+ break;
+ case TYPE_DATETIME:
+ {
+ ::com::sun::star::util::Time aTime = lcl_getTime(nValue);
+ ::com::sun::star::util::Date aDate = lcl_getDate(nValue);
+
+ ::com::sun::star::util::DateTime aDateTime;
+ aDateTime.HundredthSeconds = aTime.HundredthSeconds;
+ aDateTime.Seconds = aTime.Seconds;
+ aDateTime.Minutes = aTime.Minutes;
+ aDateTime.Hours = aTime.Hours;
+ aDateTime.Day = aDate.Day;
+ aDateTime.Month = aDate.Month;
+ aDateTime.Year = aDate.Year;
+ aReturn <<= aDateTime;
+ }
+ break;
+ }
+ }
+ else
+ OSL_FAIL("PropertyConversion::convertString: unsupported property type!");
+ }
+ break;
+ default:
+ OSL_FAIL("PropertyConversion::convertString: invalid type class!");
+ }
+
+ return aReturn;
+}
+
+//---------------------------------------------------------------------
+Type PropertyConversion::xmlTypeToUnoType( const ::rtl::OUString& _rType )
+{
+ Type aUnoType( ::getVoidCppuType() );
+
+ DECLARE_STL_USTRINGACCESS_MAP( ::com::sun::star::uno::Type, MapString2Type );
+ static MapString2Type s_aTypeNameMap;
+ if ( s_aTypeNameMap.empty() )
+ {
+ s_aTypeNameMap[ token::GetXMLToken( token::XML_BOOLEAN ) ] = ::getBooleanCppuType();
+ s_aTypeNameMap[ token::GetXMLToken( token::XML_FLOAT ) ] = ::getCppuType( static_cast< double* >(NULL) );
+ s_aTypeNameMap[ token::GetXMLToken( token::XML_STRING ) ] = ::getCppuType( static_cast< ::rtl::OUString* >(NULL) );
+ s_aTypeNameMap[ token::GetXMLToken( token::XML_VOID ) ] = ::getVoidCppuType();
+ }
+
+ const ConstMapString2TypeIterator aTypePos = s_aTypeNameMap.find( _rType );
+ OSL_ENSURE( s_aTypeNameMap.end() != aTypePos, "PropertyConversion::xmlTypeToUnoType: invalid property name!" );
+ if ( s_aTypeNameMap.end() != aTypePos )
+ aUnoType = aTypePos->second;
+
+ return aUnoType;
+}
+
+//=====================================================================
+//= OPropertyImport
+//=====================================================================
+//---------------------------------------------------------------------
+OPropertyImport::OPropertyImport(OFormLayerXMLImport_Impl& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName)
+ :SvXMLImportContext(_rImport.getGlobalContext(), _nPrefix, _rName)
+ ,m_rContext(_rImport)
+ ,m_bTrackAttributes(sal_False)
+{
+}
+
+//---------------------------------------------------------------------
+SvXMLImportContext* OPropertyImport::CreateChildContext(sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
+ const Reference< sax::XAttributeList >& _rxAttrList)
+{
+ if( token::IsXMLToken( _rLocalName, token::XML_PROPERTIES) )
+ {
+ return new OPropertyElementsContext( m_rContext.getGlobalContext(),
+ _nPrefix, _rLocalName, this);
+ }
+ else
+ {
+ OSL_FAIL(::rtl::OString("OPropertyImport::CreateChildContext: unknown sub element (only \"properties\" is recognized, but it is ")
+ += ::rtl::OString(_rLocalName.getStr(), _rLocalName.getLength(), RTL_TEXTENCODING_ASCII_US)
+ += ::rtl::OString(")!"));
+ return SvXMLImportContext::CreateChildContext(_nPrefix, _rLocalName, _rxAttrList);
+ }
+}
+
+//---------------------------------------------------------------------
+void OPropertyImport::StartElement(const Reference< sax::XAttributeList >& _rxAttrList)
+{
+ OSL_ENSURE(_rxAttrList.is(), "OPropertyImport::StartElement: invalid attribute list!");
+ const sal_Int32 nAttributeCount = _rxAttrList->getLength();
+
+ // assume the 'worst' case: all attributes describe properties. This should save our property array
+ // some reallocs
+ m_aValues.reserve(nAttributeCount);
+
+ const SvXMLNamespaceMap& rMap = m_rContext.getGlobalContext().GetNamespaceMap();
+ sal_uInt16 nNamespace;
+ ::rtl::OUString sLocalName;
+ for (sal_Int16 i=0; i<nAttributeCount; ++i)
+ {
+ nNamespace = rMap.GetKeyByAttrName(_rxAttrList->getNameByIndex(i), &sLocalName);
+ handleAttribute(nNamespace, sLocalName, _rxAttrList->getValueByIndex(i));
+
+ if (m_bTrackAttributes)
+ m_aEncounteredAttributes.insert(sLocalName);
+ }
+
+ // TODO: create PropertyValues for all the attributes which were not present, because they were implied
+ // this is necessary as soon as we have properties where the XML default is different from the property
+ // default
+}
+
+//---------------------------------------------------------------------
+sal_Bool OPropertyImport::encounteredAttribute(const ::rtl::OUString& _rAttributeName) const
+{
+ OSL_ENSURE(m_bTrackAttributes, "OPropertyImport::encounteredAttribute: attribute tracking not enabled!");
+ return m_aEncounteredAttributes.end() != m_aEncounteredAttributes.find(_rAttributeName);
+}
+
+//---------------------------------------------------------------------
+void OPropertyImport::Characters(const ::rtl::OUString&
+#if OSL_DEBUG_LEVEL > 0
+_rChars
+#endif
+)
+{
+ // ignore them (should be whitespaces only)
+ OSL_ENSURE(0 == _rChars.trim().getLength(), "OPropertyImport::Characters: non-whitespace characters!");
+}
+
+//---------------------------------------------------------------------
+bool OPropertyImport::handleAttribute(sal_uInt16 /*_nNamespaceKey*/, const ::rtl::OUString& _rLocalName, const ::rtl::OUString& _rValue)
+{
+ const OAttribute2Property::AttributeAssignment* pProperty = m_rContext.getAttributeMap().getAttributeTranslation(_rLocalName);
+ if (pProperty)
+ {
+ // create and store a new PropertyValue
+ PropertyValue aNewValue;
+ aNewValue.Name = pProperty->sPropertyName;
+
+ // convert the value string into the target type
+ aNewValue.Value = PropertyConversion::convertString(m_rContext.getGlobalContext(), pProperty->aPropertyType, _rValue, pProperty->pEnumMap, pProperty->bInverseSemantics);
+ implPushBackPropertyValue( aNewValue );
+ return true;
+ }
+ if (!token::IsXMLToken(_rLocalName, token::XML_TYPE)) // xlink:type is valid but ignored for <form:form>
+ {
+#if OSL_DEBUG_LEVEL > 0
+ ::rtl::OString sMessage( "OPropertyImport::handleAttribute: Can't handle the following:\n" );
+ sMessage += ::rtl::OString( " Attribute name: " );
+ sMessage += ::rtl::OString( _rLocalName.getStr(), _rLocalName.getLength(), osl_getThreadTextEncoding() );
+ sMessage += ::rtl::OString( "\n value: " );
+ sMessage += ::rtl::OString( _rValue.getStr(), _rValue.getLength(), osl_getThreadTextEncoding() );
+ OSL_FAIL( sMessage.getStr() );
+#endif
+ return false;
+ }
+ return true;
+}
+
+//=====================================================================
+//= OPropertyElementsContext
+//=====================================================================
+//---------------------------------------------------------------------
+OPropertyElementsContext::OPropertyElementsContext(SvXMLImport& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const OPropertyImportRef& _rPropertyImporter)
+ :SvXMLImportContext(_rImport, _nPrefix, _rName)
+ ,m_xPropertyImporter(_rPropertyImporter)
+{
+}
+
+//---------------------------------------------------------------------
+SvXMLImportContext* OPropertyElementsContext::CreateChildContext(sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
+ const Reference< sax::XAttributeList >&)
+{
+ if( token::IsXMLToken( _rLocalName, token::XML_PROPERTY ) )
+ {
+ return new OSinglePropertyContext(GetImport(), _nPrefix, _rLocalName, m_xPropertyImporter);
+ }
+ else if( token::IsXMLToken( _rLocalName, token::XML_LIST_PROPERTY ) )
+ {
+ return new OListPropertyContext( GetImport(), _nPrefix, _rLocalName, m_xPropertyImporter );
+ }
+ else
+ {
+ OSL_FAIL(::rtl::OString("OPropertyElementsContext::CreateChildContext: unknown child element (\"")
+ += ::rtl::OString(_rLocalName.getStr(), _rLocalName.getLength(), RTL_TEXTENCODING_ASCII_US)
+ += ::rtl::OString("\")!"));
+ return new SvXMLImportContext(GetImport(), _nPrefix, _rLocalName);
+ }
+}
+
+#if OSL_DEBUG_LEVEL > 0
+ //---------------------------------------------------------------------
+ void OPropertyElementsContext::StartElement(const Reference< sax::XAttributeList >& _rxAttrList)
+ {
+ OSL_ENSURE(0 == _rxAttrList->getLength(), "OPropertyElementsContext::StartElement: the form:properties element should not have attributes!");
+ SvXMLImportContext::StartElement(_rxAttrList);
+ }
+
+ //---------------------------------------------------------------------
+ void OPropertyElementsContext::Characters(const ::rtl::OUString& _rChars)
+ {
+ OSL_ENSURE(0 == _rChars.trim(), "OPropertyElementsContext::Characters: non-whitespace characters detected!");
+ SvXMLImportContext::Characters(_rChars);
+ }
+
+#endif
+
+//=====================================================================
+//= OSinglePropertyContext
+//=====================================================================
+//---------------------------------------------------------------------
+OSinglePropertyContext::OSinglePropertyContext(SvXMLImport& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const OPropertyImportRef& _rPropertyImporter)
+ :SvXMLImportContext(_rImport, _nPrefix, _rName)
+ ,m_xPropertyImporter(_rPropertyImporter)
+{
+}
+
+//---------------------------------------------------------------------
+SvXMLImportContext* OSinglePropertyContext::CreateChildContext(sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
+ const Reference< sax::XAttributeList >&)
+{
+ OSL_FAIL(::rtl::OString("OSinglePropertyContext::CreateChildContext: unknown child element (\"")
+ += ::rtl::OString(_rLocalName.getStr(), _rLocalName.getLength(), RTL_TEXTENCODING_ASCII_US)
+ += ::rtl::OString("\")!"));
+ return new SvXMLImportContext(GetImport(), _nPrefix, _rLocalName);
+}
+
+//---------------------------------------------------------------------
+void OSinglePropertyContext::StartElement(const Reference< sax::XAttributeList >& _rxAttrList)
+{
+ ::com::sun::star::beans::PropertyValue aPropValue; // the property the instance imports currently
+ ::com::sun::star::uno::Type aPropType; // the type of the property the instance imports currently
+
+ ::rtl::OUString sType, sValue;
+ const SvXMLNamespaceMap& rMap = GetImport().GetNamespaceMap();
+ const sal_Int16 nAttrCount = _rxAttrList.is() ? _rxAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const ::rtl::OUString& rAttrName = _rxAttrList->getNameByIndex( i );
+
+ ::rtl::OUString aLocalName;
+ sal_uInt16 nPrefix =
+ rMap.GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ if( XML_NAMESPACE_FORM == nPrefix )
+ {
+ if( token::IsXMLToken( aLocalName, token::XML_PROPERTY_NAME ) )
+ aPropValue.Name = _rxAttrList->getValueByIndex( i );
+
+ }
+ else if( XML_NAMESPACE_OFFICE == nPrefix )
+ {
+ if( token::IsXMLToken( aLocalName, token::XML_VALUE_TYPE ) )
+ sType = _rxAttrList->getValueByIndex( i );
+ else if( token::IsXMLToken( aLocalName,
+ token::XML_VALUE ) ||
+ token::IsXMLToken( aLocalName,
+ token::XML_BOOLEAN_VALUE ) ||
+ token::IsXMLToken( aLocalName,
+ token::XML_STRING_VALUE ) )
+ sValue = _rxAttrList->getValueByIndex( i );
+ }
+ }
+
+ // the name of the property
+ OSL_ENSURE(aPropValue.Name.getLength(), "OSinglePropertyContext::StartElement: invalid property name!");
+
+ // needs to be translated into a ::com::sun::star::uno::Type
+ aPropType = PropertyConversion::xmlTypeToUnoType( sType );
+ if( TypeClass_VOID == aPropType.getTypeClass() )
+ {
+ aPropValue.Value = Any();
+ }
+ else
+ {
+ aPropValue.Value =
+ PropertyConversion::convertString(GetImport(), aPropType,
+ sValue);
+ }
+
+ // now that we finally have our property value, add it to our parent object
+ if( aPropValue.Name.getLength() )
+ m_xPropertyImporter->implPushBackGenericPropertyValue(aPropValue);
+}
+
+//=====================================================================
+//= OListPropertyContext
+//=====================================================================
+//---------------------------------------------------------------------
+OListPropertyContext::OListPropertyContext( SvXMLImport& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const OPropertyImportRef& _rPropertyImporter )
+ :SvXMLImportContext( _rImport, _nPrefix, _rName )
+ ,m_xPropertyImporter( _rPropertyImporter )
+{
+}
+
+//---------------------------------------------------------------------
+void OListPropertyContext::StartElement( const Reference< sax::XAttributeList >& _rxAttrList )
+{
+ sal_Int32 nAttributeCount = _rxAttrList->getLength();
+
+ sal_uInt16 nNamespace;
+ ::rtl::OUString sAttributeName;
+ const SvXMLNamespaceMap& rMap = GetImport().GetNamespaceMap();
+ for ( sal_Int16 i = 0; i < nAttributeCount; ++i )
+ {
+ nNamespace = rMap.GetKeyByAttrName( _rxAttrList->getNameByIndex( i ), &sAttributeName );
+ if ( ( XML_NAMESPACE_FORM == nNamespace )
+ && ( token::IsXMLToken( sAttributeName, token::XML_PROPERTY_NAME ) )
+ )
+ {
+ m_sPropertyName = _rxAttrList->getValueByIndex( i );
+ }
+ else if ( ( XML_NAMESPACE_OFFICE == nNamespace )
+ && ( token::IsXMLToken( sAttributeName, token::XML_VALUE_TYPE ) )
+ )
+ {
+ m_sPropertyType = _rxAttrList->getValueByIndex( i );
+ }
+ else
+ {
+ OSL_FAIL( ::rtl::OString( "OListPropertyContext::StartElement: unknown child element (\"")
+ += ::rtl::OString( sAttributeName.getStr(), sAttributeName.getLength(), RTL_TEXTENCODING_ASCII_US )
+ += ::rtl::OString( "\")!" ) );
+ }
+ }
+}
+
+//---------------------------------------------------------------------
+void OListPropertyContext::EndElement()
+{
+ OSL_ENSURE( m_sPropertyName.getLength() && m_sPropertyType.getLength(),
+ "OListPropertyContext::EndElement: no property name or type!" );
+
+ if ( !m_sPropertyName.getLength() || !m_sPropertyType.getLength() )
+ return;
+
+ Sequence< Any > aListElements( m_aListValues.size() );
+ Any* pListElement = aListElements.getArray();
+ com::sun::star::uno::Type aType = PropertyConversion::xmlTypeToUnoType( m_sPropertyType );
+ for ( ::std::vector< ::rtl::OUString >::const_iterator values = m_aListValues.begin();
+ values != m_aListValues.end();
+ ++values, ++pListElement
+ )
+ {
+ *pListElement = PropertyConversion::convertString( GetImport(), aType, *values );
+ }
+
+ PropertyValue aSequenceValue;
+ aSequenceValue.Name = m_sPropertyName;
+ aSequenceValue.Value <<= aListElements;
+
+ m_xPropertyImporter->implPushBackGenericPropertyValue( aSequenceValue );
+}
+
+//---------------------------------------------------------------------
+SvXMLImportContext* OListPropertyContext::CreateChildContext( sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName, const Reference< sax::XAttributeList >& /*_rxAttrList*/ )
+{
+ if ( token::IsXMLToken( _rLocalName, token::XML_LIST_VALUE ) )
+ {
+ m_aListValues.resize( m_aListValues.size() + 1 );
+ return new OListValueContext( GetImport(), _nPrefix, _rLocalName, *m_aListValues.rbegin() );
+ }
+ else
+ {
+ OSL_FAIL( ::rtl::OString("OListPropertyContext::CreateChildContext: unknown child element (\"")
+ += ::rtl::OString(_rLocalName.getStr(), _rLocalName.getLength(), RTL_TEXTENCODING_ASCII_US)
+ += ::rtl::OString("\")!"));
+ return new SvXMLImportContext( GetImport(), _nPrefix, _rLocalName );
+ }
+}
+
+//=====================================================================
+//= OListValueContext
+//=====================================================================
+//---------------------------------------------------------------------
+OListValueContext::OListValueContext( SvXMLImport& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName, ::rtl::OUString& _rListValueHolder )
+ :SvXMLImportContext( _rImport, _nPrefix, _rName )
+ ,m_rListValueHolder( _rListValueHolder )
+{
+}
+
+//---------------------------------------------------------------------
+void OListValueContext::StartElement( const Reference< sax::XAttributeList >& _rxAttrList )
+{
+ const sal_Int32 nAttributeCount = _rxAttrList->getLength();
+
+ sal_uInt16 nNamespace;
+ ::rtl::OUString sAttributeName;
+ const SvXMLNamespaceMap& rMap = GetImport().GetNamespaceMap();
+ for ( sal_Int16 i = 0; i < nAttributeCount; ++i )
+ {
+ nNamespace = rMap.GetKeyByAttrName( _rxAttrList->getNameByIndex( i ), &sAttributeName );
+ if ( XML_NAMESPACE_OFFICE == nNamespace )
+ {
+ if ( token::IsXMLToken( sAttributeName, token::XML_VALUE )
+ || token::IsXMLToken( sAttributeName, token::XML_STRING_VALUE )
+ || token::IsXMLToken( sAttributeName, token::XML_BOOLEAN_VALUE )
+ )
+ {
+ m_rListValueHolder = _rxAttrList->getValueByIndex( i );
+ continue;
+ }
+ }
+
+ OSL_FAIL( ::rtl::OString( "OListValueContext::StartElement: unknown child element (\"")
+ += ::rtl::OString( sAttributeName.getStr(), sAttributeName.getLength(), RTL_TEXTENCODING_ASCII_US )
+ += ::rtl::OString( "\")!" ) );
+ }
+}
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/propertyimport.hxx b/xmloff/source/forms/propertyimport.hxx
new file mode 100644
index 000000000000..922edbdacbbd
--- /dev/null
+++ b/xmloff/source/forms/propertyimport.hxx
@@ -0,0 +1,255 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_FORMS_PROPERTYIMPORT_HXX_
+#define _XMLOFF_FORMS_PROPERTYIMPORT_HXX_
+
+#include <xmloff/xmlictxt.hxx>
+#include "formattributes.hxx"
+#include <rtl/ref.hxx>
+#include <comphelper/stl_types.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include "layerimport.hxx"
+
+namespace com { namespace sun { namespace star { namespace util {
+ struct Time;
+ struct Date;
+} } } }
+
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ //=====================================================================
+ //= PropertyConversion
+ //=====================================================================
+ class PropertyConversion
+ {
+ public:
+ static ::com::sun::star::uno::Any convertString(
+ SvXMLImport& _rImporter,
+ const ::com::sun::star::uno::Type& _rExpectedType,
+ const ::rtl::OUString& _rReadCharacters,
+ const SvXMLEnumMapEntry* _pEnumMap = NULL,
+ const sal_Bool _bInvertBoolean = sal_False
+ );
+
+ static ::com::sun::star::uno::Type xmlTypeToUnoType( const ::rtl::OUString& _rType );
+ };
+
+ class OFormLayerXMLImport_Impl;
+ //=====================================================================
+ //= OPropertyImport
+ //=====================================================================
+ /** Helper class for importing property values
+
+ <p>This class imports properties which are stored as attributes as well as properties which
+ are stored in </em>&lt;form:properties&gt;</em> elements.</p>
+ */
+ class OPropertyImport : public SvXMLImportContext
+ {
+ friend class OSinglePropertyContext;
+ friend class OListPropertyContext;
+
+ protected:
+ typedef ::std::vector< ::com::sun::star::beans::PropertyValue > PropertyValueArray;
+ PropertyValueArray m_aValues;
+ PropertyValueArray m_aGenericValues;
+ // the values which the instance collects between StartElement and EndElement
+
+ DECLARE_STL_STDKEY_SET( ::rtl::OUString, StringSet );
+ StringSet m_aEncounteredAttributes;
+
+ OFormLayerXMLImport_Impl& m_rContext;
+
+ sal_Bool m_bTrackAttributes;
+
+ // TODO: think about the restriction that the class does not know anything about the object it is importing.
+ // Perhaps this object should be known to the class, so setting the properties ('normal' ones as well as
+ // style properties) can be done in our own EndElement instead of letting derived classes do this.
+
+ public:
+ OPropertyImport(OFormLayerXMLImport_Impl& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName);
+
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
+
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
+ virtual void Characters(const ::rtl::OUString& _rChars);
+
+ protected:
+ /** handle one single attribute.
+
+ <p>This is called for every attribute of the element. This class' implementaion checks if the attribute
+ describes a property, if so, it is added to <member>m_aValues</member>.</p>
+
+ <p>All non-property attributes should be handled in derived classes.</p>
+
+ @param _nNamespaceKey
+ key of the namespace used in the attribute
+ @param _rLocalName
+ local (relative to the namespace) attribute name
+ @param _rValue
+ attribute value
+ */
+ virtual bool handleAttribute(sal_uInt16 _nNamespaceKey,
+ const ::rtl::OUString& _rLocalName,
+ const ::rtl::OUString& _rValue);
+
+ /** determine if the element imported by the object had an given attribute.
+ <p>Please be aware of the fact that the name given must be a local name, i.e. not contain a namespace.
+ All form relevant attributes are in the same namespace, so this would be an redundant information.</p>
+ */
+ sal_Bool encounteredAttribute(const ::rtl::OUString& _rAttributeName) const;
+
+ /** determine if the element imported by the object had an given attribute.
+ <p>Please be aware of the fact that the name given must be a local name, i.e. not contain a namespace.
+ All form relevant attributes are in the same namespace, so this would be an redundant information.</p>
+ */
+ sal_Bool encounteredAttribute(const sal_Char* _pAttributeName) const { return encounteredAttribute(::rtl::OUString::createFromAscii(_pAttributeName)); }
+
+ /** enables the tracking of the encountered attributes
+ <p>The tracking will raise the import costs a little bit, but it's cheaper than
+ derived classes tracking this themself.</p>
+ */
+ void enableTrackAttributes() { m_bTrackAttributes = sal_True; }
+
+ inline void implPushBackPropertyValue(const ::com::sun::star::beans::PropertyValue& _rProp)
+ {
+ m_aValues.push_back(_rProp);
+ }
+
+ inline void implPushBackPropertyValue( const ::rtl::OUString& _rName, const ::com::sun::star::uno::Any& _rValue )
+ {
+ m_aValues.push_back( ::com::sun::star::beans::PropertyValue(
+ _rName, -1, _rValue, ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) );
+ }
+
+ inline void implPushBackGenericPropertyValue(const ::com::sun::star::beans::PropertyValue& _rProp)
+ {
+ m_aGenericValues.push_back(_rProp);
+ }
+ };
+ SV_DECL_IMPL_REF( OPropertyImport )
+
+ //=====================================================================
+ //= OPropertyElementsContext
+ //=====================================================================
+ /** helper class for importing the &lt;form:properties&gt; element
+ */
+ class OPropertyElementsContext : public SvXMLImportContext
+ {
+ protected:
+ OPropertyImportRef m_xPropertyImporter; // to add the properties
+
+ public:
+ OPropertyElementsContext(SvXMLImport& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const OPropertyImportRef& _rPropertyImporter);
+
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
+
+#if OSL_DEBUG_LEVEL > 0
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
+ virtual void Characters(const ::rtl::OUString& _rChars);
+#endif
+ };
+
+ //=====================================================================
+ //= OSinglePropertyContext
+ //=====================================================================
+ /** helper class for importing a single &lt;form:property&gt; element
+ */
+ class OSinglePropertyContext : public SvXMLImportContext
+ {
+ OPropertyImportRef m_xPropertyImporter; // to add the properties
+
+ public:
+ OSinglePropertyContext(SvXMLImport& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const OPropertyImportRef& _rPropertyImporter);
+
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
+
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
+ };
+
+ //=====================================================================
+ //= OListPropertyContext
+ //=====================================================================
+ class OListPropertyContext : public SvXMLImportContext
+ {
+ OPropertyImportRef m_xPropertyImporter;
+ ::rtl::OUString m_sPropertyName;
+ ::rtl::OUString m_sPropertyType;
+ ::std::vector< ::rtl::OUString > m_aListValues;
+
+ public:
+ OListPropertyContext( SvXMLImport& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ const OPropertyImportRef& _rPropertyImporter );
+
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList );
+
+ virtual void EndElement();
+
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
+ };
+
+ //=====================================================================
+ //= OListValueContext
+ //=====================================================================
+ class OListValueContext : public SvXMLImportContext
+ {
+ ::rtl::OUString& m_rListValueHolder;
+
+ public:
+ OListValueContext( SvXMLImport& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ ::rtl::OUString& _rListValueHolder );
+
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList );
+ };
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+#endif // _XMLOFF_FORMS_PROPERTYIMPORT_HXX_
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/strings.cxx b/xmloff/source/forms/strings.cxx
new file mode 100644
index 000000000000..222740b7b2ff
--- /dev/null
+++ b/xmloff/source/forms/strings.cxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#ifndef _XMLOFF_FORMS_STRINGS_HXX_
+#define XMLFORM_IMPLEMENT_STRINGS
+#include "strings.hxx"
+#undef XMLFORM_IMPLEMENT_STRINGS
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/strings.hxx b/xmloff/source/forms/strings.hxx
new file mode 100644
index 000000000000..b98cd42f43c7
--- /dev/null
+++ b/xmloff/source/forms/strings.hxx
@@ -0,0 +1,287 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_FORMS_STRINGS_HXX_
+#define _XMLOFF_FORMS_STRINGS_HXX_
+
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ //============================================================
+ //= a helper for static ascii pseudo-unicode strings
+ //============================================================
+ struct ConstAsciiString
+ {
+ const sal_Char* ascii;
+ sal_Int32 length;
+
+ inline operator const ConstAsciiString* () const { return this; }
+ inline const ::rtl::OUString* operator& () const;
+ inline operator const ::rtl::OUString& () const { return *(&(*this)); }
+ inline operator const sal_Char* () const { return ascii; }
+
+ inline ConstAsciiString(const sal_Char* _pAsciiZeroTerminated, const sal_Int32 _nLength);
+ inline ~ConstAsciiString();
+
+ private:
+ mutable ::rtl::OUString* m_pString;
+
+ private:
+ ConstAsciiString(); // never implemented
+ };
+
+ //------------------------------------------------------------
+ inline ConstAsciiString::ConstAsciiString(const sal_Char* _pAsciiZeroTerminated, const sal_Int32 _nLength)
+ :ascii( _pAsciiZeroTerminated )
+ ,length( _nLength )
+ ,m_pString( NULL )
+ {
+ }
+
+ //------------------------------------------------------------
+ inline ConstAsciiString::~ConstAsciiString()
+ {
+ if ( m_pString )
+ {
+ delete m_pString;
+ m_pString = NULL;
+ }
+ }
+
+ //------------------------------------------------------------
+ inline const ::rtl::OUString* ConstAsciiString::operator& () const
+ {
+ if ( !m_pString )
+ m_pString = new ::rtl::OUString( ascii, length, RTL_TEXTENCODING_ASCII_US );
+ return m_pString;
+ }
+
+#ifndef XMLFORM_IMPLEMENT_STRINGS
+ #define XMLFORM_CONSTASCII_STRING(ident, string) extern const ConstAsciiString ident
+#else
+ #define XMLFORM_CONSTASCII_STRING(ident, string) extern const ConstAsciiString ident(string, sizeof(string)-1)
+#endif
+
+ //============================================================
+ //= string constants
+ //============================================================
+
+ // properties
+ XMLFORM_CONSTASCII_STRING( PROPERTY_CLASSID, "ClassId" );
+ XMLFORM_CONSTASCII_STRING( PROPERTY_ECHOCHAR, "EchoChar" );
+ XMLFORM_CONSTASCII_STRING( PROPERTY_MULTILINE, "MultiLine" );
+ XMLFORM_CONSTASCII_STRING( PROPERTY_NAME, "Name" );
+ XMLFORM_CONSTASCII_STRING( PROPERTY_IMAGEURL, "ImageURL" );
+ XMLFORM_CONSTASCII_STRING( PROPERTY_LABEL, "Label" );
+ XMLFORM_CONSTASCII_STRING( PROPERTY_TARGETFRAME, "TargetFrame" );
+ XMLFORM_CONSTASCII_STRING( PROPERTY_TARGETURL, "TargetURL" );
+ XMLFORM_CONSTASCII_STRING( PROPERTY_TITLE, "Tag" );
+ XMLFORM_CONSTASCII_STRING( PROPERTY_DROPDOWN, "Dropdown" );
+ XMLFORM_CONSTASCII_STRING( PROPERTY_PRINTABLE, "Printable" );
+ XMLFORM_CONSTASCII_STRING( PROPERTY_READONLY, "ReadOnly" );
+ XMLFORM_CONSTASCII_STRING( PROPERTY_DEFAULT_STATE, "DefaultState" );
+ XMLFORM_CONSTASCII_STRING( PROPERTY_TABSTOP, "Tabstop" );
+ XMLFORM_CONSTASCII_STRING( PROPERTY_STATE, "State" );
+ XMLFORM_CONSTASCII_STRING( PROPERTY_ENABLED, "Enabled" );
+ XMLFORM_CONSTASCII_STRING( PROPERTY_ENABLEVISIBLE, "EnableVisible" );
+ XMLFORM_CONSTASCII_STRING( PROPERTY_MAXTEXTLENGTH, "MaxTextLen" );
+ XMLFORM_CONSTASCII_STRING( PROPERTY_LINECOUNT, "LineCount" );
+ XMLFORM_CONSTASCII_STRING( PROPERTY_TABINDEX, "TabIndex" );
+ XMLFORM_CONSTASCII_STRING( PROPERTY_COMMAND, "Command" );
+ XMLFORM_CONSTASCII_STRING( PROPERTY_DATASOURCENAME, "DataSourceName" );
+ XMLFORM_CONSTASCII_STRING( PROPERTY_FILTER, "Filter" );
+ XMLFORM_CONSTASCII_STRING( PROPERTY_ORDER, "Order" );
+ XMLFORM_CONSTASCII_STRING( PROPERTY_ALLOWDELETES, "AllowDeletes" );
+ XMLFORM_CONSTASCII_STRING( PROPERTY_ALLOWINSERTS, "AllowInserts" );
+ XMLFORM_CONSTASCII_STRING( PROPERTY_ALLOWUPDATES, "AllowUpdates" );
+ XMLFORM_CONSTASCII_STRING( PROPERTY_APPLYFILTER, "ApplyFilter" );
+ XMLFORM_CONSTASCII_STRING( PROPERTY_ESCAPEPROCESSING, "EscapeProcessing" );
+ XMLFORM_CONSTASCII_STRING( PROPERTY_IGNORERESULT, "IgnoreResult" );
+ XMLFORM_CONSTASCII_STRING( PROPERTY_SUBMIT_ENCODING, "SubmitEncoding" );
+ XMLFORM_CONSTASCII_STRING( PROPERTY_SUBMIT_METHOD, "SubmitMethod" );
+ XMLFORM_CONSTASCII_STRING( PROPERTY_COMMAND_TYPE, "CommandType" );
+ XMLFORM_CONSTASCII_STRING( PROPERTY_NAVIGATION, "NavigationBarMode" );
+ XMLFORM_CONSTASCII_STRING( PROPERTY_CYCLE, "Cycle" );
+ XMLFORM_CONSTASCII_STRING( PROPERTY_BUTTONTYPE, "ButtonType" );
+ XMLFORM_CONSTASCII_STRING( PROPERTY_DATAFIELD, "DataField" );
+ XMLFORM_CONSTASCII_STRING( PROPERTY_BOUNDCOLUMN, "BoundColumn");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_EMPTY_IS_NULL, "ConvertEmptyToNull");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_INPUT_REQUIRED, "InputRequired");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_LISTSOURCE, "ListSource");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_LISTSOURCETYPE, "ListSourceType");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_ECHO_CHAR, "EchoChar");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_STRICTFORMAT, "StrictFormat");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_AUTOCOMPLETE, "Autocomplete");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_MULTISELECTION, "MultiSelection");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_DEFAULTBUTTON, "DefaultButton");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_TRISTATE, "TriState");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_CONTROLLABEL, "LabelControl");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_STRING_ITEM_LIST, "StringItemList");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_VALUE_SEQ, "ValueItemList");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_DEFAULT_SELECT_SEQ, "DefaultSelection");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_SELECT_SEQ, "SelectedItems");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_DATE_MIN, "DateMin");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_DATE_MAX, "DateMax");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_TIME_MIN, "TimeMin");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_TIME_MAX, "TimeMax");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_VALUE_MIN, "ValueMin");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_VALUE_MAX, "ValueMax");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_EFFECTIVE_MIN, "EffectiveMin");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_EFFECTIVE_MAX, "EffectiveMax");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_DEFAULT_DATE, "DefaultDate");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_DATE, "Date");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_DEFAULT_TIME, "DefaultTime");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_TIME, "Time");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_DEFAULT_VALUE, "DefaultValue");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_VALUE, "Value");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_HIDDEN_VALUE, "HiddenValue");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_DEFAULT_TEXT, "DefaultText");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_TEXT, "Text");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_EFFECTIVE_VALUE, "EffectiveValue");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_EFFECTIVE_DEFAULT, "EffectiveDefault");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_REFVALUE, "RefValue");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_URL, "URL");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_FONT, "FontDescriptor");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_BACKGROUNDCOLOR, "BackgroundColor");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_MASTERFIELDS, "MasterFields");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_DETAILFIELDS, "DetailFields");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_COLUMNSERVICENAME, "ColumnServiceName");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_FORMATKEY, "FormatKey");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_ALIGN, "Align");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_BORDER, "Border");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_AUTOCONTROLFOCUS, "AutomaticControlFocus");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_APPLYDESIGNMODE, "ApplyFormDesignMode");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_FORMATSSUPPLIER, "FormatsSupplier");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_LOCALE, "Locale");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_FORMATSTRING, "FormatString");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_DATEFORMAT, "DateFormat");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_TIMEFORMAT, "TimeFormat");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_PERSISTENCE_MAXTEXTLENGTH, "PersistenceMaxTextLength");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_SCROLLVALUE_MIN, "ScrollValueMin");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_SCROLLVALUE_MAX, "ScrollValueMax");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_SCROLLVALUE, "ScrollValue");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_SCROLLVALUE_DEFAULT,"DefaultScrollValue");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_LINE_INCREMENT, "LineIncrement");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_BLOCK_INCREMENT, "BlockIncrement");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_REPEAT_DELAY, "RepeatDelay");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_SPINVALUE, "SpinValue");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_SPINVALUE_MIN, "SpinValueMin");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_SPINVALUE_MAX, "SpinValueMax");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_DEFAULT_SPINVALUE, "DefaultSpinValue");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_SPIN_INCREMENT, "SpinIncrement");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_ORIENTATION, "Orientation");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_TOGGLE, "Toggle");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_FOCUS_ON_CLICK, "FocusOnClick");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_VISUAL_EFFECT, "VisualEffect");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_IMAGE_POSITION, "ImagePosition");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_IMAGE_ALIGN, "ImageAlign");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_SCALE_IMAGE, "ScaleImage");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_GROUP_NAME, "GroupName");
+
+ XMLFORM_CONSTASCII_STRING( PROPERTY_BOUND_CELL, "BoundCell");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_LIST_CELL_RANGE, "CellRange");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_ADDRESS, "Address");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_FILE_REPRESENTATION,"PersistentRepresentation");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_RICH_TEXT, "RichText");
+
+ // services
+ XMLFORM_CONSTASCII_STRING( SERVICE_FORMSCOLLECTION, "com.sun.star.form.Forms" );
+ XMLFORM_CONSTASCII_STRING( SERVICE_NUMBERFORMATSSUPPLIER, "com.sun.star.util.NumberFormatsSupplier" );
+ XMLFORM_CONSTASCII_STRING( SERVICE_SPREADSHEET_DOCUMENT, "com.sun.star.sheet.SpreadsheetDocument");
+ XMLFORM_CONSTASCII_STRING( SERVICE_CELLVALUEBINDING, "com.sun.star.table.CellValueBinding" );
+ XMLFORM_CONSTASCII_STRING( SERVICE_LISTINDEXCELLBINDING, "com.sun.star.table.ListPositionCellBinding" );
+ XMLFORM_CONSTASCII_STRING( SERVICE_CELLRANGELISTSOURCE, "com.sun.star.table.CellRangeListSource" );
+ XMLFORM_CONSTASCII_STRING( SERVICE_ADDRESS_CONVERSION, "com.sun.star.table.CellAddressConversion");
+ XMLFORM_CONSTASCII_STRING( SERVICE_RANGEADDRESS_CONVERSION, "com.sun.star.table.CellRangeAddressConversion");
+
+ // old service names (compatibility)
+ XMLFORM_CONSTASCII_STRING( SERVICE_PERSISTENT_COMPONENT_FORM, "stardiv.one.form.component.Form");
+ XMLFORM_CONSTASCII_STRING( SERVICE_PERSISTENT_COMPONENT_EDIT, "stardiv.one.form.component.Edit");
+ XMLFORM_CONSTASCII_STRING( SERVICE_PERSISTENT_COMPONENT_LISTBOX, "stardiv.one.form.component.ListBox");
+ XMLFORM_CONSTASCII_STRING( SERVICE_PERSISTENT_COMPONENT_COMBOBOX, "stardiv.one.form.component.ComboBox");
+ XMLFORM_CONSTASCII_STRING( SERVICE_PERSISTENT_COMPONENT_RADIOBUTTON, "stardiv.one.form.component.RadioButton");
+ XMLFORM_CONSTASCII_STRING( SERVICE_PERSISTENT_COMPONENT_GROUPBOX, "stardiv.one.form.component.GroupBox");
+ XMLFORM_CONSTASCII_STRING( SERVICE_PERSISTENT_COMPONENT_FIXEDTEXT, "stardiv.one.form.component.FixedText");
+ XMLFORM_CONSTASCII_STRING( SERVICE_PERSISTENT_COMPONENT_COMMANDBUTTON, "stardiv.one.form.component.CommandButton");
+ XMLFORM_CONSTASCII_STRING( SERVICE_PERSISTENT_COMPONENT_CHECKBOX, "stardiv.one.form.component.CheckBox");
+ XMLFORM_CONSTASCII_STRING( SERVICE_PERSISTENT_COMPONENT_GRID, "stardiv.one.form.component.Grid");
+ XMLFORM_CONSTASCII_STRING( SERVICE_PERSISTENT_COMPONENT_IMAGEBUTTON, "stardiv.one.form.component.ImageButton");
+ XMLFORM_CONSTASCII_STRING( SERVICE_PERSISTENT_COMPONENT_FILECONTROL, "stardiv.one.form.component.FileControl");
+ XMLFORM_CONSTASCII_STRING( SERVICE_PERSISTENT_COMPONENT_TIMEFIELD, "stardiv.one.form.component.TimeField");
+ XMLFORM_CONSTASCII_STRING( SERVICE_PERSISTENT_COMPONENT_DATEFIELD, "stardiv.one.form.component.DateField");
+ XMLFORM_CONSTASCII_STRING( SERVICE_PERSISTENT_COMPONENT_NUMERICFIELD, "stardiv.one.form.component.NumericField");
+ XMLFORM_CONSTASCII_STRING( SERVICE_PERSISTENT_COMPONENT_CURRENCYFIELD, "stardiv.one.form.component.CurrencyField");
+ XMLFORM_CONSTASCII_STRING( SERVICE_PERSISTENT_COMPONENT_PATTERNFIELD, "stardiv.one.form.component.PatternField");
+ XMLFORM_CONSTASCII_STRING( SERVICE_PERSISTENT_COMPONENT_HIDDENCONTROL, "stardiv.one.form.component.Hidden");
+ XMLFORM_CONSTASCII_STRING( SERVICE_PERSISTENT_COMPONENT_IMAGECONTROL, "stardiv.one.form.component.ImageControl");
+ XMLFORM_CONSTASCII_STRING( SERVICE_PERSISTENT_COMPONENT_FORMATTEDFIELD, "stardiv.one.form.component.FormattedField");
+
+ // new service names, the old ones are translated into this new ones
+ XMLFORM_CONSTASCII_STRING( SERVICE_FORM, "com.sun.star.form.component.Form");
+ XMLFORM_CONSTASCII_STRING( SERVICE_EDIT, "com.sun.star.form.component.TextField");
+ XMLFORM_CONSTASCII_STRING( SERVICE_LISTBOX, "com.sun.star.form.component.ListBox");
+ XMLFORM_CONSTASCII_STRING( SERVICE_COMBOBOX, "com.sun.star.form.component.ComboBox");
+ XMLFORM_CONSTASCII_STRING( SERVICE_RADIOBUTTON, "com.sun.star.form.component.RadioButton");
+ XMLFORM_CONSTASCII_STRING( SERVICE_GROUPBOX, "com.sun.star.form.component.GroupBox");
+ XMLFORM_CONSTASCII_STRING( SERVICE_FIXEDTEXT, "com.sun.star.form.component.FixedText");
+ XMLFORM_CONSTASCII_STRING( SERVICE_COMMANDBUTTON, "com.sun.star.form.component.CommandButton");
+ XMLFORM_CONSTASCII_STRING( SERVICE_CHECKBOX, "com.sun.star.form.component.CheckBox");
+ XMLFORM_CONSTASCII_STRING( SERVICE_GRID, "com.sun.star.form.component.GridControl");
+ XMLFORM_CONSTASCII_STRING( SERVICE_IMAGEBUTTON, "com.sun.star.form.component.ImageButton");
+ XMLFORM_CONSTASCII_STRING( SERVICE_FILECONTROL, "com.sun.star.form.component.FileControl");
+ XMLFORM_CONSTASCII_STRING( SERVICE_TIMEFIELD, "com.sun.star.form.component.TimeField");
+ XMLFORM_CONSTASCII_STRING( SERVICE_DATEFIELD, "com.sun.star.form.component.DateField");
+ XMLFORM_CONSTASCII_STRING( SERVICE_NUMERICFIELD, "com.sun.star.form.component.NumericField");
+ XMLFORM_CONSTASCII_STRING( SERVICE_CURRENCYFIELD, "com.sun.star.form.component.CurrencyField");
+ XMLFORM_CONSTASCII_STRING( SERVICE_PATTERNFIELD, "com.sun.star.form.component.PatternField");
+ XMLFORM_CONSTASCII_STRING( SERVICE_HIDDENCONTROL, "com.sun.star.form.component.HiddenControl");
+ XMLFORM_CONSTASCII_STRING( SERVICE_IMAGECONTROL, "com.sun.star.form.component.DatabaseImageControl");
+ XMLFORM_CONSTASCII_STRING( SERVICE_FORMATTEDFIELD, "com.sun.star.form.component.FormattedField" );
+
+ // various strings
+ XMLFORM_CONSTASCII_STRING( EVENT_NAME_SEPARATOR, "::" );
+ XMLFORM_CONSTASCII_STRING( EVENT_TYPE, "EventType" );
+ XMLFORM_CONSTASCII_STRING( EVENT_LIBRARY, "Library" );
+ XMLFORM_CONSTASCII_STRING( EVENT_LOCALMACRONAME, "MacroName" );
+ XMLFORM_CONSTASCII_STRING( EVENT_SCRIPTURL, "Script" );
+ XMLFORM_CONSTASCII_STRING( EVENT_STAROFFICE, "StarOffice" );
+ XMLFORM_CONSTASCII_STRING( EVENT_STARBASIC, "StarBasic" );
+ XMLFORM_CONSTASCII_STRING( EVENT_APPLICATION, "application" );
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+#endif // _XMLOFF_FORMS_STRINGS_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/valueproperties.cxx b/xmloff/source/forms/valueproperties.cxx
new file mode 100644
index 000000000000..59d1b25de22d
--- /dev/null
+++ b/xmloff/source/forms/valueproperties.cxx
@@ -0,0 +1,201 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "valueproperties.hxx"
+#include "strings.hxx"
+#include <com/sun/star/form/FormComponentType.hpp>
+
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ using namespace ::com::sun::star::form;
+
+ //=====================================================================
+ //= OValuePropertiesMetaData
+ //=====================================================================
+ //---------------------------------------------------------------------
+ void OValuePropertiesMetaData::getValuePropertyNames(
+ OControlElement::ElementType _eType, sal_Int16 _nFormComponentType,
+ sal_Char const * & _rpCurrentValuePropertyName, sal_Char const * & _rpValuePropertyName)
+ {
+ // reset the pointers in case we can't determine the property names
+ _rpCurrentValuePropertyName = _rpValuePropertyName = NULL;
+ switch (_nFormComponentType)
+ {
+ case FormComponentType::TEXTFIELD:
+ if (OControlElement::FORMATTED_TEXT == _eType)
+ {
+ _rpCurrentValuePropertyName = PROPERTY_EFFECTIVE_VALUE;
+ _rpValuePropertyName = PROPERTY_EFFECTIVE_DEFAULT;
+ }
+ else
+ {
+ if (OControlElement::PASSWORD != _eType)
+ // no CurrentValue" for passwords
+ _rpCurrentValuePropertyName = PROPERTY_TEXT;
+ _rpValuePropertyName = PROPERTY_DEFAULT_TEXT;
+ }
+ break;
+
+ case FormComponentType::NUMERICFIELD:
+ case FormComponentType::CURRENCYFIELD:
+ _rpCurrentValuePropertyName = PROPERTY_VALUE;
+ _rpValuePropertyName = PROPERTY_DEFAULT_VALUE;
+ break;
+
+ case FormComponentType::PATTERNFIELD:
+ case FormComponentType::FILECONTROL:
+ case FormComponentType::COMBOBOX:
+ _rpValuePropertyName = PROPERTY_DEFAULT_TEXT;
+ // NO BREAK!!
+ case FormComponentType::COMMANDBUTTON:
+ _rpCurrentValuePropertyName = PROPERTY_TEXT;
+ break;
+
+ case FormComponentType::CHECKBOX:
+ case FormComponentType::RADIOBUTTON:
+ _rpValuePropertyName = PROPERTY_REFVALUE;
+ break;
+
+ case FormComponentType::HIDDENCONTROL:
+ _rpValuePropertyName = PROPERTY_HIDDEN_VALUE;
+ break;
+
+ case FormComponentType::SCROLLBAR:
+ _rpCurrentValuePropertyName = PROPERTY_SCROLLVALUE;
+ _rpValuePropertyName = PROPERTY_SCROLLVALUE_DEFAULT;
+ break;
+
+ case FormComponentType::SPINBUTTON:
+ _rpCurrentValuePropertyName = PROPERTY_SPINVALUE;
+ _rpValuePropertyName = PROPERTY_DEFAULT_SPINVALUE;
+ break;
+
+ default:
+ OSL_ENSURE( false, "OValuePropertiesMetaData::getValuePropertyNames: unsupported component type!" );
+ break;
+ }
+ }
+
+
+ //---------------------------------------------------------------------
+ void OValuePropertiesMetaData::getValueLimitPropertyNames(sal_Int16 _nFormComponentType,
+ sal_Char const * & _rpMinValuePropertyName, sal_Char const * & _rpMaxValuePropertyName)
+ {
+ _rpMinValuePropertyName = _rpMaxValuePropertyName = NULL;
+ switch (_nFormComponentType)
+ {
+ case FormComponentType::NUMERICFIELD:
+ case FormComponentType::CURRENCYFIELD:
+ _rpMinValuePropertyName = PROPERTY_VALUE_MIN;
+ _rpMaxValuePropertyName = PROPERTY_VALUE_MAX;
+ break;
+
+ case FormComponentType::TEXTFIELD:
+ _rpMinValuePropertyName = PROPERTY_EFFECTIVE_MIN;
+ _rpMaxValuePropertyName = PROPERTY_EFFECTIVE_MAX;
+ break;
+
+ case FormComponentType::SCROLLBAR:
+ _rpMinValuePropertyName = PROPERTY_SCROLLVALUE_MIN;
+ _rpMaxValuePropertyName = PROPERTY_SCROLLVALUE_MAX;
+ break;
+
+ case FormComponentType::SPINBUTTON:
+ _rpMinValuePropertyName = PROPERTY_SPINVALUE_MIN;
+ _rpMaxValuePropertyName = PROPERTY_SPINVALUE_MAX;
+ break;
+
+ default:
+ OSL_ENSURE( false, "OValuePropertiesMetaData::getValueLimitPropertyNames: unsupported component type!" );
+ break;
+ }
+ }
+
+ //---------------------------------------------------------------------
+ void OValuePropertiesMetaData::getRuntimeValuePropertyNames(
+ OControlElement::ElementType _eType, sal_Int16 _nFormComponentType,
+ sal_Char const * & _rpValuePropertyName, sal_Char const * & _rpDefaultValuePropertyName )
+ {
+ // reset the pointers in case we can't determine the property names
+ _rpValuePropertyName = _rpDefaultValuePropertyName = NULL;
+ switch (_nFormComponentType)
+ {
+ case FormComponentType::TEXTFIELD:
+ if (OControlElement::FORMATTED_TEXT == _eType)
+ {
+ _rpValuePropertyName = PROPERTY_EFFECTIVE_VALUE;
+ _rpDefaultValuePropertyName = PROPERTY_EFFECTIVE_DEFAULT;
+ }
+ else
+ {
+ _rpValuePropertyName = PROPERTY_TEXT;
+ _rpDefaultValuePropertyName = PROPERTY_DEFAULT_TEXT;
+ }
+ break;
+
+ case FormComponentType::DATEFIELD:
+ _rpValuePropertyName = PROPERTY_DATE;
+ _rpDefaultValuePropertyName = PROPERTY_DEFAULT_DATE;
+ break;
+
+ case FormComponentType::TIMEFIELD:
+ _rpValuePropertyName = PROPERTY_TIME;
+ _rpDefaultValuePropertyName = PROPERTY_DEFAULT_TIME;
+ break;
+
+ case FormComponentType::NUMERICFIELD:
+ case FormComponentType::CURRENCYFIELD:
+ case FormComponentType::PATTERNFIELD:
+ case FormComponentType::FILECONTROL:
+ case FormComponentType::COMBOBOX:
+ case FormComponentType::SCROLLBAR:
+ case FormComponentType::SPINBUTTON:
+ // For these types, the runtime properties are the same as the ones which in the XML
+ // stream are named "value properties"
+ getValuePropertyNames( _eType, _nFormComponentType, _rpValuePropertyName, _rpDefaultValuePropertyName );
+ break;
+
+ case FormComponentType::CHECKBOX:
+ case FormComponentType::RADIOBUTTON:
+ _rpValuePropertyName = PROPERTY_STATE;
+ _rpDefaultValuePropertyName = PROPERTY_DEFAULT_STATE;
+ break;
+ }
+ }
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/valueproperties.hxx b/xmloff/source/forms/valueproperties.hxx
new file mode 100644
index 000000000000..f29153653bf4
--- /dev/null
+++ b/xmloff/source/forms/valueproperties.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_FORMS_VALUEPROPERTIES_HXX_
+#define _XMLOFF_FORMS_VALUEPROPERTIES_HXX_
+
+#include "controlelement.hxx"
+
+//.........................................................................
+namespace xmloff
+{
+//.........................................................................
+
+ //=====================================================================
+ //= OValuePropertiesMetaData
+ //=====================================================================
+ class OValuePropertiesMetaData
+ {
+ protected:
+ OValuePropertiesMetaData() { }
+
+ public:
+ /** calculate the property names for the <em>current-value</em> and the <em>value</em> attribute.
+
+ <p>If controls of the given FormComponentType do not have any of the properties requested,
+ the respective out parameter will be set to NULL.</p>
+ */
+ static void getValuePropertyNames(
+ OControlElement::ElementType _eType,
+ sal_Int16 _nFormComponentType,
+ sal_Char const * & _rpCurrentValuePropertyName,
+ sal_Char const * & _rpValuePropertyName);
+
+ /** calculate the property names for the <em>min-value</em> and the <em>max-value</em> attribute.
+
+ <p>If controls of the given FormComponentType do not have any of the properties requested,
+ the respective out parameter will be set to NULL.</p>
+ */
+ static void getValueLimitPropertyNames(
+ sal_Int16 _nFormComponentType,
+ sal_Char const * & _rpMinValuePropertyName,
+ sal_Char const * & _rpMaxValuePropertyName);
+
+ /** calculate the names of the properties which, at runtime, are used for <em>value</em> and
+ <em>default value</em>.
+ */
+ static void getRuntimeValuePropertyNames(
+ OControlElement::ElementType _eType,
+ sal_Int16 _nFormComponentType,
+ sal_Char const * & _rpValuePropertyName,
+ sal_Char const * & _rpDefaultValuePropertyName);
+ };
+
+//.........................................................................
+} // namespace xmloff
+//.........................................................................
+
+#endif // _XMLOFF_FORMS_VALUEPROPERTIES_HXX_
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/meta/MetaExportComponent.cxx b/xmloff/source/meta/MetaExportComponent.cxx
new file mode 100644
index 000000000000..37af37bb498e
--- /dev/null
+++ b/xmloff/source/meta/MetaExportComponent.cxx
@@ -0,0 +1,236 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "MetaExportComponent.hxx"
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <comphelper/genericpropertyset.hxx>
+#include <rtl/ustrbuf.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlmetae.hxx>
+#include "PropertySetMerger.hxx"
+#include <tools/debug.hxx>
+
+#include <unotools/docinfohelper.hxx>
+
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+XMLMetaExportComponent::XMLMetaExportComponent(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ sal_uInt16 nFlags )
+: SvXMLExport( xServiceFactory, MAP_INCH, XML_TEXT, nFlags )
+{
+}
+
+XMLMetaExportComponent::~XMLMetaExportComponent()
+{
+}
+
+void SAL_CALL XMLMetaExportComponent::setSourceDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ try
+ {
+ SvXMLExport::setSourceDocument( xDoc );
+ }
+ catch( lang::IllegalArgumentException& )
+ {
+ // allow to use document properties service without model access
+ // this is required for document properties exporter
+ mxDocProps =
+ uno::Reference< document::XDocumentProperties >::query( xDoc );
+ if( !mxDocProps.is() )
+ throw lang::IllegalArgumentException();
+ }
+}
+
+sal_uInt32 XMLMetaExportComponent::exportDoc( enum XMLTokenEnum )
+{
+ uno::Reference< xml::sax::XDocumentHandler > xDocHandler = GetDocHandler();
+
+ if( (getExportFlags() & EXPORT_OASIS) == 0 )
+ {
+ uno::Reference< lang::XMultiServiceFactory > xFactory = getServiceFactory();
+ if( xFactory.is() )
+ {
+ try
+ {
+ ::comphelper::PropertyMapEntry aInfoMap[] =
+ {
+ { "Class", sizeof("Class")-1, 0,
+ &::getCppuType((::rtl::OUString*)0),
+ beans::PropertyAttribute::MAYBEVOID, 0},
+ { NULL, 0, 0, NULL, 0, 0 }
+ };
+ uno::Reference< beans::XPropertySet > xConvPropSet(
+ ::comphelper::GenericPropertySet_CreateInstance(
+ new ::comphelper::PropertySetInfo( aInfoMap ) ) );
+
+ uno::Any aAny;
+ aAny <<= GetXMLToken( XML_TEXT );
+ xConvPropSet->setPropertyValue(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Class")), aAny );
+
+ uno::Reference< beans::XPropertySet > xPropSet =
+ getExportInfo().is()
+ ? PropertySetMerger_CreateInstance( getExportInfo(),
+ xConvPropSet )
+ : getExportInfo();
+
+ uno::Sequence< uno::Any > aArgs( 3 );
+ aArgs[0] <<= xDocHandler;
+ aArgs[1] <<= xPropSet;
+ aArgs[2] <<= GetModel();
+
+ // get filter component
+ xDocHandler = uno::Reference< xml::sax::XDocumentHandler >(
+ xFactory->createInstanceWithArguments(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Oasis2OOoTransformer")),
+ aArgs),
+ uno::UNO_QUERY_THROW );
+
+ SetDocHandler( xDocHandler );
+ }
+ catch( com::sun::star::uno::Exception& )
+ {
+ OSL_FAIL( "Cannot instantiate com.sun.star.comp.Oasis2OOoTransformer!\n");
+ }
+ }
+ }
+
+
+ xDocHandler->startDocument();
+ {
+
+ const SvXMLNamespaceMap& rMap = GetNamespaceMap();
+ sal_uInt16 nPos = rMap.GetFirstKey();
+ while( USHRT_MAX != nPos )
+ {
+ GetAttrList().AddAttribute( rMap.GetAttrNameByKey( nPos ), rMap.GetNameByKey( nPos ) );
+ nPos = GetNamespaceMap().GetNextKey( nPos );
+ }
+
+ const sal_Char* pVersion = 0;
+ switch( getDefaultVersion() )
+ {
+ case SvtSaveOptions::ODFVER_LATEST: pVersion = "1.2"; break;
+ case SvtSaveOptions::ODFVER_012: pVersion = "1.2"; break;
+ case SvtSaveOptions::ODFVER_011: pVersion = "1.1"; break;
+ case SvtSaveOptions::ODFVER_010: break;
+
+ default:
+ OSL_FAIL("xmloff::XMLMetaExportComponent::exportDoc(), unexpected odf default version!");
+ }
+
+ if( pVersion )
+ AddAttribute( XML_NAMESPACE_OFFICE, XML_VERSION,
+ ::rtl::OUString::createFromAscii(pVersion) );
+
+ SvXMLElementExport aDocElem( *this, XML_NAMESPACE_OFFICE, XML_DOCUMENT_META,
+ sal_True, sal_True );
+
+ // NB: office:meta is now written by _ExportMeta
+ _ExportMeta();
+ }
+ xDocHandler->endDocument();
+ return 0;
+}
+
+void XMLMetaExportComponent::_ExportMeta()
+{
+ if (mxDocProps.is()) {
+ ::rtl::OUString generator( ::utl::DocInfoHelper::GetGeneratorString() );
+ // update generator here
+ mxDocProps->setGenerator(generator);
+ SvXMLMetaExport * pMeta = new SvXMLMetaExport(*this, mxDocProps);
+ uno::Reference<xml::sax::XDocumentHandler> xMeta(pMeta);
+ pMeta->Export();
+ } else {
+ SvXMLExport::_ExportMeta();
+ }
+}
+
+// methods without content:
+void XMLMetaExportComponent::_ExportAutoStyles() {}
+void XMLMetaExportComponent::_ExportMasterStyles() {}
+void XMLMetaExportComponent::_ExportContent() {}
+
+
+uno::Sequence< rtl::OUString > SAL_CALL XMLMetaExportComponent_getSupportedServiceNames()
+ throw()
+{
+ const rtl::OUString aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.XMLOasisMetaExporter" ) );
+ const uno::Sequence< rtl::OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+rtl::OUString SAL_CALL XMLMetaExportComponent_getImplementationName() throw()
+{
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "XMLMetaExportComponent" ) );
+}
+
+uno::Reference< uno::XInterface > SAL_CALL XMLMetaExportComponent_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory > & rSMgr)
+ throw( uno::Exception )
+{
+ return (cppu::OWeakObject*)new XMLMetaExportComponent(rSMgr, EXPORT_META|EXPORT_OASIS);
+}
+
+uno::Sequence< rtl::OUString > SAL_CALL XMLMetaExportOOO_getSupportedServiceNames()
+ throw()
+{
+ const rtl::OUString aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.XMLMetaExporter" ) );
+ const uno::Sequence< rtl::OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+rtl::OUString SAL_CALL XMLMetaExportOOO_getImplementationName() throw()
+{
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "XMLMetaExportOOo" ) );
+}
+
+uno::Reference< uno::XInterface > SAL_CALL XMLMetaExportOOO_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory > & rSMgr)
+ throw( uno::Exception )
+{
+ return (cppu::OWeakObject*)new XMLMetaExportComponent(rSMgr, EXPORT_META);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/meta/MetaImportComponent.cxx b/xmloff/source/meta/MetaImportComponent.cxx
new file mode 100644
index 000000000000..a58cecb1f707
--- /dev/null
+++ b/xmloff/source/meta/MetaImportComponent.cxx
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "MetaImportComponent.hxx"
+#include "xmloff/xmlnmspe.hxx"
+
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlmetai.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <tools/string.hxx>
+
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+
+//===========================================================================
+
+// #110680#
+XMLMetaImportComponent::XMLMetaImportComponent(
+ const uno::Reference< lang::XMultiServiceFactory >& xServiceFactory) throw()
+ : SvXMLImport(xServiceFactory), mxDocProps()
+{
+}
+
+XMLMetaImportComponent::~XMLMetaImportComponent() throw()
+{
+}
+
+
+SvXMLImportContext* XMLMetaImportComponent::CreateContext(
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList > & xAttrList )
+{
+ if ( (XML_NAMESPACE_OFFICE == nPrefix) &&
+ IsXMLToken(rLocalName, XML_DOCUMENT_META) )
+ {
+ if (!mxDocProps.is()) {
+ throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "XMLMetaImportComponent::CreateContext: setTargetDocument "
+ "has not been called")), *this);
+ }
+ uno::Reference<xml::sax::XDocumentHandler> xDocBuilder(
+ mxServiceFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.xml.dom.SAXDocumentBuilder"))),
+ uno::UNO_QUERY_THROW);
+ return new SvXMLMetaDocumentContext(
+ *this, nPrefix, rLocalName, mxDocProps, xDocBuilder);
+ }
+ else
+ {
+ return SvXMLImport::CreateContext(nPrefix, rLocalName, xAttrList);
+ }
+}
+
+void SAL_CALL XMLMetaImportComponent::setTargetDocument(
+ const uno::Reference< lang::XComponent >& xDoc )
+ throw(lang::IllegalArgumentException, uno::RuntimeException)
+{
+ mxDocProps = uno::Reference< document::XDocumentProperties >::query( xDoc );
+ if( !mxDocProps.is() )
+ throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "XMLMetaImportComponent::setTargetDocument: argument is no "
+ "XDocumentProperties")), uno::Reference<uno::XInterface>(*this), 0);
+}
+
+uno::Sequence< rtl::OUString > SAL_CALL
+ XMLMetaImportComponent_getSupportedServiceNames()
+ throw()
+{
+ const rtl::OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.document.XMLOasisMetaImporter" ) );
+ const uno::Sequence< rtl::OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+rtl::OUString SAL_CALL XMLMetaImportComponent_getImplementationName() throw()
+{
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "XMLMetaImportComponent" ) );
+}
+
+uno::Reference< uno::XInterface > SAL_CALL XMLMetaImportComponent_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory > & rSMgr)
+ throw( uno::Exception )
+{
+ // #110680#
+ return (cppu::OWeakObject*)new XMLMetaImportComponent(rSMgr);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/meta/xmlmetae.cxx b/xmloff/source/meta/xmlmetae.cxx
new file mode 100644
index 000000000000..e50be583d072
--- /dev/null
+++ b/xmloff/source/meta/xmlmetae.cxx
@@ -0,0 +1,529 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <tools/debug.hxx>
+#include <tools/inetdef.hxx>
+#include <i18npool/mslangid.hxx>
+#include <tools/urlobj.hxx>
+#include <tools/time.hxx>
+#include <rtl/ustrbuf.hxx>
+
+#include <xmloff/xmlmetae.hxx>
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+
+#include <com/sun/star/beans/XPropertyAccess.hpp>
+#include <com/sun/star/beans/StringPair.hpp>
+#include <com/sun/star/xml/dom/XDocument.hpp>
+#include <com/sun/star/xml/sax/XSAXSerializable.hpp>
+
+#include <comphelper/sequenceasvector.hxx>
+#include <unotools/docinfohelper.hxx>
+
+#include <string.h>
+
+
+using namespace com::sun::star;
+using namespace ::xmloff::token;
+
+
+//-------------------------------------------------------------------------
+
+void lcl_AddTwoDigits( rtl::OUStringBuffer& rStr, sal_Int32 nVal )
+{
+ if ( nVal < 10 )
+ rStr.append( sal_Unicode('0') );
+ rStr.append( nVal );
+}
+
+rtl::OUString
+SvXMLMetaExport::GetISODateTimeString( const util::DateTime& rDateTime )
+{
+ // return ISO date string "YYYY-MM-DDThh:mm:ss"
+
+ rtl::OUStringBuffer sTmp;
+ sTmp.append( (sal_Int32) rDateTime.Year );
+ sTmp.append( sal_Unicode('-') );
+ lcl_AddTwoDigits( sTmp, rDateTime.Month );
+ sTmp.append( sal_Unicode('-') );
+ lcl_AddTwoDigits( sTmp, rDateTime.Day );
+ sTmp.append( sal_Unicode('T') );
+ lcl_AddTwoDigits( sTmp, rDateTime.Hours );
+ sTmp.append( sal_Unicode(':') );
+ lcl_AddTwoDigits( sTmp, rDateTime.Minutes );
+ sTmp.append( sal_Unicode(':') );
+ lcl_AddTwoDigits( sTmp, rDateTime.Seconds );
+
+ return sTmp.makeStringAndClear();
+}
+
+//-------------------------------------------------------------------------
+
+void SvXMLMetaExport::SimpleStringElement( const rtl::OUString& rText,
+ sal_uInt16 nNamespace, enum XMLTokenEnum eElementName )
+{
+ if ( rText.getLength() ) {
+ SvXMLElementExport aElem( mrExport, nNamespace, eElementName,
+ sal_True, sal_False );
+ mrExport.Characters( rText );
+ }
+}
+
+void SvXMLMetaExport::SimpleDateTimeElement( const util::DateTime & rDate,
+ sal_uInt16 nNamespace, enum XMLTokenEnum eElementName )
+{
+ if (rDate.Month != 0) { // invalid dates are 0-0-0
+ rtl::OUString sValue = GetISODateTimeString( rDate );
+ if ( sValue.getLength() ) {
+ SvXMLElementExport aElem( mrExport, nNamespace, eElementName,
+ sal_True, sal_False );
+ mrExport.Characters( sValue );
+ }
+ }
+}
+
+void SvXMLMetaExport::_MExport()
+{
+ // generator
+ {
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_META, XML_GENERATOR,
+ sal_True, sal_True );
+ mrExport.Characters( ::utl::DocInfoHelper::GetGeneratorString() );
+ }
+
+ // document title
+ SimpleStringElement ( mxDocProps->getTitle(),
+ XML_NAMESPACE_DC, XML_TITLE );
+
+ // description
+ SimpleStringElement ( mxDocProps->getDescription(),
+ XML_NAMESPACE_DC, XML_DESCRIPTION );
+
+ // subject
+ SimpleStringElement ( mxDocProps->getSubject(),
+ XML_NAMESPACE_DC, XML_SUBJECT );
+
+ // created...
+ SimpleStringElement ( mxDocProps->getAuthor(),
+ XML_NAMESPACE_META, XML_INITIAL_CREATOR );
+ SimpleDateTimeElement( mxDocProps->getCreationDate(),
+ XML_NAMESPACE_META, XML_CREATION_DATE );
+
+ // modified...
+ SimpleStringElement ( mxDocProps->getModifiedBy(),
+ XML_NAMESPACE_DC, XML_CREATOR );
+ SimpleDateTimeElement( mxDocProps->getModificationDate(),
+ XML_NAMESPACE_DC, XML_DATE );
+
+ // printed...
+ SimpleStringElement ( mxDocProps->getPrintedBy(),
+ XML_NAMESPACE_META, XML_PRINTED_BY );
+ SimpleDateTimeElement( mxDocProps->getPrintDate(),
+ XML_NAMESPACE_META, XML_PRINT_DATE );
+
+ // keywords
+ const uno::Sequence< ::rtl::OUString > keywords = mxDocProps->getKeywords();
+ for (sal_Int32 i = 0; i < keywords.getLength(); ++i) {
+ SvXMLElementExport aKwElem( mrExport, XML_NAMESPACE_META, XML_KEYWORD,
+ sal_True, sal_False );
+ mrExport.Characters( keywords[i] );
+ }
+
+ // document language
+ {
+ const lang::Locale aLocale = mxDocProps->getLanguage();
+ ::rtl::OUString sValue = aLocale.Language;
+ if (sValue.getLength()) {
+ if ( aLocale.Country.getLength() )
+ {
+ sValue += rtl::OUString::valueOf((sal_Unicode)'-');
+ sValue += aLocale.Country;
+ }
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DC, XML_LANGUAGE,
+ sal_True, sal_False );
+ mrExport.Characters( sValue );
+ }
+ }
+
+ // editing cycles
+ {
+ SvXMLElementExport aElem( mrExport,
+ XML_NAMESPACE_META, XML_EDITING_CYCLES,
+ sal_True, sal_False );
+ mrExport.Characters( ::rtl::OUString::valueOf(
+ static_cast<sal_Int32>(mxDocProps->getEditingCycles()) ) );
+ }
+
+ // editing duration
+ // property is a int32 (seconds)
+ {
+ sal_Int32 secs = mxDocProps->getEditingDuration();
+ SvXMLElementExport aElem( mrExport,
+ XML_NAMESPACE_META, XML_EDITING_DURATION,
+ sal_True, sal_False );
+ mrExport.Characters( SvXMLUnitConverter::convertTimeDuration(
+ Time(secs/3600, (secs%3600)/60, secs%60)) );
+ }
+
+ // default target
+ const ::rtl::OUString sDefTarget = mxDocProps->getDefaultTarget();
+ if ( sDefTarget.getLength() )
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_OFFICE, XML_TARGET_FRAME_NAME,
+ sDefTarget );
+
+ //! define strings for xlink:show values
+ const XMLTokenEnum eShow =
+ sDefTarget.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("_blank"))
+ ? XML_NEW : XML_REPLACE;
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, eShow );
+
+ SvXMLElementExport aElem( mrExport,
+ XML_NAMESPACE_META,XML_HYPERLINK_BEHAVIOUR,
+ sal_True, sal_False );
+ }
+
+ // auto-reload
+ const ::rtl::OUString sReloadURL = mxDocProps->getAutoloadURL();
+ const sal_Int32 sReloadDelay = mxDocProps->getAutoloadSecs();
+ if (sReloadDelay != 0 || sReloadURL.getLength() != 0)
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF,
+ mrExport.GetRelativeReference( sReloadURL ) );
+
+ mrExport.AddAttribute( XML_NAMESPACE_META, XML_DELAY,
+ SvXMLUnitConverter::convertTimeDuration(
+ Time(sReloadDelay/3600, (sReloadDelay%3600)/60,
+ sReloadDelay%60 )) );
+
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_META, XML_AUTO_RELOAD,
+ sal_True, sal_False );
+ }
+
+ // template
+ const rtl::OUString sTplPath = mxDocProps->getTemplateURL();
+ if ( sTplPath.getLength() )
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONREQUEST );
+
+ // template URL
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF,
+ mrExport.GetRelativeReference(sTplPath) );
+
+ // template name
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TITLE,
+ mxDocProps->getTemplateName() );
+
+ // template date
+ mrExport.AddAttribute( XML_NAMESPACE_META, XML_DATE,
+ GetISODateTimeString( mxDocProps->getTemplateDate() ) );
+
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_META, XML_TEMPLATE,
+ sal_True, sal_False );
+ }
+
+ // user defined fields
+ uno::Reference< beans::XPropertyAccess > xUserDefined(
+ mxDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW);
+ const uno::Sequence< beans::PropertyValue > props =
+ xUserDefined->getPropertyValues();
+ for (sal_Int32 i = 0; i < props.getLength(); ++i) {
+ ::rtl::OUStringBuffer sValueBuffer;
+ ::rtl::OUStringBuffer sType;
+ if (!SvXMLUnitConverter::convertAny(
+ sValueBuffer, sType, props[i].Value)) {
+ continue;
+ }
+ mrExport.AddAttribute( XML_NAMESPACE_META, XML_NAME, props[i].Name );
+ mrExport.AddAttribute( XML_NAMESPACE_META, XML_VALUE_TYPE,
+ sType.makeStringAndClear() );
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_META,
+ XML_USER_DEFINED, sal_True, sal_False );
+ mrExport.Characters( sValueBuffer.makeStringAndClear() );
+ }
+
+ const uno::Sequence< beans::NamedValue > aDocStatistic =
+ mxDocProps->getDocumentStatistics();
+ // write document statistic if there is any provided
+ if ( aDocStatistic.getLength() )
+ {
+ for ( sal_Int32 nInd = 0; nInd < aDocStatistic.getLength(); nInd++ )
+ {
+ sal_Int32 nValue = 0;
+ if ( aDocStatistic[nInd].Value >>= nValue )
+ {
+ ::rtl::OUString aValue = rtl::OUString::valueOf( nValue );
+ if ( aDocStatistic[nInd].Name.equals( ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "TableCount" ) ) ) )
+ mrExport.AddAttribute(
+ XML_NAMESPACE_META, XML_TABLE_COUNT, aValue );
+ else if ( aDocStatistic[nInd].Name.equals( ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "ObjectCount" ) ) ) )
+ mrExport.AddAttribute(
+ XML_NAMESPACE_META, XML_OBJECT_COUNT, aValue );
+ else if ( aDocStatistic[nInd].Name.equals( ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "ImageCount" ) ) ) )
+ mrExport.AddAttribute(
+ XML_NAMESPACE_META, XML_IMAGE_COUNT, aValue );
+ else if ( aDocStatistic[nInd].Name.equals( ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "PageCount" ) ) ) )
+ mrExport.AddAttribute(
+ XML_NAMESPACE_META, XML_PAGE_COUNT, aValue );
+ else if ( aDocStatistic[nInd].Name.equals( ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "ParagraphCount" ) ) ) )
+ mrExport.AddAttribute(
+ XML_NAMESPACE_META, XML_PARAGRAPH_COUNT, aValue );
+ else if ( aDocStatistic[nInd].Name.equals( ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "WordCount" ) ) ) )
+ mrExport.AddAttribute(
+ XML_NAMESPACE_META, XML_WORD_COUNT, aValue );
+ else if ( aDocStatistic[nInd].Name.equals( ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "CharacterCount" ) ) ) )
+ mrExport.AddAttribute(
+ XML_NAMESPACE_META, XML_CHARACTER_COUNT, aValue );
+ else if ( aDocStatistic[nInd].Name.equals( ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "CellCount" ) ) ) )
+ mrExport.AddAttribute(
+ XML_NAMESPACE_META, XML_CELL_COUNT, aValue );
+ else
+ {
+ DBG_ASSERT( sal_False, "Unknown statistic value!\n" );
+ }
+ }
+ }
+ SvXMLElementExport aElem( mrExport,
+ XML_NAMESPACE_META, XML_DOCUMENT_STATISTIC, sal_True, sal_True );
+ }
+}
+
+//-------------------------------------------------------------------------
+
+static const char *s_xmlns = "xmlns";
+static const char *s_xmlns2 = "xmlns:";
+static const char *s_meta = "meta:";
+static const char *s_href = "xlink:href";
+
+SvXMLMetaExport::SvXMLMetaExport(
+ SvXMLExport& i_rExp,
+ const uno::Reference<document::XDocumentProperties>& i_rDocProps ) :
+ mrExport( i_rExp ),
+ mxDocProps( i_rDocProps ),
+ m_level( 0 ),
+ m_preservedNSs()
+{
+ DBG_ASSERT( mxDocProps.is(), "no document properties" );
+}
+
+SvXMLMetaExport::~SvXMLMetaExport()
+{
+}
+
+void SvXMLMetaExport::Export()
+{
+ uno::Reference< xml::sax::XSAXSerializable> xSAXable(mxDocProps,
+ uno::UNO_QUERY);
+ if (xSAXable.is()) {
+ ::comphelper::SequenceAsVector< beans::StringPair > namespaces;
+ const SvXMLNamespaceMap & rNsMap(mrExport.GetNamespaceMap());
+ for (sal_uInt16 key = rNsMap.GetFirstKey();
+ key != USHRT_MAX; key = rNsMap.GetNextKey(key)) {
+ beans::StringPair ns;
+ const ::rtl::OUString attrname = rNsMap.GetAttrNameByKey(key);
+ if (attrname.matchAsciiL(s_xmlns2, strlen(s_xmlns2))) {
+ ns.First = attrname.copy(strlen(s_xmlns2));
+ } else if (attrname.equalsAsciiL(s_xmlns, strlen(s_xmlns))) {
+ // default initialized empty string
+ } else {
+ OSL_FAIL("namespace attribute not starting with xmlns unexpected");
+ }
+ ns.Second = rNsMap.GetNameByKey(key);
+ namespaces.push_back(ns);
+ }
+ xSAXable->serialize(this, namespaces.getAsConstList());
+ } else {
+ // office:meta
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_OFFICE, XML_META,
+ sal_True, sal_True );
+ // fall back to using public interface of XDocumentProperties
+ _MExport();
+ }
+}
+
+// ::com::sun::star::xml::sax::XDocumentHandler:
+void SAL_CALL
+SvXMLMetaExport::startDocument()
+ throw (uno::RuntimeException, xml::sax::SAXException)
+{
+ // ignore: has already been done by SvXMLExport::exportDoc
+ DBG_ASSERT( m_level == 0, "SvXMLMetaExport: level error" );
+}
+
+void SAL_CALL
+SvXMLMetaExport::endDocument()
+ throw (uno::RuntimeException, xml::sax::SAXException)
+{
+ // ignore: will be done by SvXMLExport::exportDoc
+ DBG_ASSERT( m_level == 0, "SvXMLMetaExport: level error" );
+}
+
+// unfortunately, this method contains far too much ugly namespace mangling.
+void SAL_CALL
+SvXMLMetaExport::startElement(const ::rtl::OUString & i_rName,
+ const uno::Reference< xml::sax::XAttributeList > & i_xAttribs)
+ throw (uno::RuntimeException, xml::sax::SAXException)
+{
+
+ if (m_level == 0) {
+ // namepace decls: default ones have been written at the root element
+ // non-default ones must be preserved here
+ const sal_Int16 nCount = i_xAttribs->getLength();
+ for (sal_Int16 i = 0; i < nCount; ++i) {
+ const ::rtl::OUString name(i_xAttribs->getNameByIndex(i));
+ if (name.matchAsciiL(s_xmlns, strlen(s_xmlns))) {
+ bool found(false);
+ const SvXMLNamespaceMap & rNsMap(mrExport.GetNamespaceMap());
+ for (sal_uInt16 key = rNsMap.GetFirstKey();
+ key != USHRT_MAX; key = rNsMap.GetNextKey(key)) {
+ if (name.equals(rNsMap.GetAttrNameByKey(key))) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ m_preservedNSs.push_back(beans::StringPair(name,
+ i_xAttribs->getValueByIndex(i)));
+ }
+ }
+ }
+ // ignore the root: it has been written already
+ ++m_level;
+ return;
+ }
+
+ if (m_level == 1) {
+ // attach preserved namespace decls from root node here
+ for (std::vector<beans::StringPair>::const_iterator iter =
+ m_preservedNSs.begin(); iter != m_preservedNSs.end(); ++iter) {
+ const ::rtl::OUString ns(iter->First);
+ bool found(false);
+ // but only if it is not already there
+ const sal_Int16 nCount = i_xAttribs->getLength();
+ for (sal_Int16 i = 0; i < nCount; ++i) {
+ const ::rtl::OUString name(i_xAttribs->getNameByIndex(i));
+ if (ns.equals(name)) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ mrExport.AddAttribute(ns, iter->Second);
+ }
+ }
+ }
+
+ // attach the attributes
+ if (i_rName.matchAsciiL(s_meta, strlen(s_meta))) {
+ // special handling for all elements that may have
+ // xlink:href attributes; these must be made relative
+ const sal_Int16 nLength = i_xAttribs->getLength();
+ for (sal_Int16 i = 0; i < nLength; ++i) {
+ const ::rtl::OUString name (i_xAttribs->getNameByIndex (i));
+ ::rtl::OUString value(i_xAttribs->getValueByIndex(i));
+ if (name.matchAsciiL(s_href, strlen(s_href))) {
+ value = mrExport.GetRelativeReference(value);
+ }
+ mrExport.AddAttribute(name, value);
+ }
+ } else {
+ const sal_Int16 nLength = i_xAttribs->getLength();
+ for (sal_Int16 i = 0; i < nLength; ++i) {
+ const ::rtl::OUString name (i_xAttribs->getNameByIndex(i));
+ const ::rtl::OUString value (i_xAttribs->getValueByIndex(i));
+ mrExport.AddAttribute(name, value);
+ }
+ }
+
+ // finally, start the element
+ // #i107240# no whitespace here, because the DOM may already contain
+ // whitespace, which is not cleared when loading and thus accumulates.
+ mrExport.StartElement(i_rName, (m_level > 1) ? sal_False : sal_True);
+ ++m_level;
+}
+
+void SAL_CALL
+SvXMLMetaExport::endElement(const ::rtl::OUString & i_rName)
+ throw (uno::RuntimeException, xml::sax::SAXException)
+{
+ --m_level;
+ if (m_level == 0) {
+ // ignore the root; see startElement
+ return;
+ }
+ DBG_ASSERT( m_level >= 0, "SvXMLMetaExport: level error" );
+ mrExport.EndElement(i_rName, sal_False);
+}
+
+void SAL_CALL
+SvXMLMetaExport::characters(const ::rtl::OUString & i_rChars)
+ throw (uno::RuntimeException, xml::sax::SAXException)
+{
+ mrExport.Characters(i_rChars);
+}
+
+void SAL_CALL
+SvXMLMetaExport::ignorableWhitespace(const ::rtl::OUString & /*i_rWhitespaces*/)
+ throw (uno::RuntimeException, xml::sax::SAXException)
+{
+ mrExport.IgnorableWhitespace(/*i_rWhitespaces*/);
+}
+
+void SAL_CALL
+SvXMLMetaExport::processingInstruction(const ::rtl::OUString & i_rTarget,
+ const ::rtl::OUString & i_rData)
+ throw (uno::RuntimeException, xml::sax::SAXException)
+{
+ // ignore; the exporter cannot handle these
+ (void) i_rTarget;
+ (void) i_rData;
+}
+
+void SAL_CALL
+SvXMLMetaExport::setDocumentLocator(const uno::Reference<xml::sax::XLocator>&)
+ throw (uno::RuntimeException, xml::sax::SAXException)
+{
+ // nothing to do here, move along...
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/meta/xmlmetai.cxx b/xmloff/source/meta/xmlmetai.cxx
new file mode 100644
index 000000000000..a6dbd1d0995e
--- /dev/null
+++ b/xmloff/source/meta/xmlmetai.cxx
@@ -0,0 +1,279 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
+#include <com/sun/star/xml/dom/XSAXDocumentBuilder.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+
+#include <tools/debug.hxx>
+
+#include <xmloff/xmlmetai.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlnmspe.hxx"
+
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using namespace com::sun::star;
+using namespace ::xmloff::token;
+
+
+//===========================================================================
+
+/// builds a DOM tree from SAX events, by forwarding to SAXDocumentBuilder
+class XMLDocumentBuilderContext : public SvXMLImportContext
+{
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XDocumentHandler> mxDocBuilder;
+
+public:
+ XMLDocumentBuilderContext(SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XDocumentHandler>& rDocBuilder);
+
+ virtual ~XMLDocumentBuilderContext();
+
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void Characters( const ::rtl::OUString& rChars );
+
+ virtual void EndElement();
+};
+
+XMLDocumentBuilderContext::XMLDocumentBuilderContext(SvXMLImport& rImport,
+ sal_uInt16 nPrfx, const ::rtl::OUString& rLName,
+ const uno::Reference<xml::sax::XAttributeList>&,
+ const uno::Reference<xml::sax::XDocumentHandler>& rDocBuilder) :
+ SvXMLImportContext( rImport, nPrfx, rLName ),
+ mxDocBuilder(rDocBuilder)
+{
+}
+
+XMLDocumentBuilderContext::~XMLDocumentBuilderContext()
+{
+}
+
+SvXMLImportContext *
+XMLDocumentBuilderContext::CreateChildContext( sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList>& rAttrs)
+{
+ return new XMLDocumentBuilderContext(
+ GetImport(), nPrefix, rLocalName, rAttrs, mxDocBuilder);
+}
+
+void XMLDocumentBuilderContext::StartElement(
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ mxDocBuilder->startElement(
+ GetImport().GetNamespaceMap().GetQNameByKey(GetPrefix(), GetLocalName()),
+ xAttrList);
+}
+
+void XMLDocumentBuilderContext::Characters( const ::rtl::OUString& rChars )
+{
+ mxDocBuilder->characters(rChars);
+}
+
+void XMLDocumentBuilderContext::EndElement()
+{
+ mxDocBuilder->endElement(
+ GetImport().GetNamespaceMap().GetQNameByKey(GetPrefix(), GetLocalName()));
+}
+
+
+//===========================================================================
+
+SvXMLMetaDocumentContext::SvXMLMetaDocumentContext(SvXMLImport& rImport,
+ sal_uInt16 nPrfx, const rtl::OUString& rLName,
+ const uno::Reference<document::XDocumentProperties>& xDocProps,
+ const uno::Reference<xml::sax::XDocumentHandler>& xDocBuilder) :
+ SvXMLImportContext( rImport, nPrfx, rLName ),
+ mxDocProps(xDocProps),
+ mxDocBuilder(xDocBuilder)
+{
+ DBG_ASSERT(xDocProps.is(), "SvXMLMetaDocumentContext: no document props");
+ DBG_ASSERT(xDocBuilder.is(), "SvXMLMetaDocumentContext: no document hdlr");
+ // here are no attributes
+}
+
+SvXMLMetaDocumentContext::~SvXMLMetaDocumentContext()
+{
+}
+
+SvXMLImportContext *SvXMLMetaDocumentContext::CreateChildContext(
+ sal_uInt16 nPrefix, const rtl::OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& rAttrs)
+{
+ if ( (XML_NAMESPACE_OFFICE == nPrefix) &&
+ IsXMLToken(rLocalName, XML_META) )
+ {
+ return new XMLDocumentBuilderContext(
+ GetImport(), nPrefix, rLocalName, rAttrs, mxDocBuilder);
+ }
+ else
+ {
+ return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+ }
+}
+
+
+void SvXMLMetaDocumentContext::StartElement(
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ mxDocBuilder->startDocument();
+ // hardcode office:document-meta (necessary in case of flat file ODF)
+ mxDocBuilder->startElement(
+ GetImport().GetNamespaceMap().GetQNameByKey(GetPrefix(),
+ GetXMLToken(XML_DOCUMENT_META)), xAttrList);
+}
+
+void SvXMLMetaDocumentContext::EndElement()
+{
+ // hardcode office:document-meta (necessary in case of flat file ODF)
+ mxDocBuilder->endElement(
+ GetImport().GetNamespaceMap().GetQNameByKey(GetPrefix(),
+ GetXMLToken(XML_DOCUMENT_META)));
+ mxDocBuilder->endDocument();
+ initDocumentProperties();
+}
+
+void SvXMLMetaDocumentContext::initDocumentProperties()
+{
+ uno::Sequence< uno::Any > aSeq(1);
+ uno::Reference< xml::dom::XSAXDocumentBuilder > xDB (mxDocBuilder,
+ uno::UNO_QUERY_THROW);
+ aSeq[0] <<= xDB->getDocument();
+ uno::Reference< lang::XInitialization > xInit(mxDocProps,
+ uno::UNO_QUERY_THROW);
+ try {
+ xInit->initialize(aSeq);
+ GetImport().SetStatistics(mxDocProps->getDocumentStatistics());
+ // convert all URLs from relative to absolute
+ mxDocProps->setTemplateURL(GetImport().GetAbsoluteReference(
+ mxDocProps->getTemplateURL()));
+ mxDocProps->setAutoloadURL(GetImport().GetAbsoluteReference(
+ mxDocProps->getAutoloadURL()));
+ setBuildId(mxDocProps->getGenerator());
+ } catch (uno::RuntimeException) {
+ throw;
+ } catch (uno::Exception & e) {
+ throw lang::WrappedTargetRuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "SvXMLMetaDocumentContext::initDocumentProperties: "
+ "properties init exception")),
+ GetImport(), makeAny(e));
+ }
+}
+
+void SvXMLMetaDocumentContext::setBuildId(const ::rtl::OUString & i_rBuildId)
+{
+ SvXMLMetaDocumentContext::setBuildId( i_rBuildId, GetImport().getImportInfo() );
+}
+
+//static
+void SvXMLMetaDocumentContext::setBuildId(::rtl::OUString const& i_rBuildId, const uno::Reference<beans::XPropertySet>& xImportInfo )
+{
+ OUString sBuildId;
+ // skip to second product
+ sal_Int32 nBegin = i_rBuildId.indexOf( ' ' );
+ if ( nBegin != -1 )
+ {
+ // skip to build information
+ nBegin = i_rBuildId.indexOf( '/', nBegin );
+ if ( nBegin != -1 )
+ {
+ sal_Int32 nEnd = i_rBuildId.indexOf( 'm', nBegin );
+ if ( nEnd != -1 )
+ {
+ OUStringBuffer sBuffer(
+ i_rBuildId.copy( nBegin+1, nEnd-nBegin-1 ) );
+ const OUString sBuildCompare(
+ RTL_CONSTASCII_USTRINGPARAM( "$Build-" ) );
+ nBegin = i_rBuildId.indexOf( sBuildCompare, nEnd );
+ if ( nBegin != -1 )
+ {
+ sBuffer.append( (sal_Unicode)'$' );
+ sBuffer.append( i_rBuildId.copy(
+ nBegin + sBuildCompare.getLength() ) );
+ sBuildId = sBuffer.makeStringAndClear();
+ }
+ }
+ }
+ }
+
+ if ( sBuildId.getLength() == 0 )
+ {
+ if ((i_rBuildId.compareToAscii(
+ RTL_CONSTASCII_STRINGPARAM("StarOffice 7") ) == 0) ||
+ (i_rBuildId.compareToAscii(
+ RTL_CONSTASCII_STRINGPARAM("StarSuite 7") ) == 0) ||
+ (i_rBuildId.compareToAscii(
+ RTL_CONSTASCII_STRINGPARAM("OpenOffice.org 1") ) == 0))
+ {
+ sBuildId = OUString(RTL_CONSTASCII_USTRINGPARAM("645$8687"));
+ }
+ if ((i_rBuildId.compareToAscii( RTL_CONSTASCII_STRINGPARAM("NeoOffice/2") ) == 0) )
+ {
+ sBuildId = OUString(RTL_CONSTASCII_USTRINGPARAM("680$9134")); // fake NeoOffice as OpenOffice.org 2.2 release
+ }
+ }
+
+ if ( sBuildId.getLength() ) try
+ {
+ if( xImportInfo.is() )
+ {
+ const OUString aPropName(RTL_CONSTASCII_USTRINGPARAM("BuildId"));
+ uno::Reference< beans::XPropertySetInfo > xSetInfo(
+ xImportInfo->getPropertySetInfo());
+ if( xSetInfo.is() && xSetInfo->hasPropertyByName( aPropName ) )
+ xImportInfo->setPropertyValue( aPropName, uno::makeAny( sBuildId ) );
+ }
+ }
+ catch( uno::Exception& )
+ {
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/meta/xmlversion.cxx b/xmloff/source/meta/xmlversion.cxx
new file mode 100644
index 000000000000..8163dd5adbb1
--- /dev/null
+++ b/xmloff/source/meta/xmlversion.cxx
@@ -0,0 +1,513 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/embed/ElementModes.hpp>
+#include <tools/debug.hxx>
+#include <unotools/streamwrap.hxx>
+#include <xmlversion.hxx>
+#include <xmloff/xmlmetae.hxx>
+
+#include <xmloff/xmltoken.hxx>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/xml/sax/InputSource.hpp>
+#include <com/sun/star/xml/sax/XParser.hpp>
+
+#include <tools/string.hxx>
+class SvStringsDtor;
+
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+// ------------------------------------------------------------------------
+
+sal_Char XMLN_VERSIONSLIST[] = "VersionList.xml";
+
+// ------------------------------------------------------------------------
+// #110897#
+XMLVersionListExport::XMLVersionListExport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
+ const com::sun::star::uno::Sequence < com::sun::star::util::RevisionTag >& rVersions,
+ const OUString &rFileName,
+ Reference< XDocumentHandler > &rHandler )
+: SvXMLExport( xServiceFactory, rFileName, rHandler ),
+ maVersions( rVersions )
+{
+ _GetNamespaceMap().AddAtIndex( XML_NAMESPACE_DC_IDX, xmloff::token::GetXMLToken(xmloff::token::XML_NP_DC),
+ xmloff::token::GetXMLToken(xmloff::token::XML_N_DC), XML_NAMESPACE_DC );
+ _GetNamespaceMap().AddAtIndex( XML_NAMESPACE_FRAMEWORK_IDX, xmloff::token::GetXMLToken(xmloff::token::XML_NP_VERSIONS_LIST),
+ xmloff::token::GetXMLToken(xmloff::token::XML_N_VERSIONS_LIST), XML_NAMESPACE_FRAMEWORK );
+}
+
+// ------------------------------------------------------------------------
+sal_uInt32 XMLVersionListExport::exportDoc( enum ::xmloff::token::XMLTokenEnum )
+{
+ GetDocHandler()->startDocument();
+
+ sal_uInt16 nPos = _GetNamespaceMap().GetIndexByKey( XML_NAMESPACE_DC );
+
+ AddAttribute( XML_NAMESPACE_NONE, _GetNamespaceMap().GetAttrNameByIndex( nPos ),
+ _GetNamespaceMap().GetNameByIndex ( nPos ) );
+
+ nPos = _GetNamespaceMap().GetIndexByKey( XML_NAMESPACE_FRAMEWORK );
+ AddAttribute( XML_NAMESPACE_NONE, _GetNamespaceMap().GetAttrNameByIndex( nPos ),
+ _GetNamespaceMap().GetNameByIndex ( nPos ) );
+
+ {
+ // the following object will write all collected attributes in its dtor
+ SvXMLElementExport aRoot( *this, XML_NAMESPACE_FRAMEWORK, xmloff::token::XML_VERSION_LIST, sal_True, sal_True );
+
+ for ( sal_Int32 n=0; n<maVersions.getLength(); n++ )
+ {
+ const util::RevisionTag& rInfo = maVersions[n];
+ AddAttribute( XML_NAMESPACE_FRAMEWORK,
+ xmloff::token::XML_TITLE,
+ OUString( rInfo.Identifier ) );
+ AddAttribute( XML_NAMESPACE_FRAMEWORK,
+ xmloff::token::XML_COMMENT,
+ OUString( rInfo.Comment ) );
+ AddAttribute( XML_NAMESPACE_FRAMEWORK,
+ xmloff::token::XML_CREATOR,
+ OUString( rInfo.Author ) );
+
+ OUString aDateStr =
+ SvXMLMetaExport::GetISODateTimeString( rInfo.TimeStamp );
+
+ AddAttribute( XML_NAMESPACE_DC, xmloff::token::XML_DATE_TIME, aDateStr );
+
+ // the following object will write all collected attributes in its dtor
+ SvXMLElementExport aEntry( *this, XML_NAMESPACE_FRAMEWORK, xmloff::token::XML_VERSION_ENTRY, sal_True, sal_True );
+ }
+ }
+ GetDocHandler()->endDocument();
+ return 0;
+}
+
+// ------------------------------------------------------------------------
+// #110897#
+XMLVersionListImport::XMLVersionListImport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
+ com::sun::star::uno::Sequence < com::sun::star::util::RevisionTag >& rVersions )
+: SvXMLImport(xServiceFactory),
+ maVersions( rVersions )
+{
+ GetNamespaceMap().AddAtIndex( XML_NAMESPACE_FRAMEWORK_IDX, xmloff::token::GetXMLToken(xmloff::token::XML_NP_VERSIONS_LIST),
+ xmloff::token::GetXMLToken(xmloff::token::XML_N_VERSIONS_LIST), XML_NAMESPACE_FRAMEWORK );
+}
+
+// ------------------------------------------------------------------------
+XMLVersionListImport::~XMLVersionListImport( void ) throw()
+{}
+
+// ------------------------------------------------------------------------
+SvXMLImportContext *XMLVersionListImport::CreateContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference< XAttributeList > & xAttrList )
+{
+ SvXMLImportContext *pContext = 0;
+
+ if ( XML_NAMESPACE_FRAMEWORK == nPrefix &&
+ rLocalName == xmloff::token::GetXMLToken(xmloff::token::XML_VERSION_LIST) )
+ {
+ pContext = new XMLVersionListContext( *this, nPrefix, rLocalName, xAttrList );
+ }
+ else
+ {
+ pContext = SvXMLImport::CreateContext( nPrefix, rLocalName, xAttrList );
+ }
+
+ return pContext;
+}
+
+
+// ------------------------------------------------------------------------
+XMLVersionListContext::XMLVersionListContext( XMLVersionListImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference< XAttributeList > & )
+ : SvXMLImportContext( rImport, nPrefix, rLocalName )
+ , rLocalRef( rImport )
+{
+}
+
+// ------------------------------------------------------------------------
+XMLVersionListContext::~XMLVersionListContext( void )
+{}
+
+// ------------------------------------------------------------------------
+SvXMLImportContext *XMLVersionListContext::CreateChildContext( sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference< XAttributeList > & xAttrList )
+{
+ SvXMLImportContext *pContext = 0;
+
+ if ( nPrefix == XML_NAMESPACE_FRAMEWORK &&
+ rLocalName == xmloff::token::GetXMLToken(xmloff::token::XML_VERSION_ENTRY) )
+ {
+ pContext = new XMLVersionContext( rLocalRef, nPrefix, rLocalName, xAttrList );
+ }
+ else
+ {
+ pContext = new SvXMLImportContext( rLocalRef, nPrefix, rLocalName );
+ }
+
+ return pContext;
+}
+
+// ------------------------------------------------------------------------
+XMLVersionContext::XMLVersionContext( XMLVersionListImport& rImport,
+ sal_uInt16 nPref,
+ const OUString& rLocalName,
+ const Reference< XAttributeList > & xAttrList )
+ : SvXMLImportContext( rImport, nPref, rLocalName )
+ , rLocalRef( rImport )
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+
+ if ( !nAttrCount )
+ return;
+
+ util::RevisionTag aInfo;
+ for ( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ OUString aLocalName;
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ sal_uInt16 nPrefix = rImport.GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName );
+
+ if ( XML_NAMESPACE_FRAMEWORK == nPrefix )
+ {
+ if ( aLocalName == xmloff::token::GetXMLToken(xmloff::token::XML_TITLE) )
+ {
+ const OUString& rAttrValue = xAttrList->getValueByIndex( i );
+ aInfo.Identifier = rAttrValue;
+ }
+ else if ( aLocalName == xmloff::token::GetXMLToken(xmloff::token::XML_COMMENT) )
+ {
+ const OUString& rAttrValue = xAttrList->getValueByIndex( i );
+ aInfo.Comment = rAttrValue;
+ }
+ else if ( aLocalName == xmloff::token::GetXMLToken(xmloff::token::XML_CREATOR) )
+ {
+ const OUString& rAttrValue = xAttrList->getValueByIndex( i );
+ aInfo.Author = rAttrValue;
+ }
+ }
+ else if ( ( XML_NAMESPACE_DC == nPrefix ) &&
+ ( aLocalName == xmloff::token::GetXMLToken(xmloff::token::XML_DATE_TIME) ) )
+ {
+ const OUString& rAttrValue = xAttrList->getValueByIndex( i );
+ util::DateTime aTime;
+ if ( ParseISODateTimeString( rAttrValue, aTime ) )
+ aInfo.TimeStamp = aTime;
+ }
+ }
+
+ uno::Sequence < util::RevisionTag >& aList = rLocalRef.GetList();
+ sal_Int32 nLength = aList.getLength();
+ aList.realloc( nLength+1 );
+ aList[nLength] = aInfo;
+}
+
+
+// ------------------------------------------------------------------------
+XMLVersionContext::~XMLVersionContext( void )
+{}
+
+// ------------------------------------------------------------------------
+sal_Bool XMLVersionContext::ParseISODateTimeString(
+ const rtl::OUString& rString,
+ util::DateTime& rDateTime )
+{
+ sal_Bool bSuccess = sal_True;
+
+ OUString aDateStr, aTimeStr;
+ sal_Int32 nPos = rString.indexOf( (sal_Unicode) 'T' );
+ if ( nPos >= 0 )
+ {
+ aDateStr = rString.copy( 0, nPos );
+ aTimeStr = rString.copy( nPos + 1 );
+ }
+ else
+ aDateStr = rString; // no separator: only date part
+
+ sal_Int32 nYear = 0;
+ sal_Int32 nMonth = 1;
+ sal_Int32 nDay = 1;
+ sal_Int32 nHour = 0;
+ sal_Int32 nMin = 0;
+ sal_Int32 nSec = 0;
+
+ const sal_Unicode* pStr = aDateStr.getStr();
+ sal_Int32 nDateTokens = 1;
+ while ( *pStr )
+ {
+ if ( *pStr == '-' )
+ nDateTokens++;
+ pStr++;
+ }
+ if ( nDateTokens > 3 || aDateStr.getLength() == 0 )
+ bSuccess = sal_False;
+ else
+ {
+ sal_Int32 n = 0;
+ nYear = aDateStr.getToken( 0, '-', n ).toInt32();
+ if ( nYear > 9999 )
+ bSuccess = sal_False;
+ else if ( nDateTokens >= 2 )
+ {
+ nMonth = aDateStr.getToken( 0, '-', n ).toInt32();
+ if ( nMonth > 12 )
+ bSuccess = sal_False;
+ else if ( nDateTokens >= 3 )
+ {
+ nDay = aDateStr.getToken( 0, '-', n ).toInt32();
+ if ( nDay > 31 )
+ bSuccess = sal_False;
+ }
+ }
+ }
+
+ if ( bSuccess && aTimeStr.getLength() > 0 ) // time is optional
+ {
+ pStr = aTimeStr.getStr();
+ sal_Int32 nTimeTokens = 1;
+ while ( *pStr )
+ {
+ if ( *pStr == ':' )
+ nTimeTokens++;
+ pStr++;
+ }
+ if ( nTimeTokens > 3 )
+ bSuccess = sal_False;
+ else
+ {
+ sal_Int32 n = 0;
+ nHour = aTimeStr.getToken( 0, ':', n ).toInt32();
+ if ( nHour > 23 )
+ bSuccess = sal_False;
+ else if ( nTimeTokens >= 2 )
+ {
+ nMin = aTimeStr.getToken( 0, ':', n ).toInt32();
+ if ( nMin > 59 )
+ bSuccess = sal_False;
+ else if ( nTimeTokens >= 3 )
+ {
+ nSec = aTimeStr.getToken( 0, ':', n ).toInt32();
+ if ( nSec > 59 )
+ bSuccess = sal_False;
+ }
+ }
+ }
+ }
+
+ if ( bSuccess )
+ {
+ rDateTime.Day = sal::static_int_cast< sal_uInt16 >(nDay);
+ rDateTime.Month = sal::static_int_cast< sal_uInt16 >(nMonth);
+ rDateTime.Year = sal::static_int_cast< sal_uInt16 >(nYear);
+ rDateTime.Hours = sal::static_int_cast< sal_uInt16 >(nHour);
+ rDateTime.Minutes = sal::static_int_cast< sal_uInt16 >(nMin);
+ rDateTime.Seconds = sal::static_int_cast< sal_uInt16 >(nSec);
+ }
+
+ return bSuccess;
+}
+
+
+// ------------------------------------------------------------------------
+void SAL_CALL XMLVersionListPersistence::store( const uno::Reference< embed::XStorage >& xRoot, const uno::Sequence< util::RevisionTag >& rVersions )
+ throw (::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+{
+ // no storage, no version list!
+ if ( xRoot.is() )
+ {
+ // get the services needed for writing the xml data
+ Reference< lang::XMultiServiceFactory > xServiceFactory =
+ comphelper::getProcessServiceFactory();
+ DBG_ASSERT( xServiceFactory.is(), "XMLReader::Read: got no service manager" );
+
+ Reference< XInterface > xWriter (xServiceFactory->createInstance(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer"))));
+ DBG_ASSERT( xWriter.is(), "com.sun.star.xml.sax.Writer service missing" );
+
+ // check wether there's already a sub storage with the version info
+ // and delete it
+ OUString sVerName( RTL_CONSTASCII_USTRINGPARAM( XMLN_VERSIONSLIST ) );
+
+ try {
+ // open (create) the sub storage with the version info
+ uno::Reference< io::XStream > xVerStream = xRoot->openStreamElement(
+ sVerName,
+ embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE );
+ if ( !xVerStream.is() )
+ throw uno::RuntimeException();
+
+ Reference< io::XOutputStream > xOut = xVerStream->getOutputStream();
+ if ( !xOut.is() )
+ throw uno::RuntimeException(); // the stream was successfuly opened for writing already
+
+ Reference< io::XActiveDataSource > xSrc( xWriter, uno::UNO_QUERY );
+ xSrc->setOutputStream(xOut);
+
+ Reference< XDocumentHandler > xHandler( xWriter, uno::UNO_QUERY );
+
+ XMLVersionListExport aExp( xServiceFactory, rVersions, sVerName, xHandler );
+
+ aExp.exportDoc( ::xmloff::token::XML_VERSION );
+
+ xVerStream = uno::Reference< io::XStream >(); // use refcounting for now to dispose
+ }
+ catch( uno::Exception& )
+ {
+ // TODO: error handling
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+uno::Sequence< util::RevisionTag > SAL_CALL XMLVersionListPersistence::load( const uno::Reference< embed::XStorage >& xRoot )
+ throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+{
+ com::sun::star::uno::Sequence < com::sun::star::util::RevisionTag > aVersions;
+
+ const OUString sDocName( RTL_CONSTASCII_USTRINGPARAM( XMLN_VERSIONSLIST ) );
+ uno::Reference< container::XNameAccess > xRootNames( xRoot, uno::UNO_QUERY );
+
+ try {
+ if ( xRootNames.is() && xRootNames->hasByName( sDocName ) && xRoot->isStreamElement( sDocName ) )
+ {
+ Reference< lang::XMultiServiceFactory > xServiceFactory =
+ comphelper::getProcessServiceFactory();
+ DBG_ASSERT( xServiceFactory.is(), "XMLReader::Read: got no service manager" );
+
+ InputSource aParserInput;
+
+ uno::Reference< beans::XPropertySet > xProps( xRoot, uno::UNO_QUERY );
+ OSL_ENSURE( xProps.is(), "Storage must implement XPropertySet!\n" );
+ if ( xProps.is() )
+ {
+ try {
+ xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL")) ) >>= aParserInput.sSystemId;
+ }
+ catch( uno::Exception& )
+ {}
+ }
+
+ uno::Reference< io::XStream > xDocStream = xRoot->openStreamElement(
+ sDocName,
+ embed::ElementModes::READ );
+ if ( !xDocStream.is() )
+ throw uno::RuntimeException();
+
+ aParserInput.aInputStream = xDocStream->getInputStream();
+ OSL_ENSURE( aParserInput.aInputStream.is(),
+ "The stream was successfuly opened for reading, the input part must be accessible!\n" );
+ if ( !aParserInput.aInputStream.is() )
+ throw uno::RuntimeException();
+
+ // get parser
+ Reference< XInterface > xXMLParser = xServiceFactory->createInstance(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser")) );
+ DBG_ASSERT( xXMLParser.is(),
+ "XMLReader::Read: com.sun.star.xml.sax.Parser service missing" );
+
+ // get filter
+ Reference< XDocumentHandler > xFilter = new XMLVersionListImport( xServiceFactory, aVersions );
+
+ // connect parser and filter
+ Reference< XParser > xParser( xXMLParser, UNO_QUERY );
+ xParser->setDocumentHandler( xFilter );
+
+ // parse
+ try
+ {
+ xParser->parseStream( aParserInput );
+ }
+ catch( SAXParseException& ) {}
+ catch( SAXException& ) {}
+ catch( io::IOException& ) {}
+ }
+ }
+ catch( uno::Exception& )
+ {
+ // TODO: error handling
+ }
+
+ return aVersions;
+}
+
+uno::Sequence< rtl::OUString > SAL_CALL XMLVersionListPersistence_getSupportedServiceNames()
+ throw()
+{
+ const rtl::OUString aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.DocumentRevisionListPersistence" ) );
+ const uno::Sequence< rtl::OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+rtl::OUString SAL_CALL XMLVersionListPersistence_getImplementationName() throw()
+{
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "XMLVersionListPersistence" ) );
+}
+
+uno::Reference< uno::XInterface > SAL_CALL XMLVersionListPersistence_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory > &)
+ throw( uno::Exception )
+{
+ return (cppu::OWeakObject*)new XMLVersionListPersistence;
+}
+
+uno::Sequence< rtl::OUString > SAL_CALL XMLVersionImExportOOO_getSupportedServiceNames()
+ throw()
+{
+ const rtl::OUString aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.DocumentRevisionListPersistence" ) );
+ const uno::Sequence< rtl::OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+rtl::OUString SAL_CALL XMLVersionImExportOOO_getImplementationName() throw()
+{
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "XMLVersionImExportOOo" ) );
+}
+
+uno::Reference< uno::XInterface > SAL_CALL XMLVersionImExportOOO_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory > &)
+ throw( uno::Exception )
+{
+ return (cppu::OWeakObject*)new XMLVersionListPersistence;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/script/XMLEventExport.cxx b/xmloff/source/script/XMLEventExport.cxx
new file mode 100644
index 000000000000..ebb339348097
--- /dev/null
+++ b/xmloff/source/script/XMLEventExport.cxx
@@ -0,0 +1,364 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <xmloff/XMLEventExport.hxx>
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+#include <com/sun/star/document/XEventsSupplier.hpp>
+
+#include <com/sun/star/container/XNameReplace.hpp>
+#include <tools/debug.hxx>
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+
+
+using namespace ::com::sun::star::uno;
+
+using std::map;
+using ::rtl::OUString;
+using ::com::sun::star::beans::PropertyValue;
+using ::com::sun::star::document::XEventsSupplier;
+using ::com::sun::star::container::XNameReplace;
+using ::com::sun::star::container::XNameAccess;
+using ::xmloff::token::GetXMLToken;
+using ::xmloff::token::XML_EVENT_LISTENERS;
+
+
+XMLEventExport::XMLEventExport(SvXMLExport& rExp,
+ const XMLEventNameTranslation* pTranslationTable) :
+ sEventType(RTL_CONSTASCII_USTRINGPARAM("EventType")),
+ rExport(rExp),
+ bExtNamespace(false)
+{
+ AddTranslationTable(pTranslationTable);
+}
+
+XMLEventExport::~XMLEventExport()
+{
+ // delete all handlers
+ HandlerMap::iterator aEnd = aHandlerMap.end();
+ for( HandlerMap::iterator aIter =
+ aHandlerMap.begin();
+ aIter != aEnd;
+ ++aIter )
+ {
+ delete aIter->second;
+ }
+ aHandlerMap.clear();
+}
+
+void XMLEventExport::AddHandler( const OUString& rName,
+ XMLEventExportHandler* pHandler )
+{
+ DBG_ASSERT(pHandler != NULL, "Need EventExportHandler");
+ if (pHandler != NULL)
+ {
+ aHandlerMap[rName] = pHandler;
+ }
+}
+
+void XMLEventExport::AddTranslationTable(
+ const XMLEventNameTranslation* pTransTable )
+{
+ if (NULL != pTransTable)
+ {
+ // put translation table into map
+ for(const XMLEventNameTranslation* pTrans = pTransTable;
+ pTrans->sAPIName != NULL;
+ pTrans++)
+ {
+ aNameTranslationMap[OUString::createFromAscii(pTrans->sAPIName)] =
+ XMLEventName(pTrans->nPrefix, pTrans->sXMLName);
+ }
+ }
+ // else? ignore!
+}
+
+void XMLEventExport::Export( Reference<XEventsSupplier> & rSupplier,
+ sal_Bool bWhitespace)
+{
+ if (rSupplier.is())
+ {
+ Reference<XNameAccess> xAccess(rSupplier->getEvents(), UNO_QUERY);
+ Export(xAccess, bWhitespace);
+ }
+ // else: no supplier, no export -> ignore!
+}
+
+void XMLEventExport::Export( Reference<XNameReplace> & rReplace,
+ sal_Bool bWhitespace)
+{
+ Reference<XNameAccess> xAccess(rReplace, UNO_QUERY);
+ Export(xAccess, bWhitespace);
+}
+
+void XMLEventExport::Export( Reference<XNameAccess> & rAccess,
+ sal_Bool bWhitespace)
+{
+ // early out if we don't actually get any events
+ if (!rAccess.is())
+ {
+ return;
+ }
+
+ // have we already processed an element?
+ sal_Bool bStarted = sal_False;
+
+ // iterate over all event types
+ Sequence<OUString> aNames = rAccess->getElementNames();
+ sal_Int32 nCount = aNames.getLength();
+ for(sal_Int32 i = 0; i < nCount; i++)
+ {
+ // translate name
+ NameMap::iterator aIter = aNameTranslationMap.find(aNames[i]);
+ if (aIter != aNameTranslationMap.end())
+ {
+ const XMLEventName& rXmlName = aIter->second;
+
+ // get PropertyValues for this event
+ Any aAny = rAccess->getByName( aNames[i] );
+ Sequence<PropertyValue> aValues;
+ aAny >>= aValues;
+
+ // now export the current event
+ ExportEvent( aValues, rXmlName, bWhitespace, bStarted );
+ }
+#ifdef DBG_UTIL
+ else
+ {
+ // don't proceed further
+ ::rtl::OString aStr("Unknown event name:" );
+ aStr += ::rtl::OUStringToOString( aNames[i], RTL_TEXTENCODING_UTF8 );
+ OSL_FAIL( aStr.getStr() );
+ }
+#endif
+ }
+
+ // close <script:events> element (if it was opened before)
+ if (bStarted)
+ {
+ EndElement(bWhitespace);
+ }
+}
+
+void XMLEventExport::ExportExt( Reference<XNameAccess> & rAccess,
+ sal_Bool bWhitespace )
+{
+ // set bExtNamespace flag to use XML_NAMESPACE_OFFICE_EXT namespace
+ // for events element (not for child elements)
+ bExtNamespace = true;
+ Export(rAccess, bWhitespace);
+ bExtNamespace = false; // reset for future Export calls
+}
+
+/// export a singular event and wirte <office:events> container
+void XMLEventExport::ExportSingleEvent(
+ Sequence<PropertyValue>& rEventValues,
+ const OUString& rApiEventName,
+ sal_Bool bUseWhitespace )
+{
+ // translate the name
+ NameMap::iterator aIter = aNameTranslationMap.find(rApiEventName);
+ if (aIter != aNameTranslationMap.end())
+ {
+ const XMLEventName& rXmlName = aIter->second;
+
+ // export the event ...
+ sal_Bool bStarted = sal_False;
+ ExportEvent( rEventValues, rXmlName, bUseWhitespace, bStarted );
+
+ // ... and close the container element (if necessary)
+ if (bStarted)
+ {
+ EndElement(bUseWhitespace);
+ }
+ }
+#ifdef DBG_UTIL
+ else
+ {
+ // don't proceed further
+ ::rtl::OString aStr("Unknown event name:" );
+ aStr += ::rtl::OUStringToOString( rApiEventName, RTL_TEXTENCODING_UTF8 );
+ OSL_FAIL( aStr.getStr() );
+ }
+#endif
+}
+
+
+/// export a single event
+void XMLEventExport::ExportEvent(
+ Sequence<PropertyValue>& rEventValues,
+ const XMLEventName& rXmlEventName,
+ sal_Bool bUseWhitespace,
+ sal_Bool& rExported )
+{
+ // search for EventType value and then delegate to EventHandler
+ sal_Int32 nValues = rEventValues.getLength();
+ const PropertyValue* pValues = rEventValues.getConstArray();
+
+ for(sal_Int32 nVal = 0; nVal < nValues; nVal++)
+ {
+ if (sEventType.equals(pValues[nVal].Name))
+ {
+ // found! Now find handler and delegate
+ OUString sType;
+ pValues[nVal].Value >>= sType;
+
+ if (aHandlerMap.count(sType))
+ {
+ if (! rExported)
+ {
+ // OK, we have't yet exported the enclosing
+ // element. So we do that now.
+ rExported = sal_True;
+ StartElement(bUseWhitespace);
+ }
+
+ OUString aEventQName(
+ rExport.GetNamespaceMap().GetQNameByKey(
+ rXmlEventName.m_nPrefix, rXmlEventName.m_aName ) );
+
+ // delegate to proper ExportEventHandler
+ aHandlerMap[sType]->Export(rExport, aEventQName,
+ rEventValues, bUseWhitespace);
+ }
+ else
+ {
+ if (! sType.equalsAsciiL("None", sizeof("None")-1))
+ {
+ OSL_FAIL("unknown event type returned by API");
+ // unknown type -> error (ignore)
+ }
+ // else: we ignore None fields
+ }
+
+ // early out: we don't need to look for another type
+ break;
+ }
+ // else: we only care for EventType -> ignore
+ }
+}
+
+
+void XMLEventExport::StartElement(sal_Bool bWhitespace)
+{
+ if (bWhitespace)
+ {
+ rExport.IgnorableWhitespace();
+ }
+ sal_uInt16 nNamespace = bExtNamespace ? XML_NAMESPACE_OFFICE_EXT
+ : XML_NAMESPACE_OFFICE;
+ rExport.StartElement( nNamespace, XML_EVENT_LISTENERS,
+ bWhitespace);
+}
+
+void XMLEventExport::EndElement(sal_Bool bWhitespace)
+{
+ sal_uInt16 nNamespace = bExtNamespace ? XML_NAMESPACE_OFFICE_EXT
+ : XML_NAMESPACE_OFFICE;
+ rExport.EndElement(nNamespace, XML_EVENT_LISTENERS, bWhitespace);
+ if (bWhitespace)
+ {
+ rExport.IgnorableWhitespace();
+ }
+}
+
+
+// implement aStandardEventTable (defined in xmlevent.hxx)
+const XMLEventNameTranslation aStandardEventTable[] =
+{
+ { "OnSelect", XML_NAMESPACE_DOM, "select" }, // "on-select"
+ { "OnInsertStart", XML_NAMESPACE_OFFICE, "insert-start" }, // "on-insert-start"
+ { "OnInsertDone", XML_NAMESPACE_OFFICE, "insert-done" }, // "on-insert-done"
+ { "OnMailMerge", XML_NAMESPACE_OFFICE, "mail-merge" }, // "on-mail-merge"
+ { "OnAlphaCharInput", XML_NAMESPACE_OFFICE, "alpha-char-input" }, // "on-alpha-char-input"
+ { "OnNonAlphaCharInput", XML_NAMESPACE_OFFICE, "non-alpha-char-input" }, // "on-non-alpha-char-input"
+ { "OnResize", XML_NAMESPACE_DOM, "resize" }, // "on-resize"
+ { "OnMove", XML_NAMESPACE_OFFICE, "move" }, // "on-move"
+ { "OnPageCountChange", XML_NAMESPACE_OFFICE, "page-count-change" }, // "on-page-count-change"
+ { "OnMouseOver", XML_NAMESPACE_DOM, "mouseover" }, // "on-mouse-over"
+ { "OnClick", XML_NAMESPACE_DOM, "click" }, // "on-click"
+ { "OnMouseOut", XML_NAMESPACE_DOM, "mouseout" }, // "on-mouse-out"
+ { "OnLoadError", XML_NAMESPACE_OFFICE, "load-error" }, // "on-load-error"
+ { "OnLoadCancel", XML_NAMESPACE_OFFICE, "load-cancel" }, // "on-load-cancel"
+ { "OnLoadDone", XML_NAMESPACE_OFFICE, "load-done" }, // "on-load-done"
+ { "OnLoad", XML_NAMESPACE_DOM, "load" }, // "on-load"
+ { "OnUnload", XML_NAMESPACE_DOM, "unload" }, // "on-unload"
+ { "OnStartApp", XML_NAMESPACE_OFFICE, "start-app" }, // "on-start-app"
+ { "OnCloseApp", XML_NAMESPACE_OFFICE, "close-app" }, // "on-close-app"
+ { "OnNew", XML_NAMESPACE_OFFICE, "new" }, // "on-new"
+ { "OnSave", XML_NAMESPACE_OFFICE, "save" }, // "on-save"
+ { "OnSaveAs", XML_NAMESPACE_OFFICE, "save-as" }, // "on-save-as"
+ { "OnFocus", XML_NAMESPACE_DOM, "DOMFocusIn" }, // "on-focus"
+ { "OnUnfocus", XML_NAMESPACE_DOM, "DOMFocusOut" }, // "on-unfocus"
+ { "OnPrint", XML_NAMESPACE_OFFICE, "print" }, // "on-print"
+ { "OnError", XML_NAMESPACE_DOM, "error" }, // "on-error"
+ { "OnLoadFinished", XML_NAMESPACE_OFFICE, "load-finished" }, // "on-load-finished"
+ { "OnSaveFinished", XML_NAMESPACE_OFFICE, "save-finished" }, // "on-save-finished"
+ { "OnModifyChanged", XML_NAMESPACE_OFFICE, "modify-changed" }, // "on-modify-changed"
+ { "OnPrepareUnload", XML_NAMESPACE_OFFICE, "prepare-unload" }, // "on-prepare-unload"
+ { "OnNewMail", XML_NAMESPACE_OFFICE, "new-mail" }, // "on-new-mail"
+ { "OnToggleFullscreen", XML_NAMESPACE_OFFICE, "toggle-fullscreen" }, // "on-toggle-fullscreen"
+ { "OnSaveDone", XML_NAMESPACE_OFFICE, "save-done" }, // "on-save-done"
+ { "OnSaveAsDone", XML_NAMESPACE_OFFICE, "save-as-done" }, // "on-save-as-done"
+ { "OnCopyTo", XML_NAMESPACE_OFFICE, "copy-to" },
+ { "OnCopyToDone", XML_NAMESPACE_OFFICE, "copy-to-done" },
+ { "OnViewCreated", XML_NAMESPACE_OFFICE, "view-created" },
+ { "OnPrepareViewClosing", XML_NAMESPACE_OFFICE, "prepare-view-closing" },
+ { "OnViewClosed", XML_NAMESPACE_OFFICE, "view-close" },
+ { "OnVisAreaChanged", XML_NAMESPACE_OFFICE, "visarea-changed" }, // "on-visarea-changed"
+ { "OnCreate", XML_NAMESPACE_OFFICE, "create" },
+ { "OnSaveAsFailed", XML_NAMESPACE_OFFICE, "save-as-failed" },
+ { "OnSaveFailed", XML_NAMESPACE_OFFICE, "save-failed" },
+ { "OnCopyToFailed", XML_NAMESPACE_OFFICE, "copy-to-failed" },
+ { "OnTitleChanged", XML_NAMESPACE_OFFICE, "title-changed" },
+ { "OnModeChanged", XML_NAMESPACE_OFFICE, "mode-changed" },
+ { "OnSaveTo", XML_NAMESPACE_OFFICE, "save-to" },
+ { "OnSaveToDone", XML_NAMESPACE_OFFICE, "save-to-done" },
+ { "OnSaveToFailed", XML_NAMESPACE_OFFICE, "save-to-failed" },
+ { "OnSubComponentOpened", XML_NAMESPACE_OFFICE, "subcomponent-opened" },
+ { "OnSubComponentClosed", XML_NAMESPACE_OFFICE, "subcomponent-closed" },
+ { "OnStorageChanged", XML_NAMESPACE_OFFICE, "storage-changed" },
+ { "OnMailMergeFinished", XML_NAMESPACE_OFFICE, "mail-merge-finished" },
+ { "OnFieldMerge", XML_NAMESPACE_OFFICE, "field-merge" },
+ { "OnFieldMergeFinished", XML_NAMESPACE_OFFICE, "field-merge-finished" },
+ { "OnLayoutFinished", XML_NAMESPACE_OFFICE, "layout-finished" },
+ { "OnDoubleClick", XML_NAMESPACE_OFFICE, "dblclick" },
+ { "OnRightClick", XML_NAMESPACE_OFFICE, "contextmenu" },
+ { "OnChange", XML_NAMESPACE_OFFICE, "content-changed" },
+ { "OnCalculate", XML_NAMESPACE_OFFICE, "calculated" },
+
+ { NULL, 0, 0 }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/script/XMLEventImportHelper.cxx b/xmloff/source/script/XMLEventImportHelper.cxx
new file mode 100644
index 000000000000..991d3159516a
--- /dev/null
+++ b/xmloff/source/script/XMLEventImportHelper.cxx
@@ -0,0 +1,180 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "XMLEventImportHelper.hxx"
+#include <tools/debug.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include "xmloff/xmlerror.hxx"
+
+using ::rtl::OUString;
+using ::com::sun::star::xml::sax::XAttributeList;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+
+XMLEventImportHelper::XMLEventImportHelper() :
+ aFactoryMap(),
+ pEventNameMap(new NameMap()),
+ aEventNameMapList()
+{
+}
+
+
+XMLEventImportHelper::~XMLEventImportHelper()
+{
+ // delete factories
+ FactoryMap::iterator aEnd = aFactoryMap.end();
+ for(FactoryMap::iterator aIter = aFactoryMap.begin();
+ aIter != aEnd;
+ ++aIter)
+ {
+ delete aIter->second;
+ }
+ aFactoryMap.clear();
+
+ // delete name map
+ delete pEventNameMap;
+}
+
+void XMLEventImportHelper::RegisterFactory(
+ const OUString& rLanguage,
+ XMLEventContextFactory* pFactory )
+{
+ DBG_ASSERT(pFactory != NULL, "I need a factory.");
+ if (NULL != pFactory)
+ {
+ aFactoryMap[rLanguage] = pFactory;
+ }
+}
+
+void XMLEventImportHelper::AddTranslationTable(
+ const XMLEventNameTranslation* pTransTable )
+{
+ if (NULL != pTransTable)
+ {
+ // put translation table into map
+ for(const XMLEventNameTranslation* pTrans = pTransTable;
+ pTrans->sAPIName != NULL;
+ pTrans++)
+ {
+ XMLEventName aName( pTrans->nPrefix, pTrans->sXMLName );
+
+ // check for conflicting entries
+ DBG_ASSERT(pEventNameMap->find(aName) == pEventNameMap->end(),
+ "conflicting event translations");
+
+ // assign new translation
+ (*pEventNameMap)[aName] =
+ OUString::createFromAscii(pTrans->sAPIName);
+ }
+ }
+ // else? ignore!
+}
+
+void XMLEventImportHelper::PushTranslationTable()
+{
+ // save old map and install new one
+ aEventNameMapList.push_back(pEventNameMap);
+ pEventNameMap = new NameMap();
+}
+
+void XMLEventImportHelper::PopTranslationTable()
+{
+ DBG_ASSERT(aEventNameMapList.size() > 0,
+ "no translation tables left to pop");
+ if ( !aEventNameMapList.empty() )
+ {
+ // delete current and install old map
+ delete pEventNameMap;
+ pEventNameMap = aEventNameMapList.back();
+ aEventNameMapList.pop_back();
+ }
+}
+
+
+SvXMLImportContext* XMLEventImportHelper::CreateContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList,
+ XMLEventsImportContext* rEvents,
+ const OUString& rXmlEventName,
+ const OUString& rLanguage)
+{
+ SvXMLImportContext* pContext = NULL;
+
+ // translate event name form xml to api
+ OUString sMacroName;
+ sal_uInt16 nMacroPrefix =
+ rImport.GetNamespaceMap().GetKeyByAttrName( rXmlEventName,
+ &sMacroName );
+ XMLEventName aEventName( nMacroPrefix, sMacroName );
+ NameMap::iterator aNameIter = pEventNameMap->find(aEventName);
+ if (aNameIter != pEventNameMap->end())
+ {
+ OUString aScriptLanguage;
+ sal_uInt16 nScriptPrefix = rImport.GetNamespaceMap().
+ GetKeyByAttrName( rLanguage, &aScriptLanguage );
+ if( XML_NAMESPACE_OOO != nScriptPrefix )
+ aScriptLanguage = rLanguage ;
+
+ // check for factory
+ FactoryMap::iterator aFactoryIterator =
+ aFactoryMap.find(aScriptLanguage);
+ if (aFactoryIterator != aFactoryMap.end())
+ {
+ // delegate to factory
+ pContext = aFactoryIterator->second->CreateContext(
+ rImport, nPrefix, rLocalName, xAttrList,
+ rEvents, aNameIter->second, aScriptLanguage);
+ }
+ }
+
+ // default context (if no context was created above)
+ if( NULL == pContext )
+ {
+ pContext = new SvXMLImportContext(rImport, nPrefix, rLocalName);
+
+ Sequence<OUString> aMsgParams(2);
+
+ aMsgParams[0] = rXmlEventName;
+ aMsgParams[1] = rLanguage;
+
+ rImport.SetError(XMLERROR_FLAG_ERROR | XMLERROR_ILLEGAL_EVENT,
+ aMsgParams);
+
+ }
+
+ return pContext;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/script/XMLEventsImportContext.cxx b/xmloff/source/script/XMLEventsImportContext.cxx
new file mode 100644
index 000000000000..3ce8cec3eec9
--- /dev/null
+++ b/xmloff/source/script/XMLEventsImportContext.cxx
@@ -0,0 +1,232 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <xmloff/XMLEventsImportContext.hxx>
+
+#include "XMLEventImportHelper.hxx"
+
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#include <tools/debug.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlerror.hxx"
+
+using namespace ::com::sun::star::uno;
+using namespace ::xmloff::token;
+
+using ::rtl::OUString;
+using ::com::sun::star::xml::sax::XAttributeList;
+using ::com::sun::star::beans::PropertyValue;
+using ::com::sun::star::container::XNameReplace;
+using ::com::sun::star::document::XEventsSupplier;
+using ::com::sun::star::lang::IllegalArgumentException;
+
+TYPEINIT1(XMLEventsImportContext, SvXMLImportContext);
+
+
+XMLEventsImportContext::XMLEventsImportContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName) :
+ SvXMLImportContext(rImport, nPrfx, rLocalName)
+{
+}
+
+
+XMLEventsImportContext::XMLEventsImportContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const Reference<XEventsSupplier> & xEventsSupplier) :
+ SvXMLImportContext(rImport, nPrfx, rLocalName),
+ xEvents(xEventsSupplier->getEvents())
+{
+}
+
+
+XMLEventsImportContext::XMLEventsImportContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const Reference<XNameReplace> & xNameReplace) :
+ SvXMLImportContext(rImport, nPrfx, rLocalName),
+ xEvents(xNameReplace)
+{
+}
+
+XMLEventsImportContext::~XMLEventsImportContext()
+{
+// // if, for whatever reason, the object gets destroyed prematurely,
+// // we need to delete the collected events
+}
+
+
+void XMLEventsImportContext::StartElement(
+ const Reference<XAttributeList> &)
+{
+ // nothing to be done
+}
+
+void XMLEventsImportContext::EndElement()
+{
+ // nothing to be done
+}
+
+SvXMLImportContext* XMLEventsImportContext::CreateChildContext(
+ sal_uInt16 p_nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList )
+{
+ // a) search for script:language and script:event-name attribute
+ // b) delegate to factory. The factory will:
+ // 1) translate XML event name into API event name
+ // 2) get proper event context factory from import
+ // 3) instantiate context
+
+ // a) search for script:language and script:event-name attribute
+ OUString sLanguage;
+ OUString sEventName;
+ sal_Int16 nCount = xAttrList->getLength();
+ for (sal_Int16 nAttr = 0; nAttr < nCount; nAttr++)
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(nAttr), &sLocalName );
+
+ if (XML_NAMESPACE_SCRIPT == nPrefix)
+ {
+ if (IsXMLToken(sLocalName, XML_EVENT_NAME))
+ {
+ sEventName = xAttrList->getValueByIndex(nAttr);
+ }
+ else if (IsXMLToken(sLocalName, XML_LANGUAGE))
+ {
+ sLanguage = xAttrList->getValueByIndex(nAttr);
+ }
+ // else: ignore -> let child context handle this
+ }
+ // else: ignore -> let child context handle this
+ }
+
+ // b) delegate to factory
+ return GetImport().GetEventImport().CreateContext(
+ GetImport(), p_nPrefix, rLocalName, xAttrList,
+ this, sEventName, sLanguage);
+}
+
+void XMLEventsImportContext::SetEvents(
+ const Reference<XEventsSupplier> & xEventsSupplier)
+{
+ if (xEventsSupplier.is())
+ {
+ SetEvents(xEventsSupplier->getEvents());
+ }
+}
+
+void XMLEventsImportContext::SetEvents(
+ const Reference<XNameReplace> & xNameRepl)
+{
+ if (xNameRepl.is())
+ {
+ xEvents = xNameRepl;
+
+ // now iterate over vector and a) insert b) delete all elements
+ EventsVector::iterator aEnd = aCollectEvents.end();
+ for(EventsVector::iterator aIter = aCollectEvents.begin();
+ aIter != aEnd;
+ ++aIter)
+ {
+ AddEventValues(aIter->first, aIter->second);
+ }
+ aCollectEvents.clear();
+ }
+}
+
+sal_Bool XMLEventsImportContext::GetEventSequence(
+ const OUString& rName,
+ Sequence<PropertyValue> & rSequence )
+{
+ // search through the vector
+ // (This shouldn't take a lot of time, since this method should only get
+ // called if only one (or few) events are being expected)
+
+ // iterate over vector until end or rName is found;
+ EventsVector::iterator aIter = aCollectEvents.begin();
+ while( (aIter != aCollectEvents.end()) && (aIter->first != rName) )
+ {
+ ++aIter;
+ }
+
+ // if we're not at the end, set the sequence
+ sal_Bool bRet = (aIter != aCollectEvents.end());
+ if (bRet)
+ rSequence = aIter->second;
+
+ return bRet;
+}
+
+void XMLEventsImportContext::AddEventValues(
+ const OUString& rEventName,
+ const Sequence<PropertyValue> & rValues )
+{
+ // if we already have the events, set them; else just collect
+ if (xEvents.is())
+ {
+ // set event (if name is known)
+ if (xEvents->hasByName(rEventName))
+ {
+ Any aAny;
+ aAny <<= rValues;
+
+ try
+ {
+ xEvents->replaceByName(rEventName, aAny);
+ } catch ( const IllegalArgumentException & rException )
+ {
+ Sequence<OUString> aMsgParams(1);
+
+ aMsgParams[0] = rEventName;
+
+ GetImport().SetError(XMLERROR_FLAG_ERROR |
+ XMLERROR_ILLEGAL_EVENT,
+ aMsgParams, rException.Message, 0);
+ }
+ }
+ }
+ else
+ {
+ EventNameValuesPair aPair(rEventName, rValues);
+ aCollectEvents.push_back(aPair);
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/script/XMLScriptContextFactory.cxx b/xmloff/source/script/XMLScriptContextFactory.cxx
new file mode 100644
index 000000000000..4de998a5207b
--- /dev/null
+++ b/xmloff/source/script/XMLScriptContextFactory.cxx
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLScriptContextFactory.hxx"
+#include <xmloff/XMLEventsImportContext.hxx>
+#include <tools/debug.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+
+
+using namespace ::xmloff::token;
+
+using ::rtl::OUString;
+using ::com::sun::star::xml::sax::XAttributeList;
+using ::com::sun::star::beans::PropertyValue;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
+
+XMLScriptContextFactory::XMLScriptContextFactory() :
+ sEventType(RTL_CONSTASCII_USTRINGPARAM("EventType")),
+ sScript(RTL_CONSTASCII_USTRINGPARAM("Script")),
+ sURL(RTL_CONSTASCII_USTRINGPARAM("Script"))
+{
+}
+
+XMLScriptContextFactory::~XMLScriptContextFactory()
+{
+}
+
+SvXMLImportContext * XMLScriptContextFactory::CreateContext
+(SvXMLImport & rImport,
+ sal_uInt16 p_nPrefix,
+ const OUString & rLocalName,
+ const Reference<XAttributeList> & xAttrList,
+ XMLEventsImportContext * rEvents,
+ const OUString & rApiEventName,
+ const OUString & /*rApiLanguage*/)
+{
+ OUString sURLVal;
+
+ sal_Int16 nCount = xAttrList->getLength();
+ for (sal_Int16 nAttr = 0; nAttr < nCount; nAttr++)
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = rImport.GetNamespaceMap().
+ GetKeyByAttrName(xAttrList->getNameByIndex(nAttr), &sLocalName);
+
+ if (XML_NAMESPACE_XLINK == nPrefix)
+ {
+ if (IsXMLToken(sLocalName, XML_HREF))
+ sURLVal = xAttrList->getValueByIndex(nAttr);
+ // else: ignore
+ }
+ // else ignore
+ }
+
+ Sequence<PropertyValue> aValues(2);
+
+ // EventType
+ aValues[0].Name = sEventType;
+ aValues[0].Value <<= sScript;
+
+ // URL
+ aValues[1].Name = sURL;
+ aValues[1].Value <<= sURLVal;
+
+ // add values for event now
+ rEvents->AddEventValues(rApiEventName, aValues);
+
+ // return dummy context
+ return new SvXMLImportContext(rImport, p_nPrefix, rLocalName);
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/script/XMLScriptExportHandler.cxx b/xmloff/source/script/XMLScriptExportHandler.cxx
new file mode 100644
index 000000000000..9310accee364
--- /dev/null
+++ b/xmloff/source/script/XMLScriptExportHandler.cxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLScriptExportHandler.hxx"
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <tools/debug.hxx>
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+
+
+using namespace ::com::sun::star::uno;
+using namespace ::xmloff::token;
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::PropertyValue;
+
+
+XMLScriptExportHandler::XMLScriptExportHandler() :
+ sURL(RTL_CONSTASCII_USTRINGPARAM("Script"))
+{
+}
+
+XMLScriptExportHandler::~XMLScriptExportHandler()
+{
+}
+
+void XMLScriptExportHandler::Export(
+ SvXMLExport& rExport,
+ const OUString& rEventQName,
+ Sequence<PropertyValue> & rValues,
+ sal_Bool bUseWhitespace)
+{
+
+ rExport.AddAttribute(XML_NAMESPACE_SCRIPT, XML_LANGUAGE,
+ rExport.GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_OOO, GetXMLToken(XML_SCRIPT) ) );
+ rExport.AddAttribute(XML_NAMESPACE_SCRIPT, XML_EVENT_NAME, rEventQName);
+
+ sal_Int32 nCount = rValues.getLength();
+ for(sal_Int32 i = 0; i < nCount; i++)
+ {
+ if (sURL.equals(rValues[i].Name))
+ {
+ OUString sTmp;
+ rValues[i].Value >>= sTmp;
+ rExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, sTmp);
+
+ // #i110911# xlink:type="simple" is required
+ rExport.AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE);
+ }
+ // else: disregard
+ }
+
+ SvXMLElementExport aEventElemt(rExport, XML_NAMESPACE_SCRIPT,
+ XML_EVENT_LISTENER,
+ bUseWhitespace, sal_False);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/script/XMLStarBasicContextFactory.cxx b/xmloff/source/script/XMLStarBasicContextFactory.cxx
new file mode 100644
index 000000000000..51c2050be4bc
--- /dev/null
+++ b/xmloff/source/script/XMLStarBasicContextFactory.cxx
@@ -0,0 +1,130 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLStarBasicContextFactory.hxx"
+#include <xmloff/XMLEventsImportContext.hxx>
+#include <tools/debug.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+
+
+using namespace ::xmloff::token;
+
+using ::rtl::OUString;
+using ::com::sun::star::xml::sax::XAttributeList;
+using ::com::sun::star::beans::PropertyValue;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
+
+
+XMLStarBasicContextFactory::XMLStarBasicContextFactory() :
+ sEventType(RTL_CONSTASCII_USTRINGPARAM("EventType")),
+ sLibrary(RTL_CONSTASCII_USTRINGPARAM("Library")),
+ sMacroName(RTL_CONSTASCII_USTRINGPARAM("MacroName")),
+ sStarBasic(RTL_CONSTASCII_USTRINGPARAM("StarBasic"))
+{
+}
+
+XMLStarBasicContextFactory::~XMLStarBasicContextFactory()
+{
+}
+
+SvXMLImportContext* XMLStarBasicContextFactory::CreateContext(
+ SvXMLImport& rImport,
+ sal_uInt16 p_nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList,
+ XMLEventsImportContext* rEvents,
+ const OUString& rApiEventName,
+ const OUString& /*rApiLanguage*/)
+{
+ OUString sLibraryVal;
+ OUString sMacroNameVal;
+
+ sal_Int16 nCount = xAttrList->getLength();
+ for(sal_Int16 nAttr = 0; nAttr < nCount; nAttr++)
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = rImport.GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(nAttr), &sLocalName );
+
+ if (XML_NAMESPACE_SCRIPT == nPrefix)
+ {
+ if (IsXMLToken(sLocalName, XML_MACRO_NAME))
+ {
+ sMacroNameVal = xAttrList->getValueByIndex(nAttr);
+ }
+ // else: ingore
+ }
+ // else: ignore
+ }
+
+ const OUString& rApp = GetXMLToken( XML_APPLICATION );
+ const OUString& rDoc = GetXMLToken( XML_DOCUMENT );
+ if( sMacroNameVal.getLength() > rApp.getLength()+1 &&
+ sMacroNameVal.copy(0,rApp.getLength()).equalsIgnoreAsciiCase( rApp ) &&
+ ':' == sMacroNameVal[rApp.getLength()] )
+ {
+ sLibraryVal = OUString(RTL_CONSTASCII_USTRINGPARAM("StarOffice"));
+ sMacroNameVal = sMacroNameVal.copy( rApp.getLength()+1 );
+ }
+ else if( sMacroNameVal.getLength() > rDoc.getLength()+1 &&
+ sMacroNameVal.copy(0,rDoc.getLength()).equalsIgnoreAsciiCase( rDoc ) &&
+ ':' == sMacroNameVal[rDoc.getLength()] )
+ {
+ sLibraryVal = rDoc;
+ sMacroNameVal = sMacroNameVal.copy( rDoc.getLength()+1 );
+ }
+
+ Sequence<PropertyValue> aValues(3);
+
+ // EventType
+ aValues[0].Name = sEventType;
+ aValues[0].Value <<= sStarBasic;
+
+ // library name
+ aValues[1].Name = sLibrary;
+ aValues[1].Value <<= sLibraryVal;
+
+ // macro name
+ aValues[2].Name = sMacroName;
+ aValues[2].Value <<= sMacroNameVal;
+
+ // add values for event now
+ rEvents->AddEventValues(rApiEventName, aValues);
+
+ // return dummy context
+ return new SvXMLImportContext(rImport, p_nPrefix, rLocalName);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/script/XMLStarBasicExportHandler.cxx b/xmloff/source/script/XMLStarBasicExportHandler.cxx
new file mode 100644
index 000000000000..023dc7efcf1e
--- /dev/null
+++ b/xmloff/source/script/XMLStarBasicExportHandler.cxx
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLStarBasicExportHandler.hxx"
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <tools/debug.hxx>
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+
+
+using namespace ::com::sun::star::uno;
+using namespace ::xmloff::token;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::com::sun::star::beans::PropertyValue;
+
+
+XMLStarBasicExportHandler::XMLStarBasicExportHandler() :
+ sStarBasic(RTL_CONSTASCII_USTRINGPARAM("StarBasic")),
+ sLibrary(RTL_CONSTASCII_USTRINGPARAM("Library")),
+ sMacroName(RTL_CONSTASCII_USTRINGPARAM("MacroName")),
+ sStarOffice(RTL_CONSTASCII_USTRINGPARAM("StarOffice")),
+ sApplication(RTL_CONSTASCII_USTRINGPARAM("application"))
+{
+}
+
+XMLStarBasicExportHandler::~XMLStarBasicExportHandler()
+{
+}
+
+void XMLStarBasicExportHandler::Export(
+ SvXMLExport& rExport,
+ const OUString& rEventQName,
+ Sequence<PropertyValue> & rValues,
+ sal_Bool bUseWhitespace)
+{
+ rExport.AddAttribute(XML_NAMESPACE_SCRIPT, XML_LANGUAGE,
+ rExport.GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_OOO, sStarBasic ) );
+ rExport.AddAttribute(XML_NAMESPACE_SCRIPT, XML_EVENT_NAME, rEventQName);
+
+ OUString sLocation, sName;
+ sal_Int32 nCount = rValues.getLength();
+ for(sal_Int32 i = 0; i < nCount; i++)
+ {
+ if (sLibrary.equals(rValues[i].Name))
+ {
+ OUString sTmp;
+ rValues[i].Value >>= sTmp;
+ sLocation = GetXMLToken(
+ (sTmp.equalsIgnoreAsciiCase(sApplication) ||
+ sTmp.equalsIgnoreAsciiCase(sStarOffice) ) ? XML_APPLICATION
+ : XML_DOCUMENT );
+ }
+ else if (sMacroName.equals(rValues[i].Name))
+ {
+ rValues[i].Value >>= sName;
+ }
+ // else: disregard
+ }
+
+ if( sLocation.getLength() )
+ {
+ OUStringBuffer sTmp( sLocation.getLength() + sName.getLength() + 1 );
+ sTmp = sLocation;
+ sTmp.append( sal_Unicode( ':' ) );
+ sTmp.append( sName );
+ rExport.AddAttribute(XML_NAMESPACE_SCRIPT, XML_MACRO_NAME,
+ sTmp.makeStringAndClear());
+ }
+ else
+ {
+ rExport.AddAttribute(XML_NAMESPACE_SCRIPT, XML_MACRO_NAME, sName );
+ }
+
+ SvXMLElementExport aEventElemt(rExport, XML_NAMESPACE_SCRIPT,
+ XML_EVENT_LISTENER,
+ bUseWhitespace, sal_False);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/script/xmlbasici.cxx b/xmloff/source/script/xmlbasici.cxx
new file mode 100644
index 000000000000..c6738eb51c83
--- /dev/null
+++ b/xmloff/source/script/xmlbasici.cxx
@@ -0,0 +1,200 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "xmlbasici.hxx"
+#include <xmloff/attrlist.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmlimp.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+
+// =============================================================================
+// XMLBasicImportContext
+// =============================================================================
+
+XMLBasicImportContext::XMLBasicImportContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const ::rtl::OUString& rLName,
+ const Reference< frame::XModel >& rxModel )
+ :SvXMLImportContext( rImport, nPrfx, rLName )
+ ,m_xModel( rxModel )
+{
+ Reference< lang::XMultiServiceFactory > xMSF = GetImport().getServiceFactory();
+ if ( xMSF.is() )
+ {
+ m_xHandler.set( xMSF->createInstance(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.XMLOasisBasicImporter" ) ) ),
+ UNO_QUERY );
+ }
+
+ if ( m_xHandler.is() )
+ {
+ Reference< document::XImporter > xImporter( m_xHandler, UNO_QUERY );
+ if ( xImporter.is() )
+ {
+ Reference< lang::XComponent > xComp( m_xModel, UNO_QUERY );
+ xImporter->setTargetDocument( xComp );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+XMLBasicImportContext::~XMLBasicImportContext()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+SvXMLImportContext* XMLBasicImportContext::CreateChildContext(
+ sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
+ const Reference< xml::sax::XAttributeList >& )
+{
+ SvXMLImportContext* pContext = 0;
+
+ if ( m_xHandler.is() )
+ pContext = new XMLBasicImportChildContext( GetImport(), nPrefix, rLocalName, m_xHandler );
+
+ if ( !pContext )
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+
+ return pContext;
+}
+
+// -----------------------------------------------------------------------------
+
+void XMLBasicImportContext::StartElement(
+ const Reference< xml::sax::XAttributeList >& rxAttrList )
+{
+ if ( m_xHandler.is() )
+ {
+ m_xHandler->startDocument();
+
+ // copy namespace declarations
+ SvXMLAttributeList* pAttrList = new SvXMLAttributeList( rxAttrList );
+ Reference< xml::sax::XAttributeList > xAttrList( pAttrList );
+ const SvXMLNamespaceMap& rNamespaceMap = GetImport().GetNamespaceMap();
+ sal_uInt16 nPos = rNamespaceMap.GetFirstKey();
+ while ( nPos != USHRT_MAX )
+ {
+ ::rtl::OUString aAttrName( rNamespaceMap.GetAttrNameByKey( nPos ) );
+ if ( xAttrList->getValueByName( aAttrName ).getLength() == 0 )
+ pAttrList->AddAttribute( aAttrName, rNamespaceMap.GetNameByKey( nPos ) );
+ nPos = rNamespaceMap.GetNextKey( nPos );
+ }
+
+ m_xHandler->startElement(
+ GetImport().GetNamespaceMap().GetQNameByKey( GetPrefix(), GetLocalName() ),
+ xAttrList );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void XMLBasicImportContext::EndElement()
+{
+ if ( m_xHandler.is() )
+ {
+ m_xHandler->endElement(
+ GetImport().GetNamespaceMap().GetQNameByKey( GetPrefix(), GetLocalName() ) );
+ m_xHandler->endDocument();
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void XMLBasicImportContext::Characters( const ::rtl::OUString& rChars )
+{
+ if ( m_xHandler.is() )
+ m_xHandler->characters( rChars );
+}
+
+
+// =============================================================================
+// XMLBasicImportChildContext
+// =============================================================================
+
+XMLBasicImportChildContext::XMLBasicImportChildContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const ::rtl::OUString& rLName,
+ const Reference< xml::sax::XDocumentHandler >& rxHandler )
+ :SvXMLImportContext( rImport, nPrfx, rLName )
+ ,m_xHandler( rxHandler )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+XMLBasicImportChildContext::~XMLBasicImportChildContext()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+SvXMLImportContext* XMLBasicImportChildContext::CreateChildContext(
+ sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
+ const Reference< xml::sax::XAttributeList >& )
+{
+ return new XMLBasicImportChildContext( GetImport(), nPrefix, rLocalName, m_xHandler );
+}
+
+// -----------------------------------------------------------------------------
+
+void XMLBasicImportChildContext::StartElement(
+ const Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ if ( m_xHandler.is() )
+ {
+ m_xHandler->startElement(
+ GetImport().GetNamespaceMap().GetQNameByKey( GetPrefix(), GetLocalName() ),
+ xAttrList );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void XMLBasicImportChildContext::EndElement()
+{
+ if ( m_xHandler.is() )
+ {
+ m_xHandler->endElement(
+ GetImport().GetNamespaceMap().GetQNameByKey( GetPrefix(), GetLocalName() ) );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void XMLBasicImportChildContext::Characters( const ::rtl::OUString& rChars )
+{
+ if ( m_xHandler.is() )
+ m_xHandler->characters( rChars );
+}
+
+// -----------------------------------------------------------------------------
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/script/xmlbasici.hxx b/xmloff/source/script/xmlbasici.hxx
new file mode 100644
index 000000000000..b9e5099b1780
--- /dev/null
+++ b/xmloff/source/script/xmlbasici.hxx
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLBASICI_HXX
+#define _XMLOFF_XMLBASICI_HXX
+
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <xmloff/xmlictxt.hxx>
+
+
+// =============================================================================
+// class XMLBasicImportContext
+// =============================================================================
+
+class XMLBasicImportContext : public SvXMLImportContext
+{
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xModel;
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > m_xHandler;
+
+public:
+ XMLBasicImportContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel );
+
+ virtual ~XMLBasicImportContext();
+
+ virtual SvXMLImportContext* CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& rxAttrList );
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& rxAttrList );
+
+ virtual void EndElement();
+
+ virtual void Characters( const ::rtl::OUString& rChars );
+};
+
+
+// =============================================================================
+// class XMLBasicImportChildContext
+// =============================================================================
+
+class XMLBasicImportChildContext : public SvXMLImportContext
+{
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > m_xHandler;
+
+public:
+ XMLBasicImportChildContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler >& rxHandler );
+
+ virtual ~XMLBasicImportChildContext();
+
+ virtual SvXMLImportContext* CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void EndElement();
+
+ virtual void Characters( const ::rtl::OUString& rChars );
+};
+
+#endif // _XMLOFF_XMLBASICI_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/script/xmlscripti.cxx b/xmloff/source/script/xmlscripti.cxx
new file mode 100644
index 000000000000..16d4f2c5c6ce
--- /dev/null
+++ b/xmloff/source/script/xmlscripti.cxx
@@ -0,0 +1,192 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <xmloff/xmlscripti.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/XMLEventsImportContext.hxx>
+#include "xmlbasici.hxx"
+
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#include <com/sun/star/document/XEmbeddedScripts.hpp>
+
+using ::rtl::OUString;
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::frame;
+using namespace com::sun::star::document;
+using namespace com::sun::star::xml::sax;
+using namespace ::xmloff::token;
+
+using rtl::OUString;
+
+// =============================================================================
+// XMLScriptChildContext: context for <office:script> element
+// =============================================================================
+
+class XMLScriptChildContext : public SvXMLImportContext
+{
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xModel;
+ ::com::sun::star::uno::Reference< ::com::sun::star::document::XEmbeddedScripts > m_xDocumentScripts;
+ ::rtl::OUString m_aLanguage;
+
+public:
+ XMLScriptChildContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel>& rxModel,
+ const ::rtl::OUString& rLanguage );
+ virtual ~XMLScriptChildContext();
+
+ virtual SvXMLImportContext* CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void EndElement();
+};
+
+// -----------------------------------------------------------------------------
+
+XMLScriptChildContext::XMLScriptChildContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const ::rtl::OUString& rLName,
+ const Reference< frame::XModel >& rxModel, const ::rtl::OUString& rLanguage )
+ :SvXMLImportContext( rImport, nPrfx, rLName )
+ ,m_xModel( rxModel )
+ ,m_xDocumentScripts( rxModel, UNO_QUERY )
+ ,m_aLanguage( rLanguage )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+XMLScriptChildContext::~XMLScriptChildContext()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+SvXMLImportContext* XMLScriptChildContext::CreateChildContext(
+ sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
+ const Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ SvXMLImportContext* pContext = NULL;
+
+ if ( m_xDocumentScripts.is() )
+ { // document supports embedding scripts/macros
+ ::rtl::OUString aBasic( GetImport().GetNamespaceMap().GetPrefixByKey( XML_NAMESPACE_OOO ) );
+ aBasic += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ":Basic" ) );
+
+ if ( m_aLanguage == aBasic && nPrefix == XML_NAMESPACE_OOO && IsXMLToken( rLocalName, XML_LIBRARIES ) )
+ pContext = new XMLBasicImportContext( GetImport(), nPrefix, rLocalName, m_xModel );
+ }
+
+ if ( !pContext )
+ pContext = SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList );
+
+ return pContext;
+}
+
+// -----------------------------------------------------------------------------
+
+void XMLScriptChildContext::EndElement()
+{
+}
+
+// =============================================================================
+// XMLScriptContext: context for <office:scripts> element
+// =============================================================================
+
+XMLScriptContext::XMLScriptContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName,
+ const Reference<XModel>& rDocModel )
+ :SvXMLImportContext( rImport, nPrfx, rLName )
+ ,m_xModel( rDocModel )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+XMLScriptContext::~XMLScriptContext()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+SvXMLImportContext* XMLScriptContext::CreateChildContext(
+ sal_uInt16 nPrefix, const OUString& rLName,
+ const Reference<XAttributeList>& xAttrList )
+{
+ SvXMLImportContext* pContext = NULL;
+
+ if ( nPrefix == XML_NAMESPACE_OFFICE )
+ {
+ if ( IsXMLToken( rLName, XML_EVENT_LISTENERS ) )
+ {
+ Reference< XEventsSupplier> xSupplier( GetImport().GetModel(), UNO_QUERY );
+ pContext = new XMLEventsImportContext( GetImport(), nPrefix, rLName, xSupplier );
+ }
+ else if ( IsXMLToken( rLName, XML_SCRIPT ) )
+ {
+ ::rtl::OUString aAttrName( GetImport().GetNamespaceMap().GetPrefixByKey( XML_NAMESPACE_SCRIPT ) );
+ aAttrName += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ":language" ) );
+ if ( xAttrList.is() )
+ {
+ ::rtl::OUString aLanguage = xAttrList->getValueByName( aAttrName );
+
+ if ( m_xModel.is() )
+ {
+ uno::Sequence< beans::PropertyValue > aMedDescr = m_xModel->getArgs();
+ sal_Int32 nNewLen = aMedDescr.getLength() + 1;
+ aMedDescr.realloc( nNewLen );
+ aMedDescr[nNewLen-1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BreakMacroSignature" ) );
+ aMedDescr[nNewLen-1].Value <<= (sal_Bool)sal_True;
+ m_xModel->attachResource( m_xModel->getURL(), aMedDescr );
+
+ pContext = new XMLScriptChildContext( GetImport(), nPrefix, rLName, m_xModel, aLanguage );
+ }
+ }
+ }
+ }
+
+ if ( !pContext )
+ pContext = SvXMLImportContext::CreateChildContext( nPrefix, rLName, xAttrList);
+
+ return pContext;
+}
+
+// -----------------------------------------------------------------------------
+
+void XMLScriptContext::EndElement()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/AttributeContainerHandler.cxx b/xmloff/source/style/AttributeContainerHandler.cxx
new file mode 100644
index 000000000000..94c0f2e25ef2
--- /dev/null
+++ b/xmloff/source/style/AttributeContainerHandler.cxx
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/xml/AttributeData.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/text/GraphicCrop.hpp>
+
+#include "AttributeContainerHandler.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::container;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLAttributeContainerHandler
+//
+
+XMLAttributeContainerHandler::~XMLAttributeContainerHandler()
+{
+ // nothing to do
+}
+
+bool XMLAttributeContainerHandler::equals(
+ const Any& r1,
+ const Any& r2 ) const
+{
+ Reference< XNameContainer > xContainer1;
+ Reference< XNameContainer > xContainer2;
+
+ if( ( r1 >>= xContainer1 ) && ( r2 >>= xContainer2 ) )
+ {
+ uno::Sequence< OUString > aAttribNames1( xContainer1->getElementNames() );
+ uno::Sequence< OUString > aAttribNames2( xContainer2->getElementNames() );
+ const sal_Int32 nCount = aAttribNames1.getLength();
+
+ if( aAttribNames2.getLength() == nCount )
+ {
+ const OUString* pAttribName = aAttribNames1.getConstArray();
+
+ xml::AttributeData aData1;
+ xml::AttributeData aData2;
+
+ for( sal_Int32 i=0; i < nCount; i++, pAttribName++ )
+ {
+ if( !xContainer2->hasByName( *pAttribName ) )
+ return sal_False;
+
+ xContainer1->getByName( *pAttribName ) >>= aData1;
+ xContainer2->getByName( *pAttribName ) >>= aData2;
+
+ if( ( aData1.Namespace != aData2.Namespace ) ||
+ ( aData1.Type != aData2.Type ) ||
+ ( aData1.Value != aData2.Value ) )
+ return sal_False;
+ }
+
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+}
+
+sal_Bool XMLAttributeContainerHandler::importXML( const OUString& /*rStrImpValue*/, Any& /*rValue*/, const SvXMLUnitConverter& /*rUnitConverter*/ ) const
+{
+ return sal_True;
+}
+
+sal_Bool XMLAttributeContainerHandler::exportXML( OUString& /*rStrExpValue*/, const Any& /*rValue*/, const SvXMLUnitConverter& /*rUnitConverter*/ ) const
+{
+ return sal_True;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/DashStyle.cxx b/xmloff/source/style/DashStyle.cxx
new file mode 100644
index 000000000000..97f187b5178e
--- /dev/null
+++ b/xmloff/source/style/DashStyle.cxx
@@ -0,0 +1,331 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/drawing/DashStyle.hpp>
+#include <com/sun/star/drawing/LineDash.hpp>
+#include "xmloff/DashStyle.hxx"
+#include <xmloff/attrlist.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/ustring.hxx>
+#include <tools/debug.hxx>
+#include <xmloff/xmltkmap.hxx>
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::xmloff::token;
+
+enum SvXMLTokenMapAttrs
+{
+ XML_TOK_DASH_NAME,
+ XML_TOK_DASH_DISPLAY_NAME,
+ XML_TOK_DASH_STYLE,
+ XML_TOK_DASH_DOTS1,
+ XML_TOK_DASH_DOTS1LEN,
+ XML_TOK_DASH_DOTS2,
+ XML_TOK_DASH_DOTS2LEN,
+ XML_TOK_DASH_DISTANCE,
+ XML_TOK_DASH_END=XML_TOK_UNKNOWN
+};
+
+static SvXMLTokenMapEntry aDashStyleAttrTokenMap[] =
+{
+ { XML_NAMESPACE_DRAW, XML_NAME, XML_TOK_DASH_NAME },
+ { XML_NAMESPACE_DRAW, XML_DISPLAY_NAME, XML_TOK_DASH_DISPLAY_NAME },
+ { XML_NAMESPACE_DRAW, XML_STYLE, XML_TOK_DASH_STYLE },
+ { XML_NAMESPACE_DRAW, XML_DOTS1, XML_TOK_DASH_DOTS1 },
+ { XML_NAMESPACE_DRAW, XML_DOTS1_LENGTH, XML_TOK_DASH_DOTS1LEN },
+ { XML_NAMESPACE_DRAW, XML_DOTS2, XML_TOK_DASH_DOTS2 },
+ { XML_NAMESPACE_DRAW, XML_DOTS2_LENGTH, XML_TOK_DASH_DOTS2LEN },
+ { XML_NAMESPACE_DRAW, XML_DISTANCE, XML_TOK_DASH_DISTANCE },
+ XML_TOKEN_MAP_END
+};
+
+SvXMLEnumMapEntry const pXML_DashStyle_Enum[] =
+{
+ { XML_RECT, drawing::DashStyle_RECT },
+ { XML_ROUND, drawing::DashStyle_ROUND },
+ { XML_RECT, drawing::DashStyle_RECTRELATIVE },
+ { XML_ROUND, drawing::DashStyle_ROUNDRELATIVE },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+//-------------------------------------------------------------
+// Import
+//-------------------------------------------------------------
+
+XMLDashStyleImport::XMLDashStyleImport( SvXMLImport& rImp )
+ : rImport(rImp)
+{
+}
+
+XMLDashStyleImport::~XMLDashStyleImport()
+{
+}
+
+sal_Bool XMLDashStyleImport::importXML(
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList,
+ uno::Any& rValue,
+ OUString& rStrName )
+{
+ drawing::LineDash aLineDash;
+ aLineDash.Style = drawing::DashStyle_RECT;
+ aLineDash.Dots = 0;
+ aLineDash.DotLen = 0;
+ aLineDash.Dashes = 0;
+ aLineDash.DashLen = 0;
+ aLineDash.Distance = 20;
+ OUString aDisplayName;
+
+ sal_Bool bIsRel = sal_False;
+
+ SvXMLNamespaceMap& rNamespaceMap = rImport.GetNamespaceMap();
+ SvXMLUnitConverter& rUnitConverter = rImport.GetMM100UnitConverter();
+
+ SvXMLTokenMap aTokenMap( aDashStyleAttrTokenMap );
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rFullAttrName = xAttrList->getNameByIndex( i );
+ OUString aStrAttrName;
+ sal_uInt16 nPrefix = rNamespaceMap.GetKeyByAttrName( rFullAttrName, &aStrAttrName );
+ const OUString& rStrValue = xAttrList->getValueByIndex( i );
+
+ switch( aTokenMap.Get( nPrefix, aStrAttrName ) )
+ {
+ case XML_TOK_DASH_NAME:
+ {
+ rStrName = rStrValue;
+ }
+ break;
+ case XML_TOK_DASH_DISPLAY_NAME:
+ {
+ aDisplayName = rStrValue;
+ }
+ break;
+ case XML_TOK_DASH_STYLE:
+ {
+ sal_uInt16 eValue;
+ if( rUnitConverter.convertEnum( eValue, rStrValue, pXML_DashStyle_Enum ) )
+ {
+ aLineDash.Style = (drawing::DashStyle) eValue;
+ }
+ }
+ break;
+ case XML_TOK_DASH_DOTS1:
+ aLineDash.Dots = (sal_Int16)rStrValue.toInt32();
+ break;
+
+ case XML_TOK_DASH_DOTS1LEN:
+ {
+ if( rStrValue.indexOf( sal_Unicode('%') ) != -1 ) // its a percentage
+ {
+ bIsRel = sal_True;
+ rUnitConverter.convertPercent( aLineDash.DotLen, rStrValue );
+ }
+ else
+ {
+ rUnitConverter.convertMeasure( aLineDash.DotLen, rStrValue );
+ }
+ }
+ break;
+
+ case XML_TOK_DASH_DOTS2:
+ aLineDash.Dashes = (sal_Int16)rStrValue.toInt32();
+ break;
+
+ case XML_TOK_DASH_DOTS2LEN:
+ {
+ if( rStrValue.indexOf( sal_Unicode('%') ) != -1 ) // its a percentage
+ {
+ bIsRel = sal_True;
+ rUnitConverter.convertPercent( aLineDash.DashLen, rStrValue );
+ }
+ else
+ {
+ rUnitConverter.convertMeasure( aLineDash.DashLen, rStrValue );
+ }
+ }
+ break;
+
+ case XML_TOK_DASH_DISTANCE:
+ {
+ if( rStrValue.indexOf( sal_Unicode('%') ) != -1 ) // its a percentage
+ {
+ bIsRel = sal_True;
+ rUnitConverter.convertPercent( aLineDash.Distance, rStrValue );
+ }
+ else
+ {
+ rUnitConverter.convertMeasure( aLineDash.Distance, rStrValue );
+ }
+ }
+ break;
+ default:
+ DBG_WARNING( "Unknown token at import gradient style" );
+ }
+ }
+
+ if( bIsRel )
+ aLineDash.Style = aLineDash.Style == drawing::DashStyle_RECT ? drawing::DashStyle_RECTRELATIVE : drawing::DashStyle_ROUNDRELATIVE;
+
+ rValue <<= aLineDash;
+
+ if( aDisplayName.getLength() )
+ {
+ rImport.AddStyleDisplayName( XML_STYLE_FAMILY_SD_STROKE_DASH_ID,
+ rStrName, aDisplayName );
+ rStrName = aDisplayName;
+ }
+
+ return sal_True;
+}
+
+
+//-------------------------------------------------------------
+// Export
+//-------------------------------------------------------------
+
+XMLDashStyleExport::XMLDashStyleExport( SvXMLExport& rExp )
+ : rExport(rExp)
+{
+}
+
+XMLDashStyleExport::~XMLDashStyleExport()
+{
+}
+
+sal_Bool XMLDashStyleExport::exportXML(
+ const OUString& rStrName,
+ const uno::Any& rValue )
+{
+ sal_Bool bRet = sal_False;
+
+ SvXMLUnitConverter rUnitConverter = rExport.GetMM100UnitConverter();
+
+ drawing::LineDash aLineDash;
+
+ if( rStrName.getLength() )
+ {
+ if( rValue >>= aLineDash )
+ {
+ sal_Bool bIsRel = aLineDash.Style == drawing::DashStyle_RECTRELATIVE || aLineDash.Style == drawing::DashStyle_ROUNDRELATIVE;
+
+ OUString aStrValue;
+ OUStringBuffer aOut;
+
+ // Name
+ sal_Bool bEncoded = sal_False;
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME,
+ rExport.EncodeStyleName( rStrName,
+ &bEncoded ) );
+ if( bEncoded )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DISPLAY_NAME,
+ rStrName );
+
+ // Style
+ rUnitConverter.convertEnum( aOut, aLineDash.Style, pXML_DashStyle_Enum );
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_STYLE, aStrValue );
+
+
+ // dots
+ if( aLineDash.Dots )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DOTS1, OUString::valueOf( (sal_Int32)aLineDash.Dots ) );
+
+ if( aLineDash.DotLen )
+ {
+ // dashes length
+ if( bIsRel )
+ {
+ rUnitConverter.convertPercent( aOut, aLineDash.DotLen );
+ }
+ else
+ {
+ rUnitConverter.convertMeasure( aOut, aLineDash.DotLen );
+ }
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DOTS1_LENGTH, aStrValue );
+ }
+ }
+
+ // dashes
+ if( aLineDash.Dashes )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DOTS2, OUString::valueOf( (sal_Int32)aLineDash.Dashes ) );
+
+ if( aLineDash.DashLen )
+ {
+ // dashes length
+ if( bIsRel )
+ {
+ rUnitConverter.convertPercent( aOut, aLineDash.DashLen );
+ }
+ else
+ {
+ rUnitConverter.convertMeasure( aOut, aLineDash.DashLen );
+ }
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DOTS2_LENGTH, aStrValue );
+ }
+ }
+
+ // distance
+ if( bIsRel )
+ {
+ rUnitConverter.convertPercent( aOut, aLineDash.Distance );
+ }
+ else
+ {
+ rUnitConverter.convertMeasure( aOut, aLineDash.Distance );
+ }
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DISTANCE, aStrValue );
+
+
+ // do Write
+ SvXMLElementExport rElem( rExport,
+ XML_NAMESPACE_DRAW, XML_STROKE_DASH,
+ sal_True, sal_False );
+ }
+ }
+ return bRet;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/DrawAspectHdl.cxx b/xmloff/source/style/DrawAspectHdl.cxx
new file mode 100644
index 000000000000..754e22b27d47
--- /dev/null
+++ b/xmloff/source/style/DrawAspectHdl.cxx
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/uno/Any.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmltoken.hxx>
+#include "DrawAspectHdl.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLMeasurePropHdl
+//
+
+SvXMLEnumMapEntry const pXML_DrawAspect_Enum[] =
+{
+ { XML_CONTENT, 1 },
+ { XML_THUMBNAIL, 2 },
+ { XML_ICON, 4 },
+ { XML_PRINT, 8 },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+DrawAspectHdl::~DrawAspectHdl()
+{
+ // nothing to do
+}
+
+sal_Bool DrawAspectHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Int64 nAspect = 0;
+
+ SvXMLUnitConverter::convertNumber64( nAspect, rStrImpValue );
+ rValue <<= nAspect;
+
+ return nAspect > 0;
+}
+
+sal_Bool DrawAspectHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ OUStringBuffer aOut;
+
+ sal_Int64 nAspect = 0;
+ if( ( rValue >>= nAspect ) && nAspect > 0 )
+ {
+ // store the aspect as an integer value
+ aOut.append( nAspect );
+
+ rStrExpValue = aOut.makeStringAndClear();
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/DrawAspectHdl.hxx b/xmloff/source/style/DrawAspectHdl.hxx
new file mode 100644
index 000000000000..c644c0dc85fb
--- /dev/null
+++ b/xmloff/source/style/DrawAspectHdl.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_DRAWASPECTHDL_HXX
+#define _XMLOFF_DRAWASPECTHDL_HXX
+
+#include <xmloff/xmlprhdl.hxx>
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class DrawAspectHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~DrawAspectHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_DRAWASPECTHDL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/EnumPropertyHdl.cxx b/xmloff/source/style/EnumPropertyHdl.cxx
new file mode 100644
index 000000000000..55c3a60491ad
--- /dev/null
+++ b/xmloff/source/style/EnumPropertyHdl.cxx
@@ -0,0 +1,100 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#include <xmloff/EnumPropertyHdl.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <comphelper/extract.hxx>
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/uno/Any.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star::uno;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLEnumPropertyHdl
+//
+
+XMLEnumPropertyHdl::~XMLEnumPropertyHdl()
+{
+ // Nothing to do
+}
+
+sal_Bool XMLEnumPropertyHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_uInt16 nValue = 0;
+
+ if( SvXMLUnitConverter::convertEnum( nValue, rStrImpValue, mpEnumMap ) )
+ {
+ switch( mrType.getTypeClass() )
+ {
+ case TypeClass_ENUM:
+ rValue = ::cppu::int2enum( nValue, mrType );
+ break;
+ case TypeClass_LONG:
+ rValue <<= (sal_Int32) nValue;
+ break;
+ case TypeClass_SHORT:
+ rValue <<= (sal_Int16) nValue;
+ break;
+ case TypeClass_BYTE:
+ rValue <<= (sal_Int8) nValue;
+ break;
+ default:
+ OSL_FAIL( "Wrong type for enum property handler!" );
+ return sal_False;
+ }
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+sal_Bool XMLEnumPropertyHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Int32 nValue = 0;
+ if(!(rValue >>= nValue ))
+ if(!::cppu::enum2int(nValue, rValue) )
+ return sal_False;
+
+ OUStringBuffer aOut;
+
+ if(!SvXMLUnitConverter::convertEnum( aOut, nValue, mpEnumMap ))
+ return sal_False;
+
+ rStrExpValue = aOut.makeStringAndClear();
+ return sal_True;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/FillStyleContext.cxx b/xmloff/source/style/FillStyleContext.cxx
new file mode 100644
index 000000000000..305b4932a2db
--- /dev/null
+++ b/xmloff/source/style/FillStyleContext.cxx
@@ -0,0 +1,362 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/container/XNameContainer.hpp>
+#include "FillStyleContext.hxx"
+#include <xmloff/xmlimp.hxx>
+#include "xmloff/GradientStyle.hxx"
+#include "xmloff/HatchStyle.hxx"
+#include "xmloff/ImageStyle.hxx"
+#include "TransGradientStyle.hxx"
+#include "xmloff/MarkerStyle.hxx"
+#include "xmloff/DashStyle.hxx"
+#include <xmloff/families.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/XMLBase64ImportContext.hxx>
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( XMLGradientStyleContext, SvXMLStyleContext );
+
+XMLGradientStyleContext::XMLGradientStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList)
+: SvXMLStyleContext(rImport, nPrfx, rLName, xAttrList)
+{
+
+ // start import
+ XMLGradientStyleImport aGradientStyle( GetImport() );
+ aGradientStyle.importXML( xAttrList, maAny, maStrName );
+}
+
+XMLGradientStyleContext::~XMLGradientStyleContext()
+{
+}
+
+void XMLGradientStyleContext::EndElement()
+{
+ uno::Reference< container::XNameContainer > xGradient( GetImport().GetGradientHelper() );
+
+ try
+ {
+ if(xGradient.is())
+ {
+ if( xGradient->hasByName( maStrName ) )
+ {
+ xGradient->replaceByName( maStrName, maAny );
+ }
+ else
+ {
+ xGradient->insertByName( maStrName, maAny );
+ }
+ }
+ }
+ catch( container::ElementExistException& )
+ {}
+}
+
+sal_Bool XMLGradientStyleContext::IsTransient() const
+{
+ return sal_True;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( XMLHatchStyleContext, SvXMLStyleContext );
+
+XMLHatchStyleContext::XMLHatchStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList)
+: SvXMLStyleContext(rImport, nPrfx, rLName, xAttrList)
+{
+ // start import
+ XMLHatchStyleImport aHatchStyle( GetImport() );
+ aHatchStyle.importXML( xAttrList, maAny, maStrName );
+}
+
+XMLHatchStyleContext::~XMLHatchStyleContext()
+{
+}
+
+void XMLHatchStyleContext::EndElement()
+{
+ uno::Reference< container::XNameContainer > xHatch( GetImport().GetHatchHelper() );
+
+ try
+ {
+ if(xHatch.is())
+ {
+ if( xHatch->hasByName( maStrName ) )
+ {
+ xHatch->replaceByName( maStrName, maAny );
+ }
+ else
+ {
+ xHatch->insertByName( maStrName, maAny );
+ }
+ }
+ }
+ catch( container::ElementExistException& )
+ {}
+}
+
+sal_Bool XMLHatchStyleContext::IsTransient() const
+{
+ return sal_True;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( XMLBitmapStyleContext, SvXMLStyleContext );
+
+XMLBitmapStyleContext::XMLBitmapStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList)
+: SvXMLStyleContext(rImport, nPrfx, rLName, xAttrList)
+{
+ // start import
+ XMLImageStyle aBitmapStyle;
+ aBitmapStyle.importXML( xAttrList, maAny, maStrName, rImport );
+}
+
+XMLBitmapStyleContext::~XMLBitmapStyleContext()
+{
+}
+
+SvXMLImportContext* XMLBitmapStyleContext::CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList )
+{
+ SvXMLImportContext *pContext = 0;
+ if( (XML_NAMESPACE_OFFICE == nPrefix) && xmloff::token::IsXMLToken( rLocalName, xmloff::token::XML_BINARY_DATA ) )
+ {
+ OUString sURL;
+ maAny >>= sURL;
+ if( !sURL.getLength() && !mxBase64Stream.is() )
+ {
+ mxBase64Stream = GetImport().GetStreamForGraphicObjectURLFromBase64();
+ if( mxBase64Stream.is() )
+ pContext = new XMLBase64ImportContext( GetImport(), nPrefix,
+ rLocalName, xAttrList,
+ mxBase64Stream );
+ }
+ }
+ if( !pContext )
+ {
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+ }
+
+ return pContext;
+}
+
+void XMLBitmapStyleContext::EndElement()
+{
+ OUString sURL;
+ maAny >>= sURL;
+
+ if( !sURL.getLength() && mxBase64Stream.is() )
+ {
+ sURL = GetImport().ResolveGraphicObjectURLFromBase64( mxBase64Stream );
+ mxBase64Stream = 0;
+ maAny <<= sURL;
+ }
+
+ uno::Reference< container::XNameContainer > xBitmap( GetImport().GetBitmapHelper() );
+
+ try
+ {
+ if(xBitmap.is())
+ {
+ if( xBitmap->hasByName( maStrName ) )
+ {
+ xBitmap->replaceByName( maStrName, maAny );
+ }
+ else
+ {
+ xBitmap->insertByName( maStrName, maAny );
+ }
+ }
+ }
+ catch( container::ElementExistException& )
+ {}
+}
+
+sal_Bool XMLBitmapStyleContext::IsTransient() const
+{
+ return sal_True;
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( XMLTransGradientStyleContext, SvXMLStyleContext );
+
+XMLTransGradientStyleContext::XMLTransGradientStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList)
+: SvXMLStyleContext(rImport, nPrfx, rLName, xAttrList)
+{
+ // start import
+ XMLTransGradientStyleImport aTransGradientStyle( GetImport() );
+ aTransGradientStyle.importXML( xAttrList, maAny, maStrName );
+}
+
+XMLTransGradientStyleContext::~XMLTransGradientStyleContext()
+{
+}
+
+void XMLTransGradientStyleContext::EndElement()
+{
+ uno::Reference< container::XNameContainer > xTransGradient( GetImport().GetTransGradientHelper() );
+
+ try
+ {
+ if(xTransGradient.is())
+ {
+ if( xTransGradient->hasByName( maStrName ) )
+ {
+ xTransGradient->replaceByName( maStrName, maAny );
+ }
+ else
+ {
+ xTransGradient->insertByName( maStrName, maAny );
+ }
+ }
+ }
+ catch( container::ElementExistException& )
+ {}
+}
+
+sal_Bool XMLTransGradientStyleContext::IsTransient() const
+{
+ return sal_True;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( XMLMarkerStyleContext, SvXMLStyleContext );
+
+XMLMarkerStyleContext::XMLMarkerStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList)
+: SvXMLStyleContext(rImport, nPrfx, rLName, xAttrList)
+{
+ // start import
+ XMLMarkerStyleImport aMarkerStyle( GetImport() );
+ aMarkerStyle.importXML( xAttrList, maAny, maStrName );
+}
+
+XMLMarkerStyleContext::~XMLMarkerStyleContext()
+{
+}
+
+void XMLMarkerStyleContext::EndElement()
+{
+ uno::Reference< container::XNameContainer > xMarker( GetImport().GetMarkerHelper() );
+
+ try
+ {
+ if(xMarker.is())
+ {
+ if( xMarker->hasByName( maStrName ) )
+ {
+ xMarker->replaceByName( maStrName, maAny );
+ }
+ else
+ {
+ xMarker->insertByName( maStrName, maAny );
+ }
+ }
+ }
+ catch( container::ElementExistException& )
+ {}
+}
+
+sal_Bool XMLMarkerStyleContext::IsTransient() const
+{
+ return sal_True;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( XMLDashStyleContext, SvXMLStyleContext );
+
+XMLDashStyleContext::XMLDashStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList)
+: SvXMLStyleContext(rImport, nPrfx, rLName, xAttrList)
+{
+ // start import
+ XMLDashStyleImport aDashStyle( GetImport() );
+ aDashStyle.importXML( xAttrList, maAny, maStrName );
+}
+
+XMLDashStyleContext::~XMLDashStyleContext()
+{
+}
+
+void XMLDashStyleContext::EndElement()
+{
+ uno::Reference< container::XNameContainer > xDashes( GetImport().GetDashHelper() );
+
+ try
+ {
+ if(xDashes.is())
+ {
+ if( xDashes->hasByName( maStrName ) )
+ {
+ xDashes->replaceByName( maStrName, maAny );
+ }
+ else
+ {
+ xDashes->insertByName( maStrName, maAny );
+ }
+ }
+ }
+ catch( container::ElementExistException& )
+ {}
+}
+
+sal_Bool XMLDashStyleContext::IsTransient() const
+{
+ return sal_True;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/FillStyleContext.hxx b/xmloff/source/style/FillStyleContext.hxx
new file mode 100644
index 000000000000..b047ea42b5ef
--- /dev/null
+++ b/xmloff/source/style/FillStyleContext.hxx
@@ -0,0 +1,170 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_FILLSTYLECONTEXTS_HXX_
+#define _XMLOFF_FILLSTYLECONTEXTS_HXX_
+
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <xmloff/xmlstyle.hxx>
+#include<rtl/ustring.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:gardient context
+
+class XMLGradientStyleContext: public SvXMLStyleContext
+{
+private:
+ ::com::sun::star::uno::Any maAny;
+ rtl::OUString maStrName;
+
+public:
+ TYPEINFO();
+
+ XMLGradientStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual ~XMLGradientStyleContext();
+
+ virtual void EndElement();
+
+ virtual sal_Bool IsTransient() const;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:hatch context
+
+class XMLHatchStyleContext: public SvXMLStyleContext
+{
+private:
+ ::com::sun::star::uno::Any maAny;
+ rtl::OUString maStrName;
+
+public:
+ TYPEINFO();
+
+ XMLHatchStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual ~XMLHatchStyleContext();
+
+ virtual void EndElement();
+
+ virtual sal_Bool IsTransient() const;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:fill-image context
+
+class XMLBitmapStyleContext: public SvXMLStyleContext
+{
+private:
+ ::com::sun::star::uno::Any maAny;
+ rtl::OUString maStrName;
+ ::com::sun::star::uno::Reference < ::com::sun::star::io::XOutputStream > mxBase64Stream;
+
+public:
+ TYPEINFO();
+
+ XMLBitmapStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual ~XMLBitmapStyleContext();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+ virtual void EndElement();
+
+ virtual sal_Bool IsTransient() const;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:transparency context
+
+class XMLTransGradientStyleContext: public SvXMLStyleContext
+{
+private:
+ ::com::sun::star::uno::Any maAny;
+ rtl::OUString maStrName;
+
+public:
+ TYPEINFO();
+
+ XMLTransGradientStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual ~XMLTransGradientStyleContext();
+
+ virtual void EndElement();
+
+ virtual sal_Bool IsTransient() const;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:marker context
+
+class XMLMarkerStyleContext: public SvXMLStyleContext
+{
+private:
+ ::com::sun::star::uno::Any maAny;
+ rtl::OUString maStrName;
+
+public:
+ TYPEINFO();
+
+ XMLMarkerStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual ~XMLMarkerStyleContext();
+
+ virtual void EndElement();
+
+ virtual sal_Bool IsTransient() const;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:marker context
+
+class XMLDashStyleContext: public SvXMLStyleContext
+{
+private:
+ ::com::sun::star::uno::Any maAny;
+ rtl::OUString maStrName;
+
+public:
+ TYPEINFO();
+
+ XMLDashStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual ~XMLDashStyleContext();
+
+ virtual void EndElement();
+
+ virtual sal_Bool IsTransient() const;
+};
+
+#endif // _XMLOFF_FILLSTYLECONTEXTS_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/GradientStyle.cxx b/xmloff/source/style/GradientStyle.cxx
new file mode 100644
index 000000000000..c468f2907d1e
--- /dev/null
+++ b/xmloff/source/style/GradientStyle.cxx
@@ -0,0 +1,343 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "xmloff/GradientStyle.hxx"
+#include <com/sun/star/awt/Gradient.hpp>
+#include <xmloff/attrlist.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/ustring.hxx>
+#include <tools/debug.hxx>
+#include <xmloff/xmltkmap.hxx>
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmlimp.hxx>
+
+
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::xmloff::token;
+
+enum SvXMLTokenMapAttrs
+{
+ XML_TOK_GRADIENT_NAME,
+ XML_TOK_GRADIENT_DISPLAY_NAME,
+ XML_TOK_GRADIENT_STYLE,
+ XML_TOK_GRADIENT_CX,
+ XML_TOK_GRADIENT_CY,
+ XML_TOK_GRADIENT_STARTCOLOR,
+ XML_TOK_GRADIENT_ENDCOLOR,
+ XML_TOK_GRADIENT_STARTINT,
+ XML_TOK_GRADIENT_ENDINT,
+ XML_TOK_GRADIENT_ANGLE,
+ XML_TOK_GRADIENT_BORDER,
+ XML_TOK_TABSTOP_END=XML_TOK_UNKNOWN
+};
+
+
+SvXMLEnumMapEntry const pXML_GradientStyle_Enum[] =
+{
+ { XML_GRADIENTSTYLE_LINEAR, awt::GradientStyle_LINEAR },
+ { XML_GRADIENTSTYLE_AXIAL, awt::GradientStyle_AXIAL },
+ { XML_GRADIENTSTYLE_RADIAL, awt::GradientStyle_RADIAL },
+ { XML_GRADIENTSTYLE_ELLIPSOID, awt::GradientStyle_ELLIPTICAL },
+ { XML_GRADIENTSTYLE_SQUARE, awt::GradientStyle_SQUARE },
+ { XML_GRADIENTSTYLE_RECTANGULAR, awt::GradientStyle_RECT },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+//-------------------------------------------------------------
+// Import
+//-------------------------------------------------------------
+XMLGradientStyleImport::XMLGradientStyleImport(
+ SvXMLImport& rImp )
+ : rImport(rImp)
+{
+}
+
+XMLGradientStyleImport::~XMLGradientStyleImport()
+{
+}
+
+sal_Bool XMLGradientStyleImport::importXML(
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList,
+ uno::Any& rValue,
+ OUString& rStrName )
+{
+ sal_Bool bRet = sal_False;
+ sal_Bool bHasName = sal_False;
+ sal_Bool bHasStyle = sal_False;
+ sal_Bool bHasStartColor = sal_False;
+ sal_Bool bHasEndColor = sal_False;
+ OUString aDisplayName;
+
+ awt::Gradient aGradient;
+ aGradient.XOffset = 0;
+ aGradient.YOffset = 0;
+ aGradient.StartIntensity = 100;
+ aGradient.EndIntensity = 100;
+ aGradient.Angle = 0;
+ aGradient.Border = 0;
+
+ {
+ static SvXMLTokenMapEntry aGradientAttrTokenMap[] =
+{
+ { XML_NAMESPACE_DRAW, XML_NAME, XML_TOK_GRADIENT_NAME },
+ { XML_NAMESPACE_DRAW, XML_DISPLAY_NAME, XML_TOK_GRADIENT_DISPLAY_NAME },
+ { XML_NAMESPACE_DRAW, XML_STYLE, XML_TOK_GRADIENT_STYLE },
+ { XML_NAMESPACE_DRAW, XML_CX, XML_TOK_GRADIENT_CX },
+ { XML_NAMESPACE_DRAW, XML_CY, XML_TOK_GRADIENT_CY },
+ { XML_NAMESPACE_DRAW, XML_START_COLOR, XML_TOK_GRADIENT_STARTCOLOR },
+ { XML_NAMESPACE_DRAW, XML_END_COLOR, XML_TOK_GRADIENT_ENDCOLOR },
+ { XML_NAMESPACE_DRAW, XML_START_INTENSITY, XML_TOK_GRADIENT_STARTINT },
+ { XML_NAMESPACE_DRAW, XML_END_INTENSITY, XML_TOK_GRADIENT_ENDINT },
+ { XML_NAMESPACE_DRAW, XML_GRADIENT_ANGLE, XML_TOK_GRADIENT_ANGLE },
+ { XML_NAMESPACE_DRAW, XML_GRADIENT_BORDER, XML_TOK_GRADIENT_BORDER },
+ XML_TOKEN_MAP_END
+};
+
+ SvXMLTokenMap aTokenMap( aGradientAttrTokenMap );
+ SvXMLNamespaceMap& rNamespaceMap = rImport.GetNamespaceMap();
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rFullAttrName = xAttrList->getNameByIndex( i );
+ OUString aStrAttrName;
+ sal_uInt16 nPrefix = rNamespaceMap.GetKeyByAttrName( rFullAttrName, &aStrAttrName );
+ const OUString& rStrValue = xAttrList->getValueByIndex( i );
+
+ sal_Int32 nTmpValue;
+
+ switch( aTokenMap.Get( nPrefix, aStrAttrName ) )
+ {
+ case XML_TOK_GRADIENT_NAME:
+ {
+ rStrName = rStrValue;
+ bHasName = sal_True;
+ }
+ break;
+ case XML_TOK_GRADIENT_DISPLAY_NAME:
+ {
+ aDisplayName = rStrValue;
+ }
+ break;
+ case XML_TOK_GRADIENT_STYLE:
+ {
+ sal_uInt16 eValue;
+ if( SvXMLUnitConverter::convertEnum( eValue, rStrValue, pXML_GradientStyle_Enum ) )
+ {
+ aGradient.Style = (awt::GradientStyle) eValue;
+ bHasStyle = sal_True;
+ }
+ }
+ break;
+ case XML_TOK_GRADIENT_CX:
+ SvXMLUnitConverter::convertPercent( nTmpValue, rStrValue );
+ aGradient.XOffset = static_cast< sal_Int16 >( nTmpValue );
+ break;
+ case XML_TOK_GRADIENT_CY:
+ SvXMLUnitConverter::convertPercent( nTmpValue, rStrValue );
+ aGradient.YOffset = static_cast< sal_Int16 >( nTmpValue );
+ break;
+ case XML_TOK_GRADIENT_STARTCOLOR:
+ {
+ Color aColor;
+ bHasStartColor = SvXMLUnitConverter::convertColor( aColor, rStrValue );
+ if( bHasStartColor )
+ aGradient.StartColor = (sal_Int32)( aColor.GetColor() );
+ }
+ break;
+ case XML_TOK_GRADIENT_ENDCOLOR:
+ {
+ Color aColor;
+ bHasStartColor = SvXMLUnitConverter::convertColor( aColor, rStrValue );
+ if( bHasStartColor )
+ aGradient.EndColor = (sal_Int32)( aColor.GetColor() );
+ }
+ break;
+ case XML_TOK_GRADIENT_STARTINT:
+ SvXMLUnitConverter::convertPercent( nTmpValue, rStrValue );
+ aGradient.StartIntensity = static_cast< sal_Int16 >( nTmpValue );
+ break;
+ case XML_TOK_GRADIENT_ENDINT:
+ SvXMLUnitConverter::convertPercent( nTmpValue, rStrValue );
+ aGradient.EndIntensity = static_cast< sal_Int16 >( nTmpValue );
+ break;
+ case XML_TOK_GRADIENT_ANGLE:
+ {
+ sal_Int32 nValue;
+ SvXMLUnitConverter::convertNumber( nValue, rStrValue, 0, 3600 );
+ aGradient.Angle = sal_Int16( nValue );
+ }
+ break;
+ case XML_TOK_GRADIENT_BORDER:
+ SvXMLUnitConverter::convertPercent( nTmpValue, rStrValue );
+ aGradient.Border = static_cast< sal_Int16 >( nTmpValue );
+ break;
+
+ default:
+ DBG_WARNING( "Unknown token at import gradient style" )
+ ;
+ }
+ }
+
+ rValue <<= aGradient;
+
+ if( aDisplayName.getLength() )
+ {
+ rImport.AddStyleDisplayName( XML_STYLE_FAMILY_SD_GRADIENT_ID, rStrName,
+ aDisplayName );
+ rStrName = aDisplayName;
+ }
+
+ bRet = bHasName && bHasStyle && bHasStartColor && bHasEndColor;
+
+ }
+
+ return bRet;
+}
+
+
+//-------------------------------------------------------------
+// Export
+//-------------------------------------------------------------
+
+XMLGradientStyleExport::XMLGradientStyleExport(
+ SvXMLExport& rExp )
+ : rExport(rExp)
+{
+}
+
+XMLGradientStyleExport::~XMLGradientStyleExport()
+{
+}
+
+sal_Bool XMLGradientStyleExport::exportXML(
+ const OUString& rStrName,
+ const uno::Any& rValue )
+{
+ sal_Bool bRet = sal_False;
+ awt::Gradient aGradient;
+
+ if( rStrName.getLength() )
+ {
+ if( rValue >>= aGradient )
+ {
+ OUString aStrValue;
+ OUStringBuffer aOut;
+
+ // Style
+ if( !SvXMLUnitConverter::convertEnum( aOut, aGradient.Style, pXML_GradientStyle_Enum ) )
+ {
+ bRet = sal_False;
+ }
+ else
+ {
+ // Name
+ sal_Bool bEncoded = sal_False;
+ OUString aStrName( rStrName );
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME,
+ rExport.EncodeStyleName( aStrName,
+ &bEncoded ) );
+ if( bEncoded )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DISPLAY_NAME,
+ aStrName );
+
+
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_STYLE, aStrValue );
+
+ // Center x/y
+ if( aGradient.Style != awt::GradientStyle_LINEAR &&
+ aGradient.Style != awt::GradientStyle_AXIAL )
+ {
+ SvXMLUnitConverter::convertPercent( aOut, aGradient.XOffset );
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CX, aStrValue );
+
+ SvXMLUnitConverter::convertPercent( aOut, aGradient.YOffset );
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CY, aStrValue );
+ }
+
+ Color aColor;
+
+ // Color start
+ aColor.SetColor( aGradient.StartColor );
+ SvXMLUnitConverter::convertColor( aOut, aColor );
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_START_COLOR, aStrValue );
+
+ // Color end
+ aColor.SetColor( aGradient.EndColor );
+ SvXMLUnitConverter::convertColor( aOut, aColor );
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_END_COLOR, aStrValue );
+
+ // Intensity start
+ SvXMLUnitConverter::convertPercent( aOut, aGradient.StartIntensity );
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_START_INTENSITY, aStrValue );
+
+ // Intensity end
+ SvXMLUnitConverter::convertPercent( aOut, aGradient.EndIntensity );
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_END_INTENSITY, aStrValue );
+
+ // Angle
+ if( aGradient.Style != awt::GradientStyle_RADIAL )
+ {
+ SvXMLUnitConverter::convertNumber( aOut, sal_Int32( aGradient.Angle ) );
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_GRADIENT_ANGLE, aStrValue );
+ }
+
+ // Border
+ SvXMLUnitConverter::convertPercent( aOut, aGradient.Border );
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_GRADIENT_BORDER, aStrValue );
+
+ // Do Write
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_DRAW, XML_GRADIENT,
+ sal_True, sal_False );
+ }
+ }
+ }
+
+ return bRet;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/HatchStyle.cxx b/xmloff/source/style/HatchStyle.cxx
new file mode 100644
index 000000000000..ded1ad105cb7
--- /dev/null
+++ b/xmloff/source/style/HatchStyle.cxx
@@ -0,0 +1,262 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "xmloff/HatchStyle.hxx"
+#include <com/sun/star/drawing/Hatch.hpp>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/ustring.hxx>
+#include <tools/debug.hxx>
+#include <xmloff/xmltkmap.hxx>
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::xmloff::token;
+
+enum SvXMLTokenMapAttrs
+{
+ XML_TOK_HATCH_NAME,
+ XML_TOK_HATCH_DISPLAY_NAME,
+ XML_TOK_HATCH_STYLE,
+ XML_TOK_HATCH_COLOR,
+ XML_TOK_HATCH_DISTANCE,
+ XML_TOK_HATCH_ROTATION,
+ XML_TOK_TABSTOP_END=XML_TOK_UNKNOWN
+};
+
+
+SvXMLEnumMapEntry const pXML_HatchStyle_Enum[] =
+{
+ { XML_HATCHSTYLE_SINGLE, drawing::HatchStyle_SINGLE },
+ { XML_HATCHSTYLE_DOUBLE, drawing::HatchStyle_DOUBLE },
+ { XML_HATCHSTYLE_TRIPLE, drawing::HatchStyle_TRIPLE },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+
+//-------------------------------------------------------------
+// Import
+//-------------------------------------------------------------
+
+XMLHatchStyleImport::XMLHatchStyleImport( SvXMLImport& rImp )
+ : rImport(rImp)
+{
+}
+
+XMLHatchStyleImport::~XMLHatchStyleImport()
+{
+}
+
+sal_Bool XMLHatchStyleImport::importXML(
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList,
+ uno::Any& rValue,
+ OUString& rStrName )
+{
+ sal_Bool bRet = sal_False;
+
+ sal_Bool bHasName = sal_False;
+ sal_Bool bHasStyle = sal_False;
+ sal_Bool bHasColor = sal_False;
+ sal_Bool bHasDist = sal_False;
+ OUString aDisplayName;
+
+ drawing::Hatch aHatch;
+ aHatch.Style = drawing::HatchStyle_SINGLE;
+ aHatch.Color = 0;
+ aHatch.Distance = 0;
+ aHatch.Angle = 0;
+
+ {
+ static SvXMLTokenMapEntry aHatchAttrTokenMap[] =
+{
+ { XML_NAMESPACE_DRAW, XML_NAME, XML_TOK_HATCH_NAME },
+ { XML_NAMESPACE_DRAW, XML_DISPLAY_NAME, XML_TOK_HATCH_DISPLAY_NAME },
+ { XML_NAMESPACE_DRAW, XML_STYLE, XML_TOK_HATCH_STYLE },
+ { XML_NAMESPACE_DRAW, XML_COLOR, XML_TOK_HATCH_COLOR },
+ { XML_NAMESPACE_DRAW, XML_HATCH_DISTANCE, XML_TOK_HATCH_DISTANCE },
+ { XML_NAMESPACE_DRAW, XML_ROTATION, XML_TOK_HATCH_ROTATION },
+ XML_TOKEN_MAP_END
+};
+
+ SvXMLTokenMap aTokenMap( aHatchAttrTokenMap );
+ SvXMLNamespaceMap rNamespaceMap = rImport.GetNamespaceMap();
+ SvXMLUnitConverter& rUnitConverter = rImport.GetMM100UnitConverter();
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rFullAttrName = xAttrList->getNameByIndex( i );
+ OUString aStrAttrName;
+ sal_uInt16 nPrefix = rNamespaceMap.GetKeyByAttrName( rFullAttrName, &aStrAttrName );
+ const OUString& rStrValue = xAttrList->getValueByIndex( i );
+
+ switch( aTokenMap.Get( nPrefix, aStrAttrName ) )
+ {
+ case XML_TOK_HATCH_NAME:
+ {
+ rStrName = rStrValue;
+ bHasName = sal_True;
+ }
+ break;
+ case XML_TOK_HATCH_DISPLAY_NAME:
+ aDisplayName = rStrValue;
+ break;
+ case XML_TOK_HATCH_STYLE:
+ {
+ sal_uInt16 eValue;
+ bHasStyle = rUnitConverter.convertEnum( eValue, rStrValue, pXML_HatchStyle_Enum );
+ if( bHasStyle )
+ aHatch.Style = (drawing::HatchStyle) eValue;
+ }
+ break;
+ case XML_TOK_HATCH_COLOR:
+ {
+ Color aColor;
+ bHasColor = rUnitConverter.convertColor( aColor, rStrValue );
+ if( bHasColor )
+ aHatch.Color = (sal_Int32)( aColor.GetColor() );
+ }
+ break;
+ case XML_TOK_HATCH_DISTANCE:
+ bHasDist = rUnitConverter.convertMeasure( (sal_Int32&)aHatch.Distance, rStrValue );
+ break;
+ case XML_TOK_HATCH_ROTATION:
+ {
+ sal_Int32 nValue;
+ rUnitConverter.convertNumber( nValue, rStrValue, 0, 3600 );
+ aHatch.Angle = sal_Int16( nValue );
+ }
+ break;
+
+ default:
+ DBG_WARNING( "Unknown token at import hatch style" )
+ ;
+ }
+ }
+
+ rValue <<= aHatch;
+
+ if( aDisplayName.getLength() )
+ {
+ rImport.AddStyleDisplayName( XML_STYLE_FAMILY_SD_HATCH_ID, rStrName,
+ aDisplayName );
+ rStrName = aDisplayName;
+ }
+
+ bRet = bHasName && bHasStyle && bHasColor && bHasDist;
+
+ }
+
+ return bRet;
+}
+
+
+//-------------------------------------------------------------
+// Export
+//-------------------------------------------------------------
+
+XMLHatchStyleExport::XMLHatchStyleExport( SvXMLExport& rExp )
+ : rExport(rExp)
+{
+}
+
+XMLHatchStyleExport::~XMLHatchStyleExport()
+{
+}
+
+sal_Bool XMLHatchStyleExport::exportXML(
+ const OUString& rStrName,
+ const uno::Any& rValue )
+{
+ sal_Bool bRet = sal_False;
+ drawing::Hatch aHatch;
+
+ if( rStrName.getLength() )
+ {
+ if( rValue >>= aHatch )
+ {
+ OUString aStrValue;
+ OUStringBuffer aOut;
+
+ SvXMLUnitConverter& rUnitConverter =
+ rExport.GetMM100UnitConverter();
+
+ // Style
+ if( !rUnitConverter.convertEnum( aOut, aHatch.Style, pXML_HatchStyle_Enum ) )
+ {
+ bRet = sal_False;
+ }
+ else
+ {
+ // Name
+ sal_Bool bEncoded = sal_False;
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME,
+ rExport.EncodeStyleName( rStrName,
+ &bEncoded ) );
+ if( bEncoded )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DISPLAY_NAME,
+ rStrName );
+
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_STYLE, aStrValue );
+
+ // Color
+ rUnitConverter.convertColor( aOut, Color( aHatch.Color ) );
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_COLOR, aStrValue );
+
+ // Distance
+ rUnitConverter.convertMeasure( aOut, aHatch.Distance );
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HATCH_DISTANCE, aStrValue );
+
+ // Angle
+ rUnitConverter.convertNumber( aOut, sal_Int32( aHatch.Angle ) );
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_ROTATION, aStrValue );
+
+ // Do Write
+ SvXMLElementExport rElem( rExport, XML_NAMESPACE_DRAW, XML_HATCH,
+ sal_True, sal_False );
+ }
+ }
+ }
+
+ return bRet;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/ImageStyle.cxx b/xmloff/source/style/ImageStyle.cxx
new file mode 100644
index 000000000000..f306ede9eaa3
--- /dev/null
+++ b/xmloff/source/style/ImageStyle.cxx
@@ -0,0 +1,209 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "xmloff/ImageStyle.hxx"
+#include <com/sun/star/awt/XBitmap.hpp>
+#include <xmloff/attrlist.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmluconv.hxx>
+#include"xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/ustring.hxx>
+#include <tools/debug.hxx>
+#include <xmloff/xmltkmap.hxx>
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::xmloff::token;
+
+enum SvXMLTokenMapAttrs
+{
+ XML_TOK_IMAGE_NAME,
+ XML_TOK_IMAGE_DISPLAY_NAME,
+ XML_TOK_IMAGE_URL,
+ XML_TOK_IMAGE_TYPE,
+ XML_TOK_IMAGE_SHOW,
+ XML_TOK_IMAGE_ACTUATE,
+ XML_TOK_TABSTOP_END=XML_TOK_UNKNOWN
+};
+
+
+XMLImageStyle::XMLImageStyle()
+{
+}
+
+XMLImageStyle::~XMLImageStyle()
+{
+}
+
+sal_Bool XMLImageStyle::exportXML( const OUString& rStrName, const ::com::sun::star::uno::Any& rValue, SvXMLExport& rExport )
+{
+ return ImpExportXML( rStrName, rValue, rExport );
+}
+
+sal_Bool XMLImageStyle::ImpExportXML( const OUString& rStrName, const uno::Any& rValue, SvXMLExport& rExport )
+{
+ sal_Bool bRet = sal_False;
+
+ OUString sImageURL;
+
+ if( rStrName.getLength() )
+ {
+ if( rValue >>= sImageURL )
+ {
+ OUString aStrValue;
+ OUStringBuffer aOut;
+
+ // Name
+ sal_Bool bEncoded = sal_False;
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME,
+ rExport.EncodeStyleName( rStrName,
+ &bEncoded ) );
+ if( bEncoded )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DISPLAY_NAME,
+ rStrName );
+
+ // uri
+ const OUString aStr( rExport.AddEmbeddedGraphicObject( sImageURL ) );
+ if( aStr.getLength() )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, aStr );
+ rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+ rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
+ }
+
+ // Do Write
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_DRAW, XML_FILL_IMAGE, sal_True, sal_True );
+
+ if( sImageURL.getLength() )
+ {
+ // optional office:binary-data
+ rExport.AddEmbeddedGraphicObjectAsBase64( sImageURL );
+ }
+ }
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLImageStyle::importXML( const uno::Reference< xml::sax::XAttributeList >& xAttrList, uno::Any& rValue, OUString& rStrName, SvXMLImport& rImport )
+{
+ return ImpImportXML( xAttrList, rValue, rStrName, rImport );
+}
+
+sal_Bool XMLImageStyle::ImpImportXML( const uno::Reference< xml::sax::XAttributeList >& xAttrList,
+ uno::Any& rValue, OUString& rStrName,
+ SvXMLImport& rImport )
+{
+ sal_Bool bRet = sal_False;
+ sal_Bool bHasHRef = sal_False;
+ sal_Bool bHasName = sal_False;
+ OUString aStrURL;
+ OUString aDisplayName;
+
+ {
+ static SvXMLTokenMapEntry aHatchAttrTokenMap[] =
+{
+ { XML_NAMESPACE_DRAW, XML_NAME, XML_TOK_IMAGE_NAME },
+ { XML_NAMESPACE_DRAW, XML_DISPLAY_NAME, XML_TOK_IMAGE_DISPLAY_NAME },
+ { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_IMAGE_URL },
+ { XML_NAMESPACE_XLINK, XML_TYPE, XML_TOK_IMAGE_TYPE },
+ { XML_NAMESPACE_XLINK, XML_SHOW, XML_TOK_IMAGE_SHOW },
+ { XML_NAMESPACE_XLINK, XML_ACTUATE, XML_TOK_IMAGE_ACTUATE },
+ XML_TOKEN_MAP_END
+};
+
+ SvXMLTokenMap aTokenMap( aHatchAttrTokenMap );
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rFullAttrName = xAttrList->getNameByIndex( i );
+ OUString aStrAttrName;
+ sal_uInt16 nPrefix = rImport.GetNamespaceMap().GetKeyByAttrName( rFullAttrName, &aStrAttrName );
+ const OUString& rStrValue = xAttrList->getValueByIndex( i );
+
+ switch( aTokenMap.Get( nPrefix, aStrAttrName ) )
+ {
+ case XML_TOK_IMAGE_NAME:
+ {
+ rStrName = rStrValue;
+ bHasName = sal_True;
+ }
+ break;
+ case XML_TOK_IMAGE_DISPLAY_NAME:
+ {
+ aDisplayName = rStrValue;
+ }
+ break;
+ case XML_TOK_IMAGE_URL:
+ {
+ aStrURL = rImport.ResolveGraphicObjectURL( rStrValue, sal_False );
+ bHasHRef = sal_True;
+ }
+ break;
+ case XML_TOK_IMAGE_TYPE:
+ // ignore
+ break;
+ case XML_TOK_IMAGE_SHOW:
+ // ignore
+ break;
+ case XML_TOK_IMAGE_ACTUATE:
+ // ignore
+ break;
+ default:
+ DBG_WARNING( "Unknown token at import fill bitmap style" )
+ ;
+ }
+ }
+
+ rValue <<= aStrURL;
+
+ if( aDisplayName.getLength() )
+ {
+ rImport.AddStyleDisplayName( XML_STYLE_FAMILY_SD_FILL_IMAGE_ID,
+ rStrName, aDisplayName );
+ rStrName = aDisplayName;
+ }
+
+ bRet = bHasName && bHasHRef;
+
+ }
+
+ return bRet;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/MarkerStyle.cxx b/xmloff/source/style/MarkerStyle.cxx
new file mode 100644
index 000000000000..5cacaf44b08b
--- /dev/null
+++ b/xmloff/source/style/MarkerStyle.cxx
@@ -0,0 +1,285 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "xmloff/MarkerStyle.hxx"
+#include "xexptran.hxx"
+#include <xmloff/attrlist.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::xmloff::token;
+
+
+//-------------------------------------------------------------
+// Import
+//-------------------------------------------------------------
+
+XMLMarkerStyleImport::XMLMarkerStyleImport( SvXMLImport& rImp )
+ : rImport( rImp )
+{
+}
+
+XMLMarkerStyleImport::~XMLMarkerStyleImport()
+{
+}
+
+sal_Bool XMLMarkerStyleImport::importXML(
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList,
+ uno::Any& rValue,
+ OUString& rStrName )
+{
+ sal_Bool bHasViewBox = sal_False;
+ sal_Bool bHasPathData = sal_False;
+ OUString aDisplayName;
+
+ SdXMLImExViewBox* pViewBox = NULL;
+
+ SvXMLNamespaceMap& rNamespaceMap = rImport.GetNamespaceMap();
+ SvXMLUnitConverter& rUnitConverter = rImport.GetMM100UnitConverter();
+
+ OUString strPathData;
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i = 0; i < nAttrCount; i++ )
+ {
+ OUString aStrFullAttrName = xAttrList->getNameByIndex( i );
+ OUString aStrAttrName;
+ rNamespaceMap.GetKeyByAttrName( aStrFullAttrName, &aStrAttrName );
+ OUString aStrValue = xAttrList->getValueByIndex( i );
+
+ if( IsXMLToken( aStrAttrName, XML_NAME ) )
+ {
+ rStrName = aStrValue;
+ }
+ else if( IsXMLToken( aStrAttrName, XML_DISPLAY_NAME ) )
+ {
+ aDisplayName = aStrValue;
+ }
+ else if( IsXMLToken( aStrAttrName, XML_VIEWBOX ) )
+ {
+ pViewBox = new SdXMLImExViewBox( aStrValue, rUnitConverter );
+ bHasViewBox = sal_True;
+
+ }
+ else if( IsXMLToken( aStrAttrName, XML_D ) )
+ {
+ strPathData = aStrValue;
+ bHasPathData = sal_True;
+ }
+ }
+
+ if( bHasViewBox && bHasPathData )
+ {
+ SdXMLImExSvgDElement aPoints(strPathData, *pViewBox, awt::Point( 0, 0 ),
+ awt::Size( pViewBox->GetWidth(), pViewBox->GetHeight() ),
+ rUnitConverter );
+
+ if(aPoints.IsCurve())
+ {
+ drawing::PolyPolygonBezierCoords aSourcePolyPolygon(
+ aPoints.GetPointSequenceSequence(),
+ aPoints.GetFlagSequenceSequence());
+ rValue <<= aSourcePolyPolygon;
+ }
+ else
+ {
+ drawing::PolyPolygonBezierCoords aSourcePolyPolygon;
+ aSourcePolyPolygon.Coordinates = aPoints.GetPointSequenceSequence();
+ aSourcePolyPolygon.Flags.realloc(aSourcePolyPolygon.Coordinates.getLength());
+
+ // Zeiger auf innere sequences holen
+ const drawing::PointSequence* pInnerSequence = aSourcePolyPolygon.Coordinates.getConstArray();
+ drawing::FlagSequence* pInnerSequenceFlags = aSourcePolyPolygon.Flags.getArray();
+
+ for(sal_Int32 a(0); a < aSourcePolyPolygon.Coordinates.getLength(); a++)
+ {
+ pInnerSequenceFlags->realloc(pInnerSequence->getLength());
+ drawing::PolygonFlags* pPolyFlags = pInnerSequenceFlags->getArray();
+
+ for(sal_Int32 b(0); b < pInnerSequence->getLength(); b++)
+ *pPolyFlags++ = drawing::PolygonFlags_NORMAL;
+
+ // next run
+ pInnerSequence++;
+ pInnerSequenceFlags++;
+ }
+
+ rValue <<= aSourcePolyPolygon;
+ }
+
+ if( aDisplayName.getLength() )
+ {
+ rImport.AddStyleDisplayName( XML_STYLE_FAMILY_SD_MARKER_ID, rStrName,
+ aDisplayName );
+ rStrName = aDisplayName;
+ }
+
+ }
+
+ if( pViewBox )
+ delete pViewBox;
+
+ return bHasViewBox && bHasPathData;
+}
+
+
+//-------------------------------------------------------------
+// Export
+//-------------------------------------------------------------
+
+XMLMarkerStyleExport::XMLMarkerStyleExport( SvXMLExport& rExp )
+ : rExport( rExp )
+{
+}
+
+XMLMarkerStyleExport::~XMLMarkerStyleExport()
+{
+}
+
+sal_Bool XMLMarkerStyleExport::exportXML(
+ const OUString& rStrName,
+ const uno::Any& rValue )
+{
+ sal_Bool bRet(sal_False);
+
+ if(rStrName.getLength())
+ {
+ drawing::PolyPolygonBezierCoords aBezier;
+
+ if(rValue >>= aBezier)
+ {
+ OUString aStrValue;
+ OUStringBuffer aOut;
+
+ /////////////////
+ // Name
+ sal_Bool bEncoded = sal_False;
+ OUString aStrName( rStrName );
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME,
+ rExport.EncodeStyleName( aStrName,
+ &bEncoded ) );
+ if( bEncoded )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DISPLAY_NAME,
+ aStrName );
+
+ /////////////////
+ // Viewbox (viewBox="0 0 1500 1000")
+ sal_Int32 nMinX(0x7fffffff);
+ sal_Int32 nMaxX(0x80000000);
+ sal_Int32 nMinY(0x7fffffff);
+ sal_Int32 nMaxY(0x80000000);
+ sal_Int32 nOuterCnt(aBezier.Coordinates.getLength());
+ drawing::PointSequence* pOuterSequence = aBezier.Coordinates.getArray();
+ sal_Int32 a, b;
+ sal_Bool bClosed(sal_False);
+
+ for (a = 0; a < nOuterCnt; a++)
+ {
+ drawing::PointSequence* pSequence = pOuterSequence++;
+ const awt::Point *pPoints = pSequence->getConstArray();
+ sal_Int32 nPointCount(pSequence->getLength());
+
+ if(nPointCount)
+ {
+ const awt::Point aStart = pPoints[0];
+ const awt::Point aEnd = pPoints[nPointCount - 1];
+
+ if(aStart.X == aEnd.X && aStart.Y == aEnd.Y)
+ {
+ bClosed = sal_True;
+ }
+ }
+
+ for (b = 0; b < nPointCount; b++)
+ {
+ const awt::Point aPoint = pPoints[b];
+
+ if( aPoint.X < nMinX )
+ nMinX = aPoint.X;
+
+ if( aPoint.X > nMaxX )
+ nMaxX = aPoint.X;
+
+ if( aPoint.Y < nMinY )
+ nMinY = aPoint.Y;
+
+ if( aPoint.Y > nMaxY )
+ nMaxY = aPoint.Y;
+ }
+ }
+
+ sal_Int32 nDifX(nMaxX - nMinX);
+ sal_Int32 nDifY(nMaxY - nMinY);
+
+ SdXMLImExViewBox aViewBox( 0, 0, nDifX, nDifY );
+ rExport.AddAttribute( XML_NAMESPACE_SVG, XML_VIEWBOX, aViewBox.GetExportString() );
+
+ /////////////////
+ // Pathdata
+ pOuterSequence = aBezier.Coordinates.getArray();
+ drawing::FlagSequence* pOuterFlags = aBezier.Flags.getArray();
+ SdXMLImExSvgDElement aSvgDElement(aViewBox);
+
+ for (a = 0; a < nOuterCnt; a++)
+ {
+ drawing::PointSequence* pSequence = pOuterSequence++;
+ drawing::FlagSequence* pFlags = pOuterFlags++;
+
+ aSvgDElement.AddPolygon(pSequence, pFlags,
+ awt::Point( 0, 0 ),
+ awt::Size( aViewBox.GetWidth(), aViewBox.GetHeight() ),
+ bClosed);
+ }
+
+ // write point array
+ rExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aSvgDElement.GetExportString());
+
+ /////////////////
+ // Do Write
+ SvXMLElementExport rElem( rExport, XML_NAMESPACE_DRAW, XML_MARKER,
+ sal_True, sal_False );
+ }
+ }
+
+ return bRet;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/MultiPropertySetHelper.cxx b/xmloff/source/style/MultiPropertySetHelper.cxx
new file mode 100644
index 000000000000..dc5e2eee6cc7
--- /dev/null
+++ b/xmloff/source/style/MultiPropertySetHelper.cxx
@@ -0,0 +1,217 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "MultiPropertySetHelper.hxx"
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <comphelper/stl_types.hxx>
+
+// STL includes
+#include <algorithm>
+
+
+using ::com::sun::star::beans::XMultiPropertySet;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::beans::XPropertySetInfo;
+using ::com::sun::star::lang::XServiceInfo;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::comphelper::UStringLess;
+using ::rtl::OUString;
+using ::std::sort;
+
+
+MultiPropertySetHelper::MultiPropertySetHelper(
+ const sal_Char** pNames ) :
+ pPropertyNames( NULL ),
+ nLength( 0 ),
+ aPropertySequence(),
+ pSequenceIndex( NULL ),
+ aValues(),
+ pValues( NULL )
+{
+ // first count the elements
+ for( const sal_Char** pPtr = pNames; *pPtr != NULL; pPtr++ )
+ nLength++;
+
+ // allocate array and create strings
+ pPropertyNames = new OUString[nLength];
+ for( sal_Int16 i = 0; i < nLength; i++ )
+ pPropertyNames[i] = OUString::createFromAscii( pNames[i] );
+}
+
+MultiPropertySetHelper::MultiPropertySetHelper(
+ const OUString* pNames ) :
+ pPropertyNames( NULL ),
+ nLength( 0 ),
+ aPropertySequence(),
+ pSequenceIndex( NULL ),
+ aValues(),
+ pValues( NULL )
+{
+ // count elements
+ for( const OUString* pPtr = pNames; pPtr != NULL; pPtr++ )
+ nLength++;
+
+ // allocate array and assign strings
+ pPropertyNames = new OUString[nLength];
+ for( sal_Int16 i = 0; i < nLength; i++ )
+ pPropertyNames[i] = pNames[i];
+}
+
+
+MultiPropertySetHelper::~MultiPropertySetHelper()
+{
+ pValues = NULL; // memory 'owned' by aValues
+
+ delete[] pSequenceIndex;
+ delete[] pPropertyNames;
+}
+
+
+
+void MultiPropertySetHelper::hasProperties(
+ const Reference<XPropertySetInfo> & rInfo )
+{
+ DBG_ASSERT( rInfo.is(), "I'd really like an XPropertySetInfo here." );
+
+ // allocate sequence index
+ if ( NULL == pSequenceIndex )
+ pSequenceIndex = new sal_Int16[nLength] ;
+
+ // construct pSequenceIndex
+ sal_Int16 nNumberOfProperties = 0;
+ sal_Int16 i;
+
+ for( i = 0; i < nLength; i++ )
+ {
+ // ask for property
+ sal_Bool bHasProperty =
+ rInfo->hasPropertyByName( pPropertyNames[i] );
+
+ // set index and increment (if appropriate)
+ pSequenceIndex[i]= bHasProperty ? nNumberOfProperties : -1;
+ if ( bHasProperty )
+ nNumberOfProperties++;
+ }
+
+ // construct property sequence from index array
+ if ( aPropertySequence.getLength() != nNumberOfProperties )
+ aPropertySequence.realloc( nNumberOfProperties );
+ OUString* pPropertySequence = aPropertySequence.getArray();
+ for( i = 0; i < nLength; i ++ )
+ {
+ sal_Int16 nIndex = pSequenceIndex[i];
+ if ( nIndex != -1 )
+ pPropertySequence[nIndex] = pPropertyNames[i];
+ }
+}
+
+sal_Bool MultiPropertySetHelper::checkedProperties()
+{
+ return (NULL != pSequenceIndex);
+}
+
+
+
+void MultiPropertySetHelper::getValues(
+ const Reference<XMultiPropertySet> & rMultiPropertySet )
+{
+ DBG_ASSERT( rMultiPropertySet.is(), "We need an XMultiPropertySet." );
+
+ aValues = rMultiPropertySet->getPropertyValues( aPropertySequence );
+ pValues = aValues.getConstArray();
+}
+
+void MultiPropertySetHelper::getValues(
+ const Reference<XPropertySet> & rPropertySet )
+{
+ DBG_ASSERT( rPropertySet.is(), "We need an XPropertySet." );
+
+ // re-alloc aValues (if necessary) and fill with values from XPropertySet
+ sal_Int16 nSupportedPropertiesCount =
+ (sal_Int16)aPropertySequence.getLength();
+ if ( aValues.getLength() != nSupportedPropertiesCount )
+ aValues.realloc( nSupportedPropertiesCount );
+ Any* pMutableArray = aValues.getArray();
+ for( sal_Int16 i = 0; i < nSupportedPropertiesCount; i++ )
+ {
+ pMutableArray[i] = rPropertySet->getPropertyValue(
+ pPropertyNames[ pSequenceIndex[ i ] ] );
+ }
+
+ // re-establish pValues pointer
+ pValues = aValues.getConstArray();
+}
+
+
+const Any& MultiPropertySetHelper::getValue( sal_Int16 nIndex,
+ const Reference< XPropertySet> & rPropSet,
+ sal_Bool bTryMulti )
+{
+ if( !pValues )
+ {
+ if( bTryMulti )
+ {
+ Reference < XMultiPropertySet > xMultiPropSet( rPropSet,
+ UNO_QUERY );
+ if( xMultiPropSet.is() )
+ getValues( xMultiPropSet );
+ else
+ getValues( rPropSet );
+ }
+ else
+ {
+ getValues( rPropSet );
+ }
+ }
+
+ return getValue( nIndex );
+}
+
+const Any& MultiPropertySetHelper::getValue( sal_Int16 nIndex,
+ const Reference< XMultiPropertySet> & rMultiPropSet )
+{
+ if( !pValues )
+ getValues( rMultiPropSet );
+
+ return getValue( nIndex );
+}
+
+// inline methods defined in header:
+// inline Any& MultiPropertySetHelper::getValue( sal_Int16 nIndex )
+// inline sal_Bool MultiPropertySetHelper::hasProperty( sal_Int16 nValueNo )
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/NamedBoolPropertyHdl.cxx b/xmloff/source/style/NamedBoolPropertyHdl.cxx
new file mode 100644
index 000000000000..8f008a65751e
--- /dev/null
+++ b/xmloff/source/style/NamedBoolPropertyHdl.cxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <xmloff/NamedBoolPropertyHdl.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <comphelper/extract.hxx>
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/uno/Any.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star::uno;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLNamedBoolPropertyHdl
+//
+
+XMLNamedBoolPropertyHdl::~XMLNamedBoolPropertyHdl()
+{
+ // Nothing to do
+}
+
+sal_Bool XMLNamedBoolPropertyHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& ) const
+{
+ if( rStrImpValue == maTrueStr )
+ {
+ rValue = ::cppu::bool2any( sal_True );
+ return sal_True;
+ }
+
+ if( rStrImpValue == maFalseStr )
+ {
+ rValue = ::cppu::bool2any( sal_False );
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+sal_Bool XMLNamedBoolPropertyHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& ) const
+{
+ if( ::cppu::any2bool( rValue ) )
+ {
+ rStrExpValue = maTrueStr;
+ }
+ else
+ {
+ rStrExpValue = maFalseStr;
+ }
+
+ return sal_True;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/PageHeaderFooterContext.cxx b/xmloff/source/style/PageHeaderFooterContext.cxx
new file mode 100644
index 000000000000..5661ec44c16a
--- /dev/null
+++ b/xmloff/source/style/PageHeaderFooterContext.cxx
@@ -0,0 +1,100 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+
+
+// INCLUDE ---------------------------------------------------------------
+
+#include "PageHeaderFooterContext.hxx"
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include "PagePropertySetContext.hxx"
+
+using namespace com::sun::star;
+using ::xmloff::token::IsXMLToken;
+using ::xmloff::token::XML_HEADER_FOOTER_PROPERTIES;
+
+//------------------------------------------------------------------
+
+PageHeaderFooterContext::PageHeaderFooterContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>&,
+ ::std::vector< XMLPropertyState > & rTempProperties,
+ const UniReference < SvXMLImportPropertyMapper > &rTempMap,
+ sal_Int32 nStart, sal_Int32 nEnd,
+ const sal_Bool bTempHeader ) :
+ SvXMLImportContext( rImport, nPrfx, rLName ),
+ rProperties(rTempProperties),
+ nStartIndex(nStart),
+ nEndIndex(nEnd),
+ rMap(rTempMap)
+{
+ bHeader = bTempHeader;
+}
+
+PageHeaderFooterContext::~PageHeaderFooterContext()
+{
+}
+
+SvXMLImportContext *PageHeaderFooterContext::CreateChildContext( sal_uInt16 nPrefix,
+ const rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList )
+{
+ SvXMLImportContext *pContext = 0;
+
+ if( XML_NAMESPACE_STYLE == nPrefix && IsXMLToken( rLName, XML_HEADER_FOOTER_PROPERTIES ) )
+ {
+ PageContextType aType = Header;
+ if (!bHeader)
+ aType = Footer;
+ pContext = new PagePropertySetContext( GetImport(), nPrefix,
+ rLName, xAttrList,
+ XML_TYPE_PROP_HEADER_FOOTER,
+ rProperties,
+ rMap, nStartIndex, nEndIndex, aType);
+ }
+
+
+ if( !pContext )
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
+
+ return pContext;
+}
+
+void PageHeaderFooterContext::EndElement()
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/PageHeaderFooterContext.hxx b/xmloff/source/style/PageHeaderFooterContext.hxx
new file mode 100644
index 000000000000..b47b99577ccd
--- /dev/null
+++ b/xmloff/source/style/PageHeaderFooterContext.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PAGEHEADERFOOTERCONTEXT_HXX
+#define _XMLOFF_PAGEHEADERFOOTERCONTEXT_HXX
+
+#include <xmloff/xmlimp.hxx>
+
+class PageHeaderFooterContext : public SvXMLImportContext
+{
+ ::std::vector< XMLPropertyState > & rProperties;
+ sal_Int32 nStartIndex;
+ sal_Int32 nEndIndex;
+ sal_Bool bHeader;
+ const UniReference < SvXMLImportPropertyMapper > rMap;
+
+public:
+
+ PageHeaderFooterContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ ::std::vector< XMLPropertyState > & rProperties,
+ const UniReference < SvXMLImportPropertyMapper > &rMap,
+ sal_Int32 nStartIndex, sal_Int32 nEndIndex,
+ const sal_Bool bHeader);
+
+ virtual ~PageHeaderFooterContext();
+
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+ virtual void EndElement();
+};
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/PageMasterExportPropMapper.cxx b/xmloff/source/style/PageMasterExportPropMapper.cxx
new file mode 100644
index 000000000000..6a9b9d1d7a2f
--- /dev/null
+++ b/xmloff/source/style/PageMasterExportPropMapper.cxx
@@ -0,0 +1,446 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "PageMasterExportPropMapper.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <comphelper/types.hxx>
+#include <com/sun/star/table/BorderLine2.hpp>
+#include <xmloff/PageMasterStyleMap.hxx>
+#include <tools/debug.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <comphelper/extract.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::comphelper;
+using namespace ::xmloff::token;
+
+
+//______________________________________________________________________________
+
+inline sal_Bool lcl_HasSameLineWidth( const table::BorderLine2& rLine1, const table::BorderLine2& rLine2 )
+{
+ return (rLine1.InnerLineWidth == rLine2.InnerLineWidth) &&
+ (rLine1.OuterLineWidth == rLine2.OuterLineWidth) &&
+ (rLine1.LineDistance == rLine2.LineDistance) &&
+ (rLine1.LineWidth == rLine2.LineWidth);
+}
+
+inline sal_Bool operator==( const table::BorderLine2& rLine1, const table::BorderLine2& rLine2 )
+{
+ return (rLine1.Color == rLine2.Color) &&
+ lcl_HasSameLineWidth( rLine1, rLine2 ) &&
+ ( rLine1.LineStyle == rLine2.LineStyle );
+}
+
+inline void lcl_RemoveState( XMLPropertyState* pState )
+{
+ pState->mnIndex = -1;
+ pState->maValue.clear();
+}
+
+void lcl_RemoveStateIfZero16( XMLPropertyState* pState )
+{
+ sal_Int16 nValue = sal_Int16();
+ if( (pState->maValue >>= nValue) && !nValue )
+ lcl_RemoveState( pState );
+}
+
+void lcl_AddState(::std::vector< XMLPropertyState >& rPropState, sal_Int32 nIndex, const rtl::OUString& rProperty, uno::Reference< beans::XPropertySet >& xProps)
+{
+ if(::cppu::any2bool(xProps->getPropertyValue(rProperty)))
+ rPropState.push_back(XMLPropertyState (nIndex, cppu::bool2any(sal_True)));
+}
+
+//______________________________________________________________________________
+// helper struct to handle equal XMLPropertyState's for page, header and footer
+
+struct XMLPropertyStateBuffer
+{
+ XMLPropertyState* pPMBorderAll;
+ XMLPropertyState* pPMBorderTop;
+ XMLPropertyState* pPMBorderBottom;
+ XMLPropertyState* pPMBorderLeft;
+ XMLPropertyState* pPMBorderRight;
+
+ XMLPropertyState* pPMBorderWidthAll;
+ XMLPropertyState* pPMBorderWidthTop;
+ XMLPropertyState* pPMBorderWidthBottom;
+ XMLPropertyState* pPMBorderWidthLeft;
+ XMLPropertyState* pPMBorderWidthRight;
+
+ XMLPropertyState* pPMPaddingAll;
+ XMLPropertyState* pPMPaddingTop;
+ XMLPropertyState* pPMPaddingBottom;
+ XMLPropertyState* pPMPaddingLeft;
+ XMLPropertyState* pPMPaddingRight;
+
+ XMLPropertyStateBuffer();
+ void ContextFilter( ::std::vector< XMLPropertyState >& rPropState );
+};
+
+XMLPropertyStateBuffer::XMLPropertyStateBuffer() :
+ pPMBorderAll( NULL ),
+ pPMBorderTop( NULL ),
+ pPMBorderBottom( NULL ),
+ pPMBorderLeft( NULL ),
+ pPMBorderRight( NULL ),
+
+ pPMBorderWidthAll( NULL ),
+ pPMBorderWidthTop( NULL ),
+ pPMBorderWidthBottom( NULL ),
+ pPMBorderWidthLeft( NULL ),
+ pPMBorderWidthRight( NULL ),
+
+ pPMPaddingAll( NULL ),
+ pPMPaddingTop( NULL ),
+ pPMPaddingBottom( NULL ),
+ pPMPaddingLeft( NULL ),
+ pPMPaddingRight( NULL )
+{
+}
+
+void XMLPropertyStateBuffer::ContextFilter( ::std::vector< XMLPropertyState >& )
+{
+ if( pPMBorderAll )
+ {
+ if( pPMBorderTop && pPMBorderBottom && pPMBorderLeft && pPMBorderRight )
+ {
+ table::BorderLine2 aLineTop, aLineBottom, aLineLeft, aLineRight;
+
+ pPMBorderTop->maValue >>= aLineTop;
+ pPMBorderBottom->maValue >>= aLineBottom;
+ pPMBorderLeft->maValue >>= aLineLeft;
+ pPMBorderRight->maValue >>= aLineRight;
+
+ if( (aLineTop == aLineBottom) && (aLineBottom == aLineLeft) && (aLineLeft == aLineRight) )
+ {
+ lcl_RemoveState( pPMBorderTop );
+ lcl_RemoveState( pPMBorderBottom );
+ lcl_RemoveState( pPMBorderLeft );
+ lcl_RemoveState( pPMBorderRight );
+ }
+ else
+ lcl_RemoveState( pPMBorderAll );
+ }
+ else
+ lcl_RemoveState( pPMBorderAll );
+ }
+
+ if( pPMBorderWidthAll )
+ {
+ if( pPMBorderWidthTop && pPMBorderWidthBottom && pPMBorderWidthLeft && pPMBorderWidthRight )
+ {
+ table::BorderLine2 aLineTop, aLineBottom, aLineLeft, aLineRight;
+
+ pPMBorderWidthTop->maValue >>= aLineTop;
+ pPMBorderWidthBottom->maValue >>= aLineBottom;
+ pPMBorderWidthLeft->maValue >>= aLineLeft;
+ pPMBorderWidthRight->maValue >>= aLineRight;
+
+ if( lcl_HasSameLineWidth( aLineTop, aLineBottom ) &&
+ lcl_HasSameLineWidth( aLineBottom, aLineLeft ) &&
+ lcl_HasSameLineWidth( aLineLeft, aLineRight ) )
+ {
+ lcl_RemoveState( pPMBorderWidthTop );
+ lcl_RemoveState( pPMBorderWidthBottom );
+ lcl_RemoveState( pPMBorderWidthLeft );
+ lcl_RemoveState( pPMBorderWidthRight );
+ }
+ else
+ lcl_RemoveState( pPMBorderWidthAll );
+ }
+ else
+ lcl_RemoveState( pPMBorderWidthAll );
+ }
+
+ if( pPMPaddingAll )
+ {
+ if( pPMPaddingTop && pPMPaddingBottom && pPMPaddingLeft && pPMPaddingRight )
+ {
+ sal_Int32 nTop = 0, nBottom = 0, nLeft = 0, nRight = 0;
+
+ pPMPaddingTop->maValue >>= nTop;
+ pPMPaddingBottom->maValue >>= nBottom;
+ pPMPaddingLeft->maValue >>= nLeft;
+ pPMPaddingRight->maValue >>= nRight;
+
+ if( (nTop == nBottom) && (nBottom == nLeft) && (nLeft == nRight) )
+ {
+ lcl_RemoveState( pPMPaddingTop );
+ lcl_RemoveState( pPMPaddingBottom );
+ lcl_RemoveState( pPMPaddingLeft );
+ lcl_RemoveState( pPMPaddingRight );
+ }
+ else
+ lcl_RemoveState( pPMPaddingAll );
+ }
+ else
+ lcl_RemoveState( pPMPaddingAll );
+ }
+}
+
+//______________________________________________________________________________
+
+XMLPageMasterExportPropMapper::XMLPageMasterExportPropMapper(
+ const UniReference< XMLPropertySetMapper >& rMapper,
+ SvXMLExport& rExport ) :
+ SvXMLExportPropertyMapper( rMapper ),
+ aBackgroundImageExport( rExport ),
+ aTextColumnsExport( rExport ),
+ aFootnoteSeparatorExport( rExport )
+{
+}
+
+XMLPageMasterExportPropMapper::~XMLPageMasterExportPropMapper()
+{
+}
+
+void XMLPageMasterExportPropMapper::handleElementItem(
+ SvXMLExport&,
+ const XMLPropertyState& rProperty,
+ sal_uInt16 /*nFlags*/,
+ const ::std::vector< XMLPropertyState >* pProperties,
+ sal_uInt32 nIdx ) const
+{
+ XMLPageMasterExportPropMapper* pThis = (XMLPageMasterExportPropMapper*) this;
+
+ sal_uInt32 nContextId = getPropertySetMapper()->GetEntryContextId( rProperty.mnIndex );
+ switch( nContextId )
+ {
+ case CTF_PM_GRAPHICURL:
+ case CTF_PM_HEADERGRAPHICURL:
+ case CTF_PM_FOOTERGRAPHICURL:
+ {
+ DBG_ASSERT( pProperties && (nIdx >= 2), "property vector missing" );
+ sal_Int32 nPos;
+ sal_Int32 nFilter;
+ switch( nContextId )
+ {
+ case CTF_PM_GRAPHICURL:
+ nPos = CTF_PM_GRAPHICPOSITION;
+ nFilter = CTF_PM_GRAPHICFILTER;
+ break;
+ case CTF_PM_HEADERGRAPHICURL:
+ nPos = CTF_PM_HEADERGRAPHICPOSITION;
+ nFilter = CTF_PM_HEADERGRAPHICFILTER;
+ break;
+ case CTF_PM_FOOTERGRAPHICURL:
+ nPos = CTF_PM_FOOTERGRAPHICPOSITION;
+ nFilter = CTF_PM_FOOTERGRAPHICFILTER;
+ break;
+ default:
+ nPos = 0; // TODO What values should this be?
+ nFilter = 0;
+ }
+ const Any* pPos = NULL;
+ const Any* pFilter = NULL;
+ if( pProperties && (nIdx >= 2) )
+ {
+ const XMLPropertyState& rPos = (*pProperties)[nIdx - 2];
+ DBG_ASSERT( getPropertySetMapper()->GetEntryContextId( rPos.mnIndex ) == nPos,
+ "invalid property map: pos expected" );
+ if( getPropertySetMapper()->GetEntryContextId( rPos.mnIndex ) == nPos )
+ pPos = &rPos.maValue;
+
+ const XMLPropertyState& rFilter = (*pProperties)[nIdx - 1];
+ DBG_ASSERT( getPropertySetMapper()->GetEntryContextId( rFilter.mnIndex ) == nFilter,
+ "invalid property map: filter expected" );
+ if( getPropertySetMapper()->GetEntryContextId( rFilter.mnIndex ) == nFilter )
+ pFilter = &rFilter.maValue;
+ }
+ sal_uInt32 nPropIndex = rProperty.mnIndex;
+ pThis->aBackgroundImageExport.exportXML( rProperty.maValue, pPos, pFilter, NULL,
+ getPropertySetMapper()->GetEntryNameSpace( nPropIndex ),
+ getPropertySetMapper()->GetEntryXMLName( nPropIndex ) );
+ }
+ break;
+ case CTF_PM_TEXTCOLUMNS:
+ pThis->aTextColumnsExport.exportXML( rProperty.maValue );
+ break;
+ case CTF_PM_FTN_LINE_WEIGTH:
+ pThis->aFootnoteSeparatorExport.exportXML( pProperties, nIdx,
+ getPropertySetMapper());
+ break;
+ }
+}
+
+void XMLPageMasterExportPropMapper::handleSpecialItem(
+ SvXMLAttributeList&,
+ const XMLPropertyState&,
+ const SvXMLUnitConverter&,
+ const SvXMLNamespaceMap&,
+ const ::std::vector< XMLPropertyState >*,
+ sal_uInt32 /*nIdx*/) const
+{
+}
+
+void XMLPageMasterExportPropMapper::ContextFilter(
+ ::std::vector< XMLPropertyState >& rPropState,
+ Reference< XPropertySet > rPropSet ) const
+{
+ XMLPropertyStateBuffer aPageBuffer;
+ XMLPropertyStateBuffer aHeaderBuffer;
+ XMLPropertyStateBuffer aFooterBuffer;
+
+ XMLPropertyState* pPMHeaderHeight = NULL;
+ XMLPropertyState* pPMHeaderMinHeight = NULL;
+ XMLPropertyState* pPMHeaderDynamic = NULL;
+
+ XMLPropertyState* pPMFooterHeight = NULL;
+ XMLPropertyState* pPMFooterMinHeight = NULL;
+ XMLPropertyState* pPMFooterDynamic = NULL;
+
+ XMLPropertyState* pPMScaleTo = NULL;
+ XMLPropertyState* pPMScaleToPages = NULL;
+ XMLPropertyState* pPMScaleToX = NULL;
+ XMLPropertyState* pPMScaleToY = NULL;
+ XMLPropertyState* pPMStandardMode = NULL;
+ XMLPropertyState* pPMGridBaseWidth = NULL;
+ XMLPropertyState* pPMGridSnapToChars = NULL;
+
+ XMLPropertyState* pPrint = NULL;
+
+ UniReference < XMLPropertySetMapper > aPropMapper(getPropertySetMapper());
+
+ for( ::std::vector< XMLPropertyState >::iterator aIter = rPropState.begin(); aIter != rPropState.end(); ++aIter )
+ {
+ XMLPropertyState *pProp = &(*aIter);
+ sal_Int16 nContextId = aPropMapper->GetEntryContextId( pProp->mnIndex );
+ sal_Int16 nFlag = nContextId & CTF_PM_FLAGMASK;
+ sal_Int16 nSimpleId = nContextId & (~CTF_PM_FLAGMASK | XML_PM_CTF_START);
+ sal_Int16 nPrintId = nContextId & CTF_PM_PRINTMASK;
+
+ XMLPropertyStateBuffer* pBuffer;
+ switch( nFlag )
+ {
+ case CTF_PM_HEADERFLAG: pBuffer = &aHeaderBuffer; break;
+ case CTF_PM_FOOTERFLAG: pBuffer = &aFooterBuffer; break;
+ default: pBuffer = &aPageBuffer; break;
+ }
+
+ switch( nSimpleId )
+ {
+ case CTF_PM_BORDERALL: pBuffer->pPMBorderAll = pProp; break;
+ case CTF_PM_BORDERTOP: pBuffer->pPMBorderTop = pProp; break;
+ case CTF_PM_BORDERBOTTOM: pBuffer->pPMBorderBottom = pProp; break;
+ case CTF_PM_BORDERLEFT: pBuffer->pPMBorderLeft = pProp; break;
+ case CTF_PM_BORDERRIGHT: pBuffer->pPMBorderRight = pProp; break;
+ case CTF_PM_BORDERWIDTHALL: pBuffer->pPMBorderWidthAll = pProp; break;
+ case CTF_PM_BORDERWIDTHTOP: pBuffer->pPMBorderWidthTop = pProp; break;
+ case CTF_PM_BORDERWIDTHBOTTOM: pBuffer->pPMBorderWidthBottom = pProp; break;
+ case CTF_PM_BORDERWIDTHLEFT: pBuffer->pPMBorderWidthLeft = pProp; break;
+ case CTF_PM_BORDERWIDTHRIGHT: pBuffer->pPMBorderWidthRight = pProp; break;
+ case CTF_PM_PADDINGALL: pBuffer->pPMPaddingAll = pProp; break;
+ case CTF_PM_PADDINGTOP: pBuffer->pPMPaddingTop = pProp; break;
+ case CTF_PM_PADDINGBOTTOM: pBuffer->pPMPaddingBottom = pProp; break;
+ case CTF_PM_PADDINGLEFT: pBuffer->pPMPaddingLeft = pProp; break;
+ case CTF_PM_PADDINGRIGHT: pBuffer->pPMPaddingRight = pProp; break;
+ }
+
+ switch( nContextId )
+ {
+ case CTF_PM_HEADERHEIGHT: pPMHeaderHeight = pProp; break;
+ case CTF_PM_HEADERMINHEIGHT: pPMHeaderMinHeight = pProp; break;
+ case CTF_PM_HEADERDYNAMIC: pPMHeaderDynamic = pProp; break;
+ case CTF_PM_FOOTERHEIGHT: pPMFooterHeight = pProp; break;
+ case CTF_PM_FOOTERMINHEIGHT: pPMFooterMinHeight = pProp; break;
+ case CTF_PM_FOOTERDYNAMIC: pPMFooterDynamic = pProp; break;
+ case CTF_PM_SCALETO: pPMScaleTo = pProp; break;
+ case CTF_PM_SCALETOPAGES: pPMScaleToPages = pProp; break;
+ case CTF_PM_SCALETOX: pPMScaleToX = pProp; break;
+ case CTF_PM_SCALETOY: pPMScaleToY = pProp; break;
+ case CTF_PM_STANDARD_MODE: pPMStandardMode = pProp; break;
+ case CTP_PM_GRID_BASE_WIDTH: pPMGridBaseWidth = pProp; break;
+ case CTP_PM_GRID_SNAP_TO_CHARS: pPMGridSnapToChars = pProp; break;
+ }
+ if (nPrintId == CTF_PM_PRINTMASK)
+ {
+ pPrint = pProp;
+ lcl_RemoveState(pPrint);
+ }
+ }
+
+ if( pPMStandardMode && !getBOOL(pPMStandardMode->maValue) )
+ {
+ lcl_RemoveState(pPMStandardMode);
+ if( pPMGridBaseWidth )
+ lcl_RemoveState(pPMGridBaseWidth);
+ if( pPMGridSnapToChars )
+ lcl_RemoveState(pPMGridSnapToChars);
+ }
+
+ if( pPMGridBaseWidth && pPMStandardMode )
+ lcl_RemoveState(pPMStandardMode);
+
+ aPageBuffer.ContextFilter( rPropState );
+ aHeaderBuffer.ContextFilter( rPropState );
+ aFooterBuffer.ContextFilter( rPropState );
+
+ if( pPMHeaderHeight && (!pPMHeaderDynamic || (pPMHeaderDynamic && getBOOL( pPMHeaderDynamic->maValue ))) )
+ lcl_RemoveState( pPMHeaderHeight );
+ if( pPMHeaderMinHeight && pPMHeaderDynamic && !getBOOL( pPMHeaderDynamic->maValue ) )
+ lcl_RemoveState( pPMHeaderMinHeight );
+ if( pPMHeaderDynamic )
+ lcl_RemoveState( pPMHeaderDynamic );
+
+ if( pPMFooterHeight && (!pPMFooterDynamic || (pPMFooterDynamic && getBOOL( pPMFooterDynamic->maValue ))) )
+ lcl_RemoveState( pPMFooterHeight );
+ if( pPMFooterMinHeight && pPMFooterDynamic && !getBOOL( pPMFooterDynamic->maValue ) )
+ lcl_RemoveState( pPMFooterMinHeight );
+ if( pPMFooterDynamic )
+ lcl_RemoveState( pPMFooterDynamic );
+
+ if( pPMScaleTo )
+ lcl_RemoveStateIfZero16( pPMScaleTo );
+ if( pPMScaleToPages )
+ lcl_RemoveStateIfZero16( pPMScaleToPages );
+ if( pPMScaleToX )
+ lcl_RemoveStateIfZero16( pPMScaleToX );
+ if( pPMScaleToY )
+ lcl_RemoveStateIfZero16( pPMScaleToY );
+
+ if (pPrint)
+ {
+ lcl_AddState(rPropState, aPropMapper->FindEntryIndex(CTF_PM_PRINT_ANNOTATIONS), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PrintAnnotations")), rPropSet);
+ lcl_AddState(rPropState, aPropMapper->FindEntryIndex(CTF_PM_PRINT_CHARTS), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PrintCharts")), rPropSet);
+ lcl_AddState(rPropState, aPropMapper->FindEntryIndex(CTF_PM_PRINT_DRAWING), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PrintDrawing")), rPropSet);
+ lcl_AddState(rPropState, aPropMapper->FindEntryIndex(CTF_PM_PRINT_FORMULAS), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PrintFormulas")), rPropSet);
+ lcl_AddState(rPropState, aPropMapper->FindEntryIndex(CTF_PM_PRINT_GRID), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PrintGrid")), rPropSet);
+ lcl_AddState(rPropState, aPropMapper->FindEntryIndex(CTF_PM_PRINT_HEADERS), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PrintHeaders")), rPropSet);
+ lcl_AddState(rPropState, aPropMapper->FindEntryIndex(CTF_PM_PRINT_OBJECTS), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PrintObjects")), rPropSet);
+ lcl_AddState(rPropState, aPropMapper->FindEntryIndex(CTF_PM_PRINT_ZEROVALUES), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PrintZeroValues")), rPropSet);
+ }
+
+ SvXMLExportPropertyMapper::ContextFilter(rPropState,rPropSet);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/PageMasterExportPropMapper.hxx b/xmloff/source/style/PageMasterExportPropMapper.hxx
new file mode 100644
index 000000000000..20617b0726de
--- /dev/null
+++ b/xmloff/source/style/PageMasterExportPropMapper.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PAGEMASTEREXPORTPROPMAPPER_HXX
+#define _XMLOFF_PAGEMASTEREXPORTPROPMAPPER_HXX
+
+#include <xmloff/xmlexppr.hxx>
+#include "XMLBackgroundImageExport.hxx"
+#include "XMLTextColumnsExport.hxx"
+#include "XMLFootnoteSeparatorExport.hxx"
+
+//______________________________________________________________________________
+
+class XMLPageMasterExportPropMapper : public SvXMLExportPropertyMapper
+{
+protected:
+ XMLBackgroundImageExport aBackgroundImageExport;
+ XMLTextColumnsExport aTextColumnsExport;
+ XMLFootnoteSeparatorExport aFootnoteSeparatorExport;
+
+ virtual void ContextFilter(
+ ::std::vector< XMLPropertyState >& rProperties,
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rPropSet
+ ) const;
+
+public:
+ XMLPageMasterExportPropMapper(
+ const UniReference< XMLPropertySetMapper >& rMapper,
+ SvXMLExport& rExport
+ );
+ virtual ~XMLPageMasterExportPropMapper();
+
+ virtual void handleElementItem(
+ SvXMLExport& rExport,
+ const XMLPropertyState& rProperty,
+ sal_uInt16 nFlags,
+ const ::std::vector< XMLPropertyState >* pProperties = 0,
+ sal_uInt32 nIdx = 0
+ ) const;
+ virtual void handleSpecialItem(
+ SvXMLAttributeList& rAttrList,
+ const XMLPropertyState& rProperty,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ const ::std::vector< XMLPropertyState >* pProperties = 0,
+ sal_uInt32 nIdx = 0
+ ) const;
+
+ inline XMLBackgroundImageExport& GetBackgroundImageExport()
+ { return aBackgroundImageExport; }
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/PageMasterImportContext.cxx b/xmloff/source/style/PageMasterImportContext.cxx
new file mode 100644
index 000000000000..fbaff859da3f
--- /dev/null
+++ b/xmloff/source/style/PageMasterImportContext.cxx
@@ -0,0 +1,197 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+#include "PageMasterImportContext.hxx"
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include "PageMasterPropHdl.hxx"
+#include "PagePropertySetContext.hxx"
+#include "PageHeaderFooterContext.hxx"
+#include "PageMasterPropMapper.hxx"
+#include "PageMasterImportPropMapper.hxx"
+#include <xmloff/PageMasterStyleMap.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+
+void PageStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
+ const rtl::OUString& rLocalName,
+ const rtl::OUString& rValue )
+{
+ // TODO: use a map here
+ if( XML_NAMESPACE_STYLE == nPrefixKey && IsXMLToken( rLocalName, XML_PAGE_USAGE ) )
+ {
+ sPageUsage = rValue;
+ }
+ else
+ {
+ XMLPropStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
+ }
+}
+
+TYPEINIT1( PageStyleContext, XMLPropStyleContext );
+
+PageStyleContext::PageStyleContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx, const rtl::OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList,
+ SvXMLStylesContext& rStyles,
+ sal_Bool bDefaultStyle) :
+ XMLPropStyleContext( rImport, nPrfx, rLName, xAttrList, rStyles, XML_STYLE_FAMILY_PAGE_MASTER, bDefaultStyle),
+ sPageUsage()
+{
+}
+
+PageStyleContext::~PageStyleContext()
+{
+}
+
+SvXMLImportContext *PageStyleContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList )
+{
+ SvXMLImportContext *pContext = NULL;
+
+ if( XML_NAMESPACE_STYLE == nPrefix &&
+ ((IsXMLToken(rLocalName, XML_HEADER_STYLE )) ||
+ (IsXMLToken(rLocalName, XML_FOOTER_STYLE )) ) )
+ {
+ sal_Bool bHeader = IsXMLToken(rLocalName, XML_HEADER_STYLE);
+ UniReference < SvXMLImportPropertyMapper > xImpPrMap =
+ GetStyles()->GetImportPropertyMapper( GetFamily() );
+ if( xImpPrMap.is() )
+ {
+ const UniReference< XMLPropertySetMapper >& rMapper = xImpPrMap->getPropertySetMapper();
+ sal_Int32 nFlag;
+ if (bHeader)
+ nFlag = CTF_PM_HEADERFLAG;
+ else
+ nFlag = CTF_PM_FOOTERFLAG;
+ sal_Int32 nStartIndex (-1);
+ sal_Int32 nEndIndex (-1);
+ sal_Bool bFirst(sal_False);
+ sal_Bool bEnd(sal_False);
+ sal_Int32 nIndex = 0;
+ while ( nIndex < rMapper->GetEntryCount() && !bEnd)
+ {
+ if ((rMapper->GetEntryContextId( nIndex ) & CTF_PM_FLAGMASK) == nFlag)
+ {
+ if (!bFirst)
+ {
+ bFirst = sal_True;
+ nStartIndex = nIndex;
+ }
+ }
+ else if (bFirst)
+ {
+ bEnd = sal_True;
+ nEndIndex = nIndex;
+ }
+ nIndex++;
+ }
+ if (!bEnd)
+ nEndIndex = nIndex;
+ pContext = new PageHeaderFooterContext(GetImport(), nPrefix, rLocalName,
+ xAttrList, GetProperties(), xImpPrMap, nStartIndex, nEndIndex, bHeader);
+ }
+ }
+ if( XML_NAMESPACE_STYLE == nPrefix &&
+ IsXMLToken(rLocalName, XML_PAGE_LAYOUT_PROPERTIES) )
+ {
+ UniReference < SvXMLImportPropertyMapper > xImpPrMap =
+ GetStyles()->GetImportPropertyMapper( GetFamily() );
+ if( xImpPrMap.is() )
+ {
+ const UniReference< XMLPropertySetMapper >& rMapper = xImpPrMap->getPropertySetMapper();
+ sal_Int32 nEndIndex (-1);
+ sal_Bool bEnd(sal_False);
+ sal_Int32 nIndex = 0;
+ sal_Int16 nContextID;
+ while ( nIndex < rMapper->GetEntryCount() && !bEnd)
+ {
+ nContextID = rMapper->GetEntryContextId( nIndex );
+ if (nContextID && ((nContextID & CTF_PM_FLAGMASK) != XML_PM_CTF_START))
+ {
+ nEndIndex = nIndex;
+ bEnd = sal_True;
+ }
+ nIndex++;
+ }
+ if (!bEnd)
+ nEndIndex = nIndex;
+ PageContextType aType = Page;
+ pContext = new PagePropertySetContext( GetImport(), nPrefix,
+ rLocalName, xAttrList,
+ XML_TYPE_PROP_PAGE_LAYOUT,
+ GetProperties(),
+ xImpPrMap, 0, nEndIndex, aType);
+ }
+ }
+
+ if (!pContext)
+ pContext = XMLPropStyleContext::CreateChildContext( nPrefix, rLocalName,
+ xAttrList );
+ return pContext;
+}
+
+void PageStyleContext::FillPropertySet(
+ const uno::Reference<beans::XPropertySet > & rPropSet )
+{
+ XMLPropStyleContext::FillPropertySet(rPropSet);
+ if (sPageUsage.getLength())
+ {
+ uno::Any aPageUsage;
+ XMLPMPropHdl_PageStyleLayout aPageUsageHdl;
+ if (aPageUsageHdl.importXML(sPageUsage, aPageUsage, GetImport().GetMM100UnitConverter()))
+ rPropSet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PageStyleLayout")), aPageUsage);
+ }
+}
+
+// text grid enhancement for better CJK support
+//set default page layout style
+void PageStyleContext::SetDefaults( )
+{
+ Reference < XMultiServiceFactory > xFactory ( GetImport().GetModel(), UNO_QUERY);
+ if (xFactory.is())
+ {
+ Reference < XInterface > xInt = xFactory->createInstance (
+ rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.text.Defaults" ) ) );
+ Reference < beans::XPropertySet > xProperties ( xInt, UNO_QUERY );
+ if ( xProperties.is() )
+ FillPropertySet ( xProperties );
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/PageMasterImportPropMapper.cxx b/xmloff/source/style/PageMasterImportPropMapper.cxx
new file mode 100644
index 000000000000..e8c82edb7f5b
--- /dev/null
+++ b/xmloff/source/style/PageMasterImportPropMapper.cxx
@@ -0,0 +1,342 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+#include "PageMasterImportPropMapper.hxx"
+#include "PageMasterPropMapper.hxx"
+#include <xmloff/PageMasterStyleMap.hxx>
+#include <xmloff/maptype.hxx>
+#include <com/sun/star/table/BorderLine2.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <xmloff/xmlimp.hxx>
+
+#define XML_LINE_LEFT 0
+#define XML_LINE_RIGHT 1
+#define XML_LINE_TOP 2
+#define XML_LINE_BOTTOM 3
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::container;
+
+PageMasterImportPropertyMapper::PageMasterImportPropertyMapper(
+ const UniReference< XMLPropertySetMapper >& rMapper,
+ SvXMLImport& rImp ) :
+ SvXMLImportPropertyMapper( rMapper, rImp ),
+ rImport( rImp )
+{
+}
+
+PageMasterImportPropertyMapper::~PageMasterImportPropertyMapper()
+{
+}
+
+bool PageMasterImportPropertyMapper::handleSpecialItem(
+ XMLPropertyState& rProperty,
+ ::std::vector< XMLPropertyState >& rProperties,
+ const ::rtl::OUString& rValue,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int16 nContextID =
+ getPropertySetMapper()->GetEntryContextId(rProperty.mnIndex);
+
+ if( CTF_PM_REGISTER_STYLE==nContextID )
+ {
+ ::rtl::OUString sDisplayName( rImport.GetStyleDisplayName(
+ XML_STYLE_FAMILY_TEXT_PARAGRAPH, rValue ) );
+ Reference < XNameContainer > xParaStyles =
+ rImport.GetTextImport()->GetParaStyles();
+ if( xParaStyles.is() && xParaStyles->hasByName( sDisplayName ) )
+ {
+ rProperty.maValue <<= sDisplayName;
+ bRet = sal_True;
+ }
+ }
+ else
+ {
+ bRet = SvXMLImportPropertyMapper::handleSpecialItem(
+ rProperty, rProperties, rValue,
+ rUnitConverter, rNamespaceMap );
+ }
+
+ return bRet;
+}
+
+
+void PageMasterImportPropertyMapper::finished(::std::vector< XMLPropertyState >& rProperties, sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const
+{
+ SvXMLImportPropertyMapper::finished(rProperties, nStartIndex, nEndIndex);
+ XMLPropertyState* pAllPaddingProperty = NULL;
+ XMLPropertyState* pPadding[4] = { NULL, NULL, NULL, NULL };
+ XMLPropertyState* pNewPadding[4] = { NULL, NULL, NULL, NULL };
+ XMLPropertyState* pAllBorderProperty = NULL;
+ XMLPropertyState* pBorders[4] = { NULL, NULL, NULL, NULL };
+ XMLPropertyState* pNewBorders[4] = { NULL, NULL, NULL, NULL };
+ XMLPropertyState* pAllBorderWidthProperty = NULL;
+ XMLPropertyState* pBorderWidths[4] = { NULL, NULL, NULL, NULL };
+ XMLPropertyState* pAllHeaderPaddingProperty = NULL;
+ XMLPropertyState* pHeaderPadding[4] = { NULL, NULL, NULL, NULL };
+ XMLPropertyState* pHeaderNewPadding[4] = { NULL, NULL, NULL, NULL };
+ XMLPropertyState* pAllHeaderBorderProperty = NULL;
+ XMLPropertyState* pHeaderBorders[4] = { NULL, NULL, NULL, NULL };
+ XMLPropertyState* pHeaderNewBorders[4] = { NULL, NULL, NULL, NULL };
+ XMLPropertyState* pAllHeaderBorderWidthProperty = NULL;
+ XMLPropertyState* pHeaderBorderWidths[4] = { NULL, NULL, NULL, NULL };
+ XMLPropertyState* pAllFooterPaddingProperty = NULL;
+ XMLPropertyState* pFooterPadding[4] = { NULL, NULL, NULL, NULL };
+ XMLPropertyState* pFooterNewPadding[4] = { NULL, NULL, NULL, NULL };
+ XMLPropertyState* pAllFooterBorderProperty = NULL;
+ XMLPropertyState* pFooterBorders[4] = { NULL, NULL, NULL, NULL };
+ XMLPropertyState* pFooterNewBorders[4] = { NULL, NULL, NULL, NULL };
+ XMLPropertyState* pAllFooterBorderWidthProperty = NULL;
+ XMLPropertyState* pFooterBorderWidths[4] = { NULL, NULL, NULL, NULL };
+ XMLPropertyState* pHeaderHeight = NULL;
+ XMLPropertyState* pHeaderMinHeight = NULL;
+ XMLPropertyState* pHeaderDynamic = NULL;
+ XMLPropertyState* pFooterHeight = NULL;
+ XMLPropertyState* pFooterMinHeight = NULL;
+ XMLPropertyState* pFooterDynamic = NULL;
+ sal_uInt16 i; // for the "for" loop
+
+ ::std::vector< XMLPropertyState >::iterator aEnd = rProperties.end();
+ for (::std::vector< XMLPropertyState >::iterator aIter = rProperties.begin(); aIter != aEnd; ++aIter)
+ {
+ XMLPropertyState *property = &(*aIter);
+ sal_Int16 nContextID = getPropertySetMapper()->GetEntryContextId(property->mnIndex);
+ if (property->mnIndex >= nStartIndex && property->mnIndex < nEndIndex)
+ {
+ switch (nContextID)
+ {
+ case CTF_PM_PADDINGALL : pAllPaddingProperty = property; break;
+ case CTF_PM_PADDINGLEFT : pPadding[XML_LINE_LEFT] = property; break;
+ case CTF_PM_PADDINGRIGHT : pPadding[XML_LINE_RIGHT] = property; break;
+ case CTF_PM_PADDINGTOP : pPadding[XML_LINE_TOP] = property; break;
+ case CTF_PM_PADDINGBOTTOM : pPadding[XML_LINE_BOTTOM] = property; break;
+ case CTF_PM_BORDERALL : pAllBorderProperty = property; break;
+ case CTF_PM_BORDERLEFT : pBorders[XML_LINE_LEFT] = property; break;
+ case CTF_PM_BORDERRIGHT : pBorders[XML_LINE_RIGHT] = property; break;
+ case CTF_PM_BORDERTOP : pBorders[XML_LINE_TOP] = property; break;
+ case CTF_PM_BORDERBOTTOM : pBorders[XML_LINE_BOTTOM] = property; break;
+ case CTF_PM_BORDERWIDTHALL : pAllBorderWidthProperty = property; break;
+ case CTF_PM_BORDERWIDTHLEFT : pBorderWidths[XML_LINE_LEFT] = property; break;
+ case CTF_PM_BORDERWIDTHRIGHT : pBorderWidths[XML_LINE_RIGHT] = property; break;
+ case CTF_PM_BORDERWIDTHTOP : pBorderWidths[XML_LINE_TOP] = property; break;
+ case CTF_PM_BORDERWIDTHBOTTOM : pBorderWidths[XML_LINE_BOTTOM] = property; break;
+ case CTF_PM_HEADERPADDINGALL : pAllHeaderPaddingProperty = property; break;
+ case CTF_PM_HEADERPADDINGLEFT : pHeaderPadding[XML_LINE_LEFT] = property; break;
+ case CTF_PM_HEADERPADDINGRIGHT : pHeaderPadding[XML_LINE_RIGHT] = property; break;
+ case CTF_PM_HEADERPADDINGTOP : pHeaderPadding[XML_LINE_TOP] = property; break;
+ case CTF_PM_HEADERPADDINGBOTTOM : pHeaderPadding[XML_LINE_BOTTOM] = property; break;
+ case CTF_PM_HEADERBORDERALL : pAllHeaderBorderProperty = property; break;
+ case CTF_PM_HEADERBORDERLEFT : pHeaderBorders[XML_LINE_LEFT] = property; break;
+ case CTF_PM_HEADERBORDERRIGHT : pHeaderBorders[XML_LINE_RIGHT] = property; break;
+ case CTF_PM_HEADERBORDERTOP : pHeaderBorders[XML_LINE_TOP] = property; break;
+ case CTF_PM_HEADERBORDERBOTTOM : pHeaderBorders[XML_LINE_BOTTOM] = property; break;
+ case CTF_PM_HEADERBORDERWIDTHALL : pAllHeaderBorderWidthProperty = property; break;
+ case CTF_PM_HEADERBORDERWIDTHLEFT : pHeaderBorderWidths[XML_LINE_LEFT] = property; break;
+ case CTF_PM_HEADERBORDERWIDTHRIGHT : pHeaderBorderWidths[XML_LINE_RIGHT] = property; break;
+ case CTF_PM_HEADERBORDERWIDTHTOP : pHeaderBorderWidths[XML_LINE_TOP] = property; break;
+ case CTF_PM_HEADERBORDERWIDTHBOTTOM : pHeaderBorderWidths[XML_LINE_BOTTOM] = property; break;
+ case CTF_PM_FOOTERPADDINGALL : pAllFooterPaddingProperty = property; break;
+ case CTF_PM_FOOTERPADDINGLEFT : pFooterPadding[XML_LINE_LEFT] = property; break;
+ case CTF_PM_FOOTERPADDINGRIGHT : pFooterPadding[XML_LINE_RIGHT] = property; break;
+ case CTF_PM_FOOTERPADDINGTOP : pFooterPadding[XML_LINE_TOP] = property; break;
+ case CTF_PM_FOOTERPADDINGBOTTOM : pFooterPadding[XML_LINE_BOTTOM] = property; break;
+ case CTF_PM_FOOTERBORDERALL : pAllFooterBorderProperty = property; break;
+ case CTF_PM_FOOTERBORDERLEFT : pFooterBorders[XML_LINE_LEFT] = property; break;
+ case CTF_PM_FOOTERBORDERRIGHT : pFooterBorders[XML_LINE_RIGHT] = property; break;
+ case CTF_PM_FOOTERBORDERTOP : pFooterBorders[XML_LINE_TOP] = property; break;
+ case CTF_PM_FOOTERBORDERBOTTOM : pFooterBorders[XML_LINE_BOTTOM] = property; break;
+ case CTF_PM_FOOTERBORDERWIDTHALL : pAllFooterBorderWidthProperty = property; break;
+ case CTF_PM_FOOTERBORDERWIDTHLEFT : pFooterBorderWidths[XML_LINE_LEFT] = property; break;
+ case CTF_PM_FOOTERBORDERWIDTHRIGHT : pFooterBorderWidths[XML_LINE_RIGHT] = property; break;
+ case CTF_PM_FOOTERBORDERWIDTHTOP : pFooterBorderWidths[XML_LINE_TOP] = property; break;
+ case CTF_PM_FOOTERBORDERWIDTHBOTTOM : pFooterBorderWidths[XML_LINE_BOTTOM] = property; break;
+ case CTF_PM_HEADERHEIGHT : pHeaderHeight = property; break;
+ case CTF_PM_HEADERMINHEIGHT : pHeaderMinHeight = property; break;
+ case CTF_PM_FOOTERHEIGHT : pFooterHeight = property; break;
+ case CTF_PM_FOOTERMINHEIGHT : pFooterMinHeight = property; break;
+ }
+ }
+ }
+
+ for ( i = 0; i < 4; i++)
+ {
+ if (pAllPaddingProperty && !pPadding[i])
+ pNewPadding[i] = new XMLPropertyState(pAllPaddingProperty->mnIndex + 1 + i, pAllPaddingProperty->maValue);
+ if (pAllBorderProperty && !pBorders[i])
+ {
+ pNewBorders[i] = new XMLPropertyState(pAllBorderProperty->mnIndex + 1 + i, pAllBorderProperty->maValue);
+ pBorders[i] = pNewBorders[i];
+ }
+ if( !pBorderWidths[i] )
+ pBorderWidths[i] = pAllBorderWidthProperty;
+ else
+ pBorderWidths[i]->mnIndex = -1;
+ if( pBorders[i] )
+ {
+ table::BorderLine2 aBorderLine;
+ pBorders[i]->maValue >>= aBorderLine;
+ if( pBorderWidths[i] )
+ {
+ table::BorderLine2 aBorderLineWidth;
+ pBorderWidths[i]->maValue >>= aBorderLineWidth;
+ aBorderLine.OuterLineWidth = aBorderLineWidth.OuterLineWidth;
+ aBorderLine.InnerLineWidth = aBorderLineWidth.InnerLineWidth;
+ aBorderLine.LineDistance = aBorderLineWidth.LineDistance;
+ aBorderLine.LineWidth = aBorderLineWidth.LineWidth;
+ pBorders[i]->maValue <<= aBorderLine;
+ }
+ }
+ if (pAllHeaderPaddingProperty && !pHeaderPadding[i])
+ pHeaderNewPadding[i] = new XMLPropertyState(pAllHeaderPaddingProperty->mnIndex + 1 + i, pAllHeaderPaddingProperty->maValue);
+ if (pAllHeaderBorderProperty && !pHeaderBorders[i])
+ pHeaderNewBorders[i] = new XMLPropertyState(pAllHeaderBorderProperty->mnIndex + 1 + i, pAllHeaderBorderProperty->maValue);
+ if( !pHeaderBorderWidths[i] )
+ pHeaderBorderWidths[i] = pAllHeaderBorderWidthProperty;
+ else
+ pHeaderBorderWidths[i]->mnIndex = -1;
+ if( pHeaderBorders[i] )
+ {
+ table::BorderLine2 aBorderLine;
+ pHeaderBorders[i]->maValue >>= aBorderLine;
+ if( pHeaderBorderWidths[i] )
+ {
+ table::BorderLine2 aBorderLineWidth;
+ pHeaderBorderWidths[i]->maValue >>= aBorderLineWidth;
+ aBorderLine.OuterLineWidth = aBorderLineWidth.OuterLineWidth;
+ aBorderLine.InnerLineWidth = aBorderLineWidth.InnerLineWidth;
+ aBorderLine.LineDistance = aBorderLineWidth.LineDistance;
+ aBorderLine.LineWidth = aBorderLineWidth.LineWidth;
+ pHeaderBorders[i]->maValue <<= aBorderLine;
+ }
+ }
+ if (pAllFooterPaddingProperty && !pFooterPadding[i])
+ pFooterNewPadding[i] = new XMLPropertyState(pAllFooterPaddingProperty->mnIndex + 1 + i, pAllFooterPaddingProperty->maValue);
+ if (pAllFooterBorderProperty && !pFooterBorders[i])
+ pFooterNewBorders[i] = new XMLPropertyState(pAllFooterBorderProperty->mnIndex + 1 + i, pAllFooterBorderProperty->maValue);
+ if( !pFooterBorderWidths[i] )
+ pFooterBorderWidths[i] = pAllFooterBorderWidthProperty;
+ else
+ pFooterBorderWidths[i]->mnIndex = -1;
+ if( pFooterBorders[i] )
+ {
+ table::BorderLine2 aBorderLine;
+ pFooterBorders[i]->maValue >>= aBorderLine;
+ if( pFooterBorderWidths[i] )
+ {
+ table::BorderLine2 aBorderLineWidth;
+ pFooterBorderWidths[i]->maValue >>= aBorderLineWidth;
+ aBorderLine.OuterLineWidth = aBorderLineWidth.OuterLineWidth;
+ aBorderLine.InnerLineWidth = aBorderLineWidth.InnerLineWidth;
+ aBorderLine.LineDistance = aBorderLineWidth.LineDistance;
+ aBorderLine.LineWidth = aBorderLineWidth.LineWidth;
+ pFooterBorders[i]->maValue <<= aBorderLine;
+ }
+ }
+ }
+
+ if (pHeaderHeight)
+ {
+ sal_Bool bValue(sal_False);
+ uno::Any aAny;
+ aAny.setValue( &bValue, ::getBooleanCppuType() );
+ pHeaderDynamic = new XMLPropertyState(pHeaderHeight->mnIndex + 2, aAny);
+ }
+ if (pHeaderMinHeight)
+ {
+ sal_Bool bValue(sal_True);
+ uno::Any aAny;
+ aAny.setValue( &bValue, ::getBooleanCppuType() );
+ pHeaderDynamic = new XMLPropertyState(pHeaderMinHeight->mnIndex + 1, aAny);
+ }
+ if (pFooterHeight)
+ {
+ sal_Bool bValue(sal_False);
+ uno::Any aAny;
+ aAny.setValue( &bValue, ::getBooleanCppuType() );
+ pFooterDynamic = new XMLPropertyState(pFooterHeight->mnIndex + 2, aAny);
+ }
+ if (pFooterMinHeight)
+ {
+ sal_Bool bValue(sal_True);
+ uno::Any aAny;
+ aAny.setValue( &bValue, ::getBooleanCppuType() );
+ pFooterDynamic = new XMLPropertyState(pFooterMinHeight->mnIndex + 1, aAny);
+ }
+ for (i = 0; i < 4; i++)
+ {
+ if (pNewPadding[i])
+ {
+ rProperties.push_back(*pNewPadding[i]);
+ delete pNewPadding[i];
+ }
+ if (pNewBorders[i])
+ {
+ rProperties.push_back(*pNewBorders[i]);
+ delete pNewBorders[i];
+ }
+ if (pHeaderNewPadding[i])
+ {
+ rProperties.push_back(*pHeaderNewPadding[i]);
+ delete pHeaderNewPadding[i];
+ }
+ if (pHeaderNewBorders[i])
+ {
+ rProperties.push_back(*pHeaderNewBorders[i]);
+ delete pHeaderNewBorders[i];
+ }
+ if (pFooterNewPadding[i])
+ {
+ rProperties.push_back(*pFooterNewPadding[i]);
+ delete pFooterNewPadding[i];
+ }
+ if (pFooterNewBorders[i])
+ {
+ rProperties.push_back(*pFooterNewBorders[i]);
+ delete pFooterNewBorders[i];
+ }
+ }
+ if(pHeaderDynamic)
+ {
+ rProperties.push_back(*pHeaderDynamic);
+ delete pHeaderDynamic;
+ }
+ if(pFooterDynamic)
+ {
+ rProperties.push_back(*pFooterDynamic);
+ delete pFooterDynamic;
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/PageMasterImportPropMapper.hxx b/xmloff/source/style/PageMasterImportPropMapper.hxx
new file mode 100644
index 000000000000..e386104ed8c9
--- /dev/null
+++ b/xmloff/source/style/PageMasterImportPropMapper.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PAGEMASTERIMPORTPROPMAPPER_HXX
+#define _XMLOFF_PAGEMASTERIMPORTPROPMAPPER_HXX
+
+#include <xmloff/xmlimppr.hxx>
+
+class SvXMLImport;
+
+class PageMasterImportPropertyMapper : public SvXMLImportPropertyMapper
+{
+ SvXMLImport& rImport;
+
+protected:
+
+public:
+
+ PageMasterImportPropertyMapper(
+ const UniReference< XMLPropertySetMapper >& rMapper,
+ SvXMLImport& rImp);
+ virtual ~PageMasterImportPropertyMapper();
+
+ /** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_IMPORT flag set */
+ virtual bool handleSpecialItem(
+ XMLPropertyState& rProperty,
+ ::std::vector< XMLPropertyState >& rProperties,
+ const ::rtl::OUString& rValue,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap ) const;
+
+ /** This method is called when all attributes have been processed. It may be used to remove items that are incomplete */
+ virtual void finished(
+ ::std::vector< XMLPropertyState >& rProperties,
+ sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/PageMasterPropHdl.cxx b/xmloff/source/style/PageMasterPropHdl.cxx
new file mode 100644
index 000000000000..4fb090f32662
--- /dev/null
+++ b/xmloff/source/style/PageMasterPropHdl.cxx
@@ -0,0 +1,428 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "PageMasterPropHdl.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmlnumi.hxx>
+#include <xmloff/xmlnume.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/style/PageStyleLayout.hpp>
+#include <comphelper/types.hxx>
+#include <comphelper/extract.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::style;
+using namespace ::comphelper;
+using namespace ::xmloff::token;
+
+
+//______________________________________________________________________________
+
+#define DEFAULT_PAPERTRAY (sal_Int32(-1))
+
+
+//______________________________________________________________________________
+// property handler for style:page-usage (style::PageStyleLayout)
+
+XMLPMPropHdl_PageStyleLayout::~XMLPMPropHdl_PageStyleLayout()
+{
+}
+
+bool XMLPMPropHdl_PageStyleLayout::equals( const Any& rAny1, const Any& rAny2 ) const
+{
+ style::PageStyleLayout eLayout1, eLayout2;
+ return ((rAny1 >>= eLayout1) && (rAny2 >>= eLayout2)) ? (eLayout1 == eLayout2) : sal_False;
+}
+
+sal_Bool XMLPMPropHdl_PageStyleLayout::importXML(
+ const OUString& rStrImpValue,
+ Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_True;
+
+ if( IsXMLToken( rStrImpValue, XML_ALL ) )
+ rValue <<= PageStyleLayout_ALL;
+ else if( IsXMLToken( rStrImpValue, XML_LEFT ) )
+ rValue <<= PageStyleLayout_LEFT;
+ else if( IsXMLToken( rStrImpValue, XML_RIGHT ) )
+ rValue <<= PageStyleLayout_RIGHT;
+ else if( IsXMLToken( rStrImpValue, XML_MIRRORED ) )
+ rValue <<= PageStyleLayout_MIRRORED;
+ else
+ bRet = sal_False;
+
+ return bRet;
+}
+
+sal_Bool XMLPMPropHdl_PageStyleLayout::exportXML(
+ OUString& rStrExpValue,
+ const Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ PageStyleLayout eLayout;
+
+ if( rValue >>= eLayout )
+ {
+ bRet = sal_True;
+ switch( eLayout )
+ {
+ case PageStyleLayout_ALL:
+ rStrExpValue = GetXMLToken( XML_ALL );
+ break;
+ case PageStyleLayout_LEFT:
+ rStrExpValue = GetXMLToken( XML_LEFT );
+ break;
+ case PageStyleLayout_RIGHT:
+ rStrExpValue = GetXMLToken( XML_RIGHT );
+ break;
+ case PageStyleLayout_MIRRORED:
+ rStrExpValue = GetXMLToken( XML_MIRRORED );
+ break;
+ default:
+ bRet = sal_False;
+ }
+ }
+
+ return bRet;
+}
+
+
+//______________________________________________________________________________
+// property handler for style:num-format (style::NumberingType)
+
+XMLPMPropHdl_NumFormat::~XMLPMPropHdl_NumFormat()
+{
+}
+
+sal_Bool XMLPMPropHdl_NumFormat::importXML(
+ const OUString& rStrImpValue,
+ Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Int16 nSync = sal_Int16();
+ sal_Int16 nNumType = NumberingType::NUMBER_NONE;
+ rUnitConverter.convertNumFormat( nNumType, rStrImpValue, OUString(),
+ sal_True );
+
+ if( !(rValue >>= nSync) )
+ nSync = NumberingType::NUMBER_NONE;
+
+ // if num-letter-sync appears before num-format, the function
+ // XMLPMPropHdl_NumLetterSync::importXML() sets the value
+ // NumberingType::CHARS_LOWER_LETTER_N
+ if( nSync == NumberingType::CHARS_LOWER_LETTER_N )
+ {
+ switch( nNumType )
+ {
+ case NumberingType::CHARS_LOWER_LETTER:
+ nNumType = NumberingType::CHARS_LOWER_LETTER_N;
+ break;
+ case NumberingType::CHARS_UPPER_LETTER:
+ nNumType = NumberingType::CHARS_UPPER_LETTER_N;
+ break;
+ }
+ }
+ rValue <<= nNumType;
+
+ return sal_True;
+}
+
+sal_Bool XMLPMPropHdl_NumFormat::exportXML(
+ OUString& rStrExpValue,
+ const Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int16 nNumType = sal_Int16();
+
+ if( rValue >>= nNumType )
+ {
+ OUStringBuffer aBuffer( 10 );
+ rUnitConverter.convertNumFormat( aBuffer, nNumType );
+ rStrExpValue = aBuffer.makeStringAndClear();
+ bRet = sal_True;
+ }
+ return bRet;
+}
+
+
+//______________________________________________________________________________
+// property handler for style:num-letter-sync (style::NumberingType)
+
+XMLPMPropHdl_NumLetterSync::~XMLPMPropHdl_NumLetterSync()
+{
+}
+
+sal_Bool XMLPMPropHdl_NumLetterSync::importXML(
+ const OUString& rStrImpValue,
+ Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Int16 nNumType;
+ sal_Int16 nSync = NumberingType::NUMBER_NONE;
+ rUnitConverter.convertNumFormat( nSync, rStrImpValue,
+ GetXMLToken( XML_A ), sal_True );
+
+ if( !(rValue >>= nNumType) )
+ nNumType = NumberingType::NUMBER_NONE;
+
+ if( nSync == NumberingType::CHARS_LOWER_LETTER_N )
+ {
+ switch( nNumType )
+ {
+ case NumberingType::CHARS_LOWER_LETTER:
+ nNumType = NumberingType::CHARS_LOWER_LETTER_N;
+ break;
+ case NumberingType::CHARS_UPPER_LETTER:
+ nNumType = NumberingType::CHARS_UPPER_LETTER_N;
+ break;
+ }
+ }
+ rValue <<= nNumType;
+
+ return sal_True;
+}
+
+sal_Bool XMLPMPropHdl_NumLetterSync::exportXML(
+ OUString& rStrExpValue,
+ const Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int16 nNumType = sal_Int16();
+
+ if( rValue >>= nNumType )
+ {
+ OUStringBuffer aBuffer( 5 );
+ rUnitConverter.convertNumLetterSync( aBuffer, nNumType );
+ rStrExpValue = aBuffer.makeStringAndClear();
+ bRet = rStrExpValue.getLength() > 0;
+ }
+ return bRet;
+}
+
+
+//______________________________________________________________________________
+// property handler for style:paper-tray-number
+
+XMLPMPropHdl_PaperTrayNumber::~XMLPMPropHdl_PaperTrayNumber()
+{
+}
+
+sal_Bool XMLPMPropHdl_PaperTrayNumber::importXML(
+ const OUString& rStrImpValue,
+ Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+
+ if( IsXMLToken( rStrImpValue, XML_DEFAULT ) )
+ {
+ rValue <<= DEFAULT_PAPERTRAY;
+ bRet = sal_True;
+ }
+ else
+ {
+ sal_Int32 nPaperTray;
+ if( SvXMLUnitConverter::convertNumber( nPaperTray, rStrImpValue, 0 ) )
+ {
+ rValue <<= nPaperTray;
+ bRet = sal_True;
+ }
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLPMPropHdl_PaperTrayNumber::exportXML(
+ OUString& rStrExpValue,
+ const Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int32 nPaperTray = 0;
+
+ if( rValue >>= nPaperTray )
+ {
+ if( nPaperTray == DEFAULT_PAPERTRAY )
+ rStrExpValue = GetXMLToken( XML_DEFAULT );
+ else
+ {
+ OUStringBuffer aBuffer;
+ SvXMLUnitConverter::convertNumber( aBuffer, nPaperTray );
+ rStrExpValue = aBuffer.makeStringAndClear();
+ }
+ bRet = sal_True;
+ }
+ return bRet;
+}
+
+
+//______________________________________________________________________________
+// property handler for style:print
+
+XMLPMPropHdl_Print::XMLPMPropHdl_Print( enum XMLTokenEnum eValue ) :
+ sAttrValue( GetXMLToken( eValue ) )
+{
+}
+
+XMLPMPropHdl_Print::~XMLPMPropHdl_Print()
+{
+}
+
+sal_Bool XMLPMPropHdl_Print::importXML(
+ const OUString& rStrImpValue,
+ Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ sal_Unicode cToken = ' ';
+ sal_Int32 nTokenIndex = 0;
+ sal_Bool bFound = sal_False;
+
+ do
+ {
+ bFound = (sAttrValue == rStrImpValue.getToken( 0, cToken, nTokenIndex ));
+ }
+ while ( (nTokenIndex >= 0) && !bFound );
+
+ setBOOL( rValue, bFound );
+ return sal_True;
+}
+
+sal_Bool XMLPMPropHdl_Print::exportXML(
+ OUString& rStrExpValue,
+ const Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ if( getBOOL( rValue ) )
+ {
+ if( rStrExpValue.getLength() )
+ rStrExpValue += OUString( RTL_CONSTASCII_USTRINGPARAM( " " ) );
+ rStrExpValue += sAttrValue;
+ }
+
+ return sal_True;
+}
+
+//______________________________________________________________________________
+// property handler for style:table-centering
+
+XMLPMPropHdl_CenterHorizontal::~XMLPMPropHdl_CenterHorizontal()
+{
+}
+
+sal_Bool XMLPMPropHdl_CenterHorizontal::importXML(
+ const OUString& rStrImpValue,
+ Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+
+ if (rStrImpValue.getLength())
+ if (IsXMLToken( rStrImpValue, XML_BOTH) ||
+ IsXMLToken( rStrImpValue, XML_HORIZONTAL))
+ {
+ rValue = ::cppu::bool2any(sal_True);
+ bRet = sal_True;
+ }
+
+
+ return bRet;
+}
+
+sal_Bool XMLPMPropHdl_CenterHorizontal::exportXML(
+ OUString& rStrExpValue,
+ const Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+
+ if ( ::cppu::any2bool( rValue ) )
+ {
+ bRet = sal_True;
+ if (rStrExpValue.getLength())
+ rStrExpValue = GetXMLToken(XML_BOTH);
+ else
+ rStrExpValue = GetXMLToken(XML_HORIZONTAL);
+ }
+
+ return bRet;
+}
+
+XMLPMPropHdl_CenterVertical::~XMLPMPropHdl_CenterVertical()
+{
+}
+
+sal_Bool XMLPMPropHdl_CenterVertical::importXML(
+ const OUString& rStrImpValue,
+ Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+
+ if (rStrImpValue.getLength())
+ if (IsXMLToken(rStrImpValue, XML_BOTH) ||
+ IsXMLToken(rStrImpValue, XML_VERTICAL) )
+ {
+ rValue = ::cppu::bool2any(sal_True);
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLPMPropHdl_CenterVertical::exportXML(
+ OUString& rStrExpValue,
+ const Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+
+ if ( ::cppu::any2bool( rValue ) )
+ {
+ bRet = sal_True;
+ if (rStrExpValue.getLength())
+ rStrExpValue = GetXMLToken(XML_BOTH);
+ else
+ rStrExpValue = GetXMLToken(XML_VERTICAL);
+ }
+
+ return bRet;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/PageMasterPropHdl.hxx b/xmloff/source/style/PageMasterPropHdl.hxx
new file mode 100644
index 000000000000..b2e1b6ade887
--- /dev/null
+++ b/xmloff/source/style/PageMasterPropHdl.hxx
@@ -0,0 +1,182 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PAGEMASTERPROPHDL_HXX_
+#define _XMLOFF_PAGEMASTERPROPHDL_HXX_
+
+#include <xmloff/xmlprhdl.hxx>
+#include <rtl/ustring.hxx>
+#include <xmloff/xmltoken.hxx>
+
+
+//______________________________________________________________________________
+// property handler for style:page-usage (style::PageStyleLayout)
+
+class XMLPMPropHdl_PageStyleLayout : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLPMPropHdl_PageStyleLayout();
+ virtual bool equals(
+ const ::com::sun::star::uno::Any& rAny1,
+ const ::com::sun::star::uno::Any& rAny2
+ ) const;
+ virtual sal_Bool importXML(
+ const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter
+ ) const;
+ virtual sal_Bool exportXML(
+ ::rtl::OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter
+ ) const;
+};
+
+
+//______________________________________________________________________________
+// property handler for style:num-format (style::NumberingType)
+
+class XMLPMPropHdl_NumFormat : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLPMPropHdl_NumFormat();
+ virtual sal_Bool importXML(
+ const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter
+ ) const;
+ virtual sal_Bool exportXML(
+ ::rtl::OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter
+ ) const;
+};
+
+
+//______________________________________________________________________________
+// property handler for style:num-letter-sync (style::NumberingType)
+
+class XMLPMPropHdl_NumLetterSync : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLPMPropHdl_NumLetterSync();
+ virtual sal_Bool importXML(
+ const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter
+ ) const;
+ virtual sal_Bool exportXML(
+ ::rtl::OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter
+ ) const;
+};
+
+
+//______________________________________________________________________________
+// property handler for style:paper-tray-number
+
+class XMLPMPropHdl_PaperTrayNumber : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLPMPropHdl_PaperTrayNumber();
+ virtual sal_Bool importXML(
+ const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter
+ ) const;
+ virtual sal_Bool exportXML(
+ ::rtl::OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter
+ ) const;
+};
+
+
+//______________________________________________________________________________
+// property handler for style:print
+
+class XMLPMPropHdl_Print : public XMLPropertyHandler
+{
+protected:
+ ::rtl::OUString sAttrValue;
+
+public:
+ XMLPMPropHdl_Print( enum ::xmloff::token::XMLTokenEnum eValue );
+ virtual ~XMLPMPropHdl_Print();
+
+ virtual sal_Bool importXML(
+ const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter
+ ) const;
+ virtual sal_Bool exportXML(
+ ::rtl::OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter
+ ) const;
+};
+
+//______________________________________________________________________________
+// property handler for style:table-centering
+
+class XMLPMPropHdl_CenterHorizontal : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLPMPropHdl_CenterHorizontal();
+ virtual sal_Bool importXML(
+ const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter
+ ) const;
+ virtual sal_Bool exportXML(
+ ::rtl::OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter
+ ) const;
+};
+
+class XMLPMPropHdl_CenterVertical : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLPMPropHdl_CenterVertical();
+ virtual sal_Bool importXML(
+ const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter
+ ) const;
+ virtual sal_Bool exportXML(
+ ::rtl::OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter
+ ) const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/PageMasterPropHdlFactory.cxx b/xmloff/source/style/PageMasterPropHdlFactory.cxx
new file mode 100644
index 000000000000..3ff8a9c1a75d
--- /dev/null
+++ b/xmloff/source/style/PageMasterPropHdlFactory.cxx
@@ -0,0 +1,148 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "PageMasterPropHdlFactory.hxx"
+#include <xmloff/xmltypes.hxx>
+#include <xmloff/xmltoken.hxx>
+#include "xmlbahdl.hxx"
+#include <xmloff/NamedBoolPropertyHdl.hxx>
+#include "XMLTextColumnsPropertyHandler.hxx"
+#include <xmloff/XMLConstantsPropertyHandler.hxx>
+#include "PageMasterPropHdl.hxx"
+#include <xmloff/PageMasterStyleMap.hxx>
+#include <com/sun/star/text/TextGridMode.hpp>
+
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::xmloff::token;
+using namespace ::com::sun::star;
+
+
+SvXMLEnumMapEntry aXML_TextGridMode_ConstantMap[] =
+{
+ { XML_NONE, text::TextGridMode::NONE },
+ { XML_LINE, text::TextGridMode::LINES },
+ { XML_BOTH, text::TextGridMode::LINES_AND_CHARS },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+//______________________________________________________________________________
+
+XMLPageMasterPropHdlFactory::XMLPageMasterPropHdlFactory() :
+ XMLPropertyHandlerFactory()
+{
+}
+
+XMLPageMasterPropHdlFactory::~XMLPageMasterPropHdlFactory()
+{
+}
+
+const XMLPropertyHandler* XMLPageMasterPropHdlFactory::GetPropertyHandler( sal_Int32 nType ) const
+{
+ nType &= MID_FLAG_MASK;
+
+ XMLPropertyHandler* pHdl = (XMLPropertyHandler*) XMLPropertyHandlerFactory::GetPropertyHandler( nType );
+ if( !pHdl )
+ {
+ switch( nType )
+ {
+ case XML_PM_TYPE_PAGESTYLELAYOUT:
+ pHdl = new XMLPMPropHdl_PageStyleLayout();
+ break;
+ case XML_PM_TYPE_NUMFORMAT:
+ pHdl = new XMLPMPropHdl_NumFormat();
+ break;
+ case XML_PM_TYPE_NUMLETTERSYNC:
+ pHdl = new XMLPMPropHdl_NumLetterSync();
+ break;
+ case XML_PM_TYPE_PAPERTRAYNUMBER:
+ pHdl = new XMLPMPropHdl_PaperTrayNumber();
+ break;
+ case XML_PM_TYPE_PRINTORIENTATION:
+ pHdl = new XMLNamedBoolPropertyHdl(
+ GetXMLToken( XML_LANDSCAPE ),
+ GetXMLToken( XML_PORTRAIT ) );
+ break;
+ case XML_PM_TYPE_PRINTANNOTATIONS:
+ pHdl = new XMLPMPropHdl_Print( XML_ANNOTATIONS );
+ break;
+ case XML_PM_TYPE_PRINTCHARTS:
+ pHdl = new XMLPMPropHdl_Print( XML_CHARTS );
+ break;
+ case XML_PM_TYPE_PRINTDRAWING:
+ pHdl = new XMLPMPropHdl_Print( XML_DRAWINGS );
+ break;
+ case XML_PM_TYPE_PRINTFORMULAS:
+ pHdl = new XMLPMPropHdl_Print( XML_FORMULAS );
+ break;
+ case XML_PM_TYPE_PRINTGRID:
+ pHdl = new XMLPMPropHdl_Print( XML_GRID );
+ break;
+ case XML_PM_TYPE_PRINTHEADERS:
+ pHdl = new XMLPMPropHdl_Print( XML_HEADERS );
+ break;
+ case XML_PM_TYPE_PRINTOBJECTS:
+ pHdl = new XMLPMPropHdl_Print( XML_OBJECTS );
+ break;
+ case XML_PM_TYPE_PRINTZEROVALUES:
+ pHdl = new XMLPMPropHdl_Print( XML_ZERO_VALUES );
+ break;
+ case XML_PM_TYPE_PRINTPAGEORDER:
+ pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken( XML_TTB ),
+ GetXMLToken( XML_LTR ) );
+ break;
+ case XML_PM_TYPE_FIRSTPAGENUMBER:
+ pHdl = new XMLNumberNonePropHdl( XML_CONTINUE, 2 );
+ break;
+ case XML_PM_TYPE_CENTER_HORIZONTAL:
+ pHdl = new XMLPMPropHdl_CenterHorizontal();
+ break;
+ case XML_PM_TYPE_CENTER_VERTICAL:
+ pHdl = new XMLPMPropHdl_CenterVertical();
+ break;
+ case XML_TYPE_TEXT_COLUMNS:
+ pHdl = new XMLTextColumnsPropertyHandler;
+ break;
+ case XML_TYPE_LAYOUT_GRID_MODE:
+ pHdl = new XMLConstantsPropertyHandler(
+ aXML_TextGridMode_ConstantMap, XML_NONE );
+ break;
+ }
+
+ if( pHdl )
+ PutHdlCache( nType, pHdl );
+ }
+ return pHdl;
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/PageMasterPropHdlFactory.hxx b/xmloff/source/style/PageMasterPropHdlFactory.hxx
new file mode 100644
index 000000000000..10b796c59640
--- /dev/null
+++ b/xmloff/source/style/PageMasterPropHdlFactory.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PAGEMASTERPROPHDLFACTORY_HXX
+#define _XMLOFF_PAGEMASTERPROPHDLFACTORY_HXX
+
+#include <xmloff/prhdlfac.hxx>
+
+
+//______________________________________________________________________________
+
+class XMLPageMasterPropHdlFactory : public XMLPropertyHandlerFactory
+{
+public:
+ XMLPageMasterPropHdlFactory();
+ virtual ~XMLPageMasterPropHdlFactory();
+
+ virtual const XMLPropertyHandler*
+ GetPropertyHandler( sal_Int32 nType ) const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/PageMasterPropMapper.cxx b/xmloff/source/style/PageMasterPropMapper.cxx
new file mode 100644
index 000000000000..97159c698f9c
--- /dev/null
+++ b/xmloff/source/style/PageMasterPropMapper.cxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "PageMasterPropMapper.hxx"
+
+
+#include <xmloff/PageMasterStyleMap.hxx>
+#include "PageMasterPropHdlFactory.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+
+
+//______________________________________________________________________________
+
+XMLPageMasterPropSetMapper::XMLPageMasterPropSetMapper():
+ XMLPropertySetMapper( aXMLPageMasterStyleMap, new XMLPageMasterPropHdlFactory())
+{
+}
+
+XMLPageMasterPropSetMapper::XMLPageMasterPropSetMapper(
+ const XMLPropertyMapEntry* pEntries,
+ const UniReference< XMLPropertyHandlerFactory >& rFactory ) :
+ XMLPropertySetMapper( pEntries, rFactory )
+{
+}
+
+XMLPageMasterPropSetMapper::~XMLPageMasterPropSetMapper()
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/PageMasterPropMapper.hxx b/xmloff/source/style/PageMasterPropMapper.hxx
new file mode 100644
index 000000000000..2b48501b75d7
--- /dev/null
+++ b/xmloff/source/style/PageMasterPropMapper.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PAGEMASTERPROPMAPPER_HXX_
+#define _XMLOFF_PAGEMASTERPROPMAPPER_HXX_
+
+#include <xmloff/xmlprmap.hxx>
+
+
+//______________________________________________________________________________
+
+class XMLPageMasterPropSetMapper : public XMLPropertySetMapper
+{
+public:
+ XMLPageMasterPropSetMapper();
+ XMLPageMasterPropSetMapper(
+ const XMLPropertyMapEntry* pEntries,
+ const UniReference< XMLPropertyHandlerFactory >& rFactory );
+ virtual ~XMLPageMasterPropSetMapper();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/PageMasterStyleMap.cxx b/xmloff/source/style/PageMasterStyleMap.cxx
new file mode 100644
index 000000000000..af5feb81d61c
--- /dev/null
+++ b/xmloff/source/style/PageMasterStyleMap.cxx
@@ -0,0 +1,193 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <xmloff/PageMasterStyleMap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+
+using namespace ::xmloff::token;
+
+#define _MAP(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, type, context, SvtSaveOptions::ODFVER_010 }
+#define PLMAP(name,prefix,token,type,context) \
+ _MAP(name,prefix,token,type|XML_TYPE_PROP_PAGE_LAYOUT,context)
+#define HFMAP(name,prefix,token,type,context) \
+ _MAP(name,prefix,token,type|XML_TYPE_PROP_HEADER_FOOTER,context)
+
+//______________________________________________________________________________
+
+const XMLPropertyMapEntry aXMLPageMasterStyleMap[] =
+{
+// page master
+ PLMAP( "PageStyleLayout", XML_NAMESPACE_STYLE, XML_PAGE_USAGE, XML_PM_TYPE_PAGESTYLELAYOUT | MID_FLAG_SPECIAL_ITEM, CTF_PM_PAGEUSAGE ),
+ PLMAP( "Width", XML_NAMESPACE_FO, XML_PAGE_WIDTH, XML_TYPE_MEASURE, 0 ),
+ PLMAP( "Height", XML_NAMESPACE_FO, XML_PAGE_HEIGHT, XML_TYPE_MEASURE, 0 ),
+ PLMAP( "NumberingType", XML_NAMESPACE_STYLE, XML_NUM_FORMAT, XML_PM_TYPE_NUMFORMAT | MID_FLAG_MERGE_PROPERTY, 0 ),
+ PLMAP( "NumberingType", XML_NAMESPACE_STYLE, XML_NUM_LETTER_SYNC, XML_PM_TYPE_NUMLETTERSYNC, 0 ),
+ PLMAP( "PrinterPaperTray", XML_NAMESPACE_STYLE, XML_PAPER_TRAY_NAME, XML_TYPE_STRING | MID_FLAG_PROPERTY_MAY_EXCEPT, 0 ),
+ PLMAP( "IsLandscape", XML_NAMESPACE_STYLE, XML_PRINT_ORIENTATION, XML_PM_TYPE_PRINTORIENTATION, 0 ),
+ PLMAP( "TopMargin", XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_TYPE_MEASURE, 0 ),
+ PLMAP( "BottomMargin", XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_TYPE_MEASURE, 0 ),
+ PLMAP( "LeftMargin", XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_MEASURE, 0 ),
+ PLMAP( "RightMargin", XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_TYPE_MEASURE, 0 ),
+ PLMAP( "TopBorder", XML_NAMESPACE_FO, XML_BORDER, XML_TYPE_BORDER, CTF_PM_BORDERALL ),
+ PLMAP( "TopBorder", XML_NAMESPACE_FO, XML_BORDER_TOP, XML_TYPE_BORDER, CTF_PM_BORDERTOP ),
+ PLMAP( "BottomBorder", XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_TYPE_BORDER, CTF_PM_BORDERBOTTOM ),
+ PLMAP( "LeftBorder", XML_NAMESPACE_FO, XML_BORDER_LEFT, XML_TYPE_BORDER, CTF_PM_BORDERLEFT ),
+ PLMAP( "RightBorder", XML_NAMESPACE_FO, XML_BORDER_RIGHT, XML_TYPE_BORDER, CTF_PM_BORDERRIGHT ),
+ PLMAP( "TopBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH, XML_TYPE_BORDER_WIDTH, CTF_PM_BORDERWIDTHALL ),
+ PLMAP( "TopBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_TOP, XML_TYPE_BORDER_WIDTH, CTF_PM_BORDERWIDTHTOP ),
+ PLMAP( "BottomBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_BOTTOM, XML_TYPE_BORDER_WIDTH, CTF_PM_BORDERWIDTHBOTTOM ),
+ PLMAP( "LeftBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_LEFT, XML_TYPE_BORDER_WIDTH, CTF_PM_BORDERWIDTHLEFT ),
+ PLMAP( "RightBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_RIGHT, XML_TYPE_BORDER_WIDTH, CTF_PM_BORDERWIDTHRIGHT ),
+ PLMAP( "TopBorderDistance", XML_NAMESPACE_FO, XML_PADDING, XML_TYPE_MEASURE, CTF_PM_PADDINGALL ),
+ PLMAP( "TopBorderDistance", XML_NAMESPACE_FO, XML_PADDING_TOP, XML_TYPE_MEASURE, CTF_PM_PADDINGTOP ),
+ PLMAP( "BottomBorderDistance", XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_TYPE_MEASURE, CTF_PM_PADDINGBOTTOM ),
+ PLMAP( "LeftBorderDistance", XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_TYPE_MEASURE, CTF_PM_PADDINGLEFT ),
+ PLMAP( "RightBorderDistance", XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_TYPE_MEASURE, CTF_PM_PADDINGRIGHT ),
+ PLMAP( "ShadowFormat", XML_NAMESPACE_STYLE, XML_SHADOW, XML_TYPE_TEXT_SHADOW, 0 ),
+ PLMAP( "BackColor", XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT | MID_FLAG_MULTI_PROPERTY, 0 ),
+ PLMAP( "BackTransparent", XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT | MID_FLAG_MERGE_ATTRIBUTE, 0 ),
+ PLMAP( "BackGraphicLocation", XML_NAMESPACE_STYLE, XML_POSITION, XML_TYPE_BUILDIN_CMP_ONLY | MID_FLAG_SPECIAL_ITEM, CTF_PM_GRAPHICPOSITION ),
+ PLMAP( "BackGraphicFilter", XML_NAMESPACE_STYLE, XML_FILTER_NAME, XML_TYPE_STRING | MID_FLAG_SPECIAL_ITEM, CTF_PM_GRAPHICFILTER ),
+ PLMAP( "BackGraphicURL", XML_NAMESPACE_STYLE, XML_BACKGROUND_IMAGE, XML_TYPE_STRING | MID_FLAG_ELEMENT_ITEM, CTF_PM_GRAPHICURL ),
+ PLMAP( "PrintAnnotations", XML_NAMESPACE_STYLE, XML_PRINT, XML_PM_TYPE_PRINTANNOTATIONS | MID_FLAG_MULTI_PROPERTY, CTF_PM_PRINT_ANNOTATIONS ),
+ PLMAP( "PrintCharts", XML_NAMESPACE_STYLE, XML_PRINT, XML_PM_TYPE_PRINTCHARTS | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE, CTF_PM_PRINT_CHARTS ),
+ PLMAP( "PrintDrawing", XML_NAMESPACE_STYLE, XML_PRINT, XML_PM_TYPE_PRINTDRAWING | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE, CTF_PM_PRINT_DRAWING ),
+ PLMAP( "PrintFormulas", XML_NAMESPACE_STYLE, XML_PRINT, XML_PM_TYPE_PRINTFORMULAS | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE, CTF_PM_PRINT_FORMULAS ),
+ PLMAP( "PrintGrid", XML_NAMESPACE_STYLE, XML_PRINT, XML_PM_TYPE_PRINTGRID | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE, CTF_PM_PRINT_GRID ),
+ PLMAP( "PrintHeaders", XML_NAMESPACE_STYLE, XML_PRINT, XML_PM_TYPE_PRINTHEADERS | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE, CTF_PM_PRINT_HEADERS ),
+ PLMAP( "PrintObjects", XML_NAMESPACE_STYLE, XML_PRINT, XML_PM_TYPE_PRINTOBJECTS | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE, CTF_PM_PRINT_OBJECTS ),
+ PLMAP( "PrintZeroValues", XML_NAMESPACE_STYLE, XML_PRINT, XML_PM_TYPE_PRINTZEROVALUES | MID_FLAG_MERGE_ATTRIBUTE, CTF_PM_PRINT_ZEROVALUES ),
+ PLMAP( "PrintDownFirst", XML_NAMESPACE_STYLE, XML_PRINT_PAGE_ORDER, XML_PM_TYPE_PRINTPAGEORDER, 0 ),
+ PLMAP( "FirstPageNumber", XML_NAMESPACE_STYLE, XML_FIRST_PAGE_NUMBER, XML_PM_TYPE_FIRSTPAGENUMBER, 0 ),
+ PLMAP( "PageScale", XML_NAMESPACE_STYLE, XML_SCALE_TO, XML_TYPE_PERCENT16, CTF_PM_SCALETO ),
+ PLMAP( "ScaleToPages", XML_NAMESPACE_STYLE, XML_SCALE_TO_PAGES, XML_TYPE_NUMBER16, CTF_PM_SCALETOPAGES ),
+ PLMAP( "ScaleToPagesX", XML_NAMESPACE_STYLE, XML_SCALE_TO_X, XML_TYPE_NUMBER16, CTF_PM_SCALETOX ),
+ PLMAP( "ScaleToPagesY", XML_NAMESPACE_STYLE, XML_SCALE_TO_Y, XML_TYPE_NUMBER16, CTF_PM_SCALETOY ),
+ PLMAP( "CenterHorizontally", XML_NAMESPACE_STYLE, XML_TABLE_CENTERING, XML_PM_TYPE_CENTER_HORIZONTAL | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE, 0 ),
+ PLMAP( "CenterVertically", XML_NAMESPACE_STYLE, XML_TABLE_CENTERING, XML_PM_TYPE_CENTER_VERTICAL | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE, 0 ),
+ PLMAP( "TextColumns", XML_NAMESPACE_STYLE, XML_COLUMNS, MID_FLAG_ELEMENT_ITEM|XML_TYPE_TEXT_COLUMNS, CTF_PM_TEXTCOLUMNS ),
+ PLMAP( "RegisterModeActive", XML_NAMESPACE_STYLE, XML_REGISTER_TRUE, XML_TYPE_BOOL, 0 ),
+ PLMAP( "RegisterParagraphStyle", XML_NAMESPACE_STYLE, XML_REGISTER_TRUTH_REF_STYLE_NAME, XML_TYPE_STYLENAME| MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_PM_REGISTER_STYLE ),
+ PLMAP( "WritingMode", XML_NAMESPACE_STYLE, XML_WRITING_MODE, XML_TYPE_TEXT_WRITING_MODE, 0 ),
+
+ PLMAP( "GridColor", XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_COLOR, XML_TYPE_COLOR, 0 ),
+ PLMAP( "GridLines", XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_LINES, XML_TYPE_NUMBER16, 0 ),
+ PLMAP( "GridBaseHeight", XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_BASE_HEIGHT, XML_TYPE_MEASURE, 0 ),
+ PLMAP( "GridRubyHeight", XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_RUBY_HEIGHT, XML_TYPE_MEASURE, 0 ),
+ PLMAP( "GridMode", XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_MODE, XML_TYPE_LAYOUT_GRID_MODE, 0 ),
+ PLMAP( "RubyBelow", XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_RUBY_BELOW, XML_TYPE_BOOL, 0 ),
+ PLMAP( "GridPrint", XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_PRINT, XML_TYPE_BOOL, 0 ),
+ PLMAP( "GridDisplay", XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_DISPLAY, XML_TYPE_BOOL, 0 ),
+
+ //text grid enhancement for better CJK support
+ PLMAP( "GridBaseWidth", XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_BASE_WIDTH, XML_TYPE_MEASURE, CTP_PM_GRID_BASE_WIDTH ),
+ PLMAP( "GridSnapToChars", XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_SNAP_TO, XML_TYPE_BOOL, CTP_PM_GRID_SNAP_TO_CHARS ),
+ PLMAP( "GridSnapToChars", XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_SNAP_TO_CHARS, XML_TYPE_BOOL, CTP_PM_GRID_SNAP_TO_CHARS ),
+ //export as a default attribute
+ PLMAP( "StandardPageMode", XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_STANDARD_MODE, XML_TYPE_BOOL|MID_FLAG_DEFAULT_ITEM_EXPORT, CTF_PM_STANDARD_MODE ),
+
+ PLMAP( "UserDefinedAttributes", XML_NAMESPACE_TEXT, XML_XMLNS, XML_TYPE_ATTRIBUTE_CONTAINER | MID_FLAG_SPECIAL_ITEM, 0 ),
+
+// footnote
+ PLMAP( "FootnoteHeight", XML_NAMESPACE_STYLE, XML_FOOTNOTE_MAX_HEIGHT, XML_TYPE_MEASURE, CTF_PM_FTN_HEIGTH ),
+ PLMAP( "FootnoteLineAdjust", XML_NAMESPACE_STYLE, XML__EMPTY, XML_TYPE_TEXT_HORIZONTAL_ADJUST|MID_FLAG_SPECIAL_ITEM, CTF_PM_FTN_LINE_ADJUST ),
+ PLMAP( "FootnoteLineColor", XML_NAMESPACE_STYLE, XML__EMPTY, XML_TYPE_COLOR|MID_FLAG_SPECIAL_ITEM, CTF_PM_FTN_LINE_COLOR ),
+ PLMAP( "FootnoteLineDistance", XML_NAMESPACE_STYLE, XML__EMPTY, XML_TYPE_MEASURE|MID_FLAG_SPECIAL_ITEM,CTF_PM_FTN_DISTANCE ),
+ PLMAP( "FootnoteLineRelativeWidth", XML_NAMESPACE_STYLE, XML__EMPTY, XML_TYPE_PERCENT8|MID_FLAG_SPECIAL_ITEM, CTF_PM_FTN_LINE_WIDTH ),
+ PLMAP( "FootnoteLineTextDistance", XML_NAMESPACE_STYLE, XML__EMPTY, XML_TYPE_MEASURE|MID_FLAG_SPECIAL_ITEM, CTF_PM_FTN_LINE_DISTANCE ),
+ PLMAP( "FootnoteLineWeight", XML_NAMESPACE_STYLE, XML_FOOTNOTE_SEP, XML_TYPE_MEASURE16|MID_FLAG_ELEMENT_ITEM, CTF_PM_FTN_LINE_WEIGTH ),
+ PLMAP( "FootnoteLineStyle", XML_NAMESPACE_STYLE, XML_EMPTY, XML_TYPE_STRING|MID_FLAG_ELEMENT_ITEM, CTF_PM_FTN_LINE_STYLE ),
+
+// header
+ HFMAP( "HeaderHeight", XML_NAMESPACE_SVG, XML_HEIGHT, XML_TYPE_MEASURE, CTF_PM_HEADERHEIGHT ),
+ HFMAP( "HeaderHeight", XML_NAMESPACE_FO, XML_MIN_HEIGHT, XML_TYPE_MEASURE, CTF_PM_HEADERMINHEIGHT ),
+ HFMAP( "HeaderIsDynamicHeight", XML_NAMESPACE_STYLE, XML__EMPTY, XML_TYPE_BOOL, CTF_PM_HEADERDYNAMIC ),
+ HFMAP( "HeaderLeftMargin", XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_MEASURE, CTF_PM_HEADERFLAG ),
+ HFMAP( "HeaderRightMargin", XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_TYPE_MEASURE, CTF_PM_HEADERFLAG ),
+ HFMAP( "HeaderBodyDistance", XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_TYPE_MEASURE, CTF_PM_HEADERFLAG ),
+ HFMAP( "HeaderTopBorder", XML_NAMESPACE_FO, XML_BORDER, XML_TYPE_BORDER, CTF_PM_HEADERBORDERALL ),
+ HFMAP( "HeaderTopBorder", XML_NAMESPACE_FO, XML_BORDER_TOP, XML_TYPE_BORDER, CTF_PM_HEADERBORDERTOP ),
+ HFMAP( "HeaderBottomBorder", XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_TYPE_BORDER, CTF_PM_HEADERBORDERBOTTOM ),
+ HFMAP( "HeaderLeftBorder", XML_NAMESPACE_FO, XML_BORDER_LEFT, XML_TYPE_BORDER, CTF_PM_HEADERBORDERLEFT ),
+ HFMAP( "HeaderRightBorder", XML_NAMESPACE_FO, XML_BORDER_RIGHT, XML_TYPE_BORDER, CTF_PM_HEADERBORDERRIGHT ),
+ HFMAP( "HeaderTopBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH, XML_TYPE_BORDER_WIDTH, CTF_PM_HEADERBORDERWIDTHALL ),
+ HFMAP( "HeaderTopBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_TOP, XML_TYPE_BORDER_WIDTH, CTF_PM_HEADERBORDERWIDTHTOP ),
+ HFMAP( "HeaderBottomBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_BOTTOM, XML_TYPE_BORDER_WIDTH, CTF_PM_HEADERBORDERWIDTHBOTTOM ),
+ HFMAP( "HeaderLeftBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_LEFT, XML_TYPE_BORDER_WIDTH, CTF_PM_HEADERBORDERWIDTHLEFT ),
+ HFMAP( "HeaderRightBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_RIGHT, XML_TYPE_BORDER_WIDTH, CTF_PM_HEADERBORDERWIDTHRIGHT ),
+ HFMAP( "HeaderTopBorderDistance", XML_NAMESPACE_FO, XML_PADDING, XML_TYPE_MEASURE, CTF_PM_HEADERPADDINGALL ),
+ HFMAP( "HeaderTopBorderDistance", XML_NAMESPACE_FO, XML_PADDING_TOP, XML_TYPE_MEASURE, CTF_PM_HEADERPADDINGTOP ),
+ HFMAP( "HeaderBottomBorderDistance", XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_TYPE_MEASURE, CTF_PM_HEADERPADDINGBOTTOM ),
+ HFMAP( "HeaderLeftBorderDistance", XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_TYPE_MEASURE, CTF_PM_HEADERPADDINGLEFT ),
+ HFMAP( "HeaderRightBorderDistance", XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_TYPE_MEASURE, CTF_PM_HEADERPADDINGRIGHT ),
+ HFMAP( "HeaderShadowFormat", XML_NAMESPACE_STYLE, XML_SHADOW, XML_TYPE_TEXT_SHADOW, CTF_PM_HEADERFLAG ),
+ HFMAP( "HeaderBackColor", XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT | MID_FLAG_MULTI_PROPERTY, CTF_PM_HEADERFLAG ),
+ HFMAP( "HeaderBackTransparent", XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT | MID_FLAG_MERGE_ATTRIBUTE, CTF_PM_HEADERFLAG ),
+ HFMAP( "HeaderBackGraphicLocation", XML_NAMESPACE_STYLE, XML_POSITION, XML_TYPE_BUILDIN_CMP_ONLY | MID_FLAG_SPECIAL_ITEM, CTF_PM_HEADERGRAPHICPOSITION ),
+ HFMAP( "HeaderBackGraphicFilter", XML_NAMESPACE_STYLE, XML_FILTER_NAME, XML_TYPE_STRING | MID_FLAG_SPECIAL_ITEM, CTF_PM_HEADERGRAPHICFILTER ),
+ HFMAP( "HeaderBackGraphicURL", XML_NAMESPACE_STYLE, XML_BACKGROUND_IMAGE, XML_TYPE_STRING | MID_FLAG_ELEMENT_ITEM, CTF_PM_HEADERGRAPHICURL ),
+ HFMAP( "HeaderDynamicSpacing", XML_NAMESPACE_STYLE, XML_DYNAMIC_SPACING, XML_TYPE_BOOL, CTF_PM_HEADERFLAG ),
+
+// footer
+ HFMAP( "FooterHeight", XML_NAMESPACE_SVG, XML_HEIGHT, XML_TYPE_MEASURE, CTF_PM_FOOTERHEIGHT ),
+ HFMAP( "FooterHeight", XML_NAMESPACE_FO, XML_MIN_HEIGHT, XML_TYPE_MEASURE, CTF_PM_FOOTERMINHEIGHT ),
+ HFMAP( "FooterIsDynamicHeight", XML_NAMESPACE_STYLE, XML__EMPTY, XML_TYPE_BOOL, CTF_PM_FOOTERDYNAMIC ),
+ HFMAP( "FooterLeftMargin", XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_MEASURE, CTF_PM_FOOTERFLAG ),
+ HFMAP( "FooterRightMargin", XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_TYPE_MEASURE, CTF_PM_FOOTERFLAG ),
+ HFMAP( "FooterBodyDistance", XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_TYPE_MEASURE, CTF_PM_FOOTERFLAG ),
+ HFMAP( "FooterTopBorder", XML_NAMESPACE_FO, XML_BORDER, XML_TYPE_BORDER, CTF_PM_FOOTERBORDERALL ),
+ HFMAP( "FooterTopBorder", XML_NAMESPACE_FO, XML_BORDER_TOP, XML_TYPE_BORDER, CTF_PM_FOOTERBORDERTOP ),
+ HFMAP( "FooterBottomBorder", XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_TYPE_BORDER, CTF_PM_FOOTERBORDERBOTTOM ),
+ HFMAP( "FooterLeftBorder", XML_NAMESPACE_FO, XML_BORDER_LEFT, XML_TYPE_BORDER, CTF_PM_FOOTERBORDERLEFT ),
+ HFMAP( "FooterRightBorder", XML_NAMESPACE_FO, XML_BORDER_RIGHT, XML_TYPE_BORDER, CTF_PM_FOOTERBORDERRIGHT ),
+ HFMAP( "FooterTopBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH, XML_TYPE_BORDER_WIDTH, CTF_PM_FOOTERBORDERWIDTHALL ),
+ HFMAP( "FooterTopBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_TOP, XML_TYPE_BORDER_WIDTH, CTF_PM_FOOTERBORDERWIDTHTOP ),
+ HFMAP( "FooterBottomBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_BOTTOM, XML_TYPE_BORDER_WIDTH, CTF_PM_FOOTERBORDERWIDTHBOTTOM ),
+ HFMAP( "FooterLeftBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_LEFT, XML_TYPE_BORDER_WIDTH, CTF_PM_FOOTERBORDERWIDTHLEFT ),
+ HFMAP( "FooterRightBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_RIGHT, XML_TYPE_BORDER_WIDTH, CTF_PM_FOOTERBORDERWIDTHRIGHT ),
+ HFMAP( "FooterTopBorderDistance", XML_NAMESPACE_FO, XML_PADDING, XML_TYPE_MEASURE, CTF_PM_FOOTERPADDINGALL ),
+ HFMAP( "FooterTopBorderDistance", XML_NAMESPACE_FO, XML_PADDING_TOP, XML_TYPE_MEASURE, CTF_PM_FOOTERPADDINGTOP ),
+ HFMAP( "FooterBottomBorderDistance", XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_TYPE_MEASURE, CTF_PM_FOOTERPADDINGBOTTOM ),
+ HFMAP( "FooterLeftBorderDistance", XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_TYPE_MEASURE, CTF_PM_FOOTERPADDINGLEFT ),
+ HFMAP( "FooterRightBorderDistance", XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_TYPE_MEASURE, CTF_PM_FOOTERPADDINGRIGHT ),
+ HFMAP( "FooterShadowFormat", XML_NAMESPACE_STYLE, XML_SHADOW, XML_TYPE_TEXT_SHADOW, CTF_PM_FOOTERFLAG ),
+ HFMAP( "FooterBackColor", XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT | MID_FLAG_MULTI_PROPERTY, CTF_PM_FOOTERFLAG ),
+ HFMAP( "FooterBackTransparent", XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT | MID_FLAG_MERGE_ATTRIBUTE, CTF_PM_FOOTERFLAG ),
+ HFMAP( "FooterBackGraphicLocation", XML_NAMESPACE_STYLE, XML_POSITION, XML_TYPE_BUILDIN_CMP_ONLY | MID_FLAG_SPECIAL_ITEM, CTF_PM_FOOTERGRAPHICPOSITION ),
+ HFMAP( "FooterBackGraphicFilter", XML_NAMESPACE_STYLE, XML_FILTER_NAME, XML_TYPE_STRING | MID_FLAG_SPECIAL_ITEM, CTF_PM_FOOTERGRAPHICFILTER ),
+ HFMAP( "FooterBackGraphicURL", XML_NAMESPACE_STYLE, XML_BACKGROUND_IMAGE, XML_TYPE_STRING | MID_FLAG_ELEMENT_ITEM, CTF_PM_FOOTERGRAPHICURL ),
+ HFMAP( "FooterDynamicSpacing", XML_NAMESPACE_STYLE, XML_DYNAMIC_SPACING, XML_TYPE_BOOL, CTF_PM_FOOTERFLAG ),
+
+ { 0L, 0, 0, XML_EMPTY, 0, 0, SvtSaveOptions::ODFVER_010 }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/PagePropertySetContext.cxx b/xmloff/source/style/PagePropertySetContext.cxx
new file mode 100644
index 000000000000..21c2c09ec31a
--- /dev/null
+++ b/xmloff/source/style/PagePropertySetContext.cxx
@@ -0,0 +1,136 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#include "PagePropertySetContext.hxx"
+#include "XMLBackgroundImageContext.hxx"
+#include "XMLTextColumnsContext.hxx"
+#include <xmloff/PageMasterStyleMap.hxx>
+#include "XMLFootnoteSeparatorImport.hxx"
+
+using ::rtl::OUString;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star;
+
+PagePropertySetContext::PagePropertySetContext(
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const Reference< xml::sax::XAttributeList > & xAttrList,
+ sal_uInt32 nFam,
+ ::std::vector< XMLPropertyState > &rProps,
+ const UniReference < SvXMLImportPropertyMapper > &rMap,
+ sal_Int32 nStartIndex, sal_Int32 nEndIndex,
+ const PageContextType aTempType ) :
+ SvXMLPropertySetContext( rImport, nPrfx, rLName, xAttrList, nFam,
+ rProps, rMap, nStartIndex, nEndIndex )
+{
+ aType = aTempType;
+}
+
+PagePropertySetContext::~PagePropertySetContext()
+{
+}
+
+SvXMLImportContext *PagePropertySetContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference< xml::sax::XAttributeList > & xAttrList,
+ ::std::vector< XMLPropertyState > &rProperties,
+ const XMLPropertyState& rProp )
+{
+ sal_Int32 nPos = CTF_PM_GRAPHICPOSITION;
+ sal_Int32 nFil = CTF_PM_GRAPHICFILTER;
+ switch ( aType )
+ {
+ case Header:
+ {
+ nPos = CTF_PM_HEADERGRAPHICPOSITION;
+ nFil = CTF_PM_HEADERGRAPHICFILTER;
+ }
+ break;
+ case Footer:
+ {
+ nPos = CTF_PM_FOOTERGRAPHICPOSITION;
+ nFil = CTF_PM_FOOTERGRAPHICFILTER;
+ }
+ break;
+ default:
+ break;
+ }
+ SvXMLImportContext *pContext = 0;
+
+ switch( mxMapper->getPropertySetMapper()
+ ->GetEntryContextId( rProp.mnIndex ) )
+ {
+ case CTF_PM_GRAPHICURL:
+ case CTF_PM_HEADERGRAPHICURL:
+ case CTF_PM_FOOTERGRAPHICURL:
+ DBG_ASSERT( rProp.mnIndex >= 2 &&
+ nPos == mxMapper->getPropertySetMapper()
+ ->GetEntryContextId( rProp.mnIndex-2 ) &&
+ nFil == mxMapper->getPropertySetMapper()
+ ->GetEntryContextId( rProp.mnIndex-1 ),
+ "invalid property map!");
+ (void)nPos;
+ (void)nFil;
+ pContext =
+ new XMLBackgroundImageContext( GetImport(), nPrefix,
+ rLocalName, xAttrList,
+ rProp,
+ rProp.mnIndex-2,
+ rProp.mnIndex-1,
+ -1,
+ rProperties );
+ break;
+
+ case CTF_PM_TEXTCOLUMNS:
+ pContext = new XMLTextColumnsContext( GetImport(), nPrefix,
+ rLocalName, xAttrList, rProp,
+ rProperties );
+ break;
+
+ case CTF_PM_FTN_LINE_WEIGTH:
+ pContext = new XMLFootnoteSeparatorImport(
+ GetImport(), nPrefix, rLocalName, rProperties,
+ mxMapper->getPropertySetMapper(), rProp.mnIndex);
+ break;
+ }
+
+ if( !pContext )
+ pContext = SvXMLPropertySetContext::CreateChildContext( nPrefix, rLocalName,
+ xAttrList,
+ rProperties, rProp );
+
+ return pContext;
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/PagePropertySetContext.hxx b/xmloff/source/style/PagePropertySetContext.hxx
new file mode 100644
index 000000000000..cfa2e554f77b
--- /dev/null
+++ b/xmloff/source/style/PagePropertySetContext.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PAGEPROPERTYSETCONTEXT_HXX
+#define _XMLOFF_PAGEPROPERTYSETCONTEXT_HXX
+
+#include <xmloff/xmlprcon.hxx>
+
+enum PageContextType
+{
+ Page,
+ Header,
+ Footer
+};
+
+class PagePropertySetContext : public SvXMLPropertySetContext
+{
+ PageContextType aType;
+
+public:
+ PagePropertySetContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList >& xAttrList,
+ sal_uInt32 nFam,
+ ::std::vector< XMLPropertyState > &rProps,
+ const UniReference < SvXMLImportPropertyMapper > &rMap,
+ sal_Int32 nStartIndex, sal_Int32 nEndIndex,
+ const PageContextType aType );
+
+ virtual ~PagePropertySetContext();
+
+ using SvXMLPropertySetContext::CreateChildContext;
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList,
+ ::std::vector< XMLPropertyState > &rProperties,
+ const XMLPropertyState& rProp);
+};
+
+
+#endif // _XMLOFF_XMLTEXTPROPERTYSETCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/SinglePropertySetInfoCache.cxx b/xmloff/source/style/SinglePropertySetInfoCache.cxx
new file mode 100644
index 000000000000..6282828e162f
--- /dev/null
+++ b/xmloff/source/style/SinglePropertySetInfoCache.cxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <cppuhelper/weakref.hxx>
+
+#include <xmloff/SinglePropertySetInfoCache.hxx>
+
+using namespace ::com::sun::star::uno;
+using ::com::sun::star::lang::XTypeProvider;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::beans::XPropertySetInfo;
+
+sal_Bool SinglePropertySetInfoCache::hasProperty(
+ const Reference< XPropertySet >& rPropSet,
+ Reference< XPropertySetInfo >& rPropSetInfo )
+{
+ if( !rPropSetInfo.is() )
+ rPropSetInfo = rPropSet->getPropertySetInfo();
+ sal_Bool bRet = sal_False, bValid = sal_False;
+ Reference < XTypeProvider > xTypeProv( rPropSet, UNO_QUERY );
+ Sequence< sal_Int8 > aImplId;
+ if( xTypeProv.is() )
+ {
+ aImplId = xTypeProv->getImplementationId();
+ if( aImplId.getLength() == 16 )
+ {
+ // The key must not be created outside this block, because it
+ // keeps a reference to the property set info.
+ PropertySetInfoKey aKey( rPropSetInfo, aImplId );
+ iterator aIter = find( aKey );
+ if( aIter != end() )
+ {
+ bRet = (*aIter).second;
+ bValid = sal_True;
+ }
+ }
+ }
+ if( !bValid )
+ {
+ bRet = rPropSetInfo->hasPropertyByName( sName );
+ if( xTypeProv.is() && aImplId.getLength() == 16 )
+ {
+ // Check whether the property set info is destroyed if it is
+ // assigned to a weak reference only. If it is destroyed, then
+ // every instance of getPropertySetInfo returns a new object.
+ // Such property set infos must not be cached.
+ WeakReference < XPropertySetInfo > xWeakInfo( rPropSetInfo );
+ rPropSetInfo = 0;
+ rPropSetInfo = xWeakInfo;
+ if( rPropSetInfo.is() )
+ {
+ PropertySetInfoKey aKey( rPropSetInfo, aImplId );
+ value_type aValue( aKey, bRet );
+ insert( aValue );
+ }
+ }
+ }
+
+ return bRet;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/StyleMap.cxx b/xmloff/source/style/StyleMap.cxx
new file mode 100644
index 000000000000..66b9453f4bb8
--- /dev/null
+++ b/xmloff/source/style/StyleMap.cxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <osl/mutex.hxx>
+#include <rtl/uuid.h>
+#include <rtl/memory.h>
+
+#include "StyleMap.hxx"
+
+using namespace ::osl;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+
+
+StyleMap::StyleMap()
+{
+}
+
+
+
+StyleMap::~StyleMap()
+{
+}
+
+
+// XUnoTunnel & co
+const Sequence< sal_Int8 > & StyleMap::getUnoTunnelId() throw()
+{
+ static Sequence< sal_Int8 > * pSeq = 0;
+ if( !pSeq )
+ {
+ Guard< Mutex > aGuard( Mutex::getGlobalMutex() );
+ if( !pSeq )
+ {
+ static Sequence< sal_Int8 > aSeq( 16 );
+ rtl_createUuid( reinterpret_cast<sal_uInt8*>( aSeq.getArray() ),
+ 0, sal_True );
+ pSeq = &aSeq;
+ }
+ }
+ return *pSeq;
+}
+
+StyleMap* StyleMap::getImplementation( Reference< XInterface > xInt ) throw()
+{
+ Reference< XUnoTunnel > xUT( xInt, UNO_QUERY );
+ if( xUT.is() )
+ return reinterpret_cast<StyleMap *>(
+ xUT->getSomething( StyleMap::getUnoTunnelId() ) );
+ else
+ return 0;
+}
+
+// XUnoTunnel
+sal_Int64 SAL_CALL StyleMap::getSomething(
+ const Sequence< sal_Int8 >& rId )
+ throw( RuntimeException )
+{
+ if( rId.getLength() == 16 &&
+ 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return reinterpret_cast<sal_Int64>( this );
+ }
+ return 0;
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/TransGradientStyle.cxx b/xmloff/source/style/TransGradientStyle.cxx
new file mode 100644
index 000000000000..cf0ab56d0225
--- /dev/null
+++ b/xmloff/source/style/TransGradientStyle.cxx
@@ -0,0 +1,328 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "TransGradientStyle.hxx"
+#include <com/sun/star/awt/Gradient.hpp>
+#include <xmloff/attrlist.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <rtl/ustrbuf.hxx>
+#include <rtl/ustring.hxx>
+#include <tools/debug.hxx>
+#include <xmloff/xmltkmap.hxx>
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmlimp.hxx>
+
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::xmloff::token;
+
+enum SvXMLTokenMapAttrs
+{
+ XML_TOK_GRADIENT_NAME,
+ XML_TOK_GRADIENT_DISPLAY_NAME,
+ XML_TOK_GRADIENT_STYLE,
+ XML_TOK_GRADIENT_CX,
+ XML_TOK_GRADIENT_CY,
+ XML_TOK_GRADIENT_START,
+ XML_TOK_GRADIENT_END,
+ XML_TOK_GRADIENT_ANGLE,
+ XML_TOK_GRADIENT_BORDER,
+ XML_TOK_TABSTOP_END=XML_TOK_UNKNOWN
+};
+
+
+SvXMLEnumMapEntry const pXML_GradientStyle_Enum[] =
+{
+ { XML_GRADIENTSTYLE_LINEAR, awt::GradientStyle_LINEAR },
+ { XML_GRADIENTSTYLE_AXIAL, awt::GradientStyle_AXIAL },
+ { XML_GRADIENTSTYLE_RADIAL, awt::GradientStyle_RADIAL },
+ { XML_GRADIENTSTYLE_ELLIPSOID, awt::GradientStyle_ELLIPTICAL },
+ { XML_GRADIENTSTYLE_SQUARE, awt::GradientStyle_SQUARE },
+ { XML_GRADIENTSTYLE_RECTANGULAR, awt::GradientStyle_RECT },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+
+//-------------------------------------------------------------
+// Import
+//-------------------------------------------------------------
+
+XMLTransGradientStyleImport::XMLTransGradientStyleImport( SvXMLImport& rImp )
+ : rImport(rImp)
+{
+}
+
+XMLTransGradientStyleImport::~XMLTransGradientStyleImport()
+{
+}
+
+sal_Bool XMLTransGradientStyleImport::importXML(
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList,
+ uno::Any& rValue,
+ OUString& rStrName )
+{
+ sal_Bool bRet = sal_False;
+ sal_Bool bHasName = sal_False;
+ sal_Bool bHasStyle = sal_False;
+ OUString aDisplayName;
+
+ awt::Gradient aGradient;
+ aGradient.XOffset = 0;
+ aGradient.YOffset = 0;
+ aGradient.StartIntensity = 100;
+ aGradient.EndIntensity = 100;
+ aGradient.Angle = 0;
+ aGradient.Border = 0;
+
+ {
+ static SvXMLTokenMapEntry aTrGradientAttrTokenMap[] =
+{
+ { XML_NAMESPACE_DRAW, XML_NAME, XML_TOK_GRADIENT_NAME },
+ { XML_NAMESPACE_DRAW, XML_DISPLAY_NAME, XML_TOK_GRADIENT_DISPLAY_NAME },
+ { XML_NAMESPACE_DRAW, XML_STYLE, XML_TOK_GRADIENT_STYLE },
+ { XML_NAMESPACE_DRAW, XML_CX, XML_TOK_GRADIENT_CX },
+ { XML_NAMESPACE_DRAW, XML_CY, XML_TOK_GRADIENT_CY },
+ { XML_NAMESPACE_DRAW, XML_START, XML_TOK_GRADIENT_START },
+ { XML_NAMESPACE_DRAW, XML_END, XML_TOK_GRADIENT_END },
+ { XML_NAMESPACE_DRAW, XML_GRADIENT_ANGLE, XML_TOK_GRADIENT_ANGLE },
+ { XML_NAMESPACE_DRAW, XML_GRADIENT_BORDER, XML_TOK_GRADIENT_BORDER },
+ XML_TOKEN_MAP_END
+};
+
+ SvXMLTokenMap aTokenMap( aTrGradientAttrTokenMap );
+ SvXMLNamespaceMap& rNamespaceMap = rImport.GetNamespaceMap();
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rFullAttrName = xAttrList->getNameByIndex( i );
+ OUString aStrAttrName;
+ sal_uInt16 nPrefix = rNamespaceMap.GetKeyByAttrName( rFullAttrName, &aStrAttrName );
+ const OUString& rStrValue = xAttrList->getValueByIndex( i );
+
+ sal_Int32 nTmpValue;
+
+ switch( aTokenMap.Get( nPrefix, aStrAttrName ) )
+ {
+ case XML_TOK_GRADIENT_NAME:
+ {
+ rStrName = rStrValue;
+ bHasName = sal_True;
+ }
+ break;
+ case XML_TOK_GRADIENT_DISPLAY_NAME:
+ {
+ aDisplayName = rStrValue;
+ }
+ break;
+ case XML_TOK_GRADIENT_STYLE:
+ {
+ sal_uInt16 eValue;
+ if( SvXMLUnitConverter::convertEnum( eValue, rStrValue, pXML_GradientStyle_Enum ) )
+ {
+ aGradient.Style = (awt::GradientStyle) eValue;
+ bHasStyle = sal_True;
+ }
+ }
+ break;
+ case XML_TOK_GRADIENT_CX:
+ SvXMLUnitConverter::convertPercent( nTmpValue, rStrValue );
+ aGradient.XOffset = sal::static_int_cast< sal_Int16 >(nTmpValue);
+ break;
+ case XML_TOK_GRADIENT_CY:
+ SvXMLUnitConverter::convertPercent( nTmpValue, rStrValue );
+ aGradient.YOffset = sal::static_int_cast< sal_Int16 >(nTmpValue);
+ break;
+ case XML_TOK_GRADIENT_START:
+ {
+ sal_Int32 aStartTransparency;
+ SvXMLUnitConverter::convertPercent( aStartTransparency, rStrValue );
+
+ sal_uInt8 n = sal::static_int_cast< sal_uInt8 >(
+ ( (100 - aStartTransparency) * 255 ) / 100 );
+
+ Color aColor( n, n, n );
+ aGradient.StartColor = (sal_Int32)( aColor.GetColor() );
+ }
+ break;
+ case XML_TOK_GRADIENT_END:
+ {
+ sal_Int32 aEndTransparency;
+ SvXMLUnitConverter::convertPercent( aEndTransparency, rStrValue );
+
+ sal_uInt8 n = sal::static_int_cast< sal_uInt8 >(
+ ( (100 - aEndTransparency) * 255 ) / 100 );
+
+ Color aColor( n, n, n );
+ aGradient.EndColor = (sal_Int32)( aColor.GetColor() );
+ }
+ break;
+ case XML_TOK_GRADIENT_ANGLE:
+ {
+ sal_Int32 nValue;
+ SvXMLUnitConverter::convertNumber( nValue, rStrValue, 0, 3600 );
+ aGradient.Angle = sal_Int16( nValue );
+ }
+ break;
+ case XML_TOK_GRADIENT_BORDER:
+ SvXMLUnitConverter::convertPercent( nTmpValue, rStrValue );
+ aGradient.Border = sal::static_int_cast< sal_Int16 >(nTmpValue);
+ break;
+
+ default:
+ DBG_WARNING( "Unknown token at import transparency gradient style" )
+ ;
+ }
+ }
+
+ rValue <<= aGradient;
+
+ if( aDisplayName.getLength() )
+ {
+ rImport.AddStyleDisplayName( XML_STYLE_FAMILY_SD_GRADIENT_ID, rStrName,
+ aDisplayName );
+ rStrName = aDisplayName;
+ }
+
+ bRet = bHasName && bHasStyle;
+
+ }
+
+ return bRet;
+}
+
+
+//-------------------------------------------------------------
+// Export
+//-------------------------------------------------------------
+
+XMLTransGradientStyleExport::XMLTransGradientStyleExport( SvXMLExport& rExp )
+ : rExport(rExp)
+{
+}
+
+XMLTransGradientStyleExport::~XMLTransGradientStyleExport()
+{
+}
+
+
+sal_Bool XMLTransGradientStyleExport::exportXML(
+ const OUString& rStrName,
+ const uno::Any& rValue )
+{
+ sal_Bool bRet = sal_False;
+ awt::Gradient aGradient;
+
+ if( rStrName.getLength() )
+ {
+ if( rValue >>= aGradient )
+ {
+ OUString aStrValue;
+ OUStringBuffer aOut;
+
+ // Style
+ if( !SvXMLUnitConverter::convertEnum( aOut, aGradient.Style, pXML_GradientStyle_Enum ) )
+ {
+ bRet = sal_False;
+ }
+ else
+ {
+ // Name
+ sal_Bool bEncoded = sal_False;
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME,
+ rExport.EncodeStyleName( rStrName,
+ &bEncoded ) );
+ if( bEncoded )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DISPLAY_NAME,
+ rStrName );
+
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_STYLE, aStrValue );
+
+ // Center x/y
+ if( aGradient.Style != awt::GradientStyle_LINEAR &&
+ aGradient.Style != awt::GradientStyle_AXIAL )
+ {
+ SvXMLUnitConverter::convertPercent( aOut, aGradient.XOffset );
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CX, aStrValue );
+
+ SvXMLUnitConverter::convertPercent( aOut, aGradient.YOffset );
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CY, aStrValue );
+ }
+
+
+ Color aColor;
+
+ // Transparency start
+ aColor.SetColor( aGradient.StartColor );
+ sal_Int32 aStartValue = 100 - (sal_Int32)(((aColor.GetRed() + 1) * 100) / 255);
+ SvXMLUnitConverter::convertPercent( aOut, aStartValue );
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_START, aStrValue );
+
+ // Transparency end
+ aColor.SetColor( aGradient.EndColor );
+ sal_Int32 aEndValue = 100 - (sal_Int32)(((aColor.GetRed() + 1) * 100) / 255);
+ SvXMLUnitConverter::convertPercent( aOut, aEndValue );
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_END, aStrValue );
+
+ // Angle
+ if( aGradient.Style != awt::GradientStyle_RADIAL )
+ {
+ SvXMLUnitConverter::convertNumber( aOut, sal_Int32( aGradient.Angle ) );
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_GRADIENT_ANGLE, aStrValue );
+ }
+
+ // Border
+ SvXMLUnitConverter::convertPercent( aOut, aGradient.Border );
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_GRADIENT_BORDER, aStrValue );
+
+ // Do Write
+ SvXMLElementExport rElem( rExport,
+ XML_NAMESPACE_DRAW, XML_OPACITY,
+ sal_True, sal_False );
+ }
+ }
+ }
+
+ return bRet;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/VisAreaContext.cxx b/xmloff/source/style/VisAreaContext.cxx
new file mode 100644
index 000000000000..727d09293025
--- /dev/null
+++ b/xmloff/source/style/VisAreaContext.cxx
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+
+
+// INCLUDE ---------------------------------------------------------------
+#include "xmloff/VisAreaContext.hxx"
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <tools/gen.hxx>
+
+using namespace com::sun::star;
+using namespace ::xmloff::token;
+
+//------------------------------------------------------------------
+
+XMLVisAreaContext::XMLVisAreaContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList,
+ Rectangle& rRect, const MapUnit aMapUnit ) :
+ SvXMLImportContext( rImport, nPrfx, rLName )
+{
+ awt::Rectangle rAwtRect( rRect.getX(), rRect.getY(), rRect.getWidth(), rRect.getHeight() );
+ process( xAttrList, rAwtRect, (sal_Int16)aMapUnit );
+
+ rRect.setX( rAwtRect.X );
+ rRect.setY( rAwtRect.Y );
+ rRect.setWidth( rAwtRect.Width );
+ rRect.setHeight( rAwtRect.Height );
+}
+
+XMLVisAreaContext::XMLVisAreaContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList,
+ ::com::sun::star::awt::Rectangle& rRect, const sal_Int16 nMeasureUnit ) :
+ SvXMLImportContext( rImport, nPrfx, rLName )
+{
+ process( xAttrList, rRect, nMeasureUnit );
+}
+
+XMLVisAreaContext::~XMLVisAreaContext()
+{
+}
+
+void XMLVisAreaContext::process( const uno::Reference< xml::sax::XAttributeList>& xAttrList, awt::Rectangle& rRect, const sal_Int16 nMeasureUnit )
+{
+ MapUnit aMapUnit = (MapUnit)nMeasureUnit;
+
+ sal_Int32 nX(0);
+ sal_Int32 nY(0);
+ sal_Int32 nWidth(0);
+ sal_Int32 nHeight(0);
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
+ rtl::OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(
+ sAttrName, &aLocalName );
+ rtl::OUString sValue = xAttrList->getValueByIndex( i );
+
+ if (nPrefix == XML_NAMESPACE_OFFICE)
+ {
+ if (IsXMLToken( aLocalName, XML_X ))
+ {
+ SvXMLUnitConverter::convertMeasure(nX, sValue, aMapUnit);
+ rRect.X = nX;
+ }
+ else if (IsXMLToken( aLocalName, XML_Y ))
+ {
+ SvXMLUnitConverter::convertMeasure(nY, sValue, aMapUnit);
+ rRect.Y = nY;
+ }
+ else if (IsXMLToken( aLocalName, XML_WIDTH ))
+ {
+ SvXMLUnitConverter::convertMeasure(nWidth, sValue, aMapUnit);
+ rRect.Width = nWidth;
+ }
+ else if (IsXMLToken( aLocalName, XML_HEIGHT ))
+ {
+ SvXMLUnitConverter::convertMeasure(nHeight, sValue, aMapUnit);
+ rRect.Height = nHeight;
+ }
+ }
+ }
+}
+
+SvXMLImportContext *XMLVisAreaContext::CreateChildContext( sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& )
+{
+ // here is no context
+ SvXMLImportContext *pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+
+ return pContext;
+}
+
+void XMLVisAreaContext::EndElement()
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/VisAreaExport.cxx b/xmloff/source/style/VisAreaExport.cxx
new file mode 100644
index 000000000000..5ed8dbb2a801
--- /dev/null
+++ b/xmloff/source/style/VisAreaExport.cxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/awt/Rectangle.hpp>
+#include "xmloff/VisAreaExport.hxx"
+#include <xmloff/xmlexp.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <tools/gen.hxx>
+
+using namespace ::xmloff::token;
+
+
+XMLVisAreaExport::XMLVisAreaExport(SvXMLExport& rExport, const sal_Char *pName,
+ const Rectangle& aRect, const MapUnit aMapUnit)
+{
+ SvXMLUnitConverter& rUnitConv = rExport.GetMM100UnitConverter();
+
+ // write VisArea Element and its Attributes
+ rtl::OUStringBuffer sBuffer;
+ rUnitConv.convertMeasure(sBuffer, aRect.getX(), aMapUnit);
+ rExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_X, sBuffer.makeStringAndClear());
+ rUnitConv.convertMeasure(sBuffer, aRect.getY(), aMapUnit);
+ rExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_Y, sBuffer.makeStringAndClear());
+ rUnitConv.convertMeasure(sBuffer, aRect.getWidth(), aMapUnit);
+ rExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_WIDTH, sBuffer.makeStringAndClear());
+ rUnitConv.convertMeasure(sBuffer, aRect.getHeight(), aMapUnit);
+ rExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_HEIGHT, sBuffer.makeStringAndClear());
+ SvXMLElementExport aVisAreaElem(rExport, XML_NAMESPACE_OFFICE, pName, sal_True, sal_True);
+}
+
+XMLVisAreaExport::XMLVisAreaExport(SvXMLExport& rExport, const sal_Char *pName,
+ const com::sun::star::awt::Rectangle& aRect, const sal_Int16 nMeasureUnit )
+{
+ MapUnit aMapUnit = (MapUnit)nMeasureUnit;
+
+ SvXMLUnitConverter& rUnitConv = rExport.GetMM100UnitConverter();
+
+ // write VisArea Element and its Attributes
+ rtl::OUStringBuffer sBuffer;
+ rUnitConv.convertMeasure(sBuffer, aRect.X, aMapUnit);
+ rExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_X, sBuffer.makeStringAndClear());
+ rUnitConv.convertMeasure(sBuffer, aRect.Y, aMapUnit);
+ rExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_Y, sBuffer.makeStringAndClear());
+ rUnitConv.convertMeasure(sBuffer, aRect.Width, aMapUnit);
+ rExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_WIDTH, sBuffer.makeStringAndClear());
+ rUnitConv.convertMeasure(sBuffer, aRect.Height, aMapUnit);
+ rExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_HEIGHT, sBuffer.makeStringAndClear());
+ SvXMLElementExport aVisAreaElem(rExport, XML_NAMESPACE_OFFICE, pName, sal_True, sal_True);
+}
+
+XMLVisAreaExport::~XMLVisAreaExport()
+{
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/WordWrapPropertyHdl.cxx b/xmloff/source/style/WordWrapPropertyHdl.cxx
new file mode 100644
index 000000000000..c7fc2b26c8b0
--- /dev/null
+++ b/xmloff/source/style/WordWrapPropertyHdl.cxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/WordWrapPropertyHdl.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <comphelper/extract.hxx>
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/uno/Any.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star::uno;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLWordWrapPropertyHdl
+//
+
+XMLWordWrapPropertyHdl::XMLWordWrapPropertyHdl( SvXMLImport* pImport )
+: mpImport( pImport )
+{
+}
+
+XMLWordWrapPropertyHdl::~XMLWordWrapPropertyHdl()
+{
+ // Nothing to do
+}
+
+sal_Bool XMLWordWrapPropertyHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bValue = sal_False, bRetValue = sal_False;
+ if( rStrImpValue == GetXMLToken( xmloff::token::XML_WRAP ) )
+ {
+ bValue = sal_True;
+ bRetValue = sal_True;
+ }
+ if( rStrImpValue == GetXMLToken( xmloff::token::XML_NO_WRAP ) )
+ {
+ bValue = sal_False;
+ bRetValue = sal_True;
+ }
+ if ( bRetValue && mpImport )
+ {
+ sal_Int32 nUPD, nBuildId;
+ if( mpImport->getBuildIds( nUPD, nBuildId ) )
+ {
+ if( nUPD == 300 )
+ {
+ if( ( nBuildId > 0 ) && (nBuildId < 9316 ) )
+ bValue = bValue ? sal_False : sal_True; // treat OOo 3.0 beta1 as OOo 2.x
+ }
+ else if( ( nUPD == 680 ) || ( nUPD >= 640 && nUPD <= 645 ) )
+ bValue = bValue ? sal_False : sal_True;
+ }
+ rValue <<= bValue;
+ }
+ return bRetValue;
+}
+
+sal_Bool XMLWordWrapPropertyHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& ) const
+{
+ if( ::cppu::any2bool( rValue ) )
+ {
+ rStrExpValue = GetXMLToken( xmloff::token::XML_WRAP );
+ }
+ else
+ {
+ rStrExpValue = GetXMLToken( xmloff::token::XML_NO_WRAP );
+ }
+ return sal_True;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/XMLBackgroundImageContext.cxx b/xmloff/source/style/XMLBackgroundImageContext.cxx
new file mode 100644
index 000000000000..4f3bd37d8a21
--- /dev/null
+++ b/xmloff/source/style/XMLBackgroundImageContext.cxx
@@ -0,0 +1,417 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <xmloff/xmltkmap.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/XMLBase64ImportContext.hxx>
+#include "XMLBackgroundImageContext.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::io;
+using namespace ::xmloff::token;
+
+enum SvXMLTokenMapAttrs
+{
+ XML_TOK_BGIMG_HREF,
+ XML_TOK_BGIMG_TYPE,
+ XML_TOK_BGIMG_ACTUATE,
+ XML_TOK_BGIMG_SHOW,
+ XML_TOK_BGIMG_POSITION,
+ XML_TOK_BGIMG_REPEAT,
+ XML_TOK_BGIMG_FILTER,
+ XML_TOK_BGIMG_OPACITY,
+ XML_TOK_NGIMG_END=XML_TOK_UNKNOWN
+};
+const SvXMLTokenMapEntry* lcl_getBGImgAttributesAttrTokenMap()
+{
+ static SvXMLTokenMapEntry aBGImgAttributesAttrTokenMap[] =
+ {
+ { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_BGIMG_HREF },
+ { XML_NAMESPACE_XLINK, XML_TYPE, XML_TOK_BGIMG_TYPE },
+ { XML_NAMESPACE_XLINK, XML_ACTUATE, XML_TOK_BGIMG_ACTUATE },
+ { XML_NAMESPACE_XLINK, XML_SHOW, XML_TOK_BGIMG_SHOW },
+ { XML_NAMESPACE_STYLE, XML_POSITION, XML_TOK_BGIMG_POSITION },
+ { XML_NAMESPACE_STYLE, XML_REPEAT, XML_TOK_BGIMG_REPEAT },
+ { XML_NAMESPACE_STYLE, XML_FILTER_NAME, XML_TOK_BGIMG_FILTER },
+ { XML_NAMESPACE_DRAW, XML_OPACITY, XML_TOK_BGIMG_OPACITY },
+ XML_TOKEN_MAP_END
+ };
+ return aBGImgAttributesAttrTokenMap;
+}
+
+
+
+SvXMLEnumMapEntry psXML_BrushHoriPos[] =
+{
+ { XML_LEFT, GraphicLocation_LEFT_MIDDLE },
+ { XML_RIGHT, GraphicLocation_RIGHT_MIDDLE },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry psXML_BrushVertPos[] =
+{
+ { XML_TOP, GraphicLocation_MIDDLE_TOP },
+ { XML_BOTTOM, GraphicLocation_MIDDLE_BOTTOM },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+void lcl_xmlbic_MergeHoriPos( GraphicLocation& ePos,
+ GraphicLocation eHori )
+{
+ DBG_ASSERT( GraphicLocation_LEFT_MIDDLE==eHori ||
+ GraphicLocation_MIDDLE_MIDDLE==eHori ||
+ GraphicLocation_RIGHT_MIDDLE==eHori,
+ "lcl_xmlbic_MergeHoriPos: vertical pos must be middle" );
+
+ switch( ePos )
+ {
+ case GraphicLocation_LEFT_TOP:
+ case GraphicLocation_MIDDLE_TOP:
+ case GraphicLocation_RIGHT_TOP:
+ ePos = GraphicLocation_LEFT_MIDDLE==eHori
+ ? GraphicLocation_LEFT_TOP
+ : (GraphicLocation_MIDDLE_MIDDLE==eHori
+ ? GraphicLocation_MIDDLE_TOP
+ : GraphicLocation_RIGHT_TOP);
+ break;
+
+ case GraphicLocation_LEFT_MIDDLE:
+ case GraphicLocation_MIDDLE_MIDDLE:
+ case GraphicLocation_RIGHT_MIDDLE:
+ ePos = eHori;
+ break;
+
+ case GraphicLocation_LEFT_BOTTOM:
+ case GraphicLocation_MIDDLE_BOTTOM:
+ case GraphicLocation_RIGHT_BOTTOM:
+ ePos = GraphicLocation_LEFT_MIDDLE==eHori
+ ? GraphicLocation_LEFT_BOTTOM
+ : (GraphicLocation_MIDDLE_MIDDLE==eHori
+ ? GraphicLocation_MIDDLE_BOTTOM
+ : GraphicLocation_RIGHT_BOTTOM);
+ break;
+ default:
+ break;
+ }
+}
+
+void lcl_xmlbic_MergeVertPos( GraphicLocation& ePos,
+ GraphicLocation eVert )
+{
+ DBG_ASSERT( GraphicLocation_MIDDLE_TOP==eVert ||
+ GraphicLocation_MIDDLE_MIDDLE==eVert ||
+ GraphicLocation_MIDDLE_BOTTOM==eVert,
+ "lcl_xmlbic_MergeVertPos: horizontal pos must be middle" );
+
+ switch( ePos )
+ {
+ case GraphicLocation_LEFT_TOP:
+ case GraphicLocation_LEFT_MIDDLE:
+ case GraphicLocation_LEFT_BOTTOM:
+ ePos = GraphicLocation_MIDDLE_TOP==eVert
+ ? GraphicLocation_LEFT_TOP
+ : (GraphicLocation_MIDDLE_MIDDLE==eVert
+ ? GraphicLocation_LEFT_MIDDLE
+ : GraphicLocation_LEFT_BOTTOM);
+ ePos = eVert;
+ break;
+
+ case GraphicLocation_MIDDLE_TOP:
+ case GraphicLocation_MIDDLE_MIDDLE:
+ case GraphicLocation_MIDDLE_BOTTOM:
+ ePos = eVert;
+ break;
+
+ case GraphicLocation_RIGHT_TOP:
+ case GraphicLocation_RIGHT_MIDDLE:
+ case GraphicLocation_RIGHT_BOTTOM:
+ ePos = GraphicLocation_MIDDLE_TOP==eVert
+ ? GraphicLocation_RIGHT_TOP
+ : (GraphicLocation_MIDDLE_MIDDLE==eVert
+ ? GraphicLocation_RIGHT_MIDDLE
+ : GraphicLocation_RIGHT_BOTTOM);
+ break;
+ default:
+ break;
+ }
+}
+
+TYPEINIT1( XMLBackgroundImageContext, XMLElementPropertyContext );
+
+void XMLBackgroundImageContext::ProcessAttrs(
+ const Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ SvXMLTokenMap aTokenMap( lcl_getBGImgAttributesAttrTokenMap() );
+
+ ePos = GraphicLocation_NONE;
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ const OUString& rValue = xAttrList->getValueByIndex( i );
+
+ switch( aTokenMap.Get( nPrefix, aLocalName ) )
+ {
+ case XML_TOK_BGIMG_HREF:
+ sURL = rValue;
+ if( GraphicLocation_NONE == ePos )
+ ePos = GraphicLocation_TILED;
+ break;
+ case XML_TOK_BGIMG_TYPE:
+ case XML_TOK_BGIMG_ACTUATE:
+ case XML_TOK_BGIMG_SHOW:
+ break;
+ case XML_TOK_BGIMG_POSITION:
+ {
+ GraphicLocation eNewPos = GraphicLocation_NONE, eTmp;
+ sal_uInt16 nTmp;
+ SvXMLTokenEnumerator aTokenEnum( rValue );
+ OUString aToken;
+ sal_Bool bHori = sal_False, bVert = sal_False;
+ sal_Bool bOK = sal_True;
+ while( bOK && aTokenEnum.getNextToken( aToken ) )
+ {
+ if( bHori && bVert )
+ {
+ bOK = sal_False;
+ }
+ else if( -1 != aToken.indexOf( sal_Unicode('%') ) )
+ {
+ sal_Int32 nPrc = 50;
+ if( SvXMLUnitConverter::convertPercent( nPrc, aToken ) )
+ {
+ if( !bHori )
+ {
+ eNewPos = nPrc < 25
+ ? GraphicLocation_LEFT_TOP
+ : (nPrc < 75 ? GraphicLocation_MIDDLE_MIDDLE
+ : GraphicLocation_RIGHT_BOTTOM);
+ bHori = sal_True;
+ }
+ else
+ {
+ eTmp = nPrc < 25
+ ? GraphicLocation_LEFT_TOP
+ : (nPrc < 75 ? GraphicLocation_LEFT_MIDDLE
+ : GraphicLocation_LEFT_BOTTOM);
+ lcl_xmlbic_MergeVertPos( eNewPos, eTmp );
+ bVert = sal_True;
+ }
+ }
+ else
+ {
+ // wrong percentage
+ bOK = sal_False;
+ }
+ }
+ else if( IsXMLToken( aToken, XML_CENTER ) )
+ {
+ if( bHori )
+ lcl_xmlbic_MergeVertPos( eNewPos,
+ GraphicLocation_MIDDLE_MIDDLE );
+ else if ( bVert )
+ lcl_xmlbic_MergeHoriPos( eNewPos,
+ GraphicLocation_MIDDLE_MIDDLE );
+ else
+ eNewPos = GraphicLocation_MIDDLE_MIDDLE;
+ }
+ else if( SvXMLUnitConverter::convertEnum( nTmp, aToken,
+ psXML_BrushHoriPos ) )
+ {
+ if( bVert )
+ lcl_xmlbic_MergeHoriPos( eNewPos,
+ (GraphicLocation)nTmp );
+ else if( !bHori )
+ eNewPos = (GraphicLocation)nTmp;
+ else
+ bOK = sal_False;
+ bHori = sal_True;
+ }
+ else if( SvXMLUnitConverter::convertEnum( nTmp, aToken,
+ psXML_BrushVertPos ) )
+ {
+ if( bHori )
+ lcl_xmlbic_MergeVertPos( eNewPos,
+ (GraphicLocation)nTmp );
+ else if( !bVert )
+ eNewPos = (GraphicLocation)nTmp;
+ else
+ bOK = sal_False;
+ bVert = sal_True;
+ }
+ else
+ {
+ bOK = sal_False;
+ }
+ }
+
+ bOK &= GraphicLocation_NONE != eNewPos;
+ if( bOK )
+ ePos = eNewPos;
+ }
+ break;
+ case XML_TOK_BGIMG_REPEAT:
+ {
+ sal_uInt16 nPos = GraphicLocation_NONE;
+ static SvXMLEnumMapEntry psXML_BrushRepeat[] =
+ {
+ { XML_BACKGROUND_REPEAT, GraphicLocation_TILED },
+ { XML_BACKGROUND_NO_REPEAT, GraphicLocation_MIDDLE_MIDDLE },
+ { XML_BACKGROUND_STRETCH, GraphicLocation_AREA },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ if( SvXMLUnitConverter::convertEnum( nPos, rValue,
+ psXML_BrushRepeat ) )
+ {
+ if( GraphicLocation_MIDDLE_MIDDLE != nPos ||
+ GraphicLocation_NONE == ePos ||
+ GraphicLocation_AREA == ePos ||
+ GraphicLocation_TILED == ePos )
+ ePos = (GraphicLocation)nPos;
+ }
+ }
+ break;
+ case XML_TOK_BGIMG_FILTER:
+ sFilter = rValue;
+ break;
+ case XML_TOK_BGIMG_OPACITY:
+ {
+ sal_Int32 nTmp;
+ // convert from percent and clip
+ if( SvXMLUnitConverter::convertPercent( nTmp, rValue ) )
+ {
+ if( (nTmp >= 0) && (nTmp <= 100) )
+ nTransparency = static_cast<sal_Int8>( 100-nTmp );
+ }
+ }
+ break;
+ }
+ }
+
+}
+
+XMLBackgroundImageContext::XMLBackgroundImageContext(
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const Reference< xml::sax::XAttributeList > & xAttrList,
+ const XMLPropertyState& rProp,
+ sal_Int32 nPosIdx,
+ sal_Int32 nFilterIdx,
+ sal_Int32 nTransparencyIdx,
+ ::std::vector< XMLPropertyState > &rProps ) :
+ XMLElementPropertyContext( rImport, nPrfx, rLName, rProp, rProps ),
+ aPosProp( nPosIdx ),
+ aFilterProp( nFilterIdx ),
+ aTransparencyProp( nTransparencyIdx ),
+ nTransparency( 0 )
+{
+ ProcessAttrs( xAttrList );
+}
+
+XMLBackgroundImageContext::~XMLBackgroundImageContext()
+{
+}
+
+SvXMLImportContext *XMLBackgroundImageContext::CreateChildContext(
+ sal_uInt16 nPrefix, const OUString& rLocalName,
+ const Reference< xml::sax::XAttributeList > & xAttrList )
+{
+ SvXMLImportContext *pContext = NULL;
+ if( (XML_NAMESPACE_OFFICE == nPrefix) &&
+ xmloff::token::IsXMLToken( rLocalName,
+ xmloff::token::XML_BINARY_DATA ) )
+ {
+ if( !sURL.getLength() && !xBase64Stream.is() )
+ {
+ xBase64Stream = GetImport().GetStreamForGraphicObjectURLFromBase64();
+ if( xBase64Stream.is() )
+ pContext = new XMLBase64ImportContext( GetImport(), nPrefix,
+ rLocalName, xAttrList,
+ xBase64Stream );
+ }
+ }
+ if( !pContext )
+ {
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+ }
+
+ return pContext;
+}
+
+void XMLBackgroundImageContext::EndElement()
+{
+ if( sURL.getLength() )
+ {
+ sURL = GetImport().ResolveGraphicObjectURL( sURL, sal_False );
+ }
+ else if( xBase64Stream.is() )
+ {
+ sURL = GetImport().ResolveGraphicObjectURLFromBase64( xBase64Stream );
+ xBase64Stream = 0;
+ }
+
+ if( !sURL.getLength() )
+ ePos = GraphicLocation_NONE;
+ else if( GraphicLocation_NONE == ePos )
+ ePos = GraphicLocation_TILED;
+
+ aProp.maValue <<= sURL;
+ aPosProp.maValue <<= ePos;
+ aFilterProp.maValue <<= sFilter;
+ aTransparencyProp.maValue <<= nTransparency;
+
+ SetInsert( sal_True );
+ XMLElementPropertyContext::EndElement();
+
+ if( -1 != aPosProp.mnIndex )
+ rProperties.push_back( aPosProp );
+ if( -1 != aFilterProp.mnIndex )
+ rProperties.push_back( aFilterProp );
+ if( -1 != aTransparencyProp.mnIndex )
+ rProperties.push_back( aTransparencyProp );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/XMLBackgroundImageExport.cxx b/xmloff/source/style/XMLBackgroundImageExport.cxx
new file mode 100644
index 000000000000..adeb55009ea4
--- /dev/null
+++ b/xmloff/source/style/XMLBackgroundImageExport.cxx
@@ -0,0 +1,177 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/style/GraphicLocation.hpp>
+
+#include <xmloff/xmlnmspe.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <xmloff/xmlexp.hxx>
+#include "XMLBackgroundImageExport.hxx"
+#include <xmloff/xmluconv.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::style;
+using namespace ::xmloff::token;
+
+XMLBackgroundImageExport::XMLBackgroundImageExport( SvXMLExport& rExp ) :
+ rExport( rExp )
+{
+}
+
+XMLBackgroundImageExport::~XMLBackgroundImageExport()
+{
+}
+
+void XMLBackgroundImageExport::exportXML( const Any& rURL,
+ const Any *pPos,
+ const Any *pFilter,
+ const Any *pTransparency,
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName )
+{
+ GraphicLocation ePos;
+ if( !(pPos && ((*pPos) >>= ePos)) )
+ ePos = GraphicLocation_AREA;
+
+ OUString sURL;
+ rURL >>= sURL;
+ if( sURL.getLength() && GraphicLocation_NONE != ePos )
+ {
+ OUString sTempURL( GetExport().AddEmbeddedGraphicObject( sURL ) );
+ if( sTempURL.getLength() )
+ {
+ GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, sTempURL );
+ GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE,
+ XML_SIMPLE );
+ GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE,
+ XML_ONLOAD );
+ }
+
+ OUStringBuffer aOut;
+ switch( ePos )
+ {
+ case GraphicLocation_LEFT_TOP:
+ case GraphicLocation_MIDDLE_TOP:
+ case GraphicLocation_RIGHT_TOP:
+ aOut.append( GetXMLToken(XML_TOP) );
+ break;
+ case GraphicLocation_LEFT_MIDDLE:
+ case GraphicLocation_MIDDLE_MIDDLE:
+ case GraphicLocation_RIGHT_MIDDLE:
+ aOut.append( GetXMLToken(XML_CENTER) );
+ break;
+ case GraphicLocation_LEFT_BOTTOM:
+ case GraphicLocation_MIDDLE_BOTTOM:
+ case GraphicLocation_RIGHT_BOTTOM:
+ aOut.append( GetXMLToken(XML_BOTTOM) );
+ break;
+ default:
+ break;
+ }
+
+ if( aOut.getLength() )
+ {
+ aOut.append( sal_Unicode( ' ' ) );
+
+ switch( ePos )
+ {
+ case GraphicLocation_LEFT_TOP:
+ case GraphicLocation_LEFT_BOTTOM:
+ case GraphicLocation_LEFT_MIDDLE:
+ aOut.append( GetXMLToken(XML_LEFT) );
+ break;
+ case GraphicLocation_MIDDLE_TOP:
+ case GraphicLocation_MIDDLE_MIDDLE:
+ case GraphicLocation_MIDDLE_BOTTOM:
+ aOut.append( GetXMLToken(XML_CENTER) );
+ break;
+ case GraphicLocation_RIGHT_MIDDLE:
+ case GraphicLocation_RIGHT_TOP:
+ case GraphicLocation_RIGHT_BOTTOM:
+ aOut.append( GetXMLToken(XML_RIGHT) );
+ break;
+ default:
+ break;
+ }
+ }
+ if( aOut.getLength() )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE,
+ XML_POSITION, aOut.makeStringAndClear() );
+
+ if( GraphicLocation_AREA == ePos )
+ {
+ aOut.append( GetXMLToken(XML_BACKGROUND_STRETCH) );
+ }
+ else if( GraphicLocation_NONE != ePos && GraphicLocation_TILED != ePos )
+ {
+ aOut.append( GetXMLToken(XML_BACKGROUND_NO_REPEAT) );
+ }
+ if( aOut.getLength() )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_REPEAT,
+ aOut.makeStringAndClear() );
+
+ if( pFilter )
+ {
+ OUString sFilter;
+ (*pFilter) >>= sFilter;
+ if( sFilter.getLength() )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_FILTER_NAME,
+ sFilter );
+ }
+
+ if( pTransparency )
+ {
+ sal_Int8 nTransparency = sal_Int8();
+ if( (*pTransparency) >>= nTransparency )
+ {
+ OUStringBuffer aTransOut;
+ SvXMLUnitConverter::convertPercent( aTransOut, 100-nTransparency );
+ GetExport().AddAttribute( XML_NAMESPACE_DRAW, XML_OPACITY,
+ aTransOut.makeStringAndClear() );
+ }
+ }
+ }
+
+ {
+ SvXMLElementExport aElem( GetExport(), nPrefix, rLocalName, sal_True, sal_True );
+ if( sURL.getLength() && GraphicLocation_NONE != ePos )
+ {
+ // optional office:binary-data
+ GetExport().AddEmbeddedGraphicObjectAsBase64( sURL );
+ }
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/XMLBitmapLogicalSizePropertyHandler.cxx b/xmloff/source/style/XMLBitmapLogicalSizePropertyHandler.cxx
new file mode 100644
index 000000000000..72fedc3c2081
--- /dev/null
+++ b/xmloff/source/style/XMLBitmapLogicalSizePropertyHandler.cxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <xmloff/xmluconv.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include "XMLBitmapLogicalSizePropertyHandler.hxx"
+#include <comphelper/extract.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+
+XMLBitmapLogicalSizePropertyHandler::XMLBitmapLogicalSizePropertyHandler()
+{
+}
+
+XMLBitmapLogicalSizePropertyHandler::~XMLBitmapLogicalSizePropertyHandler()
+{
+}
+
+sal_Bool XMLBitmapLogicalSizePropertyHandler::importXML(
+ const OUString& rStrImpValue,
+ Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ rValue = ::cppu::bool2any( rStrImpValue.indexOf( sal_Unicode('%') ) == -1 );
+ return sal_True;
+}
+
+sal_Bool XMLBitmapLogicalSizePropertyHandler::exportXML(
+ OUString&,
+ const Any&,
+ const SvXMLUnitConverter& ) const
+{
+ return sal_False;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/XMLBitmapRepeatOffsetPropertyHandler.cxx b/xmloff/source/style/XMLBitmapRepeatOffsetPropertyHandler.cxx
new file mode 100644
index 000000000000..6f7143d62da3
--- /dev/null
+++ b/xmloff/source/style/XMLBitmapRepeatOffsetPropertyHandler.cxx
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include "XMLBitmapRepeatOffsetPropertyHandler.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+
+using ::xmloff::token::GetXMLToken;
+using ::xmloff::token::XML_VERTICAL;
+using ::xmloff::token::XML_HORIZONTAL;
+
+
+XMLBitmapRepeatOffsetPropertyHandler::XMLBitmapRepeatOffsetPropertyHandler( sal_Bool bX )
+: mbX( bX ),
+ msVertical( GetXMLToken(XML_VERTICAL) ),
+ msHorizontal( GetXMLToken(XML_HORIZONTAL) )
+{
+}
+
+XMLBitmapRepeatOffsetPropertyHandler::~XMLBitmapRepeatOffsetPropertyHandler()
+{
+}
+
+sal_Bool XMLBitmapRepeatOffsetPropertyHandler::importXML(
+ const OUString& rStrImpValue,
+ Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ SvXMLTokenEnumerator aTokenEnum( rStrImpValue );
+ OUString aToken;
+ if( aTokenEnum.getNextToken( aToken ) )
+ {
+ sal_Int32 nValue;
+ if( SvXMLUnitConverter::convertPercent( nValue, aToken ) )
+ {
+ if( aTokenEnum.getNextToken( aToken ) )
+ {
+ if( ( mbX && ( aToken == msHorizontal ) ) || ( !mbX && ( aToken == msVertical ) ) )
+ {
+ rValue <<= nValue;
+ return sal_True;
+ }
+ }
+ }
+ }
+
+ return sal_False;
+
+}
+
+sal_Bool XMLBitmapRepeatOffsetPropertyHandler::exportXML(
+ OUString& rStrExpValue,
+ const Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ OUStringBuffer aOut;
+
+ sal_Int32 nValue = 0;
+ if( rValue >>= nValue )
+ {
+ SvXMLUnitConverter::convertPercent( aOut, nValue );
+ aOut.append( sal_Unicode( ' ' ) );
+ aOut.append( mbX ? msHorizontal : msVertical );
+ rStrExpValue = aOut.makeStringAndClear();
+
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/XMLClipPropertyHandler.cxx b/xmloff/source/style/XMLClipPropertyHandler.cxx
new file mode 100644
index 000000000000..af36556370ec
--- /dev/null
+++ b/xmloff/source/style/XMLClipPropertyHandler.cxx
@@ -0,0 +1,149 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLClipPropertyHandler.hxx"
+#include <com/sun/star/uno/Any.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/text/GraphicCrop.hpp>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmltoken.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::text;
+using namespace ::xmloff::token;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLMeasurePropHdl
+//
+
+XMLClipPropertyHandler::XMLClipPropertyHandler( sal_Bool bODF11 ) :
+ m_bODF11( bODF11 )
+{
+}
+
+XMLClipPropertyHandler::~XMLClipPropertyHandler()
+{
+ // nothing to do
+}
+
+bool XMLClipPropertyHandler::equals(
+ const Any& r1,
+ const Any& r2 ) const
+{
+ GraphicCrop aCrop1, aCrop2;
+ r1 >>= aCrop1;
+ r2 >>= aCrop2;
+
+ return aCrop1.Top == aCrop2.Top &&
+ aCrop1.Bottom == aCrop2.Bottom &&
+ aCrop1.Left == aCrop2.Left &&
+ aCrop1.Right == aCrop2.Right;
+}
+
+sal_Bool XMLClipPropertyHandler::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int32 nLen = rStrImpValue.getLength();
+ if( nLen > 6 &&
+ 0 == rStrImpValue.compareTo( GetXMLToken(XML_RECT), 4 ) &&
+ rStrImpValue[4] == '(' &&
+ rStrImpValue[nLen-1] == ')' )
+ {
+ GraphicCrop aCrop;
+ OUString sTmp( rStrImpValue.copy( 5, nLen-6 ) );
+
+ sal_Bool bHasComma = sTmp.indexOf( ',' ) != -1;
+ SvXMLTokenEnumerator aTokenEnum( sTmp, bHasComma ? ',' : ' ' );
+
+ sal_uInt16 nPos = 0;
+ OUString aToken;
+ while( aTokenEnum.getNextToken( aToken ) )
+ {
+ sal_Int32 nVal = 0;
+ if( !IsXMLToken(aToken, XML_AUTO) &&
+ !rUnitConverter.convertMeasure( nVal, aToken ) )
+ break;
+
+ switch( nPos )
+ {
+ case 0: aCrop.Top = nVal; break;
+ case 1: aCrop.Right = nVal; break;
+ case 2: aCrop.Bottom = nVal; break;
+ case 3: aCrop.Left = nVal; break;
+ }
+ nPos++;
+ }
+
+ bRet = (4 == nPos );
+ if( bRet )
+ rValue <<= aCrop;
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLClipPropertyHandler::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ OUStringBuffer aOut(30);
+ GraphicCrop aCrop;
+
+ if( rValue >>= aCrop )
+ {
+ aOut.append( GetXMLToken(XML_RECT) );
+ aOut.append( (sal_Unicode)'(' );
+ rUnitConverter.convertMeasure( aOut, aCrop.Top );
+ if( !m_bODF11 )
+ aOut.append( (sal_Unicode)',' );
+ aOut.append( (sal_Unicode)' ' );
+ rUnitConverter.convertMeasure( aOut, aCrop.Right );
+ if( !m_bODF11 )
+ aOut.append( (sal_Unicode)',' );
+ aOut.append( (sal_Unicode)' ' );
+ rUnitConverter.convertMeasure( aOut, aCrop.Bottom );
+ if( !m_bODF11 )
+ aOut.append( (sal_Unicode)',' );
+ aOut.append( (sal_Unicode)' ' );
+ rUnitConverter.convertMeasure( aOut, aCrop.Left );
+ aOut.append( (sal_Unicode)')' );
+ rStrExpValue = aOut.makeStringAndClear();
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/XMLConstantsPropertyHandler.cxx b/xmloff/source/style/XMLConstantsPropertyHandler.cxx
new file mode 100644
index 000000000000..55c62fc8d810
--- /dev/null
+++ b/xmloff/source/style/XMLConstantsPropertyHandler.cxx
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <xmloff/XMLConstantsPropertyHandler.hxx>
+
+using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using ::xmloff::token::XMLTokenEnum;
+
+XMLConstantsPropertyHandler::XMLConstantsPropertyHandler(
+ const SvXMLEnumMapEntry *pM,
+ enum XMLTokenEnum eDflt ) :
+ pMap( pM ),
+ eDefault( eDflt )
+{
+}
+
+XMLConstantsPropertyHandler::~XMLConstantsPropertyHandler()
+{
+}
+
+sal_Bool XMLConstantsPropertyHandler::importXML(
+ const OUString& rStrImpValue,
+ Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ sal_uInt16 nEnum;
+ sal_Bool bRet = SvXMLUnitConverter::convertEnum(
+ nEnum, rStrImpValue, pMap );
+
+ if( bRet )
+ rValue <<= (sal_Int16)nEnum;
+
+ return bRet;
+}
+
+sal_Bool XMLConstantsPropertyHandler::exportXML(
+ OUString& rStrExpValue,
+ const Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ OUStringBuffer aOut;
+
+ sal_Bool bRet = false;
+
+ sal_Int32 nEnum = 0;
+
+ if( rValue.hasValue() && (rValue.getValueTypeClass() == TypeClass_ENUM))
+ {
+ nEnum = *((sal_Int32*)rValue.getValue());
+ bRet = true;
+ }
+ else
+ {
+ bRet = (rValue >>= nEnum );
+ }
+
+ if( bRet )
+ {
+ if( (nEnum >= 0) && (nEnum <= 0xffff) )
+ {
+ sal_uInt16 nConst = static_cast<sal_uInt16>( nEnum );
+
+ bRet = SvXMLUnitConverter::convertEnum(
+ aOut, nConst, pMap, eDefault );
+
+ rStrExpValue = aOut.makeStringAndClear();
+ }
+ else
+ {
+ OSL_FAIL("XMLConstantsPropertyHandler::exportXML() constant is out of range for implementation using sal_uInt16");
+ }
+ }
+ else
+ {
+ OSL_FAIL("XMLConstantsPropertyHandler::exportXML() could not convert any to sal_Int32");
+ }
+
+ return bRet;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/XMLElementPropertyContext.cxx b/xmloff/source/style/XMLElementPropertyContext.cxx
new file mode 100644
index 000000000000..1a9bf554a8e5
--- /dev/null
+++ b/xmloff/source/style/XMLElementPropertyContext.cxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+#include "XMLElementPropertyContext.hxx"
+
+using ::rtl::OUString;
+
+TYPEINIT1( XMLElementPropertyContext , SvXMLImportContext );
+
+XMLElementPropertyContext::XMLElementPropertyContext (
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const XMLPropertyState& rProp,
+ ::std::vector< XMLPropertyState > &rProps ) :
+ SvXMLImportContext( rImport, nPrfx, rLName ),
+ bInsert( sal_False ),
+ rProperties( rProps ),
+ aProp( rProp )
+{
+}
+
+XMLElementPropertyContext::~XMLElementPropertyContext()
+{
+}
+
+void XMLElementPropertyContext::EndElement( )
+{
+ if( bInsert )
+ rProperties.push_back( aProp );
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/XMLFillBitmapSizePropertyHandler.cxx b/xmloff/source/style/XMLFillBitmapSizePropertyHandler.cxx
new file mode 100644
index 000000000000..ac23035e9683
--- /dev/null
+++ b/xmloff/source/style/XMLFillBitmapSizePropertyHandler.cxx
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/uno/Any.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <rtl/ustrbuf.hxx>
+#include "XMLFillBitmapSizePropertyHandler.hxx"
+#include <comphelper/extract.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+
+XMLFillBitmapSizePropertyHandler::XMLFillBitmapSizePropertyHandler()
+{
+}
+
+XMLFillBitmapSizePropertyHandler::~XMLFillBitmapSizePropertyHandler()
+{
+}
+
+sal_Bool XMLFillBitmapSizePropertyHandler::importXML(
+ const OUString& rStrImpValue,
+ Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Int32 nValue;
+ sal_Bool bRet;
+
+ if( rStrImpValue.indexOf( sal_Unicode('%') ) != -1 )
+ {
+ bRet = rUnitConverter.convertPercent( nValue, rStrImpValue );
+ nValue *= -1;
+ }
+ else
+ {
+ bRet = rUnitConverter.convertMeasure( nValue, rStrImpValue );
+ }
+
+ if( bRet )
+ rValue <<= nValue;
+
+ return bRet;
+}
+
+sal_Bool XMLFillBitmapSizePropertyHandler::exportXML(
+ OUString& rStrExpValue,
+ const Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const
+{
+ OUStringBuffer aOut;
+
+ sal_Int32 nValue = 0;
+ if( rValue >>= nValue )
+ {
+ if( nValue < 0 )
+ {
+ rUnitConverter.convertPercent( aOut, -nValue );
+ }
+ else
+ {
+ rUnitConverter.convertMeasure( aOut, nValue );
+ }
+
+ rStrExpValue = aOut.makeStringAndClear();
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/XMLFontAutoStylePool.cxx b/xmloff/source/style/XMLFontAutoStylePool.cxx
new file mode 100644
index 000000000000..fb749e6f4edc
--- /dev/null
+++ b/xmloff/source/style/XMLFontAutoStylePool.cxx
@@ -0,0 +1,294 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#include <svl/cntnrsrt.hxx>
+#include <tools/fontenum.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "fonthdl.hxx"
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/XMLFontAutoStylePool.hxx>
+
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star::uno;
+using namespace ::xmloff::token;
+
+int XMLFontAutoStylePoolNameCmp_Impl( const OUString& r1,
+ const OUString& r2 )
+{
+ return (int)r1.compareTo( r2 );
+}
+
+DECLARE_CONTAINER_SORT_DEL( XMLFontAutoStylePoolNames_Impl,
+ OUString )
+IMPL_CONTAINER_SORT( XMLFontAutoStylePoolNames_Impl,
+ OUString,
+ XMLFontAutoStylePoolNameCmp_Impl )
+
+class XMLFontAutoStylePoolEntry_Impl
+{
+ OUString sName;
+ OUString sFamilyName;
+ OUString sStyleName;
+ sal_Int16 nFamily;
+ sal_Int16 nPitch;
+ rtl_TextEncoding eEnc;
+
+public:
+
+ inline XMLFontAutoStylePoolEntry_Impl(
+ const ::rtl::OUString& rName,
+ const ::rtl::OUString& rFamilyName,
+ const ::rtl::OUString& rStyleName,
+ sal_Int16 nFamily,
+ sal_Int16 nPitch,
+ rtl_TextEncoding eEnc );
+
+ inline XMLFontAutoStylePoolEntry_Impl(
+ const ::rtl::OUString& rFamilyName,
+ const ::rtl::OUString& rStyleName,
+ sal_Int16 nFamily,
+ sal_Int16 nPitch,
+ rtl_TextEncoding eEnc );
+
+ const OUString& GetName() const { return sName; }
+ const OUString& GetFamilyName() const { return sFamilyName; }
+ const OUString& GetStyleName() const { return sStyleName; }
+ sal_Int16 GetFamily() const { return nFamily; }
+ sal_Int16 GetPitch() const { return nPitch; }
+ rtl_TextEncoding GetEncoding() const { return eEnc; }
+};
+
+
+inline XMLFontAutoStylePoolEntry_Impl::XMLFontAutoStylePoolEntry_Impl(
+ const ::rtl::OUString& rName,
+ const ::rtl::OUString& rFamilyName,
+ const ::rtl::OUString& rStyleName,
+ sal_Int16 nFam,
+ sal_Int16 nP,
+ rtl_TextEncoding eE ) :
+ sName( rName ),
+ sFamilyName( rFamilyName ),
+ sStyleName( rStyleName ),
+ nFamily( nFam ),
+ nPitch( nP ),
+ eEnc( eE )
+{
+}
+
+inline XMLFontAutoStylePoolEntry_Impl::XMLFontAutoStylePoolEntry_Impl(
+ const ::rtl::OUString& rFamilyName,
+ const ::rtl::OUString& rStyleName,
+ sal_Int16 nFam,
+ sal_Int16 nP,
+ rtl_TextEncoding eE ) :
+ sFamilyName( rFamilyName ),
+ sStyleName( rStyleName ),
+ nFamily( nFam ),
+ nPitch( nP ),
+ eEnc( eE )
+{
+}
+int XMLFontAutoStylePoolEntryCmp_Impl(
+ const XMLFontAutoStylePoolEntry_Impl& r1,
+ const XMLFontAutoStylePoolEntry_Impl& r2 )
+{
+ sal_Int8 nEnc1(r1.GetEncoding() != RTL_TEXTENCODING_SYMBOL);
+ sal_Int8 nEnc2(r2.GetEncoding() != RTL_TEXTENCODING_SYMBOL);
+ if( nEnc1 != nEnc2 )
+ return nEnc1 - nEnc2;
+ else if( r1.GetPitch() != r2.GetPitch() )
+ return (int)r1.GetPitch() - (int)r2.GetPitch();
+ else if( r1.GetFamily() != r2.GetFamily() )
+ return (int)r1.GetFamily() - (int)r2.GetFamily();
+ else
+ {
+ sal_Int32 nCmp = r1.GetFamilyName().compareTo( r2.GetFamilyName() );
+ if( 0 == nCmp )
+ return (int)r1.GetStyleName().compareTo( r2.GetStyleName() );
+ else
+ return (int)nCmp;
+ }
+}
+
+typedef XMLFontAutoStylePoolEntry_Impl *XMLFontAutoStylePoolEntryPtr;
+DECLARE_CONTAINER_SORT_DEL( XMLFontAutoStylePool_Impl,
+ XMLFontAutoStylePoolEntry_Impl )
+IMPL_CONTAINER_SORT( XMLFontAutoStylePool_Impl,
+ XMLFontAutoStylePoolEntry_Impl,
+ XMLFontAutoStylePoolEntryCmp_Impl )
+
+XMLFontAutoStylePool::XMLFontAutoStylePool( SvXMLExport& rExp ) :
+ rExport( rExp ),
+ pPool( new XMLFontAutoStylePool_Impl( 5, 5 ) ),
+ pNames( new XMLFontAutoStylePoolNames_Impl( 5, 5 ) )
+{
+}
+
+XMLFontAutoStylePool::~XMLFontAutoStylePool()
+{
+ delete pPool;
+ delete pNames;
+}
+
+OUString XMLFontAutoStylePool::Add(
+ const OUString& rFamilyName,
+ const OUString& rStyleName,
+ sal_Int16 nFamily,
+ sal_Int16 nPitch,
+ rtl_TextEncoding eEnc )
+{
+ OUString sPoolName;
+ XMLFontAutoStylePoolEntry_Impl aTmp( rFamilyName, rStyleName, nFamily,
+ nPitch, eEnc );
+ sal_uLong nPos;
+ if( pPool->Seek_Entry( &aTmp, &nPos ) )
+ {
+ sPoolName = pPool->GetObject( nPos )->GetName();
+ }
+ else
+ {
+ OUString sName;
+ sal_Int32 nLen = rFamilyName.indexOf( sal_Unicode(';'), 0 );
+ if( -1 == nLen )
+ {
+ sName = rFamilyName;
+ }
+ else if( nLen > 0 )
+ {
+ sName = rFamilyName.copy( 0, nLen );
+ sName.trim();
+ }
+
+ if( !sName.getLength() )
+ sName = OUString::valueOf( sal_Unicode( 'F' ) );
+
+ if( pNames->Seek_Entry( &sName, 0 ) )
+ {
+ sal_Int32 nCount = 1;
+ OUString sPrefix( sName );
+ sName += OUString::valueOf( nCount );
+ while( pNames->Seek_Entry( &sName, 0 ) )
+ {
+ sName = sPrefix;
+ sName += OUString::valueOf( ++nCount );
+ }
+ }
+
+ XMLFontAutoStylePoolEntry_Impl *pEntry =
+ new XMLFontAutoStylePoolEntry_Impl( sName, rFamilyName, rStyleName,
+ nFamily, nPitch, eEnc );
+ pPool->Insert( pEntry );
+ pNames->Insert( new OUString( sName ) );
+ }
+
+ return sPoolName;
+}
+
+::rtl::OUString XMLFontAutoStylePool::Find(
+ const OUString& rFamilyName,
+ const OUString& rStyleName,
+ sal_Int16 nFamily,
+ sal_Int16 nPitch,
+ rtl_TextEncoding eEnc ) const
+{
+ OUString sName;
+ XMLFontAutoStylePoolEntry_Impl aTmp( rFamilyName, rStyleName, nFamily,
+ nPitch, eEnc );
+ sal_uLong nPos;
+ if( pPool->Seek_Entry( &aTmp, &nPos ) )
+ {
+ sName = pPool->GetObject( nPos )->GetName();
+ }
+
+ return sName;
+}
+
+
+void XMLFontAutoStylePool::exportXML()
+{
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_OFFICE,
+ XML_FONT_FACE_DECLS,
+ sal_True, sal_True );
+ Any aAny;
+ OUString sTmp;
+ XMLFontFamilyNamePropHdl aFamilyNameHdl;
+ XMLFontFamilyPropHdl aFamilyHdl;
+ XMLFontPitchPropHdl aPitchHdl;
+ XMLFontEncodingPropHdl aEncHdl;
+ const SvXMLUnitConverter& rUnitConv = GetExport().GetMM100UnitConverter();
+
+ sal_uInt32 nCount = pPool->Count();
+ for( sal_uInt32 i=0; i<nCount; i++ )
+ {
+ const XMLFontAutoStylePoolEntry_Impl *pEntry = pPool->GetObject( i );
+
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE,
+ XML_NAME, pEntry->GetName() );
+
+ aAny <<= pEntry->GetFamilyName();
+ if( aFamilyNameHdl.exportXML( sTmp, aAny, rUnitConv ) )
+ GetExport().AddAttribute( XML_NAMESPACE_SVG,
+ XML_FONT_FAMILY, sTmp );
+
+ const OUString& rStyleName = pEntry->GetStyleName();
+ if( rStyleName.getLength() )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE,
+ XML_FONT_ADORNMENTS,
+ rStyleName );
+
+ aAny <<= (sal_Int16)pEntry->GetFamily();
+ if( aFamilyHdl.exportXML( sTmp, aAny, rUnitConv ) )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE,
+ XML_FONT_FAMILY_GENERIC, sTmp );
+
+ aAny <<= (sal_Int16)pEntry->GetPitch();
+ if( aPitchHdl.exportXML( sTmp, aAny, rUnitConv ) )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE,
+ XML_FONT_PITCH, sTmp );
+
+ aAny <<= (sal_Int16)pEntry->GetEncoding();
+ if( aEncHdl.exportXML( sTmp, aAny, rUnitConv ) )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE,
+ XML_FONT_CHARSET, sTmp );
+
+ SvXMLElementExport aElement( GetExport(), XML_NAMESPACE_STYLE,
+ XML_FONT_FACE,
+ sal_True, sal_True );
+ }
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/XMLFontStylesContext.cxx b/xmloff/source/style/XMLFontStylesContext.cxx
new file mode 100644
index 000000000000..d4823ccf03ee
--- /dev/null
+++ b/xmloff/source/style/XMLFontStylesContext.cxx
@@ -0,0 +1,288 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <com/sun/star/awt/FontFamily.hpp>
+#include <com/sun/star/awt/FontPitch.hpp>
+
+#include <rtl/logfile.hxx>
+
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include "fonthdl.hxx"
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/maptype.hxx>
+#include <xmloff/XMLFontStylesContext.hxx>
+
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::awt;
+using namespace ::xmloff::token;
+
+
+#define XML_STYLE_FAMILY_FONT 1
+
+enum XMLFontStyleAttrTokens
+{
+ XML_TOK_FONT_STYLE_ATTR_FAMILY,
+ XML_TOK_FONT_STYLE_ATTR_FAMILY_GENERIC,
+ XML_TOK_FONT_STYLE_ATTR_STYLENAME,
+ XML_TOK_FONT_STYLE_ATTR_PITCH,
+ XML_TOK_FONT_STYLE_ATTR_CHARSET,
+
+ XML_TOK_FONT_STYLE_ATTR_END=XML_TOK_UNKNOWN
+};
+
+const SvXMLTokenMapEntry* lcl_getFontStyleAttrTokenMap()
+{
+ static SvXMLTokenMapEntry aFontStyleAttrTokenMap[] =
+ {
+ { XML_NAMESPACE_SVG, XML_FONT_FAMILY,
+ XML_TOK_FONT_STYLE_ATTR_FAMILY },
+ { XML_NAMESPACE_STYLE, XML_FONT_FAMILY_GENERIC,
+ XML_TOK_FONT_STYLE_ATTR_FAMILY_GENERIC },
+ { XML_NAMESPACE_STYLE, XML_FONT_ADORNMENTS,
+ XML_TOK_FONT_STYLE_ATTR_STYLENAME },
+ { XML_NAMESPACE_STYLE, XML_FONT_PITCH,
+ XML_TOK_FONT_STYLE_ATTR_PITCH },
+ { XML_NAMESPACE_STYLE, XML_FONT_CHARSET,
+ XML_TOK_FONT_STYLE_ATTR_CHARSET },
+
+ XML_TOKEN_MAP_END
+ };
+ return aFontStyleAttrTokenMap;
+}
+
+class XMLFontStyleContext_Impl : public SvXMLStyleContext
+{
+ Any aFamilyName;
+ Any aStyleName;
+ Any aFamily;
+ Any aPitch;
+ Any aEnc;
+
+ SvXMLImportContextRef xStyles;
+
+ XMLFontStylesContext *GetStyles()
+ {
+ return ((XMLFontStylesContext *)&xStyles);
+ }
+
+public:
+
+ TYPEINFO();
+
+ XMLFontStyleContext_Impl( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
+ XMLFontStylesContext& rStyles );
+ virtual ~XMLFontStyleContext_Impl();
+
+ void SetAttribute( sal_uInt16 nPrefixKey, const OUString& rLocalName,
+ const OUString& rValue );
+
+ void FillProperties( ::std::vector< XMLPropertyState > &rProps,
+ sal_Int32 nFamilyNameIdx,
+ sal_Int32 nStyleNameIdx,
+ sal_Int32 nFamilyIdx,
+ sal_Int32 nPitchIdx,
+ sal_Int32 nCharsetIdx ) const;
+
+};
+
+TYPEINIT1( XMLFontStyleContext_Impl, SvXMLStyleContext );
+
+XMLFontStyleContext_Impl::XMLFontStyleContext_Impl( SvXMLImport& rImport,
+ sal_uInt16 nPrfx, const OUString& rLName,
+ const Reference< XAttributeList > & xAttrList,
+ XMLFontStylesContext& rStyles ) :
+ SvXMLStyleContext( rImport, nPrfx, rLName, xAttrList, XML_STYLE_FAMILY_FONT ),
+ xStyles( &rStyles )
+{
+ OUString sEmpty;
+ aFamilyName <<= sEmpty;
+ aStyleName <<= sEmpty;
+ aFamily <<= (sal_Int16)FontFamily::DONTKNOW;
+ aPitch <<= (sal_Int16)FontPitch::DONTKNOW;
+ aEnc <<= (sal_Int16)rStyles.GetDfltCharset();
+}
+
+void XMLFontStyleContext_Impl::SetAttribute( sal_uInt16 nPrefixKey,
+ const OUString& rLocalName,
+ const OUString& rValue )
+{
+ SvXMLUnitConverter& rUnitConv = GetImport().GetMM100UnitConverter();
+ const SvXMLTokenMap& rTokenMap = GetStyles()->GetFontStyleAttrTokenMap();
+ Any aAny;
+
+ switch( rTokenMap.Get( nPrefixKey, rLocalName ) )
+ {
+ case XML_TOK_FONT_STYLE_ATTR_FAMILY:
+ if( GetStyles()->GetFamilyNameHdl().importXML( rValue, aAny,
+ rUnitConv ) )
+ aFamilyName = aAny;
+ break;
+ case XML_TOK_FONT_STYLE_ATTR_STYLENAME:
+ aStyleName <<= rValue;
+ break;
+ case XML_TOK_FONT_STYLE_ATTR_FAMILY_GENERIC:
+ if( GetStyles()->GetFamilyHdl().importXML( rValue, aAny,
+ rUnitConv ) )
+ aFamily = aAny;
+ break;
+ case XML_TOK_FONT_STYLE_ATTR_PITCH:
+ if( GetStyles()->GetPitchHdl().importXML( rValue, aAny,
+ rUnitConv ) )
+ aPitch = aAny;
+ break;
+ case XML_TOK_FONT_STYLE_ATTR_CHARSET:
+ if( GetStyles()->GetEncodingHdl().importXML( rValue, aAny,
+ rUnitConv ) )
+ aEnc = aAny;
+ break;
+ default:
+ SvXMLStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
+ break;
+ }
+}
+
+XMLFontStyleContext_Impl::~XMLFontStyleContext_Impl()
+{
+}
+
+void XMLFontStyleContext_Impl::FillProperties(
+ ::std::vector< XMLPropertyState > &rProps,
+ sal_Int32 nFamilyNameIdx,
+ sal_Int32 nStyleNameIdx,
+ sal_Int32 nFamilyIdx,
+ sal_Int32 nPitchIdx,
+ sal_Int32 nCharsetIdx ) const
+{
+ if( nFamilyNameIdx != -1 )
+ {
+ XMLPropertyState aPropState( nFamilyNameIdx, aFamilyName );
+ rProps.push_back( aPropState );
+ }
+ if( nStyleNameIdx != -1 )
+ {
+ XMLPropertyState aPropState( nStyleNameIdx, aStyleName );
+ rProps.push_back( aPropState );
+ }
+ if( nFamilyIdx != -1 )
+ {
+ XMLPropertyState aPropState( nFamilyIdx, aFamily );
+ rProps.push_back( aPropState );
+ }
+ if( nPitchIdx != -1 )
+ {
+ XMLPropertyState aPropState( nPitchIdx, aPitch );
+ rProps.push_back( aPropState );
+ }
+ if( nCharsetIdx != -1 )
+ {
+ XMLPropertyState aPropState( nCharsetIdx, aEnc );
+ rProps.push_back( aPropState );
+ }
+}
+
+SvXMLStyleContext *XMLFontStylesContext::CreateStyleChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList )
+{
+ SvXMLStyleContext *pStyle;
+ if( XML_NAMESPACE_STYLE == nPrefix &&
+ IsXMLToken( rLocalName, XML_FONT_FACE ) )
+ {
+ pStyle = new XMLFontStyleContext_Impl( GetImport(), nPrefix,
+ rLocalName, xAttrList, *this );
+ }
+ else
+ {
+ pStyle = SvXMLStylesContext::CreateStyleChildContext( nPrefix,
+ rLocalName, xAttrList );
+ }
+
+ return pStyle;
+}
+
+TYPEINIT1( XMLFontStylesContext, SvXMLStylesContext );
+
+XMLFontStylesContext::XMLFontStylesContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx, const OUString& rLName,
+ const Reference< XAttributeList > & xAttrList,
+ rtl_TextEncoding eDfltEnc ) :
+ SvXMLStylesContext( rImport, nPrfx, rLName, xAttrList ),
+ pFamilyNameHdl( new XMLFontFamilyNamePropHdl ),
+ pFamilyHdl( new XMLFontFamilyPropHdl ),
+ pPitchHdl( new XMLFontPitchPropHdl ),
+ pEncHdl( new XMLFontEncodingPropHdl ),
+ pFontStyleAttrTokenMap( new SvXMLTokenMap(lcl_getFontStyleAttrTokenMap()) ),
+ eDfltEncoding( eDfltEnc )
+{
+}
+
+XMLFontStylesContext::~XMLFontStylesContext()
+{
+ delete pFamilyNameHdl;
+ delete pFamilyHdl;
+ delete pPitchHdl;
+ delete pEncHdl;
+ delete pFontStyleAttrTokenMap;
+}
+
+sal_Bool XMLFontStylesContext::FillProperties( const OUString& rName,
+ ::std::vector< XMLPropertyState > &rProps,
+ sal_Int32 nFamilyNameIdx,
+ sal_Int32 nStyleNameIdx,
+ sal_Int32 nFamilyIdx,
+ sal_Int32 nPitchIdx,
+ sal_Int32 nCharsetIdx ) const
+{
+ const SvXMLStyleContext* pStyle = FindStyleChildContext( XML_STYLE_FAMILY_FONT, rName, sal_True );
+ const XMLFontStyleContext_Impl *pFontStyle = PTR_CAST( XMLFontStyleContext_Impl,pStyle);// use temp var, PTR_CAST is a bad macro, FindStyleChildContext will be called twice
+ if( pFontStyle )
+ pFontStyle->FillProperties( rProps, nFamilyNameIdx, nStyleNameIdx,
+ nFamilyIdx, nPitchIdx, nCharsetIdx );
+ return 0 != pFontStyle;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/XMLFootnoteSeparatorExport.cxx b/xmloff/source/style/XMLFootnoteSeparatorExport.cxx
new file mode 100644
index 000000000000..a7f5e0c1bf3a
--- /dev/null
+++ b/xmloff/source/style/XMLFootnoteSeparatorExport.cxx
@@ -0,0 +1,190 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLFootnoteSeparatorExport.hxx"
+#include <tools/debug.hxx>
+#include <xmloff/xmlexp.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlprmap.hxx>
+
+#include <xmloff/PageMasterStyleMap.hxx>
+#include <com/sun/star/text/HorizontalAdjust.hpp>
+#include <rtl/ustrbuf.hxx>
+
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+using ::rtl::OUStringBuffer;
+using ::std::vector;
+
+XMLFootnoteSeparatorExport::XMLFootnoteSeparatorExport(SvXMLExport& rExp) :
+ rExport(rExp)
+{
+}
+
+XMLFootnoteSeparatorExport::~XMLFootnoteSeparatorExport()
+{
+}
+
+
+void XMLFootnoteSeparatorExport::exportXML(
+ const vector<XMLPropertyState> * pProperties,
+ sal_uInt32
+ #ifdef DBG_UTIL
+ nIdx
+ #endif
+ ,
+ const UniReference<XMLPropertySetMapper> & rMapper)
+{
+ DBG_ASSERT(NULL != pProperties, "Need property states");
+
+ // intialize values
+ sal_Int16 eLineAdjust = text::HorizontalAdjust_LEFT;
+ sal_Int32 nLineColor = 0;
+ sal_Int32 nLineDistance = 0;
+ sal_Int8 nLineRelWidth = 0;
+ sal_Int32 nLineTextDistance = 0;
+ sal_Int16 nLineWeight = 0;
+ sal_Int8 nLineStyle = 0;
+
+ // find indices into property map and get values
+ sal_uInt32 nCount = pProperties->size();
+ for(sal_uInt32 i = 0; i < nCount; i++)
+ {
+ const XMLPropertyState& rState = (*pProperties)[i];
+
+ if( rState.mnIndex == -1 )
+ continue;
+
+ switch (rMapper->GetEntryContextId(rState.mnIndex))
+ {
+ case CTF_PM_FTN_LINE_ADJUST:
+ rState.maValue >>= eLineAdjust;
+ break;
+ case CTF_PM_FTN_LINE_COLOR:
+ rState.maValue >>= nLineColor;
+ break;
+ case CTF_PM_FTN_DISTANCE:
+ rState.maValue >>= nLineDistance;
+ break;
+ case CTF_PM_FTN_LINE_WIDTH:
+ rState.maValue >>= nLineRelWidth;
+ break;
+ case CTF_PM_FTN_LINE_DISTANCE:
+ rState.maValue >>= nLineTextDistance;
+ break;
+ case CTF_PM_FTN_LINE_WEIGTH:
+ DBG_ASSERT( i == nIdx,
+ "received wrong property state index" );
+ rState.maValue >>= nLineWeight;
+ break;
+ case CTF_PM_FTN_LINE_STYLE:
+ rState.maValue >>= nLineStyle;
+ break;
+ }
+ }
+
+ OUStringBuffer sBuf;
+
+ // weight/width
+ if (nLineWeight > 0)
+ {
+ rExport.GetMM100UnitConverter().convertMeasure(sBuf, nLineWeight);
+ rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_WIDTH,
+ sBuf.makeStringAndClear());
+ }
+
+ // line text distance
+ if (nLineTextDistance > 0)
+ {
+ rExport.GetMM100UnitConverter().convertMeasure(sBuf,nLineTextDistance);
+ rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_DISTANCE_BEFORE_SEP,
+ sBuf.makeStringAndClear());
+ }
+
+ // line distance
+ if (nLineDistance > 0)
+ {
+ rExport.GetMM100UnitConverter().convertMeasure(sBuf, nLineDistance);
+ rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_DISTANCE_AFTER_SEP,
+ sBuf.makeStringAndClear());
+ }
+
+ // line style
+ static const SvXMLEnumMapEntry aXML_LineStyle_Enum[] =
+ {
+ { XML_NONE, 0 },
+ { XML_SOLID, 1 },
+ { XML_DOTTED, 2 },
+ { XML_DASH, 3 },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ if (rExport.GetMM100UnitConverter().convertEnum(
+ sBuf, nLineStyle, aXML_LineStyle_Enum ) )
+ {
+ rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_LINE_STYLE,
+ sBuf.makeStringAndClear());
+ }
+
+ // adjustment
+ static const SvXMLEnumMapEntry aXML_HorizontalAdjust_Enum[] =
+ {
+ { XML_LEFT, text::HorizontalAdjust_LEFT },
+ { XML_CENTER, text::HorizontalAdjust_CENTER },
+ { XML_RIGHT, text::HorizontalAdjust_RIGHT },
+ { XML_TOKEN_INVALID, 0 }
+ };
+
+ if (rExport.GetMM100UnitConverter().convertEnum(
+ sBuf, eLineAdjust, aXML_HorizontalAdjust_Enum))
+ {
+ rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_ADJUSTMENT,
+ sBuf.makeStringAndClear());
+ }
+
+ // relative line width
+ SvXMLUnitConverter::convertPercent(sBuf, nLineRelWidth);
+ rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_REL_WIDTH,
+ sBuf.makeStringAndClear());
+
+ // color
+ rExport.GetMM100UnitConverter().convertColor(sBuf, nLineColor);
+ rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_COLOR,
+ sBuf.makeStringAndClear());
+
+ // line-style
+
+ SvXMLElementExport aElem(rExport, XML_NAMESPACE_STYLE,
+ XML_FOOTNOTE_SEP, sal_True, sal_True);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/XMLFootnoteSeparatorExport.hxx b/xmloff/source/style/XMLFootnoteSeparatorExport.hxx
new file mode 100644
index 000000000000..6d268e16e40f
--- /dev/null
+++ b/xmloff/source/style/XMLFootnoteSeparatorExport.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLFOOTNOTESEPARATOREXPORT_HXX
+#define _XMLOFF_XMLFOOTNOTESEPARATOREXPORT_HXX
+
+#include <sal/types.h>
+
+class SvXMLExport;
+class XMLPropertySetMapper;
+struct XMLPropertyState;
+template<class X> class UniReference;
+
+
+#include <vector>
+
+
+/**
+ * export footnote separator element in page styles
+ */
+class XMLFootnoteSeparatorExport
+{
+ SvXMLExport& rExport;
+
+public:
+
+ XMLFootnoteSeparatorExport(SvXMLExport& rExp);
+
+ ~XMLFootnoteSeparatorExport();
+
+ void exportXML(
+ const ::std::vector<XMLPropertyState> * pProperties,
+ sal_uInt32 nIdx,
+ /// used only for debugging
+ const UniReference<XMLPropertySetMapper> & rMapper);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/XMLFootnoteSeparatorImport.cxx b/xmloff/source/style/XMLFootnoteSeparatorImport.cxx
new file mode 100644
index 000000000000..4c579c78bed5
--- /dev/null
+++ b/xmloff/source/style/XMLFootnoteSeparatorImport.cxx
@@ -0,0 +1,217 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLFootnoteSeparatorImport.hxx"
+
+#ifndef _RTL_USTRING
+#include <rtl/ustring.hxx>
+#endif
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/text/HorizontalAdjust.hpp>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmlprmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/maptype.hxx>
+
+#include <xmloff/PageMasterStyleMap.hxx>
+#include <tools/debug.hxx>
+#include <tools/color.hxx>
+
+#include <vector>
+
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+using ::rtl::OUString;
+using ::std::vector;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::xml::sax::XAttributeList;
+
+
+TYPEINIT1(XMLFootnoteSeparatorImport, SvXMLImportContext);
+
+
+XMLFootnoteSeparatorImport::XMLFootnoteSeparatorImport(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ vector<XMLPropertyState> & rProps,
+ const UniReference<XMLPropertySetMapper> & rMapperRef,
+ sal_Int32 nIndex) :
+ SvXMLImportContext(rImport, nPrefix, rLocalName),
+ rProperties(rProps),
+ rMapper(rMapperRef),
+ nPropIndex(nIndex)
+{
+}
+
+XMLFootnoteSeparatorImport::~XMLFootnoteSeparatorImport()
+{
+}
+
+void XMLFootnoteSeparatorImport::StartElement(
+ const Reference<XAttributeList> & xAttrList)
+{
+ // get the values from the properties
+ sal_Int16 nLineWeight = 0;
+ sal_Int32 nLineColor = 0;
+ sal_Int8 nLineRelWidth = 0;
+ sal_Int16 eLineAdjust = text::HorizontalAdjust_LEFT; // enum text::HorizontalAdjust
+ sal_Int32 nLineTextDistance = 0;
+ sal_Int32 nLineDistance = 0;
+ sal_Int8 nLineStyle = 0;
+
+ // iterate over xattribute list and fill values
+ sal_Int16 nLength = xAttrList->getLength();
+ for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++)
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
+ &sLocalName );
+
+ if (XML_NAMESPACE_STYLE == nPrefix)
+ {
+ OUString sAttrValue = xAttrList->getValueByIndex(nAttr);
+ sal_Int32 nTmp;
+ if (IsXMLToken( sLocalName, XML_WIDTH ))
+ {
+ if (GetImport().GetMM100UnitConverter().convertMeasure(
+ nTmp, sAttrValue))
+ {
+ nLineWeight = (sal_Int16)nTmp;
+ }
+ }
+ else if (IsXMLToken( sLocalName, XML_DISTANCE_BEFORE_SEP ))
+ {
+ if (GetImport().GetMM100UnitConverter().convertMeasure(
+ nTmp, sAttrValue))
+ nLineTextDistance = nTmp;
+ }
+ else if (IsXMLToken( sLocalName, XML_DISTANCE_AFTER_SEP ))
+ {
+ if (GetImport().GetMM100UnitConverter().convertMeasure(
+ nTmp, sAttrValue))
+ nLineDistance = nTmp;
+ }
+ else if (IsXMLToken( sLocalName, XML_ADJUSTMENT ))
+ {
+ sal_uInt16 nTmpU;
+ static const SvXMLEnumMapEntry aXML_HorizontalAdjust_Enum[] =
+ {
+ { XML_LEFT, text::HorizontalAdjust_LEFT },
+ { XML_CENTER, text::HorizontalAdjust_CENTER },
+ { XML_RIGHT, text::HorizontalAdjust_RIGHT },
+ { XML_TOKEN_INVALID, 0 }
+ };
+
+ if (SvXMLUnitConverter::convertEnum(
+ nTmpU, sAttrValue, aXML_HorizontalAdjust_Enum))
+ eLineAdjust = (sal_Int16)nTmpU;
+ }
+ else if (IsXMLToken( sLocalName, XML_REL_WIDTH ))
+ {
+ if (SvXMLUnitConverter::convertPercent(nTmp, sAttrValue))
+ nLineRelWidth = (sal_uInt8)nTmp;
+ }
+ else if (IsXMLToken( sLocalName, XML_COLOR ))
+ {
+ Color aColor;
+ if (SvXMLUnitConverter::convertColor(aColor, sAttrValue))
+ nLineColor = (sal_Int32)aColor.GetColor();
+ }
+ else if (IsXMLToken( sLocalName, XML_LINE_STYLE ))
+ {
+ sal_uInt16 nTmpU;
+ static const SvXMLEnumMapEntry aXML_LineStyle_Enum[] =
+ {
+ { XML_NONE, 0 },
+ { XML_SOLID, 1 },
+ { XML_DOTTED, 2 },
+ { XML_DASH, 3 },
+ { XML_TOKEN_INVALID, 0 }
+ };
+
+ if (SvXMLUnitConverter::convertEnum(
+ nTmpU, sAttrValue, aXML_LineStyle_Enum))
+ nLineStyle = (sal_Int8)nTmpU;
+
+ }
+ }
+ }
+
+ // OK, now we have all values and can fill the XMLPropertyState vector
+ Any aAny;
+ sal_Int32 nIndex;
+
+ aAny <<= eLineAdjust;
+ nIndex = rMapper->FindEntryIndex(CTF_PM_FTN_LINE_ADJUST);
+ XMLPropertyState aLineAdjust( nIndex, aAny);
+ rProperties.push_back(aLineAdjust);
+
+ aAny <<= nLineColor;
+ nIndex = rMapper->FindEntryIndex(CTF_PM_FTN_LINE_COLOR);
+ XMLPropertyState aLineColor( nIndex, aAny );
+ rProperties.push_back(aLineColor);
+
+ aAny <<= nLineStyle;
+ nIndex = rMapper->FindEntryIndex(CTF_PM_FTN_LINE_STYLE);
+ XMLPropertyState aLineStyle( nIndex, aAny );
+ rProperties.push_back(aLineStyle);
+
+ aAny <<= nLineDistance;
+ nIndex = rMapper->FindEntryIndex(CTF_PM_FTN_DISTANCE);
+ XMLPropertyState aLineDistance( nIndex, aAny );
+ rProperties.push_back(aLineDistance);
+
+ aAny <<= nLineRelWidth;
+ nIndex = rMapper->FindEntryIndex(CTF_PM_FTN_LINE_WIDTH);
+ XMLPropertyState aLineRelWidth( nIndex, aAny);
+ rProperties.push_back(aLineRelWidth);
+
+ aAny <<= nLineTextDistance;
+ nIndex = rMapper->FindEntryIndex(CTF_PM_FTN_LINE_DISTANCE);
+ XMLPropertyState aLineTextDistance( nIndex, aAny);
+ rProperties.push_back(aLineTextDistance);
+
+ DBG_ASSERT( rMapper->FindEntryIndex(CTF_PM_FTN_LINE_WEIGTH) == nPropIndex,
+ "Received wrong property map index!" );
+ aAny <<= nLineWeight;
+ XMLPropertyState aLineWeight( nPropIndex, aAny );
+ rProperties.push_back(aLineWeight);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/XMLFootnoteSeparatorImport.hxx b/xmloff/source/style/XMLFootnoteSeparatorImport.hxx
new file mode 100644
index 000000000000..9c929c15315c
--- /dev/null
+++ b/xmloff/source/style/XMLFootnoteSeparatorImport.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLFOOTNOTESEPARATORIMPORT_HXX
+#define _XMLOFF_XMLFOOTNOTESEPARATORIMPORT_HXX
+
+
+
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/uniref.hxx>
+
+#include <vector>
+
+
+class SvXMLImport;
+struct XMLPropertyState;
+class XMLPropertySetMapper;
+namespace rtl { class OUString; }
+namespace com { namespace sun { namespace star {
+ namespace uno { template<class X> class Reference; }
+ namespace xml { namespace sax { class XAttributeList; } }
+} } }
+
+
+/**
+ * Import the footnote-separator element in page styles.
+ */
+class XMLFootnoteSeparatorImport : public SvXMLImportContext
+{
+ ::std::vector<XMLPropertyState> & rProperties;
+ UniReference<XMLPropertySetMapper> rMapper;
+ sal_Int32 nPropIndex;
+
+public:
+
+ TYPEINFO();
+
+ XMLFootnoteSeparatorImport(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ ::std::vector<XMLPropertyState> & rProperties,
+ const UniReference<XMLPropertySetMapper> & rMapperRef,
+ sal_Int32 nIndex);
+
+ ~XMLFootnoteSeparatorImport();
+
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/XMLIsPercentagePropertyHandler.cxx b/xmloff/source/style/XMLIsPercentagePropertyHandler.cxx
new file mode 100644
index 000000000000..96836b738d7c
--- /dev/null
+++ b/xmloff/source/style/XMLIsPercentagePropertyHandler.cxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <rtl/ustrbuf.hxx>
+#include "XMLIsPercentagePropertyHandler.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+
+XMLIsPercentagePropertyHandler::~XMLIsPercentagePropertyHandler()
+{
+}
+
+sal_Bool XMLIsPercentagePropertyHandler::importXML(
+ const OUString& rStrImpValue,
+ Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ rValue <<= (sal_Bool)(rStrImpValue.indexOf( sal_Unicode('%') ) != -1);
+ return sal_True;
+}
+
+sal_Bool XMLIsPercentagePropertyHandler::exportXML(
+ OUString&,
+ const Any&,
+ const SvXMLUnitConverter& ) const
+{
+ OSL_FAIL( "XMLIsPercentagePropertyHandler is not for export!" );
+ return sal_False;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/XMLPageExport.cxx b/xmloff/source/style/XMLPageExport.cxx
new file mode 100644
index 000000000000..7def49621b27
--- /dev/null
+++ b/xmloff/source/style/XMLPageExport.cxx
@@ -0,0 +1,272 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <xmloff/XMLPageExport.hxx>
+#include <tools/debug.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/container/XIndexReplace.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <xmloff/families.hxx>
+#include <xmloff/xmlexp.hxx>
+#include "PageMasterPropHdlFactory.hxx"
+#include <xmloff/PageMasterStyleMap.hxx>
+#include "PageMasterPropMapper.hxx"
+#include "PageMasterExportPropMapper.hxx"
+#include "PageMasterExportPropMapper.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+using namespace ::xmloff::token;
+
+
+//______________________________________________________________________________
+
+sal_Bool XMLPageExport::findPageMasterName( const OUString& rStyleName, OUString& rPMName ) const
+{
+ for( ::std::vector< XMLPageExportNameEntry >::const_iterator pEntry = aNameVector.begin();
+ pEntry != aNameVector.end(); pEntry++ )
+ {
+ if( pEntry->sStyleName == rStyleName )
+ {
+ rPMName = pEntry->sPageMasterName;
+ return sal_True;
+ }
+ }
+ return sal_False;
+}
+
+void XMLPageExport::collectPageMasterAutoStyle(
+ const Reference < XPropertySet > & rPropSet,
+ OUString& rPageMasterName )
+{
+ DBG_ASSERT( xPageMasterPropSetMapper.is(), "page master family/XMLPageMasterPropSetMapper not found" );
+ if( xPageMasterPropSetMapper.is() )
+ {
+ ::std::vector<XMLPropertyState> xPropStates = xPageMasterExportPropMapper->Filter( rPropSet );
+ if( !xPropStates.empty())
+ {
+ OUString sParent;
+ rPageMasterName = rExport.GetAutoStylePool()->Find( XML_STYLE_FAMILY_PAGE_MASTER, sParent, xPropStates );
+ if (!rPageMasterName.getLength())
+ rPageMasterName = rExport.GetAutoStylePool()->Add(XML_STYLE_FAMILY_PAGE_MASTER, sParent, xPropStates);
+ }
+ }
+}
+
+void XMLPageExport::exportMasterPageContent(
+ const Reference < XPropertySet > &,
+ sal_Bool /*bAutoStyles*/ )
+{
+
+}
+
+sal_Bool XMLPageExport::exportStyle(
+ const Reference< XStyle >& rStyle,
+ sal_Bool bAutoStyles )
+{
+ Reference< XPropertySet > xPropSet( rStyle, UNO_QUERY );
+ Reference< XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
+
+ // Don't export styles that aren't existing really. This may be the
+ // case for StarOffice Writer's pool styles.
+ if( xPropSetInfo->hasPropertyByName( sIsPhysical ) )
+ {
+ Any aAny = xPropSet->getPropertyValue( sIsPhysical );
+ if( !*(sal_Bool *)aAny.getValue() )
+ return sal_False;
+ }
+
+ if( bAutoStyles )
+ {
+ XMLPageExportNameEntry aEntry;
+ collectPageMasterAutoStyle( xPropSet, aEntry.sPageMasterName );
+ aEntry.sStyleName = rStyle->getName();
+ aNameVector.push_back( aEntry );
+
+ exportMasterPageContent( xPropSet, sal_True );
+ }
+ else
+ {
+ OUString sName( rStyle->getName() );
+ sal_Bool bEncoded = sal_False;
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_NAME,
+ GetExport().EncodeStyleName( sName, &bEncoded ) );
+
+ if( bEncoded )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_DISPLAY_NAME,
+ sName);
+
+ OUString sPMName;
+ if( findPageMasterName( sName, sPMName ) )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_NAME, GetExport().EncodeStyleName( sPMName ) );
+
+ Reference<XPropertySetInfo> xInfo = xPropSet->getPropertySetInfo();
+ if ( xInfo.is() && xInfo->hasPropertyByName(sFollowStyle) )
+ {
+ OUString sNextName;
+ xPropSet->getPropertyValue( sFollowStyle ) >>= sNextName;
+
+ if( sName != sNextName && sNextName.getLength() )
+ {
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_NEXT_STYLE_NAME,
+ GetExport().EncodeStyleName( sNextName ) );
+ }
+ }
+
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_STYLE,
+ XML_MASTER_PAGE, sal_True, sal_True );
+
+ exportMasterPageContent( xPropSet, sal_False );
+ }
+
+ return sal_True;
+}
+
+XMLPageExport::XMLPageExport( SvXMLExport& rExp ) :
+ rExport( rExp ),
+ sIsPhysical( RTL_CONSTASCII_USTRINGPARAM( "IsPhysical" ) ),
+ sFollowStyle( RTL_CONSTASCII_USTRINGPARAM( "FollowStyle" ) )
+{
+ xPageMasterPropHdlFactory = new XMLPageMasterPropHdlFactory;
+ xPageMasterPropSetMapper = new XMLPageMasterPropSetMapper(
+ (XMLPropertyMapEntry*) aXMLPageMasterStyleMap,
+ xPageMasterPropHdlFactory );
+ xPageMasterExportPropMapper = new XMLPageMasterExportPropMapper(
+ xPageMasterPropSetMapper, rExp);
+
+ rExport.GetAutoStylePool()->AddFamily( XML_STYLE_FAMILY_PAGE_MASTER, OUString( RTL_CONSTASCII_USTRINGPARAM( XML_STYLE_FAMILY_PAGE_MASTER_NAME ) ),
+ xPageMasterExportPropMapper, OUString( RTL_CONSTASCII_USTRINGPARAM( XML_STYLE_FAMILY_PAGE_MASTER_PREFIX ) ), sal_False );
+
+ Reference< XStyleFamiliesSupplier > xFamiliesSupp( GetExport().GetModel(),
+ UNO_QUERY );
+ DBG_ASSERT( xFamiliesSupp.is(),
+ "No XStyleFamiliesSupplier from XModel for export!" );
+ if( xFamiliesSupp.is() )
+ {
+ Reference< XNameAccess > xFamilies( xFamiliesSupp->getStyleFamilies() );
+ DBG_ASSERT( xFamiliesSupp.is(),
+ "getStyleFamilies() from XModel failed for export!" );
+ if( xFamilies.is() )
+ {
+ const OUString aPageStyleName(
+ RTL_CONSTASCII_USTRINGPARAM( "PageStyles" ));
+
+ if( xFamilies->hasByName( aPageStyleName ) )
+ {
+ xPageStyles.set(xFamilies->getByName( aPageStyleName ),uno::UNO_QUERY);
+
+ DBG_ASSERT( xPageStyles.is(),
+ "Page Styles not found for export!" );
+ }
+ }
+ }
+}
+
+XMLPageExport::~XMLPageExport()
+{
+}
+
+void XMLPageExport::exportStyles( sal_Bool bUsed, sal_Bool bAutoStyles )
+{
+ if( xPageStyles.is() )
+ {
+ uno::Sequence< ::rtl::OUString> aSeq = xPageStyles->getElementNames();
+ const ::rtl::OUString* pIter = aSeq.getConstArray();
+ const ::rtl::OUString* pEnd = pIter + aSeq.getLength();
+ for(;pIter != pEnd;++pIter)
+ {
+ Reference< XStyle > xStyle(xPageStyles->getByName( *pIter ),uno::UNO_QUERY);
+ if( !bUsed || xStyle->isInUse() )
+ exportStyle( xStyle, bAutoStyles );
+ }
+ }
+}
+
+void XMLPageExport::exportAutoStyles()
+{
+ rExport.GetAutoStylePool()->exportXML(XML_STYLE_FAMILY_PAGE_MASTER
+ , rExport.GetDocHandler(), rExport.GetMM100UnitConverter(),
+ rExport.GetNamespaceMap()
+ );
+}
+
+void XMLPageExport::exportDefaultStyle()
+{
+ Reference < lang::XMultiServiceFactory > xFactory (GetExport().GetModel(), UNO_QUERY);
+ if (xFactory.is())
+ {
+ OUString sTextDefaults ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.text.Defaults" ) );
+ Reference < XPropertySet > xPropSet (xFactory->createInstance ( sTextDefaults ), UNO_QUERY);
+ if (xPropSet.is())
+ {
+ // <style:default-style ...>
+ GetExport().CheckAttrList();
+
+ ::std::vector< XMLPropertyState > xPropStates =
+ xPageMasterExportPropMapper->FilterDefaults( xPropSet );
+
+ sal_Bool bExport = sal_False;
+ UniReference < XMLPropertySetMapper > aPropMapper(xPageMasterExportPropMapper->getPropertySetMapper());
+ for( ::std::vector< XMLPropertyState >::iterator aIter = xPropStates.begin(); aIter != xPropStates.end(); ++aIter )
+ {
+ XMLPropertyState *pProp = &(*aIter);
+ sal_Int16 nContextId = aPropMapper->GetEntryContextId( pProp->mnIndex );
+ if( nContextId == CTF_PM_STANDARD_MODE )
+ {
+ bExport = sal_True;
+ break;
+ }
+ }
+
+ if( bExport )
+ {
+ //<style:default-page-layout>
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_STYLE,
+ XML_DEFAULT_PAGE_LAYOUT,
+ sal_True, sal_True );
+
+ xPageMasterExportPropMapper->exportXML( GetExport(), xPropStates,
+ XML_EXPORT_FLAG_IGN_WS );
+ }
+ }
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/XMLPercentOrMeasurePropertyHandler.cxx b/xmloff/source/style/XMLPercentOrMeasurePropertyHandler.cxx
new file mode 100644
index 000000000000..b3f147cbbdcb
--- /dev/null
+++ b/xmloff/source/style/XMLPercentOrMeasurePropertyHandler.cxx
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <rtl/ustrbuf.hxx>
+#include "XMLPercentOrMeasurePropertyHandler.hxx"
+#include <xmloff/xmluconv.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+
+XMLPercentOrMeasurePropertyHandler::XMLPercentOrMeasurePropertyHandler( sal_Bool bPercent )
+: mbPercent( bPercent )
+{
+}
+
+XMLPercentOrMeasurePropertyHandler::~XMLPercentOrMeasurePropertyHandler()
+{
+}
+
+sal_Bool XMLPercentOrMeasurePropertyHandler::importXML(
+ const OUString& rStrImpValue,
+ Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const
+{
+ if( (rStrImpValue.indexOf( sal_Unicode('%') ) != -1) != mbPercent )
+ return sal_False;
+
+ sal_Int32 nValue;
+
+ if( mbPercent )
+ {
+ if( !rUnitConverter.convertPercent( nValue, rStrImpValue ) )
+ return sal_False;
+ }
+ else
+ {
+ if( !rUnitConverter.convertMeasure( nValue, rStrImpValue ) )
+ return sal_False;
+ }
+
+ rValue <<= nValue;
+ return sal_True;
+}
+
+sal_Bool XMLPercentOrMeasurePropertyHandler::exportXML(
+ OUString& rStrExpValue,
+ const Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const
+{
+ OUStringBuffer aOut;
+
+ sal_Int32 nValue = 0;
+ if( !(rValue >>= nValue ) )
+ return sal_False;
+
+ if( mbPercent )
+ {
+ rUnitConverter.convertPercent( aOut, nValue );
+ }
+ else
+ {
+ rUnitConverter.convertMeasure( aOut, nValue );
+ }
+
+ rStrExpValue = aOut.makeStringAndClear();
+ return sal_True;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/XMLRectangleMembersHandler.cxx b/xmloff/source/style/XMLRectangleMembersHandler.cxx
new file mode 100644
index 000000000000..9e9fef6d9c96
--- /dev/null
+++ b/xmloff/source/style/XMLRectangleMembersHandler.cxx
@@ -0,0 +1,125 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <xmloff/xmluconv.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/uno/Any.hxx>
+
+#include <com/sun/star/awt/Rectangle.hdl>
+#include "XMLRectangleMembersHandler.hxx"
+#include <xmloff/xmltypes.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+
+XMLRectangleMembersHdl::XMLRectangleMembersHdl( sal_Int32 nType )
+: mnType( nType )
+{
+}
+
+XMLRectangleMembersHdl::~XMLRectangleMembersHdl()
+{
+}
+
+sal_Bool XMLRectangleMembersHdl::importXML(
+ const OUString& rStrImpValue,
+ Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const
+{
+ awt::Rectangle aRect( 0, 0, 0, 0 );
+ if( rValue.hasValue() )
+ rValue >>= aRect;
+
+ sal_Int32 nValue;
+
+ if( rUnitConverter.convertMeasure( nValue, rStrImpValue ) )
+ {
+ switch( mnType )
+ {
+ case XML_TYPE_RECTANGLE_LEFT :
+ aRect.X = nValue;
+ break;
+ case XML_TYPE_RECTANGLE_TOP :
+ aRect.Y = nValue;
+ break;
+ case XML_TYPE_RECTANGLE_WIDTH :
+ aRect.Width = nValue;
+ break;
+ case XML_TYPE_RECTANGLE_HEIGHT :
+ aRect.Height = nValue;
+ break;
+ }
+
+ rValue <<= aRect;
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+sal_Bool XMLRectangleMembersHdl::exportXML(
+ OUString& rStrExpValue,
+ const Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const
+{
+ awt::Rectangle aRect( 0, 0, 0, 0 );
+ rValue >>= aRect;
+
+ sal_Int32 nValue;
+
+ switch( mnType )
+ {
+ case XML_TYPE_RECTANGLE_LEFT :
+ nValue = aRect.X;
+ break;
+ case XML_TYPE_RECTANGLE_TOP :
+ nValue = aRect.Y;
+ break;
+ case XML_TYPE_RECTANGLE_WIDTH :
+ nValue = aRect.Width;
+ break;
+ case XML_TYPE_RECTANGLE_HEIGHT :
+ nValue = aRect.Height;
+ break;
+ default:
+ nValue = 0; // TODO What value should this be?
+ break;
+ }
+
+ rtl::OUStringBuffer sBuffer;
+ rUnitConverter.convertMeasure( sBuffer, nValue );
+ rStrExpValue = sBuffer.makeStringAndClear();
+ return sal_True;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/adjushdl.cxx b/xmloff/source/style/adjushdl.cxx
new file mode 100644
index 000000000000..fd050d028111
--- /dev/null
+++ b/xmloff/source/style/adjushdl.cxx
@@ -0,0 +1,138 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <adjushdl.hxx>
+#include <tools/solar.h>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/style/ParagraphAdjust.hpp>
+#include <com/sun/star/uno/Any.hxx>
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::xmloff::token;
+
+SvXMLEnumMapEntry const pXML_Para_Adjust_Enum[] =
+{
+ { XML_START, style::ParagraphAdjust_LEFT },
+ { XML_END, style::ParagraphAdjust_RIGHT },
+ { XML_CENTER, style::ParagraphAdjust_CENTER },
+ { XML_JUSTIFY, style::ParagraphAdjust_BLOCK },
+ { XML_JUSTIFIED, style::ParagraphAdjust_BLOCK }, // obsolete
+ { XML_LEFT, style::ParagraphAdjust_LEFT },
+ { XML_RIGHT, style::ParagraphAdjust_RIGHT },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry const pXML_Para_Align_Last_Enum[] =
+{
+ { XML_START, style::ParagraphAdjust_LEFT },
+ { XML_CENTER, style::ParagraphAdjust_CENTER },
+ { XML_JUSTIFY, style::ParagraphAdjust_BLOCK },
+ { XML_JUSTIFIED, style::ParagraphAdjust_BLOCK }, // obsolete
+ { XML_TOKEN_INVALID, 0 }
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLParaAdjustPropHdl
+//
+
+XMLParaAdjustPropHdl::~XMLParaAdjustPropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLParaAdjustPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_uInt16 eAdjust;
+ sal_Bool bRet = SvXMLUnitConverter::convertEnum( eAdjust, rStrImpValue, pXML_Para_Adjust_Enum );
+ if( bRet )
+ rValue <<= (sal_Int16)eAdjust;
+
+ return bRet;
+}
+
+sal_Bool XMLParaAdjustPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ if(!rValue.hasValue())
+ return sal_False;
+ OUStringBuffer aOut;
+ sal_Int16 nVal = 0;
+
+ rValue >>= nVal;
+
+ sal_Bool bRet = SvXMLUnitConverter::convertEnum( aOut, nVal, pXML_Para_Adjust_Enum, XML_START );
+
+ rStrExpValue = aOut.makeStringAndClear();
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLLastLineAdjustPropHdl
+//
+
+XMLLastLineAdjustPropHdl::~XMLLastLineAdjustPropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLLastLineAdjustPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_uInt16 eAdjust;
+ sal_Bool bRet = SvXMLUnitConverter::convertEnum( eAdjust, rStrImpValue, pXML_Para_Align_Last_Enum );
+ if( bRet )
+ rValue <<= (sal_Int16)eAdjust;
+
+ return bRet;
+}
+
+sal_Bool XMLLastLineAdjustPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ OUStringBuffer aOut;
+ sal_Int16 nVal = 0;
+ sal_Bool bRet = sal_False;
+
+ rValue >>= nVal;
+
+ if( nVal != style::ParagraphAdjust_LEFT )
+ bRet = SvXMLUnitConverter::convertEnum( aOut, nVal, pXML_Para_Align_Last_Enum, XML_START );
+
+ rStrExpValue = aOut.makeStringAndClear();
+
+ return bRet;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/adjushdl.hxx b/xmloff/source/style/adjushdl.hxx
new file mode 100644
index 000000000000..20a5c04207b5
--- /dev/null
+++ b/xmloff/source/style/adjushdl.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PROPERTYHANDLER_ADJUSTTYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_ADJUSTTYPES_HXX
+
+#include <xmloff/xmlprhdl.hxx>
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLParaAdjustPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLParaAdjustPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLLastLineAdjustPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLLastLineAdjustPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_ADJUSTTYPES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/backhdl.cxx b/xmloff/source/style/backhdl.cxx
new file mode 100644
index 000000000000..e6743dd9609e
--- /dev/null
+++ b/xmloff/source/style/backhdl.cxx
@@ -0,0 +1,300 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#include <backhdl.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <rtl/ustrbuf.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+SvXMLEnumMapEntry pXML_BrushHorizontalPos[] =
+{
+ { XML_LEFT, style::GraphicLocation_LEFT_MIDDLE },
+ { XML_RIGHT, style::GraphicLocation_RIGHT_MIDDLE },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry pXML_BrushVerticalPos[] =
+{
+ { XML_TOP, style::GraphicLocation_MIDDLE_TOP },
+ { XML_BOTTOM, style::GraphicLocation_MIDDLE_BOTTOM },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLBackGraphicPositionPropHdl
+//
+
+XMLBackGraphicPositionPropHdl::~XMLBackGraphicPositionPropHdl()
+{
+ // Nothing to do
+}
+
+sal_Bool XMLBackGraphicPositionPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_True;
+ style::GraphicLocation ePos = style::GraphicLocation_NONE, eTmp;
+ sal_uInt16 nTmp;
+ SvXMLTokenEnumerator aTokenEnum( rStrImpValue );
+ OUString aToken;
+ sal_Bool bHori = sal_False, bVert = sal_False;
+
+ while( bRet && aTokenEnum.getNextToken( aToken ) )
+ {
+ if( bHori && bVert )
+ {
+ bRet = sal_False;
+ }
+ else if( -1 != aToken.indexOf( sal_Unicode('%') ) )
+ {
+ sal_Int32 nPrc = 50;
+ if( SvXMLUnitConverter::convertPercent( nPrc, aToken ) )
+ {
+ if( !bHori )
+ {
+ ePos = nPrc < 25 ? style::GraphicLocation_LEFT_TOP :
+ (nPrc < 75 ? style::GraphicLocation_MIDDLE_MIDDLE :
+ style::GraphicLocation_RIGHT_BOTTOM);
+ bHori = sal_True;
+ }
+ else
+ {
+ eTmp = nPrc < 25 ? style::GraphicLocation_LEFT_TOP:
+ (nPrc < 75 ? style::GraphicLocation_LEFT_MIDDLE :
+ style::GraphicLocation_LEFT_BOTTOM);
+ MergeXMLVertPos( ePos, eTmp );
+ bVert = sal_True;
+ }
+ }
+ else
+ {
+ // wrong percentage
+ bRet = sal_False;
+ }
+ }
+ else if( IsXMLToken( aToken, XML_CENTER ) )
+ {
+ if( bHori )
+ MergeXMLVertPos( ePos, style::GraphicLocation_MIDDLE_MIDDLE );
+ else if ( bVert )
+ MergeXMLHoriPos( ePos, style::GraphicLocation_MIDDLE_MIDDLE );
+ else
+ ePos = style::GraphicLocation_MIDDLE_MIDDLE;
+ }
+ else if( SvXMLUnitConverter::convertEnum( nTmp, aToken, pXML_BrushHorizontalPos ) )
+ {
+ if( bVert )
+ MergeXMLHoriPos( ePos, (style::GraphicLocation)nTmp );
+ else if( !bHori )
+ ePos = (style::GraphicLocation)nTmp;
+ else
+ bRet = sal_False;
+
+ bHori = sal_True;
+ }
+ else if( SvXMLUnitConverter::convertEnum( nTmp, aToken, pXML_BrushVerticalPos ) )
+ {
+ if( bHori )
+ MergeXMLVertPos( ePos, (style::GraphicLocation)nTmp );
+ else if( !bVert )
+ ePos = (style::GraphicLocation)nTmp;
+ else
+ bRet = sal_False;
+ bVert = sal_True;
+ }
+ else
+ {
+ bRet = sal_False;
+ }
+ }
+
+ bRet &= style::GraphicLocation_NONE != ePos;
+ if( bRet )
+ rValue <<= (style::GraphicLocation)(sal_uInt16)ePos;
+
+ return bRet;
+}
+
+sal_Bool XMLBackGraphicPositionPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_True;
+ OUStringBuffer aOut;
+
+ style::GraphicLocation eLocation;
+ if( !( rValue >>= eLocation ) )
+ {
+ sal_Int32 nValue = 0;
+ if( rValue >>= nValue )
+ eLocation = (style::GraphicLocation)nValue;
+ else
+ bRet = sal_False;
+ }
+
+ if( bRet )
+ {
+ bRet = sal_False;
+
+ switch( eLocation )
+ {
+ case style::GraphicLocation_LEFT_TOP:
+ case style::GraphicLocation_MIDDLE_TOP:
+ case style::GraphicLocation_RIGHT_TOP:
+ aOut.append( GetXMLToken(XML_TOP) );
+ bRet = sal_True;
+ break;
+ case style::GraphicLocation_LEFT_MIDDLE:
+ case style::GraphicLocation_MIDDLE_MIDDLE:
+ case style::GraphicLocation_RIGHT_MIDDLE:
+ aOut.append( GetXMLToken(XML_CENTER) );
+ bRet = sal_True;
+ break;
+ case style::GraphicLocation_LEFT_BOTTOM:
+ case style::GraphicLocation_MIDDLE_BOTTOM:
+ case style::GraphicLocation_RIGHT_BOTTOM:
+ aOut.append( GetXMLToken(XML_BOTTOM) );
+ bRet = sal_True;
+ break;
+ default:
+ break;
+ }
+
+ if( bRet )
+ {
+ aOut.append( sal_Unicode( ' ' ) );
+
+ switch( eLocation )
+ {
+ case style::GraphicLocation_LEFT_TOP:
+ case style::GraphicLocation_LEFT_BOTTOM:
+ case style::GraphicLocation_LEFT_MIDDLE:
+ aOut.append( GetXMLToken(XML_LEFT) );
+ break;
+ case style::GraphicLocation_MIDDLE_TOP:
+ case style::GraphicLocation_MIDDLE_MIDDLE:
+ case style::GraphicLocation_MIDDLE_BOTTOM:
+ aOut.append( GetXMLToken(XML_CENTER) );
+ break;
+ case style::GraphicLocation_RIGHT_MIDDLE:
+ case style::GraphicLocation_RIGHT_TOP:
+ case style::GraphicLocation_RIGHT_BOTTOM:
+ aOut.append( GetXMLToken(XML_RIGHT) );
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ rStrExpValue = aOut.makeStringAndClear();
+
+ return bRet;
+}
+
+void XMLBackGraphicPositionPropHdl::MergeXMLVertPos( style::GraphicLocation& ePos, style::GraphicLocation eVert ) const
+{
+ switch( ePos )
+ {
+ case style::GraphicLocation_LEFT_TOP:
+ case style::GraphicLocation_LEFT_MIDDLE:
+ case style::GraphicLocation_LEFT_BOTTOM:
+ ePos = style::GraphicLocation_MIDDLE_TOP==eVert ?
+ style::GraphicLocation_LEFT_TOP :
+ (style::GraphicLocation_MIDDLE_MIDDLE==eVert ?
+ style::GraphicLocation_LEFT_MIDDLE :
+ style::GraphicLocation_LEFT_BOTTOM);
+ ePos = eVert;
+ break;
+
+ case style::GraphicLocation_MIDDLE_TOP:
+ case style::GraphicLocation_MIDDLE_MIDDLE:
+ case style::GraphicLocation_MIDDLE_BOTTOM:
+ ePos = eVert;
+ break;
+
+ case style::GraphicLocation_RIGHT_TOP:
+ case style::GraphicLocation_RIGHT_MIDDLE:
+ case style::GraphicLocation_RIGHT_BOTTOM:
+ ePos = style::GraphicLocation_MIDDLE_TOP==eVert ?
+ style::GraphicLocation_RIGHT_TOP :
+ (style::GraphicLocation_MIDDLE_MIDDLE==eVert ?
+ style::GraphicLocation_RIGHT_MIDDLE :
+ style::GraphicLocation_RIGHT_BOTTOM);
+ break;
+ default:
+ break;
+ }
+}
+
+void XMLBackGraphicPositionPropHdl::MergeXMLHoriPos( style::GraphicLocation& ePos, style::GraphicLocation eHori ) const
+{
+ DBG_ASSERT( style::GraphicLocation_LEFT_MIDDLE==eHori || style::GraphicLocation_MIDDLE_MIDDLE==eHori || style::GraphicLocation_RIGHT_MIDDLE==eHori,
+ "lcl_frmitems_MergeXMLHoriPos: vertical pos must be middle" );
+
+ switch( ePos )
+ {
+ case style::GraphicLocation_LEFT_TOP:
+ case style::GraphicLocation_MIDDLE_TOP:
+ case style::GraphicLocation_RIGHT_TOP:
+ ePos = style::GraphicLocation_LEFT_MIDDLE==eHori ?
+ style::GraphicLocation_LEFT_TOP :
+ (style::GraphicLocation_MIDDLE_MIDDLE==eHori ?
+ style::GraphicLocation_MIDDLE_TOP :
+ style::GraphicLocation_RIGHT_TOP);
+ break;
+
+ case style::GraphicLocation_LEFT_MIDDLE:
+ case style::GraphicLocation_MIDDLE_MIDDLE:
+ case style::GraphicLocation_RIGHT_MIDDLE:
+ ePos = eHori;
+ break;
+
+ case style::GraphicLocation_LEFT_BOTTOM:
+ case style::GraphicLocation_MIDDLE_BOTTOM:
+ case style::GraphicLocation_RIGHT_BOTTOM:
+ ePos = style::GraphicLocation_LEFT_MIDDLE==eHori ?
+ style::GraphicLocation_LEFT_BOTTOM :
+ (style::GraphicLocation_MIDDLE_MIDDLE==eHori ?
+ style::GraphicLocation_MIDDLE_BOTTOM :
+ style::GraphicLocation_RIGHT_BOTTOM);
+ break;
+ default:
+ break;
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/backhdl.hxx b/xmloff/source/style/backhdl.hxx
new file mode 100644
index 000000000000..bef4912cb5e9
--- /dev/null
+++ b/xmloff/source/style/backhdl.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PROPERTYHANDLER_BRUSHTYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_BRUSHTYPES_HXX
+
+#include <xmloff/xmlprhdl.hxx>
+#include <com/sun/star/style/GraphicLocation.hpp>
+#include <com/sun/star/style/GraphicLocation.hpp>
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLBackGraphicPositionPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLBackGraphicPositionPropHdl();
+
+ /// TabStops will be imported/exported as XML-Elements. So the Import/Export-work must be done at another place.
+ using XMLPropertyHandler::importXML;
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+
+private:
+ void MergeXMLHoriPos( ::com::sun::star::style::GraphicLocation& ePos, ::com::sun::star::style::GraphicLocation eHori ) const;
+ void MergeXMLVertPos( ::com::sun::star::style::GraphicLocation& ePos, ::com::sun::star::style::GraphicLocation eVert ) const;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_BRUSHTYPES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/bordrhdl.cxx b/xmloff/source/style/bordrhdl.cxx
new file mode 100644
index 000000000000..230f1082fe2e
--- /dev/null
+++ b/xmloff/source/style/bordrhdl.cxx
@@ -0,0 +1,374 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+#include <bordrhdl.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/table/BorderLine2.hpp>
+
+#if DEBUG
+#include <cstdio>
+#endif
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+const sal_uInt16 API_LINE_SOLID = 0;
+const sal_uInt16 API_LINE_DOTTED = 1;
+const sal_uInt16 API_LINE_DASHED = 2;
+const sal_uInt16 API_LINE_DOUBLE = 3;
+const sal_uInt16 API_LINE_THINTHICK_SMALLGAP = 4;
+const sal_uInt16 API_LINE_THINTHICK_MEDIUMGAP = 5;
+const sal_uInt16 API_LINE_THINTHICK_LARGEGAP = 6;
+const sal_uInt16 API_LINE_THICKTHIN_SMALLGAP = 7;
+const sal_uInt16 API_LINE_THICKTHIN_MEDIUMGAP = 8;
+const sal_uInt16 API_LINE_THICKTHIN_LARGEGAP = 9;
+const sal_uInt16 API_LINE_EMBOSSED = 10;
+const sal_uInt16 API_LINE_ENGRAVED = 11;
+const sal_uInt16 API_LINE_OUTSET = 12;
+const sal_uInt16 API_LINE_INSET = 13;
+const sal_uInt16 API_LINE_NONE = USHRT_MAX;
+
+#define DEF_LINE_WIDTH_0 1
+#define DEF_LINE_WIDTH_1 35
+#define DEF_LINE_WIDTH_2 88
+
+#define SVX_XML_BORDER_WIDTH_THIN 0
+#define SVX_XML_BORDER_WIDTH_MIDDLE 1
+#define SVX_XML_BORDER_WIDTH_THICK 2
+
+SvXMLEnumMapEntry pXML_BorderStyles[] =
+{
+ { XML_NONE, API_LINE_NONE },
+ { XML_HIDDEN, API_LINE_NONE },
+ { XML_SOLID, API_LINE_SOLID },
+ { XML_DOUBLE, API_LINE_DOUBLE },
+ { XML_DOTTED, API_LINE_DOTTED },
+ { XML_DASHED, API_LINE_DASHED },
+ { XML_GROOVE, API_LINE_ENGRAVED },
+ { XML_RIDGE, API_LINE_EMBOSSED },
+ { XML_INSET, API_LINE_INSET },
+ { XML_OUTSET, API_LINE_OUTSET },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry pXML_NamedBorderWidths[] =
+{
+ { XML_THIN, SVX_XML_BORDER_WIDTH_THIN },
+ { XML_MIDDLE, SVX_XML_BORDER_WIDTH_MIDDLE },
+ { XML_THICK, SVX_XML_BORDER_WIDTH_THICK },
+ { XML_TOKEN_INVALID, 0 }
+};
+// mapping tables to map external xml input to intarnal box line widths
+
+
+static sal_uInt16 const aBorderWidths[] =
+{
+ DEF_LINE_WIDTH_0,
+ DEF_LINE_WIDTH_1,
+ DEF_LINE_WIDTH_2
+};
+
+void lcl_frmitems_setXMLBorderStyle( table::BorderLine2 & rBorderLine, sal_uInt16 nStyle )
+{
+ sal_Int16 eStyle = -1; // None
+ if ( nStyle != API_LINE_NONE )
+ eStyle = sal_Int16( nStyle );
+
+ rBorderLine.LineStyle = eStyle;
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLEscapementPropHdl
+//
+
+XMLBorderWidthHdl::~XMLBorderWidthHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLBorderWidthHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ SvXMLTokenEnumerator aTokenEnum( rStrImpValue );
+
+ sal_Int32 nInWidth, nDistance, nOutWidth;
+
+ OUString aToken;
+ if( !aTokenEnum.getNextToken( aToken ) )
+ return sal_False;
+
+ if( !rUnitConverter.convertMeasure( nInWidth, aToken, 0, 500 ) )
+ return sal_False;
+
+ if( !aTokenEnum.getNextToken( aToken ) )
+ return sal_False;
+
+ if( !rUnitConverter.convertMeasure( nDistance, aToken, 0, 500 ) )
+ return sal_False;
+
+ if( !aTokenEnum.getNextToken( aToken ) )
+ return sal_False;
+
+ if( !rUnitConverter.convertMeasure( nOutWidth, aToken, 0, 500 ) )
+ return sal_False;
+
+ table::BorderLine2 aBorderLine;
+ if(!(rValue >>= aBorderLine))
+ aBorderLine.Color = 0;
+
+ aBorderLine.InnerLineWidth = sal::static_int_cast< sal_Int16 >(nInWidth);
+ aBorderLine.OuterLineWidth = sal::static_int_cast< sal_Int16 >(nOutWidth);
+ aBorderLine.LineDistance = sal::static_int_cast< sal_Int16 >(nDistance);
+
+ rValue <<= aBorderLine;
+ return sal_True;
+}
+
+sal_Bool XMLBorderWidthHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ OUStringBuffer aOut;
+
+ table::BorderLine2 aBorderLine;
+ if(!(rValue >>= aBorderLine))
+ return sal_False;
+
+ bool bDouble = false;
+ switch ( aBorderLine.LineStyle )
+ {
+ case API_LINE_DOUBLE:
+ case API_LINE_THINTHICK_SMALLGAP:
+ case API_LINE_THINTHICK_MEDIUMGAP:
+ case API_LINE_THINTHICK_LARGEGAP:
+ case API_LINE_THICKTHIN_SMALLGAP:
+ case API_LINE_THICKTHIN_MEDIUMGAP:
+ case API_LINE_THICKTHIN_LARGEGAP:
+ bDouble = true;
+ break;
+ default:
+ break;
+ }
+
+ if( ( aBorderLine.LineDistance == 0 && aBorderLine.InnerLineWidth == 0 ) || !bDouble )
+ return sal_False;
+
+ rUnitConverter.convertMeasure( aOut, aBorderLine.InnerLineWidth );
+ aOut.append( sal_Unicode( ' ' ) );
+ rUnitConverter.convertMeasure( aOut, aBorderLine.LineDistance );
+ aOut.append( sal_Unicode( ' ' ) );
+ rUnitConverter.convertMeasure( aOut, aBorderLine.OuterLineWidth );
+
+ rStrExpValue = aOut.makeStringAndClear();
+ return sal_True;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLEscapementHeightPropHdl
+//
+
+XMLBorderHdl::~XMLBorderHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLBorderHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ OUString aToken;
+ SvXMLTokenEnumerator aTokens( rStrImpValue );
+
+ sal_Bool bHasStyle = sal_False;
+ sal_Bool bHasWidth = sal_False;
+ sal_Bool bHasColor = sal_False;
+
+ sal_uInt16 nStyle = USHRT_MAX;
+ sal_uInt16 nWidth = 0;
+ sal_uInt16 nNamedWidth = USHRT_MAX;
+ Color aColor;
+
+ sal_Int32 nTemp;
+ while( aTokens.getNextToken( aToken ) && aToken.getLength() != 0 )
+ {
+ if( !bHasWidth &&
+ rUnitConverter.convertEnum( nNamedWidth, aToken,
+ pXML_NamedBorderWidths ) )
+ {
+ bHasWidth = sal_True;
+ }
+ else if( !bHasStyle &&
+ rUnitConverter.convertEnum( nStyle, aToken,
+ pXML_BorderStyles ) )
+ {
+ bHasStyle = sal_True;
+ }
+ else if( !bHasColor && rUnitConverter.convertColor( aColor, aToken ) )
+ {
+ bHasColor = sal_True;
+ }
+ else if( !bHasWidth &&
+ rUnitConverter.convertMeasure( nTemp, aToken, 0,
+ USHRT_MAX ) )
+ {
+ nWidth = (sal_uInt16)nTemp;
+ bHasWidth = sal_True;
+ }
+ else
+ {
+ // missformed
+ return sal_False;
+ }
+ }
+
+ // if there is no style or a different style than none but no width,
+ // then the declaration is not valid.
+ if( !bHasStyle || (API_LINE_NONE != nStyle && !bHasWidth) )
+ return sal_False;
+
+ table::BorderLine2 aBorderLine;
+ if(!(rValue >>= aBorderLine))
+ {
+ aBorderLine.Color = 0;
+ aBorderLine.InnerLineWidth = 0;
+ aBorderLine.OuterLineWidth = 0;
+ aBorderLine.LineDistance = 0;
+ aBorderLine.LineWidth = 0;
+ }
+
+ // first of all, delete an empty line
+ if( (bHasStyle && API_LINE_NONE == nStyle) ||
+ (bHasWidth && USHRT_MAX == nNamedWidth && 0 == nWidth) )
+ {
+ aBorderLine.InnerLineWidth = 0;
+ aBorderLine.OuterLineWidth = 0;
+ aBorderLine.LineDistance = 0;
+ aBorderLine.LineWidth = 0;
+ }
+ else if( bHasWidth )
+ {
+ if( USHRT_MAX != nNamedWidth )
+ {
+ aBorderLine.LineWidth = aBorderWidths[nNamedWidth];
+ }
+ else
+ {
+ aBorderLine.LineWidth = nWidth;
+ lcl_frmitems_setXMLBorderStyle( aBorderLine, nStyle );
+ }
+ }
+ else
+ {
+ aBorderLine.LineWidth = 0;
+ lcl_frmitems_setXMLBorderStyle( aBorderLine, nStyle );
+ }
+
+ // set color
+ if( bHasColor )
+ aBorderLine.Color = (sal_Int32)aColor.GetRGBColor();
+
+ rValue <<= aBorderLine;
+ return sal_True;
+}
+
+sal_Bool XMLBorderHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ OUStringBuffer aOut;
+
+ table::BorderLine2 aBorderLine;
+ if(!(rValue >>= aBorderLine))
+ return sal_False;
+
+ sal_Int32 nWidth = aBorderLine.LineWidth;
+
+ if( nWidth == 0 )
+ {
+ aOut.append( GetXMLToken( XML_NONE ) );
+ }
+ else
+ {
+ rUnitConverter.convertMeasure( aOut, nWidth,
+ MAP_100TH_MM, MAP_POINT );
+
+ aOut.append( sal_Unicode( ' ' ) );
+
+ XMLTokenEnum eStyleToken = XML_SOLID;
+ switch ( aBorderLine.LineStyle )
+ {
+ case API_LINE_DASHED:
+ eStyleToken = XML_DASHED;
+ break;
+ case API_LINE_DOTTED:
+ eStyleToken = XML_DOTTED;
+ break;
+ case API_LINE_DOUBLE:
+ case API_LINE_THINTHICK_SMALLGAP:
+ case API_LINE_THINTHICK_MEDIUMGAP:
+ case API_LINE_THINTHICK_LARGEGAP:
+ case API_LINE_THICKTHIN_SMALLGAP:
+ case API_LINE_THICKTHIN_MEDIUMGAP:
+ case API_LINE_THICKTHIN_LARGEGAP:
+ eStyleToken = XML_DOUBLE;
+ break;
+ case API_LINE_EMBOSSED:
+ eStyleToken = XML_RIDGE;
+ break;
+ case API_LINE_ENGRAVED:
+ eStyleToken = XML_GROOVE;
+ break;
+ case API_LINE_OUTSET:
+ eStyleToken = XML_OUTSET;
+ break;
+ case API_LINE_INSET:
+ eStyleToken = XML_INSET;
+ break;
+ case API_LINE_SOLID:
+ default:
+ break;
+ }
+ aOut.append( GetXMLToken( eStyleToken ) );
+
+ aOut.append( sal_Unicode( ' ' ) );
+
+ rUnitConverter.convertColor( aOut, aBorderLine.Color );
+ }
+
+ rStrExpValue = aOut.makeStringAndClear();
+
+ return sal_True;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/bordrhdl.hxx b/xmloff/source/style/bordrhdl.hxx
new file mode 100644
index 000000000000..eef72569c715
--- /dev/null
+++ b/xmloff/source/style/bordrhdl.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PROPERTYHANDLER_BORDERTYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_BORDERTYPES_HXX
+
+#include <xmloff/xmlprhdl.hxx>
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLBorderWidthHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLBorderWidthHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+class XMLBorderHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLBorderHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_CHARLOCALETYPES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/breakhdl.cxx b/xmloff/source/style/breakhdl.cxx
new file mode 100644
index 000000000000..dacbc0e81be6
--- /dev/null
+++ b/xmloff/source/style/breakhdl.cxx
@@ -0,0 +1,196 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <breakhdl.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/style/BreakType.hpp>
+#include <com/sun/star/uno/Any.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+SvXMLEnumMapEntry pXML_BreakTypes[] =
+{
+ { XML_AUTO, 0 },
+ { XML_COLUMN, 1 },
+ { XML_PAGE, 2 },
+ { XML_EVEN_PAGE, 2 },
+ { XML_ODD_PAGE, 2 },
+ { XML_TOKEN_INVALID, 0}
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLFmtBreakBeforePropHdl
+//
+
+XMLFmtBreakBeforePropHdl::~XMLFmtBreakBeforePropHdl()
+{
+ // Nothing to do
+}
+
+sal_Bool XMLFmtBreakBeforePropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_uInt16 nEnum;
+ sal_Bool bRet = SvXMLUnitConverter::convertEnum( nEnum, rStrImpValue, pXML_BreakTypes );
+ if( bRet )
+ {
+ style::BreakType eBreak;
+ switch ( nEnum )
+ {
+ case 0:
+ eBreak = style::BreakType_NONE;
+ break;
+ case 1:
+ eBreak = style::BreakType_COLUMN_BEFORE;
+ break;
+ default:
+ eBreak = style::BreakType_PAGE_BEFORE;
+ break;
+ }
+ rValue <<= eBreak;
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLFmtBreakBeforePropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ style::BreakType eBreak;
+
+ if( !( rValue >>= eBreak ) )
+ {
+ sal_Int32 nValue = 0;
+ if( !( rValue >>= nValue ) )
+ return sal_False;
+
+ eBreak = (style::BreakType) nValue;
+ }
+
+ sal_uInt16 nEnum = 0;
+ switch( eBreak )
+ {
+ case style::BreakType_COLUMN_BEFORE:
+ nEnum = 1;
+ break;
+ case style::BreakType_PAGE_BEFORE:
+ nEnum = 2;
+ break;
+ case style::BreakType_NONE:
+ nEnum = 0;
+ break;
+ default:
+ return sal_False;
+ }
+
+ OUStringBuffer aOut;
+ /* sal_Bool bOk = */ SvXMLUnitConverter::convertEnum( aOut, nEnum, pXML_BreakTypes );
+ rStrExpValue = aOut.makeStringAndClear();
+
+ return sal_True;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLFmtBreakBeforePropHdl
+//
+
+XMLFmtBreakAfterPropHdl::~XMLFmtBreakAfterPropHdl()
+{
+ // Nothing to do
+}
+
+sal_Bool XMLFmtBreakAfterPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_uInt16 nEnum;
+ sal_Bool bRet = SvXMLUnitConverter::convertEnum( nEnum, rStrImpValue, pXML_BreakTypes );
+ if( bRet )
+ {
+ style::BreakType eBreak;
+ switch ( nEnum )
+ {
+ case 0:
+ eBreak = style::BreakType_NONE;
+ break;
+ case 1:
+ eBreak = style::BreakType_COLUMN_AFTER;
+ break;
+ default:
+ eBreak = style::BreakType_PAGE_AFTER;
+ break;
+ }
+ rValue <<= eBreak;
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLFmtBreakAfterPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ style::BreakType eBreak;
+
+ if( !( rValue >>= eBreak ) )
+ {
+ sal_Int32 nValue = 0;
+ if( !( rValue >>= nValue ) )
+ return sal_False;
+
+ eBreak = (style::BreakType) nValue;
+ }
+
+ sal_uInt16 nEnum = 0;
+ switch( eBreak )
+ {
+ case style::BreakType_COLUMN_AFTER:
+ nEnum = 1;
+ break;
+ case style::BreakType_PAGE_AFTER:
+ nEnum = 2;
+ break;
+ case style::BreakType_NONE:
+ nEnum = 0;
+ break;
+ default:
+ return sal_False;
+ }
+
+ OUStringBuffer aOut;
+ /* sal_Bool bOk = */ SvXMLUnitConverter::convertEnum( aOut, nEnum, pXML_BreakTypes );
+ rStrExpValue = aOut.makeStringAndClear();
+
+ return sal_True;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/breakhdl.hxx b/xmloff/source/style/breakhdl.hxx
new file mode 100644
index 000000000000..48c9ca12cc08
--- /dev/null
+++ b/xmloff/source/style/breakhdl.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PROPERTYHANDLER_BREAKTYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_BREAKTYPES_HXX
+
+#include <xmloff/xmlprhdl.hxx>
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLFmtBreakBeforePropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLFmtBreakBeforePropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLFmtBreakAfterPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLFmtBreakAfterPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_BREAKTYPES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/cdouthdl.cxx b/xmloff/source/style/cdouthdl.cxx
new file mode 100644
index 000000000000..cf1577adceee
--- /dev/null
+++ b/xmloff/source/style/cdouthdl.cxx
@@ -0,0 +1,332 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <cdouthdl.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <rtl/ustrbuf.hxx>
+
+#include <com/sun/star/awt/FontStrikeout.hpp>
+#include <com/sun/star/uno/Any.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::awt;
+using namespace ::xmloff::token;
+
+SvXMLEnumMapEntry pXML_CrossedoutType_Enum[] =
+{
+ { XML_NONE, FontStrikeout::NONE },
+ { XML_SINGLE, FontStrikeout::SINGLE },
+ { XML_DOUBLE, FontStrikeout::DOUBLE },
+ { XML_SINGLE, FontStrikeout::BOLD },
+ { XML_SINGLE, FontStrikeout::SLASH },
+ { XML_SINGLE, FontStrikeout::X },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry pXML_CrossedoutStyle_Enum[] =
+{
+ { XML_NONE, FontStrikeout::NONE },
+ { XML_SOLID, FontStrikeout::SINGLE },
+ { XML_SOLID, FontStrikeout::DOUBLE },
+ { XML_SOLID, FontStrikeout::BOLD },
+ { XML_SOLID, FontStrikeout::SLASH },
+ { XML_SOLID, FontStrikeout::X },
+ { XML_DOTTED, FontStrikeout::SINGLE },
+ { XML_DASH, FontStrikeout::SINGLE },
+ { XML_LONG_DASH, FontStrikeout::SINGLE },
+ { XML_DOT_DASH, FontStrikeout::SINGLE },
+ { XML_DOT_DOT_DASH, FontStrikeout::SINGLE },
+ { XML_WAVE, FontStrikeout::SINGLE },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry pXML_CrossedoutWidth_Enum[] =
+{
+ { XML_AUTO, FontStrikeout::NONE },
+ { XML_AUTO, FontStrikeout::SINGLE },
+ { XML_AUTO, FontStrikeout::DOUBLE },
+ { XML_BOLD, FontStrikeout::BOLD },
+ { XML_AUTO, FontStrikeout::SLASH },
+ { XML_AUTO, FontStrikeout::X },
+ { XML_THIN, FontStrikeout::NONE },
+ { XML_MEDIUM, FontStrikeout::NONE },
+ { XML_THICK, FontStrikeout::NONE },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLCrossedOutTypePropHdl
+//
+
+XMLCrossedOutTypePropHdl::~XMLCrossedOutTypePropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLCrossedOutTypePropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_uInt16 eNewStrikeout;
+ sal_Bool bRet = SvXMLUnitConverter::convertEnum(
+ eNewStrikeout, rStrImpValue, pXML_CrossedoutType_Enum );
+ if( bRet )
+ {
+ // multi property: style and width might be set already.
+ // If the old value is NONE, the new is used unchanged.
+ sal_Int16 eStrikeout = sal_Int16();
+ if( (rValue >>= eStrikeout) && FontStrikeout::NONE!=eStrikeout )
+ {
+ switch( eNewStrikeout )
+ {
+ case FontStrikeout::NONE:
+ case FontStrikeout::SINGLE:
+ // keep existing line style
+ eNewStrikeout = eStrikeout;
+ break;
+ case FontStrikeout::DOUBLE:
+ // A double line style has priority over a solid or a bold
+ // line style,
+ // but not about any other line style
+ switch( eStrikeout )
+ {
+ case FontStrikeout::SINGLE:
+ case FontStrikeout::BOLD:
+ break;
+ default:
+ // If a double line style is not supported for the existing
+ // value, keep the new one
+ eNewStrikeout = eStrikeout;
+ break;
+ }
+ break;
+ default:
+ OSL_ENSURE( bRet, "unexpected line type value" );
+ break;
+ }
+ if( eNewStrikeout != eStrikeout )
+ rValue <<= (sal_Int16)eNewStrikeout;
+ }
+ else
+ {
+ rValue <<= (sal_Int16)eNewStrikeout;
+ }
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLCrossedOutTypePropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int16 nValue = sal_Int16();
+ OUStringBuffer aOut;
+
+ if( (rValue >>= nValue) && FontStrikeout::DOUBLE==nValue )
+ {
+ bRet = SvXMLUnitConverter::convertEnum(
+ aOut, (sal_uInt16)nValue, pXML_CrossedoutType_Enum );
+ if( bRet )
+ rStrExpValue = aOut.makeStringAndClear();
+ }
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLCrossedOutStylePropHdl
+//
+
+XMLCrossedOutStylePropHdl::~XMLCrossedOutStylePropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLCrossedOutStylePropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_uInt16 eNewStrikeout;
+ sal_Bool bRet = SvXMLUnitConverter::convertEnum(
+ eNewStrikeout, rStrImpValue, pXML_CrossedoutStyle_Enum );
+ if( bRet )
+ {
+ // multi property: style and width might be set already.
+ // If the old value is NONE, the new is used unchanged.
+ sal_Int16 eStrikeout = sal_Int16();
+ if( (rValue >>= eStrikeout) && FontStrikeout::NONE!=eStrikeout )
+ {
+ // one NONE a SINGLE are possible new values. For both, the
+ // existing value is kept.
+ }
+ else
+ {
+ rValue <<= (sal_Int16)eNewStrikeout;
+ }
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLCrossedOutStylePropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int16 nValue = sal_Int16();
+ OUStringBuffer aOut;
+
+ if( rValue >>= nValue )
+ {
+ bRet = SvXMLUnitConverter::convertEnum(
+ aOut, (sal_uInt16)nValue, pXML_CrossedoutStyle_Enum );
+ if( bRet )
+ rStrExpValue = aOut.makeStringAndClear();
+ }
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLCrossedOutWidthPropHdl
+//
+
+XMLCrossedOutWidthPropHdl::~XMLCrossedOutWidthPropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLCrossedOutWidthPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_uInt16 eNewStrikeout;
+ sal_Bool bRet = SvXMLUnitConverter::convertEnum(
+ eNewStrikeout, rStrImpValue, pXML_CrossedoutWidth_Enum );
+ if( bRet )
+ {
+ // multi property: style and width might be set already.
+ // If the old value is NONE, the new is used unchanged.
+ sal_Int16 eStrikeout = sal_Int16();
+ if( (rValue >>= eStrikeout) && FontStrikeout::NONE!=eStrikeout )
+ {
+ switch( eNewStrikeout )
+ {
+ case FontStrikeout::NONE:
+ // keep existing line style
+ eNewStrikeout = eStrikeout;
+ break;
+ case FontStrikeout::BOLD:
+ switch( eStrikeout )
+ {
+ case FontStrikeout::SINGLE:
+ break;
+ default:
+ // If a double line style is not supported for the existing
+ // value, keep the new one
+ eNewStrikeout = eStrikeout;
+ break;
+ }
+ default:
+ OSL_ENSURE( bRet, "unexpected line type value" );
+ break;
+ }
+ if( eNewStrikeout != eStrikeout )
+ rValue <<= (sal_Int16)eNewStrikeout;
+ }
+ else
+ {
+ rValue <<= (sal_Int16)eNewStrikeout;
+ }
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLCrossedOutWidthPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int16 nValue = sal_Int16();
+ OUStringBuffer aOut;
+
+ if( (rValue >>= nValue) && (FontStrikeout::BOLD == nValue) )
+ {
+ bRet = SvXMLUnitConverter::convertEnum(
+ aOut, (sal_uInt16)nValue, pXML_CrossedoutWidth_Enum );
+ if( bRet )
+ rStrExpValue = aOut.makeStringAndClear();
+ }
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLCrossedOutTextPropHdl
+//
+
+XMLCrossedOutTextPropHdl::~XMLCrossedOutTextPropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLCrossedOutTextPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+
+ if( rStrImpValue.getLength() )
+ {
+ sal_Int16 eStrikeout = ('/' == rStrImpValue[0]
+ ? FontStrikeout::SLASH
+ : FontStrikeout::X);
+ rValue <<= (sal_Int16)eStrikeout;
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLCrossedOutTextPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int16 nValue = sal_Int16();
+
+ if( (rValue >>= nValue) &&
+ (FontStrikeout::SLASH == nValue || FontStrikeout::X == nValue) )
+ {
+ rStrExpValue = OUString::valueOf(
+ static_cast< sal_Unicode>( FontStrikeout::SLASH == nValue ? '/'
+ : 'X' ) );
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/cdouthdl.hxx b/xmloff/source/style/cdouthdl.hxx
new file mode 100644
index 000000000000..46779e10c70c
--- /dev/null
+++ b/xmloff/source/style/cdouthdl.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PROPERTYHANDLER_CROSSEDOUTTYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_CROSSEDOUTTYPES_HXX
+
+#include <xmloff/xmlprhdl.hxx>
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLCrossedOutTypePropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLCrossedOutTypePropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+class XMLCrossedOutStylePropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLCrossedOutStylePropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+class XMLCrossedOutWidthPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLCrossedOutWidthPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+class XMLCrossedOutTextPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLCrossedOutTextPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_CROSSEDOUTTYPES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/chrhghdl.cxx b/xmloff/source/style/chrhghdl.cxx
new file mode 100644
index 000000000000..d805d9a1274b
--- /dev/null
+++ b/xmloff/source/style/chrhghdl.cxx
@@ -0,0 +1,169 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+#include <chrhghdl.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "xmlehelp.hxx"
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/uno/Any.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+
+// this is a copy of defines in svx/inc/escpitem.hxx
+#define DFLT_ESC_PROP 58
+#define DFLT_ESC_AUTO_SUPER 101
+#define DFLT_ESC_AUTO_SUB -101
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLEscapementPropHdl
+//
+
+XMLCharHeightHdl::~XMLCharHeightHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLCharHeightHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ double fSize;
+
+ if( rStrImpValue.indexOf( sal_Unicode('%') ) == -1 )
+ {
+ MapUnit eSrcUnit = SvXMLExportHelper::GetUnitFromString( rStrImpValue, MAP_POINT );
+ if( SvXMLUnitConverter::convertDouble( fSize, rStrImpValue, eSrcUnit, MAP_POINT ))
+ {
+ rValue <<= (float)fSize;
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+}
+
+sal_Bool XMLCharHeightHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ OUStringBuffer aOut;
+
+ float fSize = 0;
+ if( rValue >>= fSize )
+ {
+ SvXMLUnitConverter::convertDouble( aOut, (double)fSize, sal_True, MAP_POINT, MAP_POINT );
+ aOut.append( sal_Unicode('p'));
+ aOut.append( sal_Unicode('t'));
+ }
+
+ rStrExpValue = aOut.makeStringAndClear();
+ return rStrExpValue.getLength() != 0;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLEscapementHeightPropHdl
+//
+
+XMLCharHeightPropHdl::~XMLCharHeightPropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLCharHeightPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Int32 nPrc = 100;
+
+ if( rStrImpValue.indexOf( sal_Unicode('%') ) != -1 )
+ {
+ if( SvXMLUnitConverter::convertPercent( nPrc, rStrImpValue ) )
+ {
+ rValue <<= (sal_Int16)nPrc;
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+}
+
+sal_Bool XMLCharHeightPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ OUStringBuffer aOut( rStrExpValue );
+
+ sal_Int16 nValue = sal_Int16();
+ if( rValue >>= nValue )
+ {
+ SvXMLUnitConverter::convertPercent( aOut, nValue );
+ }
+
+ rStrExpValue = aOut.makeStringAndClear();
+ return rStrExpValue.getLength() != 0;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLEscapementPropHdl
+//
+
+XMLCharHeightDiffHdl::~XMLCharHeightDiffHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLCharHeightDiffHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Int32 nRel = 0;
+
+ if( SvXMLUnitConverter::convertMeasure( nRel, rStrImpValue, MAP_POINT ) )
+ {
+ rValue <<= (float)nRel;
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+sal_Bool XMLCharHeightDiffHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ OUStringBuffer aOut;
+
+ float nRel = 0;
+ if( (rValue >>= nRel) && (nRel != 0) )
+ {
+ SvXMLUnitConverter::convertMeasure( aOut, (sal_Int32)nRel, MAP_POINT, MAP_POINT );
+ rStrExpValue = aOut.makeStringAndClear();
+ }
+
+ return rStrExpValue.getLength() != 0;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/chrhghdl.hxx b/xmloff/source/style/chrhghdl.hxx
new file mode 100644
index 000000000000..9d39294eb6c7
--- /dev/null
+++ b/xmloff/source/style/chrhghdl.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PROPERTYHANDLER_CHARHEIGHTTYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_CHARHEIGHTTYPES_HXX
+
+#include <xmloff/xmlprhdl.hxx>
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLCharHeightHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLCharHeightHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+class XMLCharHeightPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLCharHeightPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+class XMLCharHeightDiffHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLCharHeightDiffHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_CHARHEIGHTTYPES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/chrlohdl.cxx b/xmloff/source/style/chrlohdl.cxx
new file mode 100644
index 000000000000..a7fedf6456a4
--- /dev/null
+++ b/xmloff/source/style/chrlohdl.cxx
@@ -0,0 +1,147 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+#include <chrlohdl.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/lang/Locale.hpp>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+// this is a copy of defines in svx/inc/escpitem.hxx
+#define DFLT_ESC_PROP 58
+#define DFLT_ESC_AUTO_SUPER 101
+#define DFLT_ESC_AUTO_SUB -101
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLEscapementPropHdl
+//
+
+XMLCharLanguageHdl::~XMLCharLanguageHdl()
+{
+ // nothing to do
+}
+
+bool XMLCharLanguageHdl::equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const
+{
+ sal_Bool bRet = sal_False;
+ lang::Locale aLocale1, aLocale2;
+
+ if( ( r1 >>= aLocale1 ) && ( r2 >>= aLocale2 ) )
+ bRet = ( aLocale1.Language == aLocale2.Language );
+
+ return bRet;
+}
+
+sal_Bool XMLCharLanguageHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ lang::Locale aLocale;
+
+ rValue >>= aLocale;
+
+ if( !IsXMLToken(rStrImpValue, XML_NONE) )
+ aLocale.Language = rStrImpValue;
+
+ rValue <<= aLocale;
+ return sal_True;
+}
+
+sal_Bool XMLCharLanguageHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ lang::Locale aLocale;
+ if(!(rValue >>= aLocale))
+ return sal_False;
+
+ rStrExpValue = aLocale.Language;
+
+ if( !rStrExpValue.getLength() )
+ rStrExpValue = GetXMLToken( XML_NONE );
+
+ return sal_True;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLEscapementHeightPropHdl
+//
+
+XMLCharCountryHdl::~XMLCharCountryHdl()
+{
+ // nothing to do
+}
+
+bool XMLCharCountryHdl::equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const
+{
+ sal_Bool bRet = sal_False;
+ lang::Locale aLocale1, aLocale2;
+
+ if( ( r1 >>= aLocale1 ) && ( r2 >>= aLocale2 ) )
+ bRet = ( aLocale1.Country == aLocale2.Country );
+
+ return bRet;
+}
+
+sal_Bool XMLCharCountryHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ lang::Locale aLocale;
+
+ rValue >>= aLocale;
+
+ if( !IsXMLToken( rStrImpValue, XML_NONE ) )
+ aLocale.Country = rStrImpValue;
+
+ rValue <<= aLocale;
+ return sal_True;
+}
+
+sal_Bool XMLCharCountryHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ lang::Locale aLocale;
+ if(!(rValue >>= aLocale))
+ return sal_False;
+
+ rStrExpValue = aLocale.Country;
+
+ if( !rStrExpValue.getLength() )
+ rStrExpValue = GetXMLToken( XML_NONE );
+
+ return sal_True;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/chrlohdl.hxx b/xmloff/source/style/chrlohdl.hxx
new file mode 100644
index 000000000000..1b1f46b3e08f
--- /dev/null
+++ b/xmloff/source/style/chrlohdl.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PROPERTYHANDLER_CHARLOCALETYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_CHARLOCALETYPES_HXX
+
+#include <xmloff/xmlprhdl.hxx>
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLCharLanguageHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLCharLanguageHdl();
+
+ virtual bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const;
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+class XMLCharCountryHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLCharCountryHdl();
+
+ virtual bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const;
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_CHARLOCALETYPES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/csmaphdl.cxx b/xmloff/source/style/csmaphdl.cxx
new file mode 100644
index 000000000000..6bbd31057319
--- /dev/null
+++ b/xmloff/source/style/csmaphdl.cxx
@@ -0,0 +1,141 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <csmaphdl.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/style/CaseMap.hpp>
+#include <com/sun/star/uno/Any.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+static SvXMLEnumMapEntry pXML_Casemap_Enum[] =
+{
+ { XML_NONE, style::CaseMap::NONE },
+ { XML_CASEMAP_LOWERCASE, style::CaseMap::LOWERCASE },
+ { XML_CASEMAP_UPPERCASE, style::CaseMap::UPPERCASE },
+ { XML_CASEMAP_CAPITALIZE, style::CaseMap::TITLE },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLPosturePropHdl
+//
+
+XMLCaseMapPropHdl::~XMLCaseMapPropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLCaseMapPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_uInt16 nVal;
+ sal_Bool bRet = SvXMLUnitConverter::convertEnum(
+ nVal, rStrImpValue, pXML_Casemap_Enum );
+ if( ( bRet ) )
+ rValue <<= nVal;
+
+ return bRet;
+}
+
+sal_Bool XMLCaseMapPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_uInt16 nValue = sal_uInt16();
+ OUStringBuffer aOut;
+
+ if( rValue >>= nValue )
+ {
+ bRet = SvXMLUnitConverter::convertEnum(
+ aOut, nValue, pXML_Casemap_Enum );
+ if( bRet )
+ rStrExpValue = aOut.makeStringAndClear();
+ }
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLCaseMapVariantHdl
+//
+
+XMLCaseMapVariantHdl::~XMLCaseMapVariantHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLCaseMapVariantHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+
+ if( IsXMLToken( rStrImpValue, XML_CASEMAP_SMALL_CAPS ) )
+ {
+ rValue <<= (sal_Int16)style::CaseMap::SMALLCAPS;
+ bRet = sal_True;
+ }
+ else if( IsXMLToken( rStrImpValue, XML_CASEMAP_NORMAL ) )
+ {
+ rValue <<= (sal_Int16)style::CaseMap::NONE;
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLCaseMapVariantHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_uInt16 nValue = sal_uInt16();
+ OUStringBuffer aOut;
+
+ if( rValue >>= nValue )
+ {
+ switch( nValue )
+ {
+ case style::CaseMap::NONE:
+ aOut.append( GetXMLToken(XML_CASEMAP_NORMAL) );
+ break;
+ case style::CaseMap::SMALLCAPS:
+ aOut.append( GetXMLToken(XML_CASEMAP_SMALL_CAPS) );
+ break;
+ }
+ }
+
+ rStrExpValue = aOut.makeStringAndClear();
+ return rStrExpValue.getLength() != 0;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/csmaphdl.hxx b/xmloff/source/style/csmaphdl.hxx
new file mode 100644
index 000000000000..d437d1a7e559
--- /dev/null
+++ b/xmloff/source/style/csmaphdl.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PROPERTYHANDLER_CASEMAPTYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_CASEMAPTYPES_HXX
+
+#include <xmloff/xmlprhdl.hxx>
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLCaseMapPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLCaseMapPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+class XMLCaseMapVariantHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLCaseMapVariantHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_CASEMAPTYPES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/durationhdl.cxx b/xmloff/source/style/durationhdl.cxx
new file mode 100644
index 000000000000..d25dcb6f911d
--- /dev/null
+++ b/xmloff/source/style/durationhdl.cxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "durationhdl.hxx"
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/util/DateTime.hpp>
+#include <rtl/ustrbuf.hxx>
+#include <xmloff/xmluconv.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+
+// ---------------------------------------------------------------------------
+
+
+sal_Bool XMLDurationMS16PropHdl_Impl::importXML(
+ const OUString& rStrImpValue,
+ Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ DateTime aTime;
+ if( !SvXMLUnitConverter::convertTime( aTime, rStrImpValue ) )
+ return false;
+
+ const sal_Int16 nMS = ( ( aTime.Hours * 60 + aTime.Minutes ) * 60 + aTime.Seconds ) * 100 + aTime.HundredthSeconds;
+ rValue <<= nMS;
+
+ return sal_True;
+}
+
+sal_Bool XMLDurationMS16PropHdl_Impl::exportXML(
+ OUString& rStrExpValue,
+ const Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ sal_Int16 nMS = sal_Int16();
+
+ if(rValue >>= nMS)
+ {
+ OUStringBuffer aOut;
+ DateTime aTime( nMS, 0, 0, 0, 0, 0, 0 );
+ SvXMLUnitConverter::convertTime( aOut, aTime );
+ rStrExpValue = aOut.makeStringAndClear();
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+XMLDurationMS16PropHdl_Impl::~XMLDurationMS16PropHdl_Impl()
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/durationhdl.hxx b/xmloff/source/style/durationhdl.hxx
new file mode 100644
index 000000000000..356c5ddf5df1
--- /dev/null
+++ b/xmloff/source/style/durationhdl.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PROPERTYHANDLER_DURATIONS_HXX
+#define _XMLOFF_PROPERTYHANDLER_DURATIONS_HXX
+
+#include <xmloff/xmlprhdl.hxx>
+
+/**
+ PropertyHandler for a sal_int16 duration in ms:
+*/
+class XMLDurationMS16PropHdl_Impl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLDurationMS16PropHdl_Impl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_FMTSPLITTYPES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/escphdl.cxx b/xmloff/source/style/escphdl.cxx
new file mode 100644
index 000000000000..f0bbd43f793b
--- /dev/null
+++ b/xmloff/source/style/escphdl.cxx
@@ -0,0 +1,175 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+#include <escphdl.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/uno/Any.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+// this is a copy of defines in svx/inc/escpitem.hxx
+#define DFLT_ESC_PROP 58
+#define DFLT_ESC_AUTO_SUPER 101
+#define DFLT_ESC_AUTO_SUB -101
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLEscapementPropHdl
+//
+
+XMLEscapementPropHdl::~XMLEscapementPropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLEscapementPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Int16 nVal;
+
+ SvXMLTokenEnumerator aTokens( rStrImpValue );
+
+ OUString aToken;
+ if( ! aTokens.getNextToken( aToken ) )
+ return sal_False;
+
+ if( IsXMLToken( aToken, XML_ESCAPEMENT_SUB ) )
+ {
+ nVal = DFLT_ESC_AUTO_SUB;
+ }
+ else if( IsXMLToken( aToken, XML_ESCAPEMENT_SUPER ) )
+ {
+ nVal = DFLT_ESC_AUTO_SUPER;
+ }
+ else
+ {
+ sal_Int32 nNewEsc;
+ if( !SvXMLUnitConverter::convertPercent( nNewEsc, aToken ) )
+ return sal_False;
+
+ nVal = (sal_Int16) nNewEsc;
+ }
+
+ rValue <<= nVal;
+ return sal_True;
+}
+
+sal_Bool XMLEscapementPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Int32 nValue = 0;
+ OUStringBuffer aOut;
+
+ if( rValue >>= nValue )
+ {
+ if( nValue == DFLT_ESC_AUTO_SUPER )
+ {
+ aOut.append( GetXMLToken(XML_ESCAPEMENT_SUPER) );
+ }
+ else if( nValue == DFLT_ESC_AUTO_SUB )
+ {
+ aOut.append( GetXMLToken(XML_ESCAPEMENT_SUB) );
+ }
+ else
+ {
+ SvXMLUnitConverter::convertPercent( aOut, nValue );
+ }
+ }
+
+ rStrExpValue = aOut.makeStringAndClear();
+ return sal_True;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLEscapementHeightPropHdl
+//
+
+XMLEscapementHeightPropHdl::~XMLEscapementHeightPropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLEscapementHeightPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ if( IsXMLToken( rStrImpValue, XML_CASEMAP_SMALL_CAPS ) )
+ return sal_False;
+
+ SvXMLTokenEnumerator aTokens( rStrImpValue );
+
+ OUString aToken;
+ if( ! aTokens.getNextToken( aToken ) )
+ return sal_False;
+
+ sal_Int8 nProp;
+ if( aTokens.getNextToken( aToken ) )
+ {
+ sal_Int32 nNewProp;
+ if( !SvXMLUnitConverter::convertPercent( nNewProp, aToken ) )
+ return sal_False;
+ nProp = (sal_Int8)nNewProp;
+ }
+ else
+ {
+ sal_Int32 nEscapementPosition=0;
+ if( SvXMLUnitConverter::convertPercent( nEscapementPosition, aToken ) && nEscapementPosition==0 )
+ nProp = 100; //if escapement position is zero and no escapement height is given the default height should be 100percent and not something smaller (#i91800#)
+ else
+ nProp = (sal_Int8) DFLT_ESC_PROP;
+ }
+
+ rValue <<= nProp;
+ return sal_True;
+}
+
+sal_Bool XMLEscapementHeightPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ OUStringBuffer aOut( rStrExpValue );
+
+ sal_Int32 nValue = 0;
+ if( rValue >>= nValue )
+ {
+ if( rStrExpValue.getLength() )
+ aOut.append( sal_Unicode(' '));
+
+ SvXMLUnitConverter::convertPercent( aOut, nValue );
+ }
+
+ rStrExpValue = aOut.makeStringAndClear();
+ return rStrExpValue.getLength() != 0;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/escphdl.hxx b/xmloff/source/style/escphdl.hxx
new file mode 100644
index 000000000000..e3021e3b26dc
--- /dev/null
+++ b/xmloff/source/style/escphdl.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PROPERTYHANDLER_ESCAPETYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_ESCAPETYPES_HXX
+
+#include <xmloff/xmlprhdl.hxx>
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLEscapementPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLEscapementPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+class XMLEscapementHeightPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLEscapementHeightPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_ESCAPETYPES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/fonthdl.cxx b/xmloff/source/style/fonthdl.cxx
new file mode 100644
index 000000000000..03f0ccfb69ee
--- /dev/null
+++ b/xmloff/source/style/fonthdl.cxx
@@ -0,0 +1,322 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <fonthdl.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <tools/fontenum.hxx>
+
+#include <tools/string.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+const SvXMLEnumMapEntry* lcl_getFontFamilyGenericMapping()
+{
+ static SvXMLEnumMapEntry const aFontFamilyGenericMapping[] =
+ {
+ { XML_DECORATIVE, FAMILY_DECORATIVE },
+
+ { XML_MODERN, FAMILY_MODERN },
+ { XML_ROMAN, FAMILY_ROMAN },
+ { XML_SCRIPT, FAMILY_SCRIPT },
+ { XML_SWISS, FAMILY_SWISS },
+ { XML_SYSTEM, FAMILY_SYSTEM },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ return aFontFamilyGenericMapping;
+}
+
+static SvXMLEnumMapEntry const aFontPitchMapping[] =
+{
+ { XML_FIXED, PITCH_FIXED },
+ { XML_VARIABLE, PITCH_VARIABLE },
+ { XML_TOKEN_INVALID, 0 }
+};
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLFontFamilyNamePropHdl
+//
+
+XMLFontFamilyNamePropHdl::~XMLFontFamilyNamePropHdl()
+{
+ // Nothing to do
+}
+
+sal_Bool XMLFontFamilyNamePropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ String sValue;
+ sal_Int32 nPos = 0;
+
+ do
+ {
+ sal_Int32 nFirst = nPos;
+ nPos = SvXMLUnitConverter::indexOfComma( rStrImpValue, nPos );
+ sal_Int32 nLast = (-1 == nPos ? rStrImpValue.getLength() : nPos);
+ if( nLast > 0 )
+ nLast--;
+
+ // skip trailing blanks
+ while( sal_Unicode(' ') == rStrImpValue[nLast] && nLast > nFirst )
+ nLast--;
+
+ // skip leading blanks
+ while( sal_Unicode(' ') == rStrImpValue[nFirst] && nFirst <= nLast )
+ nFirst++;
+
+ // remove quotes
+ sal_Unicode c = rStrImpValue[nFirst];
+ if( nFirst < nLast && (sal_Unicode('\'') == c || sal_Unicode('\"') == c) && rStrImpValue[nLast] == c )
+ {
+ nFirst++;
+ nLast--;
+ }
+
+ if( nFirst <= nLast )
+ {
+ if( sValue.Len() != 0 )
+ sValue += sal_Unicode(';');
+
+ OUString sTemp = rStrImpValue.copy( nFirst, nLast-nFirst+1 );
+ sValue += sTemp.getStr();
+ }
+
+ if( -1 != nPos )
+ nPos++;
+ }
+ while( -1 != nPos );
+
+ if( sValue.Len() )
+ {
+ rValue <<= OUString(sValue.GetBuffer());
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLFontFamilyNamePropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ OUString aStrFamilyName;
+
+ if( rValue >>= aStrFamilyName )
+ {
+ OUStringBuffer sValue( aStrFamilyName.getLength() + 2L );
+ sal_Int32 nPos = 0;
+ do
+ {
+ sal_Int32 nFirst = nPos;
+ nPos = aStrFamilyName.indexOf( sal_Unicode(';'), nPos );
+ sal_Int32 nLast = (-1 == nPos ? aStrFamilyName.getLength() : nPos);
+
+ // Set position to the character behind the ';', so we won't
+ // forget this.
+ if( -1L != nPos )
+ nPos++;
+
+ // If the property value was empty, we stop now.
+ // If there is a ';' at the first position, the empty name
+ // at the start will be removed.
+ if( 0L == nLast )
+ continue;
+
+ // nFirst and nLast now denote the first and last character of
+ // one font name.
+ nLast--;
+
+ // skip trailing blanks
+ while( sal_Unicode(' ') == aStrFamilyName[nLast] && nLast > nFirst )
+ nLast--;
+
+ // skip leading blanks
+ while( sal_Unicode(' ') == aStrFamilyName[nFirst] && nFirst <= nLast )
+ nFirst++;
+
+ if( nFirst <= nLast )
+ {
+ if( sValue.getLength() != 0L )
+ {
+ sValue.append( sal_Unicode( ',' ) );
+ sValue.append( sal_Unicode( ' ' ));
+ }
+ sal_Int32 nLen = nLast-nFirst+1;
+ OUString sFamily( aStrFamilyName.copy( nFirst, nLen ) );
+ sal_Bool bQuote = sal_False;
+ for( sal_Int32 i=0; i < nLen; i++ )
+ {
+ sal_Unicode c = sFamily[i];
+ if( sal_Unicode(' ') == c || sal_Unicode(',') == c )
+ {
+ bQuote = sal_True;
+ break;
+ }
+ }
+ if( bQuote )
+ sValue.append( sal_Unicode('\'') );
+ sValue.append( sFamily );
+ if( bQuote )
+ sValue.append( sal_Unicode('\'') );
+ }
+ }
+ while( -1L != nPos );
+
+ rStrExpValue = sValue.makeStringAndClear();
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLFontFamilyPropHdl
+//
+
+XMLFontFamilyPropHdl::~XMLFontFamilyPropHdl()
+{
+ // Nothing to do
+}
+
+sal_Bool XMLFontFamilyPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_uInt16 eNewFamily;
+ sal_Bool bRet = SvXMLUnitConverter::convertEnum( eNewFamily, rStrImpValue, lcl_getFontFamilyGenericMapping() );
+ if( bRet )
+ rValue <<= (sal_Int16)eNewFamily;
+
+ return bRet;
+}
+
+sal_Bool XMLFontFamilyPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ OUStringBuffer aOut;
+
+ sal_Int16 nFamily = sal_Int16();
+ if( rValue >>= nFamily )
+ {
+ FontFamily eFamily = (FontFamily)nFamily;
+ if( eFamily != FAMILY_DONTKNOW )
+ bRet = SvXMLUnitConverter::convertEnum( aOut, eFamily, lcl_getFontFamilyGenericMapping() );
+ }
+
+ rStrExpValue = aOut.makeStringAndClear();
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLFontEncodingPropHdl
+//
+
+XMLFontEncodingPropHdl::~XMLFontEncodingPropHdl()
+{
+ // Nothing to do
+}
+
+sal_Bool XMLFontEncodingPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_True;
+
+ if( IsXMLToken( rStrImpValue, XML_X_SYMBOL ) )
+ rValue <<= (sal_Int16) RTL_TEXTENCODING_SYMBOL;
+
+ return bRet;
+}
+
+sal_Bool XMLFontEncodingPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ OUStringBuffer aOut;
+ sal_Int16 nSet = sal_Int16();
+
+ if( rValue >>= nSet )
+ {
+ if( (rtl_TextEncoding)nSet == RTL_TEXTENCODING_SYMBOL )
+ {
+ aOut.append( GetXMLToken(XML_X_SYMBOL) );
+ rStrExpValue = aOut.makeStringAndClear();
+ bRet = sal_True;
+ }
+ }
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLFontPitchPropHdl
+//
+
+XMLFontPitchPropHdl::~XMLFontPitchPropHdl()
+{
+ // Nothing to do
+}
+
+sal_Bool XMLFontPitchPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_uInt16 eNewPitch;
+ sal_Bool bRet = SvXMLUnitConverter::convertEnum( eNewPitch, rStrImpValue, aFontPitchMapping );
+ if( bRet )
+ rValue <<= (sal_Int16)eNewPitch;
+
+ return bRet;
+}
+
+sal_Bool XMLFontPitchPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int16 nPitch = sal_Int16();
+ OUStringBuffer aOut;
+
+ FontPitch ePitch = PITCH_DONTKNOW;
+ if( rValue >>= nPitch )
+ ePitch = (FontPitch)nPitch;
+
+ if( PITCH_DONTKNOW != ePitch )
+ {
+ bRet = SvXMLUnitConverter::convertEnum( aOut, ePitch, aFontPitchMapping, XML_FIXED );
+ rStrExpValue = aOut.makeStringAndClear();
+ }
+
+ return bRet;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/fonthdl.hxx b/xmloff/source/style/fonthdl.hxx
new file mode 100644
index 000000000000..3efb801ae3ac
--- /dev/null
+++ b/xmloff/source/style/fonthdl.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 XMLOFF_PROPERTYHANDLER_FONTTYPES_HXX
+#define XMLOFF_PROPERTYHANDLER_FONTTYPES_HXX
+
+#include <xmloff/xmlprhdl.hxx>
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLFontFamilyNamePropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLFontFamilyNamePropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLFontFamilyPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLFontFamilyPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLFontEncodingPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLFontEncodingPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLFontPitchPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLFontPitchPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+
+#endif // XMLOFF_PROPERTYHANDLER_FONTTYPES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/impastp1.cxx b/xmloff/source/style/impastp1.cxx
new file mode 100644
index 000000000000..8cfdcb3d994a
--- /dev/null
+++ b/xmloff/source/style/impastp1.cxx
@@ -0,0 +1,135 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#include "impastpl.hxx"
+
+using ::rtl::OUString;
+
+//#############################################################################
+//
+// Class XMLFamilyData_Impl
+//
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// ctor/dtor class XMLFamilyData_Impl
+//
+
+XMLFamilyData_Impl::XMLFamilyData_Impl(
+ sal_Int32 nFamily,
+ const ::rtl::OUString& rStrName,
+ const UniReference < SvXMLExportPropertyMapper > &rMapper,
+ const OUString& rStrPrefix,
+ sal_Bool bAsFam )
+ : pCache( 0 ), mnFamily( nFamily ), maStrFamilyName( rStrName), mxMapper( rMapper ),
+ mnCount( 0 ), mnName( 0 ), maStrPrefix( rStrPrefix ), bAsFamily( bAsFam )
+
+{
+ mpParentList = new SvXMLAutoStylePoolParentsP_Impl( 5, 5 );
+ mpNameList = new SvXMLAutoStylePoolNamesP_Impl( 5, 5 );
+}
+
+XMLFamilyData_Impl::~XMLFamilyData_Impl()
+{
+ if( mpParentList ) delete mpParentList;
+ if( mpNameList ) delete mpNameList;
+ DBG_ASSERT( !pCache || !pCache->size(), "auto style pool cache is not empty!" );
+ if( pCache )
+ {
+ for ( size_t i = 0, n = pCache->size(); i < n; ++i )
+ delete (*pCache)[ i ];
+ pCache->clear();
+ delete pCache;
+ }
+}
+
+void XMLFamilyData_Impl::ClearEntries()
+{
+ if( mpParentList )
+ delete mpParentList;
+ mpParentList = new SvXMLAutoStylePoolParentsP_Impl( 5, 5 );
+ DBG_ASSERT( !pCache || !pCache->size(), "auto style pool cache is not empty!" );
+ if( pCache )
+ {
+ for ( size_t i = 0, n = pCache->size(); i < n; ++i )
+ delete (*pCache)[ i ];
+ pCache->clear();
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// friendfunction of class XMLFamilyData_Impl for sorting listelements
+//
+
+int XMLFamilyDataSort_Impl( const XMLFamilyData_Impl& r1, const XMLFamilyData_Impl& r2 )
+{
+ int nRet = 0;
+
+ if( r1.mnFamily != r2.mnFamily )
+ nRet = ( r1.mnFamily > r2.mnFamily ? 1 : -1 );
+
+ return nRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Implementation of sorted list of XMLFamilyData_Impl - elements
+//
+
+IMPL_CONTAINER_SORT( XMLFamilyDataList_Impl, XMLFamilyData_Impl, XMLFamilyDataSort_Impl )
+
+//#############################################################################
+//
+// Sorted list of OUString - elements
+//
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Sort-function for OUString-list
+//
+
+int SvXMLAutoStylePoolNamesPCmp_Impl( const OUString& r1,
+ const OUString& r2 )
+{
+ return (int)r1.compareTo( r2 );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Implementation of sorted OUString-list
+//
+
+IMPL_CONTAINER_SORT( SvXMLAutoStylePoolNamesP_Impl,
+ OUString,
+ SvXMLAutoStylePoolNamesPCmp_Impl )
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/impastp2.cxx b/xmloff/source/style/impastp2.cxx
new file mode 100644
index 000000000000..d152fe0c70bb
--- /dev/null
+++ b/xmloff/source/style/impastp2.cxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <rtl/ustrbuf.hxx>
+#include "impastpl.hxx"
+
+using namespace std;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+//#############################################################################
+//
+// Class SvXMLAutoStylePoolProperties_Impl
+//
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// ctor class SvXMLAutoStylePoolProperties_Impl
+//
+
+SvXMLAutoStylePoolPropertiesP_Impl::SvXMLAutoStylePoolPropertiesP_Impl( XMLFamilyData_Impl* pFamilyData, const vector< XMLPropertyState >& rProperties )
+: maProperties( rProperties ),
+ mnPos ( pFamilyData->mnCount )
+{
+ // create a name that hasn't been used before. The created name has not
+ // to be added to the array, because it will never tried again
+ OUStringBuffer sBuffer( 7 );
+ do
+ {
+ pFamilyData->mnName++;
+ sBuffer.append( pFamilyData->maStrPrefix );
+ sBuffer.append( OUString::valueOf( (sal_Int32)pFamilyData->mnName ) );
+ msName = sBuffer.makeStringAndClear();
+ }
+ while( pFamilyData->mpNameList->Seek_Entry( &msName, 0 ) );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/impastp3.cxx b/xmloff/source/style/impastp3.cxx
new file mode 100644
index 000000000000..0c51db505b17
--- /dev/null
+++ b/xmloff/source/style/impastp3.cxx
@@ -0,0 +1,194 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "impastpl.hxx"
+#include <xmloff/xmlprmap.hxx>
+
+using namespace std;
+
+using ::rtl::OUString;
+
+//#############################################################################
+//
+// Class SvXMLAutoStylePoolParent_Impl
+//
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// dtor class SvXMLAutoStylePoolParent_Impl
+//
+
+SvXMLAutoStylePoolParentP_Impl::~SvXMLAutoStylePoolParentP_Impl()
+{
+ for( size_t i = maPropertiesList.size(); i > 0; )
+ delete maPropertiesList[ --i ];
+ maPropertiesList.clear();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Adds a array of XMLPropertyState ( vector< XMLPropertyState > ) to list
+// if not added, yet.
+//
+
+sal_Bool SvXMLAutoStylePoolParentP_Impl::Add( XMLFamilyData_Impl* pFamilyData, const vector< XMLPropertyState >& rProperties, OUString& rName, bool bDontSeek )
+{
+ sal_Bool bAdded = sal_False;
+ SvXMLAutoStylePoolPropertiesP_Impl *pProperties = 0;
+ size_t i = 0;
+ sal_Int32 nProperties = rProperties.size();
+ size_t nCount = maPropertiesList.size();
+
+ for( i = 0; i < nCount; i++ )
+ {
+ SvXMLAutoStylePoolPropertiesP_Impl *pIS = maPropertiesList[ i ];
+ if( nProperties > (sal_Int32)pIS->GetProperties().size() )
+ {
+ continue;
+ }
+ else if( nProperties < (sal_Int32)pIS->GetProperties().size() )
+ {
+ break;
+ }
+ else if( !bDontSeek && pFamilyData->mxMapper->Equals( pIS->GetProperties(), rProperties ) )
+ {
+ pProperties = pIS;
+ break;
+ }
+ }
+
+ if( !pProperties )
+ {
+ pProperties = new SvXMLAutoStylePoolPropertiesP_Impl( pFamilyData, rProperties );
+ SvXMLAutoStylePoolPropertiesPList_Impl::iterator it = maPropertiesList.begin();
+ ::std::advance( it, i );
+ maPropertiesList.insert( it, pProperties );
+ bAdded = sal_True;
+ }
+
+ rName = pProperties->GetName();
+
+ return bAdded;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Adds a array of XMLPropertyState ( vector< XMLPropertyState > ) with a given name.
+// If the name exists already, nothing is done. If a style with a different name and
+// the same properties exists, a new one is added (like with bDontSeek).
+//
+
+sal_Bool SvXMLAutoStylePoolParentP_Impl::AddNamed( XMLFamilyData_Impl* pFamilyData, const vector< XMLPropertyState >& rProperties, const OUString& rName )
+{
+ sal_Bool bAdded = sal_False;
+ size_t i = 0;
+ sal_Int32 nProperties = rProperties.size();
+ size_t nCount = maPropertiesList.size();
+
+ for( i = 0; i < nCount; i++ )
+ {
+ SvXMLAutoStylePoolPropertiesP_Impl *pIS = maPropertiesList[ i ];
+ if( nProperties > (sal_Int32)pIS->GetProperties().size() )
+ {
+ continue;
+ }
+ else if( nProperties < (sal_Int32)pIS->GetProperties().size() )
+ {
+ break;
+ }
+ }
+
+ if( !pFamilyData->mpNameList->Seek_Entry( &rName, 0 ) )
+ {
+ SvXMLAutoStylePoolPropertiesP_Impl* pProperties =
+ new SvXMLAutoStylePoolPropertiesP_Impl( pFamilyData, rProperties );
+ // ignore the generated name
+ pProperties->SetName( rName );
+ SvXMLAutoStylePoolPropertiesPList_Impl::iterator it = maPropertiesList.begin();
+ ::std::advance( it, i );
+ maPropertiesList.insert( it, pProperties );
+ bAdded = sal_True;
+ }
+
+ return bAdded;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Search for a array of XMLPropertyState ( vector< XMLPropertyState > ) in list
+//
+
+OUString SvXMLAutoStylePoolParentP_Impl::Find( const XMLFamilyData_Impl* pFamilyData, const vector< XMLPropertyState >& rProperties ) const
+{
+ OUString sName;
+ vector< XMLPropertyState>::size_type nItems = rProperties.size();
+ size_t nCount = maPropertiesList.size();
+ for( size_t i = 0; i < nCount; i++ )
+ {
+ SvXMLAutoStylePoolPropertiesP_Impl *pIS = maPropertiesList[ i ];
+ if( nItems > pIS->GetProperties().size() )
+ {
+ continue;
+ }
+ else if( nItems < pIS->GetProperties().size() )
+ {
+ break;
+ }
+ else if( pFamilyData->mxMapper->Equals( pIS->GetProperties(), rProperties ) )
+ {
+ sName = pIS->GetName();
+ break;
+ }
+ }
+
+ return sName;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Sort-function for sorted list of SvXMLAutoStylePoolParent_Impl-elements
+//
+
+int SvXMLAutoStylePoolParentPCmp_Impl( const SvXMLAutoStylePoolParentP_Impl& r1,
+ const SvXMLAutoStylePoolParentP_Impl& r2)
+{
+ return (int)r1.GetParent().compareTo( r2.GetParent() );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Implementation of sorted list of SvXMLAutoStylePoolParent_Impl-elements
+//
+
+IMPL_CONTAINER_SORT( SvXMLAutoStylePoolParentsP_Impl,
+ SvXMLAutoStylePoolParentP_Impl,
+ SvXMLAutoStylePoolParentPCmp_Impl )
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/impastp4.cxx b/xmloff/source/style/impastp4.cxx
new file mode 100644
index 000000000000..d6032f54b4ce
--- /dev/null
+++ b/xmloff/source/style/impastp4.cxx
@@ -0,0 +1,523 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#include <xmloff/xmlaustp.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/attrlist.hxx>
+#include "impastpl.hxx"
+#include <xmloff/xmlexppr.hxx>
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/families.hxx>
+#include <xmloff/PageMasterStyleMap.hxx>
+
+using namespace ::std;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+//#############################################################################
+//
+// Class SvXMLAutoStylePool_Impl
+//
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// ctor/dtor class SvXMLAutoStylePool_Impl
+//
+
+SvXMLAutoStylePoolP_Impl::SvXMLAutoStylePoolP_Impl( SvXMLExport& rExp)
+ : rExport( rExp ),
+ maFamilyList( 5, 5 )
+{
+}
+
+SvXMLAutoStylePoolP_Impl::~SvXMLAutoStylePoolP_Impl()
+{
+ for (;;) {
+ XMLFamilyData_Impl* pData = maFamilyList.Remove( sal_uLong(0) );
+ if (pData == NULL) {
+ break;
+ }
+ delete pData;
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Adds stylefamily-informations to sorted list
+//
+
+void SvXMLAutoStylePoolP_Impl::AddFamily(
+ sal_Int32 nFamily,
+ const OUString& rStrName,
+ const UniReference < SvXMLExportPropertyMapper > & rMapper,
+ const OUString& rStrPrefix,
+ sal_Bool bAsFamily )
+{
+ // store family in a list if not already stored
+ sal_uLong nPos;
+
+ sal_uInt16 nExportFlags = GetExport().getExportFlags();
+ sal_Bool bStylesOnly = (nExportFlags & EXPORT_STYLES) != 0 && (nExportFlags & EXPORT_CONTENT) == 0;
+
+ OUString aPrefix( rStrPrefix );
+ if( bStylesOnly )
+ {
+ aPrefix = OUString( 'M' );
+ aPrefix += rStrPrefix;
+ }
+
+ XMLFamilyData_Impl *pFamily = new XMLFamilyData_Impl( nFamily, rStrName, rMapper, aPrefix, bAsFamily );
+ if( !maFamilyList.Seek_Entry( pFamily, &nPos ) )
+ maFamilyList.Insert( pFamily );
+ else
+ delete pFamily;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Adds a name to list
+//
+
+void SvXMLAutoStylePoolP_Impl::RegisterName( sal_Int32 nFamily, const OUString& rName )
+{
+ SvXMLAutoStylePoolNamesP_Impl *pNames = 0;
+
+ sal_uLong nPos;
+ XMLFamilyData_Impl aTmp( nFamily );
+ if( maFamilyList.Seek_Entry( &aTmp, &nPos ) )
+ pNames = maFamilyList.GetObject( nPos )->mpNameList;
+
+ DBG_ASSERT( pNames,
+ "SvXMLAutoStylePool_Impl::RegisterName: unknown family" );
+ if( pNames )
+ {
+ OUString *pName = new OUString( rName );
+ if( !pNames->Insert( pName ) )
+ delete pName;
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Retrieve the list of registered names
+//
+
+void SvXMLAutoStylePoolP_Impl::GetRegisteredNames(
+ uno::Sequence<sal_Int32>& rFamilies,
+ uno::Sequence<OUString>& rNames )
+{
+ // collect registered names + families
+ vector<sal_Int32> aFamilies;
+ vector<OUString> aNames;
+
+ // iterate over families
+ sal_uInt32 nCount = maFamilyList.Count();
+ for( sal_uInt32 i = 0; i < nCount; i++ )
+ {
+ XMLFamilyData_Impl* pFamily = maFamilyList.GetObject( i );
+
+ // iterate over names
+ SvXMLAutoStylePoolNamesP_Impl* pNames = pFamily->mpNameList;
+ sal_uInt32 nNames = ( pNames != NULL ) ? pNames->Count() : 0;
+ for( sal_uInt32 j = 0; j < nNames; j++ )
+ {
+ aFamilies.push_back( pFamily->mnFamily );
+ aNames.push_back( *pNames->GetObject( j ) );
+ }
+ }
+
+ // copy the families + names into the sequence types
+ DBG_ASSERT( aFamilies.size() == aNames.size(), "families != names" );
+
+ rFamilies.realloc( aFamilies.size() );
+ std::copy( aFamilies.begin(), aFamilies.end(), rFamilies.getArray() );
+
+ rNames.realloc( aNames.size() );
+ std::copy( aNames.begin(), aNames.end(), rNames.getArray() );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Adds a array of XMLPropertyState ( vector< XMLPropertyState > ) to list
+// if not added, yet.
+//
+
+sal_Bool SvXMLAutoStylePoolP_Impl::Add(OUString& rName, sal_Int32 nFamily,
+ const OUString& rParent,
+ const ::std::vector< XMLPropertyState >& rProperties,
+ sal_Bool bCache,
+ bool bDontSeek )
+{
+ sal_Bool bRet(sal_False);
+ sal_uLong nPos;
+
+ XMLFamilyData_Impl *pFamily = 0;
+ XMLFamilyData_Impl aTemporary( nFamily );
+ if( maFamilyList.Seek_Entry( &aTemporary, &nPos ) )
+ {
+ pFamily = maFamilyList.GetObject( nPos );
+ }
+
+ DBG_ASSERT( pFamily, "SvXMLAutoStylePool_Impl::Add: unknown family" );
+ if( pFamily )
+ {
+ SvXMLAutoStylePoolParentP_Impl aTmp( rParent );
+ SvXMLAutoStylePoolParentP_Impl *pParent = 0;
+
+ SvXMLAutoStylePoolParentsP_Impl *pParents = pFamily->mpParentList;
+ if( pParents->Seek_Entry( &aTmp, &nPos ) )
+ {
+ pParent = pParents->GetObject( nPos );
+ }
+ else
+ {
+ pParent = new SvXMLAutoStylePoolParentP_Impl( rParent );
+ pParents->Insert( pParent );
+ }
+
+ if( pParent->Add( pFamily, rProperties, rName, bDontSeek ) )
+ {
+ pFamily->mnCount++;
+ bRet = sal_True;
+ }
+
+ if( bCache )
+ {
+ if( !pFamily->pCache )
+ pFamily->pCache = new SvXMLAutoStylePoolCache_Impl();
+ if( pFamily->pCache->size() < MAX_CACHE_SIZE )
+ pFamily->pCache->push_back( new OUString( rName ) );
+ }
+ }
+
+ return bRet;
+}
+
+sal_Bool SvXMLAutoStylePoolP_Impl::AddNamed(const OUString& rName, sal_Int32 nFamily,
+ const OUString& rParent, const ::std::vector< XMLPropertyState >& rProperties )
+{
+ // get family and parent the same way as in Add()
+ sal_Bool bRet(sal_False);
+ sal_uLong nPos;
+
+ XMLFamilyData_Impl *pFamily = 0;
+ XMLFamilyData_Impl aTemporary( nFamily );
+ if( maFamilyList.Seek_Entry( &aTemporary, &nPos ) )
+ {
+ pFamily = maFamilyList.GetObject( nPos );
+ }
+
+ DBG_ASSERT( pFamily, "SvXMLAutoStylePool_Impl::Add: unknown family" );
+ if( pFamily )
+ {
+ SvXMLAutoStylePoolParentP_Impl aTmp( rParent );
+ SvXMLAutoStylePoolParentP_Impl *pParent = 0;
+
+ SvXMLAutoStylePoolParentsP_Impl *pParents = pFamily->mpParentList;
+ if( pParents->Seek_Entry( &aTmp, &nPos ) )
+ {
+ pParent = pParents->GetObject( nPos );
+ }
+ else
+ {
+ pParent = new SvXMLAutoStylePoolParentP_Impl( rParent );
+ pParents->Insert( pParent );
+ }
+
+ if( pParent->AddNamed( pFamily, rProperties, rName ) )
+ {
+ pFamily->mnCount++;
+ bRet = sal_True;
+ }
+ }
+
+ return bRet;
+}
+
+OUString SvXMLAutoStylePoolP_Impl::AddToCache( sal_Int32 nFamily,
+ const OUString& rParent )
+{
+ sal_uLong nPos;
+
+ XMLFamilyData_Impl *pFamily = 0;
+ XMLFamilyData_Impl aTmp( nFamily );
+ if( maFamilyList.Seek_Entry( &aTmp, &nPos ) )
+ {
+ pFamily = maFamilyList.GetObject( nPos );
+ }
+
+ DBG_ASSERT( pFamily, "SvXMLAutoStylePool_Impl::Add: unknown family" );
+ if( pFamily )
+ {
+ if( !pFamily->pCache )
+ pFamily->pCache = new SvXMLAutoStylePoolCache_Impl();
+ if( pFamily->pCache->size() < MAX_CACHE_SIZE )
+ pFamily->pCache->push_back( new OUString( rParent ) );
+ }
+
+ return rParent;
+}
+///////////////////////////////////////////////////////////////////////////////
+//
+// Search for a array of XMLPropertyState ( vector< XMLPropertyState > ) in list
+//
+
+OUString SvXMLAutoStylePoolP_Impl::Find( sal_Int32 nFamily,
+ const OUString& rParent,
+ const vector< XMLPropertyState >& rProperties ) const
+{
+ OUString sName;
+
+ sal_uLong nPos;
+ XMLFamilyData_Impl aTemporary( nFamily );
+ XMLFamilyData_Impl *pFamily = 0;
+ if( maFamilyList.Seek_Entry( &aTemporary, &nPos ) )
+ {
+ pFamily = maFamilyList.GetObject( nPos );
+ }
+
+ DBG_ASSERT( pFamily, "SvXMLAutoStylePool_Impl::Find: unknown family" );
+
+ if( pFamily )
+ {
+ SvXMLAutoStylePoolParentP_Impl aTmp( rParent );
+
+ const SvXMLAutoStylePoolParentsP_Impl* pParents =
+ pFamily->mpParentList;
+ if( pParents->Seek_Entry( &aTmp, &nPos ) )
+ sName = pParents->GetObject( nPos )->Find( pFamily, rProperties );
+ }
+
+ return sName;
+}
+
+OUString SvXMLAutoStylePoolP_Impl::FindAndRemoveCached( sal_Int32 nFamily ) const
+{
+ OUString sName;
+
+ sal_uLong nPos;
+ XMLFamilyData_Impl aTmp( nFamily );
+ XMLFamilyData_Impl *pFamily = 0;
+ if( maFamilyList.Seek_Entry( &aTmp, &nPos ) )
+ {
+ pFamily = maFamilyList.GetObject( nPos );
+ }
+
+ DBG_ASSERT( pFamily, "SvXMLAutoStylePool_Impl::Find: unknown family" );
+
+ if( pFamily )
+ {
+ DBG_ASSERT( pFamily->pCache, "family doesn't have a cache" );
+
+ // The cache may be empty already. This happens if it was filled
+ // completly.
+ if( pFamily->pCache && !pFamily->pCache->empty() )
+ {
+ OUString *pName = (*pFamily->pCache)[ 0 ];
+ pFamily->pCache->erase( pFamily->pCache->begin() );
+ sName = *pName;
+ delete pName;
+ }
+ }
+
+ return sName;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// export
+//
+
+void SvXMLAutoStylePoolP_Impl::exportXML(
+ sal_Int32 nFamily,
+ const uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > &,
+ const SvXMLUnitConverter&,
+ const SvXMLNamespaceMap&,
+ const SvXMLAutoStylePoolP *pAntiImpl) const
+{
+ sal_uInt32 nCount = 0;
+
+ // Get list of parents for current family (nFamily)
+ sal_uLong nPos;
+ XMLFamilyData_Impl aTmp( nFamily );
+ XMLFamilyData_Impl *pFamily = 0;
+ if( maFamilyList.Seek_Entry( &aTmp, &nPos ) )
+ {
+ pFamily = maFamilyList.GetObject( nPos );
+ nCount = pFamily->mnCount;
+ }
+
+ DBG_ASSERT( pFamily,
+ "SvXMLAutoStylePool_Impl::exportXML: unknown family" );
+ if( pFamily && nCount > 0 )
+ {
+ /////////////////////////////////////////////////////////////////////////////////////
+ // create, initialize and fill helper-structure (SvXMLAutoStylePoolProperties_Impl)
+ // wich contains a parent-name and a SvXMLAutoStylePoolProperties_Impl
+ //
+ const SvXMLAutoStylePoolParentsP_Impl *pParents =
+ pFamily->mpParentList;
+
+ SvXMLAutoStylePoolPExport_Impl* aExpStyles =
+ new SvXMLAutoStylePoolPExport_Impl[nCount];
+
+ sal_uInt32 i;
+ for( i=0; i < nCount; i++ )
+ {
+ aExpStyles[i].mpParent = 0;
+ aExpStyles[i].mpProperties = 0;
+ }
+
+ sal_uInt32 nParents = pParents->Count();
+ for( i=0; i < nParents; i++ )
+ {
+ const SvXMLAutoStylePoolParentP_Impl* pParent =
+ pParents->GetObject( i );
+ size_t nProperties = pParent->GetPropertiesList().size();
+ for( size_t j = 0; j < nProperties; j++ )
+ {
+ const SvXMLAutoStylePoolPropertiesP_Impl* pProperties =
+ pParent->GetPropertiesList()[ j ];
+ nPos = pProperties->GetPos();
+ DBG_ASSERT( nPos < nCount,
+ "SvXMLAutoStylePool_Impl::exportXML: wrong position" );
+ if( nPos < nCount )
+ {
+ DBG_ASSERT( !aExpStyles[nPos].mpProperties,
+ "SvXMLAutoStylePool_Impl::exportXML: double position" );
+ aExpStyles[nPos].mpProperties = pProperties;
+ aExpStyles[nPos].mpParent = &pParent->GetParent();
+ }
+ }
+ }
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ //
+ // create string to export for each XML-style. That means for each property-list
+ //
+ OUString aStrFamilyName = pFamily->maStrFamilyName;
+
+ for( i=0; i<nCount; i++ )
+ {
+ DBG_ASSERT( aExpStyles[i].mpProperties,
+ "SvXMLAutoStylePool_Impl::exportXML: empty position" );
+
+ if( aExpStyles[i].mpProperties )
+ {
+ GetExport().AddAttribute(
+ XML_NAMESPACE_STYLE, XML_NAME,
+ aExpStyles[i].mpProperties->GetName() );
+
+ if( pFamily->bAsFamily )
+ {
+ GetExport().AddAttribute(
+ XML_NAMESPACE_STYLE, XML_FAMILY, aStrFamilyName );
+ }
+
+ if( aExpStyles[i].mpParent->getLength() )
+ {
+ GetExport().AddAttribute(
+ XML_NAMESPACE_STYLE, XML_PARENT_STYLE_NAME,
+ GetExport().EncodeStyleName(
+ *aExpStyles[i].mpParent ) );
+ }
+
+ OUString sName;
+ if( pFamily->bAsFamily )
+ sName = GetXMLToken(XML_STYLE);
+ else
+ sName = pFamily->maStrFamilyName;
+
+ pAntiImpl->exportStyleAttributes(
+ GetExport().GetAttrList(),
+ nFamily,
+ aExpStyles[i].mpProperties->GetProperties(),
+ *pFamily->mxMapper.get()
+ , GetExport().GetMM100UnitConverter(),
+ GetExport().GetNamespaceMap()
+ );
+
+ SvXMLElementExport aElem( GetExport(),
+ XML_NAMESPACE_STYLE, sName,
+ sal_True, sal_True );
+
+ sal_Int32 nStart(-1);
+ sal_Int32 nEnd(-1);
+ if (nFamily == XML_STYLE_FAMILY_PAGE_MASTER)
+ {
+ nStart = 0;
+ sal_Int32 nIndex = 0;
+ UniReference< XMLPropertySetMapper > aPropMapper =
+ pFamily->mxMapper->getPropertySetMapper();
+ sal_Int16 nContextID;
+ while(nIndex < aPropMapper->GetEntryCount() && nEnd == -1)
+ {
+ nContextID = aPropMapper->GetEntryContextId( nIndex );
+ if (nContextID && ((nContextID & CTF_PM_FLAGMASK) != XML_PM_CTF_START))
+ nEnd = nIndex;
+ nIndex++;
+ }
+ if (nEnd == -1)
+ nEnd = nIndex;
+ }
+
+ pFamily->mxMapper->exportXML(
+ GetExport(),
+ aExpStyles[i].mpProperties->GetProperties(),
+ nStart, nEnd, XML_EXPORT_FLAG_IGN_WS );
+
+ pAntiImpl->exportStyleContent(
+ GetExport().GetDocHandler(),
+ nFamily,
+ aExpStyles[i].mpProperties->GetProperties(),
+ *pFamily->mxMapper.get(),
+ GetExport().GetMM100UnitConverter(),
+ GetExport().GetNamespaceMap()
+ );
+ }
+ }
+
+ delete[] aExpStyles;
+ }
+}
+
+void SvXMLAutoStylePoolP_Impl::ClearEntries()
+{
+ for(sal_uInt32 a = 0L; a < maFamilyList.Count(); a++)
+ maFamilyList[a]->ClearEntries();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/impastpl.hxx b/xmloff/source/style/impastpl.hxx
new file mode 100644
index 000000000000..77597257803a
--- /dev/null
+++ b/xmloff/source/style/impastpl.hxx
@@ -0,0 +1,227 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLASTPL_IMPL_HXX
+#define _XMLOFF_XMLASTPL_IMPL_HXX
+
+#include <sal/types.h>
+#include <svl/cntnrsrt.hxx>
+#include <rtl/ustring.hxx>
+#include <vector>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <xmloff/maptype.hxx>
+#include <xmloff/xmlexppr.hxx>
+#include <vector>
+
+class SvXMLAutoStylePoolP;
+class SvXMLAutoStylePoolParentsP_Impl;
+class SvXMLAutoStylePoolNamesP_Impl;
+class SvXMLAttributeList;
+class SvXMLExportPropertyMapper;
+class SvXMLExport;
+
+#define MAX_CACHE_SIZE 65536
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Implementationclass for stylefamily-information
+//
+
+typedef ::rtl::OUString* OUStringPtr;
+typedef ::std::vector< OUStringPtr > SvXMLAutoStylePoolCache_Impl;
+
+class XMLFamilyData_Impl
+{
+public:
+ SvXMLAutoStylePoolCache_Impl *pCache;
+ sal_uInt32 mnFamily;
+ ::rtl::OUString maStrFamilyName;
+ UniReference < SvXMLExportPropertyMapper > mxMapper;
+
+ SvXMLAutoStylePoolParentsP_Impl* mpParentList;
+ SvXMLAutoStylePoolNamesP_Impl* mpNameList;
+ sal_uInt32 mnCount;
+ sal_uInt32 mnName;
+ ::rtl::OUString maStrPrefix;
+ sal_Bool bAsFamily;
+
+public:
+ XMLFamilyData_Impl( sal_Int32 nFamily, const ::rtl::OUString& rStrName,
+ const UniReference < SvXMLExportPropertyMapper > & rMapper,
+ const ::rtl::OUString& rStrPrefix, sal_Bool bAsFamily = sal_True );
+
+ XMLFamilyData_Impl( sal_Int32 nFamily ) :
+ pCache( 0 ),
+ mnFamily( nFamily ), mpParentList( NULL ),
+ mpNameList( NULL ), mnCount( 0 ), mnName( 0 )
+
+ {}
+ ~XMLFamilyData_Impl();
+
+ friend int XMLFamilyDataSort_Impl( const XMLFamilyData_Impl& r1, const XMLFamilyData_Impl& r2 );
+
+ void ClearEntries();
+};
+
+DECLARE_CONTAINER_SORT( XMLFamilyDataList_Impl, XMLFamilyData_Impl )
+
+///////////////////////////////////////////////////////////////////////////////
+//
+//
+//
+
+DECLARE_CONTAINER_SORT_DEL( SvXMLAutoStylePoolNamesP_Impl,
+ ::rtl::OUString )
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Properties of a pool
+//
+
+class SvXMLAutoStylePoolPropertiesP_Impl
+{
+ ::rtl::OUString msName;
+ ::std::vector< XMLPropertyState > maProperties;
+ sal_uInt32 mnPos;
+
+public:
+
+ SvXMLAutoStylePoolPropertiesP_Impl( XMLFamilyData_Impl* pFamilyData, const ::std::vector< XMLPropertyState >& rProperties );
+
+ ~SvXMLAutoStylePoolPropertiesP_Impl()
+ {
+ }
+
+ const ::rtl::OUString& GetName() const { return msName; }
+ const ::std::vector< XMLPropertyState >& GetProperties() const { return maProperties; }
+ sal_uInt32 GetPos() const { return mnPos; }
+
+ void SetName( const ::rtl::OUString& rNew ) { msName = rNew; }
+};
+
+typedef SvXMLAutoStylePoolPropertiesP_Impl* SvXMLAutoStylePoolPropertiesPPtr;
+typedef ::std::vector< SvXMLAutoStylePoolPropertiesPPtr > SvXMLAutoStylePoolPropertiesPList_Impl;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Parents of AutoStylePool's
+//
+
+class SvXMLAutoStylePoolParentP_Impl
+{
+ ::rtl::OUString msParent;
+ SvXMLAutoStylePoolPropertiesPList_Impl maPropertiesList;
+
+public:
+
+ SvXMLAutoStylePoolParentP_Impl( const ::rtl::OUString & rParent ) :
+ msParent( rParent )
+ {
+ }
+
+ ~SvXMLAutoStylePoolParentP_Impl();
+
+ sal_Bool Add( XMLFamilyData_Impl* pFamilyData, const ::std::vector< XMLPropertyState >& rProperties, ::rtl::OUString& rName, bool bDontSeek = false );
+
+ sal_Bool AddNamed( XMLFamilyData_Impl* pFamilyData, const ::std::vector< XMLPropertyState >& rProperties, const ::rtl::OUString& rName );
+
+ ::rtl::OUString Find( const XMLFamilyData_Impl* pFamilyData, const ::std::vector< XMLPropertyState >& rProperties ) const;
+
+ const ::rtl::OUString& GetParent() const { return msParent; }
+
+ const SvXMLAutoStylePoolPropertiesPList_Impl& GetPropertiesList() const
+ {
+ return maPropertiesList;
+ }
+};
+
+DECLARE_CONTAINER_SORT_DEL( SvXMLAutoStylePoolParentsP_Impl,
+ SvXMLAutoStylePoolParentP_Impl )
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Implementationclass of SvXMLAutoStylePool
+//
+
+class SvXMLAutoStylePoolP_Impl
+{
+ SvXMLExport& rExport;
+
+ XMLFamilyDataList_Impl maFamilyList;
+
+public:
+
+ SvXMLAutoStylePoolP_Impl( SvXMLExport& rExport );
+ ~SvXMLAutoStylePoolP_Impl();
+
+ SvXMLExport& GetExport() const { return rExport; }
+
+ void AddFamily( sal_Int32 nFamily, const ::rtl::OUString& rStrName,
+ const UniReference < SvXMLExportPropertyMapper > & rMapper,
+ const ::rtl::OUString& rStrPrefix, sal_Bool bAsFamily = sal_True );
+ void RegisterName( sal_Int32 nFamily, const ::rtl::OUString& rName );
+ void GetRegisteredNames(
+ com::sun::star::uno::Sequence<sal_Int32>& aFamilies,
+ com::sun::star::uno::Sequence<rtl::OUString>& aNames );
+
+ sal_Bool Add( ::rtl::OUString& rName, sal_Int32 nFamily,
+ const ::rtl::OUString& rParent,
+ const ::std::vector< XMLPropertyState >& rProperties,
+ sal_Bool bCache = sal_False,
+ bool bDontSeek = false );
+ sal_Bool AddNamed( const ::rtl::OUString& rName, sal_Int32 nFamily,
+ const ::rtl::OUString& rParent,
+ const ::std::vector< XMLPropertyState >& rProperties );
+
+ ::rtl::OUString AddToCache( sal_Int32 nFamily,
+ const ::rtl::OUString& rParent );
+ ::rtl::OUString Find( sal_Int32 nFamily, const ::rtl::OUString& rParent,
+ const ::std::vector< XMLPropertyState >& rProperties ) const;
+
+ ::rtl::OUString FindAndRemoveCached( sal_Int32 nFamily ) const;
+
+ void exportXML( sal_Int32 nFamily,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ const SvXMLAutoStylePoolP *pAntiImpl) const;
+
+ void ClearEntries();
+};
+
+struct SvXMLAutoStylePoolPExport_Impl
+{
+ const ::rtl::OUString *mpParent;
+ const SvXMLAutoStylePoolPropertiesP_Impl *mpProperties;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/kernihdl.cxx b/xmloff/source/style/kernihdl.cxx
new file mode 100644
index 000000000000..27ed1a5a318f
--- /dev/null
+++ b/xmloff/source/style/kernihdl.cxx
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "kernihdl.hxx"
+#include <com/sun/star/uno/Any.hxx>
+#include <rtl/ustrbuf.hxx>
+
+// --
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star::uno;
+using namespace ::xmloff::token;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLKerningPropHdl
+//
+
+XMLKerningPropHdl::~XMLKerningPropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLKerningPropHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_True;
+ sal_Int32 nKerning = 0;
+
+ if( ! IsXMLToken( rStrImpValue, XML_KERNING_NORMAL ) )
+ {
+ bRet = rUnitConverter.convertMeasure( nKerning, rStrImpValue );
+ }
+
+ rValue <<= (sal_Int16)nKerning;
+
+ return bRet;
+}
+
+sal_Bool XMLKerningPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int16 nValue = sal_Int16();
+
+ if( rValue >>= nValue )
+ {
+ OUStringBuffer aOut;
+
+ if( nValue == 0 )
+ aOut.append( GetXMLToken(XML_KERNING_NORMAL) );
+ else
+ rUnitConverter.convertMeasure( aOut, nValue );
+
+ rStrExpValue = aOut.makeStringAndClear();
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/kernihdl.hxx b/xmloff/source/style/kernihdl.hxx
new file mode 100644
index 000000000000..958aabc3b479
--- /dev/null
+++ b/xmloff/source/style/kernihdl.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PROPERTYHANDLER_KERNINGTYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_KERNINGTYPES_HXX
+
+#include <xmloff/xmlprhdl.hxx>
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLKerningPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLKerningPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_KERNINGTYPES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/lspachdl.cxx b/xmloff/source/style/lspachdl.cxx
new file mode 100644
index 000000000000..27fa7582cf46
--- /dev/null
+++ b/xmloff/source/style/lspachdl.cxx
@@ -0,0 +1,198 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+#include <lspachdl.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/style/LineSpacing.hpp>
+#include <com/sun/star/style/LineSpacingMode.hpp>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using ::xmloff::token::IsXMLToken;
+using ::xmloff::token::XML_CASEMAP_NORMAL;
+
+// this is a copy of defines in svx/inc/escpitem.hxx
+#define DFLT_ESC_PROP 58
+#define DFLT_ESC_AUTO_SUPER 101
+#define DFLT_ESC_AUTO_SUB -101
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLEscapementPropHdl
+//
+
+XMLLineHeightHdl::~XMLLineHeightHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLLineHeightHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ style::LineSpacing aLSp;
+ sal_Int32 nTemp = 0;
+
+ if( -1 != rStrImpValue.indexOf( sal_Unicode( '%' ) ) )
+ {
+ aLSp.Mode = style::LineSpacingMode::PROP;
+ if(!rUnitConverter.convertPercent( nTemp, rStrImpValue ))
+ return sal_False;
+ aLSp.Height = sal::static_int_cast< sal_Int16 >(nTemp);
+ }
+ else if( IsXMLToken( rStrImpValue, XML_CASEMAP_NORMAL) )
+ {
+ aLSp.Mode = style::LineSpacingMode::PROP;
+ aLSp.Height = 100;
+ }
+ else
+ {
+ aLSp.Mode = style::LineSpacingMode::FIX;
+ if(!rUnitConverter.convertMeasure( nTemp, rStrImpValue, 0x0000, 0xffff ))
+ return sal_False;
+ aLSp.Height = sal::static_int_cast< sal_Int16 >(nTemp);
+ }
+
+ rValue <<= aLSp;
+ return sal_True;
+}
+
+sal_Bool XMLLineHeightHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ OUStringBuffer aOut;
+
+ style::LineSpacing aLSp;
+ if(!(rValue >>= aLSp))
+ return sal_False;
+
+ if( style::LineSpacingMode::PROP != aLSp.Mode && style::LineSpacingMode::FIX != aLSp.Mode )
+ return sal_False;
+
+ if( style::LineSpacingMode::PROP == aLSp.Mode )
+ {
+ rUnitConverter.convertPercent( aOut, aLSp.Height );
+ }
+ else
+ {
+ rUnitConverter.convertMeasure( aOut, aLSp.Height );
+ }
+
+ rStrExpValue = aOut.makeStringAndClear();
+ return rStrExpValue.getLength() != 0;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLLineHeightAtLeastHdl
+//
+
+XMLLineHeightAtLeastHdl::~XMLLineHeightAtLeastHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLLineHeightAtLeastHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ style::LineSpacing aLSp;
+
+ sal_Int32 nTemp;
+ aLSp.Mode = style::LineSpacingMode::MINIMUM;
+ if(!rUnitConverter.convertMeasure( nTemp, rStrImpValue, 0x0000, 0xffff ))
+ return sal_False;
+ aLSp.Height = sal::static_int_cast< sal_Int16 >(nTemp);
+
+ rValue <<= aLSp;
+ return sal_True;
+}
+
+sal_Bool XMLLineHeightAtLeastHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ OUStringBuffer aOut;
+
+ style::LineSpacing aLSp;
+ if(!(rValue >>= aLSp))
+ return sal_False;
+
+ if( style::LineSpacingMode::MINIMUM != aLSp.Mode )
+ return sal_False;
+
+ rUnitConverter.convertMeasure( aOut, aLSp.Height );
+
+ rStrExpValue = aOut.makeStringAndClear();
+ return rStrExpValue.getLength() != 0;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLLineSpacingHdl
+//
+
+XMLLineSpacingHdl::~XMLLineSpacingHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLLineSpacingHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ style::LineSpacing aLSp;
+ sal_Int32 nTemp;
+
+ aLSp.Mode = style::LineSpacingMode::LEADING;
+ if(!rUnitConverter.convertMeasure( nTemp, rStrImpValue, 0x0000, 0xffff ))
+ return sal_False;
+ aLSp.Height = sal::static_int_cast< sal_Int16 >(nTemp);
+
+ rValue <<= aLSp;
+ return sal_True;
+}
+
+sal_Bool XMLLineSpacingHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ OUStringBuffer aOut;
+
+ style::LineSpacing aLSp;
+ if(!(rValue >>= aLSp))
+ return sal_False;
+
+ if( style::LineSpacingMode::LEADING != aLSp.Mode )
+ return sal_False;
+
+ rUnitConverter.convertMeasure( aOut, aLSp.Height );
+
+ rStrExpValue = aOut.makeStringAndClear();
+ return rStrExpValue.getLength() != 0;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/lspachdl.hxx b/xmloff/source/style/lspachdl.hxx
new file mode 100644
index 000000000000..ab1fc8f53541
--- /dev/null
+++ b/xmloff/source/style/lspachdl.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PROPERTYHANDLER_LINESPACETYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_LINESPACETYPES_HXX
+
+#include <xmloff/xmlprhdl.hxx>
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLLineHeightHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLLineHeightHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+class XMLLineHeightAtLeastHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLLineHeightAtLeastHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+class XMLLineSpacingHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLLineSpacingHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_CHARHEIGHTTYPES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/numehelp.cxx b/xmloff/source/style/numehelp.cxx
new file mode 100644
index 000000000000..a5c1680ede53
--- /dev/null
+++ b/xmloff/source/style/numehelp.cxx
@@ -0,0 +1,561 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "xmloff/numehelp.hxx"
+
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlexp.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <rtl/ustring.hxx>
+#include <svl/zforlist.hxx>
+#include <com/sun/star/util/NumberFormat.hpp>
+#include <rtl/math.hxx>
+#include <tools/debug.hxx>
+#include <rtl/ustrbuf.hxx>
+
+using namespace com::sun::star;
+using namespace xmloff::token;
+
+#define XML_TYPE "Type"
+#define XML_CURRENCYSYMBOL "CurrencySymbol"
+#define XML_CURRENCYABBREVIATION "CurrencyAbbreviation"
+#define XML_STANDARDFORMAT "StandardFormat"
+
+XMLNumberFormatAttributesExportHelper::XMLNumberFormatAttributesExportHelper(
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xTempNumberFormatsSupplier)
+ : xNumberFormats(xTempNumberFormatsSupplier.is() ? xTempNumberFormatsSupplier->getNumberFormats() : ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats > ()),
+ pExport(NULL),
+ sStandardFormat(RTL_CONSTASCII_USTRINGPARAM(XML_STANDARDFORMAT)),
+ sType(RTL_CONSTASCII_USTRINGPARAM(XML_TYPE)),
+ msCurrencySymbol(RTL_CONSTASCII_USTRINGPARAM(XML_CURRENCYSYMBOL)),
+ msCurrencyAbbreviation(RTL_CONSTASCII_USTRINGPARAM(XML_CURRENCYABBREVIATION)),
+ aNumberFormats()
+{
+}
+
+XMLNumberFormatAttributesExportHelper::XMLNumberFormatAttributesExportHelper(
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xTempNumberFormatsSupplier,
+ SvXMLExport& rTempExport )
+: xNumberFormats(xTempNumberFormatsSupplier.is() ? xTempNumberFormatsSupplier->getNumberFormats() : ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats > ()),
+ pExport(&rTempExport),
+ sStandardFormat(RTL_CONSTASCII_USTRINGPARAM(XML_STANDARDFORMAT)),
+ sType(RTL_CONSTASCII_USTRINGPARAM(XML_TYPE)),
+ sAttrValueType(rTempExport.GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_OFFICE, GetXMLToken(XML_VALUE_TYPE))),
+ sAttrValue(rTempExport.GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_OFFICE, GetXMLToken(XML_VALUE))),
+ sAttrDateValue(rTempExport.GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_OFFICE, GetXMLToken(XML_DATE_VALUE))),
+ sAttrTimeValue(rTempExport.GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_OFFICE, GetXMLToken(XML_TIME_VALUE))),
+ sAttrBooleanValue(rTempExport.GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_OFFICE, GetXMLToken(XML_BOOLEAN_VALUE))),
+ sAttrStringValue(rTempExport.GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_OFFICE, GetXMLToken(XML_STRING_VALUE))),
+ sAttrCurrency(rTempExport.GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_OFFICE, GetXMLToken(XML_CURRENCY))),
+ msCurrencySymbol(RTL_CONSTASCII_USTRINGPARAM(XML_CURRENCYSYMBOL)),
+ msCurrencyAbbreviation(RTL_CONSTASCII_USTRINGPARAM(XML_CURRENCYABBREVIATION)),
+ aNumberFormats()
+{
+}
+
+XMLNumberFormatAttributesExportHelper::~XMLNumberFormatAttributesExportHelper()
+{
+}
+
+sal_Int16 XMLNumberFormatAttributesExportHelper::GetCellType(const sal_Int32 nNumberFormat, rtl::OUString& sCurrency, sal_Bool& bIsStandard)
+{
+ XMLNumberFormat aFormat(sEmpty, nNumberFormat, 0);
+ XMLNumberFormatSet::iterator aItr(aNumberFormats.find(aFormat));
+ XMLNumberFormatSet::iterator aEndItr(aNumberFormats.end());
+ if (aItr != aEndItr)
+ {
+ bIsStandard = aItr->bIsStandard;
+ sCurrency = aItr->sCurrency;
+ return aItr->nType;
+ }
+ else
+ {
+ aFormat.nType = GetCellType(nNumberFormat, bIsStandard);
+ aFormat.bIsStandard = bIsStandard;
+ if ((aFormat.nType & ~util::NumberFormat::DEFINED) == util::NumberFormat::CURRENCY)
+ if (GetCurrencySymbol(nNumberFormat, aFormat.sCurrency))
+ sCurrency = aFormat.sCurrency;
+ aNumberFormats.insert(aFormat);
+ return aFormat.nType;
+ }
+}
+
+void XMLNumberFormatAttributesExportHelper::WriteAttributes(SvXMLExport& rXMLExport,
+ const sal_Int16 nTypeKey,
+ const double& rValue,
+ const rtl::OUString& rCurrency,
+ sal_Bool bExportValue)
+{
+ sal_Bool bWasSetTypeAttribute = sal_False;
+ switch(nTypeKey & ~util::NumberFormat::DEFINED)
+ {
+ case 0:
+ case util::NumberFormat::NUMBER:
+ case util::NumberFormat::SCIENTIFIC:
+ case util::NumberFormat::FRACTION:
+ {
+ if (!bWasSetTypeAttribute)
+ {
+ rXMLExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_FLOAT);
+ bWasSetTypeAttribute = sal_True;
+ }
+ } // No Break
+ case util::NumberFormat::PERCENT:
+ {
+ if (!bWasSetTypeAttribute)
+ {
+ rXMLExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_PERCENTAGE);
+ bWasSetTypeAttribute = sal_True;
+ }
+ } // No Break
+ case util::NumberFormat::CURRENCY:
+ {
+ if (!bWasSetTypeAttribute)
+ {
+ rXMLExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_CURRENCY);
+ if (rCurrency.getLength() > 0)
+ rXMLExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_CURRENCY, rCurrency);
+ bWasSetTypeAttribute = sal_True;
+ }
+
+ if (bExportValue)
+ {
+ rtl::OUString sValue( ::rtl::math::doubleToUString( rValue,
+ rtl_math_StringFormat_Automatic,
+ rtl_math_DecimalPlaces_Max, '.', sal_True));
+ rXMLExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_VALUE, sValue);
+ }
+ }
+ break;
+ case util::NumberFormat::DATE:
+ case util::NumberFormat::DATETIME:
+ {
+ if (!bWasSetTypeAttribute)
+ {
+ rXMLExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_DATE);
+ bWasSetTypeAttribute = sal_True;
+ }
+ if (bExportValue)
+ {
+ if ( rXMLExport.SetNullDateOnUnitConverter() )
+ {
+ rtl::OUStringBuffer sBuffer;
+ rXMLExport.GetMM100UnitConverter().convertDateTime(sBuffer, rValue);
+ rXMLExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_DATE_VALUE, sBuffer.makeStringAndClear());
+ }
+ }
+ }
+ break;
+ case util::NumberFormat::TIME:
+ {
+ if (!bWasSetTypeAttribute)
+ {
+ rXMLExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_TIME);
+ bWasSetTypeAttribute = sal_True;
+ }
+ if (bExportValue)
+ {
+ rtl::OUStringBuffer sBuffer;
+ rXMLExport.GetMM100UnitConverter().convertTime(sBuffer, rValue);
+ rXMLExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_TIME_VALUE, sBuffer.makeStringAndClear());
+ }
+ }
+ break;
+ case util::NumberFormat::LOGICAL:
+ {
+ if (!bWasSetTypeAttribute)
+ {
+ rXMLExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_BOOLEAN);
+ bWasSetTypeAttribute = sal_True;
+ }
+ if (bExportValue)
+ {
+ double fTempValue = rValue;
+ if (::rtl::math::approxEqual( fTempValue, 1.0 ))
+ {
+ rXMLExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_BOOLEAN_VALUE, XML_TRUE);
+ }
+ else
+ {
+ if (::rtl::math::approxEqual( rValue, 0.0 ))
+ {
+ rXMLExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_BOOLEAN_VALUE, XML_FALSE);
+ }
+ else
+ {
+ rtl::OUString sValue( ::rtl::math::doubleToUString(
+ fTempValue,
+ rtl_math_StringFormat_Automatic,
+ rtl_math_DecimalPlaces_Max, '.',
+ sal_True));
+ rXMLExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_BOOLEAN_VALUE, sValue);
+ }
+ }
+ }
+ }
+ break;
+ case util::NumberFormat::TEXT:
+ {
+ if (!bWasSetTypeAttribute)
+ {
+ rXMLExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_FLOAT);
+ bWasSetTypeAttribute = sal_True;
+ if (bExportValue)
+ {
+ rtl::OUString sValue( ::rtl::math::doubleToUString( rValue,
+ rtl_math_StringFormat_Automatic,
+ rtl_math_DecimalPlaces_Max, '.', sal_True));
+ rXMLExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_VALUE, sValue);
+ }
+ }
+ }
+ break;
+ }
+}
+
+sal_Bool XMLNumberFormatAttributesExportHelper::GetCurrencySymbol(const sal_Int32 nNumberFormat, rtl::OUString& sCurrencySymbol,
+ uno::Reference <util::XNumberFormatsSupplier>& xNumberFormatsSupplier)
+{
+ if (xNumberFormatsSupplier.is())
+ {
+ uno::Reference <util::XNumberFormats> xNumberFormats(xNumberFormatsSupplier->getNumberFormats());
+ if (xNumberFormats.is())
+ {
+ try
+ {
+ uno::Reference <beans::XPropertySet> xNumberPropertySet(xNumberFormats->getByKey(nNumberFormat));
+ if ( xNumberPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(XML_CURRENCYSYMBOL))) >>= sCurrencySymbol)
+ {
+ rtl::OUString sCurrencyAbbreviation;
+ if ( xNumberPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(XML_CURRENCYABBREVIATION))) >>= sCurrencyAbbreviation)
+ {
+ if ( sCurrencyAbbreviation.getLength() != 0 )
+ sCurrencySymbol = sCurrencyAbbreviation;
+ else
+ {
+ if ( sCurrencySymbol.getLength() == 1 && sCurrencySymbol.toChar() == NfCurrencyEntry::GetEuroSymbol() )
+ sCurrencySymbol = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EUR"));
+ }
+ }
+ return sal_True;
+ }
+ }
+ catch ( uno::Exception& )
+ {
+ OSL_FAIL("Numberformat not found");
+ }
+ }
+ }
+ return sal_False;
+}
+
+
+sal_Int16 XMLNumberFormatAttributesExportHelper::GetCellType(const sal_Int32 nNumberFormat, sal_Bool& bIsStandard,
+ uno::Reference <util::XNumberFormatsSupplier>& xNumberFormatsSupplier)
+{
+ if (xNumberFormatsSupplier.is())
+ {
+ uno::Reference <util::XNumberFormats> xNumberFormats(xNumberFormatsSupplier->getNumberFormats());
+ if (xNumberFormats.is())
+ {
+ try
+ {
+ uno::Reference <beans::XPropertySet> xNumberPropertySet(xNumberFormats->getByKey(nNumberFormat));
+ xNumberPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STANDARDFORMAT))) >>= bIsStandard;
+ sal_Int16 nNumberType = sal_Int16();
+ if ( xNumberPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(XML_TYPE))) >>= nNumberType )
+ {
+ return nNumberType;
+ }
+ }
+ catch ( uno::Exception& )
+ {
+ OSL_FAIL("Numberformat not found");
+ }
+ }
+ }
+ return 0;
+}
+
+void XMLNumberFormatAttributesExportHelper::SetNumberFormatAttributes(SvXMLExport& rXMLExport,
+ const sal_Int32 nNumberFormat, const double& rValue, sal_Bool bExportValue)
+{
+ sal_Bool bIsStandard;
+ sal_Int16 nTypeKey = GetCellType(nNumberFormat, bIsStandard, rXMLExport.GetNumberFormatsSupplier());
+ rtl::OUString sCurrency;
+ if ((nTypeKey & ~util::NumberFormat::DEFINED) == util::NumberFormat::CURRENCY)
+ GetCurrencySymbol(nNumberFormat, sCurrency, rXMLExport.GetNumberFormatsSupplier());
+ WriteAttributes(rXMLExport, nTypeKey, rValue, sCurrency, bExportValue);
+}
+
+void XMLNumberFormatAttributesExportHelper::SetNumberFormatAttributes(SvXMLExport& rXMLExport,
+ const rtl::OUString& rValue, const rtl::OUString& rCharacters,
+ sal_Bool bExportValue, sal_Bool bExportTypeAttribute)
+{
+ if (bExportTypeAttribute)
+ rXMLExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_STRING);
+ if (bExportValue && rValue.getLength() && (rValue != rCharacters))
+ rXMLExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_STRING_VALUE, rValue);
+}
+
+sal_Bool XMLNumberFormatAttributesExportHelper::GetCurrencySymbol(const sal_Int32 nNumberFormat, rtl::OUString& rCurrencySymbol)
+{
+ if (!xNumberFormats.is() && pExport && pExport->GetNumberFormatsSupplier().is())
+ xNumberFormats.set(pExport->GetNumberFormatsSupplier()->getNumberFormats());
+
+ if (xNumberFormats.is())
+ {
+ try
+ {
+ uno::Reference <beans::XPropertySet> xNumberPropertySet(xNumberFormats->getByKey(nNumberFormat));
+ if ( xNumberPropertySet->getPropertyValue(msCurrencySymbol) >>= rCurrencySymbol)
+ {
+ rtl::OUString sCurrencyAbbreviation;
+ if ( xNumberPropertySet->getPropertyValue(msCurrencyAbbreviation) >>= sCurrencyAbbreviation)
+ {
+ if ( sCurrencyAbbreviation.getLength() != 0 )
+ rCurrencySymbol = sCurrencyAbbreviation;
+ else
+ {
+ if ( rCurrencySymbol.getLength() == 1 && rCurrencySymbol.toChar() == NfCurrencyEntry::GetEuroSymbol() )
+ rCurrencySymbol = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EUR"));
+ }
+ }
+ return sal_True;
+ }
+ }
+ catch ( uno::Exception& )
+ {
+ OSL_FAIL("Numberformat not found");
+ }
+ }
+ return sal_False;
+}
+
+sal_Int16 XMLNumberFormatAttributesExportHelper::GetCellType(const sal_Int32 nNumberFormat, sal_Bool& bIsStandard)
+{
+ if (!xNumberFormats.is() && pExport && pExport->GetNumberFormatsSupplier().is())
+ xNumberFormats.set(pExport->GetNumberFormatsSupplier()->getNumberFormats());
+
+ if (xNumberFormats.is())
+ {
+ try
+ {
+ uno::Reference <beans::XPropertySet> xNumberPropertySet(xNumberFormats->getByKey(nNumberFormat));
+ if (xNumberPropertySet.is())
+ {
+ xNumberPropertySet->getPropertyValue(sStandardFormat) >>= bIsStandard;
+ sal_Int16 nNumberType = sal_Int16();
+ if ( xNumberPropertySet->getPropertyValue(sType) >>= nNumberType )
+ {
+ return nNumberType;
+ }
+ }
+ }
+ catch ( uno::Exception& )
+ {
+ OSL_FAIL("Numberformat not found");
+ }
+ }
+ return 0;
+}
+
+void XMLNumberFormatAttributesExportHelper::WriteAttributes(
+ const sal_Int16 nTypeKey,
+ const double& rValue,
+ const rtl::OUString& rCurrency,
+ sal_Bool bExportValue)
+{
+ if (!pExport)
+ return;
+
+ sal_Bool bWasSetTypeAttribute = sal_False;
+ switch(nTypeKey & ~util::NumberFormat::DEFINED)
+ {
+ case 0:
+ case util::NumberFormat::NUMBER:
+ case util::NumberFormat::SCIENTIFIC:
+ case util::NumberFormat::FRACTION:
+ {
+ if (!bWasSetTypeAttribute)
+ {
+ pExport->AddAttribute(sAttrValueType, XML_FLOAT);
+ bWasSetTypeAttribute = sal_True;
+ }
+ } // No Break
+ case util::NumberFormat::PERCENT:
+ {
+ if (!bWasSetTypeAttribute)
+ {
+ pExport->AddAttribute(sAttrValueType, XML_PERCENTAGE);
+ bWasSetTypeAttribute = sal_True;
+ }
+ } // No Break
+ case util::NumberFormat::CURRENCY:
+ {
+ if (!bWasSetTypeAttribute)
+ {
+ pExport->AddAttribute(sAttrValueType, XML_CURRENCY);
+ if (rCurrency.getLength() > 0)
+ pExport->AddAttribute(sAttrCurrency, rCurrency);
+ bWasSetTypeAttribute = sal_True;
+ }
+
+ if (bExportValue)
+ {
+ rtl::OUString sValue( ::rtl::math::doubleToUString( rValue,
+ rtl_math_StringFormat_Automatic,
+ rtl_math_DecimalPlaces_Max, '.', sal_True));
+ pExport->AddAttribute(sAttrValue, sValue);
+ }
+ }
+ break;
+ case util::NumberFormat::DATE:
+ case util::NumberFormat::DATETIME:
+ {
+ if (!bWasSetTypeAttribute)
+ {
+ pExport->AddAttribute(sAttrValueType, XML_DATE);
+ bWasSetTypeAttribute = sal_True;
+ }
+ if (bExportValue)
+ {
+ if ( pExport->SetNullDateOnUnitConverter() )
+ {
+ rtl::OUStringBuffer sBuffer;
+ pExport->GetMM100UnitConverter().convertDateTime(sBuffer, rValue);
+ pExport->AddAttribute(sAttrDateValue, sBuffer.makeStringAndClear());
+ }
+ }
+ }
+ break;
+ case util::NumberFormat::TIME:
+ {
+ if (!bWasSetTypeAttribute)
+ {
+ pExport->AddAttribute(sAttrValueType, XML_TIME);
+ bWasSetTypeAttribute = sal_True;
+ }
+ if (bExportValue)
+ {
+ rtl::OUStringBuffer sBuffer;
+ pExport->GetMM100UnitConverter().convertTime(sBuffer, rValue);
+ pExport->AddAttribute(sAttrTimeValue, sBuffer.makeStringAndClear());
+ }
+ }
+ break;
+ case util::NumberFormat::LOGICAL:
+ {
+ if (!bWasSetTypeAttribute)
+ {
+ pExport->AddAttribute(sAttrValueType, XML_BOOLEAN);
+ bWasSetTypeAttribute = sal_True;
+ }
+ if (bExportValue)
+ {
+ double fTempValue = rValue;
+ if (::rtl::math::approxEqual( fTempValue, 1.0 ))
+ {
+ pExport->AddAttribute(sAttrBooleanValue, XML_TRUE);
+ }
+ else
+ {
+ if (::rtl::math::approxEqual( rValue, 0.0 ))
+ {
+ pExport->AddAttribute(sAttrBooleanValue, XML_FALSE);
+ }
+ else
+ {
+ rtl::OUString sValue( ::rtl::math::doubleToUString(
+ fTempValue,
+ rtl_math_StringFormat_Automatic,
+ rtl_math_DecimalPlaces_Max, '.',
+ sal_True));
+ pExport->AddAttribute(sAttrBooleanValue, sValue);
+ }
+ }
+ }
+ }
+ break;
+ case util::NumberFormat::TEXT:
+ {
+ if (!bWasSetTypeAttribute)
+ {
+ pExport->AddAttribute(sAttrValueType, XML_FLOAT);
+ bWasSetTypeAttribute = sal_True;
+ if (bExportValue)
+ {
+ rtl::OUString sValue( ::rtl::math::doubleToUString( rValue,
+ rtl_math_StringFormat_Automatic,
+ rtl_math_DecimalPlaces_Max, '.', sal_True));
+ pExport->AddAttribute(sAttrValue, sValue);
+ }
+ }
+ }
+ break;
+ }
+}
+
+void XMLNumberFormatAttributesExportHelper::SetNumberFormatAttributes(
+ const sal_Int32 nNumberFormat, const double& rValue, sal_Bool bExportValue)
+{
+ if (pExport)
+ {
+ sal_Bool bIsStandard;
+ rtl::OUString sCurrency;
+ sal_Int16 nTypeKey = GetCellType(nNumberFormat, sCurrency, bIsStandard);
+ WriteAttributes(nTypeKey, rValue, sCurrency, bExportValue);
+ }
+ else {
+ OSL_FAIL("no SvXMLExport given");
+ }
+}
+
+void XMLNumberFormatAttributesExportHelper::SetNumberFormatAttributes(
+ const rtl::OUString& rValue, const rtl::OUString& rCharacters,
+ sal_Bool bExportValue, sal_Bool bExportTypeAttribute)
+{
+ if (pExport)
+ {
+ if (bExportTypeAttribute)
+ pExport->AddAttribute(sAttrValueType, XML_STRING);
+ if (bExportValue && rValue.getLength() && (rValue != rCharacters))
+ pExport->AddAttribute(sAttrStringValue, rValue);
+ }
+ else {
+ OSL_FAIL("no SvXMLExport given");
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/opaquhdl.cxx b/xmloff/source/style/opaquhdl.cxx
new file mode 100644
index 000000000000..8ef05d56894d
--- /dev/null
+++ b/xmloff/source/style/opaquhdl.cxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "opaquhdl.hxx"
+#include <com/sun/star/uno/Any.hxx>
+#include <rtl/ustrbuf.hxx>
+
+// --
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star::uno;
+using namespace ::xmloff::token;
+
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLOpaquePropHdl
+//
+
+XMLOpaquePropHdl::~XMLOpaquePropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLOpaquePropHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_True;
+
+ sal_Bool bValue = IsXMLToken( rStrImpValue, XML_OPAQUE_FOREGROUND );
+ rValue <<= sal_Bool(bValue);
+ bRet = sal_True;
+
+ return bRet;
+}
+
+sal_Bool XMLOpaquePropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Bool bValue = sal_Bool();
+
+ if (rValue >>= bValue)
+ {
+ if( bValue )
+ rStrExpValue = GetXMLToken( XML_OPAQUE_FOREGROUND );
+ else
+ rStrExpValue = GetXMLToken( XML_OPAQUE_BACKGROUND );
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/opaquhdl.hxx b/xmloff/source/style/opaquhdl.hxx
new file mode 100644
index 000000000000..0c013936fda0
--- /dev/null
+++ b/xmloff/source/style/opaquhdl.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PROPERTYHANDLER_OPAQUETYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_OPAQUETYPES_HXX
+
+#include <xmloff/xmlprhdl.hxx>
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLOpaquePropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLOpaquePropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_OPAQUETYPES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/postuhdl.cxx b/xmloff/source/style/postuhdl.cxx
new file mode 100644
index 000000000000..6a8c104fca3a
--- /dev/null
+++ b/xmloff/source/style/postuhdl.cxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <postuhdl.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/awt/FontSlant.hpp>
+#include <tools/fontenum.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+SvXMLEnumMapEntry const aPostureGenericMapping[] =
+{
+ { XML_POSTURE_NORMAL, ITALIC_NONE },
+ { XML_POSTURE_ITALIC, ITALIC_NORMAL },
+ { XML_POSTURE_OBLIQUE, ITALIC_OBLIQUE },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLPosturePropHdl
+//
+
+XMLPosturePropHdl::~XMLPosturePropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLPosturePropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_uInt16 ePosture;
+ sal_Bool bRet = SvXMLUnitConverter::convertEnum( ePosture, rStrImpValue, aPostureGenericMapping );
+ if( bRet )
+ rValue <<= (awt::FontSlant)ePosture;
+
+ return bRet;
+}
+
+sal_Bool XMLPosturePropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ awt::FontSlant eSlant;
+
+ if( !( rValue >>= eSlant ) )
+ {
+ sal_Int32 nValue = 0;
+
+ if( !( rValue >>= nValue ) )
+ return sal_False;
+
+ eSlant = (awt::FontSlant)nValue;
+ }
+
+ OUStringBuffer aOut;
+ sal_Bool bRet = SvXMLUnitConverter::convertEnum( aOut, (sal_Int32)eSlant, aPostureGenericMapping );
+ if( bRet )
+ rStrExpValue = aOut.makeStringAndClear();
+
+ return bRet;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/postuhdl.hxx b/xmloff/source/style/postuhdl.hxx
new file mode 100644
index 000000000000..fffe77ee7f72
--- /dev/null
+++ b/xmloff/source/style/postuhdl.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PROPERTYHANDLER_POSTURETYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_POSTURETYPES_HXX
+
+#include <xmloff/xmlprhdl.hxx>
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLPosturePropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLPosturePropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_POSTURETYPES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/prhdlfac.cxx b/xmloff/source/style/prhdlfac.cxx
new file mode 100644
index 000000000000..b0652788a927
--- /dev/null
+++ b/xmloff/source/style/prhdlfac.cxx
@@ -0,0 +1,453 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <com/sun/star/drawing/ColorMode.hpp>
+#include <com/sun/star/text/HorizontalAdjust.hpp>
+#include <com/sun/star/text/WritingMode2.hpp>
+
+#include <tools/debug.hxx>
+
+#include <xmloff/prhdlfac.hxx>
+#include <xmloff/xmltypes.hxx>
+#include <xmloff/xmltoken.hxx>
+#include "xmlbahdl.hxx"
+#include <xmloff/NamedBoolPropertyHdl.hxx>
+#include <xmloff/XMLConstantsPropertyHandler.hxx>
+#include "cdouthdl.hxx"
+#include "csmaphdl.hxx"
+#include "fonthdl.hxx"
+#include "kernihdl.hxx"
+#include <postuhdl.hxx>
+#include "shadwhdl.hxx"
+#include "shdwdhdl.hxx"
+#include "undlihdl.hxx"
+#include "weighhdl.hxx"
+#include "breakhdl.hxx"
+#include <adjushdl.hxx>
+#include <escphdl.hxx>
+#include <chrhghdl.hxx>
+#include <chrlohdl.hxx>
+#include <lspachdl.hxx>
+#include <bordrhdl.hxx>
+#include <tabsthdl.hxx>
+#include <xmloff/EnumPropertyHdl.hxx>
+#include "AttributeContainerHandler.hxx"
+#include "durationhdl.hxx"
+#include "XMLRectangleMembersHandler.hxx"
+#include "DrawAspectHdl.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+SvXMLEnumMapEntry aXML_ColorMode_EnumMap[] =
+{
+ { XML_GREYSCALE, drawing::ColorMode_GREYS },
+ { XML_MONO, drawing::ColorMode_MONO },
+ { XML_WATERMARK, drawing::ColorMode_WATERMARK },
+ { XML_STANDARD, drawing::ColorMode_STANDARD },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry const aXML_HorizontalAdjust_Enum[] =
+{
+ { XML_LEFT, text::HorizontalAdjust_LEFT },
+ { XML_CENTER, text::HorizontalAdjust_CENTER },
+ { XML_RIGHT, text::HorizontalAdjust_RIGHT },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+// aXML_WritingDirection_Enum is used with and without 'page'
+// attribute, so you'll find uses of aXML_WritingDirection_Enum
+// directly, as well as &(aXML_WritingDirection_Enum[1])
+SvXMLEnumMapEntry const aXML_WritingDirection_Enum[] =
+{
+ // aXML_WritingDirection_Enum
+ { XML_PAGE, text::WritingMode2::PAGE },
+
+ // &(aXML_WritingDirection_Enum[1])
+ { XML_LR_TB, text::WritingMode2::LR_TB },
+ { XML_RL_TB, text::WritingMode2::RL_TB },
+ { XML_TB_RL, text::WritingMode2::TB_RL },
+ { XML_TB_LR, text::WritingMode2::TB_LR },
+
+ // alternative names of the above, as accepted by XSL
+ { XML_LR, text::WritingMode2::LR_TB },
+ { XML_RL, text::WritingMode2::RL_TB },
+ { XML_TB, text::WritingMode2::TB_RL },
+
+ { XML_TOKEN_INVALID, 0 }
+};
+
+
+///////////////////////////////////////////////////////////////////////////
+//
+// Dtor
+//
+XMLPropertyHandlerFactory::~XMLPropertyHandlerFactory()
+{
+ for( CacheMap::iterator pPos = maHandlerCache.begin(); pPos != maHandlerCache.end(); ++pPos )
+ delete pPos->second;
+}
+
+///////////////////////////////////////////////////////////////////////////
+//
+// Interface
+//
+const XMLPropertyHandler* XMLPropertyHandlerFactory::GetPropertyHandler( sal_Int32 nType ) const
+{
+ DBG_ASSERT( (nType & ~((sal_uInt32)MID_FLAG_MASK)) == 0,
+ "GetPropertyHandler called with flags in type" );
+ return GetBasicHandler( nType );
+}
+
+///////////////////////////////////////////////////////////////////////////
+//
+// Helper-methods to create and cache PropertyHandler
+//
+XMLPropertyHandler* XMLPropertyHandlerFactory::GetHdlCache( sal_Int32 nType ) const
+{
+ XMLPropertyHandler* pRet = NULL;
+
+ if( maHandlerCache.find( nType ) != maHandlerCache.end() )
+ pRet = maHandlerCache.find( nType )->second;
+
+ return pRet;
+}
+
+void XMLPropertyHandlerFactory::PutHdlCache( sal_Int32 nType, const XMLPropertyHandler* pHdl ) const
+{
+ // Don't be wondered about the following construct. The sense is to be able to provide a const-
+ // method as class-interface.
+ ((XMLPropertyHandlerFactory*)this)->maHandlerCache[ nType ] = (XMLPropertyHandler*)pHdl;
+}
+
+const XMLPropertyHandler* XMLPropertyHandlerFactory::GetBasicHandler( sal_Int32 nType ) const
+{
+ const XMLPropertyHandler* pPropHdl = GetHdlCache( nType );
+
+ if( !pPropHdl )
+ {
+ pPropHdl = CreatePropertyHandler( nType );
+
+ if( pPropHdl )
+ PutHdlCache( nType, pPropHdl );
+ }
+
+ return pPropHdl;
+}
+
+const XMLPropertyHandler* XMLPropertyHandlerFactory::CreatePropertyHandler( sal_Int32 nType )
+{
+ XMLPropertyHandler* pPropHdl = NULL;
+
+ switch( nType )
+ {
+ case XML_TYPE_BOOL :
+ pPropHdl = new XMLBoolPropHdl;
+ break;
+ case XML_TYPE_MEASURE :
+ pPropHdl = new XMLMeasurePropHdl( 4 );
+ break;
+ case XML_TYPE_MEASURE8 :
+ pPropHdl = new XMLMeasurePropHdl( 1 );
+ break;
+ case XML_TYPE_MEASURE16:
+ pPropHdl = new XMLMeasurePropHdl( 2 );
+ break;
+ case XML_TYPE_PERCENT :
+ pPropHdl = new XMLPercentPropHdl( 4 );
+ break;
+ case XML_TYPE_PERCENT8 :
+ pPropHdl = new XMLPercentPropHdl( 1 );
+ break;
+ case XML_TYPE_PERCENT16 :
+ pPropHdl = new XMLPercentPropHdl( 2 );
+ break;
+ case XML_TYPE_DOUBLE_PERCENT :
+ pPropHdl = new XMLDoublePercentPropHdl();
+ break;
+ case XML_TYPE_NEG_PERCENT :
+ pPropHdl = new XMLNegPercentPropHdl( 4 );
+ break;
+ case XML_TYPE_NEG_PERCENT8 :
+ pPropHdl = new XMLNegPercentPropHdl( 1 );
+ break;
+ case XML_TYPE_NEG_PERCENT16 :
+ pPropHdl = new XMLNegPercentPropHdl( 2 );
+ break;
+ case XML_TYPE_MEASURE_PX :
+ pPropHdl = new XMLMeasurePxPropHdl( 4 );
+ break;
+ case XML_TYPE_STRING :
+ pPropHdl = new XMLStringPropHdl;
+ break;
+ case XML_TYPE_COLOR :
+ pPropHdl = new XMLColorPropHdl;
+ break;
+ case XML_TYPE_NUMBER :
+ pPropHdl = new XMLNumberPropHdl( 4 );
+ break;
+ case XML_TYPE_NUMBER8 :
+ pPropHdl = new XMLNumberPropHdl( 1 );
+ break;
+ case XML_TYPE_NUMBER16:
+ pPropHdl = new XMLNumberPropHdl( 2 );
+ break;
+ case XML_TYPE_NUMBER_NONE :
+ pPropHdl = new XMLNumberNonePropHdl;
+ break;
+ case XML_TYPE_NUMBER8_NONE :
+ pPropHdl = new XMLNumberNonePropHdl( 1 );
+ break;
+ case XML_TYPE_NUMBER16_NONE :
+ pPropHdl = new XMLNumberNonePropHdl( 2 );
+ break;
+ case XML_TYPE_DOUBLE :
+ pPropHdl = new XMLDoublePropHdl;
+ break;
+ case XML_TYPE_NBOOL :
+ pPropHdl = new XMLNBoolPropHdl;
+ break;
+ case XML_TYPE_COLORTRANSPARENT :
+ pPropHdl = new XMLColorTransparentPropHdl;
+ break;
+ case XML_TYPE_ISTRANSPARENT :
+ pPropHdl = new XMLIsTransparentPropHdl;
+ break;
+ case XML_TYPE_COLORAUTO :
+ pPropHdl = new XMLColorAutoPropHdl;
+ break;
+ case XML_TYPE_ISAUTOCOLOR :
+ pPropHdl = new XMLIsAutoColorPropHdl;
+ break;
+ case XML_TYPE_BUILDIN_CMP_ONLY :
+ pPropHdl = new XMLCompareOnlyPropHdl;
+ break;
+
+ case XML_TYPE_RECTANGLE_LEFT :
+ case XML_TYPE_RECTANGLE_TOP :
+ case XML_TYPE_RECTANGLE_WIDTH :
+ case XML_TYPE_RECTANGLE_HEIGHT :
+ pPropHdl = new XMLRectangleMembersHdl( nType );
+ break;
+
+ case XML_TYPE_TEXT_CROSSEDOUT_TYPE:
+ pPropHdl = new XMLCrossedOutTypePropHdl ;
+ break;
+ case XML_TYPE_TEXT_CROSSEDOUT_STYLE:
+ pPropHdl = new XMLCrossedOutStylePropHdl ;
+ break;
+ case XML_TYPE_TEXT_CROSSEDOUT_WIDTH:
+ pPropHdl = new XMLCrossedOutWidthPropHdl ;
+ break;
+ case XML_TYPE_TEXT_CROSSEDOUT_TEXT:
+ pPropHdl = new XMLCrossedOutTextPropHdl ;
+ break;
+ case XML_TYPE_TEXT_BOOLCROSSEDOUT:
+ pPropHdl = new XMLNamedBoolPropertyHdl(
+ GetXMLToken(XML_SOLID),
+ GetXMLToken(XML_NONE) );
+ break;
+ case XML_TYPE_TEXT_ESCAPEMENT:
+ pPropHdl = new XMLEscapementPropHdl;
+ break;
+ case XML_TYPE_TEXT_ESCAPEMENT_HEIGHT:
+ pPropHdl = new XMLEscapementHeightPropHdl;
+ break;
+ case XML_TYPE_TEXT_CASEMAP:
+ pPropHdl = new XMLCaseMapPropHdl;
+ break;
+ case XML_TYPE_TEXT_CASEMAP_VAR:
+ pPropHdl = new XMLCaseMapVariantHdl;
+ break;
+ case XML_TYPE_TEXT_FONTFAMILYNAME:
+ pPropHdl = new XMLFontFamilyNamePropHdl;
+ break;
+ case XML_TYPE_TEXT_FONTFAMILY:
+ pPropHdl = new XMLFontFamilyPropHdl;
+ break;
+ case XML_TYPE_TEXT_FONTENCODING:
+ pPropHdl = new XMLFontEncodingPropHdl;
+ break;
+ case XML_TYPE_TEXT_FONTPITCH:
+ pPropHdl = new XMLFontPitchPropHdl;
+ break;
+ case XML_TYPE_TEXT_KERNING:
+ pPropHdl = new XMLKerningPropHdl;
+ break;
+ case XML_TYPE_TEXT_POSTURE:
+ pPropHdl = new XMLPosturePropHdl;
+ break;
+ case XML_TYPE_TEXT_SHADOWED:
+ pPropHdl = new XMLShadowedPropHdl;
+ break;
+ case XML_TYPE_TEXT_UNDERLINE_TYPE:
+ pPropHdl = new XMLUnderlineTypePropHdl;
+ break;
+ case XML_TYPE_TEXT_UNDERLINE_STYLE:
+ pPropHdl = new XMLUnderlineStylePropHdl;
+ break;
+ case XML_TYPE_TEXT_UNDERLINE_WIDTH:
+ pPropHdl = new XMLUnderlineWidthPropHdl;
+ break;
+ case XML_TYPE_TEXT_UNDERLINE_COLOR:
+ pPropHdl = new XMLColorTransparentPropHdl( XML_FONT_COLOR );
+ break;
+ case XML_TYPE_TEXT_UNDERLINE_HASCOLOR:
+ pPropHdl = new XMLIsTransparentPropHdl( XML_FONT_COLOR,
+ sal_False );
+ break;
+ case XML_TYPE_TEXT_OVERLINE_TYPE:
+ pPropHdl = new XMLUnderlineTypePropHdl;
+ break;
+ case XML_TYPE_TEXT_OVERLINE_STYLE:
+ pPropHdl = new XMLUnderlineStylePropHdl;
+ break;
+ case XML_TYPE_TEXT_OVERLINE_WIDTH:
+ pPropHdl = new XMLUnderlineWidthPropHdl;
+ break;
+ case XML_TYPE_TEXT_OVERLINE_COLOR:
+ pPropHdl = new XMLColorTransparentPropHdl( XML_FONT_COLOR );
+ break;
+ case XML_TYPE_TEXT_OVERLINE_HASCOLOR:
+ pPropHdl = new XMLIsTransparentPropHdl( XML_FONT_COLOR,
+ sal_False );
+ break;
+ case XML_TYPE_TEXT_WEIGHT:
+ pPropHdl = new XMLFontWeightPropHdl;
+ break;
+ case XML_TYPE_TEXT_SPLIT:
+ pPropHdl = new XMLNamedBoolPropertyHdl(
+ GetXMLToken(XML_AUTO),
+ GetXMLToken(XML_ALWAYS) );
+ break;
+ case XML_TYPE_TEXT_BREAKBEFORE:
+ pPropHdl = new XMLFmtBreakBeforePropHdl;
+ break;
+ case XML_TYPE_TEXT_BREAKAFTER:
+ pPropHdl = new XMLFmtBreakAfterPropHdl;
+ break;
+ case XML_TYPE_TEXT_SHADOW:
+ pPropHdl = new XMLShadowPropHdl;
+ break;
+ case XML_TYPE_TEXT_ADJUST:
+ pPropHdl = new XMLParaAdjustPropHdl;
+ break;
+ case XML_TYPE_TEXT_ADJUSTLAST:
+ pPropHdl = new XMLLastLineAdjustPropHdl;
+ break;
+ case XML_TYPE_CHAR_HEIGHT:
+ pPropHdl = new XMLCharHeightHdl;
+ break;
+ case XML_TYPE_CHAR_HEIGHT_PROP:
+ pPropHdl = new XMLCharHeightPropHdl;
+ break;
+ case XML_TYPE_CHAR_HEIGHT_DIFF:
+ pPropHdl = new XMLCharHeightDiffHdl;
+ break;
+ case XML_TYPE_CHAR_LANGUAGE:
+ pPropHdl = new XMLCharLanguageHdl;
+ break;
+ case XML_TYPE_CHAR_COUNTRY:
+ pPropHdl = new XMLCharCountryHdl;
+ break;
+ case XML_TYPE_LINE_SPACE_FIXED:
+ pPropHdl = new XMLLineHeightHdl;
+ break;
+ case XML_TYPE_LINE_SPACE_MINIMUM:
+ pPropHdl = new XMLLineHeightAtLeastHdl;
+ break;
+ case XML_TYPE_LINE_SPACE_DISTANCE:
+ pPropHdl = new XMLLineSpacingHdl;
+ break;
+ case XML_TYPE_BORDER_WIDTH:
+ pPropHdl = new XMLBorderWidthHdl;
+ break;
+ case XML_TYPE_BORDER:
+ pPropHdl = new XMLBorderHdl;
+ break;
+ case XML_TYPE_TEXT_TABSTOP:
+ pPropHdl = new XMLTabStopPropHdl;
+ break;
+ case XML_TYPE_ATTRIBUTE_CONTAINER:
+ pPropHdl = new XMLAttributeContainerHandler;
+ break;
+ case XML_TYPE_COLOR_MODE:
+ pPropHdl = new XMLEnumPropertyHdl( aXML_ColorMode_EnumMap,
+ ::getCppuType((const drawing::ColorMode*)0) );
+ break;
+ case XML_TYPE_DURATION16_MS:
+ pPropHdl = new XMLDurationMS16PropHdl_Impl;
+ break;
+ case XML_TYPE_TEXT_HORIZONTAL_ADJUST:
+ pPropHdl = new XMLEnumPropertyHdl(
+ aXML_HorizontalAdjust_Enum,
+ ::getCppuType((const text::HorizontalAdjust*)0) );
+ break;
+ case XML_TYPE_TEXT_DRAW_ASPECT:
+ pPropHdl = new DrawAspectHdl;
+ break;
+ case XML_TYPE_TEXT_WRITING_MODE:
+ pPropHdl = new XMLConstantsPropertyHandler(
+ &(aXML_WritingDirection_Enum[1]),
+ XML_LR_TB);
+ break;
+ case XML_TYPE_TEXT_WRITING_MODE_WITH_DEFAULT:
+ pPropHdl = new XMLConstantsPropertyHandler(
+ aXML_WritingDirection_Enum,
+ XML_PAGE);
+ break;
+ case XML_TYPE_TEXT_HIDDEN_AS_DISPLAY:
+ pPropHdl = new XMLNamedBoolPropertyHdl(
+ GetXMLToken(XML_NONE),
+ GetXMLToken(XML_TRUE) );
+ break;
+ case XML_TYPE_STYLENAME :
+ pPropHdl = new XMLStyleNamePropHdl;
+ break;
+ case XML_TYPE_NUMBER_NO_ZERO:
+ pPropHdl = new XMLNumberWithoutZeroPropHdl( 4 );
+ break;
+ case XML_TYPE_NUMBER8_NO_ZERO:
+ pPropHdl = new XMLNumberWithoutZeroPropHdl( 1 );
+ break;
+ case XML_TYPE_NUMBER16_NO_ZERO:
+ pPropHdl = new XMLNumberWithoutZeroPropHdl( 2 );
+ break;
+ case XML_TYPE_NUMBER16_AUTO:
+ pPropHdl = new XMLNumberWithAutoInsteadZeroPropHdl();
+ break;
+ }
+
+ return pPropHdl;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/prstylei.cxx b/xmloff/source/style/prstylei.cxx
new file mode 100644
index 000000000000..c0261eb0852c
--- /dev/null
+++ b/xmloff/source/style/prstylei.cxx
@@ -0,0 +1,420 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+#include <tools/debug.hxx>
+#include <set>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlprcon.hxx>
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/style/XAutoStyleFamily.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/beans/XMultiPropertyStates.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <xmloff/xmlimp.hxx>
+
+#include <xmloff/prstylei.hxx>
+#include <xmloff/attrlist.hxx>
+#include "xmloff/xmlerror.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::xmloff::token;
+
+
+void XMLPropStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
+ const OUString& rLocalName,
+ const OUString& rValue )
+{
+ if( XML_NAMESPACE_STYLE == nPrefixKey && IsXMLToken( rLocalName, XML_FAMILY ) )
+ {
+ DBG_ASSERT( GetFamily() == ((SvXMLStylesContext *)&mxStyles)->GetFamily( rValue ), "unexpected style family" );
+ }
+ else
+ {
+ SvXMLStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
+ }
+}
+
+TYPEINIT1( XMLPropStyleContext, SvXMLStyleContext );
+
+XMLPropStyleContext::XMLPropStyleContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx, const OUString& rLName,
+ const Reference< XAttributeList > & xAttrList,
+ SvXMLStylesContext& rStyles, sal_uInt16 nFamily,
+ sal_Bool bDefault )
+: SvXMLStyleContext( rImport, nPrfx, rLName, xAttrList, nFamily, bDefault )
+, msIsPhysical( RTL_CONSTASCII_USTRINGPARAM( "IsPhysical" ) )
+, msFollowStyle( RTL_CONSTASCII_USTRINGPARAM( "FollowStyle" ) )
+, mxStyles( &rStyles )
+{
+}
+
+XMLPropStyleContext::~XMLPropStyleContext()
+{
+}
+
+SvXMLImportContext *XMLPropStyleContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference< XAttributeList > & xAttrList )
+{
+ SvXMLImportContext *pContext = 0;
+
+ sal_uInt32 nFamily = 0;
+ if( XML_NAMESPACE_STYLE == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_GRAPHIC_PROPERTIES ) )
+ nFamily = XML_TYPE_PROP_GRAPHIC;
+ else if( IsXMLToken( rLocalName, XML_DRAWING_PAGE_PROPERTIES ) )
+ nFamily = XML_TYPE_PROP_DRAWING_PAGE;
+ else if( IsXMLToken( rLocalName, XML_TEXT_PROPERTIES ) )
+ nFamily = XML_TYPE_PROP_TEXT;
+ else if( IsXMLToken( rLocalName, XML_PARAGRAPH_PROPERTIES ) )
+ nFamily = XML_TYPE_PROP_PARAGRAPH;
+ else if( IsXMLToken( rLocalName, XML_RUBY_PROPERTIES ) )
+ nFamily = XML_TYPE_PROP_RUBY;
+ else if( IsXMLToken( rLocalName, XML_SECTION_PROPERTIES ) )
+ nFamily = XML_TYPE_PROP_SECTION;
+ else if( IsXMLToken( rLocalName, XML_TABLE_PROPERTIES ) )
+ nFamily = XML_TYPE_PROP_TABLE;
+ else if( IsXMLToken( rLocalName, XML_TABLE_COLUMN_PROPERTIES ) )
+ nFamily = XML_TYPE_PROP_TABLE_COLUMN;
+ else if( IsXMLToken( rLocalName, XML_TABLE_ROW_PROPERTIES ) )
+ nFamily = XML_TYPE_PROP_TABLE_ROW;
+ else if( IsXMLToken( rLocalName, XML_TABLE_CELL_PROPERTIES ) )
+ nFamily = XML_TYPE_PROP_TABLE_CELL;
+ else if( IsXMLToken( rLocalName, XML_CHART_PROPERTIES ) )
+ nFamily = XML_TYPE_PROP_CHART;
+ }
+ if( nFamily )
+ {
+ UniReference < SvXMLImportPropertyMapper > xImpPrMap =
+ ((SvXMLStylesContext *)&mxStyles)->GetImportPropertyMapper(
+ GetFamily() );
+ if( xImpPrMap.is() )
+ pContext = new SvXMLPropertySetContext( GetImport(), nPrefix,
+ rLocalName, xAttrList,
+ nFamily,
+ maProperties,
+ xImpPrMap );
+ }
+
+ if( !pContext )
+ pContext = SvXMLStyleContext::CreateChildContext( nPrefix, rLocalName,
+ xAttrList );
+
+ return pContext;
+}
+
+void XMLPropStyleContext::FillPropertySet(
+ const Reference< XPropertySet > & rPropSet )
+{
+ UniReference < SvXMLImportPropertyMapper > xImpPrMap =
+ ((SvXMLStylesContext *)&mxStyles)->GetImportPropertyMapper(
+ GetFamily() );
+ DBG_ASSERT( xImpPrMap.is(), "There is the import prop mapper" );
+ if( xImpPrMap.is() )
+ xImpPrMap->FillPropertySet( maProperties, rPropSet );
+}
+
+void XMLPropStyleContext::SetDefaults()
+{
+}
+
+Reference < XStyle > XMLPropStyleContext::Create()
+{
+ Reference < XStyle > xNewStyle;
+
+ OUString sServiceName(
+ ((SvXMLStylesContext *)&mxStyles)->GetServiceName( GetFamily() ) );
+ if( sServiceName.getLength() )
+ {
+ Reference< XMultiServiceFactory > xFactory( GetImport().GetModel(),
+ UNO_QUERY );
+ if( xFactory.is() )
+ {
+ Reference < XInterface > xIfc =
+ xFactory->createInstance( sServiceName );
+ if( xIfc.is() )
+ xNewStyle = Reference < XStyle >( xIfc, UNO_QUERY );
+ }
+ }
+
+ return xNewStyle;
+}
+
+typedef ::std::set < OUString, ::comphelper::UStringLess > PropertyNameSet;
+
+void XMLPropStyleContext::CreateAndInsert( sal_Bool bOverwrite )
+{
+ if( ((SvXMLStylesContext *)&mxStyles)->IsAutomaticStyle()
+ && ( GetFamily() == XML_STYLE_FAMILY_TEXT_TEXT || GetFamily() == XML_STYLE_FAMILY_TEXT_PARAGRAPH ) )
+ {
+ Reference < XAutoStyleFamily > xAutoFamily =
+ ((SvXMLStylesContext *)&mxStyles)->GetAutoStyles( GetFamily() );
+ if( !xAutoFamily.is() )
+ return;
+ UniReference < SvXMLImportPropertyMapper > xImpPrMap =
+ ((SvXMLStylesContext *)&mxStyles)->GetImportPropertyMapper( GetFamily() );
+ DBG_ASSERT( xImpPrMap.is(), "There is no import prop mapper" );
+ if( xImpPrMap.is() )
+ {
+ Sequence< PropertyValue > aValues;
+ xImpPrMap->FillPropertySequence( maProperties, aValues );
+
+ sal_Int32 nLen = aValues.getLength();
+ if( nLen )
+ {
+ if( GetFamily() == XML_STYLE_FAMILY_TEXT_PARAGRAPH )
+ {
+ aValues.realloc( nLen + 2 );
+ PropertyValue *pProps = aValues.getArray() + nLen;
+ pProps->Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaStyleName"));
+ OUString sParent( GetParentName() );
+ if( sParent.getLength() )
+ sParent = GetImport().GetStyleDisplayName( GetFamily(), sParent );
+ else
+ sParent = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Standard"));
+ pProps->Value <<= sParent;
+ ++pProps;
+ pProps->Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaConditionalStyleName"));
+ pProps->Value <<= sParent;
+ }
+
+ Reference < XAutoStyle > xAutoStyle = xAutoFamily->insertStyle( aValues );
+ if( xAutoStyle.is() )
+ {
+ Sequence< OUString > aPropNames(1);
+ aPropNames[0] = GetFamily() == XML_STYLE_FAMILY_TEXT_PARAGRAPH ?
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaAutoStyleName")) :
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharAutoStyleName"));
+ Sequence< Any > aAny = xAutoStyle->getPropertyValues( aPropNames );
+ if( aAny.hasElements() )
+ {
+ OUString aName;
+ aAny[0] >>= aName;
+ SetAutoName( aName );
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ const OUString& rName = GetDisplayName();
+ if( 0 == rName.getLength() || IsDefaultStyle() )
+ return;
+
+ Reference < XNameContainer > xFamilies =
+ ((SvXMLStylesContext *)&mxStyles)->GetStylesContainer( GetFamily() );
+ if( !xFamilies.is() )
+ return;
+
+ sal_Bool bNew = sal_False;
+ if( xFamilies->hasByName( rName ) )
+ {
+ Any aAny = xFamilies->getByName( rName );
+ aAny >>= mxStyle;
+ }
+ else
+ {
+ mxStyle = Create();
+ if( !mxStyle.is() )
+ return;
+
+ Any aAny;
+ aAny <<= mxStyle;
+ xFamilies->insertByName( rName, aAny );
+ bNew = sal_True;
+ }
+
+ Reference < XPropertySet > xPropSet( mxStyle, UNO_QUERY );
+ Reference< XPropertySetInfo > xPropSetInfo =
+ xPropSet->getPropertySetInfo();
+ if( !bNew && xPropSetInfo->hasPropertyByName( msIsPhysical ) )
+ {
+ Any aAny = xPropSet->getPropertyValue( msIsPhysical );
+ bNew = !*(sal_Bool *)aAny.getValue();
+ }
+ SetNew( bNew );
+ if( rName != GetName() )
+ GetImport().AddStyleDisplayName( GetFamily(), GetName(), rName );
+
+ if( bOverwrite || bNew )
+ {
+ Reference< XPropertyState > xPropState( xPropSet, uno::UNO_QUERY );
+
+ UniReference < XMLPropertySetMapper > xPrMap;
+ UniReference < SvXMLImportPropertyMapper > xImpPrMap =
+ ((SvXMLStylesContext *)&mxStyles)->GetImportPropertyMapper(
+ GetFamily() );
+ DBG_ASSERT( xImpPrMap.is(), "There is the import prop mapper" );
+ if( xImpPrMap.is() )
+ xPrMap = xImpPrMap->getPropertySetMapper();
+ if( xPrMap.is() )
+ {
+ Reference < XMultiPropertyStates > xMultiStates( xPropSet,
+ UNO_QUERY );
+ if( xMultiStates.is() )
+ {
+ xMultiStates->setAllPropertiesToDefault();
+ }
+ else
+ {
+ PropertyNameSet aNameSet;
+ sal_Int32 nCount = xPrMap->GetEntryCount();
+ sal_Int32 i;
+ for( i = 0; i < nCount; i++ )
+ {
+ const OUString& rPrName = xPrMap->GetEntryAPIName( i );
+ if( xPropSetInfo->hasPropertyByName( rPrName ) )
+ aNameSet.insert( rPrName );
+ }
+
+ nCount = aNameSet.size();
+ Sequence < OUString > aNames( nCount );
+ OUString *pNames = aNames.getArray();
+ PropertyNameSet::iterator aIter = aNameSet.begin();
+ while( aIter != aNameSet.end() )
+ *pNames++ = *aIter++;
+
+ Sequence < PropertyState > aStates(
+ xPropState->getPropertyStates( aNames ) );
+ const PropertyState *pStates = aStates.getConstArray();
+ pNames = aNames.getArray();
+
+ for( i = 0; i < nCount; i++ )
+ {
+ if( PropertyState_DIRECT_VALUE == *pStates++ )
+ xPropState->setPropertyToDefault( pNames[i] );
+ }
+ }
+ }
+
+ if (mxStyle.is())
+ mxStyle->setParentStyle(OUString());
+
+ FillPropertySet( xPropSet );
+ }
+ else
+ {
+ SetValid( sal_False );
+ }
+ }
+}
+
+void XMLPropStyleContext::Finish( sal_Bool bOverwrite )
+{
+ if( mxStyle.is() && (IsNew() || bOverwrite) )
+ {
+ // The families cintaner must exist
+ Reference < XNameContainer > xFamilies =
+ ((SvXMLStylesContext *)&mxStyles)->GetStylesContainer( GetFamily() );
+ DBG_ASSERT( xFamilies.is(), "Families lost" );
+ if( !xFamilies.is() )
+ return;
+
+ // connect parent
+ OUString sParent( GetParentName() );
+ if( sParent.getLength() )
+ sParent = GetImport().GetStyleDisplayName( GetFamily(), sParent );
+ if( sParent.getLength() && !xFamilies->hasByName( sParent ) )
+ sParent = OUString();
+
+ if( sParent != mxStyle->getParentStyle() )
+ {
+ // this may except if setting the parent style forms a
+ // circle in the style depencies; especially if the parent
+ // style is the same as the current style
+ try
+ {
+ mxStyle->setParentStyle( sParent );
+ }
+ catch( uno::Exception e )
+ {
+ // according to the API definition, I would expect a
+ // container::NoSuchElementException. But it throws an
+ // uno::RuntimeException instead. I catch
+ // uno::Exception in order to process both of them.
+
+ // We can't set the parent style. For a proper
+ // Error-Message, we should pass in the name of the
+ // style, as well as the desired parent style.
+ Sequence<OUString> aSequence(2);
+
+ // getName() throws no non-Runtime exception:
+ aSequence[0] = mxStyle->getName();
+ aSequence[1] = sParent;
+
+ GetImport().SetError(
+ XMLERROR_FLAG_ERROR | XMLERROR_PARENT_STYLE_NOT_ALLOWED,
+ aSequence, e.Message, NULL );
+ }
+ }
+
+ // connect follow
+ OUString sFollow( GetFollow() );
+ if( sFollow.getLength() )
+ sFollow = GetImport().GetStyleDisplayName( GetFamily(), sFollow );
+ if( !sFollow.getLength() || !xFamilies->hasByName( sFollow ) )
+ sFollow = mxStyle->getName();
+
+ Reference < XPropertySet > xPropSet( mxStyle, UNO_QUERY );
+ Reference< XPropertySetInfo > xPropSetInfo =
+ xPropSet->getPropertySetInfo();
+ if( xPropSetInfo->hasPropertyByName( msFollowStyle ) )
+ {
+ Any aAny = xPropSet->getPropertyValue( msFollowStyle );
+ OUString sCurrFollow;
+ aAny >>= sCurrFollow;
+ if( sCurrFollow != sFollow )
+ {
+ aAny <<= sFollow;
+ xPropSet->setPropertyValue( msFollowStyle, aAny );
+ }
+ }
+ }
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/shadwhdl.cxx b/xmloff/source/style/shadwhdl.cxx
new file mode 100644
index 000000000000..03fcb8a4eaf9
--- /dev/null
+++ b/xmloff/source/style/shadwhdl.cxx
@@ -0,0 +1,178 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "shadwhdl.hxx"
+#include <com/sun/star/uno/Any.hxx>
+#include <rtl/ustrbuf.hxx>
+
+// --
+#include <com/sun/star/table/ShadowFormat.hpp>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmltoken.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLMeasurePropHdl
+//
+
+XMLShadowPropHdl::~XMLShadowPropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLShadowPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ table::ShadowFormat aShadow;
+ aShadow.Location = table::ShadowLocation_BOTTOM_RIGHT;
+
+ sal_Bool bColorFound = sal_False;
+ sal_Bool bOffsetFound = sal_False;
+ SvXMLTokenEnumerator aTokenEnum( rStrImpValue );
+ Color aColor( 128,128, 128 );
+ OUString aToken;
+
+ while( aTokenEnum.getNextToken( aToken ) )
+ {
+ if( IsXMLToken( aToken, XML_NONE ) )
+ {
+ aShadow.Location = table::ShadowLocation_NONE;
+ bRet = sal_True;
+ break;
+ }
+ else if( !bColorFound && aToken.compareToAscii( "#", 1 ) == 0 )
+ {
+ bRet = rUnitConverter.convertColor( aColor, aToken );
+ if( !bRet )
+ return sal_False;
+
+ bColorFound = sal_True;
+ }
+ else if( !bOffsetFound )
+ {
+ sal_Int32 nX = 0, nY = 0;
+
+ bRet = rUnitConverter.convertMeasure( nX, aToken );
+ if( bRet && aTokenEnum.getNextToken( aToken ) )
+ bRet = rUnitConverter.convertMeasure( nY, aToken );
+
+ if( bRet )
+ {
+ if( nX < 0 )
+ {
+ if( nY < 0 )
+ aShadow.Location = table::ShadowLocation_TOP_LEFT;
+ else
+ aShadow.Location = table::ShadowLocation_BOTTOM_LEFT;
+ }
+ else
+ {
+ if( nY < 0 )
+ aShadow.Location = table::ShadowLocation_TOP_RIGHT;
+ else
+ aShadow.Location = table::ShadowLocation_BOTTOM_RIGHT;
+ }
+
+ if( nX < 0 ) nX *= -1;
+ if( nY < 0 ) nY *= -1;
+
+ aShadow.ShadowWidth = sal::static_int_cast< sal_Int16 >(
+ (nX + nY) >> 1);
+ }
+ }
+ }
+
+ if( bRet && ( bColorFound || bOffsetFound ) )
+ {
+ aShadow.IsTransparent = aColor.GetTransparency() > 0;
+ aShadow.Color = aColor.GetColor();
+ bRet = sal_True;
+ }
+
+ rValue <<= aShadow;
+
+ return bRet;
+}
+
+sal_Bool XMLShadowPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ OUStringBuffer aOut;
+ table::ShadowFormat aShadow;
+
+ if( rValue >>= aShadow )
+ {
+ sal_Int32 nX = 1, nY = 1;
+
+ switch( aShadow.Location )
+ {
+ case table::ShadowLocation_TOP_LEFT:
+ nX = -1;
+ nY = -1;
+ break;
+ case table::ShadowLocation_TOP_RIGHT:
+ nY = -1;
+ break;
+ case table::ShadowLocation_BOTTOM_LEFT:
+ nX = -1;
+ break;
+ case table::ShadowLocation_BOTTOM_RIGHT:
+ break;
+ case table::ShadowLocation_NONE:
+ default:
+ rStrExpValue = GetXMLToken(XML_NONE);
+ return sal_True;
+ }
+
+ nX *= aShadow.ShadowWidth;
+ nY *= aShadow.ShadowWidth;
+
+ rUnitConverter.convertColor( aOut, aShadow.Color );
+
+ aOut.append( sal_Unicode(' ') );
+ rUnitConverter.convertMeasure( aOut, nX );
+ aOut.append( sal_Unicode(' ') );
+ rUnitConverter.convertMeasure( aOut, nY );
+
+ rStrExpValue = aOut.makeStringAndClear();
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/shadwhdl.hxx b/xmloff/source/style/shadwhdl.hxx
new file mode 100644
index 000000000000..6cb957778f01
--- /dev/null
+++ b/xmloff/source/style/shadwhdl.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PROPERTYHANDLER_SHADOWTYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_SHADOWTYPES_HXX
+
+#include <xmloff/xmlprhdl.hxx>
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLShadowPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLShadowPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_BASICTYPES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/shdwdhdl.cxx b/xmloff/source/style/shdwdhdl.cxx
new file mode 100644
index 000000000000..c6e2279239db
--- /dev/null
+++ b/xmloff/source/style/shdwdhdl.cxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "shdwdhdl.hxx"
+#include <com/sun/star/uno/Any.hxx>
+#include <rtl/ustrbuf.hxx>
+
+// --
+#include <xmloff/xmltoken.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star::uno;
+using namespace ::xmloff::token;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLFmtSplitPropHdl
+//
+
+XMLShadowedPropHdl::~XMLShadowedPropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLShadowedPropHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+
+ sal_Bool bValue = ! IsXMLToken( rStrImpValue, XML_NONE );
+ rValue <<= sal_Bool(bValue);
+ bRet = sal_True;
+
+ return bRet;
+}
+
+sal_Bool XMLShadowedPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Bool bValue = sal_Bool();
+
+ if (rValue >>= bValue)
+ {
+ if( bValue )
+ {
+ rStrExpValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "1pt 1pt" ) );
+ }
+ else
+ {
+ rStrExpValue = GetXMLToken( XML_NONE );
+ }
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/shdwdhdl.hxx b/xmloff/source/style/shdwdhdl.hxx
new file mode 100644
index 000000000000..aba2f6c2c67a
--- /dev/null
+++ b/xmloff/source/style/shdwdhdl.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PROPERTYHANDLER_SHADOWEDTYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_SHADOWEDTYPES_HXX
+
+#include <xmloff/xmlprhdl.hxx>
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLShadowedPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLShadowedPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_SHADOWEDTYPES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/styleexp.cxx b/xmloff/source/style/styleexp.cxx
new file mode 100644
index 000000000000..81b8dd3409e4
--- /dev/null
+++ b/xmloff/source/style/styleexp.cxx
@@ -0,0 +1,526 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#ifndef _SVSTDARR_STRINGSSORTDTOR_DECL
+#define _SVSTDARR_STRINGSSORTDTOR
+#include <svl/svstdarr.hxx>
+#endif
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/attrlist.hxx>
+#include <xmloff/xmlprmap.hxx>
+#include <xmloff/xmlexppr.hxx>
+#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#include <com/sun/star/text/XChapterNumberingSupplier.hpp>
+#include <xmloff/xmlaustp.hxx>
+#include <xmloff/styleexp.hxx>
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/XMLEventExport.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::text;
+using namespace ::xmloff::token;
+
+using ::com::sun::star::document::XEventsSupplier;
+
+XMLStyleExport::XMLStyleExport(
+ SvXMLExport& rExp,
+ const ::rtl::OUString& rPoolStyleName,
+ SvXMLAutoStylePoolP *pAutoStyleP ) :
+ rExport( rExp ),
+ sIsPhysical( RTL_CONSTASCII_USTRINGPARAM( "IsPhysical" ) ),
+ sIsAutoUpdate( RTL_CONSTASCII_USTRINGPARAM( "IsAutoUpdate" ) ),
+ sFollowStyle( RTL_CONSTASCII_USTRINGPARAM( "FollowStyle" ) ),
+ sNumberingStyleName( RTL_CONSTASCII_USTRINGPARAM( "NumberingStyleName" ) ),
+ sOutlineLevel( RTL_CONSTASCII_USTRINGPARAM( "OutlineLevel" ) ),
+ sPoolStyleName( rPoolStyleName ),
+ pAutoStylePool( pAutoStyleP )
+{
+}
+
+XMLStyleExport::~XMLStyleExport()
+{
+}
+
+void XMLStyleExport::exportStyleAttributes( const Reference< XStyle >& )
+{
+}
+
+void XMLStyleExport::exportStyleContent( const Reference< XStyle >& )
+{
+}
+
+sal_Bool XMLStyleExport::exportStyle(
+ const Reference< XStyle >& rStyle,
+ const OUString& rXMLFamily,
+ const UniReference < SvXMLExportPropertyMapper >& rPropMapper,
+ const Reference< XNameAccess >& xStyles,
+ const OUString* pPrefix )
+{
+ Reference< XPropertySet > xPropSet( rStyle, UNO_QUERY );
+ Reference< XPropertySetInfo > xPropSetInfo =
+ xPropSet->getPropertySetInfo();
+ Any aAny;
+
+ // Don't export styles that aren't existing really. This may be the
+ // case for StarOffice Writer's pool styles.
+ if( xPropSetInfo->hasPropertyByName( sIsPhysical ) )
+ {
+ aAny = xPropSet->getPropertyValue( sIsPhysical );
+ if( !*(sal_Bool *)aAny.getValue() )
+ return sal_False;
+ }
+
+ // <style:style ...>
+ GetExport().CheckAttrList();
+
+ // style:name="..."
+ OUString sName;
+
+ if(pPrefix)
+ sName = *pPrefix;
+ sName += rStyle->getName();
+
+ sal_Bool bEncoded = sal_False;
+ const OUString sEncodedStyleName(GetExport().EncodeStyleName( sName, &bEncoded ));
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_NAME, sEncodedStyleName );
+
+ if( bEncoded )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_DISPLAY_NAME,
+ sName);
+
+ // style:family="..."
+ if( rXMLFamily.getLength() > 0 )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_FAMILY, rXMLFamily);
+
+ // style:parent-style-name="..."
+ OUString sParentString(rStyle->getParentStyle());
+ OUString sParent;
+
+ if(sParentString.getLength())
+ {
+ if(pPrefix)
+ sParent = *pPrefix;
+ sParent += sParentString;
+ }
+ else
+ sParent = sPoolStyleName;
+
+ if( sParent.getLength() )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_PARENT_STYLE_NAME,
+ GetExport().EncodeStyleName( sParent ) );
+
+ // style:next-style-name="..." (paragraph styles only)
+ if( xPropSetInfo->hasPropertyByName( sFollowStyle ) )
+ {
+ aAny = xPropSet->getPropertyValue( sFollowStyle );
+ OUString sNextName;
+ aAny >>= sNextName;
+ if( sName != sNextName )
+ {
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_NEXT_STYLE_NAME,
+ GetExport().EncodeStyleName( sNextName ) );
+ }
+ }
+
+ // style:auto-update="..." (SW only)
+ if( xPropSetInfo->hasPropertyByName( sIsAutoUpdate ) )
+ {
+ aAny = xPropSet->getPropertyValue( sIsAutoUpdate );
+ if( *(sal_Bool *)aAny.getValue() )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_AUTO_UPDATE,
+ XML_TRUE );
+ }
+
+ // style:default-outline-level"..."
+ sal_Int32 nOutlineLevel = 0;
+ if( xPropSetInfo->hasPropertyByName( sOutlineLevel ) )
+ {
+ Reference< XPropertyState > xPropState( xPropSet, uno::UNO_QUERY );
+ if( PropertyState_DIRECT_VALUE == xPropState->getPropertyState( sOutlineLevel ) )
+ {
+ aAny = xPropSet->getPropertyValue( sOutlineLevel );
+ aAny >>= nOutlineLevel;
+ if( nOutlineLevel > 0 )
+ {
+ OUStringBuffer sTmp;
+ sTmp.append( static_cast<sal_Int32>(nOutlineLevel));
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE,
+ XML_DEFAULT_OUTLINE_LEVEL,
+ sTmp.makeStringAndClear() );
+ }
+ else
+ {
+ /* Empty value for style:default-outline-level does exist
+ since ODF 1.2. Thus, suppress its export for former versions. (#i104889#)
+ */
+ if ( ( GetExport().getExportFlags() & EXPORT_OASIS ) != 0 &&
+ GetExport().getDefaultVersion() >= SvtSaveOptions::ODFVER_012 )
+ {
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE,
+ XML_DEFAULT_OUTLINE_LEVEL,
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "" )));
+ }
+ }
+ }
+ }
+
+ // style:list-style-name="..." (SW paragarph styles only)
+ if( xPropSetInfo->hasPropertyByName( sNumberingStyleName ) )
+ {
+ Reference< XPropertyState > xPropState( xPropSet, uno::UNO_QUERY );
+ if( PropertyState_DIRECT_VALUE ==
+ xPropState->getPropertyState( sNumberingStyleName ) )
+ {
+ aAny = xPropSet->getPropertyValue( sNumberingStyleName );
+ if( aAny.hasValue() )
+ {
+ OUString sListName;
+ aAny >>= sListName;
+
+ /* An direct set empty list style has to be written. Otherwise,
+ this information is lost and causes an error, if the parent
+ style has a list style set. (#i69523#)
+ */
+ if ( !sListName.getLength() )
+ {
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE,
+ XML_LIST_STYLE_NAME,
+ sListName /* empty string */);
+ }
+ else
+ {
+ // Written OpenDocument file format doesn't fit to the created text document (#i69627#)
+ bool bSuppressListStyle( false );
+ {
+ if ( !GetExport().writeOutlineStyleAsNormalListStyle() )
+ {
+ Reference< XChapterNumberingSupplier > xCNSupplier
+ (GetExport().GetModel(), UNO_QUERY);
+
+ OUString sOutlineName;
+ if (xCNSupplier.is())
+ {
+ Reference< XIndexReplace > xNumRule
+ ( xCNSupplier->getChapterNumberingRules() );
+ DBG_ASSERT( xNumRule.is(), "no chapter numbering rules" );
+
+ if (xNumRule.is())
+ {
+ Reference< XPropertySet > xNumRulePropSet
+ (xNumRule, UNO_QUERY);
+ xNumRulePropSet->getPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Name")) )
+ >>= sOutlineName;
+ bSuppressListStyle = ( sListName == sOutlineName );
+ }
+ }
+ }
+ }
+
+ if ( sListName.getLength() && !bSuppressListStyle )
+ {
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE,
+ XML_LIST_STYLE_NAME,
+ GetExport().EncodeStyleName( sListName ) );
+ }
+ }
+ }
+ }
+ else if( nOutlineLevel > 0 )
+ {
+
+ bool bNoInheritedListStyle( true );
+
+ /////////////////////////////////////////////////
+ Reference<XStyle> xStyle( xPropState, UNO_QUERY );
+ while ( xStyle.is() )
+ {
+ OUString aParentStyle( xStyle->getParentStyle() );
+ if ( aParentStyle.getLength() == 0 ||
+ !xStyles->hasByName( aParentStyle ) )
+ {
+ break;
+ }
+ else
+ {
+ xPropState = Reference< XPropertyState >( xStyles->getByName( aParentStyle ), UNO_QUERY );
+ if ( !xPropState.is() )
+ {
+ break;
+ }
+ if ( xPropState->getPropertyState( sNumberingStyleName ) == PropertyState_DIRECT_VALUE )
+ {
+ bNoInheritedListStyle = false;
+ break;
+ }
+ else
+ {
+ xStyle = Reference<XStyle>( xPropState, UNO_QUERY );
+ }
+ }
+ }
+ /////////////////////////////////////////////////
+ if ( bNoInheritedListStyle )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE,
+ XML_LIST_STYLE_NAME,
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "" )));
+ }
+ }
+
+ // style:pool-id="..." is not required any longer since we use
+ // english style names only
+ exportStyleAttributes( rStyle );
+
+ // TODO: style:help-file-name="..." and style:help-id="..." can neither
+ // be modified by UI nor by API and that for, have not to be exported
+ // currently.
+
+ {
+ // <style:style>
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_STYLE, XML_STYLE,
+ sal_True, sal_True );
+
+ rPropMapper->SetStyleName( sName );
+
+ // <style:properties>
+ ::std::vector< XMLPropertyState > xPropStates =
+ rPropMapper->Filter( xPropSet );
+ rPropMapper->exportXML( GetExport(), xPropStates,
+ XML_EXPORT_FLAG_IGN_WS );
+
+ rPropMapper->SetStyleName( OUString() );
+
+ exportStyleContent( rStyle );
+
+ // <script:events>, if they are supported by this style
+ Reference<XEventsSupplier> xEventsSupp(rStyle, UNO_QUERY);
+ GetExport().GetEventExport().Export(xEventsSupp);
+ }
+ return sal_True;
+}
+
+sal_Bool XMLStyleExport::exportDefaultStyle(
+ const Reference< XPropertySet >& xPropSet,
+ const OUString& rXMLFamily,
+ const UniReference < SvXMLExportPropertyMapper >& rPropMapper )
+{
+ Reference< XPropertySetInfo > xPropSetInfo =
+ xPropSet->getPropertySetInfo();
+
+ Any aAny;
+
+ // <style:default-style ...>
+ GetExport().CheckAttrList();
+
+ {
+ // style:family="..."
+ if( rXMLFamily.getLength() > 0 )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_FAMILY,
+ rXMLFamily );
+ // <style:style>
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_STYLE,
+ XML_DEFAULT_STYLE,
+ sal_True, sal_True );
+ // <style:properties>
+ ::std::vector< XMLPropertyState > xPropStates =
+ rPropMapper->FilterDefaults( xPropSet );
+ rPropMapper->exportXML( GetExport(), xPropStates,
+ XML_EXPORT_FLAG_IGN_WS );
+ }
+ return sal_True;
+}
+
+void XMLStyleExport::exportStyleFamily(
+ const sal_Char *pFamily,
+ const OUString& rXMLFamily,
+ const UniReference < SvXMLExportPropertyMapper >& rPropMapper,
+ sal_Bool bUsed, sal_uInt16 nFamily, const OUString* pPrefix)
+{
+ const OUString sFamily(OUString::createFromAscii(pFamily ));
+ exportStyleFamily( sFamily, rXMLFamily, rPropMapper, bUsed, nFamily,
+ pPrefix);
+}
+
+void XMLStyleExport::exportStyleFamily(
+ const OUString& rFamily, const OUString& rXMLFamily,
+ const UniReference < SvXMLExportPropertyMapper >& rPropMapper,
+ sal_Bool bUsed, sal_uInt16 nFamily, const OUString* pPrefix)
+{
+ DBG_ASSERT( GetExport().GetModel().is(), "There is the model?" );
+ Reference< XStyleFamiliesSupplier > xFamiliesSupp( GetExport().GetModel(), UNO_QUERY );
+ if( !xFamiliesSupp.is() )
+ return; // family not available in current model
+
+ Reference< XNameAccess > xStyleCont;
+
+ Reference< XNameAccess > xFamilies( xFamiliesSupp->getStyleFamilies() );
+ if( xFamilies->hasByName( rFamily ) )
+ xFamilies->getByName( rFamily ) >>= xStyleCont;
+
+ if( !xStyleCont.is() )
+ return;
+
+ Reference< XNameAccess > xStyles( xStyleCont, UNO_QUERY );
+ // If next styles are supported and used styles should be exported only,
+ // the next style may be unused but has to be exported, too. In this case
+ // the names of all exported styles are remembered.
+ SvStringsSortDtor *pExportedStyles = 0;
+ sal_Bool bFirstStyle = sal_True;
+
+ const uno::Sequence< ::rtl::OUString> aSeq = xStyles->getElementNames();
+ const ::rtl::OUString* pIter = aSeq.getConstArray();
+ const ::rtl::OUString* pEnd = pIter + aSeq.getLength();
+ for(;pIter != pEnd;++pIter)
+ {
+ Reference< XStyle > xStyle;
+ try
+ {
+ xStyles->getByName( *pIter ) >>= xStyle;
+ }
+ catch( lang::IndexOutOfBoundsException )
+ {
+ // due to bugs in prior versions it is possible that
+ // a binary file is missing some critical styles.
+ // The only possible way to deal with this is to
+ // not export them here and remain silent.
+ continue;
+ }
+
+ DBG_ASSERT( xStyle.is(), "Style not found for export!" );
+ if( xStyle.is() )
+ {
+ if( !bUsed || xStyle->isInUse() )
+ {
+ sal_Bool bExported = exportStyle( xStyle, rXMLFamily, rPropMapper,
+ xStyles,pPrefix );
+ if( bUsed && bFirstStyle && bExported )
+ {
+ // If this is the first style, find out wether next styles
+ // are supported.
+ Reference< XPropertySet > xPropSet( xStyle, UNO_QUERY );
+ Reference< XPropertySetInfo > xPropSetInfo =
+ xPropSet->getPropertySetInfo();
+
+ if( xPropSetInfo->hasPropertyByName( sFollowStyle ) )
+ pExportedStyles = new SvStringsSortDtor;
+ bFirstStyle = sal_False;
+ }
+
+ if( pExportedStyles && bExported )
+ {
+ // If next styles are supported, remember this style's name.
+ String *pTmp = new String( xStyle->getName() );
+ if( !pExportedStyles->Insert( pTmp ) )
+ delete pTmp;
+ }
+ }
+
+ // if an auto style pool is given, remember this style's name as a
+ // style name that must not be used by automatic styles.
+ if( pAutoStylePool )
+ pAutoStylePool->RegisterName( nFamily, xStyle->getName() );
+ }
+ }
+
+ if( pExportedStyles )
+ {
+ // if next styles are supported, export all next styles that are
+ // unused and that for, haven't been exported in the first loop.
+ pIter = aSeq.getConstArray();
+ for(;pIter != pEnd;++pIter)
+ {
+ Reference< XStyle > xStyle;
+ xStyles->getByName( *pIter ) >>= xStyle;
+
+ DBG_ASSERT( xStyle.is(), "Style not found for export!" );
+ if( xStyle.is() )
+ {
+ Reference< XPropertySet > xPropSet( xStyle, UNO_QUERY );
+ Reference< XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
+
+ // styles that aren't existing realy are ignored.
+ if( xPropSetInfo->hasPropertyByName( sIsPhysical ) )
+ {
+ Any aAny( xPropSet->getPropertyValue( sIsPhysical ) );
+ if( !*(sal_Bool *)aAny.getValue() )
+ continue;
+ }
+
+ if( !xStyle->isInUse() )
+ continue;
+
+ if( !xPropSetInfo->hasPropertyByName( sFollowStyle ) )
+ {
+ DBG_ASSERT( 0==sFollowStyle.getLength(),
+ "no follow style???" );
+ continue;
+ }
+
+ OUString sNextName;
+ xPropSet->getPropertyValue( sFollowStyle ) >>= sNextName;
+ String sTmp( sNextName );
+ // if the next style hasn't been exported by now, export it now
+ // and remember its name.
+ if( xStyle->getName() != sNextName &&
+ !pExportedStyles->Seek_Entry( &sTmp ) )
+ {
+ xStyleCont->getByName( sNextName ) >>= xStyle;
+ DBG_ASSERT( xStyle.is(), "Style not found for export!" );
+
+ if( xStyle.is() && exportStyle( xStyle, rXMLFamily, rPropMapper, xStyles,pPrefix ) )
+ pExportedStyles->Insert( new String( sTmp ) );
+ }
+ }
+ }
+ }
+
+ delete pExportedStyles;
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/tabsthdl.cxx b/xmloff/source/style/tabsthdl.cxx
new file mode 100644
index 000000000000..c4e84b88858c
--- /dev/null
+++ b/xmloff/source/style/tabsthdl.cxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tabsthdl.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/style/TabStop.hpp>
+
+using namespace ::com::sun::star;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLFontFamilyNamePropHdl
+//
+
+XMLTabStopPropHdl::~XMLTabStopPropHdl()
+{
+ // Nothing to do
+}
+
+bool XMLTabStopPropHdl::equals( const uno::Any& r1, const uno::Any& r2 ) const
+{
+ sal_Bool bEqual = sal_False;
+
+ uno::Sequence< style::TabStop> aSeq1;
+ if( r1 >>= aSeq1 )
+ {
+ uno::Sequence< style::TabStop> aSeq2;
+ if( r2 >>= aSeq2 )
+ {
+ if( aSeq1.getLength() == aSeq2.getLength() )
+ {
+ bEqual = sal_True;
+ if( aSeq1.getLength() > 0 )
+ {
+ const style::TabStop* pTabs1 = aSeq1.getConstArray();
+ const style::TabStop* pTabs2 = aSeq2.getConstArray();
+
+ int i=0;
+
+ do
+ {
+ bEqual = ( pTabs1[i].Position == pTabs2[i].Position &&
+ pTabs1[i].Alignment == pTabs2[i].Alignment &&
+ pTabs1[i].DecimalChar == pTabs2[i].DecimalChar &&
+ pTabs1[i].FillChar == pTabs2[i].FillChar );
+ i++;
+
+ } while( bEqual && i < aSeq1.getLength() );
+ }
+ }
+ }
+ }
+
+ return bEqual;
+}
+
+sal_Bool XMLTabStopPropHdl::importXML( const ::rtl::OUString&, ::com::sun::star::uno::Any&, const SvXMLUnitConverter& ) const
+{
+ return sal_False;
+}
+
+sal_Bool XMLTabStopPropHdl::exportXML( ::rtl::OUString&, const ::com::sun::star::uno::Any&, const SvXMLUnitConverter& ) const
+{
+ return sal_False;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/tabsthdl.hxx b/xmloff/source/style/tabsthdl.hxx
new file mode 100644
index 000000000000..008cbcbf2291
--- /dev/null
+++ b/xmloff/source/style/tabsthdl.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PROPERTYHANDLER_TABSTOPTYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_TABSTOPTYPES_HXX
+
+#include <xmloff/xmlprhdl.hxx>
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLTabStopPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLTabStopPropHdl();
+
+ virtual bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const;
+
+ /// TabStops will be imported/exported as XML-Elements. So the Import/Export-work must be done at another place.
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_TABSTOPTYPES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/undlihdl.cxx b/xmloff/source/style/undlihdl.cxx
new file mode 100644
index 000000000000..85f72a06cdc8
--- /dev/null
+++ b/xmloff/source/style/undlihdl.cxx
@@ -0,0 +1,383 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <undlihdl.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <rtl/ustrbuf.hxx>
+
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/awt/FontUnderline.hpp>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::awt;
+using namespace ::xmloff::token;
+
+SvXMLEnumMapEntry const pXML_UnderlineType_Enum[] =
+{
+ { XML_NONE, FontUnderline::NONE },
+ { XML_SINGLE, FontUnderline::SINGLE },
+ { XML_DOUBLE, FontUnderline::DOUBLE },
+ { XML_SINGLE, FontUnderline::DOTTED },
+ { XML_SINGLE, FontUnderline::DASH },
+ { XML_SINGLE, FontUnderline::LONGDASH },
+ { XML_SINGLE, FontUnderline::DASHDOT },
+ { XML_SINGLE, FontUnderline::DASHDOTDOT },
+ { XML_SINGLE, FontUnderline::WAVE },
+ { XML_SINGLE, FontUnderline::BOLD },
+ { XML_SINGLE, FontUnderline::BOLDDOTTED },
+ { XML_SINGLE, FontUnderline::BOLDDASH },
+ { XML_SINGLE, FontUnderline::BOLDLONGDASH },
+ { XML_SINGLE, FontUnderline::BOLDDASHDOT },
+ { XML_SINGLE, FontUnderline::BOLDDASHDOTDOT },
+ { XML_SINGLE, FontUnderline::BOLDWAVE },
+ { XML_DOUBLE, FontUnderline::DOUBLEWAVE },
+ { XML_SINGLE, FontUnderline::SMALLWAVE },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry const pXML_UnderlineStyle_Enum[] =
+{
+ { XML_NONE, FontUnderline::NONE },
+ { XML_SOLID, FontUnderline::SINGLE },
+ { XML_SOLID, FontUnderline::DOUBLE },
+ { XML_DOTTED, FontUnderline::DOTTED },
+ { XML_DASH, FontUnderline::DASH },
+ { XML_LONG_DASH, FontUnderline::LONGDASH },
+ { XML_DOT_DASH, FontUnderline::DASHDOT },
+ { XML_DOT_DOT_DASH, FontUnderline::DASHDOTDOT },
+ { XML_WAVE, FontUnderline::WAVE },
+ { XML_SOLID, FontUnderline::BOLD },
+ { XML_DOTTED, FontUnderline::BOLDDOTTED },
+ { XML_DASH, FontUnderline::BOLDDASH },
+ { XML_LONG_DASH, FontUnderline::BOLDLONGDASH },
+ { XML_DOT_DASH, FontUnderline::BOLDDASHDOT },
+ { XML_DOT_DOT_DASH, FontUnderline::BOLDDASHDOTDOT },
+ { XML_WAVE, FontUnderline::BOLDWAVE },
+ { XML_WAVE, FontUnderline::DOUBLEWAVE },
+ { XML_SMALL_WAVE, FontUnderline::SMALLWAVE },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry const pXML_UnderlineWidth_Enum[] =
+{
+ { XML_AUTO, FontUnderline::NONE },
+ { XML_AUTO, FontUnderline::SINGLE },
+ { XML_AUTO, FontUnderline::DOUBLE },
+ { XML_AUTO, FontUnderline::DOTTED },
+ { XML_AUTO, FontUnderline::DASH },
+ { XML_AUTO, FontUnderline::LONGDASH },
+ { XML_AUTO, FontUnderline::DASHDOT },
+ { XML_AUTO, FontUnderline::DASHDOTDOT },
+ { XML_AUTO, FontUnderline::WAVE },
+ { XML_BOLD, FontUnderline::BOLD },
+ { XML_BOLD, FontUnderline::BOLDDOTTED },
+ { XML_BOLD, FontUnderline::BOLDDASH },
+ { XML_BOLD, FontUnderline::BOLDLONGDASH },
+ { XML_BOLD, FontUnderline::BOLDDASHDOT },
+ { XML_BOLD, FontUnderline::BOLDDASHDOTDOT },
+ { XML_BOLD, FontUnderline::BOLDWAVE },
+ { XML_AUTO, FontUnderline::DOUBLEWAVE },
+ { XML_THIN, FontUnderline::NONE },
+ { XML_MEDIUM, FontUnderline::NONE },
+ { XML_THICK, FontUnderline::BOLD},
+ { XML_TOKEN_INVALID, 0 }
+};
+
+
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLUnderlineTypePropHdl
+//
+
+XMLUnderlineTypePropHdl::~XMLUnderlineTypePropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLUnderlineTypePropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_uInt16 eNewUnderline;
+ sal_Bool bRet = SvXMLUnitConverter::convertEnum(
+ eNewUnderline, rStrImpValue, pXML_UnderlineType_Enum );
+ if( bRet )
+ {
+ // multi property: style and width might be set already.
+ // If the old value is NONE, the new is used unchanged.
+ sal_Int16 eUnderline = sal_Int16();
+ if( (rValue >>= eUnderline) && FontUnderline::NONE!=eUnderline )
+ {
+ switch( eNewUnderline )
+ {
+ case FontUnderline::NONE:
+ case FontUnderline::SINGLE:
+ // keep existing line style
+ eNewUnderline = eUnderline;
+ break;
+ case FontUnderline::DOUBLE:
+ // A double line style has priority over a bold line style,
+ // but not over the line style itself.
+ switch( eUnderline )
+ {
+ case FontUnderline::SINGLE:
+ case FontUnderline::BOLD:
+ break;
+ case FontUnderline::WAVE:
+ case FontUnderline::BOLDWAVE:
+ eNewUnderline = FontUnderline::DOUBLEWAVE;
+ break;
+ default:
+ // If a double line style is not supported for the existing
+ // value, keep the new one
+ eNewUnderline = eUnderline;
+ break;
+ }
+ break;
+ default:
+ OSL_ENSURE( bRet, "unexpected line type value" );
+ break;
+ }
+ if( eNewUnderline != eUnderline )
+ rValue <<= (sal_Int16)eNewUnderline;
+ }
+ else
+ {
+ rValue <<= (sal_Int16)eNewUnderline;
+ }
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLUnderlineTypePropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int16 nValue = sal_Int16();
+ OUStringBuffer aOut;
+
+ if( (rValue >>= nValue) &&
+ (FontUnderline::DOUBLE == nValue ||
+ FontUnderline::DOUBLEWAVE == nValue) )
+ {
+ bRet = SvXMLUnitConverter::convertEnum(
+ aOut, (sal_uInt16)nValue, pXML_UnderlineType_Enum );
+ if( bRet )
+ rStrExpValue = aOut.makeStringAndClear();
+ }
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLUnderlineStylePropHdl
+//
+
+XMLUnderlineStylePropHdl::~XMLUnderlineStylePropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLUnderlineStylePropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_uInt16 eNewUnderline;
+ sal_Bool bRet = SvXMLUnitConverter::convertEnum(
+ eNewUnderline, rStrImpValue, pXML_UnderlineStyle_Enum );
+ if( bRet )
+ {
+ // multi property: style and width might be set already.
+ // If the old value is NONE, the new is used unchanged.
+ sal_Int16 eUnderline = sal_Int16();
+ if( (rValue >>= eUnderline) && FontUnderline::NONE!=eUnderline )
+ {
+ switch( eNewUnderline )
+ {
+ case FontUnderline::NONE:
+ case FontUnderline::SINGLE:
+ // keep double or bold line style
+ eNewUnderline = eUnderline;
+ case FontUnderline::DOTTED:
+ // The line style has priority over a double type.
+ if( FontUnderline::BOLD == eUnderline )
+ eNewUnderline = FontUnderline::BOLDDOTTED;
+ break;
+ case FontUnderline::DASH:
+ if( FontUnderline::BOLD == eUnderline )
+ eNewUnderline = FontUnderline::BOLDDASH;
+ break;
+ case FontUnderline::LONGDASH:
+ if( FontUnderline::BOLD == eUnderline )
+ eNewUnderline = FontUnderline::BOLDLONGDASH;
+ break;
+ case FontUnderline::DASHDOT:
+ if( FontUnderline::BOLD == eUnderline )
+ eNewUnderline = FontUnderline::BOLDDASHDOT;
+ break;
+ case FontUnderline::DASHDOTDOT:
+ if( FontUnderline::BOLD == eUnderline )
+ eNewUnderline = FontUnderline::BOLDDASHDOTDOT;
+ break;
+ case FontUnderline::WAVE:
+ if( FontUnderline::BOLD == eUnderline )
+ eNewUnderline = FontUnderline::BOLDWAVE;
+ break;
+ case FontUnderline::SMALLWAVE:
+ // SMALLWAVE is not used
+ default:
+ OSL_ENSURE( bRet, "unexpected line style value" );
+ break;
+ }
+ if( eNewUnderline != eUnderline )
+ rValue <<= (sal_Int16)eNewUnderline;
+ }
+ else
+ {
+ rValue <<= (sal_Int16)eNewUnderline;
+ }
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLUnderlineStylePropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int16 nValue = sal_Int16();
+ OUStringBuffer aOut;
+
+ if( rValue >>= nValue )
+ {
+ bRet = SvXMLUnitConverter::convertEnum(
+ aOut, (sal_uInt16)nValue, pXML_UnderlineStyle_Enum );
+ if( bRet )
+ rStrExpValue = aOut.makeStringAndClear();
+ }
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLUnderlineWidthPropHdl
+//
+
+XMLUnderlineWidthPropHdl::~XMLUnderlineWidthPropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLUnderlineWidthPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_uInt16 eNewUnderline;
+ sal_Bool bRet = SvXMLUnitConverter::convertEnum(
+ eNewUnderline, rStrImpValue, pXML_UnderlineWidth_Enum );
+ if( bRet )
+ {
+ // multi property: style and width might be set already.
+ // If the old value is NONE, the new is used unchanged.
+ sal_Int16 eUnderline = sal_Int16();
+ if( (rValue >>= eUnderline) && FontUnderline::NONE!=eUnderline )
+ {
+ switch( eNewUnderline )
+ {
+ case FontUnderline::NONE:
+ // keep existing line style
+ eNewUnderline = eUnderline;
+ break;
+ case FontUnderline::BOLD:
+ // A double line style has priority over a bold line style,
+ // but not over the line style itself.
+ switch( eUnderline )
+ {
+ case FontUnderline::SINGLE:
+ break;
+ case FontUnderline::DOTTED:
+ eNewUnderline = FontUnderline::BOLDDOTTED;
+ break;
+ case FontUnderline::DASH:
+ eNewUnderline = FontUnderline::BOLDDASH;
+ break;
+ case FontUnderline::LONGDASH:
+ eNewUnderline = FontUnderline::BOLDLONGDASH;
+ break;
+ case FontUnderline::DASHDOT:
+ eNewUnderline = FontUnderline::BOLDDASHDOT;
+ break;
+ case FontUnderline::DASHDOTDOT:
+ eNewUnderline = FontUnderline::BOLDDASHDOTDOT;
+ break;
+ case FontUnderline::WAVE:
+ eNewUnderline = FontUnderline::BOLDWAVE;
+ break;
+ default:
+ // a doube line style overwrites a bold one
+ eNewUnderline = eUnderline;
+ break;
+ }
+ break;
+ default:
+ OSL_ENSURE( bRet, "unexpected line width value" );
+ break;
+ }
+ if( eNewUnderline != eUnderline )
+ rValue <<= (sal_Int16)eNewUnderline;
+ }
+ else
+ {
+ rValue <<= (sal_Int16)eNewUnderline;
+ }
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLUnderlineWidthPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int16 nValue = sal_Int16();
+ OUStringBuffer aOut;
+
+ if( (rValue >>= nValue) && (FontUnderline::NONE != nValue) )
+ {
+ bRet = SvXMLUnitConverter::convertEnum(
+ aOut, (sal_uInt16)nValue, pXML_UnderlineWidth_Enum );
+ if( bRet )
+ rStrExpValue = aOut.makeStringAndClear();
+ }
+
+ return bRet;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/undlihdl.hxx b/xmloff/source/style/undlihdl.hxx
new file mode 100644
index 000000000000..60818cc35657
--- /dev/null
+++ b/xmloff/source/style/undlihdl.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PROPERTYHANDLER_UNDERLINETYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_UNDERLINETYPES_HXX
+
+#include <xmloff/xmlprhdl.hxx>
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLUnderlineTypePropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLUnderlineTypePropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+class XMLUnderlineStylePropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLUnderlineStylePropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+class XMLUnderlineWidthPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLUnderlineWidthPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_UNDERLINETYPES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/uniref.cxx b/xmloff/source/style/uniref.cxx
new file mode 100644
index 000000000000..342df9fa1a51
--- /dev/null
+++ b/xmloff/source/style/uniref.cxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <xmloff/uniref.hxx>
+
+UniRefBase::~UniRefBase()
+{
+}
+
+void UniRefBase::release()
+{
+ if( !osl_decrementInterlockedCount( &m_refCount ) )
+ delete this;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/weighhdl.cxx b/xmloff/source/style/weighhdl.cxx
new file mode 100644
index 000000000000..9955d446e66f
--- /dev/null
+++ b/xmloff/source/style/weighhdl.cxx
@@ -0,0 +1,177 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <weighhdl.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <tools/fontenum.hxx>
+#include <tools/solar.h>
+
+#ifndef _INC_LIMITS
+#include <limits.h>
+#endif
+#include <rtl/ustrbuf.hxx>
+#include <rtl/ustring.hxx>
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/awt/FontWeight.hpp>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star::uno;
+using namespace ::xmloff::token;
+
+struct FontWeightMapper
+{
+ float fWeight;
+ sal_uInt16 nValue;
+};
+
+FontWeightMapper const aFontWeightMap[] =
+{
+ { ::com::sun::star::awt::FontWeight::DONTKNOW, 0 },
+ { ::com::sun::star::awt::FontWeight::THIN, 100 },
+ { ::com::sun::star::awt::FontWeight::ULTRALIGHT, 150 },
+ { ::com::sun::star::awt::FontWeight::LIGHT, 250 },
+ { ::com::sun::star::awt::FontWeight::SEMILIGHT, 350 },
+ { ::com::sun::star::awt::FontWeight::NORMAL, 400 },
+ { ::com::sun::star::awt::FontWeight::NORMAL, 450 },
+ { ::com::sun::star::awt::FontWeight::SEMIBOLD, 600 },
+ { ::com::sun::star::awt::FontWeight::BOLD, 700 },
+ { ::com::sun::star::awt::FontWeight::ULTRABOLD, 800 },
+ { ::com::sun::star::awt::FontWeight::BLACK, 900 },
+ { ::com::sun::star::awt::FontWeight::DONTKNOW, 1000 }
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLFmtBreakBeforePropHdl
+//
+
+XMLFontWeightPropHdl::~XMLFontWeightPropHdl()
+{
+ // Nothing to do
+}
+
+sal_Bool XMLFontWeightPropHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_uInt16 nWeight = 0;
+
+ if( IsXMLToken( rStrImpValue, XML_WEIGHT_NORMAL ) )
+ {
+ nWeight = 400;
+ bRet = sal_True;
+ }
+ else if( IsXMLToken( rStrImpValue, XML_WEIGHT_BOLD ) )
+ {
+ nWeight = 700;
+ bRet = sal_True;
+ }
+ else
+ {
+ sal_Int32 nTemp;
+ bRet = SvXMLUnitConverter::convertNumber( nTemp, rStrImpValue, 100, 900 );
+ if( bRet )
+ nWeight = sal::static_int_cast< sal_uInt16 >(nTemp);
+ }
+
+ if( bRet )
+ {
+ bRet = sal_False;
+ static int nCount = sizeof(aFontWeightMap)/sizeof(FontWeightMapper);
+ for( int i=0; i<nCount; i++ )
+ {
+ if( (nWeight >= aFontWeightMap[i].nValue) && (nWeight <= aFontWeightMap[i+1].nValue) )
+ {
+ sal_uInt16 nDiff1 = nWeight - aFontWeightMap[i].nValue;
+ sal_uInt16 nDiff2 = aFontWeightMap[i+1].nValue - nWeight;
+
+ if( nDiff1 < nDiff2 )
+ rValue <<= aFontWeightMap[i].fWeight;
+ else
+ rValue <<= aFontWeightMap[i+1].fWeight;
+
+ bRet = sal_True;
+ break;
+ }
+ }
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLFontWeightPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+
+ float fValue = float();
+ if( !( rValue >>= fValue ) )
+ {
+ sal_Int32 nValue = 0;
+ if( rValue >>= nValue )
+ {
+ fValue = (float)nValue;
+ bRet = sal_True;
+ }
+ }
+ else
+ bRet = sal_True;
+
+ if( bRet )
+ {
+ sal_uInt16 nWeight = 0;
+ static int nCount = sizeof(aFontWeightMap)/sizeof(FontWeightMapper);
+ for( int i=0; i<nCount; i++ )
+ {
+ if( fValue <= aFontWeightMap[i].fWeight )
+ {
+ nWeight = aFontWeightMap[i].nValue;
+ break;
+ }
+ }
+
+ OUStringBuffer aOut;
+
+ if( 400 == nWeight )
+ aOut.append( GetXMLToken(XML_WEIGHT_NORMAL) );
+ else if( 700 == nWeight )
+ aOut.append( GetXMLToken(XML_WEIGHT_BOLD) );
+ else
+ SvXMLUnitConverter::convertNumber( aOut, (sal_Int32)nWeight );
+
+ rStrExpValue = aOut.makeStringAndClear();
+ }
+
+ return bRet;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/weighhdl.hxx b/xmloff/source/style/weighhdl.hxx
new file mode 100644
index 000000000000..5ac66dd18aff
--- /dev/null
+++ b/xmloff/source/style/weighhdl.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PROPERTYHANDLER_FONTWEIGHTTYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_FONTWEIGHTTYPES_HXX
+
+#include <xmloff/xmlprhdl.hxx>
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLFontWeightPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLFontWeightPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+
+#endif // _XMLOFF_PROPERTYHANDLER_FONTWEIGHTTYPES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/xmlaustp.cxx b/xmloff/source/style/xmlaustp.cxx
new file mode 100644
index 000000000000..669a4a169531
--- /dev/null
+++ b/xmloff/source/style/xmlaustp.cxx
@@ -0,0 +1,449 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+#include <com/sun/star/container/XIndexReplace.hpp>
+#include <tools/debug.hxx>
+#include "impastpl.hxx"
+#include <xmloff/xmlaustp.hxx>
+#include <xmloff/families.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlexp.hxx>
+#include "xmloff/XMLTextListAutoStylePool.hxx"
+
+#include <xmloff/PageMasterStyleMap.hxx>
+#include "PageMasterExportPropMapper.hxx"
+#include "XMLBackgroundImageExport.hxx"
+
+
+using namespace ::std;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+
+namespace
+{
+ static void lcl_exportDataStyle( SvXMLExport& _rExport, const UniReference< XMLPropertySetMapper >& _rxMapper,
+ const XMLPropertyState& _rProperty )
+ {
+ DBG_ASSERT( _rxMapper.is(), "xmloff::lcl_exportDataStyle: invalid property mapper!" );
+ // obtain the data style name
+ ::rtl::OUString sDataStyleName;
+ _rProperty.maValue >>= sDataStyleName;
+ DBG_ASSERT( sDataStyleName.getLength(), "xmloff::lcl_exportDataStyle: invalid property value for the data style name!" );
+
+ // add the attribute
+ _rExport.AddAttribute(
+ _rxMapper->GetEntryNameSpace( _rProperty.mnIndex ),
+ _rxMapper->GetEntryXMLName( _rProperty.mnIndex ),
+ sDataStyleName );
+ }
+}
+
+void SvXMLAutoStylePoolP::exportStyleAttributes(
+ SvXMLAttributeList&,
+ sal_Int32 nFamily,
+ const vector< XMLPropertyState >& rProperties,
+ const SvXMLExportPropertyMapper& rPropExp,
+ const SvXMLUnitConverter&,
+ const SvXMLNamespaceMap&
+ ) const
+{
+ if ( XML_STYLE_FAMILY_CONTROL_ID == nFamily )
+ { // it's a control-related style
+ UniReference< XMLPropertySetMapper > aPropertyMapper = rPropExp.getPropertySetMapper();
+
+ for ( vector< XMLPropertyState >::const_iterator pProp = rProperties.begin();
+ pProp != rProperties.end();
+ ++pProp
+ )
+ {
+ if ( ( pProp->mnIndex > -1 )
+ && ( CTF_FORMS_DATA_STYLE == aPropertyMapper->GetEntryContextId( pProp->mnIndex ) )
+ )
+ { // it's the data-style for a grid column
+ lcl_exportDataStyle( GetExport(), aPropertyMapper, *pProp );
+ }
+ }
+ }
+
+ if( (XML_STYLE_FAMILY_SD_GRAPHICS_ID == nFamily) || (XML_STYLE_FAMILY_SD_PRESENTATION_ID == nFamily) )
+ { // it's a graphics style
+ UniReference< XMLPropertySetMapper > aPropertyMapper = rPropExp.getPropertySetMapper();
+ DBG_ASSERT(aPropertyMapper.is(), "SvXMLAutoStylePoolP::exportStyleAttributes: invalid property set mapper!");
+
+ sal_Bool bFoundControlShapeDataStyle = sal_False;
+ sal_Bool bFoundNumberingRulesName = sal_False;
+
+ for ( vector< XMLPropertyState >::const_iterator pProp = rProperties.begin();
+ pProp != rProperties.end();
+ ++pProp
+ )
+ {
+ if (pProp->mnIndex > -1)
+ { // it's a valid property
+ switch( aPropertyMapper->GetEntryContextId(pProp->mnIndex) )
+ {
+ case CTF_SD_CONTROL_SHAPE_DATA_STYLE:
+ { // it's the control shape data style property
+
+ if (bFoundControlShapeDataStyle)
+ {
+ OSL_FAIL("SvXMLAutoStylePoolP::exportStyleAttributes: found two properties with the ControlShapeDataStyle context id!");
+ // already added the attribute for the first occurrence
+ break;
+ }
+
+ lcl_exportDataStyle( GetExport(), aPropertyMapper, *pProp );
+
+ // check if there is another property with the special context id we're handling here
+ bFoundControlShapeDataStyle = sal_True;
+ break;
+ }
+ case CTF_SD_NUMBERINGRULES_NAME:
+ {
+ if (bFoundNumberingRulesName)
+ {
+ OSL_FAIL("SvXMLAutoStylePoolP::exportStyleAttributes: found two properties with the numbering rules name context id!");
+ // already added the attribute for the first occurrence
+ break;
+ }
+
+ uno::Reference< container::XIndexReplace > xNumRule;
+ pProp->maValue >>= xNumRule;
+ if( xNumRule.is() && (xNumRule->getCount() > 0 ) )
+ {
+ const OUString sName(((XMLTextListAutoStylePool*)&GetExport().GetTextParagraphExport()->GetListAutoStylePool())->Add( xNumRule ));
+
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_LIST_STYLE_NAME, GetExport().EncodeStyleName( sName ) );
+ }
+
+ bFoundNumberingRulesName = sal_True;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ if( nFamily == XML_STYLE_FAMILY_PAGE_MASTER )
+ {
+ for( vector< XMLPropertyState >::const_iterator pProp = rProperties.begin(); pProp != rProperties.end(); ++pProp )
+ {
+ if (pProp->mnIndex > -1)
+ {
+ UniReference< XMLPropertySetMapper > aPropMapper = rPropExp.getPropertySetMapper();
+ sal_Int32 nIndex = pProp->mnIndex;
+ sal_Int16 nContextID = aPropMapper->GetEntryContextId( nIndex );
+ switch( nContextID )
+ {
+ case CTF_PM_PAGEUSAGE:
+ {
+ OUString sValue;
+ const XMLPropertyHandler* pPropHdl = aPropMapper->GetPropertyHandler( nIndex );
+ if( pPropHdl &&
+ pPropHdl->exportXML( sValue, pProp->maValue,
+ GetExport().GetMM100UnitConverter() ) &&
+ ( ! IsXMLToken( sValue, XML_ALL ) ) )
+ {
+ GetExport().AddAttribute( aPropMapper->GetEntryNameSpace( nIndex ), aPropMapper->GetEntryXMLName( nIndex ), sValue );
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
+}
+
+void SvXMLAutoStylePoolP::exportStyleContent(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > &,
+ sal_Int32 nFamily,
+ const vector< XMLPropertyState >& rProperties,
+ const SvXMLExportPropertyMapper& rPropExp,
+ const SvXMLUnitConverter&,
+ const SvXMLNamespaceMap&
+ ) const
+{
+ if( nFamily == XML_STYLE_FAMILY_PAGE_MASTER )
+ {
+ OUString sWS( GetXMLToken(XML_WS) );
+
+ sal_Int32 nHeaderStartIndex(-1);
+ sal_Int32 nHeaderEndIndex(-1);
+ sal_Int32 nFooterStartIndex(-1);
+ sal_Int32 nFooterEndIndex(-1);
+ sal_Bool bHeaderStartIndex(sal_False);
+ sal_Bool bHeaderEndIndex(sal_False);
+ sal_Bool bFooterStartIndex(sal_False);
+ sal_Bool bFooterEndIndex(sal_False);
+
+ UniReference< XMLPropertySetMapper > aPropMapper = rPropExp.getPropertySetMapper();
+
+ sal_Int32 nIndex(0);
+ while(nIndex < aPropMapper->GetEntryCount())
+ {
+ switch( aPropMapper->GetEntryContextId( nIndex ) & CTF_PM_FLAGMASK )
+ {
+ case CTF_PM_HEADERFLAG:
+ {
+ if (!bHeaderStartIndex)
+ {
+ nHeaderStartIndex = nIndex;
+ bHeaderStartIndex = sal_True;
+ }
+ if (bFooterStartIndex && !bFooterEndIndex)
+ {
+ nFooterEndIndex = nIndex;
+ bFooterEndIndex = sal_True;
+ }
+ }
+ break;
+ case CTF_PM_FOOTERFLAG:
+ {
+ if (!bFooterStartIndex)
+ {
+ nFooterStartIndex = nIndex;
+ bFooterStartIndex = sal_True;
+ }
+ if (bHeaderStartIndex && !bHeaderEndIndex)
+ {
+ nHeaderEndIndex = nIndex;
+ bHeaderEndIndex = sal_True;
+ }
+ }
+ break;
+ }
+ nIndex++;
+ }
+ if (!bHeaderEndIndex)
+ nHeaderEndIndex = nIndex;
+ if (!bFooterEndIndex)
+ nFooterEndIndex = nIndex;
+
+ // export header style element
+ {
+ SvXMLElementExport aElem(
+ GetExport(), XML_NAMESPACE_STYLE, XML_HEADER_STYLE,
+ sal_True, sal_True );
+
+ rPropExp.exportXML(
+ GetExport(), rProperties,
+ nHeaderStartIndex, nHeaderEndIndex, XML_EXPORT_FLAG_IGN_WS);
+ }
+
+ // export footer style
+ {
+ SvXMLElementExport aElem(
+ GetExport(), XML_NAMESPACE_STYLE, XML_FOOTER_STYLE,
+ sal_True, sal_True );
+
+ rPropExp.exportXML(
+ GetExport(), rProperties,
+ nFooterStartIndex, nFooterEndIndex, XML_EXPORT_FLAG_IGN_WS);
+ }
+ }
+}
+
+SvXMLAutoStylePoolP::SvXMLAutoStylePoolP()
+{
+ OSL_FAIL("This constuctor is obsoleted and should not be used!");
+ pImpl = NULL;
+}
+
+SvXMLAutoStylePoolP::SvXMLAutoStylePoolP( SvXMLExport& rExport )
+{
+ pImpl = new SvXMLAutoStylePoolP_Impl( rExport );
+}
+
+SvXMLAutoStylePoolP::~SvXMLAutoStylePoolP()
+{
+ delete pImpl;
+}
+
+SvXMLExport& SvXMLAutoStylePoolP::GetExport() const
+{
+ return pImpl->GetExport();
+}
+
+// TODO: romove this
+void SvXMLAutoStylePoolP::AddFamily(
+ sal_Int32 nFamily,
+ const OUString& rStrName,
+ SvXMLExportPropertyMapper* pMapper,
+ OUString aStrPrefix,
+ sal_Bool bAsFamily )
+{
+ UniReference <SvXMLExportPropertyMapper> xTmp = pMapper;
+ AddFamily( nFamily, rStrName, xTmp, aStrPrefix, bAsFamily );
+}
+
+void SvXMLAutoStylePoolP::AddFamily(
+ sal_Int32 nFamily,
+ const OUString& rStrName,
+ const UniReference < SvXMLExportPropertyMapper > & rMapper,
+ const OUString& rStrPrefix,
+ sal_Bool bAsFamily )
+{
+ pImpl->AddFamily( nFamily, rStrName, rMapper, rStrPrefix, bAsFamily );
+}
+
+void SvXMLAutoStylePoolP::RegisterName( sal_Int32 nFamily,
+ const OUString& rName )
+{
+ pImpl->RegisterName( nFamily, rName );
+}
+
+void SvXMLAutoStylePoolP::GetRegisteredNames(
+ uno::Sequence<sal_Int32>& rFamilies,
+ uno::Sequence<OUString>& rNames )
+{
+ pImpl->GetRegisteredNames( rFamilies, rNames );
+}
+
+void SvXMLAutoStylePoolP::RegisterNames(
+ uno::Sequence<sal_Int32>& aFamilies,
+ uno::Sequence<OUString>& aNames )
+{
+ DBG_ASSERT( aFamilies.getLength() == aNames.getLength(),
+ "aFamilies != aNames" );
+
+ // iterate over sequence(s) and call RegisterName(..) for each pair
+ const sal_Int32* pFamilies = aFamilies.getConstArray();
+ const OUString* pNames = aNames.getConstArray();
+ sal_Int32 nCount = min( aFamilies.getLength(), aNames.getLength() );
+ for( sal_Int32 n = 0; n < nCount; n++ )
+ RegisterName( pFamilies[n], pNames[n] );
+}
+
+OUString SvXMLAutoStylePoolP::Add( sal_Int32 nFamily,
+ const vector< XMLPropertyState >& rProperties )
+{
+ OUString sEmpty;
+ OUString sName;
+ pImpl->Add(sName, nFamily, sEmpty, rProperties );
+ return sName;
+}
+
+OUString SvXMLAutoStylePoolP::Add( sal_Int32 nFamily,
+ const OUString& rParent,
+ const vector< XMLPropertyState >& rProperties, bool bDontSeek )
+{
+ OUString sName;
+ pImpl->Add(sName, nFamily, rParent, rProperties, sal_False, bDontSeek );
+ return sName;
+}
+
+sal_Bool SvXMLAutoStylePoolP::Add(OUString& rName, sal_Int32 nFamily, const ::std::vector< XMLPropertyState >& rProperties )
+{
+ OUString sEmpty;
+ return pImpl->Add(rName, nFamily, sEmpty, rProperties);
+}
+
+sal_Bool SvXMLAutoStylePoolP::Add(OUString& rName, sal_Int32 nFamily, const OUString& rParent, const ::std::vector< XMLPropertyState >& rProperties )
+{
+ return pImpl->Add(rName, nFamily, rParent, rProperties);
+}
+
+sal_Bool SvXMLAutoStylePoolP::AddNamed( const OUString& rName, sal_Int32 nFamily, const OUString& rParent,
+ const ::std::vector< XMLPropertyState >& rProperties )
+
+{
+ return pImpl->AddNamed(rName, nFamily, rParent, rProperties);
+}
+
+OUString SvXMLAutoStylePoolP::AddAndCache( sal_Int32 nFamily,
+ const vector< XMLPropertyState >& rProperties )
+{
+ OUString sEmpty;
+ OUString sName;
+ pImpl->Add(sName, nFamily, sEmpty, rProperties, sal_True );
+ return sName;
+}
+
+OUString SvXMLAutoStylePoolP::AddAndCache( sal_Int32 nFamily,
+ const OUString& rParent,
+ const vector< XMLPropertyState >& rProperties )
+{
+ OUString sName;
+ pImpl->Add(sName, nFamily, rParent, rProperties, sal_True );
+ return sName;
+}
+
+OUString SvXMLAutoStylePoolP::AddAndCache( sal_Int32 nFamily,
+ const OUString& rParent )
+{
+ return pImpl->AddToCache( nFamily, rParent );
+}
+
+OUString SvXMLAutoStylePoolP::Find( sal_Int32 nFamily,
+ const vector< XMLPropertyState >& rProperties ) const
+{
+ OUString sEmpty;
+ return pImpl->Find( nFamily, sEmpty, rProperties );
+}
+
+OUString SvXMLAutoStylePoolP::Find( sal_Int32 nFamily,
+ const OUString& rParent,
+ const vector< XMLPropertyState >& rProperties ) const
+{
+ return pImpl->Find( nFamily, rParent, rProperties );
+}
+
+OUString SvXMLAutoStylePoolP::FindAndRemoveCached( sal_Int32 nFamily ) const
+{
+ return pImpl->FindAndRemoveCached( nFamily );
+}
+
+
+void SvXMLAutoStylePoolP::exportXML( sal_Int32 nFamily,
+ const uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > &,
+ const SvXMLUnitConverter&,
+ const SvXMLNamespaceMap&
+ ) const
+{
+ pImpl->exportXML( nFamily,
+ GetExport().GetDocHandler(),
+ GetExport().GetMM100UnitConverter(),
+ GetExport().GetNamespaceMap(),
+ this);
+}
+
+void SvXMLAutoStylePoolP::ClearEntries()
+{
+ pImpl->ClearEntries();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/xmlbahdl.cxx b/xmloff/source/style/xmlbahdl.cxx
new file mode 100644
index 000000000000..af4fcaba8f3c
--- /dev/null
+++ b/xmloff/source/style/xmlbahdl.cxx
@@ -0,0 +1,946 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#include <xmlbahdl.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <xmloff/xmltoken.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star::uno;
+using namespace ::xmloff::token;
+
+void lcl_xmloff_setAny( Any& rValue, sal_Int32 nValue, sal_Int8 nBytes )
+{
+ switch( nBytes )
+ {
+ case 1:
+ if( nValue < SCHAR_MIN )
+ nValue = SCHAR_MIN;
+ else if( nValue > SCHAR_MAX )
+ nValue = SCHAR_MAX;
+ rValue <<= (sal_Int8)nValue;
+ break;
+ case 2:
+ if( nValue < SHRT_MIN )
+ nValue = SHRT_MIN;
+ else if( nValue > SHRT_MAX )
+ nValue = SHRT_MAX;
+ rValue <<= (sal_Int16)nValue;
+ break;
+ case 4:
+ rValue <<= nValue;
+ break;
+ }
+}
+
+sal_Bool lcl_xmloff_getAny( const Any& rValue, sal_Int32& nValue,
+ sal_Int8 nBytes )
+{
+ sal_Bool bRet = sal_False;
+
+ switch( nBytes )
+ {
+ case 1:
+ {
+ sal_Int8 nValue8 = 0;
+ bRet = rValue >>= nValue8;
+ nValue = nValue8;
+ }
+ break;
+ case 2:
+ {
+ sal_Int16 nValue16 = 0;
+ bRet = rValue >>= nValue16;
+ nValue = nValue16;
+ }
+ break;
+ case 4:
+ bRet = rValue >>= nValue;
+ break;
+ }
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLNumberPropHdl
+//
+
+XMLNumberPropHdl::~XMLNumberPropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLNumberPropHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+
+ sal_Int32 nValue = 0;
+ bRet = SvXMLUnitConverter::convertNumber( nValue, rStrImpValue );
+ lcl_xmloff_setAny( rValue, nValue, nBytes );
+
+ return bRet;
+}
+
+sal_Bool XMLNumberPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int32 nValue;
+ OUStringBuffer aOut;
+
+ if( lcl_xmloff_getAny( rValue, nValue, nBytes ) )
+ {
+ SvXMLUnitConverter::convertNumber( aOut, nValue );
+ rStrExpValue = aOut.makeStringAndClear();
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// class XMLNumberNonePropHdl
+//
+
+XMLNumberNonePropHdl::XMLNumberNonePropHdl( sal_Int8 nB ) :
+ sZeroStr( GetXMLToken(XML_NO_LIMIT) ),
+ nBytes( nB )
+{
+}
+
+XMLNumberNonePropHdl::XMLNumberNonePropHdl( enum XMLTokenEnum eZeroString, sal_Int8 nB ) :
+ sZeroStr( GetXMLToken( eZeroString ) ),
+ nBytes( nB )
+{
+}
+
+XMLNumberNonePropHdl::~XMLNumberNonePropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLNumberNonePropHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+
+ sal_Int32 nValue = 0;
+ if( rStrImpValue == sZeroStr )
+ {
+ bRet = sal_True;
+ }
+ else
+ {
+ bRet = SvXMLUnitConverter::convertNumber( nValue, rStrImpValue );
+ }
+ lcl_xmloff_setAny( rValue, nValue, nBytes );
+
+ return bRet;
+}
+
+sal_Bool XMLNumberNonePropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int32 nValue;
+
+ if( lcl_xmloff_getAny( rValue, nValue, nBytes ) )
+ {
+ OUStringBuffer aOut;
+
+ if( nValue == 0 )
+ {
+ aOut.append( sZeroStr );
+ }
+ else
+ {
+ SvXMLUnitConverter::convertNumber( aOut, nValue );
+ }
+
+ rStrExpValue = aOut.makeStringAndClear();
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLMeasurePropHdl
+//
+
+XMLMeasurePropHdl::~XMLMeasurePropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLMeasurePropHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+
+ sal_Int32 nValue = 0;
+ bRet = rUnitConverter.convertMeasure( nValue, rStrImpValue );
+ lcl_xmloff_setAny( rValue, nValue, nBytes );
+
+ return bRet;
+}
+
+sal_Bool XMLMeasurePropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int32 nValue;
+ OUStringBuffer aOut;
+
+ if( lcl_xmloff_getAny( rValue, nValue, nBytes ) )
+ {
+ rUnitConverter.convertMeasure( aOut, nValue );
+ rStrExpValue = aOut.makeStringAndClear();
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLBoolPropHdl
+//
+
+XMLBoolPropHdl::~XMLBoolPropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLBoolPropHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+
+ bool bValue;
+ bRet = SvXMLUnitConverter::convertBool( bValue, rStrImpValue );
+ rValue <<= sal_Bool(bValue);
+
+ return bRet;
+}
+
+sal_Bool XMLBoolPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ OUStringBuffer aOut;
+ sal_Bool bValue = sal_Bool();
+
+ if (rValue >>= bValue)
+ {
+ SvXMLUnitConverter::convertBool( aOut, bValue );
+ rStrExpValue = aOut.makeStringAndClear();
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLNBoolPropHdl
+//
+
+XMLNBoolPropHdl::~XMLNBoolPropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLNBoolPropHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+
+ bool bValue;
+ bRet = SvXMLUnitConverter::convertBool( bValue, rStrImpValue );
+ rValue <<= sal_Bool(!bValue);
+
+ return bRet;
+}
+
+sal_Bool XMLNBoolPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ OUStringBuffer aOut;
+ sal_Bool bValue = sal_Bool();
+
+ if (rValue >>= bValue)
+ {
+ SvXMLUnitConverter::convertBool( aOut, !bValue );
+ rStrExpValue = aOut.makeStringAndClear();
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLPercentPropHdl
+//
+
+XMLPercentPropHdl::~XMLPercentPropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLPercentPropHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+
+ sal_Int32 nValue = 0;
+ bRet = SvXMLUnitConverter::convertPercent( nValue, rStrImpValue );
+ lcl_xmloff_setAny( rValue, nValue, nBytes );
+
+ return bRet;
+}
+
+sal_Bool XMLPercentPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int32 nValue;
+ OUStringBuffer aOut;
+
+ if( lcl_xmloff_getAny( rValue, nValue, nBytes ) )
+ {
+ SvXMLUnitConverter::convertPercent( aOut, nValue );
+ rStrExpValue = aOut.makeStringAndClear();
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLDoublePercentPropHdl
+//
+
+sal_Bool XMLDoublePercentPropHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+
+ double fValue = 1.0;
+
+ if( rStrImpValue.indexOf( (sal_Unicode)'%' ) == -1 )
+ {
+ fValue = rStrImpValue.toDouble();
+ }
+ else
+ {
+ sal_Int32 nValue = 0;
+ bRet = SvXMLUnitConverter::convertPercent( nValue, rStrImpValue );
+ fValue = ((double)nValue) / 100.0;
+ }
+ rValue <<= fValue;
+
+ return bRet;
+}
+
+sal_Bool XMLDoublePercentPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ double fValue = 0;
+
+ if( rValue >>= fValue )
+ {
+ fValue *= 100.0;
+ if( fValue > 0 ) fValue += 0.5; else fValue -= 0.5;
+
+ sal_Int32 nValue = (sal_Int32)fValue;
+
+ OUStringBuffer aOut;
+ SvXMLUnitConverter::convertPercent( aOut, nValue );
+ rStrExpValue = aOut.makeStringAndClear();
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLNegPercentPropHdl
+//
+
+XMLNegPercentPropHdl::~XMLNegPercentPropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLNegPercentPropHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+
+ sal_Int32 nValue = 0;
+ bRet = SvXMLUnitConverter::convertPercent( nValue, rStrImpValue );
+ lcl_xmloff_setAny( rValue, 100-nValue, nBytes );
+
+ return bRet;
+}
+
+sal_Bool XMLNegPercentPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int32 nValue;
+ OUStringBuffer aOut;
+
+ if( lcl_xmloff_getAny( rValue, nValue, nBytes ) )
+ {
+ SvXMLUnitConverter::convertPercent( aOut, 100-nValue );
+ rStrExpValue = aOut.makeStringAndClear();
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLMeasurePxPropHdl
+//
+
+XMLMeasurePxPropHdl::~XMLMeasurePxPropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLMeasurePxPropHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+
+ sal_Int32 nValue = 0;
+ bRet = SvXMLUnitConverter::convertMeasurePx( nValue, rStrImpValue );
+ lcl_xmloff_setAny( rValue, nValue, nBytes );
+
+ return bRet;
+}
+
+sal_Bool XMLMeasurePxPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int32 nValue;
+ OUStringBuffer aOut;
+
+ if( lcl_xmloff_getAny( rValue, nValue, nBytes ) )
+ {
+ SvXMLUnitConverter::convertMeasurePx( aOut, nValue );
+ rStrExpValue = aOut.makeStringAndClear();
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLColorPropHdl
+//
+
+XMLColorPropHdl::~XMLColorPropHdl()
+{
+ // Nothing to do
+}
+
+sal_Bool XMLColorPropHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ Color aColor;
+
+ const OUString astrHSL( RTL_CONSTASCII_USTRINGPARAM( "hsl" ) );
+ if( rStrImpValue.matchIgnoreAsciiCase( astrHSL ) )
+ {
+ sal_Int32 nOpen = rStrImpValue.indexOf( '(' );
+ sal_Int32 nClose = rStrImpValue.lastIndexOf( ')' );
+
+ if( (nOpen != -1) && (nClose > nOpen) )
+ {
+ const OUString aTmp( rStrImpValue.copy( nOpen+1, nClose - nOpen-1) );
+
+ sal_Int32 nIndex = 0;
+
+ Sequence< double > aHSL(3);
+ aHSL[0] = aTmp.getToken( 0, ',', nIndex ).toDouble();
+ aHSL[1] = aTmp.getToken( 0, ',', nIndex ).toDouble() / 100.0;
+ aHSL[2] = aTmp.getToken( 0, ',', nIndex ).toDouble() / 100.0;
+ rValue <<= aHSL;
+ bRet = true;
+ }
+ }
+ else
+ {
+ bRet = SvXMLUnitConverter::convertColor( aColor, rStrImpValue );
+ rValue <<= (sal_Int32)( aColor.GetColor() );
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLColorPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ Color aColor;
+ sal_Int32 nColor = 0;
+
+ OUStringBuffer aOut;
+ if( rValue >>= nColor )
+ {
+ aColor.SetColor( nColor );
+
+ SvXMLUnitConverter::convertColor( aOut, aColor );
+ rStrExpValue = aOut.makeStringAndClear();
+
+ bRet = sal_True;
+ }
+ else
+ {
+ Sequence< double > aHSL;
+ if( (rValue >>= aHSL) && (aHSL.getLength() == 3) )
+ {
+ aOut.append( OUString(RTL_CONSTASCII_USTRINGPARAM("hsl(")) );
+ aOut.append( aHSL[0] );
+ aOut.append( OUString(RTL_CONSTASCII_USTRINGPARAM(",")) );
+ aOut.append( aHSL[1] * 100.0 );
+ aOut.append( OUString(RTL_CONSTASCII_USTRINGPARAM("%,")) );
+ aOut.append( aHSL[2] * 100.0 );
+ aOut.append( OUString(RTL_CONSTASCII_USTRINGPARAM("%)")) );
+ rStrExpValue = aOut.makeStringAndClear();
+
+ bRet = sal_True;
+ }
+ }
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLStringPropHdl
+//
+
+XMLStringPropHdl::~XMLStringPropHdl()
+{
+ // Nothing to do
+}
+
+sal_Bool XMLStringPropHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+
+ rValue <<= rStrImpValue;
+ bRet = sal_True;
+
+ return bRet;
+}
+
+sal_Bool XMLStringPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+
+ if( rValue >>= rStrExpValue )
+ bRet = sal_True;
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLStyleNamePropHdl
+//
+
+XMLStyleNamePropHdl::~XMLStyleNamePropHdl()
+{
+ // Nothing to do
+}
+
+sal_Bool XMLStyleNamePropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+
+ if( rValue >>= rStrExpValue )
+ {
+ rStrExpValue = rUnitConverter.encodeStyleName( rStrExpValue );
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLDoublePropHdl
+//
+
+XMLDoublePropHdl::~XMLDoublePropHdl()
+{
+ // Nothing to do
+}
+
+sal_Bool XMLDoublePropHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& ) const
+{
+ double fDblValue;
+ sal_Bool bRet = SvXMLUnitConverter::convertDouble( fDblValue, rStrImpValue );
+ rValue <<= fDblValue;
+ return bRet;
+}
+
+sal_Bool XMLDoublePropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+
+ double fValue = 0;
+
+ if( rValue >>= fValue )
+ {
+ OUStringBuffer aOut;
+ SvXMLUnitConverter::convertDouble( aOut, fValue );
+ rStrExpValue = aOut.makeStringAndClear();
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLColorTransparentPropHdl
+//
+
+XMLColorTransparentPropHdl::XMLColorTransparentPropHdl(
+ enum XMLTokenEnum eTransparent ) :
+ sTransparent( GetXMLToken(
+ eTransparent != XML_TOKEN_INVALID ? eTransparent : XML_TRANSPARENT ) )
+{
+ // Nothing to do
+}
+
+XMLColorTransparentPropHdl::~XMLColorTransparentPropHdl()
+{
+ // Nothing to do
+}
+
+sal_Bool XMLColorTransparentPropHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+
+ if( rStrImpValue != sTransparent )
+ {
+ Color aColor;
+ bRet = SvXMLUnitConverter::convertColor( aColor, rStrImpValue );
+ rValue <<= (sal_Int32)( aColor.GetColor() );
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLColorTransparentPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int32 nColor = 0;
+
+ if( rStrExpValue == sTransparent )
+ bRet = sal_False;
+ else if( rValue >>= nColor )
+ {
+ Color aColor( nColor );
+ OUStringBuffer aOut;
+ SvXMLUnitConverter::convertColor( aOut, aColor );
+ rStrExpValue = aOut.makeStringAndClear();
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLIsTransparentPropHdl
+//
+
+XMLIsTransparentPropHdl::XMLIsTransparentPropHdl(
+ enum XMLTokenEnum eTransparent, sal_Bool bTransPropVal ) :
+ sTransparent( GetXMLToken(
+ eTransparent != XML_TOKEN_INVALID ? eTransparent : XML_TRANSPARENT ) ),
+ bTransPropValue( bTransPropVal )
+{
+}
+
+XMLIsTransparentPropHdl::~XMLIsTransparentPropHdl()
+{
+ // Nothing to do
+}
+
+sal_Bool XMLIsTransparentPropHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bValue = ( (rStrImpValue == sTransparent) == bTransPropValue);
+ rValue.setValue( &bValue, ::getBooleanCppuType() );
+
+ return sal_True;
+}
+
+sal_Bool XMLIsTransparentPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+
+ // MIB: This looks a bit strange, because bTransPropValue == bValue should
+ // do the same, but this only applies if 'true' is represented by the same
+ // 8 bit value in bValue and bTransPropValue. Who will ensure this?
+ sal_Bool bValue = *(sal_Bool *)rValue.getValue();
+ sal_Bool bIsTrans = bTransPropValue ? bValue : !bValue;
+
+ if( bIsTrans )
+ {
+ rStrExpValue = sTransparent;
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLColorAutoPropHdl
+//
+
+XMLColorAutoPropHdl::XMLColorAutoPropHdl()
+{
+ // Nothing to do
+}
+
+XMLColorAutoPropHdl::~XMLColorAutoPropHdl()
+{
+ // Nothing to do
+}
+
+sal_Bool XMLColorAutoPropHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+
+ // This is a multi property: the value might be set to AUTO_COLOR
+ // already by the XMLIsAutoColorPropHdl!
+ sal_Int32 nColor = 0;
+ if( !(rValue >>= nColor) || -1 != nColor )
+ {
+ Color aColor;
+ bRet = SvXMLUnitConverter::convertColor( aColor, rStrImpValue );
+ if( bRet )
+ rValue <<= (sal_Int32)( aColor.GetColor() );
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLColorAutoPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+
+ sal_Int32 nColor = 0;
+ if( (rValue >>= nColor) && -1 != nColor )
+ {
+ Color aColor( nColor );
+ OUStringBuffer aOut;
+ SvXMLUnitConverter::convertColor( aOut, aColor );
+ rStrExpValue = aOut.makeStringAndClear();
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLIsAutoColorPropHdl
+//
+
+XMLIsAutoColorPropHdl::XMLIsAutoColorPropHdl()
+{
+}
+
+XMLIsAutoColorPropHdl::~XMLIsAutoColorPropHdl()
+{
+ // Nothing to do
+}
+
+sal_Bool XMLIsAutoColorPropHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& ) const
+{
+ bool bValue;
+
+ // An auto color overrides any other color set!
+ sal_Bool bRet = SvXMLUnitConverter::convertBool( bValue, rStrImpValue );
+ if( bRet && bValue )
+ rValue <<= (sal_Int32)-1;
+
+ return sal_True;
+}
+
+sal_Bool XMLIsAutoColorPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int32 nColor = 0;
+
+ if( (rValue >>= nColor) && -1 == nColor )
+ {
+ OUStringBuffer aOut;
+ SvXMLUnitConverter::convertBool( aOut, sal_True );
+ rStrExpValue = aOut.makeStringAndClear();
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLCompareOnlyPropHdl
+//
+
+XMLCompareOnlyPropHdl::~XMLCompareOnlyPropHdl()
+{
+ // Nothing to do
+}
+
+sal_Bool XMLCompareOnlyPropHdl::importXML( const OUString&, Any&, const SvXMLUnitConverter& ) const
+{
+ DBG_ASSERT( !this, "importXML called for compare-only-property" );
+ return sal_False;
+}
+
+sal_Bool XMLCompareOnlyPropHdl::exportXML( OUString&, const Any&, const SvXMLUnitConverter& ) const
+{
+ DBG_ASSERT( !this, "exportXML called for compare-only-property" );
+ return sal_False;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// class XMLNumberWithoutZeroPropHdl
+//
+
+XMLNumberWithoutZeroPropHdl::XMLNumberWithoutZeroPropHdl( sal_Int8 nB ) :
+ nBytes( nB )
+{
+}
+
+XMLNumberWithoutZeroPropHdl::~XMLNumberWithoutZeroPropHdl()
+{
+}
+
+sal_Bool XMLNumberWithoutZeroPropHdl::importXML(
+ const OUString& rStrImpValue,
+ Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ sal_Int32 nValue = 0;
+ sal_Bool bRet = SvXMLUnitConverter::convertNumber( nValue, rStrImpValue );
+ if( bRet )
+ lcl_xmloff_setAny( rValue, nValue, nBytes );
+ return bRet;
+}
+
+sal_Bool XMLNumberWithoutZeroPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& ) const
+{
+
+ sal_Int32 nValue = 0;
+ sal_Bool bRet = lcl_xmloff_getAny( rValue, nValue, nBytes );
+ bRet &= nValue != 0;
+
+ if( bRet )
+ {
+ OUStringBuffer aBuffer;
+ SvXMLUnitConverter::convertNumber( aBuffer, nValue );
+ rStrExpValue = aBuffer.makeStringAndClear();
+ }
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// class XMLNumberWithAutoInsteadZeroPropHdl
+//
+
+XMLNumberWithAutoInsteadZeroPropHdl::~XMLNumberWithAutoInsteadZeroPropHdl()
+{
+}
+
+sal_Bool XMLNumberWithAutoInsteadZeroPropHdl::importXML(
+ const OUString& rStrImpValue,
+ Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ sal_Int32 nValue = 0;
+ sal_Bool bRet = SvXMLUnitConverter::convertNumber( nValue, rStrImpValue );
+ if( bRet )
+ lcl_xmloff_setAny( rValue, nValue, 2 );
+ else if( rStrImpValue == GetXMLToken( XML_AUTO ) )
+ {
+ rValue <<= (sal_Int16)nValue;
+ bRet = sal_True;
+ }
+ return bRet;
+}
+
+sal_Bool XMLNumberWithAutoInsteadZeroPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& ) const
+{
+
+ sal_Int32 nValue = 0;
+ lcl_xmloff_getAny( rValue, nValue, 2 );
+
+ if( 0 == nValue )
+ rStrExpValue = GetXMLToken( XML_AUTO );
+ else
+ {
+ OUStringBuffer aBuffer;
+ SvXMLUnitConverter::convertNumber( aBuffer, nValue );
+ rStrExpValue = aBuffer.makeStringAndClear();
+ }
+
+ return sal_True;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/xmlbahdl.hxx b/xmloff/source/style/xmlbahdl.hxx
new file mode 100644
index 000000000000..80f75b0159c7
--- /dev/null
+++ b/xmloff/source/style/xmlbahdl.hxx
@@ -0,0 +1,310 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PROPERTYHANDLER_BASICTYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_BASICTYPES_HXX
+
+#include <xmloff/xmlprhdl.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <xmloff/xmltoken.hxx>
+
+
+/**
+ PropertyHandler for the XML-data-type: XML_TYPE_NUMBER
+*/
+class XMLNumberPropHdl : public XMLPropertyHandler
+{
+ sal_Int8 nBytes;
+
+public:
+ XMLNumberPropHdl( sal_Int8 nB=4 ) : nBytes( nB ) {}
+ virtual ~XMLNumberPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+/**
+ PropertyHandler for the XML-data-type: XML_TYPE_NUMBER_NONE
+*/
+class XMLNumberNonePropHdl : public XMLPropertyHandler
+{
+ ::rtl::OUString sZeroStr;
+ sal_Int8 nBytes;
+public:
+ XMLNumberNonePropHdl( sal_Int8 nB = 4 );
+ XMLNumberNonePropHdl( enum ::xmloff::token::XMLTokenEnum eZeroString, sal_Int8 nB = 4 );
+ virtual ~XMLNumberNonePropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+/**
+ PropertyHandler for the XML-data-type: XML_TYPE_MEASURE
+*/
+class XMLMeasurePropHdl : public XMLPropertyHandler
+{
+ sal_Int8 nBytes;
+public:
+ XMLMeasurePropHdl( sal_Int8 nB=4 ) : nBytes( nB ) {}
+ virtual ~XMLMeasurePropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+/**
+ PropertyHandler for the XML-data-type: XML_TYPE_PERCENT
+*/
+class XMLPercentPropHdl : public XMLPropertyHandler
+{
+ sal_Int8 nBytes;
+public:
+ XMLPercentPropHdl( sal_Int8 nB=4 ) : nBytes( nB ) {}
+ virtual ~XMLPercentPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+/**
+ PropertyHandler for the XML-data-type: XML_TYPE_PERCENT
+ that is mapped on a double from 0.0 to 1.0
+*/
+class XMLDoublePercentPropHdl : public XMLPropertyHandler
+{
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+/**
+ PropertyHandler for the XML-data-type: XML_TYPE_NEG_PERCENT
+*/
+class XMLNegPercentPropHdl : public XMLPropertyHandler
+{
+ sal_Int8 nBytes;
+public:
+ XMLNegPercentPropHdl( sal_Int8 nB=4 ) : nBytes( nB ) {}
+ virtual ~XMLNegPercentPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+/**
+ PropertyHandler for the XML-data-type: XML_TYPE_PERCENT
+*/
+class XMLMeasurePxPropHdl : public XMLPropertyHandler
+{
+ sal_Int8 nBytes;
+public:
+ XMLMeasurePxPropHdl( sal_Int8 nB=4 ) : nBytes( nB ) {}
+ virtual ~XMLMeasurePxPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+/**
+ PropertyHandler for the XML-data-type: XML_TYPE_BOOL
+*/
+class XMLBoolPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLBoolPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+/**
+ PropertyHandler for the XML-data-type: XML_TYPE_COLOR
+*/
+class XMLColorPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLColorPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+/**
+ PropertyHandler for the XML-data-type: XML_TYPE_STRING
+*/
+class XMLStringPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLStringPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+/**
+ PropertyHandler for the XML-data-type: XML_TYPE_STYLENAME
+*/
+class XMLStyleNamePropHdl : public XMLStringPropHdl
+{
+public:
+ virtual ~XMLStyleNamePropHdl();
+
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+
+/**
+ PropertyHandler for the XML-data-type: XML_TYPE_DOUBLE
+*/
+class XMLDoublePropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLDoublePropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+/**
+ PropertyHandler for the XML-data-type: XML_TYPE_NBOOL
+*/
+class XMLNBoolPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLNBoolPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+/**
+ PropertyHandler for the XML-data-type: XML_TYPE_COLORTRANSPARENT
+*/
+class XMLColorTransparentPropHdl : public XMLPropertyHandler
+{
+ const ::rtl::OUString sTransparent;
+
+public:
+ XMLColorTransparentPropHdl( enum ::xmloff::token::XMLTokenEnum eTransparent = xmloff::token::XML_TOKEN_INVALID );
+ virtual ~XMLColorTransparentPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+/**
+ PropertyHandler for the XML-data-type: XML_TYPE_ISTRANSPARENT
+*/
+class XMLIsTransparentPropHdl : public XMLPropertyHandler
+{
+ const ::rtl::OUString sTransparent;
+ sal_Bool bTransPropValue;
+
+public:
+ XMLIsTransparentPropHdl( enum ::xmloff::token::XMLTokenEnum eTransparent = xmloff::token::XML_TOKEN_INVALID,
+ sal_Bool bTransPropValue = sal_True );
+ virtual ~XMLIsTransparentPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+/**
+ PropertyHandler for the XML-data-type: XML_TYPE_COLORAUTO
+*/
+class XMLColorAutoPropHdl : public XMLPropertyHandler
+{
+public:
+ XMLColorAutoPropHdl();
+ virtual ~XMLColorAutoPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+/**
+ PropertyHandler for the XML-data-type: XML_TYPE_COLORISAUTO
+*/
+class XMLIsAutoColorPropHdl : public XMLPropertyHandler
+{
+public:
+ XMLIsAutoColorPropHdl();
+ virtual ~XMLIsAutoColorPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+
+/**
+ PropertyHandler for properties that cannot make use of importXML
+ and exportXML methods, but can make use of the default comparison
+*/
+class XMLCompareOnlyPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLCompareOnlyPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+/**
+ PropertyHandler for the XML-data-type: XML_TYPE_NUMBER_NO_ZERO
+ Reads/writes numeric properties, but fails for the value zero
+ (i.e., a value 0 property will not be written)
+*/
+class XMLNumberWithoutZeroPropHdl : public XMLPropertyHandler
+{
+ sal_Int8 nBytes;
+public:
+ XMLNumberWithoutZeroPropHdl( sal_Int8 nB = 4 );
+ virtual ~XMLNumberWithoutZeroPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+/**
+ PropertyHandler for the XML-data-type: XML_TYPE_NUMBER16_AUTO
+ Reads/writes numeric properties with special handling for the value zero
+ (i.e., a value 0 property will be written as "auto")
+*/
+class XMLNumberWithAutoInsteadZeroPropHdl : public XMLNumberWithoutZeroPropHdl
+{
+public:
+ virtual ~XMLNumberWithAutoInsteadZeroPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_BASICTYPES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/xmlexppr.cxx b/xmloff/source/style/xmlexppr.cxx
new file mode 100644
index 000000000000..48f383a9a376
--- /dev/null
+++ b/xmloff/source/style/xmlexppr.cxx
@@ -0,0 +1,1141 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/xml/AttributeData.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/beans/XTolerantMultiPropertySet.hpp>
+#include <com/sun/star/beans/TolerantPropertySetResultType.hpp>
+#include <rtl/ustrbuf.hxx>
+#include <list>
+#include <boost/unordered_map.hpp>
+
+#include <xmloff/xmlexppr.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/attrlist.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmlprmap.hxx>
+#include <xmloff/PropertySetInfoHash.hxx>
+#include <comphelper/stl_types.hxx>
+
+#ifndef _SVSTDARR_USHORTS
+#define _SVSTDARR_USHORTS
+#include <svl/svstdarr.hxx>
+#endif
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::std;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::xmloff::token;
+
+#define GET_PROP_TYPE( f ) static_cast<sal_uInt16>((f & XML_TYPE_PROP_MASK) >> XML_TYPE_PROP_SHIFT)
+
+struct XMLPropTokens_Impl
+{
+ sal_uInt16 nType;
+ XMLTokenEnum eToken;
+};
+
+#define ENTRY(t) { GET_PROP_TYPE(XML_TYPE_PROP_##t), XML_##t##_PROPERTIES }
+const sal_uInt16 MAX_PROP_TYPES =
+ (XML_TYPE_PROP_END >> XML_TYPE_PROP_SHIFT) -
+ (XML_TYPE_PROP_START >> XML_TYPE_PROP_SHIFT);
+
+static XMLPropTokens_Impl aPropTokens[MAX_PROP_TYPES] =
+{
+ ENTRY(CHART),
+ ENTRY(GRAPHIC),
+ ENTRY(TABLE),
+ ENTRY(TABLE_COLUMN),
+ ENTRY(TABLE_ROW),
+ ENTRY(TABLE_CELL),
+ ENTRY(LIST_LEVEL),
+ ENTRY(PARAGRAPH),
+ ENTRY(TEXT),
+ ENTRY(DRAWING_PAGE),
+ ENTRY(PAGE_LAYOUT),
+ ENTRY(HEADER_FOOTER),
+ ENTRY(RUBY),
+ ENTRY(SECTION)
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// public methods
+//
+
+///////////////////////////////////////////////////////////////////////////
+//
+// Take all properties of the XPropertySet which are also found in the
+// XMLPropertyMapEntry-array and which are not set to their default-value,
+// if a state is available.
+//
+// After that I call the method 'ContextFilter'.
+//
+
+typedef std::list<XMLPropertyState> XMLPropertyStateList_Impl;
+
+class XMLPropertyStates_Impl
+{
+ XMLPropertyStateList_Impl aPropStates;
+ XMLPropertyStateList_Impl::iterator aLastItr;
+ sal_uInt32 nCount;
+public:
+ XMLPropertyStates_Impl();
+ void AddPropertyState(const XMLPropertyState& rPropState);
+ void FillPropertyStateVector(std::vector<XMLPropertyState>& rVector);
+};
+
+XMLPropertyStates_Impl::XMLPropertyStates_Impl() :
+ aPropStates(),
+ nCount(0)
+{
+ aLastItr = aPropStates.begin();
+}
+
+void XMLPropertyStates_Impl::AddPropertyState(
+ const XMLPropertyState& rPropState)
+{
+ XMLPropertyStateList_Impl::iterator aItr = aPropStates.begin();
+ sal_Bool bInserted(sal_False);
+ if (nCount)
+ {
+ if (aLastItr->mnIndex < rPropState.mnIndex)
+ aItr = ++aLastItr;
+ }
+ do
+ {
+ // TODO: one path required only
+ if (aItr == aPropStates.end())
+ {
+ aLastItr = aPropStates.insert(aPropStates.end(), rPropState);
+ bInserted = sal_True;
+ nCount++;
+ }
+ else if (aItr->mnIndex > rPropState.mnIndex)
+ {
+ aLastItr = aPropStates.insert(aItr, rPropState);
+ bInserted = sal_True;
+ nCount++;
+ }
+ }
+ while(!bInserted && (aItr++ != aPropStates.end()));
+}
+
+void XMLPropertyStates_Impl::FillPropertyStateVector(
+ std::vector<XMLPropertyState>& rVector)
+{
+ if (nCount)
+ {
+ rVector.resize(nCount, XMLPropertyState(-1));
+ ::std::copy( aPropStates.begin(), aPropStates.end(), rVector.begin() );
+ }
+}
+
+class FilterPropertyInfo_Impl
+{
+ const rtl::OUString sApiName;
+ std::list<sal_uInt32> aIndexes;
+ sal_uInt32 nCount;
+
+public:
+
+ FilterPropertyInfo_Impl( const rtl::OUString& rApiName,
+ const sal_uInt32 nIndex);
+
+ const OUString& GetApiName() const { return sApiName; }
+ std::list<sal_uInt32>& GetIndexes() { return aIndexes; }
+
+ void AddIndex( sal_uInt32 nIndex )
+ {
+ aIndexes.push_back(nIndex);
+ nCount++;
+ }
+
+ // for sort
+ sal_Bool operator< ( const FilterPropertyInfo_Impl& rArg ) const
+ {
+ return (GetApiName() < rArg.GetApiName());
+ }
+};
+
+FilterPropertyInfo_Impl::FilterPropertyInfo_Impl(
+ const rtl::OUString& rApiName,
+ const sal_uInt32 nIndex ) :
+ sApiName( rApiName ),
+ aIndexes(),
+ nCount(1)
+{
+ aIndexes.push_back(nIndex);
+}
+
+typedef std::list<FilterPropertyInfo_Impl> FilterPropertyInfoList_Impl;
+
+// ----------------------------------------------------------------------------
+
+class FilterPropertiesInfo_Impl
+{
+ sal_uInt32 nCount;
+ FilterPropertyInfoList_Impl aPropInfos;
+ FilterPropertyInfoList_Impl::iterator aLastItr;
+
+ Sequence <OUString> *pApiNames;
+
+public:
+ FilterPropertiesInfo_Impl();
+ ~FilterPropertiesInfo_Impl();
+
+ void AddProperty(const rtl::OUString& rApiName, const sal_uInt32 nIndex);
+ const uno::Sequence<OUString>& GetApiNames();
+ void FillPropertyStateArray(
+ vector< XMLPropertyState >& rPropStates,
+ const Reference< XPropertySet >& xPropSet,
+ const UniReference< XMLPropertySetMapper >& maPropMapper,
+ const sal_Bool bDefault = sal_False);
+ sal_uInt32 GetPropertyCount() const { return nCount; }
+};
+
+// ----------------------------------------------------------------------------
+
+typedef boost::unordered_map
+<
+ PropertySetInfoKey,
+ FilterPropertiesInfo_Impl *,
+ PropertySetInfoHash,
+ PropertySetInfoHash
+>
+FilterOropertiesHashMap_Impl;
+
+class FilterPropertiesInfos_Impl : public FilterOropertiesHashMap_Impl
+{
+public:
+ ~FilterPropertiesInfos_Impl ();
+};
+
+FilterPropertiesInfos_Impl::~FilterPropertiesInfos_Impl ()
+{
+ FilterOropertiesHashMap_Impl::iterator aIter = begin();
+ FilterOropertiesHashMap_Impl::iterator aEnd = end();
+ while( aIter != aEnd )
+ {
+ delete (*aIter).second;
+ (*aIter).second = 0;
+ ++aIter;
+ }
+}
+
+// ----------------------------------------------------------------------------
+
+FilterPropertiesInfo_Impl::FilterPropertiesInfo_Impl() :
+ nCount(0),
+ aPropInfos(),
+ pApiNames( 0 )
+{
+ aLastItr = aPropInfos.begin();
+}
+
+FilterPropertiesInfo_Impl::~FilterPropertiesInfo_Impl()
+{
+ delete pApiNames;
+}
+
+void FilterPropertiesInfo_Impl::AddProperty(
+ const rtl::OUString& rApiName, const sal_uInt32 nIndex)
+{
+ aPropInfos.push_back(FilterPropertyInfo_Impl(rApiName, nIndex));
+ nCount++;
+
+ OSL_ENSURE( !pApiNames, "perfomance warning: API names already retrieved" );
+ if( pApiNames )
+ {
+ delete pApiNames;
+ pApiNames = NULL;
+ }
+}
+const uno::Sequence<OUString>& FilterPropertiesInfo_Impl::GetApiNames()
+{
+ OSL_ENSURE(nCount == aPropInfos.size(), "wrong property count");
+ if( !pApiNames )
+ {
+ // we have to do three things:
+ // 1) sort API names,
+ // 2) merge duplicates,
+ // 3) construct sequence
+
+ // sort names
+ aPropInfos.sort();
+
+ // merge duplicates
+ if ( nCount > 1 )
+ {
+ FilterPropertyInfoList_Impl::iterator aOld = aPropInfos.begin();
+ FilterPropertyInfoList_Impl::iterator aEnd = aPropInfos.end();
+ FilterPropertyInfoList_Impl::iterator aCurrent = aOld;
+ ++aCurrent;
+
+ while ( aCurrent != aEnd )
+ {
+ // equal to next element?
+ if ( aOld->GetApiName().equals( aCurrent->GetApiName() ) )
+ {
+ // if equal: merge index lists
+ aOld->GetIndexes().merge( aCurrent->GetIndexes() );
+ // erase element, and continue with next
+ aCurrent = aPropInfos.erase( aCurrent );
+ nCount--;
+ }
+ else
+ {
+ // remember old element and continue with next
+ aOld = aCurrent;
+ ++aCurrent;
+ }
+ }
+ }
+
+ // construct sequence
+ pApiNames = new Sequence < OUString >( nCount );
+ OUString *pNames = pApiNames->getArray();
+ FilterPropertyInfoList_Impl::iterator aItr = aPropInfos.begin();
+ FilterPropertyInfoList_Impl::iterator aEnd = aPropInfos.end();
+ for ( ; aItr != aEnd; ++aItr, ++pNames)
+ *pNames = aItr->GetApiName();
+ }
+
+ return *pApiNames;
+}
+
+void FilterPropertiesInfo_Impl::FillPropertyStateArray(
+ vector< XMLPropertyState >& rPropStates,
+ const Reference< XPropertySet >& rPropSet,
+ const UniReference< XMLPropertySetMapper >& rPropMapper,
+ const sal_Bool bDefault )
+{
+ XMLPropertyStates_Impl aPropStates;
+
+ const uno::Sequence<OUString>& rApiNames = GetApiNames();
+
+ Reference < XTolerantMultiPropertySet > xTolPropSet( rPropSet, UNO_QUERY );
+ if (xTolPropSet.is())
+ {
+ if (!bDefault)
+ {
+ Sequence < beans::GetDirectPropertyTolerantResult > aResults(xTolPropSet->getDirectPropertyValuesTolerant(rApiNames));
+ sal_Int32 nResultCount(aResults.getLength());
+ if (nResultCount > 0)
+ {
+ const beans::GetDirectPropertyTolerantResult *pResults = aResults.getConstArray();
+ FilterPropertyInfoList_Impl::iterator aPropIter(aPropInfos.begin());
+ XMLPropertyState aNewProperty( -1 );
+ sal_uInt32 i = 0;
+ while (nResultCount > 0 && i < nCount)
+ {
+ if (pResults->Name == aPropIter->GetApiName())
+ {
+ aNewProperty.mnIndex = -1;
+ aNewProperty.maValue = pResults->Value;
+
+ for( std::list<sal_uInt32>::iterator aIndexItr(aPropIter->GetIndexes().begin());
+ aIndexItr != aPropIter->GetIndexes().end();
+ ++aIndexItr )
+ {
+ aNewProperty.mnIndex = *aIndexItr;
+ aPropStates.AddPropertyState( aNewProperty );
+ }
+ ++pResults;
+ --nResultCount;
+ }
+ ++aPropIter;
+ ++i;
+ }
+ }
+ }
+ else
+ {
+ Sequence < beans::GetPropertyTolerantResult > aResults(xTolPropSet->getPropertyValuesTolerant(rApiNames));
+ OSL_ENSURE( rApiNames.getLength() == aResults.getLength(), "wrong implemented XTolerantMultiPropertySet" );
+ const beans::GetPropertyTolerantResult *pResults = aResults.getConstArray();
+ FilterPropertyInfoList_Impl::iterator aPropIter(aPropInfos.begin());
+ XMLPropertyState aNewProperty( -1 );
+ sal_uInt32 nResultCount(aResults.getLength());
+ OSL_ENSURE( nCount == nResultCount, "wrong implemented XTolerantMultiPropertySet??" );
+ for( sal_uInt32 i = 0; i < nResultCount; ++i )
+ {
+ if ((pResults->Result == beans::TolerantPropertySetResultType::SUCCESS) &&
+ ((pResults->State == PropertyState_DIRECT_VALUE) || (pResults->State == PropertyState_DEFAULT_VALUE)))
+ {
+ aNewProperty.mnIndex = -1;
+ aNewProperty.maValue = pResults->Value;
+
+ for( std::list<sal_uInt32>::iterator aIndexItr(aPropIter->GetIndexes().begin());
+ aIndexItr != aPropIter->GetIndexes().end();
+ ++aIndexItr )
+ {
+ aNewProperty.mnIndex = *aIndexItr;
+ aPropStates.AddPropertyState( aNewProperty );
+ }
+ }
+ ++pResults;
+ ++aPropIter;
+ }
+ }
+ }
+ else
+ {
+ Sequence < PropertyState > aStates;
+ const PropertyState *pStates = 0;
+ Reference< XPropertyState > xPropState( rPropSet, UNO_QUERY );
+ if( xPropState.is() )
+ {
+ aStates = xPropState->getPropertyStates( rApiNames );
+ pStates = aStates.getConstArray();
+ }
+
+ Reference < XMultiPropertySet > xMultiPropSet( rPropSet, UNO_QUERY );
+ if( xMultiPropSet.is() && !bDefault )
+ {
+ Sequence < Any > aValues;
+ if( pStates )
+ {
+ // step 1: get value count
+ sal_uInt32 nValueCount = 0;
+ sal_uInt32 i;
+
+ for( i = 0; i < nCount; ++i, ++pStates )
+ {
+ if( (*pStates == PropertyState_DIRECT_VALUE)/* || (bDefault && (*pStates == PropertyState_DEFAULT_VALUE))*/ )
+ nValueCount++;
+ }
+
+ if( nValueCount )
+ {
+ // step 2: collect property names
+ Sequence < OUString > aAPINames( nValueCount );
+ OUString *pAPINames = aAPINames.getArray();
+
+ ::std::vector< FilterPropertyInfoList_Impl::iterator > aPropIters;
+ aPropIters.reserve( nValueCount );
+
+ FilterPropertyInfoList_Impl::iterator aItr = aPropInfos.begin();
+ OSL_ENSURE(aItr != aPropInfos.end(),"Invalid iterator!");
+
+ pStates = aStates.getConstArray();
+ i = 0;
+ while( i < nValueCount )
+ {
+ if( (*pStates == PropertyState_DIRECT_VALUE)/* || (bDefault && (*pStates == PropertyState_DEFAULT_VALUE))*/ )
+ {
+ *pAPINames++ = aItr->GetApiName();
+ aPropIters.push_back( aItr );
+ ++i;
+ }
+ ++aItr;
+ ++pStates;
+ }
+
+ aValues = xMultiPropSet->getPropertyValues( aAPINames );
+ const Any *pValues = aValues.getConstArray();
+
+ ::std::vector< FilterPropertyInfoList_Impl::iterator >::const_iterator
+ pPropIter = aPropIters.begin();
+
+ XMLPropertyState aNewProperty( -1 );
+ for( i = 0; i < nValueCount; ++i )
+ {
+ aNewProperty.mnIndex = -1;
+ aNewProperty.maValue = *pValues;
+
+ const ::std::list< sal_uInt32 >& rIndexes( (*pPropIter)->GetIndexes() );
+ for ( std::list<sal_uInt32>::const_iterator aIndexItr = rIndexes.begin();
+ aIndexItr != rIndexes.end();
+ ++aIndexItr
+ )
+ {
+ aNewProperty.mnIndex = *aIndexItr;
+ aPropStates.AddPropertyState( aNewProperty );
+ }
+
+ ++pPropIter;
+ ++pValues;
+ }
+ }
+ }
+ else
+ {
+ aValues = xMultiPropSet->getPropertyValues( rApiNames );
+ const Any *pValues = aValues.getConstArray();
+
+ FilterPropertyInfoList_Impl::iterator aItr = aPropInfos.begin();
+ for(sal_uInt32 i = 0; i < nCount; ++i)
+ {
+ // The value is stored in the PropertySet itself, add to list.
+ XMLPropertyState aNewProperty( -1 );
+ aNewProperty.maValue = *pValues;
+ ++pValues;
+ for( std::list<sal_uInt32>::iterator aIndexItr =
+ aItr->GetIndexes().begin();
+ aIndexItr != aItr->GetIndexes().end();
+ ++aIndexItr )
+ {
+ aNewProperty.mnIndex = *aIndexItr;
+ aPropStates.AddPropertyState( aNewProperty );
+ }
+ ++aItr;
+ }
+ }
+ }
+ else
+ {
+ FilterPropertyInfoList_Impl::iterator aItr = aPropInfos.begin();
+ for(sal_uInt32 i = 0; i < nCount; ++i)
+ {
+ sal_Bool bDirectValue =
+ !pStates || *pStates == PropertyState_DIRECT_VALUE;
+ if( bDirectValue || bDefault )
+ {
+ // The value is stored in the PropertySet itself, add to list.
+ sal_Bool bGotValue = sal_False;
+ XMLPropertyState aNewProperty( -1 );
+ for( std::list<sal_uInt32>::const_iterator aIndexItr =
+ aItr->GetIndexes().begin();
+ aIndexItr != aItr->GetIndexes().end();
+ ++aIndexItr )
+ {
+ if( bDirectValue ||
+ (rPropMapper->GetEntryFlags( *aIndexItr ) &
+ MID_FLAG_DEFAULT_ITEM_EXPORT) != 0 )
+ {
+ try
+ {
+ if( !bGotValue )
+ {
+ aNewProperty.maValue =
+ rPropSet->getPropertyValue( aItr->GetApiName() );
+ bGotValue = sal_True;
+ }
+ aNewProperty.mnIndex = *aIndexItr;
+ aPropStates.AddPropertyState( aNewProperty );
+ }
+ catch( UnknownPropertyException& )
+ {
+ // might be a problem of getImplemenetationId
+ OSL_ENSURE( !this, "unknown property in getPropertyValue" );
+ }
+
+ }
+ }
+ }
+
+ ++aItr;
+ if( pStates )
+ ++pStates;
+ }
+ }
+ }
+ aPropStates.FillPropertyStateVector(rPropStates);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// ctor/dtor , class SvXMLExportPropertyMapper
+//
+
+SvXMLExportPropertyMapper::SvXMLExportPropertyMapper(
+ const UniReference< XMLPropertySetMapper >& rMapper ) :
+ pCache( 0 ),
+ maPropMapper( rMapper )
+{
+}
+
+SvXMLExportPropertyMapper::~SvXMLExportPropertyMapper()
+{
+ delete pCache;
+ mxNextMapper = 0;
+}
+
+void SvXMLExportPropertyMapper::ChainExportMapper(
+ const UniReference< SvXMLExportPropertyMapper>& rMapper )
+{
+ // add map entries from rMapper to current map
+ maPropMapper->AddMapperEntry( rMapper->getPropertySetMapper() );
+ // rMapper uses the same map as 'this'
+ rMapper->maPropMapper = maPropMapper;
+
+ // set rMapper as last mapper in current chain
+ UniReference< SvXMLExportPropertyMapper > xNext = mxNextMapper;
+ if( xNext.is())
+ {
+ while( xNext->mxNextMapper.is())
+ xNext = xNext->mxNextMapper;
+ xNext->mxNextMapper = rMapper;
+ }
+ else
+ mxNextMapper = rMapper;
+
+ // if rMapper was already chained, correct
+ // map pointer of successors
+ xNext = rMapper;
+
+ while( xNext->mxNextMapper.is())
+ {
+ xNext = xNext->mxNextMapper;
+ xNext->maPropMapper = maPropMapper;
+ }
+}
+
+
+vector< XMLPropertyState > SvXMLExportPropertyMapper::_Filter(
+ const Reference< XPropertySet > xPropSet,
+ const sal_Bool bDefault ) const
+{
+ vector< XMLPropertyState > aPropStateArray;
+
+ // Retrieve XPropertySetInfo and XPropertyState
+ Reference< XPropertySetInfo > xInfo( xPropSet->getPropertySetInfo() );
+ if( !xInfo.is() )
+ return aPropStateArray;
+
+ sal_Int32 nProps = maPropMapper->GetEntryCount();
+
+ FilterPropertiesInfo_Impl *pFilterInfo = 0;
+
+ Reference < XTypeProvider > xTypeProv( xPropSet, UNO_QUERY );
+ Sequence< sal_Int8 > aImplId;
+ if( xTypeProv.is() )
+ {
+ aImplId = xTypeProv->getImplementationId();
+ if( aImplId.getLength() == 16 )
+ {
+ if( pCache )
+ {
+ // The key must not be created outside this block, because it
+ // keeps a reference to the property set info.
+ PropertySetInfoKey aKey( xInfo, aImplId );
+ FilterPropertiesInfos_Impl::iterator aIter =
+ pCache->find( aKey );
+ if( aIter != pCache->end() )
+ pFilterInfo = (*aIter).second;
+ }
+ }
+ }
+
+ sal_Bool bDelInfo = sal_False;
+ if( !pFilterInfo )
+ {
+ pFilterInfo = new FilterPropertiesInfo_Impl;
+ for( sal_Int32 i=0; i < nProps; i++ )
+ {
+ // Are we allowed to ask for the property? (MID_FLAG_NO_PROP..)
+ // Does the PropertySet contain name of mpEntries-array ?
+ const OUString& rAPIName = maPropMapper->GetEntryAPIName( i );
+ const sal_Int32 nFlags = maPropMapper->GetEntryFlags( i );
+ if( (0 == (nFlags & MID_FLAG_NO_PROPERTY_EXPORT)) &&
+ ( (0 != (nFlags & MID_FLAG_MUST_EXIST)) ||
+ xInfo->hasPropertyByName( rAPIName ) ) )
+ {
+ const SvtSaveOptions::ODFDefaultVersion nCurrentVersion( SvtSaveOptions().GetODFDefaultVersion() );
+ const SvtSaveOptions::ODFDefaultVersion nEarliestODFVersionForExport(
+ maPropMapper->GetEarliestODFVersionForExport( i ) );
+ if( nCurrentVersion >= nEarliestODFVersionForExport
+ || nCurrentVersion == SvtSaveOptions::ODFVER_UNKNOWN
+ || nEarliestODFVersionForExport == SvtSaveOptions::ODFVER_UNKNOWN )
+ pFilterInfo->AddProperty(rAPIName, i);
+ }
+ }
+
+ if( xTypeProv.is() && aImplId.getLength() == 16 )
+ {
+ // Check whether the property set info is destroyed if it is
+ // assigned to a weak reference only. If it is destroyed, then
+ // every instance of getPropertySetInfo returns a new object.
+ // Such property set infos must not be cached.
+ WeakReference < XPropertySetInfo > xWeakInfo( xInfo );
+ xInfo = 0;
+ xInfo = xWeakInfo;
+ if( xInfo.is() )
+ {
+ if( !pCache )
+ ((SvXMLExportPropertyMapper *)this)->pCache =
+ new FilterPropertiesInfos_Impl;
+ PropertySetInfoKey aKey( xInfo, aImplId );
+ (*pCache)[aKey] = pFilterInfo;
+ }
+ else
+ bDelInfo = sal_True;
+ }
+ else
+ {
+ OSL_FAIL("here is no TypeProvider or the ImplId is wrong");
+ bDelInfo = sal_True;
+ }
+ }
+
+ if( pFilterInfo->GetPropertyCount() )
+ {
+ try
+ {
+ pFilterInfo->FillPropertyStateArray(aPropStateArray,
+ xPropSet, maPropMapper,
+ bDefault);
+ }
+ catch( UnknownPropertyException& )
+ {
+ // might be a problem of getImplemenetationId
+ OSL_ENSURE( !this, "unknown property in getPropertyStates" );
+ }
+ }
+
+ // Call centext-filter
+ if( !aPropStateArray.empty() )
+ ContextFilter( aPropStateArray, xPropSet );
+
+ // Have to do if we change from a vector to a list or something like that
+
+ if( bDelInfo )
+ delete pFilterInfo;
+
+ return aPropStateArray;
+}
+
+void SvXMLExportPropertyMapper::ContextFilter(
+ vector< XMLPropertyState >& rProperties,
+ Reference< XPropertySet > rPropSet ) const
+{
+ // Derived class could implement this.
+ if( mxNextMapper.is() )
+ mxNextMapper->ContextFilter( rProperties, rPropSet );
+}
+
+///////////////////////////////////////////////////////////////////////////
+//
+// Compares two Sequences of XMLPropertyState:
+// 1.Number of elements equal ?
+// 2.Index of each element equal ? (So I know whether the propertynames are the same)
+// 3.Value of each element equal ?
+//
+sal_Bool SvXMLExportPropertyMapper::Equals(
+ const vector< XMLPropertyState >& aProperties1,
+ const vector< XMLPropertyState >& aProperties2 ) const
+{
+ sal_Bool bRet = sal_True;
+ sal_uInt32 nCount = aProperties1.size();
+
+ if( nCount == aProperties2.size() )
+ {
+ sal_uInt32 nIndex = 0;
+ while( bRet && nIndex < nCount )
+ {
+ const XMLPropertyState& rProp1 = aProperties1[ nIndex ];
+ const XMLPropertyState& rProp2 = aProperties2[ nIndex ];
+
+ // Compare index. If equal, compare value
+ if( rProp1.mnIndex == rProp2.mnIndex )
+ {
+ if( rProp1.mnIndex != -1 )
+ {
+ // Now compare values
+ if( ( maPropMapper->GetEntryType( rProp1.mnIndex ) &
+ XML_TYPE_BUILDIN_CMP ) != 0 )
+ // simple type ( binary compare )
+ bRet = ( rProp1.maValue == rProp2.maValue );
+ else
+ // complex type ( ask for compare-function )
+ bRet = maPropMapper->GetPropertyHandler(
+ rProp1.mnIndex )->equals( rProp1.maValue,
+ rProp2.maValue );
+ }
+ }
+ else
+ bRet = sal_False;
+
+ nIndex++;
+ }
+ }
+ else
+ bRet = sal_False;
+
+ return bRet;
+}
+
+
+/** fills the given attribute list with the items in the given set
+void SvXMLExportPropertyMapper::exportXML( SvXMLAttributeList& rAttrList,
+ const ::std::vector< XMLPropertyState >& rProperties,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ sal_uInt16 nFlags ) const
+{
+ _exportXML( rAttrList, rProperties, rUnitConverter, rNamespaceMap,
+ nFlags, 0, -1, -1 );
+}
+
+
+void SvXMLExportPropertyMapper::exportXML( SvXMLAttributeList& rAttrList,
+ const ::std::vector< XMLPropertyState >& rProperties,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ sal_Int32 nPropMapStartIdx, sal_Int32 nPropMapEndIdx,
+ sal_uInt16 nFlags ) const
+{
+ _exportXML( rAttrList, rProperties, rUnitConverter, rNamespaceMap,
+ nFlags, 0, nPropMapStartIdx, nPropMapEndIdx );
+}
+*/
+
+
+void SvXMLExportPropertyMapper::exportXML( SvXMLAttributeList& rAttrList,
+ const XMLPropertyState& rProperty,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ sal_uInt16 nFlags ) const
+{
+ if( ( maPropMapper->GetEntryFlags( rProperty.mnIndex ) &
+ MID_FLAG_ELEMENT_ITEM_EXPORT ) == 0 )
+ _exportXML( rAttrList, rProperty, rUnitConverter, rNamespaceMap,
+ nFlags );
+}
+
+void SvXMLExportPropertyMapper::exportXML(
+ SvXMLExport& rExport,
+ const ::std::vector< XMLPropertyState >& rProperties,
+ sal_uInt16 nFlags ) const
+{
+ exportXML( rExport, rProperties, -1, -1, nFlags );
+}
+
+void SvXMLExportPropertyMapper::exportXML(
+ SvXMLExport& rExport,
+ const ::std::vector< XMLPropertyState >& rProperties,
+ sal_Int32 nPropMapStartIdx, sal_Int32 nPropMapEndIdx,
+ sal_uInt16 nFlags ) const
+{
+ sal_uInt16 nPropTypeFlags = 0;
+ for( sal_uInt16 i=0; i<MAX_PROP_TYPES; ++i )
+ {
+ sal_uInt16 nPropType = aPropTokens[i].nType;
+ if( 0==i || (nPropTypeFlags & (1 << nPropType)) != 0 )
+ {
+ SvUShorts aIndexArray;
+
+ _exportXML( nPropType, nPropTypeFlags,
+ rExport.GetAttrList(), rProperties,
+ rExport.GetMM100UnitConverter(),
+ rExport.GetNamespaceMap(),
+ nFlags, &aIndexArray,
+ nPropMapStartIdx, nPropMapEndIdx );
+
+ if( rExport.GetAttrList().getLength() > 0L ||
+ (nFlags & XML_EXPORT_FLAG_EMPTY) != 0 ||
+ aIndexArray.Count() != 0 )
+ {
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_STYLE,
+ aPropTokens[i].eToken,
+ (nFlags & XML_EXPORT_FLAG_IGN_WS) != 0,
+ sal_False );
+
+ exportElementItems( rExport, rProperties, nFlags, aIndexArray );
+ }
+ }
+ }
+}
+
+/** this method is called for every item that has the
+ MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
+void SvXMLExportPropertyMapper::handleSpecialItem(
+ SvXMLAttributeList& rAttrList,
+ const XMLPropertyState& rProperty,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ const ::std::vector< XMLPropertyState > *pProperties,
+ sal_uInt32 nIdx ) const
+{
+ OSL_ENSURE( mxNextMapper.is(), "special item not handled in xml export" );
+ if( mxNextMapper.is() )
+ mxNextMapper->handleSpecialItem( rAttrList, rProperty, rUnitConverter,
+ rNamespaceMap, pProperties, nIdx );
+}
+
+/** this method is called for every item that has the
+ MID_FLAG_ELEMENT_EXPORT flag set */
+void SvXMLExportPropertyMapper::handleElementItem(
+ SvXMLExport& rExport,
+ const XMLPropertyState& rProperty,
+ sal_uInt16 nFlags,
+ const ::std::vector< XMLPropertyState > *pProperties,
+ sal_uInt32 nIdx ) const
+{
+ OSL_ENSURE( mxNextMapper.is(), "element item not handled in xml export" );
+ if( mxNextMapper.is() )
+ mxNextMapper->handleElementItem( rExport, rProperty, nFlags,
+ pProperties, nIdx );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// protected methods
+//
+
+/** fills the given attribute list with the items in the given set */
+void SvXMLExportPropertyMapper::_exportXML(
+ sal_uInt16 nPropType, sal_uInt16& rPropTypeFlags,
+ SvXMLAttributeList& rAttrList,
+ const ::std::vector< XMLPropertyState >& rProperties,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ sal_uInt16 nFlags,
+ SvUShorts* pIndexArray,
+ sal_Int32 nPropMapStartIdx, sal_Int32 nPropMapEndIdx ) const
+{
+ const sal_uInt32 nCount = rProperties.size();
+ sal_uInt32 nIndex = 0;
+
+ if( -1 == nPropMapStartIdx )
+ nPropMapStartIdx = 0;
+ if( -1 == nPropMapEndIdx )
+ nPropMapEndIdx = maPropMapper->GetEntryCount();
+
+ while( nIndex < nCount )
+ {
+ sal_Int32 nPropMapIdx = rProperties[nIndex].mnIndex;
+ if( nPropMapIdx >= nPropMapStartIdx &&
+ nPropMapIdx < nPropMapEndIdx )// valid entry?
+ {
+ sal_uInt32 nEFlags = maPropMapper->GetEntryFlags( nPropMapIdx );
+ sal_uInt16 nEPType = GET_PROP_TYPE(nEFlags);
+ OSL_ENSURE( nEPType >= (XML_TYPE_PROP_START>>XML_TYPE_PROP_SHIFT),
+ "no prop type sepcified" );
+ rPropTypeFlags |= (1 << nEPType);
+ if( nEPType == nPropType )
+ {
+ // we have a valid map entry here, so lets use it...
+ if( ( nEFlags & MID_FLAG_ELEMENT_ITEM_EXPORT ) != 0 )
+ {
+ // element items do not add any properties,
+ // we export it later
+ if( pIndexArray )
+ pIndexArray->Insert( (sal_uInt16)nIndex, pIndexArray->Count() );
+ }
+ else
+ {
+ _exportXML( rAttrList, rProperties[nIndex], rUnitConverter,
+ rNamespaceMap, nFlags, &rProperties, nIndex );
+ }
+ }
+ }
+
+ nIndex++;
+ }
+}
+
+void SvXMLExportPropertyMapper::_exportXML(
+ SvXMLAttributeList& rAttrList,
+ const XMLPropertyState& rProperty,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ sal_uInt16 /*nFlags*/,
+ const ::std::vector< XMLPropertyState > *pProperties,
+ sal_uInt32 nIdx ) const
+{
+ OUString sCDATA( GetXMLToken(XML_CDATA) );
+
+ if ( ( maPropMapper->GetEntryFlags( rProperty.mnIndex ) &
+ MID_FLAG_SPECIAL_ITEM_EXPORT ) != 0 )
+ {
+ uno::Reference< container::XNameContainer > xAttrContainer;
+ if( (rProperty.maValue >>= xAttrContainer) && xAttrContainer.is() )
+ {
+ SvXMLNamespaceMap *pNewNamespaceMap = 0;
+ const SvXMLNamespaceMap *pNamespaceMap = &rNamespaceMap;
+
+ uno::Sequence< OUString > aAttribNames( xAttrContainer->getElementNames() );
+ const OUString* pAttribName = aAttribNames.getConstArray();
+
+ const sal_Int32 nCount = aAttribNames.getLength();
+
+ OUStringBuffer sNameBuffer;
+ xml::AttributeData aData;
+ for( sal_Int32 i=0; i < nCount; i++, pAttribName++ )
+ {
+ xAttrContainer->getByName( *pAttribName ) >>= aData;
+ OUString sAttribName( *pAttribName );
+
+ // extract namespace prefix from attribute name if it exists
+ OUString sPrefix;
+ const sal_Int32 nColonPos =
+ pAttribName->indexOf( sal_Unicode(':') );
+ if( nColonPos != -1 )
+ sPrefix = pAttribName->copy( 0, nColonPos );
+
+ if( sPrefix.getLength() )
+ {
+ OUString sNamespace( aData.Namespace );
+
+ // if the prefix isn't defined yet or has another meaning,
+ // we have to redefine it now.
+ sal_uInt16 nKey = pNamespaceMap->GetKeyByPrefix( sPrefix );
+ if( USHRT_MAX == nKey || pNamespaceMap->GetNameByKey( nKey ) != sNamespace )
+ {
+ sal_Bool bAddNamespace = sal_False;
+ if( USHRT_MAX == nKey )
+ {
+ // The prefix is unused, so it is sufficient
+ // to add it to the namespace map.
+ bAddNamespace = sal_True;
+ }
+ else
+ {
+ // check if there is a prefix registered for the
+ // namepsace URI
+ nKey = pNamespaceMap->GetKeyByName( sNamespace );
+ if( XML_NAMESPACE_UNKNOWN == nKey )
+ {
+ // There is no prefix for the namespace, so
+ // we have to generate one and have to add it.
+ sal_Int32 n=0;
+ OUString sOrigPrefix( sPrefix );
+ do
+ {
+ sNameBuffer.append( sOrigPrefix );
+ sNameBuffer.append( ++n );
+ sPrefix = sNameBuffer.makeStringAndClear();
+ nKey = pNamespaceMap->GetKeyByPrefix( sPrefix );
+ }
+ while( nKey != USHRT_MAX );
+
+ bAddNamespace = sal_True;
+ }
+ else
+ {
+ // If there is a prefix for the namespace,
+ // we reuse that.
+ sPrefix = pNamespaceMap->GetPrefixByKey( nKey );
+ }
+ // In any case, the attribute name has to be adapted.
+ sNameBuffer.append( sPrefix );
+ sNameBuffer.append( sal_Unicode(':') );
+ sNameBuffer.append( pAttribName->copy( nColonPos+1 ) );
+ sAttribName = sNameBuffer.makeStringAndClear();
+ }
+
+ if( bAddNamespace )
+ {
+ if( !pNewNamespaceMap )
+ {
+ pNewNamespaceMap = new SvXMLNamespaceMap( rNamespaceMap );
+ pNamespaceMap = pNewNamespaceMap;
+ }
+ pNewNamespaceMap->Add( sPrefix, sNamespace );
+ sNameBuffer.append( GetXMLToken(XML_XMLNS) );
+ sNameBuffer.append( sal_Unicode(':') );
+ sNameBuffer.append( sPrefix );
+ rAttrList.AddAttribute( sNameBuffer.makeStringAndClear(),
+ sNamespace );
+ }
+ }
+ }
+ OUString sOldValue( rAttrList.getValueByName( sAttribName ) );
+ OSL_ENSURE( sOldValue.getLength() == 0, "alien attribute exists already" );
+ OSL_ENSURE(aData.Type == GetXMLToken(XML_CDATA), "different type to our default type which should be written out");
+ if( !sOldValue.getLength() )
+ rAttrList.AddAttribute( sAttribName, aData.Value );
+ }
+
+ delete pNewNamespaceMap;
+ }
+ else
+ {
+ handleSpecialItem( rAttrList, rProperty, rUnitConverter,
+ rNamespaceMap, pProperties, nIdx );
+ }
+ }
+ else if ( ( maPropMapper->GetEntryFlags( rProperty.mnIndex ) &
+ MID_FLAG_ELEMENT_ITEM_EXPORT ) == 0 )
+ {
+ OUString aValue;
+ const OUString sName( rNamespaceMap.GetQNameByKey(
+ maPropMapper->GetEntryNameSpace( rProperty.mnIndex ),
+ maPropMapper->GetEntryXMLName( rProperty.mnIndex ) ) );
+
+ sal_Bool bRemove = sal_False;
+ if( ( maPropMapper->GetEntryFlags( rProperty.mnIndex ) &
+ MID_FLAG_MERGE_ATTRIBUTE ) != 0 )
+ {
+ aValue = rAttrList.getValueByName( sName );
+ bRemove = sal_True;
+ }
+
+ if( maPropMapper->exportXML( aValue, rProperty, rUnitConverter ) )
+ {
+ if( bRemove )
+ rAttrList.RemoveAttribute( sName );
+ rAttrList.AddAttribute( sName, aValue );
+ }
+ }
+}
+
+void SvXMLExportPropertyMapper::exportElementItems(
+ SvXMLExport& rExport,
+ const ::std::vector< XMLPropertyState >& rProperties,
+ sal_uInt16 nFlags,
+ const SvUShorts& rIndexArray ) const
+{
+ const sal_uInt16 nCount = rIndexArray.Count();
+
+ sal_Bool bItemsExported = sal_False;
+ OUString sWS( GetXMLToken(XML_WS) );
+ for( sal_uInt16 nIndex = 0; nIndex < nCount; nIndex++ )
+ {
+ const sal_uInt16 nElement = rIndexArray.GetObject( nIndex );
+
+ OSL_ENSURE( 0 != ( maPropMapper->GetEntryFlags(
+ rProperties[nElement].mnIndex ) & MID_FLAG_ELEMENT_ITEM_EXPORT),
+ "wrong mid flag!" );
+
+ rExport.IgnorableWhitespace();
+ handleElementItem( rExport, rProperties[nElement],
+ nFlags, &rProperties, nElement );
+ bItemsExported = sal_True;
+ }
+
+ if( bItemsExported )
+ rExport.IgnorableWhitespace();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/xmlimppr.cxx b/xmloff/source/style/xmlimppr.cxx
new file mode 100644
index 000000000000..cf09b6cdc53c
--- /dev/null
+++ b/xmloff/source/style/xmlimppr.cxx
@@ -0,0 +1,779 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/xml/AttributeData.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/lang/WrappedTargetException.hpp>
+#include <com/sun/star/beans/UnknownPropertyException.hpp>
+#include <com/sun/star/beans/PropertyVetoException.hpp>
+#include <com/sun/star/beans/TolerantPropertySetResultType.hpp>
+#include <rtl/ustrbuf.hxx>
+#include <xmloff/xmlprmap.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmlimppr.hxx>
+#include <xmloff/xmlimp.hxx>
+
+#include "xmloff/unoatrcn.hxx"
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlerror.hxx"
+#include <tools/debug.hxx>
+
+#include "xmloff/contextid.hxx"
+
+// STL includes
+#include <algorithm>
+#include <functional>
+#include <utility>
+#include <vector>
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::xml;
+using namespace ::com::sun::star::xml::sax;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::std;
+using namespace ::xmloff::token;
+using ::com::sun::star::lang::IllegalArgumentException;
+using ::com::sun::star::lang::WrappedTargetException;
+using ::com::sun::star::beans::UnknownPropertyException;
+using ::com::sun::star::beans::PropertyVetoException;
+
+using rtl::OUString;
+using rtl::OUStringBuffer;
+
+SvXMLImportPropertyMapper::SvXMLImportPropertyMapper(
+ const UniReference< XMLPropertySetMapper >& rMapper,
+ SvXMLImport& rImp ):
+ rImport(rImp),
+ maPropMapper ( rMapper )
+{
+}
+
+SvXMLImportPropertyMapper::~SvXMLImportPropertyMapper()
+{
+ mxNextMapper = 0;
+}
+
+void SvXMLImportPropertyMapper::ChainImportMapper(
+ const UniReference< SvXMLImportPropertyMapper>& rMapper )
+{
+ // add map entries from rMapper to current map
+ maPropMapper->AddMapperEntry( rMapper->getPropertySetMapper() );
+ // rMapper uses the same map as 'this'
+ rMapper->maPropMapper = maPropMapper;
+
+ // set rMapper as last mapper in current chain
+ UniReference< SvXMLImportPropertyMapper > xNext = mxNextMapper;
+ if( xNext.is())
+ {
+ while( xNext->mxNextMapper.is())
+ xNext = xNext->mxNextMapper;
+ xNext->mxNextMapper = rMapper;
+ }
+ else
+ mxNextMapper = rMapper;
+
+ // if rMapper was already chained, correct
+ // map pointer of successors
+ xNext = rMapper;
+
+ while( xNext->mxNextMapper.is())
+ {
+ xNext = xNext->mxNextMapper;
+ xNext->maPropMapper = maPropMapper;
+ }
+}
+
+void SvXMLImportPropertyMapper::importXML(
+ vector< XMLPropertyState >& rProperties,
+ Reference< XAttributeList > xAttrList,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ sal_uInt32 nPropType ) const
+{
+ importXML( rProperties, xAttrList, rUnitConverter, rNamespaceMap,
+ nPropType,-1, -1 );
+}
+
+/** fills the given itemset with the attributes in the given list */
+void SvXMLImportPropertyMapper::importXML(
+ vector< XMLPropertyState >& rProperties,
+ Reference< XAttributeList > xAttrList,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ sal_uInt32 nPropType,
+ sal_Int32 nStartIdx,
+ sal_Int32 nEndIdx ) const
+{
+ sal_Int16 nAttr = xAttrList->getLength();
+
+ Reference< XNameContainer > xAttrContainer;
+
+ if( -1 == nStartIdx )
+ nStartIdx = 0;
+ if( -1 == nEndIdx )
+ nEndIdx = maPropMapper->GetEntryCount();
+ for( sal_Int16 i=0; i < nAttr; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName, aPrefix, aNamespace;
+ sal_uInt16 nPrefix = rNamespaceMap.GetKeyByAttrName( rAttrName, &aPrefix,
+ &aLocalName, &aNamespace );
+
+ if( XML_NAMESPACE_XMLNS == nPrefix )
+ continue;
+
+ const OUString& rValue = xAttrList->getValueByIndex( i );
+
+ // index of actual property map entry
+ // This looks very strange, but it works well:
+ // If the start index is 0, the new value will become -1, and
+ // GetEntryIndex will start searching with position 0.
+ // Otherwise GetEntryIndex will start with the next position specified.
+ sal_Int32 nIndex = nStartIdx - 1;
+ sal_uInt32 nFlags = 0; // flags of actual property map entry
+ sal_Bool bFound = sal_False;
+
+ // for better error reporting: this should be set true if no
+ // warning is needed
+ sal_Bool bNoWarning = sal_False;
+ bool bAlienImport = false;
+
+ do
+ {
+ // find an entry for this attribute
+ nIndex = maPropMapper->GetEntryIndex( nPrefix, aLocalName,
+ nPropType, nIndex );
+
+ if( nIndex > -1 && nIndex < nEndIdx )
+ {
+ // create a XMLPropertyState with an empty value
+
+ nFlags = maPropMapper->GetEntryFlags( nIndex );
+ if( (( nFlags & MID_FLAG_NO_PROPERTY ) == MID_FLAG_NO_PROPERTY) && (maPropMapper->GetEntryContextId( nIndex ) == CTF_ALIEN_ATTRIBUTE_IMPORT) )
+ {
+ bAlienImport = true;
+ nIndex = -1;
+ }
+ else
+ {
+ if( ( nFlags & MID_FLAG_ELEMENT_ITEM_IMPORT ) == 0 )
+ {
+ XMLPropertyState aNewProperty( nIndex );
+ sal_Int32 nReference = -1;
+
+ // if this is a multi attribute check if another attribute already set
+ // this any. If so use this as a initial value
+ if( ( nFlags & MID_FLAG_MERGE_PROPERTY ) != 0 )
+ {
+ const OUString aAPIName( maPropMapper->GetEntryAPIName( nIndex ) );
+ const sal_Int32 nSize = rProperties.size();
+ for( nReference = 0; nReference < nSize; nReference++ )
+ {
+ sal_Int32 nRefIdx = rProperties[nReference].mnIndex;
+ if( (nRefIdx != -1) && (nIndex != nRefIdx) &&
+ (maPropMapper->GetEntryAPIName( nRefIdx ) == aAPIName ))
+ {
+ aNewProperty = rProperties[nReference];
+ aNewProperty.mnIndex = nIndex;
+ break;
+ }
+ }
+
+ if( nReference == nSize )
+ nReference = -1;
+ }
+
+ sal_Bool bSet = sal_False;
+ if( ( nFlags & MID_FLAG_SPECIAL_ITEM_IMPORT ) == 0 )
+ {
+ // let the XMLPropertySetMapper decide how to import the value
+ bSet = maPropMapper->importXML( rValue, aNewProperty,
+ rUnitConverter );
+ }
+ else
+ {
+ sal_uInt32 nOldSize = rProperties.size();
+
+ bSet = handleSpecialItem( aNewProperty, rProperties,
+ rValue, rUnitConverter,
+ rNamespaceMap );
+
+ // no warning if handleSpecialItem added properties
+ bNoWarning |= ( nOldSize != rProperties.size() );
+ }
+
+ // no warning if we found could set the item. This
+ // 'remembers' bSet across multi properties.
+ bNoWarning |= bSet;
+
+ // store the property in the given vector
+ if( bSet )
+ {
+ if( nReference == -1 )
+ rProperties.push_back( aNewProperty );
+ else
+ rProperties[nReference] = aNewProperty;
+ }
+ else
+ {
+ // warn about unknown value. Unless it's a
+ // multi property: Then we get another chance
+ // to set the value.
+ if( !bNoWarning &&
+ ((nFlags & MID_FLAG_MULTI_PROPERTY) == 0) )
+ {
+ Sequence<OUString> aSeq(2);
+ aSeq[0] = rAttrName;
+ aSeq[1] = rValue;
+ rImport.SetError( XMLERROR_FLAG_WARNING |
+ XMLERROR_STYLE_ATTR_VALUE,
+ aSeq );
+ }
+ }
+ }
+ bFound = sal_True;
+ continue;
+ }
+ }
+
+ if( !bFound )
+ {
+ if( (XML_NAMESPACE_UNKNOWN_FLAG & nPrefix) || (XML_NAMESPACE_NONE == nPrefix) || bAlienImport )
+ {
+ OSL_ENSURE( XML_NAMESPACE_NONE == nPrefix ||
+ (XML_NAMESPACE_UNKNOWN_FLAG & nPrefix) ||
+ bAlienImport,
+ "unknown attribute - might be a new feature?" );
+ if( !xAttrContainer.is() )
+ {
+ // add an unknown attribute container to the properties
+ Reference< XNameContainer > xNew( SvUnoAttributeContainer_CreateInstance(), UNO_QUERY );
+ xAttrContainer = xNew;
+
+ // find map entry and create new property state
+ if( -1 == nIndex )
+ {
+ switch( nPropType )
+ {
+ case XML_TYPE_PROP_CHART:
+ nIndex = maPropMapper->FindEntryIndex( "ChartUserDefinedAttributes", XML_NAMESPACE_TEXT, GetXMLToken(XML_XMLNS) );
+ break;
+ case XML_TYPE_PROP_PARAGRAPH:
+ nIndex = maPropMapper->FindEntryIndex( "ParaUserDefinedAttributes", XML_NAMESPACE_TEXT, GetXMLToken(XML_XMLNS) );
+ break;
+ case XML_TYPE_PROP_TEXT:
+ nIndex = maPropMapper->FindEntryIndex( "TextUserDefinedAttributes", XML_NAMESPACE_TEXT, GetXMLToken(XML_XMLNS) );
+ break;
+ default:
+ break;
+ }
+ // other property type or property not found
+ if( -1 == nIndex )
+ nIndex = maPropMapper->FindEntryIndex( "UserDefinedAttributes", XML_NAMESPACE_TEXT, GetXMLToken(XML_XMLNS) );
+ }
+
+ // #106963#; use userdefined attribute only if it is in the specified property range
+ if( nIndex != -1 && nIndex >= nStartIdx && nIndex < nEndIdx)
+ {
+ Any aAny;
+ aAny <<= xAttrContainer;
+ XMLPropertyState aNewProperty( nIndex, aAny );
+
+ // push it on our stack so we export it later
+ rProperties.push_back( aNewProperty );
+ }
+ }
+
+ if( xAttrContainer.is() )
+ {
+ AttributeData aData;
+ aData.Type = GetXMLToken( XML_CDATA );
+ aData.Value = rValue;
+
+ OUStringBuffer sName;
+ if( XML_NAMESPACE_NONE != nPrefix )
+ {
+ sName.append( aPrefix );
+ sName.append( sal_Unicode(':') );
+ aData.Namespace = aNamespace;
+ }
+
+ sName.append( aLocalName );
+
+ Any aAny;
+ aAny <<= aData;
+ xAttrContainer->insertByName( sName.makeStringAndClear(), aAny );
+ }
+ }
+ }
+ }
+ while( ( nIndex >= 0 ) && (( nFlags & MID_FLAG_MULTI_PROPERTY ) != 0 ) );
+ }
+
+ finished( rProperties, nStartIdx, nEndIdx );
+}
+
+/** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_IMPORT flag set */
+bool SvXMLImportPropertyMapper::handleSpecialItem(
+ XMLPropertyState& rProperty,
+ vector< XMLPropertyState >& rProperties,
+ const OUString& rValue,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap ) const
+{
+ OSL_ENSURE( mxNextMapper.is(), "unsuported special item in xml import" );
+ if( mxNextMapper.is() )
+ return mxNextMapper->handleSpecialItem( rProperty, rProperties, rValue,
+ rUnitConverter, rNamespaceMap );
+ else
+ return sal_False;
+}
+
+void SvXMLImportPropertyMapper::FillPropertySequence(
+ const ::std::vector< XMLPropertyState >& rProperties,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rValues )
+ const
+{
+ sal_Int32 nCount = rProperties.size();
+ sal_Int32 nValueCount = 0;
+ rValues.realloc( nCount );
+ PropertyValue *pProps = rValues.getArray();
+ for( sal_Int32 i=0; i < nCount; i++ )
+ {
+ const XMLPropertyState& rProp = rProperties[i];
+ sal_Int32 nIdx = rProp.mnIndex;
+ if( nIdx == -1 )
+ continue;
+ pProps->Name = maPropMapper->GetEntryAPIName( nIdx );
+ if( pProps->Name.getLength() )
+ {
+ pProps->Value <<= rProp.maValue;
+ ++pProps;
+ ++nValueCount;
+ }
+ }
+ if( nValueCount < nCount )
+ rValues.realloc( nValueCount );
+}
+
+void SvXMLImportPropertyMapper::CheckSpecialContext(
+ const ::std::vector< XMLPropertyState >& aProperties,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > rPropSet,
+ _ContextID_Index_Pair* pSpecialContextIds ) const
+{
+ OSL_ENSURE( rPropSet.is(), "need an XPropertySet" );
+ sal_Int32 nCount = aProperties.size();
+
+ Reference< XPropertySetInfo > xInfo(rPropSet->getPropertySetInfo());
+
+ for( sal_Int32 i=0; i < nCount; i++ )
+ {
+ const XMLPropertyState& rProp = aProperties[i];
+ sal_Int32 nIdx = rProp.mnIndex;
+
+ // disregard property state if it has an invalid index
+ if( -1 == nIdx )
+ continue;
+
+ const sal_Int32 nPropFlags = maPropMapper->GetEntryFlags( nIdx );
+
+ // handle no-property and special items
+ if( ( pSpecialContextIds != NULL ) &&
+ ( ( 0 != ( nPropFlags & MID_FLAG_NO_PROPERTY_IMPORT ) ) ||
+ ( 0 != ( nPropFlags & MID_FLAG_SPECIAL_ITEM_IMPORT ) ) ) )
+ {
+ // maybe it's one of our special context ids?
+ sal_Int16 nContextId = maPropMapper->GetEntryContextId(nIdx);
+
+ for ( sal_Int32 n = 0;
+ pSpecialContextIds[n].nContextID != -1;
+ n++ )
+ {
+ // found: set index in pSpecialContextIds array
+ if ( pSpecialContextIds[n].nContextID == nContextId )
+ {
+ pSpecialContextIds[n].nIndex = i;
+ break; // early out
+ }
+ }
+ }
+ }
+
+}
+
+sal_Bool SvXMLImportPropertyMapper::FillPropertySet(
+ const vector< XMLPropertyState >& aProperties,
+ const Reference< XPropertySet > rPropSet,
+ _ContextID_Index_Pair* pSpecialContextIds ) const
+{
+ sal_Bool bSet = sal_False;
+
+ Reference< XTolerantMultiPropertySet > xTolPropSet( rPropSet, UNO_QUERY );
+ if (xTolPropSet.is())
+ bSet = _FillTolerantMultiPropertySet( aProperties, xTolPropSet, maPropMapper, rImport,
+ pSpecialContextIds );
+
+ if (!bSet)
+ {
+ // get property set info
+ Reference< XPropertySetInfo > xInfo(rPropSet->getPropertySetInfo());
+
+ // check for multi-property set
+ Reference<XMultiPropertySet> xMultiPropSet( rPropSet, UNO_QUERY );
+ if ( xMultiPropSet.is() )
+ {
+ // Try XMultiPropertySet. If that fails, try the regular route.
+ bSet = _FillMultiPropertySet( aProperties, xMultiPropSet,
+ xInfo, maPropMapper,
+ pSpecialContextIds );
+ if ( !bSet )
+ bSet = _FillPropertySet( aProperties, rPropSet,
+ xInfo, maPropMapper, rImport,
+ pSpecialContextIds);
+ }
+ else
+ bSet = _FillPropertySet( aProperties, rPropSet, xInfo,
+ maPropMapper, rImport,
+ pSpecialContextIds );
+ }
+
+ return bSet;
+}
+
+sal_Bool SvXMLImportPropertyMapper::_FillPropertySet(
+ const vector<XMLPropertyState> & rProperties,
+ const Reference<XPropertySet> & rPropSet,
+ const Reference<XPropertySetInfo> & rPropSetInfo,
+ const UniReference<XMLPropertySetMapper> & rPropMapper,
+ SvXMLImport& rImport,
+ _ContextID_Index_Pair* pSpecialContextIds )
+{
+ OSL_ENSURE( rPropSet.is(), "need an XPropertySet" );
+ OSL_ENSURE( rPropSetInfo.is(), "need an XPropertySetInfo" );
+
+ // preliminaries
+ sal_Bool bSet = sal_False;
+ sal_Int32 nCount = rProperties.size();
+
+ // iterate over property states that we want to set
+ for( sal_Int32 i=0; i < nCount; i++ )
+ {
+ const XMLPropertyState& rProp = rProperties[i];
+ sal_Int32 nIdx = rProp.mnIndex;
+
+ // disregard property state if it has an invalid index
+ if( -1 == nIdx )
+ continue;
+
+ const OUString& rPropName = rPropMapper->GetEntryAPIName( nIdx );
+ const sal_Int32 nPropFlags = rPropMapper->GetEntryFlags( nIdx );
+
+ if ( ( 0 == ( nPropFlags & MID_FLAG_NO_PROPERTY ) ) &&
+ ( ( 0 != ( nPropFlags & MID_FLAG_MUST_EXIST ) ) ||
+ rPropSetInfo->hasPropertyByName( rPropName ) ) )
+ {
+ // try setting the property
+ try
+ {
+ rPropSet->setPropertyValue( rPropName, rProp.maValue );
+ bSet = sal_True;
+ }
+ catch ( IllegalArgumentException& e )
+ {
+ // illegal value: check whether this property is
+ // allowed to throw this exception
+ if ( 0 == ( nPropFlags & MID_FLAG_PROPERTY_MAY_EXCEPT ) )
+ {
+ Sequence<OUString> aSeq(1);
+ aSeq[0] = rPropName;
+ rImport.SetError(
+ XMLERROR_STYLE_PROP_VALUE | XMLERROR_FLAG_ERROR,
+ aSeq, e.Message, NULL );
+ }
+ }
+ catch ( UnknownPropertyException& e )
+ {
+ // unknown property: This is always an error!
+ Sequence<OUString> aSeq(1);
+ aSeq[0] = rPropName;
+ rImport.SetError(
+ XMLERROR_STYLE_PROP_UNKNOWN | XMLERROR_FLAG_ERROR,
+ aSeq, e.Message, NULL );
+ }
+ catch ( PropertyVetoException& e )
+ {
+ // property veto: this shouldn't happen
+ Sequence<OUString> aSeq(1);
+ aSeq[0] = rPropName;
+ rImport.SetError(
+ XMLERROR_STYLE_PROP_OTHER | XMLERROR_FLAG_ERROR,
+ aSeq, e.Message, NULL );
+ }
+ catch ( WrappedTargetException& e )
+ {
+ // wrapped target: this shouldn't happen either
+ Sequence<OUString> aSeq(1);
+ aSeq[0] = rPropName;
+ rImport.SetError(
+ XMLERROR_STYLE_PROP_OTHER | XMLERROR_FLAG_ERROR,
+ aSeq, e.Message, NULL );
+ }
+ }
+
+ // handle no-property and special items
+ if( ( pSpecialContextIds != NULL ) &&
+ ( ( 0 != ( nPropFlags & MID_FLAG_NO_PROPERTY_IMPORT ) ) ||
+ ( 0 != ( nPropFlags & MID_FLAG_SPECIAL_ITEM_IMPORT ) ) ) )
+ {
+ // maybe it's one of our special context ids?
+ sal_Int16 nContextId = rPropMapper->GetEntryContextId(nIdx);
+
+ for ( sal_Int32 n = 0;
+ pSpecialContextIds[n].nContextID != -1;
+ n++ )
+ {
+ // found: set index in pSpecialContextIds array
+ if ( pSpecialContextIds[n].nContextID == nContextId )
+ {
+ pSpecialContextIds[n].nIndex = i;
+ break; // early out
+ }
+ }
+ }
+ }
+
+ return bSet;
+}
+
+
+
+typedef pair<const OUString*, const Any* > PropertyPair;
+typedef vector<PropertyPair> PropertyPairs;
+
+struct PropertyPairLessFunctor :
+ public std::binary_function<PropertyPair, PropertyPair, bool>
+{
+ bool operator()( const PropertyPair& a, const PropertyPair& b ) const
+ {
+ return (*a.first < *b.first ? true : false);
+ }
+};
+
+void SvXMLImportPropertyMapper::_PrepareForMultiPropertySet(
+ const vector<XMLPropertyState> & rProperties,
+ const Reference<XPropertySetInfo> & rPropSetInfo,
+ const UniReference<XMLPropertySetMapper> & rPropMapper,
+ _ContextID_Index_Pair* pSpecialContextIds,
+ Sequence<OUString>& rNames,
+ Sequence<Any>& rValues)
+{
+ sal_Int32 nCount = rProperties.size();
+
+ // property pairs structure stores names + values of properties to be set.
+ PropertyPairs aPropertyPairs;
+ aPropertyPairs.reserve( nCount );
+
+ // iterate over property states that we want to set
+ sal_Int32 i;
+ for( i = 0; i < nCount; i++ )
+ {
+ const XMLPropertyState& rProp = rProperties[i];
+ sal_Int32 nIdx = rProp.mnIndex;
+
+ // disregard property state if it has an invalid index
+ if( -1 == nIdx )
+ continue;
+
+ const OUString& rPropName = rPropMapper->GetEntryAPIName( nIdx );
+ const sal_Int32 nPropFlags = rPropMapper->GetEntryFlags( nIdx );
+
+ if ( ( 0 == ( nPropFlags & MID_FLAG_NO_PROPERTY ) ) &&
+ ( ( 0 != ( nPropFlags & MID_FLAG_MUST_EXIST ) ) ||
+ !rPropSetInfo.is() ||
+ (rPropSetInfo.is() && rPropSetInfo->hasPropertyByName( rPropName )) ) )
+ {
+ // save property into property pair structure
+ aPropertyPairs.push_back( PropertyPair( &rPropName, &rProp.maValue ) );
+ }
+
+ // handle no-property and special items
+ if( ( pSpecialContextIds != NULL ) &&
+ ( ( 0 != ( nPropFlags & MID_FLAG_NO_PROPERTY_IMPORT ) ) ||
+ ( 0 != ( nPropFlags & MID_FLAG_SPECIAL_ITEM_IMPORT ) ) ) )
+ {
+ // maybe it's one of our special context ids?
+ sal_Int16 nContextId = rPropMapper->GetEntryContextId(nIdx);
+ for ( sal_Int32 n = 0;
+ pSpecialContextIds[n].nContextID != -1;
+ n++ )
+ {
+ // found: set index in pSpecialContextIds array
+ if ( pSpecialContextIds[n].nContextID == nContextId )
+ {
+ pSpecialContextIds[n].nIndex = i;
+ break; // early out
+ }
+ }
+ }
+ }
+
+ // We now need to construct the sequences and actually the set
+ // values.
+
+ // sort the property pairs
+ sort( aPropertyPairs.begin(), aPropertyPairs.end(),
+ PropertyPairLessFunctor());
+
+ // create sequences
+ rNames.realloc( aPropertyPairs.size() );
+ OUString* pNamesArray = rNames.getArray();
+ rValues.realloc( aPropertyPairs.size() );
+ Any* pValuesArray = rValues.getArray();
+
+ // copy values into sequences
+ i = 0;
+ for( PropertyPairs::iterator aIter = aPropertyPairs.begin();
+ aIter != aPropertyPairs.end();
+ ++aIter )
+ {
+ pNamesArray[i] = *(aIter->first);
+ pValuesArray[i++] = *(aIter->second);
+ }
+}
+
+sal_Bool SvXMLImportPropertyMapper::_FillMultiPropertySet(
+ const vector<XMLPropertyState> & rProperties,
+ const Reference<XMultiPropertySet> & rMultiPropSet,
+ const Reference<XPropertySetInfo> & rPropSetInfo,
+ const UniReference<XMLPropertySetMapper> & rPropMapper,
+ _ContextID_Index_Pair* pSpecialContextIds )
+{
+ OSL_ENSURE( rMultiPropSet.is(), "Need multi property set. ");
+ OSL_ENSURE( rPropSetInfo.is(), "Need property set info." );
+
+ sal_Bool bSuccessful = sal_False;
+
+ Sequence<OUString> aNames;
+ Sequence<Any> aValues;
+
+ _PrepareForMultiPropertySet(rProperties, rPropSetInfo, rPropMapper, pSpecialContextIds,
+ aNames, aValues);
+
+ // and, finally, try to set the values
+ try
+ {
+ rMultiPropSet->setPropertyValues( aNames, aValues );
+ bSuccessful = sal_True;
+ }
+ catch ( ... )
+ {
+ OSL_ENSURE(bSuccessful, "Exception caught; style may not be imported correctly.");
+ }
+
+ return bSuccessful;
+}
+
+sal_Bool SvXMLImportPropertyMapper::_FillTolerantMultiPropertySet(
+ const vector<XMLPropertyState> & rProperties,
+ const Reference<XTolerantMultiPropertySet> & rTolMultiPropSet,
+ const UniReference<XMLPropertySetMapper> & rPropMapper,
+ SvXMLImport& rImport,
+ _ContextID_Index_Pair* pSpecialContextIds )
+{
+ OSL_ENSURE( rTolMultiPropSet.is(), "Need tolerant multi property set. ");
+
+ sal_Bool bSuccessful = sal_False;
+
+ Sequence<OUString> aNames;
+ Sequence<Any> aValues;
+
+ _PrepareForMultiPropertySet(rProperties, Reference<XPropertySetInfo>(NULL), rPropMapper, pSpecialContextIds,
+ aNames, aValues);
+
+ // and, finally, try to set the values
+ try
+ {
+ Sequence< SetPropertyTolerantFailed > aResults(rTolMultiPropSet->setPropertyValuesTolerant( aNames, aValues ));
+ if (aResults.getLength() == 0)
+ bSuccessful = sal_True;
+ else
+ {
+ sal_Int32 nCount(aResults.getLength());
+ for( sal_Int32 i = 0; i < nCount; ++i)
+ {
+ Sequence<OUString> aSeq(1);
+ aSeq[0] = aResults[i].Name;
+ rtl::OUString sMessage;
+ switch (aResults[i].Result)
+ {
+ case TolerantPropertySetResultType::UNKNOWN_PROPERTY :
+ sMessage = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UNKNOWN_PROPERTY"));
+ break;
+ case TolerantPropertySetResultType::ILLEGAL_ARGUMENT :
+ sMessage = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ILLEGAL_ARGUMENT"));
+ break;
+ case TolerantPropertySetResultType::PROPERTY_VETO :
+ sMessage = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PROPERTY_VETO"));
+ break;
+ case TolerantPropertySetResultType::WRAPPED_TARGET :
+ sMessage = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WRAPPED_TARGET"));
+ break;
+ };
+ rImport.SetError(
+ XMLERROR_STYLE_PROP_OTHER | XMLERROR_FLAG_ERROR,
+ aSeq, sMessage, NULL );
+ }
+ }
+ }
+ catch ( ... )
+ {
+ OSL_ENSURE(bSuccessful, "Exception caught; style may not be imported correctly.");
+ }
+
+ return bSuccessful;
+}
+
+void SvXMLImportPropertyMapper::finished(
+ vector< XMLPropertyState >& rProperties,
+ sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const
+{
+ // nothing to do here
+ if( mxNextMapper.is() )
+ mxNextMapper->finished( rProperties, nStartIndex, nEndIndex );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/xmlnume.cxx b/xmloff/source/style/xmlnume.cxx
new file mode 100644
index 000000000000..6ff60f002d39
--- /dev/null
+++ b/xmloff/source/style/xmlnume.cxx
@@ -0,0 +1,907 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/style/NumberingType.hpp>
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/container/XIndexReplace.hpp>
+#include <com/sun/star/awt/XBitmap.hpp>
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#include <com/sun/star/text/HoriOrientation.hpp>
+#include <com/sun/star/text/VertOrientation.hpp>
+#include <com/sun/star/text/XChapterNumberingSupplier.hpp>
+#include <com/sun/star/text/PositionAndSpaceMode.hpp>
+#include <com/sun/star/text/LabelFollow.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+#include <rtl/ustrbuf.hxx>
+
+#include <tools/debug.hxx>
+
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "fonthdl.hxx"
+#include "xmloff/XMLTextListAutoStylePool.hxx"
+#include <xmloff/xmlnume.hxx>
+#include <xmloff/xmlexp.hxx>
+#include <tools/fontenum.hxx>
+
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+using namespace ::xmloff::token;
+
+static sal_Char const XML_UNO_NAME_NRULE_SYMBOL_TEXT_DISTANCE[] = "SymbolTextDistance";
+static sal_Char const XML_UNO_NAME_NRULE_PARENT_NUMBERING[] = "ParentNumbering";
+static sal_Char const XML_UNO_NAME_NRULE_CHAR_STYLE_NAME[] = "CharStyleName";
+static sal_Char const XML_UNO_NAME_NRULE_BULLET_CHAR[] = "BulletChar";
+static sal_Char const XML_UNO_NAME_NRULE_BULLET_RELSIZE[] = "BulletRelSize";
+static sal_Char const XML_UNO_NAME_NRULE_BULLET_COLOR[] = "BulletColor";
+static sal_Char const XML_UNO_NAME_NRULE_GRAPHIC_BITMAP[] = "GraphicBitmap";
+static sal_Char const XML_UNO_NAME_NRULE_GRAPHIC_SIZE[] = "GraphicSize";
+static sal_Char const XML_UNO_NAME_NRULE_VERT_ORIENT[] = "VertOrient";
+static sal_Char const XML_UNO_NAME_NRULE_NUMBERINGTYPE[] = "NumberingType";
+static sal_Char const XML_UNO_NAME_NRULE_HEADING_STYLE_NAME[] = "HeadingStyleName";
+static sal_Char const XML_UNO_NAME_NRULE_PREFIX[] = "Prefix";
+static sal_Char const XML_UNO_NAME_NRULE_SUFFIX[] = "Suffix";
+static sal_Char const XML_UNO_NAME_NRULE_ADJUST[] = "Adjust";
+static sal_Char const XML_UNO_NAME_NRULE_LEFT_MARGIN[] = "LeftMargin";
+static sal_Char const XML_UNO_NAME_NRULE_FIRST_LINE_OFFSET[] = "FirstLineOffset";
+static sal_Char const XML_UNO_NAME_NRULE_BULLET_FONT[] = "BulletFont";
+static sal_Char const XML_UNO_NAME_NRULE_GRAPHICURL[] = "GraphicURL";
+static sal_Char const XML_UNO_NAME_NRULE_START_WITH[] = "StartWith";
+static sal_Char const XML_UNO_NAME_NRULE_POSITION_AND_SPACE_MODE[] = "PositionAndSpaceMode";
+static sal_Char const XML_UNO_NAME_NRULE_LABEL_FOLLOWED_BY[] = "LabelFollowedBy";
+static sal_Char const XML_UNO_NAME_NRULE_LISTTAB_STOP_POSITION[] = "ListtabStopPosition";
+static sal_Char const XML_UNO_NAME_NRULE_FIRST_LINE_INDENT[] = "FirstLineIndent";
+static sal_Char const XML_UNO_NAME_NRULE_INDENT_AT[] = "IndentAt";
+
+void SvxXMLNumRuleExport::exportLevelStyles( const uno::Reference< ::com::sun::star::container::XIndexReplace > & xNumRule,
+ sal_Bool bOutline )
+{
+ sal_Int32 nCount = xNumRule ->getCount();
+ for( sal_Int32 i=0; i<nCount; i++ )
+ {
+ uno::Any aEntry( xNumRule->getByIndex( i ) );
+ uno::Sequence<beans::PropertyValue> aSeq;
+ if( aEntry >>= aSeq )
+ {
+ exportLevelStyle( i, aSeq, bOutline );
+ }
+ }
+}
+
+void SvxXMLNumRuleExport::exportLevelStyle( sal_Int32 nLevel,
+ const uno::Sequence<beans::PropertyValue>& rProps,
+ sal_Bool bOutline )
+{
+ sal_Int16 eType = NumberingType::CHAR_SPECIAL;
+
+ sal_Int16 eAdjust = HoriOrientation::LEFT;
+ OUString sPrefix, sSuffix;
+ OUString sTextStyleName;
+ sal_Bool bHasColor = sal_False;
+ sal_Int32 nColor = 0;
+ sal_Int32 nSpaceBefore = 0, nMinLabelWidth = 0, nMinLabelDist = 0;
+
+ sal_Int16 nStartValue = 1, nDisplayLevels = 1, nBullRelSize = 0;
+
+ sal_Unicode cBullet = 0xf095;
+ OUString sBulletFontName, sBulletFontStyleName ;
+ sal_Int16 eBulletFontFamily = FAMILY_DONTKNOW;
+ sal_Int16 eBulletFontPitch = PITCH_DONTKNOW;
+ rtl_TextEncoding eBulletFontEncoding = RTL_TEXTENCODING_DONTKNOW;
+
+ OUString sImageURL;
+ uno::Reference< ::com::sun::star::awt::XBitmap > xBitmap;
+ sal_Int32 nImageWidth = 0, nImageHeight = 0;
+ sal_Int16 eImageVertOrient = VertOrientation::LINE_CENTER;
+
+ sal_Int16 ePosAndSpaceMode = PositionAndSpaceMode::LABEL_WIDTH_AND_POSITION;
+ sal_Int16 eLabelFollowedBy = LabelFollow::LISTTAB;
+ sal_Int32 nListtabStopPosition( 0 );
+ sal_Int32 nFirstLineIndent( 0 );
+ sal_Int32 nIndentAt( 0 );
+
+ const sal_Int32 nCount = rProps.getLength();
+ const beans::PropertyValue* pPropArray = rProps.getConstArray();
+ for( sal_Int32 i=0; i<nCount; i++ )
+ {
+ const beans::PropertyValue& rProp = pPropArray[i];
+
+ if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_NUMBERINGTYPE, sizeof(XML_UNO_NAME_NRULE_NUMBERINGTYPE)-1 ) )
+ {
+ rProp.Value >>= eType;
+ }
+ else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_PREFIX, sizeof(XML_UNO_NAME_NRULE_PREFIX)-1 ) )
+ {
+ rProp.Value >>= sPrefix;
+ }
+ else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_SUFFIX, sizeof(XML_UNO_NAME_NRULE_SUFFIX)-1 ) )
+ {
+ rProp.Value >>= sSuffix;
+ }
+ else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_BULLET_CHAR, sizeof(XML_UNO_NAME_NRULE_BULLET_CHAR)-1 ) )
+ {
+ OUString sValue;
+ rProp.Value >>= sValue;
+ if( sValue.getLength() > 0 )
+ {
+ cBullet = (sal_Unicode)sValue[0];
+ }
+ }
+ else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_BULLET_RELSIZE, sizeof(XML_UNO_NAME_NRULE_BULLET_RELSIZE)-1 ) )
+ {
+ rProp.Value >>= nBullRelSize;
+ }
+ else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_ADJUST, sizeof(XML_UNO_NAME_NRULE_ADJUST)-1 ) )
+ {
+ sal_Int16 nValue = 0;
+ rProp.Value >>= nValue;
+ eAdjust = nValue;
+ }
+ else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_BULLET_FONT, sizeof(XML_UNO_NAME_NRULE_BULLET_FONT)-1 ) )
+ {
+ awt::FontDescriptor rFDesc;
+ if( rProp.Value >>= rFDesc )
+ {
+ sBulletFontName = rFDesc.Name;
+ sBulletFontStyleName = rFDesc.StyleName;
+ eBulletFontFamily = (sal_Int16)rFDesc.Family;
+ eBulletFontPitch = (sal_Int16)rFDesc.Pitch;
+ eBulletFontEncoding = (rtl_TextEncoding)rFDesc.CharSet;
+ }
+ }
+ else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_GRAPHICURL, sizeof(XML_UNO_NAME_NRULE_GRAPHICURL)-1 ) )
+ {
+ rProp.Value >>= sImageURL;
+ }
+ else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_GRAPHIC_BITMAP, sizeof(XML_UNO_NAME_NRULE_GRAPHIC_BITMAP)-1 ) )
+ {
+ rProp.Value >>= xBitmap;
+ }
+ else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_BULLET_COLOR, sizeof(XML_UNO_NAME_NRULE_BULLET_COLOR)-1 ) )
+ {
+ rProp.Value >>= nColor;
+ bHasColor = sal_True;
+ }
+ else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_START_WITH, sizeof(XML_UNO_NAME_NRULE_START_WITH)-1 ) )
+ {
+ rProp.Value >>= nStartValue;
+ }
+ else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_LEFT_MARGIN, sizeof(XML_UNO_NAME_NRULE_LEFT_MARGIN)-1 ) )
+ {
+ rProp.Value >>= nSpaceBefore;
+ }
+ else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_FIRST_LINE_OFFSET, sizeof(XML_UNO_NAME_NRULE_FIRST_LINE_OFFSET)-1 ) )
+ {
+ rProp.Value >>= nMinLabelWidth;
+ }
+ else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_SYMBOL_TEXT_DISTANCE, sizeof(XML_UNO_NAME_NRULE_SYMBOL_TEXT_DISTANCE)-1 ) )
+ {
+ rProp.Value >>= nMinLabelDist;
+ }
+ else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_PARENT_NUMBERING, sizeof(XML_UNO_NAME_NRULE_PARENT_NUMBERING)-1 ) )
+ {
+ rProp.Value >>= nDisplayLevels;
+ if( nDisplayLevels > nLevel+1 )
+ nDisplayLevels = static_cast<sal_Int16>( nLevel )+1;
+ }
+ else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_CHAR_STYLE_NAME, sizeof(XML_UNO_NAME_NRULE_CHAR_STYLE_NAME)-1 ) )
+ {
+ rProp.Value >>= sTextStyleName;
+ }
+ else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_GRAPHIC_SIZE, sizeof(XML_UNO_NAME_NRULE_GRAPHIC_SIZE)-1 ) )
+ {
+ awt::Size aSize;
+ if( rProp.Value >>= aSize )
+ {
+ nImageWidth = aSize.Width;
+ nImageHeight = aSize.Height;
+ }
+ }
+ else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_VERT_ORIENT, sizeof(XML_UNO_NAME_NRULE_VERT_ORIENT)-1 ) )
+ {
+ sal_Int16 nValue = 0;
+ rProp.Value >>= nValue;
+ eImageVertOrient = nValue;
+ }
+ else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_POSITION_AND_SPACE_MODE,
+ sizeof(XML_UNO_NAME_NRULE_POSITION_AND_SPACE_MODE)-1 ) )
+ {
+ sal_Int16 nValue = 0;
+ rProp.Value >>= nValue;
+ ePosAndSpaceMode = nValue;
+ }
+ else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_LABEL_FOLLOWED_BY,
+ sizeof(XML_UNO_NAME_NRULE_LABEL_FOLLOWED_BY)-1 ) )
+ {
+ sal_Int16 nValue = 0;
+ rProp.Value >>= nValue;
+ eLabelFollowedBy = nValue;
+ }
+ else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_LISTTAB_STOP_POSITION,
+ sizeof(XML_UNO_NAME_NRULE_LISTTAB_STOP_POSITION)-1 ) )
+ {
+ rProp.Value >>= nListtabStopPosition;
+ }
+ else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_FIRST_LINE_INDENT,
+ sizeof(XML_UNO_NAME_NRULE_FIRST_LINE_INDENT)-1 ) )
+ {
+ rProp.Value >>= nFirstLineIndent;
+ }
+ else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_INDENT_AT,
+ sizeof(XML_UNO_NAME_NRULE_INDENT_AT)-1 ) )
+ {
+ rProp.Value >>= nIndentAt;
+ }
+ }
+
+ if( bOutline && (NumberingType::CHAR_SPECIAL == eType ||
+ NumberingType::BITMAP == eType) )
+ {
+ DBG_ASSERT( !bOutline,
+ "SvxXMLNumRuleExport::exportLevelStyle: invalid style for outline" );
+ return;
+ }
+
+ GetExport().CheckAttrList();
+
+ // text:level
+ OUStringBuffer sTmp;
+ sTmp.append( nLevel + 1 );
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_LEVEL, sTmp.makeStringAndClear() );
+ // #i110694#: no style-name on list-level-style-image
+ // #i116149#: neither prefix/suffix
+ if (NumberingType::BITMAP != eType)
+ {
+ if (sTextStyleName.getLength() > 0)
+ {
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME,
+ GetExport().EncodeStyleName( sTextStyleName ) );
+ }
+ if (sPrefix.getLength() > 0)
+ {
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_NUM_PREFIX,
+ sPrefix );
+ }
+ if (sSuffix.getLength() > 0)
+ {
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_NUM_SUFFIX,
+ sSuffix );
+ }
+ }
+
+ enum XMLTokenEnum eElem = XML_LIST_LEVEL_STYLE_NUMBER;
+ if( NumberingType::CHAR_SPECIAL == eType )
+ {
+ // <text:list-level-style-bullet>
+ eElem = XML_LIST_LEVEL_STYLE_BULLET;
+
+ if( cBullet )
+ {
+ if( cBullet < ' ' )
+ {
+ cBullet = 0xF000 + 149;
+ }
+ // text:bullet-char="..."
+ sTmp.append( cBullet );
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_BULLET_CHAR,
+ sTmp.makeStringAndClear() );
+ }
+
+ }
+ else if( NumberingType::BITMAP == eType )
+ {
+ // <text:list-level-style-image>
+
+ eElem = XML_LIST_LEVEL_STYLE_IMAGE;
+
+
+ if( sImageURL.getLength() )
+ {
+ OUString sURL( GetExport().AddEmbeddedGraphicObject( sImageURL ) );
+ if( sURL.getLength() )
+ {
+ GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, sURL );
+
+ GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+ GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
+ }
+ }
+ else
+ {
+ DBG_ASSERT( !xBitmap.is(),
+ "embedded images are not supported by now" );
+ }
+ }
+ else
+ {
+ // <text:list-level-style-number> or <text:outline-level-style>
+ if( bOutline )
+ eElem = XML_OUTLINE_LEVEL_STYLE;
+ else
+ eElem = XML_LIST_LEVEL_STYLE_NUMBER;
+
+ GetExport().GetMM100UnitConverter().convertNumFormat( sTmp, eType );
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_NUM_FORMAT,
+ sTmp.makeStringAndClear() );
+ GetExport().GetMM100UnitConverter().convertNumLetterSync( sTmp, eType );
+ if( sTmp.getLength() )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE,
+ XML_NUM_LETTER_SYNC,
+ sTmp.makeStringAndClear() );
+
+ if( nStartValue != 1 )
+ {
+ sTmp.append( (sal_Int32)nStartValue );
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_START_VALUE,
+ sTmp.makeStringAndClear() );
+ }
+ if( nDisplayLevels > 1 && NumberingType::NUMBER_NONE != eType )
+ {
+ sTmp.append( (sal_Int32)nDisplayLevels );
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_DISPLAY_LEVELS,
+ sTmp.makeStringAndClear() );
+ }
+ }
+
+ {
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT, eElem,
+ sal_True, sal_True );
+
+ OUStringBuffer sBuffer;
+ if ( ePosAndSpaceMode == PositionAndSpaceMode::LABEL_WIDTH_AND_POSITION )
+ {
+ nSpaceBefore += nMinLabelWidth;
+ nMinLabelWidth = -nMinLabelWidth;
+ if( nSpaceBefore != 0 )
+ {
+ GetExport().GetMM100UnitConverter().convertMeasure( sBuffer, nSpaceBefore );
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_SPACE_BEFORE,
+ sBuffer.makeStringAndClear() );
+ }
+ if( nMinLabelWidth != 0 )
+ {
+ GetExport().GetMM100UnitConverter().convertMeasure( sBuffer, nMinLabelWidth );
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_MIN_LABEL_WIDTH,
+ sBuffer.makeStringAndClear() );
+ }
+ if( nMinLabelDist > 0 )
+ {
+ GetExport().GetMM100UnitConverter().convertMeasure( sBuffer, nMinLabelDist );
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_MIN_LABEL_DISTANCE,
+ sBuffer.makeStringAndClear() );
+ }
+ }
+ /* Check, if properties for position-and-space-mode LABEL_ALIGNMENT
+ are allowed to be exported. (#i89178#)
+ */
+ else if ( ePosAndSpaceMode == PositionAndSpaceMode::LABEL_ALIGNMENT &&
+ mbExportPositionAndSpaceModeLabelAlignment )
+ {
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT,
+ XML_LIST_LEVEL_POSITION_AND_SPACE_MODE,
+ XML_LABEL_ALIGNMENT );
+ }
+ if( HoriOrientation::LEFT != eAdjust )
+ {
+ enum XMLTokenEnum eValue = XML_TOKEN_INVALID;
+ switch( eAdjust )
+ {
+ case HoriOrientation::RIGHT: eValue = XML_END; break;
+ case HoriOrientation::CENTER: eValue = XML_CENTER; break;
+ }
+ if( eValue != XML_TOKEN_INVALID )
+ GetExport().AddAttribute( XML_NAMESPACE_FO, XML_TEXT_ALIGN, eValue );
+ }
+
+ if( NumberingType::BITMAP == eType )
+ {
+ enum XMLTokenEnum eValue = XML_TOKEN_INVALID;
+ switch( eImageVertOrient )
+ {
+ case VertOrientation::BOTTOM: // yes, its OK: BOTTOM means that the baseline
+ // hits the frame at its topmost position
+ case VertOrientation::LINE_TOP:
+ case VertOrientation::CHAR_TOP:
+ eValue = XML_TOP;
+ break;
+ case VertOrientation::CENTER:
+ case VertOrientation::LINE_CENTER:
+ case VertOrientation::CHAR_CENTER:
+ eValue = XML_MIDDLE;
+ break;
+ case VertOrientation::TOP: // yes, its OK: TOP means that the baseline
+ // hits the frame at its bottommost position
+ case VertOrientation::LINE_BOTTOM:
+ case VertOrientation::CHAR_BOTTOM:
+ eValue = XML_BOTTOM;
+ break;
+ }
+ if( eValue != XML_TOKEN_INVALID )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_VERTICAL_POS, eValue );
+
+ eValue = XML_TOKEN_INVALID;
+ switch( eImageVertOrient )
+ {
+ case VertOrientation::TOP:
+ case VertOrientation::CENTER:
+ case VertOrientation::BOTTOM:
+ eValue = XML_BASELINE;
+ break;
+ case VertOrientation::LINE_TOP:
+ case VertOrientation::LINE_CENTER:
+ case VertOrientation::LINE_BOTTOM:
+ eValue = XML_LINE;
+ break;
+ case VertOrientation::CHAR_TOP:
+ case VertOrientation::CHAR_CENTER:
+ case VertOrientation::CHAR_BOTTOM:
+ eValue = XML_CHAR;
+ break;
+ }
+ if( eValue != XML_TOKEN_INVALID )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_VERTICAL_REL, eValue );
+
+ if( nImageWidth > 0 )
+ {
+ GetExport().GetMM100UnitConverter().convertMeasure( sBuffer, nImageWidth );
+ GetExport().AddAttribute( XML_NAMESPACE_FO, XML_WIDTH,
+ sBuffer.makeStringAndClear() );
+ }
+
+ if( nImageHeight > 0 )
+ {
+ GetExport().GetMM100UnitConverter().convertMeasure( sBuffer, nImageHeight );
+ GetExport().AddAttribute( XML_NAMESPACE_FO, XML_HEIGHT,
+ sBuffer.makeStringAndClear() );
+ }
+ }
+
+ {
+ SvXMLElementExport aElement( GetExport(), XML_NAMESPACE_STYLE,
+ XML_LIST_LEVEL_PROPERTIES, sal_True, sal_True );
+
+ /* Check, if properties for position-and-space-mode LABEL_ALIGNMENT
+ are allowed to be exported. (#i89178#)
+ */
+ if ( ePosAndSpaceMode == PositionAndSpaceMode::LABEL_ALIGNMENT &&
+ mbExportPositionAndSpaceModeLabelAlignment )
+ {
+ enum XMLTokenEnum eValue = XML_LISTTAB;
+ if ( eLabelFollowedBy == LabelFollow::SPACE )
+ {
+ eValue = XML_SPACE;
+ }
+ else if ( eLabelFollowedBy == LabelFollow::NOTHING )
+ {
+ eValue = XML_NOTHING;
+ }
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT,
+ XML_LABEL_FOLLOWED_BY, eValue );
+
+ if ( eLabelFollowedBy == LabelFollow::LISTTAB &&
+ nListtabStopPosition > 0 )
+ {
+ GetExport().GetMM100UnitConverter().convertMeasure( sBuffer, nListtabStopPosition );
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT,
+ XML_LIST_TAB_STOP_POSITION,
+ sBuffer.makeStringAndClear() );
+ }
+
+ if ( nFirstLineIndent != 0 )
+ {
+ GetExport().GetMM100UnitConverter().convertMeasure( sBuffer, nFirstLineIndent );
+ GetExport().AddAttribute( XML_NAMESPACE_FO,
+ XML_TEXT_INDENT,
+ sBuffer.makeStringAndClear() );
+ }
+
+ if ( nIndentAt != 0 )
+ {
+ GetExport().GetMM100UnitConverter().convertMeasure( sBuffer, nIndentAt );
+ GetExport().AddAttribute( XML_NAMESPACE_FO,
+ XML_MARGIN_LEFT,
+ sBuffer.makeStringAndClear() );
+ }
+
+ SvXMLElementExport aLabelAlignmentElement( GetExport(), XML_NAMESPACE_STYLE,
+ XML_LIST_LEVEL_LABEL_ALIGNMENT,
+ sal_True, sal_True );
+ }
+ }
+
+ if( NumberingType::CHAR_SPECIAL == eType )
+ {
+ if( sBulletFontName.getLength() )
+ {
+ OUString sStyleName =
+ GetExport().GetFontAutoStylePool()->Find(
+ sBulletFontName, sBulletFontStyleName,
+ eBulletFontFamily, eBulletFontPitch,
+ eBulletFontEncoding );
+
+ if( sStyleName.getLength() )
+ {
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE,
+ XML_FONT_NAME,
+ sStyleName );
+ }
+ else
+ {
+ Any aAny;
+ OUString sTemp;
+
+ const SvXMLUnitConverter& rUnitConv =
+ GetExport().GetMM100UnitConverter();
+ XMLFontFamilyNamePropHdl aFamilyNameHdl;
+ aAny <<= sBulletFontName;
+ if( aFamilyNameHdl.exportXML( sTemp, aAny, rUnitConv ) )
+ GetExport().AddAttribute( XML_NAMESPACE_FO,
+ XML_FONT_FAMILY, sTemp );
+
+ if( sBulletFontStyleName.getLength() )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE,
+ XML_FONT_STYLE_NAME,
+ sBulletFontStyleName );
+
+ XMLFontFamilyPropHdl aFamilyHdl;
+ aAny <<= (sal_Int16)eBulletFontFamily;
+ if( aFamilyHdl.exportXML( sTemp, aAny, rUnitConv ) )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE,
+ XML_FONT_FAMILY_GENERIC,
+ sTemp );
+
+ XMLFontPitchPropHdl aPitchHdl;
+ aAny <<= (sal_Int16)eBulletFontPitch;
+ if( aPitchHdl.exportXML( sTemp, aAny, rUnitConv ) )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE,
+ XML_FONT_PITCH, sTemp );
+
+ XMLFontEncodingPropHdl aEncHdl;
+ aAny <<= (sal_Int16)eBulletFontEncoding;
+ if( aEncHdl.exportXML( sTemp, aAny, rUnitConv ) )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE,
+ XML_FONT_CHARSET, sTemp );
+ }
+ }
+ }
+ if( NumberingType::BITMAP != eType )
+ {
+ // fo:color = "#..."
+ if( bHasColor )
+ {
+ const Color aColor( nColor );
+ if( aColor.GetColor() == 0xffffffff )
+ {
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_USE_WINDOW_FONT_COLOR, XML_TRUE );
+ }
+ else
+ {
+ SvXMLUnitConverter::convertColor( sBuffer, aColor );
+ GetExport().AddAttribute( XML_NAMESPACE_FO, XML_COLOR,
+ sBuffer.makeStringAndClear() );
+ }
+ }
+ // fo:height="...%"
+ if( nBullRelSize )
+ {
+ GetExport().GetMM100UnitConverter().convertPercent( sTmp, nBullRelSize );
+ GetExport().AddAttribute( XML_NAMESPACE_FO, XML_FONT_SIZE,
+ sTmp.makeStringAndClear() );
+ }
+ }
+ if( GetExport().GetAttrList().getLength() > 0 )
+ {
+ SvXMLElementExport aElement( GetExport(), XML_NAMESPACE_STYLE,
+ XML_TEXT_PROPERTIES, sal_True, sal_True );
+ }
+ if( NumberingType::BITMAP == eType && sImageURL.getLength() )
+ {
+ // optional office:binary-data
+ GetExport().AddEmbeddedGraphicObjectAsBase64( sImageURL );
+ }
+ }
+}
+
+
+uno::Reference< ::com::sun::star::container::XIndexReplace > SvxXMLNumRuleExport::GetUNONumRule() const
+{
+ return uno::Reference< ::com::sun::star::container::XIndexReplace > ();
+}
+
+void SvxXMLNumRuleExport::AddListStyleAttributes()
+{
+}
+
+
+SvxXMLNumRuleExport::SvxXMLNumRuleExport( SvXMLExport& rExp ) :
+ rExport( rExp ),
+ sNumberingRules( RTL_CONSTASCII_USTRINGPARAM( "NumberingRules" ) ),
+ sIsPhysical( RTL_CONSTASCII_USTRINGPARAM( "IsPhysical" ) ),
+ sIsContinuousNumbering( RTL_CONSTASCII_USTRINGPARAM( "IsContinuousNumbering" ) ),
+ // Let list style creation depend on Load/Save option "ODF format version" (#i89178#)
+ mbExportPositionAndSpaceModeLabelAlignment( true )
+{
+ switch ( GetExport().getDefaultVersion() )
+ {
+ case SvtSaveOptions::ODFVER_010:
+ case SvtSaveOptions::ODFVER_011:
+ {
+ mbExportPositionAndSpaceModeLabelAlignment = false;
+ }
+ break;
+ default: // ODFVER_UNKNOWN or ODFVER_012
+ {
+ mbExportPositionAndSpaceModeLabelAlignment = true;
+ }
+ }
+}
+
+SvxXMLNumRuleExport::~SvxXMLNumRuleExport()
+{
+}
+
+void SvxXMLNumRuleExport::exportNumberingRule(
+ const OUString& rName,
+ const Reference< XIndexReplace >& rNumRule )
+{
+ Reference< XPropertySet > xPropSet( rNumRule, UNO_QUERY );
+ Reference< XPropertySetInfo > xPropSetInfo;
+ if( xPropSet.is() )
+ xPropSetInfo = xPropSet->getPropertySetInfo();
+
+ GetExport().CheckAttrList();
+
+ // style:name="..."
+ if( rName.getLength() )
+ {
+ sal_Bool bEncoded = sal_False;
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_NAME,
+ GetExport().EncodeStyleName( rName, &bEncoded ) );
+ if( bEncoded )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_DISPLAY_NAME,
+ rName);
+ }
+
+ // text:consecutive-numbering="..."
+ sal_Bool bContNumbering = sal_False;
+ if( xPropSetInfo.is() &&
+ xPropSetInfo->hasPropertyByName( sIsContinuousNumbering ) )
+ {
+ Any aAny( xPropSet->getPropertyValue( sIsContinuousNumbering ) );
+ bContNumbering = *(sal_Bool *)aAny.getValue();
+ }
+ if( bContNumbering )
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT,
+ XML_CONSECUTIVE_NUMBERING, XML_TRUE );
+
+ // other application specific attributes
+ AddListStyleAttributes();
+
+ {
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT, XML_LIST_STYLE ,
+ sal_True, sal_True );
+ exportLevelStyles( rNumRule );
+ }
+}
+
+sal_Bool SvxXMLNumRuleExport::exportStyle( const Reference< XStyle >& rStyle )
+{
+ Reference< XPropertySet > xPropSet( rStyle, UNO_QUERY );
+ Reference< XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
+
+ Any aAny;
+
+ // Don't export styles that aren't existing really. This may be the
+ // case for StarOffice Writer's pool styles.
+ if( xPropSetInfo->hasPropertyByName( sIsPhysical ) )
+ {
+ aAny = xPropSet->getPropertyValue( sIsPhysical );
+ if( !*(sal_Bool *)aAny.getValue() )
+ return sal_False;
+ }
+
+ aAny = xPropSet->getPropertyValue( sNumberingRules );
+ Reference<XIndexReplace> xNumRule;
+ aAny >>= xNumRule;
+
+ OUString sName = rStyle->getName();
+
+ exportNumberingRule( sName, xNumRule );
+
+ return sal_True;
+}
+
+void SvxXMLNumRuleExport::exportOutline()
+{
+ Reference< XChapterNumberingSupplier > xCNSupplier( GetExport().GetModel(),
+ UNO_QUERY );
+ DBG_ASSERT( xCNSupplier.is(), "no chapter numbering supplier" );
+
+ if( xCNSupplier.is() )
+ {
+ Reference< XIndexReplace > xNumRule( xCNSupplier->getChapterNumberingRules() );
+ DBG_ASSERT( xNumRule.is(), "no chapter numbering rules" );
+
+ if( xNumRule.is() )
+ {
+ /* Outline style has property style:name since ODF 1.2
+ Thus, export this property and adjust fix for issue #i69627# (#i90780#)
+ */
+ OUString sOutlineStyleName;
+ {
+ Reference<XPropertySet> xNumRulePropSet(
+ xCNSupplier->getChapterNumberingRules(), UNO_QUERY );
+ if (xNumRulePropSet.is())
+ {
+ const OUString sName( RTL_CONSTASCII_USTRINGPARAM("Name") );
+ xNumRulePropSet->getPropertyValue( sName ) >>= sOutlineStyleName;
+ }
+ }
+ const SvtSaveOptions::ODFDefaultVersion nODFVersion =
+ GetExport().getDefaultVersion();
+ if ( ( nODFVersion == SvtSaveOptions::ODFVER_010 ||
+ nODFVersion == SvtSaveOptions::ODFVER_011 ) &&
+ GetExport().writeOutlineStyleAsNormalListStyle() )
+ {
+ exportNumberingRule( sOutlineStyleName, xNumRule );
+ }
+ else
+ {
+ if ( nODFVersion != SvtSaveOptions::ODFVER_010 &&
+ nODFVersion != SvtSaveOptions::ODFVER_011 )
+ {
+ // style:name="..."
+ GetExport().CheckAttrList();
+ if ( sOutlineStyleName.getLength() > 0 )
+ {
+ sal_Bool bEncoded = sal_False;
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_NAME,
+ GetExport().EncodeStyleName( sOutlineStyleName,
+ &bEncoded ) );
+ if( bEncoded )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE,
+ XML_DISPLAY_NAME,
+ sOutlineStyleName );
+ }
+ }
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT,
+ XML_OUTLINE_STYLE, sal_True, sal_True );
+ exportLevelStyles( xNumRule, sal_True );
+ }
+ }
+ }
+}
+
+void SvxXMLNumRuleExport::exportStyles( sal_Bool bUsed,
+ XMLTextListAutoStylePool *pPool,
+ sal_Bool bExportChapterNumbering )
+{
+ if( bExportChapterNumbering )
+ exportOutline();
+
+ Reference< XStyleFamiliesSupplier > xFamiliesSupp( GetExport().GetModel(), UNO_QUERY );
+ DBG_ASSERT( xFamiliesSupp.is(), "No XStyleFamiliesSupplier from XModel for export!" );
+ if( xFamiliesSupp.is() )
+ {
+ Reference< XNameAccess > xFamilies( xFamiliesSupp->getStyleFamilies() );
+ DBG_ASSERT( xFamiliesSupp.is(), "getStyleFamilies() from XModel failed for export!" );
+
+ if( xFamilies.is() )
+ {
+ const OUString aNumberStyleName( RTL_CONSTASCII_USTRINGPARAM( "NumberingStyles" ));
+
+ Reference< XIndexAccess > xStyles;
+ if( xFamilies->hasByName( aNumberStyleName ) )
+ {
+ xFamilies->getByName( aNumberStyleName ) >>= xStyles;
+
+ DBG_ASSERT( xStyles.is(), "Style not found for export!" );
+
+ if( xStyles.is() )
+ {
+ const sal_Int32 nStyles = xStyles->getCount();
+
+ for( sal_Int32 i=0; i < nStyles; i++ )
+ {
+ Reference< XStyle > xStyle;
+ xStyles->getByIndex( i ) >>= xStyle;
+
+ if( !bUsed || xStyle->isInUse() )
+ {
+ exportStyle( xStyle );
+ if( pPool )
+ pPool->RegisterName( xStyle->getName() );
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+sal_Bool SvxXMLNumRuleExport::GetOutlineStyles( XMLStringVector& rStyleNames,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & rModel )
+{
+ Reference< XChapterNumberingSupplier > xCNSupplier( rModel,
+ UNO_QUERY );
+ sal_Int32 nLevels = 0;
+ Reference< XIndexReplace > xNumRule;
+ if( xCNSupplier.is() )
+ {
+ xNumRule = xCNSupplier->getChapterNumberingRules();
+ if( xNumRule.is() )
+ nLevels = xNumRule->getCount();
+ }
+
+ rStyleNames.resize( nLevels );
+ for( sal_Int32 i=0; i<nLevels; i++ )
+ {
+ uno::Any aEntry( xNumRule->getByIndex( i ) );
+ uno::Sequence<beans::PropertyValue> aSeq;
+ if( aEntry >>= aSeq )
+ {
+ const sal_Int32 nCount = aSeq.getLength();
+ const beans::PropertyValue* pPropArray = aSeq.getConstArray();
+ for( sal_Int32 j=0; j<nCount; j++ )
+ {
+ const beans::PropertyValue& rProp = pPropArray[j];
+
+ if( rProp.Name.equalsAsciiL(
+ XML_UNO_NAME_NRULE_HEADING_STYLE_NAME,
+ sizeof(XML_UNO_NAME_NRULE_HEADING_STYLE_NAME)-1 ) )
+ {
+ rProp.Value >>= rStyleNames[i];
+ break;
+ }
+ }
+ }
+ }
+
+ return nLevels != 0;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx
new file mode 100644
index 000000000000..6124414ffe5b
--- /dev/null
+++ b/xmloff/source/style/xmlnumfe.cxx
@@ -0,0 +1,1809 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#define _SVSTDARR_ULONGS
+#define _ZFORLIST_DECLARE_TABLE
+
+#include <svl/svstdarr.hxx>
+#include <svl/zforlist.hxx>
+#include <svl/zformat.hxx>
+#include <svl/numuno.hxx>
+#include <i18npool/mslangid.hxx>
+#include <tools/debug.hxx>
+#include <rtl/math.hxx>
+#include <unotools/calendarwrapper.hxx>
+#include <unotools/charclass.hxx>
+#include <com/sun/star/lang/Locale.hpp>
+#include <rtl/ustrbuf.hxx>
+
+#include <com/sun/star/i18n/NativeNumberXmlAttributes.hpp>
+
+#include <xmloff/xmlnumfe.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/attrlist.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/families.hxx>
+#include <xmloff/xmlnumfi.hxx> // SvXMLNumFmtDefaults
+
+#define _SVSTDARR_USHORTS
+#include <svl/svstdarr.hxx>
+#include <svl/nfsymbol.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlexp.hxx>
+
+#include <set>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+using namespace ::svt;
+
+//-------------------------------------------------------------------------
+
+#define XMLNUM_MAX_PARTS 3
+
+//-------------------------------------------------------------------------
+
+struct LessuInt32
+{
+ sal_Bool operator() (const sal_uInt32 rValue1, const sal_uInt32 rValue2) const
+ {
+ return rValue1 < rValue2;
+ }
+};
+
+typedef std::set< sal_uInt32, LessuInt32 > SvXMLuInt32Set;
+
+class SvXMLNumUsedList_Impl
+{
+ SvXMLuInt32Set aUsed;
+ SvXMLuInt32Set aWasUsed;
+ SvXMLuInt32Set::iterator aCurrentUsedPos;
+ sal_uInt32 nUsedCount;
+ sal_uInt32 nWasUsedCount;
+
+public:
+ SvXMLNumUsedList_Impl();
+ ~SvXMLNumUsedList_Impl();
+
+ void SetUsed( sal_uInt32 nKey );
+ sal_Bool IsUsed( sal_uInt32 nKey ) const;
+ sal_Bool IsWasUsed( sal_uInt32 nKey ) const;
+ void Export();
+
+ sal_Bool GetFirstUsed(sal_uInt32& nKey);
+ sal_Bool GetNextUsed(sal_uInt32& nKey);
+
+ void GetWasUsed(uno::Sequence<sal_Int32>& rWasUsed);
+ void SetWasUsed(const uno::Sequence<sal_Int32>& rWasUsed);
+};
+
+//-------------------------------------------------------------------------
+
+struct SvXMLEmbeddedTextEntry
+{
+ sal_uInt16 nSourcePos; // position in NumberFormat (to skip later)
+ sal_Int32 nFormatPos; // resulting position in embedded-text element
+ rtl::OUString aText;
+
+ SvXMLEmbeddedTextEntry( sal_uInt16 nSP, sal_Int32 nFP, const rtl::OUString& rT ) :
+ nSourcePos(nSP), nFormatPos(nFP), aText(rT) {}
+};
+
+typedef SvXMLEmbeddedTextEntry* SvXMLEmbeddedTextEntryPtr;
+SV_DECL_PTRARR_DEL( SvXMLEmbeddedTextEntryArr, SvXMLEmbeddedTextEntryPtr, 4, 4 )
+
+//-------------------------------------------------------------------------
+
+SV_IMPL_PTRARR( SvXMLEmbeddedTextEntryArr, SvXMLEmbeddedTextEntryPtr );
+
+//-------------------------------------------------------------------------
+
+//
+//! SvXMLNumUsedList_Impl should be optimized!
+//
+
+SvXMLNumUsedList_Impl::SvXMLNumUsedList_Impl() :
+ nUsedCount(0),
+ nWasUsedCount(0)
+{
+}
+
+SvXMLNumUsedList_Impl::~SvXMLNumUsedList_Impl()
+{
+}
+
+void SvXMLNumUsedList_Impl::SetUsed( sal_uInt32 nKey )
+{
+ if ( !IsWasUsed(nKey) )
+ {
+ std::pair<SvXMLuInt32Set::iterator, bool> aPair = aUsed.insert( nKey );
+ if (aPair.second)
+ nUsedCount++;
+ }
+}
+
+sal_Bool SvXMLNumUsedList_Impl::IsUsed( sal_uInt32 nKey ) const
+{
+ SvXMLuInt32Set::const_iterator aItr = aUsed.find(nKey);
+ return (aItr != aUsed.end());
+}
+
+sal_Bool SvXMLNumUsedList_Impl::IsWasUsed( sal_uInt32 nKey ) const
+{
+ SvXMLuInt32Set::const_iterator aItr = aWasUsed.find(nKey);
+ return (aItr != aWasUsed.end());
+}
+
+void SvXMLNumUsedList_Impl::Export()
+{
+ SvXMLuInt32Set::const_iterator aItr = aUsed.begin();
+ while (aItr != aUsed.end())
+ {
+ std::pair<SvXMLuInt32Set::const_iterator, bool> aPair = aWasUsed.insert( *aItr );
+ if (aPair.second)
+ nWasUsedCount++;
+ ++aItr;
+ }
+ aUsed.clear();
+ nUsedCount = 0;
+}
+
+sal_Bool SvXMLNumUsedList_Impl::GetFirstUsed(sal_uInt32& nKey)
+{
+ sal_Bool bRet(sal_False);
+ aCurrentUsedPos = aUsed.begin();
+ if(nUsedCount)
+ {
+ DBG_ASSERT(aCurrentUsedPos != aUsed.end(), "something went wrong");
+ nKey = *aCurrentUsedPos;
+ bRet = sal_True;
+ }
+ return bRet;
+}
+
+sal_Bool SvXMLNumUsedList_Impl::GetNextUsed(sal_uInt32& nKey)
+{
+ sal_Bool bRet(sal_False);
+ if (aCurrentUsedPos != aUsed.end())
+ {
+ ++aCurrentUsedPos;
+ if (aCurrentUsedPos != aUsed.end())
+ {
+ nKey = *aCurrentUsedPos;
+ bRet = sal_True;
+ }
+ }
+ return bRet;
+}
+
+void SvXMLNumUsedList_Impl::GetWasUsed(uno::Sequence<sal_Int32>& rWasUsed)
+{
+ rWasUsed.realloc(nWasUsedCount);
+ sal_Int32* pWasUsed = rWasUsed.getArray();
+ if (pWasUsed)
+ {
+ SvXMLuInt32Set::const_iterator aItr = aWasUsed.begin();
+ while (aItr != aWasUsed.end())
+ {
+ *pWasUsed = *aItr;
+ ++aItr;
+ ++pWasUsed;
+ }
+ }
+}
+
+void SvXMLNumUsedList_Impl::SetWasUsed(const uno::Sequence<sal_Int32>& rWasUsed)
+{
+ DBG_ASSERT(nWasUsedCount == 0, "WasUsed should be empty");
+ sal_Int32 nCount(rWasUsed.getLength());
+ const sal_Int32* pWasUsed = rWasUsed.getConstArray();
+ for (sal_uInt16 i = 0; i < nCount; i++, pWasUsed++)
+ {
+ std::pair<SvXMLuInt32Set::const_iterator, bool> aPair = aWasUsed.insert( *pWasUsed );
+ if (aPair.second)
+ nWasUsedCount++;
+ }
+}
+
+//-------------------------------------------------------------------------
+
+SvXMLNumFmtExport::SvXMLNumFmtExport(
+ SvXMLExport& rExp,
+ const uno::Reference< util::XNumberFormatsSupplier >& rSupp ) :
+ rExport( rExp ),
+ sPrefix( OUString(RTL_CONSTASCII_USTRINGPARAM("N")) ),
+ pFormatter( NULL ),
+ pCharClass( NULL ),
+ pLocaleData( NULL )
+{
+ // supplier must be SvNumberFormatsSupplierObj
+ SvNumberFormatsSupplierObj* pObj =
+ SvNumberFormatsSupplierObj::getImplementation( rSupp );
+ if (pObj)
+ pFormatter = pObj->GetNumberFormatter();
+
+ if ( pFormatter )
+ {
+ pCharClass = new CharClass( pFormatter->GetServiceManager(),
+ pFormatter->GetLocale() );
+ pLocaleData = new LocaleDataWrapper( pFormatter->GetServiceManager(),
+ pFormatter->GetLocale() );
+ }
+ else
+ {
+ lang::Locale aLocale( MsLangId::convertLanguageToLocale( MsLangId::getSystemLanguage() ) );
+
+ pCharClass = new CharClass( rExport.getServiceFactory(), aLocale );
+ pLocaleData = new LocaleDataWrapper( rExport.getServiceFactory(), aLocale );
+ }
+
+ pUsedList = new SvXMLNumUsedList_Impl;
+}
+
+SvXMLNumFmtExport::SvXMLNumFmtExport(
+ SvXMLExport& rExp,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XNumberFormatsSupplier >& rSupp,
+ const rtl::OUString& rPrefix ) :
+ rExport( rExp ),
+ sPrefix( rPrefix ),
+ pFormatter( NULL ),
+ pCharClass( NULL ),
+ pLocaleData( NULL )
+{
+ // supplier must be SvNumberFormatsSupplierObj
+ SvNumberFormatsSupplierObj* pObj =
+ SvNumberFormatsSupplierObj::getImplementation( rSupp );
+ if (pObj)
+ pFormatter = pObj->GetNumberFormatter();
+
+ if ( pFormatter )
+ {
+ pCharClass = new CharClass( pFormatter->GetServiceManager(),
+ pFormatter->GetLocale() );
+ pLocaleData = new LocaleDataWrapper( pFormatter->GetServiceManager(),
+ pFormatter->GetLocale() );
+ }
+ else
+ {
+ lang::Locale aLocale( MsLangId::convertLanguageToLocale( MsLangId::getSystemLanguage() ) );
+
+ pCharClass = new CharClass( rExport.getServiceFactory(), aLocale );
+ pLocaleData = new LocaleDataWrapper( rExport.getServiceFactory(), aLocale );
+ }
+
+ pUsedList = new SvXMLNumUsedList_Impl;
+}
+
+SvXMLNumFmtExport::~SvXMLNumFmtExport()
+{
+ delete pUsedList;
+ delete pLocaleData;
+ delete pCharClass;
+}
+
+//-------------------------------------------------------------------------
+
+//
+// helper methods
+//
+
+OUString lcl_CreateStyleName( sal_Int32 nKey, sal_Int32 nPart, sal_Bool bDefPart, const rtl::OUString& rPrefix )
+{
+ OUStringBuffer aFmtName( 10L );
+ aFmtName.append( rPrefix );
+ aFmtName.append( nKey );
+ if (!bDefPart)
+ {
+ aFmtName.append( (sal_Unicode)'P' );
+ aFmtName.append( nPart );
+ }
+ return aFmtName.makeStringAndClear();
+}
+
+void SvXMLNumFmtExport::AddCalendarAttr_Impl( const OUString& rCalendar )
+{
+ if ( rCalendar.getLength() )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_CALENDAR, rCalendar );
+ }
+}
+
+void SvXMLNumFmtExport::AddTextualAttr_Impl( sal_Bool bText )
+{
+ if ( bText ) // non-textual
+ {
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_TEXTUAL, XML_TRUE );
+ }
+}
+
+void SvXMLNumFmtExport::AddStyleAttr_Impl( sal_Bool bLong )
+{
+ if ( bLong ) // short is default
+ {
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_STYLE, XML_LONG );
+ }
+}
+
+void SvXMLNumFmtExport::AddLanguageAttr_Impl( sal_Int32 nLang )
+{
+ if ( nLang != LANGUAGE_SYSTEM )
+ {
+ OUString aLangStr, aCountryStr;
+ MsLangId::convertLanguageToIsoNames( (LanguageType)nLang, aLangStr, aCountryStr );
+
+ if (aLangStr.getLength())
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_LANGUAGE, aLangStr );
+ if (aCountryStr.getLength())
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_COUNTRY, aCountryStr );
+ }
+}
+
+//-------------------------------------------------------------------------
+
+//
+// methods to write individual elements within a format
+//
+
+void SvXMLNumFmtExport::AddToTextElement_Impl( const OUString& rString )
+{
+ // append to sTextContent, write element in FinishTextElement_Impl
+ // to avoid several text elements following each other
+
+ sTextContent.append( rString );
+}
+
+void SvXMLNumFmtExport::FinishTextElement_Impl()
+{
+ if ( sTextContent.getLength() )
+ {
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_NUMBER, XML_TEXT,
+ sal_True, sal_False );
+ rExport.Characters( sTextContent.makeStringAndClear() );
+ }
+}
+
+void SvXMLNumFmtExport::WriteColorElement_Impl( const Color& rColor )
+{
+ FinishTextElement_Impl();
+
+ OUStringBuffer aColStr( 7 );
+ SvXMLUnitConverter::convertColor( aColStr, rColor );
+ rExport.AddAttribute( XML_NAMESPACE_FO, XML_COLOR,
+ aColStr.makeStringAndClear() );
+
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_STYLE, XML_TEXT_PROPERTIES,
+ sal_True, sal_False );
+}
+
+void SvXMLNumFmtExport::WriteCurrencyElement_Impl( const OUString& rString,
+ const OUString& rExt )
+{
+ FinishTextElement_Impl();
+
+ if ( rExt.getLength() )
+ {
+ sal_Int32 nLang = rExt.toInt32(16); // hex
+ if ( nLang < 0 ) // extension string may contain "-" separator
+ nLang = -nLang;
+ AddLanguageAttr_Impl( nLang ); // adds to pAttrList
+ }
+
+ SvXMLElementExport aElem( rExport,
+ XML_NAMESPACE_NUMBER, XML_CURRENCY_SYMBOL,
+ sal_True, sal_False );
+ rExport.Characters( rString );
+}
+
+void SvXMLNumFmtExport::WriteBooleanElement_Impl()
+{
+ FinishTextElement_Impl();
+
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_NUMBER, XML_BOOLEAN,
+ sal_True, sal_False );
+}
+
+void SvXMLNumFmtExport::WriteTextContentElement_Impl()
+{
+ FinishTextElement_Impl();
+
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_NUMBER, XML_TEXT_CONTENT,
+ sal_True, sal_False );
+}
+
+// date elements
+
+void SvXMLNumFmtExport::WriteDayElement_Impl( const OUString& rCalendar, sal_Bool bLong )
+{
+ FinishTextElement_Impl();
+
+ AddCalendarAttr_Impl( rCalendar ); // adds to pAttrList
+ AddStyleAttr_Impl( bLong ); // adds to pAttrList
+
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_NUMBER, XML_DAY,
+ sal_True, sal_False );
+}
+
+void SvXMLNumFmtExport::WriteMonthElement_Impl( const OUString& rCalendar, sal_Bool bLong, sal_Bool bText )
+{
+ FinishTextElement_Impl();
+
+ AddCalendarAttr_Impl( rCalendar ); // adds to pAttrList
+ AddStyleAttr_Impl( bLong ); // adds to pAttrList
+ AddTextualAttr_Impl( bText ); // adds to pAttrList
+
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_NUMBER, XML_MONTH,
+ sal_True, sal_False );
+}
+
+void SvXMLNumFmtExport::WriteYearElement_Impl( const OUString& rCalendar, sal_Bool bLong )
+{
+ FinishTextElement_Impl();
+
+ AddCalendarAttr_Impl( rCalendar ); // adds to pAttrList
+ AddStyleAttr_Impl( bLong ); // adds to pAttrList
+
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_NUMBER, XML_YEAR,
+ sal_True, sal_False );
+}
+
+void SvXMLNumFmtExport::WriteEraElement_Impl( const OUString& rCalendar, sal_Bool bLong )
+{
+ FinishTextElement_Impl();
+
+ AddCalendarAttr_Impl( rCalendar ); // adds to pAttrList
+ AddStyleAttr_Impl( bLong ); // adds to pAttrList
+
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_NUMBER, XML_ERA,
+ sal_True, sal_False );
+}
+
+void SvXMLNumFmtExport::WriteDayOfWeekElement_Impl( const OUString& rCalendar, sal_Bool bLong )
+{
+ FinishTextElement_Impl();
+
+ AddCalendarAttr_Impl( rCalendar ); // adds to pAttrList
+ AddStyleAttr_Impl( bLong ); // adds to pAttrList
+
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_NUMBER, XML_DAY_OF_WEEK,
+ sal_True, sal_False );
+}
+
+void SvXMLNumFmtExport::WriteWeekElement_Impl( const OUString& rCalendar )
+{
+ FinishTextElement_Impl();
+
+ AddCalendarAttr_Impl( rCalendar ); // adds to pAttrList
+
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_NUMBER, XML_WEEK_OF_YEAR,
+ sal_True, sal_False );
+}
+
+void SvXMLNumFmtExport::WriteQuarterElement_Impl( const OUString& rCalendar, sal_Bool bLong )
+{
+ FinishTextElement_Impl();
+
+ AddCalendarAttr_Impl( rCalendar ); // adds to pAttrList
+ AddStyleAttr_Impl( bLong ); // adds to pAttrList
+
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_NUMBER, XML_QUARTER,
+ sal_True, sal_False );
+}
+
+// time elements
+
+void SvXMLNumFmtExport::WriteHoursElement_Impl( sal_Bool bLong )
+{
+ FinishTextElement_Impl();
+
+ AddStyleAttr_Impl( bLong ); // adds to pAttrList
+
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_NUMBER, XML_HOURS,
+ sal_True, sal_False );
+}
+
+void SvXMLNumFmtExport::WriteMinutesElement_Impl( sal_Bool bLong )
+{
+ FinishTextElement_Impl();
+
+ AddStyleAttr_Impl( bLong ); // adds to pAttrList
+
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_NUMBER, XML_MINUTES,
+ sal_True, sal_False );
+}
+
+void SvXMLNumFmtExport::WriteSecondsElement_Impl( sal_Bool bLong, sal_uInt16 nDecimals )
+{
+ FinishTextElement_Impl();
+
+ AddStyleAttr_Impl( bLong ); // adds to pAttrList
+ if ( nDecimals > 0 )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_DECIMAL_PLACES,
+ OUString::valueOf( (sal_Int32) nDecimals ) );
+ }
+
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_NUMBER, XML_SECONDS,
+ sal_True, sal_False );
+}
+
+void SvXMLNumFmtExport::WriteAMPMElement_Impl()
+{
+ FinishTextElement_Impl();
+
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_NUMBER, XML_AM_PM,
+ sal_True, sal_False );
+}
+
+// numbers
+
+void SvXMLNumFmtExport::WriteNumberElement_Impl(
+ sal_Int32 nDecimals, sal_Int32 nInteger,
+ const OUString& rDashStr, sal_Bool bVarDecimals,
+ sal_Bool bGrouping, sal_Int32 nTrailingThousands,
+ const SvXMLEmbeddedTextEntryArr& rEmbeddedEntries )
+{
+ FinishTextElement_Impl();
+
+ // decimals
+ if ( nDecimals >= 0 ) // negative = automatic
+ {
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_DECIMAL_PLACES,
+ OUString::valueOf( nDecimals ) );
+ }
+
+ // integer digits
+ if ( nInteger >= 0 ) // negative = automatic
+ {
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_MIN_INTEGER_DIGITS,
+ OUString::valueOf( nInteger ) );
+ }
+
+ // decimal replacement (dashes) or variable decimals (#)
+ if ( rDashStr.getLength() || bVarDecimals )
+ {
+ // variable decimals means an empty replacement string
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_DECIMAL_REPLACEMENT,
+ rDashStr );
+ }
+
+ // (automatic) grouping separator
+ if ( bGrouping )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_GROUPING, XML_TRUE );
+ }
+
+ // display-factor if there are trailing thousands separators
+ if ( nTrailingThousands )
+ {
+ // each separator character removes three digits
+ double fFactor = ::rtl::math::pow10Exp( 1.0, 3 * nTrailingThousands );
+
+ OUStringBuffer aFactStr;
+ SvXMLUnitConverter::convertDouble( aFactStr, fFactor );
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_DISPLAY_FACTOR, aFactStr.makeStringAndClear() );
+ }
+
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_NUMBER, XML_NUMBER,
+ sal_True, sal_True );
+
+ // number:embedded-text as child elements
+
+ sal_uInt16 nEntryCount = rEmbeddedEntries.Count();
+ for (sal_uInt16 nEntry=0; nEntry<nEntryCount; nEntry++)
+ {
+ SvXMLEmbeddedTextEntry* pObj = rEmbeddedEntries[nEntry];
+
+ // position attribute
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_POSITION,
+ OUString::valueOf( pObj->nFormatPos ) );
+ SvXMLElementExport aChildElem( rExport, XML_NAMESPACE_NUMBER, XML_EMBEDDED_TEXT,
+ sal_True, sal_False );
+
+ // text as element content
+ rtl::OUString aContent( pObj->aText );
+ while ( nEntry+1 < nEntryCount && rEmbeddedEntries[nEntry+1]->nFormatPos == pObj->nFormatPos )
+ {
+ // The array can contain several elements for the same position in the number
+ // (for example, literal text and space from underscores). They must be merged
+ // into a single embedded-text element.
+ aContent += rEmbeddedEntries[nEntry+1]->aText;
+ ++nEntry;
+ }
+ rExport.Characters( aContent );
+ }
+}
+
+void SvXMLNumFmtExport::WriteScientificElement_Impl(
+ sal_Int32 nDecimals, sal_Int32 nInteger,
+ sal_Bool bGrouping, sal_Int32 nExp )
+{
+ FinishTextElement_Impl();
+
+ // decimals
+ if ( nDecimals >= 0 ) // negative = automatic
+ {
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_DECIMAL_PLACES,
+ OUString::valueOf( nDecimals ) );
+ }
+
+ // integer digits
+ if ( nInteger >= 0 ) // negative = automatic
+ {
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_MIN_INTEGER_DIGITS,
+ OUString::valueOf( nInteger ) );
+ }
+
+ // (automatic) grouping separator
+ if ( bGrouping )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_GROUPING, XML_TRUE );
+ }
+
+ // exponent digits
+ if ( nExp >= 0 )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_MIN_EXPONENT_DIGITS,
+ OUString::valueOf( nExp ) );
+ }
+
+ SvXMLElementExport aElem( rExport,
+ XML_NAMESPACE_NUMBER, XML_SCIENTIFIC_NUMBER,
+ sal_True, sal_False );
+}
+
+void SvXMLNumFmtExport::WriteFractionElement_Impl(
+ sal_Int32 nInteger, sal_Bool bGrouping,
+ sal_Int32 nNumerator, sal_Int32 nDenominator )
+{
+ FinishTextElement_Impl();
+
+ // integer digits
+ if ( nInteger >= 0 ) // negative = default (no integer part)
+ {
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_MIN_INTEGER_DIGITS,
+ OUString::valueOf( nInteger ) );
+ }
+
+ // (automatic) grouping separator
+ if ( bGrouping )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_GROUPING, XML_TRUE );
+ }
+
+ // numerator digits
+ if ( nNumerator >= 0 )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_MIN_NUMERATOR_DIGITS,
+ OUString::valueOf( nNumerator ) );
+ }
+
+ // denominator digits
+ if ( nDenominator >= 0 )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_MIN_DENOMINATOR_DIGITS,
+ OUString::valueOf( nDenominator ) );
+ }
+
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_NUMBER, XML_FRACTION,
+ sal_True, sal_False );
+}
+
+// mapping (condition)
+
+void SvXMLNumFmtExport::WriteMapElement_Impl( sal_Int32 nOp, double fLimit,
+ sal_Int32 nKey, sal_Int32 nPart )
+{
+ FinishTextElement_Impl();
+
+ if ( nOp != NUMBERFORMAT_OP_NO )
+ {
+ // style namespace
+
+ OUStringBuffer aCondStr( 20L );
+ aCondStr.appendAscii( "value()" ); //! define constant
+ switch ( nOp )
+ {
+ case NUMBERFORMAT_OP_EQ: aCondStr.append( (sal_Unicode) '=' ); break;
+ case NUMBERFORMAT_OP_NE: aCondStr.appendAscii( "<>" ); break;
+ case NUMBERFORMAT_OP_LT: aCondStr.append( (sal_Unicode) '<' ); break;
+ case NUMBERFORMAT_OP_LE: aCondStr.appendAscii( "<=" ); break;
+ case NUMBERFORMAT_OP_GT: aCondStr.append( (sal_Unicode) '>' ); break;
+ case NUMBERFORMAT_OP_GE: aCondStr.appendAscii( ">=" ); break;
+ default:
+ OSL_FAIL("unknown operator");
+ }
+ ::rtl::math::doubleToUStringBuffer( aCondStr, fLimit,
+ rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
+ '.', true );
+
+ rExport.AddAttribute( XML_NAMESPACE_STYLE, XML_CONDITION,
+ aCondStr.makeStringAndClear() );
+
+ rExport.AddAttribute( XML_NAMESPACE_STYLE, XML_APPLY_STYLE_NAME,
+ rExport.EncodeStyleName( lcl_CreateStyleName( nKey, nPart, sal_False,
+ sPrefix ) ) );
+
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_STYLE, XML_MAP,
+ sal_True, sal_False );
+ }
+}
+
+//-------------------------------------------------------------------------
+// for old (automatic) currency formats: parse currency symbol from text
+
+xub_StrLen lcl_FindSymbol( const String& sUpperStr, const String& sCurString )
+{
+ // search for currency symbol
+ // Quoting as in ImpSvNumberformatScan::Symbol_Division
+
+ xub_StrLen nCPos = 0;
+ while (nCPos != STRING_NOTFOUND)
+ {
+ nCPos = sUpperStr.Search( sCurString, nCPos );
+ if (nCPos != STRING_NOTFOUND)
+ {
+ // in Quotes?
+ xub_StrLen nQ = SvNumberformat::GetQuoteEnd( sUpperStr, nCPos );
+ if ( nQ == STRING_NOTFOUND )
+ {
+ // dm can be escaped as "dm or \d
+ sal_Unicode c;
+ if ( nCPos == 0 ||
+ ((c = sUpperStr.GetChar(xub_StrLen(nCPos-1))) != '"'
+ && c != '\\') )
+ {
+ return nCPos; // found
+ }
+ else
+ nCPos++; // continue
+ }
+ else
+ nCPos = nQ + 1; // continue after quote end
+ }
+ }
+ return STRING_NOTFOUND; // not found
+}
+
+sal_Bool SvXMLNumFmtExport::WriteTextWithCurrency_Impl( const OUString& rString,
+ const ::com::sun::star::lang::Locale& rLocale )
+{
+ // returns sal_True if currency element was written
+
+ sal_Bool bRet = sal_False;
+
+ LanguageType nLang = MsLangId::convertLocaleToLanguage( rLocale );
+ pFormatter->ChangeIntl( nLang );
+ String sCurString, sDummy;
+ pFormatter->GetCompatibilityCurrency( sCurString, sDummy );
+
+ pCharClass->setLocale( rLocale );
+ String sUpperStr = pCharClass->upper(rString);
+ xub_StrLen nPos = lcl_FindSymbol( sUpperStr, sCurString );
+ if ( nPos != STRING_NOTFOUND )
+ {
+ sal_Int32 nLength = rString.getLength();
+ sal_Int32 nCurLen = sCurString.Len();
+ sal_Int32 nCont = nPos + nCurLen;
+
+ // text before currency symbol
+ if ( nPos > 0 )
+ AddToTextElement_Impl( rString.copy( 0, nPos ) );
+
+ // currency symbol (empty string -> default)
+ OUString sEmpty;
+ WriteCurrencyElement_Impl( sEmpty, sEmpty );
+ bRet = sal_True;
+
+ // text after currency symbol
+ if ( nCont < nLength )
+ AddToTextElement_Impl( rString.copy( nCont, nLength-nCont ) );
+ }
+ else
+ AddToTextElement_Impl( rString ); // simple text
+
+ return bRet; // sal_True: currency element written
+}
+
+//-------------------------------------------------------------------------
+
+OUString lcl_GetDefaultCalendar( SvNumberFormatter* pFormatter, LanguageType nLang )
+{
+ // get name of first non-gregorian calendar for the language
+
+ OUString aCalendar;
+ CalendarWrapper* pCalendar = pFormatter->GetCalendar();
+ if (pCalendar)
+ {
+ lang::Locale aLocale( MsLangId::convertLanguageToLocale( nLang ) );
+
+ uno::Sequence<OUString> aCals = pCalendar->getAllCalendars( aLocale );
+ sal_Int32 nCnt = aCals.getLength();
+ sal_Bool bFound = sal_False;
+ for ( sal_Int32 j=0; j < nCnt && !bFound; j++ )
+ {
+ if ( !aCals[j].equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("gregorian") ) )
+ {
+ aCalendar = aCals[j];
+ bFound = sal_True;
+ }
+ }
+ }
+ return aCalendar;
+}
+
+//-------------------------------------------------------------------------
+
+sal_Bool lcl_IsInEmbedded( const SvXMLEmbeddedTextEntryArr& rEmbeddedEntries, sal_uInt16 nPos )
+{
+ sal_uInt16 nCount = rEmbeddedEntries.Count();
+ for (sal_uInt16 i=0; i<nCount; i++)
+ if ( rEmbeddedEntries[i]->nSourcePos == nPos )
+ return sal_True;
+
+ return sal_False; // not found
+}
+
+sal_Bool lcl_IsDefaultDateFormat( const SvNumberformat& rFormat, sal_Bool bSystemDate, NfIndexTableOffset eBuiltIn )
+{
+ // make an extra loop to collect date elements, to check if it is a default format
+ // before adding the automatic-order attribute
+
+ SvXMLDateElementAttributes eDateDOW = XML_DEA_NONE;
+ SvXMLDateElementAttributes eDateDay = XML_DEA_NONE;
+ SvXMLDateElementAttributes eDateMonth = XML_DEA_NONE;
+ SvXMLDateElementAttributes eDateYear = XML_DEA_NONE;
+ SvXMLDateElementAttributes eDateHours = XML_DEA_NONE;
+ SvXMLDateElementAttributes eDateMins = XML_DEA_NONE;
+ SvXMLDateElementAttributes eDateSecs = XML_DEA_NONE;
+ sal_Bool bDateNoDefault = sal_False;
+
+ sal_uInt16 nPos = 0;
+ sal_Bool bEnd = sal_False;
+ short nLastType = 0;
+ while (!bEnd)
+ {
+ short nElemType = rFormat.GetNumForType( 0, nPos, sal_False );
+ switch ( nElemType )
+ {
+ case 0:
+ if ( nLastType == NF_SYMBOLTYPE_STRING )
+ bDateNoDefault = sal_True; // text at the end -> no default date format
+ bEnd = sal_True; // end of format reached
+ break;
+ case NF_SYMBOLTYPE_STRING:
+ case NF_SYMBOLTYPE_DATESEP:
+ case NF_SYMBOLTYPE_TIMESEP:
+ case NF_SYMBOLTYPE_TIME100SECSEP:
+ // text is ignored, except at the end
+ break;
+ // same mapping as in SvXMLNumFormatContext::AddNfKeyword:
+ case NF_KEY_NN: eDateDOW = XML_DEA_SHORT; break;
+ case NF_KEY_NNN:
+ case NF_KEY_NNNN: eDateDOW = XML_DEA_LONG; break;
+ case NF_KEY_D: eDateDay = XML_DEA_SHORT; break;
+ case NF_KEY_DD: eDateDay = XML_DEA_LONG; break;
+ case NF_KEY_M: eDateMonth = XML_DEA_SHORT; break;
+ case NF_KEY_MM: eDateMonth = XML_DEA_LONG; break;
+ case NF_KEY_MMM: eDateMonth = XML_DEA_TEXTSHORT; break;
+ case NF_KEY_MMMM: eDateMonth = XML_DEA_TEXTLONG; break;
+ case NF_KEY_YY: eDateYear = XML_DEA_SHORT; break;
+ case NF_KEY_YYYY: eDateYear = XML_DEA_LONG; break;
+ case NF_KEY_H: eDateHours = XML_DEA_SHORT; break;
+ case NF_KEY_HH: eDateHours = XML_DEA_LONG; break;
+ case NF_KEY_MI: eDateMins = XML_DEA_SHORT; break;
+ case NF_KEY_MMI: eDateMins = XML_DEA_LONG; break;
+ case NF_KEY_S: eDateSecs = XML_DEA_SHORT; break;
+ case NF_KEY_SS: eDateSecs = XML_DEA_LONG; break;
+ case NF_KEY_AP:
+ case NF_KEY_AMPM: break; // AM/PM may or may not be in date/time formats -> ignore by itself
+ default:
+ bDateNoDefault = sal_True; // any other element -> no default format
+ }
+ nLastType = nElemType;
+ ++nPos;
+ }
+
+ if ( bDateNoDefault )
+ return sal_False; // additional elements
+ else
+ {
+ NfIndexTableOffset eFound = (NfIndexTableOffset) SvXMLNumFmtDefaults::GetDefaultDateFormat(
+ eDateDOW, eDateDay, eDateMonth, eDateYear, eDateHours, eDateMins, eDateSecs, bSystemDate );
+
+ return ( eFound == eBuiltIn );
+ }
+}
+
+//
+// export one part (condition)
+//
+
+void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt32 nKey,
+ sal_uInt16 nPart, sal_Bool bDefPart )
+{
+ //! for the default part, pass the coditions from the other parts!
+
+ //
+ // element name
+ //
+
+ NfIndexTableOffset eBuiltIn = pFormatter->GetIndexTableOffset( nKey );
+
+ short nFmtType = 0;
+ sal_Bool bThousand = sal_False;
+ sal_uInt16 nPrecision = 0;
+ sal_uInt16 nLeading = 0;
+ rFormat.GetNumForInfo( nPart, nFmtType, bThousand, nPrecision, nLeading);
+ nFmtType &= ~NUMBERFORMAT_DEFINED;
+
+ // special treatment of builtin formats that aren't detected by normal parsing
+ // (the same formats that get the type set in SvNumberFormatter::ImpGenerateFormats)
+ if ( eBuiltIn == NF_NUMBER_STANDARD )
+ nFmtType = NUMBERFORMAT_NUMBER;
+ else if ( eBuiltIn == NF_BOOLEAN )
+ nFmtType = NUMBERFORMAT_LOGICAL;
+ else if ( eBuiltIn == NF_TEXT )
+ nFmtType = NUMBERFORMAT_TEXT;
+
+ // #101606# An empty subformat is a valid number-style resulting in an
+ // empty display string for the condition of the subformat.
+ if ( nFmtType == NUMBERFORMAT_UNDEFINED && rFormat.GetNumForType( nPart,
+ 0, sal_False ) == 0 )
+ nFmtType = 0;
+
+ XMLTokenEnum eType = XML_TOKEN_INVALID;
+ switch ( nFmtType )
+ {
+ // type is 0 if a format contains no recognized elements
+ // (like text only) - this is handled as a number-style.
+ case 0:
+ case NUMBERFORMAT_NUMBER:
+ case NUMBERFORMAT_SCIENTIFIC:
+ case NUMBERFORMAT_FRACTION:
+ eType = XML_NUMBER_STYLE;
+ break;
+ case NUMBERFORMAT_PERCENT:
+ eType = XML_PERCENTAGE_STYLE;
+ break;
+ case NUMBERFORMAT_CURRENCY:
+ eType = XML_CURRENCY_STYLE;
+ break;
+ case NUMBERFORMAT_DATE:
+ case NUMBERFORMAT_DATETIME:
+ eType = XML_DATE_STYLE;
+ break;
+ case NUMBERFORMAT_TIME:
+ eType = XML_TIME_STYLE;
+ break;
+ case NUMBERFORMAT_TEXT:
+ eType = XML_TEXT_STYLE;
+ break;
+ case NUMBERFORMAT_LOGICAL:
+ eType = XML_BOOLEAN_STYLE;
+ break;
+ }
+ DBG_ASSERT( eType != XML_TOKEN_INVALID, "unknown format type" );
+
+ OUString sAttrValue;
+ sal_Bool bUserDef = ( ( rFormat.GetType() & NUMBERFORMAT_DEFINED ) != 0 );
+
+ //
+ // common attributes for format
+ //
+
+ // format name (generated from key) - style namespace
+ rExport.AddAttribute( XML_NAMESPACE_STYLE, XML_NAME,
+ lcl_CreateStyleName( nKey, nPart, bDefPart, sPrefix ) );
+
+ // "volatile" attribute for styles used only in maps
+ if ( !bDefPart )
+ rExport.AddAttribute( XML_NAMESPACE_STYLE, XML_VOLATILE, XML_TRUE );
+
+ // language / country
+ LanguageType nLang = rFormat.GetLanguage();
+ AddLanguageAttr_Impl( nLang ); // adds to pAttrList
+
+ // title (comment)
+ // titles for builtin formats are not written
+ sAttrValue = rFormat.GetComment();
+ if ( sAttrValue.getLength() && bUserDef && bDefPart )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_TITLE, sAttrValue );
+ }
+
+ // automatic ordering for currency and date formats
+ // only used for some built-in formats
+ sal_Bool bAutoOrder = ( eBuiltIn == NF_CURRENCY_1000INT || eBuiltIn == NF_CURRENCY_1000DEC2 ||
+ eBuiltIn == NF_CURRENCY_1000INT_RED || eBuiltIn == NF_CURRENCY_1000DEC2_RED ||
+ eBuiltIn == NF_CURRENCY_1000DEC2_DASHED ||
+ eBuiltIn == NF_DATE_SYSTEM_SHORT || eBuiltIn == NF_DATE_SYSTEM_LONG ||
+ eBuiltIn == NF_DATE_SYS_MMYY || eBuiltIn == NF_DATE_SYS_DDMMM ||
+ eBuiltIn == NF_DATE_SYS_DDMMYYYY || eBuiltIn == NF_DATE_SYS_DDMMYY ||
+ eBuiltIn == NF_DATE_SYS_DMMMYY || eBuiltIn == NF_DATE_SYS_DMMMYYYY ||
+ eBuiltIn == NF_DATE_SYS_DMMMMYYYY || eBuiltIn == NF_DATE_SYS_NNDMMMYY ||
+ eBuiltIn == NF_DATE_SYS_NNDMMMMYYYY || eBuiltIn == NF_DATE_SYS_NNNNDMMMMYYYY ||
+ eBuiltIn == NF_DATETIME_SYSTEM_SHORT_HHMM || eBuiltIn == NF_DATETIME_SYS_DDMMYYYY_HHMMSS );
+
+ // format source (for date and time formats)
+ // only used for some built-in formats
+ sal_Bool bSystemDate = ( eBuiltIn == NF_DATE_SYSTEM_SHORT ||
+ eBuiltIn == NF_DATE_SYSTEM_LONG ||
+ eBuiltIn == NF_DATETIME_SYSTEM_SHORT_HHMM );
+ sal_Bool bLongSysDate = ( eBuiltIn == NF_DATE_SYSTEM_LONG );
+
+ // check if the format definition matches the key
+ if ( bAutoOrder && ( nFmtType == NUMBERFORMAT_DATE || nFmtType == NUMBERFORMAT_DATETIME ) &&
+ !lcl_IsDefaultDateFormat( rFormat, bSystemDate, eBuiltIn ) )
+ {
+ bAutoOrder = bSystemDate = bLongSysDate = sal_False; // don't write automatic-order attribute then
+ }
+
+ if ( bAutoOrder &&
+ ( nFmtType == NUMBERFORMAT_CURRENCY || nFmtType == NUMBERFORMAT_DATE || nFmtType == NUMBERFORMAT_DATETIME ) )
+ {
+ // #85109# format type must be checked to avoid dtd errors if
+ // locale data contains other format types at the built-in positions
+
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_AUTOMATIC_ORDER,
+ XML_TRUE );
+ }
+
+ if ( bSystemDate && bAutoOrder &&
+ ( nFmtType == NUMBERFORMAT_DATE || nFmtType == NUMBERFORMAT_DATETIME ) )
+ {
+ // #85109# format type must be checked to avoid dtd errors if
+ // locale data contains other format types at the built-in positions
+
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_FORMAT_SOURCE,
+ XML_LANGUAGE );
+ }
+
+ // overflow for time formats as in [hh]:mm
+ // controlled by bThousand from number format info
+ // default for truncate-on-overflow is true
+ if ( nFmtType == NUMBERFORMAT_TIME && bThousand )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_TRUNCATE_ON_OVERFLOW,
+ XML_FALSE );
+ }
+
+ //
+ // Native number transliteration
+ //
+ ::com::sun::star::i18n::NativeNumberXmlAttributes aAttr;
+ rFormat.GetNatNumXml( aAttr, nPart );
+ if ( aAttr.Format.getLength() )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_TRANSLITERATION_FORMAT,
+ aAttr.Format );
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_TRANSLITERATION_LANGUAGE,
+ aAttr.Locale.Language );
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_TRANSLITERATION_COUNTRY,
+ aAttr.Locale.Country );
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_TRANSLITERATION_STYLE,
+ aAttr.Style );
+ }
+
+ //
+ // The element
+ //
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_NUMBER, eType,
+ sal_True, sal_True );
+
+ //
+ // color (properties element)
+ //
+
+ const Color* pCol = rFormat.GetColor( nPart );
+ if (pCol)
+ WriteColorElement_Impl(*pCol);
+
+
+ // detect if there is "real" content, excluding color and maps
+ //! move to implementation of Write... methods?
+ sal_Bool bAnyContent = sal_False;
+
+ //
+ // format elements
+ //
+
+ SvXMLEmbeddedTextEntryArr aEmbeddedEntries(0);
+ if ( eBuiltIn == NF_NUMBER_STANDARD )
+ {
+ // default number format contains just one number element
+ WriteNumberElement_Impl( -1, 1, OUString(), sal_False, sal_False, 0, aEmbeddedEntries );
+ bAnyContent = sal_True;
+ }
+ else if ( eBuiltIn == NF_BOOLEAN )
+ {
+ // boolean format contains just one boolean element
+ WriteBooleanElement_Impl();
+ bAnyContent = sal_True;
+ }
+ else
+ {
+ // first loop to collect attributes
+
+ sal_Bool bDecDashes = sal_False;
+ sal_Bool bVarDecimals = sal_False;
+ sal_Bool bExpFound = sal_False;
+ sal_Bool bCurrFound = sal_False;
+ sal_Bool bInInteger = sal_True;
+ sal_Int32 nExpDigits = 0;
+ sal_Int32 nIntegerSymbols = 0; // for embedded-text, including "#"
+ sal_Int32 nTrailingThousands = 0; // thousands-separators after all digits
+ OUString sCurrExt;
+ OUString aCalendar;
+ sal_uInt16 nPos = 0;
+ sal_Bool bEnd = sal_False;
+ while (!bEnd)
+ {
+ short nElemType = rFormat.GetNumForType( nPart, nPos, sal_False );
+ const XubString* pElemStr = rFormat.GetNumForString( nPart, nPos, sal_False );
+
+ switch ( nElemType )
+ {
+ case 0:
+ bEnd = sal_True; // end of format reached
+ break;
+ case NF_SYMBOLTYPE_DIGIT:
+ if ( bExpFound && pElemStr )
+ nExpDigits += pElemStr->Len();
+ else if ( !bDecDashes && pElemStr && pElemStr->GetChar(0) == '-' )
+ bDecDashes = sal_True;
+ else if ( !bVarDecimals && !bInInteger && pElemStr && pElemStr->GetChar(0) == '#' )
+ {
+ // If the decimal digits string starts with a '#', variable
+ // decimals is assumed (for 0.###, but not 0.0##).
+ bVarDecimals = sal_True;
+ }
+ if ( bInInteger && pElemStr )
+ nIntegerSymbols += pElemStr->Len();
+ nTrailingThousands = 0;
+ break;
+ case NF_SYMBOLTYPE_DECSEP:
+ bInInteger = sal_False;
+ break;
+ case NF_SYMBOLTYPE_THSEP:
+ if (pElemStr)
+ nTrailingThousands += pElemStr->Len(); // is reset to 0 if digits follow
+ break;
+ case NF_SYMBOLTYPE_EXP:
+ bExpFound = sal_True; // following digits are exponent digits
+ bInInteger = sal_False;
+ break;
+ case NF_SYMBOLTYPE_CURRENCY:
+ bCurrFound = sal_True;
+ break;
+ case NF_SYMBOLTYPE_CURREXT:
+ if (pElemStr)
+ sCurrExt = *pElemStr;
+ break;
+
+ // E, EE, R, RR: select non-gregorian calendar
+ // AAA, AAAA: calendar is switched at the position of the element
+ case NF_KEY_EC:
+ case NF_KEY_EEC:
+ case NF_KEY_R:
+ case NF_KEY_RR:
+ if (!aCalendar.getLength())
+ aCalendar = lcl_GetDefaultCalendar( pFormatter, nLang );
+ break;
+ }
+ ++nPos;
+ }
+
+ // collect strings for embedded-text (must be known before number element is written)
+
+ sal_Bool bAllowEmbedded = ( nFmtType == 0 || nFmtType == NUMBERFORMAT_NUMBER ||
+ nFmtType == NUMBERFORMAT_CURRENCY ||
+ nFmtType == NUMBERFORMAT_PERCENT );
+ if ( bAllowEmbedded )
+ {
+ sal_Int32 nDigitsPassed = 0;
+ nPos = 0;
+ bEnd = sal_False;
+ while (!bEnd)
+ {
+ short nElemType = rFormat.GetNumForType( nPart, nPos, sal_False );
+ const XubString* pElemStr = rFormat.GetNumForString( nPart, nPos, sal_False );
+
+ switch ( nElemType )
+ {
+ case 0:
+ bEnd = sal_True; // end of format reached
+ break;
+ case NF_SYMBOLTYPE_DIGIT:
+ if ( pElemStr )
+ nDigitsPassed += pElemStr->Len();
+ break;
+ case NF_SYMBOLTYPE_STRING:
+ case NF_SYMBOLTYPE_BLANK:
+ case NF_SYMBOLTYPE_PERCENT:
+ if ( nDigitsPassed > 0 && nDigitsPassed < nIntegerSymbols && pElemStr )
+ {
+ // text (literal or underscore) within the integer part of a number:number element
+
+ String aEmbeddedStr;
+ if ( nElemType == NF_SYMBOLTYPE_STRING || nElemType == NF_SYMBOLTYPE_PERCENT )
+ aEmbeddedStr = *pElemStr;
+ else
+ SvNumberformat::InsertBlanks( aEmbeddedStr, 0, pElemStr->GetChar(1) );
+
+ sal_Int32 nEmbedPos = nIntegerSymbols - nDigitsPassed;
+
+ SvXMLEmbeddedTextEntry* pObj = new SvXMLEmbeddedTextEntry( nPos, nEmbedPos, aEmbeddedStr );
+ aEmbeddedEntries.Insert( pObj, aEmbeddedEntries.Count() );
+ }
+ break;
+ }
+ ++nPos;
+ }
+ }
+
+ // final loop to write elements
+
+ sal_Bool bNumWritten = sal_False;
+ sal_Bool bCurrencyWritten = sal_False;
+ short nPrevType = 0;
+ nPos = 0;
+ bEnd = sal_False;
+ while (!bEnd)
+ {
+ short nElemType = rFormat.GetNumForType( nPart, nPos, sal_False );
+ const XubString* pElemStr = rFormat.GetNumForString( nPart, nPos, sal_False );
+
+ switch ( nElemType )
+ {
+ case 0:
+ bEnd = sal_True; // end of format reached
+ break;
+ case NF_SYMBOLTYPE_STRING:
+ case NF_SYMBOLTYPE_DATESEP:
+ case NF_SYMBOLTYPE_TIMESEP:
+ case NF_SYMBOLTYPE_TIME100SECSEP:
+ case NF_SYMBOLTYPE_PERCENT:
+ if (pElemStr)
+ {
+ if ( ( nPrevType == NF_KEY_S || nPrevType == NF_KEY_SS ) &&
+ ( nElemType == NF_SYMBOLTYPE_TIME100SECSEP ) &&
+ nPrecision > 0 )
+ {
+ // decimal separator after seconds is implied by
+ // "decimal-places" attribute and must not be written
+ // as text element
+ //! difference between '.' and ',' is lost here
+ }
+ else if ( lcl_IsInEmbedded( aEmbeddedEntries, nPos ) )
+ {
+ // text is written as embedded-text child of the number,
+ // don't create a text element
+ }
+ else if ( nFmtType == NUMBERFORMAT_CURRENCY && !bCurrFound && !bCurrencyWritten )
+ {
+ // automatic currency symbol is implemented as part of
+ // normal text -> search for the symbol
+ bCurrencyWritten = WriteTextWithCurrency_Impl( *pElemStr,
+ MsLangId::convertLanguageToLocale( nLang ) );
+ bAnyContent = sal_True;
+ }
+ else
+ AddToTextElement_Impl( *pElemStr );
+ }
+ break;
+ case NF_SYMBOLTYPE_BLANK:
+ if ( pElemStr && !lcl_IsInEmbedded( aEmbeddedEntries, nPos ) )
+ {
+ // turn "_x" into the number of spaces used for x in InsertBlanks in the NumberFormat
+ // (#i20396# the spaces may also be in embedded-text elements)
+
+ String aBlanks;
+ SvNumberformat::InsertBlanks( aBlanks, 0, pElemStr->GetChar(1) );
+ AddToTextElement_Impl( aBlanks );
+ }
+ break;
+ case NF_KEY_GENERAL :
+ WriteNumberElement_Impl( -1, 1, OUString(), sal_False, sal_False, 0, aEmbeddedEntries );
+ break;
+ case NF_KEY_CCC:
+ if (pElemStr)
+ {
+ if ( bCurrencyWritten )
+ AddToTextElement_Impl( *pElemStr ); // never more than one currency element
+ else
+ {
+ //! must be different from short automatic format
+ //! but should still be empty (meaning automatic)
+ // pElemStr is "CCC"
+
+ WriteCurrencyElement_Impl( *pElemStr, OUString() );
+ bAnyContent = sal_True;
+ bCurrencyWritten = sal_True;
+ }
+ }
+ break;
+ case NF_SYMBOLTYPE_CURRENCY:
+ if (pElemStr)
+ {
+ if ( bCurrencyWritten )
+ AddToTextElement_Impl( *pElemStr ); // never more than one currency element
+ else
+ {
+ WriteCurrencyElement_Impl( *pElemStr, sCurrExt );
+ bAnyContent = sal_True;
+ bCurrencyWritten = sal_True;
+ }
+ }
+ break;
+ case NF_SYMBOLTYPE_DIGIT:
+ if (!bNumWritten) // write number part
+ {
+ switch ( nFmtType )
+ {
+ // for type 0 (not recognized as a special type),
+ // write a "normal" number
+ case 0:
+ case NUMBERFORMAT_NUMBER:
+ case NUMBERFORMAT_CURRENCY:
+ case NUMBERFORMAT_PERCENT:
+ {
+ // decimals
+ // only some built-in formats have automatic decimals
+ sal_Int32 nDecimals = nPrecision; // from GetFormatSpecialInfo
+ if ( eBuiltIn == NF_NUMBER_STANDARD ||
+ eBuiltIn == NF_CURRENCY_1000DEC2 ||
+ eBuiltIn == NF_CURRENCY_1000DEC2_RED ||
+ eBuiltIn == NF_CURRENCY_1000DEC2_CCC ||
+ eBuiltIn == NF_CURRENCY_1000DEC2_DASHED )
+ nDecimals = -1;
+
+ // integer digits
+ // only one built-in format has automatic integer digits
+ sal_Int32 nInteger = nLeading;
+ if ( eBuiltIn == NF_NUMBER_SYSTEM )
+ nInteger = -1;
+
+ // string for decimal replacement
+ // has to be taken from nPrecision
+ // (positive number even for automatic decimals)
+ String sDashStr;
+ if ( bDecDashes && nPrecision > 0 )
+ sDashStr.Fill( nPrecision, '-' );
+
+ WriteNumberElement_Impl( nDecimals, nInteger, sDashStr, bVarDecimals,
+ bThousand, nTrailingThousands, aEmbeddedEntries );
+ bAnyContent = sal_True;
+ }
+ break;
+ case NUMBERFORMAT_SCIENTIFIC:
+ // #i43959# for scientific numbers, count all integer symbols ("0" and "#")
+ // as integer digits: use nIntegerSymbols instead of nLeading
+ // (use of '#' to select multiples in exponent might be added later)
+ WriteScientificElement_Impl( nPrecision, nIntegerSymbols, bThousand, nExpDigits );
+ bAnyContent = sal_True;
+ break;
+ case NUMBERFORMAT_FRACTION:
+ {
+ sal_Int32 nInteger = nLeading;
+ if ( pElemStr && pElemStr->GetChar(0) == '?' )
+ {
+ // If the first digit character is a question mark,
+ // the fraction doesn't have an integer part, and no
+ // min-integer-digits attribute must be written.
+ nInteger = -1;
+ }
+ WriteFractionElement_Impl( nInteger, bThousand, nPrecision, nPrecision );
+ bAnyContent = sal_True;
+ }
+ break;
+ }
+
+ bNumWritten = sal_True;
+ }
+ break;
+ case NF_SYMBOLTYPE_DECSEP:
+ if ( pElemStr && nPrecision == 0 )
+ {
+ // A decimal separator after the number, without following decimal digits,
+ // isn't modelled as part of the number element, so it's written as text
+ // (the distinction between a quoted and non-quoted, locale-dependent
+ // character is lost here).
+
+ AddToTextElement_Impl( *pElemStr );
+ }
+ break;
+ case NF_SYMBOLTYPE_DEL:
+ if ( pElemStr && *pElemStr == XubString('@') )
+ {
+ WriteTextContentElement_Impl();
+ bAnyContent = sal_True;
+ }
+ break;
+
+ case NF_SYMBOLTYPE_CALENDAR:
+ if ( pElemStr )
+ aCalendar = *pElemStr;
+ break;
+
+ // date elements:
+
+ case NF_KEY_D:
+ case NF_KEY_DD:
+ {
+ sal_Bool bLong = ( nElemType == NF_KEY_DD );
+ WriteDayElement_Impl( aCalendar, ( bSystemDate ? bLongSysDate : bLong ) );
+ bAnyContent = sal_True;
+ }
+ break;
+ case NF_KEY_DDD:
+ case NF_KEY_DDDD:
+ case NF_KEY_NN:
+ case NF_KEY_NNN:
+ case NF_KEY_NNNN:
+ case NF_KEY_AAA:
+ case NF_KEY_AAAA:
+ {
+ OUString aCalAttr = aCalendar;
+ if ( nElemType == NF_KEY_AAA || nElemType == NF_KEY_AAAA )
+ {
+ // calendar attribute for AAA and AAAA is switched only for this element
+ if (!aCalAttr.getLength())
+ aCalAttr = lcl_GetDefaultCalendar( pFormatter, nLang );
+ }
+
+ sal_Bool bLong = ( nElemType == NF_KEY_NNN || nElemType == NF_KEY_NNNN ||
+ nElemType == NF_KEY_DDDD || nElemType == NF_KEY_AAAA );
+ WriteDayOfWeekElement_Impl( aCalAttr, ( bSystemDate ? bLongSysDate : bLong ) );
+ bAnyContent = sal_True;
+ if ( nElemType == NF_KEY_NNNN )
+ {
+ // write additional text element for separator
+ pLocaleData->setLocale( MsLangId::convertLanguageToLocale( nLang ) );
+ AddToTextElement_Impl( pLocaleData->getLongDateDayOfWeekSep() );
+ }
+ }
+ break;
+ case NF_KEY_M:
+ case NF_KEY_MM:
+ case NF_KEY_MMM:
+ case NF_KEY_MMMM:
+ case NF_KEY_MMMMM: //! first letter of month name, no attribute available
+ {
+ sal_Bool bLong = ( nElemType == NF_KEY_MM || nElemType == NF_KEY_MMMM );
+ sal_Bool bText = ( nElemType == NF_KEY_MMM || nElemType == NF_KEY_MMMM ||
+ nElemType == NF_KEY_MMMMM );
+ WriteMonthElement_Impl( aCalendar, ( bSystemDate ? bLongSysDate : bLong ), bText );
+ bAnyContent = sal_True;
+ }
+ break;
+ case NF_KEY_YY:
+ case NF_KEY_YYYY:
+ case NF_KEY_EC:
+ case NF_KEY_EEC:
+ case NF_KEY_R: //! R acts as EE, no attribute available
+ {
+ //! distinguish EE and R
+ // calendar attribute for E and EE and R is set in first loop
+ sal_Bool bLong = ( nElemType == NF_KEY_YYYY || nElemType == NF_KEY_EEC ||
+ nElemType == NF_KEY_R );
+ WriteYearElement_Impl( aCalendar, ( bSystemDate ? bLongSysDate : bLong ) );
+ bAnyContent = sal_True;
+ }
+ break;
+ case NF_KEY_G:
+ case NF_KEY_GG:
+ case NF_KEY_GGG:
+ case NF_KEY_RR: //! RR acts as GGGEE, no attribute available
+ {
+ //! distinguish GG and GGG and RR
+ sal_Bool bLong = ( nElemType == NF_KEY_GGG || nElemType == NF_KEY_RR );
+ WriteEraElement_Impl( aCalendar, ( bSystemDate ? bLongSysDate : bLong ) );
+ bAnyContent = sal_True;
+ if ( nElemType == NF_KEY_RR )
+ {
+ // calendar attribute for RR is set in first loop
+ WriteYearElement_Impl( aCalendar, ( bSystemDate ? bLongSysDate : sal_True ) );
+ }
+ }
+ break;
+ case NF_KEY_Q:
+ case NF_KEY_QQ:
+ {
+ sal_Bool bLong = ( nElemType == NF_KEY_QQ );
+ WriteQuarterElement_Impl( aCalendar, ( bSystemDate ? bLongSysDate : bLong ) );
+ bAnyContent = sal_True;
+ }
+ break;
+ case NF_KEY_WW:
+ WriteWeekElement_Impl( aCalendar );
+ bAnyContent = sal_True;
+ break;
+
+ // time elements (bSystemDate is not used):
+
+ case NF_KEY_H:
+ case NF_KEY_HH:
+ WriteHoursElement_Impl( nElemType == NF_KEY_HH );
+ bAnyContent = sal_True;
+ break;
+ case NF_KEY_MI:
+ case NF_KEY_MMI:
+ WriteMinutesElement_Impl( nElemType == NF_KEY_MMI );
+ bAnyContent = sal_True;
+ break;
+ case NF_KEY_S:
+ case NF_KEY_SS:
+ WriteSecondsElement_Impl( ( nElemType == NF_KEY_SS ), nPrecision );
+ bAnyContent = sal_True;
+ break;
+ case NF_KEY_AMPM:
+ case NF_KEY_AP:
+ WriteAMPMElement_Impl(); // short/long?
+ bAnyContent = sal_True;
+ break;
+ }
+ nPrevType = nElemType;
+ ++nPos;
+ }
+ }
+
+ if ( sTextContent.getLength() )
+ bAnyContent = sal_True; // element written in FinishTextElement_Impl
+
+ FinishTextElement_Impl(); // final text element - before maps
+
+ if ( !bAnyContent )
+ {
+ // for an empty format, write an empty text element
+ SvXMLElementExport aTElem( rExport, XML_NAMESPACE_NUMBER, XML_TEXT,
+ sal_True, sal_False );
+ }
+
+ //
+ // mapping (conditions) must be last elements
+ //
+
+ if (bDefPart)
+ {
+ SvNumberformatLimitOps eOp1, eOp2;
+ double fLimit1, fLimit2;
+ rFormat.GetConditions( eOp1, fLimit1, eOp2, fLimit2 );
+
+ WriteMapElement_Impl( eOp1, fLimit1, nKey, 0 );
+ WriteMapElement_Impl( eOp2, fLimit2, nKey, 1 );
+
+ if ( rFormat.HasTextFormat() )
+ {
+ // 4th part is for text -> make an "all other numbers" condition for the 3rd part
+ // by reversing the 2nd condition
+
+ SvNumberformatLimitOps eOp3 = NUMBERFORMAT_OP_NO;
+ double fLimit3 = fLimit2;
+ switch ( eOp2 )
+ {
+ case NUMBERFORMAT_OP_EQ: eOp3 = NUMBERFORMAT_OP_NE; break;
+ case NUMBERFORMAT_OP_NE: eOp3 = NUMBERFORMAT_OP_EQ; break;
+ case NUMBERFORMAT_OP_LT: eOp3 = NUMBERFORMAT_OP_GE; break;
+ case NUMBERFORMAT_OP_LE: eOp3 = NUMBERFORMAT_OP_GT; break;
+ case NUMBERFORMAT_OP_GT: eOp3 = NUMBERFORMAT_OP_LE; break;
+ case NUMBERFORMAT_OP_GE: eOp3 = NUMBERFORMAT_OP_LT; break;
+ default:
+ break;
+ }
+
+ if ( fLimit1 == fLimit2 &&
+ ( ( eOp1 == NUMBERFORMAT_OP_LT && eOp2 == NUMBERFORMAT_OP_GT ) ||
+ ( eOp1 == NUMBERFORMAT_OP_GT && eOp2 == NUMBERFORMAT_OP_LT ) ) )
+ {
+ // For <x and >x, add =x as last condition
+ // (just for readability, <=x would be valid, too)
+
+ eOp3 = NUMBERFORMAT_OP_EQ;
+ }
+
+ WriteMapElement_Impl( eOp3, fLimit3, nKey, 2 );
+ }
+ }
+}
+
+//-------------------------------------------------------------------------
+
+//
+// export one format
+//
+
+void SvXMLNumFmtExport::ExportFormat_Impl( const SvNumberformat& rFormat, sal_uInt32 nKey )
+{
+ sal_uInt16 nUsedParts = 0;
+ sal_uInt16 nPart;
+ for (nPart=0; nPart<XMLNUM_MAX_PARTS; nPart++)
+ if (rFormat.GetNumForType( nPart, 0, sal_False ) != 0)
+ nUsedParts = nPart+1;
+
+ SvNumberformatLimitOps eOp1, eOp2;
+ double fLimit1, fLimit2;
+ rFormat.GetConditions( eOp1, fLimit1, eOp2, fLimit2 );
+
+ // if conditions are set, even empty formats must be written
+
+ if ( eOp1 != NUMBERFORMAT_OP_NO && nUsedParts < 2 )
+ nUsedParts = 2;
+ if ( eOp2 != NUMBERFORMAT_OP_NO && nUsedParts < 3 )
+ nUsedParts = 3;
+ if ( rFormat.HasTextFormat() && nUsedParts < 4 )
+ nUsedParts = 4;
+
+ for (nPart=0; nPart<nUsedParts; nPart++)
+ {
+ sal_Bool bDefault = ( nPart+1 == nUsedParts ); // last = default
+ ExportPart_Impl( rFormat, nKey, nPart, bDefault );
+ }
+}
+
+//-------------------------------------------------------------------------
+
+//
+// export method called by application
+//
+
+void SvXMLNumFmtExport::Export( sal_Bool bIsAutoStyle )
+{
+ if ( !pFormatter )
+ return; // no formatter -> no entries
+
+ sal_uInt32 nKey;
+ const SvNumberformat* pFormat = NULL;
+ sal_Bool bNext(pUsedList->GetFirstUsed(nKey));
+ while(bNext)
+ {
+ pFormat = pFormatter->GetEntry(nKey);
+ if(pFormat)
+ ExportFormat_Impl( *pFormat, nKey );
+ bNext = pUsedList->GetNextUsed(nKey);
+ }
+ if (!bIsAutoStyle)
+ {
+ SvUShorts aLanguages;
+ pFormatter->GetUsedLanguages( aLanguages );
+ sal_uInt16 nLangCount = aLanguages.Count();
+ for (sal_uInt16 nLangPos=0; nLangPos<nLangCount; nLangPos++)
+ {
+ LanguageType nLang = aLanguages[nLangPos];
+
+ sal_uInt32 nDefaultIndex = 0;
+ SvNumberFormatTable& rTable = pFormatter->GetEntryTable(
+ NUMBERFORMAT_DEFINED, nDefaultIndex, nLang );
+ pFormat = rTable.First();
+ while (pFormat)
+ {
+ nKey = rTable.GetCurKey();
+ if (!pUsedList->IsUsed(nKey))
+ {
+ DBG_ASSERT((pFormat->GetType() & NUMBERFORMAT_DEFINED) != 0, "a not user defined numberformat found");
+ // user-defined and used formats are exported
+ ExportFormat_Impl( *pFormat, nKey );
+ // if it is a user-defined Format it will be added else nothing will hapen
+ pUsedList->SetUsed(nKey);
+ }
+
+ pFormat = rTable.Next();
+ }
+ }
+ }
+ pUsedList->Export();
+}
+
+OUString SvXMLNumFmtExport::GetStyleName( sal_uInt32 nKey )
+{
+ if(pUsedList->IsUsed(nKey) || pUsedList->IsWasUsed(nKey))
+ return lcl_CreateStyleName( nKey, 0, sal_True, sPrefix );
+ else
+ {
+ OSL_FAIL("There is no written Data-Style");
+ return rtl::OUString();
+ }
+}
+
+void SvXMLNumFmtExport::SetUsed( sal_uInt32 nKey )
+{
+ DBG_ASSERT( pFormatter != NULL, "missing formatter" );
+ if( !pFormatter )
+ return;
+
+ if (pFormatter->GetEntry(nKey))
+ pUsedList->SetUsed( nKey );
+ else {
+ OSL_FAIL("no existing Numberformat found with this key");
+ }
+}
+
+void SvXMLNumFmtExport::GetWasUsed(uno::Sequence<sal_Int32>& rWasUsed)
+{
+ if (pUsedList)
+ pUsedList->GetWasUsed(rWasUsed);
+}
+
+void SvXMLNumFmtExport::SetWasUsed(const uno::Sequence<sal_Int32>& rWasUsed)
+{
+ if (pUsedList)
+ pUsedList->SetWasUsed(rWasUsed);
+}
+
+
+
+const SvNumberformat* lcl_GetFormat( SvNumberFormatter* pFormatter,
+ sal_uInt32 nKey )
+{
+ return ( pFormatter != NULL ) ? pFormatter->GetEntry( nKey ) : NULL;
+}
+
+sal_uInt32 SvXMLNumFmtExport::ForceSystemLanguage( sal_uInt32 nKey )
+{
+ sal_uInt32 nRet = nKey;
+
+ const SvNumberformat* pFormat = lcl_GetFormat( pFormatter, nKey );
+ if( pFormat != NULL )
+ {
+ DBG_ASSERT( pFormatter != NULL, "format without formatter?" );
+
+ xub_StrLen nErrorPos;
+ short nType = pFormat->GetType();
+
+ sal_uInt32 nNewKey = pFormatter->GetFormatForLanguageIfBuiltIn(
+ nKey, LANGUAGE_SYSTEM );
+
+ if( nNewKey != nKey )
+ {
+ nRet = nNewKey;
+ }
+ else
+ {
+ String aFormatString( pFormat->GetFormatstring() );
+ pFormatter->PutandConvertEntry(
+ aFormatString,
+ nErrorPos, nType, nNewKey,
+ pFormat->GetLanguage(), LANGUAGE_SYSTEM );
+
+ // success? Then use new key.
+ if( nErrorPos == 0 )
+ nRet = nNewKey;
+ }
+ }
+
+ return nRet;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
new file mode 100644
index 000000000000..a09c88233066
--- /dev/null
+++ b/xmloff/source/style/xmlnumfi.cxx
@@ -0,0 +1,2233 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <unotools/syslocale.hxx>
+
+#define _ZFORLIST_DECLARE_TABLE
+#include <svl/zforlist.hxx>
+
+#include <svl/zformat.hxx>
+#include <svl/numuno.hxx>
+#include <rtl/math.hxx>
+#include <i18npool/mslangid.hxx>
+#include <tools/debug.hxx>
+#include <rtl/ustrbuf.hxx>
+
+#include <xmloff/xmlnumfi.hxx>
+#include <xmloff/xmltkmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/families.hxx>
+#include <xmloff/xmltoken.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+//-------------------------------------------------------------------------
+
+struct SvXMLNumFmtEntry
+{
+ rtl::OUString aName;
+ sal_uInt32 nKey;
+ sal_Bool bRemoveAfterUse;
+
+ SvXMLNumFmtEntry( const rtl::OUString& rN, sal_uInt32 nK, sal_Bool bR ) :
+ aName(rN), nKey(nK), bRemoveAfterUse(bR) {}
+};
+
+typedef SvXMLNumFmtEntry* SvXMLNumFmtEntryPtr;
+SV_DECL_PTRARR_DEL( SvXMLNumFmtEntryArr, SvXMLNumFmtEntryPtr, 4, 4 )
+
+struct SvXMLEmbeddedElement
+{
+ sal_Int32 nFormatPos;
+ rtl::OUString aText;
+
+ SvXMLEmbeddedElement( sal_Int32 nFP, const rtl::OUString& rT ) :
+ nFormatPos(nFP), aText(rT) {}
+
+ // comparison operators for PTRARR sorting - sorted by position
+ sal_Bool operator ==( const SvXMLEmbeddedElement& r ) const { return nFormatPos == r.nFormatPos; }
+ sal_Bool operator < ( const SvXMLEmbeddedElement& r ) const { return nFormatPos < r.nFormatPos; }
+};
+
+typedef SvXMLEmbeddedElement* SvXMLEmbeddedElementPtr;
+SV_DECL_PTRARR_SORT_DEL( SvXMLEmbeddedElementArr, SvXMLEmbeddedElementPtr, 0, 4 )
+
+//-------------------------------------------------------------------------
+
+class SvXMLNumImpData
+{
+ SvNumberFormatter* pFormatter;
+ SvXMLTokenMap* pStylesElemTokenMap;
+ SvXMLTokenMap* pStyleElemTokenMap;
+ SvXMLTokenMap* pStyleAttrTokenMap;
+ SvXMLTokenMap* pStyleElemAttrTokenMap;
+ LocaleDataWrapper* pLocaleData;
+ SvXMLNumFmtEntryArr aNameEntries;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxServiceFactory;
+
+public:
+ SvXMLNumImpData(
+ SvNumberFormatter* pFmt,
+ const uno::Reference<lang::XMultiServiceFactory>& xServiceFactory );
+ ~SvXMLNumImpData();
+
+ SvNumberFormatter* GetNumberFormatter() const { return pFormatter; }
+ const SvXMLTokenMap& GetStylesElemTokenMap();
+ const SvXMLTokenMap& GetStyleElemTokenMap();
+ const SvXMLTokenMap& GetStyleAttrTokenMap();
+ const SvXMLTokenMap& GetStyleElemAttrTokenMap();
+ const LocaleDataWrapper& GetLocaleData( LanguageType nLang );
+ sal_uInt32 GetKeyForName( const rtl::OUString& rName );
+ void AddKey( sal_uInt32 nKey, const rtl::OUString& rName, sal_Bool bRemoveAfterUse );
+ void SetUsed( sal_uInt32 nKey );
+ void RemoveVolatileFormats();
+};
+
+
+struct SvXMLNumberInfo
+{
+ sal_Int32 nDecimals;
+ sal_Int32 nInteger;
+ sal_Int32 nExpDigits;
+ sal_Int32 nNumerDigits;
+ sal_Int32 nDenomDigits;
+ sal_Bool bGrouping;
+ sal_Bool bDecReplace;
+ sal_Bool bVarDecimals;
+ double fDisplayFactor;
+ SvXMLEmbeddedElementArr aEmbeddedElements;
+
+ SvXMLNumberInfo()
+ {
+ nDecimals = nInteger = nExpDigits = nNumerDigits = nDenomDigits = -1;
+ bGrouping = bDecReplace = bVarDecimals = sal_False;
+ fDisplayFactor = 1.0;
+ }
+};
+
+class SvXMLNumFmtElementContext : public SvXMLImportContext
+{
+ SvXMLNumFormatContext& rParent;
+ sal_uInt16 nType;
+ rtl::OUStringBuffer aContent;
+ SvXMLNumberInfo aNumInfo;
+ LanguageType nElementLang;
+ sal_Bool bLong;
+ sal_Bool bTextual;
+ rtl::OUString sCalendar;
+
+public:
+ SvXMLNumFmtElementContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLName,
+ SvXMLNumFormatContext& rParentContext, sal_uInt16 nNewType,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
+ virtual ~SvXMLNumFmtElementContext();
+
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
+ virtual void Characters( const rtl::OUString& rChars );
+ virtual void EndElement();
+
+ void AddEmbeddedElement( sal_Int32 nFormatPos, const rtl::OUString& rContent );
+};
+
+
+class SvXMLNumFmtEmbeddedTextContext : public SvXMLImportContext
+{
+ SvXMLNumFmtElementContext& rParent;
+ rtl::OUStringBuffer aContent;
+ sal_Int32 nTextPosition;
+
+public:
+ SvXMLNumFmtEmbeddedTextContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLName,
+ SvXMLNumFmtElementContext& rParentContext,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
+ virtual ~SvXMLNumFmtEmbeddedTextContext();
+
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
+ virtual void Characters( const rtl::OUString& rChars );
+ virtual void EndElement();
+};
+
+
+class SvXMLNumFmtMapContext : public SvXMLImportContext
+{
+ SvXMLNumFormatContext& rParent;
+ rtl::OUString sCondition;
+ rtl::OUString sName;
+
+public:
+ SvXMLNumFmtMapContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLName,
+ SvXMLNumFormatContext& rParentContext,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
+ virtual ~SvXMLNumFmtMapContext();
+
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
+ virtual void Characters( const rtl::OUString& rChars );
+ virtual void EndElement();
+};
+
+
+class SvXMLNumFmtPropContext : public SvXMLImportContext
+{
+ SvXMLNumFormatContext& rParent;
+ Color aColor;
+ sal_Bool bColSet;
+
+public:
+ SvXMLNumFmtPropContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLName,
+ SvXMLNumFormatContext& rParentContext,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
+ virtual ~SvXMLNumFmtPropContext();
+
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
+ virtual void Characters( const rtl::OUString& rChars );
+ virtual void EndElement();
+};
+
+
+//-------------------------------------------------------------------------
+
+enum SvXMLStyleTokens
+{
+ XML_TOK_STYLE_TEXT,
+ XML_TOK_STYLE_NUMBER,
+ XML_TOK_STYLE_SCIENTIFIC_NUMBER,
+ XML_TOK_STYLE_FRACTION,
+ XML_TOK_STYLE_CURRENCY_SYMBOL,
+ XML_TOK_STYLE_DAY,
+ XML_TOK_STYLE_MONTH,
+ XML_TOK_STYLE_YEAR,
+ XML_TOK_STYLE_ERA,
+ XML_TOK_STYLE_DAY_OF_WEEK,
+ XML_TOK_STYLE_WEEK_OF_YEAR,
+ XML_TOK_STYLE_QUARTER,
+ XML_TOK_STYLE_HOURS,
+ XML_TOK_STYLE_AM_PM,
+ XML_TOK_STYLE_MINUTES,
+ XML_TOK_STYLE_SECONDS,
+ XML_TOK_STYLE_BOOLEAN,
+ XML_TOK_STYLE_TEXT_CONTENT,
+ XML_TOK_STYLE_PROPERTIES,
+ XML_TOK_STYLE_MAP
+};
+
+enum SvXMLStyleAttrTokens
+{
+ XML_TOK_STYLE_ATTR_NAME,
+ XML_TOK_STYLE_ATTR_LANGUAGE,
+ XML_TOK_STYLE_ATTR_COUNTRY,
+ XML_TOK_STYLE_ATTR_TITLE,
+ XML_TOK_STYLE_ATTR_AUTOMATIC_ORDER,
+ XML_TOK_STYLE_ATTR_FORMAT_SOURCE,
+ XML_TOK_STYLE_ATTR_TRUNCATE_ON_OVERFLOW,
+ XML_TOK_STYLE_ATTR_VOLATILE,
+ XML_TOK_STYLE_ATTR_TRANSL_FORMAT,
+ XML_TOK_STYLE_ATTR_TRANSL_LANGUAGE,
+ XML_TOK_STYLE_ATTR_TRANSL_COUNTRY,
+ XML_TOK_STYLE_ATTR_TRANSL_STYLE
+};
+
+enum SvXMLStyleElemAttrTokens
+{
+ XML_TOK_ELEM_ATTR_DECIMAL_PLACES,
+ XML_TOK_ELEM_ATTR_MIN_INTEGER_DIGITS,
+ XML_TOK_ELEM_ATTR_GROUPING,
+ XML_TOK_ELEM_ATTR_DISPLAY_FACTOR,
+ XML_TOK_ELEM_ATTR_DECIMAL_REPLACEMENT,
+ XML_TOK_ELEM_ATTR_MIN_EXPONENT_DIGITS,
+ XML_TOK_ELEM_ATTR_MIN_NUMERATOR_DIGITS,
+ XML_TOK_ELEM_ATTR_MIN_DENOMINATOR_DIGITS,
+ XML_TOK_ELEM_ATTR_LANGUAGE,
+ XML_TOK_ELEM_ATTR_COUNTRY,
+ XML_TOK_ELEM_ATTR_STYLE,
+ XML_TOK_ELEM_ATTR_TEXTUAL,
+ XML_TOK_ELEM_ATTR_CALENDAR
+};
+
+//-------------------------------------------------------------------------
+
+//
+// standard colors
+//
+
+#define XML_NUMF_COLORCOUNT 10
+
+static ColorData aNumFmtStdColors[XML_NUMF_COLORCOUNT] =
+{
+ COL_BLACK,
+ COL_LIGHTBLUE,
+ COL_LIGHTGREEN,
+ COL_LIGHTCYAN,
+ COL_LIGHTRED,
+ COL_LIGHTMAGENTA,
+ COL_BROWN,
+ COL_GRAY,
+ COL_YELLOW,
+ COL_WHITE
+};
+
+//
+// token maps
+//
+
+// maps for SvXMLUnitConverter::convertEnum
+
+static SvXMLEnumMapEntry aStyleValueMap[] =
+{
+ { XML_SHORT, sal_False },
+ { XML_LONG, sal_True },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+static SvXMLEnumMapEntry aFormatSourceMap[] =
+{
+ { XML_FIXED, sal_False },
+ { XML_LANGUAGE, sal_True },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+//-------------------------------------------------------------------------
+
+struct SvXMLDefaultDateFormat
+{
+ NfIndexTableOffset eFormat;
+ SvXMLDateElementAttributes eDOW;
+ SvXMLDateElementAttributes eDay;
+ SvXMLDateElementAttributes eMonth;
+ SvXMLDateElementAttributes eYear;
+ SvXMLDateElementAttributes eHours;
+ SvXMLDateElementAttributes eMins;
+ SvXMLDateElementAttributes eSecs;
+ sal_Bool bSystem;
+};
+
+static SvXMLDefaultDateFormat aDefaultDateFormats[] =
+{
+ // format day-of-week day month year hours minutes seconds format-source
+
+ { NF_DATE_SYSTEM_SHORT, XML_DEA_NONE, XML_DEA_ANY, XML_DEA_ANY, XML_DEA_ANY, XML_DEA_NONE, XML_DEA_NONE, XML_DEA_NONE, sal_True },
+ { NF_DATE_SYSTEM_LONG, XML_DEA_ANY, XML_DEA_ANY, XML_DEA_ANY, XML_DEA_ANY, XML_DEA_NONE, XML_DEA_NONE, XML_DEA_NONE, sal_True },
+ { NF_DATE_SYS_MMYY, XML_DEA_NONE, XML_DEA_NONE, XML_DEA_LONG, XML_DEA_SHORT, XML_DEA_NONE, XML_DEA_NONE, XML_DEA_NONE, sal_False },
+ { NF_DATE_SYS_DDMMM, XML_DEA_NONE, XML_DEA_LONG, XML_DEA_TEXTSHORT, XML_DEA_NONE, XML_DEA_NONE, XML_DEA_NONE, XML_DEA_NONE, sal_False },
+ { NF_DATE_SYS_DDMMYYYY, XML_DEA_NONE, XML_DEA_LONG, XML_DEA_LONG, XML_DEA_LONG, XML_DEA_NONE, XML_DEA_NONE, XML_DEA_NONE, sal_False },
+ { NF_DATE_SYS_DDMMYY, XML_DEA_NONE, XML_DEA_LONG, XML_DEA_LONG, XML_DEA_SHORT, XML_DEA_NONE, XML_DEA_NONE, XML_DEA_NONE, sal_False },
+ { NF_DATE_SYS_DMMMYY, XML_DEA_NONE, XML_DEA_SHORT, XML_DEA_TEXTSHORT, XML_DEA_SHORT, XML_DEA_NONE, XML_DEA_NONE, XML_DEA_NONE, sal_False },
+ { NF_DATE_SYS_DMMMYYYY, XML_DEA_NONE, XML_DEA_SHORT, XML_DEA_TEXTSHORT, XML_DEA_LONG, XML_DEA_NONE, XML_DEA_NONE, XML_DEA_NONE, sal_False },
+ { NF_DATE_SYS_DMMMMYYYY, XML_DEA_NONE, XML_DEA_SHORT, XML_DEA_TEXTLONG, XML_DEA_LONG, XML_DEA_NONE, XML_DEA_NONE, XML_DEA_NONE, sal_False },
+ { NF_DATE_SYS_NNDMMMYY, XML_DEA_SHORT, XML_DEA_SHORT, XML_DEA_TEXTSHORT, XML_DEA_SHORT, XML_DEA_NONE, XML_DEA_NONE, XML_DEA_NONE, sal_False },
+ { NF_DATE_SYS_NNDMMMMYYYY, XML_DEA_SHORT, XML_DEA_SHORT, XML_DEA_TEXTLONG, XML_DEA_LONG, XML_DEA_NONE, XML_DEA_NONE, XML_DEA_NONE, sal_False },
+ { NF_DATE_SYS_NNNNDMMMMYYYY, XML_DEA_LONG, XML_DEA_SHORT, XML_DEA_TEXTLONG, XML_DEA_LONG, XML_DEA_NONE, XML_DEA_NONE, XML_DEA_NONE, sal_False },
+ { NF_DATETIME_SYSTEM_SHORT_HHMM, XML_DEA_NONE, XML_DEA_ANY, XML_DEA_ANY, XML_DEA_ANY, XML_DEA_ANY, XML_DEA_ANY, XML_DEA_NONE, sal_True },
+ { NF_DATETIME_SYS_DDMMYYYY_HHMMSS, XML_DEA_NONE, XML_DEA_ANY, XML_DEA_ANY, XML_DEA_ANY, XML_DEA_ANY, XML_DEA_ANY, XML_DEA_ANY, sal_False }
+};
+
+//-------------------------------------------------------------------------
+
+SV_IMPL_PTRARR( SvXMLNumFmtEntryArr, SvXMLNumFmtEntryPtr );
+SV_IMPL_OP_PTRARR_SORT( SvXMLEmbeddedElementArr, SvXMLEmbeddedElementPtr );
+
+//-------------------------------------------------------------------------
+
+//
+// SvXMLNumImpData
+//
+
+SvXMLNumImpData::SvXMLNumImpData(
+ SvNumberFormatter* pFmt,
+ const uno::Reference<lang::XMultiServiceFactory>& xServiceFactory )
+: pFormatter(pFmt),
+ pStylesElemTokenMap(NULL),
+ pStyleElemTokenMap(NULL),
+ pStyleAttrTokenMap(NULL),
+ pStyleElemAttrTokenMap(NULL),
+ pLocaleData(NULL),
+
+ mxServiceFactory(xServiceFactory)
+{
+ DBG_ASSERT( mxServiceFactory.is(), "got no service manager" );
+}
+
+SvXMLNumImpData::~SvXMLNumImpData()
+{
+ delete pStylesElemTokenMap;
+ delete pStyleElemTokenMap;
+ delete pStyleAttrTokenMap;
+ delete pStyleElemAttrTokenMap;
+ delete pLocaleData;
+}
+
+sal_uInt32 SvXMLNumImpData::GetKeyForName( const rtl::OUString& rName )
+{
+ sal_uInt16 nCount = aNameEntries.Count();
+ for (sal_uInt16 i=0; i<nCount; i++)
+ {
+ const SvXMLNumFmtEntry* pObj = aNameEntries[i];
+ if ( pObj->aName == rName )
+ return pObj->nKey; // found
+ }
+ return NUMBERFORMAT_ENTRY_NOT_FOUND;
+}
+
+void SvXMLNumImpData::AddKey( sal_uInt32 nKey, const rtl::OUString& rName, sal_Bool bRemoveAfterUse )
+{
+ if ( bRemoveAfterUse )
+ {
+ // if there is already an entry for this key without the bRemoveAfterUse flag,
+ // clear the flag for this entry, too
+
+ sal_uInt16 nCount = aNameEntries.Count();
+ for (sal_uInt16 i=0; i<nCount; i++)
+ {
+ SvXMLNumFmtEntry* pObj = aNameEntries[i];
+ if ( pObj->nKey == nKey && !pObj->bRemoveAfterUse )
+ {
+ bRemoveAfterUse = sal_False; // clear flag for new entry
+ break;
+ }
+ }
+ }
+ else
+ {
+ // call SetUsed to clear the bRemoveAfterUse flag for other entries for this key
+ SetUsed( nKey );
+ }
+
+ SvXMLNumFmtEntry* pObj = new SvXMLNumFmtEntry( rName, nKey, bRemoveAfterUse );
+ aNameEntries.Insert( pObj, aNameEntries.Count() );
+}
+
+void SvXMLNumImpData::SetUsed( sal_uInt32 nKey )
+{
+ sal_uInt16 nCount = aNameEntries.Count();
+ for (sal_uInt16 i=0; i<nCount; i++)
+ {
+ SvXMLNumFmtEntry* pObj = aNameEntries[i];
+ if ( pObj->nKey == nKey )
+ {
+ pObj->bRemoveAfterUse = sal_False; // used -> don't remove
+
+ // continue searching - there may be several entries for the same key
+ // (with different names), the format must not be deleted if any one of
+ // them is used
+ }
+ }
+}
+
+void SvXMLNumImpData::RemoveVolatileFormats()
+{
+ // remove temporary (volatile) formats from NumberFormatter
+ // called at the end of each import (styles and content), so volatile formats
+ // from styles can't be used in content
+
+ if ( !pFormatter )
+ return;
+
+ sal_uInt16 nCount = aNameEntries.Count();
+ for (sal_uInt16 i=0; i<nCount; i++)
+ {
+ const SvXMLNumFmtEntry* pObj = aNameEntries[i];
+ if ( pObj->bRemoveAfterUse )
+ {
+ const SvNumberformat* pFormat = pFormatter->GetEntry(pObj->nKey);
+ if (pFormat && (pFormat->GetType() & NUMBERFORMAT_DEFINED))
+ pFormatter->DeleteEntry( pObj->nKey );
+ }
+ }
+}
+
+const SvXMLTokenMap& SvXMLNumImpData::GetStylesElemTokenMap()
+{
+ if( !pStylesElemTokenMap )
+ {
+ static SvXMLTokenMapEntry aStylesElemMap[] =
+ {
+ // style elements
+ { XML_NAMESPACE_NUMBER, XML_NUMBER_STYLE, XML_TOK_STYLES_NUMBER_STYLE },
+ { XML_NAMESPACE_NUMBER, XML_CURRENCY_STYLE, XML_TOK_STYLES_CURRENCY_STYLE },
+ { XML_NAMESPACE_NUMBER, XML_PERCENTAGE_STYLE, XML_TOK_STYLES_PERCENTAGE_STYLE },
+ { XML_NAMESPACE_NUMBER, XML_DATE_STYLE, XML_TOK_STYLES_DATE_STYLE },
+ { XML_NAMESPACE_NUMBER, XML_TIME_STYLE, XML_TOK_STYLES_TIME_STYLE },
+ { XML_NAMESPACE_NUMBER, XML_BOOLEAN_STYLE, XML_TOK_STYLES_BOOLEAN_STYLE },
+ { XML_NAMESPACE_NUMBER, XML_TEXT_STYLE, XML_TOK_STYLES_TEXT_STYLE },
+ XML_TOKEN_MAP_END
+ };
+
+ pStylesElemTokenMap = new SvXMLTokenMap( aStylesElemMap );
+ }
+ return *pStylesElemTokenMap;
+}
+
+const SvXMLTokenMap& SvXMLNumImpData::GetStyleElemTokenMap()
+{
+ if( !pStyleElemTokenMap )
+ {
+ static SvXMLTokenMapEntry aStyleElemMap[] =
+ {
+ // elements in a style
+ { XML_NAMESPACE_NUMBER, XML_TEXT, XML_TOK_STYLE_TEXT },
+ { XML_NAMESPACE_NUMBER, XML_NUMBER, XML_TOK_STYLE_NUMBER },
+ { XML_NAMESPACE_NUMBER, XML_SCIENTIFIC_NUMBER, XML_TOK_STYLE_SCIENTIFIC_NUMBER },
+ { XML_NAMESPACE_NUMBER, XML_FRACTION, XML_TOK_STYLE_FRACTION },
+ { XML_NAMESPACE_NUMBER, XML_CURRENCY_SYMBOL, XML_TOK_STYLE_CURRENCY_SYMBOL },
+ { XML_NAMESPACE_NUMBER, XML_DAY, XML_TOK_STYLE_DAY },
+ { XML_NAMESPACE_NUMBER, XML_MONTH, XML_TOK_STYLE_MONTH },
+ { XML_NAMESPACE_NUMBER, XML_YEAR, XML_TOK_STYLE_YEAR },
+ { XML_NAMESPACE_NUMBER, XML_ERA, XML_TOK_STYLE_ERA },
+ { XML_NAMESPACE_NUMBER, XML_DAY_OF_WEEK, XML_TOK_STYLE_DAY_OF_WEEK },
+ { XML_NAMESPACE_NUMBER, XML_WEEK_OF_YEAR, XML_TOK_STYLE_WEEK_OF_YEAR },
+ { XML_NAMESPACE_NUMBER, XML_QUARTER, XML_TOK_STYLE_QUARTER },
+ { XML_NAMESPACE_NUMBER, XML_HOURS, XML_TOK_STYLE_HOURS },
+ { XML_NAMESPACE_NUMBER, XML_AM_PM, XML_TOK_STYLE_AM_PM },
+ { XML_NAMESPACE_NUMBER, XML_MINUTES, XML_TOK_STYLE_MINUTES },
+ { XML_NAMESPACE_NUMBER, XML_SECONDS, XML_TOK_STYLE_SECONDS },
+ { XML_NAMESPACE_NUMBER, XML_BOOLEAN, XML_TOK_STYLE_BOOLEAN },
+ { XML_NAMESPACE_NUMBER, XML_TEXT_CONTENT, XML_TOK_STYLE_TEXT_CONTENT },
+ { XML_NAMESPACE_STYLE, XML_TEXT_PROPERTIES, XML_TOK_STYLE_PROPERTIES },
+ { XML_NAMESPACE_STYLE, XML_MAP, XML_TOK_STYLE_MAP },
+ XML_TOKEN_MAP_END
+ };
+
+ pStyleElemTokenMap = new SvXMLTokenMap( aStyleElemMap );
+ }
+ return *pStyleElemTokenMap;
+}
+
+const SvXMLTokenMap& SvXMLNumImpData::GetStyleAttrTokenMap()
+{
+ if( !pStyleAttrTokenMap )
+ {
+ static SvXMLTokenMapEntry aStyleAttrMap[] =
+ {
+ // attributes for a style
+ { XML_NAMESPACE_STYLE, XML_NAME, XML_TOK_STYLE_ATTR_NAME },
+ { XML_NAMESPACE_NUMBER, XML_LANGUAGE, XML_TOK_STYLE_ATTR_LANGUAGE },
+ { XML_NAMESPACE_NUMBER, XML_COUNTRY, XML_TOK_STYLE_ATTR_COUNTRY },
+ { XML_NAMESPACE_NUMBER, XML_TITLE, XML_TOK_STYLE_ATTR_TITLE },
+ { XML_NAMESPACE_NUMBER, XML_AUTOMATIC_ORDER, XML_TOK_STYLE_ATTR_AUTOMATIC_ORDER },
+ { XML_NAMESPACE_NUMBER, XML_FORMAT_SOURCE, XML_TOK_STYLE_ATTR_FORMAT_SOURCE },
+ { XML_NAMESPACE_NUMBER, XML_TRUNCATE_ON_OVERFLOW, XML_TOK_STYLE_ATTR_TRUNCATE_ON_OVERFLOW },
+ { XML_NAMESPACE_STYLE, XML_VOLATILE, XML_TOK_STYLE_ATTR_VOLATILE },
+ { XML_NAMESPACE_NUMBER, XML_TRANSLITERATION_FORMAT, XML_TOK_STYLE_ATTR_TRANSL_FORMAT },
+ { XML_NAMESPACE_NUMBER, XML_TRANSLITERATION_LANGUAGE, XML_TOK_STYLE_ATTR_TRANSL_LANGUAGE },
+ { XML_NAMESPACE_NUMBER, XML_TRANSLITERATION_COUNTRY, XML_TOK_STYLE_ATTR_TRANSL_COUNTRY },
+ { XML_NAMESPACE_NUMBER, XML_TRANSLITERATION_STYLE, XML_TOK_STYLE_ATTR_TRANSL_STYLE },
+ XML_TOKEN_MAP_END
+ };
+
+ pStyleAttrTokenMap = new SvXMLTokenMap( aStyleAttrMap );
+ }
+ return *pStyleAttrTokenMap;
+}
+
+const SvXMLTokenMap& SvXMLNumImpData::GetStyleElemAttrTokenMap()
+{
+ if( !pStyleElemAttrTokenMap )
+ {
+ static SvXMLTokenMapEntry aStyleElemAttrMap[] =
+ {
+ // attributes for an element within a style
+ { XML_NAMESPACE_NUMBER, XML_DECIMAL_PLACES, XML_TOK_ELEM_ATTR_DECIMAL_PLACES },
+ { XML_NAMESPACE_NUMBER, XML_MIN_INTEGER_DIGITS, XML_TOK_ELEM_ATTR_MIN_INTEGER_DIGITS },
+ { XML_NAMESPACE_NUMBER, XML_GROUPING, XML_TOK_ELEM_ATTR_GROUPING },
+ { XML_NAMESPACE_NUMBER, XML_DISPLAY_FACTOR, XML_TOK_ELEM_ATTR_DISPLAY_FACTOR },
+ { XML_NAMESPACE_NUMBER, XML_DECIMAL_REPLACEMENT, XML_TOK_ELEM_ATTR_DECIMAL_REPLACEMENT },
+ { XML_NAMESPACE_NUMBER, XML_MIN_EXPONENT_DIGITS, XML_TOK_ELEM_ATTR_MIN_EXPONENT_DIGITS },
+ { XML_NAMESPACE_NUMBER, XML_MIN_NUMERATOR_DIGITS, XML_TOK_ELEM_ATTR_MIN_NUMERATOR_DIGITS },
+ { XML_NAMESPACE_NUMBER, XML_MIN_DENOMINATOR_DIGITS, XML_TOK_ELEM_ATTR_MIN_DENOMINATOR_DIGITS },
+ { XML_NAMESPACE_NUMBER, XML_LANGUAGE, XML_TOK_ELEM_ATTR_LANGUAGE },
+ { XML_NAMESPACE_NUMBER, XML_COUNTRY, XML_TOK_ELEM_ATTR_COUNTRY },
+ { XML_NAMESPACE_NUMBER, XML_STYLE, XML_TOK_ELEM_ATTR_STYLE },
+ { XML_NAMESPACE_NUMBER, XML_TEXTUAL, XML_TOK_ELEM_ATTR_TEXTUAL },
+ { XML_NAMESPACE_NUMBER, XML_CALENDAR, XML_TOK_ELEM_ATTR_CALENDAR },
+ XML_TOKEN_MAP_END
+ };
+
+ pStyleElemAttrTokenMap = new SvXMLTokenMap( aStyleElemAttrMap );
+ }
+ return *pStyleElemAttrTokenMap;
+}
+
+const LocaleDataWrapper& SvXMLNumImpData::GetLocaleData( LanguageType nLang )
+{
+ if ( !pLocaleData )
+ pLocaleData = new LocaleDataWrapper(
+ (pFormatter ? pFormatter->GetServiceManager() :
+ mxServiceFactory),
+ MsLangId::convertLanguageToLocale( nLang ) );
+ else
+ pLocaleData->setLocale( MsLangId::convertLanguageToLocale( nLang ) );
+ return *pLocaleData;
+}
+
+//-------------------------------------------------------------------------
+
+//
+// SvXMLNumFmtMapContext
+//
+
+SvXMLNumFmtMapContext::SvXMLNumFmtMapContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx, const rtl::OUString& rLName,
+ SvXMLNumFormatContext& rParentContext,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList ) :
+ SvXMLImportContext( rImport, nPrfx, rLName ),
+ rParent( rParentContext )
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString sValue = xAttrList->getValueByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = rImport.GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ if ( nPrefix == XML_NAMESPACE_STYLE )
+ {
+ if ( IsXMLToken( aLocalName, XML_CONDITION) )
+ sCondition = sValue;
+ else if ( IsXMLToken( aLocalName, XML_APPLY_STYLE_NAME) )
+ sName = sValue;
+ }
+ }
+}
+
+SvXMLNumFmtMapContext::~SvXMLNumFmtMapContext()
+{
+}
+
+SvXMLImportContext* SvXMLNumFmtMapContext::CreateChildContext(
+ sal_uInt16 nPrfx, const rtl::OUString& rLName,
+ const uno::Reference<xml::sax::XAttributeList>& )
+{
+ // no elements supported - use default context
+ return new SvXMLImportContext( GetImport(), nPrfx, rLName );
+}
+
+void SvXMLNumFmtMapContext::Characters( const rtl::OUString& )
+{
+}
+
+void SvXMLNumFmtMapContext::EndElement()
+{
+ rParent.AddCondition( sCondition, sName );
+}
+
+//-------------------------------------------------------------------------
+
+//
+// SvXMLNumFmtPropContext
+//
+
+SvXMLNumFmtPropContext::SvXMLNumFmtPropContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx, const rtl::OUString& rLName,
+ SvXMLNumFormatContext& rParentContext,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList ) :
+ SvXMLImportContext( rImport, nPrfx, rLName ),
+ rParent( rParentContext ),
+ bColSet( sal_False )
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString sValue = xAttrList->getValueByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = rImport.GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ if ( nPrefix == XML_NAMESPACE_FO && IsXMLToken( aLocalName, XML_COLOR ) )
+ bColSet = SvXMLUnitConverter::convertColor( aColor, sValue );
+ }
+}
+
+SvXMLNumFmtPropContext::~SvXMLNumFmtPropContext()
+{
+}
+
+SvXMLImportContext* SvXMLNumFmtPropContext::CreateChildContext(
+ sal_uInt16 nPrfx, const rtl::OUString& rLName,
+ const uno::Reference<xml::sax::XAttributeList>& )
+{
+ // no elements supported - use default context
+ return new SvXMLImportContext( GetImport(), nPrfx, rLName );
+}
+
+void SvXMLNumFmtPropContext::Characters( const rtl::OUString& )
+{
+}
+
+void SvXMLNumFmtPropContext::EndElement()
+{
+ if (bColSet)
+ rParent.AddColor( aColor );
+}
+
+//-------------------------------------------------------------------------
+
+//
+// SvXMLNumFmtEmbeddedTextContext
+//
+
+SvXMLNumFmtEmbeddedTextContext::SvXMLNumFmtEmbeddedTextContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx, const rtl::OUString& rLName,
+ SvXMLNumFmtElementContext& rParentContext,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList ) :
+ SvXMLImportContext( rImport, nPrfx, rLName ),
+ rParent( rParentContext ),
+ nTextPosition( 0 )
+{
+ sal_Int32 nAttrVal;
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString sValue = xAttrList->getValueByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = rImport.GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ if ( nPrefix == XML_NAMESPACE_NUMBER && IsXMLToken( aLocalName, XML_POSITION ) )
+ {
+ if ( SvXMLUnitConverter::convertNumber( nAttrVal, sValue, 0 ) )
+ nTextPosition = nAttrVal;
+ }
+ }
+}
+
+SvXMLNumFmtEmbeddedTextContext::~SvXMLNumFmtEmbeddedTextContext()
+{
+}
+
+SvXMLImportContext* SvXMLNumFmtEmbeddedTextContext::CreateChildContext(
+ sal_uInt16 nPrfx, const rtl::OUString& rLName,
+ const uno::Reference<xml::sax::XAttributeList>& )
+{
+ // no elements supported - use default context
+ return new SvXMLImportContext( GetImport(), nPrfx, rLName );
+}
+
+void SvXMLNumFmtEmbeddedTextContext::Characters( const rtl::OUString& rChars )
+{
+ aContent.append( rChars );
+}
+
+void SvXMLNumFmtEmbeddedTextContext::EndElement()
+{
+ rParent.AddEmbeddedElement( nTextPosition, aContent.makeStringAndClear() );
+}
+
+//-------------------------------------------------------------------------
+
+sal_Bool lcl_ValidChar( sal_Unicode cChar, const SvXMLNumFormatContext& rParent )
+{
+ sal_uInt16 nFormatType = rParent.GetType();
+
+ // Treat space equal to non-breaking space separator.
+ const sal_Unicode cNBSP = 0x00A0;
+ sal_Unicode cTS;
+ if ( ( nFormatType == XML_TOK_STYLES_NUMBER_STYLE ||
+ nFormatType == XML_TOK_STYLES_CURRENCY_STYLE ||
+ nFormatType == XML_TOK_STYLES_PERCENTAGE_STYLE ) &&
+ (cChar == (cTS = rParent.GetLocaleData().getNumThousandSep().GetChar(0)) ||
+ (cChar == ' ' && cTS == cNBSP)) )
+ {
+ // #i22394# Extra occurrences of thousands separator must be quoted, so they
+ // aren't mis-interpreted as display-factor.
+ // This must be limited to the format types that can contain a number element,
+ // because the same character can be a date separator that should not be quoted
+ // in date formats.
+
+ return sal_False; // force quotes
+ }
+
+ // see ImpSvNumberformatScan::Next_Symbol
+ if ( cChar == ' ' ||
+ cChar == '-' ||
+ cChar == '/' ||
+ cChar == '.' ||
+ cChar == ',' ||
+ cChar == ':' ||
+ cChar == '\'' )
+ return sal_True; // for all format types
+
+ // percent sign must be used without quotes for percentage styles only
+ if ( nFormatType == XML_TOK_STYLES_PERCENTAGE_STYLE && cChar == '%' )
+ return sal_True;
+
+ // don't put quotes around single parentheses (often used for negative numbers)
+ if ( ( nFormatType == XML_TOK_STYLES_NUMBER_STYLE ||
+ nFormatType == XML_TOK_STYLES_CURRENCY_STYLE ||
+ nFormatType == XML_TOK_STYLES_PERCENTAGE_STYLE ) &&
+ ( cChar == '(' || cChar == ')' ) )
+ return sal_True;
+
+ return sal_False;
+}
+
+void lcl_EnquoteIfNecessary( rtl::OUStringBuffer& rContent, const SvXMLNumFormatContext& rParent )
+{
+ sal_Bool bQuote = sal_True;
+ sal_Int32 nLength = rContent.getLength();
+
+ if ( ( nLength == 1 &&
+ lcl_ValidChar( rContent.charAt(0), rParent ) ) ||
+ ( nLength == 2 &&
+ lcl_ValidChar( rContent.charAt(0), rParent ) &&
+ rContent.charAt(1) == ' ' ) )
+ {
+ // don't quote single separator characters like space or percent,
+ // or separator characters followed by space (used in date formats)
+ bQuote = sal_False;
+ }
+ else if ( rParent.GetType() == XML_TOK_STYLES_PERCENTAGE_STYLE && nLength > 1 )
+ {
+ // the percent character in percentage styles must be left out of quoting
+ // (one occurrence is enough even if there are several percent characters in the string)
+
+ rtl::OUString aString( rContent.getStr() );
+ sal_Int32 nPos = aString.indexOf( (sal_Unicode) '%' );
+ if ( nPos >= 0 )
+ {
+ if ( nPos + 1 < nLength )
+ {
+ if ( nPos + 2 == nLength && lcl_ValidChar( rContent.charAt(nPos + 1), rParent ) )
+ {
+ // single character that doesn't need quoting
+ }
+ else
+ {
+ // quote text behind percent character
+ rContent.insert( nPos + 1, (sal_Unicode) '"' );
+ rContent.append( (sal_Unicode) '"' );
+ }
+ }
+ if ( nPos > 0 )
+ {
+ if ( nPos == 1 && lcl_ValidChar( rContent.charAt(0), rParent ) )
+ {
+ // single character that doesn't need quoting
+ }
+ else
+ {
+ // quote text before percent character
+ rContent.insert( nPos, (sal_Unicode) '"' );
+ rContent.insert( 0, (sal_Unicode) '"' );
+ }
+ }
+ bQuote = sal_False;
+ }
+ // else: normal quoting (below)
+ }
+
+ if ( bQuote )
+ {
+ // #i55469# quotes in the string itself have to be escaped
+ rtl::OUString aString( rContent.getStr() );
+ bool bEscape = ( aString.indexOf( (sal_Unicode) '"' ) >= 0 );
+ if ( bEscape )
+ {
+ // A quote is turned into "\"" - a quote to end quoted text, an escaped quote,
+ // and a quote to resume quoting.
+ rtl::OUString aInsert( RTL_CONSTASCII_USTRINGPARAM( "\"\\\"" ) );
+
+ sal_Int32 nPos = 0;
+ while ( nPos < rContent.getLength() )
+ {
+ if ( rContent.charAt( nPos ) == (sal_Unicode) '"' )
+ {
+ rContent.insert( nPos, aInsert );
+ nPos += aInsert.getLength();
+ }
+ ++nPos;
+ }
+ }
+
+ // quote string literals
+ rContent.insert( 0, (sal_Unicode) '"' );
+ rContent.append( (sal_Unicode) '"' );
+
+ // remove redundant double quotes at start or end
+ if ( bEscape )
+ {
+ if ( rContent.getLength() > 2 &&
+ rContent.charAt(0) == (sal_Unicode) '"' &&
+ rContent.charAt(1) == (sal_Unicode) '"' )
+ {
+ String aTrimmed( rContent.makeStringAndClear().copy(2) );
+ rContent = rtl::OUStringBuffer( aTrimmed );
+ }
+
+ sal_Int32 nLen = rContent.getLength();
+ if ( nLen > 2 &&
+ rContent.charAt(nLen-1) == (sal_Unicode) '"' &&
+ rContent.charAt(nLen-2) == (sal_Unicode) '"' )
+ {
+ String aTrimmed( rContent.makeStringAndClear().copy( 0, nLen - 2 ) );
+ rContent = rtl::OUStringBuffer( aTrimmed );
+ }
+ }
+ }
+}
+
+//
+// SvXMLNumFmtElementContext
+//
+
+SvXMLNumFmtElementContext::SvXMLNumFmtElementContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx, const rtl::OUString& rLName,
+ SvXMLNumFormatContext& rParentContext, sal_uInt16 nNewType,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList ) :
+ SvXMLImportContext( rImport, nPrfx, rLName ),
+ rParent( rParentContext ),
+ nType( nNewType ),
+ nElementLang( LANGUAGE_SYSTEM ),
+ bLong( sal_False ),
+ bTextual( sal_False )
+{
+ OUString sLanguage, sCountry;
+ sal_Int32 nAttrVal;
+ bool bAttrBool;
+ sal_uInt16 nAttrEnum;
+ double fAttrDouble;
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString sValue = xAttrList->getValueByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = rImport.GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+
+ const SvXMLTokenMap& rTokenMap = rParent.GetData()->GetStyleElemAttrTokenMap();
+ sal_uInt16 nToken = rTokenMap.Get( nPrefix, aLocalName );
+
+ switch (nToken)
+ {
+ case XML_TOK_ELEM_ATTR_DECIMAL_PLACES:
+ if ( SvXMLUnitConverter::convertNumber( nAttrVal, sValue, 0 ) )
+ aNumInfo.nDecimals = nAttrVal;
+ break;
+ case XML_TOK_ELEM_ATTR_MIN_INTEGER_DIGITS:
+ if ( SvXMLUnitConverter::convertNumber( nAttrVal, sValue, 0 ) )
+ aNumInfo.nInteger = nAttrVal;
+ break;
+ case XML_TOK_ELEM_ATTR_GROUPING:
+ if ( SvXMLUnitConverter::convertBool( bAttrBool, sValue ) )
+ aNumInfo.bGrouping = bAttrBool;
+ break;
+ case XML_TOK_ELEM_ATTR_DISPLAY_FACTOR:
+ if ( SvXMLUnitConverter::convertDouble( fAttrDouble, sValue ) )
+ aNumInfo.fDisplayFactor = fAttrDouble;
+ break;
+ case XML_TOK_ELEM_ATTR_DECIMAL_REPLACEMENT:
+ if ( sValue.getLength() > 0 )
+ aNumInfo.bDecReplace = sal_True; // only a default string is supported
+ else
+ aNumInfo.bVarDecimals = sal_True; // empty replacement string: variable decimals
+ break;
+ case XML_TOK_ELEM_ATTR_MIN_EXPONENT_DIGITS:
+ if ( SvXMLUnitConverter::convertNumber( nAttrVal, sValue, 0 ) )
+ aNumInfo.nExpDigits = nAttrVal;
+ break;
+ case XML_TOK_ELEM_ATTR_MIN_NUMERATOR_DIGITS:
+ if ( SvXMLUnitConverter::convertNumber( nAttrVal, sValue, 0 ) )
+ aNumInfo.nNumerDigits = nAttrVal;
+ break;
+ case XML_TOK_ELEM_ATTR_MIN_DENOMINATOR_DIGITS:
+ if ( SvXMLUnitConverter::convertNumber( nAttrVal, sValue, 0 ) )
+ aNumInfo.nDenomDigits = nAttrVal;
+ break;
+ case XML_TOK_ELEM_ATTR_LANGUAGE:
+ sLanguage = sValue;
+ break;
+ case XML_TOK_ELEM_ATTR_COUNTRY:
+ sCountry = sValue;
+ break;
+ case XML_TOK_ELEM_ATTR_STYLE:
+ if ( SvXMLUnitConverter::convertEnum( nAttrEnum, sValue, aStyleValueMap ) )
+ bLong = (sal_Bool) nAttrEnum;
+ break;
+ case XML_TOK_ELEM_ATTR_TEXTUAL:
+ if ( SvXMLUnitConverter::convertBool( bAttrBool, sValue ) )
+ bTextual = bAttrBool;
+ break;
+ case XML_TOK_ELEM_ATTR_CALENDAR:
+ sCalendar = sValue;
+ break;
+ }
+ }
+
+ if ( sLanguage.getLength() || sCountry.getLength() )
+ {
+ nElementLang = MsLangId::convertIsoNamesToLanguage( sLanguage, sCountry );
+ if ( nElementLang == LANGUAGE_DONTKNOW )
+ nElementLang = LANGUAGE_SYSTEM; //! error handling for invalid locales?
+ }
+}
+
+SvXMLNumFmtElementContext::~SvXMLNumFmtElementContext()
+{
+}
+
+SvXMLImportContext* SvXMLNumFmtElementContext::CreateChildContext(
+ sal_uInt16 nPrfx, const rtl::OUString& rLName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList )
+{
+ // only number:number supports number:embedded-text child element
+
+ if ( nType == XML_TOK_STYLE_NUMBER &&
+ nPrfx == XML_NAMESPACE_NUMBER && IsXMLToken( rLName, XML_EMBEDDED_TEXT ) )
+ {
+ return new SvXMLNumFmtEmbeddedTextContext( GetImport(), nPrfx, rLName, *this, xAttrList );
+ }
+ else
+ return new SvXMLImportContext( GetImport(), nPrfx, rLName );
+}
+
+void SvXMLNumFmtElementContext::Characters( const rtl::OUString& rChars )
+{
+ aContent.append( rChars );
+}
+
+void SvXMLNumFmtElementContext::AddEmbeddedElement( sal_Int32 nFormatPos, const rtl::OUString& rContent )
+{
+ if ( rContent.getLength() )
+ {
+ SvXMLEmbeddedElement* pObj = new SvXMLEmbeddedElement( nFormatPos, rContent );
+ if ( !aNumInfo.aEmbeddedElements.Insert( pObj ) )
+ {
+ // there's already an element at this position - append text to existing element
+
+ delete pObj;
+ sal_uInt16 nElementCount = aNumInfo.aEmbeddedElements.Count();
+ for (sal_uInt16 i=0; i<nElementCount; i++)
+ {
+ pObj = aNumInfo.aEmbeddedElements[i];
+ if ( pObj->nFormatPos == nFormatPos )
+ {
+ pObj->aText += rContent;
+ break;
+ }
+ }
+ }
+ }
+}
+
+void SvXMLNumFmtElementContext::EndElement()
+{
+ sal_Bool bEffLong = bLong;
+ switch (nType)
+ {
+ case XML_TOK_STYLE_TEXT:
+ if ( rParent.HasLongDoW() &&
+ rParent.GetLocaleData().getLongDateDayOfWeekSep() ==
+ String( aContent.getStr() ) )
+ {
+ // skip separator constant after long day of week
+ // (NF_KEY_NNNN contains the separator)
+
+ if ( rParent.ReplaceNfKeyword( NF_KEY_NNN, NF_KEY_NNNN ) )
+ {
+ aContent = OUStringBuffer();
+ }
+
+ rParent.SetHasLongDoW( sal_False ); // only once
+ }
+ if ( aContent.getLength() )
+ {
+ lcl_EnquoteIfNecessary( aContent, rParent );
+ rParent.AddToCode( aContent.makeStringAndClear() );
+ }
+ break;
+
+ case XML_TOK_STYLE_NUMBER:
+ rParent.AddNumber( aNumInfo );
+ break;
+
+ case XML_TOK_STYLE_CURRENCY_SYMBOL:
+ rParent.AddCurrency( aContent.makeStringAndClear(), nElementLang );
+ break;
+
+ case XML_TOK_STYLE_TEXT_CONTENT:
+ rParent.AddToCode( OUString::valueOf((sal_Unicode)'@') );
+ break;
+ case XML_TOK_STYLE_BOOLEAN:
+ // ignored - only default boolean format is supported
+ break;
+
+ case XML_TOK_STYLE_DAY:
+ rParent.UpdateCalendar( sCalendar );
+//! I18N doesn't provide SYSTEM or extended date information yet
+
+ rParent.AddNfKeyword(
+ sal::static_int_cast< sal_uInt16 >(
+ bEffLong ? NF_KEY_DD : NF_KEY_D ) );
+ break;
+ case XML_TOK_STYLE_MONTH:
+ rParent.UpdateCalendar( sCalendar );
+//! I18N doesn't provide SYSTEM or extended date information yet
+
+ rParent.AddNfKeyword(
+ sal::static_int_cast< sal_uInt16 >(
+ bTextual
+ ? ( bEffLong ? NF_KEY_MMMM : NF_KEY_MMM )
+ : ( bEffLong ? NF_KEY_MM : NF_KEY_M ) ) );
+ break;
+ case XML_TOK_STYLE_YEAR:
+ rParent.UpdateCalendar( sCalendar );
+//! I18N doesn't provide SYSTEM or extended date information yet
+ // Y after G (era) is replaced by E
+ if ( rParent.HasEra() )
+ rParent.AddNfKeyword(
+ sal::static_int_cast< sal_uInt16 >(
+ bEffLong ? NF_KEY_EEC : NF_KEY_EC ) );
+ else
+ rParent.AddNfKeyword(
+ sal::static_int_cast< sal_uInt16 >(
+ bEffLong ? NF_KEY_YYYY : NF_KEY_YY ) );
+ break;
+ case XML_TOK_STYLE_ERA:
+ rParent.UpdateCalendar( sCalendar );
+//! I18N doesn't provide SYSTEM or extended date information yet
+ rParent.AddNfKeyword(
+ sal::static_int_cast< sal_uInt16 >(
+ bEffLong ? NF_KEY_GGG : NF_KEY_G ) );
+ // HasEra flag is set
+ break;
+ case XML_TOK_STYLE_DAY_OF_WEEK:
+ rParent.UpdateCalendar( sCalendar );
+//! I18N doesn't provide SYSTEM or extended date information yet
+ rParent.AddNfKeyword(
+ sal::static_int_cast< sal_uInt16 >(
+ bEffLong ? NF_KEY_NNNN : NF_KEY_NN ) );
+ break;
+ case XML_TOK_STYLE_WEEK_OF_YEAR:
+ rParent.UpdateCalendar( sCalendar );
+ rParent.AddNfKeyword( NF_KEY_WW );
+ break;
+ case XML_TOK_STYLE_QUARTER:
+ rParent.UpdateCalendar( sCalendar );
+ rParent.AddNfKeyword(
+ sal::static_int_cast< sal_uInt16 >(
+ bEffLong ? NF_KEY_QQ : NF_KEY_Q ) );
+ break;
+ case XML_TOK_STYLE_HOURS:
+ rParent.AddNfKeyword(
+ sal::static_int_cast< sal_uInt16 >(
+ bEffLong ? NF_KEY_HH : NF_KEY_H ) );
+ break;
+ case XML_TOK_STYLE_AM_PM:
+ //! short/long?
+ rParent.AddNfKeyword( NF_KEY_AMPM );
+ break;
+ case XML_TOK_STYLE_MINUTES:
+ rParent.AddNfKeyword(
+ sal::static_int_cast< sal_uInt16 >(
+ bEffLong ? NF_KEY_MMI : NF_KEY_MI ) );
+ break;
+ case XML_TOK_STYLE_SECONDS:
+ rParent.AddNfKeyword(
+ sal::static_int_cast< sal_uInt16 >(
+ bEffLong ? NF_KEY_SS : NF_KEY_S ) );
+ if ( aNumInfo.nDecimals > 0 )
+ {
+ // manually add the decimal places
+ const String& rSep = rParent.GetLocaleData().getNumDecimalSep();
+ for ( xub_StrLen j=0; j<rSep.Len(); j++ )
+ {
+ rParent.AddToCode( OUString::valueOf( rSep.GetChar(j) ) );
+ }
+ for (sal_Int32 i=0; i<aNumInfo.nDecimals; i++)
+ rParent.AddToCode( OUString::valueOf((sal_Unicode)'0') );
+ }
+ break;
+
+ case XML_TOK_STYLE_FRACTION:
+ {
+ if ( aNumInfo.nInteger >= 0 )
+ {
+ // add integer part only if min-integer-digits attribute is there
+ aNumInfo.nDecimals = 0;
+ rParent.AddNumber( aNumInfo ); // number without decimals
+ rParent.AddToCode( OUString::valueOf((sal_Unicode)' ') );
+ }
+
+ //! build string and add at once
+
+ sal_Int32 i;
+ for (i=0; i<aNumInfo.nNumerDigits; i++)
+ rParent.AddToCode( OUString::valueOf((sal_Unicode)'?') );
+ rParent.AddToCode( OUString::valueOf((sal_Unicode)'/') );
+ for (i=0; i<aNumInfo.nDenomDigits; i++)
+ rParent.AddToCode( OUString::valueOf((sal_Unicode)'?') );
+ }
+ break;
+
+ case XML_TOK_STYLE_SCIENTIFIC_NUMBER:
+ {
+ rParent.AddNumber( aNumInfo ); // simple number
+
+ rParent.AddToCode( OUString(RTL_CONSTASCII_USTRINGPARAM("E+")) );
+ for (sal_Int32 i=0; i<aNumInfo.nExpDigits; i++)
+ rParent.AddToCode( OUString::valueOf((sal_Unicode)'0') );
+ }
+ break;
+
+ default:
+ OSL_FAIL("invalid element ID");
+ }
+}
+
+//-------------------------------------------------------------------------
+
+sal_uInt16 SvXMLNumFmtDefaults::GetDefaultDateFormat( SvXMLDateElementAttributes eDOW,
+ SvXMLDateElementAttributes eDay, SvXMLDateElementAttributes eMonth,
+ SvXMLDateElementAttributes eYear, SvXMLDateElementAttributes eHours,
+ SvXMLDateElementAttributes eMins, SvXMLDateElementAttributes eSecs,
+ sal_Bool bSystem )
+{
+ const sal_uInt16 nCount = sizeof(aDefaultDateFormats) / sizeof(SvXMLDefaultDateFormat);
+ for (sal_uInt16 nPos=0; nPos<nCount; nPos++)
+ {
+ const SvXMLDefaultDateFormat& rEntry = aDefaultDateFormats[nPos];
+ if ( bSystem == rEntry.bSystem &&
+ ( eDOW == rEntry.eDOW || ( rEntry.eDOW == XML_DEA_ANY && eDOW != XML_DEA_NONE ) ) &&
+ ( eDay == rEntry.eDay || ( rEntry.eDay == XML_DEA_ANY && eDay != XML_DEA_NONE ) ) &&
+ ( eMonth == rEntry.eMonth || ( rEntry.eMonth == XML_DEA_ANY && eMonth != XML_DEA_NONE ) ) &&
+ ( eYear == rEntry.eYear || ( rEntry.eYear == XML_DEA_ANY && eYear != XML_DEA_NONE ) ) &&
+ ( eHours == rEntry.eHours || ( rEntry.eHours == XML_DEA_ANY && eHours != XML_DEA_NONE ) ) &&
+ ( eMins == rEntry.eMins || ( rEntry.eMins == XML_DEA_ANY && eMins != XML_DEA_NONE ) ) &&
+ ( eSecs == rEntry.eSecs || ( rEntry.eSecs == XML_DEA_ANY && eSecs != XML_DEA_NONE ) ) )
+ {
+ return sal::static_int_cast< sal_uInt16 >(rEntry.eFormat);
+ }
+ }
+
+ return NF_INDEX_TABLE_ENTRIES; // invalid
+}
+
+//-------------------------------------------------------------------------
+
+//
+// SvXMLNumFormatContext
+//
+
+SvXMLNumFormatContext::SvXMLNumFormatContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx, const rtl::OUString& rLName,
+ SvXMLNumImpData* pNewData, sal_uInt16 nNewType,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList,
+ SvXMLStylesContext& rStyles ) :
+ SvXMLStyleContext( rImport, nPrfx, rLName, xAttrList ),
+ pData( pNewData ),
+ pStyles( &rStyles ),
+ aMyConditions(),
+ nType( nNewType ),
+ nKey(-1),
+ nFormatLang( LANGUAGE_SYSTEM ),
+ bAutoOrder( sal_False ),
+ bFromSystem( sal_False ),
+ bTruncate( sal_True ),
+ bAutoDec( sal_False ),
+ bAutoInt( sal_False ),
+ bHasExtraText( sal_False ),
+ bHasLongDoW( sal_False ),
+ bHasEra( sal_False ),
+ bHasDateTime( sal_False ),
+ bRemoveAfterUse( sal_False ),
+ eDateDOW( XML_DEA_NONE ),
+ eDateDay( XML_DEA_NONE ),
+ eDateMonth( XML_DEA_NONE ),
+ eDateYear( XML_DEA_NONE ),
+ eDateHours( XML_DEA_NONE ),
+ eDateMins( XML_DEA_NONE ),
+ eDateSecs( XML_DEA_NONE ),
+ bDateNoDefault( sal_False )
+{
+ OUString sLanguage, sCountry;
+ ::com::sun::star::i18n::NativeNumberXmlAttributes aNatNumAttr;
+ bool bAttrBool;
+ sal_uInt16 nAttrEnum;
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString sValue = xAttrList->getValueByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = rImport.GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+
+ const SvXMLTokenMap& rTokenMap = pData->GetStyleAttrTokenMap();
+ sal_uInt16 nToken = rTokenMap.Get( nPrefix, aLocalName );
+ switch (nToken)
+ {
+ case XML_TOK_STYLE_ATTR_NAME:
+ break;
+ case XML_TOK_STYLE_ATTR_LANGUAGE:
+ sLanguage = sValue;
+ break;
+ case XML_TOK_STYLE_ATTR_COUNTRY:
+ sCountry = sValue;
+ break;
+ case XML_TOK_STYLE_ATTR_TITLE:
+ sFormatTitle = sValue;
+ break;
+ case XML_TOK_STYLE_ATTR_AUTOMATIC_ORDER:
+ if ( SvXMLUnitConverter::convertBool( bAttrBool, sValue ) )
+ bAutoOrder = bAttrBool;
+ break;
+ case XML_TOK_STYLE_ATTR_FORMAT_SOURCE:
+ if ( SvXMLUnitConverter::convertEnum( nAttrEnum, sValue, aFormatSourceMap ) )
+ bFromSystem = (sal_Bool) nAttrEnum;
+ break;
+ case XML_TOK_STYLE_ATTR_TRUNCATE_ON_OVERFLOW:
+ if ( SvXMLUnitConverter::convertBool( bAttrBool, sValue ) )
+ bTruncate = bAttrBool;
+ break;
+ case XML_TOK_STYLE_ATTR_VOLATILE:
+ // volatile formats can be removed after importing
+ // if not used in other styles
+ if ( SvXMLUnitConverter::convertBool( bAttrBool, sValue ) )
+ bRemoveAfterUse = bAttrBool;
+ break;
+ case XML_TOK_STYLE_ATTR_TRANSL_FORMAT:
+ aNatNumAttr.Format = sValue;
+ break;
+ case XML_TOK_STYLE_ATTR_TRANSL_LANGUAGE:
+ aNatNumAttr.Locale.Language = sValue;
+ break;
+ case XML_TOK_STYLE_ATTR_TRANSL_COUNTRY:
+ aNatNumAttr.Locale.Country = sValue;
+ break;
+ case XML_TOK_STYLE_ATTR_TRANSL_STYLE:
+ aNatNumAttr.Style = sValue;
+ break;
+ }
+ }
+
+ if ( sLanguage.getLength() || sCountry.getLength() )
+ {
+ nFormatLang = MsLangId::convertIsoNamesToLanguage( sLanguage, sCountry );
+ if ( nFormatLang == LANGUAGE_DONTKNOW )
+ nFormatLang = LANGUAGE_SYSTEM; //! error handling for invalid locales?
+ }
+
+ if ( aNatNumAttr.Format.getLength() )
+ {
+ SvNumberFormatter* pFormatter = pData->GetNumberFormatter();
+ if ( pFormatter )
+ {
+ sal_Int32 nNatNum = pFormatter->GetNatNum()->convertFromXmlAttributes( aNatNumAttr );
+ aFormatCode.appendAscii( RTL_CONSTASCII_STRINGPARAM( "[NatNum" ) );
+ aFormatCode.append( nNatNum, 10 );
+
+ LanguageType eLang = MsLangId::convertLocaleToLanguage( aNatNumAttr.Locale );
+ if ( eLang == LANGUAGE_DONTKNOW )
+ eLang = LANGUAGE_SYSTEM; //! error handling for invalid locales?
+ if ( eLang != nFormatLang && eLang != LANGUAGE_SYSTEM )
+ {
+ aFormatCode.appendAscii( RTL_CONSTASCII_STRINGPARAM( "][$-" ) );
+ // language code in upper hex:
+ aFormatCode.append( String::CreateFromInt32( sal_Int32( eLang ), 16 ).ToUpperAscii() );
+ }
+ aFormatCode.append( sal_Unicode(']') );
+ }
+ }
+}
+
+SvXMLNumFormatContext::SvXMLNumFormatContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx, const rtl::OUString& rLName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList,
+ const sal_Int32 nTempKey,
+ SvXMLStylesContext& rStyles ) :
+ SvXMLStyleContext( rImport, nPrfx, rLName, xAttrList, XML_STYLE_FAMILY_DATA_STYLE ),
+ pData( NULL ),
+ pStyles( &rStyles ),
+ aMyConditions(),
+ nType( 0 ),
+ nKey(nTempKey),
+ nFormatLang( LANGUAGE_SYSTEM ),
+ bAutoOrder( sal_False ),
+ bFromSystem( sal_False ),
+ bTruncate( sal_True ),
+ bAutoDec( sal_False ),
+ bAutoInt( sal_False ),
+ bHasExtraText( sal_False ),
+ bHasLongDoW( sal_False ),
+ bHasEra( sal_False ),
+ bHasDateTime( sal_False ),
+ bRemoveAfterUse( sal_False ),
+ eDateDOW( XML_DEA_NONE ),
+ eDateDay( XML_DEA_NONE ),
+ eDateMonth( XML_DEA_NONE ),
+ eDateYear( XML_DEA_NONE ),
+ eDateHours( XML_DEA_NONE ),
+ eDateMins( XML_DEA_NONE ),
+ eDateSecs( XML_DEA_NONE ),
+ bDateNoDefault( sal_False )
+{
+ SetAttribute(XML_NAMESPACE_STYLE, GetXMLToken(XML_NAME), rLName);
+}
+
+SvXMLNumFormatContext::~SvXMLNumFormatContext()
+{
+}
+
+SvXMLImportContext* SvXMLNumFormatContext::CreateChildContext(
+ sal_uInt16 nPrfx, const rtl::OUString& rLName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList )
+{
+ SvXMLImportContext* pContext = NULL;
+
+ const SvXMLTokenMap& rTokenMap = pData->GetStyleElemTokenMap();
+ sal_uInt16 nToken = rTokenMap.Get( nPrfx, rLName );
+ switch (nToken)
+ {
+ case XML_TOK_STYLE_TEXT:
+ case XML_TOK_STYLE_NUMBER:
+ case XML_TOK_STYLE_SCIENTIFIC_NUMBER:
+ case XML_TOK_STYLE_FRACTION:
+ case XML_TOK_STYLE_CURRENCY_SYMBOL:
+ case XML_TOK_STYLE_DAY:
+ case XML_TOK_STYLE_MONTH:
+ case XML_TOK_STYLE_YEAR:
+ case XML_TOK_STYLE_ERA:
+ case XML_TOK_STYLE_DAY_OF_WEEK:
+ case XML_TOK_STYLE_WEEK_OF_YEAR:
+ case XML_TOK_STYLE_QUARTER:
+ case XML_TOK_STYLE_HOURS:
+ case XML_TOK_STYLE_AM_PM:
+ case XML_TOK_STYLE_MINUTES:
+ case XML_TOK_STYLE_SECONDS:
+ case XML_TOK_STYLE_BOOLEAN:
+ case XML_TOK_STYLE_TEXT_CONTENT:
+ pContext = new SvXMLNumFmtElementContext( GetImport(), nPrfx, rLName,
+ *this, nToken, xAttrList );
+ break;
+
+ case XML_TOK_STYLE_PROPERTIES:
+ pContext = new SvXMLNumFmtPropContext( GetImport(), nPrfx, rLName,
+ *this, xAttrList );
+ break;
+ case XML_TOK_STYLE_MAP:
+ {
+ // SvXMLNumFmtMapContext::EndElement adds to aMyConditions,
+ // so there's no need for an extra flag
+ pContext = new SvXMLNumFmtMapContext( GetImport(), nPrfx, rLName,
+ *this, xAttrList );
+ }
+ break;
+ }
+
+ if( !pContext )
+ pContext = new SvXMLImportContext( GetImport(), nPrfx, rLName );
+ return pContext;
+}
+
+sal_Int32 SvXMLNumFormatContext::GetKey()
+{
+ if (nKey > -1)
+ {
+ if (bRemoveAfterUse)
+ {
+ // format is used -> don't remove
+ bRemoveAfterUse = sal_False;
+ if (pData)
+ pData->SetUsed(nKey);
+
+ // Add to import's list of keys now - CreateAndInsert didn't add
+ // the style if bRemoveAfterUse was set.
+ GetImport().AddNumberStyle( nKey, GetName() );
+ }
+ return nKey;
+ }
+ else
+ {
+ // reset bRemoveAfterUse before CreateAndInsert, so AddKey is called without bRemoveAfterUse set
+ bRemoveAfterUse = sal_False;
+ CreateAndInsert(sal_True);
+ return nKey;
+ }
+}
+
+sal_Int32 SvXMLNumFormatContext::PrivateGetKey()
+{
+ // used for map elements in CreateAndInsert - don't reset bRemoveAfterUse flag
+
+ if (nKey > -1)
+ return nKey;
+ else
+ {
+ CreateAndInsert(sal_True);
+ return nKey;
+ }
+}
+
+sal_Int32 SvXMLNumFormatContext::CreateAndInsert( com::sun::star::uno::Reference< com::sun::star::util::XNumberFormatsSupplier >& xFormatsSupplier )
+{
+ if (nKey <= -1)
+ {
+ SvNumberFormatter* pFormatter = NULL;
+ SvNumberFormatsSupplierObj* pObj =
+ SvNumberFormatsSupplierObj::getImplementation( xFormatsSupplier );
+ if (pObj)
+ pFormatter = pObj->GetNumberFormatter();
+
+ if ( pFormatter )
+ return CreateAndInsert( pFormatter );
+ else
+ return -1;
+ }
+ else
+ return nKey;
+}
+
+void SvXMLNumFormatContext::CreateAndInsert(sal_Bool /*bOverwrite*/)
+{
+ if (!(nKey > -1))
+ CreateAndInsert(pData->GetNumberFormatter());
+}
+
+sal_Int32 SvXMLNumFormatContext::CreateAndInsert(SvNumberFormatter* pFormatter)
+{
+ if (!pFormatter)
+ {
+ OSL_FAIL("no number formatter");
+ return -1;
+ }
+
+ sal_uInt32 nIndex = NUMBERFORMAT_ENTRY_NOT_FOUND;
+
+ for (sal_uInt32 i = 0; i < aMyConditions.size(); i++)
+ {
+ SvXMLNumFormatContext* pStyle = (SvXMLNumFormatContext *)pStyles->FindStyleChildContext(
+ XML_STYLE_FAMILY_DATA_STYLE, aMyConditions[i].sMapName, sal_False);
+ if (pStyle)
+ {
+ if ((pStyle->PrivateGetKey() > -1)) // don't reset pStyle's bRemoveAfterUse flag
+ AddCondition(i);
+ }
+ }
+
+ if ( !aFormatCode.getLength() )
+ {
+ // insert empty format as empty string (with quotes)
+ // #93901# this check has to be done before inserting the conditions
+ aFormatCode.appendAscii("\"\""); // ""
+ }
+
+ aFormatCode.insert( 0, aConditions.makeStringAndClear() );
+ OUString sFormat = aFormatCode.makeStringAndClear();
+
+ // test special cases
+
+ if ( bAutoDec ) // automatic decimal places
+ {
+ // #99391# adjust only if the format contains no text elements, no conditions
+ // and no color definition (detected by the '[' at the start)
+
+ if ( nType == XML_TOK_STYLES_NUMBER_STYLE && !bHasExtraText &&
+ aMyConditions.size() == 0 && sFormat.toChar() != (sal_Unicode)'[' )
+ nIndex = pFormatter->GetStandardIndex( nFormatLang );
+ }
+ if ( bAutoInt ) // automatic integer digits
+ {
+ //! only if two decimal places was set?
+
+ if ( nType == XML_TOK_STYLES_NUMBER_STYLE && !bHasExtraText &&
+ aMyConditions.size() == 0 && sFormat.toChar() != (sal_Unicode)'[' )
+ nIndex = pFormatter->GetFormatIndex( NF_NUMBER_SYSTEM, nFormatLang );
+ }
+
+ // boolean is always the builtin boolean format
+ // (no other boolean formats are implemented)
+ if ( nType == XML_TOK_STYLES_BOOLEAN_STYLE )
+ nIndex = pFormatter->GetFormatIndex( NF_BOOLEAN, nFormatLang );
+
+ // check for default date formats
+ if ( nType == XML_TOK_STYLES_DATE_STYLE && bAutoOrder && !bDateNoDefault )
+ {
+ NfIndexTableOffset eFormat = (NfIndexTableOffset) SvXMLNumFmtDefaults::GetDefaultDateFormat(
+ eDateDOW, eDateDay, eDateMonth, eDateYear,
+ eDateHours, eDateMins, eDateSecs, bFromSystem );
+ if ( eFormat < NF_INDEX_TABLE_ENTRIES )
+ {
+ // #109651# if a date format has the automatic-order attribute and
+ // contains exactly the elements of one of the default date formats,
+ // use that default format, with the element order and separators
+ // from the current locale settings
+
+ nIndex = pFormatter->GetFormatIndex( eFormat, nFormatLang );
+ }
+ }
+
+ if ( nIndex == NUMBERFORMAT_ENTRY_NOT_FOUND && sFormat.getLength() )
+ {
+ // insert by format string
+
+ String aFormatStr( sFormat );
+ nIndex = pFormatter->GetEntryKey( aFormatStr, nFormatLang );
+ if ( nIndex == NUMBERFORMAT_ENTRY_NOT_FOUND )
+ {
+ xub_StrLen nErrPos = 0;
+ short l_nType = 0;
+ sal_Bool bOk = pFormatter->PutEntry( aFormatStr, nErrPos, l_nType, nIndex, nFormatLang );
+ if ( !bOk && nErrPos == 0 && aFormatStr != String(sFormat) )
+ {
+ // if the string was modified by PutEntry, look for an existing format
+ // with the modified string
+ nIndex = pFormatter->GetEntryKey( aFormatStr, nFormatLang );
+ if ( nIndex != NUMBERFORMAT_ENTRY_NOT_FOUND )
+ bOk = sal_True;
+ }
+ if (!bOk)
+ nIndex = NUMBERFORMAT_ENTRY_NOT_FOUND;
+ }
+ }
+
+//! I18N doesn't provide SYSTEM or extended date information yet
+ if ( nIndex != NUMBERFORMAT_ENTRY_NOT_FOUND && !bAutoOrder )
+ {
+ // use fixed-order formats instead of SYS... if bAutoOrder is false
+ // (only if the format strings are equal for the locale)
+
+ NfIndexTableOffset eOffset = pFormatter->GetIndexTableOffset( nIndex );
+ if ( eOffset == NF_DATE_SYS_DMMMYYYY )
+ {
+ sal_uInt32 nNewIndex = pFormatter->GetFormatIndex( NF_DATE_DIN_DMMMYYYY, nFormatLang );
+ const SvNumberformat* pOldEntry = pFormatter->GetEntry( nIndex );
+ const SvNumberformat* pNewEntry = pFormatter->GetEntry( nNewIndex );
+ if ( pOldEntry && pNewEntry && pOldEntry->GetFormatstring() == pNewEntry->GetFormatstring() )
+ nIndex = nNewIndex;
+ }
+ else if ( eOffset == NF_DATE_SYS_DMMMMYYYY )
+ {
+ sal_uInt32 nNewIndex = pFormatter->GetFormatIndex( NF_DATE_DIN_DMMMMYYYY, nFormatLang );
+ const SvNumberformat* pOldEntry = pFormatter->GetEntry( nIndex );
+ const SvNumberformat* pNewEntry = pFormatter->GetEntry( nNewIndex );
+ if ( pOldEntry && pNewEntry && pOldEntry->GetFormatstring() == pNewEntry->GetFormatstring() )
+ nIndex = nNewIndex;
+ }
+ }
+
+ if ((nIndex != NUMBERFORMAT_ENTRY_NOT_FOUND) && sFormatTitle.getLength())
+ {
+ SvNumberformat* pFormat = const_cast<SvNumberformat*>(pFormatter->GetEntry( nIndex ));
+ if (pFormat)
+ {
+ String sTitle (sFormatTitle);
+ pFormat->SetComment(sTitle);
+ }
+ }
+
+ if ( nIndex == NUMBERFORMAT_ENTRY_NOT_FOUND )
+ {
+ OSL_FAIL("invalid number format");
+ nIndex = pFormatter->GetStandardIndex( nFormatLang );
+ }
+
+ pData->AddKey( nIndex, GetName(), bRemoveAfterUse );
+ nKey = nIndex;
+
+ // Add to import's list of keys (shared between styles and content import)
+ // only if not volatile - formats are removed from NumberFormatter at the
+ // end of each import (in SvXMLNumFmtHelper dtor).
+ // If bRemoveAfterUse is reset later in GetKey, AddNumberStyle is called there.
+
+ if (!bRemoveAfterUse)
+ GetImport().AddNumberStyle( nKey, GetName() );
+
+ return nKey;
+}
+
+void SvXMLNumFormatContext::Finish( sal_Bool bOverwrite )
+{
+ SvXMLStyleContext::Finish( bOverwrite );
+}
+
+const LocaleDataWrapper& SvXMLNumFormatContext::GetLocaleData() const
+{
+ return pData->GetLocaleData( nFormatLang );
+}
+
+void SvXMLNumFormatContext::AddToCode( const rtl::OUString& rString )
+{
+ aFormatCode.append( rString );
+ bHasExtraText = sal_True;
+}
+
+void SvXMLNumFormatContext::AddNumber( const SvXMLNumberInfo& rInfo )
+{
+ SvNumberFormatter* pFormatter = pData->GetNumberFormatter();
+ if (!pFormatter)
+ return;
+
+ // store special conditions
+ bAutoDec = ( rInfo.nDecimals < 0 );
+ bAutoInt = ( rInfo.nInteger < 0 );
+
+ sal_uInt16 nPrec = 0;
+ sal_uInt16 nLeading = 0;
+ if ( rInfo.nDecimals >= 0 ) // < 0 : Default
+ nPrec = (sal_uInt16) rInfo.nDecimals;
+ if ( rInfo.nInteger >= 0 ) // < 0 : Default
+ nLeading = (sal_uInt16) rInfo.nInteger;
+
+ if ( bAutoDec )
+ {
+ if ( nType == XML_TOK_STYLES_CURRENCY_STYLE )
+ {
+ // for currency formats, "automatic decimals" is used for the automatic
+ // currency format with (fixed) decimals from the locale settings
+
+ const LocaleDataWrapper& rLoc = pData->GetLocaleData( nFormatLang );
+ nPrec = rLoc.getCurrDigits();
+ }
+ else
+ {
+ // for other types, "automatic decimals" means dynamic determination of
+ // decimals, as achieved with the "general" keyword
+
+ aFormatCode.append( pFormatter->GetStandardName( nFormatLang ) );
+ return;
+ }
+ }
+ if ( bAutoInt )
+ {
+ //!...
+ }
+
+ sal_uInt16 nGenPrec = nPrec;
+ if ( rInfo.bDecReplace || rInfo.bVarDecimals )
+ nGenPrec = 0; // generate format without decimals...
+
+ sal_Bool bGrouping = rInfo.bGrouping;
+ sal_uInt16 nEmbeddedCount = rInfo.aEmbeddedElements.Count();
+ if ( nEmbeddedCount )
+ bGrouping = sal_False; // grouping and embedded characters can't be used together
+
+ String aNumStr;
+ sal_uInt32 nStdIndex = pFormatter->GetStandardIndex( nFormatLang );
+ pFormatter->GenerateFormat( aNumStr, nStdIndex, nFormatLang,
+ bGrouping, sal_False, nGenPrec, nLeading );
+
+ if ( rInfo.nExpDigits >= 0 && nLeading == 0 && !bGrouping && nEmbeddedCount == 0 )
+ {
+ // #i43959# For scientific numbers, "#" in the integer part forces a digit,
+ // so it has to be removed if nLeading is 0 (".00E+0", not "#.00E+0").
+
+ aNumStr.EraseLeadingChars( (sal_Unicode)'#' );
+ }
+
+ if ( nEmbeddedCount )
+ {
+ // insert embedded strings into number string
+ // only the integer part is supported
+ // nZeroPos is the string position where format position 0 is inserted
+
+ xub_StrLen nZeroPos = aNumStr.Search( pData->GetLocaleData( nFormatLang ).getNumDecimalSep() );
+ if ( nZeroPos == STRING_NOTFOUND )
+ nZeroPos = aNumStr.Len();
+
+ // aEmbeddedElements is sorted - last entry has the largest position (leftmost)
+ const SvXMLEmbeddedElement* pLastObj = rInfo.aEmbeddedElements[nEmbeddedCount - 1];
+ sal_Int32 nLastFormatPos = pLastObj->nFormatPos;
+ if ( nLastFormatPos >= nZeroPos )
+ {
+ // add '#' characters so all embedded texts are really embedded in digits
+ // (there always has to be a digit before the leftmost embedded text)
+
+ xub_StrLen nAddCount = (xub_StrLen)nLastFormatPos + 1 - nZeroPos;
+ String aDigitStr;
+ aDigitStr.Fill( nAddCount, (sal_Unicode)'#' );
+ aNumStr.Insert( aDigitStr, 0 );
+ nZeroPos = nZeroPos + nAddCount;
+ }
+
+ // aEmbeddedElements is sorted with ascending positions - loop is from right to left
+ for (sal_uInt16 nElement = 0; nElement < nEmbeddedCount; nElement++)
+ {
+ const SvXMLEmbeddedElement* pObj = rInfo.aEmbeddedElements[nElement];
+ sal_Int32 nFormatPos = pObj->nFormatPos;
+ sal_Int32 nInsertPos = nZeroPos - nFormatPos;
+ if ( nFormatPos >= 0 && nInsertPos >= 0 )
+ {
+ rtl::OUStringBuffer aContent( pObj->aText );
+ // #107805# always quote embedded strings - even space would otherwise
+ // be recognized as thousands separator in French.
+ aContent.insert( 0, (sal_Unicode) '"' );
+ aContent.append( (sal_Unicode) '"' );
+
+ aNumStr.Insert( String( aContent.makeStringAndClear() ), (xub_StrLen)nInsertPos );
+ }
+ }
+ }
+
+ aFormatCode.append( aNumStr );
+
+ if ( ( rInfo.bDecReplace || rInfo.bVarDecimals ) && nPrec ) // add decimal replacement (dashes)
+ {
+ // add dashes for explicit decimal replacement, # for variable decimals
+ sal_Unicode cAdd = rInfo.bDecReplace ? '-' : '#';
+
+ aFormatCode.append( pData->GetLocaleData( nFormatLang ).getNumDecimalSep() );
+ for ( sal_uInt16 i=0; i<nPrec; i++)
+ aFormatCode.append( cAdd );
+ }
+
+ // add extra thousands separators for display factor
+
+ if ( rInfo.fDisplayFactor != 1.0 && rInfo.fDisplayFactor > 0.0 )
+ {
+ // test for 1.0 is just for optimization - nSepCount would be 0
+
+ // one separator for each factor of 1000
+ sal_Int32 nSepCount = (sal_Int32) ::rtl::math::round( log10(rInfo.fDisplayFactor) / 3.0 );
+ if ( nSepCount > 0 )
+ {
+ OUString aSep = pData->GetLocaleData( nFormatLang ).getNumThousandSep();
+ for ( sal_Int32 i=0; i<nSepCount; i++ )
+ aFormatCode.append( aSep );
+ }
+ }
+}
+
+void SvXMLNumFormatContext::AddCurrency( const rtl::OUString& rContent, LanguageType nLang )
+{
+ sal_Bool bAutomatic = sal_False;
+ OUString aSymbol = rContent;
+ if ( aSymbol.getLength() == 0 )
+ {
+ SvNumberFormatter* pFormatter = pData->GetNumberFormatter();
+ if ( pFormatter )
+ {
+ pFormatter->ChangeIntl( nFormatLang );
+ String sCurString, sDummy;
+ pFormatter->GetCompatibilityCurrency( sCurString, sDummy );
+ aSymbol = sCurString;
+
+ bAutomatic = sal_True;
+ }
+ }
+ else if ( nLang == LANGUAGE_SYSTEM && aSymbol.compareToAscii("CCC") == 0 )
+ {
+ // "CCC" is used for automatic long symbol
+ bAutomatic = sal_True;
+ }
+
+ if ( bAutomatic )
+ {
+ // remove unnecessary quotes before automatic symbol (formats like "-(0DM)")
+ // otherwise the currency symbol isn't recognized (#94048#)
+
+ sal_Int32 nLength = aFormatCode.getLength();
+ if ( nLength > 1 && aFormatCode.charAt( nLength-1 ) == '"' )
+ {
+ // find start of quoted string
+ // When SvXMLNumFmtElementContext::EndElement creates escaped quotes,
+ // they must be handled here, too.
+
+ sal_Int32 nFirst = nLength - 2;
+ while ( nFirst >= 0 && aFormatCode.charAt( nFirst ) != '"' )
+ --nFirst;
+ if ( nFirst >= 0 )
+ {
+ // remove both quotes from aFormatCode
+ rtl::OUString aOld = aFormatCode.makeStringAndClear();
+ if ( nFirst > 0 )
+ aFormatCode.append( aOld.copy( 0, nFirst ) );
+ if ( nLength > nFirst + 2 )
+ aFormatCode.append( aOld.copy( nFirst + 1, nLength - nFirst - 2 ) );
+ }
+ }
+ }
+
+ if (!bAutomatic)
+ aFormatCode.appendAscii( "[$" ); // intro for "new" currency symbols
+
+ aFormatCode.append( aSymbol );
+
+ if (!bAutomatic)
+ {
+ if ( nLang != LANGUAGE_SYSTEM )
+ {
+ // '-' sign and language code in hex:
+ aFormatCode.append( (sal_Unicode) '-' );
+ aFormatCode.append( String::CreateFromInt32( sal_Int32( nLang ), 16 ).ToUpperAscii() );
+ }
+
+ aFormatCode.append( (sal_Unicode) ']' ); // end of "new" currency symbol
+ }
+}
+
+void SvXMLNumFormatContext::AddNfKeyword( sal_uInt16 nIndex )
+{
+ SvNumberFormatter* pFormatter = pData->GetNumberFormatter();
+ if (!pFormatter)
+ return;
+
+ if ( nIndex == NF_KEY_G || nIndex == NF_KEY_GG || nIndex == NF_KEY_GGG )
+ bHasEra = sal_True;
+
+ if ( nIndex == NF_KEY_NNNN )
+ {
+ nIndex = NF_KEY_NNN;
+ bHasLongDoW = sal_True; // to remove string constant with separator
+ }
+
+ String sKeyword = pFormatter->GetKeyword( nFormatLang, nIndex );
+
+ if ( nIndex == NF_KEY_H || nIndex == NF_KEY_HH ||
+ nIndex == NF_KEY_MI || nIndex == NF_KEY_MMI ||
+ nIndex == NF_KEY_S || nIndex == NF_KEY_SS )
+ {
+ if ( !bTruncate && !bHasDateTime )
+ {
+ // with truncate-on-overflow = false, add "[]" to first time part
+
+ sKeyword.Insert( (sal_Unicode) '[', 0 );
+ sKeyword.Append( (sal_Unicode) ']' );
+ }
+ bHasDateTime = sal_True;
+ }
+
+ aFormatCode.append( sKeyword );
+
+ // collect the date elements that the format contains, to recognize default date formats
+ switch ( nIndex )
+ {
+ case NF_KEY_NN: eDateDOW = XML_DEA_SHORT; break;
+ case NF_KEY_NNN:
+ case NF_KEY_NNNN: eDateDOW = XML_DEA_LONG; break;
+ case NF_KEY_D: eDateDay = XML_DEA_SHORT; break;
+ case NF_KEY_DD: eDateDay = XML_DEA_LONG; break;
+ case NF_KEY_M: eDateMonth = XML_DEA_SHORT; break;
+ case NF_KEY_MM: eDateMonth = XML_DEA_LONG; break;
+ case NF_KEY_MMM: eDateMonth = XML_DEA_TEXTSHORT; break;
+ case NF_KEY_MMMM: eDateMonth = XML_DEA_TEXTLONG; break;
+ case NF_KEY_YY: eDateYear = XML_DEA_SHORT; break;
+ case NF_KEY_YYYY: eDateYear = XML_DEA_LONG; break;
+ case NF_KEY_H: eDateHours = XML_DEA_SHORT; break;
+ case NF_KEY_HH: eDateHours = XML_DEA_LONG; break;
+ case NF_KEY_MI: eDateMins = XML_DEA_SHORT; break;
+ case NF_KEY_MMI: eDateMins = XML_DEA_LONG; break;
+ case NF_KEY_S: eDateSecs = XML_DEA_SHORT; break;
+ case NF_KEY_SS: eDateSecs = XML_DEA_LONG; break;
+ case NF_KEY_AP:
+ case NF_KEY_AMPM: break; // AM/PM may or may not be in date/time formats -> ignore by itself
+ default:
+ bDateNoDefault = sal_True; // any other element -> no default format
+ }
+}
+
+sal_Bool lcl_IsAtEnd( rtl::OUStringBuffer& rBuffer, const String& rToken )
+{
+ sal_Int32 nBufLen = rBuffer.getLength();
+ xub_StrLen nTokLen = rToken.Len();
+
+ if ( nTokLen > nBufLen )
+ return sal_False;
+
+ sal_Int32 nStartPos = nBufLen - nTokLen;
+ for ( xub_StrLen nTokPos = 0; nTokPos < nTokLen; nTokPos++ )
+ if ( rToken.GetChar( nTokPos ) != rBuffer.charAt( nStartPos + nTokPos ) )
+ return sal_False;
+
+ return sal_True;
+}
+
+sal_Bool SvXMLNumFormatContext::ReplaceNfKeyword( sal_uInt16 nOld, sal_uInt16 nNew )
+{
+ // replaces one keyword with another if it is found at the end of the code
+
+ SvNumberFormatter* pFormatter = pData->GetNumberFormatter();
+ if (!pFormatter)
+ return sal_False;
+
+ String sOldStr = pFormatter->GetKeyword( nFormatLang, nOld );
+ if ( lcl_IsAtEnd( aFormatCode, sOldStr ) )
+ {
+ // remove old keyword
+ aFormatCode.setLength( aFormatCode.getLength() - sOldStr.Len() );
+
+ // add new keyword
+ String sNewStr = pFormatter->GetKeyword( nFormatLang, nNew );
+ aFormatCode.append( sNewStr );
+
+ return sal_True; // changed
+ }
+ return sal_False; // not found
+}
+
+void SvXMLNumFormatContext::AddCondition( const sal_Int32 nIndex )
+{
+ rtl::OUString rApplyName = aMyConditions[nIndex].sMapName;
+ rtl::OUString rCondition = aMyConditions[nIndex].sCondition;
+ SvNumberFormatter* pFormatter = pData->GetNumberFormatter();
+ sal_uInt32 l_nKey = pData->GetKeyForName( rApplyName );
+ OUString sValue(RTL_CONSTASCII_USTRINGPARAM("value()")); //! define constant
+ sal_Int32 nValLen = sValue.getLength();
+
+ if ( pFormatter && l_nKey != NUMBERFORMAT_ENTRY_NOT_FOUND &&
+ rCondition.copy( 0, nValLen ) == sValue )
+ {
+ //! test for valid conditions
+ //! test for default conditions
+
+ OUString sRealCond = rCondition.copy( nValLen, rCondition.getLength() - nValLen );
+ sal_Bool bDefaultCond = sal_False;
+
+ //! collect all conditions first and adjust default to >=0, >0 or <0 depending on count
+ //! allow blanks in conditions
+ sal_Bool bFirstCond = ( aConditions.getLength() == 0 );
+ if ( bFirstCond && aMyConditions.size() == 1 && sRealCond.compareToAscii( ">=0" ) == 0 )
+ bDefaultCond = sal_True;
+
+ if ( nType == XML_TOK_STYLES_TEXT_STYLE && nIndex == 2 )
+ {
+ // The third condition in a number format with a text part can only be
+ // "all other numbers", the condition string must be empty.
+ bDefaultCond = sal_True;
+ }
+
+ if (!bDefaultCond)
+ {
+ sal_Int32 nPos = sRealCond.indexOf( '.' );
+ if ( nPos >= 0 )
+ { // #i8026# #103991# localize decimal separator
+ const String& rDecSep = GetLocaleData().getNumDecimalSep();
+ if ( rDecSep.Len() > 1 || rDecSep.GetChar(0) != '.' )
+ sRealCond = sRealCond.replaceAt( nPos, 1, rDecSep );
+ }
+ aConditions.append( (sal_Unicode) '[' );
+ aConditions.append( sRealCond );
+ aConditions.append( (sal_Unicode) ']' );
+ }
+
+ const SvNumberformat* pFormat = pFormatter->GetEntry(l_nKey);
+ if ( pFormat )
+ aConditions.append( OUString( pFormat->GetFormatstring() ) );
+
+ aConditions.append( (sal_Unicode) ';' );
+ }
+}
+
+void SvXMLNumFormatContext::AddCondition( const sal_Int32 nIndex, const rtl::OUString& rFormat, const LocaleDataWrapper& rData )
+{
+ rtl::OUString rCondition = aMyConditions[nIndex].sCondition;
+ OUString sValue(RTL_CONSTASCII_USTRINGPARAM("value()")); //! define constant
+ sal_Int32 nValLen = sValue.getLength();
+
+ if ( rCondition.copy( 0, nValLen ) == sValue )
+ {
+ //! test for valid conditions
+ //! test for default conditions
+
+ OUString sRealCond = rCondition.copy( nValLen, rCondition.getLength() - nValLen );
+ sal_Bool bDefaultCond = sal_False;
+
+ //! collect all conditions first and adjust default to >=0, >0 or <0 depending on count
+ //! allow blanks in conditions
+ sal_Bool bFirstCond = ( aConditions.getLength() == 0 );
+ if ( bFirstCond && aMyConditions.size() == 1 && sRealCond.compareToAscii( ">=0" ) == 0 )
+ bDefaultCond = sal_True;
+
+ if ( nType == XML_TOK_STYLES_TEXT_STYLE && nIndex == 2 )
+ {
+ // The third condition in a number format with a text part can only be
+ // "all other numbers", the condition string must be empty.
+ bDefaultCond = sal_True;
+ }
+
+ if (!bDefaultCond)
+ {
+ sal_Int32 nPos = sRealCond.indexOf( '.' );
+ if ( nPos >= 0 )
+ { // #i8026# #103991# localize decimal separator
+ const String& rDecSep = rData.getNumDecimalSep();
+ if ( rDecSep.Len() > 1 || rDecSep.GetChar(0) != '.' )
+ sRealCond = sRealCond.replaceAt( nPos, 1, rDecSep );
+ }
+ aConditions.append( (sal_Unicode) '[' );
+ aConditions.append( sRealCond );
+ aConditions.append( (sal_Unicode) ']' );
+ }
+
+ aConditions.append( rFormat );
+
+ aConditions.append( (sal_Unicode) ';' );
+ }
+}
+
+void SvXMLNumFormatContext::AddCondition( const rtl::OUString& rCondition, const rtl::OUString& rApplyName )
+{
+ MyCondition aCondition;
+ aCondition.sCondition = rCondition;
+ aCondition.sMapName = rApplyName;
+ aMyConditions.push_back(aCondition);
+}
+
+void SvXMLNumFormatContext::AddColor( const Color& rColor )
+{
+ SvNumberFormatter* pFormatter = pData->GetNumberFormatter();
+ if (!pFormatter)
+ return;
+
+ OUStringBuffer aColName;
+ for ( sal_uInt16 i=0; i<XML_NUMF_COLORCOUNT; i++ )
+ if ( rColor == aNumFmtStdColors[i] )
+ {
+ aColName = OUString( pFormatter->GetKeyword( nFormatLang, sal::static_int_cast< sal_uInt16 >(NF_KEY_FIRSTCOLOR + i) ) );
+ break;
+ }
+
+ if ( aColName.getLength() )
+ {
+ aColName.insert( 0, (sal_Unicode) '[' );
+ aColName.append( (sal_Unicode) ']' );
+ aFormatCode.insert( 0, aColName.makeStringAndClear() );
+ }
+}
+
+void SvXMLNumFormatContext::UpdateCalendar( const rtl::OUString& rNewCalendar )
+{
+ if ( rNewCalendar != sCalendar )
+ {
+ sCalendar = rNewCalendar;
+ if ( sCalendar.getLength() )
+ {
+ aFormatCode.appendAscii( "[~" ); // intro for calendar code
+ aFormatCode.append( sCalendar );
+ aFormatCode.append( (sal_Unicode) ']' ); // end of "new" currency symbolcalendar code
+ }
+ }
+}
+
+sal_Bool SvXMLNumFormatContext::IsSystemLanguage()
+{
+ return nFormatLang == LANGUAGE_SYSTEM;
+}
+
+//-------------------------------------------------------------------------
+
+//
+// SvXMLNumFmtHelper
+//
+
+SvXMLNumFmtHelper::SvXMLNumFmtHelper(
+ const uno::Reference<util::XNumberFormatsSupplier>& rSupp,
+ const uno::Reference<lang::XMultiServiceFactory>& xServiceFactory )
+: mxServiceFactory(xServiceFactory)
+{
+ DBG_ASSERT( mxServiceFactory.is(), "got no service manager" );
+
+ SvNumberFormatter* pFormatter = NULL;
+ SvNumberFormatsSupplierObj* pObj =
+ SvNumberFormatsSupplierObj::getImplementation( rSupp );
+ if (pObj)
+ pFormatter = pObj->GetNumberFormatter();
+
+ pData = new SvXMLNumImpData( pFormatter, mxServiceFactory );
+}
+
+SvXMLNumFmtHelper::SvXMLNumFmtHelper(
+ SvNumberFormatter* pNumberFormatter,
+ const uno::Reference<lang::XMultiServiceFactory>& xServiceFactory )
+: mxServiceFactory(xServiceFactory)
+{
+ DBG_ASSERT( mxServiceFactory.is(), "got no service manager" );
+
+ pData = new SvXMLNumImpData( pNumberFormatter, mxServiceFactory );
+}
+
+SvXMLNumFmtHelper::~SvXMLNumFmtHelper()
+{
+ // remove temporary (volatile) formats from NumberFormatter
+ pData->RemoveVolatileFormats();
+
+ delete pData;
+}
+
+SvXMLStyleContext* SvXMLNumFmtHelper::CreateChildContext( SvXMLImport& rImport,
+ sal_uInt16 nPrefix, const OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList,
+ SvXMLStylesContext& rStyles )
+{
+ SvXMLStyleContext* pContext = NULL;
+
+ const SvXMLTokenMap& rTokenMap = pData->GetStylesElemTokenMap();
+ sal_uInt16 nToken = rTokenMap.Get( nPrefix, rLocalName );
+ switch (nToken)
+ {
+ case XML_TOK_STYLES_NUMBER_STYLE:
+ case XML_TOK_STYLES_CURRENCY_STYLE:
+ case XML_TOK_STYLES_PERCENTAGE_STYLE:
+ case XML_TOK_STYLES_DATE_STYLE:
+ case XML_TOK_STYLES_TIME_STYLE:
+ case XML_TOK_STYLES_BOOLEAN_STYLE:
+ case XML_TOK_STYLES_TEXT_STYLE:
+ pContext = new SvXMLNumFormatContext( rImport, nPrefix, rLocalName,
+ pData, nToken, xAttrList, rStyles );
+ break;
+ }
+
+ // return NULL if not a data style, caller must handle other elements
+ return pContext;
+}
+
+const SvXMLTokenMap& SvXMLNumFmtHelper::GetStylesElemTokenMap()
+{
+ return pData->GetStylesElemTokenMap();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/xmlnumi.cxx b/xmloff/source/style/xmlnumi.cxx
new file mode 100644
index 000000000000..1d6d5a518249
--- /dev/null
+++ b/xmloff/source/style/xmlnumi.cxx
@@ -0,0 +1,1397 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#include <com/sun/star/text/HoriOrientation.hpp>
+#include <com/sun/star/text/VertOrientation.hpp>
+#include <com/sun/star/text/PositionAndSpaceMode.hpp>
+#include <com/sun/star/text/LabelFollow.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+
+#include <rtl/ustrbuf.hxx>
+
+#include <tools/urlobj.hxx>
+#include <tools/debug.hxx>
+#include <tools/fontenum.hxx>
+
+#include <xmloff/xmltkmap.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/XMLBase64ImportContext.hxx>
+#include <xmloff/xmltoken.hxx>
+
+#include <xmloff/i18nmap.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "fonthdl.hxx"
+#include <xmloff/XMLFontStylesContext.hxx>
+#include <xmloff/families.hxx>
+#include <xmloff/maptype.hxx>
+
+#include <xmloff/xmlnumi.hxx>
+
+#define _SVSTDARR_USHORTS
+#include <svl/svstdarr.hxx>
+
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::frame;
+using namespace ::xmloff::token;
+using namespace ::com::sun::star::io;
+
+using rtl::OUString;
+using rtl::OUStringBuffer;
+
+static sal_Char const XML_UNO_NAME_NRULE_SYMBOL_TEXT_DISTANCE[] =
+ "SymbolTextDistance";
+static sal_Char const XML_UNO_NAME_NRULE_PARENT_NUMBERING[] =
+ "ParentNumbering";
+static sal_Char const XML_UNO_NAME_NRULE_CHAR_STYLE_NAME[] =
+ "CharStyleName";
+static sal_Char const XML_UNO_NAME_NRULE_BULLET_CHAR[] ="BulletChar";
+static sal_Char const XML_UNO_NAME_NRULE_BULLET_RELSIZE[] = "BulletRelSize";
+static sal_Char const XML_UNO_NAME_NRULE_GRAPHIC_SIZE[] =
+ "GraphicSize";
+static sal_Char const XML_UNO_NAME_NRULE_VERT_ORIENT[] ="VertOrient";
+
+static sal_Char const XML_UNO_NAME_NRULE_NUMBERINGTYPE[] = "NumberingType";
+static sal_Char const XML_UNO_NAME_NRULE_PREFIX[] = "Prefix";
+static sal_Char const XML_UNO_NAME_NRULE_SUFFIX[] = "Suffix";
+static sal_Char const XML_UNO_NAME_NRULE_ADJUST[] = "Adjust";
+static sal_Char const XML_UNO_NAME_NRULE_LEFT_MARGIN[] = "LeftMargin";
+static sal_Char const XML_UNO_NAME_NRULE_FIRST_LINE_OFFSET[] =
+ "FirstLineOffset";
+static sal_Char const XML_UNO_NAME_NRULE_BULLET_FONT[] = "BulletFont";
+static sal_Char const XML_UNO_NAME_NRULE_GRAPHICURL[] = "GraphicURL";
+static sal_Char const XML_UNO_NAME_NRULE_START_WITH[] = "StartWith";
+static sal_Char const XML_UNO_NAME_NRULE_BULLET_COLOR[] = "BulletColor";
+static sal_Char const XML_UNO_NAME_NRULE_POSITION_AND_SPACE_MODE[] = "PositionAndSpaceMode";
+static sal_Char const XML_UNO_NAME_NRULE_LABEL_FOLLOWED_BY[] = "LabelFollowedBy";
+static sal_Char const XML_UNO_NAME_NRULE_LISTTAB_STOP_POSITION[] = "ListtabStopPosition";
+static sal_Char const XML_UNO_NAME_NRULE_FIRST_LINE_INDENT[] = "FirstLineIndent";
+static sal_Char const XML_UNO_NAME_NRULE_INDENT_AT[] = "IndentAt";
+
+// ---------------------------------------------------------------------
+
+class SvxXMLListLevelStyleContext_Impl;
+
+class SvxXMLListLevelStyleAttrContext_Impl : public SvXMLImportContext
+{
+ SvxXMLListLevelStyleContext_Impl& rListLevel;
+
+public:
+
+ SvxXMLListLevelStyleAttrContext_Impl(
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const Reference< xml::sax::XAttributeList >& xAttrList,
+ SvxXMLListLevelStyleContext_Impl& rLLevel );
+ virtual ~SvxXMLListLevelStyleAttrContext_Impl();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix, const OUString& rLocalName,
+ const Reference< xml::sax::XAttributeList > & xAttrList );
+};
+
+// ---------------------------------------------------------------------
+
+class SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl : public SvXMLImportContext
+{
+ SvxXMLListLevelStyleContext_Impl& rListLevel;
+
+public:
+
+ SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl(
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const Reference< xml::sax::XAttributeList >& xAttrList,
+ SvxXMLListLevelStyleContext_Impl& rLLevel );
+ virtual ~SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl();
+};
+
+// ---------------------------------------------------------------------
+
+enum SvxXMLTextListLevelStyleAttrTokens
+{
+ XML_TOK_TEXT_LEVEL_ATTR_LEVEL,
+ XML_TOK_TEXT_LEVEL_ATTR_STYLE_NAME,
+ XML_TOK_TEXT_LEVEL_ATTR_BULLET_CHAR,
+ XML_TOK_TEXT_LEVEL_ATTR_HREF,
+ XML_TOK_TEXT_LEVEL_ATTR_TYPE,
+ XML_TOK_TEXT_LEVEL_ATTR_SHOW,
+ XML_TOK_TEXT_LEVEL_ATTR_ACTUATE,
+ XML_TOK_TEXT_LEVEL_ATTR_NUM_FORMAT,
+ XML_TOK_TEXT_LEVEL_ATTR_NUM_PREFIX,
+ XML_TOK_TEXT_LEVEL_ATTR_NUM_SUFFIX,
+ XML_TOK_TEXT_LEVEL_ATTR_NUM_LETTER_SYNC,
+ XML_TOK_TEXT_LEVEL_ATTR_START_VALUE,
+ XML_TOK_TEXT_LEVEL_ATTR_DISPLAY_LEVELS,
+
+ XML_TOK_TEXT_LEVEL_ATTR_END=XML_TOK_UNKNOWN
+};
+
+const SvXMLTokenMapEntry* lcl_getLevelAttrTokenMap()
+{
+ static SvXMLTokenMapEntry aLevelAttrTokenMap[] =
+ {
+ { XML_NAMESPACE_TEXT, XML_LEVEL, XML_TOK_TEXT_LEVEL_ATTR_LEVEL },
+ { XML_NAMESPACE_TEXT, XML_STYLE_NAME, XML_TOK_TEXT_LEVEL_ATTR_STYLE_NAME },
+ { XML_NAMESPACE_TEXT, XML_BULLET_CHAR, XML_TOK_TEXT_LEVEL_ATTR_BULLET_CHAR },
+ { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_TEXT_LEVEL_ATTR_HREF },
+ { XML_NAMESPACE_XLINK, XML_TYPE, XML_TOK_TEXT_LEVEL_ATTR_TYPE },
+ { XML_NAMESPACE_XLINK, XML_SHOW, XML_TOK_TEXT_LEVEL_ATTR_SHOW },
+ { XML_NAMESPACE_XLINK, XML_ACTUATE, XML_TOK_TEXT_LEVEL_ATTR_ACTUATE },
+
+ { XML_NAMESPACE_STYLE, XML_NUM_FORMAT, XML_TOK_TEXT_LEVEL_ATTR_NUM_FORMAT },
+ { XML_NAMESPACE_STYLE, XML_NUM_PREFIX, XML_TOK_TEXT_LEVEL_ATTR_NUM_PREFIX },
+ { XML_NAMESPACE_STYLE, XML_NUM_SUFFIX, XML_TOK_TEXT_LEVEL_ATTR_NUM_SUFFIX },
+ { XML_NAMESPACE_STYLE, XML_NUM_LETTER_SYNC, XML_TOK_TEXT_LEVEL_ATTR_NUM_LETTER_SYNC },
+ { XML_NAMESPACE_TEXT, XML_START_VALUE, XML_TOK_TEXT_LEVEL_ATTR_START_VALUE },
+ { XML_NAMESPACE_TEXT, XML_DISPLAY_LEVELS, XML_TOK_TEXT_LEVEL_ATTR_DISPLAY_LEVELS },
+
+ XML_TOKEN_MAP_END
+ };
+ return aLevelAttrTokenMap;
+}
+
+class SvxXMLListLevelStyleContext_Impl : public SvXMLImportContext
+{
+ friend class SvxXMLListLevelStyleAttrContext_Impl;
+ const OUString sStarBats;
+ const OUString sStarMath;
+
+ OUString sPrefix;
+ OUString sSuffix;
+ OUString sTextStyleName;
+ OUString sNumFormat;
+ OUString sNumLetterSync;
+ OUString sBulletFontName;
+ OUString sBulletFontStyleName;
+ OUString sImageURL;
+
+ Reference < XOutputStream > xBase64Stream;
+
+ sal_Int32 nLevel;
+ sal_Int32 nSpaceBefore;
+ sal_Int32 nMinLabelWidth;
+ sal_Int32 nMinLabelDist;
+ sal_Int32 nImageWidth;
+ sal_Int32 nImageHeight;
+ sal_Int16 nNumStartValue;
+ sal_Int16 nNumDisplayLevels;
+
+ sal_Int16 eAdjust;
+ sal_Int16 eBulletFontFamily;
+ sal_Int16 eBulletFontPitch;
+ rtl_TextEncoding eBulletFontEncoding;
+ sal_Int16 eImageVertOrient;
+
+ sal_Unicode cBullet;
+
+ sal_Int16 nRelSize;
+ Color aColor;
+
+ sal_Int16 ePosAndSpaceMode;
+ sal_Int16 eLabelFollowedBy;
+ sal_Int32 nListtabStopPosition;
+ sal_Int32 nFirstLineIndent;
+ sal_Int32 nIndentAt;
+
+ sal_Bool bBullet : 1;
+ sal_Bool bImage : 1;
+ sal_Bool bNum : 1;
+ sal_Bool bHasColor : 1;
+
+ void SetRelSize( sal_Int16 nRel ) { nRelSize = nRel; }
+ void SetColor( sal_Int32 _aColor ) { aColor = _aColor; bHasColor = sal_True; }
+ void SetSpaceBefore( sal_Int32 nSet ) { nSpaceBefore = nSet; }
+ void SetMinLabelWidth( sal_Int32 nSet ) { nMinLabelWidth = nSet; }
+ void SetMinLabelDist( sal_Int32 nSet ) { nMinLabelDist = nSet; }
+ void SetAdjust( sal_Int16 eSet ) { eAdjust = eSet; }
+
+ void SetBulletFontName( const OUString& rSet ) { sBulletFontName = rSet; }
+ void SetBulletFontStyleName( const OUString& rSet )
+ { sBulletFontStyleName = rSet; }
+ void SetBulletFontFamily( sal_Int16 eSet ) { eBulletFontFamily = eSet; }
+ void SetBulletFontPitch( sal_Int16 eSet ) { eBulletFontPitch = eSet; }
+ void SetBulletFontEncoding( rtl_TextEncoding eSet )
+ { eBulletFontEncoding = eSet; }
+
+ void SetImageWidth( sal_Int32 nSet ) { nImageWidth = nSet; }
+ void SetImageHeight( sal_Int32 nSet ) { nImageHeight = nSet; }
+ void SetImageVertOrient( sal_Int16 eSet )
+ { eImageVertOrient = eSet; }
+
+public:
+
+ SvxXMLListLevelStyleContext_Impl(
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const Reference< xml::sax::XAttributeList > & xAttrList );
+ virtual ~SvxXMLListLevelStyleContext_Impl();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix, const OUString& rLocalName,
+ const Reference< xml::sax::XAttributeList > & xAttrList );
+
+ sal_Int32 GetLevel() const { return nLevel; }
+ Sequence<beans::PropertyValue> GetProperties(
+ const SvI18NMap *pI18NMap=0 );
+
+ inline void SetPosAndSpaceMode( sal_Int16 eValue )
+ {
+ ePosAndSpaceMode = eValue;
+ }
+ inline void SetLabelFollowedBy( sal_Int16 eValue )
+ {
+ eLabelFollowedBy = eValue;
+ }
+ inline void SetListtabStopPosition( sal_Int32 nValue )
+ {
+ nListtabStopPosition = nValue;
+ }
+ inline void SetFirstLineIndent( sal_Int32 nValue )
+ {
+ nFirstLineIndent = nValue;
+ }
+ inline void SetIndentAt( sal_Int32 nValue )
+ {
+ nIndentAt = nValue;
+ }
+};
+
+SvxXMLListLevelStyleContext_Impl::SvxXMLListLevelStyleContext_Impl(
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const Reference< xml::sax::XAttributeList > & xAttrList )
+
+: SvXMLImportContext( rImport, nPrfx, rLName )
+, sStarBats( RTL_CONSTASCII_USTRINGPARAM( "StarBats" ) )
+, sStarMath( RTL_CONSTASCII_USTRINGPARAM( "StarMath" ) )
+, sNumFormat( OUString(RTL_CONSTASCII_USTRINGPARAM("1")) )
+, nLevel( -1L )
+, nSpaceBefore( 0L )
+, nMinLabelWidth( 0L )
+, nMinLabelDist( 0L )
+, nImageWidth( 0L )
+, nImageHeight( 0L )
+, nNumStartValue( 1 )
+, nNumDisplayLevels( 1 )
+, eAdjust( HoriOrientation::LEFT )
+, eBulletFontFamily( FAMILY_DONTKNOW )
+, eBulletFontPitch( PITCH_DONTKNOW )
+, eBulletFontEncoding( RTL_TEXTENCODING_DONTKNOW )
+, eImageVertOrient(0)
+, cBullet( 0 )
+, nRelSize(0)
+, aColor( 0 )
+, ePosAndSpaceMode( PositionAndSpaceMode::LABEL_WIDTH_AND_POSITION )
+, eLabelFollowedBy( LabelFollow::LISTTAB )
+, nListtabStopPosition( 0 )
+, nFirstLineIndent( 0 )
+, nIndentAt( 0 )
+, bBullet( sal_False )
+, bImage( sal_False )
+, bNum( sal_False )
+, bHasColor( sal_False )
+{
+ if( IsXMLToken( rLName, XML_LIST_LEVEL_STYLE_NUMBER ) ||
+ IsXMLToken( rLName, XML_OUTLINE_LEVEL_STYLE ) )
+ bNum = sal_True;
+ else if( IsXMLToken( rLName, XML_LIST_LEVEL_STYLE_BULLET ) )
+ bBullet = sal_True;
+ else if( IsXMLToken( rLName, XML_LIST_LEVEL_STYLE_IMAGE ) )
+ bImage = sal_True;
+
+ SvXMLTokenMap aTokenMap( lcl_getLevelAttrTokenMap() );
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ const OUString& rValue = xAttrList->getValueByIndex( i );
+
+ switch( aTokenMap.Get( nPrefix, aLocalName ) )
+ {
+ case XML_TOK_TEXT_LEVEL_ATTR_LEVEL:
+ nLevel = rValue.toInt32();
+ if( nLevel >= 1L )
+ nLevel--;
+ else
+ nLevel = 0;
+ break;
+ case XML_TOK_TEXT_LEVEL_ATTR_STYLE_NAME:
+ sTextStyleName = rValue;
+ break;
+ case XML_TOK_TEXT_LEVEL_ATTR_BULLET_CHAR:
+ cBullet = rValue[0];
+ break;
+ case XML_TOK_TEXT_LEVEL_ATTR_HREF:
+ if( bImage )
+ sImageURL = rValue;
+ break;
+ case XML_TOK_TEXT_LEVEL_ATTR_TYPE:
+ case XML_TOK_TEXT_LEVEL_ATTR_SHOW:
+ case XML_TOK_TEXT_LEVEL_ATTR_ACTUATE:
+ // This properties will be ignored
+ break;
+ case XML_TOK_TEXT_LEVEL_ATTR_NUM_FORMAT:
+ if( bNum )
+ sNumFormat = rValue;
+ break;
+ case XML_TOK_TEXT_LEVEL_ATTR_NUM_PREFIX:
+ sPrefix = rValue;
+ break;
+ case XML_TOK_TEXT_LEVEL_ATTR_NUM_SUFFIX:
+ sSuffix = rValue;
+ break;
+ case XML_TOK_TEXT_LEVEL_ATTR_NUM_LETTER_SYNC:
+ if( bNum )
+ sNumLetterSync = rValue;
+ break;
+ case XML_TOK_TEXT_LEVEL_ATTR_START_VALUE:
+ if( bNum )
+ {
+ sal_Int32 nTmp = rValue.toInt32();
+ nNumStartValue =
+ (nTmp < 0L) ? 1 : ( (nTmp>SHRT_MAX) ? SHRT_MAX
+ : (sal_Int16)nTmp );
+ }
+ break;
+ case XML_TOK_TEXT_LEVEL_ATTR_DISPLAY_LEVELS:
+ if( bNum )
+ {
+ sal_Int32 nTmp = rValue.toInt32();
+ nNumDisplayLevels =
+ (nTmp < 1L) ? 1 : ( (nTmp>SHRT_MAX) ? SHRT_MAX
+ : (sal_Int16)nTmp );
+ }
+ break;
+ }
+ }
+}
+
+SvxXMLListLevelStyleContext_Impl::~SvxXMLListLevelStyleContext_Impl()
+{
+}
+
+SvXMLImportContext *SvxXMLListLevelStyleContext_Impl::CreateChildContext(
+ sal_uInt16 nPrefix, const OUString& rLocalName,
+ const Reference< xml::sax::XAttributeList > & xAttrList )
+{
+ SvXMLImportContext *pContext = 0;
+ if( XML_NAMESPACE_STYLE == nPrefix &&
+ ( IsXMLToken( rLocalName, XML_LIST_LEVEL_PROPERTIES ) ||
+ IsXMLToken( rLocalName, XML_TEXT_PROPERTIES ) ) )
+ {
+ pContext = new SvxXMLListLevelStyleAttrContext_Impl( GetImport(),
+ nPrefix,
+ rLocalName,
+ xAttrList,
+ *this );
+ }
+ else if( (XML_NAMESPACE_OFFICE == nPrefix) && xmloff::token::IsXMLToken( rLocalName,
+ xmloff::token::XML_BINARY_DATA ) )
+ {
+ if( bImage && !sImageURL.getLength() && !xBase64Stream.is() )
+ {
+ xBase64Stream = GetImport().GetStreamForGraphicObjectURLFromBase64();
+ if( xBase64Stream.is() )
+ pContext = new XMLBase64ImportContext( GetImport(), nPrefix,
+ rLocalName, xAttrList,
+ xBase64Stream );
+ }
+ }
+ if( !pContext )
+ {
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+ }
+
+ return pContext;
+}
+
+Sequence<beans::PropertyValue> SvxXMLListLevelStyleContext_Impl::GetProperties(
+ const SvI18NMap *pI18NMap )
+{
+ sal_Int16 eType;
+
+ sal_Int32 nCount = 0;
+ if( bBullet )
+ {
+ eType = NumberingType::CHAR_SPECIAL;
+ nCount = cBullet ? 15 : 14;
+ }
+ if( bImage )
+ {
+ eType = NumberingType::BITMAP;
+ nCount = 15;
+
+ if( (sImageURL.getLength() > 0L) || xBase64Stream.is() )
+ nCount++;
+ }
+ if( bNum )
+ {
+ eType = NumberingType::ARABIC;
+ GetImport().GetMM100UnitConverter().convertNumFormat(
+ eType, sNumFormat, sNumLetterSync, sal_True );
+ nCount = 15;
+ }
+
+ if( ( bBullet || bNum ) && nRelSize )
+ nCount++;
+
+ if( !bImage && bHasColor )
+ {
+ nCount++;
+ }
+
+ if (bBullet && sSuffix.getLength())
+ {
+ sal_uInt16 const nVersion(GetImport().getGeneratorVersion());
+ sal_Int32 nUPD;
+ sal_Int32 nBuildId;
+ if (GetImport().getBuildIds(nUPD, nBuildId)
+ && ( (SvXMLImport::OOo_1x == nVersion)
+ || (SvXMLImport::OOo_2x == nVersion)
+ || (310 == nUPD) || (320 == nUPD) || (330 == nUPD)
+ || ((300 == nUPD) && (nBuildId <= 9573))))
+ {
+ // #i93908# OOo < 3.4 wrote a bogus suffix for bullet chars
+ sSuffix = ::rtl::OUString(); // clear it
+ }
+ }
+
+ Sequence<beans::PropertyValue> aPropSeq( nCount );
+ if( nCount > 0 )
+ {
+ beans::PropertyValue *pProps = aPropSeq.getArray();
+ sal_Int32 nPos = 0;
+ pProps[nPos].Name =
+ OUString(RTL_CONSTASCII_USTRINGPARAM( XML_UNO_NAME_NRULE_NUMBERINGTYPE ));
+ pProps[nPos++].Value <<= (sal_Int16)eType ;
+
+ pProps[nPos].Name = OUString(RTL_CONSTASCII_USTRINGPARAM( XML_UNO_NAME_NRULE_PREFIX ));
+ pProps[nPos++].Value <<= sPrefix;
+
+ pProps[nPos].Name = OUString(RTL_CONSTASCII_USTRINGPARAM( XML_UNO_NAME_NRULE_SUFFIX ));
+ pProps[nPos++].Value <<= sSuffix;
+
+ pProps[nPos].Name = OUString(RTL_CONSTASCII_USTRINGPARAM( XML_UNO_NAME_NRULE_ADJUST ));
+ pProps[nPos++].Value <<= eAdjust;
+
+ sal_Int32 nLeftMargin = nSpaceBefore + nMinLabelWidth;
+ pProps[nPos].Name =
+ OUString(RTL_CONSTASCII_USTRINGPARAM( XML_UNO_NAME_NRULE_LEFT_MARGIN ));
+ pProps[nPos++].Value <<= (sal_Int32)nLeftMargin;
+
+ sal_Int32 nFirstLineOffset = -nMinLabelWidth;
+
+ pProps[nPos].Name =
+ OUString(RTL_CONSTASCII_USTRINGPARAM( XML_UNO_NAME_NRULE_FIRST_LINE_OFFSET ));
+ pProps[nPos++].Value <<= (sal_Int32)nFirstLineOffset;
+
+ pProps[nPos].Name =
+ OUString(RTL_CONSTASCII_USTRINGPARAM(XML_UNO_NAME_NRULE_SYMBOL_TEXT_DISTANCE));
+ pProps[nPos++].Value <<= (sal_Int16)nMinLabelDist;
+
+ pProps[nPos].Name =
+ OUString(RTL_CONSTASCII_USTRINGPARAM(XML_UNO_NAME_NRULE_POSITION_AND_SPACE_MODE));
+ pProps[nPos++].Value <<= (sal_Int16)ePosAndSpaceMode;
+ pProps[nPos].Name =
+ OUString(RTL_CONSTASCII_USTRINGPARAM(XML_UNO_NAME_NRULE_LABEL_FOLLOWED_BY));
+ pProps[nPos++].Value <<= (sal_Int16)eLabelFollowedBy;
+ pProps[nPos].Name =
+ OUString(RTL_CONSTASCII_USTRINGPARAM(XML_UNO_NAME_NRULE_LISTTAB_STOP_POSITION));
+ pProps[nPos++].Value <<= (sal_Int32)nListtabStopPosition;
+ pProps[nPos].Name =
+ OUString(RTL_CONSTASCII_USTRINGPARAM(XML_UNO_NAME_NRULE_FIRST_LINE_INDENT));
+ pProps[nPos++].Value <<= (sal_Int32)nFirstLineIndent;
+ pProps[nPos].Name =
+ OUString(RTL_CONSTASCII_USTRINGPARAM(XML_UNO_NAME_NRULE_INDENT_AT));
+ pProps[nPos++].Value <<= (sal_Int32)nIndentAt;
+
+ OUString sDisplayTextStyleName = GetImport().GetStyleDisplayName(
+ XML_STYLE_FAMILY_TEXT_TEXT, sTextStyleName );
+ OUString sStyleName = sDisplayTextStyleName;
+ if( sStyleName.getLength() && pI18NMap )
+ sStyleName = pI18NMap->Get( SFX_STYLE_FAMILY_CHAR, sStyleName );
+ pProps[nPos].Name =
+ OUString(RTL_CONSTASCII_USTRINGPARAM( XML_UNO_NAME_NRULE_CHAR_STYLE_NAME ));
+ pProps[nPos++].Value <<= sDisplayTextStyleName;
+
+ if( bBullet )
+ {
+ awt::FontDescriptor aFDesc;
+ aFDesc.Name = sBulletFontName;
+ if( sBulletFontName.getLength() )
+ {
+ aFDesc.StyleName = sBulletFontStyleName;
+ aFDesc.Family = eBulletFontFamily;
+ aFDesc.Pitch = eBulletFontPitch;
+ aFDesc.CharSet = eBulletFontEncoding;
+ aFDesc.Weight = WEIGHT_DONTKNOW;
+ sal_Bool bStarSymbol = sal_False;
+ if( aFDesc.Name.equalsIgnoreAsciiCase( sStarBats ) )
+ {
+ cBullet = GetImport().ConvStarBatsCharToStarSymbol( cBullet );
+ bStarSymbol = sal_True;
+ }
+ else if( aFDesc.Name.equalsIgnoreAsciiCase( sStarMath ) )
+ {
+ cBullet = GetImport().ConvStarMathCharToStarSymbol( cBullet );
+ bStarSymbol = sal_True;
+ }
+ if( bStarSymbol )
+ aFDesc.Name =
+ OUString( RTL_CONSTASCII_USTRINGPARAM("StarSymbol" ) );
+ }
+
+ if( cBullet )
+ {
+ OUStringBuffer sTmp(1);
+ sTmp.append( cBullet );
+ pProps[nPos].Name =
+ OUString(RTL_CONSTASCII_USTRINGPARAM( XML_UNO_NAME_NRULE_BULLET_CHAR ));
+ pProps[nPos++].Value <<= sTmp.makeStringAndClear();
+ }
+
+ pProps[nPos].Name =
+ OUString(RTL_CONSTASCII_USTRINGPARAM( XML_UNO_NAME_NRULE_BULLET_FONT ));
+ pProps[nPos++].Value <<= aFDesc;
+
+ }
+
+ if( bImage )
+ {
+ OUString sStr( sImageURL );
+ if( sImageURL.getLength() )
+ {
+ sStr = GetImport().ResolveGraphicObjectURL( sImageURL,
+ sal_False );
+ }
+ else if( xBase64Stream.is() )
+ {
+ sStr = GetImport().ResolveGraphicObjectURLFromBase64( xBase64Stream );
+ }
+
+ if( sStr.getLength() )
+ {
+ pProps[nPos].Name =
+ OUString(RTL_CONSTASCII_USTRINGPARAM( XML_UNO_NAME_NRULE_GRAPHICURL ));
+ pProps[nPos++].Value <<= sStr;
+ }
+
+ awt::Size aSize( nImageWidth, nImageHeight );
+ pProps[nPos].Name =
+ OUString(RTL_CONSTASCII_USTRINGPARAM( XML_UNO_NAME_NRULE_GRAPHIC_SIZE ));
+ pProps[nPos++].Value <<= aSize;
+
+ pProps[nPos].Name =
+ OUString(RTL_CONSTASCII_USTRINGPARAM( XML_UNO_NAME_NRULE_VERT_ORIENT ));
+ pProps[nPos++].Value <<= (sal_Int16)eImageVertOrient;
+ }
+
+ if( bNum )
+ {
+ pProps[nPos].Name =
+ OUString(RTL_CONSTASCII_USTRINGPARAM( XML_UNO_NAME_NRULE_START_WITH ));
+ pProps[nPos++].Value <<= (sal_Int16)nNumStartValue;
+
+ pProps[nPos].Name =
+ OUString(RTL_CONSTASCII_USTRINGPARAM(XML_UNO_NAME_NRULE_PARENT_NUMBERING));
+ pProps[nPos++].Value <<= (sal_Int16)nNumDisplayLevels;
+ }
+
+ if( ( bNum || bBullet ) && nRelSize )
+ {
+ pProps[nPos].Name =
+ OUString(RTL_CONSTASCII_USTRINGPARAM( XML_UNO_NAME_NRULE_BULLET_RELSIZE ));
+ pProps[nPos++].Value <<= nRelSize;
+ }
+
+ if( !bImage && bHasColor )
+ {
+ pProps[nPos].Name = OUString(RTL_CONSTASCII_USTRINGPARAM( XML_UNO_NAME_NRULE_BULLET_COLOR ));
+ pProps[nPos++].Value <<= (sal_Int32)aColor.GetColor();
+ }
+
+ DBG_ASSERT( nPos == nCount, "array under/overflow" );
+ }
+
+ return aPropSeq;
+}
+
+// ---------------------------------------------------------------------
+
+enum SvxXMLStyleAttributesAttrTokens
+{
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_SPACE_BEFORE,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_MIN_LABEL_WIDTH,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_MIN_LABEL_DIST,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_TEXT_ALIGN,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_NAME,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_FAMILY,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_FAMILY_GENERIC,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_STYLENAME,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_PITCH,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_CHARSET,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_VERTICAL_POS,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_VERTICAL_REL,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_WIDTH,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_HEIGHT,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_COLOR,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_WINDOW_FONT_COLOR,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_SIZE,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_POSITION_AND_SPACE_MODE,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_END=XML_TOK_UNKNOWN
+};
+const SvXMLTokenMapEntry* lcl_getStyleAttributesAttrTokenMap()
+{
+ static SvXMLTokenMapEntry aStyleAttributesAttrTokenMap[] =
+ {
+ { XML_NAMESPACE_TEXT, XML_SPACE_BEFORE,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_SPACE_BEFORE },
+ { XML_NAMESPACE_TEXT, XML_MIN_LABEL_WIDTH,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_MIN_LABEL_WIDTH },
+ { XML_NAMESPACE_TEXT, XML_MIN_LABEL_DISTANCE,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_MIN_LABEL_DIST },
+ { XML_NAMESPACE_FO, XML_TEXT_ALIGN,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_TEXT_ALIGN },
+ { XML_NAMESPACE_STYLE, XML_FONT_NAME,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_NAME },
+ { XML_NAMESPACE_FO, XML_FONT_FAMILY,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_FAMILY },
+ { XML_NAMESPACE_STYLE, XML_FONT_FAMILY_GENERIC,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_FAMILY_GENERIC },
+ { XML_NAMESPACE_STYLE, XML_FONT_STYLE_NAME,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_STYLENAME },
+ { XML_NAMESPACE_STYLE, XML_FONT_PITCH,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_PITCH },
+ { XML_NAMESPACE_STYLE, XML_FONT_CHARSET,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_CHARSET },
+ { XML_NAMESPACE_STYLE, XML_VERTICAL_POS,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_VERTICAL_POS },
+ { XML_NAMESPACE_STYLE, XML_VERTICAL_REL,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_VERTICAL_REL },
+ { XML_NAMESPACE_FO, XML_WIDTH,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_WIDTH },
+ { XML_NAMESPACE_FO, XML_HEIGHT,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_HEIGHT },
+ { XML_NAMESPACE_FO, XML_COLOR,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_COLOR },
+ { XML_NAMESPACE_STYLE, XML_USE_WINDOW_FONT_COLOR,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_WINDOW_FONT_COLOR },
+ { XML_NAMESPACE_FO, XML_FONT_SIZE,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_SIZE },
+ { XML_NAMESPACE_TEXT, XML_LIST_LEVEL_POSITION_AND_SPACE_MODE,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_POSITION_AND_SPACE_MODE },
+ XML_TOKEN_MAP_END
+ };
+ return aStyleAttributesAttrTokenMap;
+}
+SvxXMLListLevelStyleAttrContext_Impl::SvxXMLListLevelStyleAttrContext_Impl(
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const Reference< xml::sax::XAttributeList > & xAttrList,
+ SvxXMLListLevelStyleContext_Impl& rLLevel ) :
+ SvXMLImportContext( rImport, nPrfx, rLName ),
+ rListLevel( rLLevel )
+{
+ SvXMLTokenMap aTokenMap( lcl_getStyleAttributesAttrTokenMap() );
+ SvXMLUnitConverter& rUnitConv = GetImport().GetMM100UnitConverter();
+
+ OUString sFontName, sFontFamily, sFontStyleName, sFontFamilyGeneric,
+ sFontPitch, sFontCharset;
+ OUString sVerticalPos, sVerticalRel;
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ const OUString& rValue = xAttrList->getValueByIndex( i );
+
+ sal_Int32 nVal;
+ switch( aTokenMap.Get( nPrefix, aLocalName ) )
+ {
+ case XML_TOK_STYLE_ATTRIBUTES_ATTR_SPACE_BEFORE:
+ if( rUnitConv.convertMeasure( nVal, rValue, SHRT_MIN, SHRT_MAX ) )
+ rListLevel.SetSpaceBefore( nVal );
+ break;
+ case XML_TOK_STYLE_ATTRIBUTES_ATTR_MIN_LABEL_WIDTH:
+ if( rUnitConv.convertMeasure( nVal, rValue, 0, SHRT_MAX ) )
+ rListLevel.SetMinLabelWidth( nVal );
+ break;
+ case XML_TOK_STYLE_ATTRIBUTES_ATTR_MIN_LABEL_DIST:
+ if( rUnitConv.convertMeasure( nVal, rValue, 0, USHRT_MAX ) )
+ rListLevel.SetMinLabelDist( nVal );
+ break;
+ case XML_TOK_STYLE_ATTRIBUTES_ATTR_TEXT_ALIGN:
+ if( rValue.getLength() )
+ {
+ sal_Int16 eAdjust = HoriOrientation::LEFT;
+ if( IsXMLToken( rValue, XML_CENTER ) )
+ eAdjust = HoriOrientation::CENTER;
+ else if( IsXMLToken( rValue, XML_END ) )
+ eAdjust = HoriOrientation::RIGHT;
+ rListLevel.SetAdjust( eAdjust );
+ }
+ break;
+ case XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_NAME:
+ sFontName = rValue;
+ break;
+ case XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_FAMILY:
+ sFontFamily = rValue;
+ break;
+ case XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_FAMILY_GENERIC:
+ sFontFamilyGeneric = rValue;
+ break;
+ case XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_STYLENAME:
+ sFontStyleName = rValue;
+ break;
+ case XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_PITCH:
+ sFontPitch = rValue;
+ break;
+ case XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_CHARSET:
+ sFontCharset = rValue;
+ break;
+ case XML_TOK_STYLE_ATTRIBUTES_ATTR_VERTICAL_POS:
+ sVerticalPos = rValue;
+ break;
+ case XML_TOK_STYLE_ATTRIBUTES_ATTR_VERTICAL_REL:
+ sVerticalRel = rValue;
+ break;
+ case XML_TOK_STYLE_ATTRIBUTES_ATTR_WIDTH:
+ if( rUnitConv.convertMeasure( nVal, rValue, 0, SAL_MAX_INT32) )
+ rListLevel.SetImageWidth( nVal );
+ break;
+ case XML_TOK_STYLE_ATTRIBUTES_ATTR_HEIGHT:
+ if( rUnitConv.convertMeasure( nVal, rValue, 0, SAL_MAX_INT32) )
+ rListLevel.SetImageHeight( nVal );
+ break;
+ case XML_TOK_STYLE_ATTRIBUTES_ATTR_COLOR:
+ {
+ Color aColor;
+ if( SvXMLUnitConverter::convertColor( aColor, rValue ) )
+ rListLevel.SetColor( (sal_Int32)aColor.GetColor() );
+ }
+ break;
+ case XML_TOK_STYLE_ATTRIBUTES_ATTR_WINDOW_FONT_COLOR:
+ {
+ if( IsXMLToken( rValue, XML_TRUE ) )
+ rListLevel.SetColor( (sal_Int32)0xffffffff );
+ }
+ break;
+ case XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_SIZE:
+ if(SvXMLUnitConverter::convertPercent( nVal, rValue ) )
+ rListLevel.SetRelSize( (sal_Int16)nVal );
+ break;
+ case XML_TOK_STYLE_ATTRIBUTES_ATTR_POSITION_AND_SPACE_MODE:
+ {
+ sal_Int16 ePosAndSpaceMode = PositionAndSpaceMode::LABEL_WIDTH_AND_POSITION;
+ if( IsXMLToken( rValue, XML_LABEL_ALIGNMENT ) )
+ ePosAndSpaceMode = PositionAndSpaceMode::LABEL_ALIGNMENT;
+ rListLevel.SetPosAndSpaceMode( ePosAndSpaceMode );
+ }
+ break;
+ }
+ }
+
+ if( sFontName.getLength() )
+ {
+ const XMLFontStylesContext *pFontDecls =
+ GetImport().GetTextImport()->GetFontDecls();
+ if( pFontDecls )
+ {
+ ::std::vector < XMLPropertyState > aProps;
+ if( pFontDecls->FillProperties( sFontName, aProps, 0, 1, 2, 3, 4 ) )
+ {
+ OUString sTmp;
+ sal_Int16 nTmp = 0;
+ ::std::vector< XMLPropertyState >::iterator i;
+ for( i = aProps.begin(); i != aProps.end(); i++ )
+ {
+ switch( i->mnIndex )
+ {
+ case 0:
+ i->maValue >>= sTmp;
+ rListLevel.SetBulletFontName( sTmp);
+ break;
+ case 1:
+ i->maValue >>= sTmp;
+ rListLevel.SetBulletFontStyleName( sTmp );
+ break;
+ case 2:
+ i->maValue >>= nTmp;
+ rListLevel.SetBulletFontFamily( nTmp );
+ break;
+ case 3:
+ i->maValue >>= nTmp;
+ rListLevel.SetBulletFontPitch( nTmp );
+ break;
+ case 4:
+ i->maValue >>= nTmp;
+ rListLevel.SetBulletFontEncoding( nTmp );
+ break;
+ }
+ }
+ }
+ }
+ }
+ if( sFontFamily.getLength() )
+ {
+ String sEmpty;
+ Any aAny;
+
+ XMLFontFamilyNamePropHdl aFamilyNameHdl;
+ if( aFamilyNameHdl.importXML( sFontFamily, aAny, rUnitConv ) )
+ {
+ OUString sTmp;
+ aAny >>= sTmp;
+ rListLevel.SetBulletFontName( sTmp);
+ }
+
+ XMLFontFamilyPropHdl aFamilyHdl;
+ if( sFontFamilyGeneric.getLength() &&
+ aFamilyHdl.importXML( sFontFamilyGeneric, aAny, rUnitConv ) )
+ {
+ sal_Int16 nTmp = 0;
+ aAny >>= nTmp;
+ rListLevel.SetBulletFontFamily( nTmp );
+ }
+
+ if( sFontStyleName.getLength() )
+ rListLevel.SetBulletFontStyleName( sFontStyleName );
+
+ XMLFontPitchPropHdl aPitchHdl;
+ if( sFontPitch.getLength() &&
+ aPitchHdl.importXML( sFontPitch, aAny, rUnitConv ) )
+ {
+ sal_Int16 nTmp = 0;
+ aAny >>= nTmp;
+ rListLevel.SetBulletFontPitch( nTmp );
+ }
+
+ XMLFontEncodingPropHdl aEncHdl;
+ if( sFontCharset.getLength() &&
+ aEncHdl.importXML( sFontCharset, aAny, rUnitConv ) )
+ {
+ sal_Int16 nTmp = 0;
+ aAny >>= nTmp;
+ rListLevel.SetBulletFontEncoding( nTmp );
+ }
+ }
+
+ sal_Int16 eVertOrient = VertOrientation::LINE_CENTER;
+ if( sVerticalPos.getLength() )
+ {
+ if( IsXMLToken( sVerticalPos, XML_TOP ) )
+ eVertOrient = VertOrientation::LINE_TOP;
+ else if( IsXMLToken( sVerticalPos, XML_BOTTOM ) )
+ eVertOrient = VertOrientation::LINE_BOTTOM;
+ }
+ if( sVerticalRel.getLength() )
+ {
+ if( IsXMLToken( sVerticalRel, XML_BASELINE ) )
+ {
+ // TOP and BOTTOM are exchanged for a baseline relation
+ switch( eVertOrient )
+ {
+ case VertOrientation::LINE_TOP:
+ eVertOrient = VertOrientation::BOTTOM;
+ break;
+ case VertOrientation::LINE_CENTER:
+ eVertOrient = VertOrientation::CENTER;
+ break;
+ case VertOrientation::LINE_BOTTOM:
+ eVertOrient = VertOrientation::TOP;
+ break;
+ }
+ }
+ else if( IsXMLToken( sVerticalRel, XML_CHAR ) )
+ {
+ switch( eVertOrient )
+ {
+ case VertOrientation::LINE_TOP:
+ eVertOrient = VertOrientation::CHAR_TOP;
+ break;
+ case VertOrientation::LINE_CENTER:
+ eVertOrient = VertOrientation::CHAR_CENTER;
+ break;
+ case VertOrientation::LINE_BOTTOM:
+ eVertOrient = VertOrientation::CHAR_BOTTOM;
+ break;
+ }
+ }
+ }
+ rListLevel.SetImageVertOrient( eVertOrient );
+}
+
+SvxXMLListLevelStyleAttrContext_Impl::~SvxXMLListLevelStyleAttrContext_Impl()
+{
+}
+
+SvXMLImportContext* SvxXMLListLevelStyleAttrContext_Impl::CreateChildContext(
+ sal_uInt16 nPrefix, const OUString& rLocalName,
+ const Reference< xml::sax::XAttributeList > & xAttrList )
+{
+ SvXMLImportContext *pContext = 0;
+ if ( XML_NAMESPACE_STYLE == nPrefix &&
+ IsXMLToken( rLocalName, XML_LIST_LEVEL_LABEL_ALIGNMENT ) )
+ {
+ pContext = new SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl( GetImport(),
+ nPrefix,
+ rLocalName,
+ xAttrList,
+ rListLevel );
+ }
+ if( !pContext )
+ {
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+ }
+
+ return pContext;
+}
+
+// ---------------------------------------------------------------------
+
+enum SvxXMLStyleAttributesLabelAlignmentAttrTokens
+{
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_LABEL_FOLLOWED_BY,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_LISTTAB_STOP_POSITION,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_FIRST_LINE_INDENT,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_INDENT_AT,
+
+ XML_TOK_STYLE_ATTRIBUTES_LABEL_ALIGNMENT_ATTR_END=XML_TOK_UNKNOWN
+};
+const SvXMLTokenMapEntry* lcl_getStyleAlignmentAttributesAttrTokenMap()
+{
+ static SvXMLTokenMapEntry aStyleAlignmentAttributesAttrTokenMap[] =
+ {
+ { XML_NAMESPACE_TEXT, XML_LABEL_FOLLOWED_BY,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_LABEL_FOLLOWED_BY },
+ { XML_NAMESPACE_TEXT, XML_LIST_TAB_STOP_POSITION,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_LISTTAB_STOP_POSITION },
+ { XML_NAMESPACE_FO, XML_TEXT_INDENT,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_FIRST_LINE_INDENT },
+ { XML_NAMESPACE_FO, XML_MARGIN_LEFT,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_INDENT_AT },
+
+ XML_TOKEN_MAP_END
+ };
+ return aStyleAlignmentAttributesAttrTokenMap;
+}
+SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl::SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl(
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const Reference< xml::sax::XAttributeList > & xAttrList,
+ SvxXMLListLevelStyleContext_Impl& rLLevel ) :
+ SvXMLImportContext( rImport, nPrfx, rLName ),
+ rListLevel( rLLevel )
+{
+ SvXMLTokenMap aTokenMap( lcl_getStyleAlignmentAttributesAttrTokenMap() );
+ SvXMLUnitConverter& rUnitConv = GetImport().GetMM100UnitConverter();
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ const OUString& rValue = xAttrList->getValueByIndex( i );
+
+ sal_Int32 nVal;
+ switch( aTokenMap.Get( nPrefix, aLocalName ) )
+ {
+ case XML_TOK_STYLE_ATTRIBUTES_ATTR_LABEL_FOLLOWED_BY:
+ {
+ sal_Int16 eLabelFollowedBy = LabelFollow::LISTTAB;
+ if( IsXMLToken( rValue, XML_SPACE ) )
+ eLabelFollowedBy = LabelFollow::SPACE;
+ else if( IsXMLToken( rValue, XML_NOTHING ) )
+ eLabelFollowedBy = LabelFollow::NOTHING;
+ rListLevel.SetLabelFollowedBy( eLabelFollowedBy );
+ }
+ break;
+ case XML_TOK_STYLE_ATTRIBUTES_ATTR_LISTTAB_STOP_POSITION:
+ if( rUnitConv.convertMeasure( nVal, rValue, 0, SHRT_MAX ) )
+ rListLevel.SetListtabStopPosition( nVal );
+ break;
+ case XML_TOK_STYLE_ATTRIBUTES_ATTR_FIRST_LINE_INDENT:
+ if( rUnitConv.convertMeasure( nVal, rValue, SHRT_MIN, SHRT_MAX ) )
+ rListLevel.SetFirstLineIndent( nVal );
+ break;
+ case XML_TOK_STYLE_ATTRIBUTES_ATTR_INDENT_AT:
+ if( rUnitConv.convertMeasure( nVal, rValue, SHRT_MIN, SHRT_MAX ) )
+ rListLevel.SetIndentAt( nVal );
+ break;
+ }
+ }
+}
+
+SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl::~SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl()
+{
+}
+
+// ---------------------------------------------------------------------
+
+typedef SvxXMLListLevelStyleContext_Impl *SvxXMLListLevelStyleContext_ImplPtr;
+SV_DECL_PTRARR( SvxXMLListStyle_Impl, SvxXMLListLevelStyleContext_ImplPtr,
+ 10, 5 )
+
+void SvxXMLListStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
+ const OUString& rLocalName,
+ const OUString& rValue )
+{
+ if( XML_NAMESPACE_TEXT == nPrefixKey &&
+ IsXMLToken( rLocalName, XML_CONSECUTIVE_NUMBERING ) )
+ {
+ bConsecutive = IsXMLToken( rValue, XML_TRUE );
+ }
+ else
+ {
+ SvXMLStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
+ }
+}
+
+
+SvxXMLListStyleContext::SvxXMLListStyleContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const Reference< xml::sax::XAttributeList > & xAttrList,
+ sal_Bool bOutl )
+: SvXMLStyleContext( rImport, nPrfx, rLName, xAttrList, bOutl ? XML_STYLE_FAMILY_TEXT_OUTLINE : XML_STYLE_FAMILY_TEXT_LIST )
+, sIsPhysical( RTL_CONSTASCII_USTRINGPARAM( "IsPhysical" ) )
+, sNumberingRules( RTL_CONSTASCII_USTRINGPARAM( "NumberingRules" ) )
+, sName( RTL_CONSTASCII_USTRINGPARAM( "Name" ) )
+, sIsContinuousNumbering( RTL_CONSTASCII_USTRINGPARAM( "IsContinuousNumbering" ) )
+, pLevelStyles( 0 )
+, nLevels( 0 )
+, bConsecutive( sal_False )
+, bOutline( bOutl )
+{
+}
+
+SvxXMLListStyleContext::~SvxXMLListStyleContext()
+{
+ if( pLevelStyles )
+ {
+ while( pLevelStyles->Count() )
+ {
+ sal_uInt16 n = pLevelStyles->Count() - 1;
+ SvxXMLListLevelStyleContext_Impl *pStyle = (*pLevelStyles)[n];
+ pLevelStyles->Remove( n, 1 );
+ pStyle->ReleaseRef();
+ }
+ }
+
+ delete pLevelStyles;
+}
+
+TYPEINIT1( SvxXMLListStyleContext, SvXMLStyleContext );
+
+SvXMLImportContext *SvxXMLListStyleContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference< xml::sax::XAttributeList > & xAttrList )
+{
+ SvXMLImportContext *pContext = 0;
+
+ if( XML_NAMESPACE_TEXT == nPrefix &&
+ ( bOutline
+ ? IsXMLToken( rLocalName, XML_OUTLINE_LEVEL_STYLE )
+ : ( IsXMLToken( rLocalName, XML_LIST_LEVEL_STYLE_NUMBER ) ||
+ IsXMLToken( rLocalName, XML_LIST_LEVEL_STYLE_BULLET ) ||
+ IsXMLToken( rLocalName, XML_LIST_LEVEL_STYLE_IMAGE ) ) ) )
+ {
+ SvxXMLListLevelStyleContext_Impl *pLevelStyle =
+ new SvxXMLListLevelStyleContext_Impl( GetImport(), nPrefix,
+ rLocalName, xAttrList );
+ if( !pLevelStyles )
+ pLevelStyles = new SvxXMLListStyle_Impl;
+ pLevelStyles->Insert( pLevelStyle, pLevelStyles->Count() );
+ pLevelStyle->AddRef();
+
+ pContext = pLevelStyle;
+ }
+ else
+ {
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+ }
+
+ return pContext;
+}
+
+void SvxXMLListStyleContext::FillUnoNumRule(
+ const Reference< container::XIndexReplace > & rNumRule,
+ const SvI18NMap *pI18NMap ) const
+{
+ try
+ {
+ if( pLevelStyles && rNumRule.is() )
+ {
+ sal_uInt16 nCount = pLevelStyles->Count();
+ sal_Int32 l_nLevels = rNumRule->getCount();
+ for( sal_uInt16 i=0; i < nCount; i++ )
+ {
+ SvxXMLListLevelStyleContext_Impl *pLevelStyle =
+ (*pLevelStyles)[i];
+ sal_Int32 nLevel = pLevelStyle->GetLevel();
+ if( nLevel >= 0 && nLevel < l_nLevels )
+ {
+ Sequence<beans::PropertyValue> aProps =
+ pLevelStyle->GetProperties( pI18NMap );
+ Any aAny;
+ aAny <<= aProps;
+ rNumRule->replaceByIndex( nLevel, aAny );
+ }
+ }
+ }
+
+ Reference < XPropertySet > xPropSet( rNumRule, UNO_QUERY );
+ Reference< XPropertySetInfo > xPropSetInfo;
+ if (xPropSet.is())
+ xPropSetInfo = xPropSet->getPropertySetInfo();
+ if( xPropSetInfo.is() &&
+ xPropSetInfo->hasPropertyByName( sIsContinuousNumbering ) )
+ {
+ Any aAny;
+ sal_Bool bTmp = bConsecutive;
+ aAny.setValue( &bTmp, ::getBooleanCppuType() );
+ xPropSet->setPropertyValue( sIsContinuousNumbering, aAny );
+ }
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL( "SvxXMLListStyleContext::FillUnoNumRule - Exception catched" );
+ }
+}
+
+void SvxXMLListStyleContext::CreateAndInsertLate( sal_Bool bOverwrite )
+{
+ if( bOutline )
+ {
+ if( bOverwrite )
+ {
+ const Reference< XIndexReplace >& rNumRule =
+ GetImport().GetTextImport()->GetChapterNumbering();
+ // We don't set xNumberingRules here, to avoid using them
+ // as numbering rules.
+ if( rNumRule.is() )
+ FillUnoNumRule( rNumRule, 0 );
+ }
+ }
+ else
+ {
+ Reference < XStyle > xStyle;
+ const OUString& rName = GetDisplayName();
+ if( 0 == rName.getLength() )
+ {
+ SetValid( sal_False );
+ return;
+ }
+
+ const Reference < XNameContainer >& rNumStyles =
+ GetImport().GetTextImport()->GetNumberingStyles();
+ if( !rNumStyles.is() )
+ {
+ SetValid( sal_False );
+ return;
+ }
+
+ sal_Bool bNew = sal_False;
+ if( rNumStyles->hasByName( rName ) )
+ {
+ Any aAny = rNumStyles->getByName( rName );
+ aAny >>= xStyle;
+ }
+ else
+ {
+ Reference< XMultiServiceFactory > xFactory( GetImport().GetModel(),
+ UNO_QUERY );
+ DBG_ASSERT( xFactory.is(), "no factory" );
+ if( !xFactory.is() )
+ return;
+
+ Reference < XInterface > xIfc = xFactory->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.style.NumberingStyle")) );
+ if( !xIfc.is() )
+ return;
+ Reference < XStyle > xTmp( xIfc, UNO_QUERY );
+ xStyle = xTmp;
+ if( !xStyle.is() )
+ return;
+
+ Any aAny;
+ aAny <<= xStyle;
+ rNumStyles->insertByName( rName, aAny );
+ bNew = sal_True;
+ }
+
+ Reference < XPropertySet > xPropSet( xStyle, UNO_QUERY );
+ Reference< XPropertySetInfo > xPropSetInfo =
+ xPropSet->getPropertySetInfo();
+ if( !bNew && xPropSetInfo->hasPropertyByName( sIsPhysical ) )
+ {
+ Any aAny = xPropSet->getPropertyValue( sIsPhysical );
+ bNew = !*(sal_Bool *)aAny.getValue();
+ }
+ if( rName != GetName() )
+ GetImport().AddStyleDisplayName( XML_STYLE_FAMILY_TEXT_LIST,
+ GetName(), rName );
+
+ Any aAny = xPropSet->getPropertyValue( sNumberingRules );
+ aAny >>= xNumRules;
+ nLevels = xNumRules->getCount();
+ if( bOverwrite || bNew )
+ {
+ FillUnoNumRule( xNumRules, 0 );
+ aAny <<= xNumRules;
+ xPropSet->setPropertyValue( sNumberingRules, aAny );
+ }
+ else
+ {
+ SetValid( sal_False );
+ }
+
+ SetNew( bNew );
+ }
+}
+
+void SvxXMLListStyleContext::CreateAndInsertAuto() const
+{
+ DBG_ASSERT( !bOutline, "Outlines cannot be inserted here" );
+ DBG_ASSERT( !xNumRules.is(), "Numbering Rule is existing already" );
+
+ const OUString& rName = GetName();
+ if( bOutline || xNumRules.is() || 0 == rName.getLength() )
+ {
+ ((SvxXMLListStyleContext *)this)->SetValid( sal_False );
+ return;
+ }
+
+ ((SvxXMLListStyleContext *)this)->xNumRules = CreateNumRule(
+ GetImport().GetModel() );
+ ((SvxXMLListStyleContext *)this)->nLevels = xNumRules->getCount();
+
+ FillUnoNumRule( xNumRules, 0 );
+}
+
+Reference < XIndexReplace > SvxXMLListStyleContext::CreateNumRule(
+ const Reference < XModel > & rModel )
+{
+ Reference<XIndexReplace> xNumRule;
+
+ Reference< XMultiServiceFactory > xFactory( rModel, UNO_QUERY );
+ DBG_ASSERT( xFactory.is(), "no factory" );
+ if( !xFactory.is() )
+ return xNumRule;
+
+ Reference < XInterface > xIfc = xFactory->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.NumberingRules")) );
+ if( !xIfc.is() )
+ return xNumRule;
+
+ xNumRule = Reference<XIndexReplace>( xIfc, UNO_QUERY );
+ DBG_ASSERT( xNumRule.is(), "go no numbering rule" );
+
+ return xNumRule;
+}
+
+void SvxXMLListStyleContext::SetDefaultStyle(
+ const Reference < XIndexReplace > & rNumRule,
+ sal_Int16 nLevel,
+ sal_Bool bOrdered )
+{
+ Sequence<beans::PropertyValue> aPropSeq( bOrdered ? 1 : 4 );
+ beans::PropertyValue *pProps = aPropSeq.getArray();
+
+ pProps->Name =
+ OUString(RTL_CONSTASCII_USTRINGPARAM( XML_UNO_NAME_NRULE_NUMBERINGTYPE ));
+ (pProps++)->Value <<= (sal_Int16)(bOrdered ? NumberingType::ARABIC
+ : NumberingType::CHAR_SPECIAL );
+ if( !bOrdered )
+ {
+ // TODO: Bullet-Font
+ awt::FontDescriptor aFDesc;
+ aFDesc.Name = OUString(
+#if defined UNX
+ RTL_CONSTASCII_USTRINGPARAM( "starbats" )
+#else
+ RTL_CONSTASCII_USTRINGPARAM( "StarBats" )
+#endif
+ );
+ aFDesc.Family = FAMILY_DONTKNOW ;
+ aFDesc.Pitch = PITCH_DONTKNOW ;
+ aFDesc.CharSet = RTL_TEXTENCODING_SYMBOL ;
+ aFDesc.Weight = WEIGHT_DONTKNOW;
+ pProps->Name =
+ OUString(RTL_CONSTASCII_USTRINGPARAM( XML_UNO_NAME_NRULE_BULLET_FONT ));
+ (pProps++)->Value <<= aFDesc;
+
+ OUStringBuffer sTmp(1);
+ sTmp.append( (sal_Unicode)(0xF000 + 149) );
+ pProps->Name =
+ OUString(RTL_CONSTASCII_USTRINGPARAM( XML_UNO_NAME_NRULE_BULLET_CHAR ));
+ (pProps++)->Value <<= sTmp.makeStringAndClear();
+ pProps->Name =
+ OUString(RTL_CONSTASCII_USTRINGPARAM( XML_UNO_NAME_NRULE_CHAR_STYLE_NAME ));
+ (pProps++)->Value <<=
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "Numbering Symbols" ) );
+ }
+
+ Any aAny;
+ aAny <<= aPropSeq;
+ rNumRule->replaceByIndex( nLevel, aAny );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/xmlprcon.cxx b/xmloff/source/style/xmlprcon.cxx
new file mode 100644
index 000000000000..84c0cee372e3
--- /dev/null
+++ b/xmloff/source/style/xmlprcon.cxx
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <xmloff/xmlimp.hxx>
+
+
+#include <xmloff/xmlprcon.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::std;
+
+SvXMLPropertySetContext::SvXMLPropertySetContext(
+ SvXMLImport& rImp, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList,
+ sal_uInt32 nFam,
+ vector< XMLPropertyState > &rProps,
+ const UniReference < SvXMLImportPropertyMapper > &rMap,
+ sal_Int32 nSIdx, sal_Int32 nEIdx )
+: SvXMLImportContext( rImp, nPrfx, rLName )
+, mnStartIdx( nSIdx )
+, mnEndIdx( nEIdx )
+, mnFamily( nFam )
+, mrProperties( rProps )
+, mxMapper( rMap )
+{
+ mxMapper->importXML( mrProperties, xAttrList,
+ GetImport().GetMM100UnitConverter(),
+ GetImport().GetNamespaceMap(), mnFamily,
+ mnStartIdx, mnEndIdx );
+}
+
+SvXMLPropertySetContext::~SvXMLPropertySetContext()
+{
+}
+
+SvXMLImportContext *SvXMLPropertySetContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ UniReference< XMLPropertySetMapper > aSetMapper(
+ mxMapper->getPropertySetMapper() );
+ sal_Int32 nEntryIndex = aSetMapper->GetEntryIndex( nPrefix, rLocalName,
+ mnFamily, mnStartIdx );
+
+ if( ( nEntryIndex != -1 ) && (-1 == mnEndIdx || nEntryIndex < mnEndIdx ) &&
+ ( 0 != ( aSetMapper->GetEntryFlags( nEntryIndex )
+ & MID_FLAG_ELEMENT_ITEM_IMPORT ) ) )
+ {
+ XMLPropertyState aProp( nEntryIndex );
+ return CreateChildContext( nPrefix, rLocalName, xAttrList,
+ mrProperties, aProp );
+ }
+ else
+ {
+ return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+ }
+}
+
+/** This method is called from this instance implementation of
+ CreateChildContext if the element matches an entry in the
+ SvXMLImportItemMapper with the mid flag MID_FLAG_ELEMENT
+*/
+SvXMLImportContext *SvXMLPropertySetContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList >&,
+ ::std::vector< XMLPropertyState > &,
+ const XMLPropertyState& )
+{
+ return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/xmlprhdl.cxx b/xmloff/source/style/xmlprhdl.cxx
new file mode 100644
index 000000000000..b43377c8f70d
--- /dev/null
+++ b/xmloff/source/style/xmlprhdl.cxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <xmloff/xmlprhdl.hxx>
+#include <com/sun/star/uno/Any.hxx>
+
+XMLPropertyHandler::~XMLPropertyHandler()
+{
+ // does nothing
+}
+
+bool XMLPropertyHandler::equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const
+{
+ return (r1 == r2);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/xmlprmap.cxx b/xmloff/source/style/xmlprmap.cxx
new file mode 100644
index 000000000000..766f25bfa426
--- /dev/null
+++ b/xmloff/source/style/xmlprmap.cxx
@@ -0,0 +1,255 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#include <xmloff/xmlprhdl.hxx>
+#include "xmlbahdl.hxx"
+#include <xmloff/xmlprmap.hxx>
+#include <xmloff/xmltypes.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <xmloff/xmltoken.hxx>
+
+
+using namespace ::std;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using ::xmloff::token::GetXMLToken;
+
+XMLPropertySetMapperEntry_Impl::XMLPropertySetMapperEntry_Impl(
+ const XMLPropertyMapEntry& rMapEntry,
+ const UniReference< XMLPropertyHandlerFactory >& rFactory ) :
+ sXMLAttributeName( GetXMLToken(rMapEntry.meXMLName) ),
+ sAPIPropertyName( OUString(rMapEntry.msApiName, rMapEntry.nApiNameLength,
+ RTL_TEXTENCODING_ASCII_US ) ),
+ nXMLNameSpace( rMapEntry.mnNameSpace ),
+ nType( rMapEntry.mnType ),
+ nContextId( rMapEntry.mnContextId ),
+ nEarliestODFVersionForExport( rMapEntry.mnEarliestODFVersionForExport ),
+ pHdl( rFactory->GetPropertyHandler( rMapEntry.mnType & MID_FLAG_MASK ) )
+{
+}
+
+XMLPropertySetMapperEntry_Impl::XMLPropertySetMapperEntry_Impl(
+ const XMLPropertySetMapperEntry_Impl& rEntry ) :
+ sXMLAttributeName( rEntry.sXMLAttributeName),
+ sAPIPropertyName( rEntry.sAPIPropertyName),
+ nXMLNameSpace( rEntry.nXMLNameSpace),
+ nType( rEntry.nType),
+ nContextId( rEntry.nContextId),
+ nEarliestODFVersionForExport( rEntry.nEarliestODFVersionForExport ),
+ pHdl( rEntry.pHdl)
+{
+ DBG_ASSERT( pHdl, "Unknown XML property type handler!" );
+}
+
+///////////////////////////////////////////////////////////////////////////
+//
+// Ctor
+//
+XMLPropertySetMapper::XMLPropertySetMapper(
+ const XMLPropertyMapEntry* pEntries,
+ const UniReference< XMLPropertyHandlerFactory >& rFactory )
+{
+ aHdlFactories.push_back( rFactory );
+ if( pEntries )
+ {
+ const XMLPropertyMapEntry* pIter = pEntries;
+
+ // count entries
+ while( pIter->msApiName )
+ {
+ XMLPropertySetMapperEntry_Impl aEntry( *pIter, rFactory );
+ aMapEntries.push_back( aEntry );
+ pIter++;
+ }
+ }
+}
+
+XMLPropertySetMapper::~XMLPropertySetMapper()
+{
+}
+
+void XMLPropertySetMapper::AddMapperEntry(
+ const UniReference < XMLPropertySetMapper >& rMapper )
+{
+ for( vector < UniReference < XMLPropertyHandlerFactory > >::iterator
+ aFIter = rMapper->aHdlFactories.begin();
+ aFIter != rMapper->aHdlFactories.end();
+ ++aFIter )
+ {
+ aHdlFactories.push_back( *aFIter );
+ }
+
+ for( vector < XMLPropertySetMapperEntry_Impl >::iterator
+ aEIter = rMapper->aMapEntries.begin();
+ aEIter != rMapper->aMapEntries.end();
+ ++aEIter )
+ {
+ aMapEntries.push_back( *aEIter );
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////
+//
+// Export a Property
+//
+sal_Bool XMLPropertySetMapper::exportXML(
+ OUString& rStrExpValue,
+ const XMLPropertyState& rProperty,
+ const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+
+ const XMLPropertyHandler* pHdl = GetPropertyHandler( rProperty.mnIndex );
+
+ DBG_ASSERT( pHdl, "Unknown XML Type!" );
+ if( pHdl )
+ bRet = pHdl->exportXML( rStrExpValue, rProperty.maValue,
+ rUnitConverter );
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////
+//
+// Import a Property
+//
+sal_Bool XMLPropertySetMapper::importXML(
+ const OUString& rStrImpValue,
+ XMLPropertyState& rProperty,
+ const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+
+ const XMLPropertyHandler* pHdl = GetPropertyHandler( rProperty.mnIndex );
+
+ if( pHdl )
+ bRet = pHdl->importXML( rStrImpValue, rProperty.maValue,
+ rUnitConverter );
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////
+//
+// Search for the given name and the namespace in the list and return
+// the index of the entry
+// If there is no matching entry the method returns -1
+//
+sal_Int32 XMLPropertySetMapper::GetEntryIndex(
+ sal_uInt16 nNamespace,
+ const OUString& rStrName,
+ sal_uInt32 nPropType,
+ sal_Int32 nStartAt /* = -1 */ ) const
+{
+ sal_Int32 nEntries = GetEntryCount();
+ sal_Int32 nIndex= nStartAt == - 1? 0 : nStartAt+1;
+
+ if ( nEntries )
+ {
+ do
+ {
+ const XMLPropertySetMapperEntry_Impl& rEntry = aMapEntries[nIndex];
+ if( (!nPropType || nPropType == rEntry.GetPropType()) &&
+ rEntry.nXMLNameSpace == nNamespace &&
+ rStrName == rEntry.sXMLAttributeName )
+ return nIndex;
+ else
+ nIndex++;
+
+ } while( nIndex<nEntries );
+ }
+
+ return -1;
+}
+
+
+/** searches for an entry that matches the given api name, namespace and local name or -1 if nothing found */
+sal_Int32 XMLPropertySetMapper::FindEntryIndex(
+ const sal_Char* sApiName,
+ sal_uInt16 nNameSpace,
+ const OUString& sXMLName ) const
+{
+ sal_Int32 nIndex = 0;
+ sal_Int32 nEntries = GetEntryCount();
+
+ do
+ {
+ const XMLPropertySetMapperEntry_Impl& rEntry = aMapEntries[nIndex];
+ if( rEntry.nXMLNameSpace == nNameSpace &&
+ rEntry.sXMLAttributeName.equals( sXMLName ) &&
+ 0 == rEntry.sAPIPropertyName.compareToAscii( sApiName ) )
+ return nIndex;
+ else
+ nIndex++;
+
+ } while( nIndex < nEntries );
+
+ return -1;
+}
+
+sal_Int32 XMLPropertySetMapper::FindEntryIndex( const sal_Int16 nContextId ) const
+{
+ sal_Int32 nIndex = 0;
+ const sal_Int32 nEntries = GetEntryCount();
+
+ if ( nEntries )
+ {
+ do
+ {
+ const XMLPropertySetMapperEntry_Impl& rEntry = aMapEntries[nIndex];
+ if( rEntry.nContextId == nContextId )
+ return nIndex;
+ else
+ nIndex++;
+
+ } while( nIndex < nEntries );
+ }
+
+ return -1;
+}
+
+void XMLPropertySetMapper::RemoveEntry( sal_Int32 nIndex )
+{
+ const sal_Int32 nEntries = GetEntryCount();
+ if( nIndex>=nEntries || nIndex<0 )
+ return;
+ vector < XMLPropertySetMapperEntry_Impl >::iterator aEIter = aMapEntries.begin();
+ for( sal_Int32 nN=0; nN<nIndex; nN++ )
+ ++aEIter;
+ aMapEntries.erase( aEIter );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/xmlstyle.cxx b/xmloff/source/style/xmlstyle.cxx
new file mode 100644
index 000000000000..b3343c307193
--- /dev/null
+++ b/xmloff/source/style/xmlstyle.cxx
@@ -0,0 +1,954 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/xml/sax/SAXParseException.hpp>
+#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/SAXException.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/xml/sax/XLocator.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/style/XAutoStylesSupplier.hpp>
+#include <com/sun/star/style/XAutoStyleFamily.hpp>
+#include "PageMasterPropMapper.hxx"
+#include <tools/debug.hxx>
+#include <svl/cntnrsrt.hxx>
+#include <svl/itemset.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+
+#include <xmloff/families.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmlnumi.hxx>
+#include <xmloff/xmlimppr.hxx>
+#include <xmloff/xmlstyle.hxx>
+#include <xmloff/txtstyli.hxx>
+#include <xmloff/txtprmap.hxx>
+#include <xmloff/xmlnumfi.hxx>
+#include "XMLChartStyleContext.hxx"
+#include "XMLChartPropertySetMapper.hxx"
+#include <xmloff/XMLShapeStyleContext.hxx>
+#include "FillStyleContext.hxx"
+#include "XMLFootnoteConfigurationImportContext.hxx"
+#include "XMLIndexBibliographyConfigurationContext.hxx"
+#include "XMLLineNumberingImportContext.hxx"
+#include "PageMasterImportContext.hxx"
+#include "PageMasterImportPropMapper.hxx"
+
+#include <vector>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::std::vector;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::style;
+using namespace ::xmloff::token;
+
+// ---------------------------------------------------------------------
+
+static SvXMLTokenMapEntry aStyleStylesElemTokenMap[] =
+{
+ { XML_NAMESPACE_STYLE, XML_STYLE, XML_TOK_STYLE_STYLE },
+ { XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT, XML_TOK_STYLE_PAGE_MASTER },
+ { XML_NAMESPACE_TEXT, XML_LIST_STYLE, XML_TOK_TEXT_LIST_STYLE },
+ { XML_NAMESPACE_TEXT, XML_OUTLINE_STYLE, XML_TOK_TEXT_OUTLINE },
+ { XML_NAMESPACE_STYLE, XML_DEFAULT_STYLE, XML_TOK_STYLE_DEFAULT_STYLE },
+ { XML_NAMESPACE_DRAW, XML_GRADIENT, XML_TOK_STYLES_GRADIENTSTYLES },
+ { XML_NAMESPACE_DRAW, XML_HATCH, XML_TOK_STYLES_HATCHSTYLES },
+ { XML_NAMESPACE_DRAW, XML_FILL_IMAGE, XML_TOK_STYLES_BITMAPSTYLES },
+ { XML_NAMESPACE_DRAW, XML_OPACITY, XML_TOK_STYLES_TRANSGRADIENTSTYLES },
+ { XML_NAMESPACE_DRAW, XML_MARKER, XML_TOK_STYLES_MARKERSTYLES },
+ { XML_NAMESPACE_DRAW, XML_STROKE_DASH, XML_TOK_STYLES_DASHSTYLES },
+ { XML_NAMESPACE_TEXT, XML_NOTES_CONFIGURATION, XML_TOK_TEXT_NOTE_CONFIG },
+ { XML_NAMESPACE_TEXT, XML_BIBLIOGRAPHY_CONFIGURATION, XML_TOK_TEXT_BIBLIOGRAPHY_CONFIG },
+ { XML_NAMESPACE_TEXT, XML_LINENUMBERING_CONFIGURATION,XML_TOK_TEXT_LINENUMBERING_CONFIG },
+ { XML_NAMESPACE_STYLE, XML_DEFAULT_PAGE_LAYOUT, XML_TOK_STYLE_DEFAULT_PAGE_LAYOUT },
+ XML_TOKEN_MAP_END
+};
+
+const SvXMLTokenMap& SvXMLStylesContext::GetStyleStylesElemTokenMap()
+{
+ if( !mpStyleStylesElemTokenMap )
+ mpStyleStylesElemTokenMap =
+ new SvXMLTokenMap( aStyleStylesElemTokenMap );
+
+ return *mpStyleStylesElemTokenMap;
+}
+
+// ---------------------------------------------------------------------
+
+void SvXMLStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
+ const OUString& rLocalName,
+ const OUString& rValue )
+{
+ // TODO: use a map here
+ if( XML_NAMESPACE_STYLE == nPrefixKey )
+ {
+ if( IsXMLToken( rLocalName, XML_FAMILY ) )
+ {
+ if( IsXMLToken( rValue, XML_PARAGRAPH ) )
+ mnFamily = (sal_uInt16)SFX_STYLE_FAMILY_PARA;
+ else if( IsXMLToken( rValue, XML_TEXT ) )
+ mnFamily = (sal_uInt16)SFX_STYLE_FAMILY_CHAR;
+ }
+ else if( IsXMLToken( rLocalName, XML_NAME ) )
+ {
+ maName = rValue;
+ }
+ else if( IsXMLToken( rLocalName, XML_DISPLAY_NAME ) )
+ {
+ maDisplayName = rValue;
+ }
+ else if( IsXMLToken( rLocalName, XML_PARENT_STYLE_NAME ) )
+ {
+ maParentName = rValue;
+ }
+ else if( IsXMLToken( rLocalName, XML_NEXT_STYLE_NAME ) )
+ {
+ maFollow = rValue;
+ }
+ else if( IsXMLToken( rLocalName, XML_HELP_FILE_NAME ) )
+ {
+ maHelpFile = rValue;
+ }
+ else if( IsXMLToken( rLocalName, XML_HELP_ID ) )
+ {
+ sal_Int32 nTmp = rValue.toInt32();
+ mnHelpId =
+ (nTmp < 0L) ? 0U : ( (nTmp > USHRT_MAX) ? USHRT_MAX
+ : (sal_uInt16)nTmp );
+ }
+ }
+}
+
+TYPEINIT1( SvXMLStyleContext, SvXMLImportContext );
+
+SvXMLStyleContext::SvXMLStyleContext(
+ SvXMLImport& rImp, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList >&,
+ sal_uInt16 nFam, sal_Bool bDefault ) :
+ SvXMLImportContext( rImp, nPrfx, rLName ),
+ mnHelpId( UCHAR_MAX ),
+ mnFamily( nFam ),
+ mbValid( sal_True ),
+ mbNew( sal_True ),
+ mbDefaultStyle( bDefault )
+{
+}
+
+SvXMLStyleContext::~SvXMLStyleContext()
+{
+}
+
+SvXMLImportContext *SvXMLStyleContext::CreateChildContext( sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > & )
+{
+ return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );;
+}
+
+void SvXMLStyleContext::StartElement( const uno::Reference< xml::sax::XAttributeList > & xAttrList )
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName );
+ const OUString& rValue = xAttrList->getValueByIndex( i );
+
+ SetAttribute( nPrefix, aLocalName, rValue );
+ }
+}
+
+void SvXMLStyleContext::SetDefaults()
+{
+}
+
+void SvXMLStyleContext::CreateAndInsert( sal_Bool /*bOverwrite*/ )
+{
+}
+
+void SvXMLStyleContext::CreateAndInsertLate( sal_Bool /*bOverwrite*/ )
+{
+}
+
+void SvXMLStyleContext::Finish( sal_Bool /*bOverwrite*/ )
+{
+}
+
+sal_Bool SvXMLStyleContext::IsTransient() const
+{
+ return sal_False;
+}
+
+// ---------------------------------------------------------------------
+
+class SvXMLStyleIndex_Impl
+{
+ OUString sName;
+ sal_uInt16 nFamily;
+ const SvXMLStyleContext *pStyle;
+
+public:
+
+ SvXMLStyleIndex_Impl( sal_uInt16 nFam, const OUString& rName ) :
+ sName( rName ),
+ nFamily( nFam ),
+ pStyle ( 0 )
+ {
+ }
+
+ SvXMLStyleIndex_Impl( const SvXMLStyleContext *pStl ) :
+ sName( pStl->GetName() ),
+ nFamily( pStl->GetFamily() ),
+ pStyle ( pStl )
+ {
+ }
+
+ const OUString& GetName() const { return sName; }
+ sal_uInt16 GetFamily() const { return nFamily; }
+ const SvXMLStyleContext *GetStyle() const { return pStyle; }
+};
+
+int SvXMLStyleIndexCmp_Impl( const SvXMLStyleIndex_Impl& r1,
+ const SvXMLStyleIndex_Impl& r2 )
+{
+ int nRet;
+ if( (sal_uInt16)r1.GetFamily() < (sal_uInt16)r2.GetFamily() )
+ nRet = -1;
+ else if( (sal_uInt16)r1.GetFamily() > (sal_uInt16)r2.GetFamily() )
+ nRet = 1;
+ else
+ nRet = (int)r1.GetName().compareTo( r2.GetName() );
+
+ return nRet;
+}
+
+// ---------------------------------------------------------------------
+
+typedef SvXMLStyleContext *SvXMLStyleContextPtr;
+typedef vector< SvXMLStyleContextPtr > SvXMLStyleContexts_Impl;
+
+DECLARE_CONTAINER_SORT_DEL( SvXMLStyleIndices_Impl, SvXMLStyleIndex_Impl )
+IMPL_CONTAINER_SORT( SvXMLStyleIndices_Impl, SvXMLStyleIndex_Impl,
+ SvXMLStyleIndexCmp_Impl )
+
+
+class SvXMLStylesContext_Impl
+{
+ SvXMLStyleContexts_Impl aStyles;
+ SvXMLStyleIndices_Impl *pIndices;
+ sal_Bool bAutomaticStyle;
+
+#ifdef DBG_UTIL
+ sal_uInt32 nIndexCreated;
+#endif
+
+ void FlushIndex() { delete pIndices; pIndices = 0; }
+
+public:
+ SvXMLStylesContext_Impl( sal_Bool bAuto );
+ ~SvXMLStylesContext_Impl();
+
+ size_t GetStyleCount() const { return aStyles.size(); }
+
+ const SvXMLStyleContext *GetStyle( size_t i ) const
+ {
+ return i < aStyles.size() ? aStyles[ i ] : 0;
+ }
+
+ SvXMLStyleContext *GetStyle( size_t i )
+ {
+ return i < aStyles.size() ? aStyles[ i ] : 0;
+ }
+
+ inline void AddStyle( SvXMLStyleContext *pStyle );
+ void Clear();
+
+ const SvXMLStyleContext *FindStyleChildContext( sal_uInt16 nFamily,
+ const OUString& rName, sal_Bool bCreateIndex ) const;
+ sal_Bool IsAutomaticStyle() const { return bAutomaticStyle; }
+};
+
+SvXMLStylesContext_Impl::SvXMLStylesContext_Impl( sal_Bool bAuto ) :
+ pIndices( 0 ),
+ bAutomaticStyle( bAuto )
+#ifdef DBG_UTIL
+, nIndexCreated( 0 )
+#endif
+{}
+
+SvXMLStylesContext_Impl::~SvXMLStylesContext_Impl()
+{
+ delete pIndices;
+
+ for ( size_t i = 0, n = aStyles.size(); i < n; ++i )
+ {
+ SvXMLStyleContext *pStyle = aStyles[ i ];
+ pStyle->ReleaseRef();
+ }
+ aStyles.clear();
+}
+
+inline void SvXMLStylesContext_Impl::AddStyle( SvXMLStyleContext *pStyle )
+{
+ aStyles.push_back( pStyle );
+ pStyle->AddRef();
+
+ FlushIndex();
+}
+
+void SvXMLStylesContext_Impl::Clear()
+{
+ FlushIndex();
+
+ for ( size_t i = 0, n = aStyles.size(); i < n; ++i )
+ {
+ SvXMLStyleContext *pStyle = aStyles[ i ];
+ pStyle->ReleaseRef();
+ }
+ aStyles.clear();
+}
+
+const SvXMLStyleContext *SvXMLStylesContext_Impl::FindStyleChildContext(
+ sal_uInt16 nFamily,
+ const OUString& rName,
+ sal_Bool bCreateIndex ) const
+{
+ const SvXMLStyleContext *pStyle = 0;
+
+ if( !pIndices && bCreateIndex && !aStyles.empty() )
+ {
+#ifdef DBG_UTIL
+ DBG_ASSERT( 0==nIndexCreated,
+ "Performance warning: sdbcx::Index created multiple times" );
+#endif
+ ((SvXMLStylesContext_Impl *)this)->pIndices =
+ new SvXMLStyleIndices_Impl(
+ sal::static_int_cast< sal_uInt16 >( aStyles.size() ), 5 );
+ for( size_t i = 0; i < aStyles.size(); i++ )
+ {
+ SvXMLStyleIndex_Impl* pStyleIndex = new SvXMLStyleIndex_Impl( aStyles[ i ] );
+ if (!pIndices->Insert( pStyleIndex ))
+ {
+ OSL_FAIL("Here is a double Style");
+ delete pStyleIndex;
+ }
+ }
+#ifdef DBG_UTIL
+ ((SvXMLStylesContext_Impl *)this)->nIndexCreated++;
+#endif
+ }
+
+ if( pIndices )
+ {
+ SvXMLStyleIndex_Impl aIndex( nFamily, rName );
+ sal_uLong nPos = 0;
+ if( pIndices->Seek_Entry( &aIndex, &nPos ) )
+ pStyle = pIndices->GetObject( nPos )->GetStyle();
+ }
+ else
+ {
+ for( size_t i = 0; !pStyle && i < aStyles.size(); i++ )
+ {
+ const SvXMLStyleContext *pS = aStyles[ i ];
+ if( pS->GetFamily() == nFamily &&
+ pS->GetName() == rName )
+ pStyle = pS;
+ }
+ }
+ return pStyle;
+}
+
+// ---------------------------------------------------------------------
+
+TYPEINIT1( SvXMLStylesContext, SvXMLImportContext );
+
+sal_uInt32 SvXMLStylesContext::GetStyleCount() const
+{
+ return mpImpl->GetStyleCount();
+}
+
+SvXMLStyleContext *SvXMLStylesContext::GetStyle( sal_uInt32 i )
+{
+ return mpImpl->GetStyle( i );
+}
+
+const SvXMLStyleContext *SvXMLStylesContext::GetStyle( sal_uInt32 i ) const
+{
+ return mpImpl->GetStyle( i );
+}
+
+sal_Bool SvXMLStylesContext::IsAutomaticStyle() const
+{
+ return mpImpl->IsAutomaticStyle();
+}
+
+SvXMLStyleContext *SvXMLStylesContext::CreateStyleChildContext(
+ sal_uInt16 p_nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList )
+{
+ SvXMLStyleContext *pStyle = NULL;
+
+ if(GetImport().GetDataStylesImport())
+ {
+ pStyle = GetImport().GetDataStylesImport()->CreateChildContext(GetImport(), p_nPrefix,
+ rLocalName, xAttrList, *this);
+ }
+
+ if (!pStyle)
+ {
+ const SvXMLTokenMap& rTokenMap = GetStyleStylesElemTokenMap();
+ sal_uInt16 nToken = rTokenMap.Get( p_nPrefix, rLocalName );
+ switch( nToken )
+ {
+ case XML_TOK_STYLE_STYLE:
+ case XML_TOK_STYLE_DEFAULT_STYLE:
+ {
+ sal_uInt16 nFamily = 0;
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ if( XML_NAMESPACE_STYLE == nPrefix &&
+ IsXMLToken( aLocalName, XML_FAMILY ) )
+ {
+ const OUString& rValue = xAttrList->getValueByIndex( i );
+ nFamily = GetFamily( rValue );
+ break;
+ }
+ }
+ pStyle = XML_TOK_STYLE_STYLE==nToken
+ ? CreateStyleStyleChildContext( nFamily, p_nPrefix,
+ rLocalName, xAttrList )
+ : CreateDefaultStyleStyleChildContext( nFamily, p_nPrefix,
+ rLocalName, xAttrList );
+ }
+ break;
+ case XML_TOK_STYLE_PAGE_MASTER:
+ case XML_TOK_STYLE_DEFAULT_PAGE_LAYOUT:
+ {
+ //there is not page family in odf now, so I specify one for it
+ sal_Bool bDefaultStyle = XML_TOK_STYLE_DEFAULT_PAGE_LAYOUT == nToken
+ ? sal_True: sal_False;
+ pStyle = new PageStyleContext( GetImport(), p_nPrefix,
+ rLocalName, xAttrList, *this, bDefaultStyle );
+ }
+ break;
+ case XML_TOK_TEXT_LIST_STYLE:
+ pStyle = new SvxXMLListStyleContext( GetImport(), p_nPrefix,
+ rLocalName, xAttrList );
+ break;
+ case XML_TOK_TEXT_OUTLINE:
+ pStyle = new SvxXMLListStyleContext( GetImport(), p_nPrefix,
+ rLocalName, xAttrList, sal_True );
+ break;
+ case XML_TOK_TEXT_NOTE_CONFIG:
+ pStyle = new XMLFootnoteConfigurationImportContext(GetImport(),
+ p_nPrefix,
+ rLocalName,
+ xAttrList);
+ break;
+
+ case XML_TOK_TEXT_BIBLIOGRAPHY_CONFIG:
+ pStyle = new XMLIndexBibliographyConfigurationContext(
+ GetImport(), p_nPrefix, rLocalName, xAttrList);
+ break;
+
+ case XML_TOK_TEXT_LINENUMBERING_CONFIG:
+ pStyle = new XMLLineNumberingImportContext(
+ GetImport(), p_nPrefix, rLocalName, xAttrList);
+ break;
+
+ //
+ // FillStyles
+ //
+ case XML_TOK_STYLES_GRADIENTSTYLES:
+ {
+ pStyle = new XMLGradientStyleContext( GetImport(), p_nPrefix, rLocalName, xAttrList );
+ break;
+ }
+ case XML_TOK_STYLES_HATCHSTYLES:
+ {
+ pStyle = new XMLHatchStyleContext( GetImport(), p_nPrefix, rLocalName, xAttrList );
+ break;
+ }
+ case XML_TOK_STYLES_BITMAPSTYLES:
+ {
+ pStyle = new XMLBitmapStyleContext( GetImport(), p_nPrefix, rLocalName, xAttrList );
+ break;
+ }
+ case XML_TOK_STYLES_TRANSGRADIENTSTYLES:
+ {
+ pStyle = new XMLTransGradientStyleContext( GetImport(), p_nPrefix, rLocalName, xAttrList );
+ break;
+ }
+ case XML_TOK_STYLES_MARKERSTYLES:
+ {
+ pStyle = new XMLMarkerStyleContext( GetImport(), p_nPrefix, rLocalName, xAttrList );
+ break;
+ }
+ case XML_TOK_STYLES_DASHSTYLES:
+ {
+ pStyle = new XMLDashStyleContext( GetImport(), p_nPrefix, rLocalName, xAttrList );
+ break;
+ }
+ }
+ }
+
+ return pStyle;
+}
+
+SvXMLStyleContext *SvXMLStylesContext::CreateStyleStyleChildContext(
+ sal_uInt16 nFamily, sal_uInt16 nPrefix, const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList )
+{
+ SvXMLStyleContext *pStyle = 0;
+
+ switch( nFamily )
+ {
+ case XML_STYLE_FAMILY_TEXT_PARAGRAPH:
+ case XML_STYLE_FAMILY_TEXT_TEXT:
+ case XML_STYLE_FAMILY_TEXT_SECTION:
+ pStyle = new XMLTextStyleContext( GetImport(), nPrefix, rLocalName,
+ xAttrList, *this, nFamily );
+ break;
+
+ case XML_STYLE_FAMILY_TEXT_RUBY:
+ pStyle = new XMLPropStyleContext( GetImport(), nPrefix, rLocalName,
+ xAttrList, *this, nFamily );
+ break;
+ case XML_STYLE_FAMILY_SCH_CHART_ID:
+ pStyle = new XMLChartStyleContext( GetImport(), nPrefix, rLocalName,
+ xAttrList, *this, nFamily );
+ break;
+
+ case XML_STYLE_FAMILY_SD_GRAPHICS_ID:
+ case XML_STYLE_FAMILY_SD_PRESENTATION_ID:
+ case XML_STYLE_FAMILY_SD_POOL_ID:
+ pStyle = new XMLShapeStyleContext( GetImport(), nPrefix, rLocalName,
+ xAttrList, *this, nFamily );
+ }
+
+ return pStyle;
+}
+
+SvXMLStyleContext *SvXMLStylesContext::CreateDefaultStyleStyleChildContext(
+ sal_uInt16 /*nFamily*/, sal_uInt16 /*nPrefix*/, const OUString& /*rLocalName*/,
+ const uno::Reference< xml::sax::XAttributeList > & )
+{
+ return 0;
+}
+
+
+sal_Bool SvXMLStylesContext::InsertStyleFamily( sal_uInt16 ) const
+{
+ return sal_True;
+}
+
+sal_uInt16 SvXMLStylesContext::GetFamily(
+ const ::rtl::OUString& rValue ) const
+{
+ sal_uInt16 nFamily = 0U;
+ if( IsXMLToken( rValue, XML_PARAGRAPH ) )
+ {
+ nFamily = XML_STYLE_FAMILY_TEXT_PARAGRAPH;
+ }
+ else if( IsXMLToken( rValue, XML_TEXT ) )
+ {
+ nFamily = XML_STYLE_FAMILY_TEXT_TEXT;
+ }
+ else if( IsXMLToken( rValue, XML_DATA_STYLE ) )
+ {
+ nFamily = XML_STYLE_FAMILY_DATA_STYLE;
+ }
+ else if ( IsXMLToken( rValue, XML_SECTION ) )
+ {
+ nFamily = XML_STYLE_FAMILY_TEXT_SECTION;
+ }
+ else if( IsXMLToken( rValue, XML_TABLE ) )
+ {
+ nFamily = XML_STYLE_FAMILY_TABLE_TABLE;
+ }
+ else if( IsXMLToken( rValue, XML_TABLE_COLUMN ) )
+ nFamily = XML_STYLE_FAMILY_TABLE_COLUMN;
+ else if( IsXMLToken( rValue, XML_TABLE_ROW ) )
+ nFamily = XML_STYLE_FAMILY_TABLE_ROW;
+ else if( IsXMLToken( rValue, XML_TABLE_CELL ) )
+ nFamily = XML_STYLE_FAMILY_TABLE_CELL;
+ else if( rValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_NAME)))
+ {
+ nFamily = XML_STYLE_FAMILY_SD_GRAPHICS_ID;
+ }
+ else if( rValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(XML_STYLE_FAMILY_SD_PRESENTATION_NAME)))
+ {
+ nFamily = XML_STYLE_FAMILY_SD_PRESENTATION_ID;
+ }
+ else if( rValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(XML_STYLE_FAMILY_SD_POOL_NAME)))
+ {
+ nFamily = XML_STYLE_FAMILY_SD_POOL_ID;
+ }
+ else if( rValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME)))
+ {
+ nFamily = XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID;
+ }
+ else if( rValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( XML_STYLE_FAMILY_SCH_CHART_NAME )))
+ {
+ nFamily = XML_STYLE_FAMILY_SCH_CHART_ID;
+ }
+ else if ( IsXMLToken( rValue, XML_RUBY ) )
+ {
+ nFamily = XML_STYLE_FAMILY_TEXT_RUBY;
+ }
+
+ return nFamily;
+}
+
+UniReference < SvXMLImportPropertyMapper > SvXMLStylesContext::GetImportPropertyMapper(
+ sal_uInt16 nFamily ) const
+{
+ UniReference < SvXMLImportPropertyMapper > xMapper;
+
+ switch( nFamily )
+ {
+ case XML_STYLE_FAMILY_TEXT_PARAGRAPH:
+ if( !mxParaImpPropMapper.is() )
+ {
+ SvXMLStylesContext * pThis = (SvXMLStylesContext *)this;
+ pThis->mxParaImpPropMapper =
+ pThis->GetImport().GetTextImport()
+ ->GetParaImportPropertySetMapper();
+ }
+ xMapper = mxParaImpPropMapper;
+ break;
+ case XML_STYLE_FAMILY_TEXT_TEXT:
+ if( !mxTextImpPropMapper.is() )
+ {
+ SvXMLStylesContext * pThis = (SvXMLStylesContext *)this;
+ pThis->mxTextImpPropMapper =
+ pThis->GetImport().GetTextImport()
+ ->GetTextImportPropertySetMapper();
+ }
+ xMapper = mxTextImpPropMapper;
+ break;
+
+ case XML_STYLE_FAMILY_TEXT_SECTION:
+ // don't cache section mapper, as it's rarely used
+ // *sigh*, cast to non-const, because this is a const method,
+ // but SvXMLImport::GetTextImport() isn't.
+ xMapper = ((SvXMLStylesContext*)this)->GetImport().GetTextImport()->
+ GetSectionImportPropertySetMapper();
+ break;
+
+ case XML_STYLE_FAMILY_TEXT_RUBY:
+ // don't cache section mapper, as it's rarely used
+ // *sigh*, cast to non-const, because this is a const method,
+ // but SvXMLImport::GetTextImport() isn't.
+ xMapper = ((SvXMLStylesContext*)this)->GetImport().GetTextImport()->
+ GetRubyImportPropertySetMapper();
+ break;
+
+ case XML_STYLE_FAMILY_SD_GRAPHICS_ID:
+ case XML_STYLE_FAMILY_SD_PRESENTATION_ID:
+ case XML_STYLE_FAMILY_SD_POOL_ID:
+ if(!mxShapeImpPropMapper.is())
+ {
+ UniReference< XMLShapeImportHelper > aImpHelper = ((SvXMLImport&)GetImport()).GetShapeImport();
+ ((SvXMLStylesContext*)this)->mxShapeImpPropMapper =
+ aImpHelper->GetPropertySetMapper();
+ }
+ xMapper = mxShapeImpPropMapper;
+ break;
+ case XML_STYLE_FAMILY_SCH_CHART_ID:
+ if( ! mxChartImpPropMapper.is() )
+ {
+ XMLPropertySetMapper *pPropMapper = new XMLChartPropertySetMapper();
+ mxChartImpPropMapper = new XMLChartImportPropertyMapper( pPropMapper, GetImport() );
+ }
+ xMapper = mxChartImpPropMapper;
+ break;
+ case XML_STYLE_FAMILY_PAGE_MASTER:
+ if( ! mxPageImpPropMapper.is() )
+ {
+ XMLPropertySetMapper *pPropMapper =
+ new XMLPageMasterPropSetMapper();
+ mxPageImpPropMapper =
+ new PageMasterImportPropertyMapper( pPropMapper,
+ ((SvXMLStylesContext*)this)->GetImport() );
+ }
+ xMapper = mxPageImpPropMapper;
+ break;
+ }
+
+ return xMapper;
+}
+
+Reference < XAutoStyleFamily > SvXMLStylesContext::GetAutoStyles( sal_uInt16 nFamily ) const
+{
+ Reference < XAutoStyleFamily > xAutoStyles;
+ if( XML_STYLE_FAMILY_TEXT_TEXT == nFamily || XML_STYLE_FAMILY_TEXT_PARAGRAPH == nFamily)
+ {
+ bool bPara = XML_STYLE_FAMILY_TEXT_PARAGRAPH == nFamily;
+ OUString sName;
+ if( !bPara && mxTextAutoStyles.is() )
+ xAutoStyles = mxTextAutoStyles;
+ else if( bPara && mxParaAutoStyles.is() )
+ xAutoStyles = mxParaAutoStyles;
+ else
+ {
+ sName = bPara ?
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "ParagraphStyles" ) ):
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "CharacterStyles" ) );
+ Reference< XAutoStylesSupplier > xAutoStylesSupp( GetImport().GetModel(), UNO_QUERY );
+ Reference< XAutoStyles > xAutoStyleFamilies = xAutoStylesSupp->getAutoStyles();
+ if (xAutoStyleFamilies->hasByName(sName))
+ {
+ Any aAny = xAutoStyleFamilies->getByName( sName );
+ xAutoStyles = *(Reference<XAutoStyleFamily>*)aAny.getValue();
+ if( bPara )
+ ((SvXMLStylesContext *)this)->mxParaAutoStyles = xAutoStyles;
+ else
+ ((SvXMLStylesContext *)this)->mxTextAutoStyles = xAutoStyles;
+ }
+ }
+ }
+ return xAutoStyles;
+}
+
+Reference < XNameContainer > SvXMLStylesContext::GetStylesContainer(
+ sal_uInt16 nFamily ) const
+{
+ Reference < XNameContainer > xStyles;
+ OUString sName;
+ switch( nFamily )
+ {
+ case XML_STYLE_FAMILY_TEXT_PARAGRAPH:
+ if( mxParaStyles.is() )
+ xStyles = mxParaStyles;
+ else
+ sName =
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "ParagraphStyles" ) );
+ break;
+
+ case XML_STYLE_FAMILY_TEXT_TEXT:
+ if( mxTextStyles.is() )
+ xStyles = mxTextStyles;
+ else
+ sName =
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "CharacterStyles" ) );
+ break;
+ }
+ if( !xStyles.is() && sName.getLength() )
+ {
+ Reference< XStyleFamiliesSupplier > xFamiliesSupp(
+ GetImport().GetModel(), UNO_QUERY );
+ if ( xFamiliesSupp.is() )
+ {
+ Reference< XNameAccess > xFamilies = xFamiliesSupp->getStyleFamilies();
+ if (xFamilies->hasByName(sName))
+ {
+ xStyles.set(xFamilies->getByName( sName ),uno::UNO_QUERY);
+
+ switch( nFamily )
+ {
+ case XML_STYLE_FAMILY_TEXT_PARAGRAPH:
+ ((SvXMLStylesContext *)this)->mxParaStyles = xStyles;
+ break;
+
+ case XML_STYLE_FAMILY_TEXT_TEXT:
+ ((SvXMLStylesContext *)this)->mxTextStyles = xStyles;
+ break;
+ }
+ }
+ }
+ }
+
+ return xStyles;
+}
+
+OUString SvXMLStylesContext::GetServiceName( sal_uInt16 nFamily ) const
+{
+ String sServiceName;
+ switch( nFamily )
+ {
+ case XML_STYLE_FAMILY_TEXT_PARAGRAPH:
+ sServiceName = msParaStyleServiceName;
+ break;
+ case XML_STYLE_FAMILY_TEXT_TEXT:
+ sServiceName = msTextStyleServiceName;
+ break;
+ }
+
+ return sServiceName;
+}
+
+
+SvXMLStylesContext::SvXMLStylesContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList > &, sal_Bool bAuto ) :
+ SvXMLImportContext( rImport, nPrfx, rLName ),
+ msParaStyleServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.style.ParagraphStyle" ) ),
+ msTextStyleServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.style.CharacterStyle" ) ),
+ mpImpl( new SvXMLStylesContext_Impl( bAuto ) ),
+ mpStyleStylesElemTokenMap( 0 )
+{
+}
+
+
+SvXMLStylesContext::~SvXMLStylesContext()
+{
+ delete mpStyleStylesElemTokenMap;
+ delete mpImpl;
+}
+
+SvXMLImportContext *SvXMLStylesContext::CreateChildContext( sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList )
+{
+ SvXMLImportContext *pContext = 0;
+
+ SvXMLStyleContext *pStyle =
+ CreateStyleChildContext( nPrefix, rLocalName, xAttrList );
+ if( pStyle )
+ {
+ if( !pStyle->IsTransient() )
+ mpImpl->AddStyle( pStyle );
+ pContext = pStyle;
+ }
+ else
+ {
+ pContext = new SvXMLImportContext( GetImport(), nPrefix,
+ rLocalName );
+ }
+
+ return pContext;
+}
+
+void SvXMLStylesContext::EndElement()
+{
+}
+
+void SvXMLStylesContext::AddStyle(SvXMLStyleContext& rNew)
+{
+ mpImpl->AddStyle( &rNew );
+}
+
+void SvXMLStylesContext::Clear()
+{
+ mpImpl->Clear();
+}
+
+void SvXMLStylesContext::CopyAutoStylesToDoc()
+{
+ sal_uInt32 nCount = GetStyleCount();
+ sal_uInt32 i;
+ for( i = 0; i < nCount; i++ )
+ {
+ SvXMLStyleContext *pStyle = GetStyle( i );
+ if( !pStyle || ( pStyle->GetFamily() != XML_STYLE_FAMILY_TEXT_TEXT &&
+ pStyle->GetFamily() != XML_STYLE_FAMILY_TEXT_PARAGRAPH &&
+ pStyle->GetFamily() != XML_STYLE_FAMILY_TABLE_CELL ) )
+ continue;
+ pStyle->CreateAndInsert( sal_False );
+ }
+}
+
+void SvXMLStylesContext::CopyStylesToDoc( sal_Bool bOverwrite,
+ sal_Bool bFinish )
+{
+ // pass 1: create text, paragraph and frame styles
+ sal_uInt32 nCount = GetStyleCount();
+ sal_uInt32 i;
+
+ for( i = 0; i < nCount; i++ )
+ {
+ SvXMLStyleContext *pStyle = GetStyle( i );
+ if( !pStyle )
+ continue;
+
+ if (pStyle->IsDefaultStyle())
+ pStyle->SetDefaults();
+ else if( InsertStyleFamily( pStyle->GetFamily() ) )
+ pStyle->CreateAndInsert( bOverwrite );
+ }
+
+ // pass 2: create list styles (they require char styles)
+ for( i=0; i<nCount; i++ )
+ {
+ SvXMLStyleContext *pStyle = GetStyle( i );
+ if( !pStyle || pStyle->IsDefaultStyle())
+ continue;
+
+ if( InsertStyleFamily( pStyle->GetFamily() ) )
+ pStyle->CreateAndInsertLate( bOverwrite );
+ }
+
+ // pass3: finish creation of styles
+ if( bFinish )
+ FinishStyles( bOverwrite );
+}
+
+void SvXMLStylesContext::FinishStyles( sal_Bool bOverwrite )
+{
+ sal_uInt32 nCount = GetStyleCount();
+ for( sal_uInt32 i=0; i<nCount; i++ )
+ {
+ SvXMLStyleContext *pStyle = GetStyle( i );
+ if( !pStyle || !pStyle->IsValid() || pStyle->IsDefaultStyle() )
+ continue;
+
+ if( InsertStyleFamily( pStyle->GetFamily() ) )
+ pStyle->Finish( bOverwrite );
+ }
+}
+
+
+const SvXMLStyleContext *SvXMLStylesContext::FindStyleChildContext(
+ sal_uInt16 nFamily,
+ const OUString& rName,
+ sal_Bool bCreateIndex ) const
+{
+ return mpImpl->FindStyleChildContext( nFamily, rName, bCreateIndex );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/xmltabe.cxx b/xmloff/source/style/xmltabe.cxx
new file mode 100644
index 000000000000..d967e3d30618
--- /dev/null
+++ b/xmloff/source/style/xmltabe.cxx
@@ -0,0 +1,140 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <tools/debug.hxx>
+#include <com/sun/star/style/TabStop.hpp>
+#include <com/sun/star/style/TabAlign.hpp>
+#include <rtl/ustrbuf.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmlexp.hxx>
+#include "xmloff/xmltabe.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+SvXMLEnumMapEntry pXML_tabstop_style[] =
+{
+ { XML_LEFT, style::TabAlign_LEFT },
+ { XML_CENTER, style::TabAlign_CENTER },
+ { XML_RIGHT, style::TabAlign_RIGHT },
+ { XML_CHAR, style::TabAlign_DECIMAL },
+ { XML_DEFAULT, style::TabAlign_DEFAULT }, // ?????????????????????????????????????
+ { XML_TOKEN_INVALID, 0 }
+};
+
+void SvxXMLTabStopExport::exportTabStop( const ::com::sun::star::style::TabStop* pTabStop )
+{
+ SvXMLUnitConverter& rUnitConv = rExport.GetMM100UnitConverter();
+
+ // text:level
+ OUStringBuffer sBuffer;
+
+ // position attribute
+ rUnitConv.convertMeasure( sBuffer, pTabStop->Position );
+ rExport.AddAttribute( XML_NAMESPACE_STYLE, XML_POSITION,
+ sBuffer.makeStringAndClear() );
+
+ // type attribute
+ if( style::TabAlign_LEFT != pTabStop->Alignment )
+ {
+ rUnitConv.convertEnum( sBuffer, pTabStop->Alignment,
+ pXML_tabstop_style );
+ rExport.AddAttribute( XML_NAMESPACE_STYLE, XML_TYPE,
+ sBuffer.makeStringAndClear() );
+ }
+
+ // char
+ if( style::TabAlign_DECIMAL == pTabStop->Alignment &&
+ pTabStop->DecimalChar != 0 )
+ {
+ sBuffer.append( pTabStop->DecimalChar );
+ rExport.AddAttribute( XML_NAMESPACE_STYLE, XML_CHAR,
+ sBuffer.makeStringAndClear() );
+ }
+
+ // leader-char
+ if( ' ' != pTabStop->FillChar && 0 != pTabStop->FillChar )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_STYLE, XML_LEADER_STYLE,
+ GetXMLToken('.' == pTabStop->FillChar ? XML_DOTTED
+ : XML_SOLID) );
+
+ sBuffer.append( pTabStop->FillChar );
+ rExport.AddAttribute( XML_NAMESPACE_STYLE, XML_LEADER_TEXT,
+ sBuffer.makeStringAndClear() );
+ }
+
+ SvXMLElementExport rElem( rExport, XML_NAMESPACE_STYLE, XML_TAB_STOP,
+ sal_True, sal_True );
+}
+
+
+SvxXMLTabStopExport::SvxXMLTabStopExport(
+ SvXMLExport& rExp)
+ : rExport( rExp )
+{
+}
+
+SvxXMLTabStopExport::~SvxXMLTabStopExport()
+{
+}
+
+void SvxXMLTabStopExport::Export( const uno::Any& rAny )
+{
+ uno::Sequence< ::com::sun::star::style::TabStop> aSeq;
+ if(!(rAny >>= aSeq))
+ {
+ OSL_FAIL( "SvxXMLTabStopExport needs a Sequence ::com::sun::star::style::TabStop>" );
+ }
+ else
+ {
+ const ::com::sun::star::style::TabStop* pTabs = aSeq.getConstArray();
+ const sal_Int32 nTabs = aSeq.getLength();
+
+ SvXMLElementExport rElem( rExport, XML_NAMESPACE_STYLE, XML_TAB_STOPS,
+ sal_True, sal_True );
+
+ for( sal_Int32 nIndex = 0; nIndex < nTabs; nIndex++ )
+ {
+ if( style::TabAlign_DEFAULT != pTabs[nIndex].Alignment )
+ exportTabStop( &(pTabs[nIndex]) );
+ }
+ }
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/xmltabi.cxx b/xmloff/source/style/xmltabi.cxx
new file mode 100644
index 000000000000..a5c92fb5469d
--- /dev/null
+++ b/xmloff/source/style/xmltabi.cxx
@@ -0,0 +1,295 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/style/TabAlign.hpp>
+#include <rtl/ustrbuf.hxx>
+#include <xmloff/xmltkmap.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmlimp.hxx>
+#include <com/sun/star/style/TabStop.hpp>
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/i18nmap.hxx"
+#include <xmloff/xmluconv.hxx>
+
+#include "xmltabi.hxx"
+
+#define _SVSTDARR_USHORTS
+#include <svl/svstdarr.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+// ---
+
+enum SvXMLTokenMapAttrs
+{
+ XML_TOK_TABSTOP_POSITION,
+ XML_TOK_TABSTOP_TYPE,
+ XML_TOK_TABSTOP_CHAR,
+ XML_TOK_TABSTOP_LEADER_STYLE,
+ XML_TOK_TABSTOP_LEADER_TEXT,
+ XML_TOK_TABSTOP_END=XML_TOK_UNKNOWN
+};
+
+static SvXMLTokenMapEntry aTabsAttributesAttrTokenMap[] =
+{
+ { XML_NAMESPACE_STYLE, XML_POSITION, XML_TOK_TABSTOP_POSITION },
+ { XML_NAMESPACE_STYLE, XML_TYPE, XML_TOK_TABSTOP_TYPE },
+ { XML_NAMESPACE_STYLE, XML_CHAR, XML_TOK_TABSTOP_CHAR },
+ { XML_NAMESPACE_STYLE, XML_LEADER_TEXT, XML_TOK_TABSTOP_LEADER_TEXT },
+ { XML_NAMESPACE_STYLE, XML_LEADER_STYLE, XML_TOK_TABSTOP_LEADER_STYLE },
+ XML_TOKEN_MAP_END
+};
+
+// ---
+
+class SvxXMLTabStopContext_Impl : public SvXMLImportContext
+{
+private:
+ style::TabStop aTabStop;
+
+public:
+ TYPEINFO();
+
+ SvxXMLTabStopContext_Impl( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList );
+
+ virtual ~SvxXMLTabStopContext_Impl();
+
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList );
+
+ const style::TabStop& getTabStop() const { return aTabStop; }
+};
+
+TYPEINIT1( SvxXMLTabStopContext_Impl, SvXMLImportContext );
+
+SvxXMLTabStopContext_Impl::SvxXMLTabStopContext_Impl(
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList )
+: SvXMLImportContext( rImport, nPrfx, rLName )
+{
+ aTabStop.Position = 0;
+ aTabStop.Alignment = style::TabAlign_LEFT;
+ aTabStop.DecimalChar = sal_Unicode( ',' );
+ aTabStop.FillChar = sal_Unicode( ' ' );
+ sal_Unicode cTextFillChar = 0;
+
+ SvXMLTokenMap aTokenMap( aTabsAttributesAttrTokenMap );
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ const OUString& rValue = xAttrList->getValueByIndex( i );
+
+ sal_Int32 nVal;
+ switch( aTokenMap.Get( nPrefix, aLocalName ) )
+ {
+ case XML_TOK_TABSTOP_POSITION:
+ if( GetImport().GetMM100UnitConverter().convertMeasure( nVal,
+ rValue ) )
+ aTabStop.Position = nVal;
+ break;
+ case XML_TOK_TABSTOP_TYPE:
+ if( IsXMLToken( rValue, XML_LEFT ) )
+ {
+ aTabStop.Alignment = style::TabAlign_LEFT;
+ }
+ else if( IsXMLToken( rValue, XML_RIGHT ) )
+ {
+ aTabStop.Alignment = style::TabAlign_RIGHT;
+ }
+ else if( IsXMLToken( rValue, XML_CENTER ) )
+ {
+ aTabStop.Alignment = style::TabAlign_CENTER;
+ }
+ else if( IsXMLToken( rValue, XML_CHAR ) )
+ {
+ aTabStop.Alignment = style::TabAlign_DECIMAL;
+ }
+ else if( IsXMLToken( rValue, XML_DEFAULT ) )
+ {
+ aTabStop.Alignment = style::TabAlign_DEFAULT;
+ }
+ break;
+ case XML_TOK_TABSTOP_CHAR:
+ if( 0 != rValue.getLength() )
+ aTabStop.DecimalChar = rValue[0];
+ break;
+ case XML_TOK_TABSTOP_LEADER_STYLE:
+ if( IsXMLToken( rValue, XML_NONE ) )
+ aTabStop.FillChar = ' ';
+ else if( IsXMLToken( rValue, XML_DOTTED ) )
+ aTabStop.FillChar = '.';
+ else
+ aTabStop.FillChar = '_';
+ break;
+ case XML_TOK_TABSTOP_LEADER_TEXT:
+ if( 0 != rValue.getLength() )
+ cTextFillChar = rValue[0];
+ break;
+ }
+ }
+
+ if( cTextFillChar != 0 && aTabStop.FillChar != ' ' )
+ aTabStop.FillChar = cTextFillChar;
+}
+
+SvxXMLTabStopContext_Impl::~SvxXMLTabStopContext_Impl()
+{
+}
+
+SvXMLImportContext *SvxXMLTabStopContext_Impl::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > & )
+{
+ return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+}
+
+
+
+
+typedef SvxXMLTabStopContext_Impl *SvxXMLTabStopContext_Impl_ImplPtr;
+SV_DECL_PTRARR( SvxXMLTabStopArray_Impl, SvxXMLTabStopContext_Impl_ImplPtr, 20, 5 )
+
+
+// ---
+
+TYPEINIT1( SvxXMLTabStopImportContext, XMLElementPropertyContext );
+
+SvxXMLTabStopImportContext::SvxXMLTabStopImportContext(
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const XMLPropertyState& rProp,
+ ::std::vector< XMLPropertyState > &rProps )
+: XMLElementPropertyContext( rImport, nPrfx, rLName, rProp, rProps ),
+ mpTabStops( NULL )
+{
+}
+
+SvxXMLTabStopImportContext::~SvxXMLTabStopImportContext()
+{
+ if( mpTabStops )
+ {
+ sal_uInt16 nCount = mpTabStops->Count();
+ while( nCount )
+ {
+ nCount--;
+ SvxXMLTabStopContext_Impl *pTabStop = (*mpTabStops)[nCount];
+ mpTabStops->Remove( nCount, 1 );
+ pTabStop->ReleaseRef();
+ }
+ }
+
+ delete mpTabStops;
+}
+
+SvXMLImportContext *SvxXMLTabStopImportContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList )
+{
+ SvXMLImportContext *pContext = 0;
+
+ if( XML_NAMESPACE_STYLE == nPrefix && IsXMLToken( rLocalName, XML_TAB_STOP ) )
+ {
+ // create new tabstop import context
+ SvxXMLTabStopContext_Impl *pTabStopContext =
+ new SvxXMLTabStopContext_Impl( GetImport(), nPrefix, rLocalName,
+ xAttrList );
+
+ // add new tabstop to array of tabstops
+ if( !mpTabStops )
+ mpTabStops = new SvxXMLTabStopArray_Impl;
+
+ mpTabStops->Insert( pTabStopContext, mpTabStops->Count() );
+ pTabStopContext->AddRef();
+
+ pContext = pTabStopContext;
+ }
+ else
+ {
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+ }
+
+ return pContext;
+}
+
+void SvxXMLTabStopImportContext::EndElement( )
+{
+ sal_uInt16 nCount = mpTabStops ? mpTabStops->Count() : 0;
+ uno::Sequence< style::TabStop> aSeq( nCount );
+
+ if( mpTabStops )
+ {
+ sal_uInt16 nNewCount = 0;
+
+ style::TabStop* pTabStops = aSeq.getArray();
+ for( sal_uInt16 i=0; i < nCount; i++ )
+ {
+ SvxXMLTabStopContext_Impl *pTabStopContext = (*mpTabStops)[i];
+ const style::TabStop& rTabStop = pTabStopContext->getTabStop();
+ sal_Bool bDflt = style::TabAlign_DEFAULT == rTabStop.Alignment;
+ if( !bDflt || 0==i )
+ {
+ *pTabStops++ = pTabStopContext->getTabStop();
+ nNewCount++;
+ }
+ if( bDflt && 0==i )
+ break;
+ }
+
+ if( nCount != nNewCount )
+ aSeq.realloc( nNewCount );
+ }
+ aProp.maValue <<= aSeq;
+
+ SetInsert( sal_True );
+ XMLElementPropertyContext::EndElement();
+
+}
+
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/table/XMLTableExport.cxx b/xmloff/source/table/XMLTableExport.cxx
new file mode 100644
index 000000000000..e53e321257af
--- /dev/null
+++ b/xmloff/source/table/XMLTableExport.cxx
@@ -0,0 +1,593 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "xmloff/dllapi.h"
+
+#include "sal/config.h"
+#include <osl/diagnose.h>
+
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/table/XCellRange.hpp>
+#include <com/sun/star/table/XColumnRowRange.hpp>
+#include <com/sun/star/table/CellContentType.hpp>
+#include <com/sun/star/table/XMergeableCell.hpp>
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+
+#include "xmloff/table/XMLTableExport.hxx"
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmlprmap.hxx>
+#include <xmloff/xmlexppr.hxx>
+#include <xmloff/xmlexp.hxx>
+#include "table.hxx"
+
+using ::rtl::OUString;
+using namespace ::xmloff::token;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::style;
+using namespace ::xmloff::token;
+
+// --------------------------------------------------------------------
+
+#define _MAP(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, type, context, SvtSaveOptions::ODFVER_010 }
+#define CMAP(name,prefix,token,type,context) _MAP(name,prefix,token,type|XML_TYPE_PROP_TABLE_COLUMN,context)
+#define RMAP(name,prefix,token,type,context) _MAP(name,prefix,token,type|XML_TYPE_PROP_TABLE_ROW,context)
+#define MAP_END { 0L, 0, 0, XML_EMPTY, 0, 0, SvtSaveOptions::ODFVER_010 }
+
+// --------------------------------------------------------------------
+
+const XMLPropertyMapEntry* getColumnPropertiesMap()
+{
+ static const XMLPropertyMapEntry aXMLColumnProperties[] =
+ {
+ CMAP( "Width", XML_NAMESPACE_STYLE, XML_COLUMN_WIDTH, XML_TYPE_MEASURE, 0 ),
+ CMAP( "OptimalWidth", XML_NAMESPACE_STYLE, XML_USE_OPTIMAL_COLUMN_WIDTH, XML_TYPE_BOOL, 0 ),
+ MAP_END
+ };
+
+ return &aXMLColumnProperties[0];
+}
+
+// --------------------------------------------------------------------
+
+const XMLPropertyMapEntry* getRowPropertiesMap()
+{
+ static const XMLPropertyMapEntry aXMLRowProperties[] =
+ {
+ RMAP( "Height", XML_NAMESPACE_STYLE, XML_ROW_HEIGHT, XML_TYPE_MEASURE, 0 ),
+ RMAP( "OptimalHeight", XML_NAMESPACE_STYLE, XML_MIN_ROW_HEIGHT, XML_TYPE_MEASURE, 0 ),
+ RMAP( "OptimalWidth", XML_NAMESPACE_STYLE, XML_USE_OPTIMAL_ROW_HEIGHT, XML_TYPE_BOOL, 0 ),
+ MAP_END
+ };
+
+ return &aXMLRowProperties[0];
+}
+
+// --------------------------------------------------------------------
+
+class StringStatisticHelper : public std::map< OUString, sal_Int32 >
+{
+public:
+ void add( const OUString& rStyleName );
+ void clear() { std::map< OUString, sal_Int32 >::clear(); }
+
+ sal_Int32 getModeString( /* out */ OUString& rModeString );
+};
+
+// --------------------------------------------------------------------
+
+void StringStatisticHelper::add( const OUString& rStyleName )
+{
+ std::map< OUString, sal_Int32 >::iterator iter( find( rStyleName ) );
+ if( iter == end() )
+ {
+ (*this)[rStyleName] = 1;
+ }
+ else
+ {
+ (*iter).second += 1;
+ }
+}
+
+// --------------------------------------------------------------------
+
+sal_Int32 StringStatisticHelper::getModeString( OUString& rStyleName )
+{
+ sal_Int32 nMax = 0;
+ for( std::map< OUString, sal_Int32 >::iterator iter( begin() ); iter != end(); iter++ )
+ {
+ if( (*iter).second > nMax )
+ {
+ rStyleName = (*iter).first;
+ nMax = (*iter).second;
+ }
+ }
+
+ return nMax;
+}
+
+// --------------------------------------------------------------------
+// class XMLTableExport
+// --------------------------------------------------------------------
+
+XMLTableExport::XMLTableExport(SvXMLExport& rExp, const rtl::Reference< SvXMLExportPropertyMapper >& xExportPropertyMapper, const rtl::Reference< XMLPropertyHandlerFactory >& xFactoryRef )
+: mrExport( rExp )
+, mbExportTables( false )
+{
+ Reference< XMultiServiceFactory > xFac( rExp.GetModel(), UNO_QUERY );
+ if( xFac.is() ) try
+ {
+ Sequence< OUString > sSNS( xFac->getAvailableServiceNames() );
+ sal_Int32 n = sSNS.getLength();
+ const OUString* pSNS( sSNS.getConstArray() );
+ while( --n > 0 )
+ {
+ if( (*pSNS++).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.TableShape") ) )
+ {
+ mbExportTables = true;
+ break;
+ }
+ }
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ }
+
+ mxCellExportPropertySetMapper = xExportPropertyMapper;
+ mxCellExportPropertySetMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaExtPropMapper(rExp));
+
+ mxRowExportPropertySetMapper = new SvXMLExportPropertyMapper( new XMLPropertySetMapper( getRowPropertiesMap(), xFactoryRef.get() ) );
+ mxColumnExportPropertySetMapper = new SvXMLExportPropertyMapper( new XMLPropertySetMapper( getColumnPropertiesMap(), xFactoryRef.get() ) );
+
+ mrExport.GetAutoStylePool()->AddFamily(XML_STYLE_FAMILY_TABLE_COLUMN,
+ OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_NAME)),
+ mxColumnExportPropertySetMapper.get(),
+ OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_PREFIX)));
+ mrExport.GetAutoStylePool()->AddFamily(XML_STYLE_FAMILY_TABLE_ROW,
+ OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_TABLE_ROW_STYLES_NAME)),
+ mxRowExportPropertySetMapper.get(),
+ OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_TABLE_ROW_STYLES_PREFIX)));
+ mrExport.GetAutoStylePool()->AddFamily(XML_STYLE_FAMILY_TABLE_CELL,
+ OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_TABLE_CELL_STYLES_NAME)),
+ mxCellExportPropertySetMapper.get(),
+ OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_TABLE_CELL_STYLES_PREFIX)));
+}
+
+// --------------------------------------------------------------------
+
+XMLTableExport::~XMLTableExport ()
+{
+}
+
+// --------------------------------------------------------------------
+
+static bool has_states( const std::vector< XMLPropertyState >& xPropStates )
+{
+ if( !xPropStates.empty() )
+ {
+ std::vector< XMLPropertyState >::const_iterator aIter( xPropStates.begin() );
+ std::vector< XMLPropertyState >::const_iterator aEnd( xPropStates.end() );
+ while( aIter != aEnd )
+ {
+ if( aIter->mnIndex != -1 )
+ return true;
+ ++aIter;
+ }
+ }
+ return false;
+}
+
+// --------------------------------------------------------------------
+
+ void XMLTableExport::collectTableAutoStyles(const Reference < XColumnRowRange >& xColumnRowRange)
+ {
+ if( !mbExportTables )
+ return;
+
+ boost::shared_ptr< XMLTableInfo > pTableInfo( new XMLTableInfo() );
+ maTableInfoMap[xColumnRowRange] = pTableInfo;
+
+ try
+ {
+ Reference< XIndexAccess > xIndexAccessCols( xColumnRowRange->getColumns(), UNO_QUERY_THROW );
+ const sal_Int32 nColumnCount = xIndexAccessCols->getCount();
+ for( sal_Int32 nColumn = 0; nColumn < nColumnCount; ++nColumn ) try
+ {
+ Reference< XPropertySet > xPropSet( xIndexAccessCols->getByIndex(nColumn) , UNO_QUERY_THROW );
+ std::vector< XMLPropertyState > xPropStates( mxColumnExportPropertySetMapper->Filter( xPropSet ) );
+
+ if( has_states( xPropStates ) )
+ {
+ const OUString sStyleName( mrExport.GetAutoStylePool()->Add(XML_STYLE_FAMILY_TABLE_COLUMN, xPropStates) );
+ Reference< XInterface > xKey( xPropSet, UNO_QUERY );
+ pTableInfo->maColumnStyleMap[xKey] = sStyleName;
+ }
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL("xmloff::XMLTableExport::collectTableAutoStyles(), exception during column style collection!");
+ }
+
+ Reference< XIndexAccess > xIndexAccessRows( xColumnRowRange->getRows(), UNO_QUERY_THROW );
+ const sal_Int32 nRowCount = xIndexAccessRows->getCount();
+ pTableInfo->maDefaultRowCellStyles.resize(nRowCount);
+
+ StringStatisticHelper aStringStatistic;
+
+ for( sal_Int32 nRow = 0; nRow < nRowCount; ++nRow ) try
+ {
+ Reference< XPropertySet > xPropSet( xIndexAccessRows->getByIndex(nRow) , UNO_QUERY_THROW );
+ std::vector< XMLPropertyState > xRowPropStates( mxRowExportPropertySetMapper->Filter( xPropSet ) );
+
+ if( has_states( xRowPropStates ) )
+ {
+ const OUString sStyleName( mrExport.GetAutoStylePool()->Add(XML_STYLE_FAMILY_TABLE_ROW, xRowPropStates) );
+ Reference< XInterface > xKey( xPropSet, UNO_QUERY );
+ pTableInfo->maRowStyleMap[xKey] = sStyleName;
+ }
+
+ // get the current row
+ Reference< XCellRange > xCellRange( xPropSet, UNO_QUERY_THROW );
+ for ( sal_Int32 nColumn = 0; nColumn < nColumnCount; ++nColumn )
+ {
+ // get current cell, remarks row index is 0, because we get the range for each row seperate
+ Reference< XPropertySet > xCellSet( xCellRange->getCellByPosition(nColumn, 0), UNO_QUERY_THROW );
+
+ // get style
+ OUString sParentStyleName;
+ Reference< XPropertySetInfo > xPropertySetInfo( xCellSet->getPropertySetInfo() );
+ if( xPropertySetInfo.is() && xPropertySetInfo->hasPropertyByName( OUString(RTL_CONSTASCII_USTRINGPARAM("Style"))) )
+ {
+ Reference< XStyle > xStyle( xCellSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Style"))), UNO_QUERY );
+ if( xStyle.is() )
+ sParentStyleName = xStyle->getName();
+ }
+
+ // create auto style, if needed
+ OUString sStyleName;
+ std::vector< XMLPropertyState > xCellPropStates( mxCellExportPropertySetMapper->Filter( xCellSet ) );
+ if( has_states( xCellPropStates ) )
+ sStyleName = mrExport.GetAutoStylePool()->Add(XML_STYLE_FAMILY_TABLE_CELL, xCellPropStates);
+ else
+ sStyleName = sParentStyleName;
+
+ if( sStyleName.getLength() )
+ {
+ Reference< XInterface > xKey( xCellSet, UNO_QUERY );
+ pTableInfo->maCellStyleMap[xKey] = sStyleName;
+ }
+
+ // create auto style for text
+ Reference< XText > xText(xCellSet, UNO_QUERY);
+ if(xText.is() && xText->getString().getLength())
+ GetExport().GetTextParagraphExport()->collectTextAutoStyles( xText );
+
+ aStringStatistic.add( sStyleName );
+ }
+
+ OUString sDefaultCellStyle;
+ if( aStringStatistic.getModeString( sDefaultCellStyle ) > 1 )
+ pTableInfo->maDefaultRowCellStyles[nRow] = sDefaultCellStyle;
+
+ aStringStatistic.clear();
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL("xmloff::XMLTableExport::collectTableAutoStyles(), exception during column style collection!");
+ }
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL("xmloff::XMLTableExport::collectTableAutoStyles(), exception caught!");
+ }
+ }
+
+ // --------------------------------------------------------------------
+
+ void XMLTableExport::exportTable( const Reference < XColumnRowRange >& xColumnRowRange )
+ {
+ if( !mbExportTables )
+ return;
+
+ try
+ {
+ boost::shared_ptr< XMLTableInfo > pTableInfo( maTableInfoMap[xColumnRowRange] );
+
+ // get row and column count
+ Reference< XIndexAccess > xIndexAccess( xColumnRowRange->getRows(), UNO_QUERY_THROW );
+ Reference< XIndexAccess > xIndexAccessCols( xColumnRowRange->getColumns(), UNO_QUERY_THROW );
+
+ const sal_Int32 rowCount = xIndexAccess->getCount();
+ const sal_Int32 columnCount = xIndexAccessCols->getCount();
+
+ SvXMLElementExport tableElement( mrExport, XML_NAMESPACE_TABLE, XML_TABLE, sal_True, sal_True );
+
+ // export table columns
+ ExportTableColumns( xIndexAccessCols, pTableInfo );
+
+ // start iterating rows and columns
+ for ( sal_Int32 rowIndex = 0; rowIndex < rowCount; rowIndex++ )
+ {
+ // get the current row
+ Reference< XCellRange > xCellRange( xIndexAccess->getByIndex(rowIndex), UNO_QUERY_THROW );
+
+ OUString sDefaultCellStyle;
+
+ // table:style-name
+ if( pTableInfo.get() )
+ {
+ Reference< XInterface > xKey( xCellRange, UNO_QUERY );
+ const OUString sStyleName( pTableInfo->maRowStyleMap[xKey] );
+ if( sStyleName.getLength() )
+ mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_STYLE_NAME, sStyleName );
+
+ sDefaultCellStyle = pTableInfo->maDefaultRowCellStyles[rowIndex];
+ if( sDefaultCellStyle.getLength() )
+ mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_DEFAULT_CELL_STYLE_NAME, sDefaultCellStyle );
+ }
+
+ // write row element
+ SvXMLElementExport tableRowElement( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_ROW, sal_True, sal_True );
+
+ for ( sal_Int32 columnIndex = 0; columnIndex < columnCount; columnIndex++ )
+ {
+ // get current cell, remarks row index is 0, because we get the range for each row seperate
+ Reference< XCell > xCell( xCellRange->getCellByPosition(columnIndex, 0), UNO_QUERY_THROW );
+
+ // use XMergeableCell interface from offapi
+ Reference< XMergeableCell > xMergeableCell( xCell, UNO_QUERY_THROW );
+
+ // export cell
+ ExportCell( xCell, pTableInfo, sDefaultCellStyle );
+ }
+ }
+ }
+ catch( Exception )
+ {
+ OSL_FAIL( "XMLTableExport::exportTable(), exception cought!" );
+ }
+ }
+
+// --------------------------------------------------------------------
+// Export the table columns
+// --------------------------------------------------------------------
+
+ void XMLTableExport::ExportTableColumns( const Reference < XIndexAccess >& xtableColumnsIndexAccess, const boost::shared_ptr< XMLTableInfo >& pTableInfo )
+ {
+ const sal_Int32 nColumnCount = xtableColumnsIndexAccess->getCount();
+ for( sal_Int32 nColumn = 0; nColumn < nColumnCount; ++nColumn )
+ {
+ Reference< XPropertySet > xColumnProperties( xtableColumnsIndexAccess->getByIndex(nColumn) , UNO_QUERY );
+ if ( xColumnProperties.is() )
+ {
+ // table:style-name
+ if( pTableInfo.get() )
+ {
+ Reference< XInterface > xKey( xColumnProperties, UNO_QUERY );
+ const OUString sStyleName( pTableInfo->maColumnStyleMap[xKey] );
+ if( sStyleName.getLength() )
+ mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_STYLE_NAME, sStyleName );
+ }
+
+ // TODO: All columns first have to be checked if some ones
+ // have identical properties. If yes, attr table:number-columns-repeated
+ // has to be written.
+ SvXMLElementExport tableColumnElement( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_COLUMN, sal_True, sal_True );
+ }
+ }
+ }
+
+// --------------------------------------------------------------------
+// ODF export for a table cell.
+// --------------------------------------------------------------------
+
+ void XMLTableExport::ExportCell( const Reference < XCell >& xCell, const boost::shared_ptr< XMLTableInfo >& pTableInfo, const OUString& rDefaultCellStyle )
+ {
+ bool bIsMerged = false;
+ sal_Int32 nRowSpan = 0;
+ sal_Int32 nColSpan = 0;
+
+ try
+ {
+ if( pTableInfo.get() )
+ {
+ // table:style-name
+ Reference< XInterface > xKey( xCell, UNO_QUERY );
+ const OUString sStyleName( pTableInfo->maCellStyleMap[xKey] );
+ if( sStyleName.getLength() && (sStyleName != rDefaultCellStyle) )
+ mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_STYLE_NAME, sStyleName );
+ }
+
+ Reference< XMergeableCell > xMerge( xCell, UNO_QUERY );
+ if( xMerge.is() )
+ {
+ bIsMerged = xMerge->isMerged();
+ nRowSpan = xMerge->getRowSpan();
+ nColSpan = xMerge->getColumnSpan();
+ }
+ DBG_ASSERT( (nRowSpan >= 1) && (nColSpan >= 1), "xmloff::XMLTableExport::ExportCell(), illegal row or col span < 1?" );
+ }
+ catch ( Exception )
+ {
+ OSL_FAIL( "exception while exporting a table cell" );
+ }
+
+ // table:number-columns-repeated
+ // todo
+
+ // table:number-columns-spanned
+ if( nColSpan > 1 )
+ mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_NUMBER_COLUMNS_SPANNED, OUString::valueOf( nColSpan ) );
+
+ // table:number-rows-spanned
+ if( nRowSpan > 1 )
+ mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_NUMBER_ROWS_SPANNED, OUString::valueOf( nRowSpan ) );
+
+ // <table:table-cell> or <table:covered-table-cell>
+ SvXMLElementExport tableCellElement( mrExport, XML_NAMESPACE_TABLE, bIsMerged ? XML_COVERED_TABLE_CELL : XML_TABLE_CELL, sal_True, sal_True );
+
+ // export cells text content
+ ImpExportText( xCell );
+ }
+
+// --------------------------------------------------------------------
+// ODF export of the text contents of a table cell.
+// Remarks: Up to now we only export text contents!
+// TODO: Check against nested tables ....
+// --------------------------------------------------------------------
+
+ void XMLTableExport::ImpExportText( const Reference< XCell >& xCell )
+ {
+ Reference< XText > xText( xCell, UNO_QUERY );
+ if( xText.is() && xText->getString().getLength())
+ mrExport.GetTextParagraphExport()->exportText( xText );
+ }
+
+// --------------------------------------------------------------------
+
+void XMLTableExport::exportTableStyles()
+{
+ if( !mbExportTables )
+ return;
+
+ XMLStyleExport aStEx(mrExport, OUString(), mrExport.GetAutoStylePool().get());
+
+ // write graphic family styles
+ aStEx.exportStyleFamily("cell", OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_TABLE_CELL_STYLES_NAME)), mxCellExportPropertySetMapper.get(), sal_True, XML_STYLE_FAMILY_TABLE_CELL);
+
+ exportTableTemplates();
+}
+
+// --------------------------------------------------------------------
+// Export the collected automatic styles
+// --------------------------------------------------------------------
+
+void XMLTableExport::exportAutoStyles()
+{
+ if( !mbExportTables )
+ return;
+
+ mrExport.GetAutoStylePool()->exportXML( XML_STYLE_FAMILY_TABLE_COLUMN, mrExport.GetDocHandler(), mrExport.GetMM100UnitConverter(), mrExport.GetNamespaceMap() );
+ mrExport.GetAutoStylePool()->exportXML( XML_STYLE_FAMILY_TABLE_ROW, mrExport.GetDocHandler(), mrExport.GetMM100UnitConverter(), mrExport.GetNamespaceMap() );
+ mrExport.GetAutoStylePool()->exportXML( XML_STYLE_FAMILY_TABLE_CELL, mrExport.GetDocHandler(), mrExport.GetMM100UnitConverter(), mrExport.GetNamespaceMap() );
+}
+
+// --------------------------------------------------------------------
+
+const TableStyleElement* getTableStyleMap()
+{
+ static struct TableStyleElement gTableStyleElements[] =
+ {
+ { XML_FIRST_ROW, OUString( RTL_CONSTASCII_USTRINGPARAM( "first-row" ) ) },
+ { XML_LAST_ROW, OUString( RTL_CONSTASCII_USTRINGPARAM( "last-row" ) ) },
+ { XML_FIRST_COLUMN, OUString( RTL_CONSTASCII_USTRINGPARAM( "first-column" ) ) },
+ { XML_LAST_COLUMN, OUString( RTL_CONSTASCII_USTRINGPARAM( "last-column" ) ) },
+ { XML_EVEN_ROWS, OUString( RTL_CONSTASCII_USTRINGPARAM( "even-rows" ) ) },
+ { XML_ODD_ROWS, OUString( RTL_CONSTASCII_USTRINGPARAM( "odd-rows" ) ) },
+ { XML_EVEN_COLUMNS, OUString( RTL_CONSTASCII_USTRINGPARAM( "even-columns" ) ) },
+ { XML_ODD_COLUMNS, OUString( RTL_CONSTASCII_USTRINGPARAM( "odd-columns" ) ) },
+ { XML_BODY, OUString( RTL_CONSTASCII_USTRINGPARAM( "body" ) ) },
+ { XML_TOKEN_END, OUString() }
+ };
+
+ return &gTableStyleElements[0];
+}
+
+// --------------------------------------------------------------------
+
+void XMLTableExport::exportTableTemplates()
+{
+ if( !mbExportTables )
+ return;
+
+ try
+ {
+ Reference< XStyleFamiliesSupplier > xFamiliesSupp( mrExport.GetModel(), UNO_QUERY_THROW );
+ Reference< XNameAccess > xFamilies( xFamiliesSupp->getStyleFamilies() );
+ const OUString sFamilyName( RTL_CONSTASCII_USTRINGPARAM("table" ) );
+ Reference< XIndexAccess > xTableFamily( xFamilies->getByName( sFamilyName ), UNO_QUERY_THROW );
+
+ for( sal_Int32 nIndex = 0; nIndex < xTableFamily->getCount(); nIndex++ ) try
+ {
+ Reference< XStyle > xTableStyle( xTableFamily->getByIndex( nIndex ), UNO_QUERY_THROW );
+ if( !xTableStyle->isInUse() )
+ continue;
+
+ Reference< XNameAccess > xStyleNames( xTableStyle, UNO_QUERY_THROW );
+
+ mrExport.AddAttribute(XML_NAMESPACE_TEXT, XML_STYLE_NAME, GetExport().EncodeStyleName( xTableStyle->getName() ) );
+ SvXMLElementExport tableTemplate( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_TEMPLATE, sal_True, sal_True );
+
+ const TableStyleElement* pElements = getTableStyleMap();
+ while( pElements->meElement != XML_TOKEN_END )
+ {
+ try
+ {
+ Reference< XStyle > xStyle( xStyleNames->getByName( pElements->msStyleName ), UNO_QUERY );
+ if( xStyle.is() )
+ {
+ mrExport.AddAttribute(XML_NAMESPACE_TEXT, XML_STYLE_NAME, GetExport().EncodeStyleName( xStyle->getName() ) );
+ SvXMLElementExport element( mrExport, XML_NAMESPACE_TABLE, pElements->meElement, sal_True, sal_True );
+ }
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL("xmloff::XMLTableExport::exportTableTemplates(), exception caught!");
+ }
+
+ pElements++;
+ }
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL("xmloff::XMLTableExport::exportTableDesigns(), exception caught while exporting a table design!");
+ }
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL("xmloff::XMLTableExport::exportTableDesigns(), exception caught!");
+ }
+}
+
+// --------------------------------------------------------------------
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/table/XMLTableImport.cxx b/xmloff/source/table/XMLTableImport.cxx
new file mode 100644
index 000000000000..26cd8621dbec
--- /dev/null
+++ b/xmloff/source/table/XMLTableImport.cxx
@@ -0,0 +1,829 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/table/XTableRows.hpp>
+#include <com/sun/star/table/XMergeableCell.hpp>
+#include <com/sun/star/table/XMergeableCellRange.hpp>
+#include <com/sun/star/table/XTable.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+
+#include "xmloff/table/XMLTableImport.hxx"
+#include "xmloff/xmltkmap.hxx"
+#include "xmloff/maptype.hxx"
+#include "xmloff/xmlprmap.hxx"
+#include "xmloff/txtimp.hxx"
+#include "xmloff/xmlimp.hxx"
+#include "xmloff/nmspmap.hxx"
+#include "xmloff/xmlstyle.hxx"
+#include "xmloff/prstylei.hxx"
+#include "xmloff/xmlimp.hxx"
+
+#include "xmloff/xmlnmspe.hxx"
+#include "table.hxx"
+
+#include <boost/shared_ptr.hpp>
+
+// --------------------------------------------------------------------
+
+using ::rtl::OUString;
+using namespace ::xmloff::token;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+
+// --------------------------------------------------------------------
+
+struct ColumnInfo
+{
+ OUString msStyleName;
+ sal_Bool mbVisibility;
+ OUString msDefaultCellStyleName;
+};
+
+// --------------------------------------------------------------------
+
+class XMLProxyContext : public SvXMLImportContext
+{
+public:
+ XMLProxyContext( SvXMLImport& rImport, const SvXMLImportContextRef& xParent, sal_uInt16 nPrfx, const OUString& rLName );
+
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList );
+
+private:
+ SvXMLImportContextRef mxParent;
+};
+
+// --------------------------------------------------------------------
+
+struct MergeInfo
+{
+ sal_Int32 mnStartColumn;
+ sal_Int32 mnStartRow;
+ sal_Int32 mnEndColumn;
+ sal_Int32 mnEndRow;
+
+ MergeInfo( sal_Int32 nStartColumn, sal_Int32 nStartRow, sal_Int32 nColumnSpan, sal_Int32 nRowSpan )
+ : mnStartColumn( nStartColumn ), mnStartRow( nStartRow ), mnEndColumn( nStartColumn + nColumnSpan - 1 ), mnEndRow( nStartRow + nRowSpan - 1 ) {};
+};
+
+typedef std::vector< boost::shared_ptr< MergeInfo > > MergeInfoVector;
+
+// --------------------------------------------------------------------
+
+class XMLTableImportContext : public SvXMLImportContext
+{
+public:
+ XMLTableImportContext( const rtl::Reference< XMLTableImport >& xThis, sal_uInt16 nPrfx, const OUString& rLName, Reference< XColumnRowRange >& xColumnRowRange );
+ virtual ~XMLTableImportContext();
+
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList );
+
+ virtual void StartElement( const Reference< XAttributeList >& xAttrList );
+
+ virtual void EndElement();
+
+ void InitColumns();
+
+ SvXMLImportContext * ImportColumn( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList );
+ SvXMLImportContext * ImportRow( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList );
+ SvXMLImportContext * ImportCell( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList );
+
+ OUString GetDefaultCellStyleName() const;
+
+ rtl::Reference< XMLTableImport > mxTableImporter;
+ ::com::sun::star::uno::Reference< ::com::sun::star::table::XTable > mxTable;
+ Reference< XTableColumns > mxColumns;
+ Reference< XTableRows > mxRows;
+
+ std::vector< boost::shared_ptr< ColumnInfo > > maColumnInfos;
+ sal_Int32 mnCurrentRow;
+ sal_Int32 mnCurrentColumn;
+
+ // default cell style name for the current row
+ OUString msDefaultCellStyleName;
+
+ MergeInfoVector maMergeInfos;
+};
+
+// --------------------------------------------------------------------
+
+class XMLCellImportContext : public SvXMLImportContext
+{
+public:
+ XMLCellImportContext( SvXMLImport& rImport,
+ const Reference< XMergeableCell >& xCell,
+ const OUString& sDefaultCellStyleName,
+ sal_uInt16 nPrfx, const OUString& rLName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual ~XMLCellImportContext();
+
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList );
+
+ virtual void EndElement();
+
+ sal_Int32 getColumnSpan() const { return mnColSpan; }
+ sal_Int32 getRowSpan() const { return mnRowSpan; }
+ sal_Int32 getRepeated() const { return mnRepeated; }
+
+ Reference< XMergeableCell > mxCell;
+ Reference< XTextCursor > mxCursor;
+ Reference< XTextCursor > mxOldCursor;
+ bool mbListContextPushed;
+
+ sal_Int32 mnColSpan, mnRowSpan, mnRepeated;
+};
+
+// --------------------------------------------------------------------
+
+class XMLTableTemplateContext : public SvXMLStyleContext
+{
+public:
+ XMLTableTemplateContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, const Reference< XAttributeList >& xAttrList );
+
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList );
+
+ virtual void StartElement( const Reference< XAttributeList >& xAttrList );
+
+ virtual void EndElement();
+
+private:
+ XMLTableTemplate maTableTemplate;
+ OUString msTemplateStyleName;
+};
+
+// --------------------------------------------------------------------
+// class XMLProxyContext
+// --------------------------------------------------------------------
+
+XMLProxyContext::XMLProxyContext( SvXMLImport& rImport, const SvXMLImportContextRef& xParent, sal_uInt16 nPrfx, const OUString& rLName )
+: SvXMLImportContext( rImport, nPrfx, rLName )
+, mxParent( xParent )
+{
+}
+
+// --------------------------------------------------------------------
+
+SvXMLImportContext * XMLProxyContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList )
+{
+ if( mxParent.Is() )
+ return mxParent->CreateChildContext( nPrefix, rLocalName, xAttrList );
+ else
+ return SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList );
+}
+
+// --------------------------------------------------------------------
+// class XMLTableImport
+// --------------------------------------------------------------------
+
+XMLTableImport::XMLTableImport( SvXMLImport& rImport, const rtl::Reference< XMLPropertySetMapper >& xCellPropertySetMapper, const rtl::Reference< XMLPropertyHandlerFactory >& xFactoryRef )
+: mrImport( rImport )
+{
+ mxCellImportPropertySetMapper = new SvXMLImportPropertyMapper( xCellPropertySetMapper.get(), rImport );
+ mxCellImportPropertySetMapper->ChainImportMapper(XMLTextImportHelper::CreateParaExtPropMapper(rImport));
+
+
+ UniReference < XMLPropertySetMapper > xRowMapper( new XMLPropertySetMapper( getRowPropertiesMap(), xFactoryRef.get() ) );
+ mxRowImportPropertySetMapper = new SvXMLImportPropertyMapper( xRowMapper, rImport );
+
+ UniReference < XMLPropertySetMapper > xColMapper( new XMLPropertySetMapper( getColumnPropertiesMap(), xFactoryRef.get() ) );
+ mxColumnImportPropertySetMapper = new SvXMLImportPropertyMapper( xColMapper, rImport );
+}
+
+// --------------------------------------------------------------------
+
+XMLTableImport::~XMLTableImport()
+{
+}
+
+// --------------------------------------------------------------------
+
+SvXMLImportContext* XMLTableImport::CreateTableContext( sal_uInt16 nPrfx, const OUString& rLName, Reference< XColumnRowRange >& xColumnRowRange )
+{
+ rtl::Reference< XMLTableImport > xThis( this );
+ return new XMLTableImportContext( xThis, nPrfx, rLName, xColumnRowRange );
+}
+
+// --------------------------------------------------------------------
+
+SvXMLStyleContext* XMLTableImport::CreateTableTemplateContext( sal_uInt16 nPrfx, const OUString& rLName, const Reference< XAttributeList >& xAttrList )
+{
+ return new XMLTableTemplateContext( mrImport, nPrfx, rLName, xAttrList );
+}
+
+// --------------------------------------------------------------------
+
+void XMLTableImport::addTableTemplate( const rtl::OUString& rsStyleName, XMLTableTemplate& xTableTemplate )
+{
+ boost::shared_ptr< XMLTableTemplate > xPtr( new XMLTableTemplate );
+ xPtr->swap( xTableTemplate );
+ maTableTemplates[rsStyleName] = xPtr;
+}
+
+// --------------------------------------------------------------------
+
+void XMLTableImport::finishStyles()
+{
+ if( !maTableTemplates.empty() ) try
+ {
+ Reference< XStyleFamiliesSupplier > xFamiliesSupp( mrImport.GetModel(), UNO_QUERY_THROW );
+ Reference< XNameAccess > xFamilies( xFamiliesSupp->getStyleFamilies() );
+ const OUString sFamilyName( RTL_CONSTASCII_USTRINGPARAM("table" ) );
+ const OUString sCellFamilyName( RTL_CONSTASCII_USTRINGPARAM("cell") );
+
+ Reference< XNameContainer > xTableFamily( xFamilies->getByName( sFamilyName ), UNO_QUERY_THROW );
+ Reference< XNameAccess > xCellFamily( xFamilies->getByName( sCellFamilyName ), UNO_QUERY_THROW );
+
+ Reference< XSingleServiceFactory > xFactory( xTableFamily, UNO_QUERY_THROW );
+
+ for( XMLTableTemplateMap::iterator aTemplateIter( maTableTemplates.begin() ); aTemplateIter != maTableTemplates.end(); aTemplateIter++ ) try
+ {
+ const OUString sTemplateName( (*aTemplateIter).first );
+ Reference< XNameReplace > xTemplate( xFactory->createInstance(), UNO_QUERY_THROW );
+
+ boost::shared_ptr< XMLTableTemplate > xT( (*aTemplateIter).second );
+
+ for( XMLTableTemplate::iterator aStyleIter( xT->begin() ); aStyleIter != xT->end(); aStyleIter++ ) try
+ {
+ const OUString sPropName( (*aStyleIter).first );
+ const OUString sStyleName( (*aStyleIter).second );
+ xTemplate->replaceByName( sPropName, xCellFamily->getByName( sStyleName ) );
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL("xmloff::XMLTableImport::finishStyles(), exception caught!");
+ }
+
+ if( xTemplate.is() )
+ {
+ if( xTableFamily->hasByName( sTemplateName ) )
+ xTableFamily->replaceByName( sTemplateName, Any( xTemplate ) );
+ else
+ xTableFamily->insertByName( sTemplateName, Any( xTemplate ) );
+ }
+
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL("xmloff::XMLTableImport::finishStyles(), exception caught!");
+ }
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL("xmloff::XMLTableImport::finishStyles(), exception caught!");
+ }
+}
+
+// --------------------------------------------------------------------
+// class XMLTableImport
+// --------------------------------------------------------------------
+
+
+XMLTableImportContext::XMLTableImportContext( const rtl::Reference< XMLTableImport >& xImporter, sal_uInt16 nPrfx, const OUString& rLName, Reference< XColumnRowRange >& xColumnRowRange )
+: SvXMLImportContext( xImporter->mrImport, nPrfx, rLName )
+, mxTableImporter( xImporter )
+, mxTable( xColumnRowRange, UNO_QUERY )
+, mxColumns( xColumnRowRange->getColumns() )
+, mxRows( xColumnRowRange->getRows() )
+, mnCurrentRow( -1 )
+, mnCurrentColumn( -1 )
+{
+}
+
+// --------------------------------------------------------------------
+
+XMLTableImportContext::~XMLTableImportContext()
+{
+}
+
+// --------------------------------------------------------------------
+
+SvXMLImportContext * XMLTableImportContext::ImportColumn( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList )
+{
+ if( mxColumns.is() && (mnCurrentRow == -1) ) try
+ {
+ boost::shared_ptr< ColumnInfo > xInfo ( new ColumnInfo );
+
+ sal_Int32 nRepeated = 1;
+
+ // read attributes for the table-column
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ const OUString sAttrName( xAttrList->getNameByIndex( i ) );
+ const OUString sValue( xAttrList->getValueByIndex( i ) );
+ OUString aLocalName;
+
+ sal_uInt16 nPrefix2 = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ if( XML_NAMESPACE_TABLE == nPrefix2 )
+ {
+ if( IsXMLToken( aLocalName, XML_NUMBER_COLUMNS_REPEATED ) )
+ {
+ nRepeated = sValue.toInt32();
+ }
+ else if( IsXMLToken( aLocalName, XML_STYLE_NAME ) )
+ {
+ xInfo->msStyleName = sValue;
+ }
+ else if( IsXMLToken( aLocalName, XML_DEFAULT_CELL_STYLE_NAME ) )
+ {
+ xInfo->msDefaultCellStyleName = sValue;
+ }
+ else if( IsXMLToken( aLocalName, XML_VISIBILITY ) )
+ {
+ xInfo->mbVisibility = IsXMLToken( sValue, XML_VISIBLE );
+ }
+ }
+ else if ( (XML_NAMESPACE_XML == nPrefix2) &&
+ IsXMLToken(aLocalName, XML_ID) )
+ {
+ (void) sValue;
+//FIXME: TODO
+ }
+ }
+
+ if( nRepeated <= 1 )
+ {
+ maColumnInfos.push_back( xInfo );
+ }
+ else
+ {
+ maColumnInfos.insert( maColumnInfos.end(), nRepeated, xInfo );
+ }
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL("xmloff::XMLTableImportContext::ImportTableColumn(), exception caught!");
+ }
+
+ return SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList);
+}
+
+// --------------------------------------------------------------------
+
+void XMLTableImportContext::InitColumns()
+{
+ if( mxColumns.is() ) try
+ {
+ const sal_Int32 nCount1 = mxColumns->getCount();
+ const sal_Int32 nCount2 = sal::static_int_cast< sal_Int32 >( maColumnInfos.size() );
+ if( nCount1 < nCount2 )
+ mxColumns->insertByIndex( nCount1, nCount2 - nCount1 );
+
+ SvXMLStylesContext * pAutoStyles = GetImport().GetShapeImport()->GetAutoStylesContext();
+
+ for( sal_Int32 nCol = 0; nCol < nCount2; nCol++ )
+ {
+ boost::shared_ptr< ColumnInfo > xInfo( maColumnInfos[nCol] );
+
+ if( pAutoStyles && xInfo->msStyleName.getLength() )
+ {
+ const XMLPropStyleContext* pStyle =
+ dynamic_cast< const XMLPropStyleContext* >(
+ pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_TABLE_COLUMN, xInfo->msStyleName) );
+
+ if( pStyle )
+ {
+ Reference< XPropertySet > xColProps( mxColumns->getByIndex(nCol), UNO_QUERY_THROW );
+ const_cast< XMLPropStyleContext* >( pStyle )->FillPropertySet( xColProps );
+ }
+ }
+
+ }
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL("xmloff::XMLTableImportContext::ImportTableColumn(), exception caught!");
+ }
+}
+
+// --------------------------------------------------------------------
+
+SvXMLImportContext * XMLTableImportContext::ImportRow( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList )
+{
+ if( mxRows.is() )
+ {
+ mnCurrentRow++;
+ if( mnCurrentRow == 0 )
+ InitColumns(); // first init columns
+
+ mnCurrentColumn = -1;
+
+ const sal_Int32 nRowCount = mxRows->getCount();
+ if( ( nRowCount - 1) < mnCurrentRow )
+ {
+ const sal_Int32 nCount = mnCurrentRow - nRowCount + 1;
+ mxRows->insertByIndex( nRowCount, nCount );
+ }
+
+ Reference< XPropertySet > xRowSet( mxRows->getByIndex(mnCurrentRow), UNO_QUERY );
+
+ OUString sStyleName;
+
+ // read attributes for the table-row
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ const OUString sAttrName( xAttrList->getNameByIndex( i ) );
+ const OUString sValue( xAttrList->getValueByIndex( i ) );
+ OUString aLocalName;
+
+ sal_uInt16 nPrefix2 = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ if( nPrefix2 == XML_NAMESPACE_TABLE )
+ {
+ if( IsXMLToken( aLocalName, XML_STYLE_NAME ) )
+ {
+ sStyleName = sValue;
+ }
+ else if( IsXMLToken( aLocalName, XML_DEFAULT_CELL_STYLE_NAME ) )
+ {
+ msDefaultCellStyleName = sValue;
+ }
+#if 0
+ else if( IsXMLToken( aLocalName, XML_VISIBILITY ) )
+ {
+ bVisibility = IsXMLToken( sValue, XML_VISIBLE );
+ }
+ else if( IsXMLToken( aLocalName, XML_NUMBER_ROWS_REPEATED ) )
+ {
+ nRepeated = sValue.toInt32();
+ }
+#endif
+ }
+ else if ( (XML_NAMESPACE_XML == nPrefix2) &&
+ IsXMLToken(aLocalName, XML_ID) )
+ {
+ (void) sValue;
+//FIXME: TODO
+ }
+ }
+
+ if( sStyleName.getLength() )
+ {
+ SvXMLStylesContext * pAutoStyles = GetImport().GetShapeImport()->GetAutoStylesContext();
+ if( pAutoStyles )
+ {
+ const XMLPropStyleContext* pStyle =
+ dynamic_cast< const XMLPropStyleContext* >(
+ pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_TABLE_ROW, sStyleName) );
+
+ if( pStyle )
+ {
+ const_cast< XMLPropStyleContext* >( pStyle )->FillPropertySet( xRowSet );
+ }
+ }
+ }
+ }
+
+ SvXMLImportContextRef xThis( this );
+ return new XMLProxyContext( GetImport(), xThis, nPrefix, rLocalName );
+}
+
+// --------------------------------------------------------------------
+
+SvXMLImportContext * XMLTableImportContext::ImportCell( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList )
+{
+ mnCurrentColumn++;
+ if( mxColumns.is() ) try
+ {
+ if( mxColumns->getCount() <= mnCurrentColumn )
+ mxColumns->insertByIndex( mxColumns->getCount(), mnCurrentColumn - mxColumns->getCount() + 1 );
+
+ Reference< XMergeableCell > xCell( mxTable->getCellByPosition( mnCurrentColumn, mnCurrentRow ), UNO_QUERY_THROW );
+ XMLCellImportContext* pCellContext = new XMLCellImportContext( GetImport(), xCell, GetDefaultCellStyleName(), nPrefix, rLocalName, xAttrList );
+
+ const sal_Int32 nColumnSpan = pCellContext->getColumnSpan();
+ const sal_Int32 nRowSpan = pCellContext->getRowSpan();
+ if( (nColumnSpan > 1) || (nRowSpan > 1) )
+ maMergeInfos.push_back( boost::shared_ptr< MergeInfo >( new MergeInfo( mnCurrentColumn, mnCurrentRow, nColumnSpan, nRowSpan ) ) );
+
+ const sal_Int32 nRepeated = pCellContext->getRepeated();
+ if( nRepeated > 1 )
+ {
+ OSL_FAIL("xmloff::XMLTableImportContext::ImportCell(), import of repeated Cells not implemented (TODO)");
+ mnCurrentColumn += nRepeated - 1;
+ }
+
+ return pCellContext;
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL("xmloff::XMLTableImportContext::ImportCell(), exception caught!");
+ }
+
+ return SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList);
+}
+
+// --------------------------------------------------------------------
+
+SvXMLImportContext *XMLTableImportContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList )
+{
+ if( nPrefix == XML_NAMESPACE_TABLE )
+ {
+ if( IsXMLToken( rLocalName, XML_TABLE_COLUMN ) )
+ return ImportColumn( nPrefix, rLocalName, xAttrList );
+ else if( IsXMLToken( rLocalName, XML_TABLE_ROW ) )
+ return ImportRow( nPrefix, rLocalName, xAttrList );
+ else if( IsXMLToken( rLocalName, XML_TABLE_CELL ) || IsXMLToken( rLocalName, XML_COVERED_TABLE_CELL ) )
+ return ImportCell( nPrefix, rLocalName, xAttrList );
+ else if( IsXMLToken( rLocalName, XML_TABLE_COLUMNS ) || IsXMLToken( rLocalName, XML_TABLE_ROWS ) )
+ {
+ SvXMLImportContextRef xThis( this );
+ return new XMLProxyContext( GetImport(), xThis, nPrefix, rLocalName );
+ }
+ }
+
+ return SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList);
+}
+
+// --------------------------------------------------------------------
+
+void XMLTableImportContext::StartElement( const Reference< XAttributeList >& /*xAttrList*/ )
+{
+}
+
+// --------------------------------------------------------------------
+
+void XMLTableImportContext::EndElement()
+{
+ if( !maMergeInfos.empty() )
+ {
+ MergeInfoVector::iterator aIter( maMergeInfos.begin() );
+ while( aIter != maMergeInfos.end() )
+ {
+ boost::shared_ptr< MergeInfo > xInfo( (*aIter++) );
+
+ if( xInfo.get() ) try
+ {
+ Reference< XCellRange > xRange( mxTable->getCellRangeByPosition( xInfo->mnStartColumn, xInfo->mnStartRow, xInfo->mnEndColumn, xInfo->mnEndRow ) );
+ Reference< XMergeableCellRange > xCursor( mxTable->createCursorByRange( xRange ), UNO_QUERY_THROW );
+ xCursor->merge();
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL("XMLTableImportContext::EndElement(), exception caught while merging cells!");
+ }
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+OUString XMLTableImportContext::GetDefaultCellStyleName() const
+{
+ OUString sStyleName( msDefaultCellStyleName );
+
+ // if there is still no style name, try default style name from column
+ if( (sStyleName.getLength() == 0) && (mnCurrentColumn < sal::static_int_cast<sal_Int32>(maColumnInfos.size())) )
+ sStyleName = maColumnInfos[mnCurrentColumn]->msDefaultCellStyleName;
+
+ return sStyleName;
+}
+
+// --------------------------------------------------------------------
+// XMLCellImportContext
+// --------------------------------------------------------------------
+
+XMLCellImportContext::XMLCellImportContext( SvXMLImport& rImport, const Reference< XMergeableCell >& xCell, const OUString& sDefaultCellStyleName, sal_uInt16 nPrfx, const OUString& rLName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList )
+: SvXMLImportContext( rImport, nPrfx, rLName )
+, mxCell( xCell )
+, mbListContextPushed( false )
+, mnColSpan( 1 )
+, mnRowSpan( 1 )
+, mnRepeated( 1 )
+{
+ OUString sStyleName;
+
+ // read attributes for the table-cell
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ const OUString sAttrName( xAttrList->getNameByIndex( i ) );
+ const OUString sValue( xAttrList->getValueByIndex( i ) );
+ OUString aLocalName;
+
+ sal_uInt16 nPrefix2 = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ if( XML_NAMESPACE_TABLE == nPrefix2 )
+ {
+ if( IsXMLToken( aLocalName, XML_NUMBER_COLUMNS_REPEATED ) )
+ {
+ mnRepeated = sValue.toInt32();
+ }
+ else if( IsXMLToken( aLocalName, XML_NUMBER_COLUMNS_SPANNED ) )
+ {
+ mnColSpan = sValue.toInt32();
+ }
+ else if( IsXMLToken( aLocalName, XML_NUMBER_ROWS_SPANNED ) )
+ {
+ mnRowSpan = sValue.toInt32();
+ }
+ else if( IsXMLToken( aLocalName, XML_STYLE_NAME ) )
+ {
+ sStyleName = sValue;
+ }
+ }
+ else if ( (XML_NAMESPACE_XML == nPrefix2) &&
+ IsXMLToken(aLocalName, XML_ID) )
+ {
+ (void) sValue;
+//FIXME: TODO
+ }
+//FIXME: RDFa (table:table-cell)
+ }
+
+ // if there is no style name at the cell, try default style name from row
+ if( sStyleName.getLength() == 0 )
+ sStyleName = sDefaultCellStyleName;
+
+ if( sStyleName.getLength() )
+ {
+ SvXMLStylesContext * pAutoStyles = GetImport().GetShapeImport()->GetAutoStylesContext();
+ if( pAutoStyles )
+ {
+ const XMLPropStyleContext* pStyle =
+ dynamic_cast< const XMLPropStyleContext* >(
+ pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_TABLE_CELL, sStyleName) );
+
+ if( pStyle )
+ {
+ Reference< XPropertySet > xCellSet( mxCell, UNO_QUERY );
+ if( xCellSet.is() )
+ const_cast< XMLPropStyleContext* >( pStyle )->FillPropertySet( xCellSet );
+ }
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+XMLCellImportContext::~XMLCellImportContext()
+{
+}
+
+// --------------------------------------------------------------------
+
+SvXMLImportContext * XMLCellImportContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList )
+{
+ // create text cursor on demand
+ if( !mxCursor.is() )
+ {
+ Reference< XText > xText( mxCell, UNO_QUERY );
+ if( xText.is() )
+ {
+ UniReference < XMLTextImportHelper > xTxtImport( GetImport().GetTextImport() );
+ mxOldCursor = xTxtImport->GetCursor();
+ mxCursor = xText->createTextCursor();
+ if( mxCursor.is() )
+ xTxtImport->SetCursor( mxCursor );
+
+ // remember old list item and block (#91964#) and reset them
+ // for the text frame
+ xTxtImport->PushListContext();
+ mbListContextPushed = true;
+ }
+ }
+
+ SvXMLImportContext * pContext = 0;
+
+ // if we have a text cursor, lets try to import some text
+ if( mxCursor.is() )
+ {
+ pContext = GetImport().GetTextImport()->CreateTextChildContext( GetImport(), nPrefix, rLocalName, xAttrList );
+ }
+
+ if( pContext )
+ return pContext;
+ else
+ return SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList);
+}
+
+// --------------------------------------------------------------------
+
+// --------------------------------------------------------------------
+
+void XMLCellImportContext::EndElement()
+{
+ if(mxCursor.is())
+ {
+ // delete addition newline
+ const OUString aEmpty;
+ mxCursor->gotoEnd( sal_False );
+ mxCursor->goLeft( 1, sal_True );
+ mxCursor->setString( aEmpty );
+
+ // reset cursor
+ GetImport().GetTextImport()->ResetCursor();
+ }
+
+ if(mxOldCursor.is())
+ GetImport().GetTextImport()->SetCursor( mxOldCursor );
+
+ // reinstall old list item (if necessary) #91964#
+ if (mbListContextPushed) {
+ GetImport().GetTextImport()->PopListContext();
+ }
+}
+
+// --------------------------------------------------------------------
+// class XMLTableTemplateContext
+// --------------------------------------------------------------------
+
+XMLTableTemplateContext::XMLTableTemplateContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, const Reference< XAttributeList >& xAttrList )
+: SvXMLStyleContext( rImport, nPrfx, rLName, xAttrList, XML_STYLE_FAMILY_TABLE_TEMPLATE_ID, sal_False )
+{
+}
+
+// --------------------------------------------------------------------
+
+void XMLTableTemplateContext::StartElement( const Reference< XAttributeList >& xAttrList )
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName;
+ sal_uInt16 nAttrPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( xAttrList->getNameByIndex( i ), &sAttrName );
+ if( (nAttrPrefix == XML_NAMESPACE_TEXT ) && IsXMLToken( sAttrName, XML_STYLE_NAME ) )
+ {
+ msTemplateStyleName = xAttrList->getValueByIndex( i );
+ break;
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+void XMLTableTemplateContext::EndElement()
+{
+ rtl::Reference< XMLTableImport > xTableImport( GetImport().GetShapeImport()->GetShapeTableImport() );
+ if( xTableImport.is() )
+ xTableImport->addTableTemplate( msTemplateStyleName, maTableTemplate );
+}
+
+// --------------------------------------------------------------------
+
+SvXMLImportContext * XMLTableTemplateContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList )
+{
+ if( nPrefix == XML_NAMESPACE_TABLE )
+ {
+ const TableStyleElement* pElements = getTableStyleMap();
+ while( (pElements->meElement != XML_TOKEN_END) && !IsXMLToken( rLocalName, pElements->meElement ) )
+ pElements++;
+
+ if( pElements->meElement != XML_TOKEN_END )
+ {
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName;
+ sal_uInt16 nAttrPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( xAttrList->getNameByIndex( i ), &sAttrName );
+ if( (nAttrPrefix == XML_NAMESPACE_TEXT) && IsXMLToken( sAttrName, XML_STYLE_NAME ) )
+ {
+ maTableTemplate[pElements->msStyleName] = xAttrList->getValueByIndex( i );
+ break;
+ }
+ }
+ }
+ }
+
+ return SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList );
+}
+
+// --------------------------------------------------------------------
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/table/table.hxx b/xmloff/source/table/table.hxx
new file mode 100644
index 000000000000..595e71d72582
--- /dev/null
+++ b/xmloff/source/table/table.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_TABLE_TABLE_HXX_
+#define _XMLOFF_TABLE_TABLE_HXX_
+
+#include "xmloff/xmltoken.hxx"
+
+struct XMLPropertyMapEntry;
+
+struct TableStyleElement
+{
+ ::xmloff::token::XMLTokenEnum meElement;
+ ::rtl::OUString msStyleName;
+};
+
+extern const TableStyleElement* getTableStyleMap();
+extern const XMLPropertyMapEntry* getColumnPropertiesMap();
+extern const XMLPropertyMapEntry* getRowPropertiesMap();
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLAnchorTypePropHdl.hxx b/xmloff/source/text/XMLAnchorTypePropHdl.hxx
new file mode 100644
index 000000000000..4d45710387ae
--- /dev/null
+++ b/xmloff/source/text/XMLAnchorTypePropHdl.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLANCHORTYPEPROPHDL_HXX
+#define _XMLOFF_XMLANCHORTYPEPROPHDL_HXX
+
+#include <com/sun/star/text/TextContentAnchorType.hpp>
+#include <xmloff/xmlprhdl.hxx>
+
+
+class XMLAnchorTypePropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLAnchorTypePropHdl ();
+
+ virtual sal_Bool importXML(
+ const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML(
+ ::rtl::OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const;
+ static sal_Bool convert( const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::text::TextContentAnchorType& rType );
+};
+
+#endif // _XMLOFF_XMLANCHORTYPEPROPHDL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLAutoMarkFileContext.cxx b/xmloff/source/text/XMLAutoMarkFileContext.cxx
new file mode 100644
index 000000000000..da893a4958db
--- /dev/null
+++ b/xmloff/source/text/XMLAutoMarkFileContext.cxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLAutoMarkFileContext.hxx"
+#include <xmloff/xmlimp.hxx>
+#include <rtl/ustring.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+
+using ::rtl::OUString;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::xml::sax::XAttributeList;
+using ::com::sun::star::beans::XPropertySet;
+
+using ::xmloff::token::IsXMLToken;
+using ::xmloff::token::XML_HREF;
+
+
+TYPEINIT1( XMLAutoMarkFileContext, SvXMLImportContext );
+
+XMLAutoMarkFileContext::XMLAutoMarkFileContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName) :
+ SvXMLImportContext(rImport, nPrefix, rLocalName),
+ sIndexAutoMarkFileURL(
+ RTL_CONSTASCII_USTRINGPARAM("IndexAutoMarkFileURL"))
+{
+}
+
+XMLAutoMarkFileContext::~XMLAutoMarkFileContext()
+{
+}
+
+
+void XMLAutoMarkFileContext::StartElement(
+ const Reference<XAttributeList> & xAttrList)
+{
+ // scan for text:alphabetical-index-auto-mark-file attribute, and if
+ // found set value with the document
+
+ sal_Int16 nLength = xAttrList->getLength();
+ for( sal_Int16 i = 0; i < nLength; i++ )
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(i), &sLocalName );
+
+ if ( ( XML_NAMESPACE_XLINK == nPrefix ) &&
+ IsXMLToken(sLocalName, XML_HREF) )
+ {
+ Any aAny;
+ aAny <<= GetImport().GetAbsoluteReference( xAttrList->getValueByIndex(i) );
+ Reference<XPropertySet> xPropertySet(
+ GetImport().GetModel(), UNO_QUERY );
+ if (xPropertySet.is())
+ {
+ xPropertySet->setPropertyValue( sIndexAutoMarkFileURL, aAny );
+ }
+ }
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLAutoMarkFileContext.hxx b/xmloff/source/text/XMLAutoMarkFileContext.hxx
new file mode 100644
index 000000000000..78360212a388
--- /dev/null
+++ b/xmloff/source/text/XMLAutoMarkFileContext.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLAUTOMARKFILECONTEXT_HXX_
+#define _XMLOFF_XMLAUTOMARKFILECONTEXT_HXX_
+
+#include <xmloff/xmlictxt.hxx>
+
+
+namespace com { namespace sun { namespace star {
+ namespace uno { template<class X> class Reference; }
+ namespace beans { class XPropertySet; }
+ namespace xml { namespace sax { class XAttributeList; } }
+} } }
+namespace rtl { class OUString; }
+
+
+class XMLAutoMarkFileContext : public SvXMLImportContext
+{
+ const ::rtl::OUString sIndexAutoMarkFileURL;
+
+public:
+
+ TYPEINFO();
+
+ XMLAutoMarkFileContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName);
+
+ ~XMLAutoMarkFileContext();
+
+protected:
+
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLAutoTextContainerEventImport.cxx b/xmloff/source/text/XMLAutoTextContainerEventImport.cxx
new file mode 100644
index 000000000000..75bdfe9b1e59
--- /dev/null
+++ b/xmloff/source/text/XMLAutoTextContainerEventImport.cxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLAutoTextContainerEventImport.hxx"
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/container/XNameReplace.hpp>
+#include <xmloff/xmlimp.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/XMLEventsImportContext.hxx>
+
+
+using namespace ::com::sun::star;
+
+using ::rtl::OUString;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::xml::sax::XAttributeList;
+using ::com::sun::star::container::XNameReplace;
+using ::xmloff::token::IsXMLToken;
+using ::xmloff::token::XML_EVENT_LISTENERS;
+
+
+TYPEINIT1(XMLAutoTextContainerEventImport, SvXMLImportContext);
+
+
+XMLAutoTextContainerEventImport::XMLAutoTextContainerEventImport(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const Reference<XNameReplace> & rEvnts ) :
+ SvXMLImportContext(rImport, nPrfx, rLName),
+ rEvents(rEvnts)
+{
+}
+
+XMLAutoTextContainerEventImport::~XMLAutoTextContainerEventImport()
+{
+}
+
+SvXMLImportContext* XMLAutoTextContainerEventImport::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & )
+{
+ if ( (XML_NAMESPACE_OFFICE == nPrefix) &&
+ IsXMLToken( rLocalName, XML_EVENT_LISTENERS) )
+ {
+ return new XMLEventsImportContext(GetImport(), nPrefix, rLocalName,
+ rEvents);
+ }
+ else
+ return new SvXMLImportContext(GetImport(), nPrefix, rLocalName);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLAutoTextContainerEventImport.hxx b/xmloff/source/text/XMLAutoTextContainerEventImport.hxx
new file mode 100644
index 000000000000..f0e9c8dbfe64
--- /dev/null
+++ b/xmloff/source/text/XMLAutoTextContainerEventImport.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLAUTOTEXTCONTAINEREVENTIMPORT_HXX
+#define _XMLOFF_XMLAUTOTEXTCONTAINEREVENTIMPORT_HXX
+
+#include <xmloff/xmlictxt.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+
+
+namespace rtl { class OUString; }
+namespace com { namespace sun { namespace star {
+ namespace container { class XNameReplace; }
+ namespace xml { namespace sax { class XAttributeList; } }
+} } }
+
+
+/**
+ * Import the text:auto-text-container element.
+ * This only instantiates text:auto-text-group contexta.
+ */
+class XMLAutoTextContainerEventImport : public SvXMLImportContext
+{
+ /// the parent auto text container
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XNameReplace> & rEvents;
+
+public:
+
+ TYPEINFO();
+
+ XMLAutoTextContainerEventImport(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XNameReplace > & rEvents );
+
+ ~XMLAutoTextContainerEventImport();
+
+
+protected:
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLAutoTextEventExport.cxx b/xmloff/source/text/XMLAutoTextEventExport.cxx
new file mode 100644
index 000000000000..1b14c1fb9665
--- /dev/null
+++ b/xmloff/source/text/XMLAutoTextEventExport.cxx
@@ -0,0 +1,286 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLAutoTextEventExport.hxx"
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#include <com/sun/star/container/XNameReplace.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Exception.hpp>
+#include <rtl/ustrbuf.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/XMLEventExport.hxx>
+#include <tools/debug.hxx>
+
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::std::set;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::beans::PropertyValue;
+using ::com::sun::star::container::XNameAccess;
+using ::com::sun::star::container::XNameReplace;
+using ::com::sun::star::document::XEventsSupplier;
+using ::com::sun::star::frame::XModel;
+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::XInterface;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::xml::sax::XDocumentHandler;
+
+
+const sal_Char sAPI_AutoText[] = "com.sun.star.text.AutoTextContainer";
+
+
+XMLAutoTextEventExport::XMLAutoTextEventExport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ sal_uInt16 nFlags
+ )
+: SvXMLExport( xServiceFactory, MAP_INCH, XML_AUTO_TEXT, nFlags ),
+ sEventType(RTL_CONSTASCII_USTRINGPARAM("EventType")),
+ sNone(RTL_CONSTASCII_USTRINGPARAM("None"))
+{
+}
+
+XMLAutoTextEventExport::XMLAutoTextEventExport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ const OUString& rFileName,
+ const Reference<XDocumentHandler> & rHandler,
+ const Reference<XModel> & rModel,
+ const Reference<XNameAccess> & rEvents,
+ sal_uInt16 /*nFlags*/ )
+: SvXMLExport( xServiceFactory, rFileName, rHandler, rModel, MAP_INCH ),
+ xEvents(rEvents),
+ sEventType(RTL_CONSTASCII_USTRINGPARAM("EventType")),
+ sNone(RTL_CONSTASCII_USTRINGPARAM("None"))
+{
+}
+
+XMLAutoTextEventExport::~XMLAutoTextEventExport()
+{
+}
+
+
+void XMLAutoTextEventExport::initialize(
+ const Sequence<Any> & rArguments )
+ throw(uno::Exception, uno::RuntimeException)
+{
+ if (rArguments.getLength() > 1)
+ {
+ Reference<XEventsSupplier> xSupplier;
+ rArguments[1] >>= xSupplier;
+ if (xSupplier.is())
+ {
+ Reference<XNameAccess> xAccess(xSupplier->getEvents(), UNO_QUERY);
+ xEvents = xAccess;
+ }
+ else
+ {
+ Reference<XNameReplace> xReplace;
+ rArguments[1] >>= xReplace;
+ if (xReplace.is())
+ {
+ Reference<XNameAccess> xAccess(xReplace, UNO_QUERY);
+ xEvents = xAccess;
+ }
+ else
+ {
+ rArguments[1] >>= xEvents;
+ }
+ }
+ }
+
+ // call super class (for XHandler)
+ SvXMLExport::initialize(rArguments);
+}
+
+
+sal_uInt32 XMLAutoTextEventExport::exportDoc( enum XMLTokenEnum )
+{
+ if( (getExportFlags() & EXPORT_OASIS) == 0 )
+ {
+ Reference< lang::XMultiServiceFactory > xFactory = getServiceFactory();
+ if( xFactory.is() )
+ {
+ try
+ {
+
+ Sequence<Any> aArgs( 1 );
+ aArgs[0] <<= GetDocHandler();
+
+ // get filter component
+ Reference< xml::sax::XDocumentHandler > xTmpDocHandler(
+ xFactory->createInstanceWithArguments(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Oasis2OOoTransformer")),
+ aArgs), UNO_QUERY);
+ OSL_ENSURE( xTmpDocHandler.is(),
+ "can't instantiate OASIS transformer component" );
+ if( xTmpDocHandler.is() )
+ {
+ SetDocHandler( xTmpDocHandler );
+ }
+ }
+ catch( com::sun::star::uno::Exception& )
+ {
+ }
+ }
+ }
+ if (hasEvents())
+ {
+ GetDocHandler()->startDocument();
+
+ addNamespaces();
+
+ {
+ // container element
+ SvXMLElementExport aContainerElement(
+ *this, XML_NAMESPACE_OOO, XML_AUTO_TEXT_EVENTS,
+ sal_True, sal_True);
+
+ exportEvents();
+ }
+
+ // and close document again
+ GetDocHandler()->endDocument();
+ }
+
+ return 0;
+}
+
+sal_Bool XMLAutoTextEventExport::hasEvents()
+{
+ // TODO: provide full implementation that check for presence of events
+ return xEvents.is();
+}
+
+void XMLAutoTextEventExport::addNamespaces()
+{
+ // namespaces for office:, text: and script:
+ GetAttrList().AddAttribute(
+ GetNamespaceMap().GetAttrNameByIndex( XML_NAMESPACE_OFFICE ),
+ GetNamespaceMap().GetNameByIndex( XML_NAMESPACE_OFFICE ) );
+ GetAttrList().AddAttribute(
+ GetNamespaceMap().GetAttrNameByIndex( XML_NAMESPACE_TEXT ),
+ GetNamespaceMap().GetNameByIndex( XML_NAMESPACE_TEXT ) );
+ GetAttrList().AddAttribute(
+ GetNamespaceMap().GetAttrNameByIndex( XML_NAMESPACE_SCRIPT ),
+ GetNamespaceMap().GetNameByIndex( XML_NAMESPACE_SCRIPT ) );
+ GetAttrList().AddAttribute(
+ GetNamespaceMap().GetAttrNameByIndex( XML_NAMESPACE_DOM ),
+ GetNamespaceMap().GetNameByIndex( XML_NAMESPACE_DOM ) );
+ GetAttrList().AddAttribute(
+ GetNamespaceMap().GetAttrNameByIndex( XML_NAMESPACE_OOO ),
+ GetNamespaceMap().GetNameByIndex( XML_NAMESPACE_OOO ) );
+ GetAttrList().AddAttribute(
+ GetNamespaceMap().GetAttrNameByIndex( XML_NAMESPACE_XLINK ),
+ GetNamespaceMap().GetNameByIndex( XML_NAMESPACE_XLINK ) );
+}
+
+void XMLAutoTextEventExport::exportEvents()
+{
+ DBG_ASSERT(hasEvents(), "no events to export!");
+
+ GetEventExport().Export(xEvents, sal_True);
+}
+
+
+
+// methods without content:
+
+void XMLAutoTextEventExport::_ExportMeta() {}
+void XMLAutoTextEventExport::_ExportScripts() {}
+void XMLAutoTextEventExport::_ExportFontDecls() {}
+void XMLAutoTextEventExport::_ExportStyles( sal_Bool ) {}
+void XMLAutoTextEventExport::_ExportAutoStyles() {}
+void XMLAutoTextEventExport::_ExportMasterStyles() {}
+void XMLAutoTextEventExport::_ExportChangeTracking() {}
+void XMLAutoTextEventExport::_ExportContent() {}
+
+
+
+// methods to support the component registration
+
+Sequence< OUString > SAL_CALL XMLAutoTextEventExport_getSupportedServiceNames()
+ throw()
+{
+ Sequence< OUString > aSeq( 1 );
+ aSeq[0] = XMLAutoTextEventExport_getImplementationName();
+ return aSeq;
+}
+
+OUString SAL_CALL XMLAutoTextEventExport_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.comp.Writer.XMLOasisAutotextEventsExporter" ) );
+}
+
+Reference< XInterface > SAL_CALL XMLAutoTextEventExport_createInstance(
+ const Reference< XMultiServiceFactory > & rSMgr)
+ throw( Exception )
+{
+ return (cppu::OWeakObject*)new XMLAutoTextEventExport(rSMgr, EXPORT_ALL|EXPORT_OASIS);
+}
+
+// methods to support the component registration
+
+Sequence< OUString > SAL_CALL XMLAutoTextEventExportOOO_getSupportedServiceNames()
+ throw()
+{
+ Sequence< OUString > aSeq( 1 );
+ aSeq[0] = XMLAutoTextEventExportOOO_getImplementationName();
+ return aSeq;
+}
+
+OUString SAL_CALL XMLAutoTextEventExportOOO_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.comp.Writer.XMLAutotextEventsExporter" ) );
+}
+
+Reference< XInterface > SAL_CALL XMLAutoTextEventExportOOO_createInstance(
+ const Reference< XMultiServiceFactory > & rSMgr)
+ throw( Exception )
+{
+ return (cppu::OWeakObject*)new XMLAutoTextEventExport(rSMgr,EXPORT_ALL);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLAutoTextEventExport.hxx b/xmloff/source/text/XMLAutoTextEventExport.hxx
new file mode 100644
index 000000000000..28cb956dee7e
--- /dev/null
+++ b/xmloff/source/text/XMLAutoTextEventExport.hxx
@@ -0,0 +1,161 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLAUTOTEXTEVENTEXPORT_HXX
+#define _XMLOFF_XMLAUTOTEXTEVENTEXPORT_HXX
+
+#include <xmloff/xmlexp.hxx>
+
+#include <set>
+
+
+namespace rtl { class OUString; }
+namespace com { namespace sun { namespace star {
+ namespace container { class XNameAccess; }
+ namespace frame { class XModel; }
+ namespace lang { class XMultiServiceFactory; }
+ namespace uno { template<class X> class Reference; }
+ namespace uno { template<class X> class Sequence; }
+ namespace uno { class XInterface; }
+ namespace uno { class Exception; }
+ namespace xml { namespace sax { class XDocumentHandler; } }
+} } }
+
+
+/**
+ * Component for the export of events attached to autotext blocks.
+ * Via the XInitialization interface it expects up to two strings, the
+ * first giving the file name (URL) of the autotext group, and the second
+ * identifying the autotext. If one of the strings is not given, it
+ * will export the whole group / all groups.
+ */
+class XMLAutoTextEventExport : public SvXMLExport
+{
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XNameAccess> xEvents;
+
+ const ::rtl::OUString sEventType;
+ const ::rtl::OUString sNone;
+
+
+public:
+
+ // #110680#
+ //XMLAutoTextEventExport();
+ XMLAutoTextEventExport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, sal_uInt16 nFlags
+ );
+
+ // #110680#
+ //XMLAutoTextEventExport(
+ // const ::rtl::OUString& rFileName,
+ // const ::com::sun::star::uno::Reference<
+ // ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
+ // const ::com::sun::star::uno::Reference<
+ // ::com::sun::star::frame::XModel > & rModel,
+ // const ::com::sun::star::uno::Reference<
+ // ::com::sun::star::container::XNameAccess > & rEvents);
+ XMLAutoTextEventExport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ const ::rtl::OUString& rFileName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & rModel,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > & rEvents, sal_uInt16 nFlags);
+
+ ~XMLAutoTextEventExport();
+
+ // XInitialization
+ virtual void SAL_CALL initialize(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Any> & rArguments )
+ throw(
+ ::com::sun::star::uno::Exception,
+ ::com::sun::star::uno::RuntimeException);
+
+protected:
+
+ /// export the events off all autotexts
+ virtual sal_uInt32 exportDoc(
+ enum ::xmloff::token::XMLTokenEnum eClass = xmloff::token::XML_TOKEN_INVALID );
+
+ /// does the document have any events ?
+ sal_Bool hasEvents();
+
+ /// export the events element
+ void exportEvents();
+
+
+ /// add the namespaces used by events
+ /// (to be called for the document element)
+ void addNamespaces();
+
+
+ // methods without content:
+ virtual void _ExportMeta();
+ virtual void _ExportScripts();
+ virtual void _ExportFontDecls();
+ virtual void _ExportStyles( sal_Bool bUsed ) ;
+ virtual void _ExportAutoStyles();
+ virtual void _ExportMasterStyles();
+ virtual void _ExportChangeTracking();
+ virtual void _ExportContent();
+};
+
+
+
+// global functions to support the component
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ XMLAutoTextEventExport_getSupportedServiceNames()
+ throw();
+
+::rtl::OUString SAL_CALL XMLAutoTextEventExport_getImplementationName()
+ throw();
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
+ XMLAutoTextEventExportOOO_createInstance(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > & )
+ throw( ::com::sun::star::uno::Exception );
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ XMLAutoTextEventExportOOO_getSupportedServiceNames()
+ throw();
+
+::rtl::OUString SAL_CALL XMLAutoTextEventExportOOO_getImplementationName()
+ throw();
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
+ XMLAutoTextEventExportOOO_createInstance(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > & )
+ throw( ::com::sun::star::uno::Exception );
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLAutoTextEventImport.cxx b/xmloff/source/text/XMLAutoTextEventImport.cxx
new file mode 100644
index 000000000000..51b6f81054bf
--- /dev/null
+++ b/xmloff/source/text/XMLAutoTextEventImport.cxx
@@ -0,0 +1,146 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLAutoTextEventImport.hxx"
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include "XMLAutoTextContainerEventImport.hxx"
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <tools/debug.hxx>
+
+using namespace ::com::sun::star;
+
+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::Type;
+using ::com::sun::star::uno::XInterface;
+using ::com::sun::star::uno::RuntimeException;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::xml::sax::XAttributeList;
+using ::com::sun::star::document::XEventsSupplier;
+using ::com::sun::star::container::XNameReplace;
+using ::com::sun::star::lang::XMultiServiceFactory;
+using ::xmloff::token::IsXMLToken;
+using ::xmloff::token::XML_AUTO_TEXT_EVENTS;
+
+const sal_Char sAPI_AutoText[] = "com.sun.star.text.AutoTextContainer";
+
+
+// #110680#
+XMLAutoTextEventImport::XMLAutoTextEventImport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory) throw()
+: SvXMLImport(xServiceFactory)
+{
+}
+
+XMLAutoTextEventImport::~XMLAutoTextEventImport() throw()
+{
+}
+
+void XMLAutoTextEventImport::initialize(
+ const Sequence<Any> & rArguments )
+ throw(Exception, RuntimeException)
+{
+ // The events may come as either an XNameReplace or XEventsSupplier.
+
+ const sal_Int32 nLength = rArguments.getLength();
+ for( sal_Int32 i = 0; i < nLength; i++ )
+ {
+ const Type& rType = rArguments[i].getValueType();
+ if ( rType == ::getCppuType( (Reference<XEventsSupplier>*)NULL ) )
+ {
+ Reference<XEventsSupplier> xSupplier;
+ rArguments[i] >>= xSupplier;
+ DBG_ASSERT(xSupplier.is(), "need XEventsSupplier or XNameReplace");
+
+ xEvents = xSupplier->getEvents();
+ }
+ else if (rType == ::getCppuType( (Reference<XNameReplace>*)NULL ) )
+ {
+ rArguments[i] >>= xEvents;
+ DBG_ASSERT(xEvents.is(), "need XEventsSupplier or XNameReplace");
+ }
+ }
+
+ // call parent
+ SvXMLImport::initialize(rArguments);
+}
+
+
+
+SvXMLImportContext* XMLAutoTextEventImport::CreateContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList > & xAttrList )
+{
+ if ( xEvents.is() && (XML_NAMESPACE_OOO == nPrefix) &&
+ IsXMLToken( rLocalName, XML_AUTO_TEXT_EVENTS) )
+ {
+ return new XMLAutoTextContainerEventImport(
+ *this, nPrefix, rLocalName, xEvents);
+ }
+ else
+ {
+ return SvXMLImport::CreateContext(nPrefix, rLocalName, xAttrList);
+ }
+}
+
+
+Sequence< OUString > SAL_CALL
+ XMLAutoTextEventImport_getSupportedServiceNames()
+ throw()
+{
+ Sequence< OUString > aSeq( 1 );
+ aSeq[0] = XMLAutoTextEventImport_getImplementationName();
+ return aSeq;
+}
+
+OUString SAL_CALL XMLAutoTextEventImport_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.comp.Writer.XMLOasisAutotextEventsImporter" ) );
+}
+
+Reference< XInterface > SAL_CALL XMLAutoTextEventImport_createInstance(
+ const Reference< XMultiServiceFactory > & rSMgr)
+ throw( Exception )
+{
+ // #110680#
+ // return (cppu::OWeakObject*)new XMLAutoTextEventImport;
+ return (cppu::OWeakObject*)new XMLAutoTextEventImport(rSMgr);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLAutoTextEventImport.hxx b/xmloff/source/text/XMLAutoTextEventImport.hxx
new file mode 100644
index 000000000000..86324c22cf74
--- /dev/null
+++ b/xmloff/source/text/XMLAutoTextEventImport.hxx
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLAUTOTEXTEVENTIMPORT_HXX
+#define _XMLOFF_XMLAUTOTEXTEVENTIMPORT_HXX
+
+#include <xmloff/xmlimp.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+
+
+namespace rtl { class OUString; }
+namespace com { namespace sun { namespace star {
+ namespace frame { class XModel; }
+ namespace lang { class XMultiServiceFactory; }
+ namespace text { class XAutoTextContainer; }
+ namespace text { class XAutoTextGroup; }
+ namespace text { class XAutoTextEntry; }
+ namespace uno { template<class X> class Reference; }
+ namespace uno { template<class X> class Sequence; }
+ namespace uno { class XInterface; }
+ namespace uno { class Exception; }
+ namespace xml { namespace sax { class XDocumentHandler; } }
+} } }
+
+
+class XMLAutoTextEventImport : public SvXMLImport
+{
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XNameReplace> xEvents;
+
+public:
+ // #110680#
+ // XMLAutoTextEventImport() throw();
+ XMLAutoTextEventImport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory
+ ) throw();
+
+ ~XMLAutoTextEventImport() throw();
+
+ // XInitialization
+ virtual void SAL_CALL initialize(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Any> & rArguments )
+ throw(
+ ::com::sun::star::uno::Exception,
+ ::com::sun::star::uno::RuntimeException);
+
+protected:
+
+ virtual SvXMLImportContext* CreateContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+};
+
+
+// global functions to support the component
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ XMLAutoTextEventImport_getSupportedServiceNames()
+ throw();
+
+::rtl::OUString SAL_CALL XMLAutoTextEventImport_getImplementationName()
+ throw();
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
+ XMLAutoTextEventImport_createInstance(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > & )
+ throw( ::com::sun::star::uno::Exception );
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLCalculationSettingsContext.cxx b/xmloff/source/text/XMLCalculationSettingsContext.cxx
new file mode 100644
index 000000000000..f1aae0bfafee
--- /dev/null
+++ b/xmloff/source/text/XMLCalculationSettingsContext.cxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <XMLCalculationSettingsContext.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::text;
+using namespace ::xmloff::token;
+
+XMLCalculationSettingsContext::XMLCalculationSettingsContext( SvXMLImport& rImport,
+ sal_uInt16 p_nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList >& xAttrList )
+: SvXMLImportContext ( rImport, p_nPrefix, rLocalName )
+, nYear( 1930 )
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
+ rtl::OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(
+ sAttrName, &aLocalName );
+ rtl::OUString sValue = xAttrList->getValueByIndex( i );
+
+ if (nPrefix == XML_NAMESPACE_TABLE)
+ {
+ if ( IsXMLToken( aLocalName, XML_NULL_YEAR ) )
+ {
+ sal_Int32 nTemp;
+ GetImport().GetMM100UnitConverter().convertNumber(nTemp, sValue);
+ nYear= static_cast <sal_Int16> (nTemp);
+ }
+ }
+ }
+}
+
+XMLCalculationSettingsContext::~XMLCalculationSettingsContext()
+{
+}
+void XMLCalculationSettingsContext::EndElement()
+{
+ if (nYear != 1930 )
+ {
+ Reference < XTextDocument > xTextDoc ( GetImport().GetModel(), UNO_QUERY);
+ if (xTextDoc.is())
+ {
+ Reference < XPropertySet > xPropSet ( xTextDoc, UNO_QUERY );
+ OUString sTwoDigitYear ( RTL_CONSTASCII_USTRINGPARAM ( "TwoDigitYear" ) );
+ Any aAny;
+ aAny <<= nYear;
+ xPropSet->setPropertyValue ( sTwoDigitYear, aAny );
+ }
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLCalculationSettingsContext.hxx b/xmloff/source/text/XMLCalculationSettingsContext.hxx
new file mode 100644
index 000000000000..027f2361b2b5
--- /dev/null
+++ b/xmloff/source/text/XMLCalculationSettingsContext.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLCALCULATIONSETTINGSCONTEXT_HXX
+#define _XMLOFF_XMLCALCULATIONSETTINGSCONTEXT_HXX
+
+#include <xmloff/xmlictxt.hxx>
+
+class XMLCalculationSettingsContext : public SvXMLImportContext
+{
+ sal_Int16 nYear;
+public:
+ XMLCalculationSettingsContext( SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual ~XMLCalculationSettingsContext();
+ virtual void EndElement();
+
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLChangeElementImportContext.cxx b/xmloff/source/text/XMLChangeElementImportContext.cxx
new file mode 100644
index 000000000000..648484717532
--- /dev/null
+++ b/xmloff/source/text/XMLChangeElementImportContext.cxx
@@ -0,0 +1,116 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLChangeElementImportContext.hxx"
+#include "XMLChangedRegionImportContext.hxx"
+#include "XMLChangeInfoContext.hxx"
+#include <com/sun/star/uno/Reference.h>
+#include <xmloff/xmlimp.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+
+
+
+using ::rtl::OUString;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::xml::sax::XAttributeList;
+using ::xmloff::token::IsXMLToken;
+using ::xmloff::token::XML_P;
+using ::xmloff::token::XML_CHANGE_INFO;
+
+TYPEINIT1( XMLChangeElementImportContext, SvXMLImportContext );
+
+XMLChangeElementImportContext::XMLChangeElementImportContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ sal_Bool bAccContent,
+ XMLChangedRegionImportContext& rParent) :
+ SvXMLImportContext(rImport, nPrefix, rLocalName),
+ bAcceptContent(bAccContent),
+ rChangedRegion(rParent)
+{
+}
+
+SvXMLImportContext* XMLChangeElementImportContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList)
+{
+ SvXMLImportContext* pContext = NULL;
+
+ if ( (XML_NAMESPACE_OFFICE == nPrefix) &&
+ IsXMLToken( rLocalName, XML_CHANGE_INFO) )
+ {
+ pContext = new XMLChangeInfoContext(GetImport(), nPrefix, rLocalName,
+ rChangedRegion, GetLocalName());
+ }
+ else
+ {
+ // import into redline -> create XText
+ rChangedRegion.UseRedlineText();
+
+ pContext = GetImport().GetTextImport()->CreateTextChildContext(
+ GetImport(), nPrefix, rLocalName, xAttrList,
+ XML_TEXT_TYPE_CHANGED_REGION);
+
+ if (NULL == pContext)
+ {
+ // no text element -> use default
+ pContext = SvXMLImportContext::CreateChildContext(
+ nPrefix, rLocalName, xAttrList);
+
+ // illegal element content! TODO: discard this redline!
+ }
+ }
+
+
+ return pContext;
+}
+
+// #107848#
+void XMLChangeElementImportContext::StartElement( const Reference< XAttributeList >& )
+{
+ if(bAcceptContent)
+ {
+ GetImport().GetTextImport()->SetInsideDeleteContext(sal_True);
+ }
+}
+
+// #107848#
+void XMLChangeElementImportContext::EndElement()
+{
+ if(bAcceptContent)
+ {
+ GetImport().GetTextImport()->SetInsideDeleteContext(sal_False);
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLChangeElementImportContext.hxx b/xmloff/source/text/XMLChangeElementImportContext.hxx
new file mode 100644
index 000000000000..cc89f1febcd9
--- /dev/null
+++ b/xmloff/source/text/XMLChangeElementImportContext.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLCHANGEELEMENTIMPORTCONTEXT_HXX
+#define _XMLOFF_XMLCHANGEELEMENTIMPORTCONTEXT_HXX
+
+#include <xmloff/xmlictxt.hxx>
+#include <com/sun/star/uno/Reference.h>
+
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax {
+ class XAttributeList;
+ } }
+} } }
+namespace rtl {
+ class OUString;
+}
+class XMLChangedRegionImportContext;
+
+
+
+/**
+ * Import <text:deletion> and <text:insertion> elements contained in a
+ * <text:changed-region> element.
+ */
+class XMLChangeElementImportContext : public SvXMLImportContext
+{
+ sal_Bool bAcceptContent;
+ XMLChangedRegionImportContext& rChangedRegion;
+
+public:
+
+ TYPEINFO();
+
+ XMLChangeElementImportContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ /// accept text content (paragraphs) in element as redline content?
+ sal_Bool bAcceptContent,
+ /// context of enclosing <text:changed-region> element
+ XMLChangedRegionImportContext& rParent);
+
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+
+ // #107848#
+ // Start- and EndElement are needed here to set the inside_deleted_section
+ // flag at the corresponding TextImportHelper
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ // #107848#
+ virtual void EndElement();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLChangeImportContext.cxx b/xmloff/source/text/XMLChangeImportContext.cxx
new file mode 100644
index 000000000000..67b30469fe84
--- /dev/null
+++ b/xmloff/source/text/XMLChangeImportContext.cxx
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLChangeImportContext.hxx"
+#include <com/sun/star/text/XTextRange.hpp>
+#include <tools/debug.hxx>
+#include <xmloff/xmlimp.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmltoken.hxx>
+
+using ::rtl::OUString;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::text::XTextRange;
+using ::com::sun::star::xml::sax::XAttributeList;
+using ::xmloff::token::IsXMLToken;
+using ::xmloff::token::XML_CHANGE_ID;
+
+TYPEINIT1( XMLChangeImportContext, SvXMLImportContext );
+
+XMLChangeImportContext::XMLChangeImportContext(
+ SvXMLImport& rImport,
+ sal_Int16 nPrefix,
+ const OUString& rLocalName,
+ sal_Bool bStart,
+ sal_Bool bEnd,
+ sal_Bool bOutsideOfParagraph) :
+ SvXMLImportContext(rImport, nPrefix, rLocalName),
+ bIsStart(bStart),
+ bIsEnd(bEnd),
+ bIsOutsideOfParagraph(bOutsideOfParagraph)
+{
+ DBG_ASSERT(bStart || bEnd, "Must be either start, end, or both!");
+}
+
+XMLChangeImportContext::~XMLChangeImportContext()
+{
+}
+
+void XMLChangeImportContext::StartElement(
+ const Reference<XAttributeList>& xAttrList)
+{
+ sal_Int16 nLength = xAttrList->getLength();
+ for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++)
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
+ &sLocalName );
+ if ( (XML_NAMESPACE_TEXT == nPrefix) &&
+ IsXMLToken( sLocalName, XML_CHANGE_ID ) )
+ {
+ // Id found! Now call RedlineImportHelper
+
+ // prepare parameters
+ UniReference<XMLTextImportHelper> rHelper =
+ GetImport().GetTextImport();
+ OUString sID = xAttrList->getValueByIndex(nAttr);
+
+ // call for bStart and bEnd (may both be true)
+ if (bIsStart)
+ rHelper->RedlineSetCursor(sID,sal_True,bIsOutsideOfParagraph);
+ if (bIsEnd)
+ rHelper->RedlineSetCursor(sID,sal_False,bIsOutsideOfParagraph);
+
+ // outside of paragraph and still open? set open redline ID
+ if (bIsOutsideOfParagraph)
+ {
+ rHelper->SetOpenRedlineId(sID);
+ }
+ }
+ // else: ignore
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLChangeImportContext.hxx b/xmloff/source/text/XMLChangeImportContext.hxx
new file mode 100644
index 000000000000..a38fe2e2d607
--- /dev/null
+++ b/xmloff/source/text/XMLChangeImportContext.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLCHANGEIMPORTCONTEXT_HXX
+#define _XMLOFF_XMLCHANGEIMPORTCONTEXT_HXX
+
+
+#include <xmloff/xmlictxt.hxx>
+#include <com/sun/star/uno/Reference.h>
+
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax {
+ class XAttributeList;
+ } }
+} } }
+namespace rtl {
+ class OUString;
+}
+
+
+
+/**
+ * import change tracking/redlining markers
+ * <text:change>, <text:change-start>, <text:change-end>
+ */
+class XMLChangeImportContext : public SvXMLImportContext
+{
+ sal_Bool bIsStart;
+ sal_Bool bIsEnd;
+ sal_Bool bIsOutsideOfParagraph;
+
+public:
+
+ TYPEINFO();
+
+ /**
+ * import a change mark
+ * (<text:change>, <text:change-start>, <text:change-end>)
+ * Note: a <text:change> mark denotes start and end of a change
+ * simultaniously, so both bIsStart and bIsEnd parameters would
+ * be set true.
+ */
+ XMLChangeImportContext(
+ SvXMLImport& rImport,
+ sal_Int16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ sal_Bool bIsStart, /// mark start of a change
+ sal_Bool bIsEnd, /// mark end of a change
+ /// true if change mark is encountered outside of a paragraph
+ /// (usually before a section or table)
+ sal_Bool bIsOutsideOfParagraph = sal_False);
+
+ ~XMLChangeImportContext();
+
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLChangeInfoContext.cxx b/xmloff/source/text/XMLChangeInfoContext.cxx
new file mode 100644
index 000000000000..a868a1c1717b
--- /dev/null
+++ b/xmloff/source/text/XMLChangeInfoContext.cxx
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLChangeInfoContext.hxx"
+#include "XMLChangedRegionImportContext.hxx"
+#include "XMLStringBufferImportContext.hxx"
+#include <com/sun/star/uno/Reference.h>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlimp.hxx>
+
+
+
+using namespace ::xmloff::token;
+
+using ::rtl::OUString;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::xml::sax::XAttributeList;
+
+
+TYPEINIT1(XMLChangeInfoContext, SvXMLImportContext);
+
+XMLChangeInfoContext::XMLChangeInfoContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ XMLChangedRegionImportContext& rPParent,
+ const OUString& rChangeType)
+: SvXMLImportContext(rImport, nPrefix, rLocalName)
+, rType(rChangeType)
+, rChangedRegion(rPParent)
+{
+}
+
+XMLChangeInfoContext::~XMLChangeInfoContext()
+{
+}
+
+void XMLChangeInfoContext::StartElement(const Reference<XAttributeList> &)
+{
+ // no attributes
+}
+
+SvXMLImportContext* XMLChangeInfoContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList >& xAttrList )
+{
+ SvXMLImportContext* pContext = NULL;
+
+ if( XML_NAMESPACE_DC == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_CREATOR ) )
+ pContext = new XMLStringBufferImportContext(GetImport(), nPrefix,
+ rLocalName, sAuthorBuffer);
+ else if( IsXMLToken( rLocalName, XML_DATE ) )
+ pContext = new XMLStringBufferImportContext(GetImport(), nPrefix,
+ rLocalName, sDateTimeBuffer);
+ }
+ else if ( ( XML_NAMESPACE_TEXT == nPrefix ) &&
+ IsXMLToken( rLocalName, XML_P ) )
+ {
+ pContext = new XMLStringBufferImportContext(GetImport(), nPrefix,
+ rLocalName, sCommentBuffer);
+ }
+
+ if( !pContext )
+ {
+ pContext = SvXMLImportContext::CreateChildContext(nPrefix, rLocalName,
+ xAttrList);
+ }
+
+ return pContext;
+}
+
+void XMLChangeInfoContext::EndElement()
+{
+ // set values at changed region context
+ rChangedRegion.SetChangeInfo(rType, sAuthorBuffer.makeStringAndClear(),
+ sCommentBuffer.makeStringAndClear(),
+ sDateTimeBuffer.makeStringAndClear());
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLChangeInfoContext.hxx b/xmloff/source/text/XMLChangeInfoContext.hxx
new file mode 100644
index 000000000000..c347d4a4221a
--- /dev/null
+++ b/xmloff/source/text/XMLChangeInfoContext.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLCHANGEINFOCONTEXT_HXX
+#define _XMLOFF_XMLCHANGEINFOCONTEXT_HXX
+
+#include <xmloff/xmlictxt.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+} } }
+class XMLChangedRegionImportContext;
+
+
+
+/**
+ * Import <office:change-info> elements as children of <text:changed-region>
+ * elements. The attribute values will be passed to the enclosing
+ * XMLChangedRegionImportContext (which has to be passed down in the
+ * constructor).
+ */
+class XMLChangeInfoContext : public SvXMLImportContext
+{
+ const ::rtl::OUString& rType;
+
+ ::rtl::OUStringBuffer sAuthorBuffer;
+ ::rtl::OUStringBuffer sDateTimeBuffer;
+ ::rtl::OUStringBuffer sCommentBuffer;
+
+ XMLChangedRegionImportContext& rChangedRegion;
+
+public:
+
+ TYPEINFO();
+
+ XMLChangeInfoContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ XMLChangedRegionImportContext& rChangedRegion,
+ const ::rtl::OUString& rChangeType);
+
+ ~XMLChangeInfoContext();
+
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void EndElement();
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLChangedRegionImportContext.cxx b/xmloff/source/text/XMLChangedRegionImportContext.cxx
new file mode 100644
index 000000000000..ef7341bf81f4
--- /dev/null
+++ b/xmloff/source/text/XMLChangedRegionImportContext.cxx
@@ -0,0 +1,199 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLChangedRegionImportContext.hxx"
+#include "XMLChangeElementImportContext.hxx"
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/text/XTextCursor.hpp>
+#include <xmloff/xmlimp.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+
+
+using namespace ::xmloff::token;
+
+using ::rtl::OUString;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::text::XTextCursor;
+using ::com::sun::star::util::DateTime;
+using ::com::sun::star::xml::sax::XAttributeList;
+
+
+
+TYPEINIT1(XMLChangedRegionImportContext, SvXMLImportContext);
+
+XMLChangedRegionImportContext::XMLChangedRegionImportContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName) :
+ SvXMLImportContext(rImport, nPrefix, rLocalName),
+ bMergeLastPara(sal_True)
+{
+}
+
+XMLChangedRegionImportContext::~XMLChangedRegionImportContext()
+{
+}
+
+void XMLChangedRegionImportContext::StartElement(
+ const Reference<XAttributeList> & xAttrList)
+{
+ // process attributes: id
+ bool bHaveXmlId( false );
+ sal_Int16 nLength = xAttrList->getLength();
+ for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++)
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
+ &sLocalName );
+
+ const OUString sValue = xAttrList->getValueByIndex(nAttr);
+ if (XML_NAMESPACE_XML == nPrefix)
+ {
+ if (IsXMLToken(sLocalName, XML_ID))
+ {
+ sID = sValue;
+ bHaveXmlId = true;
+ }
+ }
+ else if (XML_NAMESPACE_TEXT == nPrefix)
+ {
+ if (IsXMLToken(sLocalName, XML_ID))
+ {
+ if (!bHaveXmlId) { sID = sValue; }
+ }
+ else if( IsXMLToken( sLocalName, XML_MERGE_LAST_PARAGRAPH ) )
+ {
+ bool bTmp;
+ if( SvXMLUnitConverter::convertBool(bTmp, sValue) )
+ {
+ bMergeLastPara = bTmp;
+ }
+ }
+ }
+ }
+}
+
+SvXMLImportContext* XMLChangedRegionImportContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList)
+{
+ SvXMLImportContext* pContext = NULL;
+
+ if (XML_NAMESPACE_TEXT == nPrefix)
+ {
+ if ( IsXMLToken( rLocalName, XML_INSERTION ) ||
+ IsXMLToken( rLocalName, XML_DELETION ) ||
+ IsXMLToken( rLocalName, XML_FORMAT_CHANGE ) )
+ {
+ // create XMLChangeElementImportContext for all kinds of changes
+ pContext = new XMLChangeElementImportContext(
+ GetImport(), nPrefix, rLocalName,
+ IsXMLToken( rLocalName, XML_DELETION ),
+ *this);
+ }
+ // else: it may be a text element, see below
+ }
+
+ if (NULL == pContext)
+ {
+ pContext = SvXMLImportContext::CreateChildContext(nPrefix, rLocalName,
+ xAttrList);
+
+ // was it a text element? If not, use default!
+ if (NULL == pContext)
+ {
+ pContext = SvXMLImportContext::CreateChildContext(
+ nPrefix, rLocalName, xAttrList);
+ }
+ }
+
+ return pContext;
+}
+
+void XMLChangedRegionImportContext::EndElement()
+{
+ // restore old XCursor (if necessary)
+ if (xOldCursor.is())
+ {
+ // delete last paragraph
+ // (one extra paragraph was inserted in the beginning)
+ UniReference<XMLTextImportHelper> rHelper =
+ GetImport().GetTextImport();
+ rHelper->DeleteParagraph();
+
+ GetImport().GetTextImport()->SetCursor(xOldCursor);
+ xOldCursor = NULL;
+ }
+}
+
+void XMLChangedRegionImportContext::SetChangeInfo(
+ const OUString& rType,
+ const OUString& rAuthor,
+ const OUString& rComment,
+ const OUString& rDate)
+{
+ DateTime aDateTime;
+ if (SvXMLUnitConverter::convertDateTime(aDateTime, rDate))
+ {
+ GetImport().GetTextImport()->RedlineAdd(
+ rType, sID, rAuthor, rComment, aDateTime, bMergeLastPara);
+ }
+}
+
+void XMLChangedRegionImportContext::UseRedlineText()
+{
+ // if we haven't already installed the redline cursor, do it now
+ if (! xOldCursor.is())
+ {
+ // get TextImportHelper and old Cursor
+ UniReference<XMLTextImportHelper> rHelper(GetImport().GetTextImport());
+ Reference<XTextCursor> xCursor( rHelper->GetCursor() );
+
+ // create Redline and new Cursor
+ Reference<XTextCursor> xNewCursor =
+ rHelper->RedlineCreateText(xCursor, sID);
+
+ if (xNewCursor.is())
+ {
+ // save old cursor and install new one
+ xOldCursor = xCursor;
+ rHelper->SetCursor( xNewCursor );
+ }
+ // else: leave as is
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLChangedRegionImportContext.hxx b/xmloff/source/text/XMLChangedRegionImportContext.hxx
new file mode 100644
index 000000000000..ea26d577eabd
--- /dev/null
+++ b/xmloff/source/text/XMLChangedRegionImportContext.hxx
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLCHANGEDREGIONIMPORTCONTEXT_HXX
+#define _XMLOFF_XMLCHANGEDREGIONIMPORTCONTEXT_HXX
+
+#include <xmloff/xmlictxt.hxx>
+#include <com/sun/star/uno/Reference.h>
+
+
+namespace com { namespace sun { namespace star {
+ namespace text {
+ class XTextCursor;
+ }
+ namespace xml { namespace sax {
+ class XAttributeList;
+ } }
+} } }
+namespace rtl {
+ class OUString;
+}
+
+
+class XMLChangedRegionImportContext : public SvXMLImportContext
+{
+ const ::rtl::OUString sEmpty;
+
+ /// if we replace the current XTextCursor/XText by the ones for
+ /// the redline, we remeber the old cursor here.
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextCursor> xOldCursor;
+
+ ::rtl::OUString sID; /// redline-ID
+
+ sal_Bool bMergeLastPara; /// merge-last-paragraph flag
+
+public:
+
+ TYPEINFO();
+
+ XMLChangedRegionImportContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName);
+
+ ~XMLChangedRegionImportContext();
+
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+
+ virtual void EndElement();
+
+
+ /// change info: To be called from change-info context
+ void SetChangeInfo(const ::rtl::OUString& rType,
+ const ::rtl::OUString& rAuthor,
+ const ::rtl::OUString& rComment,
+ const ::rtl::OUString& rDate);
+
+ /// create redline XText/XTextCursor on demand and register with
+ /// XMLTextImportHelper
+ void UseRedlineText();
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLFootnoteBodyImportContext.cxx b/xmloff/source/text/XMLFootnoteBodyImportContext.cxx
new file mode 100644
index 000000000000..667afb1e34f0
--- /dev/null
+++ b/xmloff/source/text/XMLFootnoteBodyImportContext.cxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLFootnoteBodyImportContext.hxx"
+
+#ifndef _RTL_USTRING
+#include <rtl/ustring.hxx>
+#endif
+#include <tools/debug.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/txtimp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+
+using ::rtl::OUString;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::xml::sax::XAttributeList;
+
+
+TYPEINIT1( XMLFootnoteBodyImportContext, SvXMLImportContext );
+
+XMLFootnoteBodyImportContext::XMLFootnoteBodyImportContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName ) :
+ SvXMLImportContext(rImport, nPrfx, rLocalName)
+{
+}
+
+SvXMLImportContext* XMLFootnoteBodyImportContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList )
+{
+ // return text context
+ SvXMLImportContext *pContext =
+ GetImport().GetTextImport()->CreateTextChildContext(GetImport(),
+ nPrefix,
+ rLocalName,
+ xAttrList,
+ XML_TEXT_TYPE_FOOTNOTE);
+ if( !pContext )
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+
+ return pContext;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLFootnoteBodyImportContext.hxx b/xmloff/source/text/XMLFootnoteBodyImportContext.hxx
new file mode 100644
index 000000000000..29186035526a
--- /dev/null
+++ b/xmloff/source/text/XMLFootnoteBodyImportContext.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLFOOTNOTEBODYIMPORTCONTEXT_HXX_
+#define _XMLOFF_XMLFOOTNOTEBODYIMPORTCONTEXT_HXX_
+
+#include <xmloff/xmlictxt.hxx>
+#include <com/sun/star/uno/Reference.h>
+
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax {
+ class XAttributeList;
+ } }
+} } }
+namespace rtl {
+ class OUString;
+}
+
+
+/// import foot- and endnote body elements (<text:footnote-body>)
+class XMLFootnoteBodyImportContext : public SvXMLImportContext
+{
+
+public:
+
+ TYPEINFO();
+
+ XMLFootnoteBodyImportContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName );
+
+protected:
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx b/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx
new file mode 100644
index 000000000000..ae3bd1aa8290
--- /dev/null
+++ b/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx
@@ -0,0 +1,455 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLFootnoteConfigurationImportContext.hxx"
+
+#ifndef _RTL_USTRING
+#include <rtl/ustring.hxx>
+#endif
+#include <rtl/ustrbuf.hxx>
+#include <tools/debug.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+
+#include <xmloff/families.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmlnumi.hxx>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/text/XFootnote.hpp>
+#include <com/sun/star/text/XFootnotesSupplier.hpp>
+#include <com/sun/star/text/XEndnotesSupplier.hpp>
+#include <com/sun/star/text/FootnoteNumbering.hpp>
+#include <com/sun/star/style/NumberingType.hpp>
+
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::xmloff::token;
+
+//
+// XMLFootnoteConfigHelper
+//
+
+/// local helper class for import of quo-vadis and ergo-sum elements
+class XMLFootnoteConfigHelper : public SvXMLImportContext
+{
+ OUStringBuffer sBuffer;
+ XMLFootnoteConfigurationImportContext& rConfig;
+ sal_Bool bIsBegin;
+
+public:
+ TYPEINFO();
+
+ XMLFootnoteConfigHelper(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLName,
+ XMLFootnoteConfigurationImportContext& rConfigImport,
+ sal_Bool bBegin);
+
+ virtual void EndElement();
+
+ virtual void Characters( const OUString& rChars );
+};
+
+TYPEINIT1( XMLFootnoteConfigHelper, SvXMLImportContext );
+
+XMLFootnoteConfigHelper::XMLFootnoteConfigHelper(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLName,
+ XMLFootnoteConfigurationImportContext& rConfigImport,
+ sal_Bool bBegin)
+: SvXMLImportContext(rImport, nPrfx, rLName)
+, sBuffer()
+, rConfig(rConfigImport)
+, bIsBegin(bBegin)
+{
+}
+
+void XMLFootnoteConfigHelper::EndElement()
+{
+ if (bIsBegin)
+ {
+ rConfig.SetBeginNotice(sBuffer.makeStringAndClear());
+ }
+ else
+ {
+ rConfig.SetEndNotice(sBuffer.makeStringAndClear());
+ }
+// rConfig = NULL; // import contexts are ref-counted
+}
+
+void XMLFootnoteConfigHelper::Characters( const OUString& rChars )
+{
+ sBuffer.append(rChars);
+}
+
+
+//
+// XMLFootnoteConfigurationImportContext
+//
+
+
+TYPEINIT1( XMLFootnoteConfigurationImportContext, SvXMLStyleContext );
+
+XMLFootnoteConfigurationImportContext::XMLFootnoteConfigurationImportContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList)
+: SvXMLStyleContext(rImport, nPrfx, rLocalName, xAttrList, XML_STYLE_FAMILY_TEXT_FOOTNOTECONFIG)
+, sPropertyAnchorCharStyleName(RTL_CONSTASCII_USTRINGPARAM("AnchorCharStyleName"))
+, sPropertyCharStyleName(RTL_CONSTASCII_USTRINGPARAM("CharStyleName"))
+, sPropertyNumberingType(RTL_CONSTASCII_USTRINGPARAM("NumberingType"))
+, sPropertyPageStyleName(RTL_CONSTASCII_USTRINGPARAM("PageStyleName"))
+, sPropertyParagraphStyleName(RTL_CONSTASCII_USTRINGPARAM("ParaStyleName"))
+, sPropertyPrefix(RTL_CONSTASCII_USTRINGPARAM("Prefix"))
+, sPropertyStartAt(RTL_CONSTASCII_USTRINGPARAM("StartAt"))
+, sPropertySuffix(RTL_CONSTASCII_USTRINGPARAM("Suffix"))
+, sPropertyPositionEndOfDoc(RTL_CONSTASCII_USTRINGPARAM("PositionEndOfDoc"))
+, sPropertyFootnoteCounting(RTL_CONSTASCII_USTRINGPARAM("FootnoteCounting"))
+, sPropertyEndNotice(RTL_CONSTASCII_USTRINGPARAM("EndNotice"))
+, sPropertyBeginNotice(RTL_CONSTASCII_USTRINGPARAM("BeginNotice"))
+, sNumFormat(RTL_CONSTASCII_USTRINGPARAM("1"))
+, sNumSync(RTL_CONSTASCII_USTRINGPARAM("false"))
+, pAttrTokenMap(NULL)
+, nOffset(0)
+, nNumbering(FootnoteNumbering::PER_PAGE)
+, bPosition(sal_False)
+, bIsEndnote(sal_False)
+{
+ sal_Int16 nLength = xAttrList->getLength();
+ for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++)
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
+ &sLocalName );
+ if( XML_NAMESPACE_TEXT == nPrefix && IsXMLToken( sLocalName,
+ XML_NOTE_CLASS ) )
+ {
+ const OUString& rValue = xAttrList->getValueByIndex( nAttr );
+ if( IsXMLToken( rValue, XML_ENDNOTE ) )
+ {
+ bIsEndnote = sal_True;
+ SetFamily( XML_STYLE_FAMILY_TEXT_FOOTNOTECONFIG );
+ }
+ break;
+ }
+ }
+
+}
+XMLFootnoteConfigurationImportContext::~XMLFootnoteConfigurationImportContext()
+{
+ delete pAttrTokenMap;
+}
+
+enum XMLFtnConfigToken
+{
+ XML_TOK_FTNCONFIG_CITATION_STYLENAME,
+ XML_TOK_FTNCONFIG_ANCHOR_STYLENAME,
+ XML_TOK_FTNCONFIG_DEFAULT_STYLENAME,
+ XML_TOK_FTNCONFIG_PAGE_STYLENAME,
+ XML_TOK_FTNCONFIG_OFFSET,
+ XML_TOK_FTNCONFIG_NUM_PREFIX,
+ XML_TOK_FTNCONFIG_NUM_SUFFIX,
+ XML_TOK_FTNCONFIG_NUM_FORMAT,
+ XML_TOK_FTNCONFIG_NUM_SYNC,
+ XML_TOK_FTNCONFIG_START_AT,
+ XML_TOK_FTNCONFIG_POSITION
+};
+
+static SvXMLTokenMapEntry aTextFieldAttrTokenMap[] =
+{
+ { XML_NAMESPACE_TEXT, XML_CITATION_STYLE_NAME, XML_TOK_FTNCONFIG_CITATION_STYLENAME },
+ { XML_NAMESPACE_TEXT, XML_CITATION_BODY_STYLE_NAME, XML_TOK_FTNCONFIG_ANCHOR_STYLENAME },
+ { XML_NAMESPACE_TEXT, XML_DEFAULT_STYLE_NAME, XML_TOK_FTNCONFIG_DEFAULT_STYLENAME },
+ { XML_NAMESPACE_TEXT, XML_MASTER_PAGE_NAME, XML_TOK_FTNCONFIG_PAGE_STYLENAME },
+ { XML_NAMESPACE_TEXT, XML_START_VALUE, XML_TOK_FTNCONFIG_OFFSET },
+ { XML_NAMESPACE_STYLE, XML_NUM_PREFIX, XML_TOK_FTNCONFIG_NUM_PREFIX },
+ { XML_NAMESPACE_STYLE, XML_NUM_SUFFIX, XML_TOK_FTNCONFIG_NUM_SUFFIX },
+ { XML_NAMESPACE_STYLE, XML_NUM_FORMAT, XML_TOK_FTNCONFIG_NUM_FORMAT },
+ { XML_NAMESPACE_STYLE, XML_NUM_LETTER_SYNC, XML_TOK_FTNCONFIG_NUM_SYNC },
+ { XML_NAMESPACE_TEXT, XML_START_NUMBERING_AT, XML_TOK_FTNCONFIG_START_AT},
+ { XML_NAMESPACE_TEXT, XML_FOOTNOTES_POSITION, XML_TOK_FTNCONFIG_POSITION},
+
+ // for backwards compatibility with SRC630 & earlier
+ { XML_NAMESPACE_TEXT, XML_NUM_PREFIX, XML_TOK_FTNCONFIG_NUM_PREFIX },
+ { XML_NAMESPACE_TEXT, XML_NUM_SUFFIX, XML_TOK_FTNCONFIG_NUM_SUFFIX },
+ { XML_NAMESPACE_TEXT, XML_OFFSET, XML_TOK_FTNCONFIG_OFFSET },
+ XML_TOKEN_MAP_END
+};
+
+const SvXMLTokenMap&
+ XMLFootnoteConfigurationImportContext::GetFtnConfigAttrTokenMap()
+{
+ if (NULL == pAttrTokenMap)
+ {
+ pAttrTokenMap = new SvXMLTokenMap(aTextFieldAttrTokenMap);
+ }
+
+ return *pAttrTokenMap;
+}
+
+static SvXMLEnumMapEntry const aFootnoteNumberingMap[] =
+{
+ { XML_PAGE, FootnoteNumbering::PER_PAGE },
+ { XML_CHAPTER, FootnoteNumbering::PER_CHAPTER },
+ { XML_DOCUMENT, FootnoteNumbering::PER_DOCUMENT },
+ { XML_TOKEN_INVALID, 0 },
+};
+
+void XMLFootnoteConfigurationImportContext::StartElement(
+ const Reference<XAttributeList> & xAttrList )
+{
+ sal_Int16 nLength = xAttrList->getLength();
+ for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++)
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
+ &sLocalName );
+ OUString sValue = xAttrList->getValueByIndex(nAttr);
+ switch (GetFtnConfigAttrTokenMap().Get(nPrefix, sLocalName))
+ {
+ case XML_TOK_FTNCONFIG_CITATION_STYLENAME:
+ sCitationStyle = sValue;
+ break;
+ case XML_TOK_FTNCONFIG_ANCHOR_STYLENAME:
+ sAnchorStyle = sValue;
+ break;
+ case XML_TOK_FTNCONFIG_DEFAULT_STYLENAME:
+ sDefaultStyle = sValue;
+ break;
+ case XML_TOK_FTNCONFIG_PAGE_STYLENAME:
+ sPageStyle = sValue;
+ break;
+ case XML_TOK_FTNCONFIG_OFFSET:
+ {
+ sal_Int32 nTmp;
+ if (SvXMLUnitConverter::convertNumber(nTmp, sValue))
+ {
+ nOffset = (sal_uInt16)nTmp;
+ }
+ break;
+ }
+ case XML_TOK_FTNCONFIG_NUM_PREFIX:
+ sPrefix = sValue;
+ break;
+ case XML_TOK_FTNCONFIG_NUM_SUFFIX:
+ sSuffix = sValue;
+ break;
+ case XML_TOK_FTNCONFIG_NUM_FORMAT:
+ sNumFormat = sValue;
+ break;
+ case XML_TOK_FTNCONFIG_NUM_SYNC:
+ sNumSync = sValue;
+ break;
+ case XML_TOK_FTNCONFIG_START_AT:
+ {
+ sal_uInt16 nTmp;
+ if (SvXMLUnitConverter::convertEnum(nTmp, sValue,
+ aFootnoteNumberingMap))
+ {
+ nNumbering = nTmp;
+ }
+ break;
+ }
+ case XML_TOK_FTNCONFIG_POSITION:
+ bPosition = IsXMLToken( sValue, XML_DOCUMENT );
+ break;
+ default:
+ ; // ignore
+ }
+ }
+}
+
+SvXMLImportContext *XMLFootnoteConfigurationImportContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList )
+{
+ SvXMLImportContext* pContext = NULL;
+
+ if (!bIsEndnote)
+ {
+ if (XML_NAMESPACE_TEXT == nPrefix)
+ {
+ if ( IsXMLToken( rLocalName,
+ XML_FOOTNOTE_CONTINUATION_NOTICE_FORWARD ) )
+ {
+ pContext = new XMLFootnoteConfigHelper(GetImport(),
+ nPrefix, rLocalName,
+ *this, sal_False);
+ }
+ else if ( IsXMLToken( rLocalName,
+ XML_FOOTNOTE_CONTINUATION_NOTICE_BACKWARD ) )
+ {
+ pContext = new XMLFootnoteConfigHelper(GetImport(),
+ nPrefix, rLocalName,
+ *this, sal_True);
+ }
+ // else: default context
+ }
+ // else: unknown namespace -> default context
+ }
+ // else: endnote -> default context
+
+ if (pContext == NULL)
+ {
+ // default: delegate to super class
+ pContext = SvXMLStyleContext::CreateChildContext(nPrefix,
+ rLocalName,
+ xAttrList);
+ }
+
+ return pContext;
+}
+
+// Rename method <CreateAndInsertLate(..)> to <Finish(..)> (#i40597#)
+void XMLFootnoteConfigurationImportContext::Finish( sal_Bool bOverwrite )
+{
+
+ if (bOverwrite)
+ {
+ if (bIsEndnote)
+ {
+ Reference<XEndnotesSupplier> xSupplier(
+ GetImport().GetModel(), UNO_QUERY);
+ if (xSupplier.is())
+ {
+ ProcessSettings(xSupplier->getEndnoteSettings());
+ }
+ }
+ else
+ {
+ Reference<XFootnotesSupplier> xSupplier(
+ GetImport().GetModel(), UNO_QUERY);
+ if (xSupplier.is())
+ {
+ ProcessSettings(xSupplier->getFootnoteSettings());
+ }
+ }
+ }
+ // else: ignore (there's only one configuration, so we can only overwrite)
+}
+
+void XMLFootnoteConfigurationImportContext::ProcessSettings(
+ const Reference<XPropertySet> & rConfig)
+{
+ Any aAny;
+
+ if (sCitationStyle.getLength() > 0)
+ {
+ aAny <<= GetImport().GetStyleDisplayName(
+ XML_STYLE_FAMILY_TEXT_TEXT, sCitationStyle );
+ rConfig->setPropertyValue(sPropertyCharStyleName, aAny);
+ }
+
+ if (sAnchorStyle.getLength() > 0)
+ {
+ aAny <<= GetImport().GetStyleDisplayName(
+ XML_STYLE_FAMILY_TEXT_TEXT, sAnchorStyle );
+ rConfig->setPropertyValue(sPropertyAnchorCharStyleName, aAny);
+ }
+
+ if (sPageStyle.getLength() > 0)
+ {
+ aAny <<= GetImport().GetStyleDisplayName(
+ XML_STYLE_FAMILY_MASTER_PAGE, sPageStyle );
+ rConfig->setPropertyValue(sPropertyPageStyleName, aAny);
+ }
+
+ if (sDefaultStyle.getLength() > 0)
+ {
+ aAny <<= GetImport().GetStyleDisplayName(
+ XML_STYLE_FAMILY_TEXT_PARAGRAPH, sDefaultStyle );
+ rConfig->setPropertyValue(sPropertyParagraphStyleName, aAny);
+ }
+
+ aAny <<= sPrefix;
+ rConfig->setPropertyValue(sPropertyPrefix, aAny);
+
+ aAny <<= sSuffix;
+ rConfig->setPropertyValue(sPropertySuffix, aAny);
+
+ sal_Int16 nNumType = NumberingType::ARABIC;
+ GetImport().GetMM100UnitConverter().convertNumFormat( nNumType, sNumFormat,
+ sNumSync );
+ // #i61399: Corrupt file? It contains "Bullet" as numbering style for footnotes.
+ // Okay, even it seems to be corrupt, we will oversee this and set the style to ARABIC
+ if( NumberingType::CHAR_SPECIAL == nNumType )
+ nNumType = NumberingType::ARABIC;
+
+ aAny <<= nNumType;
+ rConfig->setPropertyValue(sPropertyNumberingType, aAny);
+
+ aAny <<= nOffset;
+ rConfig->setPropertyValue(sPropertyStartAt, aAny);
+
+ if (!bIsEndnote)
+ {
+ aAny.setValue(&bPosition, ::getBooleanCppuType());
+ rConfig->setPropertyValue(sPropertyPositionEndOfDoc, aAny);
+
+ aAny <<= nNumbering;
+ rConfig->setPropertyValue(sPropertyFootnoteCounting, aAny);
+
+ aAny <<= sEndNotice;
+ rConfig->setPropertyValue(sPropertyEndNotice, aAny);
+
+ aAny <<= sBeginNotice;
+ rConfig->setPropertyValue(sPropertyBeginNotice, aAny);
+ }
+}
+
+void XMLFootnoteConfigurationImportContext::SetBeginNotice(
+ OUString sText)
+{
+ sBeginNotice = sText;
+}
+
+void XMLFootnoteConfigurationImportContext::SetEndNotice(
+ OUString sText)
+{
+ sEndNotice = sText;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLFootnoteImportContext.cxx b/xmloff/source/text/XMLFootnoteImportContext.cxx
new file mode 100644
index 000000000000..3c32971c39cb
--- /dev/null
+++ b/xmloff/source/text/XMLFootnoteImportContext.cxx
@@ -0,0 +1,246 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+#include "XMLFootnoteImportContext.hxx"
+
+#include <rtl/ustring.hxx>
+#include <tools/debug.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/txtimp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+
+#include "XMLFootnoteBodyImportContext.hxx"
+#include "XMLTextListBlockContext.hxx"
+#include "XMLTextListItemContext.hxx"
+
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/text/XTextContent.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/text/XFootnote.hpp>
+
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::xmloff::token;
+
+TYPEINIT1(XMLFootnoteImportContext, SvXMLImportContext);
+
+const sal_Char sAPI_service_footnote[] = "com.sun.star.text.Footnote";
+const sal_Char sAPI_service_endnote[] = "com.sun.star.text.Endnote";
+
+enum XMLFootnoteChildToken {
+ XML_TOK_FTN_NOTE_CITATION,
+ XML_TOK_FTN_NOTE_BODY
+};
+
+static SvXMLTokenMapEntry aFootnoteChildTokenMap[] =
+{
+ { XML_NAMESPACE_TEXT, XML_NOTE_CITATION,
+ XML_TOK_FTN_NOTE_CITATION },
+ { XML_NAMESPACE_TEXT, XML_NOTE_BODY, XML_TOK_FTN_NOTE_BODY },
+ XML_TOKEN_MAP_END
+};
+
+
+XMLFootnoteImportContext::XMLFootnoteImportContext(
+ SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName )
+: SvXMLImportContext(rImport, nPrfx, rLocalName)
+, sPropertyReferenceId(RTL_CONSTASCII_USTRINGPARAM("ReferenceId"))
+, mbListContextPushed(false)
+, rHelper(rHlp)
+{
+}
+
+void XMLFootnoteImportContext::StartElement(
+ const Reference<XAttributeList> & xAttrList)
+{
+ // create footnote
+ Reference<XMultiServiceFactory> xFactory(GetImport().GetModel(),
+ UNO_QUERY);
+ if( xFactory.is() )
+ {
+ // create endnote or footnote
+ sal_Bool bIsEndnote = sal_False;
+ sal_Int16 nLength = xAttrList->getLength();
+ for(sal_Int16 nAttr1 = 0; nAttr1 < nLength; nAttr1++)
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(nAttr1),
+ &sLocalName );
+ if( XML_NAMESPACE_TEXT == nPrefix && IsXMLToken( sLocalName,
+ XML_NOTE_CLASS ) )
+ {
+ const OUString& rValue = xAttrList->getValueByIndex( nAttr1 );
+ if( IsXMLToken( rValue, XML_ENDNOTE ) )
+ bIsEndnote = sal_True;
+ break;
+ }
+ }
+
+ Reference<XInterface> xIfc = xFactory->createInstance(
+ bIsEndnote ?
+ OUString(RTL_CONSTASCII_USTRINGPARAM(sAPI_service_endnote)) :
+ OUString(RTL_CONSTASCII_USTRINGPARAM(sAPI_service_footnote)) );
+
+ // attach footnote to document
+ Reference<XTextContent> xTextContent(xIfc, UNO_QUERY);
+ rHelper.InsertTextContent(xTextContent);
+
+ // process id attribute
+ for(sal_Int16 nAttr2 = 0; nAttr2 < nLength; nAttr2++)
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(nAttr2),
+ &sLocalName );
+
+ if ( (XML_NAMESPACE_TEXT == nPrefix) &&
+ IsXMLToken( sLocalName, XML_ID ) )
+ {
+ // get ID ...
+ Reference<XPropertySet> xPropertySet(xTextContent, UNO_QUERY);
+ Any aAny =xPropertySet->getPropertyValue(sPropertyReferenceId);
+ sal_Int16 nID = 0;
+ aAny >>= nID;
+
+ // ... and insert into map
+ rHelper.InsertFootnoteID(
+ xAttrList->getValueByIndex(nAttr2),
+ nID);
+ }
+ }
+
+ // save old cursor and install new one
+ xOldCursor = rHelper.GetCursor();
+ Reference<XText> xText(xTextContent, UNO_QUERY);
+ rHelper.SetCursor(xText->createTextCursor());
+
+ // remember old list item and block (#89891#) and reset them
+ // for the footnote
+ rHelper.PushListContext();
+ mbListContextPushed = true;
+
+ // remember footnote (for CreateChildContext)
+ Reference<XFootnote> xNote(xTextContent, UNO_QUERY);
+ xFootnote = xNote;
+ }
+ // else: ignore footnote! Content will be merged into document.
+}
+
+void XMLFootnoteImportContext::Characters(const OUString&)
+{
+ // ignore characters! Text must be contained in paragraphs!
+ // rHelper.InsertString(rString);
+}
+
+void XMLFootnoteImportContext::EndElement()
+{
+ // get rid of last dummy paragraph
+ rHelper.DeleteParagraph();
+
+ // reinstall old cursor
+ rHelper.SetCursor(xOldCursor);
+
+ // reinstall old list item
+ if (mbListContextPushed) {
+ rHelper.PopListContext();
+ }
+}
+
+
+SvXMLImportContext *XMLFootnoteImportContext::CreateChildContext(
+ sal_uInt16 p_nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList )
+{
+ SvXMLImportContext* pContext = NULL;
+
+ SvXMLTokenMap aTokenMap(aFootnoteChildTokenMap);
+
+ switch(aTokenMap.Get(p_nPrefix, rLocalName))
+ {
+ case XML_TOK_FTN_NOTE_CITATION:
+ {
+ // little hack: we only care for one attribute of the citation
+ // element. We handle that here, and then return a
+ // default context.
+ sal_Int16 nLength = xAttrList->getLength();
+ for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++)
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
+ &sLocalName );
+
+ if ( (nPrefix == XML_NAMESPACE_TEXT) &&
+ IsXMLToken( sLocalName, XML_LABEL ) )
+ {
+ xFootnote->setLabel(xAttrList->getValueByIndex(nAttr));
+ }
+ }
+
+ // ignore content: return default context
+ pContext = new SvXMLImportContext(GetImport(),
+ p_nPrefix, rLocalName);
+ break;
+ }
+
+ case XML_TOK_FTN_NOTE_BODY:
+ // return footnote body
+ pContext = new XMLFootnoteBodyImportContext(GetImport(),
+ p_nPrefix, rLocalName);
+ break;
+ default:
+ // default:
+ pContext = SvXMLImportContext::CreateChildContext(p_nPrefix,
+ rLocalName,
+ xAttrList);
+ break;
+ }
+
+ return pContext;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLFootnoteImportContext.hxx b/xmloff/source/text/XMLFootnoteImportContext.hxx
new file mode 100644
index 000000000000..89fc26468d07
--- /dev/null
+++ b/xmloff/source/text/XMLFootnoteImportContext.hxx
@@ -0,0 +1,100 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLFOOTNOTEIMPORTCONTEXT_HXX_
+#define _XMLOFF_XMLFOOTNOTEIMPORTCONTEXT_HXX_
+
+#include <xmloff/xmlictxt.hxx>
+#include <com/sun/star/uno/Reference.h>
+
+
+namespace com { namespace sun { namespace star {
+ namespace text {
+ class XTextCursor;
+ class XFootnote;
+ }
+ namespace xml { namespace sax {
+ class XAttributeList;
+ } }
+} } }
+namespace rtl {
+ class OUString;
+}
+class XMLTextImportHelper;
+
+/// import footnote elements (<text:footnote>)
+class XMLFootnoteImportContext : public SvXMLImportContext
+{
+ const ::rtl::OUString sPropertyReferenceId;
+
+ /// old document cursor
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextCursor> xOldCursor;
+
+ /// old list item and block (#89891#)
+ bool mbListContextPushed;
+
+ /// text import helper; holds current XTextCursor (and XText)
+ XMLTextImportHelper& rHelper;
+
+ /// the footnote
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XFootnote> xFootnote;
+
+public:
+
+ TYPEINFO();
+
+ XMLFootnoteImportContext(
+ SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName );
+
+protected:
+
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+
+ virtual void Characters(
+ const ::rtl::OUString& rChars);
+
+ virtual void EndElement();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexAlphabeticalSourceContext.cxx b/xmloff/source/text/XMLIndexAlphabeticalSourceContext.cxx
new file mode 100644
index 000000000000..ec18fdc9e2eb
--- /dev/null
+++ b/xmloff/source/text/XMLIndexAlphabeticalSourceContext.cxx
@@ -0,0 +1,274 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+#include "XMLIndexAlphabeticalSourceContext.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XIndexReplace.hpp>
+#include "XMLIndexTemplateContext.hxx"
+#include "XMLIndexTitleTemplateContext.hxx"
+#include "XMLIndexTOCStylesContext.hxx"
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/txtimp.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <tools/debug.hxx>
+#include <rtl/ustring.hxx>
+
+
+
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::xml::sax::XAttributeList;
+using ::xmloff::token::IsXMLToken;
+using ::xmloff::token::XML_ALPHABETICAL_INDEX_ENTRY_TEMPLATE;
+using ::xmloff::token::XML_OUTLINE_LEVEL;
+
+const sal_Char sAPI_MainEntryCharacterStyleName[] = "MainEntryCharacterStyleName";
+const sal_Char sAPI_UseAlphabeticalSeparators[] = "UseAlphabeticalSeparators";
+const sal_Char sAPI_UseCombinedEntries[] = "UseCombinedEntries";
+const sal_Char sAPI_IsCaseSensitive[] = "IsCaseSensitive";
+const sal_Char sAPI_UseKeyAsEntry[] = "UseKeyAsEntry";
+const sal_Char sAPI_UseUpperCase[] = "UseUpperCase";
+const sal_Char sAPI_UseDash[] = "UseDash";
+const sal_Char sAPI_UsePP[] = "UsePP";
+const sal_Char sAPI_SortAlgorithm[] = "SortAlgorithm";
+const sal_Char sAPI_Locale[] = "Locale";
+
+
+TYPEINIT1( XMLIndexAlphabeticalSourceContext, XMLIndexSourceBaseContext );
+
+XMLIndexAlphabeticalSourceContext::XMLIndexAlphabeticalSourceContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ Reference<XPropertySet> & rPropSet)
+: XMLIndexSourceBaseContext(rImport, nPrfx, rLocalName, rPropSet, sal_False)
+, sMainEntryCharacterStyleName(RTL_CONSTASCII_USTRINGPARAM(sAPI_MainEntryCharacterStyleName))
+, sUseAlphabeticalSeparators(RTL_CONSTASCII_USTRINGPARAM(sAPI_UseAlphabeticalSeparators))
+, sUseCombinedEntries(RTL_CONSTASCII_USTRINGPARAM(sAPI_UseCombinedEntries))
+, sIsCaseSensitive(RTL_CONSTASCII_USTRINGPARAM(sAPI_IsCaseSensitive))
+, sUseKeyAsEntry(RTL_CONSTASCII_USTRINGPARAM(sAPI_UseKeyAsEntry))
+, sUseUpperCase(RTL_CONSTASCII_USTRINGPARAM(sAPI_UseUpperCase))
+, sUseDash(RTL_CONSTASCII_USTRINGPARAM(sAPI_UseDash))
+, sUsePP(RTL_CONSTASCII_USTRINGPARAM(sAPI_UsePP))
+, sIsCommaSeparated(RTL_CONSTASCII_USTRINGPARAM("IsCommaSeparated"))
+, sSortAlgorithm(RTL_CONSTASCII_USTRINGPARAM(sAPI_SortAlgorithm))
+, sLocale(RTL_CONSTASCII_USTRINGPARAM(sAPI_Locale))
+, bMainEntryStyleNameOK(sal_False)
+, bSeparators(sal_False)
+, bCombineEntries(sal_True)
+, bCaseSensitive(sal_True)
+, bEntry(sal_False)
+, bUpperCase(sal_False)
+, bCombineDash(sal_False)
+, bCombinePP(sal_True)
+, bCommaSeparated(sal_False)
+{
+}
+
+XMLIndexAlphabeticalSourceContext::~XMLIndexAlphabeticalSourceContext()
+{
+}
+
+void XMLIndexAlphabeticalSourceContext::ProcessAttribute(
+ enum IndexSourceParamEnum eParam,
+ const OUString& rValue)
+{
+ bool bTmp;
+
+ switch (eParam)
+ {
+ case XML_TOK_INDEXSOURCE_MAIN_ENTRY_STYLE:
+ {
+ sMainEntryStyleName = rValue;
+ OUString sDisplayStyleName = GetImport().GetStyleDisplayName(
+ XML_STYLE_FAMILY_TEXT_TEXT, sMainEntryStyleName );
+ const Reference < ::com::sun::star::container::XNameContainer >&
+ rStyles = GetImport().GetTextImport()->GetTextStyles();
+ bMainEntryStyleNameOK = rStyles.is() && rStyles->hasByName( sDisplayStyleName );
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_IGNORE_CASE:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bCaseSensitive = !bTmp;
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_SEPARATORS:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bSeparators = bTmp;
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_COMBINE_ENTRIES:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bCombineEntries = bTmp;
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_COMBINE_WITH_DASH:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bCombineDash = bTmp;
+ }
+ break;
+ case XML_TOK_INDEXSOURCE_KEYS_AS_ENTRIES:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bEntry = bTmp;
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_COMBINE_WITH_PP:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bCombinePP = bTmp;
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_CAPITALIZE:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bUpperCase = bTmp;
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_COMMA_SEPARATED:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bCommaSeparated = bTmp;
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_SORT_ALGORITHM:
+ sAlgorithm = rValue;
+ break;
+ case XML_TOK_INDEXSOURCE_LANGUAGE:
+ aLocale.Language = rValue;
+ break;
+ case XML_TOK_INDEXSOURCE_COUNTRY:
+ aLocale.Country = rValue;
+ break;
+
+ default:
+ XMLIndexSourceBaseContext::ProcessAttribute(eParam, rValue);
+ break;
+ }
+}
+
+void XMLIndexAlphabeticalSourceContext::EndElement()
+{
+
+ Any aAny;
+
+ if (bMainEntryStyleNameOK)
+ {
+ aAny <<= GetImport().GetStyleDisplayName(
+ XML_STYLE_FAMILY_TEXT_TEXT, sMainEntryStyleName );
+ rIndexPropertySet->setPropertyValue(sMainEntryCharacterStyleName,aAny);
+ }
+
+ aAny.setValue(&bSeparators, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sUseAlphabeticalSeparators, aAny);
+
+ aAny.setValue(&bCombineEntries, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sUseCombinedEntries, aAny);
+
+ aAny.setValue(&bCaseSensitive, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sIsCaseSensitive, aAny);
+
+ aAny.setValue(&bEntry, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sUseKeyAsEntry, aAny);
+
+ aAny.setValue(&bUpperCase, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sUseUpperCase, aAny);
+
+ aAny.setValue(&bCombineDash, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sUseDash, aAny);
+
+ aAny.setValue(&bCombinePP, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sUsePP, aAny);
+
+ aAny.setValue(&bCommaSeparated, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sIsCommaSeparated, aAny);
+
+
+ if (sAlgorithm.getLength() > 0)
+ {
+ aAny <<= sAlgorithm;
+ rIndexPropertySet->setPropertyValue(sSortAlgorithm, aAny);
+ }
+
+ if ( (aLocale.Language.getLength() > 0) &&
+ (aLocale.Country.getLength() > 0) )
+ {
+ aAny <<= aLocale;
+ rIndexPropertySet->setPropertyValue(sLocale, aAny);
+ }
+
+ XMLIndexSourceBaseContext::EndElement();
+}
+
+SvXMLImportContext* XMLIndexAlphabeticalSourceContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList )
+{
+ if ( (XML_NAMESPACE_TEXT == nPrefix) &&
+ IsXMLToken( rLocalName, XML_ALPHABETICAL_INDEX_ENTRY_TEMPLATE ) )
+ {
+ return new XMLIndexTemplateContext(GetImport(), rIndexPropertySet,
+ nPrefix, rLocalName,
+ aLevelNameAlphaMap,
+ XML_OUTLINE_LEVEL,
+ aLevelStylePropNameAlphaMap,
+ aAllowedTokenTypesAlpha);
+ }
+ else
+ {
+ return XMLIndexSourceBaseContext::CreateChildContext(nPrefix,
+ rLocalName,
+ xAttrList);
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexAlphabeticalSourceContext.hxx b/xmloff/source/text/XMLIndexAlphabeticalSourceContext.hxx
new file mode 100644
index 000000000000..11bcbfe2ba99
--- /dev/null
+++ b/xmloff/source/text/XMLIndexAlphabeticalSourceContext.hxx
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLINDEXALPHABETICALSOURCECONTEXT_HXX_
+#define _XMLOFF_XMLINDEXALPHABETICALSOURCECONTEXT_HXX_
+
+#include "XMLIndexSourceBaseContext.hxx"
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/lang/Locale.hpp>
+
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+ namespace beans { class XPropertySet; }
+} } }
+namespace rtl { class OUString; }
+
+
+/**
+ * Import alphabetical (keyword) index source element
+ */
+class XMLIndexAlphabeticalSourceContext : public XMLIndexSourceBaseContext
+{
+ const ::rtl::OUString sMainEntryCharacterStyleName;
+ const ::rtl::OUString sUseAlphabeticalSeparators;
+ const ::rtl::OUString sUseCombinedEntries;
+ const ::rtl::OUString sIsCaseSensitive;
+ const ::rtl::OUString sUseKeyAsEntry;
+ const ::rtl::OUString sUseUpperCase;
+ const ::rtl::OUString sUseDash;
+ const ::rtl::OUString sUsePP;
+ const ::rtl::OUString sIsCommaSeparated;
+ const ::rtl::OUString sSortAlgorithm;
+ const ::rtl::OUString sLocale;
+
+ ::com::sun::star::lang::Locale aLocale;
+ ::rtl::OUString sAlgorithm;
+
+ ::rtl::OUString sMainEntryStyleName;
+ sal_Bool bMainEntryStyleNameOK;
+
+ sal_Bool bSeparators;
+ sal_Bool bCombineEntries;
+ sal_Bool bCaseSensitive;
+ sal_Bool bEntry;
+ sal_Bool bUpperCase;
+ sal_Bool bCombineDash;
+ sal_Bool bCombinePP;
+ sal_Bool bCommaSeparated;
+
+public:
+
+ TYPEINFO();
+
+ XMLIndexAlphabeticalSourceContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet);
+
+ ~XMLIndexAlphabeticalSourceContext();
+
+protected:
+
+ virtual void ProcessAttribute(
+ enum IndexSourceParamEnum eParam,
+ const ::rtl::OUString& rValue);
+
+ virtual void EndElement();
+
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx b/xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx
new file mode 100644
index 000000000000..0f9f5edad3d0
--- /dev/null
+++ b/xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx
@@ -0,0 +1,300 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+#include "XMLIndexBibliographyConfigurationContext.hxx"
+#include "XMLIndexBibliographyEntryContext.hxx"
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/txtimp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <tools/debug.hxx>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::uno;
+using namespace ::xmloff::token;
+
+using ::rtl::OUString;
+using ::com::sun::star::xml::sax::XAttributeList;
+using ::com::sun::star::beans::PropertyValue;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::lang::XMultiServiceFactory;
+
+const sal_Char sAPI_FieldMaster_Bibliography[] =
+ "com.sun.star.text.FieldMaster.Bibliography";
+
+
+TYPEINIT1( XMLIndexBibliographyConfigurationContext, SvXMLStyleContext );
+
+XMLIndexBibliographyConfigurationContext::XMLIndexBibliographyConfigurationContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList) :
+ SvXMLStyleContext(rImport, nPrfx, rLocalName, xAttrList, XML_STYLE_FAMILY_TEXT_BIBLIOGRAPHYCONFIG),
+ sFieldMaster_Bibliography(
+ RTL_CONSTASCII_USTRINGPARAM(sAPI_FieldMaster_Bibliography)),
+ sBracketBefore(RTL_CONSTASCII_USTRINGPARAM("BracketBefore")),
+ sBracketAfter(RTL_CONSTASCII_USTRINGPARAM("BracketAfter")),
+ sIsNumberEntries(RTL_CONSTASCII_USTRINGPARAM("IsNumberEntries")),
+ sIsSortByPosition(RTL_CONSTASCII_USTRINGPARAM("IsSortByPosition")),
+ sSortKeys(RTL_CONSTASCII_USTRINGPARAM("SortKeys")),
+ sSortKey(RTL_CONSTASCII_USTRINGPARAM("SortKey")),
+ sIsSortAscending(RTL_CONSTASCII_USTRINGPARAM("IsSortAscending")),
+ sSortAlgorithm(RTL_CONSTASCII_USTRINGPARAM("SortAlgorithm")),
+ sLocale(RTL_CONSTASCII_USTRINGPARAM("Locale")),
+ sSuffix(),
+ sPrefix(),
+ sAlgorithm(),
+ aLocale(),
+ bNumberedEntries(sal_False),
+ bSortByPosition(sal_True)
+{
+}
+
+XMLIndexBibliographyConfigurationContext::~XMLIndexBibliographyConfigurationContext()
+{
+}
+
+void XMLIndexBibliographyConfigurationContext::StartElement(
+ const Reference<XAttributeList> & xAttrList)
+{
+ sal_Int16 nLength = xAttrList->getLength();
+ for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++)
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
+ &sLocalName );
+
+ ProcessAttribute(nPrefix, sLocalName,
+ xAttrList->getValueByIndex(nAttr));
+ // else: ignore
+ }
+}
+
+void XMLIndexBibliographyConfigurationContext::ProcessAttribute(
+ sal_uInt16 nPrefix,
+ OUString sLocalName,
+ OUString sValue)
+{
+ if( XML_NAMESPACE_TEXT == nPrefix )
+ {
+ if( IsXMLToken(sLocalName, XML_PREFIX) )
+ {
+ sPrefix = sValue;
+ }
+ else if( IsXMLToken(sLocalName, XML_SUFFIX) )
+ {
+ sSuffix = sValue;
+ }
+ else if( IsXMLToken(sLocalName, XML_NUMBERED_ENTRIES) )
+ {
+ bool bTmp;
+ if( SvXMLUnitConverter::convertBool(bTmp, sValue) )
+ {
+ bNumberedEntries = bTmp;
+ }
+ }
+ else if( IsXMLToken(sLocalName, XML_SORT_BY_POSITION) )
+ {
+ bool bTmp;
+ if (SvXMLUnitConverter::convertBool(bTmp, sValue))
+ {
+ bSortByPosition = bTmp;
+ }
+ }
+ else if( IsXMLToken(sLocalName, XML_SORT_ALGORITHM) )
+ {
+ sAlgorithm = sValue;
+ }
+ }
+ else if( XML_NAMESPACE_FO == nPrefix )
+ {
+ if( IsXMLToken(sLocalName, XML_LANGUAGE) )
+ {
+ aLocale.Language = sValue;
+ }
+ else if( IsXMLToken(sLocalName, XML_COUNTRY) )
+ {
+ aLocale.Country = sValue;
+ }
+ }
+}
+
+
+SvXMLImportContext *XMLIndexBibliographyConfigurationContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList )
+{
+ OUString sKey;
+ sal_Bool bSort(sal_True);
+
+ // process children here and use default context!
+ if ( ( nPrefix == XML_NAMESPACE_TEXT ) &&
+ IsXMLToken( rLocalName, XML_SORT_KEY ) )
+ {
+ sal_Int16 nLength = xAttrList->getLength();
+ for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++)
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrfx = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
+ &sLocalName );
+
+ if (nPrfx == XML_NAMESPACE_TEXT)
+ {
+ if ( IsXMLToken( sLocalName, XML_KEY ) )
+ {
+ sKey = xAttrList->getValueByIndex(nAttr);
+ }
+ else if ( IsXMLToken( sLocalName, XML_SORT_ASCENDING ) )
+ {
+ bool bTmp;
+ if (SvXMLUnitConverter::convertBool(
+ bTmp, xAttrList->getValueByIndex(nAttr)))
+ {
+ bSort = bTmp;
+ }
+ }
+ }
+ }
+
+ // valid data?
+ sal_uInt16 nKey;
+ if (SvXMLUnitConverter::convertEnum(nKey, sKey,
+ aBibliographyDataFieldMap))
+ {
+
+ Any aAny;
+ Sequence<PropertyValue> aKey(2);
+
+ PropertyValue aNameValue;
+ aNameValue.Name = sSortKey;
+ aAny <<= (sal_Int16)nKey;
+ aNameValue.Value = aAny;
+ aKey[0] = aNameValue;
+
+ PropertyValue aSortValue;
+ aSortValue.Name = sIsSortAscending;
+ aAny.setValue(&bSort, ::getBooleanCppuType());
+ aSortValue.Value = aAny;
+ aKey[1] = aSortValue;
+
+ aSortKeys.push_back(aKey);
+ }
+ }
+
+ return SvXMLImportContext::CreateChildContext(nPrefix, rLocalName,
+ xAttrList);
+}
+
+void XMLIndexBibliographyConfigurationContext::CreateAndInsert(sal_Bool)
+{
+ // (code almost the same as export...)
+
+ // insert and block mode is handled in insertStyleFamily
+
+ // first: get field master
+ // (we'll create one, and get the only master for this type)
+ Reference<XMultiServiceFactory> xFactory(GetImport().GetModel(),UNO_QUERY);
+ if( xFactory.is() )
+ {
+ Sequence<rtl::OUString> aServices = xFactory->getAvailableServiceNames();
+ sal_Bool bFound(sal_False);
+ sal_Int32 i(0);
+ sal_Int32 nServiceCount(aServices.getLength());
+ while (i < nServiceCount && !bFound)
+ {
+ if (aServices[i].equals(sFieldMaster_Bibliography))
+ // here we should use a method which compares in reverse order if available
+ // #85282#
+ bFound = sal_True;
+ else
+ i++;
+ }
+ if (bFound)
+ {
+ Reference<XInterface> xIfc =
+ xFactory->createInstance(sFieldMaster_Bibliography);
+ if( xIfc.is() )
+ {
+ Reference<XPropertySet> xPropSet( xIfc, UNO_QUERY );
+ Any aAny;
+
+ aAny <<= sSuffix;
+ xPropSet->setPropertyValue(sBracketAfter, aAny);
+
+ aAny <<= sPrefix;
+ xPropSet->setPropertyValue(sBracketBefore, aAny);
+
+ aAny.setValue(&bNumberedEntries, ::getBooleanCppuType());
+ xPropSet->setPropertyValue(sIsNumberEntries, aAny);
+
+ aAny.setValue(&bSortByPosition, ::getBooleanCppuType());
+ xPropSet->setPropertyValue(sIsSortByPosition, aAny);
+
+ if( (aLocale.Language.getLength() > 0) &&
+ (aLocale.Country.getLength() > 0) )
+ {
+ aAny <<= aLocale;
+ xPropSet->setPropertyValue(sLocale, aAny);
+ }
+
+ if( sAlgorithm.getLength() > 0 )
+ {
+ aAny <<= sAlgorithm;
+ xPropSet->setPropertyValue(sSortAlgorithm, aAny);
+ }
+
+ sal_Int32 nCount = aSortKeys.size();
+ Sequence<Sequence<PropertyValue> > aKeysSeq(nCount);
+ for(i = 0; i < nCount; i++)
+ {
+ aKeysSeq[i] = aSortKeys[i];
+ }
+ aAny <<= aKeysSeq;
+ xPropSet->setPropertyValue(sSortKeys, aAny);
+ }
+ // else: can't get FieldMaster -> ignore
+ }
+ }
+ // else: can't even get Factory -> ignore
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexBibliographyEntryContext.cxx b/xmloff/source/text/XMLIndexBibliographyEntryContext.cxx
new file mode 100644
index 000000000000..2e827c3137da
--- /dev/null
+++ b/xmloff/source/text/XMLIndexBibliographyEntryContext.cxx
@@ -0,0 +1,184 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+#include "XMLIndexBibliographyEntryContext.hxx"
+#include "XMLIndexTemplateContext.hxx"
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/txtimp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <com/sun/star/text/BibliographyDataField.hpp>
+
+
+using namespace ::com::sun::star::text;
+using namespace ::xmloff::token;
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::PropertyValue;
+using ::com::sun::star::beans::PropertyValues;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::xml::sax::XAttributeList;
+
+
+const sal_Char sAPI_TokenType[] = "TokenType";
+const sal_Char sAPI_CharacterStyleName[] = "CharacterStyleName";
+
+TYPEINIT1( XMLIndexBibliographyEntryContext, XMLIndexSimpleEntryContext);
+
+XMLIndexBibliographyEntryContext::XMLIndexBibliographyEntryContext(
+ SvXMLImport& rImport,
+ XMLIndexTemplateContext& rTemplate,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName ) :
+ XMLIndexSimpleEntryContext(rImport,
+ rTemplate.sTokenBibliographyDataField,
+ rTemplate,
+ nPrfx, rLocalName),
+ nBibliographyInfo(BibliographyDataField::IDENTIFIER),
+ bBibliographyInfoOK(sal_False)
+{
+}
+
+XMLIndexBibliographyEntryContext::~XMLIndexBibliographyEntryContext()
+{
+}
+
+const SvXMLEnumMapEntry aBibliographyDataFieldMap[] =
+{
+ { XML_ADDRESS, BibliographyDataField::ADDRESS },
+ { XML_ANNOTE, BibliographyDataField::ANNOTE },
+ { XML_AUTHOR, BibliographyDataField::AUTHOR },
+ { XML_BIBLIOGRAPHY_TYPE, BibliographyDataField::BIBILIOGRAPHIC_TYPE },
+ // #96658#: also read old documents (bib*i*liographic...)
+ { XML_BIBILIOGRAPHIC_TYPE, BibliographyDataField::BIBILIOGRAPHIC_TYPE },
+ { XML_BOOKTITLE, BibliographyDataField::BOOKTITLE },
+ { XML_CHAPTER, BibliographyDataField::CHAPTER },
+ { XML_CUSTOM1, BibliographyDataField::CUSTOM1 },
+ { XML_CUSTOM2, BibliographyDataField::CUSTOM2 },
+ { XML_CUSTOM3, BibliographyDataField::CUSTOM3 },
+ { XML_CUSTOM4, BibliographyDataField::CUSTOM4 },
+ { XML_CUSTOM5, BibliographyDataField::CUSTOM5 },
+ { XML_EDITION, BibliographyDataField::EDITION },
+ { XML_EDITOR, BibliographyDataField::EDITOR },
+ { XML_HOWPUBLISHED, BibliographyDataField::HOWPUBLISHED },
+ { XML_IDENTIFIER, BibliographyDataField::IDENTIFIER },
+ { XML_INSTITUTION, BibliographyDataField::INSTITUTION },
+ { XML_ISBN, BibliographyDataField::ISBN },
+ { XML_JOURNAL, BibliographyDataField::JOURNAL },
+ { XML_MONTH, BibliographyDataField::MONTH },
+ { XML_NOTE, BibliographyDataField::NOTE },
+ { XML_NUMBER, BibliographyDataField::NUMBER },
+ { XML_ORGANIZATIONS, BibliographyDataField::ORGANIZATIONS },
+ { XML_PAGES, BibliographyDataField::PAGES },
+ { XML_PUBLISHER, BibliographyDataField::PUBLISHER },
+ { XML_REPORT_TYPE, BibliographyDataField::REPORT_TYPE },
+ { XML_SCHOOL, BibliographyDataField::SCHOOL },
+ { XML_SERIES, BibliographyDataField::SERIES },
+ { XML_TITLE, BibliographyDataField::TITLE },
+ { XML_URL, BibliographyDataField::URL },
+ { XML_VOLUME, BibliographyDataField::VOLUME },
+ { XML_YEAR, BibliographyDataField::YEAR },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+void XMLIndexBibliographyEntryContext::StartElement(
+ const Reference<XAttributeList> & xAttrList)
+{
+ // handle both, style name and bibliography info
+ sal_Int16 nLength = xAttrList->getLength();
+ for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++)
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
+ &sLocalName );
+ if (XML_NAMESPACE_TEXT == nPrefix)
+ {
+ if ( IsXMLToken( sLocalName, XML_STYLE_NAME ) )
+ {
+ sCharStyleName = xAttrList->getValueByIndex(nAttr);
+ bCharStyleNameOK = sal_True;
+ }
+ else if ( IsXMLToken( sLocalName, XML_BIBLIOGRAPHY_DATA_FIELD ) )
+ {
+ sal_uInt16 nTmp;
+ if (SvXMLUnitConverter::convertEnum(
+ nTmp, xAttrList->getValueByIndex(nAttr),
+ aBibliographyDataFieldMap))
+ {
+ nBibliographyInfo = nTmp;
+ bBibliographyInfoOK = sal_True;
+ }
+ }
+ }
+ }
+
+ // if we have a style name, set it!
+ if (bCharStyleNameOK)
+ {
+ nValues++;
+ }
+
+ // always bibliography; else element is not valid
+ nValues++;
+}
+
+void XMLIndexBibliographyEntryContext::EndElement()
+{
+ // only valid, if we have bibliography info
+ if (bBibliographyInfoOK)
+ {
+ XMLIndexSimpleEntryContext::EndElement();
+ }
+}
+
+void XMLIndexBibliographyEntryContext::FillPropertyValues(
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue> & rValues)
+{
+ // entry name and (optionally) style name in parent class
+ XMLIndexSimpleEntryContext::FillPropertyValues(rValues);
+
+ // bibliography data field
+ sal_Int32 nIndex = bCharStyleNameOK ? 2 : 1;
+ rValues[nIndex].Name = rTemplateContext.sBibliographyDataField;
+ Any aAny;
+ aAny <<= nBibliographyInfo;
+ rValues[nIndex].Value = aAny;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexBibliographyEntryContext.hxx b/xmloff/source/text/XMLIndexBibliographyEntryContext.hxx
new file mode 100644
index 000000000000..ccec6a46cf0c
--- /dev/null
+++ b/xmloff/source/text/XMLIndexBibliographyEntryContext.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLINDEXBIBLIOGRAPHYENTRYCONTEXT_HXX_
+#define _XMLOFF_XMLINDEXBIBLIOGRAPHYENTRYCONTEXT_HXX_
+
+#include "XMLIndexSimpleEntryContext.hxx"
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+} } }
+namespace rtl { class OUString; }
+class XMLIndexTemplateContext;
+struct SvXMLEnumMapEntry;
+
+extern const SvXMLEnumMapEntry aBibliographyDataFieldMap[];
+
+/**
+ * Import bibliography index entry templates
+ */
+class XMLIndexBibliographyEntryContext : public XMLIndexSimpleEntryContext
+{
+ // bibliography info
+ sal_Int16 nBibliographyInfo;
+ sal_Bool bBibliographyInfoOK;
+
+public:
+
+ TYPEINFO();
+
+ XMLIndexBibliographyEntryContext(
+ SvXMLImport& rImport,
+ XMLIndexTemplateContext& rTemplate,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName );
+
+ ~XMLIndexBibliographyEntryContext();
+
+protected:
+
+ /** process parameters */
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+
+ /** call FillPropertyValues and insert into template */
+ virtual void EndElement();
+
+ /** fill property values for this template entry */
+ virtual void FillPropertyValues(
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue> & rValues);
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexBibliographySourceContext.cxx b/xmloff/source/text/XMLIndexBibliographySourceContext.cxx
new file mode 100644
index 000000000000..71a02d3cceed
--- /dev/null
+++ b/xmloff/source/text/XMLIndexBibliographySourceContext.cxx
@@ -0,0 +1,114 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+#include "XMLIndexBibliographySourceContext.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XIndexReplace.hpp>
+#include "XMLIndexTemplateContext.hxx"
+#include "XMLIndexTitleTemplateContext.hxx"
+#include "XMLIndexTOCStylesContext.hxx"
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/txtimp.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <tools/debug.hxx>
+#include <rtl/ustring.hxx>
+
+
+using namespace ::xmloff::token;
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::xml::sax::XAttributeList;
+
+
+TYPEINIT1(XMLIndexBibliographySourceContext, XMLIndexSourceBaseContext);
+
+
+XMLIndexBibliographySourceContext::XMLIndexBibliographySourceContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ Reference<XPropertySet> & rPropSet) :
+ XMLIndexSourceBaseContext(rImport, nPrfx, rLocalName,
+ rPropSet, sal_False)
+{
+}
+
+XMLIndexBibliographySourceContext::~XMLIndexBibliographySourceContext()
+{
+}
+
+void XMLIndexBibliographySourceContext::ProcessAttribute(
+ enum IndexSourceParamEnum,
+ const OUString&)
+{
+ // We have no attributes. Who wants attributes, anyway?
+}
+
+
+void XMLIndexBibliographySourceContext::EndElement()
+{
+ // No attributes, no properties.
+}
+
+
+SvXMLImportContext* XMLIndexBibliographySourceContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList )
+{
+ if ( ( XML_NAMESPACE_TEXT == nPrefix ) &&
+ ( IsXMLToken( rLocalName, XML_BIBLIOGRAPHY_ENTRY_TEMPLATE ) ) )
+ {
+ return new XMLIndexTemplateContext(GetImport(), rIndexPropertySet,
+ nPrefix, rLocalName,
+ aLevelNameBibliographyMap,
+ XML_BIBLIOGRAPHY_TYPE,
+ aLevelStylePropNameBibliographyMap,
+ aAllowedTokenTypesBibliography);
+ }
+ else
+ {
+ return XMLIndexSourceBaseContext::CreateChildContext(nPrefix,
+ rLocalName,
+ xAttrList);
+ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexBibliographySourceContext.hxx b/xmloff/source/text/XMLIndexBibliographySourceContext.hxx
new file mode 100644
index 000000000000..aff6534d9a3f
--- /dev/null
+++ b/xmloff/source/text/XMLIndexBibliographySourceContext.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLINDEXBIBLIOGRAPHYSOURCECONTEXT_HXX_
+#define _XMLOFF_XMLINDEXBIBLIOGRAPHYSOURCECONTEXT_HXX_
+
+#include "XMLIndexSourceBaseContext.hxx"
+#include <com/sun/star/uno/Reference.h>
+
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+ namespace beans { class XPropertySet; }
+} } }
+namespace rtl { class OUString; }
+
+
+/**
+ * Import bibliography source element
+ */
+class XMLIndexBibliographySourceContext : public XMLIndexSourceBaseContext
+{
+
+public:
+
+ TYPEINFO();
+
+ XMLIndexBibliographySourceContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet);
+
+ ~XMLIndexBibliographySourceContext();
+
+protected:
+
+ virtual void ProcessAttribute(
+ enum IndexSourceParamEnum eParam,
+ const ::rtl::OUString& rValue);
+
+ virtual void EndElement();
+
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexBodyContext.cxx b/xmloff/source/text/XMLIndexBodyContext.cxx
new file mode 100644
index 000000000000..0606a279d228
--- /dev/null
+++ b/xmloff/source/text/XMLIndexBodyContext.cxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+#include "XMLIndexBodyContext.hxx"
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/txtimp.hxx>
+#include <tools/debug.hxx>
+#include <rtl/ustring.hxx>
+
+using ::rtl::OUString;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::xml::sax::XAttributeList;
+
+
+TYPEINIT1( XMLIndexBodyContext, SvXMLImportContext);
+
+XMLIndexBodyContext::XMLIndexBodyContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName ) :
+ SvXMLImportContext(rImport, nPrfx, rLocalName),
+ bHasContent(sal_False)
+{
+}
+
+XMLIndexBodyContext::~XMLIndexBodyContext()
+{
+}
+
+SvXMLImportContext* XMLIndexBodyContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList)
+{
+ SvXMLImportContext* pContext = NULL;
+
+ // return text content (if possible)
+ pContext = GetImport().GetTextImport()->CreateTextChildContext(
+ GetImport(), nPrefix, rLocalName, xAttrList, XML_TEXT_TYPE_SECTION );
+ if (NULL == pContext)
+ {
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+ }
+ else
+ bHasContent = sal_True;
+
+ return pContext;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexBodyContext.hxx b/xmloff/source/text/XMLIndexBodyContext.hxx
new file mode 100644
index 000000000000..7bceae7cca6e
--- /dev/null
+++ b/xmloff/source/text/XMLIndexBodyContext.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLINDEXBODYCONTEXT_HXX_
+#define _XMLOFF_XMLINDEXBODYCONTEXT_HXX_
+
+#include <xmloff/xmlictxt.hxx>
+#include <com/sun/star/uno/Reference.h>
+
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+ namespace beans { class XPropertySet; }
+} } }
+namespace rtl { class OUString; }
+
+/**
+ * Import index body.
+ *
+ * This class basically delegates all CreateChildContext() calls to
+ * the text import and doesn't do much else.
+ */
+class XMLIndexBodyContext : public SvXMLImportContext
+{
+ sal_Bool bHasContent;
+
+public:
+
+ TYPEINFO();
+
+ XMLIndexBodyContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName );
+
+ ~XMLIndexBodyContext();
+
+ /// return whether any content elements were encountered
+ inline sal_Bool HasContent();
+
+protected:
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+};
+
+inline sal_Bool XMLIndexBodyContext::HasContent()
+{
+ return bHasContent;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexChapterInfoEntryContext.cxx b/xmloff/source/text/XMLIndexChapterInfoEntryContext.cxx
new file mode 100644
index 000000000000..62d8ef90516b
--- /dev/null
+++ b/xmloff/source/text/XMLIndexChapterInfoEntryContext.cxx
@@ -0,0 +1,210 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+#include "XMLIndexChapterInfoEntryContext.hxx"
+#include "XMLIndexTemplateContext.hxx"
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/txtimp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <com/sun/star/text/ChapterFormat.hpp>
+
+
+using namespace ::com::sun::star::text;
+using namespace ::xmloff::token;
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::PropertyValue;
+using ::com::sun::star::beans::PropertyValues;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::xml::sax::XAttributeList;
+
+
+
+TYPEINIT1( XMLIndexChapterInfoEntryContext, XMLIndexSimpleEntryContext);
+
+XMLIndexChapterInfoEntryContext::XMLIndexChapterInfoEntryContext(
+ SvXMLImport& rImport,
+ XMLIndexTemplateContext& rTemplate,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ sal_Bool bT ) :
+ XMLIndexSimpleEntryContext(rImport,
+ (bT ? rTemplate.sTokenEntryNumber
+ : rTemplate.sTokenChapterInfo),
+ rTemplate, nPrfx, rLocalName),
+ nChapterInfo(ChapterFormat::NAME_NUMBER),
+ bChapterInfoOK(sal_False),
+ bTOC( bT ),
+ nOutlineLevel( 0 ),
+ bOutlineLevelOK(sal_False)
+{
+}
+
+XMLIndexChapterInfoEntryContext::~XMLIndexChapterInfoEntryContext()
+{
+}
+
+static const SvXMLEnumMapEntry aChapterDisplayMap[] =
+{
+ { XML_NAME, ChapterFormat::NAME },
+ { XML_NUMBER, ChapterFormat::NUMBER },
+ { XML_NUMBER_AND_NAME, ChapterFormat::NAME_NUMBER },
+ //---> i89791
+ // enabled for ODF 1.2, full index support in 3.0
+ { XML_PLAIN_NUMBER_AND_NAME, ChapterFormat::NO_PREFIX_SUFFIX },
+ //<---
+ { XML_PLAIN_NUMBER, ChapterFormat::DIGIT },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+void XMLIndexChapterInfoEntryContext::StartElement(
+ const Reference<XAttributeList> & xAttrList)
+{
+ // handle both, style name and bibliography info
+ sal_Int16 nLength = xAttrList->getLength();
+ for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++)
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
+ &sLocalName );
+ if (XML_NAMESPACE_TEXT == nPrefix)
+ {
+ if ( IsXMLToken( sLocalName, XML_STYLE_NAME ) )
+ {
+ sCharStyleName = xAttrList->getValueByIndex(nAttr);
+ bCharStyleNameOK = sal_True;
+ }
+ else if ( IsXMLToken( sLocalName, XML_DISPLAY ) )//i53420, always true, in TOC as well
+ {
+ sal_uInt16 nTmp;
+ if (SvXMLUnitConverter::convertEnum(
+ nTmp, xAttrList->getValueByIndex(nAttr),
+ aChapterDisplayMap))
+ {
+ nChapterInfo = nTmp;
+ bChapterInfoOK = sal_True;
+ }
+ }
+ else if ( IsXMLToken( sLocalName, XML_OUTLINE_LEVEL ) )
+ {
+ sal_Int32 nTmp;
+
+ if (SvXMLUnitConverter::convertNumber(nTmp, xAttrList->getValueByIndex(nAttr)))
+ {
+//control on range is carried out in the UNO level
+ nOutlineLevel = static_cast<sal_uInt16>(nTmp);
+ bOutlineLevelOK = sal_True;
+ }
+ }
+ }
+ }
+
+ // if we have a style name, set it!
+ if (bCharStyleNameOK)
+ {
+ nValues++;
+ }
+
+ // if we have chaper info, set it!
+ if (bChapterInfoOK)
+ {
+ nValues++;
+ /* Some of the index chapter information attributes written to ODF 1.1
+ and 1.2 don't reflect the displaying (#i89791#)
+ */
+ if ( !bTOC )
+ {
+ bool bConvert( false );
+ {
+ sal_Int32 nUPD( 0 );
+ sal_Int32 nBuild( 0 );
+ const bool bBuildIdFound = GetImport().getBuildIds( nUPD, nBuild );
+ if ( GetImport().IsTextDocInOOoFileFormat() ||
+ ( bBuildIdFound &&
+ ( nUPD== 680 || nUPD == 645 || nUPD == 641 ) ) )
+ {
+ bConvert = true;
+ }
+ }
+ if ( bConvert )
+ {
+ if ( nChapterInfo == ChapterFormat::NUMBER )
+ {
+ nChapterInfo = ChapterFormat::DIGIT;
+ }
+ else if ( nChapterInfo == ChapterFormat::NAME_NUMBER )
+ {
+ nChapterInfo = ChapterFormat::NO_PREFIX_SUFFIX;
+ }
+ }
+ }
+ // <--
+ }
+ if (bOutlineLevelOK)
+ nValues++;
+}
+
+void XMLIndexChapterInfoEntryContext::FillPropertyValues(
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue> & rValues)
+{
+ // entry name and (optionally) style name in parent class
+ XMLIndexSimpleEntryContext::FillPropertyValues(rValues);
+
+ sal_Int32 nIndex = bCharStyleNameOK ? 2 : 1;
+
+ if( bChapterInfoOK )
+ {
+ // chapter info field
+ rValues[nIndex].Name = rTemplateContext.sChapterFormat;
+ Any aAny;
+ aAny <<= nChapterInfo;
+ rValues[nIndex].Value = aAny;
+ nIndex++;
+ }
+ if( bOutlineLevelOK )
+ {
+ rValues[nIndex].Name = rTemplateContext.sChapterLevel;
+ Any aAny;
+ aAny <<= nOutlineLevel;
+ rValues[nIndex].Value = aAny;
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexChapterInfoEntryContext.hxx b/xmloff/source/text/XMLIndexChapterInfoEntryContext.hxx
new file mode 100644
index 000000000000..7af50acad403
--- /dev/null
+++ b/xmloff/source/text/XMLIndexChapterInfoEntryContext.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLINDEXCHAPTERINFOENTRYCONTEXT_HXX_
+#define _XMLOFF_XMLINDEXCHAPTERINFOENTRYCONTEXT_HXX_
+
+#include "XMLIndexSimpleEntryContext.hxx"
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+} } }
+namespace rtl { class OUString; }
+class XMLIndexTemplateContext;
+
+/**
+ * Import chapter info index entry templates
+ */
+class XMLIndexChapterInfoEntryContext : public XMLIndexSimpleEntryContext
+{
+ // chapter format
+ sal_Int16 nChapterInfo;
+ sal_Bool bChapterInfoOK;
+ sal_Bool bTOC;
+ sal_Int16 nOutlineLevel;
+ sal_Bool bOutlineLevelOK;
+
+public:
+
+ TYPEINFO();
+
+ XMLIndexChapterInfoEntryContext(
+ SvXMLImport& rImport,
+ XMLIndexTemplateContext& rTemplate,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName,
+ sal_Bool bTOC );
+
+ ~XMLIndexChapterInfoEntryContext();
+
+protected:
+
+ /** process parameters */
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+
+ /** fill property values for this template entry */
+ virtual void FillPropertyValues(
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue> & rValues);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexIllustrationSourceContext.cxx b/xmloff/source/text/XMLIndexIllustrationSourceContext.cxx
new file mode 100644
index 000000000000..5c45121448c1
--- /dev/null
+++ b/xmloff/source/text/XMLIndexIllustrationSourceContext.cxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+#include "XMLIndexIllustrationSourceContext.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include "XMLIndexTemplateContext.hxx"
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/txtimp.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <tools/debug.hxx>
+#include <rtl/ustring.hxx>
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::xml::sax::XAttributeList;
+using ::xmloff::token::IsXMLToken;
+using ::xmloff::token::XML_ILLUSTRATION_INDEX_ENTRY_TEMPLATE;
+using ::xmloff::token::XML_TOKEN_INVALID;
+
+TYPEINIT1(XMLIndexIllustrationSourceContext, XMLIndexTableSourceContext);
+
+
+XMLIndexIllustrationSourceContext::XMLIndexIllustrationSourceContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ Reference<XPropertySet> & rPropSet) :
+ XMLIndexTableSourceContext(rImport, nPrfx, rLocalName, rPropSet)
+{
+}
+
+XMLIndexIllustrationSourceContext::~XMLIndexIllustrationSourceContext()
+{
+}
+
+SvXMLImportContext* XMLIndexIllustrationSourceContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList )
+{
+ if ( ( XML_NAMESPACE_TEXT == nPrefix ) &&
+ ( IsXMLToken( rLocalName, XML_ILLUSTRATION_INDEX_ENTRY_TEMPLATE ) ) )
+ {
+ return new XMLIndexTemplateContext(GetImport(), rIndexPropertySet,
+ nPrefix, rLocalName,
+ aLevelNameTableMap,
+ XML_TOKEN_INVALID, // no outline-level attr
+ aLevelStylePropNameTableMap,
+ aAllowedTokenTypesTable);
+ }
+ else
+ {
+ return XMLIndexSourceBaseContext::CreateChildContext(nPrefix,
+ rLocalName,
+ xAttrList);
+ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexIllustrationSourceContext.hxx b/xmloff/source/text/XMLIndexIllustrationSourceContext.hxx
new file mode 100644
index 000000000000..3055a616179c
--- /dev/null
+++ b/xmloff/source/text/XMLIndexIllustrationSourceContext.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLINDEXILLUSTRATIONSOURCECONTEXT_HXX_
+#define _XMLOFF_XMLINDEXILLUSTRATIONSOURCECONTEXT_HXX_
+
+#include "XMLIndexTableSourceContext.hxx"
+#include <com/sun/star/uno/Reference.h>
+
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+ namespace beans { class XPropertySet; }
+} } }
+namespace rtl { class OUString; }
+
+
+/**
+ * Import illustration index source element;
+ *
+ * All logic is inherited from table source context. The only difference is
+ * the different child context (illustration entry template).
+ */
+class XMLIndexIllustrationSourceContext : public XMLIndexTableSourceContext
+{
+public:
+
+ TYPEINFO();
+
+ XMLIndexIllustrationSourceContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet);
+
+ ~XMLIndexIllustrationSourceContext();
+
+protected:
+
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexMarkExport.cxx b/xmloff/source/text/XMLIndexMarkExport.cxx
new file mode 100644
index 000000000000..e84282b83589
--- /dev/null
+++ b/xmloff/source/text/XMLIndexMarkExport.cxx
@@ -0,0 +1,270 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLIndexMarkExport.hxx"
+#include <tools/debug.hxx>
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmluconv.hxx>
+
+
+using namespace ::xmloff::token;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::beans::XPropertySetInfo;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+
+
+
+XMLIndexMarkExport::XMLIndexMarkExport(
+ SvXMLExport& rExp,
+ XMLTextParagraphExport& rParaExp)
+: sLevel(RTL_CONSTASCII_USTRINGPARAM("Level"))
+, sUserIndexName(RTL_CONSTASCII_USTRINGPARAM("UserIndexName"))
+, sPrimaryKey(RTL_CONSTASCII_USTRINGPARAM("PrimaryKey"))
+, sSecondaryKey(RTL_CONSTASCII_USTRINGPARAM("SecondaryKey"))
+, sDocumentIndexMark(RTL_CONSTASCII_USTRINGPARAM("DocumentIndexMark"))
+, sIsStart(RTL_CONSTASCII_USTRINGPARAM("IsStart"))
+, sIsCollapsed(RTL_CONSTASCII_USTRINGPARAM("IsCollapsed"))
+, sAlternativeText(RTL_CONSTASCII_USTRINGPARAM("AlternativeText"))
+, sTextReading(RTL_CONSTASCII_USTRINGPARAM("TextReading"))
+, sPrimaryKeyReading(RTL_CONSTASCII_USTRINGPARAM("PrimaryKeyReading"))
+, sSecondaryKeyReading(RTL_CONSTASCII_USTRINGPARAM("SecondaryKeyReading"))
+, sMainEntry(RTL_CONSTASCII_USTRINGPARAM("IsMainEntry"))
+, rExport(rExp)
+, rParaExport(rParaExp)
+{
+}
+
+const enum XMLTokenEnum lcl_pTocMarkNames[] =
+ { XML_TOC_MARK, XML_TOC_MARK_START, XML_TOC_MARK_END };
+const enum XMLTokenEnum lcl_pUserIndexMarkName[] =
+ { XML_USER_INDEX_MARK,
+ XML_USER_INDEX_MARK_START, XML_USER_INDEX_MARK_END };
+const enum XMLTokenEnum lcl_pAlphaIndexMarkName[] =
+ { XML_ALPHABETICAL_INDEX_MARK,
+ XML_ALPHABETICAL_INDEX_MARK_START,
+ XML_ALPHABETICAL_INDEX_MARK_END };
+
+
+XMLIndexMarkExport::~XMLIndexMarkExport()
+{
+}
+
+void XMLIndexMarkExport::ExportIndexMark(
+ const Reference<XPropertySet> & rPropSet,
+ sal_Bool bAutoStyles)
+{
+ /// index marks have no styles!
+ if (!bAutoStyles)
+ {
+ const enum XMLTokenEnum * pElements = NULL;
+ sal_Int8 nElementNo = -1;
+
+ // get index mark
+ Any aAny;
+ aAny = rPropSet->getPropertyValue(sDocumentIndexMark);
+ Reference<XPropertySet> xIndexMarkPropSet;
+ aAny >>= xIndexMarkPropSet;
+
+ // common: handling of start, end, collapsed entries and
+ // alternative text
+
+ // collapsed/alternative text entry?
+ aAny = rPropSet->getPropertyValue(sIsCollapsed);
+ if (*(sal_Bool *)aAny.getValue())
+ {
+ // collapsed entry: needs alternative text
+ nElementNo = 0;
+
+ aAny = xIndexMarkPropSet->getPropertyValue(sAlternativeText);
+ OUString sTmp;
+ aAny >>= sTmp;
+ DBG_ASSERT(sTmp.getLength() > 0,
+ "collapsed index mark without alternative text");
+ rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_STRING_VALUE, sTmp);
+ }
+ else
+ {
+ // start and end entries: has ID
+ aAny = rPropSet->getPropertyValue(sIsStart);
+ nElementNo = *(sal_Bool *)aAny.getValue() ? 1 : 2;
+
+ // generate ID
+ OUStringBuffer sBuf;
+ GetID(sBuf, xIndexMarkPropSet);
+ rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_ID,
+ sBuf.makeStringAndClear());
+ }
+
+ // distinguish between TOC, user, alphab. index marks by
+ // asking for specific properties
+ // Export attributes for -mark-start and -mark elements,
+ // but not for -mark-end
+ Reference<XPropertySetInfo> xPropertySetInfo =
+ xIndexMarkPropSet->getPropertySetInfo();
+ if (xPropertySetInfo->hasPropertyByName(sUserIndexName))
+ {
+ // user index mark
+ pElements = lcl_pUserIndexMarkName;
+ if (nElementNo != 2)
+ {
+ ExportUserIndexMarkAttributes(xIndexMarkPropSet);
+ }
+ }
+ else if (xPropertySetInfo->hasPropertyByName(sPrimaryKey))
+ {
+ // alphabetical index mark
+ pElements = lcl_pAlphaIndexMarkName;
+ if (nElementNo != 2)
+ {
+ ExportAlphabeticalIndexMarkAttributes(xIndexMarkPropSet);
+ }
+ }
+ else
+ {
+ // table of content:
+ pElements = lcl_pTocMarkNames;
+ if (nElementNo != 2)
+ {
+ ExportTOCMarkAttributes(xIndexMarkPropSet);
+ }
+ }
+
+ // export element
+ DBG_ASSERT(pElements != NULL, "illegal element array");
+ DBG_ASSERT(nElementNo >= 0, "illegal name array index");
+ DBG_ASSERT(nElementNo <= 2, "illegal name array index");
+
+ if ((pElements != NULL) && (nElementNo != -1))
+ {
+ SvXMLElementExport aElem(rExport,
+ XML_NAMESPACE_TEXT,
+ pElements[nElementNo],
+ sal_False, sal_False);
+ }
+ }
+}
+
+void XMLIndexMarkExport::ExportTOCMarkAttributes(
+ const Reference<XPropertySet> & rPropSet)
+{
+ // outline level
+ sal_Int16 nLevel = 0;
+ Any aAny = rPropSet->getPropertyValue(sLevel);
+ aAny >>= nLevel;
+ OUStringBuffer sBuf;
+ SvXMLUnitConverter::convertNumber(sBuf, (sal_Int32)nLevel + 1);
+ rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_OUTLINE_LEVEL,
+ sBuf.makeStringAndClear());
+}
+
+void lcl_ExportPropertyString( SvXMLExport& rExport,
+ const Reference<XPropertySet> & rPropSet,
+ const OUString sProperty,
+ XMLTokenEnum eToken,
+ Any& rAny )
+{
+ rAny = rPropSet->getPropertyValue( sProperty );
+
+ OUString sValue;
+ if( rAny >>= sValue )
+ {
+ if( sValue.getLength() > 0 )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_TEXT, eToken, sValue );
+ }
+ }
+}
+
+void lcl_ExportPropertyBool( SvXMLExport& rExport,
+ const Reference<XPropertySet> & rPropSet,
+ const OUString sProperty,
+ XMLTokenEnum eToken,
+ Any& rAny )
+{
+ rAny = rPropSet->getPropertyValue( sProperty );
+
+ sal_Bool bValue = sal_Bool();
+ if( rAny >>= bValue )
+ {
+ if( bValue )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_TEXT, eToken, XML_TRUE );
+ }
+ }
+}
+
+void XMLIndexMarkExport::ExportUserIndexMarkAttributes(
+ const Reference<XPropertySet> & rPropSet)
+{
+ // name of user index
+ // (unless it's the default index; then it has no name)
+ Any aAny;
+ lcl_ExportPropertyString( rExport, rPropSet, sUserIndexName, XML_INDEX_NAME, aAny );
+
+ // additionally export outline level; just reuse ExportTOCMarkAttributes
+ ExportTOCMarkAttributes( rPropSet );
+}
+
+void XMLIndexMarkExport::ExportAlphabeticalIndexMarkAttributes(
+ const Reference<XPropertySet> & rPropSet)
+{
+ // primary and secondary keys (if available)
+ Any aAny;
+ lcl_ExportPropertyString( rExport, rPropSet, sTextReading, XML_STRING_VALUE_PHONETIC, aAny );
+ lcl_ExportPropertyString( rExport, rPropSet, sPrimaryKey, XML_KEY1, aAny );
+ lcl_ExportPropertyString( rExport, rPropSet, sPrimaryKeyReading, XML_KEY1_PHONETIC, aAny );
+ lcl_ExportPropertyString( rExport, rPropSet, sSecondaryKey, XML_KEY2, aAny );
+ lcl_ExportPropertyString( rExport, rPropSet, sSecondaryKeyReading, XML_KEY2_PHONETIC, aAny );
+ lcl_ExportPropertyBool( rExport, rPropSet, sMainEntry, XML_MAIN_ENTRY, aAny );
+}
+
+void XMLIndexMarkExport::GetID(
+ OUStringBuffer& sBuf,
+ const Reference<XPropertySet> & rPropSet)
+{
+ static const sal_Char sPrefix[] = "IMark";
+
+ // HACK: use address of object to form identifier
+ sal_Int64 nId = sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(rPropSet.get()));
+ sBuf.appendAscii(sPrefix, sizeof(sPrefix)-1);
+ sBuf.append(nId);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexMarkExport.hxx b/xmloff/source/text/XMLIndexMarkExport.hxx
new file mode 100644
index 000000000000..461d6780d965
--- /dev/null
+++ b/xmloff/source/text/XMLIndexMarkExport.hxx
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLINDEXMARKEXPORT_HXX_
+#define _XMLOFF_XMLINDEXMARKEXPORT_HXX_
+
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.h>
+
+class SvXMLExport;
+class XMLTextParagraphExport;
+namespace com { namespace sun { namespace star {
+ namespace beans { class XPropertySet; }
+ } } }
+namespace rtl {
+ class OUString;
+ class OUStringBuffer;
+}
+
+
+/**
+ * This class handles the export of index marks for table of content,
+ * alphabetical and user index.
+ *
+ * Marks for bibliography indices are internally modelled as text
+ * fields and thus handled in txtparae.cxx
+ */
+class XMLIndexMarkExport
+{
+ ::rtl::OUString sLevel;
+ ::rtl::OUString sUserIndexName;
+ ::rtl::OUString sPrimaryKey;
+ ::rtl::OUString sSecondaryKey;
+ ::rtl::OUString sDocumentIndexMark;
+ ::rtl::OUString sIsStart;
+ ::rtl::OUString sIsCollapsed;
+ ::rtl::OUString sAlternativeText;
+ ::rtl::OUString sTextReading;
+ ::rtl::OUString sPrimaryKeyReading;
+ ::rtl::OUString sSecondaryKeyReading;
+ ::rtl::OUString sMainEntry;
+
+
+ SvXMLExport& rExport;
+ XMLTextParagraphExport& rParaExport;
+
+public:
+ XMLIndexMarkExport(SvXMLExport& rExp,
+ XMLTextParagraphExport& rParaExp);
+
+ ~XMLIndexMarkExport();
+
+ /**
+ * export by the property set of its *text* *portion*.
+ *
+ * The text portion supplies us with the properties of the index
+ * mark itself, as well as the information whether we are at the
+ * start or end of an index mark, or whether the index mark is
+ * collapsed.
+ */
+ void ExportIndexMark(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet,
+ sal_Bool bAutoStyles);
+
+protected:
+
+ /// export attributes of table-of-content index marks
+ void ExportTOCMarkAttributes(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet);
+
+ /// export attributes of user index marks
+ void ExportUserIndexMarkAttributes(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet);
+
+ /// export attributes of alphabetical index marks
+ void ExportAlphabeticalIndexMarkAttributes(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet);
+
+ /// create a numerical ID for this index mark
+ /// (represented by its properties)
+ void GetID(
+ ::rtl::OUStringBuffer& sBuffer,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet);
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexObjectSourceContext.cxx b/xmloff/source/text/XMLIndexObjectSourceContext.cxx
new file mode 100644
index 000000000000..1bf18ec7cb0a
--- /dev/null
+++ b/xmloff/source/text/XMLIndexObjectSourceContext.cxx
@@ -0,0 +1,193 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+#include "XMLIndexObjectSourceContext.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XIndexReplace.hpp>
+#include "XMLIndexTemplateContext.hxx"
+#include "XMLIndexTitleTemplateContext.hxx"
+#include "XMLIndexTOCStylesContext.hxx"
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/txtimp.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <tools/debug.hxx>
+#include <rtl/ustring.hxx>
+
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::xml::sax::XAttributeList;
+using ::xmloff::token::IsXMLToken;
+using ::xmloff::token::XML_OBJECT_INDEX_ENTRY_TEMPLATE;
+using ::xmloff::token::XML_TOKEN_INVALID;
+
+const sal_Char sAPI_CreateFromStarCalc[] = "CreateFromStarCalc";
+const sal_Char sAPI_CreateFromStarChart[] = "CreateFromStarChart";
+const sal_Char sAPI_CreateFromStarDraw[] = "CreateFromStarDraw";
+const sal_Char sAPI_CreateFromStarImage[] = "CreateFromStarImage";
+const sal_Char sAPI_CreateFromStarMath[] = "CreateFromStarMath";
+const sal_Char sAPI_CreateFromOtherEmbeddedObjects[] = "CreateFromOtherEmbeddedObjects";
+
+
+TYPEINIT1( XMLIndexObjectSourceContext, XMLIndexSourceBaseContext );
+
+XMLIndexObjectSourceContext::XMLIndexObjectSourceContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ Reference<XPropertySet> & rPropSet) :
+ XMLIndexSourceBaseContext(rImport, nPrfx, rLocalName,
+ rPropSet, sal_False),
+ sCreateFromStarCalc(RTL_CONSTASCII_USTRINGPARAM(
+ sAPI_CreateFromStarCalc)),
+ sCreateFromStarChart(RTL_CONSTASCII_USTRINGPARAM(
+ sAPI_CreateFromStarChart)),
+ sCreateFromStarDraw(RTL_CONSTASCII_USTRINGPARAM(
+ sAPI_CreateFromStarDraw)),
+ sCreateFromStarMath(RTL_CONSTASCII_USTRINGPARAM(
+ sAPI_CreateFromStarMath)),
+ sCreateFromOtherEmbeddedObjects(RTL_CONSTASCII_USTRINGPARAM(
+ sAPI_CreateFromOtherEmbeddedObjects)),
+ bUseCalc(sal_False),
+ bUseChart(sal_False),
+ bUseDraw(sal_False),
+ bUseMath(sal_False),
+ bUseOtherObjects(sal_False)
+{
+}
+
+XMLIndexObjectSourceContext::~XMLIndexObjectSourceContext()
+{
+}
+
+void XMLIndexObjectSourceContext::ProcessAttribute(
+ enum IndexSourceParamEnum eParam,
+ const OUString& rValue)
+{
+ switch (eParam)
+ {
+ bool bTmp;
+
+ case XML_TOK_INDEXSOURCE_USE_OTHER_OBJECTS:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bUseOtherObjects = bTmp;
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_USE_SHEET:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bUseCalc = bTmp;
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_USE_CHART:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bUseChart = bTmp;
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_USE_DRAW:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bUseDraw = bTmp;
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_USE_MATH:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bUseMath = bTmp;
+ }
+ break;
+
+ default:
+ XMLIndexSourceBaseContext::ProcessAttribute(eParam, rValue);
+ break;
+ }
+}
+
+void XMLIndexObjectSourceContext::EndElement()
+{
+ Any aAny;
+
+ aAny.setValue(&bUseCalc, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sCreateFromStarCalc, aAny);
+
+ aAny.setValue(&bUseChart, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sCreateFromStarChart, aAny);
+
+ aAny.setValue(&bUseDraw, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sCreateFromStarDraw, aAny);
+
+ aAny.setValue(&bUseMath, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sCreateFromStarMath, aAny);
+
+ aAny.setValue(&bUseOtherObjects, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sCreateFromOtherEmbeddedObjects, aAny);
+
+ XMLIndexSourceBaseContext::EndElement();
+}
+
+SvXMLImportContext* XMLIndexObjectSourceContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList )
+{
+ if ( (XML_NAMESPACE_TEXT == nPrefix) &&
+ (IsXMLToken(rLocalName, XML_OBJECT_INDEX_ENTRY_TEMPLATE)) )
+ {
+ return new XMLIndexTemplateContext(GetImport(), rIndexPropertySet,
+ nPrefix, rLocalName,
+ aLevelNameTableMap,
+ XML_TOKEN_INVALID, // no outline-level attr
+ aLevelStylePropNameTableMap,
+ aAllowedTokenTypesTable);
+ }
+ else
+ {
+ return XMLIndexSourceBaseContext::CreateChildContext(nPrefix,
+ rLocalName,
+ xAttrList);
+ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexObjectSourceContext.hxx b/xmloff/source/text/XMLIndexObjectSourceContext.hxx
new file mode 100644
index 000000000000..74c37bc28283
--- /dev/null
+++ b/xmloff/source/text/XMLIndexObjectSourceContext.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLINDEXOBJECTSOURCECONTEXT_HXX_
+#define _XMLOFF_XMLINDEXOBJECTSOURCECONTEXT_HXX_
+
+#include "XMLIndexSourceBaseContext.hxx"
+#include <com/sun/star/uno/Reference.h>
+
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+ namespace beans { class XPropertySet; }
+} } }
+namespace rtl { class OUString; }
+
+
+/**
+ * Import object index source element
+ */
+class XMLIndexObjectSourceContext : public XMLIndexSourceBaseContext
+{
+ const ::rtl::OUString sCreateFromStarCalc;
+ const ::rtl::OUString sCreateFromStarChart;
+ const ::rtl::OUString sCreateFromStarDraw;
+ const ::rtl::OUString sCreateFromStarMath;
+ const ::rtl::OUString sCreateFromOtherEmbeddedObjects;
+
+ sal_Bool bUseCalc;
+ sal_Bool bUseChart;
+ sal_Bool bUseDraw;
+ sal_Bool bUseMath;
+ sal_Bool bUseOtherObjects;
+
+public:
+
+ TYPEINFO();
+
+ XMLIndexObjectSourceContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet);
+
+ ~XMLIndexObjectSourceContext();
+
+protected:
+
+ virtual void ProcessAttribute(
+ enum IndexSourceParamEnum eParam,
+ const ::rtl::OUString& rValue);
+
+ virtual void EndElement();
+
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexSimpleEntryContext.cxx b/xmloff/source/text/XMLIndexSimpleEntryContext.cxx
new file mode 100644
index 000000000000..0f3ca31b2385
--- /dev/null
+++ b/xmloff/source/text/XMLIndexSimpleEntryContext.cxx
@@ -0,0 +1,146 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+#include "XMLIndexSimpleEntryContext.hxx"
+#include "XMLIndexTemplateContext.hxx"
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/txtimp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::PropertyValue;
+using ::com::sun::star::beans::PropertyValues;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::xml::sax::XAttributeList;
+using ::xmloff::token::IsXMLToken;
+using ::xmloff::token::XML_STYLE_NAME;
+
+const sal_Char sAPI_TokenType[] = "TokenType";
+const sal_Char sAPI_CharacterStyleName[] = "CharacterStyleName";
+
+TYPEINIT1( XMLIndexSimpleEntryContext, SvXMLImportContext);
+
+XMLIndexSimpleEntryContext::XMLIndexSimpleEntryContext(
+ SvXMLImport& rImport,
+ const OUString& rEntry,
+ XMLIndexTemplateContext& rTemplate,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName )
+: SvXMLImportContext(rImport, nPrfx, rLocalName)
+, rEntryType(rEntry)
+, bCharStyleNameOK(sal_False)
+, rTemplateContext(rTemplate)
+, nValues(1)
+{
+}
+
+XMLIndexSimpleEntryContext::~XMLIndexSimpleEntryContext()
+{
+}
+
+void XMLIndexSimpleEntryContext::StartElement(
+ const Reference<XAttributeList> & xAttrList)
+{
+ // we know only one attribute: style-name
+ sal_Int16 nLength = xAttrList->getLength();
+ for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++)
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
+ &sLocalName );
+ if ( (XML_NAMESPACE_TEXT == nPrefix) &&
+ IsXMLToken(sLocalName, XML_STYLE_NAME) )
+ {
+ sCharStyleName = xAttrList->getValueByIndex(nAttr);
+ OUString sDisplayStyleName = GetImport().GetStyleDisplayName(
+ XML_STYLE_FAMILY_TEXT_TEXT, sCharStyleName );
+ // #142494#: Check if style exists
+ const Reference < ::com::sun::star::container::XNameContainer > & rStyles =
+ GetImport().GetTextImport()->GetTextStyles();
+ if( rStyles.is() && rStyles->hasByName( sDisplayStyleName ) )
+ bCharStyleNameOK = sal_True;
+ else
+ bCharStyleNameOK = sal_False;
+ }
+ }
+
+ // if we have a style name, set it!
+ if (bCharStyleNameOK)
+ {
+ nValues++;
+ }
+
+}
+
+void XMLIndexSimpleEntryContext::EndElement()
+{
+ Sequence<PropertyValue> aValues(nValues);
+
+ FillPropertyValues(aValues);
+ rTemplateContext.addTemplateEntry(aValues);
+}
+
+void XMLIndexSimpleEntryContext::FillPropertyValues(
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue> & rValues)
+{
+ // due to the limited number of subclasses, we fill the values
+ // directly into the slots. Subclasses will have to know they can
+ // only use slot so-and-so.
+
+ Any aAny;
+
+ // token type
+ rValues[0].Name = rTemplateContext.sTokenType;
+ aAny <<= rEntryType;
+ rValues[0].Value = aAny;
+
+ // char style
+ if (bCharStyleNameOK)
+ {
+ rValues[1].Name = rTemplateContext.sCharacterStyleName;
+ aAny <<= GetImport().GetStyleDisplayName(
+ XML_STYLE_FAMILY_TEXT_TEXT,
+ sCharStyleName );
+ rValues[1].Value = aAny;
+ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexSimpleEntryContext.hxx b/xmloff/source/text/XMLIndexSimpleEntryContext.hxx
new file mode 100644
index 000000000000..556b936027db
--- /dev/null
+++ b/xmloff/source/text/XMLIndexSimpleEntryContext.hxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLINDEXSIMPLEENTRYCONTEXT_HXX_
+#define _XMLOFF_XMLINDEXSIMPLEENTRYCONTEXT_HXX_
+
+#include <xmloff/xmlictxt.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+} } }
+namespace rtl { class OUString; }
+class XMLIndexTemplateContext;
+
+/**
+ * Import index entry templates
+ */
+class XMLIndexSimpleEntryContext : public SvXMLImportContext
+{
+
+ // entry type
+ const ::rtl::OUString& rEntryType;
+
+protected:
+ // character style
+ ::rtl::OUString sCharStyleName;
+ sal_Bool bCharStyleNameOK;
+
+ // surrounding template
+ XMLIndexTemplateContext& rTemplateContext;
+
+ // number of values for PropertyValues
+ sal_Int32 nValues;
+
+public:
+
+ TYPEINFO();
+
+ XMLIndexSimpleEntryContext(
+ SvXMLImport& rImport,
+ const ::rtl::OUString& rEntry,
+ XMLIndexTemplateContext& rTemplate,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName );
+
+ ~XMLIndexSimpleEntryContext();
+
+protected:
+
+ /** process parameters */
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+
+ /** call FillPropertyValues and insert into template */
+ virtual void EndElement();
+
+ /** fill property values for this template entry */
+ virtual void FillPropertyValues(
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue> & rValues);
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexSourceBaseContext.cxx b/xmloff/source/text/XMLIndexSourceBaseContext.cxx
new file mode 100644
index 000000000000..849ffa0b2b0e
--- /dev/null
+++ b/xmloff/source/text/XMLIndexSourceBaseContext.cxx
@@ -0,0 +1,280 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+#include "XMLIndexSourceBaseContext.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XIndexReplace.hpp>
+#include "XMLIndexTemplateContext.hxx"
+#include "XMLIndexTitleTemplateContext.hxx"
+#include "XMLIndexTOCStylesContext.hxx"
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/txtimp.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <tools/debug.hxx>
+#include <rtl/ustring.hxx>
+
+
+
+using namespace ::xmloff::token;
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::xml::sax::XAttributeList;
+
+const sal_Char sAPI_CreateFromChapter[] = "CreateFromChapter";
+const sal_Char sAPI_IsRelativeTabstops[] = "IsRelativeTabstops";
+
+static SvXMLTokenMapEntry aIndexSourceTokenMap[] =
+{
+ { XML_NAMESPACE_TEXT,
+ XML_OUTLINE_LEVEL,
+ XML_TOK_INDEXSOURCE_OUTLINE_LEVEL},
+ { XML_NAMESPACE_TEXT,
+ XML_USE_INDEX_MARKS,
+ XML_TOK_INDEXSOURCE_USE_INDEX_MARKS },
+ { XML_NAMESPACE_TEXT,
+ XML_INDEX_SCOPE,
+ XML_TOK_INDEXSOURCE_INDEX_SCOPE },
+ { XML_NAMESPACE_TEXT,
+ XML_RELATIVE_TAB_STOP_POSITION,
+ XML_TOK_INDEXSOURCE_RELATIVE_TABS } ,
+ { XML_NAMESPACE_TEXT,
+ XML_USE_OTHER_OBJECTS,
+ XML_TOK_INDEXSOURCE_USE_OTHER_OBJECTS },
+ { XML_NAMESPACE_TEXT,
+ XML_USE_SPREADSHEET_OBJECTS,
+ XML_TOK_INDEXSOURCE_USE_SHEET },
+ { XML_NAMESPACE_TEXT,
+ XML_USE_CHART_OBJECTS,
+ XML_TOK_INDEXSOURCE_USE_CHART },
+ { XML_NAMESPACE_TEXT,
+ XML_USE_DRAW_OBJECTS,
+ XML_TOK_INDEXSOURCE_USE_DRAW },
+ { XML_NAMESPACE_TEXT,
+ XML_USE_IMAGE_OBJECTS,
+ XML_TOK_INDEXSOURCE_USE_IMAGE },
+ { XML_NAMESPACE_TEXT,
+ XML_USE_MATH_OBJECTS,
+ XML_TOK_INDEXSOURCE_USE_MATH },
+ { XML_NAMESPACE_TEXT,
+ XML_MAIN_ENTRY_STYLE_NAME,
+ XML_TOK_INDEXSOURCE_MAIN_ENTRY_STYLE },
+ { XML_NAMESPACE_TEXT,
+ XML_IGNORE_CASE,
+ XML_TOK_INDEXSOURCE_IGNORE_CASE },
+ { XML_NAMESPACE_TEXT,
+ XML_ALPHABETICAL_SEPARATORS,
+ XML_TOK_INDEXSOURCE_SEPARATORS },
+ { XML_NAMESPACE_TEXT,
+ XML_COMBINE_ENTRIES,
+ XML_TOK_INDEXSOURCE_COMBINE_ENTRIES },
+ { XML_NAMESPACE_TEXT,
+ XML_COMBINE_ENTRIES_WITH_DASH,
+ XML_TOK_INDEXSOURCE_COMBINE_WITH_DASH },
+ { XML_NAMESPACE_TEXT,
+ XML_USE_KEYS_AS_ENTRIES,
+ XML_TOK_INDEXSOURCE_KEYS_AS_ENTRIES },
+ { XML_NAMESPACE_TEXT,
+ XML_COMBINE_ENTRIES_WITH_PP,
+ XML_TOK_INDEXSOURCE_COMBINE_WITH_PP },
+ { XML_NAMESPACE_TEXT,
+ XML_CAPITALIZE_ENTRIES,
+ XML_TOK_INDEXSOURCE_CAPITALIZE },
+ { XML_NAMESPACE_TEXT,
+ XML_USE_OBJECTS,
+ XML_TOK_INDEXSOURCE_USE_OBJECTS },
+ { XML_NAMESPACE_TEXT,
+ XML_USE_GRAPHICS,
+ XML_TOK_INDEXSOURCE_USE_GRAPHICS },
+ { XML_NAMESPACE_TEXT,
+ XML_USE_TABLES,
+ XML_TOK_INDEXSOURCE_USE_TABLES },
+ { XML_NAMESPACE_TEXT,
+ XML_USE_FLOATING_FRAMES,
+ XML_TOK_INDEXSOURCE_USE_FRAMES },
+ { XML_NAMESPACE_TEXT,
+ XML_COPY_OUTLINE_LEVELS,
+ XML_TOK_INDEXSOURCE_COPY_OUTLINE_LEVELS },
+ { XML_NAMESPACE_TEXT,
+ XML_USE_CAPTION,
+ XML_TOK_INDEXSOURCE_USE_CAPTION },
+ { XML_NAMESPACE_TEXT,
+ XML_CAPTION_SEQUENCE_NAME,
+ XML_TOK_INDEXSOURCE_SEQUENCE_NAME },
+ { XML_NAMESPACE_TEXT,
+ XML_CAPTION_SEQUENCE_FORMAT,
+ XML_TOK_INDEXSOURCE_SEQUENCE_FORMAT },
+ { XML_NAMESPACE_TEXT,
+ XML_COMMA_SEPARATED,
+ XML_TOK_INDEXSOURCE_COMMA_SEPARATED },
+ { XML_NAMESPACE_TEXT,
+ XML_USE_INDEX_SOURCE_STYLES,
+ XML_TOK_INDEXSOURCE_USE_INDEX_SOURCE_STYLES },
+ { XML_NAMESPACE_TEXT, XML_SORT_ALGORITHM,
+ XML_TOK_INDEXSOURCE_SORT_ALGORITHM },
+ { XML_NAMESPACE_FO, XML_LANGUAGE, XML_TOK_INDEXSOURCE_LANGUAGE },
+ { XML_NAMESPACE_FO, XML_COUNTRY, XML_TOK_INDEXSOURCE_COUNTRY },
+ { XML_NAMESPACE_TEXT, XML_INDEX_NAME, XML_TOK_INDEXSOURCE_USER_INDEX_NAME },
+ { XML_NAMESPACE_TEXT,
+ XML_USE_OUTLINE_LEVEL,
+ XML_TOK_INDEXSOURCE_USE_OUTLINE_LEVEL},
+
+ XML_TOKEN_MAP_END
+};
+
+
+TYPEINIT1( XMLIndexSourceBaseContext, SvXMLImportContext );
+
+XMLIndexSourceBaseContext::XMLIndexSourceBaseContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ Reference<XPropertySet> & rPropSet,
+ sal_Bool bLevelFormats)
+: SvXMLImportContext(rImport, nPrfx, rLocalName)
+, sCreateFromChapter(RTL_CONSTASCII_USTRINGPARAM(sAPI_CreateFromChapter))
+, sIsRelativeTabstops(RTL_CONSTASCII_USTRINGPARAM(sAPI_IsRelativeTabstops))
+, bUseLevelFormats(bLevelFormats)
+, bChapterIndex(sal_False)
+, bRelativeTabs(sal_True)
+, rIndexPropertySet(rPropSet)
+{
+}
+
+XMLIndexSourceBaseContext::~XMLIndexSourceBaseContext()
+{
+}
+
+void XMLIndexSourceBaseContext::StartElement(
+ const Reference<XAttributeList> & xAttrList)
+{
+ SvXMLTokenMap aTokenMap(aIndexSourceTokenMap);
+
+ // process attributes
+ sal_Int16 nLength = xAttrList->getLength();
+ for(sal_Int16 i=0; i<nLength; i++)
+ {
+ // map to IndexSourceParamEnum
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(i), &sLocalName );
+ sal_uInt16 nToken = aTokenMap.Get(nPrefix, sLocalName);
+
+ // process attribute
+ ProcessAttribute((enum IndexSourceParamEnum)nToken,
+ xAttrList->getValueByIndex(i));
+ }
+}
+
+void XMLIndexSourceBaseContext::ProcessAttribute(
+ enum IndexSourceParamEnum eParam,
+ const OUString& rValue)
+{
+ switch (eParam)
+ {
+ case XML_TOK_INDEXSOURCE_INDEX_SCOPE:
+ if ( IsXMLToken( rValue, XML_CHAPTER ) )
+ {
+ bChapterIndex = sal_True;
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_RELATIVE_TABS:
+ {
+ bool bTmp;
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bRelativeTabs = bTmp;
+ }
+ break;
+ }
+
+ default:
+ // unknown attribute -> ignore
+ break;
+ }
+}
+
+void XMLIndexSourceBaseContext::EndElement()
+{
+ Any aAny;
+
+ aAny.setValue(&bRelativeTabs, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sIsRelativeTabstops, aAny);
+
+ aAny.setValue(&bChapterIndex, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sCreateFromChapter, aAny);
+}
+
+SvXMLImportContext* XMLIndexSourceBaseContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList )
+{
+ SvXMLImportContext* pContext = NULL;
+
+ if (XML_NAMESPACE_TEXT == nPrefix)
+ {
+ if ( IsXMLToken( rLocalName, XML_INDEX_TITLE_TEMPLATE ) )
+ {
+ pContext = new XMLIndexTitleTemplateContext(GetImport(),
+ rIndexPropertySet,
+ nPrefix, rLocalName);
+ }
+ else if ( bUseLevelFormats &&
+ IsXMLToken( rLocalName, XML_INDEX_SOURCE_STYLES ) )
+ {
+ pContext = new XMLIndexTOCStylesContext(GetImport(),
+ rIndexPropertySet,
+ nPrefix, rLocalName);
+ }
+ // else: unknown element in text namespace -> ignore
+ }
+ // else: unknown namespace -> ignore
+
+ // use default context
+ if (pContext == NULL)
+ {
+ pContext = SvXMLImportContext::CreateChildContext(nPrefix, rLocalName,
+ xAttrList);
+ }
+
+ return pContext;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexSourceBaseContext.hxx b/xmloff/source/text/XMLIndexSourceBaseContext.hxx
new file mode 100644
index 000000000000..7d7d10672d1e
--- /dev/null
+++ b/xmloff/source/text/XMLIndexSourceBaseContext.hxx
@@ -0,0 +1,134 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLINDEXSOURCEBASECONTEXT_HXX_
+#define _XMLOFF_XMLINDEXSOURCEBASECONTEXT_HXX_
+
+#include <xmloff/xmlictxt.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <rtl/ustring.hxx>
+
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+ namespace beans { class XPropertySet; }
+} } }
+
+enum IndexSourceParamEnum
+{
+ XML_TOK_INDEXSOURCE_OUTLINE_LEVEL,
+ XML_TOK_INDEXSOURCE_USE_INDEX_MARKS,
+ XML_TOK_INDEXSOURCE_INDEX_SCOPE,
+ XML_TOK_INDEXSOURCE_RELATIVE_TABS,
+ XML_TOK_INDEXSOURCE_USE_OTHER_OBJECTS,
+ XML_TOK_INDEXSOURCE_USE_SHEET,
+ XML_TOK_INDEXSOURCE_USE_CHART,
+ XML_TOK_INDEXSOURCE_USE_DRAW,
+ XML_TOK_INDEXSOURCE_USE_IMAGE,
+ XML_TOK_INDEXSOURCE_USE_MATH,
+ XML_TOK_INDEXSOURCE_MAIN_ENTRY_STYLE,
+ XML_TOK_INDEXSOURCE_IGNORE_CASE,
+ XML_TOK_INDEXSOURCE_SEPARATORS,
+ XML_TOK_INDEXSOURCE_COMBINE_ENTRIES,
+ XML_TOK_INDEXSOURCE_COMBINE_WITH_DASH,
+ XML_TOK_INDEXSOURCE_KEYS_AS_ENTRIES,
+ XML_TOK_INDEXSOURCE_COMBINE_WITH_PP,
+ XML_TOK_INDEXSOURCE_CAPITALIZE,
+ XML_TOK_INDEXSOURCE_USE_OBJECTS,
+ XML_TOK_INDEXSOURCE_USE_GRAPHICS,
+ XML_TOK_INDEXSOURCE_USE_TABLES,
+ XML_TOK_INDEXSOURCE_USE_FRAMES,
+ XML_TOK_INDEXSOURCE_COPY_OUTLINE_LEVELS,
+ XML_TOK_INDEXSOURCE_USE_CAPTION,
+ XML_TOK_INDEXSOURCE_SEQUENCE_NAME,
+ XML_TOK_INDEXSOURCE_SEQUENCE_FORMAT,
+ XML_TOK_INDEXSOURCE_COMMA_SEPARATED,
+ XML_TOK_INDEXSOURCE_USE_INDEX_SOURCE_STYLES,
+ XML_TOK_INDEXSOURCE_SORT_ALGORITHM,
+ XML_TOK_INDEXSOURCE_LANGUAGE,
+ XML_TOK_INDEXSOURCE_COUNTRY,
+ XML_TOK_INDEXSOURCE_USER_INDEX_NAME,
+ XML_TOK_INDEXSOURCE_USE_OUTLINE_LEVEL
+};
+
+
+/**
+ * Superclass for index source elements
+ */
+class XMLIndexSourceBaseContext : public SvXMLImportContext
+{
+ const ::rtl::OUString sCreateFromChapter;
+ const ::rtl::OUString sIsRelativeTabstops;
+
+ sal_Bool bUseLevelFormats;
+
+ sal_Bool bChapterIndex; /// chapter-wise or document index?
+ sal_Bool bRelativeTabs; /// tab stops relative to margin or indent?
+
+protected:
+
+ /// property set of index; must be accessible to subclasses
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rIndexPropertySet;
+
+public:
+
+ TYPEINFO();
+
+ XMLIndexSourceBaseContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet,
+ sal_Bool bLevelFormats);
+
+ ~XMLIndexSourceBaseContext();
+
+protected:
+
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+
+ virtual void ProcessAttribute(
+ enum IndexSourceParamEnum eParam,
+ const ::rtl::OUString& rValue);
+
+ virtual void EndElement();
+
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexSpanEntryContext.cxx b/xmloff/source/text/XMLIndexSpanEntryContext.cxx
new file mode 100644
index 000000000000..21a37dd56e7a
--- /dev/null
+++ b/xmloff/source/text/XMLIndexSpanEntryContext.cxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLIndexSpanEntryContext.hxx"
+#include <rtl/ustring.hxx>
+#include "XMLIndexTemplateContext.hxx"
+#include <xmloff/xmlictxt.hxx>
+
+
+using ::rtl::OUString;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::beans::PropertyValue;
+
+
+TYPEINIT1( XMLIndexSpanEntryContext, XMLIndexSimpleEntryContext);
+
+XMLIndexSpanEntryContext::XMLIndexSpanEntryContext(
+ SvXMLImport& rImport,
+ XMLIndexTemplateContext& rTemplate,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName ) :
+ XMLIndexSimpleEntryContext(rImport, rTemplate.sTokenText,
+ rTemplate, nPrfx, rLocalName)
+{
+ nValues++; // one more for the text string
+}
+
+XMLIndexSpanEntryContext::~XMLIndexSpanEntryContext()
+{
+}
+
+void XMLIndexSpanEntryContext::Characters(const OUString& sString)
+{
+ sContent.append(sString);
+}
+
+void XMLIndexSpanEntryContext::FillPropertyValues(
+ Sequence<PropertyValue> & rValues)
+{
+ // call superclass for token type, stylename,
+ XMLIndexSimpleEntryContext::FillPropertyValues(rValues);
+
+ // content
+ Any aAny;
+ aAny <<= sContent.makeStringAndClear();
+ rValues[nValues-1].Name = rTemplateContext.sText;
+ rValues[nValues-1].Value = aAny;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexSpanEntryContext.hxx b/xmloff/source/text/XMLIndexSpanEntryContext.hxx
new file mode 100644
index 000000000000..de7f26840508
--- /dev/null
+++ b/xmloff/source/text/XMLIndexSpanEntryContext.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLINDEXSPANENTRYCONTEXT_HXX_
+#define _XMLOFF_XMLINDEXSPANENTRYCONTEXT_HXX_
+
+#include "XMLIndexSimpleEntryContext.hxx"
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <rtl/ustrbuf.hxx>
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+} } }
+namespace rtl { class OUString; }
+
+/**
+ * Import index entry templates
+ */
+class XMLIndexSpanEntryContext : public XMLIndexSimpleEntryContext
+{
+ ::rtl::OUStringBuffer sContent;
+
+public:
+
+ TYPEINFO();
+
+ XMLIndexSpanEntryContext(
+ SvXMLImport& rImport,
+ XMLIndexTemplateContext& rTemplate,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName );
+
+ ~XMLIndexSpanEntryContext();
+
+protected:
+
+ /// Collect element contents
+ virtual void Characters(const ::rtl::OUString& sString);
+
+ /// add Text PropertyValue
+ virtual void FillPropertyValues(
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue> & rValues);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexTOCContext.cxx b/xmloff/source/text/XMLIndexTOCContext.cxx
new file mode 100644
index 000000000000..fd82a5f8f082
--- /dev/null
+++ b/xmloff/source/text/XMLIndexTOCContext.cxx
@@ -0,0 +1,385 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+#include "XMLIndexTOCContext.hxx"
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/text/XTextContent.hpp>
+#include <com/sun/star/text/XTextSection.hpp>
+#include <com/sun/star/text/XRelativeTextContentInsert.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include "XMLIndexTOCSourceContext.hxx"
+#include "XMLIndexObjectSourceContext.hxx"
+#include "XMLIndexAlphabeticalSourceContext.hxx"
+#include "XMLIndexUserSourceContext.hxx"
+#include "XMLIndexBibliographySourceContext.hxx"
+#include "XMLIndexTableSourceContext.hxx"
+#include "XMLIndexIllustrationSourceContext.hxx"
+#include "XMLIndexBodyContext.hxx"
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/txtimp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/prstylei.hxx>
+#include "xmloff/xmlerror.hxx"
+#include <xmloff/xmluconv.hxx>
+#include <rtl/ustring.hxx>
+
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::text;
+using namespace ::xmloff::token;
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::xml::sax::XAttributeList;
+using ::com::sun::star::lang::XMultiServiceFactory;
+using ::com::sun::star::lang::IllegalArgumentException;
+
+
+TYPEINIT1(XMLIndexTOCContext, SvXMLImportContext);
+
+static const sal_Char* aIndexServiceMap[] =
+{
+ "com.sun.star.text.ContentIndex",
+ "com.sun.star.text.DocumentIndex",
+ "com.sun.star.text.TableIndex",
+ "com.sun.star.text.ObjectIndex",
+ "com.sun.star.text.Bibliography",
+ "com.sun.star.text.UserIndex",
+ "com.sun.star.text.IllustrationsIndex"
+};
+
+static const XMLTokenEnum aIndexSourceElementMap[] =
+{
+ XML_TABLE_OF_CONTENT_SOURCE,
+ XML_ALPHABETICAL_INDEX_SOURCE,
+ XML_TABLE_INDEX_SOURCE,
+ XML_OBJECT_INDEX_SOURCE,
+ XML_BIBLIOGRAPHY_SOURCE,
+ XML_USER_INDEX_SOURCE,
+ XML_ILLUSTRATION_INDEX_SOURCE
+};
+
+SvXMLEnumMapEntry const aIndexTypeMap[] =
+{
+ { XML_TABLE_OF_CONTENT, TEXT_INDEX_TOC },
+ { XML_ALPHABETICAL_INDEX, TEXT_INDEX_ALPHABETICAL },
+ { XML_TABLE_INDEX, TEXT_INDEX_TABLE },
+ { XML_OBJECT_INDEX, TEXT_INDEX_OBJECT },
+ { XML_BIBLIOGRAPHY, TEXT_INDEX_BIBLIOGRAPHY },
+ { XML_USER_INDEX, TEXT_INDEX_USER },
+ { XML_ILLUSTRATION_INDEX, TEXT_INDEX_ILLUSTRATION },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+
+XMLIndexTOCContext::XMLIndexTOCContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName )
+: SvXMLImportContext(rImport, nPrfx, rLocalName)
+, sTitle(RTL_CONSTASCII_USTRINGPARAM("Title"))
+, sIsProtected(RTL_CONSTASCII_USTRINGPARAM("IsProtected"))
+, sName(RTL_CONSTASCII_USTRINGPARAM("Name"))
+, bValid(sal_False)
+{
+ if (XML_NAMESPACE_TEXT == nPrfx)
+ {
+ sal_uInt16 nTmp;
+ if (SvXMLUnitConverter::convertEnum(nTmp, rLocalName, aIndexTypeMap))
+ {
+ // check for array index:
+ OSL_ENSURE(nTmp < (sizeof(aIndexServiceMap)/sizeof(sal_Char*)), "index out of range");
+ OSL_ENSURE(sizeof(aIndexServiceMap) ==
+ sizeof(aIndexSourceElementMap),
+ "service and source element maps must be same size");
+
+ eIndexType = static_cast<IndexTypeEnum>(nTmp);
+ bValid = sal_True;
+ }
+ }
+}
+
+XMLIndexTOCContext::~XMLIndexTOCContext()
+{
+}
+
+void XMLIndexTOCContext::StartElement(
+ const Reference<XAttributeList> & xAttrList)
+{
+ if (bValid)
+ {
+ // find text:style-name attribute and set section style
+ // find text:protected and set value
+ // find text:name and set value (if not empty)
+ sal_Int16 nCount = xAttrList->getLength();
+ sal_Bool bProtected = sal_False;
+ OUString sIndexName;
+ OUString sXmlId;
+ XMLPropStyleContext* pStyle(NULL);
+ for(sal_Int16 nAttr = 0; nAttr < nCount; nAttr++)
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
+ &sLocalName );
+ if ( XML_NAMESPACE_TEXT == nPrefix)
+ {
+ if ( IsXMLToken( sLocalName, XML_STYLE_NAME ) )
+ {
+ pStyle = GetImport().GetTextImport()->FindSectionStyle(
+ xAttrList->getValueByIndex(nAttr));
+ }
+ else if ( IsXMLToken( sLocalName, XML_PROTECTED ) )
+ {
+ bool bTmp;
+ if ( SvXMLUnitConverter::convertBool(
+ bTmp, xAttrList->getValueByIndex(nAttr) ) )
+ {
+ bProtected = bTmp;
+ }
+ }
+ else if ( IsXMLToken( sLocalName, XML_NAME ) )
+ {
+ sIndexName = xAttrList->getValueByIndex(nAttr);
+ }
+ }
+ else if ( XML_NAMESPACE_XML == nPrefix)
+ {
+ if ( IsXMLToken( sLocalName, XML_ID ) )
+ {
+ sXmlId = xAttrList->getValueByIndex(nAttr);
+ }
+ }
+ }
+
+ // create table of content (via MultiServiceFactory)
+ Reference<XMultiServiceFactory> xFactory(GetImport().GetModel(),
+ UNO_QUERY);
+ if( xFactory.is() )
+ {
+ Reference<XInterface> xIfc =
+ xFactory->createInstance(
+ OUString::createFromAscii(aIndexServiceMap[eIndexType]));
+ if( xIfc.is() )
+ {
+ // get Property set
+ Reference<XPropertySet> xPropSet(xIfc, UNO_QUERY);
+ xTOCPropertySet = xPropSet;
+
+ // insert section
+ // a) insert section
+ // The inserted index consists of an empty paragraph
+ // only, as well as an empty paragraph *after* the index
+ // b) insert marker after index, and put Cursor inside of the
+ // index
+
+ // preliminaries
+#ifndef DBG_UTIL
+ OUString sMarker(RTL_CONSTASCII_USTRINGPARAM(" "));
+#else
+ OUString sMarker(RTL_CONSTASCII_USTRINGPARAM("Y"));
+#endif
+ UniReference<XMLTextImportHelper> rImport =
+ GetImport().GetTextImport();
+
+ // a) insert index
+ Reference<XTextContent> xTextContent(xIfc, UNO_QUERY);
+ try
+ {
+ GetImport().GetTextImport()->InsertTextContent(
+ xTextContent);
+ }
+ catch( IllegalArgumentException e )
+ {
+ // illegal argument? Then we can't accept indices here!
+ Sequence<OUString> aSeq(1);
+ aSeq[0] = GetLocalName();
+ GetImport().SetError(
+ XMLERROR_FLAG_ERROR | XMLERROR_NO_INDEX_ALLOWED_HERE,
+ aSeq, e.Message, NULL );
+
+ // set bValid to false, and return prematurely
+ bValid = false;
+ return;
+ }
+
+ // xml:id for RDF metadata
+ GetImport().SetXmlId(xIfc, sXmlId);
+
+ // b) insert marker and move cursor
+ rImport->InsertString(sMarker);
+ rImport->GetCursor()->goLeft(2, sal_False);
+ }
+ }
+
+ // finally, check for redlines that should start at
+ // the section start node
+ if( bValid )
+ GetImport().GetTextImport()->
+ RedlineAdjustStartNodeCursor(sal_True);
+
+ if (pStyle != NULL)
+ {
+ pStyle->FillPropertySet( xTOCPropertySet );
+ }
+
+ Any aAny;
+ aAny.setValue( &bProtected, ::getBooleanCppuType() );
+ xTOCPropertySet->setPropertyValue( sIsProtected, aAny );
+
+ if (sIndexName.getLength() > 0)
+ {
+ aAny <<= sIndexName;
+ xTOCPropertySet->setPropertyValue( sName, aAny );
+ }
+ }
+}
+
+void XMLIndexTOCContext::EndElement()
+{
+ // complete import of index by removing the markers (if the index
+ // was actually inserted, that is)
+ if( bValid )
+ {
+ // preliminaries
+ OUString sEmpty;
+ UniReference<XMLTextImportHelper> rHelper= GetImport().GetTextImport();
+
+ // get rid of last paragraph (unless it's the only paragraph)
+ rHelper->GetCursor()->goRight(1, sal_False);
+ if( xBodyContextRef.Is() &&
+ ((XMLIndexBodyContext*)&xBodyContextRef)->HasContent() )
+ {
+ rHelper->GetCursor()->goLeft(1, sal_True);
+ rHelper->GetText()->insertString(rHelper->GetCursorAsRange(),
+ sEmpty, sal_True);
+ }
+
+ // and delete second marker
+ rHelper->GetCursor()->goRight(1, sal_True);
+ rHelper->GetText()->insertString(rHelper->GetCursorAsRange(),
+ sEmpty, sal_True);
+
+ // check for Redlines on our end node
+ GetImport().GetTextImport()->RedlineAdjustStartNodeCursor(sal_False);
+ }
+}
+
+SvXMLImportContext* XMLIndexTOCContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList )
+{
+ SvXMLImportContext* pContext = NULL;
+
+ if (bValid)
+ {
+ if (XML_NAMESPACE_TEXT == nPrefix)
+ {
+ if ( IsXMLToken( rLocalName, XML_INDEX_BODY ) )
+ {
+ pContext = new XMLIndexBodyContext(GetImport(), nPrefix,
+ rLocalName);
+ if ( !xBodyContextRef.Is() ||
+ !((XMLIndexBodyContext*)&xBodyContextRef)->HasContent() )
+ {
+ xBodyContextRef = pContext;
+ }
+ }
+ else if (IsXMLToken(rLocalName, aIndexSourceElementMap[eIndexType]))
+ {
+ // instantiate source context for the appropriate index type
+ switch (eIndexType)
+ {
+ case TEXT_INDEX_TOC:
+ pContext = new XMLIndexTOCSourceContext(
+ GetImport(), nPrefix, rLocalName, xTOCPropertySet);
+ break;
+
+ case TEXT_INDEX_OBJECT:
+ pContext = new XMLIndexObjectSourceContext(
+ GetImport(), nPrefix, rLocalName, xTOCPropertySet);
+ break;
+
+ case TEXT_INDEX_ALPHABETICAL:
+ pContext = new XMLIndexAlphabeticalSourceContext(
+ GetImport(), nPrefix, rLocalName, xTOCPropertySet);
+ break;
+
+ case TEXT_INDEX_USER:
+ pContext = new XMLIndexUserSourceContext(
+ GetImport(), nPrefix, rLocalName, xTOCPropertySet);
+ break;
+
+ case TEXT_INDEX_BIBLIOGRAPHY:
+ pContext = new XMLIndexBibliographySourceContext(
+ GetImport(), nPrefix, rLocalName, xTOCPropertySet);
+ break;
+
+ case TEXT_INDEX_TABLE:
+ pContext = new XMLIndexTableSourceContext(
+ GetImport(), nPrefix, rLocalName, xTOCPropertySet);
+ break;
+
+ case TEXT_INDEX_ILLUSTRATION:
+ pContext = new XMLIndexIllustrationSourceContext(
+ GetImport(), nPrefix, rLocalName, xTOCPropertySet);
+ break;
+
+ default:
+ OSL_FAIL("index type not implemented");
+ break;
+ }
+ }
+ // else: ignore
+ }
+ // else: no text: namespace -> ignore
+ }
+ // else: not valid -> ignore
+
+ // default: ignore
+ if (pContext == NULL)
+ {
+ pContext = SvXMLImportContext::CreateChildContext(nPrefix, rLocalName,
+ xAttrList);
+ }
+
+ return pContext;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexTOCContext.hxx b/xmloff/source/text/XMLIndexTOCContext.hxx
new file mode 100644
index 000000000000..f4c99e99bf36
--- /dev/null
+++ b/xmloff/source/text/XMLIndexTOCContext.hxx
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLINDEXTOCCONTEXT_HXX_
+#define _XMLOFF_XMLINDEXTOCCONTEXT_HXX_
+
+#include <xmloff/xmlictxt.hxx>
+#include <com/sun/star/uno/Reference.h>
+
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+ namespace beans { class XPropertySet; }
+} } }
+namespace rtl { class OUString; }
+
+
+enum IndexTypeEnum
+{
+ TEXT_INDEX_TOC,
+ TEXT_INDEX_ALPHABETICAL,
+ TEXT_INDEX_TABLE,
+ TEXT_INDEX_OBJECT,
+ TEXT_INDEX_BIBLIOGRAPHY,
+ TEXT_INDEX_USER,
+ TEXT_INDEX_ILLUSTRATION,
+
+ TEXT_INDEX_UNKNOWN
+};
+
+
+/**
+ * Import all indices.
+ *
+ * Originally, this class would import only the TOC (table of
+ * content), but now it's role has been expanded to handle all
+ * indices, and hence is named inappropriately. Depending on the
+ * element name it decides which index source element context to create.
+ */
+class XMLIndexTOCContext : public SvXMLImportContext
+{
+ const ::rtl::OUString sTitle;
+ const ::rtl::OUString sIsProtected;
+ const ::rtl::OUString sName;
+
+ /** XPropertySet of the index */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> xTOCPropertySet;
+
+ enum IndexTypeEnum eIndexType;
+
+ sal_Bool bValid;
+
+ SvXMLImportContextRef xBodyContextRef;
+
+public:
+
+ TYPEINFO();
+
+ XMLIndexTOCContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName );
+
+ ~XMLIndexTOCContext();
+
+protected:
+
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+
+ virtual void EndElement();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexTOCSourceContext.cxx b/xmloff/source/text/XMLIndexTOCSourceContext.cxx
new file mode 100644
index 000000000000..46404a9cd6ca
--- /dev/null
+++ b/xmloff/source/text/XMLIndexTOCSourceContext.cxx
@@ -0,0 +1,199 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+#include "XMLIndexTOCSourceContext.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XIndexReplace.hpp>
+#include "XMLIndexTemplateContext.hxx"
+#include "XMLIndexTitleTemplateContext.hxx"
+#include "XMLIndexTOCStylesContext.hxx"
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/txtimp.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <tools/debug.hxx>
+#include <rtl/ustring.hxx>
+
+
+
+using namespace ::xmloff::token;
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::xml::sax::XAttributeList;
+
+const sal_Char sAPI_CreateFromChapter[] = "CreateFromChapter";
+const sal_Char sAPI_CreateFromOutline[] = "CreateFromOutline";
+const sal_Char sAPI_CreateFromMarks[] = "CreateFromMarks";
+const sal_Char sAPI_Level[] = "Level";
+const sal_Char sAPI_CreateFromLevelParagraphStyles[] = "CreateFromLevelParagraphStyles";
+
+
+TYPEINIT1( XMLIndexTOCSourceContext, XMLIndexSourceBaseContext );
+
+XMLIndexTOCSourceContext::XMLIndexTOCSourceContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ Reference<XPropertySet> & rPropSet)
+: XMLIndexSourceBaseContext(rImport, nPrfx, rLocalName, rPropSet, sal_True)
+, sCreateFromMarks(RTL_CONSTASCII_USTRINGPARAM(sAPI_CreateFromMarks))
+, sLevel(RTL_CONSTASCII_USTRINGPARAM(sAPI_Level))
+, sCreateFromOutline(RTL_CONSTASCII_USTRINGPARAM(sAPI_CreateFromOutline))
+, sCreateFromLevelParagraphStyles(RTL_CONSTASCII_USTRINGPARAM(sAPI_CreateFromLevelParagraphStyles))
+ // use all chapters by default
+, nOutlineLevel(rImport.GetTextImport()->GetChapterNumbering()->getCount())
+, bUseOutline(sal_True)
+, bUseMarks(sal_True)
+, bUseParagraphStyles(sal_False)
+{
+}
+
+XMLIndexTOCSourceContext::~XMLIndexTOCSourceContext()
+{
+}
+
+void XMLIndexTOCSourceContext::ProcessAttribute(
+ enum IndexSourceParamEnum eParam,
+ const OUString& rValue)
+{
+ switch (eParam)
+ {
+ case XML_TOK_INDEXSOURCE_OUTLINE_LEVEL:
+ if ( IsXMLToken( rValue, XML_NONE ) )
+ {
+ // #104651# use OUTLINE_LEVEL and USE_OUTLINE_LEVEL instead of
+ // OUTLINE_LEVEL with values none|1..10. For backwards
+ // compatibility, 'none' must still be read.
+ bUseOutline = sal_False;
+ }
+ else
+ {
+ sal_Int32 nTmp;
+ if (SvXMLUnitConverter::convertNumber(
+ nTmp, rValue, 1, GetImport().GetTextImport()->
+ GetChapterNumbering()->getCount()))
+ {
+ bUseOutline = sal_True;
+ nOutlineLevel = nTmp;
+ }
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_USE_OUTLINE_LEVEL:
+ {
+ bool bTmp;
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bUseOutline = bTmp;
+ }
+ break;
+ }
+
+
+ case XML_TOK_INDEXSOURCE_USE_INDEX_MARKS:
+ {
+ bool bTmp;
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bUseMarks = bTmp;
+ }
+ break;
+ }
+
+ case XML_TOK_INDEXSOURCE_USE_INDEX_SOURCE_STYLES:
+ {
+ bool bTmp;
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bUseParagraphStyles = bTmp;
+ }
+ break;
+ }
+
+ default:
+ // default: ask superclass
+ XMLIndexSourceBaseContext::ProcessAttribute(eParam, rValue);
+ break;
+ }
+}
+
+void XMLIndexTOCSourceContext::EndElement()
+{
+ Any aAny;
+
+ aAny.setValue(&bUseMarks, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sCreateFromMarks, aAny);
+
+ aAny.setValue(&bUseOutline, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sCreateFromOutline, aAny);
+
+ aAny.setValue(&bUseParagraphStyles, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sCreateFromLevelParagraphStyles, aAny);
+
+ aAny <<= (sal_Int16)nOutlineLevel;
+ rIndexPropertySet->setPropertyValue(sLevel, aAny);
+
+ // process common attributes
+ XMLIndexSourceBaseContext::EndElement();
+}
+
+
+SvXMLImportContext* XMLIndexTOCSourceContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList )
+{
+ if ( (XML_NAMESPACE_TEXT == nPrefix) &&
+ IsXMLToken(rLocalName, XML_TABLE_OF_CONTENT_ENTRY_TEMPLATE) )
+ {
+ return new XMLIndexTemplateContext(GetImport(), rIndexPropertySet,
+ nPrefix, rLocalName,
+ aLevelNameTOCMap,
+ XML_OUTLINE_LEVEL,
+ aLevelStylePropNameTOCMap,
+ aAllowedTokenTypesTOC, sal_True );
+ }
+ else
+ {
+ return XMLIndexSourceBaseContext::CreateChildContext(nPrefix,
+ rLocalName,
+ xAttrList);
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexTOCSourceContext.hxx b/xmloff/source/text/XMLIndexTOCSourceContext.hxx
new file mode 100644
index 000000000000..e05d0d7b8774
--- /dev/null
+++ b/xmloff/source/text/XMLIndexTOCSourceContext.hxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLINDEXTOCSOURCECONTEXT_HXX_
+#define _XMLOFF_XMLINDEXTOCSOURCECONTEXT_HXX_
+
+#include "XMLIndexSourceBaseContext.hxx"
+#include <com/sun/star/uno/Reference.h>
+
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+ namespace beans { class XPropertySet; }
+} } }
+namespace rtl { class OUString; }
+
+
+/**
+ * Import table of context source element
+ */
+class XMLIndexTOCSourceContext : public XMLIndexSourceBaseContext
+{
+ const ::rtl::OUString sCreateFromMarks;
+ const ::rtl::OUString sLevel;
+ const ::rtl::OUString sCreateFromChapter;
+ const ::rtl::OUString sCreateFromOutline;
+ const ::rtl::OUString sCreateFromLevelParagraphStyles;
+
+ sal_Int32 nOutlineLevel;
+ sal_Bool bUseOutline;
+ sal_Bool bUseMarks;
+ sal_Bool bUseParagraphStyles;
+
+public:
+
+ TYPEINFO();
+
+ XMLIndexTOCSourceContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet);
+
+ ~XMLIndexTOCSourceContext();
+
+protected:
+
+ virtual void ProcessAttribute(
+ enum IndexSourceParamEnum eParam,
+ const ::rtl::OUString& rValue);
+
+ virtual void EndElement();
+
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexTOCStylesContext.cxx b/xmloff/source/text/XMLIndexTOCStylesContext.cxx
new file mode 100644
index 000000000000..4dec88afc16a
--- /dev/null
+++ b/xmloff/source/text/XMLIndexTOCStylesContext.cxx
@@ -0,0 +1,162 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+#include "XMLIndexTOCStylesContext.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XIndexReplace.hpp>
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/txtimp.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <tools/debug.hxx>
+#include <rtl/ustring.hxx>
+
+
+using namespace ::xmloff::token;
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::container::XIndexReplace;
+using ::com::sun::star::xml::sax::XAttributeList;
+
+
+const sal_Char sAPI_LevelParagraphStyles[] = "LevelParagraphStyles";
+
+TYPEINIT1( XMLIndexTOCStylesContext, SvXMLImportContext );
+
+
+XMLIndexTOCStylesContext::XMLIndexTOCStylesContext(
+ SvXMLImport& rImport,
+ Reference<XPropertySet> & rPropSet,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName )
+: SvXMLImportContext(rImport, nPrfx, rLocalName)
+, sLevelParagraphStyles(RTL_CONSTASCII_USTRINGPARAM(sAPI_LevelParagraphStyles))
+, rTOCPropertySet(rPropSet)
+{
+}
+
+XMLIndexTOCStylesContext::~XMLIndexTOCStylesContext()
+{
+}
+
+void XMLIndexTOCStylesContext::StartElement(
+ const Reference<XAttributeList> & xAttrList )
+{
+ // find text:outline-level attribute
+ sal_Int16 nCount = xAttrList->getLength();
+ for(sal_Int16 nAttr = 0; nAttr < nCount; nAttr++)
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
+ &sLocalName );
+ if ( (XML_NAMESPACE_TEXT == nPrefix) &&
+ (IsXMLToken(sLocalName, XML_OUTLINE_LEVEL)) )
+ {
+ sal_Int32 nTmp;
+ if (SvXMLUnitConverter::convertNumber(
+ nTmp, xAttrList->getValueByIndex(nAttr), 1,
+ GetImport().GetTextImport()->GetChapterNumbering()->
+ getCount()))
+ {
+ // API numbers 0..9, we number 1..10
+ nOutlineLevel = nTmp-1;
+ }
+ }
+ }
+}
+
+void XMLIndexTOCStylesContext::EndElement()
+{
+ // if valid...
+ if (nOutlineLevel >= 0)
+ {
+ // copy vector into sequence
+ const sal_Int32 nCount = aStyleNames.size();
+ Sequence<OUString> aStyleNamesSequence(nCount);
+ for(sal_Int32 i = 0; i < nCount; i++)
+ {
+ aStyleNamesSequence[i] = GetImport().GetStyleDisplayName(
+ XML_STYLE_FAMILY_TEXT_PARAGRAPH,
+ aStyleNames[i] );
+ }
+
+ // get index replace
+ Any aAny = rTOCPropertySet->getPropertyValue(sLevelParagraphStyles);
+ Reference<XIndexReplace> xIndexReplace;
+ aAny >>= xIndexReplace;
+
+ // set style names
+ aAny <<= aStyleNamesSequence;
+ xIndexReplace->replaceByIndex(nOutlineLevel, aAny);
+ }
+}
+
+SvXMLImportContext *XMLIndexTOCStylesContext::CreateChildContext(
+ sal_uInt16 p_nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList )
+{
+ // check for index-source-style
+ if ( (XML_NAMESPACE_TEXT == p_nPrefix) &&
+ IsXMLToken( rLocalName, XML_INDEX_SOURCE_STYLE ) )
+ {
+ // find text:style-name attribute and record in aStyleNames
+ sal_Int16 nCount = xAttrList->getLength();
+ for(sal_Int16 nAttr = 0; nAttr < nCount; nAttr++)
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
+ &sLocalName );
+ if ( (XML_NAMESPACE_TEXT == nPrefix) &&
+ IsXMLToken( sLocalName, XML_STYLE_NAME ) )
+ {
+ aStyleNames.push_back(xAttrList->getValueByIndex(nAttr));
+ }
+ }
+ }
+
+ // always return default context; we already got the interesting info
+ return SvXMLImportContext::CreateChildContext(p_nPrefix, rLocalName,
+ xAttrList);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexTOCStylesContext.hxx b/xmloff/source/text/XMLIndexTOCStylesContext.hxx
new file mode 100644
index 000000000000..d027b30ec5aa
--- /dev/null
+++ b/xmloff/source/text/XMLIndexTOCStylesContext.hxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLINDEXTOCSTYLESCONTEXT_HXX_
+#define _XMLOFF_XMLINDEXTOCSTYLESCONTEXT_HXX_
+
+#include <xmloff/xmlictxt.hxx>
+#include <com/sun/star/uno/Reference.h>
+
+#include <vector>
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+ namespace beans { class XPropertySet; }
+} } }
+namespace rtl { class OUString; }
+
+
+/**
+ * Import <test:index-source-styles> elements and their children
+ *
+ * (Small hackery here: Because there's only one type of child
+ * elements with only one interesting attribute, we completely handle
+ * them inside the CreateChildContext method, rather than creating a
+ * new import class for them. This must be changed if children become
+ * more complex in future versions.)
+ */
+class XMLIndexTOCStylesContext : public SvXMLImportContext
+{
+ const ::rtl::OUString sLevelParagraphStyles;
+
+ /// XPropertySet of the index
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rTOCPropertySet;
+
+ /// style names for this level
+ ::std::vector< ::rtl::OUString > aStyleNames;
+
+ /// outline level
+ sal_Int32 nOutlineLevel;
+
+public:
+
+ TYPEINFO();
+
+ XMLIndexTOCStylesContext(
+ SvXMLImport& rImport,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName );
+
+ ~XMLIndexTOCStylesContext();
+
+protected:
+
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+
+ virtual void EndElement();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexTabStopEntryContext.cxx b/xmloff/source/text/XMLIndexTabStopEntryContext.cxx
new file mode 100644
index 000000000000..ff70425d0711
--- /dev/null
+++ b/xmloff/source/text/XMLIndexTabStopEntryContext.cxx
@@ -0,0 +1,177 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+#include "XMLIndexTabStopEntryContext.hxx"
+#include "XMLIndexTemplateContext.hxx"
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/txtimp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <rtl/ustring.hxx>
+#include <tools/debug.hxx>
+
+using namespace ::xmloff::token;
+
+using ::rtl::OUString;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::beans::PropertyValue;
+using ::com::sun::star::xml::sax::XAttributeList;
+
+
+TYPEINIT1( XMLIndexTabStopEntryContext, XMLIndexSimpleEntryContext );
+
+XMLIndexTabStopEntryContext::XMLIndexTabStopEntryContext(
+ SvXMLImport& rImport,
+ XMLIndexTemplateContext& rTemplate,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName ) :
+ XMLIndexSimpleEntryContext(rImport, rTemplate.sTokenTabStop,
+ rTemplate, nPrfx, rLocalName),
+ sLeaderChar(),
+ nTabPosition(0),
+ bTabPositionOK(sal_False),
+ bTabRightAligned(sal_False),
+ bLeaderCharOK(sal_False),
+ bWithTab(sal_True) // #i21237#
+{
+}
+
+XMLIndexTabStopEntryContext::~XMLIndexTabStopEntryContext()
+{
+}
+
+void XMLIndexTabStopEntryContext::StartElement(
+ const Reference<XAttributeList> & xAttrList)
+{
+ // process three attributes: type, position, leader char
+ sal_Int16 nLength = xAttrList->getLength();
+ for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++)
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
+ &sLocalName );
+ OUString sAttr = xAttrList->getValueByIndex(nAttr);
+ if (XML_NAMESPACE_STYLE == nPrefix)
+ {
+ if ( IsXMLToken( sLocalName, XML_TYPE ) )
+ {
+ // if it's neither left nor right, value is
+ // ignored. Since left is default, we only need to
+ // check for right
+ bTabRightAligned = IsXMLToken( sAttr, XML_RIGHT );
+ }
+ else if ( IsXMLToken( sLocalName, XML_POSITION ) )
+ {
+ sal_Int32 nTmp;
+ if (GetImport().GetMM100UnitConverter().
+ convertMeasure(nTmp, sAttr))
+ {
+ nTabPosition = nTmp;
+ bTabPositionOK = sal_True;
+ }
+ }
+ else if ( IsXMLToken( sLocalName, XML_LEADER_CHAR ) )
+ {
+ sLeaderChar = sAttr;
+ // valid only, if we have a char!
+ bLeaderCharOK = (sAttr.getLength() > 0);
+ }
+ // #i21237#
+ else if ( IsXMLToken( sLocalName, XML_WITH_TAB ) )
+ {
+ bool bTmp;
+ if (SvXMLUnitConverter::convertBool(bTmp, sAttr))
+ bWithTab = bTmp;
+ }
+ // else: unknown style: attribute -> ignore
+ }
+ // else: no style attribute -> ignore
+ }
+
+ // how many entries? #i21237#
+ nValues += 2 + (bTabPositionOK ? 1 : 0) + (bLeaderCharOK ? 1 : 0);
+
+ // now try parent class (for character style)
+ XMLIndexSimpleEntryContext::StartElement( xAttrList );
+}
+
+void XMLIndexTabStopEntryContext::FillPropertyValues(
+ Sequence<PropertyValue> & rValues)
+{
+ // fill vlues from parent class (type + style name)
+ XMLIndexSimpleEntryContext::FillPropertyValues(rValues);
+
+ // get values array and next entry to be written;
+ sal_Int32 nNextEntry = bCharStyleNameOK ? 2 : 1;
+ PropertyValue* pValues = rValues.getArray();
+
+ // right aligned?
+ pValues[nNextEntry].Name = rTemplateContext.sTabStopRightAligned;
+ pValues[nNextEntry].Value.setValue( &bTabRightAligned,
+ ::getBooleanCppuType());
+ nNextEntry++;
+
+ // position
+ if (bTabPositionOK)
+ {
+ pValues[nNextEntry].Name = rTemplateContext.sTabStopPosition;
+ pValues[nNextEntry].Value <<= nTabPosition;
+ nNextEntry++;
+ }
+
+ // leader char
+ if (bLeaderCharOK)
+ {
+ pValues[nNextEntry].Name = rTemplateContext.sTabStopFillCharacter;
+ pValues[nNextEntry].Value <<= sLeaderChar;
+ nNextEntry++;
+ }
+
+ // tab character #i21237#
+ pValues[nNextEntry].Name =
+ OUString( RTL_CONSTASCII_USTRINGPARAM("WithTab") );
+ pValues[nNextEntry].Value.setValue( &bWithTab,
+ ::getBooleanCppuType());
+ nNextEntry++;
+
+ // check whether we really filled all elements of the sequence
+ DBG_ASSERT( nNextEntry == rValues.getLength(),
+ "length incorrectly precumputed!" );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexTabStopEntryContext.hxx b/xmloff/source/text/XMLIndexTabStopEntryContext.hxx
new file mode 100644
index 000000000000..87713e8b46e5
--- /dev/null
+++ b/xmloff/source/text/XMLIndexTabStopEntryContext.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLINDEXTABSTOPENTRYCONTEXT_HXX_
+#define _XMLOFF_XMLINDEXTABSTOPENTRYCONTEXT_HXX_
+
+#include "XMLIndexSimpleEntryContext.hxx"
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+} } }
+class XMLIndexTemplateContext;
+
+/**
+ * Import index entry templates
+ */
+class XMLIndexTabStopEntryContext : public XMLIndexSimpleEntryContext
+{
+ ::rtl::OUString sLeaderChar; /// fill ("leader") character
+ sal_Int32 nTabPosition; /// tab position
+ sal_Bool bTabPositionOK; /// is tab right aligned?
+ sal_Bool bTabRightAligned; /// is nTabPosition valid?
+ sal_Bool bLeaderCharOK; /// is sLeaderChar valid?
+ sal_Bool bWithTab; /// is tab char present? #i21237#
+
+public:
+
+ TYPEINFO();
+
+ XMLIndexTabStopEntryContext(
+ SvXMLImport& rImport,
+ XMLIndexTemplateContext& rTemplate,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName );
+
+ ~XMLIndexTabStopEntryContext();
+
+protected:
+
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+
+ /** fill property values for this template entry */
+ virtual void FillPropertyValues(
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue> & rValues);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexTableSourceContext.cxx b/xmloff/source/text/XMLIndexTableSourceContext.cxx
new file mode 100644
index 000000000000..783c18e5590f
--- /dev/null
+++ b/xmloff/source/text/XMLIndexTableSourceContext.cxx
@@ -0,0 +1,189 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+#include "XMLIndexTableSourceContext.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XIndexReplace.hpp>
+
+#include <com/sun/star/text/ReferenceFieldPart.hpp>
+#include "XMLIndexTemplateContext.hxx"
+#include "XMLIndexTitleTemplateContext.hxx"
+#include "XMLIndexTOCStylesContext.hxx"
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/txtimp.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <tools/debug.hxx>
+#include <rtl/ustring.hxx>
+
+
+using namespace ::com::sun::star::text;
+using namespace ::xmloff::token;
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::xml::sax::XAttributeList;
+
+const sal_Char sAPI_CreateFromLabels[] = "CreateFromLabels";
+const sal_Char sAPI_LabelCategory[] = "LabelCategory";
+const sal_Char sAPI_LabelDisplayType[] = "LabelDisplayType";
+
+
+TYPEINIT1(XMLIndexTableSourceContext, XMLIndexSourceBaseContext);
+
+
+XMLIndexTableSourceContext::XMLIndexTableSourceContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ Reference<XPropertySet> & rPropSet) :
+ XMLIndexSourceBaseContext(rImport, nPrfx, rLocalName,
+ rPropSet, sal_False),
+ sCreateFromLabels(RTL_CONSTASCII_USTRINGPARAM(sAPI_CreateFromLabels)),
+ sLabelCategory(RTL_CONSTASCII_USTRINGPARAM(sAPI_LabelCategory)),
+ sLabelDisplayType(RTL_CONSTASCII_USTRINGPARAM(sAPI_LabelDisplayType)),
+ bSequenceOK(sal_False),
+ bDisplayFormatOK(sal_False),
+ bUseCaption(sal_True)
+{
+}
+
+XMLIndexTableSourceContext::~XMLIndexTableSourceContext()
+{
+}
+
+static SvXMLEnumMapEntry const lcl_aReferenceTypeTokenMap[] =
+{
+
+ { XML_TEXT, ReferenceFieldPart::TEXT },
+ { XML_CATEGORY_AND_VALUE, ReferenceFieldPart::CATEGORY_AND_NUMBER },
+ { XML_CAPTION, ReferenceFieldPart::ONLY_CAPTION },
+
+ // wrong values that previous versions wrote:
+ { XML_CHAPTER, ReferenceFieldPart::CATEGORY_AND_NUMBER },
+ { XML_PAGE, ReferenceFieldPart::ONLY_CAPTION },
+
+ { XML_TOKEN_INVALID, 0 }
+};
+
+void XMLIndexTableSourceContext::ProcessAttribute(
+ enum IndexSourceParamEnum eParam,
+ const OUString& rValue)
+{
+ bool bTmp;
+
+ switch (eParam)
+ {
+ case XML_TOK_INDEXSOURCE_USE_CAPTION:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bUseCaption = bTmp;
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_SEQUENCE_NAME:
+ sSequence = rValue;
+ bSequenceOK = sal_True;
+ break;
+
+ case XML_TOK_INDEXSOURCE_SEQUENCE_FORMAT:
+ {
+ sal_uInt16 nTmp;
+ if (SvXMLUnitConverter::convertEnum(nTmp, rValue,
+ lcl_aReferenceTypeTokenMap))
+ {
+ nDisplayFormat = nTmp;
+ bDisplayFormatOK = sal_True;
+ }
+ break;
+ }
+
+ default:
+ XMLIndexSourceBaseContext::ProcessAttribute(eParam, rValue);
+ break;
+ }
+}
+
+
+void XMLIndexTableSourceContext::EndElement()
+{
+ Any aAny;
+
+ aAny.setValue(&bUseCaption, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sCreateFromLabels, aAny);
+
+ if (bSequenceOK)
+ {
+ aAny <<= sSequence;
+ rIndexPropertySet->setPropertyValue(sLabelCategory, aAny);
+ }
+
+ if (bDisplayFormatOK)
+ {
+ aAny <<= nDisplayFormat;
+ rIndexPropertySet->setPropertyValue(sLabelDisplayType, aAny);
+ }
+
+ XMLIndexSourceBaseContext::EndElement();
+}
+
+
+SvXMLImportContext* XMLIndexTableSourceContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList )
+{
+ if ( ( XML_NAMESPACE_TEXT == nPrefix ) &&
+ ( IsXMLToken( rLocalName, XML_TABLE_INDEX_ENTRY_TEMPLATE ) ) )
+ {
+ return new XMLIndexTemplateContext(GetImport(), rIndexPropertySet,
+ nPrefix, rLocalName,
+ aLevelNameTableMap,
+ XML_TOKEN_INVALID, // no outline-level attr
+ aLevelStylePropNameTableMap,
+ aAllowedTokenTypesTable);
+ }
+ else
+ {
+ return XMLIndexSourceBaseContext::CreateChildContext(nPrefix,
+ rLocalName,
+ xAttrList);
+ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexTableSourceContext.hxx b/xmloff/source/text/XMLIndexTableSourceContext.hxx
new file mode 100644
index 000000000000..afeb866b2a0b
--- /dev/null
+++ b/xmloff/source/text/XMLIndexTableSourceContext.hxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLINDEXTABLESOURCECONTEXT_HXX_
+#define _XMLOFF_XMLINDEXTABLESOURCECONTEXT_HXX_
+
+#include "XMLIndexSourceBaseContext.hxx"
+#include <com/sun/star/uno/Reference.h>
+
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+ namespace beans { class XPropertySet; }
+} } }
+namespace rtl { class OUString; }
+
+
+/**
+ * Import table index source element
+ */
+class XMLIndexTableSourceContext : public XMLIndexSourceBaseContext
+{
+ const ::rtl::OUString sCreateFromLabels;
+ const ::rtl::OUString sLabelCategory;
+ const ::rtl::OUString sLabelDisplayType;
+
+ ::rtl::OUString sSequence;
+ sal_Int16 nDisplayFormat;
+
+ sal_Bool bSequenceOK;
+ sal_Bool bDisplayFormatOK;
+ sal_Bool bUseCaption;
+
+public:
+
+ TYPEINFO();
+
+ XMLIndexTableSourceContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet);
+
+ ~XMLIndexTableSourceContext();
+
+protected:
+
+ virtual void ProcessAttribute(
+ enum IndexSourceParamEnum eParam,
+ const ::rtl::OUString& rValue);
+
+ virtual void EndElement();
+
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexTemplateContext.cxx b/xmloff/source/text/XMLIndexTemplateContext.cxx
new file mode 100644
index 000000000000..15031b67baba
--- /dev/null
+++ b/xmloff/source/text/XMLIndexTemplateContext.cxx
@@ -0,0 +1,505 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+#include "XMLIndexTemplateContext.hxx"
+#include "XMLIndexSimpleEntryContext.hxx"
+#include "XMLIndexSpanEntryContext.hxx"
+#include "XMLIndexTabStopEntryContext.hxx"
+#include "XMLIndexBibliographyEntryContext.hxx"
+#include "XMLIndexChapterInfoEntryContext.hxx"
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/txtimp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <tools/debug.hxx>
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/container/XIndexReplace.hpp>
+
+
+using namespace ::std;
+using namespace ::xmloff::token;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::beans::PropertyValue;
+using ::com::sun::star::beans::PropertyValues;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::xml::sax::XAttributeList;
+using ::com::sun::star::container::XIndexReplace;
+
+const sal_Char sAPI_TokenEntryNumber[] = "TokenEntryNumber";
+const sal_Char sAPI_TokenEntryText[] = "TokenEntryText";
+const sal_Char sAPI_TokenTabStop[] = "TokenTabStop";
+const sal_Char sAPI_TokenText[] = "TokenText";
+const sal_Char sAPI_TokenPageNumber[] = "TokenPageNumber";
+const sal_Char sAPI_TokenChapterInfo[] = "TokenChapterInfo";
+const sal_Char sAPI_TokenHyperlinkStart[] = "TokenHyperlinkStart";
+const sal_Char sAPI_TokenHyperlinkEnd[] = "TokenHyperlinkEnd";
+const sal_Char sAPI_TokenBibliographyDataField[] =
+ "TokenBibliographyDataField";
+
+
+TYPEINIT1( XMLIndexTemplateContext, SvXMLImportContext);
+
+XMLIndexTemplateContext::XMLIndexTemplateContext(
+ SvXMLImport& rImport,
+ Reference<XPropertySet> & rPropSet,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const SvXMLEnumMapEntry* pLevelNameMap,
+ enum XMLTokenEnum eLevelAttrName,
+ const sal_Char** pLevelStylePropMap,
+ const sal_Bool* pAllowedTokenTypes,
+ sal_Bool bT )
+: SvXMLImportContext(rImport, nPrfx, rLocalName)
+, pOutlineLevelNameMap(pLevelNameMap)
+, eOutlineLevelAttrName(eLevelAttrName)
+, pOutlineLevelStylePropMap(pLevelStylePropMap)
+, pAllowedTokenTypesMap(pAllowedTokenTypes)
+, nOutlineLevel(1) // all indices have level 1 (0 is for header)
+, bStyleNameOK(sal_False)
+, bOutlineLevelOK(sal_False)
+, bTOC( bT )
+, rPropertySet(rPropSet)
+, sTokenEntryNumber(RTL_CONSTASCII_USTRINGPARAM(sAPI_TokenEntryNumber))
+, sTokenEntryText(RTL_CONSTASCII_USTRINGPARAM(sAPI_TokenEntryText))
+, sTokenTabStop(RTL_CONSTASCII_USTRINGPARAM(sAPI_TokenTabStop))
+, sTokenText(RTL_CONSTASCII_USTRINGPARAM(sAPI_TokenText))
+, sTokenPageNumber(RTL_CONSTASCII_USTRINGPARAM(sAPI_TokenPageNumber))
+, sTokenChapterInfo(RTL_CONSTASCII_USTRINGPARAM(sAPI_TokenChapterInfo))
+, sTokenHyperlinkStart(RTL_CONSTASCII_USTRINGPARAM(sAPI_TokenHyperlinkStart))
+, sTokenHyperlinkEnd(RTL_CONSTASCII_USTRINGPARAM(sAPI_TokenHyperlinkEnd))
+, sTokenBibliographyDataField(RTL_CONSTASCII_USTRINGPARAM(sAPI_TokenBibliographyDataField))
+
+, sCharacterStyleName(RTL_CONSTASCII_USTRINGPARAM("CharacterStyleName"))
+, sTokenType(RTL_CONSTASCII_USTRINGPARAM("TokenType"))
+, sText(RTL_CONSTASCII_USTRINGPARAM("Text"))
+, sTabStopRightAligned(RTL_CONSTASCII_USTRINGPARAM("TabStopRightAligned"))
+, sTabStopPosition(RTL_CONSTASCII_USTRINGPARAM("TabStopPosition"))
+, sTabStopFillCharacter(RTL_CONSTASCII_USTRINGPARAM("TabStopFillCharacter"))
+, sBibliographyDataField(RTL_CONSTASCII_USTRINGPARAM("BibliographyDataField"))
+, sChapterFormat(RTL_CONSTASCII_USTRINGPARAM("ChapterFormat"))
+, sChapterLevel(RTL_CONSTASCII_USTRINGPARAM("ChapterLevel")) //#i53420
+
+, sLevelFormat(RTL_CONSTASCII_USTRINGPARAM("LevelFormat"))
+, sParaStyleLevel(RTL_CONSTASCII_USTRINGPARAM("ParaStyleLevel"))
+{
+ DBG_ASSERT( ((XML_TOKEN_INVALID != eLevelAttrName) && (NULL != pLevelNameMap))
+ || ((XML_TOKEN_INVALID == eLevelAttrName) && (NULL == pLevelNameMap)),
+ "need both, attribute name and value map, or neither" );
+ DBG_ASSERT( NULL != pOutlineLevelStylePropMap, "need property name map" );
+ DBG_ASSERT( NULL != pAllowedTokenTypes, "need allowed tokens map" );
+
+ // no map for outline-level? then use 1
+ if (NULL == pLevelNameMap)
+ {
+ nOutlineLevel = 1;
+ bOutlineLevelOK = sal_True;
+ }
+}
+
+XMLIndexTemplateContext::~XMLIndexTemplateContext()
+{
+}
+
+
+void XMLIndexTemplateContext::addTemplateEntry(
+ const PropertyValues& aValues)
+{
+ aValueVector.push_back(aValues);
+}
+
+
+void XMLIndexTemplateContext::StartElement(
+ const Reference<XAttributeList> & xAttrList)
+{
+ // process two attributes: style-name, outline-level
+ sal_Int16 nLength = xAttrList->getLength();
+ for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++)
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
+ &sLocalName );
+ if (XML_NAMESPACE_TEXT == nPrefix)
+ {
+ if ( IsXMLToken( sLocalName, XML_STYLE_NAME ) )
+ {
+ // style name
+ sStyleName = xAttrList->getValueByIndex(nAttr);
+ bStyleNameOK = sal_True;
+ }
+ else if (eOutlineLevelAttrName != XML_TOKEN_INVALID)
+ {
+ // we have an attr name! Then see if we have the attr, too.
+ if (IsXMLToken(sLocalName, eOutlineLevelAttrName))
+ {
+ // outline level
+ sal_uInt16 nTmp;
+ if (SvXMLUnitConverter::convertEnum(
+ nTmp, xAttrList->getValueByIndex(nAttr),
+ pOutlineLevelNameMap))
+ {
+ nOutlineLevel = nTmp;
+ bOutlineLevelOK = sal_True;
+ }
+ // else: illegal value -> ignore
+ }
+ // else: unknown attribute -> ignore
+ }
+ // else: we don't care about outline-level -> ignore
+ }
+ // else: attribute not in text namespace -> ignore
+ }
+}
+
+void XMLIndexTemplateContext::EndElement()
+{
+ if (bOutlineLevelOK)
+ {
+ const sal_Int32 nCount = aValueVector.size();
+ Sequence<PropertyValues> aValueSequence(nCount);
+ for(sal_Int32 i = 0; i<nCount; i++)
+ {
+ aValueSequence[i] = aValueVector[i];
+ }
+
+ // get LevelFormat IndexReplace ...
+ Any aAny = rPropertySet->getPropertyValue(sLevelFormat);
+ Reference<XIndexReplace> xIndexReplace;
+ aAny >>= xIndexReplace;
+
+ // ... and insert
+ aAny <<= aValueSequence;
+ xIndexReplace->replaceByIndex(nOutlineLevel, aAny);
+
+ if (bStyleNameOK)
+ {
+ const sal_Char* pStyleProperty =
+ pOutlineLevelStylePropMap[nOutlineLevel];
+
+ DBG_ASSERT(NULL != pStyleProperty, "need property name");
+ if (NULL != pStyleProperty)
+ {
+ OUString sDisplayStyleName =
+ GetImport().GetStyleDisplayName(
+ XML_STYLE_FAMILY_TEXT_PARAGRAPH,
+ sStyleName );
+ // #i50288#: Check if style exists
+ const Reference < ::com::sun::star::container::XNameContainer > & rStyles =
+ GetImport().GetTextImport()->GetParaStyles();
+ if( rStyles.is() &&
+ rStyles->hasByName( sDisplayStyleName ) )
+ {
+ aAny <<= sDisplayStyleName;
+ rPropertySet->setPropertyValue(
+ OUString::createFromAscii(pStyleProperty), aAny);
+ }
+ }
+ }
+ }
+}
+
+
+
+/// template token types; used for aTokenTypeMap parameter
+enum TemplateTokenType
+{
+ XML_TOK_INDEX_TYPE_ENTRY_TEXT = 0,
+ XML_TOK_INDEX_TYPE_TAB_STOP,
+ XML_TOK_INDEX_TYPE_TEXT,
+ XML_TOK_INDEX_TYPE_PAGE_NUMBER,
+ XML_TOK_INDEX_TYPE_CHAPTER,
+ XML_TOK_INDEX_TYPE_LINK_START,
+ XML_TOK_INDEX_TYPE_LINK_END,
+ XML_TOK_INDEX_TYPE_BIBLIOGRAPHY
+};
+
+
+SvXMLEnumMapEntry aTemplateTokenTypeMap[] =
+{
+ { XML_INDEX_ENTRY_TEXT, XML_TOK_INDEX_TYPE_ENTRY_TEXT },
+ { XML_INDEX_ENTRY_TAB_STOP, XML_TOK_INDEX_TYPE_TAB_STOP },
+ { XML_INDEX_ENTRY_SPAN, XML_TOK_INDEX_TYPE_TEXT },
+ { XML_INDEX_ENTRY_PAGE_NUMBER, XML_TOK_INDEX_TYPE_PAGE_NUMBER },
+ { XML_INDEX_ENTRY_CHAPTER, XML_TOK_INDEX_TYPE_CHAPTER },
+ { XML_INDEX_ENTRY_LINK_START, XML_TOK_INDEX_TYPE_LINK_START },
+ { XML_INDEX_ENTRY_LINK_END, XML_TOK_INDEX_TYPE_LINK_END },
+ { XML_INDEX_ENTRY_BIBLIOGRAPHY, XML_TOK_INDEX_TYPE_BIBLIOGRAPHY },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLImportContext *XMLIndexTemplateContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList )
+{
+ SvXMLImportContext* pContext = NULL;
+
+ if (XML_NAMESPACE_TEXT == nPrefix)
+ {
+ sal_uInt16 nToken;
+ if (SvXMLUnitConverter::convertEnum(nToken, rLocalName,
+ aTemplateTokenTypeMap))
+ {
+ // can this index accept this kind of token?
+ if (pAllowedTokenTypesMap[nToken])
+ {
+ switch ((TemplateTokenType)nToken)
+ {
+ case XML_TOK_INDEX_TYPE_ENTRY_TEXT:
+ pContext = new XMLIndexSimpleEntryContext(
+ GetImport(), sTokenEntryText, *this,
+ nPrefix, rLocalName);
+ break;
+
+ case XML_TOK_INDEX_TYPE_PAGE_NUMBER:
+ pContext = new XMLIndexSimpleEntryContext(
+ GetImport(), sTokenPageNumber, *this,
+ nPrefix, rLocalName);
+ break;
+
+ case XML_TOK_INDEX_TYPE_LINK_START:
+ pContext = new XMLIndexSimpleEntryContext(
+ GetImport(), sTokenHyperlinkStart, *this,
+ nPrefix, rLocalName);
+ break;
+
+ case XML_TOK_INDEX_TYPE_LINK_END:
+ pContext = new XMLIndexSimpleEntryContext(
+ GetImport(), sTokenHyperlinkEnd, *this,
+ nPrefix, rLocalName);
+ break;
+
+ case XML_TOK_INDEX_TYPE_TEXT:
+ pContext = new XMLIndexSpanEntryContext(
+ GetImport(), *this, nPrefix, rLocalName);
+ break;
+
+ case XML_TOK_INDEX_TYPE_TAB_STOP:
+ pContext = new XMLIndexTabStopEntryContext(
+ GetImport(), *this, nPrefix, rLocalName);
+ break;
+
+ case XML_TOK_INDEX_TYPE_BIBLIOGRAPHY:
+ pContext = new XMLIndexBibliographyEntryContext(
+ GetImport(), *this, nPrefix, rLocalName);
+ break;
+
+ case XML_TOK_INDEX_TYPE_CHAPTER:
+ pContext = new XMLIndexChapterInfoEntryContext(
+ GetImport(), *this, nPrefix, rLocalName, bTOC );
+ break;
+
+ default:
+ // ignore!
+ break;
+ }
+ }
+ }
+ }
+
+ // ignore unknown
+ if (NULL == pContext)
+ {
+ return SvXMLImportContext::CreateChildContext(nPrefix, rLocalName,
+ xAttrList);
+ }
+
+ return pContext;
+}
+
+
+
+//
+// maps for the XMLIndexTemplateContext constructor
+//
+
+
+// table of content and user defined index:
+
+const SvXMLEnumMapEntry aLevelNameTOCMap[] =
+{
+ { XML_1, 1 },
+ { XML_2, 2 },
+ { XML_3, 3 },
+ { XML_4, 4 },
+ { XML_5, 5 },
+ { XML_6, 6 },
+ { XML_7, 7 },
+ { XML_8, 8 },
+ { XML_9, 9 },
+ { XML_10, 10 },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+const sal_Char* aLevelStylePropNameTOCMap[] =
+ { NULL, "ParaStyleLevel1", "ParaStyleLevel2", "ParaStyleLevel3",
+ "ParaStyleLevel4", "ParaStyleLevel5", "ParaStyleLevel6",
+ "ParaStyleLevel7", "ParaStyleLevel8", "ParaStyleLevel9",
+ "ParaStyleLevel10", NULL };
+
+const sal_Bool aAllowedTokenTypesTOC[] =
+{
+ sal_True, // XML_TOK_INDEX_TYPE_ENTRY_TEXT =
+ sal_True, // XML_TOK_INDEX_TYPE_TAB_STOP,
+ sal_True, // XML_TOK_INDEX_TYPE_TEXT,
+ sal_True, // XML_TOK_INDEX_TYPE_PAGE_NUMBER,
+ sal_True, // XML_TOK_INDEX_TYPE_CHAPTER,
+ sal_True, // XML_TOK_INDEX_TYPE_LINK_START,
+ sal_True, // XML_TOK_INDEX_TYPE_LINK_END,
+ sal_False // XML_TOK_INDEX_TYPE_BIBLIOGRAPHY
+};
+
+const sal_Bool aAllowedTokenTypesUser[] =
+{
+ sal_True, // XML_TOK_INDEX_TYPE_ENTRY_TEXT =
+ sal_True, // XML_TOK_INDEX_TYPE_TAB_STOP,
+ sal_True, // XML_TOK_INDEX_TYPE_TEXT,
+ sal_True, // XML_TOK_INDEX_TYPE_PAGE_NUMBER,
+ sal_True, // XML_TOK_INDEX_TYPE_CHAPTER,
+ sal_False, // XML_TOK_INDEX_TYPE_LINK_START,
+ sal_False, // XML_TOK_INDEX_TYPE_LINK_END,
+ sal_False // XML_TOK_INDEX_TYPE_BIBLIOGRAPHY
+};
+
+
+// alphabetical index
+
+const SvXMLEnumMapEntry aLevelNameAlphaMap[] =
+{
+ { XML_SEPARATOR, 1 },
+ { XML_1, 2 },
+ { XML_2, 3 },
+ { XML_3, 4 },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+const sal_Char* aLevelStylePropNameAlphaMap[] =
+ { NULL, "ParaStyleSeparator", "ParaStyleLevel1", "ParaStyleLevel2",
+ "ParaStyleLevel3", NULL };
+
+const sal_Bool aAllowedTokenTypesAlpha[] =
+{
+ sal_True, // XML_TOK_INDEX_TYPE_ENTRY_TEXT =
+ sal_True, // XML_TOK_INDEX_TYPE_TAB_STOP,
+ sal_True, // XML_TOK_INDEX_TYPE_TEXT,
+ sal_True, // XML_TOK_INDEX_TYPE_PAGE_NUMBER,
+ sal_True, // XML_TOK_INDEX_TYPE_CHAPTER,
+ sal_False, // XML_TOK_INDEX_TYPE_LINK_START,
+ sal_False, // XML_TOK_INDEX_TYPE_LINK_END,
+ sal_False // XML_TOK_INDEX_TYPE_BIBLIOGRAPHY
+};
+
+
+// bibliography index:
+
+const SvXMLEnumMapEntry aLevelNameBibliographyMap[] =
+{
+ { XML_ARTICLE, 1 },
+ { XML_BOOK, 2 },
+ { XML_BOOKLET, 3 },
+ { XML_CONFERENCE, 4 },
+ { XML_CUSTOM1, 5 },
+ { XML_CUSTOM2, 6 },
+ { XML_CUSTOM3, 7 },
+ { XML_CUSTOM4, 8 },
+ { XML_CUSTOM5, 9 },
+ { XML_EMAIL, 10 },
+ { XML_INBOOK, 11 },
+ { XML_INCOLLECTION, 12 },
+ { XML_INPROCEEDINGS, 13 },
+ { XML_JOURNAL, 14 },
+ { XML_MANUAL, 15 },
+ { XML_MASTERSTHESIS, 16 },
+ { XML_MISC, 17 },
+ { XML_PHDTHESIS, 18 },
+ { XML_PROCEEDINGS, 19 },
+ { XML_TECHREPORT, 20 },
+ { XML_UNPUBLISHED, 21 },
+ { XML_WWW, 22 },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+// TODO: replace with real property names, when available
+const sal_Char* aLevelStylePropNameBibliographyMap[] =
+{
+ NULL, "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1",
+ "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1",
+ "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1",
+ "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1",
+ "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1",
+ "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1",
+ "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1",
+ "ParaStyleLevel1", NULL };
+
+const sal_Bool aAllowedTokenTypesBibliography[] =
+{
+ sal_True, // XML_TOK_INDEX_TYPE_ENTRY_TEXT =
+ sal_True, // XML_TOK_INDEX_TYPE_TAB_STOP,
+ sal_True, // XML_TOK_INDEX_TYPE_TEXT,
+ sal_True, // XML_TOK_INDEX_TYPE_PAGE_NUMBER,
+ sal_False, // XML_TOK_INDEX_TYPE_CHAPTER,
+ sal_False, // XML_TOK_INDEX_TYPE_LINK_START,
+ sal_False, // XML_TOK_INDEX_TYPE_LINK_END,
+ sal_True // XML_TOK_INDEX_TYPE_BIBLIOGRAPHY
+};
+
+
+// table, illustration and object index
+
+// no name map
+const SvXMLEnumMapEntry* aLevelNameTableMap = NULL;
+
+const sal_Char* aLevelStylePropNameTableMap[] =
+ { NULL, "ParaStyleLevel1", NULL };
+
+const sal_Bool aAllowedTokenTypesTable[] =
+{
+ sal_True, // XML_TOK_INDEX_TYPE_ENTRY_TEXT =
+ sal_True, // XML_TOK_INDEX_TYPE_TAB_STOP,
+ sal_True, // XML_TOK_INDEX_TYPE_TEXT,
+ sal_True, // XML_TOK_INDEX_TYPE_PAGE_NUMBER,
+ sal_True, // XML_TOK_INDEX_TYPE_CHAPTER,
+ sal_False, // XML_TOK_INDEX_TYPE_LINK_START,
+ sal_False, // XML_TOK_INDEX_TYPE_LINK_END,
+ sal_False // XML_TOK_INDEX_TYPE_BIBLIOGRAPHY
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexTemplateContext.hxx b/xmloff/source/text/XMLIndexTemplateContext.hxx
new file mode 100644
index 000000000000..7f496838f9a1
--- /dev/null
+++ b/xmloff/source/text/XMLIndexTemplateContext.hxx
@@ -0,0 +1,162 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLINDEXTEMPLATECONTEXT_HXX_
+#define _XMLOFF_XMLINDEXTEMPLATECONTEXT_HXX_
+
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/xmltoken.hxx>
+
+#include <vector>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/beans/PropertyValues.hpp>
+
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+ namespace beans { class XPropertySet; }
+} } }
+namespace rtl { class OUString; }
+struct SvXMLEnumMapEntry;
+
+
+// constants for the XMLIndexTemplateContext constructor
+
+// TOC and user defined index:
+extern const SvXMLEnumMapEntry aLevelNameTOCMap[];
+extern const sal_Char* aLevelStylePropNameTOCMap[];
+extern const sal_Bool aAllowedTokenTypesTOC[];
+extern const sal_Bool aAllowedTokenTypesUser[];
+
+// alphabetical index:
+extern const SvXMLEnumMapEntry aLevelNameAlphaMap[];
+extern const sal_Char* aLevelStylePropNameAlphaMap[];
+extern const sal_Bool aAllowedTokenTypesAlpha[];
+
+// bibliography:
+extern const SvXMLEnumMapEntry aLevelNameBibliographyMap[];
+extern const sal_Char* aLevelStylePropNameBibliographyMap[];
+extern const sal_Bool aAllowedTokenTypesBibliography[];
+
+// table, illustration and object tables:
+extern const SvXMLEnumMapEntry* aLevelNameTableMap; // NULL: no outline-level
+extern const sal_Char* aLevelStylePropNameTableMap[];
+extern const sal_Bool aAllowedTokenTypesTable[];
+
+
+/**
+ * Import index entry templates
+ */
+class XMLIndexTemplateContext : public SvXMLImportContext
+{
+ // pick up PropertyValues to be turned into a sequence.
+ ::std::vector< ::com::sun::star::beans::PropertyValues > aValueVector;
+
+ ::rtl::OUString sStyleName;
+
+ const SvXMLEnumMapEntry* pOutlineLevelNameMap;
+ enum ::xmloff::token::XMLTokenEnum eOutlineLevelAttrName;
+ const sal_Char** pOutlineLevelStylePropMap;
+ const sal_Bool* pAllowedTokenTypesMap;
+
+ sal_Int32 nOutlineLevel;
+ sal_Bool bStyleNameOK;
+ sal_Bool bOutlineLevelOK;
+ sal_Bool bTOC;
+
+ // PropertySet of current index
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropertySet;
+
+public:
+
+ // constants made available to other contexts (template entry
+ // contexts, in particular)
+ const ::rtl::OUString sTokenEntryNumber;
+ const ::rtl::OUString sTokenEntryText;
+ const ::rtl::OUString sTokenTabStop;
+ const ::rtl::OUString sTokenText;
+ const ::rtl::OUString sTokenPageNumber;
+ const ::rtl::OUString sTokenChapterInfo;
+ const ::rtl::OUString sTokenHyperlinkStart;
+ const ::rtl::OUString sTokenHyperlinkEnd;
+ const ::rtl::OUString sTokenBibliographyDataField;
+
+ const ::rtl::OUString sCharacterStyleName;
+ const ::rtl::OUString sTokenType;
+ const ::rtl::OUString sText;
+ const ::rtl::OUString sTabStopRightAligned;
+ const ::rtl::OUString sTabStopPosition;
+ const ::rtl::OUString sTabStopFillCharacter;
+ const ::rtl::OUString sBibliographyDataField;
+ const ::rtl::OUString sChapterFormat;
+ const ::rtl::OUString sChapterLevel;//i53420
+
+ const ::rtl::OUString sLevelFormat;
+ const ::rtl::OUString sParaStyleLevel;
+
+
+ TYPEINFO();
+
+ XMLIndexTemplateContext(
+ SvXMLImport& rImport,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName,
+ const SvXMLEnumMapEntry* aLevelNameMap,
+ enum ::xmloff::token::XMLTokenEnum eLevelAttrName,
+ const sal_Char** aLevelStylePropNameMap,
+ const sal_Bool* aAllowedTokenTypes,
+ sal_Bool bTOC=sal_False);
+
+ ~XMLIndexTemplateContext();
+
+ /** add template; to be called by child template entry contexts */
+ void addTemplateEntry(
+ const ::com::sun::star::beans::PropertyValues& aValues);
+
+protected:
+
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+
+ virtual void EndElement();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexTitleTemplateContext.cxx b/xmloff/source/text/XMLIndexTitleTemplateContext.cxx
new file mode 100644
index 000000000000..e713da8a97a3
--- /dev/null
+++ b/xmloff/source/text/XMLIndexTitleTemplateContext.cxx
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLIndexTitleTemplateContext.hxx"
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::xml::sax::XAttributeList;
+using ::xmloff::token::IsXMLToken;
+using ::xmloff::token::XML_STYLE_NAME;
+
+
+const sal_Char sAPI_Title[] = "Title";
+const sal_Char sAPI_ParaStyleHeading[] = "ParaStyleHeading";
+
+
+TYPEINIT1( XMLIndexTitleTemplateContext, SvXMLImportContext );
+
+XMLIndexTitleTemplateContext::XMLIndexTitleTemplateContext(
+ SvXMLImport& rImport,
+ Reference<XPropertySet> & rPropSet,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName)
+: SvXMLImportContext(rImport, nPrfx, rLocalName)
+, sTitle(RTL_CONSTASCII_USTRINGPARAM(sAPI_Title))
+, sParaStyleHeading(RTL_CONSTASCII_USTRINGPARAM(sAPI_ParaStyleHeading))
+, bStyleNameOK(sal_False)
+, rTOCPropertySet(rPropSet)
+{
+}
+
+
+XMLIndexTitleTemplateContext::~XMLIndexTitleTemplateContext()
+{
+}
+
+void XMLIndexTitleTemplateContext::StartElement(
+ const Reference<XAttributeList> & xAttrList)
+{
+ // there's only one attribute: style-name
+ sal_Int16 nLength = xAttrList->getLength();
+ for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++)
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
+ &sLocalName );
+ if ( (XML_NAMESPACE_TEXT == nPrefix) &&
+ (IsXMLToken(sLocalName, XML_STYLE_NAME)) )
+ {
+ sStyleName = xAttrList->getValueByIndex(nAttr);
+ OUString sDisplayStyleName = GetImport().GetStyleDisplayName(
+ XML_STYLE_FAMILY_TEXT_PARAGRAPH, sStyleName );
+ const Reference < ::com::sun::star::container::XNameContainer >&
+ rStyles = GetImport().GetTextImport()->GetParaStyles();
+ bStyleNameOK = rStyles.is() && rStyles->hasByName( sDisplayStyleName );
+ }
+ }
+}
+
+void XMLIndexTitleTemplateContext::EndElement()
+{
+ Any aAny;
+
+ aAny <<= sContent.makeStringAndClear();
+ rTOCPropertySet->setPropertyValue(sTitle, aAny);
+
+ if (bStyleNameOK)
+ {
+ aAny <<= GetImport().GetStyleDisplayName(
+ XML_STYLE_FAMILY_TEXT_PARAGRAPH,
+ sStyleName );
+ rTOCPropertySet->setPropertyValue(sParaStyleHeading, aAny);
+ }
+}
+
+void XMLIndexTitleTemplateContext::Characters(
+ const OUString& sString)
+{
+ sContent.append(sString);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexTitleTemplateContext.hxx b/xmloff/source/text/XMLIndexTitleTemplateContext.hxx
new file mode 100644
index 000000000000..a8a1713520b9
--- /dev/null
+++ b/xmloff/source/text/XMLIndexTitleTemplateContext.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLINDEXTITLETEMPLATECONTEXT_HXX_
+#define _XMLOFF_XMLINDEXTITLETEMPLATECONTEXT_HXX_
+
+#include <xmloff/xmlictxt.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+
+
+namespace com { namespace sun { namespace star {
+ namespace beans { class XPropertySet; }
+ namespace xml { namespace sax { class XAttributeList; } }
+} } }
+
+
+/**
+ * Import index title templates
+ */
+class XMLIndexTitleTemplateContext : public SvXMLImportContext
+{
+
+ const ::rtl::OUString sTitle;
+ const ::rtl::OUString sParaStyleHeading;
+
+ // paragraph style
+ ::rtl::OUString sStyleName;
+ sal_Bool bStyleNameOK;
+
+ // content
+ ::rtl::OUStringBuffer sContent;
+
+ // TOC property set
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rTOCPropertySet;
+
+public:
+
+ TYPEINFO();
+
+ XMLIndexTitleTemplateContext(
+ SvXMLImport& rImport,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName);
+
+ ~XMLIndexTitleTemplateContext();
+
+protected:
+
+ /** process parameters */
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+
+ /** set values */
+ virtual void EndElement();
+
+ /** pick up title characters */
+ virtual void Characters(const ::rtl::OUString& sString);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexUserSourceContext.cxx b/xmloff/source/text/XMLIndexUserSourceContext.cxx
new file mode 100644
index 000000000000..fd5be90bb89f
--- /dev/null
+++ b/xmloff/source/text/XMLIndexUserSourceContext.cxx
@@ -0,0 +1,234 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+#include "XMLIndexUserSourceContext.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XIndexReplace.hpp>
+#include "XMLIndexTemplateContext.hxx"
+#include "XMLIndexTitleTemplateContext.hxx"
+#include "XMLIndexTOCStylesContext.hxx"
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/txtimp.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <tools/debug.hxx>
+#include <rtl/ustring.hxx>
+
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::xml::sax::XAttributeList;
+using ::xmloff::token::IsXMLToken;
+using ::xmloff::token::XML_USER_INDEX_ENTRY_TEMPLATE;
+using ::xmloff::token::XML_OUTLINE_LEVEL;
+
+
+const sal_Char sAPI_CreateFromEmbeddedObjects[] = "CreateFromEmbeddedObjects";
+const sal_Char sAPI_CreateFromGraphicObjects[] = "CreateFromGraphicObjects";
+const sal_Char sAPI_CreateFromMarks[] = "CreateFromMarks";
+const sal_Char sAPI_CreateFromTables[] = "CreateFromTables";
+const sal_Char sAPI_CreateFromTextFrames[] = "CreateFromTextFrames";
+const sal_Char sAPI_UseLevelFromSource[] = "UseLevelFromSource";
+const sal_Char sAPI_CreateFromLevelParagraphStyles[] = "CreateFromLevelParagraphStyles";
+const sal_Char sAPI_UserIndexName[] = "UserIndexName";
+
+
+TYPEINIT1(XMLIndexUserSourceContext, XMLIndexSourceBaseContext);
+
+
+XMLIndexUserSourceContext::XMLIndexUserSourceContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ Reference<XPropertySet> & rPropSet) :
+ XMLIndexSourceBaseContext(rImport, nPrfx, rLocalName,
+ rPropSet, sal_True),
+ sCreateFromEmbeddedObjects(RTL_CONSTASCII_USTRINGPARAM(
+ sAPI_CreateFromEmbeddedObjects)),
+ sCreateFromGraphicObjects(RTL_CONSTASCII_USTRINGPARAM(
+ sAPI_CreateFromGraphicObjects)),
+ sCreateFromMarks(RTL_CONSTASCII_USTRINGPARAM(sAPI_CreateFromMarks)),
+ sCreateFromTables(RTL_CONSTASCII_USTRINGPARAM(sAPI_CreateFromTables)),
+ sCreateFromTextFrames(RTL_CONSTASCII_USTRINGPARAM(
+ sAPI_CreateFromTextFrames)),
+ sUseLevelFromSource(RTL_CONSTASCII_USTRINGPARAM(
+ sAPI_UseLevelFromSource)),
+ sCreateFromLevelParagraphStyles(RTL_CONSTASCII_USTRINGPARAM(
+ sAPI_CreateFromLevelParagraphStyles)),
+ sUserIndexName(RTL_CONSTASCII_USTRINGPARAM(sAPI_UserIndexName)),
+ bUseObjects(sal_False),
+ bUseGraphic(sal_False),
+ bUseMarks(sal_False),
+ bUseTables(sal_False),
+ bUseFrames(sal_False),
+ bUseLevelFromSource(sal_False),
+ bUseLevelParagraphStyles(sal_False)
+{
+}
+
+XMLIndexUserSourceContext::~XMLIndexUserSourceContext()
+{
+}
+
+void XMLIndexUserSourceContext::ProcessAttribute(
+ enum IndexSourceParamEnum eParam,
+ const OUString& rValue)
+{
+ bool bTmp;
+
+ switch (eParam)
+ {
+ case XML_TOK_INDEXSOURCE_USE_INDEX_MARKS:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bUseMarks = bTmp;
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_USE_OBJECTS:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bUseObjects = bTmp;
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_USE_GRAPHICS:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bUseGraphic = bTmp;
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_USE_TABLES:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bUseTables = bTmp;
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_USE_FRAMES:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bUseFrames = bTmp;
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_COPY_OUTLINE_LEVELS:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bUseLevelFromSource = bTmp;
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_USE_INDEX_SOURCE_STYLES:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bUseLevelParagraphStyles = bTmp;
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_USER_INDEX_NAME:
+ sIndexName = rValue;
+ break;
+
+ default:
+ XMLIndexSourceBaseContext::ProcessAttribute(eParam, rValue);
+ break;
+ }
+}
+
+
+void XMLIndexUserSourceContext::EndElement()
+{
+ Any aAny;
+
+ aAny.setValue(&bUseObjects, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sCreateFromEmbeddedObjects, aAny);
+
+ aAny.setValue(&bUseGraphic, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sCreateFromGraphicObjects, aAny);
+
+ aAny.setValue(&bUseLevelFromSource, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sUseLevelFromSource, aAny);
+
+ aAny.setValue(&bUseMarks, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sCreateFromMarks, aAny);
+
+ aAny.setValue(&bUseTables, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sCreateFromTables, aAny);
+
+ aAny.setValue(&bUseFrames, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sCreateFromTextFrames, aAny);
+
+ aAny.setValue(&bUseLevelParagraphStyles, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sCreateFromLevelParagraphStyles, aAny);
+
+ if( sIndexName.getLength() > 0 )
+ {
+ aAny <<= sIndexName;
+ rIndexPropertySet->setPropertyValue(sUserIndexName, aAny);
+ }
+
+ XMLIndexSourceBaseContext::EndElement();
+}
+
+
+SvXMLImportContext* XMLIndexUserSourceContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList )
+{
+ if ( (XML_NAMESPACE_TEXT == nPrefix) &&
+ (IsXMLToken(rLocalName, XML_USER_INDEX_ENTRY_TEMPLATE)) )
+ {
+ return new XMLIndexTemplateContext(GetImport(), rIndexPropertySet,
+ nPrefix, rLocalName,
+ aLevelNameTOCMap,
+ XML_OUTLINE_LEVEL,
+ aLevelStylePropNameTOCMap,
+ aAllowedTokenTypesUser);
+ }
+ else
+ {
+ return XMLIndexSourceBaseContext::CreateChildContext(nPrefix,
+ rLocalName,
+ xAttrList);
+ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLIndexUserSourceContext.hxx b/xmloff/source/text/XMLIndexUserSourceContext.hxx
new file mode 100644
index 000000000000..003a4103654d
--- /dev/null
+++ b/xmloff/source/text/XMLIndexUserSourceContext.hxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLINDEXUSERSOURCECONTEXT_HXX_
+#define _XMLOFF_XMLINDEXUSERSOURCECONTEXT_HXX_
+
+#include "XMLIndexSourceBaseContext.hxx"
+#include <com/sun/star/uno/Reference.h>
+
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+ namespace beans { class XPropertySet; }
+} } }
+namespace rtl { class OUString; }
+
+
+/**
+ * Import user defined index source element
+ */
+class XMLIndexUserSourceContext : public XMLIndexSourceBaseContext
+{
+ const ::rtl::OUString sCreateFromEmbeddedObjects;
+ const ::rtl::OUString sCreateFromGraphicObjects;
+ const ::rtl::OUString sCreateFromMarks;
+ const ::rtl::OUString sCreateFromTables;
+ const ::rtl::OUString sCreateFromTextFrames;
+ const ::rtl::OUString sUseLevelFromSource;
+ const ::rtl::OUString sCreateFromLevelParagraphStyles;
+ const ::rtl::OUString sUserIndexName;
+
+ sal_Bool bUseObjects;
+ sal_Bool bUseGraphic;
+ sal_Bool bUseMarks;
+ sal_Bool bUseTables;
+ sal_Bool bUseFrames;
+ sal_Bool bUseLevelFromSource;
+ sal_Bool bUseLevelParagraphStyles;
+ ::rtl::OUString sIndexName;
+
+public:
+
+ TYPEINFO();
+
+ XMLIndexUserSourceContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet);
+
+ ~XMLIndexUserSourceContext();
+
+protected:
+
+ virtual void ProcessAttribute(
+ enum IndexSourceParamEnum eParam,
+ const ::rtl::OUString& rValue);
+
+ virtual void EndElement();
+
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLLineNumberingExport.cxx b/xmloff/source/text/XMLLineNumberingExport.cxx
new file mode 100644
index 000000000000..021314e36599
--- /dev/null
+++ b/xmloff/source/text/XMLLineNumberingExport.cxx
@@ -0,0 +1,215 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLLineNumberingExport.hxx"
+#include "com/sun/star/beans/XPropertySet.hpp"
+#include "com/sun/star/text/XLineNumberingProperties.hpp"
+#include <com/sun/star/style/LineNumberPosition.hpp>
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlnume.hxx>
+
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::text::XLineNumberingProperties;
+
+
+XMLLineNumberingExport::XMLLineNumberingExport(SvXMLExport& rExp)
+: sCharStyleName(RTL_CONSTASCII_USTRINGPARAM("CharStyleName"))
+, sCountEmptyLines(RTL_CONSTASCII_USTRINGPARAM("CountEmptyLines"))
+, sCountLinesInFrames(RTL_CONSTASCII_USTRINGPARAM("CountLinesInFrames"))
+, sDistance(RTL_CONSTASCII_USTRINGPARAM("Distance"))
+, sInterval(RTL_CONSTASCII_USTRINGPARAM("Interval"))
+, sSeparatorText(RTL_CONSTASCII_USTRINGPARAM("SeparatorText"))
+, sNumberPosition(RTL_CONSTASCII_USTRINGPARAM("NumberPosition"))
+, sNumberingType(RTL_CONSTASCII_USTRINGPARAM("NumberingType"))
+, sIsOn(RTL_CONSTASCII_USTRINGPARAM("IsOn"))
+, sRestartAtEachPage(RTL_CONSTASCII_USTRINGPARAM("RestartAtEachPage"))
+, sSeparatorInterval(RTL_CONSTASCII_USTRINGPARAM("SeparatorInterval"))
+, rExport(rExp)
+{
+}
+
+SvXMLEnumMapEntry const aLineNumberPositionMap[] =
+{
+ { XML_LEFT, style::LineNumberPosition::LEFT },
+ { XML_RIGHT, style::LineNumberPosition::RIGHT },
+ { XML_INSIDE, style::LineNumberPosition::INSIDE },
+ { XML_OUTSIDE, style::LineNumberPosition::OUTSIDE },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+
+
+void XMLLineNumberingExport::Export()
+{
+ // export element if we have line numbering info
+ Reference<XLineNumberingProperties> xSupplier(rExport.GetModel(),
+ UNO_QUERY);
+ if (xSupplier.is())
+ {
+ Reference<XPropertySet> xLineNumbering =
+ xSupplier->getLineNumberingProperties();
+
+ if (xLineNumbering.is())
+ {
+ Any aAny;
+
+ // char style
+ aAny = xLineNumbering->getPropertyValue(sCharStyleName);
+ OUString sTmp;
+ aAny >>= sTmp;
+ if (sTmp.getLength() > 0)
+ {
+ rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_STYLE_NAME,
+ rExport.EncodeStyleName( sTmp ));
+ }
+
+ // enable
+ aAny = xLineNumbering->getPropertyValue(sIsOn);
+ if (! *(sal_Bool*)aAny.getValue())
+ {
+ rExport.AddAttribute(XML_NAMESPACE_TEXT,
+ XML_NUMBER_LINES, XML_FALSE);
+ }
+
+ // count empty lines
+ aAny = xLineNumbering->getPropertyValue(sCountEmptyLines);
+ if (! *(sal_Bool*)aAny.getValue())
+ {
+ rExport.AddAttribute(XML_NAMESPACE_TEXT,
+ XML_COUNT_EMPTY_LINES, XML_FALSE);
+ }
+
+ // count in frames
+ aAny = xLineNumbering->getPropertyValue(sCountLinesInFrames);
+ if (*(sal_Bool*)aAny.getValue())
+ {
+ rExport.AddAttribute(XML_NAMESPACE_TEXT,
+ XML_COUNT_IN_TEXT_BOXES, XML_TRUE);
+ }
+
+ // restart numbering
+ aAny = xLineNumbering->getPropertyValue(sRestartAtEachPage);
+ if (*(sal_Bool*)aAny.getValue())
+ {
+ rExport.AddAttribute(XML_NAMESPACE_TEXT,
+ XML_RESTART_ON_PAGE, XML_TRUE);
+ }
+
+ // Distance
+ aAny = xLineNumbering->getPropertyValue(sDistance);
+ sal_Int32 nLength = 0;
+ aAny >>= nLength;
+ if (nLength != 0)
+ {
+ OUStringBuffer sBuf;
+ rExport.GetMM100UnitConverter().convertMeasure(sBuf, nLength);
+ rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_OFFSET,
+ sBuf.makeStringAndClear());
+ }
+
+ // NumeringType
+ OUStringBuffer sNumPosBuf;
+ aAny = xLineNumbering->getPropertyValue(sNumberingType);
+ sal_Int16 nFormat = 0;
+ aAny >>= nFormat;
+ rExport.GetMM100UnitConverter().convertNumFormat( sNumPosBuf, nFormat );
+ rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_NUM_FORMAT,
+ sNumPosBuf.makeStringAndClear());
+ rExport.GetMM100UnitConverter().convertNumLetterSync( sNumPosBuf, nFormat );
+ if( sNumPosBuf.getLength() )
+ {
+ rExport.AddAttribute(XML_NAMESPACE_STYLE,
+ XML_NUM_LETTER_SYNC,
+ sNumPosBuf.makeStringAndClear() );
+ }
+
+ // number position
+ aAny = xLineNumbering->getPropertyValue(sNumberPosition);
+ sal_Int16 nPosition = 0;
+ aAny >>= nPosition;
+ if (SvXMLUnitConverter::convertEnum(sNumPosBuf, nPosition,
+ aLineNumberPositionMap))
+ {
+ rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_NUMBER_POSITION,
+ sNumPosBuf.makeStringAndClear());
+ }
+
+ // sInterval
+ aAny = xLineNumbering->getPropertyValue(sInterval);
+ sal_Int16 nLineInterval = 0;
+ aAny >>= nLineInterval;
+ OUStringBuffer sBuf;
+ SvXMLUnitConverter::convertNumber(sBuf,
+ (sal_Int32)nLineInterval);
+ rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_INCREMENT,
+ sBuf.makeStringAndClear());
+
+ SvXMLElementExport aConfigElem(rExport, XML_NAMESPACE_TEXT,
+ XML_LINENUMBERING_CONFIGURATION,
+ sal_True, sal_True);
+
+ // line separator
+ aAny = xLineNumbering->getPropertyValue(sSeparatorText);
+ OUString sSeparator;
+ aAny >>= sSeparator;
+ if (sSeparator.getLength() > 0)
+ {
+
+ // SeparatorInterval
+ aAny = xLineNumbering->getPropertyValue(sSeparatorInterval);
+ sal_Int16 nLineDistance = 0;
+ aAny >>= nLineDistance;
+ SvXMLUnitConverter::convertNumber(sBuf,
+ (sal_Int32)nLineDistance);
+ rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_INCREMENT,
+ sBuf.makeStringAndClear());
+
+ SvXMLElementExport aSeparatorElem(rExport, XML_NAMESPACE_TEXT,
+ XML_LINENUMBERING_SEPARATOR,
+ sal_True, sal_False);
+ rExport.Characters(sSeparator);
+ }
+ }
+ // else: no configuration: don't save -> default
+ }
+ // can't even get supplier: don't save -> default
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLLineNumberingExport.hxx b/xmloff/source/text/XMLLineNumberingExport.hxx
new file mode 100644
index 000000000000..25725ab67072
--- /dev/null
+++ b/xmloff/source/text/XMLLineNumberingExport.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLLINENUMBERINGEXPORT_HXX_
+#define _XMLOFF_XMLLINENUMBERINGEXPORT_HXX_
+
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Reference.h>
+
+class SvXMLExport;
+
+/** export <text:linenumbering-configuration> and it's child elements */
+class XMLLineNumberingExport
+{
+ const ::rtl::OUString sCharStyleName;
+ const ::rtl::OUString sCountEmptyLines;
+ const ::rtl::OUString sCountLinesInFrames;
+ const ::rtl::OUString sDistance;
+ const ::rtl::OUString sInterval;
+ const ::rtl::OUString sSeparatorText;
+ const ::rtl::OUString sNumberPosition;
+ const ::rtl::OUString sNumberingType;
+ const ::rtl::OUString sIsOn;
+ const ::rtl::OUString sRestartAtEachPage;
+ const ::rtl::OUString sSeparatorInterval;
+
+ SvXMLExport& rExport;
+
+public:
+ XMLLineNumberingExport(SvXMLExport& rExp);
+
+ void Export();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLLineNumberingImportContext.cxx b/xmloff/source/text/XMLLineNumberingImportContext.cxx
new file mode 100644
index 000000000000..c48cb8f58409
--- /dev/null
+++ b/xmloff/source/text/XMLLineNumberingImportContext.cxx
@@ -0,0 +1,324 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLLineNumberingImportContext.hxx"
+#include "XMLLineNumberingSeparatorImportContext.hxx"
+#include "com/sun/star/beans/XPropertySet.hpp"
+#include "com/sun/star/text/XLineNumberingProperties.hpp"
+#include <com/sun/star/style/LineNumberPosition.hpp>
+#include <com/sun/star/style/NumberingType.hpp>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlnumi.hxx>
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::style;
+using namespace ::xmloff::token;
+
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::xml::sax::XAttributeList;
+using ::com::sun::star::text::XLineNumberingProperties;
+using ::rtl::OUString;
+
+TYPEINIT1( XMLLineNumberingImportContext, SvXMLStyleContext );
+
+
+XMLLineNumberingImportContext::XMLLineNumberingImportContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList)
+: SvXMLStyleContext(rImport, nPrfx, rLocalName, xAttrList, XML_STYLE_FAMILY_TEXT_LINENUMBERINGCONFIG)
+, sCharStyleName(RTL_CONSTASCII_USTRINGPARAM("CharStyleName"))
+, sCountEmptyLines(RTL_CONSTASCII_USTRINGPARAM("CountEmptyLines"))
+, sCountLinesInFrames(RTL_CONSTASCII_USTRINGPARAM("CountLinesInFrames"))
+, sDistance(RTL_CONSTASCII_USTRINGPARAM("Distance"))
+, sInterval(RTL_CONSTASCII_USTRINGPARAM("Interval"))
+, sSeparatorText(RTL_CONSTASCII_USTRINGPARAM("SeparatorText"))
+, sNumberPosition(RTL_CONSTASCII_USTRINGPARAM("NumberPosition"))
+, sNumberingType(RTL_CONSTASCII_USTRINGPARAM("NumberingType"))
+, sIsOn(RTL_CONSTASCII_USTRINGPARAM("IsOn"))
+, sRestartAtEachPage(RTL_CONSTASCII_USTRINGPARAM("RestartAtEachPage"))
+, sSeparatorInterval(RTL_CONSTASCII_USTRINGPARAM("SeparatorInterval"))
+, sNumFormat(GetXMLToken(XML_1))
+, sNumLetterSync(GetXMLToken(XML_FALSE))
+, nOffset(-1)
+, nNumberPosition(style::LineNumberPosition::LEFT)
+, nIncrement(-1)
+, nSeparatorIncrement(-1)
+, bNumberLines(sal_True)
+, bCountEmptyLines(sal_True)
+, bCountInFloatingFrames(sal_False)
+, bRestartNumbering(sal_False)
+{
+}
+
+XMLLineNumberingImportContext::~XMLLineNumberingImportContext()
+{
+}
+
+void XMLLineNumberingImportContext::StartElement(
+ const Reference<XAttributeList> & xAttrList)
+{
+ static SvXMLTokenMapEntry aLineNumberingTokenMap[] =
+ {
+ { XML_NAMESPACE_TEXT, XML_STYLE_NAME, XML_TOK_LINENUMBERING_STYLE_NAME },
+ { XML_NAMESPACE_TEXT, XML_NUMBER_LINES,
+ XML_TOK_LINENUMBERING_NUMBER_LINES },
+ { XML_NAMESPACE_TEXT, XML_COUNT_EMPTY_LINES,
+ XML_TOK_LINENUMBERING_COUNT_EMPTY_LINES },
+ { XML_NAMESPACE_TEXT, XML_COUNT_IN_TEXT_BOXES,
+ XML_TOK_LINENUMBERING_COUNT_IN_TEXT_BOXES },
+ { XML_NAMESPACE_TEXT, XML_RESTART_ON_PAGE,
+ XML_TOK_LINENUMBERING_RESTART_NUMBERING },
+ { XML_NAMESPACE_TEXT, XML_OFFSET, XML_TOK_LINENUMBERING_OFFSET },
+ { XML_NAMESPACE_STYLE, XML_NUM_FORMAT, XML_TOK_LINENUMBERING_NUM_FORMAT },
+ { XML_NAMESPACE_STYLE, XML_NUM_LETTER_SYNC,
+ XML_TOK_LINENUMBERING_NUM_LETTER_SYNC },
+ { XML_NAMESPACE_TEXT, XML_NUMBER_POSITION,
+ XML_TOK_LINENUMBERING_NUMBER_POSITION },
+ { XML_NAMESPACE_TEXT, XML_INCREMENT, XML_TOK_LINENUMBERING_INCREMENT },
+ // { XML_NAMESPACE_TEXT, XML_LINENUMBERING_CONFIGURATION,
+ // XML_TOK_LINENUMBERING_LINENUMBERING_CONFIGURATION },
+ // { XML_NAMESPACE_TEXT, XML_INCREMENT, XML_TOK_LINENUMBERING_INCREMENT },
+ // { XML_NAMESPACE_TEXT, XML_LINENUMBERING_SEPARATOR,
+ // XML_TOK_LINENUMBERING_LINENUMBERING_SEPARATOR },
+
+ XML_TOKEN_MAP_END
+ };
+
+ SvXMLTokenMap aTokenMap(aLineNumberingTokenMap);
+
+ // process attributes
+ sal_Int16 nLength = xAttrList->getLength();
+ for(sal_Int16 i=0; i<nLength; i++)
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(i), &sLocalName );
+
+ ProcessAttribute(
+ (enum LineNumberingToken)aTokenMap.Get(nPrefix, sLocalName),
+ xAttrList->getValueByIndex(i));
+ }
+}
+
+void XMLLineNumberingImportContext::ProcessAttribute(
+ enum LineNumberingToken eToken,
+ OUString sValue)
+{
+ bool bTmp;
+ sal_Int32 nTmp;
+
+ switch (eToken)
+ {
+ case XML_TOK_LINENUMBERING_STYLE_NAME:
+ sStyleName = sValue;
+ break;
+
+ case XML_TOK_LINENUMBERING_NUMBER_LINES:
+ if (SvXMLUnitConverter::convertBool(bTmp, sValue))
+ {
+ bNumberLines = bTmp;
+ }
+ break;
+
+ case XML_TOK_LINENUMBERING_COUNT_EMPTY_LINES:
+ if (SvXMLUnitConverter::convertBool(bTmp, sValue))
+ {
+ bCountEmptyLines = bTmp;
+ }
+ break;
+
+ case XML_TOK_LINENUMBERING_COUNT_IN_TEXT_BOXES:
+ if (SvXMLUnitConverter::convertBool(bTmp, sValue))
+ {
+ bCountInFloatingFrames = bTmp;
+ }
+ break;
+
+ case XML_TOK_LINENUMBERING_RESTART_NUMBERING:
+ if (SvXMLUnitConverter::convertBool(bTmp, sValue))
+ {
+ bRestartNumbering = bTmp;
+ }
+ break;
+
+ case XML_TOK_LINENUMBERING_OFFSET:
+ if (GetImport().GetMM100UnitConverter().
+ convertMeasure(nTmp, sValue))
+ {
+ nOffset = nTmp;
+ }
+ break;
+
+ case XML_TOK_LINENUMBERING_NUM_FORMAT:
+ sNumFormat = sValue;
+ break;
+
+ case XML_TOK_LINENUMBERING_NUM_LETTER_SYNC:
+ sNumLetterSync = sValue;
+ break;
+
+ case XML_TOK_LINENUMBERING_NUMBER_POSITION:
+ {
+ static const SvXMLEnumMapEntry aLineNumberPositionMap[] =
+ {
+ { XML_LEFT, style::LineNumberPosition::LEFT },
+ { XML_RIGHT, style::LineNumberPosition::RIGHT },
+ { XML_INSIDE, style::LineNumberPosition::INSIDE },
+ { XML_OUTSIDE, style::LineNumberPosition::OUTSIDE },
+ { XML_TOKEN_INVALID, 0 }
+ };
+
+ sal_uInt16 nTmp16;
+ if (SvXMLUnitConverter::convertEnum(nTmp16, sValue,
+ aLineNumberPositionMap))
+ {
+ nNumberPosition = nTmp16;
+ }
+ break;
+ }
+
+ case XML_TOK_LINENUMBERING_INCREMENT:
+ if (SvXMLUnitConverter::convertNumber(nTmp, sValue, 0))
+ {
+ nIncrement = (sal_Int16)nTmp;
+ }
+ break;
+ }
+}
+
+void XMLLineNumberingImportContext::CreateAndInsert(sal_Bool)
+{
+ // insert and block mode is handled in insertStyleFamily
+
+ // we'll try to get the LineNumberingProperties
+ Reference<XLineNumberingProperties> xSupplier(GetImport().GetModel(),
+ UNO_QUERY);
+ if (xSupplier.is())
+ {
+ Reference<XPropertySet> xLineNumbering =
+ xSupplier->getLineNumberingProperties();
+
+ if (xLineNumbering.is())
+ {
+ Any aAny;
+
+ // set style name (if it exists)
+ if ( GetImport().GetStyles()->FindStyleChildContext(
+ XML_STYLE_FAMILY_TEXT_TEXT, sStyleName ) != NULL )
+ {
+ aAny <<= GetImport().GetStyleDisplayName(
+ XML_STYLE_FAMILY_TEXT_TEXT, sStyleName );
+ xLineNumbering->setPropertyValue(sCharStyleName, aAny);
+ }
+
+ aAny <<= sSeparator;
+ xLineNumbering->setPropertyValue(sSeparatorText, aAny);
+
+ aAny <<= nOffset;
+ xLineNumbering->setPropertyValue(sDistance, aAny);
+
+ aAny <<= nNumberPosition;
+ xLineNumbering->setPropertyValue(sNumberPosition, aAny);
+
+ if (nIncrement >= 0)
+ {
+ aAny <<= nIncrement;
+ xLineNumbering->setPropertyValue(sInterval, aAny);
+ }
+
+ if (nSeparatorIncrement >= 0)
+ {
+ aAny <<= nSeparatorIncrement;
+ xLineNumbering->setPropertyValue(sSeparatorInterval, aAny);
+ }
+
+ aAny.setValue(&bNumberLines, ::getBooleanCppuType());
+ xLineNumbering->setPropertyValue(sIsOn, aAny);
+
+ aAny.setValue(&bCountEmptyLines, ::getBooleanCppuType());
+ xLineNumbering->setPropertyValue(sCountEmptyLines, aAny);
+
+ aAny.setValue(&bCountInFloatingFrames, ::getBooleanCppuType());
+ xLineNumbering->setPropertyValue(sCountLinesInFrames, aAny);
+
+ aAny.setValue(&bRestartNumbering, ::getBooleanCppuType());
+ xLineNumbering->setPropertyValue(sRestartAtEachPage, aAny);
+
+ sal_Int16 nNumType = NumberingType::ARABIC;
+ GetImport().GetMM100UnitConverter().convertNumFormat( nNumType,
+ sNumFormat,
+ sNumLetterSync );
+ aAny <<= nNumType;
+ xLineNumbering->setPropertyValue(sNumberingType, aAny);
+ }
+ }
+}
+
+SvXMLImportContext* XMLLineNumberingImportContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList )
+{
+ if ( (nPrefix == XML_NAMESPACE_TEXT) &&
+ IsXMLToken(rLocalName, XML_LINENUMBERING_SEPARATOR) )
+ {
+ return new XMLLineNumberingSeparatorImportContext(GetImport(),
+ nPrefix, rLocalName,
+ *this);
+ }
+ else
+ {
+ // unknown element: default context
+ return SvXMLImportContext::CreateChildContext(nPrefix, rLocalName,
+ xAttrList);
+ }
+}
+
+void XMLLineNumberingImportContext::SetSeparatorText(
+ const OUString& sText)
+{
+ sSeparator = sText;
+}
+
+void XMLLineNumberingImportContext::SetSeparatorIncrement(
+ sal_Int16 nIncr)
+{
+ nSeparatorIncrement = nIncr;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLLineNumberingSeparatorImportContext.cxx b/xmloff/source/text/XMLLineNumberingSeparatorImportContext.cxx
new file mode 100644
index 000000000000..adc7a3230d4c
--- /dev/null
+++ b/xmloff/source/text/XMLLineNumberingSeparatorImportContext.cxx
@@ -0,0 +1,100 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLLineNumberingSeparatorImportContext.hxx"
+#include "XMLLineNumberingImportContext.hxx"
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+
+
+using namespace ::com::sun::star::uno;
+
+using ::com::sun::star::xml::sax::XAttributeList;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::xmloff::token::IsXMLToken;
+using ::xmloff::token::XML_INCREMENT;
+
+TYPEINIT1( XMLLineNumberingSeparatorImportContext, SvXMLImportContext );
+
+XMLLineNumberingSeparatorImportContext::XMLLineNumberingSeparatorImportContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ XMLLineNumberingImportContext& rLineNumbering) :
+ SvXMLImportContext(rImport, nPrfx, rLocalName),
+ rLineNumberingContext(rLineNumbering)
+{
+}
+
+XMLLineNumberingSeparatorImportContext::~XMLLineNumberingSeparatorImportContext()
+{
+}
+
+void XMLLineNumberingSeparatorImportContext::StartElement(
+ const Reference<XAttributeList> & xAttrList)
+{
+ sal_Int16 nLength = xAttrList->getLength();
+ for(sal_Int16 i=0; i<nLength; i++)
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(i), &sLocalName );
+
+ if ( (nPrefix == XML_NAMESPACE_TEXT) &&
+ IsXMLToken(sLocalName, XML_INCREMENT) )
+ {
+ sal_Int32 nTmp;
+ if (SvXMLUnitConverter::convertNumber(
+ nTmp, xAttrList->getValueByIndex(i), 0))
+ {
+ rLineNumberingContext.SetSeparatorIncrement((sal_Int16)nTmp);
+ }
+ // else: invalid number -> ignore
+ }
+ // else: unknown attribute -> ignore
+ }
+}
+
+void XMLLineNumberingSeparatorImportContext::Characters(
+ const OUString& rChars )
+{
+ sSeparatorBuf.append(rChars);
+}
+
+void XMLLineNumberingSeparatorImportContext::EndElement()
+{
+ rLineNumberingContext.SetSeparatorText(sSeparatorBuf.makeStringAndClear());
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLLineNumberingSeparatorImportContext.hxx b/xmloff/source/text/XMLLineNumberingSeparatorImportContext.hxx
new file mode 100644
index 000000000000..224e54e13936
--- /dev/null
+++ b/xmloff/source/text/XMLLineNumberingSeparatorImportContext.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLLINENUMBERINGSEPARATORIMPORTCONTEXT_HXX_
+#define _XMLOFF_XMLLINENUMBERINGSEPARATORIMPORTCONTEXT_HXX_
+
+#include <xmloff/xmlictxt.hxx>
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/uno/Reference.h>
+
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+} } }
+class XMLLineNumberingImportContext;
+
+
+/** import <text:linenumbering-separator> elements */
+class XMLLineNumberingSeparatorImportContext : public SvXMLImportContext
+{
+ ::rtl::OUStringBuffer sSeparatorBuf;
+ XMLLineNumberingImportContext& rLineNumberingContext;
+
+public:
+
+ TYPEINFO();
+
+ XMLLineNumberingSeparatorImportContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName,
+ XMLLineNumberingImportContext& rLineNumbering);
+
+ ~XMLLineNumberingSeparatorImportContext();
+
+protected:
+
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+
+ virtual void Characters( const ::rtl::OUString& rChars );
+
+ virtual void EndElement();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLPropertyBackpatcher.cxx b/xmloff/source/text/XMLPropertyBackpatcher.cxx
new file mode 100644
index 000000000000..292a77f42465
--- /dev/null
+++ b/xmloff/source/text/XMLPropertyBackpatcher.cxx
@@ -0,0 +1,314 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/uno/Reference.h>
+
+#include <rtl/ustring.hxx>
+#include <tools/debug.hxx>
+#include "XMLPropertyBackpatcher.hxx"
+#include <xmloff/txtimp.hxx> // XMLTextImportHelper partially implemented here
+
+
+using ::rtl::OUString;
+using ::std::vector;
+using ::std::map;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::beans::XPropertySet;
+
+
+template<class A>
+XMLPropertyBackpatcher<A>::XMLPropertyBackpatcher(
+ const ::rtl::OUString& sPropName)
+: sPropertyName(sPropName)
+, bDefaultHandling(sal_False)
+, bPreserveProperty(sal_False)
+, sPreservePropertyName()
+{
+}
+
+template<class A>
+XMLPropertyBackpatcher<A>::XMLPropertyBackpatcher(
+ const OUString& sPropName,
+ const OUString& sPreserveName,
+ sal_Bool bDefault,
+ A aDef)
+: sPropertyName(sPropName)
+, bDefaultHandling(bDefault)
+, bPreserveProperty(sPreserveName.getLength()>0)
+, sPreservePropertyName(sPreserveName)
+, aDefault(aDef)
+{
+}
+
+template<class A>
+XMLPropertyBackpatcher<A>::XMLPropertyBackpatcher(
+ const sal_Char* pPropName)
+: bDefaultHandling(sal_False)
+, bPreserveProperty(sal_False)
+{
+ DBG_ASSERT(pPropName != NULL, "need property name");
+ sPropertyName = OUString::createFromAscii(pPropName);
+}
+
+template<class A>
+XMLPropertyBackpatcher<A>::XMLPropertyBackpatcher(
+ const sal_Char* pPropName,
+ const sal_Char* pPreservePropName,
+ sal_Bool bDefault,
+ A aDef)
+: bDefaultHandling(bDefault)
+, bPreserveProperty(pPreservePropName != NULL)
+, aDefault(aDef)
+{
+ DBG_ASSERT(pPropName != NULL, "need property name");
+ sPropertyName = OUString::createFromAscii(pPropName);
+ if (pPreservePropName != NULL)
+ {
+ sPreservePropertyName = OUString::createFromAscii(pPreservePropName);
+ }
+}
+
+template<class A>
+XMLPropertyBackpatcher<A>::~XMLPropertyBackpatcher()
+{
+ SetDefault();
+}
+
+
+template<class A>
+void XMLPropertyBackpatcher<A>::ResolveId(
+ const OUString& sName,
+ A aValue)
+{
+ // insert ID into ID map
+ aIDMap[sName] = aValue;
+
+ // backpatch old references, if backpatch list exists
+ if (aBackpatchListMap.count(sName))
+ {
+ // aah, we have a backpatch list!
+ BackpatchListType* pList =
+ (BackpatchListType*)aBackpatchListMap[sName];
+
+ // a) remove list from list map
+ aBackpatchListMap.erase(sName);
+
+ // b) for every item, set SequenceNumber
+ // (and preserve Property, if appropriate)
+ Any aAny;
+ aAny <<= aValue;
+ if (bPreserveProperty)
+ {
+ // preserve version
+ for(BackpatchListType::iterator aIter = pList->begin();
+ aIter != pList->end();
+ aIter++)
+ {
+ Reference<XPropertySet> xProp = (*aIter);
+ Any aPres = xProp->getPropertyValue(sPreservePropertyName);
+ xProp->setPropertyValue(sPropertyName, aAny);
+ xProp->setPropertyValue(sPreservePropertyName, aPres);
+ }
+ }
+ else
+ {
+ // without preserve
+ for(BackpatchListType::iterator aIter = pList->begin();
+ aIter != pList->end();
+ aIter++)
+ {
+ (*aIter)->setPropertyValue(sPropertyName, aAny);
+ }
+ }
+
+ // c) delete list
+ delete pList;
+ }
+ // else: no backpatch list -> then we're finished
+}
+
+template<class A>
+void XMLPropertyBackpatcher<A>::SetProperty(
+ const Reference<XPropertySet> & xPropSet,
+ const OUString& sName)
+{
+ Reference<XPropertySet> xNonConstPropSet(xPropSet);
+ SetProperty(xNonConstPropSet, sName);
+}
+
+template<class A>
+void XMLPropertyBackpatcher<A>::SetProperty(
+ Reference<XPropertySet> & xPropSet,
+ const OUString& sName)
+{
+ if (aIDMap.count(sName))
+ {
+ // we know this ID -> set property
+ Any aAny;
+ aAny <<= aIDMap[sName];
+ xPropSet->setPropertyValue(sPropertyName, aAny);
+ }
+ else
+ {
+ // ID unknown -> into backpatch list for later fixup
+ if (! aBackpatchListMap.count(sName))
+ {
+ // create backpatch list for this name
+ BackpatchListType* pTmp = new BackpatchListType() ;
+ aBackpatchListMap[sName] = (void*)pTmp;
+ }
+
+ // insert footnote
+ ((BackpatchListType*)aBackpatchListMap[sName])->push_back(xPropSet);
+ }
+}
+
+template<class A>
+void XMLPropertyBackpatcher<A>::SetDefault()
+{
+ if (bDefaultHandling)
+ {
+ // not implemented yet
+ }
+}
+
+// force instantiation of templates
+template class XMLPropertyBackpatcher<sal_Int16>;
+template class XMLPropertyBackpatcher<OUString>;
+
+struct SAL_DLLPRIVATE XMLTextImportHelper::BackpatcherImpl
+{
+ /// backpatcher for references to footnotes and endnotes
+ ::std::auto_ptr< XMLPropertyBackpatcher<sal_Int16> >
+ m_pFootnoteBackpatcher;
+
+ /// backpatchers for references to sequences
+ ::std::auto_ptr< XMLPropertyBackpatcher<sal_Int16> >
+ m_pSequenceIdBackpatcher;
+
+ ::std::auto_ptr< XMLPropertyBackpatcher< ::rtl::OUString> >
+ m_pSequenceNameBackpatcher;
+
+};
+
+::boost::shared_ptr<XMLTextImportHelper::BackpatcherImpl>
+XMLTextImportHelper::MakeBackpatcherImpl()
+{
+ // n.b.: the shared_ptr stores the dtor!
+ return ::boost::shared_ptr<BackpatcherImpl>(new BackpatcherImpl);
+}
+
+static ::rtl::OUString const& GetSequenceNumber()
+{
+ static ::rtl::OUString s_SequenceNumber(
+ RTL_CONSTASCII_USTRINGPARAM("SequenceNumber"));
+ return s_SequenceNumber;
+}
+
+//
+// XMLTextImportHelper
+//
+// Code from XMLTextImportHelper using the XMLPropertyBackpatcher is
+// implemented here. The reason is that in the unxsols2 environment,
+// all templates are instatiated as file local (switch
+// -instances=static), and thus are not accessible from the outside.
+//
+// The previous solution was to force additional instantiation of
+// XMLPropertyBackpatcher in txtimp.cxx. This solution combines all
+// usage of the XMLPropertyBackpatcher in XMLPropertyBackpatcher.cxx
+// instead.
+//
+
+XMLPropertyBackpatcher<sal_Int16>& XMLTextImportHelper::GetFootnoteBP()
+{
+ if (!m_pBackpatcherImpl->m_pFootnoteBackpatcher.get())
+ {
+ m_pBackpatcherImpl->m_pFootnoteBackpatcher.reset(
+ new XMLPropertyBackpatcher<sal_Int16>(GetSequenceNumber()));
+ }
+ return *m_pBackpatcherImpl->m_pFootnoteBackpatcher;
+}
+
+XMLPropertyBackpatcher<sal_Int16>& XMLTextImportHelper::GetSequenceIdBP()
+{
+ if (!m_pBackpatcherImpl->m_pSequenceIdBackpatcher.get())
+ {
+ m_pBackpatcherImpl->m_pSequenceIdBackpatcher.reset(
+ new XMLPropertyBackpatcher<sal_Int16>(GetSequenceNumber()));
+ }
+ return *m_pBackpatcherImpl->m_pSequenceIdBackpatcher;
+}
+
+XMLPropertyBackpatcher<OUString>& XMLTextImportHelper::GetSequenceNameBP()
+{
+ static ::rtl::OUString s_SourceName(
+ RTL_CONSTASCII_USTRINGPARAM("SourceName"));
+ if (!m_pBackpatcherImpl->m_pSequenceNameBackpatcher.get())
+ {
+ m_pBackpatcherImpl->m_pSequenceNameBackpatcher.reset(
+ new XMLPropertyBackpatcher<OUString>(s_SourceName));
+ }
+ return *m_pBackpatcherImpl->m_pSequenceNameBackpatcher;
+}
+
+void XMLTextImportHelper::InsertFootnoteID(
+ const OUString& sXMLId,
+ sal_Int16 nAPIId)
+{
+ GetFootnoteBP().ResolveId(sXMLId, nAPIId);
+}
+
+void XMLTextImportHelper::ProcessFootnoteReference(
+ const OUString& sXMLId,
+ const Reference<XPropertySet> & xPropSet)
+{
+ GetFootnoteBP().SetProperty(xPropSet, sXMLId);
+}
+
+void XMLTextImportHelper::InsertSequenceID(
+ const OUString& sXMLId,
+ const OUString& sName,
+ sal_Int16 nAPIId)
+{
+ GetSequenceIdBP().ResolveId(sXMLId, nAPIId);
+ GetSequenceNameBP().ResolveId(sXMLId, sName);
+}
+
+void XMLTextImportHelper::ProcessSequenceReference(
+ const OUString& sXMLId,
+ const Reference<XPropertySet> & xPropSet)
+{
+ GetSequenceIdBP().SetProperty(xPropSet, sXMLId);
+ GetSequenceNameBP().SetProperty(xPropSet, sXMLId);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLPropertyBackpatcher.hxx b/xmloff/source/text/XMLPropertyBackpatcher.hxx
new file mode 100644
index 000000000000..42f2009f25e0
--- /dev/null
+++ b/xmloff/source/text/XMLPropertyBackpatcher.hxx
@@ -0,0 +1,154 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLPROPERTYBACKPATCHER_HXX
+#define _XMLOFF_XMLPROPERTYBACKPATCHER_HXX
+
+#include <map>
+#include <vector>
+#include <comphelper/stl_types.hxx>
+
+namespace rtl { class OUString; }
+namespace com { namespace sun { namespace star {
+ namespace beans { class XPropertySet; }
+ namespace uno { template<class A> class Reference; }
+} } }
+
+
+/** This class maintains an OUString->sal_Int16 mapping for cases in
+ * which an XPropertySet needs to be filled with values that are not
+ * yet known.
+ *
+ * A good example for appropriate use are footnotes and references to
+ * footnoes. Internally, the StarOffice API numbers footnotes, and
+ * references to footnotes refer to that internal numbering. In the
+ * XML file format, these numbers are replaced with name strings. Now
+ * if during import of a document a reference to a footnote is
+ * encountered, two things can happen: 1) The footnote already
+ * appeared in the document. In this case the name is already known
+ * and the proper ID can be requested from the footnote. 2) The
+ * footnote will appear later in the document. In this case the ID is
+ * not yet known, and the reference-ID property of the reference
+ * cannot be determined. Hence, the reference has to be stored and the
+ * ID needs to bet set later, when the footnote is eventually found in
+ * the document.
+ *
+ * This class simplifies this process: If the footnote is found,
+ * ResolveId with the XML name and the ID is called. When a reference
+ * is encountered, SetProperty gets called with the reference's
+ * XPropertySet and the XML name. All remaining tasks are handled by
+ * the class.
+ */
+template <class A>
+class XMLPropertyBackpatcher
+{
+
+ /// name of property that gets set or backpatched
+ ::rtl::OUString sPropertyName;
+
+ /// should a default value be set for unresolved properties
+ sal_Bool bDefaultHandling;
+
+ /// should the sPreservePropertyName be preserved
+ sal_Bool bPreserveProperty;
+
+ /// name of the property to preserve
+ ::rtl::OUString sPreservePropertyName;
+
+ /// default value for unresolved properties (if bDefaultHandling)
+ A aDefault;
+
+ /// backpatch list type
+ typedef ::std::vector<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> > BackpatchListType;
+
+ /* use void* instead of BackpatchListType to avoid linker problems
+ with long typenames. The real typename (commented out) contains
+ >1200 chars. */
+
+ /// backpatch list for unresolved IDs
+ //::std::map<const ::rtl::OUString, BackpatchListType*> aBackpatchListMap;
+ ::std::map<const ::rtl::OUString, void*, ::comphelper::UStringLess> aBackpatchListMap;
+
+ /// mapping of names -> IDs
+ ::std::map<const ::rtl::OUString, A, ::comphelper::UStringLess> aIDMap;
+
+public:
+
+ XMLPropertyBackpatcher(
+ const ::rtl::OUString& sPropertyName);
+
+ XMLPropertyBackpatcher(
+ const ::rtl::OUString& sPropertyName,
+ const ::rtl::OUString& sPreservePropertyName,
+ sal_Bool bDefault,
+ A aDef);
+
+ XMLPropertyBackpatcher(
+ const sal_Char* pPropertyName);
+
+ XMLPropertyBackpatcher(
+ const sal_Char* pPropertyName,
+ const sal_Char* pPreservePropertyName,
+ sal_Bool bDefault,
+ A aDef);
+
+ ~XMLPropertyBackpatcher();
+
+ /// resolve a known ID.
+ /// Call this as soon as the value for a particular name is known.
+ void ResolveId(
+ const ::rtl::OUString& sName,
+ A aValue);
+
+ /// Set property with the proper value for this name. If the value
+ /// is not yet known, store the XPropertySet in the backpatch list.
+ /// Use this whenever the value should be set, even if it is not yet known.
+ /// const version
+ void SetProperty(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropSet,
+ const ::rtl::OUString& sName);
+
+ /// non-const version of SetProperty
+ void SetProperty(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropSet,
+ const ::rtl::OUString& sName);
+
+ /// set default (if bDefaultHandling) for unresolved names
+ /// called by destructor
+ void SetDefault();
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLRedlineExport.cxx b/xmloff/source/text/XMLRedlineExport.cxx
new file mode 100644
index 000000000000..a0f2947434e8
--- /dev/null
+++ b/xmloff/source/text/XMLRedlineExport.cxx
@@ -0,0 +1,675 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLRedlineExport.hxx"
+#include <tools/debug.hxx>
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/UnknownPropertyException.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+
+#include <com/sun/star/container/XEnumeration.hpp>
+#include <com/sun/star/document/XRedlinesSupplier.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XTextContent.hpp>
+#include <com/sun/star/text/XTextSection.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmluconv.hxx>
+
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+using ::com::sun::star::beans::PropertyValue;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::beans::UnknownPropertyException;
+using ::com::sun::star::document::XRedlinesSupplier;
+using ::com::sun::star::container::XEnumerationAccess;
+using ::com::sun::star::container::XEnumeration;
+using ::com::sun::star::text::XText;
+using ::com::sun::star::text::XTextContent;
+using ::com::sun::star::text::XTextSection;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::util::DateTime;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::std::list;
+
+
+XMLRedlineExport::XMLRedlineExport(SvXMLExport& rExp)
+: sDelete(RTL_CONSTASCII_USTRINGPARAM("Delete"))
+, sDeletion(GetXMLToken(XML_DELETION))
+, sFormat(RTL_CONSTASCII_USTRINGPARAM("Format"))
+, sFormatChange(GetXMLToken(XML_FORMAT_CHANGE))
+, sInsert(RTL_CONSTASCII_USTRINGPARAM("Insert"))
+, sInsertion(GetXMLToken(XML_INSERTION))
+, sIsCollapsed(RTL_CONSTASCII_USTRINGPARAM("IsCollapsed"))
+, sIsStart(RTL_CONSTASCII_USTRINGPARAM("IsStart"))
+, sRedlineAuthor(RTL_CONSTASCII_USTRINGPARAM("RedlineAuthor"))
+, sRedlineComment(RTL_CONSTASCII_USTRINGPARAM("RedlineComment"))
+, sRedlineDateTime(RTL_CONSTASCII_USTRINGPARAM("RedlineDateTime"))
+, sRedlineSuccessorData(RTL_CONSTASCII_USTRINGPARAM("RedlineSuccessorData"))
+, sRedlineText(RTL_CONSTASCII_USTRINGPARAM("RedlineText"))
+, sRedlineType(RTL_CONSTASCII_USTRINGPARAM("RedlineType"))
+, sStyle(RTL_CONSTASCII_USTRINGPARAM("Style"))
+, sTextTable(RTL_CONSTASCII_USTRINGPARAM("TextTable"))
+, sUnknownChange(RTL_CONSTASCII_USTRINGPARAM("UnknownChange"))
+, sStartRedline(RTL_CONSTASCII_USTRINGPARAM("StartRedline"))
+, sEndRedline(RTL_CONSTASCII_USTRINGPARAM("EndRedline"))
+, sRedlineIdentifier(RTL_CONSTASCII_USTRINGPARAM("RedlineIdentifier"))
+, sIsInHeaderFooter(RTL_CONSTASCII_USTRINGPARAM("IsInHeaderFooter"))
+, sRedlineProtectionKey(RTL_CONSTASCII_USTRINGPARAM("RedlineProtectionKey"))
+, sRecordChanges(RTL_CONSTASCII_USTRINGPARAM("RecordChanges"))
+, sMergeLastPara(RTL_CONSTASCII_USTRINGPARAM("MergeLastPara"))
+, sChangePrefix(RTL_CONSTASCII_USTRINGPARAM("ct"))
+, rExport(rExp)
+, pCurrentChangesList(NULL)
+{
+}
+
+
+XMLRedlineExport::~XMLRedlineExport()
+{
+ // delete changes lists
+ for( ChangesMapType::iterator aIter = aChangeMap.begin();
+ aIter != aChangeMap.end();
+ aIter++ )
+ {
+ delete aIter->second;
+ }
+ aChangeMap.clear();
+}
+
+
+void XMLRedlineExport::ExportChange(
+ const Reference<XPropertySet> & rPropSet,
+ sal_Bool bAutoStyle)
+{
+ if (bAutoStyle)
+ {
+ // For the headers/footers, we have to collect the autostyles
+ // here. For the general case, however, it's better to collet
+ // the autostyles by iterating over the global redline
+ // list. So that's what we do: Here, we collect autostyles
+ // only if we have no current list of changes. For the
+ // main-document case, the autostyles are collected in
+ // ExportChangesListAutoStyles().
+ if (pCurrentChangesList != NULL)
+ ExportChangeAutoStyle(rPropSet);
+ }
+ else
+ {
+ ExportChangeInline(rPropSet);
+ }
+}
+
+
+void XMLRedlineExport::ExportChangesList(sal_Bool bAutoStyles)
+{
+ if (bAutoStyles)
+ {
+ ExportChangesListAutoStyles();
+ }
+ else
+ {
+ ExportChangesListElements();
+ }
+}
+
+
+void XMLRedlineExport::ExportChangesList(
+ const Reference<XText> & rText,
+ sal_Bool bAutoStyles)
+{
+ // in the header/footer case, auto styles are collected from the
+ // inline change elements.
+ if (bAutoStyles)
+ return;
+
+ // look for changes list for this XText
+ ChangesMapType::iterator aFind = aChangeMap.find(rText);
+ if (aFind != aChangeMap.end())
+ {
+ ChangesListType* pChangesList = aFind->second;
+
+ // export only if changes are found
+ if (pChangesList->size() > 0)
+ {
+ // changes container element
+ SvXMLElementExport aChanges(rExport, XML_NAMESPACE_TEXT,
+ XML_TRACKED_CHANGES,
+ sal_True, sal_True);
+
+ // iterate over changes list
+ for( ChangesListType::iterator aIter = pChangesList->begin();
+ aIter != pChangesList->end();
+ aIter++ )
+ {
+ ExportChangedRegion( *aIter );
+ }
+ }
+ // else: changes list empty -> ignore
+ }
+ // else: no changes list found -> empty
+}
+
+void XMLRedlineExport::SetCurrentXText(
+ const Reference<XText> & rText)
+{
+ if (rText.is())
+ {
+ // look for appropriate list in map; use the found one, or create new
+ ChangesMapType::iterator aIter = aChangeMap.find(rText);
+ if (aIter == aChangeMap.end())
+ {
+ ChangesListType* pList = new ChangesListType;
+ aChangeMap[rText] = pList;
+ pCurrentChangesList = pList;
+ }
+ else
+ pCurrentChangesList = aIter->second;
+ }
+ else
+ {
+ // don't record changes
+ SetCurrentXText();
+ }
+}
+
+void XMLRedlineExport::SetCurrentXText()
+{
+ pCurrentChangesList = NULL;
+}
+
+
+void XMLRedlineExport::ExportChangesListElements()
+{
+ // get redlines (aka tracked changes) from the model
+ Reference<XRedlinesSupplier> xSupplier(rExport.GetModel(), uno::UNO_QUERY);
+ if (xSupplier.is())
+ {
+ Reference<XEnumerationAccess> aEnumAccess = xSupplier->getRedlines();
+
+ // redline protection key
+ Reference<XPropertySet> aDocPropertySet( rExport.GetModel(),
+ uno::UNO_QUERY );
+ // redlining enabled?
+ sal_Bool bEnabled = *(sal_Bool*)aDocPropertySet->getPropertyValue(
+ sRecordChanges ).getValue();
+
+ // only export if we have redlines or attributes
+ if ( aEnumAccess->hasElements() || bEnabled )
+ {
+
+ // export only if we have changes, but tracking is not enabled
+ if ( !bEnabled != !aEnumAccess->hasElements() )
+ {
+ rExport.AddAttribute(
+ XML_NAMESPACE_TEXT, XML_TRACK_CHANGES,
+ bEnabled ? XML_TRUE : XML_FALSE );
+ }
+
+ // changes container element
+ SvXMLElementExport aChanges(rExport, XML_NAMESPACE_TEXT,
+ XML_TRACKED_CHANGES,
+ sal_True, sal_True);
+
+ // get enumeration and iterate over elements
+ Reference<XEnumeration> aEnum = aEnumAccess->createEnumeration();
+ while (aEnum->hasMoreElements())
+ {
+ Any aAny = aEnum->nextElement();
+ Reference<XPropertySet> xPropSet;
+ aAny >>= xPropSet;
+
+ DBG_ASSERT(xPropSet.is(),
+ "can't get XPropertySet; skipping Redline");
+ if (xPropSet.is())
+ {
+ // export only if not in header or footer
+ // (those must be exported with their XText)
+ aAny = xPropSet->getPropertyValue(sIsInHeaderFooter);
+ if (! *(sal_Bool*)aAny.getValue())
+ {
+ // and finally, export change
+ ExportChangedRegion(xPropSet);
+ }
+ }
+ // else: no XPropertySet -> no export
+ }
+ }
+ // else: no redlines -> no export
+ }
+ // else: no XRedlineSupplier -> no export
+}
+
+void XMLRedlineExport::ExportChangeAutoStyle(
+ const Reference<XPropertySet> & rPropSet)
+{
+ // record change (if changes should be recorded)
+ if (NULL != pCurrentChangesList)
+ {
+ // put redline in list if it's collapsed or the redline start
+ Any aIsStart = rPropSet->getPropertyValue(sIsStart);
+ Any aIsCollapsed = rPropSet->getPropertyValue(sIsCollapsed);
+
+ if ( *(sal_Bool*)aIsStart.getValue() ||
+ *(sal_Bool*)aIsCollapsed.getValue() )
+ pCurrentChangesList->push_back(rPropSet);
+ }
+
+ // get XText for export of redline auto styles
+ Any aAny = rPropSet->getPropertyValue(sRedlineText);
+ Reference<XText> xText;
+ aAny >>= xText;
+ if (xText.is())
+ {
+ // export the auto styles
+ rExport.GetTextParagraphExport()->collectTextAutoStyles(xText);
+ }
+}
+
+void XMLRedlineExport::ExportChangesListAutoStyles()
+{
+ // get redlines (aka tracked changes) from the model
+ Reference<XRedlinesSupplier> xSupplier(rExport.GetModel(), uno::UNO_QUERY);
+ if (xSupplier.is())
+ {
+ Reference<XEnumerationAccess> aEnumAccess = xSupplier->getRedlines();
+
+ // only export if we actually have redlines
+ if (aEnumAccess->hasElements())
+ {
+ // get enumeration and iterate over elements
+ Reference<XEnumeration> aEnum = aEnumAccess->createEnumeration();
+ while (aEnum->hasMoreElements())
+ {
+ Any aAny = aEnum->nextElement();
+ Reference<XPropertySet> xPropSet;
+ aAny >>= xPropSet;
+
+ DBG_ASSERT(xPropSet.is(),
+ "can't get XPropertySet; skipping Redline");
+ if (xPropSet.is())
+ {
+
+ // export only if not in header or footer
+ // (those must be exported with their XText)
+ aAny = xPropSet->getPropertyValue(sIsInHeaderFooter);
+ if (! *(sal_Bool*)aAny.getValue())
+ {
+ ExportChangeAutoStyle(xPropSet);
+ }
+ }
+ }
+ }
+ }
+}
+
+void XMLRedlineExport::ExportChangeInline(
+ const Reference<XPropertySet> & rPropSet)
+{
+ // determine element name (depending on collapsed, start/end)
+ enum XMLTokenEnum eElement = XML_TOKEN_INVALID;
+ Any aAny = rPropSet->getPropertyValue(sIsCollapsed);
+ sal_Bool bCollapsed = *(sal_Bool *)aAny.getValue();
+ sal_Bool bStart = sal_True; // ignored if bCollapsed = sal_True
+ if (bCollapsed)
+ {
+ eElement = XML_CHANGE;
+ }
+ else
+ {
+ aAny = rPropSet->getPropertyValue(sIsStart);
+ bStart = *(sal_Bool *)aAny.getValue();
+ eElement = bStart ? XML_CHANGE_START : XML_CHANGE_END;
+ }
+
+ if (XML_TOKEN_INVALID != eElement)
+ {
+ // we always need the ID
+ rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_CHANGE_ID,
+ GetRedlineID(rPropSet));
+
+ // export the element (no whitespace because we're in the text body)
+ SvXMLElementExport aChangeElem(rExport, XML_NAMESPACE_TEXT,
+ eElement, sal_False, sal_False);
+ }
+}
+
+
+void XMLRedlineExport::ExportChangedRegion(
+ const Reference<XPropertySet> & rPropSet)
+{
+ // Redline-ID
+ rExport.AddAttributeIdLegacy(XML_NAMESPACE_TEXT, GetRedlineID(rPropSet));
+
+ // merge-last-paragraph
+ Any aAny = rPropSet->getPropertyValue(sMergeLastPara);
+ if( ! *(sal_Bool*)aAny.getValue() )
+ rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_MERGE_LAST_PARAGRAPH,
+ XML_FALSE);
+
+ // export change region element
+ SvXMLElementExport aChangedRegion(rExport, XML_NAMESPACE_TEXT,
+ XML_CHANGED_REGION, sal_True, sal_True);
+
+
+ // scope for (first) change element
+ {
+ aAny = rPropSet->getPropertyValue(sRedlineType);
+ OUString sType;
+ aAny >>= sType;
+ SvXMLElementExport aChange(rExport, XML_NAMESPACE_TEXT,
+ ConvertTypeName(sType), sal_True, sal_True);
+
+ ExportChangeInfo(rPropSet);
+
+ // get XText from the redline and export (if the XText exists)
+ aAny = rPropSet->getPropertyValue(sRedlineText);
+ Reference<XText> xText;
+ aAny >>= xText;
+ if (xText.is())
+ {
+ rExport.GetTextParagraphExport()->exportText(xText);
+ // default parameters: bProgress, bExportParagraph ???
+ }
+ // else: no text interface -> content is inline and will
+ // be exported there
+ }
+
+ // changed change? Hierarchical changes can onl be two levels
+ // deep. Here we check for the second level.
+ aAny = rPropSet->getPropertyValue(sRedlineSuccessorData);
+ Sequence<PropertyValue> aSuccessorData;
+ aAny >>= aSuccessorData;
+
+ // if we actually got a hierarchical change, make element and
+ // process change info
+ if (aSuccessorData.getLength() > 0)
+ {
+ // The only change that can be "undone" is an insertion -
+ // after all, you can't re-insert an deletion, but you can
+ // delete an insertion. This assumption is asserted in
+ // ExportChangeInfo(Sequence<PropertyValue>&).
+ SvXMLElementExport aSecondChangeElem(
+ rExport, XML_NAMESPACE_TEXT, XML_INSERTION,
+ sal_True, sal_True);
+
+ ExportChangeInfo(aSuccessorData);
+ }
+ // else: no hierarchical change
+}
+
+
+const OUString XMLRedlineExport::ConvertTypeName(
+ const OUString& sApiName)
+{
+ if (sApiName == sDelete)
+ {
+ return sDeletion;
+ }
+ else if (sApiName == sInsert)
+ {
+ return sInsertion;
+ }
+ else if (sApiName == sFormat)
+ {
+ return sFormatChange;
+ }
+ else
+ {
+ OSL_FAIL("unknown redline type");
+ return sUnknownChange;
+ }
+}
+
+
+/** Create a Redline-ID */
+const OUString XMLRedlineExport::GetRedlineID(
+ const Reference<XPropertySet> & rPropSet)
+{
+ Any aAny = rPropSet->getPropertyValue(sRedlineIdentifier);
+ OUString sTmp;
+ aAny >>= sTmp;
+
+ OUStringBuffer sBuf(sChangePrefix);
+ sBuf.append(sTmp);
+ return sBuf.makeStringAndClear();
+}
+
+
+void XMLRedlineExport::ExportChangeInfo(
+ const Reference<XPropertySet> & rPropSet)
+{
+
+ SvXMLElementExport aChangeInfo(rExport, XML_NAMESPACE_OFFICE,
+ XML_CHANGE_INFO, sal_True, sal_True);
+
+ Any aAny = rPropSet->getPropertyValue(sRedlineAuthor);
+ OUString sTmp;
+ aAny >>= sTmp;
+ if (sTmp.getLength() > 0)
+ {
+ SvXMLElementExport aCreatorElem( rExport, XML_NAMESPACE_DC,
+ XML_CREATOR, sal_True,
+ sal_False );
+ rExport.Characters(sTmp);
+ }
+
+ aAny = rPropSet->getPropertyValue(sRedlineDateTime);
+ util::DateTime aDateTime;
+ aAny >>= aDateTime;
+ {
+ OUStringBuffer sBuf;
+ rExport.GetMM100UnitConverter().convertDateTime(sBuf, aDateTime);
+ SvXMLElementExport aDateElem( rExport, XML_NAMESPACE_DC,
+ XML_DATE, sal_True,
+ sal_False );
+ rExport.Characters(sBuf.makeStringAndClear());
+ }
+
+ // comment as <text:p> sequence
+ aAny = rPropSet->getPropertyValue(sRedlineComment);
+ aAny >>= sTmp;
+ WriteComment( sTmp );
+}
+
+void XMLRedlineExport::ExportChangeInfo(
+ const Sequence<PropertyValue> & rPropertyValues)
+{
+ OUString sComment;
+
+ sal_Int32 nCount = rPropertyValues.getLength();
+ for(sal_Int32 i = 0; i < nCount; i++)
+ {
+ const PropertyValue& rVal = rPropertyValues[i];
+
+ if( rVal.Name.equals(sRedlineAuthor) )
+ {
+ OUString sTmp;
+ rVal.Value >>= sTmp;
+ if (sTmp.getLength() > 0)
+ {
+ rExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_CHG_AUTHOR, sTmp);
+ }
+ }
+ else if( rVal.Name.equals(sRedlineComment) )
+ {
+ rVal.Value >>= sComment;
+ }
+ else if( rVal.Name.equals(sRedlineDateTime) )
+ {
+ util::DateTime aDateTime;
+ rVal.Value >>= aDateTime;
+ OUStringBuffer sBuf;
+ rExport.GetMM100UnitConverter().convertDateTime(sBuf, aDateTime);
+ rExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_CHG_DATE_TIME,
+ sBuf.makeStringAndClear());
+ }
+ else if( rVal.Name.equals(sRedlineType) )
+ {
+ // check if this is an insertion; cf. comment at calling location
+ OUString sTmp;
+ rVal.Value >>= sTmp;
+ DBG_ASSERT(sTmp.equals(sInsert),
+ "hierarchical change must be insertion");
+ }
+ // else: unknown value -> ignore
+ }
+
+ // finally write element
+ SvXMLElementExport aChangeInfo(rExport, XML_NAMESPACE_OFFICE,
+ XML_CHANGE_INFO, sal_True, sal_True);
+
+ WriteComment( sComment );
+}
+
+void XMLRedlineExport::ExportStartOrEndRedline(
+ const Reference<XPropertySet> & rPropSet,
+ sal_Bool bStart)
+{
+ if( ! rPropSet.is() )
+ return;
+
+ // get appropriate (start or end) property
+ Any aAny;
+ try
+ {
+ aAny = rPropSet->getPropertyValue(bStart ? sStartRedline : sEndRedline);
+ }
+ catch( UnknownPropertyException e )
+ {
+ // If we don't have the property, there's nothing to do.
+ return;
+ }
+
+ Sequence<PropertyValue> aValues;
+ aAny >>= aValues;
+ const PropertyValue* pValues = aValues.getConstArray();
+
+ // seek for redline properties
+ sal_Bool bIsCollapsed = sal_False;
+ sal_Bool bIsStart = sal_True;
+ OUString sId;
+ sal_Bool bIdOK = sal_False; // have we seen an ID?
+ sal_Int32 nLength = aValues.getLength();
+ for(sal_Int32 i = 0; i < nLength; i++)
+ {
+ if (sRedlineIdentifier.equals(pValues[i].Name))
+ {
+ pValues[i].Value >>= sId;
+ bIdOK = sal_True;
+ }
+ else if (sIsCollapsed.equals(pValues[i].Name))
+ {
+ bIsCollapsed = *(sal_Bool*)pValues[i].Value.getValue();
+ }
+ else if (sIsStart.equals(pValues[i].Name))
+ {
+ bIsStart = *(sal_Bool*)pValues[i].Value.getValue();
+ }
+ }
+
+ if( bIdOK )
+ {
+ DBG_ASSERT( sId.getLength() > 0, "Redlines must have IDs" );
+
+ // TODO: use GetRedlineID or elimiate that function
+ OUStringBuffer sBuffer(sChangePrefix);
+ sBuffer.append(sId);
+
+ rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_CHANGE_ID,
+ sBuffer.makeStringAndClear());
+
+ // export the element
+ // (whitespace because we're not inside paragraphs)
+ SvXMLElementExport aChangeElem(
+ rExport, XML_NAMESPACE_TEXT,
+ bIsCollapsed ? XML_CHANGE :
+ ( bIsStart ? XML_CHANGE_START : XML_CHANGE_END ),
+ sal_True, sal_True);
+ }
+}
+
+void XMLRedlineExport::ExportStartOrEndRedline(
+ const Reference<XTextContent> & rContent,
+ sal_Bool bStart)
+{
+ Reference<XPropertySet> xPropSet(rContent, uno::UNO_QUERY);
+ if (xPropSet.is())
+ {
+ ExportStartOrEndRedline(xPropSet, bStart);
+ }
+ else
+ {
+ OSL_FAIL("XPropertySet expected");
+ }
+}
+
+void XMLRedlineExport::ExportStartOrEndRedline(
+ const Reference<XTextSection> & rSection,
+ sal_Bool bStart)
+{
+ Reference<XPropertySet> xPropSet(rSection, uno::UNO_QUERY);
+ if (xPropSet.is())
+ {
+ ExportStartOrEndRedline(xPropSet, bStart);
+ }
+ else
+ {
+ OSL_FAIL("XPropertySet expected");
+ }
+}
+
+void XMLRedlineExport::WriteComment(const OUString& rComment)
+{
+ if (rComment.getLength() > 0)
+ {
+ // iterate over all string-pieces separated by return (0x0a) and
+ // put each inside a paragraph element.
+ SvXMLTokenEnumerator aEnumerator(rComment, sal_Char(0x0a));
+ OUString aSubString;
+ while (aEnumerator.getNextToken(aSubString))
+ {
+ SvXMLElementExport aParagraph(
+ rExport, XML_NAMESPACE_TEXT, XML_P, sal_True, sal_False);
+ rExport.Characters(aSubString);
+ }
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLRedlineExport.hxx b/xmloff/source/text/XMLRedlineExport.hxx
new file mode 100644
index 000000000000..46125b5fd42d
--- /dev/null
+++ b/xmloff/source/text/XMLRedlineExport.hxx
@@ -0,0 +1,215 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLREDLINEEXPORT_HXX
+#define _XMLOFF_XMLREDLINEEXPORT_HXX
+
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.h>
+
+#include <list>
+#include <map>
+#include <set>
+
+class SvXMLExport;
+namespace com { namespace sun { namespace star {
+ namespace beans { class XPropertySet; }
+ namespace beans { struct PropertyValue; }
+ namespace text { class XText; }
+ namespace text { class XTextContent; }
+ namespace text { class XTextSection; }
+ } } }
+namespace rtl {
+ class OUString;
+ class OUStringBuffer;
+}
+
+// store a list of redline properties
+typedef ::std::list<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> > ChangesListType;
+
+// store a list of redline properties for each XText
+typedef ::std::map<
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XText>,
+ ChangesListType* > ChangesMapType;
+
+
+/**
+ * This class handles the export of redline portions.
+ * It is to be called from XMLTextParagraphExport.
+ */
+class XMLRedlineExport
+{
+ const ::rtl::OUString sDelete;
+ const ::rtl::OUString sDeletion;
+ const ::rtl::OUString sFormat;
+ const ::rtl::OUString sFormatChange;
+ const ::rtl::OUString sInsert;
+ const ::rtl::OUString sInsertion;
+ const ::rtl::OUString sIsCollapsed;
+ const ::rtl::OUString sIsStart;
+ const ::rtl::OUString sRedlineAuthor;
+ const ::rtl::OUString sRedlineComment;
+ const ::rtl::OUString sRedlineDateTime;
+ const ::rtl::OUString sRedlineSuccessorData;
+ const ::rtl::OUString sRedlineText;
+ const ::rtl::OUString sRedlineType;
+ const ::rtl::OUString sStyle;
+ const ::rtl::OUString sTextTable;
+ const ::rtl::OUString sUnknownChange;
+ const ::rtl::OUString sStartRedline;
+ const ::rtl::OUString sEndRedline;
+ const ::rtl::OUString sRedlineIdentifier;
+ const ::rtl::OUString sIsInHeaderFooter;
+ const ::rtl::OUString sRedlineProtectionKey;
+ const ::rtl::OUString sRecordChanges;
+ const ::rtl::OUString sMergeLastPara;
+
+ const ::rtl::OUString sChangePrefix;
+
+ SvXMLExport& rExport;
+
+
+ // handling of change recording:
+
+ // To support change tracking in headers and footers we need to
+ // write these changes separately. To do this, we record the
+ // changes for headers and footers. For the main document body, we
+ // get the complete list of changes from the document, which
+ // should be much more efficient than recording all of those.
+
+ ChangesMapType aChangeMap; /// map of recorded changes
+
+ /// list of current changes; is NULL or points to member of aChangeMap
+ ChangesListType* pCurrentChangesList;
+
+
+public:
+ XMLRedlineExport(SvXMLExport& rExp);
+
+ ~XMLRedlineExport();
+
+ /// export a change
+ void ExportChange(
+ /// PropertySet of RedlinePortion
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet,
+ sal_Bool bAutoStyle);
+
+ /// export the list of changes (complete list minus recorded changed)
+ void ExportChangesList(sal_Bool bAutoStyles);
+
+ /// export the list of changes (recorded changes for this XText only)
+ void ExportChangesList(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XText> & rText,
+ sal_Bool bAutoStyles);
+
+ /// set the current XText for which changes should be recorded.
+ /// An empty XText means: don't record changes
+ void SetCurrentXText(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XText> & rText);
+
+ /// Do not record changes.
+ /// Same as SetCurrentXText(Reference<XText>) with empty argument.
+ void SetCurrentXText();
+
+ /// export redline marks which start or end at start nodes,
+ /// i.e. that include the complete paragraph/table/section
+ void ExportStartOrEndRedline(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet,
+ sal_Bool bStart); /// start or end of text entity (e.g. paragraph)?
+
+ /// convenience method, calls XPropertySet-version of this method
+ void ExportStartOrEndRedline(
+ /// XTextContent; must also be an XPropertySet
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextContent> & rContent,
+ sal_Bool bStart);
+
+ /// convenience method, calls XPropertySet-version of this method
+ void ExportStartOrEndRedline(
+ /// XTextSection; must also be an XPropertySet
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextSection> & rSection,
+ sal_Bool bStart);
+
+private:
+
+ /// export the change mark contained in the text body
+ void ExportChangeInline(
+ /// PropertySet of RedlinePortion
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet);
+
+ /// export the auto styles used in this change
+ void ExportChangeAutoStyle(
+ /// PropertySet of RedlinePortion
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet);
+
+ /// export the changes list (<text:tracked-changes>)
+ void ExportChangesListElements();
+
+ /// export the auto styles needed by the changes list
+ void ExportChangesListAutoStyles();
+
+ /// export the changed-region element
+ void ExportChangedRegion(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet);
+
+ /// export an change-info element (from a PropertySet)
+ void ExportChangeInfo(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet);
+
+ /// export an change-info element (from PropertyValues)
+ void ExportChangeInfo(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue> & rValues);
+
+ /// convert the change type from API to XML names
+ const ::rtl::OUString ConvertTypeName(const ::rtl::OUString& sApiName);
+
+ /// Get ID string!
+ const ::rtl::OUString GetRedlineID(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet);
+
+ /// write a comment string as sequence of <text:p> elements
+ void WriteComment(const ::rtl::OUString& rComment);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLSectionExport.cxx b/xmloff/source/text/XMLSectionExport.cxx
new file mode 100644
index 000000000000..151a233f6f67
--- /dev/null
+++ b/xmloff/source/text/XMLSectionExport.cxx
@@ -0,0 +1,1931 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLSectionExport.hxx"
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+
+#include <vector>
+
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/container/XIndexReplace.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <com/sun/star/beans/PropertyState.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XTextSection.hpp>
+#include <com/sun/star/text/SectionFileLink.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/text/XDocumentIndex.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/text/BibliographyDataField.hpp>
+#include <com/sun/star/text/XTextFieldsSupplier.hpp>
+#include <com/sun/star/text/XChapterNumberingSupplier.hpp>
+#include <com/sun/star/text/ChapterFormat.hpp> //i90246
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/families.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmltkmap.hxx>
+#include "txtflde.hxx"
+
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::uno;
+using namespace ::std;
+using namespace ::xmloff::token;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::beans::PropertyValue;
+using ::com::sun::star::beans::PropertyValues;
+using ::com::sun::star::beans::PropertyState;
+using ::com::sun::star::container::XIndexReplace;
+using ::com::sun::star::container::XNameAccess;
+using ::com::sun::star::container::XNamed;
+using ::com::sun::star::lang::XServiceInfo;
+using ::com::sun::star::lang::Locale;
+using ::com::sun::star::uno::XInterface;
+
+
+XMLSectionExport::XMLSectionExport(
+ SvXMLExport& rExp,
+ XMLTextParagraphExport& rParaExp)
+: sCondition(RTL_CONSTASCII_USTRINGPARAM("Condition"))
+, sCreateFromChapter(RTL_CONSTASCII_USTRINGPARAM("CreateFromChapter"))
+, sCreateFromEmbeddedObjects(RTL_CONSTASCII_USTRINGPARAM("CreateFromEmbeddedObjects"))
+, sCreateFromGraphicObjects(RTL_CONSTASCII_USTRINGPARAM("CreateFromGraphicObjects"))
+, sCreateFromLabels(RTL_CONSTASCII_USTRINGPARAM("CreateFromLabels"))
+, sCreateFromMarks(RTL_CONSTASCII_USTRINGPARAM("CreateFromMarks"))
+, sCreateFromOtherEmbeddedObjects(RTL_CONSTASCII_USTRINGPARAM("CreateFromOtherEmbeddedObjects"))
+, sCreateFromOutline(RTL_CONSTASCII_USTRINGPARAM("CreateFromOutline"))
+, sCreateFromStarCalc(RTL_CONSTASCII_USTRINGPARAM("CreateFromStarCalc"))
+, sCreateFromStarChart(RTL_CONSTASCII_USTRINGPARAM("CreateFromStarChart"))
+, sCreateFromStarDraw(RTL_CONSTASCII_USTRINGPARAM("CreateFromStarDraw"))
+, sCreateFromStarImage(RTL_CONSTASCII_USTRINGPARAM("CreateFromStarImage"))
+, sCreateFromStarMath(RTL_CONSTASCII_USTRINGPARAM("CreateFromStarMath"))
+, sCreateFromTables(RTL_CONSTASCII_USTRINGPARAM("CreateFromTables"))
+, sCreateFromTextFrames(RTL_CONSTASCII_USTRINGPARAM("CreateFromTextFrames"))
+, sDdeCommandElement(RTL_CONSTASCII_USTRINGPARAM("DDECommandElement"))
+, sDdeCommandFile(RTL_CONSTASCII_USTRINGPARAM("DDECommandFile"))
+, sDdeCommandType(RTL_CONSTASCII_USTRINGPARAM("DDECommandType"))
+, sFileLink(RTL_CONSTASCII_USTRINGPARAM("FileLink"))
+, sIsCaseSensitive(RTL_CONSTASCII_USTRINGPARAM("IsCaseSensitive"))
+, sIsProtected(RTL_CONSTASCII_USTRINGPARAM("IsProtected"))
+, sIsVisible(RTL_CONSTASCII_USTRINGPARAM("IsVisible"))
+, sLabelCategory(RTL_CONSTASCII_USTRINGPARAM("LabelCategory"))
+, sLabelDisplayType(RTL_CONSTASCII_USTRINGPARAM("LabelDisplayType"))
+, sLevel(RTL_CONSTASCII_USTRINGPARAM("Level"))
+, sLevelFormat(RTL_CONSTASCII_USTRINGPARAM("LevelFormat"))
+, sLevelParagraphStyles(RTL_CONSTASCII_USTRINGPARAM("LevelParagraphStyles"))
+, sLinkRegion(RTL_CONSTASCII_USTRINGPARAM("LinkRegion"))
+, sMainEntryCharacterStyleName(RTL_CONSTASCII_USTRINGPARAM("MainEntryCharacterStyleName"))
+, sParaStyleHeading(RTL_CONSTASCII_USTRINGPARAM("ParaStyleHeading"))
+, sParaStyleLevel(RTL_CONSTASCII_USTRINGPARAM("ParaStyleLevel"))
+, sTitle(RTL_CONSTASCII_USTRINGPARAM("Title"))
+, sName(RTL_CONSTASCII_USTRINGPARAM("Name"))
+, sUseAlphabeticalSeparators(RTL_CONSTASCII_USTRINGPARAM("UseAlphabeticalSeparators"))
+, sUseCombinedEntries(RTL_CONSTASCII_USTRINGPARAM("UseCombinedEntries"))
+, sUseDash(RTL_CONSTASCII_USTRINGPARAM("UseDash"))
+, sUseKeyAsEntry(RTL_CONSTASCII_USTRINGPARAM("UseKeyAsEntry"))
+, sUseLevelFromSource(RTL_CONSTASCII_USTRINGPARAM("UseLevelFromSource"))
+, sUsePP(RTL_CONSTASCII_USTRINGPARAM("UsePP"))
+, sUseUpperCase(RTL_CONSTASCII_USTRINGPARAM("UseUpperCase"))
+, sIsCommaSeparated(RTL_CONSTASCII_USTRINGPARAM("IsCommaSeparated"))
+, sIsAutomaticUpdate(RTL_CONSTASCII_USTRINGPARAM("IsAutomaticUpdate"))
+, sIsRelativeTabstops(RTL_CONSTASCII_USTRINGPARAM("IsRelativeTabstops"))
+, sCreateFromLevelParagraphStyles(RTL_CONSTASCII_USTRINGPARAM("CreateFromLevelParagraphStyles"))
+, sDocumentIndex(RTL_CONSTASCII_USTRINGPARAM("DocumentIndex"))
+, sContentSection(RTL_CONSTASCII_USTRINGPARAM("ContentSection"))
+, sHeaderSection(RTL_CONSTASCII_USTRINGPARAM("HeaderSection"))
+
+, sTextSection(RTL_CONSTASCII_USTRINGPARAM("TextSection"))
+, sIsGlobalDocumentSection(RTL_CONSTASCII_USTRINGPARAM("IsGlobalDocumentSection"))
+, sProtectionKey(RTL_CONSTASCII_USTRINGPARAM("ProtectionKey"))
+, sSortAlgorithm(RTL_CONSTASCII_USTRINGPARAM("SortAlgorithm"))
+, sLocale(RTL_CONSTASCII_USTRINGPARAM("Locale"))
+, sUserIndexName(RTL_CONSTASCII_USTRINGPARAM("UserIndexName"))
+
+, sIsCurrentlyVisible(RTL_CONSTASCII_USTRINGPARAM("IsCurrentlyVisible"))
+, sHeadingStyleName(RTL_CONSTASCII_USTRINGPARAM("HeadingStyleName"))
+
+, rExport(rExp)
+, rParaExport(rParaExp)
+, bHeadingDummiesExported( sal_False )
+{
+}
+
+
+void XMLSectionExport::ExportSectionStart(
+ const Reference<XTextSection> & rSection,
+ sal_Bool bAutoStyles)
+{
+ Reference<XPropertySet> xPropertySet(rSection, UNO_QUERY);
+
+ // always export section (auto) style
+ if (bAutoStyles)
+ {
+ // get PropertySet and add section style
+ GetParaExport().Add( XML_STYLE_FAMILY_TEXT_SECTION, xPropertySet );
+ }
+ else
+ {
+ // always export section style
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_STYLE_NAME,
+ GetParaExport().Find(
+ XML_STYLE_FAMILY_TEXT_SECTION,
+ xPropertySet, sEmpty ) );
+
+ // xml:id for RDF metadata
+ GetExport().AddAttributeXmlId(rSection);
+
+ // export index or regular section
+ Reference<XDocumentIndex> xIndex;
+ if (GetIndex(rSection, xIndex))
+ {
+ if (xIndex.is())
+ {
+ // we are an index
+ ExportIndexStart(xIndex);
+ }
+ else
+ {
+ // we are an index header
+ ExportIndexHeaderStart(rSection);
+ }
+ }
+ else
+ {
+ // we are not an index
+ ExportRegularSectionStart(rSection);
+ }
+ }
+}
+
+sal_Bool XMLSectionExport::GetIndex(
+ const Reference<XTextSection> & rSection,
+ Reference<XDocumentIndex> & rIndex) const
+{
+ // first, reset result
+ sal_Bool bRet = sal_False;
+ rIndex = NULL;
+
+ // get section Properties
+ Reference<XPropertySet> xSectionPropSet(rSection, UNO_QUERY);
+
+ // then check if this section happens to be inside an index
+ if (xSectionPropSet->getPropertySetInfo()->
+ hasPropertyByName(sDocumentIndex))
+ {
+ Any aAny = xSectionPropSet->getPropertyValue(sDocumentIndex);
+ Reference<XDocumentIndex> xDocumentIndex;
+ aAny >>= xDocumentIndex;
+
+ // OK, are we inside of an index
+ if (xDocumentIndex.is())
+ {
+ // is the enclosing index identical with "our" section?
+ Reference<XPropertySet> xIndexPropSet(xDocumentIndex, UNO_QUERY);
+ aAny = xIndexPropSet->getPropertyValue(sContentSection);
+ Reference<XTextSection> xEnclosingSection;
+ aAny >>= xEnclosingSection;
+
+ // if the enclosing section is "our" section, then we are an index!
+ if (rSection == xEnclosingSection)
+ {
+ rIndex = xDocumentIndex;
+ bRet = sal_True;
+ }
+ // else: index header or regular section
+
+ // is the enclosing index identical with the header section?
+ aAny = xIndexPropSet->getPropertyValue(sHeaderSection);
+ // now mis-named: contains header section
+ aAny >>= xEnclosingSection;
+
+ // if the enclosing section is "our" section, then we are an index!
+ if (rSection == xEnclosingSection)
+ {
+ bRet = sal_True;
+ }
+ // else: regular section
+ }
+ // else: we aren't even inside of an index
+ }
+ // else: we don't even know what an index is.
+
+ return bRet;
+}
+
+
+void XMLSectionExport::ExportSectionEnd(
+ const Reference<XTextSection> & rSection,
+ sal_Bool bAutoStyles)
+{
+ // no end section for styles
+ if (!bAutoStyles)
+ {
+ enum XMLTokenEnum eElement = XML_TOKEN_INVALID;
+
+ // export index or regular section end
+ Reference<XDocumentIndex> xIndex;
+ if (GetIndex(rSection, xIndex))
+ {
+ if (xIndex.is())
+ {
+ // index end: close index body element
+ GetExport().EndElement( XML_NAMESPACE_TEXT, XML_INDEX_BODY,
+ sal_True );
+ GetExport().IgnorableWhitespace();
+
+ switch (MapSectionType(xIndex->getServiceName()))
+ {
+ case TEXT_SECTION_TYPE_TOC:
+ eElement = XML_TABLE_OF_CONTENT;
+ break;
+
+ case TEXT_SECTION_TYPE_ILLUSTRATION:
+ eElement = XML_ILLUSTRATION_INDEX;
+ break;
+
+ case TEXT_SECTION_TYPE_ALPHABETICAL:
+ eElement = XML_ALPHABETICAL_INDEX;
+ break;
+
+ case TEXT_SECTION_TYPE_TABLE:
+ eElement = XML_TABLE_INDEX;
+ break;
+
+ case TEXT_SECTION_TYPE_OBJECT:
+ eElement = XML_OBJECT_INDEX;
+ break;
+
+ case TEXT_SECTION_TYPE_USER:
+ eElement = XML_USER_INDEX;
+ break;
+
+ case TEXT_SECTION_TYPE_BIBLIOGRAPHY:
+ eElement = XML_BIBLIOGRAPHY;
+ break;
+
+ default:
+ OSL_FAIL("unknown index type");
+ // default: skip index!
+ break;
+ }
+ }
+ else
+ {
+ eElement = XML_INDEX_TITLE;
+ }
+ }
+ else
+ {
+ eElement = XML_SECTION;
+ }
+
+ if (XML_TOKEN_INVALID != eElement)
+ {
+ // any old attributes?
+ GetExport().CheckAttrList();
+
+ // element surrounded by whitespace
+ GetExport().EndElement( XML_NAMESPACE_TEXT, eElement, sal_True);
+ GetExport().IgnorableWhitespace();
+ }
+ else
+ {
+ OSL_FAIL("Need element name!");
+ }
+ }
+ // else: autostyles -> ignore
+}
+
+void XMLSectionExport::ExportIndexStart(
+ const Reference<XDocumentIndex> & rIndex)
+{
+ // get PropertySet
+ Reference<XPropertySet> xPropertySet(rIndex, UNO_QUERY);
+
+ switch (MapSectionType(rIndex->getServiceName()))
+ {
+ case TEXT_SECTION_TYPE_TOC:
+ ExportTableOfContentStart(xPropertySet);
+ break;
+
+ case TEXT_SECTION_TYPE_ILLUSTRATION:
+ ExportIllustrationIndexStart(xPropertySet);
+ break;
+
+ case TEXT_SECTION_TYPE_ALPHABETICAL:
+ ExportAlphabeticalIndexStart(xPropertySet);
+ break;
+
+ case TEXT_SECTION_TYPE_TABLE:
+ ExportTableIndexStart(xPropertySet);
+ break;
+
+ case TEXT_SECTION_TYPE_OBJECT:
+ ExportObjectIndexStart(xPropertySet);
+ break;
+
+ case TEXT_SECTION_TYPE_USER:
+ ExportUserIndexStart(xPropertySet);
+ break;
+
+ case TEXT_SECTION_TYPE_BIBLIOGRAPHY:
+ ExportBibliographyStart(xPropertySet);
+ break;
+
+ default:
+ // skip index
+ OSL_FAIL("unknown index type");
+ break;
+ }
+}
+
+void XMLSectionExport::ExportIndexHeaderStart(
+ const Reference<XTextSection> & rSection)
+{
+ // export name, dammit!
+ Reference<XNamed> xName(rSection, UNO_QUERY);
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_NAME, xName->getName());
+
+ // format already handled -> export only start element
+ GetExport().StartElement( XML_NAMESPACE_TEXT, XML_INDEX_TITLE, sal_True );
+ GetExport().IgnorableWhitespace();
+}
+
+
+SvXMLEnumStringMapEntry const aIndexTypeMap[] =
+{
+ ENUM_STRING_MAP_ENTRY( "com.sun.star.text.ContentIndex", TEXT_SECTION_TYPE_TOC ),
+ ENUM_STRING_MAP_ENTRY( "com.sun.star.text.DocumentIndex", TEXT_SECTION_TYPE_ALPHABETICAL ),
+ ENUM_STRING_MAP_ENTRY( "com.sun.star.text.TableIndex", TEXT_SECTION_TYPE_TABLE ),
+ ENUM_STRING_MAP_ENTRY( "com.sun.star.text.ObjectIndex", TEXT_SECTION_TYPE_OBJECT ),
+ ENUM_STRING_MAP_ENTRY( "com.sun.star.text.Bibliography", TEXT_SECTION_TYPE_BIBLIOGRAPHY ),
+ ENUM_STRING_MAP_ENTRY( "com.sun.star.text.UserIndex", TEXT_SECTION_TYPE_USER ),
+ ENUM_STRING_MAP_ENTRY( "com.sun.star.text.IllustrationsIndex", TEXT_SECTION_TYPE_ILLUSTRATION ),
+ ENUM_STRING_MAP_END()
+};
+
+enum SectionTypeEnum XMLSectionExport::MapSectionType(
+ const OUString& rServiceName)
+{
+ enum SectionTypeEnum eType = TEXT_SECTION_TYPE_UNKNOWN;
+
+ sal_uInt16 nTmp;
+ if (SvXMLUnitConverter::convertEnum(nTmp, rServiceName, aIndexTypeMap))
+ {
+ eType = (enum SectionTypeEnum)nTmp;
+ }
+
+ // TODO: index header section types, etc.
+
+ return eType;
+}
+
+void XMLSectionExport::ExportRegularSectionStart(
+ const Reference<XTextSection> & rSection)
+{
+ // style name already handled in ExportSectionStart(...)
+
+ Reference<XNamed> xName(rSection, UNO_QUERY);
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_NAME, xName->getName());
+
+ // get XPropertySet for other values
+ Reference<XPropertySet> xPropSet(rSection, UNO_QUERY);
+ Any aAny;
+
+ // condition and display
+ aAny = xPropSet->getPropertyValue(sCondition);
+ OUString sCond;
+ aAny >>= sCond;
+ enum XMLTokenEnum eDisplay = XML_TOKEN_INVALID;
+ if (sCond.getLength() > 0)
+ {
+ OUString sQValue =
+ GetExport().GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_OOOW,
+ sCond, sal_False );
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_CONDITION, sQValue);
+ eDisplay = XML_CONDITION;
+
+ // #97450# store hidden-status (of conditional sections only)
+ aAny = xPropSet->getPropertyValue(sIsCurrentlyVisible);
+ if (! *(sal_Bool*)aAny.getValue())
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_IS_HIDDEN,
+ XML_TRUE);
+ }
+ }
+ else
+ {
+ eDisplay = XML_NONE;
+ }
+ aAny = xPropSet->getPropertyValue(sIsVisible);
+ if (! *(sal_Bool*)aAny.getValue())
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_DISPLAY, eDisplay);
+ }
+
+ // protect + protection key
+ aAny = xPropSet->getPropertyValue(sIsProtected);
+ if (*(sal_Bool*)aAny.getValue())
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_PROTECTED, XML_TRUE);
+ }
+ Sequence<sal_Int8> aPassword;
+ xPropSet->getPropertyValue(sProtectionKey) >>= aPassword;
+ if (aPassword.getLength() > 0)
+ {
+ OUStringBuffer aBuffer;
+ SvXMLUnitConverter::encodeBase64(aBuffer, aPassword);
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_PROTECTION_KEY,
+ aBuffer.makeStringAndClear());
+ }
+
+ // export element
+ GetExport().IgnorableWhitespace();
+ GetExport().StartElement( XML_NAMESPACE_TEXT, XML_SECTION, sal_True );
+
+ // data source
+ // unfortunately, we have to test all relevant strings for non-zero length
+ aAny = xPropSet->getPropertyValue(sFileLink);
+ SectionFileLink aFileLink;
+ aAny >>= aFileLink;
+
+ aAny = xPropSet->getPropertyValue(sLinkRegion);
+ OUString sRegionName;
+ aAny >>= sRegionName;
+
+ if ( (aFileLink.FileURL.getLength() > 0) ||
+ (aFileLink.FilterName.getLength() > 0) ||
+ (sRegionName.getLength() > 0) )
+ {
+ if (aFileLink.FileURL.getLength() > 0)
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_XLINK, XML_HREF,
+ GetExport().GetRelativeReference( aFileLink.FileURL) );
+ }
+
+ if (aFileLink.FilterName.getLength() > 0)
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_FILTER_NAME,
+ aFileLink.FilterName);
+ }
+
+ if (sRegionName.getLength() > 0)
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_SECTION_NAME,
+ sRegionName);
+ }
+
+ SvXMLElementExport aElem(GetExport(),
+ XML_NAMESPACE_TEXT, XML_SECTION_SOURCE,
+ sal_True, sal_True);
+ }
+ else
+ {
+ // check for DDE first
+ if (xPropSet->getPropertySetInfo()->hasPropertyByName(sDdeCommandFile))
+ {
+ // data source DDE
+ // unfortunately, we have to test all relevant strings for
+ // non-zero length
+ aAny = xPropSet->getPropertyValue(sDdeCommandFile);
+ OUString sApplication;
+ aAny >>= sApplication;
+ aAny = xPropSet->getPropertyValue(sDdeCommandType);
+ OUString sTopic;
+ aAny >>= sTopic;
+ aAny = xPropSet->getPropertyValue(sDdeCommandElement);
+ OUString sItem;
+ aAny >>= sItem;
+
+ if ( (sApplication.getLength() > 0) ||
+ (sTopic.getLength() > 0) ||
+ (sItem.getLength() > 0 ) )
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_OFFICE,
+ XML_DDE_APPLICATION, sApplication);
+ GetExport().AddAttribute(XML_NAMESPACE_OFFICE, XML_DDE_TOPIC,
+ sTopic);
+ GetExport().AddAttribute(XML_NAMESPACE_OFFICE, XML_DDE_ITEM,
+ sItem);
+
+ aAny = xPropSet->getPropertyValue(sIsAutomaticUpdate);
+ if (*(sal_Bool*)aAny.getValue())
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_OFFICE,
+ XML_AUTOMATIC_UPDATE, XML_TRUE);
+ }
+
+ SvXMLElementExport aElem(GetExport(),
+ XML_NAMESPACE_OFFICE,
+ XML_DDE_SOURCE, sal_True, sal_True);
+ }
+ // else: no DDE data source
+ }
+ // else: no DDE on this system
+ }
+}
+
+void XMLSectionExport::ExportTableOfContentStart(
+ const Reference<XPropertySet> & rPropertySet)
+{
+ // export TOC element start
+ ExportBaseIndexStart(XML_TABLE_OF_CONTENT, rPropertySet);
+
+ // scope for table-of-content-source element
+ {
+
+ Any aAny;
+
+ // TOC specific index source attributes:
+
+ // outline-level: 1..10
+ sal_Int16 nLevel = sal_Int16();
+ if( rPropertySet->getPropertyValue(sLevel) >>= nLevel )
+ {
+ OUStringBuffer sBuffer;
+ SvXMLUnitConverter::convertNumber(sBuffer, (sal_Int32)nLevel);
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT,
+ XML_OUTLINE_LEVEL,
+ sBuffer.makeStringAndClear());
+ }
+
+ // use outline level
+ ExportBoolean(rPropertySet, sCreateFromOutline,
+ XML_USE_OUTLINE_LEVEL, sal_True);
+
+ // use index marks
+ ExportBoolean(rPropertySet, sCreateFromMarks,
+ XML_USE_INDEX_MARKS, sal_True);
+
+ // use level styles
+ ExportBoolean(rPropertySet, sCreateFromLevelParagraphStyles,
+ XML_USE_INDEX_SOURCE_STYLES, sal_False);
+
+ ExportBaseIndexSource(TEXT_SECTION_TYPE_TOC, rPropertySet);
+ }
+
+ ExportBaseIndexBody(TEXT_SECTION_TYPE_TOC, rPropertySet);
+}
+
+void XMLSectionExport::ExportObjectIndexStart(
+ const Reference<XPropertySet> & rPropertySet)
+{
+ // export index start
+ ExportBaseIndexStart(XML_OBJECT_INDEX, rPropertySet);
+
+ // scope for index source element
+ {
+ ExportBoolean(rPropertySet, sCreateFromOtherEmbeddedObjects,
+ XML_USE_OTHER_OBJECTS, sal_False);
+ ExportBoolean(rPropertySet, sCreateFromStarCalc,
+ XML_USE_SPREADSHEET_OBJECTS, sal_False);
+ ExportBoolean(rPropertySet, sCreateFromStarChart,
+ XML_USE_CHART_OBJECTS, sal_False);
+ ExportBoolean(rPropertySet, sCreateFromStarDraw,
+ XML_USE_DRAW_OBJECTS, sal_False);
+ ExportBoolean(rPropertySet, sCreateFromStarMath,
+ XML_USE_MATH_OBJECTS, sal_False);
+
+ ExportBaseIndexSource(TEXT_SECTION_TYPE_OBJECT, rPropertySet);
+ }
+
+ ExportBaseIndexBody(TEXT_SECTION_TYPE_OBJECT, rPropertySet);
+}
+
+void XMLSectionExport::ExportIllustrationIndexStart(
+ const Reference<XPropertySet> & rPropertySet)
+{
+ // export index start
+ ExportBaseIndexStart(XML_ILLUSTRATION_INDEX, rPropertySet);
+
+ // scope for index source element
+ {
+ // export common attributes for illustration and table indices
+ ExportTableAndIllustrationIndexSourceAttributes(rPropertySet);
+
+ ExportBaseIndexSource(TEXT_SECTION_TYPE_ILLUSTRATION, rPropertySet);
+ }
+
+ ExportBaseIndexBody(TEXT_SECTION_TYPE_ILLUSTRATION, rPropertySet);
+}
+
+void XMLSectionExport::ExportTableIndexStart(
+ const Reference<XPropertySet> & rPropertySet)
+{
+ // export index start
+ ExportBaseIndexStart(XML_TABLE_INDEX, rPropertySet);
+
+ // scope for index source element
+ {
+ // export common attributes for illustration and table indices
+ ExportTableAndIllustrationIndexSourceAttributes(rPropertySet);
+
+ ExportBaseIndexSource(TEXT_SECTION_TYPE_TABLE, rPropertySet);
+ }
+
+ ExportBaseIndexBody(TEXT_SECTION_TYPE_TABLE, rPropertySet);
+}
+
+void XMLSectionExport::ExportAlphabeticalIndexStart(
+ const Reference<XPropertySet> & rPropertySet)
+{
+ // export TOC element start
+ ExportBaseIndexStart(XML_ALPHABETICAL_INDEX, rPropertySet);
+
+ // scope for table-of-content-source element
+ {
+
+ // style name (if present)
+ Any aAny;
+ aAny = rPropertySet->getPropertyValue(sMainEntryCharacterStyleName);
+ OUString sStyleName;
+ aAny >>= sStyleName;
+ if (sStyleName.getLength())
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT,
+ XML_MAIN_ENTRY_STYLE_NAME,
+ GetExport().EncodeStyleName( sStyleName ));
+ }
+
+ // other (boolean) attributes
+ ExportBoolean(rPropertySet, sIsCaseSensitive, XML_IGNORE_CASE,
+ sal_False, sal_True);
+ ExportBoolean(rPropertySet, sUseAlphabeticalSeparators,
+ XML_ALPHABETICAL_SEPARATORS, sal_False);
+ ExportBoolean(rPropertySet, sUseCombinedEntries, XML_COMBINE_ENTRIES,
+ sal_True);
+ ExportBoolean(rPropertySet, sUseDash, XML_COMBINE_ENTRIES_WITH_DASH,
+ sal_False);
+ ExportBoolean(rPropertySet, sUseKeyAsEntry, XML_USE_KEYS_AS_ENTRIES,
+ sal_False);
+ ExportBoolean(rPropertySet, sUsePP, XML_COMBINE_ENTRIES_WITH_PP,
+ sal_True);
+ ExportBoolean(rPropertySet, sUseUpperCase, XML_CAPITALIZE_ENTRIES,
+ sal_False);
+ ExportBoolean(rPropertySet, sIsCommaSeparated, XML_COMMA_SEPARATED,
+ sal_False);
+
+ // sort algorithm
+ aAny = rPropertySet->getPropertyValue(sSortAlgorithm);
+ OUString sAlgorithm;
+ aAny >>= sAlgorithm;
+ if (sAlgorithm.getLength() > 0)
+ {
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_SORT_ALGORITHM,
+ sAlgorithm );
+ }
+
+ // locale
+ aAny = rPropertySet->getPropertyValue(sLocale);
+ Locale aLocale;
+ aAny >>= aLocale;
+ GetExport().AddAttribute(XML_NAMESPACE_FO, XML_LANGUAGE,
+ aLocale.Language);
+ GetExport().AddAttribute(XML_NAMESPACE_FO, XML_COUNTRY,
+ aLocale.Country);
+
+ ExportBaseIndexSource(TEXT_SECTION_TYPE_ALPHABETICAL, rPropertySet);
+ }
+
+ ExportBaseIndexBody(TEXT_SECTION_TYPE_ALPHABETICAL, rPropertySet);
+}
+
+void XMLSectionExport::ExportUserIndexStart(
+ const Reference<XPropertySet> & rPropertySet)
+{
+ // export TOC element start
+ ExportBaseIndexStart(XML_USER_INDEX, rPropertySet);
+
+ // scope for table-of-content-source element
+ {
+ // bool attributes
+ ExportBoolean(rPropertySet, sCreateFromEmbeddedObjects,
+ XML_USE_OBJECTS, sal_False);
+ ExportBoolean(rPropertySet, sCreateFromGraphicObjects,
+ XML_USE_GRAPHICS, sal_False);
+ ExportBoolean(rPropertySet, sCreateFromMarks,
+ XML_USE_INDEX_MARKS, sal_False);
+ ExportBoolean(rPropertySet, sCreateFromTables,
+ XML_USE_TABLES, sal_False);
+ ExportBoolean(rPropertySet, sCreateFromTextFrames,
+ XML_USE_FLOATING_FRAMES, sal_False);
+ ExportBoolean(rPropertySet, sUseLevelFromSource,
+ XML_COPY_OUTLINE_LEVELS, sal_False);
+ ExportBoolean(rPropertySet, sCreateFromLevelParagraphStyles,
+ XML_USE_INDEX_SOURCE_STYLES, sal_False);
+
+ Any aAny = rPropertySet->getPropertyValue( sUserIndexName );
+ OUString sIndexName;
+ aAny >>= sIndexName;
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_INDEX_NAME,
+ sIndexName);
+
+ ExportBaseIndexSource(TEXT_SECTION_TYPE_USER, rPropertySet);
+ }
+
+ ExportBaseIndexBody(TEXT_SECTION_TYPE_USER, rPropertySet);
+}
+
+void XMLSectionExport::ExportBibliographyStart(
+ const Reference<XPropertySet> & rPropertySet)
+{
+ // export TOC element start
+ ExportBaseIndexStart(XML_BIBLIOGRAPHY, rPropertySet);
+
+ // scope for table-of-content-source element
+ {
+ // No attributes. Fine.
+
+ ExportBaseIndexSource(TEXT_SECTION_TYPE_BIBLIOGRAPHY, rPropertySet);
+ }
+
+ ExportBaseIndexBody(TEXT_SECTION_TYPE_BIBLIOGRAPHY, rPropertySet);
+}
+
+
+void XMLSectionExport::ExportBaseIndexStart(
+ XMLTokenEnum eElement,
+ const Reference<XPropertySet> & rPropertySet)
+{
+ // protect + protection key
+ Any aAny = rPropertySet->getPropertyValue(sIsProtected);
+ if (*(sal_Bool*)aAny.getValue())
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_PROTECTED, XML_TRUE);
+ }
+
+ // index name
+ OUString sIndexName;
+ rPropertySet->getPropertyValue(sName) >>= sIndexName;
+ if ( sIndexName.getLength() > 0 )
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_NAME, sIndexName);
+ }
+
+ // index Element start
+ GetExport().IgnorableWhitespace();
+ GetExport().StartElement( XML_NAMESPACE_TEXT, eElement, sal_False );
+}
+
+static const XMLTokenEnum aTypeSourceElementNameMap[] =
+{
+ XML_TABLE_OF_CONTENT_SOURCE, // TOC
+ XML_TABLE_INDEX_SOURCE, // table index
+ XML_ILLUSTRATION_INDEX_SOURCE, // illustration index
+ XML_OBJECT_INDEX_SOURCE, // object index
+ XML_USER_INDEX_SOURCE, // user index
+ XML_ALPHABETICAL_INDEX_SOURCE, // alphabetical index
+ XML_BIBLIOGRAPHY_SOURCE // bibliography
+};
+
+void XMLSectionExport::ExportBaseIndexSource(
+ SectionTypeEnum eType,
+ const Reference<XPropertySet> & rPropertySet)
+{
+ // check type
+ OSL_ENSURE(eType >= TEXT_SECTION_TYPE_TOC, "illegal index type");
+ OSL_ENSURE(eType <= TEXT_SECTION_TYPE_BIBLIOGRAPHY, "illegal index type");
+
+ Any aAny;
+
+ // common attributes; not supported by bibliography
+ if (eType != TEXT_SECTION_TYPE_BIBLIOGRAPHY)
+ {
+ // document or chapter index?
+ aAny = rPropertySet->getPropertyValue(sCreateFromChapter);
+ if (*(sal_Bool*)aAny.getValue())
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT,
+ XML_INDEX_SCOPE, XML_CHAPTER);
+ }
+
+ // tab-stops relative to margin?
+ aAny = rPropertySet->getPropertyValue(sIsRelativeTabstops);
+ if (! *(sal_Bool*)aAny.getValue())
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT,
+ XML_RELATIVE_TAB_STOP_POSITION,
+ XML_FALSE);
+ }
+ }
+
+ // the index source element (all indices)
+ SvXMLElementExport aElem(GetExport(),
+ XML_NAMESPACE_TEXT,
+ GetXMLToken(
+ aTypeSourceElementNameMap[
+ eType - TEXT_SECTION_TYPE_TOC]),
+ sal_True, sal_True);
+
+ // scope for title template (all indices)
+ {
+ // header style name
+ aAny = rPropertySet->getPropertyValue(sParaStyleHeading);
+ OUString sStyleName;
+ aAny >>= sStyleName;
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT,
+ XML_STYLE_NAME,
+ GetExport().EncodeStyleName( sStyleName ));
+
+ // title template
+ SvXMLElementExport aHeaderTemplate(GetExport(),
+ XML_NAMESPACE_TEXT,
+ XML_INDEX_TITLE_TEMPLATE,
+ sal_True, sal_False);
+
+ // title as element content
+ aAny = rPropertySet->getPropertyValue(sTitle);
+ OUString sTitleString;
+ aAny >>= sTitleString;
+ GetExport().Characters(sTitleString);
+ }
+
+ // export level templates (all indices)
+ aAny = rPropertySet->getPropertyValue(sLevelFormat);
+ Reference<XIndexReplace> xLevelTemplates;
+ aAny >>= xLevelTemplates;
+
+ // iterate over level formats;
+ // skip element 0 (empty template for title)
+ sal_Int32 nLevelCount = xLevelTemplates->getCount();
+ for(sal_Int32 i = 1; i<nLevelCount; i++)
+ {
+ // get sequence
+ Sequence<PropertyValues> aTemplateSequence;
+ aAny = xLevelTemplates->getByIndex(i);
+ aAny >>= aTemplateSequence;
+
+ // export the sequence (abort export if an error occurred; #91214#)
+ sal_Bool bResult =
+ ExportIndexTemplate(eType, i, rPropertySet, aTemplateSequence);
+ if ( !bResult )
+ break;
+ }
+
+ // only TOC and user index:
+ // styles from which to build the index (LevelParagraphStyles)
+ if ( (TEXT_SECTION_TYPE_TOC == eType) ||
+ (TEXT_SECTION_TYPE_USER == eType) )
+ {
+ aAny = rPropertySet->getPropertyValue(sLevelParagraphStyles);
+ Reference<XIndexReplace> xLevelParagraphStyles;
+ aAny >>= xLevelParagraphStyles;
+ ExportLevelParagraphStyles(xLevelParagraphStyles);
+ }
+}
+
+
+void XMLSectionExport::ExportBaseIndexBody(
+ SectionTypeEnum
+ #if OSL_DEBUG_LEVEL > 0
+ eType
+ #endif
+ ,
+ const Reference<XPropertySet> &)
+{
+ // type not used; checked anyway.
+ OSL_ENSURE(eType >= TEXT_SECTION_TYPE_TOC, "illegal index type");
+ OSL_ENSURE(eType <= TEXT_SECTION_TYPE_BIBLIOGRAPHY, "illegal index type");
+
+ // export start only
+
+ // any old attributes?
+ GetExport().CheckAttrList();
+
+ // start surrounded by whitespace
+ GetExport().IgnorableWhitespace();
+ GetExport().StartElement( XML_NAMESPACE_TEXT, XML_INDEX_BODY, sal_True );
+}
+
+void XMLSectionExport::ExportTableAndIllustrationIndexSourceAttributes(
+ const Reference<XPropertySet> & rPropertySet)
+{
+ // use caption
+ Any aAny = rPropertySet->getPropertyValue(sCreateFromLabels);
+ if (! *(sal_Bool*)aAny.getValue())
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT,
+ XML_USE_CAPTION, XML_FALSE);
+ }
+
+ // sequence name
+ aAny = rPropertySet->getPropertyValue(sLabelCategory);
+ OUString sSequenceName;
+ aAny >>= sSequenceName;
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT,
+ XML_CAPTION_SEQUENCE_NAME,
+ sSequenceName);
+
+ // caption format
+ aAny = rPropertySet->getPropertyValue(sLabelDisplayType);
+ sal_Int16 nType = 0;
+ aAny >>= nType;
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT,
+ XML_CAPTION_SEQUENCE_FORMAT,
+ XMLTextFieldExport::MapReferenceType(nType));
+}
+
+
+// map index of LevelFormats to attribute value;
+// level 0 is always the header
+static const XMLTokenEnum aLevelNameTOCMap[] =
+ { XML_TOKEN_INVALID, XML_1, XML_2, XML_3, XML_4, XML_5, XML_6, XML_7,
+ XML_8, XML_9, XML_10, XML_TOKEN_INVALID };
+static const XMLTokenEnum aLevelNameTableMap[] =
+ { XML_TOKEN_INVALID, XML__EMPTY, XML_TOKEN_INVALID };
+static const XMLTokenEnum aLevelNameAlphaMap[] =
+ { XML_TOKEN_INVALID, XML_SEPARATOR, XML_1, XML_2, XML_3, XML_TOKEN_INVALID };
+static const XMLTokenEnum aLevelNameBibliographyMap[] =
+ { XML_TOKEN_INVALID, XML_ARTICLE, XML_BOOK, XML_BOOKLET, XML_CONFERENCE,
+ XML_CUSTOM1, XML_CUSTOM2, XML_CUSTOM3, XML_CUSTOM4,
+ XML_CUSTOM5, XML_EMAIL, XML_INBOOK, XML_INCOLLECTION,
+ XML_INPROCEEDINGS, XML_JOURNAL,
+ XML_MANUAL, XML_MASTERSTHESIS, XML_MISC, XML_PHDTHESIS,
+ XML_PROCEEDINGS, XML_TECHREPORT, XML_UNPUBLISHED, XML_WWW,
+ XML_TOKEN_INVALID };
+
+static const XMLTokenEnum* aTypeLevelNameMap[] =
+{
+ aLevelNameTOCMap, // TOC
+ aLevelNameTableMap, // table index
+ aLevelNameTableMap, // illustration index
+ aLevelNameTableMap, // object index
+ aLevelNameTOCMap, // user index
+ aLevelNameAlphaMap, // alphabetical index
+ aLevelNameBibliographyMap // bibliography
+};
+
+static const sal_Char* aLevelStylePropNameTOCMap[] =
+ { NULL, "ParaStyleLevel1", "ParaStyleLevel2", "ParaStyleLevel3",
+ "ParaStyleLevel4", "ParaStyleLevel5", "ParaStyleLevel6",
+ "ParaStyleLevel7", "ParaStyleLevel8", "ParaStyleLevel9",
+ "ParaStyleLevel10", NULL };
+static const sal_Char* aLevelStylePropNameTableMap[] =
+ { NULL, "ParaStyleLevel1", NULL };
+static const sal_Char* aLevelStylePropNameAlphaMap[] =
+ { NULL, "ParaStyleSeparator", "ParaStyleLevel1", "ParaStyleLevel2",
+ "ParaStyleLevel3", NULL };
+static const sal_Char* aLevelStylePropNameBibliographyMap[] =
+ // TODO: replace with real property names, when available
+ { NULL, "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1",
+ "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1",
+ "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1",
+ "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1",
+ "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1",
+ "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1",
+ "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1",
+ "ParaStyleLevel1",
+ NULL };
+
+static const sal_Char** aTypeLevelStylePropNameMap[] =
+{
+ aLevelStylePropNameTOCMap, // TOC
+ aLevelStylePropNameTableMap, // table index
+ aLevelStylePropNameTableMap, // illustration index
+ aLevelStylePropNameTableMap, // object index
+ aLevelStylePropNameTOCMap, // user index
+ aLevelStylePropNameAlphaMap, // alphabetical index
+ aLevelStylePropNameBibliographyMap // bibliography
+};
+
+static const XMLTokenEnum aTypeLevelAttrMap[] =
+{
+ XML_OUTLINE_LEVEL, // TOC
+ XML_TOKEN_INVALID, // table index
+ XML_TOKEN_INVALID, // illustration index
+ XML_TOKEN_INVALID, // object index
+ XML_OUTLINE_LEVEL, // user index
+ XML_OUTLINE_LEVEL, // alphabetical index
+ XML_BIBLIOGRAPHY_TYPE // bibliography
+};
+
+static const XMLTokenEnum aTypeElementNameMap[] =
+{
+ XML_TABLE_OF_CONTENT_ENTRY_TEMPLATE, // TOC
+ XML_TABLE_INDEX_ENTRY_TEMPLATE, // table index
+ XML_ILLUSTRATION_INDEX_ENTRY_TEMPLATE, // illustration index
+ XML_OBJECT_INDEX_ENTRY_TEMPLATE, // object index
+ XML_USER_INDEX_ENTRY_TEMPLATE, // user index
+ XML_ALPHABETICAL_INDEX_ENTRY_TEMPLATE, // alphabetical index
+ XML_BIBLIOGRAPHY_ENTRY_TEMPLATE // bibliography
+};
+
+
+sal_Bool XMLSectionExport::ExportIndexTemplate(
+ SectionTypeEnum eType,
+ sal_Int32 nOutlineLevel,
+ const Reference<XPropertySet> & rPropertySet,
+ Sequence<Sequence<PropertyValue> > & rValues)
+{
+ OSL_ENSURE(eType >= TEXT_SECTION_TYPE_TOC, "illegal index type");
+ OSL_ENSURE(eType <= TEXT_SECTION_TYPE_BIBLIOGRAPHY, "illegal index type");
+ OSL_ENSURE(nOutlineLevel >= 0, "illegal outline level");
+
+ if ( (eType >= TEXT_SECTION_TYPE_TOC) &&
+ (eType <= TEXT_SECTION_TYPE_BIBLIOGRAPHY) &&
+ (nOutlineLevel >= 0) )
+ {
+ // get level name and level attribute name from aLevelNameMap;
+ const XMLTokenEnum eLevelAttrName(
+ aTypeLevelAttrMap[eType-TEXT_SECTION_TYPE_TOC]);
+ const XMLTokenEnum eLevelName(
+ aTypeLevelNameMap[eType-TEXT_SECTION_TYPE_TOC][nOutlineLevel]);
+
+ // #92124#: some old documents may be broken, then they have
+ // too many template levels; we need to recognize this and
+ // export only as many as is legal for the respective index
+ // type. To do this, we simply return an error flag, which
+ // will then abort further template level exports.
+ OSL_ENSURE(XML_TOKEN_INVALID != eLevelName, "can't find level name");
+ if ( XML_TOKEN_INVALID == eLevelName )
+ {
+ // output level not found? Then end of templates! #91214#
+ return sal_False;
+ }
+
+ // output level name
+ if ((XML_TOKEN_INVALID != eLevelName) && (XML_TOKEN_INVALID != eLevelAttrName))
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT,
+ GetXMLToken(eLevelAttrName),
+ GetXMLToken(eLevelName));
+ }
+
+ // paragraph level style name
+ const sal_Char* pPropName(
+ aTypeLevelStylePropNameMap[eType-TEXT_SECTION_TYPE_TOC][nOutlineLevel]);
+ OSL_ENSURE(NULL != pPropName, "can't find property name");
+ if (NULL != pPropName)
+ {
+ Any aAny = rPropertySet->getPropertyValue(
+ OUString::createFromAscii(pPropName));
+ OUString sParaStyleName;
+ aAny >>= sParaStyleName;
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT,
+ XML_STYLE_NAME,
+ GetExport().EncodeStyleName( sParaStyleName ));
+ }
+
+ // template element
+ const XMLTokenEnum eElementName(
+ aTypeElementNameMap[eType - TEXT_SECTION_TYPE_TOC]);
+ SvXMLElementExport aLevelTemplate(GetExport(),
+ XML_NAMESPACE_TEXT,
+ GetXMLToken(eElementName),
+ sal_True, sal_True);
+
+ // export sequence
+ sal_Int32 nTemplateCount = rValues.getLength();
+ for(sal_Int32 nTemplateNo = 0;
+ nTemplateNo < nTemplateCount;
+ nTemplateNo++)
+ {
+ ExportIndexTemplateElement(
+ eType, //i90246
+ rValues[nTemplateNo]);
+ }
+ }
+
+ return sal_True;
+}
+
+
+enum TemplateTypeEnum
+{
+ TOK_TTYPE_ENTRY_NUMBER,
+ TOK_TTYPE_ENTRY_TEXT,
+ TOK_TTYPE_TAB_STOP,
+ TOK_TTYPE_TEXT,
+ TOK_TTYPE_PAGE_NUMBER,
+ TOK_TTYPE_CHAPTER_INFO,
+ TOK_TTYPE_HYPERLINK_START,
+ TOK_TTYPE_HYPERLINK_END,
+ TOK_TTYPE_BIBLIOGRAPHY,
+ TOK_TTYPE_INVALID
+};
+
+enum TemplateParamEnum
+{
+ TOK_TPARAM_TOKEN_TYPE,
+ TOK_TPARAM_CHAR_STYLE,
+ TOK_TPARAM_TAB_RIGHT_ALIGNED,
+ TOK_TPARAM_TAB_POSITION,
+ TOK_TPARAM_TAB_WITH_TAB, // #i21237#
+ TOK_TPARAM_TAB_FILL_CHAR,
+ TOK_TPARAM_TEXT,
+ TOK_TPARAM_CHAPTER_FORMAT,
+ TOK_TPARAM_CHAPTER_LEVEL,//i53420
+ TOK_TPARAM_BIBLIOGRAPHY_DATA
+};
+
+SvXMLEnumStringMapEntry const aTemplateTypeMap[] =
+{
+ ENUM_STRING_MAP_ENTRY( "TokenEntryNumber", TOK_TTYPE_ENTRY_NUMBER ),
+ ENUM_STRING_MAP_ENTRY( "TokenEntryText", TOK_TTYPE_ENTRY_TEXT ),
+ ENUM_STRING_MAP_ENTRY( "TokenTabStop", TOK_TTYPE_TAB_STOP ),
+ ENUM_STRING_MAP_ENTRY( "TokenText", TOK_TTYPE_TEXT ),
+ ENUM_STRING_MAP_ENTRY( "TokenPageNumber", TOK_TTYPE_PAGE_NUMBER ),
+ ENUM_STRING_MAP_ENTRY( "TokenChapterInfo", TOK_TTYPE_CHAPTER_INFO ),
+ ENUM_STRING_MAP_ENTRY( "TokenHyperlinkStart", TOK_TTYPE_HYPERLINK_START ),
+ ENUM_STRING_MAP_ENTRY( "TokenHyperlinkEnd", TOK_TTYPE_HYPERLINK_END ),
+ ENUM_STRING_MAP_ENTRY( "TokenBibliographyDataField", TOK_TTYPE_BIBLIOGRAPHY ),
+ ENUM_STRING_MAP_END()
+};
+
+SvXMLEnumStringMapEntry const aTemplateParamMap[] =
+{
+ ENUM_STRING_MAP_ENTRY( "TokenType", TOK_TPARAM_TOKEN_TYPE ),
+ ENUM_STRING_MAP_ENTRY( "CharacterStyleName", TOK_TPARAM_CHAR_STYLE ),
+ ENUM_STRING_MAP_ENTRY( "TabStopRightAligned", TOK_TPARAM_TAB_RIGHT_ALIGNED ),
+ ENUM_STRING_MAP_ENTRY( "TabStopPosition", TOK_TPARAM_TAB_POSITION ),
+ ENUM_STRING_MAP_ENTRY( "TabStopFillCharacter", TOK_TPARAM_TAB_FILL_CHAR ),
+ // #i21237#
+ ENUM_STRING_MAP_ENTRY( "WithTab", TOK_TPARAM_TAB_WITH_TAB ),
+ ENUM_STRING_MAP_ENTRY( "Text", TOK_TPARAM_TEXT ),
+ ENUM_STRING_MAP_ENTRY( "ChapterFormat", TOK_TPARAM_CHAPTER_FORMAT ),
+ ENUM_STRING_MAP_ENTRY( "ChapterLevel", TOK_TPARAM_CHAPTER_LEVEL ),//i53420
+ ENUM_STRING_MAP_ENTRY( "BibliographyDataField", TOK_TPARAM_BIBLIOGRAPHY_DATA ),
+ ENUM_STRING_MAP_END()
+};
+
+SvXMLEnumMapEntry const aBibliographyDataFieldMap[] =
+{
+ { XML_ADDRESS, BibliographyDataField::ADDRESS },
+ { XML_ANNOTE, BibliographyDataField::ANNOTE },
+ { XML_AUTHOR, BibliographyDataField::AUTHOR },
+ { XML_BIBLIOGRAPHY_TYPE, BibliographyDataField::BIBILIOGRAPHIC_TYPE },
+ { XML_BOOKTITLE, BibliographyDataField::BOOKTITLE },
+ { XML_CHAPTER, BibliographyDataField::CHAPTER },
+ { XML_CUSTOM1, BibliographyDataField::CUSTOM1 },
+ { XML_CUSTOM2, BibliographyDataField::CUSTOM2 },
+ { XML_CUSTOM3, BibliographyDataField::CUSTOM3 },
+ { XML_CUSTOM4, BibliographyDataField::CUSTOM4 },
+ { XML_CUSTOM5, BibliographyDataField::CUSTOM5 },
+ { XML_EDITION, BibliographyDataField::EDITION },
+ { XML_EDITOR, BibliographyDataField::EDITOR },
+ { XML_HOWPUBLISHED, BibliographyDataField::HOWPUBLISHED },
+ { XML_IDENTIFIER, BibliographyDataField::IDENTIFIER },
+ { XML_INSTITUTION, BibliographyDataField::INSTITUTION },
+ { XML_ISBN, BibliographyDataField::ISBN },
+ { XML_JOURNAL, BibliographyDataField::JOURNAL },
+ { XML_MONTH, BibliographyDataField::MONTH },
+ { XML_NOTE, BibliographyDataField::NOTE },
+ { XML_NUMBER, BibliographyDataField::NUMBER },
+ { XML_ORGANIZATIONS, BibliographyDataField::ORGANIZATIONS },
+ { XML_PAGES, BibliographyDataField::PAGES },
+ { XML_PUBLISHER, BibliographyDataField::PUBLISHER },
+ { XML_REPORT_TYPE, BibliographyDataField::REPORT_TYPE },
+ { XML_SCHOOL, BibliographyDataField::SCHOOL },
+ { XML_SERIES, BibliographyDataField::SERIES },
+ { XML_TITLE, BibliographyDataField::TITLE },
+ { XML_URL, BibliographyDataField::URL },
+ { XML_VOLUME, BibliographyDataField::VOLUME },
+ { XML_YEAR, BibliographyDataField::YEAR },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+void XMLSectionExport::ExportIndexTemplateElement(
+ SectionTypeEnum eType, //i90246
+ Sequence<PropertyValue> & rValues)
+{
+ // variables for template values
+
+ // char style
+ OUString sCharStyle;
+ sal_Bool bCharStyleOK = sal_False;
+
+ // text
+ OUString sText;
+ sal_Bool bTextOK = sal_False;
+
+ // tab position
+ sal_Bool bRightAligned = sal_False;
+
+ // tab position
+ sal_Int32 nTabPosition = 0;
+ sal_Bool bTabPositionOK = sal_False;
+
+ // fill character
+ OUString sFillChar;
+ sal_Bool bFillCharOK = sal_False;
+
+ // chapter format
+ sal_Int16 nChapterFormat = 0;
+ sal_Bool bChapterFormatOK = sal_False;
+
+ // outline max level
+ sal_Int16 nLevel = 0;
+ sal_Bool bLevelOK = sal_False;
+
+ // Bibliography Data
+ sal_Int16 nBibliographyData = 0;
+ sal_Bool bBibliographyDataOK = sal_False;
+
+ // With Tab Stop #i21237#
+ sal_Bool bWithTabStop = sal_False;
+ sal_Bool bWithTabStopOK = sal_False;
+
+ //i90246, the ODF version being written to is:
+ const SvtSaveOptions::ODFDefaultVersion aODFVersion = rExport.getDefaultVersion();
+ //the above version cannot be used for old OOo (OOo 1.0) formats!
+
+ // token type
+ enum TemplateTypeEnum nTokenType = TOK_TTYPE_INVALID;
+
+ sal_Int32 nCount = rValues.getLength();
+ for(sal_Int32 i = 0; i<nCount; i++)
+ {
+ sal_uInt16 nToken;
+ if ( SvXMLUnitConverter::convertEnum( nToken, rValues[i].Name,
+ aTemplateParamMap ) )
+ {
+ // Only use direct and default values.
+ // Wrong. no property states, so ignore.
+ // if ( (beans::PropertyState_DIRECT_VALUE == rValues[i].State) ||
+ // (beans::PropertyState_DEFAULT_VALUE == rValues[i].State) )
+
+ switch (nToken)
+ {
+ case TOK_TPARAM_TOKEN_TYPE:
+ {
+ sal_uInt16 nTmp;
+ OUString sVal;
+ rValues[i].Value >>= sVal;
+ if (SvXMLUnitConverter::convertEnum( nTmp, sVal,
+ aTemplateTypeMap))
+ {
+ nTokenType = (enum TemplateTypeEnum)nTmp;
+ }
+ break;
+ }
+
+ case TOK_TPARAM_CHAR_STYLE:
+ // only valid, if not empty
+ rValues[i].Value >>= sCharStyle;
+ bCharStyleOK = sCharStyle.getLength() > 0;
+ break;
+
+ case TOK_TPARAM_TEXT:
+ rValues[i].Value >>= sText;
+ bTextOK = sal_True;
+ break;
+
+ case TOK_TPARAM_TAB_RIGHT_ALIGNED:
+ bRightAligned =
+ *(sal_Bool *)rValues[i].Value.getValue();
+ break;
+
+ case TOK_TPARAM_TAB_POSITION:
+ rValues[i].Value >>= nTabPosition;
+ bTabPositionOK = sal_True;
+ break;
+
+ // #i21237#
+ case TOK_TPARAM_TAB_WITH_TAB:
+ bWithTabStop = *(sal_Bool *)rValues[i].Value.getValue();
+ bWithTabStopOK = sal_True;
+ break;
+
+ case TOK_TPARAM_TAB_FILL_CHAR:
+ rValues[i].Value >>= sFillChar;
+ bFillCharOK = sal_True;
+ break;
+
+ case TOK_TPARAM_CHAPTER_FORMAT:
+ rValues[i].Value >>= nChapterFormat;
+ bChapterFormatOK = sal_True;
+ break;
+//---> i53420
+ case TOK_TPARAM_CHAPTER_LEVEL:
+ rValues[i].Value >>= nLevel;
+ bLevelOK = sal_True;
+ break;
+//<---
+ case TOK_TPARAM_BIBLIOGRAPHY_DATA:
+ rValues[i].Value >>= nBibliographyData;
+ bBibliographyDataOK = sal_True;
+ break;
+ }
+ }
+ }
+
+ // convert type to token (and check validity) ...
+ XMLTokenEnum eElement(XML_TOKEN_INVALID);
+ switch(nTokenType)
+ {
+ case TOK_TTYPE_ENTRY_TEXT:
+ eElement = XML_INDEX_ENTRY_TEXT;
+ break;
+ case TOK_TTYPE_TAB_STOP:
+ // test validity
+ if ( bRightAligned || bTabPositionOK || bFillCharOK )
+ {
+ eElement = XML_INDEX_ENTRY_TAB_STOP;
+ }
+ break;
+ case TOK_TTYPE_TEXT:
+ // test validity
+ if (bTextOK)
+ {
+ eElement = XML_INDEX_ENTRY_SPAN;
+ }
+ break;
+ case TOK_TTYPE_PAGE_NUMBER:
+ eElement = XML_INDEX_ENTRY_PAGE_NUMBER;
+ break;
+ case TOK_TTYPE_CHAPTER_INFO: // keyword index
+ eElement = XML_INDEX_ENTRY_CHAPTER;
+ break;
+ case TOK_TTYPE_ENTRY_NUMBER: // table of content
+ eElement = XML_INDEX_ENTRY_CHAPTER;
+ break;
+ case TOK_TTYPE_HYPERLINK_START:
+ eElement = XML_INDEX_ENTRY_LINK_START;
+ break;
+ case TOK_TTYPE_HYPERLINK_END:
+ eElement = XML_INDEX_ENTRY_LINK_END;
+ break;
+ case TOK_TTYPE_BIBLIOGRAPHY:
+ if (bBibliographyDataOK)
+ {
+ eElement = XML_INDEX_ENTRY_BIBLIOGRAPHY;
+ }
+ break;
+ default:
+ ; // unknown/unimplemented template
+ break;
+ }
+
+ //--->i90246
+ //check the ODF version being exported
+ if( aODFVersion == SvtSaveOptions::ODFVER_011
+ || aODFVersion == SvtSaveOptions::ODFVER_010)
+ {
+ bLevelOK = sal_False;
+ if (TOK_TTYPE_CHAPTER_INFO == nTokenType)
+ {
+ //if we are emitting for ODF 1.1 or 1.0, this information can be used for alphabetical index only
+ //it's not permitted in other indexes
+ if (eType != TEXT_SECTION_TYPE_ALPHABETICAL)
+ {
+ eElement = XML_TOKEN_INVALID; //not permitted, invalidate the element
+ }
+ else //maps format for 1.1 & 1.0
+ {
+ // a few word here: OOo up to 2.4 uses the field chapter info in Alphabetical index
+ // in a way different from the ODF 1.1/1.0 specification:
+ //
+ // ODF1.1/1.0 OOo display in chapter info ODF1.2
+ // (used in alphabetical index only
+ //
+ // number chapter number without pre/postfix plain-number
+ // number-and-name chapter number without pre/postfix plus title plain-number-and-name
+ //
+ // with issue i89791 the reading of ODF 1.1 and 1.0 was corrected
+ // this one corrects the writing back from ODF 1.2 to ODF 1.1/1.0
+ // unfortunately if there is another application which interprets correctly ODF1.1/1.0,
+ // the resulting alphabetical index will be rendered wrong by OOo 2.4 version
+ //
+ switch( nChapterFormat )
+ {
+ case ChapterFormat::DIGIT:
+ nChapterFormat = ChapterFormat::NUMBER;
+ break;
+ case ChapterFormat::NO_PREFIX_SUFFIX:
+ nChapterFormat = ChapterFormat::NAME_NUMBER;
+ break;
+ }
+ }
+ }
+ else if (TOK_TTYPE_ENTRY_NUMBER == nTokenType)
+ {
+ //in case of ODF 1.1 or 1.0 the only allowed number format is "number"
+ //so, force it...
+ // The only expected 'foreign' nChapterFormat is
+ // ' ChapterFormat::DIGIT', forced to 'none, since the
+ // 'value allowed in ODF 1.1 and 1.0 is 'number' the default
+ // this can be obtained by simply disabling the chapter format
+ bChapterFormatOK = sal_False;
+ }
+ }
+//<---
+
+ // ... and write Element
+ if (eElement != XML_TOKEN_INVALID)
+ {
+ // character style (for most templates)
+ if (bCharStyleOK)
+ {
+ switch (nTokenType)
+ {
+ case TOK_TTYPE_ENTRY_TEXT:
+ case TOK_TTYPE_TEXT:
+ case TOK_TTYPE_PAGE_NUMBER:
+ case TOK_TTYPE_ENTRY_NUMBER:
+ case TOK_TTYPE_HYPERLINK_START:
+ case TOK_TTYPE_HYPERLINK_END:
+ case TOK_TTYPE_BIBLIOGRAPHY:
+ case TOK_TTYPE_CHAPTER_INFO:
+ case TOK_TTYPE_TAB_STOP:
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT,
+ XML_STYLE_NAME,
+ GetExport().EncodeStyleName( sCharStyle) );
+ break;
+ default:
+ ; // nothing: no character style
+ break;
+ }
+ }
+
+ // tab properties
+ if (TOK_TTYPE_TAB_STOP == nTokenType)
+ {
+ // tab type
+ GetExport().AddAttribute(XML_NAMESPACE_STYLE, XML_TYPE,
+ bRightAligned ? XML_RIGHT : XML_LEFT);
+
+ if (bTabPositionOK && (! bRightAligned))
+ {
+ // position for left tabs (convert to measure)
+ OUStringBuffer sBuf;
+ GetExport().GetMM100UnitConverter().convertMeasure(sBuf,
+ nTabPosition);
+ GetExport().AddAttribute(XML_NAMESPACE_STYLE,
+ XML_POSITION,
+ sBuf.makeStringAndClear());
+ }
+
+ // fill char ("leader char")
+ if (bFillCharOK && (sFillChar.getLength() > 0))
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_STYLE,
+ XML_LEADER_CHAR, sFillChar);
+ }
+
+ // #i21237#
+ if (bWithTabStopOK && ! bWithTabStop)
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_STYLE,
+ XML_WITH_TAB,
+ XML_FALSE);
+ }
+ }
+
+ // bibliography data
+ if (TOK_TTYPE_BIBLIOGRAPHY == nTokenType)
+ {
+ OSL_ENSURE(bBibliographyDataOK, "need bibl data");
+ OUStringBuffer sBuf;
+ if (SvXMLUnitConverter::convertEnum( sBuf, nBibliographyData,
+ aBibliographyDataFieldMap ) )
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT,
+ XML_BIBLIOGRAPHY_DATA_FIELD,
+ sBuf.makeStringAndClear());
+ }
+ }
+
+ // chapter info
+ if (TOK_TTYPE_CHAPTER_INFO == nTokenType)
+ {
+ OSL_ENSURE(bChapterFormatOK, "need chapter info");
+ GetExport().AddAttribute(
+ XML_NAMESPACE_TEXT, XML_DISPLAY,
+ XMLTextFieldExport::MapChapterDisplayFormat(nChapterFormat));
+//---> i53420
+ if (bLevelOK)
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_OUTLINE_LEVEL,
+ OUString::valueOf((sal_Int32)nLevel));
+//<---
+ }
+
+//--->i53420
+ if (TOK_TTYPE_ENTRY_NUMBER == nTokenType)
+ {
+ if (bChapterFormatOK)
+ GetExport().AddAttribute(
+ XML_NAMESPACE_TEXT, XML_DISPLAY,
+ XMLTextFieldExport::MapChapterDisplayFormat(nChapterFormat));
+
+ if (bLevelOK)
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_OUTLINE_LEVEL,
+ OUString::valueOf((sal_Int32)nLevel));
+ }
+//<---
+ // export template
+ SvXMLElementExport aTemplateElement(GetExport(), XML_NAMESPACE_TEXT,
+ GetXMLToken(eElement),
+ sal_True, sal_False)
+ ;
+
+ // entry text or span element: write text
+ if (TOK_TTYPE_TEXT == nTokenType)
+ {
+ GetExport().Characters(sText);
+ }
+ }
+}
+
+void XMLSectionExport::ExportLevelParagraphStyles(
+ Reference<XIndexReplace> & xLevelParagraphStyles)
+{
+ // iterate over levels
+ sal_Int32 nPLevelCount = xLevelParagraphStyles->getCount();
+ for(sal_Int32 nLevel = 0; nLevel < nPLevelCount; nLevel++)
+ {
+ Any aAny = xLevelParagraphStyles->getByIndex(nLevel);
+ Sequence<OUString> aStyleNames;
+ aAny >>= aStyleNames;
+
+ // export only if at least one style is contained
+ sal_Int32 nNamesCount = aStyleNames.getLength();
+ if (nNamesCount > 0)
+ {
+ // level attribute; we count 1..10; API 0..9
+ OUStringBuffer sBuf;
+ sal_Int32 nLevelPlusOne = nLevel + 1;
+ SvXMLUnitConverter::convertNumber(sBuf, nLevelPlusOne);
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT,
+ XML_OUTLINE_LEVEL,
+ sBuf.makeStringAndClear());
+
+ // source styles element
+ SvXMLElementExport aParaStyles(GetExport(),
+ XML_NAMESPACE_TEXT,
+ XML_INDEX_SOURCE_STYLES,
+ sal_True, sal_True);
+
+ // iterate over styles in this level
+ for(sal_Int32 nName = 0; nName < nNamesCount; nName++)
+ {
+ // stylename attribute
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT,
+ XML_STYLE_NAME,
+ GetExport().EncodeStyleName( aStyleNames[nName]) );
+
+ // element
+ SvXMLElementExport aParaStyle(GetExport(),
+ XML_NAMESPACE_TEXT,
+ XML_INDEX_SOURCE_STYLE,
+ sal_True, sal_False);
+ }
+ }
+ }
+}
+
+void XMLSectionExport::ExportBoolean(
+ const Reference<XPropertySet> & rPropSet,
+ const OUString& sPropertyName,
+ enum XMLTokenEnum eAttributeName,
+ sal_Bool bDefault,
+ sal_Bool bInvert)
+{
+ OSL_ENSURE(eAttributeName != XML_TOKEN_INVALID, "Need attribute name");
+
+ Any aAny = rPropSet->getPropertyValue(sPropertyName);
+ sal_Bool bTmp = *(sal_Bool*)aAny.getValue();
+
+ // value = value ^ bInvert
+ // omit if value == default
+ // negate forces sal_Bool to 0/1, making them comparable
+ if ((!(bTmp ^ bInvert)) != (!bDefault))
+ {
+ // export non-default value (since default is omitted)
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT,
+ eAttributeName,
+ bDefault ? XML_FALSE : XML_TRUE);
+ }
+}
+
+const sal_Char sAPI_FieldMaster_Bibliography[] =
+ "com.sun.star.text.FieldMaster.Bibliography";
+const sal_Char sAPI_SortKey[] = "SortKey";
+const sal_Char sAPI_IsSortAscending[] = "IsSortAscending";
+
+void XMLSectionExport::ExportBibliographyConfiguration(SvXMLExport& rExport)
+{
+ // first: get field master (via text field supplier)
+ Reference<XTextFieldsSupplier> xTextFieldsSupp( rExport.GetModel(),
+ UNO_QUERY );
+ if ( xTextFieldsSupp.is() )
+ {
+ const OUString sFieldMaster_Bibliography(
+ RTL_CONSTASCII_USTRINGPARAM(sAPI_FieldMaster_Bibliography));
+
+ // get bibliography field master
+ Reference<XNameAccess> xMasters =
+ xTextFieldsSupp->getTextFieldMasters();
+ if ( xMasters->hasByName(sFieldMaster_Bibliography) )
+ {
+ Any aAny =
+ xMasters->getByName(sFieldMaster_Bibliography);
+ Reference<XPropertySet> xPropSet;
+ aAny >>= xPropSet;
+
+ OSL_ENSURE( xPropSet.is(), "field master must have XPropSet" );
+
+ const OUString sBracketBefore(
+ RTL_CONSTASCII_USTRINGPARAM("BracketBefore"));
+ const OUString sBracketAfter(
+ RTL_CONSTASCII_USTRINGPARAM("BracketAfter"));
+ const OUString sIsNumberEntries(
+ RTL_CONSTASCII_USTRINGPARAM("IsNumberEntries"));
+ const OUString sIsSortByPosition(
+ RTL_CONSTASCII_USTRINGPARAM("IsSortByPosition"));
+ const OUString sSortKeys(
+ RTL_CONSTASCII_USTRINGPARAM("SortKeys"));
+ const OUString sSortAlgorithm(
+ RTL_CONSTASCII_USTRINGPARAM("SortAlgorithm"));
+ const OUString sLocale(
+ RTL_CONSTASCII_USTRINGPARAM("Locale"));
+
+ OUString sTmp;
+
+ aAny = xPropSet->getPropertyValue(sBracketBefore);
+ aAny >>= sTmp;
+ rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_PREFIX, sTmp);
+
+ aAny = xPropSet->getPropertyValue(sBracketAfter);
+ aAny >>= sTmp;
+ rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_SUFFIX, sTmp);
+
+ aAny = xPropSet->getPropertyValue(sIsNumberEntries);
+ if (*(sal_Bool*)aAny.getValue())
+ {
+ rExport.AddAttribute(XML_NAMESPACE_TEXT,
+ XML_NUMBERED_ENTRIES, XML_TRUE);
+ }
+
+ aAny = xPropSet->getPropertyValue(sIsSortByPosition);
+ if (! *(sal_Bool*)aAny.getValue())
+ {
+ rExport.AddAttribute(XML_NAMESPACE_TEXT,
+ XML_SORT_BY_POSITION, XML_FALSE);
+ }
+
+ // sort algorithm
+ aAny = xPropSet->getPropertyValue(sSortAlgorithm);
+ OUString sAlgorithm;
+ aAny >>= sAlgorithm;
+ if( sAlgorithm.getLength() > 0 )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_TEXT,
+ XML_SORT_ALGORITHM, sAlgorithm );
+ }
+
+ // locale
+ aAny = xPropSet->getPropertyValue(sLocale);
+ Locale aLocale;
+ aAny >>= aLocale;
+ rExport.AddAttribute(XML_NAMESPACE_FO, XML_LANGUAGE,
+ aLocale.Language);
+ rExport.AddAttribute(XML_NAMESPACE_FO, XML_COUNTRY,
+ aLocale.Country);
+
+ // configuration element
+ SvXMLElementExport aElement(rExport, XML_NAMESPACE_TEXT,
+ XML_BIBLIOGRAPHY_CONFIGURATION,
+ sal_True, sal_True);
+
+ // sort keys
+ aAny = xPropSet->getPropertyValue(sSortKeys);
+ Sequence<Sequence<PropertyValue> > aKeys;
+ aAny >>= aKeys;
+ sal_Int32 nKeysCount = aKeys.getLength();
+ for(sal_Int32 nKeys = 0; nKeys < nKeysCount; nKeys++)
+ {
+ Sequence<PropertyValue> & rKey = aKeys[nKeys];
+
+ sal_Int32 nKeyCount = rKey.getLength();
+ for(sal_Int32 nPropertyKey = 0; nPropertyKey < nKeyCount; nPropertyKey++)
+ {
+ PropertyValue& rValue = rKey[nPropertyKey];
+
+ if (rValue.Name.equalsAsciiL(sAPI_SortKey,
+ sizeof(sAPI_SortKey)-1))
+ {
+ sal_Int16 nKey = 0;
+ rValue.Value >>= nKey;
+ OUStringBuffer sBuf;
+ if (SvXMLUnitConverter::convertEnum( sBuf, nKey,
+ aBibliographyDataFieldMap ) )
+ {
+ rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_KEY,
+ sBuf.makeStringAndClear());
+ }
+ }
+ else if (rValue.Name.equalsAsciiL(sAPI_IsSortAscending,
+ sizeof(sAPI_IsSortAscending)-1))
+ {
+ sal_Bool bTmp = *(sal_Bool*)rValue.Value.getValue();
+ rExport.AddAttribute(XML_NAMESPACE_TEXT,
+ XML_SORT_ASCENDING,
+ bTmp ? XML_TRUE : XML_FALSE);
+ }
+ }
+
+ SvXMLElementExport aKeyElem(rExport,
+ XML_NAMESPACE_TEXT, XML_SORT_KEY,
+ sal_True, sal_True);
+ }
+ }
+ }
+}
+
+
+sal_Bool XMLSectionExport::IsMuteSection(
+ const Reference<XTextSection> & rSection) const
+{
+ sal_Bool bRet = sal_False;
+
+ // a section is mute if
+ // 1) it exists
+ // 2) the SaveLinkedSections flag (at the export) is false
+ // 3) the IsGlobalDocumentSection property is true
+ // 4) it is not an Index
+
+ if ( (!rExport.IsSaveLinkedSections()) && rSection.is() )
+ {
+ // walk the section chain and set bRet if any is linked
+ for(Reference<XTextSection> aSection(rSection);
+ aSection.is();
+ aSection = aSection->getParentSection())
+ {
+ // check if it is a global document section (linked or index)
+ Reference<XPropertySet> xPropSet(aSection, UNO_QUERY);
+ if (xPropSet.is())
+ {
+ Any aAny = xPropSet->getPropertyValue(sIsGlobalDocumentSection);
+
+ if ( *(sal_Bool*)aAny.getValue() )
+ {
+ Reference<XDocumentIndex> xIndex;
+ if (! GetIndex(rSection, xIndex))
+ {
+ bRet = sal_True;
+
+ // early out if result is known
+ break;
+ }
+ }
+ }
+ // section has no properties: ignore
+ }
+ }
+ // else: no section, or always save sections: default (false)
+
+ return bRet;
+}
+
+sal_Bool XMLSectionExport::IsMuteSection(
+ const Reference<XTextContent> & rSection,
+ sal_Bool bDefault) const
+{
+ // default: like default argument
+ sal_Bool bRet = bDefault;
+
+ Reference<XPropertySet> xPropSet(rSection->getAnchor(), UNO_QUERY);
+ if (xPropSet.is())
+ {
+ if (xPropSet->getPropertySetInfo()->hasPropertyByName(sTextSection))
+ {
+ Any aAny = xPropSet->getPropertyValue(sTextSection);
+ Reference<XTextSection> xSection;
+ aAny >>= xSection;
+
+ bRet = IsMuteSection(xSection);
+ }
+ // else: return default
+ }
+ // else: return default
+
+ return bRet;
+}
+
+sal_Bool XMLSectionExport::IsInSection(
+ const Reference<XTextSection> & rEnclosingSection,
+ const Reference<XTextContent> & rContent,
+ sal_Bool bDefault)
+{
+ // default: like default argument
+ sal_Bool bRet = bDefault;
+ OSL_ENSURE(rEnclosingSection.is(), "enclosing section expected");
+
+ Reference<XPropertySet> xPropSet(rContent, UNO_QUERY);
+ if (xPropSet.is())
+ {
+ if (xPropSet->getPropertySetInfo()->hasPropertyByName(sTextSection))
+ {
+ Any aAny = xPropSet->getPropertyValue(sTextSection);
+ Reference<XTextSection> xSection;
+ aAny >>= xSection;
+
+ // now walk chain of text sections (if we have one)
+ if (xSection.is())
+ {
+ do
+ {
+ bRet = (rEnclosingSection == xSection);
+ xSection = xSection->getParentSection();
+ }
+ while (!bRet && xSection.is());
+ }
+ else
+ bRet = sal_False; // no section -> can't be inside
+ }
+ // else: no TextSection property -> return default
+ }
+ // else: no XPropertySet -> return default
+
+ return bRet;
+}
+
+
+void XMLSectionExport::ExportMasterDocHeadingDummies()
+{
+ if( bHeadingDummiesExported )
+ return;
+
+ Reference< XChapterNumberingSupplier > xCNSupplier( rExport.GetModel(),
+ UNO_QUERY );
+
+ Reference< XIndexReplace > xChapterNumbering;
+ if( xCNSupplier.is() )
+ xChapterNumbering = xCNSupplier->getChapterNumberingRules();
+
+ if( !xChapterNumbering.is() )
+ return;
+
+ sal_Int32 nCount = xChapterNumbering->getCount();
+ for( sal_Int32 nLevel = 0; nLevel < nCount; nLevel++ )
+ {
+ OUString sStyle;
+ Sequence<PropertyValue> aProperties;
+ xChapterNumbering->getByIndex( nLevel ) >>= aProperties;
+ for( sal_Int32 i = 0; i < aProperties.getLength(); i++ )
+ {
+ if( aProperties[i].Name == sHeadingStyleName )
+ {
+ aProperties[i].Value >>= sStyle;
+ break;
+ }
+ }
+ if( sStyle.getLength() > 0 )
+ {
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME,
+ GetExport().EncodeStyleName( sStyle ) );
+
+ OUStringBuffer sTmp;
+ sTmp.append( nLevel + 1 );
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_LEVEL,
+ sTmp.makeStringAndClear() );
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT, XML_H,
+ sal_True, sal_False );
+ }
+ }
+
+ bHeadingDummiesExported = sal_True;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLSectionExport.hxx b/xmloff/source/text/XMLSectionExport.hxx
new file mode 100644
index 000000000000..fb331c0e8b64
--- /dev/null
+++ b/xmloff/source/text/XMLSectionExport.hxx
@@ -0,0 +1,369 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLSECTIONEXPORT_HXX_
+#define _XMLOFF_XMLSECTIONEXPORT_HXX_
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <xmloff/xmltoken.hxx>
+
+class SvXMLExport;
+class XMLTextParagraphExport;
+namespace com { namespace sun { namespace star {
+ namespace text
+ {
+ class XTextSection;
+ class XDocumentIndex;
+ class XTextContent;
+ }
+ namespace beans
+ {
+ class XPropertySet;
+ }
+ namespace container
+ {
+ class XIndexReplace;
+ }
+} } }
+
+
+enum SectionTypeEnum
+{
+ TEXT_SECTION_TYPE_SECTION,
+
+ // indices: keep index valued together and do not change order,
+ // because they are used to index into array
+ TEXT_SECTION_TYPE_TOC,
+ TEXT_SECTION_TYPE_TABLE,
+ TEXT_SECTION_TYPE_ILLUSTRATION,
+ TEXT_SECTION_TYPE_OBJECT,
+ TEXT_SECTION_TYPE_USER,
+ TEXT_SECTION_TYPE_ALPHABETICAL,
+ TEXT_SECTION_TYPE_BIBLIOGRAPHY,
+
+ // index header sections:
+ TEXT_SECTION_TYPE_HEADER,
+
+ TEXT_SECTION_TYPE_UNKNOWN
+};
+
+
+/**
+ * This class handles the export of sections and indices (which are,
+ * internally, just sections). It is intended to be used only from
+ * within the XMLTextParagraphExport class.
+ */
+class XMLSectionExport
+{
+ const ::rtl::OUString sCondition;
+ const ::rtl::OUString sCreateFromChapter;
+ const ::rtl::OUString sCreateFromEmbeddedObjects;
+ const ::rtl::OUString sCreateFromGraphicObjects;
+ const ::rtl::OUString sCreateFromLabels;
+ const ::rtl::OUString sCreateFromMarks;
+ const ::rtl::OUString sCreateFromOtherEmbeddedObjects;
+ const ::rtl::OUString sCreateFromOutline;
+ const ::rtl::OUString sCreateFromStarCalc;
+ const ::rtl::OUString sCreateFromStarChart;
+ const ::rtl::OUString sCreateFromStarDraw;
+ const ::rtl::OUString sCreateFromStarImage;
+ const ::rtl::OUString sCreateFromStarMath;
+ const ::rtl::OUString sCreateFromTables;
+ const ::rtl::OUString sCreateFromTextFrames;
+ const ::rtl::OUString sDdeCommandElement;
+ const ::rtl::OUString sDdeCommandFile;
+ const ::rtl::OUString sDdeCommandType;
+ const ::rtl::OUString sFileLink;
+ const ::rtl::OUString sIsCaseSensitive;
+ const ::rtl::OUString sIsProtected;
+ const ::rtl::OUString sIsVisible;
+ const ::rtl::OUString sLabelCategory;
+ const ::rtl::OUString sLabelDisplayType;
+ const ::rtl::OUString sLevel;
+ const ::rtl::OUString sLevelFormat;
+ const ::rtl::OUString sLevelParagraphStyles;
+ const ::rtl::OUString sLinkRegion;
+ const ::rtl::OUString sMainEntryCharacterStyleName;
+ const ::rtl::OUString sParaStyleHeading;
+ const ::rtl::OUString sParaStyleLevel;
+ const ::rtl::OUString sTitle;
+ const ::rtl::OUString sName;
+ const ::rtl::OUString sUseAlphabeticalSeparators;
+ const ::rtl::OUString sUseCombinedEntries;
+ const ::rtl::OUString sUseDash;
+ const ::rtl::OUString sUseKeyAsEntry;
+ const ::rtl::OUString sUseLevelFromSource;
+ const ::rtl::OUString sUsePP;
+ const ::rtl::OUString sUseUpperCase;
+ const ::rtl::OUString sIsCommaSeparated;
+ const ::rtl::OUString sIsAutomaticUpdate;
+ const ::rtl::OUString sIsRelativeTabstops;
+ const ::rtl::OUString sCreateFromLevelParagraphStyles;
+ const ::rtl::OUString sDocumentIndex;
+ const ::rtl::OUString sContentSection;
+ const ::rtl::OUString sHeaderSection;
+
+ const ::rtl::OUString sTextSection;
+ const ::rtl::OUString sIsGlobalDocumentSection;
+ const ::rtl::OUString sProtectionKey;
+ const ::rtl::OUString sSortAlgorithm;
+ const ::rtl::OUString sLocale;
+ const ::rtl::OUString sUserIndexName;
+
+ const ::rtl::OUString sIsCurrentlyVisible;
+ const ::rtl::OUString sHeadingStyleName;
+
+ const ::rtl::OUString sEmpty;
+
+ SvXMLExport& rExport;
+ XMLTextParagraphExport& rParaExport;
+
+ sal_Bool bHeadingDummiesExported;
+
+public:
+ XMLSectionExport(SvXMLExport& rExp,
+ XMLTextParagraphExport& rParaExp);
+
+ /**
+ * export section or index start and source elements. This
+ * method handles the section styles, and delegates to the
+ * appropriate section or index method.
+ */
+ void ExportSectionStart(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextSection > & rSection,
+ sal_Bool bAutoStyles);
+
+ /**
+ * export section or index end elements
+ */
+ void ExportSectionEnd(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextSection > & rSection,
+ sal_Bool bAutoStyles);
+
+ /**
+ * Should the content of this section be exported?
+ * (E.g. linked sections in global documents are not always exported)
+ */
+ sal_Bool IsMuteSection(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextSection > & rSection) const;
+
+ /**
+ * XTextContent-version of IsMuteSection(Reference<XTextSection>&)
+ * returns *true* for all non-section elements
+ */
+ sal_Bool IsMuteSection(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextContent > & rSection,
+ /// return value if this content doesn't support the section property
+ sal_Bool bDefault) const;
+
+ /**
+ * Determine whether rContent is contained in rEnclosingSection. If the
+ * current section of rContent can not be determined, return bDefault.
+ */
+ sal_Bool IsInSection(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextSection > & rEnclosingSection,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextContent > & rContent,
+ /// return value if this content doesn't support the section property
+ sal_Bool bDefault);
+
+ /**
+ * Export the configuration element for bibliography indices.
+ *
+ * (This is part of XMLSectionExport because all section- and
+ * index-related items are handled here.)
+ */
+ static void ExportBibliographyConfiguration(SvXMLExport& rExport);
+
+ /** export a heading for every level. This is used by master documents
+ * to not loose the heading information if master documents are exported
+ * without section contents
+ */
+ void ExportMasterDocHeadingDummies();
+
+
+
+protected:
+
+ inline SvXMLExport& GetExport() { return rExport; }
+ inline XMLTextParagraphExport& GetParaExport() { return rParaExport; }
+
+ // export methods for section and index start:
+
+ /// export an index start element.
+ void ExportIndexStart(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XDocumentIndex > & rSection);
+
+ /// export an index header start element.
+ void ExportIndexHeaderStart(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextSection > & rSection);
+
+ /// export a proper section (and source elements)
+ void ExportRegularSectionStart(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextSection > & rSection);
+
+ /// export a table of content (and source element)
+ void ExportTableOfContentStart(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rSection);
+
+ /// export a table index (and source element)
+ void ExportTableIndexStart(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rSection);
+
+ /// export an object index (and source element)
+ void ExportObjectIndexStart(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rSection);
+
+ /// export an illustration index (and source element)
+ void ExportIllustrationIndexStart(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rSection);
+
+ /// export an alphabetical/keyword index (and source element)
+ void ExportAlphabeticalIndexStart(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rSection);
+
+ /// export a user index (and source element)
+ void ExportUserIndexStart(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rSection);
+
+ /// export the bibliography (and source element)
+ void ExportBibliographyStart(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rIndex);
+
+ // helper methods:
+
+ /**
+ * If this section is an index, the index is written in the
+ * rIndex parameter. The return value is sal_True for all "special"
+ * sections.
+ *
+ * Thus we have:
+ * return sal_False: regular section
+ * return sal_True, xIndex is empty: index header section
+ * return sal_True, xIndex is set: index section */
+ sal_Bool GetIndex(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextSection > & rSection,
+ ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XDocumentIndex > & rIndex) const;
+
+ /// map service name to section type
+ enum SectionTypeEnum MapSectionType(const ::rtl::OUString& rSectionName);
+
+ /**
+ * Export the index element start (for all index types).
+ *
+ * All additional attributes (usually none) for the index element
+ * should have been set at GetExport() before calling this method.
+ */
+ void ExportBaseIndexStart(
+ ::xmloff::token::XMLTokenEnum eElement,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rSection);
+
+ /**
+ * Export the index source element (common for all index types).
+ *
+ * All additional attributes for the source element should have
+ * been set at the GetExport() before calling this method.
+ */
+ void ExportBaseIndexSource(
+ SectionTypeEnum eType, /// index type
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rSection);
+
+ /**
+ * Export the index body (common for all index types).
+ */
+ void ExportBaseIndexBody(
+ SectionTypeEnum eType, /// index type
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rSection);
+
+
+ /**
+ * Helper method to export common attributes for table and
+ * illustration indices
+ */
+ void ExportTableAndIllustrationIndexSourceAttributes(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rSection);
+
+ /// export one template for the specific index type
+ sal_Bool ExportIndexTemplate(
+ SectionTypeEnum eType, /// index type
+ sal_Int32 nLevel, /// outline level (if applicable)
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet,
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue> > & rValues);
+
+ /// export a single template element (e.g. span or tab-stop)
+ void ExportIndexTemplateElement(
+ SectionTypeEnum eType, //i90246, needed for ODF 1.0, 1.0 and 1.2 management
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue> & rValues);
+
+ /// export level paragraph styles
+ void ExportLevelParagraphStyles(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XIndexReplace> & xStyles);
+
+
+ /// helper to export boolean properties
+ void ExportBoolean(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet,
+ const ::rtl::OUString& sPropertyName,
+ enum ::xmloff::token::XMLTokenEnum eAttributeName,
+ sal_Bool bDefault,
+ sal_Bool bInvert = sal_False);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLSectionFootnoteConfigExport.cxx b/xmloff/source/text/XMLSectionFootnoteConfigExport.cxx
new file mode 100644
index 000000000000..a420ebb13f8f
--- /dev/null
+++ b/xmloff/source/text/XMLSectionFootnoteConfigExport.cxx
@@ -0,0 +1,203 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLSectionFootnoteConfigExport.hxx"
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmlprmap.hxx>
+#include <com/sun/star/style/NumberingType.hpp>
+#include <xmloff/maptype.hxx>
+
+#include <xmloff/txtprmap.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlnume.hxx>
+#include <tools/debug.hxx>
+
+#ifndef _RTL_USTRING
+#include <rtl/ustring.hxx>
+#endif
+#include <rtl/ustrbuf.hxx>
+
+#include <vector>
+
+
+using namespace ::xmloff::token;
+
+using ::std::vector;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::com::sun::star::style::NumberingType::ARABIC;
+
+
+void XMLSectionFootnoteConfigExport::exportXML(
+ SvXMLExport& rExport,
+ sal_Bool bEndnote,
+ const vector<XMLPropertyState> *pProperties,
+ sal_uInt32
+ #ifdef DBG_UTIL
+ nIdx
+ #endif
+ ,
+ const UniReference<XMLPropertySetMapper> & rMapper)
+{
+ // store and initialize the values
+ sal_Bool bNumOwn = sal_False;
+ sal_Bool bNumRestart = sal_False;
+ sal_Int16 nNumRestartAt = 0;
+ sal_Int16 nNumberingType = ARABIC;
+ OUString sNumPrefix;
+ OUString sNumSuffix;
+ sal_Bool bEnd = sal_False;
+
+ // find entries in property states vector
+ sal_uInt32 nCount = pProperties->size();
+ for(sal_uInt32 i = 0; i < nCount; i++)
+ {
+ const XMLPropertyState& rState = (*pProperties)[i];
+
+ sal_Int16 nContextId = rMapper->GetEntryContextId(rState.mnIndex);
+ if (!bEndnote)
+ {
+ switch (nContextId)
+ {
+ case CTF_SECTION_FOOTNOTE_NUM_OWN:
+ rState.maValue >>= bNumOwn;
+ break;
+ case CTF_SECTION_FOOTNOTE_NUM_RESTART:
+ rState.maValue >>= bNumRestart;
+ break;
+ case CTF_SECTION_FOOTNOTE_NUM_RESTART_AT:
+ rState.maValue >>= nNumRestartAt;
+ break;
+ case CTF_SECTION_FOOTNOTE_NUM_TYPE:
+ rState.maValue >>= nNumberingType;
+ break;
+ case CTF_SECTION_FOOTNOTE_NUM_PREFIX:
+ rState.maValue >>= sNumPrefix;
+ break;
+ case CTF_SECTION_FOOTNOTE_NUM_SUFFIX:
+ rState.maValue >>= sNumSuffix;
+ break;
+ case CTF_SECTION_FOOTNOTE_END:
+ DBG_ASSERT( i == nIdx,
+ "received wrong property state index" );
+ rState.maValue >>= bEnd;
+ break;
+ }
+ }
+ else
+ {
+ switch (nContextId)
+ {
+ case CTF_SECTION_ENDNOTE_NUM_OWN:
+ rState.maValue >>= bNumOwn;
+ break;
+ case CTF_SECTION_ENDNOTE_NUM_RESTART:
+ rState.maValue >>= bNumRestart;
+ break;
+ case CTF_SECTION_ENDNOTE_NUM_RESTART_AT:
+ rState.maValue >>= nNumRestartAt;
+ break;
+ case CTF_SECTION_ENDNOTE_NUM_TYPE:
+ rState.maValue >>= nNumberingType;
+ break;
+ case CTF_SECTION_ENDNOTE_NUM_PREFIX:
+ rState.maValue >>= sNumPrefix;
+ break;
+ case CTF_SECTION_ENDNOTE_NUM_SUFFIX:
+ rState.maValue >>= sNumSuffix;
+ break;
+ case CTF_SECTION_ENDNOTE_END:
+ DBG_ASSERT( i == nIdx,
+ "received wrong property state index" );
+ rState.maValue >>= bEnd;
+ break;
+ }
+ }
+ }
+
+ // we only make an element if we have an own footnote/endnote numbering
+ if (bEnd)
+ {
+ rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_NOTE_CLASS,
+ GetXMLToken( bEndnote ? XML_ENDNOTE
+ : XML_FOOTNOTE ) );
+ // start numbering
+ OUStringBuffer sBuf;
+ if (bNumRestart)
+ {
+ // restart number is stored as 0.., but interpreted as 1..
+ SvXMLUnitConverter::convertNumber(sBuf,
+ (sal_Int32)(nNumRestartAt+1));
+ rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_START_VALUE,
+ sBuf.makeStringAndClear());
+ }
+
+ if (bNumOwn)
+ {
+ // prefix and suffix
+ if (sNumPrefix.getLength() > 0)
+ {
+ rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_NUM_PREFIX,
+ sNumPrefix);
+ }
+ if (sNumSuffix.getLength() > 0)
+ {
+ rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_NUM_SUFFIX,
+ sNumSuffix);
+ }
+
+ // number type: num format
+ rExport.GetMM100UnitConverter().convertNumFormat( sBuf,
+ nNumberingType );
+ rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_NUM_FORMAT,
+ sBuf.makeStringAndClear());
+
+ // and letter sync, if applicable
+ rExport.GetMM100UnitConverter().convertNumLetterSync(
+ sBuf, nNumberingType );
+ if (sBuf.getLength())
+ {
+ rExport.AddAttribute(XML_NAMESPACE_STYLE,
+ XML_NUM_LETTER_SYNC,
+ sBuf.makeStringAndClear());
+ }
+ }
+
+ // and finally, the element
+ SvXMLElementExport rElem(rExport, XML_NAMESPACE_TEXT,
+ XML_NOTES_CONFIGURATION,
+ sal_True, sal_True);
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLSectionFootnoteConfigExport.hxx b/xmloff/source/text/XMLSectionFootnoteConfigExport.hxx
new file mode 100644
index 000000000000..722f9f64f68f
--- /dev/null
+++ b/xmloff/source/text/XMLSectionFootnoteConfigExport.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLSECTIONFOOTNOTECONFIGEXPORT_HXX
+#define _XMLOFF_XMLSECTIONFOOTNOTECONFIGEXPORT_HXX
+
+#include <sal/types.h>
+
+#include <vector>
+
+class SvXMLExport;
+class XMLPropertySetMapper;
+struct XMLPropertyState;
+template<class X> class UniReference;
+
+/**
+ * Export the footnote-/endnote-configuration element in section styles.
+ *
+ * Because this class contains only one method, and all information is
+ * available during that method call, we simply make it static.
+ */
+class XMLSectionFootnoteConfigExport
+{
+
+public:
+ static void exportXML(
+ SvXMLExport& rExport,
+ sal_Bool bEndnote,
+ const ::std::vector<XMLPropertyState> * pProperties,
+ sal_uInt32 nIdx,
+ const UniReference<XMLPropertySetMapper> & rMapper); /// used only for debugging
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLSectionFootnoteConfigImport.cxx b/xmloff/source/text/XMLSectionFootnoteConfigImport.cxx
new file mode 100644
index 000000000000..6e699017c374
--- /dev/null
+++ b/xmloff/source/text/XMLSectionFootnoteConfigImport.cxx
@@ -0,0 +1,198 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLSectionFootnoteConfigImport.hxx"
+
+#ifndef _RTL_USTRING
+#include <rtl/ustring.hxx>
+#endif
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/style/NumberingType.hpp>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmlprmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/maptype.hxx>
+#include <xmloff/xmlnumi.hxx>
+#include <xmloff/txtprmap.hxx>
+#include <tools/debug.hxx>
+
+#include <vector>
+
+
+using namespace ::xmloff::token;
+using namespace ::com::sun::star::style;
+
+using ::rtl::OUString;
+using ::std::vector;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::xml::sax::XAttributeList;
+
+
+TYPEINIT1(XMLSectionFootnoteConfigImport, SvXMLImportContext);
+
+
+XMLSectionFootnoteConfigImport::XMLSectionFootnoteConfigImport(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ vector<XMLPropertyState> & rProps,
+ const UniReference<XMLPropertySetMapper> & rMapperRef) :
+ SvXMLImportContext(rImport, nPrefix, rLocalName),
+ rProperties(rProps),
+ rMapper(rMapperRef)
+{
+}
+
+XMLSectionFootnoteConfigImport::~XMLSectionFootnoteConfigImport()
+{
+}
+
+void XMLSectionFootnoteConfigImport::StartElement(
+ const Reference<XAttributeList> & xAttrList)
+{
+ sal_Bool bEnd = sal_True; // we're inside the element, so this is true
+ sal_Bool bNumOwn = sal_False;
+ sal_Bool bNumRestart = sal_False;
+ sal_Bool bEndnote = sal_False;
+ sal_Int16 nNumRestartAt = 0;
+ OUString sNumPrefix;
+ OUString sNumSuffix;
+ OUString sNumFormat;
+ OUString sNumLetterSync;
+
+ // iterate over xattribute list and fill values
+ sal_Int16 nLength = xAttrList->getLength();
+ for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++)
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
+ &sLocalName );
+ OUString sAttrValue = xAttrList->getValueByIndex(nAttr);
+
+ if (XML_NAMESPACE_TEXT == nPrefix)
+ {
+ if (IsXMLToken(sLocalName, XML_START_VALUE))
+ {
+ sal_Int32 nTmp;
+ if (SvXMLUnitConverter::convertNumber(nTmp, sAttrValue))
+ {
+ nNumRestartAt = static_cast< sal_Int16 >( nTmp ) - 1;
+ bNumRestart = sal_True;
+ }
+ }
+ else if( IsXMLToken( sLocalName, XML_NOTE_CLASS ) )
+ {
+ if( IsXMLToken( sAttrValue, XML_ENDNOTE ) )
+ bEndnote = sal_True;
+ }
+ }
+ else if (XML_NAMESPACE_STYLE == nPrefix)
+ {
+ if (IsXMLToken(sLocalName, XML_NUM_PREFIX))
+ {
+ sNumPrefix = sAttrValue;
+ bNumOwn = sal_True;
+ }
+ else if (IsXMLToken(sLocalName, XML_NUM_SUFFIX))
+ {
+ sNumSuffix = sAttrValue;
+ bNumOwn = sal_True;
+ }
+ else if (IsXMLToken(sLocalName, XML_NUM_FORMAT))
+ {
+ sNumFormat = sAttrValue;
+ bNumOwn = sal_True;
+ }
+ else if (IsXMLToken(sLocalName, XML_NUM_LETTER_SYNC))
+ {
+ sNumLetterSync = sAttrValue;
+ bNumOwn = sal_True;
+ }
+ }
+ }
+
+ // OK, now we have all values and can fill the XMLPropertyState vector
+ Any aAny;
+
+ aAny.setValue( &bNumOwn, ::getBooleanCppuType() );
+ sal_Int32 nIndex = rMapper->FindEntryIndex( bEndnote ?
+ CTF_SECTION_ENDNOTE_NUM_OWN : CTF_SECTION_FOOTNOTE_NUM_OWN );
+ XMLPropertyState aNumOwn( nIndex, aAny );
+ rProperties.push_back( aNumOwn );
+
+ aAny.setValue( &bNumRestart, ::getBooleanCppuType() );
+ nIndex = rMapper->FindEntryIndex( bEndnote ?
+ CTF_SECTION_ENDNOTE_NUM_RESTART : CTF_SECTION_FOOTNOTE_NUM_RESTART );
+ XMLPropertyState aNumRestart( nIndex, aAny );
+ rProperties.push_back( aNumRestart );
+
+ aAny <<= nNumRestartAt;
+ nIndex = rMapper->FindEntryIndex( bEndnote ?
+ CTF_SECTION_ENDNOTE_NUM_RESTART_AT :
+ CTF_SECTION_FOOTNOTE_NUM_RESTART_AT );
+ XMLPropertyState aNumRestartAtState( nIndex, aAny );
+ rProperties.push_back( aNumRestartAtState );
+
+ sal_Int16 nNumType = NumberingType::ARABIC;
+ GetImport().GetMM100UnitConverter().convertNumFormat( nNumType,
+ sNumFormat,
+ sNumLetterSync );
+ aAny <<= nNumType;
+ nIndex = rMapper->FindEntryIndex( bEndnote ?
+ CTF_SECTION_ENDNOTE_NUM_TYPE : CTF_SECTION_FOOTNOTE_NUM_TYPE );
+ XMLPropertyState aNumFormatState( nIndex, aAny );
+ rProperties.push_back( aNumFormatState );
+
+ aAny <<= sNumPrefix;
+ nIndex = rMapper->FindEntryIndex( bEndnote ?
+ CTF_SECTION_ENDNOTE_NUM_PREFIX : CTF_SECTION_FOOTNOTE_NUM_PREFIX );
+ XMLPropertyState aPrefixState( nIndex, aAny );
+ rProperties.push_back( aPrefixState );
+
+ aAny <<= sNumSuffix;
+ nIndex = rMapper->FindEntryIndex( bEndnote ?
+ CTF_SECTION_ENDNOTE_NUM_SUFFIX : CTF_SECTION_FOOTNOTE_NUM_SUFFIX );
+ XMLPropertyState aSuffixState( nIndex, aAny );
+ rProperties.push_back( aSuffixState );
+
+ aAny.setValue( &bEnd, ::getBooleanCppuType() );
+ nIndex = rMapper->FindEntryIndex( bEndnote ?
+ CTF_SECTION_ENDNOTE_END : CTF_SECTION_FOOTNOTE_END );
+ XMLPropertyState aEndState( nIndex, aAny );
+ rProperties.push_back( aEndState );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLSectionFootnoteConfigImport.hxx b/xmloff/source/text/XMLSectionFootnoteConfigImport.hxx
new file mode 100644
index 000000000000..3862d824fe4d
--- /dev/null
+++ b/xmloff/source/text/XMLSectionFootnoteConfigImport.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLSECTIONFOOTNOTECONFIGIMPORT_HXX
+#define _XMLOFF_XMLSECTIONFOOTNOTECONFIGIMPORT_HXX
+
+
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/uniref.hxx>
+
+#include <vector>
+
+
+class SvXMLImport;
+struct XMLPropertyState;
+class XMLPropertySetMapper;
+namespace rtl { class OUString; }
+namespace com { namespace sun { namespace star {
+ namespace uno { template<class X> class Reference; }
+ namespace xml { namespace sax { class XAttributeList; } }
+} } }
+
+
+/**
+ * Import the footnote-/endnote-configuration element in section styles.
+ */
+class XMLSectionFootnoteConfigImport : public SvXMLImportContext
+{
+ ::std::vector<XMLPropertyState> & rProperties;
+ UniReference<XMLPropertySetMapper> rMapper;
+
+public:
+
+ TYPEINFO();
+
+ XMLSectionFootnoteConfigImport(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ ::std::vector<XMLPropertyState> & rProperties,
+ const UniReference<XMLPropertySetMapper> & rMapperRef);
+
+ ~XMLSectionFootnoteConfigImport();
+
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLSectionImportContext.cxx b/xmloff/source/text/XMLSectionImportContext.cxx
new file mode 100644
index 000000000000..0058026d0dba
--- /dev/null
+++ b/xmloff/source/text/XMLSectionImportContext.cxx
@@ -0,0 +1,408 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLSectionImportContext.hxx"
+#include "XMLSectionSourceImportContext.hxx"
+#include "XMLSectionSourceDDEImportContext.hxx"
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/txtimp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/prstylei.hxx>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/text/XTextContent.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/text/ControlCharacter.hpp>
+
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::xml::sax::XAttributeList;
+using ::com::sun::star::lang::XMultiServiceFactory;
+using ::com::sun::star::container::XNamed;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::text;
+using namespace ::xmloff::token;
+
+
+TYPEINIT1( XMLSectionImportContext, SvXMLImportContext );
+
+const sal_Char sAPI_TextSection[] = "com.sun.star.text.TextSection";
+const sal_Char sAPI_IndexHeaderSection[] = "com.sun.star.text.IndexHeaderSection";
+const sal_Char sAPI_IsProtected[] = "IsProtected";
+const sal_Char sAPI_Condition[] = "Condition";
+const sal_Char sAPI_IsVisible[] = "IsVisible";
+const sal_Char sAPI_IsCurrentlyVisible[] = "IsCurrentlyVisible";
+const sal_Char sAPI_ProtectionKey[] = "ProtectionKey";
+
+enum XMLSectionToken
+{
+ XML_TOK_SECTION_XMLID,
+ XML_TOK_SECTION_STYLE_NAME,
+ XML_TOK_SECTION_NAME,
+ XML_TOK_SECTION_CONDITION,
+ XML_TOK_SECTION_DISPLAY,
+ XML_TOK_SECTION_PROTECT,
+ XML_TOK_SECTION_PROTECTION_KEY,
+ XML_TOK_SECTION_IS_HIDDEN
+};
+
+static SvXMLTokenMapEntry aSectionTokenMap[] =
+{
+ { XML_NAMESPACE_XML , XML_ID, XML_TOK_SECTION_XMLID },
+ { XML_NAMESPACE_TEXT, XML_STYLE_NAME, XML_TOK_SECTION_STYLE_NAME },
+ { XML_NAMESPACE_TEXT, XML_NAME, XML_TOK_SECTION_NAME },
+ { XML_NAMESPACE_TEXT, XML_CONDITION, XML_TOK_SECTION_CONDITION },
+ { XML_NAMESPACE_TEXT, XML_DISPLAY, XML_TOK_SECTION_DISPLAY },
+ { XML_NAMESPACE_TEXT, XML_PROTECTED, XML_TOK_SECTION_PROTECT },
+ { XML_NAMESPACE_TEXT, XML_PROTECTION_KEY, XML_TOK_SECTION_PROTECTION_KEY},
+ { XML_NAMESPACE_TEXT, XML_IS_HIDDEN, XML_TOK_SECTION_IS_HIDDEN },
+ // compatibility with SRC629 (or earlier) versions
+ { XML_NAMESPACE_TEXT, XML_PROTECT, XML_TOK_SECTION_PROTECT },
+ XML_TOKEN_MAP_END
+};
+
+
+// section import: This one is fairly tricky due to a variety of
+// limits of the core or the API. The main problem is that if you
+// insert a section within another section, you can't move the cursor
+// between the ends of the inner and the enclosing section. To avoid
+// these problems, additional markers are first inserted and later deleted.
+XMLSectionImportContext::XMLSectionImportContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName )
+: SvXMLImportContext(rImport, nPrfx, rLocalName)
+, sTextSection(RTL_CONSTASCII_USTRINGPARAM(sAPI_TextSection))
+, sIndexHeaderSection(RTL_CONSTASCII_USTRINGPARAM(sAPI_IndexHeaderSection))
+, sCondition(RTL_CONSTASCII_USTRINGPARAM(sAPI_Condition))
+, sIsVisible(RTL_CONSTASCII_USTRINGPARAM(sAPI_IsVisible))
+, sProtectionKey(RTL_CONSTASCII_USTRINGPARAM(sAPI_ProtectionKey))
+, sIsProtected(RTL_CONSTASCII_USTRINGPARAM(sAPI_IsProtected))
+, sIsCurrentlyVisible(RTL_CONSTASCII_USTRINGPARAM(sAPI_IsCurrentlyVisible))
+, bProtect(sal_False)
+, bCondOK(sal_False)
+, bIsVisible(sal_True)
+, bValid(sal_False)
+, bSequenceOK(sal_False)
+, bIsCurrentlyVisible(sal_True)
+, bIsCurrentlyVisibleOK(sal_False)
+, bHasContent(sal_False)
+{
+}
+
+XMLSectionImportContext::~XMLSectionImportContext()
+{
+}
+
+void XMLSectionImportContext::StartElement(
+ const Reference<XAttributeList> & xAttrList)
+{
+ // process attributes
+ ProcessAttributes(xAttrList);
+
+ // process index headers:
+ sal_Bool bIsIndexHeader = IsXMLToken( GetLocalName(), XML_INDEX_TITLE );
+ if (bIsIndexHeader)
+ {
+ bValid = sal_True;
+ }
+
+ UniReference<XMLTextImportHelper> rHelper = GetImport().GetTextImport();
+
+ // valid?
+ if (bValid)
+ {
+ // create text section (as XPropertySet)
+ Reference<XMultiServiceFactory> xFactory(
+ GetImport().GetModel(),UNO_QUERY);
+ if (xFactory.is())
+ {
+ Reference<XInterface> xIfc =
+ xFactory->createInstance( bIsIndexHeader ? sIndexHeaderSection
+ : sTextSection );
+ if (xIfc.is())
+ {
+ Reference<XPropertySet> xPropSet(xIfc, UNO_QUERY);
+
+ // save PropertySet (for CreateChildContext)
+ xSectionPropertySet = xPropSet;
+
+ // name
+ Reference<XNamed> xNamed(xPropSet, UNO_QUERY);
+ xNamed->setName(sName);
+
+ // stylename?
+ if (sStyleName.getLength() > 0)
+ {
+ XMLPropStyleContext* pStyle = rHelper->
+ FindSectionStyle(sStyleName);
+
+ if (pStyle != NULL)
+ {
+ pStyle->FillPropertySet( xPropSet );
+ }
+ }
+
+ // IsVisible and condition (not for index headers)
+ if (! bIsIndexHeader)
+ {
+ Any aAny;
+ aAny.setValue( &bIsVisible, ::getBooleanCppuType() );
+ xPropSet->setPropertyValue( sIsVisible, aAny );
+
+ // #97450# hidden sections must be hidden on reload
+ // For backwards compatibilty, set flag only if it is
+ // present
+ if( bIsCurrentlyVisibleOK )
+ {
+ aAny.setValue( &bIsCurrentlyVisible,
+ ::getBooleanCppuType() );
+ xPropSet->setPropertyValue( sIsCurrentlyVisible, aAny);
+ }
+
+ if (bCondOK)
+ {
+ aAny <<= sCond;
+ xPropSet->setPropertyValue( sCondition, aAny );
+ }
+ }
+
+ // password (only for regular sections)
+ if ( bSequenceOK &&
+ IsXMLToken(GetLocalName(), XML_SECTION) )
+ {
+ Any aAny;
+ aAny <<= aSequence;
+ xPropSet->setPropertyValue(sProtectionKey, aAny);
+ }
+
+ // protection
+ Any aAny;
+ aAny.setValue( &bProtect, ::getBooleanCppuType() );
+ xPropSet->setPropertyValue( sIsProtected, aAny );
+
+ // insert marker, <paragraph>, marker; then insert
+ // section over the first marker character, and delete the
+ // last paragraph (and marker) when closing a section.
+ Reference<XTextRange> xStart =
+ rHelper->GetCursor()->getStart();
+#ifndef DBG_UTIL
+ static const sal_Char sMarker[] = " ";
+#else
+ static const sal_Char sMarker[] = "X";
+#endif
+ OUString sMarkerString(RTL_CONSTASCII_USTRINGPARAM(sMarker));
+ rHelper->InsertString(sMarkerString);
+ rHelper->InsertControlCharacter(
+ ControlCharacter::APPEND_PARAGRAPH );
+ rHelper->InsertString(sMarkerString);
+
+ // select first marker
+ rHelper->GetCursor()->gotoRange(xStart, sal_False);
+ rHelper->GetCursor()->goRight(1, sal_True);
+
+ // convert section to XTextContent
+ Reference<XTextContent> xTextContent(xSectionPropertySet,
+ UNO_QUERY);
+
+ // and insert (over marker)
+ rHelper->GetText()->insertTextContent(
+ rHelper->GetCursorAsRange(), xTextContent, sal_True );
+
+ // and delete first marker (in section)
+ rHelper->GetText()->insertString(
+ rHelper->GetCursorAsRange(), sEmpty, sal_True);
+
+ // finally, check for redlines that should start at
+ // the section start node
+ rHelper->RedlineAdjustStartNodeCursor(sal_True); // start ???
+
+ // xml:id for RDF metadata
+ GetImport().SetXmlId(xIfc, sXmlId);
+ }
+ }
+ }
+}
+
+void XMLSectionImportContext::ProcessAttributes(
+ const Reference<XAttributeList> & xAttrList )
+{
+ SvXMLTokenMap aTokenMap(aSectionTokenMap);
+
+ sal_Int16 nLength = xAttrList->getLength();
+ for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++)
+ {
+ OUString sLocalName;
+ sal_uInt16 nNamePrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
+ &sLocalName );
+ OUString sAttr = xAttrList->getValueByIndex(nAttr);
+
+ switch (aTokenMap.Get(nNamePrefix, sLocalName))
+ {
+ case XML_TOK_SECTION_XMLID:
+ sXmlId = sAttr;
+ break;
+ case XML_TOK_SECTION_STYLE_NAME:
+ sStyleName = sAttr;
+ break;
+ case XML_TOK_SECTION_NAME:
+ sName = sAttr;
+ bValid = sal_True;
+ break;
+ case XML_TOK_SECTION_CONDITION:
+ {
+ OUString sTmp;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ _GetKeyByAttrName( sAttr, &sTmp, sal_False );
+ if( XML_NAMESPACE_OOOW == nPrefix )
+ {
+ sCond = sTmp;
+ bCondOK = sal_True;
+ }
+ else
+ sCond = sAttr;
+ }
+ break;
+ case XML_TOK_SECTION_DISPLAY:
+ if (IsXMLToken(sAttr, XML_TRUE))
+ {
+ bIsVisible = sal_True;
+ }
+ else if ( IsXMLToken(sAttr, XML_NONE) ||
+ IsXMLToken(sAttr, XML_CONDITION) )
+ {
+ bIsVisible = sal_False;
+ }
+ // else: ignore
+ break;
+ case XML_TOK_SECTION_IS_HIDDEN:
+ {
+ bool bTmp;
+ if (SvXMLUnitConverter::convertBool(bTmp, sAttr))
+ {
+ bIsCurrentlyVisible = !bTmp;
+ bIsCurrentlyVisibleOK = sal_True;
+ }
+ }
+ break;
+ case XML_TOK_SECTION_PROTECTION_KEY:
+ SvXMLUnitConverter::decodeBase64(aSequence, sAttr);
+ bSequenceOK = sal_True;
+ break;
+ case XML_TOK_SECTION_PROTECT:
+ {
+ bool bTmp;
+ if (SvXMLUnitConverter::convertBool(bTmp, sAttr))
+ {
+ bProtect = bTmp;
+ }
+ break;
+ }
+ default:
+ ; // ignore
+ break;
+ }
+ }
+}
+
+void XMLSectionImportContext::EndElement()
+{
+ // get rid of last paragraph
+ // (unless it's the only paragraph in the section)
+ UniReference<XMLTextImportHelper> rHelper = GetImport().GetTextImport();
+ rHelper->GetCursor()->goRight(1, sal_False);
+ if (bHasContent)
+ {
+ rHelper->GetCursor()->goLeft(1, sal_True);
+ rHelper->GetText()->insertString(rHelper->GetCursorAsRange(),
+ sEmpty, sal_True);
+ }
+
+ // and delete second marker
+ rHelper->GetCursor()->goRight(1, sal_True);
+ rHelper->GetText()->insertString(rHelper->GetCursorAsRange(),
+ sEmpty, sal_True);
+
+ // check for redlines to our endnode
+ rHelper->RedlineAdjustStartNodeCursor(sal_False);
+}
+
+SvXMLImportContext* XMLSectionImportContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList )
+{
+ SvXMLImportContext* pContext = NULL;
+
+ // section-source (-dde) elements
+ if ( (XML_NAMESPACE_TEXT == nPrefix) &&
+ IsXMLToken(rLocalName, XML_SECTION_SOURCE) )
+ {
+ pContext = new XMLSectionSourceImportContext(GetImport(),
+ nPrefix, rLocalName,
+ xSectionPropertySet);
+ }
+ else if ( (XML_NAMESPACE_OFFICE == nPrefix) &&
+ IsXMLToken(rLocalName, XML_DDE_SOURCE) )
+ {
+ pContext = new XMLSectionSourceDDEImportContext(GetImport(),
+ nPrefix, rLocalName,
+ xSectionPropertySet);
+ }
+ else
+ {
+ // otherwise: text context
+ pContext = GetImport().GetTextImport()->CreateTextChildContext(
+ GetImport(), nPrefix, rLocalName, xAttrList,
+ XML_TEXT_TYPE_SECTION );
+
+ // if that fails, default context
+ if (NULL == pContext)
+ {
+ pContext = new SvXMLImportContext( GetImport(),
+ nPrefix, rLocalName );
+ }
+ else
+ bHasContent = sal_True;
+ }
+
+ return pContext;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLSectionImportContext.hxx b/xmloff/source/text/XMLSectionImportContext.hxx
new file mode 100644
index 000000000000..38c4f2d99569
--- /dev/null
+++ b/xmloff/source/text/XMLSectionImportContext.hxx
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLSECTIONIMPORTCONTEXT_HXX_
+#define _XMLOFF_XMLSECTIONIMPORTCONTEXT_HXX_
+
+#include <xmloff/xmlictxt.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.h>
+
+namespace com { namespace sun { namespace star {
+ namespace text { class XTextRange; }
+ namespace beans { class XPropertySet; }
+ namespace xml { namespace sax { class XAttributeList; } }
+} } }
+namespace rtl { class OUString; }
+class XMLTextImportHelper;
+
+
+/**
+ * Import text sections.
+ *
+ * This context may *also* be used for index header sections. The
+ * differentiates its behaviour based on GetLocalName().
+ */
+class XMLSectionImportContext : public SvXMLImportContext
+{
+ /// start position; ranges aquired via getStart(),getEnd() don't move
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange> xStartRange;
+
+ /// end position
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange> xEndRange;
+
+ /// TextSection (as XPropertySet) for passing down to data source elements
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> xSectionPropertySet;
+
+ const ::rtl::OUString sTextSection;
+ const ::rtl::OUString sIndexHeaderSection;
+ const ::rtl::OUString sCondition;
+ const ::rtl::OUString sIsVisible;
+ const ::rtl::OUString sProtectionKey;
+ const ::rtl::OUString sIsProtected;
+ const ::rtl::OUString sIsCurrentlyVisible;
+ const ::rtl::OUString sEmpty;
+
+ ::rtl::OUString sXmlId;
+ ::rtl::OUString sStyleName;
+ ::rtl::OUString sName;
+ ::rtl::OUString sCond;
+ ::com::sun::star::uno::Sequence<sal_Int8> aSequence;
+ sal_Bool bProtect;
+ sal_Bool bCondOK;
+ sal_Bool bIsVisible;
+ sal_Bool bValid;
+ sal_Bool bSequenceOK;
+ sal_Bool bIsCurrentlyVisible;
+ sal_Bool bIsCurrentlyVisibleOK;
+
+ sal_Bool bHasContent;
+
+public:
+
+ TYPEINFO();
+
+ XMLSectionImportContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName );
+
+ ~XMLSectionImportContext();
+
+protected:
+
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+
+ virtual void EndElement();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+
+ void ProcessAttributes(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx b/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx
new file mode 100644
index 000000000000..39a7d0095dd9
--- /dev/null
+++ b/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx
@@ -0,0 +1,189 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLSectionSourceDDEImportContext.hxx"
+#include "XMLSectionImportContext.hxx"
+#include <com/sun/star/text/SectionFileLink.hpp>
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/txtimp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <tools/debug.hxx>
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::beans::XMultiPropertySet;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::xml::sax::XAttributeList;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::text;
+using namespace ::xmloff::token;
+
+const sal_Char sAPI_DDECommandFile[] = "DDECommandFile";
+const sal_Char sAPI_DDECommandType[] = "DDECommandType";
+const sal_Char sAPI_DDECommandElement[] = "DDECommandElement";
+const sal_Char sAPI_IsAutomaticUpdate[] = "IsAutomaticUpdate";
+
+
+TYPEINIT1(XMLSectionSourceDDEImportContext, SvXMLImportContext);
+
+XMLSectionSourceDDEImportContext::XMLSectionSourceDDEImportContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ Reference<XPropertySet> & rSectPropSet) :
+ SvXMLImportContext(rImport, nPrfx, rLocalName),
+ rSectionPropertySet(rSectPropSet),
+ sDdeCommandFile(RTL_CONSTASCII_USTRINGPARAM(sAPI_DDECommandFile)),
+ sDdeCommandType(RTL_CONSTASCII_USTRINGPARAM(sAPI_DDECommandType)),
+ sDdeCommandElement(RTL_CONSTASCII_USTRINGPARAM(sAPI_DDECommandElement)),
+ sIsAutomaticUpdate(RTL_CONSTASCII_USTRINGPARAM(sAPI_IsAutomaticUpdate))
+{
+}
+
+XMLSectionSourceDDEImportContext::~XMLSectionSourceDDEImportContext()
+{
+}
+
+enum XMLSectionSourceDDEToken
+{
+ XML_TOK_SECTION_DDE_APPLICATION,
+ XML_TOK_SECTION_DDE_TOPIC,
+ XML_TOK_SECTION_DDE_ITEM,
+ XML_TOK_SECTION_IS_AUTOMATIC_UPDATE
+};
+
+static SvXMLTokenMapEntry aSectionSourceDDETokenMap[] =
+{
+ { XML_NAMESPACE_OFFICE, XML_DDE_APPLICATION,
+ XML_TOK_SECTION_DDE_APPLICATION },
+ { XML_NAMESPACE_OFFICE, XML_DDE_TOPIC, XML_TOK_SECTION_DDE_TOPIC },
+ { XML_NAMESPACE_OFFICE, XML_DDE_ITEM, XML_TOK_SECTION_DDE_ITEM },
+ { XML_NAMESPACE_OFFICE, XML_AUTOMATIC_UPDATE,
+ XML_TOK_SECTION_IS_AUTOMATIC_UPDATE },
+ XML_TOKEN_MAP_END
+};
+
+
+void XMLSectionSourceDDEImportContext::StartElement(
+ const Reference<XAttributeList> & xAttrList)
+{
+ SvXMLTokenMap aTokenMap(aSectionSourceDDETokenMap);
+ OUString sApplication;
+ OUString sTopic;
+ OUString sItem;
+ sal_Bool bAutomaticUpdate = sal_False;
+
+ sal_Int16 nLength = xAttrList->getLength();
+ for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++)
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
+ &sLocalName );
+
+ switch (aTokenMap.Get(nPrefix, sLocalName))
+ {
+ case XML_TOK_SECTION_DDE_APPLICATION:
+ sApplication = xAttrList->getValueByIndex(nAttr);
+ break;
+ case XML_TOK_SECTION_DDE_TOPIC:
+ sTopic = xAttrList->getValueByIndex(nAttr);
+ break;
+ case XML_TOK_SECTION_DDE_ITEM:
+ sItem = xAttrList->getValueByIndex(nAttr);
+ break;
+ case XML_TOK_SECTION_IS_AUTOMATIC_UPDATE:
+ {
+ bool bTmp;
+ if (SvXMLUnitConverter::convertBool(
+ bTmp, xAttrList->getValueByIndex(nAttr)))
+ {
+ bAutomaticUpdate = bTmp;
+ }
+ break;
+ }
+ default:
+ ; // ignore
+ break;
+ }
+ }
+
+ // DDE not supported on all platforms; query property first
+ if (rSectionPropertySet->getPropertySetInfo()->
+ hasPropertyByName(sDdeCommandFile))
+ {
+ // use multi property set to force single update of connection #83654#
+ Sequence<OUString> aNames(4);
+ Sequence<Any> aValues(4);
+
+ aValues[0] <<= sApplication;
+ aNames[0] = sDdeCommandFile;
+
+ aValues[1] <<= sTopic;
+ aNames[1] = sDdeCommandType;
+
+ aValues[2] <<= sItem;
+ aNames[2] = sDdeCommandElement;
+
+ aValues[3].setValue(&bAutomaticUpdate, ::getBooleanCppuType());
+ aNames[3] = sIsAutomaticUpdate;
+
+ Reference<XMultiPropertySet> rMultiPropSet(rSectionPropertySet,
+ UNO_QUERY);
+ DBG_ASSERT(rMultiPropSet.is(), "we'd really like a XMultiPropertySet");
+ if (rMultiPropSet.is())
+ rMultiPropSet->setPropertyValues(aNames, aValues);
+ // else: ignore
+ }
+}
+
+void XMLSectionSourceDDEImportContext::EndElement()
+{
+ // nothing to be done!
+}
+
+SvXMLImportContext* XMLSectionSourceDDEImportContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & )
+{
+ // ignore -> default context
+ return new SvXMLImportContext(GetImport(), nPrefix, rLocalName);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLSectionSourceDDEImportContext.hxx b/xmloff/source/text/XMLSectionSourceDDEImportContext.hxx
new file mode 100644
index 000000000000..bca2e342f45b
--- /dev/null
+++ b/xmloff/source/text/XMLSectionSourceDDEImportContext.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLSECTIONSOURCEDDEIMPORTCONTEXT_HXX_
+#define _XMLOFF_XMLSECTIONSOURCEDDEIMPORTCONTEXT_HXX_
+
+#include <xmloff/xmlictxt.hxx>
+#include <com/sun/star/uno/Reference.h>
+
+namespace com { namespace sun { namespace star {
+ namespace beans { class XPropertySet; }
+ namespace xml { namespace sax { class XAttributeList; } }
+} } }
+namespace rtl { class OUString; }
+
+class XMLSectionSourceDDEImportContext : public SvXMLImportContext
+{
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rSectionPropertySet;
+
+ const ::rtl::OUString sDdeCommandFile;
+ const ::rtl::OUString sDdeCommandType;
+ const ::rtl::OUString sDdeCommandElement;
+ const ::rtl::OUString sIsAutomaticUpdate;
+
+public:
+
+ TYPEINFO();
+
+ XMLSectionSourceDDEImportContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rSectPropSet);
+
+ ~XMLSectionSourceDDEImportContext();
+
+protected:
+
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+
+ virtual void EndElement();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLSectionSourceImportContext.cxx b/xmloff/source/text/XMLSectionSourceImportContext.cxx
new file mode 100644
index 000000000000..d5b5b6805712
--- /dev/null
+++ b/xmloff/source/text/XMLSectionSourceImportContext.cxx
@@ -0,0 +1,159 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLSectionSourceImportContext.hxx"
+#include "XMLSectionImportContext.hxx"
+#include <com/sun/star/text/SectionFileLink.hpp>
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/txtimp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::xml::sax::XAttributeList;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::text;
+using namespace ::xmloff::token;
+
+
+TYPEINIT1(XMLSectionSourceImportContext, SvXMLImportContext);
+
+XMLSectionSourceImportContext::XMLSectionSourceImportContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ Reference<XPropertySet> & rSectPropSet) :
+ SvXMLImportContext(rImport, nPrfx, rLocalName),
+ rSectionPropertySet(rSectPropSet)
+{
+}
+
+XMLSectionSourceImportContext::~XMLSectionSourceImportContext()
+{
+}
+
+enum XMLSectionSourceToken
+{
+ XML_TOK_SECTION_XLINK_HREF,
+ XML_TOK_SECTION_TEXT_FILTER_NAME,
+ XML_TOK_SECTION_TEXT_SECTION_NAME
+};
+
+static SvXMLTokenMapEntry aSectionSourceTokenMap[] =
+{
+ { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_SECTION_XLINK_HREF },
+ { XML_NAMESPACE_TEXT, XML_FILTER_NAME, XML_TOK_SECTION_TEXT_FILTER_NAME },
+ { XML_NAMESPACE_TEXT, XML_SECTION_NAME,
+ XML_TOK_SECTION_TEXT_SECTION_NAME },
+ XML_TOKEN_MAP_END
+};
+
+
+void XMLSectionSourceImportContext::StartElement(
+ const Reference<XAttributeList> & xAttrList)
+{
+ SvXMLTokenMap aTokenMap(aSectionSourceTokenMap);
+ OUString sURL;
+ OUString sFilterName;
+ OUString sSectionName;
+
+ sal_Int16 nLength = xAttrList->getLength();
+ for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++)
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
+ &sLocalName );
+
+ switch (aTokenMap.Get(nPrefix, sLocalName))
+ {
+ case XML_TOK_SECTION_XLINK_HREF:
+ sURL = xAttrList->getValueByIndex(nAttr);
+ break;
+
+ case XML_TOK_SECTION_TEXT_FILTER_NAME:
+ sFilterName = xAttrList->getValueByIndex(nAttr);
+ break;
+
+ case XML_TOK_SECTION_TEXT_SECTION_NAME:
+ sSectionName = xAttrList->getValueByIndex(nAttr);
+ break;
+
+ default:
+ ; // ignore
+ break;
+ }
+ }
+
+ // we only need them once
+ const OUString sFileLink(RTL_CONSTASCII_USTRINGPARAM("FileLink"));
+ const OUString sLinkRegion(RTL_CONSTASCII_USTRINGPARAM("LinkRegion"));
+
+ Any aAny;
+ if ((sURL.getLength() > 0) || (sFilterName.getLength() > 0))
+ {
+ SectionFileLink aFileLink;
+ aFileLink.FileURL = GetImport().GetAbsoluteReference( sURL );
+ aFileLink.FilterName = sFilterName;
+
+ aAny <<= aFileLink;
+ rSectionPropertySet->setPropertyValue(sFileLink, aAny);
+ }
+
+ if (sSectionName.getLength() > 0)
+ {
+ aAny <<= sSectionName;
+ rSectionPropertySet->setPropertyValue(sLinkRegion, aAny);
+ }
+}
+
+void XMLSectionSourceImportContext::EndElement()
+{
+ // this space intentionally left blank.
+}
+
+SvXMLImportContext* XMLSectionSourceImportContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & )
+{
+ // ignore -> default context
+ return new SvXMLImportContext(GetImport(), nPrefix, rLocalName);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLSectionSourceImportContext.hxx b/xmloff/source/text/XMLSectionSourceImportContext.hxx
new file mode 100644
index 000000000000..3dd61d03bb89
--- /dev/null
+++ b/xmloff/source/text/XMLSectionSourceImportContext.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLSECTIONSOURCEIMPORTCONTEXT_HXX_
+#define _XMLOFF_XMLSECTIONSOURCEIMPORTCONTEXT_HXX_
+
+#include <xmloff/xmlictxt.hxx>
+#include <com/sun/star/uno/Reference.h>
+
+namespace com { namespace sun { namespace star {
+ namespace beans { class XPropertySet; }
+ namespace xml { namespace sax { class XAttributeList; } }
+} } }
+namespace rtl { class OUString; }
+
+class XMLSectionSourceImportContext : public SvXMLImportContext
+{
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rSectionPropertySet;
+
+public:
+
+ TYPEINFO();
+
+ XMLSectionSourceImportContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rSectPropSet);
+
+ ~XMLSectionSourceImportContext();
+
+protected:
+
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+
+ virtual void EndElement();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLStringBufferImportContext.cxx b/xmloff/source/text/XMLStringBufferImportContext.cxx
new file mode 100644
index 000000000000..077b041167bf
--- /dev/null
+++ b/xmloff/source/text/XMLStringBufferImportContext.cxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLStringBufferImportContext.hxx"
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlnmspe.hxx"
+
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::xml::sax::XAttributeList;
+using ::xmloff::token::IsXMLToken;
+using ::xmloff::token::XML_P;
+
+
+TYPEINIT1(XMLStringBufferImportContext, SvXMLImportContext);
+
+XMLStringBufferImportContext::XMLStringBufferImportContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& sLocalName,
+ OUStringBuffer& rBuffer) :
+ SvXMLImportContext(rImport, nPrefix, sLocalName),
+ rTextBuffer(rBuffer)
+{
+}
+
+XMLStringBufferImportContext::~XMLStringBufferImportContext()
+{
+}
+
+SvXMLImportContext *XMLStringBufferImportContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> &)
+{
+ return new XMLStringBufferImportContext(GetImport(), nPrefix,
+ rLocalName, rTextBuffer);
+}
+
+void XMLStringBufferImportContext::Characters(
+ const OUString& rChars )
+{
+ rTextBuffer.append(rChars);
+}
+
+void XMLStringBufferImportContext::EndElement()
+{
+ // add return for paragraph elements
+ if ( (XML_NAMESPACE_TEXT == GetPrefix()) &&
+ (IsXMLToken(GetLocalName(), XML_P)) )
+ {
+ rTextBuffer.append(sal_Unicode(0x0a));
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLTextCharStyleNamesElementExport.cxx b/xmloff/source/text/XMLTextCharStyleNamesElementExport.cxx
new file mode 100644
index 000000000000..197f8c79203b
--- /dev/null
+++ b/xmloff/source/text/XMLTextCharStyleNamesElementExport.cxx
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLTextCharStyleNamesElementExport.hxx"
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmlexp.hxx>
+
+namespace com { namespace sun { namespace star {
+ namespace beans { class XPropertySet; }
+} } }
+
+using namespace ::com::sun::star::uno;
+using ::com::sun::star::beans::XPropertySet;
+using ::rtl::OUString;
+using namespace ::xmloff::token;
+
+XMLTextCharStyleNamesElementExport::XMLTextCharStyleNamesElementExport(
+ SvXMLExport& rExp,
+ sal_Bool bDoSth,
+ sal_Bool bAllStyles,
+ const Reference < XPropertySet > & rPropSet,
+ const OUString& rPropName ) :
+ rExport( rExp ),
+ nCount( 0 )
+{
+ if( bDoSth )
+ {
+ Any aAny = rPropSet->getPropertyValue( rPropName );
+ Sequence < OUString > aNames;
+ if( aAny >>= aNames )
+ {
+ nCount = aNames.getLength();
+ OSL_ENSURE( nCount > 0, "no char style found" );
+ if ( bAllStyles ) ++nCount;
+ if( nCount > 1 )
+ {
+ aName = rExport.GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_TEXT, GetXMLToken(XML_SPAN) );
+ sal_Int32 i = nCount;
+ const OUString *pName = aNames.getConstArray();
+ while( --i )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME,
+ rExport.EncodeStyleName( *pName ) );
+ rExport.StartElement( aName, sal_False );
+ ++pName;
+ }
+ }
+ }
+ }
+}
+
+XMLTextCharStyleNamesElementExport::~XMLTextCharStyleNamesElementExport()
+{
+ if( nCount > 1 )
+ {
+ sal_Int32 i = nCount;
+ while( --i )
+ rExport.EndElement( aName, sal_False );
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLTextCharStyleNamesElementExport.hxx b/xmloff/source/text/XMLTextCharStyleNamesElementExport.hxx
new file mode 100644
index 000000000000..5af87c094bf3
--- /dev/null
+++ b/xmloff/source/text/XMLTextCharStyleNamesElementExport.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLTEXTCHARSTYLENAMESELEMENTEXPORT_HXX
+#define _XMLOFF_XMLTEXTCHARSTYLENAMESELEMENTEXPORT_HXX
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+
+
+namespace com { namespace sun { namespace star {
+ namespace beans { class XPropertySet; }
+} } }
+
+class SvXMLExport;
+
+class XMLTextCharStyleNamesElementExport
+{
+ SvXMLExport& rExport;
+ ::rtl::OUString aName;
+ sal_Int32 nCount;
+
+public:
+
+ XMLTextCharStyleNamesElementExport(
+ SvXMLExport& rExp, sal_Bool bDoSomething, sal_Bool bAllStyles,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rPropSet,
+ const ::rtl::OUString& rPropName );
+ ~XMLTextCharStyleNamesElementExport();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLTextColumnsContext.cxx b/xmloff/source/text/XMLTextColumnsContext.cxx
new file mode 100644
index 000000000000..a1bfa163711a
--- /dev/null
+++ b/xmloff/source/text/XMLTextColumnsContext.cxx
@@ -0,0 +1,535 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/text/XTextColumns.hpp>
+#include <com/sun/star/text/TextColumn.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/style/VerticalAlignment.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <xmloff/xmltkmap.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmltoken.hxx>
+#include "XMLTextColumnsContext.hxx"
+#define _SVSTDARR_USHORTS
+#include <svl/svstdarr.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::beans;
+using namespace ::xmloff::token;
+
+enum SvXMLTokenMapAttrs
+{
+ XML_TOK_COLUMN_WIDTH,
+ XML_TOK_COLUMN_MARGIN_LEFT,
+ XML_TOK_COLUMN_MARGIN_RIGHT,
+ XML_TOK_COLUMN_END=XML_TOK_UNKNOWN
+};
+
+enum SvXMLSepTokenMapAttrs
+{
+ XML_TOK_COLUMN_SEP_WIDTH,
+ XML_TOK_COLUMN_SEP_HEIGHT,
+ XML_TOK_COLUMN_SEP_COLOR,
+ XML_TOK_COLUMN_SEP_ALIGN,
+ XML_TOK_COLUMN_SEP_STYLE,
+ XML_TOK_COLUMN_SEP_END=XML_TOK_UNKNOWN
+};
+
+static SvXMLTokenMapEntry aColAttrTokenMap[] =
+{
+ { XML_NAMESPACE_STYLE, XML_REL_WIDTH, XML_TOK_COLUMN_WIDTH },
+ { XML_NAMESPACE_FO, XML_START_INDENT, XML_TOK_COLUMN_MARGIN_LEFT },
+ { XML_NAMESPACE_FO, XML_END_INDENT, XML_TOK_COLUMN_MARGIN_RIGHT },
+ XML_TOKEN_MAP_END
+};
+
+static SvXMLTokenMapEntry aColSepAttrTokenMap[] =
+{
+ { XML_NAMESPACE_STYLE, XML_WIDTH, XML_TOK_COLUMN_SEP_WIDTH },
+ { XML_NAMESPACE_STYLE, XML_COLOR, XML_TOK_COLUMN_SEP_COLOR },
+ { XML_NAMESPACE_STYLE, XML_HEIGHT, XML_TOK_COLUMN_SEP_HEIGHT },
+ { XML_NAMESPACE_STYLE, XML_VERTICAL_ALIGN, XML_TOK_COLUMN_SEP_ALIGN },
+ { XML_NAMESPACE_STYLE, XML_STYLE, XML_TOK_COLUMN_SEP_STYLE },
+ XML_TOKEN_MAP_END
+};
+
+SvXMLEnumMapEntry const pXML_Sep_Style_Enum[] =
+{
+ { XML_NONE, 0 },
+ { XML_SOLID, 1 },
+ { XML_DOTTED, 2 },
+ { XML_DASHED, 3 },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry const pXML_Sep_Align_Enum[] =
+{
+ { XML_TOP, VerticalAlignment_TOP },
+ { XML_MIDDLE, VerticalAlignment_MIDDLE },
+ { XML_BOTTOM, VerticalAlignment_BOTTOM },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+class XMLTextColumnContext_Impl: public SvXMLImportContext
+{
+ text::TextColumn aColumn;
+
+public:
+ TYPEINFO();
+
+ XMLTextColumnContext_Impl( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference<
+ xml::sax::XAttributeList > & xAttrList,
+ const SvXMLTokenMap& rTokenMap );
+
+ virtual ~XMLTextColumnContext_Impl();
+
+ text::TextColumn& getTextColumn() { return aColumn; }
+};
+
+TYPEINIT1( XMLTextColumnContext_Impl, SvXMLImportContext );
+
+XMLTextColumnContext_Impl::XMLTextColumnContext_Impl(
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference<
+ xml::sax::XAttributeList > & xAttrList,
+ const SvXMLTokenMap& rTokenMap ) :
+ SvXMLImportContext( rImport, nPrfx, rLName )
+{
+ aColumn.Width = 0;
+ aColumn.LeftMargin = 0;
+ aColumn.RightMargin = 0;
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ const OUString& rValue = xAttrList->getValueByIndex( i );
+
+ sal_Int32 nVal;
+ switch( rTokenMap.Get( nPrefix, aLocalName ) )
+ {
+ case XML_TOK_COLUMN_WIDTH:
+ {
+ sal_Int32 nPos = rValue.indexOf( (sal_Unicode)'*' );
+ if( nPos != -1 && nPos+1 == rValue.getLength() )
+ {
+ OUString sTmp( rValue.copy( 0, nPos ) );
+ if( GetImport().GetMM100UnitConverter().
+ convertNumber( nVal, sTmp, 0, USHRT_MAX ) )
+ aColumn.Width = nVal;
+ }
+ }
+ break;
+ case XML_TOK_COLUMN_MARGIN_LEFT:
+ if( GetImport().GetMM100UnitConverter().
+ convertMeasure( nVal, rValue ) )
+ aColumn.LeftMargin = nVal;
+ break;
+ case XML_TOK_COLUMN_MARGIN_RIGHT:
+
+ if( GetImport().GetMM100UnitConverter().
+ convertMeasure( nVal, rValue ) )
+ aColumn.RightMargin = nVal;
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+XMLTextColumnContext_Impl::~XMLTextColumnContext_Impl()
+{
+}
+
+// --------------------------------------------------------------------------
+
+class XMLTextColumnSepContext_Impl: public SvXMLImportContext
+{
+ sal_Int32 nWidth;
+ sal_Int32 nColor;
+ sal_Int8 nHeight;
+ sal_Int8 nStyle;
+ VerticalAlignment eVertAlign;
+
+
+public:
+ TYPEINFO();
+
+ XMLTextColumnSepContext_Impl( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference<
+ xml::sax::XAttributeList > & xAttrList,
+ const SvXMLTokenMap& rTokenMap );
+
+ virtual ~XMLTextColumnSepContext_Impl();
+
+ sal_Int32 GetWidth() const { return nWidth; }
+ sal_Int32 GetColor() const { return nColor; }
+ sal_Int8 GetHeight() const { return nHeight; }
+ sal_Int8 GetStyle() const { return nStyle; }
+ VerticalAlignment GetVertAlign() const { return eVertAlign; }
+};
+
+
+TYPEINIT1( XMLTextColumnSepContext_Impl, SvXMLImportContext );
+
+XMLTextColumnSepContext_Impl::XMLTextColumnSepContext_Impl(
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference<
+ xml::sax::XAttributeList > & xAttrList,
+ const SvXMLTokenMap& rTokenMap ) :
+ SvXMLImportContext( rImport, nPrfx, rLName ),
+ nWidth( 2 ),
+ nColor( 0 ),
+ nHeight( 100 ),
+ nStyle( 1 ),
+ eVertAlign( VerticalAlignment_TOP )
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ const OUString& rValue = xAttrList->getValueByIndex( i );
+
+ sal_Int32 nVal;
+ switch( rTokenMap.Get( nPrefix, aLocalName ) )
+ {
+ case XML_TOK_COLUMN_SEP_WIDTH:
+ if( GetImport().GetMM100UnitConverter().
+ convertMeasure( nVal, rValue ) )
+ nWidth = nVal;
+ break;
+ case XML_TOK_COLUMN_SEP_HEIGHT:
+ if( GetImport().GetMM100UnitConverter().
+ convertPercent( nVal, rValue ) &&
+ nVal >=1 && nVal <= 100 )
+ nHeight = (sal_Int8)nVal;
+ break;
+ case XML_TOK_COLUMN_SEP_COLOR:
+ {
+ Color aColor;
+ if( GetImport().GetMM100UnitConverter().
+ convertColor( aColor, rValue ) )
+ nColor = (sal_Int32)aColor.GetColor();
+ }
+ break;
+ case XML_TOK_COLUMN_SEP_ALIGN:
+ {
+ sal_uInt16 nAlign;
+ if( GetImport().GetMM100UnitConverter().
+ convertEnum( nAlign, rValue,
+ pXML_Sep_Align_Enum ) )
+ eVertAlign = (VerticalAlignment)nAlign;
+ }
+ break;
+ case XML_TOK_COLUMN_SEP_STYLE:
+ {
+ sal_uInt16 nStyleVal;
+ if( GetImport().GetMM100UnitConverter().
+ convertEnum( nStyleVal, rValue,
+ pXML_Sep_Style_Enum ) )
+ nStyle = (sal_Int8)nStyleVal;
+ }
+ break;
+ }
+ }
+}
+
+XMLTextColumnSepContext_Impl::~XMLTextColumnSepContext_Impl()
+{
+}
+
+// --------------------------------------------------------------------------
+
+typedef XMLTextColumnContext_Impl *XMLTextColumnContext_ImplPtr;
+SV_DECL_PTRARR( XMLTextColumnsArray_Impl, XMLTextColumnContext_ImplPtr, 5, 5 )
+
+TYPEINIT1( XMLTextColumnsContext, XMLElementPropertyContext );
+
+XMLTextColumnsContext::XMLTextColumnsContext(
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const Reference< xml::sax::XAttributeList >&
+ xAttrList,
+ const XMLPropertyState& rProp,
+ ::std::vector< XMLPropertyState > &rProps )
+: XMLElementPropertyContext( rImport, nPrfx, rLName, rProp, rProps )
+, sSeparatorLineIsOn(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineIsOn"))
+, sSeparatorLineWidth(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineWidth"))
+, sSeparatorLineColor(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineColor"))
+, sSeparatorLineRelativeHeight(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineRelativeHeight"))
+, sSeparatorLineVerticalAlignment(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineVerticalAlignment"))
+, sIsAutomatic(RTL_CONSTASCII_USTRINGPARAM("IsAutomatic"))
+, sAutomaticDistance(RTL_CONSTASCII_USTRINGPARAM("AutomaticDistance"))
+, sSeparatorLineStyle(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineStyle"))
+, pColumns( 0 )
+, pColumnSep( 0 )
+, pColumnAttrTokenMap( new SvXMLTokenMap(aColAttrTokenMap) )
+, pColumnSepAttrTokenMap( new SvXMLTokenMap(aColSepAttrTokenMap) )
+, nCount( 0 )
+, bAutomatic( sal_False )
+, nAutomaticDistance( 0 )
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ sal_Int32 nVal;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ const OUString& rValue = xAttrList->getValueByIndex( i );
+ if( XML_NAMESPACE_FO == nPrefix )
+ {
+ if( IsXMLToken( aLocalName, XML_COLUMN_COUNT ) &&
+ GetImport().GetMM100UnitConverter().
+ convertNumber( nVal, rValue, 0, SHRT_MAX ) )
+ {
+ nCount = (sal_Int16)nVal;
+ }
+ else if( IsXMLToken( aLocalName, XML_COLUMN_GAP ) )
+ {
+ bAutomatic = GetImport().GetMM100UnitConverter().
+ convertMeasure( nAutomaticDistance, rValue );
+ }
+ }
+ }
+}
+
+XMLTextColumnsContext::~XMLTextColumnsContext()
+{
+ if( pColumns )
+ {
+ sal_uInt16 nColCount = pColumns->Count();
+ while( nColCount )
+ {
+ nColCount--;
+ XMLTextColumnContext_Impl *pColumn = (*pColumns)[nColCount];
+ pColumns->Remove( nColCount, 1 );
+ pColumn->ReleaseRef();
+ }
+ }
+ if( pColumnSep )
+ pColumnSep->ReleaseRef();
+
+ delete pColumns;
+ delete pColumnAttrTokenMap;
+ delete pColumnSepAttrTokenMap;
+}
+
+SvXMLImportContext *XMLTextColumnsContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList )
+{
+ SvXMLImportContext *pContext = 0;
+
+ if( XML_NAMESPACE_STYLE == nPrefix &&
+ IsXMLToken( rLocalName, XML_COLUMN ) )
+ {
+ XMLTextColumnContext_Impl *pColumn =
+ new XMLTextColumnContext_Impl( GetImport(), nPrefix, rLocalName,
+ xAttrList, *pColumnAttrTokenMap );
+
+ // add new tabstop to array of tabstops
+ if( !pColumns )
+ pColumns = new XMLTextColumnsArray_Impl;
+
+ pColumns->Insert( pColumn, pColumns->Count() );
+ pColumn->AddRef();
+
+ pContext = pColumn;
+ }
+ else if( XML_NAMESPACE_STYLE == nPrefix &&
+ IsXMLToken( rLocalName, XML_COLUMN_SEP ) )
+ {
+ pColumnSep =
+ new XMLTextColumnSepContext_Impl( GetImport(), nPrefix, rLocalName,
+ xAttrList, *pColumnSepAttrTokenMap );
+ pColumnSep->AddRef();
+
+ pContext = pColumnSep;
+ }
+ else
+ {
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+ }
+
+ return pContext;
+}
+
+void XMLTextColumnsContext::EndElement( )
+{
+ Reference<XMultiServiceFactory> xFactory(GetImport().GetModel(),UNO_QUERY);
+ if( !xFactory.is() )
+ return;
+
+ Reference<XInterface> xIfc = xFactory->createInstance(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextColumns")));
+ if( !xIfc.is() )
+ return;
+
+ Reference< XTextColumns > xColumns( xIfc, UNO_QUERY );
+ if ( 0 == nCount )
+ {
+ // zero columns = no columns -> 1 column
+ xColumns->setColumnCount( 1 );
+ }
+ else if( !bAutomatic && pColumns &&
+ pColumns->Count() == (sal_uInt16)nCount )
+ {
+ // if we have column descriptions, one per column, and we don't use
+ // automatic width, then set the column widths
+
+ sal_Int32 nRelWidth = 0;
+ sal_uInt16 nColumnsWithWidth = 0;
+ sal_Int16 i;
+
+ for( i = 0; i < nCount; i++ )
+ {
+ const TextColumn& rColumn =
+ (*pColumns)[(sal_uInt16)i]->getTextColumn();
+ if( rColumn.Width > 0 )
+ {
+ nRelWidth += rColumn.Width;
+ nColumnsWithWidth++;
+ }
+ }
+ if( nColumnsWithWidth < nCount )
+ {
+ sal_Int32 nColWidth = 0==nRelWidth
+ ? USHRT_MAX / nCount
+ : nRelWidth / nColumnsWithWidth;
+
+ for( i=0; i < nCount; i++ )
+ {
+ TextColumn& rColumn =
+ (*pColumns)[(sal_uInt16)i]->getTextColumn();
+ if( rColumn.Width == 0 )
+ {
+ rColumn.Width = nColWidth;
+ nRelWidth += rColumn.Width;
+ if( 0 == --nColumnsWithWidth )
+ break;
+ }
+ }
+ }
+
+ Sequence< TextColumn > aColumns( (sal_Int32)nCount );
+ TextColumn *pTextColumns = aColumns.getArray();
+ for( i=0; i < nCount; i++ )
+ *pTextColumns++ = (*pColumns)[(sal_uInt16)i]->getTextColumn();
+
+ xColumns->setColumns( aColumns );
+ }
+ else
+ {
+ // only set column count (and let the columns be distributed
+ // automatically)
+
+ xColumns->setColumnCount( nCount );
+ }
+
+ Reference < XPropertySet > xPropSet( xColumns, UNO_QUERY );
+ if( xPropSet.is() )
+ {
+ Any aAny;
+ sal_Bool bOn = pColumnSep != 0;
+
+ aAny.setValue( &bOn, ::getBooleanCppuType() );
+ xPropSet->setPropertyValue( sSeparatorLineIsOn, aAny );
+
+ if( pColumnSep )
+ {
+ if( pColumnSep->GetWidth() )
+ {
+ aAny <<= pColumnSep->GetWidth();
+ xPropSet->setPropertyValue( sSeparatorLineWidth, aAny );
+ }
+ if( pColumnSep->GetHeight() )
+ {
+ aAny <<= pColumnSep->GetHeight();
+ xPropSet->setPropertyValue( sSeparatorLineRelativeHeight,
+ aAny );
+ }
+ if ( pColumnSep->GetStyle() )
+ {
+ aAny <<= pColumnSep->GetStyle();
+ xPropSet->setPropertyValue( sSeparatorLineStyle, aAny );
+ }
+
+
+ aAny <<= pColumnSep->GetColor();
+ xPropSet->setPropertyValue( sSeparatorLineColor, aAny );
+
+
+ aAny <<= pColumnSep->GetVertAlign();
+ xPropSet->setPropertyValue( sSeparatorLineVerticalAlignment, aAny );
+ }
+
+ // handle 'automatic columns': column distance
+ if( bAutomatic )
+ {
+ aAny <<= nAutomaticDistance;
+ xPropSet->setPropertyValue( sAutomaticDistance, aAny );
+ }
+ }
+
+ aProp.maValue <<= xColumns;
+
+ SetInsert( sal_True );
+ XMLElementPropertyContext::EndElement();
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLTextColumnsExport.cxx b/xmloff/source/text/XMLTextColumnsExport.cxx
new file mode 100644
index 000000000000..a4c58f4651d9
--- /dev/null
+++ b/xmloff/source/text/XMLTextColumnsExport.cxx
@@ -0,0 +1,210 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#include <rtl/ustrbuf.hxx>
+
+
+#include <com/sun/star/text/XTextColumns.hpp>
+#include <com/sun/star/text/TextColumn.hpp>
+#include <com/sun/star/style/VerticalAlignment.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmlexp.hxx>
+#include "XMLTextColumnsExport.hxx"
+
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using namespace ::xmloff::token;
+
+
+XMLTextColumnsExport::XMLTextColumnsExport( SvXMLExport& rExp ) :
+ rExport( rExp ),
+ sSeparatorLineIsOn(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineIsOn")),
+ sSeparatorLineWidth(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineWidth")),
+ sSeparatorLineColor(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineColor")),
+ sSeparatorLineRelativeHeight(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineRelativeHeight")),
+ sSeparatorLineVerticalAlignment(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineVerticalAlignment")),
+ sIsAutomatic(RTL_CONSTASCII_USTRINGPARAM("IsAutomatic")),
+ sAutomaticDistance(RTL_CONSTASCII_USTRINGPARAM("AutomaticDistance")),
+ sSeparatorLineStyle(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineStyle"))
+{
+}
+
+void XMLTextColumnsExport::exportXML( const Any& rAny )
+{
+ Reference < XTextColumns > xColumns;
+ rAny >>= xColumns;
+
+ Sequence < TextColumn > aColumns = xColumns->getColumns();
+ const TextColumn *pColumns = aColumns.getArray();
+ sal_Int32 nCount = aColumns.getLength();
+
+ OUStringBuffer sValue;
+ GetExport().GetMM100UnitConverter().convertNumber( sValue, nCount ? nCount : 1 );
+ GetExport().AddAttribute( XML_NAMESPACE_FO, XML_COLUMN_COUNT,
+ sValue.makeStringAndClear() );
+
+ // handle 'automatic' columns
+ Reference < XPropertySet > xPropSet( xColumns, UNO_QUERY );
+ if( xPropSet.is() )
+ {
+ Any aAny = xPropSet->getPropertyValue( sIsAutomatic );
+ if ( *(sal_Bool*)aAny.getValue() )
+ {
+ aAny = xPropSet->getPropertyValue( sAutomaticDistance );
+ sal_Int32 nDistance = 0;
+ aAny >>= nDistance;
+ OUStringBuffer aBuffer;
+ GetExport().GetMM100UnitConverter().convertMeasure(
+ aBuffer, nDistance );
+ GetExport().AddAttribute( XML_NAMESPACE_FO,
+ XML_COLUMN_GAP,
+ aBuffer.makeStringAndClear() );
+ }
+ }
+
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_STYLE, XML_COLUMNS,
+ sal_True, sal_True );
+
+ if( xPropSet.is() )
+ {
+ Any aAny = xPropSet->getPropertyValue( sSeparatorLineIsOn );
+ if( *(sal_Bool *)aAny.getValue() )
+ {
+ // style:width
+ aAny = xPropSet->getPropertyValue( sSeparatorLineWidth );
+ sal_Int32 nWidth = 0;
+ aAny >>= nWidth;
+ GetExport().GetMM100UnitConverter().convertMeasure( sValue,
+ nWidth );
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_WIDTH,
+ sValue.makeStringAndClear() );
+
+ // style:color
+ aAny = xPropSet->getPropertyValue( sSeparatorLineColor );
+ sal_Int32 nColor = 0;
+ aAny >>= nColor;
+ GetExport().GetMM100UnitConverter().convertColor( sValue,
+ nColor );
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_COLOR,
+ sValue.makeStringAndClear() );
+
+ // style:height
+ aAny = xPropSet->getPropertyValue( sSeparatorLineRelativeHeight );
+ sal_Int8 nHeight = 0;
+ aAny >>= nHeight;
+ GetExport().GetMM100UnitConverter().convertPercent( sValue,
+ nHeight );
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_HEIGHT,
+ sValue.makeStringAndClear() );
+
+ // style::style
+ aAny = xPropSet->getPropertyValue( sSeparatorLineStyle );
+ sal_Int8 nStyle = 0;
+ aAny >>= nStyle;
+
+ enum XMLTokenEnum eStr = XML_TOKEN_INVALID;
+ switch ( nStyle )
+ {
+ case 0: eStr = XML_NONE; break;
+ case 1: eStr = XML_SOLID; break;
+ case 2: eStr = XML_DOTTED; break;
+ case 3: eStr = XML_DASHED; break;
+ default:
+ break;
+ }
+ if ( eStr != XML_TOKEN_INVALID )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_STYLE, eStr );
+
+ // style:vertical-align
+ aAny = xPropSet->getPropertyValue( sSeparatorLineVerticalAlignment );
+ VerticalAlignment eVertAlign;
+ aAny >>= eVertAlign;
+
+ eStr = XML_TOKEN_INVALID;
+ switch( eVertAlign )
+ {
+// case VerticalAlignment_TOP: eStr = XML_TOP;
+ case VerticalAlignment_MIDDLE: eStr = XML_MIDDLE; break;
+ case VerticalAlignment_BOTTOM: eStr = XML_BOTTOM; break;
+ default:
+ break;
+ }
+
+ if( eStr != XML_TOKEN_INVALID)
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE,
+ XML_VERTICAL_ALIGN, eStr );
+
+ // style:column-sep
+ SvXMLElementExport aElement( GetExport(), XML_NAMESPACE_STYLE,
+ XML_COLUMN_SEP,
+ sal_True, sal_True );
+ }
+ }
+
+ while( nCount-- )
+ {
+ // style:rel-width
+ GetExport().GetMM100UnitConverter().convertNumber( sValue,
+ pColumns->Width );
+ sValue.append( (sal_Unicode)'*' );
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_REL_WIDTH,
+ sValue.makeStringAndClear() );
+
+ // fo:margin-left
+ GetExport().GetMM100UnitConverter().convertMeasure( sValue,
+ pColumns->LeftMargin );
+ GetExport().AddAttribute( XML_NAMESPACE_FO, XML_START_INDENT,
+ sValue.makeStringAndClear() );
+
+ // fo:margin-right
+ GetExport().GetMM100UnitConverter().convertMeasure( sValue,
+ pColumns->RightMargin );
+ GetExport().AddAttribute( XML_NAMESPACE_FO, XML_END_INDENT,
+ sValue.makeStringAndClear() );
+
+ // style:column
+ SvXMLElementExport aElement( GetExport(), XML_NAMESPACE_STYLE, XML_COLUMN,
+ sal_True, sal_True );
+ pColumns++;
+ }
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx
new file mode 100644
index 000000000000..58023ef5849e
--- /dev/null
+++ b/xmloff/source/text/XMLTextFrameContext.cxx
@@ -0,0 +1,1657 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/text/TextContentAnchorType.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/text/XTextFrame.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/text/SizeType.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#include <com/sun/star/document/XEmbeddedObjectSupplier.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/text/HoriOrientation.hpp>
+#include <com/sun/star/text/VertOrientation.hpp>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "XMLAnchorTypePropHdl.hxx"
+#include "XMLEmbeddedObjectImportContext.hxx"
+#include <xmloff/XMLBase64ImportContext.hxx>
+#include "XMLReplacementImageContext.hxx"
+#include <xmloff/prstylei.hxx>
+#include "xmloff/i18nmap.hxx"
+#include "xexptran.hxx"
+#include <xmloff/shapeimport.hxx>
+#include <xmloff/XMLEventsImportContext.hxx>
+#include "XMLImageMapContext.hxx"
+#include "XMLTextFrameContext.hxx"
+
+#include "XMLTextListBlockContext.hxx"
+#include "XMLTextListItemContext.hxx"
+#include <xmloff/attrlist.hxx>
+#include <comphelper/stl_types.hxx>
+
+#include <map>
+
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::document;
+using namespace ::xmloff::token;
+using ::com::sun::star::document::XEventsSupplier;
+
+#define XML_TEXT_FRAME_TEXTBOX 1
+#define XML_TEXT_FRAME_GRAPHIC 2
+#define XML_TEXT_FRAME_OBJECT 3
+#define XML_TEXT_FRAME_OBJECT_OLE 4
+#define XML_TEXT_FRAME_APPLET 5
+#define XML_TEXT_FRAME_PLUGIN 6
+#define XML_TEXT_FRAME_FLOATING_FRAME 7
+
+typedef ::std::map < const ::rtl::OUString, ::rtl::OUString, ::comphelper::UStringLess> ParamMap;
+
+class XMLTextFrameContextHyperlink_Impl
+{
+ OUString sHRef;
+ OUString sName;
+ OUString sTargetFrameName;
+ sal_Bool bMap;
+
+public:
+
+ inline XMLTextFrameContextHyperlink_Impl( const OUString& rHRef,
+ const OUString& rName,
+ const OUString& rTargetFrameName,
+ sal_Bool bMap );
+
+ const OUString& GetHRef() const { return sHRef; }
+ const OUString& GetName() const { return sName; }
+ const OUString& GetTargetFrameName() const { return sTargetFrameName; }
+ sal_Bool GetMap() const { return bMap; }
+};
+
+inline XMLTextFrameContextHyperlink_Impl::XMLTextFrameContextHyperlink_Impl(
+ const OUString& rHRef, const OUString& rName,
+ const OUString& rTargetFrameName, sal_Bool bM ) :
+ sHRef( rHRef ),
+ sName( rName ),
+ sTargetFrameName( rTargetFrameName ),
+ bMap( bM )
+{
+}
+
+// Implement Title/Description Elements UI (#i73249#)
+class XMLTextFrameTitleOrDescContext_Impl : public SvXMLImportContext
+{
+ OUString& mrTitleOrDesc;
+
+public:
+
+ TYPEINFO();
+
+ XMLTextFrameTitleOrDescContext_Impl( SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ OUString& rTitleOrDesc );
+ virtual ~XMLTextFrameTitleOrDescContext_Impl();
+
+ virtual void Characters( const OUString& rText );
+};
+
+TYPEINIT1( XMLTextFrameTitleOrDescContext_Impl, SvXMLImportContext );
+
+XMLTextFrameTitleOrDescContext_Impl::XMLTextFrameTitleOrDescContext_Impl(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLName,
+ OUString& rTitleOrDesc )
+ : SvXMLImportContext( rImport, nPrfx, rLName )
+ , mrTitleOrDesc( rTitleOrDesc )
+{
+}
+
+XMLTextFrameTitleOrDescContext_Impl::~XMLTextFrameTitleOrDescContext_Impl()
+{
+}
+
+void XMLTextFrameTitleOrDescContext_Impl::Characters( const OUString& rText )
+{
+ mrTitleOrDesc += rText;
+}
+
+// ------------------------------------------------------------------------
+
+class XMLTextFrameParam_Impl : public SvXMLImportContext
+{
+public:
+
+ TYPEINFO();
+
+ XMLTextFrameParam_Impl( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
+ sal_uInt16 nType,
+ ParamMap &rParamMap);
+ virtual ~XMLTextFrameParam_Impl();
+};
+
+TYPEINIT1( XMLTextFrameParam_Impl, SvXMLImportContext );
+
+XMLTextFrameParam_Impl::~XMLTextFrameParam_Impl()
+{
+}
+
+XMLTextFrameParam_Impl::XMLTextFrameParam_Impl(
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
+ sal_uInt16 /*nType*/,
+ ParamMap &rParamMap):
+ SvXMLImportContext( rImport, nPrfx, rLName )
+{
+ OUString sName, sValue;
+ sal_Bool bFoundValue = sal_False; // to allow empty values
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ const OUString& rValue = xAttrList->getValueByIndex( i );
+
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName );
+ if ( XML_NAMESPACE_DRAW == nPrefix )
+ {
+ if( IsXMLToken(aLocalName, XML_VALUE) )
+ {
+ sValue = rValue;
+ bFoundValue=sal_True;
+ }
+ else if( IsXMLToken(aLocalName, XML_NAME) )
+ {
+ sName = rValue;
+ }
+ }
+ }
+ if (sName.getLength() && bFoundValue )
+ rParamMap[sName] = sValue;
+}
+class XMLTextFrameContourContext_Impl : public SvXMLImportContext
+{
+ Reference < XPropertySet > xPropSet;
+
+public:
+
+ TYPEINFO();
+
+ XMLTextFrameContourContext_Impl( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
+ const Reference < XPropertySet >& rPropSet,
+ sal_Bool bPath );
+ virtual ~XMLTextFrameContourContext_Impl();
+};
+
+TYPEINIT1( XMLTextFrameContourContext_Impl, SvXMLImportContext );
+
+XMLTextFrameContourContext_Impl::XMLTextFrameContourContext_Impl(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx, const OUString& rLName,
+ const Reference< XAttributeList > & xAttrList,
+ const Reference < XPropertySet >& rPropSet,
+ sal_Bool bPath ) :
+ SvXMLImportContext( rImport, nPrfx, rLName ),
+ xPropSet( rPropSet )
+{
+ OUString sD, sPoints, sViewBox;
+ sal_Bool bPixelWidth = sal_False, bPixelHeight = sal_False;
+ sal_Bool bAuto = sal_False;
+ sal_Int32 nWidth = 0;
+ sal_Int32 nHeight = 0;
+
+ const SvXMLTokenMap& rTokenMap =
+ GetImport().GetTextImport()->GetTextContourAttrTokenMap();
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ const OUString& rValue = xAttrList->getValueByIndex( i );
+
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ switch( rTokenMap.Get( nPrefix, aLocalName ) )
+ {
+ case XML_TOK_TEXT_CONTOUR_VIEWBOX:
+ sViewBox = rValue;
+ break;
+ case XML_TOK_TEXT_CONTOUR_D:
+ if( bPath )
+ sD = rValue;
+ break;
+ case XML_TOK_TEXT_CONTOUR_POINTS:
+ if( !bPath )
+ sPoints = rValue;
+ break;
+ case XML_TOK_TEXT_CONTOUR_WIDTH:
+ if( GetImport().GetMM100UnitConverter().convertMeasurePx( nWidth,
+ rValue) )
+ bPixelWidth = sal_True;
+ else
+ GetImport().GetMM100UnitConverter().convertMeasure( nWidth,
+ rValue);
+ break;
+ case XML_TOK_TEXT_CONTOUR_HEIGHT:
+ if( GetImport().GetMM100UnitConverter().convertMeasurePx( nHeight,
+ rValue) )
+ bPixelHeight = sal_True;
+ else
+ GetImport().GetMM100UnitConverter().convertMeasure( nHeight,
+ rValue);
+ break;
+ case XML_TOK_TEXT_CONTOUR_AUTO:
+ bAuto = IsXMLToken(rValue, XML_TRUE);
+ break;
+ }
+ }
+
+ OUString sContourPolyPolygon(
+ RTL_CONSTASCII_USTRINGPARAM("ContourPolyPolygon") );
+ Reference < XPropertySetInfo > xPropSetInfo =
+ rPropSet->getPropertySetInfo();
+ if( xPropSetInfo->hasPropertyByName(
+ sContourPolyPolygon ) &&
+ nWidth > 0 && nHeight > 0 && bPixelWidth == bPixelHeight &&
+ (bPath ? sD : sPoints).getLength() )
+ {
+ awt::Point aPoint( 0, 0 );
+ awt::Size aSize( nWidth, nHeight );
+ SdXMLImExViewBox aViewBox( sViewBox,
+ GetImport().GetMM100UnitConverter());
+ Any aAny;
+ if( bPath )
+ {
+ SdXMLImExSvgDElement aPoints( sD, aViewBox, aPoint, aSize,
+ GetImport().GetMM100UnitConverter() );
+ aAny <<= aPoints.GetPointSequenceSequence();
+ }
+ else
+ {
+ SdXMLImExPointsElement aPoints( sPoints, aViewBox, aPoint, aSize,
+ GetImport().GetMM100UnitConverter() );
+ aAny <<= aPoints.GetPointSequenceSequence();
+ }
+
+ OUString sIsPixelContour(
+ RTL_CONSTASCII_USTRINGPARAM("IsPixelContour") );
+ xPropSet->setPropertyValue( sContourPolyPolygon, aAny );
+
+ if( xPropSetInfo->hasPropertyByName( sIsPixelContour ) )
+ {
+ aAny.setValue( &bPixelWidth, ::getBooleanCppuType() );
+ xPropSet->setPropertyValue( sIsPixelContour, aAny );
+ }
+
+ OUString sIsAutomaticContour(
+ RTL_CONSTASCII_USTRINGPARAM("IsAutomaticContour") );
+ if( xPropSetInfo->hasPropertyByName( sIsAutomaticContour ) )
+ {
+ aAny.setValue( &bAuto, ::getBooleanCppuType() );
+ xPropSet->setPropertyValue( sIsAutomaticContour, aAny );
+ }
+ }
+}
+
+XMLTextFrameContourContext_Impl::~XMLTextFrameContourContext_Impl()
+{
+}
+
+// ------------------------------------------------------------------------
+
+class XMLTextFrameContext_Impl : public SvXMLImportContext
+{
+ ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextCursor > xOldTextCursor;
+ ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > xPropSet;
+ ::com::sun::star::uno::Reference <
+ ::com::sun::star::io::XOutputStream > xBase64Stream;
+
+ /// old list item and block (#89891#)
+ bool mbListContextPushed;
+
+ const ::rtl::OUString sWidth;
+ const ::rtl::OUString sWidthType;
+ const ::rtl::OUString sRelativeWidth;
+ const ::rtl::OUString sHeight;
+ const ::rtl::OUString sRelativeHeight;
+ const ::rtl::OUString sSizeType;
+ const ::rtl::OUString sIsSyncWidthToHeight;
+ const ::rtl::OUString sIsSyncHeightToWidth;
+ const ::rtl::OUString sHoriOrient;
+ const ::rtl::OUString sHoriOrientPosition;
+ const ::rtl::OUString sVertOrient;
+ const ::rtl::OUString sVertOrientPosition;
+ const ::rtl::OUString sChainNextName;
+ const ::rtl::OUString sAnchorType;
+ const ::rtl::OUString sAnchorPageNo;
+ const ::rtl::OUString sGraphicURL;
+ const ::rtl::OUString sGraphicFilter;
+ const ::rtl::OUString sTitle;
+ const ::rtl::OUString sDescription;
+ const ::rtl::OUString sFrameStyleName;
+ const ::rtl::OUString sGraphicRotation;
+ const ::rtl::OUString sTextBoxServiceName;
+ const ::rtl::OUString sGraphicServiceName;
+
+ ::rtl::OUString sName;
+ ::rtl::OUString sStyleName;
+ ::rtl::OUString sNextName;
+ ::rtl::OUString sHRef;
+ ::rtl::OUString sFilterName;
+ ::rtl::OUString sCode;
+ ::rtl::OUString sObject;
+ ::rtl::OUString sArchive;
+ ::rtl::OUString sMimeType;
+ ::rtl::OUString sFrameName;
+ ::rtl::OUString sAppletName;
+ ::rtl::OUString sFilterService;
+ ::rtl::OUString sBase64CharsLeft;
+ ::rtl::OUString sTblName;
+
+ ParamMap aParamMap;
+
+ sal_Int32 nX;
+ sal_Int32 nY;
+ sal_Int32 nWidth;
+ sal_Int32 nHeight;
+ sal_Int32 nZIndex;
+ sal_Int16 nPage;
+ sal_Int16 nRotation;
+ sal_Int16 nRelWidth;
+ sal_Int16 nRelHeight;
+
+ sal_uInt16 nType;
+ ::com::sun::star::text::TextContentAnchorType eAnchorType;
+
+ sal_Bool bMayScript : 1;
+ sal_Bool bMinWidth : 1;
+ sal_Bool bMinHeight : 1;
+ sal_Bool bSyncWidth : 1;
+ sal_Bool bSyncHeight : 1;
+ sal_Bool bCreateFailed : 1;
+ sal_Bool bOwnBase64Stream : 1;
+
+ void Create( sal_Bool bHRefOrBase64 );
+
+public:
+
+ TYPEINFO();
+
+ sal_Bool CreateIfNotThere();
+
+ XMLTextFrameContext_Impl( SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & rAttrList,
+ ::com::sun::star::text::TextContentAnchorType eAnchorType,
+ sal_uInt16 nType,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & rFrameAttrList );
+ virtual ~XMLTextFrameContext_Impl();
+
+ virtual void EndElement();
+
+ virtual void Characters( const ::rtl::OUString& rChars );
+
+ SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+ void SetHyperlink( const ::rtl::OUString& rHRef,
+ const ::rtl::OUString& rName,
+ const ::rtl::OUString& rTargetFrameName,
+ sal_Bool bMap );
+
+ // Implement Title/Description Elements UI (#i73249#)
+ void SetTitle( const ::rtl::OUString& rTitle );
+
+ void SetDesc( const ::rtl::OUString& rDesc );
+
+ ::com::sun::star::text::TextContentAnchorType GetAnchorType() const { return eAnchorType; }
+
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet >& GetPropSet() { return xPropSet; }
+};
+
+TYPEINIT1( XMLTextFrameContext_Impl, SvXMLImportContext );
+
+void XMLTextFrameContext_Impl::Create( sal_Bool /*bHRefOrBase64*/ )
+{
+ UniReference < XMLTextImportHelper > xTextImportHelper =
+ GetImport().GetTextImport();
+
+ switch ( nType)
+ {
+ case XML_TEXT_FRAME_OBJECT:
+ case XML_TEXT_FRAME_OBJECT_OLE:
+ if( xBase64Stream.is() )
+ {
+ OUString sURL( GetImport().ResolveEmbeddedObjectURLFromBase64() );
+ if( sURL.getLength() )
+ xPropSet = GetImport().GetTextImport()
+ ->createAndInsertOLEObject( GetImport(), sURL,
+ sStyleName,
+ sTblName,
+ nWidth, nHeight );
+ }
+ else if( sHRef.getLength() )
+ {
+ OUString sURL( GetImport().ResolveEmbeddedObjectURL( sHRef,
+ OUString() ) );
+
+ if( GetImport().IsPackageURL( sHRef ) )
+ {
+ xPropSet = GetImport().GetTextImport()
+ ->createAndInsertOLEObject( GetImport(), sURL,
+ sStyleName,
+ sTblName,
+ nWidth, nHeight );
+ }
+ else
+ {
+ // it should be an own OOo link that has no storage persistance
+ xPropSet = GetImport().GetTextImport()
+ ->createAndInsertOOoLink( GetImport(),
+ sURL,
+ sStyleName,
+ sTblName,
+ nWidth, nHeight );
+ }
+ }
+ else
+ {
+ OUString sURL( RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.ServiceName:") );
+ sURL += sFilterService;
+ xPropSet = GetImport().GetTextImport()
+ ->createAndInsertOLEObject( GetImport(), sURL,
+ sStyleName,
+ sTblName,
+ nWidth, nHeight );
+
+ }
+ break;
+ case XML_TEXT_FRAME_APPLET:
+ {
+ xPropSet = GetImport().GetTextImport()
+ ->createAndInsertApplet( sAppletName, sCode,
+ bMayScript, sHRef,
+ nWidth, nHeight);
+ break;
+ }
+ case XML_TEXT_FRAME_PLUGIN:
+ {
+ if(sHRef.getLength())
+ GetImport().GetAbsoluteReference(sHRef);
+ xPropSet = GetImport().GetTextImport()
+ ->createAndInsertPlugin( sMimeType, sHRef,
+ nWidth, nHeight);
+
+ break;
+ }
+ case XML_TEXT_FRAME_FLOATING_FRAME:
+ {
+ xPropSet = GetImport().GetTextImport()
+ ->createAndInsertFloatingFrame( sFrameName, sHRef,
+ sStyleName,
+ nWidth, nHeight);
+ break;
+ }
+ default:
+ {
+ Reference<XMultiServiceFactory> xFactory( GetImport().GetModel(),
+ UNO_QUERY );
+ if( xFactory.is() )
+ {
+ OUString sServiceName;
+ switch( nType )
+ {
+ case XML_TEXT_FRAME_TEXTBOX: sServiceName = sTextBoxServiceName; break;
+ case XML_TEXT_FRAME_GRAPHIC: sServiceName = sGraphicServiceName; break;
+ }
+ Reference<XInterface> xIfc = xFactory->createInstance( sServiceName );
+ DBG_ASSERT( xIfc.is(), "couldn't create frame" );
+ if( xIfc.is() )
+ xPropSet = Reference < XPropertySet >( xIfc, UNO_QUERY );
+ }
+ }
+ }
+
+ if( !xPropSet.is() )
+ {
+ bCreateFailed = sal_True;
+ return;
+ }
+
+ Reference< XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
+
+ // set name
+ Reference < XNamed > xNamed( xPropSet, UNO_QUERY );
+ if( xNamed.is() )
+ {
+ OUString sOrigName( xNamed->getName() );
+ if( !sOrigName.getLength() ||
+ (sName.getLength() && sOrigName != sName) )
+ {
+ OUString sOldName( sName );
+ sal_Int32 i = 0;
+ while( xTextImportHelper->HasFrameByName( sName ) )
+ {
+ sName = sOldName;
+ sName += OUString::valueOf( ++i );
+ }
+ xNamed->setName( sName );
+ if( sName != sOldName )
+ xTextImportHelper->GetRenameMap().Add( XML_TEXT_RENAME_TYPE_FRAME,
+ sOldName, sName );
+ }
+ }
+
+ // frame style
+ XMLPropStyleContext *pStyle = 0;
+ if( sStyleName.getLength() )
+ {
+ pStyle = xTextImportHelper->FindAutoFrameStyle( sStyleName );
+ if( pStyle )
+ sStyleName = pStyle->GetParentName();
+ }
+
+ Any aAny;
+ if( sStyleName.getLength() )
+ {
+ OUString sDisplayStyleName( GetImport().GetStyleDisplayName(
+ XML_STYLE_FAMILY_SD_GRAPHICS_ID, sStyleName ) );
+ const Reference < XNameContainer > & rStyles =
+ xTextImportHelper->GetFrameStyles();
+ if( rStyles.is() &&
+ rStyles->hasByName( sDisplayStyleName ) )
+ {
+ aAny <<= sDisplayStyleName;
+ xPropSet->setPropertyValue( sFrameStyleName, aAny );
+ }
+ }
+
+ // anchor type (must be set before any other properties, because
+ // otherwise some orientations cannot be set or will be changed
+ // afterwards)
+ aAny <<= eAnchorType;
+ xPropSet->setPropertyValue( sAnchorType, aAny );
+
+ // hard properties
+ if( pStyle )
+ pStyle->FillPropertySet( xPropSet );
+
+
+ // x and y
+ sal_Int16 nHoriOrient = HoriOrientation::NONE;
+ aAny = xPropSet->getPropertyValue( sHoriOrient );
+ aAny >>= nHoriOrient;
+ if( HoriOrientation::NONE == nHoriOrient )
+ {
+ aAny <<= nX;
+ xPropSet->setPropertyValue( sHoriOrientPosition, aAny );
+ }
+
+ sal_Int16 nVertOrient = VertOrientation::NONE;
+ aAny = xPropSet->getPropertyValue( sVertOrient );
+ aAny >>= nVertOrient;
+ if( VertOrientation::NONE == nVertOrient )
+ {
+ aAny <<= nY;
+ xPropSet->setPropertyValue( sVertOrientPosition, aAny );
+ }
+
+ // width
+ if( nWidth > 0 )
+ {
+ aAny <<= nWidth;
+ xPropSet->setPropertyValue( sWidth, aAny );
+ }
+ if( nRelWidth > 0 || nWidth > 0 )
+ {
+ aAny <<= nRelWidth;
+ xPropSet->setPropertyValue( sRelativeWidth, aAny );
+ }
+ if( bSyncWidth || nWidth > 0 )
+ {
+ sal_Bool bTmp = bSyncWidth;
+ aAny.setValue( &bTmp, ::getBooleanCppuType() );
+ xPropSet->setPropertyValue( sIsSyncWidthToHeight, aAny );
+ }
+ if( xPropSetInfo->hasPropertyByName( sWidthType ) &&
+ (bMinWidth || nWidth > 0 || nRelWidth > 0 ) )
+ {
+ sal_Int16 nSizeType =
+ (bMinWidth && XML_TEXT_FRAME_TEXTBOX == nType) ? SizeType::MIN
+ : SizeType::FIX;
+ aAny <<= nSizeType;
+ xPropSet->setPropertyValue( sWidthType, aAny );
+ }
+
+ if( nHeight > 0 )
+ {
+ aAny <<= nHeight;
+ xPropSet->setPropertyValue( sHeight, aAny );
+ }
+ if( nRelHeight > 0 || nHeight > 0 )
+ {
+ aAny <<= nRelHeight;
+ xPropSet->setPropertyValue( sRelativeHeight, aAny );
+ }
+ if( bSyncHeight || nHeight > 0 )
+ {
+ sal_Bool bTmp = bSyncHeight;
+ aAny.setValue( &bTmp, ::getBooleanCppuType() );
+ xPropSet->setPropertyValue( sIsSyncHeightToWidth, aAny );
+ }
+ if( xPropSetInfo->hasPropertyByName( sSizeType ) &&
+ (bMinHeight || nHeight > 0 || nRelHeight > 0 ) )
+ {
+ sal_Int16 nSizeType =
+ (bMinHeight && XML_TEXT_FRAME_TEXTBOX == nType) ? SizeType::MIN
+ : SizeType::FIX;
+ aAny <<= nSizeType;
+ xPropSet->setPropertyValue( sSizeType, aAny );
+ }
+
+ if( XML_TEXT_FRAME_GRAPHIC == nType )
+ {
+ // URL
+ OSL_ENSURE( sHRef.getLength() > 0 || xBase64Stream.is(),
+ "neither URL nor base64 image data given" );
+ UniReference < XMLTextImportHelper > xTxtImport =
+ GetImport().GetTextImport();
+ if( sHRef.getLength() )
+ {
+ sal_Bool bForceLoad = xTxtImport->IsInsertMode() ||
+ xTxtImport->IsBlockMode() ||
+ xTxtImport->IsStylesOnlyMode() ||
+ xTxtImport->IsOrganizerMode();
+ sHRef = GetImport().ResolveGraphicObjectURL( sHRef, !bForceLoad );
+ }
+ else if( xBase64Stream.is() )
+ {
+ sHRef = GetImport().ResolveGraphicObjectURLFromBase64( xBase64Stream );
+ xBase64Stream = 0;
+ }
+ aAny <<= sHRef;
+ xPropSet->setPropertyValue( sGraphicURL, aAny );
+
+ // filter name
+ aAny <<=sFilterName;
+ xPropSet->setPropertyValue( sGraphicFilter, aAny );
+
+ // rotation
+ aAny <<= nRotation;
+ xPropSet->setPropertyValue( sGraphicRotation, aAny );
+ }
+
+ // page number (must be set after the frame is inserted, because it
+ // will be overwritten then inserting the frame.
+ if( TextContentAnchorType_AT_PAGE == eAnchorType && nPage > 0 )
+ {
+ aAny <<= nPage;
+ xPropSet->setPropertyValue( sAnchorPageNo, aAny );
+ }
+
+ if( XML_TEXT_FRAME_OBJECT != nType &&
+ XML_TEXT_FRAME_OBJECT_OLE != nType &&
+ XML_TEXT_FRAME_APPLET != nType &&
+ XML_TEXT_FRAME_PLUGIN!= nType &&
+ XML_TEXT_FRAME_FLOATING_FRAME != nType)
+ {
+ Reference < XTextContent > xTxtCntnt( xPropSet, UNO_QUERY );
+ xTextImportHelper->InsertTextContent( xTxtCntnt );
+ }
+
+ Reference < XShape > xShape( xPropSet, UNO_QUERY );
+
+ // #107848#
+ // Make adding the shepe to Z-Ordering dependent from if we are
+ // inside a inside_deleted_section (redlining). That is necessary
+ // since the shape will be removed again later. It would lead to
+ // errors if it would stay inside the Z-Ordering. Thus, the
+ // easiest way to solve that conflict is to not add it here.
+ if(!GetImport().HasTextImport()
+ || !GetImport().GetTextImport()->IsInsideDeleteContext())
+ {
+ GetImport().GetShapeImport()->shapeWithZIndexAdded( xShape, nZIndex );
+ }
+
+ if( XML_TEXT_FRAME_TEXTBOX == nType )
+ {
+ xTextImportHelper->ConnectFrameChains( sName, sNextName, xPropSet );
+ Reference < XTextFrame > xTxtFrame( xPropSet, UNO_QUERY );
+ Reference < XText > xTxt = xTxtFrame->getText();
+ xOldTextCursor = xTextImportHelper->GetCursor();
+ xTextImportHelper->SetCursor( xTxt->createTextCursor() );
+
+ // remember old list item and block (#89892#) and reset them
+ // for the text frame
+ xTextImportHelper->PushListContext();
+ mbListContextPushed = true;
+ }
+}
+
+sal_Bool XMLTextFrameContext_Impl::CreateIfNotThere()
+{
+ if( !xPropSet.is() &&
+ ( XML_TEXT_FRAME_OBJECT_OLE == nType ||
+ XML_TEXT_FRAME_GRAPHIC == nType ) &&
+ xBase64Stream.is() && !bCreateFailed )
+ {
+ if( bOwnBase64Stream )
+ xBase64Stream->closeOutput();
+ Create( sal_True );
+ }
+
+ return xPropSet.is();
+}
+
+XMLTextFrameContext_Impl::XMLTextFrameContext_Impl(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx, const OUString& rLName,
+ const Reference< XAttributeList > & rAttrList,
+ TextContentAnchorType eATyp,
+ sal_uInt16 nNewType,
+ const Reference< XAttributeList > & rFrameAttrList )
+: SvXMLImportContext( rImport, nPrfx, rLName )
+, mbListContextPushed( false )
+, sWidth(RTL_CONSTASCII_USTRINGPARAM("Width"))
+, sWidthType(RTL_CONSTASCII_USTRINGPARAM("WidthType"))
+, sRelativeWidth(RTL_CONSTASCII_USTRINGPARAM("RelativeWidth"))
+, sHeight(RTL_CONSTASCII_USTRINGPARAM("Height"))
+, sRelativeHeight(RTL_CONSTASCII_USTRINGPARAM("RelativeHeight"))
+, sSizeType(RTL_CONSTASCII_USTRINGPARAM("SizeType"))
+, sIsSyncWidthToHeight(RTL_CONSTASCII_USTRINGPARAM("IsSyncWidthToHeight"))
+, sIsSyncHeightToWidth(RTL_CONSTASCII_USTRINGPARAM("IsSyncHeightToWidth"))
+, sHoriOrient(RTL_CONSTASCII_USTRINGPARAM("HoriOrient"))
+, sHoriOrientPosition(RTL_CONSTASCII_USTRINGPARAM("HoriOrientPosition"))
+, sVertOrient(RTL_CONSTASCII_USTRINGPARAM("VertOrient"))
+, sVertOrientPosition(RTL_CONSTASCII_USTRINGPARAM("VertOrientPosition"))
+, sChainNextName(RTL_CONSTASCII_USTRINGPARAM("ChainNextName"))
+, sAnchorType(RTL_CONSTASCII_USTRINGPARAM("AnchorType"))
+, sAnchorPageNo(RTL_CONSTASCII_USTRINGPARAM("AnchorPageNo"))
+, sGraphicURL(RTL_CONSTASCII_USTRINGPARAM("GraphicURL"))
+, sGraphicFilter(RTL_CONSTASCII_USTRINGPARAM("GraphicFilter"))
+, sTitle(RTL_CONSTASCII_USTRINGPARAM("Title"))
+, sDescription(RTL_CONSTASCII_USTRINGPARAM("Description"))
+, sFrameStyleName(RTL_CONSTASCII_USTRINGPARAM("FrameStyleName"))
+, sGraphicRotation(RTL_CONSTASCII_USTRINGPARAM("GraphicRotation"))
+, sTextBoxServiceName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextFrame"))
+, sGraphicServiceName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.GraphicObject"))
+, nType( nNewType )
+, eAnchorType( eATyp )
+{
+ nX = 0;
+ nY = 0;
+ nWidth = 0;
+ nHeight = 0;
+ nZIndex = -1;
+ nPage = 0;
+ nRotation = 0;
+ nRelWidth = 0;
+ nRelHeight = 0;
+ bMayScript = sal_False;
+
+ bMinHeight = sal_False;
+ bMinWidth = sal_False;
+ bSyncWidth = sal_False;
+ bSyncHeight = sal_False;
+ bCreateFailed = sal_False;
+ bOwnBase64Stream = sal_False;
+
+ UniReference < XMLTextImportHelper > xTxtImport =
+ GetImport().GetTextImport();
+ const SvXMLTokenMap& rTokenMap =
+ xTxtImport->GetTextFrameAttrTokenMap();
+
+ sal_Int16 nAttrCount = rAttrList.is() ? rAttrList->getLength() : 0;
+ sal_Int16 nTotalAttrCount = nAttrCount + (rFrameAttrList.is() ? rFrameAttrList->getLength() : 0);
+ for( sal_Int16 i=0; i < nTotalAttrCount; i++ )
+ {
+ const OUString& rAttrName =
+ i < nAttrCount ? rAttrList->getNameByIndex( i ) : rFrameAttrList->getNameByIndex( i-nAttrCount );
+ const OUString& rValue =
+ i < nAttrCount ? rAttrList->getValueByIndex( i ): rFrameAttrList->getValueByIndex( i-nAttrCount );
+
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ switch( rTokenMap.Get( nPrefix, aLocalName ) )
+ {
+ case XML_TOK_TEXT_FRAME_STYLE_NAME:
+ sStyleName = rValue;
+ break;
+ case XML_TOK_TEXT_FRAME_NAME:
+ sName = rValue;
+ break;
+ case XML_TOK_TEXT_FRAME_FRAME_NAME:
+ sFrameName = rValue;
+ break;
+ case XML_TOK_TEXT_FRAME_APPLET_NAME:
+ sAppletName = rValue;
+ break;
+ case XML_TOK_TEXT_FRAME_ANCHOR_TYPE:
+ if( TextContentAnchorType_AT_PARAGRAPH == eAnchorType ||
+ TextContentAnchorType_AT_CHARACTER == eAnchorType ||
+ TextContentAnchorType_AS_CHARACTER == eAnchorType )
+ {
+
+ TextContentAnchorType eNew;
+ if( XMLAnchorTypePropHdl::convert( rValue, eNew ) &&
+ ( TextContentAnchorType_AT_PARAGRAPH == eNew ||
+ TextContentAnchorType_AT_CHARACTER == eNew ||
+ TextContentAnchorType_AS_CHARACTER == eNew ||
+ TextContentAnchorType_AT_PAGE == eNew) )
+ eAnchorType = eNew;
+ }
+ break;
+ case XML_TOK_TEXT_FRAME_ANCHOR_PAGE_NUMBER:
+ {
+ sal_Int32 nTmp;
+ if( GetImport().GetMM100UnitConverter().
+ convertNumber( nTmp, rValue, 1, SHRT_MAX ) )
+ nPage = (sal_Int16)nTmp;
+ }
+ break;
+ case XML_TOK_TEXT_FRAME_X:
+ GetImport().GetMM100UnitConverter().convertMeasure( nX, rValue );
+ break;
+ case XML_TOK_TEXT_FRAME_Y:
+ GetImport().GetMM100UnitConverter().convertMeasure( nY, rValue );
+ break;
+ case XML_TOK_TEXT_FRAME_WIDTH:
+ // relative widths are obsolete since SRC617. Remove them some day!
+ if( rValue.indexOf( '%' ) != -1 )
+ {
+ sal_Int32 nTmp;
+ GetImport().GetMM100UnitConverter().convertPercent( nTmp,
+ rValue );
+ nRelWidth = (sal_Int16)nTmp;
+ }
+ else
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure( nWidth,
+ rValue, 0 );
+ }
+ break;
+ case XML_TOK_TEXT_FRAME_REL_WIDTH:
+ if( IsXMLToken(rValue, XML_SCALE) )
+ {
+ bSyncWidth = sal_True;
+ }
+ else
+ {
+ sal_Int32 nTmp;
+ if( GetImport().GetMM100UnitConverter().
+ convertPercent( nTmp, rValue ) )
+ nRelWidth = (sal_Int16)nTmp;
+ }
+ break;
+ case XML_TOK_TEXT_FRAME_MIN_WIDTH:
+ if( rValue.indexOf( '%' ) != -1 )
+ {
+ sal_Int32 nTmp;
+ GetImport().GetMM100UnitConverter().convertPercent( nTmp,
+ rValue );
+ nRelWidth = (sal_Int16)nTmp;
+ }
+ else
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure( nWidth,
+ rValue, 0 );
+ }
+ bMinWidth = sal_True;
+ break;
+ case XML_TOK_TEXT_FRAME_HEIGHT:
+ // relative heights are obsolete since SRC617. Remove them some day!
+ if( rValue.indexOf( '%' ) != -1 )
+ {
+ sal_Int32 nTmp;
+ GetImport().GetMM100UnitConverter().convertPercent( nTmp,
+ rValue );
+ nRelHeight = (sal_Int16)nTmp;
+ }
+ else
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure( nHeight,
+ rValue, 0 );
+ }
+ break;
+ case XML_TOK_TEXT_FRAME_REL_HEIGHT:
+ if( IsXMLToken( rValue, XML_SCALE ) )
+ {
+ bSyncHeight = sal_True;
+ }
+ else if( IsXMLToken( rValue, XML_SCALE_MIN ) )
+ {
+ bSyncHeight = sal_True;
+ bMinHeight = sal_True;
+ }
+ else
+ {
+ sal_Int32 nTmp;
+ if( GetImport().GetMM100UnitConverter().
+ convertPercent( nTmp, rValue ) )
+ nRelHeight = (sal_Int16)nTmp;
+ }
+ break;
+ case XML_TOK_TEXT_FRAME_MIN_HEIGHT:
+ if( rValue.indexOf( '%' ) != -1 )
+ {
+ sal_Int32 nTmp;
+ GetImport().GetMM100UnitConverter().convertPercent( nTmp,
+ rValue );
+ nRelHeight = (sal_Int16)nTmp;
+ }
+ else
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure( nHeight,
+ rValue, 0 );
+ }
+ bMinHeight = sal_True;
+ break;
+ case XML_TOK_TEXT_FRAME_Z_INDEX:
+ GetImport().GetMM100UnitConverter().convertNumber( nZIndex, rValue, -1 );
+ break;
+ case XML_TOK_TEXT_FRAME_NEXT_CHAIN_NAME:
+ sNextName = rValue;
+ break;
+ case XML_TOK_TEXT_FRAME_HREF:
+ sHRef = rValue;
+ break;
+ case XML_TOK_TEXT_FRAME_FILTER_NAME:
+ sFilterName = rValue;
+ break;
+ case XML_TOK_TEXT_FRAME_TRANSFORM:
+ {
+ OUString sValue( rValue );
+ sValue.trim();
+ const OUString aRotate(GetXMLToken(XML_ROTATE));
+ const sal_Int32 nRotateLen(aRotate.getLength());
+ sal_Int32 nLen = sValue.getLength();
+ if( nLen >= nRotateLen+3 &&
+ 0 == sValue.compareTo( aRotate, nRotateLen ) &&
+ '(' == sValue[nRotateLen] &&
+ ')' == sValue[nLen-1] )
+ {
+ sValue = sValue.copy( nRotateLen+1, nLen-(nRotateLen+2) );
+ sValue.trim();
+ sal_Int32 nVal;
+ if( GetImport().GetMM100UnitConverter().convertNumber( nVal, sValue ) )
+ nRotation = (sal_Int16)(nVal % 360 );
+ }
+ }
+ break;
+ case XML_TOK_TEXT_FRAME_CODE:
+ sCode = rValue;
+ break;
+ case XML_TOK_TEXT_FRAME_OBJECT:
+ sObject = rValue;
+ break;
+ case XML_TOK_TEXT_FRAME_ARCHIVE:
+ sArchive = rValue;
+ break;
+ case XML_TOK_TEXT_FRAME_MAY_SCRIPT:
+ bMayScript = IsXMLToken( rValue, XML_TRUE );
+ break;
+ case XML_TOK_TEXT_FRAME_MIME_TYPE:
+ sMimeType = rValue;
+ break;
+ case XML_TOK_TEXT_FRAME_NOTIFY_ON_UPDATE:
+ sTblName = rValue;
+ break;
+ }
+ }
+
+ if( ( (XML_TEXT_FRAME_GRAPHIC == nType ||
+ XML_TEXT_FRAME_OBJECT == nType ||
+ XML_TEXT_FRAME_OBJECT_OLE == nType) &&
+ !sHRef.getLength() ) ||
+ ( XML_TEXT_FRAME_APPLET == nType && !sCode.getLength() ) ||
+ ( XML_TEXT_FRAME_PLUGIN == nType &&
+ sHRef.getLength() == 0 && sMimeType.getLength() == 0 ) )
+ return; // no URL: no image or OLE object
+
+ Create( sal_True );
+}
+
+XMLTextFrameContext_Impl::~XMLTextFrameContext_Impl()
+{
+}
+
+void XMLTextFrameContext_Impl::EndElement()
+{
+ CreateIfNotThere();
+
+ if( xOldTextCursor.is() )
+ {
+ GetImport().GetTextImport()->DeleteParagraph();
+ GetImport().GetTextImport()->SetCursor( xOldTextCursor );
+ }
+
+ // reinstall old list item (if necessary) #89892#
+ if (mbListContextPushed) {
+ GetImport().GetTextImport()->PopListContext();
+ }
+
+ if (( nType == XML_TEXT_FRAME_APPLET || nType == XML_TEXT_FRAME_PLUGIN ) && xPropSet.is())
+ GetImport().GetTextImport()->endAppletOrPlugin( xPropSet, aParamMap);
+}
+
+SvXMLImportContext *XMLTextFrameContext_Impl::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference< XAttributeList > & xAttrList )
+{
+ SvXMLImportContext *pContext = 0;
+
+ if( XML_NAMESPACE_DRAW == nPrefix )
+ {
+ if ( (nType == XML_TEXT_FRAME_APPLET || nType == XML_TEXT_FRAME_PLUGIN) &&
+ IsXMLToken( rLocalName, XML_PARAM ) )
+ {
+ pContext = new XMLTextFrameParam_Impl( GetImport(),
+ nPrefix, rLocalName,
+ xAttrList, nType, aParamMap );
+ }
+ }
+ else if( (XML_NAMESPACE_OFFICE == nPrefix) )
+ {
+ if( IsXMLToken( rLocalName, XML_BINARY_DATA ) )
+ {
+ if( !xPropSet.is() && !xBase64Stream.is() && !bCreateFailed )
+ {
+ switch( nType )
+ {
+ case XML_TEXT_FRAME_GRAPHIC:
+ xBase64Stream =
+ GetImport().GetStreamForGraphicObjectURLFromBase64();
+ break;
+ case XML_TEXT_FRAME_OBJECT_OLE:
+ xBase64Stream =
+ GetImport().GetStreamForEmbeddedObjectURLFromBase64();
+ break;
+ }
+ if( xBase64Stream.is() )
+ pContext = new XMLBase64ImportContext( GetImport(), nPrefix,
+ rLocalName, xAttrList,
+ xBase64Stream );
+ }
+ }
+ }
+ // Correction of condition which also avoids warnings. (#i100480#)
+ if( !pContext &&
+ ( XML_TEXT_FRAME_OBJECT == nType &&
+ ( ( XML_NAMESPACE_OFFICE == nPrefix &&
+ IsXMLToken( rLocalName, XML_DOCUMENT ) ) ||
+ ( XML_NAMESPACE_MATH == nPrefix &&
+ IsXMLToken( rLocalName, XML_MATH ) ) ) ) )
+ {
+ if( !xPropSet.is() && !bCreateFailed )
+ {
+ XMLEmbeddedObjectImportContext *pEContext =
+ new XMLEmbeddedObjectImportContext( GetImport(), nPrefix,
+ rLocalName, xAttrList );
+ sFilterService = pEContext->GetFilterServiceName();
+ if( sFilterService.getLength() != 0 )
+ {
+ Create( sal_False );
+ if( xPropSet.is() )
+ {
+ Reference < XEmbeddedObjectSupplier > xEOS( xPropSet,
+ UNO_QUERY );
+ OSL_ENSURE( xEOS.is(),
+ "no embedded object supplier for own object" );
+ Reference<com::sun::star::lang::XComponent> aXComponent(xEOS->getEmbeddedObject());
+ pEContext->SetComponent( aXComponent );
+ }
+ }
+ pContext = pEContext;
+ }
+ }
+ if( !pContext && xOldTextCursor.is() ) // text-box
+ pContext = GetImport().GetTextImport()->CreateTextChildContext(
+ GetImport(), nPrefix, rLocalName, xAttrList,
+ XML_TEXT_TYPE_TEXTBOX );
+
+ if( !pContext )
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+
+ return pContext;
+}
+
+void XMLTextFrameContext_Impl::Characters( const OUString& rChars )
+{
+ if( ( XML_TEXT_FRAME_OBJECT_OLE == nType ||
+ XML_TEXT_FRAME_GRAPHIC == nType) &&
+ !xPropSet.is() && !bCreateFailed )
+ {
+ OUString sTrimmedChars( rChars. trim() );
+ if( sTrimmedChars.getLength() )
+ {
+ if( !xBase64Stream.is() )
+ {
+ if( XML_TEXT_FRAME_GRAPHIC == nType )
+ {
+ xBase64Stream =
+ GetImport().GetStreamForGraphicObjectURLFromBase64();
+ }
+ else
+ {
+ xBase64Stream =
+ GetImport().GetStreamForEmbeddedObjectURLFromBase64();
+ }
+ if( xBase64Stream.is() )
+ bOwnBase64Stream = sal_True;
+ }
+ if( bOwnBase64Stream && xBase64Stream.is() )
+ {
+ OUString sChars;
+ if( sBase64CharsLeft.getLength() )
+ {
+ sChars = sBase64CharsLeft;
+ sChars += sTrimmedChars;
+ sBase64CharsLeft = OUString();
+ }
+ else
+ {
+ sChars = sTrimmedChars;
+ }
+ Sequence< sal_Int8 > aBuffer( (sChars.getLength() / 4) * 3 );
+ sal_Int32 nCharsDecoded =
+ GetImport().GetMM100UnitConverter().
+ decodeBase64SomeChars( aBuffer, sChars );
+ xBase64Stream->writeBytes( aBuffer );
+ if( nCharsDecoded != sChars.getLength() )
+ sBase64CharsLeft = sChars.copy( nCharsDecoded );
+ }
+ }
+ }
+}
+
+void XMLTextFrameContext_Impl::SetHyperlink( const OUString& rHRef,
+ const OUString& rName,
+ const OUString& rTargetFrameName,
+ sal_Bool bMap )
+{
+ static ::rtl::OUString s_HyperLinkURL(
+ RTL_CONSTASCII_USTRINGPARAM("HyperLinkURL"));
+ static ::rtl::OUString s_HyperLinkName(
+ RTL_CONSTASCII_USTRINGPARAM("HyperLinkName"));
+ static ::rtl::OUString s_HyperLinkTarget(
+ RTL_CONSTASCII_USTRINGPARAM("HyperLinkTarget"));
+ static ::rtl::OUString s_ServerMap(
+ RTL_CONSTASCII_USTRINGPARAM("ServerMap"));
+ if( !xPropSet.is() )
+ return;
+
+ UniReference< XMLTextImportHelper > xTxtImp = GetImport().GetTextImport();
+ Reference < XPropertySetInfo > xPropSetInfo =
+ xPropSet->getPropertySetInfo();
+ if( !xPropSetInfo.is() ||
+ !xPropSetInfo->hasPropertyByName(s_HyperLinkURL))
+ return;
+
+ Any aAny;
+ aAny <<= rHRef;
+ xPropSet->setPropertyValue( s_HyperLinkURL, aAny );
+
+ if (xPropSetInfo->hasPropertyByName(s_HyperLinkName))
+ {
+ aAny <<= rName;
+ xPropSet->setPropertyValue(s_HyperLinkName, aAny);
+ }
+
+ if (xPropSetInfo->hasPropertyByName(s_HyperLinkTarget))
+ {
+ aAny <<= rTargetFrameName;
+ xPropSet->setPropertyValue( s_HyperLinkTarget, aAny );
+ }
+
+ if (xPropSetInfo->hasPropertyByName(s_ServerMap))
+ {
+ aAny.setValue( &bMap, ::getBooleanCppuType() );
+ xPropSet->setPropertyValue(s_ServerMap, aAny);
+ }
+}
+
+// Implement Title/Description Elements UI (#i73249#)
+void XMLTextFrameContext_Impl::SetTitle( const OUString& rTitle )
+{
+ if ( xPropSet.is() )
+ {
+ Reference< XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
+ if( xPropSetInfo->hasPropertyByName( sTitle ) )
+ {
+ xPropSet->setPropertyValue( sTitle, makeAny( rTitle ) );
+ }
+ }
+}
+
+void XMLTextFrameContext_Impl::SetDesc( const OUString& rDesc )
+{
+ if ( xPropSet.is() )
+ {
+ Reference< XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
+ if( xPropSetInfo->hasPropertyByName( sDescription ) )
+ {
+ xPropSet->setPropertyValue( sDescription, makeAny( rDesc ) );
+ }
+ }
+}
+
+//-----------------------------------------------------------------------------------------------------
+
+TYPEINIT1( XMLTextFrameContext, SvXMLImportContext );
+
+sal_Bool XMLTextFrameContext::CreateIfNotThere()
+{
+ sal_Bool bRet = sal_False;
+ SvXMLImportContext *pContext = &m_xImplContext;
+ XMLTextFrameContext_Impl *pImpl = PTR_CAST( XMLTextFrameContext_Impl, pContext );
+ if( pImpl )
+ bRet = pImpl->CreateIfNotThere();
+
+ return bRet;
+}
+
+sal_Bool XMLTextFrameContext::CreateIfNotThere( ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet >& rPropSet )
+{
+ SvXMLImportContext *pContext = &m_xImplContext;
+ XMLTextFrameContext_Impl *pImpl = PTR_CAST( XMLTextFrameContext_Impl, pContext );
+ if( pImpl )
+ {
+ if( pImpl->CreateIfNotThere() )
+ rPropSet = pImpl->GetPropSet();
+ }
+
+ return rPropSet.is();
+}
+
+XMLTextFrameContext::XMLTextFrameContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx, const OUString& rLName,
+ const Reference< XAttributeList > & xAttrList,
+ TextContentAnchorType eATyp )
+: SvXMLImportContext( rImport, nPrfx, rLName )
+, m_xAttrList( new SvXMLAttributeList( xAttrList ) )
+, m_pHyperlink( 0 )
+ // Implement Title/Description Elements UI (#i73249#)
+, m_sTitle()
+, m_sDesc()
+, m_eDefaultAnchorType( eATyp )
+ // Shapes in Writer cannot be named via context menu (#i51726#)
+, m_HasAutomaticStyleWithoutParentStyle( sal_False )
+, m_bSupportsReplacement( sal_False )
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName );
+ // New distinguish attribute between Writer objects and Draw objects is:
+ // Draw objects have an automatic style without a parent style (#i51726#)
+ if ( XML_NAMESPACE_DRAW == nPrefix &&
+ IsXMLToken( aLocalName, XML_STYLE_NAME ) )
+ {
+ OUString aStyleName = xAttrList->getValueByIndex( i );
+ if( aStyleName.getLength() )
+ {
+ UniReference < XMLTextImportHelper > xTxtImport =
+ GetImport().GetTextImport();
+ XMLPropStyleContext* pStyle( 0L );
+ pStyle = xTxtImport->FindAutoFrameStyle( aStyleName );
+ if ( pStyle && !pStyle->GetParentName().getLength() )
+ {
+ m_HasAutomaticStyleWithoutParentStyle = sal_True;
+ }
+ }
+ }
+ else if ( XML_NAMESPACE_TEXT == nPrefix &&
+ IsXMLToken( aLocalName, XML_ANCHOR_TYPE ) )
+ {
+ TextContentAnchorType eNew;
+ if( XMLAnchorTypePropHdl::convert( xAttrList->getValueByIndex(i),
+ eNew ) &&
+ ( TextContentAnchorType_AT_PARAGRAPH == eNew ||
+ TextContentAnchorType_AT_CHARACTER == eNew ||
+ TextContentAnchorType_AS_CHARACTER == eNew ||
+ TextContentAnchorType_AT_PAGE == eNew) )
+ m_eDefaultAnchorType = eNew;
+ }
+ }
+}
+
+XMLTextFrameContext::~XMLTextFrameContext()
+{
+ delete m_pHyperlink;
+}
+
+void XMLTextFrameContext::EndElement()
+{
+ SvXMLImportContext *pContext = &m_xImplContext;
+ XMLTextFrameContext_Impl *pImpl = PTR_CAST( XMLTextFrameContext_Impl, pContext );
+ if( pImpl )
+ {
+ pImpl->CreateIfNotThere();
+
+ if( m_sTitle.getLength() )
+ {
+ pImpl->SetTitle( m_sTitle );
+ }
+ if( m_sDesc.getLength() )
+ {
+ pImpl->SetDesc( m_sDesc );
+ }
+
+ if( m_pHyperlink )
+ {
+ pImpl->SetHyperlink( m_pHyperlink->GetHRef(), m_pHyperlink->GetName(),
+ m_pHyperlink->GetTargetFrameName(), m_pHyperlink->GetMap() );
+ delete m_pHyperlink;
+ m_pHyperlink = 0;
+ }
+
+ }
+}
+
+SvXMLImportContext *XMLTextFrameContext::CreateChildContext(
+ sal_uInt16 p_nPrefix,
+ const OUString& rLocalName,
+ const Reference< XAttributeList > & xAttrList )
+{
+ SvXMLImportContext *pContext = 0;
+
+ if( !m_xImplContext.Is() )
+ {
+ // no child exists
+ if( XML_NAMESPACE_DRAW == p_nPrefix )
+ {
+ sal_uInt16 nFrameType = USHRT_MAX;
+ if( IsXMLToken( rLocalName, XML_TEXT_BOX ) )
+ nFrameType = XML_TEXT_FRAME_TEXTBOX;
+ else if( IsXMLToken( rLocalName, XML_IMAGE ) )
+ nFrameType = XML_TEXT_FRAME_GRAPHIC;
+ else if( IsXMLToken( rLocalName, XML_OBJECT ) )
+ nFrameType = XML_TEXT_FRAME_OBJECT;
+ else if( IsXMLToken( rLocalName, XML_OBJECT_OLE ) )
+ nFrameType = XML_TEXT_FRAME_OBJECT_OLE;
+ else if( IsXMLToken( rLocalName, XML_APPLET) )
+ nFrameType = XML_TEXT_FRAME_APPLET;
+ else if( IsXMLToken( rLocalName, XML_PLUGIN ) )
+ nFrameType = XML_TEXT_FRAME_PLUGIN;
+ else if( IsXMLToken( rLocalName, XML_FLOATING_FRAME ) )
+ nFrameType = XML_TEXT_FRAME_FLOATING_FRAME;
+
+ if( USHRT_MAX != nFrameType )
+ {
+ // Shapes in Writer cannot be named via context menu (#i51726#)
+ if ( ( XML_TEXT_FRAME_TEXTBOX == nFrameType ||
+ XML_TEXT_FRAME_GRAPHIC == nFrameType ) &&
+ m_HasAutomaticStyleWithoutParentStyle )
+ {
+ Reference < XShapes > xShapes;
+ pContext = GetImport().GetShapeImport()->CreateFrameChildContext(
+ GetImport(), p_nPrefix, rLocalName, xAttrList, xShapes, m_xAttrList );
+ }
+ else if( XML_TEXT_FRAME_PLUGIN == nFrameType )
+ {
+ bool bMedia = false;
+
+ // check, if we have a media object
+ for( sal_Int16 n = 0, nAttrCount = ( xAttrList.is() ? xAttrList->getLength() : 0 ); n < nAttrCount; ++n )
+ {
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( xAttrList->getNameByIndex( n ), &aLocalName );
+
+ if( nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( aLocalName, XML_MIME_TYPE ) )
+ {
+ if( 0 == xAttrList->getValueByIndex( n ).compareToAscii( "application/vnd.sun.star.media" ) )
+ bMedia = true;
+
+ // leave this loop
+ n = nAttrCount - 1;
+ }
+ }
+
+ if( bMedia )
+ {
+ Reference < XShapes > xShapes;
+ pContext = GetImport().GetShapeImport()->CreateFrameChildContext(
+ GetImport(), p_nPrefix, rLocalName, xAttrList, xShapes, m_xAttrList );
+ }
+ }
+ else if( XML_TEXT_FRAME_OBJECT == nFrameType ||
+ XML_TEXT_FRAME_OBJECT_OLE == nFrameType )
+ {
+ m_bSupportsReplacement = sal_True;
+ }
+
+ if( !pContext )
+ {
+
+ pContext = new XMLTextFrameContext_Impl( GetImport(), p_nPrefix,
+ rLocalName, xAttrList,
+ m_eDefaultAnchorType,
+ nFrameType,
+ m_xAttrList );
+ }
+
+ m_xImplContext = pContext;
+ }
+ }
+ }
+ else if( m_bSupportsReplacement && !m_xReplImplContext &&
+ XML_NAMESPACE_DRAW == p_nPrefix &&
+ IsXMLToken( rLocalName, XML_IMAGE ) )
+ {
+ // read replacement image
+ Reference < XPropertySet > xPropSet;
+ if( CreateIfNotThere( xPropSet ) )
+ {
+ pContext = new XMLReplacementImageContext( GetImport(),
+ p_nPrefix, rLocalName, xAttrList, xPropSet );
+ m_xReplImplContext = pContext;
+ }
+ }
+ else if( m_xImplContext->ISA( XMLTextFrameContext_Impl ) )
+ {
+ // the child is a writer frame
+ if( XML_NAMESPACE_SVG == p_nPrefix )
+ {
+ // Implement Title/Description Elements UI (#i73249#)
+ const bool bOld = SvXMLImport::OOo_2x >= GetImport().getGeneratorVersion();
+ if ( bOld )
+ {
+ if ( IsXMLToken( rLocalName, XML_DESC ) )
+ {
+ pContext = new XMLTextFrameTitleOrDescContext_Impl( GetImport(),
+ p_nPrefix,
+ rLocalName,
+ m_sTitle );
+ }
+ }
+ else
+ {
+ if( IsXMLToken( rLocalName, XML_TITLE ) )
+ {
+ pContext = new XMLTextFrameTitleOrDescContext_Impl( GetImport(),
+ p_nPrefix,
+ rLocalName,
+ m_sTitle );
+ }
+ else if ( IsXMLToken( rLocalName, XML_DESC ) )
+ {
+ pContext = new XMLTextFrameTitleOrDescContext_Impl( GetImport(),
+ p_nPrefix,
+ rLocalName,
+ m_sDesc );
+ }
+ }
+ }
+ else if( XML_NAMESPACE_DRAW == p_nPrefix )
+ {
+ Reference < XPropertySet > xPropSet;
+ if( IsXMLToken( rLocalName, XML_CONTOUR_POLYGON ) )
+ {
+ if( CreateIfNotThere( xPropSet ) )
+ pContext = new XMLTextFrameContourContext_Impl( GetImport(), p_nPrefix, rLocalName,
+ xAttrList, xPropSet, sal_False );
+ }
+ else if( IsXMLToken( rLocalName, XML_CONTOUR_PATH ) )
+ {
+ if( CreateIfNotThere( xPropSet ) )
+ pContext = new XMLTextFrameContourContext_Impl( GetImport(), p_nPrefix, rLocalName,
+ xAttrList, xPropSet, sal_True );
+ }
+ else if( IsXMLToken( rLocalName, XML_IMAGE_MAP ) )
+ {
+ if( CreateIfNotThere( xPropSet ) )
+ pContext = new XMLImageMapContext( GetImport(), p_nPrefix, rLocalName, xPropSet );
+ }
+ }
+ else if( (XML_NAMESPACE_OFFICE == p_nPrefix) && IsXMLToken( rLocalName, XML_EVENT_LISTENERS ) )
+ {
+ // do we still have the frame object?
+ Reference < XPropertySet > xPropSet;
+ if( CreateIfNotThere( xPropSet ) )
+ {
+ // is it an event supplier?
+ Reference<XEventsSupplier> xEventsSupplier(xPropSet, UNO_QUERY);
+ if (xEventsSupplier.is())
+ {
+ // OK, we have the events, so create the context
+ pContext = new XMLEventsImportContext(GetImport(), p_nPrefix,
+ rLocalName, xEventsSupplier);
+ }
+ }
+ }
+ }
+ else if( p_nPrefix == XML_NAMESPACE_SVG && // #i68101#
+ (IsXMLToken( rLocalName, XML_TITLE ) || IsXMLToken( rLocalName, XML_DESC ) ) )
+ {
+ pContext = m_xImplContext->CreateChildContext( p_nPrefix, rLocalName, xAttrList );
+ }
+ else
+ {
+ // the child is a drawing shape
+ pContext = GetImport().GetShapeImport()->CreateFrameChildContext(
+ &m_xImplContext, p_nPrefix, rLocalName, xAttrList );
+ }
+
+ if( !pContext )
+ pContext = new SvXMLImportContext( GetImport(), p_nPrefix, rLocalName );
+
+ return pContext;
+}
+
+void XMLTextFrameContext::SetHyperlink( const OUString& rHRef,
+ const OUString& rName,
+ const OUString& rTargetFrameName,
+ sal_Bool bMap )
+{
+ OSL_ENSURE( !m_pHyperlink, "recursive SetHyperlink call" );
+ delete m_pHyperlink;
+ m_pHyperlink = new XMLTextFrameContextHyperlink_Impl(
+ rHRef, rName, rTargetFrameName, bMap );
+}
+
+TextContentAnchorType XMLTextFrameContext::GetAnchorType() const
+{
+ SvXMLImportContext *pContext = &m_xImplContext;
+ XMLTextFrameContext_Impl *pImpl = PTR_CAST( XMLTextFrameContext_Impl, pContext );
+ if( pImpl )
+ return pImpl->GetAnchorType();
+ else
+ return m_eDefaultAnchorType;
+}
+
+Reference < XTextContent > XMLTextFrameContext::GetTextContent() const
+{
+ Reference < XTextContent > xTxtCntnt;
+ SvXMLImportContext *pContext = &m_xImplContext;
+ XMLTextFrameContext_Impl *pImpl = PTR_CAST( XMLTextFrameContext_Impl, pContext );
+ if( pImpl )
+ xTxtCntnt.set( pImpl->GetPropSet(), UNO_QUERY );
+
+ return xTxtCntnt;
+}
+
+Reference < XShape > XMLTextFrameContext::GetShape() const
+{
+ Reference < XShape > xShape;
+ SvXMLImportContext* pContext = &m_xImplContext;
+ SvXMLShapeContext* pImpl = PTR_CAST( SvXMLShapeContext, pContext );
+ if ( pImpl )
+ {
+ xShape = pImpl->getShape();
+ }
+
+ return xShape;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLTextFrameContext.hxx b/xmloff/source/text/XMLTextFrameContext.hxx
new file mode 100644
index 000000000000..1168bf3ffc1d
--- /dev/null
+++ b/xmloff/source/text/XMLTextFrameContext.hxx
@@ -0,0 +1,108 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLTEXTFRAMECONTEXT_HXX
+#define _XMLTEXTFRAMECONTEXT_HXX
+
+#include <com/sun/star/text/TextContentAnchorType.hpp>
+#include <xmloff/xmlictxt.hxx>
+
+namespace com { namespace sun { namespace star {
+ namespace text { class XTextCursor; class XTextContent; }
+} } }
+
+class SvXMLAttributeList;
+class XMLTextFrameContextHyperlink_Impl;
+
+class XMLTextFrameContext : public SvXMLImportContext
+{
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > m_xAttrList;
+
+ SvXMLImportContextRef m_xImplContext;
+ SvXMLImportContextRef m_xReplImplContext;
+ SvXMLAttributeList *m_pAttrList;
+
+ XMLTextFrameContextHyperlink_Impl *m_pHyperlink;
+ // Implement Title/Description Elements UI (#i73249#)
+ ::rtl::OUString m_sTitle;
+ ::rtl::OUString m_sDesc;
+
+ ::com::sun::star::text::TextContentAnchorType m_eDefaultAnchorType;
+
+ /* The <draw:name> can longer be used to distinguish Writer graphic/text box
+ objects and Draw graphic/text box objects.
+ The new distinguish attribute is the parent style of the automatic style
+ of the object. All Draw objects have an automatic style without a parent style.
+ (#i51726#)
+ */
+ sal_Bool m_HasAutomaticStyleWithoutParentStyle;
+ sal_Bool m_bSupportsReplacement;
+
+ sal_Bool CreateIfNotThere();
+ sal_Bool CreateIfNotThere( ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet >& rPropSet );
+
+public:
+
+ TYPEINFO();
+
+ XMLTextFrameContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
+ ::com::sun::star::text::TextContentAnchorType eDfltAnchorType );
+ virtual ~XMLTextFrameContext();
+
+ virtual void EndElement();
+
+ SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+ void SetHyperlink( const ::rtl::OUString& rHRef,
+ const ::rtl::OUString& rName,
+ const ::rtl::OUString& rTargetFrameName,
+ sal_Bool bMap );
+
+ ::com::sun::star::text::TextContentAnchorType GetAnchorType() const;
+
+ ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextContent > GetTextContent() const;
+
+ // Frame "to character": anchor moves from first to last char after saving (#i33242#)
+ ::com::sun::star::uno::Reference <
+ ::com::sun::star::drawing::XShape > GetShape() const;
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLTextFrameHyperlinkContext.cxx b/xmloff/source/text/XMLTextFrameHyperlinkContext.cxx
new file mode 100644
index 000000000000..b63aa46ef4d9
--- /dev/null
+++ b/xmloff/source/text/XMLTextFrameHyperlinkContext.cxx
@@ -0,0 +1,188 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "XMLTextFrameContext.hxx"
+#include "XMLTextFrameHyperlinkContext.hxx"
+
+// OD 2004-04-21 #i26791#
+#include <txtparaimphint.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::beans;
+using namespace ::xmloff::token;
+
+TYPEINIT1( XMLTextFrameHyperlinkContext, SvXMLImportContext );
+
+XMLTextFrameHyperlinkContext::XMLTextFrameHyperlinkContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx, const OUString& rLName,
+ const Reference< XAttributeList > & xAttrList,
+ TextContentAnchorType eATyp ) :
+ SvXMLImportContext( rImport, nPrfx, rLName ),
+ eDefaultAnchorType( eATyp ),
+ bMap( sal_False )
+{
+ OUString sShow;
+ const SvXMLTokenMap& rTokenMap =
+ GetImport().GetTextImport()->GetTextHyperlinkAttrTokenMap();
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ const OUString& rValue = xAttrList->getValueByIndex( i );
+
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ switch( rTokenMap.Get( nPrefix, aLocalName ) )
+ {
+ case XML_TOK_TEXT_HYPERLINK_HREF:
+ sHRef = GetImport().GetAbsoluteReference( rValue );
+ break;
+ case XML_TOK_TEXT_HYPERLINK_NAME:
+ sName = rValue;
+ break;
+ case XML_TOK_TEXT_HYPERLINK_TARGET_FRAME:
+ sTargetFrameName = rValue;
+ break;
+ case XML_TOK_TEXT_HYPERLINK_SHOW:
+ sShow = rValue;
+ break;
+ case XML_TOK_TEXT_HYPERLINK_SERVER_MAP:
+ {
+ bool bTmp;
+ if( rImport.GetMM100UnitConverter().convertBool( bTmp,
+ rValue ) )
+ {
+ bMap = bTmp;
+ }
+ }
+ break;
+ }
+ }
+
+ if( sShow.getLength() && !sTargetFrameName.getLength() )
+ {
+ if( IsXMLToken( sShow, XML_NEW ) )
+ sTargetFrameName =
+ OUString( RTL_CONSTASCII_USTRINGPARAM("_blank" ) );
+ else if( IsXMLToken( sShow, XML_REPLACE ) )
+ sTargetFrameName =
+ OUString( RTL_CONSTASCII_USTRINGPARAM("_self" ) );
+ }
+}
+
+XMLTextFrameHyperlinkContext::~XMLTextFrameHyperlinkContext()
+{
+}
+
+void XMLTextFrameHyperlinkContext::EndElement()
+{
+}
+
+SvXMLImportContext *XMLTextFrameHyperlinkContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference< XAttributeList > & xAttrList )
+{
+ SvXMLImportContext *pContext = 0;
+ XMLTextFrameContext *pTextFrameContext = 0;
+
+ if( XML_NAMESPACE_DRAW == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_FRAME ) )
+ pTextFrameContext = new XMLTextFrameContext( GetImport(), nPrefix,
+ rLocalName, xAttrList,
+ eDefaultAnchorType );
+ }
+
+ if( pTextFrameContext )
+ {
+ pTextFrameContext->SetHyperlink( sHRef, sName, sTargetFrameName, bMap );
+ pContext = pTextFrameContext;
+ xFrameContext = pContext;
+ }
+ else
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+
+ return pContext;
+}
+
+
+TextContentAnchorType XMLTextFrameHyperlinkContext::GetAnchorType() const
+{
+ if( xFrameContext.Is() )
+ {
+ SvXMLImportContext *pContext = &xFrameContext;
+ return PTR_CAST( XMLTextFrameContext, pContext ) ->GetAnchorType();
+ }
+ else
+ return eDefaultAnchorType;
+
+}
+
+Reference < XTextContent > XMLTextFrameHyperlinkContext::GetTextContent() const
+{
+ Reference <XTextContent > xTxt;
+ if( xFrameContext.Is() )
+ {
+ SvXMLImportContext *pContext = &xFrameContext;
+ xTxt = PTR_CAST( XMLTextFrameContext, pContext )->GetTextContent();
+ }
+
+ return xTxt;
+}
+
+// Frame "to character": anchor moves from first to last char after saving (#i33242#)
+Reference < drawing::XShape > XMLTextFrameHyperlinkContext::GetShape() const
+{
+ Reference < drawing::XShape > xShape;
+ if( xFrameContext.Is() )
+ {
+ SvXMLImportContext *pContext = &xFrameContext;
+ xShape = PTR_CAST( XMLTextFrameContext, pContext )->GetShape();
+ }
+
+ return xShape;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLTextFrameHyperlinkContext.hxx b/xmloff/source/text/XMLTextFrameHyperlinkContext.hxx
new file mode 100644
index 000000000000..0ba1ca1c9523
--- /dev/null
+++ b/xmloff/source/text/XMLTextFrameHyperlinkContext.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLTEXTFRAMEHYPERLINKCONTEXT_HXX
+#define _XMLTEXTFRAMEHYPERLINKCONTEXT_HXX
+
+#include <com/sun/star/text/TextContentAnchorType.hpp>
+#include <com/sun/star/text/XTextFrame.hpp>
+#include <xmloff/xmlictxt.hxx>
+
+namespace com { namespace sun { namespace star {
+ namespace text { class XTextCursor; class XTextFrame; }
+ namespace beans { class XPropertySet; }
+} } }
+
+// OD 2004-04-21 #i26791#
+class XMLTextFrameHint_Impl;
+
+class XMLTextFrameHyperlinkContext : public SvXMLImportContext
+{
+ ::rtl::OUString sHRef;
+ ::rtl::OUString sName;
+ ::rtl::OUString sTargetFrameName;
+ ::com::sun::star::text::TextContentAnchorType eDefaultAnchorType;
+ SvXMLImportContextRef xFrameContext;
+ sal_Bool bMap;
+
+public:
+
+ TYPEINFO();
+
+ XMLTextFrameHyperlinkContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
+ ::com::sun::star::text::TextContentAnchorType eDefaultAnchorType );
+ virtual ~XMLTextFrameHyperlinkContext();
+
+ virtual void EndElement();
+
+ SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+ ::com::sun::star::text::TextContentAnchorType GetAnchorType() const;
+
+ ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextContent > GetTextContent() const;
+
+ // Frame "to character": anchor moves from first to last char after saving (#i33242#)
+ ::com::sun::star::uno::Reference <
+ ::com::sun::star::drawing::XShape > GetShape() const;
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLTextHeaderFooterContext.cxx b/xmloff/source/text/XMLTextHeaderFooterContext.cxx
new file mode 100644
index 000000000000..640fcca8e4af
--- /dev/null
+++ b/xmloff/source/text/XMLTextHeaderFooterContext.cxx
@@ -0,0 +1,194 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XRelativeTextContentRemove.hpp>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include "XMLTextHeaderFooterContext.hxx"
+#include <xmloff/XMLTextTableContext.hxx>
+#include <xmloff/xmlimp.hxx>
+
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::beans;
+
+
+TYPEINIT1( XMLTextHeaderFooterContext, SvXMLImportContext );
+
+XMLTextHeaderFooterContext::XMLTextHeaderFooterContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference<
+ xml::sax::XAttributeList > &,
+ const Reference < XPropertySet > & rPageStylePropSet,
+ sal_Bool bFooter, sal_Bool bLft ) :
+ SvXMLImportContext( rImport, nPrfx, rLName ),
+ xPropSet( rPageStylePropSet ),
+ sOn( bFooter ? OUString(RTL_CONSTASCII_USTRINGPARAM( "FooterIsOn" )) : OUString(RTL_CONSTASCII_USTRINGPARAM( "HeaderIsOn" )) ),
+ sShareContent( bFooter ? OUString(RTL_CONSTASCII_USTRINGPARAM( "FooterIsShared" ))
+ : OUString(RTL_CONSTASCII_USTRINGPARAM( "HeaderIsShared" )) ),
+ sText( bFooter ? OUString(RTL_CONSTASCII_USTRINGPARAM( "FooterText" )) : OUString(RTL_CONSTASCII_USTRINGPARAM( "HeaderText" )) ),
+ sTextLeft( bFooter ? OUString(RTL_CONSTASCII_USTRINGPARAM( "FooterTextLeft" ))
+ : OUString(RTL_CONSTASCII_USTRINGPARAM( "HeaderTextLeft" )) ),
+ bInsertContent( sal_True ),
+ bLeft( bLft )
+{
+ if( bLeft )
+ {
+ Any aAny;
+
+ aAny = xPropSet->getPropertyValue( sOn );
+ sal_Bool bOn = *(sal_Bool *)aAny.getValue();
+
+ if( bOn )
+ {
+ aAny = xPropSet->getPropertyValue( sShareContent );
+ sal_Bool bShared = *(sal_Bool *)aAny.getValue();
+ if( bShared )
+ {
+ // Don't share headers any longer
+ bShared = sal_False;
+ aAny.setValue( &bShared, ::getBooleanCppuType() );
+ xPropSet->setPropertyValue( sShareContent, aAny );
+ }
+ }
+ else
+ {
+ // If headers or footers are switched off, no content must be
+ // inserted.
+ bInsertContent = sal_False;
+ }
+ }
+}
+
+XMLTextHeaderFooterContext::~XMLTextHeaderFooterContext()
+{
+}
+
+SvXMLImportContext *XMLTextHeaderFooterContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList )
+{
+ SvXMLImportContext *pContext = 0;
+ if( bInsertContent )
+ {
+ if( !xOldTextCursor.is() )
+ {
+ sal_Bool bRemoveContent = sal_True;
+ Any aAny;
+ if( bLeft )
+ {
+ // Headers and footers are switched on already,
+ // and they aren't shared.
+ aAny = xPropSet->getPropertyValue( sTextLeft );
+ }
+ else
+ {
+ aAny = xPropSet->getPropertyValue( sOn );
+ sal_Bool bOn = *(sal_Bool *)aAny.getValue();
+
+ if( !bOn )
+ {
+ // Switch header on
+ bOn = sal_True;
+ aAny.setValue( &bOn, ::getBooleanCppuType() );
+ xPropSet->setPropertyValue( sOn, aAny );
+
+ // The content has not to be removed, because the header
+ // or footer is empty already.
+ bRemoveContent = sal_False;
+ }
+
+ // If a header or footer is not shared, share it now.
+ aAny = xPropSet->getPropertyValue( sShareContent );
+ sal_Bool bShared = *(sal_Bool *)aAny.getValue();
+ if( !bShared )
+ {
+ bShared = sal_True;
+ aAny.setValue( &bShared, ::getBooleanCppuType() );
+ xPropSet->setPropertyValue( sShareContent, aAny );
+ }
+
+ aAny = xPropSet->getPropertyValue( sText );
+ }
+
+ Reference < XText > xText;
+ aAny >>= xText;
+
+ if( bRemoveContent )
+ {
+ OUString aText;
+ xText->setString( aText );
+ }
+
+ UniReference < XMLTextImportHelper > xTxtImport =
+ GetImport().GetTextImport();
+
+ xOldTextCursor = xTxtImport->GetCursor();
+ xTxtImport->SetCursor( xText->createTextCursor() );
+ }
+
+ pContext =
+ GetImport().GetTextImport()->CreateTextChildContext(
+ GetImport(), nPrefix, rLocalName, xAttrList,
+ XML_TEXT_TYPE_HEADER_FOOTER );
+ }
+ if( !pContext )
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+
+ return pContext;
+}
+
+void XMLTextHeaderFooterContext::EndElement()
+{
+ if( xOldTextCursor.is() )
+ {
+ GetImport().GetTextImport()->DeleteParagraph();
+ GetImport().GetTextImport()->SetCursor( xOldTextCursor );
+ }
+ else if( !bLeft )
+ {
+ // If no content has been inserted inro the header or footer,
+ // switch it off.
+ sal_Bool bOn = sal_False;
+ Any aAny;
+ aAny.setValue( &bOn, ::getBooleanCppuType() );
+ xPropSet->setPropertyValue( sOn, aAny );
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLTextListAutoStylePool.cxx b/xmloff/source/text/XMLTextListAutoStylePool.cxx
new file mode 100644
index 000000000000..69d886dd1f99
--- /dev/null
+++ b/xmloff/source/text/XMLTextListAutoStylePool.cxx
@@ -0,0 +1,321 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#include <svl/cntnrsrt.hxx>
+#include <com/sun/star/ucb/XAnyCompareFactory.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/container/XIndexReplace.hpp>
+#include <rtl/ustrbuf.hxx>
+#include <xmloff/xmlnume.hxx>
+#include "xmloff/XMLTextListAutoStylePool.hxx"
+#include <xmloff/xmlexp.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::style;
+
+
+int XMLTextListAutoStylePoolNameCmp_Impl( const OUString& r1,
+ const OUString& r2 )
+{
+ return (int)r1.compareTo( r2 );
+}
+
+DECLARE_CONTAINER_SORT_DEL( XMLTextListAutoStylePoolNames_Impl,
+ OUString )
+IMPL_CONTAINER_SORT( XMLTextListAutoStylePoolNames_Impl,
+ OUString,
+ XMLTextListAutoStylePoolNameCmp_Impl )
+
+class XMLTextListAutoStylePoolEntry_Impl
+{
+ OUString sName;
+ OUString sInternalName;
+ Reference < XIndexReplace > xNumRules;
+ sal_uInt32 nPos;
+ sal_Bool bIsNamed;
+
+
+public:
+
+ XMLTextListAutoStylePoolEntry_Impl(
+ sal_uInt32 nPos,
+ const Reference < XIndexReplace > & rNumRules,
+ XMLTextListAutoStylePoolNames_Impl& rNames,
+ const OUString& rPrefix,
+ sal_uInt32& rName );
+
+ XMLTextListAutoStylePoolEntry_Impl(
+ const Reference < XIndexReplace > & rNumRules ) :
+ xNumRules( rNumRules ),
+ nPos( 0 ),
+ bIsNamed( sal_False )
+ {
+ Reference < XNamed > xNamed( xNumRules, UNO_QUERY );
+ if( xNamed.is() )
+ {
+ sInternalName = xNamed->getName();
+ bIsNamed = sal_True;
+ }
+ }
+
+ XMLTextListAutoStylePoolEntry_Impl(
+ const OUString& rInternalName ) :
+ sInternalName( rInternalName ),
+ nPos( 0 ),
+ bIsNamed( sal_True )
+ {
+ }
+
+ const OUString& GetName() const { return sName; }
+ const OUString& GetInternalName() const { return sInternalName; }
+ const Reference < XIndexReplace > & GetNumRules() const { return xNumRules; }
+ sal_uInt32 GetPos() const { return nPos; }
+ sal_Bool IsNamed() const { return bIsNamed; }
+};
+
+XMLTextListAutoStylePoolEntry_Impl::XMLTextListAutoStylePoolEntry_Impl(
+ sal_uInt32 nP,
+ const Reference < XIndexReplace > & rNumRules,
+ XMLTextListAutoStylePoolNames_Impl& rNames,
+ const OUString& rPrefix,
+ sal_uInt32& rName ) :
+ xNumRules( rNumRules ),
+ nPos( nP ),
+ bIsNamed( sal_False )
+{
+ Reference < XNamed > xNamed( xNumRules, UNO_QUERY );
+ if( xNamed.is() )
+ {
+ sInternalName = xNamed->getName();
+ bIsNamed = sal_True;
+ }
+
+ // create a name that hasn't been used before. The created name has not
+ // to be added to the array, because it will never tried again
+ OUStringBuffer sBuffer( 7 );
+ do
+ {
+ rName++;
+ sBuffer.append( rPrefix );
+ sBuffer.append( (sal_Int32)rName );
+ sName = sBuffer.makeStringAndClear();
+ }
+ while( rNames.Seek_Entry( &sName, 0 ) );
+}
+
+int XMLTextListAutoStylePoolEntryCmp_Impl(
+ const XMLTextListAutoStylePoolEntry_Impl& r1,
+ const XMLTextListAutoStylePoolEntry_Impl& r2 )
+{
+ int nRet;
+ if( r1.IsNamed() )
+ {
+ if( r2.IsNamed() )
+ nRet = (int)r1.GetInternalName().compareTo( r2.GetInternalName());
+ else
+ nRet = -1;
+ }
+ else
+ {
+ if( r2.IsNamed() )
+ nRet = 1;
+ else
+ nRet = (int)(r1.GetNumRules().get() - r2.GetNumRules().get());
+ }
+
+ return nRet;
+}
+
+typedef XMLTextListAutoStylePoolEntry_Impl *XMLTextListAutoStylePoolEntryPtr;
+DECLARE_CONTAINER_SORT( XMLTextListAutoStylePool_Impl,
+ XMLTextListAutoStylePoolEntry_Impl )
+IMPL_CONTAINER_SORT( XMLTextListAutoStylePool_Impl,
+ XMLTextListAutoStylePoolEntry_Impl,
+ XMLTextListAutoStylePoolEntryCmp_Impl )
+
+XMLTextListAutoStylePool::XMLTextListAutoStylePool( SvXMLExport& rExp ) :
+ rExport( rExp ),
+ sPrefix( RTL_CONSTASCII_USTRINGPARAM("L") ),
+ pPool( new XMLTextListAutoStylePool_Impl( 5, 5 ) ),
+ pNames( new XMLTextListAutoStylePoolNames_Impl( 5, 5 ) ),
+ nName( 0 )
+{
+ Reference<ucb::XAnyCompareFactory> xCompareFac( rExp.GetModel(), uno::UNO_QUERY );
+ if( xCompareFac.is() )
+ mxNumRuleCompare = xCompareFac->createAnyCompareByName( OUString( RTL_CONSTASCII_USTRINGPARAM( "NumberingRules" ) ) );
+ sal_uInt16 nExportFlags = rExport.getExportFlags();
+ sal_Bool bStylesOnly = (nExportFlags & EXPORT_STYLES) != 0 && (nExportFlags & EXPORT_CONTENT) == 0;
+ if( bStylesOnly )
+ sPrefix = OUString( RTL_CONSTASCII_USTRINGPARAM("ML") );
+
+}
+
+XMLTextListAutoStylePool::~XMLTextListAutoStylePool()
+{
+ // The XMLTextListAutoStylePoolEntry_Impl object in the pool need delete explicitly in dtor.
+ sal_uLong nCount = pPool->Count();
+ while ( nCount-- )
+ delete pPool->Remove(nCount);
+ delete pPool;
+
+ nCount = pNames->Count();
+ while ( nCount-- )
+ delete pNames->Remove(nCount);
+ delete pNames;
+}
+
+void XMLTextListAutoStylePool::RegisterName( const OUString& rName )
+{
+ OUString *pName = new OUString( rName );
+ if( !pNames->Insert( pName ) )
+ delete pName;
+}
+
+sal_Bool XMLTextListAutoStylePool::HasName( const OUString& rName ) const
+{
+ return pNames->Seek_Entry( &rName, 0 );
+}
+
+sal_uInt32 XMLTextListAutoStylePool::Find( XMLTextListAutoStylePoolEntry_Impl* pEntry ) const
+{
+ sal_uLong nPos;
+ if( !pEntry->IsNamed() && mxNumRuleCompare.is() )
+ {
+ const sal_uInt32 nCount = pPool->Count();
+
+ uno::Any aAny1, aAny2;
+ aAny1 <<= pEntry->GetNumRules();
+
+ for( nPos = 0; nPos < nCount; nPos++ )
+ {
+ aAny2 <<= pPool->GetObject(nPos)->GetNumRules();
+
+ if( mxNumRuleCompare->compare( aAny1, aAny2 ) == 0 )
+ return nPos;
+ }
+ }
+ else if( pPool->Seek_Entry( pEntry, &nPos ) )
+ {
+ return nPos;
+ }
+
+ return (sal_uInt32)-1;
+}
+
+OUString XMLTextListAutoStylePool::Add(
+ const Reference < XIndexReplace > & rNumRules )
+{
+ OUString sName;
+ XMLTextListAutoStylePoolEntry_Impl aTmp( rNumRules );
+
+ sal_uInt32 nPos = Find( &aTmp );
+ if( nPos != (sal_uInt32)-1 )
+ {
+ sName = pPool->GetObject( nPos )->GetName();
+ }
+ else
+ {
+ XMLTextListAutoStylePoolEntry_Impl *pEntry =
+ new XMLTextListAutoStylePoolEntry_Impl( pPool->Count(),
+ rNumRules, *pNames, sPrefix,
+ nName );
+ pPool->Insert( pEntry );
+ sName = pEntry->GetName();
+ }
+
+ return sName;
+}
+
+::rtl::OUString XMLTextListAutoStylePool::Find(
+ const Reference < XIndexReplace > & rNumRules ) const
+{
+ OUString sName;
+ XMLTextListAutoStylePoolEntry_Impl aTmp( rNumRules );
+
+ sal_uInt32 nPos = Find( &aTmp );
+ if( nPos != (sal_uInt32)-1 )
+ sName = pPool->GetObject( nPos )->GetName();
+
+ return sName;
+}
+
+::rtl::OUString XMLTextListAutoStylePool::Find(
+ const OUString& rInternalName ) const
+{
+ OUString sName;
+ XMLTextListAutoStylePoolEntry_Impl aTmp( rInternalName );
+ sal_uInt32 nPos = Find( &aTmp );
+ if( nPos != (sal_uInt32)-1 )
+ sName = pPool->GetObject( nPos )->GetName();
+
+ return sName;
+}
+
+void XMLTextListAutoStylePool::exportXML() const
+{
+ sal_uInt32 nCount = pPool->Count();
+ if( !nCount )
+ return;
+
+ XMLTextListAutoStylePoolEntry_Impl **aExpEntries =
+ new XMLTextListAutoStylePoolEntryPtr[nCount];
+
+ sal_uInt32 i;
+ for( i=0; i < nCount; i++ )
+ {
+ aExpEntries[i] = 0;
+ }
+ for( i=0; i < nCount; i++ )
+ {
+ XMLTextListAutoStylePoolEntry_Impl *pEntry = pPool->GetObject(i);
+ DBG_ASSERT( pEntry->GetPos() < nCount, "Illegal pos" );
+ aExpEntries[pEntry->GetPos()] = pEntry;
+ }
+
+ SvxXMLNumRuleExport aNumRuleExp( rExport );
+
+ for( i=0; i < nCount; i++ )
+ {
+ XMLTextListAutoStylePoolEntry_Impl *pEntry = aExpEntries[i];
+ aNumRuleExp.exportNumberingRule( pEntry->GetName(),
+ pEntry->GetNumRules() );
+ }
+ delete [] aExpEntries;
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLTextListBlockContext.cxx b/xmloff/source/text/XMLTextListBlockContext.cxx
new file mode 100644
index 000000000000..1991670ee3cf
--- /dev/null
+++ b/xmloff/source/text/XMLTextListBlockContext.cxx
@@ -0,0 +1,308 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/container/XIndexReplace.hpp>
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmlnumi.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include "XMLTextListItemContext.hxx"
+#include "XMLTextListBlockContext.hxx"
+#include "txtlists.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::beans;
+using namespace ::xmloff::token;
+
+TYPEINIT1( XMLTextListBlockContext, SvXMLImportContext );
+
+// OD 2008-05-07 #refactorlists#
+// add optional parameter <bRestartNumberingAtSubList> and its handling
+XMLTextListBlockContext::XMLTextListBlockContext(
+ SvXMLImport& rImport,
+ XMLTextImportHelper& rTxtImp,
+ sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const Reference< xml::sax::XAttributeList > & xAttrList,
+ const sal_Bool bRestartNumberingAtSubList )
+: SvXMLImportContext( rImport, nPrfx, rLName )
+, mrTxtImport( rTxtImp )
+, msListStyleName()
+, mxParentListBlock( )
+, mnLevel( 0 )
+, mbRestartNumbering( sal_False )
+, mbSetDefaults( sal_False )
+, msListId()
+, msContinueListId()
+{
+ static ::rtl::OUString s_PropNameDefaultListId(
+ RTL_CONSTASCII_USTRINGPARAM("DefaultListId"));
+ {
+ // get the parent list block context (if any); this is a bit ugly...
+ XMLTextListBlockContext * pLB(0);
+ XMLTextListItemContext * pLI(0);
+ XMLNumberedParaContext * pNP(0);
+ rTxtImp.GetTextListHelper().ListContextTop(pLB, pLI, pNP);
+ mxParentListBlock = pLB;
+ }
+ // Inherit style name from parent list, as well as the flags whether
+ // numbering must be restarted and formats have to be created.
+ OUString sParentListStyleName;
+ if( mxParentListBlock.Is() )
+ {
+ XMLTextListBlockContext *pParent =
+ (XMLTextListBlockContext *)&mxParentListBlock;
+ msListStyleName = pParent->GetListStyleName();
+ sParentListStyleName = msListStyleName;
+ mxNumRules = pParent->GetNumRules();
+ mnLevel = pParent->GetLevel() + 1;
+ mbRestartNumbering = pParent->IsRestartNumbering() ||
+ bRestartNumberingAtSubList;
+ mbSetDefaults = pParent->mbSetDefaults;
+ msListId = pParent->GetListId();
+ msContinueListId = pParent->GetContinueListId();
+ }
+
+ const SvXMLTokenMap& rTokenMap = mrTxtImport.GetTextListBlockAttrTokenMap();
+
+ bool bIsContinueNumberingAttributePresent( false );
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ const OUString& rValue = xAttrList->getValueByIndex( i );
+
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ switch( rTokenMap.Get( nPrefix, aLocalName ) )
+ {
+ case XML_TOK_TEXT_LIST_BLOCK_XMLID:
+ sXmlId = rValue;
+//FIXME: there is no UNO API for lists
+ // xml:id is also the list ID (#i92221#)
+ if ( mnLevel == 0 ) // root <list> element
+ {
+ msListId = rValue;
+ }
+ break;
+ case XML_TOK_TEXT_LIST_BLOCK_CONTINUE_NUMBERING:
+ mbRestartNumbering = !IsXMLToken(rValue, XML_TRUE);
+ bIsContinueNumberingAttributePresent = true;
+ break;
+ case XML_TOK_TEXT_LIST_BLOCK_STYLE_NAME:
+ msListStyleName = rValue;
+ break;
+ case XML_TOK_TEXT_LIST_BLOCK_CONTINUE_LIST:
+ if ( mnLevel == 0 ) // root <list> element
+ {
+ msContinueListId = rValue;
+ }
+ break;
+ }
+ }
+
+ mxNumRules = XMLTextListsHelper::MakeNumRule(GetImport(), mxNumRules,
+ sParentListStyleName, msListStyleName,
+ mnLevel, &mbRestartNumbering, &mbSetDefaults );
+ if( !mxNumRules.is() )
+ return;
+
+ if ( mnLevel == 0 ) // root <list> element
+ {
+ XMLTextListsHelper& rTextListsHelper( mrTxtImport.GetTextListHelper() );
+ // Inconsistent behavior regarding lists (#i92811#)
+ ::rtl::OUString sListStyleDefaultListId;
+ {
+ uno::Reference< beans::XPropertySet > xNumRuleProps( mxNumRules, UNO_QUERY );
+ if ( xNumRuleProps.is() )
+ {
+ uno::Reference< beans::XPropertySetInfo > xNumRulePropSetInfo(
+ xNumRuleProps->getPropertySetInfo());
+ if (xNumRulePropSetInfo.is() &&
+ xNumRulePropSetInfo->hasPropertyByName(
+ s_PropNameDefaultListId))
+ {
+ xNumRuleProps->getPropertyValue(s_PropNameDefaultListId)
+ >>= sListStyleDefaultListId;
+ DBG_ASSERT( sListStyleDefaultListId.getLength() != 0,
+ "no default list id found at numbering rules instance. Serious defect -> please inform OD." );
+ }
+ }
+ }
+ if ( msListId.getLength() == 0 ) // no text:id property found
+ {
+ sal_Int32 nUPD( 0 );
+ sal_Int32 nBuild( 0 );
+ const bool bBuildIdFound = GetImport().getBuildIds( nUPD, nBuild );
+ if ( rImport.IsTextDocInOOoFileFormat() ||
+ ( bBuildIdFound && nUPD == 680 ) )
+ {
+ /* handling former documents written by OpenOffice.org:
+ use default list id of numbering rules instance, if existing
+ (#i92811#)
+ */
+ if ( sListStyleDefaultListId.getLength() != 0 )
+ {
+ msListId = sListStyleDefaultListId;
+ if ( !bIsContinueNumberingAttributePresent &&
+ !mbRestartNumbering &&
+ rTextListsHelper.IsListProcessed( msListId ) )
+ {
+ mbRestartNumbering = sal_True;
+ }
+ }
+ }
+ if ( msListId.getLength() == 0 )
+ {
+ // generate a new list id for the list
+ msListId = rTextListsHelper.GenerateNewListId();
+ }
+ }
+
+ if ( bIsContinueNumberingAttributePresent && !mbRestartNumbering &&
+ msContinueListId.getLength() == 0 )
+ {
+ ::rtl::OUString Last( rTextListsHelper.GetLastProcessedListId() );
+ if ( rTextListsHelper.GetListStyleOfLastProcessedList() == msListStyleName
+ && Last != msListId )
+ {
+ msContinueListId = Last;
+ }
+ }
+
+ if ( msContinueListId.getLength() > 0 )
+ {
+ if ( !rTextListsHelper.IsListProcessed( msContinueListId ) )
+ {
+ msContinueListId = ::rtl::OUString();
+ }
+ else
+ {
+ // search continue list chain for master list and
+ // continue the master list.
+ ::rtl::OUString sTmpStr =
+ rTextListsHelper.GetContinueListIdOfProcessedList( msContinueListId );
+ while ( sTmpStr.getLength() > 0 )
+ {
+ msContinueListId = sTmpStr;
+
+ sTmpStr =
+ rTextListsHelper.GetContinueListIdOfProcessedList( msContinueListId );
+ }
+ }
+ }
+
+ if ( !rTextListsHelper.IsListProcessed( msListId ) )
+ {
+ // Inconsistent behavior regarding lists (#i92811#)
+ rTextListsHelper.KeepListAsProcessed(
+ msListId, msListStyleName, msContinueListId,
+ sListStyleDefaultListId );
+ }
+ }
+
+ // Remember this list block.
+ mrTxtImport.GetTextListHelper().PushListContext( this );
+}
+
+XMLTextListBlockContext::~XMLTextListBlockContext()
+{
+}
+
+void XMLTextListBlockContext::EndElement()
+{
+ // Numbering has not to be restarted if it has been restarted within
+ // a child list.
+ XMLTextListBlockContext *pParent =
+ (XMLTextListBlockContext *)&mxParentListBlock;
+ if( pParent )
+ {
+ pParent->mbRestartNumbering = mbRestartNumbering;
+ }
+
+ // Restore current list block.
+ mrTxtImport.GetTextListHelper().PopListContext();
+
+ // Any paragraph following the list within the same list item must not
+ // be numbered.
+ mrTxtImport.GetTextListHelper().SetListItem( 0 );
+}
+
+SvXMLImportContext *XMLTextListBlockContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference< xml::sax::XAttributeList > & xAttrList )
+{
+ SvXMLImportContext *pContext = 0;
+
+ const SvXMLTokenMap& rTokenMap =
+ mrTxtImport.GetTextListBlockElemTokenMap();
+ sal_Bool bHeader = sal_False;
+ switch( rTokenMap.Get( nPrefix, rLocalName ) )
+ {
+ case XML_TOK_TEXT_LIST_HEADER:
+ bHeader = sal_True;
+ case XML_TOK_TEXT_LIST_ITEM:
+ pContext = new XMLTextListItemContext( GetImport(), mrTxtImport,
+ nPrefix, rLocalName,
+ xAttrList, bHeader );
+ break;
+ }
+
+ if( !pContext )
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+
+ return pContext;
+}
+
+const ::rtl::OUString& XMLTextListBlockContext::GetListId() const
+{
+ return msListId;
+}
+
+const ::rtl::OUString& XMLTextListBlockContext::GetContinueListId() const
+{
+ return msContinueListId;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLTextListBlockContext.hxx b/xmloff/source/text/XMLTextListBlockContext.hxx
new file mode 100644
index 000000000000..ba47769abc94
--- /dev/null
+++ b/xmloff/source/text/XMLTextListBlockContext.hxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLTEXTLISTBLOCKCONTEXT_HXX
+#define _XMLTEXTLISTBLOCKCONTEXT_HXX
+
+#include <com/sun/star/container/XIndexReplace.hpp>
+#include <xmloff/xmlictxt.hxx>
+
+class XMLTextImportHelper;
+
+class XMLTextListBlockContext : public SvXMLImportContext
+{
+ XMLTextImportHelper& mrTxtImport;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XIndexReplace > mxNumRules;
+
+ // text:style-name property of <list> element
+ ::rtl::OUString msListStyleName;
+ ::rtl::OUString sXmlId;
+
+ SvXMLImportContextRef mxParentListBlock;
+
+ sal_Int16 mnLevel;
+ sal_Bool mbRestartNumbering;
+ sal_Bool mbSetDefaults;
+
+ // text:id property of <list> element, only valid for root <list> element
+ ::rtl::OUString msListId;
+ // text:continue-list property of <list> element, only valid for root <list> element
+ ::rtl::OUString msContinueListId;
+
+public:
+
+ TYPEINFO();
+
+ // add optional parameter <bRestartNumberingAtSubList>
+ XMLTextListBlockContext(
+ SvXMLImport& rImport,
+ XMLTextImportHelper& rTxtImp,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
+ const sal_Bool bRestartNumberingAtSubList = sal_False );
+ virtual ~XMLTextListBlockContext();
+
+ virtual void EndElement();
+
+ SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+ const ::rtl::OUString& GetListStyleName() const { return msListStyleName; }
+ sal_Int16 GetLevel() const { return mnLevel; }
+ sal_Bool IsRestartNumbering() const { return mbRestartNumbering; }
+ void ResetRestartNumbering() { mbRestartNumbering = sal_False; }
+
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::container::XIndexReplace >& GetNumRules() const
+ { return mxNumRules; }
+
+ const ::rtl::OUString& GetListId() const;
+ const ::rtl::OUString& GetContinueListId() const;
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLTextListItemContext.cxx b/xmloff/source/text/XMLTextListItemContext.cxx
new file mode 100644
index 000000000000..47a5fa025df6
--- /dev/null
+++ b/xmloff/source/text/XMLTextListItemContext.cxx
@@ -0,0 +1,185 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include "txtparai.hxx"
+#include "txtlists.hxx"
+#include "XMLTextListBlockContext.hxx"
+#include <xmloff/txtimp.hxx>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/style/XStyle.hpp>
+#include <xmloff/xmlnumi.hxx>
+#include "XMLTextListItemContext.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::xmloff::token;
+
+TYPEINIT1( XMLTextListItemContext, SvXMLImportContext );
+
+XMLTextListItemContext::XMLTextListItemContext(
+ SvXMLImport& rImport,
+ XMLTextImportHelper& rTxtImp,
+ const sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const Reference< xml::sax::XAttributeList > & xAttrList,
+ const sal_Bool bIsHeader )
+ : SvXMLImportContext( rImport, nPrfx, rLName ),
+ rTxtImport( rTxtImp ),
+ nStartValue( -1 ),
+ mnSubListCount( 0 ),
+ mxNumRulesOverride()
+{
+ static ::rtl::OUString s_NumberingRules(
+ RTL_CONSTASCII_USTRINGPARAM("NumberingRules"));
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ const OUString& rValue = xAttrList->getValueByIndex( i );
+
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ if( !bIsHeader && XML_NAMESPACE_TEXT == nPrefix &&
+ IsXMLToken( aLocalName, XML_START_VALUE ) )
+ {
+ sal_Int32 nTmp = rValue.toInt32();
+ if( nTmp >= 0 && nTmp <= SHRT_MAX )
+ nStartValue = (sal_Int16)nTmp;
+ }
+ else if ( nPrefix == XML_NAMESPACE_TEXT &&
+ IsXMLToken( aLocalName, XML_STYLE_OVERRIDE ) )
+ {
+ const ::rtl::OUString sListStyleOverrideName = rValue;
+ if ( sListStyleOverrideName.getLength() > 0 )
+ {
+ OUString sDisplayStyleName(
+ GetImport().GetStyleDisplayName( XML_STYLE_FAMILY_TEXT_LIST,
+ sListStyleOverrideName ) );
+ const Reference < container::XNameContainer >& rNumStyles =
+ rTxtImp.GetNumberingStyles();
+ if( rNumStyles.is() && rNumStyles->hasByName( sDisplayStyleName ) )
+ {
+ Reference < style::XStyle > xStyle;
+ Any aAny = rNumStyles->getByName( sDisplayStyleName );
+ aAny >>= xStyle;
+
+ uno::Reference< beans::XPropertySet > xPropSet( xStyle, UNO_QUERY );
+ aAny = xPropSet->getPropertyValue(s_NumberingRules);
+ aAny >>= mxNumRulesOverride;
+ }
+ else
+ {
+ const SvxXMLListStyleContext* pListStyle =
+ rTxtImp.FindAutoListStyle( sListStyleOverrideName );
+ if( pListStyle )
+ {
+ mxNumRulesOverride = pListStyle->GetNumRules();
+ if( !mxNumRulesOverride.is() )
+ {
+ pListStyle->CreateAndInsertAuto();
+ mxNumRulesOverride = pListStyle->GetNumRules();
+ }
+ }
+ }
+ }
+ }
+ else if ( (XML_NAMESPACE_XML == nPrefix) &&
+ IsXMLToken(aLocalName, XML_ID) )
+ {
+ (void) rValue;
+//FIXME: there is no UNO API for list items
+ }
+ }
+
+ // If this is a <text:list-item> element, then remember it as a sign
+ // that a bullet has to be generated.
+ if( !bIsHeader ) {
+ rTxtImport.GetTextListHelper().SetListItem( this );
+ }
+
+}
+
+XMLTextListItemContext::~XMLTextListItemContext()
+{
+}
+
+void XMLTextListItemContext::EndElement()
+{
+ // finish current list item
+ rTxtImport.GetTextListHelper().SetListItem( 0 );
+}
+
+SvXMLImportContext *XMLTextListItemContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference< xml::sax::XAttributeList > & xAttrList )
+{
+ SvXMLImportContext *pContext = 0;
+
+ const SvXMLTokenMap& rTokenMap = rTxtImport.GetTextElemTokenMap();
+ sal_Bool bHeading = sal_False;
+ switch( rTokenMap.Get( nPrefix, rLocalName ) )
+ {
+ case XML_TOK_TEXT_H:
+ bHeading = sal_True;
+ case XML_TOK_TEXT_P:
+ pContext = new XMLParaContext( GetImport(),
+ nPrefix, rLocalName,
+ xAttrList, bHeading );
+ if (rTxtImport.IsProgress())
+ GetImport().GetProgressBarHelper()->Increment();
+
+ break;
+ case XML_TOK_TEXT_LIST:
+ ++mnSubListCount;
+ pContext = new XMLTextListBlockContext( GetImport(), rTxtImport,
+ nPrefix, rLocalName,
+ xAttrList,
+ (mnSubListCount > 1) );
+ break;
+ }
+
+ if( !pContext )
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+
+ return pContext;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLTextListItemContext.hxx b/xmloff/source/text/XMLTextListItemContext.hxx
new file mode 100644
index 000000000000..2644a38513a9
--- /dev/null
+++ b/xmloff/source/text/XMLTextListItemContext.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLTEXTLISTITEMCONTEXT_HXX
+#define _XMLTEXTLISTITEMCONTEXT_HXX
+
+#include <xmloff/xmlictxt.hxx>
+
+class XMLTextImportHelper;
+
+class XMLTextListItemContext : public SvXMLImportContext
+{
+ XMLTextImportHelper& rTxtImport;
+
+ sal_Int16 nStartValue;
+
+ // quantity of <text:list> child elements
+ sal_Int16 mnSubListCount;
+ // list style instance for text::style-override property
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XIndexReplace > mxNumRulesOverride;
+
+public:
+
+ TYPEINFO();
+
+ XMLTextListItemContext(
+ SvXMLImport& rImport,
+ XMLTextImportHelper& rTxtImp,
+ const sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
+ const sal_Bool bIsHeader = sal_False );
+ virtual ~XMLTextListItemContext();
+
+ virtual void EndElement();
+
+ SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+ sal_Bool HasStartValue() const { return -1 != nStartValue; }
+ sal_Int16 GetStartValue() const { return nStartValue; }
+
+ inline sal_Bool HasNumRulesOverride() const
+ {
+ return mxNumRulesOverride.is();
+ }
+ inline const ::com::sun::star::uno::Reference <
+ ::com::sun::star::container::XIndexReplace >& GetNumRulesOverride() const
+ {
+ return mxNumRulesOverride;
+ }
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLTextMarkImportContext.cxx b/xmloff/source/text/XMLTextMarkImportContext.cxx
new file mode 100644
index 000000000000..ace0f99bc900
--- /dev/null
+++ b/xmloff/source/text/XMLTextMarkImportContext.cxx
@@ -0,0 +1,492 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+#include "XMLTextMarkImportContext.hxx"
+
+
+#include <rtl/ustring.hxx>
+#include <tools/debug.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/odffields.hxx>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/text/XTextContent.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/rdf/XMetadatable.hpp>
+
+#include <com/sun/star/text/XFormField.hpp>
+
+#include "RDFaImportHelper.hxx"
+
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::xmloff::token;
+
+using rtl::OUString;
+
+
+XMLFieldParamImportContext::XMLFieldParamImportContext(
+ SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName ) :
+ SvXMLImportContext(rImport, nPrefix, rLocalName),
+ rHelper(rHlp)
+{
+}
+
+
+void XMLFieldParamImportContext::StartElement(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList> & xAttrList)
+{
+ SvXMLImport& rImport = GetImport();
+ ::rtl::OUString sName;
+ ::rtl::OUString sValue;
+
+ sal_Int16 nLength = xAttrList->getLength();
+ for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++)
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = rImport.GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
+ &sLocalName );
+
+ if ( (XML_NAMESPACE_FIELD == nPrefix) &&
+ IsXMLToken(sLocalName, XML_NAME) )
+ {
+ sName = xAttrList->getValueByIndex(nAttr);
+ }
+ if ( (XML_NAMESPACE_FIELD == nPrefix) &&
+ IsXMLToken(sLocalName, XML_VALUE) )
+ {
+ sValue = xAttrList->getValueByIndex(nAttr);
+ }
+ }
+ if (rHelper.hasCurrentFieldCtx() && sName.getLength()>0) {
+ rHelper.addFieldParam(sName, sValue);
+ }
+}
+
+
+TYPEINIT1( XMLTextMarkImportContext, SvXMLImportContext);
+
+XMLTextMarkImportContext::XMLTextMarkImportContext(
+ SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName )
+ : SvXMLImportContext(rImport, nPrefix, rLocalName)
+ , m_rHelper(rHlp)
+ , m_bHaveAbout(false)
+{
+}
+
+enum lcl_MarkType { TypeReference, TypeReferenceStart, TypeReferenceEnd,
+ TypeBookmark, TypeBookmarkStart, TypeBookmarkEnd,
+ TypeFieldmark, TypeFieldmarkStart, TypeFieldmarkEnd
+ };
+
+static SvXMLEnumMapEntry const lcl_aMarkTypeMap[] =
+{
+ { XML_REFERENCE_MARK, TypeReference },
+ { XML_REFERENCE_MARK_START, TypeReferenceStart },
+ { XML_REFERENCE_MARK_END, TypeReferenceEnd },
+ { XML_BOOKMARK, TypeBookmark },
+ { XML_BOOKMARK_START, TypeBookmarkStart },
+ { XML_BOOKMARK_END, TypeBookmarkEnd },
+ { XML_FIELDMARK, TypeFieldmark },
+ { XML_FIELDMARK_START, TypeFieldmarkStart },
+ { XML_FIELDMARK_END, TypeFieldmarkEnd },
+ { XML_TOKEN_INVALID, 0 },
+};
+
+
+static const char *lcl_getFormFieldmarkName(rtl::OUString &name)
+{
+ static const char sCheckbox[]=ODF_FORMCHECKBOX;
+ static const char sFormDropDown[]=ODF_FORMDROPDOWN;
+ if (name.compareToAscii("msoffice.field.FORMCHECKBOX")==0 ||
+ name.compareToAscii("ecma.office-open-xml.field.FORMCHECKBOX")==0)
+ return sCheckbox;
+ else if (name.compareToAscii(ODF_FORMCHECKBOX)==0)
+ return sCheckbox;
+ if (name.compareToAscii(ODF_FORMDROPDOWN)==0 ||
+ name.compareToAscii("ecma.office-open-xml.field.FORMDROPDOWN")==0)
+ return sFormDropDown;
+ else
+ return NULL;
+}
+
+static rtl::OUString lcl_getFieldmarkName(rtl::OUString &name)
+{
+ static const char sFormtext[]=ODF_FORMTEXT;
+ if (name.compareToAscii("msoffice.field.FORMTEXT")==0 ||
+ name.compareToAscii("ecma.office-open-xml.field.FORMTEXT")==0)
+ return rtl::OUString::createFromAscii(sFormtext);
+ else if (name.compareToAscii(ODF_FORMTEXT)==0)
+ return rtl::OUString::createFromAscii(sFormtext);
+ else
+ return name;
+}
+
+
+void XMLTextMarkImportContext::StartElement(
+ const Reference<XAttributeList> & xAttrList)
+{
+ if (!FindName(GetImport(), xAttrList))
+ {
+ m_sBookmarkName = OUString();
+ }
+
+ if (IsXMLToken(GetLocalName(), XML_FIELDMARK_END))
+ {
+ m_sBookmarkName = m_rHelper.FindActiveBookmarkName();
+ }
+
+ if (IsXMLToken(GetLocalName(), XML_FIELDMARK_START) || IsXMLToken(GetLocalName(), XML_FIELDMARK))
+ {
+ if (m_sBookmarkName.getLength() == 0)
+ {
+ m_sBookmarkName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown"));
+ }
+ m_rHelper.pushFieldCtx( m_sBookmarkName, m_sFieldName );
+ }
+}
+
+void XMLTextMarkImportContext::EndElement()
+{
+ SvXMLImportContext::EndElement();
+
+ static const OUString sAPI_reference_mark(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.ReferenceMark"));
+ static const OUString sAPI_bookmark(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Bookmark"));
+ static const OUString sAPI_fieldmark(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Fieldmark"));
+ static const OUString sAPI_formfieldmark(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.FormFieldmark"));
+
+ if (m_sBookmarkName.getLength() > 0)
+ {
+ sal_uInt16 nTmp;
+ if (SvXMLUnitConverter::convertEnum(nTmp, GetLocalName(),
+ lcl_aMarkTypeMap))
+ {
+ switch ((lcl_MarkType)nTmp)
+ {
+ case TypeReference:
+ // export point reference mark
+ CreateAndInsertMark(GetImport(),
+ sAPI_reference_mark,
+ m_sBookmarkName,
+ m_rHelper.GetCursorAsRange()->getStart(),
+ ::rtl::OUString());
+ break;
+
+ case TypeFieldmark:
+ case TypeBookmark:
+ {
+ const char *formFieldmarkName=lcl_getFormFieldmarkName(m_sFieldName);
+ bool bImportAsField=((lcl_MarkType)nTmp==TypeFieldmark && formFieldmarkName!=NULL); //@TODO handle abbreviation cases..
+ // export point bookmark
+ const Reference<XInterface> xContent(
+ CreateAndInsertMark(GetImport(),
+ (bImportAsField?sAPI_formfieldmark:sAPI_bookmark),
+ m_sBookmarkName,
+ m_rHelper.GetCursorAsRange()->getStart(),
+ m_sXmlId) );
+ if ((lcl_MarkType)nTmp==TypeFieldmark) {
+ if (xContent.is() && bImportAsField) {
+ // setup fieldmark...
+ Reference< ::com::sun::star::text::XFormField> xFormField(xContent, UNO_QUERY);
+ xFormField->setFieldType(rtl::OUString::createFromAscii(formFieldmarkName));
+ if (xFormField.is() && m_rHelper.hasCurrentFieldCtx()) {
+ m_rHelper.setCurrentFieldParamsTo(xFormField);
+ }
+ }
+ m_rHelper.popFieldCtx();
+ }
+ }
+ break;
+
+ case TypeFieldmarkStart:
+ case TypeBookmarkStart:
+ // save XTextRange for later construction of bookmark
+ {
+ ::boost::shared_ptr< ::xmloff::ParsedRDFaAttributes >
+ pRDFaAttributes;
+ if (m_bHaveAbout && (TypeBookmarkStart
+ == static_cast<lcl_MarkType>(nTmp)))
+ {
+ pRDFaAttributes =
+ GetImport().GetRDFaImportHelper().ParseRDFa(
+ m_sAbout, m_sProperty,
+ m_sContent, m_sDatatype);
+ }
+ m_rHelper.InsertBookmarkStartRange(
+ m_sBookmarkName,
+ m_rHelper.GetCursorAsRange()->getStart(),
+ m_sXmlId, pRDFaAttributes);
+ }
+ break;
+
+ case TypeFieldmarkEnd:
+ case TypeBookmarkEnd:
+ {
+ // get old range, and construct
+ Reference<XTextRange> xStartRange;
+ ::boost::shared_ptr< ::xmloff::ParsedRDFaAttributes >
+ pRDFaAttributes;
+ if (m_rHelper.FindAndRemoveBookmarkStartRange(
+ m_sBookmarkName, xStartRange,
+ m_sXmlId, pRDFaAttributes))
+ {
+ Reference<XTextRange> xEndRange(
+ m_rHelper.GetCursorAsRange()->getStart());
+
+ // check if beginning and end are in same XText
+ if (xStartRange->getText() == xEndRange->getText())
+ {
+ // create range for insertion
+ Reference<XTextCursor> xInsertionCursor =
+ m_rHelper.GetText()->createTextCursorByRange(
+ xEndRange);
+ try {
+ xInsertionCursor->gotoRange(xStartRange, sal_True);
+ } catch (uno::Exception&) {
+ OSL_ENSURE(false,
+ "cannot go to end position of bookmark");
+ }
+
+ //DBG_ASSERT(! xInsertionCursor->isCollapsed(),
+ // "we want no point mark");
+ // can't assert, because someone could
+ // create a file with subsequence
+ // start/end elements
+
+ Reference<XTextRange> xInsertionRange(
+ xInsertionCursor, UNO_QUERY);
+
+ bool bImportAsField=((lcl_MarkType)nTmp==TypeFieldmarkEnd && m_rHelper.hasCurrentFieldCtx());
+
+ // insert reference
+ const Reference<XInterface> xContent(
+ CreateAndInsertMark(GetImport(),
+ (bImportAsField?sAPI_fieldmark:sAPI_bookmark),
+ m_sBookmarkName,
+ xInsertionRange,
+ m_sXmlId) );
+ if (pRDFaAttributes)
+ {
+ const Reference<rdf::XMetadatable>
+ xMeta(xContent, UNO_QUERY);
+ GetImport().GetRDFaImportHelper().AddRDFa(
+ xMeta, pRDFaAttributes);
+ }
+
+ if ((lcl_MarkType)nTmp==TypeFieldmarkEnd) {
+ if (xContent.is() && bImportAsField) {
+ // setup fieldmark...
+ Reference< ::com::sun::star::text::XFormField> xFormField(xContent, UNO_QUERY);
+ if (xFormField.is() && m_rHelper.hasCurrentFieldCtx()) {
+ rtl::OUString givenTypeName=m_rHelper.getCurrentFieldType();
+ rtl::OUString fieldmarkTypeName=lcl_getFieldmarkName(givenTypeName);
+
+ xFormField->setFieldType(fieldmarkTypeName);
+ m_rHelper.setCurrentFieldParamsTo(xFormField);
+ }
+ }
+ m_rHelper.popFieldCtx();
+ }
+ }
+ // else: beginning/end in different XText -> ignore!
+ }
+ // else: no start found -> ignore!
+ break;
+ }
+
+ case TypeReferenceStart:
+ case TypeReferenceEnd:
+ OSL_FAIL("reference start/end are handled in txtparai !");
+ break;
+
+ default:
+ OSL_FAIL("unknown mark type");
+ break;
+ }
+ }
+ }
+}
+
+SvXMLImportContext *XMLTextMarkImportContext::CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& )
+{
+ return new XMLFieldParamImportContext(GetImport(), m_rHelper,
+ nPrefix, rLocalName);
+}
+
+
+Reference<XTextContent> XMLTextMarkImportContext::CreateAndInsertMark(
+ SvXMLImport& rImport,
+ const OUString& sServiceName,
+ const OUString& sMarkName,
+ const Reference<XTextRange> & rRange,
+ const OUString& i_rXmlId)
+{
+ // create mark
+ const Reference<XMultiServiceFactory> xFactory(rImport.GetModel(),
+ UNO_QUERY);
+ Reference<XInterface> xIfc;
+
+ if (xFactory.is())
+ {
+ xIfc = xFactory->createInstance(sServiceName);
+
+ if (!xIfc.is())
+ {
+ OSL_FAIL("CreateAndInsertMark: cannot create service?");
+ return 0;
+ }
+
+ // set name (unless there is no name (text:meta))
+ const Reference<XNamed> xNamed(xIfc, UNO_QUERY);
+ if (xNamed.is())
+ {
+ xNamed->setName(sMarkName);
+ }
+ else
+ {
+ if (sMarkName.getLength())
+ {
+ OSL_FAIL("name given, but XNamed not supported?");
+ return 0;
+ }
+ }
+
+ // cast to XTextContent and attach to document
+ const Reference<XTextContent> xTextContent(xIfc, UNO_QUERY);
+ if (xTextContent.is())
+ {
+ try
+ {
+ // if inserting marks, bAbsorb==sal_False will cause
+ // collapsing of the given XTextRange.
+ rImport.GetTextImport()->GetText()->insertTextContent(rRange,
+ xTextContent, sal_True);
+
+ // xml:id for RDF metadata -- after insertion!
+ rImport.SetXmlId(xIfc, i_rXmlId);
+
+ return xTextContent;
+ }
+ catch (com::sun::star::lang::IllegalArgumentException &)
+ {
+ OSL_FAIL("CreateAndInsertMark: cannot insert?");
+ return 0;
+ }
+ }
+ }
+ return 0;
+}
+
+sal_Bool XMLTextMarkImportContext::FindName(
+ SvXMLImport& rImport,
+ const Reference<XAttributeList> & xAttrList)
+{
+ sal_Bool bNameOK = sal_False;
+
+ // find name attribute first
+ const sal_Int16 nLength = xAttrList->getLength();
+ for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++)
+ {
+ OUString sLocalName;
+ const sal_uInt16 nPrefix = rImport.GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
+ &sLocalName );
+
+ if ( (XML_NAMESPACE_TEXT == nPrefix) &&
+ IsXMLToken(sLocalName, XML_NAME) )
+ {
+ m_sBookmarkName = xAttrList->getValueByIndex(nAttr);
+ bNameOK = sal_True;
+ }
+ else if ( (XML_NAMESPACE_XML == nPrefix) &&
+ IsXMLToken(sLocalName, XML_ID) )
+ {
+ m_sXmlId = xAttrList->getValueByIndex(nAttr);
+ }
+ else if ( XML_NAMESPACE_XHTML == nPrefix )
+ {
+ // RDFa
+ if ( IsXMLToken( sLocalName, XML_ABOUT) )
+ {
+ m_sAbout = xAttrList->getValueByIndex(nAttr);
+ m_bHaveAbout = true;
+ }
+ else if ( IsXMLToken( sLocalName, XML_PROPERTY) )
+ {
+ m_sProperty = xAttrList->getValueByIndex(nAttr);
+ }
+ else if ( IsXMLToken( sLocalName, XML_CONTENT) )
+ {
+ m_sContent = xAttrList->getValueByIndex(nAttr);
+ }
+ else if ( IsXMLToken( sLocalName, XML_DATATYPE) )
+ {
+ m_sDatatype = xAttrList->getValueByIndex(nAttr);
+ }
+ }
+ else if ( (XML_NAMESPACE_FIELD == nPrefix) &&
+ IsXMLToken(sLocalName, XML_TYPE) )
+ {
+ m_sFieldName = xAttrList->getValueByIndex(nAttr);
+ }
+ }
+
+ return bNameOK;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLTextMarkImportContext.hxx b/xmloff/source/text/XMLTextMarkImportContext.hxx
new file mode 100644
index 000000000000..5742fae877a6
--- /dev/null
+++ b/xmloff/source/text/XMLTextMarkImportContext.hxx
@@ -0,0 +1,127 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLTEXTMARKIMPORTCONTEXT_HXX
+#define _XMLOFF_XMLTEXTMARKIMPORTCONTEXT_HXX
+
+#include <xmloff/xmlictxt.hxx>
+#include <com/sun/star/uno/Reference.h>
+
+
+namespace com { namespace sun { namespace star {
+ namespace text {
+ class XTextRange;
+ class XTextContent;
+ }
+ namespace xml { namespace sax {
+ class XAttributeList;
+ } }
+} } }
+namespace rtl {
+ class OUString;
+}
+class XMLTextImportHelper;
+
+class XMLFieldParamImportContext : public SvXMLImportContext
+{
+ XMLTextImportHelper& rHelper;
+public:
+ XMLFieldParamImportContext(
+ SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName );
+
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+};
+
+
+/**
+ * import bookmarks and reference marks
+ * ( <bookmark>, <bookmark-start>, <bookmark-end>,
+ * <reference>, <reference-start>, <reference-end> )
+ *
+ * All elements are handled by the same class due to their similarities.
+ */
+class XMLTextMarkImportContext : public SvXMLImportContext
+{
+
+ XMLTextImportHelper & m_rHelper;
+ ::rtl::OUString m_sBookmarkName;
+ ::rtl::OUString m_sFieldName;
+ ::rtl::OUString m_sXmlId;
+ // RDFa
+ bool m_bHaveAbout;
+ ::rtl::OUString m_sAbout;
+ ::rtl::OUString m_sProperty;
+ ::rtl::OUString m_sContent;
+ ::rtl::OUString m_sDatatype;
+
+public:
+
+ TYPEINFO();
+
+ XMLTextMarkImportContext(
+ SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName );
+
+protected:
+
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+ virtual void EndElement();
+
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+public:
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextContent > CreateAndInsertMark(
+ SvXMLImport& rImport,
+ const ::rtl::OUString& sServiceName,
+ const ::rtl::OUString& sMarkName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange> & rRange,
+ const ::rtl::OUString& i_rXmlId = ::rtl::OUString());
+
+ sal_Bool FindName(
+ SvXMLImport& rImport,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLTextMasterPageContext.cxx b/xmloff/source/text/XMLTextMasterPageContext.cxx
new file mode 100644
index 000000000000..313a140b70ba
--- /dev/null
+++ b/xmloff/source/text/XMLTextMasterPageContext.cxx
@@ -0,0 +1,295 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/style/PageStyleLayout.hpp>
+#include <com/sun/star/beans/XMultiPropertyStates.hpp>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/XMLTextMasterPageContext.hxx>
+#include "XMLTextHeaderFooterContext.hxx"
+#include <xmloff/xmlimp.hxx>
+#include "PageMasterImportContext.hxx"
+
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::lang;
+using namespace ::xmloff::token;
+
+Reference < XStyle > XMLTextMasterPageContext::Create()
+{
+ Reference < XStyle > xNewStyle;
+
+ Reference< XMultiServiceFactory > xFactory( GetImport().GetModel(),
+ UNO_QUERY );
+ if( xFactory.is() )
+ {
+ Reference < XInterface > xIfc =
+ xFactory->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.style.PageStyle")) );
+ if( xIfc.is() )
+ xNewStyle = Reference < XStyle >( xIfc, UNO_QUERY );
+ }
+
+ return xNewStyle;
+}
+TYPEINIT1( XMLTextMasterPageContext, SvXMLStyleContext );
+
+XMLTextMasterPageContext::XMLTextMasterPageContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx, const OUString& rLName,
+ const Reference< XAttributeList > & xAttrList,
+ sal_Bool bOverwrite )
+: SvXMLStyleContext( rImport, nPrfx, rLName, xAttrList, XML_STYLE_FAMILY_MASTER_PAGE )
+, sIsPhysical( RTL_CONSTASCII_USTRINGPARAM( "IsPhysical" ) )
+, sPageStyleLayout( RTL_CONSTASCII_USTRINGPARAM( "PageStyleLayout" ) )
+, sFollowStyle( RTL_CONSTASCII_USTRINGPARAM( "FollowStyle" ) )
+, bInsertHeader( sal_False )
+, bInsertFooter( sal_False )
+, bInsertHeaderLeft( sal_False )
+, bInsertFooterLeft( sal_False )
+, bHeaderInserted( sal_False )
+, bFooterInserted( sal_False )
+, bHeaderLeftInserted( sal_False )
+, bFooterLeftInserted( sal_False )
+{
+ OUString sName, sDisplayName;
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName );
+ if( XML_NAMESPACE_STYLE == nPrefix )
+ {
+ if( IsXMLToken( aLocalName, XML_NAME ) )
+ {
+ sName = xAttrList->getValueByIndex( i );
+ }
+ else if( IsXMLToken( aLocalName, XML_DISPLAY_NAME ) )
+ {
+ sDisplayName = xAttrList->getValueByIndex( i );
+ }
+ else if( IsXMLToken( aLocalName, XML_NEXT_STYLE_NAME ) )
+ {
+ sFollow = xAttrList->getValueByIndex( i );
+ }
+ else if( IsXMLToken( aLocalName, XML_PAGE_LAYOUT_NAME ) )
+ {
+ sPageMasterName = xAttrList->getValueByIndex( i );
+ }
+ }
+ }
+
+ if( sDisplayName.getLength() )
+ {
+ rImport.AddStyleDisplayName( XML_STYLE_FAMILY_MASTER_PAGE, sName,
+ sDisplayName );
+ }
+ else
+ {
+ sDisplayName = sName;
+ }
+
+ if( 0 == sDisplayName.getLength() )
+ return;
+
+ Reference < XNameContainer > xPageStyles =
+ GetImport().GetTextImport()->GetPageStyles();
+ if( !xPageStyles.is() )
+ return;
+
+ Any aAny;
+ sal_Bool bNew = sal_False;
+ if( xPageStyles->hasByName( sDisplayName ) )
+ {
+ aAny = xPageStyles->getByName( sDisplayName );
+ aAny >>= xStyle;
+ }
+ else
+ {
+ xStyle = Create();
+ if( !xStyle.is() )
+ return;
+
+ aAny <<= xStyle;
+ xPageStyles->insertByName( sDisplayName, aAny );
+ bNew = sal_True;
+ }
+
+ Reference < XPropertySet > xPropSet( xStyle, UNO_QUERY );
+ Reference< XPropertySetInfo > xPropSetInfo =
+ xPropSet->getPropertySetInfo();
+ if( !bNew && xPropSetInfo->hasPropertyByName( sIsPhysical ) )
+ {
+ aAny = xPropSet->getPropertyValue( sIsPhysical );
+ bNew = !*(sal_Bool *)aAny.getValue();
+ }
+ SetNew( bNew );
+
+ if( bOverwrite || bNew )
+ {
+ Reference < XMultiPropertyStates > xMultiStates( xPropSet,
+ UNO_QUERY );
+ OSL_ENSURE( xMultiStates.is(),
+ "text page style does not support multi property set" );
+ if( xMultiStates.is() )
+ xMultiStates->setAllPropertiesToDefault();
+
+ bInsertHeader = bInsertFooter = sal_True;
+ bInsertHeaderLeft = bInsertFooterLeft = sal_True;
+ }
+}
+
+XMLTextMasterPageContext::~XMLTextMasterPageContext()
+{
+}
+
+SvXMLImportContext *XMLTextMasterPageContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference< XAttributeList > & xAttrList )
+{
+ SvXMLImportContext *pContext = 0;
+
+ const SvXMLTokenMap& rTokenMap =
+ GetImport().GetTextImport()->GetTextMasterPageElemTokenMap();
+
+ sal_Bool bInsert = sal_False, bFooter = sal_False, bLeft = sal_False;
+ switch( rTokenMap.Get( nPrefix, rLocalName ) )
+ {
+ case XML_TOK_TEXT_MP_HEADER:
+ if( bInsertHeader && !bHeaderInserted )
+ {
+ bInsert = sal_True;
+ bHeaderInserted = sal_True;
+ }
+ break;
+ case XML_TOK_TEXT_MP_FOOTER:
+ if( bInsertFooter && !bFooterInserted )
+ {
+ bInsert = bFooter = sal_True;
+ bFooterInserted = sal_True;
+ }
+ break;
+ case XML_TOK_TEXT_MP_HEADER_LEFT:
+ if( bInsertHeaderLeft && bHeaderInserted && !bHeaderLeftInserted )
+ bInsert = bLeft = sal_True;
+ break;
+ case XML_TOK_TEXT_MP_FOOTER_LEFT:
+ if( bInsertFooterLeft && bFooterInserted && !bFooterLeftInserted )
+ bInsert = bFooter = bLeft = sal_True;
+ break;
+ }
+
+ if( bInsert && xStyle.is() )
+ {
+ pContext = CreateHeaderFooterContext( nPrefix, rLocalName,
+ xAttrList,
+ bFooter, bLeft );
+ }
+ else
+ {
+ pContext = SvXMLStyleContext::CreateChildContext( nPrefix, rLocalName,
+ xAttrList );
+ }
+
+ return pContext;
+}
+
+SvXMLImportContext *XMLTextMasterPageContext::CreateHeaderFooterContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
+ const sal_Bool bFooter,
+ const sal_Bool bLeft )
+{
+ Reference < XPropertySet > xPropSet( xStyle, UNO_QUERY );
+ return new XMLTextHeaderFooterContext( GetImport(),
+ nPrefix, rLocalName,
+ xAttrList,
+ xPropSet,
+ bFooter, bLeft );
+}
+
+void XMLTextMasterPageContext::Finish( sal_Bool bOverwrite )
+{
+ if( xStyle.is() && (IsNew() || bOverwrite) )
+ {
+ Reference < XPropertySet > xPropSet( xStyle, UNO_QUERY );
+ if( sPageMasterName.getLength() )
+ {
+ XMLPropStyleContext* pStyle =
+ GetImport().GetTextImport()->FindPageMaster( sPageMasterName );
+ if (pStyle)
+ {
+ pStyle->FillPropertySet(xPropSet);
+ }
+ }
+
+ Reference < XNameContainer > xPageStyles =
+ GetImport().GetTextImport()->GetPageStyles();
+ if( !xPageStyles.is() )
+ return;
+
+ Reference< XPropertySetInfo > xPropSetInfo =
+ xPropSet->getPropertySetInfo();
+ if( xPropSetInfo->hasPropertyByName( sFollowStyle ) )
+ {
+ OUString sDisplayFollow(
+ GetImport().GetStyleDisplayName(
+ XML_STYLE_FAMILY_MASTER_PAGE, sFollow ) );
+ if( !sDisplayFollow.getLength() ||
+ !xPageStyles->hasByName( sDisplayFollow ) )
+ sDisplayFollow = xStyle->getName();
+
+ Any aAny = xPropSet->getPropertyValue( sFollowStyle );
+ OUString sCurrFollow;
+ aAny >>= sCurrFollow;
+ if( sCurrFollow != sDisplayFollow )
+ {
+ aAny <<= sDisplayFollow;
+ xPropSet->setPropertyValue( sFollowStyle, aAny );
+ }
+ }
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLTextMasterPageExport.cxx b/xmloff/source/text/XMLTextMasterPageExport.cxx
new file mode 100644
index 000000000000..d02d26a556cc
--- /dev/null
+++ b/xmloff/source/text/XMLTextMasterPageExport.cxx
@@ -0,0 +1,187 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/XMLTextMasterPageExport.hxx>
+
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::beans;
+using namespace ::xmloff::token;
+
+XMLTextMasterPageExport::XMLTextMasterPageExport( SvXMLExport& rExp ) :
+ XMLPageExport( rExp ),
+ sHeaderText( RTL_CONSTASCII_USTRINGPARAM( "HeaderText" ) ),
+ sHeaderOn( RTL_CONSTASCII_USTRINGPARAM( "HeaderIsOn" ) ),
+ sHeaderShareContent( RTL_CONSTASCII_USTRINGPARAM( "HeaderIsShared" ) ),
+ sHeaderTextLeft( RTL_CONSTASCII_USTRINGPARAM( "HeaderTextLeft" ) ),
+ sFooterText( RTL_CONSTASCII_USTRINGPARAM( "FooterText" ) ),
+ sFooterOn( RTL_CONSTASCII_USTRINGPARAM( "FooterIsOn" ) ),
+ sFooterShareContent( RTL_CONSTASCII_USTRINGPARAM( "FooterIsShared" ) ),
+ sFooterTextLeft( RTL_CONSTASCII_USTRINGPARAM( "FooterTextLeft" ) )
+{
+}
+
+XMLTextMasterPageExport::~XMLTextMasterPageExport()
+{
+}
+
+
+void XMLTextMasterPageExport::exportHeaderFooterContent(
+ const Reference< XText >& rText,
+ sal_Bool bAutoStyles, sal_Bool bExportParagraph )
+{
+ DBG_ASSERT( rText.is(), "There is the text" );
+
+ // tracked changes (autostyles + changes list)
+ GetExport().GetTextParagraphExport()->recordTrackedChangesForXText(rText);
+ GetExport().GetTextParagraphExport()->exportTrackedChanges(rText,
+ bAutoStyles);
+ if( bAutoStyles )
+ GetExport().GetTextParagraphExport()
+ ->collectTextAutoStyles( rText, sal_True, bExportParagraph );
+ else
+ {
+ GetExport().GetTextParagraphExport()->exportTextDeclarations( rText );
+ GetExport().GetTextParagraphExport()->exportText( rText, sal_True, bExportParagraph );
+ }
+
+ // tracked changes (end of XText)
+ GetExport().GetTextParagraphExport()->recordTrackedChangesNoXText();
+}
+
+void XMLTextMasterPageExport::exportMasterPageContent(
+ const Reference < XPropertySet > & rPropSet,
+ sal_Bool bAutoStyles )
+{
+ Any aAny;
+
+ Reference < XText > xHeaderText;
+ aAny = rPropSet->getPropertyValue( sHeaderText );
+ aAny >>= xHeaderText;
+
+ Reference < XText > xHeaderTextLeft;
+ aAny = rPropSet->getPropertyValue( sHeaderTextLeft );
+ aAny >>= xHeaderTextLeft;
+
+ Reference < XText > xFooterText;
+ aAny = rPropSet->getPropertyValue( sFooterText );
+ aAny >>= xFooterText;
+
+ Reference < XText > xFooterTextLeft;
+ aAny = rPropSet->getPropertyValue( sFooterTextLeft );
+ aAny >>= xFooterTextLeft;
+
+ if( bAutoStyles )
+ {
+ if( xHeaderText.is() )
+ exportHeaderFooterContent( xHeaderText, sal_True );
+ if( xHeaderTextLeft.is() && xHeaderTextLeft != xHeaderText )
+ exportHeaderFooterContent( xHeaderTextLeft, sal_True );
+ if( xFooterText.is() )
+ exportHeaderFooterContent( xFooterText, sal_True );
+ if( xFooterTextLeft.is() && xFooterTextLeft != xFooterText )
+ exportHeaderFooterContent( xFooterTextLeft, sal_True );
+ }
+ else
+ {
+ aAny = rPropSet->getPropertyValue( sHeaderOn );
+ sal_Bool bHeader = *(sal_Bool *)aAny.getValue();
+
+ sal_Bool bHeaderLeft = sal_False;
+ if( bHeader )
+ {
+ aAny = rPropSet->getPropertyValue( sHeaderShareContent );
+ bHeaderLeft = !*(sal_Bool *)aAny.getValue();
+ }
+
+ if( xHeaderText.is() )
+ {
+ if( !bHeader )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE,
+ XML_DISPLAY, XML_FALSE );
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_STYLE,
+ XML_HEADER, sal_True, sal_True );
+ exportHeaderFooterContent( xHeaderText, sal_False );
+ }
+
+ if( xHeaderTextLeft.is() && xHeaderTextLeft != xHeaderText )
+ {
+ if( !bHeaderLeft )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE,
+ XML_DISPLAY, XML_FALSE );
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_STYLE,
+ XML_HEADER_LEFT, sal_True, sal_True );
+ exportHeaderFooterContent( xHeaderTextLeft, sal_False );
+ }
+
+ aAny = rPropSet->getPropertyValue( sFooterOn );
+ sal_Bool bFooter = *(sal_Bool *)aAny.getValue();
+
+ sal_Bool bFooterLeft = sal_False;
+ if( bFooter )
+ {
+ aAny = rPropSet->getPropertyValue( sFooterShareContent );
+ bFooterLeft = !*(sal_Bool *)aAny.getValue();
+ }
+
+ if( xFooterText.is() )
+ {
+ if( !bFooter )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE,
+ XML_DISPLAY, XML_FALSE );
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_STYLE,
+ XML_FOOTER, sal_True, sal_True );
+ exportHeaderFooterContent( xFooterText, sal_False );
+ }
+
+ if( xFooterTextLeft.is() && xFooterTextLeft != xFooterText )
+ {
+ if( !bFooterLeft )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE,
+ XML_DISPLAY, XML_FALSE );
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_STYLE,
+ XML_FOOTER_LEFT, sal_True, sal_True );
+ exportHeaderFooterContent( xFooterTextLeft, sal_False );
+ }
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLTextMasterStylesContext.cxx b/xmloff/source/text/XMLTextMasterStylesContext.cxx
new file mode 100644
index 000000000000..f6d211a358e1
--- /dev/null
+++ b/xmloff/source/text/XMLTextMasterStylesContext.cxx
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+
+
+#include <xmloff/xmlimp.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/nmspmap.hxx>
+
+#include <xmloff/XMLTextMasterPageContext.hxx>
+#include <xmloff/XMLTextMasterStylesContext.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+
+using ::xmloff::token::IsXMLToken;
+using ::xmloff::token::XML_MASTER_PAGE;
+
+// ------------------------------------------------------------------------
+
+TYPEINIT1( XMLTextMasterStylesContext, SvXMLStylesContext );
+
+sal_Bool XMLTextMasterStylesContext::InsertStyleFamily( sal_uInt16 ) const
+{
+ return sal_True;
+}
+
+XMLTextMasterStylesContext::XMLTextMasterStylesContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx, const OUString& rLName,
+ const Reference< XAttributeList > & xAttrList ) :
+ SvXMLStylesContext( rImport, nPrfx, rLName, xAttrList )
+{
+}
+
+XMLTextMasterStylesContext::~XMLTextMasterStylesContext()
+{
+}
+
+SvXMLStyleContext *XMLTextMasterStylesContext::CreateStyleChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference< XAttributeList > & xAttrList )
+{
+ SvXMLStyleContext *pContext = 0;
+
+ if( XML_NAMESPACE_STYLE == nPrefix &&
+ IsXMLToken( rLocalName, XML_MASTER_PAGE ) &&
+ InsertStyleFamily( XML_STYLE_FAMILY_MASTER_PAGE ) )
+ pContext = new XMLTextMasterPageContext(
+ GetImport(), nPrefix, rLocalName,
+ xAttrList,
+ !GetImport().GetTextImport()->IsInsertMode() );
+
+ // any other style will be ignored here!
+
+ return pContext;
+}
+
+SvXMLStyleContext *XMLTextMasterStylesContext::CreateStyleStyleChildContext(
+ sal_uInt16 /*nFamily*/,
+ sal_uInt16 /*nPrefix*/,
+ const OUString& /*rLocalName*/,
+ const Reference< XAttributeList > & /*xAttrList*/ )
+{
+ return 0;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLTextNumRuleInfo.cxx b/xmloff/source/text/XMLTextNumRuleInfo.cxx
new file mode 100644
index 000000000000..f9e0912b9b79
--- /dev/null
+++ b/xmloff/source/text/XMLTextNumRuleInfo.cxx
@@ -0,0 +1,248 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <tools/debug.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/container/XIndexReplace.hpp>
+#include <com/sun/star/style/NumberingType.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include "XMLTextNumRuleInfo.hxx"
+#include "xmloff/XMLTextListAutoStylePool.hxx"
+
+using ::rtl::OUString;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::style;
+
+// Complete refactoring of the class and enhancement of the class for lists.
+XMLTextNumRuleInfo::XMLTextNumRuleInfo()
+ : msNumberingRules(RTL_CONSTASCII_USTRINGPARAM("NumberingRules"))
+ , msNumberingLevel(RTL_CONSTASCII_USTRINGPARAM("NumberingLevel"))
+ , msNumberingStartValue(RTL_CONSTASCII_USTRINGPARAM("NumberingStartValue"))
+ , msParaIsNumberingRestart(RTL_CONSTASCII_USTRINGPARAM("ParaIsNumberingRestart"))
+ , msNumberingIsNumber(RTL_CONSTASCII_USTRINGPARAM("NumberingIsNumber"))
+ , msNumberingIsOutline(RTL_CONSTASCII_USTRINGPARAM("NumberingIsOutline"))
+ , msPropNameListId(RTL_CONSTASCII_USTRINGPARAM("ListId"))
+ , msPropNameStartWith(RTL_CONSTASCII_USTRINGPARAM("StartWith"))
+ , msContinueingPreviousSubTree(RTL_CONSTASCII_USTRINGPARAM("ContinueingPreviousSubTree"))
+ , msListLabelStringProp(RTL_CONSTASCII_USTRINGPARAM("ListLabelString"))
+ , mxNumRules()
+ , msNumRulesName()
+ , msListId()
+ , mnListStartValue( -1 )
+ , mnListLevel( 0 )
+ , mbIsNumbered( sal_False )
+ , mbIsRestart( sal_False )
+ , mnListLevelStartValue( -1 )
+ , mbOutlineStyleAsNormalListStyle( sal_False )
+{
+ Reset();
+}
+
+// Written OpenDocument file format doesn't fit to the created text document (#i69627#)
+void XMLTextNumRuleInfo::Set(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextContent > & xTextContent,
+ const sal_Bool bOutlineStyleAsNormalListStyle,
+ const XMLTextListAutoStylePool& rListAutoPool,
+ const sal_Bool bExportTextNumberElement )
+{
+ Reset();
+ // Written OpenDocument file format doesn't fit to the created text document (#i69627#)
+ mbOutlineStyleAsNormalListStyle = bOutlineStyleAsNormalListStyle;
+
+ Reference< XPropertySet > xPropSet( xTextContent, UNO_QUERY );
+ Reference< XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
+
+ // check if this paragraph supports a numbering
+ if( !xPropSetInfo->hasPropertyByName( msNumberingLevel ) )
+ return;
+
+ if( xPropSet->getPropertyValue( msNumberingLevel ) >>= mnListLevel )
+ {
+ if( xPropSetInfo->hasPropertyByName( msNumberingRules ) )
+ {
+ xPropSet->getPropertyValue( msNumberingRules ) >>= mxNumRules;
+ }
+ }
+ else
+ {
+ // in applications using the outliner we always have a numbering rule,
+ // so a void property no numbering
+ mnListLevel = 0;
+ }
+
+ // Assertion saving writer document (#i97312#)
+ if ( mxNumRules.is() && mxNumRules->getCount() < 1 )
+ {
+ DBG_ASSERT( false,
+ "<XMLTextNumRuleInfo::Set(..)> - numbering rules instance does not contain any numbering rule" );
+ Reset();
+ return;
+ }
+
+ if ( mnListLevel < 0 )
+ {
+ DBG_ASSERT( false,
+ "<XMLTextNumRuleInfo::Set(..)> - unexpected numbering level" );
+ Reset();
+ return;
+ }
+
+ // Written OpenDocument file format doesn't fit to the created text document (#i69627#)
+ bool bSuppressListStyle( false );
+ if ( mxNumRules.is() )
+ {
+ if ( !mbOutlineStyleAsNormalListStyle )
+ {
+ sal_Bool bIsOutline = sal_False;
+ Reference<XPropertySet> xNumRulesProps(mxNumRules, UNO_QUERY);
+ if ( xNumRulesProps.is() &&
+ xNumRulesProps->getPropertySetInfo()->
+ hasPropertyByName( msNumberingIsOutline ) )
+ {
+ xNumRulesProps->getPropertyValue( msNumberingIsOutline ) >>= bIsOutline;
+ bSuppressListStyle = bIsOutline ? true : false;
+ }
+ }
+ }
+
+ if( mxNumRules.is() && !bSuppressListStyle )
+ {
+ // First try to find the numbering rules in the list auto style pool.
+ // If not found, the numbering rules instance has to be named.
+ msNumRulesName = rListAutoPool.Find( mxNumRules );
+ if ( msNumRulesName.getLength() == 0 )
+ {
+ Reference < XNamed > xNamed( mxNumRules, UNO_QUERY );
+ DBG_ASSERT( xNamed.is(),
+ "<XMLTextNumRuleInfo::Set(..)> - numbering rules instance have to be named. Serious defect -> please inform OD." );
+ if( xNamed.is() )
+ {
+ msNumRulesName = xNamed->getName();
+ }
+ }
+ DBG_ASSERT( msNumRulesName.getLength() > 0,
+ "<XMLTextNumRuleInfo::Set(..)> - no name found for numbering rules instance. Serious defect -> please inform OD." );
+
+ if( xPropSetInfo->hasPropertyByName( msPropNameListId ) )
+ {
+ xPropSet->getPropertyValue( msPropNameListId ) >>= msListId;
+ }
+
+ mbContinueingPreviousSubTree = sal_False;
+ if( xPropSetInfo->hasPropertyByName( msContinueingPreviousSubTree ) )
+ {
+ xPropSet->getPropertyValue( msContinueingPreviousSubTree ) >>= mbContinueingPreviousSubTree;
+ }
+
+ mbIsNumbered = sal_True;
+ if( xPropSetInfo->hasPropertyByName( msNumberingIsNumber ) )
+ {
+ if( !(xPropSet->getPropertyValue( msNumberingIsNumber ) >>= mbIsNumbered ) )
+ {
+ OSL_FAIL( "numbered paragraph without number info" );
+ mbIsNumbered = sal_False;
+ }
+ }
+
+ if( mbIsNumbered )
+ {
+ if( xPropSetInfo->hasPropertyByName( msParaIsNumberingRestart ) )
+ {
+ xPropSet->getPropertyValue( msParaIsNumberingRestart ) >>= mbIsRestart;
+ }
+ if( xPropSetInfo->hasPropertyByName( msNumberingStartValue ) )
+ {
+ xPropSet->getPropertyValue( msNumberingStartValue ) >>= mnListStartValue;
+ }
+ }
+
+ OSL_ENSURE( mnListLevel < mxNumRules->getCount(), "wrong num rule level" );
+ if( mnListLevel >= mxNumRules->getCount() )
+ {
+ Reset();
+ return;
+ }
+
+ Sequence<PropertyValue> aProps;
+ mxNumRules->getByIndex( mnListLevel ) >>= aProps;
+
+ const PropertyValue* pPropArray = aProps.getConstArray();
+ sal_Int32 nCount = aProps.getLength();
+ for( sal_Int32 i=0; i<nCount; i++ )
+ {
+ const PropertyValue& rProp = pPropArray[i];
+
+ if ( rProp.Name == msPropNameStartWith )
+ {
+ rProp.Value >>= mnListLevelStartValue;
+ break;
+ }
+ }
+
+ msListLabelString = ::rtl::OUString();
+ if ( bExportTextNumberElement &&
+ xPropSetInfo->hasPropertyByName( msListLabelStringProp ) )
+ {
+ xPropSet->getPropertyValue( msListLabelStringProp ) >>= msListLabelString;
+ }
+
+ // paragraph's list level range is [0..9] representing list levels [1..10]
+ ++mnListLevel;
+ }
+ else
+ {
+ mnListLevel = 0;
+ }
+}
+
+sal_Bool XMLTextNumRuleInfo::BelongsToSameList( const XMLTextNumRuleInfo& rCmp ) const
+{
+ sal_Bool bRet( sal_True );
+ // Currently only the text documents support <ListId>.
+ if ( rCmp.msListId.getLength() > 0 ||
+ msListId.getLength() > 0 )
+ {
+ bRet = rCmp.msListId == msListId;
+ }
+ else
+ {
+ bRet = HasSameNumRules( rCmp );
+ }
+
+ return bRet;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLTextNumRuleInfo.hxx b/xmloff/source/text/XMLTextNumRuleInfo.hxx
new file mode 100644
index 000000000000..d03370eb6feb
--- /dev/null
+++ b/xmloff/source/text/XMLTextNumRuleInfo.hxx
@@ -0,0 +1,187 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLTEXTNUMRULEINFO_HXX
+#define _XMLOFF_XMLTEXTNUMRULEINFO_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/container/XIndexReplace.hpp>
+
+namespace com { namespace sun { namespace star {
+ namespace text { class XTextContent; }
+} } }
+#include <sal/types.h>
+
+class XMLTextListAutoStylePool;
+
+/** information about list and list style for a certain paragraph
+
+ OD 2008-04-24 #refactorlists#
+ Complete refactoring of the class and enhancement of the class for lists.
+ These changes are considered by method <XMLTextParagraphExport::exportListChange(..)>
+*/
+class XMLTextNumRuleInfo
+{
+ const ::rtl::OUString msNumberingRules;
+ const ::rtl::OUString msNumberingLevel;
+ const ::rtl::OUString msNumberingStartValue;
+ const ::rtl::OUString msParaIsNumberingRestart;
+ const ::rtl::OUString msNumberingIsNumber;
+ const ::rtl::OUString msNumberingIsOutline;
+ const ::rtl::OUString msPropNameListId;
+ const ::rtl::OUString msPropNameStartWith;
+ const ::rtl::OUString msContinueingPreviousSubTree;
+ const ::rtl::OUString msListLabelStringProp;
+
+ // numbering rules instance and its name
+ ::com::sun::star::uno::Reference <
+ ::com::sun::star::container::XIndexReplace > mxNumRules;
+ ::rtl::OUString msNumRulesName;
+
+ // paragraph's list attributes
+ ::rtl::OUString msListId;
+ sal_Int16 mnListStartValue;
+ sal_Int16 mnListLevel;
+ sal_Bool mbIsNumbered;
+ sal_Bool mbIsRestart;
+
+ // numbering rules' attributes
+ sal_Int16 mnListLevelStartValue;
+
+ // Written OpenDocument file format doesn't fit to the created text document (#i69627#)
+ sal_Bool mbOutlineStyleAsNormalListStyle;
+
+ sal_Bool mbContinueingPreviousSubTree;
+ ::rtl::OUString msListLabelString;
+
+public:
+
+ XMLTextNumRuleInfo();
+
+ inline XMLTextNumRuleInfo& operator=( const XMLTextNumRuleInfo& rInfo );
+
+ void Set( const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextContent > & rTextContnt,
+ const sal_Bool bOutlineStyleAsNormalListStyle,
+ const XMLTextListAutoStylePool& rListAutoPool,
+ const sal_Bool bExportTextNumberElement );
+ inline void Reset();
+
+ inline const ::rtl::OUString& GetNumRulesName() const
+ {
+ return msNumRulesName;
+ }
+ inline const ::com::sun::star::uno::Reference <
+ ::com::sun::star::container::XIndexReplace >& GetNumRules() const
+ {
+ return mxNumRules;
+ }
+ inline sal_Int16 GetListLevelStartValue() const
+ {
+ return mnListLevelStartValue;
+ }
+
+ inline const ::rtl::OUString& GetListId() const
+ {
+ return msListId;
+ }
+
+ inline sal_Int16 GetLevel() const
+ {
+ return mnListLevel;
+ }
+
+ inline sal_Bool HasStartValue() const
+ {
+ return mnListStartValue != -1;
+ }
+ inline sal_uInt32 GetStartValue() const
+ {
+ return mnListStartValue;
+ }
+
+ inline sal_Bool IsNumbered() const
+ {
+ return mbIsNumbered;
+ }
+ inline sal_Bool IsRestart() const
+ {
+ return mbIsRestart;
+ }
+
+ sal_Bool BelongsToSameList( const XMLTextNumRuleInfo& rCmp ) const;
+
+ inline sal_Bool HasSameNumRules( const XMLTextNumRuleInfo& rCmp ) const
+ {
+ return rCmp.msNumRulesName == msNumRulesName;
+ }
+
+ inline sal_Bool IsContinueingPreviousSubTree() const
+ {
+ return mbContinueingPreviousSubTree;
+ }
+ inline const ::rtl::OUString& ListLabelString() const
+ {
+ return msListLabelString;
+ }
+};
+
+inline XMLTextNumRuleInfo& XMLTextNumRuleInfo::operator=(
+ const XMLTextNumRuleInfo& rInfo )
+{
+ msNumRulesName = rInfo.msNumRulesName;
+ mxNumRules = rInfo.mxNumRules;
+ msListId = rInfo.msListId;
+ mnListStartValue = rInfo.mnListStartValue;
+ mnListLevel = rInfo.mnListLevel;
+ mbIsNumbered = rInfo.mbIsNumbered;
+ mbIsRestart = rInfo.mbIsRestart;
+ // Written OpenDocument file format doesn't fit to the created text document (#i69627#)
+ mbOutlineStyleAsNormalListStyle = rInfo.mbOutlineStyleAsNormalListStyle;
+ mbContinueingPreviousSubTree = rInfo.mbContinueingPreviousSubTree;
+ msListLabelString = rInfo.msListLabelString;
+
+ return *this;
+}
+
+inline void XMLTextNumRuleInfo::Reset()
+{
+ mxNumRules = 0;
+ msNumRulesName = ::rtl::OUString();
+ msListId = ::rtl::OUString();
+ mnListStartValue = -1;
+ mnListLevel = 0;
+ // Written OpenDocument file format doesn't fit to the created text document (#i69627#)
+ mbIsNumbered = mbIsRestart =
+ mbOutlineStyleAsNormalListStyle = sal_False;
+ mbContinueingPreviousSubTree = sal_False;
+ msListLabelString = ::rtl::OUString();
+}
+#endif // _XMLOFF_XMLTEXTNUMRULEINFO_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLTextPropertySetContext.cxx b/xmloff/source/text/XMLTextPropertySetContext.cxx
new file mode 100644
index 000000000000..555d7b688745
--- /dev/null
+++ b/xmloff/source/text/XMLTextPropertySetContext.cxx
@@ -0,0 +1,149 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#include "XMLTextPropertySetContext.hxx"
+#include "XMLTextColumnsContext.hxx"
+#include "XMLBackgroundImageContext.hxx"
+#include "XMLSectionFootnoteConfigImport.hxx"
+
+#include <xmloff/txtprmap.hxx>
+#include "xmltabi.hxx"
+#include "txtdropi.hxx"
+
+using ::rtl::OUString;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star;
+
+XMLTextPropertySetContext::XMLTextPropertySetContext(
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const Reference< xml::sax::XAttributeList > & xAttrList,
+ sal_uInt32 nFamily,
+ ::std::vector< XMLPropertyState > &rProps,
+ const UniReference < SvXMLImportPropertyMapper > &rMap,
+ OUString& rDCTextStyleName ) :
+ SvXMLPropertySetContext( rImport, nPrfx, rLName, xAttrList, nFamily,
+ rProps, rMap ),
+ rDropCapTextStyleName( rDCTextStyleName )
+{
+}
+
+XMLTextPropertySetContext::~XMLTextPropertySetContext()
+{
+}
+
+SvXMLImportContext *XMLTextPropertySetContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference< xml::sax::XAttributeList > & xAttrList,
+ ::std::vector< XMLPropertyState > &rProperties,
+ const XMLPropertyState& rProp )
+{
+ SvXMLImportContext *pContext = 0;
+
+ switch( mxMapper->getPropertySetMapper()
+ ->GetEntryContextId( rProp.mnIndex ) )
+ {
+ case CTF_TABSTOP:
+ pContext = new SvxXMLTabStopImportContext( GetImport(), nPrefix,
+ rLocalName, rProp,
+ rProperties );
+ break;
+ case CTF_TEXTCOLUMNS:
+ pContext = new XMLTextColumnsContext( GetImport(), nPrefix,
+ rLocalName, xAttrList, rProp,
+ rProperties );
+ break;
+
+ case CTF_DROPCAPFORMAT:
+ {
+ DBG_ASSERT( rProp.mnIndex >= 2 &&
+ CTF_DROPCAPWHOLEWORD == mxMapper->getPropertySetMapper()
+ ->GetEntryContextId( rProp.mnIndex-2 ),
+ "invalid property map!");
+ XMLTextDropCapImportContext *pDCContext =
+ new XMLTextDropCapImportContext( GetImport(), nPrefix,
+ rLocalName, xAttrList,
+ rProp,
+ rProp.mnIndex-2,
+ rProperties );
+ rDropCapTextStyleName = pDCContext->GetStyleName();
+ pContext = pDCContext;
+ }
+ break;
+
+ case CTF_BACKGROUND_URL:
+ {
+ DBG_ASSERT( rProp.mnIndex >= 2 &&
+ CTF_BACKGROUND_POS == mxMapper->getPropertySetMapper()
+ ->GetEntryContextId( rProp.mnIndex-2 ) &&
+ CTF_BACKGROUND_FILTER == mxMapper->getPropertySetMapper()
+ ->GetEntryContextId( rProp.mnIndex-1 ),
+ "invalid property map!");
+
+ // #99657# Transparency might be there as well... but doesn't have
+ // to. Thus, this is checked with an if, rather than with an assertion.
+ sal_Int32 nTranspIndex = -1;
+ if( (rProp.mnIndex >= 3) &&
+ ( CTF_BACKGROUND_TRANSPARENCY ==
+ mxMapper->getPropertySetMapper()->GetEntryContextId(
+ rProp.mnIndex-3 ) ) )
+ nTranspIndex = rProp.mnIndex-3;
+
+ pContext =
+ new XMLBackgroundImageContext( GetImport(), nPrefix,
+ rLocalName, xAttrList,
+ rProp,
+ rProp.mnIndex-2,
+ rProp.mnIndex-1,
+ nTranspIndex,
+ rProperties );
+ }
+ break;
+ case CTF_SECTION_FOOTNOTE_END:
+ case CTF_SECTION_ENDNOTE_END:
+ pContext = new XMLSectionFootnoteConfigImport(
+ GetImport(), nPrefix, rLocalName, rProperties,
+ mxMapper->getPropertySetMapper());
+ break;
+ }
+
+ if( !pContext )
+ pContext = SvXMLPropertySetContext::CreateChildContext( nPrefix, rLocalName,
+ xAttrList,
+ rProperties, rProp );
+
+ return pContext;
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLTextPropertySetContext.hxx b/xmloff/source/text/XMLTextPropertySetContext.hxx
new file mode 100644
index 000000000000..dd945491be68
--- /dev/null
+++ b/xmloff/source/text/XMLTextPropertySetContext.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLTEXTPROPERTYSETCONTEXT_HXX
+#define _XMLOFF_XMLTEXTPROPERTYSETCONTEXT_HXX
+
+#include <xmloff/xmlprcon.hxx>
+
+
+class XMLTextPropertySetContext : public SvXMLPropertySetContext
+{
+// SvXMLImportContextRef xTabStop;
+// SvXMLImportContextRef xBackground;
+// SvXMLImportContextRef xDropCap;
+ ::rtl::OUString& rDropCapTextStyleName;
+
+public:
+ XMLTextPropertySetContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList >& xAttrList,
+ sal_uInt32 nFamily,
+ ::std::vector< XMLPropertyState > &rProps,
+ const UniReference < SvXMLImportPropertyMapper > &rMap,
+ ::rtl::OUString& rDopCapTextStyleName );
+
+ virtual ~XMLTextPropertySetContext();
+
+ using SvXMLPropertySetContext::CreateChildContext;
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList,
+ ::std::vector< XMLPropertyState > &rProperties,
+ const XMLPropertyState& rProp);
+};
+
+
+#endif // _XMLOFF_XMLTEXTPROPERTYSETCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLTextShapeImportHelper.cxx b/xmloff/source/text/XMLTextShapeImportHelper.cxx
new file mode 100644
index 000000000000..21689e5fc8c2
--- /dev/null
+++ b/xmloff/source/text/XMLTextShapeImportHelper.cxx
@@ -0,0 +1,165 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/text/XTextContent.hpp>
+#include <com/sun/star/text/TextContentAnchorType.hpp>
+
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/txtimp.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "XMLAnchorTypePropHdl.hxx"
+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include "xmloff/XMLTextShapeImportHelper.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::xml::sax;
+
+XMLTextShapeImportHelper::XMLTextShapeImportHelper(
+ SvXMLImport& rImp ) :
+ XMLShapeImportHelper( rImp, rImp.GetModel(),
+ XMLTextImportHelper::CreateShapeExtPropMapper(rImp) ),
+ rImport( rImp ),
+ sAnchorType(RTL_CONSTASCII_USTRINGPARAM("AnchorType")),
+ sAnchorPageNo(RTL_CONSTASCII_USTRINGPARAM("AnchorPageNo")),
+ sVertOrientPosition(RTL_CONSTASCII_USTRINGPARAM("VertOrientPosition"))
+{
+ Reference < XDrawPageSupplier > xDPS( rImp.GetModel(), UNO_QUERY );
+ if( xDPS.is() )
+ {
+ Reference < XShapes > xShapes( xDPS->getDrawPage(), UNO_QUERY );
+ pushGroupForSorting( xShapes );
+ }
+
+}
+
+XMLTextShapeImportHelper::~XMLTextShapeImportHelper()
+{
+ popGroupAndSort();
+}
+
+void XMLTextShapeImportHelper::addShape(
+ Reference< XShape >& rShape,
+ const Reference< XAttributeList >& xAttrList,
+ Reference< XShapes >& rShapes )
+{
+ if( rShapes.is() )
+ {
+ // It's a group shape or 3DScene , so we have to call the base class method.
+ XMLShapeImportHelper::addShape( rShape, xAttrList, rShapes );
+ return;
+ }
+
+ TextContentAnchorType eAnchorType = TextContentAnchorType_AT_PARAGRAPH;
+ sal_Int16 nPage = 0;
+ sal_Int32 nY = 0;
+
+ UniReference < XMLTextImportHelper > xTxtImport =
+ rImport.GetTextImport();
+ const SvXMLTokenMap& rTokenMap =
+ xTxtImport->GetTextFrameAttrTokenMap();
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ const OUString& rValue = xAttrList->getValueByIndex( i );
+
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ rImport.GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ switch( rTokenMap.Get( nPrefix, aLocalName ) )
+ {
+ case XML_TOK_TEXT_FRAME_ANCHOR_TYPE:
+ {
+ TextContentAnchorType eNew;
+ // OD 2004-06-01 #i26791# - allow all anchor types
+ if ( XMLAnchorTypePropHdl::convert( rValue, eNew ) )
+ {
+ eAnchorType = eNew;
+ }
+ }
+ break;
+ case XML_TOK_TEXT_FRAME_ANCHOR_PAGE_NUMBER:
+ {
+ sal_Int32 nTmp;
+ if( rImport.GetMM100UnitConverter().
+ convertNumber( nTmp, rValue, 1, SHRT_MAX ) )
+ nPage = (sal_Int16)nTmp;
+ }
+ break;
+ case XML_TOK_TEXT_FRAME_Y:
+ rImport.GetMM100UnitConverter().convertMeasure( nY, rValue );
+ break;
+ }
+ }
+
+ Reference < XPropertySet > xPropSet( rShape, UNO_QUERY );
+ Any aAny;
+
+ // anchor type
+ aAny <<= eAnchorType;
+ xPropSet->setPropertyValue( sAnchorType, aAny );
+
+ Reference < XTextContent > xTxtCntnt( rShape, UNO_QUERY );
+ xTxtImport->InsertTextContent( xTxtCntnt );
+
+ // page number (must be set after the frame is inserted, because it
+ // will be overwritten then inserting the frame.
+ switch( eAnchorType )
+ {
+ case TextContentAnchorType_AT_PAGE:
+ // only set positive page numbers
+ if ( nPage > 0 )
+ {
+ aAny <<= nPage;
+ xPropSet->setPropertyValue( sAnchorPageNo, aAny );
+ }
+ break;
+ case TextContentAnchorType_AS_CHARACTER:
+ aAny <<= nY;
+ xPropSet->setPropertyValue( sVertOrientPosition, aAny );
+ break;
+ default:
+ break;
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLTextShapeStyleContext.cxx b/xmloff/source/text/XMLTextShapeStyleContext.cxx
new file mode 100644
index 000000000000..b7dd2d132c00
--- /dev/null
+++ b/xmloff/source/text/XMLTextShapeStyleContext.cxx
@@ -0,0 +1,252 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include "XMLTextPropertySetContext.hxx"
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/XMLEventsImportContext.hxx>
+#include "XMLShapePropertySetContext.hxx"
+#include "XMLTextColumnsContext.hxx"
+#include "XMLBackgroundImageContext.hxx"
+#include <xmloff/txtprmap.hxx>
+
+#include <xmloff/XMLTextShapeStyleContext.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star::document;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::beans;
+using namespace ::xmloff::token;
+
+class XMLTextShapePropertySetContext_Impl : public XMLShapePropertySetContext
+{
+public:
+ XMLTextShapePropertySetContext_Impl( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const Reference< XAttributeList >& xAttrList,
+ sal_uInt32 nFamily,
+ ::std::vector< XMLPropertyState > &rProps,
+ const UniReference < SvXMLImportPropertyMapper > &rMap );
+
+ virtual ~XMLTextShapePropertySetContext_Impl();
+
+ using SvXMLPropertySetContext::CreateChildContext;
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference< XAttributeList >& xAttrList,
+ ::std::vector< XMLPropertyState > &rProperties,
+ const XMLPropertyState& rProp);
+};
+
+XMLTextShapePropertySetContext_Impl::XMLTextShapePropertySetContext_Impl(
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const Reference< XAttributeList > & xAttrList,
+ sal_uInt32 nFamily,
+ ::std::vector< XMLPropertyState > &rProps,
+ const UniReference < SvXMLImportPropertyMapper > &rMap ) :
+ XMLShapePropertySetContext( rImport, nPrfx, rLName, xAttrList, nFamily,
+ rProps, rMap )
+{
+}
+
+XMLTextShapePropertySetContext_Impl::~XMLTextShapePropertySetContext_Impl()
+{
+}
+
+SvXMLImportContext *XMLTextShapePropertySetContext_Impl::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference< XAttributeList > & xAttrList,
+ ::std::vector< XMLPropertyState > &rProperties,
+ const XMLPropertyState& rProp )
+{
+ SvXMLImportContext *pContext = 0;
+
+ switch( mxMapper->getPropertySetMapper()
+ ->GetEntryContextId( rProp.mnIndex ) )
+ {
+ case CTF_TEXTCOLUMNS:
+ pContext = new XMLTextColumnsContext( GetImport(), nPrefix,
+ rLocalName, xAttrList, rProp,
+ rProperties );
+ break;
+
+ case CTF_BACKGROUND_URL:
+ DBG_ASSERT( rProp.mnIndex >= 3 &&
+ CTF_BACKGROUND_TRANSPARENCY ==
+ mxMapper->getPropertySetMapper()
+ ->GetEntryContextId( rProp.mnIndex-3 ) &&
+ CTF_BACKGROUND_POS == mxMapper->getPropertySetMapper()
+ ->GetEntryContextId( rProp.mnIndex-2 ) &&
+ CTF_BACKGROUND_FILTER == mxMapper->getPropertySetMapper()
+ ->GetEntryContextId( rProp.mnIndex-1 ),
+ "invalid property map!");
+ pContext =
+ new XMLBackgroundImageContext( GetImport(), nPrefix,
+ rLocalName, xAttrList,
+ rProp,
+ rProp.mnIndex-2,
+ rProp.mnIndex-1,
+ rProp.mnIndex-3,
+ rProperties );
+ break;
+ }
+
+ if( !pContext )
+ pContext = XMLShapePropertySetContext::CreateChildContext(
+ nPrefix, rLocalName, xAttrList, rProperties, rProp );
+
+ return pContext;
+}
+
+//-----------------------------------------------------------------------------
+
+void XMLTextShapeStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
+ const OUString& rLocalName,
+ const OUString& rValue )
+{
+ if( XML_NAMESPACE_STYLE == nPrefixKey &&
+ IsXMLToken( rLocalName, XML_AUTO_UPDATE ) )
+ {
+ if( IsXMLToken( rValue, XML_TRUE ) )
+ bAutoUpdate = sal_True;
+ }
+ else
+ {
+ XMLShapeStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
+ }
+}
+
+TYPEINIT1( XMLTextShapeStyleContext, XMLShapeStyleContext );
+
+XMLTextShapeStyleContext::XMLTextShapeStyleContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx, const OUString& rLName,
+ const Reference< XAttributeList > & xAttrList,
+ SvXMLStylesContext& rStyles, sal_uInt16 nFamily,
+ sal_Bool /*bDefaultStyle*/ ) :
+ XMLShapeStyleContext( rImport, nPrfx, rLName, xAttrList, rStyles,
+ nFamily ),
+ sIsAutoUpdate( RTL_CONSTASCII_USTRINGPARAM( "IsAutoUpdate" ) ),
+ bAutoUpdate( sal_False )
+{
+}
+
+XMLTextShapeStyleContext::~XMLTextShapeStyleContext()
+{
+}
+
+SvXMLImportContext *XMLTextShapeStyleContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference< XAttributeList > & xAttrList )
+{
+ SvXMLImportContext *pContext = 0;
+
+ if( XML_NAMESPACE_STYLE == nPrefix )
+ {
+ sal_uInt32 nFamily = 0;
+ if( IsXMLToken( rLocalName, XML_TEXT_PROPERTIES ) )
+ nFamily = XML_TYPE_PROP_TEXT;
+ else if( IsXMLToken( rLocalName, XML_PARAGRAPH_PROPERTIES ) )
+ nFamily = XML_TYPE_PROP_PARAGRAPH;
+ else if( IsXMLToken( rLocalName, XML_GRAPHIC_PROPERTIES ) )
+ nFamily = XML_TYPE_PROP_GRAPHIC;
+ if( nFamily )
+ {
+ UniReference < SvXMLImportPropertyMapper > xImpPrMap =
+ GetStyles()->GetImportPropertyMapper( GetFamily() );
+ if( xImpPrMap.is() )
+ {
+ pContext = new XMLTextShapePropertySetContext_Impl(
+ GetImport(), nPrefix, rLocalName, xAttrList, nFamily,
+ GetProperties(), xImpPrMap );
+ }
+ }
+ }
+ else if ( (XML_NAMESPACE_OFFICE == nPrefix) &&
+ IsXMLToken( rLocalName, XML_EVENT_LISTENERS ) )
+ {
+ // create and remember events import context
+ // (for delayed processing of events)
+ pContext = new XMLEventsImportContext( GetImport(), nPrefix,
+ rLocalName);
+ xEventContext = pContext;
+ }
+
+ if( !pContext )
+ pContext = XMLShapeStyleContext::CreateChildContext( nPrefix, rLocalName,
+ xAttrList );
+
+ return pContext;
+}
+
+void XMLTextShapeStyleContext::CreateAndInsert( sal_Bool bOverwrite )
+{
+ XMLShapeStyleContext::CreateAndInsert( bOverwrite );
+ Reference < XStyle > xStyle = GetStyle();
+ if( !xStyle.is() || !(bOverwrite || IsNew()) )
+ return;
+
+ Reference < XPropertySet > xPropSet( xStyle, UNO_QUERY );
+ Reference< XPropertySetInfo > xPropSetInfo =
+ xPropSet->getPropertySetInfo();
+ if( xPropSetInfo->hasPropertyByName( sIsAutoUpdate ) )
+ {
+ Any aAny;
+ sal_Bool bTmp = bAutoUpdate;
+ aAny.setValue( &bTmp, ::getBooleanCppuType() );
+ xPropSet->setPropertyValue( sIsAutoUpdate, aAny );
+ }
+
+ // tell the style about it's events (if applicable)
+ if( xEventContext.Is() )
+ {
+ // set event suppplier and release reference to context
+ Reference<XEventsSupplier> xEventsSupplier(xStyle, UNO_QUERY);
+ ((XMLEventsImportContext *)&xEventContext)->SetEvents(xEventsSupplier);
+ xEventContext = 0;
+ }
+}
+
+
+void XMLTextShapeStyleContext::Finish( sal_Bool bOverwrite )
+{
+ XMLPropStyleContext::Finish( bOverwrite );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLTextTableContext.cxx b/xmloff/source/text/XMLTextTableContext.cxx
new file mode 100644
index 000000000000..0b8628217dde
--- /dev/null
+++ b/xmloff/source/text/XMLTextTableContext.cxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <xmloff/XMLTextTableContext.hxx>
+
+using ::rtl::OUString;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::text;
+
+
+TYPEINIT1( XMLTextTableContext, SvXMLImportContext );
+
+XMLTextTableContext::XMLTextTableContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx, const OUString& rLName ) :
+ SvXMLImportContext( rImport, nPrfx, rLName )
+{
+}
+
+XMLTextTableContext::~XMLTextTableContext()
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLTrackedChangesImportContext.cxx b/xmloff/source/text/XMLTrackedChangesImportContext.cxx
new file mode 100644
index 000000000000..8af54c293ed2
--- /dev/null
+++ b/xmloff/source/text/XMLTrackedChangesImportContext.cxx
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLTrackedChangesImportContext.hxx"
+#include "XMLChangedRegionImportContext.hxx"
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.h>
+#include <xmloff/xmlimp.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmltoken.hxx>
+
+
+using ::rtl::OUString;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::xml::sax::XAttributeList;
+using namespace ::xmloff::token;
+
+
+
+TYPEINIT1( XMLTrackedChangesImportContext, SvXMLImportContext );
+
+XMLTrackedChangesImportContext::XMLTrackedChangesImportContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName) :
+ SvXMLImportContext(rImport, nPrefix, rLocalName)
+{
+}
+
+XMLTrackedChangesImportContext::~XMLTrackedChangesImportContext()
+{
+}
+
+void XMLTrackedChangesImportContext::StartElement(
+ const Reference<XAttributeList> & xAttrList )
+{
+ sal_Bool bTrackChanges = sal_True;
+
+ // scan for text:track-changes and text:protection-key attributes
+ sal_Int16 nLength = xAttrList->getLength();
+ for( sal_Int16 i = 0; i < nLength; i++ )
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(i), &sLocalName );
+
+ if ( XML_NAMESPACE_TEXT == nPrefix )
+ {
+ if ( IsXMLToken( sLocalName, XML_TRACK_CHANGES ) )
+ {
+ bool bTmp;
+ if( SvXMLUnitConverter::convertBool(
+ bTmp, xAttrList->getValueByIndex(i)) )
+ {
+ bTrackChanges = bTmp;
+ }
+ }
+ }
+ }
+
+ // set tracked changes
+ GetImport().GetTextImport()->SetRecordChanges( bTrackChanges );
+}
+
+
+SvXMLImportContext* XMLTrackedChangesImportContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList)
+{
+ SvXMLImportContext* pContext = NULL;
+
+ if ( (XML_NAMESPACE_TEXT == nPrefix) &&
+ IsXMLToken( rLocalName, XML_CHANGED_REGION ) )
+ {
+ pContext = new XMLChangedRegionImportContext(GetImport(),
+ nPrefix, rLocalName);
+ }
+
+ if (NULL == pContext)
+ {
+ pContext = SvXMLImportContext::CreateChildContext(nPrefix, rLocalName,
+ xAttrList);
+ }
+
+ return pContext;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLTrackedChangesImportContext.hxx b/xmloff/source/text/XMLTrackedChangesImportContext.hxx
new file mode 100644
index 000000000000..448d51197878
--- /dev/null
+++ b/xmloff/source/text/XMLTrackedChangesImportContext.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XMLTRACKEDCHANGESIMPORTCONTEXT_HXX
+#define _XMLOFF_XMLTRACKEDCHANGESIMPORTCONTEXT_HXX
+
+#include <xmloff/xmlictxt.hxx>
+#include <com/sun/star/uno/Reference.h>
+
+
+namespace com { namespace sun { namespace star {
+ namespace text {
+ class XTextRange;
+ }
+ namespace xml { namespace sax {
+ class XAttributeList;
+ } }
+} } }
+namespace rtl {
+ class OUString;
+}
+class XMLTextImportHelper;
+
+/**
+ */
+class XMLTrackedChangesImportContext : public SvXMLImportContext
+{
+public:
+
+ TYPEINFO();
+
+ XMLTrackedChangesImportContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName);
+
+ ~XMLTrackedChangesImportContext();
+
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/txtdrope.cxx b/xmloff/source/text/txtdrope.cxx
new file mode 100644
index 000000000000..3e469a9dc501
--- /dev/null
+++ b/xmloff/source/text/txtdrope.cxx
@@ -0,0 +1,108 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/style/DropCapFormat.hpp>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include "txtdrope.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::xmloff::token;
+
+
+XMLTextDropCapExport::XMLTextDropCapExport( SvXMLExport& rExp ) :
+ rExport(rExp)
+{
+}
+
+XMLTextDropCapExport::~XMLTextDropCapExport()
+{
+}
+
+void XMLTextDropCapExport::exportXML( const Any& rAny,
+ sal_Bool bWholeWord,
+ const OUString& rStyleName )
+{
+ DropCapFormat aFormat;
+ rAny >>= aFormat;
+ OUString sValue;
+ OUStringBuffer sBuffer;
+ if( aFormat.Lines > 1 )
+ {
+ SvXMLUnitConverter& rUnitConv = rExport.GetMM100UnitConverter();
+
+ // style:lines
+ rUnitConv.convertNumber( sBuffer, (sal_Int32)aFormat.Lines );
+ rExport.AddAttribute( XML_NAMESPACE_STYLE, XML_LINES,
+ sBuffer.makeStringAndClear() );
+
+ // style:length
+ if( bWholeWord )
+ {
+ sValue = GetXMLToken(XML_WORD);
+ }
+ else if( aFormat.Count > 1 )
+ {
+ rUnitConv.convertNumber( sBuffer, (sal_Int32)aFormat.Count );
+ sValue = sBuffer.makeStringAndClear();
+ }
+ if( sValue.getLength() )
+ rExport.AddAttribute( XML_NAMESPACE_STYLE, XML_LENGTH, sValue );
+
+ // style:distance
+ if( aFormat.Distance > 0 )
+ {
+ rUnitConv.convertMeasure( sBuffer, aFormat.Distance );
+ rExport.AddAttribute( XML_NAMESPACE_STYLE, XML_DISTANCE,
+ sBuffer.makeStringAndClear() );
+ }
+
+ // style:style-name
+ if( rStyleName.getLength() )
+ rExport.AddAttribute( XML_NAMESPACE_STYLE, XML_STYLE_NAME,
+ rExport.EncodeStyleName( rStyleName ) );
+ }
+
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_STYLE, XML_DROP_CAP,
+ sal_False, sal_False );
+}
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/txtdrope.hxx b/xmloff/source/text/txtdrope.hxx
new file mode 100644
index 000000000000..2526c447ddbc
--- /dev/null
+++ b/xmloff/source/text/txtdrope.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_TXTDROPE_HXX
+#define _XMLOFF_TXTDROPE_HXX
+
+
+class SvXMLExport;
+namespace com { namespace sun { namespace star { namespace uno {
+ class Any; } } } }
+namespace rtl { class OUString; }
+
+class XMLTextDropCapExport
+{
+ SvXMLExport& rExport;
+
+public:
+
+ XMLTextDropCapExport( SvXMLExport& rExport );
+ ~XMLTextDropCapExport();
+
+ void exportXML( const ::com::sun::star::uno::Any& rAny,
+ sal_Bool bWholeWord,
+ const ::rtl::OUString& rStyleName );
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/txtdropi.cxx b/xmloff/source/text/txtdropi.cxx
new file mode 100644
index 000000000000..47cd1ec379d9
--- /dev/null
+++ b/xmloff/source/text/txtdropi.cxx
@@ -0,0 +1,156 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/style/DropCapFormat.hpp>
+#include "txtdropi.hxx"
+#include <xmloff/xmltkmap.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmltoken.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::style;
+using namespace ::xmloff::token;
+
+
+enum SvXMLTokenMapDropAttrs
+{
+ XML_TOK_DROP_LINES,
+ XML_TOK_DROP_LENGTH,
+ XML_TOK_DROP_DISTANCE,
+ XML_TOK_DROP_STYLE,
+ XML_TOK_DROP_END=XML_TOK_UNKNOWN
+};
+
+static SvXMLTokenMapEntry aDropAttrTokenMap[] =
+{
+ { XML_NAMESPACE_STYLE, XML_LINES, XML_TOK_DROP_LINES },
+ { XML_NAMESPACE_STYLE, XML_LENGTH, XML_TOK_DROP_LENGTH },
+ { XML_NAMESPACE_STYLE, XML_DISTANCE, XML_TOK_DROP_DISTANCE },
+ { XML_NAMESPACE_STYLE, XML_STYLE_NAME, XML_TOK_DROP_STYLE },
+ XML_TOKEN_MAP_END
+};
+
+TYPEINIT1( XMLTextDropCapImportContext, XMLElementPropertyContext );
+void XMLTextDropCapImportContext::ProcessAttrs(
+ const Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ SvXMLTokenMap aTokenMap( aDropAttrTokenMap );
+
+ DropCapFormat aFormat;
+ sal_Bool bWholeWord = sal_False;
+
+ sal_Int32 nTmp;
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ const OUString& rValue = xAttrList->getValueByIndex( i );
+
+ switch( aTokenMap.Get( nPrefix, aLocalName ) )
+ {
+ case XML_TOK_DROP_LINES:
+ if( GetImport().GetMM100UnitConverter().convertNumber( nTmp, rValue, 0, 255 ) )
+ {
+ aFormat.Lines = nTmp < 2 ? 0 : (sal_Int8)nTmp;
+ }
+ break;
+
+ case XML_TOK_DROP_LENGTH:
+ if( IsXMLToken( rValue, XML_WORD ) )
+ {
+ bWholeWord = sal_True;
+ }
+ else if( GetImport().GetMM100UnitConverter().convertNumber( nTmp, rValue, 1, 255 ) )
+ {
+ bWholeWord = sal_False;
+ aFormat.Count = (sal_Int8)nTmp;
+ }
+ break;
+
+ case XML_TOK_DROP_DISTANCE:
+ if( GetImport().GetMM100UnitConverter().convertMeasure( nTmp, rValue, 0 ) )
+ {
+ aFormat.Distance = (sal_uInt16)nTmp;
+ }
+ break;
+
+ case XML_TOK_DROP_STYLE:
+ sStyleName = rValue;
+ break;
+ }
+ }
+
+ if( aFormat.Lines > 1 && aFormat.Count < 1 )
+ aFormat.Count = 1;
+
+ aProp.maValue <<= aFormat;
+
+ aWholeWordProp.maValue.setValue( &bWholeWord, ::getBooleanCppuType() );
+}
+
+XMLTextDropCapImportContext::XMLTextDropCapImportContext(
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const Reference< xml::sax::XAttributeList > & xAttrList,
+ const XMLPropertyState& rProp,
+ sal_Int32 nWholeWordIdx,
+ ::std::vector< XMLPropertyState > &rProps ) :
+ XMLElementPropertyContext( rImport, nPrfx, rLName, rProp, rProps ),
+ aWholeWordProp( nWholeWordIdx )
+{
+ ProcessAttrs( xAttrList );
+}
+
+XMLTextDropCapImportContext::~XMLTextDropCapImportContext()
+{
+}
+
+void XMLTextDropCapImportContext::EndElement()
+{
+ SetInsert( sal_True );
+ XMLElementPropertyContext::EndElement();
+
+ if( -1 != aWholeWordProp.mnIndex )
+ rProperties.push_back( aWholeWordProp );
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/txtdropi.hxx b/xmloff/source/text/txtdropi.hxx
new file mode 100644
index 000000000000..7fbe75ec4f55
--- /dev/null
+++ b/xmloff/source/text/txtdropi.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _TXTDROPI_HXX
+#define _TXTDROPI_HXX
+
+#include "XMLElementPropertyContext.hxx"
+
+
+namespace rtl { class OUString; }
+
+class XMLTextDropCapImportContext :public XMLElementPropertyContext
+{
+ XMLPropertyState aWholeWordProp;
+ ::rtl::OUString sStyleName;
+
+private:
+ void ProcessAttrs(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+public:
+ TYPEINFO();
+
+ XMLTextDropCapImportContext(
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
+ const XMLPropertyState& rProp,
+ sal_Int32 nWholeWOrdIdx,
+ ::std::vector< XMLPropertyState > &rProps );
+
+ virtual ~XMLTextDropCapImportContext();
+
+ virtual void EndElement();
+
+ const ::rtl::OUString& GetStyleName() const { return sStyleName; }
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/txtexppr.cxx b/xmloff/source/text/txtexppr.cxx
new file mode 100644
index 000000000000..169ec68b6698
--- /dev/null
+++ b/xmloff/source/text/txtexppr.cxx
@@ -0,0 +1,1036 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#include <xmloff/txtprmap.hxx>
+#include <com/sun/star/table/BorderLine2.hpp>
+#include <com/sun/star/text/SizeType.hpp>
+#include <com/sun/star/text/WrapTextMode.hpp>
+#include <com/sun/star/text/TextContentAnchorType.hpp>
+#include <com/sun/star/awt/FontFamily.hpp>
+#include <com/sun/star/awt/FontPitch.hpp>
+#include <com/sun/star/awt/FontUnderline.hpp>
+#include <com/sun/star/text/XChapterNumberingSupplier.hpp>
+#include "txtexppr.hxx"
+#include <xmloff/xmlexp.hxx>
+#include "XMLSectionFootnoteConfigExport.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::awt;
+
+void XMLTextExportPropertySetMapper::handleElementItem(
+ SvXMLExport& rExp,
+ const XMLPropertyState& rProperty,
+ sal_uInt16 nFlags,
+ const ::std::vector< XMLPropertyState > *pProperties,
+ sal_uInt32 nIdx ) const
+{
+ XMLTextExportPropertySetMapper *pThis =
+ ((XMLTextExportPropertySetMapper *)this);
+
+ switch( getPropertySetMapper()->GetEntryContextId( rProperty.mnIndex ) )
+ {
+ case CTF_DROPCAPFORMAT:
+ pThis->maDropCapExport.exportXML( rProperty.maValue, bDropWholeWord,
+ sDropCharStyle );
+ pThis->bDropWholeWord = sal_False;
+ pThis->sDropCharStyle = OUString();
+ break;
+
+ case CTF_TABSTOP:
+ pThis->maTabStopExport.Export( rProperty.maValue );
+ break;
+
+ case CTF_TEXTCOLUMNS:
+ pThis->maTextColumnsExport.exportXML( rProperty.maValue );
+ break;
+
+ case CTF_BACKGROUND_URL:
+ {
+ DBG_ASSERT( pProperties && nIdx >= 3,
+ "property vector missing" );
+ const Any *pPos = 0, *pFilter = 0, *pTrans = 0;
+ if( pProperties && nIdx >= 3 )
+ {
+ const XMLPropertyState& rTrans = (*pProperties)[nIdx-3];
+ // #99657# transparency may be there, but doesn't have to be.
+ // If it's there, it must be in the right position.
+ if( CTF_BACKGROUND_TRANSPARENCY == getPropertySetMapper()
+ ->GetEntryContextId( rTrans.mnIndex ) )
+ pTrans = &rTrans.maValue;
+
+ const XMLPropertyState& rPos = (*pProperties)[nIdx-2];
+ DBG_ASSERT( CTF_BACKGROUND_POS == getPropertySetMapper()
+ ->GetEntryContextId( rPos.mnIndex ),
+ "invalid property map: pos expected" );
+ if( CTF_BACKGROUND_POS == getPropertySetMapper()
+ ->GetEntryContextId( rPos.mnIndex ) )
+ pPos = &rPos.maValue;
+
+ const XMLPropertyState& rFilter = (*pProperties)[nIdx-1];
+ DBG_ASSERT( CTF_BACKGROUND_FILTER == getPropertySetMapper()
+ ->GetEntryContextId( rFilter.mnIndex ),
+ "invalid property map: filter expected" );
+ if( CTF_BACKGROUND_FILTER == getPropertySetMapper()
+ ->GetEntryContextId( rFilter.mnIndex ) )
+ pFilter = &rFilter.maValue;
+ }
+ sal_uInt32 nPropIndex = rProperty.mnIndex;
+ pThis->maBackgroundImageExport.exportXML(
+ rProperty.maValue, pPos, pFilter, pTrans,
+ getPropertySetMapper()->GetEntryNameSpace( nPropIndex ),
+ getPropertySetMapper()->GetEntryXMLName( nPropIndex ) );
+ }
+ break;
+
+ case CTF_SECTION_FOOTNOTE_END:
+ XMLSectionFootnoteConfigExport::exportXML(rExp, sal_False,
+ pProperties, nIdx,
+ getPropertySetMapper());
+ break;
+
+ case CTF_SECTION_ENDNOTE_END:
+ XMLSectionFootnoteConfigExport::exportXML(rExp, sal_True,
+ pProperties, nIdx,
+ getPropertySetMapper());
+ break;
+
+ default:
+ SvXMLExportPropertyMapper::handleElementItem( rExp, rProperty, nFlags, pProperties, nIdx );
+ break;
+ }
+}
+
+void XMLTextExportPropertySetMapper::handleSpecialItem(
+ SvXMLAttributeList& rAttrList,
+ const XMLPropertyState& rProperty,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ const ::std::vector< XMLPropertyState > *pProperties,
+ sal_uInt32 nIdx ) const
+{
+ XMLTextExportPropertySetMapper *pThis =
+ ((XMLTextExportPropertySetMapper *)this);
+
+ switch( getPropertySetMapper()->GetEntryContextId( rProperty.mnIndex ) )
+ {
+ case CTF_DROPCAPWHOLEWORD:
+ DBG_ASSERT( !bDropWholeWord, "drop whole word is set already!" );
+ pThis->bDropWholeWord = *(sal_Bool *)rProperty.maValue.getValue();
+ break;
+ case CTF_DROPCAPCHARSTYLE:
+ DBG_ASSERT( !sDropCharStyle.getLength(),
+ "drop char style is set already!" );
+ rProperty.maValue >>= pThis->sDropCharStyle;
+ break;
+ case CTF_NUMBERINGSTYLENAME:
+ case CTF_PAGEDESCNAME:
+ case CTF_OLDTEXTBACKGROUND:
+ case CTF_BACKGROUND_POS:
+ case CTF_BACKGROUND_FILTER:
+ case CTF_BACKGROUND_TRANSPARENCY:
+ case CTF_SECTION_FOOTNOTE_NUM_OWN:
+ case CTF_SECTION_FOOTNOTE_NUM_RESTART:
+ case CTF_SECTION_FOOTNOTE_NUM_RESTART_AT:
+ case CTF_SECTION_FOOTNOTE_NUM_TYPE:
+ case CTF_SECTION_FOOTNOTE_NUM_PREFIX:
+ case CTF_SECTION_FOOTNOTE_NUM_SUFFIX:
+ case CTF_SECTION_ENDNOTE_NUM_OWN:
+ case CTF_SECTION_ENDNOTE_NUM_RESTART:
+ case CTF_SECTION_ENDNOTE_NUM_RESTART_AT:
+ case CTF_SECTION_ENDNOTE_NUM_TYPE:
+ case CTF_SECTION_ENDNOTE_NUM_PREFIX:
+ case CTF_SECTION_ENDNOTE_NUM_SUFFIX:
+ case CTF_DEFAULT_OUTLINE_LEVEL:
+ case CTF_OLD_FLOW_WITH_TEXT:
+ // There's nothing to do here!
+ break;
+ default:
+ SvXMLExportPropertyMapper::handleSpecialItem(rAttrList, rProperty, rUnitConverter, rNamespaceMap, pProperties, nIdx );
+ break;
+ }
+}
+
+XMLTextExportPropertySetMapper::XMLTextExportPropertySetMapper(
+ const UniReference< XMLPropertySetMapper >& rMapper,
+ SvXMLExport& rExp ) :
+ SvXMLExportPropertyMapper( rMapper ),
+ rExport( rExp ),
+ bDropWholeWord( sal_False ),
+ maDropCapExport( rExp ),
+ maTabStopExport( rExp ),
+ maTextColumnsExport( rExp ),
+ maBackgroundImageExport( rExp )
+{
+}
+
+XMLTextExportPropertySetMapper::~XMLTextExportPropertySetMapper()
+{
+}
+
+void XMLTextExportPropertySetMapper::ContextFontFilter(
+ XMLPropertyState *pFontNameState,
+ XMLPropertyState *pFontFamilyNameState,
+ XMLPropertyState *pFontStyleNameState,
+ XMLPropertyState *pFontFamilyState,
+ XMLPropertyState *pFontPitchState,
+ XMLPropertyState *pFontCharsetState ) const
+{
+ OUString sFamilyName;
+ OUString sStyleName;
+ sal_Int16 nFamily = FontFamily::DONTKNOW;
+ sal_Int16 nPitch = FontPitch::DONTKNOW;
+ rtl_TextEncoding eEnc = RTL_TEXTENCODING_DONTKNOW;
+
+ OUString sTmp;
+ if( pFontFamilyNameState && (pFontFamilyNameState->maValue >>= sTmp ) )
+ sFamilyName = sTmp;
+ if( pFontStyleNameState && (pFontStyleNameState->maValue >>= sTmp ) )
+ sStyleName = sTmp;
+
+ sal_Int16 nTmp = sal_Int16();
+ if( pFontFamilyState && (pFontFamilyState->maValue >>= nTmp ) )
+ nFamily = nTmp;
+ if( pFontPitchState && (pFontPitchState->maValue >>= nTmp ) )
+ nPitch = nTmp;
+ if( pFontCharsetState && (pFontCharsetState->maValue >>= nTmp ) )
+ eEnc = (rtl_TextEncoding)nTmp;
+
+ OUString sName( ((SvXMLExport&)GetExport()).GetFontAutoStylePool()->Find(
+ sFamilyName, sStyleName, nFamily, nPitch, eEnc ) );
+ if( sName.getLength() )
+ {
+ pFontNameState->maValue <<= sName;
+ if( pFontFamilyNameState )
+ pFontFamilyNameState->mnIndex = -1;
+ if( pFontStyleNameState )
+ pFontStyleNameState->mnIndex = -1;
+ if( pFontFamilyState )
+ pFontFamilyState->mnIndex = -1;
+ if( pFontPitchState )
+ pFontPitchState->mnIndex = -1;
+ if( pFontCharsetState )
+ pFontCharsetState->mnIndex = -1;
+ }
+ else
+ {
+ pFontNameState->mnIndex = -1;
+ }
+
+ if( pFontFamilyNameState && (0 == sFamilyName.getLength()) )
+ {
+ pFontFamilyNameState->mnIndex = -1;
+ }
+
+ if( pFontStyleNameState && (0 == sStyleName.getLength()) )
+ {
+ pFontStyleNameState->mnIndex = -1;
+ }
+}
+
+void XMLTextExportPropertySetMapper::ContextFontHeightFilter(
+ XMLPropertyState* pCharHeightState,
+ XMLPropertyState* pCharPropHeightState,
+ XMLPropertyState* pCharDiffHeightState ) const
+{
+ if( pCharPropHeightState )
+ {
+ sal_Int32 nTemp = 0;
+ pCharPropHeightState->maValue >>= nTemp;
+ if( nTemp == 100 )
+ {
+ pCharPropHeightState->mnIndex = -1;
+ pCharPropHeightState->maValue.clear();
+ }
+ else
+ {
+ pCharHeightState->mnIndex = -1;
+ pCharHeightState->maValue.clear();
+ }
+ }
+ if( pCharDiffHeightState )
+ {
+ float nTemp = 0;
+ pCharDiffHeightState->maValue >>= nTemp;
+ if( nTemp == 0. )
+ {
+ pCharDiffHeightState->mnIndex = -1;
+ pCharDiffHeightState->maValue.clear();
+ }
+ else
+ {
+ pCharHeightState->mnIndex = -1;
+ pCharHeightState->maValue.clear();
+ }
+ }
+
+}
+
+// helper method; implementation below
+bool lcl_IsOutlineStyle(const SvXMLExport&, const OUString&);
+
+
+void XMLTextExportPropertySetMapper::ContextFilter(
+ ::std::vector< XMLPropertyState >& rProperties,
+ Reference< XPropertySet > rPropSet ) const
+{
+ // filter font
+ XMLPropertyState *pFontNameState = 0;
+ XMLPropertyState *pFontFamilyNameState = 0;
+ XMLPropertyState *pFontStyleNameState = 0;
+ XMLPropertyState *pFontFamilyState = 0;
+ XMLPropertyState *pFontPitchState = 0;
+ XMLPropertyState *pFontCharsetState = 0;
+ XMLPropertyState *pFontNameCJKState = 0;
+ XMLPropertyState *pFontFamilyNameCJKState = 0;
+ XMLPropertyState *pFontStyleNameCJKState = 0;
+ XMLPropertyState *pFontFamilyCJKState = 0;
+ XMLPropertyState *pFontPitchCJKState = 0;
+ XMLPropertyState *pFontCharsetCJKState = 0;
+ XMLPropertyState *pFontNameCTLState = 0;
+ XMLPropertyState *pFontFamilyNameCTLState = 0;
+ XMLPropertyState *pFontStyleNameCTLState = 0;
+ XMLPropertyState *pFontFamilyCTLState = 0;
+ XMLPropertyState *pFontPitchCTLState = 0;
+ XMLPropertyState *pFontCharsetCTLState = 0;
+
+ // filter char height point/percent
+ XMLPropertyState* pCharHeightState = NULL;
+ XMLPropertyState* pCharPropHeightState = NULL;
+ XMLPropertyState* pCharDiffHeightState = NULL;
+ XMLPropertyState* pCharHeightCJKState = NULL;
+ XMLPropertyState* pCharPropHeightCJKState = NULL;
+ XMLPropertyState* pCharDiffHeightCJKState = NULL;
+ XMLPropertyState* pCharHeightCTLState = NULL;
+ XMLPropertyState* pCharPropHeightCTLState = NULL;
+ XMLPropertyState* pCharDiffHeightCTLState = NULL;
+
+ // filter left margin measure/percent
+ XMLPropertyState* pParaLeftMarginState = NULL;
+ XMLPropertyState* pParaLeftMarginRelState = NULL;
+
+ // filter right margin measure/percent
+ XMLPropertyState* pParaRightMarginState = NULL;
+ XMLPropertyState* pParaRightMarginRelState = NULL;
+
+ // filter first line indent measure/percent
+ XMLPropertyState* pParaFirstLineState = NULL;
+ XMLPropertyState* pParaFirstLineRelState = NULL;
+
+ // filter ParaTopMargin/Relative
+ XMLPropertyState* pParaTopMarginState = NULL;
+ XMLPropertyState* pParaTopMarginRelState = NULL;
+
+ // filter ParaTopMargin/Relative
+ XMLPropertyState* pParaBottomMarginState = NULL;
+ XMLPropertyState* pParaBottomMarginRelState = NULL;
+
+ // filter (Left|Right|Top|Bottom|)BorderWidth
+ XMLPropertyState* pAllBorderWidthState = NULL;
+ XMLPropertyState* pLeftBorderWidthState = NULL;
+ XMLPropertyState* pRightBorderWidthState = NULL;
+ XMLPropertyState* pTopBorderWidthState = NULL;
+ XMLPropertyState* pBottomBorderWidthState = NULL;
+
+ // filter (Left|Right|Top|)BorderDistance
+ XMLPropertyState* pAllBorderDistanceState = NULL;
+ XMLPropertyState* pLeftBorderDistanceState = NULL;
+ XMLPropertyState* pRightBorderDistanceState = NULL;
+ XMLPropertyState* pTopBorderDistanceState = NULL;
+ XMLPropertyState* pBottomBorderDistanceState = NULL;
+
+ // filter (Left|Right|Top|Bottom|)Border
+ XMLPropertyState* pAllBorderState = NULL;
+ XMLPropertyState* pLeftBorderState = NULL;
+ XMLPropertyState* pRightBorderState = NULL;
+ XMLPropertyState* pTopBorderState = NULL;
+ XMLPropertyState* pBottomBorderState = NULL;
+
+ // filter height properties
+ XMLPropertyState* pHeightMinAbsState = NULL;
+ XMLPropertyState* pHeightMinRelState = NULL;
+ XMLPropertyState* pHeightAbsState = NULL;
+ XMLPropertyState* pHeightRelState = NULL;
+ XMLPropertyState* pSizeTypeState = NULL;
+
+ // filter width properties
+ XMLPropertyState* pWidthMinAbsState = NULL;
+ XMLPropertyState* pWidthMinRelState = NULL;
+ XMLPropertyState* pWidthAbsState = NULL;
+ XMLPropertyState* pWidthRelState = NULL;
+ XMLPropertyState* pWidthTypeState = NULL;
+
+ // wrap
+ XMLPropertyState* pWrapState = NULL;
+ XMLPropertyState* pWrapContourState = NULL;
+ XMLPropertyState* pWrapContourModeState = NULL;
+ XMLPropertyState* pWrapParagraphOnlyState = NULL;
+
+ // anchor
+ XMLPropertyState* pAnchorTypeState = NULL;
+
+ // horizontal position and relation
+ XMLPropertyState* pHoriOrientState = NULL;
+ XMLPropertyState* pHoriOrientMirroredState = NULL;
+ XMLPropertyState* pHoriOrientRelState = NULL;
+ XMLPropertyState* pHoriOrientRelFrameState = NULL;
+ XMLPropertyState* pHoriOrientMirrorState = NULL;
+ // Horizontal position and relation for shapes (#i28749#)
+ XMLPropertyState* pShapeHoriOrientState = NULL;
+ XMLPropertyState* pShapeHoriOrientMirroredState = NULL;
+ XMLPropertyState* pShapeHoriOrientRelState = NULL;
+ XMLPropertyState* pShapeHoriOrientRelFrameState = NULL;
+ XMLPropertyState* pShapeHoriOrientMirrorState = NULL;
+
+ // vertical position and relation
+ XMLPropertyState* pVertOrientState = NULL;
+ XMLPropertyState* pVertOrientAtCharState = NULL;
+ XMLPropertyState* pVertOrientRelState = NULL;
+ XMLPropertyState* pVertOrientRelPageState = NULL;
+ XMLPropertyState* pVertOrientRelFrameState = NULL;
+ XMLPropertyState* pVertOrientRelAsCharState = NULL;
+
+ // Vertical position and relation for shapes (#i28749#)
+ XMLPropertyState* pShapeVertOrientState = NULL;
+ XMLPropertyState* pShapeVertOrientAtCharState = NULL;
+ XMLPropertyState* pShapeVertOrientRelState = NULL;
+ XMLPropertyState* pShapeVertOrientRelPageState = NULL;
+ XMLPropertyState* pShapeVertOrientRelFrameState = NULL;
+
+ // filter underline color
+ XMLPropertyState* pUnderlineState = NULL;
+ XMLPropertyState* pUnderlineColorState = NULL;
+ XMLPropertyState* pUnderlineHasColorState = NULL;
+
+ // filter list style name
+ XMLPropertyState* pListStyleName = NULL;
+
+ // filter fo:clip
+ XMLPropertyState* pClip11State = NULL;
+ XMLPropertyState* pClipState = NULL;
+
+ sal_Bool bNeedsAnchor = sal_False;
+
+ for( ::std::vector< XMLPropertyState >::iterator aIter = rProperties.begin();
+ aIter != rProperties.end();
+ ++aIter )
+ {
+ XMLPropertyState *propertie = &(*aIter);
+ if( propertie->mnIndex == -1 )
+ continue;
+
+ switch( getPropertySetMapper()->GetEntryContextId( propertie->mnIndex ) )
+ {
+ case CTF_CHARHEIGHT: pCharHeightState = propertie; break;
+ case CTF_CHARHEIGHT_REL: pCharPropHeightState = propertie; break;
+ case CTF_CHARHEIGHT_DIFF: pCharDiffHeightState = propertie; break;
+ case CTF_CHARHEIGHT_CJK: pCharHeightCJKState = propertie; break;
+ case CTF_CHARHEIGHT_REL_CJK: pCharPropHeightCJKState = propertie; break;
+ case CTF_CHARHEIGHT_DIFF_CJK: pCharDiffHeightCJKState = propertie; break;
+ case CTF_CHARHEIGHT_CTL: pCharHeightCTLState = propertie; break;
+ case CTF_CHARHEIGHT_REL_CTL: pCharPropHeightCTLState = propertie; break;
+ case CTF_CHARHEIGHT_DIFF_CTL: pCharDiffHeightCTLState = propertie; break;
+ case CTF_PARALEFTMARGIN: pParaLeftMarginState = propertie; break;
+ case CTF_PARALEFTMARGIN_REL: pParaLeftMarginRelState = propertie; break;
+ case CTF_PARARIGHTMARGIN: pParaRightMarginState = propertie; break;
+ case CTF_PARARIGHTMARGIN_REL: pParaRightMarginRelState = propertie; break;
+ case CTF_PARAFIRSTLINE: pParaFirstLineState = propertie; break;
+ case CTF_PARAFIRSTLINE_REL: pParaFirstLineRelState = propertie; break;
+ case CTF_PARATOPMARGIN: pParaTopMarginState = propertie; break;
+ case CTF_PARATOPMARGIN_REL: pParaTopMarginRelState = propertie; break;
+ case CTF_PARABOTTOMMARGIN: pParaBottomMarginState = propertie; break;
+ case CTF_PARABOTTOMMARGIN_REL: pParaBottomMarginRelState = propertie; break;
+ case CTF_ALLBORDERWIDTH: pAllBorderWidthState = propertie; break;
+ case CTF_LEFTBORDERWIDTH: pLeftBorderWidthState = propertie; break;
+ case CTF_RIGHTBORDERWIDTH: pRightBorderWidthState = propertie; break;
+ case CTF_TOPBORDERWIDTH: pTopBorderWidthState = propertie; break;
+ case CTF_BOTTOMBORDERWIDTH: pBottomBorderWidthState = propertie; break;
+ case CTF_ALLBORDERDISTANCE: pAllBorderDistanceState = propertie; break;
+ case CTF_LEFTBORDERDISTANCE: pLeftBorderDistanceState = propertie; break;
+ case CTF_RIGHTBORDERDISTANCE: pRightBorderDistanceState = propertie; break;
+ case CTF_TOPBORDERDISTANCE: pTopBorderDistanceState = propertie; break;
+ case CTF_BOTTOMBORDERDISTANCE: pBottomBorderDistanceState = propertie; break;
+ case CTF_ALLBORDER: pAllBorderState = propertie; break;
+ case CTF_LEFTBORDER: pLeftBorderState = propertie; break;
+ case CTF_RIGHTBORDER: pRightBorderState = propertie; break;
+ case CTF_TOPBORDER: pTopBorderState = propertie; break;
+ case CTF_BOTTOMBORDER: pBottomBorderState = propertie; break;
+
+ case CTF_FRAMEHEIGHT_MIN_ABS: pHeightMinAbsState = propertie; break;
+ case CTF_FRAMEHEIGHT_MIN_REL: pHeightMinRelState = propertie; break;
+ case CTF_FRAMEHEIGHT_ABS: pHeightAbsState = propertie; break;
+ case CTF_FRAMEHEIGHT_REL: pHeightRelState = propertie; break;
+ case CTF_SIZETYPE: pSizeTypeState = propertie; break;
+
+ case CTF_FRAMEWIDTH_MIN_ABS: pWidthMinAbsState = propertie; break;
+ case CTF_FRAMEWIDTH_MIN_REL: pWidthMinRelState = propertie; break;
+ case CTF_FRAMEWIDTH_ABS: pWidthAbsState = propertie; break;
+ case CTF_FRAMEWIDTH_REL: pWidthRelState = propertie; break;
+ case CTF_FRAMEWIDTH_TYPE: pWidthTypeState = propertie; break;
+
+ case CTF_WRAP: pWrapState = propertie; break;
+ case CTF_WRAP_CONTOUR: pWrapContourState = propertie; break;
+ case CTF_WRAP_CONTOUR_MODE: pWrapContourModeState = propertie; break;
+ case CTF_WRAP_PARAGRAPH_ONLY: pWrapParagraphOnlyState = propertie; break;
+ case CTF_ANCHORTYPE: pAnchorTypeState = propertie; break;
+
+ case CTF_HORIZONTALPOS: pHoriOrientState = propertie; bNeedsAnchor = sal_True; break;
+ case CTF_HORIZONTALPOS_MIRRORED: pHoriOrientMirroredState = propertie; bNeedsAnchor = sal_True; break;
+ case CTF_HORIZONTALREL: pHoriOrientRelState = propertie; bNeedsAnchor = sal_True; break;
+ case CTF_HORIZONTALREL_FRAME: pHoriOrientRelFrameState = propertie; bNeedsAnchor = sal_True; break;
+ case CTF_HORIZONTALMIRROR: pHoriOrientMirrorState = propertie; bNeedsAnchor = sal_True; break;
+ case CTF_VERTICALPOS: pVertOrientState = propertie; bNeedsAnchor = sal_True; break;
+ case CTF_VERTICALPOS_ATCHAR: pVertOrientAtCharState = propertie; bNeedsAnchor = sal_True; break;
+ case CTF_VERTICALREL: pVertOrientRelState = propertie; bNeedsAnchor = sal_True; break;
+ case CTF_VERTICALREL_PAGE: pVertOrientRelPageState = propertie; bNeedsAnchor = sal_True; break;
+ case CTF_VERTICALREL_FRAME: pVertOrientRelFrameState = propertie; bNeedsAnchor = sal_True; break;
+ case CTF_VERTICALREL_ASCHAR: pVertOrientRelAsCharState = propertie; bNeedsAnchor = sal_True; break;
+
+ // Handle new CTFs for shape positioning properties (#i28749#)
+ case CTF_SHAPE_HORIZONTALPOS: pShapeHoriOrientState = propertie; bNeedsAnchor = sal_True; break;
+ case CTF_SHAPE_HORIZONTALPOS_MIRRORED: pShapeHoriOrientMirroredState = propertie; bNeedsAnchor = sal_True; break;
+ case CTF_SHAPE_HORIZONTALREL: pShapeHoriOrientRelState = propertie; bNeedsAnchor = sal_True; break;
+ case CTF_SHAPE_HORIZONTALREL_FRAME: pShapeHoriOrientRelFrameState = propertie; bNeedsAnchor = sal_True; break;
+ case CTF_SHAPE_HORIZONTALMIRROR: pShapeHoriOrientMirrorState = propertie; bNeedsAnchor = sal_True; break;
+ case CTF_SHAPE_VERTICALPOS: pShapeVertOrientState = propertie; bNeedsAnchor = sal_True; break;
+ case CTF_SHAPE_VERTICALPOS_ATCHAR: pShapeVertOrientAtCharState = propertie; bNeedsAnchor = sal_True; break;
+ case CTF_SHAPE_VERTICALREL: pShapeVertOrientRelState = propertie; bNeedsAnchor = sal_True; break;
+ case CTF_SHAPE_VERTICALREL_PAGE: pShapeVertOrientRelPageState = propertie; bNeedsAnchor = sal_True; break;
+ case CTF_SHAPE_VERTICALREL_FRAME: pShapeVertOrientRelFrameState = propertie; bNeedsAnchor = sal_True; break;
+ case CTF_FONTNAME: pFontNameState = propertie; break;
+ case CTF_FONTFAMILYNAME: pFontFamilyNameState = propertie; break;
+ case CTF_FONTSTYLENAME: pFontStyleNameState = propertie; break;
+ case CTF_FONTFAMILY: pFontFamilyState = propertie; break;
+ case CTF_FONTPITCH: pFontPitchState = propertie; break;
+ case CTF_FONTCHARSET: pFontCharsetState = propertie; break;
+
+ case CTF_FONTNAME_CJK: pFontNameCJKState = propertie; break;
+ case CTF_FONTFAMILYNAME_CJK: pFontFamilyNameCJKState = propertie; break;
+ case CTF_FONTSTYLENAME_CJK: pFontStyleNameCJKState = propertie; break;
+ case CTF_FONTFAMILY_CJK: pFontFamilyCJKState = propertie; break;
+ case CTF_FONTPITCH_CJK: pFontPitchCJKState = propertie; break;
+ case CTF_FONTCHARSET_CJK: pFontCharsetCJKState = propertie; break;
+
+ case CTF_FONTNAME_CTL: pFontNameCTLState = propertie; break;
+ case CTF_FONTFAMILYNAME_CTL: pFontFamilyNameCTLState = propertie; break;
+ case CTF_FONTSTYLENAME_CTL: pFontStyleNameCTLState = propertie; break;
+ case CTF_FONTFAMILY_CTL: pFontFamilyCTLState = propertie; break;
+ case CTF_FONTPITCH_CTL: pFontPitchCTLState = propertie; break;
+ case CTF_FONTCHARSET_CTL: pFontCharsetCTLState = propertie; break;
+ case CTF_UNDERLINE: pUnderlineState = propertie; break;
+ case CTF_UNDERLINE_COLOR: pUnderlineColorState = propertie; break;
+ case CTF_UNDERLINE_HASCOLOR: pUnderlineHasColorState = propertie; break;
+ case CTF_NUMBERINGSTYLENAME: pListStyleName = propertie; break;
+ case CTF_TEXT_CLIP11: pClip11State = propertie; break;
+ case CTF_TEXT_CLIP: pClipState = propertie; break;
+ }
+ }
+
+ if( pFontNameState )
+ ContextFontFilter( pFontNameState, pFontFamilyNameState,
+ pFontStyleNameState, pFontFamilyState,
+ pFontPitchState, pFontCharsetState );
+ if( pFontNameCJKState )
+ ContextFontFilter( pFontNameCJKState, pFontFamilyNameCJKState,
+ pFontStyleNameCJKState, pFontFamilyCJKState,
+ pFontPitchCJKState, pFontCharsetCJKState );
+ if( pFontNameCTLState )
+ ContextFontFilter( pFontNameCTLState, pFontFamilyNameCTLState,
+ pFontStyleNameCTLState, pFontFamilyCTLState,
+ pFontPitchCTLState, pFontCharsetCTLState );
+
+ if( pCharHeightState && (pCharPropHeightState || pCharDiffHeightState ) )
+ ContextFontHeightFilter( pCharHeightState, pCharPropHeightState,
+ pCharDiffHeightState );
+ if( pCharHeightCJKState &&
+ (pCharPropHeightCJKState || pCharDiffHeightCJKState ) )
+ ContextFontHeightFilter( pCharHeightCJKState, pCharPropHeightCJKState,
+ pCharDiffHeightCJKState );
+ if( pCharHeightCTLState &&
+ (pCharPropHeightCTLState || pCharDiffHeightCTLState ) )
+ ContextFontHeightFilter( pCharHeightCTLState, pCharPropHeightCTLState,
+ pCharDiffHeightCTLState );
+ if( pUnderlineColorState || pUnderlineHasColorState )
+ {
+ sal_Bool bClear = !pUnderlineState;
+ if( !bClear )
+ {
+ sal_Int16 nUnderline = 0;
+ pUnderlineState->maValue >>= nUnderline;
+ bClear = FontUnderline::NONE == nUnderline;
+ }
+ if( bClear )
+ {
+ if( pUnderlineColorState )
+ pUnderlineColorState->mnIndex = -1;
+ if( pUnderlineHasColorState )
+ pUnderlineHasColorState->mnIndex = -1;
+ }
+ }
+
+ if( pParaLeftMarginState && pParaLeftMarginRelState )
+ {
+ sal_Int32 nTemp = 0;
+ pParaLeftMarginRelState->maValue >>= nTemp;
+ if( nTemp == 100 )
+ {
+ pParaLeftMarginRelState->mnIndex = -1;
+ pParaLeftMarginRelState->maValue.clear();
+ }
+ else
+ {
+ pParaLeftMarginState->mnIndex = -1;
+ pParaLeftMarginState->maValue.clear();
+ }
+
+ }
+
+ if( pParaRightMarginState && pParaRightMarginRelState )
+ {
+ sal_Int32 nTemp = 0;
+ pParaRightMarginRelState->maValue >>= nTemp;
+ if( nTemp == 100 )
+ {
+ pParaRightMarginRelState->mnIndex = -1;
+ pParaRightMarginRelState->maValue.clear();
+ }
+ else
+ {
+ pParaRightMarginState->mnIndex = -1;
+ pParaRightMarginState->maValue.clear();
+ }
+ }
+
+ if( pParaFirstLineState && pParaFirstLineRelState )
+ {
+ sal_Int32 nTemp = 0;
+ pParaFirstLineRelState->maValue >>= nTemp;
+ if( nTemp == 100 )
+ {
+ pParaFirstLineRelState->mnIndex = -1;
+ pParaFirstLineRelState->maValue.clear();
+ }
+ else
+ {
+ pParaFirstLineState->mnIndex = -1;
+ pParaFirstLineState->maValue.clear();
+ }
+ }
+
+ if( pParaTopMarginState && pParaTopMarginRelState )
+ {
+ sal_Int32 nTemp = 0;
+ pParaTopMarginRelState->maValue >>= nTemp;
+ if( nTemp == 100 )
+ {
+ pParaTopMarginRelState->mnIndex = -1;
+ pParaTopMarginRelState->maValue.clear();
+ }
+ else
+ {
+ pParaTopMarginState->mnIndex = -1;
+ pParaTopMarginState->maValue.clear();
+ }
+
+ }
+
+ if( pParaBottomMarginState && pParaBottomMarginRelState )
+ {
+ sal_Int32 nTemp = 0;
+ pParaBottomMarginRelState->maValue >>= nTemp;
+ if( nTemp == 100 )
+ {
+ pParaBottomMarginRelState->mnIndex = -1;
+ pParaBottomMarginRelState->maValue.clear();
+ }
+ else
+ {
+ pParaBottomMarginState->mnIndex = -1;
+ pParaBottomMarginState->maValue.clear();
+ }
+
+ }
+
+ if( pAllBorderWidthState )
+ {
+ if( pLeftBorderWidthState && pRightBorderWidthState && pTopBorderWidthState && pBottomBorderWidthState )
+ {
+ table::BorderLine2 aLeft, aRight, aTop, aBottom;
+
+ pLeftBorderWidthState->maValue >>= aLeft;
+ pRightBorderWidthState->maValue >>= aRight;
+ pTopBorderWidthState->maValue >>= aTop;
+ pBottomBorderWidthState->maValue >>= aBottom;
+ if( aLeft.Color == aRight.Color && aLeft.InnerLineWidth == aRight.InnerLineWidth &&
+ aLeft.OuterLineWidth == aRight.OuterLineWidth && aLeft.LineDistance == aRight.LineDistance &&
+ aLeft.LineStyle == aRight.LineStyle &&
+ aLeft.LineWidth == aRight.LineWidth &&
+ aLeft.Color == aTop.Color && aLeft.InnerLineWidth == aTop.InnerLineWidth &&
+ aLeft.OuterLineWidth == aTop.OuterLineWidth && aLeft.LineDistance == aTop.LineDistance &&
+ aLeft.LineStyle == aTop.LineStyle &&
+ aLeft.LineWidth == aTop.LineWidth &&
+ aLeft.Color == aBottom.Color && aLeft.InnerLineWidth == aBottom.InnerLineWidth &&
+ aLeft.OuterLineWidth == aBottom.OuterLineWidth && aLeft.LineDistance == aBottom.LineDistance &&
+ aLeft.LineStyle == aBottom.LineStyle &&
+ aLeft.LineWidth == aBottom.LineWidth )
+ {
+ pLeftBorderWidthState->mnIndex = -1;
+ pLeftBorderWidthState->maValue.clear();
+ pRightBorderWidthState->mnIndex = -1;
+ pRightBorderWidthState->maValue.clear();
+ pTopBorderWidthState->mnIndex = -1;
+ pTopBorderWidthState->maValue.clear();
+ pBottomBorderWidthState->mnIndex = -1;
+ pBottomBorderWidthState->maValue.clear();
+ }
+ else
+ {
+ pAllBorderWidthState->mnIndex = -1;
+ pAllBorderWidthState->maValue.clear();
+ }
+ }
+ else
+ {
+ pAllBorderWidthState->mnIndex = -1;
+ pAllBorderWidthState->maValue.clear();
+ }
+ }
+
+ if( pAllBorderDistanceState )
+ {
+ if( pLeftBorderDistanceState && pRightBorderDistanceState && pTopBorderDistanceState && pBottomBorderDistanceState )
+ {
+ sal_Int32 aLeft = 0, aRight = 0, aTop = 0, aBottom = 0;
+
+ pLeftBorderDistanceState->maValue >>= aLeft;
+ pRightBorderDistanceState->maValue >>= aRight;
+ pTopBorderDistanceState->maValue >>= aTop;
+ pBottomBorderDistanceState->maValue >>= aBottom;
+ if( aLeft == aRight && aLeft == aTop && aLeft == aBottom )
+ {
+ pLeftBorderDistanceState->mnIndex = -1;
+ pLeftBorderDistanceState->maValue.clear();
+ pRightBorderDistanceState->mnIndex = -1;
+ pRightBorderDistanceState->maValue.clear();
+ pTopBorderDistanceState->mnIndex = -1;
+ pTopBorderDistanceState->maValue.clear();
+ pBottomBorderDistanceState->mnIndex = -1;
+ pBottomBorderDistanceState->maValue.clear();
+ }
+ else
+ {
+ pAllBorderDistanceState->mnIndex = -1;
+ pAllBorderDistanceState->maValue.clear();
+ }
+ }
+ else
+ {
+ pAllBorderDistanceState->mnIndex = -1;
+ pAllBorderDistanceState->maValue.clear();
+ }
+ }
+
+ if( pAllBorderState )
+ {
+ if( pLeftBorderState && pRightBorderState && pTopBorderState && pBottomBorderState )
+ {
+ table::BorderLine2 aLeft, aRight, aTop, aBottom;
+
+ pLeftBorderState->maValue >>= aLeft;
+ pRightBorderState->maValue >>= aRight;
+ pTopBorderState->maValue >>= aTop;
+ pBottomBorderState->maValue >>= aBottom;
+ if( aLeft.Color == aRight.Color && aLeft.InnerLineWidth == aRight.InnerLineWidth &&
+ aLeft.OuterLineWidth == aRight.OuterLineWidth && aLeft.LineDistance == aRight.LineDistance &&
+ aLeft.LineStyle == aRight.LineStyle &&
+ aLeft.LineWidth == aRight.LineWidth &&
+ aLeft.Color == aTop.Color && aLeft.InnerLineWidth == aTop.InnerLineWidth &&
+ aLeft.OuterLineWidth == aTop.OuterLineWidth && aLeft.LineDistance == aTop.LineDistance &&
+ aLeft.LineStyle == aTop.LineStyle &&
+ aLeft.LineWidth == aTop.LineWidth &&
+ aLeft.Color == aBottom.Color && aLeft.InnerLineWidth == aBottom.InnerLineWidth &&
+ aLeft.OuterLineWidth == aBottom.OuterLineWidth && aLeft.LineDistance == aBottom.LineDistance &&
+ aLeft.LineWidth == aBottom.LineWidth &&
+ aLeft.LineStyle == aBottom.LineStyle )
+ {
+ pLeftBorderState->mnIndex = -1;
+ pLeftBorderState->maValue.clear();
+ pRightBorderState->mnIndex = -1;
+ pRightBorderState->maValue.clear();
+ pTopBorderState->mnIndex = -1;
+ pTopBorderState->maValue.clear();
+ pBottomBorderState->mnIndex = -1;
+ pBottomBorderState->maValue.clear();
+ }
+ else
+ {
+ pAllBorderState->mnIndex = -1;
+ pAllBorderState->maValue.clear();
+ }
+ }
+ else
+ {
+ pAllBorderState->mnIndex = -1;
+ pAllBorderState->maValue.clear();
+ }
+ }
+
+ sal_Int16 nSizeType = SizeType::FIX;
+ if( pSizeTypeState )
+ {
+ pSizeTypeState->maValue >>= nSizeType;
+ pSizeTypeState->mnIndex = -1;
+ }
+
+ if( pHeightMinAbsState )
+ {
+ sal_Int16 nRel = sal_Int16();
+ if( (SizeType::FIX == nSizeType) ||
+ ( pHeightMinRelState &&
+ ( !(pHeightMinRelState->maValue >>= nRel) || nRel > 0 ) ) )
+ {
+ pHeightMinAbsState->mnIndex = -1;
+ }
+
+ // export SizeType::VARIABLE als min-width="0"
+ if( SizeType::VARIABLE == nSizeType )
+ pHeightMinAbsState->maValue <<= static_cast<sal_Int32>( 0 );
+ }
+ if( pHeightMinRelState && SizeType::MIN != nSizeType)
+ pHeightMinRelState->mnIndex = -1;
+ if( pHeightAbsState && pHeightMinAbsState &&
+ -1 != pHeightMinAbsState->mnIndex )
+ pHeightAbsState->mnIndex = -1;
+ if( pHeightRelState && SizeType::FIX != nSizeType)
+ pHeightRelState->mnIndex = -1;
+
+ // frame width
+ nSizeType = SizeType::FIX;
+ if( pWidthTypeState )
+ {
+ pWidthTypeState->maValue >>= nSizeType;
+ pWidthTypeState->mnIndex = -1;
+ }
+ if( pWidthMinAbsState )
+ {
+ sal_Int16 nRel = sal_Int16();
+ if( (SizeType::FIX == nSizeType) ||
+ ( pWidthMinRelState &&
+ ( !(pWidthMinRelState->maValue >>= nRel) || nRel > 0 ) ) )
+ {
+ pWidthMinAbsState->mnIndex = -1;
+ }
+
+ // export SizeType::VARIABLE als min-width="0"
+ if( SizeType::VARIABLE == nSizeType )
+ pWidthMinAbsState->maValue <<= static_cast<sal_Int32>( 0 );
+ }
+ if( pWidthMinRelState && SizeType::MIN != nSizeType)
+ pWidthMinRelState->mnIndex = -1;
+ if( pWidthAbsState && pWidthMinAbsState &&
+ -1 != pWidthMinAbsState->mnIndex )
+ pWidthAbsState->mnIndex = -1;
+ if( pWidthRelState && SizeType::FIX != nSizeType)
+ pWidthRelState->mnIndex = -1;
+
+ if( pWrapState )
+ {
+ WrapTextMode eVal;
+ pWrapState->maValue >>= eVal;
+ switch( eVal )
+ {
+ case WrapTextMode_NONE:
+ // no wrapping: disable para-only and contour
+ if( pWrapParagraphOnlyState )
+ pWrapParagraphOnlyState->mnIndex = -1;
+ // no break
+ case WrapTextMode_THROUGHT:
+ // wrap through: disable only contour
+ if( pWrapContourState )
+ pWrapContourState->mnIndex = -1;
+ break;
+ default:
+ break;
+ }
+ if( pWrapContourModeState &&
+ (!pWrapContourState ||
+ !*(sal_Bool *)pWrapContourState ->maValue.getValue() ) )
+ pWrapContourModeState->mnIndex = -1;
+ }
+
+ TextContentAnchorType eAnchor = TextContentAnchorType_AT_PARAGRAPH;
+ if( pAnchorTypeState )
+ pAnchorTypeState->maValue >>= eAnchor;
+ else if( bNeedsAnchor )
+ {
+ Any aAny = rPropSet->getPropertyValue(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ) );
+ aAny >>= eAnchor;
+ }
+
+ // states for frame positioning attributes
+ {
+ if( pHoriOrientState && pHoriOrientMirroredState )
+ {
+ if( pHoriOrientMirrorState &&
+ *(sal_Bool *)pHoriOrientMirrorState->maValue.getValue() )
+ pHoriOrientState->mnIndex = -1;
+ else
+ pHoriOrientMirroredState->mnIndex = -1;
+ }
+ if( pHoriOrientMirrorState )
+ pHoriOrientMirrorState->mnIndex = -1;
+
+ if( pHoriOrientRelState && TextContentAnchorType_AT_FRAME == eAnchor )
+ pHoriOrientRelState->mnIndex = -1;
+ if( pHoriOrientRelFrameState && TextContentAnchorType_AT_FRAME != eAnchor )
+ pHoriOrientRelFrameState->mnIndex = -1;;
+
+ if( pVertOrientState && TextContentAnchorType_AT_CHARACTER == eAnchor )
+ pVertOrientState->mnIndex = -1;
+ if( pVertOrientAtCharState && TextContentAnchorType_AT_CHARACTER != eAnchor )
+ pVertOrientAtCharState->mnIndex = -1;
+ if( pVertOrientRelState && TextContentAnchorType_AT_PARAGRAPH != eAnchor &&
+ TextContentAnchorType_AT_CHARACTER != eAnchor )
+ pVertOrientRelState->mnIndex = -1;
+ if( pVertOrientRelPageState && TextContentAnchorType_AT_PAGE != eAnchor )
+ pVertOrientRelPageState->mnIndex = -1;
+ if( pVertOrientRelFrameState && TextContentAnchorType_AT_FRAME != eAnchor )
+ pVertOrientRelFrameState->mnIndex = -1;
+ if( pVertOrientRelAsCharState && TextContentAnchorType_AS_CHARACTER != eAnchor )
+ pVertOrientRelAsCharState->mnIndex = -1;
+ }
+
+ // States for shape positioning properties (#i28749#)
+ if ( eAnchor != TextContentAnchorType_AS_CHARACTER &&
+ ( GetExport().getExportFlags() & EXPORT_OASIS ) == 0 )
+ {
+ // no export of shape positioning properties,
+ // if shape isn't anchored as-character and
+ // destination file format is OpenOffice.org file format
+ if ( pShapeHoriOrientState )
+ pShapeHoriOrientState->mnIndex = -1;
+ if ( pShapeHoriOrientMirroredState )
+ pShapeHoriOrientMirroredState->mnIndex = -1;
+ if ( pShapeHoriOrientRelState )
+ pShapeHoriOrientRelState->mnIndex = -1;
+ if ( pShapeHoriOrientRelFrameState )
+ pShapeHoriOrientRelFrameState->mnIndex = -1;
+ if ( pShapeHoriOrientMirrorState )
+ pShapeHoriOrientMirrorState->mnIndex = -1;
+ if ( pShapeVertOrientState )
+ pShapeVertOrientState->mnIndex = -1;
+ if ( pShapeVertOrientAtCharState )
+ pShapeVertOrientAtCharState->mnIndex = -1;
+ if ( pShapeVertOrientRelState )
+ pShapeVertOrientRelState->mnIndex = -1;
+ if ( pShapeVertOrientRelPageState )
+ pShapeVertOrientRelPageState->mnIndex = -1;
+ if ( pShapeVertOrientRelFrameState )
+ pShapeVertOrientRelFrameState->mnIndex = -1;
+ }
+ else
+ {
+ // handling of shape positioning property states as for frames - see above
+ if( pShapeHoriOrientState && pShapeHoriOrientMirroredState )
+ {
+ if( pShapeHoriOrientMirrorState &&
+ *(sal_Bool *)pShapeHoriOrientMirrorState->maValue.getValue() )
+ pShapeHoriOrientState->mnIndex = -1;
+ else
+ pShapeHoriOrientMirroredState->mnIndex = -1;
+ }
+ if( pShapeHoriOrientMirrorState )
+ pShapeHoriOrientMirrorState->mnIndex = -1;
+
+ if( pShapeHoriOrientRelState && TextContentAnchorType_AT_FRAME == eAnchor )
+ pShapeHoriOrientRelState->mnIndex = -1;
+ if( pShapeHoriOrientRelFrameState && TextContentAnchorType_AT_FRAME != eAnchor )
+ pShapeHoriOrientRelFrameState->mnIndex = -1;;
+
+ if( pShapeVertOrientState && TextContentAnchorType_AT_CHARACTER == eAnchor )
+ pShapeVertOrientState->mnIndex = -1;
+ if( pShapeVertOrientAtCharState && TextContentAnchorType_AT_CHARACTER != eAnchor )
+ pShapeVertOrientAtCharState->mnIndex = -1;
+ if( pShapeVertOrientRelState && TextContentAnchorType_AT_PARAGRAPH != eAnchor &&
+ TextContentAnchorType_AT_CHARACTER != eAnchor )
+ pShapeVertOrientRelState->mnIndex = -1;
+ if( pShapeVertOrientRelPageState && TextContentAnchorType_AT_PAGE != eAnchor )
+ pShapeVertOrientRelPageState->mnIndex = -1;
+ if( pShapeVertOrientRelFrameState && TextContentAnchorType_AT_FRAME != eAnchor )
+ pShapeVertOrientRelFrameState->mnIndex = -1;
+ }
+
+ // list style name: remove list style if it is the default outline style
+ if( pListStyleName != NULL )
+ {
+ OUString sListStyleName;
+ pListStyleName->maValue >>= sListStyleName;
+ if( lcl_IsOutlineStyle( GetExport(), sListStyleName ) )
+ pListStyleName->mnIndex = -1;
+ }
+
+ if( pClipState != NULL && pClip11State != NULL )
+ pClip11State->mnIndex = -1;
+
+ SvXMLExportPropertyMapper::ContextFilter(rProperties,rPropSet);
+}
+
+
+bool lcl_IsOutlineStyle(const SvXMLExport &rExport, const OUString & rName)
+{
+ Reference< XChapterNumberingSupplier >
+ xCNSupplier(rExport.GetModel(), UNO_QUERY);
+
+ OUString sOutlineName;
+ OUString sName(RTL_CONSTASCII_USTRINGPARAM("Name"));
+
+ if (xCNSupplier.is())
+ {
+ Reference<XPropertySet> xNumRule(
+ xCNSupplier->getChapterNumberingRules(), UNO_QUERY );
+ DBG_ASSERT( xNumRule.is(), "no chapter numbering rules" );
+ if (xNumRule.is())
+ {
+ xNumRule->getPropertyValue(sName) >>= sOutlineName;
+ }
+ }
+
+ return rName == sOutlineName;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/txtexppr.hxx b/xmloff/source/text/txtexppr.hxx
new file mode 100644
index 000000000000..98c6d6e0514c
--- /dev/null
+++ b/xmloff/source/text/txtexppr.hxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_TXTEXPPR_HXX
+#define _XMLOFF_TXTEXPPR_HXX
+
+
+#include <xmloff/xmlexppr.hxx>
+#include "txtdrope.hxx"
+#include "xmloff/xmltabe.hxx"
+#include "XMLTextColumnsExport.hxx"
+#include "XMLBackgroundImageExport.hxx"
+
+class SvXMLExport;
+class XMLTextExportPropertySetMapper: public SvXMLExportPropertyMapper
+{
+ SvXMLExport& rExport;
+
+ ::rtl::OUString sDropCharStyle;
+ sal_Bool bDropWholeWord;
+
+ void ContextFontFilter(
+ XMLPropertyState *pFontNameState,
+ XMLPropertyState *pFontFamilyNameState,
+ XMLPropertyState *pFontStyleNameState,
+ XMLPropertyState *pFontFamilyState,
+ XMLPropertyState *pFontPitchState,
+ XMLPropertyState *pFontCharsetState ) const;
+ void ContextFontHeightFilter(
+ XMLPropertyState* pCharHeightState,
+ XMLPropertyState* pCharPropHeightState,
+ XMLPropertyState* pCharDiffHeightState ) const;
+
+protected:
+// SvXMLUnitConverter& mrUnitConverter;
+// const Reference< xml::sax::XDocumentHandler > & mrHandler;
+ XMLTextDropCapExport maDropCapExport;
+ SvxXMLTabStopExport maTabStopExport;
+ XMLTextColumnsExport maTextColumnsExport;
+ XMLBackgroundImageExport maBackgroundImageExport;
+
+ /** Application-specific filter. By default do nothing. */
+ virtual void ContextFilter(
+ ::std::vector< XMLPropertyState >& rProperties,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > rPropSet ) const;
+ const SvXMLExport& GetExport() const { return rExport; }
+
+public:
+
+ XMLTextExportPropertySetMapper(
+ const UniReference< XMLPropertySetMapper >& rMapper,
+ SvXMLExport& rExt );
+ virtual ~XMLTextExportPropertySetMapper();
+
+ virtual void handleElementItem(
+ SvXMLExport& rExport,
+ const XMLPropertyState& rProperty,
+ sal_uInt16 nFlags,
+ const ::std::vector< XMLPropertyState > *pProperties = 0,
+ sal_uInt32 nIdx = 0 ) const;
+
+ virtual void handleSpecialItem(
+ SvXMLAttributeList& rAttrList,
+ const XMLPropertyState& rProperty,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ const ::std::vector< XMLPropertyState > *pProperties = 0,
+ sal_uInt32 nIdx = 0 ) const;
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx
new file mode 100644
index 000000000000..0e4f6b54cb3a
--- /dev/null
+++ b/xmloff/source/text/txtflde.cxx
@@ -0,0 +1,3621 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+/** @#file
+ *
+ * export of all text fields
+ */
+#include "txtflde.hxx"
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmlnumfe.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlement.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmlnume.hxx>
+#include "xmloff/numehelp.hxx"
+
+#include <xmloff/families.hxx>
+#include <xmloff/XMLEventExport.hxx>
+#include "XMLTextCharStyleNamesElementExport.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/text/UserDataPart.hpp>
+#include <com/sun/star/text/PageNumberType.hpp>
+#include <com/sun/star/style/NumberingType.hpp>
+#include <com/sun/star/text/ReferenceFieldPart.hpp>
+#include <com/sun/star/text/ReferenceFieldSource.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/text/XTextField.hpp>
+#include <com/sun/star/text/XDependentTextField.hpp>
+#include <com/sun/star/text/XTextFieldsSupplier.hpp>
+
+#include <com/sun/star/text/SetVariableType.hpp>
+#include <com/sun/star/text/PlaceholderType.hpp>
+#include <com/sun/star/text/FilenameDisplayFormat.hpp>
+#include <com/sun/star/text/ChapterFormat.hpp>
+#include <com/sun/star/text/TemplateDisplayFormat.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/container/XNameReplace.hpp>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/util/NumberFormat.hpp>
+#include <com/sun/star/text/BibliographyDataType.hpp>
+#include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/rdf/XMetadatable.hpp>
+#include <rtl/ustrbuf.hxx>
+#include <tools/debug.hxx>
+#include <rtl/math.hxx>
+
+#include <vector>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::std;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::document;
+using namespace ::com::sun::star::container;
+using namespace ::xmloff::token;
+
+
+static sal_Char const FIELD_SERVICE_SENDER[] = "ExtendedUser";
+static sal_Char const FIELD_SERVICE_AUTHOR[] = "Author";
+static sal_Char const FIELD_SERVICE_JUMPEDIT[] = "JumpEdit";
+static sal_Char const FIELD_SERVICE_GETEXP[] = "GetExpression";
+static sal_Char const FIELD_SERVICE_SETEXP[] = "SetExpression";
+static sal_Char const FIELD_SERVICE_USER[] = "User";
+static sal_Char const FIELD_SERVICE_INPUT[] = "Input";
+static sal_Char const FIELD_SERVICE_USERINPUT[] = "InputUser";
+static sal_Char const FIELD_SERVICE_DATETIME[] = "DateTime";
+static sal_Char const FIELD_SERVICE_PAGENUMBER[] = "PageNumber";
+static sal_Char const FIELD_SERVICE_DB_NEXT[] = "DatabaseNextSet";
+static sal_Char const FIELD_SERVICE_DB_SELECT[] = "DatabaseNumberOfSet";
+static sal_Char const FIELD_SERVICE_DB_NUMBER[] = "DatabaseSetNumber";
+static sal_Char const FIELD_SERVICE_DB_DISPLAY[] = "Database";
+static sal_Char const FIELD_SERVICE_DB_NAME[] = "DatabaseName";
+static sal_Char const FIELD_SERVICE_CONDITIONAL_TEXT[] = "ConditionalText";
+static sal_Char const FIELD_SERVICE_HIDDEN_TEXT[] = "HiddenText";
+static sal_Char const FIELD_SERVICE_HIDDEN_PARAGRAPH[] = "HiddenParagraph";
+static sal_Char const FIELD_SERVICE_DOC_INFO_CHANGE_AUTHOR[] = "DocInfo.ChangeAuthor";
+static sal_Char const FIELD_SERVICE_DOC_INFO_CHANGE_AUTHOR2[] = "docinfo.ChangeAuthor";
+static sal_Char const FIELD_SERVICE_DOC_INFO_CHANGE_DATE_TIME[] = "DocInfo.ChangeDateTime";
+static sal_Char const FIELD_SERVICE_DOC_INFO_CHANGE_DATE_TIME2[] = "docinfo.ChangeDateTime";
+static sal_Char const FIELD_SERVICE_DOC_INFO_EDIT_TIME[] = "DocInfo.EditTime";
+static sal_Char const FIELD_SERVICE_DOC_INFO_EDIT_TIME2[] = "docinfo.EditTime";
+static sal_Char const FIELD_SERVICE_DOC_INFO_DESCRIPTION[] = "DocInfo.Description";
+static sal_Char const FIELD_SERVICE_DOC_INFO_DESCRIPTION2[] = "docinfo.Description";
+static sal_Char const FIELD_SERVICE_DOC_INFO_CREATE_AUTHOR[] = "DocInfo.CreateAuthor";
+static sal_Char const FIELD_SERVICE_DOC_INFO_CREATE_AUTHOR2[] = "docinfo.CreateAuthor";
+static sal_Char const FIELD_SERVICE_DOC_INFO_CREATE_DATE_TIME[] = "DocInfo.CreateDateTime";
+static sal_Char const FIELD_SERVICE_DOC_INFO_CREATE_DATE_TIME2[] = "docinfo.CreateDateTime";
+static sal_Char const FIELD_SERVICE_DOC_INFO_CUSTOM[] = "DocInfo.Custom";
+static sal_Char const FIELD_SERVICE_DOC_INFO_CUSTOM2[] = "docinfo.Custom";
+static sal_Char const FIELD_SERVICE_DOC_INFO_PRINT_AUTHOR[] = "DocInfo.PrintAuthor";
+static sal_Char const FIELD_SERVICE_DOC_INFO_PRINT_AUTHOR2[] = "docinfo.PrintAuthor";
+static sal_Char const FIELD_SERVICE_DOC_INFO_PRINT_DATE_TIME[] = "DocInfo.PrintDateTime";
+static sal_Char const FIELD_SERVICE_DOC_INFO_PRINT_DATE_TIME2[] = "docinfo.PrintDateTime";
+static sal_Char const FIELD_SERVICE_DOC_INFO_KEY_WORDS[] = "DocInfo.KeyWords";
+static sal_Char const FIELD_SERVICE_DOC_INFO_KEY_WORDS2[] = "docinfo.KeyWords";
+static sal_Char const FIELD_SERVICE_DOC_INFO_SUBJECT[] = "DocInfo.Subject";
+static sal_Char const FIELD_SERVICE_DOC_INFO_SUBJECT2[] = "docinfo.Subject";
+static sal_Char const FIELD_SERVICE_DOC_INFO_TITLE[] = "DocInfo.Title";
+static sal_Char const FIELD_SERVICE_DOC_INFO_TITLE2[] = "docinfo.Title";
+static sal_Char const FIELD_SERVICE_DOC_INFO_REVISION[] = "DocInfo.Revision";
+static sal_Char const FIELD_SERVICE_DOC_INFO_REVISION2[] = "docinfo.Revision";
+static sal_Char const FIELD_SERVICE_FILE_NAME[] = "FileName";
+static sal_Char const FIELD_SERVICE_CHAPTER[] = "Chapter";
+static sal_Char const FIELD_SERVICE_TEMPLATE_NAME[] = "TemplateName";
+static sal_Char const FIELD_SERVICE_PAGE_COUNT[] = "PageCount";
+static sal_Char const FIELD_SERVICE_PARAGRAPH_COUNT[] = "ParagraphCount";
+static sal_Char const FIELD_SERVICE_WORD_COUNT[] = "WordCount";
+static sal_Char const FIELD_SERVICE_CHARACTER_COUNT[] = "CharacterCount";
+static sal_Char const FIELD_SERVICE_TABLE_COUNT[] = "TableCount";
+static sal_Char const FIELD_SERVICE_GRAPHIC_COUNT[] = "GraphicObjectCount";
+static sal_Char const FIELD_SERVICE_OBJECT_COUNT[] = "EmbeddedObjectCount";
+static sal_Char const FIELD_SERVICE_REFERENCE_PAGE_SET[] = "ReferencePageSet";
+static sal_Char const FIELD_SERVICE_REFERENCE_PAGE_GET[] = "ReferencePageGet";
+static sal_Char const FIELD_SERVICE_SHEET_NAME[] = "SheetName";
+static sal_Char const FIELD_SERVICE_MACRO[] = "Macro";
+static sal_Char const FIELD_SERVICE_GET_REFERENCE[] = "GetReference";
+static sal_Char const FIELD_SERVICE_DDE[] = "DDE";
+static sal_Char const FIELD_SERVICE_URL[] = "URL";
+static sal_Char const FIELD_SERVICE_BIBLIOGRAPHY[] = "Bibliography";
+static sal_Char const FIELD_SERVICE_SCRIPT[] = "Script";
+static sal_Char const FIELD_SERVICE_ANNOTATION[] = "Annotation";
+static sal_Char const FIELD_SERVICE_COMBINED_CHARACTERS[] = "CombinedCharacters";
+static sal_Char const FIELD_SERVICE_META[] = "MetadataField";
+static sal_Char const FIELD_SERVICE_MEASURE[] = "Measure";
+static sal_Char const FIELD_SERVICE_TABLE_FORMULA[] = "TableFormula";
+static sal_Char const FIELD_SERVICE_DROP_DOWN[] = "DropDown";
+
+SvXMLEnumStringMapEntry const aFieldServiceNameMapping[] =
+{
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_SENDER, FIELD_ID_SENDER ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_AUTHOR, FIELD_ID_AUTHOR ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_JUMPEDIT, FIELD_ID_PLACEHOLDER ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_GETEXP, FIELD_ID_VARIABLE_GET ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_SETEXP, FIELD_ID_VARIABLE_SET ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_USER, FIELD_ID_USER_GET ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_INPUT, FIELD_ID_TEXT_INPUT ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_USERINPUT, FIELD_ID_USER_INPUT ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DATETIME, FIELD_ID_TIME ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_PAGENUMBER, FIELD_ID_PAGENUMBER ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_REFERENCE_PAGE_SET, FIELD_ID_REFPAGE_SET ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_REFERENCE_PAGE_GET, FIELD_ID_REFPAGE_GET ),
+
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DB_NEXT, FIELD_ID_DATABASE_NEXT ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DB_SELECT, FIELD_ID_DATABASE_SELECT ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DB_NUMBER, FIELD_ID_DATABASE_NUMBER ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DB_DISPLAY, FIELD_ID_DATABASE_DISPLAY ),
+ // workaround for #no-bug#: Database/DataBase
+ ENUM_STRING_MAP_ENTRY( "DataBase", FIELD_ID_DATABASE_DISPLAY ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DB_NAME, FIELD_ID_DATABASE_NAME ),
+
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CREATE_AUTHOR, FIELD_ID_DOCINFO_CREATION_AUTHOR ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CREATE_AUTHOR2, FIELD_ID_DOCINFO_CREATION_AUTHOR ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CREATE_DATE_TIME, FIELD_ID_DOCINFO_CREATION_TIME),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CREATE_DATE_TIME2, FIELD_ID_DOCINFO_CREATION_TIME),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CHANGE_AUTHOR, FIELD_ID_DOCINFO_SAVE_AUTHOR ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CHANGE_AUTHOR2, FIELD_ID_DOCINFO_SAVE_AUTHOR ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CHANGE_DATE_TIME, FIELD_ID_DOCINFO_SAVE_TIME ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CHANGE_DATE_TIME2, FIELD_ID_DOCINFO_SAVE_TIME ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_EDIT_TIME, FIELD_ID_DOCINFO_EDIT_DURATION ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_EDIT_TIME2, FIELD_ID_DOCINFO_EDIT_DURATION ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_DESCRIPTION, FIELD_ID_DOCINFO_DESCRIPTION ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_DESCRIPTION2, FIELD_ID_DOCINFO_DESCRIPTION ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CUSTOM, FIELD_ID_DOCINFO_CUSTOM ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CUSTOM2, FIELD_ID_DOCINFO_CUSTOM ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_PRINT_AUTHOR, FIELD_ID_DOCINFO_PRINT_AUTHOR ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_PRINT_AUTHOR2, FIELD_ID_DOCINFO_PRINT_AUTHOR ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_PRINT_DATE_TIME, FIELD_ID_DOCINFO_PRINT_TIME ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_PRINT_DATE_TIME2, FIELD_ID_DOCINFO_PRINT_TIME ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_KEY_WORDS, FIELD_ID_DOCINFO_KEYWORDS ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_KEY_WORDS2, FIELD_ID_DOCINFO_KEYWORDS ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_SUBJECT, FIELD_ID_DOCINFO_SUBJECT ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_SUBJECT2, FIELD_ID_DOCINFO_SUBJECT ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_TITLE, FIELD_ID_DOCINFO_TITLE ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_TITLE2, FIELD_ID_DOCINFO_TITLE ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_REVISION, FIELD_ID_DOCINFO_REVISION ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_REVISION2, FIELD_ID_DOCINFO_REVISION ),
+
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_CONDITIONAL_TEXT, FIELD_ID_CONDITIONAL_TEXT ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_HIDDEN_TEXT, FIELD_ID_HIDDEN_TEXT ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_HIDDEN_PARAGRAPH, FIELD_ID_HIDDEN_PARAGRAPH ),
+
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_FILE_NAME, FIELD_ID_FILE_NAME ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_CHAPTER, FIELD_ID_CHAPTER ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_TEMPLATE_NAME, FIELD_ID_TEMPLATE_NAME ),
+
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_PAGE_COUNT, FIELD_ID_COUNT_PAGES ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_PARAGRAPH_COUNT, FIELD_ID_COUNT_PARAGRAPHS ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_WORD_COUNT, FIELD_ID_COUNT_WORDS ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_CHARACTER_COUNT, FIELD_ID_COUNT_CHARACTERS ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_TABLE_COUNT, FIELD_ID_COUNT_TABLES ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_GRAPHIC_COUNT, FIELD_ID_COUNT_GRAPHICS ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_OBJECT_COUNT, FIELD_ID_COUNT_OBJECTS ),
+
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_MACRO, FIELD_ID_MACRO ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_GET_REFERENCE, FIELD_ID_REF_REFERENCE ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DDE, FIELD_ID_DDE ),
+
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_BIBLIOGRAPHY, FIELD_ID_BIBLIOGRAPHY ),
+
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_SCRIPT, FIELD_ID_SCRIPT ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_ANNOTATION, FIELD_ID_ANNOTATION ),
+
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_COMBINED_CHARACTERS, FIELD_ID_COMBINED_CHARACTERS ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_META, FIELD_ID_META ),
+
+ // non-writer fields
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_SHEET_NAME, FIELD_ID_SHEET_NAME ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_URL, FIELD_ID_URL ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_MEASURE, FIELD_ID_MEASURE ),
+
+ // deprecated fields
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_TABLE_FORMULA, FIELD_ID_TABLE_FORMULA ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DROP_DOWN, FIELD_ID_DROP_DOWN ),
+
+ ENUM_STRING_MAP_END()
+};
+
+
+
+// property accessor helper functions
+inline sal_Bool GetBoolProperty(const OUString&,
+ const Reference<XPropertySet> &);
+inline sal_Bool GetOptionalBoolProperty(const OUString&,
+ const Reference<XPropertySet> &,
+ const Reference<XPropertySetInfo> &,
+ sal_Bool bDefault);
+inline double GetDoubleProperty(const OUString&,
+ const Reference<XPropertySet> &);
+inline OUString const GetStringProperty(const OUString&,
+ const Reference<XPropertySet> &);
+inline sal_Int32 GetIntProperty(const OUString&,
+ const Reference<XPropertySet> &);
+inline sal_Int16 GetInt16Property(const OUString&,
+ const Reference<XPropertySet> &);
+inline sal_Int8 GetInt8Property(const OUString&,
+ const Reference<XPropertySet> &);
+inline DateTime const GetDateTimeProperty( const OUString& sPropName,
+ const Reference<XPropertySet> & xPropSet);
+inline Date const GetDateProperty( const OUString& sPropName,
+ const Reference<XPropertySet> & xPropSet);
+inline Sequence<OUString> const GetStringSequenceProperty(
+ const OUString& sPropName,
+ const Reference<XPropertySet> & xPropSet);
+
+
+
+XMLTextFieldExport::XMLTextFieldExport( SvXMLExport& rExp,
+ XMLPropertyState* pCombinedCharState)
+ : rExport(rExp),
+ pUsedMasters(NULL),
+ sServicePrefix(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.textfield.")),
+ sFieldMasterPrefix(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.FieldMaster.")),
+ sPresentationServicePrefix(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.TextField.")),
+
+ sPropertyAdjust(RTL_CONSTASCII_USTRINGPARAM("Adjust")),
+ sPropertyAuthor(RTL_CONSTASCII_USTRINGPARAM("Author")),
+ sPropertyChapterFormat(RTL_CONSTASCII_USTRINGPARAM("ChapterFormat")),
+ sPropertyChapterNumberingLevel(RTL_CONSTASCII_USTRINGPARAM("ChapterNumberingLevel")),
+ sPropertyCharStyleNames(RTL_CONSTASCII_USTRINGPARAM("CharStyleNames")),
+ sPropertyCondition(RTL_CONSTASCII_USTRINGPARAM("Condition")),
+ sPropertyContent(RTL_CONSTASCII_USTRINGPARAM("Content")),
+ sPropertyDataBaseName(RTL_CONSTASCII_USTRINGPARAM("DataBaseName")),
+ sPropertyDataBaseURL(RTL_CONSTASCII_USTRINGPARAM("DataBaseURL")),
+ sPropertyDataColumnName(RTL_CONSTASCII_USTRINGPARAM("DataColumnName")),
+ sPropertyDataCommandType(RTL_CONSTASCII_USTRINGPARAM("DataCommandType")),
+ sPropertyDataTableName(RTL_CONSTASCII_USTRINGPARAM("DataTableName")),
+ sPropertyDate(RTL_CONSTASCII_USTRINGPARAM("Date")),
+ sPropertyDateTime(RTL_CONSTASCII_USTRINGPARAM("DateTime")),
+ sPropertyDateTimeValue(RTL_CONSTASCII_USTRINGPARAM("DateTimeValue")),
+ sPropertyDDECommandElement(RTL_CONSTASCII_USTRINGPARAM("DDECommandElement")),
+ sPropertyDDECommandFile(RTL_CONSTASCII_USTRINGPARAM("DDECommandFile")),
+ sPropertyDDECommandType(RTL_CONSTASCII_USTRINGPARAM("DDECommandType")),
+ sPropertyDependentTextFields(RTL_CONSTASCII_USTRINGPARAM("DependentTextFields")),
+ sPropertyFalseContent(RTL_CONSTASCII_USTRINGPARAM("FalseContent")),
+ sPropertyFields(RTL_CONSTASCII_USTRINGPARAM("Fields")),
+ sPropertyFieldSubType(RTL_CONSTASCII_USTRINGPARAM("UserDataType")),
+ sPropertyFileFormat(RTL_CONSTASCII_USTRINGPARAM("FileFormat")),
+ sPropertyFullName(RTL_CONSTASCII_USTRINGPARAM("FullName")),
+ sPropertyHint(RTL_CONSTASCII_USTRINGPARAM("Hint")),
+ sPropertyInstanceName(RTL_CONSTASCII_USTRINGPARAM("InstanceName")),
+ sPropertyIsAutomaticUpdate(RTL_CONSTASCII_USTRINGPARAM("IsAutomaticUpdate")),
+ sPropertyIsConditionTrue(RTL_CONSTASCII_USTRINGPARAM("IsConditionTrue")),
+ sPropertyIsDataBaseFormat(RTL_CONSTASCII_USTRINGPARAM("DataBaseFormat")),
+ sPropertyIsDate(RTL_CONSTASCII_USTRINGPARAM("IsDate")),
+ sPropertyIsExpression(RTL_CONSTASCII_USTRINGPARAM("IsExpression")),
+ sPropertyIsFixed(RTL_CONSTASCII_USTRINGPARAM("IsFixed")),
+ sPropertyIsFixedLanguage(RTL_CONSTASCII_USTRINGPARAM("IsFixedLanguage")),
+ sPropertyIsHidden(RTL_CONSTASCII_USTRINGPARAM("IsHidden")),
+ sPropertyIsInput(RTL_CONSTASCII_USTRINGPARAM("Input")),
+ sPropertyIsShowFormula(RTL_CONSTASCII_USTRINGPARAM("IsShowFormula")),
+ sPropertyIsVisible(RTL_CONSTASCII_USTRINGPARAM("IsVisible")),
+ sPropertyItems(RTL_CONSTASCII_USTRINGPARAM("Items")),
+ sPropertyLevel(RTL_CONSTASCII_USTRINGPARAM("Level")),
+ sPropertyMacro(RTL_CONSTASCII_USTRINGPARAM("Macro")),
+ sPropertyMeasureKind(RTL_CONSTASCII_USTRINGPARAM("Kind")),
+ sPropertyName(RTL_CONSTASCII_USTRINGPARAM("Name")),
+ sPropertyNumberFormat(RTL_CONSTASCII_USTRINGPARAM("NumberFormat")),
+ sPropertyNumberingSeparator(RTL_CONSTASCII_USTRINGPARAM("NumberingSeparator")),
+ sPropertyNumberingType(RTL_CONSTASCII_USTRINGPARAM("NumberingType")),
+ sPropertyOffset(RTL_CONSTASCII_USTRINGPARAM("Offset")),
+ sPropertyOn(RTL_CONSTASCII_USTRINGPARAM("On")),
+ sPropertyPlaceholder(RTL_CONSTASCII_USTRINGPARAM("PlaceHolder")),
+ sPropertyPlaceholderType(RTL_CONSTASCII_USTRINGPARAM("PlaceHolderType")),
+ sPropertyReferenceFieldPart(RTL_CONSTASCII_USTRINGPARAM("ReferenceFieldPart")),
+ sPropertyReferenceFieldSource(RTL_CONSTASCII_USTRINGPARAM("ReferenceFieldSource")),
+ sPropertyReferenceFieldType(RTL_CONSTASCII_USTRINGPARAM("ReferenceFieldType")),
+ sPropertyRevision(RTL_CONSTASCII_USTRINGPARAM("Revision")),
+ sPropertyScriptType(RTL_CONSTASCII_USTRINGPARAM("ScriptType")),
+ sPropertySelectedItem(RTL_CONSTASCII_USTRINGPARAM("SelectedItem")),
+ sPropertySequenceNumber(RTL_CONSTASCII_USTRINGPARAM("SequenceNumber")),
+ sPropertySequenceValue(RTL_CONSTASCII_USTRINGPARAM("SequenceValue")),
+ sPropertySetNumber(RTL_CONSTASCII_USTRINGPARAM("SetNumber")),
+ sPropertySourceName(RTL_CONSTASCII_USTRINGPARAM("SourceName")),
+ sPropertySubType(RTL_CONSTASCII_USTRINGPARAM("SubType")),
+ sPropertyTargetFrame(RTL_CONSTASCII_USTRINGPARAM("TargetFrame")),
+ sPropertyTrueContent(RTL_CONSTASCII_USTRINGPARAM("TrueContent")),
+ sPropertyURL(RTL_CONSTASCII_USTRINGPARAM("URL")),
+ sPropertyURLContent(RTL_CONSTASCII_USTRINGPARAM("URLContent")),
+ sPropertyUserText(RTL_CONSTASCII_USTRINGPARAM("UserText")),
+ sPropertyValue(RTL_CONSTASCII_USTRINGPARAM("Value")),
+ sPropertyVariableName(RTL_CONSTASCII_USTRINGPARAM("VariableName")),
+ sPropertyVariableSubType(RTL_CONSTASCII_USTRINGPARAM("VariableSubtype")),
+ sPropertyHelp(RTL_CONSTASCII_USTRINGPARAM("Help")),
+ sPropertyTooltip(RTL_CONSTASCII_USTRINGPARAM("Tooltip")),
+ sPropertyTextRange(RTL_CONSTASCII_USTRINGPARAM("TextRange")),
+ pCombinedCharactersPropertyState(pCombinedCharState)
+{
+ SetExportOnlyUsedFieldDeclarations();
+}
+
+XMLTextFieldExport::~XMLTextFieldExport()
+{
+ delete pCombinedCharactersPropertyState;
+ delete pUsedMasters;
+}
+
+/// get the field ID (as in FieldIDEnum) from XTextField
+enum FieldIdEnum XMLTextFieldExport::GetFieldID(
+ const Reference<XTextField> & rTextField,
+ const Reference<XPropertySet> & xPropSet)
+{
+ // get service names for rTextField (via XServiceInfo service)
+ Reference<XServiceInfo> xService(rTextField, UNO_QUERY);
+ const Sequence<OUString> aServices = xService->getSupportedServiceNames();
+ const OUString* pNames = aServices.getConstArray();
+ sal_Int32 nCount = aServices.getLength();
+
+ OUString sFieldName; // service name postfix of current field
+
+ // search for TextField service name
+ while( nCount-- )
+ {
+ if (pNames->matchIgnoreAsciiCase(sServicePrefix))
+ {
+ // TextField found => postfix is field type!
+ sFieldName = pNames->copy(sServicePrefix.getLength());
+ break;
+ }
+
+ ++pNames;
+ }
+
+ // if this is not a normal text field, check if its a presentation text field
+ if( sFieldName.getLength() == 0 )
+ {
+ const OUString* pNames2 = aServices.getConstArray();
+ sal_Int32 nCount2 = aServices.getLength();
+ // search for TextField service name
+ while( nCount2-- )
+ {
+ if( 0 == pNames2->compareTo(sPresentationServicePrefix, sPresentationServicePrefix.getLength()))
+ {
+ // TextField found => postfix is field type!
+ sFieldName = pNames2->copy(sPresentationServicePrefix.getLength());
+ break;
+ }
+
+ ++pNames2;
+ }
+
+ if( sFieldName.getLength() != 0 )
+ {
+ if( sFieldName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "Header" ) ) == 0 )
+ {
+ return FIELD_ID_DRAW_HEADER;
+ }
+ else if( sFieldName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "Footer" ) ) == 0 )
+ {
+ return FIELD_ID_DRAW_FOOTER;
+ }
+ else if( sFieldName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "DateTime" ) ) == 0 )
+ {
+ return FIELD_ID_DRAW_DATE_TIME;
+ }
+ }
+ }
+
+ // map postfix of service name to field ID
+ DBG_ASSERT(sFieldName.getLength()>0, "no TextField service found!");
+ return MapFieldName(sFieldName, xPropSet);
+}
+
+enum FieldIdEnum XMLTextFieldExport::MapFieldName(
+ const OUString& sFieldName, // field (master) name
+ const Reference<XPropertySet> & xPropSet) // for subtype
+{
+ // we'll proceed in 2 steps:
+ // a) map service name to preliminary FIELD_ID
+ // b) map those prelim. FIELD_IDs that correspond to several field types
+ // (in our (XML) world) to final FIELD IDs
+
+
+ // a) find prelim. FIELD_ID via aFieldServiceMapping
+
+ // check for non-empty service name
+ DBG_ASSERT(sFieldName.getLength()>0, "no valid service name!");
+ enum FieldIdEnum nToken = FIELD_ID_UNKNOWN;
+ if (sFieldName.getLength() > 0)
+ {
+ // map name to prelim. ID
+ sal_uInt16 nTmp;
+ sal_Bool bRet = GetExport().GetMM100UnitConverter().convertEnum(
+ nTmp, sFieldName, aFieldServiceNameMapping);
+
+ // check return
+ DBG_ASSERT(bRet, "Unknown field service name encountered!");
+ if (! bRet)
+ {
+ nToken = FIELD_ID_UNKNOWN;
+ }
+ else
+ {
+ nToken = (enum FieldIdEnum)nTmp;
+ }
+ } else {
+ // invalid service name
+ nToken = FIELD_ID_UNKNOWN;
+ }
+
+ // b) map prelim. to final FIELD_IDs
+ switch (nToken) {
+ case FIELD_ID_VARIABLE_SET:
+ if (GetBoolProperty(sPropertyIsInput, xPropSet))
+ {
+ nToken = FIELD_ID_VARIABLE_INPUT;
+ }
+ else
+ {
+ switch (GetIntProperty(sPropertySubType, xPropSet))
+ {
+ case SetVariableType::STRING: // text field
+ case SetVariableType::VAR: // num field
+ nToken = FIELD_ID_VARIABLE_SET;
+ break;
+ case SetVariableType::SEQUENCE:
+ nToken = FIELD_ID_SEQUENCE;
+ break;
+ case SetVariableType::FORMULA:
+ default:
+ nToken = FIELD_ID_UNKNOWN;
+ break;
+ }
+ }
+ break;
+
+ case FIELD_ID_VARIABLE_GET:
+ switch (GetIntProperty(sPropertySubType, xPropSet))
+ {
+ case SetVariableType::STRING: // text field
+ case SetVariableType::VAR: // num field
+ nToken = FIELD_ID_VARIABLE_GET;
+ break;
+ case SetVariableType::FORMULA:
+ nToken = FIELD_ID_EXPRESSION;
+ break;
+ case SetVariableType::SEQUENCE:
+ default:
+ nToken = FIELD_ID_UNKNOWN;
+ break;
+ }
+ break;
+
+ case FIELD_ID_TIME:
+ if (GetBoolProperty(sPropertyIsDate, xPropSet))
+ {
+ nToken = FIELD_ID_DATE;
+ }
+ break;
+
+ case FIELD_ID_PAGENUMBER:
+ // NumberingType not available in non-Writer apps
+ if (xPropSet->getPropertySetInfo()->
+ hasPropertyByName(sPropertyNumberingType))
+ {
+ if (NumberingType::CHAR_SPECIAL == GetIntProperty(
+ sPropertyNumberingType, xPropSet))
+ {
+ nToken = FIELD_ID_PAGESTRING;
+ }
+ }
+ break;
+
+ case FIELD_ID_DOCINFO_CREATION_TIME:
+ if (GetBoolProperty(sPropertyIsDate, xPropSet))
+ {
+ nToken = FIELD_ID_DOCINFO_CREATION_DATE;
+ }
+ break;
+
+ case FIELD_ID_DOCINFO_PRINT_TIME:
+ if (GetBoolProperty(sPropertyIsDate, xPropSet))
+ {
+ nToken = FIELD_ID_DOCINFO_PRINT_DATE;
+ }
+ break;
+
+ case FIELD_ID_DOCINFO_SAVE_TIME:
+ if (GetBoolProperty(sPropertyIsDate, xPropSet))
+ {
+ nToken = FIELD_ID_DOCINFO_SAVE_DATE;
+ }
+ break;
+
+ case FIELD_ID_REF_REFERENCE:
+ switch (GetInt16Property(sPropertyReferenceFieldSource, xPropSet))
+ {
+ case ReferenceFieldSource::REFERENCE_MARK:
+ nToken = FIELD_ID_REF_REFERENCE;
+ break;
+ case ReferenceFieldSource::SEQUENCE_FIELD:
+ nToken = FIELD_ID_REF_SEQUENCE;
+ break;
+ case ReferenceFieldSource::BOOKMARK:
+ nToken = FIELD_ID_REF_BOOKMARK;
+ break;
+ case ReferenceFieldSource::FOOTNOTE:
+ nToken = FIELD_ID_REF_FOOTNOTE;
+ break;
+ case ReferenceFieldSource::ENDNOTE:
+ nToken = FIELD_ID_REF_ENDNOTE;
+ break;
+ default:
+ nToken = FIELD_ID_UNKNOWN;
+ break;
+ }
+ break;
+
+ case FIELD_ID_COMBINED_CHARACTERS:
+ case FIELD_ID_SCRIPT:
+ case FIELD_ID_ANNOTATION:
+ case FIELD_ID_BIBLIOGRAPHY:
+ case FIELD_ID_DDE:
+ case FIELD_ID_MACRO:
+ case FIELD_ID_REFPAGE_SET:
+ case FIELD_ID_REFPAGE_GET:
+ case FIELD_ID_COUNT_PAGES:
+ case FIELD_ID_COUNT_PARAGRAPHS:
+ case FIELD_ID_COUNT_WORDS:
+ case FIELD_ID_COUNT_CHARACTERS:
+ case FIELD_ID_COUNT_TABLES:
+ case FIELD_ID_COUNT_GRAPHICS:
+ case FIELD_ID_COUNT_OBJECTS:
+ case FIELD_ID_CONDITIONAL_TEXT:
+ case FIELD_ID_HIDDEN_TEXT:
+ case FIELD_ID_HIDDEN_PARAGRAPH:
+ case FIELD_ID_DOCINFO_CREATION_AUTHOR:
+ case FIELD_ID_DOCINFO_DESCRIPTION:
+ case FIELD_ID_DOCINFO_CUSTOM:
+ case FIELD_ID_DOCINFO_PRINT_AUTHOR:
+ case FIELD_ID_DOCINFO_TITLE:
+ case FIELD_ID_DOCINFO_SUBJECT:
+ case FIELD_ID_DOCINFO_KEYWORDS:
+ case FIELD_ID_DOCINFO_REVISION:
+ case FIELD_ID_DOCINFO_EDIT_DURATION:
+ case FIELD_ID_DOCINFO_SAVE_AUTHOR:
+ case FIELD_ID_TEXT_INPUT:
+ case FIELD_ID_USER_INPUT:
+ case FIELD_ID_AUTHOR:
+ case FIELD_ID_SENDER:
+ case FIELD_ID_PLACEHOLDER:
+ case FIELD_ID_USER_GET:
+ case FIELD_ID_DATABASE_NEXT:
+ case FIELD_ID_DATABASE_SELECT:
+ case FIELD_ID_DATABASE_DISPLAY:
+ case FIELD_ID_DATABASE_NAME:
+ case FIELD_ID_DATABASE_NUMBER:
+ case FIELD_ID_TEMPLATE_NAME:
+ case FIELD_ID_CHAPTER:
+ case FIELD_ID_FILE_NAME:
+ case FIELD_ID_META:
+ case FIELD_ID_SHEET_NAME:
+ case FIELD_ID_MEASURE:
+ case FIELD_ID_URL:
+ case FIELD_ID_TABLE_FORMULA:
+ case FIELD_ID_DROP_DOWN:
+ ; // these field IDs are final
+ break;
+
+ default:
+ nToken = FIELD_ID_UNKNOWN;
+ }
+
+ // ... and return final FIELD_ID
+ return nToken;
+}
+
+// is string or numeric field?
+sal_Bool XMLTextFieldExport::IsStringField(
+ FieldIdEnum nFieldType,
+ const Reference<XPropertySet> & xPropSet)
+{
+ switch (nFieldType) {
+
+ case FIELD_ID_VARIABLE_GET:
+ case FIELD_ID_VARIABLE_SET:
+ case FIELD_ID_VARIABLE_INPUT:
+ {
+ // depends on field sub type
+ return ( GetIntProperty(sPropertySubType, xPropSet) ==
+ SetVariableType::STRING );
+ }
+
+ case FIELD_ID_USER_GET:
+ case FIELD_ID_USER_INPUT:
+ {
+ Reference<XTextField> xTextField(xPropSet, UNO_QUERY);
+ DBG_ASSERT(xTextField.is(), "field is no XTextField!");
+ sal_Bool bRet = GetBoolProperty(sPropertyIsExpression,
+ GetMasterPropertySet(xTextField));
+ return !bRet;
+ }
+
+ case FIELD_ID_META:
+ return 0 > GetIntProperty(sPropertyNumberFormat, xPropSet);
+
+ case FIELD_ID_DATABASE_DISPLAY:
+ // TODO: depends on... ???
+ // workaround #no-bug#: no data type
+ return 5100 == GetIntProperty(sPropertyNumberFormat, xPropSet);
+
+ case FIELD_ID_TABLE_FORMULA:
+ // legacy field: always a number field (because it always has
+ // a number format)
+ return sal_False;
+
+ case FIELD_ID_COUNT_PAGES:
+ case FIELD_ID_COUNT_PARAGRAPHS:
+ case FIELD_ID_COUNT_WORDS:
+ case FIELD_ID_COUNT_CHARACTERS:
+ case FIELD_ID_COUNT_TABLES:
+ case FIELD_ID_COUNT_GRAPHICS:
+ case FIELD_ID_COUNT_OBJECTS:
+ case FIELD_ID_DOCINFO_SAVE_TIME:
+ case FIELD_ID_DOCINFO_SAVE_DATE:
+ case FIELD_ID_DOCINFO_CREATION_DATE:
+ case FIELD_ID_DOCINFO_CREATION_TIME:
+ case FIELD_ID_DOCINFO_PRINT_TIME:
+ case FIELD_ID_DOCINFO_PRINT_DATE:
+ case FIELD_ID_DOCINFO_EDIT_DURATION:
+ case FIELD_ID_DOCINFO_REVISION:
+ case FIELD_ID_DATABASE_NUMBER:
+ case FIELD_ID_EXPRESSION:
+ case FIELD_ID_SEQUENCE:
+ case FIELD_ID_DATE:
+ case FIELD_ID_TIME:
+ case FIELD_ID_PAGENUMBER:
+ case FIELD_ID_REFPAGE_SET:
+ case FIELD_ID_REFPAGE_GET:
+ case FIELD_ID_DOCINFO_CUSTOM:
+ // always number
+ return sal_False;
+
+ case FIELD_ID_COMBINED_CHARACTERS:
+ case FIELD_ID_BIBLIOGRAPHY:
+ case FIELD_ID_DDE:
+ case FIELD_ID_REF_REFERENCE:
+ case FIELD_ID_REF_SEQUENCE:
+ case FIELD_ID_REF_BOOKMARK:
+ case FIELD_ID_REF_FOOTNOTE:
+ case FIELD_ID_REF_ENDNOTE:
+ case FIELD_ID_MACRO:
+ case FIELD_ID_TEMPLATE_NAME:
+ case FIELD_ID_CHAPTER:
+ case FIELD_ID_FILE_NAME:
+ case FIELD_ID_CONDITIONAL_TEXT:
+ case FIELD_ID_HIDDEN_TEXT:
+ case FIELD_ID_HIDDEN_PARAGRAPH:
+ case FIELD_ID_DOCINFO_CREATION_AUTHOR:
+ case FIELD_ID_DOCINFO_DESCRIPTION:
+ case FIELD_ID_DOCINFO_PRINT_AUTHOR:
+ case FIELD_ID_DOCINFO_TITLE:
+ case FIELD_ID_DOCINFO_SUBJECT:
+ case FIELD_ID_DOCINFO_KEYWORDS:
+ case FIELD_ID_DOCINFO_SAVE_AUTHOR:
+ case FIELD_ID_DATABASE_NAME:
+ case FIELD_ID_TEXT_INPUT:
+ case FIELD_ID_SENDER:
+ case FIELD_ID_AUTHOR:
+ case FIELD_ID_PAGESTRING:
+ case FIELD_ID_SHEET_NAME:
+ case FIELD_ID_MEASURE:
+ case FIELD_ID_URL:
+ case FIELD_ID_DROP_DOWN:
+ // always string:
+ return sal_True;
+
+ case FIELD_ID_SCRIPT:
+ case FIELD_ID_ANNOTATION:
+ case FIELD_ID_DATABASE_NEXT:
+ case FIELD_ID_DATABASE_SELECT:
+ case FIELD_ID_VARIABLE_DECL:
+ case FIELD_ID_USER_DECL:
+ case FIELD_ID_SEQUENCE_DECL:
+ case FIELD_ID_PLACEHOLDER:
+ case FIELD_ID_UNKNOWN:
+ case FIELD_ID_DRAW_HEADER:
+ case FIELD_ID_DRAW_FOOTER:
+ case FIELD_ID_DRAW_DATE_TIME:
+ default:
+ OSL_FAIL("unkown field type/field has no content");
+ return sal_True; // invalid info; string in case of doubt
+ }
+}
+
+/// export the styles needed by the given field. Called on first pass
+/// through document
+void XMLTextFieldExport::ExportFieldAutoStyle(
+ const Reference<XTextField> & rTextField, const sal_Bool bProgress,
+ const sal_Bool bRecursive )
+{
+ // get property set
+ Reference<XPropertySet> xPropSet(rTextField, UNO_QUERY);
+
+ // add field master to list of used field masters (if desired)
+ if (NULL != pUsedMasters)
+ {
+ Reference<XDependentTextField> xDepField(rTextField, UNO_QUERY);
+ if (xDepField.is())
+ {
+ Reference<XText> xOurText = rTextField->getAnchor()->getText();
+
+ map<Reference<XText>, set<OUString> >::iterator aMapIter =
+ pUsedMasters->find(xOurText);
+
+ // insert a list for our XText (if necessary)
+ if (aMapIter == pUsedMasters->end())
+ {
+ set<OUString> aSet;
+ (*pUsedMasters)[xOurText] = aSet;
+ aMapIter = pUsedMasters->find(xOurText);
+ }
+
+ // insert this text field master
+ OUString sFieldMasterName = GetStringProperty(
+ sPropertyInstanceName, xDepField->getTextFieldMaster());
+ if (sFieldMasterName.getLength() > 0)
+ aMapIter->second.insert( sFieldMasterName );
+ }
+ // else: no dependent field -> no master -> ignore
+ }
+
+ // get Field ID
+ FieldIdEnum nToken = GetFieldID(rTextField, xPropSet);
+
+ // export the character style for all fields
+ // with one exception: combined character fields export their own
+ // text style below
+ Reference <XPropertySet> xRangePropSet(rTextField->getAnchor(), UNO_QUERY);
+ if (FIELD_ID_COMBINED_CHARACTERS != nToken)
+ {
+ GetExport().GetTextParagraphExport()->Add(
+ XML_STYLE_FAMILY_TEXT_TEXT, xRangePropSet);
+ }
+
+ // process special styles for each field (e.g. data styles)
+ switch (nToken) {
+
+ case FIELD_ID_DATABASE_DISPLAY:
+ {
+ sal_Int32 nFormat = GetIntProperty(sPropertyNumberFormat, xPropSet);
+ // workaround: #no-bug#; see IsStringField(...)
+ if ( (5100 != nFormat) &&
+ !GetBoolProperty(sPropertyIsDataBaseFormat, xPropSet) )
+ {
+ GetExport().addDataStyle(nFormat);
+ }
+ break;
+ }
+
+ case FIELD_ID_DATE:
+ case FIELD_ID_TIME:
+ {
+ // date and time fields are always number fields, but the
+ // NumberFormat property is optional (e.g. Calc doesn't
+ // support it)
+ Reference<XPropertySetInfo> xPropSetInfo(
+ xPropSet->getPropertySetInfo() );
+ if ( xPropSetInfo->hasPropertyByName( sPropertyNumberFormat ) )
+ {
+ sal_Int32 nFormat =
+ GetIntProperty(sPropertyNumberFormat, xPropSet);
+
+ // nFormat may be -1 for numeric fields that display their
+ // variable name. (Maybe this should be a field type, then?)
+ if (nFormat != -1)
+ {
+ if( ! GetOptionalBoolProperty(
+ sPropertyIsFixedLanguage,
+ xPropSet, xPropSetInfo, sal_False ) )
+ {
+ nFormat =
+ GetExport().dataStyleForceSystemLanguage(nFormat);
+ }
+
+ GetExport().addDataStyle( nFormat,
+ nToken == FIELD_ID_TIME );
+ }
+ }
+ }
+ break;
+
+ case FIELD_ID_META:
+ // recurse into content (does not export element, so can be done first)
+ if (bRecursive)
+ {
+ ExportMetaField(xPropSet, true, bProgress);
+ }
+ // fall-through: for the meta-field itself!
+ case FIELD_ID_DOCINFO_PRINT_TIME:
+ case FIELD_ID_DOCINFO_PRINT_DATE:
+ case FIELD_ID_DOCINFO_CREATION_DATE:
+ case FIELD_ID_DOCINFO_CREATION_TIME:
+ case FIELD_ID_DOCINFO_SAVE_TIME:
+ case FIELD_ID_DOCINFO_SAVE_DATE:
+ case FIELD_ID_DOCINFO_EDIT_DURATION:
+ case FIELD_ID_VARIABLE_SET:
+ case FIELD_ID_VARIABLE_GET:
+ case FIELD_ID_VARIABLE_INPUT:
+ case FIELD_ID_USER_GET:
+ case FIELD_ID_EXPRESSION:
+ case FIELD_ID_TABLE_FORMULA:
+ case FIELD_ID_DOCINFO_CUSTOM:
+ // register number format, if this is a numeric field
+ if (! IsStringField(nToken, xPropSet)) {
+
+ sal_Int32 nFormat =
+ GetIntProperty(sPropertyNumberFormat, xPropSet);
+
+ // nFormat may be -1 for numeric fields that display their
+ // variable name. (Maybe this should be a field type, then?)
+ if (nFormat != -1)
+ {
+ // handle formats for fixed language fields
+ // for all these fields (except table formula)
+ if( ( nToken != FIELD_ID_TABLE_FORMULA ) &&
+ ! GetOptionalBoolProperty(
+ sPropertyIsFixedLanguage,
+ xPropSet, xPropSet->getPropertySetInfo(),
+ sal_False ) )
+ {
+ nFormat =
+ GetExport().dataStyleForceSystemLanguage(nFormat);
+ }
+
+ GetExport().addDataStyle(nFormat);
+ }
+ }
+ break;
+
+ case FIELD_ID_COMBINED_CHARACTERS:
+ {
+ // export text style with the addition of the combined characters
+ DBG_ASSERT(NULL != pCombinedCharactersPropertyState,
+ "need proper PropertyState for combined characters");
+ const XMLPropertyState *aStates[] = { pCombinedCharactersPropertyState, 0 };
+ GetExport().GetTextParagraphExport()->Add(
+ XML_STYLE_FAMILY_TEXT_TEXT, xRangePropSet,
+ aStates);
+ break;
+ }
+
+ case FIELD_ID_SCRIPT:
+ case FIELD_ID_ANNOTATION:
+ case FIELD_ID_BIBLIOGRAPHY:
+ case FIELD_ID_DDE:
+ case FIELD_ID_REF_REFERENCE:
+ case FIELD_ID_REF_SEQUENCE:
+ case FIELD_ID_REF_BOOKMARK:
+ case FIELD_ID_REF_FOOTNOTE:
+ case FIELD_ID_REF_ENDNOTE:
+ case FIELD_ID_MACRO:
+ case FIELD_ID_REFPAGE_SET:
+ case FIELD_ID_REFPAGE_GET:
+ case FIELD_ID_COUNT_PAGES:
+ case FIELD_ID_COUNT_PARAGRAPHS:
+ case FIELD_ID_COUNT_WORDS:
+ case FIELD_ID_COUNT_CHARACTERS:
+ case FIELD_ID_COUNT_TABLES:
+ case FIELD_ID_COUNT_GRAPHICS:
+ case FIELD_ID_COUNT_OBJECTS:
+ case FIELD_ID_CONDITIONAL_TEXT:
+ case FIELD_ID_HIDDEN_TEXT:
+ case FIELD_ID_HIDDEN_PARAGRAPH:
+ case FIELD_ID_DOCINFO_CREATION_AUTHOR:
+ case FIELD_ID_DOCINFO_DESCRIPTION:
+ case FIELD_ID_DOCINFO_PRINT_AUTHOR:
+ case FIELD_ID_DOCINFO_TITLE:
+ case FIELD_ID_DOCINFO_SUBJECT:
+ case FIELD_ID_DOCINFO_KEYWORDS:
+ case FIELD_ID_DOCINFO_REVISION:
+ case FIELD_ID_DOCINFO_SAVE_AUTHOR:
+ case FIELD_ID_SEQUENCE:
+ case FIELD_ID_PAGENUMBER:
+ case FIELD_ID_PAGESTRING:
+ case FIELD_ID_AUTHOR:
+ case FIELD_ID_SENDER:
+ case FIELD_ID_PLACEHOLDER:
+ case FIELD_ID_USER_INPUT:
+ case FIELD_ID_TEXT_INPUT:
+ case FIELD_ID_DATABASE_NEXT:
+ case FIELD_ID_DATABASE_SELECT:
+ case FIELD_ID_DATABASE_NAME:
+ case FIELD_ID_DATABASE_NUMBER:
+ case FIELD_ID_TEMPLATE_NAME:
+ case FIELD_ID_CHAPTER:
+ case FIELD_ID_FILE_NAME:
+ case FIELD_ID_SHEET_NAME:
+ case FIELD_ID_MEASURE:
+ case FIELD_ID_URL:
+ case FIELD_ID_DROP_DOWN:
+ case FIELD_ID_DRAW_DATE_TIME:
+ case FIELD_ID_DRAW_FOOTER:
+ case FIELD_ID_DRAW_HEADER:
+ ; // no formats for these fields!
+ break;
+
+ case FIELD_ID_UNKNOWN:
+ default:
+ OSL_FAIL("unkown field type!");
+ // ignore -> no format for unkowns
+ break;
+ }
+}
+
+/// export the given field to XML. Called on second pass through document
+void XMLTextFieldExport::ExportField(
+ const Reference<XTextField> & rTextField, sal_Bool bProgress )
+{
+ // get property set
+ Reference<XPropertySet> xPropSet(rTextField, UNO_QUERY);
+
+ // get property set of range (for the attributes)
+ Reference <XPropertySet> xRangePropSet(rTextField->getAnchor(), UNO_QUERY);
+
+ // get Field ID
+ enum FieldIdEnum nToken = GetFieldID(rTextField, xPropSet);
+
+ // special treatment for combined characters field, because it is
+ // exported as a style
+ const XMLPropertyState* aStates[] = { pCombinedCharactersPropertyState, 0 };
+ const XMLPropertyState **pStates =
+ FIELD_ID_COMBINED_CHARACTERS == nToken
+ ? aStates
+ : 0;
+
+ // find out whether we need to set the style or hyperlink
+ sal_Bool bHasHyperlink;
+ sal_Bool bIsUICharStyle;
+ sal_Bool bHasAutoStyle;
+ OUString sStyle = GetExport().GetTextParagraphExport()->
+ FindTextStyleAndHyperlink( xRangePropSet, bHasHyperlink, bIsUICharStyle,
+ bHasAutoStyle, pStates );
+ sal_Bool bHasStyle = (sStyle.getLength() > 0);
+
+ // export hyperlink (if we have one)
+ Reference < XPropertySetInfo > xRangePropSetInfo;
+ if( bHasHyperlink )
+ {
+ Reference<XPropertyState> xRangePropState( xRangePropSet, UNO_QUERY );
+ xRangePropSetInfo = xRangePropSet->getPropertySetInfo();
+ bHasHyperlink =
+ GetExport().GetTextParagraphExport()->addHyperlinkAttributes(
+ xRangePropSet, xRangePropState,
+ xRangePropSetInfo );
+ }
+ SvXMLElementExport aHyperlink( GetExport(), bHasHyperlink,
+ XML_NAMESPACE_TEXT, XML_A,
+ sal_False, sal_False );
+
+ if( bHasHyperlink )
+ {
+ // export events (if supported)
+ OUString sHyperLinkEvents(RTL_CONSTASCII_USTRINGPARAM(
+ "HyperLinkEvents"));
+ if (xRangePropSetInfo->hasPropertyByName(sHyperLinkEvents))
+ {
+ Any aAny = xRangePropSet->getPropertyValue(sHyperLinkEvents);
+ Reference<XNameReplace> xName;
+ aAny >>= xName;
+ GetExport().GetEventExport().Export(xName, sal_False);
+ }
+ }
+
+ {
+ XMLTextCharStyleNamesElementExport aCharStylesExport(
+ GetExport(), bIsUICharStyle &&
+ GetExport().GetTextParagraphExport()
+ ->GetCharStyleNamesPropInfoCache().hasProperty(
+ xRangePropSet, xRangePropSetInfo ), bHasAutoStyle,
+ xRangePropSet, sPropertyCharStyleNames );
+
+ // export span with style (if necessary)
+ // (except for combined characters field)
+ if( bHasStyle )
+ {
+ // export <text:span> element
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME,
+ GetExport().EncodeStyleName( sStyle ) );
+ }
+ SvXMLElementExport aSpan( GetExport(), bHasStyle,
+ XML_NAMESPACE_TEXT, XML_SPAN,
+ sal_False, sal_False);
+
+ // finally, export the field itself
+ ExportFieldHelper( rTextField, xPropSet, xRangePropSet, nToken,
+ bProgress );
+ }
+}
+
+/// export the given field to XML. Called on second pass through document
+void XMLTextFieldExport::ExportFieldHelper(
+ const Reference<XTextField> & rTextField,
+ const Reference<XPropertySet> & rPropSet,
+ const Reference<XPropertySet> &,
+ enum FieldIdEnum nToken,
+ sal_Bool bProgress )
+{
+ // get property set info (because some attributes are not support
+ // in all implementations)
+ Reference<XPropertySetInfo> xPropSetInfo(rPropSet->getPropertySetInfo());
+
+ OUString sPresentation = rTextField->getPresentation(sal_False);
+
+ // process each field type
+ switch (nToken) {
+ case FIELD_ID_AUTHOR:
+ // author field: fixed, field (sub-)type
+ ProcessBoolean(XML_FIXED,
+ GetBoolProperty(sPropertyIsFixed, rPropSet), sal_True);
+ ExportElement(MapAuthorFieldName(rPropSet), sPresentation);
+ break;
+
+ case FIELD_ID_SENDER:
+ // sender field: fixed, field (sub-)type
+ ProcessBoolean(XML_FIXED,
+ GetBoolProperty(sPropertyIsFixed, rPropSet), sal_True);
+ ExportElement(MapSenderFieldName(rPropSet), sPresentation);
+ break;
+
+ case FIELD_ID_PLACEHOLDER:
+ // placeholder field: type, name, description
+ ProcessString(XML_PLACEHOLDER_TYPE,
+ MapPlaceholderType(
+ GetInt16Property(sPropertyPlaceholderType, rPropSet)));
+ ProcessString(XML_DESCRIPTION,
+ GetStringProperty(sPropertyHint,rPropSet), sal_True);
+ ExportElement(XML_PLACEHOLDER, sPresentation);
+ break;
+
+ case FIELD_ID_VARIABLE_SET:
+ {
+ // variable set field: name, visible, format&value
+ ProcessString(XML_NAME,
+ GetStringProperty(sPropertyVariableName, rPropSet));
+ ProcessDisplay(GetBoolProperty(sPropertyIsVisible, rPropSet),
+ sal_False);
+ ProcessString(XML_FORMULA, XML_NAMESPACE_OOOW,
+ GetStringProperty(sPropertyContent, rPropSet),
+ sPresentation);
+ ProcessValueAndType(IsStringField(nToken, rPropSet),
+ GetIntProperty(sPropertyNumberFormat, rPropSet),
+ GetStringProperty(sPropertyContent, rPropSet),
+ sPresentation,
+ GetDoubleProperty(sPropertyValue, rPropSet),
+ sal_True, sal_True, sal_True,
+ ! GetOptionalBoolProperty(
+ sPropertyIsFixedLanguage,
+ rPropSet, xPropSetInfo, sal_False ) );
+ ExportElement(XML_VARIABLE_SET, sPresentation);
+ break;
+ }
+ case FIELD_ID_VARIABLE_GET:
+ {
+ // variable get field: name, format&value
+ ProcessString(XML_NAME,
+ GetStringProperty(sPropertyContent, rPropSet));
+ sal_Bool bCmd = GetBoolProperty(sPropertyIsShowFormula, rPropSet);
+ ProcessDisplay(sal_True, bCmd);
+ // #i81766# for older versions export of the value-type
+ sal_Bool bExportValueType = !bCmd && ( GetExport().getExportFlags() & EXPORT_SAVEBACKWARDCOMPATIBLE );
+ // show style, unless name will be shown
+ ProcessValueAndType(IsStringField(nToken, rPropSet),
+ GetIntProperty(sPropertyNumberFormat, rPropSet),
+ sEmpty, sEmpty, 0.0, // values not used
+ sal_False,
+ bExportValueType,
+ !bCmd,
+ ! GetOptionalBoolProperty(
+ sPropertyIsFixedLanguage,
+ rPropSet, xPropSetInfo, sal_False ) );
+ ExportElement(XML_VARIABLE_GET, sPresentation);
+ break;
+ }
+ case FIELD_ID_VARIABLE_INPUT:
+ // variable input field: name, description, format&value
+ ProcessString(XML_NAME,
+ GetStringProperty(sPropertyVariableName, rPropSet));
+ ProcessString(XML_DESCRIPTION,
+ GetStringProperty(sPropertyHint , rPropSet));
+ ProcessDisplay(GetBoolProperty(sPropertyIsVisible, rPropSet),
+ sal_False);
+ ProcessString(XML_FORMULA, XML_NAMESPACE_OOOW,
+ GetStringProperty(sPropertyContent, rPropSet),
+ sPresentation);
+ ProcessValueAndType(IsStringField(nToken, rPropSet),
+ GetIntProperty(sPropertyNumberFormat, rPropSet),
+ GetStringProperty(sPropertyContent, rPropSet),
+ sPresentation,
+ GetDoubleProperty(sPropertyValue, rPropSet),
+ sal_True, sal_True, sal_True,
+ ! GetOptionalBoolProperty(
+ sPropertyIsFixedLanguage,
+ rPropSet, xPropSetInfo, sal_False ) );
+ ExportElement(XML_VARIABLE_INPUT, sPresentation);
+ break;
+
+ case FIELD_ID_USER_GET:
+ // user field: name, hidden, style
+ {
+ sal_Bool bCmd = GetBoolProperty(sPropertyIsShowFormula, rPropSet);
+ ProcessDisplay(GetBoolProperty(sPropertyIsVisible, rPropSet),
+ bCmd);
+ ProcessValueAndType(IsStringField(nToken, rPropSet),
+ GetIntProperty(sPropertyNumberFormat, rPropSet),
+ sEmpty, sEmpty, 0.0, // values not used
+ sal_False, sal_False, !bCmd,
+ ! GetOptionalBoolProperty(
+ sPropertyIsFixedLanguage,
+ rPropSet, xPropSetInfo, sal_False ) );
+
+ // name from FieldMaster
+ ProcessString(XML_NAME,
+ GetStringProperty(sPropertyName,
+ GetMasterPropertySet(rTextField)));
+ ExportElement(XML_USER_FIELD_GET, sPresentation);
+ break;
+ }
+
+ case FIELD_ID_USER_INPUT:
+ // user input field: name (from FieldMaster), description
+// ProcessString(XML_NAME,
+// GetStringProperty(sPropertyName,
+// GetMasterPropertySet(rTextField)));
+ ProcessString(XML_NAME,
+ GetStringProperty(sPropertyContent, rPropSet));
+ ProcessString(XML_DESCRIPTION,
+ GetStringProperty(sPropertyHint, rPropSet));
+ ExportElement(XML_USER_FIELD_INPUT, sPresentation);
+ break;
+
+ case FIELD_ID_SEQUENCE:
+ {
+ // sequence field: name, formula, seq-format
+ OUString sName = GetStringProperty(sPropertyVariableName, rPropSet);
+ // TODO: use reference name only if actually beeing referenced.
+ ProcessString(XML_REF_NAME,
+ MakeSequenceRefName(
+ GetInt16Property(sPropertySequenceValue, rPropSet),
+ sName));
+ ProcessString(XML_NAME, sName);
+ ProcessString(XML_FORMULA, XML_NAMESPACE_OOOW,
+ GetStringProperty(sPropertyContent, rPropSet),
+ sPresentation);
+ ProcessNumberingType(GetInt16Property(sPropertyNumberingType,
+ rPropSet));
+ ExportElement(XML_SEQUENCE, sPresentation);
+ break;
+ }
+
+ case FIELD_ID_EXPRESSION:
+ {
+ // formula field: formula, format&value
+ sal_Bool bCmd = GetBoolProperty(sPropertyIsShowFormula, rPropSet);
+ ProcessString(XML_FORMULA, XML_NAMESPACE_OOOW,
+ GetStringProperty(sPropertyContent, rPropSet),
+ sPresentation);
+ ProcessDisplay(sal_True, bCmd);
+ ProcessValueAndType(IsStringField(nToken, rPropSet),
+ GetIntProperty(sPropertyNumberFormat, rPropSet),
+ GetStringProperty(sPropertyContent, rPropSet),
+ sPresentation,
+ GetDoubleProperty(sPropertyValue, rPropSet),
+ !bCmd, !bCmd, !bCmd,
+ ! GetOptionalBoolProperty(
+ sPropertyIsFixedLanguage,
+ rPropSet, xPropSetInfo, sal_False ) );
+ ExportElement(XML_EXPRESSION, sPresentation);
+ break;
+ }
+
+ case FIELD_ID_TEXT_INPUT:
+ // text input field: description and string-value
+ ProcessString(XML_DESCRIPTION,
+ GetStringProperty(sPropertyHint, rPropSet));
+ ProcessString(XML_HELP,
+ GetStringProperty(sPropertyHelp, rPropSet), true);
+ ProcessString(XML_HINT,
+ GetStringProperty(sPropertyTooltip, rPropSet), true);
+ ExportElement(XML_TEXT_INPUT, sPresentation);
+ break;
+
+ case FIELD_ID_TIME:
+ // all properties (except IsDate) are optional!
+ if (xPropSetInfo->hasPropertyByName(sPropertyNumberFormat))
+ {
+ ProcessValueAndType(sal_False,
+ GetIntProperty(sPropertyNumberFormat,rPropSet),
+ sEmpty, sEmpty, 0.0, // not used
+ sal_False, sal_False, sal_True,
+ ! GetOptionalBoolProperty(
+ sPropertyIsFixedLanguage,
+ rPropSet, xPropSetInfo, sal_False ),
+ sal_True);
+ }
+ if (xPropSetInfo->hasPropertyByName(sPropertyDateTimeValue))
+ {
+ // no value -> current time
+ ProcessDateTime(XML_TIME_VALUE,
+ GetDateTimeProperty(sPropertyDateTimeValue,
+ rPropSet),
+ sal_False );
+ }
+ if (xPropSetInfo->hasPropertyByName(sPropertyDateTime))
+ {
+ // no value -> current time
+ ProcessDateTime(XML_TIME_VALUE,
+ GetDateTimeProperty(sPropertyDateTime,rPropSet),
+ sal_False );
+ }
+ if (xPropSetInfo->hasPropertyByName(sPropertyIsFixed))
+ {
+ ProcessBoolean(XML_FIXED,
+ GetBoolProperty(sPropertyIsFixed, rPropSet),
+ sal_False);
+ }
+ if (xPropSetInfo->hasPropertyByName(sPropertyAdjust))
+ {
+ // adjust value given as integer in minutes
+ ProcessDateTime(XML_TIME_ADJUST,
+ GetIntProperty(sPropertyAdjust, rPropSet),
+ sal_False, sal_True, sal_True);
+ }
+ ExportElement(XML_TIME, sPresentation);
+ break;
+
+ case FIELD_ID_DATE:
+ // all properties (except IsDate) are optional!
+ if (xPropSetInfo->hasPropertyByName(sPropertyNumberFormat))
+ {
+ ProcessValueAndType(sal_False,
+ GetIntProperty(sPropertyNumberFormat,rPropSet),
+ sEmpty, sEmpty, 0.0, // not used
+ sal_False, sal_False, sal_True,
+ ! GetOptionalBoolProperty(
+ sPropertyIsFixedLanguage,
+ rPropSet, xPropSetInfo, sal_False ) );
+ }
+ if (xPropSetInfo->hasPropertyByName(sPropertyDateTimeValue))
+ {
+ // no value -> current date
+ ProcessDateTime(XML_DATE_VALUE,
+ GetDateTimeProperty(sPropertyDateTimeValue,
+ rPropSet),
+ // #96457#: date fields should also save time
+ sal_False);
+ }
+ // TODO: remove double-handling after SRC614
+ else if (xPropSetInfo->hasPropertyByName(sPropertyDateTime))
+ {
+ ProcessDateTime(XML_DATE_VALUE,
+ GetDateTimeProperty(sPropertyDateTime,rPropSet),
+ // #96457#: date fields should also save time
+ sal_False);
+ }
+ if (xPropSetInfo->hasPropertyByName(sPropertyIsFixed))
+ {
+ ProcessBoolean(XML_FIXED,
+ GetBoolProperty(sPropertyIsFixed, rPropSet),
+ sal_False);
+ }
+ if (xPropSetInfo->hasPropertyByName(sPropertyAdjust))
+ {
+ // adjust value given as number of days
+ ProcessDateTime(XML_DATE_ADJUST,
+ GetIntProperty(sPropertyAdjust, rPropSet),
+ sal_True, sal_True, sal_True);
+ }
+ ExportElement(XML_DATE, sPresentation);
+ break;
+
+ case FIELD_ID_PAGENUMBER:
+ // all properties are optional
+ if (xPropSetInfo->hasPropertyByName(sPropertyNumberingType))
+ {
+ ProcessNumberingType(GetInt16Property(sPropertyNumberingType,
+ rPropSet));
+ }
+ if (xPropSetInfo->hasPropertyByName(sPropertyOffset))
+ {
+ sal_Int32 nAdjust = GetIntProperty(sPropertyOffset, rPropSet);
+
+ if (xPropSetInfo->hasPropertyByName(sPropertySubType))
+ {
+ // property SubType used in MapPageNumebrName
+ ProcessString(XML_SELECT_PAGE,
+ MapPageNumberName(rPropSet, nAdjust));
+ }
+ ProcessIntegerDef(XML_PAGE_ADJUST, nAdjust, 0);
+ }
+ ExportElement(XML_PAGE_NUMBER, sPresentation);
+ break;
+
+ case FIELD_ID_PAGESTRING:
+ {
+ ProcessString(XML_STRING_VALUE,
+ GetStringProperty(sPropertyUserText, rPropSet),
+ sPresentation);
+ sal_Int32 nDummy = 0; // MapPageNumberName need int
+ ProcessString(XML_SELECT_PAGE, MapPageNumberName(rPropSet, nDummy));
+ if( 0 == ( GetExport().getExportFlags() & EXPORT_SAVEBACKWARDCOMPATIBLE ) )
+ ExportElement(XML_PAGE_CONTINUATION, sPresentation);
+ else
+ ExportElement(XML_PAGE_CONTINUATION_STRING, sPresentation);
+ break;
+ }
+
+ case FIELD_ID_DATABASE_NAME:
+ ProcessString(XML_TABLE_NAME,
+ GetStringProperty(sPropertyDataTableName, rPropSet));
+ ProcessCommandType(GetIntProperty(sPropertyDataCommandType, rPropSet));
+ ProcessDisplay(GetBoolProperty(sPropertyIsVisible, rPropSet),
+ sal_False);
+ ExportDataBaseElement(XML_DATABASE_NAME, sPresentation,
+ rPropSet, xPropSetInfo);
+ break;
+
+ case FIELD_ID_DATABASE_NUMBER:
+ ProcessString(XML_TABLE_NAME,
+ GetStringProperty(sPropertyDataTableName, rPropSet));
+ ProcessCommandType(GetIntProperty(sPropertyDataCommandType, rPropSet));
+ ProcessNumberingType(
+ GetInt16Property(sPropertyNumberingType,rPropSet));
+ ProcessInteger(XML_VALUE,
+ GetIntProperty(sPropertySetNumber, rPropSet));
+ ProcessDisplay(GetBoolProperty(sPropertyIsVisible, rPropSet),
+ sal_False);
+ ExportDataBaseElement(XML_DATABASE_ROW_NUMBER, sPresentation,
+ rPropSet, xPropSetInfo);
+ break;
+
+ case FIELD_ID_DATABASE_NEXT:
+ ProcessString(XML_TABLE_NAME,
+ GetStringProperty(sPropertyDataTableName, rPropSet));
+ ProcessCommandType(GetIntProperty(sPropertyDataCommandType, rPropSet));
+ ProcessString(XML_CONDITION, XML_NAMESPACE_OOOW,
+ GetStringProperty(sPropertyCondition, rPropSet));
+ DBG_ASSERT(sPresentation.equals(sEmpty),
+ "Unexpected presentation for database next field");
+ ExportDataBaseElement(XML_DATABASE_NEXT, OUString(),
+ rPropSet, xPropSetInfo);
+ break;
+
+ case FIELD_ID_DATABASE_SELECT:
+ ProcessString(XML_TABLE_NAME,
+ GetStringProperty(sPropertyDataTableName, rPropSet));
+ ProcessCommandType(GetIntProperty(sPropertyDataCommandType, rPropSet));
+ ProcessString(XML_CONDITION, XML_NAMESPACE_OOOW,
+ GetStringProperty(sPropertyCondition, rPropSet));
+ ProcessInteger(XML_ROW_NUMBER,
+ GetIntProperty(sPropertySetNumber, rPropSet));
+ DBG_ASSERT(sPresentation.equals(sEmpty),
+ "Unexpected presentation for database select field");
+ ExportDataBaseElement(XML_DATABASE_ROW_SELECT, OUString(),
+ rPropSet, xPropSetInfo);
+ break;
+
+ case FIELD_ID_DATABASE_DISPLAY:
+ {
+ // get database, table and column name from field master
+ const Reference<XPropertySet> & xMaster = GetMasterPropertySet(rTextField);
+ ProcessString(XML_TABLE_NAME,
+ GetStringProperty(sPropertyDataTableName, xMaster));
+ ProcessCommandType(GetIntProperty(sPropertyDataCommandType, xMaster));
+ ProcessString(XML_COLUMN_NAME,
+ GetStringProperty(sPropertyDataColumnName, xMaster));
+ // export number format if available (happens only for numbers!)
+ if (!GetBoolProperty(sPropertyIsDataBaseFormat, rPropSet))
+ {
+ ProcessValueAndType(sal_False, // doesn't happen for text
+ GetIntProperty(sPropertyNumberFormat,rPropSet),
+ sEmpty, sEmpty, 0.0, // not used
+ sal_False, sal_False, sal_True, sal_False);
+ }
+ ProcessDisplay(GetBoolProperty(sPropertyIsVisible, rPropSet),
+ sal_False);
+ ExportDataBaseElement(XML_DATABASE_DISPLAY, sPresentation,
+ xMaster, xMaster->getPropertySetInfo());
+ break;
+ }
+
+ case FIELD_ID_DOCINFO_REVISION:
+ ProcessBoolean(XML_FIXED,
+ GetBoolProperty(sPropertyIsFixed, rPropSet), sal_False);
+ ExportElement(MapDocInfoFieldName(nToken), sPresentation);
+ break;
+
+ case FIELD_ID_DOCINFO_EDIT_DURATION:
+ case FIELD_ID_DOCINFO_SAVE_TIME:
+ case FIELD_ID_DOCINFO_CREATION_TIME:
+ case FIELD_ID_DOCINFO_PRINT_TIME:
+ case FIELD_ID_DOCINFO_SAVE_DATE:
+ case FIELD_ID_DOCINFO_CREATION_DATE:
+ case FIELD_ID_DOCINFO_PRINT_DATE:
+ ProcessValueAndType(sal_False,
+ GetIntProperty(sPropertyNumberFormat, rPropSet),
+ sEmpty, sEmpty, 0.0,
+ sal_False, sal_False, sal_True,
+ ! GetOptionalBoolProperty(
+ sPropertyIsFixedLanguage,
+ rPropSet, xPropSetInfo, sal_False ) );
+
+ // todo: export date/time value, but values not available -> core bug
+ ProcessBoolean(XML_FIXED,
+ GetBoolProperty(sPropertyIsFixed, rPropSet), sal_False);
+ ExportElement(MapDocInfoFieldName(nToken), sPresentation);
+ break;
+
+ case FIELD_ID_DOCINFO_CREATION_AUTHOR:
+ case FIELD_ID_DOCINFO_DESCRIPTION:
+ case FIELD_ID_DOCINFO_PRINT_AUTHOR:
+ case FIELD_ID_DOCINFO_TITLE:
+ case FIELD_ID_DOCINFO_SUBJECT:
+ case FIELD_ID_DOCINFO_KEYWORDS:
+ case FIELD_ID_DOCINFO_SAVE_AUTHOR:
+ if (xPropSetInfo->hasPropertyByName(sPropertyIsFixed))
+ {
+ ProcessBoolean(XML_FIXED,
+ GetBoolProperty(sPropertyIsFixed, rPropSet), sal_False);
+ }
+ ExportElement(MapDocInfoFieldName(nToken), sPresentation);
+ break;
+
+ case FIELD_ID_DOCINFO_CUSTOM:
+ {
+ ProcessValueAndType(sal_False, // doesn't happen for text
+ GetIntProperty(sPropertyNumberFormat,rPropSet),
+ sEmpty, sEmpty, 0.0, // not used
+ sal_False, sal_False, sal_True,
+ ! GetOptionalBoolProperty(
+ sPropertyIsFixedLanguage,
+ rPropSet, xPropSetInfo, sal_False ));
+ uno::Any aAny = rPropSet->getPropertyValue( sPropertyName );
+ ::rtl::OUString sName;
+ aAny >>= sName;
+ ProcessString(XML_NAME, sName);
+ ProcessBoolean(XML_FIXED, GetBoolProperty(sPropertyIsFixed, rPropSet), sal_False);
+ ExportElement(XML_USER_DEFINED, sPresentation);
+ break;
+ }
+
+ case FIELD_ID_COUNT_PAGES:
+ case FIELD_ID_COUNT_PARAGRAPHS:
+ case FIELD_ID_COUNT_WORDS:
+ case FIELD_ID_COUNT_CHARACTERS:
+ case FIELD_ID_COUNT_TABLES:
+ case FIELD_ID_COUNT_GRAPHICS:
+ case FIELD_ID_COUNT_OBJECTS:
+ // all properties optional (applies to pages only, but I'll do
+ // it for all for sake of common implementation)
+ if (xPropSetInfo->hasPropertyByName(sPropertyNumberingType))
+ {
+ ProcessNumberingType(GetInt16Property(sPropertyNumberingType,
+ rPropSet));
+ }
+ ExportElement(MapCountFieldName(nToken), sPresentation);
+ break;
+
+ case FIELD_ID_CONDITIONAL_TEXT:
+ ProcessString(XML_CONDITION, XML_NAMESPACE_OOOW,
+ GetStringProperty(sPropertyCondition, rPropSet));
+ ProcessString(XML_STRING_VALUE_IF_TRUE,
+ GetStringProperty(sPropertyTrueContent, rPropSet));
+ ProcessString(XML_STRING_VALUE_IF_FALSE,
+ GetStringProperty(sPropertyFalseContent, rPropSet));
+ ProcessBoolean(XML_CURRENT_VALUE,
+ GetBoolProperty(sPropertyIsConditionTrue, rPropSet),
+ sal_False);
+ ExportElement(XML_CONDITIONAL_TEXT, sPresentation);
+ break;
+
+ case FIELD_ID_HIDDEN_TEXT:
+ ProcessString(XML_CONDITION, XML_NAMESPACE_OOOW,
+ GetStringProperty(sPropertyCondition, rPropSet));
+ ProcessString(XML_STRING_VALUE,
+ GetStringProperty(sPropertyContent, rPropSet));
+ ProcessBoolean(XML_IS_HIDDEN,
+ GetBoolProperty(sPropertyIsHidden, rPropSet),
+ sal_False);
+ ExportElement(XML_HIDDEN_TEXT, sPresentation);
+ break;
+
+ case FIELD_ID_HIDDEN_PARAGRAPH:
+ ProcessString(XML_CONDITION, XML_NAMESPACE_OOOW,
+ GetStringProperty(sPropertyCondition, rPropSet));
+ ProcessBoolean(XML_IS_HIDDEN,
+ GetBoolProperty(sPropertyIsHidden, rPropSet),
+ sal_False);
+ DBG_ASSERT(sPresentation.equals(sEmpty),
+ "Unexpected presentation for hidden paragraph field");
+ ExportElement(XML_HIDDEN_PARAGRAPH);
+ break;
+
+ case FIELD_ID_TEMPLATE_NAME:
+ ProcessString(XML_DISPLAY,
+ MapTemplateDisplayFormat(
+ GetInt16Property(sPropertyFileFormat, rPropSet)));
+ ExportElement(XML_TEMPLATE_NAME, sPresentation);
+ break;
+
+ case FIELD_ID_CHAPTER:
+ ProcessString(XML_DISPLAY,
+ MapChapterDisplayFormat(
+ GetInt16Property(sPropertyChapterFormat, rPropSet)));
+ // API numbers 0..9, we number 1..10
+ ProcessInteger(XML_OUTLINE_LEVEL,
+ GetInt8Property(sPropertyLevel, rPropSet) + 1);
+ ExportElement(XML_CHAPTER, sPresentation);
+ break;
+
+ case FIELD_ID_FILE_NAME:
+ // all properties are optional
+ if (xPropSetInfo->hasPropertyByName(sPropertyFileFormat))
+ {
+ ProcessString(XML_DISPLAY,
+ MapFilenameDisplayFormat(
+ GetInt16Property(sPropertyFileFormat, rPropSet)));
+ }
+ if (xPropSetInfo->hasPropertyByName(sPropertyIsFixed))
+ {
+ ProcessBoolean(XML_FIXED,
+ GetBoolProperty(sPropertyIsFixed, rPropSet),
+ sal_False);
+ }
+ ExportElement(XML_FILE_NAME, sPresentation);
+ break;
+
+ case FIELD_ID_REFPAGE_SET:
+ ProcessBoolean(XML_ACTIVE,
+ GetBoolProperty(sPropertyOn, rPropSet), sal_True);
+ ProcessIntegerDef(XML_PAGE_ADJUST,
+ GetInt16Property(sPropertyOffset, rPropSet), 0);
+ DBG_ASSERT(sPresentation.equals(sEmpty),
+ "Unexpected presentation page variable field");
+ ExportElement(XML_PAGE_VARIABLE_SET);
+ break;
+
+ case FIELD_ID_REFPAGE_GET:
+ ProcessNumberingType(
+ GetInt16Property(sPropertyNumberingType, rPropSet));
+ ExportElement(XML_PAGE_VARIABLE_GET, sPresentation);
+ break;
+
+ case FIELD_ID_MACRO:
+ ExportMacro( rPropSet, sPresentation );
+ break;
+
+ case FIELD_ID_REF_SEQUENCE:
+ // reference to sequence: format, name, find value (and element)
+ // was: if (nSeqNumber != -1) ...
+ ProcessString(XML_REFERENCE_FORMAT,
+ MapReferenceType(GetInt16Property(
+ sPropertyReferenceFieldPart, rPropSet)),
+ XML_TEMPLATE);
+ ProcessString(XML_REF_NAME,
+ MakeSequenceRefName(
+ GetInt16Property(sPropertySequenceNumber, rPropSet),
+ GetStringProperty(sPropertySourceName, rPropSet) ) );
+ ExportElement(
+ MapReferenceSource(
+ GetInt16Property(sPropertyReferenceFieldSource, rPropSet)),
+ sPresentation);
+ break;
+
+ case FIELD_ID_REF_REFERENCE:
+ case FIELD_ID_REF_BOOKMARK:
+ // reference to bookmarks, references: format, name (and element)
+ ProcessString(XML_REFERENCE_FORMAT,
+ MapReferenceType(GetInt16Property(
+ sPropertyReferenceFieldPart, rPropSet)),
+ XML_TEMPLATE);
+ ProcessString(XML_REF_NAME,
+ GetStringProperty(sPropertySourceName, rPropSet));
+ ExportElement(
+ MapReferenceSource(GetInt16Property(
+ sPropertyReferenceFieldSource, rPropSet)),
+ sPresentation);
+ break;
+
+ case FIELD_ID_REF_FOOTNOTE:
+ case FIELD_ID_REF_ENDNOTE:
+ // reference to end-/footnote: format, generate name, (and element)
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_NOTE_CLASS,
+ FIELD_ID_REF_ENDNOTE==nToken ? XML_ENDNOTE : XML_FOOTNOTE );
+ ProcessString(XML_REFERENCE_FORMAT,
+ MapReferenceType(GetInt16Property(
+ sPropertyReferenceFieldPart, rPropSet)),
+ XML_TEMPLATE);
+ ProcessString(XML_REF_NAME,
+ MakeFootnoteRefName(GetInt16Property(
+ sPropertySequenceNumber, rPropSet)));
+ ExportElement(
+ MapReferenceSource(GetInt16Property(
+ sPropertyReferenceFieldSource, rPropSet)),
+ sPresentation);
+ break;
+
+ case FIELD_ID_DDE:
+ // name from field master
+ ProcessString(XML_CONNECTION_NAME,
+
+ GetStringProperty(sPropertyName,
+ GetMasterPropertySet(rTextField)));
+ ExportElement(XML_DDE_CONNECTION, sPresentation);
+ break;
+
+ case FIELD_ID_SHEET_NAME:
+ // name of spreadsheet (Calc only)
+ ExportElement(XML_SHEET_NAME, sPresentation);
+ break;
+
+ case FIELD_ID_URL:
+ {
+ // this field is a special case because it gets mapped onto a
+ // hyperlink, rather than one of the regular text field.
+ ProcessString(XML_HREF, GetExport().GetRelativeReference(GetStringProperty(sPropertyURL, rPropSet)),
+ sal_False, XML_NAMESPACE_XLINK);
+ ProcessString(XML_TARGET_FRAME_NAME,
+ GetStringProperty(sPropertyTargetFrame,rPropSet),
+ sal_True, XML_NAMESPACE_OFFICE);
+ SvXMLElementExport aUrlField(rExport, XML_NAMESPACE_TEXT, XML_A,
+ sal_False, sal_False);
+ GetExport().Characters(sPresentation);
+ break;
+ }
+
+ case FIELD_ID_BIBLIOGRAPHY:
+ {
+ ProcessBibliographyData(rPropSet);
+ ExportElement(XML_BIBLIOGRAPHY_MARK, sPresentation);
+ break;
+ }
+
+ case FIELD_ID_SCRIPT:
+ ProcessString(XML_LANGUAGE,
+ GetStringProperty(sPropertyScriptType, rPropSet),
+ sal_True, XML_NAMESPACE_SCRIPT);
+ DBG_ASSERT(sPresentation.equals(sEmpty),
+ "Unexpected presentation for script field");
+ if (GetBoolProperty(sPropertyURLContent, rPropSet))
+ {
+ ProcessString(XML_HREF,
+ GetExport().GetRelativeReference(GetStringProperty(sPropertyContent, rPropSet)),
+ sal_False, XML_NAMESPACE_XLINK);
+ ExportElement(XML_SCRIPT);
+ }
+ else
+ {
+ ExportElement(XML_SCRIPT,
+ GetStringProperty(sPropertyContent, rPropSet));
+ }
+ break;
+
+ case FIELD_ID_ANNOTATION:
+ {
+ // check for empty presentation (just in case)
+ DBG_ASSERT(sPresentation.equals(sEmpty),
+ "Unexpected presentation for annotation field");
+
+ // annotation element + content
+ SvXMLElementExport aElem(GetExport(), XML_NAMESPACE_OFFICE,
+ XML_ANNOTATION, sal_False, sal_True);
+
+ // author
+ OUString aAuthor( GetStringProperty(sPropertyAuthor, rPropSet) );
+ if( aAuthor.getLength() )
+ {
+ SvXMLElementExport aCreatorElem( GetExport(), XML_NAMESPACE_DC,
+ XML_CREATOR, sal_True,
+ sal_False );
+ GetExport().Characters(aAuthor);
+ }
+
+ // date time
+ DateTime aDate( GetDateTimeProperty(sPropertyDateTimeValue, rPropSet) );
+ {
+ OUStringBuffer aBuffer;
+ GetExport().GetMM100UnitConverter().convertDateTime(aBuffer,
+ aDate,
+ sal_True);
+ SvXMLElementExport aDateElem( GetExport(), XML_NAMESPACE_DC,
+ XML_DATE, sal_True,
+ sal_False );
+ GetExport().Characters(aBuffer.makeStringAndClear());
+ }
+
+ com::sun::star::uno::Reference < com::sun::star::text::XText > xText;
+ try
+ {
+ com::sun::star::uno::Any aRet = rPropSet->getPropertyValue(sPropertyTextRange);
+ aRet >>= xText;
+ }
+ catch ( com::sun::star::uno::Exception& )
+ {}
+
+ if ( xText.is() )
+ GetExport().GetTextParagraphExport()->exportText( xText );
+ else
+ ProcessParagraphSequence(GetStringProperty(sPropertyContent,rPropSet));
+ break;
+ }
+
+ case FIELD_ID_COMBINED_CHARACTERS:
+ {
+ // The style with the combined characters attribute has
+ // already been handled in the ExportField method. So all that
+ // is left to do now is to export the characters.
+ GetExport().Characters(sPresentation);
+ break;
+ }
+
+ case FIELD_ID_META:
+ {
+ ExportMetaField(rPropSet, false, bProgress);
+ break;
+ }
+
+ case FIELD_ID_MEASURE:
+ {
+ ProcessString(XML_KIND, MapMeasureKind(GetInt16Property(sPropertyMeasureKind, rPropSet)));
+ ExportElement( XML_MEASURE, sPresentation );
+ break;
+ }
+
+ case FIELD_ID_TABLE_FORMULA:
+ ProcessString( XML_FORMULA, XML_NAMESPACE_OOOW,
+ GetStringProperty(sPropertyContent, rPropSet) );
+ ProcessDisplay( sal_True,
+ GetBoolProperty(sPropertyIsShowFormula, rPropSet),
+ sal_True );
+ ProcessValueAndType( sal_False,
+ GetIntProperty(sPropertyNumberFormat, rPropSet),
+ sEmpty, sEmpty, 0.0f,
+ sal_False, sal_False, sal_True,
+ sal_False, sal_False );
+ ExportElement( XML_TABLE_FORMULA, sPresentation );
+ break;
+
+ case FIELD_ID_DROP_DOWN:
+ {
+ ProcessString(XML_NAME, GetStringProperty(sPropertyName, rPropSet));
+ ProcessString(XML_HELP,
+ GetStringProperty(sPropertyHelp, rPropSet), true);
+ ProcessString(XML_HINT,
+ GetStringProperty(sPropertyTooltip, rPropSet), true);
+ SvXMLElementExport aElem( GetExport(),
+ XML_NAMESPACE_TEXT, XML_DROPDOWN,
+ sal_False, sal_False );
+ ProcessStringSequence
+ (GetStringSequenceProperty( sPropertyItems, rPropSet ),
+ GetStringProperty( sPropertySelectedItem, rPropSet ) );
+
+ GetExport().Characters( sPresentation );
+ }
+ break;
+
+ case FIELD_ID_DRAW_HEADER:
+ {
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_PRESENTATION, XML_HEADER, sal_False, sal_False );
+ }
+ break;
+
+ case FIELD_ID_DRAW_FOOTER:
+ {
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_PRESENTATION, XML_FOOTER, sal_False, sal_False );
+ }
+ break;
+
+ case FIELD_ID_DRAW_DATE_TIME:
+ {
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_PRESENTATION, XML_DATE_TIME, sal_False, sal_False );
+ }
+ break;
+
+ case FIELD_ID_UNKNOWN:
+ default:
+ OSL_FAIL("unkown field type encountered!");
+ // always export content
+ GetExport().Characters(sPresentation);
+ }
+}
+
+
+/// export field declarations / field masters
+void XMLTextFieldExport::ExportFieldDeclarations()
+{
+ Reference<XText> xEmptyText;
+ ExportFieldDeclarations(xEmptyText);
+}
+
+/// export field declarations / field masters
+void XMLTextFieldExport::ExportFieldDeclarations(
+ const Reference<XText> & rText )
+{
+ // store lists for decl elements
+ vector<OUString> aVarName;
+ vector<OUString> aUserName;
+ vector<OUString> aSeqName;
+ vector<OUString> aDdeName;
+
+ // get text fields supplier and field master name access
+ Reference<XTextFieldsSupplier> xTextFieldsSupp(GetExport().GetModel(),
+ UNO_QUERY);
+ if( !xTextFieldsSupp.is() )
+ return;
+
+ Reference<container::XNameAccess> xFieldMasterNameAccess(
+ xTextFieldsSupp->getTextFieldMasters(), UNO_QUERY);
+
+ // where to get the text field masters from?
+ // a) we get a specific XText: then use pUsedMasters
+ // b) the XText is empty: then export all text fields
+ Sequence<OUString> aFieldMasters;
+ if (rText.is())
+ {
+ // export only used masters
+ DBG_ASSERT(NULL != pUsedMasters,
+ "field masters must be recorded in order to be "
+ "written out separatly" );
+ if (NULL != pUsedMasters)
+ {
+ map<Reference<XText>, set<OUString> > ::iterator aMapIter =
+ pUsedMasters->find(rText);
+ if (aMapIter != pUsedMasters->end())
+ {
+ // found the set of used field masters
+ set<OUString> & rOurMasters = aMapIter->second;
+
+ // copy set to sequence
+ aFieldMasters.realloc( rOurMasters.size() );
+ sal_Int32 i = 0;
+ for( set<OUString>::iterator aSetIter = rOurMasters.begin();
+ aSetIter != rOurMasters.end();
+ ++aSetIter, ++i )
+ {
+ aFieldMasters[i] = *aSetIter;
+ }
+
+ pUsedMasters->erase(rText);
+ }
+ // else: XText not found -> ignore
+ }
+ // else: no field masters have been recorded -> ignore
+ }
+ else
+ {
+ // no XText: export all!
+ aFieldMasters = xFieldMasterNameAccess->getElementNames();
+ }
+
+ for(sal_Int32 i=0; i<aFieldMasters.getLength(); i++) {
+
+ // get field master name
+ OUString sFieldMaster = aFieldMasters[i];
+
+ // workaround for #no-bug#
+ static const sal_Char sDB[] =
+ "com.sun.star.text.FieldMaster.DataBase.";
+ if ( sFieldMaster.matchIgnoreAsciiCaseAsciiL( sDB, sizeof(sDB)-1) )
+ {
+ continue;
+ }
+
+
+ OUString sFieldMasterType;
+ OUString sVarName;
+ ExplodeFieldMasterName(sFieldMaster, sFieldMasterType, sVarName);
+
+ // get XPropertySet of this field master
+ Reference<XPropertySet> xPropSet;
+ Any aAny = xFieldMasterNameAccess->getByName(sFieldMaster);
+ aAny >>= xPropSet;
+
+ // save interesting field masters
+ if (0 == sFieldMasterType.compareToAscii(FIELD_SERVICE_SETEXP))
+ {
+ sal_Int32 nType = GetIntProperty(sPropertySubType, xPropSet);
+
+ // sequence or variable?
+ if ( SetVariableType::SEQUENCE == nType )
+ {
+ aSeqName.push_back( sFieldMaster );
+ }
+ else
+ {
+ aVarName.push_back( sFieldMaster );
+ }
+ }
+ else if (0 == sFieldMasterType.compareToAscii(FIELD_SERVICE_USER))
+ {
+ aUserName.push_back( sFieldMaster );
+ }
+ else if (0 == sFieldMasterType.compareToAscii(FIELD_SERVICE_DDE))
+ {
+ aDdeName.push_back( sFieldMaster );
+ }
+ else
+ {
+ ; // ignore
+ }
+ }
+
+ // now process fields:
+
+ // variable field masters:
+ if ( !aVarName.empty() )
+ {
+ SvXMLElementExport aElem( GetExport(),
+ XML_NAMESPACE_TEXT,
+ XML_VARIABLE_DECLS,
+ sal_True, sal_True );
+
+ for (vector<OUString>::iterator aVarIter = aVarName.begin();
+ aVarIter != aVarName.end();
+ ++aVarIter) {
+
+ OUString sName = *aVarIter;
+
+ // get field master property set
+ Reference<XPropertySet> xPropSet;
+ Any aAny = xFieldMasterNameAccess->getByName(sName);
+ aAny >>= xPropSet;
+
+ // field name and type
+ OUString sFieldMasterType;
+ OUString sVarName;
+ ExplodeFieldMasterName(sName, sFieldMasterType, sVarName);
+
+ // determine string/numeric field
+ sal_Bool bIsString = ( GetIntProperty(sPropertySubType, xPropSet)
+ == SetVariableType::STRING );
+
+ // get dependent field property set
+ Reference<XPropertySet> xFieldPropSet;
+ if (GetDependentFieldPropertySet(xPropSet, xFieldPropSet))
+ {
+ // process value and type.
+ ProcessValueAndType(
+ bIsString,
+ GetIntProperty(sPropertyNumberFormat, xFieldPropSet),
+ sEmpty, sEmpty, 0.0,
+ sal_False, sal_True, sal_False, sal_False);
+ }
+ else
+ {
+ // If no dependent field is found, only string and
+ // float types can be supported
+
+ // number format: 0 is default number format for 1st
+ // language. should be: getDefaultNumberFormat(Locale)
+ // from NumberFormats
+ ProcessValueAndType(
+ bIsString,
+ 0, sEmpty, sEmpty, 0.0,
+ sal_False, sal_True, sal_False, sal_False);
+ }
+
+ ProcessString(XML_NAME, sVarName);
+ ExportElement(XML_VARIABLE_DECL, sal_True);
+ }
+ }
+ // else: no declarations element
+
+ // sequence field masters:
+ if ( !aSeqName.empty() )
+ {
+ SvXMLElementExport aElem( GetExport(),
+ XML_NAMESPACE_TEXT,
+ XML_SEQUENCE_DECLS,
+ sal_True, sal_True );
+
+ for (vector<OUString>::iterator aSeqIter = aSeqName.begin();
+ aSeqIter != aSeqName.end();
+ ++aSeqIter) {
+
+ OUString sName = *aSeqIter;
+
+ // get field master property set
+ Reference<XPropertySet> xPropSet;
+ Any aAny = xFieldMasterNameAccess->getByName(sName);
+ aAny >>= xPropSet;
+
+ // field name and type
+ OUString sFieldMasterType;
+ OUString sVarName;
+ ExplodeFieldMasterName(sName, sFieldMasterType, sVarName);
+
+ // outline level
+ sal_Int32 nLevel = 1 + GetIntProperty(
+ sPropertyChapterNumberingLevel, xPropSet);
+ DBG_ASSERT(nLevel >= 0, "illegal outline level");
+ DBG_ASSERT(nLevel < 127, "possible illegal outline level");
+ ProcessInteger(XML_DISPLAY_OUTLINE_LEVEL, nLevel);
+
+ // separation character
+ if (nLevel > 0) {
+ ProcessString(XML_SEPARATION_CHARACTER, GetStringProperty(
+ sPropertyNumberingSeparator, xPropSet));
+ }
+ ProcessString(XML_NAME, sVarName);
+ ExportElement(XML_SEQUENCE_DECL, sal_True);
+ }
+ }
+ // else: no declarations element
+
+ // user field field masters:
+ if ( !aUserName.empty() )
+ {
+ SvXMLElementExport aElem( GetExport(),
+ XML_NAMESPACE_TEXT,
+ XML_USER_FIELD_DECLS,
+ sal_True, sal_True );
+
+ for (vector<OUString>::iterator aUserIter = aUserName.begin();
+ aUserIter != aUserName.end();
+ ++aUserIter) {
+
+ OUString sName = *aUserIter;
+
+ // get field master property set
+ Reference<XPropertySet> xPropSet;
+ Any aAny = xFieldMasterNameAccess->getByName(sName);
+ aAny >>= xPropSet;
+
+ // field name and type
+ OUString sFieldMasterType;
+ OUString sVarName;
+ ExplodeFieldMasterName(sName, sFieldMasterType, sVarName);
+
+ if (GetBoolProperty(sPropertyIsExpression, xPropSet))
+ {
+ // expression:
+ ProcessValueAndType(
+ sal_False,
+ 0, sEmpty, sEmpty,
+ GetDoubleProperty(sPropertyValue, xPropSet),
+ sal_True,
+ sal_True,
+ sal_False,
+ sal_False);
+ }
+ else
+ {
+ // string: write regardless of default
+ ProcessString(XML_VALUE_TYPE, XML_STRING, sal_False,
+ XML_NAMESPACE_OFFICE);
+ ProcessString(XML_STRING_VALUE,
+ GetStringProperty(sPropertyContent, xPropSet),
+ sal_False, XML_NAMESPACE_OFFICE );
+ }
+ ProcessString(XML_NAME, sVarName);
+ ExportElement(XML_USER_FIELD_DECL, sal_True);
+ }
+ }
+ // else: no declarations element
+
+ // DDE field field masters:
+ if ( !aDdeName.empty() )
+ {
+ SvXMLElementExport aElem( GetExport(),
+ XML_NAMESPACE_TEXT,
+ XML_DDE_CONNECTION_DECLS,
+ sal_True, sal_True );
+
+ for (vector<OUString>::iterator aDdeIter = aDdeName.begin();
+ aDdeIter != aDdeName.end();
+ ++aDdeIter)
+ {
+ OUString sName = *aDdeIter;
+
+ // get field master property set
+ Reference<XPropertySet> xPropSet;
+ Any aAny = xFieldMasterNameAccess->getByName(sName);
+ aAny >>= xPropSet;
+
+ // check if this connection is being used by a field
+ Reference<XPropertySet> xDummy;
+ if (GetDependentFieldPropertySet(xPropSet, xDummy))
+ {
+
+ ProcessString(XML_NAME,
+ GetStringProperty(sPropertyName, xPropSet),
+ sal_False, XML_NAMESPACE_OFFICE);
+
+ // export elements; can't use ProcessString because
+ // elements are in office namespace
+ ProcessString(XML_DDE_APPLICATION,
+ GetStringProperty(sPropertyDDECommandType,
+ xPropSet),
+ sal_False, XML_NAMESPACE_OFFICE);
+ ProcessString(XML_DDE_TOPIC,
+ GetStringProperty(sPropertyDDECommandFile,
+ xPropSet),
+ sal_False, XML_NAMESPACE_OFFICE);
+ ProcessString(XML_DDE_ITEM,
+ GetStringProperty(sPropertyDDECommandElement,
+ xPropSet),
+ sal_False, XML_NAMESPACE_OFFICE);
+ sal_Bool bIsAutomaticUpdate = GetBoolProperty(
+ sPropertyIsAutomaticUpdate, xPropSet);
+ if (bIsAutomaticUpdate)
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_OFFICE,
+ XML_AUTOMATIC_UPDATE,
+ XML_TRUE);
+ }
+
+ ExportElement(XML_DDE_CONNECTION_DECL, sal_True);
+ }
+ // else: no dependent field -> no export of field declaration
+ }
+ }
+ // else: no declarations element
+}
+
+void XMLTextFieldExport::SetExportOnlyUsedFieldDeclarations(
+ sal_Bool bExportOnlyUsed)
+{
+ delete pUsedMasters;
+ pUsedMasters = NULL;
+
+ // create used masters set (if none is used)
+ if (bExportOnlyUsed)
+ pUsedMasters = new map<Reference<XText>, set<OUString> > ;
+}
+
+void XMLTextFieldExport::ExportElement(enum XMLTokenEnum eElementName,
+ sal_Bool bAddSpace)
+{
+ // can't call ExportElement(eElementName, const OUString&) with empty
+ // string because xmlprinter only uses empty tags if no content
+ // (not even empty content) was written.
+
+ DBG_ASSERT(XML_TOKEN_INVALID != eElementName, "invalid element name!");
+ if (XML_TOKEN_INVALID != eElementName)
+ {
+ // Element
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT,
+ eElementName, bAddSpace, bAddSpace );
+ } // else: ignore
+}
+
+void XMLTextFieldExport::ExportElement(enum XMLTokenEnum eElementName,
+ const OUString& sContent,
+ sal_Bool bAddSpace)
+{
+ DBG_ASSERT(eElementName != XML_TOKEN_INVALID, "invalid element name!");
+ if (eElementName != XML_TOKEN_INVALID)
+ {
+ // Element
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT,
+ eElementName, bAddSpace, bAddSpace );
+ // export content
+ GetExport().Characters(sContent);
+ } else {
+ // always export content
+ GetExport().Characters(sContent);
+ }
+}
+
+void XMLTextFieldExport::ExportMacro(
+ const Reference<XPropertySet> & rPropSet,
+ const OUString& rContent )
+{
+ // some strings we'll need
+ OUString sEventType( RTL_CONSTASCII_USTRINGPARAM( "EventType" ));
+ OUString sStarBasic( RTL_CONSTASCII_USTRINGPARAM( "StarBasic" ));
+ OUString sScript( RTL_CONSTASCII_USTRINGPARAM( "Script" ));
+ OUString sLibrary( RTL_CONSTASCII_USTRINGPARAM( "Library" ));
+ OUString sMacroName( RTL_CONSTASCII_USTRINGPARAM( "MacroName" ));
+ OUString sOnClick( RTL_CONSTASCII_USTRINGPARAM( "OnClick" ));
+ OUString sPropertyMacroLibrary( RTL_CONSTASCII_USTRINGPARAM( "MacroLibrary" ));
+ OUString sPropertyMacroName( RTL_CONSTASCII_USTRINGPARAM( "MacroName" ));
+ OUString sPropertyScriptURL( RTL_CONSTASCII_USTRINGPARAM( "ScriptURL" ));
+
+
+ // the description attribute
+ ProcessString(XML_DESCRIPTION,
+ GetStringProperty(sPropertyHint, rPropSet),
+ rContent);
+
+ // the element
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT,
+ XML_EXECUTE_MACRO, sal_False, sal_False );
+
+ // the <office:events>-macro:
+
+ // 1) build sequence of PropertyValues
+ Sequence<PropertyValue> aSeq;
+ OUString sName;
+ rPropSet->getPropertyValue( sPropertyScriptURL ) >>= sName;
+
+ // if the ScriptURL property is not empty then this is a Scripting
+ // Framework URL, otherwise treat it as a Basic Macro
+ if (sName.getLength() != 0)
+ {
+ aSeq = Sequence<PropertyValue> (2);
+ PropertyValue* pArr = aSeq.getArray();
+ pArr[0].Name = sEventType;
+ pArr[0].Value <<= sScript;
+ pArr[1].Name = sScript;
+ pArr[1].Value = rPropSet->getPropertyValue( sPropertyScriptURL );
+ }
+ else
+ {
+ aSeq = Sequence<PropertyValue> (3);
+ PropertyValue* pArr = aSeq.getArray();
+ pArr[0].Name = sEventType;
+ pArr[0].Value <<= sStarBasic;
+ pArr[1].Name = sLibrary;
+ pArr[1].Value = rPropSet->getPropertyValue( sPropertyMacroLibrary );
+ pArr[2].Name = sMacroName;
+ pArr[2].Value = rPropSet->getPropertyValue( sPropertyMacroName );
+ }
+
+ // 2) export the sequence
+ GetExport().GetEventExport().ExportSingleEvent( aSeq, sOnClick, sal_False );
+
+ // and finally, the field presentation
+ GetExport().Characters(rContent);
+}
+
+void XMLTextFieldExport::ExportMetaField(
+ const Reference<XPropertySet> & i_xMeta,
+ bool i_bAutoStyles, sal_Bool i_bProgress )
+{
+ bool doExport(!i_bAutoStyles); // do not export element if autostyles
+ // check version >= 1.2
+ switch (GetExport().getDefaultVersion()) {
+ case SvtSaveOptions::ODFVER_011: // fall thru
+ case SvtSaveOptions::ODFVER_010: doExport = false; break;
+ default: break;
+ }
+
+ const Reference < XEnumerationAccess > xEA( i_xMeta, UNO_QUERY_THROW );
+ const Reference < XEnumeration > xTextEnum( xEA->createEnumeration() );
+
+ if (doExport)
+ {
+ const Reference<rdf::XMetadatable> xMeta( i_xMeta, UNO_QUERY_THROW );
+
+ // style:data-style-name
+ ProcessValueAndType(sal_False,
+ GetIntProperty(sPropertyNumberFormat, i_xMeta),
+ sEmpty, sEmpty, 0.0, sal_False, sal_False, sal_True,
+ sal_False, sal_False /*, sal_False*/ );
+
+ // text:meta-field without xml:id is invalid
+ xMeta->ensureMetadataReference();
+
+ // xml:id for RDF metadata
+ GetExport().AddAttributeXmlId(xMeta);
+ }
+
+ SvXMLElementExport aElem( GetExport(), doExport,
+ XML_NAMESPACE_TEXT, XML_META_FIELD, sal_False, sal_False );
+
+ // recurse to export content
+ GetExport().GetTextParagraphExport()->
+ exportTextRangeEnumeration( xTextEnum, i_bAutoStyles, i_bProgress );
+}
+
+/// export all data-style related attributes
+void XMLTextFieldExport::ProcessValueAndType(
+ sal_Bool bIsString, /// do we process a string or a number?
+ sal_Int32 nFormatKey, /// format key for NumberFormatter; inv. if string
+ const OUString& sContent, /// string content; possibly invalid
+ const OUString& sDefault, /// default string
+ double fValue, /// float content; possibly invalid
+ sal_Bool bExportValue, /// export value attribute?
+ sal_Bool bExportValueType, /// export value-type attribute?
+ sal_Bool bExportStyle, /// export style-sttribute?
+ sal_Bool bForceSystemLanguage, /// export language attributes?
+ sal_Bool bTimeStyle) // exporting a time style?
+{
+ // String or number?
+ if (bIsString)
+ {
+
+ // string: attributes value-type=string, string-value=...
+
+ if (bExportValue || bExportValueType)
+ {
+ XMLNumberFormatAttributesExportHelper::SetNumberFormatAttributes(
+ GetExport(), sContent, sDefault, bExportValue);
+ }
+
+ }
+ else
+ {
+
+ // number: value-type=..., value...=..., data-style-name=...
+
+ DBG_ASSERT(bExportValueType || !bExportValue, "value w/o value type not supported!");
+
+ // take care of illegal formats
+ // (shouldn't happen, but does if document is corrupted)
+ if (-1 != nFormatKey)
+ {
+ if (bExportValue || bExportValueType)
+ {
+ XMLNumberFormatAttributesExportHelper::
+ SetNumberFormatAttributes(
+ GetExport(), nFormatKey, fValue, bExportValue);
+ }
+
+ if (bExportStyle)
+ {
+ // don't export language (if desired)
+ if( bForceSystemLanguage )
+ nFormatKey =
+ GetExport().dataStyleForceSystemLanguage( nFormatKey );
+
+ OUString sDataStyleName =
+ GetExport().getDataStyleName(nFormatKey, bTimeStyle);
+ if( sDataStyleName.getLength() > 0 )
+ {
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE,
+ XML_DATA_STYLE_NAME,
+ sDataStyleName );
+ } // else: ignore (no valid number format)
+ } // else: ignore (no number format)
+ }
+ }
+}
+
+
+
+/// process display related properties
+void XMLTextFieldExport::ProcessDisplay(sal_Bool bIsVisible,
+ sal_Bool bIsCommand,
+ sal_Bool bValueDefault)
+{
+ enum XMLTokenEnum eValue;
+
+ if (bIsVisible)
+ {
+ eValue = bIsCommand ? XML_FORMULA : XML_VALUE;
+ }
+ else
+ {
+ eValue = XML_NONE;
+ }
+
+ // omit attribute if default
+ if (!bValueDefault || (eValue != XML_VALUE))
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_DISPLAY, eValue);
+ }
+}
+
+
+
+/// export boolean property
+void XMLTextFieldExport::ProcessBoolean(enum XMLTokenEnum eName,
+ sal_Bool bBool, sal_Bool bDefault)
+{
+ DBG_ASSERT( eName != XML_TOKEN_INVALID, "invalid element token");
+ if ( XML_TOKEN_INVALID == eName )
+ return;
+
+ // write attribute (if different than default)
+ // negate to force 0/1 values (and make sal_Bool comparable)
+ if ((!bBool) != (!bDefault)) {
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT, eName,
+ (bBool ? XML_TRUE : XML_FALSE) );
+ }
+}
+
+
+
+
+/// export string attribute
+void XMLTextFieldExport::ProcessString(enum XMLTokenEnum eName,
+ const OUString& sValue,
+ sal_Bool bOmitEmpty,
+ sal_uInt16 nPrefix)
+{
+ DBG_ASSERT( eName != XML_TOKEN_INVALID, "invalid element token");
+ if ( XML_TOKEN_INVALID == eName )
+ return;
+
+ // check for empty string, if applicable
+ if ( bOmitEmpty && (sValue.getLength()==0) )
+ return;
+
+ // write attribute
+ GetExport().AddAttribute(nPrefix, eName, sValue);
+}
+
+void XMLTextFieldExport::ProcessString(enum XMLTokenEnum eName,
+ sal_uInt16 nValuePrefix,
+ const OUString& sValue,
+ sal_Bool bOmitEmpty,
+ sal_uInt16 nPrefix)
+{
+ OUString sQValue =
+ GetExport().GetNamespaceMap().GetQNameByKey( nValuePrefix, sValue, sal_False );
+ ProcessString( eName, sQValue, bOmitEmpty, nPrefix );
+}
+
+/// export a string attribute
+void XMLTextFieldExport::ProcessString(enum XMLTokenEnum eName,
+ const ::rtl::OUString& sValue,
+ const ::rtl::OUString& sDefault,
+ sal_uInt16 nPrefix)
+{
+ if (sValue != sDefault)
+ {
+ ProcessString(eName, sValue, sal_False, nPrefix);
+ }
+}
+
+/// export a string attribute
+void XMLTextFieldExport::ProcessString(enum XMLTokenEnum eName,
+ sal_uInt16 nValuePrefix,
+ const ::rtl::OUString& sValue,
+ const ::rtl::OUString& sDefault,
+ sal_uInt16 nPrefix)
+{
+ if (sValue != sDefault)
+ {
+ ProcessString(eName, nValuePrefix, sValue, sal_False, nPrefix);
+ }
+}
+
+
+/// export string attribute
+void XMLTextFieldExport::ProcessString(
+ enum XMLTokenEnum eName,
+ enum XMLTokenEnum eValue,
+ sal_Bool bOmitEmpty,
+ sal_uInt16 nPrefix)
+{
+ DBG_ASSERT( eName != XML_TOKEN_INVALID, "invalid element token" );
+ DBG_ASSERT( bOmitEmpty || (eValue != XML_TOKEN_INVALID),
+ "invalid value token" );
+ if ( XML_TOKEN_INVALID == eName )
+ return;
+
+ // check for empty string, if applicable
+ if (bOmitEmpty && (eValue == XML_TOKEN_INVALID))
+ return;
+
+ GetExport().AddAttribute(nPrefix, eName, eValue);
+}
+
+/// export a string attribute
+void XMLTextFieldExport::ProcessString(
+ enum XMLTokenEnum eName,
+ enum XMLTokenEnum eValue,
+ enum XMLTokenEnum eDefault,
+ sal_uInt16 nPrefix)
+{
+ if ( eValue != eDefault )
+ ProcessString( eName, eValue, sal_False, nPrefix);
+}
+
+
+/// export a string as a sequence of paragraphs
+void XMLTextFieldExport::ProcessParagraphSequence(
+ const ::rtl::OUString& sParagraphSequence)
+{
+ // iterate over all string-pieces separated by return (0x0a) and
+ // put each inside a paragraph element.
+ SvXMLTokenEnumerator aEnumerator(sParagraphSequence, sal_Char(0x0a));
+ OUString aSubString;
+ while (aEnumerator.getNextToken(aSubString))
+ {
+ SvXMLElementExport aParagraph(
+ GetExport(), XML_NAMESPACE_TEXT, XML_P, sal_True, sal_False);
+ GetExport().Characters(aSubString);
+ }
+}
+
+// export an integer attribute
+void XMLTextFieldExport::ProcessInteger(enum XMLTokenEnum eName,
+ sal_Int32 nNum)
+{
+ DBG_ASSERT( eName != XML_TOKEN_INVALID, "invalid element token");
+ if ( XML_TOKEN_INVALID == eName )
+ return;
+
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT, eName,
+ OUString::valueOf(nNum));
+}
+
+/// export an integer attribute, omit if default
+void XMLTextFieldExport::ProcessIntegerDef(enum XMLTokenEnum eName,
+ sal_Int32 nNum, sal_Int32 nDefault)
+{
+ if (nNum != nDefault)
+ ProcessInteger(eName, nNum);
+}
+
+
+
+/// export a numbering type
+void XMLTextFieldExport::ProcessNumberingType(sal_Int16 nNumberingType)
+{
+ // process only if real format (not: like page descriptor)
+ if (NumberingType::PAGE_DESCRIPTOR != nNumberingType)
+ {
+ OUStringBuffer sTmp( 10 );
+ // number type: num format
+ GetExport().GetMM100UnitConverter().convertNumFormat( sTmp,
+ nNumberingType );
+ GetExport().AddAttribute(XML_NAMESPACE_STYLE, XML_NUM_FORMAT,
+ sTmp.makeStringAndClear() );
+ // and letter sync, if applicable
+ GetExport().GetMM100UnitConverter().convertNumLetterSync( sTmp,
+ nNumberingType );
+
+ if (sTmp.getLength())
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_STYLE, XML_NUM_LETTER_SYNC,
+ sTmp.makeStringAndClear() );
+ }
+ }
+ // else: like page descriptor => ignore
+}
+
+
+/// export a date, time, or duration
+void XMLTextFieldExport::ProcessDateTime(enum XMLTokenEnum eName,
+ double dValue,
+ sal_Bool bIsDate,
+ sal_Bool bIsDuration,
+ sal_Bool bOmitDurationIfZero,
+ sal_uInt16 nPrefix)
+{
+ // truncate for date granularity
+ if (bIsDate)
+ {
+ dValue = ::rtl::math::approxFloor(dValue);
+ }
+
+ OUStringBuffer aBuffer;
+ if (bIsDuration)
+ {
+ // date/time durationM handle bOmitDurationIfZero
+ if (!bOmitDurationIfZero || !::rtl::math::approxEqual(dValue, 0.0))
+ {
+ rExport.GetMM100UnitConverter().convertTime(aBuffer, dValue);
+ }
+ }
+ else
+ {
+ // date/time value
+ rExport.GetMM100UnitConverter().convertDateTime(aBuffer, dValue);
+ }
+
+ // output attribute
+ ProcessString(eName, aBuffer.makeStringAndClear(), sal_True, nPrefix);
+}
+
+/// export a date or time
+void XMLTextFieldExport::ProcessDateTime(enum XMLTokenEnum eName,
+ const DateTime& rTime,
+ sal_Bool bIsDate,
+ sal_uInt16 nPrefix)
+{
+ OUStringBuffer aBuffer;
+
+ DateTime aDateTime(rTime);
+
+ // truncate dates
+ if(bIsDate)
+ {
+ aDateTime.HundredthSeconds = 0;
+ aDateTime.Seconds = 0;
+ aDateTime.Minutes = 0;
+ aDateTime.Hours = 0;
+ }
+
+ // date/time value
+ rExport.GetMM100UnitConverter().convertDateTime(aBuffer, aDateTime);
+
+ // output attribute
+ ProcessString(eName, aBuffer.makeStringAndClear(), sal_True, nPrefix);
+}
+
+/// export date according to ISO 8601
+void XMLTextFieldExport::ProcessDate(
+ enum XMLTokenEnum eName,
+ const ::com::sun::star::util::Date& rDate,
+ sal_uInt16 nPrefix)
+{
+ // the easiest way: delegate to ProcessDateTime (as date)
+ DateTime aDateTime;
+ aDateTime.Day = rDate.Day;
+ aDateTime.Month = rDate.Month;
+ aDateTime.Year = rDate.Year;
+ ProcessDateTime(eName, aDateTime, sal_True, nPrefix);
+}
+
+
+/// export a date, time, or duration
+void XMLTextFieldExport::ProcessDateTime(enum XMLTokenEnum eName,
+ sal_Int32 nMinutes,
+ sal_Bool bIsDate,
+ sal_Bool bIsDuration,
+ sal_Bool bOmitDurationIfZero,
+ sal_uInt16 nPrefix)
+{
+ // handle bOmitDurationIfZero here, because we can precisely compare ints
+ if (!(bIsDuration && bOmitDurationIfZero && (nMinutes==0)))
+ {
+ ProcessDateTime(eName, (double)nMinutes / (double)(24*60),
+ bIsDate, bIsDuration, bOmitDurationIfZero, nPrefix);
+ }
+}
+
+
+SvXMLEnumMapEntry const aBibliographyDataTypeMap[] =
+{
+ { XML_ARTICLE, BibliographyDataType::ARTICLE },
+ { XML_BOOK, BibliographyDataType::BOOK },
+ { XML_BOOKLET, BibliographyDataType::BOOKLET },
+ { XML_CONFERENCE, BibliographyDataType::CONFERENCE },
+ { XML_CUSTOM1, BibliographyDataType::CUSTOM1 },
+ { XML_CUSTOM2, BibliographyDataType::CUSTOM2 },
+ { XML_CUSTOM3, BibliographyDataType::CUSTOM3 },
+ { XML_CUSTOM4, BibliographyDataType::CUSTOM4 },
+ { XML_CUSTOM5, BibliographyDataType::CUSTOM5 },
+ { XML_EMAIL, BibliographyDataType::EMAIL },
+ { XML_INBOOK, BibliographyDataType::INBOOK },
+ { XML_INCOLLECTION, BibliographyDataType::INCOLLECTION },
+ { XML_INPROCEEDINGS, BibliographyDataType::INPROCEEDINGS },
+ { XML_JOURNAL, BibliographyDataType::JOURNAL },
+ { XML_MANUAL, BibliographyDataType::MANUAL },
+ { XML_MASTERSTHESIS, BibliographyDataType::MASTERSTHESIS },
+ { XML_MISC, BibliographyDataType::MISC },
+ { XML_PHDTHESIS, BibliographyDataType::PHDTHESIS },
+ { XML_PROCEEDINGS, BibliographyDataType::PROCEEDINGS },
+ { XML_TECHREPORT, BibliographyDataType::TECHREPORT },
+ { XML_UNPUBLISHED, BibliographyDataType::UNPUBLISHED },
+ { XML_WWW, BibliographyDataType::WWW },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+
+
+void XMLTextFieldExport::ProcessBibliographyData(
+ const Reference<XPropertySet>& rPropSet)
+{
+ // get the values
+ Any aAny = rPropSet->getPropertyValue(sPropertyFields);
+ Sequence<PropertyValue> aValues;
+ aAny >>= aValues;
+
+ // one attribute per value (unless empty)
+ sal_Int32 nLength = aValues.getLength();
+ for (sal_Int32 i = 0; i < nLength; i++)
+ {
+ if (aValues[i].Name.equalsAsciiL("BibiliographicType",
+ sizeof("BibiliographicType")-1))
+ {
+ sal_Int16 nTypeId = 0;
+ aValues[i].Value >>= nTypeId;
+ OUStringBuffer sBuf;
+
+ if (SvXMLUnitConverter::convertEnum(sBuf, nTypeId,
+ aBibliographyDataTypeMap))
+ {
+ rExport.AddAttribute(XML_NAMESPACE_TEXT,
+ XML_BIBLIOGRAPHY_TYPE,
+ sBuf.makeStringAndClear());
+ }
+ // else: ignore this argument
+ }
+ else
+ {
+ OUString sStr;
+ aValues[i].Value >>= sStr;
+
+ if (sStr.getLength() > 0)
+ {
+ rExport.AddAttribute(XML_NAMESPACE_TEXT,
+ MapBibliographyFieldName(aValues[i].Name),
+ sStr);
+ }
+ }
+ }
+}
+
+/// export CommandTypeAttribute
+void XMLTextFieldExport::ProcessCommandType(
+ sal_Int32 nCommandType)
+{
+ enum XMLTokenEnum eToken = XML_TOKEN_INVALID;
+ switch( nCommandType )
+ {
+ case sdb::CommandType::TABLE: eToken = XML_TABLE; break;
+ case sdb::CommandType::QUERY: eToken = XML_QUERY; break;
+ case sdb::CommandType::COMMAND: eToken = XML_COMMAND; break;
+ }
+
+ if( eToken != XML_TOKEN_INVALID )
+ rExport.AddAttribute( XML_NAMESPACE_TEXT, XML_TABLE_TYPE, eToken );
+}
+
+
+void XMLTextFieldExport::ProcessStringSequence(
+ const Sequence<OUString>& rSequence,
+ const OUString sSelected )
+{
+ // find selected element
+ sal_Int32 nSelected = -1;
+ sal_Int32 nLength = rSequence.getLength();
+ const OUString* pSequence = rSequence.getConstArray();
+ for( sal_Int32 i = 0; i < nLength; i++ )
+ {
+ if( pSequence[i] == sSelected )
+ nSelected = i;
+ }
+
+ // delegate to ProcessStringSequence(OUString,sal_Int32)
+ ProcessStringSequence( rSequence, nSelected );
+}
+
+void XMLTextFieldExport::ProcessStringSequence(
+ const Sequence<OUString>& rSequence,
+ sal_Int32 nSelected )
+{
+ sal_Int32 nLength = rSequence.getLength();
+ const OUString* pSequence = rSequence.getConstArray();
+ for( sal_Int32 i = 0; i < nLength; i++ )
+ {
+ if( i == nSelected )
+ rExport.AddAttribute( XML_NAMESPACE_TEXT,
+ XML_CURRENT_SELECTED, XML_TRUE );
+ rExport.AddAttribute( XML_NAMESPACE_TEXT, XML_VALUE, pSequence[i] );
+ SvXMLElementExport aElement( rExport, XML_NAMESPACE_TEXT, XML_LABEL,
+ sal_False, sal_False );
+ }
+}
+
+void XMLTextFieldExport::ExportDataBaseElement(
+ enum XMLTokenEnum eElementName,
+ const OUString& sPresentation,
+ const Reference<XPropertySet>& rPropertySet,
+ const Reference<XPropertySetInfo>& rPropertySetInfo )
+{
+ DBG_ASSERT( eElementName != XML_TOKEN_INVALID, "need token" );
+ DBG_ASSERT( rPropertySet.is(), "need property set" );
+ DBG_ASSERT( rPropertySetInfo.is(), "need property set info" );
+
+ // get database properties
+ OUString sDataBaseName;
+ OUString sDataBaseURL;
+ OUString sStr;
+ if( ( rPropertySet->getPropertyValue( sPropertyDataBaseName ) >>= sStr )
+ && ( sStr.getLength() > 0 ) )
+ {
+ sDataBaseName = sStr;
+ }
+ else if( rPropertySetInfo->hasPropertyByName( sPropertyDataBaseURL ) &&
+ (rPropertySet->getPropertyValue( sPropertyDataBaseURL ) >>= sStr) &&
+ (sStr.getLength() > 0) )
+ {
+ sDataBaseURL = sStr;
+ }
+
+ // add database name property (if present)
+ if( sDataBaseName.getLength() > 0 )
+ rExport.AddAttribute( XML_NAMESPACE_TEXT, XML_DATABASE_NAME,
+ sDataBaseName );
+ SvXMLElementExport aDataBaseElement( GetExport(),
+ XML_NAMESPACE_TEXT, eElementName,
+ sal_False, sal_False );
+
+ // write URL as children
+ if( sDataBaseURL.getLength() > 0 )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, sDataBaseURL );
+ SvXMLElementExport aDataSourceElement(
+ GetExport(), XML_NAMESPACE_FORM, XML_CONNECTION_RESOURCE,
+ sal_False, sal_False );
+ }
+
+ // write presentation
+ rExport.Characters( sPresentation );
+}
+
+
+
+// explode a field master name into field type and field name
+sal_Bool XMLTextFieldExport::ExplodeFieldMasterName(
+ const OUString& sMasterName, OUString& sFieldType, OUString& sVarName)
+{
+ sal_Int32 nLength = sFieldMasterPrefix.getLength();
+ sal_Int32 nSeparator = sMasterName.indexOf('.', nLength);
+ sal_Bool bReturn = sal_True;
+
+#ifdef DBG_UTIL
+ // check for service name
+ bReturn &= (0 == sFieldMasterPrefix.compareTo(sMasterName, nLength));
+#endif
+
+ // '.' found?
+ if (nSeparator <= nLength) {
+ nSeparator = sMasterName.getLength();
+ DBG_WARNING("no field var name!");
+ bReturn = sal_False;
+ }
+ else
+ {
+ sFieldType = sMasterName.copy(nLength, nSeparator-nLength);
+ sVarName = sMasterName.copy(nSeparator+1);
+ }
+
+ return bReturn;
+}
+
+
+// for XDependentTextFields, get PropertySet of FieldMaster
+Reference<XPropertySet> XMLTextFieldExport::GetMasterPropertySet(
+ const Reference<XTextField> & rTextField)
+{
+ // name, value => get Property set of TextFieldMaster
+ Reference<XDependentTextField> xDep(rTextField, UNO_QUERY);
+ return xDep->getTextFieldMaster();
+}
+
+// get PropertySet of (any; the first) dependent field
+sal_Bool XMLTextFieldExport::GetDependentFieldPropertySet(
+ const Reference<XPropertySet> & xMaster,
+ Reference<XPropertySet> & xField)
+{
+ Any aAny;
+ Sequence<Reference<XDependentTextField> > aFields;
+ aAny = xMaster->getPropertyValue(sPropertyDependentTextFields);
+ aAny >>= aFields;
+
+ // any fields?
+ if (aFields.getLength() > 0)
+ {
+ // get first one and return
+ Reference<XDependentTextField> xTField = aFields[0];
+ xField = Reference<XPropertySet>(xTField, UNO_QUERY);
+ DBG_ASSERT(xField.is(),
+ "Surprisinlgy, this TextField refuses to be a PropertySet!");
+ return sal_True;
+ }
+ else
+ {
+ return sal_False;
+ }
+}
+
+
+/// map placeholder type
+enum XMLTokenEnum XMLTextFieldExport::MapPlaceholderType(sal_uInt16 nType)
+{
+ enum XMLTokenEnum eType = XML_TEXT;
+
+ switch (nType)
+ {
+ case PlaceholderType::TEXT:
+ eType = XML_TEXT;
+ break;
+
+ case PlaceholderType::TABLE:
+ eType = XML_TABLE;
+ break;
+
+ case PlaceholderType::TEXTFRAME:
+ eType = XML_TEXT_BOX;
+ break;
+
+ case PlaceholderType::GRAPHIC:
+ eType = XML_IMAGE;
+ break;
+
+ case PlaceholderType::OBJECT:
+ eType = XML_OBJECT;
+ break;
+
+ default:
+ // unkown placeholder: XML_TEXT
+ OSL_FAIL("unkown placeholder type");
+ }
+
+ return eType;
+}
+
+
+/// element name for author fields
+enum XMLTokenEnum XMLTextFieldExport::MapAuthorFieldName(
+ const Reference<XPropertySet> & xPropSet)
+{
+ // Initalen oder voller Name?
+ return GetBoolProperty(sPropertyFullName, xPropSet)
+ ? XML_AUTHOR_NAME : XML_AUTHOR_INITIALS;
+}
+
+enum XMLTokenEnum XMLTextFieldExport::MapPageNumberName(
+ const Reference<XPropertySet> & xPropSet,
+ sal_Int32& nOffset)
+{
+ enum XMLTokenEnum eName = XML_TOKEN_INVALID;
+ PageNumberType ePage;
+ Any aAny = xPropSet->getPropertyValue(sPropertySubType);
+ ePage = *(PageNumberType*)aAny.getValue();
+
+ switch (ePage)
+ {
+ case PageNumberType_PREV:
+ eName = XML_PREVIOUS;
+ nOffset += 1;
+ break;
+ case PageNumberType_CURRENT:
+ eName = XML_CURRENT;
+ break;
+ case PageNumberType_NEXT:
+ eName = XML_NEXT;
+ nOffset -= 1;
+ break;
+ default:
+ OSL_FAIL("unknown page number type");
+ eName = XML_TOKEN_INVALID;
+ break;
+ }
+
+ return eName;
+}
+
+/// map TemplateDisplayFormat to XML
+enum XMLTokenEnum XMLTextFieldExport::MapTemplateDisplayFormat(sal_Int16 nFormat)
+{
+ enum XMLTokenEnum eName = XML_TOKEN_INVALID;
+
+ switch (nFormat)
+ {
+ case TemplateDisplayFormat::FULL:
+ eName = XML_FULL;
+ break;
+ case TemplateDisplayFormat::PATH:
+ eName = XML_PATH;
+ break;
+ case TemplateDisplayFormat::NAME:
+ eName = XML_NAME;
+ break;
+ case TemplateDisplayFormat::NAME_AND_EXT:
+ eName = XML_NAME_AND_EXTENSION;
+ break;
+ case TemplateDisplayFormat::AREA:
+ eName = XML_AREA;
+ break;
+ case TemplateDisplayFormat::TITLE:
+ eName = XML_TITLE;
+ break;
+ default:
+ OSL_FAIL("unknown template display format");
+ eName = XML_TOKEN_INVALID;
+ break;
+ }
+
+ return eName;
+}
+
+/// map count/statistics field token to XML name
+enum XMLTokenEnum XMLTextFieldExport::MapCountFieldName(FieldIdEnum nToken)
+{
+ enum XMLTokenEnum eElement = XML_TOKEN_INVALID;
+
+ switch (nToken)
+ {
+ case FIELD_ID_COUNT_PAGES:
+ eElement = XML_PAGE_COUNT;
+ break;
+ case FIELD_ID_COUNT_PARAGRAPHS:
+ eElement = XML_PARAGRAPH_COUNT;
+ break;
+ case FIELD_ID_COUNT_WORDS:
+ eElement = XML_WORD_COUNT;
+ break;
+ case FIELD_ID_COUNT_CHARACTERS:
+ eElement = XML_CHARACTER_COUNT;
+ break;
+ case FIELD_ID_COUNT_TABLES:
+ eElement = XML_TABLE_COUNT;
+ break;
+ case FIELD_ID_COUNT_GRAPHICS:
+ eElement = XML_IMAGE_COUNT;
+ break;
+ case FIELD_ID_COUNT_OBJECTS:
+ eElement = XML_OBJECT_COUNT;
+ break;
+ default:
+ OSL_FAIL("no count field token");
+ eElement = XML_TOKEN_INVALID;
+ break;
+ }
+
+ return eElement;
+}
+
+/// map ChapterDisplayFormat to XML string
+enum XMLTokenEnum XMLTextFieldExport::MapChapterDisplayFormat(sal_Int16 nFormat)
+{
+ enum XMLTokenEnum eName = XML_TOKEN_INVALID;
+
+ switch (nFormat)
+ {
+ case ChapterFormat::NAME:
+ eName = XML_NAME;
+ break;
+ case ChapterFormat::NUMBER:
+ eName = XML_NUMBER;
+ break;
+ case ChapterFormat::NAME_NUMBER:
+ eName = XML_NUMBER_AND_NAME;
+ break;
+ case ChapterFormat::NO_PREFIX_SUFFIX:
+ eName = XML_PLAIN_NUMBER_AND_NAME;
+ break;
+ case ChapterFormat::DIGIT:
+ eName = XML_PLAIN_NUMBER;
+ break;
+ default:
+ OSL_FAIL("unkown chapter display format");
+ eName = XML_TOKEN_INVALID;
+ break;
+ }
+
+ return eName;
+}
+
+
+/// map FilenameDisplayFormat to XML attribute names
+enum XMLTokenEnum XMLTextFieldExport::MapFilenameDisplayFormat(sal_Int16 nFormat)
+{
+ enum XMLTokenEnum eName = XML_TOKEN_INVALID;
+
+ switch (nFormat)
+ {
+ case FilenameDisplayFormat::FULL:
+ eName = XML_FULL;
+ break;
+ case FilenameDisplayFormat::PATH:
+ eName = XML_PATH;
+ break;
+ case FilenameDisplayFormat::NAME:
+ eName = XML_NAME;
+ break;
+ case FilenameDisplayFormat::NAME_AND_EXT:
+ eName = XML_NAME_AND_EXTENSION;
+ break;
+ default:
+ OSL_FAIL("unknown filename display format");
+ }
+
+ return eName;
+}
+
+
+/// map ReferenceFieldPart to XML string
+enum XMLTokenEnum XMLTextFieldExport::MapReferenceType(sal_Int16 nType)
+{
+ enum XMLTokenEnum eElement = XML_TOKEN_INVALID;
+
+ switch (nType)
+ {
+ case ReferenceFieldPart::PAGE:
+ eElement = XML_PAGE;
+ break;
+ case ReferenceFieldPart::CHAPTER:
+ eElement = XML_CHAPTER;
+ break;
+ case ReferenceFieldPart::TEXT:
+ eElement = XML_TEXT;
+ break;
+ case ReferenceFieldPart::UP_DOWN:
+ eElement = XML_DIRECTION;
+ break;
+ case ReferenceFieldPart::CATEGORY_AND_NUMBER:
+ eElement = XML_CATEGORY_AND_VALUE;
+ break;
+ case ReferenceFieldPart::ONLY_CAPTION:
+ eElement = XML_CAPTION;
+ break;
+ case ReferenceFieldPart::ONLY_SEQUENCE_NUMBER:
+ eElement = XML_VALUE;
+ break;
+ case ReferenceFieldPart::PAGE_DESC:
+ // small hack: this value never gets written, because
+ // XML_TEMPLATE is default
+ eElement = XML_TEMPLATE;
+ break;
+ // Core implementation for direct cross-references (#i81002#)
+ case ReferenceFieldPart::NUMBER:
+ eElement = XML_NUMBER;
+ break;
+ case ReferenceFieldPart::NUMBER_NO_CONTEXT:
+ eElement = XML_NUMBER_NO_SUPERIOR;
+ break;
+ case ReferenceFieldPart::NUMBER_FULL_CONTEXT:
+ eElement = XML_NUMBER_ALL_SUPERIOR;
+ break;
+ default:
+ OSL_FAIL("unknown reference type");
+ eElement = XML_TEMPLATE;
+ break;
+ }
+
+ return eElement;
+}
+
+/// map ReferenceFieldPart to XML string
+enum XMLTokenEnum XMLTextFieldExport::MapReferenceSource(sal_Int16 nType)
+{
+ enum XMLTokenEnum eElement = XML_TOKEN_INVALID;
+
+ switch (nType)
+ {
+ case ReferenceFieldSource::REFERENCE_MARK:
+ eElement = XML_REFERENCE_REF;
+ break;
+ case ReferenceFieldSource::SEQUENCE_FIELD:
+ eElement = XML_SEQUENCE_REF;
+ break;
+ case ReferenceFieldSource::BOOKMARK:
+ eElement = XML_BOOKMARK_REF;
+ break;
+ case ReferenceFieldSource::FOOTNOTE:
+ case ReferenceFieldSource::ENDNOTE:
+ eElement = XML_NOTE_REF;
+ break;
+ default:
+ OSL_FAIL("unkown reference source");
+ break;
+ }
+
+ return eElement;
+}
+
+
+/// element name for sender fields
+enum XMLTokenEnum XMLTextFieldExport::MapSenderFieldName(
+ const Reference<XPropertySet> & xPropSet)
+{
+ enum XMLTokenEnum eName = XML_TOKEN_INVALID;
+
+ // sub-field type
+ switch (GetInt16Property(sPropertyFieldSubType, xPropSet))
+ {
+ case UserDataPart::COMPANY :
+ eName = XML_SENDER_COMPANY;
+ break;
+ case UserDataPart::FIRSTNAME :
+ eName = XML_SENDER_FIRSTNAME;
+ break;
+ case UserDataPart::NAME :
+ eName = XML_SENDER_LASTNAME;
+ break;
+ case UserDataPart::SHORTCUT :
+ eName = XML_SENDER_INITIALS;
+ break;
+ case UserDataPart::STREET :
+ eName = XML_SENDER_STREET;
+ break;
+ case UserDataPart::COUNTRY :
+ eName = XML_SENDER_COUNTRY;
+ break;
+ case UserDataPart::ZIP :
+ eName = XML_SENDER_POSTAL_CODE;
+ break;
+ case UserDataPart::CITY :
+ eName = XML_SENDER_CITY;
+ break;
+ case UserDataPart::TITLE :
+ eName = XML_SENDER_TITLE;
+ break;
+ case UserDataPart::POSITION :
+ eName = XML_SENDER_POSITION;
+ break;
+ case UserDataPart::PHONE_PRIVATE :
+ eName = XML_SENDER_PHONE_PRIVATE;
+ break;
+ case UserDataPart::PHONE_COMPANY :
+ eName = XML_SENDER_PHONE_WORK;
+ break;
+ case UserDataPart::FAX :
+ eName = XML_SENDER_FAX;
+ break;
+ case UserDataPart::EMAIL :
+ eName = XML_SENDER_EMAIL;
+ break;
+ case UserDataPart::STATE :
+ eName = XML_SENDER_STATE_OR_PROVINCE;
+ break;
+ default:
+ DBG_WARNING("unknown sender type");
+ eName = XML_TOKEN_INVALID;
+ break;
+ }
+
+ return eName;
+}
+
+enum XMLTokenEnum XMLTextFieldExport::MapDocInfoFieldName(
+ enum FieldIdEnum nToken)
+{
+ enum XMLTokenEnum eElement = XML_TOKEN_INVALID;
+
+ switch (nToken)
+ {
+ case FIELD_ID_DOCINFO_CREATION_AUTHOR:
+ eElement = XML_INITIAL_CREATOR;
+ break;
+ case FIELD_ID_DOCINFO_CREATION_DATE:
+ eElement = XML_CREATION_DATE;
+ break;
+ case FIELD_ID_DOCINFO_CREATION_TIME:
+ eElement = XML_CREATION_TIME;
+ break;
+ case FIELD_ID_DOCINFO_DESCRIPTION:
+ eElement = XML_DESCRIPTION;
+ break;
+ case FIELD_ID_DOCINFO_PRINT_TIME:
+ eElement = XML_PRINT_TIME;
+ break;
+ case FIELD_ID_DOCINFO_PRINT_DATE:
+ eElement = XML_PRINT_DATE;
+ break;
+ case FIELD_ID_DOCINFO_PRINT_AUTHOR:
+ eElement = XML_PRINTED_BY;
+ break;
+ case FIELD_ID_DOCINFO_TITLE:
+ eElement = XML_TITLE;
+ break;
+ case FIELD_ID_DOCINFO_SUBJECT:
+ eElement = XML_SUBJECT;
+ break;
+ case FIELD_ID_DOCINFO_KEYWORDS:
+ eElement = XML_KEYWORDS;
+ break;
+ case FIELD_ID_DOCINFO_REVISION:
+ eElement = XML_EDITING_CYCLES;
+ break;
+ case FIELD_ID_DOCINFO_EDIT_DURATION:
+ eElement = XML_EDITING_DURATION;
+ break;
+ case FIELD_ID_DOCINFO_SAVE_TIME:
+ eElement = XML_MODIFICATION_TIME;
+ break;
+ case FIELD_ID_DOCINFO_SAVE_DATE:
+ eElement = XML_MODIFICATION_DATE;
+ break;
+ case FIELD_ID_DOCINFO_SAVE_AUTHOR:
+ eElement = XML_CREATOR;
+ break;
+ default:
+ DBG_WARNING("unknown docinfo field type!");
+ eElement = XML_TOKEN_INVALID;
+ break;
+ }
+
+ return eElement;
+}
+
+enum XMLTokenEnum XMLTextFieldExport::MapBibliographyFieldName(OUString sName)
+{
+ enum XMLTokenEnum eName = XML_TOKEN_INVALID;
+
+ if (sName.equalsAsciiL("Identifier", sizeof("Identifier")-1))
+ {
+ eName = XML_IDENTIFIER;
+ }
+ else if (sName.equalsAsciiL("BibiliographicType",
+ sizeof("BibiliographicType")-1))
+ {
+ eName = XML_BIBLIOGRAPHY_TYPE;
+ }
+ else if (sName.equalsAsciiL("Address", sizeof("Address")-1))
+ {
+ eName = XML_ADDRESS;
+ }
+ else if (sName.equalsAsciiL("Annote", sizeof("Annote")-1))
+ {
+ eName = XML_ANNOTE;
+ }
+ else if (sName.equalsAsciiL("Author", sizeof("Author")-1))
+ {
+ eName = XML_AUTHOR;
+ }
+ else if (sName.equalsAsciiL("Booktitle", sizeof("Booktitle")-1))
+ {
+ eName = XML_BOOKTITLE;
+ }
+ else if (sName.equalsAsciiL("Chapter", sizeof("Chapter")-1))
+ {
+ eName = XML_CHAPTER;
+ }
+ else if (sName.equalsAsciiL("Edition", sizeof("Edition")-1))
+ {
+ eName = XML_EDITION;
+ }
+ else if (sName.equalsAsciiL("Editor", sizeof("Editor")-1))
+ {
+ eName = XML_EDITOR;
+ }
+ else if (sName.equalsAsciiL("Howpublished", sizeof("Howpublished")-1))
+ {
+ eName = XML_HOWPUBLISHED;
+ }
+ else if (sName.equalsAsciiL("Institution", sizeof("Institution")-1))
+ {
+ eName = XML_INSTITUTION;
+ }
+ else if (sName.equalsAsciiL("Journal", sizeof("Journal")-1))
+ {
+ eName = XML_JOURNAL;
+ }
+ else if (sName.equalsAsciiL("Month", sizeof("Month")-1))
+ {
+ eName = XML_MONTH;
+ }
+ else if (sName.equalsAsciiL("Note", sizeof("Note")-1))
+ {
+ eName = XML_NOTE;
+ }
+ else if (sName.equalsAsciiL("Number", sizeof("Number")-1))
+ {
+ eName = XML_NUMBER;
+ }
+ else if (sName.equalsAsciiL("Organizations", sizeof("Organizations")-1))
+ {
+ eName = XML_ORGANIZATIONS;
+ }
+ else if (sName.equalsAsciiL("Pages", sizeof("Pages")-1))
+ {
+ eName = XML_PAGES;
+ }
+ else if (sName.equalsAsciiL("Publisher", sizeof("Publisher")-1))
+ {
+ eName = XML_PUBLISHER;
+ }
+ else if (sName.equalsAsciiL("School", sizeof("School")-1))
+ {
+ eName = XML_SCHOOL;
+ }
+ else if (sName.equalsAsciiL("Series", sizeof("Series")-1))
+ {
+ eName = XML_SERIES;
+ }
+ else if (sName.equalsAsciiL("Title", sizeof("Title")-1))
+ {
+ eName = XML_TITLE;
+ }
+ else if (sName.equalsAsciiL("Report_Type", sizeof("Report_Type")-1))
+ {
+ eName = XML_REPORT_TYPE;
+ }
+ else if (sName.equalsAsciiL("Volume", sizeof("Volume")-1))
+ {
+ eName = XML_VOLUME;
+ }
+ else if (sName.equalsAsciiL("Year", sizeof("Year")-1))
+ {
+ eName = XML_YEAR;
+ }
+ else if (sName.equalsAsciiL("URL", sizeof("URL")-1))
+ {
+ eName = XML_URL;
+ }
+ else if (sName.equalsAsciiL("Custom1", sizeof("Custom1")-1))
+ {
+ eName = XML_CUSTOM1;
+ }
+ else if (sName.equalsAsciiL("Custom2", sizeof("Custom2")-1))
+ {
+ eName = XML_CUSTOM2;
+ }
+ else if (sName.equalsAsciiL("Custom3", sizeof("Custom3")-1))
+ {
+ eName = XML_CUSTOM3;
+ }
+ else if (sName.equalsAsciiL("Custom4", sizeof("Custom4")-1))
+ {
+ eName = XML_CUSTOM4;
+ }
+ else if (sName.equalsAsciiL("Custom5", sizeof("Custom5")-1))
+ {
+ eName = XML_CUSTOM5;
+ }
+ else if (sName.equalsAsciiL("ISBN", sizeof("ISBN")-1))
+ {
+ eName = XML_ISBN;
+ }
+ else
+ {
+ OSL_FAIL("Unknown bibliography info data");
+ eName = XML_TOKEN_INVALID;
+ }
+
+ return eName;
+}
+
+enum XMLTokenEnum XMLTextFieldExport::MapMeasureKind(sal_Int16 nKind)
+{
+ switch( nKind )
+ {
+ case 0:
+ return XML_VALUE;
+ case 1:
+ return XML_UNIT;
+ }
+ return XML_GAP;
+}
+
+OUString XMLTextFieldExport::MakeFootnoteRefName(
+ sal_Int16 nSeqNo)
+{
+ // generate foot-/endnote ID
+ OUStringBuffer aBuf;
+ aBuf.appendAscii("ftn");
+ aBuf.append((sal_Int32)nSeqNo);
+ return aBuf.makeStringAndClear();
+}
+
+OUString XMLTextFieldExport::MakeSequenceRefName(
+ sal_Int16 nSeqNo,
+ const OUString& rSeqName)
+{
+ // generate foot-/endnote ID
+ OUStringBuffer aBuf;
+ aBuf.appendAscii("ref");
+ aBuf.append(rSeqName);
+ aBuf.append((sal_Int32)nSeqNo);
+ return aBuf.makeStringAndClear();
+}
+
+//
+// Property accessor helper functions
+//
+
+// to be relegated (does that word exist?) to a more appropriate place
+//
+
+
+inline sal_Bool GetBoolProperty(
+ const OUString& sPropName,
+ const Reference<XPropertySet> & xPropSet)
+{
+ Any aAny = xPropSet->getPropertyValue(sPropName);
+ sal_Bool bBool = *(sal_Bool *)aAny.getValue();
+ return bBool;
+}
+
+inline sal_Bool GetOptionalBoolProperty(
+ const OUString& sPropName,
+ const Reference<XPropertySet> & xPropSet,
+ const Reference<XPropertySetInfo> & xPropSetInfo,
+ sal_Bool bDefault)
+{
+ return xPropSetInfo->hasPropertyByName( sPropName )
+ ? GetBoolProperty( sPropName, xPropSet ) : bDefault;
+}
+
+inline double GetDoubleProperty(
+ const OUString& sPropName,
+ const Reference<XPropertySet> & xPropSet)
+{
+ Any aAny = xPropSet->getPropertyValue(sPropName);
+ double fDouble = 0.0;
+ aAny >>= fDouble;
+ return fDouble;
+}
+
+inline OUString const GetStringProperty(
+ const OUString& sPropName,
+ const Reference<XPropertySet> & xPropSet)
+{
+ Any aAny = xPropSet->getPropertyValue(sPropName);
+ OUString sString;
+ aAny >>= sString;
+ return sString;
+}
+
+inline sal_Int32 GetIntProperty(
+ const OUString& sPropName,
+ const Reference<XPropertySet> & xPropSet)
+{
+ Any aAny = xPropSet->getPropertyValue(sPropName);
+ sal_Int32 nInt = 0;
+ aAny >>= nInt;
+ return nInt;
+}
+
+inline sal_Int16 GetInt16Property(
+ const OUString& sPropName,
+ const Reference<XPropertySet> & xPropSet)
+{
+ Any aAny = xPropSet->getPropertyValue(sPropName);
+ sal_Int16 nInt = 0;
+ aAny >>= nInt;
+ return nInt;
+}
+
+inline sal_Int8 GetInt8Property(
+ const OUString& sPropName,
+ const Reference<XPropertySet> & xPropSet)
+{
+ Any aAny = xPropSet->getPropertyValue(sPropName);
+ sal_Int8 nInt = 0;
+ aAny >>= nInt;
+ return nInt;
+}
+
+inline DateTime const GetDateTimeProperty(
+ const OUString& sPropName,
+ const Reference<XPropertySet> & xPropSet)
+{
+ Any aAny = xPropSet->getPropertyValue(sPropName);
+ DateTime aTime;
+ aAny >>= aTime;
+ return aTime;
+}
+
+inline Date const GetDateProperty(
+ const OUString& sPropName,
+ const Reference<XPropertySet> & xPropSet)
+{
+ Any aAny = xPropSet->getPropertyValue(sPropName);
+ Date aDate;
+ aAny >>= aDate;
+ return aDate;
+}
+
+inline Sequence<OUString> const GetStringSequenceProperty(
+ const OUString& sPropName,
+ const Reference<XPropertySet> & xPropSet)
+{
+ Any aAny = xPropSet->getPropertyValue(sPropName);
+ Sequence<OUString> aSequence;
+ aAny >>= aSequence;
+ return aSequence;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx
new file mode 100644
index 000000000000..af7677a2cdc6
--- /dev/null
+++ b/xmloff/source/text/txtfldi.cxx
@@ -0,0 +1,4127 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+/** @#file
+ *
+ * Import of all text fields except those from txtvfldi.cxx
+ * (variable related text fields and database display fields)
+ */
+#include "txtfldi.hxx"
+#include "txtvfldi.hxx"
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmlnumi.hxx>
+#include <xmloff/txtimp.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmlement.hxx>
+#include "XMLStringBufferImportContext.hxx"
+#include <xmloff/XMLEventsImportContext.hxx>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/text/UserDataPart.hpp>
+#include <com/sun/star/style/NumberingType.hpp>
+#include <com/sun/star/text/PlaceholderType.hpp>
+#include <com/sun/star/text/ReferenceFieldPart.hpp>
+#include <com/sun/star/text/ReferenceFieldSource.hpp>
+#include <com/sun/star/text/XTextField.hpp>
+#include <com/sun/star/text/XTextContent.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/text/XTextFieldsSupplier.hpp>
+#include <com/sun/star/text/XDependentTextField.hpp>
+#include <com/sun/star/text/SetVariableType.hpp>
+#include <com/sun/star/text/FilenameDisplayFormat.hpp>
+#include <com/sun/star/text/ChapterFormat.hpp>
+#include <com/sun/star/text/TemplateDisplayFormat.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/text/BibliographyDataType.hpp>
+#include <com/sun/star/text/BibliographyDataField.hpp>
+#include <com/sun/star/util/XUpdatable.hpp>
+#include <com/sun/star/sdb/CommandType.hpp>
+
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/math.hxx>
+#include <tools/debug.hxx>
+
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::document;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::xmloff::token;
+
+
+//
+// SO API string constants
+//
+
+// service prefix and service anems
+const sal_Char sAPI_textfield_prefix[] = "com.sun.star.text.TextField.";
+const sal_Char sAPI_fieldmaster_prefix[] = "com.sun.star.text.FieldMaster.";
+const sal_Char sAPI_presentation_prefix[] = "com.sun.star.presentation.TextField.";
+
+const sal_Char sAPI_extended_user[] = "ExtendedUser";
+const sal_Char sAPI_user_data_type[] = "UserDataType";
+const sal_Char sAPI_jump_edit[] = "JumpEdit";
+const sal_Char sAPI_get_expression[] = "GetExpression";
+const sal_Char sAPI_set_expression[] = "SetExpression";
+const sal_Char sAPI_user[] = "User";
+const sal_Char sAPI_date_time[] = "DateTime";
+const sal_Char sAPI_page_number[] = "PageNumber";
+const sal_Char sAPI_database_next[] = "DatabaseNextSet";
+const sal_Char sAPI_database_select[] = "DatabaseNumberOfSet";
+const sal_Char sAPI_database_number[] = "DatabaseSetNumber";
+const sal_Char sAPI_database[] = "Database";
+const sal_Char sAPI_database_name[] = "DatabaseName";
+const sal_Char sAPI_docinfo_change_author[] = "DocInfo.ChangeAuthor";
+const sal_Char sAPI_docinfo_change_date_time[] = "DocInfo.ChangeDateTime";
+const sal_Char sAPI_docinfo_edit_time[] = "DocInfo.EditTime";
+const sal_Char sAPI_docinfo_description[] = "DocInfo.Description";
+const sal_Char sAPI_docinfo_create_author[] = "DocInfo.CreateAuthor";
+const sal_Char sAPI_docinfo_create_date_time[] = "DocInfo.CreateDateTime";
+const sal_Char sAPI_docinfo_custom[] = "DocInfo.Custom";
+const sal_Char sAPI_docinfo_print_author[] = "DocInfo.PrintAuthor";
+const sal_Char sAPI_docinfo_print_date_time[] = "DocInfo.PrintDateTime";
+const sal_Char sAPI_docinfo_keywords[] = "DocInfo.KeyWords";
+const sal_Char sAPI_docinfo_subject[] = "DocInfo.Subject";
+const sal_Char sAPI_docinfo_title[] = "DocInfo.Title";
+const sal_Char sAPI_docinfo_revision[] = "DocInfo.Revision";
+const sal_Char sAPI_hidden_paragraph[] = "HiddenParagraph";
+const sal_Char sAPI_hidden_text[] = "HiddenText";
+const sal_Char sAPI_conditional_text[] = "ConditionalText";
+const sal_Char sAPI_file_name[] = "FileName";
+const sal_Char sAPI_chapter[] = "Chapter";
+const sal_Char sAPI_template_name[] = "TemplateName";
+const sal_Char sAPI_page_count[] = "PageCount";
+const sal_Char sAPI_paragraph_count[] = "ParagraphCount";
+const sal_Char sAPI_word_count[] = "WordCount";
+const sal_Char sAPI_character_count[] = "CharacterCount";
+const sal_Char sAPI_table_count[] = "TableCount";
+const sal_Char sAPI_graphic_object_count[] = "GraphicObjectCount";
+const sal_Char sAPI_embedded_object_count[] = "EmbeddedObjectCount";
+const sal_Char sAPI_reference_page_set[] = "ReferencePageSet";
+const sal_Char sAPI_reference_page_get[] = "ReferencePageGet";
+const sal_Char sAPI_macro[] = "Macro";
+const sal_Char sAPI_dde[] = "DDE";
+const sal_Char sAPI_get_reference[] = "GetReference";
+const sal_Char sAPI_sheet_name[] = "SheetName";
+const sal_Char sAPI_url[] = "URL";
+const sal_Char sAPI_bibliography[] = "Bibliography";
+const sal_Char sAPI_annotation[] = "Annotation";
+const sal_Char sAPI_script[] = "Script";
+const sal_Char sAPI_measure[] = "Measure";
+const sal_Char sAPI_drop_down[] = "DropDown";
+const sal_Char sAPI_header[] = "Header";
+const sal_Char sAPI_footer[] = "Footer";
+const sal_Char sAPI_datetime[] = "DateTime";
+
+// property names
+const sal_Char sAPI_is_fixed[] = "IsFixed";
+const sal_Char sAPI_content[] = "Content";
+const sal_Char sAPI_value[] = "Value";
+const sal_Char sAPI_author[] = "Author";
+const sal_Char sAPI_full_name[] = "FullName";
+const sal_Char sAPI_place_holder_type[] = "PlaceHolderType";
+const sal_Char sAPI_place_holder[] = "PlaceHolder";
+const sal_Char sAPI_hint[] = "Hint";
+const sal_Char sAPI_variable_name[] = "VariableName";
+const sal_Char sAPI_name[] = "Name";
+const sal_Char sAPI_sub_type[] = "SubType";
+const sal_Char sAPI_numbering_separator[] = "NumberingSeparator";
+const sal_Char sAPI_chapter_numbering_level[] = "ChapterNumberingLevel";
+const sal_Char sAPI_variable_subtype[] = "VariableSubtype";
+const sal_Char sAPI_formula[] = "Formula";
+const sal_Char sAPI_date_time_value[] = "DateTimeValue";
+const sal_Char sAPI_number_format[] = "NumberFormat";
+const sal_Char sAPI_user_text[] = "UserText";
+const sal_Char sAPI_numbering_type[] = "NumberingType";
+const sal_Char sAPI_offset[] = "Offset";
+const sal_Char sAPI_data_base_name[] = "DataBaseName";
+const sal_Char sAPI_data_base_u_r_l[] = "DataBaseURL";
+const sal_Char sAPI_data_table_name[] = "DataTableName";
+const sal_Char sAPI_condition[] = "Condition";
+const sal_Char sAPI_set_number[] = "SetNumber";
+const sal_Char sAPI_is_data_base_format[] = "DataBaseFormat";
+const sal_Char sAPI_true_content[] = "TrueContent";
+const sal_Char sAPI_false_content[] = "FalseContent";
+const sal_Char sAPI_revision[] = "Revision";
+const sal_Char sAPI_file_format[] = "FileFormat";
+const sal_Char sAPI_chapter_format[] = "ChapterFormat";
+const sal_Char sAPI_level[] = "Level";
+const sal_Char sAPI_is_date[] = "IsDate";
+const sal_Char sAPI_adjust[] = "Adjust";
+const sal_Char sAPI_on[] = "On";
+const sal_Char sAPI_is_automatic_update[] = "IsAutomaticUpdate";
+const sal_Char sAPI_source_name[] = "SourceName";
+const sal_Char sAPI_current_presentation[] = "CurrentPresentation";
+const sal_Char sAPI_reference_field_part[] = "ReferenceFieldPart";
+const sal_Char sAPI_reference_field_source[] = "ReferenceFieldSource";
+const sal_Char sAPI_dde_command_type[] = "DDECommandType";
+const sal_Char sAPI_dde_command_file[] = "DDECommandFile";
+const sal_Char sAPI_dde_command_element[] = "DDECommandElement";
+// sAPI_url: also used as service name
+const sal_Char sAPI_target_frame[] = "TargetFrame";
+const sal_Char sAPI_representation[] = "Representation";
+const sal_Char sAPI_date[] = "Date";
+const sal_Char sAPI_url_content[] = "URLContent";
+const sal_Char sAPI_script_type[] = "ScriptType";
+const sal_Char sAPI_is_hidden[] = "IsHidden";
+const sal_Char sAPI_is_condition_true[] = "IsConditionTrue";
+const sal_Char sAPI_data_command_type[] = "DataCommandType";
+const sal_Char sAPI_is_fixed_language[] = "IsFixedLanguage";
+const sal_Char sAPI_is_visible[] = "IsVisible";
+const sal_Char sAPI_TextRange[] = "TextRange";
+
+const sal_Char sAPI_true[] = "TRUE";
+
+
+TYPEINIT1( XMLTextFieldImportContext, SvXMLImportContext);
+
+XMLTextFieldImportContext::XMLTextFieldImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp,
+ const sal_Char* pService,
+ sal_uInt16 nPrefix, const OUString& rElementName)
+: SvXMLImportContext( rImport, nPrefix, rElementName )
+, sIsFixed(RTL_CONSTASCII_USTRINGPARAM(sAPI_is_fixed))
+, rTextImportHelper(rHlp)
+, sServicePrefix(RTL_CONSTASCII_USTRINGPARAM(sAPI_textfield_prefix))
+, bValid(sal_False)
+{
+ DBG_ASSERT(NULL != pService, "Need service name!");
+ sServiceName = OUString::createFromAscii(pService);
+}
+
+void XMLTextFieldImportContext::StartElement(
+ const Reference<XAttributeList> & xAttrList)
+{
+ // process attributes
+ sal_Int16 nLength = xAttrList->getLength();
+ for(sal_Int16 i=0; i<nLength; i++) {
+
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(i), &sLocalName );
+
+ ProcessAttribute(rTextImportHelper.GetTextFieldAttrTokenMap().
+ Get(nPrefix, sLocalName),
+ xAttrList->getValueByIndex(i) );
+ }
+}
+
+XMLTextFieldImportContext::~XMLTextFieldImportContext() {
+}
+
+OUString XMLTextFieldImportContext::GetContent()
+{
+ if (sContent.getLength()==0)
+ {
+ sContent = sContentBuffer.makeStringAndClear();
+ }
+
+ return sContent;
+}
+
+void XMLTextFieldImportContext::EndElement()
+{
+ DBG_ASSERT(GetServiceName().getLength()>0, "no service name for element!");
+ if (bValid)
+ {
+
+ // create field/Service
+ Reference<XPropertySet> xPropSet;
+ if (CreateField(xPropSet, sServicePrefix + GetServiceName()))
+ {
+ // set field properties
+ PrepareField(xPropSet);
+
+ // attach field to document
+ Reference<XTextContent> xTextContent(xPropSet, UNO_QUERY);
+
+ // workaround for #80606#
+ try
+ {
+ rTextImportHelper.InsertTextContent(xTextContent);
+ }
+ catch (lang::IllegalArgumentException e)
+ {
+ // ignore
+ }
+ return;
+ }
+ }
+
+ // in case of error: write element content
+ rTextImportHelper.InsertString(GetContent());
+}
+
+void XMLTextFieldImportContext::Characters(const OUString& rContent)
+{
+ sContentBuffer.append(rContent);
+}
+
+sal_Bool XMLTextFieldImportContext::CreateField(
+ Reference<XPropertySet> & xField,
+ const OUString& rServiceName)
+{
+ // instantiate new XTextField:
+ // ask import for model, model is factory, ask factory to create service
+
+ Reference<XMultiServiceFactory> xFactory(GetImport().GetModel(),UNO_QUERY);
+ if( xFactory.is() )
+ {
+ Reference<XInterface> xIfc = xFactory->createInstance(rServiceName);
+ if( xIfc.is() )
+ {
+ Reference<XPropertySet> xTmp( xIfc, UNO_QUERY );
+
+ xField = xTmp;
+ } else {
+ return sal_False; // can't create instance
+ }
+ } else {
+ return sal_False; // can't get MultiServiceFactory
+ }
+
+ return sal_True;
+}
+
+/// create the appropriate field context from
+XMLTextFieldImportContext*
+XMLTextFieldImportContext::CreateTextFieldImportContext(
+ SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrefix,
+ const OUString& rName,
+ sal_uInt16 nToken)
+{
+ XMLTextFieldImportContext* pContext = NULL;
+
+ switch (nToken)
+ {
+ case XML_TOK_TEXT_SENDER_FIRSTNAME:
+ case XML_TOK_TEXT_SENDER_LASTNAME:
+ case XML_TOK_TEXT_SENDER_INITIALS:
+ case XML_TOK_TEXT_SENDER_TITLE:
+ case XML_TOK_TEXT_SENDER_POSITION:
+ case XML_TOK_TEXT_SENDER_EMAIL:
+ case XML_TOK_TEXT_SENDER_PHONE_PRIVATE:
+ case XML_TOK_TEXT_SENDER_FAX:
+ case XML_TOK_TEXT_SENDER_COMPANY:
+ case XML_TOK_TEXT_SENDER_PHONE_WORK:
+ case XML_TOK_TEXT_SENDER_STREET:
+ case XML_TOK_TEXT_SENDER_CITY:
+ case XML_TOK_TEXT_SENDER_POSTAL_CODE:
+ case XML_TOK_TEXT_SENDER_COUNTRY:
+ case XML_TOK_TEXT_SENDER_STATE_OR_PROVINCE:
+ pContext =
+ new XMLSenderFieldImportContext( rImport, rHlp,
+ nPrefix, rName, nToken );
+ break;
+
+ case XML_TOK_TEXT_AUTHOR_NAME:
+ case XML_TOK_TEXT_AUTHOR_INITIALS:
+ pContext =
+ new XMLAuthorFieldImportContext( rImport, rHlp,
+ nPrefix, rName, nToken );
+ break;
+
+ case XML_TOK_TEXT_PLACEHOLDER:
+ pContext =
+ new XMLPlaceholderFieldImportContext( rImport, rHlp,
+ nPrefix, rName);
+ break;
+ case XML_TOK_TEXT_SEQUENCE:
+ pContext =
+ new XMLSequenceFieldImportContext( rImport, rHlp,
+ nPrefix, rName );
+ break;
+ case XML_TOK_TEXT_TEXT_INPUT:
+ pContext =
+ new XMLTextInputFieldImportContext( rImport, rHlp,
+ nPrefix, rName );
+ break;
+ case XML_TOK_TEXT_EXPRESSION:
+ pContext =
+ new XMLExpressionFieldImportContext( rImport, rHlp,
+ nPrefix, rName );
+ break;
+ case XML_TOK_TEXT_VARIABLE_SET:
+ pContext =
+ new XMLVariableSetFieldImportContext( rImport, rHlp,
+ nPrefix, rName );
+ break;
+ case XML_TOK_TEXT_VARIABLE_INPUT:
+ pContext =
+ new XMLVariableInputFieldImportContext( rImport, rHlp,
+ nPrefix, rName );
+ break;
+ case XML_TOK_TEXT_VARIABLE_GET:
+ pContext =
+ new XMLVariableGetFieldImportContext( rImport, rHlp,
+ nPrefix, rName );
+ break;
+ case XML_TOK_TEXT_USER_FIELD_GET:
+ pContext = new XMLUserFieldImportContext( rImport, rHlp,
+ nPrefix, rName );
+ break;
+ case XML_TOK_TEXT_USER_FIELD_INPUT:
+ pContext = new XMLUserFieldInputImportContext( rImport, rHlp,
+ nPrefix, rName );
+ break;
+ case XML_TOK_TEXT_TIME:
+ pContext = new XMLTimeFieldImportContext( rImport, rHlp,
+ nPrefix, rName );
+ break;
+ case XML_TOK_TEXT_PAGE_CONTINUATION_STRING:
+ case XML_TOK_TEXT_PAGE_CONTINUATION:
+ pContext = new XMLPageContinuationImportContext( rImport, rHlp,
+ nPrefix, rName );
+ break;
+
+ case XML_TOK_TEXT_PAGE_NUMBER:
+ pContext = new XMLPageNumberImportContext( rImport, rHlp,
+ nPrefix, rName );
+ break;
+
+ case XML_TOK_TEXT_DATE:
+ pContext = new XMLDateFieldImportContext( rImport, rHlp,
+ nPrefix, rName );
+ break;
+
+ case XML_TOK_TEXT_DATABASE_NAME:
+ pContext = new XMLDatabaseNameImportContext( rImport, rHlp,
+ nPrefix, rName );
+ break;
+ case XML_TOK_TEXT_DATABASE_NEXT:
+ pContext = new XMLDatabaseNextImportContext( rImport, rHlp,
+ nPrefix, rName );
+ break;
+ case XML_TOK_TEXT_DATABASE_SELECT:
+ pContext = new XMLDatabaseSelectImportContext( rImport, rHlp,
+ nPrefix, rName );
+ break;
+ case XML_TOK_TEXT_DATABASE_ROW_NUMBER:
+ pContext = new XMLDatabaseNumberImportContext( rImport, rHlp,
+ nPrefix, rName );
+ break;
+ case XML_TOK_TEXT_DATABASE_DISPLAY:
+ pContext = new XMLDatabaseDisplayImportContext( rImport, rHlp,
+ nPrefix, rName );
+ break;
+ case XML_TOK_TEXT_CONDITIONAL_TEXT:
+ pContext = new XMLConditionalTextImportContext( rImport, rHlp,
+ nPrefix, rName );
+ break;
+ case XML_TOK_TEXT_HIDDEN_TEXT:
+ pContext = new XMLHiddenTextImportContext( rImport, rHlp,
+ nPrefix, rName );
+ break;
+ case XML_TOK_TEXT_HIDDEN_PARAGRAPH:
+ pContext = new XMLHiddenParagraphImportContext( rImport, rHlp,
+ nPrefix, rName );
+ break;
+ case XML_TOK_TEXT_DOCUMENT_DESCRIPTION:
+ case XML_TOK_TEXT_DOCUMENT_TITLE:
+ case XML_TOK_TEXT_DOCUMENT_SUBJECT:
+ case XML_TOK_TEXT_DOCUMENT_KEYWORDS:
+ pContext = new XMLSimpleDocInfoImportContext( rImport, rHlp,
+ nPrefix, rName,
+ nToken, sal_True,
+ sal_False );
+ break;
+ case XML_TOK_TEXT_DOCUMENT_CREATION_AUTHOR:
+ case XML_TOK_TEXT_DOCUMENT_PRINT_AUTHOR:
+ case XML_TOK_TEXT_DOCUMENT_SAVE_AUTHOR:
+ pContext = new XMLSimpleDocInfoImportContext( rImport, rHlp,
+ nPrefix, rName,
+ nToken, sal_False,
+ sal_True );
+ break;
+
+ case XML_TOK_TEXT_DOCUMENT_CREATION_DATE:
+ case XML_TOK_TEXT_DOCUMENT_CREATION_TIME:
+ case XML_TOK_TEXT_DOCUMENT_PRINT_DATE:
+ case XML_TOK_TEXT_DOCUMENT_PRINT_TIME:
+ case XML_TOK_TEXT_DOCUMENT_SAVE_DATE:
+ case XML_TOK_TEXT_DOCUMENT_SAVE_TIME:
+ case XML_TOK_TEXT_DOCUMENT_EDIT_DURATION:
+ pContext = new XMLDateTimeDocInfoImportContext( rImport, rHlp,
+ nPrefix, rName,
+ nToken );
+ break;
+
+ case XML_TOK_TEXT_DOCUMENT_REVISION:
+ pContext = new XMLRevisionDocInfoImportContext( rImport, rHlp,
+ nPrefix, rName,
+ nToken );
+ break;
+
+ case XML_TOK_TEXT_DOCUMENT_USER_DEFINED:
+ pContext = new XMLUserDocInfoImportContext( rImport, rHlp,
+ nPrefix, rName,
+ nToken );
+ break;
+
+ case XML_TOK_TEXT_FILENAME:
+ pContext = new XMLFileNameImportContext( rImport, rHlp,
+ nPrefix, rName );
+ break;
+
+ case XML_TOK_TEXT_CHAPTER:
+ pContext = new XMLChapterImportContext( rImport, rHlp,
+ nPrefix, rName );
+ break;
+
+ case XML_TOK_TEXT_TEMPLATENAME:
+ pContext = new XMLTemplateNameImportContext( rImport, rHlp,
+ nPrefix, rName );
+ break;
+
+ case XML_TOK_TEXT_WORD_COUNT:
+ case XML_TOK_TEXT_PARAGRAPH_COUNT:
+ case XML_TOK_TEXT_TABLE_COUNT:
+ case XML_TOK_TEXT_CHARACTER_COUNT:
+ case XML_TOK_TEXT_IMAGE_COUNT:
+ case XML_TOK_TEXT_OBJECT_COUNT:
+ case XML_TOK_TEXT_PAGE_COUNT:
+ pContext = new XMLCountFieldImportContext( rImport, rHlp,
+ nPrefix, rName, nToken);
+ break;
+
+ case XML_TOK_TEXT_GET_PAGE_VAR:
+ pContext = new XMLPageVarGetFieldImportContext( rImport, rHlp,
+ nPrefix, rName );
+ break;
+
+ case XML_TOK_TEXT_SET_PAGE_VAR:
+ pContext = new XMLPageVarSetFieldImportContext( rImport, rHlp,
+ nPrefix, rName );
+ break;
+
+ case XML_TOK_TEXT_MACRO:
+ pContext = new XMLMacroFieldImportContext( rImport, rHlp,
+ nPrefix, rName );
+ break;
+
+ case XML_TOK_TEXT_DDE:
+ pContext = new XMLDdeFieldImportContext( rImport, rHlp,
+ nPrefix, rName );
+ break;
+
+ case XML_TOK_TEXT_REFERENCE_REF:
+ case XML_TOK_TEXT_BOOKMARK_REF:
+ case XML_TOK_TEXT_NOTE_REF:
+ case XML_TOK_TEXT_SEQUENCE_REF:
+ pContext = new XMLReferenceFieldImportContext( rImport, rHlp,
+ nToken,
+ nPrefix, rName );
+ break;
+
+ case XML_TOK_TEXT_SHEET_NAME:
+ pContext = new XMLSheetNameImportContext( rImport, rHlp,
+ nPrefix, rName );
+ break;
+
+ case XML_TOK_TEXT_BIBLIOGRAPHY_MARK:
+ pContext = new XMLBibliographyFieldImportContext( rImport, rHlp,
+ nPrefix, rName );
+ break;
+
+ case XML_TOK_TEXT_ANNOTATION:
+ pContext = new XMLAnnotationImportContext( rImport, rHlp,
+ nPrefix, rName);
+ break;
+
+ case XML_TOK_TEXT_SCRIPT:
+ pContext = new XMLScriptImportContext( rImport, rHlp,
+ nPrefix, rName);
+ break;
+
+ case XML_TOK_TEXT_MEASURE:
+ pContext = new XMLMeasureFieldImportContext( rImport, rHlp,
+ nPrefix, rName );
+ break;
+
+ case XML_TOK_TEXT_TABLE_FORMULA:
+ pContext = new XMLTableFormulaImportContext( rImport, rHlp,
+ nPrefix, rName );
+ break;
+ case XML_TOK_TEXT_DROPDOWN:
+ pContext = new XMLDropDownFieldImportContext( rImport, rHlp,
+ nPrefix, rName );
+ break;
+ case XML_TOK_DRAW_HEADER:
+ pContext = new XMLHeaderFieldImportContext( rImport, rHlp,
+ nPrefix, rName );
+ break;
+ case XML_TOK_DRAW_FOOTER:
+ pContext = new XMLFooterFieldImportContext( rImport, rHlp,
+ nPrefix, rName );
+ break;
+ case XML_TOK_DRAW_DATE_TIME:
+ pContext = new XMLDateTimeFieldImportContext( rImport, rHlp,
+ nPrefix, rName );
+ break;
+
+ default:
+ // ignore! May not even be a textfield.
+ // (Reminder: This method is called inside default:-branch)
+ pContext = NULL;
+ break;
+ }
+
+ return pContext;
+}
+
+
+void XMLTextFieldImportContext::ForceUpdate(
+ const Reference<XPropertySet> & rPropertySet)
+{
+ // force update
+ Reference<XUpdatable> xUpdate(rPropertySet, UNO_QUERY);
+ if (xUpdate.is())
+ {
+ xUpdate->update();
+ }
+ else
+ {
+ OSL_FAIL("Expected XUpdatable support!");
+ }
+}
+
+
+
+//
+// XMLSenderFieldImportContext
+//
+
+TYPEINIT1( XMLSenderFieldImportContext, XMLTextFieldImportContext);
+
+XMLSenderFieldImportContext::XMLSenderFieldImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx, const OUString& sLocalName,
+ sal_uInt16 nToken)
+: XMLTextFieldImportContext(rImport, rHlp, sAPI_extended_user,nPrfx, sLocalName)
+, sPropertyFixed(RTL_CONSTASCII_USTRINGPARAM(sAPI_is_fixed))
+, sPropertyFieldSubType(RTL_CONSTASCII_USTRINGPARAM(sAPI_user_data_type))
+, sPropertyContent(RTL_CONSTASCII_USTRINGPARAM(sAPI_content))
+, bFixed(sal_True)
+, nElementToken(nToken)
+{
+}
+
+void XMLSenderFieldImportContext::StartElement(
+ const Reference<XAttributeList> & xAttrList)
+{
+ bValid = sal_True;
+ switch (nElementToken) {
+ case XML_TOK_TEXT_SENDER_FIRSTNAME:
+ nSubType = UserDataPart::FIRSTNAME;
+ break;
+ case XML_TOK_TEXT_SENDER_LASTNAME:
+ nSubType = UserDataPart::NAME;
+ break;
+ case XML_TOK_TEXT_SENDER_INITIALS:
+ nSubType = UserDataPart::SHORTCUT;
+ break;
+ case XML_TOK_TEXT_SENDER_TITLE:
+ nSubType = UserDataPart::TITLE;
+ break;
+ case XML_TOK_TEXT_SENDER_POSITION:
+ nSubType = UserDataPart::POSITION;
+ break;
+ case XML_TOK_TEXT_SENDER_EMAIL:
+ nSubType = UserDataPart::EMAIL;
+ break;
+ case XML_TOK_TEXT_SENDER_PHONE_PRIVATE:
+ nSubType = UserDataPart::PHONE_PRIVATE;
+ break;
+ case XML_TOK_TEXT_SENDER_FAX:
+ nSubType = UserDataPart::FAX;
+ break;
+ case XML_TOK_TEXT_SENDER_COMPANY:
+ nSubType = UserDataPart::COMPANY;
+ break;
+ case XML_TOK_TEXT_SENDER_PHONE_WORK:
+ nSubType = UserDataPart::PHONE_COMPANY;
+ break;
+ case XML_TOK_TEXT_SENDER_STREET:
+ nSubType = UserDataPart::STREET;
+ break;
+ case XML_TOK_TEXT_SENDER_CITY:
+ nSubType = UserDataPart::CITY;
+ break;
+ case XML_TOK_TEXT_SENDER_POSTAL_CODE:
+ nSubType = UserDataPart::ZIP;
+ break;
+ case XML_TOK_TEXT_SENDER_COUNTRY:
+ nSubType = UserDataPart::COUNTRY;
+ break;
+ case XML_TOK_TEXT_SENDER_STATE_OR_PROVINCE:
+ nSubType = UserDataPart::STATE;
+ break;
+ default:
+ bValid = sal_False;
+ break;
+ }
+
+ // process Attributes
+ XMLTextFieldImportContext::StartElement(xAttrList);
+}
+
+void XMLSenderFieldImportContext::ProcessAttribute(
+ sal_uInt16 nAttrToken,
+ const OUString& sAttrValue)
+{
+ if (XML_TOK_TEXTFIELD_FIXED == nAttrToken) {
+
+ // set bVal
+ bool bVal;
+ bool bRet = GetImport().GetMM100UnitConverter().
+ convertBool(bVal, sAttrValue);
+
+ // set bFixed if successfull
+ if (bRet) {
+ bFixed = bVal;
+ }
+ }
+}
+
+void XMLSenderFieldImportContext::PrepareField(
+ const Reference<XPropertySet> & rPropSet)
+{
+ // set members
+ Any aAny;
+ aAny <<= nSubType;
+ rPropSet->setPropertyValue(sPropertyFieldSubType, aAny);
+
+ // set fixed
+ aAny.setValue( &bFixed, ::getBooleanCppuType() );
+ rPropSet->setPropertyValue(sPropertyFixed, aAny);
+
+ // set content if fixed
+ if (bFixed)
+ {
+ // in organizer or styles-only mode: force update
+ if (GetImport().GetTextImport()->IsOrganizerMode() ||
+ GetImport().GetTextImport()->IsStylesOnlyMode() )
+ {
+ ForceUpdate(rPropSet);
+ }
+ else
+ {
+ aAny <<= GetContent();
+ rPropSet->setPropertyValue(sPropertyContent, aAny);
+ }
+ }
+}
+
+
+
+//
+// XMLAuthorFieldImportContext
+//
+
+TYPEINIT1( XMLAuthorFieldImportContext, XMLSenderFieldImportContext);
+
+XMLAuthorFieldImportContext::XMLAuthorFieldImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx, const OUString& sLocalName,
+ sal_uInt16 nToken)
+: XMLSenderFieldImportContext(rImport, rHlp, nPrfx, sLocalName, nToken)
+, bAuthorFullName(sal_True)
+, sServiceAuthor(RTL_CONSTASCII_USTRINGPARAM(sAPI_author))
+, sPropertyAuthorFullName(RTL_CONSTASCII_USTRINGPARAM(sAPI_full_name))
+, sPropertyFixed(RTL_CONSTASCII_USTRINGPARAM(sAPI_is_fixed))
+, sPropertyContent(RTL_CONSTASCII_USTRINGPARAM(sAPI_content))
+{
+ // overwrite service name from XMLSenderFieldImportContext
+ SetServiceName(sServiceAuthor);
+}
+
+void XMLAuthorFieldImportContext::StartElement(
+ const Reference<XAttributeList> & xAttrList) {
+
+ bAuthorFullName = (XML_TOK_TEXT_AUTHOR_INITIALS != nElementToken);
+ bValid = sal_True;
+
+ // process Attributes
+ XMLTextFieldImportContext::StartElement(xAttrList);
+}
+
+void XMLAuthorFieldImportContext::PrepareField(
+ const Reference<XPropertySet> & rPropSet)
+{
+ // set members
+ Any aAny;
+ aAny.setValue( &bAuthorFullName, ::getBooleanCppuType() );
+ rPropSet->setPropertyValue(sPropertyAuthorFullName, aAny);
+
+ aAny.setValue( &bFixed, ::getBooleanCppuType() );
+ rPropSet->setPropertyValue(sPropertyFixed, aAny);
+
+ // set content if fixed
+ if (bFixed)
+ {
+ // organizer or styles-only mode: force update
+ if (GetImport().GetTextImport()->IsOrganizerMode() ||
+ GetImport().GetTextImport()->IsStylesOnlyMode() )
+ {
+ ForceUpdate(rPropSet);
+ }
+ else
+ {
+ aAny <<= GetContent();
+ rPropSet->setPropertyValue(sPropertyContent, aAny);
+ }
+ }
+}
+
+
+//
+// page continuation string
+//
+
+TYPEINIT1( XMLPageContinuationImportContext, XMLTextFieldImportContext );
+
+static SvXMLEnumMapEntry const lcl_aSelectPageAttrMap[] =
+{
+ { XML_PREVIOUS, PageNumberType_PREV },
+ { XML_CURRENT, PageNumberType_CURRENT },
+ { XML_NEXT, PageNumberType_NEXT },
+ { XML_TOKEN_INVALID, 0 },
+};
+
+XMLPageContinuationImportContext::XMLPageContinuationImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp, sal_uInt16 nPrfx,
+ const OUString& sLocalName)
+: XMLTextFieldImportContext(rImport, rHlp, sAPI_page_number, nPrfx, sLocalName)
+, sPropertySubType(RTL_CONSTASCII_USTRINGPARAM(sAPI_sub_type))
+, sPropertyUserText(RTL_CONSTASCII_USTRINGPARAM(sAPI_user_text))
+, sPropertyNumberingType(RTL_CONSTASCII_USTRINGPARAM(sAPI_numbering_type))
+, eSelectPage(PageNumberType_CURRENT)
+, sStringOK(sal_False)
+{
+ bValid = sal_True;
+}
+
+void XMLPageContinuationImportContext::ProcessAttribute(
+ sal_uInt16 nAttrToken, const OUString& sAttrValue )
+{
+ switch(nAttrToken)
+ {
+ case XML_TOK_TEXTFIELD_SELECT_PAGE:
+ {
+ sal_uInt16 nTmp;
+ if (SvXMLUnitConverter::convertEnum(nTmp, sAttrValue,
+ lcl_aSelectPageAttrMap)
+ && (PageNumberType_CURRENT != nTmp) )
+ {
+ eSelectPage = (PageNumberType)nTmp;
+ }
+ break;
+ }
+ case XML_TOK_TEXTFIELD_STRING_VALUE:
+ sString = sAttrValue;
+ sStringOK = sal_True;
+ break;
+ }
+}
+
+void XMLPageContinuationImportContext::PrepareField(
+ const Reference<XPropertySet> & xPropertySet)
+{
+ Any aAny;
+
+ aAny <<= eSelectPage;
+ xPropertySet->setPropertyValue(sPropertySubType, aAny);
+
+ aAny <<= (sStringOK ? sString : GetContent());
+ xPropertySet->setPropertyValue(sPropertyUserText, aAny);
+
+ aAny <<= style::NumberingType::CHAR_SPECIAL;
+ xPropertySet->setPropertyValue(sPropertyNumberingType, aAny);
+}
+
+
+
+//
+// page number field
+//
+
+TYPEINIT1( XMLPageNumberImportContext, XMLTextFieldImportContext );
+
+XMLPageNumberImportContext::XMLPageNumberImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp, sal_uInt16 nPrfx,
+ const OUString& sLocalName)
+: XMLTextFieldImportContext(rImport, rHlp, sAPI_page_number, nPrfx, sLocalName)
+, sPropertySubType(RTL_CONSTASCII_USTRINGPARAM(sAPI_sub_type))
+, sPropertyNumberingType(RTL_CONSTASCII_USTRINGPARAM(sAPI_numbering_type))
+, sPropertyOffset(RTL_CONSTASCII_USTRINGPARAM(sAPI_offset))
+, sNumberSync(GetXMLToken(XML_FALSE))
+, nPageAdjust(0)
+, eSelectPage(PageNumberType_CURRENT)
+, sNumberFormatOK(sal_False)
+{
+ bValid = sal_True;
+}
+
+void XMLPageNumberImportContext::ProcessAttribute(
+ sal_uInt16 nAttrToken,
+ const OUString& sAttrValue )
+{
+ switch (nAttrToken)
+ {
+ case XML_TOK_TEXTFIELD_NUM_FORMAT:
+ sNumberFormat = sAttrValue;
+ sNumberFormatOK = sal_True;
+ break;
+ case XML_TOK_TEXTFIELD_NUM_LETTER_SYNC:
+ sNumberSync = sAttrValue;
+ break;
+ case XML_TOK_TEXTFIELD_SELECT_PAGE:
+ {
+ sal_uInt16 nTmp;
+ if (SvXMLUnitConverter::convertEnum(nTmp, sAttrValue,
+ lcl_aSelectPageAttrMap))
+ {
+ eSelectPage = (PageNumberType)nTmp;
+ }
+ break;
+ }
+ case XML_TOK_TEXTFIELD_PAGE_ADJUST:
+ {
+ sal_Int32 nTmp;
+ if (SvXMLUnitConverter::convertNumber(nTmp, sAttrValue))
+ {
+ nPageAdjust = (sal_Int16)nTmp;
+ }
+ break;
+ }
+ }
+}
+
+void XMLPageNumberImportContext::PrepareField(
+ const Reference<XPropertySet> & xPropertySet)
+{
+ Any aAny;
+
+ // all properties are optional
+ Reference<XPropertySetInfo> xPropertySetInfo(
+ xPropertySet->getPropertySetInfo());
+
+ if (xPropertySetInfo->hasPropertyByName(sPropertyNumberingType))
+ {
+ sal_Int16 nNumType;
+ if( sNumberFormatOK )
+ {
+ nNumType= style::NumberingType::ARABIC;
+ GetImport().GetMM100UnitConverter().convertNumFormat( nNumType,
+ sNumberFormat,
+ sNumberSync );
+ }
+ else
+ nNumType = style::NumberingType::PAGE_DESCRIPTOR;
+
+ aAny <<= nNumType;
+ xPropertySet->setPropertyValue(sPropertyNumberingType, aAny);
+ }
+
+ if (xPropertySetInfo->hasPropertyByName(sPropertyOffset))
+ {
+ // adjust offset
+ switch (eSelectPage)
+ {
+ case PageNumberType_PREV:
+ nPageAdjust--;
+ break;
+ case PageNumberType_CURRENT:
+ break;
+ case PageNumberType_NEXT:
+ nPageAdjust++;
+ break;
+ default:
+ DBG_WARNING("unknown page number type");
+ }
+ aAny <<= nPageAdjust;
+ xPropertySet->setPropertyValue(sPropertyOffset, aAny);
+ }
+
+ if (xPropertySetInfo->hasPropertyByName(sPropertySubType))
+ {
+ aAny <<= eSelectPage;
+ xPropertySet->setPropertyValue(sPropertySubType, aAny);
+ }
+}
+
+
+
+//
+// Placeholder
+//
+
+TYPEINIT1( XMLPlaceholderFieldImportContext, XMLTextFieldImportContext);
+
+XMLPlaceholderFieldImportContext::XMLPlaceholderFieldImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx, const OUString& sLocalName)
+: XMLTextFieldImportContext(rImport, rHlp, sAPI_jump_edit,nPrfx, sLocalName)
+, sPropertyPlaceholderType(RTL_CONSTASCII_USTRINGPARAM(sAPI_place_holder_type))
+, sPropertyPlaceholder(RTL_CONSTASCII_USTRINGPARAM(sAPI_place_holder))
+, sPropertyHint(RTL_CONSTASCII_USTRINGPARAM(sAPI_hint))
+{
+}
+
+/// process attribute values
+void XMLPlaceholderFieldImportContext::ProcessAttribute(
+ sal_uInt16 nAttrToken, const OUString& sAttrValue )
+{
+ switch (nAttrToken) {
+ case XML_TOK_TEXTFIELD_DESCRIPTION:
+ sDescription = sAttrValue;
+ break;
+
+ case XML_TOK_TEXTFIELD_PLACEHOLDER_TYPE:
+ bValid = sal_True;
+ if (IsXMLToken(sAttrValue, XML_TABLE))
+ {
+ nPlaceholderType = PlaceholderType::TABLE;
+ }
+ else if (IsXMLToken(sAttrValue, XML_TEXT))
+ {
+ nPlaceholderType = PlaceholderType::TEXT;
+ }
+ else if (IsXMLToken(sAttrValue, XML_TEXT_BOX))
+ {
+ nPlaceholderType = PlaceholderType::TEXTFRAME;
+ }
+ else if (IsXMLToken(sAttrValue, XML_IMAGE))
+ {
+ nPlaceholderType = PlaceholderType::GRAPHIC;
+ }
+ else if (IsXMLToken(sAttrValue, XML_OBJECT))
+ {
+ nPlaceholderType = PlaceholderType::OBJECT;
+ }
+ else
+ {
+ bValid = sal_False;
+ }
+ break;
+
+ default:
+ ; // ignore
+ }
+}
+
+void XMLPlaceholderFieldImportContext::PrepareField(
+ const Reference<XPropertySet> & xPropertySet) {
+
+ Any aAny;
+ aAny <<= sDescription;
+ xPropertySet->setPropertyValue(sPropertyHint, aAny);
+
+ // remove <...> around content (if present)
+ OUString aContent = GetContent();
+ sal_Int32 nStart = 0;
+ sal_Int32 nLength = aContent.getLength();
+ if ((nLength > 0) && (aContent.getStr()[0] == '<'))
+ {
+ --nLength;
+ ++nStart;
+ }
+ if ((nLength > 0) && (aContent.getStr()[aContent.getLength()-1] == '>'))
+ {
+ --nLength;
+ }
+ aAny <<= aContent.copy(nStart, nLength);
+ xPropertySet->setPropertyValue(sPropertyPlaceholder, aAny);
+
+ aAny <<= nPlaceholderType;
+ xPropertySet->setPropertyValue(sPropertyPlaceholderType, aAny);
+}
+
+
+//
+// time field
+//
+
+TYPEINIT1( XMLTimeFieldImportContext, XMLTextFieldImportContext);
+
+XMLTimeFieldImportContext::XMLTimeFieldImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx, const OUString& sLocalName)
+: XMLTextFieldImportContext(rImport, rHlp, sAPI_date_time, nPrfx, sLocalName)
+, sPropertyNumberFormat(RTL_CONSTASCII_USTRINGPARAM(sAPI_number_format))
+, sPropertyFixed(RTL_CONSTASCII_USTRINGPARAM(sAPI_is_fixed))
+, sPropertyDateTimeValue(RTL_CONSTASCII_USTRINGPARAM(sAPI_date_time_value))
+, sPropertyDateTime(RTL_CONSTASCII_USTRINGPARAM(sAPI_date_time))
+, sPropertyAdjust(RTL_CONSTASCII_USTRINGPARAM(sAPI_adjust))
+, sPropertyIsDate(RTL_CONSTASCII_USTRINGPARAM(sAPI_is_date))
+, sPropertyIsFixedLanguage(RTL_CONSTASCII_USTRINGPARAM(sAPI_is_fixed_language))
+, fTimeValue(0.0)
+, nAdjust(0)
+, nFormatKey(0)
+, bTimeOK(sal_False)
+, bFormatOK(sal_False)
+, bFixed(sal_False)
+, bIsDate(sal_False)
+, bIsDefaultLanguage( sal_True )
+{
+ bValid = sal_True; // always valid!
+}
+
+void XMLTimeFieldImportContext::ProcessAttribute(
+ sal_uInt16 nAttrToken, const OUString& sAttrValue )
+{
+ switch (nAttrToken)
+ {
+ case XML_TOK_TEXTFIELD_TIME_VALUE:
+ {
+ double fTmp;
+ if (GetImport().GetMM100UnitConverter().
+ convertDateTime(fTmp, sAttrValue))
+ {
+ fTimeValue = fTmp;
+ bTimeOK = sal_True;
+ }
+
+ if (GetImport().GetMM100UnitConverter().
+ convertDateTime(aDateTimeValue, sAttrValue ))
+ {
+ bTimeOK = sal_True;
+ }
+ break;
+ }
+ case XML_TOK_TEXTFIELD_FIXED:
+ {
+ bool bTmp;
+ if (SvXMLUnitConverter::convertBool(bTmp, sAttrValue))
+ {
+ bFixed = bTmp;
+ }
+ break;
+ }
+ case XML_TOK_TEXTFIELD_DATA_STYLE_NAME:
+ {
+ sal_Int32 nKey = GetImportHelper().GetDataStyleKey(
+ sAttrValue, &bIsDefaultLanguage);
+ if (-1 != nKey)
+ {
+ nFormatKey = nKey;
+ bFormatOK = sal_True;
+ }
+ break;
+ }
+ case XML_TOK_TEXTFIELD_TIME_ADJUST:
+ {
+ double fTmp;
+
+ if (SvXMLUnitConverter::convertTime(fTmp, sAttrValue))
+ {
+ // convert to minutes
+ nAdjust = (sal_Int32)::rtl::math::approxFloor(fTmp * 60 * 24);
+ }
+ break;
+ }
+ }
+}
+
+void XMLTimeFieldImportContext::PrepareField(
+ const Reference<XPropertySet> & rPropertySet)
+{
+ Any aAny;
+
+ // all properties are optional (except IsDate)
+ Reference<XPropertySetInfo> xPropertySetInfo(
+ rPropertySet->getPropertySetInfo());
+
+ if (xPropertySetInfo->hasPropertyByName(sPropertyFixed))
+ {
+ aAny.setValue( &bFixed, ::getBooleanCppuType() );
+ rPropertySet->setPropertyValue(sPropertyFixed, aAny);
+ }
+
+ aAny.setValue( &bIsDate, ::getBooleanCppuType() );
+ rPropertySet->setPropertyValue(sPropertyIsDate, aAny);
+
+ if (xPropertySetInfo->hasPropertyByName(sPropertyAdjust))
+ {
+ aAny <<= nAdjust;
+ rPropertySet->setPropertyValue(sPropertyAdjust, aAny);
+ }
+
+ // set value
+ if (bFixed)
+ {
+ // organizer or styles-only mode: force update
+ if (GetImport().GetTextImport()->IsOrganizerMode() ||
+ GetImport().GetTextImport()->IsStylesOnlyMode() )
+ {
+ ForceUpdate(rPropertySet);
+ }
+ else
+ {
+ // normal mode: set value (if present)
+ if (bTimeOK)
+ {
+ if (xPropertySetInfo->hasPropertyByName(sPropertyDateTimeValue))
+ {
+ aAny <<= aDateTimeValue;
+ rPropertySet->setPropertyValue(sPropertyDateTimeValue,aAny);
+ }
+ else if (xPropertySetInfo->hasPropertyByName(sPropertyDateTime))
+ {
+ aAny <<= aDateTimeValue;
+ rPropertySet->setPropertyValue(sPropertyDateTime, aAny);
+ }
+ }
+ }
+ }
+
+ if (bFormatOK &&
+ xPropertySetInfo->hasPropertyByName(sPropertyNumberFormat))
+ {
+ aAny <<= nFormatKey;
+ rPropertySet->setPropertyValue(sPropertyNumberFormat, aAny);
+
+ if( xPropertySetInfo->hasPropertyByName( sPropertyIsFixedLanguage ) )
+ {
+ sal_Bool bIsFixedLanguage = ! bIsDefaultLanguage;
+ aAny.setValue( &bIsFixedLanguage, ::getBooleanCppuType() );
+ rPropertySet->setPropertyValue( sPropertyIsFixedLanguage, aAny );
+ }
+ }
+}
+
+
+
+//
+// date field
+//
+
+TYPEINIT1( XMLDateFieldImportContext, XMLTimeFieldImportContext );
+
+XMLDateFieldImportContext::XMLDateFieldImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx, const OUString& sLocalName) :
+ XMLTimeFieldImportContext(rImport, rHlp, nPrfx, sLocalName)
+{
+ bIsDate = sal_True; // always a date!
+}
+
+void XMLDateFieldImportContext::ProcessAttribute(
+ sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue )
+{
+ switch (nAttrToken)
+ {
+ case XML_TOK_TEXTFIELD_DATE_VALUE:
+ {
+ double fTmp;
+
+ if (GetImport().GetMM100UnitConverter().
+ convertDateTime(fTmp, sAttrValue))
+ {
+ // #96457#: don't truncate in order to read date+time
+ fTimeValue = fTmp;
+ bTimeOK = sal_True;
+ }
+
+ if (GetImport().GetMM100UnitConverter().
+ convertDateTime(aDateTimeValue, sAttrValue ))
+ {
+ bTimeOK = sal_True;
+ }
+ break;
+ }
+ case XML_TOK_TEXTFIELD_DATE_ADJUST:
+ // delegate to superclass, pretending it was a time-adjust attr.
+ XMLTimeFieldImportContext::ProcessAttribute(
+ XML_TOK_TEXTFIELD_TIME_ADJUST,
+ sAttrValue);
+ break;
+ case XML_TOK_TEXTFIELD_TIME_VALUE:
+ case XML_TOK_TEXTFIELD_TIME_ADJUST:
+ ; // ignore time-adjust and time-value attributes
+ break;
+ default:
+ // all others: delegate to super-class
+ XMLTimeFieldImportContext::ProcessAttribute(nAttrToken,
+ sAttrValue);
+ break;
+ }
+}
+
+
+
+
+//
+// database field superclass
+//
+
+TYPEINIT1( XMLDatabaseFieldImportContext, XMLTextFieldImportContext );
+
+XMLDatabaseFieldImportContext::XMLDatabaseFieldImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp,
+ const sal_Char* pServiceName, sal_uInt16 nPrfx,
+ const OUString& sLocalName, bool bUseDisply)
+: XMLTextFieldImportContext(rImport, rHlp, pServiceName, nPrfx, sLocalName)
+, sPropertyDataBaseName(RTL_CONSTASCII_USTRINGPARAM(sAPI_data_base_name))
+, sPropertyDataBaseURL(RTL_CONSTASCII_USTRINGPARAM(sAPI_data_base_u_r_l))
+, sPropertyTableName(RTL_CONSTASCII_USTRINGPARAM(sAPI_data_table_name))
+, sPropertyDataCommandType(RTL_CONSTASCII_USTRINGPARAM(sAPI_data_command_type))
+, sPropertyIsVisible(RTL_CONSTASCII_USTRINGPARAM(sAPI_is_visible))
+, nCommandType( sdb::CommandType::TABLE )
+, bCommandTypeOK(sal_False)
+, bDisplay( sal_True )
+, bDisplayOK( false )
+, bUseDisplay( bUseDisply )
+, bDatabaseOK(sal_False)
+, bDatabaseNameOK(sal_False)
+, bDatabaseURLOK(sal_False)
+, bTableOK(sal_False)
+{
+}
+
+void XMLDatabaseFieldImportContext::ProcessAttribute(
+ sal_uInt16 nAttrToken, const OUString& sAttrValue )
+{
+ switch (nAttrToken)
+ {
+ case XML_TOK_TEXTFIELD_DATABASE_NAME:
+ sDatabaseName = sAttrValue;
+ bDatabaseOK = sal_True;
+ bDatabaseNameOK = sal_True;
+ break;
+ case XML_TOK_TEXTFIELD_TABLE_NAME:
+ sTableName = sAttrValue;
+ bTableOK = sal_True;
+ break;
+ case XML_TOK_TEXTFIELD_TABLE_TYPE:
+ if( IsXMLToken( sAttrValue, XML_TABLE ) )
+ {
+ nCommandType = sdb::CommandType::TABLE;
+ bCommandTypeOK = sal_True;
+ }
+ else if( IsXMLToken( sAttrValue, XML_QUERY ) )
+ {
+ nCommandType = sdb::CommandType::QUERY;
+ bCommandTypeOK = sal_True;
+ }
+ else if( IsXMLToken( sAttrValue, XML_COMMAND ) )
+ {
+ nCommandType = sdb::CommandType::COMMAND;
+ bCommandTypeOK = sal_True;
+ }
+ break;
+ case XML_TOK_TEXTFIELD_DISPLAY:
+ if( IsXMLToken( sAttrValue, XML_NONE ) )
+ {
+ bDisplay = sal_False;
+ bDisplayOK = true;
+ }
+ else if( IsXMLToken( sAttrValue, XML_VALUE ) )
+ {
+ bDisplay = sal_True;
+ bDisplayOK = true;
+ }
+ break;
+ }
+}
+
+SvXMLImportContext* XMLDatabaseFieldImportContext::CreateChildContext(
+ sal_uInt16 p_nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList>& xAttrList )
+{
+ if( ( p_nPrefix == XML_NAMESPACE_FORM ) &&
+ IsXMLToken( rLocalName, XML_CONNECTION_RESOURCE ) )
+ {
+ // process attribute list directly
+ sal_Int16 nLength = xAttrList->getLength();
+ for( sal_Int16 n = 0; n < nLength; n++ )
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(n), &sLocalName );
+
+ if( ( nPrefix == XML_NAMESPACE_XLINK ) &&
+ IsXMLToken( sLocalName, XML_HREF ) )
+ {
+ sDatabaseURL = xAttrList->getValueByIndex(n);
+ bDatabaseOK = sal_True;
+ bDatabaseURLOK = sal_True;
+ }
+ }
+
+ // we call ProcessAttribute in order to set bValid appropriatly
+ ProcessAttribute( XML_TOKEN_INVALID, OUString() );
+ }
+
+ return SvXMLImportContext::CreateChildContext(p_nPrefix, rLocalName,
+ xAttrList);
+}
+
+
+void XMLDatabaseFieldImportContext::PrepareField(
+ const Reference<XPropertySet> & xPropertySet)
+{
+ Any aAny;
+
+ aAny <<= sTableName;
+ xPropertySet->setPropertyValue(sPropertyTableName, aAny);
+
+ if( bDatabaseNameOK )
+ {
+ aAny <<= sDatabaseName;
+ xPropertySet->setPropertyValue(sPropertyDataBaseName, aAny);
+ }
+ else if( bDatabaseURLOK )
+ {
+ aAny <<= sDatabaseURL;
+ xPropertySet->setPropertyValue(sPropertyDataBaseURL, aAny);
+ }
+
+ // #99980# load/save command type for all fields; also load
+ // old documents without command type
+ if( bCommandTypeOK )
+ {
+ aAny <<= nCommandType;
+ xPropertySet->setPropertyValue( sPropertyDataCommandType, aAny );
+ }
+
+ if( bUseDisplay && bDisplayOK )
+ {
+ aAny.setValue( &bDisplay, ::getBooleanCppuType() );
+ xPropertySet->setPropertyValue( sPropertyIsVisible, aAny );
+ }
+}
+
+
+
+//
+// database name field
+//
+
+TYPEINIT1( XMLDatabaseNameImportContext, XMLDatabaseFieldImportContext );
+
+XMLDatabaseNameImportContext::XMLDatabaseNameImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx, const OUString& sLocalName) :
+ XMLDatabaseFieldImportContext(rImport, rHlp, sAPI_database_name,
+ nPrfx, sLocalName, true)
+{
+}
+
+void XMLDatabaseNameImportContext::ProcessAttribute(
+ sal_uInt16 nAttrToken, const OUString& sAttrValue )
+{
+ // delegate to superclass and check for success
+ XMLDatabaseFieldImportContext::ProcessAttribute(nAttrToken, sAttrValue);
+ bValid = bDatabaseOK && bTableOK;
+}
+
+
+
+//
+// database next field
+//
+
+TYPEINIT1( XMLDatabaseNextImportContext, XMLDatabaseFieldImportContext );
+
+XMLDatabaseNextImportContext::XMLDatabaseNextImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp,
+ const sal_Char* pServiceName, sal_uInt16 nPrfx,
+ const OUString& sLocalName) :
+ XMLDatabaseFieldImportContext(rImport, rHlp, pServiceName,
+ nPrfx, sLocalName, false),
+ sPropertyCondition(RTL_CONSTASCII_USTRINGPARAM(sAPI_condition)),
+ sTrue(RTL_CONSTASCII_USTRINGPARAM(sAPI_true)),
+ sCondition(),
+ bConditionOK(sal_False)
+{
+}
+
+XMLDatabaseNextImportContext::XMLDatabaseNextImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx, const OUString& sLocalName)
+: XMLDatabaseFieldImportContext(rImport, rHlp, sAPI_database_next, nPrfx, sLocalName, false)
+, sPropertyCondition(RTL_CONSTASCII_USTRINGPARAM(sAPI_condition))
+, sTrue(RTL_CONSTASCII_USTRINGPARAM(sAPI_true))
+, bConditionOK(sal_False)
+{
+}
+
+void XMLDatabaseNextImportContext::ProcessAttribute(
+ sal_uInt16 nAttrToken, const OUString& sAttrValue )
+{
+ if (XML_TOK_TEXTFIELD_CONDITION == nAttrToken)
+ {
+ OUString sTmp;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap()._GetKeyByAttrName(
+ sAttrValue, &sTmp, sal_False );
+ if( XML_NAMESPACE_OOOW == nPrefix )
+ {
+ sCondition = sTmp;
+ bConditionOK = sal_True;
+ }
+ else
+ sCondition = sAttrValue;
+ }
+ else
+ {
+ XMLDatabaseFieldImportContext::ProcessAttribute(nAttrToken,
+ sAttrValue);
+ }
+
+ bValid = bDatabaseOK && bTableOK;
+}
+
+void XMLDatabaseNextImportContext::PrepareField(
+ const Reference<XPropertySet> & xPropertySet)
+{
+ Any aAny;
+
+ aAny <<= bConditionOK ? sCondition : sTrue;
+ xPropertySet->setPropertyValue(sPropertyCondition, aAny);
+
+ XMLDatabaseFieldImportContext::PrepareField(xPropertySet);
+}
+
+
+
+//
+// database select field
+//
+
+TYPEINIT1( XMLDatabaseSelectImportContext, XMLDatabaseNextImportContext );
+
+XMLDatabaseSelectImportContext::XMLDatabaseSelectImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx, const ::rtl::OUString& sLocalName) :
+ XMLDatabaseNextImportContext(rImport, rHlp, sAPI_database_select,
+ nPrfx, sLocalName),
+ sPropertySetNumber(RTL_CONSTASCII_USTRINGPARAM(sAPI_set_number)),
+ nNumber(0),
+ bNumberOK(sal_False)
+{
+}
+
+void XMLDatabaseSelectImportContext::ProcessAttribute(
+ sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue )
+{
+ if (XML_TOK_TEXTFIELD_ROW_NUMBER == nAttrToken)
+ {
+ sal_Int32 nTmp;
+ if (SvXMLUnitConverter::convertNumber( nTmp, sAttrValue
+ /* , nMin, nMax ??? */ ))
+ {
+ nNumber = nTmp;
+ bNumberOK = sal_True;
+ }
+ }
+ else
+ {
+ XMLDatabaseNextImportContext::ProcessAttribute(nAttrToken, sAttrValue);
+ }
+
+ bValid = bTableOK && bDatabaseOK && bNumberOK;
+}
+
+void XMLDatabaseSelectImportContext::PrepareField(
+ const Reference<XPropertySet> & xPropertySet)
+{
+ Any aAny;
+
+ aAny <<= nNumber;
+ xPropertySet->setPropertyValue(sPropertySetNumber, aAny);
+
+ XMLDatabaseNextImportContext::PrepareField(xPropertySet);
+}
+
+
+
+//
+// database display row number field
+//
+
+TYPEINIT1( XMLDatabaseNumberImportContext, XMLDatabaseFieldImportContext );
+
+XMLDatabaseNumberImportContext::XMLDatabaseNumberImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx, const OUString& sLocalName) :
+ XMLDatabaseFieldImportContext(rImport, rHlp, sAPI_database_number,
+ nPrfx, sLocalName, true),
+ sPropertyNumberingType(
+ RTL_CONSTASCII_USTRINGPARAM(sAPI_numbering_type)),
+ sPropertySetNumber(RTL_CONSTASCII_USTRINGPARAM(sAPI_set_number)),
+ sNumberFormat(RTL_CONSTASCII_USTRINGPARAM("1")),
+ sNumberSync(GetXMLToken(XML_FALSE)),
+ nValue(0),
+ bValueOK(sal_False)
+{
+}
+
+void XMLDatabaseNumberImportContext::ProcessAttribute(
+ sal_uInt16 nAttrToken,
+ const OUString& sAttrValue )
+{
+ switch (nAttrToken)
+ {
+ case XML_TOK_TEXTFIELD_NUM_FORMAT:
+ sNumberFormat = sAttrValue;
+ break;
+ case XML_TOK_TEXTFIELD_NUM_LETTER_SYNC:
+ sNumberSync = sAttrValue;
+ break;
+ case XML_TOK_TEXTFIELD_VALUE:
+ {
+ sal_Int32 nTmp;
+ if (SvXMLUnitConverter::convertNumber( nTmp, sAttrValue ))
+ {
+ nValue = nTmp;
+ bValueOK = sal_True;
+ }
+ break;
+ }
+ default:
+ XMLDatabaseFieldImportContext::ProcessAttribute(nAttrToken,
+ sAttrValue);
+ break;
+ }
+
+ bValid = bTableOK && bDatabaseOK;
+}
+
+void XMLDatabaseNumberImportContext::PrepareField(
+ const Reference<XPropertySet> & xPropertySet)
+{
+ Any aAny;
+
+ sal_Int16 nNumType = style::NumberingType::ARABIC;
+ GetImport().GetMM100UnitConverter().convertNumFormat( nNumType,
+ sNumberFormat,
+ sNumberSync );
+ aAny <<= nNumType;
+ xPropertySet->setPropertyValue(sPropertyNumberingType, aAny);
+
+ if (bValueOK)
+ {
+ aAny <<= nValue;
+ xPropertySet->setPropertyValue(sPropertySetNumber, aAny);
+ }
+
+ XMLDatabaseFieldImportContext::PrepareField(xPropertySet);
+}
+
+
+
+//
+// Simple doc info fields
+//
+
+TYPEINIT1( XMLSimpleDocInfoImportContext, XMLTextFieldImportContext );
+
+XMLSimpleDocInfoImportContext::XMLSimpleDocInfoImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx, const OUString& sLocalName, sal_uInt16 nToken,
+ sal_Bool bContent, sal_Bool bAuthor)
+: XMLTextFieldImportContext(rImport, rHlp, MapTokenToServiceName(nToken),nPrfx, sLocalName)
+, sPropertyFixed(RTL_CONSTASCII_USTRINGPARAM(sAPI_is_fixed))
+, sPropertyContent(RTL_CONSTASCII_USTRINGPARAM(sAPI_content))
+, sPropertyAuthor(RTL_CONSTASCII_USTRINGPARAM(sAPI_author))
+, sPropertyCurrentPresentation(RTL_CONSTASCII_USTRINGPARAM(sAPI_current_presentation))
+, bFixed(sal_False)
+, bHasAuthor(bAuthor)
+, bHasContent(bContent)
+{
+ bValid = sal_True;
+}
+
+void XMLSimpleDocInfoImportContext::ProcessAttribute(
+ sal_uInt16 nAttrToken,
+ const OUString& sAttrValue )
+{
+ if (XML_TOK_TEXTFIELD_FIXED == nAttrToken)
+ {
+ bool bTmp;
+ if (SvXMLUnitConverter::convertBool(bTmp, sAttrValue))
+ {
+ bFixed = bTmp;
+ }
+ }
+}
+
+void XMLSimpleDocInfoImportContext::PrepareField(
+ const Reference<XPropertySet> & rPropertySet)
+{
+ // title field in Calc has no Fixed property
+ Reference<XPropertySetInfo> xPropertySetInfo(rPropertySet->getPropertySetInfo());
+ if (xPropertySetInfo->hasPropertyByName(sPropertyFixed))
+ {
+ Any aAny;
+ aAny.setValue(&bFixed, ::getBooleanCppuType() );
+ rPropertySet->setPropertyValue(sPropertyFixed, aAny);
+
+ // set Content and CurrentPresentation (if fixed)
+ if (bFixed)
+ {
+ // in organizer-mode or styles-only-mode, only force update
+ if (GetImport().GetTextImport()->IsOrganizerMode() ||
+ GetImport().GetTextImport()->IsStylesOnlyMode() )
+ {
+ ForceUpdate(rPropertySet);
+ }
+ else
+ {
+ // set content (author, if that's the name) and current
+ // presentation
+ aAny <<= GetContent();
+
+ if (bFixed && bHasAuthor)
+ {
+ rPropertySet->setPropertyValue(sPropertyAuthor, aAny);
+ }
+
+ if (bFixed && bHasContent)
+ {
+ rPropertySet->setPropertyValue(sPropertyContent, aAny);
+ }
+
+ rPropertySet->setPropertyValue(sPropertyCurrentPresentation, aAny);
+ }
+ }
+ }
+}
+
+const sal_Char* XMLSimpleDocInfoImportContext::MapTokenToServiceName(
+ sal_uInt16 nToken)
+{
+ const sal_Char* pServiceName = NULL;
+
+ switch(nToken)
+ {
+ case XML_TOK_TEXT_DOCUMENT_CREATION_AUTHOR:
+ pServiceName = sAPI_docinfo_create_author;
+ break;
+ case XML_TOK_TEXT_DOCUMENT_CREATION_DATE:
+ pServiceName = sAPI_docinfo_create_date_time;
+ break;
+ case XML_TOK_TEXT_DOCUMENT_CREATION_TIME:
+ pServiceName = sAPI_docinfo_create_date_time;
+ break;
+ case XML_TOK_TEXT_DOCUMENT_DESCRIPTION:
+ pServiceName = sAPI_docinfo_description;
+ break;
+ case XML_TOK_TEXT_DOCUMENT_EDIT_DURATION:
+ pServiceName = sAPI_docinfo_edit_time;
+ break;
+ case XML_TOK_TEXT_DOCUMENT_USER_DEFINED:
+ pServiceName = sAPI_docinfo_custom;
+ break;
+ case XML_TOK_TEXT_DOCUMENT_PRINT_AUTHOR:
+ pServiceName = sAPI_docinfo_print_author;
+ break;
+ case XML_TOK_TEXT_DOCUMENT_PRINT_DATE:
+ pServiceName = sAPI_docinfo_print_date_time;
+ break;
+ case XML_TOK_TEXT_DOCUMENT_PRINT_TIME:
+ pServiceName = sAPI_docinfo_print_date_time;
+ break;
+ case XML_TOK_TEXT_DOCUMENT_KEYWORDS:
+ pServiceName = sAPI_docinfo_keywords;
+ break;
+ case XML_TOK_TEXT_DOCUMENT_SUBJECT:
+ pServiceName = sAPI_docinfo_subject;
+ break;
+ case XML_TOK_TEXT_DOCUMENT_REVISION:
+ pServiceName = sAPI_docinfo_revision;
+ break;
+ case XML_TOK_TEXT_DOCUMENT_SAVE_AUTHOR:
+ pServiceName = sAPI_docinfo_change_author;
+ break;
+ case XML_TOK_TEXT_DOCUMENT_SAVE_DATE:
+ pServiceName = sAPI_docinfo_change_date_time;
+ break;
+ case XML_TOK_TEXT_DOCUMENT_SAVE_TIME:
+ pServiceName = sAPI_docinfo_change_date_time;
+ break;
+ case XML_TOK_TEXT_DOCUMENT_TITLE:
+ pServiceName = sAPI_docinfo_title;
+ break;
+
+ default:
+ OSL_FAIL("no docinfo field token");
+ pServiceName = NULL;
+ break;
+ }
+
+ return pServiceName;
+}
+
+
+//
+// revision field
+//
+
+TYPEINIT1( XMLRevisionDocInfoImportContext, XMLSimpleDocInfoImportContext );
+
+XMLRevisionDocInfoImportContext::XMLRevisionDocInfoImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp, sal_uInt16 nPrfx,
+ const OUString& sLocalName, sal_uInt16 nToken) :
+ XMLSimpleDocInfoImportContext(rImport, rHlp, nPrfx, sLocalName,
+ nToken, sal_False, sal_False),
+ sPropertyRevision(RTL_CONSTASCII_USTRINGPARAM(sAPI_revision))
+{
+ bValid = sal_True;
+}
+
+void XMLRevisionDocInfoImportContext::PrepareField(
+ const Reference<XPropertySet> & rPropertySet)
+{
+ XMLSimpleDocInfoImportContext::PrepareField(rPropertySet);
+
+ // set revision number
+ // if fixed, if not in organizer-mode, if not in styles-only-mode
+ if (bFixed)
+ {
+ if ( GetImport().GetTextImport()->IsOrganizerMode() ||
+ GetImport().GetTextImport()->IsStylesOnlyMode() )
+ {
+ ForceUpdate(rPropertySet);
+ }
+ else
+ {
+ sal_Int32 nTmp;
+ if (SvXMLUnitConverter::convertNumber(nTmp, GetContent()))
+ {
+ Any aAny;
+ aAny <<= nTmp;
+ rPropertySet->setPropertyValue(sPropertyRevision, aAny);
+ }
+ }
+ }
+}
+
+
+
+//
+// DocInfo fields with date/time attributes
+//
+
+TYPEINIT1( XMLDateTimeDocInfoImportContext, XMLSimpleDocInfoImportContext );
+
+XMLDateTimeDocInfoImportContext::XMLDateTimeDocInfoImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp, sal_uInt16 nPrfx,
+ const OUString& sLocalName, sal_uInt16 nToken)
+: XMLSimpleDocInfoImportContext(rImport, rHlp, nPrfx, sLocalName,nToken, sal_False, sal_False)
+, sPropertyNumberFormat(RTL_CONSTASCII_USTRINGPARAM(sAPI_number_format))
+, sPropertyIsDate(RTL_CONSTASCII_USTRINGPARAM(sAPI_is_date))
+, sPropertyIsFixedLanguage(RTL_CONSTASCII_USTRINGPARAM(sAPI_is_fixed_language))
+, nFormat(0)
+, bFormatOK(sal_False)
+, bIsDefaultLanguage(sal_True)
+{
+ // we allow processing of EDIT_DURATION here, because import of actual
+ // is not supported anyway. If it was, we'd need an extra import class
+ // because times and time durations are presented differently!
+
+ bValid = sal_True;
+ switch (nToken)
+ {
+ case XML_TOK_TEXT_DOCUMENT_CREATION_DATE:
+ case XML_TOK_TEXT_DOCUMENT_PRINT_DATE:
+ case XML_TOK_TEXT_DOCUMENT_SAVE_DATE:
+ bIsDate = sal_True;
+ bHasDateTime = sal_True;
+ break;
+ case XML_TOK_TEXT_DOCUMENT_CREATION_TIME:
+ case XML_TOK_TEXT_DOCUMENT_PRINT_TIME:
+ case XML_TOK_TEXT_DOCUMENT_SAVE_TIME:
+ bIsDate = sal_False;
+ bHasDateTime = sal_True;
+ break;
+ case XML_TOK_TEXT_DOCUMENT_EDIT_DURATION:
+ bIsDate = sal_False;
+ bHasDateTime = sal_False;
+ break;
+ default:
+ OSL_FAIL(
+ "XMLDateTimeDocInfoImportContext needs date/time doc. fields");
+ bValid = sal_False;
+ break;
+ }
+}
+
+void XMLDateTimeDocInfoImportContext::ProcessAttribute(
+ sal_uInt16 nAttrToken,
+ const OUString& sAttrValue )
+{
+ switch (nAttrToken)
+ {
+ case XML_TOK_TEXTFIELD_DATA_STYLE_NAME:
+ {
+ sal_Int32 nKey = GetImportHelper().GetDataStyleKey(
+ sAttrValue, &bIsDefaultLanguage);
+ if (-1 != nKey)
+ {
+ nFormat = nKey;
+ bFormatOK = sal_True;
+ }
+ break;
+ }
+ case XML_TOK_TEXTFIELD_FIXED:
+ XMLSimpleDocInfoImportContext::ProcessAttribute(nAttrToken,
+ sAttrValue);
+ break;
+ default:
+ // ignore -> we can't set date/time value anyway!
+ break;
+ }
+}
+
+void XMLDateTimeDocInfoImportContext::PrepareField(
+ const Reference<XPropertySet> & xPropertySet)
+{
+ // process fixed and presentation
+ XMLSimpleDocInfoImportContext::PrepareField(xPropertySet);
+
+ Any aAny;
+
+ if (bHasDateTime)
+ {
+ aAny.setValue( &bIsDate, ::getBooleanCppuType());
+ xPropertySet->setPropertyValue(sPropertyIsDate, aAny);
+ }
+
+ if (bFormatOK)
+ {
+ aAny <<= nFormat;
+ xPropertySet->setPropertyValue(sPropertyNumberFormat, aAny);
+
+ if( xPropertySet->getPropertySetInfo()->
+ hasPropertyByName( sPropertyIsFixedLanguage ) )
+ {
+ sal_Bool bIsFixedLanguage = ! bIsDefaultLanguage;
+ aAny.setValue( &bIsFixedLanguage, ::getBooleanCppuType() );
+ xPropertySet->setPropertyValue( sPropertyIsFixedLanguage, aAny );
+ }
+ }
+
+ // can't set date/time/duration value! Sorry.
+}
+
+
+//
+// user defined docinfo fields
+//
+
+TYPEINIT1( XMLUserDocInfoImportContext, XMLSimpleDocInfoImportContext );
+
+XMLUserDocInfoImportContext::XMLUserDocInfoImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx, const OUString& sLocalName, sal_uInt16 nToken) :
+ XMLSimpleDocInfoImportContext(rImport, rHlp, nPrfx,
+ sLocalName, nToken,
+ sal_False, sal_False)
+ , sPropertyName(RTL_CONSTASCII_USTRINGPARAM(sAPI_name))
+ , sPropertyNumberFormat(RTL_CONSTASCII_USTRINGPARAM(sAPI_number_format))
+ , sPropertyIsFixedLanguage(RTL_CONSTASCII_USTRINGPARAM(sAPI_is_fixed_language))
+ , nFormat(0)
+ , bFormatOK(sal_False)
+ , bIsDefaultLanguage( sal_True )
+{
+ bValid = sal_False;
+}
+
+void XMLUserDocInfoImportContext::ProcessAttribute(
+ sal_uInt16 nAttrToken,
+ const OUString& sAttrValue )
+{
+ switch (nAttrToken)
+ {
+ case XML_TOK_TEXTFIELD_DATA_STYLE_NAME:
+ {
+ sal_Int32 nKey = GetImportHelper().GetDataStyleKey(
+ sAttrValue, &bIsDefaultLanguage);
+ if (-1 != nKey)
+ {
+ nFormat = nKey;
+ bFormatOK = sal_True;
+ }
+ break;
+ }
+ case XML_TOK_TEXTFIELD_NAME:
+ {
+ if (!bValid)
+ {
+ SetServiceName(OUString(RTL_CONSTASCII_USTRINGPARAM( sAPI_docinfo_custom )) );
+ aName = sAttrValue;
+ bValid = sal_True;
+ }
+ break;
+ }
+
+ default:
+ XMLSimpleDocInfoImportContext::ProcessAttribute(nAttrToken,
+ sAttrValue);
+ break;
+ }
+}
+
+void XMLUserDocInfoImportContext::PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropertySet)
+{
+ uno::Any aAny;
+ if ( aName.getLength() )
+ {
+ aAny <<= aName;
+ xPropertySet->setPropertyValue(sPropertyName, aAny);
+ }
+ Reference<XPropertySetInfo> xPropertySetInfo(
+ xPropertySet->getPropertySetInfo());
+ if (bFormatOK &&
+ xPropertySetInfo->hasPropertyByName(sPropertyNumberFormat))
+ {
+ aAny <<= nFormat;
+ xPropertySet->setPropertyValue(sPropertyNumberFormat, aAny);
+
+ if( xPropertySetInfo->hasPropertyByName( sPropertyIsFixedLanguage ) )
+ {
+ sal_Bool bIsFixedLanguage = ! bIsDefaultLanguage;
+ aAny.setValue( &bIsFixedLanguage, ::getBooleanCppuType() );
+ xPropertySet->setPropertyValue( sPropertyIsFixedLanguage, aAny );
+ }
+ }
+
+ // call superclass to handle "fixed"
+ XMLSimpleDocInfoImportContext::PrepareField(xPropertySet);
+}
+
+
+//
+// import hidden paragraph fields
+//
+
+TYPEINIT1( XMLHiddenParagraphImportContext, XMLTextFieldImportContext );
+
+XMLHiddenParagraphImportContext::XMLHiddenParagraphImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx, const OUString& sLocalName) :
+ XMLTextFieldImportContext(rImport, rHlp, sAPI_hidden_paragraph,
+ nPrfx, sLocalName),
+ sPropertyCondition(RTL_CONSTASCII_USTRINGPARAM(sAPI_condition)),
+ sPropertyIsHidden(RTL_CONSTASCII_USTRINGPARAM(sAPI_is_hidden)),
+ sCondition(),
+ bIsHidden(sal_False)
+{
+}
+
+void XMLHiddenParagraphImportContext::ProcessAttribute(
+ sal_uInt16 nAttrToken,
+ const OUString& sAttrValue )
+{
+ if (XML_TOK_TEXTFIELD_CONDITION == nAttrToken)
+ {
+ OUString sTmp;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap()._GetKeyByAttrName(
+ sAttrValue, &sTmp, sal_False );
+ if( XML_NAMESPACE_OOOW == nPrefix )
+ {
+ sCondition = sTmp;
+ bValid = sal_True;
+ }
+ else
+ sCondition = sAttrValue;
+ }
+ else if (XML_TOK_TEXTFIELD_IS_HIDDEN == nAttrToken)
+ {
+ bool bTmp;
+ if (SvXMLUnitConverter::convertBool(bTmp, sAttrValue))
+ {
+ bIsHidden = bTmp;
+ }
+ }
+}
+
+void XMLHiddenParagraphImportContext::PrepareField(
+ const Reference<XPropertySet> & xPropertySet)
+{
+ Any aAny;
+ aAny <<= sCondition;
+ xPropertySet->setPropertyValue(sPropertyCondition, aAny);
+
+ aAny.setValue( &bIsHidden, ::getBooleanCppuType() );
+ xPropertySet->setPropertyValue(sPropertyIsHidden, aAny);
+}
+
+
+
+//
+// import conditional text (<text:conditional-text>)
+//
+
+TYPEINIT1( XMLConditionalTextImportContext, XMLTextFieldImportContext );
+
+XMLConditionalTextImportContext::XMLConditionalTextImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx, const OUString& sLocalName) :
+ XMLTextFieldImportContext(rImport, rHlp, sAPI_conditional_text,
+ nPrfx, sLocalName),
+ sPropertyCondition(RTL_CONSTASCII_USTRINGPARAM(sAPI_condition)),
+ sPropertyTrueContent(RTL_CONSTASCII_USTRINGPARAM(sAPI_true_content)),
+ sPropertyFalseContent(RTL_CONSTASCII_USTRINGPARAM(sAPI_false_content)),
+ sPropertyIsConditionTrue(RTL_CONSTASCII_USTRINGPARAM(sAPI_is_condition_true)),
+ sPropertyCurrentPresentation(RTL_CONSTASCII_USTRINGPARAM(sAPI_current_presentation)),
+ bConditionOK(sal_False),
+ bTrueOK(sal_False),
+ bFalseOK(sal_False),
+ bCurrentValue(sal_False)
+{
+}
+
+void XMLConditionalTextImportContext::ProcessAttribute(
+ sal_uInt16 nAttrToken,
+ const OUString& sAttrValue )
+{
+ switch (nAttrToken)
+ {
+ case XML_TOK_TEXTFIELD_CONDITION:
+ {
+ OUString sTmp;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ _GetKeyByAttrName( sAttrValue, &sTmp, sal_False );
+ if( XML_NAMESPACE_OOOW == nPrefix )
+ {
+ sCondition = sTmp;
+ bConditionOK = sal_True;
+ }
+ else
+ sCondition = sAttrValue;
+ }
+ break;
+ case XML_TOK_TEXTFIELD_STRING_VALUE_IF_FALSE:
+ sFalseContent = sAttrValue;
+ bFalseOK = sal_True;
+ break;
+ case XML_TOK_TEXTFIELD_STRING_VALUE_IF_TRUE:
+ sTrueContent = sAttrValue;
+ bTrueOK = sal_True;
+ break;
+ case XML_TOK_TEXTFIELD_CURRENT_VALUE:
+ {
+ bool bTmp;
+ if (SvXMLUnitConverter::convertBool(bTmp, sAttrValue))
+ {
+ bCurrentValue = bTmp;
+ }
+ break;
+ }
+ }
+
+ bValid = bConditionOK && bFalseOK && bTrueOK;
+}
+
+void XMLConditionalTextImportContext::PrepareField(
+ const Reference<XPropertySet> & xPropertySet)
+{
+ Any aAny;
+
+ aAny <<= sCondition;
+ xPropertySet->setPropertyValue(sPropertyCondition, aAny);
+
+ aAny <<= sFalseContent;
+ xPropertySet->setPropertyValue(sPropertyFalseContent, aAny);
+
+ aAny <<= sTrueContent;
+ xPropertySet->setPropertyValue(sPropertyTrueContent, aAny);
+
+ aAny.setValue( &bCurrentValue, ::getBooleanCppuType() );
+ xPropertySet->setPropertyValue(sPropertyIsConditionTrue, aAny);
+
+ aAny <<= GetContent();
+ xPropertySet->setPropertyValue(sPropertyCurrentPresentation, aAny);
+}
+
+
+
+//
+// hidden text
+//
+
+TYPEINIT1( XMLHiddenTextImportContext, XMLTextFieldImportContext);
+
+XMLHiddenTextImportContext::XMLHiddenTextImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx, const OUString& sLocalName) :
+ XMLTextFieldImportContext(rImport, rHlp, sAPI_hidden_text,
+ nPrfx, sLocalName),
+ sPropertyCondition(RTL_CONSTASCII_USTRINGPARAM(sAPI_condition)),
+ sPropertyContent(RTL_CONSTASCII_USTRINGPARAM(sAPI_content)),
+ sPropertyIsHidden(RTL_CONSTASCII_USTRINGPARAM(sAPI_is_hidden)),
+ bConditionOK(sal_False),
+ bStringOK(sal_False),
+ bIsHidden(sal_False)
+{
+}
+
+void XMLHiddenTextImportContext::ProcessAttribute(
+ sal_uInt16 nAttrToken,
+ const OUString& sAttrValue )
+{
+ switch (nAttrToken)
+ {
+ case XML_TOK_TEXTFIELD_CONDITION:
+ {
+ OUString sTmp;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ _GetKeyByAttrName( sAttrValue, &sTmp, sal_False );
+ if( XML_NAMESPACE_OOOW == nPrefix )
+ {
+ sCondition = sTmp;
+ bConditionOK = sal_True;
+ }
+ else
+ sCondition = sAttrValue;
+ }
+ break;
+ case XML_TOK_TEXTFIELD_STRING_VALUE:
+ sString = sAttrValue;
+ bStringOK = sal_True;
+ break;
+ case XML_TOK_TEXTFIELD_IS_HIDDEN:
+ {
+ bool bTmp;
+ if (SvXMLUnitConverter::convertBool(bTmp, sAttrValue))
+ {
+ bIsHidden = bTmp;
+ }
+ break;
+ }
+ }
+
+ bValid = bConditionOK && bStringOK;
+}
+
+void XMLHiddenTextImportContext::PrepareField(
+ const Reference<XPropertySet> & xPropertySet)
+{
+ Any aAny;
+
+ aAny <<= sCondition;
+ xPropertySet->setPropertyValue(sPropertyCondition, aAny);
+
+ aAny <<= sString;
+ xPropertySet->setPropertyValue(sPropertyContent, aAny);
+
+ aAny.setValue( &bIsHidden, ::getBooleanCppuType() );
+ xPropertySet->setPropertyValue(sPropertyIsHidden, aAny);
+}
+
+
+
+//
+// file name fields
+//
+
+TYPEINIT1( XMLFileNameImportContext, XMLTextFieldImportContext );
+
+static const SvXMLEnumMapEntry aFilenameDisplayMap[] =
+{
+ { XML_PATH, FilenameDisplayFormat::PATH },
+ { XML_NAME, FilenameDisplayFormat::NAME },
+ { XML_NAME_AND_EXTENSION, FilenameDisplayFormat::NAME_AND_EXT },
+ { XML_FULL, FilenameDisplayFormat::FULL },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+XMLFileNameImportContext::XMLFileNameImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp, sal_uInt16 nPrfx,
+ const OUString& sLocalName) :
+ XMLTextFieldImportContext(rImport, rHlp, sAPI_file_name,
+ nPrfx, sLocalName),
+ sPropertyFixed(RTL_CONSTASCII_USTRINGPARAM(sAPI_is_fixed)),
+ sPropertyFileFormat(RTL_CONSTASCII_USTRINGPARAM(sAPI_file_format)),
+ sPropertyCurrentPresentation(
+ RTL_CONSTASCII_USTRINGPARAM(sAPI_current_presentation)),
+ nFormat(FilenameDisplayFormat::FULL),
+ bFixed(sal_False)
+{
+ bValid = sal_True;
+}
+
+void XMLFileNameImportContext::ProcessAttribute(
+ sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue )
+{
+ switch (nAttrToken)
+ {
+ case XML_TOK_TEXTFIELD_FIXED:
+ {
+ bool bTmp;
+ if (SvXMLUnitConverter::convertBool(bTmp, sAttrValue))
+ {
+ bFixed = bTmp;
+ }
+ break;
+ }
+ case XML_TOK_TEXTFIELD_DISPLAY:
+ {
+ sal_uInt16 nTmp;
+ if (SvXMLUnitConverter::convertEnum(nTmp, sAttrValue,
+ aFilenameDisplayMap))
+ {
+ nFormat = (sal_uInt16)nTmp;
+ }
+ break;
+ }
+ default:
+ ; // unkown attribute: ignore
+ break;
+ }
+}
+
+void XMLFileNameImportContext::PrepareField(
+ const Reference<XPropertySet> & xPropertySet)
+{
+ Any aAny;
+
+ // properties are optional
+ Reference<XPropertySetInfo> xPropertySetInfo(
+ xPropertySet->getPropertySetInfo());
+
+ if (xPropertySetInfo->hasPropertyByName(sPropertyFixed))
+ {
+ aAny <<= bFixed;
+ xPropertySet->setPropertyValue(sPropertyFixed, aAny);
+ }
+
+ if (xPropertySetInfo->hasPropertyByName(sPropertyFileFormat))
+ {
+ aAny <<= nFormat;
+ xPropertySet->setPropertyValue(sPropertyFileFormat, aAny);
+ }
+
+ if (xPropertySetInfo->hasPropertyByName(sPropertyCurrentPresentation))
+ {
+ aAny <<= GetContent();
+ xPropertySet->setPropertyValue(sPropertyCurrentPresentation, aAny);
+ }
+}
+
+
+//
+// template name field
+//
+
+static const SvXMLEnumMapEntry aTemplateDisplayMap[] =
+{
+ { XML_FULL, TemplateDisplayFormat::FULL },
+ { XML_PATH, TemplateDisplayFormat::PATH },
+ { XML_NAME, TemplateDisplayFormat::NAME },
+ { XML_NAME_AND_EXTENSION, TemplateDisplayFormat::NAME_AND_EXT },
+ { XML_AREA, TemplateDisplayFormat::AREA },
+ { XML_TITLE, TemplateDisplayFormat::TITLE },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+TYPEINIT1( XMLTemplateNameImportContext, XMLTextFieldImportContext );
+
+XMLTemplateNameImportContext::XMLTemplateNameImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp, sal_uInt16 nPrfx,
+ const OUString& sLocalName) :
+ XMLTextFieldImportContext(rImport, rHlp, sAPI_template_name,
+ nPrfx, sLocalName),
+ sPropertyFileFormat(RTL_CONSTASCII_USTRINGPARAM(sAPI_file_format)),
+ nFormat(TemplateDisplayFormat::FULL)
+{
+ bValid = sal_True;
+}
+
+void XMLTemplateNameImportContext::ProcessAttribute(
+ sal_uInt16 nAttrToken,
+ const OUString& sAttrValue )
+{
+ switch (nAttrToken)
+ {
+ case XML_TOK_TEXTFIELD_DISPLAY:
+ {
+ sal_uInt16 nTmp;
+ if (SvXMLUnitConverter::convertEnum(nTmp, sAttrValue,
+ aTemplateDisplayMap))
+ {
+ nFormat = (sal_uInt16)nTmp;
+ }
+ break;
+ }
+ default:
+ ; // unknown attribute: ignore
+ break;
+ }
+}
+
+void XMLTemplateNameImportContext::PrepareField(
+ const Reference<XPropertySet> & xPropertySet)
+{
+ Any aAny;
+
+ aAny <<= nFormat;
+ xPropertySet->setPropertyValue(sPropertyFileFormat, aAny);
+}
+
+
+//
+// import chapter fields
+//
+
+TYPEINIT1( XMLChapterImportContext, XMLTextFieldImportContext );
+
+static const SvXMLEnumMapEntry aChapterDisplayMap[] =
+{
+ { XML_NAME, ChapterFormat::NAME },
+ { XML_NUMBER, ChapterFormat::NUMBER },
+ { XML_NUMBER_AND_NAME, ChapterFormat::NAME_NUMBER },
+ { XML_PLAIN_NUMBER_AND_NAME, ChapterFormat::NO_PREFIX_SUFFIX },
+ { XML_PLAIN_NUMBER, ChapterFormat::DIGIT },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+XMLChapterImportContext::XMLChapterImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx, const OUString& sLocalName) :
+ XMLTextFieldImportContext(rImport, rHlp, sAPI_chapter,
+ nPrfx, sLocalName),
+ sPropertyChapterFormat(
+ RTL_CONSTASCII_USTRINGPARAM(sAPI_chapter_format)),
+ sPropertyLevel(RTL_CONSTASCII_USTRINGPARAM(sAPI_level)),
+ nFormat(ChapterFormat::NAME_NUMBER),
+ nLevel(0)
+{
+ bValid = sal_True;
+}
+
+void XMLChapterImportContext::ProcessAttribute(
+ sal_uInt16 nAttrToken,
+ const OUString& sAttrValue )
+{
+ switch (nAttrToken)
+ {
+ case XML_TOK_TEXTFIELD_DISPLAY:
+ {
+ sal_uInt16 nTmp;
+ if (SvXMLUnitConverter::convertEnum(nTmp, sAttrValue,
+ aChapterDisplayMap))
+ {
+ nFormat = (sal_Int16)nTmp;
+ }
+ break;
+ }
+ case XML_TOK_TEXTFIELD_OUTLINE_LEVEL:
+ {
+ sal_Int32 nTmp;
+ if (SvXMLUnitConverter::convertNumber(
+ nTmp, sAttrValue, 1,
+ GetImport().GetTextImport()->GetChapterNumbering()->getCount()
+ ))
+ {
+ // API numbers 0..9, we number 1..10
+ nLevel = (sal_Int8)nTmp;
+ nLevel--;
+ }
+ break;
+ }
+ default:
+ ; // unknown attribute: ignore
+ break;
+ }
+}
+
+void XMLChapterImportContext::PrepareField(
+ const Reference<XPropertySet> & xPropertySet)
+{
+ Any aAny;
+
+ aAny <<= nFormat;
+ xPropertySet->setPropertyValue(sPropertyChapterFormat, aAny);
+
+ aAny <<= nLevel;
+ xPropertySet->setPropertyValue(sPropertyLevel, aAny);
+}
+
+
+//
+// counting fields
+//
+
+TYPEINIT1( XMLCountFieldImportContext, XMLTextFieldImportContext );
+
+XMLCountFieldImportContext::XMLCountFieldImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx, const OUString& sLocalName, sal_uInt16 nToken) :
+ XMLTextFieldImportContext(rImport, rHlp, MapTokenToServiceName(nToken),
+ nPrfx, sLocalName),
+ sPropertyNumberingType(
+ RTL_CONSTASCII_USTRINGPARAM(sAPI_numbering_type)),
+ sNumberFormat(),
+ sLetterSync(),
+ bNumberFormatOK(sal_False)
+{
+ bValid = sal_True;
+}
+
+void XMLCountFieldImportContext::ProcessAttribute(
+ sal_uInt16 nAttrToken,
+ const OUString& sAttrValue )
+{
+ switch (nAttrToken)
+ {
+ case XML_TOK_TEXTFIELD_NUM_FORMAT:
+ sNumberFormat = sAttrValue;
+ bNumberFormatOK = sal_True;
+ break;
+ case XML_TOK_TEXTFIELD_NUM_LETTER_SYNC:
+ sLetterSync = sAttrValue;
+ break;
+ }
+}
+
+void XMLCountFieldImportContext::PrepareField(
+ const Reference<XPropertySet> & xPropertySet)
+{
+ Any aAny;
+
+ // properties optional
+ // (only page count, but do for all to save common implementation)
+
+ if (xPropertySet->getPropertySetInfo()->
+ hasPropertyByName(sPropertyNumberingType))
+ {
+ sal_Int16 nNumType;
+ if( bNumberFormatOK )
+ {
+ nNumType= style::NumberingType::ARABIC;
+ GetImport().GetMM100UnitConverter().convertNumFormat( nNumType,
+ sNumberFormat,
+ sLetterSync );
+ }
+ else
+ nNumType = style::NumberingType::PAGE_DESCRIPTOR;
+ aAny <<= nNumType;
+ xPropertySet->setPropertyValue(sPropertyNumberingType, aAny);
+ }
+}
+
+const sal_Char* XMLCountFieldImportContext::MapTokenToServiceName(
+ sal_uInt16 nToken)
+{
+ const sal_Char* pServiceName = NULL;
+
+ switch (nToken)
+ {
+ case XML_TOK_TEXT_WORD_COUNT:
+ pServiceName = sAPI_word_count;
+ break;
+ case XML_TOK_TEXT_PARAGRAPH_COUNT:
+ pServiceName = sAPI_paragraph_count;
+ break;
+ case XML_TOK_TEXT_TABLE_COUNT:
+ pServiceName = sAPI_table_count;
+ break;
+ case XML_TOK_TEXT_CHARACTER_COUNT:
+ pServiceName = sAPI_character_count;
+ break;
+ case XML_TOK_TEXT_IMAGE_COUNT:
+ pServiceName = sAPI_graphic_object_count;
+ break;
+ case XML_TOK_TEXT_OBJECT_COUNT:
+ pServiceName = sAPI_embedded_object_count;
+ break;
+ case XML_TOK_TEXT_PAGE_COUNT:
+ pServiceName = sAPI_page_count;
+ break;
+ default:
+ pServiceName = NULL;
+ OSL_FAIL("unknown count field!");
+ break;
+ }
+
+ return pServiceName;
+}
+
+
+
+//
+// page variable import
+//
+
+TYPEINIT1( XMLPageVarGetFieldImportContext, XMLTextFieldImportContext );
+
+XMLPageVarGetFieldImportContext::XMLPageVarGetFieldImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx, const OUString& sLocalName) :
+ XMLTextFieldImportContext(rImport, rHlp, sAPI_reference_page_get,
+ nPrfx, sLocalName),
+ sPropertyNumberingType(
+ RTL_CONSTASCII_USTRINGPARAM(sAPI_numbering_type)),
+ sNumberFormat(),
+ sLetterSync(),
+ bNumberFormatOK(sal_False)
+{
+ bValid = sal_True;
+}
+
+void XMLPageVarGetFieldImportContext::ProcessAttribute(
+ sal_uInt16 nAttrToken,
+ const OUString& sAttrValue )
+{
+ switch (nAttrToken)
+ {
+ case XML_TOK_TEXTFIELD_NUM_FORMAT:
+ sNumberFormat = sAttrValue;
+ bNumberFormatOK = sal_True;
+ break;
+ case XML_TOK_TEXTFIELD_NUM_LETTER_SYNC:
+ sLetterSync = sAttrValue;
+ break;
+ }
+}
+
+void XMLPageVarGetFieldImportContext::PrepareField(
+ const Reference<XPropertySet> & xPropertySet)
+{
+ Any aAny;
+
+ sal_Int16 nNumType;
+ if( bNumberFormatOK )
+ {
+ nNumType= style::NumberingType::ARABIC;
+ GetImport().GetMM100UnitConverter().convertNumFormat( nNumType,
+ sNumberFormat,
+ sLetterSync );
+ }
+ else
+ nNumType = style::NumberingType::PAGE_DESCRIPTOR;
+ aAny <<= nNumType;
+ xPropertySet->setPropertyValue(sPropertyNumberingType, aAny);
+
+ // display old content (#96657#)
+ aAny <<= GetContent();
+ xPropertySet->setPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM(sAPI_current_presentation)),
+ aAny );
+}
+
+
+
+//
+// page variable set fields
+//
+
+TYPEINIT1(XMLPageVarSetFieldImportContext, XMLTextFieldImportContext);
+
+XMLPageVarSetFieldImportContext::XMLPageVarSetFieldImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp, sal_uInt16 nPrfx,
+ const OUString& sLocalName) :
+ XMLTextFieldImportContext(rImport, rHlp, sAPI_reference_page_set,
+ nPrfx, sLocalName),
+ sPropertyOn(RTL_CONSTASCII_USTRINGPARAM(sAPI_on)),
+ sPropertyOffset(RTL_CONSTASCII_USTRINGPARAM(sAPI_offset)),
+ nAdjust(0),
+ bActive(sal_True)
+{
+ bValid = sal_True;
+}
+
+void XMLPageVarSetFieldImportContext::ProcessAttribute(
+ sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue )
+{
+ switch (nAttrToken)
+ {
+ case XML_TOK_TEXTFIELD_ACTIVE:
+ {
+ bool bTmp;
+ if (SvXMLUnitConverter::convertBool(bTmp, sAttrValue))
+ {
+ bActive = bTmp;
+ }
+ }
+ case XML_TOK_TEXTFIELD_PAGE_ADJUST:
+ {
+ sal_Int32 nTmp;
+ if (SvXMLUnitConverter::convertNumber(nTmp, sAttrValue))
+ {
+ nAdjust = (sal_Int16)nTmp;
+ }
+ }
+ }
+}
+
+void XMLPageVarSetFieldImportContext::PrepareField(
+ const Reference<XPropertySet> & xPropertySet)
+{
+ Any aAny;
+
+ aAny.setValue(&bActive, ::getBooleanCppuType());
+ xPropertySet->setPropertyValue(sPropertyOn, aAny);
+
+ aAny <<= nAdjust;
+ xPropertySet->setPropertyValue(sPropertyOffset, aAny);
+}
+
+
+
+//
+// macro fields
+//
+
+TYPEINIT1( XMLMacroFieldImportContext, XMLTextFieldImportContext );
+
+XMLMacroFieldImportContext::XMLMacroFieldImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp, sal_uInt16 nPrfx,
+ const OUString& sLocalName) :
+ XMLTextFieldImportContext(rImport, rHlp, sAPI_macro,
+ nPrfx, sLocalName),
+ sPropertyHint(RTL_CONSTASCII_USTRINGPARAM(sAPI_hint)),
+ sPropertyMacroName(RTL_CONSTASCII_USTRINGPARAM("MacroName")),
+ sPropertyScriptURL(RTL_CONSTASCII_USTRINGPARAM("ScriptURL")),
+ bDescriptionOK(sal_False)
+{
+}
+
+SvXMLImportContext* XMLMacroFieldImportContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList )
+{
+ SvXMLImportContext* pContext = NULL;
+
+ if ( (nPrefix == XML_NAMESPACE_OFFICE) &&
+ IsXMLToken( rLocalName, XML_EVENT_LISTENERS ) )
+ {
+ // create events context and remember it!
+ pContext = new XMLEventsImportContext(
+ GetImport(), nPrefix, rLocalName );
+ xEventContext = pContext;
+ bValid = sal_True;
+ }
+ else
+ pContext = SvXMLImportContext::CreateChildContext(
+ nPrefix, rLocalName, xAttrList);
+
+ return pContext;
+}
+
+
+void XMLMacroFieldImportContext::ProcessAttribute(
+ sal_uInt16 nAttrToken,
+ const OUString& sAttrValue )
+{
+ switch (nAttrToken)
+ {
+ case XML_TOK_TEXTFIELD_DESCRIPTION:
+ sDescription = sAttrValue;
+ bDescriptionOK = sal_True;
+ break;
+ case XML_TOK_TEXTFIELD_NAME:
+ sMacro = sAttrValue;
+ bValid = sal_True;
+ break;
+ }
+}
+
+void XMLMacroFieldImportContext::PrepareField(
+ const Reference<XPropertySet> & xPropertySet)
+{
+ Any aAny;
+
+ OUString sOnClick(RTL_CONSTASCII_USTRINGPARAM("OnClick"));
+ OUString sPropertyMacroLibrary(RTL_CONSTASCII_USTRINGPARAM("MacroLibrary"));
+
+ aAny <<= (bDescriptionOK ? sDescription : GetContent());
+ xPropertySet->setPropertyValue(sPropertyHint, aAny);
+
+ // if we have an events child element, we'll look for the OnClick
+ // event if not, it may be an old (pre-638i) document. Then, we'll
+ // have to look at the name attribute.
+ OUString sMacroName;
+ OUString sLibraryName;
+ OUString sScriptURL;
+
+ if ( xEventContext.Is() )
+ {
+ // get event sequence
+ XMLEventsImportContext* pEvents =
+ (XMLEventsImportContext*)&xEventContext;
+ Sequence<PropertyValue> aValues;
+ pEvents->GetEventSequence( sOnClick, aValues );
+
+ sal_Int32 nLength = aValues.getLength();
+ for( sal_Int32 i = 0; i < nLength; i++ )
+ {
+ if ( aValues[i].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ScriptType")) )
+ {
+ // ignore ScriptType
+ }
+ else if ( aValues[i].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Library")) )
+ {
+ aValues[i].Value >>= sLibraryName;
+ }
+ else if ( aValues[i].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("MacroName")) )
+ {
+ aValues[i].Value >>= sMacroName;
+ }
+ if ( aValues[i].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Script")) )
+ {
+ aValues[i].Value >>= sScriptURL;
+ }
+ }
+ }
+ else
+ {
+ // disassemble old-style macro-name: Everything before the
+ // third-last dot is the library
+ sal_Int32 nPos = sMacro.getLength() + 1; // the loop starts with nPos--
+ const sal_Unicode* pBuf = sMacro.getStr();
+ for( sal_Int32 i = 0; (i < 3) && (nPos > 0); i++ )
+ {
+ nPos--;
+ while ( (pBuf[nPos] != '.') && (nPos > 0) )
+ nPos--;
+ }
+
+ if (nPos > 0)
+ {
+ sLibraryName = sMacro.copy(0, nPos);
+ sMacroName = sMacro.copy(nPos+1);
+ }
+ else
+ sMacroName = sMacro;
+ }
+
+ aAny <<= sScriptURL;
+ xPropertySet->setPropertyValue(sPropertyScriptURL, aAny);
+
+ aAny <<= sMacroName;
+ xPropertySet->setPropertyValue(sPropertyMacroName, aAny);
+
+ aAny <<= sLibraryName;
+ xPropertySet->setPropertyValue(sPropertyMacroLibrary, aAny);
+}
+
+
+
+//
+// reference field import
+//
+
+TYPEINIT1( XMLReferenceFieldImportContext, XMLTextFieldImportContext );
+
+XMLReferenceFieldImportContext::XMLReferenceFieldImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp,
+ sal_uInt16 nToken, sal_uInt16 nPrfx, const OUString& sLocalName)
+: XMLTextFieldImportContext(rImport, rHlp, sAPI_get_reference, nPrfx, sLocalName)
+, sPropertyReferenceFieldPart(RTL_CONSTASCII_USTRINGPARAM(sAPI_reference_field_part))
+, sPropertyReferenceFieldSource(RTL_CONSTASCII_USTRINGPARAM(sAPI_reference_field_source))
+, sPropertySourceName(RTL_CONSTASCII_USTRINGPARAM(sAPI_source_name))
+, sPropertyCurrentPresentation(RTL_CONSTASCII_USTRINGPARAM(sAPI_current_presentation))
+, nElementToken(nToken)
+, nType(ReferenceFieldPart::PAGE_DESC)
+, bNameOK(sal_False)
+, bTypeOK(sal_False)
+, bSeqNumberOK(sal_False)
+{
+}
+
+static SvXMLEnumMapEntry const lcl_aReferenceTypeTokenMap[] =
+{
+ { XML_PAGE, ReferenceFieldPart::PAGE},
+ { XML_CHAPTER, ReferenceFieldPart::CHAPTER },
+ { XML_TEXT, ReferenceFieldPart::TEXT },
+ { XML_DIRECTION, ReferenceFieldPart::UP_DOWN },
+ { XML_CATEGORY_AND_VALUE, ReferenceFieldPart::CATEGORY_AND_NUMBER },
+ { XML_CAPTION, ReferenceFieldPart::ONLY_CAPTION },
+ { XML_VALUE, ReferenceFieldPart::ONLY_SEQUENCE_NUMBER },
+ // Core implementation for direct cross-references (#i81002#)
+ { XML_NUMBER, ReferenceFieldPart::NUMBER },
+ { XML_NUMBER_NO_SUPERIOR, ReferenceFieldPart::NUMBER_NO_CONTEXT },
+ { XML_NUMBER_ALL_SUPERIOR, ReferenceFieldPart::NUMBER_FULL_CONTEXT },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+void XMLReferenceFieldImportContext::StartElement(
+ const Reference<XAttributeList> & xAttrList)
+{
+ bTypeOK = sal_True;
+ switch (nElementToken)
+ {
+ case XML_TOK_TEXT_REFERENCE_REF:
+ nSource = ReferenceFieldSource::REFERENCE_MARK;
+ break;
+ case XML_TOK_TEXT_BOOKMARK_REF:
+ nSource = ReferenceFieldSource::BOOKMARK;
+ break;
+ case XML_TOK_TEXT_NOTE_REF:
+ nSource = ReferenceFieldSource::FOOTNOTE;
+ break;
+ case XML_TOK_TEXT_SEQUENCE_REF:
+ nSource = ReferenceFieldSource::SEQUENCE_FIELD;
+ break;
+ default:
+ bTypeOK = sal_False;
+ OSL_FAIL("unknown reference field");
+ break;
+ }
+
+ XMLTextFieldImportContext::StartElement(xAttrList);
+}
+
+
+void XMLReferenceFieldImportContext::ProcessAttribute(
+ sal_uInt16 nAttrToken,
+ const OUString& sAttrValue )
+{
+ switch (nAttrToken)
+ {
+ case XML_TOK_TEXTFIELD_NOTE_CLASS:
+ if( IsXMLToken( sAttrValue, XML_ENDNOTE ) )
+ nSource = ReferenceFieldSource::ENDNOTE;
+ break;
+ case XML_TOK_TEXTFIELD_REF_NAME:
+ sName = sAttrValue;
+ bNameOK = sal_True;
+ break;
+ case XML_TOK_TEXTFIELD_REFERENCE_FORMAT:
+ {
+ sal_uInt16 nToken;
+ if (SvXMLUnitConverter::convertEnum(nToken, sAttrValue,
+ lcl_aReferenceTypeTokenMap))
+ {
+ nType = nToken;
+ }
+
+ // check for sequence-only-attributes
+ if ( (XML_TOK_TEXT_SEQUENCE_REF != nElementToken) &&
+ ( (nType == ReferenceFieldPart::CATEGORY_AND_NUMBER) ||
+ (nType == ReferenceFieldPart::ONLY_CAPTION) ||
+ (nType == ReferenceFieldPart::ONLY_SEQUENCE_NUMBER) ) )
+ {
+ nType = ReferenceFieldPart::PAGE_DESC;
+ }
+
+ break;
+ }
+ }
+
+ // bValid: we need proper element type and name
+ bValid = bTypeOK && bNameOK;
+}
+
+void XMLReferenceFieldImportContext::PrepareField(
+ const Reference<XPropertySet> & xPropertySet)
+{
+ Any aAny;
+
+ aAny <<= nType;
+ xPropertySet->setPropertyValue(sPropertyReferenceFieldPart, aAny);
+
+ aAny <<= nSource;
+ xPropertySet->setPropertyValue(sPropertyReferenceFieldSource, aAny);
+
+ switch (nElementToken)
+ {
+ case XML_TOK_TEXT_REFERENCE_REF:
+ case XML_TOK_TEXT_BOOKMARK_REF:
+ aAny <<= sName;
+ xPropertySet->setPropertyValue(sPropertySourceName, aAny);
+ break;
+
+ case XML_TOK_TEXT_NOTE_REF:
+ GetImportHelper().ProcessFootnoteReference(sName, xPropertySet);
+ break;
+
+ case XML_TOK_TEXT_SEQUENCE_REF:
+ GetImportHelper().ProcessSequenceReference(sName, xPropertySet);
+ break;
+ }
+
+ aAny <<= GetContent();
+ xPropertySet->setPropertyValue(sPropertyCurrentPresentation, aAny);
+}
+
+
+
+//
+// field declarations container
+//
+
+enum DdeFieldDeclAttrs
+{
+ XML_TOK_DDEFIELD_NAME,
+ XML_TOK_DDEFIELD_APPLICATION,
+ XML_TOK_DDEFIELD_TOPIC,
+ XML_TOK_DDEFIELD_ITEM,
+ XML_TOK_DDEFIELD_UPDATE
+};
+
+static SvXMLTokenMapEntry aDdeDeclAttrTokenMap[] =
+{
+ { XML_NAMESPACE_OFFICE, XML_NAME, XML_TOK_DDEFIELD_NAME },
+ { XML_NAMESPACE_OFFICE, XML_DDE_APPLICATION, XML_TOK_DDEFIELD_APPLICATION },
+ { XML_NAMESPACE_OFFICE, XML_DDE_TOPIC, XML_TOK_DDEFIELD_TOPIC },
+ { XML_NAMESPACE_OFFICE, XML_DDE_ITEM, XML_TOK_DDEFIELD_ITEM },
+ { XML_NAMESPACE_OFFICE, XML_AUTOMATIC_UPDATE, XML_TOK_DDEFIELD_UPDATE },
+ XML_TOKEN_MAP_END
+};
+
+TYPEINIT1( XMLDdeFieldDeclsImportContext, SvXMLImportContext );
+
+XMLDdeFieldDeclsImportContext::XMLDdeFieldDeclsImportContext(
+ SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& sLocalName) :
+ SvXMLImportContext(rImport, nPrfx, sLocalName),
+ aTokenMap(aDdeDeclAttrTokenMap)
+{
+}
+
+SvXMLImportContext * XMLDdeFieldDeclsImportContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList )
+{
+ if ( (XML_NAMESPACE_TEXT == nPrefix) &&
+ (IsXMLToken(rLocalName, XML_DDE_CONNECTION_DECL)) )
+ {
+ return new XMLDdeFieldDeclImportContext(GetImport(), nPrefix,
+ rLocalName, aTokenMap);
+ }
+ else
+ {
+ return SvXMLImportContext::CreateChildContext(nPrefix,
+ rLocalName,
+ xAttrList);
+ }
+}
+
+
+
+//
+// import dde field declaration
+//
+
+TYPEINIT1( XMLDdeFieldDeclImportContext, SvXMLImportContext );
+
+XMLDdeFieldDeclImportContext::XMLDdeFieldDeclImportContext(
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& sLocalName, const SvXMLTokenMap& rMap)
+: SvXMLImportContext(rImport, nPrfx, sLocalName)
+, sPropertyIsAutomaticUpdate(RTL_CONSTASCII_USTRINGPARAM(sAPI_is_automatic_update))
+, sPropertyName(RTL_CONSTASCII_USTRINGPARAM(sAPI_name))
+, sPropertyDDECommandType(RTL_CONSTASCII_USTRINGPARAM(sAPI_dde_command_type))
+, sPropertyDDECommandFile(RTL_CONSTASCII_USTRINGPARAM(sAPI_dde_command_file))
+, sPropertyDDECommandElement(RTL_CONSTASCII_USTRINGPARAM(sAPI_dde_command_element))
+, rTokenMap(rMap)
+{
+ DBG_ASSERT(XML_NAMESPACE_TEXT == nPrfx, "wrong prefix");
+ DBG_ASSERT(IsXMLToken(sLocalName, XML_DDE_CONNECTION_DECL), "wrong name");
+}
+
+void XMLDdeFieldDeclImportContext::StartElement(
+ const Reference<XAttributeList> & xAttrList)
+{
+ OUString sName;
+ OUString sCommandApplication;
+ OUString sCommandTopic;
+ OUString sCommandItem;
+
+ sal_Bool bUpdate = sal_False;
+ sal_Bool bNameOK = sal_False;
+ sal_Bool bCommandApplicationOK = sal_False;
+ sal_Bool bCommandTopicOK = sal_False;
+ sal_Bool bCommandItemOK = sal_False;
+
+ // process attributes
+ sal_Int16 nLength = xAttrList->getLength();
+ for(sal_Int16 i=0; i<nLength; i++)
+ {
+
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(i), &sLocalName );
+
+ switch (rTokenMap.Get(nPrefix, sLocalName))
+ {
+ case XML_TOK_DDEFIELD_NAME:
+ sName = xAttrList->getValueByIndex(i);
+ bNameOK = sal_True;
+ break;
+ case XML_TOK_DDEFIELD_APPLICATION:
+ sCommandApplication = xAttrList->getValueByIndex(i);
+ bCommandApplicationOK = sal_True;
+ break;
+ case XML_TOK_DDEFIELD_TOPIC:
+ sCommandTopic = xAttrList->getValueByIndex(i);
+ bCommandTopicOK = sal_True;
+ break;
+ case XML_TOK_DDEFIELD_ITEM:
+ sCommandItem = xAttrList->getValueByIndex(i);
+ bCommandItemOK = sal_True;
+ break;
+ case XML_TOK_DDEFIELD_UPDATE:
+ {
+ bool bTmp;
+ if ( SvXMLUnitConverter::convertBool(
+ bTmp, xAttrList->getValueByIndex(i)) )
+ {
+ bUpdate = bTmp;
+ }
+ break;
+ }
+ }
+ }
+
+ // valid data?
+ if (bNameOK && bCommandApplicationOK && bCommandTopicOK && bCommandItemOK)
+ {
+ // make service name
+ OUStringBuffer sBuf;
+ sBuf.appendAscii(sAPI_fieldmaster_prefix);
+ sBuf.appendAscii(sAPI_dde);
+
+ // create DDE TextFieldMaster
+ Reference<XMultiServiceFactory> xFactory(GetImport().GetModel(),
+ UNO_QUERY);
+ if( xFactory.is() )
+ {
+ /* #i6432# There might be multiple occurrences of one DDE
+ declaration if it is used in more than one of
+ header/footer/body. createInstance will throw an exception if we
+ try to create the second, third, etc. instance of such a
+ declaration. Thus we ignore the exception. Otherwise this will
+ lead to an unloadable document. */
+ try
+ {
+ Reference<XInterface> xIfc =
+ xFactory->createInstance(sBuf.makeStringAndClear());
+ if( xIfc.is() )
+ {
+ Reference<XPropertySet> xPropSet( xIfc, UNO_QUERY );
+ if (xPropSet.is() &&
+ xPropSet->getPropertySetInfo()->hasPropertyByName(
+ sPropertyDDECommandType))
+ {
+ Any aAny;
+
+ aAny <<= sName;
+ xPropSet->setPropertyValue(sPropertyName, aAny);
+
+ aAny <<= sCommandApplication;
+ xPropSet->setPropertyValue(sPropertyDDECommandType, aAny);
+
+ aAny <<= sCommandTopic;
+ xPropSet->setPropertyValue(sPropertyDDECommandFile, aAny);
+
+ aAny <<= sCommandItem;
+ xPropSet->setPropertyValue(sPropertyDDECommandElement,
+ aAny);
+
+ aAny.setValue(&bUpdate, ::getBooleanCppuType());
+ xPropSet->setPropertyValue(sPropertyIsAutomaticUpdate,
+ aAny);
+ }
+ // else: ignore (can't get XPropertySet, or DDE
+ // properties are not supported)
+ }
+ // else: ignore
+ }
+ catch ( const Exception& )
+ {
+ //ignore
+ }
+ }
+ // else: ignore
+ }
+ // else: ignore
+}
+
+
+
+//
+// DDE field import
+//
+
+TYPEINIT1( XMLDdeFieldImportContext, XMLTextFieldImportContext );
+
+XMLDdeFieldImportContext::XMLDdeFieldImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx, const OUString& sLocalName) :
+ XMLTextFieldImportContext(rImport, rHlp, sAPI_dde,
+ nPrfx, sLocalName),
+ sName()
+ ,sPropertyContent(RTL_CONSTASCII_USTRINGPARAM(sAPI_content))
+{
+}
+
+void XMLDdeFieldImportContext::ProcessAttribute(
+ sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue )
+{
+ if (XML_TOK_TEXTFIELD_CONNECTION_NAME == nAttrToken)
+ {
+ sName = sAttrValue;
+ bValid = sal_True;
+ }
+}
+
+void XMLDdeFieldImportContext::EndElement()
+{
+ if (bValid)
+ {
+ // find master
+ OUStringBuffer sBuf;
+ sBuf.appendAscii(sAPI_fieldmaster_prefix);
+ sBuf.appendAscii(sAPI_dde);
+ sBuf.append(sal_Unicode('.'));
+ sBuf.append(sName);
+ OUString sMasterName = sBuf.makeStringAndClear();
+
+ Reference<XTextFieldsSupplier> xTextFieldsSupp(GetImport().GetModel(),
+ UNO_QUERY);
+ Reference<container::XNameAccess> xFieldMasterNameAccess(
+ xTextFieldsSupp->getTextFieldMasters(), UNO_QUERY);
+
+ if (xFieldMasterNameAccess->hasByName(sMasterName))
+ {
+ Reference<XPropertySet> xMaster;
+ Any aAny = xFieldMasterNameAccess->getByName(sMasterName);
+ aAny >>= xMaster;
+ //apply the content to the master
+ xMaster->setPropertyValue( sPropertyContent, uno::makeAny( GetContent()));
+ // master exists: create text field and attach
+ Reference<XPropertySet> xField;
+ sBuf.appendAscii(sAPI_textfield_prefix);
+ sBuf.appendAscii(sAPI_dde);
+ if (CreateField(xField, sBuf.makeStringAndClear()))
+ {
+ Reference<XDependentTextField> xDepTextField(xField,UNO_QUERY);
+ xDepTextField->attachTextFieldMaster(xMaster);
+
+ // attach field to document
+ Reference<XTextContent> xTextContent(xField, UNO_QUERY);
+ if (xTextContent.is())
+ {
+ GetImportHelper().InsertTextContent(xTextContent);
+
+ // we're lucky. nothing else to prepare.
+ }
+ // else: fail, because text content could not be created
+ }
+ // else: fail, because field could not be created
+ }
+ // else: fail, because no master was found (faulty document?!)
+ }
+ // not valid: ignore
+}
+
+void XMLDdeFieldImportContext::PrepareField(
+ const Reference<XPropertySet> &)
+{
+ // empty, since not needed.
+}
+
+
+//
+// sheet name fields
+//
+
+TYPEINIT1(XMLSheetNameImportContext, XMLTextFieldImportContext);
+
+XMLSheetNameImportContext::XMLSheetNameImportContext(
+ SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const OUString& sLocalName) :
+ XMLTextFieldImportContext(rImport, rHlp, sAPI_sheet_name,
+ nPrfx, sLocalName)
+{
+ bValid = sal_True; // always valid!
+}
+
+void XMLSheetNameImportContext::ProcessAttribute(
+ sal_uInt16,
+ const ::rtl::OUString& )
+{
+ // no attributes -> nothing to be done
+}
+
+void XMLSheetNameImportContext::PrepareField(
+ const Reference<XPropertySet> &)
+{
+ // no attributes -> nothing to be done
+}
+
+
+//
+// URL fields (Calc, Impress, Draw)
+//
+
+TYPEINIT1(XMLUrlFieldImportContext, XMLTextFieldImportContext);
+
+XMLUrlFieldImportContext::XMLUrlFieldImportContext(
+ SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const OUString& sLocalName) :
+ XMLTextFieldImportContext(rImport, rHlp, sAPI_url,
+ nPrfx, sLocalName),
+ sPropertyURL(RTL_CONSTASCII_USTRINGPARAM(sAPI_url)),
+ sPropertyTargetFrame(RTL_CONSTASCII_USTRINGPARAM(sAPI_target_frame)),
+ sPropertyRepresentation(RTL_CONSTASCII_USTRINGPARAM(
+ sAPI_representation)),
+ bFrameOK(sal_False)
+{
+}
+
+void XMLUrlFieldImportContext::ProcessAttribute(
+ sal_uInt16 nAttrToken,
+ const OUString& sAttrValue )
+{
+ switch (nAttrToken)
+ {
+ case XML_TOK_TEXTFIELD_HREF:
+ sURL = GetImport().GetAbsoluteReference( sAttrValue );
+ bValid = sal_True;
+ break;
+ case XML_TOK_TEXTFIELD_TARGET_FRAME:
+ sFrame = sAttrValue;
+ bFrameOK = sal_True;
+ break;
+ default:
+ // ignore
+ break;
+ }
+}
+
+void XMLUrlFieldImportContext::PrepareField(
+ const Reference<XPropertySet> & xPropertySet)
+{
+ Any aAny;
+
+ aAny <<= sURL;
+ xPropertySet->setPropertyValue(sPropertyURL, aAny);
+
+ if (bFrameOK)
+ {
+ aAny <<= sFrame;
+ xPropertySet->setPropertyValue(sPropertyTargetFrame, aAny);
+ }
+
+ aAny <<= GetContent();
+ xPropertySet->setPropertyValue(sPropertyRepresentation, aAny);
+}
+
+
+TYPEINIT1(XMLBibliographyFieldImportContext, XMLTextFieldImportContext);
+
+
+XMLBibliographyFieldImportContext::XMLBibliographyFieldImportContext(
+ SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const OUString& sLocalName) :
+ XMLTextFieldImportContext(rImport, rHlp, sAPI_bibliography,
+ nPrfx, sLocalName),
+ sPropertyFields(RTL_CONSTASCII_USTRINGPARAM("Fields")),
+ aValues()
+{
+ bValid = sal_True;
+}
+
+// TODO: this is the same map as is used in the text field export
+SvXMLEnumMapEntry const aBibliographyDataTypeMap[] =
+{
+ { XML_ARTICLE, BibliographyDataType::ARTICLE },
+ { XML_BOOK, BibliographyDataType::BOOK },
+ { XML_BOOKLET, BibliographyDataType::BOOKLET },
+ { XML_CONFERENCE, BibliographyDataType::CONFERENCE },
+ { XML_CUSTOM1, BibliographyDataType::CUSTOM1 },
+ { XML_CUSTOM2, BibliographyDataType::CUSTOM2 },
+ { XML_CUSTOM3, BibliographyDataType::CUSTOM3 },
+ { XML_CUSTOM4, BibliographyDataType::CUSTOM4 },
+ { XML_CUSTOM5, BibliographyDataType::CUSTOM5 },
+ { XML_EMAIL, BibliographyDataType::EMAIL },
+ { XML_INBOOK, BibliographyDataType::INBOOK },
+ { XML_INCOLLECTION, BibliographyDataType::INCOLLECTION },
+ { XML_INPROCEEDINGS, BibliographyDataType::INPROCEEDINGS },
+ { XML_JOURNAL, BibliographyDataType::JOURNAL },
+ { XML_MANUAL, BibliographyDataType::MANUAL },
+ { XML_MASTERSTHESIS, BibliographyDataType::MASTERSTHESIS },
+ { XML_MISC, BibliographyDataType::MISC },
+ { XML_PHDTHESIS, BibliographyDataType::PHDTHESIS },
+ { XML_PROCEEDINGS, BibliographyDataType::PROCEEDINGS },
+ { XML_TECHREPORT, BibliographyDataType::TECHREPORT },
+ { XML_UNPUBLISHED, BibliographyDataType::UNPUBLISHED },
+ { XML_WWW, BibliographyDataType::WWW },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+
+// we'll process attributes on our own and forfit the standard
+// tecfield mechanism, because our attributes have zero overlp with
+// all the oher textfields.
+void XMLBibliographyFieldImportContext::StartElement(
+ const Reference<XAttributeList> & xAttrList)
+{
+ // iterate over attributes
+ sal_Int16 nLength = xAttrList->getLength();
+ for(sal_Int16 i=0; i<nLength; i++) {
+
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(i), &sLocalName );
+
+ if (nPrefix == XML_NAMESPACE_TEXT)
+ {
+ PropertyValue aValue;
+ aValue.Name = OUString::createFromAscii(
+ MapBibliographyFieldName(sLocalName));
+ Any aAny;
+
+ // special treatment for bibliography type
+ // biblio vs bibilio: #96658#; also read old documents
+ if (IsXMLToken(sLocalName, XML_BIBILIOGRAPHIC_TYPE) ||
+ IsXMLToken(sLocalName, XML_BIBLIOGRAPHY_TYPE) )
+ {
+ sal_uInt16 nTmp;
+ if (SvXMLUnitConverter::convertEnum(
+ nTmp, xAttrList->getValueByIndex(i),
+ aBibliographyDataTypeMap))
+ {
+ aAny <<= (sal_Int16)nTmp;
+ aValue.Value = aAny;
+
+ aValues.push_back(aValue);
+ }
+ }
+ else
+ {
+ aAny <<= xAttrList->getValueByIndex(i);
+ aValue.Value = aAny;
+
+ aValues.push_back(aValue);
+ }
+ }
+ // else: unknown namespace -> ignore
+ }
+}
+
+void XMLBibliographyFieldImportContext::ProcessAttribute(
+ sal_uInt16,
+ const OUString& )
+{
+ // attributes are handled in StartElement
+ OSL_FAIL("This should not have happened.");
+}
+
+
+void XMLBibliographyFieldImportContext::PrepareField(
+ const Reference<XPropertySet> & xPropertySet)
+{
+ // convert vector into sequence
+ sal_Int32 nCount = aValues.size();
+ Sequence<PropertyValue> aValueSequence(nCount);
+ for(sal_Int32 i = 0; i < nCount; i++)
+ {
+ aValueSequence[i] = aValues[i];
+ }
+
+ // set sequence
+ Any aAny;
+ aAny <<= aValueSequence;
+ xPropertySet->setPropertyValue(sPropertyFields, aAny);
+}
+
+const sal_Char* XMLBibliographyFieldImportContext::MapBibliographyFieldName(
+ OUString sName)
+{
+ const sal_Char* pName = NULL;
+
+ if (IsXMLToken(sName, XML_IDENTIFIER))
+ {
+ pName = "Identifier";
+ }
+ else if (IsXMLToken(sName, XML_BIBILIOGRAPHIC_TYPE) ||
+ IsXMLToken(sName, XML_BIBLIOGRAPHY_TYPE) )
+ {
+ // biblio... vs bibilio...: #96658#: also read old documents
+ pName = "BibiliographicType";
+ }
+ else if (IsXMLToken(sName, XML_ADDRESS))
+ {
+ pName = "Address";
+ }
+ else if (IsXMLToken(sName, XML_ANNOTE))
+ {
+ pName = "Annote";
+ }
+ else if (IsXMLToken(sName, XML_AUTHOR))
+ {
+ pName = "Author";
+ }
+ else if (IsXMLToken(sName, XML_BOOKTITLE))
+ {
+ pName = "Booktitle";
+ }
+ else if (IsXMLToken(sName, XML_CHAPTER))
+ {
+ pName = "Chapter";
+ }
+ else if (IsXMLToken(sName, XML_EDITION))
+ {
+ pName = "Edition";
+ }
+ else if (IsXMLToken(sName, XML_EDITOR))
+ {
+ pName = "Editor";
+ }
+ else if (IsXMLToken(sName, XML_HOWPUBLISHED))
+ {
+ pName = "Howpublished";
+ }
+ else if (IsXMLToken(sName, XML_INSTITUTION))
+ {
+ pName = "Institution";
+ }
+ else if (IsXMLToken(sName, XML_JOURNAL))
+ {
+ pName = "Journal";
+ }
+ else if (IsXMLToken(sName, XML_MONTH))
+ {
+ pName = "Month";
+ }
+ else if (IsXMLToken(sName, XML_NOTE))
+ {
+ pName = "Note";
+ }
+ else if (IsXMLToken(sName, XML_NUMBER))
+ {
+ pName = "Number";
+ }
+ else if (IsXMLToken(sName, XML_ORGANIZATIONS))
+ {
+ pName = "Organizations";
+ }
+ else if (IsXMLToken(sName, XML_PAGES))
+ {
+ pName = "Pages";
+ }
+ else if (IsXMLToken(sName, XML_PUBLISHER))
+ {
+ pName = "Publisher";
+ }
+ else if (IsXMLToken(sName, XML_SCHOOL))
+ {
+ pName = "School";
+ }
+ else if (IsXMLToken(sName, XML_SERIES))
+ {
+ pName = "Series";
+ }
+ else if (IsXMLToken(sName, XML_TITLE))
+ {
+ pName = "Title";
+ }
+ else if (IsXMLToken(sName, XML_REPORT_TYPE))
+ {
+ pName = "Report_Type";
+ }
+ else if (IsXMLToken(sName, XML_VOLUME))
+ {
+ pName = "Volume";
+ }
+ else if (IsXMLToken(sName, XML_YEAR))
+ {
+ pName = "Year";
+ }
+ else if (IsXMLToken(sName, XML_URL))
+ {
+ pName = "URL";
+ }
+ else if (IsXMLToken(sName, XML_CUSTOM1))
+ {
+ pName = "Custom1";
+ }
+ else if (IsXMLToken(sName, XML_CUSTOM2))
+ {
+ pName = "Custom2";
+ }
+ else if (IsXMLToken(sName, XML_CUSTOM3))
+ {
+ pName = "Custom3";
+ }
+ else if (IsXMLToken(sName, XML_CUSTOM4))
+ {
+ pName = "Custom4";
+ }
+ else if (IsXMLToken(sName, XML_CUSTOM5))
+ {
+ pName = "Custom5";
+ }
+ else if (IsXMLToken(sName, XML_ISBN))
+ {
+ pName = "ISBN";
+ }
+ else
+ {
+ OSL_FAIL("Unknown bibliography info data");
+ pName = NULL;
+ }
+
+ return pName;
+}
+
+
+//
+// Annotation Field
+//
+
+TYPEINIT1(XMLAnnotationImportContext, XMLTextFieldImportContext);
+
+XMLAnnotationImportContext::XMLAnnotationImportContext(
+ SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const OUString& sLocalName) :
+ XMLTextFieldImportContext(rImport, rHlp, sAPI_annotation,
+ nPrfx, sLocalName),
+ sPropertyAuthor(RTL_CONSTASCII_USTRINGPARAM(sAPI_author)),
+ sPropertyContent(RTL_CONSTASCII_USTRINGPARAM(sAPI_content)),
+ // why is there no UNO_NAME_DATE_TIME, but only UNO_NAME_DATE_TIME_VALUE?
+ sPropertyDate(RTL_CONSTASCII_USTRINGPARAM(sAPI_date_time_value)),
+ sPropertyTextRange(RTL_CONSTASCII_USTRINGPARAM(sAPI_TextRange))
+{
+ bValid = sal_True;
+
+ // remember old list item and block (#91964#) and reset them
+ // for the text frame
+ // do this in the constructor, not in CreateChildContext (#i93392#)
+ GetImport().GetTextImport()->PushListContext();
+}
+
+void XMLAnnotationImportContext::ProcessAttribute(
+ sal_uInt16,
+ const OUString& )
+{
+ // ignore
+}
+
+SvXMLImportContext* XMLAnnotationImportContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList >& xAttrList )
+{
+ SvXMLImportContext *pContext = 0;
+ if( XML_NAMESPACE_DC == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_CREATOR ) )
+ pContext = new XMLStringBufferImportContext(GetImport(), nPrefix,
+ rLocalName, aAuthorBuffer);
+ else if( IsXMLToken( rLocalName, XML_DATE ) )
+ pContext = new XMLStringBufferImportContext(GetImport(), nPrefix,
+ rLocalName, aDateBuffer);
+ }
+
+ if( !pContext )
+ {
+ try
+ {
+ if ( !mxField.is() )
+ CreateField( mxField, sServicePrefix + GetServiceName() );
+ Any aAny = mxField->getPropertyValue( sPropertyTextRange );
+ Reference< XText > xText;
+ aAny >>= xText;
+ if( xText.is() )
+ {
+ UniReference < XMLTextImportHelper > xTxtImport = GetImport().GetTextImport();
+ if( !mxCursor.is() )
+ {
+ mxOldCursor = xTxtImport->GetCursor();
+ mxCursor = xText->createTextCursor();
+ }
+
+ if( mxCursor.is() )
+ {
+ xTxtImport->SetCursor( mxCursor );
+ pContext = xTxtImport->CreateTextChildContext( GetImport(), nPrefix, rLocalName, xAttrList );
+ }
+ }
+ }
+ catch ( Exception& )
+ {}
+
+ if( !pContext )
+ pContext = new XMLStringBufferImportContext(GetImport(), nPrefix, rLocalName, aTextBuffer);
+ }
+
+ return pContext;
+}
+
+void XMLAnnotationImportContext::EndElement()
+{
+ DBG_ASSERT(GetServiceName().getLength()>0, "no service name for element!");
+ if( mxCursor.is() )
+ {
+ // delete addition newline
+ const OUString aEmpty;
+ mxCursor->gotoEnd( sal_False );
+ mxCursor->goLeft( 1, sal_True );
+ mxCursor->setString( aEmpty );
+
+ // reset cursor
+ GetImport().GetTextImport()->ResetCursor();
+ }
+
+ if( mxOldCursor.is() )
+ GetImport().GetTextImport()->SetCursor( mxOldCursor );
+
+ // reinstall old list item #91964#
+ GetImport().GetTextImport()->PopListContext();
+
+ if ( bValid )
+ {
+ if ( mxField.is() || CreateField( mxField, sServicePrefix + GetServiceName() ) )
+ {
+ // set field properties
+ PrepareField( mxField );
+
+ // attach field to document
+ Reference < XTextContent > xTextContent( mxField, UNO_QUERY );
+
+ // workaround for #80606#
+ try
+ {
+ GetImportHelper().InsertTextContent( xTextContent );
+ }
+ catch (lang::IllegalArgumentException)
+ {
+ // ignore
+ }
+ }
+ }
+ else
+ GetImportHelper().InsertString(GetContent());
+}
+
+void XMLAnnotationImportContext::PrepareField(
+ const Reference<XPropertySet> & xPropertySet)
+{
+ // import (possibly empty) author
+ OUString sAuthor( aAuthorBuffer.makeStringAndClear() );
+ xPropertySet->setPropertyValue(sPropertyAuthor, makeAny(sAuthor));
+
+ DateTime aDateTime;
+ if (SvXMLUnitConverter::convertDateTime(aDateTime,
+ aDateBuffer.makeStringAndClear()))
+ {
+ /*
+ Date aDate;
+ aDate.Year = aDateTime.Year;
+ aDate.Month = aDateTime.Month;
+ aDate.Day = aDateTime.Day;
+ xPropertySet->setPropertyValue(sPropertyDate, makeAny(aDate));
+ */
+ xPropertySet->setPropertyValue(sPropertyDate, makeAny(aDateTime));
+ }
+
+ OUString sBuffer = aTextBuffer.makeStringAndClear();
+ if ( sBuffer.getLength() )
+ {
+ // delete last paragraph mark (if necessary)
+ if (sal_Char(0x0a) == sBuffer.getStr()[sBuffer.getLength()-1])
+ sBuffer = sBuffer.copy(0, sBuffer.getLength()-1);
+ xPropertySet->setPropertyValue(sPropertyContent, makeAny(sBuffer));
+ }
+}
+
+
+
+//
+// script field
+//
+
+TYPEINIT1(XMLScriptImportContext, XMLTextFieldImportContext);
+
+XMLScriptImportContext::XMLScriptImportContext(
+ SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const OUString& sLocalName)
+: XMLTextFieldImportContext(rImport, rHlp, sAPI_script, nPrfx, sLocalName)
+, sPropertyScriptType(RTL_CONSTASCII_USTRINGPARAM(sAPI_script_type))
+, sPropertyURLContent(RTL_CONSTASCII_USTRINGPARAM(sAPI_url_content))
+, sPropertyContent(RTL_CONSTASCII_USTRINGPARAM(sAPI_content))
+, bContentOK(sal_False)
+, bScriptTypeOK(sal_False)
+, bUrlContent(sal_False)
+{
+}
+
+void XMLScriptImportContext::ProcessAttribute(
+ sal_uInt16 nAttrToken,
+ const OUString& sAttrValue )
+{
+ switch (nAttrToken)
+ {
+ case XML_TOK_TEXTFIELD_HREF:
+ sContent = GetImport().GetAbsoluteReference( sAttrValue );
+ bContentOK = sal_True;
+ break;
+
+ case XML_TOK_TEXTFIELD_LANGUAGE:
+ sScriptType = sAttrValue;
+ bScriptTypeOK = sal_True;
+ break;
+
+ default:
+ // ignore
+ break;
+ }
+
+ // always valid (even without ScriptType; cf- #96531#)
+ bValid = sal_True;
+}
+
+void XMLScriptImportContext::PrepareField(
+ const Reference<XPropertySet> & xPropertySet)
+{
+ Any aAny;
+
+ // if href attribute was present, we use it. Else we use element content
+ if (! bContentOK)
+ {
+ sContent = GetContent();
+ }
+ aAny <<= sContent;
+ xPropertySet->setPropertyValue(sPropertyContent, aAny);
+
+ // URL or script text? We use URL if we have an href-attribute
+ aAny.setValue(&bContentOK, ::getBooleanCppuType());
+ xPropertySet->setPropertyValue(sPropertyURLContent, aAny);
+
+ aAny <<= sScriptType;
+ xPropertySet->setPropertyValue(sPropertyScriptType, aAny);
+}
+
+//
+// measure field
+//
+
+TYPEINIT1(XMLMeasureFieldImportContext, XMLTextFieldImportContext);
+
+XMLMeasureFieldImportContext::XMLMeasureFieldImportContext(
+ SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const OUString& sLocalName) :
+ XMLTextFieldImportContext(rImport, rHlp, sAPI_measure,
+ nPrfx, sLocalName),
+ mnKind( 0 )
+{
+}
+
+void XMLMeasureFieldImportContext::ProcessAttribute(
+ sal_uInt16 nAttrToken,
+ const OUString& sAttrValue )
+{
+ switch (nAttrToken)
+ {
+ case XML_TOK_TEXTFIELD_MEASURE_KIND:
+ if( IsXMLToken( sAttrValue, XML_VALUE ) )
+ {
+ mnKind = 0; bValid = sal_True;
+ }
+ else if( IsXMLToken( sAttrValue, XML_UNIT ) )
+ {
+ mnKind = 1; bValid = sal_True;
+ }
+ else if( IsXMLToken( sAttrValue, XML_GAP ) )
+ {
+ mnKind = 2; bValid = sal_True;
+ }
+ break;
+ }
+}
+
+void XMLMeasureFieldImportContext::PrepareField(
+ const Reference<XPropertySet> & xPropertySet)
+{
+ Any aAny;
+ aAny <<= mnKind;
+ xPropertySet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Kind")), aAny);
+}
+
+
+
+//
+// dropdown field
+//
+
+
+TYPEINIT1( XMLDropDownFieldImportContext, XMLTextFieldImportContext );
+
+XMLDropDownFieldImportContext::XMLDropDownFieldImportContext(
+ SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& sLocalName) :
+ XMLTextFieldImportContext( rImport, rHlp, sAPI_drop_down,
+ nPrfx, sLocalName ),
+ aLabels(),
+ sName(),
+ nSelected( -1 ),
+ bNameOK( false ),
+ bHelpOK(false),
+ bHintOK(false),
+ sPropertyItems( RTL_CONSTASCII_USTRINGPARAM( "Items" ) ),
+ sPropertySelectedItem( RTL_CONSTASCII_USTRINGPARAM( "SelectedItem" ) ),
+ sPropertyName( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ),
+ sPropertyHelp( RTL_CONSTASCII_USTRINGPARAM( "Help" ) ),
+ sPropertyToolTip( RTL_CONSTASCII_USTRINGPARAM( "Tooltip" ) )
+{
+ bValid = sal_True;
+}
+
+bool lcl_ProcessLabel( const SvXMLImport& rImport,
+ const Reference<XAttributeList>& xAttrList,
+ OUString& rLabel,
+ bool& rIsSelected )
+{
+ bool bValid = false;
+ sal_Int16 nLength = xAttrList->getLength();
+ for( sal_Int16 n = 0; n < nLength; n++ )
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = rImport.GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(n), &sLocalName );
+ OUString sValue = xAttrList->getValueByIndex(n);
+
+ if( nPrefix == XML_NAMESPACE_TEXT )
+ {
+ if( IsXMLToken( sLocalName, XML_VALUE ) )
+ {
+ rLabel = sValue;
+ bValid = true;
+ }
+ else if( IsXMLToken( sLocalName, XML_CURRENT_SELECTED ) )
+ {
+ bool bTmp;
+ if( SvXMLUnitConverter::convertBool( bTmp, sValue ) )
+ rIsSelected = bTmp;
+ }
+ }
+ }
+ return bValid;
+}
+
+SvXMLImportContext* XMLDropDownFieldImportContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList>& xAttrList )
+{
+ if( nPrefix == XML_NAMESPACE_TEXT &&
+ IsXMLToken( rLocalName, XML_LABEL ) )
+ {
+ OUString sLabel;
+ bool bIsSelected = sal_False;
+ if( lcl_ProcessLabel( GetImport(), xAttrList, sLabel, bIsSelected ) )
+ {
+ if( bIsSelected )
+ nSelected = static_cast<sal_Int32>( aLabels.size() );
+ aLabels.push_back( sLabel );
+ }
+ }
+ return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+}
+
+void XMLDropDownFieldImportContext::ProcessAttribute(
+ sal_uInt16 nAttrToken,
+ const ::rtl::OUString& sAttrValue )
+{
+ if( nAttrToken == XML_TOK_TEXTFIELD_NAME )
+ {
+ sName = sAttrValue;
+ bNameOK = true;
+ }
+ else if (nAttrToken == XML_TOK_TEXTFIELD_HELP)
+ {
+ sHelp = sAttrValue;
+ bHelpOK = true;
+ }
+ else if (nAttrToken == XML_TOK_TEXTFIELD_HINT)
+ {
+ sHint = sAttrValue;
+ bHintOK = true;
+ }
+}
+
+void XMLDropDownFieldImportContext::PrepareField(
+ const Reference<XPropertySet>& xPropertySet)
+{
+ // create sequence
+ sal_Int32 nLength = static_cast<sal_Int32>( aLabels.size() );
+ Sequence<OUString> aSequence( nLength );
+ OUString* pSequence = aSequence.getArray();
+ for( sal_Int32 n = 0; n < nLength; n++ )
+ pSequence[n] = aLabels[n];
+
+ // now set values:
+ Any aAny;
+
+ aAny <<= aSequence;
+ xPropertySet->setPropertyValue( sPropertyItems, aAny );
+
+ if( nSelected >= 0 && nSelected < nLength )
+ {
+ aAny <<= pSequence[nSelected];
+ xPropertySet->setPropertyValue( sPropertySelectedItem, aAny );
+ }
+
+ // set name
+ if( bNameOK )
+ {
+ aAny <<= sName;
+ xPropertySet->setPropertyValue( sPropertyName, aAny );
+ }
+ // set help
+ if( bHelpOK )
+ {
+ aAny <<= sHelp;
+ xPropertySet->setPropertyValue( sPropertyHelp, aAny );
+ }
+ // set hint
+ if( bHintOK )
+ {
+ aAny <<= sHint;
+ xPropertySet->setPropertyValue( sPropertyToolTip, aAny );
+ }
+
+}
+
+/** import header fields (<draw:header>) */
+TYPEINIT1( XMLHeaderFieldImportContext, XMLTextFieldImportContext );
+
+XMLHeaderFieldImportContext::XMLHeaderFieldImportContext(
+ SvXMLImport& rImport, /// XML Import
+ XMLTextImportHelper& rHlp, /// Text import helper
+ sal_uInt16 nPrfx, /// namespace prefix
+ const ::rtl::OUString& sLocalName) /// element name w/o prefix
+: XMLTextFieldImportContext(rImport, rHlp, sAPI_header, nPrfx, sLocalName )
+{
+ sServicePrefix = OUString(RTL_CONSTASCII_USTRINGPARAM( sAPI_presentation_prefix ));
+ bValid = sal_True;
+}
+
+/// process attribute values
+void XMLHeaderFieldImportContext::ProcessAttribute( sal_uInt16, const ::rtl::OUString& )
+{
+}
+
+/// prepare XTextField for insertion into document
+void XMLHeaderFieldImportContext::PrepareField(const Reference<XPropertySet> &)
+{
+}
+
+/** import footer fields (<draw:footer>) */
+TYPEINIT1( XMLFooterFieldImportContext, XMLTextFieldImportContext );
+
+XMLFooterFieldImportContext::XMLFooterFieldImportContext(
+ SvXMLImport& rImport, /// XML Import
+ XMLTextImportHelper& rHlp, /// Text import helper
+ sal_uInt16 nPrfx, /// namespace prefix
+ const ::rtl::OUString& sLocalName) /// element name w/o prefix
+: XMLTextFieldImportContext(rImport, rHlp, sAPI_footer, nPrfx, sLocalName )
+{
+ sServicePrefix = OUString(RTL_CONSTASCII_USTRINGPARAM( sAPI_presentation_prefix ));
+ bValid = sal_True;
+}
+
+/// process attribute values
+void XMLFooterFieldImportContext::ProcessAttribute( sal_uInt16, const ::rtl::OUString& )
+{
+}
+
+/// prepare XTextField for insertion into document
+void XMLFooterFieldImportContext::PrepareField(const Reference<XPropertySet> &)
+{
+}
+
+
+/** import footer fields (<draw:date-and-time>) */
+TYPEINIT1( XMLDateTimeFieldImportContext, XMLTextFieldImportContext );
+
+XMLDateTimeFieldImportContext::XMLDateTimeFieldImportContext(
+ SvXMLImport& rImport, /// XML Import
+ XMLTextImportHelper& rHlp, /// Text import helper
+ sal_uInt16 nPrfx, /// namespace prefix
+ const ::rtl::OUString& sLocalName) /// element name w/o prefix
+: XMLTextFieldImportContext(rImport, rHlp, sAPI_datetime, nPrfx, sLocalName )
+{
+ sServicePrefix = OUString(RTL_CONSTASCII_USTRINGPARAM( sAPI_presentation_prefix ));
+ bValid = sal_True;
+}
+
+/// process attribute values
+void XMLDateTimeFieldImportContext::ProcessAttribute( sal_uInt16,
+ const ::rtl::OUString& )
+{
+}
+
+/// prepare XTextField for insertion into document
+void XMLDateTimeFieldImportContext::PrepareField(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> &)
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/txtftne.cxx b/xmloff/source/text/txtftne.cxx
new file mode 100644
index 000000000000..23ee992339a5
--- /dev/null
+++ b/xmloff/source/text/txtftne.cxx
@@ -0,0 +1,394 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+/** @#file
+ *
+ * This file implements XMLTextParagraphExport methods to export
+ * - footnotes
+ * - endnotes
+ * - footnote configuration elements
+ * - endnote configuration elements
+ */
+#include <tools/debug.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XTextContent.hpp>
+#include <com/sun/star/text/XFootnote.hpp>
+#include <com/sun/star/text/XFootnotesSupplier.hpp>
+#include <com/sun/star/text/XEndnotesSupplier.hpp>
+#include <com/sun/star/text/FootnoteNumbering.hpp>
+#include <com/sun/star/container/XNameReplace.hpp>
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmlnumfe.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/families.hxx>
+#include <xmloff/xmlnume.hxx>
+#include "XMLTextCharStyleNamesElementExport.hxx"
+#include <xmloff/XMLEventExport.hxx>
+#include <xmloff/txtparae.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::container;
+using namespace ::xmloff::token;
+
+
+void XMLTextParagraphExport::exportTextFootnote(
+ const Reference<XPropertySet> & rPropSet,
+ const OUString& rText,
+ sal_Bool bAutoStyles, sal_Bool bIsProgress )
+{
+ // get footnote and associated text
+ Any aAny;
+ aAny = rPropSet->getPropertyValue(sFootnote);
+ Reference<XFootnote> xFootnote;
+ aAny >>= xFootnote;
+ Reference<XText> xText(xFootnote, UNO_QUERY);
+
+ // are we an endnote?
+ Reference<XServiceInfo> xServiceInfo( xFootnote, UNO_QUERY );
+ sal_Bool bIsEndnote = xServiceInfo->supportsService(sTextEndnoteService);
+
+ if (bAutoStyles)
+ {
+ // handle formatting of citation mark
+ Add( XML_STYLE_FAMILY_TEXT_TEXT, rPropSet );
+
+ // handle formatting within footnote
+ exportTextFootnoteHelper(xFootnote, xText, rText,
+ bAutoStyles, bIsEndnote, bIsProgress );
+ }
+ else
+ {
+ // create span (for citation mark) if necessary; footnote content
+ // wil be handled via exportTextFootnoteHelper, exportText
+ sal_Bool bHasHyperlink;
+ sal_Bool bIsUICharStyle = sal_False;
+ sal_Bool bHasAutoStyle = sal_False;
+
+ OUString sStyle = FindTextStyleAndHyperlink( rPropSet, bHasHyperlink,
+ bIsUICharStyle, bHasAutoStyle );
+
+ // export hyperlink (if we have one)
+ Reference < XPropertySetInfo > xPropSetInfo;
+ if( bHasHyperlink )
+ {
+ Reference<XPropertyState> xPropState( rPropSet, UNO_QUERY );
+ xPropSetInfo = rPropSet->getPropertySetInfo();
+ bHasHyperlink =
+ addHyperlinkAttributes( rPropSet, xPropState, xPropSetInfo );
+ }
+ SvXMLElementExport aHyperlink( GetExport(), bHasHyperlink,
+ XML_NAMESPACE_TEXT, XML_A,
+ sal_False, sal_False );
+
+ if( bHasHyperlink )
+ {
+ // export events (if supported)
+ OUString sHyperLinkEvents(RTL_CONSTASCII_USTRINGPARAM(
+ "HyperLinkEvents"));
+ if (xPropSetInfo->hasPropertyByName(sHyperLinkEvents))
+ {
+ Any a = rPropSet->getPropertyValue(sHyperLinkEvents);
+ Reference<XNameReplace> xName;
+ a >>= xName;
+ GetExport().GetEventExport().Export(xName, sal_False);
+ }
+ }
+
+ {
+ XMLTextCharStyleNamesElementExport aCharStylesExport(
+ GetExport(), bIsUICharStyle &&
+ aCharStyleNamesPropInfoCache.hasProperty(
+ rPropSet ), bHasAutoStyle,
+ rPropSet, sCharStyleNames );
+ if( sStyle.getLength() )
+ {
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME,
+ GetExport().EncodeStyleName( sStyle ) );
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT,
+ XML_SPAN, sal_False, sal_False );
+ exportTextFootnoteHelper(xFootnote, xText, rText,
+ bAutoStyles, bIsEndnote, bIsProgress );
+ }
+ else
+ {
+ exportTextFootnoteHelper(xFootnote, xText, rText,
+ bAutoStyles, bIsEndnote, bIsProgress );
+ }
+ }
+ }
+}
+
+
+void XMLTextParagraphExport::exportTextFootnoteHelper(
+ const Reference<XFootnote> & rFootnote,
+ const Reference<XText> & rText,
+ const OUString& rTextString,
+ sal_Bool bAutoStyles,
+ sal_Bool bIsEndnote,
+ sal_Bool bIsProgress )
+{
+ if (bAutoStyles)
+ {
+ exportText(rText, bAutoStyles, bIsProgress, sal_True );
+ }
+ else
+ {
+ // export reference Id (for reference fields)
+ Reference<XPropertySet> xPropSet(rFootnote, UNO_QUERY);
+ Any aAny = xPropSet->getPropertyValue(sReferenceId);
+ sal_Int32 nNumber = 0;
+ aAny >>= nNumber;
+ OUStringBuffer aBuf;
+ aBuf.appendAscii("ftn");
+ aBuf.append(nNumber);
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_ID,
+ aBuf.makeStringAndClear());
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_NOTE_CLASS,
+ GetXMLToken( bIsEndnote ? XML_ENDNOTE
+ : XML_FOOTNOTE ) );
+
+ SvXMLElementExport aNote(GetExport(), XML_NAMESPACE_TEXT,
+ XML_NOTE, sal_False, sal_False);
+ {
+ // handle label vs. automatic numbering
+ OUString sLabel = rFootnote->getLabel();
+ if (sLabel.getLength()>0)
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_LABEL,
+ sLabel);
+ }
+ // else: automatic numbering -> no attribute
+
+ SvXMLElementExport aCite(GetExport(), XML_NAMESPACE_TEXT,
+ XML_NOTE_CITATION, sal_False, sal_False);
+ GetExport().Characters(rTextString);
+ }
+
+ {
+ SvXMLElementExport aBody(GetExport(), XML_NAMESPACE_TEXT,
+ XML_NOTE_BODY, sal_False, sal_False);
+ exportText(rText, bAutoStyles, bIsProgress, sal_True );
+ }
+ }
+}
+
+
+void XMLTextParagraphExport::exportTextFootnoteConfiguration()
+{
+ // footnote settings
+ Reference<XFootnotesSupplier> aFootnotesSupplier(GetExport().GetModel(),
+ UNO_QUERY);
+ Reference<XPropertySet> aFootnoteConfiguration(
+ aFootnotesSupplier->getFootnoteSettings());
+ exportTextFootnoteConfigurationHelper(aFootnoteConfiguration, sal_False);
+
+ // endnote settings
+ Reference<XEndnotesSupplier> aEndnotesSupplier(GetExport().GetModel(),
+ UNO_QUERY);
+ Reference<XPropertySet> aEndnoteConfiguration(
+ aEndnotesSupplier->getEndnoteSettings());
+ exportTextFootnoteConfigurationHelper(aEndnoteConfiguration, sal_True);
+}
+
+
+void lcl_exportString(
+ SvXMLExport& rExport,
+ const Reference<XPropertySet> & rPropSet,
+ const OUString& sProperty,
+ sal_uInt16 nPrefix,
+ enum XMLTokenEnum eElement,
+ sal_Bool bEncodeName,
+ sal_Bool bOmitIfEmpty)
+{
+ DBG_ASSERT( eElement != XML_TOKEN_INVALID, "need element token");
+
+ Any aAny = rPropSet->getPropertyValue(sProperty);
+ OUString sTmp;
+ aAny >>= sTmp;
+ if (!bOmitIfEmpty || (sTmp.getLength() > 0))
+ {
+ if( bEncodeName )
+ sTmp = rExport.EncodeStyleName( sTmp );
+ rExport.AddAttribute(nPrefix, eElement, sTmp);
+ }
+}
+
+void XMLTextParagraphExport::exportTextFootnoteConfigurationHelper(
+ const Reference<XPropertySet> & rFootnoteConfig,
+ sal_Bool bIsEndnote)
+{
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_NOTE_CLASS,
+ GetXMLToken( bIsEndnote ? XML_ENDNOTE
+ : XML_FOOTNOTE ) );
+ // default/paragraph style
+ lcl_exportString( GetExport(), rFootnoteConfig,
+ sParaStyleName,
+ XML_NAMESPACE_TEXT, XML_DEFAULT_STYLE_NAME,
+ sal_True, sal_True);
+
+ // citation style
+ lcl_exportString( GetExport(), rFootnoteConfig,
+ sCharStyleName,
+ XML_NAMESPACE_TEXT, XML_CITATION_STYLE_NAME,
+ sal_True, sal_True);
+
+ // citation body style
+ lcl_exportString( GetExport(), rFootnoteConfig,
+ sAnchorCharStyleName,
+ XML_NAMESPACE_TEXT, XML_CITATION_BODY_STYLE_NAME,
+ sal_True, sal_True);
+
+ // page style
+ lcl_exportString( GetExport(), rFootnoteConfig,
+ sPageStyleName,
+ XML_NAMESPACE_TEXT, XML_MASTER_PAGE_NAME,
+ sal_True, sal_True );
+
+ // prefix
+ lcl_exportString( GetExport(), rFootnoteConfig, sPrefix,
+ XML_NAMESPACE_STYLE, XML_NUM_PREFIX, sal_False, sal_True);
+
+ // suffix
+ lcl_exportString( GetExport(), rFootnoteConfig, sSuffix,
+ XML_NAMESPACE_STYLE, XML_NUM_SUFFIX, sal_False, sal_True);
+
+
+
+ Any aAny;
+
+ // numbering style
+ OUStringBuffer sBuffer;
+ aAny = rFootnoteConfig->getPropertyValue(sNumberingType);
+ sal_Int16 nNumbering = 0;
+ aAny >>= nNumbering;
+ GetExport().GetMM100UnitConverter().convertNumFormat( sBuffer, nNumbering);
+ GetExport().AddAttribute(XML_NAMESPACE_STYLE, XML_NUM_FORMAT,
+ sBuffer.makeStringAndClear() );
+ GetExport().GetMM100UnitConverter().convertNumLetterSync( sBuffer, nNumbering);
+ if (sBuffer.getLength() )
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_STYLE, XML_NUM_LETTER_SYNC,
+ sBuffer.makeStringAndClear());
+ }
+
+ // StartAt / start-value
+ aAny = rFootnoteConfig->getPropertyValue(sStartAt);
+ sal_Int16 nOffset = 0;
+ aAny >>= nOffset;
+ SvXMLUnitConverter::convertNumber(sBuffer, (sal_Int32)nOffset);
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_START_VALUE,
+ sBuffer.makeStringAndClear());
+
+ // some properties are for footnotes only
+ if (!bIsEndnote)
+ {
+ // footnotes position
+ aAny = rFootnoteConfig->getPropertyValue(
+ sPositionEndOfDoc);
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_FOOTNOTES_POSITION,
+ ( (*(sal_Bool *)aAny.getValue()) ?
+ XML_DOCUMENT : XML_PAGE ) );
+
+ aAny = rFootnoteConfig->getPropertyValue(sFootnoteCounting);
+ sal_Int16 nTmp = 0;
+ aAny >>= nTmp;
+ enum XMLTokenEnum eElement;
+ switch (nTmp)
+ {
+ case FootnoteNumbering::PER_PAGE:
+ eElement = XML_PAGE;
+ break;
+ case FootnoteNumbering::PER_CHAPTER:
+ eElement = XML_CHAPTER;
+ break;
+ case FootnoteNumbering::PER_DOCUMENT:
+ default:
+ eElement = XML_DOCUMENT;
+ break;
+ }
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT,
+ XML_START_NUMBERING_AT, eElement);
+ }
+
+ // element
+ SvXMLElementExport aFootnoteConfigElement(
+ GetExport(), XML_NAMESPACE_TEXT,
+ XML_NOTES_CONFIGURATION,
+ sal_True, sal_True);
+
+ // two element for footnote content
+ if (!bIsEndnote)
+ {
+ OUString sTmp;
+
+ // end notice / quo vadis
+ aAny = rFootnoteConfig->getPropertyValue(sEndNotice);
+ aAny >>= sTmp;
+
+ if (sTmp.getLength() > 0)
+ {
+ SvXMLElementExport aElem(GetExport(), XML_NAMESPACE_TEXT,
+ XML_FOOTNOTE_CONTINUATION_NOTICE_FORWARD,
+ sal_True, sal_False);
+ GetExport().Characters(sTmp);
+ }
+
+ // begin notice / ergo sum
+ aAny = rFootnoteConfig->getPropertyValue(sBeginNotice);
+ aAny >>= sTmp;
+
+ if (sTmp.getLength() > 0)
+ {
+ SvXMLElementExport aElem(GetExport(), XML_NAMESPACE_TEXT,
+ XML_FOOTNOTE_CONTINUATION_NOTICE_BACKWARD,
+ sal_True, sal_False);
+ GetExport().Characters(sTmp);
+ }
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
new file mode 100644
index 000000000000..2a7abbf088ee
--- /dev/null
+++ b/xmloff/source/text/txtimp.cxx
@@ -0,0 +1,2959 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <vector>
+
+#include <boost/scoped_array.hpp>
+#include <boost/tuple/tuple.hpp>
+
+#include <tools/solar.h>
+#include <tools/debug.hxx>
+#ifndef _SVSTDARR_STRINGSDTOR_DECL
+#define _SVSTDARR_STRINGSDTOR
+#include <svl/svstdarr.hxx>
+#endif
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/text/XTextCursor.hpp>
+#include <com/sun/star/text/XChapterNumberingSupplier.hpp>
+#include <com/sun/star/text/XTextFramesSupplier.hpp>
+#include <com/sun/star/text/XTextGraphicObjectsSupplier.hpp>
+#include <com/sun/star/text/XTextEmbeddedObjectsSupplier.hpp>
+#include <com/sun/star/text/TextContentAnchorType.hpp>
+#include <com/sun/star/text/XTextFrame.hpp>
+#include <com/sun/star/text/XFormField.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/ucb/XAnyCompareFactory.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/txtstyli.hxx>
+#include <xmloff/families.hxx>
+#include <xmloff/xmlnumfi.hxx>
+#include <xmloff/xmlnumi.hxx>
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/xmlimppr.hxx>
+
+#include "txtparai.hxx"
+#include <xmloff/txtimp.hxx>
+#include <xmloff/txtprmap.hxx>
+#include "xmloff/txtimppr.hxx"
+#include <xmloff/xmlimp.hxx>
+#include "txtvfldi.hxx"
+#include "xmloff/i18nmap.hxx"
+#include "XMLTextListItemContext.hxx"
+#include "XMLTextListBlockContext.hxx"
+#include "XMLTextFrameContext.hxx"
+#include "XMLPropertyBackpatcher.hxx"
+#include "XMLTextFrameHyperlinkContext.hxx"
+#include "XMLSectionImportContext.hxx"
+#include "XMLIndexTOCContext.hxx"
+#include <xmloff/XMLFontStylesContext.hxx>
+#include <xmloff/ProgressBarHelper.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/XMLEventsImportContext.hxx>
+#include "XMLTrackedChangesImportContext.hxx"
+#include "XMLChangeImportContext.hxx"
+#include "XMLAutoMarkFileContext.hxx"
+
+#include "XMLCalculationSettingsContext.hxx"
+#include <xmloff/formsimp.hxx>
+#include "XMLNumberStylesImport.hxx"
+// XML import: reconstrution of assignment of paragraph style to outline levels (#i69629#)
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <txtlists.hxx>
+#include <xmloff/odffields.hxx>
+#include <comphelper/stlunosequence.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::com::sun::star::ucb::XAnyCompare;
+
+using namespace ::std;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::lang;
+using namespace ::xmloff::token;
+using ::com::sun::star::util::DateTime;
+using namespace ::com::sun::star::ucb;
+using namespace ::com::sun::star;
+using ::comphelper::UStringLess;
+
+
+
+static SvXMLTokenMapEntry aTextElemTokenMap[] =
+{
+ { XML_NAMESPACE_TEXT, XML_P, XML_TOK_TEXT_P },
+ { XML_NAMESPACE_TEXT, XML_H, XML_TOK_TEXT_H },
+ { XML_NAMESPACE_TEXT, XML_LIST, XML_TOK_TEXT_LIST },
+ { XML_NAMESPACE_DRAW, XML_FRAME, XML_TOK_TEXT_FRAME_PAGE },
+ { XML_NAMESPACE_DRAW, XML_A, XML_TOK_DRAW_A_PAGE },
+ { XML_NAMESPACE_TABLE,XML_TABLE, XML_TOK_TABLE_TABLE },
+ { XML_NAMESPACE_TEXT, XML_VARIABLE_DECLS, XML_TOK_TEXT_VARFIELD_DECLS },
+ { XML_NAMESPACE_TEXT, XML_USER_FIELD_DECLS, XML_TOK_TEXT_USERFIELD_DECLS },
+ { XML_NAMESPACE_TEXT, XML_SEQUENCE_DECLS, XML_TOK_TEXT_SEQUENCE_DECLS },
+ { XML_NAMESPACE_TEXT, XML_DDE_CONNECTION_DECLS, XML_TOK_TEXT_DDE_DECLS },
+ { XML_NAMESPACE_TEXT, XML_SECTION, XML_TOK_TEXT_SECTION },
+ { XML_NAMESPACE_TEXT, XML_TABLE_OF_CONTENT, XML_TOK_TEXT_TOC },
+ { XML_NAMESPACE_TEXT, XML_OBJECT_INDEX, XML_TOK_TEXT_OBJECT_INDEX },
+ { XML_NAMESPACE_TEXT, XML_TABLE_INDEX, XML_TOK_TEXT_TABLE_INDEX },
+ { XML_NAMESPACE_TEXT, XML_ILLUSTRATION_INDEX, XML_TOK_TEXT_ILLUSTRATION_INDEX },
+ { XML_NAMESPACE_TEXT, XML_USER_INDEX, XML_TOK_TEXT_USER_INDEX },
+ { XML_NAMESPACE_TEXT, XML_ALPHABETICAL_INDEX, XML_TOK_TEXT_ALPHABETICAL_INDEX },
+ { XML_NAMESPACE_TEXT, XML_BIBLIOGRAPHY, XML_TOK_TEXT_BIBLIOGRAPHY_INDEX },
+ { XML_NAMESPACE_TEXT, XML_INDEX_TITLE, XML_TOK_TEXT_INDEX_TITLE },
+ { XML_NAMESPACE_TEXT, XML_TRACKED_CHANGES, XML_TOK_TEXT_TRACKED_CHANGES },
+ { XML_NAMESPACE_TEXT, XML_CHANGE_START, XML_TOK_TEXT_CHANGE_START },
+ { XML_NAMESPACE_TEXT, XML_CHANGE_END, XML_TOK_TEXT_CHANGE_END },
+ { XML_NAMESPACE_TEXT, XML_CHANGE, XML_TOK_TEXT_CHANGE },
+ { XML_NAMESPACE_OFFICE, XML_FORMS, XML_TOK_TEXT_FORMS },
+ { XML_NAMESPACE_TABLE, XML_CALCULATION_SETTINGS, XML_TOK_TEXT_CALCULATION_SETTINGS },
+ { XML_NAMESPACE_TEXT, XML_ALPHABETICAL_INDEX_AUTO_MARK_FILE, XML_TOK_TEXT_AUTOMARK },
+ // --> FLR #i52127#
+ { XML_NAMESPACE_TEXT, XML_NUMBERED_PARAGRAPH, XML_TOK_TEXT_NUMBERED_PARAGRAPH },
+ // <--
+
+ XML_TOKEN_MAP_END
+};
+
+static SvXMLTokenMapEntry aTextPElemTokenMap[] =
+{
+ { XML_NAMESPACE_TEXT, XML_SPAN, XML_TOK_TEXT_SPAN },
+ { XML_NAMESPACE_TEXT, XML_TAB, XML_TOK_TEXT_TAB_STOP },
+ { XML_NAMESPACE_TEXT, XML_LINE_BREAK, XML_TOK_TEXT_LINE_BREAK },
+ { XML_NAMESPACE_TEXT, XML_SOFT_PAGE_BREAK, XML_TOK_TEXT_SOFT_PAGE_BREAK },
+ { XML_NAMESPACE_TEXT, XML_S, XML_TOK_TEXT_S },
+ { XML_NAMESPACE_TEXT, XML_A, XML_TOK_TEXT_HYPERLINK },
+ { XML_NAMESPACE_TEXT, XML_RUBY, XML_TOK_TEXT_RUBY },
+
+ { XML_NAMESPACE_TEXT, XML_NOTE, XML_TOK_TEXT_NOTE },
+ { XML_NAMESPACE_TEXT, XML_BOOKMARK, XML_TOK_TEXT_BOOKMARK },
+ { XML_NAMESPACE_TEXT, XML_BOOKMARK_START, XML_TOK_TEXT_BOOKMARK_START },
+ { XML_NAMESPACE_TEXT, XML_BOOKMARK_END, XML_TOK_TEXT_BOOKMARK_END },
+ { XML_NAMESPACE_TEXT, XML_REFERENCE_MARK, XML_TOK_TEXT_REFERENCE },
+ { XML_NAMESPACE_TEXT, XML_REFERENCE_MARK_START,
+ XML_TOK_TEXT_REFERENCE_START },
+ { XML_NAMESPACE_TEXT, XML_REFERENCE_MARK_END,
+ XML_TOK_TEXT_REFERENCE_END },
+
+ { XML_NAMESPACE_DRAW, XML_FRAME, XML_TOK_TEXT_FRAME },
+ { XML_NAMESPACE_DRAW, XML_A, XML_TOK_DRAW_A },
+
+ // index marks
+ { XML_NAMESPACE_TEXT, XML_TOC_MARK, XML_TOK_TEXT_TOC_MARK },
+ { XML_NAMESPACE_TEXT, XML_TOC_MARK_START, XML_TOK_TEXT_TOC_MARK_START },
+ { XML_NAMESPACE_TEXT, XML_TOC_MARK_END, XML_TOK_TEXT_TOC_MARK_END },
+ { XML_NAMESPACE_TEXT, XML_USER_INDEX_MARK, XML_TOK_TEXT_USER_INDEX_MARK },
+ { XML_NAMESPACE_TEXT, XML_USER_INDEX_MARK_START,
+ XML_TOK_TEXT_USER_INDEX_MARK_START },
+ { XML_NAMESPACE_TEXT, XML_USER_INDEX_MARK_END,
+ XML_TOK_TEXT_USER_INDEX_MARK_END },
+ { XML_NAMESPACE_TEXT, XML_ALPHABETICAL_INDEX_MARK,
+ XML_TOK_TEXT_ALPHA_INDEX_MARK },
+ { XML_NAMESPACE_TEXT, XML_ALPHABETICAL_INDEX_MARK_START,
+ XML_TOK_TEXT_ALPHA_INDEX_MARK_START },
+ { XML_NAMESPACE_TEXT, XML_ALPHABETICAL_INDEX_MARK_END,
+ XML_TOK_TEXT_ALPHA_INDEX_MARK_END },
+
+ // sender fields
+ { XML_NAMESPACE_TEXT, XML_SENDER_FIRSTNAME,XML_TOK_TEXT_SENDER_FIRSTNAME},
+ { XML_NAMESPACE_TEXT, XML_SENDER_LASTNAME, XML_TOK_TEXT_SENDER_LASTNAME },
+ { XML_NAMESPACE_TEXT, XML_SENDER_INITIALS, XML_TOK_TEXT_SENDER_INITIALS },
+ { XML_NAMESPACE_TEXT, XML_SENDER_TITLE, XML_TOK_TEXT_SENDER_TITLE },
+ { XML_NAMESPACE_TEXT, XML_SENDER_POSITION, XML_TOK_TEXT_SENDER_POSITION },
+ { XML_NAMESPACE_TEXT, XML_SENDER_EMAIL, XML_TOK_TEXT_SENDER_EMAIL },
+ { XML_NAMESPACE_TEXT, XML_SENDER_PHONE_PRIVATE,
+ XML_TOK_TEXT_SENDER_PHONE_PRIVATE },
+ { XML_NAMESPACE_TEXT, XML_SENDER_FAX, XML_TOK_TEXT_SENDER_FAX },
+ { XML_NAMESPACE_TEXT, XML_SENDER_COMPANY, XML_TOK_TEXT_SENDER_COMPANY },
+ { XML_NAMESPACE_TEXT, XML_SENDER_PHONE_WORK,
+ XML_TOK_TEXT_SENDER_PHONE_WORK },
+ { XML_NAMESPACE_TEXT, XML_SENDER_STREET, XML_TOK_TEXT_SENDER_STREET },
+ { XML_NAMESPACE_TEXT, XML_SENDER_CITY, XML_TOK_TEXT_SENDER_CITY },
+ { XML_NAMESPACE_TEXT, XML_SENDER_POSTAL_CODE,
+ XML_TOK_TEXT_SENDER_POSTAL_CODE },
+ { XML_NAMESPACE_TEXT, XML_SENDER_COUNTRY, XML_TOK_TEXT_SENDER_COUNTRY },
+ { XML_NAMESPACE_TEXT, XML_SENDER_STATE_OR_PROVINCE,
+ XML_TOK_TEXT_SENDER_STATE_OR_PROVINCE },
+
+ // misc. document fields
+ { XML_NAMESPACE_TEXT, XML_AUTHOR_NAME, XML_TOK_TEXT_AUTHOR_NAME },
+ { XML_NAMESPACE_TEXT, XML_AUTHOR_INITIALS, XML_TOK_TEXT_AUTHOR_INITIALS },
+ { XML_NAMESPACE_TEXT, XML_DATE, XML_TOK_TEXT_DATE },
+ { XML_NAMESPACE_TEXT, XML_TIME, XML_TOK_TEXT_TIME },
+ { XML_NAMESPACE_TEXT, XML_PAGE_NUMBER, XML_TOK_TEXT_PAGE_NUMBER },
+ { XML_NAMESPACE_TEXT, XML_PAGE_CONTINUATION_STRING,
+ XML_TOK_TEXT_PAGE_CONTINUATION_STRING },
+
+ // variable fields
+ { XML_NAMESPACE_TEXT, XML_VARIABLE_SET, XML_TOK_TEXT_VARIABLE_SET },
+ { XML_NAMESPACE_TEXT, XML_VARIABLE_GET, XML_TOK_TEXT_VARIABLE_GET },
+ { XML_NAMESPACE_TEXT, XML_VARIABLE_INPUT, XML_TOK_TEXT_VARIABLE_INPUT },
+ { XML_NAMESPACE_TEXT, XML_USER_FIELD_GET, XML_TOK_TEXT_USER_FIELD_GET },
+ { XML_NAMESPACE_TEXT, XML_USER_FIELD_INPUT,XML_TOK_TEXT_USER_FIELD_INPUT},
+ { XML_NAMESPACE_TEXT, XML_SEQUENCE, XML_TOK_TEXT_SEQUENCE },
+ { XML_NAMESPACE_TEXT, XML_EXPRESSION, XML_TOK_TEXT_EXPRESSION },
+ { XML_NAMESPACE_TEXT, XML_TEXT_INPUT, XML_TOK_TEXT_TEXT_INPUT },
+
+ // database fields
+ { XML_NAMESPACE_TEXT, XML_DATABASE_DISPLAY,
+ XML_TOK_TEXT_DATABASE_DISPLAY },
+ { XML_NAMESPACE_TEXT, XML_DATABASE_NEXT,
+ XML_TOK_TEXT_DATABASE_NEXT },
+ { XML_NAMESPACE_TEXT, XML_DATABASE_ROW_SELECT,
+ XML_TOK_TEXT_DATABASE_SELECT },
+ { XML_NAMESPACE_TEXT, XML_DATABASE_ROW_NUMBER,
+ XML_TOK_TEXT_DATABASE_ROW_NUMBER },
+ { XML_NAMESPACE_TEXT, XML_DATABASE_NAME, XML_TOK_TEXT_DATABASE_NAME },
+
+ // docinfo fields
+ { XML_NAMESPACE_TEXT, XML_INITIAL_CREATOR,
+ XML_TOK_TEXT_DOCUMENT_CREATION_AUTHOR },
+ { XML_NAMESPACE_TEXT, XML_DESCRIPTION, XML_TOK_TEXT_DOCUMENT_DESCRIPTION},
+ { XML_NAMESPACE_TEXT, XML_PRINTED_BY, XML_TOK_TEXT_DOCUMENT_PRINT_AUTHOR},
+ { XML_NAMESPACE_TEXT, XML_TITLE, XML_TOK_TEXT_DOCUMENT_TITLE },
+ { XML_NAMESPACE_TEXT, XML_SUBJECT, XML_TOK_TEXT_DOCUMENT_SUBJECT },
+ { XML_NAMESPACE_TEXT, XML_KEYWORDS, XML_TOK_TEXT_DOCUMENT_KEYWORDS },
+ { XML_NAMESPACE_TEXT, XML_CREATOR, XML_TOK_TEXT_DOCUMENT_SAVE_AUTHOR },
+ { XML_NAMESPACE_TEXT, XML_EDITING_CYCLES,
+ XML_TOK_TEXT_DOCUMENT_REVISION },
+ { XML_NAMESPACE_TEXT, XML_CREATION_DATE,
+ XML_TOK_TEXT_DOCUMENT_CREATION_DATE },
+ { XML_NAMESPACE_TEXT, XML_CREATION_TIME,
+ XML_TOK_TEXT_DOCUMENT_CREATION_TIME },
+ { XML_NAMESPACE_TEXT, XML_PRINT_DATE, XML_TOK_TEXT_DOCUMENT_PRINT_DATE },
+ { XML_NAMESPACE_TEXT, XML_PRINT_TIME, XML_TOK_TEXT_DOCUMENT_PRINT_TIME },
+ { XML_NAMESPACE_TEXT, XML_MODIFICATION_DATE,
+ XML_TOK_TEXT_DOCUMENT_SAVE_DATE },
+ { XML_NAMESPACE_TEXT, XML_MODIFICATION_TIME,
+ XML_TOK_TEXT_DOCUMENT_SAVE_TIME },
+ { XML_NAMESPACE_TEXT, XML_EDITING_DURATION,
+ XML_TOK_TEXT_DOCUMENT_EDIT_DURATION },
+ { XML_NAMESPACE_TEXT, XML_USER_DEFINED,
+ XML_TOK_TEXT_DOCUMENT_USER_DEFINED },
+
+ // misc fields
+ { XML_NAMESPACE_TEXT, XML_PLACEHOLDER, XML_TOK_TEXT_PLACEHOLDER },
+ { XML_NAMESPACE_TEXT, XML_HIDDEN_TEXT, XML_TOK_TEXT_HIDDEN_TEXT },
+ { XML_NAMESPACE_TEXT, XML_HIDDEN_PARAGRAPH,
+ XML_TOK_TEXT_HIDDEN_PARAGRAPH },
+ { XML_NAMESPACE_TEXT, XML_CONDITIONAL_TEXT,
+ XML_TOK_TEXT_CONDITIONAL_TEXT },
+ { XML_NAMESPACE_TEXT, XML_FILE_NAME, XML_TOK_TEXT_FILENAME },
+ { XML_NAMESPACE_TEXT, XML_CHAPTER, XML_TOK_TEXT_CHAPTER },
+ { XML_NAMESPACE_TEXT, XML_TEMPLATE_NAME, XML_TOK_TEXT_TEMPLATENAME },
+ { XML_NAMESPACE_TEXT, XML_PARAGRAPH_COUNT, XML_TOK_TEXT_PARAGRAPH_COUNT },
+ { XML_NAMESPACE_TEXT, XML_WORD_COUNT, XML_TOK_TEXT_WORD_COUNT },
+ { XML_NAMESPACE_TEXT, XML_TABLE_COUNT, XML_TOK_TEXT_TABLE_COUNT },
+ { XML_NAMESPACE_TEXT, XML_CHARACTER_COUNT, XML_TOK_TEXT_CHARACTER_COUNT },
+ { XML_NAMESPACE_TEXT, XML_IMAGE_COUNT, XML_TOK_TEXT_IMAGE_COUNT },
+ { XML_NAMESPACE_TEXT, XML_OBJECT_COUNT, XML_TOK_TEXT_OBJECT_COUNT },
+ { XML_NAMESPACE_TEXT, XML_PAGE_COUNT, XML_TOK_TEXT_PAGE_COUNT },
+ { XML_NAMESPACE_TEXT, XML_PAGE_VARIABLE_GET, XML_TOK_TEXT_GET_PAGE_VAR },
+ { XML_NAMESPACE_TEXT, XML_PAGE_VARIABLE_SET, XML_TOK_TEXT_SET_PAGE_VAR },
+ { XML_NAMESPACE_TEXT, XML_EXECUTE_MACRO, XML_TOK_TEXT_MACRO },
+ { XML_NAMESPACE_TEXT, XML_DDE_CONNECTION, XML_TOK_TEXT_DDE },
+ { XML_NAMESPACE_TEXT, XML_REFERENCE_REF, XML_TOK_TEXT_REFERENCE_REF },
+ { XML_NAMESPACE_TEXT, XML_BOOKMARK_REF, XML_TOK_TEXT_BOOKMARK_REF },
+ { XML_NAMESPACE_TEXT, XML_SEQUENCE_REF, XML_TOK_TEXT_SEQUENCE_REF },
+ { XML_NAMESPACE_TEXT, XML_NOTE_REF, XML_TOK_TEXT_NOTE_REF },
+ { XML_NAMESPACE_TEXT, XML_BIBLIOGRAPHY_MARK,
+ XML_TOK_TEXT_BIBLIOGRAPHY_MARK },
+ { XML_NAMESPACE_OFFICE, XML_ANNOTATION, XML_TOK_TEXT_ANNOTATION },
+ { XML_NAMESPACE_TEXT, XML_SCRIPT, XML_TOK_TEXT_SCRIPT },
+ { XML_NAMESPACE_TEXT, XML_TABLE_FORMULA, XML_TOK_TEXT_TABLE_FORMULA },
+ { XML_NAMESPACE_TEXT, XML_DROPDOWN, XML_TOK_TEXT_DROPDOWN },
+
+ // Calc fields
+ { XML_NAMESPACE_TEXT, XML_SHEET_NAME, XML_TOK_TEXT_SHEET_NAME },
+
+ // draw fields
+ { XML_NAMESPACE_TEXT, XML_MEASURE, XML_TOK_TEXT_MEASURE },
+
+ // RDF metadata
+ { XML_NAMESPACE_TEXT, XML_META, XML_TOK_TEXT_META },
+ { XML_NAMESPACE_TEXT, XML_META_FIELD, XML_TOK_TEXT_META_FIELD },
+
+ // redlining (aka change tracking)
+ { XML_NAMESPACE_TEXT, XML_CHANGE_START, XML_TOK_TEXTP_CHANGE_START },
+ { XML_NAMESPACE_TEXT, XML_CHANGE_END , XML_TOK_TEXTP_CHANGE_END },
+ { XML_NAMESPACE_TEXT, XML_CHANGE, XML_TOK_TEXTP_CHANGE },
+
+ { XML_NAMESPACE_PRESENTATION, XML_HEADER, XML_TOK_DRAW_HEADER },
+ { XML_NAMESPACE_PRESENTATION, XML_FOOTER, XML_TOK_DRAW_FOOTER },
+ { XML_NAMESPACE_PRESENTATION, XML_DATE_TIME, XML_TOK_DRAW_DATE_TIME },
+ { XML_NAMESPACE_TEXT, XML_PAGE_CONTINUATION, XML_TOK_TEXT_PAGE_CONTINUATION },
+
+ { XML_NAMESPACE_FIELD, XML_FIELDMARK, XML_TOK_TEXT_FIELDMARK },
+ { XML_NAMESPACE_FIELD, XML_FIELDMARK_START, XML_TOK_TEXT_FIELDMARK_START },
+ { XML_NAMESPACE_FIELD, XML_FIELDMARK_END, XML_TOK_TEXT_FIELDMARK_END },
+
+
+ XML_TOKEN_MAP_END
+};
+
+static SvXMLTokenMapEntry aTextPAttrTokenMap[] =
+{
+ { XML_NAMESPACE_XML , XML_ID, XML_TOK_TEXT_P_XMLID },
+ { XML_NAMESPACE_XHTML, XML_ABOUT, XML_TOK_TEXT_P_ABOUT },
+ { XML_NAMESPACE_XHTML, XML_PROPERTY, XML_TOK_TEXT_P_PROPERTY },
+ { XML_NAMESPACE_XHTML, XML_CONTENT, XML_TOK_TEXT_P_CONTENT },
+ { XML_NAMESPACE_XHTML, XML_DATATYPE, XML_TOK_TEXT_P_DATATYPE },
+ { XML_NAMESPACE_TEXT, XML_ID, XML_TOK_TEXT_P_TEXTID },
+ { XML_NAMESPACE_TEXT, XML_STYLE_NAME, XML_TOK_TEXT_P_STYLE_NAME },
+ { XML_NAMESPACE_TEXT, XML_COND_STYLE_NAME,
+ XML_TOK_TEXT_P_COND_STYLE_NAME },
+ { XML_NAMESPACE_TEXT, XML_OUTLINE_LEVEL,XML_TOK_TEXT_P_LEVEL },
+ { XML_NAMESPACE_TEXT, XML_IS_LIST_HEADER,XML_TOK_TEXT_P_IS_LIST_HEADER },
+ { XML_NAMESPACE_TEXT, XML_RESTART_NUMBERING,XML_TOK_TEXT_P_RESTART_NUMBERING },
+ { XML_NAMESPACE_TEXT, XML_START_VALUE,XML_TOK_TEXT_P_START_VALUE },
+ XML_TOKEN_MAP_END
+};
+
+static SvXMLTokenMapEntry aTextNumberedParagraphAttrTokenMap[] =
+{
+ { XML_NAMESPACE_XML , XML_ID, XML_TOK_TEXT_NUMBERED_PARAGRAPH_XMLID },
+ { XML_NAMESPACE_TEXT, XML_LIST_ID,
+ XML_TOK_TEXT_NUMBERED_PARAGRAPH_LIST_ID },
+ { XML_NAMESPACE_TEXT, XML_LEVEL, XML_TOK_TEXT_NUMBERED_PARAGRAPH_LEVEL },
+ { XML_NAMESPACE_TEXT, XML_STYLE_NAME,
+ XML_TOK_TEXT_NUMBERED_PARAGRAPH_STYLE_NAME },
+ { XML_NAMESPACE_TEXT, XML_CONTINUE_NUMBERING,
+ XML_TOK_TEXT_NUMBERED_PARAGRAPH_CONTINUE_NUMBERING },
+ { XML_NAMESPACE_TEXT, XML_START_VALUE,
+ XML_TOK_TEXT_NUMBERED_PARAGRAPH_START_VALUE },
+ XML_TOKEN_MAP_END
+};
+
+static SvXMLTokenMapEntry aTextListBlockAttrTokenMap[] =
+{
+ { XML_NAMESPACE_XML , XML_ID, XML_TOK_TEXT_LIST_BLOCK_XMLID },
+ { XML_NAMESPACE_TEXT, XML_STYLE_NAME,
+ XML_TOK_TEXT_LIST_BLOCK_STYLE_NAME },
+ { XML_NAMESPACE_TEXT, XML_CONTINUE_NUMBERING,
+ XML_TOK_TEXT_LIST_BLOCK_CONTINUE_NUMBERING },
+ { XML_NAMESPACE_TEXT, XML_CONTINUE_LIST,
+ XML_TOK_TEXT_LIST_BLOCK_CONTINUE_LIST },
+ XML_TOKEN_MAP_END
+};
+
+static SvXMLTokenMapEntry aTextListBlockElemTokenMap[] =
+{
+ { XML_NAMESPACE_TEXT, XML_LIST_HEADER, XML_TOK_TEXT_LIST_HEADER },
+ { XML_NAMESPACE_TEXT, XML_LIST_ITEM, XML_TOK_TEXT_LIST_ITEM },
+ XML_TOKEN_MAP_END
+};
+
+static SvXMLTokenMapEntry aTextFrameAttrTokenMap[] =
+{
+ { XML_NAMESPACE_DRAW, XML_STYLE_NAME, XML_TOK_TEXT_FRAME_STYLE_NAME },
+ { XML_NAMESPACE_DRAW, XML_NAME, XML_TOK_TEXT_FRAME_NAME },
+ { XML_NAMESPACE_TEXT, XML_ANCHOR_TYPE, XML_TOK_TEXT_FRAME_ANCHOR_TYPE },
+ { XML_NAMESPACE_TEXT, XML_ANCHOR_PAGE_NUMBER, XML_TOK_TEXT_FRAME_ANCHOR_PAGE_NUMBER },
+ { XML_NAMESPACE_SVG, XML_X, XML_TOK_TEXT_FRAME_X },
+ { XML_NAMESPACE_SVG, XML_Y, XML_TOK_TEXT_FRAME_Y },
+ { XML_NAMESPACE_SVG, XML_WIDTH, XML_TOK_TEXT_FRAME_WIDTH },
+ { XML_NAMESPACE_FO, XML_MIN_WIDTH, XML_TOK_TEXT_FRAME_MIN_WIDTH },
+ { XML_NAMESPACE_STYLE, XML_REL_WIDTH, XML_TOK_TEXT_FRAME_REL_WIDTH },
+ { XML_NAMESPACE_SVG, XML_HEIGHT, XML_TOK_TEXT_FRAME_HEIGHT },
+ { XML_NAMESPACE_FO, XML_MIN_HEIGHT, XML_TOK_TEXT_FRAME_MIN_HEIGHT },
+ { XML_NAMESPACE_STYLE, XML_REL_HEIGHT, XML_TOK_TEXT_FRAME_REL_HEIGHT },
+ { XML_NAMESPACE_DRAW, XML_CHAIN_NEXT_NAME, XML_TOK_TEXT_FRAME_NEXT_CHAIN_NAME },
+ { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_TEXT_FRAME_HREF },
+ { XML_NAMESPACE_DRAW, XML_NAME, XML_TOK_TEXT_FRAME_FILTER_NAME },
+ { XML_NAMESPACE_DRAW, XML_ZINDEX, XML_TOK_TEXT_FRAME_Z_INDEX },
+ { XML_NAMESPACE_SVG, XML_TRANSFORM, XML_TOK_TEXT_FRAME_TRANSFORM },
+ { XML_NAMESPACE_DRAW, XML_CLASS_ID, XML_TOK_TEXT_FRAME_CLASS_ID },
+ { XML_NAMESPACE_DRAW, XML_CODE, XML_TOK_TEXT_FRAME_CODE },
+ { XML_NAMESPACE_DRAW, XML_OBJECT, XML_TOK_TEXT_FRAME_OBJECT },
+ { XML_NAMESPACE_DRAW, XML_ARCHIVE, XML_TOK_TEXT_FRAME_ARCHIVE },
+ { XML_NAMESPACE_DRAW, XML_MAY_SCRIPT, XML_TOK_TEXT_FRAME_MAY_SCRIPT },
+ { XML_NAMESPACE_DRAW, XML_MIME_TYPE, XML_TOK_TEXT_FRAME_MIME_TYPE },
+ { XML_NAMESPACE_DRAW, XML_APPLET_NAME, XML_TOK_TEXT_FRAME_APPLET_NAME },
+ { XML_NAMESPACE_DRAW, XML_FRAME_NAME, XML_TOK_TEXT_FRAME_FRAME_NAME },
+ { XML_NAMESPACE_DRAW, XML_NOTIFY_ON_UPDATE_OF_RANGES, XML_TOK_TEXT_FRAME_NOTIFY_ON_UPDATE },
+ { XML_NAMESPACE_DRAW, XML_NOTIFY_ON_UPDATE_OF_TABLE, XML_TOK_TEXT_FRAME_NOTIFY_ON_UPDATE },
+ XML_TOKEN_MAP_END
+};
+
+static SvXMLTokenMapEntry aTextContourAttrTokenMap[] =
+{
+ { XML_NAMESPACE_SVG, XML_WIDTH, XML_TOK_TEXT_CONTOUR_WIDTH },
+ { XML_NAMESPACE_SVG, XML_HEIGHT, XML_TOK_TEXT_CONTOUR_HEIGHT },
+ { XML_NAMESPACE_SVG, XML_VIEWBOX, XML_TOK_TEXT_CONTOUR_VIEWBOX },
+ { XML_NAMESPACE_SVG, XML_D, XML_TOK_TEXT_CONTOUR_D },
+ { XML_NAMESPACE_DRAW,XML_POINTS, XML_TOK_TEXT_CONTOUR_POINTS },
+ { XML_NAMESPACE_DRAW,XML_RECREATE_ON_EDIT, XML_TOK_TEXT_CONTOUR_AUTO },
+ XML_TOKEN_MAP_END
+};
+
+static SvXMLTokenMapEntry aTextHyperlinkAttrTokenMap[] =
+{
+ { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_TEXT_HYPERLINK_HREF },
+ { XML_NAMESPACE_OFFICE, XML_NAME, XML_TOK_TEXT_HYPERLINK_NAME },
+ { XML_NAMESPACE_XLINK, XML_SHOW, XML_TOK_TEXT_HYPERLINK_SHOW },
+ { XML_NAMESPACE_OFFICE, XML_TARGET_FRAME_NAME, XML_TOK_TEXT_HYPERLINK_TARGET_FRAME },
+ { XML_NAMESPACE_TEXT, XML_STYLE_NAME, XML_TOK_TEXT_HYPERLINK_STYLE_NAME },
+ { XML_NAMESPACE_TEXT, XML_VISITED_STYLE_NAME, XML_TOK_TEXT_HYPERLINK_VIS_STYLE_NAME },
+ { XML_NAMESPACE_OFFICE, XML_SERVER_MAP, XML_TOK_TEXT_HYPERLINK_SERVER_MAP },
+ XML_TOKEN_MAP_END
+};
+
+static SvXMLTokenMapEntry aTextMasterPageElemTokenMap[] =
+{
+ { XML_NAMESPACE_STYLE, XML_HEADER, XML_TOK_TEXT_MP_HEADER },
+ { XML_NAMESPACE_STYLE, XML_FOOTER, XML_TOK_TEXT_MP_FOOTER },
+ { XML_NAMESPACE_STYLE, XML_HEADER_LEFT, XML_TOK_TEXT_MP_HEADER_LEFT },
+ { XML_NAMESPACE_STYLE, XML_FOOTER_LEFT, XML_TOK_TEXT_MP_FOOTER_LEFT },
+
+ XML_TOKEN_MAP_END
+};
+
+static SvXMLTokenMapEntry aTextFieldAttrTokenMap[] =
+{
+ { XML_NAMESPACE_TEXT, XML_FIXED, XML_TOK_TEXTFIELD_FIXED },
+ { XML_NAMESPACE_TEXT, XML_DESCRIPTION, XML_TOK_TEXTFIELD_DESCRIPTION },
+ { XML_NAMESPACE_TEXT, XML_HELP, XML_TOK_TEXTFIELD_HELP },
+ { XML_NAMESPACE_TEXT, XML_HINT, XML_TOK_TEXTFIELD_HINT },
+ { XML_NAMESPACE_TEXT, XML_PLACEHOLDER_TYPE,
+ XML_TOK_TEXTFIELD_PLACEHOLDER_TYPE },
+ { XML_NAMESPACE_TEXT, XML_NAME, XML_TOK_TEXTFIELD_NAME },
+ { XML_NAMESPACE_TEXT, XML_FORMULA, XML_TOK_TEXTFIELD_FORMULA },
+ { XML_NAMESPACE_STYLE, XML_NUM_FORMAT, XML_TOK_TEXTFIELD_NUM_FORMAT },
+ { XML_NAMESPACE_STYLE, XML_NUM_LETTER_SYNC,
+ XML_TOK_TEXTFIELD_NUM_LETTER_SYNC },
+ { XML_NAMESPACE_TEXT, XML_DISPLAY_FORMULA,
+ XML_TOK_TEXTFIELD_DISPLAY_FORMULA },
+ { XML_NAMESPACE_TEXT, XML_VALUE_TYPE, XML_TOK_TEXTFIELD_VALUE_TYPE }, // #i32362#: src680m48++ saves text:value-type
+ { XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_TOK_TEXTFIELD_VALUE_TYPE },
+ { XML_NAMESPACE_TEXT, XML_VALUE, XML_TOK_TEXTFIELD_VALUE },
+ { XML_NAMESPACE_OFFICE, XML_VALUE, XML_TOK_TEXTFIELD_VALUE },
+ { XML_NAMESPACE_TEXT, XML_STRING_VALUE, XML_TOK_TEXTFIELD_STRING_VALUE },
+ { XML_NAMESPACE_OFFICE, XML_STRING_VALUE, XML_TOK_TEXTFIELD_STRING_VALUE },
+ { XML_NAMESPACE_TEXT, XML_DATE_VALUE, XML_TOK_TEXTFIELD_DATE_VALUE },
+ { XML_NAMESPACE_OFFICE, XML_DATE_VALUE, XML_TOK_TEXTFIELD_DATE_VALUE },
+ { XML_NAMESPACE_TEXT, XML_TIME_VALUE, XML_TOK_TEXTFIELD_TIME_VALUE },
+ { XML_NAMESPACE_OFFICE, XML_TIME_VALUE, XML_TOK_TEXTFIELD_TIME_VALUE },
+ { XML_NAMESPACE_OFFICE, XML_BOOLEAN_VALUE, XML_TOK_TEXTFIELD_BOOL_VALUE},
+ { XML_NAMESPACE_OFFICE, XML_CURRENCY, XML_TOK_TEXTFIELD_CURRENCY},
+ { XML_NAMESPACE_STYLE, XML_DATA_STYLE_NAME,
+ XML_TOK_TEXTFIELD_DATA_STYLE_NAME },
+ { XML_NAMESPACE_TEXT, XML_DISPLAY_OUTLINE_LEVEL,
+ XML_TOK_TEXTFIELD_NUMBERING_LEVEL },
+ { XML_NAMESPACE_TEXT, XML_SEPARATION_CHARACTER,
+ XML_TOK_TEXTFIELD_NUMBERING_SEPARATOR },
+ { XML_NAMESPACE_TEXT, XML_DISPLAY, XML_TOK_TEXTFIELD_DISPLAY },
+ { XML_NAMESPACE_TEXT, XML_TIME_ADJUST, XML_TOK_TEXTFIELD_TIME_ADJUST },
+ { XML_NAMESPACE_TEXT, XML_DATE_ADJUST, XML_TOK_TEXTFIELD_DATE_ADJUST },
+ { XML_NAMESPACE_TEXT, XML_PAGE_ADJUST, XML_TOK_TEXTFIELD_PAGE_ADJUST },
+ { XML_NAMESPACE_TEXT, XML_SELECT_PAGE, XML_TOK_TEXTFIELD_SELECT_PAGE },
+ { XML_NAMESPACE_TEXT, XML_DATABASE_NAME, XML_TOK_TEXTFIELD_DATABASE_NAME},
+ { XML_NAMESPACE_TEXT, XML_TABLE_NAME, XML_TOK_TEXTFIELD_TABLE_NAME },
+ { XML_NAMESPACE_TEXT, XML_COLUMN_NAME, XML_TOK_TEXTFIELD_COLUMN_NAME },
+ { XML_NAMESPACE_TEXT, XML_ROW_NUMBER, XML_TOK_TEXTFIELD_ROW_NUMBER },
+ { XML_NAMESPACE_TEXT, XML_CONDITION, XML_TOK_TEXTFIELD_CONDITION },
+ { XML_NAMESPACE_TEXT, XML_STRING_VALUE_IF_TRUE,
+ XML_TOK_TEXTFIELD_STRING_VALUE_IF_TRUE },
+ { XML_NAMESPACE_TEXT, XML_STRING_VALUE_IF_FALSE,
+ XML_TOK_TEXTFIELD_STRING_VALUE_IF_FALSE },
+ { XML_NAMESPACE_TEXT, XML_EDITING_CYCLES, XML_TOK_TEXTFIELD_REVISION },
+ { XML_NAMESPACE_TEXT, XML_OUTLINE_LEVEL, XML_TOK_TEXTFIELD_OUTLINE_LEVEL},
+ { XML_NAMESPACE_TEXT, XML_ACTIVE, XML_TOK_TEXTFIELD_ACTIVE },
+ { XML_NAMESPACE_TEXT, XML_NOTE_CLASS, XML_TOK_TEXTFIELD_NOTE_CLASS },
+ { XML_NAMESPACE_TEXT, XML_REFERENCE_FORMAT,
+ XML_TOK_TEXTFIELD_REFERENCE_FORMAT },
+ { XML_NAMESPACE_TEXT, XML_REF_NAME, XML_TOK_TEXTFIELD_REF_NAME },
+ { XML_NAMESPACE_TEXT, XML_CONNECTION_NAME,
+ XML_TOK_TEXTFIELD_CONNECTION_NAME },
+ { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_TEXTFIELD_HREF },
+ { XML_NAMESPACE_OFFICE, XML_TARGET_FRAME_NAME,
+ XML_TOK_TEXTFIELD_TARGET_FRAME },
+ { XML_NAMESPACE_TEXT, XML_ANNOTATION, XML_TOK_TEXTFIELD_ANNOTATION },
+ { XML_NAMESPACE_SCRIPT, XML_LANGUAGE, XML_TOK_TEXTFIELD_LANGUAGE },
+ { XML_NAMESPACE_TEXT, XML_KIND, XML_TOK_TEXTFIELD_MEASURE_KIND },
+ { XML_NAMESPACE_TEXT, XML_IS_HIDDEN, XML_TOK_TEXTFIELD_IS_HIDDEN },
+ { XML_NAMESPACE_TEXT, XML_CURRENT_VALUE,
+ XML_TOK_TEXTFIELD_CURRENT_VALUE },
+ { XML_NAMESPACE_TEXT, XML_TABLE_TYPE, XML_TOK_TEXTFIELD_TABLE_TYPE },
+
+ XML_TOKEN_MAP_END
+};
+
+
+// maximum allowed length of combined characters field
+#define MAX_COMBINED_CHARACTERS 6
+
+struct SAL_DLLPRIVATE XMLTextImportHelper::Impl
+ : private ::boost::noncopyable
+{
+ ::std::auto_ptr<SvXMLTokenMap> m_pTextElemTokenMap;
+ ::std::auto_ptr<SvXMLTokenMap> m_pTextPElemTokenMap;
+ ::std::auto_ptr<SvXMLTokenMap> m_pTextPAttrTokenMap;
+ ::std::auto_ptr<SvXMLTokenMap> m_pTextFieldAttrTokenMap;
+ ::std::auto_ptr<SvXMLTokenMap> m_pTextNumberedParagraphAttrTokenMap;
+ ::std::auto_ptr<SvXMLTokenMap> m_pTextListBlockAttrTokenMap;
+ ::std::auto_ptr<SvXMLTokenMap> m_pTextListBlockElemTokenMap;
+ ::std::auto_ptr<SvXMLTokenMap> m_pTextFrameAttrTokenMap;
+ ::std::auto_ptr<SvXMLTokenMap> m_pTextContourAttrTokenMap;
+ ::std::auto_ptr<SvXMLTokenMap> m_pTextHyperlinkAttrTokenMap;
+ ::std::auto_ptr<SvXMLTokenMap> m_pTextMasterPageElemTokenMap;
+ ::std::auto_ptr<SvStringsDtor> m_pPrevFrmNames;
+ ::std::auto_ptr<SvStringsDtor> m_pNextFrmNames;
+ ::std::auto_ptr<XMLTextListsHelper> m_pTextListsHelper;
+
+ SvXMLImportContextRef m_xAutoStyles;
+ SvXMLImportContextRef m_xFontDecls;
+
+ UniReference< SvXMLImportPropertyMapper > m_xParaImpPrMap;
+ UniReference< SvXMLImportPropertyMapper > m_xTextImpPrMap;
+ UniReference< SvXMLImportPropertyMapper > m_xFrameImpPrMap;
+ UniReference< SvXMLImportPropertyMapper > m_xSectionImpPrMap;
+ UniReference< SvXMLImportPropertyMapper > m_xRubyImpPrMap;
+
+ ::std::auto_ptr<SvI18NMap> m_pRenameMap;
+ /* Change and extend data structure:
+ - data structure contains candidates of paragraph styles, which
+ will be assigned to the outline style
+ - data structure contains more than one candidate for each list level
+ of the outline style (#i69629#)
+ */
+ ::boost::scoped_array< ::std::vector< ::rtl::OUString > >
+ m_pOutlineStylesCandidates;
+
+ // start range, xml:id, RDFa stuff
+ typedef ::boost::tuple<
+ uno::Reference<text::XTextRange>, ::rtl::OUString,
+ ::boost::shared_ptr< ::xmloff::ParsedRDFaAttributes > >
+ BookmarkMapEntry_t;
+ /// start ranges for open bookmarks
+ ::std::map< ::rtl::OUString, BookmarkMapEntry_t,
+ ::comphelper::UStringLess> m_BookmarkStartRanges;
+
+ typedef ::std::vector< ::rtl::OUString > BookmarkVector_t;
+ BookmarkVector_t m_BookmarkVector;
+
+ /// name of the last 'open' redline that started between paragraphs
+ ::rtl::OUString m_sOpenRedlineIdentifier;
+
+ uno::Reference<text::XText> m_xText;
+ uno::Reference<text::XTextCursor> m_xCursor;
+ uno::Reference<text::XTextRange> m_xCursorAsRange;
+ uno::Reference<container::XNameContainer> m_xParaStyles;
+ uno::Reference<container::XNameContainer> m_xTextStyles;
+ uno::Reference<container::XNameContainer> m_xNumStyles;
+ uno::Reference<container::XNameContainer> m_xFrameStyles;
+ uno::Reference<container::XNameContainer> m_xPageStyles;
+ uno::Reference<container::XIndexReplace> m_xChapterNumbering;
+ uno::Reference<container::XNameAccess> m_xTextFrames;
+ uno::Reference<container::XNameAccess> m_xGraphics;
+ uno::Reference<container::XNameAccess> m_xObjects;
+ uno::Reference<lang::XMultiServiceFactory> m_xServiceFactory;
+
+ SvXMLImport & m_rSvXMLImport;
+
+ bool m_bInsertMode : 1;
+ bool m_bStylesOnlyMode : 1;
+ bool m_bBlockMode : 1;
+ bool m_bProgress : 1;
+ bool m_bOrganizerMode : 1;
+ bool m_bBodyContentStarted : 1;
+
+ // #107848#
+ // One more flag to remember if we are inside a deleted redline section
+ bool m_bInsideDeleteContext : 1;
+
+ typedef ::std::pair< ::rtl::OUString, ::rtl::OUString> field_name_type_t;
+ typedef ::std::pair< ::rtl::OUString, ::rtl::OUString > field_param_t;
+ typedef ::std::vector< field_param_t > field_params_t;
+ typedef ::std::pair< field_name_type_t, field_params_t > field_stack_item_t;
+ typedef ::std::stack< field_stack_item_t > field_stack_t;
+
+ field_stack_t m_FieldStack;
+
+ ::rtl::OUString m_sCellParaStyleDefault;
+
+ Impl( uno::Reference<frame::XModel> const& rModel,
+ SvXMLImport & rImport,
+ bool const bInsertMode, bool const bStylesOnlyMode,
+ bool const bProgress, bool const bBlockMode,
+ bool const bOrganizerMode)
+ : m_pTextElemTokenMap( 0 )
+ , m_pTextPElemTokenMap( 0 )
+ , m_pTextPAttrTokenMap( 0 )
+ , m_pTextFieldAttrTokenMap( 0 )
+ , m_pTextNumberedParagraphAttrTokenMap( 0 )
+ , m_pTextListBlockAttrTokenMap( 0 )
+ , m_pTextListBlockElemTokenMap( 0 )
+ , m_pTextFrameAttrTokenMap( 0 )
+ , m_pTextContourAttrTokenMap( 0 )
+ , m_pTextHyperlinkAttrTokenMap( 0 )
+ , m_pTextMasterPageElemTokenMap( 0 )
+ , m_pPrevFrmNames( 0 )
+ , m_pNextFrmNames( 0 )
+ , m_pTextListsHelper( new XMLTextListsHelper() )
+ , m_pRenameMap( 0 )
+ // XML import: reconstrution of assignment of paragraph style to outline levels (#i69629#)
+ , m_pOutlineStylesCandidates( 0 )
+ , m_xServiceFactory( rModel, UNO_QUERY )
+ , m_rSvXMLImport( rImport )
+ , m_bInsertMode( bInsertMode )
+ , m_bStylesOnlyMode( bStylesOnlyMode )
+ , m_bBlockMode( bBlockMode )
+ , m_bProgress( bProgress )
+ , m_bOrganizerMode( bOrganizerMode )
+ , m_bBodyContentStarted( true )
+ // #107848# Initialize inside_deleted_section flag correctly
+ , m_bInsideDeleteContext( false )
+ {
+ }
+
+ void InitOutlineStylesCandidates()
+ {
+ if (!m_pOutlineStylesCandidates)
+ {
+ size_t const size(m_xChapterNumbering->getCount());
+ m_pOutlineStylesCandidates.reset(
+ new ::std::vector< ::rtl::OUString >[size] );
+ }
+ }
+
+};
+
+
+uno::Reference< text::XText > & XMLTextImportHelper::GetText()
+{
+ return m_pImpl->m_xText;
+}
+
+uno::Reference< text::XTextCursor > & XMLTextImportHelper::GetCursor()
+{
+ return m_pImpl->m_xCursor;
+}
+
+uno::Reference< text::XTextRange > & XMLTextImportHelper::GetCursorAsRange()
+{
+ return m_pImpl->m_xCursorAsRange;
+}
+
+bool XMLTextImportHelper::IsInsertMode() const
+{
+ return m_pImpl->m_bInsertMode;
+}
+
+bool XMLTextImportHelper::IsStylesOnlyMode() const
+{
+ return m_pImpl->m_bStylesOnlyMode;
+}
+
+bool XMLTextImportHelper::IsBlockMode() const
+{
+ return m_pImpl->m_bBlockMode;
+}
+
+bool XMLTextImportHelper::IsOrganizerMode() const
+{
+ return m_pImpl->m_bOrganizerMode;
+}
+
+bool XMLTextImportHelper::IsProgress() const
+{
+ return m_pImpl->m_bProgress;
+}
+
+uno::Reference<container::XNameContainer> const&
+XMLTextImportHelper::GetParaStyles() const
+{
+ return m_pImpl->m_xParaStyles;
+}
+
+uno::Reference<container::XNameContainer> const&
+XMLTextImportHelper::GetTextStyles() const
+{
+ return m_pImpl->m_xTextStyles;
+}
+
+uno::Reference<container::XNameContainer> const&
+XMLTextImportHelper::GetNumberingStyles() const
+{
+ return m_pImpl->m_xNumStyles;
+}
+
+uno::Reference<container::XNameContainer> const&
+XMLTextImportHelper::GetFrameStyles() const
+{
+ return m_pImpl->m_xFrameStyles;
+}
+
+uno::Reference<container::XNameContainer> const&
+XMLTextImportHelper::GetPageStyles() const
+{
+ return m_pImpl->m_xPageStyles;
+}
+
+uno::Reference<container::XIndexReplace> const&
+XMLTextImportHelper::GetChapterNumbering() const
+{
+ return m_pImpl->m_xChapterNumbering;
+}
+
+UniReference< SvXMLImportPropertyMapper > const&
+XMLTextImportHelper::GetParaImportPropertySetMapper() const
+{
+ return m_pImpl->m_xParaImpPrMap;
+}
+
+UniReference< SvXMLImportPropertyMapper > const&
+XMLTextImportHelper::GetTextImportPropertySetMapper() const
+{
+ return m_pImpl->m_xTextImpPrMap;
+}
+
+UniReference< SvXMLImportPropertyMapper > const&
+XMLTextImportHelper::GetFrameImportPropertySetMapper() const
+{
+ return m_pImpl->m_xFrameImpPrMap;
+}
+
+UniReference< SvXMLImportPropertyMapper > const&
+XMLTextImportHelper::GetSectionImportPropertySetMapper() const
+{
+ return m_pImpl->m_xSectionImpPrMap;
+}
+
+UniReference< SvXMLImportPropertyMapper > const&
+XMLTextImportHelper::GetRubyImportPropertySetMapper() const
+{
+ return m_pImpl->m_xRubyImpPrMap;
+}
+
+void XMLTextImportHelper::SetInsideDeleteContext(bool const bNew)
+{
+ m_pImpl->m_bInsideDeleteContext = bNew;
+}
+
+bool XMLTextImportHelper::IsInsideDeleteContext() const
+{
+ return m_pImpl->m_bInsideDeleteContext;
+}
+
+SvXMLImport & XMLTextImportHelper::GetXMLImport()
+{
+ return m_pImpl->m_rSvXMLImport;
+}
+
+XMLTextListsHelper & XMLTextImportHelper::GetTextListHelper()
+{
+ return *m_pImpl->m_pTextListsHelper;
+}
+
+const SvXMLTokenMap& XMLTextImportHelper::GetTextElemTokenMap()
+{
+ if (!m_pImpl->m_pTextElemTokenMap.get())
+ {
+ m_pImpl->m_pTextElemTokenMap.reset(
+ new SvXMLTokenMap( aTextElemTokenMap ));
+ }
+ return *m_pImpl->m_pTextElemTokenMap;
+}
+
+const SvXMLTokenMap& XMLTextImportHelper::GetTextPElemTokenMap()
+{
+ if (!m_pImpl->m_pTextPElemTokenMap.get())
+ {
+ m_pImpl->m_pTextPElemTokenMap.reset(
+ new SvXMLTokenMap( aTextPElemTokenMap ));
+ }
+ return *m_pImpl->m_pTextPElemTokenMap;
+}
+
+const SvXMLTokenMap& XMLTextImportHelper::GetTextPAttrTokenMap()
+{
+ if (!m_pImpl->m_pTextPAttrTokenMap.get())
+ {
+ m_pImpl->m_pTextPAttrTokenMap.reset(
+ new SvXMLTokenMap( aTextPAttrTokenMap ));
+ }
+ return *m_pImpl->m_pTextPAttrTokenMap;
+}
+
+const SvXMLTokenMap& XMLTextImportHelper::GetTextFrameAttrTokenMap()
+{
+ if (!m_pImpl->m_pTextFrameAttrTokenMap.get())
+ {
+ m_pImpl->m_pTextFrameAttrTokenMap.reset(
+ new SvXMLTokenMap( aTextFrameAttrTokenMap ));
+ }
+ return *m_pImpl->m_pTextFrameAttrTokenMap;
+}
+
+const SvXMLTokenMap& XMLTextImportHelper::GetTextContourAttrTokenMap()
+{
+ if (!m_pImpl->m_pTextContourAttrTokenMap.get())
+ {
+ m_pImpl->m_pTextContourAttrTokenMap.reset(
+ new SvXMLTokenMap( aTextContourAttrTokenMap ));
+ }
+ return *m_pImpl->m_pTextContourAttrTokenMap;
+}
+
+const SvXMLTokenMap& XMLTextImportHelper::GetTextHyperlinkAttrTokenMap()
+{
+ if (!m_pImpl->m_pTextHyperlinkAttrTokenMap.get())
+ {
+ m_pImpl->m_pTextHyperlinkAttrTokenMap.reset(
+ new SvXMLTokenMap( aTextHyperlinkAttrTokenMap ));
+ }
+ return *m_pImpl->m_pTextHyperlinkAttrTokenMap;
+}
+
+const SvXMLTokenMap& XMLTextImportHelper::GetTextMasterPageElemTokenMap()
+{
+ if (!m_pImpl->m_pTextMasterPageElemTokenMap.get())
+ {
+ m_pImpl->m_pTextMasterPageElemTokenMap.reset(
+ new SvXMLTokenMap( aTextMasterPageElemTokenMap ));
+ }
+ return *m_pImpl->m_pTextMasterPageElemTokenMap;
+}
+
+const SvXMLTokenMap& XMLTextImportHelper::GetTextFieldAttrTokenMap()
+{
+ if (!m_pImpl->m_pTextFieldAttrTokenMap.get())
+ {
+ m_pImpl->m_pTextFieldAttrTokenMap.reset(
+ new SvXMLTokenMap( aTextFieldAttrTokenMap ));
+ }
+ return *m_pImpl->m_pTextFieldAttrTokenMap;
+}
+
+
+namespace
+{
+ class FieldParamImporter
+ {
+ public:
+ typedef pair<OUString,OUString> field_param_t;
+ typedef vector<field_param_t> field_params_t;
+ FieldParamImporter(const field_params_t* const pInParams, Reference<XNameContainer> xOutParams)
+ : m_pInParams(pInParams)
+ , m_xOutParams(xOutParams)
+ { };
+ void Import();
+
+ private:
+ const field_params_t* const m_pInParams;
+ Reference<XNameContainer> m_xOutParams;
+ };
+
+ void FieldParamImporter::Import()
+ {
+ ::std::vector<OUString> vListEntries;
+ ::std::map<OUString, Any> vOutParams;
+ for(field_params_t::const_iterator pCurrent = m_pInParams->begin();
+ pCurrent != m_pInParams->end();
+ ++pCurrent)
+ {
+ if(pCurrent->first.equalsAscii(ODF_FORMDROPDOWN_RESULT))
+ {
+ // sal_Int32
+ vOutParams[pCurrent->first] = makeAny(pCurrent->second.toInt32());
+ }
+ else if(pCurrent->first.equalsAscii(ODF_FORMCHECKBOX_RESULT))
+ {
+ // bool
+ vOutParams[pCurrent->first] = makeAny(pCurrent->second.toBoolean());
+ }
+ else if(pCurrent->first.equalsAscii(ODF_FORMDROPDOWN_LISTENTRY))
+ {
+ // sequence
+ vListEntries.push_back(pCurrent->second);
+ }
+ else
+ vOutParams[pCurrent->first] = makeAny(pCurrent->second);
+ }
+ if(!vListEntries.empty())
+ {
+ Sequence<OUString> vListEntriesSeq(vListEntries.size());
+ copy(vListEntries.begin(), vListEntries.end(), ::comphelper::stl_begin(vListEntriesSeq));
+ vOutParams[OUString(RTL_CONSTASCII_USTRINGPARAM(ODF_FORMDROPDOWN_LISTENTRY))] = makeAny(vListEntriesSeq);
+ }
+ for(::std::map<OUString, Any>::const_iterator pCurrent = vOutParams.begin();
+ pCurrent != vOutParams.end();
+ ++pCurrent)
+ {
+ try
+ {
+ m_xOutParams->insertByName(pCurrent->first, pCurrent->second);
+ }
+ catch(ElementExistException)
+ { }
+ }
+ }
+}
+
+XMLTextImportHelper::XMLTextImportHelper(
+ uno::Reference<frame::XModel> const& rModel,
+ SvXMLImport& rImport,
+ bool const bInsertMode, bool const bStylesOnlyMode,
+ bool const bProgress, bool const bBlockMode,
+ bool const bOrganizerMode)
+ : m_pImpl( new Impl(rModel, rImport, bInsertMode, bStylesOnlyMode,
+ bProgress, bBlockMode, bOrganizerMode) )
+ , m_pBackpatcherImpl( MakeBackpatcherImpl() )
+{
+ static ::rtl::OUString s_PropNameDefaultListId(
+ RTL_CONSTASCII_USTRINGPARAM("DefaultListId"));
+
+ Reference< XChapterNumberingSupplier > xCNSupplier( rModel, UNO_QUERY );
+
+ if( xCNSupplier.is() )
+ {
+ m_pImpl->m_xChapterNumbering = xCNSupplier->getChapterNumberingRules();
+ if (m_pImpl->m_xChapterNumbering.is())
+ {
+ Reference< XPropertySet > const xNumRuleProps(
+ m_pImpl->m_xChapterNumbering, UNO_QUERY);
+ if ( xNumRuleProps.is() )
+ {
+ Reference< XPropertySetInfo > xNumRulePropSetInfo(
+ xNumRuleProps->getPropertySetInfo());
+ if (xNumRulePropSetInfo.is() &&
+ xNumRulePropSetInfo->hasPropertyByName(
+ s_PropNameDefaultListId))
+ {
+ ::rtl::OUString sListId;
+ xNumRuleProps->getPropertyValue(s_PropNameDefaultListId)
+ >>= sListId;
+ DBG_ASSERT( sListId.getLength() != 0,
+ "no default list id found at chapter numbering rules instance. Serious defect -> please inform OD." );
+ if ( sListId.getLength() )
+ {
+ Reference< XNamed > const xChapterNumNamed(
+ m_pImpl->m_xChapterNumbering, UNO_QUERY);
+ if ( xChapterNumNamed.is() )
+ {
+ m_pImpl->m_pTextListsHelper->KeepListAsProcessed(
+ sListId,
+ xChapterNumNamed->getName(),
+ ::rtl::OUString() );
+ }
+ }
+ }
+ }
+ }
+ }
+
+ Reference< XStyleFamiliesSupplier > xFamiliesSupp( rModel, UNO_QUERY );
+// DBG_ASSERT( xFamiliesSupp.is(), "no chapter numbering supplier" ); for clipboard there may be documents without styles
+
+ if( xFamiliesSupp.is() )
+ {
+ Reference< XNameAccess > xFamilies(xFamiliesSupp->getStyleFamilies());
+
+ const OUString aParaStyles(RTL_CONSTASCII_USTRINGPARAM("ParagraphStyles"));
+ if( xFamilies->hasByName( aParaStyles ) )
+ {
+ m_pImpl->m_xParaStyles.set(xFamilies->getByName(aParaStyles),
+ UNO_QUERY);
+ }
+
+ const OUString aCharStyles(RTL_CONSTASCII_USTRINGPARAM("CharacterStyles"));
+ if( xFamilies->hasByName( aCharStyles ) )
+ {
+ m_pImpl->m_xTextStyles.set(xFamilies->getByName(aCharStyles),
+ UNO_QUERY);
+ }
+
+ const OUString aNumStyles(RTL_CONSTASCII_USTRINGPARAM("NumberingStyles"));
+ if( xFamilies->hasByName( aNumStyles ) )
+ {
+ m_pImpl->m_xNumStyles.set(xFamilies->getByName(aNumStyles),
+ UNO_QUERY);
+ }
+
+ const OUString aFrameStyles(RTL_CONSTASCII_USTRINGPARAM("FrameStyles"));
+ if( xFamilies->hasByName( aFrameStyles ) )
+ {
+ m_pImpl->m_xFrameStyles.set(xFamilies->getByName(aFrameStyles),
+ UNO_QUERY);
+ }
+
+ const OUString aPageStyles(RTL_CONSTASCII_USTRINGPARAM("PageStyles"));
+ if( xFamilies->hasByName( aPageStyles ) )
+ {
+ m_pImpl->m_xPageStyles.set(xFamilies->getByName(aPageStyles),
+ UNO_QUERY);
+ }
+ }
+
+ Reference < XTextFramesSupplier > xTFS( rModel, UNO_QUERY );
+ if( xTFS.is() )
+ {
+ m_pImpl->m_xTextFrames.set(xTFS->getTextFrames());
+ }
+
+ Reference < XTextGraphicObjectsSupplier > xTGOS( rModel, UNO_QUERY );
+ if( xTGOS.is() )
+ {
+ m_pImpl->m_xGraphics.set(xTGOS->getGraphicObjects());
+ }
+
+ Reference < XTextEmbeddedObjectsSupplier > xTEOS( rModel, UNO_QUERY );
+ if( xTEOS.is() )
+ {
+ m_pImpl->m_xObjects.set(xTEOS->getEmbeddedObjects());
+ }
+
+ XMLPropertySetMapper *pPropMapper =
+ new XMLTextPropertySetMapper( TEXT_PROP_MAP_PARA );
+ m_pImpl->m_xParaImpPrMap =
+ new XMLTextImportPropertyMapper( pPropMapper, rImport );
+
+ pPropMapper = new XMLTextPropertySetMapper( TEXT_PROP_MAP_TEXT );
+ m_pImpl->m_xTextImpPrMap =
+ new XMLTextImportPropertyMapper( pPropMapper, rImport );
+
+ pPropMapper = new XMLTextPropertySetMapper( TEXT_PROP_MAP_FRAME );
+ m_pImpl->m_xFrameImpPrMap =
+ new XMLTextImportPropertyMapper( pPropMapper, rImport );
+
+ pPropMapper = new XMLTextPropertySetMapper( TEXT_PROP_MAP_SECTION );
+ m_pImpl->m_xSectionImpPrMap =
+ new XMLTextImportPropertyMapper( pPropMapper, rImport );
+
+ pPropMapper = new XMLTextPropertySetMapper( TEXT_PROP_MAP_RUBY );
+ m_pImpl->m_xRubyImpPrMap =
+ new SvXMLImportPropertyMapper( pPropMapper, rImport );
+}
+
+XMLTextImportHelper::~XMLTextImportHelper()
+{
+}
+
+SvXMLImportPropertyMapper *XMLTextImportHelper::CreateShapeExtPropMapper(SvXMLImport& rImport)
+{
+ XMLPropertySetMapper *pPropMapper =
+ new XMLTextPropertySetMapper( TEXT_PROP_MAP_FRAME );
+ return new XMLTextImportPropertyMapper( pPropMapper, rImport,
+ const_cast<XMLFontStylesContext*>(rImport.GetFontDecls()) );
+}
+
+SvXMLImportPropertyMapper *XMLTextImportHelper::CreateCharExtPropMapper(SvXMLImport& rImport, XMLFontStylesContext *pFontDecls)
+{
+ XMLPropertySetMapper *pPropMapper =
+ new XMLTextPropertySetMapper( TEXT_PROP_MAP_TEXT );
+ if (!pFontDecls)
+ pFontDecls = const_cast<XMLFontStylesContext*>(rImport.GetFontDecls());
+ return new XMLTextImportPropertyMapper( pPropMapper, rImport, pFontDecls );
+}
+
+SvXMLImportPropertyMapper *XMLTextImportHelper::CreateParaExtPropMapper(SvXMLImport& rImport, XMLFontStylesContext *pFontDecls)
+{
+ XMLPropertySetMapper *pPropMapper =
+ new XMLTextPropertySetMapper( TEXT_PROP_MAP_SHAPE_PARA );
+ if (!pFontDecls)
+ pFontDecls = const_cast<XMLFontStylesContext*>(rImport.GetFontDecls());
+ return new XMLTextImportPropertyMapper( pPropMapper, rImport, pFontDecls );
+}
+
+SvXMLImportPropertyMapper *XMLTextImportHelper::CreateParaDefaultExtPropMapper(SvXMLImport& rImport, XMLFontStylesContext* pFontDecls)
+{
+ if (!pFontDecls)
+ pFontDecls = const_cast<XMLFontStylesContext*>(rImport.GetFontDecls());
+
+ XMLPropertySetMapper* pPropMapper =
+ new XMLTextPropertySetMapper( TEXT_PROP_MAP_SHAPE_PARA );
+ SvXMLImportPropertyMapper* pImportMapper = new XMLTextImportPropertyMapper( pPropMapper, rImport, pFontDecls );
+
+ pPropMapper =
+ new XMLTextPropertySetMapper( TEXT_PROP_MAP_TEXT_ADDITIONAL_DEFAULTS );
+ pImportMapper->ChainImportMapper( new XMLTextImportPropertyMapper( pPropMapper, rImport, pFontDecls ) );
+
+ return pImportMapper;
+}
+
+SvXMLImportPropertyMapper*
+ XMLTextImportHelper::CreateTableDefaultExtPropMapper(
+ SvXMLImport& rImport,
+ XMLFontStylesContext* )
+{
+ XMLPropertySetMapper *pPropMapper =
+ new XMLTextPropertySetMapper( TEXT_PROP_MAP_TABLE_DEFAULTS );
+ return new SvXMLImportPropertyMapper( pPropMapper, rImport );
+}
+
+SvXMLImportPropertyMapper*
+ XMLTextImportHelper::CreateTableRowDefaultExtPropMapper(
+ SvXMLImport& rImport,
+ XMLFontStylesContext* )
+{
+ XMLPropertySetMapper *pPropMapper =
+ new XMLTextPropertySetMapper( TEXT_PROP_MAP_TABLE_ROW_DEFAULTS );
+ return new SvXMLImportPropertyMapper( pPropMapper, rImport );
+}
+
+void XMLTextImportHelper::SetCursor( const Reference < XTextCursor > & rCursor )
+{
+ m_pImpl->m_xCursor.set(rCursor);
+ m_pImpl->m_xText.set(rCursor->getText());
+ m_pImpl->m_xCursorAsRange.set( rCursor, UNO_QUERY );
+}
+
+void XMLTextImportHelper::ResetCursor()
+{
+ m_pImpl->m_xCursor.set(0);
+ m_pImpl->m_xText.set(0);
+ m_pImpl->m_xCursorAsRange.set(0);
+}
+
+
+sal_Bool XMLTextImportHelper::HasFrameByName( const OUString& rName ) const
+{
+ return (m_pImpl->m_xTextFrames.is() &&
+ m_pImpl->m_xTextFrames->hasByName(rName))
+ || (m_pImpl->m_xGraphics.is() &&
+ m_pImpl->m_xGraphics->hasByName(rName))
+ || (m_pImpl->m_xObjects.is() &&
+ m_pImpl->m_xObjects->hasByName(rName));
+}
+
+void XMLTextImportHelper::InsertString( const OUString& rChars )
+{
+ DBG_ASSERT(m_pImpl->m_xText.is(), "no text");
+ DBG_ASSERT(m_pImpl->m_xCursorAsRange.is(), "no range");
+ if (m_pImpl->m_xText.is())
+ {
+ m_pImpl->m_xText->insertString(m_pImpl->m_xCursorAsRange,
+ rChars, sal_False);
+ }
+}
+
+void XMLTextImportHelper::InsertString( const OUString& rChars,
+ sal_Bool& rIgnoreLeadingSpace )
+{
+ DBG_ASSERT(m_pImpl->m_xText.is(), "no text");
+ DBG_ASSERT(m_pImpl->m_xCursorAsRange.is(), "no range");
+ if (m_pImpl->m_xText.is())
+ {
+ sal_Int32 nLen = rChars.getLength();
+ OUStringBuffer sChars( nLen );
+
+ for( sal_Int32 i=0; i < nLen; i++ )
+ {
+ sal_Unicode c = rChars[i];
+ switch( c )
+ {
+ case 0x20:
+ case 0x09:
+ case 0x0a:
+ case 0x0d:
+ if( !rIgnoreLeadingSpace )
+ sChars.append( (sal_Unicode)0x20 );
+ rIgnoreLeadingSpace = sal_True;
+ break;
+ default:
+ rIgnoreLeadingSpace = sal_False;
+ sChars.append( c );
+ break;
+ }
+ }
+ m_pImpl->m_xText->insertString(m_pImpl->m_xCursorAsRange,
+ sChars.makeStringAndClear(), sal_False);
+ }
+}
+
+void XMLTextImportHelper::InsertControlCharacter( sal_Int16 nControl )
+{
+ DBG_ASSERT(m_pImpl->m_xText.is(), "no text");
+ DBG_ASSERT(m_pImpl->m_xCursorAsRange.is(), "no range");
+ if (m_pImpl->m_xText.is())
+ {
+ m_pImpl->m_xText->insertControlCharacter(
+ m_pImpl->m_xCursorAsRange, nControl, sal_False);
+ }
+}
+
+void XMLTextImportHelper::InsertTextContent(
+ Reference < XTextContent > & xContent )
+{
+ DBG_ASSERT(m_pImpl->m_xText.is(), "no text");
+ DBG_ASSERT(m_pImpl->m_xCursorAsRange.is(), "no range");
+ if (m_pImpl->m_xText.is())
+ {
+ m_pImpl->m_xText->insertTextContent(
+ m_pImpl->m_xCursorAsRange, xContent, sal_False);
+ }
+}
+
+void XMLTextImportHelper::DeleteParagraph()
+{
+ DBG_ASSERT(m_pImpl->m_xText.is(), "no text");
+ DBG_ASSERT(m_pImpl->m_xCursor.is(), "no cursor");
+ DBG_ASSERT(m_pImpl->m_xCursorAsRange.is(), "no range");
+
+ sal_Bool bDelete = sal_True;
+ Reference < XEnumerationAccess > const xEnumAccess(
+ m_pImpl->m_xCursor, UNO_QUERY);
+ if( xEnumAccess.is() )
+ {
+ Reference < XEnumeration > xEnum(xEnumAccess->createEnumeration());
+ DBG_ASSERT( xEnum->hasMoreElements(), "empty text enumeration" );
+ if( xEnum->hasMoreElements() )
+ {
+ Reference < XComponent > xComp( xEnum->nextElement(), UNO_QUERY );
+ DBG_ASSERT( xComp.is(), "got no component" );
+ if( xComp.is() )
+ {
+ xComp->dispose();
+ bDelete = sal_False;
+ }
+ }
+ }
+ if( bDelete )
+ {
+ if (m_pImpl->m_xCursor->goLeft( 1, sal_True ))
+ {
+ OUString sEmpty;
+ m_pImpl->m_xText->insertString(m_pImpl->m_xCursorAsRange,
+ sEmpty, sal_True);
+ }
+ }
+}
+
+OUString XMLTextImportHelper::ConvertStarFonts( const OUString& rChars,
+ const OUString& rStyleName,
+ sal_uInt8& rFlags,
+ sal_Bool bPara,
+ SvXMLImport& rImport ) const
+{
+ OUStringBuffer sChars( rChars );
+ sal_Bool bConverted = sal_False;
+ for( sal_Int32 j=0; j<rChars.getLength(); j++ )
+ {
+ sal_Unicode c = rChars[j];
+ if( c >= 0xf000 && c <= 0xf0ff )
+ {
+ if( (rFlags & CONV_STAR_FONT_FLAGS_VALID) == 0 )
+ {
+ XMLTextStyleContext *pStyle = 0;
+ sal_uInt16 nFamily = bPara ? XML_STYLE_FAMILY_TEXT_PARAGRAPH
+ : XML_STYLE_FAMILY_TEXT_TEXT;
+ if (rStyleName.getLength() && m_pImpl->m_xAutoStyles.Is())
+ {
+ const SvXMLStyleContext* pTempStyle =
+ ((SvXMLStylesContext *)&m_pImpl->m_xAutoStyles)->
+ FindStyleChildContext( nFamily, rStyleName,
+ sal_True );
+ pStyle = PTR_CAST( XMLTextStyleContext,pTempStyle);
+ }
+
+ if( pStyle )
+ {
+ sal_Int32 nCount = pStyle->_GetProperties().size();
+ if( nCount )
+ {
+ UniReference < SvXMLImportPropertyMapper > xImpPrMap =
+ ((SvXMLStylesContext *)&m_pImpl->m_xAutoStyles)
+ ->GetImportPropertyMapper(nFamily);
+ if( xImpPrMap.is() )
+ {
+ UniReference<XMLPropertySetMapper> rPropMapper =
+ xImpPrMap->getPropertySetMapper();
+ for( sal_Int32 i=0; i < nCount; i++ )
+ {
+ const XMLPropertyState& rProp = pStyle->_GetProperties()[i];
+ sal_Int32 nIdx = rProp.mnIndex;
+ sal_uInt32 nContextId = rPropMapper->GetEntryContextId(nIdx);
+ if( CTF_FONTFAMILYNAME == nContextId )
+ {
+ rFlags &= ~(CONV_FROM_STAR_BATS|CONV_FROM_STAR_MATH);
+ OUString sFontName;
+ rProp.maValue >>= sFontName;
+ OUString sStarBats( RTL_CONSTASCII_USTRINGPARAM("StarBats" ) );
+ OUString sStarMath( RTL_CONSTASCII_USTRINGPARAM("StarMath" ) );
+ if( sFontName.equalsIgnoreAsciiCase( sStarBats ) )
+ rFlags |= CONV_FROM_STAR_BATS;
+ else if( sFontName.equalsIgnoreAsciiCase( sStarMath ) )
+ rFlags |= CONV_FROM_STAR_MATH;
+ break;
+ }
+ }
+ }
+ }
+
+ }
+
+ rFlags |= CONV_STAR_FONT_FLAGS_VALID;
+ }
+ if( (rFlags & CONV_FROM_STAR_BATS ) != 0 )
+ {
+ sChars.setCharAt( j, rImport.ConvStarBatsCharToStarSymbol( c ) );
+ bConverted = sal_True;
+ }
+ else if( (rFlags & CONV_FROM_STAR_MATH ) != 0 )
+ {
+ sChars.setCharAt( j, rImport.ConvStarMathCharToStarSymbol( c ) );
+ bConverted = sal_True;
+ }
+ }
+ }
+
+ return bConverted ? sChars.makeStringAndClear() : rChars;
+}
+
+/* Helper method to determine, if a paragraph style has a list style (inclusive
+ an empty one) inherits a list style (inclusive an empty one) from one of its parents (#i69629#)
+*/
+/* Apply special case, that found list style equals the chapter numbering, also
+ to the found list styles of the parent styles. (#i73973#)
+*/
+sal_Bool lcl_HasListStyle( OUString sStyleName,
+ const Reference < XNameContainer >& xParaStyles,
+ SvXMLImport& rImport,
+ const OUString& sNumberingStyleName,
+ const OUString& sOutlineStyleName )
+{
+ sal_Bool bRet( sal_False );
+
+ if ( !xParaStyles->hasByName( sStyleName ) )
+ {
+ // error case
+ return sal_True;
+ }
+
+ Reference< XPropertyState > xPropState( xParaStyles->getByName( sStyleName ),
+ UNO_QUERY );
+ if ( !xPropState.is() )
+ {
+ // error case
+ return sal_False;
+ }
+
+ if ( xPropState->getPropertyState( sNumberingStyleName ) == PropertyState_DIRECT_VALUE )
+ {
+ // list style found
+ bRet = sal_True;
+ // special case: the set list style equals the chapter numbering
+ Reference< XPropertySet > xPropSet( xPropState, UNO_QUERY );
+ if ( xPropSet.is() )
+ {
+ OUString sListStyle;
+ xPropSet->getPropertyValue( sNumberingStyleName ) >>= sListStyle;
+ if ( sListStyle.getLength() != 0 &&
+ sListStyle == sOutlineStyleName )
+ {
+ bRet = sal_False;
+ }
+ }
+ }
+ else
+ {
+ // Tools.Outline settings lost on Save (#i77708#)
+ sal_Int32 nUPD( 0 );
+ sal_Int32 nBuild( 0 );
+ // Don't use UPD for versioning: xmloff/source/text/txtstyli.cxx and txtimp.cxx (#i86058#)
+ const bool bBuildIdFound = rImport.getBuildIds( nUPD, nBuild );
+ // search list style at parent
+ Reference<XStyle> xStyle( xPropState, UNO_QUERY );
+ while ( xStyle.is() )
+ {
+ OUString aParentStyle( xStyle->getParentStyle() );
+ if ( aParentStyle.getLength() > 0 )
+ {
+ aParentStyle =
+ rImport.GetStyleDisplayName( XML_STYLE_FAMILY_TEXT_PARAGRAPH,
+ aParentStyle );
+ }
+ if ( aParentStyle.getLength() == 0 ||
+ !xParaStyles->hasByName( aParentStyle ) )
+ {
+ // no list style found
+ break;
+ }
+ else
+ {
+ xPropState = Reference< XPropertyState >(
+ xParaStyles->getByName( aParentStyle ),
+ UNO_QUERY );
+ if ( !xPropState.is() )
+ {
+ // error case
+ return sal_True;
+ }
+ if ( xPropState->getPropertyState( sNumberingStyleName ) == PropertyState_DIRECT_VALUE )
+ {
+ // list style found
+ bRet = sal_True;
+ // Special case: the found list style equals the chapter numbering (#i73973#)
+ Reference< XPropertySet > xPropSet( xPropState, UNO_QUERY );
+ if ( xPropSet.is() )
+ {
+ OUString sListStyle;
+ xPropSet->getPropertyValue( sNumberingStyleName ) >>= sListStyle;
+ if ( sListStyle.getLength() != 0 &&
+ sListStyle == sOutlineStyleName )
+ {
+ bRet = sal_False;
+ }
+ // Special handling for text documents from OOo version prior OOo 2.4 (#i77708#)
+ /* Check explicitly on certain versions and on import of
+ text documents in OpenOffice.org file format (#i86058#)
+ */
+ else if ( sListStyle.getLength() == 0 &&
+ ( rImport.IsTextDocInOOoFileFormat() ||
+ ( bBuildIdFound &&
+ ( ( nUPD == 641 ) || ( nUPD == 645 ) || // prior OOo 2.0
+ ( nUPD == 680 && nBuild <= 9238 ) ) ) ) ) // OOo 2.0 - OOo 2.3.1
+ {
+ bRet = sal_False;
+ }
+ // <--
+ }
+ // <--
+ break;
+ }
+ else
+ {
+ // search list style at parent
+ xStyle = Reference<XStyle>( xPropState, UNO_QUERY );
+ }
+ }
+ }
+ }
+
+ return bRet;
+}
+// <--
+OUString XMLTextImportHelper::SetStyleAndAttrs(
+ SvXMLImport& rImport,
+ const Reference < XTextCursor >& rCursor,
+ const OUString& rStyleName,
+ sal_Bool bPara,
+ sal_Bool bOutlineLevelAttrFound,
+ sal_Int8 nOutlineLevel,
+ // Numberings/Bullets in table not visible aftzer save/reload (#i80724#)
+ sal_Bool bSetListAttrs )
+{
+ static ::rtl::OUString s_ParaStyleName(
+ RTL_CONSTASCII_USTRINGPARAM("ParaStyleName"));
+ static ::rtl::OUString s_CharStyleName(
+ RTL_CONSTASCII_USTRINGPARAM("CharStyleName"));
+ static ::rtl::OUString s_NumberingRules(
+ RTL_CONSTASCII_USTRINGPARAM("NumberingRules"));
+ static ::rtl::OUString s_NumberingIsNumber(
+ RTL_CONSTASCII_USTRINGPARAM("NumberingIsNumber"));
+ static ::rtl::OUString s_NumberingLevel(
+ RTL_CONSTASCII_USTRINGPARAM("NumberingLevel"));
+ static ::rtl::OUString s_ParaIsNumberingRestart(
+ RTL_CONSTASCII_USTRINGPARAM("ParaIsNumberingRestart"));
+ static ::rtl::OUString s_NumberingStartValue(
+ RTL_CONSTASCII_USTRINGPARAM("NumberingStartValue"));
+ static ::rtl::OUString s_PropNameListId(
+ RTL_CONSTASCII_USTRINGPARAM("ListId"));
+ static ::rtl::OUString s_PageDescName(
+ RTL_CONSTASCII_USTRINGPARAM("PageDescName"));
+ static ::rtl::OUString s_ServiceCombinedCharacters(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.text.TextField.CombinedCharacters"));
+ static ::rtl::OUString s_Content(RTL_CONSTASCII_USTRINGPARAM("Content"));
+ static ::rtl::OUString s_OutlineLevel(
+ RTL_CONSTASCII_USTRINGPARAM("OutlineLevel"));
+ static ::rtl::OUString s_NumberingStyleName(
+ RTL_CONSTASCII_USTRINGPARAM("NumberingStyleName"));
+
+ const sal_uInt16 nFamily = bPara ? XML_STYLE_FAMILY_TEXT_PARAGRAPH
+ : XML_STYLE_FAMILY_TEXT_TEXT;
+ XMLTextStyleContext *pStyle = 0;
+ OUString sStyleName( rStyleName );
+ if (sStyleName.getLength() && m_pImpl->m_xAutoStyles.Is())
+ {
+ const SvXMLStyleContext* pTempStyle =
+ ((SvXMLStylesContext *)&m_pImpl->m_xAutoStyles)->
+ FindStyleChildContext( nFamily, sStyleName, sal_True );
+ pStyle = PTR_CAST( XMLTextStyleContext,pTempStyle);
+ }
+ if( pStyle )
+ sStyleName = pStyle->GetParentName();
+
+ Reference < XPropertySet > xPropSet( rCursor, UNO_QUERY );
+ Reference< XPropertySetInfo > xPropSetInfo(
+ xPropSet->getPropertySetInfo());
+
+ // style
+ if( sStyleName.getLength() )
+ {
+ sStyleName = rImport.GetStyleDisplayName( nFamily, sStyleName );
+ const String& rPropName = (bPara) ? s_ParaStyleName : s_CharStyleName;
+ const Reference < XNameContainer > & rStyles = (bPara)
+ ? m_pImpl->m_xParaStyles
+ : m_pImpl->m_xTextStyles;
+ if( rStyles.is() &&
+ xPropSetInfo->hasPropertyByName( rPropName ) &&
+ rStyles->hasByName( sStyleName ) )
+ {
+ xPropSet->setPropertyValue( rPropName, makeAny(sStyleName) );
+ }
+ else
+ sStyleName = OUString();
+ }
+
+ /* The outline level needs to be only applied as list level, if the heading
+ is not inside a list and if it by default applies the outline style. (#i70748#)
+ */
+ bool bApplyOutlineLevelAsListLevel( false );
+ // Numberings/Bullets in table not visible aftzer save/reload (#i80724#)
+ if (bSetListAttrs && bPara
+ && xPropSetInfo->hasPropertyByName( s_NumberingRules))
+ {
+ // Set numbering rules
+ Reference< XIndexReplace > const xNumRules(
+ xPropSet->getPropertyValue(s_NumberingRules), UNO_QUERY);
+
+ XMLTextListBlockContext * pListBlock(0);
+ XMLTextListItemContext * pListItem(0);
+ XMLNumberedParaContext * pNumberedParagraph(0);
+ GetTextListHelper().ListContextTop(
+ pListBlock, pListItem, pNumberedParagraph);
+
+ OSL_ENSURE(!(pListBlock && pNumberedParagraph), "XMLTextImportHelper::"
+ "SetStyleAndAttrs: both list and numbered-paragraph???");
+
+ Reference < XIndexReplace > xNewNumRules;
+ sal_Int8 nLevel(-1);
+ ::rtl::OUString sListId;
+ sal_Int16 nStartValue(-1);
+ bool bNumberingIsNumber(true);
+
+ if (pListBlock) {
+
+ if (!pListItem) {
+ bNumberingIsNumber = false; // list-header
+ }
+ // consider text:style-override property of <text:list-item>
+ xNewNumRules.set(
+ (pListItem != 0 && pListItem->HasNumRulesOverride())
+ ? pListItem->GetNumRulesOverride()
+ : pListBlock->GetNumRules() );
+ nLevel = static_cast<sal_Int8>(pListBlock->GetLevel());
+
+ if ( pListItem && pListItem->HasStartValue() ) {
+ nStartValue = pListItem->GetStartValue();
+ }
+
+ // Inconsistent behavior regarding lists (#i92811#)
+ sListId = m_pImpl->m_pTextListsHelper->GetListIdForListBlock(
+ *pListBlock);
+ }
+ else if (pNumberedParagraph)
+ {
+ xNewNumRules.set(pNumberedParagraph->GetNumRules());
+ nLevel = static_cast<sal_Int8>(pNumberedParagraph->GetLevel());
+ sListId = pNumberedParagraph->GetListId();
+ nStartValue = pNumberedParagraph->GetStartValue();
+ }
+
+
+ if (pListBlock || pNumberedParagraph)
+ {
+ // Assure that list style of automatic paragraph style is applied at paragraph. (#i101349#)
+ sal_Bool bApplyNumRules = pStyle && pStyle->IsListStyleSet();
+ if ( !bApplyNumRules )
+ {
+ sal_Bool bSameNumRules = xNewNumRules == xNumRules;
+ if( !bSameNumRules && xNewNumRules.is() && xNumRules.is() )
+ {
+ // If the interface pointers are different then this does
+ // not mean that the num rules are different. Further tests
+ // are required then. However, if only one num rule is
+ // set, no tests are required of course.
+ Reference< XNamed > xNewNamed( xNewNumRules, UNO_QUERY );
+ Reference< XNamed > xNamed( xNumRules, UNO_QUERY );
+ if( xNewNamed.is() && xNamed.is() )
+ {
+ bSameNumRules = xNewNamed->getName() == xNamed->getName();
+ }
+ else
+ {
+ Reference< XAnyCompare > xNumRuleCompare( xNumRules, UNO_QUERY );
+ if( xNumRuleCompare.is() )
+ {
+ bSameNumRules = (xNumRuleCompare->compare( Any(xNumRules), Any(xNewNumRules) ) == 0);
+ }
+ }
+ }
+ bApplyNumRules = !bSameNumRules;
+ }
+
+ if ( bApplyNumRules )
+ {
+ // #102607# This may except when xNewNumRules contains
+ // a Writer-NumRule-Implementation bug gets applied to
+ // a shape. Since this may occur inside a document
+ // (e.g. when edited), this must be handled
+ // gracefully.
+ try
+ {
+ xPropSet->setPropertyValue(
+ s_NumberingRules, makeAny(xNewNumRules) );
+ }
+ catch( Exception e )
+ {
+ ; // I would really like to use a warning here,
+ // but I can't access the XMLErrorHandler from
+ // here.
+ }
+ }
+
+ if (!bNumberingIsNumber &&
+ xPropSetInfo->hasPropertyByName(s_NumberingIsNumber))
+ {
+ xPropSet->setPropertyValue(s_NumberingIsNumber, Any(sal_False));
+ }
+
+ xPropSet->setPropertyValue( s_NumberingLevel, Any(nLevel) );
+
+ if( pListBlock && pListBlock->IsRestartNumbering() )
+ {
+ // TODO: property missing
+ if (xPropSetInfo->hasPropertyByName(s_ParaIsNumberingRestart))
+ {
+ sal_Bool bTmp = sal_True;
+ xPropSet->setPropertyValue(s_ParaIsNumberingRestart,
+ makeAny(bTmp) );
+ }
+ pListBlock->ResetRestartNumbering();
+ }
+
+ if ( 0 <= nStartValue &&
+ xPropSetInfo->hasPropertyByName(s_NumberingStartValue))
+ {
+ xPropSet->setPropertyValue(s_NumberingStartValue,
+ makeAny(nStartValue));
+ }
+
+ if (xPropSetInfo->hasPropertyByName(s_PropNameListId))
+ {
+ if (sListId.getLength()) {
+ xPropSet->setPropertyValue(s_PropNameListId,
+ makeAny(sListId) );
+ }
+ }
+
+ GetTextListHelper().SetListItem( (XMLTextListItemContext *)0 );
+ }
+ else
+ {
+ /* If the paragraph is not in a list but its style, remove it from
+ the list. Do not remove it, if the list of the style is
+ the chapter numbering rule.
+ */
+ if( xNumRules.is() )
+ {
+ bool bRemove( true );
+ // Special handling for document from OOo 2.x (#i70748#)
+ sal_Int32 nUPD( 0 );
+ sal_Int32 nBuild( 0 );
+ const bool bBuildIdFound = rImport.getBuildIds( nUPD, nBuild );
+ DBG_ASSERT( ( bBuildIdFound && nUPD == 680 ) ||
+ !pStyle ||
+ !pStyle->IsListStyleSet() ||
+ pStyle->GetListStyle().getLength() == 0,
+ "automatic paragraph style with list style name, but paragraph not in list???" );
+ if ( ( bBuildIdFound && nUPD == 680 ) ||
+ !pStyle || !pStyle->IsListStyleSet() )
+ {
+ if (m_pImpl->m_xChapterNumbering.is())
+ {
+ Reference< XNamed > xNumNamed( xNumRules, UNO_QUERY );
+ Reference< XNamed > const xChapterNumNamed (
+ m_pImpl->m_xChapterNumbering, UNO_QUERY);
+ if ( xNumNamed.is() && xChapterNumNamed.is() &&
+ xNumNamed->getName() == xChapterNumNamed->getName() )
+ {
+ bRemove = false;
+ // RFE: inserting headings into text documents (#i70748#)
+ bApplyOutlineLevelAsListLevel = true;
+ }
+ }
+ }
+ if ( bRemove )
+ {
+ xPropSet->setPropertyValue( s_NumberingRules, Any() );
+ }
+ }
+ }
+ }
+
+ // hard paragraph properties
+ if( pStyle )
+ {
+ pStyle->FillPropertySet( xPropSet );
+ if( bPara && pStyle->HasMasterPageName() &&
+ xPropSetInfo->hasPropertyByName(s_PageDescName))
+ {
+ OUString sDisplayName(
+ rImport.GetStyleDisplayName(
+ XML_STYLE_FAMILY_MASTER_PAGE,
+ pStyle->GetMasterPageName()) );
+ if( !sDisplayName.getLength() ||
+ (m_pImpl->m_xPageStyles.is() &&
+ m_pImpl->m_xPageStyles->hasByName( sDisplayName)))
+ {
+ xPropSet->setPropertyValue(s_PageDescName,
+ makeAny(sDisplayName));
+ }
+ }
+ if( bPara && pStyle->GetDropCapStyleName().getLength() &&
+ m_pImpl->m_xTextStyles.is())
+ {
+ OUString sDisplayName(
+ rImport.GetStyleDisplayName(
+ XML_STYLE_FAMILY_TEXT_TEXT,
+ pStyle->GetDropCapStyleName()) );
+ if (m_pImpl->m_xTextStyles->hasByName(sDisplayName) &&
+ xPropSetInfo->hasPropertyByName( sDisplayName ) )
+ {
+ xPropSet->setPropertyValue( pStyle->sDropCapCharStyleName, makeAny(sDisplayName) );
+ }
+ }
+
+ // combined characters special treatment
+ if (!bPara && pStyle->HasCombinedCharactersLetter())
+ {
+ // insert combined characters text field
+ if (m_pImpl->m_xServiceFactory.is())
+ {
+ uno::Reference<beans::XPropertySet> const xTmp(
+ m_pImpl->m_xServiceFactory->createInstance(
+ s_ServiceCombinedCharacters), UNO_QUERY);
+ if( xTmp.is() )
+ {
+ // fix cursor if larger than possible for
+ // combined characters field
+ if (rCursor->getString().getLength() >
+ MAX_COMBINED_CHARACTERS)
+ {
+ rCursor->gotoRange(rCursor->getStart(), sal_False);
+ rCursor->goRight(MAX_COMBINED_CHARACTERS, sal_True);
+ }
+
+ // set field value (the combined character string)
+ xTmp->setPropertyValue(s_Content,
+ makeAny(rCursor->getString()));
+
+ // insert the field over it's original text
+ Reference<XTextRange> xRange(rCursor, UNO_QUERY);
+ Reference<XTextContent> xTextContent(xTmp, UNO_QUERY);
+ if (m_pImpl->m_xText.is() && xRange.is())
+ {
+ // #i107225# the combined characters need to be inserted first
+ // the selected text has to be removed afterwards
+ m_pImpl->m_xText->insertTextContent( xRange->getStart(), xTextContent, sal_True );
+
+ if( xRange->getString().getLength() )
+ {
+ try
+ {
+ uno::Reference< text::XTextCursor > xCrsr = xRange->getText()->createTextCursorByRange( xRange->getStart() );
+ xCrsr->goLeft( 1, true );
+ uno::Reference< beans::XPropertySet> xCrsrProperties( xCrsr, uno::UNO_QUERY_THROW );
+ //the hard properties of the removed text need to be applied to the combined characters field
+ pStyle->FillPropertySet( xCrsrProperties );
+ xCrsr->collapseToEnd();
+ xCrsr->gotoRange( xRange->getEnd(), true );
+ xCrsr->setString( ::rtl::OUString() );
+ }
+ catch( const uno::Exception& rEx )
+ {
+ (void)rEx;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // outline level; set after list style has been set
+ // Complete re-worked and corrected: (#i53198#)
+ // - set outline level at paragraph
+ // - set numbering level at paragraph, if none is already set
+ // - assure that style is marked as an outline style for the corresponding
+ // outline level.
+ // - DO NOT set type of numbering rule to outline.
+ // - DO NOT set numbering rule directly at the paragraph.
+
+ // Some minor rework and adjust access to paragraph styles (#i70748#)
+ if ( bPara )
+ {
+ // Headings not numbered anymore in 3.1 (#i103817#)
+ sal_Int16 nCurrentOutlineLevelInheritedFromParagraphStyle = 0;
+ const bool bHasOutlineLevelProp(
+ xPropSetInfo->hasPropertyByName(s_OutlineLevel));
+ if ( bHasOutlineLevelProp )
+ {
+ xPropSet->getPropertyValue(s_OutlineLevel)
+ >>= nCurrentOutlineLevelInheritedFromParagraphStyle;
+ }
+ if ( nOutlineLevel > 0 )
+ {
+ if ( bHasOutlineLevelProp )
+ {
+ // In case that the value equals the value of its paragraph style
+ // attribute outline level, the paragraph attribute value is left unset
+ if ( nCurrentOutlineLevelInheritedFromParagraphStyle != nOutlineLevel )
+ {
+ xPropSet->setPropertyValue( s_OutlineLevel,
+ makeAny( static_cast<sal_Int16>(nOutlineLevel) ) );
+ }
+ }
+
+ // RFE: inserting headings into text documents (#i70748#)
+ if ( bApplyOutlineLevelAsListLevel )
+ {
+ sal_Int16 nNumLevel = -1;
+ xPropSet->getPropertyValue( s_NumberingLevel ) >>= nNumLevel;
+ if ( nNumLevel == -1 ||
+ nNumLevel != (nOutlineLevel - 1) )
+ {
+ xPropSet->setPropertyValue( s_NumberingLevel,
+ makeAny( static_cast<sal_Int8>(nOutlineLevel - 1) ) );
+ }
+ }
+ /* Correction: (#i69629#)
+ - for text document from version OOo 2.0.4/SO 8 PU4 and earlier
+ the paragraph style of a heading should be assigned to the
+ corresponding list level of the outline style.
+ - for other text documents the paragraph style of a heading is only
+ a candidate for an assignment to the list level of the outline
+ style, if it has no direct list style property and (if exists) the
+ automatic paragraph style has also no direct list style set.
+ */
+ if (m_pImpl->m_xParaStyles->hasByName(sStyleName))
+ {
+ bool bOutlineStyleCandidate( false );
+
+ sal_Int32 nUPD( 0 );
+ sal_Int32 nBuild( 0 );
+ const bool bBuildIdFound = rImport.getBuildIds( nUPD, nBuild );
+ // Lost outline numbering in master document (#i73509#)
+ // Check explicitly on certain versions (#i86058#)
+ if ( rImport.IsTextDocInOOoFileFormat() ||
+ ( bBuildIdFound &&
+ ( nUPD == 645 || nUPD == 641 ) ) )
+ {
+ bOutlineStyleCandidate = true;
+ }
+ else if ( nUPD == 680 && nBuild <= 9073 ) /* BuildId of OOo 2.0.4/SO8 PU4 */
+ {
+ bOutlineStyleCandidate = bOutlineLevelAttrFound;
+ }
+ if ( bOutlineStyleCandidate )
+ {
+ AddOutlineStyleCandidate( nOutlineLevel, sStyleName );
+ }
+ // Assure that heading applies the outline style (#i103817#)
+ if ( ( !pStyle || !pStyle->IsListStyleSet() ) &&
+ !bOutlineStyleCandidate &&
+ m_pImpl->m_xChapterNumbering.is())
+ {
+ OUString sEmptyStr;
+ if ( !lcl_HasListStyle( sStyleName,
+ m_pImpl->m_xParaStyles, GetXMLImport(),
+ s_NumberingStyleName,
+ sEmptyStr ) )
+ {
+ // heading not in a list --> apply outline style
+ xPropSet->setPropertyValue( s_NumberingRules,
+ makeAny(m_pImpl->m_xChapterNumbering) );
+ xPropSet->setPropertyValue( s_NumberingLevel,
+ makeAny(static_cast<sal_Int8>(nOutlineLevel - 1)));
+ }
+ }
+ }
+ }
+ //handle for text:p,if the paragraphstyle outlinelevel is set to[1~10]
+ else if( bHasOutlineLevelProp )
+ {
+ if ( nCurrentOutlineLevelInheritedFromParagraphStyle != 0 )
+ {
+ sal_Int16 nZero = 0;
+ xPropSet->setPropertyValue(s_OutlineLevel,
+ makeAny( static_cast<sal_Int16>(nZero) ));
+ }
+ }
+ }
+
+ return sStyleName;
+}
+
+void XMLTextImportHelper::FindOutlineStyleName( ::rtl::OUString& rStyleName,
+ sal_Int8 nOutlineLevel )
+{
+ static ::rtl::OUString s_HeadingStyleName(
+ RTL_CONSTASCII_USTRINGPARAM("HeadingStyleName"));
+
+ // style name empty?
+ if( rStyleName.getLength() == 0 )
+ {
+ // Empty? Then we need o do stuff. Let's do error checking first.
+ if (m_pImpl->m_xChapterNumbering.is() &&
+ ( nOutlineLevel > 0 ) &&
+ (nOutlineLevel <= m_pImpl->m_xChapterNumbering->getCount()))
+ {
+ nOutlineLevel--; // for the remainder, the level's are 0-based
+
+ // empty style name: look-up previously used name
+
+ // if we don't have a previously used name, we'll use the default
+ m_pImpl->InitOutlineStylesCandidates();
+ if (m_pImpl->m_pOutlineStylesCandidates[nOutlineLevel].empty())
+ {
+ // no other name used previously? Then use default
+
+ // iterate over property value sequence to find the style name
+ Sequence<PropertyValue> aProperties;
+ m_pImpl->m_xChapterNumbering->getByIndex( nOutlineLevel )
+ >>= aProperties;
+ for( sal_Int32 i = 0; i < aProperties.getLength(); i++ )
+ {
+ if (aProperties[i].Name == s_HeadingStyleName)
+ {
+ rtl::OUString aOutlineStyle;
+ aProperties[i].Value >>= aOutlineStyle;
+ m_pImpl->m_pOutlineStylesCandidates[nOutlineLevel]
+ .push_back( aOutlineStyle );
+ break; // early out, if we found it!.
+ }
+ }
+ }
+
+ // finally, we'll use the previously used style name for this
+ // format (or the default we've just put into that style)
+ // take last added one (#i71249#)
+ rStyleName =
+ m_pImpl->m_pOutlineStylesCandidates[nOutlineLevel].back();
+ }
+ // else: nothing we can do, so we'll leave it empty
+ }
+ // else: we already had a style name, so we let it pass.
+}
+
+void XMLTextImportHelper::AddOutlineStyleCandidate( const sal_Int8 nOutlineLevel,
+ const OUString& rStyleName )
+{
+ if (rStyleName.getLength()
+ && m_pImpl->m_xChapterNumbering.is()
+ && (nOutlineLevel > 0)
+ && (nOutlineLevel <= m_pImpl->m_xChapterNumbering->getCount()))
+ {
+ m_pImpl->InitOutlineStylesCandidates();
+ m_pImpl->m_pOutlineStylesCandidates[nOutlineLevel-1].push_back(
+ rStyleName);
+ }
+}
+
+void XMLTextImportHelper::SetOutlineStyles( sal_Bool bSetEmptyLevels )
+{
+ static ::rtl::OUString s_NumberingStyleName(
+ RTL_CONSTASCII_USTRINGPARAM("NumberingStyleName"));
+ static ::rtl::OUString s_HeadingStyleName(
+ RTL_CONSTASCII_USTRINGPARAM("HeadingStyleName"));
+
+ if ((m_pImpl->m_pOutlineStylesCandidates != NULL || bSetEmptyLevels) &&
+ m_pImpl->m_xChapterNumbering.is() &&
+ !IsInsertMode())
+ {
+ bool bChooseLastOne( false );
+ {
+ if ( GetXMLImport().IsTextDocInOOoFileFormat() )
+ {
+ bChooseLastOne = true;
+ }
+ else
+ {
+ sal_Int32 nUPD( 0 );
+ sal_Int32 nBuild( 0 );
+ if ( GetXMLImport().getBuildIds( nUPD, nBuild ) )
+ {
+ // check explicitly on certain versions
+ bChooseLastOne = ( nUPD == 641 ) || ( nUPD == 645 ) || // prior OOo 2.0
+ ( nUPD == 680 && nBuild <= 9073 ); // OOo 2.0 - OOo 2.0.4
+ }
+ }
+ }
+
+ OUString sOutlineStyleName;
+ {
+ Reference<XPropertySet> xChapterNumRule(
+ m_pImpl->m_xChapterNumbering, UNO_QUERY);
+ const OUString sName(RTL_CONSTASCII_USTRINGPARAM("Name"));
+ xChapterNumRule->getPropertyValue(sName) >>= sOutlineStyleName;
+ }
+
+ const sal_Int32 nCount = m_pImpl->m_xChapterNumbering->getCount();
+ /* First collect all paragraph styles choosen for assignment to each
+ list level of the outline style, then perform the intrinsic assignment.
+ Reason: The assignment of a certain paragraph style to a list level
+ of the outline style causes side effects on the children
+ paragraph styles in Writer. (#i106218#)
+ */
+ ::std::vector<OUString> sChosenStyles(nCount);
+ for( sal_Int32 i=0; i < nCount; ++i )
+ {
+ if ( bSetEmptyLevels ||
+ (m_pImpl->m_pOutlineStylesCandidates &&
+ !m_pImpl->m_pOutlineStylesCandidates[i].empty()))
+ {
+ // determine, which candidate is one to be assigned to the list
+ // level of the outline style
+ if (m_pImpl->m_pOutlineStylesCandidates &&
+ !m_pImpl->m_pOutlineStylesCandidates[i].empty())
+ {
+ if ( bChooseLastOne )
+ {
+ sChosenStyles[i] =
+ m_pImpl->m_pOutlineStylesCandidates[i].back();
+ }
+ else
+ {
+ for (sal_uInt32 j = 0;
+ j < m_pImpl->m_pOutlineStylesCandidates[i].size();
+ ++j)
+ {
+ if (!lcl_HasListStyle(
+ m_pImpl->m_pOutlineStylesCandidates[i][j],
+ m_pImpl->m_xParaStyles, GetXMLImport(),
+ s_NumberingStyleName,
+ sOutlineStyleName))
+ {
+ sChosenStyles[i] =
+ m_pImpl->m_pOutlineStylesCandidates[i][j];
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ // Trashed outline numbering in ODF 1.1 text document created by OOo 3.x (#i106218#)
+ Sequence < PropertyValue > aProps( 1 );
+ PropertyValue *pProps = aProps.getArray();
+ pProps->Name = s_HeadingStyleName;
+ for ( sal_Int32 i = 0; i < nCount; ++i )
+ {
+ // Paragraph style assignments in Outline of template lost from second level on (#i107610#)
+ if ( bSetEmptyLevels ||
+ sChosenStyles[i].getLength() > 0 )
+ {
+ pProps->Value <<= sChosenStyles[i];
+ m_pImpl->m_xChapterNumbering->replaceByIndex(i,
+ makeAny( aProps ));
+ }
+ }
+ }
+}
+
+void XMLTextImportHelper::SetHyperlink(
+ SvXMLImport& rImport,
+ const Reference < XTextCursor >& rCursor,
+ const OUString& rHRef,
+ const OUString& rName,
+ const OUString& rTargetFrameName,
+ const OUString& rStyleName,
+ const OUString& rVisitedStyleName,
+ XMLEventsImportContext* pEvents)
+{
+ static ::rtl::OUString s_HyperLinkURL(
+ RTL_CONSTASCII_USTRINGPARAM("HyperLinkURL"));
+ static ::rtl::OUString s_HyperLinkName(
+ RTL_CONSTASCII_USTRINGPARAM("HyperLinkName"));
+ static ::rtl::OUString s_HyperLinkTarget(
+ RTL_CONSTASCII_USTRINGPARAM("HyperLinkTarget"));
+ static ::rtl::OUString s_UnvisitedCharStyleName(
+ RTL_CONSTASCII_USTRINGPARAM("UnvisitedCharStyleName"));
+ static ::rtl::OUString s_VisitedCharStyleName(
+ RTL_CONSTASCII_USTRINGPARAM("VisitedCharStyleName"));
+ static ::rtl::OUString s_HyperLinkEvents(
+ RTL_CONSTASCII_USTRINGPARAM("HyperLinkEvents"));
+
+ Reference < XPropertySet > xPropSet( rCursor, UNO_QUERY );
+ Reference < XPropertySetInfo > xPropSetInfo(
+ xPropSet->getPropertySetInfo());
+ if (!xPropSetInfo.is() || !xPropSetInfo->hasPropertyByName(s_HyperLinkURL))
+ return;
+
+ xPropSet->setPropertyValue(s_HyperLinkURL, makeAny(rHRef));
+
+ if (xPropSetInfo->hasPropertyByName(s_HyperLinkName))
+ {
+ xPropSet->setPropertyValue(s_HyperLinkName, makeAny(rName));
+ }
+
+ if (xPropSetInfo->hasPropertyByName(s_HyperLinkTarget))
+ {
+ xPropSet->setPropertyValue(s_HyperLinkTarget,
+ makeAny(rTargetFrameName));
+ }
+
+ if ( (pEvents != NULL) &&
+ xPropSetInfo->hasPropertyByName(s_HyperLinkEvents))
+ {
+ // The API treats events at hyperlinks differently from most
+ // other properties: You have to set a name replace with the
+ // events in it. The easiest way to to this is to 1) get
+ // events, 2) set new ones, and 3) then put events back.
+ uno::Reference<XNameReplace> const xReplace(
+ xPropSet->getPropertyValue(s_HyperLinkEvents), UNO_QUERY);
+ if (xReplace.is())
+ {
+ // set events
+ pEvents->SetEvents(xReplace);
+
+ // put events
+ xPropSet->setPropertyValue(s_HyperLinkEvents, makeAny(xReplace));
+ }
+ }
+
+ if (m_pImpl->m_xTextStyles.is())
+ {
+ OUString sDisplayName(
+ rImport.GetStyleDisplayName(
+ XML_STYLE_FAMILY_TEXT_TEXT, rStyleName ) );
+ if( sDisplayName.getLength() &&
+ xPropSetInfo->hasPropertyByName(s_UnvisitedCharStyleName) &&
+ m_pImpl->m_xTextStyles->hasByName(sDisplayName))
+ {
+ xPropSet->setPropertyValue(s_UnvisitedCharStyleName,
+ makeAny(sDisplayName));
+ }
+
+ sDisplayName =
+ rImport.GetStyleDisplayName(
+ XML_STYLE_FAMILY_TEXT_TEXT, rVisitedStyleName );
+ if( sDisplayName.getLength() &&
+ xPropSetInfo->hasPropertyByName(s_VisitedCharStyleName) &&
+ m_pImpl->m_xTextStyles->hasByName(sDisplayName))
+ {
+ xPropSet->setPropertyValue(s_VisitedCharStyleName,
+ makeAny(sDisplayName));
+ }
+ }
+}
+
+void XMLTextImportHelper::SetRuby(
+ SvXMLImport& rImport,
+ const Reference < XTextCursor >& rCursor,
+ const OUString& rStyleName,
+ const OUString& rTextStyleName,
+ const OUString& rText )
+{
+ Reference<XPropertySet> xPropSet(rCursor, UNO_QUERY);
+
+ OUString sRubyText(RTL_CONSTASCII_USTRINGPARAM("RubyText"));
+ OUString sRubyCharStyleName(RTL_CONSTASCII_USTRINGPARAM("RubyCharStyleName"));
+
+ // if we have one Ruby property, we assume all of them are present
+ if (xPropSet.is() &&
+ xPropSet->getPropertySetInfo()->hasPropertyByName( sRubyText ))
+ {
+ // the ruby text
+ xPropSet->setPropertyValue(sRubyText, makeAny(rText));
+
+ // the ruby style (ruby-adjust)
+ XMLPropStyleContext *pStyle = 0;
+ if (rStyleName.getLength() && m_pImpl->m_xAutoStyles.Is())
+ {
+ const SvXMLStyleContext* pTempStyle =
+ ((SvXMLStylesContext *)&m_pImpl->m_xAutoStyles)->
+ FindStyleChildContext( XML_STYLE_FAMILY_TEXT_RUBY,
+ rStyleName, sal_True );
+ pStyle = PTR_CAST(XMLPropStyleContext,pTempStyle);
+
+ if (NULL != pStyle)
+ pStyle->FillPropertySet( xPropSet );
+ }
+
+ // the ruby text character style
+ if (m_pImpl->m_xTextStyles.is())
+ {
+ OUString sDisplayName(
+ rImport.GetStyleDisplayName(
+ XML_STYLE_FAMILY_TEXT_TEXT, rTextStyleName ) );
+ if( (sDisplayName.getLength() > 0) &&
+ m_pImpl->m_xTextStyles->hasByName( sDisplayName ))
+ {
+ xPropSet->setPropertyValue(sRubyCharStyleName, makeAny(sDisplayName));
+ }
+ }
+ }
+}
+
+void XMLTextImportHelper::SetAutoStyles( SvXMLStylesContext *pStyles )
+{
+ m_pImpl->m_xAutoStyles = pStyles;
+}
+
+void XMLTextImportHelper::SetFontDecls( XMLFontStylesContext *pFontDecls )
+{
+ m_pImpl->m_xFontDecls = pFontDecls;
+ ((XMLTextImportPropertyMapper *)m_pImpl->m_xParaImpPrMap.get())
+ ->SetFontDecls( pFontDecls );
+ ((XMLTextImportPropertyMapper *)m_pImpl->m_xTextImpPrMap.get())
+ ->SetFontDecls( pFontDecls );
+}
+
+const XMLFontStylesContext *XMLTextImportHelper::GetFontDecls() const
+{
+ return (XMLFontStylesContext *)&m_pImpl->m_xFontDecls;
+}
+
+sal_Bool XMLTextImportHelper::HasDrawNameAttribute(
+ const Reference< XAttributeList > & xAttrList,
+ SvXMLNamespaceMap& rNamespaceMap )
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ rNamespaceMap.GetKeyByAttrName( rAttrName, &aLocalName );
+ if( XML_NAMESPACE_DRAW == nPrefix &&
+ IsXMLToken( aLocalName, XML_NAME ) )
+ {
+ return xAttrList->getValueByIndex(i).getLength() != 0;
+ }
+ }
+
+ return sal_False;
+}
+
+SvXMLImportContext *XMLTextImportHelper::CreateTextChildContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix, const OUString& rLocalName,
+ const Reference< XAttributeList > & xAttrList,
+ XMLTextType eType )
+{
+ SvXMLImportContext *pContext = 0;
+
+ const SvXMLTokenMap& rTokenMap = GetTextElemTokenMap();
+ sal_Bool bHeading = sal_False;
+ sal_Bool bContent = sal_True;
+ sal_uInt16 nToken = rTokenMap.Get( nPrefix, rLocalName );
+ switch( nToken )
+ {
+ case XML_TOK_TEXT_H:
+ bHeading = sal_True;
+ case XML_TOK_TEXT_P:
+ pContext = new XMLParaContext( rImport,
+ nPrefix, rLocalName,
+ xAttrList, bHeading );
+ if (m_pImpl->m_bProgress && XML_TEXT_TYPE_SHAPE != eType)
+ {
+ rImport.GetProgressBarHelper()->Increment();
+ }
+ break;
+ case XML_TOK_TEXT_NUMBERED_PARAGRAPH:
+ pContext = new XMLNumberedParaContext(
+ rImport, nPrefix, rLocalName, xAttrList );
+ break;
+ case XML_TOK_TEXT_LIST:
+ pContext = new XMLTextListBlockContext( rImport, *this,
+ nPrefix, rLocalName,
+ xAttrList );
+ break;
+ case XML_TOK_TABLE_TABLE:
+ if( XML_TEXT_TYPE_BODY == eType ||
+ XML_TEXT_TYPE_TEXTBOX == eType ||
+ XML_TEXT_TYPE_SECTION == eType ||
+ XML_TEXT_TYPE_HEADER_FOOTER == eType ||
+ XML_TEXT_TYPE_CHANGED_REGION == eType ||
+ XML_TEXT_TYPE_CELL == eType )
+ pContext = CreateTableChildContext( rImport, nPrefix, rLocalName,
+ xAttrList );
+ break;
+ case XML_TOK_TEXT_SEQUENCE_DECLS:
+ if ((XML_TEXT_TYPE_BODY == eType && m_pImpl->m_bBodyContentStarted) ||
+ XML_TEXT_TYPE_HEADER_FOOTER == eType )
+ {
+ pContext = new XMLVariableDeclsImportContext(
+ rImport, *this, nPrefix, rLocalName, VarTypeSequence);
+ bContent = sal_False;
+ }
+ break;
+
+ case XML_TOK_TEXT_VARFIELD_DECLS:
+ if ((XML_TEXT_TYPE_BODY == eType && m_pImpl->m_bBodyContentStarted) ||
+ XML_TEXT_TYPE_HEADER_FOOTER == eType )
+ {
+ pContext = new XMLVariableDeclsImportContext(
+ rImport, *this, nPrefix, rLocalName, VarTypeSimple);
+ bContent = sal_False;
+ }
+ break;
+
+ case XML_TOK_TEXT_USERFIELD_DECLS:
+ if ((XML_TEXT_TYPE_BODY == eType && m_pImpl->m_bBodyContentStarted)||
+ XML_TEXT_TYPE_HEADER_FOOTER == eType )
+ {
+ pContext = new XMLVariableDeclsImportContext(
+ rImport, *this, nPrefix, rLocalName, VarTypeUserField);
+ bContent = sal_False;
+ }
+ break;
+
+ case XML_TOK_TEXT_DDE_DECLS:
+ if ((XML_TEXT_TYPE_BODY == eType && m_pImpl->m_bBodyContentStarted) ||
+ XML_TEXT_TYPE_HEADER_FOOTER == eType )
+ {
+ pContext = new XMLDdeFieldDeclsImportContext(
+ rImport, nPrefix, rLocalName);
+ bContent = sal_False;
+ }
+ break;
+
+ case XML_TOK_TEXT_FRAME_PAGE:
+ if ((XML_TEXT_TYPE_BODY == eType && m_pImpl->m_bBodyContentStarted) ||
+ XML_TEXT_TYPE_TEXTBOX == eType ||
+ XML_TEXT_TYPE_CHANGED_REGION == eType )
+ {
+ TextContentAnchorType eAnchorType =
+ XML_TEXT_TYPE_TEXTBOX == eType ? TextContentAnchorType_AT_FRAME
+ : TextContentAnchorType_AT_PAGE;
+ pContext = new XMLTextFrameContext( rImport, nPrefix,
+ rLocalName, xAttrList,
+ eAnchorType );
+ bContent = sal_False;
+ }
+ break;
+
+ case XML_TOK_DRAW_A_PAGE:
+ if ((XML_TEXT_TYPE_BODY == eType && m_pImpl->m_bBodyContentStarted) ||
+ XML_TEXT_TYPE_TEXTBOX == eType ||
+ XML_TEXT_TYPE_CHANGED_REGION == eType)
+ {
+ TextContentAnchorType eAnchorType =
+ XML_TEXT_TYPE_TEXTBOX == eType ? TextContentAnchorType_AT_FRAME
+ : TextContentAnchorType_AT_PAGE;
+ pContext = new XMLTextFrameHyperlinkContext( rImport, nPrefix,
+ rLocalName, xAttrList,
+ eAnchorType );
+ bContent = sal_False;
+ }
+ break;
+
+ case XML_TOK_TEXT_INDEX_TITLE:
+ case XML_TOK_TEXT_SECTION:
+ pContext = new XMLSectionImportContext( rImport, nPrefix, rLocalName );
+ break;
+
+ case XML_TOK_TEXT_TOC:
+ case XML_TOK_TEXT_OBJECT_INDEX:
+ case XML_TOK_TEXT_TABLE_INDEX:
+ case XML_TOK_TEXT_ILLUSTRATION_INDEX:
+ case XML_TOK_TEXT_USER_INDEX:
+ case XML_TOK_TEXT_ALPHABETICAL_INDEX:
+ case XML_TOK_TEXT_BIBLIOGRAPHY_INDEX:
+ if( XML_TEXT_TYPE_SHAPE != eType )
+ pContext = new XMLIndexTOCContext( rImport, nPrefix, rLocalName );
+ break;
+
+ case XML_TOK_TEXT_TRACKED_CHANGES:
+ pContext = new XMLTrackedChangesImportContext( rImport, nPrefix,
+ rLocalName);
+ bContent = sal_False;
+ break;
+
+ case XML_TOK_TEXT_CHANGE:
+ case XML_TOK_TEXT_CHANGE_START:
+ case XML_TOK_TEXT_CHANGE_END:
+ pContext = new XMLChangeImportContext(
+ rImport, nPrefix, rLocalName,
+ (XML_TOK_TEXT_CHANGE_END != nToken),
+ (XML_TOK_TEXT_CHANGE_START != nToken),
+ sal_True);
+ break;
+
+ case XML_TOK_TEXT_FORMS:
+ pContext = rImport.GetFormImport()->createOfficeFormsContext(rImport, nPrefix, rLocalName);
+ bContent = sal_False;
+ break;
+
+ case XML_TOK_TEXT_AUTOMARK:
+ if( XML_TEXT_TYPE_BODY == eType )
+ {
+ pContext = new XMLAutoMarkFileContext(rImport, nPrefix,rLocalName);
+ }
+ bContent = sal_False;
+ break;
+
+ case XML_TOK_TEXT_CALCULATION_SETTINGS:
+ pContext = new XMLCalculationSettingsContext ( rImport, nPrefix, rLocalName, xAttrList);
+ bContent = sal_False;
+ break;
+
+ default:
+ if ((XML_TEXT_TYPE_BODY == eType && m_pImpl->m_bBodyContentStarted) ||
+ XML_TEXT_TYPE_TEXTBOX == eType ||
+ XML_TEXT_TYPE_CHANGED_REGION == eType )
+ {
+ Reference < XShapes > xShapes;
+ pContext = rImport.GetShapeImport()->CreateGroupChildContext(
+ rImport, nPrefix, rLocalName, xAttrList, xShapes );
+ bContent = sal_False;
+ }
+ }
+
+ // handle open redlines
+ if ( (XML_TOK_TEXT_CHANGE != nToken) &&
+ (XML_TOK_TEXT_CHANGE_END != nToken) &&
+ (XML_TOK_TEXT_CHANGE_START != nToken) )
+ {
+// ResetOpenRedlineId();
+ }
+
+ if( XML_TEXT_TYPE_BODY == eType && bContent )
+ {
+ m_pImpl->m_bBodyContentStarted = sal_False;
+ }
+
+ return pContext;
+}
+
+SvXMLImportContext *XMLTextImportHelper::CreateTableChildContext(
+ SvXMLImport&,
+ sal_uInt16 /*nPrefix*/, const OUString& /*rLocalName*/,
+ const Reference< XAttributeList > & )
+{
+ return 0;
+}
+
+/// get data style key for use with NumberFormat property
+sal_Int32 XMLTextImportHelper::GetDataStyleKey(const OUString& sStyleName,
+ sal_Bool* pIsSystemLanguage )
+{
+ const SvXMLStyleContext* pStyle =
+ ((SvXMLStylesContext *)&m_pImpl->m_xAutoStyles)->
+ FindStyleChildContext( XML_STYLE_FAMILY_DATA_STYLE,
+ sStyleName, sal_True );
+
+ // get appropriate context
+
+
+ // first check if its a impress and draw only number format
+ // this is needed since its also a SvXMLNumFormatContext,
+ // that was needed to support them for controls in impress/draw also
+ SdXMLNumberFormatImportContext* pSdNumStyle = PTR_CAST( SdXMLNumberFormatImportContext, pStyle );
+ if( pSdNumStyle )
+ {
+ return pSdNumStyle->GetDrawKey();
+ }
+ else
+ {
+ SvXMLNumFormatContext* pNumStyle = PTR_CAST( SvXMLNumFormatContext, pStyle );
+ if( pNumStyle )
+ {
+ if( pIsSystemLanguage != NULL )
+ *pIsSystemLanguage = pNumStyle->IsSystemLanguage();
+
+ // return key
+ return pNumStyle->GetKey();
+ }
+ }
+ return -1;
+}
+
+const SvxXMLListStyleContext *XMLTextImportHelper::FindAutoListStyle( const OUString& rName ) const
+{
+ const SvxXMLListStyleContext *pStyle = 0;
+ if (m_pImpl->m_xAutoStyles.Is())
+ {
+ const SvXMLStyleContext* pTempStyle =
+ ((SvXMLStylesContext *)&m_pImpl->m_xAutoStyles)->
+ FindStyleChildContext( XML_STYLE_FAMILY_TEXT_LIST, rName,
+ sal_True );
+ pStyle = PTR_CAST( SvxXMLListStyleContext ,pTempStyle);
+ }
+
+ return pStyle;
+}
+
+XMLPropStyleContext *XMLTextImportHelper::FindAutoFrameStyle( const OUString& rName ) const
+{
+ XMLPropStyleContext *pStyle = 0;
+ if (m_pImpl->m_xAutoStyles.Is())
+ {
+ const SvXMLStyleContext* pTempStyle =
+ ((SvXMLStylesContext *)&m_pImpl->m_xAutoStyles)->
+ FindStyleChildContext( XML_STYLE_FAMILY_SD_GRAPHICS_ID, rName,
+ sal_True );
+ pStyle = PTR_CAST( XMLPropStyleContext ,pTempStyle);
+ }
+
+ return pStyle;
+}
+
+XMLPropStyleContext* XMLTextImportHelper::FindSectionStyle(
+ const OUString& rName ) const
+{
+ XMLPropStyleContext* pStyle = NULL;
+ if (m_pImpl->m_xAutoStyles.Is())
+ {
+ const SvXMLStyleContext* pTempStyle =
+ ((SvXMLStylesContext *)&m_pImpl->m_xAutoStyles)->
+ FindStyleChildContext(
+ XML_STYLE_FAMILY_TEXT_SECTION,
+ rName, sal_True );
+ pStyle = PTR_CAST( XMLPropStyleContext,pTempStyle);
+ }
+
+ return pStyle;
+}
+
+XMLPropStyleContext* XMLTextImportHelper::FindPageMaster(
+ const OUString& rName ) const
+{
+ XMLPropStyleContext* pStyle = NULL;
+ if (m_pImpl->m_xAutoStyles.Is())
+ {
+ const SvXMLStyleContext* pTempStyle =
+ ((SvXMLStylesContext *)&m_pImpl->m_xAutoStyles)->
+ FindStyleChildContext(
+ XML_STYLE_FAMILY_PAGE_MASTER,
+ rName, sal_True );
+ pStyle = PTR_CAST( XMLPropStyleContext,pTempStyle);
+ }
+
+ return pStyle;
+}
+
+
+void XMLTextImportHelper::PushListContext(XMLTextListBlockContext *i_pListBlock)
+{
+ GetTextListHelper().PushListContext(i_pListBlock);
+}
+
+void XMLTextImportHelper::PopListContext()
+{
+ GetTextListHelper().PopListContext();
+}
+
+
+const SvXMLTokenMap& XMLTextImportHelper::GetTextNumberedParagraphAttrTokenMap()
+{
+ if (!m_pImpl->m_pTextNumberedParagraphAttrTokenMap.get())
+ {
+ m_pImpl->m_pTextNumberedParagraphAttrTokenMap.reset(
+ new SvXMLTokenMap( aTextNumberedParagraphAttrTokenMap ) );
+ }
+ return *m_pImpl->m_pTextNumberedParagraphAttrTokenMap;
+}
+
+const SvXMLTokenMap& XMLTextImportHelper::GetTextListBlockAttrTokenMap()
+{
+ if (!m_pImpl->m_pTextListBlockAttrTokenMap.get())
+ {
+ m_pImpl->m_pTextListBlockAttrTokenMap.reset(
+ new SvXMLTokenMap( aTextListBlockAttrTokenMap ) );
+ }
+ return *m_pImpl->m_pTextListBlockAttrTokenMap;
+}
+
+const SvXMLTokenMap& XMLTextImportHelper::GetTextListBlockElemTokenMap()
+{
+ if (!m_pImpl->m_pTextListBlockElemTokenMap.get())
+ {
+ m_pImpl->m_pTextListBlockElemTokenMap.reset(
+ new SvXMLTokenMap( aTextListBlockElemTokenMap ) );
+ }
+ return *m_pImpl->m_pTextListBlockElemTokenMap;
+}
+
+SvI18NMap& XMLTextImportHelper::GetRenameMap()
+{
+ if (!m_pImpl->m_pRenameMap.get())
+ {
+ m_pImpl->m_pRenameMap.reset( new SvI18NMap() );
+ }
+ return *m_pImpl->m_pRenameMap;
+}
+
+void XMLTextImportHelper::InsertBookmarkStartRange(
+ const OUString sName,
+ const Reference<XTextRange> & rRange,
+ OUString const& i_rXmlId,
+ ::boost::shared_ptr< ::xmloff::ParsedRDFaAttributes > & i_rpRDFaAttributes)
+{
+ m_pImpl->m_BookmarkStartRanges[sName] =
+ ::boost::make_tuple(rRange, i_rXmlId, i_rpRDFaAttributes);
+ m_pImpl->m_BookmarkVector.push_back(sName);
+}
+
+sal_Bool XMLTextImportHelper::FindAndRemoveBookmarkStartRange(
+ const OUString sName,
+ Reference<XTextRange> & o_rRange,
+ OUString & o_rXmlId,
+ ::boost::shared_ptr< ::xmloff::ParsedRDFaAttributes > & o_rpRDFaAttributes)
+{
+ if (m_pImpl->m_BookmarkStartRanges.count(sName))
+ {
+ Impl::BookmarkMapEntry_t & rEntry =
+ (*m_pImpl->m_BookmarkStartRanges.find(sName)).second;
+ o_rRange.set(rEntry.get<0>());
+ o_rXmlId = rEntry.get<1>();
+ o_rpRDFaAttributes = rEntry.get<2>();
+ m_pImpl->m_BookmarkStartRanges.erase(sName);
+ Impl::BookmarkVector_t::iterator it(m_pImpl->m_BookmarkVector.begin());
+ while (it != m_pImpl->m_BookmarkVector.end() && it->compareTo(sName)!=0)
+ {
+ it++;
+ }
+ if (it!=m_pImpl->m_BookmarkVector.end()) {
+ m_pImpl->m_BookmarkVector.erase(it);
+ }
+ return sal_True;
+ }
+ else
+ {
+ return sal_False;
+ }
+}
+
+::rtl::OUString XMLTextImportHelper::FindActiveBookmarkName()
+{
+ if (!m_pImpl->m_BookmarkVector.empty()) {
+ return m_pImpl->m_BookmarkVector.back();
+ } else return ::rtl::OUString(); // return the empty string on error...
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > XMLTextImportHelper::GetRangeFor(::rtl::OUString &sName)
+{
+ return m_pImpl->m_BookmarkStartRanges[sName].get<0>();
+}
+
+
+void XMLTextImportHelper::pushFieldCtx( ::rtl::OUString name, ::rtl::OUString type )
+{
+ m_pImpl->m_FieldStack.push(Impl::field_stack_item_t(
+ Impl::field_name_type_t(name, type), Impl::field_params_t()));
+}
+
+void XMLTextImportHelper::popFieldCtx()
+{
+ if ( !m_pImpl->m_FieldStack.empty() )
+ m_pImpl->m_FieldStack.pop();
+}
+
+void XMLTextImportHelper::addFieldParam( ::rtl::OUString name, ::rtl::OUString value )
+{
+ DBG_ASSERT(!m_pImpl->m_FieldStack.empty(),
+ "stack is empty: not good! Do a pushFieldCtx before...");
+ if (!m_pImpl->m_FieldStack.empty()) {
+ Impl::field_stack_item_t & FieldStackItem(m_pImpl->m_FieldStack.top());
+ FieldStackItem.second.push_back(Impl::field_param_t( name, value ));
+ }
+}
+::rtl::OUString XMLTextImportHelper::getCurrentFieldName()
+{
+ DBG_ASSERT(!m_pImpl->m_FieldStack.empty(),
+ "stack is empty: not good! Do a pushFieldCtx before...");
+ if (!m_pImpl->m_FieldStack.empty()) {
+ return m_pImpl->m_FieldStack.top().first.first;
+ } else return ::rtl::OUString();
+}
+
+::rtl::OUString XMLTextImportHelper::getCurrentFieldType()
+{
+ DBG_ASSERT(!m_pImpl->m_FieldStack.empty(),
+ "stack is empty: not good! Do a pushFieldCtx before...");
+ if (!m_pImpl->m_FieldStack.empty()) {
+ return m_pImpl->m_FieldStack.top().first.second;
+ } else return ::rtl::OUString();
+}
+
+bool XMLTextImportHelper::hasCurrentFieldCtx()
+{
+ return !m_pImpl->m_FieldStack.empty();
+}
+
+void XMLTextImportHelper::setCurrentFieldParamsTo(::com::sun::star::uno::Reference< ::com::sun::star::text::XFormField> &xFormField)
+{
+ DBG_ASSERT(!m_pImpl->m_FieldStack.empty(),
+ "stack is empty: not good! Do a pushFieldCtx before...");
+ if (!m_pImpl->m_FieldStack.empty() && xFormField.is())
+ {
+ FieldParamImporter(&m_pImpl->m_FieldStack.top().second,
+ xFormField->getParameters()).Import();
+ }
+}
+
+
+void XMLTextImportHelper::ConnectFrameChains(
+ const OUString& rFrmName,
+ const OUString& rNextFrmName,
+ const Reference < XPropertySet >& rFrmPropSet )
+{
+ static ::rtl::OUString s_ChainNextName(
+ RTL_CONSTASCII_USTRINGPARAM("ChainNextName"));
+ static ::rtl::OUString s_ChainPrevName(
+ RTL_CONSTASCII_USTRINGPARAM("ChainPrevName"));
+
+ if( !rFrmName.getLength() )
+ return;
+
+ if( rNextFrmName.getLength() )
+ {
+ OUString sNextFrmName(GetRenameMap().Get( XML_TEXT_RENAME_TYPE_FRAME,
+ rNextFrmName ));
+ if (m_pImpl->m_xTextFrames.is()
+ && m_pImpl->m_xTextFrames->hasByName(sNextFrmName))
+ {
+ rFrmPropSet->setPropertyValue(s_ChainNextName,
+ makeAny(sNextFrmName));
+ }
+ else
+ {
+ if (!m_pImpl->m_pPrevFrmNames.get())
+ {
+ m_pImpl->m_pPrevFrmNames.reset( new SvStringsDtor );
+ m_pImpl->m_pNextFrmNames.reset( new SvStringsDtor );
+ }
+ m_pImpl->m_pPrevFrmNames->Insert( new String( rFrmName ),
+ m_pImpl->m_pPrevFrmNames->Count() );
+ m_pImpl->m_pNextFrmNames->Insert( new String( sNextFrmName ),
+ m_pImpl->m_pNextFrmNames->Count() );
+ }
+ }
+ if (m_pImpl->m_pPrevFrmNames.get() && m_pImpl->m_pPrevFrmNames->Count())
+ {
+ sal_uInt16 nCount = m_pImpl->m_pPrevFrmNames->Count();
+ for( sal_uInt16 i=0; i<nCount; i++ )
+ {
+ String *pNext = (*m_pImpl->m_pNextFrmNames)[i];
+ if( OUString(*pNext) == rFrmName )
+ {
+ // The previuous frame must exist, because it existing than
+ // inserting the entry
+ String *pPrev = (*m_pImpl->m_pPrevFrmNames)[i];
+
+ rFrmPropSet->setPropertyValue(s_ChainPrevName,
+ makeAny(OUString( *pPrev )));
+
+ m_pImpl->m_pPrevFrmNames->Remove( i, 1 );
+ m_pImpl->m_pNextFrmNames->Remove( i, 1 );
+ delete pPrev;
+ delete pNext;
+
+ // There cannot be more than one previous frames
+ break;
+ }
+ }
+ }
+}
+
+sal_Bool XMLTextImportHelper::IsInFrame() const
+{
+ static ::rtl::OUString s_TextFrame(
+ RTL_CONSTASCII_USTRINGPARAM("TextFrame"));
+
+ sal_Bool bIsInFrame = sal_False;
+
+ // are we currently in a text frame? yes, if the cursor has a
+ // TextFrame property and it's non-NULL
+ Reference<XPropertySet> xPropSet(((XMLTextImportHelper *)this)->GetCursor(), UNO_QUERY);
+ if (xPropSet.is())
+ {
+ if (xPropSet->getPropertySetInfo()->hasPropertyByName(s_TextFrame))
+ {
+ uno::Reference<XTextFrame> const xFrame(
+ xPropSet->getPropertyValue(s_TextFrame), UNO_QUERY);
+
+ if (xFrame.is())
+ {
+ bIsInFrame = sal_True;
+ }
+ }
+ }
+
+ return bIsInFrame;
+}
+
+sal_Bool XMLTextImportHelper::IsInHeaderFooter() const
+{
+ return sal_False;
+}
+
+Reference< XPropertySet> XMLTextImportHelper::createAndInsertOLEObject(
+ SvXMLImport&,
+ const OUString& /*rHRef*/,
+ const OUString& /*rStyleName*/,
+ const OUString& /*rTblName*/,
+ sal_Int32 /*nWidth*/, sal_Int32 /*nHeight*/ )
+{
+ Reference< XPropertySet> xPropSet;
+ return xPropSet;
+}
+
+Reference< XPropertySet> XMLTextImportHelper::createAndInsertOOoLink(
+ SvXMLImport&,
+ const OUString& /*rHRef*/,
+ const OUString& /*rStyleName*/,
+ const OUString& /*rTblName*/,
+ sal_Int32 /*nWidth*/, sal_Int32 /*nHeight*/ )
+{
+ Reference< XPropertySet> xPropSet;
+ return xPropSet;
+}
+
+Reference< XPropertySet> XMLTextImportHelper::createAndInsertApplet(
+ const OUString& /*rCode*/,
+ const OUString& /*rName*/,
+ sal_Bool /*bMayScript*/,
+ const OUString& /*rHRef*/,
+ sal_Int32 /*nWidth*/, sal_Int32 /*nHeight*/ )
+{
+ Reference< XPropertySet> xPropSet;
+ return xPropSet;
+}
+Reference< XPropertySet> XMLTextImportHelper::createAndInsertPlugin(
+ const OUString& /*rMimeType*/,
+ const OUString& /*rHRef*/,
+ sal_Int32 /*nWidth*/, sal_Int32 /*nHeight*/ )
+{
+ Reference< XPropertySet> xPropSet;
+ return xPropSet;
+}
+Reference< XPropertySet> XMLTextImportHelper::createAndInsertFloatingFrame(
+ const OUString& /*rName*/,
+ const OUString& /*rHRef*/,
+ const OUString& /*rStyleName*/,
+ sal_Int32 /*nWidth*/, sal_Int32 /*nHeight*/ )
+{
+ Reference< XPropertySet> xPropSet;
+ return xPropSet;
+}
+
+void XMLTextImportHelper::endAppletOrPlugin(
+ const Reference < XPropertySet> &,
+ std::map < const rtl::OUString, rtl::OUString, UStringLess > &)
+{
+}
+// redline helper: dummy implementation to be overridden in sw/filter/xml
+void XMLTextImportHelper::RedlineAdd(
+ const OUString& /*rType*/,
+ const OUString& /*rId*/,
+ const OUString& /*rAuthor*/,
+ const OUString& /*rComment*/,
+ const DateTime& /*rDateTime*/,
+ sal_Bool /*bMergeLastPara*/)
+{
+ // dummy implementation: do nothing
+}
+
+Reference<XTextCursor> XMLTextImportHelper::RedlineCreateText(
+ Reference<XTextCursor> & /*rOldCursor*/,
+ const OUString& /*rId*/)
+{
+ // dummy implementation: do nothing
+ Reference<XTextCursor> xRet;
+ return xRet;
+}
+
+void XMLTextImportHelper::RedlineSetCursor(
+ const OUString& /*rId*/,
+ sal_Bool /*bStart*/,
+ sal_Bool /*bIsOutsideOfParagraph*/)
+{
+ // dummy implementation: do nothing
+}
+
+void XMLTextImportHelper::RedlineAdjustStartNodeCursor(sal_Bool)
+{
+ // dummy implementation: do nothing
+}
+
+void XMLTextImportHelper::SetShowChanges( sal_Bool )
+{
+ // dummy implementation: do nothing
+}
+
+void XMLTextImportHelper::SetRecordChanges( sal_Bool )
+{
+ // dummy implementation: do nothing
+}
+void XMLTextImportHelper::SetChangesProtectionKey(const Sequence<sal_Int8> &)
+{
+ // dummy implementation: do nothing
+}
+
+
+OUString XMLTextImportHelper::GetOpenRedlineId()
+{
+ return m_pImpl->m_sOpenRedlineIdentifier;
+}
+
+void XMLTextImportHelper::SetOpenRedlineId( ::rtl::OUString& rId)
+{
+ m_pImpl->m_sOpenRedlineIdentifier = rId;
+}
+
+void XMLTextImportHelper::ResetOpenRedlineId()
+{
+ OUString sEmpty;
+ SetOpenRedlineId(sEmpty);
+}
+
+void
+XMLTextImportHelper::SetCellParaStyleDefault(::rtl::OUString const& rNewValue)
+{
+ m_pImpl->m_sCellParaStyleDefault = rNewValue;
+}
+
+::rtl::OUString const& XMLTextImportHelper::GetCellParaStyleDefault()
+{
+ return m_pImpl->m_sCellParaStyleDefault;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/txtimppr.cxx b/xmloff/source/text/txtimppr.cxx
new file mode 100644
index 000000000000..6a16693078e2
--- /dev/null
+++ b/xmloff/source/text/txtimppr.cxx
@@ -0,0 +1,673 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#include <com/sun/star/awt/FontFamily.hpp>
+#include <com/sun/star/awt/FontPitch.hpp>
+#include <com/sun/star/table/BorderLine2.hpp>
+#include <com/sun/star/text/VertOrientation.hpp>
+#include <com/sun/star/text/SizeType.hpp>
+#include <tools/string.hxx>
+#include <xmloff/XMLFontStylesContext.hxx>
+#include <xmloff/txtprmap.hxx>
+#include <xmloff/xmlimp.hxx>
+#include "xmloff/txtimppr.hxx"
+
+#define XML_LINE_LEFT 0
+#define XML_LINE_RIGHT 1
+#define XML_LINE_TOP 2
+#define XML_LINE_BOTTOM 3
+#define MIN_BORDER_DIST 49
+
+using ::rtl::OUString;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::text;
+
+bool XMLTextImportPropertyMapper::handleSpecialItem(
+ XMLPropertyState& rProperty,
+ ::std::vector< XMLPropertyState >& rProperties,
+ const ::rtl::OUString& rValue,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int32 nIndex = rProperty.mnIndex;
+ switch( getPropertySetMapper()->GetEntryContextId( nIndex ) )
+ {
+ case CTF_FONTNAME:
+ case CTF_FONTNAME_CJK:
+ case CTF_FONTNAME_CTL:
+ if( xFontDecls.Is() )
+ {
+ DBG_ASSERT(
+ ( CTF_FONTFAMILYNAME ==
+ getPropertySetMapper()->GetEntryContextId(nIndex+1) &&
+ CTF_FONTSTYLENAME ==
+ getPropertySetMapper()->GetEntryContextId(nIndex+2) &&
+ CTF_FONTFAMILY ==
+ getPropertySetMapper()->GetEntryContextId(nIndex+3) &&
+ CTF_FONTPITCH ==
+ getPropertySetMapper()->GetEntryContextId(nIndex+4) &&
+ CTF_FONTCHARSET ==
+ getPropertySetMapper()->GetEntryContextId(nIndex+5) ) ||
+ ( CTF_FONTFAMILYNAME_CJK ==
+ getPropertySetMapper()->GetEntryContextId(nIndex+1) &&
+ CTF_FONTSTYLENAME_CJK ==
+ getPropertySetMapper()->GetEntryContextId(nIndex+2) &&
+ CTF_FONTFAMILY_CJK ==
+ getPropertySetMapper()->GetEntryContextId(nIndex+3) &&
+ CTF_FONTPITCH_CJK ==
+ getPropertySetMapper()->GetEntryContextId(nIndex+4) &&
+ CTF_FONTCHARSET_CJK ==
+ getPropertySetMapper()->GetEntryContextId(nIndex+5) ) ||
+ ( CTF_FONTFAMILYNAME_CTL ==
+ getPropertySetMapper()->GetEntryContextId(nIndex+1) &&
+ CTF_FONTSTYLENAME_CTL ==
+ getPropertySetMapper()->GetEntryContextId(nIndex+2) &&
+ CTF_FONTFAMILY_CTL ==
+ getPropertySetMapper()->GetEntryContextId(nIndex+3) &&
+ CTF_FONTPITCH_CTL ==
+ getPropertySetMapper()->GetEntryContextId(nIndex+4) &&
+ CTF_FONTCHARSET_CTL ==
+ getPropertySetMapper()->GetEntryContextId(nIndex+5) ),
+ "illegal property map" );
+
+ ((XMLFontStylesContext *)&xFontDecls)->FillProperties(
+ rValue, rProperties,
+ rProperty.mnIndex+1, rProperty.mnIndex+2,
+ rProperty.mnIndex+3, rProperty.mnIndex+4,
+ rProperty.mnIndex+5 );
+ bRet = sal_False; // the property hasn't been filled
+ }
+ break;
+
+ // If we want to do StarMath/StarSymbol font conversion, then we'll
+ // want these special items to be treated just like regular ones...
+ // For the Writer, we'll catch and convert them in _FillPropertySet;
+ // the other apps probably don't care. For the other apps, we just
+ // imitate the default non-special-item mechanism.
+ case CTF_FONTFAMILYNAME:
+ case CTF_FONTFAMILYNAME_CJK:
+ case CTF_FONTFAMILYNAME_CTL:
+ bRet = getPropertySetMapper()->importXML( rValue, rProperty,
+ rUnitConverter );
+ break;
+
+ case CTF_TEXT_DISPLAY:
+ bRet = getPropertySetMapper()->importXML( rValue, rProperty,
+ rUnitConverter );
+ if( SvXMLImport::OOo_2x == GetImport().getGeneratorVersion() )
+ {
+ sal_Bool bHidden;
+ rProperty.maValue >>= bHidden;
+ bHidden = !bHidden;
+ rProperty.maValue <<= bHidden;
+ }
+ break;
+ default:
+ bRet = SvXMLImportPropertyMapper::handleSpecialItem( rProperty,
+ rProperties, rValue, rUnitConverter, rNamespaceMap );
+ break;
+ }
+
+ return bRet;
+}
+
+XMLTextImportPropertyMapper::XMLTextImportPropertyMapper(
+ const UniReference< XMLPropertySetMapper >& rMapper,
+ SvXMLImport& rImp,
+ XMLFontStylesContext *pFontDecls ) :
+ SvXMLImportPropertyMapper( rMapper, rImp ),
+ nSizeTypeIndex( -2 ),
+ nWidthTypeIndex( -2 ),
+ xFontDecls( pFontDecls )
+{
+}
+
+XMLTextImportPropertyMapper::~XMLTextImportPropertyMapper()
+{
+}
+
+void XMLTextImportPropertyMapper::SetFontDecls(
+ XMLFontStylesContext *pFontDecls )
+{
+ xFontDecls = pFontDecls;
+}
+
+void XMLTextImportPropertyMapper::FontFinished(
+ XMLPropertyState *pFontFamilyNameState,
+ XMLPropertyState *pFontStyleNameState,
+ XMLPropertyState *pFontFamilyState,
+ XMLPropertyState *pFontPitchState,
+ XMLPropertyState *pFontCharsetState ) const
+{
+ if( pFontFamilyNameState && pFontFamilyNameState->mnIndex != -1 )
+ {
+ OUString sName;
+ pFontFamilyNameState->maValue >>= sName;
+ if( !sName.getLength() )
+ pFontFamilyNameState->mnIndex = -1;
+ }
+ if( !pFontFamilyNameState || pFontFamilyNameState->mnIndex == -1 )
+ {
+ if( pFontStyleNameState )
+ pFontStyleNameState->mnIndex = -1;
+ if( pFontFamilyState )
+ pFontFamilyState->mnIndex = -1;
+ if( pFontPitchState )
+ pFontPitchState->mnIndex = -1;
+ if( pFontCharsetState )
+ pFontCharsetState->mnIndex = -1;
+ }
+}
+
+/** since the properties "CharFontFamilyName", "CharFontStyleName", "CharFontFamily",
+ "CharFontPitch" and "CharFontSet" and theire CJK and CTL counterparts are only
+ usable as a union, we add defaults to all values that are not set as long as we
+ have an "CharFontFamilyName"
+
+ #99928# CL */
+void XMLTextImportPropertyMapper::FontDefaultsCheck(
+ XMLPropertyState* pFontFamilyName,
+ XMLPropertyState* pFontStyleName,
+ XMLPropertyState* pFontFamily,
+ XMLPropertyState* pFontPitch,
+ XMLPropertyState* pFontCharSet,
+ XMLPropertyState** ppNewFontStyleName,
+ XMLPropertyState** ppNewFontFamily,
+ XMLPropertyState** ppNewFontPitch,
+ XMLPropertyState** ppNewFontCharSet ) const
+{
+ if( pFontFamilyName )
+ {
+ OUString sEmpty;
+ Any aAny;
+
+ if( !pFontStyleName )
+ {
+ aAny <<= sEmpty;
+ #ifdef DBG_UTIL
+ sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId(
+ pFontFamilyName->mnIndex + 1 );
+ DBG_ASSERT( nTmp == CTF_FONTSTYLENAME || nTmp == CTF_FONTSTYLENAME_CJK || nTmp == CTF_FONTSTYLENAME_CTL,
+ "wrong property context id" );
+ #endif
+ *ppNewFontStyleName = new XMLPropertyState( pFontFamilyName->mnIndex + 1,
+ aAny );
+ }
+
+ if( !pFontFamily )
+ {
+ aAny <<= (sal_Int16)com::sun::star::awt::FontFamily::DONTKNOW;
+
+ #ifdef DBG_UTIL
+ sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId(
+ pFontFamilyName->mnIndex + 2 );
+ DBG_ASSERT( nTmp == CTF_FONTFAMILY || nTmp == CTF_FONTFAMILY_CJK || nTmp == CTF_FONTFAMILY_CTL,
+ "wrong property context id" );
+ #endif
+ *ppNewFontFamily = new XMLPropertyState( pFontFamilyName->mnIndex + 2,
+ aAny );
+ }
+
+ if( !pFontPitch )
+ {
+ aAny <<= (sal_Int16)com::sun::star::awt::FontPitch::DONTKNOW;
+ #ifdef DBG_UTIL
+ sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId(
+ pFontFamilyName->mnIndex + 3 );
+ DBG_ASSERT( nTmp == CTF_FONTPITCH || nTmp == CTF_FONTPITCH_CJK || nTmp == CTF_FONTPITCH_CTL,
+ "wrong property context id" );
+ #endif
+ *ppNewFontPitch = new XMLPropertyState( pFontFamilyName->mnIndex + 3,
+ aAny );
+ }
+
+ if( !pFontCharSet )
+ {
+ aAny <<= (sal_Int16)gsl_getSystemTextEncoding();
+ #ifdef DBG_UTIL
+ sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId(
+ pFontFamilyName->mnIndex + 4 );
+ DBG_ASSERT( nTmp == CTF_FONTCHARSET || nTmp == CTF_FONTCHARSET_CJK || nTmp == CTF_FONTCHARSET_CTL,
+ "wrong property context id" );
+ #endif
+ *ppNewFontCharSet = new XMLPropertyState( pFontFamilyName->mnIndex + 4,
+ aAny );
+ }
+ }
+}
+
+void XMLTextImportPropertyMapper::finished(
+ ::std::vector< XMLPropertyState >& rProperties,
+ sal_Int32 /*nStartIndex*/, sal_Int32 /*nEndIndex*/ ) const
+{
+ sal_Bool bHasAnyHeight = sal_False;
+ sal_Bool bHasAnyMinHeight = sal_False;
+ sal_Bool bHasAnyWidth = sal_False;
+ sal_Bool bHasAnyMinWidth = sal_False;
+
+ XMLPropertyState* pFontFamilyName = 0;
+ XMLPropertyState* pFontStyleName = 0;
+ XMLPropertyState* pFontFamily = 0;
+ XMLPropertyState* pFontPitch = 0;
+ XMLPropertyState* pFontCharSet = 0;
+ XMLPropertyState* pNewFontStyleName = 0;
+ XMLPropertyState* pNewFontFamily = 0;
+ XMLPropertyState* pNewFontPitch = 0;
+ XMLPropertyState* pNewFontCharSet = 0;
+ XMLPropertyState* pFontFamilyNameCJK = 0;
+ XMLPropertyState* pFontStyleNameCJK = 0;
+ XMLPropertyState* pFontFamilyCJK = 0;
+ XMLPropertyState* pFontPitchCJK = 0;
+ XMLPropertyState* pFontCharSetCJK = 0;
+ XMLPropertyState* pNewFontStyleNameCJK = 0;
+ XMLPropertyState* pNewFontFamilyCJK = 0;
+ XMLPropertyState* pNewFontPitchCJK = 0;
+ XMLPropertyState* pNewFontCharSetCJK = 0;
+ XMLPropertyState* pFontFamilyNameCTL = 0;
+ XMLPropertyState* pFontStyleNameCTL = 0;
+ XMLPropertyState* pFontFamilyCTL = 0;
+ XMLPropertyState* pFontPitchCTL = 0;
+ XMLPropertyState* pFontCharSetCTL = 0;
+ XMLPropertyState* pNewFontStyleNameCTL = 0;
+ XMLPropertyState* pNewFontFamilyCTL = 0;
+ XMLPropertyState* pNewFontPitchCTL = 0;
+ XMLPropertyState* pNewFontCharSetCTL = 0;
+ XMLPropertyState* pAllBorderDistance = 0;
+ XMLPropertyState* pBorderDistances[4] = { 0, 0, 0, 0 };
+ XMLPropertyState* pNewBorderDistances[4] = { 0, 0, 0, 0 };
+ XMLPropertyState* pAllBorder = 0;
+ XMLPropertyState* pBorders[4] = { 0, 0, 0, 0 };
+ XMLPropertyState* pNewBorders[4] = { 0, 0, 0, 0 };
+ XMLPropertyState* pAllBorderWidth = 0;
+ XMLPropertyState* pBorderWidths[4] = { 0, 0, 0, 0 };
+ XMLPropertyState* pVertOrient = 0;
+ XMLPropertyState* pVertOrientRelAsChar = 0;
+ XMLPropertyState* pBackTransparency = NULL; // transparency in %
+ XMLPropertyState* pBackTransparent = NULL; // transparency as boolean
+ sal_uInt16 i; // for the "for" loop
+
+ for( ::std::vector< XMLPropertyState >::iterator aIter = rProperties.begin();
+ aIter != rProperties.end();
+ ++aIter )
+ {
+ XMLPropertyState* property = &(*aIter);
+ if( -1 == property->mnIndex )
+ continue;
+
+ switch( getPropertySetMapper()->GetEntryContextId( property->mnIndex ) )
+ {
+ case CTF_FONTFAMILYNAME: pFontFamilyName = property; break;
+ case CTF_FONTSTYLENAME: pFontStyleName = property; break;
+ case CTF_FONTFAMILY: pFontFamily = property; break;
+ case CTF_FONTPITCH: pFontPitch = property; break;
+ case CTF_FONTCHARSET: pFontCharSet = property; break;
+
+ case CTF_FONTFAMILYNAME_CJK: pFontFamilyNameCJK = property; break;
+ case CTF_FONTSTYLENAME_CJK: pFontStyleNameCJK = property; break;
+ case CTF_FONTFAMILY_CJK: pFontFamilyCJK = property; break;
+ case CTF_FONTPITCH_CJK: pFontPitchCJK = property; break;
+ case CTF_FONTCHARSET_CJK: pFontCharSetCJK = property; break;
+
+ case CTF_FONTFAMILYNAME_CTL: pFontFamilyNameCTL = property; break;
+ case CTF_FONTSTYLENAME_CTL: pFontStyleNameCTL = property; break;
+ case CTF_FONTFAMILY_CTL: pFontFamilyCTL = property; break;
+ case CTF_FONTPITCH_CTL: pFontPitchCTL = property; break;
+ case CTF_FONTCHARSET_CTL: pFontCharSetCTL = property; break;
+
+ case CTF_ALLBORDERDISTANCE: pAllBorderDistance = property; break;
+ case CTF_LEFTBORDERDISTANCE: pBorderDistances[XML_LINE_LEFT] = property; break;
+ case CTF_RIGHTBORDERDISTANCE: pBorderDistances[XML_LINE_RIGHT] = property; break;
+ case CTF_TOPBORDERDISTANCE: pBorderDistances[XML_LINE_TOP] = property; break;
+ case CTF_BOTTOMBORDERDISTANCE: pBorderDistances[XML_LINE_BOTTOM] = property; break;
+ case CTF_ALLBORDER: pAllBorder = property; break;
+ case CTF_LEFTBORDER: pBorders[XML_LINE_LEFT] = property; break;
+ case CTF_RIGHTBORDER: pBorders[XML_LINE_RIGHT] = property; break;
+ case CTF_TOPBORDER: pBorders[XML_LINE_TOP] = property; break;
+ case CTF_BOTTOMBORDER: pBorders[XML_LINE_BOTTOM] = property; break;
+
+ case CTF_ALLBORDERWIDTH: pAllBorderWidth = property; break;
+ case CTF_LEFTBORDERWIDTH: pBorderWidths[XML_LINE_LEFT] = property; break;
+ case CTF_RIGHTBORDERWIDTH: pBorderWidths[XML_LINE_RIGHT] = property; break;
+ case CTF_TOPBORDERWIDTH: pBorderWidths[XML_LINE_TOP] = property; break;
+ case CTF_BOTTOMBORDERWIDTH: pBorderWidths[XML_LINE_BOTTOM] = property; break;
+ case CTF_ANCHORTYPE: break;
+ case CTF_VERTICALPOS: pVertOrient = property; break;
+ case CTF_VERTICALREL_ASCHAR: pVertOrientRelAsChar = property; break;
+
+ case CTF_FRAMEHEIGHT_MIN_ABS:
+ case CTF_FRAMEHEIGHT_MIN_REL:
+// case CTF_SYNCHEIGHT_MIN:
+ bHasAnyMinHeight = sal_True;
+ // no break here!
+ case CTF_FRAMEHEIGHT_ABS:
+ case CTF_FRAMEHEIGHT_REL:
+// case CTF_SYNCHEIGHT:
+ bHasAnyHeight = sal_True; break;
+ case CTF_FRAMEWIDTH_MIN_ABS:
+ case CTF_FRAMEWIDTH_MIN_REL:
+ bHasAnyMinWidth = sal_True;
+ // no break here!
+ case CTF_FRAMEWIDTH_ABS:
+ case CTF_FRAMEWIDTH_REL:
+ bHasAnyWidth = sal_True; break;
+ case CTF_BACKGROUND_TRANSPARENCY: pBackTransparency = property; break;
+ case CTF_BACKGROUND_TRANSPARENT: pBackTransparent = property; break;
+
+ }
+ }
+
+ if( pFontFamilyName || pFontStyleName || pFontFamily ||
+ pFontPitch || pFontCharSet )
+ FontFinished( pFontFamilyName, pFontStyleName, pFontFamily,
+ pFontPitch, pFontCharSet );
+ if( pFontFamilyNameCJK || pFontStyleNameCJK || pFontFamilyCJK ||
+ pFontPitchCJK || pFontCharSetCJK )
+ FontFinished( pFontFamilyNameCJK, pFontStyleNameCJK, pFontFamilyCJK,
+ pFontPitchCJK, pFontCharSetCJK );
+ if( pFontFamilyNameCTL || pFontStyleNameCTL || pFontFamilyCTL ||
+ pFontPitchCTL || pFontCharSetCTL )
+ FontFinished( pFontFamilyNameCTL, pFontStyleNameCTL, pFontFamilyCTL,
+ pFontPitchCTL, pFontCharSetCTL );
+
+ for( i = 0; i < 4; i++ )
+ {
+ if( pAllBorderDistance && !pBorderDistances[i] )
+ {
+#ifdef DBG_UTIL
+ sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId(
+ pAllBorderDistance->mnIndex + i + 1 );
+ DBG_ASSERT( nTmp >= CTF_LEFTBORDERDISTANCE &&
+ nTmp <= CTF_BOTTOMBORDERDISTANCE,
+ "wrong property context id" );
+#endif
+ pNewBorderDistances[i] =
+ new XMLPropertyState( pAllBorderDistance->mnIndex + i + 1,
+ pAllBorderDistance->maValue );
+ pBorderDistances[i] = pNewBorderDistances[i];
+ }
+ if( pAllBorder && !pBorders[i] )
+ {
+#ifdef DBG_UTIL
+ sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId(
+ pAllBorder->mnIndex + i + 1 );
+ DBG_ASSERT( nTmp >= CTF_LEFTBORDER && nTmp <= CTF_BOTTOMBORDER,
+ "wrong property context id" );
+#endif
+ pNewBorders[i] = new XMLPropertyState( pAllBorder->mnIndex + i + 1,
+ pAllBorder->maValue );
+ pBorders[i] = pNewBorders[i];
+ }
+ if( !pBorderWidths[i] )
+ pBorderWidths[i] = pAllBorderWidth;
+ else
+ pBorderWidths[i]->mnIndex = -1;
+
+ if( pBorders[i] && pBorderWidths[i] )
+ {
+ table::BorderLine2 aBorderLine;
+ pBorders[i]->maValue >>= aBorderLine;
+
+ table::BorderLine2 aBorderLineWidth;
+ pBorderWidths[i]->maValue >>= aBorderLineWidth;
+
+ aBorderLine.OuterLineWidth = aBorderLineWidth.OuterLineWidth;
+ aBorderLine.InnerLineWidth = aBorderLineWidth.InnerLineWidth;
+ aBorderLine.LineDistance = aBorderLineWidth.LineDistance;
+ aBorderLine.LineWidth = aBorderLineWidth.LineWidth;
+
+ pBorders[i]->maValue <<= aBorderLine;
+ }
+ }
+ if( pAllBorderDistance )
+ pAllBorderDistance->mnIndex = -1;
+
+ if( pAllBorder )
+ pAllBorder->mnIndex = -1;
+
+ if( pAllBorderWidth )
+ pAllBorderWidth->mnIndex = -1;
+
+ if( pVertOrient && pVertOrientRelAsChar )
+ {
+ sal_Int16 nVertOrient;
+ pVertOrient->maValue >>= nVertOrient;
+ sal_Int16 nVertOrientRel = 0;
+ pVertOrientRelAsChar->maValue >>= nVertOrientRel;
+ switch( nVertOrient )
+ {
+ case VertOrientation::TOP:
+ nVertOrient = nVertOrientRel;
+ break;
+ case VertOrientation::CENTER:
+ switch( nVertOrientRel )
+ {
+ case VertOrientation::CHAR_TOP:
+ nVertOrient = VertOrientation::CHAR_CENTER;
+ break;
+ case VertOrientation::LINE_TOP:
+ nVertOrient = VertOrientation::LINE_CENTER;
+ break;
+ }
+ break;
+ case VertOrientation::BOTTOM:
+ switch( nVertOrientRel )
+ {
+ case VertOrientation::CHAR_TOP:
+ nVertOrient = VertOrientation::CHAR_BOTTOM;
+ break;
+ case VertOrientation::LINE_TOP:
+ nVertOrient = VertOrientation::LINE_BOTTOM;
+ break;
+ }
+ break;
+ }
+ pVertOrient->maValue <<= nVertOrient;
+ pVertOrientRelAsChar->mnIndex = -1;
+ }
+
+ FontDefaultsCheck( pFontFamilyName,
+ pFontStyleName, pFontFamily, pFontPitch, pFontCharSet,
+ &pNewFontStyleName, &pNewFontFamily, &pNewFontPitch, &pNewFontCharSet );
+
+ FontDefaultsCheck( pFontFamilyNameCJK,
+ pFontStyleNameCJK, pFontFamilyCJK, pFontPitchCJK, pFontCharSetCJK,
+ &pNewFontStyleNameCJK, &pNewFontFamilyCJK, &pNewFontPitchCJK, &pNewFontCharSetCJK );
+
+ FontDefaultsCheck( pFontFamilyNameCTL,
+ pFontStyleNameCTL, pFontFamilyCTL, pFontPitchCTL, pFontCharSetCTL,
+ &pNewFontStyleNameCTL, &pNewFontFamilyCTL, &pNewFontPitchCTL, &pNewFontCharSetCTL );
+
+ // #i5775# don't overwrite %transparency with binary transparency
+ if( ( pBackTransparency != NULL ) && ( pBackTransparent != NULL ) )
+ {
+ if( ! *(sal_Bool*)(pBackTransparent->maValue.getValue()) )
+ pBackTransparent->mnIndex = -1;
+ }
+
+
+ // insert newly created properties. This inavlidates all iterators!
+ // Most of the pXXX variables in this method are iterators and will be
+ // invalidated!!!
+
+ if( pNewFontStyleName )
+ {
+ rProperties.push_back( *pNewFontStyleName );
+ delete pNewFontStyleName;
+ }
+
+ if( pNewFontFamily )
+ {
+ rProperties.push_back( *pNewFontFamily );
+ delete pNewFontFamily;
+ }
+
+ if( pNewFontPitch )
+ {
+ rProperties.push_back( *pNewFontPitch );
+ delete pNewFontPitch;
+ }
+
+ if( pNewFontCharSet )
+ {
+ rProperties.push_back( *pNewFontCharSet );
+ delete pNewFontCharSet;
+ }
+
+ if( pNewFontStyleNameCJK )
+ {
+ rProperties.push_back( *pNewFontStyleNameCJK );
+ delete pNewFontStyleNameCJK;
+ }
+
+ if( pNewFontFamilyCJK )
+ {
+ rProperties.push_back( *pNewFontFamilyCJK );
+ delete pNewFontFamilyCJK;
+ }
+
+ if( pNewFontPitchCJK )
+ {
+ rProperties.push_back( *pNewFontPitchCJK );
+ delete pNewFontPitchCJK;
+ }
+
+ if( pNewFontCharSetCJK )
+ {
+ rProperties.push_back( *pNewFontCharSetCJK );
+ delete pNewFontCharSetCJK;
+ }
+
+ if( pNewFontStyleNameCTL)
+ {
+ rProperties.push_back( *pNewFontStyleNameCTL );
+ delete pNewFontStyleNameCTL;
+ }
+
+ if( pNewFontFamilyCTL )
+ {
+ rProperties.push_back( *pNewFontFamilyCTL );
+ delete pNewFontFamilyCTL;
+ }
+
+ if( pNewFontPitchCTL )
+ {
+ rProperties.push_back( *pNewFontPitchCTL );
+ delete pNewFontPitchCTL;
+ }
+
+ if( pNewFontCharSetCTL )
+ {
+ rProperties.push_back( *pNewFontCharSetCTL );
+ delete pNewFontCharSetCTL;
+ }
+
+ for( i=0; i<4; i++ )
+ {
+ if( pNewBorderDistances[i] )
+ {
+ rProperties.push_back( *pNewBorderDistances[i] );
+ delete pNewBorderDistances[i];
+ }
+ if( pNewBorders[i] )
+ {
+ rProperties.push_back( *pNewBorders[i] );
+ delete pNewBorders[i];
+ }
+ }
+
+ if( bHasAnyHeight )
+ {
+ if( nSizeTypeIndex == -2 )
+ {
+ const_cast < XMLTextImportPropertyMapper * > ( this )
+ ->nSizeTypeIndex = -1;
+ sal_Int32 nPropCount = getPropertySetMapper()->GetEntryCount();
+ for( sal_Int32 j=0; j < nPropCount; j++ )
+ {
+ if( CTF_SIZETYPE == getPropertySetMapper()
+ ->GetEntryContextId( j ) )
+ {
+ const_cast < XMLTextImportPropertyMapper * > ( this )
+ ->nSizeTypeIndex = j;
+ break;
+ }
+ }
+ }
+ if( nSizeTypeIndex != -1 )
+ {
+ XMLPropertyState aSizeTypeState( nSizeTypeIndex );
+ aSizeTypeState.maValue <<= (sal_Int16)( bHasAnyMinHeight
+ ? SizeType::MIN
+ : SizeType::FIX);
+ rProperties.push_back( aSizeTypeState );
+ }
+ }
+
+ if( bHasAnyWidth )
+ {
+ if( nWidthTypeIndex == -2 )
+ {
+ const_cast < XMLTextImportPropertyMapper * > ( this )
+ ->nWidthTypeIndex = -1;
+ sal_Int32 nCount = getPropertySetMapper()->GetEntryCount();
+ for( sal_Int32 j=0; j < nCount; j++ )
+ {
+ if( CTF_FRAMEWIDTH_TYPE == getPropertySetMapper()
+ ->GetEntryContextId( j ) )
+ {
+ const_cast < XMLTextImportPropertyMapper * > ( this )
+ ->nWidthTypeIndex = j;
+ break;
+ }
+ }
+ }
+ if( nWidthTypeIndex != -1 )
+ {
+ XMLPropertyState aSizeTypeState( nWidthTypeIndex );
+ aSizeTypeState.maValue <<= (sal_Int16)( bHasAnyMinWidth
+ ? SizeType::MIN
+ : SizeType::FIX);
+ rProperties.push_back( aSizeTypeState );
+ }
+ }
+
+ // DO NOT USE ITERATORS/POINTERS INTO THE rProperties-VECTOR AFTER
+ // THIS LINE. All iterators into the rProperties-vector, especially all
+ // pXXX-type variables set in the first switch statement of this method,
+ // may have been invalidated by the above push_back() calls!
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/txtlists.cxx b/xmloff/source/text/txtlists.cxx
new file mode 100644
index 000000000000..58bedf74ee81
--- /dev/null
+++ b/xmloff/source/text/txtlists.cxx
@@ -0,0 +1,520 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_xmloff.hxx"
+
+#include <txtlists.hxx>
+
+#include <tools/debug.hxx>
+#include <tools/date.hxx>
+#include <tools/time.hxx>
+
+#include <xmloff/txtimp.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmlnumi.hxx>
+
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include "XMLTextListItemContext.hxx"
+#include "XMLTextListBlockContext.hxx"
+#include "txtparai.hxx"
+
+
+using namespace ::com::sun::star;
+
+
+XMLTextListsHelper::XMLTextListsHelper()
+ : mpProcessedLists( 0 ),
+ msLastProcessedListId(),
+ msListStyleOfLastProcessedList(),
+ // Inconsistent behavior regarding lists (#i92811#)
+ mpMapListIdToListStyleDefaultListId( 0 ),
+ mpContinuingLists( 0 ),
+ mpListStack( 0 )
+{
+}
+
+XMLTextListsHelper::~XMLTextListsHelper()
+{
+ if ( mpProcessedLists )
+ {
+ mpProcessedLists->clear();
+ delete mpProcessedLists;
+ }
+ // Inconsistent behavior regarding lists (#i92811#)#
+ if ( mpMapListIdToListStyleDefaultListId )
+ {
+ mpMapListIdToListStyleDefaultListId->clear();
+ delete mpMapListIdToListStyleDefaultListId;
+ }
+ if ( mpContinuingLists )
+ {
+ mpContinuingLists->clear();
+ delete mpContinuingLists;
+ }
+ if ( mpListStack )
+ {
+ mpListStack->clear();
+ delete mpListStack;
+ }
+}
+
+void XMLTextListsHelper::PushListContext(
+ XMLTextListBlockContext *i_pListBlock)
+{
+// fprintf(stderr, "PushListContext\n");
+ mListStack.push(::boost::make_tuple(i_pListBlock,
+ static_cast<XMLTextListItemContext*>(0),
+ static_cast<XMLNumberedParaContext*>(0)));
+}
+
+void XMLTextListsHelper::PushListContext(
+ XMLNumberedParaContext *i_pNumberedParagraph)
+{
+// fprintf(stderr, "PushListContext(NP)\n");
+ mListStack.push(::boost::make_tuple(
+ static_cast<XMLTextListBlockContext*>(0),
+ static_cast<XMLTextListItemContext*>(0), i_pNumberedParagraph));
+}
+
+void XMLTextListsHelper::PopListContext()
+{
+ OSL_ENSURE(mListStack.size(),
+ "internal error: PopListContext: mListStack empty");
+// fprintf(stderr, "PopListContext\n");
+ if ( !mListStack.empty())
+ mListStack.pop();
+}
+
+void XMLTextListsHelper::ListContextTop(
+ XMLTextListBlockContext*& o_pListBlockContext,
+ XMLTextListItemContext*& o_pListItemContext,
+ XMLNumberedParaContext*& o_pNumberedParagraphContext )
+{
+ if ( !mListStack.empty() ) {
+ o_pListBlockContext =
+ static_cast<XMLTextListBlockContext*>(&mListStack.top().get<0>());
+ o_pListItemContext =
+ static_cast<XMLTextListItemContext *>(&mListStack.top().get<1>());
+ o_pNumberedParagraphContext =
+ static_cast<XMLNumberedParaContext *>(&mListStack.top().get<2>());
+ }
+}
+
+void XMLTextListsHelper::SetListItem( XMLTextListItemContext *i_pListItem )
+{
+ // may be cleared by ListBlockContext for upper list...
+ if (i_pListItem) {
+ OSL_ENSURE(mListStack.size(),
+ "internal error: SetListItem: mListStack empty");
+ OSL_ENSURE(mListStack.top().get<0>(),
+ "internal error: SetListItem: mListStack has no ListBlock");
+ OSL_ENSURE(!mListStack.top().get<1>(),
+ "error: SetListItem: list item already exists");
+ }
+ if ( !mListStack.empty() ) {
+ mListStack.top().get<1>() = i_pListItem;
+ }
+}
+
+// Handling for parameter <sListStyleDefaultListId> (#i92811#)
+void XMLTextListsHelper::KeepListAsProcessed( ::rtl::OUString sListId,
+ ::rtl::OUString sListStyleName,
+ ::rtl::OUString sContinueListId,
+ ::rtl::OUString sListStyleDefaultListId )
+{
+ if ( IsListProcessed( sListId ) )
+ {
+ DBG_ASSERT( false,
+ "<XMLTextListsHelper::KeepListAsProcessed(..)> - list id already added" );
+ return;
+ }
+
+ if ( mpProcessedLists == 0 )
+ {
+ mpProcessedLists = new tMapForLists();
+ }
+
+ ::std::pair< ::rtl::OUString, ::rtl::OUString >
+ aListData( sListStyleName, sContinueListId );
+ (*mpProcessedLists)[ sListId ] = aListData;
+
+ msLastProcessedListId = sListId;
+ msListStyleOfLastProcessedList = sListStyleName;
+
+ // Inconsistent behavior regarding lists (#i92811#)
+ if ( sListStyleDefaultListId.getLength() != 0 )
+ {
+ if ( mpMapListIdToListStyleDefaultListId == 0 )
+ {
+ mpMapListIdToListStyleDefaultListId = new tMapForLists();
+ }
+
+ if ( mpMapListIdToListStyleDefaultListId->find( sListStyleName ) ==
+ mpMapListIdToListStyleDefaultListId->end() )
+ {
+ ::std::pair< ::rtl::OUString, ::rtl::OUString >
+ aListIdMapData( sListId, sListStyleDefaultListId );
+ (*mpMapListIdToListStyleDefaultListId)[ sListStyleName ] =
+ aListIdMapData;
+ }
+ }
+}
+
+sal_Bool XMLTextListsHelper::IsListProcessed( const ::rtl::OUString sListId ) const
+{
+ if ( mpProcessedLists == 0 )
+ {
+ return sal_False;
+ }
+
+ return mpProcessedLists->find( sListId ) != mpProcessedLists->end();
+}
+
+::rtl::OUString XMLTextListsHelper::GetListStyleOfProcessedList(
+ const ::rtl::OUString sListId ) const
+{
+ if ( mpProcessedLists != 0 )
+ {
+ tMapForLists::const_iterator aIter = mpProcessedLists->find( sListId );
+ if ( aIter != mpProcessedLists->end() )
+ {
+ return (*aIter).second.first;
+ }
+ }
+
+ return ::rtl::OUString();
+}
+
+::rtl::OUString XMLTextListsHelper::GetContinueListIdOfProcessedList(
+ const ::rtl::OUString sListId ) const
+{
+ if ( mpProcessedLists != 0 )
+ {
+ tMapForLists::const_iterator aIter = mpProcessedLists->find( sListId );
+ if ( aIter != mpProcessedLists->end() )
+ {
+ return (*aIter).second.second;
+ }
+ }
+
+ return ::rtl::OUString();
+}
+
+const ::rtl::OUString& XMLTextListsHelper::GetLastProcessedListId() const
+{
+ return msLastProcessedListId;
+}
+
+const ::rtl::OUString& XMLTextListsHelper::GetListStyleOfLastProcessedList() const
+{
+ return msListStyleOfLastProcessedList;
+}
+
+::rtl::OUString XMLTextListsHelper::GenerateNewListId() const
+{
+ // Value of xml:id in element <text:list> has to be a valid ID type (#i92478#)
+ ::rtl::OUString sTmpStr( RTL_CONSTASCII_USTRINGPARAM( "list" ) );
+ sal_Int64 n = Time().GetTime();
+ n += Date().GetDate();
+ n += rand();
+ // Value of xml:id in element <text:list> has to be a valid ID type (#i92478#)
+ sTmpStr += ::rtl::OUString::valueOf( n );
+
+ long nHitCount = 0;
+ ::rtl::OUString sNewListId( sTmpStr );
+ if ( mpProcessedLists != 0 )
+ {
+ while ( mpProcessedLists->find( sNewListId ) != mpProcessedLists->end() )
+ {
+ ++nHitCount;
+ sNewListId = sTmpStr;
+ sNewListId += ::rtl::OUString::valueOf( nHitCount );
+ }
+ }
+
+ return sNewListId;
+}
+
+// Provide list id for a certain list block for import (#i92811#)
+::rtl::OUString XMLTextListsHelper::GetListIdForListBlock( XMLTextListBlockContext& rListBlock )
+{
+ ::rtl::OUString sListBlockListId( rListBlock.GetContinueListId() );
+ if ( sListBlockListId.getLength() == 0 )
+ {
+ sListBlockListId = rListBlock.GetListId();
+ }
+
+ if ( mpMapListIdToListStyleDefaultListId != 0 )
+ {
+ if ( sListBlockListId.getLength() != 0 )
+ {
+ const ::rtl::OUString sListStyleName =
+ GetListStyleOfProcessedList( sListBlockListId );
+
+ tMapForLists::const_iterator aIter =
+ mpMapListIdToListStyleDefaultListId->find( sListStyleName );
+ if ( aIter != mpMapListIdToListStyleDefaultListId->end() )
+ {
+ if ( (*aIter).second.first == sListBlockListId )
+ {
+ sListBlockListId = (*aIter).second.second;
+ }
+ }
+ }
+ }
+
+ return sListBlockListId;
+}
+
+void XMLTextListsHelper::StoreLastContinuingList( ::rtl::OUString sListId,
+ ::rtl::OUString sContinuingListId )
+{
+ if ( mpContinuingLists == 0 )
+ {
+ mpContinuingLists = new tMapForContinuingLists();
+ }
+
+ (*mpContinuingLists)[ sListId ] = sContinuingListId;
+}
+
+::rtl::OUString XMLTextListsHelper::GetLastContinuingListId(
+ ::rtl::OUString sListId ) const
+{
+ if ( mpContinuingLists != 0)
+ {
+ tMapForContinuingLists::const_iterator aIter =
+ mpContinuingLists->find( sListId );
+ if ( aIter != mpContinuingLists->end() )
+ {
+ return (*aIter).second;
+ }
+ }
+
+ return sListId;
+}
+
+void XMLTextListsHelper::PushListOnStack( ::rtl::OUString sListId,
+ ::rtl::OUString sListStyleName )
+{
+ if ( mpListStack == 0 )
+ {
+ mpListStack = new tStackForLists();
+ }
+ ::std::pair< ::rtl::OUString, ::rtl::OUString >
+ aListData( sListId, sListStyleName );
+ mpListStack->push_back( aListData );
+}
+void XMLTextListsHelper::PopListFromStack()
+{
+ if ( mpListStack != 0 &&
+ mpListStack->size() > 0 )
+ {
+ mpListStack->pop_back();
+ }
+}
+
+sal_Bool XMLTextListsHelper::EqualsToTopListStyleOnStack( const ::rtl::OUString sListId ) const
+{
+ return mpListStack != 0
+ ? sListId == mpListStack->back().second
+ : sal_False;
+}
+
+::rtl::OUString
+XMLTextListsHelper::GetNumberedParagraphListId(
+ const sal_uInt16 i_Level,
+ const ::rtl::OUString i_StyleName)
+{
+ if (!i_StyleName.getLength()) {
+ OSL_FAIL("invalid numbered-paragraph: no style-name");
+ }
+ if (i_StyleName.getLength()
+ && (i_Level < mLastNumberedParagraphs.size())
+ && (mLastNumberedParagraphs[i_Level].first == i_StyleName) )
+ {
+ OSL_ENSURE(mLastNumberedParagraphs[i_Level].second.getLength(),
+ "internal error: numbered-paragraph style-name but no list-id?");
+ return mLastNumberedParagraphs[i_Level].second;
+ } else {
+ return GenerateNewListId();
+ }
+}
+
+static void
+ClampLevel(uno::Reference<container::XIndexReplace> const& i_xNumRules,
+ sal_Int16 & io_rLevel)
+{
+ OSL_ENSURE(i_xNumRules.is(), "internal error: ClampLevel: NumRules null");
+ if (i_xNumRules.is()) {
+ const sal_Int32 nLevelCount( i_xNumRules->getCount() );
+ if ( io_rLevel >= nLevelCount ) {
+ io_rLevel = sal::static_int_cast< sal_Int16 >(nLevelCount-1);
+ }
+ }
+}
+
+uno::Reference<container::XIndexReplace>
+XMLTextListsHelper::EnsureNumberedParagraph(
+ SvXMLImport & i_rImport,
+ const ::rtl::OUString i_ListId,
+ sal_Int16 & io_rLevel, const ::rtl::OUString i_StyleName)
+{
+ OSL_ENSURE(i_ListId.getLength(), "inavlid ListId");
+ OSL_ENSURE(io_rLevel >= 0, "inavlid Level");
+ NumParaList_t & rNPList( mNPLists[i_ListId] );
+ const ::rtl::OUString none; // default
+ if ( rNPList.empty() && (0 != io_rLevel)) {
+ // create default list style for top level
+ sal_Int16 lev(0);
+ rNPList.push_back(::std::make_pair(none,
+ MakeNumRule(i_rImport, 0, none, none, lev) ));
+ }
+ // create num rule first because this might clamp the level...
+ uno::Reference<container::XIndexReplace> xNumRules;
+ if ((0 == io_rLevel) || rNPList.empty() || i_StyleName.getLength()) {
+ // no parent to inherit from, or explicit style given => new numrules!
+ // index of parent: level - 1, but maybe that does not exist
+ const size_t parent( std::min(static_cast<size_t>(io_rLevel),
+ rNPList.size()) - 1 );
+ xNumRules = MakeNumRule(i_rImport,
+ io_rLevel > 0 ? rNPList[parent].second : 0,
+ io_rLevel > 0 ? rNPList[parent].first : none,
+ i_StyleName, io_rLevel);
+ } else {
+ // no style given, but has a parent => reuse parent numrules!
+ ClampLevel(rNPList.back().second, io_rLevel);
+ }
+ if (static_cast<sal_uInt16>(io_rLevel) + 1U > rNPList.size()) {
+ // new level: need to enlarge
+ for (size_t i = rNPList.size();
+ i < static_cast<size_t>(io_rLevel); ++i) {
+ rNPList.push_back(rNPList.back());
+ }
+ rNPList.push_back(xNumRules.is()
+ ? ::std::make_pair(i_StyleName, xNumRules)
+ : rNPList.back());
+ } else {
+ // old level: no need to enlarge; possibly shrink
+ if (xNumRules.is()) {
+ rNPList[io_rLevel] = std::make_pair(i_StyleName, xNumRules);
+ }
+ if (static_cast<sal_uInt16>(io_rLevel) + 1U < rNPList.size()) {
+ rNPList.erase(rNPList.begin() + io_rLevel + 1, rNPList.end());
+ }
+ }
+ // remember the list id
+ if (mLastNumberedParagraphs.size() <= static_cast<size_t>(io_rLevel)) {
+ mLastNumberedParagraphs.resize(io_rLevel+1);
+ }
+ mLastNumberedParagraphs[io_rLevel] = std::make_pair(i_StyleName, i_ListId);
+ return rNPList.back().second;
+}
+
+/** extracted from the XMLTextListBlockContext constructor */
+uno::Reference<container::XIndexReplace>
+XMLTextListsHelper::MakeNumRule(
+ SvXMLImport & i_rImport,
+ const uno::Reference<container::XIndexReplace>& i_rNumRule,
+ const ::rtl::OUString i_ParentStyleName,
+ const ::rtl::OUString i_StyleName,
+ sal_Int16 & io_rLevel,
+ sal_Bool* o_pRestartNumbering,
+ sal_Bool* io_pSetDefaults)
+{
+ static ::rtl::OUString s_NumberingRules(
+ RTL_CONSTASCII_USTRINGPARAM("NumberingRules"));
+ uno::Reference<container::XIndexReplace> xNumRules(i_rNumRule);
+ if ( i_StyleName.getLength() &&
+ i_StyleName != i_ParentStyleName )
+ {
+ const ::rtl::OUString sDisplayStyleName(
+ i_rImport.GetStyleDisplayName( XML_STYLE_FAMILY_TEXT_LIST,
+ i_StyleName) );
+ const uno::Reference < container::XNameContainer >& rNumStyles(
+ i_rImport.GetTextImport()->GetNumberingStyles() );
+ if( rNumStyles.is() && rNumStyles->hasByName( sDisplayStyleName ) )
+ {
+ uno::Reference < style::XStyle > xStyle;
+ uno::Any any = rNumStyles->getByName( sDisplayStyleName );
+ any >>= xStyle;
+
+ uno::Reference< beans::XPropertySet > xPropSet( xStyle,
+ uno::UNO_QUERY );
+ any = xPropSet->getPropertyValue(s_NumberingRules);
+ any >>= xNumRules;
+ }
+ else
+ {
+ const SvxXMLListStyleContext *pListStyle(
+ i_rImport.GetTextImport()->FindAutoListStyle( i_StyleName ) );
+ if( pListStyle )
+ {
+ xNumRules = pListStyle->GetNumRules();
+ if( !xNumRules.is() )
+ {
+ pListStyle->CreateAndInsertAuto();
+ xNumRules = pListStyle->GetNumRules();
+ }
+ }
+ }
+ }
+
+ sal_Bool bSetDefaults(io_pSetDefaults ? *io_pSetDefaults : sal_False);
+ if ( !xNumRules.is() )
+ {
+ // If no style name has been specified for this style and for any
+ // parent or if no num rule with the specified name exists,
+ // create a new one.
+
+ xNumRules =
+ SvxXMLListStyleContext::CreateNumRule( i_rImport.GetModel() );
+ DBG_ASSERT( xNumRules.is(), "got no numbering rule" );
+ if ( !xNumRules.is() )
+ return xNumRules;
+
+ // Because it is a new num rule, numbering must not be restarted.
+ if (o_pRestartNumbering) *o_pRestartNumbering = sal_False;
+ bSetDefaults = sal_True;
+ if (io_pSetDefaults) *io_pSetDefaults = bSetDefaults;
+ }
+
+ ClampLevel(xNumRules, io_rLevel);
+
+ if ( bSetDefaults )
+ {
+ // Because there is no list style sheet for this style, a default
+ // format must be set for any level of this num rule.
+ SvxXMLListStyleContext::SetDefaultStyle( xNumRules, io_rLevel,
+ sal_False );
+ }
+
+ return xNumRules;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
new file mode 100644
index 000000000000..821ddac5a8fb
--- /dev/null
+++ b/xmloff/source/text/txtparae.cxx
@@ -0,0 +1,3719 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "unointerfacetouniqueidentifiermapper.hxx"
+#include <tools/debug.hxx>
+#include <svl/svarray.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <sal/types.h>
+
+#include <vector>
+#include <list>
+#include <boost/unordered_map.hpp>
+#include <tools/string.hxx>
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/container/XEnumeration.hpp>
+#include <com/sun/star/container/XIndexReplace.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XTextSectionsSupplier.hpp>
+#include <com/sun/star/text/XTextTablesSupplier.hpp>
+#include <com/sun/star/text/XNumberingRulesSupplier.hpp>
+#include <com/sun/star/text/XChapterNumberingSupplier.hpp>
+#include <com/sun/star/text/XTextTable.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XTextContent.hpp>
+#include <com/sun/star/text/XTextRange.hpp>
+#include <com/sun/star/text/XTextField.hpp>
+#include <com/sun/star/text/XFootnote.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/container/XContentEnumerationAccess.hpp>
+#include <com/sun/star/text/XTextFrame.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/text/SizeType.hpp>
+#include <com/sun/star/text/HoriOrientation.hpp>
+#include <com/sun/star/text/VertOrientation.hpp>
+#include <com/sun/star/text/TextContentAnchorType.hpp>
+#include <com/sun/star/text/XTextFramesSupplier.hpp>
+#include <com/sun/star/text/XTextGraphicObjectsSupplier.hpp>
+#include <com/sun/star/text/XTextEmbeddedObjectsSupplier.hpp>
+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+#include <com/sun/star/document/XEmbeddedObjectSupplier.hpp>
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#include <com/sun/star/document/XRedlinesSupplier.hpp>
+
+#include <com/sun/star/text/XBookmarksSupplier.hpp>
+#include <com/sun/star/text/XFormField.hpp>
+
+#include <com/sun/star/text/XTextSection.hpp>
+#include <com/sun/star/text/SectionFileLink.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/text/XTextShapesSupplier.hpp>
+
+#include <com/sun/star/style/XAutoStylesSupplier.hpp>
+#include <com/sun/star/style/XAutoStyleFamily.hpp>
+#include <com/sun/star/text/XTextFieldsSupplier.hpp>
+#include <com/sun/star/text/XFootnotesSupplier.hpp>
+#include <com/sun/star/text/XEndnotesSupplier.hpp>
+#include <com/sun/star/drawing/XControlShape.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmlaustp.hxx>
+#include <xmloff/families.hxx>
+#include "txtexppr.hxx"
+#include <xmloff/xmlnumfe.hxx>
+#include <xmloff/xmlnume.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "XMLAnchorTypePropHdl.hxx"
+#include "xexptran.hxx"
+#include <xmloff/ProgressBarHelper.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmlexp.hxx>
+#include "txtflde.hxx"
+#include <xmloff/txtprmap.hxx>
+#include "XMLImageMapExport.hxx"
+#include "XMLTextNumRuleInfo.hxx"
+#include "xmloff/XMLTextListAutoStylePool.hxx"
+#include <xmloff/txtparae.hxx>
+#include "XMLSectionExport.hxx"
+#include "XMLIndexMarkExport.hxx"
+#include <xmloff/XMLEventExport.hxx>
+#include "XMLRedlineExport.hxx"
+#include "MultiPropertySetHelper.hxx"
+#include <xmloff/formlayerexport.hxx>
+#include "XMLTextCharStyleNamesElementExport.hxx"
+#include <comphelper/stlunosequence.hxx>
+
+#include <xmloff/odffields.hxx>
+#include <com/sun/star/embed/ElementModes.hpp>
+#include <com/sun/star/embed/XTransactedObject.hpp>
+#include <com/sun/star/document/XStorageBasedDocument.hpp>
+#include <txtlists.hxx>
+#include <com/sun/star/rdf/XMetadatable.hpp>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::std;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::document;
+using namespace ::com::sun::star::frame;
+using namespace ::xmloff;
+using namespace ::xmloff::token;
+
+namespace
+{
+ class TextContentSet
+ {
+ public:
+ typedef Reference<XTextContent> text_content_ref_t;
+ typedef list<text_content_ref_t> contents_t;
+ typedef back_insert_iterator<contents_t> inserter_t;
+ typedef contents_t::const_iterator const_iterator_t;
+
+ inserter_t getInserter()
+ { return back_insert_iterator<contents_t>(m_vTextContents); };
+ const_iterator_t getBegin() const
+ { return m_vTextContents.begin(); };
+ const_iterator_t getEnd() const
+ { return m_vTextContents.end(); };
+
+ private:
+ contents_t m_vTextContents;
+ };
+
+ struct FrameRefHash
+ : public unary_function<Reference<XTextFrame>, size_t>
+ {
+ size_t operator()(const Reference<XTextFrame> xFrame) const
+ { return sal::static_int_cast<size_t>(reinterpret_cast<sal_uIntPtr>(xFrame.get())); }
+ };
+
+ static bool lcl_TextContentsUnfiltered(const Reference<XTextContent>&)
+ { return true; };
+
+ static bool lcl_ShapeFilter(const Reference<XTextContent>& xTxtContent)
+ {
+ static const OUString sTextFrameService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextFrame"));
+ static const OUString sTextGraphicService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextGraphicObject"));
+ static const OUString sTextEmbeddedService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextEmbeddedObject"));
+ Reference<XShape> xShape(xTxtContent, UNO_QUERY);
+ if(!xShape.is())
+ return false;
+ Reference<XServiceInfo> xServiceInfo(xTxtContent, UNO_QUERY);
+ if(xServiceInfo->supportsService(sTextFrameService) ||
+ xServiceInfo->supportsService(sTextGraphicService) ||
+ xServiceInfo->supportsService(sTextEmbeddedService) )
+ return false;
+ return true;
+ };
+
+ class BoundFrames
+ {
+ public:
+ typedef bool (*filter_t)(const Reference<XTextContent>&);
+ BoundFrames(
+ const Reference<XEnumerationAccess> xEnumAccess,
+ const filter_t& rFilter)
+ : m_xEnumAccess(xEnumAccess)
+ {
+ Fill(rFilter);
+ };
+ BoundFrames()
+ {};
+ const TextContentSet* GetPageBoundContents() const
+ { return &m_vPageBounds; };
+ const TextContentSet* GetFrameBoundContents(const Reference<XTextFrame>& rParentFrame) const
+ {
+ framebound_map_t::const_iterator it = m_vFrameBoundsOf.find(rParentFrame);
+ if(it == m_vFrameBoundsOf.end())
+ return NULL;
+ return &(it->second);
+ };
+ Reference<XEnumeration> createEnumeration() const
+ {
+ if(!m_xEnumAccess.is())
+ return Reference<XEnumeration>();
+ return m_xEnumAccess->createEnumeration();
+ };
+
+ private:
+ typedef boost::unordered_map<
+ Reference<XTextFrame>,
+ TextContentSet,
+ FrameRefHash> framebound_map_t;
+ TextContentSet m_vPageBounds;
+ framebound_map_t m_vFrameBoundsOf;
+ const Reference<XEnumerationAccess> m_xEnumAccess;
+ void Fill(const filter_t& rFilter);
+ static const OUString our_sAnchorType;
+ static const OUString our_sAnchorFrame;
+ };
+ const OUString BoundFrames::our_sAnchorType(RTL_CONSTASCII_USTRINGPARAM("AnchorType"));
+ const OUString BoundFrames::our_sAnchorFrame(RTL_CONSTASCII_USTRINGPARAM("AnchorFrame"));
+
+ class FieldParamExporter
+ {
+ public:
+ FieldParamExporter(SvXMLExport* const pExport, Reference<XNameContainer> xFieldParams)
+ : m_pExport(pExport)
+ , m_xFieldParams(xFieldParams)
+ { };
+ void Export();
+
+ private:
+ SvXMLExport* const m_pExport;
+ const Reference<XNameContainer> m_xFieldParams;
+
+ void ExportParameter(const OUString& sKey, const OUString& sValue);
+ };
+}
+
+namespace xmloff
+{
+ class BoundFrameSets
+ {
+ public:
+ BoundFrameSets(const Reference<XInterface> xModel);
+ const BoundFrames* GetTexts() const
+ { return m_pTexts.get(); };
+ const BoundFrames* GetGraphics() const
+ { return m_pGraphics.get(); };
+ const BoundFrames* GetEmbeddeds() const
+ { return m_pEmbeddeds.get(); };
+ const BoundFrames* GetShapes() const
+ { return m_pShapes.get(); };
+ private:
+ auto_ptr<BoundFrames> m_pTexts;
+ auto_ptr<BoundFrames> m_pGraphics;
+ auto_ptr<BoundFrames> m_pEmbeddeds;
+ auto_ptr<BoundFrames> m_pShapes;
+ };
+}
+
+typedef OUString *OUStringPtr;
+SV_DECL_PTRARR_DEL( OUStrings_Impl, OUStringPtr, 20, 10 )
+SV_IMPL_PTRARR( OUStrings_Impl, OUStringPtr )
+
+SV_DECL_PTRARR_SORT_DEL( OUStringsSort_Impl, OUStringPtr, 20, 10 )
+SV_IMPL_OP_PTRARR_SORT( OUStringsSort_Impl, OUStringPtr )
+
+#ifdef DBG_UTIL
+static int txtparae_bContainsIllegalCharacters = sal_False;
+#endif
+
+// The following map shows which property values are required:
+//
+// property auto style pass export
+// --------------------------------------------------------
+// ParaStyleName if style exists always
+// ParaConditionalStyleName if style exists always
+// NumberingRules if style exists always
+// TextSection always always
+// ParaChapterNumberingLevel never always
+// NumberingIsNumber never always
+
+// The conclusion is that for auto styles the first three properties
+// should be queried using a multi property set if, and only if, an
+// auto style needs to be exported. TextSection should be queried by
+// an individual call to getPropertyvalue, because this seems to be
+// less expensive than querying the first three properties if they aren't
+// required.
+
+// For the export pass all properties can be queried using a multi property
+// set.
+
+static const sal_Char* aParagraphPropertyNamesAuto[] =
+{
+ "NumberingRules",
+ "ParaConditionalStyleName",
+ "ParaStyleName",
+ NULL
+};
+
+enum eParagraphPropertyNamesEnumAuto
+{
+ NUMBERING_RULES_AUTO = 0,
+ PARA_CONDITIONAL_STYLE_NAME_AUTO = 1,
+ PARA_STYLE_NAME_AUTO = 2
+};
+
+static const sal_Char* aParagraphPropertyNames[] =
+{
+ "NumberingIsNumber",
+ "NumberingStyleName",
+ "OutlineLevel",
+ "ParaConditionalStyleName",
+ "ParaStyleName",
+ "TextSection",
+ NULL
+};
+
+enum eParagraphPropertyNamesEnum
+{
+ NUMBERING_IS_NUMBER = 0,
+ PARA_NUMBERING_STYLENAME = 1,
+ PARA_OUTLINE_LEVEL=2,
+ PARA_CONDITIONAL_STYLE_NAME = 3,
+ PARA_STYLE_NAME = 4,
+ TEXT_SECTION = 5
+};
+
+void BoundFrames::Fill(const filter_t& rFilter)
+{
+ if(!m_xEnumAccess.is())
+ return;
+ const Reference< XEnumeration > xEnum = m_xEnumAccess->createEnumeration();
+ if(!xEnum.is())
+ return;
+ while(xEnum->hasMoreElements())
+ {
+ Reference<XPropertySet> xPropSet(xEnum->nextElement(), UNO_QUERY);
+ Reference<XTextContent> xTextContent(xPropSet, UNO_QUERY);
+ if(!xPropSet.is() || !xTextContent.is())
+ continue;
+ TextContentAnchorType eAnchor;
+ xPropSet->getPropertyValue(our_sAnchorType) >>= eAnchor;
+ if(TextContentAnchorType_AT_PAGE != eAnchor && TextContentAnchorType_AT_FRAME != eAnchor)
+ continue;
+ if(!rFilter(xTextContent))
+ continue;
+
+ TextContentSet::inserter_t pInserter = m_vPageBounds.getInserter();
+ if(TextContentAnchorType_AT_FRAME == eAnchor)
+ {
+ Reference<XTextFrame> xAnchorTxtFrame(
+ xPropSet->getPropertyValue(our_sAnchorFrame),
+ uno::UNO_QUERY);
+ pInserter = m_vFrameBoundsOf[xAnchorTxtFrame].getInserter();
+ }
+ *pInserter++ = xTextContent;
+ }
+}
+
+BoundFrameSets::BoundFrameSets(const Reference<XInterface> xModel)
+ : m_pTexts(new BoundFrames())
+ , m_pGraphics(new BoundFrames())
+ , m_pEmbeddeds(new BoundFrames())
+ , m_pShapes(new BoundFrames())
+{
+ const Reference<XTextFramesSupplier> xTFS(xModel, UNO_QUERY);
+ const Reference<XTextGraphicObjectsSupplier> xGOS(xModel, UNO_QUERY);
+ const Reference<XTextEmbeddedObjectsSupplier> xEOS(xModel, UNO_QUERY);
+ const Reference<XDrawPageSupplier> xDPS(xModel, UNO_QUERY);
+ if(xTFS.is())
+ m_pTexts = auto_ptr<BoundFrames>(new BoundFrames(
+ Reference<XEnumerationAccess>(xTFS->getTextFrames(), UNO_QUERY),
+ &lcl_TextContentsUnfiltered));
+ if(xGOS.is())
+ m_pGraphics = auto_ptr<BoundFrames>(new BoundFrames(
+ Reference<XEnumerationAccess>(xGOS->getGraphicObjects(), UNO_QUERY),
+ &lcl_TextContentsUnfiltered));
+ if(xEOS.is())
+ m_pEmbeddeds = auto_ptr<BoundFrames>(new BoundFrames(
+ Reference<XEnumerationAccess>(xEOS->getEmbeddedObjects(), UNO_QUERY),
+ &lcl_TextContentsUnfiltered));
+ if(xDPS.is())
+ m_pShapes = auto_ptr<BoundFrames>(new BoundFrames(
+ Reference<XEnumerationAccess>(xDPS->getDrawPage(), UNO_QUERY),
+ &lcl_ShapeFilter));
+};
+
+void FieldParamExporter::Export()
+{
+ static const Type aStringType = ::getCppuType((OUString*)0);
+ static const Type aBoolType = ::getCppuType((sal_Bool*)0);
+ static const Type aSeqType = ::getCppuType((Sequence<OUString>*)0);
+ static const Type aIntType = ::getCppuType((sal_Int32*)0);
+ Sequence<OUString> vParameters(m_xFieldParams->getElementNames());
+ for(const OUString* pCurrent=::comphelper::stl_begin(vParameters); pCurrent!=::comphelper::stl_end(vParameters); ++pCurrent)
+ {
+ const Any aValue = m_xFieldParams->getByName(*pCurrent);
+ const Type aValueType = aValue.getValueType();
+ if(aValueType == aStringType)
+ {
+ OUString sValue;
+ aValue >>= sValue;
+ ExportParameter(*pCurrent,sValue);
+
+ if ( pCurrent->equalsAscii( ODF_OLE_PARAM ) )
+ {
+ // Save the OLE object
+ Reference< embed::XStorage > xTargetStg = m_pExport->GetTargetStorage();
+ Reference< embed::XStorage > xDstStg = xTargetStg->openStorageElement(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OLELinks")), embed::ElementModes::WRITE );
+
+ if ( !xDstStg->hasByName( sValue ) ) {
+ Reference< XStorageBasedDocument > xStgDoc (
+ m_pExport->GetModel( ), UNO_QUERY );
+ Reference< embed::XStorage > xDocStg = xStgDoc->getDocumentStorage();
+ Reference< embed::XStorage > xOleStg = xDocStg->openStorageElement(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OLELinks")), embed::ElementModes::READ );
+
+ xOleStg->copyElementTo( sValue, xDstStg, sValue );
+ Reference< embed::XTransactedObject > xTransact( xDstStg, UNO_QUERY );
+ if ( xTransact.is( ) )
+ xTransact->commit( );
+ }
+ }
+ }
+ else if(aValueType == aBoolType)
+ {
+ sal_Bool bValue = false;
+ aValue >>= bValue;
+ ExportParameter(*pCurrent, (bValue ? OUString(RTL_CONSTASCII_USTRINGPARAM( "true" )) : OUString(RTL_CONSTASCII_USTRINGPARAM("false"))) );
+ }
+ else if(aValueType == aSeqType)
+ {
+ Sequence<OUString> vValue;
+ aValue >>= vValue;
+ for(OUString* pSeqCurrent = ::comphelper::stl_begin(vValue); pSeqCurrent != ::comphelper::stl_end(vValue); ++pSeqCurrent)
+ {
+ ExportParameter(*pCurrent, *pSeqCurrent);
+ }
+ }
+ else if(aValueType == aIntType)
+ {
+ sal_Int32 nValue = 0;
+ aValue >>= nValue;
+ ExportParameter(*pCurrent, OUStringBuffer().append(nValue).makeStringAndClear());
+ }
+ }
+}
+
+void FieldParamExporter::ExportParameter(const OUString& sKey, const OUString& sValue)
+{
+ m_pExport->AddAttribute(XML_NAMESPACE_FIELD, XML_NAME, sKey);
+ m_pExport->AddAttribute(XML_NAMESPACE_FIELD, XML_VALUE, sValue);
+ m_pExport->StartElement(XML_NAMESPACE_FIELD, XML_PARAM, sal_False);
+ m_pExport->EndElement(XML_NAMESPACE_FIELD, XML_PARAM, sal_False);
+}
+
+void XMLTextParagraphExport::Add( sal_uInt16 nFamily,
+ const Reference < XPropertySet > & rPropSet,
+ const XMLPropertyState** ppAddStates, bool bDontSeek )
+{
+ UniReference < SvXMLExportPropertyMapper > xPropMapper;
+ switch( nFamily )
+ {
+ case XML_STYLE_FAMILY_TEXT_PARAGRAPH:
+ xPropMapper = GetParaPropMapper();
+ break;
+ case XML_STYLE_FAMILY_TEXT_TEXT:
+ xPropMapper = GetTextPropMapper();
+ break;
+ case XML_STYLE_FAMILY_TEXT_FRAME:
+ xPropMapper = GetAutoFramePropMapper();
+ break;
+ case XML_STYLE_FAMILY_TEXT_SECTION:
+ xPropMapper = GetSectionPropMapper();
+ break;
+ case XML_STYLE_FAMILY_TEXT_RUBY:
+ xPropMapper = GetRubyPropMapper();
+ break;
+ }
+ DBG_ASSERT( xPropMapper.is(), "There is the property mapper?" );
+
+ vector< XMLPropertyState > xPropStates =
+ xPropMapper->Filter( rPropSet );
+
+ if( ppAddStates )
+ {
+ while( *ppAddStates )
+ {
+ xPropStates.push_back( **ppAddStates );
+ ppAddStates++;
+ }
+ }
+
+ if( !xPropStates.empty() )
+ {
+ Reference< XPropertySetInfo > xPropSetInfo(rPropSet->getPropertySetInfo());
+ OUString sParent, sCondParent;
+ sal_uInt16 nIgnoreProps = 0;
+ switch( nFamily )
+ {
+ case XML_STYLE_FAMILY_TEXT_PARAGRAPH:
+ if( xPropSetInfo->hasPropertyByName( sParaStyleName ) )
+ {
+ rPropSet->getPropertyValue( sParaStyleName ) >>= sParent;
+ }
+ if( xPropSetInfo->hasPropertyByName( sParaConditionalStyleName ) )
+ {
+ rPropSet->getPropertyValue( sParaConditionalStyleName ) >>= sCondParent;
+ }
+ if( xPropSetInfo->hasPropertyByName( sNumberingRules ) )
+ {
+ Reference < XIndexReplace > xNumRule(rPropSet->getPropertyValue( sNumberingRules ), uno::UNO_QUERY);
+ if( xNumRule.is() && xNumRule->getCount() )
+ {
+ Reference < XNamed > xNamed( xNumRule, UNO_QUERY );
+ OUString sName;
+ if( xNamed.is() )
+ sName = xNamed->getName();
+ sal_Bool bAdd = !sName.getLength();
+ if( !bAdd )
+ {
+ Reference < XPropertySet > xNumPropSet( xNumRule,
+ UNO_QUERY );
+ const OUString sIsAutomatic( RTL_CONSTASCII_USTRINGPARAM( "IsAutomatic" ) );
+ if( xNumPropSet.is() &&
+ xNumPropSet->getPropertySetInfo()
+ ->hasPropertyByName( sIsAutomatic ) )
+ {
+ bAdd = *(sal_Bool *)xNumPropSet->getPropertyValue( sIsAutomatic ).getValue();
+ // Check on outline style (#i73361#)
+ const OUString sNumberingIsOutline( RTL_CONSTASCII_USTRINGPARAM( "NumberingIsOutline" ) );
+ if ( bAdd &&
+ xNumPropSet->getPropertySetInfo()
+ ->hasPropertyByName( sNumberingIsOutline ) )
+ {
+ bAdd = !(*(sal_Bool *)xNumPropSet->getPropertyValue( sNumberingIsOutline ).getValue());
+ }
+ }
+ else
+ {
+ bAdd = sal_True;
+ }
+ }
+ if( bAdd )
+ pListAutoPool->Add( xNumRule );
+ }
+ }
+ break;
+ case XML_STYLE_FAMILY_TEXT_TEXT:
+ {
+ // Get parent and remove hyperlinks (they aren't of interest)
+ UniReference< XMLPropertySetMapper > xPM(xPropMapper->getPropertySetMapper());
+ for( ::std::vector< XMLPropertyState >::iterator i(xPropStates.begin());
+ nIgnoreProps < 2 && i != xPropStates.end(); )
+ {
+ if( i->mnIndex == -1 )
+ {
+ ++i;
+ continue;
+ }
+
+ switch( xPM->GetEntryContextId(i->mnIndex) )
+ {
+ case CTF_CHAR_STYLE_NAME:
+ case CTF_HYPERLINK_URL:
+ i->mnIndex = -1;
+ nIgnoreProps++;
+ i = xPropStates.erase( i );
+ break;
+ default:
+ ++i;
+ break;
+ }
+ }
+ }
+ break;
+ case XML_STYLE_FAMILY_TEXT_FRAME:
+ if( xPropSetInfo->hasPropertyByName( sFrameStyleName ) )
+ {
+ rPropSet->getPropertyValue( sFrameStyleName ) >>= sParent;
+ }
+ break;
+ case XML_STYLE_FAMILY_TEXT_SECTION:
+ case XML_STYLE_FAMILY_TEXT_RUBY:
+ ; // section styles have no parents
+ break;
+ }
+ if( (xPropStates.size() - nIgnoreProps) > 0 )
+ {
+ GetAutoStylePool().Add( nFamily, sParent, xPropStates, bDontSeek );
+ if( sCondParent.getLength() && sParent != sCondParent )
+ GetAutoStylePool().Add( nFamily, sCondParent, xPropStates );
+ }
+ }
+}
+
+bool lcl_validPropState( const XMLPropertyState& rState )
+{
+ return rState.mnIndex != -1;
+}
+
+void XMLTextParagraphExport::Add( sal_uInt16 nFamily,
+ MultiPropertySetHelper& rPropSetHelper,
+ const Reference < XPropertySet > & rPropSet,
+ const XMLPropertyState** ppAddStates)
+{
+ UniReference < SvXMLExportPropertyMapper > xPropMapper;
+ switch( nFamily )
+ {
+ case XML_STYLE_FAMILY_TEXT_PARAGRAPH:
+ xPropMapper = GetParaPropMapper();
+ break;
+ }
+ DBG_ASSERT( xPropMapper.is(), "There is the property mapper?" );
+
+ vector< XMLPropertyState > xPropStates(xPropMapper->Filter( rPropSet ));
+ if( ppAddStates )
+ {
+ while( *ppAddStates )
+ {
+ xPropStates.push_back( **ppAddStates );
+ ++ppAddStates;
+ }
+ }
+
+ if( rPropSetHelper.hasProperty( NUMBERING_RULES_AUTO ) )
+ {
+ Reference < XIndexReplace > xNumRule(rPropSetHelper.getValue( NUMBERING_RULES_AUTO,
+ rPropSet, sal_True ), uno::UNO_QUERY);
+ if( xNumRule.is() && xNumRule->getCount() )
+ {
+ Reference < XNamed > xNamed( xNumRule, UNO_QUERY );
+ OUString sName;
+ if( xNamed.is() )
+ sName = xNamed->getName();
+ sal_Bool bAdd = !sName.getLength();
+ if( !bAdd )
+ {
+ Reference < XPropertySet > xNumPropSet( xNumRule,
+ UNO_QUERY );
+ const OUString sIsAutomatic( RTL_CONSTASCII_USTRINGPARAM( "IsAutomatic" ) );
+ if( xNumPropSet.is() &&
+ xNumPropSet->getPropertySetInfo()
+ ->hasPropertyByName( sIsAutomatic ) )
+ {
+ bAdd = *(sal_Bool *)xNumPropSet->getPropertyValue( sIsAutomatic ).getValue();
+ // Check on outline style (#i73361#)
+ const OUString sNumberingIsOutline( RTL_CONSTASCII_USTRINGPARAM( "NumberingIsOutline" ) );
+ if ( bAdd &&
+ xNumPropSet->getPropertySetInfo()
+ ->hasPropertyByName( sNumberingIsOutline ) )
+ {
+ bAdd = !(*(sal_Bool *)xNumPropSet->getPropertyValue( sNumberingIsOutline ).getValue());
+ }
+ }
+ else
+ {
+ bAdd = sal_True;
+ }
+ }
+ if( bAdd )
+ pListAutoPool->Add( xNumRule );
+ }
+ }
+
+ if( !xPropStates.empty() )
+ {
+ OUString sParent, sCondParent;
+ switch( nFamily )
+ {
+ case XML_STYLE_FAMILY_TEXT_PARAGRAPH:
+ if( rPropSetHelper.hasProperty( PARA_STYLE_NAME_AUTO ) )
+ {
+ rPropSetHelper.getValue( PARA_STYLE_NAME_AUTO, rPropSet,
+ sal_True ) >>= sParent;
+ }
+ if( rPropSetHelper.hasProperty( PARA_CONDITIONAL_STYLE_NAME_AUTO ) )
+ {
+ rPropSetHelper.getValue( PARA_CONDITIONAL_STYLE_NAME_AUTO,
+ rPropSet, sal_True ) >>= sCondParent;
+ }
+
+ break;
+ }
+
+ if( find_if( xPropStates.begin(), xPropStates.end(), lcl_validPropState ) != xPropStates.end() )
+ {
+ GetAutoStylePool().Add( nFamily, sParent, xPropStates );
+ if( sCondParent.getLength() && sParent != sCondParent )
+ GetAutoStylePool().Add( nFamily, sCondParent, xPropStates );
+ }
+ }
+}
+
+OUString XMLTextParagraphExport::Find(
+ sal_uInt16 nFamily,
+ const Reference < XPropertySet > & rPropSet,
+ const OUString& rParent,
+ const XMLPropertyState** ppAddStates) const
+{
+ OUString sName( rParent );
+ UniReference < SvXMLExportPropertyMapper > xPropMapper;
+ switch( nFamily )
+ {
+ case XML_STYLE_FAMILY_TEXT_PARAGRAPH:
+ xPropMapper = GetParaPropMapper();
+ break;
+ case XML_STYLE_FAMILY_TEXT_FRAME:
+ xPropMapper = GetAutoFramePropMapper();
+ break;
+ case XML_STYLE_FAMILY_TEXT_SECTION:
+ xPropMapper = GetSectionPropMapper();
+ break;
+ case XML_STYLE_FAMILY_TEXT_RUBY:
+ xPropMapper = GetRubyPropMapper();
+ break;
+ }
+ DBG_ASSERT( xPropMapper.is(), "There is the property mapper?" );
+ if( !xPropMapper.is() )
+ return sName;
+ vector< XMLPropertyState > xPropStates(xPropMapper->Filter( rPropSet ));
+ if( ppAddStates )
+ {
+ while( *ppAddStates )
+ {
+ xPropStates.push_back( **ppAddStates );
+ ++ppAddStates;
+ }
+ }
+ if( find_if( xPropStates.begin(), xPropStates.end(), lcl_validPropState ) != xPropStates.end() )
+ sName = GetAutoStylePool().Find( nFamily, sName, xPropStates );
+
+ return sName;
+}
+
+OUString XMLTextParagraphExport::FindTextStyleAndHyperlink(
+ const Reference < XPropertySet > & rPropSet,
+ sal_Bool& rbHyperlink,
+ sal_Bool& rbHasCharStyle,
+ sal_Bool& rbHasAutoStyle,
+ const XMLPropertyState** ppAddStates ) const
+{
+ UniReference < SvXMLExportPropertyMapper > xPropMapper(GetTextPropMapper());
+ vector< XMLPropertyState > xPropStates(xPropMapper->Filter( rPropSet ));
+
+ // Get parent and remove hyperlinks (they aren't of interest)
+ OUString sName;
+ rbHyperlink = rbHasCharStyle = rbHasAutoStyle = sal_False;
+ sal_uInt16 nIgnoreProps = 0;
+ UniReference< XMLPropertySetMapper > xPM(xPropMapper->getPropertySetMapper());
+ ::std::vector< XMLPropertyState >::iterator aFirstDel = xPropStates.end();
+ ::std::vector< XMLPropertyState >::iterator aSecondDel = xPropStates.end();
+
+ for( ::std::vector< XMLPropertyState >::iterator
+ i = xPropStates.begin();
+ nIgnoreProps < 2 && i != xPropStates.end();
+ i++ )
+ {
+ if( i->mnIndex == -1 )
+ continue;
+
+ switch( xPM->GetEntryContextId(i->mnIndex) )
+ {
+ case CTF_CHAR_STYLE_NAME:
+ i->maValue >>= sName;
+ i->mnIndex = -1;
+ rbHasCharStyle = sName.getLength() > 0;
+ if( nIgnoreProps )
+ aSecondDel = i;
+ else
+ aFirstDel = i;
+ nIgnoreProps++;
+ break;
+ case CTF_HYPERLINK_URL:
+ rbHyperlink = sal_True;
+ i->mnIndex = -1;
+ if( nIgnoreProps )
+ aSecondDel = i;
+ else
+ aFirstDel = i;
+ nIgnoreProps++;
+ break;
+ }
+ }
+ if( ppAddStates )
+ {
+ while( *ppAddStates )
+ {
+ xPropStates.push_back( **ppAddStates );
+ ppAddStates++;
+ }
+ }
+ if( (xPropStates.size() - nIgnoreProps) > 0L )
+ {
+ // erase the character style, otherwise the autostyle cannot be found!
+ // erase the hyperlink, otherwise the autostyle cannot be found!
+ if ( nIgnoreProps )
+ {
+ // If two elements of a vector have to be deleted,
+ // we should delete the second one first.
+ if( --nIgnoreProps )
+ xPropStates.erase( aSecondDel );
+ xPropStates.erase( aFirstDel );
+ }
+ OUString sParent; // AutoStyles should not have parents!
+ sName = GetAutoStylePool().Find( XML_STYLE_FAMILY_TEXT_TEXT, sParent, xPropStates );
+ DBG_ASSERT( sName.getLength(), "AutoStyle could not be found" );
+ rbHasAutoStyle = sal_True;
+ }
+
+ return sName;
+}
+
+OUString XMLTextParagraphExport::FindTextStyle(
+ const Reference < XPropertySet > & rPropSet,
+ sal_Bool& rHasCharStyle ) const
+{
+ sal_Bool bDummy;
+ sal_Bool bDummy2;
+ return FindTextStyleAndHyperlink( rPropSet, bDummy, rHasCharStyle, bDummy2 );
+}
+
+
+// adjustments to support lists independent from list style
+void XMLTextParagraphExport::exportListChange(
+ const XMLTextNumRuleInfo& rPrevInfo,
+ const XMLTextNumRuleInfo& rNextInfo )
+{
+ // end a list
+ if ( rPrevInfo.GetLevel() > 0 )
+ {
+ sal_Int16 nListLevelsToBeClosed = 0;
+ if ( !rNextInfo.BelongsToSameList( rPrevInfo ) ||
+ rNextInfo.GetLevel() <= 0 )
+ {
+ // close complete previous list
+ nListLevelsToBeClosed = rPrevInfo.GetLevel();
+ }
+ else if ( rPrevInfo.GetLevel() > rNextInfo.GetLevel() )
+ {
+ // close corresponding sub lists
+ DBG_ASSERT( rNextInfo.GetLevel() > 0,
+ "<rPrevInfo.GetLevel() > 0> not hold. Serious defect -> please inform OD." );
+ nListLevelsToBeClosed = rPrevInfo.GetLevel() - rNextInfo.GetLevel();
+ }
+
+ if ( nListLevelsToBeClosed > 0 &&
+ pListElements &&
+ pListElements->Count() >= ( 2 * nListLevelsToBeClosed ) )
+ {
+ do {
+ for( sal_uInt16 j = 0; j < 2; ++j )
+ {
+ OUString *pElem = (*pListElements)[pListElements->Count()-1];
+ pListElements->Remove( pListElements->Count()-1 );
+
+ GetExport().EndElement( *pElem, sal_True );
+
+ delete pElem;
+ }
+
+ // remove closed list from list stack
+ mpTextListsHelper->PopListFromStack();
+
+ --nListLevelsToBeClosed;
+ } while ( nListLevelsToBeClosed > 0 );
+ }
+ }
+
+ const bool bExportODF =
+ ( GetExport().getExportFlags() & EXPORT_OASIS ) != 0;
+ const SvtSaveOptions::ODFDefaultVersion eODFDefaultVersion =
+ GetExport().getDefaultVersion();
+
+ // start a new list
+ if ( rNextInfo.GetLevel() > 0 )
+ {
+ bool bRootListToBeStarted = false;
+ sal_Int16 nListLevelsToBeOpened = 0;
+ if ( !rPrevInfo.BelongsToSameList( rNextInfo ) ||
+ rPrevInfo.GetLevel() <= 0 )
+ {
+ // new root list
+ bRootListToBeStarted = true;
+ nListLevelsToBeOpened = rNextInfo.GetLevel();
+ }
+ else if ( rNextInfo.GetLevel() > rPrevInfo.GetLevel() )
+ {
+ // open corresponding sub lists
+ DBG_ASSERT( rPrevInfo.GetLevel() > 0,
+ "<rPrevInfo.GetLevel() > 0> not hold. Serious defect -> please inform OD." );
+ nListLevelsToBeOpened = rNextInfo.GetLevel() - rPrevInfo.GetLevel();
+ }
+
+ if ( nListLevelsToBeOpened > 0 )
+ {
+ const ::rtl::OUString sListStyleName( rNextInfo.GetNumRulesName() );
+ // Currently only the text documents support <ListId>.
+ // Thus, for other document types <sListId> is empty.
+ const ::rtl::OUString sListId( rNextInfo.GetListId() );
+ bool bExportListStyle( true );
+ bool bRestartNumberingAtContinuedRootList( false );
+ sal_Int16 nRestartValueForContinuedRootList( -1 );
+ bool bContinueingPreviousSubList = !bRootListToBeStarted &&
+ rNextInfo.IsContinueingPreviousSubTree();
+ do {
+ GetExport().CheckAttrList();
+
+ if ( bRootListToBeStarted )
+ {
+ if ( !mpTextListsHelper->IsListProcessed( sListId ) )
+ {
+ if ( bExportODF &&
+ eODFDefaultVersion >= SvtSaveOptions::ODFVER_012 &&
+ sListId.getLength() > 0 )
+ {
+ /* Property text:id at element <text:list> has to be
+ replaced by property xml:id (#i92221#)
+ */
+ GetExport().AddAttribute( XML_NAMESPACE_XML,
+ XML_ID,
+ sListId );
+ }
+ mpTextListsHelper->KeepListAsProcessed( sListId,
+ sListStyleName,
+ ::rtl::OUString() );
+ }
+ else
+ {
+ const ::rtl::OUString sNewListId(
+ mpTextListsHelper->GenerateNewListId() );
+ if ( bExportODF &&
+ eODFDefaultVersion >= SvtSaveOptions::ODFVER_012 &&
+ sListId.getLength() > 0 )
+ {
+ /* Property text:id at element <text:list> has to be
+ replaced by property xml:id (#i92221#)
+ */
+ GetExport().AddAttribute( XML_NAMESPACE_XML,
+ XML_ID,
+ sNewListId );
+ }
+
+ const ::rtl::OUString sContinueListId =
+ mpTextListsHelper->GetLastContinuingListId( sListId );
+ // store that list with list id <sNewListId> is last list,
+ // which has continued list with list id <sListId>
+ mpTextListsHelper->StoreLastContinuingList( sListId,
+ sNewListId );
+ if ( sListStyleName ==
+ mpTextListsHelper->GetListStyleOfLastProcessedList() &&
+ // Inconsistent behavior regarding lists (#i92811#)
+ sContinueListId ==
+ mpTextListsHelper->GetLastProcessedListId() &&
+ !rNextInfo.IsRestart() )
+ {
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT,
+ XML_CONTINUE_NUMBERING,
+ XML_TRUE );
+ }
+ else
+ {
+ if ( bExportODF &&
+ eODFDefaultVersion >= SvtSaveOptions::ODFVER_012 &&
+ sListId.getLength() > 0 )
+ {
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT,
+ XML_CONTINUE_LIST,
+ sContinueListId );
+ }
+
+ if ( rNextInfo.IsRestart() &&
+ ( nListLevelsToBeOpened != 1 ||
+ !rNextInfo.HasStartValue() ) )
+ {
+ bRestartNumberingAtContinuedRootList = true;
+ nRestartValueForContinuedRootList =
+ rNextInfo.GetListLevelStartValue();
+ }
+ }
+
+ mpTextListsHelper->KeepListAsProcessed( sNewListId,
+ sListStyleName,
+ sContinueListId );
+ }
+
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME,
+ GetExport().EncodeStyleName( sListStyleName ) );
+ bExportListStyle = false;
+
+ bRootListToBeStarted = false;
+ }
+ else if ( bExportListStyle &&
+ !mpTextListsHelper->EqualsToTopListStyleOnStack( sListStyleName ) )
+ {
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME,
+ GetExport().EncodeStyleName( sListStyleName ) );
+ bExportListStyle = false;
+ }
+
+ if ( bContinueingPreviousSubList )
+ {
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT,
+ XML_CONTINUE_NUMBERING, XML_TRUE );
+ bContinueingPreviousSubList = false;
+ }
+
+ enum XMLTokenEnum eLName = XML_LIST;
+
+ OUString *pElem = new OUString(
+ GetExport().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_TEXT,
+ GetXMLToken(eLName) ) );
+ GetExport().IgnorableWhitespace();
+ GetExport().StartElement( *pElem, sal_False );
+
+ if( !pListElements )
+ pListElements = new OUStrings_Impl;
+ pListElements->Insert( pElem, pListElements->Count() );
+
+ mpTextListsHelper->PushListOnStack( sListId,
+ sListStyleName );
+
+ // <text:list-header> or <text:list-item>
+ GetExport().CheckAttrList();
+
+ /* Export start value in case of <bRestartNumberingAtContinuedRootList>
+ at correct list item (#i97309#)
+ */
+ if ( nListLevelsToBeOpened == 1 )
+ {
+ if ( rNextInfo.HasStartValue() )
+ {
+ OUStringBuffer aBuffer;
+ aBuffer.append( (sal_Int32)rNextInfo.GetStartValue() );
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_START_VALUE,
+ aBuffer.makeStringAndClear() );
+ }
+ else if ( bRestartNumberingAtContinuedRootList )
+ {
+ OUStringBuffer aBuffer;
+ aBuffer.append( (sal_Int32)nRestartValueForContinuedRootList );
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT,
+ XML_START_VALUE,
+ aBuffer.makeStringAndClear() );
+ bRestartNumberingAtContinuedRootList = false;
+ }
+ }
+
+ eLName = ( rNextInfo.IsNumbered() || nListLevelsToBeOpened > 1 )
+ ? XML_LIST_ITEM
+ : XML_LIST_HEADER;
+ pElem = new OUString( GetExport().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_TEXT,
+ GetXMLToken(eLName) ) );
+ GetExport().IgnorableWhitespace();
+ GetExport().StartElement( *pElem, sal_False );
+
+ pListElements->Insert( pElem, pListElements->Count() );
+
+ // export of <text:number> element for last opened <text:list-item>, if requested
+ if ( GetExport().exportTextNumberElement() &&
+ eLName == XML_LIST_ITEM && nListLevelsToBeOpened == 1 && // last iteration --> last opened <text:list-item>
+ rNextInfo.ListLabelString().getLength() > 0 )
+ {
+ const ::rtl::OUString aTextNumberElem =
+ OUString( GetExport().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_TEXT,
+ GetXMLToken(XML_NUMBER) ) );
+ GetExport().IgnorableWhitespace();
+ GetExport().StartElement( aTextNumberElem, sal_False );
+ GetExport().Characters( rNextInfo.ListLabelString() );
+ GetExport().EndElement( aTextNumberElem, sal_True );
+ }
+ --nListLevelsToBeOpened;
+ } while ( nListLevelsToBeOpened > 0 );
+ }
+ }
+
+ if ( rNextInfo.GetLevel() > 0 &&
+ rNextInfo.IsNumbered() &&
+ rPrevInfo.BelongsToSameList( rNextInfo ) &&
+ rPrevInfo.GetLevel() >= rNextInfo.GetLevel() )
+ {
+ // close previous list-item
+ DBG_ASSERT( pListElements && pListElements->Count() >= 2,
+ "SwXMLExport::ExportListChange: list elements missing" );
+
+ OUString *pElem = (*pListElements)[pListElements->Count()-1];
+ GetExport().EndElement( *pElem, sal_True );
+
+ pListElements->Remove( pListElements->Count()-1 );
+ delete pElem;
+
+ // Only for sub lists (#i103745#)
+ if ( rNextInfo.IsRestart() && !rNextInfo.HasStartValue() &&
+ rNextInfo.GetLevel() != 1 )
+ {
+ // start new sub list respectively list on same list level
+ pElem = (*pListElements)[pListElements->Count()-1];
+ GetExport().EndElement( *pElem, sal_True );
+ GetExport().IgnorableWhitespace();
+ GetExport().StartElement( *pElem, sal_False );
+ }
+
+ // open new list-item
+ GetExport().CheckAttrList();
+ if( rNextInfo.HasStartValue() )
+ {
+ OUStringBuffer aBuffer;
+ aBuffer.append( (sal_Int32)rNextInfo.GetStartValue() );
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_START_VALUE,
+ aBuffer.makeStringAndClear() );
+ }
+ // Handle restart without start value on list level 1 (#i103745#)
+ else if ( rNextInfo.IsRestart() && /*!rNextInfo.HasStartValue() &&*/
+ rNextInfo.GetLevel() == 1 )
+ {
+ OUStringBuffer aBuffer;
+ aBuffer.append( (sal_Int32)rNextInfo.GetListLevelStartValue() );
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_START_VALUE,
+ aBuffer.makeStringAndClear() );
+ }
+ if ( ( GetExport().getExportFlags() & EXPORT_OASIS ) != 0 &&
+ GetExport().getDefaultVersion() >= SvtSaveOptions::ODFVER_012 )
+ {
+ const ::rtl::OUString sListStyleName( rNextInfo.GetNumRulesName() );
+ if ( !mpTextListsHelper->EqualsToTopListStyleOnStack( sListStyleName ) )
+ {
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT,
+ XML_STYLE_OVERRIDE,
+ GetExport().EncodeStyleName( sListStyleName ) );
+ }
+ }
+ pElem = new OUString( GetExport().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_TEXT,
+ GetXMLToken(XML_LIST_ITEM) ) );
+ GetExport().IgnorableWhitespace();
+ GetExport().StartElement( *pElem, sal_False );
+
+ pListElements->Insert( pElem, pListElements->Count() );
+
+ // export of <text:number> element for <text:list-item>, if requested
+ if ( GetExport().exportTextNumberElement() &&
+ rNextInfo.ListLabelString().getLength() > 0 )
+ {
+ const ::rtl::OUString aTextNumberElem =
+ OUString( GetExport().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_TEXT,
+ GetXMLToken(XML_NUMBER) ) );
+ GetExport().IgnorableWhitespace();
+ GetExport().StartElement( aTextNumberElem, sal_False );
+ GetExport().Characters( rNextInfo.ListLabelString() );
+ GetExport().EndElement( aTextNumberElem, sal_True );
+ }
+ }
+}
+
+XMLTextParagraphExport::XMLTextParagraphExport(
+ SvXMLExport& rExp,
+ SvXMLAutoStylePoolP & rASP
+ ) :
+ XMLStyleExport( rExp, OUString(), &rASP ),
+ rAutoStylePool( rASP ),
+ pBoundFrameSets(new BoundFrameSets(GetExport().GetModel())),
+ pFieldExport( 0 ),
+ pListElements( 0 ),
+ pListAutoPool( new XMLTextListAutoStylePool( this->GetExport() ) ),
+ pSectionExport( NULL ),
+ pIndexMarkExport( NULL ),
+ pRedlineExport( NULL ),
+ pHeadingStyles( NULL ),
+ bProgress( sal_False ),
+ bBlock( sal_False ),
+ bOpenRuby( sal_False ),
+ mpTextListsHelper( 0 ),
+ maTextListsHelperStack(),
+ sActualSize(RTL_CONSTASCII_USTRINGPARAM("ActualSize")),
+ // Implement Title/Description Elements UI (#i73249#)
+ sTitle(RTL_CONSTASCII_USTRINGPARAM("Title")),
+ sDescription(RTL_CONSTASCII_USTRINGPARAM("Description")),
+ sAnchorCharStyleName(RTL_CONSTASCII_USTRINGPARAM("AnchorCharStyleName")),
+ sAnchorPageNo(RTL_CONSTASCII_USTRINGPARAM("AnchorPageNo")),
+ sAnchorType(RTL_CONSTASCII_USTRINGPARAM("AnchorType")),
+ sBeginNotice(RTL_CONSTASCII_USTRINGPARAM("BeginNotice")),
+ sBookmark(RTL_CONSTASCII_USTRINGPARAM("Bookmark")),
+ sCategory(RTL_CONSTASCII_USTRINGPARAM("Category")),
+ sChainNextName(RTL_CONSTASCII_USTRINGPARAM("ChainNextName")),
+ sCharStyleName(RTL_CONSTASCII_USTRINGPARAM("CharStyleName")),
+ sCharStyleNames(RTL_CONSTASCII_USTRINGPARAM("CharStyleNames")),
+ sContourPolyPolygon(RTL_CONSTASCII_USTRINGPARAM("ContourPolyPolygon")),
+ sDocumentIndex(RTL_CONSTASCII_USTRINGPARAM("DocumentIndex")),
+ sDocumentIndexMark(RTL_CONSTASCII_USTRINGPARAM("DocumentIndexMark")),
+ sEndNotice(RTL_CONSTASCII_USTRINGPARAM("EndNotice")),
+ sFootnote(RTL_CONSTASCII_USTRINGPARAM("Footnote")),
+ sFootnoteCounting(RTL_CONSTASCII_USTRINGPARAM("FootnoteCounting")),
+ sFrame(RTL_CONSTASCII_USTRINGPARAM("Frame")),
+ sFrameHeightAbsolute(RTL_CONSTASCII_USTRINGPARAM("FrameHeightAbsolute")),
+ sFrameHeightPercent(RTL_CONSTASCII_USTRINGPARAM("FrameHeightPercent")),
+ sFrameStyleName(RTL_CONSTASCII_USTRINGPARAM("FrameStyleName")),
+ sFrameWidthAbsolute(RTL_CONSTASCII_USTRINGPARAM("FrameWidthAbsolute")),
+ sFrameWidthPercent(RTL_CONSTASCII_USTRINGPARAM("FrameWidthPercent")),
+ sGraphicFilter(RTL_CONSTASCII_USTRINGPARAM("GraphicFilter")),
+ sGraphicRotation(RTL_CONSTASCII_USTRINGPARAM("GraphicRotation")),
+ sGraphicURL(RTL_CONSTASCII_USTRINGPARAM("GraphicURL")),
+ sHeight(RTL_CONSTASCII_USTRINGPARAM("Height")),
+ sHoriOrient(RTL_CONSTASCII_USTRINGPARAM("HoriOrient")),
+ sHoriOrientPosition(RTL_CONSTASCII_USTRINGPARAM("HoriOrientPosition")),
+ sHyperLinkName(RTL_CONSTASCII_USTRINGPARAM("HyperLinkName")),
+ sHyperLinkTarget(RTL_CONSTASCII_USTRINGPARAM("HyperLinkTarget")),
+ sHyperLinkURL(RTL_CONSTASCII_USTRINGPARAM("HyperLinkURL")),
+ sIsAutomaticContour(RTL_CONSTASCII_USTRINGPARAM("IsAutomaticContour")),
+ sIsCollapsed(RTL_CONSTASCII_USTRINGPARAM("IsCollapsed")),
+ sIsPixelContour(RTL_CONSTASCII_USTRINGPARAM("IsPixelContour")),
+ sIsStart(RTL_CONSTASCII_USTRINGPARAM("IsStart")),
+ sIsSyncHeightToWidth(RTL_CONSTASCII_USTRINGPARAM("IsSyncHeightToWidth")),
+ sIsSyncWidthToHeight(RTL_CONSTASCII_USTRINGPARAM("IsSyncWidthToHeight")),
+ sNumberingRules(RTL_CONSTASCII_USTRINGPARAM("NumberingRules")),
+ sNumberingType(RTL_CONSTASCII_USTRINGPARAM("NumberingType")),
+ sPageDescName(RTL_CONSTASCII_USTRINGPARAM("PageDescName")),
+ sPageStyleName(RTL_CONSTASCII_USTRINGPARAM("PageStyleName")),
+ sParaChapterNumberingLevel(RTL_CONSTASCII_USTRINGPARAM("ParaChapterNumberingLevel")),
+ sParaConditionalStyleName(RTL_CONSTASCII_USTRINGPARAM("ParaConditionalStyleName")),
+ sParagraphService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Paragraph")),
+ sParaStyleName(RTL_CONSTASCII_USTRINGPARAM("ParaStyleName")),
+ sPositionEndOfDoc(RTL_CONSTASCII_USTRINGPARAM("PositionEndOfDoc")),
+ sPrefix(RTL_CONSTASCII_USTRINGPARAM("Prefix")),
+ sRedline(RTL_CONSTASCII_USTRINGPARAM("Redline")),
+ sReferenceId(RTL_CONSTASCII_USTRINGPARAM("ReferenceId")),
+ sReferenceMark(RTL_CONSTASCII_USTRINGPARAM("ReferenceMark")),
+ sRelativeHeight(RTL_CONSTASCII_USTRINGPARAM("RelativeHeight")),
+ sRelativeWidth(RTL_CONSTASCII_USTRINGPARAM("RelativeWidth")),
+ sRuby(RTL_CONSTASCII_USTRINGPARAM("Ruby")),
+ sRubyAdjust(RTL_CONSTASCII_USTRINGPARAM("RubyAdjust")),
+ sRubyCharStyleName(RTL_CONSTASCII_USTRINGPARAM("RubyCharStyleName")),
+ sRubyText(RTL_CONSTASCII_USTRINGPARAM("RubyText")),
+ sServerMap(RTL_CONSTASCII_USTRINGPARAM("ServerMap")),
+ sShapeService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.Shape")),
+ sSizeType(RTL_CONSTASCII_USTRINGPARAM("SizeType")),
+ sSoftPageBreak( RTL_CONSTASCII_USTRINGPARAM( "SoftPageBreak" ) ),
+ sStartAt(RTL_CONSTASCII_USTRINGPARAM("StartAt")),
+ sSuffix(RTL_CONSTASCII_USTRINGPARAM("Suffix")),
+ sTableService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextTable")),
+ sText(RTL_CONSTASCII_USTRINGPARAM("Text")),
+ sTextContentService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextContent")),
+ sTextEmbeddedService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextEmbeddedObject")),
+ sTextEndnoteService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Endnote")),
+ sTextField(RTL_CONSTASCII_USTRINGPARAM("TextField")),
+ sTextFieldService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextField")),
+ sTextFrameService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextFrame")),
+ sTextGraphicService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextGraphicObject")),
+ sTextPortionType(RTL_CONSTASCII_USTRINGPARAM("TextPortionType")),
+ sTextSection(RTL_CONSTASCII_USTRINGPARAM("TextSection")),
+ sUnvisitedCharStyleName(RTL_CONSTASCII_USTRINGPARAM("UnvisitedCharStyleName")),
+ sVertOrient(RTL_CONSTASCII_USTRINGPARAM("VertOrient")),
+ sVertOrientPosition(RTL_CONSTASCII_USTRINGPARAM("VertOrientPosition")),
+ sVisitedCharStyleName(RTL_CONSTASCII_USTRINGPARAM("VisitedCharStyleName")),
+ sWidth(RTL_CONSTASCII_USTRINGPARAM("Width")),
+ sWidthType( RTL_CONSTASCII_USTRINGPARAM( "WidthType" ) ),
+ sTextFieldStart( RTL_CONSTASCII_USTRINGPARAM( "TextFieldStart" ) ),
+ sTextFieldEnd( RTL_CONSTASCII_USTRINGPARAM( "TextFieldEnd" ) ),
+ sTextFieldStartEnd( RTL_CONSTASCII_USTRINGPARAM( "TextFieldStartEnd" ) ),
+ aCharStyleNamesPropInfoCache( sCharStyleNames )
+{
+ UniReference < XMLPropertySetMapper > xPropMapper(new XMLTextPropertySetMapper( TEXT_PROP_MAP_PARA ));
+ xParaPropMapper = new XMLTextExportPropertySetMapper( xPropMapper,
+ GetExport() );
+
+ OUString sFamily( GetXMLToken(XML_PARAGRAPH) );
+ OUString aPrefix( String( 'P' ) );
+ rAutoStylePool.AddFamily( XML_STYLE_FAMILY_TEXT_PARAGRAPH, sFamily,
+ xParaPropMapper, aPrefix );
+
+ xPropMapper = new XMLTextPropertySetMapper( TEXT_PROP_MAP_TEXT );
+ xTextPropMapper = new XMLTextExportPropertySetMapper( xPropMapper,
+ GetExport() );
+ sFamily = OUString( GetXMLToken(XML_TEXT) );
+ aPrefix = OUString( String( 'T' ) );
+ rAutoStylePool.AddFamily( XML_STYLE_FAMILY_TEXT_TEXT, sFamily,
+ xTextPropMapper, aPrefix );
+
+ xPropMapper = new XMLTextPropertySetMapper( TEXT_PROP_MAP_AUTO_FRAME );
+ xAutoFramePropMapper = new XMLTextExportPropertySetMapper( xPropMapper,
+ GetExport() );
+ sFamily = OUString( RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_NAME) );
+ aPrefix = OUString( RTL_CONSTASCII_USTRINGPARAM( "fr" ) );
+ rAutoStylePool.AddFamily( XML_STYLE_FAMILY_TEXT_FRAME, sFamily,
+ xAutoFramePropMapper, aPrefix );
+
+ xPropMapper = new XMLTextPropertySetMapper( TEXT_PROP_MAP_SECTION );
+ xSectionPropMapper = new XMLTextExportPropertySetMapper( xPropMapper,
+ GetExport() );
+ sFamily = OUString( GetXMLToken( XML_SECTION ) );
+ aPrefix = OUString( RTL_CONSTASCII_USTRINGPARAM( "Sect" ) );
+ rAutoStylePool.AddFamily( XML_STYLE_FAMILY_TEXT_SECTION, sFamily,
+ xSectionPropMapper, aPrefix );
+
+ xPropMapper = new XMLTextPropertySetMapper( TEXT_PROP_MAP_RUBY );
+ xRubyPropMapper = new SvXMLExportPropertyMapper( xPropMapper );
+ sFamily = OUString( GetXMLToken( XML_RUBY ) );
+ aPrefix = OUString( RTL_CONSTASCII_USTRINGPARAM( "Ru" ) );
+ rAutoStylePool.AddFamily( XML_STYLE_FAMILY_TEXT_RUBY, sFamily,
+ xRubyPropMapper, aPrefix );
+
+ xPropMapper = new XMLTextPropertySetMapper( TEXT_PROP_MAP_FRAME );
+ xFramePropMapper = new XMLTextExportPropertySetMapper( xPropMapper,
+ GetExport() );
+
+ pSectionExport = new XMLSectionExport( rExp, *this );
+ pIndexMarkExport = new XMLIndexMarkExport( rExp, *this );
+
+ if( ! IsBlockMode() &&
+ Reference<XRedlinesSupplier>( GetExport().GetModel(), UNO_QUERY ).is())
+ pRedlineExport = new XMLRedlineExport( rExp );
+
+ // The text field helper needs a pre-constructed XMLPropertyState
+ // to export the combined characters field. We construct that
+ // here, because we need the text property mapper to do it.
+
+ // construct Any value, then find index
+ sal_Int32 nIndex = xTextPropMapper->getPropertySetMapper()->FindEntryIndex(
+ "", XML_NAMESPACE_STYLE,
+ GetXMLToken(XML_TEXT_COMBINE));
+ pFieldExport = new XMLTextFieldExport( rExp, new XMLPropertyState( nIndex, uno::makeAny(sal_True) ) );
+ PushNewTextListsHelper();
+}
+
+XMLTextParagraphExport::~XMLTextParagraphExport()
+{
+ delete pHeadingStyles;
+ delete pRedlineExport;
+ delete pIndexMarkExport;
+ delete pSectionExport;
+ delete pFieldExport;
+ delete pListElements;
+ delete pListAutoPool;
+#ifdef DBG_UTIL
+ txtparae_bContainsIllegalCharacters = sal_False;
+#endif
+ PopTextListsHelper();
+ DBG_ASSERT( maTextListsHelperStack.size() == 0,
+ "misusage of text lists helper stack - it is not empty. Serious defect - please inform OD" );
+}
+
+SvXMLExportPropertyMapper *XMLTextParagraphExport::CreateShapeExtPropMapper(
+ SvXMLExport& rExport )
+{
+ UniReference < XMLPropertySetMapper > xPropMapper =
+ new XMLTextPropertySetMapper( TEXT_PROP_MAP_SHAPE );
+ return new XMLTextExportPropertySetMapper( xPropMapper, rExport );
+}
+
+SvXMLExportPropertyMapper *XMLTextParagraphExport::CreateCharExtPropMapper(
+ SvXMLExport& rExport)
+{
+ XMLPropertySetMapper *pPropMapper =
+ new XMLTextPropertySetMapper( TEXT_PROP_MAP_TEXT );
+ return new XMLTextExportPropertySetMapper( pPropMapper, rExport );
+}
+
+SvXMLExportPropertyMapper *XMLTextParagraphExport::CreateParaExtPropMapper(
+ SvXMLExport& rExport)
+{
+ XMLPropertySetMapper *pPropMapper =
+ new XMLTextPropertySetMapper( TEXT_PROP_MAP_SHAPE_PARA );
+ return new XMLTextExportPropertySetMapper( pPropMapper, rExport );
+}
+
+SvXMLExportPropertyMapper *XMLTextParagraphExport::CreateParaDefaultExtPropMapper(
+ SvXMLExport& rExport)
+{
+ XMLPropertySetMapper *pPropMapper =
+ new XMLTextPropertySetMapper( TEXT_PROP_MAP_TEXT_ADDITIONAL_DEFAULTS );
+ return new XMLTextExportPropertySetMapper( pPropMapper, rExport );
+}
+
+void XMLTextParagraphExport::exportPageFrames( sal_Bool bAutoStyles,
+ sal_Bool bIsProgress )
+{
+ const TextContentSet* const pTexts = pBoundFrameSets->GetTexts()->GetPageBoundContents();
+ const TextContentSet* const pGraphics = pBoundFrameSets->GetGraphics()->GetPageBoundContents();
+ const TextContentSet* const pEmbeddeds = pBoundFrameSets->GetEmbeddeds()->GetPageBoundContents();
+ const TextContentSet* const pShapes = pBoundFrameSets->GetShapes()->GetPageBoundContents();
+ for(TextContentSet::const_iterator_t it = pTexts->getBegin();
+ it != pTexts->getEnd();
+ ++it)
+ exportTextFrame(*it, bAutoStyles, bIsProgress, sal_True);
+ for(TextContentSet::const_iterator_t it = pGraphics->getBegin();
+ it != pGraphics->getEnd();
+ ++it)
+ exportTextGraphic(*it, bAutoStyles);
+ for(TextContentSet::const_iterator_t it = pEmbeddeds->getBegin();
+ it != pEmbeddeds->getEnd();
+ ++it)
+ exportTextEmbedded(*it, bAutoStyles);
+ for(TextContentSet::const_iterator_t it = pShapes->getBegin();
+ it != pShapes->getEnd();
+ ++it)
+ exportShape(*it, bAutoStyles);
+}
+
+void XMLTextParagraphExport::exportFrameFrames(
+ sal_Bool bAutoStyles,
+ sal_Bool bIsProgress,
+ const Reference < XTextFrame > *pParentTxtFrame )
+{
+ const TextContentSet* const pTexts = pBoundFrameSets->GetTexts()->GetFrameBoundContents(*pParentTxtFrame);
+ if(pTexts)
+ for(TextContentSet::const_iterator_t it = pTexts->getBegin();
+ it != pTexts->getEnd();
+ ++it)
+ exportTextFrame(*it, bAutoStyles, bIsProgress, sal_True);
+ const TextContentSet* const pGraphics = pBoundFrameSets->GetGraphics()->GetFrameBoundContents(*pParentTxtFrame);
+ if(pGraphics)
+ for(TextContentSet::const_iterator_t it = pGraphics->getBegin();
+ it != pGraphics->getEnd();
+ ++it)
+ exportTextGraphic(*it, bAutoStyles);
+ const TextContentSet* const pEmbeddeds = pBoundFrameSets->GetEmbeddeds()->GetFrameBoundContents(*pParentTxtFrame);
+ if(pEmbeddeds)
+ for(TextContentSet::const_iterator_t it = pEmbeddeds->getBegin();
+ it != pEmbeddeds->getEnd();
+ ++it)
+ exportTextEmbedded(*it, bAutoStyles);
+ const TextContentSet* const pShapes = pBoundFrameSets->GetShapes()->GetFrameBoundContents(*pParentTxtFrame);
+ if(pShapes)
+ for(TextContentSet::const_iterator_t it = pShapes->getBegin();
+ it != pShapes->getEnd();
+ ++it)
+ exportShape(*it, bAutoStyles);
+}
+
+// bookmarks, reference marks (and TOC marks) are the same except for the
+// element names. We use the same method for export and it an array with
+// the proper element names
+static const enum XMLTokenEnum lcl_XmlReferenceElements[] = {
+ XML_REFERENCE_MARK, XML_REFERENCE_MARK_START, XML_REFERENCE_MARK_END };
+static const enum XMLTokenEnum lcl_XmlBookmarkElements[] = {
+ XML_BOOKMARK, XML_BOOKMARK_START, XML_BOOKMARK_END };
+
+// This function replaces the text portion iteration during auto style
+// collection.
+bool XMLTextParagraphExport::collectTextAutoStylesOptimized( sal_Bool bIsProgress )
+{
+ GetExport().GetShapeExport(); // make sure the graphics styles family is added
+
+ const sal_Bool bAutoStyles = sal_True;
+ const sal_Bool bExportContent = sal_False;
+
+ // Export AutoStyles:
+ Reference< XAutoStylesSupplier > xAutoStylesSupp( GetExport().GetModel(), UNO_QUERY );
+ if ( xAutoStylesSupp.is() )
+ {
+ Reference< XAutoStyles > xAutoStyleFamilies = xAutoStylesSupp->getAutoStyles();
+ OUString sName;
+ sal_uInt16 nFamily;
+
+ for ( int i = 0; i < 3; ++i )
+ {
+ if ( 0 == i )
+ {
+ sName = OUString( RTL_CONSTASCII_USTRINGPARAM( "CharacterStyles" ) );
+ nFamily = XML_STYLE_FAMILY_TEXT_TEXT;
+ }
+ else if ( 1 == i )
+ {
+ sName = OUString( RTL_CONSTASCII_USTRINGPARAM( "RubyStyles" ) );
+ nFamily = XML_STYLE_FAMILY_TEXT_RUBY;
+ }
+ else
+ {
+ sName = OUString( RTL_CONSTASCII_USTRINGPARAM( "ParagraphStyles" ) );
+ nFamily = XML_STYLE_FAMILY_TEXT_PARAGRAPH;
+ }
+
+ Any aAny = xAutoStyleFamilies->getByName( sName );
+ Reference< XAutoStyleFamily > xAutoStyles = *(Reference<XAutoStyleFamily>*)aAny.getValue();
+ Reference < XEnumeration > xAutoStylesEnum( xAutoStyles->createEnumeration() );
+
+ while ( xAutoStylesEnum->hasMoreElements() )
+ {
+ aAny = xAutoStylesEnum->nextElement();
+ Reference< XAutoStyle > xAutoStyle = *(Reference<XAutoStyle>*)aAny.getValue();
+ Reference < XPropertySet > xPSet( xAutoStyle, uno::UNO_QUERY );
+ Add( nFamily, xPSet, 0, true );
+ }
+ }
+ }
+
+ // Export Field AutoStyles:
+ Reference< XTextFieldsSupplier > xTextFieldsSupp( GetExport().GetModel(), UNO_QUERY );
+ if ( xTextFieldsSupp.is() )
+ {
+ Reference< XEnumerationAccess > xTextFields = xTextFieldsSupp->getTextFields();
+ Reference < XEnumeration > xTextFieldsEnum( xTextFields->createEnumeration() );
+
+ while ( xTextFieldsEnum->hasMoreElements() )
+ {
+ Any aAny = xTextFieldsEnum->nextElement();
+ Reference< XTextField > xTextField = *(Reference<XTextField>*)aAny.getValue();
+ exportTextField( xTextField, bAutoStyles, bIsProgress,
+ !xAutoStylesSupp.is() );
+ try
+ {
+ Reference < XPropertySet > xSet( xTextField, UNO_QUERY );
+ Reference < XText > xText;
+ Any a = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TextRange")) );
+ a >>= xText;
+ if ( xText.is() )
+ {
+ exportText( xText, sal_True, bIsProgress, bExportContent );
+ GetExport().GetTextParagraphExport()
+ ->collectTextAutoStyles( xText );
+ }
+ }
+ catch (Exception&)
+ {
+ }
+ }
+ }
+
+ // Export text frames:
+ Reference<XEnumeration> xTextFramesEnum = pBoundFrameSets->GetTexts()->createEnumeration();
+ if(xTextFramesEnum.is())
+ while(xTextFramesEnum->hasMoreElements())
+ {
+ Reference<XTextContent> xTxtCntnt(xTextFramesEnum->nextElement(), UNO_QUERY);
+ if(xTxtCntnt.is())
+ exportTextFrame(xTxtCntnt, bAutoStyles, bIsProgress, bExportContent, 0);
+ }
+
+ // Export graphic objects:
+ Reference<XEnumeration> xGraphicsEnum = pBoundFrameSets->GetGraphics()->createEnumeration();
+ if(xGraphicsEnum.is())
+ while(xGraphicsEnum->hasMoreElements())
+ {
+ Reference<XTextContent> xTxtCntnt(xGraphicsEnum->nextElement(), UNO_QUERY);
+ if(xTxtCntnt.is())
+ exportTextGraphic(xTxtCntnt, true, 0);
+ }
+
+ // Export embedded objects:
+ Reference<XEnumeration> xEmbeddedsEnum = pBoundFrameSets->GetEmbeddeds()->createEnumeration();
+ if(xEmbeddedsEnum.is())
+ while(xEmbeddedsEnum->hasMoreElements())
+ {
+ Reference<XTextContent> xTxtCntnt(xEmbeddedsEnum->nextElement(), UNO_QUERY);
+ if(xTxtCntnt.is())
+ exportTextEmbedded(xTxtCntnt, true, 0);
+ }
+
+ // Export shapes:
+ Reference<XEnumeration> xShapesEnum = pBoundFrameSets->GetShapes()->createEnumeration();
+ if(xShapesEnum.is())
+ while(xShapesEnum->hasMoreElements())
+ {
+ Reference<XTextContent> xTxtCntnt(xShapesEnum->nextElement(), UNO_QUERY);
+ if(xTxtCntnt.is())
+ {
+ Reference<XServiceInfo> xServiceInfo(xTxtCntnt, UNO_QUERY);
+ if( xServiceInfo->supportsService(sShapeService))
+ exportShape(xTxtCntnt, true, 0);
+ }
+ }
+
+ sal_Int32 nCount;
+ // AutoStyles for sections
+ Reference< XTextSectionsSupplier > xSectionsSupp( GetExport().GetModel(), UNO_QUERY );
+ if ( xSectionsSupp.is() )
+ {
+ Reference< XIndexAccess > xSections( xSectionsSupp->getTextSections(), UNO_QUERY );
+ if ( xSections.is() )
+ {
+ nCount = xSections->getCount();
+ for( sal_Int32 i = 0; i < nCount; ++i )
+ {
+ Any aAny = xSections->getByIndex( i );
+ Reference< XTextSection > xSection = *(Reference<XTextSection>*)aAny.getValue();
+ Reference < XPropertySet > xPSet( xSection, uno::UNO_QUERY );
+ Add( XML_STYLE_FAMILY_TEXT_SECTION, xPSet );
+ }
+ }
+ }
+
+ // AutoStyles for tables (Note: suppress autostyle collection for paragraphs in exportTable)
+ Reference< XTextTablesSupplier > xTablesSupp( GetExport().GetModel(), UNO_QUERY );
+ if ( xTablesSupp.is() )
+ {
+ Reference< XIndexAccess > xTables( xTablesSupp->getTextTables(), UNO_QUERY );
+ if ( xTables.is() )
+ {
+ nCount = xTables->getCount();
+ for( sal_Int32 i = 0; i < nCount; ++i )
+ {
+ Any aAny = xTables->getByIndex( i );
+ Reference< XTextTable > xTable = *(Reference<XTextTable>*)aAny.getValue();
+ Reference < XTextContent > xTextContent( xTable, uno::UNO_QUERY );
+ exportTable( xTextContent, sal_True, sal_True );
+ }
+ }
+ }
+
+ Reference< XNumberingRulesSupplier > xNumberingRulesSupp( GetExport().GetModel(), UNO_QUERY );
+ if ( xNumberingRulesSupp.is() )
+ {
+ Reference< XIndexAccess > xNumberingRules = xNumberingRulesSupp->getNumberingRules();
+ nCount = xNumberingRules->getCount();
+ // Custom outline assignment lost after re-importing sxw (#i73361#)
+ const OUString sNumberingIsOutline( RTL_CONSTASCII_USTRINGPARAM( "NumberingIsOutline" ) );
+ for( sal_Int32 i = 0; i < nCount; ++i )
+ {
+ Reference< XIndexReplace > xNumRule( xNumberingRules->getByIndex( i ), UNO_QUERY );
+ if( xNumRule.is() && xNumRule->getCount() )
+ {
+ Reference < XNamed > xNamed( xNumRule, UNO_QUERY );
+ OUString sName;
+ if( xNamed.is() )
+ sName = xNamed->getName();
+ sal_Bool bAdd = !sName.getLength();
+ if( !bAdd )
+ {
+ Reference < XPropertySet > xNumPropSet( xNumRule,
+ UNO_QUERY );
+ const OUString sIsAutomatic( RTL_CONSTASCII_USTRINGPARAM( "IsAutomatic" ) );
+ if( xNumPropSet.is() &&
+ xNumPropSet->getPropertySetInfo()
+ ->hasPropertyByName( sIsAutomatic ) )
+ {
+ bAdd = *(sal_Bool *)xNumPropSet->getPropertyValue( sIsAutomatic ).getValue();
+ // Check on outline style (#i73361#)
+ if ( bAdd &&
+ xNumPropSet->getPropertySetInfo()
+ ->hasPropertyByName( sNumberingIsOutline ) )
+ {
+ bAdd = !(*(sal_Bool *)xNumPropSet->getPropertyValue( sNumberingIsOutline ).getValue());
+ }
+ }
+ else
+ {
+ bAdd = sal_True;
+ }
+ }
+ if( bAdd )
+ pListAutoPool->Add( xNumRule );
+ }
+ }
+ }
+
+ return true;
+}
+
+void XMLTextParagraphExport::exportText(
+ const Reference < XText > & rText,
+ sal_Bool bAutoStyles,
+ sal_Bool bIsProgress,
+ sal_Bool bExportParagraph )
+{
+ if( bAutoStyles )
+ GetExport().GetShapeExport(); // make sure the graphics styles family
+ // is added
+ Reference < XEnumerationAccess > xEA( rText, UNO_QUERY );
+ Reference < XEnumeration > xParaEnum(xEA->createEnumeration());
+ Reference < XPropertySet > xPropertySet( rText, UNO_QUERY );
+ Reference < XTextSection > xBaseSection;
+
+ // #97718# footnotes don't supply paragraph enumerations in some cases
+ // This is always a bug, but at least we don't want to crash.
+ DBG_ASSERT( xParaEnum.is(), "We need a paragraph enumeration" );
+ if( ! xParaEnum.is() )
+ return;
+
+ sal_Bool bExportLevels = sal_True;
+
+ if (xPropertySet.is())
+ {
+ Reference < XPropertySetInfo > xInfo ( xPropertySet->getPropertySetInfo() );
+
+ if( xInfo.is() )
+ {
+ if (xInfo->hasPropertyByName( sTextSection ))
+ {
+ xPropertySet->getPropertyValue(sTextSection) >>= xBaseSection ;
+ }
+
+/* #i35937#
+ // for applications that use the outliner we need to check if
+ // the current text object needs the level information exported
+ if( !bAutoStyles )
+ {
+ // fixme: move string to class member, couldn't do now because
+ // of no incompatible build
+ OUString sHasLevels( RTL_CONSTASCII_USTRINGPARAM("HasLevels") );
+ if (xInfo->hasPropertyByName( sHasLevels ) )
+ {
+ xPropertySet->getPropertyValue(sHasLevels) >>= bExportLevels;
+ }
+ }
+*/
+ }
+ }
+
+ // #96530# Export redlines at start & end of XText before & after
+ // exporting the text content enumeration
+ if( !bAutoStyles && (pRedlineExport != NULL) )
+ pRedlineExport->ExportStartOrEndRedline( xPropertySet, sal_True );
+ exportTextContentEnumeration( xParaEnum, bAutoStyles, xBaseSection,
+ bIsProgress, bExportParagraph, 0, bExportLevels );
+ if( !bAutoStyles && (pRedlineExport != NULL) )
+ pRedlineExport->ExportStartOrEndRedline( xPropertySet, sal_False );
+}
+
+void XMLTextParagraphExport::exportText(
+ const Reference < XText > & rText,
+ const Reference < XTextSection > & rBaseSection,
+ sal_Bool bAutoStyles,
+ sal_Bool bIsProgress,
+ sal_Bool bExportParagraph )
+{
+ if( bAutoStyles )
+ GetExport().GetShapeExport(); // make sure the graphics styles family
+ // is added
+ Reference < XEnumerationAccess > xEA( rText, UNO_QUERY );
+ Reference < XEnumeration > xParaEnum(xEA->createEnumeration());
+
+ // #98165# don't continue without a paragraph enumeration
+ if( ! xParaEnum.is() )
+ return;
+
+ // #96530# Export redlines at start & end of XText before & after
+ // exporting the text content enumeration
+ Reference<XPropertySet> xPropertySet;
+ if( !bAutoStyles && (pRedlineExport != NULL) )
+ {
+ xPropertySet.set(rText, uno::UNO_QUERY );
+ pRedlineExport->ExportStartOrEndRedline( xPropertySet, sal_True );
+ }
+ exportTextContentEnumeration( xParaEnum, bAutoStyles, rBaseSection,
+ bIsProgress, bExportParagraph );
+ if( !bAutoStyles && (pRedlineExport != NULL) )
+ pRedlineExport->ExportStartOrEndRedline( xPropertySet, sal_False );
+}
+
+sal_Bool XMLTextParagraphExport::exportTextContentEnumeration(
+ const Reference < XEnumeration > & rContEnum,
+ sal_Bool bAutoStyles,
+ const Reference < XTextSection > & rBaseSection,
+ sal_Bool bIsProgress,
+ sal_Bool bExportParagraph,
+ const Reference < XPropertySet > *pRangePropSet,
+ sal_Bool bExportLevels )
+{
+ DBG_ASSERT( rContEnum.is(), "No enumeration to export!" );
+ sal_Bool bHasMoreElements = rContEnum->hasMoreElements();
+ if( !bHasMoreElements )
+ return sal_False;
+
+ XMLTextNumRuleInfo aPrevNumInfo;
+ XMLTextNumRuleInfo aNextNumInfo;
+
+ sal_Bool bHasContent = sal_False;
+ Reference<XTextSection> xCurrentTextSection(rBaseSection);
+
+ MultiPropertySetHelper aPropSetHelper(
+ bAutoStyles ? aParagraphPropertyNamesAuto :
+ aParagraphPropertyNames );
+
+ sal_Bool bHoldElement = sal_False;
+ Reference < XTextContent > xTxtCntnt;
+ while( bHoldElement || bHasMoreElements )
+ {
+ if (bHoldElement)
+ {
+ bHoldElement = sal_False;
+ }
+ else
+ {
+ xTxtCntnt.set(rContEnum->nextElement(), uno::UNO_QUERY);
+
+ aPropSetHelper.resetValues();
+
+ }
+
+ Reference<XServiceInfo> xServiceInfo( xTxtCntnt, UNO_QUERY );
+ if( xServiceInfo->supportsService( sParagraphService ) )
+ {
+ if( bExportLevels )
+ {
+ if( bAutoStyles )
+ {
+ exportListAndSectionChange( xCurrentTextSection, xTxtCntnt,
+ aPrevNumInfo, aNextNumInfo,
+ bAutoStyles );
+ }
+ else
+ {
+ /* Pass list auto style pool to <XMLTextNumRuleInfo> instance
+ Pass info about request to export <text:number> element
+ to <XMLTextNumRuleInfo> instance (#i69627#)
+ */
+ aNextNumInfo.Set( xTxtCntnt,
+ GetExport().writeOutlineStyleAsNormalListStyle(),
+ GetListAutoStylePool(),
+ GetExport().exportTextNumberElement() );
+
+ exportListAndSectionChange( xCurrentTextSection, aPropSetHelper,
+ TEXT_SECTION, xTxtCntnt,
+ aPrevNumInfo, aNextNumInfo,
+ bAutoStyles );
+ }
+ }
+
+ // if we found a mute section: skip all section content
+ if (pSectionExport->IsMuteSection(xCurrentTextSection))
+ {
+ // Make sure headings are exported anyway.
+ if( !bAutoStyles )
+ pSectionExport->ExportMasterDocHeadingDummies();
+
+ while (rContEnum->hasMoreElements() &&
+ pSectionExport->IsInSection( xCurrentTextSection,
+ xTxtCntnt, sal_True ))
+ {
+ xTxtCntnt.set(rContEnum->nextElement(), uno::UNO_QUERY);
+ aPropSetHelper.resetValues();
+ aNextNumInfo.Reset();
+ }
+ // the first non-mute element still needs to be processed
+ bHoldElement =
+ ! pSectionExport->IsInSection( xCurrentTextSection,
+ xTxtCntnt, sal_False );
+ }
+ else
+ exportParagraph( xTxtCntnt, bAutoStyles, bIsProgress,
+ bExportParagraph, aPropSetHelper );
+ bHasContent = sal_True;
+ }
+ else if( xServiceInfo->supportsService( sTableService ) )
+ {
+ if( !bAutoStyles )
+ {
+ aNextNumInfo.Reset();
+ }
+
+ exportListAndSectionChange( xCurrentTextSection, xTxtCntnt,
+ aPrevNumInfo, aNextNumInfo,
+ bAutoStyles );
+
+ if (! pSectionExport->IsMuteSection(xCurrentTextSection))
+ {
+ // export start + end redlines (for wholly redlined tables)
+ if ((! bAutoStyles) && (NULL != pRedlineExport))
+ pRedlineExport->ExportStartOrEndRedline(xTxtCntnt, sal_True);
+
+ exportTable( xTxtCntnt, bAutoStyles, bIsProgress );
+
+ if ((! bAutoStyles) && (NULL != pRedlineExport))
+ pRedlineExport->ExportStartOrEndRedline(xTxtCntnt, sal_False);
+ }
+ else if( !bAutoStyles )
+ {
+ // Make sure headings are exported anyway.
+ pSectionExport->ExportMasterDocHeadingDummies();
+ }
+
+ bHasContent = sal_True;
+ }
+ else if( xServiceInfo->supportsService( sTextFrameService ) )
+ {
+ exportTextFrame( xTxtCntnt, bAutoStyles, bIsProgress, sal_True, pRangePropSet );
+ }
+ else if( xServiceInfo->supportsService( sTextGraphicService ) )
+ {
+ exportTextGraphic( xTxtCntnt, bAutoStyles, pRangePropSet );
+ }
+ else if( xServiceInfo->supportsService( sTextEmbeddedService ) )
+ {
+ exportTextEmbedded( xTxtCntnt, bAutoStyles, pRangePropSet );
+ }
+ else if( xServiceInfo->supportsService( sShapeService ) )
+ {
+ exportShape( xTxtCntnt, bAutoStyles, pRangePropSet );
+ }
+ else
+ {
+ DBG_ASSERT( !xTxtCntnt.is(), "unknown text content" );
+ }
+
+ if( !bAutoStyles )
+ {
+ aPrevNumInfo = aNextNumInfo;
+ }
+
+ bHasMoreElements = rContEnum->hasMoreElements();
+ }
+
+ if( bExportLevels && bHasContent && !bAutoStyles )
+ {
+ aNextNumInfo.Reset();
+
+ // close open lists and sections; no new styles
+ exportListAndSectionChange( xCurrentTextSection, rBaseSection,
+ aPrevNumInfo, aNextNumInfo,
+ bAutoStyles );
+ }
+
+ return sal_True;
+}
+
+void XMLTextParagraphExport::exportParagraph(
+ const Reference < XTextContent > & rTextContent,
+ sal_Bool bAutoStyles, sal_Bool bIsProgress, sal_Bool bExportParagraph,
+ MultiPropertySetHelper& rPropSetHelper)
+{
+ sal_Int16 nOutlineLevel = -1;
+
+ if( bIsProgress )
+ {
+ ProgressBarHelper *pProgress = GetExport().GetProgressBarHelper();
+ pProgress->SetValue( pProgress->GetValue()+1 );
+ }
+
+ // get property set or multi property set and initialize helper
+ Reference<XMultiPropertySet> xMultiPropSet( rTextContent, UNO_QUERY );
+ Reference<XPropertySet> xPropSet( rTextContent, UNO_QUERY );
+
+ // check for supported properties
+ if( !rPropSetHelper.checkedProperties() )
+ rPropSetHelper.hasProperties( xPropSet->getPropertySetInfo() );
+
+// if( xMultiPropSet.is() )
+// rPropSetHelper.getValues( xMultiPropSet );
+// else
+// rPropSetHelper.getValues( xPropSet );
+
+ if( bExportParagraph )
+ {
+ if( bAutoStyles )
+ {
+ Add( XML_STYLE_FAMILY_TEXT_PARAGRAPH, rPropSetHelper, xPropSet );
+ }
+ else
+ {
+ // xml:id for RDF metadata
+ GetExport().AddAttributeXmlId(rTextContent);
+ GetExport().AddAttributesRDFa(rTextContent);
+
+ OUString sStyle;
+ if( rPropSetHelper.hasProperty( PARA_STYLE_NAME ) )
+ {
+ if( xMultiPropSet.is() )
+ rPropSetHelper.getValue( PARA_STYLE_NAME,
+ xMultiPropSet ) >>= sStyle;
+ else
+ rPropSetHelper.getValue( PARA_STYLE_NAME,
+ xPropSet ) >>= sStyle;
+ }
+
+ Reference< XInterface > xRef( rTextContent, UNO_QUERY );
+ if( xRef.is() )
+ {
+ const OUString& rIdentifier = GetExport().getInterfaceToIdentifierMapper().getIdentifier( xRef );
+ if( rIdentifier.getLength() )
+ {
+ // FIXME: this is just temporary until EditEngine
+ // paragraphs implement XMetadatable.
+ // then that must be used and not the mapper, because
+ // when both can be used we get two xml:id!
+ uno::Reference<rdf::XMetadatable> const xMeta(xRef,
+ uno::UNO_QUERY);
+ OSL_ENSURE(!xMeta.is(), "paragraph that implements "
+ "XMetadatable used in interfaceToIdentifierMapper?");
+ GetExport().AddAttributeIdLegacy(XML_NAMESPACE_TEXT,
+ rIdentifier);
+ }
+ }
+
+ OUString sAutoStyle( sStyle );
+ sAutoStyle = Find( XML_STYLE_FAMILY_TEXT_PARAGRAPH, xPropSet, sStyle );
+ if( sAutoStyle.getLength() )
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME,
+ GetExport().EncodeStyleName( sAutoStyle ) );
+
+ if( rPropSetHelper.hasProperty( PARA_CONDITIONAL_STYLE_NAME ) )
+ {
+ OUString sCondStyle;
+ if( xMultiPropSet.is() )
+ rPropSetHelper.getValue( PARA_CONDITIONAL_STYLE_NAME,
+ xMultiPropSet ) >>= sCondStyle;
+ else
+ rPropSetHelper.getValue( PARA_CONDITIONAL_STYLE_NAME,
+ xPropSet ) >>= sCondStyle;
+ if( sCondStyle != sStyle )
+ {
+ sCondStyle = Find( XML_STYLE_FAMILY_TEXT_PARAGRAPH, xPropSet,
+ sCondStyle );
+ if( sCondStyle.getLength() )
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT,
+ XML_COND_STYLE_NAME,
+ GetExport().EncodeStyleName( sCondStyle ) );
+ }
+ }
+
+ if( rPropSetHelper.hasProperty( PARA_OUTLINE_LEVEL ) )
+ {
+ if( xMultiPropSet.is() )
+ rPropSetHelper.getValue( PARA_OUTLINE_LEVEL,
+ xMultiPropSet ) >>= nOutlineLevel;
+ else
+ rPropSetHelper.getValue( PARA_OUTLINE_LEVEL,
+ xPropSet ) >>= nOutlineLevel;
+
+ if( 0 < nOutlineLevel )
+ {
+ OUStringBuffer sTmp;
+ sTmp.append( sal_Int32( nOutlineLevel) );
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT,
+ XML_OUTLINE_LEVEL,
+ sTmp.makeStringAndClear() );
+
+ if( rPropSetHelper.hasProperty( NUMBERING_IS_NUMBER ) )
+ {
+ bool bIsNumber = false;
+ if( xMultiPropSet.is() )
+ rPropSetHelper.getValue(
+ NUMBERING_IS_NUMBER, xMultiPropSet ) >>= bIsNumber;
+ else
+ rPropSetHelper.getValue(
+ NUMBERING_IS_NUMBER, xPropSet ) >>= bIsNumber;
+
+ OUString sListStyleName;
+ if( xMultiPropSet.is() )
+ rPropSetHelper.getValue(
+ PARA_NUMBERING_STYLENAME, xMultiPropSet ) >>= sListStyleName;
+ else
+ rPropSetHelper.getValue(
+ PARA_NUMBERING_STYLENAME, xPropSet ) >>= sListStyleName;
+
+
+
+ bool bAssignedtoOutlineStyle = false;
+ {
+ Reference< XChapterNumberingSupplier > xCNSupplier( GetExport().GetModel(), UNO_QUERY );
+
+ OUString sOutlineName;
+ if (xCNSupplier.is())
+ {
+ Reference< XIndexReplace > xNumRule ( xCNSupplier->getChapterNumberingRules() );
+ DBG_ASSERT( xNumRule.is(), "no chapter numbering rules" );
+
+ if (xNumRule.is())
+ {
+ Reference< XPropertySet > xNumRulePropSet( xNumRule, UNO_QUERY );
+ xNumRulePropSet->getPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Name")) ) >>= sOutlineName;
+ bAssignedtoOutlineStyle = ( sListStyleName == sOutlineName );
+ }
+ }
+ }
+
+ if( ! bIsNumber && bAssignedtoOutlineStyle )
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT,
+ XML_IS_LIST_HEADER,
+ XML_TRUE );
+ }
+
+ {
+ String sParaIsNumberingRestart
+ (RTL_CONSTASCII_USTRINGPARAM
+ ("ParaIsNumberingRestart"));
+ bool bIsRestartNumbering = false;
+
+ Reference< XPropertySetInfo >
+ xPropSetInfo(xMultiPropSet.is() ?
+ xMultiPropSet->getPropertySetInfo():
+ xPropSet->getPropertySetInfo());
+
+ if (xPropSetInfo->
+ hasPropertyByName(sParaIsNumberingRestart))
+ {
+ xPropSet->getPropertyValue(sParaIsNumberingRestart)
+ >>= bIsRestartNumbering;
+ }
+
+ if (bIsRestartNumbering)
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT,
+ XML_RESTART_NUMBERING,
+ XML_TRUE);
+
+ String sNumberingStartValue
+ (RTL_CONSTASCII_USTRINGPARAM
+ ("NumberingStartValue"));
+
+
+ if (xPropSetInfo->
+ hasPropertyByName(sNumberingStartValue))
+ {
+ sal_Int32 nStartValue = 0;
+
+ xPropSet->getPropertyValue(sNumberingStartValue)
+ >>= nStartValue;
+
+ OUStringBuffer sTmpStartValue;
+
+ sTmpStartValue.append(nStartValue);
+
+ GetExport().
+ AddAttribute(XML_NAMESPACE_TEXT,
+ XML_START_VALUE,
+ sTmpStartValue.
+ makeStringAndClear());
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ Reference < XEnumerationAccess > xEA( rTextContent, UNO_QUERY );
+ Reference < XEnumeration > xTextEnum;
+ xTextEnum = xEA->createEnumeration();
+ const sal_Bool bHasPortions = xTextEnum.is();
+
+ Reference < XEnumeration> xContentEnum;
+ Reference < XContentEnumerationAccess > xCEA( rTextContent, UNO_QUERY );
+ if( xCEA.is() )
+ xContentEnum.set(xCEA->createContentEnumeration( sTextContentService ));
+ const sal_Bool bHasContentEnum = xContentEnum.is() &&
+ xContentEnum->hasMoreElements();
+
+ Reference < XTextSection > xSection;
+ if( bHasContentEnum )
+ {
+ // For the auto styles, the multi property set helper is only used
+ // if hard attributes are existing. Therfor, it seems to be a better
+ // strategy to have the TextSection property seperate, because otherwise
+ // we always retrieve the style names even if they are not required.
+ if( bAutoStyles )
+ {
+ if( xPropSet->getPropertySetInfo()->hasPropertyByName( sTextSection ) )
+ {
+ xSection.set(xPropSet->getPropertyValue( sTextSection ), uno::UNO_QUERY);
+ }
+ }
+ else
+ {
+ if( rPropSetHelper.hasProperty( TEXT_SECTION ) )
+ {
+ xSection.set(rPropSetHelper.getValue( TEXT_SECTION ), uno::UNO_QUERY);
+ }
+ }
+ }
+
+ if( bAutoStyles )
+ {
+ if( bHasContentEnum )
+ exportTextContentEnumeration(
+ xContentEnum, bAutoStyles, xSection,
+ bIsProgress, sal_True, 0, sal_True );
+ if ( bHasPortions )
+ exportTextRangeEnumeration( xTextEnum, bAutoStyles, bIsProgress );
+ }
+ else
+ {
+ sal_Bool bPrevCharIsSpace = sal_True;
+ enum XMLTokenEnum eElem =
+ 0 < nOutlineLevel ? XML_H : XML_P;
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT, eElem,
+ sal_True, sal_False );
+ if( bHasContentEnum )
+ bPrevCharIsSpace = !exportTextContentEnumeration(
+ xContentEnum, bAutoStyles, xSection,
+ bIsProgress );
+ exportTextRangeEnumeration( xTextEnum, bAutoStyles, bIsProgress,
+ bPrevCharIsSpace );
+ }
+}
+
+void XMLTextParagraphExport::exportTextRangeEnumeration(
+ const Reference < XEnumeration > & rTextEnum,
+ sal_Bool bAutoStyles, sal_Bool bIsProgress,
+ sal_Bool bPrvChrIsSpc )
+{
+ static OUString sMeta(RTL_CONSTASCII_USTRINGPARAM("InContentMetadata"));
+ sal_Bool bPrevCharIsSpace = bPrvChrIsSpc;
+
+ while( rTextEnum->hasMoreElements() )
+ {
+ Reference<XPropertySet> xPropSet(rTextEnum->nextElement(), UNO_QUERY);
+ Reference < XTextRange > xTxtRange(xPropSet, uno::UNO_QUERY);
+ Reference<XPropertySetInfo> xPropInfo(xPropSet->getPropertySetInfo());
+
+ if (xPropInfo->hasPropertyByName(sTextPortionType))
+ {
+ rtl::OUString sType;
+ xPropSet->getPropertyValue(sTextPortionType) >>= sType;
+
+ if( sType.equals(sText))
+ {
+ exportTextRange( xTxtRange, bAutoStyles,
+ bPrevCharIsSpace );
+ }
+ else if( sType.equals(sTextField))
+ {
+ exportTextField( xTxtRange, bAutoStyles, bIsProgress );
+ bPrevCharIsSpace = sal_False;
+ }
+ else if( sType.equals( sFrame ) )
+ {
+ Reference < XEnumeration> xContentEnum;
+ Reference < XContentEnumerationAccess > xCEA( xTxtRange,
+ UNO_QUERY );
+ if( xCEA.is() )
+ xContentEnum.set(xCEA->createContentEnumeration(
+ sTextContentService ));
+ // frames are never in sections
+ Reference<XTextSection> xSection;
+ if( xContentEnum.is() )
+ exportTextContentEnumeration( xContentEnum,
+ bAutoStyles,
+ xSection, bIsProgress, sal_True,
+ &xPropSet );
+
+ bPrevCharIsSpace = sal_False;
+ }
+ else if (sType.equals(sFootnote))
+ {
+ exportTextFootnote(xPropSet,
+ xTxtRange->getString(),
+ bAutoStyles, bIsProgress );
+ bPrevCharIsSpace = sal_False;
+ }
+ else if (sType.equals(sBookmark))
+ {
+ exportTextMark(xPropSet,
+ sBookmark,
+ lcl_XmlBookmarkElements,
+ bAutoStyles);
+ }
+ else if (sType.equals(sReferenceMark))
+ {
+ exportTextMark(xPropSet,
+ sReferenceMark,
+ lcl_XmlReferenceElements,
+ bAutoStyles);
+ }
+ else if (sType.equals(sDocumentIndexMark))
+ {
+ pIndexMarkExport->ExportIndexMark(xPropSet, bAutoStyles);
+ }
+ else if (sType.equals(sRedline))
+ {
+ if (NULL != pRedlineExport)
+ pRedlineExport->ExportChange(xPropSet, bAutoStyles);
+ }
+ else if (sType.equals(sRuby))
+ {
+ exportRuby(xPropSet, bAutoStyles);
+ }
+ else if (sType.equals(sMeta))
+ {
+ exportMeta(xPropSet, bAutoStyles, bIsProgress);
+ }
+ else if (sType.equals(sTextFieldStart))
+ {
+ if ( GetExport().getDefaultVersion() == SvtSaveOptions::ODFVER_LATEST )
+ {
+ Reference<XNamed> xBookmark(xPropSet->getPropertyValue(sBookmark), UNO_QUERY);
+ if (xBookmark.is())
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_NAME, xBookmark->getName());
+ }
+ Reference< ::com::sun::star::text::XFormField > xFormField(xPropSet->getPropertyValue(sBookmark), UNO_QUERY);
+ if (xFormField.is())
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_FIELD, XML_TYPE, xFormField->getFieldType());
+ }
+ GetExport().StartElement(XML_NAMESPACE_FIELD, XML_FIELDMARK_START, sal_False);
+ if (xFormField.is())
+ {
+ FieldParamExporter(&GetExport(), xFormField->getParameters()).Export();
+ }
+ GetExport().EndElement(XML_NAMESPACE_FIELD, XML_FIELDMARK_START, sal_False);
+ }
+ }
+ else if (sType.equals(sTextFieldEnd))
+ {
+ if ( GetExport().getDefaultVersion() == SvtSaveOptions::ODFVER_LATEST )
+ {
+ GetExport().StartElement(XML_NAMESPACE_FIELD, XML_FIELDMARK_END, sal_False);
+ GetExport().EndElement(XML_NAMESPACE_FIELD, XML_FIELDMARK_END, sal_False);
+ }
+ }
+ else if (sType.equals(sTextFieldStartEnd))
+ {
+ if ( GetExport().getDefaultVersion() == SvtSaveOptions::ODFVER_LATEST )
+ {
+ Reference<XNamed> xBookmark(xPropSet->getPropertyValue(sBookmark), UNO_QUERY);
+ if (xBookmark.is())
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_NAME, xBookmark->getName());
+ }
+ Reference< ::com::sun::star::text::XFormField > xFormField(xPropSet->getPropertyValue(sBookmark), UNO_QUERY);
+ if (xFormField.is())
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_FIELD, XML_TYPE, xFormField->getFieldType());
+ }
+ GetExport().StartElement(XML_NAMESPACE_FIELD, XML_FIELDMARK, sal_False);
+ if (xFormField.is())
+ {
+ FieldParamExporter(&GetExport(), xFormField->getParameters()).Export();
+ }
+ GetExport().EndElement(XML_NAMESPACE_FIELD, XML_FIELDMARK, sal_False);
+ }
+ }
+ else if (sType.equals(sSoftPageBreak))
+ {
+ exportSoftPageBreak(xPropSet, bAutoStyles);
+ }
+ else {
+ OSL_FAIL("unknown text portion type");
+ }
+ }
+ else
+ {
+ Reference<XServiceInfo> xServiceInfo( xTxtRange, UNO_QUERY );
+ if( xServiceInfo->supportsService( sTextFieldService ) )
+ {
+ exportTextField( xTxtRange, bAutoStyles, bIsProgress );
+ bPrevCharIsSpace = sal_False;
+ }
+ else
+ {
+ // no TextPortionType property -> non-Writer app -> text
+ exportTextRange( xTxtRange, bAutoStyles, bPrevCharIsSpace );
+ }
+ }
+ }
+
+// now that there are nested enumerations for meta(-field), this may be valid!
+// DBG_ASSERT( !bOpenRuby, "Red Alert: Ruby still open!" );
+}
+
+void XMLTextParagraphExport::exportTable(
+ const Reference < XTextContent > &,
+ sal_Bool /*bAutoStyles*/, sal_Bool /*bIsProgress*/ )
+{
+}
+
+void XMLTextParagraphExport::exportTextField(
+ const Reference < XTextRange > & rTextRange,
+ sal_Bool bAutoStyles, sal_Bool bIsProgress )
+{
+ Reference < XPropertySet > xPropSet( rTextRange, UNO_QUERY );
+ // non-Writer apps need not support Property TextField, so test first
+ if (xPropSet->getPropertySetInfo()->hasPropertyByName( sTextField ))
+ {
+ Reference < XTextField > xTxtFld(xPropSet->getPropertyValue( sTextField ), uno::UNO_QUERY);
+ DBG_ASSERT( xTxtFld.is(), "text field missing" );
+ if( xTxtFld.is() )
+ {
+ exportTextField(xTxtFld, bAutoStyles, bIsProgress, sal_True);
+ }
+ else
+ {
+ // write only characters
+ GetExport().Characters(rTextRange->getString());
+ }
+ }
+}
+
+void XMLTextParagraphExport::exportTextField(
+ const Reference < XTextField > & xTextField,
+ const sal_Bool bAutoStyles, const sal_Bool bIsProgress,
+ const sal_Bool bRecursive )
+{
+ if ( bAutoStyles )
+ {
+ pFieldExport->ExportFieldAutoStyle( xTextField, bIsProgress,
+ bRecursive );
+ }
+ else
+ {
+ pFieldExport->ExportField( xTextField, bIsProgress );
+ }
+}
+
+void XMLTextParagraphExport::exportSoftPageBreak(
+ const Reference<XPropertySet> & ,
+ sal_Bool )
+{
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT,
+ XML_SOFT_PAGE_BREAK, sal_False,
+ sal_False );
+}
+
+void XMLTextParagraphExport::exportTextMark(
+ const Reference<XPropertySet> & rPropSet,
+ const OUString& rProperty,
+ const enum XMLTokenEnum pElements[],
+ sal_Bool bAutoStyles)
+{
+ // mib said: "Hau wech!"
+ //
+ // (Originally, I'd export a span element in case the (book|reference)mark
+ // was formatted. This actually makes a difference in case some pervert
+ // sets a point reference mark in the document and, say, formats it bold.
+ // This basically meaningless formatting will now been thrown away
+ // (aka cleaned up), since mib said: ... dvo
+
+ if (!bAutoStyles)
+ {
+ // name element
+ Reference<XNamed> xName(rPropSet->getPropertyValue(rProperty), UNO_QUERY);
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_NAME,
+ xName->getName());
+
+ // start, end, or point-reference?
+ sal_Int8 nElement;
+ if( *(sal_Bool *)rPropSet->getPropertyValue(sIsCollapsed).getValue() )
+ {
+ nElement = 0;
+ }
+ else
+ {
+ nElement = *(sal_Bool *)rPropSet->getPropertyValue(sIsStart).getValue() ? 1 : 2;
+ }
+
+ // bookmark, bookmark-start: xml:id and RDFa for RDF metadata
+ if( nElement < 2 ) {
+ GetExport().AddAttributeXmlId(xName);
+ const uno::Reference<text::XTextContent> xTextContent(
+ xName, uno::UNO_QUERY_THROW);
+ GetExport().AddAttributesRDFa(xTextContent);
+ }
+
+ // export element
+ DBG_ASSERT(pElements != NULL, "illegal element array");
+ DBG_ASSERT(nElement >= 0, "illegal element number");
+ DBG_ASSERT(nElement <= 2, "illegal element number");
+ SvXMLElementExport aElem(GetExport(),
+ XML_NAMESPACE_TEXT, pElements[nElement],
+ sal_False, sal_False);
+ }
+ // else: no styles. (see above)
+}
+
+sal_Bool lcl_txtpara_isBoundAsChar(
+ const Reference < XPropertySet > & rPropSet,
+ const Reference < XPropertySetInfo > & rPropSetInfo )
+{
+ sal_Bool bIsBoundAsChar = sal_False;
+ OUString sAnchorType( RTL_CONSTASCII_USTRINGPARAM( "AnchorType" ) );
+ if( rPropSetInfo->hasPropertyByName( sAnchorType ) )
+ {
+ TextContentAnchorType eAnchor;
+ rPropSet->getPropertyValue( sAnchorType ) >>= eAnchor;
+ bIsBoundAsChar = TextContentAnchorType_AS_CHARACTER == eAnchor;
+ }
+
+ return bIsBoundAsChar;
+}
+
+sal_Int32 XMLTextParagraphExport::addTextFrameAttributes(
+ const Reference < XPropertySet >& rPropSet,
+ sal_Bool bShape,
+ OUString *pMinHeightValue )
+{
+ sal_Int32 nShapeFeatures = SEF_DEFAULT;
+
+ // draw:name (#97662#: not for shapes, since those names will be
+ // treated in the shape export)
+ if( !bShape )
+ {
+ Reference < XNamed > xNamed( rPropSet, UNO_QUERY );
+ if( xNamed.is() )
+ {
+ OUString sName( xNamed->getName() );
+ if( sName.getLength() )
+ GetExport().AddAttribute( XML_NAMESPACE_DRAW, XML_NAME,
+ xNamed->getName() );
+ }
+ }
+
+ OUStringBuffer sValue;
+
+ // text:anchor-type
+ TextContentAnchorType eAnchor = TextContentAnchorType_AT_PARAGRAPH;
+ rPropSet->getPropertyValue( sAnchorType ) >>= eAnchor;
+ {
+ XMLAnchorTypePropHdl aAnchorTypeHdl;
+ OUString sTmp;
+ aAnchorTypeHdl.exportXML( sTmp, uno::makeAny(eAnchor),
+ GetExport().GetMM100UnitConverter() );
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_ANCHOR_TYPE, sTmp );
+ }
+
+ // text:anchor-page-number
+ if( TextContentAnchorType_AT_PAGE == eAnchor )
+ {
+ sal_Int16 nPage = 0;
+ rPropSet->getPropertyValue( sAnchorPageNo ) >>= nPage;
+ GetExport().GetMM100UnitConverter().convertNumber( sValue,
+ (sal_Int32)nPage );
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_ANCHOR_PAGE_NUMBER,
+ sValue.makeStringAndClear() );
+ }
+ else
+ {
+ // #92210#
+ nShapeFeatures |= SEF_EXPORT_NO_WS;
+ }
+
+ // OD 2004-06-01 #i27691# - correction: no export of svg:x, if object
+ // is anchored as-character.
+ if ( !bShape &&
+ eAnchor != TextContentAnchorType_AS_CHARACTER )
+ {
+ // svg:x
+ sal_Int16 nHoriOrient = HoriOrientation::NONE;
+ rPropSet->getPropertyValue( sHoriOrient ) >>= nHoriOrient;
+ if( HoriOrientation::NONE == nHoriOrient )
+ {
+ sal_Int32 nPos = 0;
+ rPropSet->getPropertyValue( sHoriOrientPosition ) >>= nPos;
+ GetExport().GetMM100UnitConverter().convertMeasure( sValue, nPos );
+ GetExport().AddAttribute( XML_NAMESPACE_SVG, XML_X,
+ sValue.makeStringAndClear() );
+ }
+ }
+ else if( TextContentAnchorType_AS_CHARACTER == eAnchor )
+ nShapeFeatures = (nShapeFeatures & ~SEF_EXPORT_X);
+
+ if( !bShape || TextContentAnchorType_AS_CHARACTER == eAnchor )
+ {
+ // svg:y
+ sal_Int16 nVertOrient = VertOrientation::NONE;
+ rPropSet->getPropertyValue( sVertOrient ) >>= nVertOrient;
+ if( VertOrientation::NONE == nVertOrient )
+ {
+ sal_Int32 nPos = 0;
+ rPropSet->getPropertyValue( sVertOrientPosition ) >>= nPos;
+ GetExport().GetMM100UnitConverter().convertMeasure( sValue, nPos );
+ GetExport().AddAttribute( XML_NAMESPACE_SVG, XML_Y,
+ sValue.makeStringAndClear() );
+ }
+ if( bShape )
+ nShapeFeatures = (nShapeFeatures & ~SEF_EXPORT_Y);
+ }
+
+
+ Reference< XPropertySetInfo > xPropSetInfo(rPropSet->getPropertySetInfo());
+
+ // svg:width
+ sal_Int16 nWidthType = SizeType::FIX;
+ if( xPropSetInfo->hasPropertyByName( sWidthType ) )
+ {
+ rPropSet->getPropertyValue( sWidthType ) >>= nWidthType;
+ }
+ if( xPropSetInfo->hasPropertyByName( sWidth ) )
+ {
+ sal_Int32 nWidth = 0;
+ // VAR size will be written as zero min-size
+ if( SizeType::VARIABLE != nWidthType )
+ {
+ rPropSet->getPropertyValue( sWidth ) >>= nWidth;
+ }
+ GetExport().GetMM100UnitConverter().convertMeasure( sValue, nWidth );
+ if( SizeType::FIX != nWidthType )
+ GetExport().AddAttribute( XML_NAMESPACE_FO, XML_MIN_WIDTH,
+ sValue.makeStringAndClear() );
+ else
+ GetExport().AddAttribute( XML_NAMESPACE_SVG, XML_WIDTH,
+ sValue.makeStringAndClear() );
+ }
+ sal_Bool bSyncWidth = sal_False;
+ if( xPropSetInfo->hasPropertyByName( sIsSyncWidthToHeight ) )
+ {
+ bSyncWidth = *(sal_Bool *)rPropSet->getPropertyValue( sIsSyncWidthToHeight ).getValue();
+ if( bSyncWidth )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_REL_WIDTH,
+ XML_SCALE );
+ }
+ if( !bSyncWidth && xPropSetInfo->hasPropertyByName( sRelativeWidth ) )
+ {
+ sal_Int16 nRelWidth = 0;
+ rPropSet->getPropertyValue( sRelativeWidth ) >>= nRelWidth;
+ DBG_ASSERT( nRelWidth >= 0 && nRelWidth <= 254,
+ "Got illegal relative width from API" );
+ if( nRelWidth > 0 )
+ {
+ GetExport().GetMM100UnitConverter().convertPercent( sValue,
+ nRelWidth );
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_REL_WIDTH,
+ sValue.makeStringAndClear() );
+ }
+ }
+
+ // svg:height, fo:min-height or style:rel-height
+ sal_Int16 nSizeType = SizeType::FIX;
+ if( xPropSetInfo->hasPropertyByName( sSizeType ) )
+ {
+ rPropSet->getPropertyValue( sSizeType ) >>= nSizeType;
+ }
+ sal_Bool bSyncHeight = sal_False;
+ if( xPropSetInfo->hasPropertyByName( sIsSyncHeightToWidth ) )
+ {
+ bSyncHeight = *(sal_Bool *)rPropSet->getPropertyValue( sIsSyncHeightToWidth ).getValue();
+ }
+ sal_Int16 nRelHeight = 0;
+ if( !bSyncHeight && xPropSetInfo->hasPropertyByName( sRelativeHeight ) )
+ {
+ rPropSet->getPropertyValue( sRelativeHeight ) >>= nRelHeight;
+ }
+ if( xPropSetInfo->hasPropertyByName( sHeight ) )
+ {
+ sal_Int32 nHeight = 0;
+ if( SizeType::VARIABLE != nSizeType )
+ {
+ rPropSet->getPropertyValue( sHeight ) >>= nHeight;
+ }
+ GetExport().GetMM100UnitConverter().convertMeasure( sValue,
+ nHeight );
+ if( SizeType::FIX != nSizeType && 0==nRelHeight && !bSyncHeight &&
+ pMinHeightValue )
+ *pMinHeightValue = sValue.makeStringAndClear();
+ else
+ GetExport().AddAttribute( XML_NAMESPACE_SVG, XML_HEIGHT,
+ sValue.makeStringAndClear() );
+ }
+ if( bSyncHeight )
+ {
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_REL_HEIGHT,
+ SizeType::MIN == nSizeType ? XML_SCALE_MIN : XML_SCALE );
+
+ }
+ else if( nRelHeight > 0 )
+ {
+ GetExport().GetMM100UnitConverter().convertPercent( sValue,
+ nRelHeight );
+ if( SizeType::MIN == nSizeType )
+ GetExport().AddAttribute( XML_NAMESPACE_FO, XML_MIN_HEIGHT,
+ sValue.makeStringAndClear() );
+ else
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_REL_HEIGHT,
+ sValue.makeStringAndClear() );
+ }
+
+ OUString sZOrder( RTL_CONSTASCII_USTRINGPARAM( "ZOrder" ) );
+ if( xPropSetInfo->hasPropertyByName( sZOrder ) )
+ {
+ sal_Int32 nZIndex = 0;
+ rPropSet->getPropertyValue( sZOrder ) >>= nZIndex;
+ if( -1 != nZIndex )
+ {
+ GetExport().GetMM100UnitConverter().convertNumber( sValue,
+ nZIndex );
+ GetExport().AddAttribute( XML_NAMESPACE_DRAW, XML_ZINDEX,
+ sValue.makeStringAndClear() );
+ }
+ }
+
+ return nShapeFeatures;
+}
+
+void XMLTextParagraphExport::exportAnyTextFrame(
+ const Reference < XTextContent > & rTxtCntnt,
+ FrameType eType,
+ sal_Bool bAutoStyles,
+ sal_Bool bIsProgress,
+ sal_Bool bExportContent,
+ const Reference < XPropertySet > *pRangePropSet)
+{
+ Reference < XPropertySet > xPropSet( rTxtCntnt, UNO_QUERY );
+
+ if( bAutoStyles )
+ {
+ if( FT_EMBEDDED == eType )
+ _collectTextEmbeddedAutoStyles( xPropSet );
+ // No text frame style for shapes (#i28745#)
+ else if ( FT_SHAPE != eType )
+ Add( XML_STYLE_FAMILY_TEXT_FRAME, xPropSet );
+
+ if( pRangePropSet && lcl_txtpara_isBoundAsChar( xPropSet,
+ xPropSet->getPropertySetInfo() ) )
+ Add( XML_STYLE_FAMILY_TEXT_TEXT, *pRangePropSet );
+
+ switch( eType )
+ {
+ case FT_TEXT:
+ {
+ // frame bound frames
+ if ( bExportContent )
+ {
+ Reference < XTextFrame > xTxtFrame( rTxtCntnt, UNO_QUERY );
+ Reference < XText > xTxt(xTxtFrame->getText());
+ exportFrameFrames( sal_True, bIsProgress, &xTxtFrame );
+ exportText( xTxt, bAutoStyles, bIsProgress, sal_True );
+ }
+ }
+ break;
+ case FT_SHAPE:
+ {
+ Reference < XShape > xShape( rTxtCntnt, UNO_QUERY );
+ GetExport().GetShapeExport()->collectShapeAutoStyles( xShape );
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ else
+ {
+ Reference< XPropertySetInfo > xPropSetInfo(xPropSet->getPropertySetInfo());
+ Reference< XPropertyState > xPropState( xPropSet, UNO_QUERY );
+ {
+ sal_Bool bAddCharStyles = pRangePropSet &&
+ lcl_txtpara_isBoundAsChar( xPropSet, xPropSetInfo );
+
+ sal_Bool bIsUICharStyle;
+ sal_Bool bHasAutoStyle = sal_False;
+ sal_Bool bDummy;
+
+ OUString sStyle;
+
+ if( bAddCharStyles )
+ sStyle = FindTextStyleAndHyperlink( *pRangePropSet, bDummy, bIsUICharStyle, bHasAutoStyle );
+ else
+ bIsUICharStyle = sal_False;
+
+ XMLTextCharStyleNamesElementExport aCharStylesExport(
+ GetExport(), bIsUICharStyle &&
+ aCharStyleNamesPropInfoCache.hasProperty(
+ *pRangePropSet ), bHasAutoStyle,
+ *pRangePropSet, sCharStyleNames );
+
+ if( sStyle.getLength() )
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME,
+ GetExport().EncodeStyleName( sStyle ) );
+ {
+ SvXMLElementExport aElem( GetExport(), sStyle.getLength() > 0,
+ XML_NAMESPACE_TEXT, XML_SPAN, sal_False, sal_False );
+ {
+ SvXMLElementExport aElement( GetExport(),
+ FT_SHAPE != eType &&
+ addHyperlinkAttributes( xPropSet,
+ xPropState,xPropSetInfo ),
+ XML_NAMESPACE_DRAW, XML_A, sal_False, sal_False );
+ switch( eType )
+ {
+ case FT_TEXT:
+ _exportTextFrame( xPropSet, xPropSetInfo, bIsProgress );
+ break;
+ case FT_GRAPHIC:
+ _exportTextGraphic( xPropSet, xPropSetInfo );
+ break;
+ case FT_EMBEDDED:
+ _exportTextEmbedded( xPropSet, xPropSetInfo );
+ break;
+ case FT_SHAPE:
+ {
+ Reference < XShape > xShape( rTxtCntnt, UNO_QUERY );
+ sal_Int32 nFeatures =
+ addTextFrameAttributes( xPropSet, sal_True );
+ GetExport().GetShapeExport()
+ ->exportShape( xShape, nFeatures );
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+}
+
+void XMLTextParagraphExport::_exportTextFrame(
+ const Reference < XPropertySet > & rPropSet,
+ const Reference < XPropertySetInfo > & rPropSetInfo,
+ sal_Bool bIsProgress )
+{
+ Reference < XTextFrame > xTxtFrame( rPropSet, UNO_QUERY );
+ Reference < XText > xTxt(xTxtFrame->getText());
+
+ OUString sStyle;
+ if( rPropSetInfo->hasPropertyByName( sFrameStyleName ) )
+ {
+ rPropSet->getPropertyValue( sFrameStyleName ) >>= sStyle;
+ }
+
+ OUString sAutoStyle( sStyle );
+ OUString aMinHeightValue;
+ sAutoStyle = Find( XML_STYLE_FAMILY_TEXT_FRAME, rPropSet, sStyle );
+ if( sAutoStyle.getLength() )
+ GetExport().AddAttribute( XML_NAMESPACE_DRAW, XML_STYLE_NAME,
+ GetExport().EncodeStyleName( sAutoStyle ) );
+ addTextFrameAttributes( rPropSet, sal_False, &aMinHeightValue );
+
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_DRAW,
+ XML_FRAME, sal_False, sal_True );
+
+ if( aMinHeightValue.getLength() )
+ GetExport().AddAttribute( XML_NAMESPACE_FO, XML_MIN_HEIGHT,
+ aMinHeightValue );
+
+ // draw:chain-next-name
+ if( rPropSetInfo->hasPropertyByName( sChainNextName ) )
+ {
+ OUString sNext;
+ if( (rPropSet->getPropertyValue( sChainNextName ) >>= sNext) && sNext.getLength() > 0 )
+ GetExport().AddAttribute( XML_NAMESPACE_DRAW,
+ XML_CHAIN_NEXT_NAME,
+ sNext );
+ }
+
+ {
+ SvXMLElementExport aElement( GetExport(), XML_NAMESPACE_DRAW,
+ XML_TEXT_BOX, sal_True, sal_True );
+
+ // frame bound frames
+ exportFramesBoundToFrame( xTxtFrame, bIsProgress );
+
+ exportText( xTxt, sal_False, bIsProgress, sal_True );
+ }
+
+ // script:events
+ Reference<XEventsSupplier> xEventsSupp( xTxtFrame, UNO_QUERY );
+ GetExport().GetEventExport().Export(xEventsSupp);
+
+ // image map
+ GetExport().GetImageMapExport().Export( rPropSet );
+
+ // svg:title and svg:desc (#i73249#)
+ exportTitleAndDescription( rPropSet, rPropSetInfo );
+}
+
+void XMLTextParagraphExport::exportContour(
+ const Reference < XPropertySet > & rPropSet,
+ const Reference < XPropertySetInfo > & rPropSetInfo )
+{
+ if( !rPropSetInfo->hasPropertyByName( sContourPolyPolygon ) )
+ return;
+
+ PointSequenceSequence aSourcePolyPolygon;
+ rPropSet->getPropertyValue( sContourPolyPolygon ) >>= aSourcePolyPolygon;
+
+ if( !aSourcePolyPolygon.getLength() )
+ return;
+
+ awt::Point aPoint( 0, 0 );
+ awt::Size aSize( 0, 0 );
+ sal_Int32 nPolygons = aSourcePolyPolygon.getLength();
+ const PointSequence *pPolygons = aSourcePolyPolygon.getConstArray();
+ while( nPolygons-- )
+ {
+ sal_Int32 nPoints = pPolygons->getLength();
+ const awt::Point *pPoints = pPolygons->getConstArray();
+ while( nPoints-- )
+ {
+ if( aSize.Width < pPoints->X )
+ aSize.Width = pPoints->X;
+ if( aSize.Height < pPoints->Y )
+ aSize.Height = pPoints->Y;
+ pPoints++;
+ }
+ pPolygons++;
+ }
+
+ sal_Bool bPixel = sal_False;
+ if( rPropSetInfo->hasPropertyByName( sIsPixelContour ) )
+ {
+ bPixel = *(sal_Bool *)rPropSet->getPropertyValue( sIsPixelContour ).getValue();
+ }
+
+ // svg: width
+ OUStringBuffer aStringBuffer( 10 );
+ if( bPixel )
+ GetExport().GetMM100UnitConverter().convertMeasurePx(aStringBuffer, aSize.Width);
+ else
+ GetExport().GetMM100UnitConverter().convertMeasure(aStringBuffer, aSize.Width);
+ GetExport().AddAttribute( XML_NAMESPACE_SVG, XML_WIDTH,
+ aStringBuffer.makeStringAndClear() );
+
+ // svg: height
+ if( bPixel )
+ GetExport().GetMM100UnitConverter().convertMeasurePx(aStringBuffer, aSize.Height);
+ else
+ GetExport().GetMM100UnitConverter().convertMeasure(aStringBuffer, aSize.Height);
+ GetExport().AddAttribute( XML_NAMESPACE_SVG, XML_HEIGHT,
+ aStringBuffer.makeStringAndClear() );
+
+ // svg:viewbox
+ SdXMLImExViewBox aViewBox(0, 0, aSize.Width, aSize.Height);
+ GetExport().AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX,
+ aViewBox.GetExportString());
+
+ sal_Int32 nOuterCnt( aSourcePolyPolygon.getLength() );
+
+ enum XMLTokenEnum eElem = XML_TOKEN_INVALID;
+ if( 1L == nOuterCnt )
+ {
+ // simple polygon shape, can be written as svg:points sequence
+ /*const*/ PointSequence* pSequence =
+ (PointSequence*)aSourcePolyPolygon.getConstArray();
+
+ SdXMLImExPointsElement aPoints( pSequence, aViewBox, aPoint, aSize );
+
+ // write point array
+ GetExport().AddAttribute( XML_NAMESPACE_DRAW, XML_POINTS,
+ aPoints.GetExportString());
+ eElem = XML_CONTOUR_POLYGON;
+ }
+ else
+ {
+ // polypolygon, needs to be written as a svg:path sequence
+ /*const*/ PointSequence* pOuterSequence =
+ (PointSequence*)aSourcePolyPolygon.getConstArray();
+ if(pOuterSequence)
+ {
+ // prepare svx:d element export
+ SdXMLImExSvgDElement aSvgDElement( aViewBox );
+
+ for(sal_Int32 a(0L); a < nOuterCnt; a++)
+ {
+ /*const*/ PointSequence* pSequence = pOuterSequence++;
+ if(pSequence)
+ {
+ aSvgDElement.AddPolygon(pSequence, 0L, aPoint,
+ aSize, sal_True );
+ }
+ }
+
+ // write point array
+ GetExport().AddAttribute( XML_NAMESPACE_SVG, XML_D,
+ aSvgDElement.GetExportString());
+ eElem = XML_CONTOUR_PATH;
+ }
+ }
+
+ if( rPropSetInfo->hasPropertyByName( sIsAutomaticContour ) )
+ {
+ sal_Bool bTmp = *(sal_Bool *)rPropSet->getPropertyValue(
+ sIsAutomaticContour ).getValue();
+ GetExport().AddAttribute( XML_NAMESPACE_DRAW,
+ XML_RECREATE_ON_EDIT, bTmp ? XML_TRUE : XML_FALSE );
+ }
+
+ // write object now
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_DRAW, eElem,
+ sal_True, sal_True );
+}
+
+void XMLTextParagraphExport::_exportTextGraphic(
+ const Reference < XPropertySet > & rPropSet,
+ const Reference < XPropertySetInfo > & rPropSetInfo )
+{
+ OUString sStyle;
+ if( rPropSetInfo->hasPropertyByName( sFrameStyleName ) )
+ {
+ rPropSet->getPropertyValue( sFrameStyleName ) >>= sStyle;
+ }
+
+ OUString sAutoStyle( sStyle );
+ sAutoStyle = Find( XML_STYLE_FAMILY_TEXT_FRAME, rPropSet, sStyle );
+ if( sAutoStyle.getLength() )
+ GetExport().AddAttribute( XML_NAMESPACE_DRAW, XML_STYLE_NAME,
+ GetExport().EncodeStyleName( sAutoStyle ) );
+ addTextFrameAttributes( rPropSet, sal_False );
+
+ // svg:transform
+ sal_Int16 nVal = 0;
+ rPropSet->getPropertyValue( sGraphicRotation ) >>= nVal;
+ if( nVal != 0 )
+ {
+ OUStringBuffer sRet( GetXMLToken(XML_ROTATE).getLength()+4 );
+ sRet.append( GetXMLToken(XML_ROTATE));
+ sRet.append( (sal_Unicode)'(' );
+ GetExport().GetMM100UnitConverter().convertNumber( sRet, (sal_Int32)nVal );
+ sRet.append( (sal_Unicode)')' );
+ GetExport().AddAttribute( XML_NAMESPACE_SVG, XML_TRANSFORM,
+ sRet.makeStringAndClear() );
+ }
+
+
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_DRAW,
+ XML_FRAME, sal_False, sal_True );
+
+ // xlink:href
+ OUString sOrigURL;
+ rPropSet->getPropertyValue( sGraphicURL ) >>= sOrigURL;
+ OUString sURL(GetExport().AddEmbeddedGraphicObject( sOrigURL ));
+ setTextEmbeddedGraphicURL( rPropSet, sURL );
+
+ // If there still is no url, then then graphic is empty
+ if( sURL.getLength() )
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, sURL );
+ GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+ GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE,
+ XML_ONLOAD );
+ }
+
+ // draw:filter-name
+ OUString sGrfFilter;
+ rPropSet->getPropertyValue( sGraphicFilter ) >>= sGrfFilter;
+ if( sGrfFilter.getLength() )
+ GetExport().AddAttribute( XML_NAMESPACE_DRAW, XML_FILTER_NAME,
+ sGrfFilter );
+
+ {
+ SvXMLElementExport aElement( GetExport(), XML_NAMESPACE_DRAW,
+ XML_IMAGE, sal_False, sal_True );
+
+ // optional office:binary-data
+ GetExport().AddEmbeddedGraphicObjectAsBase64( sOrigURL );
+ }
+
+ // script:events
+ Reference<XEventsSupplier> xEventsSupp( rPropSet, UNO_QUERY );
+ GetExport().GetEventExport().Export(xEventsSupp);
+
+ // image map
+ GetExport().GetImageMapExport().Export( rPropSet );
+
+ // svg:title and svg:desc (#i73249#)
+ exportTitleAndDescription( rPropSet, rPropSetInfo );
+
+ // draw:contour
+ exportContour( rPropSet, rPropSetInfo );
+}
+
+void XMLTextParagraphExport::_collectTextEmbeddedAutoStyles(const Reference < XPropertySet > & )
+{
+ DBG_ASSERT( !this, "no API implementation avialable" );
+}
+
+void XMLTextParagraphExport::_exportTextEmbedded(
+ const Reference < XPropertySet > &,
+ const Reference < XPropertySetInfo > & )
+{
+ DBG_ASSERT( !this, "no API implementation avialable" );
+}
+
+void XMLTextParagraphExport::exportEvents( const Reference < XPropertySet > & rPropSet )
+{
+ // script:events
+ Reference<XEventsSupplier> xEventsSupp( rPropSet, UNO_QUERY );
+ GetExport().GetEventExport().Export(xEventsSupp);
+
+ // image map
+ OUString sImageMap(RTL_CONSTASCII_USTRINGPARAM("ImageMap"));
+ if (rPropSet->getPropertySetInfo()->hasPropertyByName(sImageMap))
+ GetExport().GetImageMapExport().Export( rPropSet );
+}
+
+// Implement Title/Description Elements UI (#i73249#)
+void XMLTextParagraphExport::exportTitleAndDescription(
+ const Reference < XPropertySet > & rPropSet,
+ const Reference < XPropertySetInfo > & rPropSetInfo )
+{
+ // svg:title
+ if( rPropSetInfo->hasPropertyByName( sTitle ) )
+ {
+ OUString sObjTitle;
+ rPropSet->getPropertyValue( sTitle ) >>= sObjTitle;
+ if( sObjTitle.getLength() )
+ {
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_SVG,
+ XML_TITLE, sal_True, sal_False );
+ GetExport().Characters( sObjTitle );
+ }
+ }
+
+ // svg:description
+ if( rPropSetInfo->hasPropertyByName( sDescription ) )
+ {
+ OUString sObjDesc;
+ rPropSet->getPropertyValue( sDescription ) >>= sObjDesc;
+ if( sObjDesc.getLength() )
+ {
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_SVG,
+ XML_DESC, sal_True, sal_False );
+ GetExport().Characters( sObjDesc );
+ }
+ }
+}
+
+void XMLTextParagraphExport::setTextEmbeddedGraphicURL(
+ const Reference < XPropertySet >&,
+ OUString& /*rStreamName*/ ) const
+{
+}
+
+sal_Bool XMLTextParagraphExport::addHyperlinkAttributes(
+ const Reference < XPropertySet > & rPropSet,
+ const Reference < XPropertyState > & rPropState,
+ const Reference < XPropertySetInfo > & rPropSetInfo )
+{
+ sal_Bool bExport = sal_False;
+ OUString sHRef, sName, sTargetFrame, sUStyleName, sVStyleName;
+ sal_Bool bServerMap = sal_False;
+
+ if( rPropSetInfo->hasPropertyByName( sHyperLinkURL ) &&
+ ( !rPropState.is() || PropertyState_DIRECT_VALUE ==
+ rPropState->getPropertyState( sHyperLinkURL ) ) )
+ {
+ rPropSet->getPropertyValue( sHyperLinkURL ) >>= sHRef;
+
+ if( sHRef.getLength() > 0 )
+ bExport = sal_True;
+ }
+
+ if( rPropSetInfo->hasPropertyByName( sHyperLinkName ) &&
+ ( !rPropState.is() || PropertyState_DIRECT_VALUE ==
+ rPropState->getPropertyState( sHyperLinkName ) ) )
+ {
+ rPropSet->getPropertyValue( sHyperLinkName ) >>= sName;
+ if( sName.getLength() > 0 )
+ bExport = sal_True;
+ }
+
+ if( rPropSetInfo->hasPropertyByName( sHyperLinkTarget ) &&
+ ( !rPropState.is() || PropertyState_DIRECT_VALUE ==
+ rPropState->getPropertyState( sHyperLinkTarget ) ) )
+ {
+ rPropSet->getPropertyValue( sHyperLinkTarget ) >>= sTargetFrame;
+ if( sTargetFrame.getLength() )
+ bExport = sal_True;
+ }
+
+ if( rPropSetInfo->hasPropertyByName( sServerMap ) &&
+ ( !rPropState.is() || PropertyState_DIRECT_VALUE ==
+ rPropState->getPropertyState( sServerMap ) ) )
+ {
+ bServerMap = *(sal_Bool *)rPropSet->getPropertyValue( sServerMap ).getValue();
+ if( bServerMap )
+ bExport = sal_True;
+ }
+
+ if( rPropSetInfo->hasPropertyByName( sUnvisitedCharStyleName ) &&
+ ( !rPropState.is() || PropertyState_DIRECT_VALUE ==
+ rPropState->getPropertyState( sUnvisitedCharStyleName ) ) )
+ {
+ rPropSet->getPropertyValue( sUnvisitedCharStyleName ) >>= sUStyleName;
+ if( sUStyleName.getLength() )
+ bExport = sal_True;
+ }
+
+ if( rPropSetInfo->hasPropertyByName( sVisitedCharStyleName ) &&
+ ( !rPropState.is() || PropertyState_DIRECT_VALUE ==
+ rPropState->getPropertyState( sVisitedCharStyleName ) ) )
+ {
+ rPropSet->getPropertyValue( sVisitedCharStyleName ) >>= sVStyleName;
+ if( sVStyleName.getLength() )
+ bExport = sal_True;
+ }
+
+ if( bExport )
+ {
+ GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference( sHRef ) );
+
+ if( sName.getLength() > 0 )
+ GetExport().AddAttribute( XML_NAMESPACE_OFFICE, XML_NAME, sName );
+
+ if( sTargetFrame.getLength() )
+ {
+ GetExport().AddAttribute( XML_NAMESPACE_OFFICE,
+ XML_TARGET_FRAME_NAME, sTargetFrame );
+ enum XMLTokenEnum eTok =
+ sTargetFrame.equalsAsciiL( "_blank", sizeof("_blank")-1 )
+ ? XML_NEW : XML_REPLACE;
+ GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, eTok );
+ }
+
+ if( bServerMap )
+ GetExport().AddAttribute( XML_NAMESPACE_OFFICE,
+ XML_SERVER_MAP, XML_TRUE );
+
+ if( sUStyleName.getLength() )
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT,
+ XML_STYLE_NAME, GetExport().EncodeStyleName( sUStyleName ) );
+
+ if( sVStyleName.getLength() )
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT,
+ XML_VISITED_STYLE_NAME, GetExport().EncodeStyleName( sVStyleName ) );
+ }
+
+ return bExport;
+}
+
+void XMLTextParagraphExport::exportTextRange(
+ const Reference < XTextRange > & rTextRange,
+ sal_Bool bAutoStyles,
+ sal_Bool& rPrevCharIsSpace )
+{
+ Reference < XPropertySet > xPropSet( rTextRange, UNO_QUERY );
+ if( bAutoStyles )
+ {
+ Add( XML_STYLE_FAMILY_TEXT_TEXT, xPropSet );
+ }
+ else
+ {
+ sal_Bool bHyperlink = sal_False;
+ sal_Bool bIsUICharStyle = sal_False;
+ sal_Bool bHasAutoStyle = sal_False;
+
+ OUString sStyle(FindTextStyleAndHyperlink( xPropSet, bHyperlink,
+ bIsUICharStyle, bHasAutoStyle ));
+
+ Reference < XPropertySetInfo > xPropSetInfo;
+ if( bHyperlink )
+ {
+ Reference< XPropertyState > xPropState( xPropSet, UNO_QUERY );
+ xPropSetInfo.set(xPropSet->getPropertySetInfo());
+ bHyperlink = addHyperlinkAttributes( xPropSet, xPropState, xPropSetInfo );
+ }
+ SvXMLElementExport aElem( GetExport(), bHyperlink, XML_NAMESPACE_TEXT,
+ XML_A, sal_False, sal_False );
+ if( bHyperlink )
+ {
+ // export events (if supported)
+ OUString sHyperLinkEvents(RTL_CONSTASCII_USTRINGPARAM(
+ "HyperLinkEvents"));
+ if (xPropSetInfo->hasPropertyByName(sHyperLinkEvents))
+ {
+ Reference<XNameReplace> xName(xPropSet->getPropertyValue(sHyperLinkEvents), uno::UNO_QUERY);
+ GetExport().GetEventExport().Export(xName, sal_False);
+ }
+ }
+
+ {
+ XMLTextCharStyleNamesElementExport aCharStylesExport(
+ GetExport(), bIsUICharStyle &&
+ aCharStyleNamesPropInfoCache.hasProperty(
+ xPropSet, xPropSetInfo ), bHasAutoStyle,
+ xPropSet, sCharStyleNames );
+
+ OUString aText(rTextRange->getString());
+ if( sStyle.getLength() )
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME,
+ GetExport().EncodeStyleName( sStyle ) );
+ {
+ // in a block to make sure it is destroyed before the text:a element
+ SvXMLElementExport aElement( GetExport(), sStyle.getLength() > 0,
+ XML_NAMESPACE_TEXT, XML_SPAN, sal_False,
+ sal_False );
+ exportText( aText, rPrevCharIsSpace );
+ }
+ }
+ }
+}
+
+void XMLTextParagraphExport::exportText( const OUString& rText,
+ sal_Bool& rPrevCharIsSpace )
+{
+ sal_Int32 nExpStartPos = 0;
+ sal_Int32 nEndPos = rText.getLength();
+ sal_Int32 nSpaceChars = 0;
+ for( sal_Int32 nPos = 0; nPos < nEndPos; nPos++ )
+ {
+ sal_Unicode cChar = rText[nPos];
+ sal_Bool bExpCharAsText = sal_True;
+ sal_Bool bExpCharAsElement = sal_False;
+ sal_Bool bCurrCharIsSpace = sal_False;
+ switch( cChar )
+ {
+ case 0x0009: // Tab
+ case 0x000A: // LF
+ // These characters are exported as text.
+ bExpCharAsElement = sal_True;
+ bExpCharAsText = sal_False;
+ break;
+ case 0x000D:
+ break; // legal character
+ case 0x0020: // Blank
+ if( rPrevCharIsSpace )
+ {
+ // If the previous character is a space character,
+ // too, export a special space element.
+ bExpCharAsText = sal_False;
+ }
+ bCurrCharIsSpace = sal_True;
+ break;
+ default:
+ if( cChar < 0x0020 )
+ {
+#ifdef DBG_UTIL
+ OSL_ENSURE( txtparae_bContainsIllegalCharacters ||
+ cChar >= 0x0020,
+ "illegal character in text content" );
+ txtparae_bContainsIllegalCharacters = sal_True;
+#endif
+ bExpCharAsText = sal_False;
+ }
+ break;
+ }
+
+ // If the current character is not exported as text
+ // the text that has not been exported by now has to be exported now.
+ if( nPos > nExpStartPos && !bExpCharAsText )
+ {
+ DBG_ASSERT( 0==nSpaceChars, "pending spaces" );
+ OUString sExp( rText.copy( nExpStartPos, nPos - nExpStartPos ) );
+ GetExport().Characters( sExp );
+ nExpStartPos = nPos;
+ }
+
+ // If there are spaces left that have not been exported and the
+ // current chracter is not a space , the pending spaces have to be
+ // exported now.
+ if( nSpaceChars > 0 && !bCurrCharIsSpace )
+ {
+ DBG_ASSERT( nExpStartPos == nPos, " pending characters" );
+
+ if( nSpaceChars > 1 )
+ {
+ OUStringBuffer sTmp;
+ sTmp.append( (sal_Int32)nSpaceChars );
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_C,
+ sTmp.makeStringAndClear() );
+ }
+
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT,
+ XML_S, sal_False, sal_False );
+
+ nSpaceChars = 0;
+ }
+
+ // If the current character has to be exported as a special
+ // element, the elemnt will be exported now.
+ if( bExpCharAsElement )
+ {
+ switch( cChar )
+ {
+ case 0x0009: // Tab
+ {
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT,
+ XML_TAB, sal_False,
+ sal_False );
+ }
+ break;
+ case 0x000A: // LF
+ {
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT,
+ XML_LINE_BREAK, sal_False,
+ sal_False );
+ }
+ break;
+ }
+ }
+
+ // If the current character is a space, and the previous one
+ // is a space, too, the number of pending spaces is incremented
+ // only.
+ if( bCurrCharIsSpace && rPrevCharIsSpace )
+ nSpaceChars++;
+ rPrevCharIsSpace = bCurrCharIsSpace;
+
+ // If the currect character is not exported as text, the start
+ // position for text is the position behind the current position.
+ if( !bExpCharAsText )
+ {
+ DBG_ASSERT( nExpStartPos == nPos, "wrong export start pos" );
+ nExpStartPos = nPos+1;
+ }
+ }
+
+ if( nExpStartPos < nEndPos )
+ {
+ DBG_ASSERT( 0==nSpaceChars, " pending spaces " );
+ OUString sExp( rText.copy( nExpStartPos, nEndPos - nExpStartPos ) );
+ GetExport().Characters( sExp );
+ }
+
+ // If there are some spaces left, they have to be exported now.
+ if( nSpaceChars > 0 )
+ {
+ if( nSpaceChars > 1 )
+ {
+ OUStringBuffer sTmp;
+ sTmp.append( (sal_Int32)nSpaceChars );
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_C,
+ sTmp.makeStringAndClear() );
+ }
+
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT, XML_S,
+ sal_False, sal_False );
+ }
+}
+
+void XMLTextParagraphExport::exportTextDeclarations()
+{
+ pFieldExport->ExportFieldDeclarations();
+
+ // get XPropertySet from the document and ask for AutoMarkFileURL.
+ // If it exists, export the auto-mark-file element.
+ Reference<XPropertySet> xPropertySet( GetExport().GetModel(), UNO_QUERY );
+ if (xPropertySet.is())
+ {
+ OUString sUrl;
+ OUString sIndexAutoMarkFileURL(
+ RTL_CONSTASCII_USTRINGPARAM("IndexAutoMarkFileURL"));
+ if (xPropertySet->getPropertySetInfo()->hasPropertyByName(
+ sIndexAutoMarkFileURL))
+ {
+ xPropertySet->getPropertyValue(sIndexAutoMarkFileURL) >>= sUrl;
+ if (sUrl.getLength() > 0)
+ {
+ GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_HREF,
+ GetExport().GetRelativeReference(sUrl) );
+ SvXMLElementExport aAutoMarkElement(
+ GetExport(), XML_NAMESPACE_TEXT,
+ XML_ALPHABETICAL_INDEX_AUTO_MARK_FILE,
+ sal_True, sal_True );
+ }
+ }
+ }
+}
+
+void XMLTextParagraphExport::exportTextDeclarations(
+ const Reference<XText> & rText )
+{
+ pFieldExport->ExportFieldDeclarations(rText);
+}
+
+void XMLTextParagraphExport::exportUsedDeclarations( sal_Bool bOnlyUsed )
+{
+ pFieldExport->SetExportOnlyUsedFieldDeclarations( bOnlyUsed );
+}
+
+
+void XMLTextParagraphExport::exportTrackedChanges(sal_Bool bAutoStyles)
+{
+ if (NULL != pRedlineExport)
+ pRedlineExport->ExportChangesList( bAutoStyles );
+}
+
+void XMLTextParagraphExport::exportTrackedChanges(
+ const Reference<XText> & rText,
+ sal_Bool bAutoStyle)
+{
+ if (NULL != pRedlineExport)
+ pRedlineExport->ExportChangesList(rText, bAutoStyle);
+}
+
+void XMLTextParagraphExport::recordTrackedChangesForXText(
+ const Reference<XText> & rText )
+{
+ if (NULL != pRedlineExport)
+ pRedlineExport->SetCurrentXText(rText);
+}
+
+void XMLTextParagraphExport::recordTrackedChangesNoXText()
+{
+ if (NULL != pRedlineExport)
+ pRedlineExport->SetCurrentXText();
+}
+
+
+void XMLTextParagraphExport::exportTextAutoStyles()
+{
+ GetAutoStylePool().exportXML( XML_STYLE_FAMILY_TEXT_PARAGRAPH,
+ GetExport().GetDocHandler(),
+ GetExport().GetMM100UnitConverter(),
+ GetExport().GetNamespaceMap() );
+
+ GetAutoStylePool().exportXML( XML_STYLE_FAMILY_TEXT_TEXT,
+ GetExport().GetDocHandler(),
+ GetExport().GetMM100UnitConverter(),
+ GetExport().GetNamespaceMap() );
+
+ GetAutoStylePool().exportXML( XML_STYLE_FAMILY_TEXT_FRAME,
+ GetExport().GetDocHandler(),
+ GetExport().GetMM100UnitConverter(),
+ GetExport().GetNamespaceMap() );
+
+ GetAutoStylePool().exportXML( XML_STYLE_FAMILY_TEXT_SECTION,
+ GetExport().GetDocHandler(),
+ GetExport().GetMM100UnitConverter(),
+ GetExport().GetNamespaceMap() );
+
+ GetAutoStylePool().exportXML( XML_STYLE_FAMILY_TEXT_RUBY,
+ GetExport().GetDocHandler(),
+ GetExport().GetMM100UnitConverter(),
+ GetExport().GetNamespaceMap() );
+
+ pListAutoPool->exportXML();
+}
+
+void XMLTextParagraphExport::exportRuby(
+ const Reference<XPropertySet> & rPropSet,
+ sal_Bool bAutoStyles )
+{
+ // early out: a collapsed ruby makes no sense
+ if (*(sal_Bool*)rPropSet->getPropertyValue(sIsCollapsed).getValue())
+ return;
+
+ // start value ?
+ sal_Bool bStart = (*(sal_Bool*)rPropSet->getPropertyValue(sIsStart).getValue());
+
+ if (bAutoStyles)
+ {
+ // ruby auto styles
+ if (bStart)
+ Add( XML_STYLE_FAMILY_TEXT_RUBY, rPropSet );
+ }
+ else
+ {
+ // prepare element names
+ OUString aRuby(GetXMLToken(XML_RUBY));
+ OUString sTextRuby(GetExport().GetNamespaceMap().
+ GetQNameByKey(XML_NAMESPACE_TEXT, aRuby));
+ OUString sRubyBase(GetXMLToken(XML_RUBY_BASE));
+ OUString sTextRubyBase(GetExport().GetNamespaceMap().
+ GetQNameByKey(XML_NAMESPACE_TEXT, sRubyBase));
+
+ if (bStart)
+ {
+ // ruby start
+
+ // we can only start a ruby if none is open
+ DBG_ASSERT(! bOpenRuby, "Can't open a ruby inside of ruby!");
+ if( bOpenRuby )
+ return;
+
+ // save ruby text + ruby char style
+ rPropSet->getPropertyValue(sRubyText) >>= sOpenRubyText;
+ rPropSet->getPropertyValue(sRubyCharStyleName) >>= sOpenRubyCharStyle;
+
+ // ruby style
+ GetExport().CheckAttrList();
+ OUString sEmpty;
+ OUString sStyleName(Find( XML_STYLE_FAMILY_TEXT_RUBY, rPropSet,
+ sEmpty ));
+ DBG_ASSERT(sStyleName.getLength() > 0, "I can't find the style!");
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT,
+ XML_STYLE_NAME, sStyleName);
+
+ // export <text:ruby> and <text:ruby-base> start elements
+ GetExport().StartElement( XML_NAMESPACE_TEXT, XML_RUBY, sal_False);
+ GetExport().ClearAttrList();
+ GetExport().StartElement( XML_NAMESPACE_TEXT, XML_RUBY_BASE,
+ sal_False );
+ bOpenRuby = sal_True;
+ }
+ else
+ {
+ // ruby end
+
+ // check for an open ruby
+ DBG_ASSERT(bOpenRuby, "Can't close a ruby if none is open!");
+ if( !bOpenRuby )
+ return;
+
+ // close <text:ruby-base>
+ GetExport().EndElement(XML_NAMESPACE_TEXT, XML_RUBY_BASE,
+ sal_False);
+
+ // write the ruby text (with char style)
+ {
+ if (sOpenRubyCharStyle.getLength() > 0)
+ GetExport().AddAttribute(
+ XML_NAMESPACE_TEXT, XML_STYLE_NAME,
+ GetExport().EncodeStyleName( sOpenRubyCharStyle) );
+
+ SvXMLElementExport aRubyElement(
+ GetExport(), XML_NAMESPACE_TEXT, XML_RUBY_TEXT,
+ sal_False, sal_False);
+
+ GetExport().Characters(sOpenRubyText);
+ }
+
+ // and finally, close the ruby
+ GetExport().EndElement(XML_NAMESPACE_TEXT, XML_RUBY, sal_False);
+ bOpenRuby = sal_False;
+ }
+ }
+}
+
+void XMLTextParagraphExport::exportMeta(
+ const Reference<XPropertySet> & i_xPortion,
+ sal_Bool i_bAutoStyles, sal_Bool i_isProgress)
+{
+ static OUString sMeta(RTL_CONSTASCII_USTRINGPARAM("InContentMetadata"));
+
+ bool doExport(!i_bAutoStyles); // do not export element if autostyles
+ // check version >= 1.2
+ switch (GetExport().getDefaultVersion()) {
+ case SvtSaveOptions::ODFVER_011: // fall thru
+ case SvtSaveOptions::ODFVER_010: doExport = false; break;
+ default: break;
+ }
+
+ const Reference< XTextContent > xTextContent(
+ i_xPortion->getPropertyValue(sMeta), UNO_QUERY_THROW);
+ const Reference< XEnumerationAccess > xEA( xTextContent, UNO_QUERY_THROW );
+ const Reference< XEnumeration > xTextEnum( xEA->createEnumeration() );
+
+ if (doExport)
+ {
+ const Reference<rdf::XMetadatable> xMeta(xTextContent, UNO_QUERY_THROW);
+
+ // text:meta with neither xml:id nor RDFa is invalid
+ xMeta->ensureMetadataReference();
+
+ // xml:id and RDFa for RDF metadata
+ GetExport().AddAttributeXmlId(xMeta);
+ GetExport().AddAttributesRDFa(xTextContent);
+ }
+
+ SvXMLElementExport aElem( GetExport(), doExport,
+ XML_NAMESPACE_TEXT, XML_META, sal_False, sal_False );
+
+ // recurse to export content
+ exportTextRangeEnumeration( xTextEnum, i_bAutoStyles, i_isProgress );
+}
+
+
+void XMLTextParagraphExport::PreventExportOfControlsInMuteSections(
+ const Reference<XIndexAccess> & rShapes,
+ UniReference<xmloff::OFormLayerXMLExport> xFormExport )
+{
+ // check parameters ad pre-conditions
+ if( ( ! rShapes.is() ) || ( ! xFormExport.is() ) )
+ {
+ // if we don't have shapes or a form export, there's nothing to do
+ return;
+ }
+ DBG_ASSERT( pSectionExport != NULL, "We need the section export." );
+
+ Reference<XEnumeration> xShapesEnum = pBoundFrameSets->GetShapes()->createEnumeration();
+ if(!xShapesEnum.is())
+ return;
+ while( xShapesEnum->hasMoreElements() )
+ {
+ // now we need to check
+ // 1) if this is a control shape, and
+ // 2) if it's in a mute section
+ // if both answers are 'yes', notify the form layer export
+
+ // we join accessing the shape and testing for control
+ Reference<XControlShape> xControlShape(xShapesEnum->nextElement(), UNO_QUERY);
+ if( xControlShape.is() )
+ {
+ // Reference<XPropertySet> xPropSet( xControlShape, UNO_QUERY );
+ // Reference<XTextContent> xTextContent;
+ // xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TextRange" ) ) ) >>= xTextContent;
+
+ Reference<XTextContent> xTextContent( xControlShape, UNO_QUERY );
+ if( xTextContent.is() )
+ {
+ if( pSectionExport->IsMuteSection( xTextContent, sal_False ) )
+ {
+ // Ah, we've found a shape that
+ // 1) is a control shape
+ // 2) is anchored in a mute section
+ // so: don't export it!
+ xFormExport->excludeFromExport(
+ xControlShape->getControl() );
+ }
+ // else: not in mute section -> should be exported -> nothing
+ // to do
+ }
+ // else: no anchor -> ignore
+ }
+ // else: no control shape -> nothing to do
+ }
+}
+sal_Int32 XMLTextParagraphExport::GetHeadingLevel( const OUString& rStyleName )
+{
+ if( !pHeadingStyles )
+ {
+ pHeadingStyles = new XMLStringVector;
+ SvxXMLNumRuleExport::GetOutlineStyles( *pHeadingStyles,
+ GetExport().GetModel() );
+ }
+ for( XMLStringVector::size_type i=0; i < pHeadingStyles->size(); ++i )
+ {
+ if( (*pHeadingStyles)[i] == rStyleName )
+ return static_cast < sal_Int32 >( i );
+ }
+
+ return -1;
+}
+
+void XMLTextParagraphExport::PushNewTextListsHelper()
+{
+ mpTextListsHelper = new XMLTextListsHelper();
+ maTextListsHelperStack.push_back( mpTextListsHelper );
+}
+
+void XMLTextParagraphExport::PopTextListsHelper()
+{
+ delete mpTextListsHelper;
+ mpTextListsHelper = 0;
+ maTextListsHelperStack.pop_back();
+ if ( !maTextListsHelperStack.empty() )
+ {
+ mpTextListsHelper = maTextListsHelperStack.back();
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx
new file mode 100644
index 000000000000..bc5149ca707a
--- /dev/null
+++ b/xmloff/source/text/txtparai.cxx
@@ -0,0 +1,2439 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "unointerfacetouniqueidentifiermapper.hxx"
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <tools/debug.hxx>
+
+#include <tools/string.hxx>
+#include <svl/svarray.hxx>
+#include <com/sun/star/text/XTextFrame.hpp>
+#include <com/sun/star/text/XTextCursor.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/text/ControlCharacter.hpp>
+#include <com/sun/star/container/XIndexReplace.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/rdf/XMetadatable.hpp>
+
+
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/txtimp.hxx>
+#include "txtparai.hxx"
+#include "txtfldi.hxx"
+#include <xmloff/xmluconv.hxx>
+#include "XMLFootnoteImportContext.hxx"
+#include "XMLTextMarkImportContext.hxx"
+#include "XMLTextFrameContext.hxx"
+#include <xmloff/XMLCharContext.hxx>
+#include "XMLTextFrameHyperlinkContext.hxx"
+#include <xmloff/XMLEventsImportContext.hxx>
+#include "XMLChangeImportContext.hxx"
+#include "txtlists.hxx"
+
+
+// OD 2004-04-21 #i26791#
+#include <txtparaimphint.hxx>
+typedef XMLHint_Impl *XMLHint_ImplPtr;
+SV_DECL_PTRARR_DEL( XMLHints_Impl, XMLHint_ImplPtr, 5, 5 )
+SV_IMPL_PTRARR( XMLHints_Impl, XMLHint_ImplPtr )
+// OD 2004-04-21 #i26791#
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::beans;
+using namespace ::xmloff::token;
+using ::com::sun::star::container::XEnumerationAccess;
+using ::com::sun::star::container::XEnumeration;
+
+
+TYPEINIT1( XMLCharContext, SvXMLImportContext );
+
+XMLCharContext::XMLCharContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const Reference< xml::sax::XAttributeList > & xAttrList,
+ sal_Unicode c,
+ sal_Bool bCount ) :
+ SvXMLImportContext( rImport, nPrfx, rLName )
+ ,m_nControl(0)
+ ,m_nCount(1)
+ ,m_c(c)
+{
+ if( bCount )
+ {
+ const SvXMLNamespaceMap& rMap = GetImport().GetNamespaceMap();
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+
+ OUString aLocalName;
+ sal_uInt16 nPrefix =rMap.GetKeyByAttrName( rAttrName,&aLocalName );
+ if( XML_NAMESPACE_TEXT == nPrefix &&
+ IsXMLToken( aLocalName, XML_C ) )
+ {
+ sal_Int32 nTmp = xAttrList->getValueByIndex(i).toInt32();
+ if( nTmp > 0L )
+ {
+ if( nTmp > USHRT_MAX )
+ m_nCount = USHRT_MAX;
+ else
+ m_nCount = (sal_uInt16)nTmp;
+ }
+ }
+ }
+ }
+}
+
+XMLCharContext::XMLCharContext(
+ SvXMLImport& rImp,
+ sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const Reference< xml::sax::XAttributeList > &,
+ sal_Int16 nControl ) :
+ SvXMLImportContext( rImp, nPrfx, rLName )
+ ,m_nControl(nControl)
+ ,m_nCount(0)
+{
+}
+
+XMLCharContext::~XMLCharContext()
+{
+}
+// -----------------------------------------------------------------------------
+void XMLCharContext::EndElement()
+{
+ if ( !m_nCount )
+ InsertControlCharacter( m_nControl );
+ else
+ {
+ if( 1U == m_nCount )
+ {
+ OUString sBuff( &m_c, 1 );
+ InsertString(sBuff);
+ }
+ else
+ {
+ OUStringBuffer sBuff( m_nCount );
+ while( m_nCount-- )
+ sBuff.append( &m_c, 1 );
+
+ InsertString(sBuff.makeStringAndClear() );
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+void XMLCharContext::InsertControlCharacter(sal_Int16 _nControl)
+{
+ GetImport().GetTextImport()->InsertControlCharacter( _nControl );
+}
+void XMLCharContext::InsertString(const ::rtl::OUString& _sString)
+{
+ GetImport().GetTextImport()->InsertString( _sString );
+}
+
+// ---------------------------------------------------------------------
+
+/** import start of reference (<text:reference-start>) */
+class XMLStartReferenceContext_Impl : public SvXMLImportContext
+{
+public:
+ TYPEINFO();
+
+ // Do everything in constructor. Well ...
+ XMLStartReferenceContext_Impl (
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ XMLHints_Impl& rHnts,
+ const Reference<xml::sax::XAttributeList> & xAttrList);
+
+ static sal_Bool FindName(
+ SvXMLImport& rImport,
+ const Reference<xml::sax::XAttributeList> & xAttrList,
+ OUString& rName);
+};
+
+TYPEINIT1( XMLStartReferenceContext_Impl, SvXMLImportContext );
+
+XMLStartReferenceContext_Impl::XMLStartReferenceContext_Impl(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ XMLHints_Impl& rHints,
+ const Reference<xml::sax::XAttributeList> & xAttrList) :
+ SvXMLImportContext(rImport, nPrefix, rLocalName)
+{
+ OUString sName;
+
+ if (FindName(GetImport(), xAttrList, sName))
+ {
+ XMLHint_Impl* pHint = new XMLReferenceHint_Impl(
+ sName, rImport.GetTextImport()->GetCursor()->getStart() );
+
+ // degenerates to point reference, if no end is found!
+ pHint->SetEnd(rImport.GetTextImport()->GetCursor()->getStart() );
+
+ rHints.Insert(pHint, rHints.Count());
+ }
+}
+
+sal_Bool XMLStartReferenceContext_Impl::FindName(
+ SvXMLImport& rImport,
+ const Reference<xml::sax::XAttributeList> & xAttrList,
+ OUString& rName)
+{
+ sal_Bool bNameOK( sal_False );
+
+ // find name attribute first
+ const sal_Int16 nLength( xAttrList->getLength() );
+ for (sal_Int16 nAttr = 0; nAttr < nLength; nAttr++)
+ {
+ OUString sLocalName;
+ const sal_uInt16 nPrefix = rImport.GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
+ &sLocalName );
+
+ if ( (XML_NAMESPACE_TEXT == nPrefix) &&
+ IsXMLToken(sLocalName, XML_NAME) )
+ {
+ rName = xAttrList->getValueByIndex(nAttr);
+ bNameOK = sal_True;
+ }
+ }
+
+ return bNameOK;
+}
+
+// ---------------------------------------------------------------------
+
+/** import end of reference (<text:reference-end>) */
+class XMLEndReferenceContext_Impl : public SvXMLImportContext
+{
+public:
+ TYPEINFO();
+
+ // Do everything in constructor. Well ...
+ XMLEndReferenceContext_Impl(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ XMLHints_Impl& rHnts,
+ const Reference<xml::sax::XAttributeList> & xAttrList);
+};
+
+TYPEINIT1( XMLEndReferenceContext_Impl, SvXMLImportContext );
+
+XMLEndReferenceContext_Impl::XMLEndReferenceContext_Impl(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ XMLHints_Impl& rHints,
+ const Reference<xml::sax::XAttributeList> & xAttrList) :
+ SvXMLImportContext(rImport, nPrefix, rLocalName)
+{
+ OUString sName;
+
+ // borrow from XMLStartReferenceContext_Impl
+ if (XMLStartReferenceContext_Impl::FindName(GetImport(), xAttrList, sName))
+ {
+ // search for reference start
+ sal_uInt16 nCount = rHints.Count();
+ for(sal_uInt16 nPos = 0; nPos < nCount; nPos++)
+ {
+ XMLHint_Impl *pHint = rHints[nPos];
+ if ( pHint->IsReference() &&
+ sName.equals( ((XMLReferenceHint_Impl *)pHint)->GetRefName()) )
+ {
+ // set end and stop searching
+ pHint->SetEnd(GetImport().GetTextImport()->
+ GetCursor()->getStart() );
+ break;
+ }
+ }
+ // else: no start (in this paragraph) -> ignore
+ }
+}
+
+// ---------------------------------------------------------------------
+
+class XMLImpSpanContext_Impl : public SvXMLImportContext
+{
+ const OUString sTextFrame;
+
+ XMLHints_Impl& rHints;
+ XMLStyleHint_Impl *pHint;
+
+ sal_Bool& rIgnoreLeadingSpace;
+
+ sal_uInt8 nStarFontsConvFlags;
+
+public:
+
+ TYPEINFO();
+
+ XMLImpSpanContext_Impl(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const Reference< xml::sax::XAttributeList > & xAttrList,
+ XMLHints_Impl& rHnts,
+ sal_Bool& rIgnLeadSpace
+ ,sal_uInt8 nSFConvFlags
+ );
+
+ virtual ~XMLImpSpanContext_Impl();
+
+ static SvXMLImportContext *CreateChildContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix, const OUString& rLocalName,
+ const Reference< xml::sax::XAttributeList > & xAttrList,
+ sal_uInt16 nToken, XMLHints_Impl& rHnts,
+ sal_Bool& rIgnLeadSpace
+ ,sal_uInt8 nStarFontsConvFlags = 0
+ );
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix, const OUString& rLocalName,
+ const Reference< xml::sax::XAttributeList > & xAttrList );
+
+ virtual void Characters( const OUString& rChars );
+};
+// ---------------------------------------------------------------------
+
+class XMLImpHyperlinkContext_Impl : public SvXMLImportContext
+{
+ XMLHints_Impl& rHints;
+ XMLHyperlinkHint_Impl *pHint;
+
+ sal_Bool& rIgnoreLeadingSpace;
+
+public:
+
+ TYPEINFO();
+
+ XMLImpHyperlinkContext_Impl(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const Reference< xml::sax::XAttributeList > & xAttrList,
+ XMLHints_Impl& rHnts,
+ sal_Bool& rIgnLeadSpace );
+
+ virtual ~XMLImpHyperlinkContext_Impl();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix, const OUString& rLocalName,
+ const Reference< xml::sax::XAttributeList > & xAttrList );
+
+ virtual void Characters( const OUString& rChars );
+};
+
+TYPEINIT1( XMLImpHyperlinkContext_Impl, SvXMLImportContext );
+
+XMLImpHyperlinkContext_Impl::XMLImpHyperlinkContext_Impl(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const Reference< xml::sax::XAttributeList > & xAttrList,
+ XMLHints_Impl& rHnts,
+ sal_Bool& rIgnLeadSpace ) :
+ SvXMLImportContext( rImport, nPrfx, rLName ),
+ rHints( rHnts ),
+ pHint( new XMLHyperlinkHint_Impl(
+ GetImport().GetTextImport()->GetCursorAsRange()->getStart() ) ),
+ rIgnoreLeadingSpace( rIgnLeadSpace )
+{
+ OUString sShow;
+ const SvXMLTokenMap& rTokenMap =
+ GetImport().GetTextImport()->GetTextHyperlinkAttrTokenMap();
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ const OUString& rValue = xAttrList->getValueByIndex( i );
+
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ switch( rTokenMap.Get( nPrefix, aLocalName ) )
+ {
+ case XML_TOK_TEXT_HYPERLINK_HREF:
+ pHint->SetHRef( GetImport().GetAbsoluteReference( rValue ) );
+ break;
+ case XML_TOK_TEXT_HYPERLINK_NAME:
+ pHint->SetName( rValue );
+ break;
+ case XML_TOK_TEXT_HYPERLINK_TARGET_FRAME:
+ pHint->SetTargetFrameName( rValue );
+ break;
+ case XML_TOK_TEXT_HYPERLINK_SHOW:
+ sShow = rValue;
+ break;
+ case XML_TOK_TEXT_HYPERLINK_STYLE_NAME:
+ pHint->SetStyleName( rValue );
+ break;
+ case XML_TOK_TEXT_HYPERLINK_VIS_STYLE_NAME:
+ pHint->SetVisitedStyleName( rValue );
+ break;
+ }
+ }
+
+ if( sShow.getLength() && !pHint->GetTargetFrameName().getLength() )
+ {
+ if( IsXMLToken( sShow, XML_NEW ) )
+ pHint->SetTargetFrameName(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("_blank" ) ) );
+ else if( IsXMLToken( sShow, XML_REPLACE ) )
+ pHint->SetTargetFrameName(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("_self" ) ) );
+ }
+ rHints.Insert( pHint, rHints.Count() );
+}
+
+XMLImpHyperlinkContext_Impl::~XMLImpHyperlinkContext_Impl()
+{
+ if( pHint )
+ pHint->SetEnd( GetImport().GetTextImport()
+ ->GetCursorAsRange()->getStart() );
+}
+
+SvXMLImportContext *XMLImpHyperlinkContext_Impl::CreateChildContext(
+ sal_uInt16 nPrefix, const OUString& rLocalName,
+ const Reference< xml::sax::XAttributeList > & xAttrList )
+{
+ if ( (nPrefix == XML_NAMESPACE_OFFICE) &&
+ IsXMLToken(rLocalName, XML_EVENT_LISTENERS) )
+ {
+ XMLEventsImportContext* pCtxt = new XMLEventsImportContext(
+ GetImport(), nPrefix, rLocalName);
+ pHint->SetEventsContext(pCtxt);
+ return pCtxt;
+ }
+ else
+ {
+ const SvXMLTokenMap& rTokenMap =
+ GetImport().GetTextImport()->GetTextPElemTokenMap();
+ sal_uInt16 nToken = rTokenMap.Get( nPrefix, rLocalName );
+
+ return XMLImpSpanContext_Impl::CreateChildContext(
+ GetImport(), nPrefix, rLocalName, xAttrList,
+ nToken, rHints, rIgnoreLeadingSpace );
+ }
+}
+
+void XMLImpHyperlinkContext_Impl::Characters( const OUString& rChars )
+{
+ GetImport().GetTextImport()->InsertString( rChars, rIgnoreLeadingSpace );
+}
+
+// ---------------------------------------------------------------------
+
+class XMLImpRubyBaseContext_Impl : public SvXMLImportContext
+{
+ XMLHints_Impl& rHints;
+
+ sal_Bool& rIgnoreLeadingSpace;
+
+public:
+
+ TYPEINFO();
+
+ XMLImpRubyBaseContext_Impl(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const Reference< xml::sax::XAttributeList > & xAttrList,
+ XMLHints_Impl& rHnts,
+ sal_Bool& rIgnLeadSpace );
+
+ virtual ~XMLImpRubyBaseContext_Impl();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix, const OUString& rLocalName,
+ const Reference< xml::sax::XAttributeList > & xAttrList );
+
+ virtual void Characters( const OUString& rChars );
+};
+
+TYPEINIT1( XMLImpRubyBaseContext_Impl, SvXMLImportContext );
+
+XMLImpRubyBaseContext_Impl::XMLImpRubyBaseContext_Impl(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const Reference< xml::sax::XAttributeList > &,
+ XMLHints_Impl& rHnts,
+ sal_Bool& rIgnLeadSpace ) :
+ SvXMLImportContext( rImport, nPrfx, rLName ),
+ rHints( rHnts ),
+ rIgnoreLeadingSpace( rIgnLeadSpace )
+{
+}
+
+XMLImpRubyBaseContext_Impl::~XMLImpRubyBaseContext_Impl()
+{
+}
+
+SvXMLImportContext *XMLImpRubyBaseContext_Impl::CreateChildContext(
+ sal_uInt16 nPrefix, const OUString& rLocalName,
+ const Reference< xml::sax::XAttributeList > & xAttrList )
+{
+ const SvXMLTokenMap& rTokenMap =
+ GetImport().GetTextImport()->GetTextPElemTokenMap();
+ sal_uInt16 nToken = rTokenMap.Get( nPrefix, rLocalName );
+
+ return XMLImpSpanContext_Impl::CreateChildContext( GetImport(), nPrefix,
+ rLocalName, xAttrList,
+ nToken, rHints, rIgnoreLeadingSpace );
+}
+
+void XMLImpRubyBaseContext_Impl::Characters( const OUString& rChars )
+{
+ GetImport().GetTextImport()->InsertString( rChars, rIgnoreLeadingSpace );
+}
+
+// ---------------------------------------------------------------------
+
+class XMLImpRubyContext_Impl : public SvXMLImportContext
+{
+ XMLHints_Impl& rHints;
+
+ sal_Bool& rIgnoreLeadingSpace;
+
+ Reference < XTextRange > m_xStart;
+ OUString m_sStyleName;
+ OUString m_sTextStyleName;
+ OUString m_sText;
+
+public:
+
+ TYPEINFO();
+
+ XMLImpRubyContext_Impl(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const Reference< xml::sax::XAttributeList > & xAttrList,
+ XMLHints_Impl& rHnts,
+ sal_Bool& rIgnLeadSpace );
+
+ virtual ~XMLImpRubyContext_Impl();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix, const OUString& rLocalName,
+ const Reference< xml::sax::XAttributeList > & xAttrList );
+
+ void SetTextStyleName( const OUString& s ) { m_sTextStyleName = s; }
+ void AppendText( const OUString& s ) { m_sText += s; }
+};
+
+// ---------------------------------------------------------------------
+
+class XMLImpRubyTextContext_Impl : public SvXMLImportContext
+{
+ XMLImpRubyContext_Impl & m_rRubyContext;
+
+public:
+
+ TYPEINFO();
+
+ XMLImpRubyTextContext_Impl(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const Reference< xml::sax::XAttributeList > & xAttrList,
+ XMLImpRubyContext_Impl & rParent );
+
+ virtual ~XMLImpRubyTextContext_Impl();
+
+ virtual void Characters( const OUString& rChars );
+};
+
+TYPEINIT1( XMLImpRubyTextContext_Impl, SvXMLImportContext );
+
+XMLImpRubyTextContext_Impl::XMLImpRubyTextContext_Impl(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const Reference< xml::sax::XAttributeList > & xAttrList,
+ XMLImpRubyContext_Impl & rParent )
+ : SvXMLImportContext( rImport, nPrfx, rLName )
+ , m_rRubyContext( rParent )
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ const OUString& rValue = xAttrList->getValueByIndex( i );
+
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ if( XML_NAMESPACE_TEXT == nPrefix &&
+ IsXMLToken( aLocalName, XML_STYLE_NAME ) )
+ {
+ m_rRubyContext.SetTextStyleName( rValue );
+ break;
+ }
+ }
+}
+
+XMLImpRubyTextContext_Impl::~XMLImpRubyTextContext_Impl()
+{
+}
+
+void XMLImpRubyTextContext_Impl::Characters( const OUString& rChars )
+{
+ m_rRubyContext.AppendText( rChars );
+}
+
+// ---------------------------------------------------------------------
+
+TYPEINIT1( XMLImpRubyContext_Impl, SvXMLImportContext );
+
+XMLImpRubyContext_Impl::XMLImpRubyContext_Impl(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const Reference< xml::sax::XAttributeList > & xAttrList,
+ XMLHints_Impl& rHnts,
+ sal_Bool& rIgnLeadSpace ) :
+ SvXMLImportContext( rImport, nPrfx, rLName ),
+ rHints( rHnts ),
+ rIgnoreLeadingSpace( rIgnLeadSpace )
+ , m_xStart( GetImport().GetTextImport()->GetCursorAsRange()->getStart() )
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ const OUString& rValue = xAttrList->getValueByIndex( i );
+
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ if( XML_NAMESPACE_TEXT == nPrefix &&
+ IsXMLToken( aLocalName, XML_STYLE_NAME ) )
+ {
+ m_sStyleName = rValue;
+ break;
+ }
+ }
+}
+
+XMLImpRubyContext_Impl::~XMLImpRubyContext_Impl()
+{
+ const UniReference < XMLTextImportHelper > xTextImport(
+ GetImport().GetTextImport());
+ const Reference < XTextCursor > xAttrCursor(
+ xTextImport->GetText()->createTextCursorByRange( m_xStart ));
+ xAttrCursor->gotoRange(xTextImport->GetCursorAsRange()->getStart(),
+ sal_True);
+ xTextImport->SetRuby( GetImport(), xAttrCursor,
+ m_sStyleName, m_sTextStyleName, m_sText );
+}
+
+SvXMLImportContext *XMLImpRubyContext_Impl::CreateChildContext(
+ sal_uInt16 nPrefix, const OUString& rLocalName,
+ const Reference< xml::sax::XAttributeList > & xAttrList )
+{
+ SvXMLImportContext *pContext;
+ if( XML_NAMESPACE_TEXT == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_RUBY_BASE ) )
+ pContext = new XMLImpRubyBaseContext_Impl( GetImport(), nPrefix,
+ rLocalName,
+ xAttrList,
+ rHints,
+ rIgnoreLeadingSpace );
+ else if( IsXMLToken( rLocalName, XML_RUBY_TEXT ) )
+ pContext = new XMLImpRubyTextContext_Impl( GetImport(), nPrefix,
+ rLocalName,
+ xAttrList,
+ *this );
+ else
+ pContext = new SvXMLImportContext(
+ GetImport(), nPrefix, rLocalName );
+ }
+ else
+ pContext = SvXMLImportContext::CreateChildContext( nPrefix, rLocalName,
+ xAttrList );
+
+ return pContext;
+}
+
+// ---------------------------------------------------------------------
+
+/** for text:meta and text:meta-field
+ */
+class XMLMetaImportContextBase : public SvXMLImportContext
+{
+ XMLHints_Impl& m_rHints;
+
+ sal_Bool& m_rIgnoreLeadingSpace;
+
+ /// start position
+ Reference<XTextRange> m_xStart;
+
+protected:
+ OUString m_XmlId;
+
+public:
+ TYPEINFO();
+
+ XMLMetaImportContextBase(
+ SvXMLImport& i_rImport,
+ const sal_uInt16 i_nPrefix,
+ const OUString& i_rLocalName,
+ XMLHints_Impl& i_rHints,
+ sal_Bool & i_rIgnoreLeadingSpace );
+
+ virtual ~XMLMetaImportContextBase();
+
+ virtual void StartElement(
+ const Reference<xml::sax::XAttributeList> & i_xAttrList);
+
+ virtual void EndElement();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 i_nPrefix, const OUString& i_rLocalName,
+ const Reference< xml::sax::XAttributeList > & i_xAttrList);
+
+ virtual void Characters( const OUString& i_rChars );
+
+ virtual void ProcessAttribute(sal_uInt16 const i_nPrefix,
+ OUString const & i_rLocalName, OUString const & i_rValue);
+
+ virtual void InsertMeta(const Reference<XTextRange> & i_xInsertionRange)
+ = 0;
+};
+
+TYPEINIT1( XMLMetaImportContextBase, SvXMLImportContext );
+
+XMLMetaImportContextBase::XMLMetaImportContextBase(
+ SvXMLImport& i_rImport,
+ const sal_uInt16 i_nPrefix,
+ const OUString& i_rLocalName,
+ XMLHints_Impl& i_rHints,
+ sal_Bool & i_rIgnoreLeadingSpace )
+ : SvXMLImportContext( i_rImport, i_nPrefix, i_rLocalName )
+ , m_rHints( i_rHints )
+ , m_rIgnoreLeadingSpace( i_rIgnoreLeadingSpace )
+ , m_xStart( GetImport().GetTextImport()->GetCursorAsRange()->getStart() )
+{
+}
+
+XMLMetaImportContextBase::~XMLMetaImportContextBase()
+{
+}
+
+void XMLMetaImportContextBase::StartElement(
+ const Reference<xml::sax::XAttributeList> & i_xAttrList)
+{
+ const sal_Int16 nAttrCount(i_xAttrList.is() ? i_xAttrList->getLength() : 0);
+ for ( sal_Int16 i = 0; i < nAttrCount; ++i )
+ {
+ const OUString& rAttrName( i_xAttrList->getNameByIndex( i ) );
+ const OUString& rValue( i_xAttrList->getValueByIndex( i ) );
+
+ OUString sLocalName;
+ const sal_uInt16 nPrefix(
+ GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &sLocalName ));
+ ProcessAttribute(nPrefix, sLocalName, rValue);
+ }
+}
+
+void XMLMetaImportContextBase::EndElement()
+{
+ OSL_ENSURE(m_xStart.is(), "no mxStart?");
+ if (!m_xStart.is()) return;
+
+ const Reference<XTextRange> xEndRange(
+ GetImport().GetTextImport()->GetCursorAsRange()->getStart() );
+
+ // create range for insertion
+ const Reference<XTextCursor> xInsertionCursor(
+ GetImport().GetTextImport()->GetText()->createTextCursorByRange(
+ xEndRange) );
+ xInsertionCursor->gotoRange(m_xStart, sal_True);
+
+ const Reference<XTextRange> xInsertionRange(xInsertionCursor, UNO_QUERY);
+
+ InsertMeta(xInsertionRange);
+}
+
+SvXMLImportContext * XMLMetaImportContextBase::CreateChildContext(
+ sal_uInt16 i_nPrefix, const OUString& i_rLocalName,
+ const Reference< xml::sax::XAttributeList > & i_xAttrList )
+{
+ const SvXMLTokenMap& rTokenMap(
+ GetImport().GetTextImport()->GetTextPElemTokenMap() );
+ const sal_uInt16 nToken( rTokenMap.Get( i_nPrefix, i_rLocalName ) );
+
+ return XMLImpSpanContext_Impl::CreateChildContext( GetImport(), i_nPrefix,
+ i_rLocalName, i_xAttrList, nToken, m_rHints, m_rIgnoreLeadingSpace );
+}
+
+void XMLMetaImportContextBase::Characters( const OUString& i_rChars )
+{
+ GetImport().GetTextImport()->InsertString(i_rChars, m_rIgnoreLeadingSpace);
+}
+
+void XMLMetaImportContextBase::ProcessAttribute(sal_uInt16 const i_nPrefix,
+ OUString const & i_rLocalName, OUString const & i_rValue)
+{
+ if ( (XML_NAMESPACE_XML == i_nPrefix) && IsXMLToken(i_rLocalName, XML_ID) )
+ {
+ m_XmlId = i_rValue;
+ }
+}
+
+
+// ---------------------------------------------------------------------
+
+/** text:meta */
+class XMLMetaImportContext : public XMLMetaImportContextBase
+{
+ // RDFa
+ bool m_bHaveAbout;
+ ::rtl::OUString m_sAbout;
+ ::rtl::OUString m_sProperty;
+ ::rtl::OUString m_sContent;
+ ::rtl::OUString m_sDatatype;
+
+public:
+ TYPEINFO();
+
+ XMLMetaImportContext(
+ SvXMLImport& i_rImport,
+ const sal_uInt16 i_nPrefix,
+ const OUString& i_rLocalName,
+ XMLHints_Impl& i_rHints,
+ sal_Bool & i_rIgnoreLeadingSpace );
+
+ virtual void ProcessAttribute(sal_uInt16 const i_nPrefix,
+ OUString const & i_rLocalName, OUString const & i_rValue);
+
+ virtual void InsertMeta(const Reference<XTextRange> & i_xInsertionRange);
+};
+
+TYPEINIT1( XMLMetaImportContext, XMLMetaImportContextBase );
+
+XMLMetaImportContext::XMLMetaImportContext(
+ SvXMLImport& i_rImport,
+ const sal_uInt16 i_nPrefix,
+ const OUString& i_rLocalName,
+ XMLHints_Impl& i_rHints,
+ sal_Bool & i_rIgnoreLeadingSpace )
+ : XMLMetaImportContextBase( i_rImport, i_nPrefix, i_rLocalName,
+ i_rHints, i_rIgnoreLeadingSpace )
+ , m_bHaveAbout(false)
+{
+}
+
+void XMLMetaImportContext::ProcessAttribute(sal_uInt16 const i_nPrefix,
+ OUString const & i_rLocalName, OUString const & i_rValue)
+{
+ if ( XML_NAMESPACE_XHTML == i_nPrefix )
+ {
+ // RDFa
+ if ( IsXMLToken( i_rLocalName, XML_ABOUT) )
+ {
+ m_sAbout = i_rValue;
+ m_bHaveAbout = true;
+ }
+ else if ( IsXMLToken( i_rLocalName, XML_PROPERTY) )
+ {
+ m_sProperty = i_rValue;
+ }
+ else if ( IsXMLToken( i_rLocalName, XML_CONTENT) )
+ {
+ m_sContent = i_rValue;
+ }
+ else if ( IsXMLToken( i_rLocalName, XML_DATATYPE) )
+ {
+ m_sDatatype = i_rValue;
+ }
+ }
+ else
+ {
+ XMLMetaImportContextBase::ProcessAttribute(
+ i_nPrefix, i_rLocalName, i_rValue);
+ }
+}
+
+void XMLMetaImportContext::InsertMeta(
+ const Reference<XTextRange> & i_xInsertionRange)
+{
+ OSL_ENSURE(!m_bHaveAbout == !m_sProperty.getLength(),
+ "XMLMetaImportContext::InsertMeta: invalid RDFa?");
+ if (m_XmlId.getLength() || (m_bHaveAbout && m_sProperty.getLength()))
+ {
+ // insert mark
+ const uno::Reference<rdf::XMetadatable> xMeta(
+ XMLTextMarkImportContext::CreateAndInsertMark(
+ GetImport(),
+ OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.text.InContentMetadata")),
+ OUString(),
+ i_xInsertionRange, m_XmlId),
+ uno::UNO_QUERY);
+ OSL_ENSURE(xMeta.is(), "cannot insert Meta?");
+
+ if (xMeta.is() && m_bHaveAbout)
+ {
+ GetImport().AddRDFa(xMeta,
+ m_sAbout, m_sProperty, m_sContent, m_sDatatype);
+ }
+ }
+ else
+ {
+ OSL_TRACE("invalid <text:meta>: no xml:id, no valid RDFa");
+ }
+}
+
+// ---------------------------------------------------------------------
+
+/** text:meta-field */
+class XMLMetaFieldImportContext : public XMLMetaImportContextBase
+{
+ OUString m_DataStyleName;
+
+public:
+ TYPEINFO();
+
+ XMLMetaFieldImportContext(
+ SvXMLImport& i_rImport,
+ const sal_uInt16 i_nPrefix,
+ const OUString& i_rLocalName,
+ XMLHints_Impl& i_rHints,
+ sal_Bool & i_rIgnoreLeadingSpace );
+
+ virtual void ProcessAttribute(sal_uInt16 const i_nPrefix,
+ OUString const & i_rLocalName, OUString const & i_rValue);
+
+ virtual void InsertMeta(const Reference<XTextRange> & i_xInsertionRange);
+};
+
+TYPEINIT1( XMLMetaFieldImportContext, XMLMetaImportContextBase );
+
+XMLMetaFieldImportContext::XMLMetaFieldImportContext(
+ SvXMLImport& i_rImport,
+ const sal_uInt16 i_nPrefix,
+ const OUString& i_rLocalName,
+ XMLHints_Impl& i_rHints,
+ sal_Bool & i_rIgnoreLeadingSpace )
+ : XMLMetaImportContextBase( i_rImport, i_nPrefix, i_rLocalName,
+ i_rHints, i_rIgnoreLeadingSpace )
+{
+}
+
+void XMLMetaFieldImportContext::ProcessAttribute(sal_uInt16 const i_nPrefix,
+ OUString const & i_rLocalName, OUString const & i_rValue)
+{
+ if ( XML_NAMESPACE_STYLE == i_nPrefix &&
+ IsXMLToken( i_rLocalName, XML_DATA_STYLE_NAME ) )
+ {
+ m_DataStyleName = i_rValue;
+ }
+ else
+ {
+ XMLMetaImportContextBase::ProcessAttribute(
+ i_nPrefix, i_rLocalName, i_rValue);
+ }
+}
+
+void XMLMetaFieldImportContext::InsertMeta(
+ const Reference<XTextRange> & i_xInsertionRange)
+{
+ if (m_XmlId.getLength()) // valid?
+ {
+ // insert mark
+ const Reference<XPropertySet> xPropertySet(
+ XMLTextMarkImportContext::CreateAndInsertMark(
+ GetImport(),
+ OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.text.textfield.MetadataField")),
+ OUString(),
+ i_xInsertionRange, m_XmlId),
+ UNO_QUERY);
+ OSL_ENSURE(xPropertySet.is(), "cannot insert MetaField?");
+ if (!xPropertySet.is()) return;
+
+ if (m_DataStyleName.getLength())
+ {
+ sal_Bool isDefaultLanguage(sal_True);
+
+ const sal_Int32 nKey( GetImport().GetTextImport()->GetDataStyleKey(
+ m_DataStyleName, & isDefaultLanguage) );
+
+ if (-1 != nKey)
+ {
+ static ::rtl::OUString sPropertyIsFixedLanguage(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsFixedLanguage")) );
+ Any any;
+ any <<= nKey;
+ xPropertySet->setPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("NumberFormat")), any);
+ if ( xPropertySet->getPropertySetInfo()->
+ hasPropertyByName( sPropertyIsFixedLanguage ) )
+ {
+ any <<= static_cast<bool>(!isDefaultLanguage);
+ xPropertySet->setPropertyValue( sPropertyIsFixedLanguage,
+ any );
+ }
+ }
+ }
+ }
+ else
+ {
+ OSL_TRACE("invalid <text:meta-field>: no xml:id");
+ }
+}
+
+
+// ---------------------------------------------------------------------
+
+
+/**
+ * Process index marks.
+ *
+ * All *-mark-end index marks should instantiate *this* class (because
+ * it doesn't process attributes other than ID), while the *-mark and
+ * *-mark-start classes should instantiate the apporpiate subclasses.
+ */
+class XMLIndexMarkImportContext_Impl : public SvXMLImportContext
+{
+ const OUString sAlternativeText;
+
+ XMLHints_Impl& rHints;
+ const enum XMLTextPElemTokens eToken;
+ OUString sID;
+
+public:
+ TYPEINFO();
+
+ XMLIndexMarkImportContext_Impl(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ enum XMLTextPElemTokens nTok,
+ XMLHints_Impl& rHnts);
+
+ void StartElement(const Reference<xml::sax::XAttributeList> & xAttrList);
+
+protected:
+
+ /// process all attributes
+ void ProcessAttributes(const Reference<xml::sax::XAttributeList> & xAttrList,
+ Reference<beans::XPropertySet>& rPropSet);
+
+ /**
+ * All marks can be created immediatly. Since we don't care about
+ * the element content, ProcessAttribute should set the properties
+ * immediatly.
+ *
+ * This method tolerates an empty PropertySet; subclasses however
+ * are not expected to.
+ */
+ virtual void ProcessAttribute(sal_uInt16 nNamespace,
+ OUString sLocalName,
+ OUString sValue,
+ Reference<beans::XPropertySet>& rPropSet);
+
+ static void GetServiceName(OUString& sServiceName,
+ enum XMLTextPElemTokens nToken);
+
+ sal_Bool CreateMark(Reference<beans::XPropertySet>& rPropSet,
+ const OUString& rServiceName);
+};
+
+
+TYPEINIT1( XMLIndexMarkImportContext_Impl, SvXMLImportContext );
+
+XMLIndexMarkImportContext_Impl::XMLIndexMarkImportContext_Impl(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ enum XMLTextPElemTokens eTok,
+ XMLHints_Impl& rHnts) :
+ SvXMLImportContext(rImport, nPrefix, rLocalName),
+ sAlternativeText(RTL_CONSTASCII_USTRINGPARAM("AlternativeText")),
+ rHints(rHnts),
+ eToken(eTok)
+{
+}
+
+void XMLIndexMarkImportContext_Impl::StartElement(
+ const Reference<xml::sax::XAttributeList> & xAttrList)
+{
+ // get Cursor position (needed for all cases)
+ Reference<XTextRange> xPos(
+ GetImport().GetTextImport()->GetCursor()->getStart());
+ Reference<beans::XPropertySet> xMark;
+
+ switch (eToken)
+ {
+ case XML_TOK_TEXT_TOC_MARK:
+ case XML_TOK_TEXT_USER_INDEX_MARK:
+ case XML_TOK_TEXT_ALPHA_INDEX_MARK:
+ {
+ // single mark: create mark and insert
+ OUString sService;
+ GetServiceName(sService, eToken);
+ if (CreateMark(xMark, sService))
+ {
+ ProcessAttributes(xAttrList, xMark);
+ XMLHint_Impl* pHint = new XMLIndexMarkHint_Impl(xMark, xPos);
+ rHints.Insert(pHint, rHints.Count());
+ }
+ // else: can't create mark -> ignore
+ break;
+ }
+
+ case XML_TOK_TEXT_TOC_MARK_START:
+ case XML_TOK_TEXT_USER_INDEX_MARK_START:
+ case XML_TOK_TEXT_ALPHA_INDEX_MARK_START:
+ {
+ // start: create mark and insert (if ID is found)
+ OUString sService;
+ GetServiceName(sService, eToken);
+ if (CreateMark(xMark, sService))
+ {
+ ProcessAttributes(xAttrList, xMark);
+ if (sID.getLength() > 0)
+ {
+ // process only if we find an ID
+ XMLHint_Impl* pHint =
+ new XMLIndexMarkHint_Impl(xMark, xPos, sID);
+ rHints.Insert(pHint, rHints.Count());
+ }
+ // else: no ID -> we'll never find the end -> ignore
+ }
+ // else: can't create mark -> ignore
+ break;
+ }
+
+ case XML_TOK_TEXT_TOC_MARK_END:
+ case XML_TOK_TEXT_USER_INDEX_MARK_END:
+ case XML_TOK_TEXT_ALPHA_INDEX_MARK_END:
+ {
+ // end: search for ID and set end of mark
+
+ // call process attributes with empty XPropertySet:
+ ProcessAttributes(xAttrList, xMark);
+ if (sID.getLength() > 0)
+ {
+ // if we have an ID, find the hint and set the end position
+ sal_uInt16 nCount = rHints.Count();
+ for(sal_uInt16 nPos = 0; nPos < nCount; nPos++)
+ {
+ XMLHint_Impl *pHint = rHints[nPos];
+ if ( pHint->IsIndexMark() &&
+ sID.equals(
+ ((XMLIndexMarkHint_Impl *)pHint)->GetID()) )
+ {
+ // set end and stop searching
+ pHint->SetEnd(xPos);
+ break;
+ }
+ }
+ }
+ // else: no ID -> ignore
+ break;
+ }
+
+ default:
+ OSL_FAIL("unknown index mark type!");
+ break;
+ }
+}
+
+void XMLIndexMarkImportContext_Impl::ProcessAttributes(
+ const Reference<xml::sax::XAttributeList> & xAttrList,
+ Reference<beans::XPropertySet>& rPropSet)
+{
+ // process attributes
+ sal_Int16 nLength = xAttrList->getLength();
+ for(sal_Int16 i=0; i<nLength; i++)
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(i), &sLocalName );
+
+ ProcessAttribute(nPrefix, sLocalName,
+ xAttrList->getValueByIndex(i),
+ rPropSet);
+ }
+}
+
+void XMLIndexMarkImportContext_Impl::ProcessAttribute(
+ sal_uInt16 nNamespace,
+ OUString sLocalName,
+ OUString sValue,
+ Reference<beans::XPropertySet>& rPropSet)
+{
+ // we only know ID + string-value attribute;
+ // (former: marks, latter: -start + -end-marks)
+ // the remainder is handled in sub-classes
+ switch (eToken)
+ {
+ case XML_TOK_TEXT_TOC_MARK:
+ case XML_TOK_TEXT_USER_INDEX_MARK:
+ case XML_TOK_TEXT_ALPHA_INDEX_MARK:
+ if ( (XML_NAMESPACE_TEXT == nNamespace) &&
+ IsXMLToken( sLocalName, XML_STRING_VALUE ) )
+ {
+ rPropSet->setPropertyValue(sAlternativeText, uno::makeAny(sValue));
+ }
+ // else: ignore!
+ break;
+
+ case XML_TOK_TEXT_TOC_MARK_START:
+ case XML_TOK_TEXT_USER_INDEX_MARK_START:
+ case XML_TOK_TEXT_ALPHA_INDEX_MARK_START:
+ case XML_TOK_TEXT_TOC_MARK_END:
+ case XML_TOK_TEXT_USER_INDEX_MARK_END:
+ case XML_TOK_TEXT_ALPHA_INDEX_MARK_END:
+ if ( (XML_NAMESPACE_TEXT == nNamespace) &&
+ IsXMLToken( sLocalName, XML_ID ) )
+ {
+ sID = sValue;
+ }
+ // else: ignore
+ break;
+
+ default:
+ OSL_FAIL("unknown index mark type!");
+ break;
+ }
+}
+
+static const sal_Char sAPI_com_sun_star_text_ContentIndexMark[] =
+ "com.sun.star.text.ContentIndexMark";
+static const sal_Char sAPI_com_sun_star_text_UserIndexMark[] =
+ "com.sun.star.text.UserIndexMark";
+static const sal_Char sAPI_com_sun_star_text_DocumentIndexMark[] =
+ "com.sun.star.text.DocumentIndexMark";
+
+
+void XMLIndexMarkImportContext_Impl::GetServiceName(
+ OUString& sServiceName,
+ enum XMLTextPElemTokens eToken)
+{
+ switch (eToken)
+ {
+ case XML_TOK_TEXT_TOC_MARK:
+ case XML_TOK_TEXT_TOC_MARK_START:
+ case XML_TOK_TEXT_TOC_MARK_END:
+ {
+ OUString sTmp(RTL_CONSTASCII_USTRINGPARAM(
+ sAPI_com_sun_star_text_ContentIndexMark));
+ sServiceName = sTmp;
+ break;
+ }
+
+ case XML_TOK_TEXT_USER_INDEX_MARK:
+ case XML_TOK_TEXT_USER_INDEX_MARK_START:
+ case XML_TOK_TEXT_USER_INDEX_MARK_END:
+ {
+ OUString sTmp(RTL_CONSTASCII_USTRINGPARAM(
+ sAPI_com_sun_star_text_UserIndexMark));
+ sServiceName = sTmp;
+ break;
+ }
+
+ case XML_TOK_TEXT_ALPHA_INDEX_MARK:
+ case XML_TOK_TEXT_ALPHA_INDEX_MARK_START:
+ case XML_TOK_TEXT_ALPHA_INDEX_MARK_END:
+ {
+ OUString sTmp(RTL_CONSTASCII_USTRINGPARAM(
+ sAPI_com_sun_star_text_DocumentIndexMark));
+ sServiceName = sTmp;
+ break;
+ }
+
+ default:
+ {
+ OSL_FAIL("unknown index mark type!");
+ OUString sTmp;
+ sServiceName = sTmp;
+ break;
+ }
+ }
+}
+
+
+sal_Bool XMLIndexMarkImportContext_Impl::CreateMark(
+ Reference<beans::XPropertySet>& rPropSet,
+ const OUString& rServiceName)
+{
+ Reference<lang::XMultiServiceFactory>
+ xFactory(GetImport().GetModel(), UNO_QUERY);
+
+ if( xFactory.is() )
+ {
+ Reference<beans::XPropertySet> xPropSet( xFactory->createInstance(rServiceName), UNO_QUERY );
+ if (xPropSet.is())
+ rPropSet = xPropSet;
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+
+class XMLTOCMarkImportContext_Impl : public XMLIndexMarkImportContext_Impl
+{
+ const OUString sLevel;
+
+public:
+ TYPEINFO();
+
+ XMLTOCMarkImportContext_Impl(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ enum XMLTextPElemTokens nTok,
+ XMLHints_Impl& rHnts);
+
+protected:
+
+ /** process outline level */
+ virtual void ProcessAttribute(sal_uInt16 nNamespace,
+ OUString sLocalName,
+ OUString sValue,
+ Reference<beans::XPropertySet>& rPropSet);
+};
+
+TYPEINIT1( XMLTOCMarkImportContext_Impl, XMLIndexMarkImportContext_Impl );
+
+
+XMLTOCMarkImportContext_Impl::XMLTOCMarkImportContext_Impl(
+ SvXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLocalName,
+ enum XMLTextPElemTokens nTok, XMLHints_Impl& rHnts) :
+ XMLIndexMarkImportContext_Impl(rImport, nPrefix, rLocalName,
+ nTok, rHnts),
+ sLevel(RTL_CONSTASCII_USTRINGPARAM("Level"))
+{
+}
+
+void XMLTOCMarkImportContext_Impl::ProcessAttribute(
+ sal_uInt16 nNamespace,
+ OUString sLocalName,
+ OUString sValue,
+ Reference<beans::XPropertySet>& rPropSet)
+{
+ DBG_ASSERT(rPropSet.is(), "need PropertySet");
+
+ if ((XML_NAMESPACE_TEXT == nNamespace) &&
+ IsXMLToken( sLocalName, XML_OUTLINE_LEVEL ) )
+ {
+ // ouline level: set Level property
+ sal_Int32 nTmp;
+ if ( SvXMLUnitConverter::convertNumber( nTmp, sValue )
+ && nTmp >= 1
+ && nTmp < GetImport().GetTextImport()->
+ GetChapterNumbering()->getCount() )
+ {
+ rPropSet->setPropertyValue(sLevel, uno::makeAny((sal_Int16)(nTmp - 1)));
+ }
+ // else: value out of range -> ignore
+ }
+ else
+ {
+ // else: delegate to superclass
+ XMLIndexMarkImportContext_Impl::ProcessAttribute(
+ nNamespace, sLocalName, sValue, rPropSet);
+ }
+}
+
+class XMLUserIndexMarkImportContext_Impl : public XMLIndexMarkImportContext_Impl
+{
+ const OUString sUserIndexName;
+ const OUString sLevel;
+
+public:
+ TYPEINFO();
+
+ XMLUserIndexMarkImportContext_Impl(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ enum XMLTextPElemTokens nTok,
+ XMLHints_Impl& rHnts);
+
+protected:
+
+ /** process index name */
+ virtual void ProcessAttribute(sal_uInt16 nNamespace,
+ OUString sLocalName,
+ OUString sValue,
+ Reference<beans::XPropertySet>& rPropSet);
+};
+
+TYPEINIT1( XMLUserIndexMarkImportContext_Impl, XMLIndexMarkImportContext_Impl);
+
+XMLUserIndexMarkImportContext_Impl::XMLUserIndexMarkImportContext_Impl(
+ SvXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLocalName,
+ enum XMLTextPElemTokens nTok, XMLHints_Impl& rHnts) :
+ XMLIndexMarkImportContext_Impl(rImport, nPrefix, rLocalName,
+ nTok, rHnts),
+ sUserIndexName(RTL_CONSTASCII_USTRINGPARAM("UserIndexName")),
+ sLevel(RTL_CONSTASCII_USTRINGPARAM("Level"))
+{
+}
+
+void XMLUserIndexMarkImportContext_Impl::ProcessAttribute(
+ sal_uInt16 nNamespace, OUString sLocalName, OUString sValue,
+ Reference<beans::XPropertySet>& rPropSet)
+{
+ if ( XML_NAMESPACE_TEXT == nNamespace )
+ {
+ if ( IsXMLToken( sLocalName, XML_INDEX_NAME ) )
+ {
+ rPropSet->setPropertyValue(sUserIndexName, uno::makeAny(sValue));
+ }
+ else if ( IsXMLToken( sLocalName, XML_OUTLINE_LEVEL ) )
+ {
+ // ouline level: set Level property
+ sal_Int32 nTmp;
+ if (SvXMLUnitConverter::convertNumber(
+ nTmp, sValue, 0,
+ GetImport().GetTextImport()->GetChapterNumbering()->getCount()))
+ {
+ rPropSet->setPropertyValue(sLevel, uno::makeAny(static_cast<sal_Int16>(nTmp - 1)));
+ }
+ // else: value out of range -> ignore
+ }
+ else
+ {
+ // else: unknown text property: delegate to super class
+ XMLIndexMarkImportContext_Impl::ProcessAttribute(
+ nNamespace, sLocalName, sValue, rPropSet);
+ }
+ }
+ else
+ {
+ // else: unknown namespace: delegate to super class
+ XMLIndexMarkImportContext_Impl::ProcessAttribute(
+ nNamespace, sLocalName, sValue, rPropSet);
+ }
+}
+
+
+class XMLAlphaIndexMarkImportContext_Impl : public XMLIndexMarkImportContext_Impl
+{
+ const OUString sPrimaryKey;
+ const OUString sSecondaryKey;
+ const OUString sTextReading;
+ const OUString sPrimaryKeyReading;
+ const OUString sSecondaryKeyReading;
+ const OUString sMainEntry;
+
+public:
+ TYPEINFO();
+
+ XMLAlphaIndexMarkImportContext_Impl(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ enum XMLTextPElemTokens nTok,
+ XMLHints_Impl& rHnts);
+
+protected:
+
+ /** process primary + secondary keys */
+ virtual void ProcessAttribute(sal_uInt16 nNamespace,
+ OUString sLocalName,
+ OUString sValue,
+ Reference<beans::XPropertySet>& rPropSet);
+};
+
+TYPEINIT1( XMLAlphaIndexMarkImportContext_Impl,
+ XMLIndexMarkImportContext_Impl );
+
+XMLAlphaIndexMarkImportContext_Impl::XMLAlphaIndexMarkImportContext_Impl(
+ SvXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLocalName,
+ enum XMLTextPElemTokens nTok, XMLHints_Impl& rHnts) :
+ XMLIndexMarkImportContext_Impl(rImport, nPrefix, rLocalName,
+ nTok, rHnts),
+ sPrimaryKey(RTL_CONSTASCII_USTRINGPARAM("PrimaryKey")),
+ sSecondaryKey(RTL_CONSTASCII_USTRINGPARAM("SecondaryKey")),
+ sTextReading(RTL_CONSTASCII_USTRINGPARAM("TextReading")),
+ sPrimaryKeyReading(RTL_CONSTASCII_USTRINGPARAM("PrimaryKeyReading")),
+ sSecondaryKeyReading(RTL_CONSTASCII_USTRINGPARAM("SecondaryKeyReading")),
+ sMainEntry(RTL_CONSTASCII_USTRINGPARAM("IsMainEntry"))
+{
+}
+
+void XMLAlphaIndexMarkImportContext_Impl::ProcessAttribute(
+ sal_uInt16 nNamespace, OUString sLocalName, OUString sValue,
+ Reference<beans::XPropertySet>& rPropSet)
+{
+ if (XML_NAMESPACE_TEXT == nNamespace)
+ {
+ if ( IsXMLToken( sLocalName, XML_KEY1 ) )
+ {
+ rPropSet->setPropertyValue(sPrimaryKey, uno::makeAny(sValue));
+ }
+ else if ( IsXMLToken( sLocalName, XML_KEY2 ) )
+ {
+ rPropSet->setPropertyValue(sSecondaryKey, uno::makeAny(sValue));
+ }
+ else if ( IsXMLToken( sLocalName, XML_KEY1_PHONETIC ) )
+ {
+ rPropSet->setPropertyValue(sPrimaryKeyReading, uno::makeAny(sValue));
+ }
+ else if ( IsXMLToken( sLocalName, XML_KEY2_PHONETIC ) )
+ {
+ rPropSet->setPropertyValue(sSecondaryKeyReading, uno::makeAny(sValue));
+ }
+ else if ( IsXMLToken( sLocalName, XML_STRING_VALUE_PHONETIC ) )
+ {
+ rPropSet->setPropertyValue(sTextReading, uno::makeAny(sValue));
+ }
+ else if ( IsXMLToken( sLocalName, XML_MAIN_ENTRY ) )
+ {
+ sal_Bool bMainEntry = sal_False;
+ bool bTmp;
+
+ if (SvXMLUnitConverter::convertBool(bTmp, sValue))
+ bMainEntry = bTmp;
+
+ rPropSet->setPropertyValue(sMainEntry, uno::makeAny(bMainEntry));
+ }
+ else
+ {
+ XMLIndexMarkImportContext_Impl::ProcessAttribute(
+ nNamespace, sLocalName, sValue, rPropSet);
+ }
+ }
+ else
+ {
+ XMLIndexMarkImportContext_Impl::ProcessAttribute(
+ nNamespace, sLocalName, sValue, rPropSet);
+ }
+}
+
+
+// ---------------------------------------------------------------------
+
+TYPEINIT1( XMLImpSpanContext_Impl, SvXMLImportContext );
+
+XMLImpSpanContext_Impl::XMLImpSpanContext_Impl(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const Reference< xml::sax::XAttributeList > & xAttrList,
+ XMLHints_Impl& rHnts,
+ sal_Bool& rIgnLeadSpace
+ ,sal_uInt8 nSFConvFlags
+ )
+: SvXMLImportContext( rImport, nPrfx, rLName )
+, sTextFrame(RTL_CONSTASCII_USTRINGPARAM("TextFrame"))
+, rHints( rHnts )
+, pHint( 0 )
+, rIgnoreLeadingSpace( rIgnLeadSpace )
+, nStarFontsConvFlags( nSFConvFlags & (CONV_FROM_STAR_BATS|CONV_FROM_STAR_MATH) )
+{
+ OUString aStyleName;
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ if( XML_NAMESPACE_TEXT == nPrefix &&
+ IsXMLToken( aLocalName, XML_STYLE_NAME ) )
+ aStyleName = xAttrList->getValueByIndex( i );
+ }
+
+ if( aStyleName.getLength() )
+ {
+ pHint = new XMLStyleHint_Impl( aStyleName,
+ GetImport().GetTextImport()->GetCursorAsRange()->getStart() );
+ rHints.Insert( pHint, rHints.Count() );
+ }
+}
+
+XMLImpSpanContext_Impl::~XMLImpSpanContext_Impl()
+{
+ if( pHint )
+ pHint->SetEnd( GetImport().GetTextImport()
+ ->GetCursorAsRange()->getStart() );
+}
+
+SvXMLImportContext *XMLImpSpanContext_Impl::CreateChildContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix, const OUString& rLocalName,
+ const Reference< xml::sax::XAttributeList > & xAttrList,
+ sal_uInt16 nToken,
+ XMLHints_Impl& rHints,
+ sal_Bool& rIgnoreLeadingSpace
+ ,sal_uInt8 nStarFontsConvFlags
+ )
+{
+ SvXMLImportContext *pContext = 0;
+
+ switch( nToken )
+ {
+ case XML_TOK_TEXT_SPAN:
+ pContext = new XMLImpSpanContext_Impl( rImport, nPrefix,
+ rLocalName, xAttrList,
+ rHints,
+ rIgnoreLeadingSpace
+ ,nStarFontsConvFlags
+ );
+ break;
+
+ case XML_TOK_TEXT_TAB_STOP:
+ pContext = new XMLCharContext( rImport, nPrefix,
+ rLocalName, xAttrList,
+ 0x0009, sal_False );
+ rIgnoreLeadingSpace = sal_False;
+ break;
+
+ case XML_TOK_TEXT_LINE_BREAK:
+ pContext = new XMLCharContext( rImport, nPrefix,
+ rLocalName, xAttrList,
+ ControlCharacter::LINE_BREAK );
+ rIgnoreLeadingSpace = sal_False;
+ break;
+
+ case XML_TOK_TEXT_S:
+ pContext = new XMLCharContext( rImport, nPrefix,
+ rLocalName, xAttrList,
+ 0x0020, sal_True );
+ break;
+
+ case XML_TOK_TEXT_HYPERLINK:
+ {
+ // test for HyperLinkURL property. If present, insert link as
+ // text property (StarWriter), else try to insert as text
+ // field (StarCalc, StarDraw, ...)
+ Reference<beans::XPropertySet> xPropSet(
+ rImport.GetTextImport()->GetCursor(),
+ UNO_QUERY );
+
+ const OUString sHyperLinkURL(
+ RTL_CONSTASCII_USTRINGPARAM("HyperLinkURL"));
+
+ if (xPropSet->getPropertySetInfo()->hasPropertyByName(sHyperLinkURL))
+ {
+ pContext = new XMLImpHyperlinkContext_Impl( rImport, nPrefix,
+ rLocalName, xAttrList,
+ rHints,
+ rIgnoreLeadingSpace );
+ }
+ else
+ {
+ pContext = new XMLUrlFieldImportContext( rImport,
+ *rImport.GetTextImport().get(),
+ nPrefix, rLocalName);
+ //whitespace handling like other fields
+ rIgnoreLeadingSpace = sal_False;
+
+ }
+ break;
+ }
+
+ case XML_TOK_TEXT_RUBY:
+ pContext = new XMLImpRubyContext_Impl( rImport, nPrefix,
+ rLocalName, xAttrList,
+ rHints,
+ rIgnoreLeadingSpace );
+ break;
+
+ case XML_TOK_TEXT_NOTE:
+ if (rImport.GetTextImport()->IsInFrame())
+ {
+ // we must not insert footnotes into text frames
+ pContext = new SvXMLImportContext( rImport, nPrefix,
+ rLocalName );
+ }
+ else
+ {
+ pContext = new XMLFootnoteImportContext( rImport,
+ *rImport.GetTextImport().get(),
+ nPrefix, rLocalName );
+ }
+ rIgnoreLeadingSpace = sal_False;
+ break;
+
+ case XML_TOK_TEXT_REFERENCE:
+ case XML_TOK_TEXT_BOOKMARK:
+ case XML_TOK_TEXT_BOOKMARK_START:
+ case XML_TOK_TEXT_BOOKMARK_END:
+ pContext = new XMLTextMarkImportContext( rImport,
+ *rImport.GetTextImport().get(),
+ nPrefix, rLocalName );
+ break;
+
+ case XML_TOK_TEXT_FIELDMARK:
+ case XML_TOK_TEXT_FIELDMARK_START:
+ case XML_TOK_TEXT_FIELDMARK_END:
+ pContext = new XMLTextMarkImportContext( rImport,
+ *rImport.GetTextImport().get(),
+ nPrefix, rLocalName );
+ break;
+
+ case XML_TOK_TEXT_REFERENCE_START:
+ pContext = new XMLStartReferenceContext_Impl( rImport,
+ nPrefix, rLocalName,
+ rHints, xAttrList );
+ break;
+
+ case XML_TOK_TEXT_REFERENCE_END:
+ pContext = new XMLEndReferenceContext_Impl( rImport,
+ nPrefix, rLocalName,
+ rHints, xAttrList );
+ break;
+
+ case XML_TOK_TEXT_FRAME:
+ {
+ Reference < XTextRange > xAnchorPos =
+ rImport.GetTextImport()->GetCursor()->getStart();
+ XMLTextFrameContext *pTextFrameContext =
+ new XMLTextFrameContext( rImport, nPrefix,
+ rLocalName, xAttrList,
+ TextContentAnchorType_AS_CHARACTER );
+ // Remove check for text content. (#i33242#)
+ // Check for text content is done on the processing of the hint
+ if( TextContentAnchorType_AT_CHARACTER ==
+ pTextFrameContext->GetAnchorType() )
+ {
+ rHints.Insert( new XMLTextFrameHint_Impl(
+ pTextFrameContext, xAnchorPos ),
+ rHints.Count() );
+ }
+ pContext = pTextFrameContext;
+ rIgnoreLeadingSpace = sal_False;
+ }
+ break;
+ case XML_TOK_DRAW_A:
+ {
+ Reference < XTextRange > xAnchorPos(rImport.GetTextImport()->GetCursor()->getStart());
+ pContext =
+ new XMLTextFrameHyperlinkContext( rImport, nPrefix,
+ rLocalName, xAttrList,
+ TextContentAnchorType_AS_CHARACTER );
+ XMLTextFrameHint_Impl *pHint =
+ new XMLTextFrameHint_Impl( pContext, xAnchorPos);
+ rHints.Insert( pHint, rHints.Count() );
+ }
+ break;
+
+ case XML_TOK_TEXT_TOC_MARK:
+ case XML_TOK_TEXT_TOC_MARK_START:
+ pContext = new XMLTOCMarkImportContext_Impl(
+ rImport, nPrefix, rLocalName,
+ (enum XMLTextPElemTokens)nToken, rHints);
+ break;
+
+ case XML_TOK_TEXT_USER_INDEX_MARK:
+ case XML_TOK_TEXT_USER_INDEX_MARK_START:
+ pContext = new XMLUserIndexMarkImportContext_Impl(
+ rImport, nPrefix, rLocalName,
+ (enum XMLTextPElemTokens)nToken, rHints);
+ break;
+
+ case XML_TOK_TEXT_ALPHA_INDEX_MARK:
+ case XML_TOK_TEXT_ALPHA_INDEX_MARK_START:
+ pContext = new XMLAlphaIndexMarkImportContext_Impl(
+ rImport, nPrefix, rLocalName,
+ (enum XMLTextPElemTokens)nToken, rHints);
+ break;
+
+ case XML_TOK_TEXT_TOC_MARK_END:
+ case XML_TOK_TEXT_USER_INDEX_MARK_END:
+ case XML_TOK_TEXT_ALPHA_INDEX_MARK_END:
+ pContext = new XMLIndexMarkImportContext_Impl(
+ rImport, nPrefix, rLocalName, (enum XMLTextPElemTokens)nToken,
+ rHints);
+ break;
+
+ case XML_TOK_TEXTP_CHANGE_START:
+ case XML_TOK_TEXTP_CHANGE_END:
+ case XML_TOK_TEXTP_CHANGE:
+ pContext = new XMLChangeImportContext(
+ rImport, nPrefix, rLocalName,
+ (nToken != XML_TOK_TEXTP_CHANGE_END),
+ (nToken != XML_TOK_TEXTP_CHANGE_START),
+ sal_False);
+ break;
+
+ case XML_TOK_TEXT_META:
+ pContext = new XMLMetaImportContext(rImport, nPrefix, rLocalName,
+ rHints, rIgnoreLeadingSpace );
+ break;
+
+ case XML_TOK_TEXT_META_FIELD:
+ pContext = new XMLMetaFieldImportContext(rImport, nPrefix, rLocalName,
+ rHints, rIgnoreLeadingSpace );
+ break;
+
+ default:
+ // none of the above? then it's probably a text field!
+ pContext =
+ XMLTextFieldImportContext::CreateTextFieldImportContext(
+ rImport, *rImport.GetTextImport().get(), nPrefix, rLocalName,
+ nToken);
+ // #108784# import draw elements (except control shapes in headers)
+ if( pContext == NULL &&
+ !( rImport.GetTextImport()->IsInHeaderFooter() &&
+ nPrefix == XML_NAMESPACE_DRAW &&
+ IsXMLToken( rLocalName, XML_CONTROL ) ) )
+ {
+ Reference < XShapes > xShapes;
+ SvXMLShapeContext* pShapeContext = rImport.GetShapeImport()->CreateGroupChildContext(
+ rImport, nPrefix, rLocalName, xAttrList, xShapes );
+ pContext = pShapeContext;
+ // OD 2004-04-20 #i26791# - keep shape in a text frame hint to
+ // adjust its anchor position, if its at-character anchored
+ Reference < XTextRange > xAnchorPos =
+ rImport.GetTextImport()->GetCursor()->getStart();
+ rHints.Insert( new XMLDrawHint_Impl( pShapeContext, xAnchorPos ),
+ rHints.Count() );
+ }
+ if( !pContext )
+ {
+ // ignore unknown content
+ pContext =
+ new SvXMLImportContext( rImport, nPrefix, rLocalName );
+ }
+ // Behind fields, shapes and any unknown content blanks aren't ignored
+ rIgnoreLeadingSpace = sal_False;
+ }
+
+ return pContext;
+}
+
+SvXMLImportContext *XMLImpSpanContext_Impl::CreateChildContext(
+ sal_uInt16 nPrefix, const OUString& rLocalName,
+ const Reference< xml::sax::XAttributeList > & xAttrList )
+{
+ const SvXMLTokenMap& rTokenMap =
+ GetImport().GetTextImport()->GetTextPElemTokenMap();
+ sal_uInt16 nToken = rTokenMap.Get( nPrefix, rLocalName );
+
+ return CreateChildContext( GetImport(), nPrefix, rLocalName, xAttrList,
+ nToken, rHints, rIgnoreLeadingSpace
+ ,nStarFontsConvFlags
+ );
+}
+
+void XMLImpSpanContext_Impl::Characters( const OUString& rChars )
+{
+ OUString sStyleName;
+ if( pHint )
+ sStyleName = pHint->GetStyleName();
+ OUString sChars =
+ GetImport().GetTextImport()->ConvertStarFonts( rChars, sStyleName,
+ nStarFontsConvFlags,
+ sal_False, GetImport() );
+ GetImport().GetTextImport()->InsertString( sChars, rIgnoreLeadingSpace );
+}
+
+// ---------------------------------------------------------------------
+
+TYPEINIT1( XMLParaContext, SvXMLImportContext );
+
+XMLParaContext::XMLParaContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const Reference< xml::sax::XAttributeList > & xAttrList,
+ sal_Bool bHead ) :
+ SvXMLImportContext( rImport, nPrfx, rLName ),
+ xStart( rImport.GetTextImport()->GetCursorAsRange()->getStart() ),
+ m_bHaveAbout(false),
+ nOutlineLevel( IsXMLToken( rLName, XML_H ) ? 1 : -1 ),
+ pHints( 0 ),
+ // Lost outline numbering in master document (#i73509#)
+ mbOutlineLevelAttrFound( sal_False ),
+ bIgnoreLeadingSpace( sal_True ),
+ bHeading( bHead ),
+ bIsListHeader( false ),
+ bIsRestart (false),
+ nStartValue(0),
+ nStarFontsConvFlags( 0 )
+{
+ const SvXMLTokenMap& rTokenMap =
+ GetImport().GetTextImport()->GetTextPAttrTokenMap();
+
+ bool bHaveXmlId( false );
+ OUString aCondStyleName, sClassNames;
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ const OUString& rValue = xAttrList->getValueByIndex( i );
+
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ switch( rTokenMap.Get( nPrefix, aLocalName ) )
+ {
+ case XML_TOK_TEXT_P_XMLID:
+ m_sXmlId = rValue;
+ bHaveXmlId = true;
+ break;
+ case XML_TOK_TEXT_P_ABOUT:
+ m_sAbout = rValue;
+ m_bHaveAbout = true;
+ break;
+ case XML_TOK_TEXT_P_PROPERTY:
+ m_sProperty = rValue;
+ break;
+ case XML_TOK_TEXT_P_CONTENT:
+ m_sContent = rValue;
+ break;
+ case XML_TOK_TEXT_P_DATATYPE:
+ m_sDatatype = rValue;
+ break;
+ case XML_TOK_TEXT_P_TEXTID:
+ if (!bHaveXmlId) { m_sXmlId = rValue; }
+ break;
+ case XML_TOK_TEXT_P_STYLE_NAME:
+ sStyleName = rValue;
+ break;
+ case XML_TOK_TEXT_P_CLASS_NAMES:
+ sClassNames = rValue;
+ break;
+ case XML_TOK_TEXT_P_COND_STYLE_NAME:
+ aCondStyleName = rValue;
+ break;
+ case XML_TOK_TEXT_P_LEVEL:
+ {
+ sal_Int32 nTmp = rValue.toInt32();
+ if( nTmp > 0L )
+ {
+ if( nTmp > 127 )
+ nTmp = 127;
+ nOutlineLevel = (sal_Int8)nTmp;
+ }
+ // Lost outline numbering in master document (#i73509#)
+ mbOutlineLevelAttrFound = sal_True;
+ }
+ break;
+ case XML_TOK_TEXT_P_IS_LIST_HEADER:
+ {
+ bool bBool;
+ if( SvXMLUnitConverter::convertBool( bBool, rValue ) )
+ {
+ bIsListHeader = bBool;
+ }
+ }
+ break;
+ case XML_TOK_TEXT_P_RESTART_NUMBERING:
+ {
+ bool bBool;
+ if (SvXMLUnitConverter::convertBool(bBool, rValue))
+ {
+ bIsRestart = bBool;
+ }
+ }
+ break;
+ case XML_TOK_TEXT_P_START_VALUE:
+ {
+ nStartValue = sal::static_int_cast< sal_Int16 >(
+ rValue.toInt32());
+ }
+ break;
+ }
+ }
+
+ if( aCondStyleName.getLength() )
+ sStyleName = aCondStyleName;
+ else if( sClassNames.getLength() )
+ {
+ sal_Int32 nDummy = 0;
+ sStyleName = sClassNames.getToken( 0, ' ', nDummy );
+ }
+}
+
+XMLParaContext::~XMLParaContext()
+{
+ UniReference < XMLTextImportHelper > xTxtImport(
+ GetImport().GetTextImport());
+ Reference < XTextRange > xCrsrRange( xTxtImport->GetCursorAsRange() );
+ if( !xCrsrRange.is() )
+ return; // Robust (defect file)
+ Reference < XTextRange > xEnd(xCrsrRange->getStart());
+
+ // if we have an id set for this paragraph, get a cursor for this
+ // paragraph and register it with the given identifier
+ // FIXME: this is just temporary, and should be removed when
+ // EditEngine paragraphs implement XMetadatable!
+ if (m_sXmlId.getLength())
+ {
+ Reference < XTextCursor > xIdCursor( xTxtImport->GetText()->createTextCursorByRange( xStart ) );
+ if( xIdCursor.is() )
+ {
+ xIdCursor->gotoRange( xEnd, sal_True );
+ Reference< XInterface > xRef( xIdCursor, UNO_QUERY );
+ GetImport().getInterfaceToIdentifierMapper().registerReference(
+ m_sXmlId, xRef);
+ }
+ }
+
+ // insert a paragraph break
+ xTxtImport->InsertControlCharacter( ControlCharacter::APPEND_PARAGRAPH );
+
+ // create a cursor that select the whole last paragraph
+ Reference < XTextCursor > xAttrCursor(
+ xTxtImport->GetText()->createTextCursorByRange( xStart ));
+ if( !xAttrCursor.is() )
+ return; // Robust (defect file)
+ xAttrCursor->gotoRange( xEnd, sal_True );
+
+ // xml:id for RDF metadata
+ if (m_sXmlId.getLength() || m_bHaveAbout || m_sProperty.getLength())
+ {
+ try {
+ const uno::Reference<container::XEnumerationAccess> xEA
+ (xAttrCursor, uno::UNO_QUERY_THROW);
+ const uno::Reference<container::XEnumeration> xEnum(
+ xEA->createEnumeration(), uno::UNO_QUERY_THROW);
+ OSL_ENSURE(xEnum->hasMoreElements(), "xml:id: no paragraph?");
+ if (xEnum->hasMoreElements()) {
+ uno::Reference<rdf::XMetadatable> xMeta;
+ xEnum->nextElement() >>= xMeta;
+ OSL_ENSURE(xMeta.is(), "xml:id: not XMetadatable");
+ GetImport().SetXmlId(xMeta, m_sXmlId);
+ if (m_bHaveAbout)
+ {
+ GetImport().AddRDFa(xMeta,
+ m_sAbout, m_sProperty, m_sContent, m_sDatatype);
+ }
+ OSL_ENSURE(!xEnum->hasMoreElements(), "xml:id: > 1 paragraph?");
+ }
+ } catch (uno::Exception &) {
+ OSL_TRACE("XMLParaContext::~XMLParaContext: exception");
+ }
+ }
+
+ OUString const sCellParaStyleName(xTxtImport->GetCellParaStyleDefault());
+ if( sCellParaStyleName.getLength() > 0 )
+ {
+ /* Suppress handling of outline and list attributes,
+ because of side effects of method <SetStyleAndAttrs(..)> (#i80724#)
+ */
+ xTxtImport->SetStyleAndAttrs( GetImport(), xAttrCursor,
+ sCellParaStyleName,
+ sal_True,
+ sal_False, -1, // suppress outline handling
+ sal_False ); // suppress list attributes handling
+ }
+
+ // #103445# for headings without style name, find the proper style
+ if( bHeading && (sStyleName.getLength() == 0) )
+ xTxtImport->FindOutlineStyleName( sStyleName, nOutlineLevel );
+
+ // set style and hard attributes at the previous paragraph
+ // Add paramter <mbOutlineLevelAttrFound> (#i73509#)
+ sStyleName = xTxtImport->SetStyleAndAttrs( GetImport(), xAttrCursor,
+ sStyleName,
+ sal_True,
+ mbOutlineLevelAttrFound,
+ bHeading ? nOutlineLevel : -1 );
+
+ // handle list style header
+ if (bHeading && (bIsListHeader || bIsRestart))
+ {
+ Reference<XPropertySet> xPropSet( xAttrCursor, UNO_QUERY );
+
+ if (xPropSet.is())
+ {
+ if (bIsListHeader)
+ {
+ OUString sNumberingIsNumber
+ (RTL_CONSTASCII_USTRINGPARAM("NumberingIsNumber"));
+ if(xPropSet->getPropertySetInfo()->
+ hasPropertyByName(sNumberingIsNumber))
+ {
+ xPropSet->setPropertyValue
+ (sNumberingIsNumber, makeAny( false ) );
+ }
+ }
+ if (bIsRestart)
+ {
+ OUString sParaIsNumberingRestart
+ (RTL_CONSTASCII_USTRINGPARAM("ParaIsNumberingRestart"));
+ OUString sNumberingStartValue
+ (RTL_CONSTASCII_USTRINGPARAM("NumberingStartValue"));
+ if (xPropSet->getPropertySetInfo()->
+ hasPropertyByName(sParaIsNumberingRestart))
+ {
+ xPropSet->setPropertyValue
+ (sParaIsNumberingRestart, makeAny(true));
+ }
+
+ if (xPropSet->getPropertySetInfo()->
+ hasPropertyByName(sNumberingStartValue))
+ {
+ xPropSet->setPropertyValue
+ (sNumberingStartValue, makeAny(nStartValue));
+ }
+ }
+
+ }
+ }
+
+ if( pHints && pHints->Count() )
+ {
+ for( sal_uInt16 i=0; i<pHints->Count(); i++ )
+ {
+ XMLHint_Impl *pHint = (*pHints)[i];
+ xAttrCursor->gotoRange( pHint->GetStart(), sal_False );
+ xAttrCursor->gotoRange( pHint->GetEnd(), sal_True );
+ switch( pHint->GetType() )
+ {
+ case XML_HINT_STYLE:
+ {
+ const OUString& rStyleName =
+ ((XMLStyleHint_Impl *)pHint)->GetStyleName();
+ if( rStyleName.getLength() )
+ xTxtImport->SetStyleAndAttrs( GetImport(),
+ xAttrCursor, rStyleName,
+ sal_False );
+ }
+ break;
+ case XML_HINT_REFERENCE:
+ {
+ const OUString& rRefName =
+ ((XMLReferenceHint_Impl *)pHint)->GetRefName();
+ if( rRefName.getLength() )
+ {
+ if( !pHint->GetEnd().is() )
+ pHint->SetEnd(xEnd);
+
+ // convert XCursor to XTextRange
+ Reference<XTextRange> xRange(xAttrCursor, UNO_QUERY);
+
+ // reference name uses rStyleName member
+ // borrow from XMLTextMarkImportContext
+ XMLTextMarkImportContext::CreateAndInsertMark(
+ GetImport(),
+ OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.text.ReferenceMark")),
+ rRefName,
+ xRange);
+ }
+ }
+ break;
+ case XML_HINT_HYPERLINK:
+ {
+ const XMLHyperlinkHint_Impl *pHHint =
+ (const XMLHyperlinkHint_Impl *)pHint;
+ xTxtImport->SetHyperlink( GetImport(),
+ xAttrCursor,
+ pHHint->GetHRef(),
+ pHHint->GetName(),
+ pHHint->GetTargetFrameName(),
+ pHHint->GetStyleName(),
+ pHHint->GetVisitedStyleName(),
+ pHHint->GetEventsContext() );
+ }
+ break;
+ case XML_HINT_INDEX_MARK:
+ {
+ Reference<beans::XPropertySet> xMark(
+ ((const XMLIndexMarkHint_Impl *)pHint)->GetMark());
+ Reference<XTextContent> xContent(xMark, UNO_QUERY);
+ Reference<XTextRange> xRange(xAttrCursor, UNO_QUERY);
+ xTxtImport->GetText()->insertTextContent(
+ xRange, xContent, sal_True );
+ }
+ break;
+ case XML_HINT_TEXT_FRAME:
+ {
+ const XMLTextFrameHint_Impl *pFHint =
+ (const XMLTextFrameHint_Impl *)pHint;
+ // Check for text content (#i33242#)
+ Reference < XTextContent > xTextContent =
+ pFHint->GetTextContent();
+ if ( xTextContent.is() )
+ {
+ /* Core impl. of the unification of drawing objects and
+ Writer fly frames (#i26791#)
+ */
+ Reference<XTextRange> xRange(xAttrCursor, UNO_QUERY);
+ if ( pFHint->IsBoundAtChar() )
+ {
+ xTextContent->attach( xRange );
+ }
+ }
+ /* Consider, that hint can also contain a shape -
+ e.g. drawing object of type 'Text'. (#i33242#)
+ */
+ else
+ {
+ Reference < XShape > xShape = pFHint->GetShape();
+ if ( xShape.is() )
+ {
+ // determine anchor type
+ Reference < XPropertySet > xPropSet( xShape, UNO_QUERY );
+ TextContentAnchorType eAnchorType =
+ TextContentAnchorType_AT_PARAGRAPH;
+ {
+ OUString sAnchorType( RTL_CONSTASCII_USTRINGPARAM( "AnchorType" ) );
+ Any aAny = xPropSet->getPropertyValue( sAnchorType );
+ aAny >>= eAnchorType;
+ }
+ if ( TextContentAnchorType_AT_CHARACTER == eAnchorType )
+ {
+ // set anchor position for at-character anchored objects
+ Reference<XTextRange> xRange(xAttrCursor, UNO_QUERY);
+ Any aPos;
+ aPos <<= xRange;
+ OUString sTextRange( RTL_CONSTASCII_USTRINGPARAM( "TextRange" ) );
+ xPropSet->setPropertyValue(sTextRange, aPos);
+ }
+ }
+ }
+ }
+ break;
+ /* Core impl. of the unification of drawing objects and
+ Writer fly frames (#i26791#)
+ */
+ case XML_HINT_DRAW:
+ {
+ const XMLDrawHint_Impl *pDHint =
+ static_cast<const XMLDrawHint_Impl*>(pHint);
+ // Improvement: hint directly provides the shape. (#i33242#)
+ Reference < XShape > xShape = pDHint->GetShape();
+ if ( xShape.is() )
+ {
+ // determine anchor type
+ Reference < XPropertySet > xPropSet( xShape, UNO_QUERY );
+ TextContentAnchorType eAnchorType = TextContentAnchorType_AT_PARAGRAPH;
+ {
+ OUString sAnchorType( RTL_CONSTASCII_USTRINGPARAM( "AnchorType" ) );
+ Any aAny = xPropSet->getPropertyValue( sAnchorType );
+ aAny >>= eAnchorType;
+ }
+ if ( TextContentAnchorType_AT_CHARACTER == eAnchorType )
+ {
+ // set anchor position for at-character anchored objects
+ Reference<XTextRange> xRange(xAttrCursor, UNO_QUERY);
+ Any aPos;
+ aPos <<= xRange;
+ OUString sTextRange( RTL_CONSTASCII_USTRINGPARAM( "TextRange" ) );
+ xPropSet->setPropertyValue(sTextRange, aPos);
+ }
+ }
+ }
+ break;
+ default:
+ DBG_ASSERT( !this, "What's this" );
+ break;
+ }
+ }
+ }
+ delete pHints;
+}
+
+SvXMLImportContext *XMLParaContext::CreateChildContext(
+ sal_uInt16 nPrefix, const OUString& rLocalName,
+ const Reference< xml::sax::XAttributeList > & xAttrList )
+{
+ const SvXMLTokenMap& rTokenMap =
+ GetImport().GetTextImport()->GetTextPElemTokenMap();
+ sal_uInt16 nToken = rTokenMap.Get( nPrefix, rLocalName );
+ if( !pHints )
+ pHints = new XMLHints_Impl;
+ return XMLImpSpanContext_Impl::CreateChildContext(
+ GetImport(), nPrefix, rLocalName, xAttrList,
+ nToken, *pHints, bIgnoreLeadingSpace
+ , nStarFontsConvFlags
+ );
+}
+
+void XMLParaContext::Characters( const OUString& rChars )
+{
+ OUString sChars =
+ GetImport().GetTextImport()->ConvertStarFonts( rChars, sStyleName,
+ nStarFontsConvFlags,
+ sal_True, GetImport() );
+ GetImport().GetTextImport()->InsertString( sChars, bIgnoreLeadingSpace );
+}
+
+
+
+TYPEINIT1( XMLNumberedParaContext, SvXMLImportContext );
+
+XMLNumberedParaContext::XMLNumberedParaContext(
+ SvXMLImport& i_rImport,
+ sal_uInt16 i_nPrefix,
+ const OUString& i_rLocalName,
+ const Reference< xml::sax::XAttributeList > & i_xAttrList ) :
+ SvXMLImportContext( i_rImport, i_nPrefix, i_rLocalName ),
+ m_Level(0),
+ m_StartValue(-1),
+ m_ListId(),
+ m_xNumRules()
+{
+ ::rtl::OUString StyleName;
+
+ const SvXMLTokenMap& rTokenMap(
+ i_rImport.GetTextImport()->GetTextNumberedParagraphAttrTokenMap() );
+
+ const sal_Int16 nAttrCount( i_xAttrList.is() ?
+ i_xAttrList->getLength() : 0 );
+ for ( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const ::rtl::OUString& rAttrName( i_xAttrList->getNameByIndex( i ) );
+ const ::rtl::OUString& rValue ( i_xAttrList->getValueByIndex( i ) );
+
+ ::rtl::OUString aLocalName;
+ const sal_uInt16 nPrefix(
+ GetImport().GetNamespaceMap().GetKeyByAttrName(
+ rAttrName, &aLocalName ) );
+ switch( rTokenMap.Get( nPrefix, aLocalName ) )
+ {
+ case XML_TOK_TEXT_NUMBERED_PARAGRAPH_XMLID:
+ m_XmlId = rValue;
+//FIXME: there is no UNO API for lists
+ break;
+ case XML_TOK_TEXT_NUMBERED_PARAGRAPH_LIST_ID:
+ m_ListId = rValue;
+ break;
+ case XML_TOK_TEXT_NUMBERED_PARAGRAPH_LEVEL:
+ {
+ sal_Int32 nTmp = rValue.toInt32();
+ if ( nTmp >= 1 && nTmp <= SHRT_MAX ) {
+ m_Level = static_cast<sal_uInt16>(nTmp) - 1;
+ }
+ }
+ break;
+ case XML_TOK_TEXT_NUMBERED_PARAGRAPH_STYLE_NAME:
+ StyleName = rValue;
+ break;
+ case XML_TOK_TEXT_NUMBERED_PARAGRAPH_CONTINUE_NUMBERING:
+ // this attribute is deprecated
+// ContinuteNumbering = IsXMLToken(rValue, XML_TRUE);
+ break;
+ case XML_TOK_TEXT_NUMBERED_PARAGRAPH_START_VALUE:
+ {
+ sal_Int32 nTmp = rValue.toInt32();
+ if ( nTmp >= 0 && nTmp <= SHRT_MAX ) {
+ m_StartValue = static_cast<sal_Int16>(nTmp);
+ }
+ }
+ break;
+ }
+ }
+
+ XMLTextListsHelper& rTextListsHelper(
+ i_rImport.GetTextImport()->GetTextListHelper() );
+ if (!m_ListId.getLength()) {
+ OSL_ENSURE( ! i_rImport.GetODFVersion().equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("1.2") ),
+ "invalid numbered-paragraph: no list-id (1.2)");
+ m_ListId = rTextListsHelper.GetNumberedParagraphListId(m_Level,
+ StyleName);
+ OSL_ENSURE(m_ListId.getLength(), "numbered-paragraph: no ListId");
+ if (!m_ListId.getLength()) {
+ return;
+ }
+ }
+ m_xNumRules = rTextListsHelper.EnsureNumberedParagraph( i_rImport,
+ m_ListId, m_Level, StyleName);
+
+ OSL_ENSURE(m_xNumRules.is(), "numbered-paragraph: no NumRules");
+
+ i_rImport.GetTextImport()->GetTextListHelper().PushListContext( this );
+}
+
+XMLNumberedParaContext::~XMLNumberedParaContext()
+{
+}
+
+void XMLNumberedParaContext::EndElement()
+{
+ if (m_ListId.getLength()) {
+ GetImport().GetTextImport()->PopListContext();
+ }
+}
+
+SvXMLImportContext *XMLNumberedParaContext::CreateChildContext(
+ sal_uInt16 i_nPrefix, const OUString& i_rLocalName,
+ const Reference< xml::sax::XAttributeList > & i_xAttrList )
+{
+ SvXMLImportContext *pContext( 0 );
+
+ if ( XML_NAMESPACE_TEXT == i_nPrefix )
+ {
+ bool bIsHeader( IsXMLToken( i_rLocalName, XML_H ) );
+ if ( bIsHeader || IsXMLToken( i_rLocalName, XML_P ) )
+ {
+ pContext = new XMLParaContext( GetImport(),
+ i_nPrefix, i_rLocalName, i_xAttrList, bIsHeader );
+// ignore text:number } else if (IsXMLToken( i_rLocalName, XML_NUMBER )) {
+ }
+ }
+
+ if (!pContext) {
+ pContext = SvXMLImportContext::CreateChildContext(
+ i_nPrefix, i_rLocalName, i_xAttrList );
+ }
+
+ return pContext;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/txtparai.hxx b/xmloff/source/text/txtparai.hxx
new file mode 100644
index 000000000000..3aba676617d8
--- /dev/null
+++ b/xmloff/source/text/txtparai.hxx
@@ -0,0 +1,133 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_TEXTPARAI_HXX_
+#define _XMLOFF_TEXTPARAI_HXX_
+
+
+#include <com/sun/star/uno/Reference.h>
+#include <xmloff/xmlictxt.hxx>
+
+class XMLHints_Impl;
+namespace com { namespace sun { namespace star {
+namespace text { class XTextRange; }
+namespace xml { namespace sax { class XAttributeList; } }
+} } }
+
+#define CONV_FROM_STAR_BATS 1
+#define CONV_FROM_STAR_MATH 2
+#define CONV_STAR_FONT_FLAGS_VALID 4
+
+class XMLParaContext : public SvXMLImportContext
+{
+ ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextRange > xStart; // xub_StrLen nStart;
+ ::rtl::OUString sStyleName;
+ ::rtl::OUString m_sXmlId;
+ ::rtl::OUString m_sAbout;
+ ::rtl::OUString m_sProperty;
+ ::rtl::OUString m_sContent;
+ ::rtl::OUString m_sDatatype;
+ bool m_bHaveAbout;
+ sal_Int8 nOutlineLevel;
+ XMLHints_Impl *pHints;
+ // Lost outline numbering in master document (#i73509#)
+ sal_Bool mbOutlineLevelAttrFound;
+ sal_Bool bIgnoreLeadingSpace;
+ sal_Bool bHeading;
+ sal_Bool bIsListHeader;
+ sal_Bool bIsRestart;
+ sal_Int16 nStartValue;
+ sal_uInt8 nStarFontsConvFlags;
+
+public:
+
+ TYPEINFO();
+
+ XMLParaContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
+ sal_Bool bHeading );
+
+ virtual ~XMLParaContext();
+
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+ virtual void Characters( const ::rtl::OUString& rChars );
+
+};
+
+class XMLNumberedParaContext : public SvXMLImportContext
+{
+ /// text:list-level MINUS 1
+ sal_Int16 m_Level;
+ /// text:start-value
+ sal_Int16 m_StartValue;
+ /// xml:id
+ ::rtl::OUString m_XmlId;
+ /// text:list-id
+ ::rtl::OUString m_ListId;
+ /// text:style-name
+ ::com::sun::star::uno::Reference <
+ ::com::sun::star::container::XIndexReplace > m_xNumRules;
+
+public:
+
+ TYPEINFO();
+
+ XMLNumberedParaContext( SvXMLImport& i_rImport,
+ sal_uInt16 i_nPrefix,
+ const ::rtl::OUString& i_rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & i_xAttrList );
+
+ virtual ~XMLNumberedParaContext();
+
+ virtual void EndElement();
+
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 i_nPrefix,
+ const ::rtl::OUString& i_rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & i_xAttrList );
+
+ sal_Int16 GetLevel() const { return m_Level; }
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::container::XIndexReplace >& GetNumRules() const
+ { return m_xNumRules; }
+ const ::rtl::OUString& GetListId() const { return m_ListId; }
+ sal_Int16 GetStartValue() const { return m_StartValue; }
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/txtparaimphint.hxx b/xmloff/source/text/txtparaimphint.hxx
new file mode 100644
index 000000000000..4c1ba62fd7fc
--- /dev/null
+++ b/xmloff/source/text/txtparaimphint.hxx
@@ -0,0 +1,295 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_TXTPARAIMPHINT_HXX
+#define _XMLOFF_TXTPARAIMPHINT_HXX
+
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <tools/debug.hxx>
+#include <svl/svarray.hxx>
+#include <xmloff/xmlimp.hxx>
+#include "XMLTextFrameContext.hxx"
+#include <xmloff/XMLEventsImportContext.hxx>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::text;
+using namespace ::xmloff::token;
+
+// ---------------------------------------------------------------------
+
+#define XML_HINT_STYLE 1
+#define XML_HINT_REFERENCE 2
+#define XML_HINT_HYPERLINK 3
+#define XML_HINT_INDEX_MARK 5
+#define XML_HINT_TEXT_FRAME 6
+// Core impl. of the unification of drawing objects and Writer fly frames (#i26791#)
+#define XML_HINT_DRAW 7
+
+class XMLHint_Impl
+{
+ Reference < XTextRange > xStart;
+ Reference < XTextRange > xEnd;
+
+ sal_uInt8 nType;
+
+public:
+
+ XMLHint_Impl( sal_uInt8 nTyp,
+ const Reference < XTextRange > & rS,
+ const Reference < XTextRange > & rE ) :
+ xStart( rS ),
+ xEnd( rE ),
+ nType( nTyp )
+ {
+ }
+
+ XMLHint_Impl( sal_uInt8 nTyp,
+ const Reference < XTextRange > & rS ) :
+ xStart( rS ),
+ nType( nTyp )
+ {
+ }
+
+ virtual ~XMLHint_Impl() {}
+
+ const Reference < XTextRange > & GetStart() const { return xStart; }
+ const Reference < XTextRange > & GetEnd() const { return xEnd; }
+ void SetEnd( const Reference < XTextRange > & rPos ) { xEnd = rPos; }
+
+ // We don't use virtual methods to differ between the sub classes,
+ // because this seems to be to expensive if compared to inline methods.
+ sal_uInt8 GetType() const { return nType; }
+ sal_Bool IsStyle() { return XML_HINT_STYLE==nType; }
+ sal_Bool IsReference() { return XML_HINT_REFERENCE==nType; }
+ sal_Bool IsHyperlink() { return XML_HINT_HYPERLINK==nType; }
+ sal_Bool IsIndexMark() { return XML_HINT_INDEX_MARK==nType; }
+};
+
+class XMLStyleHint_Impl : public XMLHint_Impl
+{
+ OUString sStyleName;
+
+public:
+
+ XMLStyleHint_Impl( const OUString& rStyleName,
+ const Reference < XTextRange > & rPos ) :
+ XMLHint_Impl( XML_HINT_STYLE, rPos, rPos ),
+ sStyleName( rStyleName )
+ {
+ }
+ virtual ~XMLStyleHint_Impl() {}
+
+ const OUString& GetStyleName() const { return sStyleName; }
+};
+
+class XMLReferenceHint_Impl : public XMLHint_Impl
+{
+ OUString sRefName;
+
+public:
+
+ XMLReferenceHint_Impl( const OUString& rRefName,
+ const Reference < XTextRange > & rPos ) :
+ XMLHint_Impl( XML_HINT_REFERENCE, rPos, rPos ),
+ sRefName( rRefName )
+ {
+ }
+
+ virtual ~XMLReferenceHint_Impl() {}
+
+ const OUString& GetRefName() const { return sRefName; }
+};
+
+class XMLHyperlinkHint_Impl : public XMLHint_Impl
+{
+ OUString sHRef;
+ OUString sName;
+ OUString sTargetFrameName;
+ OUString sStyleName;
+ OUString sVisitedStyleName;
+ XMLEventsImportContext* pEvents;
+
+public:
+
+ XMLHyperlinkHint_Impl( const Reference < XTextRange > & rPos ) :
+ XMLHint_Impl( XML_HINT_HYPERLINK, rPos, rPos ),
+ pEvents( NULL )
+ {
+ }
+
+ virtual ~XMLHyperlinkHint_Impl()
+ {
+ if (NULL != pEvents)
+ pEvents->ReleaseRef();
+ }
+
+ void SetHRef( const OUString& s ) { sHRef = s; }
+ const OUString& GetHRef() const { return sHRef; }
+ void SetName( const OUString& s ) { sName = s; }
+ const OUString& GetName() const { return sName; }
+ void SetTargetFrameName( const OUString& s ) { sTargetFrameName = s; }
+ const OUString& GetTargetFrameName() const { return sTargetFrameName; }
+ void SetStyleName( const OUString& s ) { sStyleName = s; }
+ const OUString& GetStyleName() const { return sStyleName; }
+ void SetVisitedStyleName( const OUString& s ) { sVisitedStyleName = s; }
+ const OUString& GetVisitedStyleName() const { return sVisitedStyleName; }
+ XMLEventsImportContext* GetEventsContext() const
+ {
+ return pEvents;
+ }
+ void SetEventsContext( XMLEventsImportContext* pCtxt )
+ {
+ pEvents = pCtxt;
+ if (pEvents != NULL)
+ pEvents->AddRef();
+ }
+};
+
+
+class XMLIndexMarkHint_Impl : public XMLHint_Impl
+{
+ const Reference<beans::XPropertySet> xIndexMarkPropSet;
+
+ const OUString sID;
+
+public:
+
+ XMLIndexMarkHint_Impl( const Reference < beans::XPropertySet > & rPropSet,
+ const Reference < XTextRange > & rPos ) :
+ XMLHint_Impl( XML_HINT_INDEX_MARK, rPos, rPos ),
+ xIndexMarkPropSet( rPropSet ),
+ sID()
+ {
+ }
+
+ XMLIndexMarkHint_Impl( const Reference < beans::XPropertySet > & rPropSet,
+ const Reference < XTextRange > & rPos,
+ OUString sIDString) :
+ XMLHint_Impl( XML_HINT_INDEX_MARK, rPos, rPos ),
+ xIndexMarkPropSet( rPropSet ),
+ sID(sIDString)
+ {
+ }
+
+ virtual ~XMLIndexMarkHint_Impl() {}
+
+ const Reference<beans::XPropertySet> & GetMark() const
+ { return xIndexMarkPropSet; }
+ const OUString& GetID() const { return sID; }
+};
+
+
+class XMLTextFrameHint_Impl : public XMLHint_Impl
+{
+ // OD 2004-04-20 #i26791#
+ SvXMLImportContextRef xContext;
+
+public:
+
+ XMLTextFrameHint_Impl( SvXMLImportContext* pContext,
+ const Reference < XTextRange > & rPos ) :
+ XMLHint_Impl( XML_HINT_TEXT_FRAME, rPos, rPos ),
+ xContext( pContext )
+ {
+ }
+
+ virtual ~XMLTextFrameHint_Impl()
+ {
+ }
+
+ Reference < XTextContent > GetTextContent() const
+ {
+ Reference <XTextContent > xTxt;
+ SvXMLImportContext *pContext = &xContext;
+ if( pContext->ISA( XMLTextFrameContext ) )
+ xTxt = PTR_CAST( XMLTextFrameContext, pContext )->GetTextContent();
+ else if( pContext->ISA( XMLTextFrameHyperlinkContext ) )
+ xTxt = PTR_CAST( XMLTextFrameHyperlinkContext, pContext )
+ ->GetTextContent();
+
+ return xTxt;
+ }
+
+ // Frame "to character": anchor moves from first to last char after saving (#i33242#)
+ Reference < drawing::XShape > GetShape() const
+ {
+ Reference < drawing::XShape > xShape;
+ SvXMLImportContext *pContext = &xContext;
+ if( pContext->ISA( XMLTextFrameContext ) )
+ xShape = PTR_CAST( XMLTextFrameContext, pContext )->GetShape();
+ else if( pContext->ISA( XMLTextFrameHyperlinkContext ) )
+ xShape = PTR_CAST( XMLTextFrameHyperlinkContext, pContext )->GetShape();
+
+ return xShape;
+ }
+
+ sal_Bool IsBoundAtChar() const
+ {
+ sal_Bool bRet = sal_False;
+ SvXMLImportContext *pContext = &xContext;
+ if( pContext->ISA( XMLTextFrameContext ) )
+ bRet = TextContentAnchorType_AT_CHARACTER ==
+ PTR_CAST( XMLTextFrameContext, pContext )
+ ->GetAnchorType();
+ else if( pContext->ISA( XMLTextFrameHyperlinkContext ) )
+ bRet = TextContentAnchorType_AT_CHARACTER ==
+ PTR_CAST( XMLTextFrameHyperlinkContext, pContext )
+ ->GetAnchorType();
+ return bRet;
+ }
+};
+
+// Core impl. of the unification of drawing objects and Writer fly frames (#i26791#)
+class XMLDrawHint_Impl : public XMLHint_Impl
+{
+ SvXMLImportContextRef xContext;
+
+public:
+
+ XMLDrawHint_Impl( SvXMLShapeContext* pContext,
+ const Reference < XTextRange > & rPos ) :
+ XMLHint_Impl( XML_HINT_DRAW, rPos, rPos ),
+ xContext( pContext )
+ {
+ }
+
+ virtual ~XMLDrawHint_Impl()
+ {
+ }
+
+ // Frame "to character": anchor moves from first to last char after saving (#i33242#)
+ Reference < drawing::XShape > GetShape() const
+ {
+ return static_cast<SvXMLShapeContext*>(&xContext)->getShape();
+ }
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/txtprhdl.cxx b/xmloff/source/text/txtprhdl.cxx
new file mode 100644
index 000000000000..a430339fcadd
--- /dev/null
+++ b/xmloff/source/text/txtprhdl.cxx
@@ -0,0 +1,1482 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <tools/fontenum.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/style/DropCapFormat.hpp>
+#include <com/sun/star/text/FontRelief.hpp>
+#include <com/sun/star/text/WrapTextMode.hpp>
+#include <com/sun/star/text/XTextColumns.hpp>
+#include <com/sun/star/text/TextColumn.hpp>
+#include <com/sun/star/text/RelOrientation.hpp>
+#include <com/sun/star/text/HoriOrientation.hpp>
+#include <com/sun/star/text/VertOrientation.hpp>
+#include <com/sun/star/text/RubyAdjust.hpp>
+#include <com/sun/star/text/FontEmphasis.hpp>
+#include <com/sun/star/text/ParagraphVertAlign.hpp>
+#include <xmloff/xmltypes.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmltoken.hxx>
+#include "XMLAnchorTypePropHdl.hxx"
+#include <xmloff/XMLConstantsPropertyHandler.hxx>
+#include "XMLClipPropertyHandler.hxx"
+#include "XMLTextColumnsPropertyHandler.hxx"
+#include <xmloff/NamedBoolPropertyHdl.hxx>
+#include "txtprhdl.hxx"
+// OD 2004-05-05 #i28701#
+#include <com/sun/star/text/WrapInfluenceOnPosition.hpp>
+
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::text;
+using namespace ::xmloff::token;
+
+
+#define CONSTASCII_USTRINGPARAM_CMP(s) s, sizeof(s)-1
+
+// ---------------------------------------------------------------------------
+
+SvXMLEnumMapEntry const pXML_HoriPos_Enum[] =
+{
+ { XML_FROM_LEFT, HoriOrientation::NONE },
+ { XML_FROM_INSIDE, HoriOrientation::NONE }, // import only
+ { XML_LEFT, HoriOrientation::LEFT },
+ { XML_INSIDE, HoriOrientation::LEFT }, // import only
+ { XML_CENTER, HoriOrientation::CENTER },
+ { XML_RIGHT, HoriOrientation::RIGHT },
+ { XML_OUTSIDE, HoriOrientation::RIGHT }, // import only
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry const pXML_HoriPosMirrored_Enum[] =
+{
+ { XML_FROM_INSIDE, HoriOrientation::NONE },
+ { XML_INSIDE, HoriOrientation::LEFT },
+ { XML_CENTER, HoriOrientation::CENTER },
+ { XML_OUTSIDE, HoriOrientation::RIGHT },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry const pXML_HoriRel_Enum[] =
+{
+ { XML_PARAGRAPH, RelOrientation::FRAME },
+ { XML_PARAGRAPH_CONTENT, RelOrientation::PRINT_AREA },
+ { XML_PAGE, RelOrientation::PAGE_FRAME },
+ { XML_PAGE_CONTENT, RelOrientation::PAGE_PRINT_AREA },
+ { XML_PARAGRAPH_START_MARGIN, RelOrientation::FRAME_LEFT },
+ { XML_PARAGRAPH_END_MARGIN, RelOrientation::FRAME_RIGHT },
+ { XML_PAGE_START_MARGIN, RelOrientation::PAGE_LEFT },
+ { XML_PAGE_END_MARGIN, RelOrientation::PAGE_RIGHT },
+ { XML_CHAR, RelOrientation::CHAR },
+ { XML_FRAME, RelOrientation::FRAME }, // import only
+ { XML_FRAME_CONTENT, RelOrientation::PRINT_AREA }, // import only
+ { XML_FRAME_START_MARGIN, RelOrientation::FRAME_LEFT }, // import only
+ { XML_FRAME_END_MARGIN, RelOrientation::FRAME_RIGHT }, // import only
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry const pXML_HoriRelFrame_Enum[] =
+{
+ { XML_FRAME, RelOrientation::FRAME },
+ { XML_FRAME_CONTENT, RelOrientation::PRINT_AREA },
+ { XML_PAGE, RelOrientation::PAGE_FRAME },
+ { XML_PAGE_CONTENT, RelOrientation::PAGE_PRINT_AREA },
+ { XML_FRAME_START_MARGIN, RelOrientation::FRAME_LEFT },
+ { XML_FRAME_END_MARGIN, RelOrientation::FRAME_RIGHT },
+ { XML_PAGE_START_MARGIN, RelOrientation::PAGE_LEFT },
+ { XML_PAGE_END_MARGIN, RelOrientation::PAGE_RIGHT },
+ { XML_CHAR, RelOrientation::CHAR },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry const pXML_HoriMirror_Enum[] =
+{
+ { XML_FROM_LEFT, sal_False },
+ { XML_FROM_INSIDE, sal_True },
+ { XML_LEFT, sal_False },
+ { XML_INSIDE, sal_True },
+ { XML_CENTER, sal_False },
+ { XML_RIGHT, sal_False },
+ { XML_OUTSIDE, sal_True },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry const pXML_VertPos_Enum[] =
+{
+ { XML_FROM_TOP, VertOrientation::NONE },
+ { XML_TOP, VertOrientation::TOP },
+ { XML_TOP, VertOrientation::CHAR_TOP }, // export only
+ { XML_TOP, VertOrientation::LINE_TOP }, // export only
+ { XML_MIDDLE, VertOrientation::CENTER },
+ { XML_MIDDLE, VertOrientation::CHAR_CENTER }, // export only
+ { XML_MIDDLE, VertOrientation::LINE_CENTER }, // export only
+ { XML_BOTTOM, VertOrientation::BOTTOM },
+ { XML_BOTTOM, VertOrientation::CHAR_BOTTOM }, // export only
+ { XML_BOTTOM, VertOrientation::LINE_BOTTOM }, // export only
+ { XML_BELOW, VertOrientation::CHAR_BOTTOM }, // import only
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry const pXML_VertPosAtChar_Enum[] =
+{
+ { XML_FROM_TOP, VertOrientation::NONE },
+ { XML_TOP, VertOrientation::TOP },
+ { XML_TOP, VertOrientation::CHAR_TOP }, // export only
+ { XML_TOP, VertOrientation::LINE_TOP }, // export only
+ { XML_MIDDLE, VertOrientation::CENTER },
+ { XML_MIDDLE, VertOrientation::CHAR_CENTER }, // export only
+ { XML_MIDDLE, VertOrientation::LINE_CENTER }, // export only
+ { XML_BOTTOM, VertOrientation::BOTTOM },
+ { XML_BELOW, VertOrientation::CHAR_BOTTOM }, // export only
+ { XML_BOTTOM, VertOrientation::LINE_BOTTOM }, // export only
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry const pXML_VertRel_Enum[] =
+{
+ { XML_PARAGRAPH, RelOrientation::FRAME },
+ { XML_PARAGRAPH_CONTENT, RelOrientation::PRINT_AREA },
+ { XML_CHAR, RelOrientation::CHAR },
+ // DVO, OD 17.09.2003 #i18732# - allow vertical alignment at page
+ { XML_PAGE, RelOrientation::PAGE_FRAME },
+ { XML_PAGE_CONTENT, RelOrientation::PAGE_PRINT_AREA },
+ { XML_FRAME, RelOrientation::FRAME }, // import only
+ { XML_FRAME_CONTENT, RelOrientation::PRINT_AREA }, // import only
+ // OD 13.11.2003 #i22341# - new vertical alignment at top of line
+ { XML_LINE, RelOrientation::TEXT_LINE },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry const pXML_VertRelPage_Enum[] =
+{
+ { XML_PAGE, RelOrientation::FRAME },
+ { XML_PAGE_CONTENT, RelOrientation::PRINT_AREA },
+ { XML_PAGE, RelOrientation::PAGE_FRAME },
+ { XML_PAGE_CONTENT, RelOrientation::PAGE_PRINT_AREA },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry const pXML_VertRelFrame_Enum[] =
+{
+ { XML_FRAME, RelOrientation::FRAME },
+ { XML_FRAME_CONTENT, RelOrientation::PRINT_AREA },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry const pXML_VertRelAsChar_Enum[] =
+{
+ { XML_BASELINE, VertOrientation::TOP },
+ { XML_BASELINE, VertOrientation::CENTER }, // export only
+ { XML_BASELINE, VertOrientation::BOTTOM }, // export only
+ { XML_TEXT, VertOrientation::CHAR_TOP },
+ { XML_TEXT, VertOrientation::CHAR_CENTER }, // export only
+ { XML_TEXT, VertOrientation::CHAR_BOTTOM }, // export only
+ { XML_LINE, VertOrientation::LINE_TOP },
+ { XML_LINE, VertOrientation::LINE_CENTER }, // export only
+ { XML_LINE, VertOrientation::LINE_BOTTOM }, // export only
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry const pXML_RubyAdjust_Enum[] =
+{
+ { XML_LEFT, RubyAdjust_LEFT },
+ { XML_CENTER, RubyAdjust_CENTER },
+ { XML_RIGHT, RubyAdjust_RIGHT },
+ { XML_DISTRIBUTE_LETTER, RubyAdjust_BLOCK },
+ { XML_DISTRIBUTE_SPACE, RubyAdjust_INDENT_BLOCK },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry const pXML_FontRelief_Enum[] =
+{
+ { XML_NONE, FontRelief::NONE },
+ { XML_ENGRAVED, FontRelief::ENGRAVED },
+ { XML_EMBOSSED, FontRelief::EMBOSSED },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry const pXML_VerticalAlign_Enum[] =
+{
+ { XML_TOP, ParagraphVertAlign::TOP },
+ { XML_MIDDLE, ParagraphVertAlign::CENTER },
+ { XML_BOTTOM, ParagraphVertAlign::BOTTOM },
+ { XML_BASELINE, ParagraphVertAlign::BASELINE },
+ { XML_AUTO, ParagraphVertAlign::AUTOMATIC },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+// OD 2004-05-05 #i28701#
+SvXMLEnumMapEntry const pXML_WrapInfluenceOnPosition_Enum[] =
+{
+ // Tokens have been renamed and <XML_ITERATIVE> has been added (#i35017#)
+ { XML_ONCE_SUCCESSIVE, WrapInfluenceOnPosition::ONCE_SUCCESSIVE },
+ { XML_ONCE_CONCURRENT, WrapInfluenceOnPosition::ONCE_CONCURRENT },
+ { XML_ITERATIVE, WrapInfluenceOnPosition::ITERATIVE },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+// ---------------------------------------------------------------------------
+
+class XMLDropCapPropHdl_Impl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLDropCapPropHdl_Impl ();
+
+ virtual bool equals(
+ const ::com::sun::star::uno::Any& r1,
+ const ::com::sun::star::uno::Any& r2 ) const;
+
+ /// TabStops will be imported/exported as XML-Elements. So the Import/Export-work must be done at another place.
+ virtual sal_Bool importXML(
+ const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& ) const;
+ virtual sal_Bool exportXML(
+ ::rtl::OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& ) const;
+};
+
+XMLDropCapPropHdl_Impl::~XMLDropCapPropHdl_Impl ()
+{
+}
+
+bool XMLDropCapPropHdl_Impl::equals(
+ const Any& r1,
+ const Any& r2 ) const
+{
+ DropCapFormat aFormat1, aFormat2;
+ r1 >>= aFormat1;
+ r2 >>= aFormat2;
+
+ return (aFormat1.Lines <=1 && aFormat2.Lines <=1) ||
+ (aFormat1.Lines == aFormat2.Lines &&
+ aFormat1.Count == aFormat2.Count &&
+ aFormat1.Distance == aFormat2.Distance);
+}
+
+sal_Bool XMLDropCapPropHdl_Impl::importXML(
+ const OUString&,
+ Any&,
+ const SvXMLUnitConverter& ) const
+{
+ DBG_ASSERT( !this, "drop caps are an element import property" );
+ return sal_False;
+}
+
+sal_Bool XMLDropCapPropHdl_Impl::exportXML(
+ OUString&,
+ const Any&,
+ const SvXMLUnitConverter& ) const
+{
+ DBG_ASSERT( !this, "drop caps are an element export property" );
+ return sal_False;
+}
+
+// ---------------------------------------------------------------------------
+
+class XMLOpaquePropHdl_Impl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLOpaquePropHdl_Impl ();
+
+ virtual sal_Bool importXML(
+ const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& ) const;
+ virtual sal_Bool exportXML(
+ ::rtl::OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& ) const;
+};
+
+sal_Bool XMLOpaquePropHdl_Impl::importXML(
+ const OUString& rStrImpValue,
+ Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_True;
+ sal_Bool bVal = sal_False;
+ if( IsXMLToken( rStrImpValue, XML_FOREGROUND ) )
+ bVal = sal_True;
+ else if( !IsXMLToken( rStrImpValue, XML_BACKGROUND ) )
+ bRet = sal_False;
+
+ if( bRet )
+ rValue.setValue( &bVal, ::getBooleanCppuType() );
+
+ return bRet;
+}
+
+sal_Bool XMLOpaquePropHdl_Impl::exportXML(
+ OUString& rStrExpValue,
+ const Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ if( *(sal_Bool *)rValue.getValue() )
+ rStrExpValue = GetXMLToken( XML_FOREGROUND );
+ else
+ rStrExpValue = GetXMLToken( XML_BACKGROUND );
+
+ return sal_True;
+}
+
+XMLOpaquePropHdl_Impl::~XMLOpaquePropHdl_Impl ()
+{
+}
+
+// ---------------------------------------------------------------------------
+
+class XMLContourModePropHdl_Impl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLContourModePropHdl_Impl ();
+
+ virtual sal_Bool importXML(
+ const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& ) const;
+ virtual sal_Bool exportXML(
+ ::rtl::OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& ) const;
+};
+
+sal_Bool XMLContourModePropHdl_Impl::importXML(
+ const OUString& rStrImpValue,
+ Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_True;
+ sal_Bool bVal = sal_False;
+ if( IsXMLToken( rStrImpValue, XML_OUTSIDE ) )
+ bVal = sal_True;
+ else if( ! IsXMLToken( rStrImpValue, XML_FULL ) )
+ bRet = sal_False;
+
+ if( bRet )
+ rValue.setValue( &bVal, ::getBooleanCppuType() );
+
+ return bRet;
+}
+
+sal_Bool XMLContourModePropHdl_Impl::exportXML(
+ OUString& rStrExpValue,
+ const Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ if( *(sal_Bool *)rValue.getValue() )
+ rStrExpValue = GetXMLToken( XML_OUTSIDE );
+ else
+ rStrExpValue = GetXMLToken( XML_FULL );
+
+ return sal_True;
+}
+
+XMLContourModePropHdl_Impl::~XMLContourModePropHdl_Impl()
+{
+}
+
+// ---------------------------------------------------------------------------
+
+class XMLParagraphOnlyPropHdl_Impl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLParagraphOnlyPropHdl_Impl ();
+
+ virtual sal_Bool importXML(
+ const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& ) const;
+ virtual sal_Bool exportXML(
+ ::rtl::OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& ) const;
+};
+
+sal_Bool XMLParagraphOnlyPropHdl_Impl::importXML(
+ const OUString& rStrImpValue,
+ Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_True;
+ sal_Bool bVal = sal_False;
+
+ if( ! IsXMLToken( rStrImpValue, XML_NO_LIMIT ) )
+ {
+ sal_Int32 nValue = 0;
+ bRet = SvXMLUnitConverter::convertNumber( nValue, rStrImpValue );
+ bVal = 1 == nValue;
+ }
+
+ if( bRet )
+ rValue.setValue( &bVal, ::getBooleanCppuType() );
+
+ return bRet;
+}
+
+sal_Bool XMLParagraphOnlyPropHdl_Impl::exportXML(
+ OUString& rStrExpValue,
+ const Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ if( *(sal_Bool *)rValue.getValue() )
+ rStrExpValue = GetXMLToken( XML_1 );
+ else
+ rStrExpValue = GetXMLToken( XML_NO_LIMIT );
+
+ return sal_True;
+}
+
+XMLParagraphOnlyPropHdl_Impl::~XMLParagraphOnlyPropHdl_Impl()
+{
+}
+
+// ---------------------------------------------------------------------------
+
+SvXMLEnumMapEntry const pXML_Wrap_Enum[] =
+{
+ { XML_NONE, WrapTextMode_NONE },
+ { XML_RUN_THROUGH, WrapTextMode_THROUGHT },
+ { XML_PARALLEL, WrapTextMode_PARALLEL },
+ { XML_DYNAMIC, WrapTextMode_DYNAMIC },
+ { XML_LEFT, WrapTextMode_LEFT },
+ { XML_RIGHT, WrapTextMode_RIGHT },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+class XMLWrapPropHdl_Impl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLWrapPropHdl_Impl ();
+
+ virtual sal_Bool importXML(
+ const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& ) const;
+ virtual sal_Bool exportXML(
+ ::rtl::OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& ) const;
+};
+
+sal_Bool XMLWrapPropHdl_Impl::importXML(
+ const OUString& rStrImpValue,
+ Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ sal_uInt16 nWrap;
+ sal_Bool bRet = SvXMLUnitConverter::convertEnum( nWrap, rStrImpValue,
+ pXML_Wrap_Enum );
+
+ if( bRet )
+ rValue <<= (WrapTextMode)nWrap;
+
+ return bRet;
+}
+
+sal_Bool XMLWrapPropHdl_Impl::exportXML(
+ OUString& rStrExpValue,
+ const Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ OUStringBuffer aOut;
+ WrapTextMode eVal;
+
+ rValue >>= eVal;
+
+ sal_Bool bRet = SvXMLUnitConverter::convertEnum( aOut, eVal, pXML_Wrap_Enum, XML_NONE );
+
+ rStrExpValue = aOut.makeStringAndClear();
+
+ return bRet;
+}
+
+XMLWrapPropHdl_Impl::~XMLWrapPropHdl_Impl ()
+{
+}
+
+// ---------------------------------------------------------------------------
+
+class XMLFrameProtectPropHdl_Impl : public XMLPropertyHandler
+{
+ const OUString sVal;
+public:
+ XMLFrameProtectPropHdl_Impl( enum XMLTokenEnum eVal ) :
+ sVal( GetXMLToken(eVal) ) {}
+ virtual ~XMLFrameProtectPropHdl_Impl ();
+
+ virtual sal_Bool importXML(
+ const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& ) const;
+ virtual sal_Bool exportXML(
+ ::rtl::OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& ) const;
+};
+
+sal_Bool XMLFrameProtectPropHdl_Impl::importXML(
+ const OUString& rStrImpValue,
+ Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_True;
+ sal_Bool bVal = sal_False;
+ if( ! IsXMLToken( rStrImpValue, XML_NONE ) )
+ {
+ bRet = sal_False;
+ SvXMLTokenEnumerator aTokenEnum( rStrImpValue );
+ OUString aToken;
+ while( aTokenEnum.getNextToken( aToken ) )
+ {
+ bRet = sal_True;
+ if( aToken == sVal )
+ {
+ bVal = sal_True;
+ break;
+ }
+ }
+ }
+
+ if( bRet )
+ rValue.setValue( &bVal, ::getBooleanCppuType() );
+
+ return bRet;
+}
+
+sal_Bool XMLFrameProtectPropHdl_Impl::exportXML(
+ OUString& rStrExpValue,
+ const Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ if( *(sal_Bool *)rValue.getValue() )
+ {
+ if( !rStrExpValue.getLength() ||
+ IsXMLToken( rStrExpValue, XML_NONE ) )
+ {
+ rStrExpValue = sVal;
+ }
+ else
+ {
+ OUStringBuffer aOut( rStrExpValue.getLength() + 1 +
+ sVal.getLength() );
+ aOut.append( rStrExpValue );
+ aOut.append( (sal_Unicode)' ' );
+ aOut.append( sVal );
+ rStrExpValue = aOut.makeStringAndClear();
+ }
+ }
+ else if( !rStrExpValue.getLength() )
+ {
+ rStrExpValue = GetXMLToken( XML_NONE );
+ }
+
+ return sal_True;
+}
+
+XMLFrameProtectPropHdl_Impl::~XMLFrameProtectPropHdl_Impl()
+{
+}
+
+// ---------------------------------------------------------------------------
+
+SvXMLEnumMapEntry const pXML_Anchor_Enum[] =
+{
+ { XML_CHAR, TextContentAnchorType_AT_CHARACTER },
+ { XML_PAGE, TextContentAnchorType_AT_PAGE },
+ { XML_FRAME, TextContentAnchorType_AT_FRAME },
+ { XML_PARAGRAPH, TextContentAnchorType_AT_PARAGRAPH },
+ { XML_AS_CHAR, TextContentAnchorType_AS_CHARACTER },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+
+sal_Bool XMLAnchorTypePropHdl::importXML(
+ const OUString& rStrImpValue,
+ Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ sal_uInt16 nAnchor;
+ sal_Bool bRet = SvXMLUnitConverter::convertEnum( nAnchor, rStrImpValue,
+ pXML_Anchor_Enum );
+
+ if( bRet )
+ rValue <<= (TextContentAnchorType)nAnchor;
+
+ return bRet;
+}
+
+sal_Bool XMLAnchorTypePropHdl::exportXML(
+ OUString& rStrExpValue,
+ const Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ OUStringBuffer aOut;
+ TextContentAnchorType eVal;
+
+ rValue >>= eVal;
+
+ sal_Bool bRet = SvXMLUnitConverter::convertEnum( aOut, eVal, pXML_Anchor_Enum, XML_PARAGRAPH );
+
+ rStrExpValue = aOut.makeStringAndClear();
+
+ return bRet;
+}
+
+XMLAnchorTypePropHdl::~XMLAnchorTypePropHdl()
+{
+}
+
+sal_Bool XMLAnchorTypePropHdl::convert( const OUString& rStrImpValue,
+ TextContentAnchorType& rType )
+{
+ sal_uInt16 nAnchor;
+ sal_Bool bRet = SvXMLUnitConverter::convertEnum( nAnchor, rStrImpValue,
+ pXML_Anchor_Enum );
+ if( bRet )
+ rType = (TextContentAnchorType)nAnchor;
+ return bRet;
+}
+
+// ---------------------------------------------------------------------------
+
+
+XMLTextColumnsPropertyHandler::~XMLTextColumnsPropertyHandler ()
+{
+}
+
+bool XMLTextColumnsPropertyHandler::equals(
+ const Any& r1,
+ const Any& r2 ) const
+{
+ Reference < XTextColumns > xColumns1;
+ r1 >>= xColumns1;
+
+ Reference < XTextColumns > xColumns2;
+ r2 >>= xColumns2;
+
+ if( xColumns1->getColumnCount() != xColumns2->getColumnCount() ||
+ xColumns1->getReferenceValue() != xColumns2->getReferenceValue() )
+ return sal_False;
+
+ Sequence < TextColumn > aColumns1 = xColumns1->getColumns();
+ Sequence < TextColumn > aColumns2 = xColumns2->getColumns();
+ sal_Int32 nCount = aColumns1.getLength();
+ if( aColumns2.getLength() != nCount )
+ return sal_False;
+
+ const TextColumn *pColumns1 = aColumns1.getArray();
+ const TextColumn *pColumns2 = aColumns2.getArray();
+
+ while( nCount-- )
+ {
+ if( pColumns1->Width != pColumns2->Width ||
+ pColumns1->LeftMargin != pColumns2->LeftMargin ||
+ pColumns1->RightMargin != pColumns2->RightMargin )
+ return sal_False;
+
+ pColumns1++;
+ pColumns2++;
+ }
+
+ return sal_True;
+}
+
+sal_Bool XMLTextColumnsPropertyHandler::importXML(
+ const OUString&,
+ Any&,
+ const SvXMLUnitConverter& ) const
+{
+ DBG_ASSERT( !this, "columns are an element import property" );
+ return sal_False;
+}
+
+sal_Bool XMLTextColumnsPropertyHandler::exportXML(
+ OUString&,
+ const Any&,
+ const SvXMLUnitConverter& ) const
+{
+ DBG_ASSERT( !this, "columns are an element export property" );
+ return sal_False;
+}
+
+// ---------------------------------------------------------------------------
+
+class XMLHoriMirrorPropHdl_Impl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLHoriMirrorPropHdl_Impl ();
+
+ virtual sal_Bool importXML(
+ const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& ) const;
+ virtual sal_Bool exportXML(
+ ::rtl::OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& ) const;
+};
+
+sal_Bool XMLHoriMirrorPropHdl_Impl::importXML(
+ const OUString& rStrImpValue,
+ Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ sal_uInt16 nHoriMirror;
+ sal_Bool bRet = SvXMLUnitConverter::convertEnum( nHoriMirror, rStrImpValue,
+ pXML_HoriMirror_Enum );
+
+ if( bRet )
+ {
+ sal_Bool bTmp = nHoriMirror != 0;
+ rValue.setValue( &bTmp, ::getBooleanCppuType() );
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLHoriMirrorPropHdl_Impl::exportXML(
+ OUString&,
+ const Any&,
+ const SvXMLUnitConverter& ) const
+{
+ DBG_ASSERT( !this, "HorMirror properyt shouldn't be exported" );
+
+ return sal_False;
+}
+
+XMLHoriMirrorPropHdl_Impl::~XMLHoriMirrorPropHdl_Impl ()
+{
+}
+
+// ---------------------------------------------------------------------------
+
+class XMLGrfMirrorPropHdl_Impl : public XMLPropertyHandler
+{
+ const OUString sVal;
+ sal_Bool bHori;
+
+public:
+ XMLGrfMirrorPropHdl_Impl( enum XMLTokenEnum eVal, sal_Bool bH ) :
+ sVal( GetXMLToken( eVal ) ),
+ bHori( bH ) {}
+ virtual ~XMLGrfMirrorPropHdl_Impl ();
+
+ virtual sal_Bool importXML(
+ const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& ) const;
+ virtual sal_Bool exportXML(
+ ::rtl::OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& ) const;
+};
+
+sal_Bool XMLGrfMirrorPropHdl_Impl::importXML(
+ const OUString& rStrImpValue,
+ Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_True;
+ sal_Bool bVal = sal_False;
+ if( ! IsXMLToken( rStrImpValue, XML_NONE ) )
+ {
+ bRet = sal_False;
+ SvXMLTokenEnumerator aTokenEnum( rStrImpValue );
+ OUString aToken;
+ while( aTokenEnum.getNextToken( aToken ) )
+ {
+ bRet = sal_True;
+ if( aToken == sVal ||
+ (bHori && IsXMLToken( aToken, XML_HORIZONTAL ) ) )
+ {
+ bVal = sal_True;
+ break;
+ }
+ }
+ }
+
+ if( bRet )
+ rValue.setValue( &bVal, ::getBooleanCppuType() );
+
+ return bRet;
+}
+
+sal_Bool XMLGrfMirrorPropHdl_Impl::exportXML(
+ OUString& rStrExpValue,
+ const Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ if( *(sal_Bool *)rValue.getValue() )
+ {
+ if( !rStrExpValue.getLength() ||
+ IsXMLToken( rStrExpValue, XML_NONE ) )
+ {
+ rStrExpValue = sVal;
+ }
+ else if( bHori &&
+ /* XML_HORIZONTAL_ON_LEFT_PAGES and XML_HORIZONTAL_ON_RIGHT_PAGES
+ are replaced by XML_HORIZONTAL_ON_EVEN and XML_HORIZONTAL_ON_ODD.
+ (#i49139#)
+ */
+ ( IsXMLToken( rStrExpValue, XML_HORIZONTAL_ON_EVEN ) ||
+ IsXMLToken( rStrExpValue, XML_HORIZONTAL_ON_ODD ) ))
+ {
+ rStrExpValue = GetXMLToken( XML_HORIZONTAL );
+ }
+ else
+ {
+ OUStringBuffer aOut( rStrExpValue.getLength() + 1 +
+ sVal.getLength() );
+ aOut.append( rStrExpValue );
+ aOut.append( (sal_Unicode)' ' );
+ aOut.append( sVal );
+ rStrExpValue = aOut.makeStringAndClear();
+ }
+ }
+ else if( !rStrExpValue.getLength() )
+ {
+ rStrExpValue = GetXMLToken( XML_NONE );
+ }
+
+ return sal_True;
+}
+
+XMLGrfMirrorPropHdl_Impl::~XMLGrfMirrorPropHdl_Impl()
+{
+}
+
+// ---------------------------------------------------------------------------
+
+SvXMLEnumMapEntry const pXML_Emphasize_Enum[] =
+{
+ { XML_NONE, FontEmphasis::NONE },
+ { XML_DOT, FontEmphasis::DOT_ABOVE },
+ { XML_CIRCLE, FontEmphasis::CIRCLE_ABOVE },
+ { XML_DISC, FontEmphasis::DISK_ABOVE },
+ { XML_ACCENT, FontEmphasis::ACCENT_ABOVE },
+ { XML_TOKEN_INVALID, 0 }
+};
+class XMLTextEmphasizePropHdl_Impl : public XMLPropertyHandler
+{
+public:
+ XMLTextEmphasizePropHdl_Impl() {}
+ virtual ~XMLTextEmphasizePropHdl_Impl();
+
+ virtual sal_Bool importXML(
+ const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& ) const;
+ virtual sal_Bool exportXML(
+ ::rtl::OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& ) const;
+};
+
+sal_Bool XMLTextEmphasizePropHdl_Impl::importXML(
+ const OUString& rStrImpValue,
+ Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_True;
+ sal_uInt16 nVal = FontEmphasis::NONE;
+ sal_Bool bBelow = sal_False;
+ sal_Bool bHasPos = sal_False, bHasType = sal_False;
+ OUString aToken;
+
+ SvXMLTokenEnumerator aTokenEnum( rStrImpValue );
+ while( aTokenEnum.getNextToken( aToken ) )
+ {
+ if( !bHasPos && IsXMLToken( aToken, XML_ABOVE ) )
+ {
+ bBelow = sal_False;
+ bHasPos = sal_True;
+ }
+ else if( !bHasPos && IsXMLToken( aToken, XML_BELOW ) )
+ {
+ bBelow = sal_True;
+ bHasPos = sal_True;
+ }
+ else if( !bHasType &&
+ SvXMLUnitConverter::convertEnum( nVal, aToken,
+ pXML_Emphasize_Enum ))
+ {
+ bHasType = sal_True;
+ }
+ else
+ {
+ bRet = sal_False;
+ break;
+ }
+ }
+
+ if( bRet )
+ {
+ if( FontEmphasis::NONE != nVal && bBelow )
+ nVal += 10;
+ rValue <<= (sal_Int16)nVal;
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLTextEmphasizePropHdl_Impl::exportXML(
+ OUString& rStrExpValue,
+ const Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ OUStringBuffer aOut( 15 );
+ sal_Bool bRet = sal_True;
+ sal_Int16 nType = sal_Int16();
+ if( rValue >>= nType )
+ {
+ sal_Bool bBelow = sal_False;
+ if( nType > 10 )
+ {
+ bBelow = sal_True;
+ nType -= 10;
+ }
+ bRet = SvXMLUnitConverter::convertEnum( aOut, nType,
+ pXML_Emphasize_Enum,
+ XML_DOT );
+ if( bRet )
+ {
+ if( nType != 0 )
+ {
+ enum XMLTokenEnum ePos = bBelow ? XML_BELOW : XML_ABOVE;
+ aOut.append( (sal_Unicode)' ' );
+ aOut.append( GetXMLToken(ePos) );
+ }
+ rStrExpValue = aOut.makeStringAndClear();
+ }
+ }
+
+ return bRet;
+}
+
+XMLTextEmphasizePropHdl_Impl::~XMLTextEmphasizePropHdl_Impl()
+{
+}
+
+
+// ---------------------------------------------------------------------------
+
+class XMLTextCombineCharPropHdl_Impl : public XMLPropertyHandler
+{
+public:
+ XMLTextCombineCharPropHdl_Impl() {}
+ virtual ~XMLTextCombineCharPropHdl_Impl();
+
+ virtual sal_Bool importXML(
+ const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& ) const;
+ virtual sal_Bool exportXML(
+ ::rtl::OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& ) const;
+};
+
+sal_Bool XMLTextCombineCharPropHdl_Impl::importXML(
+ const OUString& rStrImpValue,
+ Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ if( rStrImpValue.getLength() )
+ rValue <<= rStrImpValue.copy( 0, 1 );
+ else
+ rValue <<= rStrImpValue;
+
+ return sal_True;
+}
+
+sal_Bool XMLTextCombineCharPropHdl_Impl::exportXML(
+ OUString& rStrExpValue,
+ const Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ rValue >>= rStrExpValue;
+
+ // #i114107# attribute of type "character": export only if length is 1
+ return (1 == rStrExpValue.getLength()) ? sal_True : sal_False;
+}
+
+XMLTextCombineCharPropHdl_Impl::~XMLTextCombineCharPropHdl_Impl()
+{
+}
+
+// ---------------------------------------------------------------------------
+
+class XMLTextRelWidthHeightPropHdl_Impl : public XMLPropertyHandler
+{
+public:
+ XMLTextRelWidthHeightPropHdl_Impl() {}
+ virtual ~XMLTextRelWidthHeightPropHdl_Impl();
+
+ virtual sal_Bool importXML(
+ const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& ) const;
+ virtual sal_Bool exportXML(
+ ::rtl::OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& ) const;
+};
+
+sal_Bool XMLTextRelWidthHeightPropHdl_Impl::importXML(
+ const OUString& rStrImpValue,
+ Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet;
+ sal_Int32 nValue;
+ bRet = SvXMLUnitConverter::convertPercent( nValue, rStrImpValue );
+ if( bRet )
+ rValue <<= (sal_Int16)nValue;
+
+ return bRet;
+}
+
+sal_Bool XMLTextRelWidthHeightPropHdl_Impl::exportXML(
+ OUString& rStrExpValue,
+ const Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int16 nValue = sal_Int16();
+ if( (rValue >>= nValue) && nValue > 0 )
+ {
+ OUStringBuffer aOut;
+ SvXMLUnitConverter::convertPercent( aOut, nValue );
+ rStrExpValue = aOut.makeStringAndClear();
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+XMLTextRelWidthHeightPropHdl_Impl::~XMLTextRelWidthHeightPropHdl_Impl()
+{
+}
+
+// ---------------------------------------------------------------------------
+
+class XMLTextSyncWidthHeightPropHdl_Impl : public XMLPropertyHandler
+{
+ const OUString sValue;
+
+public:
+ XMLTextSyncWidthHeightPropHdl_Impl( enum XMLTokenEnum eValue ) :
+ sValue( GetXMLToken(eValue) ) {}
+ virtual ~XMLTextSyncWidthHeightPropHdl_Impl();
+
+ virtual sal_Bool importXML(
+ const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& ) const;
+ virtual sal_Bool exportXML(
+ ::rtl::OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& ) const;
+};
+
+sal_Bool XMLTextSyncWidthHeightPropHdl_Impl::importXML(
+ const OUString& rStrImpValue,
+ Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ sal_Bool bValue = (rStrImpValue == sValue );
+ rValue.setValue( &bValue, ::getBooleanCppuType() );
+
+ return sal_True;
+}
+
+sal_Bool XMLTextSyncWidthHeightPropHdl_Impl::exportXML(
+ OUString& rStrExpValue,
+ const Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ if( *(sal_Bool *)rValue.getValue() )
+ {
+ rStrExpValue = sValue;
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+XMLTextSyncWidthHeightPropHdl_Impl::~XMLTextSyncWidthHeightPropHdl_Impl()
+{
+}
+
+// ---------------------------------------------------------------------------
+
+class XMLTextRotationAnglePropHdl_Impl : public XMLPropertyHandler
+{
+
+public:
+ XMLTextRotationAnglePropHdl_Impl() {}
+ virtual ~XMLTextRotationAnglePropHdl_Impl();
+
+ virtual sal_Bool importXML(
+ const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& ) const;
+ virtual sal_Bool exportXML(
+ ::rtl::OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& ) const;
+};
+
+sal_Bool XMLTextRotationAnglePropHdl_Impl::importXML(
+ const OUString& rStrImpValue,
+ Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ sal_Int32 nValue;
+ sal_Bool bRet = SvXMLUnitConverter::convertNumber( nValue, rStrImpValue );
+ if( bRet )
+ {
+ nValue = (nValue % 360 );
+ if( nValue < 0 )
+ nValue = 360 + nValue;
+ sal_Int16 nAngle;
+ if( nValue < 45 || nValue > 315 )
+ nAngle = 0;
+ else if( nValue < 180 )
+ nAngle = 900;
+ else /* if nValalue <= 315 ) */
+ nAngle = 2700;
+ rValue <<= nAngle;
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLTextRotationAnglePropHdl_Impl::exportXML(
+ OUString& rStrExpValue,
+ const Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ sal_Int16 nAngle = sal_Int16();
+ sal_Bool bRet = ( rValue >>= nAngle );
+ if( bRet )
+ {
+ OUStringBuffer aOut;
+ SvXMLUnitConverter::convertNumber( aOut, nAngle / 10 );
+ rStrExpValue = aOut.makeStringAndClear();
+ }
+ OSL_ENSURE( bRet, "illegal rotation angle" );
+
+ return bRet;
+}
+
+XMLTextRotationAnglePropHdl_Impl::~XMLTextRotationAnglePropHdl_Impl()
+{
+}
+// ---------------------------------------------------------------------------
+class XMLNumber8OneBasedHdl : public XMLPropertyHandler
+{
+
+public:
+ XMLNumber8OneBasedHdl() {}
+ virtual ~XMLNumber8OneBasedHdl() {};
+
+ virtual sal_Bool importXML(
+ const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& ) const;
+ virtual sal_Bool exportXML(
+ ::rtl::OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& ) const;
+};
+
+sal_Bool XMLNumber8OneBasedHdl::importXML(
+ const OUString& rStrImpValue,
+ Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ sal_Int32 nValue = 0;
+ sal_Bool bRet = SvXMLUnitConverter::convertNumber( nValue, rStrImpValue );
+ if( bRet )
+ rValue <<= static_cast<sal_Int8>( nValue - 1 );
+ return bRet;
+}
+
+sal_Bool XMLNumber8OneBasedHdl::exportXML(
+ OUString& rStrExpValue,
+ const Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ sal_Int8 nValue = sal_Int8();
+ sal_Bool bRet = ( rValue >>= nValue );
+ if( bRet )
+ {
+ OUStringBuffer aOut;
+ SvXMLUnitConverter::convertNumber( aOut, nValue + 1 );
+ rStrExpValue = aOut.makeStringAndClear();
+ }
+ return bRet;
+}
+// ---------------------------------------------------------------------------
+class XMLTextPropertyHandlerFactory_Impl
+{
+public:
+ const XMLPropertyHandler *GetPropertyHandler( sal_Int32 nType ) const;
+
+ XMLTextPropertyHandlerFactory_Impl();
+ ~XMLTextPropertyHandlerFactory_Impl();
+};
+
+const XMLPropertyHandler *XMLTextPropertyHandlerFactory_Impl::GetPropertyHandler
+ ( sal_Int32 nType ) const
+{
+ const XMLPropertyHandler* pHdl = 0;
+ switch( nType )
+ {
+ case XML_TYPE_TEXT_DROPCAP:
+ pHdl = new XMLDropCapPropHdl_Impl;
+ break;
+ case XML_TYPE_TEXT_WRAP:
+ pHdl = new XMLWrapPropHdl_Impl;
+ break;
+ case XML_TYPE_TEXT_PARAGRAPH_ONLY:
+ pHdl = new XMLParagraphOnlyPropHdl_Impl;
+ break;
+ case XML_TYPE_TEXT_WRAP_OUTSIDE:
+ pHdl = new XMLContourModePropHdl_Impl;
+ break;
+ case XML_TYPE_TEXT_OPAQUE:
+ pHdl = new XMLOpaquePropHdl_Impl;
+ break;
+ case XML_TYPE_TEXT_PROTECT_CONTENT:
+ pHdl = new XMLFrameProtectPropHdl_Impl( XML_CONTENT );
+ break;
+ case XML_TYPE_TEXT_PROTECT_SIZE:
+ pHdl = new XMLFrameProtectPropHdl_Impl( XML_SIZE );
+ break;
+ case XML_TYPE_TEXT_PROTECT_POSITION:
+ pHdl = new XMLFrameProtectPropHdl_Impl( XML_POSITION );
+ break;
+ case XML_TYPE_TEXT_ANCHOR_TYPE:
+ pHdl = new XMLAnchorTypePropHdl;
+ break;
+ case XML_TYPE_TEXT_COLUMNS:
+ pHdl = new XMLTextColumnsPropertyHandler;
+ break;
+ case XML_TYPE_TEXT_HORIZONTAL_POS:
+ pHdl = new XMLConstantsPropertyHandler( pXML_HoriPos_Enum, XML_TOKEN_INVALID );
+ break;
+ case XML_TYPE_TEXT_HORIZONTAL_POS_MIRRORED:
+ pHdl = new XMLConstantsPropertyHandler( pXML_HoriPosMirrored_Enum, XML_TOKEN_INVALID );
+ break;
+ case XML_TYPE_TEXT_HORIZONTAL_REL:
+ pHdl = new XMLConstantsPropertyHandler( pXML_HoriRel_Enum, XML_TOKEN_INVALID );
+ break;
+ case XML_TYPE_TEXT_HORIZONTAL_REL_FRAME:
+ pHdl = new XMLConstantsPropertyHandler( pXML_HoriRelFrame_Enum, XML_TOKEN_INVALID );
+ break;
+ case XML_TYPE_TEXT_HORIZONTAL_MIRROR:
+ pHdl = new XMLHoriMirrorPropHdl_Impl;
+ break;
+ case XML_TYPE_TEXT_VERTICAL_POS:
+ pHdl = new XMLConstantsPropertyHandler( pXML_VertPos_Enum, XML_TOKEN_INVALID );
+ break;
+ case XML_TYPE_TEXT_VERTICAL_POS_AT_CHAR:
+ pHdl = new XMLConstantsPropertyHandler( pXML_VertPosAtChar_Enum, XML_TOKEN_INVALID );
+ break;
+ case XML_TYPE_TEXT_VERTICAL_REL:
+ pHdl = new XMLConstantsPropertyHandler( pXML_VertRel_Enum, XML_TOKEN_INVALID );
+ break;
+ case XML_TYPE_TEXT_VERTICAL_REL_PAGE:
+ pHdl = new XMLConstantsPropertyHandler( pXML_VertRelPage_Enum, XML_TOKEN_INVALID );
+ break;
+ case XML_TYPE_TEXT_VERTICAL_REL_FRAME:
+ pHdl = new XMLConstantsPropertyHandler( pXML_VertRelFrame_Enum, XML_TOKEN_INVALID );
+ break;
+ case XML_TYPE_TEXT_VERTICAL_REL_AS_CHAR:
+ pHdl = new XMLConstantsPropertyHandler( pXML_VertRelAsChar_Enum, XML_TOKEN_INVALID );
+ break;
+ case XML_TYPE_TEXT_MIRROR_VERTICAL:
+ pHdl = new XMLGrfMirrorPropHdl_Impl( XML_VERTICAL, sal_False );
+ break;
+ case XML_TYPE_TEXT_MIRROR_HORIZONTAL_LEFT:
+ // XML_HORIZONTAL_ON_LEFT_PAGES is replaced by XML_HORIZONTAL_ON_EVEN. (#i49139#)
+ pHdl = new XMLGrfMirrorPropHdl_Impl( XML_HORIZONTAL_ON_EVEN, sal_True );
+ break;
+ case XML_TYPE_TEXT_MIRROR_HORIZONTAL_RIGHT:
+ // XML_HORIZONTAL_ON_RIGHT_PAGES is replaced by XML_HORIZONTAL_ON_ODD. (#i49139#)
+ pHdl = new XMLGrfMirrorPropHdl_Impl( XML_HORIZONTAL_ON_ODD, sal_True );
+ break;
+ case XML_TYPE_TEXT_CLIP:
+ pHdl = new XMLClipPropertyHandler( sal_False );
+ break;
+ case XML_TYPE_TEXT_CLIP11:
+ pHdl = new XMLClipPropertyHandler( sal_True );
+ break;
+ case XML_TYPE_TEXT_EMPHASIZE:
+ pHdl = new XMLTextEmphasizePropHdl_Impl;
+ break;
+ case XML_TYPE_TEXT_COMBINE:
+ pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken( XML_LINES ),
+ GetXMLToken( XML_NONE ) );
+ break;
+ case XML_TYPE_TEXT_COMBINE_CHARACTERS:
+ pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken( XML_LETTERS ),
+ GetXMLToken( XML_NONE ) );
+ break;
+ case XML_TYPE_TEXT_COMBINECHAR:
+ pHdl = new XMLTextCombineCharPropHdl_Impl;
+ break;
+ case XML_TYPE_TEXT_AUTOSPACE:
+ pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken( XML_IDEOGRAPH_ALPHA ),
+ GetXMLToken( XML_NONE ) );
+ break;
+ case XML_TYPE_TEXT_PUNCTUATION_WRAP:
+ pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken( XML_HANGING ),
+ GetXMLToken( XML_SIMPLE ) );
+ break;
+ case XML_TYPE_TEXT_LINE_BREAK:
+ pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken( XML_STRICT ),
+ GetXMLToken( XML_NORMAL ) );
+ break;
+ case XML_TYPE_TEXT_REL_WIDTH_HEIGHT:
+ pHdl = new XMLTextRelWidthHeightPropHdl_Impl;
+ break;
+ case XML_TYPE_TEXT_SYNC_WIDTH_HEIGHT:
+ pHdl = new XMLTextSyncWidthHeightPropHdl_Impl( XML_SCALE );
+ break;
+ case XML_TYPE_TEXT_SYNC_WIDTH_HEIGHT_MIN:
+ pHdl = new XMLTextSyncWidthHeightPropHdl_Impl( XML_SCALE_MIN );
+ break;
+ case XML_TYPE_TEXT_RUBY_ADJUST:
+ pHdl = new XMLConstantsPropertyHandler( pXML_RubyAdjust_Enum, XML_TOKEN_INVALID );
+ break;
+ case XML_TYPE_TEXT_FONT_RELIEF:
+ pHdl = new XMLConstantsPropertyHandler( pXML_FontRelief_Enum, XML_TOKEN_INVALID );
+ break;
+ case XML_TYPE_TEXT_ROTATION_ANGLE:
+ pHdl = new XMLTextRotationAnglePropHdl_Impl;
+ break;
+ case XML_TYPE_TEXT_ROTATION_SCALE:
+ pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken( XML_FIXED ),
+ GetXMLToken( XML_LINE_HEIGHT ) );
+ break;
+ case XML_TYPE_TEXT_VERTICAL_ALIGN:
+ pHdl = new XMLConstantsPropertyHandler( pXML_VerticalAlign_Enum, XML_TOKEN_INVALID );
+ break;
+ case XML_TYPE_TEXT_RUBY_POSITION:
+ pHdl = new XMLNamedBoolPropertyHdl( ::xmloff::token::XML_ABOVE,
+ ::xmloff::token::XML_BELOW );
+ break;
+ // OD 2004-05-05 #i28701#
+ case XML_TYPE_WRAP_INFLUENCE_ON_POSITION:
+ pHdl = new XMLConstantsPropertyHandler( pXML_WrapInfluenceOnPosition_Enum,
+ XML_TOKEN_INVALID );
+ break;
+ case XML_TYPE_BORDER_MODEL:
+ pHdl = new XMLNamedBoolPropertyHdl( xmloff::token::XML_COLLAPSING,
+ xmloff::token::XML_SEPARATING );
+ break;
+ case XML_TYPE_TEXT_LINE_MODE:
+ pHdl = new XMLNamedBoolPropertyHdl(
+ ::xmloff::token::XML_SKIP_WHITE_SPACE,
+ ::xmloff::token::XML_CONTINUOUS);
+ break;
+ case XML_TYPE_TEXT_KEEP:
+ pHdl = new XMLNamedBoolPropertyHdl(
+ ::xmloff::token::XML_ALWAYS,
+ ::xmloff::token::XML_AUTO);
+ break;
+ case XML_TYPE_TEXT_NKEEP:
+ pHdl = new XMLNamedBoolPropertyHdl(
+ ::xmloff::token::XML_AUTO,
+ ::xmloff::token::XML_ALWAYS);
+ break;
+ case XML_TYPE_TEXT_NUMBER8_ONE_BASED:
+ pHdl = new XMLNumber8OneBasedHdl();
+ break;
+ }
+
+ return pHdl;
+}
+
+XMLTextPropertyHandlerFactory_Impl::XMLTextPropertyHandlerFactory_Impl()
+{
+}
+
+XMLTextPropertyHandlerFactory_Impl::~XMLTextPropertyHandlerFactory_Impl()
+{
+}
+
+// ----------------------------------------------------------------------------
+
+XMLTextPropertyHandlerFactory::XMLTextPropertyHandlerFactory() :
+ XMLPropertyHandlerFactory(),
+ pImpl( new XMLTextPropertyHandlerFactory_Impl )
+{
+}
+
+XMLTextPropertyHandlerFactory::~XMLTextPropertyHandlerFactory()
+{
+ delete pImpl;
+}
+
+const XMLPropertyHandler *XMLTextPropertyHandlerFactory::GetPropertyHandler(
+ sal_Int32 nType ) const
+{
+ const XMLPropertyHandler *pHdl =
+ XMLPropertyHandlerFactory::GetPropertyHandler( nType );
+
+ if( !pHdl )
+ {
+ const XMLPropertyHandler *pNewHdl = pImpl->GetPropertyHandler( nType );
+
+ if( pNewHdl )
+ PutHdlCache( nType, pNewHdl );
+
+ pHdl = pNewHdl;
+ }
+
+ return pHdl;
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/txtprhdl.hxx b/xmloff/source/text/txtprhdl.hxx
new file mode 100644
index 000000000000..05241546c142
--- /dev/null
+++ b/xmloff/source/text/txtprhdl.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_TEXTPRHDL_HXX_
+#define _XMLOFF_TEXTPRHDL_HXX_
+
+
+#include <xmloff/prhdlfac.hxx>
+
+class XMLTextPropertyHandlerFactory_Impl;
+
+class XMLTextPropertyHandlerFactory : public XMLPropertyHandlerFactory
+{
+ XMLTextPropertyHandlerFactory_Impl *pImpl;
+
+public:
+
+ XMLTextPropertyHandlerFactory();
+ virtual ~XMLTextPropertyHandlerFactory();
+
+ virtual const XMLPropertyHandler* GetPropertyHandler( sal_Int32 nType ) const ;
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx
new file mode 100644
index 000000000000..d3b5311cfc84
--- /dev/null
+++ b/xmloff/source/text/txtprmap.cxx
@@ -0,0 +1,897 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include "txtprhdl.hxx"
+#include <xmloff/txtprmap.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::xmloff::token;
+
+#define _M_E( a, p, l, t, c ) \
+ { a, sizeof(a)-1, XML_NAMESPACE_##p, XML_##l, t, c, SvtSaveOptions::ODFVER_010 }
+
+#define _M_EV( a, p, l, t, c, v ) \
+ { a, sizeof(a)-1, XML_NAMESPACE_##p, XML_##l, t, c, v }
+
+#define _M_ED( a, p, l, t, c ) \
+ { a, sizeof(a)-1, XML_NAMESPACE_##p, XML_##l, (t) | MID_FLAG_DEFAULT_ITEM_EXPORT, c, SvtSaveOptions::ODFVER_010 }
+
+// text properties
+#define MT_E( a, p, l, t, c ) \
+ _M_E( a, p, l, (t|XML_TYPE_PROP_TEXT), c )
+#define MT_ED( a, p, l, t, c ) \
+ _M_ED( a, p, l, (t|XML_TYPE_PROP_TEXT), c )
+
+// paragraph properties
+#define MP_E( a, p, l, t, c ) \
+ _M_E( a, p, l, (t|XML_TYPE_PROP_PARAGRAPH), c )
+#define MP_ED( a, p, l, t, c ) \
+ _M_ED( a, p, l, (t|XML_TYPE_PROP_PARAGRAPH), c )
+
+// graphic properties
+#define MG_E( a, p, l, t, c ) \
+ _M_E( a, p, l, (t|XML_TYPE_PROP_GRAPHIC), c )
+#define MG_ED( a, p, l, t, c ) \
+ _M_ED( a, p, l, (t|XML_TYPE_PROP_GRAPHIC), c )
+#define MG_EV( a, p, l, t, c, v ) \
+ _M_EV( a, p, l, (t|XML_TYPE_PROP_GRAPHIC), c, v )
+
+// section properties
+#define MS_E( a, p, l, t, c ) \
+ _M_E( a, p, l, (t|XML_TYPE_PROP_SECTION), c )
+#define MS_ED( a, p, l, t, c ) \
+ _M_ED( a, p, l, (t|XML_TYPE_PROP_SECTION), c )
+
+// ruby properties
+#define MR_E( a, p, l, t, c ) \
+ _M_E( a, p, l, (t|XML_TYPE_PROP_RUBY), c )
+#define MR_ED( a, p, l, t, c ) \
+ _M_ED( a, p, l, (t|XML_TYPE_PROP_RUBY), c )
+
+#define M_END() \
+ { NULL, 0, 0, XML_TOKEN_INVALID, 0, 0, SvtSaveOptions::ODFVER_010 }
+
+
+XMLPropertyMapEntry aXMLParaPropMap[] =
+{
+ // RES_UNKNOWNATR_CONTAINER
+ MP_E( "ParaUserDefinedAttributes", TEXT, XMLNS, XML_TYPE_ATTRIBUTE_CONTAINER | MID_FLAG_SPECIAL_ITEM, 0 ),
+ // RES_LR_SPACE
+ MP_E( "ParaLeftMargin", FO, MARGIN_LEFT, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_PARALEFTMARGIN ),
+ MP_E( "ParaLeftMarginRelative", FO, MARGIN_LEFT, XML_TYPE_PERCENT16, CTF_PARALEFTMARGIN_REL ),
+ MP_E( "ParaRightMargin", FO, MARGIN_RIGHT, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_PARARIGHTMARGIN ),
+ MP_E( "ParaRightMarginRelative", FO, MARGIN_RIGHT, XML_TYPE_PERCENT16, CTF_PARARIGHTMARGIN_REL ),
+ // RES_UL_SPACE
+ MP_E( "ParaTopMargin", FO, MARGIN_TOP, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_PARATOPMARGIN ),
+ MP_E( "ParaTopMarginRelative", FO, MARGIN_TOP, XML_TYPE_PERCENT16, CTF_PARATOPMARGIN_REL ),
+ MP_E( "ParaBottomMargin", FO, MARGIN_BOTTOM, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_PARABOTTOMMARGIN ),
+ MP_E( "ParaBottomMarginRelative",FO, MARGIN_BOTTOM, XML_TYPE_PERCENT16, CTF_PARABOTTOMMARGIN_REL ),
+ // RES_CHRATR_CASEMAP
+ MT_E( "CharCaseMap", FO, FONT_VARIANT, XML_TYPE_TEXT_CASEMAP_VAR, 0 ),
+ MT_E( "CharCaseMap", FO, TEXT_TRANSFORM, XML_TYPE_TEXT_CASEMAP, 0 ),
+ // RES_CHRATR_COLOR
+ MT_ED( "CharColor", FO, COLOR, XML_TYPE_COLORAUTO|MID_FLAG_MERGE_PROPERTY, 0 ),
+ MT_ED( "CharColor", STYLE, USE_WINDOW_FONT_COLOR, XML_TYPE_ISAUTOCOLOR|MID_FLAG_MERGE_PROPERTY, 0 ),
+ // RES_CHRATR_CONTOUR
+ MT_E( "CharContoured", STYLE, TEXT_OUTLINE, XML_TYPE_BOOL, 0 ),
+ // RES_CHRATR_CROSSEDOUT
+ MT_E( "CharStrikeout", STYLE, TEXT_LINE_THROUGH_STYLE, XML_TYPE_TEXT_CROSSEDOUT_STYLE|MID_FLAG_MERGE_PROPERTY, 0),
+ MT_E( "CharStrikeout", STYLE, TEXT_LINE_THROUGH_TYPE, XML_TYPE_TEXT_CROSSEDOUT_TYPE|MID_FLAG_MERGE_PROPERTY, 0),
+ MT_E( "CharStrikeout", STYLE, TEXT_LINE_THROUGH_WIDTH, XML_TYPE_TEXT_CROSSEDOUT_WIDTH|MID_FLAG_MERGE_PROPERTY, 0),
+ MT_E( "CharStrikeout", STYLE, TEXT_LINE_THROUGH_TEXT, XML_TYPE_TEXT_CROSSEDOUT_TEXT|MID_FLAG_MERGE_PROPERTY, 0),
+ // RES_CHRATR_ESCAPEMENT
+ MT_E( "CharEscapement", STYLE, TEXT_POSITION, XML_TYPE_TEXT_ESCAPEMENT|MID_FLAG_MERGE_ATTRIBUTE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ MT_E( "CharEscapementHeight", STYLE, TEXT_POSITION, XML_TYPE_TEXT_ESCAPEMENT_HEIGHT|MID_FLAG_MERGE_ATTRIBUTE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ // RES_CHRATR_FONT
+ MT_ED( "CharFontName", STYLE, FONT_NAME, XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_FONTNAME ),
+ MT_ED( "CharFontName", FO, FONT_FAMILY, XML_TYPE_TEXT_FONTFAMILYNAME|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_FONTFAMILYNAME ),
+ MT_ED( "CharFontStyleName",STYLE, FONT_STYLE_NAME, XML_TYPE_STRING, CTF_FONTSTYLENAME ),
+ MT_ED( "CharFontFamily", STYLE, FONT_FAMILY_GENERIC,XML_TYPE_TEXT_FONTFAMILY, CTF_FONTFAMILY ),
+ MT_ED( "CharFontPitch", STYLE, FONT_PITCH, XML_TYPE_TEXT_FONTPITCH, CTF_FONTPITCH ),
+ MT_ED( "CharFontCharSet", STYLE, FONT_CHARSET, XML_TYPE_TEXT_FONTENCODING, CTF_FONTCHARSET ),
+ // RES_CHRATR_FONTSIZE
+ MT_ED( "CharHeight", FO, FONT_SIZE, XML_TYPE_CHAR_HEIGHT|MID_FLAG_MULTI_PROPERTY, CTF_CHARHEIGHT ),
+ MT_ED( "CharPropHeight",FO, FONT_SIZE, XML_TYPE_CHAR_HEIGHT_PROP|MID_FLAG_MULTI_PROPERTY, CTF_CHARHEIGHT_REL ),
+ MT_ED( "CharDiffHeight",STYLE,FONT_SIZE_REL, XML_TYPE_CHAR_HEIGHT_DIFF, CTF_CHARHEIGHT_DIFF ),
+ // RES_CHRATR_KERNING
+ MT_E( "CharKerning", FO, LETTER_SPACING, XML_TYPE_TEXT_KERNING, 0 ),
+ // RES_CHRATR_LANGUAGE
+ MT_ED( "CharLocale", FO, LANGUAGE, XML_TYPE_CHAR_LANGUAGE|MID_FLAG_MERGE_PROPERTY, 0 ),
+ MT_ED( "CharLocale", FO, COUNTRY, XML_TYPE_CHAR_COUNTRY|MID_FLAG_MERGE_PROPERTY, 0 ),
+ // RES_CHRATR_POSTURE
+ MT_E( "CharPosture", FO, FONT_STYLE, XML_TYPE_TEXT_POSTURE, 0 ),
+ // RES_CHRATR_PROPORTIONALFONTSIZE
+ // TODO: not used?
+ // RES_CHRATR_SHADOWED
+ MT_E( "CharShadowed", FO, TEXT_SHADOW, XML_TYPE_TEXT_SHADOWED, 0 ),
+ // RES_CHRATR_UNDERLINE
+ MT_E( "CharUnderline", STYLE, TEXT_UNDERLINE_STYLE, XML_TYPE_TEXT_UNDERLINE_STYLE|MID_FLAG_MERGE_PROPERTY, CTF_UNDERLINE ),
+ MT_E( "CharUnderline", STYLE, TEXT_UNDERLINE_TYPE, XML_TYPE_TEXT_UNDERLINE_TYPE|MID_FLAG_MERGE_PROPERTY, 0 ),
+ MT_E( "CharUnderline", STYLE, TEXT_UNDERLINE_WIDTH, XML_TYPE_TEXT_UNDERLINE_WIDTH|MID_FLAG_MERGE_PROPERTY, 0 ),
+ MT_E( "CharUnderlineColor", STYLE, TEXT_UNDERLINE_COLOR, XML_TYPE_TEXT_UNDERLINE_COLOR|MID_FLAG_MULTI_PROPERTY, CTF_UNDERLINE_COLOR ),
+ MT_E( "CharUnderlineHasColor", STYLE, TEXT_UNDERLINE_COLOR, XML_TYPE_TEXT_UNDERLINE_HASCOLOR|MID_FLAG_MERGE_ATTRIBUTE, CTF_UNDERLINE_HASCOLOR ),
+ // RES_CHRATR_WEIGHT
+ MT_E( "CharWeight", FO, FONT_WEIGHT, XML_TYPE_TEXT_WEIGHT, 0 ),
+ // RES_CHRATR_WORDLINEMODE
+ MT_E( "CharWordMode", STYLE, TEXT_UNDERLINE_MODE, XML_TYPE_TEXT_LINE_MODE|MID_FLAG_MERGE_PROPERTY, 0 ),
+ MT_E( "CharWordMode", STYLE, TEXT_OVERLINE_MODE, XML_TYPE_TEXT_LINE_MODE|MID_FLAG_MERGE_PROPERTY, 0 ),
+ MT_E( "CharWordMode", STYLE, TEXT_LINE_THROUGH_MODE, XML_TYPE_TEXT_LINE_MODE|MID_FLAG_MERGE_PROPERTY, 0 ),
+ // RES_CHRATR_AUTOKERN
+ MT_E( "CharAutoKerning", STYLE, LETTER_KERNING, XML_TYPE_BOOL, 0 ),
+ // RES_CHRATR_BLINK
+ MT_E( "CharFlash", STYLE, TEXT_BLINKING, XML_TYPE_BOOL, 0 ),
+ // RES_CHRATR_NOHYPHEN
+ // TODO: not used?
+ // RES_CHRATR_NOLINEBREAK
+ // TODO: not used?
+ // RES_CHRATR_BACKGROUND
+ MT_E( "CharBackColor", FO, BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY, 0 ),
+ MT_E( "CharBackTransparent", FO, BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
+ MT_E( "CharBackColor", FO, TEXT_BACKGROUND_COLOR, XML_TYPE_COLOR|MID_FLAG_SPECIAL_ITEM_EXPORT, CTF_OLDTEXTBACKGROUND ),
+ // RES_CHRATR_CJK_FONT
+ MT_ED( "CharFontNameAsian", STYLE, FONT_NAME_ASIAN, XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_FONTNAME_CJK ),
+ MT_ED( "CharFontNameAsian", STYLE, FONT_FAMILY_ASIAN, XML_TYPE_TEXT_FONTFAMILYNAME|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_FONTFAMILYNAME_CJK ),
+ MT_ED( "CharFontStyleNameAsian",STYLE, FONT_STYLE_NAME_ASIAN, XML_TYPE_STRING, CTF_FONTSTYLENAME_CJK ),
+ MT_ED( "CharFontFamilyAsian", STYLE, FONT_FAMILY_GENERIC_ASIAN,XML_TYPE_TEXT_FONTFAMILY, CTF_FONTFAMILY_CJK ),
+ MT_ED( "CharFontPitchAsian", STYLE, FONT_PITCH_ASIAN, XML_TYPE_TEXT_FONTPITCH, CTF_FONTPITCH_CJK ),
+ MT_ED( "CharFontCharSetAsian", STYLE, FONT_CHARSET_ASIAN, XML_TYPE_TEXT_FONTENCODING, CTF_FONTCHARSET_CJK ),
+ // RES_CHRATR_CJK_FONTSIZE
+ MT_ED( "CharHeightAsian", STYLE, FONT_SIZE_ASIAN, XML_TYPE_CHAR_HEIGHT|MID_FLAG_MULTI_PROPERTY, CTF_CHARHEIGHT_CJK ),
+ MT_ED( "CharPropHeightAsian",STYLE, FONT_SIZE_ASIAN, XML_TYPE_CHAR_HEIGHT_PROP|MID_FLAG_MULTI_PROPERTY, CTF_CHARHEIGHT_REL_CJK ),
+ MT_ED( "CharDiffHeightAsian",STYLE,FONT_SIZE_REL_ASIAN, XML_TYPE_CHAR_HEIGHT_DIFF, CTF_CHARHEIGHT_DIFF_CJK ),
+ // RES_CHRATR_CJK_LANGUAGE
+ MT_ED( "CharLocaleAsian", STYLE, LANGUAGE_ASIAN, XML_TYPE_CHAR_LANGUAGE|MID_FLAG_MERGE_PROPERTY, 0 ),
+ MT_ED( "CharLocaleAsian", STYLE, COUNTRY_ASIAN, XML_TYPE_CHAR_COUNTRY|MID_FLAG_MERGE_PROPERTY, 0 ),
+ // RES_CHRATR_CJK_POSTURE
+ MT_E( "CharPostureAsian", STYLE, FONT_STYLE_ASIAN, XML_TYPE_TEXT_POSTURE, 0 ),
+ // RES_CHRATR_CJK_WEIGHT
+ MT_E( "CharWeightAsian", STYLE, FONT_WEIGHT_ASIAN, XML_TYPE_TEXT_WEIGHT, 0 ),
+ // RES_CHRATR_CTL_FONT
+ MT_ED( "CharFontNameComplex", STYLE, FONT_NAME_COMPLEX, XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_FONTNAME_CTL ),
+ MT_ED( "CharFontNameComplex", STYLE, FONT_FAMILY_COMPLEX, XML_TYPE_TEXT_FONTFAMILYNAME|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_FONTFAMILYNAME_CTL ),
+ MT_ED( "CharFontStyleNameComplex",STYLE, FONT_STYLE_NAME_COMPLEX, XML_TYPE_STRING, CTF_FONTSTYLENAME_CTL ),
+ MT_ED( "CharFontFamilyComplex", STYLE, FONT_FAMILY_GENERIC_COMPLEX,XML_TYPE_TEXT_FONTFAMILY, CTF_FONTFAMILY_CTL ),
+ MT_ED( "CharFontPitchComplex", STYLE, FONT_PITCH_COMPLEX, XML_TYPE_TEXT_FONTPITCH, CTF_FONTPITCH_CTL ),
+ MT_ED( "CharFontCharSetComplex", STYLE, FONT_CHARSET_COMPLEX, XML_TYPE_TEXT_FONTENCODING, CTF_FONTCHARSET_CTL ),
+ // RES_CHRATR_CTL_FONTSIZE
+ MT_ED( "CharHeightComplex", STYLE, FONT_SIZE_COMPLEX, XML_TYPE_CHAR_HEIGHT|MID_FLAG_MULTI_PROPERTY, CTF_CHARHEIGHT_CTL ),
+ MT_ED( "CharPropHeightComplex",STYLE, FONT_SIZE_COMPLEX, XML_TYPE_CHAR_HEIGHT_PROP|MID_FLAG_MULTI_PROPERTY, CTF_CHARHEIGHT_REL_CTL ),
+ MT_ED( "CharDiffHeightComplex",STYLE,FONT_SIZE_REL_COMPLEX, XML_TYPE_CHAR_HEIGHT_DIFF, CTF_CHARHEIGHT_DIFF_CTL ),
+ // RES_CHRATR_CTL_LANGUAGE
+ MT_ED( "CharLocaleComplex", STYLE, LANGUAGE_COMPLEX, XML_TYPE_CHAR_LANGUAGE|MID_FLAG_MERGE_PROPERTY, 0 ),
+ MT_ED( "CharLocaleComplex", STYLE, COUNTRY_COMPLEX, XML_TYPE_CHAR_COUNTRY|MID_FLAG_MERGE_PROPERTY, 0 ),
+ // RES_CHRATR_CTL_POSTURE
+ MT_E( "CharPostureComplex", STYLE, FONT_STYLE_COMPLEX, XML_TYPE_TEXT_POSTURE, 0 ),
+ // RES_CHRATR_CTL_WEIGHT
+ MT_E( "CharWeightComplex", STYLE, FONT_WEIGHT_COMPLEX, XML_TYPE_TEXT_WEIGHT, 0 ),
+ // RES_CHRATR_ROTATE
+ MT_E( "CharRotation", STYLE, TEXT_ROTATION_ANGLE, XML_TYPE_TEXT_ROTATION_ANGLE, 0 ),
+ MT_E( "CharRotationIsFitToLine", STYLE, TEXT_ROTATION_SCALE, XML_TYPE_TEXT_ROTATION_SCALE, 0 ),
+ // RES_CHRATR_EMPHASIS_MARK
+ MT_E( "CharEmphasis", STYLE, TEXT_EMPHASIZE, XML_TYPE_TEXT_EMPHASIZE, 0 ),
+ // RES_CHRATR_TWO_LINES
+ MT_E( "CharCombineIsOn", STYLE, TEXT_COMBINE, XML_TYPE_TEXT_COMBINE, 0 ),
+ MT_E( "CharCombinePrefix", STYLE, TEXT_COMBINE_START_CHAR, XML_TYPE_TEXT_COMBINECHAR, 0 ),
+ MT_E( "CharCombineSuffix", STYLE, TEXT_COMBINE_END_CHAR, XML_TYPE_TEXT_COMBINECHAR, 0 ),
+ // RES_CHRATR_SCALEW
+ MT_E( "CharScaleWidth", STYLE, TEXT_SCALE, XML_TYPE_PERCENT16, 0 ),
+ //RES_CHRATR_RELIEF
+ MT_E( "CharRelief", STYLE, FONT_RELIEF, XML_TYPE_TEXT_FONT_RELIEF, 0 ),
+ // RES_CHRATR_HIDDEN
+ MT_E( "CharHidden", TEXT, DISPLAY, XML_TYPE_TEXT_HIDDEN_AS_DISPLAY|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_TEXT_DISPLAY ),
+ // RES_CHRATR_OVERLINE
+ MT_E( "CharOverline", STYLE, TEXT_OVERLINE_STYLE, XML_TYPE_TEXT_OVERLINE_STYLE|MID_FLAG_MERGE_PROPERTY, 0 ),
+ MT_E( "CharOverline", STYLE, TEXT_OVERLINE_TYPE, XML_TYPE_TEXT_OVERLINE_TYPE|MID_FLAG_MERGE_PROPERTY, 0 ),
+ MT_E( "CharOverline", STYLE, TEXT_OVERLINE_WIDTH, XML_TYPE_TEXT_OVERLINE_WIDTH|MID_FLAG_MERGE_PROPERTY, 0 ),
+ MT_E( "CharOverlineColor", STYLE, TEXT_OVERLINE_COLOR, XML_TYPE_TEXT_OVERLINE_COLOR|MID_FLAG_MULTI_PROPERTY, 0 ),
+ MT_E( "CharOverlineHasColor", STYLE, TEXT_OVERLINE_COLOR, XML_TYPE_TEXT_OVERLINE_HASCOLOR|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
+
+ // RES_TXTATR_INETFMT
+ // TODO
+ // RES_TXTATR_REFMARK
+ // TODO
+ // RES_TXTATR_TOXMARK
+ // TODO
+ // RES_TXTATR_CHARFMT
+// M_E_SI( TEXT, style_name, RES_TXTATR_CHARFMT, 0 ),
+ // RES_TXTATR_CJK_RUBY
+ // TODO
+ // RES_TXTATR_FIELD
+ // TODO
+ // RES_TXTATR_FLYCNT
+ // TODO
+ // RES_TXTATR_FTN
+ // TODO
+ // RES_TXTATR_SOFTHYPH
+ // TODO
+ // RES_TXTATR_HARDBLANK
+ // TODO
+
+ // RES_PARATR_LINESPACING
+ MP_E( "ParaLineSpacing", FO, LINE_HEIGHT, XML_TYPE_LINE_SPACE_FIXED, 0 ),
+ MP_E( "ParaLineSpacing", STYLE, LINE_HEIGHT_AT_LEAST, XML_TYPE_LINE_SPACE_MINIMUM, 0 ),
+ MP_E( "ParaLineSpacing", STYLE, LINE_SPACING, XML_TYPE_LINE_SPACE_DISTANCE, 0 ),
+ // RES_PARATR_ADJUST
+ MP_E( "ParaAdjust", FO, TEXT_ALIGN, XML_TYPE_TEXT_ADJUST, CTF_SD_SHAPE_PARA_ADJUST ),
+ MP_E( "ParaLastLineAdjust", FO, TEXT_ALIGN_LAST, XML_TYPE_TEXT_ADJUSTLAST, CTF_PARA_ADJUSTLAST ),
+ MP_E( "ParaExpandSingleWord",STYLE, JUSTIFY_SINGLE_WORD,XML_TYPE_BOOL, 0 ),
+ // RES_PARATR_SPLIT
+ MP_E( "ParaSplit", FO, KEEP_TOGETHER, XML_TYPE_TEXT_SPLIT, 0 ),
+ // RES_PARATR_ORPHANS
+ MP_E( "ParaOrphans", FO, ORPHANS, XML_TYPE_NUMBER8, 0 ),
+ // RES_PARATR_WIDOWS
+ MP_E( "ParaWidows", FO, WIDOWS, XML_TYPE_NUMBER8, 0 ),
+ // RES_PARATR_TABSTOP
+ MP_ED( "ParaTabStops", STYLE, TAB_STOPS, MID_FLAG_ELEMENT_ITEM|XML_TYPE_TEXT_TABSTOP, CTF_TABSTOP ), // this is not realy a string!
+ // RES_PARATR_HYPHENZONE
+ MT_E( "ParaIsHyphenation", FO, HYPHENATE, XML_TYPE_BOOL, 0 ),
+ MT_E( "ParaHyphenationMaxLeadingChars", FO, HYPHENATION_REMAIN_CHAR_COUNT, XML_TYPE_NUMBER16, 0 ),
+ MT_E( "ParaHyphenationMaxTrailingChars",FO, HYPHENATION_PUSH_CHAR_COUNT, XML_TYPE_NUMBER16, 0 ),
+ MP_E( "ParaHyphenationMaxHyphens", FO, HYPHENATION_LADDER_COUNT, XML_TYPE_NUMBER16_NONE, 0 ),
+ // RES_PARATR_DROP
+ MP_E( "DropCapWholeWord", STYLE, LENGTH, MID_FLAG_SPECIAL_ITEM|XML_TYPE_BOOL, CTF_DROPCAPWHOLEWORD ),
+ MP_E( "DropCapCharStyleName", STYLE, STYLE_NAME, MID_FLAG_SPECIAL_ITEM|XML_TYPE_STRING, CTF_DROPCAPCHARSTYLE ),
+ MP_E( "DropCapFormat", STYLE, DROP_CAP, MID_FLAG_ELEMENT_ITEM|XML_TYPE_TEXT_DROPCAP, CTF_DROPCAPFORMAT ),
+ // RES_PARATR_REGISTER
+ MP_E( "ParaRegisterModeActive", STYLE, REGISTER_TRUE, XML_TYPE_BOOL, 0 ),
+ // RES_PARATR_NUMRULE
+ MP_E( "NumberingStyleName", STYLE, LIST_STYLE_NAME, MID_FLAG_SPECIAL_ITEM|XML_TYPE_STYLENAME, CTF_NUMBERINGSTYLENAME ),
+ MP_E( "NumberingRules", TEXT, ENABLE_NUMBERING, MID_FLAG_NO_PROPERTY|XML_TYPE_BOOL, CTF_ALIEN_ATTRIBUTE_IMPORT ),
+
+ // RES_FILL_ORDER
+ // not required
+ // RES_FRM_SIZE
+ // not required
+ // RES_PAPER_BIN
+ // not required
+ // RES_LR_SPACE
+
+ MP_E( "ParaFirstLineIndent", FO, TEXT_INDENT, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_PARAFIRSTLINE ),
+ MP_E( "ParaFirstLineIndentRelative", FO, TEXT_INDENT, XML_TYPE_PERCENT, CTF_PARAFIRSTLINE_REL ),
+ MP_E( "ParaIsAutoFirstLineIndent", STYLE, AUTO_TEXT_INDENT, XML_TYPE_BOOL, 0 ),
+ // RES_PAGEDESC
+ MP_E( "PageDescName", STYLE, MASTER_PAGE_NAME, MID_FLAG_SPECIAL_ITEM|XML_TYPE_STYLENAME, CTF_PAGEDESCNAME ),
+ MP_E( "PageNumberOffset", STYLE, PAGE_NUMBER, XML_TYPE_NUMBER16_AUTO, 0 ),
+ // RES_BREAK : TODO: does this work?
+ MP_E( "BreakType", FO, BREAK_BEFORE, XML_TYPE_TEXT_BREAKBEFORE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ MP_E( "BreakType", FO, BREAK_AFTER, XML_TYPE_TEXT_BREAKAFTER, 0 ),
+ // RES_CNTNT
+ // not required
+ // RES_HEADER
+ // not required
+ // RES_FOOTER
+ // not required
+ // RES_PRINT
+ // not required
+ // RES_OPAQUE
+ // not required
+ // RES_PROTECT
+ // not required
+ // RES_SURROUND
+ // not required
+ // RES_VERT_ORIENT
+ // not required
+ // RES_HORI_ORIENT
+ // not required
+ // RES_ANCHOR
+ // not required
+ // RES_BACKGROUND
+ MP_E( "ParaBackColor", FO, BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY, 0 ),
+ MP_E( "ParaBackTransparent", FO, BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
+ MP_E( "ParaBackGraphicLocation", STYLE, POSITION, MID_FLAG_SPECIAL_ITEM|XML_TYPE_BUILDIN_CMP_ONLY, CTF_BACKGROUND_POS ),
+ MP_E( "ParaBackGraphicFilter",STYLE, FILTER_NAME, MID_FLAG_SPECIAL_ITEM|XML_TYPE_STRING, CTF_BACKGROUND_FILTER ),
+ MP_E( "ParaBackGraphicURL", STYLE, BACKGROUND_IMAGE, MID_FLAG_ELEMENT_ITEM|XML_TYPE_STRING, CTF_BACKGROUND_URL ),
+ // RES_BOX
+ MP_E( "LeftBorder", STYLE, BORDER_LINE_WIDTH, XML_TYPE_BORDER_WIDTH, CTF_ALLBORDERWIDTH ),
+ MP_E( "LeftBorder", STYLE, BORDER_LINE_WIDTH_LEFT, XML_TYPE_BORDER_WIDTH, CTF_LEFTBORDERWIDTH ),
+ MP_E( "RightBorder", STYLE, BORDER_LINE_WIDTH_RIGHT, XML_TYPE_BORDER_WIDTH, CTF_RIGHTBORDERWIDTH ),
+ MP_E( "TopBorder", STYLE, BORDER_LINE_WIDTH_TOP, XML_TYPE_BORDER_WIDTH, CTF_TOPBORDERWIDTH ),
+ MP_E( "BottomBorder", STYLE, BORDER_LINE_WIDTH_BOTTOM, XML_TYPE_BORDER_WIDTH, CTF_BOTTOMBORDERWIDTH ),
+
+ MP_E( "LeftBorderDistance", FO, PADDING, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_ALLBORDERDISTANCE ), // need special import filtering
+ MP_E( "LeftBorderDistance", FO, PADDING_LEFT, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_LEFTBORDERDISTANCE ),
+ MP_E( "RightBorderDistance", FO, PADDING_RIGHT, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_RIGHTBORDERDISTANCE ),
+ MP_E( "TopBorderDistance", FO, PADDING_TOP, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_TOPBORDERDISTANCE ),
+ MP_E( "BottomBorderDistance",FO, PADDING_BOTTOM, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_BOTTOMBORDERDISTANCE ),
+
+ MP_E( "LeftBorder", FO, BORDER, XML_TYPE_BORDER, CTF_ALLBORDER ),
+ MP_E( "LeftBorder", FO, BORDER_LEFT, XML_TYPE_BORDER, CTF_LEFTBORDER ),
+ MP_E( "RightBorder", FO, BORDER_RIGHT, XML_TYPE_BORDER, CTF_RIGHTBORDER ),
+ MP_E( "TopBorder", FO, BORDER_TOP, XML_TYPE_BORDER, CTF_TOPBORDER ),
+ MP_E( "BottomBorder", FO, BORDER_BOTTOM, XML_TYPE_BORDER, CTF_BOTTOMBORDER ),
+ // RES_SHADOW
+ MP_E( "ParaShadowFormat", STYLE, SHADOW, XML_TYPE_TEXT_SHADOW, 0 ),
+ // RES_FRMMACRO
+ // not required
+ // RES_COL
+ // not required
+ // RES_KEEP
+ MP_E( "ParaKeepTogether", FO, KEEP_WITH_NEXT, XML_TYPE_TEXT_KEEP, 0 ),
+ // RES_URL
+ // not required
+ // RES_EDIT_IN_READONLY
+ // not required
+ // RES_LAYOUT_SPLIT
+ // not required
+ // RES_CHAIN
+ // not required
+
+ // RES_LINENUMBER
+ MP_E( "ParaLineNumberCount", TEXT, NUMBER_LINES, XML_TYPE_BOOL, 0 ),
+ MP_E( "ParaLineNumberStartValue", TEXT, LINE_NUMBER, XML_TYPE_NUMBER, 0 ),
+
+ // RES_FTN_AT_TXTEND
+ // not required
+ // RES_END_AT_TXTEND
+ // not required
+ MP_ED( "ParaIsCharacterDistance", STYLE, TEXT_AUTOSPACE, XML_TYPE_TEXT_AUTOSPACE, 0 ),
+ MP_ED( "ParaIsHangingPunctuation", STYLE, PUNCTUATION_WRAP, XML_TYPE_TEXT_PUNCTUATION_WRAP, 0 ),
+ MP_ED( "ParaIsForbiddenRules", STYLE, LINE_BREAK, XML_TYPE_TEXT_LINE_BREAK, 0 ),
+ MP_E( "TabStopDistance", STYLE, TAB_STOP_DISTANCE, XML_TYPE_MEASURE, 0 ),
+
+ // RES_PARATR_VERTALIGN
+ MP_E( "ParaVertAlignment", STYLE, VERTICAL_ALIGN, XML_TYPE_TEXT_VERTICAL_ALIGN, 0 ),
+
+ // RES_PARATR_SNAPTOGRID
+ MP_E( "SnapToGrid", STYLE, SNAP_TO_LAYOUT_GRID, XML_TYPE_BOOL, 0 ),
+
+ MP_ED( "WritingMode", STYLE, WRITING_MODE, XML_TYPE_TEXT_WRITING_MODE_WITH_DEFAULT, CTF_TEXTWRITINGMODE ),
+
+ MP_E( "ParaIsConnectBorder", STYLE, JOIN_BORDER, XML_TYPE_BOOL, 0 ),
+
+ MP_E( "DefaultOutlineLevel", STYLE, DEFAULT_OUTLINE_LEVEL, XML_TYPE_TEXT_NUMBER8_ONE_BASED|MID_FLAG_SPECIAL_ITEM_EXPORT|MID_FLAG_NO_PROPERTY_IMPORT, CTF_DEFAULT_OUTLINE_LEVEL ),
+
+ MP_ED( "FontIndependentLineSpacing", STYLE, FONT_INDEPENDENT_LINE_SPACING, XML_TYPE_BOOL, 0 ),
+
+ M_END()
+};
+
+
+XMLPropertyMapEntry aXMLAdditionalTextDefaultsMap[] =
+{
+ // RES_FOLLOW_TEXT_FLOW - DVO, OD 01.10.2003 #i18732#
+ MG_ED( "IsFollowingTextFlow", STYLE, FLOW_WITH_TEXT, XML_TYPE_BOOL, 0 ),
+
+ // OD 2004-05-05 #i28701# - RES_WRAP_INFLUENCE_ON_OBJPOS
+ MG_ED( "WrapInfluenceOnPosition", DRAW, WRAP_INFLUENCE_ON_POSITION, XML_TYPE_WRAP_INFLUENCE_ON_POSITION, 0 ),
+
+ M_END()
+};
+
+XMLPropertyMapEntry aXMLTextPropMap[] =
+{
+ // RES_CHRATR_CASEMAP
+ MT_E( "CharCaseMap", FO, FONT_VARIANT, XML_TYPE_TEXT_CASEMAP_VAR, 0 ),
+ MT_E( "CharCaseMap", FO, TEXT_TRANSFORM, XML_TYPE_TEXT_CASEMAP, 0 ),
+ // RES_CHRATR_COLOR
+ MT_ED( "CharColor", FO, COLOR, XML_TYPE_COLORAUTO|MID_FLAG_MERGE_PROPERTY, 0 ),
+ MT_ED( "CharColor", STYLE, USE_WINDOW_FONT_COLOR, XML_TYPE_ISAUTOCOLOR|MID_FLAG_MERGE_PROPERTY, 0 ),
+ // RES_CHRATR_CONTOUR
+ MT_E( "CharContoured", STYLE, TEXT_OUTLINE, XML_TYPE_BOOL, 0 ),
+ // RES_CHRATR_CROSSEDOUT
+ MT_E( "CharStrikeout", STYLE, TEXT_LINE_THROUGH_STYLE, XML_TYPE_TEXT_CROSSEDOUT_STYLE|MID_FLAG_MERGE_PROPERTY, 0),
+ MT_E( "CharStrikeout", STYLE, TEXT_LINE_THROUGH_TYPE, XML_TYPE_TEXT_CROSSEDOUT_TYPE|MID_FLAG_MERGE_PROPERTY, 0),
+ MT_E( "CharStrikeout", STYLE, TEXT_LINE_THROUGH_WIDTH, XML_TYPE_TEXT_CROSSEDOUT_WIDTH|MID_FLAG_MERGE_PROPERTY, 0),
+ MT_E( "CharStrikeout", STYLE, TEXT_LINE_THROUGH_TEXT, XML_TYPE_TEXT_CROSSEDOUT_TEXT|MID_FLAG_MERGE_PROPERTY, 0),
+ // RES_CHRATR_ESCAPEMENT
+ MT_E( "CharEscapement", STYLE, TEXT_POSITION, XML_TYPE_TEXT_ESCAPEMENT|MID_FLAG_MERGE_ATTRIBUTE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ MT_E( "CharEscapementHeight", STYLE, TEXT_POSITION, XML_TYPE_TEXT_ESCAPEMENT_HEIGHT|MID_FLAG_MERGE_ATTRIBUTE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ // RES_CHRATR_FONT
+ MT_ED( "CharFontName", STYLE, FONT_NAME, XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_FONTNAME ),
+ MT_ED( "CharFontName", FO, FONT_FAMILY, XML_TYPE_TEXT_FONTFAMILYNAME|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_FONTFAMILYNAME ),
+ MT_ED( "CharFontStyleName",STYLE, FONT_STYLE_NAME, XML_TYPE_STRING, CTF_FONTSTYLENAME ),
+ MT_ED( "CharFontFamily", STYLE, FONT_FAMILY_GENERIC,XML_TYPE_TEXT_FONTFAMILY, CTF_FONTFAMILY ),
+ MT_ED( "CharFontPitch", STYLE, FONT_PITCH, XML_TYPE_TEXT_FONTPITCH, CTF_FONTPITCH ),
+ MT_ED( "CharFontCharSet", STYLE, FONT_CHARSET, XML_TYPE_TEXT_FONTENCODING, CTF_FONTCHARSET ),
+ // RES_CHRATR_FONTSIZE
+ MT_ED( "CharHeight", FO, FONT_SIZE, XML_TYPE_CHAR_HEIGHT|MID_FLAG_MULTI_PROPERTY, CTF_CHARHEIGHT ),
+ MT_ED( "CharPropHeight",FO, FONT_SIZE, XML_TYPE_CHAR_HEIGHT_PROP|MID_FLAG_MULTI_PROPERTY, CTF_CHARHEIGHT_REL ),
+ MT_ED( "CharDiffHeight",STYLE,FONT_SIZE_REL, XML_TYPE_CHAR_HEIGHT_DIFF, CTF_CHARHEIGHT_DIFF ),
+ // RES_CHRATR_KERNING
+ MT_E( "CharKerning", FO, LETTER_SPACING, XML_TYPE_TEXT_KERNING, 0 ),
+ // RES_CHRATR_LANGUAGE
+ MT_ED( "CharLocale", FO, LANGUAGE, XML_TYPE_CHAR_LANGUAGE|MID_FLAG_MERGE_PROPERTY, 0 ),
+ MT_ED( "CharLocale", FO, COUNTRY, XML_TYPE_CHAR_COUNTRY|MID_FLAG_MERGE_PROPERTY, 0 ),
+ // RES_CHRATR_POSTURE
+ MT_E( "CharPosture", FO, FONT_STYLE, XML_TYPE_TEXT_POSTURE, 0 ),
+ // RES_CHRATR_PROPORTIONALFONTSIZE
+ // TODO: not used?
+ // RES_CHRATR_SHADOWED
+ MT_E( "CharShadowed", FO, TEXT_SHADOW, XML_TYPE_TEXT_SHADOWED, 0 ),
+ // BIS HIER GEPRUEFT!
+ // RES_CHRATR_UNDERLINE
+ MT_E( "CharUnderline", STYLE, TEXT_UNDERLINE_STYLE, XML_TYPE_TEXT_UNDERLINE_STYLE|MID_FLAG_MERGE_PROPERTY, CTF_UNDERLINE ),
+ MT_E( "CharUnderline", STYLE, TEXT_UNDERLINE_TYPE, XML_TYPE_TEXT_UNDERLINE_TYPE|MID_FLAG_MERGE_PROPERTY, 0 ),
+ MT_E( "CharUnderline", STYLE, TEXT_UNDERLINE_WIDTH, XML_TYPE_TEXT_UNDERLINE_WIDTH|MID_FLAG_MERGE_PROPERTY, 0 ),
+ MT_E( "CharUnderlineColor", STYLE, TEXT_UNDERLINE_COLOR, XML_TYPE_TEXT_UNDERLINE_COLOR|MID_FLAG_MULTI_PROPERTY, CTF_UNDERLINE_COLOR ),
+ MT_E( "CharUnderlineHasColor", STYLE, TEXT_UNDERLINE_COLOR, XML_TYPE_TEXT_UNDERLINE_HASCOLOR|MID_FLAG_MERGE_ATTRIBUTE, CTF_UNDERLINE_HASCOLOR ),
+ // RES_CHRATR_WEIGHT
+ MT_E( "CharWeight", FO, FONT_WEIGHT, XML_TYPE_TEXT_WEIGHT, 0 ),
+ // RES_CHRATR_WORDLINEMODE
+ MT_E( "CharWordMode", STYLE, TEXT_UNDERLINE_MODE, XML_TYPE_TEXT_LINE_MODE|MID_FLAG_MERGE_PROPERTY, 0 ),
+ MT_E( "CharWordMode", STYLE, TEXT_OVERLINE_MODE, XML_TYPE_TEXT_LINE_MODE|MID_FLAG_MERGE_PROPERTY, 0 ),
+ MT_E( "CharWordMode", STYLE, TEXT_LINE_THROUGH_MODE, XML_TYPE_TEXT_LINE_MODE|MID_FLAG_MERGE_PROPERTY, 0 ),
+ // RES_CHRATR_AUTOKERN
+ MT_E( "CharAutoKerning", STYLE, LETTER_KERNING, XML_TYPE_BOOL, 0 ),
+ // RES_CHRATR_BLINK
+ MT_E( "CharFlash", STYLE, TEXT_BLINKING, XML_TYPE_BOOL, 0 ),
+ // RES_CHRATR_NOHYPHEN
+ // TODO: not used?
+ // RES_CHRATR_NOLINEBREAK
+ // TODO: not used?
+ // RES_CHRATR_BACKGROUND
+ MT_E( "CharBackColor", FO, BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY, 0 ),
+ MT_E( "CharBackTransparent", FO, BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
+ MT_E( "CharBackColor", FO, TEXT_BACKGROUND_COLOR, XML_TYPE_COLOR|MID_FLAG_SPECIAL_ITEM_EXPORT, CTF_OLDTEXTBACKGROUND ),
+ // RES_CHRATR_CJK_FONT
+ MT_ED( "CharFontNameAsian", STYLE, FONT_NAME_ASIAN, XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_FONTNAME_CJK ),
+ MT_ED( "CharFontNameAsian", STYLE, FONT_FAMILY_ASIAN, XML_TYPE_TEXT_FONTFAMILYNAME|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_FONTFAMILYNAME_CJK ),
+ MT_ED( "CharFontStyleNameAsian",STYLE, FONT_STYLE_NAME_ASIAN, XML_TYPE_STRING, CTF_FONTSTYLENAME_CJK ),
+ MT_ED( "CharFontFamilyAsian", STYLE, FONT_FAMILY_GENERIC_ASIAN,XML_TYPE_TEXT_FONTFAMILY, CTF_FONTFAMILY_CJK ),
+ MT_ED( "CharFontPitchAsian", STYLE, FONT_PITCH_ASIAN, XML_TYPE_TEXT_FONTPITCH, CTF_FONTPITCH_CJK ),
+ MT_ED( "CharFontCharSetAsian", STYLE, FONT_CHARSET_ASIAN, XML_TYPE_TEXT_FONTENCODING, CTF_FONTCHARSET_CJK ),
+ // RES_CHRATR_CJK_FONTSIZE
+ MT_ED( "CharHeightAsian", STYLE, FONT_SIZE_ASIAN, XML_TYPE_CHAR_HEIGHT|MID_FLAG_MULTI_PROPERTY, CTF_CHARHEIGHT_CJK ),
+ MT_ED( "CharPropHeightAsian",STYLE, FONT_SIZE_ASIAN, XML_TYPE_CHAR_HEIGHT_PROP|MID_FLAG_MULTI_PROPERTY, CTF_CHARHEIGHT_REL_CJK ),
+ MT_ED( "CharDiffHeightAsian",STYLE,FONT_SIZE_REL_ASIAN, XML_TYPE_CHAR_HEIGHT_DIFF, CTF_CHARHEIGHT_DIFF_CJK ),
+ // RES_CHRATR_CJK_LANGUAGE
+ MT_ED( "CharLocaleAsian", STYLE, LANGUAGE_ASIAN, XML_TYPE_CHAR_LANGUAGE|MID_FLAG_MERGE_PROPERTY, 0 ),
+ MT_ED( "CharLocaleAsian", STYLE, COUNTRY_ASIAN, XML_TYPE_CHAR_COUNTRY|MID_FLAG_MERGE_PROPERTY, 0 ),
+ // RES_CHRATR_CJK_POSTURE
+ MT_E( "CharPostureAsian", STYLE, FONT_STYLE_ASIAN, XML_TYPE_TEXT_POSTURE, 0 ),
+ // RES_CHRATR_CJK_WEIGHT
+ MT_E( "CharWeightAsian", STYLE, FONT_WEIGHT_ASIAN, XML_TYPE_TEXT_WEIGHT, 0 ),
+ // RES_CHRATR_CTL_FONT
+ MT_ED( "CharFontNameComplex", STYLE, FONT_NAME_COMPLEX, XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_FONTNAME_CTL ),
+ MT_ED( "CharFontNameComplex", STYLE, FONT_FAMILY_COMPLEX, XML_TYPE_TEXT_FONTFAMILYNAME|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_FONTFAMILYNAME_CTL ),
+ MT_ED( "CharFontStyleNameComplex",STYLE, FONT_STYLE_NAME_COMPLEX, XML_TYPE_STRING, CTF_FONTSTYLENAME_CTL ),
+ MT_ED( "CharFontFamilyComplex", STYLE, FONT_FAMILY_GENERIC_COMPLEX,XML_TYPE_TEXT_FONTFAMILY, CTF_FONTFAMILY_CTL ),
+ MT_ED( "CharFontPitchComplex", STYLE, FONT_PITCH_COMPLEX, XML_TYPE_TEXT_FONTPITCH, CTF_FONTPITCH_CTL ),
+ MT_ED( "CharFontCharSetComplex", STYLE, FONT_CHARSET_COMPLEX, XML_TYPE_TEXT_FONTENCODING, CTF_FONTCHARSET_CTL ),
+ // RES_CHRATR_CTL_FONTSIZE
+ MT_ED( "CharHeightComplex", STYLE, FONT_SIZE_COMPLEX, XML_TYPE_CHAR_HEIGHT|MID_FLAG_MULTI_PROPERTY, CTF_CHARHEIGHT_CTL ),
+ MT_ED( "CharPropHeightComplex",STYLE, FONT_SIZE_COMPLEX, XML_TYPE_CHAR_HEIGHT_PROP|MID_FLAG_MULTI_PROPERTY, CTF_CHARHEIGHT_REL_CTL ),
+ MT_ED( "CharDiffHeightComplex",STYLE,FONT_SIZE_REL_COMPLEX, XML_TYPE_CHAR_HEIGHT_DIFF, CTF_CHARHEIGHT_DIFF_CTL ),
+ // RES_CHRATR_CTL_LANGUAGE
+ MT_ED( "CharLocaleComplex", STYLE, LANGUAGE_COMPLEX, XML_TYPE_CHAR_LANGUAGE|MID_FLAG_MERGE_PROPERTY, 0 ),
+ MT_ED( "CharLocaleComplex", STYLE, COUNTRY_COMPLEX, XML_TYPE_CHAR_COUNTRY|MID_FLAG_MERGE_PROPERTY, 0 ),
+ // RES_CHRATR_CTL_POSTURE
+ MT_E( "CharPostureComplex", STYLE, FONT_STYLE_COMPLEX, XML_TYPE_TEXT_POSTURE, 0 ),
+ // RES_CHRATR_CTL_WEIGHT
+ MT_E( "CharWeightComplex", STYLE, FONT_WEIGHT_COMPLEX, XML_TYPE_TEXT_WEIGHT, 0 ),
+ // RES_CHRATR_ROTATE
+ MT_E( "CharRotation", STYLE, TEXT_ROTATION_ANGLE, XML_TYPE_TEXT_ROTATION_ANGLE, 0 ),
+ MT_E( "CharRotationIsFitToLine", STYLE, TEXT_ROTATION_SCALE, XML_TYPE_TEXT_ROTATION_SCALE, 0 ),
+ // RES_CHRATR_EMPHASIS_MARK
+ MT_E( "CharEmphasis", STYLE, TEXT_EMPHASIZE, XML_TYPE_TEXT_EMPHASIZE, 0 ),
+ // RES_CHRATR_TWO_LINES
+ MT_E( "CharCombineIsOn", STYLE, TEXT_COMBINE, XML_TYPE_TEXT_COMBINE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ MT_E( "CharCombinePrefix", STYLE, TEXT_COMBINE_START_CHAR, XML_TYPE_TEXT_COMBINECHAR, 0 ),
+ MT_E( "CharCombineSuffix", STYLE, TEXT_COMBINE_END_CHAR, XML_TYPE_TEXT_COMBINECHAR, 0 ),
+ // RES_CHRATR_SCALEW
+ MT_E( "CharScaleWidth", STYLE, TEXT_SCALE, XML_TYPE_PERCENT16, 0 ),
+ // combined characters field, does not correspond to a property
+ MT_E( "", STYLE, TEXT_COMBINE, XML_TYPE_TEXT_COMBINE_CHARACTERS|MID_FLAG_NO_PROPERTY, CTF_COMBINED_CHARACTERS_FIELD ),
+ //RES_CHRATR_RELIEF
+ MT_E( "CharRelief", STYLE, FONT_RELIEF, XML_TYPE_TEXT_FONT_RELIEF, 0 ),
+ // RES_CHRATR_HIDDEN
+ MT_E( "CharHidden", TEXT, DISPLAY, XML_TYPE_TEXT_HIDDEN_AS_DISPLAY|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_TEXT_DISPLAY ),
+ // RES_CHRATR_OVERLINE
+ MT_E( "CharOverline", STYLE, TEXT_OVERLINE_STYLE, XML_TYPE_TEXT_OVERLINE_STYLE|MID_FLAG_MERGE_PROPERTY, 0 ),
+ MT_E( "CharOverline", STYLE, TEXT_OVERLINE_TYPE, XML_TYPE_TEXT_OVERLINE_TYPE|MID_FLAG_MERGE_PROPERTY, 0 ),
+ MT_E( "CharOverline", STYLE, TEXT_OVERLINE_WIDTH, XML_TYPE_TEXT_OVERLINE_WIDTH|MID_FLAG_MERGE_PROPERTY, 0 ),
+ MT_E( "CharOverlineColor", STYLE, TEXT_OVERLINE_COLOR, XML_TYPE_TEXT_OVERLINE_COLOR|MID_FLAG_MULTI_PROPERTY, 0 ),
+ MT_E( "CharOverlineHasColor", STYLE, TEXT_OVERLINE_COLOR, XML_TYPE_TEXT_OVERLINE_HASCOLOR|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
+
+ // RES_TXTATR_INETFMT
+ MT_E( "HyperLinkURL", TEXT, XMLNS, XML_TYPE_STRING|MID_FLAG_NO_PROPERTY_IMPORT, CTF_HYPERLINK_URL ),
+ // RES_TXTATR_REFMARK
+ // TODO
+ // RES_TXTATR_TOXMARK
+ // TODO
+ // RES_TXTATR_CHARFMT
+ MT_E( "CharStyleName", TEXT, STYLE_NAME, XML_TYPE_STRING|MID_FLAG_NO_PROPERTY_IMPORT, CTF_CHAR_STYLE_NAME ),
+ // RES_TXTATR_CJK_RUBY
+ // TODO
+ // RES_TXTATR_FIELD
+ // TODO
+ // RES_TXTATR_FLYCNT
+ // TODO
+ // RES_TXTATR_FTN
+ // TODO
+ // RES_TXTATR_SOFTHYPH
+ // TODO
+ // RES_TXTATR_HARDBLANK
+ // TODO
+ // RES_UNKNOWNATR_CONTAINER
+ MT_E( "TextUserDefinedAttributes", TEXT, XMLNS, XML_TYPE_ATTRIBUTE_CONTAINER | MID_FLAG_SPECIAL_ITEM, 0 ),
+ MT_ED( "ParaIsCharacterDistance", STYLE, TEXT_AUTOSPACE, XML_TYPE_TEXT_AUTOSPACE, 0 ),
+ MT_ED( "ParaIsHangingPunctuation", STYLE, PUNCTUATION_WRAP, XML_TYPE_TEXT_PUNCTUATION_WRAP, 0 ),
+ MT_ED( "ParaIsForbiddenRules", STYLE, LINE_BREAK, XML_TYPE_TEXT_LINE_BREAK, 0 ),
+ MT_E( "TabStopDistance", STYLE, TAB_STOP_DISTANCE, XML_TYPE_MEASURE, 0 ),
+
+ M_END()
+};
+
+XMLPropertyMapEntry aXMLFramePropMap[] =
+{
+ // RES_FILL_ORDER
+ // TODO: not required???
+ // RES_FRM_SIZE
+ MG_ED( "Width", SVG, WIDTH, XML_TYPE_MEASURE, CTF_FRAMEWIDTH_ABS ),
+ MG_ED( "Width", FO, MIN_WIDTH, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_FRAMEWIDTH_MIN_ABS ),
+ MG_ED( "RelativeWidth", FO, MIN_WIDTH, XML_TYPE_TEXT_REL_WIDTH_HEIGHT, CTF_FRAMEWIDTH_MIN_REL ),
+ MG_ED( "RelativeWidth", STYLE, REL_WIDTH, XML_TYPE_TEXT_REL_WIDTH_HEIGHT, CTF_FRAMEWIDTH_REL ),
+ MG_ED( "WidthType", FO, TEXT_BOX, XML_TYPE_NUMBER16|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_FRAMEWIDTH_TYPE ),
+// M_ED( "RelativeWidth", STYLE, REL_WIDTH, XML_TYPE_TEXT_REL_WIDTH_HEIGHT|MID_FLAG_MULTI_PROPERTY, 0 ),
+// M_ED( "IsSyncWidthToHeight",STYLE, REL_WIDTH, XML_TYPE_TEXT_SYNC_WIDTH_HEIGHT|MID_FLAG_MULTI_PROPERTY, 0 ),
+
+ MG_ED( "Height", SVG, HEIGHT, XML_TYPE_MEASURE, CTF_FRAMEHEIGHT_ABS ),
+ MG_ED( "Height", FO, MIN_HEIGHT, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_FRAMEHEIGHT_MIN_ABS ),
+ MG_ED( "RelativeHeight", FO, MIN_HEIGHT, XML_TYPE_TEXT_REL_WIDTH_HEIGHT, CTF_FRAMEHEIGHT_MIN_REL ),
+ MG_ED( "RelativeHeight", STYLE, REL_HEIGHT, XML_TYPE_TEXT_REL_WIDTH_HEIGHT, CTF_FRAMEHEIGHT_REL ),
+// M_ED( "RelativeHeight", STYLE, REL_HEIGHT, XML_TYPE_TEXT_REL_WIDTH_HEIGHT|MID_FLAG_MULTI_PROPERTY, CTF_FRAMEHEIGHT_REL ),
+// M_ED( "IsSyncHeightToWidth",STYLE, REL_HEIGHT, XML_TYPE_TEXT_SYNC_WIDTH_HEIGHT|MID_FLAG_MULTI_PROPERTY, CTF_SYNCHEIGHT ),
+// M_ED( "IsSyncHeightToWidth",STYLE, REL_HEIGHT, XML_TYPE_TEXT_SYNC_WIDTH_HEIGHT_MIN, CTF_SYNCHEIGHT_MIN ),
+ MG_ED( "SizeType", FO, TEXT_BOX, XML_TYPE_NUMBER16|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_SIZETYPE ),
+ // RES_PAPER_BIN
+ // not required
+ // RES_ANCHOR
+ // moved to here because it is not used for automatic styles
+ MG_ED( "AnchorType", TEXT, ANCHOR_TYPE, XML_TYPE_TEXT_ANCHOR_TYPE, CTF_ANCHORTYPE ),
+ // AnchorPage number is not required for styles!
+ MG_ED( "HoriOrientPosition", SVG, X, XML_TYPE_MEASURE, 0 ),
+ MG_ED( "VertOrientPosition", SVG, Y, XML_TYPE_MEASURE, 0 ),
+ // ***** The map for automatic styles starts here *****
+ // RES_LR_SPACE
+ MG_E( "LeftMargin", FO, MARGIN_LEFT, XML_TYPE_MEASURE, 0),
+ MG_E( "RightMargin", FO, MARGIN_RIGHT, XML_TYPE_MEASURE, 0 ),
+ // RES_UL_SPACE
+ MG_E( "TopMargin", FO, MARGIN_TOP, XML_TYPE_MEASURE, 0 ),
+ MG_E( "BottomMargin", FO, MARGIN_BOTTOM, XML_TYPE_MEASURE, 0 ),
+ // RES_PAGEDESC
+ // not required
+ // RES_BREAK
+ // not required
+ // RES_CNTNT
+ // not required (accessed using API)
+ // RES_HEADER
+ // not required
+ // RES_FOOTER
+ // not required
+ // RES_PRINT
+ MG_E( "Print", STYLE, PRINT_CONTENT, XML_TYPE_BOOL, 0 ),
+ // RES_OPAQUE
+ MG_ED( "Opaque", STYLE, RUN_THROUGH, XML_TYPE_TEXT_OPAQUE, 0 ),
+ // RES_PROTECT
+ MG_E( "ContentProtected", STYLE, PROTECT, XML_TYPE_TEXT_PROTECT_CONTENT|MID_FLAG_MERGE_ATTRIBUTE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ MG_E( "SizeProtected", STYLE, PROTECT, XML_TYPE_TEXT_PROTECT_SIZE|MID_FLAG_MERGE_ATTRIBUTE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ MG_E( "PositionProtected", STYLE, PROTECT, XML_TYPE_TEXT_PROTECT_POSITION|MID_FLAG_MERGE_ATTRIBUTE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ // RES_SURROUND
+ MG_ED( "TextWrap", STYLE, WRAP, XML_TYPE_TEXT_WRAP, CTF_WRAP ),
+ MG_ED( "SurroundAnchorOnly", STYLE, NUMBER_WRAPPED_PARAGRAPHS, XML_TYPE_TEXT_PARAGRAPH_ONLY, CTF_WRAP_PARAGRAPH_ONLY ),
+ MG_E( "SurroundContour", STYLE, WRAP_CONTOUR, XML_TYPE_BOOL, CTF_WRAP_CONTOUR ),
+ MG_E( "ContourOutside", STYLE, WRAP_CONTOUR_MODE, XML_TYPE_TEXT_WRAP_OUTSIDE, CTF_WRAP_CONTOUR_MODE ),
+ // RES_VERT_ORIENT
+ MG_ED( "VertOrient", STYLE, VERTICAL_POS, XML_TYPE_TEXT_VERTICAL_POS, CTF_VERTICALPOS ),
+ MG_ED( "VertOrient", STYLE, VERTICAL_POS, XML_TYPE_TEXT_VERTICAL_POS_AT_CHAR, CTF_VERTICALPOS_ATCHAR ),
+ MG_ED( "VertOrient", STYLE, VERTICAL_REL, XML_TYPE_TEXT_VERTICAL_REL_AS_CHAR|MID_FLAG_MULTI_PROPERTY, CTF_VERTICALREL_ASCHAR ),
+ MG_ED( "VertOrientRelation", STYLE, VERTICAL_REL, XML_TYPE_TEXT_VERTICAL_REL, CTF_VERTICALREL ),
+ MG_ED( "VertOrientRelation", STYLE, VERTICAL_REL, XML_TYPE_TEXT_VERTICAL_REL_PAGE|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_VERTICALREL_PAGE ),
+ MG_ED( "VertOrientRelation", STYLE, VERTICAL_REL, XML_TYPE_TEXT_VERTICAL_REL_FRAME|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_VERTICALREL_FRAME ),
+ // RES_HORI_ORIENT
+ MG_ED( "HoriOrient", STYLE, HORIZONTAL_POS, XML_TYPE_TEXT_HORIZONTAL_POS|MID_FLAG_MULTI_PROPERTY, CTF_HORIZONTALPOS ),
+ MG_ED( "PageToggle", STYLE, HORIZONTAL_POS, XML_TYPE_TEXT_HORIZONTAL_MIRROR, CTF_HORIZONTALMIRROR ),
+ MG_ED( "HoriOrient", STYLE, HORIZONTAL_POS, XML_TYPE_TEXT_HORIZONTAL_POS_MIRRORED|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_HORIZONTALPOS_MIRRORED ),
+ MG_ED( "HoriOrientRelation", STYLE, HORIZONTAL_REL, XML_TYPE_TEXT_HORIZONTAL_REL, CTF_HORIZONTALREL ),
+ MG_ED( "HoriOrientRelation", STYLE, HORIZONTAL_REL, XML_TYPE_TEXT_HORIZONTAL_REL_FRAME|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_HORIZONTALREL_FRAME ),
+ // RES_ANCHOR
+ // see above
+ // RES_BACKGROUND
+ MG_ED( "BackColorRGB", FO, BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY, 0 ),
+ MG_ED( "BackTransparent", FO, BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT|MID_FLAG_MERGE_ATTRIBUTE|MID_FLAG_MULTI_PROPERTY, CTF_BACKGROUND_TRANSPARENT ),
+ MG_ED( "BackColorTransparency", STYLE, BACKGROUND_TRANSPARENCY, XML_TYPE_PERCENT8, CTF_BACKGROUND_TRANSPARENCY ),
+
+ MG_E( "BackGraphicTransparency", STYLE, BACKGROUND_IMAGE_TRANSPARENCY, MID_FLAG_SPECIAL_ITEM|XML_TYPE_PERCENT8, CTF_BACKGROUND_TRANSPARENCY ),
+ MG_E( "BackGraphicLocation", STYLE, POSITION, MID_FLAG_SPECIAL_ITEM|XML_TYPE_BUILDIN_CMP_ONLY, CTF_BACKGROUND_POS ),
+ MG_E( "BackGraphicFilter",STYLE, FILTER_NAME, MID_FLAG_SPECIAL_ITEM|XML_TYPE_STRING, CTF_BACKGROUND_FILTER ),
+ MG_E( "BackGraphicURL", STYLE, BACKGROUND_IMAGE, MID_FLAG_ELEMENT_ITEM|XML_TYPE_STRING, CTF_BACKGROUND_URL ),
+
+ // RES_BOX
+ MG_ED( "LeftBorder", STYLE, BORDER_LINE_WIDTH, XML_TYPE_BORDER_WIDTH, CTF_ALLBORDERWIDTH ),
+ MG_ED( "LeftBorder", STYLE, BORDER_LINE_WIDTH_LEFT, XML_TYPE_BORDER_WIDTH, CTF_LEFTBORDERWIDTH ),
+ MG_ED( "RightBorder", STYLE, BORDER_LINE_WIDTH_RIGHT, XML_TYPE_BORDER_WIDTH, CTF_RIGHTBORDERWIDTH ),
+ MG_ED( "TopBorder", STYLE, BORDER_LINE_WIDTH_TOP, XML_TYPE_BORDER_WIDTH, CTF_TOPBORDERWIDTH ),
+ MG_ED( "BottomBorder", STYLE, BORDER_LINE_WIDTH_BOTTOM, XML_TYPE_BORDER_WIDTH, CTF_BOTTOMBORDERWIDTH ),
+
+ MG_ED( "LeftBorderDistance", FO, PADDING, XML_TYPE_MEASURE, CTF_ALLBORDERDISTANCE ), // need special import filtering
+ MG_ED( "LeftBorderDistance", FO, PADDING_LEFT, XML_TYPE_MEASURE, CTF_LEFTBORDERDISTANCE ),
+ MG_ED( "RightBorderDistance", FO, PADDING_RIGHT, XML_TYPE_MEASURE, CTF_RIGHTBORDERDISTANCE ),
+ MG_ED( "TopBorderDistance", FO, PADDING_TOP, XML_TYPE_MEASURE, CTF_TOPBORDERDISTANCE ),
+ MG_ED( "BottomBorderDistance",FO, PADDING_BOTTOM, XML_TYPE_MEASURE, CTF_BOTTOMBORDERDISTANCE ),
+
+ // There is an additional property for controls!
+ MG_ED( "LeftBorder", FO, BORDER, XML_TYPE_BORDER|MID_FLAG_MULTI_PROPERTY, CTF_ALLBORDER ),
+ MG_ED( "LeftBorder", FO, BORDER_LEFT, XML_TYPE_BORDER, CTF_LEFTBORDER ),
+ MG_ED( "RightBorder", FO, BORDER_RIGHT, XML_TYPE_BORDER, CTF_RIGHTBORDER ),
+ MG_ED( "TopBorder", FO, BORDER_TOP, XML_TYPE_BORDER, CTF_TOPBORDER ),
+ MG_ED( "BottomBorder", FO, BORDER_BOTTOM, XML_TYPE_BORDER, CTF_BOTTOMBORDER ),
+ // RES_SHADOW
+ MG_E( "ShadowFormat", STYLE, SHADOW, XML_TYPE_TEXT_SHADOW, 0 ),
+ // RES_FRMMACRO
+ // TODO
+ // RES_COL
+ MG_E( "TextColumns", STYLE, COLUMNS, MID_FLAG_ELEMENT_ITEM|XML_TYPE_TEXT_COLUMNS, CTF_TEXTCOLUMNS ),
+ // RES_KEEP
+ // not required
+ // RES_URL
+ // not required (exprted as draw:a element)
+ // RES_EDIT_IN_READONLY
+ MG_ED( "EditInReadonly", STYLE, EDITABLE, XML_TYPE_BOOL, 0 ),
+ // RES_LAYOUT_SPLIT
+ // not required
+ // RES_CHAIN
+ // not required (exported at text:text-box element)
+ // RES_LINENUMBER
+ // not required
+ // RES_FTN_AT_TXTEND
+ // not required
+ // RES_END_AT_TXTEND
+ // not required
+ // RES_COLUMNBALANCE
+ // TODO
+ // RES_UNKNOWNATR_CONTAINER
+// M_E_SE( TEXT, xmlns, RES_UNKNOWNATR_CONTAINER, 0 ),
+ // RES_GRFATR_MIRRORGRF (vertical MUST be processed after horizontal!)
+ MG_E( "HoriMirroredOnEvenPages", STYLE, MIRROR, XML_TYPE_TEXT_MIRROR_HORIZONTAL_LEFT|MID_FLAG_MERGE_ATTRIBUTE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ MG_E( "HoriMirroredOnOddPages", STYLE, MIRROR, XML_TYPE_TEXT_MIRROR_HORIZONTAL_RIGHT|MID_FLAG_MERGE_ATTRIBUTE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ MG_E( "VertMirrored", STYLE, MIRROR, XML_TYPE_TEXT_MIRROR_VERTICAL|MID_FLAG_MERGE_ATTRIBUTE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ // RES_GRFATR_CROPGRF
+ MG_EV( "GraphicCrop", FO, CLIP, XML_TYPE_TEXT_CLIP, CTF_TEXT_CLIP, SvtSaveOptions::ODFVER_012 ),
+ MG_E( "GraphicCrop", FO, CLIP, XML_TYPE_TEXT_CLIP11, CTF_TEXT_CLIP11 ),
+ // RES_GRFATR_ROTATION
+ // not required (exported as svg:transform attribute)
+ // RES_GRFATR_LUMINANCE
+ MG_E( "AdjustLuminance", DRAW, LUMINANCE, XML_TYPE_PERCENT16, 0 ), // signed?
+ // RES_GRFATR_CONTRAST
+ MG_E( "AdjustContrast", DRAW, CONTRAST, XML_TYPE_PERCENT16, 0 ), // signed?
+ // RES_GRFATR_CHANNELR
+ MG_E( "AdjustRed", DRAW, RED, XML_TYPE_PERCENT16, 0 ), // signed?
+ // RES_GRFATR_CHANNELG
+ MG_E( "AdjustGreen", DRAW, GREEN, XML_TYPE_PERCENT16, 0 ), // signed?
+ // RES_GRFATR_CHANNELB
+ MG_E( "AdjustBlue", DRAW, BLUE, XML_TYPE_PERCENT16, 0 ), // signed?
+ // RES_GRFATR_GAMMA
+ MG_E( "Gamma", DRAW, GAMMA, XML_TYPE_DOUBLE_PERCENT, 0 ), // signed?
+ // RES_GRFATR_INVERT
+ MG_E( "GraphicIsInverted", DRAW, COLOR_INVERSION, XML_TYPE_BOOL, 0 ),
+ // RES_GRFATR_TRANSPARENCY
+ MG_E( "Transparency", DRAW, IMAGE_OPACITY, XML_TYPE_NEG_PERCENT16|MID_FLAG_MULTI_PROPERTY, 0 ), // #i25616#
+ // RES_GRFATR_DRAWMODE
+ MG_E( "GraphicColorMode", DRAW, COLOR_MODE, XML_TYPE_COLOR_MODE, 0 ),
+ MG_E( "WritingMode", STYLE, WRITING_MODE, XML_TYPE_TEXT_WRITING_MODE_WITH_DEFAULT, 0 ),
+ // RES_FOLLOW_TEXT_FLOW - DVO, OD 01.10.2003 #i18732#
+ MG_E( "IsFollowingTextFlow", DRAW, FLOW_WITH_TEXT, XML_TYPE_BOOL|MID_FLAG_SPECIAL_ITEM_EXPORT, CTF_OLD_FLOW_WITH_TEXT ),
+ MG_E( "IsFollowingTextFlow", STYLE, FLOW_WITH_TEXT, XML_TYPE_BOOL, 0 ),
+ // OD 2004-05-05 #i28701# - RES_WRAP_INFLUENCE_ON_OBJPOS
+ MG_E( "WrapInfluenceOnPosition", DRAW, WRAP_INFLUENCE_ON_POSITION, XML_TYPE_WRAP_INFLUENCE_ON_POSITION, 0 ),
+
+ // special entries for floating frames
+ MG_E( "", DRAW, FRAME_DISPLAY_SCROLLBAR, XML_TYPE_BOOL|MID_FLAG_NO_PROPERTY|MID_FLAG_MULTI_PROPERTY, CTF_FRAME_DISPLAY_SCROLLBAR ),
+ MG_E( "", DRAW, FRAME_DISPLAY_BORDER, XML_TYPE_BOOL|MID_FLAG_NO_PROPERTY|MID_FLAG_MULTI_PROPERTY, CTF_FRAME_DISPLAY_BORDER ),
+ MG_E( "", DRAW, FRAME_MARGIN_HORIZONTAL, XML_TYPE_MEASURE_PX|MID_FLAG_NO_PROPERTY|MID_FLAG_MULTI_PROPERTY, CTF_FRAME_MARGIN_HORI ),
+ MG_E( "", DRAW, FRAME_MARGIN_VERTICAL, XML_TYPE_MEASURE_PX|MID_FLAG_NO_PROPERTY|MID_FLAG_MULTI_PROPERTY, CTF_FRAME_MARGIN_VERT ),
+ MG_E( "", DRAW, VISIBLE_AREA_LEFT, XML_TYPE_MEASURE|MID_FLAG_NO_PROPERTY|MID_FLAG_MULTI_PROPERTY, CTF_OLE_VIS_AREA_LEFT ),
+ MG_E( "", DRAW, VISIBLE_AREA_TOP, XML_TYPE_MEASURE|MID_FLAG_NO_PROPERTY|MID_FLAG_MULTI_PROPERTY, CTF_OLE_VIS_AREA_TOP ),
+ MG_E( "", DRAW, VISIBLE_AREA_WIDTH, XML_TYPE_MEASURE|MID_FLAG_NO_PROPERTY|MID_FLAG_MULTI_PROPERTY, CTF_OLE_VIS_AREA_WIDTH ),
+ MG_E( "", DRAW, VISIBLE_AREA_HEIGHT, XML_TYPE_MEASURE|MID_FLAG_NO_PROPERTY|MID_FLAG_MULTI_PROPERTY, CTF_OLE_VIS_AREA_HEIGHT ),
+ MG_E( "", DRAW, DRAW_ASPECT, XML_TYPE_TEXT_DRAW_ASPECT|MID_FLAG_NO_PROPERTY|MID_FLAG_MULTI_PROPERTY, CTF_OLE_DRAW_ASPECT ),
+ MG_E( "UserDefinedAttributes", TEXT, XMLNS, XML_TYPE_ATTRIBUTE_CONTAINER | MID_FLAG_SPECIAL_ITEM, 0 ),
+
+ M_END()
+};
+
+XMLPropertyMapEntry aXMLShapePropMap[] =
+{
+ // RES_LR_SPACE
+ MG_E( "LeftMargin", FO, MARGIN_LEFT, XML_TYPE_MEASURE, 0),
+ MG_E( "RightMargin", FO, MARGIN_RIGHT, XML_TYPE_MEASURE, 0 ),
+ // RES_UL_SPACE
+ MG_E( "TopMargin", FO, MARGIN_TOP, XML_TYPE_MEASURE, 0 ),
+ MG_E( "BottomMargin", FO, MARGIN_BOTTOM, XML_TYPE_MEASURE, 0 ),
+ // RES_OPAQUE
+ MG_ED( "Opaque", STYLE, RUN_THROUGH, XML_TYPE_TEXT_OPAQUE, 0 ),
+ // RES_SURROUND
+ MG_E( "TextWrap", STYLE, WRAP, XML_TYPE_TEXT_WRAP, CTF_WRAP ),
+ MG_E( "SurroundAnchorOnly", STYLE, NUMBER_WRAPPED_PARAGRAPHS, XML_TYPE_TEXT_PARAGRAPH_ONLY, CTF_WRAP_PARAGRAPH_ONLY ),
+ MG_E( "SurroundContour", STYLE, WRAP_CONTOUR, XML_TYPE_BOOL, CTF_WRAP_CONTOUR ),
+ MG_E( "ContourOutside", STYLE, WRAP_CONTOUR_MODE, XML_TYPE_TEXT_WRAP_OUTSIDE, CTF_WRAP_CONTOUR_MODE ),
+ // Use own CTF ids for positioning attributes (#i28749#)
+ // RES_VERT_ORIENT
+ MG_E( "VertOrient", STYLE, VERTICAL_POS, XML_TYPE_TEXT_VERTICAL_POS, CTF_SHAPE_VERTICALPOS ),
+ // Add property for at-character anchored shapes (#i26791#)
+ MG_E( "VertOrient", STYLE, VERTICAL_POS, XML_TYPE_TEXT_VERTICAL_POS_AT_CHAR, CTF_SHAPE_VERTICALPOS_ATCHAR ),
+ MG_E( "VertOrient", STYLE, VERTICAL_REL, XML_TYPE_TEXT_VERTICAL_REL_AS_CHAR|MID_FLAG_MULTI_PROPERTY, CTF_VERTICALREL_ASCHAR ),
+ MG_E( "VertOrientRelation", STYLE, VERTICAL_REL, XML_TYPE_TEXT_VERTICAL_REL, CTF_SHAPE_VERTICALREL ),
+ MG_E( "VertOrientRelation", STYLE, VERTICAL_REL, XML_TYPE_TEXT_VERTICAL_REL_PAGE|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_SHAPE_VERTICALREL_PAGE ),
+ MG_E( "VertOrientRelation", STYLE, VERTICAL_REL, XML_TYPE_TEXT_VERTICAL_REL_FRAME|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_SHAPE_VERTICALREL_FRAME ),
+ // RES_HORI_ORIENT
+ MG_E( "HoriOrient", STYLE, HORIZONTAL_POS, XML_TYPE_TEXT_HORIZONTAL_POS|MID_FLAG_MULTI_PROPERTY, CTF_SHAPE_HORIZONTALPOS ),
+ MG_E( "PageToggle", STYLE, HORIZONTAL_POS, XML_TYPE_TEXT_HORIZONTAL_MIRROR, CTF_SHAPE_HORIZONTALMIRROR ),
+ MG_E( "HoriOrient", STYLE, HORIZONTAL_POS, XML_TYPE_TEXT_HORIZONTAL_POS_MIRRORED|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_SHAPE_HORIZONTALPOS_MIRRORED ),
+ MG_E( "HoriOrientRelation", STYLE, HORIZONTAL_REL, XML_TYPE_TEXT_HORIZONTAL_REL, CTF_SHAPE_HORIZONTALREL ),
+ MG_E( "HoriOrientRelation", STYLE, HORIZONTAL_REL, XML_TYPE_TEXT_HORIZONTAL_REL_FRAME|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_SHAPE_HORIZONTALREL_FRAME ),
+ // RES_WRAP_INFLUENCE_ON_OBJPOS (#i28701#)
+ MG_ED( "WrapInfluenceOnPosition", DRAW, WRAP_INFLUENCE_ON_POSITION, XML_TYPE_WRAP_INFLUENCE_ON_POSITION, 0 ),
+ // UserDefinedAttributes is already contained in the map this one is
+ // chained to.
+
+ // RES_FOLLOW_TEXT_FLOW (#i26791#)
+ MG_ED( "IsFollowingTextFlow", STYLE, FLOW_WITH_TEXT, XML_TYPE_BOOL, 0 ),
+
+ M_END()
+};
+
+XMLPropertyMapEntry aXMLSectionPropMap[] =
+{
+ // RES_COL
+ MS_E( "TextColumns", STYLE, COLUMNS, MID_FLAG_ELEMENT_ITEM|XML_TYPE_TEXT_COLUMNS, CTF_TEXTCOLUMNS ),
+
+ // RES_BACKGROUND
+ MS_E( "BackColor", FO, BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY, 0 ),
+ MS_E( "BackTransparent", FO, BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
+ MS_E( "BackGraphicLocation", STYLE, POSITION, MID_FLAG_SPECIAL_ITEM|XML_TYPE_BUILDIN_CMP_ONLY, CTF_BACKGROUND_POS ),
+ MS_E( "BackGraphicFilter",STYLE, FILTER_NAME, MID_FLAG_SPECIAL_ITEM|XML_TYPE_STRING, CTF_BACKGROUND_FILTER ),
+ MS_E( "BackGraphicURL", STYLE, BACKGROUND_IMAGE, MID_FLAG_ELEMENT_ITEM|XML_TYPE_STRING, CTF_BACKGROUND_URL ),
+
+ // move protect-flag into section element
+// M_E( "IsProtected", STYLE, PROTECT, XML_TYPE_BOOL, 0 ),
+
+ MS_E( "DontBalanceTextColumns", TEXT, DONT_BALANCE_TEXT_COLUMNS, XML_TYPE_BOOL, 0 ),
+
+ MS_E( "WritingMode", STYLE, WRITING_MODE, XML_TYPE_TEXT_WRITING_MODE_WITH_DEFAULT, 0 ),
+
+ MS_E( "SectionLeftMargin", FO, MARGIN_LEFT, XML_TYPE_MEASURE, 0),
+ MS_E( "SectionRightMargin", FO, MARGIN_RIGHT, XML_TYPE_MEASURE, 0),
+
+ // section footnote settings
+ MS_E( "FootnoteIsOwnNumbering", TEXT, _EMPTY, MID_FLAG_SPECIAL_ITEM|XML_TYPE_BOOL, CTF_SECTION_FOOTNOTE_NUM_OWN ),
+ MS_E( "FootnoteIsRestartNumbering", TEXT, _EMPTY, MID_FLAG_SPECIAL_ITEM|XML_TYPE_BOOL, CTF_SECTION_FOOTNOTE_NUM_RESTART ),
+ MS_E( "FootnoteRestartNumberingAt", TEXT, _EMPTY, MID_FLAG_SPECIAL_ITEM|XML_TYPE_NUMBER16,CTF_SECTION_FOOTNOTE_NUM_RESTART_AT ),
+ MS_E( "FootnoteNumberingType", TEXT, _EMPTY, MID_FLAG_SPECIAL_ITEM|XML_TYPE_NUMBER16,CTF_SECTION_FOOTNOTE_NUM_TYPE ),
+ MS_E( "FootnoteNumberingPrefix", TEXT, _EMPTY, MID_FLAG_SPECIAL_ITEM|XML_TYPE_STRING, CTF_SECTION_FOOTNOTE_NUM_PREFIX ),
+ MS_E( "FootnoteNumberingSuffix", TEXT, _EMPTY, MID_FLAG_SPECIAL_ITEM|XML_TYPE_STRING, CTF_SECTION_FOOTNOTE_NUM_SUFFIX ),
+ MS_E( "FootnoteIsCollectAtTextEnd", TEXT, NOTES_CONFIGURATION, MID_FLAG_ELEMENT_ITEM|XML_TYPE_BOOL, CTF_SECTION_FOOTNOTE_END ),
+
+ // section footnote settings
+ MS_E( "EndnoteIsOwnNumbering", TEXT, _EMPTY, MID_FLAG_SPECIAL_ITEM|XML_TYPE_BOOL, CTF_SECTION_ENDNOTE_NUM_OWN ),
+ MS_E( "EndnoteIsRestartNumbering", TEXT, _EMPTY, MID_FLAG_SPECIAL_ITEM|XML_TYPE_BOOL, CTF_SECTION_ENDNOTE_NUM_RESTART ),
+ MS_E( "EndnoteRestartNumberingAt", TEXT, _EMPTY, MID_FLAG_SPECIAL_ITEM|XML_TYPE_NUMBER16,CTF_SECTION_ENDNOTE_NUM_RESTART_AT ),
+ MS_E( "EndnoteNumberingType", TEXT, _EMPTY, MID_FLAG_SPECIAL_ITEM|XML_TYPE_NUMBER16,CTF_SECTION_ENDNOTE_NUM_TYPE ),
+ MS_E( "EndnoteNumberingPrefix", TEXT, _EMPTY, MID_FLAG_SPECIAL_ITEM|XML_TYPE_STRING, CTF_SECTION_ENDNOTE_NUM_PREFIX ),
+ MS_E( "EndnoteNumberingSuffix", TEXT, _EMPTY, MID_FLAG_SPECIAL_ITEM|XML_TYPE_STRING, CTF_SECTION_ENDNOTE_NUM_SUFFIX ),
+ MS_E( "EndnoteIsCollectAtTextEnd", TEXT, NOTES_CONFIGURATION, MID_FLAG_ELEMENT_ITEM|XML_TYPE_BOOL, CTF_SECTION_ENDNOTE_END ),
+ MS_E( "UserDefinedAttributes", TEXT, XMLNS, XML_TYPE_ATTRIBUTE_CONTAINER | MID_FLAG_SPECIAL_ITEM, 0 ),
+ // RES_EDIT_IN_READONLY
+ MS_E( "EditInReadonly", STYLE, EDITABLE, XML_TYPE_BOOL, 0 ),
+ M_END()
+};
+
+XMLPropertyMapEntry aXMLRubyPropMap[] =
+{
+ MR_E( "RubyAdjust", STYLE, RUBY_ALIGN, XML_TYPE_TEXT_RUBY_ADJUST, 0 ),
+ MR_E( "RubyIsAbove", STYLE, RUBY_POSITION, XML_TYPE_TEXT_RUBY_POSITION, 0 ),
+ M_END()
+};
+
+
+XMLPropertyMapEntry aXMLTableDefaultsMap[] =
+{
+ // RES_COLLAPSING_BORDERS: only occurs in tables, but we need to
+ // read/write the default for this item
+ _M_ED( "CollapsingBorders", TABLE, BORDER_MODEL, XML_TYPE_PROP_TABLE | XML_TYPE_BORDER_MODEL | MID_FLAG_NO_PROPERTY_IMPORT, CTF_BORDER_MODEL ),
+
+ M_END()
+};
+
+XMLPropertyMapEntry aXMLTableRowDefaultsMap[] =
+{
+ // RES_ROW_SPLIT: only occurs in table rows, but we need to
+ // read/write the default for this item
+ _M_ED( "IsSplitAllowed", FO, KEEP_TOGETHER, XML_TYPE_PROP_TABLE_ROW | XML_TYPE_TEXT_NKEEP | MID_FLAG_NO_PROPERTY_IMPORT, CTF_KEEP_TOGETHER ),
+
+ M_END()
+};
+
+XMLPropertyMapEntry *lcl_txtprmap_getMap( sal_uInt16 nType )
+{
+ XMLPropertyMapEntry *pMap = 0;
+ switch( nType )
+ {
+ case TEXT_PROP_MAP_TEXT:
+ pMap = aXMLTextPropMap;
+ break;
+ case TEXT_PROP_MAP_SHAPE_PARA:
+ pMap = &(aXMLParaPropMap[1]);
+ DBG_ASSERT( pMap->meXMLName == XML_MARGIN_LEFT, "shape para map changed" );
+ break;
+ case TEXT_PROP_MAP_PARA:
+ pMap = aXMLParaPropMap;
+ break;
+ case TEXT_PROP_MAP_FRAME:
+ pMap = aXMLFramePropMap;
+ break;
+ case TEXT_PROP_MAP_AUTO_FRAME:
+ pMap = &(aXMLFramePropMap[13]);
+ DBG_ASSERT( pMap->meXMLName == XML_MARGIN_LEFT, "frame map changed" );
+ break;
+ case TEXT_PROP_MAP_SHAPE:
+ pMap = aXMLShapePropMap;
+ break;
+ case TEXT_PROP_MAP_SECTION:
+ pMap = aXMLSectionPropMap;
+ break;
+ case TEXT_PROP_MAP_RUBY:
+ pMap = aXMLRubyPropMap;
+ break;
+ case TEXT_PROP_MAP_TEXT_ADDITIONAL_DEFAULTS:
+ pMap = aXMLAdditionalTextDefaultsMap;
+ break;
+ case TEXT_PROP_MAP_TABLE_DEFAULTS:
+ pMap = aXMLTableDefaultsMap;
+ break;
+ case TEXT_PROP_MAP_TABLE_ROW_DEFAULTS:
+ pMap = aXMLTableRowDefaultsMap;
+ break;
+ }
+ DBG_ASSERT( pMap, "illegal map type" );
+ return pMap;
+}
+
+const XMLPropertyMapEntry* XMLTextPropertySetMapper::getPropertyMapForType( sal_uInt16 _nType )
+{
+ return lcl_txtprmap_getMap( _nType );
+}
+
+XMLTextPropertySetMapper::XMLTextPropertySetMapper( sal_uInt16 nType ) :
+ XMLPropertySetMapper( lcl_txtprmap_getMap( nType ),
+ new XMLTextPropertyHandlerFactory )
+{
+}
+
+XMLTextPropertySetMapper::~XMLTextPropertySetMapper()
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/txtsecte.cxx b/xmloff/source/text/txtsecte.cxx
new file mode 100644
index 000000000000..201407e79371
--- /dev/null
+++ b/xmloff/source/text/txtsecte.cxx
@@ -0,0 +1,256 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <xmloff/txtparae.hxx>
+#include <tools/debug.hxx>
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+
+#include <vector>
+
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/container/XIndexReplace.hpp>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <com/sun/star/beans/PropertyState.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XTextSection.hpp>
+#include <com/sun/star/text/SectionFileLink.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/text/XDocumentIndex.hpp>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/families.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmltkmap.hxx>
+#include "XMLTextNumRuleInfo.hxx"
+#include "XMLSectionExport.hxx"
+#include "XMLRedlineExport.hxx"
+#include "MultiPropertySetHelper.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::uno;
+using namespace ::std;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::beans::PropertyValue;
+using ::com::sun::star::beans::PropertyValues;
+using ::com::sun::star::beans::PropertyState;
+using ::com::sun::star::container::XIndexReplace;
+using ::com::sun::star::container::XNamed;
+using ::com::sun::star::lang::XServiceInfo;
+
+Reference<XText> lcl_findXText(const Reference<XTextSection>& rSect)
+{
+ Reference<XText> xText;
+
+ Reference<XTextContent> xTextContent(rSect, UNO_QUERY);
+ if (xTextContent.is())
+ {
+ xText.set(xTextContent->getAnchor()->getText());
+ }
+
+ return xText;
+}
+
+void XMLTextParagraphExport::exportListAndSectionChange(
+ Reference<XTextSection> & rPrevSection,
+ const Reference<XTextContent> & rNextSectionContent,
+ const XMLTextNumRuleInfo& rPrevRule,
+ const XMLTextNumRuleInfo& rNextRule,
+ sal_Bool bAutoStyles)
+{
+ Reference<XTextSection> xNextSection;
+
+ // first: get current XTextSection
+ Reference<XPropertySet> xPropSet(rNextSectionContent, UNO_QUERY);
+ if (xPropSet.is())
+ {
+ if (xPropSet->getPropertySetInfo()->hasPropertyByName(sTextSection))
+ {
+ xPropSet->getPropertyValue(sTextSection) >>= xNextSection;
+ }
+ // else: no current section
+ }
+
+ exportListAndSectionChange(rPrevSection, xNextSection,
+ rPrevRule, rNextRule, bAutoStyles);
+}
+
+void XMLTextParagraphExport::exportListAndSectionChange(
+ Reference<XTextSection> & rPrevSection,
+ MultiPropertySetHelper& rPropSetHelper,
+ sal_Int16 nTextSectionId,
+ const Reference<XTextContent> & rNextSectionContent,
+ const XMLTextNumRuleInfo& rPrevRule,
+ const XMLTextNumRuleInfo& rNextRule,
+ sal_Bool bAutoStyles)
+{
+ Reference<XTextSection> xNextSection;
+
+ // first: get current XTextSection
+ Reference<XPropertySet> xPropSet(rNextSectionContent, UNO_QUERY);
+ if (xPropSet.is())
+ {
+ if( !rPropSetHelper.checkedProperties() )
+ rPropSetHelper.hasProperties( xPropSet->getPropertySetInfo() );
+ if( rPropSetHelper.hasProperty( nTextSectionId ))
+ {
+ xNextSection.set(rPropSetHelper.getValue( nTextSectionId , xPropSet,
+ sal_True ), uno::UNO_QUERY);
+ }
+ // else: no current section
+ }
+
+ exportListAndSectionChange(rPrevSection, xNextSection,
+ rPrevRule, rNextRule, bAutoStyles);
+}
+
+void XMLTextParagraphExport::exportListAndSectionChange(
+ Reference<XTextSection> & rPrevSection,
+ const Reference<XTextSection> & rNextSection,
+ const XMLTextNumRuleInfo& rPrevRule,
+ const XMLTextNumRuleInfo& rNextRule,
+ sal_Bool bAutoStyles)
+{
+ // old != new? -> maybe we have to start or end a new section
+ if (rPrevSection != rNextSection)
+ {
+ // a new section started, or an old one gets closed!
+
+ // close old list
+ XMLTextNumRuleInfo aEmptyNumRuleInfo;
+ if ( !bAutoStyles )
+ exportListChange(rPrevRule, aEmptyNumRuleInfo);
+
+ // Build stacks of old and new sections
+ // Sections on top of mute sections should not be on the stack
+ vector< Reference<XTextSection> > aOldStack;
+ Reference<XTextSection> aCurrent(rPrevSection);
+ while(aCurrent.is())
+ {
+ // if we have a mute section, ignore all its children
+ // (all previous ones)
+ if (pSectionExport->IsMuteSection(aCurrent))
+ aOldStack.clear();
+
+ aOldStack.push_back(aCurrent);
+ aCurrent.set(aCurrent->getParentSection());
+ }
+
+ vector< Reference<XTextSection> > aNewStack;
+ aCurrent.set(rNextSection);
+ sal_Bool bMute = sal_False;
+ while(aCurrent.is())
+ {
+ // if we have a mute section, ignore all its children
+ // (all previous ones)
+ if (pSectionExport->IsMuteSection(aCurrent))
+ {
+ aNewStack.clear();
+ bMute = sal_True;
+ }
+
+ aNewStack.push_back(aCurrent);
+ aCurrent.set(aCurrent->getParentSection());
+ }
+
+ // compare the two stacks
+ vector<Reference<XTextSection> > ::reverse_iterator aOld =
+ aOldStack.rbegin();
+ vector<Reference<XTextSection> > ::reverse_iterator aNew =
+ aNewStack.rbegin();
+ // compare bottom sections and skip equal section
+ while ( (aOld != aOldStack.rend()) &&
+ (aNew != aNewStack.rend()) &&
+ (*aOld) == (*aNew) )
+ {
+ ++aOld;
+ ++aNew;
+ }
+
+ // close all elements of aOld ...
+ // (order: newest to oldest)
+ if (aOld != aOldStack.rend())
+ {
+ vector<Reference<XTextSection> > ::iterator aOldForward(
+ aOldStack.begin());
+ while ((aOldForward != aOldStack.end()) &&
+ (*aOldForward != *aOld))
+ {
+ if ( !bAutoStyles && (NULL != pRedlineExport) )
+ pRedlineExport->ExportStartOrEndRedline(*aOldForward,
+ sal_False);
+ pSectionExport->ExportSectionEnd(*aOldForward, bAutoStyles);
+ ++aOldForward;
+ }
+ if (aOldForward != aOldStack.end())
+ {
+ if ( !bAutoStyles && (NULL != pRedlineExport) )
+ pRedlineExport->ExportStartOrEndRedline(*aOldForward,
+ sal_False);
+ pSectionExport->ExportSectionEnd(*aOldForward, bAutoStyles);
+ }
+ }
+
+ // ...then open all of aNew
+ // (order: oldest to newest)
+ while (aNew != aNewStack.rend())
+ {
+ if ( !bAutoStyles && (NULL != pRedlineExport) )
+ pRedlineExport->ExportStartOrEndRedline(*aNew, sal_True);
+ pSectionExport->ExportSectionStart(*aNew, bAutoStyles);
+ ++aNew;
+ }
+
+ // start new list
+ if ( !bAutoStyles && !bMute )
+ exportListChange(aEmptyNumRuleInfo, rNextRule);
+ }
+ else
+ {
+ // list change, if sections have not changed
+ if ( !bAutoStyles )
+ exportListChange(rPrevRule, rNextRule);
+ }
+
+ // save old section (old numRule gets saved in calling method)
+ rPrevSection.set(rNextSection);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/txtstyle.cxx b/xmloff/source/text/txtstyle.cxx
new file mode 100644
index 000000000000..440a0f412b39
--- /dev/null
+++ b/xmloff/source/text/txtstyle.cxx
@@ -0,0 +1,176 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <com/sun/star/style/ParagraphStyleCategory.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/style/XStyle.hpp>
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/families.hxx>
+#include <xmloff/txtparae.hxx>
+#include <xmloff/xmlnume.hxx>
+#include <xmloff/xmlexp.hxx>
+#include "XMLSectionExport.hxx"
+#include "XMLLineNumberingExport.hxx"
+#include "txtexppr.hxx"
+#include <xmloff/txtprmap.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+using namespace ::xmloff::token;
+
+void XMLTextParagraphExport::exportStyleAttributes(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::style::XStyle > & rStyle )
+{
+ OUString sName;
+ Any aAny;
+ Reference< XPropertySet > xPropSet( rStyle, UNO_QUERY );
+ Reference< XPropertySetInfo > xPropSetInfo(
+ xPropSet->getPropertySetInfo());
+ if( xPropSetInfo->hasPropertyByName( sCategory ) )
+ {
+ sal_Int16 nCategory = 0;
+ xPropSet->getPropertyValue( sCategory ) >>= nCategory;
+ enum XMLTokenEnum eValue = XML_TOKEN_INVALID;
+ if( -1 != nCategory )
+ {
+ switch( nCategory )
+ {
+ case ParagraphStyleCategory::TEXT:
+ eValue = XML_TEXT;
+ break;
+ case ParagraphStyleCategory::CHAPTER:
+ eValue = XML_CHAPTER;
+ break;
+ case ParagraphStyleCategory::LIST:
+ eValue = XML_LIST;
+ break;
+ case ParagraphStyleCategory::INDEX:
+ eValue = XML_INDEX;
+ break;
+ case ParagraphStyleCategory::EXTRA:
+ eValue = XML_EXTRA;
+ break;
+ case ParagraphStyleCategory::HTML:
+ eValue = XML_HTML;
+ break;
+ }
+ }
+ if( eValue != XML_TOKEN_INVALID )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_CLASS, eValue);
+ }
+ if( xPropSetInfo->hasPropertyByName( sPageDescName ) )
+ {
+ Reference< XPropertyState > xPropState( xPropSet, uno::UNO_QUERY );
+ if( PropertyState_DIRECT_VALUE ==
+ xPropState->getPropertyState( sPageDescName ) )
+ {
+ xPropSet->getPropertyValue( sPageDescName ) >>= sName;
+ // fix for #i5551# if( sName.getLength() > 0 )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE,
+ XML_MASTER_PAGE_NAME,
+ GetExport().EncodeStyleName( sName ) );
+ }
+ }
+ if( bProgress )
+ {
+ ProgressBarHelper *pProgress = GetExport().GetProgressBarHelper();
+ pProgress->SetValue( pProgress->GetValue()+2 );
+ }
+}
+
+void XMLTextParagraphExport::exportNumStyles( sal_Bool bUsed )
+{
+ SvxXMLNumRuleExport aNumRuleExport( GetExport() );
+ aNumRuleExport.exportStyles( bUsed, pListAutoPool, !IsBlockMode() );
+}
+
+void XMLTextParagraphExport::exportTextStyles( sal_Bool bUsed, sal_Bool bProg )
+{
+ sal_Bool bOldProg = bProgress;
+ bProgress = bProg;
+
+ Reference < lang::XMultiServiceFactory > xFactory (GetExport().GetModel(), UNO_QUERY);
+ if (xFactory.is())
+ {
+ OUString sTextDefaults ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.text.Defaults" ) );
+ Reference < XPropertySet > xPropSet (xFactory->createInstance ( sTextDefaults ), UNO_QUERY);
+ if (xPropSet.is())
+ {
+ exportDefaultStyle( xPropSet, GetXMLToken(XML_PARAGRAPH), GetParaPropMapper());
+
+ exportDefaultStyle(
+ xPropSet,
+ GetXMLToken(XML_TABLE),
+ new XMLTextExportPropertySetMapper(
+ new XMLTextPropertySetMapper(
+ TEXT_PROP_MAP_TABLE_DEFAULTS ),
+ GetExport() ) );
+
+ exportDefaultStyle(
+ xPropSet,
+ GetXMLToken(XML_TABLE_ROW),
+ new XMLTextExportPropertySetMapper(
+ new XMLTextPropertySetMapper(
+ TEXT_PROP_MAP_TABLE_ROW_DEFAULTS ),
+ GetExport() ) );
+ }
+ }
+ exportStyleFamily( "ParagraphStyles", GetXMLToken(XML_PARAGRAPH), GetParaPropMapper(),
+ bUsed, XML_STYLE_FAMILY_TEXT_PARAGRAPH, 0);
+ exportStyleFamily( "CharacterStyles", GetXMLToken(XML_TEXT), GetTextPropMapper(),
+ bUsed, XML_STYLE_FAMILY_TEXT_TEXT );
+ // get shape export to make sure the the frame family is added correctly.
+ GetExport().GetShapeExport();
+ exportStyleFamily( "FrameStyles", OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_NAME)), GetFramePropMapper(),
+ bUsed, XML_STYLE_FAMILY_TEXT_FRAME, 0);
+ exportNumStyles( bUsed );
+ if( !IsBlockMode() )
+ {
+ exportTextFootnoteConfiguration();
+ XMLSectionExport::ExportBibliographyConfiguration(GetExport());
+ XMLLineNumberingExport aLineNumberingExport(GetExport());
+ aLineNumberingExport.Export();
+ }
+
+ bProgress = bOldProg;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/txtstyli.cxx b/xmloff/source/text/txtstyli.cxx
new file mode 100644
index 000000000000..f99e35d404b9
--- /dev/null
+++ b/xmloff/source/text/txtstyli.cxx
@@ -0,0 +1,562 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "XMLTextPropertySetContext.hxx"
+#include "xmloff/xmlnmspe.hxx"
+#include "xmloff/XMLEventsImportContext.hxx"
+#include "xmloff/attrlist.hxx"
+#include "xmloff/families.hxx"
+#include "xmloff/txtprmap.hxx"
+#include "xmloff/txtstyli.hxx"
+#include "xmloff/xmlimp.hxx"
+#include "xmloff/xmltkmap.hxx"
+#include "xmloff/xmltoken.hxx"
+#include "xmloff/xmluconv.hxx"
+
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/style/ParagraphStyleCategory.hpp>
+#include <com/sun/star/style/XStyle.hpp>
+
+#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
+
+// STL includes
+#include <algorithm>
+#include <functional>
+#include <utility>
+#include <vector>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::std;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+using namespace ::xmloff::token;
+
+static SvXMLEnumMapEntry aCategoryMap[] =
+{
+ { XML_TEXT, ParagraphStyleCategory::TEXT },
+ { XML_CHAPTER, ParagraphStyleCategory::CHAPTER },
+ { XML_LIST, ParagraphStyleCategory::LIST },
+ { XML_INDEX, ParagraphStyleCategory::INDEX },
+ { XML_EXTRA, ParagraphStyleCategory::EXTRA },
+ { XML_HTML, ParagraphStyleCategory::HTML },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+void XMLTextStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
+ const OUString& rLocalName,
+ const OUString& rValue )
+{
+ if( XML_NAMESPACE_STYLE == nPrefixKey )
+ {
+ // TODO: use a map here
+ if( IsXMLToken( rLocalName, XML_AUTO_UPDATE ) )
+ {
+ if( IsXMLToken( rValue, XML_TRUE ) )
+ bAutoUpdate = sal_True;
+ }
+ else if( IsXMLToken( rLocalName, XML_LIST_STYLE_NAME ) )
+ {
+ sListStyleName = rValue;
+ // Inherited paragraph style lost information about unset numbering (#i69523#)
+ mbListStyleSet = sal_True;
+ }
+ else if( IsXMLToken( rLocalName, XML_MASTER_PAGE_NAME ) )
+ {
+ sMasterPageName = rValue;
+ bHasMasterPageName = sal_True;
+ }
+ else if( IsXMLToken( rLocalName, XML_DATA_STYLE_NAME ) )
+ {
+ sDataStyleName = rValue;
+ }
+ else if( IsXMLToken( rLocalName, XML_CLASS ) )
+ {
+ sCategoryVal = rValue;
+ }
+ else if( IsXMLToken( rLocalName, XML_DEFAULT_OUTLINE_LEVEL ) )
+ {
+ sal_Int32 nTmp;
+ if( SvXMLUnitConverter::convertNumber( nTmp, rValue ) &&
+ 0 <= nTmp && nTmp <= 10 )
+ nOutlineLevel = static_cast< sal_Int8 >( nTmp );
+ }
+ else
+ {
+ XMLPropStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
+ }
+ }
+ else
+ {
+ XMLPropStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
+ }
+}
+
+TYPEINIT1( XMLTextStyleContext, XMLPropStyleContext );
+
+XMLTextStyleContext::XMLTextStyleContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx, const OUString& rLName,
+ const Reference< XAttributeList > & xAttrList,
+ SvXMLStylesContext& rStyles, sal_uInt16 nFamily,
+ sal_Bool bDefaultStyle )
+: XMLPropStyleContext( rImport, nPrfx, rLName, xAttrList, rStyles, nFamily, bDefaultStyle )
+, sIsAutoUpdate( RTL_CONSTASCII_USTRINGPARAM( "IsAutoUpdate" ) )
+, sCategory( RTL_CONSTASCII_USTRINGPARAM( "Category" ) )
+, sNumberingStyleName( RTL_CONSTASCII_USTRINGPARAM( "NumberingStyleName" ) )
+, sOutlineLevel(RTL_CONSTASCII_USTRINGPARAM( "OutlineLevel" ) )
+, sDropCapCharStyleName( RTL_CONSTASCII_USTRINGPARAM( "DropCapCharStyleName" ) )
+, sPageDescName( RTL_CONSTASCII_USTRINGPARAM( "PageDescName" ) )
+, nOutlineLevel( -1 )
+, bAutoUpdate( sal_False )
+, bHasMasterPageName( sal_False )
+, bHasCombinedCharactersLetter( sal_False )
+// Inherited paragraph style lost information about unset numbering (#i69523#)
+, mbListStyleSet( sal_False )
+, pEventContext( NULL )
+{
+}
+
+XMLTextStyleContext::~XMLTextStyleContext()
+{
+}
+
+SvXMLImportContext *XMLTextStyleContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference< XAttributeList > & xAttrList )
+{
+ SvXMLImportContext *pContext = 0;
+
+ if( XML_NAMESPACE_STYLE == nPrefix )
+ {
+ sal_uInt32 nFamily = 0;
+ if( IsXMLToken( rLocalName, XML_TEXT_PROPERTIES ) )
+ nFamily = XML_TYPE_PROP_TEXT;
+ else if( IsXMLToken( rLocalName, XML_PARAGRAPH_PROPERTIES ) )
+ nFamily = XML_TYPE_PROP_PARAGRAPH;
+ else if( IsXMLToken( rLocalName, XML_SECTION_PROPERTIES ) )
+ nFamily = XML_TYPE_PROP_SECTION;
+ else if( IsDefaultStyle() && IsXMLToken( rLocalName, XML_TABLE_PROPERTIES ) )
+ nFamily = XML_TYPE_PROP_TABLE;
+ else if( IsDefaultStyle() && IsXMLToken( rLocalName, XML_TABLE_ROW_PROPERTIES ) )
+ nFamily = XML_TYPE_PROP_TABLE_ROW;
+ if( nFamily )
+ {
+ UniReference < SvXMLImportPropertyMapper > xImpPrMap =
+ GetStyles()->GetImportPropertyMapper( GetFamily() );
+ if( xImpPrMap.is() )
+ pContext = new XMLTextPropertySetContext( GetImport(), nPrefix,
+ rLocalName, xAttrList,
+ nFamily,
+ GetProperties(),
+ xImpPrMap,
+ sDropCapTextStyleName );
+ }
+ }
+ else if ( (XML_NAMESPACE_OFFICE == nPrefix) &&
+ IsXMLToken( rLocalName, XML_EVENT_LISTENERS ) )
+ {
+ // create and remember events import context
+ // (for delayed processing of events)
+ pEventContext = new XMLEventsImportContext( GetImport(), nPrefix,
+ rLocalName);
+ pEventContext->AddRef();
+ pContext = pEventContext;
+ }
+
+ if( !pContext )
+ pContext = XMLPropStyleContext::CreateChildContext( nPrefix, rLocalName,
+ xAttrList );
+
+ return pContext;
+}
+
+void XMLTextStyleContext::CreateAndInsert( sal_Bool bOverwrite )
+{
+ XMLPropStyleContext::CreateAndInsert( bOverwrite );
+ Reference < XStyle > xStyle = GetStyle();
+ if( !xStyle.is() || !(bOverwrite || IsNew()) )
+ return;
+
+ Reference < XPropertySet > xPropSet( xStyle, UNO_QUERY );
+ Reference< XPropertySetInfo > xPropSetInfo =
+ xPropSet->getPropertySetInfo();
+ if( xPropSetInfo->hasPropertyByName( sIsAutoUpdate ) )
+ {
+ Any aAny;
+ sal_Bool bTmp = bAutoUpdate;
+ aAny.setValue( &bTmp, ::getBooleanCppuType() );
+ xPropSet->setPropertyValue( sIsAutoUpdate, aAny );
+ }
+
+ sal_uInt16 nCategory = ParagraphStyleCategory::TEXT;
+ if( XML_STYLE_FAMILY_TEXT_PARAGRAPH == GetFamily() &&
+ sCategoryVal.getLength() && xStyle->isUserDefined() &&
+ xPropSetInfo->hasPropertyByName( sCategory ) &&
+ SvXMLUnitConverter::convertEnum( nCategory, sCategoryVal, aCategoryMap ) )
+ {
+ Any aAny;
+ aAny <<= (sal_Int16)nCategory;
+ xPropSet->setPropertyValue( sCategory, aAny );
+ }
+
+ // tell the style about it's events (if applicable)
+ if (NULL != pEventContext)
+ {
+ // set event suppplier and release reference to context
+ Reference<document::XEventsSupplier> xEventsSupplier(xStyle,UNO_QUERY);
+ pEventContext->SetEvents(xEventsSupplier);
+ pEventContext->ReleaseRef();
+ }
+
+ // XML import: reconstrution of assignment of paragraph style to outline levels (#i69629#)
+ if ( nOutlineLevel > 0 )
+ {
+ GetImport().GetTextImport()->AddOutlineStyleCandidate( nOutlineLevel,
+ GetDisplayName() );
+ }
+}
+
+void XMLTextStyleContext::SetDefaults( )
+{
+ if( ( GetFamily() == XML_STYLE_FAMILY_TEXT_PARAGRAPH ) ||
+ ( GetFamily() == XML_STYLE_FAMILY_TABLE_TABLE ) ||
+ ( GetFamily() == XML_STYLE_FAMILY_TABLE_ROW ) )
+ {
+ Reference < XMultiServiceFactory > xFactory ( GetImport().GetModel(), UNO_QUERY);
+ if (xFactory.is())
+ {
+ Reference < XInterface > xInt = xFactory->createInstance (
+ OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.text.Defaults" ) ) );
+ Reference < XPropertySet > xProperties ( xInt, UNO_QUERY );
+ if ( xProperties.is() )
+ FillPropertySet ( xProperties );
+ }
+ }
+}
+
+void XMLTextStyleContext::Finish( sal_Bool bOverwrite )
+{
+ XMLPropStyleContext::Finish( bOverwrite );
+
+ Reference < XStyle > xStyle = GetStyle();
+ // Consider set empty list style (#i69523#)
+ if ( !( mbListStyleSet ||
+ nOutlineLevel >= 0 ||
+ sDropCapTextStyleName.getLength() ||
+ bHasMasterPageName ) ||
+ !xStyle.is() ||
+ !( bOverwrite || IsNew() ) )
+ return;
+
+ Reference < XPropertySet > xPropSet( xStyle, UNO_QUERY );
+ Reference< XPropertySetInfo > xPropSetInfo =
+ xPropSet->getPropertySetInfo();
+
+ if( xPropSetInfo->hasPropertyByName( sOutlineLevel ))
+ {
+ Any aAny;
+ if( nOutlineLevel >= 0 )
+ {
+ aAny <<= nOutlineLevel;
+ xPropSet->setPropertyValue( sOutlineLevel, aAny );
+ }
+ }
+
+ // Consider set empty list style (#i69523#)
+ if ( mbListStyleSet &&
+ xPropSetInfo->hasPropertyByName( sNumberingStyleName ) )
+ {
+ /* Only for text document from version prior OOo 2.1 resp. SO 8 PU5:
+ - Do not apply list style, if paragraph style has a default outline
+ level > 0 and thus, will be assigned to the corresponding list
+ level of the outline style. (#i70223#)
+ */
+ bool bApplyListStyle( true );
+ if ( nOutlineLevel > 0 )
+ {
+ if ( GetImport().IsTextDocInOOoFileFormat() )
+ {
+ bApplyListStyle = false;
+ }
+ else
+ {
+ sal_Int32 nUPD( 0 );
+ sal_Int32 nBuild( 0 );
+ // Check explicitly on certain versions (#i86058#)
+ if ( GetImport().getBuildIds( nUPD, nBuild ) &&
+ ( ( nUPD == 641 ) || ( nUPD == 645 ) || // prior OOo 2.0
+ ( nUPD == 680 && nBuild <= 9073 ) ) ) // OOo 2.0 - OOo 2.0.4
+ {
+ bApplyListStyle = false;
+ }
+ }
+ }
+
+ if ( bApplyListStyle )
+ {
+ if ( !sListStyleName.getLength() )
+ {
+ Any aAny;
+ aAny <<= sListStyleName /* empty string */;
+ xPropSet->setPropertyValue( sNumberingStyleName, aAny );
+ }
+ else
+ {
+ // change list style name to display name
+ OUString sDisplayListStyleName(
+ GetImport().GetStyleDisplayName( XML_STYLE_FAMILY_TEXT_LIST,
+ sListStyleName ) );
+ // The families container must exist
+ const Reference < XNameContainer >& rNumStyles =
+ GetImport().GetTextImport()->GetNumberingStyles();
+ // if( rNumStyles.is() && rNumStyles->hasByName( sDisplayListStyleName ) &&
+ // xPropSetInfo->hasPropertyByName( sNumberingStyleName ) )
+ if ( rNumStyles.is() &&
+ rNumStyles->hasByName( sDisplayListStyleName ) )
+ {
+ Any aAny;
+ aAny <<= sDisplayListStyleName;
+ xPropSet->setPropertyValue( sNumberingStyleName, aAny );
+ }
+ }
+ }
+ }
+
+ if( sDropCapTextStyleName.getLength() )
+ {
+ // change list style name to display name
+ OUString sDisplayDropCapTextStyleName(
+ GetImport().GetStyleDisplayName( XML_STYLE_FAMILY_TEXT_TEXT,
+ sDropCapTextStyleName ) );
+ // The families cointaner must exist
+ const Reference < XNameContainer >& rTextStyles =
+ GetImport().GetTextImport()->GetTextStyles();
+ if( rTextStyles.is() &&
+ rTextStyles->hasByName( sDisplayDropCapTextStyleName ) &&
+ xPropSetInfo->hasPropertyByName( sDropCapCharStyleName ) )
+ {
+ Any aAny;
+ aAny <<= sDisplayDropCapTextStyleName;
+ xPropSet->setPropertyValue( sDropCapCharStyleName, aAny );
+ }
+ }
+
+ if( bHasMasterPageName )
+ {
+ OUString sDisplayName(
+ GetImport().GetStyleDisplayName(
+ XML_STYLE_FAMILY_MASTER_PAGE, sMasterPageName ) );
+ // The families cointaner must exist
+ const Reference < XNameContainer >& rPageStyles =
+ GetImport().GetTextImport()->GetPageStyles();
+ if( ( !sDisplayName.getLength() ||
+ (rPageStyles.is() &&
+ rPageStyles->hasByName( sDisplayName )) ) &&
+ xPropSetInfo->hasPropertyByName( sPageDescName ) )
+ {
+ Any aAny;
+ aAny <<= sDisplayName;
+ xPropSet->setPropertyValue( sPageDescName, aAny );
+ }
+ }
+}
+
+void XMLTextStyleContext::FillPropertySet(
+ const Reference<XPropertySet > & rPropSet )
+{
+ // imitate the FillPropertySet of the super class, so we get a chance to
+ // catch the combined characters attribute
+
+ // imitate XMLPropStyleContext::FillPropertySet(...)
+ UniReference < SvXMLImportPropertyMapper > xImpPrMap =
+ ((SvXMLStylesContext *)GetStyles())->GetImportPropertyMapper(GetFamily());
+ DBG_ASSERT( xImpPrMap.is(), "Where is the import prop mapper?" );
+ if( xImpPrMap.is() )
+ {
+
+ // imitate SvXMLImportPropertyMapper::FillPropertySet(...)
+
+ // The reason for this is that we have no other way to
+ // efficiently intercept the value of combined characters. To
+ // get that value, we could iterate through the map once more,
+ // but instead we chose to insert the code into this
+ // iteration. I haven't been able to come up with a much more
+ // intelligent solution.
+
+
+ struct _ContextID_Index_Pair aContextIDs[] =
+ {
+ { CTF_COMBINED_CHARACTERS_FIELD, -1 },
+ { CTF_KEEP_TOGETHER, -1 },
+ { CTF_BORDER_MODEL, -1 },
+ { CTF_TEXT_DISPLAY, -1 },
+ { CTF_FONTFAMILYNAME, -1 },
+ { CTF_FONTFAMILYNAME_CJK, -1 },
+ { CTF_FONTFAMILYNAME_CTL, -1 },
+ { -1, -1 }
+ };
+
+ // get property set info
+ Reference< XPropertySetInfo > xInfo( rPropSet->getPropertySetInfo(), UNO_SET_THROW );
+
+ bool bAutomatic = false;
+ if( ((SvXMLStylesContext *)GetStyles())->IsAutomaticStyle() &&
+ ( GetFamily() == XML_STYLE_FAMILY_TEXT_TEXT || GetFamily() == XML_STYLE_FAMILY_TEXT_PARAGRAPH ) )
+ {
+ bAutomatic = true;
+ if( GetAutoName().getLength() )
+ {
+ OUString sAutoProp = ( GetFamily() == XML_STYLE_FAMILY_TEXT_TEXT ) ?
+ OUString( RTL_CONSTASCII_USTRINGPARAM("CharAutoStyleName") ):
+ OUString( RTL_CONSTASCII_USTRINGPARAM("ParaAutoStyleName") );
+ try
+ {
+ if ( xInfo->hasPropertyByName( sAutoProp ) )
+ rPropSet->setPropertyValue( sAutoProp, makeAny(GetAutoName()) );
+ else
+ bAutomatic = false;
+ }
+ catch( const RuntimeException& ) { throw; }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ bAutomatic = false;
+ }
+ }
+ }
+ if( bAutomatic )
+ xImpPrMap->CheckSpecialContext( GetProperties(), rPropSet, aContextIDs );
+ else
+ xImpPrMap->FillPropertySet( GetProperties(), rPropSet, aContextIDs );
+
+ // have we found a combined characters
+ sal_Int32 nIndex = aContextIDs[0].nIndex;
+ if ( nIndex != -1 )
+ {
+ Any& rAny = GetProperties()[nIndex].maValue;
+ sal_Bool bVal = *(sal_Bool*)rAny.getValue();
+ bHasCombinedCharactersLetter = bVal;
+ }
+
+ // keep-together: the application default is different from
+ // the file format default. Hence, if we always set this
+ // value; if we didn't find one, we'll set to false, the file
+ // format default.
+ // border-model: same
+ if( IsDefaultStyle() && GetFamily() == XML_STYLE_FAMILY_TABLE_ROW )
+ {
+ OUString sIsSplitAllowed =
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "IsSplitAllowed" ) );
+ DBG_ASSERT( rPropSet->getPropertySetInfo()->hasPropertyByName( sIsSplitAllowed ),
+ "property missing?" );
+ rPropSet->setPropertyValue( sIsSplitAllowed,
+ (aContextIDs[1].nIndex == -1)
+ ? makeAny( false )
+ : GetProperties()[aContextIDs[1].nIndex].maValue );
+ }
+
+ if( IsDefaultStyle() && GetFamily() == XML_STYLE_FAMILY_TABLE_TABLE )
+ {
+ OUString sCollapsingBorders(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "CollapsingBorders" ) ) );
+ DBG_ASSERT( rPropSet->getPropertySetInfo()->hasPropertyByName( sCollapsingBorders ),
+ "property missing?" );
+ rPropSet->setPropertyValue( sCollapsingBorders,
+ (aContextIDs[2].nIndex == -1)
+ ? makeAny( false )
+ : GetProperties()[aContextIDs[2].nIndex].maValue );
+ }
+
+
+ // check for StarBats and StarMath fonts
+
+ // iterate over aContextIDs entries 3..6
+ for ( sal_Int32 i = 3; i < 7; i++ )
+ {
+ nIndex = aContextIDs[i].nIndex;
+ if ( nIndex != -1 )
+ {
+ // Found!
+ struct XMLPropertyState& rState = GetProperties()[nIndex];
+ Any rAny = rState.maValue;
+ sal_Int32 nMapperIndex = rState.mnIndex;
+
+ // Now check for font name in rState and set corrected value,
+ // if necessary.
+ OUString sFontName;
+ rAny >>= sFontName;
+ if ( sFontName.getLength() > 0 )
+ {
+ OUString sStarBats( RTL_CONSTASCII_USTRINGPARAM("StarBats" ) );
+ OUString sStarMath( RTL_CONSTASCII_USTRINGPARAM("StarMath" ) );
+ if ( sFontName.equalsIgnoreAsciiCase( sStarBats ) ||
+ sFontName.equalsIgnoreAsciiCase( sStarMath ) )
+ {
+ // construct new value
+ sFontName = OUString(
+ RTL_CONSTASCII_USTRINGPARAM("StarSymbol") );
+ Any aAny( rAny );
+ aAny <<= sFontName;
+
+ // get property set mapper
+ UniReference<XMLPropertySetMapper> rPropMapper =
+ xImpPrMap->getPropertySetMapper();
+
+ // set property
+ OUString rPropertyName(
+ rPropMapper->GetEntryAPIName(nMapperIndex) );
+ if ( xInfo->hasPropertyByName( rPropertyName ) )
+ {
+ rPropSet->setPropertyValue( rPropertyName, aAny );
+ }
+ }
+ // else: "normal" style name -> no correction is necessary
+ }
+ // else: no style name found -> illegal value -> ignore
+ }
+ }
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/txtvfldi.cxx b/xmloff/source/text/txtvfldi.cxx
new file mode 100644
index 000000000000..d3ade9a90d4f
--- /dev/null
+++ b/xmloff/source/text/txtvfldi.cxx
@@ -0,0 +1,1476 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+/** @#file
+ *
+ * export of all variable related text fields (and database display field)
+ */
+#include "txtvfldi.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/txtimp.hxx>
+#include <xmloff/xmlnumi.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/i18nmap.hxx"
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmlement.hxx>
+#include <com/sun/star/text/SetVariableType.hpp>
+#include <com/sun/star/text/XTextField.hpp>
+#include <com/sun/star/text/XDependentTextField.hpp>
+#include <com/sun/star/text/XTextFieldsSupplier.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+
+#ifndef _RTL_USTRING
+#include <rtl/ustring.hxx>
+#endif
+#include <tools/debug.hxx>
+
+
+// service names
+static const sal_Char sAPI_textfield_prefix[] = "com.sun.star.text.TextField.";
+static const sal_Char sAPI_fieldmaster_prefix[] = "com.sun.star.text.FieldMaster.";
+static const sal_Char sAPI_input[] = "Input";
+static const sal_Char sAPI_input_user[] = "InputUser";
+static const sal_Char sAPI_get_expression[] = "GetExpression";
+static const sal_Char sAPI_set_expression[] = "SetExpression";
+static const sal_Char sAPI_user[] = "User";
+static const sal_Char sAPI_table_formula[] = "TableFormula";
+static const sal_Char sAPI_database[] = "com.sun.star.text.TextField.Database";
+static const sal_Char sAPI_fieldmaster_database[] = "com.sun.star.text.FieldMaster.Database";
+
+// property names
+static const sal_Char sAPI_hint[] = "Hint";
+static const sal_Char sAPI_help[] = "Help";
+static const sal_Char sAPI_tooltip[] = "Tooltip";
+static const sal_Char sAPI_content[] = "Content";
+static const sal_Char sAPI_sub_type[] = "SubType";
+static const sal_Char sAPI_is_expression[] = "IsExpression";
+static const sal_Char sAPI_is_input[] = "Input";
+static const sal_Char sAPI_is_show_formula[] = "IsShowFormula";
+static const sal_Char sAPI_numbering_type[] = "NumberingType";
+static const sal_Char sAPI_number_format[] = "NumberFormat";
+static const sal_Char sAPI_name[] = "Name";
+static const sal_Char sAPI_numbering_separator[] = "NumberingSeparator";
+static const sal_Char sAPI_chapter_numbering_level[]= "ChapterNumberingLevel";
+static const sal_Char sAPI_value[] = "Value";
+static const sal_Char sAPI_is_visible[] = "IsVisible";
+static const sal_Char sAPI_variable_subtype[] = "VariableSubtype";
+static const sal_Char sAPI_data_column_name[] = "DataColumnName";
+static const sal_Char sAPI_is_data_base_format[] = "DataBaseFormat";
+static const sal_Char sAPI_current_presentation[] = "CurrentPresentation";
+static const sal_Char sAPI_sequence_value[] = "SequenceValue";
+static const sal_Char sAPI_is_fixed_language[] = "IsFixedLanguage";
+
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::style;
+using namespace ::xmloff::token;
+
+
+
+//
+// XMLVarFieldImportContext: superclass for all variable related fields
+//
+
+TYPEINIT1( XMLVarFieldImportContext, XMLTextFieldImportContext );
+
+XMLVarFieldImportContext::XMLVarFieldImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp,
+ const sal_Char* pServiceName, sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ sal_Bool bName, sal_Bool bFormula, sal_Bool bFormulaDefault,
+ sal_Bool bDescription, sal_Bool bHelp, sal_Bool bHint, sal_Bool bVisible,
+ sal_Bool bIsDisplayFormula,
+ sal_Bool bType, sal_Bool bStyle, sal_Bool bValue,
+ sal_Bool bPresentation) :
+ XMLTextFieldImportContext(rImport, rHlp, pServiceName, nPrfx, rLocalName),
+ sPropertyContent(RTL_CONSTASCII_USTRINGPARAM(sAPI_content)),
+ sPropertyHint(RTL_CONSTASCII_USTRINGPARAM(sAPI_hint)),
+ sPropertyHelp(RTL_CONSTASCII_USTRINGPARAM(sAPI_help)),
+ sPropertyTooltip(RTL_CONSTASCII_USTRINGPARAM(sAPI_tooltip)),
+ sPropertyIsVisible(RTL_CONSTASCII_USTRINGPARAM(sAPI_is_visible)),
+ sPropertyIsDisplayFormula(RTL_CONSTASCII_USTRINGPARAM(sAPI_is_show_formula)),
+ sPropertyCurrentPresentation(RTL_CONSTASCII_USTRINGPARAM(sAPI_current_presentation)),
+ aValueHelper(rImport, rHlp, bType, bStyle, bValue, sal_False),
+ bDisplayFormula(sal_False),
+ bDisplayNone(sal_False),
+ bNameOK(sal_False),
+ bFormulaOK(sal_False),
+ bDescriptionOK(sal_False),
+ bHelpOK(sal_False),
+ bHintOK(sal_False),
+ bDisplayOK(sal_False),
+ bSetName(bName),
+ bSetFormula(bFormula),
+ bSetFormulaDefault(bFormulaDefault),
+ bSetDescription(bDescription),
+ bSetHelp(bHelp),
+ bSetHint(bHint),
+ bSetVisible(bVisible),
+ bSetDisplayFormula(bIsDisplayFormula),
+ bSetPresentation(bPresentation)
+{
+}
+
+void XMLVarFieldImportContext::ProcessAttribute(
+ sal_uInt16 nAttrToken,
+ const OUString& sAttrValue )
+{
+ switch (nAttrToken)
+ {
+ case XML_TOK_TEXTFIELD_NAME:
+ sName = sAttrValue;
+ bNameOK = sal_True;
+ bValid = sal_True; // we assume: field with name is valid!
+ break;
+ case XML_TOK_TEXTFIELD_DESCRIPTION:
+ sDescription = sAttrValue;
+ bDescriptionOK = sal_True;
+ break;
+ case XML_TOK_TEXTFIELD_HELP:
+ sHelp = sAttrValue;
+ bHelpOK = true;
+ break;
+ case XML_TOK_TEXTFIELD_HINT:
+ sHint = sAttrValue;
+ bHintOK = true;
+ break;
+ case XML_TOK_TEXTFIELD_FORMULA:
+ {
+ OUString sTmp;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ _GetKeyByAttrName( sAttrValue, &sTmp, sal_False );
+ if( XML_NAMESPACE_OOOW == nPrefix )
+ {
+ sFormula = sTmp;
+ bFormulaOK = sal_True;
+ }
+ else
+ sFormula = sAttrValue;
+ }
+ break;
+ case XML_TOK_TEXTFIELD_DISPLAY:
+ if (IsXMLToken(sAttrValue, XML_FORMULA))
+ {
+ bDisplayFormula = sal_True;
+ bDisplayNone = sal_False;
+ bDisplayOK = sal_True;
+ }
+ else if (IsXMLToken(sAttrValue, XML_VALUE))
+ {
+ bDisplayFormula = sal_False;
+ bDisplayNone = sal_False;
+ bDisplayOK = sal_True;
+ }
+ else if (IsXMLToken(sAttrValue, XML_NONE))
+ {
+ bDisplayFormula = sal_False;
+ bDisplayNone = sal_True;
+ bDisplayOK = sal_True;
+ } // else: no change
+ DBG_ASSERT(!(bDisplayFormula && bDisplayNone),
+ "illegal display values");
+ break;
+ default:
+ // delegate all others to value helper
+ aValueHelper.ProcessAttribute(nAttrToken, sAttrValue);
+ break;
+ }
+}
+
+void XMLVarFieldImportContext::PrepareField(
+ const Reference<XPropertySet> & xPropertySet)
+{
+ // bSetName: not implemented
+
+ if (bSetFormula)
+ {
+ if (!bFormulaOK && bSetFormulaDefault)
+ {
+ sFormula = GetContent();
+ bFormulaOK = sal_True;
+ }
+
+ if (bFormulaOK)
+ {
+ Any aAny;
+ aAny <<= sFormula;
+ xPropertySet->setPropertyValue(sPropertyContent, aAny);
+ }
+ }
+
+ if (bSetDescription && bDescriptionOK)
+ {
+ Any aAny;
+ aAny <<= sDescription;
+ xPropertySet->setPropertyValue(sPropertyHint, aAny);
+ }
+
+ if (bSetHelp && bHelpOK)
+ {
+ Any aAny;
+ aAny <<= sHelp;
+ xPropertySet->setPropertyValue(sPropertyHelp, aAny);
+ }
+
+ if (bSetHint && bHintOK)
+ {
+ Any aAny;
+ aAny <<= sHint;
+ xPropertySet->setPropertyValue(sPropertyTooltip, aAny);
+ }
+
+ if (bSetVisible && bDisplayOK)
+ {
+ Any aAny;
+ sal_Bool bTmp = ! (bDisplayNone && bDisplayOK);
+ aAny.setValue( &bTmp, ::getBooleanCppuType());
+ xPropertySet->setPropertyValue(sPropertyIsVisible, aAny);
+ }
+
+ // workaround for #no-bug#: display formula by default
+ if (xPropertySet->getPropertySetInfo()->
+ hasPropertyByName(sPropertyIsDisplayFormula) &&
+ !bSetDisplayFormula)
+ {
+ bDisplayFormula = sal_False;
+ bSetDisplayFormula = sal_True;
+ }
+
+
+ if (bSetDisplayFormula)
+ {
+ Any aAny;
+ sal_Bool bTmp = bDisplayFormula && bDisplayOK;
+ aAny.setValue( &bTmp, ::getBooleanCppuType());
+ xPropertySet->setPropertyValue(sPropertyIsDisplayFormula, aAny);
+ }
+
+ // delegate to value helper
+ aValueHelper.SetDefault(GetContent());
+ aValueHelper.PrepareField(xPropertySet);
+
+ // finally, set the curren presentation
+ if (bSetPresentation)
+ {
+ Any aAny;
+ aAny <<= GetContent();
+ xPropertySet->setPropertyValue(sPropertyCurrentPresentation, aAny);
+ }
+}
+
+
+
+
+
+//
+// variable set fields
+//
+
+TYPEINIT1( XMLSetVarFieldImportContext, XMLVarFieldImportContext );
+
+XMLSetVarFieldImportContext::XMLSetVarFieldImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp,
+ const sal_Char* pServiceName, sal_uInt16 nPrfx,
+ const OUString& rLocalName, VarType eVarType,
+ sal_Bool bName, sal_Bool bFormula, sal_Bool bFormulaDefault,
+ sal_Bool bDescription, sal_Bool bHelp, sal_Bool bHint, sal_Bool bVisible, sal_Bool bIsDisplayFormula,
+ sal_Bool bType, sal_Bool bStyle, sal_Bool bValue, sal_Bool bPresentation) :
+ XMLVarFieldImportContext(rImport, rHlp, pServiceName,
+ nPrfx, rLocalName,
+ bName, bFormula, bFormulaDefault,
+ bDescription, bHelp, bHint, bVisible, bIsDisplayFormula,
+ bType, bStyle, bValue, bPresentation),
+ eFieldType(eVarType)
+{
+}
+
+void XMLSetVarFieldImportContext::EndElement()
+{
+ // should we call PrepareField on the field, or rather on it's master?
+ // currently: call on field (just like superclass)
+ // possible alternatives: call on master
+ // call field or master depending on variable
+ // PrepareMaster() in addition to PrepareField()
+
+ DBG_ASSERT(GetServiceName().getLength()>0, "no service name for element!");
+
+ if (bValid)
+ {
+ DBG_ASSERT(GetName().getLength()>0, "variable name needed!");
+
+ // find field master
+ Reference<XPropertySet> xMaster;
+ if (FindFieldMaster(xMaster))
+ {
+ // create field/Service
+ Reference<XPropertySet> xPropSet;
+ if (CreateField(xPropSet, OUString(RTL_CONSTASCII_USTRINGPARAM(sAPI_textfield_prefix)) + GetServiceName()))
+ {
+ Reference<XDependentTextField> xDepTextField(xPropSet, UNO_QUERY);
+ if (xDepTextField.is())
+ {
+ // attach field to field master
+ xDepTextField->attachTextFieldMaster(xMaster);
+
+ // attach field to document
+ Reference<XTextContent> xTextContent(xPropSet, UNO_QUERY);
+ if (xTextContent.is())
+ {
+ try {
+ // insert, set field properties and exit!
+ GetImportHelper().InsertTextContent(xTextContent);
+ PrepareField(xPropSet);
+ } catch (lang::IllegalArgumentException & /*e*/)
+ {
+ // ignore e: #i54023#
+ };
+ return;
+ }
+ }
+ }
+ }
+ }
+
+ // above: exit on success; so for all error cases we end up here!
+ // write element content
+ GetImportHelper().InsertString(GetContent());
+}
+
+sal_Bool XMLSetVarFieldImportContext::FindFieldMaster(
+ Reference<XPropertySet> & xMaster)
+{
+ // currently: delegate to XMLVariableDeclImportContext;
+ // shoud eventually go here
+ return XMLVariableDeclImportContext::FindFieldMaster(xMaster,
+ GetImport(),
+ GetImportHelper(),
+ GetName(),
+ eFieldType);
+}
+
+
+
+//
+// sequence field
+//
+
+TYPEINIT1( XMLSequenceFieldImportContext, XMLSetVarFieldImportContext );
+
+XMLSequenceFieldImportContext::XMLSequenceFieldImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx, const OUString& rLocalName) :
+ XMLSetVarFieldImportContext(rImport, rHlp, sAPI_set_expression,
+ nPrfx, rLocalName, VarTypeSequence,
+ // name, formula
+ sal_True, sal_True, sal_True,
+ sal_False, sal_False, sal_False, sal_False,
+ sal_False,
+ sal_False, sal_False, sal_False, sal_True),
+
+ sPropertyNumberFormat(RTL_CONSTASCII_USTRINGPARAM(sAPI_number_format)),
+ sPropertySequenceValue(RTL_CONSTASCII_USTRINGPARAM(sAPI_sequence_value)),
+ sNumFormat(OUString::valueOf(sal_Unicode('1'))),
+ sNumFormatSync(GetXMLToken(XML_FALSE)),
+ bRefNameOK(sal_False)
+{
+}
+
+void XMLSequenceFieldImportContext::ProcessAttribute(
+ sal_uInt16 nAttrToken, const OUString& sAttrValue )
+{
+ switch (nAttrToken)
+ {
+ case XML_TOK_TEXTFIELD_NUM_FORMAT:
+ sNumFormat = sAttrValue;
+ break;
+ case XML_TOK_TEXTFIELD_NUM_LETTER_SYNC:
+ sNumFormatSync = sAttrValue;
+ break;
+ case XML_TOK_TEXTFIELD_REF_NAME:
+ sRefName = sAttrValue;
+ bRefNameOK = sal_True;
+ break;
+ default:
+ // delegate to super class (name, formula)
+ XMLSetVarFieldImportContext::ProcessAttribute(nAttrToken,
+ sAttrValue);
+ break;
+ } // switch
+}
+
+void XMLSequenceFieldImportContext::PrepareField(
+ const Reference<XPropertySet> & xPropertySet)
+{
+ // delegate to super class (formula)
+ XMLSetVarFieldImportContext::PrepareField(xPropertySet);
+
+ // set format
+ sal_Int16 nNumType = NumberingType::ARABIC;
+ GetImport().GetMM100UnitConverter().convertNumFormat( nNumType, sNumFormat, sNumFormatSync );
+ Any aAny;
+ aAny <<= nNumType;
+ xPropertySet->setPropertyValue(sPropertyNumberFormat, aAny);
+
+ // handle reference name
+ if (bRefNameOK)
+ {
+ aAny = xPropertySet->getPropertyValue(sPropertySequenceValue);
+ sal_Int16 nValue = 0;
+ aAny >>= nValue;
+ GetImportHelper().InsertSequenceID(sRefName, GetName(), nValue);
+ }
+}
+
+
+
+//
+// variable set field
+//
+
+TYPEINIT1( XMLVariableSetFieldImportContext, XMLSetVarFieldImportContext );
+
+XMLVariableSetFieldImportContext::XMLVariableSetFieldImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx, const OUString& rLocalName) :
+ XMLSetVarFieldImportContext(rImport, rHlp, sAPI_set_expression,
+ nPrfx, rLocalName, VarTypeSimple,
+ // name, formula, value&type, style,
+ // display none
+ sal_True, sal_True, sal_True,
+ sal_False, sal_False, sal_False,
+ sal_True, sal_False,
+ sal_True, sal_True, sal_True,
+ sal_True),
+ sPropertySubType(RTL_CONSTASCII_USTRINGPARAM(sAPI_sub_type))
+{
+}
+
+void XMLVariableSetFieldImportContext::PrepareField(
+ const Reference<XPropertySet> & xPropertySet)
+{
+ // set type
+ Any aAny;
+ aAny <<= (IsStringValue()? SetVariableType::STRING : SetVariableType::VAR);
+ xPropertySet->setPropertyValue(sPropertySubType, aAny);
+
+ // the remainder is handled by super class
+ XMLSetVarFieldImportContext::PrepareField(xPropertySet);
+}
+
+
+
+//
+// variable input field
+//
+
+TYPEINIT1( XMLVariableInputFieldImportContext, XMLSetVarFieldImportContext );
+
+XMLVariableInputFieldImportContext::XMLVariableInputFieldImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp, sal_uInt16 nPrfx,
+ const OUString& rLocalName) :
+ XMLSetVarFieldImportContext(rImport, rHlp, sAPI_set_expression,
+ nPrfx, rLocalName, VarTypeSimple,
+ // name, description, display none/formula,
+ // value&type, style, formula
+ sal_True, sal_True, sal_True,
+ sal_True, sal_True, sal_True,
+ sal_True, sal_False,
+ sal_True, sal_True, sal_True,
+ sal_True),
+ sPropertySubType(RTL_CONSTASCII_USTRINGPARAM(sAPI_sub_type)),
+ sPropertyIsInput(RTL_CONSTASCII_USTRINGPARAM(sAPI_is_input))
+{
+}
+
+void XMLVariableInputFieldImportContext::PrepareField(
+ const Reference<XPropertySet> & xPropertySet)
+{
+ // set type (input field)
+ Any aAny;
+ sal_Bool bTrue = sal_True;
+ aAny.setValue( &bTrue, ::getBooleanCppuType() );
+ xPropertySet->setPropertyValue(sPropertyIsInput, aAny);
+
+ // set type
+ aAny <<= (IsStringValue()? SetVariableType::STRING : SetVariableType::VAR);
+ xPropertySet->setPropertyValue(sPropertySubType, aAny);
+
+ // the remainder is handled by super class
+ XMLSetVarFieldImportContext::PrepareField(xPropertySet);
+}
+
+
+
+//
+// user field
+//
+
+TYPEINIT1( XMLUserFieldImportContext, XMLSetVarFieldImportContext );
+
+XMLUserFieldImportContext::XMLUserFieldImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx, const OUString& rLocalName) :
+ XMLSetVarFieldImportContext(rImport, rHlp, sAPI_user, nPrfx,
+ rLocalName, VarTypeUserField,
+ // name, display none/formula, style
+ sal_True, sal_False, sal_False,
+ sal_False, sal_False, sal_False, sal_True,
+ sal_True,
+ sal_False, sal_True, sal_False,
+ sal_False)
+{
+}
+
+
+
+//
+// user input field
+//
+
+TYPEINIT1( XMLUserFieldInputImportContext, XMLVarFieldImportContext );
+
+// bug: doesn't work (SO API lacking)
+XMLUserFieldInputImportContext::XMLUserFieldInputImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp, sal_uInt16 nPrfx,
+ const OUString& rLocalName) :
+ XMLVarFieldImportContext(rImport, rHlp, sAPI_input_user,
+ nPrfx, rLocalName,
+ // name, description, style
+ sal_True, sal_False, sal_False,
+ sal_True, sal_False, sal_False,
+ sal_False, sal_False,
+ sal_False /*???*/, sal_True, sal_False,
+ sal_False)
+{
+}
+
+void XMLUserFieldInputImportContext::PrepareField(
+ const Reference<XPropertySet> & xPropertySet)
+{
+ Any aAny;
+ aAny <<= GetName();
+ xPropertySet->setPropertyValue(sPropertyContent, aAny);
+
+ // delegate to super class
+ XMLVarFieldImportContext::PrepareField(xPropertySet);
+}
+
+
+//
+// variable get field
+//
+
+TYPEINIT1( XMLVariableGetFieldImportContext, XMLVarFieldImportContext );
+
+XMLVariableGetFieldImportContext::XMLVariableGetFieldImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx, const OUString& rLocalName) :
+ XMLVarFieldImportContext(rImport, rHlp, sAPI_get_expression,
+ nPrfx, rLocalName,
+ // name, style, display formula
+ sal_True, sal_False, sal_False,
+ sal_False, sal_False, sal_False,
+ sal_False, sal_True,
+ sal_True, sal_True, sal_False,
+ sal_True),
+ sPropertySubType(RTL_CONSTASCII_USTRINGPARAM(sAPI_sub_type))
+{
+}
+
+void XMLVariableGetFieldImportContext::PrepareField(
+ const Reference<XPropertySet> & xPropertySet)
+{
+ // set name
+ Any aAny;
+ aAny <<= GetName();
+ xPropertySet->setPropertyValue(sPropertyContent, aAny);
+
+ // the remainder is handled by super class
+ XMLVarFieldImportContext::PrepareField(xPropertySet);
+}
+
+
+
+//
+// expression field
+//
+
+TYPEINIT1( XMLExpressionFieldImportContext, XMLVarFieldImportContext );
+
+XMLExpressionFieldImportContext::XMLExpressionFieldImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx, const OUString& rLocalName) :
+ XMLVarFieldImportContext(rImport, rHlp, sAPI_get_expression,
+ nPrfx, rLocalName,
+ // formula, type, style, display formula
+ sal_False, sal_True, sal_True,
+ sal_False, sal_False, sal_False,
+ sal_False, sal_True,
+ sal_True, sal_True, sal_False,
+ sal_True),
+ sPropertySubType(RTL_CONSTASCII_USTRINGPARAM(sAPI_sub_type))
+{
+ bValid = sal_True; // always valid
+}
+
+
+void XMLExpressionFieldImportContext::PrepareField(
+ const Reference<XPropertySet> & xPropertySet)
+{
+ sal_Int16 nSubType = SetVariableType::FORMULA;
+ Any aAny;
+ aAny <<= nSubType;
+ xPropertySet->setPropertyValue(sPropertySubType, aAny);
+
+ // delegate to super class
+ XMLVarFieldImportContext::PrepareField(xPropertySet);
+}
+
+
+
+//
+// text input field
+//
+
+TYPEINIT1( XMLTextInputFieldImportContext, XMLVarFieldImportContext );
+
+XMLTextInputFieldImportContext::XMLTextInputFieldImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx, const OUString& sLocalName) :
+ XMLVarFieldImportContext(rImport, rHlp, sAPI_input,
+ nPrfx, sLocalName,
+ // description
+ sal_False, sal_False, sal_False,
+ sal_True, sal_True, sal_True,
+ sal_False, sal_False,
+ sal_False, sal_False, sal_False,
+ sal_False),
+ sPropertyContent(RTL_CONSTASCII_USTRINGPARAM(sAPI_content))
+{
+ bValid = sal_True; // always valid
+}
+
+void XMLTextInputFieldImportContext::PrepareField(
+ const Reference<XPropertySet> & xPropertySet)
+{
+ XMLVarFieldImportContext::PrepareField(xPropertySet);
+
+ Any aAny;
+ aAny <<= GetContent();
+ xPropertySet->setPropertyValue(sPropertyContent, aAny);
+}
+
+
+//
+// table formula field
+//
+
+TYPEINIT1( XMLTableFormulaImportContext, XMLTextFieldImportContext );
+
+XMLTableFormulaImportContext::XMLTableFormulaImportContext(
+ SvXMLImport& rImport,
+ XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName) :
+ XMLTextFieldImportContext(rImport, rHlp, sAPI_table_formula,
+ nPrfx, rLocalName),
+ sPropertyIsShowFormula(RTL_CONSTASCII_USTRINGPARAM("IsShowFormula")),
+ sPropertyCurrentPresentation(
+ RTL_CONSTASCII_USTRINGPARAM("CurrentPresentation")),
+ aValueHelper(rImport, rHlp, sal_False, sal_True, sal_False, sal_True),
+ sFormula(),
+ bIsShowFormula(sal_False)
+{
+}
+
+XMLTableFormulaImportContext::~XMLTableFormulaImportContext()
+{
+}
+
+void XMLTableFormulaImportContext::ProcessAttribute(
+ sal_uInt16 nAttrToken,
+ const OUString& sAttrValue )
+{
+ switch (nAttrToken)
+ {
+ case XML_TOK_TEXTFIELD_FORMULA:
+ aValueHelper.ProcessAttribute( nAttrToken, sAttrValue );
+ bValid = sal_True; // we need a formula!
+ break;
+
+ case XML_TOK_TEXTFIELD_DATA_STYLE_NAME:
+ aValueHelper.ProcessAttribute( nAttrToken, sAttrValue );
+ break;
+ case XML_TOK_TEXTFIELD_DISPLAY:
+ if ( sAttrValue.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("formula")) )
+ bIsShowFormula = sal_True;
+ break;
+ default:
+ // unknown attribute -> ignore
+ break;
+ }
+}
+
+void XMLTableFormulaImportContext::PrepareField(
+ const Reference<XPropertySet> & xPropertySet)
+{
+ // set format and formula
+ aValueHelper.PrepareField( xPropertySet );
+
+ Any aAny;
+
+ // set 'show formula' and presentation
+ aAny.setValue( &bIsShowFormula, ::getBooleanCppuType() );
+ xPropertySet->setPropertyValue( sPropertyIsShowFormula, aAny );
+
+ aAny <<= GetContent();
+ xPropertySet->setPropertyValue( sPropertyCurrentPresentation, aAny );
+}
+
+
+
+//
+// variable declarations
+//
+// Should be adapted to XMLVarField-/XMLSetVarFieldImportContext scheme!
+//
+
+
+
+//
+// declaration containter import (<variable/user-field/sequence-decls>)
+//
+
+TYPEINIT1( XMLVariableDeclsImportContext, SvXMLImportContext );
+
+XMLVariableDeclsImportContext::XMLVariableDeclsImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp, sal_uInt16 nPrfx,
+ const OUString& rLocalName, enum VarType eVarType) :
+ SvXMLImportContext(rImport, nPrfx, rLocalName),
+ eVarDeclsContextType(eVarType),
+ rImportHelper(rHlp)
+{
+}
+
+SvXMLImportContext* XMLVariableDeclsImportContext::CreateChildContext(
+ sal_uInt16 nPrefix, const OUString& rLocalName,
+ const Reference<xml::sax::XAttributeList> & xAttrList )
+{
+ enum XMLTokenEnum eElementName;
+ SvXMLImportContext* pImportContext = NULL;
+
+ if( XML_NAMESPACE_TEXT == nPrefix )
+ {
+ switch (eVarDeclsContextType)
+ {
+ case VarTypeSequence:
+ eElementName = XML_SEQUENCE_DECL;
+ break;
+ case VarTypeSimple:
+ eElementName = XML_VARIABLE_DECL;
+ break;
+ case VarTypeUserField:
+ eElementName = XML_USER_FIELD_DECL;
+ break;
+ default:
+ OSL_FAIL("unknown field type!");
+ eElementName = XML_SEQUENCE_DECL;
+ break;
+ }
+
+ if( IsXMLToken( rLocalName, eElementName ) )
+ {
+ pImportContext = new XMLVariableDeclImportContext(
+ GetImport(), rImportHelper, nPrefix, rLocalName, xAttrList,
+ eVarDeclsContextType);
+ }
+ }
+
+ // if no context was created, use default context
+ if (NULL == pImportContext) {
+ pImportContext = SvXMLImportContext::CreateChildContext(nPrefix,
+ rLocalName,
+ xAttrList);
+ }
+
+ return pImportContext;
+}
+
+
+
+//
+// declaration import (<variable/user-field/sequence-decl> elements)
+//
+
+TYPEINIT1( XMLVariableDeclImportContext, SvXMLImportContext );
+
+XMLVariableDeclImportContext::XMLVariableDeclImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp,
+ sal_uInt16 nPrfx, const OUString& rLocalName,
+ const Reference<xml::sax::XAttributeList> & xAttrList,
+ enum VarType eVarType) :
+ SvXMLImportContext(rImport, nPrfx, rLocalName),
+ // bug?? which properties for userfield/userfieldmaster
+ sPropertyName(RTL_CONSTASCII_USTRINGPARAM(sAPI_name)),
+ sPropertySubType(RTL_CONSTASCII_USTRINGPARAM(sAPI_sub_type)),
+ sPropertyNumberingLevel(RTL_CONSTASCII_USTRINGPARAM(sAPI_chapter_numbering_level)),
+ sPropertyNumberingSeparator(RTL_CONSTASCII_USTRINGPARAM(sAPI_numbering_separator)),
+ sPropertyIsExpression(RTL_CONSTASCII_USTRINGPARAM(sAPI_is_expression)),
+ aValueHelper(rImport, rHlp, sal_True, sal_False, sal_True, sal_False),
+ nNumLevel(-1), cSeparationChar('.')
+{
+ if ( (XML_NAMESPACE_TEXT == nPrfx) &&
+ ( ( IsXMLToken( rLocalName, XML_SEQUENCE_DECL )) ||
+ ( IsXMLToken( rLocalName, XML_VARIABLE_DECL)) ||
+ ( IsXMLToken( rLocalName, XML_USER_FIELD_DECL)) )) {
+
+ // TODO: check validity (need name!)
+
+ // parse attributes
+ sal_Int16 nLength = xAttrList->getLength();
+ for(sal_Int16 i=0; i<nLength; i++) {
+
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(i), &sLocalName );
+
+ sal_uInt16 nToken = rHlp.
+ GetTextFieldAttrTokenMap().Get(nPrefix, sLocalName);
+
+ switch (nToken)
+ {
+ case XML_TOK_TEXTFIELD_NAME:
+ sName = xAttrList->getValueByIndex(i);
+ break;
+ case XML_TOK_TEXTFIELD_NUMBERING_LEVEL:
+ {
+ sal_Int32 nLevel;
+ sal_Bool bRet = SvXMLUnitConverter::convertNumber(
+ nLevel, xAttrList->getValueByIndex(i), 0,
+ GetImport().GetTextImport()->GetChapterNumbering()->
+ getCount());
+ if (bRet)
+ {
+ nNumLevel = static_cast< sal_Int8 >( nLevel-1 ); // API numbers -1..9
+ }
+ break;
+ }
+ case XML_TOK_TEXTFIELD_NUMBERING_SEPARATOR:
+ cSeparationChar =
+ (sal_Char)xAttrList->getValueByIndex(i).toChar();
+ break;
+
+ default:
+ // delegate to value helper
+ aValueHelper.ProcessAttribute(nToken,
+ xAttrList->getValueByIndex(i));
+ break;
+ }
+ }
+
+ Reference<XPropertySet> xFieldMaster;
+ if (FindFieldMaster(xFieldMaster, GetImport(), rHlp,
+ sName, eVarType))
+ {
+ // now we have a field master: process attributes!
+ Any aAny;
+
+ switch (eVarType)
+ {
+ case VarTypeSequence:
+ aAny <<= nNumLevel;
+ xFieldMaster->setPropertyValue(sPropertyNumberingLevel, aAny);
+
+ if (nNumLevel >= 0)
+ {
+ OUString sStr(&cSeparationChar, 1);
+ aAny <<= sStr;
+ xFieldMaster->setPropertyValue(
+ sPropertyNumberingSeparator, aAny);
+ }
+ break;
+ case VarTypeSimple:
+ {
+ // set string or non-string SubType (#93192#)
+ // The SubType was already set in the FindFieldMaster
+ // method, but it needs to be adjusted if it's a string.
+ aAny <<= aValueHelper.IsStringValue()
+ ? SetVariableType::STRING : SetVariableType::VAR;
+ xFieldMaster->setPropertyValue(sPropertySubType, aAny);
+ }
+ break;
+ case VarTypeUserField:
+ {
+ sal_Bool bTmp = !aValueHelper.IsStringValue();
+ aAny.setValue(&bTmp, ::getBooleanCppuType());
+ xFieldMaster->setPropertyValue(sPropertyIsExpression, aAny);
+ aValueHelper.PrepareField(xFieldMaster);
+ break;
+ }
+ default:
+ OSL_FAIL("unkown varfield type");
+ } // switch
+ } // else: no field master found/constructed
+ } // else: no sequence-decl
+}
+
+
+
+sal_Bool XMLVariableDeclImportContext::FindFieldMaster(
+ Reference<XPropertySet> & xMaster, SvXMLImport& rImport,
+ XMLTextImportHelper& rImportHelper,
+ const OUString& sVarName, enum VarType eVarType)
+{
+ static sal_Int32 nCollisionCount = 0;
+
+ // rename field
+ // currently: no family in use! Use 0.
+ OUString sName = rImportHelper.GetRenameMap().Get(
+ sal::static_int_cast< sal_uInt16 >(eVarType), sVarName);
+
+ // get text fields supplier and field masters
+ Reference<XTextFieldsSupplier> xTextFieldsSupp(rImport.GetModel(),
+ UNO_QUERY);
+ Reference<container::XNameAccess> xFieldMasterNameAccess(
+ xTextFieldsSupp->getTextFieldMasters(), UNO_QUERY);
+
+ OUStringBuffer sBuffer;
+ sBuffer.appendAscii(sAPI_fieldmaster_prefix);
+ sBuffer.appendAscii(sAPI_set_expression);
+ sBuffer.appendAscii(".");
+ sBuffer.append(sName);
+ OUString sVarServiceName = sBuffer.makeStringAndClear();
+
+ sBuffer.appendAscii(sAPI_fieldmaster_prefix);
+ sBuffer.appendAscii(sAPI_user);
+ sBuffer.appendAscii(".");
+ sBuffer.append(sName);
+ OUString sUserServiceName = sBuffer.makeStringAndClear();
+
+ if (xFieldMasterNameAccess->hasByName(sVarServiceName)) {
+ // variable field master already in document
+
+ Any aAny = xFieldMasterNameAccess->getByName(sVarServiceName);
+ aAny >>= xMaster;
+
+ aAny = xMaster->getPropertyValue(
+ // sPropertySubType
+ OUString(RTL_CONSTASCII_USTRINGPARAM(sAPI_sub_type))
+ );
+ sal_Int16 nType = 0;
+ aAny >>= nType;
+
+ enum VarType eFMVarType =
+ (SetVariableType::SEQUENCE == nType) ?
+ VarTypeSequence : VarTypeSimple;
+
+ if (eFMVarType != eVarType)
+ {
+ OUString sNew;
+
+ // FIXME! cant find if name is taken already!!!!
+
+ nCollisionCount++;
+ OUStringBuffer aBuf;
+ aBuf.append(sName);
+ aBuf.appendAscii("_renamed_");
+ aBuf.append(nCollisionCount);
+ sNew = aBuf.makeStringAndClear();
+
+ rImportHelper.GetRenameMap().Add(
+ sal::static_int_cast< sal_uInt16 >(eVarType), sName, sNew);
+
+ // call FindFieldMaster recursively to create new master
+ return FindFieldMaster(xMaster, rImport, rImportHelper,
+ sNew, eVarType);
+ }
+ } else if (xFieldMasterNameAccess->hasByName(sUserServiceName)) {
+ // user field: get field master
+ Any aAny = xFieldMasterNameAccess->getByName(sUserServiceName);
+ aAny >>= xMaster;
+
+ if (VarTypeUserField != eVarType) {
+ // find new name that is not taken
+ OUString sNew;
+
+ // FIXME! cant find if name is taken already!!!!
+
+ nCollisionCount++;
+ OUStringBuffer aBuf;
+ aBuf.append(sName);
+ aBuf.appendAscii("_renamed_");
+ aBuf.append(nCollisionCount);
+ sNew = aBuf.makeStringAndClear();
+
+ rImportHelper.GetRenameMap().Add(
+ sal::static_int_cast< sal_uInt16 >(eVarType), sName, sNew);
+
+ // call FindFieldMaster recursively to create new master
+ return FindFieldMaster(xMaster, rImport, rImportHelper,
+ sNew, eVarType);
+ }
+ } else {
+ // field name not used: create field master
+
+ // import -> model is MultiServiceFactory -> createInstance
+ Reference<lang::XMultiServiceFactory>
+ xFactory(rImport.GetModel(),UNO_QUERY);
+ if( xFactory.is() ) {
+
+ OUStringBuffer sService;
+ sService.appendAscii(sAPI_fieldmaster_prefix);
+ sService.appendAscii((eVarType==VarTypeUserField) ?
+ sAPI_user : sAPI_set_expression);
+ Reference<XInterface> xIfc =
+ xFactory->createInstance( sService.makeStringAndClear() );
+ if (xIfc.is()) {
+ Reference<XPropertySet> xTmp( xIfc, UNO_QUERY );
+ xMaster = xTmp;
+
+ // set name
+ Any aAny;
+ aAny <<= sName;
+ xMaster->setPropertyValue(
+ // sPropertyName
+ OUString(RTL_CONSTASCII_USTRINGPARAM(sAPI_name))
+ , aAny);
+
+ if (eVarType != VarTypeUserField) {
+ // set subtype for setexp field
+
+ aAny <<= ((eVarType == VarTypeSimple) ?
+ SetVariableType::VAR :
+ SetVariableType::SEQUENCE);
+ xMaster->setPropertyValue(
+ // sPropertySubType
+ OUString(RTL_CONSTASCII_USTRINGPARAM(sAPI_sub_type))
+ , aAny);
+ } // else : user field: no subtype
+
+ } else {
+ return sal_False;
+ }
+ } else {
+ return sal_False;
+ }
+ }
+
+ DBG_ASSERT(xMaster.is(), "no field master found!?!");
+ return sal_True;
+}
+
+
+//
+// Database Display field import
+//
+
+
+TYPEINIT1( XMLDatabaseDisplayImportContext, XMLDatabaseFieldImportContext );
+
+XMLDatabaseDisplayImportContext::XMLDatabaseDisplayImportContext(
+ SvXMLImport& rImport, XMLTextImportHelper& rHlp, sal_uInt16 nPrfx,
+ const OUString& rLocalName) :
+ XMLDatabaseFieldImportContext(rImport, rHlp, sAPI_database,
+ nPrfx, rLocalName, false),
+ sPropertyColumnName(RTL_CONSTASCII_USTRINGPARAM(sAPI_data_column_name)),
+ sPropertyDatabaseFormat(RTL_CONSTASCII_USTRINGPARAM(sAPI_is_data_base_format)),
+ sPropertyCurrentPresentation(RTL_CONSTASCII_USTRINGPARAM(sAPI_current_presentation)),
+ sPropertyIsVisible(RTL_CONSTASCII_USTRINGPARAM(sAPI_is_visible)),
+ aValueHelper(rImport, rHlp, sal_False, sal_True, sal_False, sal_False),
+ bColumnOK(sal_False),
+ bDisplay( sal_True ),
+ bDisplayOK( sal_False )
+{
+}
+
+void XMLDatabaseDisplayImportContext::ProcessAttribute(
+ sal_uInt16 nAttrToken, const OUString& sAttrValue )
+{
+ switch (nAttrToken)
+ {
+ case XML_TOK_TEXTFIELD_COLUMN_NAME:
+ sColumnName = sAttrValue;
+ bColumnOK = sal_True;
+ break;
+ case XML_TOK_TEXTFIELD_DISPLAY:
+ {
+ sal_Bool bNone = IsXMLToken( sAttrValue, XML_NONE );
+ sal_Bool bValue = IsXMLToken( sAttrValue, XML_VALUE );
+ bDisplay = bValue;
+ bDisplayOK = bNone || bValue;
+ }
+ break;
+ case XML_TOK_TEXTFIELD_DATABASE_NAME:
+ case XML_TOK_TEXTFIELD_TABLE_NAME:
+ case XML_TOK_TEXTFIELD_TABLE_TYPE:
+ // handled by super class
+ XMLDatabaseFieldImportContext::ProcessAttribute(nAttrToken,
+ sAttrValue);
+ break;
+ default:
+ // remainder handled by value helper
+ aValueHelper.ProcessAttribute(nAttrToken, sAttrValue);
+ break;
+ }
+
+ bValid = bTableOK && bDatabaseOK && bColumnOK;
+}
+
+void XMLDatabaseDisplayImportContext::EndElement()
+{
+ // we have an EndElement of our own, because database fields need
+ // to be attached to a field master before they can be inserted into
+ // the document. Database stuff (database, table, column) all goes
+ // to the field master, value & style go to the field.
+
+ if (bValid)
+ {
+
+ // so here goes: we start with the master
+ Reference<XPropertySet> xMaster;
+
+ // create and prepare field master first
+ if (CreateField(xMaster,
+ OUString(RTL_CONSTASCII_USTRINGPARAM(
+ sAPI_fieldmaster_database))))
+ {
+ Any aAny;
+ aAny <<= sColumnName;
+ xMaster->setPropertyValue(sPropertyColumnName, aAny);
+
+ // fieldmaster takes database, table and column name
+ XMLDatabaseFieldImportContext::PrepareField(xMaster);
+
+ // create field
+ Reference<XPropertySet> xField;
+ if (CreateField(xField,
+ OUString(RTL_CONSTASCII_USTRINGPARAM(
+ sAPI_database))))
+ {
+ // attach field master
+ Reference<XDependentTextField> xDepField(xField, UNO_QUERY);
+ if (xDepField.is())
+ {
+ // attach field to field master
+ xDepField->attachTextFieldMaster(xMaster);
+
+ // attach field to document
+ Reference<XTextContent> xTextContent(xField, UNO_QUERY);
+ if (xTextContent.is())
+ {
+ // insert, set field properties and exit!
+ GetImportHelper().InsertTextContent(xTextContent);
+
+ // prepare field: format from database?
+ sal_Bool bTmp = !aValueHelper.IsFormatOK();
+ aAny.setValue( &bTmp, ::getBooleanCppuType() );
+ xField->setPropertyValue(sPropertyDatabaseFormat,aAny);
+
+ // value, value-type and format done by value helper
+ aValueHelper.PrepareField(xField);
+
+ // visibility
+ if( bDisplayOK )
+ {
+ aAny.setValue( &bDisplay, ::getBooleanCppuType() );
+ xField->setPropertyValue(sPropertyIsVisible, aAny);
+ }
+
+ // set presentation
+ aAny <<= GetContent();
+ xField->setPropertyValue(sPropertyCurrentPresentation,
+ aAny);
+
+ // success!
+ return;
+ }
+ }
+ }
+ }
+ }
+
+ // above: exit on success; so for all error cases we end up here!
+ // write element content
+ GetImportHelper().InsertString(GetContent());
+}
+
+
+//
+// value import helper
+//
+
+enum ValueType
+{
+ XML_VALUE_TYPE_STRING,
+ XML_VALUE_TYPE_FLOAT,
+ XML_VALUE_TYPE_CURRENCY,
+ XML_VALUE_TYPE_PERCENTAGE,
+ XML_VALUE_TYPE_DATE,
+ XML_VALUE_TYPE_TIME,
+ XML_VALUE_TYPE_BOOLEAN
+};
+
+static SvXMLEnumMapEntry const aValueTypeMap[] =
+{
+ { XML_FLOAT, XML_VALUE_TYPE_FLOAT },
+ { XML_CURRENCY, XML_VALUE_TYPE_CURRENCY },
+ { XML_PERCENTAGE, XML_VALUE_TYPE_PERCENTAGE },
+ { XML_DATE, XML_VALUE_TYPE_DATE },
+ { XML_TIME, XML_VALUE_TYPE_TIME },
+ { XML_BOOLEAN, XML_VALUE_TYPE_BOOLEAN },
+ { XML_STRING, XML_VALUE_TYPE_STRING },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+XMLValueImportHelper::XMLValueImportHelper(
+ SvXMLImport& rImprt,
+ XMLTextImportHelper& rHlp,
+ sal_Bool bType, sal_Bool bStyle, sal_Bool bValue, sal_Bool bFormula) :
+ sPropertyContent(RTL_CONSTASCII_USTRINGPARAM(sAPI_content)),
+ sPropertyValue(RTL_CONSTASCII_USTRINGPARAM(sAPI_value)),
+ sPropertyNumberFormat(RTL_CONSTASCII_USTRINGPARAM(sAPI_number_format)),
+ sPropertyIsFixedLanguage(RTL_CONSTASCII_USTRINGPARAM(sAPI_is_fixed_language)),
+
+ rImport(rImprt),
+ rHelper(rHlp),
+
+ fValue(0.0),
+ nFormatKey(0),
+ bIsDefaultLanguage(sal_True),
+
+ bStringType(sal_False),
+ bFormatOK(sal_False),
+ bTypeOK(sal_False),
+ bStringValueOK(sal_False),
+ bFloatValueOK(sal_False),
+ bFormulaOK(sal_False),
+
+ bSetType(bType),
+ bSetValue(bValue),
+ bSetStyle(bStyle),
+ bSetFormula(bFormula),
+
+ bStringDefault(sal_True),
+ bFormulaDefault(sal_True)
+{
+}
+
+XMLValueImportHelper::~XMLValueImportHelper()
+{
+}
+
+void XMLValueImportHelper::ProcessAttribute(
+ sal_uInt16 nAttrToken, const OUString& sAttrValue )
+{
+ switch (nAttrToken)
+ {
+ case XML_TOK_TEXTFIELD_VALUE_TYPE:
+ {
+ // convert enum
+ sal_uInt16 nTmp = 0;
+ sal_Bool bRet = SvXMLUnitConverter::convertEnum(
+ nTmp, sAttrValue, aValueTypeMap);
+
+ if (bRet) {
+ ValueType eValueType = (ValueType)nTmp;
+
+ bTypeOK = sal_True;
+
+ switch (eValueType)
+ {
+ case XML_VALUE_TYPE_STRING:
+ bStringType = sal_True;
+ break;
+ case XML_VALUE_TYPE_FLOAT:
+ case XML_VALUE_TYPE_CURRENCY:
+ case XML_VALUE_TYPE_PERCENTAGE:
+ case XML_VALUE_TYPE_DATE:
+ case XML_VALUE_TYPE_TIME:
+ case XML_VALUE_TYPE_BOOLEAN:
+ bStringType = sal_False;
+ break;
+
+ default:
+ OSL_FAIL("unknown value type");
+ bTypeOK = sal_False;
+ }
+ }
+ break;
+ }
+
+ case XML_TOK_TEXTFIELD_VALUE:
+ {
+ double fTmp;
+ sal_Bool bRet = SvXMLUnitConverter::convertDouble(fTmp,sAttrValue);
+ if (bRet) {
+ bFloatValueOK = sal_True;
+ fValue = fTmp;
+ }
+ break;
+ }
+
+ case XML_TOK_TEXTFIELD_TIME_VALUE:
+ {
+ double fTmp;
+ sal_Bool bRet = SvXMLUnitConverter::convertTime(fTmp,sAttrValue);
+ if (bRet) {
+ bFloatValueOK = sal_True;
+ fValue = fTmp;
+ }
+ break;
+ }
+
+ case XML_TOK_TEXTFIELD_DATE_VALUE:
+ {
+ double fTmp;
+ sal_Bool bRet = rImport.GetMM100UnitConverter().
+ convertDateTime(fTmp,sAttrValue);
+ if (bRet) {
+ bFloatValueOK = sal_True;
+ fValue = fTmp;
+ }
+ break;
+ }
+
+ case XML_TOK_TEXTFIELD_BOOL_VALUE:
+ {
+ bool bTmp;
+ sal_Bool bRet = SvXMLUnitConverter::convertBool(bTmp,sAttrValue);
+ if (bRet) {
+ bFloatValueOK = sal_True;
+ fValue = (bTmp ? 1.0 : 0.0);
+ }
+ else
+ {
+ double fTmp;
+ bRet = SvXMLUnitConverter::convertDouble(fTmp,sAttrValue);
+ if (bRet) {
+ bFloatValueOK = sal_True;
+ fValue = fTmp;
+ }
+ }
+ break;
+ }
+
+ case XML_TOK_TEXTFIELD_STRING_VALUE:
+ sValue = sAttrValue;
+ bStringValueOK = sal_True;
+ break;
+
+ case XML_TOK_TEXTFIELD_FORMULA:
+ {
+ OUString sTmp;
+ sal_uInt16 nPrefix = rImport.GetNamespaceMap().
+ _GetKeyByAttrName( sAttrValue, &sTmp, sal_False );
+ if( XML_NAMESPACE_OOOW == nPrefix )
+ {
+ sFormula = sTmp;
+ bFormulaOK = sal_True;
+ }
+ else
+ sFormula = sAttrValue;
+ }
+ break;
+
+ case XML_TOK_TEXTFIELD_DATA_STYLE_NAME:
+ {
+ sal_Int32 nKey = rHelper.GetDataStyleKey(
+ sAttrValue, &bIsDefaultLanguage);
+ if (-1 != nKey)
+ {
+ nFormatKey = nKey;
+ bFormatOK = sal_True;
+ }
+ break;
+ }
+ } // switch
+}
+
+void XMLValueImportHelper::PrepareField(
+ const Reference<XPropertySet> & xPropertySet)
+{
+ Any aAny;
+
+ if (bSetType)
+ {
+ // ??? how to set type?
+ }
+
+ if (bSetFormula)
+ {
+ aAny <<= (!bFormulaOK && bFormulaDefault) ? sDefault : sFormula;
+ xPropertySet->setPropertyValue(sPropertyContent, aAny);
+ }
+
+ // format/style
+ if (bSetStyle && bFormatOK)
+ {
+ aAny <<= nFormatKey;
+ xPropertySet->setPropertyValue(sPropertyNumberFormat, aAny);
+
+ if( xPropertySet->getPropertySetInfo()->
+ hasPropertyByName( sPropertyIsFixedLanguage ) )
+ {
+ sal_Bool bIsFixedLanguage = ! bIsDefaultLanguage;
+ aAny.setValue( &bIsFixedLanguage, ::getBooleanCppuType() );
+ xPropertySet->setPropertyValue( sPropertyIsFixedLanguage, aAny );
+ }
+ }
+
+ // value: string or float
+ if (bSetValue)
+ {
+ if (bStringType)
+ {
+ aAny <<= (!bStringValueOK && bStringDefault) ? sDefault : sValue;
+ xPropertySet->setPropertyValue(sPropertyContent, aAny);
+ }
+ else
+ {
+ aAny <<= fValue;
+ xPropertySet->setPropertyValue(sPropertyValue, aAny);
+ }
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/ActionMapTypesOASIS.hxx b/xmloff/source/transform/ActionMapTypesOASIS.hxx
new file mode 100644
index 000000000000..f9226a23b7ec
--- /dev/null
+++ b/xmloff/source/transform/ActionMapTypesOASIS.hxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_ACTIONMAPTYPESOASIS_HXX
+#define _XMLOFF_ACTIONMAPTYPESOASIS_HXX
+
+enum ActionMapTypesOOo
+{
+ PROP_OASIS_GRAPHIC_ATTR_ACTIONS,
+ PROP_OASIS_DRAWING_PAGE_ATTR_ACTIONS,
+ PROP_OASIS_PAGE_LAYOUT_ATTR_ACTIONS,
+ PROP_OASIS_HEADER_FOOTER_ATTR_ACTIONS,
+ PROP_OASIS_TEXT_ATTR_ACTIONS,
+ PROP_OASIS_PARAGRAPH_ATTR_ACTIONS,
+ PROP_OASIS_SECTION_ATTR_ACTIONS,
+ PROP_OASIS_TABLE_ATTR_ACTIONS,
+ PROP_OASIS_TABLE_COLUMN_ATTR_ACTIONS,
+ PROP_OASIS_TABLE_ROW_ATTR_ACTIONS,
+ PROP_OASIS_TABLE_CELL_ATTR_ACTIONS,
+ PROP_OASIS_LIST_LEVEL_ATTR_ACTIONS,
+ PROP_OASIS_CHART_ATTR_ACTIONS,
+ MAX_OASIS_PROP_ACTIONS,
+ OASIS_STYLE_ACTIONS = MAX_OASIS_PROP_ACTIONS,
+ OASIS_FONT_FACE_ACTIONS,
+ OASIS_SHAPE_ACTIONS,
+ OASIS_CONNECTOR_ACTIONS,
+ OASIS_INDEX_ENTRY_TAB_STOP_ACTIONS,
+ OASIS_TAB_STOP_ACTIONS,
+ OASIS_LINENUMBERING_ACTIONS,
+ OASIS_FOOTNOTE_SEP_ACTIONS,
+ OASIS_DROP_CAP_ACTIONS,
+ OASIS_COLUMNS_ACTIONS,
+ OASIS_TEXT_VALUE_TYPE_ACTIONS,
+ OASIS_TABLE_VALUE_TYPE_ACTIONS,
+ OASIS_PARA_ACTIONS,
+ OASIS_LIST_STYLE_REF_ACTIONS,
+ OASIS_TEXT_STYLE_REF_ACTIONS,
+ OASIS_PARA_STYLE_REF_ACTIONS,
+ OASIS_MASTER_PAGE_REF_ACTIONS,
+ OASIS_MAP_STYLE_REF_ACTIONS,
+ OASIS_MASTER_PAGE_ACTIONS,
+ OASIS_NOTES_ACTIONS,
+ OASIS_ANNOTATION_ACTIONS,
+ OASIS_CHANGE_INFO_ACTIONS,
+ OASIS_FRAME_ELEM_ACTIONS,
+ OASIS_BACKGROUND_IMAGE_ACTIONS,
+ OASIS_DDE_CONNECTION_DECL_ACTIONS,
+ OASIS_EVENT_ACTIONS,
+ OASIS_DLG_ACTIONS,
+ OASIS_FORM_CONTROL_ACTIONS,
+ OASIS_FORM_COLUMN_ACTIONS,
+ OASIS_FORM_PROP_ACTIONS,
+ OASIS_XLINK_ACTIONS,
+ OASIS_CONFIG_ITEM_SET_ACTIONS,
+ OASIS_FORMULA_ACTIONS,
+ OASIS_CHART_ACTIONS,
+ OASIS_FORM_ACTIONS,
+ OASIS_ALPHABETICAL_INDEX_MARK_ACTIONS,
+ OASIS_CONTENT_VALIDATION_ACTIONS,
+ OASIS_DDE_CONV_MODE_ACTIONS,
+ OASIS_DATAPILOT_MEMBER_ACTIONS,
+ OASIS_DATAPILOT_LEVEL_ACTIONS,
+ OASIS_SOURCE_SERVICE_ACTIONS,
+ OASIS_DRAW_AREA_POLYGON_ACTIONS,
+ OASIS_SCRIPT_ACTIONS,
+ OASIS_DATETIME_ACTIONS,
+ OASIS_TABLE_STYLE_REF_ACTIONS,
+ OASIS_ANIMATION_ACTIONS,
+ MAX_OASIS_ACTIONS
+};
+
+#endif // _XMLOFF_ACTIONMAPTYPESOASIS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/ActionMapTypesOOo.hxx b/xmloff/source/transform/ActionMapTypesOOo.hxx
new file mode 100644
index 000000000000..18c92ebbc8a8
--- /dev/null
+++ b/xmloff/source/transform/ActionMapTypesOOo.hxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_ACTIONMAPTYPESOOO_HXX
+#define _XMLOFF_ACTIONMAPTYPESOOO_HXX
+
+enum ActionMapTypesOOo
+{
+ PROP_OOO_GRAPHIC_ATTR_ACTIONS,
+ PROP_OOO_GRAPHIC_ELEM_ACTIONS,
+ PROP_OOO_DRAWING_PAGE_ATTR_ACTIONS,
+ PROP_OOO_PAGE_LAYOUT_ATTR_ACTIONS,
+ PROP_OOO_HEADER_FOOTER_ATTR_ACTIONS,
+ PROP_OOO_TEXT_ATTR_ACTIONS,
+ PROP_OOO_TEXT_ELEM_ACTIONS,
+ PROP_OOO_PARAGRAPH_ATTR_ACTIONS,
+ PROP_OOO_PARAGRAPH_ELEM_ACTIONS,
+ PROP_OOO_SECTION_ATTR_ACTIONS,
+ PROP_OOO_TABLE_ATTR_ACTIONS,
+ PROP_OOO_TABLE_COLUMN_ATTR_ACTIONS,
+ PROP_OOO_TABLE_ROW_ATTR_ACTIONS,
+ PROP_OOO_TABLE_CELL_ATTR_ACTIONS,
+ PROP_OOO_TABLE_CELL_ELEM_ACTIONS,
+ PROP_OOO_LIST_LEVEL_ATTR_ACTIONS,
+ PROP_OOO_CHART_ATTR_ACTIONS,
+ PROP_OOO_CHART_ELEM_ACTIONS,
+ MAX_OOO_PROP_ACTIONS,
+ OOO_STYLE_ACTIONS = MAX_OOO_PROP_ACTIONS,
+ OOO_FONT_DECL_ACTIONS,
+ OOO_SHAPE_ACTIONS,
+ OOO_CONNECTOR_ACTIONS,
+ OOO_INDEX_ENTRY_TAB_STOP_ACTIONS,
+ OOO_TAB_STOP_ACTIONS,
+ OOO_LINENUMBERING_ACTIONS,
+ OOO_FOOTNOTE_SEP_ACTIONS,
+ OOO_DROP_CAP_ACTIONS,
+ OOO_COLUMNS_ACTIONS,
+ OOO_TEXT_VALUE_TYPE_ACTIONS,
+ OOO_TABLE_VALUE_TYPE_ACTIONS,
+ OOO_PARA_ACTIONS,
+ OOO_STYLE_REF_ACTIONS,
+ OOO_MASTER_PAGE_ACTIONS,
+ OOO_ANNOTATION_ACTIONS,
+ OOO_CHANGE_INFO_ACTIONS,
+ OOO_FRAME_ELEM_ACTIONS,
+ OOO_FRAME_ATTR_ACTIONS,
+ OOO_BACKGROUND_IMAGE_ACTIONS,
+ OOO_DDE_CONNECTION_DECL_ACTIONS,
+ OOO_EVENT_ACTIONS,
+ OOO_FORM_CONTROL_ACTIONS,
+ OOO_FORM_COLUMN_ACTIONS,
+ OOO_FORM_PROP_ACTIONS,
+ OOO_XLINK_ACTIONS,
+ OOO_CONFIG_ITEM_SET_ACTIONS,
+ OOO_FORMULA_ACTIONS,
+ OOO_CHART_ACTIONS,
+ OOO_ERROR_MACRO_ACTIONS,
+ OOO_DDE_CONV_MODE_ACTIONS,
+ OOO_ALPHABETICAL_INDEX_MARK_ACTIONS,
+ OOO_DATAPILOT_MEMBER_ACTIONS,
+ OOO_DATAPILOT_LEVEL_ACTIONS,
+ OOO_SOURCE_SERVICE_ACTIONS,
+ OOO_DRAW_AREA_POLYGON_ACTIONS,
+ OOO_SCRIPT_ACTIONS,
+ MAX_OOO_ACTIONS
+};
+
+#endif // _XMLOFF_ACTIONMAPTYPESOOO_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/AttrTransformerAction.hxx b/xmloff/source/transform/AttrTransformerAction.hxx
new file mode 100644
index 000000000000..8dc28f2d8915
--- /dev/null
+++ b/xmloff/source/transform/AttrTransformerAction.hxx
@@ -0,0 +1,144 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_ATTRTRANSFORMERACTION_HXX
+#define _XMLOFF_ATTRTRANSFORMERACTION_HXX
+
+#include "TransformerAction.hxx"
+
+enum XMLAttrTransformerAction
+{
+ XML_ATACTION_EOT=XML_TACTION_EOT, // uses for initialization only
+ XML_ATACTION_COPY, // copy attr
+ XML_ATACTION_RENAME, // rename attr:
+ // - param1: namespace +
+ // token of local name
+ XML_ATACTION_REMOVE, // remove attr
+ XML_ATACTION_IN2INCH, // replace "in" with "inch"
+ XML_ATACTION_INS2INCHS, // replace "in" with "inch"
+ // multiple times
+ XML_ATACTION_IN2TWIPS, // replace "in" with "inch" and
+ // convert value from inch to twips
+ // but only for writer documents
+ XML_ATACTION_RENAME_IN2INCH, // replace "in" with "inch" and rename
+ // attr:
+ // - param1: namespace +
+ // token of local name
+ XML_ATACTION_INCH2IN, // replace "inch" with "in"
+ XML_ATACTION_INCHS2INS, // replace "inch" with "in"
+ // multiple times
+ XML_ATACTION_TWIPS2IN, // replace "inch" with "in" and for writer
+ // documents convert measure value from twips
+ // to inch
+ XML_ATACTION_RENAME_INCH2IN, // replace "inch" with "in" and rename
+ // attr:
+ // - param1: namespace +
+ // token of local name
+ XML_ATACTION_STYLE_FAMILY, // NOP, used for style:family
+ XML_ATACTION_DECODE_STYLE_NAME, // NOP, used for style:name
+ // - param1: style family
+ XML_ATACTION_STYLE_DISPLAY_NAME, // NOP, used for style:display_name
+ // - param1: style family
+ XML_ATACTION_DECODE_STYLE_NAME_REF, // NOP, used for style:name reference
+ // - param1: style family
+ XML_ATACTION_RENAME_DECODE_STYLE_NAME_REF, // NOP, used for style:name
+ // - param1: namespace +
+ // token of local name
+ XML_ATACTION_ENCODE_STYLE_NAME, // NOP, used for style:name
+ XML_ATACTION_ENCODE_STYLE_NAME_REF, // NOP, used for style:name
+ XML_ATACTION_RENAME_ENCODE_STYLE_NAME_REF, // NOP, used for style:name
+ // - param1: namespace +
+ // token of local name
+ // - param2: style family
+ XML_ATACTION_MOVE_TO_ELEM, // turn attr into an elem
+ // - param1: namespace +
+ // token of local name
+ XML_ATACTION_MOVE_FROM_ELEM, // turn elem into an attr:
+ // - param1: namespace +
+ // token of local name
+ XML_ATACTION_NEG_PERCENT, // replace % val with 100-%
+ XML_ATACTION_RENAME_NEG_PERCENT, // replace % val with 100-%, rename attr
+ // - param1: namespace +
+ // token of local name
+ XML_ATACTION_HREF, // xmlink:href
+ XML_ATACTION_ADD_NAMESPACE_PREFIX, // add a namespace prefix
+ // - param1: prefix
+ XML_ATACTION_ADD_APP_NAMESPACE_PREFIX, // add a namespace prefix
+ // - param1: default prefix
+ XML_ATACTION_RENAME_ADD_NAMESPACE_PREFIX, // add a namespace prefix
+ // - param1: namespace +
+ // token of local name
+ // - param2: prefix
+ XML_ATACTION_REMOVE_NAMESPACE_PREFIX,// remove a namespace prefix
+ // - param1: prefix
+ XML_ATACTION_REMOVE_ANY_NAMESPACE_PREFIX,// remove any namespace prefix
+ XML_ATACTION_RENAME_REMOVE_NAMESPACE_PREFIX,// remove a namespace prefix
+ // - param1: namespace +
+ // token of local name
+ // - param2: prefix
+ XML_ATACTION_EVENT_NAME,
+ XML_ATACTION_MACRO_NAME,
+ XML_ATACTION_MACRO_LOCATION,
+ XML_ATACTION_DLG_BORDER,
+ XML_ATACTION_URI_OOO, // an URI in OOo notation
+ // - param1: pacakage URI are supported
+ XML_ATACTION_URI_OASIS, // an URI in OASIS notation
+ // - param1: pacakage URI are supported
+ XML_ATACTION_RENAME_ATTRIBUTE, // rename up to 3 different possible values of an attrbiute
+ // - param1: token of old attribute value (lower 16 bit)
+ // + token of new attribute value (upper 16 bit)
+ // - param2: token of old attribute value
+ // + token of new attribute value
+ // - param3: token of old attribute value
+ // + token of new attribute value
+ // if param2 or param3 are unused they must contain
+ // XML_TOKEN_INVALID
+ XML_ATACTION_RNG2ISO_DATETIME, // converts . into , in datetimes
+ XML_ATACTION_RENAME_RNG2ISO_DATETIME,// converts . into , in datetimes and renames the attribute
+ // - param1: namespace +
+ // token of local name
+ XML_ATACTION_MOVE_FROM_ELEM_RNG2ISO_DATETIME, // turn elem into an attr and convert . to , in datetimes
+ // - param1: namespace +
+ // token of local name
+ XML_ATACTION_SVG_WIDTH_HEIGHT_OOO, // replace "inch" with "in" and subtracts 1/100th mm
+ XML_ATACTION_SVG_WIDTH_HEIGHT_OASIS, // replace "in" with "inch" and adds 1/100th mm
+ XML_ATACTION_DRAW_MIRROR_OOO, // renames draw:mirror to style:mirror and adapts values
+ // OpenDocument file format: attribute value of <style:mirror> wrong (#i49139#)
+ XML_ATACTION_STYLE_MIRROR_OOO, // adapts style:mirror values
+ XML_ATACTION_DRAW_MIRROR_OASIS, // renames style:mirror to draw:mirror and adapts values
+ XML_ATACTION_GAMMA_OASIS, // converts percentage to double value
+ XML_ATACTION_GAMMA_OOO, // converts double value to percentage
+ XML_ATACTION_DECODE_ID, // converts strings with non numeric characters to only numeric character ids
+ XML_ATACTION_OPACITY_FIX, // converts transparency to opacity and back
+ XML_ATACTION_USER_DEFINED=0x40000000,// user defined actions start here
+ XML_ATACTION_END=XML_TACTION_END
+};
+
+#endif // _XMLOFF_ATTRTRANSFORMERACTION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/ChartOASISTContext.cxx b/xmloff/source/transform/ChartOASISTContext.cxx
new file mode 100644
index 000000000000..84b03da52ffe
--- /dev/null
+++ b/xmloff/source/transform/ChartOASISTContext.cxx
@@ -0,0 +1,146 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "ChartOASISTContext.hxx"
+#include "MutableAttrList.hxx"
+#include "xmloff/xmlnmspe.hxx"
+#include "ActionMapTypesOASIS.hxx"
+#include "AttrTransformerAction.hxx"
+#include "TransformerActions.hxx"
+#include "TransformerBase.hxx"
+
+using ::rtl::OUString;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::xmloff::token;
+
+// -----------------------------------------------------------------------------
+
+TYPEINIT1( XMLChartOASISTransformerContext, XMLTransformerContext );
+
+XMLChartOASISTransformerContext::XMLChartOASISTransformerContext(
+ XMLTransformerBase& rImp,
+ const OUString& rQName ) :
+ XMLTransformerContext( rImp, rQName )
+{
+}
+
+XMLChartOASISTransformerContext::~XMLChartOASISTransformerContext()
+{
+}
+
+void XMLChartOASISTransformerContext::StartElement(
+ const Reference< XAttributeList >& rAttrList )
+{
+ XMLTransformerActions *pActions =
+ GetTransformer().GetUserDefinedActions( OASIS_CHART_ACTIONS );
+ OSL_ENSURE( pActions, "go no actions" );
+
+ OUString aAddInName;
+ Reference< XAttributeList > xAttrList( rAttrList );
+ XMLMutableAttributeList *pMutableAttrList = 0;
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ XMLTransformerActions::key_type aKey( nPrefix, aLocalName );
+ XMLTransformerActions::const_iterator aIter =
+ pActions->find( aKey );
+ if( !(aIter == pActions->end() ) )
+ {
+ if( !pMutableAttrList )
+ {
+ pMutableAttrList =
+ new XMLMutableAttributeList( xAttrList );
+ xAttrList = pMutableAttrList;
+ }
+ const OUString& rAttrValue = xAttrList->getValueByIndex( i );
+ switch( (*aIter).second.m_nActionType )
+ {
+ case XML_ATACTION_IN2INCH:
+ {
+ OUString aAttrValue( rAttrValue );
+ if( XMLTransformerBase::ReplaceSingleInWithInch(
+ aAttrValue ) )
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_DECODE_STYLE_NAME_REF:
+ {
+ OUString aAttrValue( rAttrValue );
+ if( GetTransformer().DecodeStyleName(aAttrValue) )
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_REMOVE_ANY_NAMESPACE_PREFIX:
+ OSL_ENSURE( IsXMLToken( aLocalName, XML_CLASS ),
+ "unexpected class token" );
+ {
+ OUString aChartClass;
+ sal_uInt16 nValuePrefix =
+ GetTransformer().GetNamespaceMap().GetKeyByAttrName(
+ rAttrValue,
+ &aChartClass );
+ if( XML_NAMESPACE_CHART == nValuePrefix )
+ {
+ pMutableAttrList->SetValueByIndex( i, aChartClass );
+ }
+ else if ( XML_NAMESPACE_OOO == nValuePrefix )
+ {
+ pMutableAttrList->SetValueByIndex( i,
+ GetXMLToken(XML_ADD_IN ) );
+ aAddInName = aChartClass;
+ }
+ }
+ break;
+ default:
+ OSL_ENSURE( !this, "unknown action" );
+ break;
+ }
+ }
+ }
+
+ if( aAddInName.getLength() > 0 )
+ {
+ OUString aAttrQName( GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_CHART,
+ GetXMLToken( XML_ADD_IN_NAME ) ) );
+ pMutableAttrList->AddAttribute( aAttrQName, aAddInName );
+ }
+
+ XMLTransformerContext::StartElement( xAttrList );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/ChartOASISTContext.hxx b/xmloff/source/transform/ChartOASISTContext.hxx
new file mode 100644
index 000000000000..ace9321daab1
--- /dev/null
+++ b/xmloff/source/transform/ChartOASISTContext.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_CHARTOASISTCONTEXT_HXX
+#define _XMLOFF_CHARTOASISTCONTEXT_HXX
+
+#include "TransformerContext.hxx"
+
+class XMLChartOASISTransformerContext : public XMLTransformerContext
+{
+public:
+ TYPEINFO();
+
+ XMLChartOASISTransformerContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName );
+ virtual ~XMLChartOASISTransformerContext();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+};
+
+#endif // _XMLOFF_CHARTOASISTCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/ChartOOoTContext.cxx b/xmloff/source/transform/ChartOOoTContext.cxx
new file mode 100644
index 000000000000..0bd73f7b36ac
--- /dev/null
+++ b/xmloff/source/transform/ChartOOoTContext.cxx
@@ -0,0 +1,149 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "ChartOOoTContext.hxx"
+#include "MutableAttrList.hxx"
+#include "xmloff/xmlnmspe.hxx"
+#include "ActionMapTypesOOo.hxx"
+#include "AttrTransformerAction.hxx"
+#include "TransformerActions.hxx"
+#include "TransformerBase.hxx"
+
+using ::rtl::OUString;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::xmloff::token;
+
+// -----------------------------------------------------------------------------
+
+TYPEINIT1( XMLChartOOoTransformerContext, XMLTransformerContext );
+
+XMLChartOOoTransformerContext::XMLChartOOoTransformerContext(
+ XMLTransformerBase& rImp,
+ const OUString& rQName ) :
+ XMLTransformerContext( rImp, rQName )
+{
+}
+
+XMLChartOOoTransformerContext::~XMLChartOOoTransformerContext()
+{
+}
+
+void XMLChartOOoTransformerContext::StartElement(
+ const Reference< XAttributeList >& rAttrList )
+{
+ XMLTransformerActions *pActions =
+ GetTransformer().GetUserDefinedActions( OOO_CHART_ACTIONS );
+ OSL_ENSURE( pActions, "go no actions" );
+
+ sal_Int16 nClassName = -1;
+ OUString aAddInName;
+ Reference< XAttributeList > xAttrList( rAttrList );
+ XMLMutableAttributeList *pMutableAttrList = 0;
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ XMLTransformerActions::key_type aKey( nPrefix, aLocalName );
+ XMLTransformerActions::const_iterator aIter =
+ pActions->find( aKey );
+ if( !(aIter == pActions->end() ) )
+ {
+ if( !pMutableAttrList )
+ {
+ pMutableAttrList =
+ new XMLMutableAttributeList( xAttrList );
+ xAttrList = pMutableAttrList;
+ }
+ const OUString& rAttrValue = xAttrList->getValueByIndex( i );
+ switch( (*aIter).second.m_nActionType )
+ {
+ case XML_ATACTION_INCH2IN:
+ {
+ OUString aAttrValue( rAttrValue );
+ if( XMLTransformerBase::ReplaceSingleInchWithIn(
+ aAttrValue ) )
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_ENCODE_STYLE_NAME_REF:
+ {
+ OUString aAttrValue( rAttrValue );
+ if( GetTransformer().EncodeStyleName(aAttrValue) )
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_ADD_NAMESPACE_PREFIX:
+ OSL_ENSURE( ::xmloff::token::IsXMLToken( aLocalName, XML_CLASS ),
+ "unexpected class token" );
+ if( ::xmloff::token::IsXMLToken( rAttrValue, XML_ADD_IN ) )
+ {
+ nClassName = i;
+ }
+ else
+ {
+ OUString aAttrValue( rAttrValue );
+ sal_uInt16 nValPrefix =
+ static_cast<sal_uInt16>((*aIter).second.m_nParam1);
+ if( GetTransformer().AddNamespacePrefix( aAttrValue,
+ nValPrefix ) )
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_REMOVE:
+ OSL_ENSURE( ::xmloff::token::IsXMLToken( aLocalName, XML_ADD_IN_NAME ),
+ "unexpected class token" );
+ aAddInName = rAttrValue;
+ pMutableAttrList->RemoveAttributeByIndex( i );
+ --i;
+ --nAttrCount;
+ break;
+ default:
+ OSL_ENSURE( !this, "unknown action" );
+ break;
+ }
+ }
+ }
+
+ if( nClassName != -1 && aAddInName.getLength() > 0 )
+ {
+ GetTransformer().AddNamespacePrefix( aAddInName, XML_NAMESPACE_OOO );
+ pMutableAttrList->SetValueByIndex( nClassName, aAddInName );
+ }
+
+ XMLTransformerContext::StartElement( xAttrList );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/ChartOOoTContext.hxx b/xmloff/source/transform/ChartOOoTContext.hxx
new file mode 100644
index 000000000000..414f369e3323
--- /dev/null
+++ b/xmloff/source/transform/ChartOOoTContext.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_CHARTOOOTCONTEXT_HXX
+#define _XMLOFF_CHARTOOOTCONTEXT_HXX
+
+#include "TransformerContext.hxx"
+
+class XMLChartOOoTransformerContext : public XMLTransformerContext
+{
+public:
+ TYPEINFO();
+
+ XMLChartOOoTransformerContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName );
+ virtual ~XMLChartOOoTransformerContext();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+};
+
+#endif // _XMLOFF_CHARTOOOTCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/ChartPlotAreaOASISTContext.cxx b/xmloff/source/transform/ChartPlotAreaOASISTContext.cxx
new file mode 100644
index 000000000000..6e5cd42a3bf8
--- /dev/null
+++ b/xmloff/source/transform/ChartPlotAreaOASISTContext.cxx
@@ -0,0 +1,259 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "ChartPlotAreaOASISTContext.hxx"
+#include "TransformerBase.hxx"
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include "DeepTContext.hxx"
+#include "ActionMapTypesOASIS.hxx"
+#include "MutableAttrList.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+using ::com::sun::star::uno::Reference;
+using ::rtl::OUString;
+
+class XMLAxisOASISContext : public XMLPersElemContentTContext
+{
+public:
+ TYPEINFO();
+
+ XMLAxisOASISContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName,
+ ::rtl::Reference< XMLPersAttrListTContext > & rOutCategoriesContext );
+ ~XMLAxisOASISContext();
+
+ virtual XMLTransformerContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::rtl::OUString& rQName,
+ const Reference< xml::sax::XAttributeList >& xAttrList );
+
+ virtual void StartElement( const Reference< xml::sax::XAttributeList >& rAttrList );
+ virtual void EndElement();
+
+ bool IsCategoryAxis() const;
+
+private:
+ ::rtl::Reference< XMLPersAttrListTContext > & m_rCategoriesContext;
+ bool m_bHasCategories;
+};
+
+TYPEINIT1( XMLAxisOASISContext, XMLPersElemContentTContext );
+
+XMLAxisOASISContext::XMLAxisOASISContext(
+ XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName,
+ ::rtl::Reference< XMLPersAttrListTContext > & rOutCategoriesContext ) :
+ XMLPersElemContentTContext( rTransformer, rQName ),
+ m_rCategoriesContext( rOutCategoriesContext ),
+ m_bHasCategories( false )
+{}
+
+XMLAxisOASISContext::~XMLAxisOASISContext()
+{}
+
+XMLTransformerContext * XMLAxisOASISContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::rtl::OUString& rQName,
+ const Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ XMLTransformerContext * pContext = 0;
+
+ if( XML_NAMESPACE_CHART == nPrefix &&
+ IsXMLToken( rLocalName, XML_CATEGORIES ) )
+ {
+ // store categories element at parent
+ m_rCategoriesContext.set( new XMLPersAttrListTContext( GetTransformer(), rQName ));
+ m_bHasCategories = true;
+ pContext = m_rCategoriesContext.get();
+ }
+ else
+ {
+ pContext = XMLPersElemContentTContext::CreateChildContext(
+ nPrefix, rLocalName, rQName, xAttrList );
+ }
+
+ return pContext;
+}
+
+void XMLAxisOASISContext::StartElement(
+ const Reference< xml::sax::XAttributeList >& rAttrList )
+{
+ OUString aLocation, aMacroName;
+ Reference< xml::sax::XAttributeList > xAttrList( rAttrList );
+ XMLMutableAttributeList *pMutableAttrList = 0;
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName );
+
+ if( nPrefix == XML_NAMESPACE_CHART &&
+ IsXMLToken( aLocalName, XML_DIMENSION ) )
+ {
+ if( !pMutableAttrList )
+ {
+ pMutableAttrList = new XMLMutableAttributeList( xAttrList );
+ xAttrList = pMutableAttrList;
+ }
+
+ const OUString& rAttrValue = xAttrList->getValueByIndex( i );
+ XMLTokenEnum eToken = XML_TOKEN_INVALID;
+ if( IsXMLToken( rAttrValue, XML_X ))
+ {
+ eToken = XML_DOMAIN;
+ // has to be XML_CATEGORY for axes with a categories
+ // sub-element. The attribute is changed later (when it is
+ // known that there is a categories sub-element) in this case.
+ }
+ else if( IsXMLToken( rAttrValue, XML_Y ))
+ {
+ eToken = XML_VALUE;
+ }
+ else if( IsXMLToken( rAttrValue, XML_Z ))
+ {
+ eToken = XML_SERIES;
+ }
+ else
+ {
+ OSL_FAIL( "ChartAxis: Invalid attribute value" );
+ }
+
+ if( eToken != XML_TOKEN_INVALID )
+ {
+ OUString aNewAttrQName(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_CHART, GetXMLToken( XML_CLASS )));
+ pMutableAttrList->RenameAttributeByIndex( i, aNewAttrQName );
+
+ pMutableAttrList->SetValueByIndex( i, GetXMLToken( eToken ));
+ }
+ }
+ }
+
+ XMLPersElemContentTContext::StartElement( xAttrList );
+}
+
+void XMLAxisOASISContext::EndElement()
+{
+ // if we have categories, change the "class" attribute
+ if( IsCategoryAxis() &&
+ m_rCategoriesContext.is() )
+ {
+ OSL_ENSURE( GetAttrList().is(), "Invalid attribute list" );
+ XMLMutableAttributeList * pMutableAttrList =
+ new XMLMutableAttributeList( GetAttrList());
+ OUString aAttrQName( GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_CHART, GetXMLToken( XML_CLASS )));
+ sal_Int16 nIndex = pMutableAttrList->GetIndexByName( aAttrQName );
+ if( nIndex != -1 )
+ {
+ OSL_ENSURE( IsXMLToken( pMutableAttrList->getValueByIndex( nIndex ),
+ XML_DOMAIN ), "Axis Dimension: invalid former value" );
+ pMutableAttrList->SetValueByIndex( nIndex, GetXMLToken( XML_CATEGORY ));
+ OSL_ENSURE( IsXMLToken( pMutableAttrList->getValueByIndex( nIndex ),
+ XML_CATEGORY ), "Axis Dimension: invalid new value" );
+ }
+
+ GetTransformer().GetDocHandler()->startElement(
+ GetExportQName(),
+ Reference< xml::sax::XAttributeList >( pMutableAttrList ));
+ ExportContent();
+ GetTransformer().GetDocHandler()->endElement( GetExportQName());
+ }
+ else
+ Export();
+}
+
+bool XMLAxisOASISContext::IsCategoryAxis() const
+{
+ return m_bHasCategories;
+}
+
+
+TYPEINIT1( XMLChartPlotAreaOASISTContext, XMLProcAttrTransformerContext );
+
+XMLChartPlotAreaOASISTContext::XMLChartPlotAreaOASISTContext(
+ XMLTransformerBase & rTransformer, const ::rtl::OUString & rQName ) :
+ XMLProcAttrTransformerContext( rTransformer, rQName, OASIS_SHAPE_ACTIONS )
+{
+}
+
+XMLChartPlotAreaOASISTContext::~XMLChartPlotAreaOASISTContext()
+{}
+
+XMLTransformerContext * XMLChartPlotAreaOASISTContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::rtl::OUString& rQName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ XMLTransformerContext *pContext = 0;
+
+ if( XML_NAMESPACE_CHART == nPrefix &&
+ IsXMLToken( rLocalName, XML_AXIS ) )
+ {
+ pContext = new XMLAxisOASISContext( GetTransformer(), rQName, m_rCategoriesContext );
+ }
+ else
+ {
+ // export (and forget) categories if found in an axis-element
+ // otherwise export regularly
+ ExportCategories();
+ pContext = XMLProcAttrTransformerContext::CreateChildContext(
+ nPrefix, rLocalName, rQName, xAttrList );
+ }
+
+ return pContext;
+}
+
+void XMLChartPlotAreaOASISTContext::EndElement()
+{
+ ExportCategories();
+ XMLProcAttrTransformerContext::EndElement();
+}
+
+void XMLChartPlotAreaOASISTContext::ExportCategories()
+{
+ if( m_rCategoriesContext.is())
+ {
+ m_rCategoriesContext->Export();
+ m_rCategoriesContext.clear();
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/ChartPlotAreaOASISTContext.hxx b/xmloff/source/transform/ChartPlotAreaOASISTContext.hxx
new file mode 100644
index 000000000000..2c3d6468652b
--- /dev/null
+++ b/xmloff/source/transform/ChartPlotAreaOASISTContext.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 XMLOFF_XMLCHARTPLOTAREAOASISTCONTEXT_HXX
+#define XMLOFF_XMLCHARTPLOTAREAOASISTCONTEXT_HXX
+
+#include "ProcAttrTContext.hxx"
+#include "PersAttrListTContext.hxx"
+#include <rtl/ref.hxx>
+
+class XMLChartPlotAreaOASISTContext : public XMLProcAttrTransformerContext
+{
+public:
+ TYPEINFO();
+
+ explicit XMLChartPlotAreaOASISTContext(
+ XMLTransformerBase & rTransformer, const ::rtl::OUString & rQName );
+ virtual ~XMLChartPlotAreaOASISTContext();
+
+ virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::rtl::OUString& rQName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+
+ void ExportCategories();
+
+private:
+ ::rtl::Reference< XMLPersAttrListTContext > m_rCategoriesContext;
+};
+
+// XMLOFF_XMLCHARTPLOTAREAOASISTCONTEXT_HXX
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/ChartPlotAreaOOoTContext.cxx b/xmloff/source/transform/ChartPlotAreaOOoTContext.cxx
new file mode 100644
index 000000000000..e1b76c9700b9
--- /dev/null
+++ b/xmloff/source/transform/ChartPlotAreaOOoTContext.cxx
@@ -0,0 +1,243 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "ChartPlotAreaOOoTContext.hxx"
+#include "TransformerBase.hxx"
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include "DeepTContext.hxx"
+#include "ActionMapTypesOOo.hxx"
+#include "MutableAttrList.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+using ::com::sun::star::uno::Reference;
+using ::rtl::OUString;
+
+class XMLAxisOOoContext : public XMLPersElemContentTContext
+{
+public:
+ TYPEINFO();
+
+ XMLAxisOOoContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName );
+ ~XMLAxisOOoContext();
+
+ virtual void StartElement( const Reference< xml::sax::XAttributeList >& rAttrList );
+
+ bool IsCategoryAxis() const;
+
+private:
+ bool m_bIsCategoryAxis;
+};
+
+TYPEINIT1( XMLAxisOOoContext, XMLPersElemContentTContext );
+
+XMLAxisOOoContext::XMLAxisOOoContext(
+ XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName ) :
+ XMLPersElemContentTContext( rTransformer, rQName ),
+ m_bIsCategoryAxis( false )
+{}
+
+XMLAxisOOoContext::~XMLAxisOOoContext()
+{}
+
+void XMLAxisOOoContext::StartElement(
+ const Reference< xml::sax::XAttributeList >& rAttrList )
+{
+ OUString aLocation, aMacroName;
+ Reference< xml::sax::XAttributeList > xAttrList( rAttrList );
+ XMLMutableAttributeList *pMutableAttrList = 0;
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName );
+
+ if( nPrefix == XML_NAMESPACE_CHART &&
+ IsXMLToken( aLocalName, XML_CLASS ) )
+ {
+ if( !pMutableAttrList )
+ {
+ pMutableAttrList = new XMLMutableAttributeList( xAttrList );
+ xAttrList = pMutableAttrList;
+ }
+
+ const OUString& rAttrValue = xAttrList->getValueByIndex( i );
+ XMLTokenEnum eToken = XML_TOKEN_INVALID;
+ if( IsXMLToken( rAttrValue, XML_DOMAIN ) ||
+ IsXMLToken( rAttrValue, XML_CATEGORY ))
+ {
+ eToken = XML_X;
+ if( IsXMLToken( rAttrValue, XML_CATEGORY ) )
+ m_bIsCategoryAxis = true;
+ }
+ else if( IsXMLToken( rAttrValue, XML_VALUE ))
+ {
+ eToken = XML_Y;
+ }
+ else if( IsXMLToken( rAttrValue, XML_SERIES ))
+ {
+ eToken = XML_Z;
+ }
+ else
+ {
+ OSL_FAIL( "ChartAxis: Invalid attribute value" );
+ }
+
+ if( eToken != XML_TOKEN_INVALID )
+ {
+ OUString aNewAttrQName(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_CHART, GetXMLToken( XML_DIMENSION )));
+ pMutableAttrList->RenameAttributeByIndex( i, aNewAttrQName );
+ pMutableAttrList->SetValueByIndex( i, GetXMLToken( eToken ));
+ }
+ }
+ }
+
+ XMLPersElemContentTContext::StartElement( xAttrList );
+}
+
+bool XMLAxisOOoContext::IsCategoryAxis() const
+{
+ return m_bIsCategoryAxis;
+}
+
+
+TYPEINIT1( XMLChartPlotAreaOOoTContext, XMLProcAttrTransformerContext )
+
+XMLChartPlotAreaOOoTContext::XMLChartPlotAreaOOoTContext(
+ XMLTransformerBase & rTransformer, const ::rtl::OUString & rQName ) :
+ XMLProcAttrTransformerContext( rTransformer, rQName, OOO_SHAPE_ACTIONS )
+{
+}
+
+XMLChartPlotAreaOOoTContext::~XMLChartPlotAreaOOoTContext()
+{}
+
+XMLTransformerContext * XMLChartPlotAreaOOoTContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::rtl::OUString& rQName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ XMLTransformerContext *pContext = 0;
+
+ if( XML_NAMESPACE_CHART == nPrefix &&
+ IsXMLToken( rLocalName, XML_AXIS ) )
+ {
+ XMLAxisOOoContext * pAxisContext( new XMLAxisOOoContext( GetTransformer(), rQName ));
+ AddContent( pAxisContext );
+ pContext = pAxisContext;
+ }
+ else if( XML_NAMESPACE_CHART == nPrefix &&
+ IsXMLToken( rLocalName, XML_CATEGORIES ) )
+ {
+ pContext = new XMLPersAttrListTContext( GetTransformer(), rQName );
+
+ // put categories at correct axis
+ XMLAxisContextVector::iterator aIter = m_aChildContexts.begin();
+ bool bFound =false;
+
+ // iterate over axis elements
+ for( ; ! bFound && aIter != m_aChildContexts.end(); ++aIter )
+ {
+ XMLAxisOOoContext * pAxisContext = (*aIter).get();
+ if( pAxisContext != 0 )
+ {
+ // iterate over attributes to find category axis
+ Reference< xml::sax::XAttributeList > xNewAttrList( pAxisContext->GetAttrList());
+ sal_Int16 nAttrCount = xNewAttrList.is() ? xNewAttrList->getLength() : 0;
+
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString & rAttrName = xNewAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nNewPrefix =
+ GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ if( nNewPrefix == XML_NAMESPACE_CHART &&
+ pAxisContext->IsCategoryAxis() &&
+ IsXMLToken( aLocalName, XML_DIMENSION ) )
+ {
+ // category axis found
+ pAxisContext->AddContent( pContext );
+ bFound = true;
+ break;
+ }
+ }
+ }
+ }
+ OSL_ENSURE( bFound, "No suitable axis for categories found." );
+ }
+ else
+ {
+ ExportContent();
+ pContext = XMLProcAttrTransformerContext::CreateChildContext(
+ nPrefix, rLocalName, rQName, xAttrList );
+ }
+
+ return pContext;
+}
+
+void XMLChartPlotAreaOOoTContext::EndElement()
+{
+ ExportContent();
+ XMLProcAttrTransformerContext::EndElement();
+}
+
+void XMLChartPlotAreaOOoTContext::AddContent( XMLAxisOOoContext *pContext )
+{
+ OSL_ENSURE( pContext && pContext->IsPersistent(),
+ "non-persistent context" );
+ XMLAxisContextVector::value_type aVal( pContext );
+ m_aChildContexts.push_back( aVal );
+}
+
+
+void XMLChartPlotAreaOOoTContext::ExportContent()
+{
+ XMLAxisContextVector::iterator aIter = m_aChildContexts.begin();
+
+ for( ; aIter != m_aChildContexts.end(); ++aIter )
+ {
+ (*aIter)->Export();
+ }
+
+ m_aChildContexts.clear();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/ChartPlotAreaOOoTContext.hxx b/xmloff/source/transform/ChartPlotAreaOOoTContext.hxx
new file mode 100644
index 000000000000..2155e76a0090
--- /dev/null
+++ b/xmloff/source/transform/ChartPlotAreaOOoTContext.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 XMLOFF_XMLCHARTPLOTAREAOOOTCONTEXT_HXX
+#define XMLOFF_XMLCHARTPLOTAREAOOOTCONTEXT_HXX
+
+#include "ProcAttrTContext.hxx"
+#include "TContextVector.hxx"
+
+class XMLAxisOOoContext;
+
+class XMLAxisContextVector :
+ public ::std::vector< ::rtl::Reference< XMLAxisOOoContext > >
+{
+};
+
+class XMLChartPlotAreaOOoTContext : public XMLProcAttrTransformerContext
+{
+public:
+ TYPEINFO();
+
+ explicit XMLChartPlotAreaOOoTContext(
+ XMLTransformerBase & rTransformer, const ::rtl::OUString & rQName );
+ virtual ~XMLChartPlotAreaOOoTContext();
+
+ virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::rtl::OUString& rQName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+ virtual void ExportContent();
+
+protected:
+ void AddContent( XMLAxisOOoContext *pContent );
+
+private:
+ XMLAxisContextVector m_aChildContexts;
+};
+
+// XMLOFF_XMLCHARTPLOTAREAOOOTCONTEXT_HXX
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/ControlOASISTContext.cxx b/xmloff/source/transform/ControlOASISTContext.cxx
new file mode 100644
index 000000000000..f264693661df
--- /dev/null
+++ b/xmloff/source/transform/ControlOASISTContext.cxx
@@ -0,0 +1,166 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "MutableAttrList.hxx"
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include "ActionMapTypesOASIS.hxx"
+#include "AttrTransformerAction.hxx"
+#include "TransformerActions.hxx"
+#include "TransformerBase.hxx"
+#include "ControlOASISTContext.hxx"
+
+using ::rtl::OUString;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::xmloff::token;
+
+TYPEINIT1( XMLControlOASISTransformerContext, XMLTransformerContext );
+
+XMLControlOASISTransformerContext::XMLControlOASISTransformerContext(
+ XMLTransformerBase& rImp,
+ const OUString& rQName,
+ sal_Bool bCreateControl ) :
+ XMLTransformerContext( rImp, rQName ),
+ m_aElemQName( rImp.GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_FORM,
+ ::xmloff::token::GetXMLToken( XML_CONTROL ) ) ),
+ m_bCreateControl( bCreateControl )
+{
+}
+
+XMLControlOASISTransformerContext::~XMLControlOASISTransformerContext()
+{
+}
+
+void XMLControlOASISTransformerContext::StartElement(
+ const Reference< XAttributeList >& rAttrList )
+{
+
+ XMLTransformerActions *pActions =
+ GetTransformer().GetUserDefinedActions( OASIS_FORM_CONTROL_ACTIONS );
+ OSL_ENSURE( pActions, "go no actions" );
+
+ Reference< XAttributeList > xAttrList( rAttrList );
+ XMLMutableAttributeList *pMutableAttrList = 0;
+// GetTransformer().ProcessAttrList( xAttrList, OOO_SHAPE_ACTIONS,
+// sal_True );
+
+ XMLMutableAttributeList *pControlMutableAttrList =
+ m_bCreateControl ? new XMLMutableAttributeList : 0;
+ Reference< XAttributeList > xControlAttrList( pControlMutableAttrList );
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ XMLTransformerActions::key_type aKey( nPrefix, aLocalName );
+ XMLTransformerActions::const_iterator aIter =
+ pActions->find( aKey );
+ if( !(aIter == pActions->end() ) )
+ {
+ if( !pMutableAttrList )
+ {
+ pMutableAttrList =
+ new XMLMutableAttributeList( rAttrList );
+ xAttrList = pMutableAttrList;
+ }
+ const OUString& rAttrValue = xAttrList->getValueByIndex( i );
+ switch( (*aIter).second.m_nActionType )
+ {
+ case XML_ATACTION_MOVE_TO_ELEM:
+ if( m_bCreateControl )
+ {
+ pControlMutableAttrList->AddAttribute( rAttrName,
+ rAttrValue );
+ pMutableAttrList->RemoveAttributeByIndex( i );
+ --i;
+ --nAttrCount;
+ }
+ break;
+ case XML_ATACTION_RENAME_REMOVE_NAMESPACE_PREFIX:
+ {
+ OUString aAttrValue( rAttrValue );
+ sal_uInt16 nValPrefix =
+ static_cast<sal_uInt16>( (*aIter).second.m_nParam2 );
+ GetTransformer().RemoveNamespacePrefix( aAttrValue,
+ nValPrefix );
+ OUString aNewAttrQName(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ (*aIter).second.GetQNamePrefixFromParam1(),
+ ::xmloff::token::GetXMLToken(
+ (*aIter).second.GetQNameTokenFromParam1()) ) );
+ if( m_bCreateControl )
+ {
+ pControlMutableAttrList->AddAttribute( aNewAttrQName,
+ aAttrValue );
+ pMutableAttrList->RemoveAttributeByIndex( i );
+ --i;
+ --nAttrCount;
+ }
+ else
+ {
+ pMutableAttrList->RenameAttributeByIndex( i,
+ aNewAttrQName );
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ }
+ case XML_ATACTION_URI_OASIS:
+ {
+ OUString aAttrValue( rAttrValue );
+ if( GetTransformer().ConvertURIToOOo( aAttrValue,
+ static_cast< sal_Bool >((*aIter).second.m_nParam1)) )
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ break;
+ default:
+ OSL_ENSURE( !this, "unknown action" );
+ break;
+ }
+ }
+ }
+
+ if( m_bCreateControl )
+ GetTransformer().GetDocHandler()->startElement( m_aElemQName,
+ xControlAttrList );
+ XMLTransformerContext::StartElement( xAttrList );
+}
+
+void XMLControlOASISTransformerContext::EndElement()
+{
+ XMLTransformerContext::EndElement();
+ if( m_bCreateControl )
+ GetTransformer().GetDocHandler()->endElement( m_aElemQName );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/ControlOASISTContext.hxx b/xmloff/source/transform/ControlOASISTContext.hxx
new file mode 100644
index 000000000000..d9e9c4a6b073
--- /dev/null
+++ b/xmloff/source/transform/ControlOASISTContext.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_CONTROLASISTCONTEXT_HXX
+#define _XMLOFF_CONTROLASISTCONTEXT_HXX
+
+#include "TransformerContext.hxx"
+
+class XMLControlOASISTransformerContext : public XMLTransformerContext
+{
+ ::rtl::OUString m_aElemQName;
+ sal_Bool m_bCreateControl;
+
+public:
+ TYPEINFO();
+
+ XMLControlOASISTransformerContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName,
+ sal_Bool bCreateControl );
+
+ virtual ~XMLControlOASISTransformerContext();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void EndElement();
+};
+
+#endif // _XMLOFF_CONTROLASISTCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/ControlOOoTContext.cxx b/xmloff/source/transform/ControlOOoTContext.cxx
new file mode 100644
index 000000000000..ae005c99dbe0
--- /dev/null
+++ b/xmloff/source/transform/ControlOOoTContext.cxx
@@ -0,0 +1,108 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "ControlOOoTContext.hxx"
+#include "IgnoreTContext.hxx"
+#include "MutableAttrList.hxx"
+#include "xmloff/xmlnmspe.hxx"
+#include "ActionMapTypesOOo.hxx"
+#include "ElemTransformerAction.hxx"
+#include "TransformerActions.hxx"
+#include "TransformerBase.hxx"
+
+using ::rtl::OUString;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::xmloff::token;
+
+TYPEINIT1( XMLControlOOoTransformerContext, XMLTransformerContext );
+
+XMLControlOOoTransformerContext::XMLControlOOoTransformerContext(
+ XMLTransformerBase& rImp,
+ const OUString& rQName ) :
+ XMLTransformerContext( rImp, rQName )
+{
+}
+
+XMLControlOOoTransformerContext::~XMLControlOOoTransformerContext()
+{
+}
+
+void XMLControlOOoTransformerContext::StartElement(
+ const Reference< XAttributeList >& rAttrList )
+{
+ m_xAttrList = new XMLMutableAttributeList( rAttrList, sal_True );
+}
+
+XMLTransformerContext *XMLControlOOoTransformerContext::CreateChildContext(
+ sal_uInt16 /*nPrefix*/,
+ const OUString& /*rLocalName*/,
+ const OUString& rQName,
+ const Reference< XAttributeList >& rAttrList )
+{
+ XMLTransformerContext *pContext = 0;
+
+ if( !m_aElemQName.getLength() )
+ {
+ pContext = new XMLIgnoreTransformerContext( GetTransformer(),
+ rQName,
+ sal_False, sal_False );
+ m_aElemQName = rQName;
+ static_cast< XMLMutableAttributeList * >( m_xAttrList.get() )
+ ->AppendAttributeList( rAttrList );
+ GetTransformer().ProcessAttrList( m_xAttrList,
+ OOO_FORM_CONTROL_ACTIONS,
+ sal_False );
+ GetTransformer().GetDocHandler()->startElement( m_aElemQName,
+ m_xAttrList );
+ }
+ else
+ {
+ pContext = new XMLIgnoreTransformerContext( GetTransformer(),
+ rQName,
+ sal_True, sal_True );
+ }
+ return pContext;
+}
+
+void XMLControlOOoTransformerContext::EndElement()
+{
+ GetTransformer().GetDocHandler()->endElement( m_aElemQName );
+}
+
+void XMLControlOOoTransformerContext::Characters( const OUString& rChars )
+{
+ // ignore
+ if( m_aElemQName.getLength() )
+ XMLTransformerContext::Characters( rChars );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/ControlOOoTContext.hxx b/xmloff/source/transform/ControlOOoTContext.hxx
new file mode 100644
index 000000000000..47d25e8f48de
--- /dev/null
+++ b/xmloff/source/transform/ControlOOoTContext.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_CONTROLOOOTCONTEXT_HXX
+#define _XMLOFF_CONTROLOOOTCONTEXT_HXX
+
+#include "TransformerContext.hxx"
+
+class XMLControlOOoTransformerContext : public XMLTransformerContext
+{
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > m_xAttrList;
+
+ ::rtl::OUString m_aElemQName;
+
+public:
+ TYPEINFO();
+
+ XMLControlOOoTransformerContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName );
+
+ virtual ~XMLControlOOoTransformerContext();
+
+ virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::rtl::OUString& rQName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void EndElement();
+
+ virtual void Characters( const ::rtl::OUString& rChars );
+};
+
+#endif // _XMLOFF_CONTROLOOOTCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/CreateElemTContext.cxx b/xmloff/source/transform/CreateElemTContext.cxx
new file mode 100644
index 000000000000..5e81a7ff66f9
--- /dev/null
+++ b/xmloff/source/transform/CreateElemTContext.cxx
@@ -0,0 +1,132 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "CreateElemTContext.hxx"
+#include "MutableAttrList.hxx"
+#include "TransformerBase.hxx"
+#include "TransformerActions.hxx"
+#include "TContextVector.hxx"
+#include "FlatTContext.hxx"
+#include "AttrTransformerAction.hxx"
+#include <xmloff/nmspmap.hxx>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::xmloff::token;
+
+TYPEINIT1( XMLCreateElemTransformerContext, XMLTransformerContext );
+
+XMLCreateElemTransformerContext::XMLCreateElemTransformerContext(
+ XMLTransformerBase& rImp,
+ const OUString& rQName,
+ sal_uInt16 nActionMap ) :
+ XMLTransformerContext( rImp, rQName ),
+ m_nActionMap( nActionMap )
+{
+}
+
+XMLCreateElemTransformerContext::~XMLCreateElemTransformerContext()
+{
+}
+
+void XMLCreateElemTransformerContext::StartElement(
+ const Reference< XAttributeList >& rAttrList )
+{
+ Reference< XAttributeList > xAttrList( rAttrList );
+
+ XMLTransformerContextVector aChildContexts;
+
+ XMLMutableAttributeList *pMutableAttrList = 0;
+ XMLTransformerActions *pActions =
+ GetTransformer().GetUserDefinedActions( m_nActionMap );
+ OSL_ENSURE( pActions, "go no actions" );
+ if( pActions )
+ {
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; ++i )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ const OUString& rAttrValue = xAttrList->getValueByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+
+ XMLTransformerActions::key_type aKey( nPrefix, aLocalName );
+ XMLTransformerActions::const_iterator aIter =
+ pActions->find( aKey );
+ if( !(aIter == pActions->end() ) )
+ {
+ if( !pMutableAttrList )
+ {
+ pMutableAttrList = new XMLMutableAttributeList( xAttrList );
+ xAttrList = pMutableAttrList;
+ }
+ sal_uInt32 nAction = (*aIter).second.m_nActionType;
+ switch( nAction )
+ {
+ case XML_ATACTION_MOVE_TO_ELEM:
+ {
+ OUString aElemQName(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ (*aIter).second.GetQNamePrefixFromParam1(),
+ ::xmloff::token::GetXMLToken(
+ (*aIter).second.GetQNameTokenFromParam1()) ) );
+ XMLTransformerContext *pContext =
+ new XMLPersTextContentTContext( GetTransformer(),
+ aElemQName );
+ pContext->Characters( rAttrValue );
+ XMLTransformerContextVector::value_type aVal(
+ pContext );
+ aChildContexts.push_back( aVal );
+ pMutableAttrList->RemoveAttributeByIndex( i );
+ --i;
+ --nAttrCount;
+ }
+ break;
+ default:
+ OSL_ENSURE( !this, "unknown action" );
+ break;
+ }
+ }
+ }
+ }
+ XMLTransformerContext::StartElement( xAttrList );
+
+ XMLTransformerContextVector::iterator aIter = aChildContexts.begin();
+
+ for( ; aIter != aChildContexts.end(); ++aIter )
+ {
+ (*aIter)->Export();
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/CreateElemTContext.hxx b/xmloff/source/transform/CreateElemTContext.hxx
new file mode 100644
index 000000000000..601c7afe4903
--- /dev/null
+++ b/xmloff/source/transform/CreateElemTContext.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_CREATEELEMTCONTEXT_HXX
+#define _XMLOFF_CREATEELEMTCONTEXT_HXX
+
+#include <xmloff/xmltoken.hxx>
+#include "TransformerContext.hxx"
+
+class XMLMutableAttributeList;
+class XMLTransformerActions;
+class XMLCreateElemTransformerContext : public XMLTransformerContext
+{
+ sal_uInt16 m_nActionMap;
+
+protected:
+
+ sal_uInt16 GetActionMap() const { return m_nActionMap; }
+
+public:
+ TYPEINFO();
+
+ XMLCreateElemTransformerContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName,
+ sal_uInt16 nActionMap );
+
+ virtual ~XMLCreateElemTransformerContext();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+};
+
+#endif // _XMLOFF_CREATEELEMCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/DeepTContext.cxx b/xmloff/source/transform/DeepTContext.cxx
new file mode 100644
index 000000000000..b6dc3d52ce43
--- /dev/null
+++ b/xmloff/source/transform/DeepTContext.cxx
@@ -0,0 +1,179 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "DeepTContext.hxx"
+#include "FlatTContext.hxx"
+#include "EventOOoTContext.hxx"
+#include "TransformerActions.hxx"
+#include "ElemTransformerAction.hxx"
+#include "PersMixedContentTContext.hxx"
+#include "TransformerBase.hxx"
+
+using ::rtl::OUString;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+
+TYPEINIT1( XMLPersElemContentTContext, XMLPersAttrListTContext );
+
+void XMLPersElemContentTContext::AddContent( XMLTransformerContext *pContext )
+{
+ OSL_ENSURE( pContext && pContext->IsPersistent(),
+ "non-persistent context" );
+ XMLTransformerContextVector::value_type aVal( pContext );
+ m_aChildContexts.push_back( aVal );
+}
+
+XMLPersElemContentTContext::XMLPersElemContentTContext(
+ XMLTransformerBase& rImp,
+ const OUString& rQName ) :
+ XMLPersAttrListTContext( rImp, rQName )
+{
+}
+
+XMLPersElemContentTContext::XMLPersElemContentTContext(
+ XMLTransformerBase& rImp,
+ const OUString& rQName,
+ sal_uInt16 nActionMap ) :
+ XMLPersAttrListTContext( rImp, rQName, nActionMap )
+{
+}
+
+XMLPersElemContentTContext::XMLPersElemContentTContext(
+ XMLTransformerBase& rImp,
+ const OUString& rQName,
+ sal_uInt16 nPrefix,
+ ::xmloff::token::XMLTokenEnum eToken ) :
+ XMLPersAttrListTContext( rImp, rQName, nPrefix, eToken )
+{
+}
+
+XMLPersElemContentTContext::XMLPersElemContentTContext(
+ XMLTransformerBase& rImp,
+ const OUString& rQName,
+ sal_uInt16 nPrefix,
+ ::xmloff::token::XMLTokenEnum eToken,
+ sal_uInt16 nActionMap ) :
+ XMLPersAttrListTContext( rImp, rQName, nPrefix, eToken, nActionMap )
+{
+}
+
+XMLPersElemContentTContext::~XMLPersElemContentTContext()
+{
+}
+
+XMLTransformerContext *XMLPersElemContentTContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const OUString& rQName,
+ const Reference< XAttributeList >& )
+{
+ XMLTransformerContext *pContext = 0;
+
+ XMLTransformerActions::key_type aKey( nPrefix, rLocalName );
+ XMLTransformerActions::const_iterator aIter =
+ GetTransformer().GetElemActions().find( aKey );
+
+ if( !(aIter == GetTransformer().GetElemActions().end()) )
+ {
+ switch( (*aIter).second.m_nActionType )
+ {
+ case XML_ETACTION_COPY:
+ pContext = new XMLPersMixedContentTContext( GetTransformer(),
+ rQName );
+ break;
+ case XML_ETACTION_COPY_TEXT:
+ pContext = new XMLPersMixedContentTContext( GetTransformer(),
+ rQName );
+ break;
+ case XML_ETACTION_RENAME_ELEM:
+ pContext = new XMLPersMixedContentTContext( GetTransformer(), rQName,
+ (*aIter).second.GetQNamePrefixFromParam1(),
+ (*aIter).second.GetQNameTokenFromParam1() );
+ break;
+ case XML_ETACTION_RENAME_ELEM_PROC_ATTRS:
+ pContext = new XMLPersMixedContentTContext( GetTransformer(), rQName,
+ (*aIter).second.GetQNamePrefixFromParam1(),
+ (*aIter).second.GetQNameTokenFromParam1(),
+ static_cast< sal_uInt16 >( (*aIter).second.m_nParam2 ) );
+ break;
+ case XML_ETACTION_RENAME_ELEM_ADD_PROC_ATTR:
+ {
+ XMLPersMixedContentTContext *pMC =
+ new XMLPersMixedContentTContext( GetTransformer(), rQName,
+ (*aIter).second.GetQNamePrefixFromParam1(),
+ (*aIter).second.GetQNameTokenFromParam1(),
+ static_cast< sal_uInt16 >(
+ (*aIter).second.m_nParam3 >> 16 ) );
+ pMC->AddAttribute(
+ (*aIter).second.GetQNamePrefixFromParam2(),
+ (*aIter).second.GetQNameTokenFromParam2(),
+ static_cast< ::xmloff::token::XMLTokenEnum >(
+ (*aIter).second.m_nParam3 & 0xffff ) );
+ pContext = pMC;
+ }
+ break;
+ case XML_ETACTION_PROC_ATTRS:
+ pContext = new XMLPersMixedContentTContext( GetTransformer(), rQName,
+ static_cast< sal_uInt16 >( (*aIter).second.m_nParam1 ) );
+ break;
+ default:
+ pContext = GetTransformer().CreateUserDefinedContext(
+ (*aIter).second, rQName, sal_True );
+ OSL_ENSURE( pContext && pContext->IsPersistent(),
+ "unknown or not persistent action" );
+ if( pContext && !pContext->IsPersistent() )
+ {
+ delete pContext;
+ pContext = 0;
+ }
+ break;
+ }
+ }
+
+ // default is copying
+ if( !pContext )
+ pContext = new XMLPersMixedContentTContext( GetTransformer(), rQName );
+ XMLTransformerContextVector::value_type aVal( pContext );
+ m_aChildContexts.push_back( aVal );
+
+ return pContext;
+}
+
+void XMLPersElemContentTContext::ExportContent()
+{
+ XMLTransformerContextVector::iterator aIter = m_aChildContexts.begin();
+
+ for( ; aIter != m_aChildContexts.end(); ++aIter )
+ {
+ (*aIter)->Export();
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/DeepTContext.hxx b/xmloff/source/transform/DeepTContext.hxx
new file mode 100644
index 000000000000..02a6d2b5c87f
--- /dev/null
+++ b/xmloff/source/transform/DeepTContext.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_DEEPTCONTEXT_HXX
+#define _XMLOFF_DEEPTCONTEXT_HXX
+
+#include <rtl/ref.hxx>
+
+#include <vector>
+#include "PersAttrListTContext.hxx"
+#include "TContextVector.hxx"
+
+class XMLPersElemContentTContext : public XMLPersAttrListTContext
+{
+ XMLTransformerContextVector m_aChildContexts;
+
+public:
+ TYPEINFO();
+
+ // element content persistence only
+ XMLPersElemContentTContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName );
+
+ // element content persistence + attribute processing
+ XMLPersElemContentTContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName,
+ sal_uInt16 nActionMap );
+
+ // element content persistence + renaming
+ XMLPersElemContentTContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName,
+ sal_uInt16 nPrefix,
+ ::xmloff::token::XMLTokenEnum eToken );
+
+ // element content persistence + renaming + attribute processing
+ XMLPersElemContentTContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName,
+ sal_uInt16 nPrefix,
+ ::xmloff::token::XMLTokenEnum eToken,
+ sal_uInt16 nActionMap );
+
+ virtual ~XMLPersElemContentTContext();
+
+ virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::rtl::OUString& rQName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ void AddContent( XMLTransformerContext *pContent );
+
+ sal_Bool HasElementContent() const
+ {
+ return static_cast<sal_Bool>( !m_aChildContexts.empty() );
+ }
+
+ virtual void ExportContent();
+};
+
+#endif // _XMLOFF_DEEPTCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/DlgOASISTContext.cxx b/xmloff/source/transform/DlgOASISTContext.cxx
new file mode 100644
index 000000000000..3aa567526437
--- /dev/null
+++ b/xmloff/source/transform/DlgOASISTContext.cxx
@@ -0,0 +1,117 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "DlgOASISTContext.hxx"
+#include "MutableAttrList.hxx"
+#include "xmloff/xmlnmspe.hxx"
+#include "ActionMapTypesOASIS.hxx"
+#include "AttrTransformerAction.hxx"
+#include "TransformerActions.hxx"
+#include "TransformerBase.hxx"
+
+using ::rtl::OUString;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::xmloff::token;
+
+// -----------------------------------------------------------------------------
+
+TYPEINIT1( XMLDlgOASISTransformerContext, XMLTransformerContext);
+
+XMLDlgOASISTransformerContext::XMLDlgOASISTransformerContext(
+ XMLTransformerBase& rImp,
+ const OUString& rQName ) :
+ XMLTransformerContext( rImp, rQName )
+{
+}
+
+XMLDlgOASISTransformerContext::~XMLDlgOASISTransformerContext()
+{
+}
+
+void XMLDlgOASISTransformerContext::StartElement(
+ const Reference< XAttributeList >& rAttrList )
+{
+ XMLTransformerActions *pActions =
+ GetTransformer().GetUserDefinedActions( OASIS_DLG_ACTIONS );
+ OSL_ENSURE( pActions, "go no actions" );
+
+ Reference< XAttributeList > xAttrList( rAttrList );
+ XMLMutableAttributeList *pMutableAttrList = 0;
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+
+ XMLTransformerActions::key_type aKey( nPrefix, aLocalName );
+ XMLTransformerActions::const_iterator aIter =
+ pActions->find( aKey );
+
+ if( !(aIter == pActions->end() ) )
+ {
+ if( !pMutableAttrList )
+ {
+ pMutableAttrList =
+ new XMLMutableAttributeList( xAttrList );
+ xAttrList = pMutableAttrList;
+ }
+ const OUString& rAttrValue = xAttrList->getValueByIndex( i );
+ switch( (*aIter).second.m_nActionType )
+ {
+ case XML_ATACTION_DLG_BORDER:
+ {
+ OUString aAttrValue( rAttrValue );
+
+ if ( !aAttrValue.equals( GetXMLToken( XML_NONE ) ) &&
+ !aAttrValue.equals( GetXMLToken( XML_SIMPLE ) ) &&
+ !aAttrValue.equals( GetXMLToken( XML_3D ) ) )
+ {
+ pMutableAttrList->SetValueByIndex(
+ i, GetXMLToken( XML_NONE ) );
+ }
+ }
+ break;
+ default:
+ OSL_ENSURE( !this, "unknown action" );
+ break;
+ }
+ }
+ }
+
+ XMLTransformerContext::StartElement( xAttrList );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/DlgOASISTContext.hxx b/xmloff/source/transform/DlgOASISTContext.hxx
new file mode 100644
index 000000000000..15f13a089cb4
--- /dev/null
+++ b/xmloff/source/transform/DlgOASISTContext.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_DLGOASISTCONTEXT_HXX
+#define _XMLOFF_DLGOASISTCONTEXT_HXX
+
+#include "TransformerContext.hxx"
+
+class XMLDlgOASISTransformerContext : public XMLTransformerContext
+{
+public:
+ TYPEINFO();
+
+ XMLDlgOASISTransformerContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName );
+ virtual ~XMLDlgOASISTransformerContext();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+};
+
+#endif // _XMLOFF_DLGOASISTCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/DocumentTContext.cxx b/xmloff/source/transform/DocumentTContext.cxx
new file mode 100644
index 000000000000..9e0e88c25c93
--- /dev/null
+++ b/xmloff/source/transform/DocumentTContext.cxx
@@ -0,0 +1,148 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/xml/sax/SAXParseException.hpp>
+#include <com/sun/star/xml/sax/SAXException.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlnmspe.hxx"
+
+#include "TransformerBase.hxx"
+#include "MutableAttrList.hxx"
+
+#include "DocumentTContext.hxx"
+
+using ::rtl::OUString;
+
+using namespace ::xmloff::token;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::beans;
+
+TYPEINIT1( XMLDocumentTransformerContext, XMLTransformerContext );
+
+XMLDocumentTransformerContext::XMLDocumentTransformerContext( XMLTransformerBase& rImp,
+ const OUString& rQName ) :
+ XMLTransformerContext( rImp, rQName )
+{
+}
+
+XMLDocumentTransformerContext::~XMLDocumentTransformerContext()
+{
+}
+
+void XMLDocumentTransformerContext::StartElement( const Reference< XAttributeList >& rAttrList )
+{
+ Reference< XAttributeList > xAttrList( rAttrList );
+
+ sal_Bool bMimeFound = sal_False;
+ OUString aClass;
+ OUString aClassQName(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_OFFICE, GetXMLToken(XML_CLASS ) ) );
+
+ XMLMutableAttributeList *pMutableAttrList = 0;
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ if( XML_NAMESPACE_OFFICE == nPrefix &&
+ IsXMLToken( aLocalName, XML_MIMETYPE ) )
+ {
+ const OUString& rValue = xAttrList->getValueByIndex( i );
+ static const char * aTmp[] =
+ {
+ "application/vnd.oasis.openoffice.",
+ "application/x-vnd.oasis.openoffice.",
+ "application/vnd.oasis.opendocument.",
+ "application/x-vnd.oasis.document.",
+ NULL
+ };
+ for (int k=0; aTmp[k]; k++)
+ {
+ ::rtl::OUString sTmpString = ::rtl::OUString::createFromAscii(aTmp[k]);
+ if( rValue.matchAsciiL( aTmp[k], sTmpString.getLength() ) )
+ {
+ aClass = rValue.copy( sTmpString.getLength() );
+ break;
+ }
+ }
+
+ if( !pMutableAttrList )
+ {
+ pMutableAttrList = new XMLMutableAttributeList( xAttrList );
+ xAttrList = pMutableAttrList;
+ }
+ pMutableAttrList->SetValueByIndex( i, aClass );
+ pMutableAttrList->RenameAttributeByIndex(i, aClassQName );
+ bMimeFound = sal_True;
+ break;
+ }
+ }
+
+ if( !bMimeFound )
+ {
+ const Reference< XPropertySet > rPropSet =
+ GetTransformer().GetPropertySet();
+
+ if( rPropSet.is() )
+ {
+ Reference< XPropertySetInfo > xPropSetInfo(
+ rPropSet->getPropertySetInfo() );
+ OUString aPropName(RTL_CONSTASCII_USTRINGPARAM("Class"));
+ if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName( aPropName ) )
+ {
+ Any aAny = rPropSet->getPropertyValue( aPropName );
+ aAny >>= aClass;
+ }
+ }
+
+ if( aClass.getLength() )
+ {
+ if( !pMutableAttrList )
+ {
+ pMutableAttrList = new XMLMutableAttributeList( xAttrList );
+ xAttrList = pMutableAttrList;
+ }
+
+ pMutableAttrList->AddAttribute( aClassQName, aClass );
+ }
+ }
+ XMLTransformerContext::StartElement( xAttrList );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/DocumentTContext.hxx b/xmloff/source/transform/DocumentTContext.hxx
new file mode 100644
index 000000000000..a601e6933675
--- /dev/null
+++ b/xmloff/source/transform/DocumentTContext.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_DOCUMENTTCONTEXT_HXX
+#define _XMLOFF_DOCUMENTTCONTEXT_HXX
+
+#include "TransformerContext.hxx"
+
+class XMLDocumentTransformerContext : public XMLTransformerContext
+{
+public:
+ TYPEINFO();
+
+ // A contexts constructor does anything that is required if an element
+ // starts. Namespace processing has been done already.
+ // Note that virtual methods cannot be used inside constructors. Use
+ // StartElement instead if this is required.
+ XMLDocumentTransformerContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName );
+
+ // A contexts destructor does anything that is required if an element
+ // ends. By default, nothing is done.
+ // Note that virtual methods cannot be used inside destructors. Use
+ // EndElement instead if this is required.
+ virtual ~XMLDocumentTransformerContext();
+
+ // StartElement is called after a context has been constructed and
+ // before a elements context is parsed. It may be used for actions that
+ // require virtual methods. The default is to do nothing.
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+};
+
+#endif // _XMLOFF_DOCUMENTTCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/ElemTransformerAction.hxx b/xmloff/source/transform/ElemTransformerAction.hxx
new file mode 100644
index 000000000000..83fea0d81ce6
--- /dev/null
+++ b/xmloff/source/transform/ElemTransformerAction.hxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_ELEMTRANSFORMERACTION_HXX
+#define _XMLOFF_ELEMTRANSFORMERACTION_HXX
+
+#include "TransformerAction.hxx"
+
+enum XMLElemTransformerAction
+{
+ XML_ETACTION_EOT=XML_TACTION_EOT, // uses for initialization only
+ XML_ETACTION_COPY, // copy all (default)
+ // for persistent elements: keep
+ // elem content
+ XML_ETACTION_COPY_TEXT, // copy all
+ // for persistent elements: keep
+ // text content
+ XML_ETACTION_COPY_CONTENT, // ignore elem, process content
+ XML_ETACTION_RENAME_ELEM, // rename element:
+ // - param1: namespace +
+ // token of local name
+ XML_ETACTION_RENAME_ELEM_PROC_ATTRS,// rename element and proc attr:
+ // - param1: elem namespace +
+ // token of local name
+ // - param2: attr acation map
+ XML_ETACTION_RENAME_ELEM_ADD_ATTR, // rename element and add attr:
+ // - param1: elem namespace +
+ // token of local name
+ // - param2: attr namespace +
+ // token of local name
+ // - param3: attr value
+ XML_ETACTION_RENAME_ELEM_ADD_PROC_ATTR, // rename element and add attr:
+ // - param1: elem namespace +
+ // token of local name
+ // - param2: attr namespace +
+ // token of local name
+ // - param3: attr value (low)
+ // attr action map (high)
+ XML_ETACTION_RENAME_ELEM_COND, // rename element if child of another:
+ // - param1: namespace +
+ // token of new local name
+ // - param2: namespace +
+ // token of parent element
+ XML_ETACTION_RENAME_ELEM_PROC_ATTRS_COND,// rename element and proc attr
+ // if child of another:
+ // - param1: elem namespace +
+ // token of new local name
+ // - param2: attr acation map
+ // - param3: namespace +
+ // token of parent element
+ XML_ETACTION_PROC_ATTRS, // proc attr:
+ // - param1: attr acation map
+ XML_ETACTION_MOVE_ATTRS_TO_ELEMS, // turn some attributes into elems
+ // - param1: action map specifying
+ // the attrs that shall be moved
+ XML_ETACTION_MOVE_ELEMS_TO_ATTRS, // turn some elems into attrs
+ // - param1: action map specifying
+ // the elems that shall be moved
+ XML_ETACTION_PROC_ATTRS_COND, // proc attr if child of another:
+ // - param1: namespace +
+ // token of parent element
+ // - param2: attr acation map
+ XML_ETACTION_EXTRACT_CHARACTERS, // takes the characters of the current
+ // element and all child elements
+ // and put them together into the
+ // current element
+ // the child elements are removed
+ XML_ETACTION_USER_DEFINED=0x40000000,// user defined actions start here
+ XML_ETACTION_END=XML_TACTION_END
+};
+
+#endif // _XMLOFF_ELEMTRANSFORMERACTION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/EventMap.cxx b/xmloff/source/transform/EventMap.cxx
new file mode 100644
index 000000000000..623e77a36ece
--- /dev/null
+++ b/xmloff/source/transform/EventMap.cxx
@@ -0,0 +1,114 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "EventMap.hxx"
+#include "xmloff/xmlnmspe.hxx"
+
+
+XMLTransformerEventMapEntry aTransformerEventMap[] =
+{
+ { XML_NAMESPACE_DOM, "select", "on-select" },
+ { XML_NAMESPACE_OFFICE, "insert-start", "on-insert-start" },
+ { XML_NAMESPACE_OFFICE, "insert-done", "on-insert-done" },
+ { XML_NAMESPACE_OFFICE, "mail-merge", "on-mail-merge" },
+ { XML_NAMESPACE_OFFICE, "alpha-char-input", "on-alpha-char-input" },
+ { XML_NAMESPACE_OFFICE, "non-alpha-char-input", "on-non-alpha-char-input" },
+ { XML_NAMESPACE_DOM, "resize", "on-resize" },
+ { XML_NAMESPACE_OFFICE, "move", "on-move" },
+ { XML_NAMESPACE_OFFICE, "page-count-change", "on-page-count-change" },
+ { XML_NAMESPACE_DOM, "mouseover", "on-mouse-over" },
+ { XML_NAMESPACE_DOM, "click", "on-click" },
+ { XML_NAMESPACE_DOM, "mouseout", "on-mouse-out" },
+ { XML_NAMESPACE_OFFICE, "load-error", "on-load-error" },
+ { XML_NAMESPACE_OFFICE, "load-cancel", "on-load-cancel" },
+ { XML_NAMESPACE_OFFICE, "load-done", "on-load-done" },
+ { XML_NAMESPACE_DOM, "load", "on-load" },
+ { XML_NAMESPACE_DOM, "unload", "on-unload" },
+ { XML_NAMESPACE_OFFICE, "start-app", "on-start-app" },
+ { XML_NAMESPACE_OFFICE, "close-app", "on-close-app" },
+ { XML_NAMESPACE_OFFICE, "new", "on-new" },
+ { XML_NAMESPACE_OFFICE, "save", "on-save" },
+ { XML_NAMESPACE_OFFICE, "save-as", "on-save-as" },
+ { XML_NAMESPACE_DOM, "DOMFocusIn", "on-focus" },
+ { XML_NAMESPACE_DOM, "DOMFocusOut", "on-unfocus" },
+ { XML_NAMESPACE_OFFICE, "print", "on-print" },
+ { XML_NAMESPACE_DOM, "error", "on-error" },
+ { XML_NAMESPACE_OFFICE, "load-finished", "on-load-finished" },
+ { XML_NAMESPACE_OFFICE, "save-finished", "on-save-finished" },
+ { XML_NAMESPACE_OFFICE, "modify-changed", "on-modify-changed" },
+ { XML_NAMESPACE_OFFICE, "prepare-unload", "on-prepare-unload" },
+ { XML_NAMESPACE_OFFICE, "new-mail", "on-new-mail" },
+ { XML_NAMESPACE_OFFICE, "toggle-fullscreen", "on-toggle-fullscreen" },
+ { XML_NAMESPACE_OFFICE, "save-done", "on-save-done" },
+ { XML_NAMESPACE_OFFICE, "save-as-done", "on-save-as-done" },
+ { XML_NAMESPACE_OFFICE, "create", "on-create" },
+ { XML_NAMESPACE_OFFICE, "save-as-failed", "on-save-as-failed" },
+ { XML_NAMESPACE_OFFICE, "save-failed", "on-save-failed" },
+ { XML_NAMESPACE_OFFICE, "copy-to-failed", "on-copy-to-failed" },
+ { XML_NAMESPACE_OFFICE, "title-changed", "on-title-changed" },
+
+ { XML_NAMESPACE_FORM, "approveaction", "on-approveaction" },
+ { XML_NAMESPACE_FORM, "performaction", "on-performaction" },
+ { XML_NAMESPACE_DOM, "change", "on-change" },
+ { XML_NAMESPACE_FORM, "textchange", "on-textchange" },
+ { XML_NAMESPACE_FORM, "itemstatechange", "on-itemstatechange" },
+ { XML_NAMESPACE_DOM, "keydown", "on-keydown" },
+ { XML_NAMESPACE_DOM, "keyup", "on-keyup" },
+ { XML_NAMESPACE_FORM, "mousedrag", "on-mousedrag" },
+ { XML_NAMESPACE_DOM, "mousemove", "on-mousemove" },
+ { XML_NAMESPACE_DOM, "mousedown", "on-mousedown" },
+ { XML_NAMESPACE_DOM, "mouseup", "on-mouseup" },
+ { XML_NAMESPACE_FORM, "approvereset", "on-approvereset" },
+ { XML_NAMESPACE_DOM, "reset", "on-reset" },
+ { XML_NAMESPACE_DOM, "submit", "on-submit" },
+ { XML_NAMESPACE_FORM, "approveupdate", "on-approveupdate" },
+ { XML_NAMESPACE_FORM, "update", "on-update" },
+ { XML_NAMESPACE_FORM, "startreload", "on-startreload" },
+ { XML_NAMESPACE_FORM, "reload", "on-reload" },
+ { XML_NAMESPACE_FORM, "startunload", "on-startunload" },
+ { XML_NAMESPACE_FORM, "confirmdelete", "on-confirmdelete" },
+ { XML_NAMESPACE_FORM, "approverowchange", "on-approverowchange" },
+ { XML_NAMESPACE_FORM, "rowchange", "on-rowchange" },
+ { XML_NAMESPACE_FORM, "approvecursormove", "on-approvecursormove" },
+ { XML_NAMESPACE_FORM, "cursormove", "on-cursormove" },
+ { XML_NAMESPACE_FORM, "supplyparameter", "on-supplyparameter" },
+ { XML_NAMESPACE_FORM, "adjust", "on-adjust" },
+ { 0, 0, 0 }
+};
+
+XMLTransformerEventMapEntry aFormTransformerEventMap[] =
+{
+ { XML_NAMESPACE_DOM, "mouseover", "on-mouseover" },
+ { XML_NAMESPACE_DOM, "mouseout", "on-mouseout" },
+ { XML_NAMESPACE_DOM, "DOMFocusOut", "on-blur" },
+ { 0, 0, 0 }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/EventMap.hxx b/xmloff/source/transform/EventMap.hxx
new file mode 100644
index 000000000000..ce0a5dd82cac
--- /dev/null
+++ b/xmloff/source/transform/EventMap.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_EVENTMAP_HXX
+#define _XMLOFF_EVENTMAP_HXX
+
+#include "TransformerContext.hxx"
+
+struct XMLTransformerEventMapEntry
+{
+ sal_uInt16 m_nOASISPrefix;
+ const sal_Char *m_pOASISName;
+ const sal_Char *m_pOOoName;
+};
+
+extern XMLTransformerEventMapEntry aTransformerEventMap[];
+extern XMLTransformerEventMapEntry aFormTransformerEventMap[];
+
+#endif // _XMLOFF_EVENTMAP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/EventOASISTContext.cxx b/xmloff/source/transform/EventOASISTContext.cxx
new file mode 100644
index 000000000000..3db3b376695c
--- /dev/null
+++ b/xmloff/source/transform/EventOASISTContext.cxx
@@ -0,0 +1,421 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "EventOASISTContext.hxx"
+#include "EventMap.hxx"
+#include "MutableAttrList.hxx"
+#include "xmloff/xmlnmspe.hxx"
+#include "ActionMapTypesOASIS.hxx"
+#include "AttrTransformerAction.hxx"
+#include "TransformerActions.hxx"
+#include "TransformerBase.hxx"
+
+#ifndef OASIS_FILTER_OOO_1X
+// Used to parse Scripting Framework URLs
+#include <com/sun/star/uri/XUriReferenceFactory.hpp>
+#include <com/sun/star/uri/XVndSunStarScriptUrl.hpp>
+#include <comphelper/processfactory.hxx>
+#endif
+
+#include <boost/unordered_map.hpp>
+
+using ::rtl::OUString;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::xmloff::token;
+
+class XMLTransformerOASISEventMap_Impl:
+ public ::boost::unordered_map< NameKey_Impl, ::rtl::OUString,
+ NameHash_Impl, NameHash_Impl >
+{
+public:
+ XMLTransformerOASISEventMap_Impl( XMLTransformerEventMapEntry *pInit );
+ ~XMLTransformerOASISEventMap_Impl();
+};
+
+XMLTransformerOASISEventMap_Impl::XMLTransformerOASISEventMap_Impl( XMLTransformerEventMapEntry *pInit )
+{
+ if( pInit )
+ {
+ XMLTransformerOASISEventMap_Impl::key_type aKey;
+ XMLTransformerOASISEventMap_Impl::mapped_type aData;
+ while( pInit->m_pOASISName )
+ {
+ aKey.m_nPrefix = pInit->m_nOASISPrefix;
+ aKey.m_aLocalName = OUString::createFromAscii(pInit->m_pOASISName);
+
+ OSL_ENSURE( find( aKey ) == end(), "duplicate event map entry" );
+
+ aData = OUString::createFromAscii(pInit->m_pOOoName);
+
+ XMLTransformerOASISEventMap_Impl::value_type aVal( aKey, aData );
+
+ insert( aVal );
+ ++pInit;
+ }
+ }
+}
+
+XMLTransformerOASISEventMap_Impl::~XMLTransformerOASISEventMap_Impl()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+TYPEINIT1( XMLEventOASISTransformerContext, XMLRenameElemTransformerContext);
+
+XMLEventOASISTransformerContext::XMLEventOASISTransformerContext(
+ XMLTransformerBase& rImp,
+ const OUString& rQName ) :
+ XMLRenameElemTransformerContext( rImp, rQName,
+ rImp.GetNamespaceMap().GetKeyByAttrName( rQName ), XML_EVENT )
+{
+}
+
+XMLEventOASISTransformerContext::~XMLEventOASISTransformerContext()
+{
+}
+
+XMLTransformerOASISEventMap_Impl
+ *XMLEventOASISTransformerContext::CreateEventMap()
+{
+ return new XMLTransformerOASISEventMap_Impl( aTransformerEventMap );
+}
+
+XMLTransformerOASISEventMap_Impl
+ *XMLEventOASISTransformerContext::CreateFormEventMap()
+{
+ return new XMLTransformerOASISEventMap_Impl( aFormTransformerEventMap );
+}
+
+void XMLEventOASISTransformerContext::FlushEventMap(
+ XMLTransformerOASISEventMap_Impl *p )
+{
+ delete p;
+}
+
+OUString XMLEventOASISTransformerContext::GetEventName(
+ sal_uInt16 nPrefix,
+ const OUString& rName,
+ XMLTransformerOASISEventMap_Impl& rMap,
+ XMLTransformerOASISEventMap_Impl *pMap2)
+{
+ XMLTransformerOASISEventMap_Impl::key_type aKey( nPrefix, rName );
+ if( pMap2 )
+ {
+ XMLTransformerOASISEventMap_Impl::const_iterator aIter =
+ pMap2->find( aKey );
+ if( !(aIter == pMap2->end()) )
+ return (*aIter).second;
+ }
+
+ XMLTransformerOASISEventMap_Impl::const_iterator aIter = rMap.find( aKey );
+ if( aIter == rMap.end() )
+ return rName;
+ else
+ return (*aIter).second;
+}
+
+bool ParseURLAsString(
+ const OUString& rAttrValue,
+ OUString* pName, OUString* pLocation )
+{
+ OUString SCHEME( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.script:" ) );
+
+ sal_Int32 params = rAttrValue.indexOf( '?' );
+ if ( rAttrValue.indexOf( SCHEME ) != 0 || params < 0 )
+ {
+ return sal_False;
+ }
+
+ sal_Int32 start = SCHEME.getLength();
+ *pName = rAttrValue.copy( start, params - start );
+
+ OUString aToken;
+ OUString aLanguage;
+ params++;
+ do
+ {
+ aToken = rAttrValue.getToken( 0, '&', params );
+ sal_Int32 dummy = 0;
+
+ if ( aToken.match( GetXMLToken( XML_LANGUAGE ) ) )
+ {
+ aLanguage = aToken.getToken( 1, '=', dummy );
+ }
+ else if ( aToken.match( GetXMLToken( XML_LOCATION ) ) )
+ {
+ OUString tmp = aToken.getToken( 1, '=', dummy );
+ if ( tmp.equalsIgnoreAsciiCase( GetXMLToken( XML_DOCUMENT ) ) )
+ {
+ *pLocation = GetXMLToken( XML_DOCUMENT );
+ }
+ else
+ {
+ *pLocation = GetXMLToken( XML_APPLICATION );
+ }
+ }
+ } while ( params >= 0 );
+
+ if ( aLanguage.equalsIgnoreAsciiCaseAscii( "basic" ) )
+ {
+ return sal_True;
+ }
+ return sal_False;
+}
+
+bool ParseURL(
+ const OUString& rAttrValue,
+ OUString* pName, OUString* pLocation )
+{
+#ifdef OASIS_FILTER_OOO_1X
+ return ParseURLAsString( rAttrValue, pName, pLocation );
+#else
+ Reference< com::sun::star::lang::XMultiServiceFactory >
+ xSMgr = ::comphelper::getProcessServiceFactory();
+
+ Reference< com::sun::star::uri::XUriReferenceFactory >
+ xFactory( xSMgr->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.uri.UriReferenceFactory" )) ), UNO_QUERY );
+
+ if ( xFactory.is() )
+ {
+ Reference< com::sun::star::uri::XVndSunStarScriptUrl > xUrl (
+ xFactory->parse( rAttrValue ), UNO_QUERY );
+
+ if ( xUrl.is() )
+ {
+ OUString aLanguageKey = GetXMLToken( XML_LANGUAGE );
+ if ( xUrl.is() && xUrl->hasParameter( aLanguageKey ) )
+ {
+ OUString aLanguage = xUrl->getParameter( aLanguageKey );
+
+ if ( aLanguage.equalsIgnoreAsciiCaseAscii( "basic" ) )
+ {
+ *pName = xUrl->getName();
+
+ OUString tmp =
+ xUrl->getParameter( GetXMLToken( XML_LOCATION ) );
+
+ OUString doc = GetXMLToken( XML_DOCUMENT );
+
+ if ( tmp.equalsIgnoreAsciiCase( doc ) )
+ {
+ *pLocation = doc;
+ }
+ else
+ {
+ *pLocation = GetXMLToken( XML_APPLICATION );
+ }
+ return sal_True;
+ }
+ }
+ }
+ return sal_False;
+ }
+ else
+ {
+ return ParseURLAsString( rAttrValue, pName, pLocation );
+ }
+#endif
+}
+
+void XMLEventOASISTransformerContext::StartElement(
+ const Reference< XAttributeList >& rAttrList )
+{
+ OSL_TRACE("XMLEventOASISTransformerContext::StartElement");
+
+ XMLTransformerActions *pActions =
+ GetTransformer().GetUserDefinedActions( OASIS_EVENT_ACTIONS );
+ OSL_ENSURE( pActions, "go no actions" );
+
+ Reference< XAttributeList > xAttrList( rAttrList );
+ XMLMutableAttributeList *pMutableAttrList = 0;
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ XMLTransformerActions::key_type aKey( nPrefix, aLocalName );
+ XMLTransformerActions::const_iterator aIter =
+ pActions->find( aKey );
+ if( !(aIter == pActions->end() ) )
+ {
+ if( !pMutableAttrList )
+ {
+ pMutableAttrList =
+ new XMLMutableAttributeList( xAttrList );
+ xAttrList = pMutableAttrList;
+ }
+ const OUString& rAttrValue = xAttrList->getValueByIndex( i );
+ switch( (*aIter).second.m_nActionType )
+ {
+ case XML_ATACTION_HREF:
+ {
+ OUString aAttrValue( rAttrValue );
+ OUString aName, aLocation;
+
+ bool bNeedsTransform =
+ ParseURL( rAttrValue, &aName, &aLocation );
+
+ if ( bNeedsTransform )
+ {
+ pMutableAttrList->RemoveAttributeByIndex( i );
+
+ OUString aAttrQName(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_SCRIPT,
+ ::xmloff::token::GetXMLToken( XML_MACRO_NAME ) ) );
+
+ pMutableAttrList->AddAttribute( aAttrQName, aName );
+
+ sal_Int16 idx = pMutableAttrList->GetIndexByName(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_SCRIPT,
+ GetXMLToken( XML_LANGUAGE ) ) );
+
+ pMutableAttrList->SetValueByIndex( idx,
+ OUString(RTL_CONSTASCII_USTRINGPARAM("StarBasic")) );
+
+ OUString aLocQName(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_SCRIPT,
+ GetXMLToken( XML_LOCATION ) ) );
+
+ pMutableAttrList->AddAttribute( aLocQName, aLocation );
+ }
+ }
+ break;
+ case XML_ATACTION_EVENT_NAME:
+ {
+ // Check if the event belongs to a form or control by
+ // cehcking the 2nd ancestor element, f.i.:
+ // <form:button><form:event-listeners><form:event-listener>
+ const XMLTransformerContext *pObjContext =
+ GetTransformer().GetAncestorContext( 1 );
+ sal_Bool bForm = pObjContext &&
+
+ pObjContext->HasNamespace(XML_NAMESPACE_FORM );
+ pMutableAttrList->SetValueByIndex( i,
+ GetTransformer().GetEventName( rAttrValue,
+ bForm ) );
+ }
+ break;
+ case XML_ATACTION_REMOVE_NAMESPACE_PREFIX:
+ {
+ OUString aAttrValue( rAttrValue );
+ sal_uInt16 nValPrefix =
+ static_cast<sal_uInt16>((*aIter).second.m_nParam1);
+ if( GetTransformer().RemoveNamespacePrefix(
+ aAttrValue, nValPrefix ) )
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_MACRO_NAME:
+ {
+ OUString aName, aLocation;
+ bool bNeedsTransform =
+ ParseURL( rAttrValue, &aName, &aLocation );
+
+ if ( bNeedsTransform )
+ {
+ pMutableAttrList->SetValueByIndex( i, aName );
+
+ sal_Int16 idx = pMutableAttrList->GetIndexByName(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_SCRIPT,
+ GetXMLToken( XML_LANGUAGE ) ) );
+
+ pMutableAttrList->SetValueByIndex( idx,
+ OUString(RTL_CONSTASCII_USTRINGPARAM("StarBasic")) );
+
+ OUString aLocQName(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_SCRIPT,
+ GetXMLToken( XML_LOCATION ) ) );
+
+ pMutableAttrList->AddAttribute( aLocQName, aLocation );
+ }
+ else
+ {
+ const OUString& rApp = GetXMLToken( XML_APPLICATION );
+ const OUString& rDoc = GetXMLToken( XML_DOCUMENT );
+ OUString aAttrValue;
+ if( rAttrValue.getLength() > rApp.getLength()+1 &&
+ rAttrValue.copy(0,rApp.getLength()).
+ equalsIgnoreAsciiCase( rApp ) &&
+ ':' == rAttrValue[rApp.getLength()] )
+ {
+ aLocation = rApp;
+ aAttrValue = rAttrValue.copy( rApp.getLength()+1 );
+ }
+ else if( rAttrValue.getLength() > rDoc.getLength()+1 &&
+ rAttrValue.copy(0,rDoc.getLength()).
+ equalsIgnoreAsciiCase( rDoc ) &&
+ ':' == rAttrValue[rDoc.getLength()] )
+ {
+ aLocation= rDoc;
+ aAttrValue = rAttrValue.copy( rDoc.getLength()+1 );
+ }
+ if( aAttrValue.getLength() )
+ pMutableAttrList->SetValueByIndex( i,
+ aAttrValue );
+ if( aLocation.getLength() )
+ {
+ OUString aAttrQName( GetTransformer().GetNamespaceMap().
+ GetQNameByKey( XML_NAMESPACE_SCRIPT,
+ ::xmloff::token::GetXMLToken( XML_LOCATION ) ) );
+ pMutableAttrList->AddAttribute( aAttrQName, aLocation );
+ // draw bug
+ aAttrQName = GetTransformer().GetNamespaceMap().
+ GetQNameByKey( XML_NAMESPACE_SCRIPT,
+ ::xmloff::token::GetXMLToken( XML_LIBRARY ) );
+ pMutableAttrList->AddAttribute( aAttrQName, aLocation );
+ }
+ }
+ }
+ break;
+ case XML_ATACTION_COPY:
+ break;
+ default:
+ OSL_ENSURE( !this, "unknown action" );
+ break;
+ }
+ }
+ }
+
+ XMLRenameElemTransformerContext::StartElement( xAttrList );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/EventOASISTContext.hxx b/xmloff/source/transform/EventOASISTContext.hxx
new file mode 100644
index 000000000000..07b0c6c08c79
--- /dev/null
+++ b/xmloff/source/transform/EventOASISTContext.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_EVENTOASISTCONTEXT_HXX
+#define _XMLOFF_EVENTOASISTCONTEXT_HXX
+
+#include "RenameElemTContext.hxx"
+
+class XMLTransformerOASISEventMap_Impl;
+
+class XMLEventOASISTransformerContext : public XMLRenameElemTransformerContext
+{
+public:
+ TYPEINFO();
+
+ XMLEventOASISTransformerContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName );
+ virtual ~XMLEventOASISTransformerContext();
+
+ static XMLTransformerOASISEventMap_Impl *CreateFormEventMap();
+ static XMLTransformerOASISEventMap_Impl *CreateEventMap();
+ static void FlushEventMap( XMLTransformerOASISEventMap_Impl *p );
+ static ::rtl::OUString GetEventName( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rName,
+ XMLTransformerOASISEventMap_Impl& rMap,
+ XMLTransformerOASISEventMap_Impl* pMap2 );
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+};
+
+#endif // _XMLOFF_EVENTOASISTCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/EventOOoTContext.cxx b/xmloff/source/transform/EventOOoTContext.cxx
new file mode 100644
index 000000000000..6c0a52386f1d
--- /dev/null
+++ b/xmloff/source/transform/EventOOoTContext.cxx
@@ -0,0 +1,265 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "EventOOoTContext.hxx"
+#include "EventMap.hxx"
+#include "MutableAttrList.hxx"
+#include "xmloff/xmlnmspe.hxx"
+#include "ActionMapTypesOOo.hxx"
+#include "AttrTransformerAction.hxx"
+#include "TransformerActions.hxx"
+#include "TransformerBase.hxx"
+#include <comphelper/stl_types.hxx>
+#include <rtl/ustrbuf.hxx>
+
+#include <boost/unordered_map.hpp>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::xmloff::token;
+
+class XMLTransformerOOoEventMap_Impl:
+ public ::boost::unordered_map< ::rtl::OUString, NameKey_Impl,
+ ::rtl::OUStringHash, ::comphelper::UStringEqual >
+{
+public:
+
+ void AddMap( XMLTransformerEventMapEntry *pInit );
+
+ XMLTransformerOOoEventMap_Impl( XMLTransformerEventMapEntry *pInit,
+ XMLTransformerEventMapEntry *pInit2 );
+ ~XMLTransformerOOoEventMap_Impl();
+};
+
+void XMLTransformerOOoEventMap_Impl::AddMap( XMLTransformerEventMapEntry *pInit )
+{
+ XMLTransformerOOoEventMap_Impl::key_type aKey;
+ XMLTransformerOOoEventMap_Impl::mapped_type aData;
+ while( pInit->m_pOOoName )
+ {
+ aKey = OUString::createFromAscii(pInit->m_pOOoName);
+
+ OSL_ENSURE( find( aKey ) == end(), "duplicate event map entry" );
+
+ aData.m_nPrefix = pInit->m_nOASISPrefix;
+ aData.m_aLocalName = OUString::createFromAscii(pInit->m_pOASISName);
+
+ XMLTransformerOOoEventMap_Impl::value_type aVal( aKey, aData );
+
+ if( !insert( aVal ).second )
+ {
+ OSL_FAIL( "duplicate OOo event name extry" );
+ }
+
+ ++pInit;
+ }
+}
+
+XMLTransformerOOoEventMap_Impl::XMLTransformerOOoEventMap_Impl(
+ XMLTransformerEventMapEntry *pInit,
+ XMLTransformerEventMapEntry *pInit2 )
+{
+ if( pInit )
+ AddMap( pInit );
+ if( pInit )
+ AddMap( pInit2 );
+}
+
+XMLTransformerOOoEventMap_Impl::~XMLTransformerOOoEventMap_Impl()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+TYPEINIT1( XMLEventOOoTransformerContext, XMLPersElemContentTContext );
+
+XMLEventOOoTransformerContext::XMLEventOOoTransformerContext(
+ XMLTransformerBase& rImp,
+ const OUString& rQName,
+ sal_Bool bPersistent ) :
+ XMLPersElemContentTContext( rImp, rQName,
+ rImp.GetNamespaceMap().GetKeyByAttrName( rQName ), XML_EVENT_LISTENER ),
+ m_bPersistent( bPersistent )
+{
+}
+
+XMLEventOOoTransformerContext::~XMLEventOOoTransformerContext()
+{
+}
+
+XMLTransformerOOoEventMap_Impl
+ *XMLEventOOoTransformerContext::CreateEventMap()
+{
+ return new XMLTransformerOOoEventMap_Impl( aTransformerEventMap,
+ aFormTransformerEventMap );
+}
+
+void XMLEventOOoTransformerContext::FlushEventMap(
+ XMLTransformerOOoEventMap_Impl *p )
+{
+ delete p;
+}
+
+sal_uInt16 XMLEventOOoTransformerContext::GetEventName(
+ const OUString& rName,
+ OUString& rNewName,
+ XMLTransformerOOoEventMap_Impl& rMap )
+{
+ XMLTransformerOOoEventMap_Impl::key_type aKey( rName );
+ XMLTransformerOOoEventMap_Impl::const_iterator aIter = rMap.find( aKey );
+ if( aIter == rMap.end() )
+ {
+ rNewName = rName;
+ return XML_NAMESPACE_UNKNOWN;
+ }
+ else
+ {
+ rNewName = (*aIter).second.m_aLocalName;
+ return (*aIter).second.m_nPrefix;
+ }
+}
+
+
+void XMLEventOOoTransformerContext::StartElement(
+ const Reference< XAttributeList >& rAttrList )
+{
+ XMLTransformerActions *pActions =
+ GetTransformer().GetUserDefinedActions( OOO_EVENT_ACTIONS );
+ OSL_ENSURE( pActions, "go no actions" );
+
+ OUString aLocation, aMacroName;
+ sal_Int16 nMacroName = -1;
+ Reference< XAttributeList > xAttrList( rAttrList );
+ XMLMutableAttributeList *pMutableAttrList = 0;
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ XMLTransformerActions::key_type aKey( nPrefix, aLocalName );
+ XMLTransformerActions::const_iterator aIter =
+ pActions->find( aKey );
+ if( !(aIter == pActions->end() ) )
+ {
+ if( !pMutableAttrList )
+ {
+ pMutableAttrList =
+ new XMLMutableAttributeList( xAttrList );
+ xAttrList = pMutableAttrList;
+ }
+ const OUString& rAttrValue = xAttrList->getValueByIndex( i );
+ switch( (*aIter).second.m_nActionType )
+ {
+ case XML_ATACTION_HREF:
+ // TODO
+ break;
+ case XML_ATACTION_EVENT_NAME:
+ pMutableAttrList->SetValueByIndex( i,
+ GetTransformer().GetEventName( rAttrValue ) );
+ break;
+ case XML_ATACTION_ADD_NAMESPACE_PREFIX:
+ {
+ OUString aAttrValue( rAttrValue );
+ sal_uInt16 nValPrefix =
+ static_cast<sal_uInt16>((*aIter).second.m_nParam1);
+ if( GetTransformer().AddNamespacePrefix( aAttrValue,
+ nValPrefix ) )
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_MACRO_LOCATION:
+ aLocation = rAttrValue;
+ pMutableAttrList->RemoveAttributeByIndex( i );
+ --i;
+ --nAttrCount;
+ break;
+ case XML_ATACTION_MACRO_NAME:
+ aMacroName = rAttrValue;
+ nMacroName = i;
+ break;
+ case XML_ATACTION_COPY:
+ break;
+ default:
+ OSL_ENSURE( !this, "unknown action" );
+ break;
+ }
+ }
+ }
+
+ if( nMacroName != -1 && aLocation.getLength() > 0 )
+ {
+ if( !IsXMLToken( aLocation, XML_APPLICATION ) )
+ aLocation = GetXMLToken( XML_DOCUMENT );
+ OUStringBuffer sTmp( aLocation.getLength() + aMacroName.getLength() + 1 );
+ sTmp = aLocation;
+ sTmp.append( sal_Unicode( ':' ) );
+ sTmp.append( aMacroName );
+ pMutableAttrList->SetValueByIndex( nMacroName,
+ sTmp.makeStringAndClear() );
+ }
+
+ if( m_bPersistent )
+ XMLPersElemContentTContext::StartElement( xAttrList );
+ else
+ GetTransformer().GetDocHandler()->startElement( GetExportQName(),
+ xAttrList );
+}
+
+void XMLEventOOoTransformerContext::EndElement()
+{
+ if( m_bPersistent )
+ XMLPersElemContentTContext::EndElement();
+ else
+ GetTransformer().GetDocHandler()->endElement( GetExportQName() );
+}
+
+XMLTransformerContext * XMLEventOOoTransformerContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const OUString& rQName,
+ const Reference< XAttributeList >& xAttrList )
+{
+ if( m_bPersistent )
+ return XMLPersElemContentTContext::CreateChildContext(nPrefix, rLocalName, rQName, xAttrList);
+ else
+ return XMLTransformerContext::CreateChildContext(nPrefix, rLocalName, rQName, xAttrList);
+}
+
+sal_Bool XMLEventOOoTransformerContext::IsPersistent() const
+{
+ return m_bPersistent;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/EventOOoTContext.hxx b/xmloff/source/transform/EventOOoTContext.hxx
new file mode 100644
index 000000000000..32519239c1b3
--- /dev/null
+++ b/xmloff/source/transform/EventOOoTContext.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_EVENTOOOTCONTEXT_HXX
+#define _XMLOFF_EVENTOOOTCONTEXT_HXX
+
+#include "DeepTContext.hxx"
+
+class XMLTransformerOOoEventMap_Impl;
+
+class XMLEventOOoTransformerContext : public XMLPersElemContentTContext
+{
+ sal_Bool m_bPersistent;
+
+public:
+ TYPEINFO();
+
+ XMLEventOOoTransformerContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName,
+ sal_Bool bPersistent = sal_False );
+ virtual ~XMLEventOOoTransformerContext();
+
+ static XMLTransformerOOoEventMap_Impl *CreateEventMap();
+ static void FlushEventMap( XMLTransformerOOoEventMap_Impl *p );
+ static sal_uInt16 GetEventName( const ::rtl::OUString& rName,
+ ::rtl::OUString& rNewName,
+ XMLTransformerOOoEventMap_Impl& rMap );
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+ virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::rtl::OUString& rQName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual sal_Bool IsPersistent() const;
+};
+
+#endif // _XMLOFF_EVENTOOOTCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/FamilyType.hxx b/xmloff/source/transform/FamilyType.hxx
new file mode 100644
index 000000000000..656a17a679f2
--- /dev/null
+++ b/xmloff/source/transform/FamilyType.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_FAMILYTYPE_HXX
+#define _XMLOFF_FAMILYTYPE_HXX
+
+enum XMLFamilyType
+{
+ XML_FAMILY_TYPE_GRAPHIC,
+ XML_FAMILY_TYPE_PRESENTATION,
+ XML_FAMILY_TYPE_DRAWING_PAGE,
+ XML_FAMILY_TYPE_MASTER_PAGE,
+ XML_FAMILY_TYPE_PAGE_LAYOUT,
+ XML_FAMILY_TYPE_HEADER_FOOTER,
+ XML_FAMILY_TYPE_TEXT,
+ XML_FAMILY_TYPE_PARAGRAPH,
+ XML_FAMILY_TYPE_RUBY,
+ XML_FAMILY_TYPE_SECTION,
+ XML_FAMILY_TYPE_TABLE,
+ XML_FAMILY_TYPE_TABLE_COLUMN,
+ XML_FAMILY_TYPE_TABLE_ROW,
+ XML_FAMILY_TYPE_TABLE_CELL,
+ XML_FAMILY_TYPE_LIST,
+ XML_FAMILY_TYPE_CHART,
+ XML_FAMILY_TYPE_DATA,
+ XML_FAMILY_TYPE_GRADIENT,
+ XML_FAMILY_TYPE_HATCH,
+ XML_FAMILY_TYPE_FILL_IMAGE,
+ XML_FAMILY_TYPE_STROKE_DASH,
+ XML_FAMILY_TYPE_MARKER,
+ XML_FAMILY_TYPE_PRESENTATION_PAGE_LAYOUT,
+ XML_FAMILY_TYPE_END
+};
+
+#endif // _XMLOFF_FAMILYTYPE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/FlatTContext.cxx b/xmloff/source/transform/FlatTContext.cxx
new file mode 100644
index 000000000000..bc43939593cf
--- /dev/null
+++ b/xmloff/source/transform/FlatTContext.cxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "FlatTContext.hxx"
+#include "TransformerBase.hxx"
+
+using ::rtl::OUString;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+
+TYPEINIT1( XMLPersTextContentTContext, XMLPersAttrListTContext );
+
+XMLPersTextContentTContext::XMLPersTextContentTContext(
+ XMLTransformerBase& rImp,
+ const OUString& rQName ) :
+ XMLPersAttrListTContext( rImp, rQName )
+{
+}
+
+XMLPersTextContentTContext::XMLPersTextContentTContext(
+ XMLTransformerBase& rImp,
+ const OUString& rQName,
+ sal_uInt16 nPrefix,
+ ::xmloff::token::XMLTokenEnum eToken ) :
+ XMLPersAttrListTContext( rImp, rQName, nPrefix, eToken )
+{
+}
+
+XMLPersTextContentTContext::~XMLPersTextContentTContext()
+{
+}
+
+void XMLPersTextContentTContext::Characters( const OUString& rChars )
+{
+ m_aCharacters += rChars;
+}
+
+void XMLPersTextContentTContext::ExportContent()
+{
+ GetTransformer().GetDocHandler()->characters( m_aCharacters );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/FlatTContext.hxx b/xmloff/source/transform/FlatTContext.hxx
new file mode 100644
index 000000000000..d76d66f5080a
--- /dev/null
+++ b/xmloff/source/transform/FlatTContext.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_FLATTCONTEXT_HXX
+#define _XMLOFF_FLATTCONTEXT_HXX
+
+#include "PersAttrListTContext.hxx"
+
+
+class XMLPersTextContentTContext : public XMLPersAttrListTContext
+{
+ ::rtl::OUString m_aCharacters;
+
+public:
+ TYPEINFO();
+
+ // A contexts constructor does anything that is required if an element
+ // starts. Namespace processing has been done already.
+ // Note that virtual methods cannot be used inside constructors. Use
+ // StartElement instead if this is required.
+ XMLPersTextContentTContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName );
+
+ // attr list/text content persistence + renaming
+ XMLPersTextContentTContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName,
+ sal_uInt16 nPrefix,
+ ::xmloff::token::XMLTokenEnum eToken );
+
+ // A contexts destructor does anything that is required if an element
+ // ends. By default, nothing is done.
+ // Note that virtual methods cannot be used inside destructors. Use
+ // EndElement instead if this is required.
+ virtual ~XMLPersTextContentTContext();
+
+ // This method is called for all characters that are contained in the
+ // current element.
+ virtual void Characters( const ::rtl::OUString& rChars );
+
+ virtual void ExportContent();
+
+ const ::rtl::OUString& GetTextContent() const { return m_aCharacters; }
+};
+
+#endif // _XMLOFF_FLATTCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/FormPropOASISTContext.cxx b/xmloff/source/transform/FormPropOASISTContext.cxx
new file mode 100644
index 000000000000..61fc64be617b
--- /dev/null
+++ b/xmloff/source/transform/FormPropOASISTContext.cxx
@@ -0,0 +1,226 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "MutableAttrList.hxx"
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include "ActionMapTypesOASIS.hxx"
+#include "AttrTransformerAction.hxx"
+#include "TransformerActions.hxx"
+#include "TransformerBase.hxx"
+#include "FormPropOASISTContext.hxx"
+
+using ::rtl::OUString;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::xmloff::token;
+
+TYPEINIT1( XMLFormPropOASISTransformerContext,
+ XMLRenameElemTransformerContext );
+
+XMLTokenEnum XMLFormPropOASISTransformerContext::GetValueType(
+ const OUString& rValue )
+{
+ XMLTokenEnum eRet = XML_DOUBLE;
+ sal_Bool bNeg = sal_False;
+ sal_uInt32 nVal = 0;
+
+ sal_Int32 nPos = 0;
+ sal_Int32 nLen = rValue.getLength();
+
+ // skip white space
+ while( nPos < nLen && sal_Unicode(' ') == rValue[nPos] )
+ nPos++;
+
+ if( nPos < nLen && sal_Unicode('-') == rValue[nPos] )
+ {
+ bNeg = sal_True;
+ nPos++;
+ }
+
+ // get number
+ sal_Bool bOverflow = sal_False;
+ while( nPos < nLen &&
+ sal_Unicode('0') <= rValue[nPos] &&
+ sal_Unicode('9') >= rValue[nPos] )
+ {
+ nVal *= 10;
+ nVal += (rValue[nPos] - sal_Unicode('0'));
+ bOverflow |= (nVal > (bNeg ? 2147483648UL : 2147483647UL));
+ nPos++;
+ }
+
+ // skip white space
+ while( nPos < nLen && sal_Unicode(' ') == rValue[nPos] )
+ nPos++;
+
+ if( nPos == nLen )
+ {
+ // It's a integer number
+ if( bOverflow )
+ eRet = XML_LONG;
+ else if( nVal > (bNeg ? 32768UL : 32767UL) )
+ eRet = XML_INT;
+ else
+ eRet = XML_SHORT;
+ }
+
+ return eRet;
+}
+
+XMLFormPropOASISTransformerContext::XMLFormPropOASISTransformerContext(
+ XMLTransformerBase& rImp,
+ const OUString& rQName,
+ XMLTokenEnum eLocalName ) :
+ XMLRenameElemTransformerContext( rImp, rQName, XML_NAMESPACE_FORM,
+ XML_PROPERTY ),
+ m_bIsList( XML_LIST_PROPERTY == eLocalName),
+ m_bIsListValue( XML_LIST_VALUE == eLocalName)
+{
+}
+
+XMLFormPropOASISTransformerContext::~XMLFormPropOASISTransformerContext()
+{
+}
+
+void XMLFormPropOASISTransformerContext::StartElement(
+ const Reference< XAttributeList >& rAttrList )
+{
+
+ XMLTransformerActions *pActions =
+ GetTransformer().GetUserDefinedActions( OASIS_FORM_PROP_ACTIONS );
+ OSL_ENSURE( pActions, "go no actions" );
+
+ XMLMutableAttributeList *pMutableAttrList =
+ new XMLMutableAttributeList( rAttrList );
+ Reference< XAttributeList > xAttrList( pMutableAttrList );
+
+ sal_Int16 nValueTypeAttr = -1;
+ OUString aValue;
+ sal_Bool bIsVoid = sal_False;
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ XMLTransformerActions::key_type aKey( nPrefix, aLocalName );
+ XMLTransformerActions::const_iterator aIter =
+ pActions->find( aKey );
+ if( !(aIter == pActions->end() ) )
+ {
+ const OUString& rAttrValue = xAttrList->getValueByIndex( i );
+ switch( (*aIter).second.m_nActionType )
+ {
+ case XML_ATACTION_RENAME:
+ if( IsXMLToken( aLocalName, XML_VALUE_TYPE ) )
+ {
+ if( IsXMLToken( rAttrValue, XML_FLOAT ) )
+ {
+ nValueTypeAttr = i;
+ }
+ else if( IsXMLToken( rAttrValue, XML_VOID ) )
+ {
+ pMutableAttrList->SetValueByIndex( i,
+ GetXMLToken( XML_SHORT ) );
+ bIsVoid = sal_True;
+ }
+ }
+ {
+ OUString aNewAttrQName(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ (*aIter).second.GetQNamePrefixFromParam1(),
+ ::xmloff::token::GetXMLToken(
+ (*aIter).second.GetQNameTokenFromParam1()) ) );
+ pMutableAttrList->RenameAttributeByIndex( i, aNewAttrQName );
+ }
+ break;
+ case XML_ATACTION_REMOVE:
+ if( !IsXMLToken( aLocalName, XML_CURRENCY ) )
+ aValue = rAttrValue;
+ pMutableAttrList->RemoveAttributeByIndex( i );
+ --i;
+ --nAttrCount;
+ break;
+ default:
+ OSL_ENSURE( !this, "unknown action" );
+ break;
+ }
+ }
+ }
+ if( m_bIsList )
+ {
+ OUString aNewAttrQName(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_FORM,
+ GetXMLToken( XML_PROPERTY_IS_LIST ) ) );
+ pMutableAttrList->AddAttribute( aNewAttrQName,
+ GetXMLToken( XML_TRUE ) );
+ }
+
+ if( nValueTypeAttr != -1 )
+ pMutableAttrList->SetValueByIndex( nValueTypeAttr,
+ GetXMLToken( GetValueType( aValue ) ) );
+
+ if( !m_bIsListValue )
+ XMLRenameElemTransformerContext::StartElement( xAttrList );
+ if( !m_bIsList )
+ {
+ pMutableAttrList =
+ new XMLMutableAttributeList;
+ xAttrList = pMutableAttrList;
+ if( bIsVoid )
+ {
+ OUString aNewAttrQName(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_FORM, GetXMLToken( XML_PROPERTY_IS_VOID ) ) );
+ pMutableAttrList->AddAttribute( aNewAttrQName,
+ GetXMLToken( XML_TRUE ) );
+ }
+
+ OUString aValueElemQName(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_FORM, GetXMLToken( XML_PROPERTY_VALUE ) ) );
+ GetTransformer().GetDocHandler()->startElement( aValueElemQName,
+ xAttrList );
+ GetTransformer().GetDocHandler()->characters( aValue );
+ GetTransformer().GetDocHandler()->endElement( aValueElemQName );
+ }
+}
+
+void XMLFormPropOASISTransformerContext::EndElement()
+{
+ if( !m_bIsListValue )
+ XMLRenameElemTransformerContext::EndElement();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/FormPropOASISTContext.hxx b/xmloff/source/transform/FormPropOASISTContext.hxx
new file mode 100644
index 000000000000..d98656557885
--- /dev/null
+++ b/xmloff/source/transform/FormPropOASISTContext.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_FORMPROPOASISTCONTEXT_HXX
+#define _XMLOFF_FORMPROPOASISTCONTEXT_HXX
+
+#include "RenameElemTContext.hxx"
+
+class XMLFormPropOASISTransformerContext :
+ public XMLRenameElemTransformerContext
+{
+ sal_Bool m_bIsList;
+ sal_Bool m_bIsListValue;
+
+ ::xmloff::token::XMLTokenEnum GetValueType( const ::rtl::OUString& rValue );
+
+public:
+ TYPEINFO();
+
+ XMLFormPropOASISTransformerContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName,
+ ::xmloff::token::XMLTokenEnum eLocalName );
+
+ virtual ~XMLFormPropOASISTransformerContext();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+};
+
+#endif // _XMLOFF_FORMPROPOASISTCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/FormPropOOoTContext.cxx b/xmloff/source/transform/FormPropOOoTContext.cxx
new file mode 100644
index 000000000000..f2378090a60e
--- /dev/null
+++ b/xmloff/source/transform/FormPropOOoTContext.cxx
@@ -0,0 +1,313 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "MutableAttrList.hxx"
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include "IgnoreTContext.hxx"
+#include "ActionMapTypesOOo.hxx"
+#include "AttrTransformerAction.hxx"
+#include "TransformerActions.hxx"
+#include "TransformerBase.hxx"
+#include "FormPropOOoTContext.hxx"
+
+using ::rtl::OUString;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::xmloff::token;
+
+class XMLFormPropValueTContext_Impl : public XMLTransformerContext
+{
+ OUString m_aAttrQName;
+ ::rtl::OUString m_aCharacters;
+ sal_Bool m_bPersistent;
+ sal_Bool m_bIsVoid;
+
+public:
+ TYPEINFO();
+
+ // element content persistence only
+ XMLFormPropValueTContext_Impl( XMLTransformerBase& rTransformer,
+ const OUString& rQName );
+ XMLFormPropValueTContext_Impl( XMLTransformerBase& rTransformer,
+ const OUString& rQName,
+ sal_uInt16 nAttrPrefix,
+ XMLTokenEnum eAttrToken );
+
+ virtual ~XMLFormPropValueTContext_Impl();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void EndElement();
+
+ virtual void Characters( const ::rtl::OUString& rChars );
+
+ virtual sal_Bool IsPersistent() const;
+
+ sal_Bool IsVoid() const { return m_bIsVoid; }
+ const ::rtl::OUString& GetTextContent() const { return m_aCharacters; }
+};
+
+TYPEINIT1( XMLFormPropValueTContext_Impl, XMLTransformerContext );
+
+XMLFormPropValueTContext_Impl::XMLFormPropValueTContext_Impl(
+ XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName ) :
+ XMLTransformerContext( rTransformer, rQName ),
+ m_bPersistent( sal_True ),
+ m_bIsVoid( sal_False )
+{
+}
+
+XMLFormPropValueTContext_Impl::XMLFormPropValueTContext_Impl(
+ XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName,
+ sal_uInt16 nAttrPrefix,
+ XMLTokenEnum eAttrToken ) :
+ XMLTransformerContext( rTransformer, rQName ),
+ m_aAttrQName( rTransformer.GetNamespaceMap().GetQNameByKey(
+ nAttrPrefix, GetXMLToken(eAttrToken) ) ),
+ m_bPersistent( sal_True ),
+ m_bIsVoid( sal_False )
+{
+}
+
+XMLFormPropValueTContext_Impl::~XMLFormPropValueTContext_Impl()
+{
+}
+
+void XMLFormPropValueTContext_Impl::StartElement(
+ const Reference< XAttributeList >& rAttrList )
+{
+ sal_Int16 nAttrCount = rAttrList.is() ? rAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = rAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ if( XML_NAMESPACE_FORM == nPrefix &&
+ IsXMLToken( aLocalName, XML_PROPERTY_IS_VOID ) &&
+ IsXMLToken( rAttrList->getValueByIndex( i ), XML_TRUE ) )
+ m_bIsVoid = sal_True;
+ }
+}
+
+void XMLFormPropValueTContext_Impl::EndElement()
+{
+ if( !m_bPersistent )
+ {
+ XMLMutableAttributeList *pMutableAttrList =
+ new XMLMutableAttributeList;
+ Reference< XAttributeList > xAttrList( pMutableAttrList );
+ pMutableAttrList->AddAttribute( m_aAttrQName,
+ m_aCharacters );
+
+ OUString aElemQName( GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_FORM, GetXMLToken(XML_LIST_VALUE) ) );
+ GetTransformer().GetDocHandler()->startElement( aElemQName,
+ xAttrList );
+ GetTransformer().GetDocHandler()->endElement( aElemQName );
+ }
+}
+
+void XMLFormPropValueTContext_Impl::Characters( const OUString& rChars )
+{
+ m_aCharacters += rChars;
+}
+
+
+sal_Bool XMLFormPropValueTContext_Impl::IsPersistent() const
+{
+ return m_bPersistent;
+}
+
+//------------------------------------------------------------------------------
+
+TYPEINIT1( XMLFormPropOOoTransformerContext, XMLTransformerContext );
+
+XMLFormPropOOoTransformerContext::XMLFormPropOOoTransformerContext(
+ XMLTransformerBase& rImp,
+ const OUString& rQName ) :
+ XMLTransformerContext( rImp, rQName ),
+ m_aElemQName( rQName ),
+ m_nValueTypeAttr( -1 ),
+ m_eValueToken( XML_VALUE ),
+ m_eValueTypeToken( XML_TOKEN_END ),
+ m_bIsList( sal_False )
+{
+}
+
+XMLFormPropOOoTransformerContext::~XMLFormPropOOoTransformerContext()
+{
+}
+
+XMLTransformerContext *XMLFormPropOOoTransformerContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const OUString& rQName,
+ const Reference< XAttributeList >& )
+{
+ XMLTransformerContext *pContext = 0;
+
+ if( XML_NAMESPACE_FORM == nPrefix &&
+ IsXMLToken( rLocalName, XML_PROPERTY_VALUE ) )
+ {
+ if( m_bIsList )
+ {
+ pContext = new XMLFormPropValueTContext_Impl( GetTransformer(),
+ rQName,
+ XML_NAMESPACE_OFFICE,
+ m_eValueToken );
+ }
+ else if( !m_xValueContext.is() )
+ {
+ m_xValueContext=
+ new XMLFormPropValueTContext_Impl( GetTransformer(), rQName );
+ pContext = m_xValueContext.get();
+ }
+ }
+
+ // default is ignore
+ if( !pContext )
+ pContext = new XMLIgnoreTransformerContext( GetTransformer(), rQName,
+ sal_True, sal_True );
+ return pContext;
+}
+
+void XMLFormPropOOoTransformerContext::StartElement(
+ const Reference< XAttributeList >& rAttrList )
+{
+
+ XMLTransformerActions *pActions =
+ GetTransformer().GetUserDefinedActions( OOO_FORM_PROP_ACTIONS );
+ OSL_ENSURE( pActions, "go no actions" );
+
+ XMLMutableAttributeList *pMutableAttrList =
+ new XMLMutableAttributeList( rAttrList, sal_True );
+ m_xAttrList = pMutableAttrList;
+
+ OUString aValueType;
+ sal_Int16 nAttrCount = rAttrList.is() ? rAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = rAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ XMLTransformerActions::key_type aKey( nPrefix, aLocalName );
+ XMLTransformerActions::const_iterator aIter =
+ pActions->find( aKey );
+ if( !(aIter == pActions->end() ) )
+ {
+ const OUString& rAttrValue = rAttrList->getValueByIndex( i );
+ switch( (*aIter).second.m_nActionType )
+ {
+ case XML_ATACTION_RENAME:
+ if( IsXMLToken( aLocalName, XML_PROPERTY_TYPE ) )
+ {
+ aValueType = rAttrValue;
+ m_nValueTypeAttr = i;
+ }
+ {
+ OUString aNewAttrQName(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ (*aIter).second.GetQNamePrefixFromParam1(),
+ ::xmloff::token::GetXMLToken(
+ (*aIter).second.GetQNameTokenFromParam1()) ) );
+ pMutableAttrList->RenameAttributeByIndex( i, aNewAttrQName );
+ }
+ break;
+ case XML_ATACTION_REMOVE:
+ if( IsXMLToken( aLocalName, XML_PROPERTY_IS_LIST ) )
+ {
+ m_aElemQName =
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_FORM, GetXMLToken( XML_LIST_PROPERTY ) );
+ m_bIsList = sal_True;
+ }
+ pMutableAttrList->RemoveAttributeByIndex( i );
+ --i;
+ --nAttrCount;
+ break;
+ default:
+ OSL_ENSURE( !this, "unknown action" );
+ break;
+ }
+ }
+ }
+
+ if( aValueType.getLength() )
+ {
+ if( IsXMLToken( aValueType, XML_STRING ) )
+ m_eValueToken = XML_STRING_VALUE;
+ else if( IsXMLToken( aValueType, XML_BOOLEAN ) )
+ m_eValueToken = XML_BOOLEAN_VALUE;
+ else if( IsXMLToken( aValueType, XML_SHORT ) ||
+ IsXMLToken( aValueType, XML_INT ) ||
+ IsXMLToken( aValueType, XML_LONG ) ||
+ IsXMLToken( aValueType, XML_DOUBLE ) )
+ m_eValueTypeToken = XML_FLOAT;
+ }
+}
+
+void XMLFormPropOOoTransformerContext::EndElement()
+{
+ if( m_xValueContext.is() )
+ {
+ if( m_xValueContext->IsVoid() )
+ {
+ m_eValueTypeToken = XML_VOID;
+ }
+ else
+ {
+ OUString aAttrQName(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_OFFICE, GetXMLToken(m_eValueToken) ) );
+ static_cast< XMLMutableAttributeList * >( m_xAttrList.get() )
+ ->AddAttribute( aAttrQName, m_xValueContext->GetTextContent() );
+ }
+ }
+
+ if( m_nValueTypeAttr != -1 && m_eValueTypeToken != XML_TOKEN_END )
+ {
+ static_cast< XMLMutableAttributeList * >( m_xAttrList.get() )
+ ->SetValueByIndex( m_nValueTypeAttr ,
+ GetXMLToken( m_eValueTypeToken ) );
+ }
+
+ GetTransformer().GetDocHandler()->startElement( m_aElemQName,
+ m_xAttrList );
+ GetTransformer().GetDocHandler()->endElement( m_aElemQName );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/FormPropOOoTContext.hxx b/xmloff/source/transform/FormPropOOoTContext.hxx
new file mode 100644
index 000000000000..32b0e4796134
--- /dev/null
+++ b/xmloff/source/transform/FormPropOOoTContext.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_FORMPROPOOOTCONTEXT_HXX
+#define _XMLOFF_FORMPROPOOOTCONTEXT_HXX
+
+#include <rtl/ref.hxx>
+#include "TransformerContext.hxx"
+
+class XMLFormPropValueTContext_Impl;
+
+class XMLFormPropOOoTransformerContext : public XMLTransformerContext
+{
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > m_xAttrList;
+
+ ::rtl::Reference< XMLFormPropValueTContext_Impl > m_xValueContext;
+
+ ::rtl::OUString m_aElemQName;
+
+ sal_Int16 m_nValueTypeAttr;
+
+ ::xmloff::token::XMLTokenEnum m_eValueToken;
+ ::xmloff::token::XMLTokenEnum m_eValueTypeToken;
+
+ sal_Bool m_bIsList;
+
+public:
+ TYPEINFO();
+
+ XMLFormPropOOoTransformerContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName );
+
+ virtual ~XMLFormPropOOoTransformerContext();
+
+ virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::rtl::OUString& rQName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+};
+
+#endif // _XMLOFF_FORMPROPOOOTCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/FrameOASISTContext.cxx b/xmloff/source/transform/FrameOASISTContext.cxx
new file mode 100644
index 000000000000..1fdabe0daf49
--- /dev/null
+++ b/xmloff/source/transform/FrameOASISTContext.cxx
@@ -0,0 +1,201 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "FrameOASISTContext.hxx"
+#include "IgnoreTContext.hxx"
+#include "MutableAttrList.hxx"
+#include "xmloff/xmlnmspe.hxx"
+#include "ActionMapTypesOASIS.hxx"
+#include "ElemTransformerAction.hxx"
+#include "TransformerActions.hxx"
+#include "TransformerBase.hxx"
+
+using ::rtl::OUString;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::xmloff::token;
+
+TYPEINIT1( XMLFrameOASISTransformerContext, XMLTransformerContext );
+
+sal_Bool XMLFrameOASISTransformerContext::IsLinkedEmbeddedObject(
+ const OUString& rLocalName,
+ const Reference< XAttributeList >& rAttrList )
+{
+ if( !(IsXMLToken( rLocalName, XML_OBJECT ) ||
+ IsXMLToken( rLocalName, XML_OBJECT_OLE) ) )
+ return sal_False;
+
+ sal_Int16 nAttrCount = rAttrList.is() ? rAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ OUString aAttrName( rAttrList->getNameByIndex( i ) );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetTransformer().GetNamespaceMap().GetKeyByAttrName( aAttrName,
+ &aLocalName );
+ if( XML_NAMESPACE_XLINK == nPrefix &&
+ IsXMLToken( aLocalName, XML_HREF ) )
+ {
+ OUString sHRef( rAttrList->getValueByIndex( i ) );
+ if (sHRef.getLength() == 0)
+ {
+ // When the href is empty then the object is not linked but
+ // a placeholder.
+ return sal_False;
+ }
+ GetTransformer().ConvertURIToOOo( sHRef, sal_True );
+ return !(sHRef.getLength() && '#'==sHRef[0]);
+ }
+ }
+
+ return sal_False;
+}
+
+
+XMLFrameOASISTransformerContext::XMLFrameOASISTransformerContext(
+ XMLTransformerBase& rImp,
+ const OUString& rQName ) :
+ XMLTransformerContext( rImp, rQName ),
+ m_bIgnoreElement( false )
+{
+}
+
+XMLFrameOASISTransformerContext::~XMLFrameOASISTransformerContext()
+{
+}
+
+void XMLFrameOASISTransformerContext::StartElement(
+ const Reference< XAttributeList >& rAttrList )
+{
+ m_xAttrList = new XMLMutableAttributeList( rAttrList, sal_True );
+
+ sal_Int16 nAttrCount = rAttrList.is() ? rAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = rAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName );
+
+ if( (nPrefix == XML_NAMESPACE_PRESENTATION) && IsXMLToken( aLocalName, XML_CLASS ) )
+ {
+ const OUString& rAttrValue = rAttrList->getValueByIndex( i );
+ if( IsXMLToken( rAttrValue, XML_HEADER ) || IsXMLToken( rAttrValue, XML_FOOTER ) ||
+ IsXMLToken( rAttrValue, XML_PAGE_NUMBER ) || IsXMLToken( rAttrValue, XML_DATE_TIME ) )
+ {
+ m_bIgnoreElement = true;
+ break;
+ }
+ }
+ }
+}
+
+XMLTransformerContext *XMLFrameOASISTransformerContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const OUString& rQName,
+ const Reference< XAttributeList >& rAttrList )
+{
+ XMLTransformerContext *pContext = 0;
+
+ if( m_bIgnoreElement )
+ {
+ // do not export the frame element and all of its children
+ pContext = new XMLIgnoreTransformerContext( GetTransformer(),
+ rQName,
+ sal_True, sal_True );
+ }
+ else
+ {
+ XMLTransformerActions *pActions =
+ GetTransformer().GetUserDefinedActions( OASIS_FRAME_ELEM_ACTIONS );
+ OSL_ENSURE( pActions, "go no actions" );
+ XMLTransformerActions::key_type aKey( nPrefix, rLocalName );
+ XMLTransformerActions::const_iterator aIter = pActions->find( aKey );
+
+ if( !(aIter == pActions->end()) )
+ {
+ switch( (*aIter).second.m_nActionType )
+ {
+ case XML_ETACTION_COPY:
+ if( !m_aElemQName.getLength() &&
+ !IsLinkedEmbeddedObject( rLocalName, rAttrList ) )
+ {
+ pContext = new XMLIgnoreTransformerContext( GetTransformer(),
+ rQName,
+ sal_False, sal_False );
+ m_aElemQName = rQName;
+ static_cast< XMLMutableAttributeList * >( m_xAttrList.get() )
+ ->AppendAttributeList( rAttrList );
+ GetTransformer().ProcessAttrList( m_xAttrList,
+ OASIS_SHAPE_ACTIONS,
+ sal_False );
+ GetTransformer().GetDocHandler()->startElement( m_aElemQName,
+ m_xAttrList );
+ }
+ else
+ {
+ pContext = new XMLIgnoreTransformerContext( GetTransformer(),
+ rQName,
+ sal_True, sal_True );
+ }
+ break;
+ default:
+ OSL_ENSURE( !this, "unknown action" );
+ break;
+ }
+ }
+ }
+
+ // default is copying
+ if( !pContext )
+ pContext = XMLTransformerContext::CreateChildContext( nPrefix,
+ rLocalName,
+ rQName,
+ rAttrList );
+
+ return pContext;
+}
+
+void XMLFrameOASISTransformerContext::EndElement()
+{
+ if( !m_bIgnoreElement )
+ GetTransformer().GetDocHandler()->endElement( m_aElemQName );
+}
+
+void XMLFrameOASISTransformerContext::Characters( const OUString& rChars )
+{
+ // ignore
+ if( m_aElemQName.getLength() && !m_bIgnoreElement )
+ XMLTransformerContext::Characters( rChars );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/FrameOASISTContext.hxx b/xmloff/source/transform/FrameOASISTContext.hxx
new file mode 100644
index 000000000000..2f43907ea834
--- /dev/null
+++ b/xmloff/source/transform/FrameOASISTContext.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_FRAMEOASISTCONTEXT_HXX
+#define _XMLOFF_FRAMEOASISTCONTEXT_HXX
+
+#include "TransformerContext.hxx"
+
+class XMLFrameOASISTransformerContext : public XMLTransformerContext
+{
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > m_xAttrList;
+
+ ::rtl::OUString m_aElemQName;
+
+ bool m_bIgnoreElement;
+
+ sal_Bool IsLinkedEmbeddedObject(
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList >& rAttrList );
+
+public:
+ TYPEINFO();
+
+ XMLFrameOASISTransformerContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName );
+
+ virtual ~XMLFrameOASISTransformerContext();
+
+ virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::rtl::OUString& rQName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void EndElement();
+
+ virtual void Characters( const ::rtl::OUString& rChars );
+};
+
+#endif // _XMLOFF_FRAMEOASISTCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/FrameOOoTContext.cxx b/xmloff/source/transform/FrameOOoTContext.cxx
new file mode 100644
index 000000000000..0ff6f95af3ea
--- /dev/null
+++ b/xmloff/source/transform/FrameOOoTContext.cxx
@@ -0,0 +1,175 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "FrameOOoTContext.hxx"
+#include "IgnoreTContext.hxx"
+#include "MutableAttrList.hxx"
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include "ActionMapTypesOOo.hxx"
+#include "AttrTransformerAction.hxx"
+#include "ElemTransformerAction.hxx"
+#include "TransformerActions.hxx"
+#include "TransformerBase.hxx"
+
+using ::rtl::OUString;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::xmloff::token;
+
+TYPEINIT1( XMLFrameOOoTransformerContext, XMLPersElemContentTContext );
+
+XMLFrameOOoTransformerContext::XMLFrameOOoTransformerContext(
+ XMLTransformerBase& rImp,
+ const OUString& rQName ) :
+ XMLPersElemContentTContext( rImp, rQName ),
+ m_aElemQName( rImp.GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_DRAW,
+ ::xmloff::token::GetXMLToken( XML_FRAME ) ) )
+{
+}
+
+XMLFrameOOoTransformerContext::~XMLFrameOOoTransformerContext()
+{
+}
+
+void XMLFrameOOoTransformerContext::StartElement(
+ const Reference< XAttributeList >& rAttrList )
+{
+
+ XMLTransformerActions *pActions =
+ GetTransformer().GetUserDefinedActions( OOO_FRAME_ATTR_ACTIONS );
+ OSL_ENSURE( pActions, "go no actions" );
+
+ Reference< XAttributeList > xAttrList( rAttrList );
+ XMLMutableAttributeList *pMutableAttrList =
+ GetTransformer().ProcessAttrList( xAttrList, OOO_SHAPE_ACTIONS,
+ sal_True );
+ if( !pMutableAttrList )
+ pMutableAttrList = new XMLMutableAttributeList( rAttrList );
+ xAttrList = pMutableAttrList;
+
+ XMLMutableAttributeList *pFrameMutableAttrList =
+ new XMLMutableAttributeList;
+ Reference< XAttributeList > xFrameAttrList( pFrameMutableAttrList );
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ XMLTransformerActions::key_type aKey( nPrefix, aLocalName );
+ XMLTransformerActions::const_iterator aIter =
+ pActions->find( aKey );
+ if( !(aIter == pActions->end() ) )
+ {
+ const OUString& rAttrValue = xAttrList->getValueByIndex( i );
+ switch( (*aIter).second.m_nActionType )
+ {
+ case XML_ATACTION_MOVE_TO_ELEM:
+ pFrameMutableAttrList->AddAttribute( rAttrName, rAttrValue );
+ pMutableAttrList->RemoveAttributeByIndex( i );
+ --i;
+ --nAttrCount;
+ break;
+ default:
+ OSL_ENSURE( !this, "unknown action" );
+ break;
+ }
+ }
+ }
+
+ GetTransformer().GetDocHandler()->startElement( m_aElemQName,
+ xFrameAttrList );
+ XMLTransformerContext::StartElement( xAttrList );
+}
+
+XMLTransformerContext *XMLFrameOOoTransformerContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const OUString& rQName,
+ const Reference< XAttributeList >& rAttrList )
+{
+ XMLTransformerContext *pContext = 0;
+
+ XMLTransformerActions *pActions =
+ GetTransformer().GetUserDefinedActions( OOO_FRAME_ELEM_ACTIONS );
+ OSL_ENSURE( pActions, "go no actions" );
+ XMLTransformerActions::key_type aKey( nPrefix, rLocalName );
+ XMLTransformerActions::const_iterator aIter = pActions->find( aKey );
+
+ if( !(aIter == pActions->end()) )
+ {
+ switch( (*aIter).second.m_nActionType )
+ {
+ case XML_ETACTION_COPY:
+ case XML_ETACTION_COPY_TEXT:
+ case XML_ETACTION_RENAME_ELEM:
+ // the ones in the list have to be persistent
+
+ pContext = XMLPersElemContentTContext::CreateChildContext(
+ nPrefix, rLocalName, rQName, rAttrList );
+ break;
+ default:
+ OSL_ENSURE( !this, "unknown action" );
+ break;
+ }
+ }
+
+ // default is copying
+ if( !pContext )
+ pContext = XMLTransformerContext::CreateChildContext(
+ nPrefix, rLocalName, rQName, rAttrList );
+
+ return pContext;
+}
+
+void XMLFrameOOoTransformerContext::EndElement()
+{
+ XMLTransformerContext::EndElement();
+ ExportContent();
+ GetTransformer().GetDocHandler()->endElement( m_aElemQName );
+}
+
+void XMLFrameOOoTransformerContext::Characters( const OUString& rChars )
+{
+ XMLTransformerContext::Characters( rChars );
+}
+
+sal_Bool XMLFrameOOoTransformerContext::IsPersistent() const
+{
+ // this context stores some of its child elements, but is not persistent
+ // itself.
+ return sal_False;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/FrameOOoTContext.hxx b/xmloff/source/transform/FrameOOoTContext.hxx
new file mode 100644
index 000000000000..4bef27cc0777
--- /dev/null
+++ b/xmloff/source/transform/FrameOOoTContext.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_FRAMEOOOTCONTEXT_HXX
+#define _XMLOFF_FRAMEOOOTCONTEXT_HXX
+
+#include "DeepTContext.hxx"
+
+class XMLFrameOOoTransformerContext : public XMLPersElemContentTContext
+{
+ ::rtl::OUString m_aElemQName;
+
+public:
+ TYPEINFO();
+
+ XMLFrameOOoTransformerContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName );
+
+ virtual ~XMLFrameOOoTransformerContext();
+
+ virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::rtl::OUString& rQName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void EndElement();
+
+ virtual void Characters( const ::rtl::OUString& rChars );
+
+ virtual sal_Bool IsPersistent() const;
+};
+
+#endif // _XMLOFF_FRAMEOOOTCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/IgnoreTContext.cxx b/xmloff/source/transform/IgnoreTContext.cxx
new file mode 100644
index 000000000000..30433bd2cd17
--- /dev/null
+++ b/xmloff/source/transform/IgnoreTContext.cxx
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "IgnoreTContext.hxx"
+#include "TransformerBase.hxx"
+
+using ::rtl::OUString;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+
+TYPEINIT1( XMLIgnoreTransformerContext, XMLTransformerContext );
+
+XMLIgnoreTransformerContext::XMLIgnoreTransformerContext(
+ XMLTransformerBase& rImp,
+ const OUString& rQName,
+ sal_Bool bIgnoreChars,
+ sal_Bool bIgnoreElems ) :
+ XMLTransformerContext( rImp, rQName ),
+ m_bIgnoreCharacters( bIgnoreChars ),
+ m_bIgnoreElements( bIgnoreElems ),
+ m_bRecursiveUse( sal_False )
+{
+}
+
+XMLIgnoreTransformerContext::XMLIgnoreTransformerContext(
+ XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName,
+ sal_Bool bAllowCharactersRecursive ) :
+ XMLTransformerContext( rTransformer, rQName ),
+ m_bIgnoreCharacters( sal_False ),
+ m_bIgnoreElements( sal_False ),
+ m_bAllowCharactersRecursive( bAllowCharactersRecursive ),
+ m_bRecursiveUse( sal_True )
+{
+}
+
+XMLIgnoreTransformerContext::~XMLIgnoreTransformerContext()
+{
+}
+
+XMLTransformerContext *XMLIgnoreTransformerContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const OUString& rQName,
+ const Reference< XAttributeList >& xAttrList )
+{
+ XMLTransformerContext *pContext = 0;
+ if( m_bIgnoreElements )
+ pContext = new XMLIgnoreTransformerContext( GetTransformer(),
+ rQName, sal_True,
+ sal_True );
+ else if (m_bRecursiveUse)
+ pContext = new XMLIgnoreTransformerContext( GetTransformer(),
+ rQName, m_bAllowCharactersRecursive );
+ else
+ pContext = XMLTransformerContext::CreateChildContext(
+ nPrefix, rLocalName, rQName, xAttrList );
+
+ return pContext;
+}
+
+void XMLIgnoreTransformerContext::StartElement( const Reference< XAttributeList >& )
+{
+ // ignore
+}
+
+void XMLIgnoreTransformerContext::EndElement()
+{
+ // ignore
+}
+
+void XMLIgnoreTransformerContext::Characters( const OUString& rChars )
+{
+ if( !m_bIgnoreCharacters )
+ GetTransformer().GetDocHandler()->characters( rChars );
+ else if ( m_bRecursiveUse && m_bAllowCharactersRecursive )
+ GetTransformer().GetDocHandler()->characters( rChars );
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/IgnoreTContext.hxx b/xmloff/source/transform/IgnoreTContext.hxx
new file mode 100644
index 000000000000..45a311c3b5d2
--- /dev/null
+++ b/xmloff/source/transform/IgnoreTContext.hxx
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_IGNORETCONTEXT_HXX
+#define _XMLOFF_IGNORETCONTEXT_HXX
+
+#include "TransformerContext.hxx"
+
+
+class XMLIgnoreTransformerContext : public XMLTransformerContext
+{
+ sal_Bool m_bIgnoreCharacters;
+ sal_Bool m_bIgnoreElements;
+ sal_Bool m_bAllowCharactersRecursive;
+ sal_Bool m_bRecursiveUse;
+
+public:
+ TYPEINFO();
+
+ // A contexts constructor does anything that is required if an element
+ // starts. Namespace processing has been done already.
+ // Note that virtual methods cannot be used inside constructors. Use
+ // StartElement instead if this is required.
+ XMLIgnoreTransformerContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName,
+ sal_Bool bIgnoreCharacters,
+ sal_Bool bIgnoreElements );
+ // A contexts constructor does anything that is required if an element
+ // starts. Namespace processing has been done already.
+ // Note that virtual methods cannot be used inside constructors. Use
+ // StartElement instead if this is required.
+ XMLIgnoreTransformerContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName,
+ sal_Bool bAllowCharactersRecursive );
+
+ // A contexts destructor does anything that is required if an element
+ // ends. By default, nothing is done.
+ // Note that virtual methods cannot be used inside destructors. Use
+ // EndElement instead if this is required.
+ virtual ~XMLIgnoreTransformerContext();
+
+ // Create a childs element context. By default, the import's
+ // CreateContext method is called to create a new default context.
+ virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::rtl::OUString& rQName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ // StartElement is called after a context has been constructed and
+ // before a elements context is parsed. It may be used for actions that
+ // require virtual methods. The default is to do nothing.
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ // EndElement is called before a context will be destructed, but
+ // after a elements context has been parsed. It may be used for actions
+ // that require virtual methods. The default is to do nothing.
+ virtual void EndElement();
+
+ // This method is called for all characters that are contained in the
+ // current element. The default is to ignore them.
+ virtual void Characters( const ::rtl::OUString& rChars );
+};
+
+#endif // _XMLOFF_IGNORETCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/MergeElemTContext.cxx b/xmloff/source/transform/MergeElemTContext.cxx
new file mode 100644
index 000000000000..d168bf94e930
--- /dev/null
+++ b/xmloff/source/transform/MergeElemTContext.cxx
@@ -0,0 +1,347 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "MergeElemTContext.hxx"
+#include "MutableAttrList.hxx"
+#include "TransformerBase.hxx"
+#include "TransformerActions.hxx"
+#include "AttrTransformerAction.hxx"
+#include "ElemTransformerAction.hxx"
+#include "IgnoreTContext.hxx"
+#include "xmloff/xmlnmspe.hxx"
+
+using ::rtl::OUString;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::xmloff::token;
+
+class XMLParagraphTransformerContext : public XMLTransformerContext
+{
+public:
+ TYPEINFO();
+
+ XMLParagraphTransformerContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName );
+
+ virtual ~XMLParagraphTransformerContext();
+
+ // Create a childs element context. By default, the import's
+ // CreateContext method is called to create a new default context.
+ virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::rtl::OUString& rQName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ // StartElement is called after a context has been constructed and
+ // before a elements context is parsed. It may be used for actions that
+ // require virtual methods. The default is to do nothing.
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ // EndElement is called before a context will be destructed, but
+ // after a elements context has been parsed. It may be used for actions
+ // that require virtual methods. The default is to do nothing.
+ virtual void EndElement();
+
+ // This method is called for all characters that are contained in the
+ // current element. The default is to ignore them.
+ virtual void Characters( const ::rtl::OUString& rChars );
+};
+
+TYPEINIT1( XMLParagraphTransformerContext, XMLTransformerContext );
+
+XMLParagraphTransformerContext::XMLParagraphTransformerContext(
+ XMLTransformerBase& rImp,
+ const OUString& rQName ) :
+ XMLTransformerContext( rImp, rQName )
+{
+}
+
+XMLParagraphTransformerContext::~XMLParagraphTransformerContext()
+{
+}
+
+XMLTransformerContext *XMLParagraphTransformerContext::CreateChildContext(
+ sal_uInt16 /*nPrefix*/,
+ const OUString& /*rLocalName*/,
+ const OUString& rQName,
+ const Reference< XAttributeList >& )
+{
+ XMLTransformerContext *pContext = 0;
+
+ pContext = new XMLIgnoreTransformerContext( GetTransformer(),
+ rQName, sal_True );
+
+ return pContext;
+}
+
+void XMLParagraphTransformerContext::StartElement( const Reference< XAttributeList >& rAttrList )
+{
+ XMLTransformerContext::StartElement( rAttrList );
+}
+
+void XMLParagraphTransformerContext::EndElement()
+{
+ XMLTransformerContext::EndElement();
+}
+
+void XMLParagraphTransformerContext::Characters( const OUString& rChars )
+{
+ XMLTransformerContext::Characters( rChars );
+}
+
+class XMLPersTextContentRNGTransformTContext : public XMLPersTextContentTContext
+{
+public:
+ TYPEINFO();
+
+ XMLPersTextContentRNGTransformTContext(
+ XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName,
+ sal_uInt16 nPrefix,
+ ::xmloff::token::XMLTokenEnum eToken );
+ virtual ~XMLPersTextContentRNGTransformTContext();
+
+ virtual void Characters( const ::rtl::OUString& rChars );
+};
+
+TYPEINIT1( XMLPersTextContentRNGTransformTContext, XMLPersAttrListTContext );
+
+XMLPersTextContentRNGTransformTContext::XMLPersTextContentRNGTransformTContext(
+ XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName,
+ sal_uInt16 nPrefix,
+ ::xmloff::token::XMLTokenEnum eToken ) :
+ XMLPersTextContentTContext(
+ rTransformer, rQName, nPrefix, eToken )
+{}
+
+XMLPersTextContentRNGTransformTContext::~XMLPersTextContentRNGTransformTContext()
+{}
+
+void XMLPersTextContentRNGTransformTContext::Characters( const ::rtl::OUString& rChars )
+{
+ OUString aConvChars( rChars );
+ GetTransformer().ConvertRNGDateTimeToISO( aConvChars );
+ XMLPersTextContentTContext::Characters( aConvChars );
+}
+
+
+TYPEINIT1( XMLMergeElemTransformerContext, XMLTransformerContext );
+
+void XMLMergeElemTransformerContext::ExportStartElement()
+{
+ XMLPersTextContentTContextVector::iterator aIter = m_aChildContexts.begin();
+
+ for( ; aIter != m_aChildContexts.end(); ++aIter )
+ {
+ XMLPersTextContentTContext *pContext = (*aIter).get();
+ static_cast< XMLMutableAttributeList * >( m_xAttrList.get() )
+ ->AddAttribute( pContext->GetExportQName(),
+ pContext->GetTextContent() );
+ }
+ XMLTransformerContext::StartElement( m_xAttrList );
+
+ m_bStartElementExported = sal_True;
+}
+
+XMLMergeElemTransformerContext::XMLMergeElemTransformerContext(
+ XMLTransformerBase& rImp,
+ const OUString& rQName,
+ sal_uInt16 nActionMap ) :
+ XMLTransformerContext( rImp, rQName ),
+ m_nActionMap( nActionMap ),
+ m_bStartElementExported( sal_False )
+{
+}
+
+XMLMergeElemTransformerContext::~XMLMergeElemTransformerContext()
+{
+}
+
+void XMLMergeElemTransformerContext::StartElement(
+ const Reference< XAttributeList >& rAttrList )
+{
+ XMLMutableAttributeList *pMutableAttrList =
+ new XMLMutableAttributeList( rAttrList, sal_True );
+ m_xAttrList = pMutableAttrList;
+
+ sal_Int16 nAttrCount = m_xAttrList.is() ? m_xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = m_xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ sal_Bool bRemove = sal_True;
+ if( XML_NAMESPACE_OFFICE == nPrefix)
+ {
+ if (IsXMLToken( aLocalName, XML_DISPLAY ) )
+ bRemove = sal_False;
+ else if (IsXMLToken( aLocalName, XML_AUTHOR ) )
+ bRemove = sal_False;
+ else if (IsXMLToken( aLocalName, XML_CREATE_DATE ) )
+ bRemove = sal_False;
+ else if (IsXMLToken( aLocalName, XML_CREATE_DATE_STRING ) )
+ bRemove = sal_False;
+ }
+ if (bRemove)
+ {
+ pMutableAttrList->RemoveAttributeByIndex( i );
+ --i;
+ --nAttrCount;
+ }
+ }
+}
+
+XMLTransformerContext *XMLMergeElemTransformerContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const OUString& rQName,
+ const Reference< XAttributeList >& rAttrList )
+{
+ XMLTransformerContext *pContext = 0;
+
+ if( !m_bStartElementExported )
+ {
+ XMLTransformerActions *pActions =
+ GetTransformer().GetUserDefinedActions( m_nActionMap );
+ OSL_ENSURE( pActions, "go no actions" );
+ if( pActions )
+ {
+ XMLTransformerActions::key_type aKey( nPrefix, rLocalName );
+ XMLTransformerActions::const_iterator aIter =
+ pActions->find( aKey );
+
+ if( !(aIter == pActions->end()) )
+ {
+ switch( (*aIter).second.m_nActionType )
+ {
+ case XML_ATACTION_MOVE_FROM_ELEM_RNG2ISO_DATETIME:
+ {
+ XMLPersTextContentTContext *pTC =
+ new XMLPersTextContentRNGTransformTContext(
+ GetTransformer(), rQName,
+ (*aIter).second.GetQNamePrefixFromParam1(),
+ (*aIter).second.GetQNameTokenFromParam1() );
+ XMLPersTextContentTContextVector::value_type aVal(pTC);
+ m_aChildContexts.push_back( aVal );
+ pContext = pTC;
+ }
+ break;
+ case XML_ATACTION_MOVE_FROM_ELEM:
+ {
+ XMLPersTextContentTContext *pTC =
+ new XMLPersTextContentTContext(
+ GetTransformer(), rQName,
+ (*aIter).second.GetQNamePrefixFromParam1(),
+ (*aIter).second.GetQNameTokenFromParam1() );
+ XMLPersTextContentTContextVector::value_type aVal(pTC);
+ m_aChildContexts.push_back( aVal );
+ pContext = pTC;
+ }
+ break;
+ case XML_ETACTION_EXTRACT_CHARACTERS:
+ {
+ if( !m_bStartElementExported )
+ ExportStartElement();
+ XMLParagraphTransformerContext* pPTC =
+ new XMLParagraphTransformerContext( GetTransformer(),
+ rQName);
+ pContext = pPTC;
+ }
+ break;
+ default:
+ OSL_ENSURE( !this, "unknown action" );
+ break;
+ }
+ }
+ }
+ }
+ else
+ {
+ XMLTransformerActions *pActions =
+ GetTransformer().GetUserDefinedActions( m_nActionMap );
+ OSL_ENSURE( pActions, "go no actions" );
+ if( pActions )
+ {
+ XMLTransformerActions::key_type aKey( nPrefix, rLocalName );
+ XMLTransformerActions::const_iterator aIter =
+ pActions->find( aKey );
+
+ if( !(aIter == pActions->end()) )
+ {
+ switch( (*aIter).second.m_nActionType )
+ {
+ case XML_ETACTION_EXTRACT_CHARACTERS:
+ {
+ if( !m_bStartElementExported )
+ ExportStartElement();
+ XMLParagraphTransformerContext* pPTC =
+ new XMLParagraphTransformerContext( GetTransformer(),
+ rQName);
+ pContext = pPTC;
+ }
+ break;
+ default:
+ OSL_ENSURE( !this, "unknown action" );
+ break;
+ }
+ }
+ }
+ }
+
+ // default is copying
+ if( !pContext )
+ {
+ if( !m_bStartElementExported )
+ ExportStartElement();
+ pContext = XMLTransformerContext::CreateChildContext( nPrefix,
+ rLocalName,
+ rQName,
+ rAttrList );
+ }
+
+ return pContext;
+}
+
+void XMLMergeElemTransformerContext::EndElement()
+{
+ if( !m_bStartElementExported )
+ ExportStartElement();
+ XMLTransformerContext::EndElement();
+}
+
+void XMLMergeElemTransformerContext::Characters( const OUString& )
+{
+ // ignore
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/MergeElemTContext.hxx b/xmloff/source/transform/MergeElemTContext.hxx
new file mode 100644
index 000000000000..200813a49dab
--- /dev/null
+++ b/xmloff/source/transform/MergeElemTContext.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_MERGEELEMTCONTEXT_HXX
+#define _XMLOFF_MERGEELEMTCONTEXT_HXX
+
+#include <rtl/ref.hxx>
+#include "FlatTContext.hxx"
+#include <vector>
+
+typedef ::std::vector< ::rtl::Reference< XMLPersTextContentTContext> >
+ XMLPersTextContentTContextVector;
+
+class XMLMergeElemTransformerContext : public XMLTransformerContext
+{
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > m_xAttrList;
+ XMLPersTextContentTContextVector m_aChildContexts;
+ sal_uInt16 m_nActionMap;
+ sal_Bool m_bStartElementExported;
+
+ void ExportStartElement();
+
+public:
+ TYPEINFO();
+
+ XMLMergeElemTransformerContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName,
+ sal_uInt16 nActionMap );
+
+ virtual ~XMLMergeElemTransformerContext();
+
+ virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::rtl::OUString& rQName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void EndElement();
+
+ virtual void Characters( const ::rtl::OUString& rChars );
+};
+
+#endif // _XMLOFF_MERGEELEMCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/MetaTContext.cxx b/xmloff/source/transform/MetaTContext.cxx
new file mode 100644
index 000000000000..38b41ef2159c
--- /dev/null
+++ b/xmloff/source/transform/MetaTContext.cxx
@@ -0,0 +1,146 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/xml/sax/SAXParseException.hpp>
+#include <com/sun/star/xml/sax/SAXException.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlnmspe.hxx"
+
+#include "TransformerBase.hxx"
+#include "MutableAttrList.hxx"
+#include "MetaTContext.hxx"
+
+using ::rtl::OUString;
+using namespace ::xmloff::token;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+
+XMLTokenEnum aMetaTokens[] =
+{
+ XML_GENERATOR,
+ XML_TITLE,
+ XML_DESCRIPTION,
+ XML_SUBJECT,
+ XML_INITIAL_CREATOR,
+ XML_CREATION_DATE,
+ XML_CREATOR,
+ XML_DATE,
+ XML_PRINTED_BY,
+ XML_PRINT_DATE,
+ XML_KEYWORD,
+ XML_LANGUAGE,
+ XML_EDITING_CYCLES,
+ XML_EDITING_DURATION,
+ XML_HYPERLINK_BEHAVIOUR,
+ XML_AUTO_RELOAD,
+ XML_TEMPLATE,
+ XML_USER_DEFINED,
+ XML_DOCUMENT_STATISTIC,
+ XML_TOKEN_END
+};
+
+TYPEINIT1( XMLMetaTransformerContext, XMLTransformerContext );
+
+XMLMetaTransformerContext::XMLMetaTransformerContext( XMLTransformerBase& rImp,
+ const OUString& rQName ) :
+ XMLTransformerContext( rImp, rQName )
+{
+}
+
+XMLMetaTransformerContext::~XMLMetaTransformerContext()
+{
+}
+
+XMLTransformerContext *XMLMetaTransformerContext::CreateChildContext(
+ sal_uInt16 /*nPrefix*/,
+ const OUString& rLocalName,
+ const OUString& rQName,
+ const Reference< XAttributeList >& )
+{
+ XMLPersTextContentTContext *pContext =
+ new XMLPersTextContentTContext( GetTransformer(), rQName );
+ XMLMetaContexts_Impl::value_type aVal( rLocalName, pContext );
+ m_aContexts.insert( aVal );
+
+ return pContext;
+}
+
+void XMLMetaTransformerContext::EndElement()
+{
+ // export everything in the correct order
+ OUString aKeywordsQName;
+ XMLTokenEnum *pToken = aMetaTokens;
+ while( *pToken != XML_TOKEN_END )
+ {
+ const OUString& rToken = GetXMLToken( *pToken );
+ XMLMetaContexts_Impl::const_iterator aIter =
+ m_aContexts.find( rToken );
+ if( aIter != m_aContexts.end() )
+ {
+ if( XML_KEYWORD == *pToken )
+ {
+ aKeywordsQName =
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_META, GetXMLToken(XML_KEYWORDS ) );
+
+ Reference< XAttributeList > xAttrList =
+ new XMLMutableAttributeList;
+ GetTransformer().GetDocHandler()->startElement( aKeywordsQName,
+ xAttrList );
+ }
+
+ // All elements may occur multiple times
+ XMLMetaContexts_Impl::const_iterator aEndIter =
+ m_aContexts.upper_bound( rToken );
+ while( aIter != aEndIter )
+ {
+ (*aIter).second->Export();
+ ++aIter;
+ }
+
+ if( XML_KEYWORD == *pToken )
+ GetTransformer().GetDocHandler()->endElement( aKeywordsQName );
+ }
+ pToken++;
+ }
+
+ GetTransformer().GetDocHandler()->endElement( GetQName() );
+}
+
+void XMLMetaTransformerContext::Characters( const OUString& )
+{
+ // ignore them
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/MetaTContext.hxx b/xmloff/source/transform/MetaTContext.hxx
new file mode 100644
index 000000000000..0d48a4069d08
--- /dev/null
+++ b/xmloff/source/transform/MetaTContext.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_METATCONTEXT_HXX
+#define _XMLOFF_METATCONTEXT_HXX
+
+#include <rtl/ref.hxx>
+#include "xmloff/functional.hxx"
+
+#include <map>
+
+#include "FlatTContext.hxx"
+
+typedef ::std::multimap< ::rtl::OUString,
+ ::rtl::Reference< XMLPersTextContentTContext >,
+ less_functor > XMLMetaContexts_Impl;
+
+
+class XMLMetaTransformerContext : public XMLTransformerContext
+{
+ XMLMetaContexts_Impl m_aContexts;
+
+public:
+ TYPEINFO();
+
+ // A contexts constructor does anything that is required if an element
+ // starts. Namespace processing has been done already.
+ // Note that virtual methods cannot be used inside constructors. Use
+ // StartElement instead if this is required.
+ XMLMetaTransformerContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName );
+
+ // A contexts destructor does anything that is required if an element
+ // ends. By default, nothing is done.
+ // Note that virtual methods cannot be used inside destructors. Use
+ // EndElement instead if this is required.
+ virtual ~XMLMetaTransformerContext();
+
+ // Create a childs element context. By default, the import's
+ // CreateContext method is called to create a new default context.
+ virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::rtl::OUString& rQName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ // EndElement is called before a context will be destructed, but
+ // after a elements context has been parsed. It may be used for actions
+ // that require virtual methods. The default is to do nothing.
+ virtual void EndElement();
+
+ // This method is called for all characters that are contained in the
+ // current element. The default is to ignore them.
+ virtual void Characters( const ::rtl::OUString& rChars );
+};
+
+#endif // _XMLOFF_METATCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/MutableAttrList.cxx b/xmloff/source/transform/MutableAttrList.cxx
new file mode 100644
index 000000000000..94606585fdd9
--- /dev/null
+++ b/xmloff/source/transform/MutableAttrList.cxx
@@ -0,0 +1,206 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <osl/mutex.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <rtl/uuid.h>
+#include <rtl/memory.h>
+#include <xmloff/attrlist.hxx>
+#include "MutableAttrList.hxx"
+
+using ::rtl::OUString;
+
+using namespace ::osl;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::util;
+
+SvXMLAttributeList *XMLMutableAttributeList::GetMutableAttrList()
+{
+ if( !m_pMutableAttrList )
+ {
+ m_pMutableAttrList = new SvXMLAttributeList( m_xAttrList );
+ m_xAttrList = m_pMutableAttrList;
+ }
+
+ return m_pMutableAttrList;
+}
+
+XMLMutableAttributeList::XMLMutableAttributeList() :
+ m_pMutableAttrList( new SvXMLAttributeList )
+{
+ m_xAttrList = m_pMutableAttrList;
+}
+
+XMLMutableAttributeList::XMLMutableAttributeList( const Reference<
+ XAttributeList> & rAttrList, sal_Bool bClone ) :
+ m_xAttrList( rAttrList.is() ? rAttrList : new SvXMLAttributeList ),
+ m_pMutableAttrList( 0 )
+{
+ if( bClone )
+ GetMutableAttrList();
+}
+
+
+XMLMutableAttributeList::~XMLMutableAttributeList()
+{
+ m_xAttrList = 0;
+}
+
+
+// XUnoTunnel & co
+const Sequence< sal_Int8 > & XMLMutableAttributeList::getUnoTunnelId() throw()
+{
+ static Sequence< sal_Int8 > * pSeq = 0;
+ if( !pSeq )
+ {
+ Guard< Mutex > aGuard( Mutex::getGlobalMutex() );
+ if( !pSeq )
+ {
+ static Sequence< sal_Int8 > aSeq( 16 );
+ rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
+ pSeq = &aSeq;
+ }
+ }
+ return *pSeq;
+}
+
+// XUnoTunnel
+sal_Int64 SAL_CALL XMLMutableAttributeList::getSomething(
+ const Sequence< sal_Int8 >& rId )
+ throw( RuntimeException )
+{
+ if( rId.getLength() == 16 &&
+ 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
+ }
+ return 0;
+}
+
+sal_Int16 SAL_CALL XMLMutableAttributeList::getLength(void)
+ throw( RuntimeException )
+{
+ return m_xAttrList->getLength();
+}
+
+
+OUString SAL_CALL XMLMutableAttributeList::getNameByIndex(sal_Int16 i)
+ throw( RuntimeException )
+{
+ return m_xAttrList->getNameByIndex( i );
+}
+
+
+OUString SAL_CALL XMLMutableAttributeList::getTypeByIndex(sal_Int16 i)
+ throw( RuntimeException )
+{
+ return m_xAttrList->getTypeByIndex( i );
+}
+
+OUString SAL_CALL XMLMutableAttributeList::getValueByIndex(sal_Int16 i)
+ throw( RuntimeException )
+{
+ return m_xAttrList->getValueByIndex( i );
+}
+
+OUString SAL_CALL XMLMutableAttributeList::getTypeByName(
+ const OUString& rName )
+ throw( RuntimeException )
+{
+ return m_xAttrList->getTypeByName( rName );
+}
+
+OUString SAL_CALL XMLMutableAttributeList::getValueByName(
+ const OUString& rName)
+ throw( RuntimeException )
+{
+ return m_xAttrList->getValueByName( rName );
+}
+
+
+Reference< XCloneable > XMLMutableAttributeList::createClone()
+ throw( RuntimeException )
+{
+ // A cloned list will be a read only list!
+ Reference< XCloneable > r = new SvXMLAttributeList( m_xAttrList );
+ return r;
+}
+
+void XMLMutableAttributeList::SetValueByIndex( sal_Int16 i,
+ const ::rtl::OUString& rValue )
+{
+ GetMutableAttrList()->SetValueByIndex( i, rValue );
+}
+
+void XMLMutableAttributeList::AddAttribute( const OUString &rName ,
+ const OUString &rValue )
+{
+ GetMutableAttrList()->AddAttribute( rName, rValue );
+}
+
+void XMLMutableAttributeList::RemoveAttributeByIndex( sal_Int16 i )
+{
+ GetMutableAttrList()->RemoveAttributeByIndex( i );
+}
+
+void XMLMutableAttributeList::RenameAttributeByIndex( sal_Int16 i,
+ const OUString& rNewName )
+{
+ GetMutableAttrList()->RenameAttributeByIndex( i, rNewName );
+}
+
+void XMLMutableAttributeList::AppendAttributeList(
+ const Reference< ::com::sun::star::xml::sax::XAttributeList >& r )
+{
+ GetMutableAttrList()->AppendAttributeList( r );
+}
+
+sal_Int16 XMLMutableAttributeList::GetIndexByName( const OUString& rName ) const
+{
+ sal_Int16 nIndex = -1;
+ if( m_pMutableAttrList )
+ {
+ nIndex = m_pMutableAttrList->GetIndexByName( rName );
+ }
+ else
+ {
+ sal_Int16 nCount = m_xAttrList->getLength();
+ for( sal_Int16 i=0; nIndex==-1 && i<nCount ; ++i )
+ {
+ if( m_xAttrList->getNameByIndex(i) == rName )
+ nIndex = i;
+ }
+ }
+ return nIndex;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/MutableAttrList.hxx b/xmloff/source/transform/MutableAttrList.hxx
new file mode 100644
index 000000000000..ae01037f6b75
--- /dev/null
+++ b/xmloff/source/transform/MutableAttrList.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_MUTABLEATTRLIST_HXX
+#define _XMLOFF_MUTABLEATTRLIST_HXX
+
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+
+#include <cppuhelper/implbase3.hxx>
+
+class SvXMLAttributeList;
+
+class XMLMutableAttributeList : public ::cppu::WeakImplHelper3<
+ ::com::sun::star::xml::sax::XAttributeList,
+ ::com::sun::star::util::XCloneable,
+ ::com::sun::star::lang::XUnoTunnel>
+{
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> m_xAttrList;
+
+ SvXMLAttributeList *m_pMutableAttrList;
+
+ SvXMLAttributeList *GetMutableAttrList();
+
+public:
+ XMLMutableAttributeList();
+ XMLMutableAttributeList( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & rAttrList,
+ sal_Bool bClone=sal_False );
+ ~XMLMutableAttributeList();
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
+
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::xml::sax::XAttributeList
+ virtual sal_Int16 SAL_CALL getLength(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::rtl::OUString SAL_CALL getNameByIndex(sal_Int16 i) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::rtl::OUString SAL_CALL getTypeByIndex(sal_Int16 i) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::rtl::OUString SAL_CALL getTypeByName(const ::rtl::OUString& aName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::rtl::OUString SAL_CALL getValueByIndex(sal_Int16 i) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::rtl::OUString SAL_CALL getValueByName(const ::rtl::OUString& aName) throw( ::com::sun::star::uno::RuntimeException );
+
+ // ::com::sun::star::util::XCloneable
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone() throw( ::com::sun::star::uno::RuntimeException );
+
+ // methods that are not contained in any interface
+ void SetValueByIndex( sal_Int16 i, const ::rtl::OUString& rValue );
+ void AddAttribute( const ::rtl::OUString &sName , const ::rtl::OUString &sValue );
+// void Clear();
+ void RemoveAttributeByIndex( sal_Int16 i );
+ void RenameAttributeByIndex( sal_Int16 i, const ::rtl::OUString& rNewName );
+// void SetAttributeList( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & );
+ void AppendAttributeList( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & );
+
+ sal_Int16 GetIndexByName( const ::rtl::OUString& rName ) const;
+};
+
+
+#endif // _XMLOFF_MUTABLEATTRLIST_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/NotesTContext.cxx b/xmloff/source/transform/NotesTContext.cxx
new file mode 100644
index 000000000000..88355a151f28
--- /dev/null
+++ b/xmloff/source/transform/NotesTContext.cxx
@@ -0,0 +1,231 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/xml/sax/SAXParseException.hpp>
+#include <com/sun/star/xml/sax/SAXException.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlnmspe.hxx"
+
+#include "TransformerBase.hxx"
+#include "TransformerActions.hxx"
+#include "AttrTransformerAction.hxx"
+#include "ActionMapTypesOASIS.hxx"
+#include "MutableAttrList.hxx"
+#include "RenameElemTContext.hxx"
+#include "FlatTContext.hxx"
+
+#include "NotesTContext.hxx"
+
+using ::rtl::OUString;
+using namespace ::xmloff::token;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+
+TYPEINIT1( XMLNotesTransformerContext, XMLPersElemContentTContext );
+
+XMLNotesTransformerContext::XMLNotesTransformerContext(
+ XMLTransformerBase& rImp,
+ const OUString& rQName,
+ XMLTokenEnum eToken, sal_Bool bPersistent ) :
+ XMLPersElemContentTContext( rImp, rQName ),
+ m_bEndNote( sal_False ),
+ m_bPersistent( bPersistent ),
+ m_eTypeToken( eToken )
+{
+}
+
+XMLNotesTransformerContext::~XMLNotesTransformerContext()
+{
+}
+
+void XMLNotesTransformerContext::StartElement(
+ const Reference< XAttributeList >& rAttrList )
+{
+ XMLTransformerActions *pActions =
+ GetTransformer().GetUserDefinedActions( OASIS_NOTES_ACTIONS );
+ OSL_ENSURE( pActions, "go no actions" );
+
+ Reference< XAttributeList > xAttrList( rAttrList );
+ XMLMutableAttributeList *pMutableAttrList = 0;
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ XMLTransformerActions::key_type aKey( nPrefix, aLocalName );
+ XMLTransformerActions::const_iterator aIter =
+ pActions->find( aKey );
+ if( !(aIter == pActions->end() ) )
+ {
+ const OUString& rAttrValue = xAttrList->getValueByIndex( i );
+
+ if( !pMutableAttrList )
+ {
+ pMutableAttrList =
+ new XMLMutableAttributeList( xAttrList );
+ xAttrList = pMutableAttrList;
+ }
+ switch( (*aIter).second.m_nActionType )
+ {
+ case XML_ATACTION_STYLE_FAMILY:
+ {
+ if( IsXMLToken( rAttrValue, XML_FOOTNOTE ) )
+ {
+ }
+ else if( IsXMLToken( rAttrValue, XML_ENDNOTE ) )
+ {
+ m_bEndNote = sal_True;
+ }
+ pMutableAttrList->RemoveAttributeByIndex( i );
+ --i;
+ --nAttrCount;
+ }
+ break;
+ case XML_ATACTION_DECODE_STYLE_NAME:
+ case XML_ATACTION_DECODE_STYLE_NAME_REF:
+ {
+ OUString aAttrValue( rAttrValue );
+ if( GetTransformer().DecodeStyleName(aAttrValue) )
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ break;
+ }
+ }
+ }
+
+ XMLTokenEnum eToken = XML_FOOTNOTE;
+ switch( m_eTypeToken )
+ {
+ case XML_NOTE:
+ eToken = (m_bEndNote ? XML_ENDNOTE : XML_FOOTNOTE);
+ break;
+ case XML_NOTES_CONFIGURATION:
+ eToken = (m_bEndNote ? XML_ENDNOTES_CONFIGURATION
+ : XML_FOOTNOTES_CONFIGURATION);
+ break;
+ case XML_NOTE_REF:
+ eToken = (m_bEndNote ? XML_ENDNOTE_REF : XML_FOOTNOTE_REF);
+ break;
+ default:
+ OSL_ENSURE( XML_NOTE==m_eTypeToken, "invalid note type" );
+ break;
+ }
+
+ SetExportQName( GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_TEXT,
+ ::xmloff::token::GetXMLToken( eToken ) ) );
+ if( m_bPersistent )
+ XMLPersElemContentTContext::StartElement( xAttrList );
+ else
+ GetTransformer().GetDocHandler()->startElement( GetExportQName(),
+ xAttrList );
+}
+
+void XMLNotesTransformerContext::EndElement()
+{
+ if( m_bPersistent )
+ {
+ XMLPersElemContentTContext::EndElement();
+ }
+ else
+ {
+ GetTransformer().GetDocHandler()->endElement( GetExportQName() );
+ }
+}
+
+XMLTransformerContext *XMLNotesTransformerContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const OUString& rQName,
+ const Reference< XAttributeList >& rAttrList )
+{
+ XMLTransformerContext *pContext = 0;
+ if( XML_NOTE == m_eTypeToken )
+ {
+ if( XML_NAMESPACE_TEXT == nPrefix )
+ {
+ XMLTokenEnum eToken ( XML_TOKEN_INVALID );
+ if( IsXMLToken( rLocalName, XML_NOTE_CITATION ) )
+ {
+ eToken = m_bEndNote ? XML_ENDNOTE_CITATION
+ : XML_FOOTNOTE_CITATION;
+ }
+ else if( IsXMLToken( rLocalName, XML_NOTE_BODY ) )
+ {
+ eToken = m_bEndNote ? XML_ENDNOTE_BODY
+ : XML_FOOTNOTE_BODY;
+ }
+
+ if( XML_TOKEN_INVALID != eToken )
+ {
+ if( m_bPersistent )
+ {
+ pContext = new XMLPersTextContentTContext(
+ GetTransformer(), rQName,
+ XML_NAMESPACE_TEXT,
+ eToken );
+ AddContent( pContext );
+
+ }
+ else
+ {
+ pContext = new XMLRenameElemTransformerContext(
+ GetTransformer(), rQName,
+ XML_NAMESPACE_TEXT,
+ eToken );
+ }
+ }
+ }
+ }
+
+ if( !pContext )
+ {
+ pContext = m_bPersistent
+ ? XMLPersElemContentTContext::CreateChildContext(
+ nPrefix, rLocalName, rQName, rAttrList )
+ : XMLTransformerContext::CreateChildContext(
+ nPrefix, rLocalName, rQName, rAttrList );
+ }
+
+ return pContext;
+}
+
+sal_Bool XMLNotesTransformerContext::IsPersistent() const
+{
+ return m_bPersistent;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/NotesTContext.hxx b/xmloff/source/transform/NotesTContext.hxx
new file mode 100644
index 000000000000..86882afbaeef
--- /dev/null
+++ b/xmloff/source/transform/NotesTContext.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_NOTESTCONTEXT_HXX
+#define _XMLOFF_NOTESTCONTEXT_HXX
+
+#include "DeepTContext.hxx"
+
+class XMLNotesTransformerContext : public XMLPersElemContentTContext
+{
+ sal_Bool m_bEndNote;
+ sal_Bool m_bPersistent;
+ ::xmloff::token::XMLTokenEnum m_eTypeToken;
+
+public:
+ TYPEINFO();
+
+ XMLNotesTransformerContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName,
+ ::xmloff::token::XMLTokenEnum m_eToken,
+ sal_Bool bPersistent );
+
+ virtual ~XMLNotesTransformerContext();
+
+ virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::rtl::OUString& rQName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+
+ virtual sal_Bool IsPersistent() const;
+};
+
+#endif // _XMLOFF_NOTESTCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/OOo2Oasis.cxx b/xmloff/source/transform/OOo2Oasis.cxx
new file mode 100644
index 000000000000..2df52defcf0c
--- /dev/null
+++ b/xmloff/source/transform/OOo2Oasis.cxx
@@ -0,0 +1,2200 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <rtl/uuid.h>
+#include <rtl/ustrbuf.hxx>
+#include <comphelper/processfactory.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include "MutableAttrList.hxx"
+#include "DeepTContext.hxx"
+#include "StyleOOoTContext.hxx"
+#include "FrameOOoTContext.hxx"
+#include "EventOOoTContext.hxx"
+#include "ControlOOoTContext.hxx"
+#include "FormPropOOoTContext.hxx"
+#include "ChartOOoTContext.hxx"
+#include "ChartPlotAreaOOoTContext.hxx"
+#include "ElemTransformerAction.hxx"
+#include "AttrTransformerAction.hxx"
+#include "PropertyActionsOOo.hxx"
+#include "TransformerActions.hxx"
+#include <xmloff/xmluconv.hxx>
+#include "OOo2Oasis.hxx"
+
+using ::rtl::OUString;
+using namespace ::xmloff::token;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::beans;
+
+OUString SAL_CALL OOo2OasisTransformer_getImplementationName() throw();
+
+enum XMLUserDefinedTransformerAction
+{
+ XML_ETACTION_DOCUMENT=XML_ETACTION_USER_DEFINED,
+ XML_ETACTION_BODY,
+ XML_ETACTION_STYLE,
+ XML_ETACTION_STYLE_RENAME,
+ XML_ETACTION_FRAME,
+ XML_ETACTION_EVENT,
+ XML_ETACTION_TAB_STOP,
+ XML_ETACTION_FORM_CONTROL,
+ XML_ETACTION_FORM_PROPERTY,
+ XML_ETACTION_CHART,
+ XML_ETACTION_TRACKED_CHANGES,
+ XML_ETACTION_CHART_PLOT_AREA,
+ XML_ETACTION_DOCUMENT_RENAME,
+ XML_ETACTION_TABLE
+};
+
+#define ENTRY3( n, l, a, p1, p2, p3 ) \
+ { XML_NAMESPACE_##n, XML_##l, a, p1, p2, p3 }
+#define ENTRY3QQN( n, l, a, n1, l1, n2, l2, p3 ) \
+ ENTRY3( n, l, a, XMLTransformerActionInit::QNameParam( n1, l1 ), \
+ XMLTransformerActionInit::QNameParam( n2, l2 ), p3 )
+
+#define ENTRY2( n, l, a, p1, p2 ) \
+ ENTRY3( n, l, a, p1, p2, 0 )
+#define ENTRY2QQ( n, l, a, n1, l1, n2, l2 ) \
+ ENTRY2( n, l, a, XMLTransformerActionInit::QNameParam( n1, l1 ), \
+ XMLTransformerActionInit::QNameParam( n2, l2 ) )
+#define ENTRY2QN( n, l, a, n1, l1, p2 ) \
+ ENTRY2( n, l, a, XMLTransformerActionInit::QNameParam( n1, l1 ), p2 )
+
+#define ENTRY1( n, l, a, p1 ) \
+ ENTRY3( n, l, a, p1, 0, 0 )
+#define ENTRY1Q( n, l, a, n1, l1 ) \
+ ENTRY1( n, l, a, XMLTransformerActionInit::QNameParam( n1, l1 ) )
+
+#define ENTRY0( n, l, a ) \
+ ENTRY3( n, l, a, 0, 0, 0 )
+
+// BM: a macro to put two tokens into one sal_Int32 for the action
+// XML_ATACTION_RENAME_ATTRIBUTE
+#define RENAME_ENTRY( f, s ) \
+ (static_cast< sal_Int32 >(f) | (static_cast< sal_Int32 >(s) << 16))
+
+static XMLTransformerActionInit aActionTable[] =
+{
+ // remove office:class from <office:document> and <office:document-content>
+ ENTRY0( OFFICE, DOCUMENT, XML_ETACTION_DOCUMENT ),
+ ENTRY0( OFFICE, DOCUMENT_CONTENT, XML_ETACTION_DOCUMENT ),
+ ENTRY0( OFFICE, DOCUMENT_STYLES, XML_ETACTION_DOCUMENT ),
+ ENTRY0( OFFICE, DOCUMENT_SETTINGS, XML_ETACTION_DOCUMENT ),
+ ENTRY1Q( OFFICE, AUTO_TEXT_EVENTS, XML_ETACTION_DOCUMENT_RENAME,
+ XML_NAMESPACE_OOO, XML_AUTO_TEXT_EVENTS),
+
+ // remove <meta:keywords>
+ ENTRY0( META, KEYWORDS, XML_ETACTION_COPY_CONTENT ),
+
+ // rename <office:script> to <office:scripts>
+ ENTRY1Q( OFFICE, SCRIPT, XML_ETACTION_RENAME_ELEM,
+ XML_NAMESPACE_OFFICE, XML_SCRIPTS ),
+
+ // rename <office:script-data> to <office:script> and process attributes
+ ENTRY2QN( OFFICE, SCRIPT_DATA, XML_ETACTION_RENAME_ELEM_PROC_ATTRS,
+ XML_NAMESPACE_OFFICE, XML_SCRIPT,
+ OOO_SCRIPT_ACTIONS ),
+
+ // rename <script:libraries> to <ooo:libraries>
+ ENTRY1Q( SCRIPT, LIBRARIES, XML_ETACTION_RENAME_ELEM,
+ XML_NAMESPACE_OOO, XML_LIBRARIES ),
+
+ // rename <script:library-linked> to <ooo:library-linked> and process attributes
+ ENTRY2QN( SCRIPT, LIBRARY_LINKED, XML_ETACTION_RENAME_ELEM_PROC_ATTRS,
+ XML_NAMESPACE_OOO, XML_LIBRARY_LINKED,
+ OOO_SCRIPT_ACTIONS ),
+
+ // rename <script:library-embedded> to <ooo:library-embedded> and process attributes
+ ENTRY2QN( SCRIPT, LIBRARY_EMBEDDED, XML_ETACTION_RENAME_ELEM_PROC_ATTRS,
+ XML_NAMESPACE_OOO, XML_LIBRARY_EMBEDDED,
+ OOO_SCRIPT_ACTIONS ),
+
+ // rename <script:module> to <ooo:module> and process attributes
+ ENTRY2QN( SCRIPT, MODULE, XML_ETACTION_RENAME_ELEM_PROC_ATTRS,
+ XML_NAMESPACE_OOO, XML_MODULE,
+ OOO_SCRIPT_ACTIONS ),
+
+ // rename <script:source-code> to <ooo:source-code>
+ ENTRY1Q( SCRIPT, SOURCE_CODE, XML_ETACTION_RENAME_ELEM,
+ XML_NAMESPACE_OOO, XML_SOURCE_CODE ),
+
+ // rename <office:font-decls> to <office:font-face-decl>,
+ // rename <style:font-decl> to <style:font-face>, process attrs
+ ENTRY1Q( OFFICE, FONT_DECLS, XML_ETACTION_RENAME_ELEM,
+ XML_NAMESPACE_OFFICE, XML_FONT_FACE_DECLS ),
+ ENTRY2QN( STYLE, FONT_DECL, XML_ETACTION_RENAME_ELEM_PROC_ATTRS,
+ XML_NAMESPACE_STYLE, XML_FONT_FACE,
+ OOO_FONT_DECL_ACTIONS ),
+
+ // add genre element
+ ENTRY0( OFFICE, BODY, XML_ETACTION_BODY ),
+
+ // rename <style:page-master> to <style:page-layout>
+ ENTRY2QN( STYLE, PAGE_MASTER, XML_ETACTION_STYLE_RENAME,
+ XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT,
+ XML_FAMILY_TYPE_PAGE_LAYOUT ),
+ ENTRY1( STYLE, MASTER_PAGE, XML_ETACTION_PROC_ATTRS,
+ OOO_MASTER_PAGE_ACTIONS ),
+
+ // split <style:properties> into <style:*-properties> and do other
+ // styles processing
+ ENTRY1( STYLE, STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_END ),
+ ENTRY1( STYLE, DEFAULT_STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_END ),
+ ENTRY1( NUMBER, NUMBER_STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_DATA ),
+ ENTRY1( NUMBER, CURRENCY_STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_DATA ),
+ ENTRY1( NUMBER, PERCENTAGE_STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_DATA ),
+ ENTRY1( NUMBER, DATE_STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_DATA ),
+ ENTRY1( NUMBER, TIME_STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_DATA ),
+ ENTRY1( NUMBER, BOOLEAN_STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_DATA ),
+ ENTRY1( NUMBER, TEXT_STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_DATA ),
+ ENTRY1( TEXT, LIST_STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_LIST ),
+// ENTRY0( TEXT, OUTLINE_STYLE, STYLE ),
+ ENTRY1( STYLE, HEADER_STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_HEADER_FOOTER ),
+ ENTRY1( STYLE, FOOTER_STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_HEADER_FOOTER ),
+ ENTRY1( TEXT, LIST_LEVEL_STYLE_NUMBER, XML_ETACTION_STYLE, XML_FAMILY_TYPE_LIST ),
+ ENTRY1( TEXT, LIST_LEVEL_STYLE_BULLET, XML_ETACTION_STYLE, XML_FAMILY_TYPE_LIST ),
+ ENTRY1( TEXT, LIST_LEVEL_STYLE_IMAGE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_LIST ),
+ ENTRY1( TEXT, OUTLINE_LEVEL_STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_LIST ),
+ ENTRY1( DRAW, GRADIENT, XML_ETACTION_STYLE,
+ XML_FAMILY_TYPE_GRADIENT ),
+ ENTRY1( DRAW, FILL_IMAGE, XML_ETACTION_STYLE,
+ XML_FAMILY_TYPE_FILL_IMAGE ),
+ ENTRY2QN( DRAW, TRANSPARENCY, XML_ETACTION_STYLE_RENAME,
+ XML_NAMESPACE_DRAW, XML_OPACITY,
+ XML_FAMILY_TYPE_GRADIENT ),
+ ENTRY1( DRAW, MARKER, XML_ETACTION_STYLE,
+ XML_FAMILY_TYPE_MARKER ),
+ ENTRY1( DRAW, HATCH, XML_ETACTION_STYLE,
+ XML_FAMILY_TYPE_HATCH ),
+ ENTRY1( DRAW, STROKE_DASH, XML_ETACTION_STYLE,
+ XML_FAMILY_TYPE_STROKE_DASH ),
+
+ // rename <text:h>'s text:level to text:outline-level
+ // process <text:h/p>: process style-name attributes,
+ ENTRY1( TEXT, H, XML_ETACTION_PROC_ATTRS, OOO_PARA_ACTIONS ),
+ ENTRY1( TEXT, P, XML_ETACTION_PROC_ATTRS, OOO_PARA_ACTIONS ),
+
+ // rename <text:ordered-list> and <text:unordered-list> to <text:list>
+ ENTRY2QN( TEXT, UNORDERED_LIST, XML_ETACTION_RENAME_ELEM_PROC_ATTRS,
+ XML_NAMESPACE_TEXT, XML_LIST,
+ OOO_STYLE_REF_ACTIONS ),
+ ENTRY2QN( TEXT, ORDERED_LIST, XML_ETACTION_RENAME_ELEM_PROC_ATTRS,
+ XML_NAMESPACE_TEXT, XML_LIST,
+ OOO_STYLE_REF_ACTIONS ),
+
+ // rename <text:footnote*> to <text:note*>
+ ENTRY3QQN( TEXT, FOOTNOTE, XML_ETACTION_RENAME_ELEM_ADD_ATTR,
+ XML_NAMESPACE_TEXT, XML_NOTE,
+ XML_NAMESPACE_TEXT, XML_NOTE_CLASS, XML_FOOTNOTE ),
+ ENTRY1Q( TEXT, FOOTNOTE_BODY, XML_ETACTION_RENAME_ELEM,
+ XML_NAMESPACE_TEXT, XML_NOTE_BODY ),
+ ENTRY1Q( TEXT, FOOTNOTE_CITATION, XML_ETACTION_RENAME_ELEM,
+ XML_NAMESPACE_TEXT, XML_NOTE_CITATION ),
+ ENTRY3QQN( TEXT, FOOTNOTES_CONFIGURATION,
+ XML_ETACTION_RENAME_ELEM_ADD_PROC_ATTR,
+ XML_NAMESPACE_TEXT, XML_NOTES_CONFIGURATION,
+ XML_NAMESPACE_TEXT, XML_NOTE_CLASS,
+ XML_FOOTNOTE | (OOO_STYLE_REF_ACTIONS << 16) ),
+
+ // rename <text:endnote*> to <text:endnote*>
+ ENTRY3QQN( TEXT, ENDNOTE, XML_ETACTION_RENAME_ELEM_ADD_ATTR,
+ XML_NAMESPACE_TEXT, XML_NOTE,
+ XML_NAMESPACE_TEXT, XML_NOTE_CLASS, XML_ENDNOTE ),
+ ENTRY1Q( TEXT, ENDNOTE_BODY, XML_ETACTION_RENAME_ELEM,
+ XML_NAMESPACE_TEXT, XML_NOTE_BODY ),
+ ENTRY1Q( TEXT, ENDNOTE_CITATION, XML_ETACTION_RENAME_ELEM,
+ XML_NAMESPACE_TEXT, XML_NOTE_CITATION ),
+ ENTRY3QQN( TEXT, ENDNOTES_CONFIGURATION,
+ XML_ETACTION_RENAME_ELEM_ADD_PROC_ATTR,
+ XML_NAMESPACE_TEXT, XML_NOTES_CONFIGURATION,
+ XML_NAMESPACE_TEXT, XML_NOTE_CLASS,
+ XML_ENDNOTE | (OOO_STYLE_REF_ACTIONS << 16) ),
+
+ // rename <text:footnote> and <text:endnote> to <text:note>
+ ENTRY3QQN( TEXT, ENDNOTE_REF, XML_ETACTION_RENAME_ELEM_ADD_ATTR,
+ XML_NAMESPACE_TEXT, XML_NOTE_REF,
+ XML_NAMESPACE_TEXT, XML_NOTE_CLASS, XML_ENDNOTE ),
+ ENTRY3QQN( TEXT, FOOTNOTE_REF, XML_ETACTION_RENAME_ELEM_ADD_ATTR,
+ XML_NAMESPACE_TEXT, XML_NOTE_REF,
+ XML_NAMESPACE_TEXT, XML_NOTE_CLASS, XML_FOOTNOTE ),
+
+ // rename <text:tab-stop> to <text:tab>
+ ENTRY1Q( TEXT, TAB_STOP, XML_ETACTION_RENAME_ELEM,
+ XML_NAMESPACE_TEXT, XML_TAB ),
+
+ // replace <table:sub-table> with <table:table table:is-sub-table>
+ ENTRY3QQN( TABLE, SUB_TABLE, XML_ETACTION_RENAME_ELEM_ADD_ATTR,
+ XML_NAMESPACE_TABLE, XML_TABLE,
+ XML_NAMESPACE_TABLE, XML_IS_SUB_TABLE, XML_TRUE ),
+
+ // process *:style-name attributes
+ ENTRY1( TEXT, SECTION, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, SPAN, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, A, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, RUBY, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, RUBY_TEXT, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, DATE, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, TIME, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, VARIABLE_GET, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, USER_FIELD_GET, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, USER_FIELD_INPUT, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, CREATION_DATE, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, CREATION_TIME, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, PRINT_TIME, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, PRINT_DATE, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, EDITING_DURATION, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, MODIFICATION_TIME, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, MODIFICATION_DATE, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, DATABASE_DISPLAY, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, TABLE_FORMULA, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, INDEX_TITLE, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, TABLE_OF_CONTENT, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, TABLE_OF_CONTENT_ENTRY_TEMPLATE, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, ILLUSTRATION_INDEX, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, ILLUSTRATION_INDEX_ENTRY_TEMPLATE, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, TABLE_INDEX, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, TABLE_INDEX_ENTRY_TEMPLATE, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, OBJECT_INDEX, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, OBJECT_INDEX_ENTRY_TEMPLATE, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, USER_INDEX, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, USER_INDEX_ENTRY_TEMPLATE, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, ALPHABETICAL_INDEX, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, ALPHABETICAL_INDEX_ENTRY_TEMPLATE, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, BIBLIOGRAPHY, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, BIBLIOGRAPHY_ENTRY_TEMPLATE, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, INDEX_SOURCE_STYLE, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, INDEX_TITLE_TEMPLATE, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, INDEX_ENTRY_CHAPTER, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY2QN( TEXT, INDEX_ENTRY_CHAPTER_NUMBER,
+ XML_ETACTION_RENAME_ELEM_PROC_ATTRS,
+ XML_NAMESPACE_TEXT, XML_INDEX_ENTRY_CHAPTER,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, INDEX_ENTRY_TEXT, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, INDEX_ENTRY_PAGE_NUMBER, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, INDEX_ENTRY_SPAN, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, INDEX_ENTRY_BIBLIOGRAPHY, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, INDEX_ENTRY_LINK_START, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, INDEX_ENTRY_LINK_END, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( STYLE, HANDOUT_MASTER, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( DRAW, PAGE, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( STYLE, MAP, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( PRESENTATION, NOTES, XML_ETACTION_PROC_ATTRS,
+ OOO_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( STYLE, PRESENTATION_PAGE_LAYOUT, XML_ETACTION_PROC_ATTRS,
+ OOO_MASTER_PAGE_ACTIONS ),
+ /* Consider also attribute table:style-name for <table:table>,
+ <table:table-row> and <table:table-column>. (#i40011#, #i40015#)
+ */
+ ENTRY0( TABLE, TABLE, XML_ETACTION_TABLE ),
+ ENTRY1( TABLE, TABLE_ROW, XML_ETACTION_PROC_ATTRS, OOO_STYLE_REF_ACTIONS ),
+ ENTRY1( TABLE, TABLE_COLUMN, XML_ETACTION_PROC_ATTRS, OOO_STYLE_REF_ACTIONS ),
+
+ // split frame elements
+ ENTRY0( DRAW, TEXT_BOX, XML_ETACTION_FRAME ),
+ ENTRY0( DRAW, IMAGE, XML_ETACTION_FRAME ),
+ ENTRY0( DRAW, OBJECT, XML_ETACTION_FRAME ),
+ ENTRY0( DRAW, OBJECT_OLE, XML_ETACTION_FRAME ),
+ ENTRY0( DRAW, APPLET, XML_ETACTION_FRAME ),
+ ENTRY0( DRAW, PLUGIN, XML_ETACTION_FRAME ),
+ ENTRY0( DRAW, FLOATING_FRAME, XML_ETACTION_FRAME ),
+ ENTRY0( SVG, DESC, XML_ETACTION_COPY_TEXT ),
+
+ // process events
+ ENTRY1Q( OFFICE, EVENTS, XML_ETACTION_RENAME_ELEM,
+ XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS ),
+ ENTRY0( SCRIPT, EVENT, XML_ETACTION_EVENT ),
+ ENTRY0( PRESENTATION, EVENT, XML_ETACTION_EVENT ),
+
+ // process length attributes
+ ENTRY1( DRAW, RECT, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+ ENTRY1( DRAW, LINE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+ ENTRY1( DRAW, POLYLINE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+ ENTRY1( DRAW, POLYGON, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+ ENTRY1( DRAW, PATH, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+ ENTRY1( DRAW, CIRCLE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+ ENTRY1( DRAW, ELLIPSE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+ ENTRY1( DRAW, CONNECTOR, XML_ETACTION_PROC_ATTRS, OOO_CONNECTOR_ACTIONS ),
+ ENTRY1( DRAW, CAPTION, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+ ENTRY1( DRAW, CONTROL, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+ ENTRY1( DRAW, PAGE_THUMBNAIL, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+ ENTRY1( DRAW, MEASURE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+ ENTRY1( DRAW, G, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+// ENTRY1( DRAW, TEXT_BOX, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+ ENTRY1( PRESENTATION, PLACEHOLDER, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+ ENTRY1( DRAW, CONTOUR_POLYGON, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+ ENTRY1( DRAW, CONTOUR_PATH, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+ ENTRY1( DRAW, AREA_RECTANGLE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+ ENTRY1( DRAW, AREA_CIRCLE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+ ENTRY1( DRAW, AREA_POLYGON, XML_ETACTION_PROC_ATTRS, OOO_DRAW_AREA_POLYGON_ACTIONS ),
+ ENTRY1( DRAW, GLUE_POINT, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+ ENTRY1( DR3D, SCENE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+ ENTRY1( DR3D, CUBE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+ ENTRY1( DR3D, SPHERE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+ ENTRY1( DR3D, EXTRUDE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+ ENTRY1( DR3D, ROTATE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+ ENTRY1( CHART, TITLE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+ ENTRY1( CHART, SUBTITLE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+ ENTRY1( CHART, FOOTER, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+ ENTRY1( CHART, LEGEND, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+ ENTRY1( CHART, WALL, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+ ENTRY1( CHART, FLOOR, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+ ENTRY1( CHART, AXIS, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+ ENTRY1( CHART, GRID, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+ ENTRY1( CHART, SERIES, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+ ENTRY1( CHART, DATA_POINT, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+ ENTRY1( CHART, MEAN_VALUE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+ ENTRY1( CHART, ERROR_INDICATOR, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+ ENTRY1( CHART, REGRESSION_CURVE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+ ENTRY1( CHART, STOCK_GAIN_MARKER, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+ ENTRY1( CHART, STOCK_LOSS_MARKER, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+ ENTRY1( CHART, STOCK_RANGE_LINE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
+
+ ENTRY0( CHART, CHART, XML_ETACTION_CHART ),
+ ENTRY0( CHART, PLOT_AREA, XML_ETACTION_CHART_PLOT_AREA ),
+
+ ENTRY1Q( TEXT, TRACKED_CHANGES, XML_ETACTION_TRACKED_CHANGES,
+ XML_NAMESPACE_TEXT, XML_PROTECTION_KEY ),
+ ENTRY1Q( TABLE, TRACKED_CHANGES, XML_ETACTION_TRACKED_CHANGES,
+ XML_NAMESPACE_TABLE, XML_PROTECTION_KEY ),
+
+ ENTRY1( TEXT, INDEX_ENTRY_TAB_STOP, XML_ETACTION_PROC_ATTRS,
+ OOO_INDEX_ENTRY_TAB_STOP_ACTIONS ),
+ ENTRY0( STYLE, TAB_STOP, XML_ETACTION_TAB_STOP ),
+ ENTRY1( STYLE, BACKGROUND_IMAGE, XML_ETACTION_PROC_ATTRS,
+ OOO_BACKGROUND_IMAGE_ACTIONS ),
+ ENTRY1( TEXT, LINENUMBERING_CONFIGURATION, XML_ETACTION_PROC_ATTRS,
+ OOO_LINENUMBERING_ACTIONS ),
+ ENTRY1( STYLE, FOOTNOTE_SEP, XML_ETACTION_PROC_ATTRS,
+ OOO_FOOTNOTE_SEP_ACTIONS ),
+ ENTRY1( STYLE, DROP_CAP, XML_ETACTION_PROC_ATTRS, OOO_DROP_CAP_ACTIONS ),
+ ENTRY1( STYLE, COLUMNS, XML_ETACTION_PROC_ATTRS, OOO_COLUMNS_ACTIONS ),
+ ENTRY1( STYLE, COLUMN, XML_ETACTION_PROC_ATTRS, OOO_COLUMNS_ACTIONS ),
+
+ // rename office:value-* to *:value-*
+ ENTRY1( TEXT, VARIABLE_DECL, XML_ETACTION_PROC_ATTRS,
+ OOO_TEXT_VALUE_TYPE_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, VARIABLE_SET, XML_ETACTION_PROC_ATTRS,
+ OOO_TEXT_VALUE_TYPE_ACTIONS), /* generated entry */
+ ENTRY1( TEXT, VARIABLE_INPUT, XML_ETACTION_PROC_ATTRS,
+ OOO_TEXT_VALUE_TYPE_ACTIONS), /* generated entry */
+ ENTRY1( TEXT, USER_FIELD_DECL, XML_ETACTION_PROC_ATTRS,
+ OOO_TEXT_VALUE_TYPE_ACTIONS), /* generated entry */
+ ENTRY1( TEXT, EXPRESSION, XML_ETACTION_PROC_ATTRS,
+ OOO_TEXT_VALUE_TYPE_ACTIONS), /* generated entry */
+// ENTRY1( TEXT, USER_DEFINED, XML_ETACTION_PROC_ATTRS,
+// OOO_TEXT_VALUE_TYPE_ACTIONS), /* text:user-defined has no attrs so far */
+ ENTRY1( TABLE, TABLE_CELL, XML_ETACTION_PROC_ATTRS,
+ OOO_TABLE_VALUE_TYPE_ACTIONS), /* generated entry */
+ ENTRY1( TABLE, COVERED_TABLE_CELL, XML_ETACTION_PROC_ATTRS,
+ OOO_TABLE_VALUE_TYPE_ACTIONS), /* generated entry */
+ ENTRY1( TABLE, CHANGE_TRACK_TABLE_CELL, XML_ETACTION_PROC_ATTRS,
+ OOO_TABLE_VALUE_TYPE_ACTIONS), /* generated entry */
+// ENTRY1( FORM, PROPERTY, XML_ETACTION_PROC_ATTRS,
+// OOO_VALUE_TYPE_ACTIONS), /* TODO: generated entry */
+// ENTRY1( FORM, LIST_PROPERTY, XML_ETACTION_PROC_ATTRS,
+// OOO_VALUE_TYPE_ACTIONS), /* generated entry */
+
+ ENTRY1( OFFICE, ANNOTATION, XML_ETACTION_MOVE_ATTRS_TO_ELEMS,
+ OOO_ANNOTATION_ACTIONS ), /* generated entry */
+ ENTRY1( OFFICE, CHANGE_INFO, XML_ETACTION_MOVE_ATTRS_TO_ELEMS,
+ OOO_CHANGE_INFO_ACTIONS ), /* generated entry */
+
+ ENTRY1( TEXT, DDE_CONNECTION_DECL, XML_ETACTION_PROC_ATTRS,
+ OOO_DDE_CONNECTION_DECL_ACTIONS ),
+
+ ENTRY0( FORM, CONTROL, XML_ETACTION_FORM_CONTROL ),
+ ENTRY1( FORM, COLUMN, XML_ETACTION_PROC_ATTRS,
+ OOO_FORM_COLUMN_ACTIONS ),
+ ENTRY0( FORM, PROPERTY, XML_ETACTION_FORM_PROPERTY ),
+
+ // process xlink:href
+ ENTRY1( META, TEMPLATE, XML_ETACTION_PROC_ATTRS,
+ OOO_XLINK_ACTIONS ), /* generated entry */
+ ENTRY1( META, AUTO_RELOAD, XML_ETACTION_PROC_ATTRS,
+ OOO_XLINK_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, SECTION_SOURCE, XML_ETACTION_PROC_ATTRS,
+ OOO_XLINK_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, SCRIPT, XML_ETACTION_PROC_ATTRS,
+ OOO_XLINK_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, ALPHABETICAL_INDEX_AUTO_MARK_FILE, XML_ETACTION_PROC_ATTRS,
+ OOO_XLINK_ACTIONS ), /* generated entry */
+ ENTRY1( TABLE, TABLE_SOURCE, XML_ETACTION_PROC_ATTRS,
+ OOO_XLINK_ACTIONS ), /* generated entry */
+ ENTRY1( TABLE, CELL_RANGE_SOURCE, XML_ETACTION_PROC_ATTRS,
+ OOO_XLINK_ACTIONS ), /* generated entry */
+ ENTRY1( DRAW, A, XML_ETACTION_PROC_ATTRS,
+ OOO_XLINK_ACTIONS ), /* generated entry */
+ ENTRY1( PRESENTATION, SOUND, XML_ETACTION_PROC_ATTRS,
+ OOO_XLINK_ACTIONS ), /* generated entry */
+ ENTRY1( FORM, FORM, XML_ETACTION_PROC_ATTRS,
+ OOO_FORM_CONTROL_ACTIONS ),
+ ENTRY2QN( STYLE, SYMBOL_IMAGE, XML_ETACTION_RENAME_ELEM_PROC_ATTRS,
+ XML_NAMESPACE_CHART, XML_SYMBOL_IMAGE,
+ OOO_BACKGROUND_IMAGE_ACTIONS ),
+
+ ENTRY2QN( CONFIG, CONFIG_ITEM_SET, XML_ETACTION_PROC_ATTRS_COND,
+ XML_NAMESPACE_OFFICE, XML_SETTINGS,
+ OOO_CONFIG_ITEM_SET_ACTIONS ),
+
+ // add namespace prefix
+ // text:formula
+ ENTRY1( TEXT, SEQUENCE, XML_ETACTION_PROC_ATTRS,
+ OOO_FORMULA_ACTIONS ), /* generated entry */
+ // text:condition
+ ENTRY1( TEXT, DATABASE_NEXT, XML_ETACTION_PROC_ATTRS,
+ OOO_FORMULA_ACTIONS ), /* generated entry */
+ // text:condition
+ ENTRY2QN( TEXT, DATABASE_SELECT, XML_ETACTION_RENAME_ELEM_PROC_ATTRS,
+ XML_NAMESPACE_TEXT, XML_DATABASE_ROW_SELECT,
+ OOO_FORMULA_ACTIONS ),
+ // text:condition
+ ENTRY1( TEXT, CONDITIONAL_TEXT, XML_ETACTION_PROC_ATTRS,
+ OOO_FORMULA_ACTIONS ), /* generated entry */
+ // text:condition
+ ENTRY1( TEXT, HIDDEN_TEXT, XML_ETACTION_PROC_ATTRS,
+ OOO_FORMULA_ACTIONS ), /* generated entry */
+ // text:condition
+ ENTRY1( TEXT, HIDDEN_PARAGRAPH, XML_ETACTION_PROC_ATTRS,
+ OOO_FORMULA_ACTIONS ), /* generated entry */
+ // table:condition
+ ENTRY1( TABLE, CONTENT_VALIDATION, XML_ETACTION_PROC_ATTRS,
+ OOO_FORMULA_ACTIONS ), /* generated entry */
+
+ // rename <table:dependences> to <table:dependencies>
+ ENTRY1Q( TABLE, DEPENDENCES, XML_ETACTION_RENAME_ELEM,
+ XML_NAMESPACE_TABLE, XML_DEPENDENCIES ),
+ ENTRY1Q( TABLE, DEPENDENCE, XML_ETACTION_RENAME_ELEM,
+ XML_NAMESPACE_TABLE, XML_DEPENDENCY ),
+
+ // process table::error-macro
+ ENTRY1( TABLE, ERROR_MACRO, XML_ETACTION_PROC_ATTRS,
+ OOO_ERROR_MACRO_ACTIONS ),
+
+ // process table::conversion-mode
+ ENTRY1( TABLE, CONVERSION_MODE, XML_ETACTION_PROC_ATTRS,
+ OOO_DDE_CONV_MODE_ACTIONS ),
+
+ // fix <text:alphabatical-index-mark text:main-etry>
+ ENTRY1( TEXT, ALPHABETICAL_INDEX_MARK, XML_ETACTION_PROC_ATTRS,
+ OOO_ALPHABETICAL_INDEX_MARK_ACTIONS ),
+ ENTRY1( TEXT, ALPHABETICAL_INDEX_MARK_START, XML_ETACTION_PROC_ATTRS,
+ OOO_ALPHABETICAL_INDEX_MARK_ACTIONS ),
+
+ // process table::data-pilot-member
+ ENTRY1( TABLE, DATA_PILOT_MEMBER, XML_ETACTION_PROC_ATTRS,
+ OOO_DATAPILOT_MEMBER_ACTIONS ),
+
+ // process table::data-pilot-level
+ ENTRY1( TABLE, DATA_PILOT_LEVEL, XML_ETACTION_PROC_ATTRS,
+ OOO_DATAPILOT_LEVEL_ACTIONS ),
+
+ // process table::source-service
+ ENTRY1( TABLE, SOURCE_SERVICE, XML_ETACTION_PROC_ATTRS,
+ OOO_SOURCE_SERVICE_ACTIONS ),
+
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ETACTION_EOT )
+};
+
+// XML_ETACTION_STYLE
+static XMLTransformerActionInit aStyleActionTable[] =
+{
+ ENTRY0( STYLE, FAMILY, XML_ATACTION_STYLE_FAMILY ),
+ ENTRY0( STYLE, NAME, XML_ATACTION_ENCODE_STYLE_NAME ),
+ ENTRY0( STYLE, PARENT_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
+ ENTRY0( STYLE, NEXT_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
+ ENTRY0( STYLE, LIST_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
+ ENTRY0( STYLE, MASTER_PAGE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
+ ENTRY0( STYLE, DATA_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
+ ENTRY0( DRAW, NAME, XML_ATACTION_ENCODE_STYLE_NAME ),
+ ENTRY0( DRAW, DISTANCE, XML_ATACTION_INCH2IN ),
+ ENTRY0( DRAW, DOTS1_LENGTH, XML_ATACTION_INCH2IN ),
+ ENTRY0( DRAW, DOTS2_LENGTH, XML_ATACTION_INCH2IN ),
+ ENTRY0( SVG, WIDTH, XML_ATACTION_SVG_WIDTH_HEIGHT_OOO ),
+ ENTRY0( SVG, HEIGHT, XML_ATACTION_SVG_WIDTH_HEIGHT_OOO ),
+ ENTRY0( DRAW, START, XML_ATACTION_NEG_PERCENT ),
+ ENTRY0( DRAW, END, XML_ATACTION_NEG_PERCENT ),
+ ENTRY1( XLINK, HREF, XML_ATACTION_URI_OOO, sal_True ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OOO_FRAME_ELEM_ACTIONS
+static XMLTransformerActionInit aFrameElemActionTable[] =
+{
+ ENTRY1Q( OFFICE, EVENTS, XML_ETACTION_RENAME_ELEM,
+ XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS ),
+ ENTRY0( DRAW, GLUE_POINT, XML_ETACTION_COPY ),
+ ENTRY0( DRAW, IMAGE_MAP, XML_ETACTION_COPY ),
+ ENTRY0( SVG, DESC, XML_ETACTION_COPY_TEXT ),
+ ENTRY0( DRAW, CONTOUR_POLYGON, XML_ETACTION_COPY ),
+ ENTRY0( DRAW, CONTOUR_PATH, XML_ETACTION_COPY ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ETACTION_EOT )
+};
+
+// OOO_FRAME_ATTR_ACTIONS
+static XMLTransformerActionInit aFrameAttrActionTable[] =
+{
+ ENTRY0( DRAW, ZINDEX, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
+ ENTRY0( DRAW, ID, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
+ ENTRY0( DRAW, LAYER, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
+ ENTRY0( DRAW, STYLE_NAME, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
+ ENTRY0( PRESENTATION, STYLE_NAME, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
+ ENTRY0( DRAW, TRANSFORM, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
+ ENTRY0( DRAW, NAME, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
+ ENTRY0( TABLE, END_CELL_ADDRESS, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
+ ENTRY0( TABLE, END_X, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
+ ENTRY0( TABLE, END_Y, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
+ ENTRY0( TABLE, TABLE_BACKGROUND, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
+ ENTRY0( TEXT, ANCHOR_TYPE, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
+ ENTRY0( TEXT, ANCHOR_PAGE_NUMBER, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
+ ENTRY0( DRAW, TEXT_STYLE_NAME, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
+ ENTRY0( SVG, X, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
+ ENTRY0( SVG, Y, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
+ ENTRY0( SVG, WIDTH, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
+ ENTRY0( SVG, HEIGHT, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
+ ENTRY0( STYLE, REL_WIDTH, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
+ ENTRY0( STYLE, REL_HEIGHT, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
+ ENTRY0( PRESENTATION, CLASS, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
+ ENTRY0( PRESENTATION, PLACEHOLDER, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
+ ENTRY0( PRESENTATION, USER_TRANSFORMED, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OOO_EVENT_ELEM_ACTIONS
+static XMLTransformerActionInit aEventActionTable[] =
+{
+ ENTRY0( XLINK, HREF, XML_ATACTION_HREF ),
+ ENTRY1( SCRIPT, LANGUAGE, XML_ATACTION_ADD_NAMESPACE_PREFIX,
+ XML_NAMESPACE_OOO ),
+ ENTRY0( SCRIPT, EVENT_NAME, XML_ATACTION_EVENT_NAME ),
+ ENTRY0( SCRIPT, MACRO_NAME, XML_ATACTION_MACRO_NAME ),
+ ENTRY0( SCRIPT, LOCATION, XML_ATACTION_MACRO_LOCATION ),
+ ENTRY0( SCRIPT, LIBRARY, XML_ATACTION_MACRO_LOCATION ), // bug in draw
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+
+// action table for OOO_MASTER_PAGE_ACTIONS
+static XMLTransformerActionInit aMasterPageActionTable[] =
+{
+ ENTRY0( STYLE, NAME, XML_ATACTION_ENCODE_STYLE_NAME ),
+ ENTRY0( STYLE, NEXT_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
+ ENTRY1Q( STYLE, PAGE_MASTER_NAME, XML_ATACTION_RENAME_ENCODE_STYLE_NAME_REF,
+ XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_NAME ),
+ ENTRY0( DRAW, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+static XMLTransformerActionInit aFontDeclActionTable[] =
+{
+ ENTRY1Q( FO, FONT_FAMILY, XML_ATACTION_RENAME,
+ XML_NAMESPACE_SVG, XML_FONT_FAMILY ),
+ ENTRY1Q( STYLE, FONT_STYLE_NAME, XML_ATACTION_RENAME,
+ XML_NAMESPACE_STYLE, XML_FONT_ADORNMENTS ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// action table for OOO_PARA_ACTIONS
+static XMLTransformerActionInit aParaActionTable[] =
+{
+ ENTRY0( TEXT, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
+ ENTRY0( TEXT, COND_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
+// ENTRY0( TEXT, CLASS_NAMES, XML_ATACTION_REMOVE ),
+ ENTRY1Q( TEXT, LEVEL, XML_ATACTION_RENAME,
+ XML_NAMESPACE_TEXT, XML_OUTLINE_LEVEL ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// action table for OOO_STYLE_REF_ACTIONS
+static XMLTransformerActionInit aStyleRefActionTable[] =
+{
+ ENTRY0( TEXT, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
+ ENTRY0( TEXT, VISITED_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
+ ENTRY0( TEXT, MAIN_ENTRY_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
+ ENTRY0( TEXT, CITATION_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
+ ENTRY0( TEXT, CITATION_BODY_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
+ ENTRY0( TEXT, DEFAULT_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
+ ENTRY0( TEXT, MASTER_PAGE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
+ ENTRY0( STYLE, DATA_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
+ ENTRY0( STYLE, APPLY_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
+ ENTRY0( STYLE, PAGE_LAYOUT_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
+ ENTRY0( TABLE, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
+ ENTRY0( TABLE, DEFAULT_CELL_STYLE_NAME,
+ XML_ATACTION_ENCODE_STYLE_NAME_REF ),
+ ENTRY0( DRAW, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
+ ENTRY0( DRAW, MASTER_PAGE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
+ ENTRY0( PRESENTATION, PRESENTATION_PAGE_LAYOUT_NAME,
+ XML_ATACTION_ENCODE_STYLE_NAME_REF ),
+ ENTRY1( XLINK, HREF, XML_ATACTION_URI_OOO, sal_False ),
+ ENTRY1( TEXT, CONDITION, XML_ATACTION_ADD_NAMESPACE_PREFIX,
+ XML_NAMESPACE_OOOW ),
+ ENTRY1( TEXT, FORMULA, XML_ATACTION_ADD_NAMESPACE_PREFIX,
+ XML_NAMESPACE_OOOW ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OOO_SHAPE_ACTIONS
+// !!ATTENTION!! If you change something here, please also change
+// aConnectorActionTable if apropriate
+static XMLTransformerActionInit aShapeActionTable[] =
+{
+ ENTRY0( SVG, X, XML_ATACTION_INCH2IN ),
+ ENTRY0( SVG, Y, XML_ATACTION_INCH2IN ),
+ ENTRY0( SVG, X1, XML_ATACTION_INCH2IN ),
+ ENTRY0( SVG, Y1, XML_ATACTION_INCH2IN ),
+ ENTRY0( SVG, X2, XML_ATACTION_INCH2IN ),
+ ENTRY0( SVG, Y2, XML_ATACTION_INCH2IN ),
+ ENTRY0( SVG, CX, XML_ATACTION_INCH2IN ),
+ ENTRY0( SVG, CY, XML_ATACTION_INCH2IN ),
+ ENTRY0( SVG, R, XML_ATACTION_INCH2IN ),
+ ENTRY0( SVG, RX, XML_ATACTION_INCH2IN ),
+ ENTRY0( SVG, RY, XML_ATACTION_INCH2IN ),
+ ENTRY0( SVG, WIDTH, XML_ATACTION_SVG_WIDTH_HEIGHT_OOO ),
+ ENTRY0( SVG, HEIGHT, XML_ATACTION_SVG_WIDTH_HEIGHT_OOO ),
+ ENTRY0( FO, MIN_WIDTH, XML_ATACTION_INCH2IN ),
+ ENTRY0( FO, MIN_HEIGHT, XML_ATACTION_INCH2IN ),
+ ENTRY0( FO, MAX_WIDTH, XML_ATACTION_INCH2IN ),
+ ENTRY0( FO, MAX_HEIGHT, XML_ATACTION_INCH2IN ),
+ ENTRY0( DRAW, CORNER_RADIUS, XML_ATACTION_INCH2IN ),
+ ENTRY0( DRAW, LINE_SKEW, XML_ATACTION_INCHS2INS ),
+ ENTRY0( DRAW, CAPTION_POINT_X, XML_ATACTION_INCH2IN ),
+ ENTRY0( DRAW, CAPTION_POINT_Y, XML_ATACTION_INCH2IN ),
+ ENTRY0( DRAW, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
+ ENTRY0( DRAW, TEXT_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
+ ENTRY0( DRAW, END_X, XML_ATACTION_INCH2IN ),
+ ENTRY0( DRAW, END_Y, XML_ATACTION_INCH2IN ),
+ ENTRY0( PRESENTATION, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
+ ENTRY0( DR3D, DISTANCE, XML_ATACTION_INCH2IN ),
+ ENTRY0( DR3D, FOCAL_LENGTH, XML_ATACTION_INCH2IN ),
+ ENTRY1Q( FORM, ID, XML_ATACTION_RENAME,
+ XML_NAMESPACE_DRAW, XML_CONTROL ),
+ ENTRY1( XLINK, HREF, XML_ATACTION_URI_OOO, sal_True ),
+
+ // BM: needed by chart:legend. The legend needs also the draw actions. As
+ // there is no merge mechanism, all actions have to be in the same table
+ ENTRY2( CHART, LEGEND_POSITION, XML_ATACTION_RENAME_ATTRIBUTE,
+ RENAME_ENTRY( XML_LEFT, XML_START ),
+ RENAME_ENTRY( XML_RIGHT, XML_END )),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+static XMLTransformerActionInit aConnectorActionTable[] =
+{
+ ENTRY0( SVG, X1, XML_ATACTION_TWIPS2IN ),
+ ENTRY0( SVG, Y1, XML_ATACTION_TWIPS2IN ),
+ ENTRY0( SVG, X2, XML_ATACTION_TWIPS2IN ),
+ ENTRY0( SVG, Y2, XML_ATACTION_TWIPS2IN ),
+ ENTRY0( SVG, WIDTH, XML_ATACTION_SVG_WIDTH_HEIGHT_OOO ),
+ ENTRY0( SVG, HEIGHT, XML_ATACTION_SVG_WIDTH_HEIGHT_OOO ),
+ ENTRY0( FO, MIN_WIDTH, XML_ATACTION_INCH2IN ),
+ ENTRY0( FO, MIN_HEIGHT, XML_ATACTION_INCH2IN ),
+ ENTRY0( FO, MAX_WIDTH, XML_ATACTION_INCH2IN ),
+ ENTRY0( FO, MAX_HEIGHT, XML_ATACTION_INCH2IN ),
+ ENTRY0( DRAW, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
+ ENTRY0( DRAW, TEXT_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
+ ENTRY0( DRAW, END_X, XML_ATACTION_INCH2IN ),
+ ENTRY0( DRAW, END_Y, XML_ATACTION_INCH2IN ),
+ ENTRY0( PRESENTATION, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
+ ENTRY1Q( FORM, ID, XML_ATACTION_RENAME,
+ XML_NAMESPACE_DRAW, XML_CONTROL ),
+ ENTRY1( XLINK, HREF, XML_ATACTION_URI_OOO, sal_True ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OOO_INDEX_ENTRY_TAB_STOP_ACTIONS
+static XMLTransformerActionInit aIndexEntryTabStopActionTable[] =
+{
+ ENTRY0( STYLE, POSITION, XML_ATACTION_INCH2IN ),
+ ENTRY0( TEXT, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OOO_TAB_STOP_ACTIONS
+static XMLTransformerActionInit aTabStopActionTable[] =
+{
+ ENTRY0( STYLE, POSITION, XML_ATACTION_INCH2IN ),
+ ENTRY1Q( STYLE, LEADER_CHAR, XML_ATACTION_RENAME,
+ XML_NAMESPACE_STYLE, XML_LEADER_TEXT ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OOO_LINENUMBERING_ACTIONS
+static XMLTransformerActionInit aLineNumberingActionTable[] =
+{
+ ENTRY0( TEXT, OFFSET, XML_ATACTION_INCH2IN ),
+ ENTRY0( TEXT, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
+ ENTRY1Q( TEXT, COUNT_IN_FLOATING_FRAMES, XML_ATACTION_RENAME,
+ XML_NAMESPACE_TEXT, XML_COUNT_IN_TEXT_BOXES ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+static XMLTransformerActionInit aFootnoteSepActionTable[] =
+{
+ ENTRY0( STYLE, WIDTH, XML_ATACTION_INCH2IN ),
+ ENTRY0( STYLE, DISTANCE_BEFORE_SEP, XML_ATACTION_INCH2IN ),
+ ENTRY0( STYLE, DISTANCE_AFTER_SEP, XML_ATACTION_INCH2IN ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OOO_DROP_CAP_ACTIONS
+static XMLTransformerActionInit aDropCapActionTable[] =
+{
+ ENTRY0( STYLE, DISTANCE, XML_ATACTION_INCH2IN ),
+ ENTRY0( STYLE, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+static XMLTransformerActionInit aColumnsActionTable[] =
+{
+ ENTRY0( STYLE, COLUMN_GAP, XML_ATACTION_INCH2IN ),
+// ENTRY0( STYLE, SPACE_BEFORE, XML_ATACTION_INCH2IN ),
+// ENTRY0( STYLE, SPACE_AFTER, XML_ATACTION_INCH2IN ),
+ ENTRY1Q( FO, MARGIN_LEFT, XML_ATACTION_RENAME_INCH2IN,
+ XML_NAMESPACE_FO, XML_START_INDENT ),
+ ENTRY1Q( FO, MARGIN_RIGHT, XML_ATACTION_RENAME_INCH2IN,
+ XML_NAMESPACE_FO, XML_END_INDENT ),
+ ENTRY0( STYLE, WIDTH, XML_ATACTION_INCH2IN ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OOO_TEXT_VALUE_TYPE_ACTIONS
+static XMLTransformerActionInit aTextValueTypeActionTable[] =
+{
+ ENTRY1Q( TEXT, VALUE_TYPE, XML_ATACTION_RENAME,
+ XML_NAMESPACE_OFFICE, XML_VALUE_TYPE ),
+ ENTRY1Q( TEXT, VALUE, XML_ATACTION_RENAME,
+ XML_NAMESPACE_OFFICE, XML_VALUE ),
+ ENTRY1Q( TEXT, CURRENCY, XML_ATACTION_RENAME,
+ XML_NAMESPACE_OFFICE, XML_CURRENCY ),
+ ENTRY1Q( TEXT, DATE_VALUE, XML_ATACTION_RENAME,
+ XML_NAMESPACE_OFFICE, XML_DATE_VALUE ),
+ ENTRY1Q( TEXT, TIME_VALUE, XML_ATACTION_RENAME,
+ XML_NAMESPACE_OFFICE, XML_TIME_VALUE ),
+ ENTRY1Q( TEXT, BOOLEAN_VALUE, XML_ATACTION_RENAME,
+ XML_NAMESPACE_OFFICE, XML_BOOLEAN_VALUE ),
+ ENTRY1Q( TEXT, STRING_VALUE, XML_ATACTION_RENAME,
+ XML_NAMESPACE_OFFICE, XML_STRING_VALUE ),
+ ENTRY0( STYLE, DATA_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
+ ENTRY1( TEXT, FORMULA, XML_ATACTION_ADD_NAMESPACE_PREFIX,
+ XML_NAMESPACE_OOOW ),
+ ENTRY0( TEXT, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OOO_TABLE_VALUE_TYPE_ACTIONS
+static XMLTransformerActionInit aTableValueTypeActionTable[] =
+{
+ ENTRY1Q( TABLE, VALUE_TYPE, XML_ATACTION_RENAME,
+ XML_NAMESPACE_OFFICE, XML_VALUE_TYPE ),
+ ENTRY1Q( TABLE, VALUE, XML_ATACTION_RENAME,
+ XML_NAMESPACE_OFFICE, XML_VALUE ),
+ ENTRY1Q( TABLE, CURRENCY, XML_ATACTION_RENAME,
+ XML_NAMESPACE_OFFICE, XML_CURRENCY ),
+ ENTRY1Q( TABLE, DATE_VALUE, XML_ATACTION_RENAME,
+ XML_NAMESPACE_OFFICE, XML_DATE_VALUE ),
+ ENTRY1Q( TABLE, TIME_VALUE, XML_ATACTION_RENAME,
+ XML_NAMESPACE_OFFICE, XML_TIME_VALUE ),
+ ENTRY1Q( TABLE, BOOLEAN_VALUE, XML_ATACTION_RENAME,
+ XML_NAMESPACE_OFFICE, XML_BOOLEAN_VALUE ),
+ ENTRY1Q( TABLE, STRING_VALUE, XML_ATACTION_RENAME,
+ XML_NAMESPACE_OFFICE, XML_STRING_VALUE ),
+ ENTRY0( TABLE, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
+ ENTRY1( TABLE, FORMULA, XML_ATACTION_ADD_APP_NAMESPACE_PREFIX,
+ XML_NAMESPACE_OOOW ),
+ ENTRY1Q( TABLE, VALIDATION_NAME, XML_ATACTION_RENAME,
+ XML_NAMESPACE_TABLE, XML_CONTENT_VALIDATION_NAME ),
+ ENTRY0( TABLE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// action table for OOO_ANNOTATION_ACTIONS
+static XMLTransformerActionInit aAnnotationActionTable[] =
+{
+ ENTRY1Q( OFFICE, AUTHOR, XML_ATACTION_MOVE_TO_ELEM,
+ XML_NAMESPACE_DC, XML_CREATOR ),
+ ENTRY1Q( OFFICE, CREATE_DATE, XML_ATACTION_MOVE_TO_ELEM,
+ XML_NAMESPACE_DC, XML_DATE ),
+ ENTRY1Q( OFFICE, CREATE_DATE_STRING, XML_ATACTION_MOVE_TO_ELEM,
+ XML_NAMESPACE_META, XML_DATE_STRING ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// action table for OOO_CHANGE_INFO_ACTIONS
+static XMLTransformerActionInit aChangeInfoActionTable[] =
+{
+ ENTRY1Q( OFFICE, CHG_AUTHOR, XML_ATACTION_MOVE_TO_ELEM,
+ XML_NAMESPACE_DC, XML_CREATOR ),
+ ENTRY1Q( OFFICE, CHG_DATE_TIME, XML_ATACTION_MOVE_TO_ELEM,
+ XML_NAMESPACE_DC, XML_DATE ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OOO_BACKGROUND_IMAGE_ACTIONS
+static XMLTransformerActionInit aBackgroundImageActionTable[] =
+{
+ ENTRY1Q( DRAW, TRANSPARENCY, XML_ATACTION_RENAME_NEG_PERCENT,
+ XML_NAMESPACE_DRAW, XML_OPACITY ),
+ ENTRY1( XLINK, HREF, XML_ATACTION_URI_OOO, sal_True ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+/* OOO_BACKGROUND_IMAGE_ACTIONS for OpenOffice.org text documents
+ OpenOffice.org text documents, written by OpenOffice.org, contain
+ wrong value for the transparency of the background graphic (#i50322#)
+*/
+static XMLTransformerActionInit aWriterBackgroundImageActionTable[] =
+{
+ ENTRY1Q( DRAW, TRANSPARENCY, XML_ATACTION_WRITER_BACK_GRAPHIC_TRANSPARENCY, XML_NAMESPACE_DRAW, XML_OPACITY ),
+ ENTRY1( XLINK, HREF, XML_ATACTION_URI_OOO, sal_True ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OOO_DDE_CONNECTION_DECL
+static XMLTransformerActionInit aDDEConnectionDeclActionTable[] =
+{
+ ENTRY1Q( TEXT, NAME, XML_ATACTION_RENAME,
+ XML_NAMESPACE_OFFICE, XML_NAME ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OOO_FORM_CONTROL_ACTIONS
+static XMLTransformerActionInit aFormControlActionTable[] =
+{
+ ENTRY2QN( FORM, SERVICE_NAME,
+ XML_ATACTION_RENAME_ADD_NAMESPACE_PREFIX,
+ XML_NAMESPACE_FORM, XML_CONTROL_IMPLEMENTATION,
+ XML_NAMESPACE_OOO ),
+ ENTRY1( XLINK, HREF, XML_ATACTION_URI_OOO, sal_False ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OOO_FORM_COLUMN_ACTIONS
+static XMLTransformerActionInit aFormColumnActionTable[] =
+{
+ ENTRY1Q( FORM, COLUMN_STYLE_NAME, XML_ATACTION_RENAME_ENCODE_STYLE_NAME_REF,
+ XML_NAMESPACE_FORM, XML_TEXT_STYLE_NAME ),
+ ENTRY2QN( FORM, SERVICE_NAME,
+ XML_ATACTION_RENAME_ADD_NAMESPACE_PREFIX,
+ XML_NAMESPACE_FORM, XML_CONTROL_IMPLEMENTATION,
+ XML_NAMESPACE_OOO ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OOO_FORM_PROP_ACTIONS
+static XMLTransformerActionInit aFormPropActionTable[] =
+{
+ ENTRY1Q( FORM, PROPERTY_TYPE, XML_ATACTION_RENAME,
+ XML_NAMESPACE_OFFICE, XML_VALUE_TYPE ),
+ ENTRY0( FORM, PROPERTY_IS_LIST, XML_ATACTION_REMOVE ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OOO_XLINK_ACTIONS
+static XMLTransformerActionInit aXLinkActionTable[] =
+{
+ ENTRY1( XLINK, HREF, XML_ATACTION_URI_OOO, sal_False ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OOO_CONFIG_ITEM_SET_ACTIONS
+static XMLTransformerActionInit aConfigItemSetActionTable[] =
+{
+ ENTRY1( CONFIG, NAME, XML_ATACTION_ADD_NAMESPACE_PREFIX,
+ XML_NAMESPACE_OOO ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OASIS_FORMULA_ACTIONS
+static XMLTransformerActionInit aFormulaActionTable[] =
+{
+ ENTRY1( TEXT, CONDITION, XML_ATACTION_ADD_NAMESPACE_PREFIX,
+ XML_NAMESPACE_OOOW ),
+ ENTRY1( TEXT, FORMULA, XML_ATACTION_ADD_NAMESPACE_PREFIX,
+ XML_NAMESPACE_OOOW ),
+ ENTRY1( TABLE, CONDITION, XML_ATACTION_ADD_APP_NAMESPACE_PREFIX,
+ XML_NAMESPACE_OOOW ),
+ ENTRY1( TABLE, FORMULA, XML_ATACTION_ADD_APP_NAMESPACE_PREFIX,
+ XML_NAMESPACE_OOOW ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OOO_ERROR_MACRO_ACTIONS
+static XMLTransformerActionInit aErrorMacroActionTable[] =
+{
+ ENTRY0( TABLE, NAME, XML_ATACTION_REMOVE ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OOO_DDE_CONV_MODE_ACTIONS
+static XMLTransformerActionInit aDDEConvModeActionTable[] =
+{
+ ENTRY1Q( TABLE, LET_TEXT, XML_ATACTION_RENAME,
+ XML_NAMESPACE_TABLE, XML_KEEP_TEXT ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OOO_DATAPILOT_MEMBER_ACTIONS
+static XMLTransformerActionInit aDataPilotMemberActionTable[] =
+{
+ ENTRY1Q( TABLE, DISPLAY_DETAILS, XML_ATACTION_RENAME,
+ XML_NAMESPACE_TABLE, XML_SHOW_DETAILS ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OOO_DATAPILOT_LEVEL_ACTIONS
+static XMLTransformerActionInit aDataPilotLevelActionTable[] =
+{
+ ENTRY1Q( TABLE, DISPLAY_EMPTY, XML_ATACTION_RENAME,
+ XML_NAMESPACE_TABLE, XML_SHOW_EMPTY ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OOO_SOURCE_SERVICE_ACTIONS
+static XMLTransformerActionInit aSourceServiceActionTable[] =
+{
+ ENTRY1Q( TABLE, USERNAME, XML_ATACTION_RENAME,
+ XML_NAMESPACE_TABLE, XML_USER_NAME ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OOO_DRAW_AREA_POLYGON_ACTIONS (to be added to OOO_SHAPE_ACTIONS)
+static XMLTransformerActionInit aDrawAreaPolygonActionTable[] =
+{
+ ENTRY1Q( SVG, POINTS, XML_ATACTION_RENAME,
+ XML_NAMESPACE_DRAW, XML_POINTS ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OOO_CHART_ACTIONS
+static XMLTransformerActionInit aChartActionTable[] =
+{
+ ENTRY1( CHART, CLASS, XML_ATACTION_ADD_NAMESPACE_PREFIX,
+ XML_NAMESPACE_CHART ),
+ ENTRY0( CHART, ADD_IN_NAME, XML_ATACTION_REMOVE ),
+ ENTRY0( SVG, WIDTH, XML_ATACTION_INCH2IN ),
+ ENTRY0( SVG, HEIGHT, XML_ATACTION_INCH2IN ),
+ ENTRY0( CHART, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OOO_ALPHABETICAL_INDEX_MARK_ACTIONS
+static XMLTransformerActionInit aAlphabeticalIndexMarkActionTable[] =
+{
+ ENTRY1Q( TEXT, MAIN_ETRY, XML_ATACTION_RENAME,
+ XML_NAMESPACE_TEXT, XML_MAIN_ENTRY ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OOO_SCRIPT_ACTIONS
+static XMLTransformerActionInit aScriptActionTable[] =
+{
+ ENTRY1( SCRIPT, LANGUAGE, XML_ATACTION_ADD_NAMESPACE_PREFIX, XML_NAMESPACE_OOO ),
+ ENTRY1Q( SCRIPT, NAME, XML_ATACTION_RENAME, XML_NAMESPACE_OOO, XML_NAME ),
+ ENTRY1Q( SCRIPT, READONLY, XML_ATACTION_RENAME, XML_NAMESPACE_OOO, XML_READONLY ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+static XMLTokenEnum aTokenMap[] =
+{
+ XML_NONE, XML_SINGLE, XML_DOUBLE, XML_BOLD, XML_BOLD_DOTTED,
+ XML_BOLD_DASH, XML_BOLD_LONG_DASH, XML_BOLD_DOT_DASH,
+ XML_BOLD_DOT_DOT_DASH, XML_BOLD_WAVE, XML_DOUBLE_WAVE,
+ XML_SINGLE_LINE, XML_DOUBLE_LINE, XML_THICK_LINE, XML_SLASH, XML_uX,
+ XML_TOKEN_END
+};
+
+//-----------------------------------------------------------------------------
+
+class XMLDocumentTransformerContext_Impl : public XMLTransformerContext
+{
+ ::rtl::OUString m_aElemQName;
+ ::rtl::OUString m_aOldClass;
+
+public:
+ TYPEINFO();
+
+ XMLDocumentTransformerContext_Impl( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName );
+ XMLDocumentTransformerContext_Impl( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName,
+ sal_uInt16 nPrefix,
+ ::xmloff::token::XMLTokenEnum eToken );
+
+ virtual ~XMLDocumentTransformerContext_Impl();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+};
+
+TYPEINIT1( XMLDocumentTransformerContext_Impl, XMLTransformerContext );
+
+XMLDocumentTransformerContext_Impl::XMLDocumentTransformerContext_Impl(
+ XMLTransformerBase& rImp,
+ const OUString& rQName ) :
+ XMLTransformerContext( rImp, rQName ),
+ m_aElemQName( rQName )
+{
+}
+XMLDocumentTransformerContext_Impl::XMLDocumentTransformerContext_Impl(
+ XMLTransformerBase& rImp,
+ const OUString& rQName ,
+ sal_uInt16 nPrefix,
+ ::xmloff::token::XMLTokenEnum eToken) :
+ XMLTransformerContext( rImp, rQName ),
+ m_aElemQName( rImp.GetNamespaceMap().GetQNameByKey( nPrefix,
+ ::xmloff::token::GetXMLToken( eToken ) ) )
+{
+}
+
+XMLDocumentTransformerContext_Impl::~XMLDocumentTransformerContext_Impl()
+{
+}
+
+void XMLDocumentTransformerContext_Impl::StartElement(
+ const Reference< XAttributeList >& rAttrList )
+{
+ Reference< XAttributeList > xAttrList( rAttrList );
+
+ m_aOldClass = GetTransformer().GetClass();
+
+ XMLMutableAttributeList *pMutableAttrList = 0;
+ sal_Bool bOOo = sal_False, bOOoW = sal_False, bOOoC = sal_False,
+ bDOM=sal_False, bDC = sal_False, bSVG = sal_False;
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ if( XML_NAMESPACE_OFFICE == nPrefix &&
+ IsXMLToken( aLocalName, XML_CLASS ) )
+ {
+ const OUString& rValue = xAttrList->getValueByIndex( i );
+ GetTransformer().SetClass( rValue );
+
+ pMutableAttrList = new XMLMutableAttributeList( xAttrList );
+ xAttrList = pMutableAttrList;
+ OUString sMime(RTL_CONSTASCII_USTRINGPARAM("application/vnd.oasis.opendocument.") );
+ sMime += rValue;
+ pMutableAttrList->SetValueByIndex( i, sMime );
+ OUString aNewAttrQName( GetTransformer().GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_OFFICE, ::xmloff::token::GetXMLToken( XML_MIMETYPE ) ) );
+ pMutableAttrList->RenameAttributeByIndex(i, aNewAttrQName );
+ break;
+ }
+ else if( XML_NAMESPACE_XMLNS == nPrefix )
+ {
+ const OUString& rAttrValue = xAttrList->getValueByIndex( i );
+ if( IsXMLToken( rAttrValue, XML_N_OOO ) )
+ bOOo = sal_True;
+ else if( IsXMLToken( rAttrValue, XML_N_OOOW ) )
+ bOOoW = sal_True;
+ else if( IsXMLToken( rAttrValue, XML_N_OOOC ) )
+ bOOoC = sal_True;
+ else if( IsXMLToken( rAttrValue, XML_N_DOM ) )
+ bDOM = sal_True;
+ else if( IsXMLToken( rAttrValue, XML_N_DC ) )
+ bDC = sal_True;
+ else if( IsXMLToken( rAttrValue, XML_N_SVG ) )
+ bSVG = sal_True;
+ }
+ }
+ if( !(bOOo && bOOoW && bOOoC && bDOM && bDC && bSVG) )
+ {
+ if( !pMutableAttrList )
+ {
+ pMutableAttrList = new XMLMutableAttributeList( xAttrList );
+ xAttrList = pMutableAttrList;
+ }
+ if( !bOOo )
+ pMutableAttrList->AddAttribute(
+ GetTransformer().GetNamespaceMap().GetAttrNameByKey(
+ XML_NAMESPACE_OOO ),
+ GetTransformer().GetNamespaceMap().GetNameByKey(
+ XML_NAMESPACE_OOO ) );
+ if( !bOOoW )
+ pMutableAttrList->AddAttribute(
+ GetTransformer().GetNamespaceMap().GetAttrNameByKey(
+ XML_NAMESPACE_OOOW ),
+ GetTransformer().GetNamespaceMap().GetNameByKey(
+ XML_NAMESPACE_OOOW ) );
+ if( !bOOoC )
+ pMutableAttrList->AddAttribute(
+ GetTransformer().GetNamespaceMap().GetAttrNameByKey(
+ XML_NAMESPACE_OOOC ),
+ GetTransformer().GetNamespaceMap().GetNameByKey(
+ XML_NAMESPACE_OOOC ) );
+ if( !bDOM )
+ pMutableAttrList->AddAttribute(
+ GetTransformer().GetNamespaceMap().GetAttrNameByKey(
+ XML_NAMESPACE_DOM ),
+ GetTransformer().GetNamespaceMap().GetNameByKey(
+ XML_NAMESPACE_DOM ) );
+ if( !bDC )
+ pMutableAttrList->AddAttribute(
+ GetTransformer().GetNamespaceMap().GetAttrNameByKey(
+ XML_NAMESPACE_DC ),
+ GetTransformer().GetNamespaceMap().GetNameByKey(
+ XML_NAMESPACE_DC ) );
+ if( !bSVG )
+ pMutableAttrList->AddAttribute(
+ GetTransformer().GetNamespaceMap().GetAttrNameByKey(
+ XML_NAMESPACE_SVG ),
+ GetTransformer().GetNamespaceMap().GetNameByKey(
+ XML_NAMESPACE_SVG ) );
+ }
+
+ GetTransformer().GetDocHandler()->startElement( m_aElemQName, xAttrList );
+}
+
+void XMLDocumentTransformerContext_Impl::EndElement()
+{
+ GetTransformer().GetDocHandler()->endElement( m_aElemQName );
+
+ GetTransformer().SetClass( m_aOldClass );
+}
+
+//-----------------------------------------------------------------------------
+
+class XMLBodyTransformerContext_Impl : public XMLTransformerContext
+{
+ OUString m_aClassQName;
+
+public:
+ TYPEINFO();
+
+ XMLBodyTransformerContext_Impl( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName );
+
+ virtual ~XMLBodyTransformerContext_Impl();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+};
+
+TYPEINIT1( XMLBodyTransformerContext_Impl, XMLTransformerContext );
+
+XMLBodyTransformerContext_Impl::XMLBodyTransformerContext_Impl(
+ XMLTransformerBase& rImp,
+ const OUString& rQName ) :
+ XMLTransformerContext( rImp, rQName )
+{
+}
+
+XMLBodyTransformerContext_Impl::~XMLBodyTransformerContext_Impl()
+{
+}
+
+void XMLBodyTransformerContext_Impl::StartElement(
+ const Reference< XAttributeList >& rAttrList )
+{
+ XMLTransformerContext::StartElement( rAttrList );
+
+ XMLMutableAttributeList *pMutableAttrList =
+ new XMLMutableAttributeList( rAttrList );
+ Reference< XAttributeList > xAttrList = pMutableAttrList;
+ OUString aClass( GetTransformer().GetClass() );
+ if( !aClass.getLength() )
+ {
+ aClass = GetXMLToken( XML_TEXT );
+ }
+ else if( IsXMLToken( aClass, XML_TEXT_GLOBAL ) )
+ {
+ OUString aGlobalQName(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_TEXT, GetXMLToken(XML_GLOBAL ) ) );
+ pMutableAttrList->AddAttribute( aGlobalQName, GetXMLToken(XML_TRUE) );
+
+ aClass = GetXMLToken( XML_TEXT );
+ }
+
+ m_aClassQName = GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_OFFICE, aClass );
+ GetTransformer().GetDocHandler()->startElement( m_aClassQName,
+ xAttrList );
+}
+
+void XMLBodyTransformerContext_Impl::EndElement()
+{
+ GetTransformer().GetDocHandler()->endElement( m_aClassQName );
+ XMLTransformerContext::EndElement();
+}
+
+//-----------------------------------------------------------------------------
+
+class XMLTabStopOOoTContext_Impl : public XMLPersElemContentTContext
+{
+public:
+ TYPEINFO();
+
+ XMLTabStopOOoTContext_Impl( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName );
+
+ virtual ~XMLTabStopOOoTContext_Impl();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+};
+
+TYPEINIT1( XMLTabStopOOoTContext_Impl, XMLPersElemContentTContext );
+
+XMLTabStopOOoTContext_Impl::XMLTabStopOOoTContext_Impl(
+ XMLTransformerBase& rImp,
+ const OUString& rQName ) :
+ XMLPersElemContentTContext( rImp, rQName )
+{
+}
+
+XMLTabStopOOoTContext_Impl::~XMLTabStopOOoTContext_Impl()
+{
+}
+
+void XMLTabStopOOoTContext_Impl::StartElement(
+ const Reference< XAttributeList >& rAttrList )
+{
+ XMLTransformerActions *pActions =
+ GetTransformer().GetUserDefinedActions( OOO_TAB_STOP_ACTIONS );
+ OSL_ENSURE( pActions, "go no actions" );
+
+ Reference< XAttributeList > xAttrList( rAttrList );
+ XMLMutableAttributeList *pMutableAttrList = 0;
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ XMLTransformerActions::key_type aKey( nPrefix, aLocalName );
+ XMLTransformerActions::const_iterator aIter =
+ pActions->find( aKey );
+ if( !(aIter == pActions->end() ) )
+ {
+ if( !pMutableAttrList )
+ {
+ pMutableAttrList =
+ new XMLMutableAttributeList( xAttrList );
+ xAttrList = pMutableAttrList;
+ }
+ const OUString& rAttrValue = xAttrList->getValueByIndex( i );
+ switch( (*aIter).second.m_nActionType )
+ {
+ case XML_ATACTION_RENAME:
+ {
+ OUString aNewAttrQName(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ (*aIter).second.GetQNamePrefixFromParam1(),
+ ::xmloff::token::GetXMLToken(
+ (*aIter).second.GetQNameTokenFromParam1()) ) );
+ pMutableAttrList->RenameAttributeByIndex( i,
+ aNewAttrQName );
+ }
+ if( IsXMLToken( aLocalName, XML_LEADER_CHAR ) &&
+ rAttrValue.getLength() > 0 &&
+ rAttrValue[0] != ' ' )
+ {
+ OUString aNewAttrQName(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_STYLE,
+ ::xmloff::token::GetXMLToken(XML_LEADER_STYLE) ) );
+ pMutableAttrList->AddAttribute( aNewAttrQName,
+ GetXMLToken( XML_SOLID ) );
+ }
+ break;
+ case XML_ATACTION_INCH2IN:
+ {
+ OUString aAttrValue( rAttrValue );
+ if( XMLTransformerBase::ReplaceSingleInchWithIn(
+ aAttrValue ) )
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ break;
+ default:
+ OSL_ENSURE( !this, "unknown action" );
+ break;
+ }
+ }
+ }
+
+ XMLPersElemContentTContext::StartElement( xAttrList );
+}
+
+// -----------------------------------------------------------------------------
+
+class XMLTrackedChangesOOoTContext_Impl : public XMLTransformerContext
+{
+ sal_uInt16 m_nPrefix;
+ XMLTokenEnum m_eToken;
+
+public:
+
+ TYPEINFO();
+
+ XMLTrackedChangesOOoTContext_Impl( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName,
+ sal_uInt16 nPrefix,
+ XMLTokenEnum eToken );
+
+ virtual ~XMLTrackedChangesOOoTContext_Impl();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+};
+
+TYPEINIT1( XMLTrackedChangesOOoTContext_Impl, XMLTransformerContext );
+
+XMLTrackedChangesOOoTContext_Impl::XMLTrackedChangesOOoTContext_Impl(
+ XMLTransformerBase& rImp,
+ const OUString& rQName,
+ sal_uInt16 nPrefix,
+ XMLTokenEnum eToken ) :
+ XMLTransformerContext( rImp, rQName ),
+ m_nPrefix( nPrefix ),
+ m_eToken( eToken )
+{
+}
+
+XMLTrackedChangesOOoTContext_Impl::~XMLTrackedChangesOOoTContext_Impl()
+{
+}
+
+void XMLTrackedChangesOOoTContext_Impl::StartElement(
+ const Reference< XAttributeList >& rAttrList )
+{
+ Reference< XAttributeList > xAttrList( rAttrList );
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ if( m_nPrefix == nPrefix && IsXMLToken( aLocalName, m_eToken ) )
+ {
+ const Reference< XPropertySet > rPropSet =
+ GetTransformer().GetPropertySet();
+ OSL_ENSURE( rPropSet.is(), "no info property set" );
+ if( rPropSet.is() )
+ {
+ const sal_Char sRedlineProtectionKey[] = "RedlineProtectionKey";
+ OUString aPropName(RTL_CONSTASCII_USTRINGPARAM(sRedlineProtectionKey));
+ Reference< XPropertySetInfo > xPropSetInfo(
+ rPropSet->getPropertySetInfo() );
+ if( xPropSetInfo.is() &&
+ xPropSetInfo->hasPropertyByName( aPropName ) )
+ {
+ Sequence < sal_Int8 > aKey;
+ SvXMLUnitConverter::decodeBase64( aKey,
+ xAttrList->getValueByIndex( i ) );
+ rPropSet->setPropertyValue( aPropName, makeAny( aKey ) );
+ }
+ else
+ {
+ OSL_ENSURE( !this, "RedineProtectionKey is missing" );
+ }
+ }
+ break;
+ }
+ }
+ XMLTransformerContext::StartElement( xAttrList );
+}
+
+// -----------------------------------------------------------------------------
+
+class XMLTableOOoTransformerContext_Impl : public XMLTransformerContext
+{
+ ::rtl::OUString m_aElemQName;
+
+public:
+ TYPEINFO();
+
+ XMLTableOOoTransformerContext_Impl( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName );
+
+ virtual ~XMLTableOOoTransformerContext_Impl();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+};
+
+TYPEINIT1( XMLTableOOoTransformerContext_Impl, XMLTransformerContext );
+
+XMLTableOOoTransformerContext_Impl::XMLTableOOoTransformerContext_Impl(
+ XMLTransformerBase& rImp,
+ const OUString& rQName ) :
+ XMLTransformerContext( rImp, rQName ),
+ m_aElemQName( rQName )
+{
+}
+
+XMLTableOOoTransformerContext_Impl::~XMLTableOOoTransformerContext_Impl()
+{
+}
+
+void XMLTableOOoTransformerContext_Impl::StartElement(
+ const Reference< XAttributeList >& rAttrList )
+{
+ // Perform OOO_STYLE_REF_ACTIONS for all applications (#i50521#)
+ Reference< XAttributeList > xAttrList( rAttrList );
+ XMLMutableAttributeList* pMutableAttrList =
+ GetTransformer().ProcessAttrList( xAttrList, OOO_STYLE_REF_ACTIONS, sal_False );
+ if( rAttrList->getLength() && IsXMLToken( GetTransformer().GetClass(), XML_SPREADSHEET ) )
+ {
+ sal_Bool bPrintRanges(sal_False);
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ if( XML_NAMESPACE_TABLE == nPrefix &&
+ IsXMLToken( aLocalName, XML_PRINT_RANGES ) )
+ {
+ bPrintRanges = sal_True;
+ }
+ }
+ if (!bPrintRanges && pMutableAttrList)
+ {
+ xAttrList = pMutableAttrList;
+ pMutableAttrList->AddAttribute(GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_TABLE,
+ GetXMLToken( XML_PRINT ) ), GetXMLToken ( XML_FALSE ));
+ }
+ }
+
+ GetTransformer().GetDocHandler()->startElement( m_aElemQName, xAttrList );
+}
+
+void XMLTableOOoTransformerContext_Impl::EndElement()
+{
+ GetTransformer().GetDocHandler()->endElement( m_aElemQName );
+}
+
+
+//-----------------------------------------------------------------------------
+
+XMLTransformerContext *OOo2OasisTransformer::CreateUserDefinedContext(
+ const TransformerAction_Impl& rAction,
+ const OUString& rQName,
+ sal_Bool bPersistent )
+{
+ switch( rAction.m_nActionType )
+ {
+ case XML_ETACTION_DOCUMENT:
+ return new XMLDocumentTransformerContext_Impl( *this, rQName );
+ case XML_ETACTION_DOCUMENT_RENAME:
+ return new XMLDocumentTransformerContext_Impl( *this, rQName,
+ rAction.GetQNamePrefixFromParam1(),
+ rAction.GetQNameTokenFromParam1() );
+ case XML_ETACTION_BODY:
+ return new XMLBodyTransformerContext_Impl( *this, rQName );
+ case XML_ETACTION_STYLE:
+ return new XMLStyleOOoTContext( *this, rQName,
+ static_cast< XMLFamilyType >( rAction.m_nParam1 ),
+ bPersistent );
+ case XML_ETACTION_STYLE_RENAME:
+ return new XMLStyleOOoTContext( *this, rQName,
+ static_cast< XMLFamilyType >( rAction.m_nParam2 ),
+ rAction.GetQNamePrefixFromParam1(),
+ rAction.GetQNameTokenFromParam1(),
+ bPersistent );
+ case XML_ETACTION_FRAME:
+ return new XMLFrameOOoTransformerContext( *this, rQName );
+ case XML_ETACTION_EVENT:
+ return new XMLEventOOoTransformerContext( *this, rQName, bPersistent );
+ case XML_ETACTION_TAB_STOP:
+ return new XMLTabStopOOoTContext_Impl( *this, rQName );
+ case XML_ETACTION_FORM_CONTROL:
+ return new XMLControlOOoTransformerContext( *this, rQName );
+ case XML_ETACTION_FORM_PROPERTY:
+ return new XMLFormPropOOoTransformerContext( *this, rQName );
+ case XML_ETACTION_CHART:
+ return new XMLChartOOoTransformerContext( *this, rQName );
+ case XML_ETACTION_TRACKED_CHANGES:
+ return new XMLTrackedChangesOOoTContext_Impl( *this, rQName,
+ rAction.GetQNamePrefixFromParam1(),
+ rAction.GetQNameTokenFromParam1() );
+ case XML_ETACTION_CHART_PLOT_AREA:
+ return new XMLChartPlotAreaOOoTContext( *this, rQName );
+ case XML_ETACTION_TABLE:
+ return new XMLTableOOoTransformerContext_Impl( *this, rQName );
+ default:
+ OSL_ENSURE( !this, "no user defined context found!" );
+ }
+
+ // default is copying
+ return new XMLTransformerContext( *this, rQName );
+}
+
+XMLTransformerActions *OOo2OasisTransformer::GetUserDefinedActions(
+ sal_uInt16 n )
+{
+ XMLTransformerActions *pActions = 0;
+ if( n < MAX_OOO_ACTIONS )
+ {
+ if( !m_aActions[n] )
+ {
+ if( n<MAX_OOO_PROP_ACTIONS )
+ {
+ m_aActions[n] =
+ XMLStyleOOoTContext::CreateTransformerActions( n );
+ }
+ else switch( n )
+ {
+ case OOO_STYLE_ACTIONS:
+ m_aActions[OOO_STYLE_ACTIONS] =
+ new XMLTransformerActions( aStyleActionTable );
+ break;
+ case OOO_FONT_DECL_ACTIONS:
+ m_aActions[OOO_FONT_DECL_ACTIONS] =
+ new XMLTransformerActions( aFontDeclActionTable );
+ break;
+ case OOO_SHAPE_ACTIONS:
+ m_aActions[OOO_SHAPE_ACTIONS] =
+ new XMLTransformerActions( aShapeActionTable );
+ break;
+ case OOO_CONNECTOR_ACTIONS:
+ m_aActions[OOO_CONNECTOR_ACTIONS] =
+ new XMLTransformerActions( aConnectorActionTable );
+ break;
+ case OOO_TAB_STOP_ACTIONS:
+ m_aActions[OOO_TAB_STOP_ACTIONS] =
+ new XMLTransformerActions( aTabStopActionTable );
+ break;
+ case OOO_INDEX_ENTRY_TAB_STOP_ACTIONS:
+ m_aActions[OOO_INDEX_ENTRY_TAB_STOP_ACTIONS] =
+ new XMLTransformerActions( aIndexEntryTabStopActionTable );
+ break;
+ case OOO_LINENUMBERING_ACTIONS:
+ m_aActions[OOO_LINENUMBERING_ACTIONS] =
+ new XMLTransformerActions( aLineNumberingActionTable );
+ break;
+ case OOO_FOOTNOTE_SEP_ACTIONS:
+ m_aActions[OOO_FOOTNOTE_SEP_ACTIONS] =
+ new XMLTransformerActions( aFootnoteSepActionTable );
+ break;
+ case OOO_DROP_CAP_ACTIONS:
+ m_aActions[OOO_DROP_CAP_ACTIONS] =
+ new XMLTransformerActions( aDropCapActionTable );
+ break;
+ case OOO_COLUMNS_ACTIONS:
+ m_aActions[OOO_COLUMNS_ACTIONS] =
+ new XMLTransformerActions( aColumnsActionTable );
+ break;
+ case OOO_TEXT_VALUE_TYPE_ACTIONS:
+ m_aActions[OOO_TEXT_VALUE_TYPE_ACTIONS] =
+ new XMLTransformerActions( aTextValueTypeActionTable );
+ break;
+ case OOO_TABLE_VALUE_TYPE_ACTIONS:
+ m_aActions[OOO_TABLE_VALUE_TYPE_ACTIONS] =
+ new XMLTransformerActions( aTableValueTypeActionTable );
+ break;
+ case OOO_PARA_ACTIONS:
+ m_aActions[OOO_PARA_ACTIONS] =
+ new XMLTransformerActions( aParaActionTable );
+ break;
+ case OOO_STYLE_REF_ACTIONS:
+ m_aActions[OOO_STYLE_REF_ACTIONS] =
+ new XMLTransformerActions( aStyleRefActionTable );
+ break;
+ case OOO_MASTER_PAGE_ACTIONS:
+ m_aActions[OOO_MASTER_PAGE_ACTIONS] =
+ new XMLTransformerActions( aMasterPageActionTable );
+ break;
+ case OOO_ANNOTATION_ACTIONS:
+ m_aActions[OOO_ANNOTATION_ACTIONS] =
+ new XMLTransformerActions( aAnnotationActionTable );
+ break;
+ case OOO_CHANGE_INFO_ACTIONS:
+ m_aActions[OOO_CHANGE_INFO_ACTIONS] =
+ new XMLTransformerActions( aChangeInfoActionTable );
+ break;
+ case OOO_FRAME_ELEM_ACTIONS:
+ m_aActions[OOO_FRAME_ELEM_ACTIONS] =
+ new XMLTransformerActions( aFrameElemActionTable );
+ break;
+ case OOO_FRAME_ATTR_ACTIONS:
+ m_aActions[OOO_FRAME_ATTR_ACTIONS] =
+ new XMLTransformerActions( aFrameAttrActionTable );
+ break;
+ case OOO_BACKGROUND_IMAGE_ACTIONS:
+ // Use special actions for Writer documents. (#i50322#)
+ m_aActions[OOO_BACKGROUND_IMAGE_ACTIONS] =
+ isWriter()
+ ? new XMLTransformerActions( aWriterBackgroundImageActionTable )
+ : new XMLTransformerActions( aBackgroundImageActionTable );
+ break;
+ case OOO_DDE_CONNECTION_DECL_ACTIONS:
+ m_aActions[OOO_DDE_CONNECTION_DECL_ACTIONS] =
+ new XMLTransformerActions( aDDEConnectionDeclActionTable );
+ break;
+ case OOO_EVENT_ACTIONS:
+ m_aActions[OOO_EVENT_ACTIONS] =
+ new XMLTransformerActions( aEventActionTable );
+ break;
+ case OOO_FORM_CONTROL_ACTIONS:
+ m_aActions[OOO_FORM_CONTROL_ACTIONS] =
+ new XMLTransformerActions( aFormControlActionTable );
+ break;
+ case OOO_FORM_COLUMN_ACTIONS:
+ m_aActions[OOO_FORM_COLUMN_ACTIONS] =
+ new XMLTransformerActions( aFormColumnActionTable );
+ break;
+ case OOO_FORM_PROP_ACTIONS:
+ m_aActions[OOO_FORM_PROP_ACTIONS] =
+ new XMLTransformerActions( aFormPropActionTable );
+ break;
+ case OOO_XLINK_ACTIONS:
+ m_aActions[OOO_XLINK_ACTIONS] =
+ new XMLTransformerActions( aXLinkActionTable );
+ break;
+ case OOO_CONFIG_ITEM_SET_ACTIONS:
+ m_aActions[OOO_CONFIG_ITEM_SET_ACTIONS] =
+ new XMLTransformerActions( aConfigItemSetActionTable );
+ break;
+ case OOO_FORMULA_ACTIONS:
+ m_aActions[OOO_FORMULA_ACTIONS] =
+ new XMLTransformerActions( aFormulaActionTable );
+ break;
+ case OOO_CHART_ACTIONS:
+ m_aActions[OOO_CHART_ACTIONS] =
+ new XMLTransformerActions( aChartActionTable );
+ break;
+ case OOO_ERROR_MACRO_ACTIONS:
+ m_aActions[OOO_ERROR_MACRO_ACTIONS] =
+ new XMLTransformerActions( aErrorMacroActionTable );
+ break;
+ case OOO_DDE_CONV_MODE_ACTIONS:
+ m_aActions[OOO_DDE_CONV_MODE_ACTIONS] =
+ new XMLTransformerActions( aDDEConvModeActionTable );
+ break;
+ case OOO_ALPHABETICAL_INDEX_MARK_ACTIONS:
+ m_aActions[OOO_ALPHABETICAL_INDEX_MARK_ACTIONS] =
+ new XMLTransformerActions( aAlphabeticalIndexMarkActionTable );
+ break;
+ case OOO_DATAPILOT_MEMBER_ACTIONS:
+ m_aActions[OOO_DATAPILOT_MEMBER_ACTIONS] =
+ new XMLTransformerActions( aDataPilotMemberActionTable );
+ case OOO_DATAPILOT_LEVEL_ACTIONS:
+ m_aActions[OOO_DATAPILOT_LEVEL_ACTIONS] =
+ new XMLTransformerActions( aDataPilotLevelActionTable );
+ case OOO_SOURCE_SERVICE_ACTIONS:
+ m_aActions[OOO_SOURCE_SERVICE_ACTIONS] =
+ new XMLTransformerActions( aSourceServiceActionTable );
+ case OOO_DRAW_AREA_POLYGON_ACTIONS:
+ m_aActions[OOO_DRAW_AREA_POLYGON_ACTIONS] =
+ new XMLTransformerActions( aShapeActionTable );
+ m_aActions[OOO_DRAW_AREA_POLYGON_ACTIONS]
+ ->Add( aDrawAreaPolygonActionTable );
+ break;
+ case OOO_SCRIPT_ACTIONS:
+ m_aActions[OOO_SCRIPT_ACTIONS] =
+ new XMLTransformerActions( aScriptActionTable );
+ break;
+ }
+ }
+ pActions = m_aActions[n];
+ }
+
+ return pActions;
+}
+
+OUString OOo2OasisTransformer::GetEventName( const OUString& rName, sal_Bool )
+{
+ if( !m_pEventMap )
+ m_pEventMap = XMLEventOOoTransformerContext::CreateEventMap();
+
+ OUString aNewName;
+ sal_uInt16 nPrefix = XMLEventOOoTransformerContext::GetEventName( rName,
+ aNewName, *m_pEventMap );
+ if( XML_NAMESPACE_UNKNOWN != nPrefix )
+ aNewName = GetNamespaceMap().GetQNameByKey( nPrefix, aNewName );
+ else
+ aNewName = rName;
+
+ return aNewName;
+}
+
+
+OOo2OasisTransformer::OOo2OasisTransformer( const sal_Char *pImplName,
+ const sal_Char *pSubServiceName )
+ throw() :
+ XMLTransformerBase( aActionTable, aTokenMap ),
+ m_pEventMap( 0 )
+{
+ if( pImplName )
+ m_aImplName = OUString::createFromAscii( pImplName );
+ else
+ m_aImplName = OOo2OasisTransformer_getImplementationName();
+ if( pSubServiceName )
+ m_aSubServiceName = OUString::createFromAscii( pSubServiceName );
+
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_OFFICE), GetXMLToken(XML_N_OFFICE_OOO), XML_NAMESPACE_OFFICE );
+ GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_OFFICE), GetXMLToken(XML_N_OFFICE), XML_NAMESPACE_OFFICE );
+
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_META), GetXMLToken(XML_N_META_OOO), XML_NAMESPACE_META );
+ GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_META), GetXMLToken(XML_N_META), XML_NAMESPACE_META );
+
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_STYLE), GetXMLToken(XML_N_STYLE_OOO), XML_NAMESPACE_STYLE );
+ GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_STYLE), GetXMLToken(XML_N_STYLE), XML_NAMESPACE_STYLE );
+
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_NUMBER), GetXMLToken(XML_N_NUMBER_OOO), XML_NAMESPACE_NUMBER );
+ GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_NUMBER), GetXMLToken(XML_N_NUMBER), XML_NAMESPACE_NUMBER );
+
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_CONFIG), GetXMLToken(XML_N_CONFIG_OOO), XML_NAMESPACE_CONFIG );
+ GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_CONFIG), GetXMLToken(XML_N_CONFIG), XML_NAMESPACE_CONFIG );
+
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_TEXT), GetXMLToken(XML_N_TEXT_OOO), XML_NAMESPACE_TEXT );
+ GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_TEXT), GetXMLToken(XML_N_TEXT), XML_NAMESPACE_TEXT );
+
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_TABLE), GetXMLToken(XML_N_TABLE_OOO), XML_NAMESPACE_TABLE );
+ GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_TABLE), GetXMLToken(XML_N_TABLE), XML_NAMESPACE_TABLE );
+
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_DRAW), GetXMLToken(XML_N_DRAW_OOO), XML_NAMESPACE_DRAW );
+ GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_DRAW), GetXMLToken(XML_N_DRAW), XML_NAMESPACE_DRAW );
+
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_DR3D), GetXMLToken(XML_N_DR3D_OOO), XML_NAMESPACE_DR3D );
+ GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_DR3D), GetXMLToken(XML_N_DR3D), XML_NAMESPACE_DR3D );
+
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_PRESENTATION), GetXMLToken(XML_N_PRESENTATION_OOO), XML_NAMESPACE_PRESENTATION );
+ GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_PRESENTATION), GetXMLToken(XML_N_PRESENTATION), XML_NAMESPACE_PRESENTATION );
+
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_CHART), GetXMLToken(XML_N_CHART_OOO), XML_NAMESPACE_CHART );
+ GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_CHART), GetXMLToken(XML_N_CHART), XML_NAMESPACE_CHART );
+
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_FORM), GetXMLToken(XML_N_FORM_OOO), XML_NAMESPACE_FORM );
+ GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_FORM), GetXMLToken(XML_N_FORM), XML_NAMESPACE_FORM );
+
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_SCRIPT), GetXMLToken(XML_N_SCRIPT_OOO), XML_NAMESPACE_SCRIPT );
+ GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_SCRIPT), GetXMLToken(XML_N_SCRIPT), XML_NAMESPACE_SCRIPT );
+
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_FO), GetXMLToken(XML_N_FO), XML_NAMESPACE_FO );
+ GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_FO), GetXMLToken(XML_N_FO_COMPAT), XML_NAMESPACE_FO );
+
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_SVG), GetXMLToken(XML_N_SVG), XML_NAMESPACE_SVG );
+ GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_SVG), GetXMLToken(XML_N_SVG_COMPAT), XML_NAMESPACE_SVG );
+
+ for( sal_uInt16 i=0; i<MAX_OOO_ACTIONS; ++i )
+ m_aActions[i] = 0;
+}
+
+OOo2OasisTransformer::~OOo2OasisTransformer() throw()
+{
+ for( sal_uInt16 i=0; i<MAX_OOO_ACTIONS; ++i )
+ delete m_aActions[i];
+ XMLEventOOoTransformerContext::FlushEventMap( m_pEventMap );
+}
+
+Any OOo2OasisTransformer::queryInterface( const Type& rType )
+ throw (RuntimeException)
+{
+ Any aRet;
+ if ( rType == ::getCppuType((Reference<XImporter> *)0) )
+ {
+ Reference<XImporter> xThis( this );
+ aRet <<= xThis;
+ }
+ else if ( rType == ::getCppuType((Reference<XFilter> *)0) )
+ {
+ Reference<XFilter> xThis( this );
+ aRet <<= xThis;
+ }
+ else
+ {
+ aRet = XMLTransformerBase::queryInterface(rType);
+ }
+
+ return aRet;
+}
+
+// XImporter
+void SAL_CALL OOo2OasisTransformer::setTargetDocument(
+ const Reference< XComponent >& xDoc )
+ throw( IllegalArgumentException, RuntimeException)
+{
+ if( !GetDocHandler().is() )
+ {
+ // if initialize hasn't been called, then we have to call it now
+ // to get the sub component initialized.
+ Sequence<Any> aArgs( 0 );
+ Initialize( aArgs );
+ }
+
+ mxModel.set( xDoc, UNO_QUERY );
+
+ Reference< XImporter > xImp( GetDocHandler(), UNO_QUERY );
+ OSL_ENSURE( xImp.is(), "doc handler is not an importer" );
+ if( xImp.is() )
+ xImp->setTargetDocument( xDoc );
+}
+
+// XFilter
+sal_Bool SAL_CALL OOo2OasisTransformer::filter(
+ const Sequence< PropertyValue >& aDescriptor )
+ throw ( RuntimeException)
+{
+ Reference< XFilter> xFilter( GetDocHandler(), UNO_QUERY );
+ OSL_ENSURE( xFilter.is(), "doc handler is not a filter" );
+ if( xFilter.is() )
+ return xFilter->filter( aDescriptor );
+
+ return sal_False;
+}
+
+void SAL_CALL OOo2OasisTransformer::cancel( )
+ throw ( RuntimeException)
+{
+ Reference< XFilter> xFilter( GetDocHandler(), UNO_QUERY );
+ OSL_ENSURE( xFilter.is(), "doc handler is not a filter" );
+ if( xFilter.is() )
+ xFilter->cancel();
+}
+
+// XInitialize
+void SAL_CALL OOo2OasisTransformer::initialize(
+ const Sequence< Any >& rArguments )
+ throw( Exception, RuntimeException )
+{
+ Initialize( rArguments );
+}
+
+void SAL_CALL OOo2OasisTransformer::startDocument( void )
+ throw( SAXException, RuntimeException )
+{
+ if( !GetDocHandler().is() )
+ {
+ // if initialize hasn't been called, then we have to call it now
+ // to get the sub component initialized.
+ Sequence<Any> aArgs( 0 );
+ Initialize( aArgs );
+ }
+
+ XMLTransformerBase::startDocument();
+}
+
+
+void SAL_CALL OOo2OasisTransformer::Initialize(
+ const Sequence< Any >& rArguments )
+ throw( Exception, RuntimeException )
+{
+ OSL_ENSURE( !GetDocHandler().is(), "duplication initialization" );
+
+ Reference< XDocumentHandler > xDocHandler;
+ if( m_aSubServiceName.getLength() )
+ {
+ Reference< XMultiServiceFactory > xFactory =
+ comphelper::getProcessServiceFactory();
+ if( xFactory.is() )
+ {
+ try
+ {
+ // get filter component
+ xDocHandler = Reference< XDocumentHandler >(
+ xFactory->createInstanceWithArguments( m_aSubServiceName,
+ rArguments ),
+ UNO_QUERY);
+ }
+ catch( Exception& )
+ {
+ }
+ }
+ }
+
+ OSL_ENSURE( xDocHandler.is(), "can't instantiate filter component" );
+ if( xDocHandler.is() )
+ {
+ Sequence<Any> aArgs( 1 + rArguments.getLength() );
+ aArgs[0] <<= xDocHandler;
+ for(sal_Int32 i = 0; i < rArguments.getLength(); i++)
+ aArgs[i+1] = rArguments[i];
+ XMLTransformerBase::initialize( aArgs );
+
+ OSL_ENSURE( GetDocHandler() == xDocHandler,
+ "duplicate doc handler" );
+ }
+ else
+ {
+ XMLTransformerBase::initialize( rArguments );
+ }
+}
+
+
+Sequence< sal_Int8 > static CreateUnoTunnelId()
+{
+ static osl::Mutex aCreateMutex;
+ ::osl::Guard<osl::Mutex> aGuard( aCreateMutex );
+ Sequence< sal_Int8 > aSeq( 16 );
+ rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
+ return aSeq;
+}
+
+const Sequence< sal_Int8 > & OOo2OasisTransformer::getUnoTunnelId() throw()
+{
+ static Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
+ return aSeq;
+}
+
+// XUnoTunnel
+sal_Int64 SAL_CALL OOo2OasisTransformer::getSomething( const Sequence< sal_Int8 >& rId )
+ throw(RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return reinterpret_cast< sal_Int64 >( this );
+ }
+ else
+ {
+ return (sal_Int64)0;
+ }
+}
+
+// XServiceInfo
+OUString SAL_CALL OOo2OasisTransformer::getImplementationName()
+ throw(RuntimeException)
+{
+ return m_aImplName;
+}
+
+sal_Bool SAL_CALL OOo2OasisTransformer::supportsService( const OUString& )
+ throw(RuntimeException)
+{
+ return sal_False;
+}
+
+Sequence< OUString > SAL_CALL OOo2OasisTransformer::getSupportedServiceNames( )
+ throw(RuntimeException)
+{
+ Sequence<OUString> aSeq(0);
+ return aSeq;
+}
+
+// XTypeProvider
+Sequence< ::com::sun::star::uno::Type > SAL_CALL
+ OOo2OasisTransformer::getTypes() throw(RuntimeException)
+{
+ Sequence< ::com::sun::star::uno::Type > aTypes(
+ XMLTransformerBase::getTypes() );
+
+ sal_Int32 nIndex = aTypes.getLength();
+ aTypes.realloc( nIndex + 2 );
+
+ ::com::sun::star::uno::Type* pTypes = aTypes.getArray();
+ pTypes[nIndex++] = ::getCppuType( static_cast< Reference< XImporter > * >( 0 ) );
+ pTypes[nIndex++] = ::getCppuType( static_cast< Reference< XFilter > * >( 0 ) );
+
+ return aTypes;
+}
+
+// Service registration
+
+OUString SAL_CALL OOo2OasisTransformer_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.comp.OOo2OasisTransformer" ) );
+}
+
+Sequence< OUString > SAL_CALL OOo2OasisTransformer_getSupportedServiceNames() throw()
+{
+ const OUString aServiceName( OOo2OasisTransformer_getImplementationName() );
+ const Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+Reference< XInterface > SAL_CALL OOo2OasisTransformer_createInstance(
+ const Reference< XMultiServiceFactory > & )
+ throw( Exception )
+{
+ return (cppu::OWeakObject*)new OOo2OasisTransformer();
+}
+
+#define OOO_IMPORTER( className, implName, subServiceName ) \
+OUString SAL_CALL className##_getImplementationName() throw() \
+{ \
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( implName ) ); \
+} \
+ \
+Sequence< OUString > SAL_CALL className##_getSupportedServiceNames() throw()\
+{ \
+ const OUString aServiceName( className##_getImplementationName() ); \
+ const Sequence< OUString > aSeq( &aServiceName, 1 ); \
+ return aSeq; \
+} \
+ \
+Reference< XInterface > SAL_CALL className##_createInstance( \
+ const Reference< XMultiServiceFactory > & ) \
+ throw( Exception ) \
+{ \
+ return (cppu::OWeakObject*)new OOo2OasisTransformer( implName, \
+ subServiceName ); \
+}
+
+OOO_IMPORTER( XMLWriterImportOOO,
+ "com.sun.star.comp.Writer.XMLImporter",
+ "com.sun.star.comp.Writer.XMLOasisImporter" )
+OOO_IMPORTER( XMLWriterStylesImportOOO,
+ "com.sun.star.comp.Writer.XMLStylesImporter",
+ "com.sun.star.comp.Writer.XMLOasisStylesImporter" )
+OOO_IMPORTER( XMLWriterContentImportOOO,
+ "com.sun.star.comp.Writer.XMLContentImporter",
+ "com.sun.star.comp.Writer.XMLOasisContentImporter" )
+OOO_IMPORTER( XMLWriterMetaImportOOO,
+ "com.sun.star.comp.Writer.XMLMetaImporter",
+ "com.sun.star.comp.Writer.XMLOasisMetaImporter" )
+OOO_IMPORTER( XMLWriterSettingsImportOOO,
+ "com.sun.star.comp.Writer.XMLSettingsImporter",
+ "com.sun.star.comp.Writer.XMLOasisSettingsImporter" )
+
+OOO_IMPORTER( XMLImpressImportOOO,
+ "com.sun.star.comp.Impress.XMLImporter",
+ "com.sun.star.comp.Impress.XMLOasisImporter" )
+OOO_IMPORTER( XMLImpressStylesImportOOO,
+ "com.sun.star.comp.Impress.XMLStylesImporter",
+ "com.sun.star.comp.Impress.XMLOasisStylesImporter" )
+OOO_IMPORTER( XMLImpressContentImportOOO,
+ "com.sun.star.comp.Impress.XMLContentImporter",
+ "com.sun.star.comp.Impress.XMLOasisContentImporter" )
+OOO_IMPORTER( XMLImpressMetaImportOOO,
+ "com.sun.star.comp.Impress.XMLMetaImporter",
+ "com.sun.star.comp.Impress.XMLOasisMetaImporter" )
+OOO_IMPORTER( XMLImpressSettingsImportOOO,
+ "com.sun.star.comp.Impress.XMLSettingsImporter",
+ "com.sun.star.comp.Impress.XMLOasisSettingsImporter" )
+
+OOO_IMPORTER( XMLDrawImportOOO,
+ "com.sun.star.comp.Draw.XMLImporter",
+ "com.sun.star.comp.Draw.XMLOasisImporter" )
+OOO_IMPORTER( XMLDrawStylesImportOOO,
+ "com.sun.star.comp.Draw.XMLStylesImporter",
+ "com.sun.star.comp.Draw.XMLOasisStylesImporter" )
+OOO_IMPORTER( XMLDrawContentImportOOO,
+ "com.sun.star.comp.Draw.XMLContentImporter",
+ "com.sun.star.comp.Draw.XMLOasisContentImporter" )
+OOO_IMPORTER( XMLDrawMetaImportOOO,
+ "com.sun.star.comp.Draw.XMLMetaImporter",
+ "com.sun.star.comp.Draw.XMLOasisMetaImporter" )
+OOO_IMPORTER( XMLDrawSettingsImportOOO,
+ "com.sun.star.comp.Draw.XMLSettingsImporter",
+ "com.sun.star.comp.Draw.XMLOasisSettingsImporter" )
+
+OOO_IMPORTER( XMLCalcImportOOO,
+ "com.sun.star.comp.Calc.XMLImporter",
+ "com.sun.star.comp.Calc.XMLOasisImporter" )
+OOO_IMPORTER( XMLCalcStylesImportOOO,
+ "com.sun.star.comp.Calc.XMLStylesImporter",
+ "com.sun.star.comp.Calc.XMLOasisStylesImporter" )
+OOO_IMPORTER( XMLCalcContentImportOOO,
+ "com.sun.star.comp.Calc.XMLContentImporter",
+ "com.sun.star.comp.Calc.XMLOasisContentImporter" )
+OOO_IMPORTER( XMLCalcMetaImportOOO,
+ "com.sun.star.comp.Calc.XMLMetaImporter",
+ "com.sun.star.comp.Calc.XMLOasisMetaImporter" )
+OOO_IMPORTER( XMLCalcSettingsImportOOO,
+ "com.sun.star.comp.Calc.XMLSettingsImporter",
+ "com.sun.star.comp.Calc.XMLOasisSettingsImporter" )
+
+OOO_IMPORTER( XMLChartImportOOO,
+ "com.sun.star.comp.Chart.XMLImporter",
+ "com.sun.star.comp.Chart.XMLOasisImporter" )
+OOO_IMPORTER( XMLChartStylesImportOOO,
+ "com.sun.star.comp.Chart.XMLStylesImporter",
+ "com.sun.star.comp.Chart.XMLOasisStylesImporter" )
+OOO_IMPORTER( XMLChartContentImportOOO,
+ "com.sun.star.comp.Chart.XMLContentImporter",
+ "com.sun.star.comp.Chart.XMLOasisContentImporter" )
+
+OOO_IMPORTER( XMLMathMetaImportOOO,
+ "com.sun.star.comp.Math.XMLMetaImporter",
+ "com.sun.star.comp.Math.XMLOasisMetaImporter" )
+OOO_IMPORTER( XMLMathSettingsImportOOO,
+ "com.sun.star.comp.Math.XMLSettingsImporter",
+ "com.sun.star.comp.Math.XMLOasisSettingsImporter" )
+
+OOO_IMPORTER( XMLMetaImportOOO,
+ "com.sun.star.document.XMLMetaImporter",
+ "com.sun.star.document.XMLOasisMetaImporter" )
+
+OOO_IMPORTER( XMLAutoTextEventImportOOO,
+ "com.sun.star.comp.Writer.XMLAutotextEventsImporter",
+ "com.sun.star.comp.Writer.XMLOasisAutotextEventsImporter" )
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/OOo2Oasis.hxx b/xmloff/source/transform/OOo2Oasis.hxx
new file mode 100644
index 000000000000..693e75cf6251
--- /dev/null
+++ b/xmloff/source/transform/OOo2Oasis.hxx
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_OOO2OASIS_HXX
+#define _XMLOFF_OOO2OASIS_HXX
+
+#include <com/sun/star/document/XImporter.hpp>
+#include <com/sun/star/document/XFilter.hpp>
+#include "ActionMapTypesOOo.hxx"
+#include "TransformerBase.hxx"
+
+class XMLTransformerOOoEventMap_Impl;
+
+class OOo2OasisTransformer :
+ public XMLTransformerBase,
+ public ::com::sun::star::document::XImporter,
+ public ::com::sun::star::document::XFilter
+{
+ ::rtl::OUString m_aImplName;
+ ::rtl::OUString m_aSubServiceName;
+
+ XMLTransformerActions *m_aActions[MAX_OOO_ACTIONS];
+ XMLTransformerOOoEventMap_Impl *m_pEventMap;
+protected:
+
+ virtual XMLTransformerContext *CreateUserDefinedContext(
+ const TransformerAction_Impl& rAction,
+ const ::rtl::OUString& rQName,
+ sal_Bool bPersistent=sal_False );
+
+ virtual XMLTransformerActions *GetUserDefinedActions( sal_uInt16 n );
+
+public:
+ OOo2OasisTransformer( const sal_Char *pImplName=0,
+ const sal_Char *pSubServiceName=0 ) throw();
+ virtual ~OOo2OasisTransformer() throw();
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
+
+ // XInterface
+
+ // (XInterface methods need to be implemented to disambigouate
+ // between those inherited through XMLTransformerBase and
+ // the new interfaces).
+
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
+ const ::com::sun::star::uno::Type& aType )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL acquire( ) throw ()
+ { XMLTransformerBase::acquire(); };
+
+ virtual void SAL_CALL release( ) throw ()
+ { XMLTransformerBase::release(); };
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XImporter
+ virtual void SAL_CALL setTargetDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ // XFilter
+ virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL cancel( ) throw (::com::sun::star::uno::RuntimeException);
+
+ void SAL_CALL Initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::xml::sax::XDocumentHandler
+ virtual void SAL_CALL startDocument(void)
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+
+ virtual ::rtl::OUString GetEventName( const ::rtl::OUString& rName,
+ sal_Bool bForm = sal_False );
+};
+
+#endif // _XMLOFF_TRANSFORMER_BASE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/Oasis2OOo.cxx b/xmloff/source/transform/Oasis2OOo.cxx
new file mode 100644
index 000000000000..f55b2aaa1d7e
--- /dev/null
+++ b/xmloff/source/transform/Oasis2OOo.cxx
@@ -0,0 +1,2084 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <rtl/uuid.h>
+#include <rtl/ustrbuf.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include "DeepTContext.hxx"
+#include "MetaTContext.hxx"
+#include "DocumentTContext.hxx"
+#include "NotesTContext.hxx"
+#include "StyleOASISTContext.hxx"
+#include "FrameOASISTContext.hxx"
+#include "EventOASISTContext.hxx"
+#include "DlgOASISTContext.hxx"
+#include "ControlOASISTContext.hxx"
+#include "FormPropOASISTContext.hxx"
+#include "ChartOASISTContext.hxx"
+#include "ChartPlotAreaOASISTContext.hxx"
+#include "MutableAttrList.hxx"
+#include "ElemTransformerAction.hxx"
+#include "AttrTransformerAction.hxx"
+#include "TransformerActions.hxx"
+#include "FamilyType.hxx"
+#include <xmloff/xmluconv.hxx>
+#include "Oasis2OOo.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using namespace ::osl;
+using namespace ::xmloff::token;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::beans;
+
+OUString SAL_CALL Oasis2OOoTransformer_getImplementationName() throw();
+
+enum XMLUserDefinedTransformerAction
+{
+ XML_ETACTION_META=XML_ETACTION_USER_DEFINED,
+ XML_ETACTION_DOCUMENT,
+ XML_ETACTION_BODY,
+ XML_ETACTION_NOTES,
+ XML_ETACTION_TABLE,
+ XML_ETACTION_STYLE,
+ XML_ETACTION_STYLE_RENAME,
+ XML_ETACTION_FRAME,
+ XML_ETACTION_EVENT,
+ XML_ETACTION_DLG,
+ XML_ETACTION_TAB_STOP,
+ XML_ETACTION_FORM_CONTROL,
+ XML_ETACTION_FORM_PROPERTY,
+ XML_ETACTION_CONFIG_ITEM,
+ XML_ETACTION_TRACKED_CHANGES,
+ XML_ETACTION_CHART,
+ XML_ETACTION_CHART_PLOT_AREA
+};
+
+#define ENTRY3( n, l, a, p1, p2, p3 ) \
+ { XML_NAMESPACE_##n, XML_##l, a, p1, p2, p3 }
+#define ENTRY3QNQ( n, l, a, n1, l1, p2, n3, l3 ) \
+ ENTRY3( n, l, a, XMLTransformerActionInit::QNameParam( n1, l1 ), \
+ p2, XMLTransformerActionInit::QNameParam( n3, l3 ) )
+
+#define ENTRY2( n, l, a, p1, p2 ) \
+ ENTRY3( n, l, a, p1, p2, 0 )
+#define ENTRY2QQ( n, l, a, n1, l1, n2, l2 ) \
+ ENTRY2( n, l, a, XMLTransformerActionInit::QNameParam( n1, l1 ), \
+ XMLTransformerActionInit::QNameParam( n2, l2 ) )
+#define ENTRY2QN( n, l, a, n1, l1, p2 ) \
+ ENTRY2( n, l, a, XMLTransformerActionInit::QNameParam( n1, l1 ), p2 )
+
+#define ENTRY1( n, l, a, p1 ) \
+ ENTRY3( n, l, a, p1, 0, 0 )
+#define ENTRY1Q( n, l, a, p1, t1 ) \
+ ENTRY1( n, l, a, XMLTransformerActionInit::QNameParam( p1, t1 ) )
+
+#define ENTRY0( n, l, a ) \
+ ENTRY3( n, l, a, 0, 0, 0 )
+
+// BM: a macro to put two tokens into one sal_Int32 for the action
+// XML_ATACTION_RENAME_ATTRIBUTE
+#define RENAME_ENTRY( f, s ) \
+ (static_cast< sal_Int32 >(f) | (static_cast< sal_Int32 >(s) << 16))
+
+static XMLTransformerActionInit aActionTable[] =
+{
+ // add office:class from <office:document> and <office:document-content>
+ ENTRY0( OFFICE, DOCUMENT, XML_ETACTION_DOCUMENT ),
+ ENTRY0( OFFICE, DOCUMENT_CONTENT, XML_ETACTION_DOCUMENT ),
+ ENTRY1Q( OOO, AUTO_TEXT_EVENTS, XML_ETACTION_RENAME_ELEM,
+ XML_NAMESPACE_OFFICE, XML_AUTO_TEXT_EVENTS),
+
+ // add <meta:keywords>
+ ENTRY0( OFFICE, META, XML_ETACTION_META ),
+
+ // rename <office:scripts> to <office:script>
+ ENTRY1Q( OFFICE, SCRIPTS, XML_ETACTION_RENAME_ELEM,
+ XML_NAMESPACE_OFFICE, XML_SCRIPT ),
+
+ // rename <office:script> to <office:script-data> and process attributes
+ ENTRY2QN( OFFICE, SCRIPT, XML_ETACTION_RENAME_ELEM_PROC_ATTRS,
+ XML_NAMESPACE_OFFICE, XML_SCRIPT_DATA,
+ OASIS_SCRIPT_ACTIONS ),
+
+ // rename <ooo:libraries> to <script:libraries>
+ ENTRY1Q( OOO, LIBRARIES, XML_ETACTION_RENAME_ELEM,
+ XML_NAMESPACE_SCRIPT, XML_LIBRARIES ),
+
+ // rename <ooo:library-linked> to <script:library-linked> and process attributes
+ ENTRY2QN( OOO, LIBRARY_LINKED, XML_ETACTION_RENAME_ELEM_PROC_ATTRS,
+ XML_NAMESPACE_SCRIPT, XML_LIBRARY_LINKED,
+ OASIS_SCRIPT_ACTIONS ),
+
+ // rename <ooo:library-embedded> to <script:library-embedded> and process attributes
+ ENTRY2QN( OOO, LIBRARY_EMBEDDED, XML_ETACTION_RENAME_ELEM_PROC_ATTRS,
+ XML_NAMESPACE_SCRIPT, XML_LIBRARY_EMBEDDED,
+ OASIS_SCRIPT_ACTIONS ),
+
+ // rename <ooo:module> to <script:module> and process attributes
+ ENTRY2QN( OOO, MODULE, XML_ETACTION_RENAME_ELEM_PROC_ATTRS,
+ XML_NAMESPACE_SCRIPT, XML_MODULE,
+ OASIS_SCRIPT_ACTIONS ),
+
+ // rename <ooo:source-code> to <script:source-code>
+ ENTRY1Q( OOO, SOURCE_CODE, XML_ETACTION_RENAME_ELEM,
+ XML_NAMESPACE_SCRIPT, XML_SOURCE_CODE ),
+
+ ENTRY0( OFFICE, BODY, XML_ETACTION_BODY ),
+
+ // rename <office:font-face-decls> to <office:font-decl>,
+ // rename <style:font-face> to <style:font-decl>, process attrs
+ ENTRY1Q( OFFICE, FONT_FACE_DECLS, XML_ETACTION_RENAME_ELEM,
+ XML_NAMESPACE_OFFICE, XML_FONT_DECLS ),
+ ENTRY2QN( STYLE, FONT_FACE, XML_ETACTION_RENAME_ELEM_PROC_ATTRS,
+ XML_NAMESPACE_STYLE, XML_FONT_DECL,
+ OASIS_FONT_FACE_ACTIONS ),
+
+ // remove genre element
+ ENTRY0( OFFICE, TEXT, XML_ETACTION_COPY_CONTENT ),
+ ENTRY0( OFFICE, DRAWING, XML_ETACTION_COPY_CONTENT ),
+ ENTRY0( OFFICE, PRESENTATION, XML_ETACTION_COPY_CONTENT ),
+ ENTRY0( OFFICE, SPREADSHEET, XML_ETACTION_COPY_CONTENT ),
+ ENTRY0( OFFICE, CHART, XML_ETACTION_COPY_CONTENT ),
+ ENTRY0( OFFICE, IMAGE, XML_ETACTION_COPY_CONTENT ),
+
+ // rename <style:page-layout> to <style:page-master>
+ // ENTRY1Q( STYLE, PAGE_LAYOUT, RENAME_ELEM,
+ // XML_NAMESPACE_STYLE, XML_PAGE_MASTER ),
+ ENTRY1( STYLE, MASTER_PAGE, XML_ETACTION_PROC_ATTRS,
+ OASIS_MASTER_PAGE_ACTIONS ),
+
+ // merge <style:*-properties> into <style:properties> and do other
+ // styles processing
+ ENTRY1( STYLE, STYLE, XML_ETACTION_STYLE,
+ XML_FAMILY_TYPE_END ),
+ ENTRY1( STYLE, DEFAULT_STYLE, XML_ETACTION_STYLE,
+ XML_FAMILY_TYPE_END ),
+ ENTRY2QN( STYLE, PAGE_LAYOUT, XML_ETACTION_STYLE_RENAME,
+ XML_NAMESPACE_STYLE, XML_PAGE_MASTER,
+ XML_FAMILY_TYPE_PAGE_LAYOUT ),
+ ENTRY1( NUMBER, NUMBER_STYLE, XML_ETACTION_STYLE,
+ XML_FAMILY_TYPE_DATA ),
+ ENTRY1( NUMBER, CURRENCY_STYLE, XML_ETACTION_STYLE,
+ XML_FAMILY_TYPE_DATA ),
+ ENTRY1( NUMBER, PERCENTAGE_STYLE, XML_ETACTION_STYLE,
+ XML_FAMILY_TYPE_DATA ),
+ ENTRY1( NUMBER, DATE_STYLE, XML_ETACTION_STYLE,
+ XML_FAMILY_TYPE_DATA ),
+ ENTRY1( NUMBER, TIME_STYLE, XML_ETACTION_STYLE,
+ XML_FAMILY_TYPE_DATA ),
+ ENTRY1( NUMBER, BOOLEAN_STYLE, XML_ETACTION_STYLE,
+ XML_FAMILY_TYPE_DATA ),
+ ENTRY1( NUMBER, TEXT_STYLE, XML_ETACTION_STYLE,
+ XML_FAMILY_TYPE_DATA ),
+ ENTRY1( TEXT, LIST_STYLE, XML_ETACTION_STYLE,
+ XML_FAMILY_TYPE_LIST ),
+// ENTRY0( TEXT, OUTLINE_STYLE, STYLE ),
+
+ ENTRY1( STYLE, HEADER_STYLE, XML_ETACTION_STYLE,
+ XML_FAMILY_TYPE_HEADER_FOOTER ),
+ ENTRY1( STYLE, FOOTER_STYLE, XML_ETACTION_STYLE,
+ XML_FAMILY_TYPE_HEADER_FOOTER ),
+ ENTRY1( TEXT, LIST_LEVEL_STYLE_NUMBER, XML_ETACTION_STYLE,
+ XML_FAMILY_TYPE_LIST ),
+ ENTRY1( TEXT, LIST_LEVEL_STYLE_BULLET, XML_ETACTION_STYLE,
+ XML_FAMILY_TYPE_LIST ),
+ ENTRY1( TEXT, LIST_LEVEL_STYLE_IMAGE, XML_ETACTION_STYLE,
+ XML_FAMILY_TYPE_LIST ),
+ ENTRY1( TEXT, OUTLINE_LEVEL_STYLE, XML_ETACTION_STYLE,
+ XML_FAMILY_TYPE_LIST ),
+ ENTRY1( DRAW, GRADIENT, XML_ETACTION_STYLE,
+ XML_FAMILY_TYPE_GRADIENT ),
+ ENTRY1( DRAW, FILL_IMAGE, XML_ETACTION_STYLE,
+ XML_FAMILY_TYPE_FILL_IMAGE ),
+ ENTRY2QN( DRAW, OPACITY, XML_ETACTION_STYLE_RENAME,
+ XML_NAMESPACE_DRAW, XML_TRANSPARENCY,
+ XML_FAMILY_TYPE_GRADIENT ),
+ ENTRY1( DRAW, MARKER, XML_ETACTION_STYLE,
+ XML_FAMILY_TYPE_MARKER ),
+ ENTRY1( DRAW, HATCH, XML_ETACTION_STYLE,
+ XML_FAMILY_TYPE_HATCH ),
+ ENTRY1( DRAW, STROKE_DASH, XML_ETACTION_STYLE,
+ XML_FAMILY_TYPE_STROKE_DASH ),
+
+ // process <text:h/p>: process style-name attributes,
+ // rename <text:h>'s text:outline-level to text:level,
+ ENTRY1( TEXT, H, XML_ETACTION_PROC_ATTRS, OASIS_PARA_ACTIONS ),
+ ENTRY1( TEXT, P, XML_ETACTION_PROC_ATTRS, OASIS_PARA_ACTIONS ),
+
+ // process <test:list>'s text:style-name attributes
+ // rename <text:list> to <text:ordered-list> or <text:unordered-list>
+ // TODO: All list currenty are renamed to <text:ordered-list>
+ ENTRY2QN( TEXT, LIST, XML_ETACTION_RENAME_ELEM_PROC_ATTRS,
+ XML_NAMESPACE_TEXT, XML_ORDERED_LIST,
+ OASIS_LIST_STYLE_REF_ACTIONS ),
+
+ // rename <text:note*> to <text:footnote*> or <text:endnote*>
+ ENTRY1( TEXT, NOTES_CONFIGURATION, XML_ETACTION_NOTES,
+ XML_NOTES_CONFIGURATION),
+ ENTRY1( TEXT, NOTE, XML_ETACTION_NOTES, XML_NOTE ),
+
+ // rename <text:footnote> and <text:endnote> to <text:note>
+ ENTRY1( TEXT, NOTE_REF, XML_ETACTION_NOTES, XML_NOTE_REF ),
+
+ // rename <text:tab> to <text:tab-stop>
+ ENTRY1Q( TEXT, TAB, XML_ETACTION_RENAME_ELEM,
+ XML_NAMESPACE_TEXT, XML_TAB_STOP ),
+
+
+ // replace <table:table tabke:is-sub-table> with <table:sub-table>
+ ENTRY0( TABLE, TABLE, XML_ETACTION_TABLE ),
+
+ // merge frame element
+ ENTRY0( DRAW, FRAME, XML_ETACTION_FRAME ),
+
+ // process events
+ ENTRY1Q( OFFICE, EVENT_LISTENERS, XML_ETACTION_RENAME_ELEM,
+ XML_NAMESPACE_OFFICE, XML_EVENTS ),
+ ENTRY0( SCRIPT, EVENT_LISTENER, XML_ETACTION_EVENT ),
+ ENTRY0( SCRIPT, EVENT, XML_ETACTION_EVENT ),
+ ENTRY0( PRESENTATION, EVENT_LISTENER, XML_ETACTION_EVENT ),
+
+ // process Basic dialogs
+ ENTRY0( DLG, STYLE, XML_ETACTION_DLG ),
+
+ // process length attributes
+ ENTRY1( DRAW, RECT, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( DRAW, LINE, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( DRAW, POLYLINE, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( DRAW, POLYGON, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( DRAW, PATH, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( DRAW, CIRCLE, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( DRAW, ELLIPSE, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( DRAW, CONNECTOR, XML_ETACTION_PROC_ATTRS, OASIS_CONNECTOR_ACTIONS ),
+ ENTRY1( DRAW, CAPTION, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( DRAW, MEASURE, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( DRAW, CONTROL, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( DRAW, PAGE_THUMBNAIL, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( DRAW, G, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+// ENTRY1( DRAW, FRAME, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( DRAW, TEXT_BOX, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( PRESENTATION, PLACEHOLDER, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( DRAW, CONTOUR_POLYGON, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( DRAW, CONTOUR_PATH, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( DRAW, AREA_RECTANGLE, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( DRAW, AREA_CIRCLE, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( DRAW, AREA_POLYGON, XML_ETACTION_PROC_ATTRS, OASIS_DRAW_AREA_POLYGON_ACTIONS ),
+ ENTRY1( DRAW, GLUE_POINT, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( DR3D, SCENE, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( DR3D, CUBE, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( DR3D, SPHERE, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( DR3D, EXTRUDE, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( DR3D, ROTATE, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( CHART, TITLE, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( CHART, SUBTITLE, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( CHART, FOOTER, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( CHART, LEGEND, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( CHART, WALL, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( CHART, FLOOR, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( CHART, AXIS, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( CHART, GRID, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( CHART, SERIES, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( CHART, DATA_POINT, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( CHART, MEAN_VALUE, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( CHART, ERROR_INDICATOR, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( CHART, REGRESSION_CURVE, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( CHART, STOCK_GAIN_MARKER, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( CHART, STOCK_LOSS_MARKER, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+ ENTRY1( CHART, STOCK_RANGE_LINE, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ),
+
+ ENTRY0( CHART, CHART, XML_ETACTION_CHART ),
+ ENTRY0( CHART, PLOT_AREA, XML_ETACTION_CHART_PLOT_AREA ),
+
+ ENTRY0( CONFIG, CONFIG_ITEM, XML_ETACTION_CONFIG_ITEM ),
+ ENTRY1Q( TEXT, TRACKED_CHANGES, XML_ETACTION_TRACKED_CHANGES,
+ XML_NAMESPACE_TEXT, XML_PROTECTION_KEY ),
+ ENTRY1Q( TABLE, TRACKED_CHANGES, XML_ETACTION_TRACKED_CHANGES,
+ XML_NAMESPACE_TABLE, XML_PROTECTION_KEY ),
+
+ ENTRY1( TEXT, INDEX_ENTRY_TAB_STOP, XML_ETACTION_PROC_ATTRS,
+ OASIS_INDEX_ENTRY_TAB_STOP_ACTIONS ),
+ ENTRY0( STYLE, TAB_STOP, XML_ETACTION_TAB_STOP ),
+ ENTRY1( STYLE, BACKGROUND_IMAGE, XML_ETACTION_PROC_ATTRS,
+ OASIS_BACKGROUND_IMAGE_ACTIONS ),
+ ENTRY1( TEXT, LINENUMBERING_CONFIGURATION, XML_ETACTION_PROC_ATTRS,
+ OASIS_LINENUMBERING_ACTIONS ),
+ ENTRY1( STYLE, FOOTNOTE_SEP, XML_ETACTION_PROC_ATTRS,
+ OASIS_FOOTNOTE_SEP_ACTIONS ),
+ ENTRY1( STYLE, DROP_CAP, XML_ETACTION_PROC_ATTRS, OASIS_DROP_CAP_ACTIONS ),
+ ENTRY1( STYLE, COLUMNS, XML_ETACTION_PROC_ATTRS, OASIS_COLUMNS_ACTIONS ),
+ ENTRY1( STYLE, COLUMN, XML_ETACTION_PROC_ATTRS, OASIS_COLUMNS_ACTIONS ),
+
+ // process *:style-name attributes
+ ENTRY1( STYLE, MAP, XML_ETACTION_PROC_ATTRS, OASIS_MAP_STYLE_REF_ACTIONS ),
+ ENTRY1( TEXT, SPAN, XML_ETACTION_PROC_ATTRS, OASIS_TEXT_STYLE_REF_ACTIONS ),
+ ENTRY1( TEXT, A, XML_ETACTION_PROC_ATTRS, OASIS_TEXT_STYLE_REF_ACTIONS ),
+ ENTRY1( TEXT, RUBY_TEXT, XML_ETACTION_PROC_ATTRS,
+ OASIS_TEXT_STYLE_REF_ACTIONS ),
+ ENTRY1( TEXT, TABLE_OF_CONTENT_ENTRY_TEMPLATE, XML_ETACTION_PROC_ATTRS,
+ OASIS_PARA_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, ILLUSTRATION_INDEX_ENTRY_TEMPLATE, XML_ETACTION_PROC_ATTRS,
+ OASIS_PARA_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, TABLE_INDEX_ENTRY_TEMPLATE, XML_ETACTION_PROC_ATTRS,
+ OASIS_PARA_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, OBJECT_INDEX_ENTRY_TEMPLATE, XML_ETACTION_PROC_ATTRS,
+ OASIS_PARA_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, USER_INDEX_ENTRY_TEMPLATE, XML_ETACTION_PROC_ATTRS,
+ OASIS_PARA_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, ALPHABETICAL_INDEX_ENTRY_TEMPLATE, XML_ETACTION_PROC_ATTRS,
+ OASIS_PARA_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, BIBLIOGRAPHY_ENTRY_TEMPLATE, XML_ETACTION_PROC_ATTRS,
+ OASIS_PARA_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, INDEX_SOURCE_STYLE, XML_ETACTION_PROC_ATTRS,
+ OASIS_PARA_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, INDEX_TITLE_TEMPLATE, XML_ETACTION_PROC_ATTRS,
+ OASIS_PARA_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY3QNQ( TEXT, INDEX_ENTRY_CHAPTER,
+ XML_ETACTION_RENAME_ELEM_PROC_ATTRS_COND,
+ XML_NAMESPACE_TEXT, XML_INDEX_ENTRY_CHAPTER_NUMBER,
+ OASIS_TEXT_STYLE_REF_ACTIONS ,
+ XML_NAMESPACE_TEXT, XML_TABLE_OF_CONTENT_ENTRY_TEMPLATE),
+ ENTRY1( TEXT, INDEX_ENTRY_TEXT, XML_ETACTION_PROC_ATTRS,
+ OASIS_TEXT_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, INDEX_ENTRY_PAGE_NUMBER, XML_ETACTION_PROC_ATTRS,
+ OASIS_TEXT_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, INDEX_ENTRY_SPAN, XML_ETACTION_PROC_ATTRS,
+ OASIS_TEXT_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, INDEX_ENTRY_BIBLIOGRAPHY, XML_ETACTION_PROC_ATTRS,
+ OASIS_TEXT_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, INDEX_ENTRY_LINK_START, XML_ETACTION_PROC_ATTRS,
+ OASIS_TEXT_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, INDEX_ENTRY_LINK_END, XML_ETACTION_PROC_ATTRS,
+ OASIS_TEXT_STYLE_REF_ACTIONS ), /* generated entry */
+ ENTRY1( DRAW, PAGE, XML_ETACTION_PROC_ATTRS,
+ OASIS_MASTER_PAGE_REF_ACTIONS ), /* generated entry */
+ /* Conversion of attribute <table:style-name> for <table:table-row> and
+ <table:table-column> (#i40011#, #i40015#)
+ */
+ ENTRY1( TABLE, TABLE_ROW, XML_ETACTION_PROC_ATTRS,
+ OASIS_TABLE_STYLE_REF_ACTIONS ),
+ ENTRY1( TABLE, TABLE_COLUMN, XML_ETACTION_PROC_ATTRS,
+ OASIS_TABLE_STYLE_REF_ACTIONS ),
+
+ // rename office:value-* to *:value-*
+ ENTRY1( TEXT, VARIABLE_DECL, XML_ETACTION_PROC_ATTRS,
+ OASIS_TEXT_VALUE_TYPE_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, VARIABLE_SET, XML_ETACTION_PROC_ATTRS,
+ OASIS_TEXT_VALUE_TYPE_ACTIONS), /* generated entry */
+ ENTRY1( TEXT, VARIABLE_INPUT, XML_ETACTION_PROC_ATTRS,
+ OASIS_TEXT_VALUE_TYPE_ACTIONS), /* generated entry */
+ ENTRY1( TEXT, USER_FIELD_DECL, XML_ETACTION_PROC_ATTRS,
+ OASIS_TEXT_VALUE_TYPE_ACTIONS), /* generated entry */
+ ENTRY1( TEXT, EXPRESSION, XML_ETACTION_PROC_ATTRS,
+ OASIS_TEXT_VALUE_TYPE_ACTIONS), /* generated entry */
+ ENTRY1( TEXT, USER_DEFINED, XML_ETACTION_PROC_ATTRS,
+ OASIS_DATETIME_ACTIONS ), // Add OASIS_TEXT_VALUE_TYPE_ACTIONS if attrs are added to text:user-defined
+ ENTRY1( TABLE, TABLE_CELL, XML_ETACTION_PROC_ATTRS,
+ OASIS_TABLE_VALUE_TYPE_ACTIONS), /* generated entry */
+ ENTRY1( TABLE, COVERED_TABLE_CELL, XML_ETACTION_PROC_ATTRS,
+ OASIS_TABLE_VALUE_TYPE_ACTIONS), /* generated entry */
+ ENTRY1( TABLE, CHANGE_TRACK_TABLE_CELL, XML_ETACTION_PROC_ATTRS,
+ OASIS_TABLE_VALUE_TYPE_ACTIONS), /* generated entry */
+// ENTRY1( FORM, PROPERTY, XML_ETACTION_PROC_ATTRS,
+// OASIS_VALUE_TYPE_ACTIONS), /* TODO: generated entry */
+// ENTRY1( FORM, LIST_PROPERTY, XML_ETACTION_PROC_ATTRS,
+// OASIS_VALUE_TYPE_ACTIONS), /* generated entry */
+
+ ENTRY1( OFFICE, ANNOTATION, XML_ETACTION_MOVE_ELEMS_TO_ATTRS,
+ OASIS_ANNOTATION_ACTIONS ), /* generated entry */
+ ENTRY1( OFFICE, CHANGE_INFO, XML_ETACTION_MOVE_ELEMS_TO_ATTRS,
+ OASIS_CHANGE_INFO_ACTIONS ), /* generated entry */
+
+ ENTRY1( TEXT, DDE_CONNECTION_DECL, XML_ETACTION_PROC_ATTRS,
+ OASIS_DDE_CONNECTION_DECL_ACTIONS ),
+
+ ENTRY0( FORM, TEXT, XML_ETACTION_FORM_CONTROL ),
+ ENTRY0( FORM, TEXTAREA, XML_ETACTION_FORM_CONTROL ),
+ ENTRY0( FORM, FIXED_TEXT, XML_ETACTION_FORM_CONTROL ),
+ ENTRY0( FORM, FILE, XML_ETACTION_FORM_CONTROL ),
+ ENTRY0( FORM, PASSWORD, XML_ETACTION_FORM_CONTROL ),
+ ENTRY0( FORM, FORMATTED_TEXT, XML_ETACTION_FORM_CONTROL ),
+ ENTRY0( FORM, BUTTON, XML_ETACTION_FORM_CONTROL ),
+ ENTRY0( FORM, IMAGE, XML_ETACTION_FORM_CONTROL ),
+ ENTRY0( FORM, CHECKBOX, XML_ETACTION_FORM_CONTROL ),
+ ENTRY0( FORM, RADIO, XML_ETACTION_FORM_CONTROL ),
+ ENTRY0( FORM, LISTBOX, XML_ETACTION_FORM_CONTROL ),
+ ENTRY0( FORM, COMBOBOX, XML_ETACTION_FORM_CONTROL ),
+ ENTRY0( FORM, FRAME, XML_ETACTION_FORM_CONTROL ),
+ ENTRY0( FORM, HIDDEN, XML_ETACTION_FORM_CONTROL ),
+ ENTRY0( FORM, IMAGE_FRAME, XML_ETACTION_FORM_CONTROL ),
+ ENTRY0( FORM, GRID, XML_ETACTION_FORM_CONTROL ),
+ ENTRY0( FORM, VALUE_RANGE, XML_ETACTION_FORM_CONTROL ),
+ ENTRY0( FORM, GENERIC_CONTROL, XML_ETACTION_FORM_CONTROL ),
+ ENTRY1( FORM, COLUMN, XML_ETACTION_PROC_ATTRS,
+ OASIS_FORM_COLUMN_ACTIONS ),
+ ENTRY1( FORM, PROPERTY, XML_ETACTION_FORM_PROPERTY, XML_PROPERTY ),
+ ENTRY1( FORM, LIST_PROPERTY, XML_ETACTION_FORM_PROPERTY,
+ XML_LIST_PROPERTY ),
+ ENTRY1( FORM, LIST_VALUE, XML_ETACTION_FORM_PROPERTY, XML_LIST_VALUE ),
+
+ // process xlink:href
+ ENTRY1( META, TEMPLATE, XML_ETACTION_PROC_ATTRS,
+ OASIS_XLINK_ACTIONS ), /* generated entry */
+ ENTRY1( META, AUTO_RELOAD, XML_ETACTION_PROC_ATTRS,
+ OASIS_XLINK_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, SECTION_SOURCE, XML_ETACTION_PROC_ATTRS,
+ OASIS_XLINK_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, SCRIPT, XML_ETACTION_PROC_ATTRS,
+ OASIS_XLINK_ACTIONS ), /* generated entry */
+ ENTRY1( TEXT, ALPHABETICAL_INDEX_AUTO_MARK_FILE, XML_ETACTION_PROC_ATTRS,
+ OASIS_XLINK_ACTIONS ), /* generated entry */
+ ENTRY1( TABLE, TABLE_SOURCE, XML_ETACTION_PROC_ATTRS,
+ OASIS_XLINK_ACTIONS ), /* generated entry */
+ ENTRY1( TABLE, CELL_RANGE_SOURCE, XML_ETACTION_PROC_ATTRS,
+ OASIS_XLINK_ACTIONS ), /* generated entry */
+ ENTRY1( DRAW, A, XML_ETACTION_PROC_ATTRS,
+ OASIS_XLINK_ACTIONS ), /* generated entry */
+ ENTRY1( PRESENTATION, SOUND, XML_ETACTION_PROC_ATTRS,
+ OASIS_XLINK_ACTIONS ), /* generated entry */
+ ENTRY1( FORM, FORM, XML_ETACTION_PROC_ATTRS,
+ OASIS_FORM_ACTIONS ), /* generated entry */
+// ENTRY1( SVG, FONT_FACE_URI, XML_ETACTION_PROC_ATTRS,
+// OASIS_XLINK_ACTIONS ), /* generated entry */
+// ENTRY1( SVG, DEFINITION_SRC, XML_ETACTION_PROC_ATTRS,
+// OASIS_XLINK_ACTIONS ), /* generated entry */
+ ENTRY2QN( CHART, SYMBOL_IMAGE, XML_ETACTION_RENAME_ELEM_PROC_ATTRS,
+ XML_NAMESPACE_STYLE, XML_SYMBOL_IMAGE,
+ OASIS_BACKGROUND_IMAGE_ACTIONS ),
+// OASIS_XLINK_ACTIONS ), /* generated entry */
+// events don't have real URIs
+// ENTRY1( PRESENTATION, EVENT_LISTENER, XML_ETACTION_PROC_ATTRS,
+// OASIS_XLINK_ACTIONS ), /* generated entry */
+// ENTRY1( SCRIPT, EVENT_LISTENER, XML_ETACTION_PROC_ATTRS,
+// OASIS_XLINK_ACTIONS ), /* generated entry */
+
+ // add namespace prefix to name
+ ENTRY1( CONFIG, CONFIG_ITEM_SET, XML_ETACTION_PROC_ATTRS,
+ OASIS_CONFIG_ITEM_SET_ACTIONS ),
+
+ // add namespace prefix to formula and condition
+ // text:condition
+ ENTRY1( TEXT, SECTION, XML_ETACTION_PROC_ATTRS,
+ OASIS_FORMULA_ACTIONS ), /* generated entry */
+ // text:formula
+ ENTRY1( TEXT, SEQUENCE, XML_ETACTION_PROC_ATTRS,
+ OASIS_FORMULA_ACTIONS ), /* generated entry */
+ // text:condition
+ ENTRY1( TEXT, DATABASE_NEXT, XML_ETACTION_PROC_ATTRS,
+ OASIS_FORMULA_ACTIONS ), /* generated entry */
+ // text:condition
+ ENTRY2QN( TEXT, DATABASE_ROW_SELECT, XML_ETACTION_RENAME_ELEM_PROC_ATTRS,
+ XML_NAMESPACE_TEXT, XML_DATABASE_SELECT,
+ OASIS_FORMULA_ACTIONS ), /* generated entry */
+ // text:condition
+ ENTRY1( TEXT, CONDITIONAL_TEXT, XML_ETACTION_PROC_ATTRS,
+ OASIS_FORMULA_ACTIONS ), /* generated entry */
+ // text:condition
+ ENTRY1( TEXT, HIDDEN_TEXT, XML_ETACTION_PROC_ATTRS,
+ OASIS_FORMULA_ACTIONS ), /* generated entry */
+ // text:condition
+ ENTRY1( TEXT, HIDDEN_PARAGRAPH, XML_ETACTION_PROC_ATTRS,
+ OASIS_FORMULA_ACTIONS ), /* generated entry */
+ // text:formula
+ ENTRY1( TEXT, TABLE_FORMULA, XML_ETACTION_PROC_ATTRS,
+ OASIS_FORMULA_ACTIONS ), /* generated entry */
+
+ // process table::content-validation
+ ENTRY1( TABLE, CONTENT_VALIDATION, XML_ETACTION_PROC_ATTRS,
+ OASIS_CONTENT_VALIDATION_ACTIONS ),
+
+ // rename <table:dependencies> to <table:dependences>
+ ENTRY1Q( TABLE, DEPENDENCIES, XML_ETACTION_RENAME_ELEM,
+ XML_NAMESPACE_TABLE, XML_DEPENDENCES ),
+ ENTRY1Q( TABLE, DEPENDENCY, XML_ETACTION_RENAME_ELEM,
+ XML_NAMESPACE_TABLE, XML_DEPENDENCE ),
+
+ // process table::conversion-mode
+ ENTRY1( TABLE, CONVERSION_MODE, XML_ETACTION_PROC_ATTRS,
+ OASIS_DDE_CONV_MODE_ACTIONS ),
+
+ // process table::data-pilot-member
+ ENTRY1( TABLE, DATA_PILOT_MEMBER, XML_ETACTION_PROC_ATTRS,
+ OASIS_DATAPILOT_MEMBER_ACTIONS ),
+
+ // process table::data-pilot-level
+ ENTRY1( TABLE, DATA_PILOT_LEVEL, XML_ETACTION_PROC_ATTRS,
+ OASIS_DATAPILOT_LEVEL_ACTIONS ),
+
+ // process table::source-service
+ ENTRY1( TABLE, SOURCE_SERVICE, XML_ETACTION_PROC_ATTRS,
+ OASIS_SOURCE_SERVICE_ACTIONS ),
+
+ // entries for date time change (#i36576#)
+ ENTRY1( TEXT, DATE, XML_ETACTION_PROC_ATTRS, OASIS_DATETIME_ACTIONS ),
+ ENTRY1( TEXT, CREATION_DATE, XML_ETACTION_PROC_ATTRS,
+ OASIS_DATETIME_ACTIONS ),
+ ENTRY1( TEXT, TIME, XML_ETACTION_PROC_ATTRS, OASIS_DATETIME_ACTIONS ),
+ ENTRY1( TEXT, CREATION_TIME, XML_ETACTION_PROC_ATTRS,
+ OASIS_DATETIME_ACTIONS ),
+ ENTRY1( TEXT, PRINT_TIME, XML_ETACTION_PROC_ATTRS, OASIS_DATETIME_ACTIONS ),
+ ENTRY1( TEXT, MODIFICATION_TIME, XML_ETACTION_PROC_ATTRS,
+ OASIS_DATETIME_ACTIONS ),
+ ENTRY1( TEXT, EDITING_DURATION, XML_ETACTION_PROC_ATTRS,
+ OASIS_DATETIME_ACTIONS ),
+ ENTRY1( FORM, TIME, XML_ETACTION_PROC_ATTRS, OASIS_DATETIME_ACTIONS ),
+ ENTRY1( PRESENTATION, SETTINGS, XML_ETACTION_PROC_ATTRS,
+ OASIS_DATETIME_ACTIONS ),
+
+ // fix <text:alphabatical-index-mark text:main-etry>
+ ENTRY1( TEXT, ALPHABETICAL_INDEX_MARK, XML_ETACTION_PROC_ATTRS,
+ OASIS_ALPHABETICAL_INDEX_MARK_ACTIONS ),
+ ENTRY1( TEXT, ALPHABETICAL_INDEX_MARK_START, XML_ETACTION_PROC_ATTRS,
+ OASIS_ALPHABETICAL_INDEX_MARK_ACTIONS ),
+
+ // fix id strings in old animation elements
+ ENTRY1( PRESENTATION, DIM, XML_ETACTION_PROC_ATTRS, OASIS_ANIMATION_ACTIONS ),
+ ENTRY1( PRESENTATION, PLAY, XML_ETACTION_PROC_ATTRS, OASIS_ANIMATION_ACTIONS ),
+ ENTRY1( PRESENTATION, SHOW_TEXT, XML_ETACTION_PROC_ATTRS, OASIS_ANIMATION_ACTIONS ),
+ ENTRY1( PRESENTATION, SHOW_SHAPE, XML_ETACTION_PROC_ATTRS, OASIS_ANIMATION_ACTIONS ),
+ ENTRY1( PRESENTATION, HIDE_TEXT, XML_ETACTION_PROC_ATTRS, OASIS_ANIMATION_ACTIONS ),
+ ENTRY1( PRESENTATION, HIDE_SHAPE, XML_ETACTION_PROC_ATTRS, OASIS_ANIMATION_ACTIONS ),
+
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ETACTION_EOT )
+};
+
+// XML_ETACTION_STYLE
+static XMLTransformerActionInit aStyleActionTable[] =
+{
+ ENTRY0( STYLE, FAMILY, XML_ATACTION_STYLE_FAMILY ),
+ ENTRY1( STYLE, NAME, XML_ATACTION_DECODE_STYLE_NAME,
+ XML_FAMILY_TYPE_END ),
+ ENTRY1( STYLE, DISPLAY_NAME, XML_ATACTION_STYLE_DISPLAY_NAME,
+ XML_FAMILY_TYPE_END ),
+ ENTRY1( STYLE, PARENT_STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF,
+ XML_FAMILY_TYPE_END ),
+ ENTRY1( STYLE, NEXT_STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF,
+ XML_FAMILY_TYPE_END ),
+ ENTRY1( STYLE, LIST_STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF,
+ XML_FAMILY_TYPE_LIST ),
+ ENTRY1( STYLE, MASTER_PAGE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF,
+ XML_FAMILY_TYPE_MASTER_PAGE ),
+ ENTRY0( STYLE, DEFAULT_OUTLINE_LEVEL, XML_ATACTION_REMOVE ),
+ ENTRY1( TEXT, STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF,
+ XML_FAMILY_TYPE_TEXT ), // list level styles
+ ENTRY1( DRAW, NAME, XML_ATACTION_DECODE_STYLE_NAME,
+ XML_FAMILY_TYPE_END ),
+ ENTRY1( DRAW, DISPLAY_NAME, XML_ATACTION_STYLE_DISPLAY_NAME,
+ XML_FAMILY_TYPE_END ),
+ ENTRY0( DRAW, DISTANCE, XML_ATACTION_IN2INCH ),
+ ENTRY0( DRAW, DOTS1_LENGTH, XML_ATACTION_IN2INCH ),
+ ENTRY0( DRAW, DOTS2_LENGTH, XML_ATACTION_IN2INCH ),
+ ENTRY0( SVG, WIDTH, XML_ATACTION_IN2INCH ),
+ ENTRY0( SVG, HEIGHT, XML_ATACTION_IN2INCH ),
+ ENTRY0( DRAW, START, XML_ATACTION_NEG_PERCENT ),
+ ENTRY0( DRAW, END, XML_ATACTION_NEG_PERCENT ),
+ ENTRY1( XLINK, HREF, XML_ATACTION_URI_OASIS, sal_True ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OASIS_FRAME_ELEM_ACTIONS
+static XMLTransformerActionInit aFrameActionTable[] =
+{
+ ENTRY0( DRAW, TEXT_BOX, XML_ETACTION_COPY ),
+ ENTRY0( DRAW, IMAGE, XML_ETACTION_COPY ),
+ ENTRY0( DRAW, OBJECT, XML_ETACTION_COPY ),
+ ENTRY0( DRAW, OBJECT_OLE, XML_ETACTION_COPY ),
+ ENTRY0( DRAW, APPLET, XML_ETACTION_COPY ),
+ ENTRY0( DRAW, PLUGIN, XML_ETACTION_COPY ),
+ ENTRY0( DRAW, FLOATING_FRAME, XML_ETACTION_COPY ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OASIS_EVENT_ELEM_ACTIONS
+static XMLTransformerActionInit aEventActionTable[] =
+{
+ ENTRY0( XLINK, HREF, XML_ATACTION_HREF ),
+ ENTRY1( SCRIPT, LANGUAGE, XML_ATACTION_REMOVE_NAMESPACE_PREFIX,
+ XML_NAMESPACE_OOO ),
+ ENTRY0( SCRIPT, EVENT_NAME, XML_ATACTION_EVENT_NAME ),
+ ENTRY0( SCRIPT, MACRO_NAME, XML_ATACTION_MACRO_NAME ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OASIS_EVENT_ELEM_ACTIONS
+static XMLTransformerActionInit aDlgActionTable[] =
+{
+ ENTRY0( DLG, BORDER, XML_ATACTION_DLG_BORDER )
+};
+
+// action table for OASIS_MASTER_PAGE_ACTIONS
+static XMLTransformerActionInit aMasterPageActionTable[] =
+{
+ ENTRY1( STYLE, NAME, XML_ATACTION_DECODE_STYLE_NAME,
+ XML_FAMILY_TYPE_MASTER_PAGE ),
+ ENTRY1( STYLE, DISPLAY_NAME, XML_ATACTION_STYLE_DISPLAY_NAME,
+ XML_FAMILY_TYPE_MASTER_PAGE ),
+ ENTRY1( STYLE, NEXT_STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF,
+ XML_FAMILY_TYPE_MASTER_PAGE ),
+ ENTRY1Q( STYLE, PAGE_LAYOUT_NAME, XML_ATACTION_RENAME,
+ XML_NAMESPACE_STYLE, XML_PAGE_MASTER_NAME ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// action table for OASIS_TEXT_STYLE_REF_ACTIONS
+static XMLTransformerActionInit aTextStyleRefActionTable[] =
+{
+ ENTRY1( TEXT, STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF,
+ XML_FAMILY_TYPE_TEXT ),
+ ENTRY1( TEXT, VISITED_STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF,
+ XML_FAMILY_TYPE_TEXT ),
+ ENTRY1( XLINK, HREF, XML_ATACTION_URI_OASIS, sal_False ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// action table for OASIS_PARA_STYLE_REF_ACTIONS
+static XMLTransformerActionInit aParaStyleRefActionTable[] =
+{
+ ENTRY1( TEXT, STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF,
+ XML_FAMILY_TYPE_PARAGRAPH ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+
+// action table for OASIS_LIST_STYLE_REF_ACTIONS
+static XMLTransformerActionInit aListStyleRefActionTable[] =
+{
+ ENTRY1( TEXT, STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF,
+ XML_FAMILY_TYPE_LIST ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// action table for OASIS_MASTER_PAGE_REF_ACTIONS
+static XMLTransformerActionInit aMasterPageRefActionTable[] =
+{
+ ENTRY1( DRAW, MASTER_PAGE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF,
+ XML_FAMILY_TYPE_MASTER_PAGE ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// action table for OASIS_MAP_STYLE_REF_ACTIONS
+static XMLTransformerActionInit aMapStyleRefActionTable[] =
+{
+ ENTRY1( STYLE, APPLY_STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF,
+ XML_FAMILY_TYPE_END ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// action table for OASIS_TABLE_STYLE_REF_ACTIONS (#i40011#, #i40015#)
+static XMLTransformerActionInit aTableStyleRefActionTable[] =
+{
+ ENTRY1( TABLE, STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF,
+ XML_FAMILY_TYPE_END ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+static XMLTransformerActionInit aFontFaceActionTable[] =
+{
+ ENTRY1Q( SVG, FONT_FAMILY, XML_ATACTION_RENAME,
+ XML_NAMESPACE_FO, XML_FONT_FAMILY ),
+ ENTRY1Q( STYLE, FONT_ADORNMENTS, XML_ATACTION_RENAME,
+ XML_NAMESPACE_STYLE, XML_FONT_STYLE_NAME ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// action table for OASIS_PARA_ACTIONS
+static XMLTransformerActionInit aParaActionTable[] =
+{
+ ENTRY1( TEXT, STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF,
+ XML_FAMILY_TYPE_PARAGRAPH ),
+ ENTRY1( TEXT, COND_STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF,
+ XML_FAMILY_TYPE_PARAGRAPH ),
+ ENTRY1Q( TEXT, OUTLINE_LEVEL, XML_ATACTION_RENAME,
+ XML_NAMESPACE_TEXT, XML_LEVEL ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// !!ATTENTION!! If you change something here, please also change
+// aConnectorActionTable if apropriate
+static XMLTransformerActionInit aShapeActionTable[] =
+{
+ ENTRY1( DRAW, STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF,
+ XML_FAMILY_TYPE_GRAPHIC ),
+ ENTRY1( DRAW, TEXT_STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF,
+ XML_FAMILY_TYPE_PARAGRAPH ),
+ ENTRY1( PRESENTATION, STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF,
+ XML_FAMILY_TYPE_PRESENTATION ),
+ ENTRY0( SVG, X, XML_ATACTION_IN2INCH ),
+ ENTRY0( SVG, Y, XML_ATACTION_IN2INCH ),
+ ENTRY0( SVG, X1, XML_ATACTION_IN2INCH ),
+ ENTRY0( SVG, Y1, XML_ATACTION_IN2INCH ),
+ ENTRY0( SVG, X2, XML_ATACTION_IN2INCH ),
+ ENTRY0( SVG, Y2, XML_ATACTION_IN2INCH ),
+ ENTRY0( SVG, CX, XML_ATACTION_IN2INCH ),
+ ENTRY0( SVG, CY, XML_ATACTION_IN2INCH ),
+ ENTRY0( DRAW, END_X, XML_ATACTION_IN2INCH ),
+ ENTRY0( DRAW, END_Y, XML_ATACTION_IN2INCH ),
+ ENTRY0( SVG, R, XML_ATACTION_IN2INCH ),
+ ENTRY0( SVG, RX, XML_ATACTION_IN2INCH ),
+ ENTRY0( SVG, RY, XML_ATACTION_IN2INCH ),
+ ENTRY0( SVG, WIDTH, XML_ATACTION_SVG_WIDTH_HEIGHT_OASIS ),
+ ENTRY0( SVG, HEIGHT, XML_ATACTION_SVG_WIDTH_HEIGHT_OASIS ),
+ ENTRY0( FO, MIN_WIDTH, XML_ATACTION_IN2INCH ),
+ ENTRY0( FO, MIN_HEIGHT, XML_ATACTION_IN2INCH ),
+ ENTRY0( FO, MAX_WIDTH, XML_ATACTION_IN2INCH ),
+ ENTRY0( FO, MAX_HEIGHT, XML_ATACTION_IN2INCH ),
+ ENTRY0( DRAW, CORNER_RADIUS, XML_ATACTION_IN2INCH ),
+ ENTRY0( DRAW, LINE_SKEW, XML_ATACTION_INS2INCHS ),
+ ENTRY0( DRAW, CAPTION_POINT_X, XML_ATACTION_IN2INCH ),
+ ENTRY0( DRAW, CAPTION_POINT_Y, XML_ATACTION_IN2INCH ),
+ ENTRY0( DR3D, DISTANCE, XML_ATACTION_IN2INCH ),
+ ENTRY0( DR3D, FOCAL_LENGTH, XML_ATACTION_IN2INCH ),
+ ENTRY1Q( DRAW, CONTROL, XML_ATACTION_RENAME,
+ XML_NAMESPACE_FORM, XML_ID ),
+ ENTRY1( XLINK, HREF, XML_ATACTION_URI_OASIS, sal_True ),
+
+ // BM: needed by chart:legend. The legend needs also the draw actions. As
+ // there is no merge mechanism, all actions have to be in the same table
+ ENTRY2( CHART, LEGEND_POSITION, XML_ATACTION_RENAME_ATTRIBUTE,
+ RENAME_ENTRY( XML_START, XML_LEFT ),
+ RENAME_ENTRY( XML_END, XML_RIGHT )),
+
+ ENTRY0( DRAW, ID, XML_ATACTION_DECODE_ID ),
+
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OASIS_ANIMATION_ACTIONS
+static XMLTransformerActionInit aAnimationActionTable[] =
+{
+ ENTRY0( DRAW, SHAPE_ID, XML_ATACTION_DECODE_ID ),
+ ENTRY0( PRESENTATION, DELAY, XML_ATACTION_RNG2ISO_DATETIME ),
+ ENTRY0( PRESENTATION, PAUSE, XML_ATACTION_RNG2ISO_DATETIME ),
+
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OOO_CONNECTOR_ACTIONS
+static XMLTransformerActionInit aConnectorActionTable[] =
+{
+ ENTRY1( DRAW, STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF,
+ XML_FAMILY_TYPE_GRAPHIC ),
+ ENTRY1( DRAW, TEXT_STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF,
+ XML_FAMILY_TYPE_PARAGRAPH ),
+ ENTRY1( PRESENTATION, STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF,
+ XML_FAMILY_TYPE_PRESENTATION ),
+ ENTRY0( SVG, X1, XML_ATACTION_IN2TWIPS ),
+ ENTRY0( SVG, Y1, XML_ATACTION_IN2TWIPS ),
+ ENTRY0( SVG, X2, XML_ATACTION_IN2TWIPS ),
+ ENTRY0( SVG, Y2, XML_ATACTION_IN2TWIPS ),
+ ENTRY0( DRAW, END_X, XML_ATACTION_IN2INCH ),
+ ENTRY0( DRAW, END_Y, XML_ATACTION_IN2INCH ),
+ ENTRY0( SVG, WIDTH, XML_ATACTION_SVG_WIDTH_HEIGHT_OASIS ),
+ ENTRY0( SVG, HEIGHT, XML_ATACTION_SVG_WIDTH_HEIGHT_OASIS ),
+ ENTRY0( FO, MIN_WIDTH, XML_ATACTION_IN2INCH ),
+ ENTRY0( FO, MIN_HEIGHT, XML_ATACTION_IN2INCH ),
+ ENTRY0( FO, MAX_WIDTH, XML_ATACTION_IN2INCH ),
+ ENTRY0( FO, MAX_HEIGHT, XML_ATACTION_IN2INCH ),
+ ENTRY0( DRAW, LINE_SKEW, XML_ATACTION_INS2INCHS ),
+ ENTRY1Q( DRAW, CONTROL, XML_ATACTION_RENAME,
+ XML_NAMESPACE_FORM, XML_ID ),
+ ENTRY1( XLINK, HREF, XML_ATACTION_URI_OASIS, sal_True ),
+ ENTRY0( DRAW, START_SHAPE, XML_ATACTION_DECODE_ID ),
+ ENTRY0( DRAW, END_SHAPE, XML_ATACTION_DECODE_ID ),
+
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OASIS_INDEX_ENTRY_TAB_STOP_ACTIONS
+static XMLTransformerActionInit aIndexEntryTabStopActionTable[] =
+{
+ ENTRY0( STYLE, POSITION, XML_ATACTION_IN2INCH ),
+ ENTRY1( TEXT, STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF,
+ XML_FAMILY_TYPE_TEXT ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OASIS_TAB_STOP_ACTIONS
+static XMLTransformerActionInit aTabStopActionTable[] =
+{
+ ENTRY0( STYLE, POSITION, XML_ATACTION_IN2INCH ),
+ ENTRY1Q( STYLE, LEADER_TEXT, XML_ATACTION_RENAME,
+ XML_NAMESPACE_STYLE, XML_LEADER_CHAR ),
+ ENTRY0( STYLE, LEADER_STYLE, XML_ATACTION_REMOVE ),
+ ENTRY0( STYLE, LEADER_TYPE, XML_ATACTION_REMOVE ),
+ ENTRY0( STYLE, LEADER_WIDTH, XML_ATACTION_REMOVE ),
+ ENTRY0( STYLE, LEADER_COLOR, XML_ATACTION_REMOVE ),
+ ENTRY0( STYLE, LEADER_TEXT_STYLE, XML_ATACTION_REMOVE ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OASIS_LINENUMBERING_ACTIONS
+static XMLTransformerActionInit aLineNumberingActionTable[] =
+{
+ ENTRY0( TEXT, OFFSET, XML_ATACTION_IN2INCH ),
+ ENTRY1( TEXT, STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF,
+ XML_FAMILY_TYPE_TEXT ),
+ ENTRY1Q( TEXT, COUNT_IN_TEXT_BOXES , XML_ATACTION_RENAME,
+ XML_NAMESPACE_TEXT, XML_COUNT_IN_FLOATING_FRAMES),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+static XMLTransformerActionInit aFootnoteSepActionTable[] =
+{
+ ENTRY0( STYLE, WIDTH, XML_ATACTION_IN2INCH ),
+ ENTRY0( STYLE, DISTANCE_BEFORE_SEP, XML_ATACTION_IN2INCH ),
+ ENTRY0( STYLE, DISTANCE_AFTER_SEP, XML_ATACTION_IN2INCH ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OASIS_NOTES_ACTIONS (processed by special context)
+static XMLTransformerActionInit aNotesActionTable[] =
+{
+ ENTRY0( TEXT, NOTE_CLASS, XML_ATACTION_STYLE_FAMILY ),
+ ENTRY1( TEXT, CITATION_STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF,
+ XML_FAMILY_TYPE_TEXT ),
+ ENTRY1( TEXT, CITATION_BODY_STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF,
+ XML_FAMILY_TYPE_TEXT ),
+ ENTRY1( TEXT, DEFAULT_STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF,
+ XML_FAMILY_TYPE_PARAGRAPH ),
+ ENTRY1( TEXT, MASTER_PAGE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF,
+ XML_FAMILY_TYPE_MASTER_PAGE ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OASIS_DROP_CAP_ACTIONS
+static XMLTransformerActionInit aDropCapActionTable[] =
+{
+ ENTRY0( STYLE, DISTANCE, XML_ATACTION_IN2INCH ),
+ ENTRY1( STYLE, STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF,
+ XML_FAMILY_TYPE_TEXT ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+static XMLTransformerActionInit aColumnsActionTable[] =
+{
+ ENTRY0( STYLE, COLUMN_GAP, XML_ATACTION_IN2INCH ),
+ ENTRY0( STYLE, SPACE_BEFORE, XML_ATACTION_REMOVE ),
+ ENTRY0( STYLE, SPACE_AFTER, XML_ATACTION_REMOVE ),
+ ENTRY1Q( FO, START_INDENT, XML_ATACTION_RENAME_IN2INCH,
+ XML_NAMESPACE_FO, XML_MARGIN_LEFT ),
+ ENTRY1Q( FO, END_INDENT, XML_ATACTION_RENAME_IN2INCH,
+ XML_NAMESPACE_FO, XML_MARGIN_RIGHT ),
+ ENTRY0( STYLE, WIDTH, XML_ATACTION_IN2INCH ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OASIS_TEXT_VALUE_TYPE_ACTIONS
+static XMLTransformerActionInit aTextValueTypeActionTable[] =
+{
+ ENTRY1Q( OFFICE, VALUE_TYPE, XML_ATACTION_RENAME,
+ XML_NAMESPACE_TEXT, XML_VALUE_TYPE ),
+ ENTRY1Q( OFFICE, VALUE, XML_ATACTION_RENAME,
+ XML_NAMESPACE_TEXT, XML_VALUE ),
+ ENTRY1Q( OFFICE, CURRENCY, XML_ATACTION_RENAME,
+ XML_NAMESPACE_TEXT, XML_CURRENCY ),
+ ENTRY1Q( OFFICE, DATE_VALUE, XML_ATACTION_RENAME_RNG2ISO_DATETIME,
+ XML_NAMESPACE_TEXT, XML_DATE_VALUE ),
+ ENTRY1Q( OFFICE, TIME_VALUE, XML_ATACTION_RENAME_RNG2ISO_DATETIME,
+ XML_NAMESPACE_TEXT, XML_TIME_VALUE ),
+ ENTRY1Q( OFFICE, BOOLEAN_VALUE, XML_ATACTION_RENAME,
+ XML_NAMESPACE_TEXT, XML_BOOLEAN_VALUE ),
+ ENTRY1Q( OFFICE, STRING_VALUE, XML_ATACTION_RENAME,
+ XML_NAMESPACE_TEXT, XML_STRING_VALUE ),
+ ENTRY0( TEXT, FORMULA, XML_ATACTION_REMOVE_ANY_NAMESPACE_PREFIX ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OASIS_TABLE_VALUE_TYPE_ACTIONS
+static XMLTransformerActionInit aTableValueTypeActionTable[] =
+{
+ ENTRY1Q( OFFICE, VALUE_TYPE, XML_ATACTION_RENAME,
+ XML_NAMESPACE_TABLE, XML_VALUE_TYPE ),
+ ENTRY1Q( OFFICE, VALUE, XML_ATACTION_RENAME,
+ XML_NAMESPACE_TABLE, XML_VALUE ),
+ ENTRY1Q( OFFICE, CURRENCY, XML_ATACTION_RENAME,
+ XML_NAMESPACE_TABLE, XML_CURRENCY ),
+ ENTRY1Q( OFFICE, DATE_VALUE, XML_ATACTION_RENAME_RNG2ISO_DATETIME,
+ XML_NAMESPACE_TABLE, XML_DATE_VALUE ),
+ ENTRY1Q( OFFICE, TIME_VALUE, XML_ATACTION_RENAME_RNG2ISO_DATETIME,
+ XML_NAMESPACE_TABLE, XML_TIME_VALUE ),
+ ENTRY1Q( OFFICE, BOOLEAN_VALUE, XML_ATACTION_RENAME,
+ XML_NAMESPACE_TABLE, XML_BOOLEAN_VALUE ),
+ ENTRY1Q( OFFICE, STRING_VALUE, XML_ATACTION_RENAME,
+ XML_NAMESPACE_TABLE, XML_STRING_VALUE ),
+ ENTRY1( TABLE, STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF,
+ XML_FAMILY_TYPE_TABLE_CELL ),
+ ENTRY0( TABLE, FORMULA, XML_ATACTION_REMOVE_ANY_NAMESPACE_PREFIX ),
+ ENTRY1Q( TABLE, CONTENT_VALIDATION_NAME, XML_ATACTION_RENAME,
+ XML_NAMESPACE_TABLE, XML_VALIDATION_NAME ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// action table for OASIS_ANNOTATION_ACTIONS
+static XMLTransformerActionInit aAnnotationActionTable[] =
+{
+ ENTRY1Q( DC, CREATOR, XML_ATACTION_MOVE_FROM_ELEM,
+ XML_NAMESPACE_OFFICE, XML_AUTHOR ),
+ ENTRY1Q( DC, DATE, XML_ATACTION_MOVE_FROM_ELEM_RNG2ISO_DATETIME,
+ XML_NAMESPACE_OFFICE, XML_CREATE_DATE ),
+ ENTRY1Q( META, DATE_STRING, XML_ATACTION_MOVE_FROM_ELEM,
+ XML_NAMESPACE_OFFICE, XML_CREATE_DATE_STRING ),
+ ENTRY0( TEXT, P, XML_ETACTION_EXTRACT_CHARACTERS ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// action table for OASIS_CHANGE_INFO_ACTIONS
+static XMLTransformerActionInit aChangeInfoActionTable[] =
+{
+ ENTRY1Q( DC, CREATOR, XML_ATACTION_MOVE_FROM_ELEM,
+ XML_NAMESPACE_OFFICE, XML_CHG_AUTHOR ),
+ ENTRY1Q( DC, DATE, XML_ATACTION_MOVE_FROM_ELEM_RNG2ISO_DATETIME,
+ XML_NAMESPACE_OFFICE, XML_CHG_DATE_TIME ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OASIS_BACKGROUND_IMAGE_ACTIONS
+static XMLTransformerActionInit aBackgroundImageActionTable[] =
+{
+ ENTRY1Q( DRAW, OPACITY, XML_ATACTION_RENAME_NEG_PERCENT,
+ XML_NAMESPACE_DRAW, XML_TRANSPARENCY ),
+ ENTRY1( XLINK, HREF, XML_ATACTION_URI_OASIS, sal_True ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OASIS_DDE_CONNECTION_DECL
+static XMLTransformerActionInit aDDEConnectionDeclActionTable[] =
+{
+ ENTRY1Q( OFFICE, NAME, XML_ATACTION_RENAME,
+ XML_NAMESPACE_TEXT, XML_NAME ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+
+// OASIS_FORM_CONTROL_ACTIONS
+static XMLTransformerActionInit aFormControlActionTable[] =
+{
+ ENTRY0( FORM, NAME, XML_ATACTION_MOVE_TO_ELEM ),
+ ENTRY2QN( FORM, CONTROL_IMPLEMENTATION,
+ XML_ATACTION_RENAME_REMOVE_NAMESPACE_PREFIX,
+ XML_NAMESPACE_FORM, XML_SERVICE_NAME,
+ XML_NAMESPACE_OOO ),
+ ENTRY0( FORM, ID, XML_ATACTION_MOVE_TO_ELEM ),
+ ENTRY1( XLINK, HREF, XML_ATACTION_URI_OASIS, sal_False ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OASIS_FORM_COLUMN_ACTIONS
+static XMLTransformerActionInit aFormColumnActionTable[] =
+{
+ ENTRY1Q( FORM, TEXT_STYLE_NAME, XML_ATACTION_RENAME_DECODE_STYLE_NAME_REF,
+ XML_NAMESPACE_FORM, XML_COLUMN_STYLE_NAME ),
+ ENTRY2QN( FORM, CONTROL_IMPLEMENTATION,
+ XML_ATACTION_RENAME_REMOVE_NAMESPACE_PREFIX,
+ XML_NAMESPACE_FORM, XML_SERVICE_NAME,
+ XML_NAMESPACE_OOO ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OASIS_FORM_PROP_ACTIONS
+static XMLTransformerActionInit aFormPropActionTable[] =
+{
+ ENTRY1Q( OFFICE, VALUE_TYPE, XML_ATACTION_RENAME,
+ XML_NAMESPACE_FORM, XML_PROPERTY_TYPE ),
+ ENTRY0( OFFICE, VALUE, XML_ATACTION_REMOVE ),
+ ENTRY0( OFFICE, STRING_VALUE, XML_ATACTION_REMOVE ),
+ ENTRY0( OFFICE, BOOLEAN_VALUE, XML_ATACTION_REMOVE ),
+ ENTRY0( OFFICE, DATE_VALUE, XML_ATACTION_REMOVE ),
+ ENTRY0( OFFICE, TIME_VALUE, XML_ATACTION_REMOVE ),
+ ENTRY0( OFFICE, CURRENCY, XML_ATACTION_REMOVE ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OASIS_XLINK_ACTIONS
+static XMLTransformerActionInit aXLinkActionTable[] =
+{
+ ENTRY1( XLINK, HREF, XML_ATACTION_URI_OASIS, sal_False ),
+ ENTRY0( TABLE, REFRESH_DELAY, XML_ATACTION_RNG2ISO_DATETIME ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OASIS_CONFIG_ITEM_SET_ACTIONS
+static XMLTransformerActionInit aConfigItemSetActionTable[] =
+{
+ ENTRY1( CONFIG, NAME, XML_ATACTION_REMOVE_NAMESPACE_PREFIX,
+ XML_NAMESPACE_OOO ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OASIS_FORMULA_ACTIONS
+static XMLTransformerActionInit aFormulaActionTable[] =
+{
+ ENTRY0( TEXT, CONDITION, XML_ATACTION_REMOVE_ANY_NAMESPACE_PREFIX ),
+ ENTRY0( TEXT, FORMULA, XML_ATACTION_REMOVE_ANY_NAMESPACE_PREFIX ),
+ ENTRY0( TABLE, CONDITION, XML_ATACTION_REMOVE_ANY_NAMESPACE_PREFIX ),
+ ENTRY0( TABLE, FORMULA, XML_ATACTION_REMOVE_ANY_NAMESPACE_PREFIX ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OASIS_CONTENT_VALIDATION_ACTIONS
+static XMLTransformerActionInit aContentValidationActionTable[] =
+{
+ ENTRY0( TABLE, CONDITION, XML_ATACTION_REMOVE_ANY_NAMESPACE_PREFIX ),
+ ENTRY0( TABLE, DISPLAY_LIST, XML_ATACTION_REMOVE ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OASIS_DDE_CONV_MODE_ACTIONS
+static XMLTransformerActionInit aDDEConvModeActionTable[] =
+{
+ ENTRY1Q( TABLE, KEEP_TEXT, XML_ATACTION_RENAME,
+ XML_NAMESPACE_TABLE, XML_LET_TEXT ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OASIS_DATAPILOT_MEMBER_ACTIONS
+static XMLTransformerActionInit aDataPilotMemberActionTable[] =
+{
+ ENTRY1Q( TABLE, SHOW_DETAILS, XML_ATACTION_RENAME,
+ XML_NAMESPACE_TABLE, XML_DISPLAY_DETAILS ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OASIS_DATAPILOT_LEVEL_ACTIONS
+static XMLTransformerActionInit aDataPilotLevelActionTable[] =
+{
+ ENTRY1Q( TABLE, SHOW_EMPTY, XML_ATACTION_RENAME,
+ XML_NAMESPACE_TABLE, XML_DISPLAY_EMPTY ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OASIS_SOURCE_SERVICE_ACTIONS
+static XMLTransformerActionInit aSourceServiceActionTable[] =
+{
+ ENTRY1Q( TABLE, USER_NAME, XML_ATACTION_RENAME,
+ XML_NAMESPACE_TABLE, XML_USERNAME ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OASIS_CHART_ACTIONS
+static XMLTransformerActionInit aChartActionTable[] =
+{
+ ENTRY0( CHART, CLASS, XML_ATACTION_REMOVE_ANY_NAMESPACE_PREFIX ),
+ ENTRY1( DRAW, STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF,
+ XML_FAMILY_TYPE_GRAPHIC ),
+ ENTRY0( SVG, WIDTH, XML_ATACTION_IN2INCH ),
+ ENTRY0( SVG, HEIGHT, XML_ATACTION_IN2INCH ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OASIS_FORM_ACTIONS
+static XMLTransformerActionInit aFormActionTable[] =
+{
+ ENTRY2QN( FORM, CONTROL_IMPLEMENTATION,
+ XML_ATACTION_RENAME_REMOVE_NAMESPACE_PREFIX,
+ XML_NAMESPACE_FORM, XML_SERVICE_NAME,
+ XML_NAMESPACE_OOO ),
+ ENTRY1( XLINK, HREF, XML_ATACTION_URI_OASIS, sal_False ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OASIS_ALPHABETICAL_INDEX_MARK_ACTIONS
+static XMLTransformerActionInit aAlphabeticalIndexMarkActionTable[] =
+{
+ ENTRY1Q( TEXT, MAIN_ENTRY, XML_ATACTION_RENAME,
+ XML_NAMESPACE_TEXT, XML_MAIN_ETRY ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OASIS_DRAW_AREA_POLYGON_ACTIONS (to be added to OASIS_SHAPE_ACTIONS)
+static XMLTransformerActionInit aDrawAreaPolygonActionTable[] =
+{
+ ENTRY1Q( DRAW, POINTS, XML_ATACTION_RENAME,
+ XML_NAMESPACE_SVG, XML_POINTS ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OASIS_SCRIPT_ACTIONS
+static XMLTransformerActionInit aScriptActionTable[] =
+{
+ ENTRY1( SCRIPT, LANGUAGE, XML_ATACTION_REMOVE_NAMESPACE_PREFIX, XML_NAMESPACE_OOO ),
+ ENTRY1Q( OOO, NAME, XML_ATACTION_RENAME, XML_NAMESPACE_SCRIPT, XML_NAME ),
+ ENTRY1Q( OOO, READONLY, XML_ATACTION_RENAME, XML_NAMESPACE_SCRIPT, XML_READONLY ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+// OASIS_DATETIME_ACTIONS
+static XMLTransformerActionInit aDateTimeActionTable[] =
+{
+ ENTRY0( TEXT, DATE_VALUE, XML_ATACTION_RNG2ISO_DATETIME ),
+ ENTRY0( TEXT, TIME_VALUE, XML_ATACTION_RNG2ISO_DATETIME ),
+ ENTRY0( TEXT, DATE_ADJUST, XML_ATACTION_RNG2ISO_DATETIME ),
+ ENTRY0( TEXT, TIME_ADJUST, XML_ATACTION_RNG2ISO_DATETIME ),
+ ENTRY0( TEXT, DURATION, XML_ATACTION_RNG2ISO_DATETIME ),
+ ENTRY0( OFFICE, DATE_VALUE, XML_ATACTION_RNG2ISO_DATETIME ),
+ ENTRY0( OFFICE, TIME_VALUE, XML_ATACTION_RNG2ISO_DATETIME ),
+ ENTRY0( FORM, VALUE, XML_ATACTION_RNG2ISO_DATETIME ),
+ ENTRY0( FORM, CURRENT_VALUE, XML_ATACTION_RNG2ISO_DATETIME ),
+ ENTRY0( TABLE, DATE_START, XML_ATACTION_RNG2ISO_DATETIME ),
+ ENTRY0( TABLE, DATE_END, XML_ATACTION_RNG2ISO_DATETIME ),
+ ENTRY0( TABLE, REFRESH_DELAY, XML_ATACTION_RNG2ISO_DATETIME ),
+ ENTRY0( PRESENTATION, DELAY, XML_ATACTION_RNG2ISO_DATETIME ),
+ ENTRY0( PRESENTATION, PAUSE, XML_ATACTION_RNG2ISO_DATETIME ),
+ ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
+};
+
+static XMLTokenEnum aTokenMap[] =
+{
+ XML_NONE, XML_SOLID, XML_DOTTED, XML_DASH, XML_LONG_DASH, XML_DOT_DASH,
+ XML_DOT_DOT_DASH, XML_WAVE, XML_SMALL_WAVE, XML_TOKEN_END
+};
+
+// -----------------------------------------------------------------------------
+
+class XMLTableTransformerContext_Impl : public XMLTransformerContext
+{
+ ::rtl::OUString m_aElemQName;
+
+public:
+ TYPEINFO();
+
+ XMLTableTransformerContext_Impl( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName );
+
+ virtual ~XMLTableTransformerContext_Impl();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+};
+
+TYPEINIT1( XMLTableTransformerContext_Impl, XMLTransformerContext );
+
+XMLTableTransformerContext_Impl::XMLTableTransformerContext_Impl(
+ XMLTransformerBase& rImp,
+ const OUString& rQName ) :
+ XMLTransformerContext( rImp, rQName ),
+ m_aElemQName( rQName )
+{
+}
+
+XMLTableTransformerContext_Impl::~XMLTableTransformerContext_Impl()
+{
+}
+
+void XMLTableTransformerContext_Impl::StartElement(
+ const Reference< XAttributeList >& rAttrList )
+{
+ Reference< XAttributeList > xAttrList( rAttrList );
+
+ XMLMutableAttributeList *pMutableAttrList = 0;
+ // <--
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ if( XML_NAMESPACE_TABLE == nPrefix )
+ {
+ if ( IsXMLToken( aLocalName, XML_IS_SUB_TABLE ) )
+ {
+ const OUString& rValue = xAttrList->getValueByIndex( i );
+ if( IsXMLToken( rValue, XML_TRUE ) )
+ {
+ m_aElemQName = GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_TABLE,
+ ::xmloff::token::GetXMLToken( XML_SUB_TABLE ) );
+ if ( !pMutableAttrList )
+ {
+ pMutableAttrList =
+ new XMLMutableAttributeList( xAttrList );
+ xAttrList = pMutableAttrList;
+ }
+ pMutableAttrList->RemoveAttributeByIndex( i );
+ }
+ // OD 2005-07-05 #i50521# - no break here for savety reason.
+ }
+ // Convert attribute table:style-name for <table:table> (#i40011#, #i40015#)
+ else if ( IsXMLToken( aLocalName, XML_STYLE_NAME ) )
+ {
+ const OUString& rValue = xAttrList->getValueByIndex( i );
+ OUString aAttrValue( rValue );
+ if( GetTransformer().DecodeStyleName(aAttrValue) )
+ {
+ if ( !pMutableAttrList )
+ {
+ pMutableAttrList =
+ new XMLMutableAttributeList( xAttrList );
+ xAttrList = pMutableAttrList;
+ }
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ }
+ else if( IsXMLToken( aLocalName, XML_PRINT ) )
+ {
+ if ( !pMutableAttrList )
+ {
+ pMutableAttrList =
+ new XMLMutableAttributeList( xAttrList );
+ xAttrList = pMutableAttrList;
+ }
+ pMutableAttrList->RemoveAttributeByIndex( i );
+ }
+ }
+ }
+
+ GetTransformer().GetDocHandler()->startElement( m_aElemQName, xAttrList );
+}
+
+void XMLTableTransformerContext_Impl::EndElement()
+{
+ GetTransformer().GetDocHandler()->endElement( m_aElemQName );
+}
+
+// -----------------------------------------------------------------------------
+
+class XMLBodyOASISTransformerContext_Impl : public XMLTransformerContext
+{
+ sal_Bool m_bFirstChild;
+
+public:
+ TYPEINFO();
+
+ XMLBodyOASISTransformerContext_Impl( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName );
+
+ virtual ~XMLBodyOASISTransformerContext_Impl();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::rtl::OUString& rQName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+};
+
+TYPEINIT1( XMLBodyOASISTransformerContext_Impl, XMLTransformerContext );
+
+XMLBodyOASISTransformerContext_Impl::XMLBodyOASISTransformerContext_Impl(
+ XMLTransformerBase& rImp,
+ const OUString& rQName ) :
+ XMLTransformerContext( rImp, rQName ),
+ m_bFirstChild( sal_False )
+{
+}
+
+XMLBodyOASISTransformerContext_Impl::~XMLBodyOASISTransformerContext_Impl()
+{
+}
+
+void XMLBodyOASISTransformerContext_Impl::StartElement(
+ const Reference< XAttributeList >& )
+{
+}
+
+XMLTransformerContext* XMLBodyOASISTransformerContext_Impl::CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::rtl::OUString& rQName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList )
+{
+ if (!m_bFirstChild)
+ {
+ m_bFirstChild = sal_True;
+ XMLTransformerContext::StartElement(xAttrList);
+ }
+
+ return XMLTransformerContext::CreateChildContext(nPrefix, rLocalName, rQName, xAttrList);
+}
+
+void XMLBodyOASISTransformerContext_Impl::EndElement()
+{
+ if (!m_bFirstChild)
+ XMLTransformerContext::StartElement(Reference< XAttributeList >());
+
+ XMLTransformerContext::EndElement();
+}
+
+//-----------------------------------------------------------------------------
+
+class XMLTabStopOASISTContext_Impl : public XMLPersElemContentTContext
+{
+public:
+ TYPEINFO();
+
+ XMLTabStopOASISTContext_Impl( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName );
+
+ virtual ~XMLTabStopOASISTContext_Impl();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+};
+
+TYPEINIT1( XMLTabStopOASISTContext_Impl, XMLPersElemContentTContext );
+
+XMLTabStopOASISTContext_Impl::XMLTabStopOASISTContext_Impl(
+ XMLTransformerBase& rImp,
+ const OUString& rQName ) :
+ XMLPersElemContentTContext( rImp, rQName )
+{
+}
+
+XMLTabStopOASISTContext_Impl::~XMLTabStopOASISTContext_Impl()
+{
+}
+
+void XMLTabStopOASISTContext_Impl::StartElement(
+ const Reference< XAttributeList >& rAttrList )
+{
+ XMLTransformerActions *pActions =
+ GetTransformer().GetUserDefinedActions( OASIS_TAB_STOP_ACTIONS );
+ OSL_ENSURE( pActions, "go no actions" );
+
+ sal_Unicode cStyleLeaderChar = 0;
+ sal_Int16 nLeaderText = -1;
+ Reference< XAttributeList > xAttrList( rAttrList );
+ XMLMutableAttributeList *pMutableAttrList = 0;
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ XMLTransformerActions::key_type aKey( nPrefix, aLocalName );
+ XMLTransformerActions::const_iterator aIter =
+ pActions->find( aKey );
+ if( !(aIter == pActions->end() ) )
+ {
+ if( !pMutableAttrList )
+ {
+ pMutableAttrList =
+ new XMLMutableAttributeList( xAttrList );
+ xAttrList = pMutableAttrList;
+ }
+ const OUString& rAttrValue = xAttrList->getValueByIndex( i );
+ switch( (*aIter).second.m_nActionType )
+ {
+ case XML_ATACTION_REMOVE:
+ if( IsXMLToken( aLocalName, XML_LEADER_STYLE ) )
+ {
+ if( IsXMLToken( rAttrValue, XML_NONE ) )
+ cStyleLeaderChar = ' ';
+ else if( IsXMLToken( rAttrValue, XML_DOTTED ) )
+ cStyleLeaderChar = '.';
+ else
+ cStyleLeaderChar = 0;
+ pMutableAttrList->RemoveAttributeByIndex( i );
+ --i;
+ --nAttrCount;
+ }
+ break;
+ case XML_ATACTION_RENAME:
+ {
+ OUString aNewAttrQName(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ (*aIter).second.GetQNamePrefixFromParam1(),
+ ::xmloff::token::GetXMLToken(
+ (*aIter).second.GetQNameTokenFromParam1()) ) );
+ pMutableAttrList->RenameAttributeByIndex( i,
+ aNewAttrQName );
+ }
+ if( IsXMLToken( aLocalName, XML_LEADER_TEXT ) )
+ {
+ if( rAttrValue.getLength() > 1 )
+ {
+ OUString aAttrValue( rAttrValue.copy( 0, 1 ) );
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ nLeaderText = i;
+ }
+ }
+ break;
+ case XML_ATACTION_IN2INCH:
+ {
+ OUString aAttrValue( rAttrValue );
+ if( XMLTransformerBase::ReplaceSingleInWithInch(
+ aAttrValue ) )
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ break;
+ default:
+ OSL_ENSURE( !this, "unknown action" );
+ break;
+ }
+ }
+ }
+
+ if( cStyleLeaderChar && ' ' != cStyleLeaderChar )
+ {
+ if( nLeaderText != -1 )
+ {
+ OUString aNewAttrQName(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_STYLE,
+ ::xmloff::token::GetXMLToken( XML_LEADER_CHAR ) ) );
+ pMutableAttrList->AddAttribute( aNewAttrQName,
+ OUString::valueOf( cStyleLeaderChar ) );
+ }
+ }
+ else
+ {
+ if( nLeaderText != -1 )
+ pMutableAttrList->RemoveAttributeByIndex( nLeaderText );
+ }
+
+ XMLPersElemContentTContext::StartElement( xAttrList );
+}
+
+// -----------------------------------------------------------------------------
+
+class XMLConfigItemTContext_Impl : public XMLTransformerContext
+{
+ ::rtl::OUString m_aContent;
+ sal_Bool m_bIsRedlineProtectionKey;
+ sal_Bool m_bIsCursorX;
+ sal_Bool m_bIsCursorY;
+
+public:
+
+ TYPEINFO();
+
+ XMLConfigItemTContext_Impl( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName );
+
+ virtual ~XMLConfigItemTContext_Impl();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+
+ virtual void Characters( const ::rtl::OUString& rChars );
+};
+
+TYPEINIT1( XMLConfigItemTContext_Impl, XMLTransformerContext );
+
+XMLConfigItemTContext_Impl::XMLConfigItemTContext_Impl(
+ XMLTransformerBase& rImp,
+ const OUString& rQName ) :
+ XMLTransformerContext( rImp, rQName ),
+ m_bIsRedlineProtectionKey( sal_False ),
+ m_bIsCursorX( sal_False ),
+ m_bIsCursorY( sal_False )
+{
+}
+
+XMLConfigItemTContext_Impl::~XMLConfigItemTContext_Impl()
+{
+}
+
+void XMLConfigItemTContext_Impl::StartElement(
+ const Reference< XAttributeList >& rAttrList )
+{
+ Reference< XAttributeList > xAttrList( rAttrList );
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ if( XML_NAMESPACE_CONFIG == nPrefix )
+ {
+ if ( IsXMLToken( aLocalName, XML_NAME ) )
+ {
+ const OUString& rValue = xAttrList->getValueByIndex( i );
+ const sal_Char sRedlineProtectionKey[] = "RedlineProtectionKey";
+ const sal_Char sCursorX[] = "CursorPositionX";
+ const sal_Char sCursorY[] = "CursorPositionY";
+ if( rValue.equalsAsciiL( sRedlineProtectionKey, sizeof(sRedlineProtectionKey)-1 ) )
+ m_bIsRedlineProtectionKey = sal_True;
+ else if( rValue.equalsAsciiL( sCursorX, sizeof(sCursorX)-1 ) )
+ m_bIsCursorX = sal_True;
+ else if( rValue.equalsAsciiL( sCursorY, sizeof(sCursorY)-1 ) )
+ m_bIsCursorY = sal_True;
+
+ break;
+ }
+ }
+ }
+
+ XMLTransformerContext::StartElement( xAttrList );
+}
+
+void XMLConfigItemTContext_Impl::Characters( const ::rtl::OUString& rChars )
+{
+ rtl::OUString sChars(rChars);
+ if (m_bIsRedlineProtectionKey)
+ m_aContent += rChars;
+ else if (m_bIsCursorX || m_bIsCursorY)
+ {
+ sal_Int32 nPos = rChars.toInt32();
+ if (m_bIsCursorX && nPos > 255)
+ nPos = 255;
+ else if (m_bIsCursorY && nPos > 31999)
+ nPos = 31999;
+
+ sChars = ::rtl::OUString::valueOf(nPos);
+ }
+
+ XMLTransformerContext::Characters( sChars );
+}
+
+void XMLConfigItemTContext_Impl::EndElement()
+{
+
+ if( m_bIsRedlineProtectionKey )
+ {
+ const Reference< XPropertySet > rPropSet =
+ GetTransformer().GetPropertySet();
+ if( rPropSet.is() )
+ {
+ const sal_Char sRedlineProtectionKey[] = "RedlineProtectionKey";
+ OUString aPropName(RTL_CONSTASCII_USTRINGPARAM(sRedlineProtectionKey));
+ Reference< XPropertySetInfo > xPropSetInfo(
+ rPropSet->getPropertySetInfo() );
+ if( xPropSetInfo.is() &&
+ xPropSetInfo->hasPropertyByName( aPropName ) )
+ {
+ Sequence < sal_Int8 > aKey;
+ SvXMLUnitConverter::decodeBase64( aKey, m_aContent );
+ rPropSet->setPropertyValue( aPropName, makeAny( aKey ) );
+ }
+ }
+ }
+ XMLTransformerContext::EndElement();
+}
+
+// -----------------------------------------------------------------------------
+
+class XMLTrackedChangesOASISTContext_Impl : public XMLTransformerContext
+{
+ ::rtl::OUString m_aAttrQName;
+
+public:
+
+ TYPEINFO();
+
+ XMLTrackedChangesOASISTContext_Impl( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName,
+ sal_uInt16 nPrefix,
+ XMLTokenEnum eToken );
+
+ virtual ~XMLTrackedChangesOASISTContext_Impl();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+};
+
+TYPEINIT1( XMLTrackedChangesOASISTContext_Impl, XMLTransformerContext );
+
+XMLTrackedChangesOASISTContext_Impl::XMLTrackedChangesOASISTContext_Impl(
+ XMLTransformerBase& rImp,
+ const OUString& rQName,
+ sal_uInt16 nPrefix,
+ XMLTokenEnum eToken ) :
+ XMLTransformerContext( rImp, rQName ),
+ m_aAttrQName( rImp.GetNamespaceMap().GetQNameByKey( nPrefix,
+ GetXMLToken(eToken)) )
+{
+}
+
+XMLTrackedChangesOASISTContext_Impl::~XMLTrackedChangesOASISTContext_Impl()
+{
+}
+
+void XMLTrackedChangesOASISTContext_Impl::StartElement(
+ const Reference< XAttributeList >& rAttrList )
+{
+ Reference< XAttributeList > xAttrList( rAttrList );
+ const Reference< XPropertySet > rPropSet =
+ GetTransformer().GetPropertySet();
+ if( rPropSet.is() )
+ {
+ const sal_Char sRedlineProtectionKey[] = "RedlineProtectionKey";
+ OUString aPropName(RTL_CONSTASCII_USTRINGPARAM(sRedlineProtectionKey));
+ Reference< XPropertySetInfo > xPropSetInfo(
+ rPropSet->getPropertySetInfo() );
+ if( xPropSetInfo.is() &&
+ xPropSetInfo->hasPropertyByName( aPropName ) )
+ {
+ Any aAny = rPropSet->getPropertyValue( aPropName);
+ Sequence < sal_Int8 > aKey;
+ aAny >>= aKey;
+ if( aKey.getLength() )
+ {
+ OUStringBuffer aBuffer;
+ SvXMLUnitConverter::encodeBase64( aBuffer, aKey );
+ XMLMutableAttributeList *pMutableAttrList =
+ new XMLMutableAttributeList( xAttrList );
+ xAttrList = pMutableAttrList;
+ pMutableAttrList->AddAttribute( m_aAttrQName,
+ aBuffer.makeStringAndClear() );
+ }
+ }
+ }
+ XMLTransformerContext::StartElement( xAttrList );
+}
+
+// -----------------------------------------------------------------------------
+
+XMLTransformerContext *Oasis2OOoTransformer::CreateUserDefinedContext(
+ const TransformerAction_Impl& rAction,
+ const OUString& rQName,
+ sal_Bool bPersistent )
+{
+ switch( rAction.m_nActionType )
+ {
+ case XML_ETACTION_META:
+ return new XMLMetaTransformerContext( *this, rQName );
+ case XML_ETACTION_DOCUMENT:
+ return new XMLDocumentTransformerContext( *this, rQName );
+ case XML_ETACTION_BODY:
+ return new XMLBodyOASISTransformerContext_Impl( *this, rQName );
+ case XML_ETACTION_NOTES:
+ return new XMLNotesTransformerContext( *this, rQName,
+ static_cast< XMLTokenEnum>( rAction.m_nParam1 ), bPersistent );
+ case XML_ETACTION_TABLE:
+ return new XMLTableTransformerContext_Impl( *this, rQName );
+ case XML_ETACTION_STYLE:
+ return new XMLStyleOASISTContext( *this, rQName, bPersistent );
+ case XML_ETACTION_STYLE_RENAME:
+ return new XMLStyleOASISTContext( *this, rQName,
+ rAction.GetQNamePrefixFromParam1(),
+ rAction.GetQNameTokenFromParam1(), bPersistent );
+ case XML_ETACTION_FRAME:
+ return new XMLFrameOASISTransformerContext( *this, rQName );
+ case XML_ETACTION_EVENT:
+ return new XMLEventOASISTransformerContext( *this, rQName );
+ case XML_ETACTION_DLG:
+ return new XMLDlgOASISTransformerContext( *this, rQName );
+ case XML_ETACTION_TAB_STOP:
+ return new XMLTabStopOASISTContext_Impl( *this, rQName );
+ case XML_ETACTION_FORM_CONTROL:
+ {
+ const XMLTransformerContext *pCurrent = GetCurrentContext();
+ return new XMLControlOASISTransformerContext( *this, rQName,
+ pCurrent ? pCurrent->HasQName( XML_NAMESPACE_FORM,
+ XML_FORM ) : sal_False );
+ }
+ case XML_ETACTION_FORM_PROPERTY:
+ return new XMLFormPropOASISTransformerContext( *this, rQName,
+ static_cast< XMLTokenEnum >( rAction.m_nParam1 ) );
+ case XML_ETACTION_CHART:
+ return new XMLChartOASISTransformerContext( *this, rQName );
+ case XML_ETACTION_CONFIG_ITEM:
+ return new XMLConfigItemTContext_Impl( *this, rQName );
+ case XML_ETACTION_TRACKED_CHANGES:
+ return new XMLTrackedChangesOASISTContext_Impl( *this, rQName,
+ rAction.GetQNamePrefixFromParam1(),
+ rAction.GetQNameTokenFromParam1() );
+ case XML_ETACTION_CHART_PLOT_AREA:
+ return new XMLChartPlotAreaOASISTContext( *this, rQName );
+ default:
+ OSL_ENSURE( !this, "no user defined context found!" );
+ break;
+ }
+
+ // default is copying
+ return new XMLTransformerContext( *this, rQName );
+}
+
+XMLTransformerActions *Oasis2OOoTransformer::GetUserDefinedActions(
+ sal_uInt16 n )
+{
+ XMLTransformerActions *pActions = 0;
+ if( n < MAX_OASIS_ACTIONS )
+ {
+ if( !m_aActions[n] )
+ {
+ if( n<MAX_OASIS_PROP_ACTIONS )
+ {
+ m_aActions[n] =
+ XMLStyleOASISTContext::CreateTransformerActions( n );
+ }
+ else switch( n )
+ {
+ case OASIS_STYLE_ACTIONS:
+ m_aActions[OASIS_STYLE_ACTIONS] =
+ new XMLTransformerActions( aStyleActionTable );
+ break;
+ case OASIS_FONT_FACE_ACTIONS:
+ m_aActions[OASIS_FONT_FACE_ACTIONS] =
+ new XMLTransformerActions( aFontFaceActionTable );
+ break;
+ case OASIS_SHAPE_ACTIONS:
+ m_aActions[OASIS_SHAPE_ACTIONS] =
+ new XMLTransformerActions( aShapeActionTable );
+ break;
+ case OASIS_CONNECTOR_ACTIONS:
+ m_aActions[OASIS_CONNECTOR_ACTIONS] =
+ new XMLTransformerActions( aConnectorActionTable );
+ break;
+ case OASIS_INDEX_ENTRY_TAB_STOP_ACTIONS:
+ m_aActions[OASIS_INDEX_ENTRY_TAB_STOP_ACTIONS] =
+ new XMLTransformerActions( aIndexEntryTabStopActionTable );
+ break;
+ case OASIS_TAB_STOP_ACTIONS:
+ m_aActions[OASIS_TAB_STOP_ACTIONS] =
+ new XMLTransformerActions( aTabStopActionTable );
+ break;
+ case OASIS_LINENUMBERING_ACTIONS:
+ m_aActions[OASIS_LINENUMBERING_ACTIONS] =
+ new XMLTransformerActions( aLineNumberingActionTable );
+ break;
+ case OASIS_FOOTNOTE_SEP_ACTIONS:
+ m_aActions[OASIS_FOOTNOTE_SEP_ACTIONS] =
+ new XMLTransformerActions( aFootnoteSepActionTable );
+ break;
+ case OASIS_DROP_CAP_ACTIONS:
+ m_aActions[OASIS_DROP_CAP_ACTIONS] =
+ new XMLTransformerActions( aDropCapActionTable );
+ break;
+ case OASIS_COLUMNS_ACTIONS:
+ m_aActions[OASIS_COLUMNS_ACTIONS] =
+ new XMLTransformerActions( aColumnsActionTable );
+ break;
+ case OASIS_TEXT_VALUE_TYPE_ACTIONS:
+ m_aActions[OASIS_TEXT_VALUE_TYPE_ACTIONS] =
+ new XMLTransformerActions( aTextValueTypeActionTable );
+ break;
+ case OASIS_TABLE_VALUE_TYPE_ACTIONS:
+ m_aActions[OASIS_TABLE_VALUE_TYPE_ACTIONS] =
+ new XMLTransformerActions( aTableValueTypeActionTable );
+ break;
+ case OASIS_PARA_ACTIONS:
+ m_aActions[OASIS_PARA_ACTIONS] =
+ new XMLTransformerActions( aParaActionTable );
+ break;
+ case OASIS_LIST_STYLE_REF_ACTIONS:
+ m_aActions[OASIS_LIST_STYLE_REF_ACTIONS] =
+ new XMLTransformerActions( aListStyleRefActionTable );
+ break;
+ case OASIS_TEXT_STYLE_REF_ACTIONS:
+ m_aActions[OASIS_TEXT_STYLE_REF_ACTIONS] =
+ new XMLTransformerActions( aTextStyleRefActionTable );
+ break;
+ case OASIS_PARA_STYLE_REF_ACTIONS:
+ m_aActions[OASIS_PARA_STYLE_REF_ACTIONS] =
+ new XMLTransformerActions( aParaStyleRefActionTable );
+ break;
+ case OASIS_MASTER_PAGE_REF_ACTIONS:
+ m_aActions[OASIS_MASTER_PAGE_REF_ACTIONS] =
+ new XMLTransformerActions( aMasterPageRefActionTable );
+ break;
+ case OASIS_MAP_STYLE_REF_ACTIONS:
+ m_aActions[OASIS_MAP_STYLE_REF_ACTIONS] =
+ new XMLTransformerActions( aMapStyleRefActionTable );
+ break;
+ case OASIS_MASTER_PAGE_ACTIONS:
+ m_aActions[OASIS_MASTER_PAGE_ACTIONS] =
+ new XMLTransformerActions( aMasterPageActionTable );
+ break;
+ case OASIS_NOTES_ACTIONS:
+ m_aActions[OASIS_NOTES_ACTIONS] =
+ new XMLTransformerActions( aNotesActionTable );
+ break;
+ case OASIS_ANNOTATION_ACTIONS:
+ m_aActions[OASIS_ANNOTATION_ACTIONS] =
+ new XMLTransformerActions( aAnnotationActionTable );
+ break;
+ case OASIS_CHANGE_INFO_ACTIONS:
+ m_aActions[OASIS_CHANGE_INFO_ACTIONS] =
+ new XMLTransformerActions( aChangeInfoActionTable );
+ break;
+ case OASIS_FRAME_ELEM_ACTIONS:
+ m_aActions[OASIS_FRAME_ELEM_ACTIONS] =
+ new XMLTransformerActions( aFrameActionTable );
+ break;
+ case OASIS_BACKGROUND_IMAGE_ACTIONS:
+ m_aActions[OASIS_BACKGROUND_IMAGE_ACTIONS] =
+ new XMLTransformerActions( aBackgroundImageActionTable );
+ break;
+ case OASIS_DDE_CONNECTION_DECL_ACTIONS:
+ m_aActions[OASIS_DDE_CONNECTION_DECL_ACTIONS] =
+ new XMLTransformerActions( aDDEConnectionDeclActionTable );
+ break;
+ case OASIS_EVENT_ACTIONS:
+ m_aActions[OASIS_EVENT_ACTIONS] =
+ new XMLTransformerActions( aEventActionTable );
+ break;
+ case OASIS_DLG_ACTIONS:
+ m_aActions[OASIS_DLG_ACTIONS] =
+ new XMLTransformerActions( aDlgActionTable );
+ break;
+ case OASIS_FORM_CONTROL_ACTIONS:
+ m_aActions[OASIS_FORM_CONTROL_ACTIONS] =
+ new XMLTransformerActions( aFormControlActionTable );
+ break;
+ case OASIS_FORM_COLUMN_ACTIONS:
+ m_aActions[OASIS_FORM_COLUMN_ACTIONS] =
+ new XMLTransformerActions( aFormColumnActionTable );
+ break;
+ case OASIS_FORM_PROP_ACTIONS:
+ m_aActions[OASIS_FORM_PROP_ACTIONS] =
+ new XMLTransformerActions( aFormPropActionTable );
+ break;
+ case OASIS_XLINK_ACTIONS:
+ m_aActions[OASIS_XLINK_ACTIONS] =
+ new XMLTransformerActions( aXLinkActionTable );
+ break;
+ case OASIS_CONFIG_ITEM_SET_ACTIONS:
+ m_aActions[OASIS_CONFIG_ITEM_SET_ACTIONS] =
+ new XMLTransformerActions( aConfigItemSetActionTable );
+ break;
+ case OASIS_FORMULA_ACTIONS:
+ m_aActions[OASIS_FORMULA_ACTIONS] =
+ new XMLTransformerActions( aFormulaActionTable );
+ break;
+ case OASIS_CHART_ACTIONS:
+ m_aActions[OASIS_CHART_ACTIONS] =
+ new XMLTransformerActions( aChartActionTable );
+ break;
+ case OASIS_FORM_ACTIONS:
+ m_aActions[OASIS_FORM_ACTIONS] =
+ new XMLTransformerActions( aFormActionTable );
+ break;
+ case OASIS_ALPHABETICAL_INDEX_MARK_ACTIONS:
+ m_aActions[OASIS_ALPHABETICAL_INDEX_MARK_ACTIONS] =
+ new XMLTransformerActions(
+ aAlphabeticalIndexMarkActionTable );
+ break;
+ case OASIS_CONTENT_VALIDATION_ACTIONS:
+ m_aActions[OASIS_CONTENT_VALIDATION_ACTIONS] =
+ new XMLTransformerActions( aContentValidationActionTable );
+ case OASIS_DDE_CONV_MODE_ACTIONS:
+ m_aActions[OASIS_DDE_CONV_MODE_ACTIONS] =
+ new XMLTransformerActions( aDDEConvModeActionTable );
+ break;
+ case OASIS_DATAPILOT_MEMBER_ACTIONS:
+ m_aActions[OASIS_DATAPILOT_MEMBER_ACTIONS] =
+ new XMLTransformerActions( aDataPilotMemberActionTable );
+ break;
+ case OASIS_DATAPILOT_LEVEL_ACTIONS:
+ m_aActions[OASIS_DATAPILOT_LEVEL_ACTIONS] =
+ new XMLTransformerActions( aDataPilotLevelActionTable );
+ break;
+ case OASIS_SOURCE_SERVICE_ACTIONS:
+ m_aActions[OASIS_SOURCE_SERVICE_ACTIONS] =
+ new XMLTransformerActions( aSourceServiceActionTable );
+ break;
+ case OASIS_DRAW_AREA_POLYGON_ACTIONS:
+ m_aActions[OASIS_DRAW_AREA_POLYGON_ACTIONS] =
+ new XMLTransformerActions( aShapeActionTable );
+ m_aActions[OASIS_DRAW_AREA_POLYGON_ACTIONS]
+ ->Add( aDrawAreaPolygonActionTable );
+ break;
+ case OASIS_SCRIPT_ACTIONS:
+ m_aActions[OASIS_SCRIPT_ACTIONS] =
+ new XMLTransformerActions( aScriptActionTable );
+ break;
+ case OASIS_DATETIME_ACTIONS:
+ m_aActions[OASIS_DATETIME_ACTIONS] =
+ new XMLTransformerActions( aDateTimeActionTable );
+ break;
+ // Bugdoc with table won't load correctly (#i40011#, #i40015#)
+ case OASIS_TABLE_STYLE_REF_ACTIONS:
+ m_aActions[OASIS_TABLE_STYLE_REF_ACTIONS] =
+ new XMLTransformerActions( aTableStyleRefActionTable );
+ break;
+ case OASIS_ANIMATION_ACTIONS:
+ m_aActions[OASIS_ANIMATION_ACTIONS] =
+ new XMLTransformerActions( aAnimationActionTable );
+ break;
+ }
+ }
+ pActions = m_aActions[n];
+ }
+
+ return pActions;
+}
+
+OUString Oasis2OOoTransformer::GetEventName( const OUString& rName,
+ sal_Bool bForm )
+{
+ if( bForm && !m_pFormEventMap )
+ m_pFormEventMap =
+ XMLEventOASISTransformerContext::CreateFormEventMap();
+ if( !m_pEventMap )
+ m_pEventMap = XMLEventOASISTransformerContext::CreateEventMap();
+
+ OUString aMacroName;
+ sal_uInt16 nPrefix =
+ GetNamespaceMap().GetKeyByAttrName( rName, &aMacroName );
+ return XMLEventOASISTransformerContext::GetEventName(
+ nPrefix, aMacroName, *m_pEventMap,
+ bForm ? m_pFormEventMap : 0 );
+}
+
+Oasis2OOoTransformer::Oasis2OOoTransformer() throw() :
+ XMLTransformerBase( aActionTable, aTokenMap ),
+ m_pEventMap( 0 ),
+ m_pFormEventMap( 0 )
+{
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_OFFICE), GetXMLToken(XML_N_OFFICE), XML_NAMESPACE_OFFICE );
+ GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_OFFICE), GetXMLToken(XML_N_OFFICE_OOO), XML_NAMESPACE_OFFICE );
+
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_META), GetXMLToken(XML_N_META), XML_NAMESPACE_META );
+ GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_META), GetXMLToken(XML_N_META_OOO), XML_NAMESPACE_META );
+
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_STYLE), GetXMLToken(XML_N_STYLE), XML_NAMESPACE_STYLE );
+ GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_STYLE), GetXMLToken(XML_N_STYLE_OOO), XML_NAMESPACE_STYLE );
+
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_NUMBER), GetXMLToken(XML_N_NUMBER), XML_NAMESPACE_NUMBER );
+ GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_NUMBER), GetXMLToken(XML_N_NUMBER_OOO), XML_NAMESPACE_NUMBER );
+
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_CONFIG), GetXMLToken(XML_N_CONFIG), XML_NAMESPACE_CONFIG );
+ GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_CONFIG), GetXMLToken(XML_N_CONFIG_OOO), XML_NAMESPACE_CONFIG );
+
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_TEXT), GetXMLToken(XML_N_TEXT), XML_NAMESPACE_TEXT );
+ GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_TEXT), GetXMLToken(XML_N_TEXT_OOO), XML_NAMESPACE_TEXT );
+
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_TABLE), GetXMLToken(XML_N_TABLE), XML_NAMESPACE_TABLE );
+ GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_TABLE), GetXMLToken(XML_N_TABLE_OOO), XML_NAMESPACE_TABLE );
+
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_DRAW), GetXMLToken(XML_N_DRAW), XML_NAMESPACE_DRAW );
+ GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_DRAW), GetXMLToken(XML_N_DRAW_OOO), XML_NAMESPACE_DRAW );
+
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_DR3D), GetXMLToken(XML_N_DR3D), XML_NAMESPACE_DR3D );
+ GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_DR3D), GetXMLToken(XML_N_DR3D_OOO), XML_NAMESPACE_DR3D );
+
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_PRESENTATION), GetXMLToken(XML_N_PRESENTATION), XML_NAMESPACE_PRESENTATION );
+ GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_PRESENTATION), GetXMLToken(XML_N_PRESENTATION_OOO), XML_NAMESPACE_PRESENTATION );
+
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_CHART), GetXMLToken(XML_N_CHART), XML_NAMESPACE_CHART );
+ GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_CHART), GetXMLToken(XML_N_CHART_OOO), XML_NAMESPACE_CHART );
+
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_FORM), GetXMLToken(XML_N_FORM), XML_NAMESPACE_FORM );
+ GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_FORM), GetXMLToken(XML_N_FORM_OOO), XML_NAMESPACE_FORM );
+
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_SCRIPT), GetXMLToken(XML_N_SCRIPT), XML_NAMESPACE_SCRIPT );
+ GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_SCRIPT), GetXMLToken(XML_N_SCRIPT_OOO), XML_NAMESPACE_SCRIPT );
+
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_DLG), GetXMLToken(XML_N_DLG), XML_NAMESPACE_DLG );
+ GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_DLG), GetXMLToken(XML_N_DLG), XML_NAMESPACE_DLG );
+
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_FO), GetXMLToken(XML_N_FO_COMPAT), XML_NAMESPACE_FO );
+ GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_FO), GetXMLToken(XML_N_FO), XML_NAMESPACE_FO );
+
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_SVG), GetXMLToken(XML_N_SVG_COMPAT), XML_NAMESPACE_SVG );
+ GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_SVG), GetXMLToken(XML_N_SVG), XML_NAMESPACE_SVG );
+
+
+ for( sal_uInt16 i=0; i<MAX_OASIS_ACTIONS; ++i )
+ m_aActions[i] = 0;
+}
+
+Oasis2OOoTransformer::~Oasis2OOoTransformer() throw()
+{
+ for( sal_uInt16 i=0; i<MAX_OASIS_ACTIONS; ++i )
+ delete m_aActions[i];
+ XMLEventOASISTransformerContext::FlushEventMap( m_pEventMap );
+ XMLEventOASISTransformerContext::FlushEventMap( m_pFormEventMap );
+}
+
+::com::sun::star::uno::Sequence< sal_Int8 > static CreateUnoTunnelId()
+{
+ static osl::Mutex aCreateMutex;
+ Guard<osl::Mutex> aGuard( aCreateMutex );
+ Sequence< sal_Int8 > aSeq( 16 );
+ rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
+ return aSeq;
+}
+
+const Sequence< sal_Int8 > & Oasis2OOoTransformer::getUnoTunnelId() throw()
+{
+ static Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
+ return aSeq;
+}
+
+// XUnoTunnel
+sal_Int64 SAL_CALL Oasis2OOoTransformer::getSomething( const Sequence< sal_Int8 >& rId )
+ throw(RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return reinterpret_cast< sal_Int64 >( this );
+ }
+ else
+ {
+ return (sal_Int64)0;
+ }
+}
+
+// XServiceInfo
+OUString SAL_CALL Oasis2OOoTransformer::getImplementationName()
+ throw(RuntimeException)
+{
+ return Oasis2OOoTransformer_getImplementationName();
+}
+
+sal_Bool SAL_CALL Oasis2OOoTransformer::supportsService( const OUString& )
+ throw(RuntimeException)
+{
+ return sal_False;
+}
+
+Sequence< OUString > SAL_CALL Oasis2OOoTransformer::getSupportedServiceNames( )
+ throw(RuntimeException)
+{
+ Sequence<OUString> aSeq(0);
+ return aSeq;
+}
+
+// Service registration
+
+OUString SAL_CALL Oasis2OOoTransformer_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.comp.Oasis2OOoTransformer" ) );
+}
+
+Sequence< OUString > SAL_CALL Oasis2OOoTransformer_getSupportedServiceNames()
+ throw()
+{
+ const OUString aServiceName( Oasis2OOoTransformer_getImplementationName() );
+ const Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+Reference< XInterface > SAL_CALL Oasis2OOoTransformer_createInstance(
+ const Reference< XMultiServiceFactory > &)
+ throw( Exception )
+{
+ OSL_TRACE("Creating Oasis2OOoTransformer");
+ return (cppu::OWeakObject*)new Oasis2OOoTransformer;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/Oasis2OOo.hxx b/xmloff/source/transform/Oasis2OOo.hxx
new file mode 100644
index 000000000000..6cc9f3f311e2
--- /dev/null
+++ b/xmloff/source/transform/Oasis2OOo.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_OASIS2OOO_HXX
+#define _XMLOFF_OASIS2OOO_HXX
+
+#include "ActionMapTypesOASIS.hxx"
+#include "TransformerBase.hxx"
+
+class XMLTransformerOASISEventMap_Impl;
+
+class Oasis2OOoTransformer : public XMLTransformerBase
+{
+ XMLTransformerActions *m_aActions[MAX_OASIS_ACTIONS];
+ XMLTransformerOASISEventMap_Impl *m_pEventMap;
+ XMLTransformerOASISEventMap_Impl *m_pFormEventMap;
+
+protected:
+
+ virtual XMLTransformerContext *CreateUserDefinedContext(
+ const TransformerAction_Impl& rAction,
+ const ::rtl::OUString& rQName,
+ sal_Bool bPersistent=sal_False );
+
+ virtual XMLTransformerActions *GetUserDefinedActions( sal_uInt16 n );
+
+public:
+ Oasis2OOoTransformer () throw();
+ virtual ~Oasis2OOoTransformer() throw();
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ virtual ::rtl::OUString GetEventName( const ::rtl::OUString& rName,
+ sal_Bool bForm );
+};
+
+#endif // _XMLOFF_OASIS2OOO_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/PersAttrListTContext.cxx b/xmloff/source/transform/PersAttrListTContext.cxx
new file mode 100644
index 000000000000..8dc05110817d
--- /dev/null
+++ b/xmloff/source/transform/PersAttrListTContext.cxx
@@ -0,0 +1,197 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/util/XCloneable.hpp>
+#include "IgnoreTContext.hxx"
+#include "TransformerBase.hxx"
+#include "MutableAttrList.hxx"
+#include <xmloff/nmspmap.hxx>
+#include "PersAttrListTContext.hxx"
+
+using ::rtl::OUString;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::xml::sax;
+
+TYPEINIT1( XMLPersAttrListTContext, XMLTransformerContext );
+
+void XMLPersAttrListTContext::AddAttribute(
+ sal_uInt16 nAPrefix,
+ ::xmloff::token::XMLTokenEnum eAToken,
+ ::xmloff::token::XMLTokenEnum eVToken )
+{
+ OUString aAttrValue( ::xmloff::token::GetXMLToken( eVToken ) );
+ AddAttribute( nAPrefix, eAToken, aAttrValue );
+}
+
+void XMLPersAttrListTContext::AddAttribute(
+ sal_uInt16 nAPrefix,
+ ::xmloff::token::XMLTokenEnum eAToken,
+ const ::rtl::OUString & rValue )
+{
+ OUString aAttrQName( GetTransformer().GetNamespaceMap().GetQNameByKey(
+ nAPrefix, ::xmloff::token::GetXMLToken( eAToken ) ) );
+ OUString aAttrValue( rValue );
+
+ XMLMutableAttributeList *pMutableAttrList;
+ if( m_xAttrList.is() )
+ {
+ pMutableAttrList =
+ static_cast< XMLMutableAttributeList * >( m_xAttrList.get() );
+ }
+ else
+ {
+ pMutableAttrList = new XMLMutableAttributeList ;
+ m_xAttrList = pMutableAttrList;
+ }
+
+ pMutableAttrList->AddAttribute( aAttrQName, aAttrValue );
+}
+
+XMLPersAttrListTContext::XMLPersAttrListTContext(
+ XMLTransformerBase& rImp,
+ const OUString& rQName ) :
+ XMLTransformerContext( rImp, rQName ),
+ m_aElemQName( rQName ),
+ m_nActionMap( INVALID_ACTIONS )
+{
+}
+
+XMLPersAttrListTContext::XMLPersAttrListTContext(
+ XMLTransformerBase& rImp,
+ const OUString& rQName,
+ sal_uInt16 nActionMap ) :
+ XMLTransformerContext( rImp, rQName ),
+ m_aElemQName( rQName ),
+ m_nActionMap( nActionMap )
+{
+}
+
+XMLPersAttrListTContext::XMLPersAttrListTContext(
+ XMLTransformerBase& rImp,
+ const OUString& rQName,
+ sal_uInt16 nPrefix,
+ ::xmloff::token::XMLTokenEnum eToken ) :
+ XMLTransformerContext( rImp, rQName ),
+ m_aElemQName( rImp.GetNamespaceMap().GetQNameByKey( nPrefix,
+ ::xmloff::token::GetXMLToken( eToken ) ) ),
+ m_nActionMap( INVALID_ACTIONS )
+{
+}
+
+XMLPersAttrListTContext::XMLPersAttrListTContext(
+ XMLTransformerBase& rImp,
+ const OUString& rQName,
+ sal_uInt16 nPrefix,
+ ::xmloff::token::XMLTokenEnum eToken,
+ sal_uInt16 nActionMap ) :
+ XMLTransformerContext( rImp, rQName ),
+ m_aElemQName( rImp.GetNamespaceMap().GetQNameByKey( nPrefix,
+ ::xmloff::token::GetXMLToken( eToken ) ) ),
+ m_nActionMap( nActionMap )
+{
+}
+
+XMLPersAttrListTContext::~XMLPersAttrListTContext()
+{
+}
+
+XMLTransformerContext *XMLPersAttrListTContext::CreateChildContext(
+ sal_uInt16 /*nPrefix*/,
+ const OUString& /*rLocalName*/,
+ const OUString& rQName,
+ const Reference< XAttributeList >& )
+{
+ // ignore all child elements
+ return new XMLIgnoreTransformerContext( GetTransformer(),
+ rQName, sal_True, sal_True );
+}
+
+void XMLPersAttrListTContext::StartElement(
+ const Reference< XAttributeList >& rAttrList )
+{
+ XMLMutableAttributeList *pMutableAttrList = 0;
+
+ Reference< XAttributeList > xAttrList( rAttrList );
+ if( m_nActionMap != INVALID_ACTIONS )
+ {
+ pMutableAttrList =
+ GetTransformer().ProcessAttrList( xAttrList, m_nActionMap,
+ sal_True );
+ }
+
+ if( m_xAttrList.is() )
+ {
+ static_cast< XMLMutableAttributeList * >( m_xAttrList.get() )
+ ->AppendAttributeList( xAttrList );
+ }
+ else if( pMutableAttrList )
+ {
+ m_xAttrList = xAttrList;
+ }
+ else
+ {
+ m_xAttrList = new XMLMutableAttributeList( rAttrList, sal_True );
+ }
+}
+
+void XMLPersAttrListTContext::EndElement()
+{
+ // ignore for now
+}
+
+void XMLPersAttrListTContext::Characters( const OUString& )
+{
+}
+
+sal_Bool XMLPersAttrListTContext::IsPersistent() const
+{
+ return sal_True;
+}
+
+void XMLPersAttrListTContext::Export()
+{
+ GetTransformer().GetDocHandler()->startElement( m_aElemQName, m_xAttrList );
+ ExportContent();
+ GetTransformer().GetDocHandler()->endElement( m_aElemQName );
+}
+
+void XMLPersAttrListTContext::ExportContent()
+{
+ // nothing to export
+}
+
+Reference< XAttributeList > XMLPersAttrListTContext::GetAttrList() const
+{
+ return m_xAttrList;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/PersAttrListTContext.hxx b/xmloff/source/transform/PersAttrListTContext.hxx
new file mode 100644
index 000000000000..54aca4b14819
--- /dev/null
+++ b/xmloff/source/transform/PersAttrListTContext.hxx
@@ -0,0 +1,124 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PERSATTRLISTTCONTEXT_HXX
+#define _XMLOFF_PERSATTRLISTTCONTEXT_HXX
+
+#include <xmloff/xmltoken.hxx>
+#include "TransformerContext.hxx"
+
+
+class XMLPersAttrListTContext : public XMLTransformerContext
+{
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > m_xAttrList;
+ ::rtl::OUString m_aElemQName;
+ sal_uInt16 m_nActionMap;
+
+protected:
+
+ void SetExportQName( const ::rtl::OUString& r ) { m_aElemQName = r; }
+
+public:
+ TYPEINFO();
+
+ // A contexts constructor does anything that is required if an element
+ // starts. Namespace processing has been done already.
+ // Note that virtual methods cannot be used inside constructors. Use
+ // StartElement instead if this is required.
+ XMLPersAttrListTContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName );
+
+ // attr list persistence + attribute processing
+ XMLPersAttrListTContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName,
+ sal_uInt16 nActionMap );
+
+ // attr list persistence + renaming
+ XMLPersAttrListTContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName,
+ sal_uInt16 nPrefix,
+ ::xmloff::token::XMLTokenEnum eToken );
+
+ // attr list persistence + renaming + attribute processing
+ XMLPersAttrListTContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName,
+ sal_uInt16 nPrefix,
+ ::xmloff::token::XMLTokenEnum eToken,
+ sal_uInt16 nActionMap );
+
+ // A contexts destructor does anything that is required if an element
+ // ends. By default, nothing is done.
+ // Note that virtual methods cannot be used inside destructors. Use
+ // EndElement instead if this is required.
+ virtual ~XMLPersAttrListTContext();
+
+ // Create a childs element context. By default, the import's
+ // CreateContext method is called to create a new default context.
+ virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::rtl::OUString& rQName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ // StartElement is called after a context has been constructed and
+ // before a elements context is parsed. It may be used for actions that
+ // require virtual methods. The default is to do nothing.
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ // EndElement is called before a context will be destructed, but
+ // after a elements context has been parsed. It may be used for actions
+ // that require virtual methods. The default is to do nothing.
+ virtual void EndElement();
+
+ // This method is called for all characters that are contained in the
+ // current element.
+ virtual void Characters( const ::rtl::OUString& rChars );
+
+ virtual sal_Bool IsPersistent() const;
+ virtual void Export();
+ virtual void ExportContent();
+
+ const ::rtl::OUString& GetExportQName() const { return m_aElemQName; }
+
+ void AddAttribute( sal_uInt16 nAPrefix,
+ ::xmloff::token::XMLTokenEnum eAToken,
+ ::xmloff::token::XMLTokenEnum eVToken );
+
+ void AddAttribute( sal_uInt16 nAPrefix,
+ ::xmloff::token::XMLTokenEnum eAToken,
+ const ::rtl::OUString & rValue );
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList >
+ GetAttrList() const;
+};
+
+#endif // _XMLOFF_PERSATTRLISTTCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/PersMixedContentTContext.cxx b/xmloff/source/transform/PersMixedContentTContext.cxx
new file mode 100644
index 000000000000..a266c5ac3235
--- /dev/null
+++ b/xmloff/source/transform/PersMixedContentTContext.cxx
@@ -0,0 +1,161 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "TransformerBase.hxx"
+#include "PersMixedContentTContext.hxx"
+
+using ::rtl::OUString;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+
+//------------------------------------------------------------------------------
+class XMLPersTextTContext_Impl : public XMLTransformerContext
+{
+ ::rtl::OUString m_aCharacters;
+
+public:
+ TYPEINFO();
+
+ XMLPersTextTContext_Impl( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rChars );
+ virtual ~XMLPersTextTContext_Impl();
+
+ virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::rtl::OUString& rQName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+ virtual void Characters( const ::rtl::OUString& rChars );
+
+ virtual sal_Bool IsPersistent() const;
+ virtual void Export();
+ const ::rtl::OUString& GetText() const { return m_aCharacters; }
+};
+
+TYPEINIT1( XMLPersTextTContext_Impl, XMLTransformerContext );
+
+XMLPersTextTContext_Impl::XMLPersTextTContext_Impl(
+ XMLTransformerBase& rImp,
+ const OUString& rChars ) :
+ XMLTransformerContext( rImp, OUString() ),
+ m_aCharacters( rChars )
+{
+}
+
+XMLPersTextTContext_Impl::~XMLPersTextTContext_Impl()
+{
+}
+
+XMLTransformerContext *XMLPersTextTContext_Impl::CreateChildContext(
+ sal_uInt16,
+ const OUString&,
+ const OUString&,
+ const Reference< XAttributeList >& )
+{
+ OSL_ENSURE( !this, "illegal call to CreateChildContext" );
+ return 0;
+}
+
+void XMLPersTextTContext_Impl::StartElement(
+ const Reference< XAttributeList >& )
+{
+ OSL_ENSURE( !this, "illegal call to StartElement" );
+}
+
+void XMLPersTextTContext_Impl::EndElement()
+{
+ OSL_ENSURE( !this, "illegal call to EndElement" );
+}
+
+sal_Bool XMLPersTextTContext_Impl::IsPersistent() const
+{
+ return sal_True;
+}
+
+void XMLPersTextTContext_Impl::Characters( const OUString& rChars )
+{
+ m_aCharacters += rChars;
+}
+
+void XMLPersTextTContext_Impl::Export()
+{
+ GetTransformer().GetDocHandler()->characters( m_aCharacters );
+}
+
+//------------------------------------------------------------------------------
+
+TYPEINIT1( XMLPersMixedContentTContext, XMLPersElemContentTContext );
+
+XMLPersMixedContentTContext::XMLPersMixedContentTContext(
+ XMLTransformerBase& rImp,
+ const OUString& rQName ) :
+ XMLPersElemContentTContext( rImp, rQName )
+{
+}
+
+XMLPersMixedContentTContext::XMLPersMixedContentTContext(
+ XMLTransformerBase& rImp,
+ const OUString& rQName,
+ sal_uInt16 nActionMap ) :
+ XMLPersElemContentTContext( rImp, rQName, nActionMap )
+{
+}
+
+XMLPersMixedContentTContext::XMLPersMixedContentTContext(
+ XMLTransformerBase& rImp,
+ const OUString& rQName,
+ sal_uInt16 nPrefix,
+ ::xmloff::token::XMLTokenEnum eToken ) :
+ XMLPersElemContentTContext( rImp, rQName, nPrefix, eToken )
+{
+}
+
+XMLPersMixedContentTContext::XMLPersMixedContentTContext(
+ XMLTransformerBase& rImp,
+ const OUString& rQName,
+ sal_uInt16 nPrefix,
+ ::xmloff::token::XMLTokenEnum eToken,
+ sal_uInt16 nActionMap ) :
+ XMLPersElemContentTContext( rImp, rQName, nPrefix, eToken, nActionMap )
+{
+}
+
+XMLPersMixedContentTContext::~XMLPersMixedContentTContext()
+{
+}
+
+void XMLPersMixedContentTContext::Characters( const OUString& rChars )
+{
+ AddContent( new XMLPersTextTContext_Impl( GetTransformer(), rChars ) );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/PersMixedContentTContext.hxx b/xmloff/source/transform/PersMixedContentTContext.hxx
new file mode 100644
index 000000000000..8a19dd53f470
--- /dev/null
+++ b/xmloff/source/transform/PersMixedContentTContext.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PERSMIXEDCONTENTTCONTEXT_HXX
+#define _XMLOFF_PERSMIXEDCONTENTTCONTEXT_HXX
+
+#include <rtl/ref.hxx>
+
+#include <vector>
+#include "DeepTContext.hxx"
+
+class XMLPersMixedContentTContext : public XMLPersElemContentTContext
+{
+public:
+ TYPEINFO();
+
+ // mixed content persistence only
+ XMLPersMixedContentTContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName );
+
+ // mixed content persistence + attribute processing
+ XMLPersMixedContentTContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName,
+ sal_uInt16 nActionMap );
+
+ // mixed content persistence + renaming
+ XMLPersMixedContentTContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName,
+ sal_uInt16 nPrefix,
+ ::xmloff::token::XMLTokenEnum eToken );
+
+ // mixed content persistence + renaming + attribute processing
+ XMLPersMixedContentTContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName,
+ sal_uInt16 nPrefix,
+ ::xmloff::token::XMLTokenEnum eToken,
+ sal_uInt16 nActionMap );
+
+ virtual void Characters( const ::rtl::OUString& rChars );
+
+ virtual ~XMLPersMixedContentTContext();
+};
+
+#endif // _XMLOFF_PERSMIXEDCONTENTTCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/ProcAddAttrTContext.cxx b/xmloff/source/transform/ProcAddAttrTContext.cxx
new file mode 100644
index 000000000000..e289b71270fb
--- /dev/null
+++ b/xmloff/source/transform/ProcAddAttrTContext.cxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "ProcAddAttrTContext.hxx"
+#include "MutableAttrList.hxx"
+#include "TransformerBase.hxx"
+#include <xmloff/nmspmap.hxx>
+
+using ::rtl::OUString;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::xmloff::token;
+
+TYPEINIT1( XMLProcAddAttrTransformerContext, XMLProcAttrTransformerContext);
+
+XMLProcAddAttrTransformerContext::XMLProcAddAttrTransformerContext(
+ XMLTransformerBase& rImp,
+ const OUString& rQName,
+ sal_uInt16 nPrefix,
+ ::xmloff::token::XMLTokenEnum eToken,
+ sal_uInt16 nActionMap,
+ sal_uInt16 nAPrefix,
+ ::xmloff::token::XMLTokenEnum eAToken,
+ ::xmloff::token::XMLTokenEnum eVToken ) :
+ XMLProcAttrTransformerContext( rImp, rQName, nPrefix, eToken, nActionMap ),
+ m_aAttrQName( rImp.GetNamespaceMap().GetQNameByKey( nAPrefix,
+ ::xmloff::token::GetXMLToken( eAToken ) ) ),
+ m_aAttrValue( ::xmloff::token::GetXMLToken( eVToken ) )
+{
+}
+
+XMLProcAddAttrTransformerContext::~XMLProcAddAttrTransformerContext()
+{
+}
+
+void XMLProcAddAttrTransformerContext::StartElement(
+ const Reference< XAttributeList >& rAttrList )
+{
+ Reference< XAttributeList > xAttrList( rAttrList );
+ XMLMutableAttributeList *pMutableAttrList =
+ GetTransformer().ProcessAttrList( xAttrList, GetActionMap(),
+ sal_False );
+ if( !pMutableAttrList )
+ {
+ pMutableAttrList = new XMLMutableAttributeList;
+ xAttrList = pMutableAttrList;
+ }
+ pMutableAttrList->AddAttribute( m_aAttrQName, m_aAttrValue );
+ GetTransformer().GetDocHandler()->startElement( GetElemQName(), xAttrList );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/ProcAddAttrTContext.hxx b/xmloff/source/transform/ProcAddAttrTContext.hxx
new file mode 100644
index 000000000000..bcdb4c1539ce
--- /dev/null
+++ b/xmloff/source/transform/ProcAddAttrTContext.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PROCADDATTRTCONTEXT_HXX
+#define _XMLOFF_PROCADDATTRTCONTEXT_HXX
+
+#include "ProcAttrTContext.hxx"
+
+class XMLMutableAttributeList;
+class XMLTransformerActions;
+class XMLProcAddAttrTransformerContext : public XMLProcAttrTransformerContext
+{
+ ::rtl::OUString m_aAttrQName;
+ ::rtl::OUString m_aAttrValue;
+
+public:
+ TYPEINFO();
+
+ XMLProcAddAttrTransformerContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName,
+ sal_uInt16 nPrefix,
+ ::xmloff::token::XMLTokenEnum eToken,
+ sal_uInt16 nActionMap,
+ sal_uInt16 nAPrefix,
+ ::xmloff::token::XMLTokenEnum eAToken,
+ ::xmloff::token::XMLTokenEnum eVToken );
+
+ virtual ~XMLProcAddAttrTransformerContext();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+};
+
+#endif // _XMLOFF_PROCADDATTRCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/ProcAttrTContext.cxx b/xmloff/source/transform/ProcAttrTContext.cxx
new file mode 100644
index 000000000000..83c2361ca579
--- /dev/null
+++ b/xmloff/source/transform/ProcAttrTContext.cxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "ProcAttrTContext.hxx"
+#include "MutableAttrList.hxx"
+#include "TransformerBase.hxx"
+#include "TransformerActions.hxx"
+#include <xmloff/nmspmap.hxx>
+
+using ::rtl::OUString;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::xmloff::token;
+
+TYPEINIT1( XMLProcAttrTransformerContext, XMLTransformerContext );
+
+XMLProcAttrTransformerContext::XMLProcAttrTransformerContext(
+ XMLTransformerBase& rImp,
+ const OUString& rQName,
+ sal_uInt16 nActionMap ) :
+ XMLTransformerContext( rImp, rQName ),
+ m_aElemQName( rQName ),
+ m_nActionMap( nActionMap )
+{
+}
+
+XMLProcAttrTransformerContext::XMLProcAttrTransformerContext(
+ XMLTransformerBase& rImp,
+ const OUString& rQName,
+ sal_uInt16 nPrefix,
+ ::xmloff::token::XMLTokenEnum eToken,
+ sal_uInt16 nActionMap ) :
+ XMLTransformerContext( rImp, rQName ),
+ m_aElemQName( rImp.GetNamespaceMap().GetQNameByKey( nPrefix,
+ ::xmloff::token::GetXMLToken( eToken ) ) ),
+ m_nActionMap( nActionMap )
+{
+}
+
+XMLProcAttrTransformerContext::~XMLProcAttrTransformerContext()
+{
+}
+
+void XMLProcAttrTransformerContext::StartElement(
+ const Reference< XAttributeList >& rAttrList )
+{
+ Reference< XAttributeList > xAttrList( rAttrList );
+ GetTransformer().ProcessAttrList( xAttrList, m_nActionMap, sal_False );
+ GetTransformer().GetDocHandler()->startElement( m_aElemQName, xAttrList );
+}
+
+void XMLProcAttrTransformerContext::EndElement()
+{
+ GetTransformer().GetDocHandler()->endElement( m_aElemQName );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/ProcAttrTContext.hxx b/xmloff/source/transform/ProcAttrTContext.hxx
new file mode 100644
index 000000000000..78a8b6dc1cf7
--- /dev/null
+++ b/xmloff/source/transform/ProcAttrTContext.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PROCATTRTCONTEXT_HXX
+#define _XMLOFF_PROCATTRTCONTEXT_HXX
+
+#include <xmloff/xmltoken.hxx>
+#include "TransformerContext.hxx"
+
+class XMLMutableAttributeList;
+class XMLTransformerActions;
+class XMLProcAttrTransformerContext : public XMLTransformerContext
+{
+ ::rtl::OUString m_aElemQName;
+ sal_uInt16 m_nActionMap;
+
+protected:
+
+ const ::rtl::OUString& GetElemQName() const { return m_aElemQName; }
+ sal_uInt16 GetActionMap() const { return m_nActionMap; }
+
+public:
+ TYPEINFO();
+
+ XMLProcAttrTransformerContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName,
+ sal_uInt16 nActionMap );
+
+ XMLProcAttrTransformerContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName,
+ sal_uInt16 nPrefix,
+ ::xmloff::token::XMLTokenEnum eToken,
+ sal_uInt16 nActionMap );
+
+ virtual ~XMLProcAttrTransformerContext();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+};
+
+#endif // _XMLOFF_PROCATTRCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/PropType.hxx b/xmloff/source/transform/PropType.hxx
new file mode 100644
index 000000000000..fcdebeb93c18
--- /dev/null
+++ b/xmloff/source/transform/PropType.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PROPTYPE_HXX
+#define _XMLOFF_PROPTYPE_HXX
+
+enum XMLPropType
+{
+ XML_PROP_TYPE_GRAPHIC,
+ XML_PROP_TYPE_DRAWING_PAGE,
+ XML_PROP_TYPE_PAGE_LAYOUT,
+ XML_PROP_TYPE_HEADER_FOOTER,
+ XML_PROP_TYPE_TEXT,
+ XML_PROP_TYPE_PARAGRAPH,
+ XML_PROP_TYPE_RUBY,
+ XML_PROP_TYPE_SECTION,
+ XML_PROP_TYPE_TABLE,
+ XML_PROP_TYPE_TABLE_COLUMN,
+ XML_PROP_TYPE_TABLE_ROW,
+ XML_PROP_TYPE_TABLE_CELL,
+ XML_PROP_TYPE_LIST_LEVEL,
+ XML_PROP_TYPE_CHART,
+ XML_PROP_TYPE_END
+};
+
+#endif // _XMLOFF_PROPTYPE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/PropertyActionsOASIS.cxx b/xmloff/source/transform/PropertyActionsOASIS.cxx
new file mode 100644
index 000000000000..17463ca4ef80
--- /dev/null
+++ b/xmloff/source/transform/PropertyActionsOASIS.cxx
@@ -0,0 +1,557 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "xmloff/xmlnmspe.hxx"
+#include "PropType.hxx"
+#include "FamilyType.hxx"
+#include "PropertyActionsOASIS.hxx"
+
+using namespace ::xmloff::token;
+
+#define NO_PARAMS 0, 0, 0
+
+XMLTransformerActionInit aGraphicPropertyOASISAttrActionTable[] =
+{
+ { XML_NAMESPACE_SVG, XML_STROKE_WIDTH, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_MARKER_START_WIDTH, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_MARKER_END_WIDTH, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_SHADOW_OFFSET_X, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_SHADOW_OFFSET_Y, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_SHADOW_OPACITY,
+ XML_ATACTION_RENAME_NEG_PERCENT,
+ XMLTransformerActionInit::QNameParam( XML_NAMESPACE_DRAW,
+ XML_SHADOW_TRANSPARENCY), 0, 0 },
+ { XML_NAMESPACE_DRAW, XML_GUIDE_OVERHANG, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_START_GUIDE, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_END_GUIDE, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_CAPTION_ESCAPE, XML_ATACTION_CAPTION_ESCAPE_OASIS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_CAPTION_LINE_LENGTH, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DR3D, XML_DEPTH, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_SVG, XML_WIDTH, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_SVG, XML_HEIGHT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MAX_HEIGHT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MAX_WIDTH, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER_TOP, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER_LEFT, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER_RIGHT, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_TOP, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_BOTTOM, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_LEFT, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_RIGHT, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_TOP, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_SHADOW, XML_ATACTION_INS2INCHS,
+ NO_PARAMS },
+ { XML_NAMESPACE_FO, XML_CLIP, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+// { XML_NAMESPACE_STYLE, XML_WRAP_DYNAMIC_TRESHOLD, XML_ATACTION_REMOVE,
+// NO_PARAMS }, /* generated entry */ // TODO
+ { XML_NAMESPACE_DRAW, XML_VISIBLE_AREA_LEFT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_VISIBLE_AREA_TOP, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_VISIBLE_AREA_WIDTH, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_VISIBLE_AREA_HEIGHT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_START_LINE_SPACING_HORIZONTAL, XML_ATACTION_IN2INCH, NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_START_LINE_SPACING_VERTICAL, XML_ATACTION_IN2INCH, NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_END_LINE_SPACING_HORIZONTAL, XML_ATACTION_IN2INCH, NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_END_LINE_SPACING_VERTICAL, XML_ATACTION_IN2INCH, NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_LINE_DISTANCE, XML_ATACTION_IN2INCH, NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_GUIDE_DISTANCE, XML_ATACTION_IN2INCH, NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_CAPTION_GAP, XML_ATACTION_IN2INCH, NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_SVG, XML_X, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_SVG, XML_Y, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_STROKE_DASH, XML_ATACTION_DECODE_STYLE_NAME_REF,
+ XML_FAMILY_TYPE_STROKE_DASH, 0, 0 },
+ { XML_NAMESPACE_DRAW, XML_MARKER_START, XML_ATACTION_DECODE_STYLE_NAME_REF,
+ XML_FAMILY_TYPE_MARKER, 0, 0 },
+ { XML_NAMESPACE_DRAW, XML_MARKER_END, XML_ATACTION_DECODE_STYLE_NAME_REF,
+ XML_FAMILY_TYPE_MARKER, 0, 0 },
+ { XML_NAMESPACE_DRAW, XML_FILL_GRADIENT_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF,
+ XML_FAMILY_TYPE_GRADIENT, 0, 0 },
+
+ // #i25616#
+ { XML_NAMESPACE_DRAW, XML_OPACITY, XML_OPTACTION_OPACITY, NO_PARAMS },
+ { XML_NAMESPACE_DRAW, XML_IMAGE_OPACITY, XML_OPTACTION_IMAGE_OPACITY, NO_PARAMS },
+
+ { XML_NAMESPACE_DRAW, XML_STROKE_LINEJOIN, XML_ATACTION_RENAME,
+ XMLTransformerActionInit::QNameParam( XML_NAMESPACE_SVG,
+ XML_STROKE_LINEJOIN), 0, 0 },
+ { XML_NAMESPACE_DRAW, XML_OPACITY_NAME,
+ XML_ATACTION_RENAME_DECODE_STYLE_NAME_REF,
+ XMLTransformerActionInit::QNameParam( XML_NAMESPACE_DRAW,
+ XML_TRANSPARENCY_NAME),
+ XML_FAMILY_TYPE_GRADIENT, 0 },
+ { XML_NAMESPACE_DRAW, XML_FILL_HATCH_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF,
+ XML_FAMILY_TYPE_HATCH, 0, 0 },
+ { XML_NAMESPACE_DRAW, XML_FILL_IMAGE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF,
+ XML_FAMILY_TYPE_FILL_IMAGE, 0, 0 },
+
+ // Font work properties
+ { XML_NAMESPACE_DRAW, XML_FONTWORK_DISTANCE, XML_ATACTION_IN2INCH, NO_PARAMS },
+ { XML_NAMESPACE_DRAW, XML_FONTWORK_START, XML_ATACTION_IN2INCH, NO_PARAMS },
+ { XML_NAMESPACE_DRAW, XML_FONTWORK_SHADOW_OFFSET_X, XML_ATACTION_IN2INCH, NO_PARAMS },
+ { XML_NAMESPACE_DRAW, XML_FONTWORK_SHADOW_OFFSET_Y, XML_ATACTION_IN2INCH, NO_PARAMS },
+
+ { XML_NAMESPACE_DRAW, XML_AUTO_GROW_WIDTH, XML_ATACTION_RENAME,
+ XMLTransformerActionInit::QNameParam( XML_NAMESPACE_DRAW,
+ XML_AUTO_GROW_HEIGHT ), 0, 0 },
+ { XML_NAMESPACE_DRAW, XML_AUTO_GROW_HEIGHT, XML_ATACTION_RENAME,
+ XMLTransformerActionInit::QNameParam( XML_NAMESPACE_DRAW,
+ XML_AUTO_GROW_WIDTH ), 0, 0 },
+ { XML_NAMESPACE_PRESENTATION, XML_DURATION, XML_ATACTION_RNG2ISO_DATETIME, NO_PARAMS },
+ { XML_NAMESPACE_TEXT, XML_ANIMATION_DELAY, XML_ATACTION_RNG2ISO_DATETIME, NO_PARAMS },
+
+ { XML_NAMESPACE_STYLE, XML_PROTECT, XML_ATACTION_DECODE_PROTECT, NO_PARAMS },
+ { XML_NAMESPACE_STYLE, XML_MIRROR, XML_ATACTION_DRAW_MIRROR_OASIS, NO_PARAMS },
+ { XML_NAMESPACE_DRAW, XML_GAMMA, XML_ATACTION_GAMMA_OASIS, NO_PARAMS },
+ { XML_NAMESPACE_SVG, XML_STROKE_OPACITY, XML_ATACTION_OPACITY_FIX, NO_PARAMS },
+
+ { XML_NAMESPACE_STYLE, XML_FLOW_WITH_TEXT, XML_ATACTION_REMOVE,
+ NO_PARAMS },
+ { XML_NAMESPACE_DRAW, XML_WRAP_INFLUENCE_ON_POSITION, XML_ATACTION_REMOVE,
+ NO_PARAMS },
+
+ { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS }
+};
+
+XMLTransformerActionInit aDrawingPagePropertyOASISAttrActionTable[] =
+{
+ // style-graphic-fill-properties-attlist
+ { XML_NAMESPACE_DRAW, XML_FILL_GRADIENT_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF,
+ NO_PARAMS },
+ { XML_NAMESPACE_DRAW, XML_FILL_HATCH_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_FILL_IMAGE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF,
+ NO_PARAMS },
+ { XML_NAMESPACE_DRAW, XML_FILL_IMAGE_WIDTH, XML_ATACTION_IN2INCH, NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_FILL_IMAGE_HEIGHT, XML_ATACTION_IN2INCH, NO_PARAMS }, /* generated entry */
+
+ { XML_NAMESPACE_PRESENTATION, XML_DISPLAY_HEADER, XML_ATACTION_REMOVE, NO_PARAMS },
+ { XML_NAMESPACE_PRESENTATION, XML_DISPLAY_FOOTER, XML_ATACTION_REMOVE, NO_PARAMS },
+ { XML_NAMESPACE_PRESENTATION, XML_DISPLAY_PAGE_NUMBER, XML_ATACTION_REMOVE, NO_PARAMS },
+ { XML_NAMESPACE_PRESENTATION, XML_DISPLAY_DATE_TIME, XML_ATACTION_REMOVE, NO_PARAMS },
+
+ { XML_NAMESPACE_SMIL, XML_TYPE, XML_ATACTION_REMOVE, NO_PARAMS },
+ { XML_NAMESPACE_SMIL, XML_SUBTYPE, XML_ATACTION_REMOVE, NO_PARAMS },
+ { XML_NAMESPACE_SMIL, XML_DIRECTION, XML_ATACTION_REMOVE, NO_PARAMS },
+ { XML_NAMESPACE_SMIL, XML_FADECOLOR, XML_ATACTION_REMOVE, NO_PARAMS },
+
+ { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS }
+};
+
+XMLTransformerActionInit aPageLayoutPropertyOASISAttrActionTable[] =
+{
+ { XML_NAMESPACE_FO, XML_PAGE_WIDTH, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PAGE_HEIGHT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER_TOP, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER_LEFT, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER_RIGHT, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_TOP, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_BOTTOM, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_LEFT, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_RIGHT, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_TOP, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_SHADOW, XML_ATACTION_INS2INCHS,
+ NO_PARAMS },
+ { XML_NAMESPACE_STYLE, XML_FOOTNOTE_MAX_HEIGHT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_BASE_HEIGHT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_RUBY_HEIGHT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_REGISTER_TRUTH_REF_STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, XML_FAMILY_TYPE_PARAGRAPH, 0, 0 },
+ { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS }
+};
+
+XMLTransformerActionInit aHeaderFooterPropertyOASISAttrActionTable[] =
+{
+ { XML_NAMESPACE_SVG, XML_HEIGHT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MIN_HEIGHT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER_TOP, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER_LEFT, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER_RIGHT, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_TOP, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_BOTTOM, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_LEFT, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_RIGHT, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_TOP, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_SHADOW, XML_ATACTION_INS2INCHS,
+ NO_PARAMS },
+ { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS }
+};
+
+XMLTransformerActionInit aTextPropertyOASISAttrActionTable[] =
+{
+ { XML_NAMESPACE_FO, XML_FONT_SIZE, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_FONT_SIZE_ASIAN, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_FONT_SIZE_COMPLEX, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_FONT_SIZE_REL, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_FONT_SIZE_REL_ASIAN, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_FONT_SIZE_REL_COMPLEX, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_LETTER_SPACING, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_TEXT_SHADOW, XML_ATACTION_INS2INCHS,
+ NO_PARAMS },
+ { XML_NAMESPACE_STYLE, XML_TEXT_UNDERLINE_TYPE,
+ XML_OPTACTION_UNDERLINE_TYPE, NO_PARAMS }, /* new attribute */
+ { XML_NAMESPACE_STYLE, XML_TEXT_UNDERLINE_STYLE,
+ XML_OPTACTION_UNDERLINE_STYLE, NO_PARAMS }, /* new attribute */
+ { XML_NAMESPACE_STYLE, XML_TEXT_UNDERLINE_WIDTH,
+ XML_OPTACTION_UNDERLINE_WIDTH, NO_PARAMS }, /* new attribute */
+ { XML_NAMESPACE_STYLE, XML_TEXT_UNDERLINE_MODE,
+ XML_OPTACTION_LINE_MODE, NO_PARAMS },
+ { XML_NAMESPACE_STYLE, XML_TEXT_LINE_THROUGH_TYPE,
+ XML_OPTACTION_LINETHROUGH_TYPE, NO_PARAMS }, /* new entry*/
+ { XML_NAMESPACE_STYLE, XML_TEXT_LINE_THROUGH_STYLE,
+ XML_OPTACTION_LINETHROUGH_STYLE, NO_PARAMS }, /* new entry*/
+ { XML_NAMESPACE_STYLE, XML_TEXT_LINE_THROUGH_WIDTH,
+ XML_OPTACTION_LINETHROUGH_WIDTH, NO_PARAMS }, /* new entry*/
+ { XML_NAMESPACE_STYLE, XML_TEXT_LINE_THROUGH_COLOR,
+ XML_ATACTION_REMOVE, NO_PARAMS }, /* new entry*/
+ { XML_NAMESPACE_STYLE, XML_TEXT_LINE_THROUGH_TEXT,
+ XML_OPTACTION_LINETHROUGH_TEXT, NO_PARAMS }, /* new entry*/
+ { XML_NAMESPACE_STYLE, XML_TEXT_LINE_THROUGH_TEXT_STYLE,
+ XML_ATACTION_REMOVE, NO_PARAMS }, /* new entry*/
+ { XML_NAMESPACE_STYLE, XML_TEXT_LINE_THROUGH_MODE,
+ XML_OPTACTION_LINE_MODE, NO_PARAMS },
+ { XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_ATACTION_RENAME,
+ XMLTransformerActionInit::QNameParam( XML_NAMESPACE_STYLE,
+ XML_TEXT_BACKGROUND_COLOR ), 0, 0 },
+ { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS }
+};
+
+XMLTransformerActionInit aParagraphPropertyOASISAttrActionTable[] =
+{
+ { XML_NAMESPACE_FO, XML_TEXT_ALIGN, XML_OPTACTION_CONTROL_TEXT_ALIGN,
+ NO_PARAMS },
+ { XML_NAMESPACE_FO, XML_LINE_HEIGHT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_LINE_HEIGHT_AT_LEAST, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_LINE_SPACING, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_TAB_STOP_DISTANCE, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_TEXT_INDENT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_TOP, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_BOTTOM, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_LEFT, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_RIGHT, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_TOP, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_SHADOW, XML_ATACTION_INS2INCHS,
+ NO_PARAMS },
+ { XML_NAMESPACE_FO, XML_KEEP_WITH_NEXT, XML_OPTACTION_KEEP_WITH_NEXT,
+ NO_PARAMS },
+ { XML_NAMESPACE_FO, XML_KEEP_TOGETHER, XML_OPTACTION_KEEP_TOGETHER,
+ NO_PARAMS },
+// { XML_NAMESPACE_STYLE, XML_WRITING_MODE, XML_OPTACTION_DRAW_WRITING_MODE, 0 },
+ { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS }
+};
+
+XMLTransformerActionInit aSectionPropertyOASISAttrActionTable[] =
+{
+ { XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS }
+};
+
+XMLTransformerActionInit aTablePropertyOASISAttrActionTable[] =
+{
+ { XML_NAMESPACE_STYLE, XML_WIDTH, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_KEEP_WITH_NEXT, XML_OPTACTION_KEEP_WITH_NEXT,
+ NO_PARAMS },
+ { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS }
+};
+
+XMLTransformerActionInit aTableColumnPropertyOASISAttrActionTable[] =
+{
+ { XML_NAMESPACE_STYLE, XML_COLUMN_WIDTH, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS }
+};
+
+XMLTransformerActionInit aTableRowPropertyOASISAttrActionTable[] =
+{
+ { XML_NAMESPACE_STYLE, XML_ROW_HEIGHT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_MIN_ROW_HEIGHT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS }
+};
+
+XMLTransformerActionInit aTableCellPropertyOASISAttrActionTable[] =
+{
+ { XML_NAMESPACE_STYLE, XML_VERTICAL_ALIGN, XML_ATACTION_RENAME,
+ XMLTransformerActionInit::QNameParam( XML_NAMESPACE_FO,
+ XML_VERTICAL_ALIGN ), 0, 0 },
+ { XML_NAMESPACE_FO, XML_BORDER, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER_TOP, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER_LEFT, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER_RIGHT, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_TOP, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_BOTTOM, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_LEFT, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_RIGHT, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_DIAGONAL_BL_TR, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_DIAGONAL_BL_TR_WIDTH, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_DIAGONAL_TL_BR, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_DIAGONAL_TL_BR_WIDTH, XML_ATACTION_INS2INCHS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_TOP, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_DIRECTION, XML_ATACTION_RENAME,
+ XMLTransformerActionInit::QNameParam( XML_NAMESPACE_FO,
+ XML_DIRECTION), 0, 0 },
+ { XML_NAMESPACE_STYLE, XML_SHADOW, XML_ATACTION_INS2INCHS,
+ NO_PARAMS },
+ { XML_NAMESPACE_STYLE, XML_REPEAT_CONTENT, XML_ATACTION_REMOVE,
+ NO_PARAMS }, /* new entry*/
+ { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS }
+};
+
+XMLTransformerActionInit aListLevelPropertyOASISAttrActionTable[] =
+{
+ { XML_NAMESPACE_TEXT, XML_SPACE_BEFORE, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_TEXT, XML_MIN_LABEL_WIDTH, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_TEXT, XML_MIN_LABEL_DISTANCE, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_WIDTH, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_HEIGHT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS }
+};
+
+XMLTransformerActionInit aChartPropertyOASISAttrActionTable[] =
+{
+ { XML_NAMESPACE_CHART, XML_SYMBOL_WIDTH, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_SYMBOL_HEIGHT, XML_ATACTION_IN2INCH,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_DIRECTION, XML_ATACTION_RENAME,
+ XMLTransformerActionInit::QNameParam( XML_NAMESPACE_FO,
+ XML_DIRECTION ), 0, 0 },
+ { XML_NAMESPACE_CHART, XML_INTERPOLATION, XML_OPTACTION_INTERPOLATION, NO_PARAMS },
+ { XML_NAMESPACE_STYLE, XML_ROTATION_ANGLE, XML_ATACTION_RENAME,
+ XMLTransformerActionInit::QNameParam( XML_NAMESPACE_TEXT,
+ XML_ROTATION_ANGLE ), 0, 0 },
+ { XML_NAMESPACE_CHART, XML_INTERVAL_MAJOR, XML_OPTACTION_INTERVAL_MAJOR, NO_PARAMS },
+ { XML_NAMESPACE_CHART, XML_INTERVAL_MINOR_DIVISOR, XML_OPTACTION_INTERVAL_MINOR_DIVISOR,
+ NO_PARAMS },
+ { XML_NAMESPACE_CHART, XML_JAPANESE_CANDLE_STICK, XML_ATACTION_RENAME,
+ XMLTransformerActionInit::QNameParam( XML_NAMESPACE_CHART,
+ XML_STOCK_UPDOWN_BARS ), 0, 0 },
+ { XML_NAMESPACE_CHART, XML_SYMBOL_TYPE, XML_OPTACTION_SYMBOL_TYPE, NO_PARAMS },
+ { XML_NAMESPACE_CHART, XML_SYMBOL_NAME, XML_OPTACTION_SYMBOL_NAME, NO_PARAMS },
+
+ { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/PropertyActionsOASIS.hxx b/xmloff/source/transform/PropertyActionsOASIS.hxx
new file mode 100644
index 000000000000..468d12157cbc
--- /dev/null
+++ b/xmloff/source/transform/PropertyActionsOASIS.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PROPERTYACTIONSOASIS_HXX
+#define _XMLOFF_PROPERTYACTIONSOASIS_HXX
+
+#include "TransformerAction.hxx"
+#include "TransformerActionInit.hxx"
+#include "AttrTransformerAction.hxx"
+
+enum XMLPropOASISTransformerAction
+{
+ XML_OPTACTION_LINE_MODE=XML_ATACTION_USER_DEFINED,
+ XML_OPTACTION_UNDERLINE_TYPE,
+ XML_OPTACTION_UNDERLINE_STYLE,
+ XML_OPTACTION_UNDERLINE_WIDTH,
+ XML_OPTACTION_LINETHROUGH_TYPE,
+ XML_OPTACTION_LINETHROUGH_STYLE,
+ XML_OPTACTION_LINETHROUGH_WIDTH,
+ XML_OPTACTION_LINETHROUGH_TEXT,
+ XML_OPTACTION_KEEP_WITH_NEXT,
+ XML_OPTACTION_INTERPOLATION,
+ XML_OPTACTION_INTERVAL_MAJOR,
+ XML_OPTACTION_INTERVAL_MINOR_DIVISOR,
+ XML_OPTACTION_SYMBOL_TYPE,
+ XML_OPTACTION_SYMBOL_NAME,
+ XML_OPTACTION_OPACITY,
+ XML_OPTACTION_IMAGE_OPACITY,
+ XML_OPTACTION_KEEP_TOGETHER,
+ XML_OPTACTION_CONTROL_TEXT_ALIGN,
+ XML_OPTACTION_DRAW_WRITING_MODE,
+ XML_ATACTION_CAPTION_ESCAPE_OASIS,
+ XML_ATACTION_DECODE_PROTECT,
+ XML_OPTACTION_END=XML_ATACTION_END
+};
+
+extern XMLTransformerActionInit aGraphicPropertyOASISAttrActionTable[];
+extern XMLTransformerActionInit aDrawingPagePropertyOASISAttrActionTable[];
+extern XMLTransformerActionInit aPageLayoutPropertyOASISAttrActionTable[];
+extern XMLTransformerActionInit aHeaderFooterPropertyOASISAttrActionTable[];
+extern XMLTransformerActionInit aTextPropertyOASISAttrActionTable[];
+extern XMLTransformerActionInit aParagraphPropertyOASISAttrActionTable[];
+extern XMLTransformerActionInit aSectionPropertyOASISAttrActionTable[];
+extern XMLTransformerActionInit aTablePropertyOASISAttrActionTable[];
+extern XMLTransformerActionInit aTableColumnPropertyOASISAttrActionTable[];
+extern XMLTransformerActionInit aTableRowPropertyOASISAttrActionTable[];
+extern XMLTransformerActionInit aTableCellPropertyOASISAttrActionTable[];
+extern XMLTransformerActionInit aListLevelPropertyOASISAttrActionTable[];
+extern XMLTransformerActionInit aChartPropertyOASISAttrActionTable[];
+
+#endif // _XMLOFF_PROPERTYACTIONSOASIS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/PropertyActionsOOo.cxx b/xmloff/source/transform/PropertyActionsOOo.cxx
new file mode 100644
index 000000000000..ca369de2334c
--- /dev/null
+++ b/xmloff/source/transform/PropertyActionsOOo.cxx
@@ -0,0 +1,1070 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "xmloff/xmlnmspe.hxx"
+#include "PropType.hxx"
+#include "PropertyActionsOOo.hxx"
+
+using namespace ::xmloff::token;
+
+#define NO_PARAMS 0, 0, 0
+
+XMLTransformerActionInit aGraphicPropertyOOoAttrActionTable[] =
+{
+ { XML_NAMESPACE_DRAW, XML_STROKE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_SVG, XML_STROKE_WIDTH, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_SVG, XML_STROKE_COLOR, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_MARKER_START_WIDTH, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_MARKER_END_WIDTH, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_MARKER_START_CENTER, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_MARKER_END_CENTER, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_SVG, XML_STROKE_OPACITY, XML_ATACTION_OPACITY_FIX,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_SVG, XML_STROKE_LINEJOIN, XML_ATACTION_RENAME,
+ XMLTransformerActionInit::QNameParam( XML_NAMESPACE_DRAW,
+ XML_STROKE_LINEJOIN), 0, 0 },
+ { XML_NAMESPACE_TEXT, XML_ANIMATION, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_TEXT, XML_ANIMATION_DIRECTION, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_TEXT, XML_ANIMATION_START_INSIDE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_TEXT, XML_ANIMATION_STOP_INSIDE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_TEXT, XML_ANIMATION_REPEAT, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_TEXT, XML_ANIMATION_DELAY, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_TEXT, XML_ANIMATION_STEPS, XML_ATACTION_COPY,
+ NO_PARAMS }, /* TODO: missing in OASIS spec */
+ { XML_NAMESPACE_DRAW, XML_AUTO_GROW_WIDTH, XML_ATACTION_RENAME,
+ XMLTransformerActionInit::QNameParam( XML_NAMESPACE_DRAW,
+ XML_AUTO_GROW_HEIGHT ), 0, 0 },
+ { XML_NAMESPACE_DRAW, XML_AUTO_GROW_HEIGHT, XML_ATACTION_RENAME,
+ XMLTransformerActionInit::QNameParam( XML_NAMESPACE_DRAW,
+ XML_AUTO_GROW_WIDTH ), 0, 0 },
+ { XML_NAMESPACE_DRAW, XML_FIT_TO_SIZE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_TEXTAREA_VERTICAL_ALIGN, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_TEXTAREA_HORIZONTAL_ALIGN, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_COLOR_MODE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_COLOR_INVERSION, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_LUMINANCE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_CONTRAST, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_GAMMA, XML_ATACTION_GAMMA_OOO,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_RED, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_GREEN, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_BLUE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_SHADOW, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_SHADOW_OFFSET_X, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_SHADOW_OFFSET_Y, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_SHADOW_COLOR, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_SHADOW_TRANSPARENCY,
+ XML_ATACTION_RENAME_NEG_PERCENT,
+ XMLTransformerActionInit::QNameParam( XML_NAMESPACE_DRAW,
+ XML_SHADOW_OPACITY), 0, 0 },
+ { XML_NAMESPACE_DRAW, XML_START_LINE_SPACING_HORIZONTAL, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_START_LINE_SPACING_VERTICAL, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_END_LINE_SPACING_HORIZONTAL, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_END_LINE_SPACING_VERTICAL, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_LINE_DISTANCE, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_GUIDE_OVERHANG, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_GUIDE_DISTANCE, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_START_GUIDE, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_END_GUIDE, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_PLACING, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_PARALLEL, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_MEASURE_ALIGN, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_MEASURE_VERTICAL_ALIGN, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_UNIT, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_SHOW_UNIT, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_DECIMAL_PLACES, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_CAPTION_TYPE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_CAPTION_ANGLE_TYPE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_CAPTION_ANGLE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_CAPTION_GAP, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_CAPTION_ESCAPE_DIRECTION, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_CAPTION_ESCAPE, XML_ATACTION_CAPTION_ESCAPE_OOO,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_CAPTION_LINE_LENGTH, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_CAPTION_FIT_LINE_LENGTH, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DR3D, XML_HORIZONTAL_SEGMENTS, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DR3D, XML_VERTICAL_SEGMENTS, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DR3D, XML_EDGE_ROUNDING, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+// { XML_NAMESPACE_DR3D, XML_EDGE_ROUNDING_MODE, XML_ATACTION_COPY,
+// NO_PARAMS }, /* TODO: does not exist! */
+ { XML_NAMESPACE_DR3D, XML_BACK_SCALE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DR3D, XML_DEPTH, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DR3D, XML_BACKFACE_CULLING, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DR3D, XML_LIGHTING_MODE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DR3D, XML_NORMALS_KIND, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DR3D, XML_NORMALS_DIRECTION, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DR3D, XML_TEX_GENERATION_MODE_X, XML_ATACTION_COPY,
+ NO_PARAMS },
+ { XML_NAMESPACE_DR3D, XML_TEX_GENERATION_MODE_Y, XML_ATACTION_COPY,
+ NO_PARAMS },
+ { XML_NAMESPACE_DR3D, XML_END_ANGLE, XML_ATACTION_COPY,
+ NO_PARAMS },
+ { XML_NAMESPACE_DR3D, XML_TEX_KIND, XML_ATACTION_COPY,
+ NO_PARAMS },
+ { XML_NAMESPACE_DR3D, XML_TEX_FILTER, XML_ATACTION_COPY,
+ NO_PARAMS },
+ { XML_NAMESPACE_DR3D, XML_TEX_MODE, XML_ATACTION_COPY,
+ NO_PARAMS },
+ { XML_NAMESPACE_DR3D, XML_AMBIENT_COLOR, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DR3D, XML_EMISSIVE_COLOR, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DR3D, XML_SPECULAR_COLOR, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DR3D, XML_DIFFUSE_COLOR, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DR3D, XML_SHININESS, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DR3D, XML_SHADOW, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_SVG, XML_WIDTH, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_SVG, XML_HEIGHT, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_REL_WIDTH, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_REL_HEIGHT, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MIN_HEIGHT, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MIN_WIDTH, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MAX_HEIGHT, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MAX_WIDTH, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_ATACTION_INCH2IN_DUPLICATE,
+ XML_PROP_TYPE_PARAGRAPH, 0, 0 }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_ATACTION_INCH2IN_DUPLICATE,
+ XML_PROP_TYPE_PARAGRAPH, 0, 0 }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_ATACTION_INCH2IN_DUPLICATE,
+ XML_PROP_TYPE_PARAGRAPH, 0, 0 }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_ATACTION_INCH2IN_DUPLICATE,
+ XML_PROP_TYPE_PARAGRAPH, 0, 0 }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BACKGROUND_TRANSPARENCY, XML_ATACTION_COPY,
+ NO_PARAMS },
+ { XML_NAMESPACE_FO, XML_BORDER, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER_TOP, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER_LEFT, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER_RIGHT, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_TOP, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_BOTTOM, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_LEFT, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_RIGHT, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_TOP, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_SHADOW, XML_ATACTION_INCHS2INS,
+ NO_PARAMS },
+ { XML_NAMESPACE_STYLE, XML_PRINT_CONTENT, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_PROTECT, XML_ATACTION_PROTECT,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_HORIZONTAL_POS, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_SVG, XML_X, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_HORIZONTAL_REL, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_VERTICAL_POS, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_SVG, XML_Y, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_VERTICAL_REL, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_TEXT, XML_ANCHOR_TYPE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_TEXT, XML_ANCHOR_PAGE_NUMBER, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_EDITABLE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_WRAP, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+// { XML_NAMESPACE_STYLE, XML_WRAP_DYNAMIC_TRESHOLD, XML_ATACTION_COPY,
+// NO_PARAMS }, /* new attribute */
+ { XML_NAMESPACE_STYLE, XML_NUMBER_WRAPPED_PARAGRAPHS, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_WRAP_CONTOUR, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_WRAP_CONTOUR_MODE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_RUN_THROUGH, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_FLOW_WITH_TEXT, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+// { XML_NAMESPACE_STYLE, XML_OVERFLOW_BEHAVIOR, XML_ATACTION_COPY,
+// NO_PARAMS }, /* new attribute */
+ /* Rename attribute values of <style:mirror>: (#i49139#)
+ horizontal-on-left-pages --> horizontal-on-even
+ horizontal-on-right-pages --> horizontal-on-odd
+ */
+ { XML_NAMESPACE_STYLE, XML_MIRROR, XML_ATACTION_STYLE_MIRROR_OOO,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_CLIP, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_FRAME_DISPLAY_SCROLLBAR, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_FRAME_DISPLAY_BORDER, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_FRAME_MARGIN_HORIZONTAL, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_FRAME_MARGIN_VERTICAL, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_VISIBLE_AREA_LEFT, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_VISIBLE_AREA_TOP, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_VISIBLE_AREA_WIDTH, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_VISIBLE_AREA_HEIGHT, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_STROKE_DASH, XML_ATACTION_ENCODE_STYLE_NAME_REF,
+ NO_PARAMS },
+ { XML_NAMESPACE_DRAW, XML_MARKER_START, XML_ATACTION_ENCODE_STYLE_NAME_REF,
+ NO_PARAMS },
+ { XML_NAMESPACE_DRAW, XML_MARKER_END, XML_ATACTION_ENCODE_STYLE_NAME_REF,
+ NO_PARAMS },
+ // style-graphic-fill-properties-attlist
+ { XML_NAMESPACE_DRAW, XML_FILL, XML_ATACTION_COPY, NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_FILL_COLOR, XML_ATACTION_COPY, NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_FILL_GRADIENT_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF,
+ NO_PARAMS },
+ { XML_NAMESPACE_DRAW, XML_GRADIENT_STEP_COUNT, XML_ATACTION_COPY, NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_FILL_HATCH_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF, NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_FILL_HATCH_SOLID, XML_ATACTION_COPY, NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_FILL_IMAGE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF,
+ NO_PARAMS },
+ { XML_NAMESPACE_STYLE, XML_REPEAT, XML_ATACTION_COPY, NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_FILL_IMAGE_WIDTH, XML_ATACTION_INCH2IN, NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_FILL_IMAGE_HEIGHT, XML_ATACTION_INCH2IN, NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT_X, XML_ATACTION_COPY, NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT_Y, XML_ATACTION_COPY, NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT, XML_ATACTION_COPY, NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET, XML_ATACTION_COPY, NO_PARAMS }, /* generated entry */
+
+ // #i25616#
+ { XML_NAMESPACE_DRAW, XML_TRANSPARENCY, XML_PTACTION_TRANSPARENCY, NO_PARAMS },
+
+ { XML_NAMESPACE_DRAW, XML_TRANSPARENCY_NAME,
+ XML_ATACTION_RENAME_ENCODE_STYLE_NAME_REF,
+ XMLTransformerActionInit::QNameParam( XML_NAMESPACE_DRAW,
+ XML_OPACITY_NAME), 0, 0 },
+
+ { XML_NAMESPACE_DRAW, XML_MOVE_PROTECT, XML_ATACTION_MOVE_PROTECT, NO_PARAMS },
+ { XML_NAMESPACE_DRAW, XML_SIZE_PROTECT, XML_ATACTION_SIZE_PROTECT, NO_PARAMS },
+ { XML_NAMESPACE_DRAW, XML_FIT_TO_CONTOUR, XML_ATACTION_COPY, NO_PARAMS },
+
+ // Font work properties
+ { XML_NAMESPACE_DRAW, XML_FONTWORK_STYLE, XML_ATACTION_COPY, NO_PARAMS },
+ { XML_NAMESPACE_DRAW, XML_FONTWORK_ADJUST, XML_ATACTION_COPY, NO_PARAMS },
+ { XML_NAMESPACE_DRAW, XML_FONTWORK_DISTANCE, XML_ATACTION_INCH2IN, NO_PARAMS },
+ { XML_NAMESPACE_DRAW, XML_FONTWORK_START, XML_ATACTION_INCH2IN, NO_PARAMS },
+ { XML_NAMESPACE_DRAW, XML_FONTWORK_MIRROR, XML_ATACTION_COPY, NO_PARAMS },
+ { XML_NAMESPACE_DRAW, XML_FONTWORK_OUTLINE, XML_ATACTION_COPY, NO_PARAMS },
+ { XML_NAMESPACE_DRAW, XML_FONTWORK_SHADOW, XML_ATACTION_COPY, NO_PARAMS },
+ { XML_NAMESPACE_DRAW, XML_FONTWORK_SHADOW_COLOR, XML_ATACTION_COPY, NO_PARAMS },
+ { XML_NAMESPACE_DRAW, XML_FONTWORK_SHADOW_OFFSET_X, XML_ATACTION_INCH2IN, NO_PARAMS },
+ { XML_NAMESPACE_DRAW, XML_FONTWORK_SHADOW_OFFSET_Y, XML_ATACTION_INCH2IN, NO_PARAMS },
+ { XML_NAMESPACE_DRAW, XML_FONTWORK_FORM, XML_ATACTION_COPY, NO_PARAMS },
+ { XML_NAMESPACE_DRAW, XML_FONTWORK_HIDE_FORM, XML_ATACTION_COPY, NO_PARAMS },
+ { XML_NAMESPACE_DRAW, XML_FONTWORK_SHADOW_TRANSPARENCE, XML_ATACTION_COPY, NO_PARAMS },
+
+ { XML_NAMESPACE_DRAW, XML_WRAP_INFLUENCE_ON_POSITION, XML_ATACTION_COPY, NO_PARAMS }, // new in OOo 2.0
+
+ { XML_NAMESPACE_DRAW, XML_MIRROR, XML_ATACTION_DRAW_MIRROR_OOO,
+ NO_PARAMS }, /* generated entry */
+
+ // b6242385: read writing-mode for text frames
+ { XML_NAMESPACE_STYLE, XML_WRITING_MODE, XML_ATACTION_COPY, NO_PARAMS },
+
+ { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS }
+};
+
+XMLTransformerActionInit aGraphicPropertyOOoElemActionTable[] =
+{
+ { XML_NAMESPACE_STYLE, XML_BACKGROUND_IMAGE, XML_ATACTION_COPY, NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_COLUMNS, XML_ATACTION_COPY, NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_TEXT, XML_LIST_STYLE, XML_ATACTION_COPY, NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS }
+};
+
+XMLTransformerActionInit aDrawingPagePropertyOOoAttrActionTable[] =
+{
+ // style-graphic-fill-properties-attlist
+ { XML_NAMESPACE_DRAW, XML_FILL_GRADIENT_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF,
+ NO_PARAMS },
+ { XML_NAMESPACE_DRAW, XML_FILL_HATCH_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF, NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_FILL_HATCH_SOLID, XML_ATACTION_COPY, NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_FILL_IMAGE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF,
+ NO_PARAMS },
+ { XML_NAMESPACE_DRAW, XML_FILL_IMAGE_WIDTH, XML_ATACTION_INCH2IN, NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_FILL_IMAGE_HEIGHT, XML_ATACTION_INCH2IN, NO_PARAMS }, /* generated entry */
+// { XML_NAMESPACE_DRAW, XML_OPACITY_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF,
+// NO_PARAMS },
+
+ { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS }
+};
+
+XMLTransformerActionInit aPageLayoutPropertyOOoAttrActionTable[] =
+{
+ { XML_NAMESPACE_FO, XML_PAGE_WIDTH, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PAGE_HEIGHT, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER_TOP, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER_LEFT, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER_RIGHT, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_TOP, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_BOTTOM, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_LEFT, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_RIGHT, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_TOP, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_SHADOW, XML_ATACTION_INCHS2INS,
+ NO_PARAMS },
+ { XML_NAMESPACE_STYLE, XML_FOOTNOTE_MAX_HEIGHT, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_BASE_HEIGHT, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_RUBY_HEIGHT, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_REGISTER_TRUTH_REF_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF, NO_PARAMS },
+ { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS }
+};
+
+XMLTransformerActionInit aHeaderFooterPropertyOOoAttrActionTable[] =
+{
+ { XML_NAMESPACE_SVG, XML_HEIGHT, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MIN_HEIGHT, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER_TOP, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER_LEFT, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER_RIGHT, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_TOP, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_BOTTOM, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_LEFT, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_RIGHT, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_TOP, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_SHADOW, XML_ATACTION_INCHS2INS,
+ NO_PARAMS },
+ { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS }
+};
+
+XMLTransformerActionInit aTextPropertyOOoAttrActionTable[] =
+{
+ { XML_NAMESPACE_FO, XML_FONT_VARIANT, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_TEXT_TRANSFORM, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_COLOR, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_USE_WINDOW_FONT_COLOR, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_TEXT_OUTLINE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_TEXT_CROSSING_OUT, XML_PTACTION_LINETHROUGH,
+ NO_PARAMS }, /* TODO: rename */
+ { XML_NAMESPACE_STYLE, XML_TEXT_POSITION, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_FONT_NAME, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_FONT_NAME_ASIAN, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_FONT_NAME_COMPLEX, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_FONT_FAMILY, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_FONT_FAMILY_ASIAN, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_FONT_FAMILY_COMPLEX, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_FONT_FAMILY_GENERIC, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_FONT_FAMILY_GENERIC_ASIAN, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_FONT_FAMILY_GENERIC_COMPLEX, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_FONT_STYLE_NAME, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_FONT_STYLE_NAME_ASIAN, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_FONT_STYLE_NAME_COMPLEX, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_FONT_PITCH, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_FONT_PITCH_ASIAN, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_FONT_PITCH_COMPLEX, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_FONT_CHARSET, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_FONT_SIZE, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_FONT_SIZE_ASIAN, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_FONT_SIZE_COMPLEX, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_FONT_SIZE_REL, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_FONT_SIZE_REL_ASIAN, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_FONT_SIZE_REL_COMPLEX, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+// { XML_NAMESPACE_STYLE, XML_SCRIPT_TYPE, XML_ATACTION_COPY,
+// NO_PARAMS }, /* new attribute*/
+ { XML_NAMESPACE_FO, XML_LETTER_SPACING, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_LANGUAGE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_LANGUAGE_ASIAN, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_LANGUAGE_COMPLEX, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_COUNTRY, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_COUNTRY_ASIAN, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_COUNTRY_COMPLEX, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_FONT_STYLE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_FONT_STYLE_ASIAN, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_FONT_STYLE_COMPLEX, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_FONT_RELIEF, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_TEXT_SHADOW, XML_ATACTION_INCHS2INS,
+ NO_PARAMS },
+ { XML_NAMESPACE_STYLE, XML_TEXT_UNDERLINE, XML_PTACTION_UNDERLINE,
+ NO_PARAMS }, /* TODO: rename */
+ { XML_NAMESPACE_STYLE, XML_TEXT_UNDERLINE_COLOR, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_FONT_WEIGHT, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_FONT_WEIGHT_ASIAN, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_FONT_WEIGHT_COMPLEX, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_SCORE_SPACES,
+ XML_PTACTION_LINE_MODE, NO_PARAMS },
+ { XML_NAMESPACE_STYLE, XML_LETTER_KERNING, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_TEXT_BLINKING, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_TEXT_BACKGROUND_COLOR, XML_ATACTION_RENAME,
+ XMLTransformerActionInit::QNameParam( XML_NAMESPACE_FO,
+ XML_BACKGROUND_COLOR ), 0, 0 },
+ { XML_NAMESPACE_STYLE, XML_TEXT_COMBINE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_TEXT_COMBINE_START_CHAR, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_TEXT_COMBINE_END_CHAR, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_TEXT_EMPHASIZE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_TEXT_SCALE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_TEXT_ROTATION_ANGLE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_TEXT_ROTATION_SCALE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_TEXT, XML_DISPLAY, XML_ATACTION_COPY,
+ NO_PARAMS }, /* new in OOo 2.0 */
+ { XML_NAMESPACE_FO, XML_HYPHENATE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_HYPHENATION_REMAIN_CHAR_COUNT, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_HYPHENATION_PUSH_CHAR_COUNT, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_TEXT_OVERLINE_STYLE, XML_ATACTION_REMOVE,
+ NO_PARAMS }, /* #i113645# */
+ { XML_NAMESPACE_STYLE, XML_TEXT_OVERLINE_COLOR, XML_ATACTION_REMOVE,
+ NO_PARAMS }, /* #i113645# */
+ { XML_NAMESPACE_FO, XML_WRAP_OPTION, XML_ATACTION_REMOVE,
+ NO_PARAMS }, /* #i116555# */
+
+ { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS }
+};
+
+XMLTransformerActionInit aTextPropertyOOoElemActionTable[] =
+{
+ { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS }
+};
+
+
+
+XMLTransformerActionInit aParagraphPropertyOOoAttrActionTable[] =
+{
+ { XML_NAMESPACE_FO, XML_LINE_HEIGHT, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_LINE_HEIGHT_AT_LEAST, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_LINE_SPACING, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_TEXT_ALIGN, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_TEXT_ALIGN_LAST, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_TEXT_ALIGN, XML_ATACTION_RENAME,
+ XMLTransformerActionInit::QNameParam( XML_NAMESPACE_FO, XML_TEXT_ALIGN ), 0, 0 },
+ { XML_NAMESPACE_STYLE, XML_JUSTIFY_SINGLE_WORD, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BREAK_INSIDE, XML_PTACTION_BREAK_INSIDE,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_WIDOWS, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_ORPHANS, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_TAB_STOP_DISTANCE, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_HYPHENATION_KEEP, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_HYPHENATION_LADDER_COUNT, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_REGISTER_TRUE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_TEXT_INDENT, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_AUTO_TEXT_INDENT, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BREAK_BEFORE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BREAK_AFTER, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER_TOP, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER_LEFT, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER_RIGHT, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_TOP, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_BOTTOM, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_LEFT, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_RIGHT, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_TOP, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_SHADOW, XML_ATACTION_INCHS2INS,
+ NO_PARAMS },
+ { XML_NAMESPACE_FO, XML_KEEP_WITH_NEXT, XML_PTACTION_KEEP_WITH_NEXT,
+ NO_PARAMS },
+ { XML_NAMESPACE_TEXT, XML_NUMBER_LINES, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_TEXT, XML_LINE_NUMBER, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_VERTICAL_ALIGN, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_WRITING_MODE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_DRAW, XML_WRITING_MODE, XML_ATACTION_RENAME,
+ XMLTransformerActionInit::QNameParam( XML_NAMESPACE_STYLE,
+ XML_WRITING_MODE ), 0, 0 },
+// { XML_NAMESPACE_STYLE, XML_WRITING_MODE_AUTOMATIC, XML_ATACTION_COPY,
+// NO_PARAMS }, /* new attribute */
+ { XML_NAMESPACE_STYLE, XML_SNAP_TO_LAYOUT_GRID, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_PAGE_NUMBER, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BACKGROUND_TRANSPARENCY, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_TEXT_AUTOSPACE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_PUNCTUATION_WRAP, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_LINE_BREAK, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_TEXT, XML_ENABLE_NUMBERING, XML_ATACTION_COPY,
+ NO_PARAMS }, /* TODO: undocumented*/
+ { XML_NAMESPACE_STYLE, XML_FONT_INDEPENDENT_LINE_SPACING, XML_ATACTION_COPY,
+ NO_PARAMS },
+ { XML_NAMESPACE_STYLE, XML_DEFAULT_OUTLINE_LEVEL, XML_ATACTION_REMOVE,
+ NO_PARAMS }, /* i41811: style-default-outline was exported as propery */
+ { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS }
+};
+
+XMLTransformerActionInit aParagraphPropertyOOoElemActionTable[] =
+{
+ { XML_NAMESPACE_STYLE, XML_TAB_STOPS, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_DROP_CAP, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BACKGROUND_IMAGE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS }
+};
+
+XMLTransformerActionInit aSectionPropertyOOoAttrActionTable[] =
+{
+ { XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS }
+};
+
+XMLTransformerActionInit aTablePropertyOOoAttrActionTable[] =
+{
+ { XML_NAMESPACE_STYLE, XML_WIDTH, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_KEEP_WITH_NEXT, XML_PTACTION_KEEP_WITH_NEXT,
+ NO_PARAMS },
+ { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS }
+};
+
+XMLTransformerActionInit aTableColumnPropertyOOoAttrActionTable[] =
+{
+ { XML_NAMESPACE_STYLE, XML_COLUMN_WIDTH, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS }
+};
+
+XMLTransformerActionInit aTableRowPropertyOOoAttrActionTable[] =
+{
+ { XML_NAMESPACE_STYLE, XML_ROW_HEIGHT, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_MIN_ROW_HEIGHT, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS }
+};
+
+XMLTransformerActionInit aTableCellPropertyOOoAttrActionTable[] =
+{
+ { XML_NAMESPACE_FO, XML_VERTICAL_ALIGN, XML_ATACTION_RENAME,
+ XMLTransformerActionInit::QNameParam( XML_NAMESPACE_STYLE,
+ XML_VERTICAL_ALIGN ), 0, 0 },
+ { XML_NAMESPACE_FO, XML_TEXT_ALIGN, XML_ATACTION_COPY_DUPLICATE,
+ XML_PROP_TYPE_PARAGRAPH, 0, 0 }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_TEXT_ALIGN_SOURCE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_DIRECTION, XML_ATACTION_RENAME,
+ XMLTransformerActionInit::QNameParam( XML_NAMESPACE_STYLE,
+ XML_DIRECTION), 0, 0 },
+ { XML_NAMESPACE_STYLE, XML_GLYPH_ORIENTATION_VERTICAL, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_SHADOW, XML_ATACTION_INCHS2INS,
+ NO_PARAMS },
+ { XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER_TOP, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER_LEFT, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_BORDER_RIGHT, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_TOP, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_BOTTOM, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_LEFT, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_RIGHT, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_DIAGONAL_BL_TR, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_DIAGONAL_BL_TR_WIDTH, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_DIAGONAL_TL_BR, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_DIAGONAL_TL_BR_WIDTH, XML_ATACTION_INCHS2INS,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_TOP, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_WRAP_OPTION, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_REPEAT_CONTENT, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_ROTATION_ANGLE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_ROTATION_ALIGN, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_CELL_PROTECT, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_PRINT_CONTENT, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_DECIMAL_PLACES, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS }
+};
+
+XMLTransformerActionInit aTableCellPropertyOOoElemActionTable[] =
+{
+ { XML_NAMESPACE_STYLE, XML_BACKGROUND_IMAGE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS }
+};
+
+XMLTransformerActionInit aListLevelPropertyOOoAttrActionTable[] =
+{
+ { XML_NAMESPACE_TEXT, XML_SPACE_BEFORE, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_TEXT, XML_MIN_LABEL_WIDTH, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_TEXT, XML_MIN_LABEL_DISTANCE, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_WIDTH, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_HEIGHT, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS }
+};
+
+XMLTransformerActionInit aChartPropertyOOoAttrActionTable[] =
+{
+ { XML_NAMESPACE_CHART, XML_SCALE_TEXT, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_THREE_DIMENSIONAL, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_DEEP, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+// { XML_NAMESPACE_CHART, XML_SYMBOL_TYPE, XML_ATACTION_COPY,
+// NO_PARAMS }, /* new attribute */
+// { XML_NAMESPACE_CHART, XML_SYMBOL_TYPE, XML_ATACTION_COPY,
+// NO_PARAMS }, /* new attribute */
+// { XML_NAMESPACE_CHART, XML_SYMBOL_TYPE, XML_ATACTION_COPY,
+// NO_PARAMS }, /* new attribute */
+// { XML_NAMESPACE_CHART, XML_SYMBOL_NAME, XML_ATACTION_COPY,
+// NO_PARAMS }, /* new attribute */
+// { XML_NAMESPACE_CHART, XML_SYMBOL_TYPE, XML_ATACTION_COPY,
+// NO_PARAMS }, /* new attribute */
+ { XML_NAMESPACE_XLINK, XML_HREF, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_SYMBOL_WIDTH, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_SYMBOL_HEIGHT, XML_ATACTION_INCH2IN,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_VERTICAL, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_CONNECT_BARS, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_GAP_WIDTH, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_OVERLAP, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+// { XML_NAMESPACE_CHART, XML_JAPANESE_CANDLE_STICK, XML_ATACTION_COPY,
+// NO_PARAMS }, /* TODO: renamed? */
+// { XML_NAMESPACE_CHART, XML_INTERPOLATION, XML_ATACTION_COPY,
+// NO_PARAMS }, /* TODO: renamed? */
+ { XML_NAMESPACE_CHART, XML_SPLINE_ORDER, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_SPLINE_RESOLUTION, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_PIE_OFFSET, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_LINES, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_SOLID_TYPE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_STACKED, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_PERCENTAGE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_LINK_DATA_STYLE_TO_SOURCE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_VISIBLE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_LOGARITHMIC, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_MAXIMUM, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_MINIMUM, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_ORIGIN, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_TICK_MARKS_MAJOR_INNER, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_TICK_MARKS_MAJOR_OUTER, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_TICK_MARKS_MINOR_INNER, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_TICK_MARKS_MINOR_OUTER, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_DISPLAY_LABEL, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_TEXT_OVERLAP, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_TEXT, XML_LINE_BREAK, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_LABEL_ARRANGEMENT, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_DIRECTION, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_STYLE, XML_ROTATION_ANGLE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_DATA_LABEL_NUMBER, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_DATA_LABEL_TEXT, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_DATA_LABEL_SYMBOL, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_MEAN_VALUE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_ERROR_CATEGORY, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_ERROR_PERCENTAGE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_ERROR_MARGIN, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_ERROR_LOWER_LIMIT, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_ERROR_UPPER_LIMIT, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_ERROR_UPPER_INDICATOR, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_ERROR_LOWER_INDICATOR, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_SERIES_SOURCE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_CHART, XML_REGRESSION_TYPE, XML_ATACTION_COPY,
+ NO_PARAMS }, /* generated entry */
+ { XML_NAMESPACE_FO, XML_DIRECTION, XML_ATACTION_RENAME,
+ XMLTransformerActionInit::QNameParam( XML_NAMESPACE_STYLE,
+ XML_DIRECTION ), 0, 0 },
+ { XML_NAMESPACE_CHART, XML_SPLINES, XML_PTACTION_SPLINES, NO_PARAMS },
+ { XML_NAMESPACE_TEXT, XML_ROTATION_ANGLE, XML_ATACTION_RENAME,
+ XMLTransformerActionInit::QNameParam( XML_NAMESPACE_STYLE,
+ XML_ROTATION_ANGLE ), 0, 0 },
+ { XML_NAMESPACE_CHART, XML_INTERVAL_MAJOR, XML_PTACTION_INTERVAL_MAJOR, NO_PARAMS },
+ { XML_NAMESPACE_CHART, XML_INTERVAL_MINOR, XML_PTACTION_INTERVAL_MINOR, NO_PARAMS },
+
+ { XML_NAMESPACE_CHART, XML_STOCK_UPDOWN_BARS, XML_ATACTION_RENAME,
+ XMLTransformerActionInit::QNameParam( XML_NAMESPACE_CHART,
+ XML_JAPANESE_CANDLE_STICK ), 0, 0 },
+ { XML_NAMESPACE_CHART, XML_SYMBOL, XML_PTACTION_SYMBOL, NO_PARAMS },
+
+ // note: chart:symbol-image-name was only used before 6.0 beta
+ { XML_NAMESPACE_CHART, XML_SYMBOL_IMAGE_NAME, XML_PTACTION_SYMBOL_IMAGE_NAME, NO_PARAMS },
+
+ // #i32368# property should no longer be used as XML-property (in OASIS
+ // format), but is still ex-/imported for compatibility with the OOo file format
+ { XML_NAMESPACE_CHART, XML_LINES_USED, XML_ATACTION_COPY, NO_PARAMS },
+ // #i32366# property should no longer be used as XML-property (in OASIS
+ // format), but is still ex-/imported for compatibility with the OOo file format
+ { XML_NAMESPACE_CHART, XML_STOCK_WITH_VOLUME, XML_ATACTION_COPY, NO_PARAMS },
+
+ { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS }
+};
+
+XMLTransformerActionInit aChartPropertyOOoElemActionTable[] =
+{
+ { XML_NAMESPACE_STYLE, XML_SYMBOL_IMAGE, XML_ATACTION_COPY, NO_PARAMS },
+ { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/PropertyActionsOOo.hxx b/xmloff/source/transform/PropertyActionsOOo.hxx
new file mode 100644
index 000000000000..2344758baa41
--- /dev/null
+++ b/xmloff/source/transform/PropertyActionsOOo.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_PROPERTYACTIONSOOO_HXX
+#define _XMLOFF_PROPERTYACTIONSOOO_HXX
+
+#include "TransformerAction.hxx"
+#include "TransformerActionInit.hxx"
+#include "AttrTransformerAction.hxx"
+
+enum XMLPropOOOTransformerAction
+{
+ XML_PTACTION_LINE_MODE=XML_ATACTION_USER_DEFINED,
+ XML_PTACTION_UNDERLINE,
+ XML_PTACTION_LINETHROUGH,
+ XML_PTACTION_KEEP_WITH_NEXT,
+ XML_PTACTION_SPLINES,
+ XML_ATACTION_INCH2IN_DUPLICATE,
+ XML_PTACTION_INTERVAL_MAJOR,
+ XML_PTACTION_INTERVAL_MINOR,
+ XML_ATACTION_COPY_DUPLICATE,
+ XML_PTACTION_SYMBOL,
+ XML_PTACTION_SYMBOL_IMAGE_NAME,
+ XML_PTACTION_TRANSPARENCY,
+ XML_PTACTION_BREAK_INSIDE,
+ XML_ATACTION_CAPTION_ESCAPE_OOO,
+ XML_ATACTION_MOVE_PROTECT,
+ XML_ATACTION_SIZE_PROTECT,
+ XML_ATACTION_PROTECT,
+ // No image transparancy info in lable document (#i50322#)
+ XML_ATACTION_WRITER_BACK_GRAPHIC_TRANSPARENCY,
+ XML_PTACTION_END=XML_TACTION_END
+};
+
+extern XMLTransformerActionInit aGraphicPropertyOOoAttrActionTable[];
+extern XMLTransformerActionInit aGraphicPropertyOOoElemActionTable[];
+extern XMLTransformerActionInit aDrawingPagePropertyOOoAttrActionTable[];
+extern XMLTransformerActionInit aPageLayoutPropertyOOoAttrActionTable[];
+extern XMLTransformerActionInit aHeaderFooterPropertyOOoAttrActionTable[];
+extern XMLTransformerActionInit aTextPropertyOOoAttrActionTable[];
+extern XMLTransformerActionInit aTextPropertyOOoElemActionTable[];
+extern XMLTransformerActionInit aParagraphPropertyOOoAttrActionTable[];
+extern XMLTransformerActionInit aParagraphPropertyOOoElemActionTable[];
+extern XMLTransformerActionInit aSectionPropertyOOoAttrActionTable[];
+extern XMLTransformerActionInit aTablePropertyOOoAttrActionTable[];
+extern XMLTransformerActionInit aTableColumnPropertyOOoAttrActionTable[];
+extern XMLTransformerActionInit aTableRowPropertyOOoAttrActionTable[];
+extern XMLTransformerActionInit aTableCellPropertyOOoAttrActionTable[];
+extern XMLTransformerActionInit aTableCellPropertyOOoElemActionTable[];
+extern XMLTransformerActionInit aListLevelPropertyOOoAttrActionTable[];
+extern XMLTransformerActionInit aChartPropertyOOoAttrActionTable[];
+extern XMLTransformerActionInit aChartPropertyOOoElemActionTable[];
+
+#endif // _XMLOFF_PROPERTYACTIONSOOO_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/RenameElemTContext.cxx b/xmloff/source/transform/RenameElemTContext.cxx
new file mode 100644
index 000000000000..5acc314c72aa
--- /dev/null
+++ b/xmloff/source/transform/RenameElemTContext.cxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "RenameElemTContext.hxx"
+#include "MutableAttrList.hxx"
+#include "TransformerBase.hxx"
+#include <xmloff/nmspmap.hxx>
+
+using ::rtl::OUString;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+
+TYPEINIT1( XMLRenameElemTransformerContext, XMLTransformerContext );
+
+XMLRenameElemTransformerContext::XMLRenameElemTransformerContext(
+ XMLTransformerBase& rImp,
+ const OUString& rQName,
+ sal_uInt16 nPrefix,
+ ::xmloff::token::XMLTokenEnum eToken ) :
+ XMLTransformerContext( rImp, rQName ),
+ m_aElemQName( rImp.GetNamespaceMap().GetQNameByKey( nPrefix,
+ ::xmloff::token::GetXMLToken( eToken ) ) )
+{
+}
+
+XMLRenameElemTransformerContext::XMLRenameElemTransformerContext(
+ XMLTransformerBase& rImp,
+ const OUString& rQName,
+ sal_uInt16 nPrefix,
+ ::xmloff::token::XMLTokenEnum eToken,
+ sal_uInt16 nAPrefix,
+ ::xmloff::token::XMLTokenEnum eAToken,
+ ::xmloff::token::XMLTokenEnum eVToken ) :
+ XMLTransformerContext( rImp, rQName ),
+ m_aElemQName( rImp.GetNamespaceMap().GetQNameByKey( nPrefix,
+ ::xmloff::token::GetXMLToken( eToken ) ) ),
+ m_aAttrQName( rImp.GetNamespaceMap().GetQNameByKey( nAPrefix,
+ ::xmloff::token::GetXMLToken( eAToken ) ) ),
+ m_aAttrValue( ::xmloff::token::GetXMLToken( eVToken ) )
+{
+}
+
+XMLRenameElemTransformerContext::~XMLRenameElemTransformerContext()
+{
+}
+
+void XMLRenameElemTransformerContext::StartElement(
+ const Reference< XAttributeList >& rAttrList )
+{
+ Reference< XAttributeList > xAttrList( rAttrList );
+ if( m_aAttrQName.getLength() )
+ {
+ XMLMutableAttributeList *pMutableAttrList =
+ new XMLMutableAttributeList( xAttrList );
+ xAttrList = pMutableAttrList;
+ pMutableAttrList->AddAttribute( m_aAttrQName, m_aAttrValue );
+ }
+ GetTransformer().GetDocHandler()->startElement( m_aElemQName, xAttrList );
+}
+
+void XMLRenameElemTransformerContext::EndElement()
+{
+ GetTransformer().GetDocHandler()->endElement( m_aElemQName );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/RenameElemTContext.hxx b/xmloff/source/transform/RenameElemTContext.hxx
new file mode 100644
index 000000000000..c73ff8b6dd09
--- /dev/null
+++ b/xmloff/source/transform/RenameElemTContext.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_RENAMEELEMTCONTEXT_HXX
+#define _XMLOFF_RENAMEELEMTCONTEXT_HXX
+
+#include <xmloff/xmltoken.hxx>
+#include "TransformerContext.hxx"
+
+
+class XMLRenameElemTransformerContext : public XMLTransformerContext
+{
+ ::rtl::OUString m_aElemQName;
+ ::rtl::OUString m_aAttrQName;
+ ::rtl::OUString m_aAttrValue;
+
+public:
+ TYPEINFO();
+
+ // The following consutructor renames the element names "rQName"
+ // to bPrefix/eToken
+ XMLRenameElemTransformerContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName,
+ sal_uInt16 nPrefix,
+ ::xmloff::token::XMLTokenEnum eToken );
+
+ // The following consutructor renames the element names "rQName"
+ // to bPrefix/eToken and adds an attribute nAPrefix/eAToken that has
+ // the value eVToken.
+ XMLRenameElemTransformerContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName,
+ sal_uInt16 nPrefix,
+ ::xmloff::token::XMLTokenEnum eToken,
+ sal_uInt16 nAPrefix,
+ ::xmloff::token::XMLTokenEnum eAToken,
+ ::xmloff::token::XMLTokenEnum eVToken );
+
+ // A contexts destructor does anything that is required if an element
+ // ends. By default, nothing is done.
+ // Note that virtual methods cannot be used inside destructors. Use
+ // EndElement instead if this is required.
+ virtual ~XMLRenameElemTransformerContext();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+};
+
+#endif // _XMLOFF_RENAMEELEMCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/StyleOASISTContext.cxx b/xmloff/source/transform/StyleOASISTContext.cxx
new file mode 100644
index 000000000000..f28ad09234b2
--- /dev/null
+++ b/xmloff/source/transform/StyleOASISTContext.cxx
@@ -0,0 +1,1014 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/xml/sax/SAXParseException.hpp>
+#include <com/sun/star/xml/sax/SAXException.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <rtl/ustrbuf.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include "PropType.hxx"
+#include "DeepTContext.hxx"
+#include "ProcAttrTContext.hxx"
+#include "TransformerBase.hxx"
+#include "TransformerActions.hxx"
+#include "ActionMapTypesOASIS.hxx"
+#include "MutableAttrList.hxx"
+#include "PropertyActionsOASIS.hxx"
+#include "StyleOASISTContext.hxx"
+#include <xmloff/xmluconv.hxx>
+#include <rtl/ustrbuf.hxx>
+
+using ::rtl::OUString;
+using namespace ::xmloff::token;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+//------------------------------------------------------------------------------
+
+static sal_uInt16 aAttrActionMaps[XML_PROP_TYPE_END] =
+{
+ PROP_OASIS_GRAPHIC_ATTR_ACTIONS,
+ PROP_OASIS_DRAWING_PAGE_ATTR_ACTIONS, // DRAWING_PAGE
+ PROP_OASIS_PAGE_LAYOUT_ATTR_ACTIONS,
+ PROP_OASIS_HEADER_FOOTER_ATTR_ACTIONS,
+ PROP_OASIS_TEXT_ATTR_ACTIONS,
+ PROP_OASIS_PARAGRAPH_ATTR_ACTIONS,
+ MAX_OASIS_PROP_ACTIONS, // RUBY
+ PROP_OASIS_SECTION_ATTR_ACTIONS,
+ PROP_OASIS_TABLE_ATTR_ACTIONS,
+ PROP_OASIS_TABLE_COLUMN_ATTR_ACTIONS,
+ PROP_OASIS_TABLE_ROW_ATTR_ACTIONS,
+ PROP_OASIS_TABLE_CELL_ATTR_ACTIONS,
+ PROP_OASIS_LIST_LEVEL_ATTR_ACTIONS,
+ PROP_OASIS_CHART_ATTR_ACTIONS
+};
+
+//------------------------------------------------------------------------------
+
+class XMLPropertiesTContext_Impl : public XMLPersElemContentTContext
+{
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > m_xAttrList;
+
+ XMLPropType m_ePropType;
+ sal_Bool m_bControlStyle;
+ ::rtl::OUString m_aStyleFamily;
+
+public:
+
+ void SetQNameAndPropType( const ::rtl::OUString& rQName,
+ XMLPropType ePropType )
+ {
+ m_ePropType = ePropType;
+ XMLTransformerContext::SetQName( rQName );
+ };
+
+ TYPEINFO();
+
+ XMLPropertiesTContext_Impl( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName,
+ XMLPropType eP,
+ const ::rtl::OUString& rStyleFamily,
+ sal_Bool _bControlStyle = sal_False );
+
+ virtual ~XMLPropertiesTContext_Impl();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void Export();
+
+ static XMLPropType GetPropType( const OUString& rLocalName );
+
+ static OUString MergeUnderline( XMLTokenEnum eUnderline,
+ sal_Bool bBold, sal_Bool bDouble );
+ static OUString MergeLineThrough( XMLTokenEnum eLineThrough,
+ sal_Bool bBold, sal_Bool bDouble,
+ sal_Unicode c );
+};
+
+TYPEINIT1( XMLPropertiesTContext_Impl, XMLPersElemContentTContext );
+
+XMLPropertiesTContext_Impl::XMLPropertiesTContext_Impl(
+ XMLTransformerBase& rImp, const OUString& rQName, XMLPropType eP,
+ const ::rtl::OUString& rStyleFamily, sal_Bool _bControlStyle ) :
+ XMLPersElemContentTContext( rImp, rQName, XML_NAMESPACE_STYLE,
+ XML_PROPERTIES),
+ m_ePropType( eP ),
+ m_bControlStyle( _bControlStyle ),
+ m_aStyleFamily( rStyleFamily )
+{
+}
+
+XMLPropertiesTContext_Impl::~XMLPropertiesTContext_Impl()
+{
+}
+
+void XMLPropertiesTContext_Impl::StartElement(
+ const Reference< XAttributeList >& rAttrList )
+{
+ XMLTransformerActions *pActions = 0;
+ sal_uInt16 nActionMap = aAttrActionMaps[m_ePropType];
+ if( nActionMap < MAX_OASIS_PROP_ACTIONS )
+ {
+ pActions = GetTransformer().GetUserDefinedActions( nActionMap );
+ OSL_ENSURE( pActions, "go no actions" );
+ }
+
+ if( pActions )
+ {
+ XMLMutableAttributeList *pAttrList = 0;
+ if( !m_xAttrList.is() )
+ {
+ pAttrList = new XMLMutableAttributeList();
+ m_xAttrList = pAttrList;
+ }
+ else
+ {
+ pAttrList =
+ static_cast< XMLMutableAttributeList * >( m_xAttrList.get() );
+ }
+
+ XMLTokenEnum eUnderline = XML_TOKEN_END;
+ sal_Bool bBoldUnderline = sal_False, bDoubleUnderline = sal_False;
+ XMLTokenEnum eLineThrough = XML_TOKEN_END;
+ sal_Bool bBoldLineThrough = sal_False, bDoubleLineThrough = sal_False;
+ sal_Unicode cLineThroughChar = 0;
+
+ bool bIntervalMinorFound = false;
+ double fIntervalMajor = 0.0;
+ sal_Int32 nIntervalMinorDivisor = 0;
+
+ // #i25616#
+ OUString aOpacityValueRemember;
+ OUString aImageOpacityValueRemember;
+
+ sal_Int16 nAttrCount = rAttrList.is() ? rAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = rAttrList->getNameByIndex( i );
+ const OUString& rAttrValue = rAttrList->getValueByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+
+ XMLTransformerActions::key_type aKey( nPrefix, aLocalName );
+ XMLTransformerActions::const_iterator aIter =
+ pActions->find( aKey );
+ if( !(aIter == pActions->end() ) )
+ {
+ switch( (*aIter).second.m_nActionType )
+ {
+ case XML_ATACTION_REMOVE:
+ break;
+ case XML_ATACTION_COPY:
+ pAttrList->AddAttribute( rAttrName, rAttrValue );
+ break;
+ case XML_ATACTION_RENAME:
+ {
+ OUString aNewAttrQName(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ (*aIter).second.GetQNamePrefixFromParam1(),
+ ::xmloff::token::GetXMLToken(
+ (*aIter).second.GetQNameTokenFromParam1()) ) );
+ pAttrList->AddAttribute( aNewAttrQName, rAttrValue );
+ }
+ break;
+ case XML_ATACTION_IN2INCH:
+ {
+ OUString aAttrValue( rAttrValue );
+ XMLTransformerBase::ReplaceSingleInWithInch(
+ aAttrValue );
+ pAttrList->AddAttribute( rAttrName, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_INS2INCHS:
+ {
+ OUString aAttrValue( rAttrValue );
+ XMLTransformerBase::ReplaceInWithInch(
+ aAttrValue );
+ pAttrList->AddAttribute( rAttrName, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_DECODE_STYLE_NAME_REF:
+ {
+ OUString aAttrValue( rAttrValue );
+ GetTransformer().DecodeStyleName(aAttrValue);
+ pAttrList->AddAttribute( rAttrName, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_RENAME_DECODE_STYLE_NAME_REF:
+ {
+ OUString aNewAttrQName(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ (*aIter).second.GetQNamePrefixFromParam1(),
+ ::xmloff::token::GetXMLToken(
+ (*aIter).second.GetQNameTokenFromParam1()) ) );
+ OUString aAttrValue( rAttrValue );
+ GetTransformer().DecodeStyleName(aAttrValue);
+ pAttrList->AddAttribute( aNewAttrQName, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_NEG_PERCENT:
+ {
+ OUString aAttrValue( rAttrValue );
+ GetTransformer().NegPercent(aAttrValue);
+ pAttrList->AddAttribute( rAttrName, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_RENAME_NEG_PERCENT:
+ {
+ OUString aNewAttrQName(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ (*aIter).second.GetQNamePrefixFromParam1(),
+ ::xmloff::token::GetXMLToken(
+ (*aIter).second.GetQNameTokenFromParam1()) ) );
+ OUString aAttrValue( rAttrValue );
+ GetTransformer().NegPercent(aAttrValue);
+ pAttrList->AddAttribute( aNewAttrQName, aAttrValue );
+ }
+ break;
+ case XML_OPTACTION_LINE_MODE:
+ {
+ sal_Bool bWordMode =
+ IsXMLToken( rAttrValue, XML_SKIP_WHITE_SPACE );
+ OUString aAttrQName(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_FO,
+ GetXMLToken( XML_SCORE_SPACES ) ) );
+ sal_Int16 nIndex =
+ pAttrList->GetIndexByName( aAttrQName );
+ if( -1 != nIndex )
+ {
+ if( bWordMode )
+ {
+ const OUString& rOldValue =
+ pAttrList->getValueByIndex( nIndex );
+ if( !IsXMLToken( rOldValue, XML_TRUE ) )
+ {
+ pAttrList->SetValueByIndex( nIndex,
+ GetXMLToken( XML_TRUE ) );
+ }
+ }
+ }
+ else
+ {
+ OUString aAttrValue( GetXMLToken( bWordMode
+ ? XML_FALSE
+ : XML_TRUE ) );
+ pAttrList->AddAttribute( aAttrQName, aAttrValue );
+ }
+ }
+ break;
+ case XML_OPTACTION_KEEP_WITH_NEXT:
+ {
+ OUString aAttrValue( GetXMLToken(
+ IsXMLToken( rAttrValue, XML_ALWAYS )
+ ? XML_TRUE
+ : XML_FALSE) );
+ pAttrList->AddAttribute( rAttrName, aAttrValue );
+ }
+ break;
+ case XML_OPTACTION_UNDERLINE_WIDTH:
+ if( IsXMLToken( rAttrValue, XML_BOLD ) )
+ bBoldUnderline = sal_True;
+ break;
+ case XML_OPTACTION_UNDERLINE_TYPE:
+ if( IsXMLToken( rAttrValue, XML_DOUBLE ) )
+ bDoubleUnderline = sal_True;
+ break;
+ case XML_OPTACTION_UNDERLINE_STYLE:
+ eUnderline = GetTransformer().GetToken( rAttrValue );
+ break;
+ case XML_OPTACTION_LINETHROUGH_WIDTH:
+ if( IsXMLToken( rAttrValue, XML_BOLD ) )
+ bBoldLineThrough = sal_True;
+ break;
+ case XML_OPTACTION_LINETHROUGH_TYPE:
+ if( IsXMLToken( rAttrValue, XML_DOUBLE ) )
+ bDoubleLineThrough = sal_True;
+ break;
+ case XML_OPTACTION_LINETHROUGH_STYLE:
+ eLineThrough = GetTransformer().GetToken( rAttrValue );
+ break;
+ case XML_OPTACTION_LINETHROUGH_TEXT:
+ if( rAttrValue.getLength() )
+ cLineThroughChar = rAttrValue[0];
+ break;
+ case XML_OPTACTION_INTERPOLATION:
+ {
+ // 0: none
+ sal_Int32 nSplineType = 0;
+ if( IsXMLToken( rAttrValue, XML_CUBIC_SPLINE ))
+ nSplineType = 1;
+ else if( IsXMLToken( rAttrValue, XML_B_SPLINE ))
+ nSplineType = 2;
+
+ pAttrList->AddAttribute(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_CHART,
+ GetXMLToken( XML_SPLINES )),
+ OUString::valueOf( nSplineType ));
+ }
+ break;
+ case XML_OPTACTION_INTERVAL_MAJOR:
+ pAttrList->AddAttribute( rAttrName, rAttrValue );
+ SvXMLUnitConverter::convertDouble( fIntervalMajor, rAttrValue );
+ break;
+ case XML_OPTACTION_INTERVAL_MINOR_DIVISOR:
+ SvXMLUnitConverter::convertNumber( nIntervalMinorDivisor, rAttrValue );
+ bIntervalMinorFound = true;
+ break;
+ case XML_OPTACTION_SYMBOL_TYPE:
+ {
+ // if symbol_type is "named-symbol" the "symbol"
+ // property is set in the action XML_OPTACTION_SYMBOL_NAME
+ sal_Int32 nSymbolType = 0;
+ if( IsXMLToken( rAttrValue, XML_NONE ))
+ nSymbolType = -3;
+ else if( IsXMLToken( rAttrValue, XML_AUTOMATIC ))
+ nSymbolType = -2;
+ else if( IsXMLToken( rAttrValue, XML_IMAGE ))
+ nSymbolType = -1;
+
+ if( nSymbolType < 0 )
+ pAttrList->AddAttribute(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_CHART,
+ GetXMLToken( XML_SYMBOL )),
+ OUString::valueOf( nSymbolType ));
+ }
+ break;
+ case XML_OPTACTION_SYMBOL_NAME:
+ {
+ // assume "symbol-type" == "named-symbol"
+ sal_Int32 nSymbolType = -3; // NONE
+ // "square" just has an awkward token-name
+ if( IsXMLToken( rAttrValue, XML_GRADIENTSTYLE_SQUARE ))
+ nSymbolType = 0;
+ else if( IsXMLToken( rAttrValue, XML_DIAMOND ))
+ nSymbolType = 1;
+ else if( IsXMLToken( rAttrValue, XML_ARROW_DOWN ))
+ nSymbolType = 2;
+ else if( IsXMLToken( rAttrValue, XML_ARROW_UP ))
+ nSymbolType = 3;
+ else if( IsXMLToken( rAttrValue, XML_ARROW_RIGHT ))
+ nSymbolType = 4;
+ else if( IsXMLToken( rAttrValue, XML_ARROW_LEFT ))
+ nSymbolType = 5;
+ else if( IsXMLToken( rAttrValue, XML_BOW_TIE ))
+ nSymbolType = 6;
+ else if( IsXMLToken( rAttrValue, XML_HOURGLASS ))
+ nSymbolType = 7;
+
+ if( nSymbolType >= 0 )
+ pAttrList->AddAttribute(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_CHART,
+ GetXMLToken( XML_SYMBOL )),
+ OUString::valueOf( nSymbolType ));
+ }
+ break;
+ // #i25616#
+ case XML_OPTACTION_OPACITY:
+ aOpacityValueRemember = rAttrValue;
+ GetTransformer().NegPercent(aOpacityValueRemember);
+ break;
+
+ // #i25616#
+ case XML_OPTACTION_IMAGE_OPACITY:
+ aImageOpacityValueRemember = rAttrValue;
+ GetTransformer().NegPercent(aImageOpacityValueRemember);
+ break;
+
+ case XML_OPTACTION_KEEP_TOGETHER:
+ pAttrList->AddAttribute(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_STYLE,GetXMLToken(XML_BREAK_INSIDE)),
+ GetXMLToken(
+ IsXMLToken( rAttrValue, XML_ALWAYS )
+ ? XML_COLUMNSPLIT_AVOID
+ : XML_COLUMNSPLIT_AUTO ) );
+ break;
+
+ case XML_OPTACTION_CONTROL_TEXT_ALIGN:
+ if ( m_bControlStyle )
+ {
+ OUString aNewAttrQName(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_STYLE,
+ ::xmloff::token::GetXMLToken(
+ XML_TEXT_ALIGN ) ) );
+ pAttrList->AddAttribute( aNewAttrQName, rAttrValue );
+ }
+ else
+ {
+ OUString aNewAttrQName(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_FO,
+ ::xmloff::token::GetXMLToken(
+ XML_TEXT_ALIGN ) ) );
+ pAttrList->AddAttribute( aNewAttrQName, rAttrValue );
+ }
+ break;
+
+ case XML_OPTACTION_DRAW_WRITING_MODE:
+ if( IsXMLToken( m_aStyleFamily, XML_GRAPHICS ) )
+ {
+ pAttrList->AddAttribute(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_DRAW,
+ GetXMLToken( XML_WRITING_MODE ) ), rAttrValue );
+ }
+ pAttrList->AddAttribute( rAttrName, rAttrValue );
+ break;
+
+ case XML_ATACTION_CAPTION_ESCAPE_OASIS:
+ {
+ OUString aAttrValue( rAttrValue );
+ if( aAttrValue.indexOf( sal_Unicode('%') ) != -1 )
+ {
+ sal_Int32 nValue = 0;
+ SvXMLUnitConverter::convertPercent( nValue, rAttrValue );
+ if( nValue )
+ {
+ nValue *= 100;
+ rtl::OUStringBuffer aOut;
+ SvXMLUnitConverter::convertPercent( aOut, nValue );
+ aAttrValue = aOut.makeStringAndClear();
+ }
+ }
+ else
+ {
+ XMLTransformerBase::ReplaceSingleInWithInch( aAttrValue );
+ }
+
+ pAttrList->AddAttribute( rAttrName, aAttrValue );
+ }
+ break;
+
+ case XML_ATACTION_DECODE_PROTECT:
+ {
+ pAttrList->AddAttribute( rAttrName, rAttrValue );
+
+ if( rAttrValue.indexOf( GetXMLToken( XML_SIZE ) ) != -1 )
+ pAttrList->AddAttribute( GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_DRAW,
+ GetXMLToken( XML_SIZE_PROTECT )), GetXMLToken( XML_TRUE ) );
+
+ if( rAttrValue.indexOf( GetXMLToken( XML_POSITION ) ) != -1 )
+ pAttrList->AddAttribute( GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_DRAW,
+ GetXMLToken( XML_MOVE_PROTECT )), GetXMLToken( XML_TRUE ) );
+ }
+ break;
+
+ case XML_ATACTION_DRAW_MIRROR_OASIS: // renames style:mirror to draw:mirror and adapts values
+ {
+ // keep original for writer graphic objects
+ // Adapts attribute values (#i49139#)
+ OUString aNewAttrValue;
+ SvXMLTokenEnumerator aTokenEnum( rAttrValue );
+ OUString aToken;
+ while( aTokenEnum.getNextToken( aToken ) )
+ {
+ if ( aNewAttrValue.getLength() > 0 )
+ {
+ aNewAttrValue += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( " " ));
+ }
+
+ if ( IsXMLToken( aToken, XML_HORIZONTAL_ON_EVEN ) )
+ {
+ aNewAttrValue += GetXMLToken( XML_HORIZONTAL_ON_LEFT_PAGES );
+ }
+ else if ( IsXMLToken( aToken, XML_HORIZONTAL_ON_ODD ) )
+ {
+ aNewAttrValue += GetXMLToken( XML_HORIZONTAL_ON_RIGHT_PAGES );
+ }
+ else
+ {
+ aNewAttrValue += aToken;
+ }
+ }
+ pAttrList->AddAttribute( rAttrName, aNewAttrValue );
+ // <--
+
+ // create old draw:mirror for drawing graphic objects
+ OUString aAttrValue( GetXMLToken( IsXMLToken( rAttrValue, XML_HORIZONTAL ) ? XML_TRUE : XML_FALSE ) );
+ pAttrList->AddAttribute( GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_DRAW,
+ GetXMLToken( XML_MIRROR )), aAttrValue );
+ }
+ break;
+ case XML_ATACTION_GAMMA_OASIS: // converts percentage value to double
+ {
+ sal_Int32 nValue;
+ SvXMLUnitConverter::convertPercent( nValue, rAttrValue );
+ const double fValue = ((double)nValue) / 100.0;
+ pAttrList->AddAttribute( rAttrName, OUString::valueOf( fValue ) );
+ }
+ break;
+ case XML_ATACTION_OPACITY_FIX:
+ {
+ sal_Int32 nValue;
+ if( rAttrValue.indexOf( sal_Unicode('%') ) != -1 )
+ {
+ SvXMLUnitConverter::convertPercent( nValue, rAttrValue );
+ }
+ else
+ {
+ nValue = sal_Int32( rAttrValue.toDouble() * 100.0 );
+ }
+ nValue = 100 - nValue;
+
+ rtl::OUStringBuffer aOut;
+ SvXMLUnitConverter::convertPercent( aOut, nValue );
+ pAttrList->AddAttribute( rAttrName, aOut.makeStringAndClear() );
+ }
+ break;
+ default:
+ OSL_ENSURE( !this, "unknown action" );
+ break;
+ }
+ }
+ else
+ {
+ pAttrList->AddAttribute( rAttrName, rAttrValue );
+ }
+ }
+ if( XML_TOKEN_END != eUnderline )
+ pAttrList->AddAttribute(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_STYLE,
+ GetXMLToken( XML_TEXT_UNDERLINE ) ),
+ MergeUnderline( eUnderline, bBoldUnderline,
+ bDoubleUnderline ) );
+ if( XML_TOKEN_END != eLineThrough )
+ pAttrList->AddAttribute(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_STYLE,
+ GetXMLToken( XML_TEXT_CROSSING_OUT ) ),
+ MergeLineThrough( eLineThrough, bBoldLineThrough,
+ bDoubleLineThrough, cLineThroughChar ) );
+ if( bIntervalMinorFound )
+ {
+ double fIntervalMinor = 0.0;
+ if( nIntervalMinorDivisor != 0)
+ fIntervalMinor = fIntervalMajor / static_cast< double >( nIntervalMinorDivisor );
+
+ ::rtl::OUStringBuffer aBuf;
+ SvXMLUnitConverter::convertDouble( aBuf, fIntervalMinor );
+ pAttrList->AddAttribute(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_CHART,
+ GetXMLToken( XML_INTERVAL_MINOR )),
+ aBuf.makeStringAndClear());
+ }
+
+ // #i25616#
+ if(aOpacityValueRemember.getLength() || aImageOpacityValueRemember.getLength())
+ {
+ pAttrList->AddAttribute(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_DRAW,
+ GetXMLToken( XML_TRANSPARENCY ) ),
+ aImageOpacityValueRemember.getLength()
+ ? aImageOpacityValueRemember : aOpacityValueRemember );
+ }
+ }
+ else
+ {
+ if( !m_xAttrList.is() )
+ {
+ m_xAttrList = new XMLMutableAttributeList( rAttrList, sal_True );
+ }
+ else
+ {
+ static_cast< XMLMutableAttributeList * >( m_xAttrList.get() )
+ ->AppendAttributeList( rAttrList );
+ }
+ }
+}
+
+void XMLPropertiesTContext_Impl::Export()
+{
+ OUString aNewQName( GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_STYLE,
+ ::xmloff::token::GetXMLToken( XML_PROPERTIES ) ) );
+ GetTransformer().GetDocHandler()->startElement( GetExportQName(),
+ m_xAttrList );
+ ExportContent();
+ GetTransformer().GetDocHandler()->endElement( GetExportQName() );
+}
+
+XMLPropType XMLPropertiesTContext_Impl::GetPropType( const OUString& rLocalName )
+{
+ XMLPropType eProp = XML_PROP_TYPE_END;
+ if( IsXMLToken( rLocalName, XML_GRAPHIC_PROPERTIES ) )
+ eProp = XML_PROP_TYPE_GRAPHIC;
+ else if( IsXMLToken( rLocalName, XML_DRAWING_PAGE_PROPERTIES ) )
+ eProp = XML_PROP_TYPE_DRAWING_PAGE;
+ else if( IsXMLToken( rLocalName, XML_PAGE_LAYOUT_PROPERTIES ) )
+ eProp = XML_PROP_TYPE_PAGE_LAYOUT;
+ else if( IsXMLToken( rLocalName, XML_HEADER_FOOTER_PROPERTIES ) )
+ eProp = XML_PROP_TYPE_HEADER_FOOTER;
+ else if( IsXMLToken( rLocalName, XML_TEXT_PROPERTIES ) )
+ eProp = XML_PROP_TYPE_TEXT;
+ else if( IsXMLToken( rLocalName, XML_PARAGRAPH_PROPERTIES ) )
+ eProp = XML_PROP_TYPE_PARAGRAPH;
+ else if( IsXMLToken( rLocalName, XML_RUBY_PROPERTIES ) )
+ eProp = XML_PROP_TYPE_RUBY;
+ else if( IsXMLToken( rLocalName, XML_SECTION_PROPERTIES ) )
+ eProp = XML_PROP_TYPE_SECTION;
+ else if( IsXMLToken( rLocalName, XML_TABLE_PROPERTIES ) )
+ eProp = XML_PROP_TYPE_TABLE;
+ else if( IsXMLToken( rLocalName, XML_TABLE_COLUMN_PROPERTIES ) )
+ eProp = XML_PROP_TYPE_TABLE_COLUMN;
+ else if( IsXMLToken( rLocalName, XML_TABLE_ROW_PROPERTIES ) )
+ eProp = XML_PROP_TYPE_TABLE_ROW;
+ else if( IsXMLToken( rLocalName, XML_TABLE_CELL_PROPERTIES ) )
+ eProp = XML_PROP_TYPE_TABLE_CELL;
+ else if( IsXMLToken( rLocalName, XML_LIST_LEVEL_PROPERTIES ) )
+ eProp = XML_PROP_TYPE_LIST_LEVEL;
+ else if( IsXMLToken( rLocalName, XML_CHART_PROPERTIES ) )
+ eProp = XML_PROP_TYPE_CHART;
+
+ return eProp;
+}
+
+OUString XMLPropertiesTContext_Impl::MergeUnderline(
+ XMLTokenEnum eUnderline, sal_Bool bBold, sal_Bool bDouble )
+{
+ if( bDouble )
+ {
+ switch( eUnderline )
+ {
+ case XML_WAVE:
+ eUnderline = XML_DOUBLE_WAVE;
+ break;
+ default:
+ eUnderline = XML_DOUBLE;
+ break;
+ }
+ }
+ else if( bBold )
+ {
+ switch( eUnderline )
+ {
+ case XML_NONE:
+ case XML_SOLID:
+ eUnderline = XML_BOLD;
+ break;
+ case XML_DOTTED:
+ eUnderline = XML_BOLD_DOTTED;
+ break;
+ case XML_DASH:
+ eUnderline = XML_BOLD_DASH;
+ break;
+ case XML_LONG_DASH:
+ eUnderline = XML_BOLD_LONG_DASH;
+ break;
+ case XML_DOT_DASH:
+ eUnderline = XML_BOLD_DOT_DASH;
+ break;
+ case XML_DOT_DOT_DASH:
+ eUnderline = XML_BOLD_DOT_DOT_DASH;
+ break;
+ case XML_WAVE:
+ eUnderline = XML_BOLD_WAVE;
+ break;
+ default:
+ OSL_FAIL( "xmloff::XMLPropertiesTContext_Impl::MergeUnderline(), missing underline case!" );
+ break;
+ }
+ }
+ else
+ {
+ switch( eUnderline )
+ {
+ case XML_SOLID:
+ eUnderline = XML_SINGLE;
+ break;
+ case XML_NONE:
+ eUnderline = XML_NONE;
+ break;
+ default:
+ OSL_FAIL( "xmloff::XMLPropertiesTContext_Impl::MergeUnderline(), missing underline case!" );
+ break;
+ }
+ }
+
+ return GetXMLToken( eUnderline );
+}
+
+OUString XMLPropertiesTContext_Impl::MergeLineThrough(
+ XMLTokenEnum eLineThrough, sal_Bool bBold, sal_Bool bDouble,
+ sal_Unicode c )
+{
+ if( c )
+ eLineThrough = c=='/' ? XML_SLASH : XML_uX;
+ else if( bDouble )
+ eLineThrough = XML_DOUBLE_LINE;
+ else if( bBold )
+ eLineThrough = XML_THICK_LINE;
+ else if( XML_NONE != eLineThrough )
+ eLineThrough = XML_SINGLE_LINE;
+
+ return GetXMLToken( eLineThrough );
+}
+
+//------------------------------------------------------------------------------
+
+TYPEINIT1( XMLStyleOASISTContext, XMLPersElemContentTContext );
+
+XMLStyleOASISTContext::XMLStyleOASISTContext( XMLTransformerBase& rImp,
+ const OUString& rQName,
+ sal_Bool bPersistent ) :
+ XMLPersElemContentTContext ( rImp, rQName ),
+ m_bPersistent( bPersistent ),
+ m_bControlStyle( false )
+{
+}
+
+XMLStyleOASISTContext::XMLStyleOASISTContext(
+ XMLTransformerBase& rImp,
+ const OUString& rQName,
+ sal_uInt16 nPrefix,
+ ::xmloff::token::XMLTokenEnum eToken,
+ sal_Bool bPersistent ) :
+ XMLPersElemContentTContext( rImp, rQName, nPrefix, eToken ),
+ m_bPersistent( bPersistent )
+{
+}
+
+XMLStyleOASISTContext::~XMLStyleOASISTContext()
+{
+}
+
+XMLTransformerContext *XMLStyleOASISTContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const OUString& rQName,
+ const Reference< XAttributeList >& rAttrList )
+{
+ XMLTransformerContext *pContext = 0;
+
+ if( XML_NAMESPACE_STYLE == nPrefix )
+ {
+ XMLPropType ePropType =
+ XMLPropertiesTContext_Impl::GetPropType( rLocalName );
+ if( XML_PROP_TYPE_END != ePropType )
+ {
+ // if no properties context exist start a new one.
+ if( !m_xPropContext.is() )
+ m_xPropContext = new XMLPropertiesTContext_Impl(
+ GetTransformer(), rQName, ePropType, m_aStyleFamily, m_bControlStyle );
+ else
+ m_xPropContext->SetQNameAndPropType( rQName, ePropType );
+ pContext = m_xPropContext.get();
+ }
+ }
+ if( !pContext )
+ {
+ // if a properties context exist close it
+ if( m_xPropContext.is() && !m_bPersistent )
+ {
+ m_xPropContext->Export();
+ m_xPropContext = 0;
+ }
+
+ pContext = m_bPersistent
+ ? XMLPersElemContentTContext::CreateChildContext(
+ nPrefix, rLocalName, rQName, rAttrList )
+ : XMLTransformerContext::CreateChildContext(
+ nPrefix, rLocalName, rQName, rAttrList );
+ }
+
+ return pContext;
+}
+
+void XMLStyleOASISTContext::StartElement(
+ const Reference< XAttributeList >& rAttrList )
+{
+ XMLTransformerActions *pActions =
+ GetTransformer().GetUserDefinedActions( OASIS_STYLE_ACTIONS );
+ OSL_ENSURE( pActions, "go no actions" );
+
+ Reference< XAttributeList > xAttrList( rAttrList );
+ XMLMutableAttributeList *pMutableAttrList = 0;
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ sal_Int16 nFamilyAttr = -1;
+ m_bControlStyle = sal_False;
+
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ XMLTransformerActions::key_type aKey( nPrefix, aLocalName );
+ XMLTransformerActions::const_iterator aIter =
+ pActions->find( aKey );
+ if( !(aIter == pActions->end() ) )
+ {
+ if( !pMutableAttrList )
+ {
+ pMutableAttrList =
+ new XMLMutableAttributeList( xAttrList );
+ xAttrList = pMutableAttrList;
+ }
+ const OUString& rAttrValue = xAttrList->getValueByIndex( i );
+ switch( (*aIter).second.m_nActionType )
+ {
+ case XML_ATACTION_STYLE_FAMILY:
+ if( IsXMLToken( rAttrValue, XML_GRAPHIC ) )
+ {
+ m_aStyleFamily = GetXMLToken( XML_GRAPHICS ) ;
+ pMutableAttrList->SetValueByIndex( i, m_aStyleFamily );
+ }
+ else
+ {
+ m_aStyleFamily = rAttrValue;
+
+ if( IsXMLToken( rAttrValue, XML_PARAGRAPH ) )
+ nFamilyAttr = i;
+ }
+
+ break;
+ case XML_ATACTION_STYLE_DISPLAY_NAME:
+ case XML_ATACTION_REMOVE:
+ pMutableAttrList->RemoveAttributeByIndex( i );
+ --i;
+ --nAttrCount;
+ break;
+ case XML_ATACTION_DECODE_STYLE_NAME:
+ m_bControlStyle = 0 == rAttrValue.compareToAscii( "ctrl", 4 );
+ case XML_ATACTION_DECODE_STYLE_NAME_REF:
+ {
+ OUString aAttrValue( rAttrValue );
+ if( GetTransformer().DecodeStyleName(aAttrValue) )
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_IN2INCH:
+ {
+ OUString aAttrValue( rAttrValue );
+ if( XMLTransformerBase::ReplaceSingleInWithInch(
+ aAttrValue ) )
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_NEG_PERCENT:
+ {
+ OUString aAttrValue( rAttrValue );
+ if( GetTransformer().NegPercent(aAttrValue) )
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_URI_OASIS:
+ {
+ OUString aAttrValue( rAttrValue );
+ if( GetTransformer().ConvertURIToOOo( aAttrValue,
+ static_cast< sal_Bool >((*aIter).second.m_nParam1)))
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ break;
+ default:
+ OSL_ENSURE( !this, "unknown action" );
+ break;
+ }
+ }
+ }
+
+ if( m_bControlStyle && nFamilyAttr != -1 )
+ pMutableAttrList->SetValueByIndex( nFamilyAttr, GetXMLToken( XML_CONTROL ) );
+
+
+ if( m_bPersistent )
+ XMLPersElemContentTContext::StartElement( xAttrList );
+ else
+ GetTransformer().GetDocHandler()->startElement( GetExportQName(),
+ xAttrList );
+}
+
+void XMLStyleOASISTContext::EndElement()
+{
+ if( m_bPersistent )
+ {
+ XMLPersElemContentTContext::EndElement();
+ }
+ else
+ {
+ // if a properties context exist close it
+ if( m_xPropContext.is() )
+ {
+ m_xPropContext->Export();
+ m_xPropContext = 0;
+ }
+ GetTransformer().GetDocHandler()->endElement( GetExportQName() );
+ }
+}
+
+void XMLStyleOASISTContext::Characters( const OUString& )
+{
+ // element content only:
+}
+
+void XMLStyleOASISTContext::ExportContent()
+{
+ if( m_xPropContext.is() )
+ m_xPropContext->Export();
+ XMLPersElemContentTContext::ExportContent();
+}
+
+sal_Bool XMLStyleOASISTContext::IsPersistent() const
+{
+ return m_bPersistent;
+}
+
+XMLTransformerActions *XMLStyleOASISTContext::CreateTransformerActions(
+ sal_uInt16 nType )
+{
+ XMLTransformerActionInit *pInit = 0;
+
+ switch( nType )
+ {
+ case PROP_OASIS_GRAPHIC_ATTR_ACTIONS:
+ pInit = aGraphicPropertyOASISAttrActionTable;
+ break;
+ case PROP_OASIS_DRAWING_PAGE_ATTR_ACTIONS:
+ pInit = aDrawingPagePropertyOASISAttrActionTable;
+ break;
+ case PROP_OASIS_PAGE_LAYOUT_ATTR_ACTIONS:
+ pInit = aPageLayoutPropertyOASISAttrActionTable;
+ break;
+ case PROP_OASIS_HEADER_FOOTER_ATTR_ACTIONS:
+ pInit = aHeaderFooterPropertyOASISAttrActionTable;
+ break;
+ case PROP_OASIS_TEXT_ATTR_ACTIONS:
+ pInit = aTextPropertyOASISAttrActionTable;
+ break;
+ case PROP_OASIS_PARAGRAPH_ATTR_ACTIONS:
+ pInit = aParagraphPropertyOASISAttrActionTable;
+ break;
+ case PROP_OASIS_SECTION_ATTR_ACTIONS:
+ pInit = aSectionPropertyOASISAttrActionTable;
+ break;
+ case PROP_OASIS_TABLE_ATTR_ACTIONS:
+ pInit = aTablePropertyOASISAttrActionTable;
+ break;
+ case PROP_OASIS_TABLE_COLUMN_ATTR_ACTIONS:
+ pInit = aTableColumnPropertyOASISAttrActionTable;
+ break;
+ case PROP_OASIS_TABLE_ROW_ATTR_ACTIONS:
+ pInit = aTableRowPropertyOASISAttrActionTable;
+ break;
+ case PROP_OASIS_TABLE_CELL_ATTR_ACTIONS:
+ pInit = aTableCellPropertyOASISAttrActionTable;
+ break;
+ case PROP_OASIS_LIST_LEVEL_ATTR_ACTIONS:
+ pInit = aListLevelPropertyOASISAttrActionTable;
+ break;
+ case PROP_OASIS_CHART_ATTR_ACTIONS:
+ pInit = aChartPropertyOASISAttrActionTable;
+ break;
+ }
+
+ XMLTransformerActions *pActions = 0;
+ if( pInit )
+ pActions = new XMLTransformerActions( pInit );
+
+ return pActions;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/StyleOASISTContext.hxx b/xmloff/source/transform/StyleOASISTContext.hxx
new file mode 100644
index 000000000000..1f4f18986791
--- /dev/null
+++ b/xmloff/source/transform/StyleOASISTContext.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_STYLEOASISTCONTEXT_HXX
+#define _XMLOFF_STYLEOASISTCONTEXT_HXX
+
+#include <rtl/ref.hxx>
+#include "DeepTContext.hxx"
+
+
+class XMLTransformerActions;
+class XMLPropertiesTContext_Impl;
+class XMLStyleOASISTContext : public XMLPersElemContentTContext
+{
+ ::rtl::Reference< XMLPropertiesTContext_Impl > m_xPropContext;
+
+ sal_Bool m_bPersistent;
+ sal_Bool m_bControlStyle;
+
+ ::rtl::OUString m_aStyleFamily;
+public:
+ TYPEINFO();
+
+ XMLStyleOASISTContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName,
+ sal_Bool bPersistent=sal_False );
+ XMLStyleOASISTContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName,
+ sal_uInt16 nPrefix,
+ ::xmloff::token::XMLTokenEnum eToken,
+ sal_Bool bPersistent=sal_False );
+
+ virtual ~XMLStyleOASISTContext();
+
+ virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::rtl::OUString& rQName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+ virtual void Characters( const ::rtl::OUString& rChars );
+
+ virtual void ExportContent();
+
+ virtual sal_Bool IsPersistent() const;
+
+ static XMLTransformerActions *CreateTransformerActions( sal_uInt16 nType );
+};
+
+#endif // _XMLOFF_STYLEOASISTCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/StyleOOoTContext.cxx b/xmloff/source/transform/StyleOOoTContext.cxx
new file mode 100644
index 000000000000..f74ebdeeda31
--- /dev/null
+++ b/xmloff/source/transform/StyleOOoTContext.cxx
@@ -0,0 +1,1373 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/xml/sax/SAXParseException.hpp>
+#include <com/sun/star/xml/sax/SAXException.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include "PropType.hxx"
+#include "DeepTContext.hxx"
+#include "RenameElemTContext.hxx"
+#include "ProcAttrTContext.hxx"
+#include "ActionMapTypesOOo.hxx"
+#include "MutableAttrList.hxx"
+#include "TransformerActions.hxx"
+#include "PropertyActionsOOo.hxx"
+#include "TransformerBase.hxx"
+
+#include "StyleOOoTContext.hxx"
+#include <xmloff/xmluconv.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/math.hxx>
+
+using ::rtl::OUString;
+using namespace ::xmloff::token;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+
+const sal_uInt16 MAX_PROP_TYPES = 4;
+#define ENTRY4(a,b,c,d) \
+ { XML_PROP_TYPE_##a, XML_PROP_TYPE_##b, \
+ XML_PROP_TYPE_##c, XML_PROP_TYPE_##d }
+#define ENTRY3(a,b,c) \
+ { XML_PROP_TYPE_##a, XML_PROP_TYPE_##b, \
+ XML_PROP_TYPE_##c, XML_PROP_TYPE_END }
+#define ENTRY2(a,b) \
+ { XML_PROP_TYPE_##a, XML_PROP_TYPE_##b, \
+ XML_PROP_TYPE_END, XML_PROP_TYPE_END }
+#define ENTRY1(a) \
+ { XML_PROP_TYPE_##a, XML_PROP_TYPE_##END, \
+ XML_PROP_TYPE_END, XML_PROP_TYPE_END }
+
+static XMLPropType aPropTypes[XML_FAMILY_TYPE_END][MAX_PROP_TYPES] =
+{
+ ENTRY3( GRAPHIC, PARAGRAPH, TEXT ), // XML_FAMILY_TYPE_GRAPHIC,
+ ENTRY3( GRAPHIC, PARAGRAPH, TEXT ), // XML_FAMILY_TYPE_PRESENTATION,
+ ENTRY1( DRAWING_PAGE ), // XML_FAMILY_TYPE_DRAWING_PAGE,
+ ENTRY1( END ), // XML_FAMILY_TYPE_MASTER_PAGE
+ ENTRY1( PAGE_LAYOUT ), // XML_FAMILY_TYPE_PAGE_LAYOUT,
+ ENTRY1( HEADER_FOOTER ), // XML_FAMILY_TYPE_HEADER_FOOTER
+ ENTRY1( TEXT ), // XML_FAMILY_TYPE_TEXT,
+ ENTRY2( PARAGRAPH, TEXT ), // XML_FAMILY_TYPE_PARAGRAPH,
+ ENTRY1( RUBY ), //XML_FAMILY_TYPE_RUBY,
+ ENTRY1( SECTION ), // XML_FAMILY_TYPE_SECTION,
+ ENTRY1( TABLE ), // XML_FAMILY_TYPE_TABLE,
+ ENTRY1( TABLE_COLUMN ), // XML_FAMILY_TYPE_TABLE_COLUMN,
+ ENTRY1( TABLE_ROW ), // XML_FAMILY_TYPE_TABLE_ROW,
+ ENTRY3( TABLE_CELL, PARAGRAPH, TEXT ), // XML_FAMILY_TYPE_TABLE_CELL,
+ ENTRY1( LIST_LEVEL ), // XML_FAMILY_TYPE_LIST,
+ ENTRY4( CHART, GRAPHIC, PARAGRAPH, TEXT ), // XML_FAMILY_TYPE_CHART,
+ ENTRY1( TEXT ), // XML_FAMILY_TYPE_DATA,
+ ENTRY1( END ), // XML_FAMILY_TYPE_GRADIENT,
+ ENTRY1( END ), // XML_FAMILY_TYPE_HATCH,
+ ENTRY1( END ), // XML_FAMILY_TYPE_FILL_IMAGE,
+ ENTRY1( END ), // XML_FAMILY_TYPE_STROKE_DASH,
+ ENTRY1( END ), // XML_FAMILY_TYPE_MARKER,
+ ENTRY1( END ) // XML_FAMILY_TYPE_PRESENTATION_PAGE_LAYOUT,
+};
+
+static XMLTokenEnum aPropTokens[XML_PROP_TYPE_END] =
+{
+ XML_GRAPHIC_PROPERTIES,
+ XML_DRAWING_PAGE_PROPERTIES,
+ XML_PAGE_LAYOUT_PROPERTIES,
+ XML_HEADER_FOOTER_PROPERTIES,
+ XML_TEXT_PROPERTIES,
+ XML_PARAGRAPH_PROPERTIES,
+ XML_RUBY_PROPERTIES,
+ XML_SECTION_PROPERTIES,
+ XML_TABLE_PROPERTIES,
+ XML_TABLE_COLUMN_PROPERTIES,
+ XML_TABLE_ROW_PROPERTIES,
+ XML_TABLE_CELL_PROPERTIES,
+ XML_LIST_LEVEL_PROPERTIES,
+ XML_CHART_PROPERTIES
+};
+
+static sal_uInt16 aAttrActionMaps[XML_PROP_TYPE_END] =
+{
+ PROP_OOO_GRAPHIC_ATTR_ACTIONS,
+ PROP_OOO_DRAWING_PAGE_ATTR_ACTIONS, // DRAWING_PAGE
+ PROP_OOO_PAGE_LAYOUT_ATTR_ACTIONS,
+ PROP_OOO_HEADER_FOOTER_ATTR_ACTIONS,
+ PROP_OOO_TEXT_ATTR_ACTIONS,
+ PROP_OOO_PARAGRAPH_ATTR_ACTIONS,
+ MAX_OOO_PROP_ACTIONS, // RUBY
+ PROP_OOO_SECTION_ATTR_ACTIONS,
+ PROP_OOO_TABLE_ATTR_ACTIONS,
+ PROP_OOO_TABLE_COLUMN_ATTR_ACTIONS,
+ PROP_OOO_TABLE_ROW_ATTR_ACTIONS,
+ PROP_OOO_TABLE_CELL_ATTR_ACTIONS,
+ PROP_OOO_LIST_LEVEL_ATTR_ACTIONS,
+ PROP_OOO_CHART_ATTR_ACTIONS
+};
+
+static sal_uInt16 aElemActionMaps[XML_PROP_TYPE_END] =
+{
+ PROP_OOO_GRAPHIC_ELEM_ACTIONS,
+ MAX_OOO_PROP_ACTIONS,
+ MAX_OOO_PROP_ACTIONS,
+ MAX_OOO_PROP_ACTIONS,
+ PROP_OOO_TEXT_ELEM_ACTIONS,
+ PROP_OOO_PARAGRAPH_ELEM_ACTIONS,
+ MAX_OOO_PROP_ACTIONS,
+ MAX_OOO_PROP_ACTIONS,
+ MAX_OOO_PROP_ACTIONS,
+ MAX_OOO_PROP_ACTIONS,
+ MAX_OOO_PROP_ACTIONS,
+ PROP_OOO_TABLE_CELL_ELEM_ACTIONS,
+ MAX_OOO_PROP_ACTIONS,
+ PROP_OOO_CHART_ELEM_ACTIONS
+};
+
+
+//------------------------------------------------------------------------------
+
+class XMLTypedPropertiesOOoTContext_Impl : public XMLPersElemContentTContext
+{
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > m_xAttrList;
+
+public:
+
+ TYPEINFO();
+
+ XMLTypedPropertiesOOoTContext_Impl( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName );
+
+ virtual ~XMLTypedPropertiesOOoTContext_Impl();
+
+ using XMLPersAttrListTContext::AddAttribute;
+ void AddAttribute( const ::rtl::OUString &sName ,
+ const ::rtl::OUString &sValue );
+ void AddAttribute( sal_uInt16 nPrefix, XMLTokenEnum eToken,
+ const ::rtl::OUString &sValue );
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& rAttrList );
+
+ virtual void Export();
+};
+
+TYPEINIT1( XMLTypedPropertiesOOoTContext_Impl, XMLPersElemContentTContext );
+
+XMLTypedPropertiesOOoTContext_Impl::XMLTypedPropertiesOOoTContext_Impl(
+ XMLTransformerBase& rImp,
+ const OUString& rQName ) :
+ XMLPersElemContentTContext( rImp, rQName ),
+ m_xAttrList( new XMLMutableAttributeList() )
+{
+}
+
+XMLTypedPropertiesOOoTContext_Impl::~XMLTypedPropertiesOOoTContext_Impl()
+{
+}
+
+void XMLTypedPropertiesOOoTContext_Impl::AddAttribute(
+ const ::rtl::OUString &sName ,
+ const ::rtl::OUString &sValue )
+{
+ static_cast< XMLMutableAttributeList * >( m_xAttrList.get() )
+ ->AddAttribute( sName, sValue );
+}
+
+void XMLTypedPropertiesOOoTContext_Impl::AddAttribute(
+ sal_uInt16 nPrefix, XMLTokenEnum eToken,
+ const ::rtl::OUString &sValue )
+{
+ OUString sName(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ nPrefix, ::xmloff::token::GetXMLToken( eToken ) ) );
+ static_cast< XMLMutableAttributeList * >( m_xAttrList.get() )
+ ->AddAttribute( sName, sValue );
+}
+
+void XMLTypedPropertiesOOoTContext_Impl::StartElement(
+ const Reference< XAttributeList >& )
+{
+ // empty, ignore even the attribute list
+}
+
+void XMLTypedPropertiesOOoTContext_Impl::Export()
+{
+ if( m_xAttrList->getLength() || HasElementContent() )
+ {
+ GetTransformer().GetDocHandler()->startElement( GetQName(), m_xAttrList );
+ ExportContent();
+ GetTransformer().GetDocHandler()->endElement( GetQName() );
+ }
+}
+
+//------------------------------------------------------------------------------
+
+class XMLPropertiesOOoTContext_Impl : public XMLTransformerContext
+{
+ ::rtl::Reference < XMLTypedPropertiesOOoTContext_Impl >
+ m_aPropContexts[MAX_PROP_TYPES];
+
+ typedef XMLPropType XMLPropTypes[MAX_PROP_TYPES];
+
+ XMLPropTypes m_aPropTypes;
+
+ sal_Bool m_bPersistent;
+
+ XMLTypedPropertiesOOoTContext_Impl *GetPropContextAndAction(
+ TransformerAction_Impl& rAction,
+ sal_uInt16 nPrefix, const OUString& rLocalName,
+ sal_Bool bElem );
+
+ XMLTypedPropertiesOOoTContext_Impl *GetPropContext(
+ XMLPropType eType );
+
+
+public:
+
+ TYPEINFO();
+
+ XMLPropertiesOOoTContext_Impl( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName,
+ XMLPropTypes& rTypes,
+ sal_Bool bPersistent );
+
+ virtual ~XMLPropertiesOOoTContext_Impl();
+
+ XMLTransformerContext *CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const OUString& rQName,
+ const Reference< XAttributeList >& rAttrList );
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& rAttrList );
+
+ virtual void EndElement();
+
+ virtual void Characters( const ::rtl::OUString& rChars );
+
+ virtual void Export();
+
+ virtual sal_Bool IsPersistent() const;
+};
+
+TYPEINIT1( XMLPropertiesOOoTContext_Impl, XMLTransformerContext );
+
+XMLTypedPropertiesOOoTContext_Impl
+ *XMLPropertiesOOoTContext_Impl::GetPropContext(
+ XMLPropType eType )
+{
+ sal_uInt16 nIndex = MAX_PROP_TYPES;
+ for( sal_uInt16 i=0; i< MAX_PROP_TYPES; i++ )
+ {
+ if( m_aPropTypes[i] == eType )
+ {
+ nIndex = i;
+ break;
+ }
+ }
+ if( MAX_PROP_TYPES == nIndex )
+ return 0;
+
+ if( !m_aPropContexts[nIndex].is() )
+ {
+ m_aPropContexts[nIndex] =
+ new XMLTypedPropertiesOOoTContext_Impl(
+ GetTransformer(),
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_STYLE,
+ ::xmloff::token::GetXMLToken(
+ aPropTokens[m_aPropTypes[nIndex]] ) ));
+ }
+
+ return m_aPropContexts[nIndex].get();
+}
+
+
+XMLTypedPropertiesOOoTContext_Impl
+ *XMLPropertiesOOoTContext_Impl::GetPropContextAndAction(
+ TransformerAction_Impl& rAction,
+ sal_uInt16 nPrefix, const OUString& rLocalName,
+ sal_Bool bElem )
+{
+ rAction.m_nActionType = XML_ATACTION_COPY;
+ sal_uInt16 nIndex = 0;
+
+ XMLTransformerActions::key_type aKey( nPrefix, rLocalName );
+ sal_uInt16 i=0;
+ while( i < MAX_PROP_TYPES && XML_PROP_TYPE_END!=m_aPropTypes[i])
+ {
+ sal_uInt16 nActionMap =
+ (bElem ? aElemActionMaps : aAttrActionMaps)[m_aPropTypes[i]];
+ if( nActionMap < MAX_OOO_PROP_ACTIONS )
+ {
+ XMLTransformerActions *pActions =
+ GetTransformer().GetUserDefinedActions( nActionMap );
+ OSL_ENSURE( pActions, "go no actions" );
+ if( pActions )
+ {
+ XMLTransformerActions::const_iterator aIter =
+ pActions->find( aKey );
+
+ if( !(aIter == pActions->end()) )
+ {
+ rAction = (*aIter).second;
+ nIndex = i;
+ break;
+ }
+ }
+ }
+ ++i;
+ }
+
+#ifdef DBG_UTIL
+ if( !( XML_NAMESPACE_NONE == nPrefix ||
+ (XML_NAMESPACE_UNKNOWN_FLAG & nPrefix) ||
+ XML_PROP_TYPE_END==m_aPropTypes[1] ||
+ (i<MAX_PROP_TYPES && XML_PROP_TYPE_END!=m_aPropTypes[i]) ) )
+ {
+ ::rtl::OString aTmp("Didnt't find property: ");
+ const ::rtl::OUString& rPrefix =
+ GetTransformer().GetNamespaceMap().GetPrefixByKey( nPrefix );
+ aTmp += ::rtl::OString( rPrefix.getStr(), rPrefix.getLength(),
+ RTL_TEXTENCODING_ASCII_US );
+ aTmp += ::rtl::OString::valueOf( ':' );
+ aTmp += ::rtl::OString( rLocalName.getStr(), rLocalName.getLength(),
+ RTL_TEXTENCODING_ASCII_US );
+ aTmp += ::rtl::OString(", assuming <style:");
+ const ::rtl::OUString& rName =
+ ::xmloff::token::GetXMLToken( aPropTokens[m_aPropTypes[0]] );
+ aTmp += ::rtl::OString( rName.getStr(), rName.getLength(),
+ RTL_TEXTENCODING_ASCII_US );
+ aTmp += ::rtl::OString::valueOf( '>' );
+
+ OSL_ENSURE( !this, aTmp );
+ }
+#endif
+
+ if( !m_aPropContexts[nIndex].is() )
+ {
+ m_aPropContexts[nIndex] =
+ new XMLTypedPropertiesOOoTContext_Impl(
+ GetTransformer(),
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_STYLE,
+ ::xmloff::token::GetXMLToken(
+ aPropTokens[m_aPropTypes[nIndex]] ) ));
+ }
+
+ return m_aPropContexts[nIndex].get();
+}
+
+XMLPropertiesOOoTContext_Impl::XMLPropertiesOOoTContext_Impl(
+ XMLTransformerBase& rImp,
+ const OUString& rQName,
+ XMLPropTypes& rTypes,
+ sal_Bool bPersistent ) :
+ XMLTransformerContext( rImp, rQName ),
+ m_bPersistent( bPersistent )
+{
+ for( sal_uInt16 i=0; i < MAX_PROP_TYPES; ++i )
+ {
+ // remember the types that belong to the attribute and element lists
+ m_aPropTypes[i] = rTypes[i];
+ }
+}
+
+XMLPropertiesOOoTContext_Impl::~XMLPropertiesOOoTContext_Impl()
+{
+}
+
+XMLTransformerContext *XMLPropertiesOOoTContext_Impl::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const OUString& rQName,
+ const Reference< XAttributeList >& rAttrList )
+{
+ TransformerAction_Impl aAction;
+ return GetPropContextAndAction( aAction, nPrefix, rLocalName, sal_True )
+ ->CreateChildContext( nPrefix, rLocalName, rQName, rAttrList );
+}
+
+
+void XMLPropertiesOOoTContext_Impl::StartElement(
+ const Reference< XAttributeList >& rAttrList )
+{
+ Reference< XAttributeList > xAttrList( rAttrList );
+
+ XMLTypedPropertiesOOoTContext_Impl * pIntervalMinorDivisorContext = 0;
+ double fIntervalMajor = 0.0;
+ double fIntervalMinor = 0.0;
+ sal_Bool bMoveProtect = sal_False;
+ sal_Bool bSizeProtect = sal_False;
+ OUString aProtectAttrValue;
+ XMLTypedPropertiesOOoTContext_Impl * pProtectContext = 0;
+
+ /* Attribute <style:mirror> has to be priority over attribute <style:draw>.
+ The filter from OpenDocument file format to OpenOffice.org file format
+ produces styles with both attributes. (#i49139#)
+ */
+ sal_Bool bExistStyleMirror( sal_False );
+ OUString aStyleMirrorAttrValue;
+ sal_Bool bExistDrawMirror( sal_False );
+ OUString aDrawMirrorAttrValue;
+ XMLTypedPropertiesOOoTContext_Impl* pMirrorContext( 0L );
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString sAttrName = xAttrList->getNameByIndex( i );
+ const OUString sAttrValue = xAttrList->getValueByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetTransformer().GetNamespaceMap().GetKeyByAttrName( sAttrName,
+ &aLocalName );
+ TransformerAction_Impl aAction;
+ XMLTypedPropertiesOOoTContext_Impl *pContext =
+ GetPropContextAndAction( aAction, nPrefix, aLocalName, sal_False );
+ switch( aAction.m_nActionType )
+ {
+ case XML_ATACTION_REMOVE:
+ break;
+ case XML_ATACTION_COPY:
+ pContext->AddAttribute( sAttrName, sAttrValue );
+ break;
+ case XML_ATACTION_COPY_DUPLICATE:
+ {
+ pContext->AddAttribute( sAttrName, sAttrValue );
+ XMLTypedPropertiesOOoTContext_Impl *pContext2 =
+ GetPropContext( (XMLPropType)aAction.m_nParam1 );
+ if( pContext2 )
+ pContext2->AddAttribute( sAttrName, sAttrValue );
+ }
+ break;
+ case XML_ATACTION_RENAME:
+ {
+ pContext->AddAttribute( aAction.GetQNamePrefixFromParam1(),
+ aAction.GetQNameTokenFromParam1(),
+ sAttrValue );
+ }
+ break;
+ case XML_ATACTION_ENCODE_STYLE_NAME_REF:
+ {
+ OUString aAttrValue( sAttrValue );
+ GetTransformer().EncodeStyleName(aAttrValue);
+ pContext->AddAttribute( sAttrName, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_RENAME_ENCODE_STYLE_NAME_REF:
+ {
+ OUString aAttrValue( sAttrValue );
+ GetTransformer().EncodeStyleName(aAttrValue);
+ pContext->AddAttribute( aAction.GetQNamePrefixFromParam1(),
+ aAction.GetQNameTokenFromParam1(),
+ aAttrValue );
+ }
+ break;
+ case XML_ATACTION_NEG_PERCENT:
+ {
+ OUString aAttrValue( sAttrValue );
+ GetTransformer().NegPercent(aAttrValue);
+ pContext->AddAttribute( sAttrName, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_RENAME_NEG_PERCENT:
+ {
+ OUString aAttrValue( sAttrValue );
+ GetTransformer().NegPercent(aAttrValue);
+ pContext->AddAttribute( aAction.GetQNamePrefixFromParam1(),
+ aAction.GetQNameTokenFromParam1(),
+ aAttrValue );
+ }
+ break;
+ case XML_ATACTION_INCH2IN:
+ {
+ OUString aAttrValue( sAttrValue );
+ XMLTransformerBase::ReplaceSingleInchWithIn( aAttrValue );
+ pContext->AddAttribute( sAttrName, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_INCH2IN_DUPLICATE:
+ {
+ OUString aAttrValue( sAttrValue );
+ XMLTransformerBase::ReplaceSingleInchWithIn( aAttrValue );
+ pContext->AddAttribute( sAttrName, aAttrValue );
+ XMLTypedPropertiesOOoTContext_Impl *pContext2 =
+ GetPropContext( (XMLPropType)aAction.m_nParam1 );
+ if( pContext2 )
+ pContext2->AddAttribute( sAttrName, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_INCHS2INS:
+ {
+ OUString aAttrValue( sAttrValue );
+ XMLTransformerBase::ReplaceInchWithIn( aAttrValue );
+ pContext->AddAttribute( sAttrName, aAttrValue );
+ }
+ break;
+ case XML_PTACTION_LINE_MODE:
+ {
+ OUString aAttrValue( GetXMLToken(
+ IsXMLToken( sAttrValue, XML_TRUE )
+ ? XML_CONTINUOUS
+ : XML_SKIP_WHITE_SPACE) );
+ OUString aAttrQName(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_STYLE,
+ GetXMLToken( XML_TEXT_UNDERLINE_MODE ) ) );
+ pContext->AddAttribute( aAttrQName, aAttrValue );
+
+ aAttrQName =
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_STYLE,
+ GetXMLToken( XML_TEXT_LINE_THROUGH_MODE ) );
+ pContext->AddAttribute( aAttrQName, aAttrValue );
+ }
+ break;
+ case XML_PTACTION_KEEP_WITH_NEXT:
+ {
+ OUString aAttrValue( GetXMLToken(
+ IsXMLToken( sAttrValue, XML_TRUE )
+ ? XML_ALWAYS
+ : XML_AUTO) );
+ pContext->AddAttribute( sAttrName, aAttrValue );
+ }
+ break;
+ case XML_PTACTION_UNDERLINE:
+ {
+ XMLTokenEnum eToken = GetTransformer().GetToken( sAttrValue );
+ sal_Bool bBold = sal_False, bDouble = sal_False;
+ switch( eToken )
+ {
+ case XML_SINGLE:
+ eToken = XML_SOLID;
+ break;
+ case XML_DOUBLE:
+ eToken = XML_SOLID;
+ bDouble = sal_True;
+ break;
+ case XML_BOLD:
+ eToken = XML_SOLID;
+ bBold = sal_True;
+ break;
+ case XML_BOLD_DOTTED:
+ eToken = XML_DOTTED;
+ bBold = sal_True;
+ break;
+ case XML_BOLD_DASH:
+ eToken = XML_DASH;
+ bBold = sal_True;
+ break;
+ case XML_BOLD_LONG_DASH:
+ eToken = XML_LONG_DASH;
+ bBold = sal_True;
+ break;
+ case XML_BOLD_DOT_DASH:
+ eToken = XML_DOT_DASH;
+ bBold = sal_True;
+ break;
+ case XML_BOLD_DOT_DOT_DASH:
+ eToken = XML_DOT_DOT_DASH;
+ bBold = sal_True;
+ break;
+ case XML_BOLD_WAVE:
+ eToken = XML_WAVE;
+ bBold = sal_True;
+ break;
+ case XML_DOUBLE_WAVE:
+ eToken = XML_WAVE;
+ bDouble = sal_True;
+ break;
+ case XML_NONE:
+ eToken = XML_NONE;
+ bDouble = sal_False;
+ break;
+ default:
+ OSL_FAIL( "xmloff::XMLPropertiesOOoTContext_Impl::StartElement(), unknown underline token!" );
+ break;
+ }
+ pContext->AddAttribute(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_STYLE,
+ GetXMLToken( XML_TEXT_UNDERLINE_STYLE ) ),
+ eToken != XML_TOKEN_END ? GetXMLToken( eToken )
+ : sAttrValue );
+ if( bDouble )
+ pContext->AddAttribute(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_STYLE,
+ GetXMLToken( XML_TEXT_UNDERLINE_TYPE ) ),
+ GetXMLToken( XML_DOUBLE ) );
+ if( bBold )
+ pContext->AddAttribute(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_STYLE,
+ GetXMLToken( XML_TEXT_UNDERLINE_WIDTH ) ),
+ GetXMLToken( XML_BOLD ) );
+ }
+ break;
+ case XML_PTACTION_LINETHROUGH:
+ {
+ XMLTokenEnum eToken = GetTransformer().GetToken( sAttrValue );
+ sal_Bool bBold = sal_False, bDouble = sal_False;
+ sal_Unicode c = 0;
+ switch( eToken )
+ {
+ case XML_SINGLE_LINE:
+ eToken = XML_SOLID;
+ break;
+ case XML_DOUBLE_LINE:
+ eToken = XML_SOLID;
+ bDouble = sal_True;
+ break;
+ case XML_THICK_LINE:
+ eToken = XML_SOLID;
+ bBold = sal_True;
+ break;
+ case XML_SLASH:
+ eToken = XML_SOLID;
+ c = '/';
+ break;
+ case XML_uX:
+ eToken = XML_SOLID;
+ c = 'X';
+ break;
+ default:
+ break;
+ }
+ pContext->AddAttribute(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_STYLE,
+ GetXMLToken( XML_TEXT_LINE_THROUGH_STYLE ) ),
+ eToken != XML_TOKEN_END ? GetXMLToken( eToken )
+ : sAttrValue );
+ if( bDouble )
+ pContext->AddAttribute(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_STYLE,
+ GetXMLToken( XML_TEXT_LINE_THROUGH_TYPE ) ),
+ GetXMLToken( XML_DOUBLE ) );
+ if( bBold )
+ pContext->AddAttribute(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_STYLE,
+ GetXMLToken( XML_TEXT_LINE_THROUGH_WIDTH ) ),
+ GetXMLToken( XML_BOLD ) );
+ if( c )
+ pContext->AddAttribute(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_STYLE,
+ GetXMLToken( XML_TEXT_LINE_THROUGH_TEXT ) ),
+ OUString::valueOf( c ) );
+ }
+ break;
+ case XML_PTACTION_SPLINES:
+ {
+ sal_Int32 nSplineType = sAttrValue.toInt32();
+ OUString aNewAttrName = GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_CHART, GetXMLToken( XML_INTERPOLATION ) );
+
+ switch( nSplineType )
+ {
+ // straight lines
+ case 0:
+ pContext->AddAttribute(
+ aNewAttrName, GetXMLToken( XML_NONE ));
+ break;
+ // cubic spline
+ case 1:
+ pContext->AddAttribute(
+ aNewAttrName, GetXMLToken( XML_CUBIC_SPLINE ));
+ break;
+ // B-spline
+ case 2:
+ pContext->AddAttribute(
+ aNewAttrName, GetXMLToken( XML_B_SPLINE ));
+ break;
+
+ default:
+ OSL_FAIL( "invalid spline type" );
+ pContext->AddAttribute(
+ aNewAttrName, GetXMLToken( XML_NONE ));
+ break;
+ }
+ }
+ break;
+ case XML_PTACTION_INTERVAL_MAJOR:
+ pContext->AddAttribute( sAttrName, sAttrValue );
+ SvXMLUnitConverter::convertDouble( fIntervalMajor, sAttrValue );
+ break;
+ case XML_PTACTION_INTERVAL_MINOR:
+ SvXMLUnitConverter::convertDouble( fIntervalMinor, sAttrValue );
+ pIntervalMinorDivisorContext = pContext;
+ break;
+ case XML_PTACTION_SYMBOL:
+ {
+ sal_Int32 nSymbolType = sAttrValue.toInt32();
+ OUString aNewAttrName = GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_CHART, GetXMLToken( XML_SYMBOL_TYPE ) );
+
+ if( nSymbolType >= 0 )
+ {
+ pContext->AddAttribute( aNewAttrName, GetXMLToken( XML_NAMED_SYMBOL ));
+ enum XMLTokenEnum eToken = XML_TOKEN_INVALID;
+ switch( nSymbolType )
+ {
+ // SYMBOL0
+ case 0:
+ // "square" has an awkward token name
+ eToken = XML_GRADIENTSTYLE_SQUARE;
+ break;
+ // SYMBOL1
+ case 1:
+ eToken = XML_DIAMOND;
+ break;
+ // SYMBOL2
+ case 2:
+ eToken = XML_ARROW_DOWN;
+ break;
+ // SYMBOL3
+ case 3:
+ eToken = XML_ARROW_UP;
+ break;
+ // SYMBOL4
+ case 4:
+ eToken = XML_ARROW_RIGHT;
+ break;
+ // SYMBOL5
+ case 5:
+ eToken = XML_ARROW_LEFT;
+ break;
+ // SYMBOL6
+ case 6:
+ eToken = XML_BOW_TIE;
+ break;
+ // SYMBOL7
+ case 7:
+ eToken = XML_HOURGLASS;
+ break;
+ default:
+ OSL_FAIL( "invalid named symbol" );
+ break;
+ }
+
+ if( eToken != XML_TOKEN_INVALID )
+ {
+ pContext->AddAttribute( GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_CHART, GetXMLToken( XML_SYMBOL_NAME )),
+ GetXMLToken( eToken ));
+ }
+ }
+ else
+ {
+ switch( nSymbolType )
+ {
+ // NONE
+ case -3:
+ pContext->AddAttribute(
+ aNewAttrName, GetXMLToken( XML_NONE ));
+ break;
+ // AUTO
+ case -2:
+ pContext->AddAttribute(
+ aNewAttrName, GetXMLToken( XML_AUTOMATIC ));
+ break;
+ // BITMAPURL
+ case -1:
+ pContext->AddAttribute(
+ aNewAttrName, GetXMLToken( XML_IMAGE ));
+ break;
+ default:
+ OSL_FAIL( "invalid symbol type" );
+ pContext->AddAttribute(
+ aNewAttrName, GetXMLToken( XML_NONE ));
+ break;
+ }
+ }
+ }
+ break;
+ case XML_PTACTION_SYMBOL_IMAGE_NAME:
+ {
+ // create an xlink:href element for URI attribute
+ XMLPersAttrListTContext *pSymbolImageContext = new XMLPersAttrListTContext(
+ GetTransformer(), GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_CHART, GetXMLToken( XML_SYMBOL_IMAGE )));
+
+ OUString aAttrValue( sAttrValue );
+ if( GetTransformer().ConvertURIToOASIS( aAttrValue, sal_True ))
+ {
+ pSymbolImageContext->AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, aAttrValue );
+ pContext->AddContent( pSymbolImageContext );
+ }
+ }
+ break;
+
+ // #i25616#
+ case XML_PTACTION_TRANSPARENCY :
+ {
+ OUString aAttrValue( sAttrValue );
+ GetTransformer().NegPercent(aAttrValue);
+ pContext->AddAttribute( XML_NAMESPACE_DRAW,
+ XML_OPACITY,
+ aAttrValue );
+ pContext->AddAttribute( XML_NAMESPACE_DRAW,
+ XML_IMAGE_OPACITY,
+ aAttrValue );
+ }
+ break;
+
+ case XML_PTACTION_BREAK_INSIDE:
+ {
+ pContext->AddAttribute(
+ XML_NAMESPACE_FO, XML_KEEP_TOGETHER,
+ GetXMLToken(
+ IsXMLToken( sAttrValue, XML_COLUMNSPLIT_AVOID )
+ ? XML_ALWAYS
+ : XML_AUTO ) );
+ }
+ break;
+ case XML_ATACTION_CAPTION_ESCAPE_OOO:
+ {
+ OUString aAttrValue( sAttrValue );
+ if( aAttrValue.indexOf( sal_Unicode('%') ) != -1 )
+ {
+ sal_Int32 nValue = 0;
+ SvXMLUnitConverter::convertPercent( nValue, sAttrValue );
+ if( nValue )
+ {
+ nValue /= 100;
+ rtl::OUStringBuffer aOut;
+ SvXMLUnitConverter::convertPercent( aOut, nValue );
+ aAttrValue = aOut.makeStringAndClear();
+ }
+ }
+ else
+ {
+ XMLTransformerBase::ReplaceSingleInchWithIn( aAttrValue );
+ }
+
+ pContext->AddAttribute( sAttrName, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_MOVE_PROTECT:
+ bMoveProtect = IsXMLToken( sAttrValue, XML_TRUE );
+ pProtectContext = pContext;
+ break;
+ case XML_ATACTION_SIZE_PROTECT:
+ bSizeProtect = IsXMLToken( sAttrValue, XML_TRUE );
+ pProtectContext = pContext;
+ break;
+ case XML_ATACTION_PROTECT:
+ aProtectAttrValue = sAttrValue;
+ pProtectContext = pContext;
+ break;
+ case XML_ATACTION_DRAW_MIRROR_OOO: // renames draw:mirror to style:mirror and adapts values
+ {
+ // OpenDocument file format: attribute value of <style:mirror> wrong (#i49139#)
+ aDrawMirrorAttrValue =
+ GetXMLToken( IsXMLToken( sAttrValue, XML_TRUE )
+ ? XML_HORIZONTAL : XML_NONE );
+ bExistDrawMirror = sal_True;
+ pMirrorContext = pContext;
+ }
+ break;
+ // OpenDocument file format: attribute value of <style:mirror> wrong (#i49139#)
+ case XML_ATACTION_STYLE_MIRROR_OOO: // adapts style:mirror values
+ {
+ SvXMLTokenEnumerator aTokenEnum( sAttrValue );
+ OUString aToken;
+ while( aTokenEnum.getNextToken( aToken ) )
+ {
+ if ( aStyleMirrorAttrValue.getLength() > 0 )
+ {
+ aStyleMirrorAttrValue += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( " " ));
+ }
+
+ if ( IsXMLToken( aToken, XML_HORIZONTAL_ON_LEFT_PAGES ) )
+ {
+ aStyleMirrorAttrValue += GetXMLToken( XML_HORIZONTAL_ON_EVEN );
+ }
+ else if ( IsXMLToken( aToken, XML_HORIZONTAL_ON_RIGHT_PAGES ) )
+ {
+ aStyleMirrorAttrValue += GetXMLToken( XML_HORIZONTAL_ON_ODD );
+ }
+ else
+ {
+ aStyleMirrorAttrValue += aToken;
+ }
+ }
+ bExistStyleMirror = sal_True;
+ pMirrorContext = pContext;
+ }
+ break;
+ case XML_ATACTION_GAMMA_OOO: // converts double value to percentage
+ {
+ double fValue = sAttrValue.toDouble();
+ sal_Int32 nValue = (sal_Int32)((fValue * 100.0) + ( fValue > 0 ? 0.5 : - 0.5 ) );
+
+ rtl::OUStringBuffer aOut;
+ SvXMLUnitConverter::convertPercent( aOut, nValue );
+ OUString aAttrValue( aOut.makeStringAndClear() );
+ pContext->AddAttribute( sAttrName, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_OPACITY_FIX:
+ {
+ sal_Int32 nValue;
+ if( sAttrValue.indexOf( sal_Unicode('%') ) != -1 )
+ {
+ SvXMLUnitConverter::convertPercent( nValue, sAttrValue );
+ }
+ else
+ {
+ nValue = sal_Int32( sAttrValue.toDouble() * 100.0 );
+ }
+ nValue = 100 - nValue;
+
+ rtl::OUStringBuffer aOut;
+ SvXMLUnitConverter::convertPercent( aOut, nValue );
+ pContext->AddAttribute( sAttrName, aOut.makeStringAndClear() );
+ }
+ break;
+ default:
+ OSL_ENSURE( !this, "unknown action" );
+ break;
+ }
+ }
+
+ // OpenDocument file format: attribute value of <style:mirror> wrong (#i49139#)
+ if ( bExistStyleMirror )
+ {
+ pMirrorContext->AddAttribute(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_STYLE, GetXMLToken( XML_MIRROR ) ),
+ aStyleMirrorAttrValue);
+ }
+ else if ( bExistDrawMirror )
+ {
+ pMirrorContext->AddAttribute(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_STYLE, GetXMLToken( XML_MIRROR ) ),
+ aDrawMirrorAttrValue);
+ }
+
+ if( bMoveProtect || bSizeProtect || aProtectAttrValue.getLength() )
+ {
+ if( (bMoveProtect ||bSizeProtect) && IsXMLToken( aProtectAttrValue, XML_NONE ) )
+ aProtectAttrValue = OUString();
+
+ const OUString& rPosition = GetXMLToken( XML_POSITION );
+ if( bMoveProtect && -1 == aProtectAttrValue.indexOf( rPosition ) )
+ {
+ if( aProtectAttrValue.getLength() )
+ aProtectAttrValue += OUString::valueOf( sal_Unicode( ' ' ) );
+ aProtectAttrValue += rPosition;
+ }
+
+ const OUString& rSize = GetXMLToken( XML_SIZE );
+ if( bSizeProtect && -1 == aProtectAttrValue.indexOf( rSize ) )
+ {
+ if( aProtectAttrValue.getLength() )
+ aProtectAttrValue += OUString::valueOf( sal_Unicode( ' ' ) );
+ aProtectAttrValue += rSize;
+ }
+
+ pProtectContext->AddAttribute( GetTransformer().GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_STYLE, GetXMLToken( XML_PROTECT ) ), aProtectAttrValue );
+ }
+
+ if( pIntervalMinorDivisorContext )
+ {
+ if( fIntervalMinor != 0.0 )
+ {
+ sal_Int32 nIntervalMinorDivisor = static_cast< sal_Int32 >(
+ ::rtl::math::round( fIntervalMajor / fIntervalMinor ));
+
+ ::rtl::OUStringBuffer aBuf;
+ SvXMLUnitConverter::convertNumber( aBuf, nIntervalMinorDivisor );
+ pIntervalMinorDivisorContext->AddAttribute(
+ GetTransformer().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_CHART,
+ GetXMLToken( XML_INTERVAL_MINOR_DIVISOR )),
+ aBuf.makeStringAndClear());
+ }
+ }
+}
+
+void XMLPropertiesOOoTContext_Impl::EndElement()
+{
+ if( !m_bPersistent )
+ Export();
+}
+
+void XMLPropertiesOOoTContext_Impl::Characters( const OUString& )
+{
+ // ignore them
+}
+
+void XMLPropertiesOOoTContext_Impl::Export()
+{
+
+ for( sal_uInt16 i=0; i < MAX_PROP_TYPES; i++ )
+ {
+ if( m_aPropContexts[i].is() )
+ m_aPropContexts[i]->Export();
+ }
+}
+
+sal_Bool XMLPropertiesOOoTContext_Impl::IsPersistent() const
+{
+ return m_bPersistent;
+}
+
+
+//------------------------------------------------------------------------------
+
+TYPEINIT1( XMLStyleOOoTContext, XMLPersElemContentTContext );
+
+XMLStyleOOoTContext::XMLStyleOOoTContext( XMLTransformerBase& rImp,
+ const OUString& rQName,
+ XMLFamilyType eT,
+ sal_Bool bPersistent ) :
+ XMLPersElemContentTContext( rImp, rQName ),
+ m_eFamily( eT ),
+ m_bPersistent( bPersistent )
+{
+}
+
+XMLStyleOOoTContext::XMLStyleOOoTContext(
+ XMLTransformerBase& rImp,
+ const OUString& rQName,
+ XMLFamilyType eT,
+ sal_uInt16 nPrefix,
+ ::xmloff::token::XMLTokenEnum eToken,
+ sal_Bool bPersistent ) :
+ XMLPersElemContentTContext( rImp, rQName, nPrefix, eToken ),
+ m_eFamily( eT ),
+ m_bPersistent( bPersistent )
+{
+}
+
+XMLStyleOOoTContext::~XMLStyleOOoTContext()
+{
+}
+
+XMLTransformerContext *XMLStyleOOoTContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const OUString& rQName,
+ const Reference< XAttributeList >& rAttrList )
+{
+ XMLTransformerContext *pContext = 0;
+
+ if( XML_NAMESPACE_STYLE == nPrefix &&
+ IsXMLToken( rLocalName, XML_PROPERTIES ) )
+ {
+ if( aPropTypes[m_eFamily][0] == XML_PROP_TYPE_END )
+ {
+ OSL_ENSURE( !this, "unexpected properties element" );
+ pContext = m_bPersistent
+ ? XMLPersElemContentTContext::CreateChildContext(
+ nPrefix, rLocalName, rQName, rAttrList )
+ : XMLTransformerContext::CreateChildContext(
+ nPrefix, rLocalName, rQName, rAttrList );
+ }
+ else if( aPropTypes[m_eFamily][1] == XML_PROP_TYPE_END )
+ {
+ sal_uInt16 nActionMap =
+ aAttrActionMaps[aPropTypes[m_eFamily][0]];
+ if( nActionMap < MAX_OOO_PROP_ACTIONS )
+ {
+ pContext = new XMLPropertiesOOoTContext_Impl(
+ GetTransformer(), rQName,
+ aPropTypes[m_eFamily], m_bPersistent );
+ }
+ else
+ {
+ if( m_bPersistent )
+ pContext = new XMLPersElemContentTContext(
+ GetTransformer(), rQName,
+ XML_NAMESPACE_STYLE,
+ aPropTokens[aPropTypes[m_eFamily][0]] );
+ else
+ pContext = new XMLRenameElemTransformerContext(
+ GetTransformer(), rQName,
+ XML_NAMESPACE_STYLE,
+ aPropTokens[aPropTypes[m_eFamily][0]] );
+ }
+ }
+ else
+ {
+ pContext = new XMLPropertiesOOoTContext_Impl(
+ GetTransformer(), rQName,
+ aPropTypes[m_eFamily], m_bPersistent);
+ }
+
+ if( m_bPersistent )
+ AddContent( pContext );
+ }
+ else
+ {
+ pContext = m_bPersistent
+ ? XMLPersElemContentTContext::CreateChildContext(
+ nPrefix, rLocalName, rQName, rAttrList )
+ : XMLTransformerContext::CreateChildContext(
+ nPrefix, rLocalName, rQName, rAttrList );
+ }
+
+ return pContext;
+}
+
+void XMLStyleOOoTContext::StartElement(
+ const Reference< XAttributeList >& rAttrList )
+{
+ XMLTransformerActions *pActions =
+ GetTransformer().GetUserDefinedActions( OOO_STYLE_ACTIONS );
+ OSL_ENSURE( pActions, "go no actions" );
+
+ Reference< XAttributeList > xAttrList( rAttrList );
+ XMLMutableAttributeList *pMutableAttrList = 0;
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetTransformer().GetNamespaceMap().GetKeyByAttrName( sAttrName,
+ &aLocalName );
+ XMLTransformerActions::key_type aKey( nPrefix, aLocalName );
+ XMLTransformerActions::const_iterator aIter =
+ pActions->find( aKey );
+ if( !(aIter == pActions->end() ) )
+ {
+ if( !pMutableAttrList )
+ {
+ pMutableAttrList =
+ new XMLMutableAttributeList( xAttrList );
+ xAttrList = pMutableAttrList;
+ }
+ const OUString sAttrValue = xAttrList->getValueByIndex( i );
+ switch( (*aIter).second.m_nActionType )
+ {
+ case XML_ATACTION_STYLE_FAMILY:
+ {
+ sal_Bool bControl = sal_False;
+ if( XML_FAMILY_TYPE_END == m_eFamily )
+ {
+ if( IsXMLToken( sAttrValue, XML_GRAPHICS ) )
+ m_eFamily = XML_FAMILY_TYPE_GRAPHIC;
+ else if( IsXMLToken( sAttrValue, XML_PRESENTATION ) )
+ m_eFamily = XML_FAMILY_TYPE_PRESENTATION;
+ else if( IsXMLToken( sAttrValue, XML_DRAWING_PAGE ) )
+ m_eFamily = XML_FAMILY_TYPE_DRAWING_PAGE;
+ else if( IsXMLToken( sAttrValue, XML_TEXT) )
+ m_eFamily = XML_FAMILY_TYPE_TEXT;
+ else if( IsXMLToken( sAttrValue, XML_PARAGRAPH) )
+ m_eFamily = XML_FAMILY_TYPE_PARAGRAPH;
+ else if( IsXMLToken( sAttrValue, XML_RUBY) )
+ m_eFamily = XML_FAMILY_TYPE_RUBY;
+ else if( IsXMLToken( sAttrValue, XML_SECTION) )
+ m_eFamily = XML_FAMILY_TYPE_SECTION;
+ else if( IsXMLToken( sAttrValue, XML_TABLE) )
+ m_eFamily = XML_FAMILY_TYPE_TABLE;
+ else if( IsXMLToken( sAttrValue, XML_TABLE_COLUMN) )
+ m_eFamily = XML_FAMILY_TYPE_TABLE_COLUMN;
+ else if( IsXMLToken( sAttrValue, XML_TABLE_ROW) )
+ m_eFamily = XML_FAMILY_TYPE_TABLE_ROW;
+ else if( IsXMLToken( sAttrValue, XML_TABLE_CELL) )
+ m_eFamily = XML_FAMILY_TYPE_TABLE_CELL;
+ else if( IsXMLToken( sAttrValue, XML_CHART) )
+ m_eFamily = XML_FAMILY_TYPE_CHART;
+ else if( IsXMLToken( sAttrValue, XML_CONTROL) )
+ {
+ m_eFamily = XML_FAMILY_TYPE_PARAGRAPH;
+ bControl = sal_True;
+ }
+ }
+ if( XML_FAMILY_TYPE_GRAPHIC == m_eFamily )
+ {
+ pMutableAttrList->SetValueByIndex( i,
+ GetXMLToken( XML_GRAPHIC ) );
+ }
+ else if( bControl )
+ {
+ pMutableAttrList->SetValueByIndex( i,
+ GetXMLToken( XML_PARAGRAPH ) );
+ }
+ }
+ break;
+ case XML_ATACTION_INCH2IN:
+ {
+ OUString aAttrValue( sAttrValue );
+ if( XMLTransformerBase::ReplaceSingleInchWithIn(
+ aAttrValue ) )
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_ENCODE_STYLE_NAME:
+ {
+ OUString aAttrValue( sAttrValue );
+ if( GetTransformer().EncodeStyleName(aAttrValue) )
+ {
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ OUString aNewAttrQName(
+ GetTransformer().GetNamespaceMap().
+ GetQNameByKey(
+ nPrefix, ::xmloff::token::GetXMLToken(
+ XML_DISPLAY_NAME ) ) );
+ pMutableAttrList->AddAttribute( aNewAttrQName,
+ sAttrValue );
+ }
+ }
+ break;
+ case XML_ATACTION_ENCODE_STYLE_NAME_REF:
+ {
+ OUString aAttrValue( sAttrValue );
+ if( GetTransformer().EncodeStyleName(aAttrValue) )
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_NEG_PERCENT:
+ {
+ OUString aAttrValue( sAttrValue );
+ if( GetTransformer().NegPercent(aAttrValue) )
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_URI_OOO:
+ {
+ OUString aAttrValue( sAttrValue );
+ if( GetTransformer().ConvertURIToOASIS( aAttrValue,
+ static_cast< sal_Bool >((*aIter).second.m_nParam1)))
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ break;
+ default:
+ OSL_ENSURE( !this, "unknown action" );
+ break;
+ }
+ }
+ }
+ if( XML_FAMILY_TYPE_END == m_eFamily )
+ m_eFamily = XML_FAMILY_TYPE_TEXT;
+ if( m_bPersistent )
+ XMLPersElemContentTContext::StartElement( xAttrList );
+ else
+ GetTransformer().GetDocHandler()->startElement( GetExportQName(),
+ xAttrList );
+}
+
+void XMLStyleOOoTContext::EndElement()
+{
+ if( m_bPersistent )
+ XMLPersElemContentTContext::EndElement();
+ else
+ GetTransformer().GetDocHandler()->endElement( GetExportQName() );
+}
+
+void XMLStyleOOoTContext::Characters( const OUString& )
+{
+ // element content only:
+}
+
+sal_Bool XMLStyleOOoTContext::IsPersistent() const
+{
+ return m_bPersistent;
+}
+
+XMLTransformerActions *XMLStyleOOoTContext::CreateTransformerActions(
+ sal_uInt16 nType )
+{
+ XMLTransformerActionInit *pInit = 0;
+
+ switch( nType )
+ {
+ case PROP_OOO_GRAPHIC_ATTR_ACTIONS:
+ pInit = aGraphicPropertyOOoAttrActionTable;
+ break;
+ case PROP_OOO_GRAPHIC_ELEM_ACTIONS:
+ pInit = aGraphicPropertyOOoElemActionTable;
+ break;
+ case PROP_OOO_DRAWING_PAGE_ATTR_ACTIONS:
+ pInit = aDrawingPagePropertyOOoAttrActionTable;
+ break;
+ case PROP_OOO_PAGE_LAYOUT_ATTR_ACTIONS:
+ pInit = aPageLayoutPropertyOOoAttrActionTable;
+ break;
+ case PROP_OOO_HEADER_FOOTER_ATTR_ACTIONS:
+ pInit = aHeaderFooterPropertyOOoAttrActionTable;
+ break;
+ case PROP_OOO_TEXT_ATTR_ACTIONS:
+ pInit = aTextPropertyOOoAttrActionTable;
+ break;
+ case PROP_OOO_TEXT_ELEM_ACTIONS:
+ pInit = aTextPropertyOOoElemActionTable;
+ break;
+ case PROP_OOO_PARAGRAPH_ATTR_ACTIONS:
+ pInit = aParagraphPropertyOOoAttrActionTable;
+ break;
+ case PROP_OOO_PARAGRAPH_ELEM_ACTIONS:
+ pInit = aParagraphPropertyOOoElemActionTable;
+ break;
+ case PROP_OOO_SECTION_ATTR_ACTIONS:
+ pInit = aSectionPropertyOOoAttrActionTable;
+ break;
+ case PROP_OOO_TABLE_ATTR_ACTIONS:
+ pInit = aTablePropertyOOoAttrActionTable;
+ break;
+ case PROP_OOO_TABLE_COLUMN_ATTR_ACTIONS:
+ pInit = aTableColumnPropertyOOoAttrActionTable;
+ break;
+ case PROP_OOO_TABLE_ROW_ATTR_ACTIONS:
+ pInit = aTableRowPropertyOOoAttrActionTable;
+ break;
+ case PROP_OOO_TABLE_CELL_ATTR_ACTIONS:
+ pInit = aTableCellPropertyOOoAttrActionTable;
+ break;
+ case PROP_OOO_TABLE_CELL_ELEM_ACTIONS:
+ pInit = aTableCellPropertyOOoElemActionTable;
+ break;
+ case PROP_OOO_LIST_LEVEL_ATTR_ACTIONS:
+ pInit = aListLevelPropertyOOoAttrActionTable;
+ break;
+ case PROP_OOO_CHART_ATTR_ACTIONS:
+ pInit = aChartPropertyOOoAttrActionTable;
+ break;
+ case PROP_OOO_CHART_ELEM_ACTIONS:
+ pInit = aChartPropertyOOoElemActionTable;
+ break;
+ }
+
+ XMLTransformerActions *pActions = 0;
+ if( pInit )
+ pActions = new XMLTransformerActions( pInit );
+
+ return pActions;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/StyleOOoTContext.hxx b/xmloff/source/transform/StyleOOoTContext.hxx
new file mode 100644
index 000000000000..4399d370fd8b
--- /dev/null
+++ b/xmloff/source/transform/StyleOOoTContext.hxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_STYLEOOOTCONTEXT_HXX
+#define _XMLOFF_STYLEOOOTCONTEXT_HXX
+
+#include <rtl/ref.hxx>
+#include "FamilyType.hxx"
+#include "DeepTContext.hxx"
+
+
+class XMLTransformerActions;
+
+class XMLStyleOOoTContext : public XMLPersElemContentTContext
+{
+ XMLFamilyType m_eFamily;
+
+ sal_Bool m_bPersistent;
+
+public:
+ TYPEINFO();
+
+ XMLStyleOOoTContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName,
+ XMLFamilyType eType,
+ sal_Bool bPersistent );
+ XMLStyleOOoTContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName,
+ XMLFamilyType eType,
+ sal_uInt16 nPrefix,
+ ::xmloff::token::XMLTokenEnum eToken,
+ sal_Bool bPersistent );
+
+ virtual ~XMLStyleOOoTContext();
+
+ virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::rtl::OUString& rQName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+ virtual void Characters( const ::rtl::OUString& rChars );
+ virtual sal_Bool IsPersistent() const;
+
+ static XMLTransformerActions *CreateTransformerActions( sal_uInt16 nType );
+
+};
+
+#endif // _XMLOFF_STYLEOOOTCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/TContextVector.hxx b/xmloff/source/transform/TContextVector.hxx
new file mode 100644
index 000000000000..6c3c42fb9432
--- /dev/null
+++ b/xmloff/source/transform/TContextVector.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_TCONTEXTVECTOR_HXX
+#define _XMLOFF_TCONTEXTVECTOR_HXX
+
+#include <rtl/ref.hxx>
+
+#include <vector>
+#include "TransformerContext.hxx"
+
+class XMLTransformerContextVector :
+ public ::std::vector< ::rtl::Reference< XMLTransformerContext > >
+{
+};
+
+#endif // _XMLOFF_TCONTEXTVECTOR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/Transformer.hxx b/xmloff/source/transform/Transformer.hxx
new file mode 100644
index 000000000000..1ebef98030a2
--- /dev/null
+++ b/xmloff/source/transform/Transformer.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_TRANSFORMER_HXX
+#define _XMLOFF_TRANSFORMER_HXX
+
+#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/implbase4.hxx>
+
+class XMLTransformer : public ::cppu::WeakImplHelper4<
+ ::com::sun::star::xml::sax::XExtendedDocumentHandler,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::lang::XInitialization,
+ ::com::sun::star::lang::XUnoTunnel>
+{
+};
+
+#endif // _XMLOFF_TRANSFORMER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/TransformerAction.hxx b/xmloff/source/transform/TransformerAction.hxx
new file mode 100644
index 000000000000..1b30d0adb560
--- /dev/null
+++ b/xmloff/source/transform/TransformerAction.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_TRANSFORMERACTION_HXX
+#define _XMLOFF_TRANSFORMERACTION_HXX
+
+#define XML_TACTION_EOT 0x0000
+#define XML_TACTION_END 0xffff
+
+
+#endif // _XMLOFF_TRANSFORMERACTION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/TransformerActionInit.hxx b/xmloff/source/transform/TransformerActionInit.hxx
new file mode 100644
index 000000000000..c4e10e739ffc
--- /dev/null
+++ b/xmloff/source/transform/TransformerActionInit.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_TRANSFORMERACTIONINIT_HXX
+#define _XMLOFF_TRANSFORMERACTIONINIT_HXX
+
+#include <xmloff/xmltoken.hxx>
+
+
+struct XMLTransformerActionInit
+{
+ sal_uInt16 m_nPrefix;
+ ::xmloff::token::XMLTokenEnum m_eLocalName;
+ sal_uInt32 m_nActionType;
+ sal_uInt32 m_nParam1;
+ sal_uInt32 m_nParam2;
+ sal_uInt32 m_nParam3;
+
+ static sal_Int32 QNameParam( sal_uInt16 nPrefix,
+ ::xmloff::token::XMLTokenEnum eLocalName )
+ {
+ return (static_cast< sal_uInt32 >( nPrefix ) << 16) +
+ static_cast< sal_uInt32 >( eLocalName );
+ }
+};
+
+#endif // _XMLOFF_TRANSFORMERACTIONINIT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/TransformerActions.cxx b/xmloff/source/transform/TransformerActions.cxx
new file mode 100644
index 000000000000..de8bcc3e8638
--- /dev/null
+++ b/xmloff/source/transform/TransformerActions.cxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "TransformerActions.hxx"
+
+
+using ::rtl::OUString;
+
+using namespace ::osl;
+using namespace ::xmloff::token;
+using namespace ::com::sun::star::uno;
+
+XMLTransformerActions::XMLTransformerActions( XMLTransformerActionInit *pInit )
+{
+ if( pInit )
+ {
+ XMLTransformerActions::key_type aKey;
+ XMLTransformerActions::mapped_type aData;
+ while( pInit->m_nActionType != XML_TACTION_EOT )
+ {
+ aKey.m_nPrefix = pInit->m_nPrefix;
+ aKey.SetLocalName( pInit->m_eLocalName );
+
+ OSL_ENSURE( find( aKey ) == end(), "duplicate action map entry" );
+
+ aData.m_nActionType = pInit->m_nActionType;
+ aData.m_nParam1 = pInit->m_nParam1;
+ aData.m_nParam2 = pInit->m_nParam2;
+ aData.m_nParam3 = pInit->m_nParam3;
+ XMLTransformerActions::value_type aVal( aKey, aData );
+
+ insert( aVal );
+ ++pInit;
+ }
+ }
+}
+
+XMLTransformerActions::~XMLTransformerActions()
+{
+}
+
+void XMLTransformerActions::Add( XMLTransformerActionInit *pInit )
+{
+ if( pInit )
+ {
+ XMLTransformerActions::key_type aKey;
+ XMLTransformerActions::mapped_type aData;
+ while( pInit->m_nActionType != XML_TACTION_EOT )
+ {
+ aKey.m_nPrefix = pInit->m_nPrefix;
+ aKey.SetLocalName( pInit->m_eLocalName );
+ XMLTransformerActions::iterator aIter = find( aKey );
+ if( aIter == end() )
+ {
+ aData.m_nActionType = pInit->m_nActionType;
+ aData.m_nParam1 = pInit->m_nParam1;
+ aData.m_nParam2 = pInit->m_nParam2;
+ aData.m_nParam3 = pInit->m_nParam3;
+ XMLTransformerActions::value_type aVal( aKey, aData );
+ insert( aVal );
+ }
+
+ ++pInit;
+ }
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/TransformerActions.hxx b/xmloff/source/transform/TransformerActions.hxx
new file mode 100644
index 000000000000..1fd68e006b6f
--- /dev/null
+++ b/xmloff/source/transform/TransformerActions.hxx
@@ -0,0 +1,164 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_TRANSFORMERACTIONS_HXX
+#define _XMLOFF_TRANSFORMERACTIONS_HXX
+
+#include <rtl/ustring.hxx>
+#include <xmloff/nmspmap.hxx>
+
+#include <boost/unordered_map.hpp>
+#include "TransformerActionInit.hxx"
+#include "TransformerAction.hxx"
+
+struct NameKey_Impl
+{
+ sal_uInt16 m_nPrefix;
+ ::rtl::OUString m_aLocalName;
+
+ inline NameKey_Impl( sal_uInt16 nPrfx,
+ ::xmloff::token::XMLTokenEnum eLclNm ) :
+ m_nPrefix( nPrfx ),
+ m_aLocalName( ::xmloff::token::GetXMLToken( eLclNm ) )
+ {
+ }
+
+ inline NameKey_Impl( sal_uInt16 nPrfx, const ::rtl::OUString& rLclNm ) :
+ m_nPrefix( nPrfx ),
+ m_aLocalName( rLclNm )
+ {
+ }
+
+ inline NameKey_Impl() :
+ m_nPrefix( XML_NAMESPACE_UNKNOWN )
+ {
+ }
+
+ inline void SetLocalName( ::xmloff::token::XMLTokenEnum eLclNm )
+ {
+ m_aLocalName = ::xmloff::token::GetXMLToken( eLclNm );
+ }
+};
+
+// -----------------------------------------------------------------------------
+
+struct NameHash_Impl
+{
+ inline size_t operator()( const NameKey_Impl& r ) const;
+ inline bool operator()( const NameKey_Impl& r1,
+ const NameKey_Impl& r2 ) const;
+};
+
+inline size_t NameHash_Impl::operator()( const NameKey_Impl& r ) const
+{
+ return static_cast< size_t >( r.m_nPrefix ) +
+ static_cast< size_t >( r.m_aLocalName.hashCode() );
+}
+
+inline bool NameHash_Impl::operator()(
+ const NameKey_Impl& r1,
+ const NameKey_Impl& r2 ) const
+{
+ return r1.m_nPrefix == r2.m_nPrefix && r1.m_aLocalName == r2.m_aLocalName;
+}
+
+// -----------------------------------------------------------------------------
+
+struct TransformerAction_Impl
+{
+ sal_uInt32 m_nActionType;
+ sal_uInt32 m_nParam1;
+ sal_uInt32 m_nParam2;
+ sal_uInt32 m_nParam3;
+
+ inline TransformerAction_Impl( sal_uInt32 nActnTp, sal_uInt32 nPrm1,
+ sal_uInt32 nPrm2, sal_uInt32 nPrm3 ) :
+ m_nActionType( nActnTp ),
+ m_nParam1( nPrm1 ),
+ m_nParam2( nPrm2 ),
+ m_nParam3( nPrm3 )
+ {
+
+ }
+ inline TransformerAction_Impl() :
+ m_nActionType( XML_TACTION_EOT ),
+ m_nParam1( 0 ),
+ m_nParam2( 0 ),
+ m_nParam3( 0 )
+ {
+ }
+
+ sal_uInt16 GetQNamePrefixFromParam1() const
+ {
+ return static_cast< sal_uInt16 >( m_nParam1 >> 16 );
+ }
+
+ sal_uInt16 GetQNamePrefixFromParam2() const
+ {
+ return static_cast< sal_uInt16 >( m_nParam2 >> 16 );
+ }
+
+ sal_uInt16 GetQNamePrefixFromParam3() const
+ {
+ return static_cast< sal_uInt16 >( m_nParam3 >> 16 );
+ }
+
+ ::xmloff::token::XMLTokenEnum GetQNameTokenFromParam1() const
+ {
+ return static_cast< ::xmloff::token::XMLTokenEnum>( m_nParam1 & 0xffff );
+ }
+
+ ::xmloff::token::XMLTokenEnum GetQNameTokenFromParam2() const
+ {
+ return static_cast< ::xmloff::token::XMLTokenEnum>( m_nParam2 & 0xffff );
+ }
+
+ ::xmloff::token::XMLTokenEnum GetQNameTokenFromParam3() const
+ {
+ return static_cast< ::xmloff::token::XMLTokenEnum>( m_nParam3 & 0xffff );
+ }
+
+};
+
+
+// -----------------------------------------------------------------------------
+
+class XMLTransformerActions :
+ public ::boost::unordered_map< NameKey_Impl, TransformerAction_Impl,
+ NameHash_Impl, NameHash_Impl >
+{
+public:
+ XMLTransformerActions( XMLTransformerActionInit *pInit );
+ ~XMLTransformerActions();
+
+ void Add( XMLTransformerActionInit *pInit );
+};
+
+#endif // _XMLOFF_TRANSFORMERACTIONS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/TransformerBase.cxx b/xmloff/source/transform/TransformerBase.cxx
new file mode 100644
index 000000000000..2761a3f234ef
--- /dev/null
+++ b/xmloff/source/transform/TransformerBase.cxx
@@ -0,0 +1,1477 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <rtl/ref.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/i18n/XCharacterClassification.hpp>
+#include <com/sun/star/i18n/UnicodeType.hpp>
+#include <comphelper/processfactory.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include "IgnoreTContext.hxx"
+#include "RenameElemTContext.hxx"
+#include "ProcAttrTContext.hxx"
+#include "ProcAddAttrTContext.hxx"
+#include "MergeElemTContext.hxx"
+#include "CreateElemTContext.hxx"
+#include "MutableAttrList.hxx"
+#include "TransformerActions.hxx"
+#include "ElemTransformerAction.hxx"
+#include "PropertyActionsOOo.hxx"
+#include "TransformerTokenMap.hxx"
+#include <xmloff/xmluconv.hxx>
+
+#include "TransformerBase.hxx"
+#include "TContextVector.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using namespace ::osl;
+using namespace ::xmloff::token;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::i18n;
+using namespace ::com::sun::star::xml::sax;
+
+namespace
+{
+bool lcl_ConvertAttr( OUString & rOutAttribute, sal_Int32 nParam )
+{
+ bool bResult = false;
+ enum XMLTokenEnum eTokenToRename =
+ static_cast< enum XMLTokenEnum >( nParam & 0xffff );
+ if( eTokenToRename != XML_TOKEN_INVALID &&
+ IsXMLToken( rOutAttribute, eTokenToRename ))
+ {
+ enum XMLTokenEnum eReplacementToken =
+ static_cast< enum XMLTokenEnum >( nParam >> 16 );
+ rOutAttribute = GetXMLToken( eReplacementToken );
+ bResult = true;
+ }
+ return bResult;
+}
+} // anonymous namespace
+
+XMLTransformerContext *XMLTransformerBase::CreateContext( sal_uInt16 nPrefix,
+ const OUString& rLocalName, const OUString& rQName )
+{
+ XMLTransformerActions::key_type aKey( nPrefix, rLocalName );
+ XMLTransformerActions::const_iterator aIter =
+ GetElemActions().find( aKey );
+
+ if( !(aIter == GetElemActions().end()) )
+ {
+ sal_uInt32 nActionType = (*aIter).second.m_nActionType;
+ if( (nActionType & XML_ETACTION_USER_DEFINED) != 0 )
+ {
+ XMLTransformerContext *pContext =
+ CreateUserDefinedContext( (*aIter).second,
+ rQName );
+ OSL_ENSURE( pContext && !pContext->IsPersistent(),
+ "unknown or not persistent action" );
+ return pContext;
+ }
+
+ switch( nActionType )
+ {
+ case XML_ETACTION_COPY_CONTENT:
+ return new XMLIgnoreTransformerContext( *this, rQName, sal_False,
+ sal_False );
+ case XML_ETACTION_COPY:
+ return new XMLTransformerContext( *this, rQName );
+ case XML_ETACTION_RENAME_ELEM:
+ return new XMLRenameElemTransformerContext( *this, rQName,
+ (*aIter).second.GetQNamePrefixFromParam1(),
+ (*aIter).second.GetQNameTokenFromParam1() );
+ case XML_ETACTION_RENAME_ELEM_ADD_ATTR:
+ return new XMLRenameElemTransformerContext( *this, rQName,
+ (*aIter).second.GetQNamePrefixFromParam1(),
+ (*aIter).second.GetQNameTokenFromParam1(),
+ (*aIter).second.GetQNamePrefixFromParam2(),
+ (*aIter).second.GetQNameTokenFromParam2(),
+ static_cast< XMLTokenEnum >( (*aIter).second.m_nParam3 ) );
+ case XML_ETACTION_RENAME_ELEM_PROC_ATTRS:
+ return new XMLProcAttrTransformerContext( *this, rQName,
+ (*aIter).second.GetQNamePrefixFromParam1(),
+ (*aIter).second.GetQNameTokenFromParam1(),
+ static_cast< sal_uInt16 >( (*aIter).second.m_nParam2 ) );
+ case XML_ETACTION_RENAME_ELEM_ADD_PROC_ATTR:
+ return new XMLProcAddAttrTransformerContext( *this, rQName,
+ (*aIter).second.GetQNamePrefixFromParam1(),
+ (*aIter).second.GetQNameTokenFromParam1(),
+ static_cast< sal_uInt16 >(
+ (*aIter).second.m_nParam3 >> 16 ),
+ (*aIter).second.GetQNamePrefixFromParam2(),
+ (*aIter).second.GetQNameTokenFromParam2(),
+ static_cast< XMLTokenEnum >(
+ (*aIter).second.m_nParam3 & 0xffff ) );
+ case XML_ETACTION_RENAME_ELEM_COND:
+ {
+ const XMLTransformerContext *pCurrent = GetCurrentContext();
+ if( pCurrent->HasQName(
+ (*aIter).second.GetQNamePrefixFromParam2(),
+ (*aIter).second.GetQNameTokenFromParam2() ) )
+ return new XMLRenameElemTransformerContext( *this, rQName,
+ (*aIter).second.GetQNamePrefixFromParam1(),
+ (*aIter).second.GetQNameTokenFromParam1() );
+ }
+ break;
+ case XML_ETACTION_RENAME_ELEM_PROC_ATTRS_COND:
+ {
+ const XMLTransformerContext *pCurrent = GetCurrentContext();
+ if( pCurrent->HasQName(
+ (*aIter).second.GetQNamePrefixFromParam3(),
+ (*aIter).second.GetQNameTokenFromParam3() ) )
+ return new XMLProcAttrTransformerContext( *this, rQName,
+ (*aIter).second.GetQNamePrefixFromParam1(),
+ (*aIter).second.GetQNameTokenFromParam1(),
+ static_cast< sal_uInt16 >( (*aIter).second.m_nParam2 ) );
+ else
+ return new XMLProcAttrTransformerContext( *this, rQName,
+ static_cast< sal_uInt16 >( (*aIter).second.m_nParam2 ) );
+ }
+ case XML_ETACTION_PROC_ATTRS:
+ return new XMLProcAttrTransformerContext( *this, rQName,
+ static_cast< sal_uInt16 >( (*aIter).second.m_nParam1 ) );
+ case XML_ETACTION_PROC_ATTRS_COND:
+ {
+ const XMLTransformerContext *pCurrent = GetCurrentContext();
+ if( pCurrent->HasQName(
+ (*aIter).second.GetQNamePrefixFromParam1(),
+ (*aIter).second.GetQNameTokenFromParam1() ) )
+ return new XMLProcAttrTransformerContext( *this, rQName,
+ static_cast< sal_uInt16 >( (*aIter).second.m_nParam2 ) );
+ }
+ break;
+ case XML_ETACTION_MOVE_ATTRS_TO_ELEMS:
+ return new XMLCreateElemTransformerContext( *this, rQName,
+ static_cast< sal_uInt16 >( (*aIter).second.m_nParam1 ) );
+ case XML_ETACTION_MOVE_ELEMS_TO_ATTRS:
+ return new XMLMergeElemTransformerContext( *this, rQName,
+ static_cast< sal_uInt16 >( (*aIter).second.m_nParam1 ) );
+ default:
+ OSL_ENSURE( !this, "unknown action" );
+ break;
+ }
+ }
+
+ // default is copying
+ return new XMLTransformerContext( *this, rQName );
+}
+
+XMLTransformerActions *XMLTransformerBase::GetUserDefinedActions( sal_uInt16 )
+{
+ return 0;
+}
+
+XMLTransformerBase::XMLTransformerBase( XMLTransformerActionInit *pInit,
+ ::xmloff::token::XMLTokenEnum *pTKMapInit )
+ throw () :
+ m_pNamespaceMap( new SvXMLNamespaceMap ),
+ m_pReplaceNamespaceMap( new SvXMLNamespaceMap ),
+ m_pContexts( new XMLTransformerContextVector ),
+ m_pElemActions( new XMLTransformerActions( pInit ) ),
+ m_pTokenMap( new XMLTransformerTokenMap( pTKMapInit ) )
+{
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_XLINK), GetXMLToken(XML_N_XLINK), XML_NAMESPACE_XLINK );
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_DC), GetXMLToken(XML_N_DC), XML_NAMESPACE_DC );
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_MATH), GetXMLToken(XML_N_MATH), XML_NAMESPACE_MATH );
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_OOO), GetXMLToken(XML_N_OOO), XML_NAMESPACE_OOO );
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_DOM), GetXMLToken(XML_N_DOM), XML_NAMESPACE_DOM );
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_OOOW), GetXMLToken(XML_N_OOOW), XML_NAMESPACE_OOOW );
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_OOOC), GetXMLToken(XML_N_OOOC), XML_NAMESPACE_OOOC );
+}
+
+XMLTransformerBase::~XMLTransformerBase() throw ()
+{
+ ResetTokens();
+
+ delete m_pNamespaceMap;
+ delete m_pReplaceNamespaceMap;
+ delete m_pContexts;
+ delete m_pElemActions;
+ delete m_pTokenMap;
+}
+
+void SAL_CALL XMLTransformerBase::startDocument( void )
+ throw( SAXException, RuntimeException )
+{
+ m_xHandler->startDocument();
+}
+
+void SAL_CALL XMLTransformerBase::endDocument( void )
+ throw( SAXException, RuntimeException)
+{
+ m_xHandler->endDocument();
+}
+
+void SAL_CALL XMLTransformerBase::startElement( const OUString& rName,
+ const Reference< XAttributeList >& rAttrList )
+ throw(SAXException, RuntimeException)
+{
+ SvXMLNamespaceMap *pRewindMap = 0;
+
+ // Process namespace attributes. This must happen before creating the
+ // context, because namespace decaration apply to the element name itself.
+ XMLMutableAttributeList *pMutableAttrList = 0;
+ Reference< XAttributeList > xAttrList( rAttrList );
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ if( ( rAttrName.getLength() >= 5 ) &&
+ ( rAttrName.compareTo( GetXMLToken(XML_XMLNS), 5 ) == 0 ) &&
+ ( rAttrName.getLength() == 5 || ':' == rAttrName[5] ) )
+ {
+ if( !pRewindMap )
+ {
+ pRewindMap = m_pNamespaceMap;
+ m_pNamespaceMap = new SvXMLNamespaceMap( *m_pNamespaceMap );
+ }
+ const OUString& rAttrValue = xAttrList->getValueByIndex( i );
+
+ OUString aPrefix( ( rAttrName.getLength() == 5 )
+ ? OUString()
+ : rAttrName.copy( 6 ) );
+ // Add namespace, but only if it is known.
+ sal_uInt16 nKey = m_pNamespaceMap->AddIfKnown( aPrefix, rAttrValue );
+ // If namespace is unknwon, try to match a name with similar
+ // TC Id an version
+ if( XML_NAMESPACE_UNKNOWN == nKey )
+ {
+ OUString aTestName( rAttrValue );
+ if( SvXMLNamespaceMap::NormalizeOasisURN( aTestName ) )
+ nKey = m_pNamespaceMap->AddIfKnown( aPrefix, aTestName );
+ }
+ // If that namespace is not known, too, add it as unknown
+ if( XML_NAMESPACE_UNKNOWN == nKey )
+ nKey = m_pNamespaceMap->Add( aPrefix, rAttrValue );
+
+ const OUString& rRepName = m_pReplaceNamespaceMap->GetNameByKey( nKey );
+ if( rRepName.getLength() )
+ {
+ if( !pMutableAttrList )
+ {
+ pMutableAttrList = new XMLMutableAttributeList( xAttrList );
+ xAttrList = pMutableAttrList;
+ }
+
+ pMutableAttrList->SetValueByIndex( i, rRepName );
+ }
+ }
+ }
+
+ // Get element's namespace and local name.
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ m_pNamespaceMap->GetKeyByAttrName( rName, &aLocalName );
+
+ // If there are contexts already, call a CreateChildContext at the topmost
+ // context. Otherwise, create a default context.
+ ::rtl::Reference < XMLTransformerContext > xContext;
+ if( !m_pContexts->empty() )
+ {
+ xContext = m_pContexts->back()->CreateChildContext( nPrefix,
+ aLocalName,
+ rName,
+ xAttrList );
+ }
+ else
+ {
+ xContext = CreateContext( nPrefix, aLocalName, rName );
+ }
+
+ OSL_ENSURE( xContext.is(), "XMLTransformerBase::startElement: missing context" );
+ if( !xContext.is() )
+ xContext = new XMLTransformerContext( *this, rName );
+
+ // Remeber old namespace map.
+ if( pRewindMap )
+ xContext->SetRewindMap( pRewindMap );
+
+ // Push context on stack.
+ m_pContexts->push_back( xContext );
+
+ // Call a startElement at the new context.
+ xContext->StartElement( xAttrList );
+}
+
+void SAL_CALL XMLTransformerBase::endElement( const OUString&
+#ifdef DBG_UTIL
+rName
+#endif
+)
+ throw(SAXException, RuntimeException)
+{
+ if( !m_pContexts->empty() )
+ {
+ // Get topmost context
+ ::rtl::Reference< XMLTransformerContext > xContext = m_pContexts->back();
+
+#ifdef DBG_UTIL
+ OSL_ENSURE( xContext->GetQName() == rName,
+ "XMLTransformerBase::endElement: popped context has wrong lname" );
+#endif
+
+ // Call a EndElement at the current context.
+ xContext->EndElement();
+
+ // and remove it from the stack.
+ m_pContexts->pop_back();
+
+ // Get a namespace map to rewind.
+ SvXMLNamespaceMap *pRewindMap = xContext->GetRewindMap();
+
+ // Delete the current context.
+ xContext = 0;
+
+ // Rewind a namespace map.
+ if( pRewindMap )
+ {
+ delete m_pNamespaceMap;
+ m_pNamespaceMap = pRewindMap;
+ }
+ }
+}
+
+void SAL_CALL XMLTransformerBase::characters( const OUString& rChars )
+ throw(SAXException, RuntimeException)
+{
+ if( !m_pContexts->empty() )
+ {
+ m_pContexts->back()->Characters( rChars );
+ }
+}
+
+void SAL_CALL XMLTransformerBase::ignorableWhitespace( const OUString& rWhitespaces )
+ throw(SAXException, RuntimeException)
+{
+ m_xHandler->ignorableWhitespace( rWhitespaces );
+}
+
+void SAL_CALL XMLTransformerBase::processingInstruction( const OUString& rTarget,
+ const OUString& rData )
+ throw(SAXException, RuntimeException)
+{
+ m_xHandler->processingInstruction( rTarget, rData );
+}
+
+void SAL_CALL XMLTransformerBase::setDocumentLocator( const Reference< XLocator >& rLocator )
+ throw(SAXException, RuntimeException)
+{
+ m_xLocator = rLocator;
+}
+
+// XExtendedDocumentHandler
+void SAL_CALL XMLTransformerBase::startCDATA( void ) throw(SAXException, RuntimeException)
+{
+ if( m_xExtHandler.is() )
+ m_xExtHandler->startCDATA();
+}
+
+void SAL_CALL XMLTransformerBase::endCDATA( void ) throw(RuntimeException)
+{
+ if( m_xExtHandler.is() )
+ m_xExtHandler->endCDATA();
+}
+
+void SAL_CALL XMLTransformerBase::comment( const OUString& rComment )
+ throw(SAXException, RuntimeException)
+{
+ if( m_xExtHandler.is() )
+ m_xExtHandler->comment( rComment );
+}
+
+void SAL_CALL XMLTransformerBase::allowLineBreak( void )
+ throw(SAXException, RuntimeException)
+{
+ if( m_xExtHandler.is() )
+ m_xExtHandler->allowLineBreak();
+}
+
+void SAL_CALL XMLTransformerBase::unknown( const OUString& rString )
+ throw(SAXException, RuntimeException)
+{
+ if( m_xExtHandler.is() )
+ m_xExtHandler->unknown( rString );
+}
+
+// XInitialize
+void SAL_CALL XMLTransformerBase::initialize( const Sequence< Any >& aArguments )
+ throw(Exception, RuntimeException)
+{
+ const sal_Int32 nAnyCount = aArguments.getLength();
+ const Any* pAny = aArguments.getConstArray();
+
+ for( sal_Int32 nIndex = 0; nIndex < nAnyCount; nIndex++, pAny++ )
+ {
+ // #b6236750# use isAssignableFrom instead of comparing the types to
+ // allow XExtendedDocumentHandler instead of XDocumentHandler (used in
+ // writeOasis2OOoLibraryElement in sfx2).
+ // The Any shift operator can't be used to query the type because it
+ // uses queryInterface, and the model also has a XPropertySet interface.
+
+ // document handler
+ if( ::getCppuType( (const Reference< XDocumentHandler >*) 0 ).isAssignableFrom( pAny->getValueType() ) )
+ m_xHandler.set( *pAny, UNO_QUERY );
+
+ // property set to transport data across
+ if( ::getCppuType( (const Reference< XPropertySet >*) 0 ).isAssignableFrom( pAny->getValueType() ) )
+ m_xPropSet.set( *pAny, UNO_QUERY );
+
+ // xmodel
+ if( ::getCppuType( (const Reference< ::com::sun::star::frame::XModel >*) 0 ).isAssignableFrom( pAny->getValueType() ) )
+ mxModel.set( *pAny, UNO_QUERY );
+ }
+
+ if( m_xPropSet.is() )
+ {
+ Any aAny;
+ OUString sRelPath, sName;
+ Reference< XPropertySetInfo > xPropSetInfo =
+ m_xPropSet->getPropertySetInfo();
+ OUString sPropName( RTL_CONSTASCII_USTRINGPARAM("StreamRelPath" ) );
+ if( xPropSetInfo->hasPropertyByName(sPropName) )
+ {
+ aAny = m_xPropSet->getPropertyValue(sPropName);
+ aAny >>= sRelPath;
+ }
+ sPropName = OUString( RTL_CONSTASCII_USTRINGPARAM("StreamName" ) );
+ if( xPropSetInfo->hasPropertyByName(sPropName) )
+ {
+ aAny = m_xPropSet->getPropertyValue(sPropName);
+ aAny >>= sName;
+ }
+ if( sName.getLength() )
+ {
+ m_aExtPathPrefix = OUString( RTL_CONSTASCII_USTRINGPARAM("../" ) );
+
+ // If there is a rel path within a package, then append
+ // additional '../'. If the rel path contains an ':', then it is
+ // an absolute URI (or invalid URI, because zip files don't
+ // permit ':'), and it will be ignored.
+ if( sRelPath.getLength() )
+ {
+ sal_Int32 nColPos = sRelPath.indexOf( ':' );
+ OSL_ENSURE( -1 == nColPos,
+ "StreamRelPath contains ':', absolute URI?" );
+
+ if( -1 == nColPos )
+ {
+ OUString sTmp = m_aExtPathPrefix;
+ sal_Int32 nPos = 0;
+ do
+ {
+ m_aExtPathPrefix += sTmp;
+ nPos = sRelPath.indexOf( '/', nPos + 1 );
+ }
+ while( -1 != nPos );
+ }
+ }
+
+ }
+ }
+}
+
+static MapUnit lcl_getUnit( const OUString& rValue )
+{
+ MapUnit nDestUnit;
+ if( rValue.endsWithIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "cm" ) ) )
+ nDestUnit = MAP_CM;
+ else if ( rValue.endsWithIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "mm" ) ) )
+ nDestUnit = MAP_MM;
+ else
+ nDestUnit = MAP_INCH;
+ return nDestUnit;
+}
+
+XMLMutableAttributeList *XMLTransformerBase::ProcessAttrList(
+ Reference< XAttributeList >& rAttrList, sal_uInt16 nActionMap,
+ sal_Bool bClone )
+{
+ XMLMutableAttributeList *pMutableAttrList = 0;
+ XMLTransformerActions *pActions = GetUserDefinedActions( nActionMap );
+ OSL_ENSURE( pActions, "go no actions" );
+ if( pActions )
+ {
+ sal_Int16 nAttrCount = rAttrList.is() ? rAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; ++i )
+ {
+ const OUString& rAttrName = rAttrList->getNameByIndex( i );
+ const OUString& rAttrValue = rAttrList->getValueByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+
+ XMLTransformerActions::key_type aKey( nPrefix, aLocalName );
+ XMLTransformerActions::const_iterator aIter =
+ pActions->find( aKey );
+ if( !(aIter == pActions->end() ) )
+ {
+ if( !pMutableAttrList )
+ {
+ pMutableAttrList = new XMLMutableAttributeList( rAttrList,
+ bClone );
+ rAttrList = pMutableAttrList;
+ }
+
+ sal_uInt32 nAction = (*aIter).second.m_nActionType;
+ sal_Bool bRename = sal_False;
+ switch( nAction )
+ {
+ case XML_ATACTION_RENAME:
+ bRename = sal_True;
+ break;
+ case XML_ATACTION_COPY:
+ break;
+ case XML_ATACTION_REMOVE:
+ case XML_ATACTION_STYLE_DISPLAY_NAME:
+ pMutableAttrList->RemoveAttributeByIndex( i );
+ --i;
+ --nAttrCount;
+ break;
+ case XML_ATACTION_RENAME_IN2INCH:
+ bRename = sal_True;
+ case XML_ATACTION_IN2INCH:
+ {
+ OUString aAttrValue( rAttrValue );
+ if( ReplaceSingleInWithInch( aAttrValue ) )
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_INS2INCHS:
+ {
+ OUString aAttrValue( rAttrValue );
+ if( ReplaceInWithInch( aAttrValue ) )
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_RENAME_INCH2IN:
+ bRename = sal_True;
+ case XML_ATACTION_INCH2IN:
+ {
+ OUString aAttrValue( rAttrValue );
+ if( ReplaceSingleInchWithIn( aAttrValue ) )
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_INCHS2INS:
+ {
+ OUString aAttrValue( rAttrValue );
+ if( ReplaceInchWithIn( aAttrValue ) )
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_TWIPS2IN:
+ {
+ OUString aAttrValue( rAttrValue );
+
+ XMLTransformerBase::ReplaceSingleInchWithIn( aAttrValue );
+ if( isWriter() )
+ {
+ MapUnit nDestUnit = lcl_getUnit( aAttrValue );
+
+ // convert twips value to inch
+ sal_Int32 nMeasure;
+ if( SvXMLUnitConverter::convertMeasure(nMeasure, aAttrValue, MAP_100TH_MM ) )
+ {
+
+ // #i13778#,#i36248# apply correct twip-to-1/100mm
+ nMeasure = (sal_Int32)( nMeasure >= 0
+ ? ((nMeasure*127+36)/72)
+ : ((nMeasure*127-36)/72) );
+
+ rtl::OUStringBuffer aBuffer;
+ SvXMLUnitConverter::convertMeasure( aBuffer, nMeasure, MAP_100TH_MM, nDestUnit );
+ aAttrValue = aBuffer.makeStringAndClear();
+ }
+ }
+
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_RENAME_DECODE_STYLE_NAME_REF:
+ bRename = sal_True;
+ case XML_ATACTION_DECODE_STYLE_NAME:
+ case XML_ATACTION_DECODE_STYLE_NAME_REF:
+ {
+ OUString aAttrValue( rAttrValue );
+ if( DecodeStyleName(aAttrValue) )
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_ENCODE_STYLE_NAME:
+ {
+ OUString aAttrValue( rAttrValue );
+ if( EncodeStyleName(aAttrValue) )
+ {
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ OUString aNewAttrQName(
+ GetNamespaceMap().GetQNameByKey(
+ nPrefix,
+ ::xmloff::token::GetXMLToken(
+ XML_DISPLAY_NAME ) ) );
+ pMutableAttrList->AddAttribute( aNewAttrQName,
+ rAttrValue );
+ }
+ }
+ break;
+ case XML_ATACTION_RENAME_ENCODE_STYLE_NAME_REF:
+ bRename = sal_True;
+ case XML_ATACTION_ENCODE_STYLE_NAME_REF:
+ {
+ OUString aAttrValue( rAttrValue );
+ if( EncodeStyleName(aAttrValue) )
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_RENAME_NEG_PERCENT:
+ bRename = sal_True;
+ case XML_ATACTION_NEG_PERCENT:
+ {
+ OUString aAttrValue( rAttrValue );
+ if( NegPercent( aAttrValue ) )
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_RENAME_ADD_NAMESPACE_PREFIX:
+ bRename = sal_True;
+ case XML_ATACTION_ADD_NAMESPACE_PREFIX:
+ {
+ OUString aAttrValue( rAttrValue );
+ sal_uInt16 nValPrefix =
+ static_cast<sal_uInt16>(
+ bRename ? (*aIter).second.m_nParam2
+ : (*aIter).second.m_nParam1);
+ if( AddNamespacePrefix( aAttrValue, nValPrefix ) )
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_ADD_APP_NAMESPACE_PREFIX:
+ {
+ OUString aAttrValue( rAttrValue );
+ sal_uInt16 nValPrefix =
+ static_cast<sal_uInt16>((*aIter).second.m_nParam1);
+ if( IsXMLToken( GetClass(), XML_SPREADSHEET ) )
+ nValPrefix = XML_NAMESPACE_OOOC;
+ else if( IsXMLToken( GetClass(), XML_TEXT ) )
+ nValPrefix = XML_NAMESPACE_OOOW;
+ if( AddNamespacePrefix( aAttrValue, nValPrefix ) )
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_RENAME_REMOVE_NAMESPACE_PREFIX:
+ bRename = sal_True;
+ case XML_ATACTION_REMOVE_NAMESPACE_PREFIX:
+ {
+ OUString aAttrValue( rAttrValue );
+ sal_uInt16 nValPrefix =
+ static_cast<sal_uInt16>(
+ bRename ? (*aIter).second.m_nParam2
+ : (*aIter).second.m_nParam1);
+ if( RemoveNamespacePrefix( aAttrValue, nValPrefix ) )
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_REMOVE_ANY_NAMESPACE_PREFIX:
+ {
+ OUString aAttrValue( rAttrValue );
+ if( RemoveNamespacePrefix( aAttrValue ) )
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_URI_OOO:
+ {
+ OUString aAttrValue( rAttrValue );
+ if( ConvertURIToOASIS( aAttrValue,
+ static_cast< sal_Bool >((*aIter).second.m_nParam1)))
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_URI_OASIS:
+ {
+ OUString aAttrValue( rAttrValue );
+ if( ConvertURIToOOo( aAttrValue,
+ static_cast< sal_Bool >((*aIter).second.m_nParam1)))
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_RENAME_ATTRIBUTE:
+ {
+ OUString aAttrValue( rAttrValue );
+ RenameAttributeValue(
+ aAttrValue,
+ (*aIter).second.m_nParam1,
+ (*aIter).second.m_nParam2,
+ (*aIter).second.m_nParam3 );
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_RNG2ISO_DATETIME:
+ {
+ OUString aAttrValue( rAttrValue );
+ if( ConvertRNGDateTimeToISO( aAttrValue ))
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_RENAME_RNG2ISO_DATETIME:
+ {
+ OUString aAttrValue( rAttrValue );
+ if( ConvertRNGDateTimeToISO( aAttrValue ))
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ bRename = sal_True;
+ }
+ break;
+ case XML_ATACTION_IN2TWIPS:
+ {
+ OUString aAttrValue( rAttrValue );
+ XMLTransformerBase::ReplaceSingleInWithInch( aAttrValue );
+
+ if( isWriter() )
+ {
+ MapUnit nDestUnit = lcl_getUnit( aAttrValue );
+
+ // convert inch value to twips and export as faked inch
+ sal_Int32 nMeasure;
+ if( SvXMLUnitConverter::convertMeasure(nMeasure, aAttrValue, MAP_100TH_MM ) )
+ {
+
+ // #i13778#,#i36248#/ apply correct 1/100mm-to-twip conversion
+ nMeasure = (sal_Int32)( nMeasure >= 0
+ ? ((nMeasure*72+63)/127)
+ : ((nMeasure*72-63)/127) );
+
+ OUStringBuffer aBuffer;
+ SvXMLUnitConverter::convertMeasure( aBuffer, nMeasure, MAP_100TH_MM, nDestUnit );
+ aAttrValue = aBuffer.makeStringAndClear();
+ }
+ }
+
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_SVG_WIDTH_HEIGHT_OOO:
+ {
+ OUString aAttrValue( rAttrValue );
+ ReplaceSingleInchWithIn( aAttrValue );
+
+ MapUnit nDestUnit = lcl_getUnit( aAttrValue );
+
+ sal_Int32 nMeasure;
+ if( SvXMLUnitConverter::convertMeasure(nMeasure, aAttrValue, MAP_100TH_MM ) )
+ {
+
+ if( nMeasure > 0 )
+ nMeasure -= 1;
+ else if( nMeasure < 0 )
+ nMeasure += 1;
+
+
+ OUStringBuffer aBuffer;
+ SvXMLUnitConverter::convertMeasure( aBuffer, nMeasure, MAP_100TH_MM, nDestUnit );
+ aAttrValue = aBuffer.makeStringAndClear();
+ }
+
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_SVG_WIDTH_HEIGHT_OASIS:
+ {
+ OUString aAttrValue( rAttrValue );
+ ReplaceSingleInWithInch( aAttrValue );
+
+ MapUnit nDestUnit = lcl_getUnit( aAttrValue );
+
+ sal_Int32 nMeasure;
+ if( SvXMLUnitConverter::convertMeasure(nMeasure, aAttrValue, MAP_100TH_MM ) )
+ {
+
+ if( nMeasure > 0 )
+ nMeasure += 1;
+ else if( nMeasure < 0 )
+ nMeasure -= 1;
+
+
+ OUStringBuffer aBuffer;
+ SvXMLUnitConverter::convertMeasure( aBuffer, nMeasure, MAP_100TH_MM, nDestUnit );
+ aAttrValue = aBuffer.makeStringAndClear();
+ }
+
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ break;
+ case XML_ATACTION_DECODE_ID:
+ {
+ OUString aAttrValue;
+
+ const sal_Int32 nLen = rAttrValue.getLength();
+ OUStringBuffer aBuffer;
+
+ sal_Int32 pos;
+ for( pos = 0; pos < nLen; pos++ )
+ {
+ sal_Unicode c = rAttrValue[pos];
+ if( (c >= '0') && (c <= '9') )
+ aBuffer.append( c );
+ else
+ aBuffer.append( (sal_Int32)c );
+ }
+
+ pMutableAttrList->SetValueByIndex( i, aBuffer.makeStringAndClear() );
+ }
+ break;
+ // #i50322# - special handling for the
+ // transparency of writer background graphics.
+ case XML_ATACTION_WRITER_BACK_GRAPHIC_TRANSPARENCY:
+ {
+ // determine, if it's the transparency of a document style
+ XMLTransformerContext* pFirstContext = (*m_pContexts)[0].get();
+ OUString aFirstContextLocalName;
+ /* sal_uInt16 nFirstContextPrefix = */
+ GetNamespaceMap().GetKeyByAttrName( pFirstContext->GetQName(),
+ &aFirstContextLocalName );
+ bool bIsDocumentStyle(
+ ::xmloff::token::IsXMLToken( aFirstContextLocalName,
+ XML_DOCUMENT_STYLES ) );
+ // no conversion of transparency value for document
+ // styles, because former OpenOffice.org version writes
+ // writes always a transparency value of 100% and doesn't
+ // read the value. Thus, it's intepreted as 0%
+ if ( !bIsDocumentStyle )
+ {
+ OUString aAttrValue( rAttrValue );
+ NegPercent(aAttrValue);
+ pMutableAttrList->SetValueByIndex( i, aAttrValue );
+ }
+ bRename = sal_True;
+ }
+ break;
+ default:
+ OSL_ENSURE( !this, "unknown action" );
+ break;
+ }
+
+ if( bRename )
+ {
+ OUString aNewAttrQName(
+ GetNamespaceMap().GetQNameByKey(
+ (*aIter).second.GetQNamePrefixFromParam1(),
+ ::xmloff::token::GetXMLToken(
+ (*aIter).second.GetQNameTokenFromParam1()) ) );
+ pMutableAttrList->RenameAttributeByIndex( i,
+ aNewAttrQName );
+ }
+ }
+ }
+ }
+
+ return pMutableAttrList;
+}
+
+sal_Bool XMLTransformerBase::ReplaceSingleInchWithIn( OUString& rValue )
+{
+ sal_Bool bRet = sal_False;
+ sal_Int32 nPos = rValue.getLength();
+ while( nPos && rValue[nPos-1] <= ' ' )
+ --nPos;
+ if( nPos > 2 &&
+ ('c'==rValue[nPos-2] || 'C'==rValue[nPos-2]) &&
+ ('h'==rValue[nPos-1] || 'H'==rValue[nPos-1]) )
+ {
+ rValue =rValue.copy( 0, nPos-2 );
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLTransformerBase::ReplaceInchWithIn( OUString& rValue )
+{
+ sal_Bool bRet = sal_False;
+ sal_Int32 nPos = 1;
+ while( nPos < rValue.getLength()-3 )
+ {
+ sal_Unicode c = rValue[nPos];
+ if( 'i'==c || 'I'==c )
+ {
+ c = rValue[nPos-1];
+ if( (c >= '0' && c <= '9') || '.' == c )
+ {
+ c = rValue[nPos+1];
+ if( 'n'==c || 'N'==c )
+ {
+ c = rValue[nPos+2];
+ if( 'c'==c || 'C'==c )
+ {
+ c = rValue[nPos+3];
+ if( 'h'==c || 'H'==c )
+ {
+ rValue = rValue.replaceAt( nPos,
+ 4, GetXMLToken(XML_UNIT_INCH) );
+ nPos += 2;
+ bRet = sal_True;
+ continue;
+ }
+ }
+ }
+ }
+ }
+ ++nPos;
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLTransformerBase::ReplaceSingleInWithInch( OUString& rValue )
+{
+ sal_Bool bRet = sal_False;
+
+ sal_Int32 nPos = rValue.getLength();
+ while( nPos && rValue[nPos-1] <= ' ' )
+ --nPos;
+ if( nPos > 2 &&
+ ('i'==rValue[nPos-2] ||
+ 'I'==rValue[nPos-2]) &&
+ ('n'==rValue[nPos-1] ||
+ 'N'==rValue[nPos-1]) )
+ {
+ nPos -= 2;
+ rValue = rValue.replaceAt( nPos, rValue.getLength() - nPos,
+ GetXMLToken(XML_INCH) );
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLTransformerBase::ReplaceInWithInch( OUString& rValue )
+{
+ sal_Bool bRet = sal_False;
+ sal_Int32 nPos = 1;
+ while( nPos < rValue.getLength()-1 )
+ {
+ sal_Unicode c = rValue[nPos];
+ if( 'i'==c || 'I'==c )
+ {
+ c = rValue[nPos-1];
+ if( (c >= '0' && c <= '9') || '.' == c )
+ {
+ c = rValue[nPos+1];
+ if( 'n'==c || 'N'==c )
+ {
+ rValue = rValue.replaceAt( nPos,
+ 2, GetXMLToken(XML_INCH) );
+ nPos += 4;
+ bRet = sal_True;
+ continue;
+ }
+ }
+ }
+ ++nPos;
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLTransformerBase::EncodeStyleName( OUString& rName ) const
+{
+ static sal_Char aHexTab[] = "0123456789abcdef";
+
+ sal_Bool bEncoded = sal_False;
+
+ sal_Int32 nLen = rName.getLength();
+ OUStringBuffer aBuffer( nLen );
+
+ for( sal_Int32 i = 0; i < nLen; i++ )
+ {
+ sal_Unicode c = rName[i];
+ sal_Bool bValidChar = sal_False;
+ if( c < 0x00ffU )
+ {
+ bValidChar =
+ (c >= 0x0041 && c <= 0x005a) ||
+ (c >= 0x0061 && c <= 0x007a) ||
+ (c >= 0x00c0 && c <= 0x00d6) ||
+ (c >= 0x00d8 && c <= 0x00f6) ||
+ (c >= 0x00f8 && c <= 0x00ff) ||
+ ( i > 0 && ( (c >= 0x0030 && c <= 0x0039) ||
+ c == 0x00b7 || c == '-' || c == '.') );
+ }
+ else
+ {
+ if( (c >= 0xf900U && c <= 0xfffeU) ||
+ (c >= 0x20ddU && c <= 0x20e0U))
+ {
+ bValidChar = sal_False;
+ }
+ else if( (c >= 0x02bbU && c <= 0x02c1U) || c == 0x0559 ||
+ c == 0x06e5 || c == 0x06e6 )
+ {
+ bValidChar = sal_True;
+ }
+ else if( c == 0x0387 )
+ {
+ bValidChar = i > 0;
+ }
+ else
+ {
+ if( !xCharClass.is() )
+ {
+ Reference< XMultiServiceFactory > xFactory =
+ comphelper::getProcessServiceFactory();
+ if( xFactory.is() )
+ {
+ try
+ {
+ const_cast < XMLTransformerBase * >(this)
+ ->xCharClass =
+ Reference < XCharacterClassification >(
+ xFactory->createInstance(
+ OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.i18n.CharacterClassification_Unicode")) ),
+ UNO_QUERY );
+
+ OSL_ENSURE( xCharClass.is(),
+ "can't instantiate character clossification component" );
+ }
+ catch( com::sun::star::uno::Exception& )
+ {
+ }
+ }
+ }
+ if( xCharClass.is() )
+ {
+ sal_Int16 nType = xCharClass->getType( rName, i );
+
+ switch( nType )
+ {
+ case UnicodeType::UPPERCASE_LETTER: // Lu
+ case UnicodeType::LOWERCASE_LETTER: // Ll
+ case UnicodeType::TITLECASE_LETTER: // Lt
+ case UnicodeType::OTHER_LETTER: // Lo
+ case UnicodeType::LETTER_NUMBER: // Nl
+ bValidChar = sal_True;
+ break;
+ case UnicodeType::NON_SPACING_MARK: // Ms
+ case UnicodeType::ENCLOSING_MARK: // Me
+ case UnicodeType::COMBINING_SPACING_MARK: //Mc
+ case UnicodeType::MODIFIER_LETTER: // Lm
+ case UnicodeType::DECIMAL_DIGIT_NUMBER: // Nd
+ bValidChar = i > 0;
+ break;
+ }
+ }
+ }
+ }
+ if( bValidChar )
+ {
+ aBuffer.append( c );
+ }
+ else
+ {
+ aBuffer.append( static_cast< sal_Unicode >( '_' ) );
+ if( c > 0x0fff )
+ aBuffer.append( static_cast< sal_Unicode >(
+ aHexTab[ (c >> 12) & 0x0f ] ) );
+ if( c > 0x00ff )
+ aBuffer.append( static_cast< sal_Unicode >(
+ aHexTab[ (c >> 8) & 0x0f ] ) );
+ if( c > 0x000f )
+ aBuffer.append( static_cast< sal_Unicode >(
+ aHexTab[ (c >> 4) & 0x0f ] ) );
+ aBuffer.append( static_cast< sal_Unicode >(
+ aHexTab[ c & 0x0f ] ) );
+ aBuffer.append( static_cast< sal_Unicode >( '_' ) );
+ bEncoded = sal_True;
+ }
+ }
+
+ if( aBuffer.getLength() > (1<<15)-1 )
+ bEncoded = sal_False;
+
+ if( bEncoded )
+ rName = aBuffer.makeStringAndClear();
+ return bEncoded;
+}
+
+sal_Bool XMLTransformerBase::DecodeStyleName( OUString& rName )
+{
+ sal_Bool bEncoded = sal_False;
+
+ sal_Int32 nLen = rName.getLength();
+ OUStringBuffer aBuffer( nLen );
+
+ sal_Bool bWithinHex = sal_False;
+ sal_Unicode cEnc = 0;
+ for( sal_Int32 i = 0; i < nLen; i++ )
+ {
+ sal_Unicode c = rName[i];
+ if( '_' == c )
+ {
+ if( bWithinHex )
+ {
+ aBuffer.append( cEnc );
+ cEnc = 0;
+ }
+ else
+ {
+ bEncoded = sal_True;
+ }
+ bWithinHex = !bWithinHex;
+ }
+ else if( bWithinHex )
+ {
+ sal_Unicode cDigit;
+ if( c >= '0' && c <= '9' )
+ {
+ cDigit = c - '0';
+ }
+ else if( c >= 'a' && c <= 'f' )
+ {
+ cDigit = c - 'a' + 10;
+ }
+ else if( c >= 'A' && c <= 'F' )
+ {
+ cDigit = c - 'A' + 10;
+ }
+ else
+ {
+ // error
+ bEncoded = sal_False;
+ break;
+ }
+ cEnc = (cEnc << 4) + cDigit;
+ }
+ else
+ {
+ aBuffer.append( c );
+ }
+ }
+
+ if( bEncoded )
+ rName = aBuffer.makeStringAndClear();
+ return bEncoded;
+}
+
+sal_Bool XMLTransformerBase::NegPercent( OUString& rValue )
+{
+ sal_Bool bRet = sal_False;
+ sal_Bool bNeg = sal_False;
+ double nVal = 0;
+
+ sal_Int32 nPos = 0;
+ sal_Int32 nLen = rValue.getLength();
+
+ // skip white space
+ while( nPos < nLen && sal_Unicode(' ') == rValue[nPos] )
+ nPos++;
+
+ if( nPos < nLen && sal_Unicode('-') == rValue[nPos] )
+ {
+ bNeg = sal_True;
+ nPos++;
+ }
+
+ // get number
+ while( nPos < nLen &&
+ sal_Unicode('0') <= rValue[nPos] &&
+ sal_Unicode('9') >= rValue[nPos] )
+ {
+ // TODO: check overflow!
+ nVal *= 10;
+ nVal += (rValue[nPos] - sal_Unicode('0'));
+ nPos++;
+ }
+ double nDiv = 1.;
+ if( nPos < nLen && sal_Unicode('.') == rValue[nPos] )
+ {
+ nPos++;
+
+ while( nPos < nLen &&
+ sal_Unicode('0') <= rValue[nPos] &&
+ sal_Unicode('9') >= rValue[nPos] )
+ {
+ // TODO: check overflow!
+ nDiv *= 10;
+ nVal += ( static_cast<double>(rValue[nPos] - sal_Unicode('0')) / nDiv );
+ nPos++;
+ }
+ }
+
+ // skip white space
+ while( nPos < nLen && sal_Unicode(' ') == rValue[nPos] )
+ nPos++;
+
+ if( nPos < nLen && sal_Unicode('%') == rValue[nPos] )
+ {
+ if( bNeg )
+ nVal = -nVal;
+ nVal += .5;
+
+ sal_Int32 nIntVal = 100 - static_cast<sal_Int32>( nVal );
+
+ OUStringBuffer aNewValBuffer;
+ aNewValBuffer.append( nIntVal );
+ aNewValBuffer.append( sal_Unicode('%' ) );
+
+ rValue = aNewValBuffer.makeStringAndClear();
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLTransformerBase::AddNamespacePrefix( ::rtl::OUString& rName,
+ sal_uInt16 nPrefix ) const
+{
+ rName = GetNamespaceMap().GetQNameByKey( nPrefix, rName, sal_False );
+ return sal_True;
+}
+
+sal_Bool XMLTransformerBase::RemoveNamespacePrefix( ::rtl::OUString& rName,
+ sal_uInt16 nPrefixOnly ) const
+{
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetNamespaceMap()._GetKeyByAttrName( rName, &aLocalName, sal_False );
+ sal_Bool bRet = XML_NAMESPACE_UNKNOWN != nPrefix &&
+ (USHRT_MAX == nPrefixOnly || nPrefix == nPrefixOnly);
+ if( bRet )
+ rName = aLocalName;
+
+ return bRet;
+}
+
+sal_Bool XMLTransformerBase::ConvertURIToOASIS( ::rtl::OUString& rURI,
+ sal_Bool bSupportPackage ) const
+{
+ sal_Bool bRet = sal_False;
+ if( m_aExtPathPrefix.getLength() && rURI.getLength() )
+ {
+ sal_Bool bRel = sal_False;
+ switch( rURI[0] )
+ {
+ case '#':
+ // no rel path, but
+ // for package URIs, the '#' has to be removed
+ if( bSupportPackage )
+ {
+ rURI = rURI.copy( 1 );
+ bRet = sal_True;
+ }
+ break;
+ case '/':
+ // no rel path; nothing to do
+ break;
+ case '.':
+ // a rel path; to keep URI simple, remove './', if there
+ bRel = sal_True;
+ if( rURI.getLength() > 1 && '/' == rURI[1] )
+ {
+ rURI = rURI.copy( 2 );
+ bRet = sal_True;
+ }
+ break;
+ default:
+ // check for a RFC2396 schema
+ {
+ bRel = sal_True;
+ sal_Int32 nPos = 1;
+ sal_Int32 nLen = rURI.getLength();
+ while( nPos < nLen )
+ {
+ switch( rURI[nPos] )
+ {
+ case '/':
+ // a relative path segement
+ nPos = nLen; // leave loop
+ break;
+ case ':':
+ // a schema
+ bRel = sal_False;
+ nPos = nLen; // leave loop
+ break;
+ default:
+ // we don't care about any other characters
+ break;
+ }
+ ++nPos;
+ }
+ }
+ }
+
+ if( bRel )
+ {
+ OUString sTmp( m_aExtPathPrefix );
+ sTmp += rURI;
+ rURI = sTmp;
+ bRet = sal_True;
+ }
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLTransformerBase::ConvertURIToOOo( ::rtl::OUString& rURI,
+ sal_Bool bSupportPackage ) const
+{
+ sal_Bool bRet = sal_False;
+ if( rURI.getLength() )
+ {
+ sal_Bool bPackage = sal_False;
+ switch( rURI[0] )
+ {
+ case '/':
+ // no rel path; nothing to to
+ break;
+ case '.':
+ // a rel path
+ if( 0 == rURI.compareTo( m_aExtPathPrefix,
+ m_aExtPathPrefix.getLength() ) )
+ {
+ // an external URI; remove '../'
+ rURI = rURI.copy( m_aExtPathPrefix.getLength() );
+ bRet = sal_True;
+ }
+ else
+ {
+ bPackage = sal_True;
+ }
+ break;
+ default:
+ // check for a RFC2396 schema
+ {
+ bPackage = sal_True;
+ sal_Int32 nPos = 1;
+ sal_Int32 nLen = rURI.getLength();
+ while( nPos < nLen )
+ {
+ switch( rURI[nPos] )
+ {
+ case '/':
+ // a relative path segement within the package
+ nPos = nLen; // leave loop
+ break;
+ case ':':
+ // a schema
+ bPackage = sal_False;
+ nPos = nLen; // leave loop
+ break;
+ default:
+ // we don't care about any other characters
+ break;
+ }
+ ++nPos;
+ }
+ }
+ }
+
+ if( bPackage && bSupportPackage )
+ {
+ OUString sTmp( OUString::valueOf( sal_Unicode( '#' ) ) );
+ if( 0 == rURI.compareToAscii( "./", 2 ) )
+ rURI = rURI.copy( 2 );
+ sTmp += rURI;
+ rURI = sTmp;
+ bRet = sal_True;
+ }
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLTransformerBase::RenameAttributeValue(
+ OUString& rOutAttributeValue,
+ sal_Int32 nParam1,
+ sal_Int32 nParam2,
+ sal_Int32 nParam3 )
+{
+ return ( lcl_ConvertAttr( rOutAttributeValue, nParam1) ||
+ lcl_ConvertAttr( rOutAttributeValue, nParam2) ||
+ lcl_ConvertAttr( rOutAttributeValue, nParam3) );
+}
+
+// static
+bool XMLTransformerBase::ConvertRNGDateTimeToISO( ::rtl::OUString& rDateTime )
+{
+ if( rDateTime.getLength() > 0 &&
+ rDateTime.indexOf( sal_Unicode('.')) != -1 )
+ {
+ rDateTime = rDateTime.replace( sal_Unicode('.'), sal_Unicode(','));
+ return true;
+ }
+
+ return false;
+}
+
+XMLTokenEnum XMLTransformerBase::GetToken( const OUString& rStr ) const
+{
+ XMLTransformerTokenMap::const_iterator aIter =
+ m_pTokenMap->find( rStr );
+ if( aIter == m_pTokenMap->end() )
+ return XML_TOKEN_END;
+ else
+ return (*aIter).second;
+}
+
+
+
+const XMLTransformerContext *XMLTransformerBase::GetCurrentContext() const
+{
+ OSL_ENSURE( !m_pContexts->empty(), "empty stack" );
+
+
+ return m_pContexts->empty() ? 0 : m_pContexts->back().get();
+}
+
+const XMLTransformerContext *XMLTransformerBase::GetAncestorContext(
+ sal_uInt32 n ) const
+{
+ XMLTransformerContextVector::size_type nSize =
+ m_pContexts->size();
+ XMLTransformerContextVector::size_type nPos =
+ static_cast<XMLTransformerContextVector::size_type>( n );
+
+ OSL_ENSURE( nSize >nPos+2 , "invalid context" );
+
+ return nSize > nPos+2 ? (*m_pContexts)[nSize-(nPos+2)].get() : 0;
+}
+
+bool XMLTransformerBase::isWriter() const
+{
+ Reference< XServiceInfo > xSI( mxModel, UNO_QUERY );
+ return xSI.is() &&
+ ( xSI->supportsService( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ) ) ||
+ xSI->supportsService( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.WebDocument" ) ) ) ||
+ xSI->supportsService( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.GlobalDocument" ) ) ) );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/TransformerBase.hxx b/xmloff/source/transform/TransformerBase.hxx
new file mode 100644
index 000000000000..2cbcd14f6681
--- /dev/null
+++ b/xmloff/source/transform/TransformerBase.hxx
@@ -0,0 +1,209 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_TRANSFORMER_BASE_HXX
+#define _XMLOFF_TRANSFORMER_BASE_HXX
+
+#include <com/sun/star/xml/sax/SAXParseException.hpp>
+#include <com/sun/star/xml/sax/SAXException.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/xml/sax/XLocator.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <xmloff/xmltoken.hxx>
+
+#include "Transformer.hxx"
+
+namespace rtl { class OUString; }
+namespace com { namespace sun { namespace star {
+ namespace i18n { class XCharacterClassification; }
+}}}
+
+class SvXMLNamespaceMap;
+class XMLTransformerContext;
+class XMLTransformerContextVector;
+class XMLTransformerActions;
+struct XMLTransformerActionInit;
+struct TransformerAction_Impl;
+class XMLMutableAttributeList;
+class XMLTransformerTokenMap;
+
+const sal_uInt16 INVALID_ACTIONS = 0xffff;
+
+class XMLTransformerBase : public XMLTransformer
+{
+ friend class XMLTransformerContext;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >
+ m_xLocator;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > m_xHandler; // the handlers
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XExtendedDocumentHandler > m_xExtHandler;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xPropSet;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::i18n::XCharacterClassification > xCharClass;
+
+ ::rtl::OUString m_aExtPathPrefix;
+ ::rtl::OUString m_aClass;
+
+ SvXMLNamespaceMap *m_pNamespaceMap;
+ SvXMLNamespaceMap *m_pReplaceNamespaceMap;
+ XMLTransformerContextVector *m_pContexts;
+ XMLTransformerActions *m_pElemActions;
+ XMLTransformerTokenMap *m_pTokenMap;
+
+protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxModel;
+
+ // This method is called after the namespace map has been updated, but
+ // before a context for the current element has been pushed.
+ XMLTransformerContext *CreateContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::rtl::OUString& rQName );
+
+ // this method may return an empty reference when the transformer service
+ // was created outside the xmloff environment.
+ // It is strictly forbiden to use this as a write access to the model!
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& getModel() const { return mxModel; }
+
+public:
+ XMLTransformerBase( XMLTransformerActionInit *pInit=0,
+ ::xmloff::token::XMLTokenEnum *pTKMapInit=0 ) throw();
+ virtual ~XMLTransformerBase() throw();
+
+ // ::com::sun::star::xml::sax::XDocumentHandler
+ virtual void SAL_CALL startDocument(void)
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL endDocument(void)
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL startElement(const ::rtl::OUString& aName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttribs)
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL endElement(const ::rtl::OUString& aName)
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL characters(const ::rtl::OUString& aChars)
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL ignorableWhitespace(const ::rtl::OUString& aWhitespaces)
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL processingInstruction(const ::rtl::OUString& aTarget,
+ const ::rtl::OUString& aData)
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL setDocumentLocator(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > & xLocator)
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+
+ // ::com::sun::star::xml::sax::XExtendedDocumentHandler
+ virtual void SAL_CALL startCDATA(void) throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL endCDATA(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL comment(const ::rtl::OUString& sComment)
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL allowLineBreak(void)
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL unknown(const ::rtl::OUString& sString)
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ // C++
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & GetDocHandler() { return m_xHandler; }
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & GetPropertySet() { return m_xPropSet; }
+
+
+ SvXMLNamespaceMap& GetNamespaceMap() { return *m_pNamespaceMap; }
+ const SvXMLNamespaceMap& GetNamespaceMap() const { return *m_pNamespaceMap; }
+ SvXMLNamespaceMap& GetReplaceNamespaceMap() { return *m_pReplaceNamespaceMap; }
+
+ XMLTransformerActions& GetElemActions() { return *m_pElemActions; }
+ virtual XMLTransformerActions *GetUserDefinedActions( sal_uInt16 n );
+ virtual XMLTransformerContext *CreateUserDefinedContext(
+ const TransformerAction_Impl& rAction,
+ const ::rtl::OUString& rQName,
+ sal_Bool bPersistent=sal_False ) = 0;
+ virtual ::rtl::OUString GetEventName( const ::rtl::OUString& rName,
+ sal_Bool bForm = sal_False ) = 0;
+
+
+ XMLMutableAttributeList *ProcessAttrList( ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList >& rAttrList,
+ sal_uInt16 nActionMap, sal_Bool bClone );
+
+ static sal_Bool ReplaceSingleInchWithIn( ::rtl::OUString& rValue );
+ static sal_Bool ReplaceSingleInWithInch( ::rtl::OUString& rValue );
+ static sal_Bool ReplaceInchWithIn( ::rtl::OUString& rValue );
+ static sal_Bool ReplaceInWithInch( ::rtl::OUString& rValue );
+
+ sal_Bool EncodeStyleName( ::rtl::OUString& rName ) const;
+ static sal_Bool DecodeStyleName( ::rtl::OUString& rName );
+ static sal_Bool NegPercent( ::rtl::OUString& rValue );
+
+ sal_Bool AddNamespacePrefix( ::rtl::OUString& rName,
+ sal_uInt16 nPrefix ) const;
+ sal_Bool RemoveNamespacePrefix( ::rtl::OUString& rName,
+ sal_uInt16 nPrefixOnly=0xffffU ) const;
+
+ sal_Bool ConvertURIToOASIS( ::rtl::OUString& rURI,
+ sal_Bool bSupportPackage=sal_False ) const;
+ sal_Bool ConvertURIToOOo( ::rtl::OUString& rURI,
+ sal_Bool bSupportPackage=sal_False ) const;
+
+ /** renames the given rOutAttributeValue if one of the parameters contains a
+ matching token in its lower 16 bits. The value is converted to the
+ token that is given in the upper 16 bits of the matching parameter.
+ */
+ sal_Bool RenameAttributeValue( ::rtl::OUString& rOutAttributeValue,
+ sal_Int32 nParam1,
+ sal_Int32 nParam2,
+ sal_Int32 nParam3 );
+
+ /** converts the '.' that separates fractions of seconds in a dateTime
+ string into a ',' that was used in the OOo format
+
+ @param rDateTime
+ A dateTime string that will be parsed and changed in case a match
+ was found.
+ @return <TRUE/> if the given string was changed
+ */
+ static bool ConvertRNGDateTimeToISO( ::rtl::OUString& rDateTime );
+
+ ::xmloff::token::XMLTokenEnum GetToken( const ::rtl::OUString& rStr ) const;
+
+ const XMLTransformerContext *GetCurrentContext() const;
+ const XMLTransformerContext *GetAncestorContext( sal_uInt32 i ) const;
+
+ // C++
+ inline void SetClass( const ::rtl::OUString& r ) { m_aClass = r; }
+ inline const ::rtl::OUString& GetClass() const { return m_aClass; }
+
+ bool isWriter() const;
+
+};
+
+#endif // _XMLOFF_TRANSFORMER_BASE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/TransformerContext.cxx b/xmloff/source/transform/TransformerContext.cxx
new file mode 100644
index 000000000000..4e3f7ef6a1fe
--- /dev/null
+++ b/xmloff/source/transform/TransformerContext.cxx
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/xml/sax/SAXParseException.hpp>
+#include <com/sun/star/xml/sax/SAXException.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <xmloff/nmspmap.hxx>
+
+#include "TransformerBase.hxx"
+
+#include "TransformerContext.hxx"
+
+using ::rtl::OUString;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+
+TYPEINIT0( XMLTransformerContext );
+
+sal_Bool XMLTransformerContext::HasQName( sal_uInt16 nPrefix,
+ ::xmloff::token::XMLTokenEnum eToken ) const
+{
+ OUString aLocalName;
+ return GetTransformer().GetNamespaceMap().GetKeyByAttrName( m_aQName,
+ &aLocalName ) == nPrefix &&
+ ::xmloff::token::IsXMLToken( aLocalName, eToken );
+}
+
+sal_Bool XMLTransformerContext::HasNamespace( sal_uInt16 nPrefix ) const
+{
+ return GetTransformer().GetNamespaceMap().GetKeyByAttrName( m_aQName ) == nPrefix;
+}
+
+XMLTransformerContext::XMLTransformerContext( XMLTransformerBase& rImp,
+ const OUString& rQName ) :
+ m_rTransformer( rImp ),
+ m_aQName( rQName ),
+ m_pRewindMap( 0 )
+{
+}
+
+XMLTransformerContext::~XMLTransformerContext()
+{
+}
+
+XMLTransformerContext *XMLTransformerContext::CreateChildContext( sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const OUString& rQName,
+ const Reference< XAttributeList >& )
+{
+ return m_rTransformer.CreateContext( nPrefix, rLocalName, rQName );
+}
+
+void XMLTransformerContext::StartElement( const Reference< XAttributeList >& rAttrList )
+{
+ m_rTransformer.GetDocHandler()->startElement( m_aQName, rAttrList );
+}
+
+void XMLTransformerContext::EndElement()
+{
+ m_rTransformer.GetDocHandler()->endElement( m_aQName );
+}
+
+void XMLTransformerContext::Characters( const OUString& rChars )
+{
+ m_rTransformer.GetDocHandler()->characters( rChars );
+}
+
+sal_Bool XMLTransformerContext::IsPersistent() const
+{
+ return sal_False;
+}
+
+void XMLTransformerContext::Export()
+{
+ OSL_ENSURE( !this, "context is not persistent" );
+}
+
+void XMLTransformerContext::ExportContent()
+{
+ OSL_ENSURE( !this, "context is not persistent" );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/TransformerContext.hxx b/xmloff/source/transform/TransformerContext.hxx
new file mode 100644
index 000000000000..07b33e026ed9
--- /dev/null
+++ b/xmloff/source/transform/TransformerContext.hxx
@@ -0,0 +1,118 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_TRANSFORMERCONTEXT_HXX
+#define _XMLOFF_TRANSFORMERCONTEXT_HXX
+
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <tools/solar.h>
+#include <salhelper/simplereferenceobject.hxx>
+#include <rtl/ustring.hxx>
+#include <tools/rtti.hxx>
+#include <xmloff/xmltoken.hxx>
+
+class SvXMLNamespaceMap;
+class XMLTransformerBase;
+
+class XMLTransformerContext : public ::salhelper::SimpleReferenceObject
+{
+ friend class XMLTransformerBase;
+
+ XMLTransformerBase& m_rTransformer;
+
+ ::rtl::OUString m_aQName;
+
+ SvXMLNamespaceMap *m_pRewindMap;
+
+ SvXMLNamespaceMap *GetRewindMap() const { return m_pRewindMap; }
+ void SetRewindMap( SvXMLNamespaceMap *p ) { m_pRewindMap = p; }
+
+protected:
+
+ XMLTransformerBase& GetTransformer() { return m_rTransformer; }
+ const XMLTransformerBase& GetTransformer() const { return m_rTransformer; }
+
+ void SetQName( const ::rtl::OUString& rQName ) { m_aQName = rQName; }
+
+public:
+ TYPEINFO();
+
+ const ::rtl::OUString& GetQName() const { return m_aQName; }
+ sal_Bool HasQName( sal_uInt16 nPrefix,
+ ::xmloff::token::XMLTokenEnum eToken ) const;
+ sal_Bool HasNamespace( sal_uInt16 nPrefix ) const;
+
+ // A contexts constructor does anything that is required if an element
+ // starts. Namespace processing has been done already.
+ // Note that virtual methods cannot be used inside constructors. Use
+ // StartElement instead if this is required.
+ XMLTransformerContext( XMLTransformerBase& rTransformer,
+ const ::rtl::OUString& rQName );
+
+ // A contexts destructor does anything that is required if an element
+ // ends. By default, nothing is done.
+ // Note that virtual methods cannot be used inside destructors. Use
+ // EndElement instead if this is required.
+ virtual ~XMLTransformerContext();
+
+ // Create a childs element context. By default, the import's
+ // CreateContext method is called to create a new default context.
+ virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::rtl::OUString& rQName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ // StartElement is called after a context has been constructed and
+ // before a elements context is parsed. It may be used for actions that
+ // require virtual methods. The default is to do nothing.
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ // EndElement is called before a context will be destructed, but
+ // after a elements context has been parsed. It may be used for actions
+ // that require virtual methods. The default is to do nothing.
+ virtual void EndElement();
+
+ // This method is called for all characters that are contained in the
+ // current element. The default is to ignore them.
+ virtual void Characters( const ::rtl::OUString& rChars );
+
+ // Is the current context a persistent one (i.e. one that saves is content
+ // rather than exporting it directly?
+ virtual sal_Bool IsPersistent() const;
+
+ // Export the whole element. By default, nothing is done here
+ virtual void Export();
+
+ // Export the element content. By default, nothing is done here
+ virtual void ExportContent();
+};
+
+
+#endif // _XMLOFF_TRANSFORMERCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/TransformerTokenMap.cxx b/xmloff/source/transform/TransformerTokenMap.cxx
new file mode 100644
index 000000000000..a42c2c62976e
--- /dev/null
+++ b/xmloff/source/transform/TransformerTokenMap.cxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "TransformerTokenMap.hxx"
+
+
+using namespace ::xmloff::token;
+
+XMLTransformerTokenMap::XMLTransformerTokenMap( XMLTokenEnum *pInit )
+{
+ if( pInit )
+ {
+ while( *pInit != XML_TOKEN_END )
+ {
+ XMLTransformerTokenMap::value_type aVal( GetXMLToken( *pInit ),
+ *pInit );
+ insert( aVal );
+ ++pInit;
+ }
+ }
+}
+
+XMLTransformerTokenMap::~XMLTransformerTokenMap()
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/TransformerTokenMap.hxx b/xmloff/source/transform/TransformerTokenMap.hxx
new file mode 100644
index 000000000000..d5963cc0082f
--- /dev/null
+++ b/xmloff/source/transform/TransformerTokenMap.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_TRANSFORMERTOKENMAPS_HXX
+#define _XMLOFF_TRANSFORMERTOKENMAPS_HXX
+
+#include <rtl/ustring.hxx>
+#include <comphelper/stl_types.hxx>
+#include <boost/unordered_map.hpp>
+#include <xmloff/xmltoken.hxx>
+#include "TransformerTokenMap.hxx"
+
+
+
+class XMLTransformerTokenMap :
+ public ::boost::unordered_map< ::rtl::OUString, ::xmloff::token::XMLTokenEnum,
+ ::rtl::OUStringHash, ::comphelper::UStringEqual >
+{
+public:
+ XMLTransformerTokenMap( ::xmloff::token::XMLTokenEnum *pInit );
+ ~XMLTransformerTokenMap();
+};
+
+#endif // _XMLOFF_TRANSFORMERTOKENMAPS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/XMLFilterRegistration.cxx b/xmloff/source/transform/XMLFilterRegistration.cxx
new file mode 100644
index 000000000000..4db6da9a91b5
--- /dev/null
+++ b/xmloff/source/transform/XMLFilterRegistration.cxx
@@ -0,0 +1,197 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <string.h>
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#include <cppuhelper/factory.hxx>
+
+using namespace ::com::sun::star;
+
+#define DECLARE_SERVICE( classname ) \
+ extern ::rtl::OUString SAL_CALL classname##_getImplementationName() throw(); \
+ extern uno::Sequence< ::rtl::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 ENUMERATE_SERVICE( classname ) \
+ { classname##_getImplementationName, classname##_getSupportedServiceNames, classname##_createInstance }
+
+// ============================================================================
+DECLARE_SERVICE( OOo2OasisTransformer )
+DECLARE_SERVICE( Oasis2OOoTransformer )
+
+DECLARE_SERVICE( XMLAutoTextEventImportOOO )
+DECLARE_SERVICE( XMLMetaImportOOO )
+DECLARE_SERVICE( XMLMathSettingsImportOOO )
+DECLARE_SERVICE( XMLMathMetaImportOOO )
+DECLARE_SERVICE( XMLCalcSettingsImportOOO )
+DECLARE_SERVICE( XMLCalcMetaImportOOO )
+DECLARE_SERVICE( XMLCalcContentImportOOO )
+DECLARE_SERVICE( XMLCalcStylesImportOOO )
+DECLARE_SERVICE( XMLCalcImportOOO )
+DECLARE_SERVICE( XMLWriterSettingsImportOOO )
+DECLARE_SERVICE( XMLWriterMetaImportOOO )
+DECLARE_SERVICE( XMLWriterContentImportOOO )
+DECLARE_SERVICE( XMLWriterStylesImportOOO )
+DECLARE_SERVICE( XMLWriterImportOOO )
+DECLARE_SERVICE( XMLChartContentImportOOO )
+DECLARE_SERVICE( XMLChartStylesImportOOO )
+DECLARE_SERVICE( XMLChartImportOOO )
+DECLARE_SERVICE( XMLDrawSettingsImportOOO )
+DECLARE_SERVICE( XMLDrawMetaImportOOO )
+DECLARE_SERVICE( XMLDrawContentImportOOO )
+DECLARE_SERVICE( XMLDrawStylesImportOOO )
+DECLARE_SERVICE( XMLDrawImportOOO )
+DECLARE_SERVICE( XMLImpressSettingsImportOOO )
+DECLARE_SERVICE( XMLImpressMetaImportOOO )
+DECLARE_SERVICE( XMLImpressContentImportOOO )
+DECLARE_SERVICE( XMLImpressStylesImportOOO )
+DECLARE_SERVICE( XMLImpressImportOOO )
+
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+namespace
+{
+ typedef ::rtl::OUString (SAL_CALL * GetImplementationName)();
+ typedef uno::Sequence< ::rtl::OUString > (SAL_CALL * GetSupportedServiceNames)();
+ typedef uno::Reference< ::uno::XInterface > (SAL_CALL * CreateInstance)(
+ const uno::Reference< lang::XMultiServiceFactory >& );
+
+ struct ServiceDescriptor
+ {
+ GetImplementationName getImplementationName;
+ GetSupportedServiceNames getSupportedServiceNames;
+ CreateInstance createInstance;
+ };
+
+ // ------------------------------------------------------------------------
+ static const ServiceDescriptor* getServiceDescriptors()
+ {
+ static const ServiceDescriptor aDescriptors[] =
+ {
+ // ================================================================
+ ENUMERATE_SERVICE( OOo2OasisTransformer ),
+ ENUMERATE_SERVICE( Oasis2OOoTransformer ),
+
+ ENUMERATE_SERVICE( XMLAutoTextEventImportOOO ),
+ ENUMERATE_SERVICE( XMLMetaImportOOO ),
+ ENUMERATE_SERVICE( XMLMathSettingsImportOOO ),
+ ENUMERATE_SERVICE( XMLMathMetaImportOOO ),
+ ENUMERATE_SERVICE( XMLCalcSettingsImportOOO ),
+ ENUMERATE_SERVICE( XMLCalcMetaImportOOO ),
+ ENUMERATE_SERVICE( XMLCalcContentImportOOO ),
+ ENUMERATE_SERVICE( XMLCalcStylesImportOOO ),
+ ENUMERATE_SERVICE( XMLCalcImportOOO ),
+ ENUMERATE_SERVICE( XMLWriterSettingsImportOOO ),
+ ENUMERATE_SERVICE( XMLWriterMetaImportOOO ),
+ ENUMERATE_SERVICE( XMLWriterContentImportOOO ),
+ ENUMERATE_SERVICE( XMLWriterStylesImportOOO ),
+ ENUMERATE_SERVICE( XMLWriterImportOOO ),
+ ENUMERATE_SERVICE( XMLChartContentImportOOO ),
+ ENUMERATE_SERVICE( XMLChartStylesImportOOO ),
+ ENUMERATE_SERVICE( XMLChartImportOOO ),
+ ENUMERATE_SERVICE( XMLDrawSettingsImportOOO ),
+ ENUMERATE_SERVICE( XMLDrawMetaImportOOO ),
+ ENUMERATE_SERVICE( XMLDrawContentImportOOO ),
+ ENUMERATE_SERVICE( XMLDrawStylesImportOOO ),
+ ENUMERATE_SERVICE( XMLDrawImportOOO ),
+ ENUMERATE_SERVICE( XMLImpressSettingsImportOOO ),
+ ENUMERATE_SERVICE( XMLImpressMetaImportOOO ),
+ ENUMERATE_SERVICE( XMLImpressContentImportOOO ),
+ ENUMERATE_SERVICE( XMLImpressStylesImportOOO ),
+ ENUMERATE_SERVICE( XMLImpressImportOOO ),
+ // ================================================================
+ { NULL, NULL, NULL }
+ };
+ return aDescriptors;
+ };
+}
+// ----------------------------------------------------------------------------
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
+{
+ void * pRet = NULL;
+ if( pServiceManager )
+ {
+ try
+ {
+ uno::Reference< lang::XMultiServiceFactory > xMSF( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ) );
+
+ const sal_Int32 nImplNameLen = strlen( pImplName );
+
+ const ServiceDescriptor* pDescriptor = getServiceDescriptors();
+ while ( pDescriptor->getImplementationName )
+ {
+ if ( pDescriptor->getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )
+ {
+ uno::Reference< lang::XSingleServiceFactory > xFactory =
+ ::cppu::createSingleFactory( xMSF,
+ pDescriptor->getImplementationName(),
+ pDescriptor->createInstance,
+ pDescriptor->getSupportedServiceNames()
+ );
+
+ if ( xFactory.is() )
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ break;
+ }
+ }
+
+ ++pDescriptor;
+ }
+ }
+ catch( uno::Exception& )
+ {
+ OSL_FAIL( "xof::component_getFactory: Exception!" );
+ }
+ }
+
+ return pRet;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/xof.component b/xmloff/source/transform/xof.component
new file mode 100755
index 000000000000..8f9c88f7fa0d
--- /dev/null
+++ b/xmloff/source/transform/xof.component
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* 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.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.Calc.XMLContentImporter">
+ <service name="com.sun.star.comp.Calc.XMLContentImporter"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Calc.XMLImporter">
+ <service name="com.sun.star.comp.Calc.XMLImporter"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Calc.XMLMetaImporter">
+ <service name="com.sun.star.comp.Calc.XMLMetaImporter"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Calc.XMLSettingsImporter">
+ <service name="com.sun.star.comp.Calc.XMLSettingsImporter"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Calc.XMLStylesImporter">
+ <service name="com.sun.star.comp.Calc.XMLStylesImporter"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Chart.XMLContentImporter">
+ <service name="com.sun.star.comp.Chart.XMLContentImporter"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Chart.XMLImporter">
+ <service name="com.sun.star.comp.Chart.XMLImporter"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Chart.XMLStylesImporter">
+ <service name="com.sun.star.comp.Chart.XMLStylesImporter"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Draw.XMLContentImporter">
+ <service name="com.sun.star.comp.Draw.XMLContentImporter"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Draw.XMLImporter">
+ <service name="com.sun.star.comp.Draw.XMLImporter"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Draw.XMLMetaImporter">
+ <service name="com.sun.star.comp.Draw.XMLMetaImporter"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Draw.XMLSettingsImporter">
+ <service name="com.sun.star.comp.Draw.XMLSettingsImporter"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Draw.XMLStylesImporter">
+ <service name="com.sun.star.comp.Draw.XMLStylesImporter"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Impress.XMLContentImporter">
+ <service name="com.sun.star.comp.Impress.XMLContentImporter"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Impress.XMLImporter">
+ <service name="com.sun.star.comp.Impress.XMLImporter"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Impress.XMLMetaImporter">
+ <service name="com.sun.star.comp.Impress.XMLMetaImporter"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Impress.XMLSettingsImporter">
+ <service name="com.sun.star.comp.Impress.XMLSettingsImporter"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Impress.XMLStylesImporter">
+ <service name="com.sun.star.comp.Impress.XMLStylesImporter"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Math.XMLMetaImporter">
+ <service name="com.sun.star.comp.Math.XMLMetaImporter"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Math.XMLSettingsImporter">
+ <service name="com.sun.star.comp.Math.XMLSettingsImporter"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.OOo2OasisTransformer">
+ <service name="com.sun.star.comp.OOo2OasisTransformer"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Oasis2OOoTransformer">
+ <service name="com.sun.star.comp.Oasis2OOoTransformer"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Writer.XMLAutotextEventsImporter">
+ <service name="com.sun.star.comp.Writer.XMLAutotextEventsImporter"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Writer.XMLContentImporter">
+ <service name="com.sun.star.comp.Writer.XMLContentImporter"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Writer.XMLImporter">
+ <service name="com.sun.star.comp.Writer.XMLImporter"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Writer.XMLMetaImporter">
+ <service name="com.sun.star.comp.Writer.XMLMetaImporter"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Writer.XMLSettingsImporter">
+ <service name="com.sun.star.comp.Writer.XMLSettingsImporter"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Writer.XMLStylesImporter">
+ <service name="com.sun.star.comp.Writer.XMLStylesImporter"/>
+ </implementation>
+ <implementation name="com.sun.star.document.XMLMetaImporter">
+ <service name="com.sun.star.document.XMLMetaImporter"/>
+ </implementation>
+</component>
diff --git a/xmloff/source/xforms/SchemaContext.cxx b/xmloff/source/xforms/SchemaContext.cxx
new file mode 100644
index 000000000000..38bda73bebf0
--- /dev/null
+++ b/xmloff/source/xforms/SchemaContext.cxx
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "SchemaContext.hxx"
+
+#include "SchemaSimpleTypeContext.hxx"
+
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmlnmspe.hxx>
+#include <xmloff/xmltkmap.hxx>
+#include <xmloff/xmluconv.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/xsd/WhiteSpaceTreatment.hpp>
+#include <com/sun/star/xforms/XDataTypeRepository.hpp>
+
+#include <tools/debug.hxx>
+
+
+using rtl::OUString;
+using com::sun::star::uno::Reference;
+using com::sun::star::uno::Any;
+using com::sun::star::xml::sax::XAttributeList;
+using com::sun::star::xforms::XDataTypeRepository;
+using namespace xmloff::token;
+
+
+
+
+static SvXMLTokenMapEntry aAttributes[] =
+{
+ XML_TOKEN_MAP_END
+};
+
+static SvXMLTokenMapEntry aChildren[] =
+{
+ TOKEN_MAP_ENTRY( XSD, SIMPLETYPE ),
+ XML_TOKEN_MAP_END
+};
+
+
+SchemaContext::SchemaContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XDataTypeRepository>& rRepository ) :
+ TokenContext( rImport, nPrefix, rLocalName, aAttributes, aChildren ),
+ mxRepository( rRepository )
+{
+}
+
+SchemaContext::~SchemaContext()
+{
+}
+
+void SchemaContext::HandleAttribute(
+ sal_uInt16,
+ const OUString& )
+{
+}
+
+SvXMLImportContext* SchemaContext::HandleChild(
+ sal_uInt16 nToken,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList>& )
+{
+ return ( nToken == XML_SIMPLETYPE )
+ ? new SchemaSimpleTypeContext( GetImport(), nPrefix, rLocalName,
+ mxRepository )
+ : new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/xforms/SchemaContext.hxx b/xmloff/source/xforms/SchemaContext.hxx
new file mode 100644
index 000000000000..2819df1c5500
--- /dev/null
+++ b/xmloff/source/xforms/SchemaContext.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_SCHEMACONTEXT_HXX
+#define _XMLOFF_SCHEMACONTEXT_HXX
+
+
+//
+// include for parent class and members
+//
+
+#include "TokenContext.hxx"
+#include <com/sun/star/uno/Reference.hxx>
+
+
+//
+// forward declarations
+//
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+ namespace beans { class XPropertySet; }
+ namespace xforms { class XDataTypeRepository; }
+} } }
+namespace rtl { class OUString; }
+class SvXMLImport;
+class SvXMLImportContext;
+
+/** import the data type declarations from an xsd:schema element */
+class SchemaContext : public TokenContext
+{
+ com::sun::star::uno::Reference<com::sun::star::xforms::XDataTypeRepository> mxRepository;
+
+public:
+
+ SchemaContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const com::sun::star::uno::Reference<com::sun::star::xforms::XDataTypeRepository>& rRepository );
+ virtual ~SchemaContext();
+
+
+ //
+ // implement TokenContext methods:
+ //
+
+protected:
+
+ virtual void HandleAttribute(
+ sal_uInt16 nToken,
+ const rtl::OUString& rValue );
+
+ virtual SvXMLImportContext* HandleChild(
+ sal_uInt16 nToken,
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList>& xAttrList );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/xforms/SchemaRestrictionContext.cxx b/xmloff/source/xforms/SchemaRestrictionContext.cxx
new file mode 100644
index 000000000000..befc06a7e521
--- /dev/null
+++ b/xmloff/source/xforms/SchemaRestrictionContext.cxx
@@ -0,0 +1,383 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "SchemaRestrictionContext.hxx"
+#include "xformsapi.hxx"
+
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmlnmspe.hxx>
+#include <xmloff/xmltkmap.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmlimp.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/uno/Type.hxx>
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/util/Time.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/xforms/XDataTypeRepository.hpp>
+#include <com/sun/star/xsd/DataTypeClass.hpp>
+#include <com/sun/star/xsd/WhiteSpaceTreatment.hpp>
+
+#include <tools/debug.hxx>
+
+
+using rtl::OUString;
+using com::sun::star::uno::Reference;
+using com::sun::star::uno::Exception;
+using com::sun::star::uno::Any;
+using com::sun::star::uno::makeAny;
+using com::sun::star::uno::UNO_QUERY;
+using com::sun::star::util::Date;
+using com::sun::star::util::DateTime;
+using com::sun::star::xml::sax::XAttributeList;
+using com::sun::star::beans::XPropertySet;
+using com::sun::star::beans::XPropertySetInfo;
+using com::sun::star::xforms::XDataTypeRepository;
+using namespace xmloff::token;
+
+
+
+
+static SvXMLTokenMapEntry aAttributes[] =
+{
+ TOKEN_MAP_ENTRY( NONE, BASE ),
+ XML_TOKEN_MAP_END
+};
+
+static SvXMLTokenMapEntry aChildren[] =
+{
+ TOKEN_MAP_ENTRY( XSD, LENGTH ),
+ TOKEN_MAP_ENTRY( XSD, MINLENGTH ),
+ TOKEN_MAP_ENTRY( XSD, MAXLENGTH ),
+ TOKEN_MAP_ENTRY( XSD, MININCLUSIVE ),
+ TOKEN_MAP_ENTRY( XSD, MINEXCLUSIVE ),
+ TOKEN_MAP_ENTRY( XSD, MAXINCLUSIVE ),
+ TOKEN_MAP_ENTRY( XSD, MAXEXCLUSIVE ),
+ TOKEN_MAP_ENTRY( XSD, PATTERN ),
+ // ??? XML_ENUMERATION
+ TOKEN_MAP_ENTRY( XSD, WHITESPACE ),
+ TOKEN_MAP_ENTRY( XSD, TOTALDIGITS ),
+ TOKEN_MAP_ENTRY( XSD, FRACTIONDIGITS ),
+ XML_TOKEN_MAP_END
+};
+
+
+SchemaRestrictionContext::SchemaRestrictionContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ Reference<com::sun::star::xforms::XDataTypeRepository>& rRepository,
+ const OUString& sTypeName ) :
+ TokenContext( rImport, nPrefix, rLocalName, aAttributes, aChildren ),
+ mxRepository( rRepository ),
+ msTypeName( sTypeName ),
+ msBaseName()
+{
+ DBG_ASSERT( mxRepository.is(), "need repository" );
+}
+
+SchemaRestrictionContext::~SchemaRestrictionContext()
+{
+}
+
+void SchemaRestrictionContext::CreateDataType()
+{
+ // only do something if we don't have a data type already
+ if( mxDataType.is() )
+ return;
+
+ DBG_ASSERT( msBaseName.getLength() > 0, "no base name?" );
+ DBG_ASSERT( mxRepository.is(), "no repository?" );
+
+ try
+ {
+ mxDataType =
+ Reference<XPropertySet>(
+ mxRepository->cloneDataType(
+ lcl_getBasicTypeName( mxRepository,
+ GetImport().GetNamespaceMap(),
+ msBaseName ),
+ msTypeName ),
+ UNO_QUERY );
+ }
+ catch( const Exception& )
+ {
+ OSL_FAIL( "exception during type creation" );
+ }
+ DBG_ASSERT( mxDataType.is(), "can't create type" );
+}
+
+void SchemaRestrictionContext::HandleAttribute(
+ sal_uInt16 nToken,
+ const OUString& rValue )
+{
+ if( nToken == XML_BASE )
+ {
+ msBaseName = rValue;
+ }
+}
+
+typedef Any (*convert_t)( const OUString& );
+
+Any lcl_string( const OUString& rValue )
+{
+ return makeAny( rValue );
+}
+
+Any lcl_int32( const OUString& rValue )
+{
+ sal_Int32 nValue;
+ bool bSuccess = SvXMLUnitConverter::convertNumber( nValue, rValue );
+ return bSuccess ? makeAny( nValue ) : Any();
+}
+
+Any lcl_int16( const OUString& rValue )
+{
+ sal_Int32 nValue;
+ bool bSuccess = SvXMLUnitConverter::convertNumber( nValue, rValue );
+ return bSuccess ? makeAny( static_cast<sal_Int16>( nValue ) ) : Any();
+}
+
+Any lcl_whitespace( const OUString& rValue )
+{
+ Any aValue;
+ if( IsXMLToken( rValue, XML_PRESERVE ) )
+ aValue <<= com::sun::star::xsd::WhiteSpaceTreatment::Preserve;
+ else if( IsXMLToken( rValue, XML_REPLACE ) )
+ aValue <<= com::sun::star::xsd::WhiteSpaceTreatment::Replace;
+ else if( IsXMLToken( rValue, XML_COLLAPSE ) )
+ aValue <<= com::sun::star::xsd::WhiteSpaceTreatment::Collapse;
+ return aValue;
+}
+
+Any lcl_double( const OUString& rValue )
+{
+ double fValue;
+ bool bSuccess = SvXMLUnitConverter::convertDouble( fValue, rValue );
+ return bSuccess ? makeAny( fValue ) : Any();
+}
+
+Any lcl_date( const OUString& rValue )
+{
+ Any aAny;
+
+ // parse ISO date
+ sal_Int32 nPos1 = rValue.indexOf( sal_Unicode('-') );
+ sal_Int32 nPos2 = rValue.indexOf( sal_Unicode('-'), nPos1 + 1 );
+ if( nPos1 > 0 && nPos2 > 0 )
+ {
+ Date aDate;
+ aDate.Year = static_cast<sal_uInt16>(
+ rValue.copy( 0, nPos1 ).toInt32() );
+ aDate.Month = static_cast<sal_uInt16>(
+ rValue.copy( nPos1 + 1, nPos2 - nPos1 - 1 ).toInt32() );
+ aDate.Day = static_cast<sal_uInt16>(
+ rValue.copy( nPos2 + 1 ).toInt32() );
+ aAny <<= aDate;
+ }
+ return aAny;
+}
+
+Any lcl_dateTime( const OUString& rValue )
+{
+ DateTime aDateTime;
+ bool bSuccess = SvXMLUnitConverter::convertDateTime( aDateTime, rValue );
+ return bSuccess ? makeAny( aDateTime ) : Any();
+}
+
+Any lcl_time( const OUString& rValue )
+{
+ Any aAny;
+ DateTime aDateTime;
+ if( SvXMLUnitConverter::convertTime( aDateTime, rValue ) )
+ {
+ com::sun::star::util::Time aTime;
+ aTime.Hours = aDateTime.Hours;
+ aTime.Minutes = aDateTime.Minutes;
+ aTime.Seconds = aDateTime.Seconds;
+ aTime.HundredthSeconds = aDateTime.HundredthSeconds;
+ aAny <<= aTime;
+ }
+ return aAny;
+}
+
+
+SvXMLImportContext* SchemaRestrictionContext::HandleChild(
+ sal_uInt16 nToken,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList>& xAttrList )
+{
+ // find value
+ OUString sValue;
+ sal_Int16 nLength = xAttrList->getLength();
+ for( sal_Int16 n = 0; n < nLength; n++ )
+ {
+ if( IsXMLToken( xAttrList->getNameByIndex( n ), XML_VALUE ) )
+ sValue = xAttrList->getValueByIndex( n );
+ }
+
+ // determine property name + suitable converter
+ OUString sPropertyName;
+ convert_t pConvert = NULL;
+ switch( nToken )
+ {
+ case XML_LENGTH:
+ sPropertyName = OUString(RTL_CONSTASCII_USTRINGPARAM("Length"));
+ pConvert = &lcl_int32;
+ break;
+ case XML_MINLENGTH:
+ sPropertyName = OUString(RTL_CONSTASCII_USTRINGPARAM("MinLength"));
+ pConvert = &lcl_int32;
+ break;
+ case XML_MAXLENGTH:
+ sPropertyName = OUString(RTL_CONSTASCII_USTRINGPARAM("MaxLength"));
+ pConvert = &lcl_int32;
+ break;
+ case XML_TOTALDIGITS:
+ sPropertyName = OUString(RTL_CONSTASCII_USTRINGPARAM("TotalDigits"));
+ pConvert = &lcl_int32;
+ break;
+ case XML_FRACTIONDIGITS:
+ sPropertyName =OUString(RTL_CONSTASCII_USTRINGPARAM("FractionDigits"));
+ pConvert = &lcl_int32;
+ break;
+ case XML_PATTERN:
+ sPropertyName = OUString(RTL_CONSTASCII_USTRINGPARAM("Pattern"));
+ pConvert = &lcl_string;
+ break;
+ case XML_WHITESPACE:
+ sPropertyName = OUString(RTL_CONSTASCII_USTRINGPARAM("WhiteSpace"));
+ pConvert = &lcl_whitespace;
+ break;
+ case XML_MININCLUSIVE:
+ case XML_MINEXCLUSIVE:
+ case XML_MAXINCLUSIVE:
+ case XML_MAXEXCLUSIVE:
+ {
+ // these attributes are mapped to different properties.
+ // To determine the property name, we use an attribute
+ // dependent prefix and a type dependent suffix. The
+ // converter is only type dependent.
+
+ // first, attribute-dependent prefix
+ switch( nToken )
+ {
+ case XML_MININCLUSIVE:
+ sPropertyName = OUString(RTL_CONSTASCII_USTRINGPARAM("MinInclusive"));
+ break;
+ case XML_MINEXCLUSIVE:
+ sPropertyName = OUString(RTL_CONSTASCII_USTRINGPARAM("MinExclusive"));
+ break;
+ case XML_MAXINCLUSIVE:
+ sPropertyName = OUString(RTL_CONSTASCII_USTRINGPARAM("MaxInclusive"));
+ break;
+ case XML_MAXEXCLUSIVE:
+ sPropertyName = OUString(RTL_CONSTASCII_USTRINGPARAM("MaxExclusive"));
+ break;
+ }
+
+ // second, type-dependent suffix + converter
+ switch( lcl_getTypeClass( mxRepository,
+ GetImport().GetNamespaceMap(),
+ msBaseName ) )
+ {
+ case com::sun::star::xsd::DataTypeClass::DECIMAL:
+ case com::sun::star::xsd::DataTypeClass::DOUBLE:
+ case com::sun::star::xsd::DataTypeClass::FLOAT:
+ sPropertyName += OUString(RTL_CONSTASCII_USTRINGPARAM("Double"));
+ pConvert = &lcl_double;
+ break;
+ case com::sun::star::xsd::DataTypeClass::DATETIME:
+ sPropertyName += OUString(RTL_CONSTASCII_USTRINGPARAM("DateTime"));
+ pConvert = &lcl_dateTime;
+ break;
+ case com::sun::star::xsd::DataTypeClass::DATE:
+ sPropertyName += OUString(RTL_CONSTASCII_USTRINGPARAM("Date"));
+ pConvert = &lcl_date;
+ break;
+ case com::sun::star::xsd::DataTypeClass::TIME:
+ sPropertyName += OUString(RTL_CONSTASCII_USTRINGPARAM("Time"));
+ pConvert = &lcl_time;
+ break;
+ case com::sun::star::xsd::DataTypeClass::gYear:
+ case com::sun::star::xsd::DataTypeClass::gDay:
+ case com::sun::star::xsd::DataTypeClass::gMonth:
+ sPropertyName += OUString(RTL_CONSTASCII_USTRINGPARAM("Int"));
+ pConvert = &lcl_int16;
+ break;
+
+ case com::sun::star::xsd::DataTypeClass::STRING:
+ case com::sun::star::xsd::DataTypeClass::anyURI:
+ case com::sun::star::xsd::DataTypeClass::BOOLEAN:
+ // invalid: These shouldn't have min/max-inclusive
+ break;
+
+ /* data types not yet supported:
+ case com::sun::star::xsd::DataTypeClass::DURATION:
+ case com::sun::star::xsd::DataTypeClass::gYearMonth:
+ case com::sun::star::xsd::DataTypeClass::gMonthDay:
+ case com::sun::star::xsd::DataTypeClass::hexBinary:
+ case com::sun::star::xsd::DataTypeClass::base64Binary:
+ case com::sun::star::xsd::DataTypeClass::QName:
+ case com::sun::star::xsd::DataTypeClass::NOTATION:
+ */
+ }
+ }
+ break;
+
+ default:
+ OSL_FAIL( "unknown facet" );
+ }
+
+ // finally, set the property
+ CreateDataType();
+ if( mxDataType.is()
+ && sPropertyName.getLength() > 0
+ && pConvert != NULL
+ && mxDataType->getPropertySetInfo()->hasPropertyByName(sPropertyName) )
+ {
+ try
+ {
+ mxDataType->setPropertyValue( sPropertyName, pConvert( sValue ) );
+ }
+ catch( const Exception& )
+ {
+ ; // can't set property? Then ignore.
+ }
+ }
+
+ return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/xforms/SchemaRestrictionContext.hxx b/xmloff/source/xforms/SchemaRestrictionContext.hxx
new file mode 100644
index 000000000000..d86a71232098
--- /dev/null
+++ b/xmloff/source/xforms/SchemaRestrictionContext.hxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_SCHEMARESTRICTIONCONTEXT_HXX
+#define _XMLOFF_SCHEMARESTRICTIONCONTEXT_HXX
+
+
+//
+// include for parent class and members
+//
+
+#include "TokenContext.hxx"
+#include <com/sun/star/uno/Reference.hxx>
+
+
+//
+// forward declarations
+//
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+ namespace beans { class XPropertySet; }
+ namespace xforms { class XDataTypeRepository; }
+} } }
+namespace rtl { class OUString; }
+class SvXMLImport;
+class SvXMLImportContext;
+
+/** import the xsd:restriction element */
+class SchemaRestrictionContext : public TokenContext
+{
+ com::sun::star::uno::Reference<com::sun::star::xforms::XDataTypeRepository> mxRepository;
+ com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> mxDataType;
+ ::rtl::OUString msTypeName;
+ ::rtl::OUString msBaseName;
+
+public:
+
+ SchemaRestrictionContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ com::sun::star::uno::Reference<com::sun::star::xforms::XDataTypeRepository>& rRepository,
+ const ::rtl::OUString& sTypeName );
+ virtual ~SchemaRestrictionContext();
+
+
+protected:
+
+ // create mxDataType (if not already present)
+ void CreateDataType();
+
+ //
+ // implement TokenContext methods:
+ //
+
+ virtual void HandleAttribute(
+ sal_uInt16 nToken,
+ const rtl::OUString& rValue );
+
+ virtual SvXMLImportContext* HandleChild(
+ sal_uInt16 nToken,
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList>& xAttrList );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/xforms/SchemaSimpleTypeContext.cxx b/xmloff/source/xforms/SchemaSimpleTypeContext.cxx
new file mode 100644
index 000000000000..96f8da4dc99f
--- /dev/null
+++ b/xmloff/source/xforms/SchemaSimpleTypeContext.cxx
@@ -0,0 +1,118 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "SchemaSimpleTypeContext.hxx"
+
+#include "SchemaRestrictionContext.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmlnmspe.hxx>
+#include <xmloff/xmltkmap.hxx>
+#include <xmloff/xmluconv.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/xsd/WhiteSpaceTreatment.hpp>
+
+#include <tools/debug.hxx>
+
+
+using rtl::OUString;
+using com::sun::star::uno::Reference;
+using com::sun::star::uno::Any;
+using com::sun::star::xml::sax::XAttributeList;
+using com::sun::star::beans::XPropertySet;
+using com::sun::star::xforms::XDataTypeRepository;
+using namespace xmloff::token;
+
+
+
+
+static SvXMLTokenMapEntry aAttributes[] =
+{
+ TOKEN_MAP_ENTRY( NONE, NAME ),
+ XML_TOKEN_MAP_END
+};
+
+static SvXMLTokenMapEntry aChildren[] =
+{
+ TOKEN_MAP_ENTRY( XSD, RESTRICTION ),
+ XML_TOKEN_MAP_END
+};
+
+
+SchemaSimpleTypeContext::SchemaSimpleTypeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XDataTypeRepository>& rRepository ) :
+ TokenContext( rImport, nPrefix, rLocalName, aAttributes, aChildren ),
+ mxRepository( rRepository )
+{
+}
+
+SchemaSimpleTypeContext::~SchemaSimpleTypeContext()
+{
+}
+
+void SchemaSimpleTypeContext::HandleAttribute(
+ sal_uInt16 nToken,
+ const OUString& rValue )
+{
+ if( nToken == XML_NAME )
+ {
+ msTypeName = rValue;
+ }
+}
+
+SvXMLImportContext* SchemaSimpleTypeContext::HandleChild(
+ sal_uInt16 nToken,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList>& )
+{
+ SvXMLImportContext* pContext = NULL;
+ switch( nToken )
+ {
+ case XML_RESTRICTION:
+ pContext = new SchemaRestrictionContext( GetImport(),
+ nPrefix, rLocalName,
+ mxRepository, msTypeName );
+ break;
+ default:
+ OSL_FAIL( "Booo!" );
+ }
+
+ return ( pContext != NULL )
+ ? pContext
+ : new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/xforms/SchemaSimpleTypeContext.hxx b/xmloff/source/xforms/SchemaSimpleTypeContext.hxx
new file mode 100644
index 000000000000..33e24351fe1f
--- /dev/null
+++ b/xmloff/source/xforms/SchemaSimpleTypeContext.hxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_SCHEMASIMPLETYPECONTEXT_HXX
+#define _XMLOFF_SCHEMASIMPLETYPECONTEXT_HXX
+
+
+//
+// include for parent class and members
+//
+
+#include "TokenContext.hxx"
+#include <com/sun/star/uno/Reference.hxx>
+
+
+//
+// forward declarations
+//
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+ namespace beans { class XPropertySet; }
+ namespace xforms { class XDataTypeRepository; }
+} } }
+namespace rtl { class OUString; }
+class SvXMLImport;
+class SvXMLImportContext;
+
+/** import the xsd:simpleType element */
+class SchemaSimpleTypeContext : public TokenContext
+{
+ com::sun::star::uno::Reference<com::sun::star::xforms::XDataTypeRepository> mxRepository;
+ rtl::OUString msTypeName;
+
+public:
+
+ SchemaSimpleTypeContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const com::sun::star::uno::Reference<com::sun::star::xforms::XDataTypeRepository>& rRepository );
+
+ virtual ~SchemaSimpleTypeContext();
+
+
+ //
+ // implement TokenContext methods:
+ //
+
+protected:
+
+ virtual void HandleAttribute(
+ sal_uInt16 nToken,
+ const rtl::OUString& rValue );
+
+ virtual SvXMLImportContext* HandleChild(
+ sal_uInt16 nToken,
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList>& xAttrList );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/xforms/TokenContext.cxx b/xmloff/source/xforms/TokenContext.cxx
new file mode 100644
index 000000000000..ab9298773e2c
--- /dev/null
+++ b/xmloff/source/xforms/TokenContext.cxx
@@ -0,0 +1,149 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "TokenContext.hxx"
+#include <xmloff/xmltkmap.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmloff/xmlerror.hxx"
+
+#include <tools/debug.hxx>
+
+using rtl::OUString;
+using com::sun::star::uno::Reference;
+using com::sun::star::xml::sax::XAttributeList;
+
+
+struct SvXMLTokenMapEntry aEmptyMap[1] =
+{
+ XML_TOKEN_MAP_END
+};
+
+
+TokenContext::TokenContext( SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const SvXMLTokenMapEntry* pAttributes,
+ const SvXMLTokenMapEntry* pChildren )
+ : SvXMLImportContext( rImport, nPrefix, rLocalName ),
+ mpAttributes( pAttributes ),
+ mpChildren( pChildren )
+{
+}
+
+TokenContext::~TokenContext()
+{
+}
+
+void TokenContext::StartElement(
+ const Reference<XAttributeList>& xAttributeList )
+{
+ // iterate over attributes
+ // - if in map: call HandleAttribute
+ // - xmlns:... : ignore
+ // - other: warning
+ DBG_ASSERT( mpAttributes != NULL, "no token map for attributes" );
+ SvXMLTokenMap aMap( mpAttributes );
+
+ sal_Int16 nCount = xAttributeList->getLength();
+ for( sal_Int16 i = 0; i < nCount; i++ )
+ {
+ // get key/local-name pair from namespace map
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttributeList->getNameByIndex(i), &sLocalName );
+
+ // get token from token map
+ sal_uInt16 nToken = aMap.Get( nPrefix, sLocalName );
+
+ // and the value...
+ const OUString& rValue = xAttributeList->getValueByIndex(i);
+
+ if( nToken != XML_TOK_UNKNOWN )
+ {
+ HandleAttribute( nToken, rValue );
+ }
+ else if( nPrefix != XML_NAMESPACE_XMLNS )
+ {
+ // error handling, for all attribute that are not
+ // namespace declarations
+ GetImport().SetError( XMLERROR_UNKNOWN_ATTRIBUTE,
+ sLocalName, rValue);
+ }
+ }
+}
+
+SvXMLImportContext* TokenContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList>& xAttrList )
+{
+ // call HandleChild for elements in token map. Ignore other content.
+
+ SvXMLImportContext* pContext = NULL;
+
+ DBG_ASSERT( mpChildren != NULL, "no token map for child elements" );
+ SvXMLTokenMap aMap( mpChildren );
+ sal_uInt16 nToken = aMap.Get( nPrefix, rLocalName );
+ if( nToken != XML_TOK_UNKNOWN )
+ {
+ // call handle child, and pass down arguments
+ pContext = HandleChild( nToken, nPrefix, rLocalName, xAttrList );
+ }
+
+ // error handling: create default context and generate warning
+ if( pContext == NULL )
+ {
+ GetImport().SetError( XMLERROR_UNKNOWN_ELEMENT, rLocalName );
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+ }
+ return pContext;
+}
+
+bool lcl_IsWhiteSpace( sal_Unicode c )
+{
+ return c == sal_Unicode( ' ' )
+ || c == sal_Unicode( 0x09 )
+ || c == sal_Unicode( 0x0A )
+ || c == sal_Unicode( 0x0D );
+}
+
+void TokenContext::Characters( const ::rtl::OUString& rCharacters )
+{
+ // get iterators for string data
+ const sal_Unicode* pBegin = rCharacters.getStr();
+ const sal_Unicode* pEnd = &( pBegin[ rCharacters.getLength() ] );
+
+ // raise error if non-whitespace character is found
+ if( ::std::find_if( pBegin, pEnd, ::std::not1(::std::ptr_fun(lcl_IsWhiteSpace)) ) != pEnd )
+ GetImport().SetError( XMLERROR_UNKNOWN_CHARACTERS, rCharacters );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/xforms/TokenContext.hxx b/xmloff/source/xforms/TokenContext.hxx
new file mode 100644
index 000000000000..33ef27ac3798
--- /dev/null
+++ b/xmloff/source/xforms/TokenContext.hxx
@@ -0,0 +1,117 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_TOKENCONTEXT_HXX
+#define _XMLOFF_TOKENCONTEXT_HXX
+
+
+//
+// include for parent class and members
+//
+
+#include <xmloff/xmlictxt.hxx>
+
+
+//
+// forward declarations
+//
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+ namespace uno { template<typename T> class Reference; }
+} } }
+namespace rtl { class OUString; }
+class SvXMLImport;
+
+#define TOKEN_MAP_ENTRY(NAMESPACE,TOKEN) { XML_NAMESPACE_##NAMESPACE, xmloff::token::XML_##TOKEN, xmloff::token::XML_##TOKEN }
+
+extern struct SvXMLTokenMapEntry aEmptyMap[1];
+
+/** handle attributes through an SvXMLTokenMap */
+class TokenContext : public SvXMLImportContext
+{
+protected:
+ const SvXMLTokenMapEntry* mpAttributes; /// static token map
+ const SvXMLTokenMapEntry* mpChildren; /// static token map
+
+public:
+
+ TokenContext( SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const SvXMLTokenMapEntry* pAttributes = NULL,
+ const SvXMLTokenMapEntry* pChildren = NULL );
+
+ virtual ~TokenContext();
+
+
+ //
+ // implement SvXMLImportContext methods:
+ //
+
+ /** call HandleAttribute for each attribute in the token map;
+ * create a warning for all others. Classes that wish to override
+ * StartElement need to call the parent method. */
+ virtual void StartElement(
+ const com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+ /** call HandleChild for each child element in the token map;
+ * create a warning for all others. Classes that wish to override
+ * CreateChildCotnenxt may want to call the parent method for
+ * handling of defaults. */
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+ /** Create a warning for all non-namespace character
+ * content. Classes that wish to deal with character content have
+ * to overload this method anyway, and will thus get rid of the
+ * warnings. */
+ virtual void Characters( const ::rtl::OUString& rChars );
+
+protected:
+ /** will be called for each attribute */
+ virtual void HandleAttribute(
+ sal_uInt16 nToken,
+ const rtl::OUString& rValue ) = 0;
+
+ /** will be called for each child element */
+ virtual SvXMLImportContext* HandleChild(
+ sal_uInt16 nToken,
+
+ // the following attributes are mainly to be used for child
+ // context creation
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList>& xAttrList ) = 0;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/xforms/XFormsBindContext.cxx b/xmloff/source/xforms/XFormsBindContext.cxx
new file mode 100644
index 000000000000..71cc356d0e1a
--- /dev/null
+++ b/xmloff/source/xforms/XFormsBindContext.cxx
@@ -0,0 +1,193 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "XFormsBindContext.hxx"
+
+#include "xformsapi.hxx"
+
+#include <xmloff/xmlimp.hxx>
+#include "xmloff/xmlerror.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmltkmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/xforms/XModel.hpp>
+
+#include <tools/debug.hxx>
+
+using rtl::OUString;
+using com::sun::star::beans::XPropertySet;
+using com::sun::star::uno::Reference;
+using com::sun::star::uno::makeAny;
+using com::sun::star::uno::UNO_QUERY;
+using com::sun::star::uno::UNO_QUERY_THROW;
+using com::sun::star::container::XNameContainer;
+using com::sun::star::xml::sax::XAttributeList;
+using com::sun::star::xforms::XModel;
+using namespace xmloff::token;
+
+
+
+
+static struct SvXMLTokenMapEntry aAttributeMap[] =
+{
+ TOKEN_MAP_ENTRY( NONE, NODESET ),
+ TOKEN_MAP_ENTRY( NONE, ID ),
+ TOKEN_MAP_ENTRY( NONE, READONLY ),
+ TOKEN_MAP_ENTRY( NONE, RELEVANT ),
+ TOKEN_MAP_ENTRY( NONE, REQUIRED ),
+ TOKEN_MAP_ENTRY( NONE, CONSTRAINT ),
+ TOKEN_MAP_ENTRY( NONE, CALCULATE ),
+ TOKEN_MAP_ENTRY( NONE, TYPE ),
+ XML_TOKEN_MAP_END
+};
+
+// helper function; see below
+void lcl_fillNamespaceContainer( const SvXMLNamespaceMap&,
+ Reference<XNameContainer>& );
+
+XFormsBindContext::XFormsBindContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XPropertySet>& xModel ) :
+ TokenContext( rImport, nPrefix, rLocalName, aAttributeMap, aEmptyMap ),
+ mxModel( xModel, UNO_QUERY_THROW ),
+ mxBinding( NULL )
+{
+ // attach binding to model
+ mxBinding = mxModel->createBinding();
+ DBG_ASSERT( mxBinding.is(), "can't create binding" );
+ mxModel->getBindings()->insert( makeAny( mxBinding ) );
+}
+
+XFormsBindContext::~XFormsBindContext()
+{
+}
+
+void XFormsBindContext::HandleAttribute( sal_uInt16 nToken,
+ const OUString& rValue )
+{
+ switch( nToken )
+ {
+ case XML_NODESET:
+ lcl_setValue( mxBinding, OUSTRING("BindingExpression"), rValue );
+ break;
+ case XML_ID:
+ lcl_setValue( mxBinding, OUSTRING("BindingID"), rValue );
+ break;
+ case XML_READONLY:
+ lcl_setValue( mxBinding, OUSTRING("ReadonlyExpression"), rValue );
+ break;
+ case XML_RELEVANT:
+ lcl_setValue( mxBinding, OUSTRING("RelevantExpression"), rValue );
+ break;
+ case XML_REQUIRED:
+ lcl_setValue( mxBinding, OUSTRING("RequiredExpression"), rValue );
+ break;
+ case XML_CONSTRAINT:
+ lcl_setValue( mxBinding, OUSTRING("ConstraintExpression"), rValue );
+ break;
+ case XML_CALCULATE:
+ lcl_setValue( mxBinding, OUSTRING("CalculateExpression"), rValue );
+ break;
+ case XML_TYPE:
+ lcl_setValue( mxBinding, OUSTRING("Type"),
+ makeAny( lcl_getTypeName( mxModel->getDataTypeRepository(),
+ GetImport().GetNamespaceMap(),
+ rValue ) ) );
+ break;
+ default:
+ OSL_FAIL( "should not happen" );
+ break;
+ }
+}
+
+void XFormsBindContext::StartElement(
+ const Reference<XAttributeList>& xAttributeList )
+{
+ // we need to register the namespaces
+ Reference<XNameContainer> xContainer(
+ mxBinding->getPropertyValue( OUSTRING("BindingNamespaces") ),
+ UNO_QUERY );
+
+ DBG_ASSERT( xContainer.is(), "binding should have a namespace container" );
+ if( xContainer.is() )
+ lcl_fillNamespaceContainer( GetImport().GetNamespaceMap(), xContainer);
+
+ // call super-class for attribute handling
+ TokenContext::StartElement( xAttributeList );
+}
+
+/** will be called for each child element */
+SvXMLImportContext* XFormsBindContext::HandleChild(
+ sal_uInt16,
+ sal_uInt16,
+ const OUString&,
+ const Reference<XAttributeList>& )
+{
+ OSL_FAIL( "no children supported" );
+ return NULL;
+}
+
+
+void lcl_fillNamespaceContainer(
+ const SvXMLNamespaceMap& aMap,
+ Reference<XNameContainer>& xContainer )
+{
+ sal_uInt16 nKeyIter = aMap.GetFirstKey();
+ do
+ {
+ // get prefix and namespace
+ const OUString& sPrefix = aMap.GetPrefixByKey( nKeyIter );
+ const OUString& sNamespace = aMap.GetNameByKey( nKeyIter );
+
+ // as a hack, we will ignore our own 'default' namespaces
+ DBG_ASSERT( sPrefix.getLength() > 0, "no prefix?" );
+ if( sPrefix.getStr()[0] != sal_Unicode( '_' ) &&
+ nKeyIter >= XML_OLD_NAMESPACE_META_IDX )
+ {
+ // insert prefix (use replace if already known)
+ if( xContainer->hasByName( sPrefix ) )
+ xContainer->replaceByName( sPrefix, makeAny( sNamespace ) );
+ else
+ xContainer->insertByName( sPrefix, makeAny( sNamespace ) );
+ }
+
+ // proceed to next
+ nKeyIter = aMap.GetNextKey( nKeyIter );
+ }
+ while( nKeyIter != XML_NAMESPACE_UNKNOWN );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/xforms/XFormsBindContext.hxx b/xmloff/source/xforms/XFormsBindContext.hxx
new file mode 100644
index 000000000000..f6e723a9f424
--- /dev/null
+++ b/xmloff/source/xforms/XFormsBindContext.hxx
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XFORMSBINDCONTEXT_HXX
+#define _XMLOFF_XFORMSBINDCONTEXT_HXX
+
+
+//
+// include for parent class and members
+//
+
+#include "TokenContext.hxx"
+#include <com/sun/star/uno/Reference.hxx>
+
+
+//
+// forward declarations
+//
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+ namespace beans { class XPropertySet; }
+ namespace xforms { class XModel; }
+} } }
+namespace rtl { class OUString; }
+class SvXMLImport;
+class SvXMLImportContext;
+
+
+/** import the xforms:binding element */
+class XFormsBindContext : public TokenContext
+{
+ const com::sun::star::uno::Reference<com::sun::star::xforms::XModel> mxModel;
+ com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> mxBinding;
+
+public:
+
+ XFormsBindContext( SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>& xModel );
+ virtual ~XFormsBindContext();
+
+
+ //
+ // implement SvXMLImportContext & TokenContext methods:
+ //
+
+ virtual void StartElement(
+ const com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+protected:
+ virtual void HandleAttribute( sal_uInt16 nToken,
+ const rtl::OUString& rValue );
+
+ virtual SvXMLImportContext* HandleChild(
+ sal_uInt16 nToken,
+ sal_uInt16 nNamespace,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/xforms/XFormsInstanceContext.cxx b/xmloff/source/xforms/XFormsInstanceContext.cxx
new file mode 100644
index 000000000000..eeb6621eb2ff
--- /dev/null
+++ b/xmloff/source/xforms/XFormsInstanceContext.cxx
@@ -0,0 +1,161 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "XFormsInstanceContext.hxx"
+
+#include "DomBuilderContext.hxx"
+#include "xformsapi.hxx"
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/xml/dom/XDocument.hpp>
+#include <com/sun/star/xforms/XModel.hpp>
+#include <tools/debug.hxx>
+
+#include <xmloff/xmlnmspe.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmlerror.hxx>
+#include <xmloff/nmspmap.hxx>
+
+
+using rtl::OUString;
+using com::sun::star::uno::Reference;
+using com::sun::star::uno::makeAny;
+using com::sun::star::uno::UNO_QUERY;
+using com::sun::star::uno::Sequence;
+using com::sun::star::xforms::XModel;
+using com::sun::star::beans::XPropertySet;
+using com::sun::star::beans::PropertyValue;
+using com::sun::star::xml::sax::XAttributeList;
+
+using xmloff::token::IsXMLToken;
+using xmloff::token::XML_INSTANCE;
+using xmloff::token::XML_SRC;
+using xmloff::token::XML_ID;
+
+static SvXMLTokenMapEntry aAttributes[] =
+{
+ TOKEN_MAP_ENTRY( NONE, SRC ),
+ TOKEN_MAP_ENTRY( NONE, ID ),
+ XML_TOKEN_MAP_END
+};
+
+XFormsInstanceContext::XFormsInstanceContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ Reference<XPropertySet> xModel ) :
+ TokenContext( rImport, nPrefix, rLocalName, aAttributes, aEmptyMap ),
+ mxModel( Reference<XModel>( xModel, UNO_QUERY ) )
+{
+ DBG_ASSERT( mxModel.is(), "need model" );
+}
+
+XFormsInstanceContext::~XFormsInstanceContext()
+{
+}
+
+SvXMLImportContext* XFormsInstanceContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList>& )
+{
+ SvXMLImportContext* pContext = NULL;
+
+ // only the first element child of an xforms:instance element
+ // is used as an instance. The other children remainder must be
+ // ignored.
+ if( mxInstance.is() )
+ {
+ GetImport().SetError( XMLERROR_XFORMS_ONLY_ONE_INSTANCE_ELEMENT, rLocalName );
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+ }
+ else
+ {
+ // create new DomBuilderContext. Save reference to tree in Model.
+ DomBuilderContext* pInstance =
+ new DomBuilderContext( GetImport(), nPrefix, rLocalName );
+ mxInstance = pInstance->getTree();
+ pContext = pInstance;
+ }
+
+ DBG_ASSERT( pContext != NULL, "no context!" );
+ return pContext;
+
+}
+
+void XFormsInstanceContext::EndElement()
+{
+ Sequence<PropertyValue> aSequence( 3 );
+ PropertyValue* pSequence = aSequence.getArray();
+ pSequence[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Instance") );
+ pSequence[0].Value <<= mxInstance;
+ pSequence[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("ID") );
+ pSequence[1].Value <<= msId;
+ pSequence[2].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("URL") );
+ pSequence[2].Value <<= msURL;
+
+ mxModel->getInstances()->insert( makeAny( aSequence ) );
+}
+
+
+void XFormsInstanceContext::HandleAttribute(
+ sal_uInt16 nToken,
+ const rtl::OUString& rValue )
+{
+ switch( nToken )
+ {
+ case XML_SRC:
+ msURL = rValue;
+ break;
+ case XML_ID:
+ msId = rValue;
+ break;
+ default:
+ OSL_FAIL( "should not happen" );
+ break;
+ }
+}
+
+SvXMLImportContext* XFormsInstanceContext::HandleChild(
+ sal_uInt16,
+ sal_uInt16,
+ const OUString&,
+ const Reference<XAttributeList>& )
+{
+ OSL_FAIL( "to be handled by CreateChildContext" );
+ return NULL;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/xforms/XFormsInstanceContext.hxx b/xmloff/source/xforms/XFormsInstanceContext.hxx
new file mode 100644
index 000000000000..5c5367018d9f
--- /dev/null
+++ b/xmloff/source/xforms/XFormsInstanceContext.hxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XFORMSINSTANCECONTEXT_HXX
+#define _XMLOFF_XFORMSINSTANCECONTEXT_HXX
+
+
+//
+// include for parent class and members
+//
+
+#include "TokenContext.hxx"
+#include <com/sun/star/uno/Reference.hxx>
+
+
+//
+// forward declarations
+//
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+ namespace xml { namespace dom { class XDocument; } }
+ namespace beans { class XPropertySet; }
+ namespace xforms { class XModel; }
+} } }
+namespace rtl { class OUString; }
+class SvXMLImport;
+class SvXMLImportContext;
+
+
+/** import the xforms:instance element */
+class XFormsInstanceContext : public TokenContext
+{
+ com::sun::star::uno::Reference<com::sun::star::xforms::XModel> mxModel;
+ com::sun::star::uno::Reference<com::sun::star::xml::dom::XDocument> mxInstance;
+ rtl::OUString msId;
+ rtl::OUString msURL;
+
+public:
+
+ XFormsInstanceContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> xModel );
+ virtual ~XFormsInstanceContext();
+
+
+ //
+ // implement SvXMLImportContext & TokenContext methods:
+ // We override CreateChildContext, because we want to read
+ // arbitrary DOM elements. For the attributes, we use the
+ // TokenContext mechanism.
+ //
+
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void EndElement();
+
+protected:
+
+ virtual void HandleAttribute(
+ sal_uInt16 nToken,
+ const rtl::OUString& rValue );
+
+ virtual SvXMLImportContext* HandleChild(
+ sal_uInt16 nToken,
+ sal_uInt16 nNamespace,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList>& xAttrList );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/xforms/XFormsModelContext.cxx b/xmloff/source/xforms/XFormsModelContext.cxx
new file mode 100644
index 000000000000..7af420c45eba
--- /dev/null
+++ b/xmloff/source/xforms/XFormsModelContext.cxx
@@ -0,0 +1,166 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "XFormsModelContext.hxx"
+
+#include "XFormsBindContext.hxx"
+#include "XFormsSubmissionContext.hxx"
+#include "XFormsInstanceContext.hxx"
+#include "SchemaContext.hxx"
+#include "xformsapi.hxx"
+
+#include <xmloff/xmlimp.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlerror.hxx"
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/xml/dom/XDocument.hpp>
+#include <com/sun/star/util/XUpdatable.hpp>
+#include <com/sun/star/xforms/XModel.hpp>
+
+#include <tools/debug.hxx>
+
+
+using rtl::OUString;
+using com::sun::star::xml::sax::XAttributeList;
+using com::sun::star::beans::XPropertySet;
+using com::sun::star::util::XUpdatable;
+using namespace com::sun::star::uno;
+using namespace xmloff::token;
+
+
+
+
+static SvXMLTokenMapEntry aAttributes[] =
+{
+ TOKEN_MAP_ENTRY( NONE, ID ),
+ TOKEN_MAP_ENTRY( NONE, SCHEMA ),
+ XML_TOKEN_MAP_END
+};
+
+static SvXMLTokenMapEntry aChildren[] =
+{
+ TOKEN_MAP_ENTRY( XFORMS, INSTANCE ),
+ TOKEN_MAP_ENTRY( XFORMS, BIND ),
+ TOKEN_MAP_ENTRY( XFORMS, SUBMISSION ),
+ TOKEN_MAP_ENTRY( XSD, SCHEMA ),
+ XML_TOKEN_MAP_END
+};
+
+
+XFormsModelContext::XFormsModelContext( SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName ) :
+ TokenContext( rImport, nPrefix, rLocalName, aAttributes, aChildren ),
+ mxModel( lcl_createXFormsModel() )
+{
+}
+
+XFormsModelContext::~XFormsModelContext()
+{
+}
+
+
+Reference<XPropertySet> XFormsModelContext::getModel()
+{
+ return mxModel;
+}
+
+
+void XFormsModelContext::HandleAttribute(
+ sal_uInt16 nToken,
+ const OUString& rValue )
+{
+ switch( nToken )
+ {
+ case XML_ID:
+ mxModel->setPropertyValue( OUSTRING("ID"), makeAny( rValue ) );
+ break;
+ case XML_SCHEMA:
+ GetImport().SetError( XMLERROR_XFORMS_NO_SCHEMA_SUPPORT );
+ break;
+ default:
+ OSL_FAIL( "this should not happen" );
+ break;
+ }
+}
+
+SvXMLImportContext* XFormsModelContext::HandleChild(
+ sal_uInt16 nToken,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList>& )
+{
+ SvXMLImportContext* pContext = NULL;
+
+ switch( nToken )
+ {
+ case XML_INSTANCE:
+ pContext = new XFormsInstanceContext( GetImport(), nPrefix, rLocalName,
+ mxModel );
+ break;
+ case XML_BIND:
+ pContext = new XFormsBindContext( GetImport(), nPrefix, rLocalName,
+ mxModel );
+ break;
+ case XML_SUBMISSION:
+ pContext = new XFormsSubmissionContext( GetImport(), nPrefix,
+ rLocalName, mxModel );
+ break;
+ case XML_SCHEMA:
+ pContext = new SchemaContext(
+ GetImport(), nPrefix, rLocalName,
+ Reference<com::sun::star::xforms::XModel>( mxModel,
+ UNO_QUERY_THROW )
+ ->getDataTypeRepository() );
+ break;
+ default:
+ OSL_FAIL( "Boooo!" );
+ break;
+ }
+
+ return pContext;
+}
+
+void XFormsModelContext::EndElement()
+{
+ // update before putting model into document
+ Reference<XUpdatable> xUpdate( mxModel, UNO_QUERY );
+ if( xUpdate.is() )
+ xUpdate->update();
+
+ GetImport().initXForms();
+ lcl_addXFormsModel( GetImport().GetModel(), getModel() );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/xforms/XFormsModelContext.hxx b/xmloff/source/xforms/XFormsModelContext.hxx
new file mode 100644
index 000000000000..8c89fcd8470b
--- /dev/null
+++ b/xmloff/source/xforms/XFormsModelContext.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XFORMSMODELCONTEXT_HXX
+#define _XMLOFF_XFORMSMODELCONTEXT_HXX
+
+
+//
+// include for parent class and members
+//
+
+#include "TokenContext.hxx"
+#include <com/sun/star/uno/Reference.hxx>
+
+
+//
+// forward declarations
+//
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+ namespace beans { class XPropertySet; }
+} } }
+namespace rtl { class OUString; }
+class SvXMLImport;
+class SvXMLImportContext;
+
+/** import the xforms:model element */
+class XFormsModelContext : public TokenContext
+{
+ com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> mxModel;
+
+public:
+
+ XFormsModelContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName );
+ virtual ~XFormsModelContext();
+
+ com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> getModel();
+
+ //
+ // implement SvXMLImportContext & TokenContext methods:
+ //
+
+ virtual void EndElement();
+
+protected:
+
+ virtual void HandleAttribute(
+ sal_uInt16 nToken,
+ const rtl::OUString& rValue );
+
+ virtual SvXMLImportContext* HandleChild(
+ sal_uInt16 nToken,
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList>& xAttrList );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/xforms/XFormsModelExport.hxx b/xmloff/source/xforms/XFormsModelExport.hxx
new file mode 100644
index 000000000000..202692a4f080
--- /dev/null
+++ b/xmloff/source/xforms/XFormsModelExport.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XFORMSMODELEXPORT_HXX
+#define _XMLOFF_XFORMSMODELEXPORT_HXX
+
+#include <sal/types.h>
+
+class SvXMLExport;
+namespace com { namespace sun { namespace star {
+ namespace uno { template<typename T> class Reference; }
+ namespace beans { class XPropertySet; }
+} } }
+
+void exportXFormsModel( SvXMLExport&,
+ const com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>& );
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/xforms/XFormsSubmissionContext.cxx b/xmloff/source/xforms/XFormsSubmissionContext.cxx
new file mode 100644
index 000000000000..e86bfc7701bb
--- /dev/null
+++ b/xmloff/source/xforms/XFormsSubmissionContext.cxx
@@ -0,0 +1,185 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "XFormsSubmissionContext.hxx"
+
+#include "xformsapi.hxx"
+
+#include <xmloff/xmlimp.hxx>
+#include "xmloff/xmlerror.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmltkmap.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmluconv.hxx>
+
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/xforms/XModel.hpp>
+
+#include <tools/debug.hxx>
+
+using rtl::OUString;
+using com::sun::star::beans::XPropertySet;
+using com::sun::star::container::XNameContainer;
+using com::sun::star::xml::sax::XAttributeList;
+using com::sun::star::xforms::XModel;
+
+using namespace com::sun::star::uno;
+using namespace xmloff::token;
+
+
+
+
+static struct SvXMLTokenMapEntry aAttributeMap[] =
+{
+ TOKEN_MAP_ENTRY( NONE, ID ),
+ TOKEN_MAP_ENTRY( NONE, BIND ),
+ TOKEN_MAP_ENTRY( NONE, REF ),
+ TOKEN_MAP_ENTRY( NONE, ACTION ),
+ TOKEN_MAP_ENTRY( NONE, METHOD ),
+ TOKEN_MAP_ENTRY( NONE, VERSION ),
+ TOKEN_MAP_ENTRY( NONE, INDENT ),
+ TOKEN_MAP_ENTRY( NONE, MEDIATYPE ),
+ TOKEN_MAP_ENTRY( NONE, ENCODING ),
+ TOKEN_MAP_ENTRY( NONE, OMIT_XML_DECLARATION ),
+ TOKEN_MAP_ENTRY( NONE, STANDALONE ),
+ TOKEN_MAP_ENTRY( NONE, CDATA_SECTION_ELEMENTS ),
+ TOKEN_MAP_ENTRY( NONE, REPLACE ),
+ TOKEN_MAP_ENTRY( NONE, SEPARATOR ),
+ TOKEN_MAP_ENTRY( NONE, INCLUDENAMESPACEPREFIXES ),
+ XML_TOKEN_MAP_END
+};
+
+// helper function; see below
+void lcl_fillNamespaceContainer( const SvXMLNamespaceMap&,
+ Reference<XNameContainer>& );
+
+XFormsSubmissionContext::XFormsSubmissionContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XPropertySet>& xModel ) :
+ TokenContext( rImport, nPrefix, rLocalName, aAttributeMap, aEmptyMap ),
+ mxSubmission()
+{
+ // register submission with model
+ DBG_ASSERT( xModel.is(), "need model" );
+ Reference<XModel> xXModel( xModel, UNO_QUERY );
+ DBG_ASSERT( xXModel.is(), "need XModel" );
+ mxSubmission = xXModel->createSubmission().get();
+ DBG_ASSERT( mxSubmission.is(), "can't create submission" );
+ xXModel->getSubmissions()->insert( makeAny( mxSubmission ) );
+}
+
+XFormsSubmissionContext::~XFormsSubmissionContext()
+{
+}
+
+Any toBool( const OUString& rValue )
+{
+ Any aValue;
+ bool bValue;
+ if( SvXMLUnitConverter::convertBool( bValue, rValue ) )
+ {
+ aValue <<= ( bValue ? true : false );
+ }
+ return aValue;
+}
+
+void XFormsSubmissionContext::HandleAttribute( sal_uInt16 nToken,
+ const OUString& rValue )
+{
+ switch( nToken )
+ {
+ case XML_ID:
+ lcl_setValue( mxSubmission, OUSTRING("ID"), rValue );
+ break;
+ case XML_BIND:
+ lcl_setValue( mxSubmission, OUSTRING("Bind"), rValue );
+ break;
+ case XML_REF:
+ lcl_setValue( mxSubmission, OUSTRING("Ref"), rValue );
+ break;
+ case XML_ACTION:
+ lcl_setValue( mxSubmission, OUSTRING("Action"), rValue );
+ break;
+ case XML_METHOD:
+ lcl_setValue( mxSubmission, OUSTRING("Method"), rValue );
+ break;
+ case XML_VERSION:
+ lcl_setValue( mxSubmission, OUSTRING("Version"), rValue );
+ break;
+ case XML_INDENT:
+ lcl_setValue( mxSubmission, OUSTRING("Indent"), toBool( rValue ) );
+ break;
+ case XML_MEDIATYPE:
+ lcl_setValue( mxSubmission, OUSTRING("MediaType"), rValue );
+ break;
+ case XML_ENCODING:
+ lcl_setValue( mxSubmission, OUSTRING("Encoding"), rValue );
+ break;
+ case XML_OMIT_XML_DECLARATION:
+ lcl_setValue( mxSubmission, OUSTRING("OmitXmlDeclaration"),
+ toBool( rValue ) );
+ break;
+ case XML_STANDALONE:
+ lcl_setValue( mxSubmission, OUSTRING("Standalone"), toBool( rValue ) );
+ break;
+ case XML_CDATA_SECTION_ELEMENTS:
+ lcl_setValue( mxSubmission, OUSTRING("CDataSectionElement"), rValue );
+ break;
+ case XML_REPLACE:
+ lcl_setValue( mxSubmission, OUSTRING("Replace"), rValue );
+ break;
+ case XML_SEPARATOR:
+ lcl_setValue( mxSubmission, OUSTRING("Separator"), rValue );
+ break;
+ case XML_INCLUDENAMESPACEPREFIXES:
+ lcl_setValue( mxSubmission, OUSTRING("IncludeNamespacePrefixes"), rValue );
+ break;
+ default:
+ OSL_FAIL( "unknown attribute" );
+ break;
+ }
+}
+
+/** will be called for each child element */
+SvXMLImportContext* XFormsSubmissionContext::HandleChild(
+ sal_uInt16,
+ sal_uInt16,
+ const OUString&,
+ const Reference<XAttributeList>& )
+{
+ OSL_FAIL( "no children supported" );
+ return NULL;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/xforms/XFormsSubmissionContext.hxx b/xmloff/source/xforms/XFormsSubmissionContext.hxx
new file mode 100644
index 000000000000..a08ab8663f67
--- /dev/null
+++ b/xmloff/source/xforms/XFormsSubmissionContext.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XFORMSSUBMISSIONCONTEXT_HXX
+#define _XMLOFF_XFORMSSUBMISSIONCONTEXT_HXX
+
+
+//
+// include for parent class and members
+//
+
+#include "TokenContext.hxx"
+#include <com/sun/star/uno/Reference.hxx>
+
+
+//
+// forward declarations
+//
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+ namespace beans { class XPropertySet; }
+} } }
+namespace rtl { class OUString; }
+class SvXMLImport;
+class SvXMLImportContext;
+
+
+/** import the xforms:submission element */
+class XFormsSubmissionContext : public TokenContext
+{
+ com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> mxSubmission;
+
+public:
+
+ XFormsSubmissionContext( SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>& xModel );
+ virtual ~XFormsSubmissionContext();
+
+
+ //
+ // implement TokenContext methods:
+ //
+
+protected:
+ virtual void HandleAttribute( sal_uInt16 nToken,
+ const rtl::OUString& rValue );
+
+ virtual SvXMLImportContext* HandleChild(
+ sal_uInt16 nToken,
+ sal_uInt16 nNamespace,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/xforms/xformsapi.cxx b/xmloff/source/xforms/xformsapi.cxx
new file mode 100644
index 000000000000..4d23ba45d3d9
--- /dev/null
+++ b/xmloff/source/xforms/xformsapi.cxx
@@ -0,0 +1,352 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "xformsapi.hxx"
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/xforms/XFormsSupplier.hpp>
+#include <com/sun/star/xforms/XDataTypeRepository.hpp>
+#include <com/sun/star/xforms/XModel.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/xsd/DataTypeClass.hpp>
+
+#include <unotools/processfactory.hxx>
+#include <tools/debug.hxx>
+
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmlnmspe.hxx>
+#include <xmloff/xmltkmap.hxx>
+
+using rtl::OUString;
+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::XPropertySet;
+using com::sun::star::container::XNameAccess;
+using com::sun::star::lang::XMultiServiceFactory;
+using com::sun::star::xforms::XFormsSupplier;
+using com::sun::star::xforms::XDataTypeRepository;
+using com::sun::star::container::XNameContainer;
+using utl::getProcessServiceFactory;
+using com::sun::star::uno::makeAny;
+using com::sun::star::uno::Any;
+using com::sun::star::uno::Exception;
+
+using namespace com::sun::star;
+using namespace xmloff::token;
+
+Reference<XPropertySet> lcl_createPropertySet( const OUString& rServiceName )
+{
+ Reference<XMultiServiceFactory> xFactory = getProcessServiceFactory();
+ DBG_ASSERT( xFactory.is(), "can't get service factory" );
+
+ Reference<XPropertySet> xModel( xFactory->createInstance( rServiceName ),
+ UNO_QUERY_THROW );
+ DBG_ASSERT( xModel.is(), "can't create model" );
+
+ return xModel;
+}
+
+Reference<XPropertySet> lcl_createXFormsModel()
+{
+ return lcl_createPropertySet( OUSTRING( "com.sun.star.xforms.Model" ) );
+}
+
+Reference<XPropertySet> lcl_createXFormsBinding()
+{
+ return lcl_createPropertySet( OUSTRING( "com.sun.star.xforms.Binding" ) );
+}
+
+void lcl_addXFormsModel(
+ const Reference<frame::XModel>& xDocument,
+ const Reference<XPropertySet>& xModel )
+{
+ bool bSuccess = false;
+ try
+ {
+ Reference<XFormsSupplier> xSupplier( xDocument, UNO_QUERY );
+ if( xSupplier.is() )
+ {
+ Reference<XNameContainer> xForms = xSupplier->getXForms();
+ if( xForms.is() )
+ {
+ OUString sName;
+ xModel->getPropertyValue( OUSTRING("ID")) >>= sName;
+ xForms->insertByName( sName, makeAny( xModel ) );
+ bSuccess = true;
+ }
+ }
+ }
+ catch( const Exception& )
+ {
+ ; // no success!
+ }
+
+ // TODO: implement proper error handling
+ DBG_ASSERT( bSuccess, "can't import model" );
+ (void)bSuccess;
+}
+
+Reference<XPropertySet> lcl_findXFormsBindingOrSubmission(
+ Reference<frame::XModel>& xDocument,
+ const rtl::OUString& rBindingID,
+ bool bBinding )
+{
+ // find binding by iterating over all models, and look for the
+ // given binding ID
+
+ Reference<XPropertySet> xRet;
+ try
+ {
+ // get supplier
+ Reference<XFormsSupplier> xSupplier( xDocument, UNO_QUERY );
+ if( xSupplier.is() )
+ {
+ // get XForms models
+ Reference<XNameContainer> xForms = xSupplier->getXForms();
+ if( xForms.is() )
+ {
+ // iterate over all models
+ Sequence<OUString> aNames = xForms->getElementNames();
+ const OUString* pNames = aNames.getConstArray();
+ sal_Int32 nNames = aNames.getLength();
+ for( sal_Int32 n = 0; (n < nNames) && !xRet.is(); n++ )
+ {
+ Reference<xforms::XModel> xModel(
+ xForms->getByName( pNames[n] ), UNO_QUERY );
+ if( xModel.is() )
+ {
+ // ask model for bindings
+ Reference<XNameAccess> xBindings(
+ bBinding
+ ? xModel->getBindings()
+ : xModel->getSubmissions(),
+ UNO_QUERY_THROW );
+
+ // finally, ask binding for name
+ if( xBindings->hasByName( rBindingID ) )
+ xRet.set( xBindings->getByName( rBindingID ),
+ UNO_QUERY );
+ }
+ }
+ }
+ }
+ }
+ catch( const Exception& )
+ {
+ ; // no success!
+ }
+
+ // TODO: if (!xRet.is()) rImport.SetError(...);
+
+ return xRet;
+}
+
+Reference<XPropertySet> lcl_findXFormsBinding(
+ Reference<frame::XModel>& xDocument,
+ const rtl::OUString& rBindingID )
+{
+ return lcl_findXFormsBindingOrSubmission( xDocument, rBindingID, true );
+}
+
+Reference<XPropertySet> lcl_findXFormsSubmission(
+ Reference<frame::XModel>& xDocument,
+ const rtl::OUString& rBindingID )
+{
+ return lcl_findXFormsBindingOrSubmission( xDocument, rBindingID, false );
+}
+
+void lcl_setValue( Reference<XPropertySet>& xPropertySet,
+ const OUString& rName,
+ const Any rAny )
+{
+ xPropertySet->setPropertyValue( rName, rAny );
+}
+
+
+Reference<XPropertySet> lcl_getXFormsModel( const Reference<frame::XModel>& xDoc )
+{
+ Reference<XPropertySet> xRet;
+ try
+ {
+ Reference<XFormsSupplier> xSupplier( xDoc, UNO_QUERY );
+ if( xSupplier.is() )
+ {
+ Reference<XNameContainer> xForms = xSupplier->getXForms();
+ if( xForms.is() )
+ {
+ Sequence<OUString> aNames = xForms->getElementNames();
+ if( aNames.getLength() > 0 )
+ xRet.set( xForms->getByName( aNames[0] ), UNO_QUERY );
+ }
+ }
+ }
+ catch( const Exception& )
+ {
+ ; // no success!
+ }
+
+ return xRet;
+}
+
+#define TOKEN_MAP_ENTRY(NAMESPACE,TOKEN) { XML_NAMESPACE_##NAMESPACE, xmloff::token::XML_##TOKEN, xmloff::token::XML_##TOKEN }
+static SvXMLTokenMapEntry aTypes[] =
+{
+ TOKEN_MAP_ENTRY( XSD, STRING ),
+ TOKEN_MAP_ENTRY( XSD, DECIMAL ),
+ TOKEN_MAP_ENTRY( XSD, DOUBLE ),
+ TOKEN_MAP_ENTRY( XSD, FLOAT ),
+ TOKEN_MAP_ENTRY( XSD, BOOLEAN ),
+ TOKEN_MAP_ENTRY( XSD, ANYURI ),
+ TOKEN_MAP_ENTRY( XSD, DATETIME_XSD ),
+ TOKEN_MAP_ENTRY( XSD, DATE ),
+ TOKEN_MAP_ENTRY( XSD, TIME ),
+ TOKEN_MAP_ENTRY( XSD, YEAR ),
+ TOKEN_MAP_ENTRY( XSD, MONTH ),
+ TOKEN_MAP_ENTRY( XSD, DAY ),
+ XML_TOKEN_MAP_END
+};
+
+sal_uInt16 lcl_getTypeClass(
+ const Reference<XDataTypeRepository>&
+ #ifdef DBG_UTIL
+ xRepository
+ #endif
+ ,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ const OUString& rXMLName )
+{
+ // translate name into token for local name
+ OUString sLocalName;
+ sal_uInt16 nPrefix = rNamespaceMap.GetKeyByAttrName(rXMLName, &sLocalName);
+ SvXMLTokenMap aMap( aTypes );
+ sal_uInt16 mnToken = aMap.Get( nPrefix, sLocalName );
+
+ sal_uInt16 nTypeClass = com::sun::star::xsd::DataTypeClass::STRING;
+ if( mnToken != XML_TOK_UNKNOWN )
+ {
+ // we found an XSD name: then get the proper API name for it
+ DBG_ASSERT( xRepository.is(), "can't find type without repository");
+ switch( mnToken )
+ {
+ case XML_STRING:
+ nTypeClass = com::sun::star::xsd::DataTypeClass::STRING;
+ break;
+ case XML_ANYURI:
+ nTypeClass = com::sun::star::xsd::DataTypeClass::anyURI;
+ break;
+ case XML_DECIMAL:
+ nTypeClass = com::sun::star::xsd::DataTypeClass::DECIMAL;
+ break;
+ case XML_DOUBLE:
+ nTypeClass = com::sun::star::xsd::DataTypeClass::DOUBLE;
+ break;
+ case XML_FLOAT:
+ nTypeClass = com::sun::star::xsd::DataTypeClass::FLOAT;
+ break;
+ case XML_BOOLEAN:
+ nTypeClass = com::sun::star::xsd::DataTypeClass::BOOLEAN;
+ break;
+ case XML_DATETIME_XSD:
+ nTypeClass = com::sun::star::xsd::DataTypeClass::DATETIME;
+ break;
+ case XML_DATE:
+ nTypeClass = com::sun::star::xsd::DataTypeClass::DATE;
+ break;
+ case XML_TIME:
+ nTypeClass = com::sun::star::xsd::DataTypeClass::TIME;
+ break;
+ case XML_YEAR:
+ nTypeClass = com::sun::star::xsd::DataTypeClass::gYear;
+ break;
+ case XML_DAY:
+ nTypeClass = com::sun::star::xsd::DataTypeClass::gDay;
+ break;
+ case XML_MONTH:
+ nTypeClass = com::sun::star::xsd::DataTypeClass::gMonth;
+ break;
+
+ /* data types not yet supported:
+ nTypeClass = com::sun::star::xsd::DataTypeClass::DURATION;
+ nTypeClass = com::sun::star::xsd::DataTypeClass::gYearMonth;
+ nTypeClass = com::sun::star::xsd::DataTypeClass::gMonthDay;
+ nTypeClass = com::sun::star::xsd::DataTypeClass::hexBinary;
+ nTypeClass = com::sun::star::xsd::DataTypeClass::base64Binary;
+ nTypeClass = com::sun::star::xsd::DataTypeClass::QName;
+ nTypeClass = com::sun::star::xsd::DataTypeClass::NOTATION;
+ */
+ }
+ }
+
+ return nTypeClass;
+}
+
+
+rtl::OUString lcl_getTypeName(
+ const Reference<XDataTypeRepository>& xRepository,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ const OUString& rXMLName )
+{
+ OUString sLocalName;
+ sal_uInt16 nPrefix = rNamespaceMap.GetKeyByAttrName(rXMLName, &sLocalName);
+ SvXMLTokenMap aMap( aTypes );
+ sal_uInt16 mnToken = aMap.Get( nPrefix, sLocalName );
+ return ( mnToken == XML_TOK_UNKNOWN )
+ ? rXMLName
+ : lcl_getBasicTypeName( xRepository, rNamespaceMap, rXMLName );
+}
+
+rtl::OUString lcl_getBasicTypeName(
+ const Reference<XDataTypeRepository>& xRepository,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ const OUString& rXMLName )
+{
+ OUString sTypeName = rXMLName;
+ try
+ {
+ sTypeName =
+ xRepository->getBasicDataType(
+ lcl_getTypeClass( xRepository, rNamespaceMap, rXMLName ) )
+ ->getName();
+ }
+ catch( const Exception& )
+ {
+ OSL_FAIL( "exception during type creation" );
+ }
+ return sTypeName;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/xforms/xformsapi.hxx b/xmloff/source/xforms/xformsapi.hxx
new file mode 100644
index 000000000000..fc24b06248f3
--- /dev/null
+++ b/xmloff/source/xforms/xformsapi.hxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 _XMLOFF_XFORMSAPI_HXX
+#define _XMLOFF_XFORMSAPI_HXX
+
+//
+// this is a collection of several functions to make dealing with the XForms
+// API a little easier
+//
+
+#include <com/sun/star/uno/Any.hxx>
+
+namespace rtl { class OUString; }
+namespace com { namespace sun { namespace star {
+ namespace beans { class XPropertySet; }
+ namespace frame { class XModel; }
+ namespace uno { template<class A> class Reference; }
+ namespace xforms { class XDataTypeRepository; }
+} } }
+class SvXMLNamespaceMap;
+
+
+#define OUSTRING(msg) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(msg))
+
+com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> lcl_createXFormsModel();
+
+com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> lcl_createXFormsBinding();
+
+void lcl_addXFormsModel(
+ const com::sun::star::uno::Reference<com::sun::star::frame::XModel>& xDocument,
+ const com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>& xModel );
+
+com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> lcl_findXFormsBinding( com::sun::star::uno::Reference<com::sun::star::frame::XModel>&, const rtl::OUString& );
+
+com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> lcl_findXFormsSubmission( com::sun::star::uno::Reference<com::sun::star::frame::XModel>&, const rtl::OUString& );
+
+void lcl_setValue(
+ com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>& xPropSet,
+ const rtl::OUString& rName,
+ const com::sun::star::uno::Any rAny );
+
+template<typename T>
+void lcl_setValue(
+ com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>& xPropSet,
+ const rtl::OUString& rName,
+ T& aValue )
+{
+ lcl_setValue( xPropSet, rName, com::sun::star::uno::makeAny( aValue ) );
+}
+
+
+com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> lcl_getXFormsModel( const com::sun::star::uno::Reference<com::sun::star::frame::XModel>& );
+
+sal_uInt16 lcl_getTypeClass(
+ const com::sun::star::uno::Reference<com::sun::star::xforms::XDataTypeRepository>& xRepository,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ const rtl::OUString& rXMLName );
+
+rtl::OUString lcl_getTypeName(
+ const com::sun::star::uno::Reference<com::sun::star::xforms::XDataTypeRepository>& xRepository,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ const rtl::OUString& rXMLName );
+
+rtl::OUString lcl_getBasicTypeName(
+ const com::sun::star::uno::Reference<com::sun::star::xforms::XDataTypeRepository>& xRepository,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ const rtl::OUString& rXMLName );
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/xforms/xformsexport.cxx b/xmloff/source/xforms/xformsexport.cxx
new file mode 100644
index 000000000000..afd8731473b3
--- /dev/null
+++ b/xmloff/source/xforms/xformsexport.cxx
@@ -0,0 +1,838 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "xmloff/xformsexport.hxx"
+
+#include "XFormsModelExport.hxx"
+#include "xformsapi.hxx"
+
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include "DomExport.hxx"
+#include <xmloff/xmluconv.hxx>
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/processfactory.hxx>
+
+#include "tools/debug.hxx"
+#include <tools/diagnose_ex.h>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/xml/dom/XDocument.hpp>
+#include <com/sun/star/form/binding/XValueBinding.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/submission/XSubmissionSupplier.hpp>
+#include <com/sun/star/xforms/XModel.hpp>
+#include <com/sun/star/xforms/XDataTypeRepository.hpp>
+#include <com/sun/star/xforms/XFormsSupplier.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/container/XEnumeration.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/xsd/WhiteSpaceTreatment.hpp>
+#include <com/sun/star/xsd/DataTypeClass.hpp>
+#include <com/sun/star/xsd/XDataType.hpp>
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/util/Time.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+using namespace xmloff::token;
+
+using rtl::OUString;
+using rtl::OUStringBuffer;
+using com::sun::star::beans::XPropertySet;
+using com::sun::star::beans::XPropertySetInfo;
+using com::sun::star::container::XIndexAccess;
+using com::sun::star::container::XNameAccess;
+using com::sun::star::container::XNameContainer;
+using com::sun::star::container::XEnumerationAccess;
+using com::sun::star::container::XEnumeration;
+using com::sun::star::xml::dom::XDocument;
+using com::sun::star::form::binding::XValueBinding;
+using com::sun::star::form::binding::XBindableValue;
+using com::sun::star::form::binding::XListEntrySink;
+using com::sun::star::form::submission::XSubmissionSupplier;
+using com::sun::star::beans::PropertyValue;
+using com::sun::star::xsd::XDataType;
+using com::sun::star::xforms::XDataTypeRepository;
+using com::sun::star::xforms::XFormsSupplier;
+using com::sun::star::util::Date;
+using com::sun::star::util::DateTime;
+
+void exportXForms( SvXMLExport& rExport )
+{
+ Reference<XFormsSupplier> xSupplier( rExport.GetModel(), UNO_QUERY );
+ if( xSupplier.is() )
+ {
+ Reference<XNameContainer> xForms = xSupplier->getXForms();
+ if( xForms.is() )
+ {
+ Sequence<OUString> aNames = xForms->getElementNames();
+ const OUString* pNames = aNames.getConstArray();
+ sal_Int32 nNames = aNames.getLength();
+
+ for( sal_Int32 n = 0; n < nNames; n++ )
+ {
+ Reference<XPropertySet> xModel( xForms->getByName( pNames[n] ),
+ UNO_QUERY );
+ exportXFormsModel( rExport, xModel );
+ }
+ }
+ }
+}
+
+
+void exportXFormsInstance( SvXMLExport&, const Sequence<PropertyValue>& );
+void exportXFormsBinding( SvXMLExport&, const Reference<XPropertySet>& );
+void exportXFormsSubmission( SvXMLExport&, const Reference<XPropertySet>& );
+void exportXFormsSchemas( SvXMLExport&, const Reference<com::sun::star::xforms::XModel>& );
+
+
+typedef OUString (*convert_t)( const Any& );
+typedef struct
+{
+ const sal_Char* pPropertyName;
+ sal_uInt16 nPropertyNameLength;
+ sal_uInt16 nNamespace;
+ sal_uInt16 nToken;
+ convert_t aConverter;
+} ExportTable;
+void lcl_export( const Reference<XPropertySet>& rPropertySet,
+ SvXMLExport& rExport,
+ const ExportTable* pTable );
+
+#define TABLE_ENTRY(NAME,NAMESPACE,TOKEN,CONVERTER) { NAME,sizeof(NAME)-1,XML_NAMESPACE_##NAMESPACE,xmloff::token::XML_##TOKEN, CONVERTER }
+#define TABLE_END { NULL, 0, 0, 0, NULL }
+
+
+// any conversion functions
+OUString lcl_string( const Any& );
+OUString lcl_bool( const Any& );
+OUString lcl_whitespace( const Any& );
+template<typename T, void (*FUNC)( OUStringBuffer&, T )> OUString lcl_convert( const Any& );
+template<typename T, void (*FUNC)( OUStringBuffer&, const T& )> OUString lcl_convertRef( const Any& );
+
+void lcl_formatDate( OUStringBuffer& aBuffer, const Date& aDate );
+void lcl_formatTime( OUStringBuffer& aBuffer, const com::sun::star::util::Time& aTime );
+void lcl_formatDateTime( OUStringBuffer& aBuffer, const DateTime& aDateTime );
+
+convert_t lcl_int32 = &lcl_convert<sal_Int32,&SvXMLUnitConverter::convertNumber>;
+convert_t lcl_double = &lcl_convert<double,&SvXMLUnitConverter::convertDouble>;
+convert_t lcl_dateTime = &lcl_convertRef<DateTime,&lcl_formatDateTime>;
+convert_t lcl_date = &lcl_convertRef<Date,&lcl_formatDate>;
+convert_t lcl_time = &lcl_convertRef<com::sun::star::util::Time,&lcl_formatTime>;
+
+// other functions
+OUString lcl_getXSDType( SvXMLExport& rExport,
+ const Reference<XPropertySet>& xType );
+
+
+//
+// the model
+//
+
+static const ExportTable aXFormsModelTable[] =
+{
+ TABLE_ENTRY( "ID", NONE, ID, lcl_string ),
+ TABLE_ENTRY( "SchemaRef", NONE, SCHEMA, lcl_string ),
+ TABLE_END
+};
+
+void exportXFormsModel( SvXMLExport& rExport,
+ const Reference<XPropertySet>& xModelPropSet )
+{
+ // no model -> don't do anything!
+ Reference<com::sun::star::xforms::XModel> xModel( xModelPropSet, UNO_QUERY );
+ if( ! xModel.is() || ! xModelPropSet.is() )
+ return;
+
+ lcl_export( xModelPropSet, rExport, aXFormsModelTable );
+ SvXMLElementExport aModelElement( rExport, XML_NAMESPACE_XFORMS, XML_MODEL,
+ sal_True, sal_True );
+
+ // instances
+ Reference<XIndexAccess> xInstances( xModel->getInstances(),
+ UNO_QUERY_THROW);
+ sal_Int32 nCount = xInstances->getCount();
+ sal_Int32 i = 0;
+ for( i = 0; i < nCount; i++ )
+ {
+ Sequence<PropertyValue> aInstance;
+ xInstances->getByIndex( i ) >>= aInstance;
+ exportXFormsInstance( rExport, aInstance );
+ }
+
+
+ // bindings
+ Reference<XIndexAccess> xBindings( xModel->getBindings(), UNO_QUERY_THROW);
+ nCount = xBindings->getCount();
+ for( i = 0; i < nCount; i++ )
+ {
+ Reference<XPropertySet> aBinding( xBindings->getByIndex( i ),
+ UNO_QUERY_THROW );
+ exportXFormsBinding( rExport, aBinding );
+ }
+
+ // submissions
+ Reference<XIndexAccess> xSubmissions( xModel->getSubmissions(),
+ UNO_QUERY_THROW );
+ nCount = xSubmissions->getCount();
+ for( i = 0; i < nCount; i++ )
+ {
+ Reference<XPropertySet> xSubmission( xSubmissions->getByIndex( i ),
+ UNO_QUERY_THROW );
+ exportXFormsSubmission( rExport, xSubmission );
+ }
+
+ // schemas
+ exportXFormsSchemas( rExport, xModel );
+}
+
+//
+// the instance
+//
+
+static const ExportTable aXFormsInstanceTable[] =
+{
+ TABLE_ENTRY( "InstanceURL", NONE, SRC, lcl_string ),
+ TABLE_END
+};
+
+void exportXFormsInstance( SvXMLExport& rExport,
+ const Sequence<PropertyValue>& xInstance )
+{
+ OUString sId;
+ OUString sURL;
+ Reference<XDocument> xDoc;
+
+ const PropertyValue* pInstance = xInstance.getConstArray();
+ sal_Int32 nCount = xInstance.getLength();
+ for( sal_Int32 i = 0; i < nCount; i++ )
+ {
+ OUString sName = pInstance[i].Name;
+ const Any& rAny = pInstance[i].Value;
+ if( sName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ID") ) )
+ rAny >>= sId;
+ else if( sName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("URL") ) )
+ rAny >>= sURL;
+ else if( sName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Instance") ))
+ rAny >>= xDoc;
+ }
+
+ if( sId.getLength() > 0 )
+ rExport.AddAttribute( XML_NAMESPACE_NONE, XML_ID, sId );
+
+ if( sURL.getLength() > 0 )
+ rExport.AddAttribute( XML_NAMESPACE_NONE, XML_SRC, sURL );
+
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_XFORMS, XML_INSTANCE,
+ sal_True, sal_True );
+ rExport.IgnorableWhitespace();
+ if( xDoc.is() )
+ {
+ exportDom( rExport, xDoc );
+ }
+}
+
+
+//
+// the binding
+//
+
+static const ExportTable aXFormsBindingTable[] =
+{
+ TABLE_ENTRY( "BindingID", NONE, ID, lcl_string ),
+ TABLE_ENTRY( "BindingExpression", NONE, NODESET, lcl_string ),
+ TABLE_ENTRY( "ReadonlyExpression", NONE, READONLY, lcl_string ),
+ TABLE_ENTRY( "RelevantExpression", NONE, RELEVANT, lcl_string ),
+ TABLE_ENTRY( "RequiredExpression", NONE, REQUIRED, lcl_string ),
+ TABLE_ENTRY( "ConstraintExpression", NONE, CONSTRAINT, lcl_string ),
+ TABLE_ENTRY( "CalculateExpression", NONE, CALCULATE, lcl_string ),
+ // type handled separatly, for type name <-> XSD type conversion
+ // TABLE_ENTRY( "Type", NONE, TYPE, lcl_string ),
+ TABLE_END
+};
+
+void exportXFormsBinding( SvXMLExport& rExport,
+ const Reference<XPropertySet>& xBinding )
+{
+ // name check; generate binding ID if necessary
+ {
+ OUString sName;
+ xBinding->getPropertyValue( OUSTRING("BindingID") ) >>= sName;
+ if( sName.getLength() == 0 )
+ {
+ // if we don't have a name yet, generate one on the fly
+ OUStringBuffer aBuffer;
+ aBuffer.append( OUSTRING("bind_" ) );
+ sal_Int64 nId = reinterpret_cast<sal_uInt64>( xBinding.get() );
+ aBuffer.append( nId , 16 );
+ sName = aBuffer.makeStringAndClear();
+ xBinding->setPropertyValue( OUSTRING("BindingID"), makeAny(sName));
+ }
+ }
+
+ lcl_export( xBinding, rExport, aXFormsBindingTable );
+
+ // handle type attribute
+ {
+ OUString sTypeName;
+ xBinding->getPropertyValue( OUSTRING("Type") ) >>= sTypeName;
+
+ try
+ {
+ // now get type, and determine whether its a standard type. If
+ // so, export the XSD name
+ Reference<com::sun::star::xforms::XModel> xModel(
+ xBinding->getPropertyValue( OUSTRING("Model") ),
+ UNO_QUERY );
+ Reference<XDataTypeRepository> xRepository(
+ xModel.is() ? xModel->getDataTypeRepository() : Reference<XDataTypeRepository>() );
+ if( xRepository.is() )
+ {
+ Reference<XPropertySet> xDataType(
+ xRepository->getDataType( sTypeName ),
+ UNO_QUERY );
+
+ // if it's a basic data type, write out the XSD name
+ // for the XSD type class
+ bool bIsBasic = false;
+ xDataType->getPropertyValue( OUSTRING("IsBasic") ) >>= bIsBasic;
+ if( bIsBasic )
+ sTypeName = lcl_getXSDType( rExport, xDataType );
+ }
+ }
+ catch( Exception& )
+ {
+ ; // ignore; just use typename
+ }
+
+ // now that we have the proper type name, write out the attribute
+ if( sTypeName.getLength() > 0 )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_NONE, XML_TYPE,
+ sTypeName );
+ }
+ }
+
+ // we need to ensure all the namespaces in the binding will work correctly.
+ // to do so, we will write out all missing namespace declaractions.
+ const SvXMLNamespaceMap& rMap = rExport.GetNamespaceMap();
+ Reference<XNameAccess> xNamespaces(
+ xBinding->getPropertyValue( OUSTRING("ModelNamespaces") ), UNO_QUERY);
+ if( xNamespaces.is() )
+ {
+ // iterate over Prefixes for this binding
+ Sequence<OUString> aPrefixes = xNamespaces->getElementNames();
+ const OUString* pPrefixes = aPrefixes.getConstArray();
+ sal_Int32 nPrefixes = aPrefixes.getLength();
+ for( sal_Int32 i = 0; i < nPrefixes; i++ )
+ {
+ const OUString& rPrefix = pPrefixes[i];
+ OUString sURI;
+ xNamespaces->getByName( rPrefix ) >>= sURI;
+
+ // check whether prefix/URI pair is in map; else write declaration
+ // (we don't need to change the map, since this element has no
+ // other content)
+ sal_uInt16 nKey = rMap.GetKeyByPrefix( rPrefix );
+ if( nKey == XML_NAMESPACE_UNKNOWN ||
+ rMap.GetNameByKey( nKey ) != sURI )
+ {
+ rExport.AddAttribute( OUSTRING("xmlns:") + rPrefix, sURI );
+ }
+ }
+ }
+
+ SvXMLElementExport aElement( rExport, XML_NAMESPACE_XFORMS, XML_BIND,
+ sal_True, sal_True );
+}
+
+
+//
+// the submission
+//
+
+static const ExportTable aXFormsSubmissionTable[] =
+{
+ TABLE_ENTRY( "ID", NONE, ID, lcl_string ),
+ TABLE_ENTRY( "Bind", NONE, BIND, lcl_string ),
+ TABLE_ENTRY( "Ref", NONE, REF, lcl_string ),
+ TABLE_ENTRY( "Action", NONE, ACTION, lcl_string ),
+ TABLE_ENTRY( "Method", NONE, METHOD, lcl_string ),
+ TABLE_ENTRY( "Version", NONE, VERSION, lcl_string ),
+ TABLE_ENTRY( "Indent", NONE, INDENT, lcl_bool ),
+ TABLE_ENTRY( "MediaType", NONE, MEDIATYPE, lcl_string ),
+ TABLE_ENTRY( "Encoding", NONE, ENCODING, lcl_string ),
+ TABLE_ENTRY( "OmitXmlDeclaration", NONE, OMIT_XML_DECLARATION, lcl_bool ),
+ TABLE_ENTRY( "Standalone", NONE, STANDALONE, lcl_bool ),
+ TABLE_ENTRY( "CDataSectionElement", NONE, CDATA_SECTION_ELEMENTS, lcl_string ),
+ TABLE_ENTRY( "Replace", NONE, REPLACE, lcl_string ),
+ TABLE_ENTRY( "Separator", NONE, SEPARATOR, lcl_string ),
+ TABLE_ENTRY( "IncludeNamespacePrefixes", NONE, INCLUDENAMESPACEPREFIXES, lcl_string ),
+ TABLE_END
+};
+
+void exportXFormsSubmission( SvXMLExport& rExport,
+ const Reference<XPropertySet>& xSubmission )
+{
+ lcl_export( xSubmission, rExport, aXFormsSubmissionTable );
+ SvXMLElementExport aElement( rExport, XML_NAMESPACE_XFORMS, XML_SUBMISSION,
+ sal_True, sal_True );
+}
+
+
+
+//
+// export data types as XSD schema
+//
+
+static const ExportTable aDataTypeFacetTable[] =
+{
+ TABLE_ENTRY( "Length", XSD, LENGTH, lcl_int32 ),
+ TABLE_ENTRY( "MinLength", XSD, MINLENGTH, lcl_int32 ),
+ TABLE_ENTRY( "MaxLength", XSD, MAXLENGTH, lcl_int32 ),
+ TABLE_ENTRY( "MinInclusiveInt", XSD, MININCLUSIVE, lcl_int32 ),
+ TABLE_ENTRY( "MinExclusiveInt", XSD, MINEXCLUSIVE, lcl_int32 ),
+ TABLE_ENTRY( "MaxInclusiveInt", XSD, MAXINCLUSIVE, lcl_int32 ),
+ TABLE_ENTRY( "MaxExclusiveInt", XSD, MAXEXCLUSIVE, lcl_int32 ),
+ TABLE_ENTRY( "MinInclusiveDouble", XSD, MININCLUSIVE, lcl_double ),
+ TABLE_ENTRY( "MinExclusiveDouble", XSD, MINEXCLUSIVE, lcl_double ),
+ TABLE_ENTRY( "MaxInclusiveDouble", XSD, MAXINCLUSIVE, lcl_double ),
+ TABLE_ENTRY( "MaxExclusiveDouble", XSD, MAXEXCLUSIVE, lcl_double ),
+ TABLE_ENTRY( "MinInclusiveDate", XSD, MININCLUSIVE, lcl_date ),
+ TABLE_ENTRY( "MinExclusiveDate", XSD, MINEXCLUSIVE, lcl_date ),
+ TABLE_ENTRY( "MaxInclusiveDate", XSD, MAXINCLUSIVE, lcl_date ),
+ TABLE_ENTRY( "MaxExclusiveDate", XSD, MAXEXCLUSIVE, lcl_date ),
+ TABLE_ENTRY( "MinInclusiveTime", XSD, MININCLUSIVE, lcl_time ),
+ TABLE_ENTRY( "MinExclusiveTime", XSD, MINEXCLUSIVE, lcl_time ),
+ TABLE_ENTRY( "MaxInclusiveTime", XSD, MAXINCLUSIVE, lcl_time ),
+ TABLE_ENTRY( "MaxExclusiveTime", XSD, MAXEXCLUSIVE, lcl_time ),
+ TABLE_ENTRY( "MinInclusiveDateTime", XSD, MININCLUSIVE, lcl_dateTime ),
+ TABLE_ENTRY( "MinExclusiveDateTime", XSD, MINEXCLUSIVE, lcl_dateTime ),
+ TABLE_ENTRY( "MaxInclusiveDateTime", XSD, MAXINCLUSIVE, lcl_dateTime ),
+ TABLE_ENTRY( "MaxExclusiveDateTime", XSD, MAXEXCLUSIVE, lcl_dateTime ),
+ TABLE_ENTRY( "Pattern", XSD, PATTERN, lcl_string ),
+ // ??? XML_ENUMERATION,
+ TABLE_ENTRY( "WhiteSpace", XSD, WHITESPACE, lcl_whitespace ),
+ TABLE_ENTRY( "TotalDigits", XSD, TOTALDIGITS, lcl_int32 ),
+ TABLE_ENTRY( "FractionDigits", XSD, FRACTIONDIGITS, lcl_int32 ),
+ TABLE_END
+};
+
+// export facets through table; use the same table as lcl_export does
+void lcl_exportDataTypeFacets( SvXMLExport& rExport,
+ const Reference<XPropertySet>& rPropertySet,
+ const ExportTable* pTable )
+{
+ Reference<XPropertySetInfo> xInfo = rPropertySet->getPropertySetInfo();
+ for( const ExportTable* pCurrent = pTable;
+ pCurrent->pPropertyName != NULL;
+ pCurrent++ )
+ {
+ OUString sName( OUString::createFromAscii( pCurrent->pPropertyName ) );
+ if( xInfo->hasPropertyByName( sName ) )
+ {
+ OUString sValue = (*pCurrent->aConverter)(
+ rPropertySet->getPropertyValue( sName ) );
+
+ if( sValue.getLength() > 0 )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_NONE, XML_VALUE, sValue );
+ SvXMLElementExport aFacet(
+ rExport,
+ pCurrent->nNamespace,
+ static_cast<XMLTokenEnum>( pCurrent->nToken ),
+ sal_True, sal_True );
+ }
+ }
+ }
+}
+
+OUString lcl_getXSDType( SvXMLExport& rExport,
+ const Reference<XPropertySet>& xType )
+{
+ // we use string as default...
+ XMLTokenEnum eToken = XML_STRING;
+
+ sal_uInt16 nDataTypeClass = 0;
+ xType->getPropertyValue( OUSTRING("TypeClass") ) >>= nDataTypeClass;
+ switch( nDataTypeClass )
+ {
+ case com::sun::star::xsd::DataTypeClass::STRING:
+ eToken = XML_STRING;
+ break;
+ case com::sun::star::xsd::DataTypeClass::anyURI:
+ eToken = XML_ANYURI;
+ break;
+ case com::sun::star::xsd::DataTypeClass::DECIMAL:
+ eToken = XML_DECIMAL;
+ break;
+ case com::sun::star::xsd::DataTypeClass::DOUBLE:
+ eToken = XML_DOUBLE;
+ break;
+ case com::sun::star::xsd::DataTypeClass::FLOAT:
+ eToken = XML_FLOAT;
+ break;
+ case com::sun::star::xsd::DataTypeClass::BOOLEAN:
+ eToken = XML_BOOLEAN;
+ break;
+ case com::sun::star::xsd::DataTypeClass::DATETIME:
+ eToken = XML_DATETIME_XSD;
+ break;
+ case com::sun::star::xsd::DataTypeClass::TIME:
+ eToken = XML_TIME;
+ break;
+ case com::sun::star::xsd::DataTypeClass::DATE:
+ eToken = XML_DATE;
+ break;
+ case com::sun::star::xsd::DataTypeClass::gYear:
+ eToken = XML_YEAR;
+ break;
+ case com::sun::star::xsd::DataTypeClass::gDay:
+ eToken = XML_DAY;
+ break;
+ case com::sun::star::xsd::DataTypeClass::gMonth:
+ eToken = XML_MONTH;
+ break;
+ case com::sun::star::xsd::DataTypeClass::DURATION:
+ case com::sun::star::xsd::DataTypeClass::gYearMonth:
+ case com::sun::star::xsd::DataTypeClass::gMonthDay:
+ case com::sun::star::xsd::DataTypeClass::hexBinary:
+ case com::sun::star::xsd::DataTypeClass::base64Binary:
+ case com::sun::star::xsd::DataTypeClass::QName:
+ case com::sun::star::xsd::DataTypeClass::NOTATION:
+ default:
+ OSL_FAIL( "unknown data type" );
+ }
+
+ return rExport.GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_XSD,
+ GetXMLToken( eToken ) );
+}
+
+void lcl_exportDataType( SvXMLExport& rExport,
+ const Reference<XPropertySet>& xType )
+{
+ // we do not need to export basic types; exit if we have one
+ bool bIsBasic = false;
+ xType->getPropertyValue( OUSTRING("IsBasic") ) >>= bIsBasic;
+ if( bIsBasic )
+ return;
+
+ // no basic type -> export
+
+ // <xsd:simpleType name="...">
+ OUString sName;
+ xType->getPropertyValue( OUSTRING("Name") ) >>= sName;
+ rExport.AddAttribute( XML_NAMESPACE_NONE, XML_NAME, sName );
+ SvXMLElementExport aSimpleType( rExport,
+ XML_NAMESPACE_XSD, XML_SIMPLETYPE,
+ sal_True, sal_True );
+
+ // <xsd:restriction base="xsd:...">
+ rExport.AddAttribute( XML_NAMESPACE_NONE, XML_BASE,
+ lcl_getXSDType( rExport, xType ) );
+ SvXMLElementExport aRestriction( rExport,
+ XML_NAMESPACE_XSD,
+ XML_RESTRICTION,
+ sal_True, sal_True );
+
+ // export facets
+ lcl_exportDataTypeFacets( rExport,
+ Reference<XPropertySet>( xType, UNO_QUERY ),
+ aDataTypeFacetTable );
+}
+
+void exportXFormsSchemas( SvXMLExport& rExport,
+ const Reference<com::sun::star::xforms::XModel>& xModel )
+{
+ // TODO: for now, we'll fake this...
+ {
+ SvXMLElementExport aSchemaElem( rExport, XML_NAMESPACE_XSD, XML_SCHEMA,
+ sal_True, sal_True );
+
+ // now get data type repositry, and export
+ Reference<XEnumerationAccess> xTypes( xModel->getDataTypeRepository(),
+ UNO_QUERY );
+ if( xTypes.is() )
+ {
+ Reference<XEnumeration> xEnum = xTypes->createEnumeration();
+ DBG_ASSERT( xEnum.is(), "no enum?" );
+ while( xEnum->hasMoreElements() )
+ {
+ Reference<XPropertySet> xType( xEnum->nextElement(), UNO_QUERY );
+ lcl_exportDataType( rExport, xType );
+ }
+ }
+ }
+
+ // export other, 'foreign' schemas
+ Reference<XPropertySet> xPropSet( xModel, UNO_QUERY );
+ if( xPropSet.is() )
+ {
+ Reference<XDocument> xDocument(
+ xPropSet->getPropertyValue( OUSTRING("ForeignSchema") ),
+ UNO_QUERY );
+
+ if( xDocument.is() )
+ exportDom( rExport, xDocument );
+ }
+}
+
+
+
+//
+// helper functions
+//
+
+void lcl_export( const Reference<XPropertySet>& rPropertySet,
+ SvXMLExport& rExport,
+ const ExportTable* pTable )
+{
+ for( const ExportTable* pCurrent = pTable;
+ pCurrent->pPropertyName != NULL;
+ pCurrent++ )
+ {
+ Any aAny = rPropertySet->getPropertyValue(
+ OUString::createFromAscii( pCurrent->pPropertyName ) );
+ OUString sValue = (*pCurrent->aConverter)( aAny );
+
+ if( sValue.getLength() > 0 )
+ rExport.AddAttribute(
+ pCurrent->nNamespace,
+ static_cast<XMLTokenEnum>( pCurrent->nToken ),
+ sValue );
+ }
+}
+
+
+
+//
+// any conversion functions
+//
+
+template<typename T, void (*FUNC)( OUStringBuffer&, T )>
+OUString lcl_convert( const Any& rAny )
+{
+ OUStringBuffer aBuffer;
+ T aData = T();
+ if( rAny >>= aData )
+ {
+ FUNC( aBuffer, aData );
+ }
+ return aBuffer.makeStringAndClear();
+}
+
+template<typename T, void (*FUNC)( OUStringBuffer&, const T& )>
+OUString lcl_convertRef( const Any& rAny )
+{
+ OUStringBuffer aBuffer;
+ T aData;
+ if( rAny >>= aData )
+ {
+ FUNC( aBuffer, aData );
+ }
+ return aBuffer.makeStringAndClear();
+}
+
+OUString lcl_string( const Any& rAny )
+{
+ OUString aResult;
+ rAny >>= aResult;
+ return aResult;
+}
+
+OUString lcl_bool( const Any& rAny )
+{
+ bool bResult = bool();
+ if( rAny >>= bResult )
+ return GetXMLToken( bResult ? XML_TRUE : XML_FALSE );
+ OSL_FAIL( "expected boolean value" );
+ return OUString();
+}
+
+void lcl_formatDate( OUStringBuffer& aBuffer, const Date& rDate )
+{
+ aBuffer.append( static_cast<sal_Int32>( rDate.Year ) );
+ aBuffer.append( sal_Unicode('-') );
+ aBuffer.append( static_cast<sal_Int32>( rDate.Month ) );
+ aBuffer.append( sal_Unicode('-') );
+ aBuffer.append( static_cast<sal_Int32>( rDate.Day ) );
+}
+
+void lcl_formatTime( OUStringBuffer& aBuffer, const com::sun::star::util::Time& rTime )
+{
+ DateTime aDateTime;
+ aDateTime.Hours = rTime.Hours;
+ aDateTime.Minutes = rTime.Minutes;
+ aDateTime.Seconds = rTime.Seconds;
+ aDateTime.HundredthSeconds = rTime.HundredthSeconds;
+ SvXMLUnitConverter::convertTime( aBuffer, aDateTime );
+}
+
+void lcl_formatDateTime( OUStringBuffer& aBuffer, const DateTime& aDateTime )
+{
+ SvXMLUnitConverter::convertDateTime( aBuffer, aDateTime );
+}
+
+OUString lcl_whitespace( const Any& rAny )
+{
+ OUString sResult;
+ sal_uInt16 n = sal_uInt16();
+ if( rAny >>= n )
+ {
+ switch( n )
+ {
+ case com::sun::star::xsd::WhiteSpaceTreatment::Preserve:
+ sResult = GetXMLToken( XML_PRESERVE );
+ break;
+ case com::sun::star::xsd::WhiteSpaceTreatment::Replace:
+ sResult = GetXMLToken( XML_REPLACE );
+ break;
+ case com::sun::star::xsd::WhiteSpaceTreatment::Collapse:
+ sResult = GetXMLToken( XML_COLLAPSE );
+ break;
+ }
+ }
+ return sResult;
+}
+
+
+/// return name of Binding
+OUString lcl_getXFormsBindName( const Reference<XPropertySet>& xBinding )
+{
+ OUString sProp( OUSTRING( "BindingID" ) );
+
+ OUString sReturn;
+ if( xBinding.is() &&
+ xBinding->getPropertySetInfo()->hasPropertyByName( sProp ) )
+ {
+ xBinding->getPropertyValue( sProp ) >>= sReturn;
+ }
+ return sReturn;
+}
+
+// return name of binding
+OUString getXFormsBindName( const Reference<XPropertySet>& xControl )
+{
+ Reference<XBindableValue> xBindable( xControl, UNO_QUERY );
+ return xBindable.is()
+ ? lcl_getXFormsBindName(
+ Reference<XPropertySet>( xBindable->getValueBinding(), UNO_QUERY ))
+ : OUString();
+}
+
+// return name of list binding
+OUString getXFormsListBindName( const Reference<XPropertySet>& xControl )
+{
+ Reference<XListEntrySink> xListEntrySink( xControl, UNO_QUERY );
+ return xListEntrySink.is()
+ ? lcl_getXFormsBindName(
+ Reference<XPropertySet>( xListEntrySink->getListEntrySource(),
+ UNO_QUERY ) )
+ : OUString();
+}
+
+OUString getXFormsSubmissionName( const Reference<XPropertySet>& xBinding )
+{
+ OUString sReturn;
+
+ Reference<XSubmissionSupplier> xSubmissionSupplier( xBinding, UNO_QUERY );
+ if( xSubmissionSupplier.is() )
+ {
+ Reference<XPropertySet> xPropertySet(
+ xSubmissionSupplier->getSubmission(), UNO_QUERY );
+ OUString sProp( OUSTRING("ID") );
+ if( xPropertySet.is() &&
+ xPropertySet->getPropertySetInfo()->hasPropertyByName( sProp ) )
+ {
+ xPropertySet->getPropertyValue( sProp ) >>= sReturn;
+ }
+ }
+
+ return sReturn;
+}
+
+void getXFormsSettings( const Reference< XNameAccess >& _rXForms, Sequence< PropertyValue >& _out_rSettings )
+{
+ _out_rSettings = Sequence< PropertyValue >();
+
+ OSL_PRECOND( _rXForms.is(), "getXFormsSettings: invalid XForms container!" );
+ if ( !_rXForms.is() )
+ return;
+
+ try
+ {
+ // we want to export some special properties of our XForms models as config-item-map-named,
+ // which implies we need a PropertyValue whose value is an XNameAccess, whose keys
+ // are the names of the XForm models, and which in turn provides named sequences of
+ // PropertyValues - which denote the actual property values of the given named model.
+
+ Sequence< ::rtl::OUString > aModelNames( _rXForms->getElementNames() );
+
+ ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+ Reference< XNameContainer > xModelSettings(
+ aContext.createComponent( "com.sun.star.document.NamedPropertyValues" ),
+ UNO_QUERY_THROW );
+
+ for ( const ::rtl::OUString* pModelName = aModelNames.getConstArray();
+ pModelName != aModelNames.getConstArray() + aModelNames.getLength();
+ ++pModelName
+ )
+ {
+ Reference< XPropertySet > xModelProps( _rXForms->getByName( *pModelName ), UNO_QUERY_THROW );
+
+ Sequence< PropertyValue > aModelSettings( 1 );
+ aModelSettings[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ExternalData" ) );
+ aModelSettings[0].Value = xModelProps->getPropertyValue( aModelSettings[0].Name );
+
+ xModelSettings->insertByName( *pModelName, makeAny( aModelSettings ) );
+ }
+
+ if ( xModelSettings->hasElements() )
+ {
+ _out_rSettings.realloc( 1 );
+ _out_rSettings[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "XFormModels" ) );
+ _out_rSettings[0].Value <<= xModelSettings;
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/xforms/xformsimport.cxx b/xmloff/source/xforms/xformsimport.cxx
new file mode 100644
index 000000000000..c2b06e0dcdc8
--- /dev/null
+++ b/xmloff/source/xforms/xformsimport.cxx
@@ -0,0 +1,209 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "XFormsModelContext.hxx"
+#include <vector>
+#include <utility>
+#include "xmloff/xformsimport.hxx"
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/form/binding/XValueBinding.hpp>
+#include <com/sun/star/form/binding/XBindableValue.hpp>
+#include <com/sun/star/form/binding/XListEntrySource.hpp>
+#include <com/sun/star/form/binding/XListEntrySink.hpp>
+#include <com/sun/star/form/submission/XSubmission.hpp>
+#include <com/sun/star/form/submission/XSubmissionSupplier.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <rtl/ustring.hxx>
+#include <xformsapi.hxx>
+#include <comphelper/namedvaluecollection.hxx>
+#include <tools/diagnose_ex.h>
+
+using std::pair;
+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::uno::Sequence;
+using com::sun::star::beans::XPropertySet;
+using com::sun::star::beans::XPropertySetInfo;
+using com::sun::star::beans::PropertyValue;
+using com::sun::star::frame::XModel;
+using com::sun::star::container::XNameAccess;
+using com::sun::star::form::binding::XValueBinding;
+using com::sun::star::form::binding::XBindableValue;
+using com::sun::star::form::binding::XListEntrySource;
+using com::sun::star::form::binding::XListEntrySink;
+using com::sun::star::form::submission::XSubmission;
+using com::sun::star::form::submission::XSubmissionSupplier;
+using rtl::OUString;
+
+SvXMLImportContext* createXFormsModelContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName )
+{
+ return new XFormsModelContext( rImport, nPrefix, rLocalName );
+}
+
+void bindXFormsValueBinding(
+ Reference<XModel> xModel,
+ pair<Reference<XPropertySet>,OUString> aPair )
+{
+ Reference<XBindableValue> xBindable(
+ aPair.first,
+ UNO_QUERY );
+ Reference<XValueBinding> xBinding(
+ lcl_findXFormsBinding( xModel, aPair.second ),
+ UNO_QUERY );
+
+ if( xBindable.is() && xBinding.is() )
+ {
+ try
+ {
+ xBindable->setValueBinding( xBinding );
+ }
+ catch( const Exception& )
+ {
+ // ignore problems during binding
+ // TODO: call XML error handling
+ }
+ }
+}
+
+void bindXFormsListBinding(
+ Reference<XModel> xModel,
+ ::pair<Reference<XPropertySet>,OUString> aPair )
+{
+ Reference<XListEntrySink> xListEntrySink(
+ aPair.first,
+ UNO_QUERY );
+ Reference<XListEntrySource> xListEntrySource(
+ lcl_findXFormsBinding( xModel, aPair.second ),
+ UNO_QUERY );
+
+ if( xListEntrySink.is() && xListEntrySource.is() )
+ {
+ try
+ {
+ xListEntrySink->setListEntrySource( xListEntrySource );
+ }
+ catch( const Exception& )
+ {
+ // ignore problems during binding
+ // TODO: call XML error handling
+ }
+ }
+}
+
+void bindXFormsSubmission(
+ Reference<XModel> xModel,
+ pair<Reference<XPropertySet>,OUString> aPair )
+{
+ Reference<XSubmissionSupplier> xSubmissionSupp( aPair.first, UNO_QUERY );
+ Reference<XSubmission> xSubmission(
+ lcl_findXFormsSubmission( xModel, aPair.second ),
+ UNO_QUERY );
+
+ if( xSubmissionSupp.is() && xSubmission.is() )
+ {
+ try
+ {
+ xSubmissionSupp->setSubmission( xSubmission );
+ }
+ catch( const Exception& )
+ {
+ // ignore problems during binding
+ // TODO: call XML error handling
+ }
+ }
+}
+
+void applyXFormsSettings( const Reference< XNameAccess >& _rXForms, const Sequence< PropertyValue >& _rSettings )
+{
+ OSL_PRECOND( _rXForms.is(), "applyXFormsSettings: invalid XForms container!" );
+ if ( !_rXForms.is() )
+ return;
+
+ ::comphelper::NamedValueCollection aSettings( _rSettings );
+ Reference< XNameAccess > xModelSettings( aSettings.get( "XFormModels" ), UNO_QUERY );
+ if ( !xModelSettings.is() )
+ {
+ OSL_FAIL( "applyXFormsSettings: wrong type for the XFormModels settings!" );
+ return;
+ }
+
+ try
+ {
+ Sequence< ::rtl::OUString > aSettingsForModels( xModelSettings->getElementNames() );
+ for ( const ::rtl::OUString* pModelName = aSettingsForModels.getConstArray();
+ pModelName != aSettingsForModels.getConstArray() + aSettingsForModels.getLength();
+ ++pModelName
+ )
+ {
+ // the settings for this particular model
+ Sequence< PropertyValue > aModelSettings;
+ OSL_VERIFY( xModelSettings->getByName( *pModelName ) >>= aModelSettings );
+
+ // the model itself
+ if ( !_rXForms->hasByName( *pModelName ) )
+ {
+ OSL_FAIL( "applyXFormsSettings: have settings for a non-existent XForms model!" );
+ continue;
+ }
+
+ // propagate the settings, being tolerant by omitting properties which are not supported
+ Reference< XPropertySet > xModelProps( _rXForms->getByName( *pModelName ), UNO_QUERY_THROW );
+ Reference< XPropertySetInfo > xModelPSI( xModelProps->getPropertySetInfo(), UNO_SET_THROW );
+
+ for ( const PropertyValue* pSetting = aModelSettings.getConstArray();
+ pSetting != aModelSettings.getConstArray() + aModelSettings.getLength();
+ ++pSetting
+ )
+ {
+ if ( !xModelPSI->hasPropertyByName( pSetting->Name ) )
+ {
+ OSL_FAIL( "applyXFormsSettings: non-existent model property!" );
+ continue;
+ }
+
+ xModelProps->setPropertyValue( pSetting->Name, pSetting->Value );
+ }
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/util/xo.component b/xmloff/util/xo.component
new file mode 100755
index 000000000000..7fe2119636d1
--- /dev/null
+++ b/xmloff/util/xo.component
@@ -0,0 +1,178 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* 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.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="SchXMLExport.Compact">
+ <service name="com.sun.star.comp.Chart.XMLExporter"/>
+ </implementation>
+ <implementation name="SchXMLExport.Content">
+ <service name="com.sun.star.comp.Chart.XMLContentExporter"/>
+ </implementation>
+ <implementation name="SchXMLExport.Oasis.Compact">
+ <service name="com.sun.star.comp.Chart.XMLOasisExporter"/>
+ </implementation>
+ <implementation name="SchXMLExport.Oasis.Content">
+ <service name="com.sun.star.comp.Chart.XMLOasisContentExporter"/>
+ </implementation>
+ <implementation name="SchXMLExport.Oasis.Meta">
+ <service name="com.sun.star.comp.Chart.XMLOasisMetaExporter"/>
+ </implementation>
+ <implementation name="SchXMLExport.Oasis.Styles">
+ <service name="com.sun.star.comp.Chart.XMLOasisStylesExporter"/>
+ </implementation>
+ <implementation name="SchXMLExport.Styles">
+ <service name="com.sun.star.comp.Chart.XMLStylesExporter"/>
+ </implementation>
+ <implementation name="SchXMLImport">
+ <service name="com.sun.star.comp.Chart.XMLOasisImporter"/>
+ </implementation>
+ <implementation name="SchXMLImport.Content">
+ <service name="com.sun.star.comp.Chart.XMLOasisContentImporter"/>
+ </implementation>
+ <implementation name="SchXMLImport.Meta">
+ <service name="com.sun.star.comp.Chart.XMLOasisMetaImporter"/>
+ </implementation>
+ <implementation name="SchXMLImport.Styles">
+ <service name="com.sun.star.comp.Chart.XMLOasisStylesImporter"/>
+ </implementation>
+ <implementation name="XMLDrawContentExportOOO">
+ <service name="com.sun.star.comp.Draw.XMLContentExporter"/>
+ </implementation>
+ <implementation name="XMLDrawContentExportOasis">
+ <service name="com.sun.star.comp.Draw.XMLOasisContentExporter"/>
+ </implementation>
+ <implementation name="XMLDrawExportOOO">
+ <service name="com.sun.star.comp.Draw.XMLExporter"/>
+ </implementation>
+ <implementation name="XMLDrawExportOasis">
+ <service name="com.sun.star.comp.Draw.XMLOasisExporter"/>
+ </implementation>
+ <implementation name="XMLDrawImportOasis">
+ <service name="com.sun.star.comp.Draw.XMLOasisImporter"/>
+ </implementation>
+ <implementation name="XMLDrawMetaExportOOO">
+ <service name="com.sun.star.comp.Draw.XMLMetaExporter"/>
+ </implementation>
+ <implementation name="XMLDrawMetaExportOasis">
+ <service name="com.sun.star.comp.Draw.XMLOasisMetaExporter"/>
+ </implementation>
+ <implementation name="XMLDrawSettingsExportOOO">
+ <service name="com.sun.star.comp.Draw.XMLSettingsExporter"/>
+ </implementation>
+ <implementation name="XMLDrawSettingsExportOasis">
+ <service name="com.sun.star.comp.Draw.XMLOasisSettingsExporter"/>
+ </implementation>
+ <implementation name="XMLDrawStylesExportOOO">
+ <service name="com.sun.star.comp.Draw.XMLStylesExporter"/>
+ </implementation>
+ <implementation name="XMLDrawStylesExportOasis">
+ <service name="com.sun.star.comp.Draw.XMLOasisStylesExporter"/>
+ </implementation>
+ <implementation name="XMLDrawingLayerExport">
+ <service name="com.sun.star.comp.DrawingLayer.XMLExporter"/>
+ </implementation>
+ <implementation name="XMLImpressClipboardExport">
+ <service name="com.sun.star.comp.Impress.XMLClipboardExporter"/>
+ </implementation>
+ <implementation name="XMLImpressContentExportOOO">
+ <service name="com.sun.star.comp.Impress.XMLContentExporter"/>
+ </implementation>
+ <implementation name="XMLImpressContentExportOasis">
+ <service name="com.sun.star.comp.Impress.XMLOasisContentExporter"/>
+ </implementation>
+ <implementation name="XMLImpressContentImportOasis">
+ <service name="com.sun.star.comp.Draw.XMLOasisContentImporter"/>
+ <service name="com.sun.star.comp.Impress.XMLOasisContentImporter"/>
+ </implementation>
+ <implementation name="XMLImpressExportOOO">
+ <service name="com.sun.star.comp.Impress.XMLExporter"/>
+ </implementation>
+ <implementation name="XMLImpressExportOasis">
+ <service name="com.sun.star.comp.Impress.XMLOasisExporter"/>
+ </implementation>
+ <implementation name="XMLImpressImportOasis">
+ <service name="com.sun.star.comp.Impress.XMLOasisImporter"/>
+ </implementation>
+ <implementation name="XMLImpressMetaExportOOO">
+ <service name="com.sun.star.comp.Impress.XMLMetaExporter"/>
+ </implementation>
+ <implementation name="XMLImpressMetaExportOasis">
+ <service name="com.sun.star.comp.Impress.XMLOasisMetaExporter"/>
+ </implementation>
+ <implementation name="XMLImpressMetaImportOasis">
+ <service name="com.sun.star.comp.Draw.XMLOasisMetaImporter"/>
+ <service name="com.sun.star.comp.Impress.XMLOasisMetaImporter"/>
+ </implementation>
+ <implementation name="XMLImpressSettingsExportOOO">
+ <service name="com.sun.star.comp.Impress.XMLSettingsExporter"/>
+ </implementation>
+ <implementation name="XMLImpressSettingsExportOasis">
+ <service name="com.sun.star.comp.Impress.XMLOasisSettingsExporter"/>
+ </implementation>
+ <implementation name="XMLImpressSettingsImportOasis">
+ <service name="com.sun.star.comp.Draw.XMLOasisSettingsImporter"/>
+ <service name="com.sun.star.comp.Impress.XMLOasisSettingsImporter"/>
+ </implementation>
+ <implementation name="XMLImpressStylesExportOOO">
+ <service name="com.sun.star.comp.Impress.XMLStylesExporter"/>
+ </implementation>
+ <implementation name="XMLImpressStylesExportOasis">
+ <service name="com.sun.star.comp.Impress.XMLOasisStylesExporter"/>
+ </implementation>
+ <implementation name="XMLImpressStylesImportOasis">
+ <service name="com.sun.star.comp.Draw.XMLOasisStylesImporter"/>
+ <service name="com.sun.star.comp.Impress.XMLOasisStylesImporter"/>
+ </implementation>
+ <implementation name="XMLMetaExportComponent">
+ <service name="com.sun.star.document.XMLOasisMetaExporter"/>
+ </implementation>
+ <implementation name="XMLMetaExportOOo">
+ <service name="com.sun.star.document.XMLMetaExporter"/>
+ </implementation>
+ <implementation name="XMLMetaImportComponent">
+ <service name="com.sun.star.document.XMLOasisMetaImporter"/>
+ </implementation>
+ <implementation name="XMLVersionListPersistence">
+ <service name="com.sun.star.document.DocumentRevisionListPersistence"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Writer.XMLAutotextEventsExporter">
+ <service name="com.sun.star.comp.Writer.XMLAutotextEventsExporter"/>
+ </implementation>
+ <implementation
+ name="com.sun.star.comp.Writer.XMLOasisAutotextEventsExporter">
+ <service name="com.sun.star.comp.Writer.XMLOasisAutotextEventsExporter"/>
+ </implementation>
+ <implementation
+ name="com.sun.star.comp.Writer.XMLOasisAutotextEventsImporter">
+ <service name="com.sun.star.comp.Writer.XMLOasisAutotextEventsImporter"/>
+ </implementation>
+ <implementation name="xmloff::AnimationsImport">
+ <service name="com.sun.star.comp.Xmloff.AnimationsImport"/>
+ </implementation>
+</component>
diff --git a/xmloff/xml/components.xml b/xmloff/xml/components.xml
new file mode 100755
index 000000000000..860f8e23f0d6
--- /dev/null
+++ b/xmloff/xml/components.xml
@@ -0,0 +1,473 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd">
+<module-description xmlns:xlink="http://www.w3.org/1999/xlink">
+ <module-name>xmloff</module-name>
+ <component-description>
+ <author>xmloff development team</author>
+ <name>com.sun.star.comp.Impress.XMLExporter</name>
+ <description>
+ This component exports a presentation document into a single XML document stream.
+ </description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta"/>
+ <supported-service>com.sun.star.xml.XMLExportFilter</supported-service>
+ <reference-docu xlink:href="http://xml.openoffice.org/"
+ xlink:title="general OpenOffice.org xml information" />
+ <reference-docu xlink:title="XML File Format Specification (draft)"
+ xlink:href="http://xml.openoffice.org/xml_specification_draft.pdf" />
+ <reference-docu xlink:href="http://xml.openoffice.org/filter/"
+ xlink:title="Guide to implement XML-based filters in OpenOffice.org" />
+ </component-description>
+
+ <component-description>
+ <author>xmloff development team</author>
+ <name>com.sun.star.comp.Draw.XMLExporter</name>
+ <description>
+ This component exports a drawing document into a single XML document stream.
+ </description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta"/>
+ <supported-service>com.sun.star.xml.XMLExportFilter</supported-service>
+ <reference-docu xlink:href="http://xml.openoffice.org/"
+ xlink:title="general OpenOffice.org xml information" />
+ <reference-docu xlink:title="XML File Format Specification (draft)"
+ xlink:href="http://xml.openoffice.org/xml_specification_draft.pdf" />
+ <reference-docu xlink:href="http://xml.openoffice.org/filter/"
+ xlink:title="Guide to implement XML-based filters in OpenOffice.org" />
+ </component-description>
+
+ <component-description>
+ <author>xmloff development team</author>
+ <name>com.sun.star.comp.Chart.XMLExporter</name>
+ <description>
+ This component exports a chart object into a single XML document stream.
+ </description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta"/>
+ <supported-service>com.sun.star.xml.XMLExportFilter</supported-service>
+ <reference-docu xlink:href="http://xml.openoffice.org/"
+ xlink:title="general OpenOffice.org xml information" />
+ <reference-docu xlink:title="XML File Format Specification (draft)"
+ xlink:href="http://xml.openoffice.org/xml_specification_draft.pdf" />
+ <reference-docu xlink:href="http://xml.openoffice.org/filter/"
+ xlink:title="Guide to implement XML-based filters in OpenOffice.org" />
+ </component-description>
+
+ <component-description>
+ <author>xmloff development team</author>
+ <name>com.sun.star.comp.Impress.XMLStylesExporter</name>
+ <description>
+ This component exports the styles of a presentation document into a single XML document stream.
+ </description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta"/>
+ <supported-service>com.sun.star.xml.XMLExportFilter</supported-service>
+ <reference-docu xlink:href="http://xml.openoffice.org/"
+ xlink:title="general OpenOffice.org xml information" />
+ <reference-docu xlink:title="XML File Format Specification (draft)"
+ xlink:href="http://xml.openoffice.org/xml_specification_draft.pdf" />
+ <reference-docu xlink:href="http://xml.openoffice.org/filter/"
+ xlink:title="Guide to implement XML-based filters in OpenOffice.org" />
+ </component-description>
+
+ <component-description>
+ <author>xmloff development team</author>
+ <name>com.sun.star.comp.Draw.XMLStylesExporter</name>
+ <description>
+ This component exports the styles of a drawing document into a single XML document stream.
+ </description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta"/>
+ <supported-service>com.sun.star.xml.XMLExportFilter</supported-service>
+ <reference-docu xlink:href="http://xml.openoffice.org/"
+ xlink:title="general OpenOffice.org xml information" />
+ <reference-docu xlink:title="XML File Format Specification (draft)"
+ xlink:href="http://xml.openoffice.org/xml_specification_draft.pdf" />
+ <reference-docu xlink:href="http://xml.openoffice.org/filter/"
+ xlink:title="Guide to implement XML-based filters in OpenOffice.org" />
+ </component-description>
+
+ <component-description>
+ <author>xmloff development team</author>
+ <name>com.sun.star.comp.Chart.XMLStylesExporter</name>
+ <description>
+ This component exports the styles of a chart object into a single XML document stream.
+ </description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta"/>
+ <supported-service>com.sun.star.xml.XMLExportFilter</supported-service>
+ <reference-docu xlink:href="http://xml.openoffice.org/"
+ xlink:title="general OpenOffice.org xml information" />
+ <reference-docu xlink:title="XML File Format Specification (draft)"
+ xlink:href="http://xml.openoffice.org/xml_specification_draft.pdf" />
+ <reference-docu xlink:href="http://xml.openoffice.org/filter/"
+ xlink:title="Guide to implement XML-based filters in OpenOffice.org" />
+ </component-description>
+
+ <component-description>
+ <author>xmloff development team</author>
+ <name>com.sun.star.comp.Impress.XMLMetaExporter</name>
+ <description>
+ This component exports the meta information of a presentation document into a single XML document stream.
+ </description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta"/>
+ <supported-service>com.sun.star.xml.XMLExportFilter</supported-service>
+ <reference-docu xlink:href="http://xml.openoffice.org/"
+ xlink:title="general OpenOffice.org xml information" />
+ <reference-docu xlink:title="XML File Format Specification (draft)"
+ xlink:href="http://xml.openoffice.org/xml_specification_draft.pdf" />
+ <reference-docu xlink:href="http://xml.openoffice.org/filter/"
+ xlink:title="Guide to implement XML-based filters in OpenOffice.org" />
+ </component-description>
+
+ <component-description>
+ <author>xmloff development team</author>
+ <name>com.sun.star.comp.Draw.XMLMetaExporter</name>
+ <description>
+ This component exports the meta information of a drawing document into a single XML document stream.
+ </description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta"/>
+ <supported-service>com.sun.star.xml.XMLExportFilter</supported-service>
+ <reference-docu xlink:href="http://xml.openoffice.org/"
+ xlink:title="general OpenOffice.org xml information" />
+ <reference-docu xlink:title="XML File Format Specification (draft)"
+ xlink:href="http://xml.openoffice.org/xml_specification_draft.pdf" />
+ <reference-docu xlink:href="http://xml.openoffice.org/filter/"
+ xlink:title="Guide to implement XML-based filters in OpenOffice.org" />
+ </component-description>
+
+ <component-description>
+ <author>xmloff development team</author>
+ <name>com.sun.star.comp.Impress.XMLSettingsExporter</name>
+ <description>
+ This component exports the settings information of a presentation document into a single XML document stream.
+ </description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta"/>
+ <supported-service>com.sun.star.xml.XMLExportFilter</supported-service>
+ <reference-docu xlink:href="http://xml.openoffice.org/"
+ xlink:title="general OpenOffice.org xml information" />
+ <reference-docu xlink:title="XML File Format Specification (draft)"
+ xlink:href="http://xml.openoffice.org/xml_specification_draft.pdf" />
+ <reference-docu xlink:href="http://xml.openoffice.org/filter/"
+ xlink:title="Guide to implement XML-based filters in OpenOffice.org" />
+ </component-description>
+
+ <component-description>
+ <author>xmloff development team</author>
+ <name>com.sun.star.comp.Draw.XMLSettingsExporter</name>
+ <description>
+ This component exports the settings information of a drawing document into a single XML document stream.
+ </description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta"/>
+ <supported-service>com.sun.star.xml.XMLExportFilter</supported-service>
+ <reference-docu xlink:href="http://xml.openoffice.org/"
+ xlink:title="general OpenOffice.org xml information" />
+ <reference-docu xlink:title="XML File Format Specification (draft)"
+ xlink:href="http://xml.openoffice.org/xml_specification_draft.pdf" />
+ <reference-docu xlink:href="http://xml.openoffice.org/filter/"
+ xlink:title="Guide to implement XML-based filters in OpenOffice.org" />
+ </component-description>
+
+ <component-description>
+ <author>xmloff development team</author>
+ <name>com.sun.star.comp.Impress.XMLContentExporter</name>
+ <description>
+ This component exports the content of a presentation document into a single XML document stream.
+ </description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta"/>
+ <supported-service>com.sun.star.xml.XMLExportFilter</supported-service>
+ <reference-docu xlink:href="http://xml.openoffice.org/"
+ xlink:title="general OpenOffice.org xml information" />
+ <reference-docu xlink:title="XML File Format Specification (draft)"
+ xlink:href="http://xml.openoffice.org/xml_specification_draft.pdf" />
+ <reference-docu xlink:href="http://xml.openoffice.org/filter/"
+ xlink:title="Guide to implement XML-based filters in OpenOffice.org" />
+ </component-description>
+
+ <component-description>
+ <author>xmloff development team</author>
+ <name>com.sun.star.comp.Draw.XMLContentExporter</name>
+ <description>
+ This component exports the content of a drawing document into a single XML document stream.
+ </description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta"/>
+ <supported-service>com.sun.star.xml.XMLExportFilter</supported-service>
+ <reference-docu xlink:href="http://xml.openoffice.org/"
+ xlink:title="general OpenOffice.org xml information" />
+ <reference-docu xlink:title="XML File Format Specification (draft)"
+ xlink:href="http://xml.openoffice.org/xml_specification_draft.pdf" />
+ <reference-docu xlink:href="http://xml.openoffice.org/filter/"
+ xlink:title="Guide to implement XML-based filters in OpenOffice.org" />
+ </component-description>
+
+ <component-description>
+ <author>xmloff development team</author>
+ <name>com.sun.star.comp.Chart.XMLContentExporter</name>
+ <description>
+ This component exports the content of a chart object into a single XML document stream.
+ </description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta"/>
+ <supported-service>com.sun.star.xml.XMLExportFilter</supported-service>
+ <reference-docu xlink:href="http://xml.openoffice.org/"
+ xlink:title="general OpenOffice.org xml information" />
+ <reference-docu xlink:title="XML File Format Specification (draft)"
+ xlink:href="http://xml.openoffice.org/xml_specification_draft.pdf" />
+ <reference-docu xlink:href="http://xml.openoffice.org/filter/"
+ xlink:title="Guide to implement XML-based filters in OpenOffice.org" />
+ </component-description>
+
+ <component-description>
+ <author>xmloff development team</author>
+ <name>com.sun.star.comp.Impress.XMLImporter</name>
+ <description>
+ This component imports a presentation document from a single XML document stream.
+ </description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta"/>
+ <supported-service>com.sun.star.xml.XMLImportFilter</supported-service>
+ <reference-docu xlink:href="http://xml.openoffice.org/"
+ xlink:title="general OpenOffice.org xml information" />
+ <reference-docu xlink:title="XML File Format Specification (draft)"
+ xlink:href="http://xml.openoffice.org/xml_specification_draft.pdf" />
+ <reference-docu xlink:href="http://xml.openoffice.org/filter/"
+ xlink:title="Guide to implement XML-based filters in OpenOffice.org" />
+ </component-description>
+
+ <component-description>
+ <author>xmloff development team</author>
+ <name>com.sun.star.comp.Draw.XMLImporter</name>
+ <description>
+ This component imports a drawing document from a single XML document stream.
+ </description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta"/>
+ <supported-service>com.sun.star.xml.XMLImportFilter</supported-service>
+ <reference-docu xlink:href="http://xml.openoffice.org/"
+ xlink:title="general OpenOffice.org xml information" />
+ <reference-docu xlink:title="XML File Format Specification (draft)"
+ xlink:href="http://xml.openoffice.org/xml_specification_draft.pdf" />
+ <reference-docu xlink:href="http://xml.openoffice.org/filter/"
+ xlink:title="Guide to implement XML-based filters in OpenOffice.org" />
+ </component-description>
+
+ <component-description>
+ <author>xmloff development team</author>
+ <name>com.sun.star.comp.Chart.XMLImporter</name>
+ <description>
+ This component imports a chart object from a single XML document stream.
+ </description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta"/>
+ <supported-service>com.sun.star.xml.XMLImportFilter</supported-service>
+ <reference-docu xlink:href="http://xml.openoffice.org/"
+ xlink:title="general OpenOffice.org xml information" />
+ <reference-docu xlink:title="XML File Format Specification (draft)"
+ xlink:href="http://xml.openoffice.org/xml_specification_draft.pdf" />
+ <reference-docu xlink:href="http://xml.openoffice.org/filter/"
+ xlink:title="Guide to implement XML-based filters in OpenOffice.org" />
+ </component-description>
+
+ <component-description>
+ <author>xmloff development team</author>
+ <name>com.sun.star.comp.Impress.XMLStylesImporter</name>
+ <description>
+ This component imports the styles of a presentation document from a single XML document stream.
+ </description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta"/>
+ <supported-service>com.sun.star.xml.XMLImportFilter</supported-service>
+ <reference-docu xlink:href="http://xml.openoffice.org/"
+ xlink:title="general OpenOffice.org xml information" />
+ <reference-docu xlink:title="XML File Format Specification (draft)"
+ xlink:href="http://xml.openoffice.org/xml_specification_draft.pdf" />
+ <reference-docu xlink:href="http://xml.openoffice.org/filter/"
+ xlink:title="Guide to implement XML-based filters in OpenOffice.org" />
+ </component-description>
+
+ <component-description>
+ <author>xmloff development team</author>
+ <name>com.sun.star.comp.Draw.XMLStylesImporter</name>
+ <description>
+ This component imports the styles of a drawing document from a single XML document stream.
+ </description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta"/>
+ <supported-service>com.sun.star.xml.XMLImportFilter</supported-service>
+ <reference-docu xlink:href="http://xml.openoffice.org/"
+ xlink:title="general OpenOffice.org xml information" />
+ <reference-docu xlink:title="XML File Format Specification (draft)"
+ xlink:href="http://xml.openoffice.org/xml_specification_draft.pdf" />
+ <reference-docu xlink:href="http://xml.openoffice.org/filter/"
+ xlink:title="Guide to implement XML-based filters in OpenOffice.org" />
+ </component-description>
+
+ <component-description>
+ <author>xmloff development team</author>
+ <name>com.sun.star.comp.Chart.XMLStylesImporter</name>
+ <description>
+ This component imports the styles of a chart object from a single XML document stream.
+ </description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta"/>
+ <supported-service>com.sun.star.xml.XMLImportFilter</supported-service>
+ <reference-docu xlink:href="http://xml.openoffice.org/"
+ xlink:title="general OpenOffice.org xml information" />
+ <reference-docu xlink:title="XML File Format Specification (draft)"
+ xlink:href="http://xml.openoffice.org/xml_specification_draft.pdf" />
+ <reference-docu xlink:href="http://xml.openoffice.org/filter/"
+ xlink:title="Guide to implement XML-based filters in OpenOffice.org" />
+ </component-description>
+
+ <component-description>
+ <author>xmloff development team</author>
+ <name>com.sun.star.comp.Impress.XMLMetaImporter</name>
+ <description>
+ This component imports the meta information of a presentation document from a single XML document stream.
+ </description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta"/>
+ <supported-service>com.sun.star.xml.XMLImportFilter</supported-service>
+ <reference-docu xlink:href="http://xml.openoffice.org/"
+ xlink:title="general OpenOffice.org xml information" />
+ <reference-docu xlink:title="XML File Format Specification (draft)"
+ xlink:href="http://xml.openoffice.org/xml_specification_draft.pdf" />
+ <reference-docu xlink:href="http://xml.openoffice.org/filter/"
+ xlink:title="Guide to implement XML-based filters in OpenOffice.org" />
+ </component-description>
+
+ <component-description>
+ <author>xmloff development team</author>
+ <name>com.sun.star.comp.Draw.XMLMetaImporter</name>
+ <description>
+ This component imports the meta information of a drawing document from a single XML document stream.
+ </description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta"/>
+ <supported-service>com.sun.star.xml.XMLImportFilter</supported-service>
+ <reference-docu xlink:href="http://xml.openoffice.org/"
+ xlink:title="general OpenOffice.org xml information" />
+ <reference-docu xlink:title="XML File Format Specification (draft)"
+ xlink:href="http://xml.openoffice.org/xml_specification_draft.pdf" />
+ <reference-docu xlink:href="http://xml.openoffice.org/filter/"
+ xlink:title="Guide to implement XML-based filters in OpenOffice.org" />
+ </component-description>
+
+ <component-description>
+ <author>xmloff development team</author>
+ <name>com.sun.star.comp.Impress.XMLSettingsImporter</name>
+ <description>
+ This component imports the settings information of a presentation document from a single XML document stream.
+ </description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta"/>
+ <supported-service>com.sun.star.xml.XMLImportFilter</supported-service>
+ <reference-docu xlink:href="http://xml.openoffice.org/"
+ xlink:title="general OpenOffice.org xml information" />
+ <reference-docu xlink:title="XML File Format Specification (draft)"
+ xlink:href="http://xml.openoffice.org/xml_specification_draft.pdf" />
+ <reference-docu xlink:href="http://xml.openoffice.org/filter/"
+ xlink:title="Guide to implement XML-based filters in OpenOffice.org" />
+ </component-description>
+
+ <component-description>
+ <author>xmloff development team</author>
+ <name>com.sun.star.comp.Draw.XMLSettingsImporter</name>
+ <description>
+ This component imports the settings information of a drawing document from a single XML document stream.
+ </description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta"/>
+ <supported-service>com.sun.star.xml.XMLImportFilter</supported-service>
+ <reference-docu xlink:href="http://xml.openoffice.org/"
+ xlink:title="general OpenOffice.org xml information" />
+ <reference-docu xlink:title="XML File Format Specification (draft)"
+ xlink:href="http://xml.openoffice.org/xml_specification_draft.pdf" />
+ <reference-docu xlink:href="http://xml.openoffice.org/filter/"
+ xlink:title="Guide to implement XML-based filters in OpenOffice.org" />
+ </component-description>
+
+ <component-description>
+ <author>xmloff development team</author>
+ <name>com.sun.star.comp.Impress.XMLContentImporter</name>
+ <description>
+ This component imports the content of a presentation document from a single XML document stream.
+ </description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta"/>
+ <supported-service>com.sun.star.xml.XMLImportFilter</supported-service>
+ <reference-docu xlink:href="http://xml.openoffice.org/"
+ xlink:title="general OpenOffice.org xml information" />
+ <reference-docu xlink:title="XML File Format Specification (draft)"
+ xlink:href="http://xml.openoffice.org/xml_specification_draft.pdf" />
+ <reference-docu xlink:href="http://xml.openoffice.org/filter/"
+ xlink:title="Guide to implement XML-based filters in OpenOffice.org" />
+ </component-description>
+
+ <component-description>
+ <author>xmloff development team</author>
+ <name>com.sun.star.comp.Draw.XMLContentImporter</name>
+ <description>
+ This component imports the content of a drawing document from a single XML document stream.
+ </description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta"/>
+ <supported-service>com.sun.star.xml.XMLImportFilter</supported-service>
+ <reference-docu xlink:href="http://xml.openoffice.org/"
+ xlink:title="general OpenOffice.org xml information" />
+ <reference-docu xlink:title="XML File Format Specification (draft)"
+ xlink:href="http://xml.openoffice.org/xml_specification_draft.pdf" />
+ <reference-docu xlink:href="http://xml.openoffice.org/filter/"
+ xlink:title="Guide to implement XML-based filters in OpenOffice.org" />
+ </component-description>
+
+ <component-description>
+ <author>xmloff development team</author>
+ <name>com.sun.star.comp.Chart.XMLContentImporter</name>
+ <description>
+ This component imports the content of a chart object from a single XML document stream.
+ </description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta"/>
+ <supported-service>com.sun.star.xml.XMLImportFilter</supported-service>
+ <reference-docu xlink:href="http://xml.openoffice.org/"
+ xlink:title="general OpenOffice.org xml information" />
+ <reference-docu xlink:title="XML File Format Specification (draft)"
+ xlink:href="http://xml.openoffice.org/xml_specification_draft.pdf" />
+ <reference-docu xlink:href="http://xml.openoffice.org/filter/"
+ xlink:title="Guide to implement XML-based filters in OpenOffice.org" />
+ </component-description>
+
+</module-description>