Fraction->double in various

Change-Id: I268df0e036ae922762eaf39b82af0fff1759d7e0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202742
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2026-03-27 08:40:17 +01:00
parent 808643c1ad
commit c422ba15c1
4 changed files with 17 additions and 18 deletions
-1
View File
@@ -33,7 +33,6 @@ namespace vcl { class Window; }
class SfxInPlaceClient_Impl;
class SfxViewShell;
class SfxObjectShell;
class Fraction;
class ErrCodeMsg;
namespace tools { class Rectangle; }
+11 -11
View File
@@ -636,9 +636,9 @@ void DrawViewShell::GetStatusBarState(SfxItemSet& rSet)
{
Point aPos = GetActiveWindow()->PixelToLogic(maMousePos);
pPageView->LogicToPagePos(aPos);
Fraction aUIScale(GetDoc()->GetUIScale());
aPos.setX( ::tools::Long(aPos.X() / aUIScale) );
aPos.setY( ::tools::Long(aPos.Y() / aUIScale) );
double fUIScale(GetDoc()->GetUIScale());
aPos.setX( ::tools::Long(aPos.X() / fUIScale) );
aPos.setY( ::tools::Long(aPos.Y() / fUIScale) );
// position- and size items
if ( mpDrawView->IsAction() )
@@ -652,12 +652,12 @@ void DrawViewShell::GetStatusBarState(SfxItemSet& rSet)
{
pPageView->LogicToPagePos(aRect);
aPos = aRect.TopLeft();
aPos.setX( ::tools::Long(aPos.X() / aUIScale) );
aPos.setY( ::tools::Long(aPos.Y() / aUIScale) );
aPos.setX( ::tools::Long(aPos.X() / fUIScale) );
aPos.setY( ::tools::Long(aPos.Y() / fUIScale) );
rSet.Put( SfxPointItem( SID_ATTR_POSITION, aPos) );
Size aSize( aRect.Right() - aRect.Left(), aRect.Bottom() - aRect.Top() );
aSize.setHeight( ::tools::Long(aSize.Height() / aUIScale) );
aSize.setWidth( ::tools::Long(aSize.Width() / aUIScale) );
aSize.setHeight( ::tools::Long(aSize.Height() / fUIScale) );
aSize.setWidth( ::tools::Long(aSize.Width() / fUIScale) );
rSet.Put( SvxSizeItem( SID_ATTR_SIZE, aSize) );
}
}
@@ -671,13 +671,13 @@ void DrawViewShell::GetStatusBarState(SfxItemSet& rSet)
// Show the position of the selected shape(s)
Point aShapePosition (aRect.TopLeft());
aShapePosition.setX( ::tools::Long(aShapePosition.X() / aUIScale) );
aShapePosition.setY( ::tools::Long(aShapePosition.Y() / aUIScale) );
aShapePosition.setX( ::tools::Long(aShapePosition.X() / fUIScale) );
aShapePosition.setY( ::tools::Long(aShapePosition.Y() / fUIScale) );
rSet.Put (SfxPointItem(SID_ATTR_POSITION, aShapePosition));
Size aSize( aRect.Right() - aRect.Left(), aRect.Bottom() - aRect.Top() );
aSize.setHeight( ::tools::Long(aSize.Height() / aUIScale) );
aSize.setWidth( ::tools::Long(aSize.Width() / aUIScale) );
aSize.setHeight( ::tools::Long(aSize.Height() / fUIScale) );
aSize.setWidth( ::tools::Long(aSize.Width() / fUIScale) );
rSet.Put( SvxSizeItem( SID_ATTR_SIZE, aSize) );
}
else
+2 -2
View File
@@ -1466,8 +1466,8 @@ bool lcl_CountBlanks(const MathMLAttributeLengthValue& rLV, sal_Int32* pWide, sa
auto nWide = static_cast<sal_Int32>(static_cast<tools::Long>(aWide));
if (nWide < 0)
return false;
const Fraction aPointFive(1, 2);
auto aNarrow = (rLV.fNumber - nWide * 2) / aPointFive;
const double fPointFive = 0.5;
auto aNarrow = (rLV.fNumber - nWide * 2) / fPointFive;
auto nNarrow = static_cast<sal_Int32>(static_cast<tools::Long>(aNarrow));
if (nNarrow < 0)
return false;
+4 -4
View File
@@ -139,8 +139,8 @@ void SmNode::SetFontSize(double fSize, FontSizeType nType)
if (!(Flags() & FontChangeMask::Size))
{
Fraction aVal(conversionFract(o3tl::Length::pt, SmO3tlLengthUnit()) * fSize);
tools::Long nHeight = static_cast<tools::Long>(aVal);
double fVal(conversionFract(o3tl::Length::pt, SmO3tlLengthUnit()) * fSize);
tools::Long nHeight = static_cast<tools::Long>(fVal);
aFntSize = GetFont().GetFontSize();
aFntSize.setWidth( 0 );
@@ -159,12 +159,12 @@ void SmNode::SetFontSize(double fSize, FontSizeType nType)
break;
case FontSizeType::MULTIPLY:
aFntSize.setHeight( static_cast<tools::Long>(Fraction(aFntSize.Height()) * fSize) );
aFntSize.setHeight( static_cast<tools::Long>(aFntSize.Height() * fSize) );
break;
case FontSizeType::DIVIDE:
if (fSize != 0)
aFntSize.setHeight( static_cast<tools::Long>(Fraction(aFntSize.Height()) / fSize) );
aFntSize.setHeight( static_cast<tools::Long>(aFntSize.Height() / fSize) );
break;
default:
break;