diff options
-rw-r--r-- | writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx | 22 | ||||
-rw-r--r-- | writerfilter/qa/cppunittests/dmapper/data/layout-in-cell-wrapnone-column.docx | bin | 0 -> 12900 bytes | |||
-rw-r--r-- | writerfilter/source/dmapper/GraphicImport.cxx | 7 |
3 files changed, 29 insertions, 0 deletions
diff --git a/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx b/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx index edd6e02ff8ea..2f9faefab55f 100644 --- a/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx +++ b/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx @@ -366,6 +366,28 @@ CPPUNIT_TEST_FIXTURE(Test, testTextboxTextlineTop) sal_Int16 nExpectedOrient = text::VertOrientation::BOTTOM; CPPUNIT_ASSERT_EQUAL(nExpectedOrient, nActualOrient); } + +CPPUNIT_TEST_FIXTURE(Test, testLayoutInCellWrapnoneColumn) +{ + // Given a file with a table, then a shape anchored inside the cell: + OUString aURL + = m_directories.getURLFromSrc(DATA_DIRECTORY) + "layout-in-cell-wrapnone-column.docx"; + + // When loading that document: + getComponent() = loadFromDesktop(aURL); + + // Then make sure the shape can leave the cell: + uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(getComponent(), uno::UNO_QUERY); + uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage(); + uno::Reference<beans::XPropertySet> xShape(xDrawPage->getByIndex(1), uno::UNO_QUERY); + uno::Reference<container::XNamed> xNamedShape(xShape, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("Text Box 1"), xNamedShape->getName()); + bool bFollowingTextFlow = true; + // Without the accompanying fix in place, this test would have failed, the shape was not allowed + // to leave the cell, leading to incorrect layout. + CPPUNIT_ASSERT(xShape->getPropertyValue("IsFollowingTextFlow") >>= bFollowingTextFlow); + CPPUNIT_ASSERT(!bFollowingTextFlow); +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/qa/cppunittests/dmapper/data/layout-in-cell-wrapnone-column.docx b/writerfilter/qa/cppunittests/dmapper/data/layout-in-cell-wrapnone-column.docx Binary files differnew file mode 100644 index 000000000000..d88761421154 --- /dev/null +++ b/writerfilter/qa/cppunittests/dmapper/data/layout-in-cell-wrapnone-column.docx diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index 704774ec504a..bb3b2077e4aa 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -1228,6 +1228,13 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue) // But they aren't Writer pictures, either (which are already handled above). uno::Reference< beans::XPropertySet > xShapeProps(m_xShape, uno::UNO_QUERY_THROW); + if (m_pImpl->nWrap == text::WrapTextMode_THROUGH && m_pImpl->nHoriRelation == text::RelOrientation::FRAME) + { + // text::RelOrientation::FRAME is OOXML's "column", which behaves as if + // layout-in-cell would be always off. + m_pImpl->bLayoutInCell = false; + } + // Anchored: Word only supports at-char in that case. text::TextContentAnchorType eAnchorType = text::TextContentAnchorType_AT_CHARACTER; |