diff --git a/sw/qa/extras/ooxmlexport/data/tdf115719.docx b/sw/qa/extras/ooxmlexport/data/tdf115719.docx index f98f8b4a05dc..4eda09a98fa2 100644 Binary files a/sw/qa/extras/ooxmlexport/data/tdf115719.docx and b/sw/qa/extras/ooxmlexport/data/tdf115719.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf115719b.docx b/sw/qa/extras/ooxmlimport/data/tdf115719b.docx index 8c552baf76c1..4cb13228443a 100644 Binary files a/sw/qa/extras/ooxmlimport/data/tdf115719b.docx and b/sw/qa/extras/ooxmlimport/data/tdf115719b.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf124600.docx b/sw/qa/extras/ooxmlimport/data/tdf124600.docx new file mode 100644 index 000000000000..d5dfa313665e Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf124600.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx index e2d930b9f4bf..c0e006668c88 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx @@ -132,6 +132,17 @@ DECLARE_OOXMLIMPORT_TEST(testGroupShapeFontName, "groupshape-fontname.docx") getProperty(getRun(getParagraphOfText(1, xText), 1), "CharFontNameAsian")); } +DECLARE_OOXMLIMPORT_TEST(testTdf124600, "tdf124600.docx") +{ + uno::Reference xShape = getShape(1); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 0 + // - Actual : 318 + // i.e. the shape had an unexpected left margin, but not in Word. + CPPUNIT_ASSERT_EQUAL(static_cast(0), + getProperty(xShape, "HoriOrientPosition")); +} + DECLARE_OOXMLIMPORT_TEST(testTdf120548, "tdf120548.docx") { // Without the accompanying fix in place, this test would have failed with 'Expected: 00ff0000; diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index bf80052e33dd..c148d7989e0d 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -975,7 +975,6 @@ void GraphicImport::ProcessShapeOptions(Value const & rValue) switch( m_pImpl->nShapeOptionType ) { case NS_ooxml::LN_CT_Anchor_distL: - //todo: changes have to be applied depending on the orientation, see SwWW8ImplReader::AdjustLRWrapForWordMargins() m_pImpl->nLeftMargin = nIntValue / 360; break; case NS_ooxml::LN_CT_Anchor_distT: @@ -1070,6 +1069,16 @@ void GraphicImport::lcl_sprm(Sprm& rSprm) m_pImpl->nHoriRelation = pHandler->relation(); m_pImpl->nHoriOrient = pHandler->orientation(); m_pImpl->nLeftPosition = pHandler->position(); + + // Left adjustments: if horizontally aligned to left of margin, then remove the + // left wrapping. + if (m_pImpl->nHoriOrient == text::HoriOrientation::LEFT) + { + if (m_pImpl->nHoriRelation == text::RelOrientation::PAGE_PRINT_AREA) + { + m_pImpl->nLeftMargin = 0; + } + } } } }