diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-11-14 00:09:43 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-11-13 23:38:37 +0100 |
commit | 7b8f630db30ee0066a9f4b6e540368d2fcad7fa8 (patch) | |
tree | e40626d45db8a228defeca6e66aba9055974d0a6 /sw | |
parent | 44f20abf66ce3f9806ad95522d7d9ae698350499 (diff) |
Use o3tl::convert
Change-Id: I78db3001d602ec1a0847785b3c127b9d345f5af7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125173
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter4.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/doc/docdesc.cxx | 10 | ||||
-rw-r--r-- | sw/source/core/doc/number.cxx | 30 |
3 files changed, 30 insertions, 14 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx b/sw/qa/extras/uiwriter/uiwriter4.cxx index 4f8740cf9101..856281ea42e0 100644 --- a/sw/qa/extras/uiwriter/uiwriter4.cxx +++ b/sw/qa/extras/uiwriter/uiwriter4.cxx @@ -106,6 +106,7 @@ #include <com/sun/star/text/XTextViewCursorSupplier.hpp> #include <com/sun/star/text/XPageCursor.hpp> #include <o3tl/cppunittraitshelper.hxx> +#include <o3tl/unit_conversion.hxx> #include <osl/file.hxx> #include <osl/thread.hxx> #include <paratr.hxx> @@ -1475,7 +1476,8 @@ void SwUiWriterTest4::testTdf104425() = getXPath(pXmlDoc, "//page[2]/body/tab/row/infos/bounds", "height").toInt32(); sal_Int32 nHeight3 = getXPath(pXmlDoc, "//page[3]/body/tab/row/infos/bounds", "height").toInt32(); - double fSumHeight_mm = (nHeight1 + nHeight2 + nHeight3) * 25.4 / 1440.0; + double fSumHeight_mm = o3tl::convert<double>(nHeight1 + nHeight2 + nHeight3, o3tl::Length::twip, + o3tl::Length::mm); CPPUNIT_ASSERT_DOUBLES_EQUAL(700.0, fSumHeight_mm, 0.05); } diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx index 31058b4caf62..d22fee74ca79 100644 --- a/sw/source/core/doc/docdesc.cxx +++ b/sw/source/core/doc/docdesc.cxx @@ -90,17 +90,17 @@ static void lcl_DefaultPageFormat( sal_uInt16 nPoolFormatId, sal_Int32 nMinTop, nMinBottom, nMinLeft, nMinRight; if( RES_POOLPAGE_HTML == nPoolFormatId ) { - nMinRight = nMinTop = nMinBottom = o3tl::convert(1, o3tl::Length::cm, o3tl::Length::twip); - nMinLeft = o3tl::convert(2, o3tl::Length::cm, o3tl::Length::twip); + nMinRight = nMinTop = nMinBottom = o3tl::toTwips(1, o3tl::Length::cm); + nMinLeft = o3tl::toTwips(2, o3tl::Length::cm); } else if (!utl::ConfigManager::IsFuzzing() && MeasurementSystem::Metric == SvtSysLocale().GetLocaleData().getMeasurementSystemEnum() ) { - nMinTop = nMinBottom = nMinLeft = nMinRight = 1134; // 2 centimeters + nMinTop = nMinBottom = nMinLeft = nMinRight = o3tl::toTwips(2, o3tl::Length::cm); } else { - nMinTop = nMinBottom = 1440; // as in MS Word: 1 Inch - nMinLeft = nMinRight = 1800; // 1,25 Inch + nMinTop = nMinBottom = o3tl::toTwips(1, o3tl::Length::in); // as in MS Word + nMinLeft = nMinRight = o3tl::toTwips(1.25, o3tl::Length::in); } // set margins diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx index 2f4cdf32b304..acb142b09988 100644 --- a/sw/source/core/doc/number.cxx +++ b/sw/source/core/doc/number.cxx @@ -66,9 +66,16 @@ SwNumFormat* SwNumRule::saLabelAlignmentBaseFormats[ RULE_END ][ MAXLEVEL ] = { {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr } }; const sal_uInt16 SwNumRule::saDefNumIndents[ MAXLEVEL ] = { -//inch: 0,5 1,0 1,5 2,0 2,5 3,0 3,5 4,0 4,5 5,0 - 1440/4, 1440/2, 1440*3/4, 1440, 1440*5/4, 1440*3/2, 1440*7/4, 1440*2, - 1440*9/4, 1440*5/2 + o3tl::toTwips(25, o3tl::Length::in100), + o3tl::toTwips(50, o3tl::Length::in100), + o3tl::toTwips(75, o3tl::Length::in100), + o3tl::toTwips(100, o3tl::Length::in100), + o3tl::toTwips(125, o3tl::Length::in100), + o3tl::toTwips(150, o3tl::Length::in100), + o3tl::toTwips(175, o3tl::Length::in100), + o3tl::toTwips(200, o3tl::Length::in100), + o3tl::toTwips(225, o3tl::Length::in100), + o3tl::toTwips(250, o3tl::Length::in100), }; OUString SwNumRule::GetOutlineRuleName() @@ -391,13 +398,20 @@ SwNumRule::SwNumRule( const OUString& rNm, } // position-and-space mode LABEL_ALIGNMENT // first line indent of general numbering in inch: -0,25 inch - const tools::Long cFirstLineIndent = -1440/4; + const tools::Long cFirstLineIndent = o3tl::toTwips(-0.25, o3tl::Length::in); // indent values of general numbering in inch: - // 0,5 0,75 1,0 1,25 1,5 - // 1,75 2,0 2,25 2,5 2,75 const tools::Long cIndentAt[ MAXLEVEL ] = { - 1440/2, 1440*3/4, 1440, 1440*5/4, 1440*3/2, - 1440*7/4, 1440*2, 1440*9/4, 1440*5/2, 1440*11/4 }; + o3tl::toTwips(50, o3tl::Length::in100), + o3tl::toTwips(75, o3tl::Length::in100), + o3tl::toTwips(100, o3tl::Length::in100), + o3tl::toTwips(125, o3tl::Length::in100), + o3tl::toTwips(150, o3tl::Length::in100), + o3tl::toTwips(175, o3tl::Length::in100), + o3tl::toTwips(200, o3tl::Length::in100), + o3tl::toTwips(225, o3tl::Length::in100), + o3tl::toTwips(250, o3tl::Length::in100), + o3tl::toTwips(275, o3tl::Length::in100), + }; for( n = 0; n < MAXLEVEL; ++n ) { pFormat = new SwNumFormat; |