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/sdxmlexp.cxx | 1 xmloff/source/draw/ximppage.cxx | 6 + xmloff/source/text/txtflde.cxx | 1 xmloff/source/text/txtfldi.cxx | 10 +-- xmloff/source/text/txtimp.cxx | 1 10 files changed, 110 insertions(+), 8 deletions(-)
New commits: commit b09889a158cbc839ebc8a6061b0b261fa74930e6 Author: Michael Stahl <michael.st...@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 <c...@libreoffice.org> Reviewed-by: Michael Stahl <michael.st...@cib.de> diff --git a/download.lst b/download.lst index 5f87d7a203db..3e4bbe2b72ff 100644 --- a/download.lst +++ b/download.lst @@ -186,8 +186,8 @@ export NSS_TARBALL := nss-3.33-with-nspr-4.17.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 := aa8896eef3adbd6b54d4ec1817c1bc3871cce99120faf26f93502077480233cf -export ODFVALIDATOR_JAR := odfvalidator-1.2.0-incubating-SNAPSHOT-jar-with-dependencies+ODFTOOLKIT-460+ODFTOOLKIT-461.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 OPENLDAP_SHA256SUM := cdd6cffdebcd95161a73305ec13fc7a78e9707b46ca9f84fb897cd5626df3824 diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx index b741dc43ac9b..6ab3cdd217f5 100644 --- a/include/xmloff/xmltoken.hxx +++ b/include/xmloff/xmltoken.hxx @@ -3314,6 +3314,8 @@ namespace xmloff { namespace token { XML_NEWLINE, + 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 375d7ed04958..00e2081341f0 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -461,6 +461,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 7566c1065119..019c0bb19308 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -3306,6 +3306,8 @@ namespace xmloff { namespace token { // for optional language-dependent reference formats TOKEN( "reference-language", XML_REFERENCE_LANGUAGE ), TOKEN( "newline", XML_NEWLINE ), + TOKEN( "creator-initials", XML_CREATOR_INITIALS ), + #if OSL_DEBUG_LEVEL > 0 { 0, nullptr, nullptr, XML_TOKEN_END } #else diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx index 1a2a3434fee7..36c8ca93f117 100644 --- a/xmloff/source/draw/sdxmlexp.cxx +++ b/xmloff/source/draw/sdxmlexp.cxx @@ -2623,6 +2623,7 @@ void SdXMLExport::exportAnnotations( const Reference<XDrawPage>& xDrawPage ) OUString aInitials( xAnnotation->getInitials() ); if( !aInitials.isEmpty() ) { + // TODO: see OFFICE-3776 export meta:creator-initials for ODF 1.3 SvXMLElementExport aInitialsElem( *this, XML_NAMESPACE_LO_EXT, XML_SENDER_INITIALS, true, false ); Characters(aInitials); diff --git a/xmloff/source/draw/ximppage.cxx b/xmloff/source/draw/ximppage.cxx index 0b670fb0e083..2bfb61072352 100644 --- a/xmloff/source/draw/ximppage.cxx +++ b/xmloff/source/draw/ximppage.cxx @@ -143,8 +143,10 @@ SvXMLImportContextRef DrawAnnotationContext::CreateChildContext( sal_uInt16 nPre else if( IsXMLToken( rLocalName, XML_DATE ) ) xContext = 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))) { xContext = new XMLStringBufferImportContext(GetImport(), nPrefix, rLocalName, maInitialsBuffer); } diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx index 26c261d24e65..4382a95a38bf 100644 --- a/xmloff/source/text/txtflde.cxx +++ b/xmloff/source/text/txtflde.cxx @@ -1770,6 +1770,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 fd20df679564..017f0fe40e21 100644 --- a/xmloff/source/text/txtfldi.cxx +++ b/xmloff/source/text/txtfldi.cxx @@ -3318,11 +3318,13 @@ SvXMLImportContextRef 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 c8abe9651736..7dadde85e2a2 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 }, _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits