summaryrefslogtreecommitdiff
path: root/editeng/source/items
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2021-01-06 10:10:39 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-01-06 11:38:01 +0100
commit2298b055cab8cf8d0268ee1375a5c6e416bf1332 (patch)
tree1fe4b266d730e13591506434ccbbeefe9cd053ff /editeng/source/items
parent9b36cae4ca95ab9508752f2a13a45d09c3dbd87f (diff)
move the bigint based Scale() implementations to one central place
Picking the best looking one in the process. Change-Id: I77f9236fcd21f883a23fe2f43f20336f17b44cc6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108831 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'editeng/source/items')
-rw-r--r--editeng/source/items/borderline.cxx11
-rw-r--r--editeng/source/items/frmitems.cxx29
-rw-r--r--editeng/source/items/textitem.cxx5
3 files changed, 24 insertions, 21 deletions
diff --git a/editeng/source/items/borderline.cxx b/editeng/source/items/borderline.cxx
index 6a33b4bbcfc5..08261ed7165f 100644
--- a/editeng/source/items/borderline.cxx
+++ b/editeng/source/items/borderline.cxx
@@ -28,6 +28,7 @@
#include <editeng/itemtype.hxx>
#include <editeng/editrids.hrc>
#include <editeng/eerdll.hxx>
+#include <tools/bigint.hxx>
using namespace ::com::sun::star::table::BorderLineStyle;
@@ -496,23 +497,23 @@ void SvxBorderLine::GuessLinesWidths( SvxBorderLineStyle nStyle, sal_uInt16 nOut
sal_uInt16 SvxBorderLine::GetOutWidth() const
{
- sal_uInt16 nOut = static_cast<sal_uInt16>(Scale( m_aWidthImpl.GetLine1( m_nWidth ), m_nMult, m_nDiv ));
+ sal_uInt16 nOut = static_cast<sal_uInt16>(BigInt::Scale( m_aWidthImpl.GetLine1( m_nWidth ), m_nMult, m_nDiv ));
if ( m_bMirrorWidths )
- nOut = static_cast<sal_uInt16>(Scale( m_aWidthImpl.GetLine2( m_nWidth ), m_nMult, m_nDiv ));
+ nOut = static_cast<sal_uInt16>(BigInt::Scale( m_aWidthImpl.GetLine2( m_nWidth ), m_nMult, m_nDiv ));
return nOut;
}
sal_uInt16 SvxBorderLine::GetInWidth() const
{
- sal_uInt16 nIn = static_cast<sal_uInt16>(Scale( m_aWidthImpl.GetLine2( m_nWidth ), m_nMult, m_nDiv ));
+ sal_uInt16 nIn = static_cast<sal_uInt16>(BigInt::Scale( m_aWidthImpl.GetLine2( m_nWidth ), m_nMult, m_nDiv ));
if ( m_bMirrorWidths )
- nIn = static_cast<sal_uInt16>(Scale( m_aWidthImpl.GetLine1( m_nWidth ), m_nMult, m_nDiv ));
+ nIn = static_cast<sal_uInt16>(BigInt::Scale( m_aWidthImpl.GetLine1( m_nWidth ), m_nMult, m_nDiv ));
return nIn;
}
sal_uInt16 SvxBorderLine::GetDistance() const
{
- return static_cast<sal_uInt16>(Scale( m_aWidthImpl.GetGap( m_nWidth ), m_nMult, m_nDiv ));
+ return static_cast<sal_uInt16>(BigInt::Scale( m_aWidthImpl.GetGap( m_nWidth ), m_nMult, m_nDiv ));
}
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index 4f365da2b7de..43a9be8e4635 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -40,6 +40,7 @@
#include <comphelper/processfactory.hxx>
#include <vcl/GraphicObject.hxx>
#include <tools/urlobj.hxx>
+#include <tools/bigint.hxx>
#include <svl/memberid.h>
#include <rtl/math.hxx>
#include <rtl/ustring.hxx>
@@ -270,8 +271,8 @@ bool SvxSizeItem::GetPresentation
void SvxSizeItem::ScaleMetrics( tools::Long nMult, tools::Long nDiv )
{
- m_aSize.setWidth( Scale( m_aSize.Width(), nMult, nDiv ) );
- m_aSize.setHeight( Scale( m_aSize.Height(), nMult, nDiv ) );
+ m_aSize.setWidth( BigInt::Scale( m_aSize.Width(), nMult, nDiv ) );
+ m_aSize.setHeight( BigInt::Scale( m_aSize.Height(), nMult, nDiv ) );
}
@@ -572,10 +573,10 @@ bool SvxLRSpaceItem::GetPresentation
void SvxLRSpaceItem::ScaleMetrics( tools::Long nMult, tools::Long nDiv )
{
- nFirstLineOffset = static_cast<short>(Scale( nFirstLineOffset, nMult, nDiv ));
- nTxtLeft = Scale( nTxtLeft, nMult, nDiv );
- nLeftMargin = Scale( nLeftMargin, nMult, nDiv );
- nRightMargin = Scale( nRightMargin, nMult, nDiv );
+ nFirstLineOffset = static_cast<short>(BigInt::Scale( nFirstLineOffset, nMult, nDiv ));
+ nTxtLeft = BigInt::Scale( nTxtLeft, nMult, nDiv );
+ nLeftMargin = BigInt::Scale( nLeftMargin, nMult, nDiv );
+ nRightMargin = BigInt::Scale( nRightMargin, nMult, nDiv );
}
@@ -824,8 +825,8 @@ bool SvxULSpaceItem::GetPresentation
void SvxULSpaceItem::ScaleMetrics( tools::Long nMult, tools::Long nDiv )
{
- nUpper = static_cast<sal_uInt16>(Scale( nUpper, nMult, nDiv ));
- nLower = static_cast<sal_uInt16>(Scale( nLower, nMult, nDiv ));
+ nUpper = static_cast<sal_uInt16>(BigInt::Scale( nUpper, nMult, nDiv ));
+ nLower = static_cast<sal_uInt16>(BigInt::Scale( nLower, nMult, nDiv ));
}
@@ -1222,7 +1223,7 @@ bool SvxShadowItem::GetPresentation
void SvxShadowItem::ScaleMetrics( tools::Long nMult, tools::Long nDiv )
{
- nWidth = static_cast<sal_uInt16>(Scale( nWidth, nMult, nDiv ));
+ nWidth = static_cast<sal_uInt16>(BigInt::Scale( nWidth, nMult, nDiv ));
}
@@ -1862,10 +1863,10 @@ void SvxBoxItem::ScaleMetrics( tools::Long nMult, tools::Long nDiv )
if ( pBottom ) pBottom->ScaleMetrics( nMult, nDiv );
if ( pLeft ) pLeft->ScaleMetrics( nMult, nDiv );
if ( pRight ) pRight->ScaleMetrics( nMult, nDiv );
- nTopDist = static_cast<sal_uInt16>(Scale( nTopDist, nMult, nDiv ));
- nBottomDist = static_cast<sal_uInt16>(Scale( nBottomDist, nMult, nDiv ));
- nLeftDist = static_cast<sal_uInt16>(Scale( nLeftDist, nMult, nDiv ));
- nRightDist = static_cast<sal_uInt16>(Scale( nRightDist, nMult, nDiv ));
+ nTopDist = static_cast<sal_uInt16>(BigInt::Scale( nTopDist, nMult, nDiv ));
+ nBottomDist = static_cast<sal_uInt16>(BigInt::Scale( nBottomDist, nMult, nDiv ));
+ nLeftDist = static_cast<sal_uInt16>(BigInt::Scale( nLeftDist, nMult, nDiv ));
+ nRightDist = static_cast<sal_uInt16>(BigInt::Scale( nRightDist, nMult, nDiv ));
}
@@ -2162,7 +2163,7 @@ void SvxBoxInfoItem::ScaleMetrics( tools::Long nMult, tools::Long nDiv )
{
if ( pHori ) pHori->ScaleMetrics( nMult, nDiv );
if ( pVert ) pVert->ScaleMetrics( nMult, nDiv );
- nDefDist = static_cast<sal_uInt16>(Scale( nDefDist, nMult, nDiv ));
+ nDefDist = static_cast<sal_uInt16>(BigInt::Scale( nDefDist, nMult, nDiv ));
}
diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx
index 84cc8e743dec..dd2205b670ab 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -33,6 +33,7 @@
#include <editeng/editids.hrc>
#include <editeng/editrids.hrc>
+#include <tools/bigint.hxx>
#include <tools/mapunit.hxx>
#include <tools/UnitConversion.hxx>
@@ -835,7 +836,7 @@ bool SvxFontHeightItem::GetPresentation
void SvxFontHeightItem::ScaleMetrics( tools::Long nMult, tools::Long nDiv )
{
- nHeight = static_cast<sal_uInt32>(Scale( nHeight, nMult, nDiv ));
+ nHeight = static_cast<sal_uInt32>(BigInt::Scale( nHeight, nMult, nDiv ));
}
@@ -1496,7 +1497,7 @@ SvxKerningItem* SvxKerningItem::Clone( SfxItemPool * ) const
void SvxKerningItem::ScaleMetrics( tools::Long nMult, tools::Long nDiv )
{
- SetValue( static_cast<sal_Int16>(Scale( GetValue(), nMult, nDiv )) );
+ SetValue( static_cast<sal_Int16>(BigInt::Scale( GetValue(), nMult, nDiv )) );
}