[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - download.lst include/xmloff sw/qa xmloff/source
Michael Stahl
Michael.Stahl at cib.de
Tue May 8 22:45:53 UTC 2018
download.lst | 4 -
include/xmloff/xmltoken.hxx | 2
sw/qa/extras/odfexport/data/sender-initials.fodt | 71 +++++++++++++++++++++++
sw/qa/extras/odfexport/odfexport.cxx | 20 ++++++
xmloff/source/core/xmltoken.cxx | 2
xmloff/source/draw/ximppage.cxx | 6 +
xmloff/source/text/txtflde.cxx | 1
xmloff/source/text/txtfldi.cxx | 10 +--
xmloff/source/text/txtimp.cxx | 1
9 files changed, 109 insertions(+), 8 deletions(-)
New commits:
commit cc68977f1be22ac0f4a15eb37e05ccba13a7a554
Author: Michael Stahl <Michael.Stahl at cib.de>
Date: Tue May 8 15:01:22 2018 +0200
OFFICE-3776 xmloff: adapt ODF import to renamed text:sender-initials
ODF TC decided to rename the element to meta:creator-initials, so adapt
the import so it can read this in addition to the 2 element names
produced by current and past LO versions.
Also add a test.
Unfortunately it turned out that the ODF validator had a bug in checking
character data in foreign elements, which is triggered by the test
document, see https://issues.apache.org/jira/browse/ODFTOOLKIT-475
... so update the validator jar as well.
Change-Id: I1de1e8772b41f8937f043d9a0d150e169f25ffd4
Reviewed-on: https://gerrit.libreoffice.org/53979
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
(cherry picked from commit b09889a158cbc839ebc8a6061b0b261fa74930e6)
Reviewed-on: https://gerrit.libreoffice.org/54007
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/download.lst b/download.lst
index 55704b5a1c02..2b194a8cd40e 100644
--- a/download.lst
+++ b/download.lst
@@ -167,8 +167,8 @@ export NSS_TARBALL := nss-3.29.5-with-nspr-4.13.1.tar.gz
export ODFGEN_SHA256SUM := 2c7b21892f84a4c67546f84611eccdad6259875c971e98ddb027da66ea0ac9c2
export ODFGEN_VERSION_MICRO := 6
export ODFGEN_TARBALL := libodfgen-0.1.$(ODFGEN_VERSION_MICRO).tar.bz2
-export ODFVALIDATOR_SHA256SUM := a0bd3e0186e043223bfb231a888e2bfb06c78ee2e07c2f0eca434236d173cf34
-export ODFVALIDATOR_JAR := a084cd548b586552cb7d3ee51f1af969-odfvalidator-1.1.8-incubating-SNAPSHOT-jar-with-dependencies.jar
+export ODFVALIDATOR_SHA256SUM := 702413413a5d8076c17fe79c0808dfba145a7260020f6c8627ea529a0cf83769
+export ODFVALIDATOR_JAR := odfvalidator-1.2.0-incubating-SNAPSHOT-jar-with-dependencies+ODFTOOLKIT-460+ODFTOOLKIT-475.jar
export OFFICEOTRON_SHA256SUM := f2443f27561af52324eee03a1892d9f569adc8db9e7bca55614898bc2a13a770
export OFFICEOTRON_JAR := 8249374c274932a21846fa7629c2aa9b-officeotron-0.7.4-master.jar
export OPENCOLLADA_SHA256SUM := 8f25d429237cde289a448c82a0a830791354ccce5ee40d77535642e46367d6c4
diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 2fee08b63871..a88b5a9132a8 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -3295,6 +3295,8 @@ namespace xmloff { namespace token {
XML_ZEROS_DENOMINATOR_DIGITS,
XML_INTEGER_FRACTION_DELIMITER,
+ XML_CREATOR_INITIALS,
+
XML_TOKEN_END
};
diff --git a/sw/qa/extras/odfexport/data/sender-initials.fodt b/sw/qa/extras/odfexport/data/sender-initials.fodt
new file mode 100644
index 000000000000..b8a5c1e67055
--- /dev/null
+++ b/sw/qa/extras/odfexport/data/sender-initials.fodt
@@ -0,0 +1,71 @@
+<?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: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:oas
is: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: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.text">
+ <office:meta><meta:initial-creator>ms </meta:initial-creator><meta:creation-date>2015-08-24T21:49:45.305718699</meta:creation-date><meta:document-statistic meta:table-count="0" meta:image-count="0" meta:object-count="0" meta:page-count="1" meta:paragraph-count="0" meta:word-count="0" meta:character-count="0" meta:non-whitespace-character-count="0"/><meta:generator>LibreOfficeDev/4.3.7.2$Linux_X86_64 LibreOffice_project/8a35821d8636a03b8bf4e15b48f59794652c68ba</meta:generator></office:meta>
+ <office:font-face-decls>
+ <style:font-face style:name="Lohit Devanagari1" svg:font-family="'Lohit Devanagari'"/>
+ <style:font-face style:name="Liberation Serif" svg:font-family="'Liberation Serif'" style:font-family-generic="roman" style:font-pitch="variable"/>
+ <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="Lohit Devanagari" svg:font-family="'Lohit Devanagari'" style:font-family-generic="system" style:font-pitch="variable"/>
+ <style:font-face style:name="Source Han Sans CN Regular" svg:font-family="'Source Han Sans CN Regular'" style:font-family-generic="system" style:font-pitch="variable"/>
+ </office:font-face-decls>
+ <office:styles>
+ <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" draw:start-line-spacing-horizontal="0.283cm" draw:start-line-spacing-vertical="0.283cm" draw:end-line-spacing-horizontal="0.283cm" draw:end-line-spacing-vertical="0.283cm" style:flow-with-text="false"/>
+ <style:paragraph-properties style:text-autospace="ideograph-alpha" 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="12pt" fo:language="de" fo:country="DE" style:letter-kerning="true" style:font-name-asian="Source Han Sans CN Regular" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lohit Devanagari" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN"/>
+ </style:default-style>
+ <style:default-style style:family="paragraph">
+ <style:paragraph-properties fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="1.251cm" style:writing-mode="page"/>
+ <style:text-properties style:use-window-font-color="true" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="de" fo:country="DE" style:letter-kerning="true" style:font-name-asian="Source Han Sans CN Regular" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lohit Devanagari" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2"/>
+ </style:default-style>
+ <style:default-style style:family="table">
+ <style:table-properties table:border-model="collapsing"/>
+ </style:default-style>
+ <style:default-style style:family="table-row">
+ <style:table-row-properties fo:keep-together="auto"/>
+ </style:default-style>
+ <style:style style:name="Standard" style:family="paragraph" style:class="text"/>
+ </office:styles>
+ <office:automatic-styles>
+ <style:page-layout style:name="pm1">
+ <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:footnote-max-height="0cm">
+ <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
+ </style:page-layout-properties>
+ <style:header-style/>
+ <style:footer-style/>
+ </style:page-layout>
+
+ <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Standard">
+ <style:text-properties officeooo:rsid="000b01fe" officeooo:paragraph-rsid="000b01fe"/>
+ </style:style>
+ <style:style style:name="P2" style:family="paragraph" style:parent-style-name="Standard">
+ <style:text-properties officeooo:rsid="000b01fe" officeooo:paragraph-rsid="000b01fe"/>
+ </style:style>
+ </office:automatic-styles>
+ <office:master-styles>
+ <style:master-page style:name="Standard" style:page-layout-name="pm1"/>
+ </office:master-styles>
+ <office:body>
+ <office:text>
+
+ <!-- ODF 1.3 -->
+ <text:p text:style-name="P1"><office:annotation office:name="__Annotation__528782_647779260"><meta:creator-initials>I</meta:creator-initials><dc:date>2018-05-08T11:09:30.015915376</dc:date><text:p text:style-name="P2">bar</text:p></office:annotation>Foo<office:annotation-end office:name="__Annotation__528782_647779260"/></text:p>
+ <!-- LO extension before 2013 -->
+ <text:p text:style-name="P1"><office:annotation office:name="__Annotation__528782_647779260"><text:sender-initials>I</text:sender-initials><dc:date>2018-05-08T11:09:30.015915376</dc:date><text:p text:style-name="P2">bar</text:p></office:annotation>Foo<office:annotation-end office:name="__Annotation__528782_647779260"/></text:p>
+ <!-- LO extension since 2013 -->
+ <text:p text:style-name="P1"><office:annotation office:name="__Annotation__528782_647779260"><loext:sender-initials>I</loext:sender-initials><dc:date>2018-05-08T11:09:30.015915376</dc:date><text:p text:style-name="P2">bar</text:p></office:annotation>Foo<office:annotation-end office:name="__Annotation__528782_647779260"/></text:p>
+ <!-- ODF 1.0 -->
+ <text:p text:style-name="P1">
+ <text:sender-initials>I</text:sender-initials>
+ </text:p>
+ <!-- accidental export of loext namespace 2013-2017 -->
+ <text:p text:style-name="P1">
+ <loext:sender-initials>I</loext:sender-initials>
+ </text:p>
+
+ </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index e9e458c4a243..687714aeb2d5 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -344,6 +344,26 @@ DECLARE_ODFEXPORT_TEST(testFdo38244, "fdo38244.odt")
CPPUNIT_ASSERT_EQUAL(OUString("M"), getProperty<OUString>(xPropertySet, "Initials"));
}
+DECLARE_ODFEXPORT_TEST(testSenderInitials, "sender-initials.fodt")
+{
+ // Test sender-initial properties (both annotation metadata and text field)
+ uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
+ uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
+ // first 3 are annotations, last 2 are text fields
+ for (unsigned i = 0; i < 3; ++i)
+ {
+ uno::Reference<beans::XPropertySet> xPropertySet(xFields->nextElement(), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString("I"), getProperty<OUString>(xPropertySet, "Initials"));
+ }
+ for (unsigned i = 0; i < 2; ++i)
+ {
+ uno::Reference<beans::XPropertySet> xPropertySet(xFields->nextElement(), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xPropertySet, "IsFixed"));
+ CPPUNIT_ASSERT_EQUAL(OUString("I"), getProperty<OUString>(xPropertySet, "Content"));
+ }
+}
+
DECLARE_ODFEXPORT_TEST(testTdf92379, "tdf92379.fodt")
{
// frame style fo:background-color was not imported
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index d19c66de0a08..5867f981b82c 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -3290,6 +3290,8 @@ namespace xmloff { namespace token {
TOKEN( "zeros-denominator-digits", XML_ZEROS_DENOMINATOR_DIGITS ),
TOKEN( "integer-fraction-delimiter", XML_INTEGER_FRACTION_DELIMITER ),
+ TOKEN( "creator-initials", XML_CREATOR_INITIALS ),
+
#if OSL_DEBUG_LEVEL > 0
{ 0, nullptr, nullptr, XML_TOKEN_END }
#else
diff --git a/xmloff/source/draw/ximppage.cxx b/xmloff/source/draw/ximppage.cxx
index dcc94e696e11..1c4c93963b75 100644
--- a/xmloff/source/draw/ximppage.cxx
+++ b/xmloff/source/draw/ximppage.cxx
@@ -143,8 +143,10 @@ SvXMLImportContext * DrawAnnotationContext::CreateChildContext( sal_uInt16 nPref
else if( IsXMLToken( rLocalName, XML_DATE ) )
pContext = new XMLStringBufferImportContext(GetImport(), nPrefix, rLocalName, maDateBuffer);
}
- else if( (XML_NAMESPACE_TEXT == nPrefix || XML_NAMESPACE_LO_EXT == nPrefix) &&
- IsXMLToken(rLocalName, XML_SENDER_INITIALS) )
+ else if (((XML_NAMESPACE_TEXT == nPrefix || XML_NAMESPACE_LO_EXT == nPrefix)
+ && IsXMLToken(rLocalName, XML_SENDER_INITIALS))
+ || (XML_NAMESPACE_META == nPrefix
+ && IsXMLToken(rLocalName, XML_CREATOR_INITIALS)))
{
pContext = new XMLStringBufferImportContext(GetImport(), nPrefix, rLocalName, maInitialsBuffer);
}
diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx
index 959b2e75162b..7458f354dce6 100644
--- a/xmloff/source/text/txtflde.cxx
+++ b/xmloff/source/text/txtflde.cxx
@@ -1752,6 +1752,7 @@ void XMLTextFieldExport::ExportFieldHelper(
OUString aInitials( GetStringProperty(sPropertyInitials, rPropSet) );
if( !aInitials.isEmpty() )
{
+ // TODO: see OFFICE-3776 export meta:creator-initials for ODF 1.3
SvXMLElementExport aCreatorElem( GetExport(), XML_NAMESPACE_LO_EXT,
XML_SENDER_INITIALS, true,
false );
diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx
index 308ea75fc69e..b80fda20eb95 100644
--- a/xmloff/source/text/txtfldi.cxx
+++ b/xmloff/source/text/txtfldi.cxx
@@ -3320,11 +3320,13 @@ SvXMLImportContext* XMLAnnotationImportContext::CreateChildContext(
pContext = new XMLStringBufferImportContext(GetImport(), nPrefix,
rLocalName, aDateBuffer);
}
- else if( XML_NAMESPACE_TEXT == nPrefix || XML_NAMESPACE_LO_EXT == nPrefix )
+ else if (((XML_NAMESPACE_TEXT == nPrefix || XML_NAMESPACE_LO_EXT == nPrefix)
+ && IsXMLToken(rLocalName, XML_SENDER_INITIALS))
+ || (XML_NAMESPACE_META == nPrefix
+ && IsXMLToken(rLocalName, XML_CREATOR_INITIALS)))
{
- if( IsXMLToken( rLocalName, XML_SENDER_INITIALS ) )
- pContext = new XMLStringBufferImportContext(GetImport(), nPrefix,
- rLocalName, aInitialsBuffer);
+ pContext = new XMLStringBufferImportContext(GetImport(), nPrefix,
+ rLocalName, aInitialsBuffer);
}
if( !pContext )
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index 9fd732c98f55..816da398e2e8 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -156,6 +156,7 @@ static const SvXMLTokenMapEntry aTextPElemTokenMap[] =
// sender fields
{ XML_NAMESPACE_TEXT, XML_SENDER_FIRSTNAME,XML_TOK_TEXT_SENDER_FIRSTNAME},
{ XML_NAMESPACE_TEXT, XML_SENDER_LASTNAME, XML_TOK_TEXT_SENDER_LASTNAME },
+ // note: loext was written by accident in some LO versions, don't remove!
{ XML_NAMESPACE_LO_EXT, XML_SENDER_INITIALS, XML_TOK_TEXT_SENDER_INITIALS },
{ XML_NAMESPACE_TEXT, XML_SENDER_INITIALS, XML_TOK_TEXT_SENDER_INITIALS },
{ XML_NAMESPACE_TEXT, XML_SENDER_TITLE, XML_TOK_TEXT_SENDER_TITLE },
More information about the Libreoffice-commits
mailing list