summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-03-22 11:08:12 +0100
committerMiklos Vajna <vmiklos@suse.cz>2013-03-22 11:48:02 +0100
commit24d5261f5a122e22675210445056cdf67663237b (patch)
tree7fbdacb30ec43502a1e123d8083e8667ebae9134 /sw
parentcc8e169d6cddc081e2a8b5249f34169c0e41d7d3 (diff)
fdo#62288 fix RTF import of table paragraph margins
Regression from 4a507f732d82c188ad81b022cbe3037951e58ac3. The problem was that in some cases \pard can't reset all paragraph properties. The original commit just made this keyword a noop when it occurred between \cell and \row, but this is too much. At least margins do need resetting. Change-Id: I5cbb1df72bf1211f85ef69ab64d5b46cbce5c742
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/rtfimport/data/fdo62288.rtf23
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx15
2 files changed, 38 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfimport/data/fdo62288.rtf b/sw/qa/extras/rtfimport/data/fdo62288.rtf
new file mode 100644
index 000000000000..f5ec592fc1fc
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo62288.rtf
@@ -0,0 +1,23 @@
+{\rtf1
+\paperw11907\paperh16840\margl567\margr567\margt567\margb567
+\sb113\sa113
+{\b\fs22\cf1\kerning1\cgrid0 Objectives}
+{\fs24\kerning1\cgrid0
+\par }
+\trowd \trgaph10\trleft-10 \clvertalt\cltxlrtb \cellx4808\clvertalt\cltxlrtb \cellx5375\clvertalt\cltxlrtb \cellx10194\clvertalt\cltxlrtb \cellx10762\pard \li567\nowidctlpar\intbl\adjustright
+{\cf1\kerning1\cgrid0 One}
+{\fs24\kerning1\cgrid0 \cell }
+\pard \qc\nowidctlpar\intbl\adjustright
+{\cf1\kerning1\cgrid0 [ ]}
+{\fs24\kerning1\cgrid0 \cell }
+\pard \li567\nowidctlpar\intbl\adjustright
+{\cf1\kerning1\cgrid0 Two}
+{
+\fs24\kerning1\cgrid0 \cell }
+\pard \qc\nowidctlpar\intbl\adjustright
+{\cf1\kerning1\cgrid0 [ ]}
+{\fs24\kerning1\cgrid0 \cell }
+\pard \widctlpar\intbl\adjustright
+{\fs24\kerning1\cgrid0 \row }
+\pard\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 4d042dcd9d8d..a7b1e01a055e 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -146,6 +146,7 @@ public:
void testFdo59638();
void testFdo60722();
void testFdo61909();
+ void testFdo62288();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -264,6 +265,7 @@ void Test::run()
{"fdo59638.rtf", &Test::testFdo59638},
{"fdo60722.rtf", &Test::testFdo60722},
{"fdo61909.rtf", &Test::testFdo61909},
+ {"fdo62288.rtf", &Test::testFdo62288},
};
header();
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1177,6 +1179,19 @@ void Test::testFdo61909()
CPPUNIT_ASSERT_EQUAL(COL_AUTO, getProperty<sal_uInt32>(xTextRange, "CharBackColor"));
}
+void Test::testFdo62288()
+{
+ 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("B1"), uno::UNO_QUERY);
+ uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xCell->getText(), uno::UNO_QUERY);
+ uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
+ uno::Reference<text::XTextRange> xPara(xParaEnum->nextElement(), uno::UNO_QUERY);
+ // Margins were inherited from the previous cell, even there was a \pard there.
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xPara, "ParaLeftMargin"));
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();