diff options
author | Regina Henschel <rb.henschel@t-online.de> | 2024-11-07 19:24:03 +0100 |
---|---|---|
committer | Regina Henschel <rb.henschel@t-online.de> | 2024-11-10 18:50:37 +0100 |
commit | 1b7bdc29559caba53fb3de9820110c633bf00a27 (patch) | |
tree | f0d6c8adb131626e71101a7a8a2f8b1f921d19e2 /xmloff | |
parent | 873b8146604589f31c7fc111462fc0348d431e94 (diff) |
tdf#162686 tdf#162687 ODF 1.4 extrusion-metal-type
and extrusion-specularity.
In ODF strict always value 'draw:MetalODF' was written. Changed the
logic to write 'loext:MetalMSCompatible' too, depending on eMetalType.
Using a QName as value requires a namespace declaration for the prefix
'loext'. That is now written directly at the element, not as global
declaration, to restrict its scope to the element. A global declaration
would hide when attributes or elements are accidentially written in
'loext' namespace.
The pattern for nonNegativePercent had missed the percent sign.
The export is adapted to write the percent sign.
Validation is skipped for save to ODF 1.3, because currently the
implicit validation uses always latest ODF version, see tdf#163806.
Tests are extended to cover ODF 1.4 and value draw:MetalODF.
Change-Id: I836d11b9cd327b9772e800d9797e04e1613ab2f9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176246
Tested-by: Jenkins
Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/qa/unit/data/tdf162686_3D_metal_type_ODF.fods | 337 | ||||
-rw-r--r-- | xmloff/qa/unit/draw.cxx | 118 | ||||
-rw-r--r-- | xmloff/source/draw/shapeexport.cxx | 37 |
3 files changed, 465 insertions, 27 deletions
diff --git a/xmloff/qa/unit/data/tdf162686_3D_metal_type_ODF.fods b/xmloff/qa/unit/data/tdf162686_3D_metal_type_ODF.fods new file mode 100644 index 000000000000..3ed0abf15667 --- /dev/null +++ b/xmloff/qa/unit/data/tdf162686_3D_metal_type_ODF.fods @@ -0,0 +1,337 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" office:version="1.4" office:mimetype="application/vnd.oasis.opendocument.spreadsheet"> + <office:meta> + <meta:generator>LibreOfficeDev/25.2.0.0.alpha0$Windows_X86_64 LibreOffice_project/957fea5f3d554c870903687d56e49d4777b69ef8 + </meta:generator> + <meta:document-statistic meta:table-count="1" meta:object-count="1" meta:cell-count="1"/> + </office:meta> + <office:settings> + <config:config-item-set config:name="ooo:view-settings"> + <config:config-item config:name="VisibleAreaTop" config:type="int">0</config:config-item> + <config:config-item config:name="VisibleAreaLeft" config:type="int">0</config:config-item> + <config:config-item config:name="VisibleAreaWidth" config:type="int">9031</config:config-item> + <config:config-item config:name="VisibleAreaHeight" config:type="int">4064</config:config-item> + <config:config-item-map-indexed config:name="Views"> + <config:config-item-map-entry> + <config:config-item config:name="ViewId" config:type="string">view1</config:config-item> + <config:config-item-map-named config:name="Tables"> + <config:config-item-map-entry config:name="Sheet1"> + <config:config-item config:name="CursorPositionX" config:type="int">5</config:config-item> + <config:config-item config:name="CursorPositionY" config:type="int">6</config:config-item> + <config:config-item config:name="ActiveSplitRange" config:type="short">2</config:config-item> + <config:config-item config:name="PositionLeft" config:type="int">0</config:config-item> + <config:config-item config:name="PositionRight" config:type="int">0</config:config-item> + <config:config-item config:name="PositionTop" config:type="int">0</config:config-item> + <config:config-item config:name="PositionBottom" config:type="int">0</config:config-item> + <config:config-item config:name="ZoomType" config:type="short">0</config:config-item> + <config:config-item config:name="ZoomValue" config:type="int">100</config:config-item> + <config:config-item config:name="PageViewZoomValue" config:type="int">60</config:config-item> + <config:config-item config:name="ShowGrid" config:type="boolean">true</config:config-item> + <config:config-item config:name="AnchoredTextOverflowLegacy" config:type="boolean">false</config:config-item> + <config:config-item config:name="LegacySingleLineFontwork" config:type="boolean">false</config:config-item> + <config:config-item config:name="ConnectorUseSnapRect" config:type="boolean">false</config:config-item> + <config:config-item config:name="IgnoreBreakAfterMultilineField" config:type="boolean">false</config:config-item> + </config:config-item-map-entry> + </config:config-item-map-named> + <config:config-item config:name="ActiveTable" config:type="string">Sheet1</config:config-item> + <config:config-item config:name="HorizontalScrollbarWidth" config:type="int">991</config:config-item> + <config:config-item config:name="ZoomType" config:type="short">0</config:config-item> + <config:config-item config:name="ZoomValue" config:type="int">100</config:config-item> + <config:config-item config:name="PageViewZoomValue" config:type="int">60</config:config-item> + <config:config-item config:name="ShowPageBreakPreview" config:type="boolean">false</config:config-item> + <config:config-item config:name="ShowZeroValues" config:type="boolean">true</config:config-item> + <config:config-item config:name="ShowNotes" config:type="boolean">true</config:config-item> + <config:config-item config:name="ShowNoteAuthor" config:type="boolean">true</config:config-item> + <config:config-item config:name="ShowFormulasMarks" config:type="boolean">false</config:config-item> + <config:config-item config:name="ShowGrid" config:type="boolean">true</config:config-item> + <config:config-item config:name="GridColor" config:type="int">12632256</config:config-item> + <config:config-item config:name="FormulaBarHeight" config:type="short">1</config:config-item> + <config:config-item config:name="HasColumnRowHeaders" config:type="boolean">true</config:config-item> + <config:config-item config:name="HasSheetTabs" config:type="boolean">true</config:config-item> + <config:config-item config:name="IsOutlineSymbolsSet" config:type="boolean">true</config:config-item> + <config:config-item config:name="IsValueHighlightingEnabled" config:type="boolean">false</config:config-item> + <config:config-item config:name="IsSnapToRaster" config:type="boolean">false</config:config-item> + <config:config-item config:name="RasterIsVisible" config:type="boolean">false</config:config-item> + <config:config-item config:name="RasterResolutionX" config:type="int">1000</config:config-item> + <config:config-item config:name="RasterResolutionY" config:type="int">1000</config:config-item> + <config:config-item config:name="RasterSubdivisionX" config:type="int">1</config:config-item> + <config:config-item config:name="RasterSubdivisionY" config:type="int">1</config:config-item> + <config:config-item config:name="IsRasterAxisSynchronized" config:type="boolean">true</config:config-item> + <config:config-item config:name="AnchoredTextOverflowLegacy" config:type="boolean">false</config:config-item> + <config:config-item config:name="LegacySingleLineFontwork" config:type="boolean">false</config:config-item> + <config:config-item config:name="ConnectorUseSnapRect" config:type="boolean">false</config:config-item> + <config:config-item config:name="IgnoreBreakAfterMultilineField" config:type="boolean">false</config:config-item> + </config:config-item-map-entry> + </config:config-item-map-indexed> + </config:config-item-set> + <config:config-item-set config:name="ooo:configuration-settings"> + <config:config-item config:name="ShowZeroValues" config:type="boolean">true</config:config-item> + <config:config-item config:name="ShowNotes" config:type="boolean">true</config:config-item> + <config:config-item config:name="EmbedComplexScriptFonts" config:type="boolean">true</config:config-item> + <config:config-item config:name="ShowNoteAuthor" config:type="boolean">true</config:config-item> + <config:config-item config:name="ShowFormulasMarks" config:type="boolean">false</config:config-item> + <config:config-item config:name="ShowGrid" config:type="boolean">true</config:config-item> + <config:config-item config:name="GridColor" config:type="int">12632256</config:config-item> + <config:config-item config:name="ShowPageBreaks" config:type="boolean">true</config:config-item> + <config:config-item config:name="IsKernAsianPunctuation" config:type="boolean">false</config:config-item> + <config:config-item config:name="LinkUpdateMode" config:type="short">3</config:config-item> + <config:config-item config:name="HasColumnRowHeaders" config:type="boolean">true</config:config-item> + <config:config-item config:name="EmbedLatinScriptFonts" config:type="boolean">true</config:config-item> + <config:config-item config:name="HasSheetTabs" config:type="boolean">true</config:config-item> + <config:config-item config:name="IsOutlineSymbolsSet" config:type="boolean">true</config:config-item> + <config:config-item config:name="IsSnapToRaster" config:type="boolean">false</config:config-item> + <config:config-item config:name="RasterIsVisible" config:type="boolean">false</config:config-item> + <config:config-item config:name="RasterResolutionX" config:type="int">1000</config:config-item> + <config:config-item config:name="RasterResolutionY" config:type="int">1000</config:config-item> + <config:config-item config:name="RasterSubdivisionX" config:type="int">1</config:config-item> + <config:config-item config:name="RasterSubdivisionY" config:type="int">1</config:config-item> + <config:config-item config:name="IsRasterAxisSynchronized" config:type="boolean">true</config:config-item> + <config:config-item config:name="AutoCalculate" config:type="boolean">true</config:config-item> + <config:config-item config:name="ApplyUserData" config:type="boolean">true</config:config-item> + <config:config-item config:name="ImagePreferredDPI" config:type="int">0</config:config-item> + <config:config-item config:name="PrinterPaperFromSetup" config:type="boolean">false</config:config-item> + <config:config-item config:name="SaveThumbnail" config:type="boolean">true</config:config-item> + <config:config-item config:name="CharacterCompressionType" config:type="short">0</config:config-item> + <config:config-item config:name="SaveVersionOnClose" config:type="boolean">false</config:config-item> + <config:config-item config:name="UpdateFromTemplate" config:type="boolean">true</config:config-item> + <config:config-item config:name="AllowPrintJobCancel" config:type="boolean">true</config:config-item> + <config:config-item config:name="LoadReadonly" config:type="boolean">false</config:config-item> + <config:config-item config:name="IsDocumentShared" config:type="boolean">false</config:config-item> + <config:config-item config:name="EmbedFonts" config:type="boolean">false</config:config-item> + <config:config-item config:name="EmbedOnlyUsedFonts" config:type="boolean">false</config:config-item> + <config:config-item config:name="EmbedAsianScriptFonts" config:type="boolean">true</config:config-item> + <config:config-item config:name="SyntaxStringRef" config:type="short">7</config:config-item> + <config:config-item-map-named config:name="ScriptConfiguration"> + <config:config-item-map-entry config:name="Sheet1"> + <config:config-item config:name="CodeName" config:type="string">Sheet1</config:config-item> + </config:config-item-map-entry> + </config:config-item-map-named> + </config:config-item-set> + </office:settings> + <office:scripts> + <office:script script:language="ooo:Basic"> + <ooo:libraries xmlns:ooo="http://openoffice.org/2004/office" xmlns:xlink="http://www.w3.org/1999/xlink"/> + </office:script> + </office:scripts> + <office:font-face-decls> + <style:font-face style:name="Liberation Sans" svg:font-family="'Liberation Sans'" style:font-family-generic="swiss" style:font-pitch="variable"/> + <style:font-face style:name="Lucida Sans" svg:font-family="'Lucida Sans'" style:font-family-generic="system" style:font-pitch="variable"/> + <style:font-face style:name="Microsoft YaHei" svg:font-family="'Microsoft YaHei'" style:font-family-generic="system" style:font-pitch="variable"/> + </office:font-face-decls> + <office:styles> + <style:default-style style:family="table-cell"> + <style:paragraph-properties style:tab-stop-distance="1.25cm"/> + <style:text-properties style:font-name="Liberation Sans" fo:font-size="10pt" fo:language="de" fo:country="DE" style:font-name-asian="Microsoft YaHei" style:font-size-asian="10pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lucida Sans" style:font-size-complex="10pt" style:language-complex="hi" style:country-complex="IN"/> + </style:default-style> + <style:default-style style:family="graphic"> + <style:graphic-properties svg:stroke-color="#3465a4" draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.3cm" draw:shadow-offset-y="0.3cm" style:writing-mode="page"/> + <style:paragraph-properties style:text-autospace="ideograph-alpha" style:punctuation-wrap="simple" style:line-break="strict" loext:tab-stop-distance="0cm" style:writing-mode="page" style:font-independent-line-spacing="false"> + <style:tab-stops/> + </style:paragraph-properties> + <style:text-properties style:use-window-font-color="true" loext:opacity="0%" fo:font-family="'Liberation Serif'" style:font-family-generic="roman" style:font-pitch="variable" fo:font-size="12pt" fo:language="de" fo:country="DE" style:letter-kerning="true" style:font-family-asian="'Segoe UI'" style:font-family-generic-asian="system" style:font-pitch-asian="variable" style:font-size-asian="12pt" style:language-asian="zh" style:country-asian="CN" style:font-family-complex="Tahoma" style:font-family-generic-complex="system" style:font-pitch-complex="variable" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN"/> + </style:default-style> + <style:style style:name="Default" style:family="graphic"/> + <style:style style:name="Note" style:family="graphic" style:parent-style-name="Default"> + <style:graphic-properties draw:stroke="solid" draw:marker-start="Arrowheads_20_1" draw:marker-start-width="0.2cm" draw:marker-start-center="false" draw:fill="solid" draw:fill-color="#ffffc0" draw:auto-grow-height="true" draw:auto-grow-width="false" fo:padding-top="0.1cm" fo:padding-bottom="0.1cm" fo:padding-left="0.1cm" fo:padding-right="0.1cm" draw:shadow="visible" draw:shadow-offset-x="0.1cm" draw:shadow-offset-y="0.1cm"/> + <style:text-properties style:font-name="Liberation Sans" fo:font-family="'Liberation Sans'" style:font-family-generic="swiss" style:font-pitch="variable" fo:font-size="10pt" style:font-name-asian="Microsoft YaHei" style:font-family-asian="'Microsoft YaHei'" style:font-family-generic-asian="system" style:font-pitch-asian="variable" style:font-size-asian="10pt" style:font-name-complex="Lucida Sans" style:font-family-complex="'Lucida Sans'" style:font-family-generic-complex="system" style:font-pitch-complex="variable" style:font-size-complex="10pt"/> + </style:style> + <number:number-style style:name="N0"> + <number:number number:min-integer-digits="1"/> + </number:number-style> + <number:currency-style style:name="N114P0" style:volatile="true"> + <number:number number:decimal-places="2" number:min-decimal-places="2" number:min-integer-digits="1" number:grouping="true"/> + <number:text> </number:text> + <number:currency-symbol number:language="de" number:country="DE">€</number:currency-symbol> + </number:currency-style> + <number:currency-style style:name="N114"> + <style:text-properties fo:color="#ff0000"/> + <number:text>-</number:text> + <number:number number:decimal-places="2" number:min-decimal-places="2" number:min-integer-digits="1" number:grouping="true"/> + <number:text> </number:text> + <number:currency-symbol number:language="de" number:country="DE">€</number:currency-symbol> + <style:map style:condition="value()>=0" style:apply-style-name="N114P0"/> + </number:currency-style> + <style:style style:name="Default" style:family="table-cell"/> + <style:style style:name="Heading" style:family="table-cell" style:parent-style-name="Default"> + <style:table-cell-properties fo:wrap-option="no-wrap" style:shrink-to-fit="false"/> + <style:text-properties fo:font-size="24pt" fo:font-style="normal" fo:font-weight="bold" style:font-size-asian="24pt" style:font-style-asian="normal" style:font-weight-asian="bold" style:font-size-complex="24pt" style:font-style-complex="normal" style:font-weight-complex="bold"/> + </style:style> + <style:style style:name="Heading_20_1" style:display-name="Heading 1" style:family="table-cell" style:parent-style-name="Heading"> + <style:table-cell-properties fo:wrap-option="no-wrap" style:shrink-to-fit="false"/> + <style:text-properties fo:font-size="18pt" style:font-size-asian="18pt" style:font-size-complex="18pt"/> + </style:style> + <style:style style:name="Heading_20_2" style:display-name="Heading 2" style:family="table-cell" style:parent-style-name="Heading"> + <style:table-cell-properties fo:wrap-option="no-wrap" style:shrink-to-fit="false"/> + <style:text-properties fo:font-size="12pt" style:font-size-asian="12pt" style:font-size-complex="12pt"/> + </style:style> + <style:style style:name="Text" style:family="table-cell" style:parent-style-name="Default"> + <style:table-cell-properties fo:wrap-option="no-wrap" style:shrink-to-fit="false"/> + </style:style> + <style:style style:name="Note" style:family="table-cell" style:parent-style-name="Text"> + <style:table-cell-properties fo:background-color="#ffffcc" style:diagonal-bl-tr="none" style:diagonal-tl-br="none" fo:wrap-option="no-wrap" fo:border="0.74pt solid #808080" style:shrink-to-fit="false"/> + <style:text-properties fo:color="#333333"/> + </style:style> + <style:style style:name="Footnote" style:family="table-cell" style:parent-style-name="Text"> + <style:table-cell-properties fo:wrap-option="no-wrap" style:shrink-to-fit="false"/> + <style:text-properties fo:color="#808080" fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic"/> + </style:style> + <style:style style:name="Hyperlink" style:family="table-cell" style:parent-style-name="Text"> + <style:table-cell-properties fo:wrap-option="no-wrap" style:shrink-to-fit="false"/> + <style:text-properties fo:color="#0000ee" style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="#0000ee"/> + </style:style> + <style:style style:name="Status" style:family="table-cell" style:parent-style-name="Default"> + <style:table-cell-properties fo:wrap-option="no-wrap" style:shrink-to-fit="false"/> + </style:style> + <style:style style:name="Good" style:family="table-cell" style:parent-style-name="Status"> + <style:table-cell-properties fo:background-color="#ccffcc" fo:wrap-option="no-wrap" style:shrink-to-fit="false"/> + <style:text-properties fo:color="#006600"/> + </style:style> + <style:style style:name="Neutral" style:family="table-cell" style:parent-style-name="Status"> + <style:table-cell-properties fo:background-color="#ffffcc" fo:wrap-option="no-wrap" style:shrink-to-fit="false"/> + <style:text-properties fo:color="#996600"/> + </style:style> + <style:style style:name="Bad" style:family="table-cell" style:parent-style-name="Status"> + <style:table-cell-properties fo:background-color="#ffcccc" fo:wrap-option="no-wrap" style:shrink-to-fit="false"/> + <style:text-properties fo:color="#cc0000"/> + </style:style> + <style:style style:name="Warning" style:family="table-cell" style:parent-style-name="Status"> + <style:table-cell-properties fo:wrap-option="no-wrap" style:shrink-to-fit="false"/> + <style:text-properties fo:color="#cc0000"/> + </style:style> + <style:style style:name="Error" style:family="table-cell" style:parent-style-name="Status"> + <style:table-cell-properties fo:background-color="#cc0000" fo:wrap-option="no-wrap" style:shrink-to-fit="false"/> + <style:text-properties fo:color="#ffffff" fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold"/> + </style:style> + <style:style style:name="Accent" style:family="table-cell" style:parent-style-name="Default"> + <style:table-cell-properties fo:wrap-option="no-wrap" style:shrink-to-fit="false"/> + <style:text-properties fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold"/> + </style:style> + <style:style style:name="Accent_20_1" style:display-name="Accent 1" style:family="table-cell" style:parent-style-name="Accent"> + <style:table-cell-properties fo:background-color="#000000" fo:wrap-option="no-wrap" style:shrink-to-fit="false"/> + <style:text-properties fo:color="#ffffff"/> + </style:style> + <style:style style:name="Accent_20_2" style:display-name="Accent 2" style:family="table-cell" style:parent-style-name="Accent"> + <style:table-cell-properties fo:background-color="#808080" fo:wrap-option="no-wrap" style:shrink-to-fit="false"/> + <style:text-properties fo:color="#ffffff"/> + </style:style> + <style:style style:name="Accent_20_3" style:display-name="Accent 3" style:family="table-cell" style:parent-style-name="Accent"> + <style:table-cell-properties fo:background-color="#dddddd" fo:wrap-option="no-wrap" style:shrink-to-fit="false"/> + </style:style> + <style:style style:name="Result" style:family="table-cell" style:parent-style-name="Default"> + <style:table-cell-properties fo:wrap-option="no-wrap" style:shrink-to-fit="false"/> + <style:text-properties fo:font-style="italic" style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="font-color" fo:font-weight="bold" style:font-style-asian="italic" style:font-weight-asian="bold" style:font-style-complex="italic" style:font-weight-complex="bold"/> + </style:style> + <draw:marker draw:name="Arrowheads_20_1" draw:display-name="Arrowheads 1" svg:viewBox="0 0 20 30" svg:d="M10 0l-10 30h20z"/> + <loext:theme loext:name="Office"> + <loext:theme-colors loext:name="LibreOffice"> + <loext:color loext:name="dark1" loext:color="#000000"/> + <loext:color loext:name="light1" loext:color="#ffffff"/> + <loext:color loext:name="dark2" loext:color="#000000"/> + <loext:color loext:name="light2" loext:color="#ffffff"/> + <loext:color loext:name="accent1" loext:color="#18a303"/> + <loext:color loext:name="accent2" loext:color="#0369a3"/> + <loext:color loext:name="accent3" loext:color="#a33e03"/> + <loext:color loext:name="accent4" loext:color="#8e03a3"/> + <loext:color loext:name="accent5" loext:color="#c99c00"/> + <loext:color loext:name="accent6" loext:color="#c9211e"/> + <loext:color loext:name="hyperlink" loext:color="#0000ee"/> + <loext:color loext:name="followed-hyperlink" loext:color="#551a8b"/> + </loext:theme-colors> + </loext:theme> + </office:styles> + <office:automatic-styles> + <style:style style:name="co1" style:family="table-column"> + <style:table-column-properties fo:break-before="auto" style:column-width="2.258cm"/> + </style:style> + <style:style style:name="ro1" style:family="table-row"> + <style:table-row-properties style:row-height="0.452cm" fo:break-before="auto" style:use-optimal-row-height="true"/> + </style:style> + <style:style style:name="ta1" style:family="table" style:master-page-name="Default"> + <style:table-properties table:display="true" style:writing-mode="lr-tb"/> + </style:style> + <number:number-style style:name="N2"> + <number:number number:decimal-places="2" number:min-decimal-places="2" number:min-integer-digits="1"/> + </number:number-style> + <style:style style:name="gr1" style:family="graphic" style:parent-style-name="Default"> + <style:graphic-properties draw:fill-color="#bc8f8f" draw:textarea-horizontal-align="justify" draw:textarea-vertical-align="middle" draw:auto-grow-height="false" fo:min-height="0.766cm" fo:min-width="1.481cm" loext:decorative="false"/> + <style:paragraph-properties fo:text-align="center"/> + </style:style> + <style:page-layout style:name="pm1"> + <style:page-layout-properties style:writing-mode="lr-tb"/> + <style:header-style> + <style:header-footer-properties fo:min-height="0.75cm" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-bottom="0.25cm"/> + </style:header-style> + <style:footer-style> + <style:header-footer-properties fo:min-height="0.75cm" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0.25cm"/> + </style:footer-style> + </style:page-layout> + <style:page-layout style:name="pm2"> + <style:page-layout-properties style:writing-mode="lr-tb"/> + <style:header-style> + <style:header-footer-properties fo:min-height="0.75cm" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-bottom="0.25cm" fo:border="1.5pt solid #000000" fo:padding="0.018cm" fo:background-color="#c0c0c0"> + <style:background-image/> + </style:header-footer-properties> + </style:header-style> + <style:footer-style> + <style:header-footer-properties fo:min-height="0.75cm" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0.25cm" fo:border="1.5pt solid #000000" fo:padding="0.018cm" fo:background-color="#c0c0c0"> + <style:background-image/> + </style:header-footer-properties> + </style:footer-style> + </style:page-layout> + <style:style style:name="P1" style:family="paragraph"> + <loext:graphic-properties draw:fill-color="#bc8f8f"/> + <style:paragraph-properties fo:text-align="center"/> + </style:style> + </office:automatic-styles> + <office:master-styles> + <style:master-page style:name="Default" style:page-layout-name="pm1"> + <style:header> + <text:p><text:sheet-name>???</text:sheet-name></text:p> + </style:header> + <style:header-left style:display="false"/> + <style:header-first style:display="false"/> + <style:footer> + <text:p>Page <text:page-number>1</text:page-number></text:p> + </style:footer> + <style:footer-left style:display="false"/> + <style:footer-first style:display="false"/> + </style:master-page> + <style:master-page style:name="Report" style:page-layout-name="pm2"> + <style:header> + <style:region-left> + <text:p><text:sheet-name>???</text:sheet-name><text:s/>(<text:title>???</text:title>)</text:p> + </style:region-left> + <style:region-right> + <text:p><text:date style:data-style-name="N2" text:date-value="2024-11-09">00.00.0000</text:date>, <text:time style:data-style-name="N2" text:time-value="14:47:35.668153500">00:00:00</text:time></text:p> + </style:region-right> + </style:header> + <style:header-left style:display="false"/> + <style:header-first style:display="false"/> + <style:footer> + <text:p>Page <text:page-number>1</text:page-number><text:s/>/ <text:page-count>99</text:page-count></text:p> + </style:footer> + <style:footer-left style:display="false"/> + <style:footer-first style:display="false"/> + </style:master-page> + </office:master-styles> + <office:body> + <office:spreadsheet> + <table:calculation-settings table:automatic-find-labels="false" table:use-regular-expressions="false" table:use-wildcards="true"/> + <table:table table:name="Sheet1" table:style-name="ta1"> + <table:shapes> + <draw:custom-shape draw:z-index="0" draw:name="Shape 1" draw:style-name="gr1" draw:text-style-name="P1" svg:width="2.961cm" svg:height="2.365cm" svg:x="2.769cm" svg:y="1.462cm"> + <text:p/> + <draw:enhanced-geometry svg:viewBox="0 0 21600 21600" draw:extrusion="true" draw:extrusion-diffusion="100%" dr3d:shade-mode="flat" draw:extrusion-metal="true" draw:extrusion-first-light-direction="(-50000 0 10000)" draw:extrusion-second-light-direction="(50000 0 10000)" draw:extrusion-viewpoint="(0cm 0cm 25cm)" draw:extrusion-origin="0 0" draw:extrusion-skew="0 0" draw:extrusion-rotation-angle="0 30" draw:extrusion-depth="2.5cm 0" draw:extrusion-metal-type="draw:MetalODF" draw:extrusion-specularity="122.0703125%" draw:glue-points="0 0 0 10800 0 21600 10800 21600 21600 21600 10800 10800" draw:text-areas="1900 12700 12700 19700" draw:type="right-triangle" draw:enhanced-path="M 0 0 L 21600 21600 0 21600 0 0 Z N"/> + </draw:custom-shape></table:shapes> + <table:table-column table:style-name="co1" table:default-cell-style-name="Default"/> + <table:table-row table:style-name="ro1"> + <table:table-cell office:value-type="string" calcext:value-type="string"> + <text:p>Dummy</text:p> + </table:table-cell> + </table:table-row> + </table:table> + <table:named-expressions/> + </office:spreadsheet> + </office:body> +</office:document>
\ No newline at end of file diff --git a/xmloff/qa/unit/draw.cxx b/xmloff/qa/unit/draw.cxx index 198173350d73..c72bf57c7e9c 100644 --- a/xmloff/qa/unit/draw.cxx +++ b/xmloff/qa/unit/draw.cxx @@ -497,9 +497,11 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTableInShape) } // Tests for save/load of new (LO 7.4) attribute loext:extrusion-metal-type +// Since ODF 1.4 it is available as draw:extrusion-metal-type in the standard. namespace { -void lcl_assertMetalProperties(std::string_view sInfo, uno::Reference<drawing::XShape>& rxShape) +void lcl_assertMetalProperties(std::string_view sInfo, uno::Reference<drawing::XShape>& rxShape, + sal_Int16 nExpectedMetalType) { uno::Reference<beans::XPropertySet> xShapeProps(rxShape, uno::UNO_QUERY); uno::Sequence<beans::PropertyValue> aGeoPropSeq; @@ -517,8 +519,7 @@ void lcl_assertMetalProperties(std::string_view sInfo, uno::Reference<drawing::X sal_Int16 nMetalType(-1); aExtrusionPropMap.getValue(u"MetalType"_ustr) >>= nMetalType; sMsg = OString::Concat(sInfo) + " MetalType"; - CPPUNIT_ASSERT_EQUAL_MESSAGE( - sMsg.getStr(), css::drawing::EnhancedCustomShapeMetalType::MetalMSCompatible, nMetalType); + CPPUNIT_ASSERT_EQUAL_MESSAGE(sMsg.getStr(), nExpectedMetalType, nMetalType); } } @@ -528,34 +529,108 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionMetalTypeExtended) loadFromFile(u"tdf145700_3D_metal_type_MSCompatible.doc"); // verify properties uno::Reference<drawing::XShape> xShape(getShape(0)); - lcl_assertMetalProperties("from doc", xShape); + lcl_assertMetalProperties("from doc", xShape, + css::drawing::EnhancedCustomShapeMetalType::MetalMSCompatible); - // Test, that new attribute is written with loext namespace. Adapt when attribute is added to ODF. - SetODFDefaultVersion(SvtSaveOptions::ODFVER_013_EXTENDED); + // Test, that attribute is written with 'draw' namespace in ODF version LATEST saveAndReload(u"writer8"_ustr); // assert XML. xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); assertXPath(pXmlDoc, "//draw:enhanced-geometry", "extrusion-metal", u"true"); assertXPath(pXmlDoc, - "//draw:enhanced-geometry[@loext:extrusion-metal-type='loext:MetalMSCompatible']"); + "//draw:enhanced-geometry[@draw:extrusion-metal-type='loext:MetalMSCompatible']"); // verify properties uno::Reference<drawing::XShape> xShapeReload(getShape(0)); - lcl_assertMetalProperties("from ODF 1.3 extended", xShapeReload); + lcl_assertMetalProperties("from LATEST", xShapeReload, + css::drawing::EnhancedCustomShapeMetalType::MetalMSCompatible); + + // Test, that attribute is written with 'loext' namespace in extended version before ODF 1.4 + SetODFDefaultVersion(SvtSaveOptions::ODFVER_013_EXTENDED); + // As of Nov 2024, validating against a version other than LATEST is not implemented. + skipValidation(); + saveAndReload(u"writer8"_ustr); + + // assert XML. + pXmlDoc = parseExport(u"content.xml"_ustr); + assertXPath(pXmlDoc, "//draw:enhanced-geometry", "extrusion-metal", u"true"); + assertXPath(pXmlDoc, + "//draw:enhanced-geometry[@loext:extrusion-metal-type='loext:MetalMSCompatible']"); + + // verify properties + uno::Reference<drawing::XShape> xShapeReload2(getShape(0)); + lcl_assertMetalProperties("from ODF 1.3 extended", xShapeReload2, + css::drawing::EnhancedCustomShapeMetalType::MetalMSCompatible); } CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionMetalTypeStrict) { + Resetter resetter([]() { SetODFDefaultVersion(SvtSaveOptions::ODFVER_LATEST); }); loadFromFile(u"tdf145700_3D_metal_type_MSCompatible.doc"); - // save ODF 1.4 strict and test that new attribute is written. + // save in ODF 1.4 strict and test that new attribute is written. + SetODFDefaultVersion(SvtSaveOptions::ODFVER_014); save(u"writer8"_ustr); + xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); + assertXPath(pXmlDoc, "//draw:enhanced-geometry", "extrusion-metal", u"true"); + assertXPath(pXmlDoc, + "//draw:enhanced-geometry[@draw:extrusion-metal-type='loext:MetalMSCompatible']"); + + // save in ODF 1.3 strict and test that new attribute is not written. + SetODFDefaultVersion(SvtSaveOptions::ODFVER_013); + save(u"writer8"_ustr); + pXmlDoc = parseExport(u"content.xml"_ustr); + assertXPath(pXmlDoc, "//draw:enhanced-geometry", "extrusion-metal", u"true"); + assertXPathNoAttribute(pXmlDoc, "//draw:enhanced-geometry", "extrusion-metal-type"); +} + +CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionMetalTypeODF) +{ + Resetter resetter([]() { SetODFDefaultVersion(SvtSaveOptions::ODFVER_LATEST); }); + loadFromFile(u"tdf162686_3D_metal_type_ODF.fods"); + // verify properties + uno::Reference<drawing::XShape> xShape(getShape(0)); + lcl_assertMetalProperties("from doc", xShape, + css::drawing::EnhancedCustomShapeMetalType::MetalODF); + + // Test, that attribute is written with 'draw' namespace in ODF version LATEST + saveAndReload(u"calc8"_ustr); // assert XML. xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); assertXPath(pXmlDoc, "//draw:enhanced-geometry", "extrusion-metal", u"true"); - assertXPath(pXmlDoc, "//draw:enhanced-geometry[@draw:extrusion-metal-type]", 1); + assertXPath(pXmlDoc, "//draw:enhanced-geometry[@draw:extrusion-metal-type='draw:MetalODF']"); + + // verify properties + uno::Reference<drawing::XShape> xShapeReload(getShape(0)); + lcl_assertMetalProperties("from LATEST", xShapeReload, + css::drawing::EnhancedCustomShapeMetalType::MetalODF); + + // Test, that export in ODFVER_014 is valid. Needs adaption, when ODF 1.5 comes out. + SetODFDefaultVersion(SvtSaveOptions::ODFVER_014); + saveAndReload(u"calc8"_ustr); + + // Test, that attribute is written with 'loext' namespace in extended version before ODF 1.4 + SetODFDefaultVersion(SvtSaveOptions::ODFVER_013_EXTENDED); + // As of Nov 2024, validating against a version other than LATEST is not implemented. + skipValidation(); + saveAndReload(u"calc8"_ustr); + + // assert XML. + pXmlDoc = parseExport(u"content.xml"_ustr); + assertXPath(pXmlDoc, "//draw:enhanced-geometry[@loext:extrusion-metal-type='draw:MetalODF']"); + + // verify properties + uno::Reference<drawing::XShape> xShapeReload2(getShape(0)); + lcl_assertMetalProperties("from ODF 1.3 extended", xShapeReload2, + css::drawing::EnhancedCustomShapeMetalType::MetalODF); + + // Test, that attribute is not written at all in strict version before ODF 1.4 + SetODFDefaultVersion(SvtSaveOptions::ODFVER_013); + save(u"calc8"_ustr); + pXmlDoc = parseExport(u"content.xml"_ustr); + assertXPathNoAttribute(pXmlDoc, "//draw:enhanced-geometry", "extrusion-metal-type"); } namespace @@ -588,11 +663,13 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionSpecularityExtended) // Test, that attribute is written in draw namespace with value 100% and in loext namespace with // value 122.0703125%. SetODFDefaultVersion(SvtSaveOptions::ODFVER_013_EXTENDED); + // As of Nov 2024, validating against a version other than LATEST is not implemented. + skipValidation(); saveAndReload(u"writer8"_ustr); // assert XML. xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); - assertXPath(pXmlDoc, "//draw:enhanced-geometry[@draw:extrusion-specularity='100']"); + assertXPath(pXmlDoc, "//draw:enhanced-geometry[@draw:extrusion-specularity='100%']"); assertXPath(pXmlDoc, "//draw:enhanced-geometry[@loext:extrusion-specularity-loext='122.0703125%']"); @@ -601,7 +678,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionSpecularityExtended) lcl_assertSpecularityProperty("from ODF 1.3 extended", xShapeReload); } -CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionSpecularityStrict) +CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionSpecularity) { loadFromFile(u"tdf147580_extrusion-specularity.doc"); // verify property @@ -612,22 +689,33 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionSpecularityStrict) // assert XML. xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); - assertXPath(pXmlDoc, "//draw:enhanced-geometry[@draw:extrusion-specularity='122.0703125']"); + assertXPath(pXmlDoc, "//draw:enhanced-geometry[@draw:extrusion-specularity='122.0703125%']"); // verify properties uno::Reference<drawing::XShape> xShapeReload(getShape(0)); lcl_assertSpecularityProperty("from ODF 1.4", xShapeReload); } -CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionSpecularity) +CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionSpecularityStrict) { Resetter resetter([]() { SetODFDefaultVersion(SvtSaveOptions::ODFVER_LATEST); }); loadFromFile(u"tdf147580_extrusion-specularity.doc"); // The file has c3DSpecularAmt="80000" which results internally in specularity=122%. - // Save to ODF 1.3 strict and make sure it does not produce a validation error. + SetODFDefaultVersion(SvtSaveOptions::ODFVER_014); + save(u"writer8"_ustr); + xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); + assertXPath(pXmlDoc, "//draw:enhanced-geometry[@draw:extrusion-specularity='122.0703125%']"); + + // Save to ODF 1.3 strict and make sure draw:extrusion-specularity="100%" is written and + // loext:extrusion-specularity is not written. + // As of Nov 2024, validating against a version other than LATEST is not implemented. + skipValidation(); SetODFDefaultVersion(SvtSaveOptions::ODFVER_013); save(u"writer8"_ustr); + pXmlDoc = parseExport(u"content.xml"_ustr); + assertXPath(pXmlDoc, "//draw:enhanced-geometry[@loext:extrusion-specularity]", 0); + assertXPath(pXmlDoc, "//draw:enhanced-geometry[@draw:extrusion-specularity='100%']"); } namespace diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index 5af74d7fc93a..81e83550c82f 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -4599,22 +4599,26 @@ static void ImpExportEnhancedGeometry( SvXMLExport& rExport, const uno::Referenc break; case EAS_MetalType : { - // export only if ODF extensions are enabled + // In ODF since ODF 1.4. Before 1.4, export only in extended. sal_Int16 eMetalType; if (rProp.Value >>= eMetalType) { + // LibreOffice had used the same values as later specified in ODF 1.4 + if (eMetalType == drawing::EnhancedCustomShapeMetalType::MetalMSCompatible) + aStr = "loext:MetalMSCompatible"; + else + aStr = "draw:MetalODF"; + SvtSaveOptions::ODFSaneDefaultVersion eVersion = rExport.getSaneDefaultVersion(); if (eVersion >= SvtSaveOptions::ODFSVER_014) { - aStr = "draw:MetalODF"; + if (!(eVersion & SvtSaveOptions::ODFSVER_EXTENDED) + && eMetalType == drawing::EnhancedCustomShapeMetalType::MetalMSCompatible) + rExport.AddAttribute(XML_NAMESPACE_XMLNS, XML_NP_LO_EXT, XML_N_LO_EXT); rExport.AddAttribute(XML_NAMESPACE_DRAW, XML_EXTRUSION_METAL_TYPE, aStr); } else if (eVersion & SvtSaveOptions::ODFSVER_EXTENDED) { - if (eMetalType == drawing::EnhancedCustomShapeMetalType::MetalMSCompatible) - aStr = "loext:MetalMSCompatible"; - else - aStr = "draw:MetalODF"; rExport.AddAttribute(XML_NAMESPACE_LO_EXT, XML_EXTRUSION_METAL_TYPE, aStr); } } @@ -4703,8 +4707,11 @@ static void ImpExportEnhancedGeometry( SvXMLExport& rExport, const uno::Referenc double fExtrusionSpecularity = 0; if ( rProp.Value >>= fExtrusionSpecularity ) { + // ODF 1.0/1.1 allow arbitrary percent, ODF 1.2/1.3 restrict it to 0%-100%, + // ODF 1.4 restricts it to non negative percent. SvtSaveOptions::ODFSaneDefaultVersion eVersion = rExport.getSaneDefaultVersion(); - if (fExtrusionSpecularity > 100.0 && eVersion & SvtSaveOptions::ODFSVER_EXTENDED) + if (fExtrusionSpecularity > 100.0 && eVersion & SvtSaveOptions::ODFSVER_EXTENDED + && eVersion >= SvtSaveOptions::ODFSVER_012 && eVersion < SvtSaveOptions::ODFSVER_014) { // tdf#147580 write values > 100% in loext ::sax::Converter::convertDouble( @@ -4717,14 +4724,20 @@ static void ImpExportEnhancedGeometry( SvXMLExport& rExport, const uno::Referenc aStr = aStrBuffer.makeStringAndClear(); rExport.AddAttribute( XML_NAMESPACE_LO_EXT, XML_EXTRUSION_SPECULARITY_LOEXT, aStr ); } - // tdf#147580 ODF 1 allows arbitrary percent, later versions not + // clamp fExtrusionSpecularity to allowed values if (eVersion >= SvtSaveOptions::ODFSVER_012 && eVersion < SvtSaveOptions::ODFSVER_014) - { fExtrusionSpecularity = std::clamp<double>(fExtrusionSpecularity, 0.0, 100.0); - } - ::sax::Converter::convertDouble( aStrBuffer, fExtrusionSpecularity ); + else if (eVersion >= SvtSaveOptions::ODFSVER_014) + fExtrusionSpecularity = std::max<double>(0.0, fExtrusionSpecularity); + // write percent + ::sax::Converter::convertDouble( + aStrBuffer, + fExtrusionSpecularity, + false, + util::MeasureUnit::PERCENT, + util::MeasureUnit::PERCENT); + aStrBuffer.append( '%' ); aStr = aStrBuffer.makeStringAndClear(); - rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_SPECULARITY, aStr ); } } |