summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2017-02-16 18:17:53 +0100
committerMichael Stahl <mstahl@redhat.com>2017-02-16 22:42:49 +0100
commitd4620d535bd5a8e73bdb9d556933b9ae22800a7d (patch)
tree3ffddd8013fec9fbd80aa2f4c57d86afb8b68c94 /sw
parent4178f55bce696affd5074ebdcc32e84d00f7df09 (diff)
i#92948 sw: WW8 import: fix table in Apo in header
The document contains a table inside of a frame anchored in the header. In WW8TabDesc::WW8TabDesc() the update to nOrigPos makes a mess of things because the new nOrigPos value contains the value of nCpOfs (93) already, so later on when SwWW8ImplReader::TestApo() calls WW8PLCFxDesc::Save() / WW8PLCFxDesc::Restore(), the call to SeekPos() positions it on CP 325 instead of 232 and the subsequent call to GetSprms() finds nothing on the wrong position; thus TestApo() concludes that the paragraph has different Apo properties than the previous one and a new fly frame is created. (regression from 4bd341e2c8a1f3a4f4677eb879a60a4ffc3369db) Change-Id: I697c4526c7c3a12119947ff5659c11ea9ee7fff8
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/inc/swmodeltestbase.hxx13
-rw-r--r--sw/qa/extras/ww8export/data/ooo92948-1.docbin0 -> 43008 bytes
-rw-r--r--sw/qa/extras/ww8export/ww8export.cxx24
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx1
4 files changed, 38 insertions, 0 deletions
diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx
index 07b04ea2ba4d..aad89d82ab14 100644
--- a/sw/qa/extras/inc/swmodeltestbase.hxx
+++ b/sw/qa/extras/inc/swmodeltestbase.hxx
@@ -516,6 +516,19 @@ protected:
return xParagraph;
}
+ /// get nth object/fly that is anchored AT paragraph
+ uno::Reference<beans::XPropertySet> getParagraphAnchoredObject(
+ int const index, uno::Reference<text::XTextRange> const & xPara) const
+ {
+ uno::Reference<container::XContentEnumerationAccess> xContentEnumAccess(xPara, uno::UNO_QUERY);
+ uno::Reference<container::XEnumeration> xContentEnum(xContentEnumAccess->createContentEnumeration("com.sun.star.text.TextContent"), uno::UNO_QUERY);
+ for (int i = 1; i < index; ++i)
+ {
+ xContentEnum->nextElement();
+ }
+ return uno::Reference<beans::XPropertySet>(xContentEnum->nextElement(), uno::UNO_QUERY);
+ }
+
/// Get run (counted from 1) of a paragraph, optionally check it contains the given text.
uno::Reference<text::XTextRange> getRun(uno::Reference<text::XTextRange> const & xParagraph, int number, const OUString& content = OUString()) const
{
diff --git a/sw/qa/extras/ww8export/data/ooo92948-1.doc b/sw/qa/extras/ww8export/data/ooo92948-1.doc
new file mode 100644
index 000000000000..f355eaa26794
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/ooo92948-1.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx
index dd3f6b3be244..1966a6a92556 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -328,6 +328,30 @@ DECLARE_WW8EXPORT_TEST(testListNolevel, "list-nolevel.doc")
CPPUNIT_ASSERT_EQUAL(OUString("1."), aText);
}
+DECLARE_WW8EXPORT_TEST(testHeaderApoTable, "ooo92948-1.doc")
+{
+ // the problem was that a table anchored in the header was split across
+ // 3 text frames and quite messed up
+
+ uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
+ uno::Reference<text::XText> xFrame(xIndexAccess->getByIndex(1), uno::UNO_QUERY);
+
+// uno::Reference<text::XText> xHeaderText = getProperty<uno::Reference<text::XText>>(getStyles("PageStyles")->getByName("Standard"), "HeaderTextFirst");
+// uno::Reference<text::XTextRange> xPara(getParagraphOfText(9, xHeaderText));
+//TODO why does this not work
+// uno::Reference<beans::XPropertySet> xFrame(getParagraphAnchoredObject(1, xPara));
+
+ uno::Reference<text::XTextContent> xTable(getParagraphOrTable(1, xFrame));
+ getCell(xTable, "A1", "Aan\nRecipient\nRecipient\n");
+ getCell(xTable, "A2", "Kopie aan\n");
+ getCell(xTable, "A3", "Datum\n31 juli 2008");
+ getCell(xTable, "A4", "Locatie\nLocationr");
+ getCell(xTable, "A5", "Van\nSender ");
+ getCell(xTable, "A6", "Directie\nDepartment");
+ getCell(xTable, "A7", "Telefoon\nPhone");
+}
+
DECLARE_WW8EXPORT_TEST(testBnc821208, "bnc821208.doc")
{
// WW8Num1z0 earned a Symbol font, turning numbers into rectangles.
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index c1e1cb6c912a..fabd439d5c21 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -2020,6 +2020,7 @@ WW8TabDesc::WW8TabDesc(SwWW8ImplReader* pIoClass, WW8_CP nStartCp) :
// PlcxMan currently points too far ahead so we need to bring
// it back to where we are trying to make a table
m_pIo->m_pPlcxMan->GetPap()->nOrigStartPos = aRes.nStartPos;
+ m_pIo->m_pPlcxMan->GetPap()->nCpOfs = aRes.nCpOfs;
if (!(pPap->SeekPos(aRes.nStartPos)))
{
aRes.nEndPos = WW8_CP_MAX;