summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2022-11-06 22:07:04 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2022-11-07 06:03:48 +0100
commit75395e0ccaeae2761a6b58bc36c8a5e32d49566f (patch)
tree6c6bfc7ebc3a757ddfdd45be7d96bcc451101d51 /starmath
parent6bc0576f8150ab1cc513c2b37347da43128dcb1c (diff)
Use o3tl::convert instead of temporary Fractions
Change-Id: I7e1f68e579e6520d17e0a058e6e0a8056e082c2a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142360 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'starmath')
-rw-r--r--starmath/source/view.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index 1bcfc0d3efc7..8898d10bf5a1 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -2295,8 +2295,10 @@ void SmViewShell::ZoomByItemSet(const SfxItemSet *pSet)
Size OutputSize(pPrinter->LogicToPixel(Size(OutputRect.GetWidth(),
OutputRect.GetHeight()), aMap));
Size GraphicSize(pPrinter->LogicToPixel(GetDoc()->GetSize(), aMap));
- sal_uInt16 nZ = sal::static_int_cast<sal_uInt16>(std::min(tools::Long(Fraction(OutputSize.Width() * 100, GraphicSize.Width())),
- tools::Long(Fraction(OutputSize.Height() * 100, GraphicSize.Height()))));
+ if (GraphicSize.Width() <= 0 || GraphicSize.Height() <= 0)
+ break;
+ sal_uInt16 nZ = std::min(o3tl::convert(OutputSize.Width(), 100, GraphicSize.Width()),
+ o3tl::convert(OutputSize.Height(), 100, GraphicSize.Height()));
mxGraphicWindow->SetZoom(nZ);
break;
}