[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source

Michael Stahl mstahl at redhat.com
Fri Aug 1 02:07:07 PDT 2014


 sw/qa/extras/rtfimport/rtfimport.cxx           |   13 +++++++++++++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   25 +++++++++++++++++++++++++
 2 files changed, 38 insertions(+)

New commits:
commit 008d1187a9f3b36d6cbf31742632d237afecf1bd
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Aug 1 10:47:49 2014 +0200

    fdo#81893: writerfilter: RTF import: \qc before \page was lost
    
    The paragraph properties need to be applied to the paragraph following
    the \page too, which did not happen in this case.
    
    Also the minimized test doc shows that checkNeedPap() must be preceded
    by checkFirstRun(), since there is no run preceding the \page.
    
    (regression from 94765a1b3f543b3b60f8c1de05048d12f2576be4)
    
    Change-Id: Id286c4fbdeee688fa4f6b24063b634bac637eab6

diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 5c033c2..dd4367a 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -343,6 +343,10 @@ DECLARE_RTFIMPORT_TEST(testFdo81892, "fdo81892.rtf")
     uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
     uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
     CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER, getProperty<sal_Int16>(xTable, "HoriOrient"));
+
+    // fdo#81893: paragraph with \page was not centered
+    uno::Reference<text::XTextRange> xPara(getParagraph(2, "Performance"));
+    CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(xPara, "ParaAdjust")));
 }
 
 DECLARE_RTFIMPORT_TEST(testFdo45394, "fdo45394.rtf")
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 61398ea..de0bdaa 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2291,11 +2291,15 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
         }
         else
         {
+            checkFirstRun();
             checkNeedPap();
             sal_uInt8 sBreak[] = { 0xc };
             Mapper().text(sBreak, 1);
             if (!m_bNeedPap)
+            {
                 parBreak();
+                m_bNeedPap = true;
+            }
             m_bNeedCr = true;
         }
     }
commit df041e468baf604f6e2606e5b632aa654b19a65d
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Aug 1 10:44:00 2014 +0200

    fdo#81892: writerfilter: RTF import: add support for table row alignment
    
    These keywords were simply not implemented.
    
    Change-Id: Ib4d07a4b2dfb07cfd56a4ee07d7c14d1c59323f9

diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index bb9cbb4..5c033c2 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -336,6 +336,15 @@ DECLARE_RTFIMPORT_TEST(testFdo46955, "fdo46955.rtf")
     }
 }
 
+DECLARE_RTFIMPORT_TEST(testFdo81892, "fdo81892.rtf")
+{
+    // table was not centered
+    uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
+    uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER, getProperty<sal_Int16>(xTable, "HoriOrient"));
+}
+
 DECLARE_RTFIMPORT_TEST(testFdo45394, "fdo45394.rtf")
 {
     uno::Reference<text::XText> xHeaderText = getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName(DEFAULT_STYLE), "HeaderText");
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 3bba4c4..61398ea 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2683,6 +2683,27 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
         return 0;
     }
 
+    switch (nKeyword)
+    {
+    case RTF_TRQL:
+        nParam = 0;
+        break;
+    case RTF_TRQC:
+        nParam = 1;
+        break;
+    case RTF_TRQR:
+        nParam = 2;
+        break;
+    default:
+        break;
+    }
+    if (nParam >= 0)
+    {
+        RTFValue::Pointer_t const pValue(new RTFValue(nParam));
+        m_aStates.top().aTableRowSprms.set(NS_ooxml::LN_CT_TrPrBase_jc, pValue);
+        return 0;
+    }
+
     // Cell Text Flow
     switch (nKeyword)
     {


More information about the Libreoffice-commits mailing list