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

Michael Stahl mstahl at redhat.com
Tue Jul 29 05:29:42 PDT 2014


 sw/qa/extras/rtfimport/data/fdo81033.rtf     |   12 ++++++++++++
 sw/qa/extras/rtfimport/rtfimport.cxx         |   14 ++++++++++++++
 writerfilter/source/dmapper/DomainMapper.cxx |    5 ++++-
 3 files changed, 30 insertions(+), 1 deletion(-)

New commits:
commit 5dcf8fd9634c4d446bec3471b1fe0b43b61ed061
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Jul 28 17:57:53 2014 +0200

    fdo#81033: writerfilter: RTF import: fix tab stop inheritance from style
    
    For RTF, the tab stops that are set directly on the paragraph are the
    tab stops the paragraph has effectively; there is no equivalent of OOXML
    <w:tab w:val="clear" w:pos="4536"/> that would override a tab stop of
    the applied style; that is done by simply omitting the tab stop.
    
    It would perhaps be possible to implement something to synthesize a
    NS_ooxml::LN_Value_ST_TabJc_clear in the RTF tokenizer for this case,
    but it's simpler to just generally disable domain mapper's
    InitTabStopFromStyle() for RTF.
    
    Change-Id: I7b0581be8db19ffda81c8d1da290abf0a0f69529
    (cherry picked from commit 7f6e26917d4aa682ed9c422c83b1df20d78177d2)
    Reviewed-on: https://gerrit.libreoffice.org/10596
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/qa/extras/rtfimport/data/fdo81033.rtf b/sw/qa/extras/rtfimport/data/fdo81033.rtf
new file mode 100644
index 0000000..500aeb7
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo81033.rtf
@@ -0,0 +1,12 @@
+{\rtf1
+{\stylesheet
+{\s15\ql \tqc\tx4536\tqr\tx9072 header;}
+}
+
+\deftab709
+\pard\plain \s15\ql \tx3293\tlul\tx9072
+\tab
+\tab
+
+\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 7e5bd67..5a47fb7 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1325,6 +1325,20 @@ DECLARE_RTFIMPORT_TEST(testGroupshape_notext, "groupshape-notext.rtf")
     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xGroupshape->getCount());
 }
 
+DECLARE_RTFIMPORT_TEST(testFdo81033, "fdo81033.rtf")
+{
+    // Number of tabstops in the paragraph should be 2, was 3.
+    uno::Sequence<style::TabStop> tabs(
+        getProperty< uno::Sequence<style::TabStop> >(getParagraph(1), "ParaTabStops"));
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(2), tabs.getLength());
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(5808), tabs[0].Position);
+    CPPUNIT_ASSERT_EQUAL(style::TabAlign_LEFT, tabs[0].Alignment);
+    CPPUNIT_ASSERT_EQUAL(sal_Unicode(0), tabs[0].FillChar);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(16002), tabs[1].Position);
+    CPPUNIT_ASSERT_EQUAL(style::TabAlign_LEFT, tabs[1].Alignment);
+    CPPUNIT_ASSERT_EQUAL(sal_Unicode('_'), tabs[1].FillChar);
+}
+
 DECLARE_RTFIMPORT_TEST(testFdo66565, "fdo66565.rtf")
 {
     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index b854738..215bbaf 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1688,7 +1688,10 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext )
     case NS_ooxml::LN_CT_PPrBase_tabs:
     {
         // Initialize tab stop vector from style sheet
-        if( !m_pImpl->IsStyleSheetImport() )
+        // fdo#81033: for RTF, a tab stop is inherited from the style if it
+        // is also applied to the paragraph directly, and cleared if it is
+        // not applied to the paragraph directly => don't InitTabStopFromStyle
+        if (!m_pImpl->IsStyleSheetImport() && !IsRTFImport())
         {
             uno::Any aValue = m_pImpl->GetPropertyFromStyleSheet(PROP_PARA_TAB_STOPS);
             uno::Sequence< style::TabStop > aStyleTabStops;


More information about the Libreoffice-commits mailing list