sw/qa/extras/rtfimport/data/fdo54900.rtf | 17 +++++++++++++++++ sw/qa/extras/rtfimport/rtfimport.cxx | 13 +++++++++++++ writerfilter/source/rtftok/rtfdocumentimpl.cxx | 1 + 3 files changed, 31 insertions(+)
New commits: commit 431853bfae7dccd139804caf7ac2505a7c283e63 Author: Miklos Vajna <vmik...@suse.cz> Date: Mon Jul 15 11:24:39 2013 +0200 fdo#54900 RTF import: support setting para align after text Both Word and Writer typically write all paragraph properties before the first text in each paragraph, but at least for paragraph alignment, it's valid to write them at the end. Change-Id: I0337e63678ad45c662a204ab2fc59378607abe74 diff --git a/sw/qa/extras/rtfimport/data/fdo54900.rtf b/sw/qa/extras/rtfimport/data/fdo54900.rtf new file mode 100644 index 0000000..0ebd9d1 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/fdo54900.rtf @@ -0,0 +1,17 @@ +{\rtf1\ansi\ansicpg1251\deflang1033 +{\fonttbl +{\f0\froman\fcharset204 TIMES NEW ROMAN;\f1\froman\fcharset204 TIMES NEW ROMAN;\f2\froman\fcharset204 ARIAL;\f3\froman\fcharset204 ARIAL;} +} +\sectd\lndscpsxn\pgwsxn16840\pghsxn11907\marglsxn1133\margrsxn850\margtsxn850\margbsxn850\linex0\headery709\footery709\colsx709\endnhere\sectdefaultcl +\b0\i0\nosupersub\b\f2 \fs28 +{\qc +\b0\i0\nosupersub\b\f3 \fs24 foo +\b0\i0\nosupersub\b\f2 \fs24 \par} +{\trowd\trql\clbrdrt\brdrdb\brdrw10\clbrdrl\brdrdb\brdrw10\clbrdrr\brdrs\brdrw10\cellx453 +\intbl +{\b\f0\fs16 N +} +{\qc\b\f0\fs16\li0\ri0 \cell} +{\row} +\pard} +\par} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index bc8c7fc..8e89c7d 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -18,6 +18,7 @@ #include <com/sun/star/style/CaseMap.hpp> #include <com/sun/star/style/LineSpacing.hpp> #include <com/sun/star/style/LineSpacingMode.hpp> +#include <com/sun/star/style/ParagraphAdjust.hpp> #include <com/sun/star/table/BorderLine2.hpp> #include <com/sun/star/table/BorderLineStyle.hpp> #include <com/sun/star/text/RelOrientation.hpp> @@ -153,6 +154,7 @@ public: void testFdo39001(); void testGroupshape(); void testFdo66565(); + void testFdo54900(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -291,6 +293,7 @@ void Test::run() {"fdo39001.rtf", &Test::testFdo39001}, {"groupshape.rtf", &Test::testGroupshape}, {"fdo66565.rtf", &Test::testFdo66565}, + {"fdo54900.rtf", &Test::testFdo54900}, }; header(); for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) @@ -1419,6 +1422,16 @@ void Test::testFdo66565() CPPUNIT_ASSERT_EQUAL(sal_Int16(304), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(1), "TableColumnSeparators")[0].Position); } +void Test::testFdo54900() +{ + uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY); + // Paragraph was aligned to left, should be center. + CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(getParagraphOfText(1, xCell->getText()), "ParaAdjust"))); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index b3374de..1673b73 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -2027,6 +2027,7 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) { RTFValue::Pointer_t pValue(new RTFValue(nParam)); m_aStates.top().aParagraphSprms.set(NS_sprm::LN_PJc, pValue); + m_bNeedPap = true; return 0; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits