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

Miklos Vajna vmiklos at collabora.co.uk
Thu Aug 24 09:58:06 UTC 2017


 sw/qa/extras/rtfimport/data/tdf108943.rtf       |   24 ++++++++++++++++++++++++
 sw/qa/extras/rtfimport/rtfimport.cxx            |   19 +++++++++++++++++++
 writerfilter/source/rtftok/rtfdispatchvalue.cxx |    5 ++++-
 3 files changed, 47 insertions(+), 1 deletion(-)

New commits:
commit e6426cc1bf174a67828f3e18ab1ea70eccc44b07
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Aug 23 09:04:43 2017 +0200

    tdf#108943 RTF import: handle \tx inside a list level definition
    
    \tx in the list level definition has a different meaning (we should map
    it to the ListtabStopPosition UNO property), compared to when it's used
    as a plain text property.
    
    (cherry picked from commit 57d535302596a62be914bee49d7b1df1fc622a65)
    
    Conflicts:
            sw/qa/extras/rtfimport/rtfimport.cxx
    
    Change-Id: I7b98ae3d82bbd2c4ad41d0d7f4ad50525c4d0f9a
    Reviewed-on: https://gerrit.libreoffice.org/41457
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sw/qa/extras/rtfimport/data/tdf108943.rtf b/sw/qa/extras/rtfimport/data/tdf108943.rtf
new file mode 100644
index 000000000000..478d101f4167
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf108943.rtf
@@ -0,0 +1,24 @@
+{\rtf1
+{\fonttbl
+{\f0\fbidi \froman\fcharset238\fprq2 Times New Roman;}
+}
+\noqfpromote
+{\stylesheet
+{\s25 \fi-720\li720\ri0\ls1 ParaLevel1;}
+}
+{\*\listtable
+{\list\listtemplateid-1762123600
+{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0
+\levelfollow0\levelstartat1\levelspace0\levelindent0
+{\leveltext\'02\'00.;}
+{\levelnumbers\'01;}
+\rtlch\fcs1 \af0 \ltrch\fcs0 \b0\i0\ulnone\fbias0 \s25\fi-720\li720\jclisttab\tx720\lin720 }
+\listid1977027487}
+}
+{\*\listoverridetable
+{\listoverride\listid1977027487\listoverridecount0\ls1}
+}
+\pard\plain \s25 \fi-720\li720\ri0\tqr\tx720\ls1
+hello
+\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index bf8188db99d6..f7f2e89d70a3 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -235,6 +235,25 @@ DECLARE_RTFIMPORT_TEST(testFdo45187, "fdo45187.rtf")
     CPPUNIT_ASSERT_EQUAL(sal_Int16(1), xTextRangeCompare->compareRegionStarts(xAnchor0, xAnchor1));
 }
 
+DECLARE_RTFIMPORT_TEST(testTdf108943, "tdf108943.rtf")
+{
+    uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY);
+    uno::Sequence<beans::PropertyValue> aProps;
+    xLevels->getByIndex(0) >>= aProps; // 1st level
+
+    sal_Int32 nListtabStopPosition = 0;
+    for (int i = 0; i < aProps.getLength(); ++i)
+    {
+        const beans::PropertyValue& rProp = aProps[i];
+
+        if (rProp.Name == "ListtabStopPosition")
+            nListtabStopPosition = rProp.Value.get<sal_Int32>();
+    }
+    // This was 0, \tx was handled in paragraphs only (and not in list definitions).
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1270), nListtabStopPosition);
+}
+
 DECLARE_RTFIMPORT_TEST(testFdo46662, "fdo46662.rtf")
 {
     uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WWNum3"), uno::UNO_QUERY);
diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
index 527d39da68db..f6a243e2fbc0 100644
--- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
@@ -605,7 +605,10 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
     {
         m_aStates.top().aTabAttributes.set(NS_ooxml::LN_CT_TabStop_pos, pIntValue);
         auto pValue = std::make_shared<RTFValue>(m_aStates.top().aTabAttributes);
-        putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_tabs, NS_ooxml::LN_CT_Tabs_tab, pValue);
+        if (m_aStates.top().eDestination == Destination::LISTLEVEL)
+            putNestedSprm(m_aStates.top().aTableSprms, NS_ooxml::LN_CT_PPrBase_tabs, NS_ooxml::LN_CT_Tabs_tab, pValue);
+        else
+            putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_tabs, NS_ooxml::LN_CT_Tabs_tab, pValue);
         m_aStates.top().aTabAttributes.clear();
     }
     break;


More information about the Libreoffice-commits mailing list