diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2022-06-08 09:08:27 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2022-06-08 12:07:48 +0200 |
commit | 51942eafdb4439559b6d59f3becd4afab45277f0 (patch) | |
tree | fbf70bbd31358db2af6c68abec8518244c626e18 /editeng | |
parent | e216988657e20a1e52986f742ab60464697bcb41 (diff) |
DOC import: allow negative page border distances
In case the margin (distance between body frame and page frame) is
smaller than the border spacing (distance between border and page
frame), then we can map that to a negative border distance during the
import of DOCX files since commit
1f127a2b9e1c1daab0972f98fc8708ecb7afa299 (sw layout: allow negative page
border distances, 2022-06-07), but DOC import had the same problem.
The above commit intentionally kept the default behavior of
BorderDistanceFromWord() unchanged to avoid side effects in other
clients of that function (not DOCX import), but means that DOC import
was still broken.
Given that it turns out there are only 2 callers of
BorderDistanceFromWord(), fix the problem by allowing negative border
distances unconditionally: this simplifies code & SetBorderDistance() in
the DOC import will now get the correct border distance out of the box.
DOC export works out of the box without any additional work.
Change-Id: I6bf15b3c73823c9265218b7b3a7b869e131818db
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135484
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/items/frmitems.cxx | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index 9780af4904c0..c1b9e66de5a7 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -2452,7 +2452,7 @@ namespace editeng { void BorderDistanceFromWord(bool bFromEdge, sal_Int32& nMargin, sal_Int32& nBorderDistance, - sal_Int32 nBorderWidth, bool bAllowNegativeBorderDistance) + sal_Int32 nBorderWidth) { // See https://wiki.openoffice.org/wiki/Writer/MSInteroperability/PageBorder @@ -2479,15 +2479,7 @@ void BorderDistanceFromWord(bool bFromEdge, sal_Int32& nMargin, sal_Int32& nBord } else if (nNewBorderDistance < 0) { - if (bAllowNegativeBorderDistance) - { - nNewMargin = nMargin; - } - else - { - nNewMargin = std::max<sal_Int32>(nMargin - nBorderWidth, 0); - nNewBorderDistance = 0; - } + nNewMargin = nMargin; } nMargin = nNewMargin; |