summaryrefslogtreecommitdiff
path: root/sw/source/core/objectpositioning
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-10-02 14:23:20 +0200
committerMiklos Vajna <vmiklos@collabora.com>2019-10-02 16:32:27 +0200
commit29d7ece94318d3f03d079dff33ec15ff74f8febf (patch)
tree2db2fccf3d96b4b62e8ae0399d3209cadacec7fb /sw/source/core/objectpositioning
parent2e6d82e94f3efc76ea4243bc67b3acbfc74d8b39 (diff)
tdf#124601 sw FollowTextFlow: fix hori pos of objects outside the current cell
The problem is that the image in the bugdoc's footer is anchored in one cell, but its position has a value that shifts it to the next column and next row. The next column is the problem for the horizontal position. So build on top of the previous vertical position fix, and make sure that CalcRelPosX() doesn't limit the position inside the current cell for an in-table, follow-text-flow, wrap-though image. Once that's in place, make sure that we don't try to grow the cell due to follow-text-flow, wrap-though objects in CalcPosition(), since in a wrap-through vs follow-text-flow situation, the wrap-though should have priority (should not affect size of cells). Finally, now that cells don't grow in this case, the previously added special-casing of footers in SwFlyFreeFrame::CheckClip() is no longer necessary. Not growing the cells means we don't try to re-position the object. Change-Id: Ic55e4b5188704fa70314f91fe9a01987b6a56d7b Reviewed-on: https://gerrit.libreoffice.org/80032 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw/source/core/objectpositioning')
-rw-r--r--sw/source/core/objectpositioning/anchoredobjectposition.cxx8
-rw-r--r--sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx14
2 files changed, 19 insertions, 3 deletions
diff --git a/sw/source/core/objectpositioning/anchoredobjectposition.cxx b/sw/source/core/objectpositioning/anchoredobjectposition.cxx
index 09f6b33c5458..f60e097a01bb 100644
--- a/sw/source/core/objectpositioning/anchoredobjectposition.cxx
+++ b/sw/source/core/objectpositioning/anchoredobjectposition.cxx
@@ -881,7 +881,13 @@ SwTwips SwAnchoredObjectPosition::CalcRelPosX(
// keep object inside 'page' alignment layout frame
const SwFrame& rEnvironmentLayFrame =
_rEnvOfObj.GetHoriEnvironmentLayoutFrame( _rHoriOrientFrame );
- nRelPosX = AdjustHoriRelPos( rEnvironmentLayFrame, nRelPosX );
+ bool bFollowTextFlow = GetFrameFormat().GetFollowTextFlow().GetValue();
+ bool bWrapThrough = GetFrameFormat().GetSurround().GetSurround() != text::WrapTextMode_THROUGH;
+ // Don't try to keep wrap-though objects inside the cell, even if they are following text flow.
+ if (!rEnvironmentLayFrame.IsInTab() || !bFollowTextFlow || bWrapThrough)
+ {
+ nRelPosX = AdjustHoriRelPos( rEnvironmentLayFrame, nRelPosX );
+ }
// if object is a Writer fly frame and it's anchored to a content and
// it is horizontal positioned left or right, but not relative to character,
diff --git a/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx b/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx
index ec4ceeb61578..1e7f36f7b0e8 100644
--- a/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx
+++ b/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx
@@ -632,7 +632,12 @@ void SwToContentAnchoredObjectPosition::CalcPosition()
// <lcl_DoesVertPosFits(..)>.
if ( pLayoutFrameToGrow )
{
- pLayoutFrameToGrow->Grow( nRelPosY - nAvail );
+ // No need to grow the anchor cell in case the follow-text-flow object
+ // is wrap-though.
+ if (!GetAnchorFrame().IsInTab() || !DoesObjFollowsTextFlow() || !bWrapThrough)
+ {
+ pLayoutFrameToGrow->Grow( nRelPosY - nAvail );
+ }
}
nRelPosY = 0;
}
@@ -789,7 +794,12 @@ void SwToContentAnchoredObjectPosition::CalcPosition()
}
if ( pLayoutFrameToGrow )
{
- pLayoutFrameToGrow->Grow( -nDist );
+ // No need to grow the anchor cell in case the follow-text-flow object
+ // is wrap-though.
+ if (!GetAnchorFrame().IsInTab() || !DoesObjFollowsTextFlow() || !bWrapThrough)
+ {
+ pLayoutFrameToGrow->Grow( -nDist );
+ }
}
}