Kaydet (Commit) ba36de7f authored tarafından Miklos Vajna's avatar Miklos Vajna Kaydeden (comit) Andras Timar

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 81ef96a2)
üst 791f26ab
......@@ -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: */
......@@ -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));
}
}
}
......
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