summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-07-28 17:57:53 +0200
committerMichael Stahl <mstahl@redhat.com>2014-07-28 18:24:31 +0200
commit7f6e26917d4aa682ed9c422c83b1df20d78177d2 (patch)
tree6d37780768edabcab4901465747cd655728c7b7c
parent29813244afafa1721feb63dfeb055594053ce3f7 (diff)
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
-rw-r--r--sw/qa/extras/rtfimport/data/fdo81033.rtf12
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx14
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx5
3 files changed, 30 insertions, 1 deletions
diff --git a/sw/qa/extras/rtfimport/data/fdo81033.rtf b/sw/qa/extras/rtfimport/data/fdo81033.rtf
new file mode 100644
index 000000000000..500aeb7b799a
--- /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 f7763b3c6f2a..f72c331f339c 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1380,6 +1380,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 a6c71b16729a..7e598d7b73b8 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1718,7 +1718,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;