[Libreoffice-commits] core.git: sw/inc sw/source
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jul 23 10:38:43 UTC 2021
sw/inc/swtypes.hxx | 4 ----
sw/source/core/layout/findfrm.cxx | 4 +++-
2 files changed, 3 insertions(+), 5 deletions(-)
New commits:
commit 27bb16a920d461f25d9ea69a0b515f6b85aff5b6
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Wed Jul 21 15:15:15 2021 +0900
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Fri Jul 23 12:38:03 2021 +0200
sw: get rid of MmToTwips function and use o3tl::convert instead
It's used in 1! place only (but could be others have been coverted
already).
Change-Id: I6ba9dbaf00afe7662321fa202eaaaa652d16e0b5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119395
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/sw/inc/swtypes.hxx b/sw/inc/swtypes.hxx
index 2a662a7ee2a2..e76b521b1f8b 100644
--- a/sw/inc/swtypes.hxx
+++ b/sw/inc/swtypes.hxx
@@ -52,10 +52,6 @@ typedef tools::Long SwTwips;
#define INVALID_TWIPS LONG_MAX
#define TWIPS_MAX (LONG_MAX - 1)
-// Converts Millimeters to Twips (1 mm == 56.905479 twips).
-template <typename T = SwTwips>
-constexpr T MmToTwips(const double mm) { return static_cast<T>(mm / 0.017573); }
-
#define MM50 283 // 1/2 cm in TWIPS.
const sal_Int32 COMPLETE_STRING = SAL_MAX_INT32;
diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx
index 3696e2a02e0c..f079b142297d 100644
--- a/sw/source/core/layout/findfrm.cxx
+++ b/sw/source/core/layout/findfrm.cxx
@@ -642,10 +642,12 @@ bool SwRootFrame::IsBetweenPages(const Point& rPt) const
const SwViewShell *pSh = GetCurrShell();
if (pSh && pSh->GetViewOptions()->IsWhitespaceHidden())
{
+ constexpr SwTwips constMargin = o3tl::convert(tools::Long(2), o3tl::Length::mm, o3tl::Length::twip);
+
// If we are really close to the bottom or top of a page.
const auto toEdge = std::min(std::abs(pPage->getFrameArea().Top() - rPt.Y()),
std::abs(pPage->getFrameArea().Bottom() - rPt.Y()));
- return toEdge <= MmToTwips(2.0);
+ return toEdge <= constMargin;
}
}
More information about the Libreoffice-commits
mailing list