From 3d536594cf3ecbd5b980aaddb5cf17084b1666d4 Mon Sep 17 00:00:00 2001 From: Attila Bakos Date: Thu, 17 Sep 2020 11:32:44 +0200 Subject: tdf#136613 sw: fix picture position in tables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit in the case of option FollowTextFlow. Regression from commit b6850bbe95418ecfde404be1696548f18d200c9b (tdf#106153 sw compatibility: fix textboxes exceeding the page). Note: now images have the same position than before the previous commit, but this is still not perfect, because option FollowTextFlow doesn't allow them to be placed outside the cell where they are anchored to. The proper fix might be extending FollowTextFlow. Change-Id: I877e4660cd4a2fd8f1e97c845755940459f1d014 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102910 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit 7351a5028b18591306dfe18b34f6c751e565766e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104330 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen --- sw/qa/extras/layout/data/tdf136613.docx | Bin 0 -> 25262 bytes .../core/objectpositioning/anchoredobjectposition.cxx | 7 ++++++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 sw/qa/extras/layout/data/tdf136613.docx diff --git a/sw/qa/extras/layout/data/tdf136613.docx b/sw/qa/extras/layout/data/tdf136613.docx new file mode 100644 index 000000000000..f885564521b1 Binary files /dev/null and b/sw/qa/extras/layout/data/tdf136613.docx differ diff --git a/sw/source/core/objectpositioning/anchoredobjectposition.cxx b/sw/source/core/objectpositioning/anchoredobjectposition.cxx index 6935714e7c82..1e792ca09da3 100644 --- a/sw/source/core/objectpositioning/anchoredobjectposition.cxx +++ b/sw/source/core/objectpositioning/anchoredobjectposition.cxx @@ -409,8 +409,13 @@ SwTwips SwAnchoredObjectPosition::ImplAdjustVertRelPos( const SwTwips nTopOfAnch const bool bCheckBottom ) const { SwTwips nAdjustedRelPosY = nProposedRelPosY; - if (SwAnchoredObject::IsDraggingOffPageAllowed(FindFrameFormat(&mrDrawObj))) + // TODO: Replace the following condition with the correction + // of the implementation of option FollowTextFlow. + if ( SwAnchoredObject::IsDraggingOffPageAllowed(FindFrameFormat(&mrDrawObj)) && + !(GetAnchorFrame().IsInTab() && DoesObjFollowsTextFlow()) ) + { return nAdjustedRelPosY; + } const Size aObjSize(GetAnchoredObj().GetObjRect().SSize()); // determine the area of 'page' alignment frame, to which the vertical -- cgit