sw/qa/extras/rtfimport/data/fdo81033.rtf | 12 ++++++++++++ sw/qa/extras/rtfimport/rtfimport.cxx | 14 ++++++++++++++ writerfilter/source/dmapper/DomainMapper.cxx | 5 ++++- writerfilter/source/dmapper/DomainMapper_Impl.hxx | 9 +++++++-- 4 files changed, 37 insertions(+), 3 deletions(-)
New commits: commit c0b6aadedc9429eee4f4df85957e00e29ccb0c8f Author: Michael Stahl <mst...@redhat.com> Date: Mon Jul 28 18:14:16 2014 +0200 (related: fdo#81033) writerfilter: default tab fill character is space This avoids an ugly "Character" box in the dialog with a null byte in it. Change-Id: Iee35a8e1bd6b57fb4eb8ae06722bd79ee1d5d8de diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index f72c331f..bb9cbb4 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -1388,7 +1388,7 @@ DECLARE_RTFIMPORT_TEST(testFdo81033, "fdo81033.rtf") 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_Unicode(' '), 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); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index ebf7426..21c66af 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -215,8 +215,13 @@ typedef std::stack< AnchoredContext > TextContentStack; struct DeletableTabStop : public ::com::sun::star::style::TabStop { bool bDeleted; - DeletableTabStop() : - bDeleted( false ){} + DeletableTabStop() + : bDeleted(false) + { + // same defaults as SvxXMLTabStopContext_Impl + FillChar = ' '; + DecimalChar = ','; + } DeletableTabStop( const ::com::sun::star::style::TabStop& rTabStop ) : TabStop( rTabStop ), bDeleted( false ){} commit 7f6e26917d4aa682ed9c422c83b1df20d78177d2 Author: Michael Stahl <mst...@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 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 f7763b3..f72c331f 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 a6c71b1..7e598d7 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; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits