sw/qa/extras/ooxmlimport/data/tdf95376.docx  |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx     |    9 +++++++++
 writerfilter/source/dmapper/DomainMapper.cxx |    8 ++++++++
 3 files changed, 17 insertions(+)

New commits:
commit 8b4fe8bfb739d60fe53ee6f3e8366225a7d15a67
Author: Miklos Vajna <vmik...@collabora.co.uk>
Date:   Tue Jan 26 13:21:28 2016 +0100

    tdf#95376 DOCX import: fix incorrectly indented tab stops
    
    Regression from commit f4badd9a485f32f787d78431ed673e2932973887
    (tdf#92454 DOCX import: allow overriding para prop from num style in
    para style, 2015-09-22), the problem was yet another priority
    mishandling in the maze of various styles and indentation handling.
    
    In the tdf#92454 bugdoc, both a numbering-from-paragraph-style and a
    paragraph-style defined indentation, and Word preferred the numbering,
    while Writer preferred the paragraph style, that's why the import-time
    conversion was added.
    
    However, it turns out there is a 3rd source that's still not direct
    indentation formatting: a direct numbering. So the correct priority is:
    
    direct-ind > ind-from-num > ind-from-parastyle > ind-from-num-from-parastyle
    
    Which means in this case the indentation should not be set directly: the
    two conflicting value (ind-from-num and ind-from-parastyle) will be
    resolved correctly by Writer core.
    
    Given that we always first get the para style info, and only then the
    numbering, we just need to undo the conversion added for the other bug
    if we see a direct numbering, then both the old bugdoc and this new one
    will be handled properly.
    
    Change-Id: I09cc84605d5df6159da985ad069d46b580a53358
    (cherry picked from commit 3915bf2dc877d5f1140798e24933db0f21386a4a)
    Reviewed-on: https://gerrit.libreoffice.org/22307
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sw/qa/extras/ooxmlimport/data/tdf95376.docx 
b/sw/qa/extras/ooxmlimport/data/tdf95376.docx
new file mode 100644
index 0000000..9bd2d05
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf95376.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index b2c48e7..9ca419c 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -2862,6 +2862,15 @@ DECLARE_OOXMLIMPORT_TEST(testTdf92454, "tdf92454.docx")
     CPPUNIT_ASSERT_EQUAL(beans::PropertyState_DIRECT_VALUE, 
xParagraph->getPropertyState("ParaFirstLineIndent"));
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf95376, "tdf95376.docx")
+{
+    uno::Reference<beans::XPropertyState> xParagraph(getParagraph(2), 
uno::UNO_QUERY);
+    // This was beans::PropertyState_DIRECT_VALUE: indentation-from-numbering
+    // did not have priority over indentation-from-paragraph-style, due to a
+    // filter workaround that's not correct here.
+    CPPUNIT_ASSERT_EQUAL(beans::PropertyState_DEFAULT_VALUE, 
xParagraph->getPropertyState("ParaFirstLineIndent"));
+}
+
 DECLARE_OOXMLIMPORT_TEST(testTdf92124, "tdf92124.docx")
 {
     // Get the second paragraph's numbering style's 1st level's suffix.
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index bcf0a44..e350e2d 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1193,6 +1193,14 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, 
PropertyMapPtr rContext )
                     rContext->Insert( PROP_NUMBERING_RULES, aRules );
                     // erase numbering from pStyle if already set
                     rContext->Erase(PROP_NUMBERING_STYLE_NAME);
+
+                    // Indentation can came from:
+                    // 1) Paragraph style's numbering's indentation: the 
current non-style numId has priority over it.
+                    // 2) Numbering's indentation: Writer handles that 
natively, so it should not be set on rContext.
+                    // 3) Paragraph style's indentation: ditto.
+                    // 4) Direct paragraph formatting: that will came later.
+                    // So no situation where keeping indentation at this point 
would make sense -> erase.
+                    rContext->Erase(PROP_PARA_FIRST_LINE_INDENT);
                 }
             }
             else
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to