sw/qa/extras/ww8export/ww8export.cxx | 15 +++++++++++++++ sw/source/filter/ww8/wrtw8esh.cxx | 12 ------------ 2 files changed, 15 insertions(+), 12 deletions(-)
New commits: commit a104332a59c62305506d80a94d2193f69614d5f0 Author: Justin Luth <jl...@mail.com> AuthorDate: Tue Aug 13 18:59:51 2024 -0400 Commit: Justin Luth <jl...@mail.com> CommitDate: Wed Aug 14 13:33:44 2024 +0200 tdf#162458 doc export: don't change "margin" to "page" I'm a little baffled at this code. The only thing I can imagine is that at some earlier time it converted TOP of PAGE_PRINT_AREA to FROM_TOP of PAGE. That at least was true of my example document in LO5.3, and I see similar things happening for horizontal. For vertical, in the case of FollowTextFlow, this is exactly backwards anyway, because MSO implements PAGE_FRAME as if it were PAGE_PRINT_AREA, which is the exact opposite of what we are doing here... For horizontal FTF, there doesn't need to be any adjustment. (see tdf#160077) DOC format knows about all 4 valid vertical positions (TOP/CENTER/BOTTOM/FROM_TOP), and all 4 valid horizontal positions (LEFT/CENTER/RIGHT/FROM_LEFT) and DOC format also knows about both hori and vert PAGE_PRINT_AREA, so there is no need to do any adjustment for "margin". For PAGE_FRAME it is irrelevant because that is what it sets anyway, so there is literally no change in that case. make CppunitTest_sw_ww8export CPPUNIT_TEST_NAME=testBnc787942 make CppunitTest_sw_ww8export \ CPPUNIT_TEST_NAME=testTextVerticalAdjustment Change-Id: I201966f00909d4a6e7fcd873582096da259c776d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171842 Reviewed-by: Justin Luth <jl...@mail.com> Tested-by: Jenkins diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx index 975b74a1271c..ba76d9cafbdb 100644 --- a/sw/qa/extras/ww8export/ww8export.cxx +++ b/sw/qa/extras/ww8export/ww8export.cxx @@ -552,6 +552,13 @@ DECLARE_WW8EXPORT_TEST(testBnc787942, "bnc787942.doc") CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_PARALLEL, getProperty<text::WrapTextMode>(getShape(1), u"Surround"_ustr)); CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(getShape(1), u"HoriOrientRelation"_ustr)); + + // The frame is at the bottom of the text area, not at the bottom of the paper. + uno::Reference<drawing::XShape> xShape = getShape(1); + CPPUNIT_ASSERT_EQUAL(text::VertOrientation::BOTTOM, + getProperty<sal_Int16>(xShape, u"VertOrient"_ustr)); + CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_PRINT_AREA, + getProperty<sal_Int16>(xShape, u"VertOrientRelation"_ustr)); } DECLARE_WW8EXPORT_TEST(testTdf133504_wrapNotBeside, "tdf133504_wrapNotBeside.doc") @@ -1335,6 +1342,14 @@ DECLARE_WW8EXPORT_TEST(testTextVerticalAdjustment, "tdf36117_verticalAdjustment. pDesc = &pDoc->GetPageDesc( 3 ); nVA = pDesc->GetVerticalAdjustment(); CPPUNIT_ASSERT_EQUAL( drawing::TextVerticalAdjust_BLOCK, nVA ); + + // The frame is at the left of the text area, not at the left of the paper. + uno::Reference<drawing::XShape> xShape = getShape(2); + CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::LEFT, + getProperty<sal_Int16>(xShape, u"HoriOrient"_ustr)); + CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_PRINT_AREA, + getProperty<sal_Int16>(xShape, u"HoriOrientRelation"_ustr)); + } DECLARE_WW8EXPORT_TEST(testRES_MIRROR_GRAPH_BOTH, "tdf56321_flipImage_both.doc") diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index 03048a9dcba9..37b36ccaafdf 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -2389,10 +2389,6 @@ bool WinwordAnchoring::ConvertPosition( SwFormatHoriOrient& _iorHoriOri, return false; } - // determine value of attribute 'Follow text flow', because positions aligned - // at page areas have to be converted, if it's set. - const bool bFollowTextFlow = _rFrameFormat.GetFollowTextFlow().GetValue(); - // check, if horizontal and vertical position have to be converted due to // the fact, that the object is anchored at a paragraph, which has a "column // break before" attribute @@ -2441,10 +2437,6 @@ bool WinwordAnchoring::ConvertPosition( SwFormatHoriOrient& _iorHoriOri, { case text::RelOrientation::PAGE_FRAME: case text::RelOrientation::PAGE_PRINT_AREA: - { - if ( bConvDueToOrientation || bFollowTextFlow ) - eHoriConv = sw::WW8AnchorConv::CONV2PG; - } break; case text::RelOrientation::PAGE_LEFT: case text::RelOrientation::PAGE_RIGHT: @@ -2507,10 +2499,6 @@ bool WinwordAnchoring::ConvertPosition( SwFormatHoriOrient& _iorHoriOri, { case text::RelOrientation::PAGE_FRAME: case text::RelOrientation::PAGE_PRINT_AREA: - { - if ( bConvDueToOrientation || bFollowTextFlow ) - eVertConv = sw::WW8AnchorConv::CONV2PG; - } break; case text::RelOrientation::FRAME: {