i18nutil/source/utility/paper.cxx |   16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

New commits:
commit ec40e3edd31319fb6cb919a38f44c861880efc5f
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Sat Apr 13 23:36:53 2024 +0500
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Sun Apr 14 06:54:24 2024 +0200

    Use more o3tl::convert
    
    Change-Id: I281ff1be4663d752a4e1a7e4d38556cefb641bd4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166060
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/i18nutil/source/utility/paper.cxx 
b/i18nutil/source/utility/paper.cxx
index c5150c384b60..8dea028ae445 100644
--- a/i18nutil/source/utility/paper.cxx
+++ b/i18nutil/source/utility/paper.cxx
@@ -17,7 +17,9 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
 
+#include <o3tl/unit_conversion.hxx>
 #include <officecfg/Setup.hxx>
 #include <officecfg/System.hxx>
 #include <sal/config.h>
@@ -49,17 +51,11 @@ struct PageDesc
     const char *m_pAltPSName;
 };
 
+constexpr tools::Long PT2MM100(double v) { return o3tl::convert(v, 
o3tl::Length::pt, o3tl::Length::mm100) + 0.5; }
+constexpr tools::Long IN2MM100(double v) { return o3tl::convert(v, 
o3tl::Length::in, o3tl::Length::mm100) + 0.5; }
+constexpr tools::Long MM2MM100(double v) { return o3tl::convert(v, 
o3tl::Length::mm, o3tl::Length::mm100) + 0.5; }
 }
 
-#define PT2MM100( v ) \
-    tools::Long(((v) * 35.27777778) + 0.5)
-
-#define IN2MM100( v ) \
-    (tools::Long(((v) * 2540) + 0.5))
-
-#define MM2MM100( v ) \
-    (tools::Long((v) * 100))
-
 //PostScript Printer Description File Format Specification
 //http://partners.adobe.com/public/developer/en/ps/5003.PPD_Spec_v4.3.pdf
 
//https://web.archive.org/web/20040912070512/http://www.y-adagio.com/public/committees/docsii/doc_00-49/symp_ulaan/china_ppr.pdf
 (Kai)
@@ -68,7 +64,7 @@ struct PageDesc
 //!! The order of these entries must correspond to enum Paper in 
<i18nutil/paper.hxx>
 
 // see XclPaperSize pPaperSizeTable in calc and ApiPaperSize in filter
-const PageDesc aDinTab[] =
+constexpr PageDesc aDinTab[] =
 {
     { MM2MM100( 841 ),   MM2MM100( 1189 ),   "A0",  nullptr },
     { MM2MM100( 594 ),   MM2MM100( 841 ),    "A1",  nullptr },

Reply via email to