diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2021-02-03 09:36:50 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-02-09 14:09:19 +0100 |
commit | cf113d719f54cc0839c8ab40f2c53b5f156f9424 (patch) | |
tree | 308405e33feaec2ccf2f718c6c3a1000442426ea /sw/source/core/layout/paintfrm.cxx | |
parent | d00cad178c8830bada68bd9d81dc0c4466160ab6 (diff) |
tdf#91920 sw page gutter margin: add layout
Handle this in general by decreasing the print area of the page frame,
that way the position and size of the child frames (header, body, etc)
will be correct.
One catch is that the page border is independent from the gutter margin
in Word, so compensate for it in lcl_CalcBorderRect() have matching
render result. (E.g. 1cm gutter margin, 1cm left and right margins, then
we would default to drawing the left margin at 2cm from left edge, but
1cm is wanted.)
(cherry picked from commit b1779452bdf8b4d00791f013945cb9aa12b19723)
Conflicts:
sw/qa/core/layout/layout.cxx
Change-Id: I41a697e8230c975e7665a06c7b739df04826e9a2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110625
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/source/core/layout/paintfrm.cxx')
-rw-r--r-- | sw/source/core/layout/paintfrm.cxx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index a53e7b249dba..da8731a400d1 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -1266,6 +1266,16 @@ static void lcl_CalcBorderRect( SwRect &rRect, const SwFrame *pFrame, SwRectFn fnRect = pFrame->IsVertical() ? ( pFrame->IsVertLR() ? (pFrame->IsVertLRBT() ? fnRectVertL2RB2T : fnRectVertL2R) : fnRectVert ) : fnRectHori; + if (pFrame->IsPageFrame() && rAttrs.GetLRSpace()) + { + long nGutterMargin = rAttrs.GetLRSpace()->GetGutterMargin(); + if (nGutterMargin) + { + // Paint the left border based on the left margin, ignoring the gutter margin. + (rRect.*fnRect->fnSubLeft)(nGutterMargin); + } + } + const SvxBoxItem &rBox = rAttrs.GetBox(); const bool bTop = 0 != (pFrame->*fnRect->fnGetTopMargin)(); if ( bTop ) |