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

Miklos Vajna vmiklos at suse.cz
Thu Jul 25 01:12:49 PDT 2013


 sw/qa/extras/ooxmlexport/data/fdo60990.odt   |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx     |   15 +++++++++++++++
 sw/source/filter/ww8/docxattributeoutput.cxx |   16 ++++++++++++++--
 3 files changed, 29 insertions(+), 2 deletions(-)

New commits:
commit 6d67b812403e1c22ee09b70dddf6b2ac13e73b58
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Wed Jul 24 16:15:51 2013 +0200

    fdo#60990 VML export: handle paragraph/run properties of shape text
    
    (cherry picked from commits 1753c4f9f1713ca4a9a1ac3a145269c850eef6fb,
    0ffed545adbb8a27a024d4d6a74dcaa8a87ba66a and
    94b3ec0597ee21b933d02496402ff0f3a416e6a3)
    
    Change-Id: Iaeb7f9826308ea94a036cb4bfa87bf65f0cfe22f
    Reviewed-on: https://gerrit.libreoffice.org/5094
    Reviewed-by: Fridrich Strba <fridrich at documentfoundation.org>
    Tested-by: Fridrich Strba <fridrich at documentfoundation.org>

diff --git a/sw/qa/extras/ooxmlexport/data/fdo60990.odt b/sw/qa/extras/ooxmlexport/data/fdo60990.odt
new file mode 100644
index 0000000..c855f32
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo60990.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 4a58bf1..2ed291f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -72,6 +72,7 @@ public:
     void testI120928();
     void testN822175();
     void testFdo58577();
+    void testFdo60990();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -121,6 +122,7 @@ void Test::run()
         {"i120928.docx", &Test::testI120928},
         {"n822175.odt", &Test::testN822175},
         {"fdo58577.odt", &Test::testFdo58577},
+        {"fdo60990.odt", &Test::testFdo60990},
     };
     // Don't test the first import of these, for some reason those tests fail
     const char* aBlacklist[] = {
@@ -694,6 +696,19 @@ void Test::testFdo58577()
     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
 }
 
+void Test::testFdo60990()
+{
+    // The shape had no background, no paragraph adjust and no font color.
+    uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> xShape(xDraws->getByIndex(0), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(0x00CFE7F5), getProperty<sal_Int32>(xShape, "BackColor"));
+    uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xShape, uno::UNO_QUERY)->getText();
+    uno::Reference<text::XTextRange> xParagraph = getParagraphOfText(1, xText);
+    CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(xParagraph, "ParaAdjust")));
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(0x00FF00), getProperty<sal_Int32>(getRun(xParagraph, 1), "CharColor"));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 153580c..08d79f0 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2635,7 +2635,7 @@ void DocxAttributeOutput::WriteOutliner(const OutlinerParaObject& rParaObj)
 
     sal_Int32 nPara = rEditObj.GetParagraphCount();
 
-    m_pSerializer->startElementNS( XML_w, XML_textbox, FSEND );
+    m_pSerializer->startElementNS( XML_v, XML_textbox, FSEND );
     m_pSerializer->startElementNS( XML_w, XML_txbxContent, FSEND );
     for (sal_Int32 n = 0; n < nPara; ++n)
     {
@@ -2647,12 +2647,24 @@ void DocxAttributeOutput::WriteOutliner(const OutlinerParaObject& rParaObj)
         xub_StrLen nEnd = aStr.Len();
 
         m_pSerializer->startElementNS( XML_w, XML_p, FSEND );
+
+        // Write paragraph properties.
+        m_pSerializer->startElementNS(XML_w, XML_pPr, FSEND);
+        aAttrIter.OutParaAttr(false);
+        m_pSerializer->endElementNS(XML_w, XML_pPr);
+
         do {
             xub_StrLen nNextAttr = aAttrIter.WhereNext();
             if( nNextAttr > nEnd )
                 nNextAttr = nEnd;
 
             m_pSerializer->startElementNS( XML_w, XML_r, FSEND );
+
+            // Write run properties.
+            m_pSerializer->startElementNS(XML_w, XML_rPr, FSEND);
+            aAttrIter.OutAttr(nAktPos);
+            m_pSerializer->endElementNS(XML_w, XML_rPr);
+
             bool bTxtAtr = aAttrIter.IsTxtAttr( nAktPos );
             if( !bTxtAtr )
             {
@@ -2669,7 +2681,7 @@ void DocxAttributeOutput::WriteOutliner(const OutlinerParaObject& rParaObj)
         m_pSerializer->endElementNS( XML_w, XML_p );
     }
     m_pSerializer->endElementNS( XML_w, XML_txbxContent );
-    m_pSerializer->endElementNS( XML_w, XML_textbox );
+    m_pSerializer->endElementNS( XML_v, XML_textbox );
 }
 
 oox::drawingml::DrawingML& DocxAttributeOutput::GetDrawingML()


More information about the Libreoffice-commits mailing list