summaryrefslogtreecommitdiff
path: root/include
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 /include
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 'include')
-rw-r--r--include/editeng/itemtype.hxx12
-rw-r--r--include/tools/bigint.hxx3
2 files changed, 4 insertions, 11 deletions
diff --git a/include/editeng/itemtype.hxx b/include/editeng/itemtype.hxx
index 470bd99f16f2..4338d1ff9142 100644
--- a/include/editeng/itemtype.hxx
+++ b/include/editeng/itemtype.hxx
@@ -21,7 +21,7 @@
// forward ---------------------------------------------------------------
#include <rtl/ustring.hxx>
-#include <tools/bigint.hxx>
+#include <tools/long.hxx>
#include <tools/mapunit.hxx>
#include <editeng/editengdllapi.h>
@@ -35,16 +35,6 @@ EDITENG_DLLPUBLIC OUString GetMetricText( tools::Long nVal, MapUnit eSrcUnit, Ma
OUString GetColorString( const Color& rCol );
EDITENG_DLLPUBLIC const char* GetMetricId(MapUnit eUnit);
-
-inline tools::Long Scale( tools::Long nVal, tools::Long nMult, tools::Long nDiv )
-{
- BigInt aVal( nVal );
- aVal *= nMult;
- aVal += nDiv/2;
- aVal /= nDiv;
- return aVal;
-}
-
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/bigint.hxx b/include/tools/bigint.hxx
index 53f681609ecf..3299d56c5374 100644
--- a/include/tools/bigint.hxx
+++ b/include/tools/bigint.hxx
@@ -106,6 +106,9 @@ public:
BigInt& operator =( sal_Int32 nValue );
+ /* Scale and round value */
+ static tools::Long Scale(tools::Long nVal, tools::Long nMult, tools::Long nDiv);
+
friend inline BigInt operator +( const BigInt& rVal1, const BigInt& rVal2 );
friend inline BigInt operator -( const BigInt& rVal1, const BigInt& rVal2 );
friend inline BigInt operator *( const BigInt& rVal1, const BigInt& rVal2 );