summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-02-08 16:49:45 +0100
committerMiklos Vajna <vmiklos@collabora.com>2021-02-10 12:12:17 +0100
commit3010ee15889a52b23aef278300e29f06739882d6 (patch)
tree466e2b315afa1b8938a02328f16d2ace770074c4 /sw/source
parent9dc25ec68f3342f257ac0b0a6ed2f7165473ed3d (diff)
tdf#91920 sw page gutter margin: handle mirrored margins
- SwPageDesc::Mirror: generate "right gutter margin" from gutter margin for mirrored pages, we just lost the gutter margin here previously - SwBorderAttrs::CalcRight: handle right gutter margin, so gutter increases the right margin, not the left margin on mirrored pages - lcl_CalcBorderRect: similar to left and top margins, compensate for right margin gutter as well, so borders are independent from the gutter margin (Word compat) (cherry picked from commit ffe7fd5c3f3de474b201fbb1e25b8251cb13574d) Conflicts: editeng/source/items/frmitems.cxx include/editeng/lrspitem.hxx sw/source/core/layout/paintfrm.cxx Change-Id: Ie4d3459ab6edcc60b20c2fed08dbf45060ca9828 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110692 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/layout/frmtool.cxx13
-rw-r--r--sw/source/core/layout/pagedesc.cxx1
-rw-r--r--sw/source/core/layout/paintfrm.cxx21
3 files changed, 29 insertions, 6 deletions
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index 550e54c05f70..fa8603bcc9b3 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -2252,6 +2252,19 @@ long SwBorderAttrs::CalcRight( const SwFrame* pCaller ) const
nRight += static_cast<const SwTextFrame*>(pCaller)->GetTextNodeForParaProps()->GetLeftMarginWithNum();
}
+ if (pCaller->IsPageFrame() && m_rLR)
+ {
+ const auto pPageFrame = static_cast<const SwPageFrame*>(pCaller);
+ bool bGutterAtTop = pPageFrame->GetFormat()->getIDocumentSettingAccess().get(
+ DocumentSettingId::GUTTER_AT_TOP);
+ if (!bGutterAtTop)
+ {
+ // Decrease the print area: the right space is the sum of right and right gutter
+ // margins.
+ nRight += m_rLR->GetRightGutterMargin();
+ }
+ }
+
return nRight;
}
diff --git a/sw/source/core/layout/pagedesc.cxx b/sw/source/core/layout/pagedesc.cxx
index 06c28a3e5a40..2e472d10ad14 100644
--- a/sw/source/core/layout/pagedesc.cxx
+++ b/sw/source/core/layout/pagedesc.cxx
@@ -153,6 +153,7 @@ void SwPageDesc::Mirror()
const SvxLRSpaceItem &rLR = m_Master.GetLRSpace();
aLR.SetLeft( rLR.GetRight() );
aLR.SetRight( rLR.GetLeft() );
+ aLR.SetRightGutterMargin(rLR.GetGutterMargin());
SfxItemSet aSet( *m_Master.GetAttrSet().GetPool(),
m_Master.GetAttrSet().GetRanges() );
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 6563256804f9..921699234913 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -1269,19 +1269,28 @@ static void lcl_CalcBorderRect( SwRect &rRect, const SwFrame *pFrame,
if (pFrame->IsPageFrame() && rAttrs.GetLRSpace())
{
long nGutterMargin = rAttrs.GetLRSpace()->GetGutterMargin();
+ long nRightGutterMargin = rAttrs.GetLRSpace()->GetRightGutterMargin();
const auto pPageFrame = static_cast<const SwPageFrame*>(pFrame);
bool bGutterAtTop = pPageFrame->GetFormat()->getIDocumentSettingAccess().get(
DocumentSettingId::GUTTER_AT_TOP);
- if (nGutterMargin && !bGutterAtTop)
- {
- // Paint the left border based on the left margin, ignoring the gutter margin.
- (rRect.*fnRect->fnSubLeft)(nGutterMargin);
- }
- else if (nGutterMargin)
+ if (bGutterAtTop)
{
// Paint the top border based on the top margin, ignoring the gutter margin.
(rRect.*fnRect->fnSubTop)(nGutterMargin);
}
+ else
+ {
+ if (nGutterMargin)
+ {
+ // Paint the left border based on the left margin, ignoring the gutter margin.
+ (rRect.*fnRect->fnSubLeft)(nGutterMargin);
+ }
+ if (nRightGutterMargin)
+ {
+ // Paint the right border based on the right margin, ignoring the gutter margin.
+ (rRect.*fnRect->fnAddRight)(nRightGutterMargin);
+ }
+ }
}
const SvxBoxItem &rBox = rAttrs.GetBox();