[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - sw/qa sw/source

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Mon Feb 10 15:18:51 UTC 2020


 sw/qa/extras/ooxmlexport/data/field-rotated.fodt |   44 +++++++++++++++++++++++
 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx        |   12 ++++++
 sw/source/filter/ww8/docxattributeoutput.cxx     |   27 +-------------
 3 files changed, 59 insertions(+), 24 deletions(-)

New commits:
commit edde4a76a66fb897c8fb49e72258dc8707b90788
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Feb 7 14:37:59 2020 +0100
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Mon Feb 10 16:18:20 2020 +0100

    sw: DOCX export: fix rotated text fields
    
    The rotation works in RTF export and DOC export, but not DOCX.
    
    If a text field is rotated via SvxCharRotateItem, the w:eastAsianLayout
    element gets written on the run that contains the fldChar begin,
    but not the subsequent 4 runs that are written via
    DoWriteFieldRunProperties(), because it doesn't write
    m_pEastAsianLayoutAttrList.
    
    It's not clear why that function manually writes a subset of the run
    properties instead of simply calling WriteCollectedRunProperties()
    to get all of them.
    
    Change-Id: I6d8cacda4b62a6f6fdc77885149e7de8666e7200
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88196
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>
    (cherry picked from commit 24ae47e808f471d1ad2d019d50cc1c2a47762dbf)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88301
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/sw/qa/extras/ooxmlexport/data/field-rotated.fodt b/sw/qa/extras/ooxmlexport/data/field-rotated.fodt
new file mode 100644
index 000000000000..079f35dfb98f
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/field-rotated.fodt
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<office:document xmlns:officeooo="http://openoffice.org/2009/office" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:ooo="http://openoffice.org/2004/office" xmlns:loext="urn:org:documentfoundation:names:experimenta
 l:office:xmlns:loext:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" 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
 :tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text">
+ <office:meta><meta:creation-date>2020-02-07T13:06:45.869388502</meta:creation-date><meta:editing-cycles>1</meta:editing-cycles><meta:editing-duration>PT1M18S</meta:editing-duration><dc:title>Rotationeering</dc:title><dc:date>2020-02-07T13:08:03.244415357</dc:date><meta:document-statistic meta:table-count="0" meta:image-count="0" meta:object-count="0" meta:page-count="1" meta:paragraph-count="1" meta:word-count="1" meta:character-count="14" meta:non-whitespace-character-count="14"/><meta:generator>LibreOfficeDev/7.0.0.0.alpha0$Linux_X86_64 LibreOffice_project/d2eff4b08869dd15b025c5801896e0332b14ba59</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="Calibri" svg:font-family="Calibri" style:font-family-generic="swiss"/>
+  <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" svg:font-family="'Source Han Sans CN'" style:font-family-generic="system" style:font-pitch="variable"/>
+  <style:font-face style:name="Source Han Serif CN" svg:font-family="'Source Han Serif CN'" style:font-family-generic="system" style:font-pitch="variable"/>
+ </office:font-face-decls>
+ <office:styles>
+
+  <style:default-style style:family="paragraph">
+   <style:paragraph-properties fo:orphans="2" fo:widows="2" 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" loext:opacity="0%" style:font-name="Calibri" fo:font-size="12pt" fo:language="de" fo:country="DE" style:letter-kerning="true" style:font-name-asian="Source Han Serif CN" 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" loext:hyphenation-no-caps="false"/>
+  </style:default-style>
+
+  <style:style style:name="Standard" style:family="paragraph" style:class="text"/>
+
+ </office:styles>
+ <office:automatic-styles>
+  <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Standard">
+   <style:text-properties style:text-rotation-angle="90" style:text-rotation-scale="line-height"/>
+  </style:style>
+  <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>
+ </office:automatic-styles>
+ <office:master-styles>
+  <style:master-page style:name="Standard" style:page-layout-name="pm1"/>
+ </office:master-styles>
+ <office:body>
+  <office:text>
+   <text:p text:style-name="P1"><text:title>Rotationeering</text:title></text:p>
+  </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index 67e07639b284..9dfd7da47ecf 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -12,6 +12,7 @@
 #include <com/sun/star/text/XDocumentIndex.hpp>
 #include <com/sun/star/text/XDocumentIndexesSupplier.hpp>
 #include <com/sun/star/text/XFootnote.hpp>
+#include <com/sun/star/text/XTextField.hpp>
 #include <com/sun/star/text/XTextTable.hpp>
 #include <com/sun/star/style/LineSpacing.hpp>
 #include <com/sun/star/style/LineSpacingMode.hpp>
@@ -320,6 +321,17 @@ DECLARE_OOXMLEXPORT_TEST(testFDO77725, "fdo77725.docx")
     assertXPath(pXmlFootnotes, "//w:footnotes[1]/w:footnote[3]/w:p[3]/w:r[1]/w:br[3]", 0);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testFieldRotation, "field-rotated.fodt")
+{
+    uno::Reference<text::XTextRange> const xRun(getRun(uno::Reference<text::XTextRange>(getParagraphOrTable(1), uno::UNO_QUERY), 1));
+    uno::Reference<text::XTextField> const xField(getProperty<uno::Reference<text::XTextField>>(xRun, "TextField"));
+    CPPUNIT_ASSERT(xField.is());
+    CPPUNIT_ASSERT_EQUAL(OUString("DocInformation:Title"), xField->getPresentation(true));
+    CPPUNIT_ASSERT_EQUAL(OUString("Rotationeering"), xField->getPresentation(false));
+    // problem was that the rotation wasn't applied to all runs of the field
+    CPPUNIT_ASSERT_EQUAL(sal_Int16(900), getProperty<sal_Int16>(xRun, "CharRotation"));
+}
+
 DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFootnoteSeparator, "footnotesep.fodt")
 {
     // foontote separator definitions - taken from default page style
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 35249c34e4f2..776364d81266 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2164,35 +2164,14 @@ void DocxAttributeOutput::DoWriteFieldRunProperties( const SwTextNode * pNode, s
             m_pSerializer->singleElementNS(XML_w, XML_webHidden);
         }
 
-        // 2. output color
-        if ( m_pColorAttrList.is() )
-        {
-            XFastAttributeListRef xAttrList( m_pColorAttrList.get() );
-            m_pColorAttrList.clear();
-
-            m_pSerializer->singleElementNS( XML_w, XML_color, xAttrList );
-        }
-
-        // 3. output all other character properties
+        // 2. find all active character properties
         SwWW8AttrIter aAttrIt( m_rExport, *pNode );
         aAttrIt.OutAttr( nPos, bWriteCombChars );
 
-        // 4. explicitly write the font-properties, to ensure all runs in the field have them
-        // see tdf#66401
-        if ( m_pFontsAttrList.is() )
-        {
-            XFastAttributeListRef xAttrList( m_pFontsAttrList.get() );
-            m_pFontsAttrList.clear();
-
-            m_pSerializer->singleElementNS( XML_w, XML_rFonts, xAttrList );
-        }
+        // 3. write the character properties
+        WriteCollectedRunProperties();
 
         m_pSerializer->endElementNS( XML_w, XML_rPr );
-
-        // During SwWW8AttrIter::OutAttr() call the new value of the text color could be set into [m_pColorAttrList].
-        // But we do not need to keep it any more and should clean up,
-        // While the next run could define a new color that is different to current one.
-        m_pColorAttrList.clear();
     }
 
     m_bPreventDoubleFieldsHandling = false;


More information about the Libreoffice-commits mailing list