[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa writerfilter/source
Miklos Vajna
vmiklos at suse.cz
Mon Jul 15 03:58:03 PDT 2013
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 49d3f271b0da11f1793135b067b9b5d4f48cf537
Author: Miklos Vajna <vmiklos at 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.
(cherry picked from commit 431853bfae7dccd139804caf7ac2505a7c283e63)
Change-Id: I0337e63678ad45c662a204ab2fc59378607abe74
Reviewed-on: https://gerrit.libreoffice.org/4913
Reviewed-by: David Tardon <dtardon at redhat.com>
Tested-by: David Tardon <dtardon at redhat.com>
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 fd05bdc..58353bf 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();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 8bf0e06..fe15892 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2006,6 +2006,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;
}
More information about the Libreoffice-commits
mailing list