summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-10-09 17:51:50 +0200
committerAndras Timar <andras.timar@collabora.com>2015-10-17 23:23:23 +0200
commit26dcd66646800bd343e2e49a6a45c5ed91d3bdec (patch)
tree69e44bc5f8d8ced35a3b4163f18b1e36f1e76991
parent92e24ae6f1a53370534e1b61514d519533f0fb4b (diff)
xmloff: fix ODF import of gradient draw:angle attribute a bit
ODF 1.2 part 3, 18.3.1 angle, says "An angle, as defined in §4.1 of [SVG]" and "If no unit identifier is specified, the value is assumed to be in degrees." Unfortunately OOo could only read and write 10th of degree here. See also https://issues.oasis-open.org/browse/OFFICE-3774 As the first step towards fixing that, implement the import for draw:angle values with an angle unit identifier, but leave the import as-is if the angle identifier is missing. Change-Id: Ib88d417c03998ebcfc569b01492f0e1f851bbc85 (cherry picked from commit aadda5d17f6e422da143ea774f759bfc5f629c5b) Reviewed-on: https://gerrit.libreoffice.org/19283 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com> (cherry picked from commit 76a4665a09542fb67dd99c9a607c162e0b678ead)
-rw-r--r--include/sax/tools/converter.hxx6
-rw-r--r--sax/source/tools/converter.cxx56
-rw-r--r--sd/CppunitTest_sd_import_tests.mk2
-rw-r--r--sd/qa/unit/data/odg/gradient-angle.fodg212
-rw-r--r--sd/qa/unit/import-tests.cxx58
-rw-r--r--sd/qa/unit/sdmodeltestbase.hxx3
-rw-r--r--xmloff/source/style/GradientStyle.cxx8
-rw-r--r--xmloff/source/style/TransGradientStyle.cxx9
8 files changed, 345 insertions, 9 deletions
diff --git a/include/sax/tools/converter.hxx b/include/sax/tools/converter.hxx
index d06d0ceee7b1..2f46c3b087ff 100644
--- a/include/sax/tools/converter.hxx
+++ b/include/sax/tools/converter.hxx
@@ -139,6 +139,12 @@ public:
/** convert string to double number (using ::rtl::math) without unit conversion */
static bool convertDouble(double& rValue, const OUString& rString);
+ /** convert number, 10th of degrees with range [0..3600] to SVG angle */
+ static void convertAngle(OUStringBuffer& rBuffer, sal_Int16 nAngle);
+
+ /** convert SVG angle to number, 10th of degrees with range [0..3600] */
+ static bool convertAngle(sal_Int16& rAngle, OUString const& rString);
+
/** convert double to ISO "duration" string; negative durations allowed */
static void convertDuration(OUStringBuffer& rBuffer,
const double fTime);
diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx
index 3ef609e2f288..5c9697411131 100644
--- a/sax/source/tools/converter.cxx
+++ b/sax/source/tools/converter.cxx
@@ -640,6 +640,62 @@ bool Converter::convertDouble(double& rValue, const OUString& rString)
return ( eStatus == rtl_math_ConversionStatus_Ok );
}
+/** convert number, 10th of degrees with range [0..3600] to SVG angle */
+void Converter::convertAngle(OUStringBuffer& rBuffer, sal_Int16 const nAngle)
+{
+#if 1
+ // wrong, but backward compatible with OOo/LO < 4.4
+ ::sax::Converter::convertNumber(rBuffer, nAngle);
+#else
+ // maybe in the future... (see other convertAngle)
+ double fAngle(double(nAngle) / 10.0);
+ ::sax::Converter::convertDouble(rBuffer, fAngle);
+ rBuffer.append("deg");
+#endif
+}
+
+/** convert SVG angle to number, 10th of degrees with range [0..3600] */
+bool Converter::convertAngle(sal_Int16& rAngle, OUString const& rString)
+{
+ // ODF 1.1 leaves it undefined what the number means, but ODF 1.2 says it's
+ // degrees, while OOo has historically used 10th of degrees :(
+ // So import degrees when we see the "deg" suffix but continue with 10th of
+ // degrees for now for the sake of existing OOo/LO documents, until the
+ // new versions that can read "deg" suffix are widely deployed and we can
+ // start to write the "deg" suffix.
+ sal_Int32 nValue(0);
+ double fValue(0.0);
+ bool bRet = ::sax::Converter::convertDouble(fValue, rString);
+ if (-1 != rString.indexOf("deg"))
+ {
+ nValue = fValue * 10.0;
+ }
+ else if (-1 != rString.indexOf("grad"))
+ {
+ nValue = (fValue * 9.0 / 10.0) * 10.0;
+ }
+ else if (-1 != rString.indexOf("rad"))
+ {
+ nValue = (fValue * 180.0 / M_PI) * 10.0;
+ }
+ else // no explicit unit
+ {
+ nValue = fValue; // wrong, but backward compatible with OOo/LO < 4.4
+ }
+ // limit to valid range [0..3600]
+ nValue = nValue % 3600;
+ if (nValue < 0)
+ {
+ nValue += 3600;
+ }
+ assert(0 <= nValue && nValue <= 3600);
+ if (bRet)
+ {
+ rAngle = sal::static_int_cast<sal_Int16>(nValue);
+ }
+ return bRet;
+}
+
/** convert double to ISO "duration" string; negative durations allowed */
void Converter::convertDuration(OUStringBuffer& rBuffer,
const double fTime)
diff --git a/sd/CppunitTest_sd_import_tests.mk b/sd/CppunitTest_sd_import_tests.mk
index 238f13319b46..6058e8e58cfc 100644
--- a/sd/CppunitTest_sd_import_tests.mk
+++ b/sd/CppunitTest_sd_import_tests.mk
@@ -76,8 +76,10 @@ $(eval $(call gb_CppunitTest_use_components,sd_import_tests,\
desktop/source/deployment/deployment \
embeddedobj/util/embobj \
filter/source/config/cache/filterconfig1 \
+ filter/source/odfflatxml/odfflatxml \
filter/source/svg/svgfilter \
filter/source/xmlfilteradaptor/xmlfa \
+ filter/source/xmlfilterdetect/xmlfd \
forms/util/frm \
framework/util/fwk \
i18npool/util/i18npool \
diff --git a/sd/qa/unit/data/odg/gradient-angle.fodg b/sd/qa/unit/data/odg/gradient-angle.fodg
new file mode 100644
index 000000000000..19039ba9b80c
--- /dev/null
+++ b/sd/qa/unit/data/odg/gradient-angle.fodg
@@ -0,0 +1,212 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office: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:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation: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:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d: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:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" 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:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.graphics">
+ <office:meta><meta:initial-creator>ms </meta:initial-creator><meta:creation-date>2015-10-09T14:51:21.086447801</meta:creation-date><dc:date>2015-10-09T14:54:47.829092906</dc:date><dc:creator>ms </dc:creator><meta:editing-duration>PT3M27S</meta:editing-duration><meta:editing-cycles>1</meta:editing-cycles><meta:generator>LibreOfficeDev/5.1.0.0.alpha1$Linux_X86_64 LibreOffice_project/83c5214889c712646e45dc1c19b6d3c13a05aa83</meta:generator><meta:document-statistic meta:object-count="1"/></office:meta>
+ <office:font-face-decls>
+ <style:font-face style:name="Liberation Sans" svg:font-family="&apos;Liberation Sans&apos;" style:font-family-generic="roman" style:font-pitch="variable"/>
+ <style:font-face style:name="Liberation Serif" svg:font-family="&apos;Liberation Serif&apos;" style:font-family-generic="roman" style:font-pitch="variable"/>
+ <style:font-face style:name="DejaVu Sans" svg:font-family="&apos;DejaVu Sans&apos;" style:font-family-generic="system" style:font-pitch="variable"/>
+ <style:font-face style:name="Lohit Devanagari" svg:font-family="&apos;Lohit Devanagari&apos;" style:font-family-generic="system" style:font-pitch="variable"/>
+ <style:font-face style:name="Source Han Sans CN Regular" svg:font-family="&apos;Source Han Sans CN Regular&apos;" style:font-family-generic="system" style:font-pitch="variable"/>
+ </office:font-face-decls>
+ <office:styles>
+ <draw:gradient draw:name="Gradient_20_10" draw:display-name="Gradient 10" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="27deg" draw:border="0%"/>
+ <draw:gradient draw:name="Gradient_20_11" draw:display-name="Gradient 11" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="2rad" draw:border="0%"/>
+ <draw:gradient draw:name="Gradient_20_12" draw:display-name="Gradient 12" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="100grad" draw:border="0%"/>
+ <draw:gradient draw:name="Gradient_20_13" draw:display-name="Gradient 13" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="-1" draw:border="0%"/>
+ <draw:gradient draw:name="Gradient_20_14" draw:display-name="Gradient 14" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="-1rad" draw:border="0%"/>
+ <draw:gradient draw:name="Gradient_20_15" draw:display-name="Gradient 15" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="3900" draw:border="0%"/>
+ <draw:gradient draw:name="Gradient_20_16" draw:display-name="Gradient 16" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="10.5deg" draw:border="0%"/>
+ <draw:gradient draw:name="Gradient_20_17" draw:display-name="Gradient 17" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="3.14159265358979323846rad" draw:border="0%"/>
+ <draw:gradient draw:name="Gradient_20_18" draw:display-name="Gradient 18" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="190" draw:border="0%"/>
+ <draw:gradient draw:name="Gradient_20_19" draw:display-name="Gradient 19" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="180" draw:border="0%"/>
+ <draw:gradient draw:name="Gradient_20_2" draw:display-name="Gradient 2" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="320" draw:border="0%"/>
+ <draw:gradient draw:name="Gradient_20_20" draw:display-name="Gradient 20" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="170" draw:border="0%"/>
+ <draw:gradient draw:name="Gradient_20_21" draw:display-name="Gradient 21" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="160" draw:border="0%"/>
+ <draw:gradient draw:name="Gradient_20_22" draw:display-name="Gradient 22" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="150" draw:border="0%"/>
+ <draw:gradient draw:name="Gradient_20_23" draw:display-name="Gradient 23" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="140" draw:border="0%"/>
+ <draw:gradient draw:name="Gradient_20_24" draw:display-name="Gradient 24" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="130" draw:border="0%"/>
+ <draw:gradient draw:name="Gradient_20_25" draw:display-name="Gradient 25" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="120" draw:border="0%"/>
+ <draw:gradient draw:name="Gradient_20_26" draw:display-name="Gradient 26" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="110" draw:border="0%"/>
+ <draw:gradient draw:name="Gradient_20_27" draw:display-name="Gradient 27" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="100" draw:border="0%"/>
+ <draw:gradient draw:name="Gradient_20_28" draw:display-name="Gradient 28" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="90" draw:border="0%"/>
+ <draw:gradient draw:name="Gradient_20_29" draw:display-name="Gradient 29" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="80" draw:border="0%"/>
+ <draw:gradient draw:name="Gradient_20_3" draw:display-name="Gradient 3" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="330" draw:border="0%"/>
+ <draw:gradient draw:name="Gradient_20_30" draw:display-name="Gradient 30" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="70" draw:border="0%"/>
+ <draw:gradient draw:name="Gradient_20_31" draw:display-name="Gradient 31" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="60" draw:border="0%"/>
+ <draw:gradient draw:name="Gradient_20_32" draw:display-name="Gradient 32" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="50" draw:border="0%"/>
+ <draw:gradient draw:name="Gradient_20_33" draw:display-name="Gradient 33" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="40" draw:border="0%"/>
+ <draw:gradient draw:name="Gradient_20_34" draw:display-name="Gradient 34" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="30" draw:border="0%"/>
+ <draw:gradient draw:name="Gradient_20_35" draw:display-name="Gradient 35" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="20" draw:border="0%"/>
+ <draw:gradient draw:name="Gradient_20_36" draw:display-name="Gradient 36" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="10" draw:border="0%"/>
+ <draw:gradient draw:name="Gradient_20_37" draw:display-name="Gradient 37" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="0" draw:border="0%"/>
+ <draw:gradient draw:name="Gradient_20_38" draw:display-name="Gradient 38" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="3600" draw:border="0%"/>
+ <draw:gradient draw:name="Gradient_20_39" draw:display-name="Gradient 39" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="3590" draw:border="0%"/>
+ <draw:gradient draw:name="Gradient_20_4" draw:display-name="Gradient 4" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="340" draw:border="0%"/>
+ <draw:gradient draw:name="Gradient_20_40" draw:display-name="Gradient 40" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="3580" draw:border="0%"/>
+ <draw:gradient draw:name="Gradient_20_5" draw:display-name="Gradient 5" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="350" draw:border="0%"/>
+ <draw:gradient draw:name="Gradient_20_6" draw:display-name="Gradient 6" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="360" draw:border="0%"/>
+ <draw:gradient draw:name="Gradient_20_7" draw:display-name="Gradient 7" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="300" draw:border="0%"/>
+ <draw:gradient draw:name="Gradient_20_8" draw:display-name="Gradient 8" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="290" draw:border="0%"/>
+ <draw:gradient draw:name="Gradient_20_9" draw:display-name="Gradient 9" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="280" draw:border="0%"/>
+ <draw:gradient draw:name="Tango_20_Green" draw:display-name="Tango Green" draw:style="linear" draw:start-color="#8ae234" draw:end-color="#4e9a06" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="310" draw:border="0%"/>
+ <draw:opacity draw:name="Transparency_20_1" draw:display-name="Transparency 1" draw:style="linear" draw:start="100%" draw:end="0%" draw:angle="90deg" draw:border="0%"/>
+ <draw:opacity draw:name="Transparency_20_2" draw:display-name="Transparency 2" draw:style="linear" draw:start="100%" draw:end="0%" draw:angle="10" draw:border="0%"/>
+ <draw:opacity draw:name="Transparency_20_3" draw:display-name="Transparency 3" draw:style="linear" draw:start="100%" draw:end="0%" draw:angle="1.0rad" draw:border="0%"/>
+ <draw:opacity draw:name="Transparency_20_4" draw:display-name="Transparency 4" draw:style="linear" draw:start="100%" draw:end="0%" draw:angle="1000grad" draw:border="0%"/>
+ <draw:opacity draw:name="Transparency_20_5" draw:display-name="Transparency 5" draw:style="linear" draw:start="100%" draw:end="0%" draw:angle="3580" draw:border="0%"/>
+ <draw:opacity draw:name="Transparency_20_6" draw:display-name="Transparency 6" draw:style="linear" draw:start="100%" draw:end="0%" draw:angle="3570" draw:border="0%"/>
+ <draw:marker draw:name="Arrow" svg:viewBox="0 0 20 30" svg:d="M10 0l-10 30h20z"/>
+ <style:default-style style:family="graphic">
+ <style:graphic-properties svg:stroke-color="#3465a4" draw:fill-color="#729fcf" fo:wrap-option="no-wrap"/>
+ <style:paragraph-properties style:text-autospace="ideograph-alpha" style:punctuation-wrap="simple" style:line-break="strict" style:writing-mode="lr-tb" style:font-independent-line-spacing="false">
+ <style:tab-stops/>
+ </style:paragraph-properties>
+ <style:text-properties style:use-window-font-color="true" style:font-name="Liberation Serif" fo:font-size="24pt" fo:language="de" fo:country="DE" style:font-name-asian="DejaVu Sans" style:font-size-asian="24pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="DejaVu Sans" style:font-size-complex="24pt" style:language-complex="hi" style:country-complex="IN"/>
+ </style:default-style>
+ <style:style style:name="standard" style:family="graphic">
+ <style:graphic-properties draw:stroke="solid" svg:stroke-width="0cm" svg:stroke-color="#3465a4" draw:marker-start-width="0.2cm" draw:marker-start-center="false" draw:marker-end-width="0.2cm" draw:marker-end-center="false" draw:fill="solid" draw:fill-color="#729fcf" draw:textarea-horizontal-align="justify" fo:padding-top="0.125cm" fo:padding-bottom="0.125cm" fo:padding-left="0.25cm" fo:padding-right="0.25cm" draw:shadow="hidden" draw:shadow-offset-x="0.2cm" draw:shadow-offset-y="0.2cm" draw:shadow-color="#808080">
+ <text:list-style style:name="standard">
+ <text:list-level-style-bullet text:level="1" text:bullet-char="●">
+ <style:list-level-properties text:min-label-width="0.6cm"/>
+ <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
+ </text:list-level-style-bullet>
+ <text:list-level-style-bullet text:level="2" text:bullet-char="●">
+ <style:list-level-properties text:space-before="0.6cm" text:min-label-width="0.6cm"/>
+ <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
+ </text:list-level-style-bullet>
+ <text:list-level-style-bullet text:level="3" text:bullet-char="●">
+ <style:list-level-properties text:space-before="1.2cm" text:min-label-width="0.6cm"/>
+ <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
+ </text:list-level-style-bullet>
+ <text:list-level-style-bullet text:level="4" text:bullet-char="●">
+ <style:list-level-properties text:space-before="1.8cm" text:min-label-width="0.6cm"/>
+ <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
+ </text:list-level-style-bullet>
+ <text:list-level-style-bullet text:level="5" text:bullet-char="●">
+ <style:list-level-properties text:space-before="2.4cm" text:min-label-width="0.6cm"/>
+ <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
+ </text:list-level-style-bullet>
+ <text:list-level-style-bullet text:level="6" text:bullet-char="●">
+ <style:list-level-properties text:space-before="3cm" text:min-label-width="0.6cm"/>
+ <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
+ </text:list-level-style-bullet>
+ <text:list-level-style-bullet text:level="7" text:bullet-char="●">
+ <style:list-level-properties text:space-before="3.6cm" text:min-label-width="0.6cm"/>
+ <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
+ </text:list-level-style-bullet>
+ <text:list-level-style-bullet text:level="8" text:bullet-char="●">
+ <style:list-level-properties text:space-before="4.2cm" text:min-label-width="0.6cm"/>
+ <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
+ </text:list-level-style-bullet>
+ <text:list-level-style-bullet text:level="9" text:bullet-char="●">
+ <style:list-level-properties text:space-before="4.8cm" text:min-label-width="0.6cm"/>
+ <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
+ </text:list-level-style-bullet>
+ <text:list-level-style-bullet text:level="10" text:bullet-char="●">
+ <style:list-level-properties text:space-before="5.4cm" text:min-label-width="0.6cm"/>
+ <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
+ </text:list-level-style-bullet>
+ </text:list-style>
+ </style:graphic-properties>
+ <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:line-height="100%" fo:text-indent="0cm"/>
+ <style:text-properties fo:font-variant="normal" fo:text-transform="none" style:use-window-font-color="true" style:text-outline="false" style:text-line-through-style="none" style:text-line-through-type="none" style:font-name="Liberation Sans" fo:font-family="&apos;Liberation Sans&apos;" style:font-family-generic="roman" style:font-pitch="variable" fo:font-size="18pt" fo:font-style="normal" fo:text-shadow="none" style:text-underline-style="none" fo:font-weight="normal" style:letter-kerning="true" style:font-name-asian="Source Han Sans CN Regular" style:font-family-asian="&apos;Source Han Sans CN Regular&apos;" style:font-family-generic-asian="system" style:font-pitch-asian="variable" style:font-size-asian="18pt" style:font-style-asian="normal" style:font-weight-asian="normal" style:font-name-complex="Lohit Devanagari" style:font-family-complex="&apos;Lohit Devanagari&apos;" style:font-family-generic-complex="system" style:font-pitch-complex="variable" style:font-size-complex="18pt" style:font-style-complex="normal" style:font-weight-complex="normal" style:text-emphasize="none" style:font-relief="none" style:text-overline-style="none" style:text-overline-color="font-color"/>
+ </style:style>
+ <style:style style:name="objectwitharrow" style:family="graphic" style:parent-style-name="standard">
+ <style:graphic-properties draw:stroke="solid" svg:stroke-width="0.15cm" svg:stroke-color="#000000" draw:marker-start="Arrow" draw:marker-start-width="0.7cm" draw:marker-start-center="true" draw:marker-end-width="0.3cm"/>
+ </style:style>
+ <style:style style:name="objectwithshadow" style:family="graphic" style:parent-style-name="standard">
+ <style:graphic-properties draw:shadow="visible" draw:shadow-offset-x="0.2cm" draw:shadow-offset-y="0.2cm" draw:shadow-color="#808080"/>
+ </style:style>
+ <style:style style:name="objectwithoutfill" style:family="graphic" style:parent-style-name="standard">
+ <style:graphic-properties svg:stroke-color="#000000" draw:fill="none"/>
+ </style:style>
+ <style:style style:name="Object_20_with_20_no_20_fill_20_and_20_no_20_line" style:display-name="Object with no fill and no line" style:family="graphic" style:parent-style-name="standard">
+ <style:graphic-properties draw:stroke="none" draw:fill="none"/>
+ </style:style>
+ <style:style style:name="text" style:family="graphic" style:parent-style-name="standard">
+ <style:graphic-properties draw:stroke="none" draw:fill="none"/>
+ </style:style>
+ <style:style style:name="textbody" style:family="graphic" style:parent-style-name="standard">
+ <style:graphic-properties draw:stroke="none" draw:fill="none"/>
+ <style:text-properties fo:font-size="16pt"/>
+ </style:style>
+ <style:style style:name="textbodyjustfied" style:family="graphic" style:parent-style-name="standard">
+ <style:graphic-properties draw:stroke="none" draw:fill="none"/>
+ <style:paragraph-properties fo:text-align="justify"/>
+ </style:style>
+ <style:style style:name="textbodyindent" style:family="graphic" style:parent-style-name="standard">
+ <style:graphic-properties draw:stroke="none" draw:fill="none"/>
+ <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="0.6cm"/>
+ </style:style>
+ <style:style style:name="title" style:family="graphic" style:parent-style-name="standard">
+ <style:graphic-properties draw:stroke="none" draw:fill="none"/>
+ <style:text-properties fo:font-size="44pt"/>
+ </style:style>
+ <style:style style:name="title1" style:family="graphic" style:parent-style-name="standard">
+ <style:graphic-properties draw:stroke="none" draw:fill="solid" draw:fill-color="#008080" draw:shadow="visible" draw:shadow-offset-x="0.2cm" draw:shadow-offset-y="0.2cm" draw:shadow-color="#808080"/>
+ <style:paragraph-properties fo:text-align="center"/>
+ <style:text-properties fo:font-size="24pt"/>
+ </style:style>
+ <style:style style:name="title2" style:family="graphic" style:parent-style-name="standard">
+ <style:graphic-properties svg:stroke-width="0.05cm" draw:fill-color="#ffcc99" draw:shadow="visible" draw:shadow-offset-x="0.2cm" draw:shadow-offset-y="0.2cm" draw:shadow-color="#808080"/>
+ <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0.2cm" fo:margin-top="0.1cm" fo:margin-bottom="0.1cm" fo:text-align="center" fo:text-indent="0cm"/>
+ <style:text-properties fo:font-size="36pt"/>
+ </style:style>
+ <style:style style:name="headline" style:family="graphic" style:parent-style-name="standard">
+ <style:graphic-properties draw:stroke="none" draw:fill="none"/>
+ <style:paragraph-properties fo:margin-top="0.42cm" fo:margin-bottom="0.21cm"/>
+ <style:text-properties fo:font-size="24pt"/>
+ </style:style>
+ <style:style style:name="headline1" style:family="graphic" style:parent-style-name="standard">
+ <style:graphic-properties draw:stroke="none" draw:fill="none"/>
+ <style:paragraph-properties fo:margin-top="0.42cm" fo:margin-bottom="0.21cm"/>
+ <style:text-properties fo:font-size="18pt" fo:font-weight="bold"/>
+ </style:style>
+ <style:style style:name="headline2" style:family="graphic" style:parent-style-name="standard">
+ <style:graphic-properties draw:stroke="none" draw:fill="none"/>
+ <style:paragraph-properties fo:margin-top="0.42cm" fo:margin-bottom="0.21cm"/>
+ <style:text-properties fo:font-size="14pt" fo:font-style="italic" fo:font-weight="bold"/>
+ </style:style>
+ <style:style style:name="measure" style:family="graphic" style:parent-style-name="standard">
+ <style:graphic-properties draw:stroke="solid" svg:stroke-color="#000000" draw:marker-start="Arrow" draw:marker-start-width="0.2cm" draw:marker-end="Arrow" draw:marker-end-width="0.2cm" draw:fill="none" draw:show-unit="true"/>
+ <style:text-properties fo:font-size="12pt"/>
+ </style:style>
+ </office:styles>
+ <office:automatic-styles>
+ <style:page-layout style:name="PM0">
+ <style:page-layout-properties fo:margin-top="1cm" fo:margin-bottom="1cm" fo:margin-left="1cm" fo:margin-right="1cm" fo:page-width="21cm" fo:page-height="29.7cm" style:print-orientation="portrait"/>
+ </style:page-layout>
+ <style:style style:name="dp1" style:family="drawing-page">
+ <style:drawing-page-properties draw:background-size="border" draw:fill="none"/>
+ </style:style>
+ <style:style style:name="dp2" style:family="drawing-page"/>
+ <style:style style:name="gr1" style:family="graphic" style:parent-style-name="standard">
+ <style:graphic-properties draw:fill="gradient" draw:fill-gradient-name="Gradient_20_38" draw:opacity="100%" draw:opacity-name="Transparency_20_2" draw:textarea-horizontal-align="justify" draw:textarea-vertical-align="middle" draw:auto-grow-height="false" fo:min-height="4.35cm" fo:min-width="10.1cm"/>
+ </style:style>
+ <style:style style:name="P1" style:family="paragraph">
+ <loext:graphic-properties draw:fill="gradient" draw:fill-gradient-name="Gradient_20_38" draw:opacity="100%" draw:opacity-name="Transparency_20_2"/>
+ <style:paragraph-properties fo:text-align="center"/>
+ </style:style>
+ </office:automatic-styles>
+ <office:master-styles>
+ <draw:layer-set>
+ <draw:layer draw:name="layout"/>
+ <draw:layer draw:name="background"/>
+ <draw:layer draw:name="backgroundobjects"/>
+ <draw:layer draw:name="controls"/>
+ <draw:layer draw:name="measurelines"/>
+ </draw:layer-set>
+ <style:master-page style:name="Default" style:page-layout-name="PM0" draw:style-name="dp1"/>
+ </office:master-styles>
+ <office:body>
+ <office:drawing>
+ <draw:page draw:name="page1" draw:style-name="dp2" draw:master-page-name="Default">
+ <draw:custom-shape draw:style-name="gr1" draw:text-style-name="P1" draw:layer="layout" svg:width="10.6cm" svg:height="4.6cm" svg:x="3.9cm" svg:y="2.5cm">
+ <text:p/>
+ <draw:enhanced-geometry svg:viewBox="0 0 21600 21600" draw:type="rectangle" draw:enhanced-path="M 0 0 L 21600 0 21600 21600 0 21600 0 0 Z N"/>
+ </draw:custom-shape>
+ </draw:page>
+ </office:drawing>
+ </office:body>
+</office:document>
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 9589a43f3f5e..bdedca1b325b 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -73,6 +73,7 @@ public:
void testN759180();
void testN778859();
void testMasterPageStyleParent();
+ void testGradientAngle();
void testFdo64512();
void testFdo71075();
void testN828390_2();
@@ -114,6 +115,7 @@ public:
CPPUNIT_TEST(testN759180);
CPPUNIT_TEST(testN778859);
CPPUNIT_TEST(testMasterPageStyleParent);
+ CPPUNIT_TEST(testGradientAngle);
CPPUNIT_TEST(testFdo64512);
CPPUNIT_TEST(testFdo71075);
CPPUNIT_TEST(testN828390_2);
@@ -440,6 +442,62 @@ void SdImportTest::testMasterPageStyleParent()
xDocShRef->DoClose();
}
+void SdImportTest::testGradientAngle()
+{
+ sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/odg/gradient-angle.fodg"), FODG);
+
+ uno::Reference<lang::XMultiServiceFactory> const xDoc(
+ xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY);
+
+ awt::Gradient gradient;
+ uno::Reference<container::XNameAccess> const xGradients(
+ xDoc->createInstance("com.sun.star.drawing.GradientTable"),
+ uno::UNO_QUERY);
+
+ CPPUNIT_ASSERT(xGradients->getByName("Gradient 38") >>= gradient);
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(0), gradient.Angle); // was: 3600
+
+ CPPUNIT_ASSERT(xGradients->getByName("Gradient 10") >>= gradient);
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(270), gradient.Angle); // 27deg
+
+ CPPUNIT_ASSERT(xGradients->getByName("Gradient 11") >>= gradient);
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(1145), gradient.Angle); // 2rad
+
+ CPPUNIT_ASSERT(xGradients->getByName("Gradient 12") >>= gradient);
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(900), gradient.Angle); // 100grad
+
+ CPPUNIT_ASSERT(xGradients->getByName("Gradient 13") >>= gradient);
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(3599), gradient.Angle); // -1
+
+ CPPUNIT_ASSERT(xGradients->getByName("Gradient 14") >>= gradient);
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(3028), gradient.Angle); // -1rad
+
+ CPPUNIT_ASSERT(xGradients->getByName("Gradient 15") >>= gradient);
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(300), gradient.Angle); // 3900
+
+ CPPUNIT_ASSERT(xGradients->getByName("Gradient 16") >>= gradient);
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(105), gradient.Angle); // 10.5deg
+
+ CPPUNIT_ASSERT(xGradients->getByName("Gradient 17") >>= gradient);
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(1800), gradient.Angle); // \pi rad
+
+ uno::Reference<container::XNameAccess> const xTranspGradients(
+ xDoc->createInstance("com.sun.star.drawing.TransparencyGradientTable"),
+ uno::UNO_QUERY);
+
+ CPPUNIT_ASSERT(xTranspGradients->getByName("Transparency 2") >>= gradient);
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(10), gradient.Angle); // 1
+
+ CPPUNIT_ASSERT(xTranspGradients->getByName("Transparency 1") >>= gradient);
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(900), gradient.Angle); // 90deg
+
+ CPPUNIT_ASSERT(xTranspGradients->getByName("Transparency 3") >>= gradient);
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(572), gradient.Angle); // 1.0rad
+
+ CPPUNIT_ASSERT(xTranspGradients->getByName("Transparency 4") >>= gradient);
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(1800), gradient.Angle); // 1000grad
+}
+
void SdImportTest::testN778859()
{
::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/n778859.pptx"), PPTX);
diff --git a/sd/qa/unit/sdmodeltestbase.hxx b/sd/qa/unit/sdmodeltestbase.hxx
index 96925af4beb5..037ba3ea5950 100644
--- a/sd/qa/unit/sdmodeltestbase.hxx
+++ b/sd/qa/unit/sdmodeltestbase.hxx
@@ -48,6 +48,7 @@ struct FileFormat
#define PPTX_FORMAT_TYPE ( SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT | SfxFilterFlags::ALIEN | SfxFilterFlags::STARONEFILTER | SfxFilterFlags::PREFERED )
#define HTML_FORMAT_TYPE ( SfxFilterFlags::EXPORT | SfxFilterFlags::ALIEN )
#define PDF_FORMAT_TYPE ( SfxFilterFlags::STARONEFILTER | SfxFilterFlags::ALIEN | SfxFilterFlags::IMPORT | SfxFilterFlags::PREFERED )
+#define FODG_FORMAT_TYPE (SfxFilterFlags::STARONEFILTER | SfxFilterFlags::OWN | SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT)
/** List of file formats we support in Impress unit tests.
@@ -64,6 +65,7 @@ FileFormat aFileFormats[] =
{ "pptx", "Impress Office Open XML", "Office Open XML Presentation", "", PPTX_FORMAT_TYPE },
{ "html", "graphic_HTML", "graphic_HTML", "", HTML_FORMAT_TYPE },
{ "pdf", "draw_pdf_import", "pdf_Portable_Document_Format", "", PDF_FORMAT_TYPE },
+ { "fodg", "OpenDocument Drawing Flat XML", "Flat XML ODF Drawing", "", FODG_FORMAT_TYPE },
{ 0, 0, 0, 0, SfxFilterFlags::NONE }
};
@@ -72,6 +74,7 @@ FileFormat aFileFormats[] =
#define PPTX 2
#define HTML 3
#define PDF 4
+#define FODG 5
/// Base class for filter tests loading or roundtriping a document, and asserting the document model.
class SdModelTestBase : public test::BootstrapFixture, public unotest::MacrosTest
diff --git a/xmloff/source/style/GradientStyle.cxx b/xmloff/source/style/GradientStyle.cxx
index 0ef830b3616c..0ad8c74c9044 100644
--- a/xmloff/source/style/GradientStyle.cxx
+++ b/xmloff/source/style/GradientStyle.cxx
@@ -178,9 +178,9 @@ bool XMLGradientStyleImport::importXML(
break;
case XML_TOK_GRADIENT_ANGLE:
{
- sal_Int32 nValue;
- ::sax::Converter::convertNumber( nValue, rStrValue, 0, 3600 );
- aGradient.Angle = sal_Int16( nValue );
+ bool const bSuccess =
+ ::sax::Converter::convertAngle(aGradient.Angle, rStrValue);
+ SAL_INFO_IF(!bSuccess, "xmloff.style", "failed to import draw:angle");
}
break;
case XML_TOK_GRADIENT_BORDER:
@@ -288,7 +288,7 @@ bool XMLGradientStyleExport::exportXML(
// Angle
if( aGradient.Style != awt::GradientStyle_RADIAL )
{
- ::sax::Converter::convertNumber(aOut, sal_Int32(aGradient.Angle));
+ ::sax::Converter::convertAngle(aOut, aGradient.Angle);
aStrValue = aOut.makeStringAndClear();
rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_GRADIENT_ANGLE, aStrValue );
}
diff --git a/xmloff/source/style/TransGradientStyle.cxx b/xmloff/source/style/TransGradientStyle.cxx
index 85c66ec3eafb..7b1ca1515193 100644
--- a/xmloff/source/style/TransGradientStyle.cxx
+++ b/xmloff/source/style/TransGradientStyle.cxx
@@ -178,9 +178,9 @@ bool XMLTransGradientStyleImport::importXML(
break;
case XML_TOK_GRADIENT_ANGLE:
{
- sal_Int32 nValue;
- ::sax::Converter::convertNumber( nValue, rStrValue, 0, 3600 );
- aGradient.Angle = sal_Int16( nValue );
+ bool const bSuccess =
+ ::sax::Converter::convertAngle(aGradient.Angle, rStrValue);
+ SAL_INFO_IF(!bSuccess, "xmloff.style", "failed to import draw:angle");
}
break;
case XML_TOK_GRADIENT_BORDER:
@@ -285,8 +285,7 @@ bool XMLTransGradientStyleExport::exportXML(
// Angle
if( aGradient.Style != awt::GradientStyle_RADIAL )
{
- ::sax::Converter::convertNumber(
- aOut, sal_Int32(aGradient.Angle));
+ ::sax::Converter::convertAngle(aOut, aGradient.Angle);
aStrValue = aOut.makeStringAndClear();
rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_GRADIENT_ANGLE, aStrValue );
}