File bsc1160687-4.diff of Package libreoffice.15776

From c91584ef805866b46b06fe7451b077f9f33419b4 Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos@collabora.com>
Date: Tue, 28 Apr 2020 17:28:16 +0200
Subject: [PATCH] sw from-bottom relative orientation: add layout

The implementation is a combination of what "bottom" and "from-top"
already provided.

Change-Id: Id7bac8cbcccbadcca377fe9946a21ccb3e368913
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93086
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
(cherry picked from commit dd52fdba87d0cfee039cc236b86241708d4e63b8)
---
 .../objectpositioning/objectpositioning.cxx   | 33 +++++++++++++++++++
 .../tocntntanchoredobjectposition.cxx         | 12 +++++++
 2 files changed, 45 insertions(+)

diff --git a/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx b/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx
index 18c08f8540d9..9bf3c7bfb6cb 100644
--- a/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx
+++ b/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx
@@ -548,6 +548,18 @@ void SwToContentAnchoredObjectPosition::CalcPosition()
                                                 aRectFnSet.GetTop(aPgPrtRect),
                                                 nTopOfOrient );
                 }
+                else if (aVert.GetRelationOrient() == text::RelOrientation::PAGE_PRINT_AREA_BOTTOM)
+                {
+                    // The anchored object is relative from the bottom of the page's print area.
+                    SwRect aPgPrtRect(rPageAlignLayFrame.getFrameArea());
+                    if (rPageAlignLayFrame.IsPageFrame())
+                    {
+                        auto& rPageFrame = static_cast<const SwPageFrame&>(rPageAlignLayFrame);
+                        aPgPrtRect = rPageFrame.PrtWithoutHeaderAndFooter();
+                    }
+                    SwTwips nPageBottom = aRectFnSet.GetBottom(aPgPrtRect);
+                    nVertOffsetToFrameAnchorPos += aRectFnSet.YDiff(nPageBottom, nTopOfOrient);
+                }
                 nRelPosY = nVertOffsetToFrameAnchorPos + aVert.GetPos();
             }

--
2.26.1
openSUSE Build Service is sponsored by