summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-11-12 09:32:02 +0100
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-11-12 16:53:22 +0100
commitc45753847dfc2b4645dc2f7500a18ec2c5d438df (patch)
tree8d04962d7a4367a92d220beb0c35effb9490395b /starmath
parent768cfcee178b284be6d96d384364e59e40ecb375 (diff)
Revert "remove Fraction::operator tools::Long()"
This reverts commit 48b667a7e7d25f835f95df89162a7849d6972531. Reason for revert: some discussion required Change-Id: Ia0990d280837fb68b7ddc9f472ec78b1467b4311 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105540 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'starmath')
-rw-r--r--starmath/source/mathmlimport.cxx4
-rw-r--r--starmath/source/node.cxx6
-rw-r--r--starmath/source/utility.cxx4
-rw-r--r--starmath/source/view.cxx10
4 files changed, 12 insertions, 12 deletions
diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx
index 510b24852cee..7a3ca34b9a5a 100644
--- a/starmath/source/mathmlimport.cxx
+++ b/starmath/source/mathmlimport.cxx
@@ -1504,12 +1504,12 @@ bool lcl_CountBlanks(const MathMLAttributeLengthValue &rLV,
return false;
const Fraction aTwo(2, 1);
auto aWide = rLV.aNumber / aTwo;
- auto nWide = static_cast<sal_Int32>(aWide);
+ auto nWide = static_cast<sal_Int32>(static_cast<tools::Long>(aWide));
if (nWide < 0)
return false;
const Fraction aPointFive(1, 2);
auto aNarrow = (rLV.aNumber - Fraction(nWide, 1) * aTwo) / aPointFive;
- auto nNarrow = static_cast<sal_Int32>(aNarrow);
+ auto nNarrow = static_cast<sal_Int32>(static_cast<tools::Long>(aNarrow));
if (nNarrow < 0)
return false;
*pWide = nWide;
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index 6e88cff4dce0..3c78de3ba5b0 100644
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -154,7 +154,7 @@ void SmNode::SetFontSize(const Fraction &rSize, FontSizeType nType)
{
Fraction aVal (SmPtsTo100th_mm(rSize.GetNumerator()),
rSize.GetDenominator());
- tools::Long nHeight = static_cast<sal_Int32>(aVal);
+ tools::Long nHeight = static_cast<tools::Long>(aVal);
aFntSize = GetFont().GetFontSize();
aFntSize.setWidth( 0 );
@@ -173,12 +173,12 @@ void SmNode::SetFontSize(const Fraction &rSize, FontSizeType nType)
break;
case FontSizeType::MULTIPLY:
- aFntSize.setHeight( static_cast<sal_Int32>(Fraction(aFntSize.Height()) * rSize) );
+ aFntSize.setHeight( static_cast<tools::Long>(Fraction(aFntSize.Height()) * rSize) );
break;
case FontSizeType::DIVIDE:
if (rSize != Fraction(0))
- aFntSize.setHeight( static_cast<sal_Int32>(Fraction(aFntSize.Height()) / rSize) );
+ aFntSize.setHeight( static_cast<tools::Long>(Fraction(aFntSize.Height()) / rSize) );
break;
default:
break;
diff --git a/starmath/source/utility.cxx b/starmath/source/utility.cxx
index 8e04a3c0073d..7012004bea94 100644
--- a/starmath/source/utility.cxx
+++ b/starmath/source/utility.cxx
@@ -230,8 +230,8 @@ SmFace & operator *= (SmFace &rFace, const Fraction &rFrac)
// It's main use is to make scaling fonts look easier.
{ const Size &rFaceSize = rFace.GetFontSize();
- rFace.SetSize(Size(sal_Int32(rFaceSize.Width() * rFrac),
- sal_Int32(rFaceSize.Height() * rFrac)));
+ rFace.SetSize(Size(tools::Long(rFaceSize.Width() * rFrac),
+ tools::Long(rFaceSize.Height() * rFrac)));
return rFace;
}
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index b893dfb88529..638a41b2daa2 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -906,7 +906,7 @@ void SmViewShell::QueryObjAreaPixel( tools::Rectangle& rRect ) const
void SmViewShell::SetZoomFactor( const Fraction &rX, const Fraction &rY )
{
const Fraction &rFrac = std::min(rX, rY);
- GetGraphicWindow().SetZoom(sal::static_int_cast<sal_uInt16>(sal_Int32(rFrac * Fraction( 100, 1 ))));
+ GetGraphicWindow().SetZoom(sal::static_int_cast<sal_uInt16>(tools::Long(rFrac * Fraction( 100, 1 ))));
//To avoid rounding errors base class regulates crooked values too
//if necessary
@@ -1190,8 +1190,8 @@ void SmViewShell::Impl_Print(OutputDevice &rOutDev, const SmPrintUIOptions &rPri
Size OutputSize (rOutDev.LogicToPixel(Size(aOutRect.GetWidth(),
aOutRect.GetHeight()), MapMode(MapUnit::Map100thMM)));
Size GraphicSize (rOutDev.LogicToPixel(aSize, MapMode(MapUnit::Map100thMM)));
- sal_uInt16 nZ = sal::static_int_cast<sal_uInt16>(std::min(sal_Int32(Fraction(OutputSize.Width() * 100, GraphicSize.Width())),
- sal_Int32(Fraction(OutputSize.Height() * 100, GraphicSize.Height()))));
+ 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()))));
nZ -= 10;
Fraction aFraction (std::max(MINZOOM, std::min(MAXZOOM, nZ)), 100);
@@ -2012,8 +2012,8 @@ 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(sal_Int32(Fraction(OutputSize.Width() * 100, GraphicSize.Width())),
- sal_Int32(Fraction(OutputSize.Height() * 100, GraphicSize.Height()))));
+ 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()))));
mpGraphic->SetZoom (nZ);
break;
}