diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-02-17 09:37:51 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-02-18 12:54:08 +0000 |
commit | 28fa9a59940471bf072175a7ee98e23546485e50 (patch) | |
tree | aa19d23f3b5e68e6740b26462d029c61dc23c6da | |
parent | 34de0b64b9184a85cd7fb65d0e811b435e90fe24 (diff) |
fdo#74357 DOCX import: fix nested tables anchored inside tables
Regression from bbef85c157169efa958ea1014d91d467cb243e6f (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.
(cherry picked from commit e5fd7c2dacf3c128cdc62622e736ce8abbc578a5)
Change-Id: Id41556e721c6e1c7239e4ea25abd57c999d2219b
Reviewed-on: https://gerrit.libreoffice.org/8080
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sw/qa/extras/ooxmlimport/data/fdo74357.docx | bin | 0 -> 11930 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 9 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 5 |
3 files changed, 13 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/fdo74357.docx b/sw/qa/extras/ooxmlimport/data/fdo74357.docx Binary files differnew file mode 100644 index 000000000000..970372906e29 --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/fdo74357.docx diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index e9c5ad0d213f..a7d576e660c1 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -737,6 +737,15 @@ DECLARE_OOXMLIMPORT_TEST(testN779627, "n779627.docx") 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") { // 0x010d was imported as a newline. diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index 3c9095a04758..0827cc919968 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -951,9 +951,12 @@ void DomainMapperTableHandler::endTable(unsigned int nestedTableLevel) // SectionPropertyMap::CloseSectionGroup(), so we'll have no idea // about the text area width, nor can fix this by delaying the text // 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; 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)); else m_xText->convertToTextFrame(xStart, xEnd, aFrameProperties); |