Kaydet (Commit) 431853bf authored tarafından Miklos Vajna's avatar Miklos Vajna

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
üst 24078e35
{\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}
......@@ -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();
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment