diff options
-rw-r--r-- | sw/qa/extras/ooxmlimport/data/tdf90153.docx | bin | 0 -> 4856 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 6 | ||||
-rw-r--r-- | writerfilter/source/dmapper/GraphicImport.cxx | 8 |
3 files changed, 12 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/tdf90153.docx b/sw/qa/extras/ooxmlimport/data/tdf90153.docx Binary files differnew file mode 100644 index 000000000000..decbfa29d3b9 --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/tdf90153.docx diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 4f41751722df..b85af749d8b3 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -2840,6 +2840,12 @@ DECLARE_OOXMLIMPORT_TEST(testTdf92124, "tdf92124.docx") CPPUNIT_ASSERT(aSuffix.isEmpty()); } +DECLARE_OOXMLIMPORT_TEST(testTdf90153, "tdf90153.docx") +{ + // This was at-para, so the line-level VertOrientRelation was lost, resulting in an incorrect vertical position. + CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index 4720f89b80dd..8161e55ffa36 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -816,8 +816,12 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue) // If we are here, this is a drawingML shape. For those, only dmapper (and not oox) knows the anchoring infos (just like for Writer pictures). // But they aren't Writer pictures, either (which are already handled above). uno::Reference< beans::XPropertySet > xShapeProps(m_xShape, uno::UNO_QUERY_THROW); - // This needs to be AT_PARAGRAPH and not AT_CHARACTER, otherwise shape will move when the user inserts a new paragraph. - xShapeProps->setPropertyValue("AnchorType", uno::makeAny(text::TextContentAnchorType_AT_PARAGRAPH)); + + // This needs to be AT_PARAGRAPH by default and not AT_CHARACTER, otherwise shape will move when the user inserts a new paragraph. + text::TextContentAnchorType eAnchorType = text::TextContentAnchorType_AT_PARAGRAPH; + if (m_pImpl->nVertRelation == text::RelOrientation::TEXT_LINE) + eAnchorType = text::TextContentAnchorType_AT_CHARACTER; + xShapeProps->setPropertyValue("AnchorType", uno::makeAny(eAnchorType)); //only the position orientation is handled in applyPosition() m_pImpl->applyPosition(xShapeProps); |