diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-07-15 11:24:39 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2013-07-15 10:57:39 +0000 |
commit | 49d3f271b0da11f1793135b067b9b5d4f48cf537 (patch) | |
tree | 39f6074b16bee6a2d3f5d22cfa1ad131e6f8d7c5 /sw | |
parent | c71f67198cd6fc98f77289c4f0276a45d19700d8 (diff) |
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.
(cherry picked from commit 431853bfae7dccd139804caf7ac2505a7c283e63)
Change-Id: I0337e63678ad45c662a204ab2fc59378607abe74
Reviewed-on: https://gerrit.libreoffice.org/4913
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/rtfimport/data/fdo54900.rtf | 17 | ||||
-rw-r--r-- | sw/qa/extras/rtfimport/rtfimport.cxx | 13 |
2 files changed, 30 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfimport/data/fdo54900.rtf b/sw/qa/extras/rtfimport/data/fdo54900.rtf new file mode 100644 index 000000000000..0ebd9d1f85da --- /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 fd05bdc19dde..58353bff2fb2 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -17,6 +17,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> @@ -144,6 +145,7 @@ public: void testN823655(); void testFdo39001(); void testFdo66565(); + void testFdo54900(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -276,6 +278,7 @@ void Test::run() {"n823655.rtf", &Test::testN823655}, {"fdo39001.rtf", &Test::testFdo39001}, {"fdo66565.rtf", &Test::testFdo66565}, + {"fdo54900.rtf", &Test::testFdo54900}, }; header(); for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) @@ -1330,6 +1333,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(); |