summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-05-05 18:03:51 +0200
committerMiklos Vajna <vmiklos@collabora.com>2020-05-05 21:20:14 +0200
commite21bc1b3e587c2bd90168b24f3774d98a3837f8e (patch)
tree1de57259463f6dd88b40cfd5119a065d761f097a /sw/source
parent0c8ee2e0182facbbaaf440054e6c72c21bdaaefb (diff)
sw from-bottom relative orientation: fix calculation of position limits
Create a new Writer doc, insert a rectangle with height = 10cm, try to position it 2cm above the bottom of the page, so that would be -12cm, but we limited the metric field to -2cm because 2cm was the page margin. Teach SwFEShell::CalcBoundRect() about text::RelOrientation::PAGE_PRINT_AREA_BOTTOM, then this will work without problems. Change-Id: Ib6ddccc1512d39fff5bff2e989973b156a6c2bf7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93501 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/frmedt/fews.cxx16
-rw-r--r--sw/source/uibase/shells/drwbassh.cxx3
2 files changed, 17 insertions, 2 deletions
diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx
index 87fb9075644f..4f545ed22649 100644
--- a/sw/source/core/frmedt/fews.cxx
+++ b/sw/source/core/frmedt/fews.cxx
@@ -967,7 +967,9 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect,
// #i18732# - adjustment vertical 'virtual' anchor position
// (<aPos.Y()> respectively <aPos.X()>), if object is vertical aligned
// to page areas.
- if ( _eVertRelOrient == text::RelOrientation::PAGE_FRAME || _eVertRelOrient == text::RelOrientation::PAGE_PRINT_AREA )
+ if (_eVertRelOrient == text::RelOrientation::PAGE_FRAME
+ || _eVertRelOrient == text::RelOrientation::PAGE_PRINT_AREA
+ || _eVertRelOrient == text::RelOrientation::PAGE_PRINT_AREA_BOTTOM)
{
if ( aRectFnSet.IsVert() && !aRectFnSet.IsVertL2R() )
{
@@ -998,6 +1000,18 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect,
aPos.setY(aPos.getY() + pTmpFrame->getFrameArea().Height());
}
}
+ else if (_eVertRelOrient == text::RelOrientation::PAGE_PRINT_AREA_BOTTOM)
+ {
+ if (rVertEnvironLayFrame.IsPageFrame())
+ {
+ auto& rPageFrame = static_cast<const SwPageFrame&>(rVertEnvironLayFrame);
+ aPos.setY(rPageFrame.PrtWithoutHeaderAndFooter().Bottom());
+ }
+ else
+ {
+ aPos.AdjustY(rVertEnvironLayFrame.getFramePrintArea().Bottom());
+ }
+ }
}
}
}
diff --git a/sw/source/uibase/shells/drwbassh.cxx b/sw/source/uibase/shells/drwbassh.cxx
index 18fce24f2c94..bccbe313bdf9 100644
--- a/sw/source/uibase/shells/drwbassh.cxx
+++ b/sw/source/uibase/shells/drwbassh.cxx
@@ -958,7 +958,8 @@ IMPL_LINK(SwDrawBaseShell, ValidatePosition, SvxSwFrameValidation&, rValidation,
// and alignment at page areas.
const bool bMaxVPosAtBottom = !rValidation.bFollowTextFlow ||
rValidation.nVRelOrient == text::RelOrientation::PAGE_FRAME ||
- rValidation.nVRelOrient == text::RelOrientation::PAGE_PRINT_AREA;
+ rValidation.nVRelOrient == text::RelOrientation::PAGE_PRINT_AREA ||
+ rValidation.nVRelOrient == text::RelOrientation::PAGE_PRINT_AREA_BOTTOM;
{
SwTwips nTmpMaxVPos = ( bMaxVPosAtBottom
? aBoundRect.Bottom()