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

Miklos Vajna vmiklos at collabora.co.uk
Tue May 16 08:06:13 UTC 2017


 sw/qa/extras/rtfimport/data/tdf106953.rtf       |   23 +++++++++++++++++++++++
 sw/qa/extras/rtfimport/rtfimport.cxx            |    9 +++++++++
 writerfilter/source/rtftok/rtfdispatchvalue.cxx |    2 +-
 writerfilter/source/rtftok/rtfsprm.cxx          |    9 +++++++--
 4 files changed, 40 insertions(+), 3 deletions(-)

New commits:
commit f528f9499bd91b700c549575e88fa102cfffede9
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue May 16 08:34:40 2017 +0200

    tdf#106953 RTF import: fix missing paragraph left margin
    
    See commit 3915bf2dc877d5f1140798e24933db0f21386a4a (tdf#95376 DOCX
    import: fix incorrectly indented tab stops, 2016-01-26) for the various
    sources that can determine the paragraph indentation.
    
    In this case the problem was that too aggressive RTF style deduplication
    removed a direct indent, which then meant a fallback to the ind-from-num
    value, not to the ind-from-parastyle one.
    
    Change-Id: I3b47b2bbeaaedf405baef24505d23dc49bd01865
    Reviewed-on: https://gerrit.libreoffice.org/37660
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/sw/qa/extras/rtfimport/data/tdf106953.rtf b/sw/qa/extras/rtfimport/data/tdf106953.rtf
new file mode 100644
index 000000000000..398f9df78dcf
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf106953.rtf
@@ -0,0 +1,23 @@
+{\rtf \ansi \ansicpg0 \deff0 \stshfdbch1 \stshfloch0 \stshfhich0 \deflang1033 \deflangfe1033
+{\stylesheet
+{\s19 \li720
+style;
+}
+}
+{\*\listtable
+{\list
+{\listlevel \levelnfc0 \levelnfcn0 \leveljc0 \leveljcn0 \levelstartat1 \levelfollow0 \levelspace0 \levelindent0 \levellegal0 \levelnorestart0
+{\leveltext\'02\'00.;
+}
+{\levelnumbers \'01
+{\uc1 \u59 ?}
+}
+\li720 \fi-360 }
+\listid697112958 }
+}
+{\*\listoverridetable
+{\listoverride \listid697112958 \listoverridecount0 \ls1 }
+}
+\pard \plain \s19 \fi-360 \li720 \ls1
+{hello\par }
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 91625bb5bb28..8cefb3af2cfa 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1333,6 +1333,15 @@ DECLARE_RTFIMPORT_TEST(testN825305, "n825305.rtf")
     CPPUNIT_ASSERT_EQUAL(beans::PropertyState_DIRECT_VALUE, ePropertyState);
 }
 
+DECLARE_RTFIMPORT_TEST(testTdf106953, "tdf106953.rtf")
+{
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1270), getProperty<sal_Int32>(getParagraph(1), "ParaLeftMargin"));
+    uno::Reference<beans::XPropertyState> xPropertyState(getParagraph(1), uno::UNO_QUERY);
+    beans::PropertyState ePropertyState = xPropertyState->getPropertyState("ParaLeftMargin");
+    // Was beans::PropertyState_DEFAULT_VALUE.
+    CPPUNIT_ASSERT_EQUAL(beans::PropertyState_DIRECT_VALUE, ePropertyState);
+}
+
 DECLARE_RTFIMPORT_TEST(testParaBottomMargin, "para-bottom-margin.rtf")
 {
     uno::Reference<beans::XPropertySet> xPropertySet(getStyles("ParagraphStyles")->getByName("Standard"), uno::UNO_QUERY);
diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
index bba6d4d29c83..527d39da68db 100644
--- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
@@ -628,7 +628,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
         if (m_aStates.top().eDestination == Destination::LISTOVERRIDEENTRY)
             m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_AbstractNum_nsid, pIntValue);
         else
-            putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_tabs, NS_ooxml::LN_CT_NumPr_numId, pIntValue);
+            putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_numPr, NS_ooxml::LN_CT_NumPr_numId, pIntValue);
     }
     break;
     case RTF_UC:
diff --git a/writerfilter/source/rtftok/rtfsprm.cxx b/writerfilter/source/rtftok/rtfsprm.cxx
index 3f4f6659d2e8..2304fa826044 100644
--- a/writerfilter/source/rtftok/rtfsprm.cxx
+++ b/writerfilter/source/rtftok/rtfsprm.cxx
@@ -158,11 +158,16 @@ static bool isSPRMDeduplicateBlacklist(Id nId)
 {
     switch (nId)
     {
+    // See the NS_ooxml::LN_CT_PPrBase_tabs handler in DomainMapper,
+    // deduplication is explicitly not wanted for these tokens.
     case NS_ooxml::LN_CT_TabStop_val:
     case NS_ooxml::LN_CT_TabStop_leader:
     case NS_ooxml::LN_CT_TabStop_pos:
-        // See the NS_ooxml::LN_CT_PPrBase_tabs handler in DomainMapper,
-        // deduplication is explicitly not wanted for these tokens.
+    // Erasing these just because they equal to the style one is
+    // problematic, as then the used value won't be from the style, but
+    // possibly from the numbering.
+    case NS_ooxml::LN_CT_Ind_left:
+    case NS_ooxml::LN_CT_Ind_right:
         return true;
 
     default:


More information about the Libreoffice-commits mailing list