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

fdo#74357 DOCX import: fix nested tables anchored inside tables

Regression from bbef85c1 (bnc#779620
DOCX import: try harder to convert floating tables to text frames,
2013-10-01), the conversion of nested tables is delayed by default till
we know the page size. However, in case the anchor is in a table, we
should convert it right away, because the conversion of the parent table
would invalidate our XTextRange references.

Change-Id: Id41556e721c6e1c7239e4ea25abd57c999d2219b
üst 4a153b4d
...@@ -745,6 +745,15 @@ DECLARE_OOXMLIMPORT_TEST(testN779627, "n779627.docx") ...@@ -745,6 +745,15 @@ DECLARE_OOXMLIMPORT_TEST(testN779627, "n779627.docx")
CPPUNIT_ASSERT_EQUAL_MESSAGE("Not centered vertically relatively to page", text::RelOrientation::PAGE_FRAME, nValue); CPPUNIT_ASSERT_EQUAL_MESSAGE("Not centered vertically relatively to page", text::RelOrientation::PAGE_FRAME, nValue);
} }
DECLARE_OOXMLIMPORT_TEST(testFdo74357, "fdo74357.docx")
{
// Floating table wasn't converted to a textframe.
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xDrawPage(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
// This was 0.
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDrawPage->getCount());
}
DECLARE_OOXMLIMPORT_TEST(testFdo55187, "fdo55187.docx") DECLARE_OOXMLIMPORT_TEST(testFdo55187, "fdo55187.docx")
{ {
// 0x010d was imported as a newline. // 0x010d was imported as a newline.
......
...@@ -959,9 +959,12 @@ void DomainMapperTableHandler::endTable(unsigned int nestedTableLevel) ...@@ -959,9 +959,12 @@ void DomainMapperTableHandler::endTable(unsigned int nestedTableLevel)
// SectionPropertyMap::CloseSectionGroup(), so we'll have no idea // SectionPropertyMap::CloseSectionGroup(), so we'll have no idea
// about the text area width, nor can fix this by delaying the text // about the text area width, nor can fix this by delaying the text
// frame conversion: just do it here. // frame conversion: just do it here.
// Also, we 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.
sal_Int32 nTableWidth = 0; sal_Int32 nTableWidth = 0;
m_aTableProperties->getValue(TablePropertyMap::TABLE_WIDTH, nTableWidth); m_aTableProperties->getValue(TablePropertyMap::TABLE_WIDTH, nTableWidth);
if (m_rDMapper_Impl.GetSectionContext()) if (m_rDMapper_Impl.GetSectionContext() && nestedTableLevel <= 1)
m_rDMapper_Impl.m_aPendingFloatingTables.push_back(FloatingTableInfo(xStart, xEnd, aFrameProperties, nTableWidth)); m_rDMapper_Impl.m_aPendingFloatingTables.push_back(FloatingTableInfo(xStart, xEnd, aFrameProperties, nTableWidth));
else else
m_xText->convertToTextFrame(xStart, xEnd, aFrameProperties); m_xText->convertToTextFrame(xStart, xEnd, 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