sw/qa/extras/ooxmlexport/ooxmlexport8.cxx | 6 ++---- writerfilter/source/dmapper/GraphicImport.cxx | 7 +++++++ 2 files changed, 9 insertions(+), 4 deletions(-)
New commits: commit 8132f0eb48d1b1601b690c43bcd4991c86dd1217 Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Fri Jan 12 16:17:03 2024 -0500 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Mon Jan 15 08:51:39 2024 +0100 tdf#139915 tdf#159157 writerfilter: fix image position with TEXT_LINE This is an IMAGE followup to vmiklos' shape/textbox fix in LO 7.2 commit 2f21e4f357ec60450df84ddd858c3cf0a4711b02 Images follow a different code path, but needed the same treatment. Change-Id: I974944c7fbb4e0fa6aa52ac239c6a16ec7f927e6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161986 Tested-by: Jenkins Reviewed-by: Justin Luth <jl...@mail.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161988 diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx index 2463534dd8ba..0ea69e698807 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx @@ -174,10 +174,8 @@ after they are loaded. CPPUNIT_ASSERT_EQUAL( OUString( "Red" ), descr2 ); CPPUNIT_ASSERT_EQUAL( OUString( "Green" ), descr3 ); - //FIXME: MS Word shows the image below the line of text, not above it. - // tdf#139915 This was 826, but it should be -826 - if (isExported()) - CPPUNIT_ASSERT_EQUAL(sal_Int32(-826), getProperty<sal_Int32>(image1, "VertOrientPosition")); + // tdf#139915/tdf#159157 This was 826, but it should be -826 + CPPUNIT_ASSERT_EQUAL(sal_Int32(-826), getProperty<sal_Int32>(image1, "VertOrientPosition")); sal_Int16 nExpected = text::RelOrientation::TEXT_LINE; CPPUNIT_ASSERT_EQUAL(nExpected, getProperty<sal_Int16>(image1, "VertOrientRelation")); diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index 63330c477cbd..eebd1b822897 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -1850,6 +1850,13 @@ uno::Reference<text::XTextContent> GraphicImport::createGraphicObject(uno::Refer m_pImpl->m_nLeftPosition = 0; } + if (m_pImpl->m_nVertRelation == text::RelOrientation::TEXT_LINE) + { + // Word's "line" is "below the bottom of the line", our TEXT_LINE is + // "towards top, from the bottom of the line", so invert the vertical position. + m_pImpl->m_nTopPosition *= -1; + } + m_pImpl->applyPosition(xGraphicObjectProperties); m_pImpl->applyRelativePosition(xGraphicObjectProperties); if( !m_pImpl->m_bOpaque )