summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-06-01 09:03:05 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-06-02 09:20:49 +0200
commit3cf789a15450efcdcf8dd95eeb71bfc746591f1c (patch)
tree14817b9508575cdde1581de3e608e5762b809707
parent948d606b0260a33a5db77061f560afebde3fcdb7 (diff)
tdf#79639 DOCX import: don't delay text frame conversion of in-header tables
Floating tables may or may not be converted to table-in-textframes during import, depending on if we guess that it'll be a multi-page table with minimal wrapping or a real wrapped table. If the floating table is in a header or footer, then it won't be a multi-page one, so can do the conversion right away. Change-Id: I8d5ff8c5fe00037d5cef92dea6b54de6806214bc (cherry picked from commit 81ef96a2417c7843dfed0558c920ad3064e58921)
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf79639.docxbin0 -> 18409 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx8
-rw-r--r--writerfilter/source/dmapper/DomainMapperTableHandler.cxx11
3 files changed, 17 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf79639.docx b/sw/qa/extras/ooxmlexport/data/tdf79639.docx
new file mode 100644
index 000000000000..b84aaea70389
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf79639.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index ba7715ba4abc..fc05887962b4 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -695,6 +695,14 @@ DECLARE_OOXMLEXPORT_TEST(testTdf91261, "tdf91261.docx")
}
+DECLARE_OOXMLEXPORT_TEST(testTdf79639, "tdf79639.docx")
+{
+ uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage();
+ // This was 0, floating table in header wasn't converted to a TextFrame.
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), xDrawPage->getCount());
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 809429ddbda6..b08e52a3c90f 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -1113,12 +1113,19 @@ void DomainMapperTableHandler::endTable(unsigned int nestedTableLevel)
// Also, when the anchor is within a table, then do it here as well,
// as xStart/xEnd would not point to the start/end at conversion
// time anyway.
+ // Next exception: it's pointless to delay the conversion if the
+ // table is not in the body text.
sal_Int32 nTableWidth = 0;
m_aTableProperties->getValue(TablePropertyMap::TABLE_WIDTH, nTableWidth);
- if (m_rDMapper_Impl.GetSectionContext() && nestedTableLevel <= 1)
+ if (m_rDMapper_Impl.GetSectionContext() && nestedTableLevel <= 1 && !m_rDMapper_Impl.IsInHeaderFooter())
m_rDMapper_Impl.m_aPendingFloatingTables.push_back(FloatingTableInfo(xStart, xEnd, comphelper::containerToSequence(aFrameProperties), nTableWidth));
else
- m_xText->convertToTextFrame(xStart, xEnd, comphelper::containerToSequence(aFrameProperties));
+ {
+ // m_xText points to the body text, get to current xText from m_rDMapper_Impl, in case e.g. we would be in a header.
+ uno::Reference<text::XTextAppendAndConvert> xTextAppendAndConvert(m_rDMapper_Impl.GetTopTextAppend(), uno::UNO_QUERY);
+ if (xTextAppendAndConvert.is())
+ xTextAppendAndConvert->convertToTextFrame(xStart, xEnd, comphelper::containerToSequence(aFrameProperties));
+ }
}
}