summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--editeng/source/items/frmitems.cxx68
-rw-r--r--editeng/source/items/numitem.cxx4
-rw-r--r--editeng/source/items/paraitem.cxx8
-rw-r--r--editeng/source/items/textitem.cxx34
-rw-r--r--include/tools/UnitConversion.hxx4
-rw-r--r--sc/qa/unit/ucalc.cxx8
-rw-r--r--sc/source/core/data/drwlayer.cxx13
-rw-r--r--sc/source/core/data/patattr.cxx6
-rw-r--r--sc/source/core/tool/docoptio.cxx2
-rw-r--r--sc/source/filter/oox/worksheethelper.cxx4
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx12
-rw-r--r--sc/source/ui/unoobj/defltuno.cxx2
-rw-r--r--sc/source/ui/unoobj/docuno.cxx8
-rw-r--r--sc/source/ui/unoobj/styleuno.cxx2
-rw-r--r--sc/source/ui/view/cellsh3.cxx12
-rw-r--r--sd/qa/unit/tiledrendering/tiledrendering.cxx56
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx2
-rw-r--r--svl/source/items/ptitem.cxx6
-rw-r--r--svx/source/dialog/rulritem.cxx12
-rw-r--r--svx/source/items/algitem.cxx8
-rw-r--r--svx/source/items/grfitem.cxx8
-rw-r--r--svx/source/table/svdotable.cxx24
-rw-r--r--svx/source/table/tablertfexporter.cxx2
-rw-r--r--svx/source/unodraw/SvxXTextColumns.cxx2
-rw-r--r--svx/source/xoutdev/xattr.cxx2
-rw-r--r--sw/qa/core/layout/layout.cxx8
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx8
-rw-r--r--sw/source/core/draw/dflyobj.cxx8
-rw-r--r--sw/source/core/inc/rootfrm.hxx2
-rw-r--r--sw/source/core/layout/atrfrm.cxx18
-rw-r--r--sw/source/core/para/paratr.cxx4
-rw-r--r--sw/source/core/unocore/unodraw.cxx6
-rw-r--r--sw/source/core/unocore/unoidx.cxx2
-rw-r--r--sw/source/core/unocore/unosett.cxx22
-rw-r--r--sw/source/core/unocore/unotbl.cxx20
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx8
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.cxx4
-rw-r--r--sw/source/filter/xml/xmltexti.cxx4
-rw-r--r--sw/source/uibase/app/appopt.cxx2
-rw-r--r--sw/source/uibase/app/docshini.cxx2
-rw-r--r--sw/source/uibase/config/fontcfg.cxx2
-rw-r--r--sw/source/uibase/config/modcfg.cxx8
-rw-r--r--sw/source/uibase/config/usrpref.cxx4
-rw-r--r--sw/source/uibase/envelp/envimg.cxx16
-rw-r--r--sw/source/uibase/envelp/labelcfg.cxx16
-rw-r--r--sw/source/uibase/envelp/labimg.cxx16
-rw-r--r--sw/source/uibase/shells/grfsh.cxx8
-rw-r--r--sw/source/uibase/uiview/view.cxx12
-rw-r--r--sw/source/uibase/uno/unomod.cxx4
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx12
-rw-r--r--sw/source/uibase/utlui/uiitems.cxx4
-rw-r--r--tools/qa/cppunit/test_100mm2twips.cxx7
-rw-r--r--vcl/source/filter/ipdf/pdfread.cxx12
-rw-r--r--writerfilter/source/dmapper/NumberingManager.cxx4
-rw-r--r--xmloff/source/transform/TransformerBase.cxx2
55 files changed, 267 insertions, 287 deletions
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index add9c3654f65..6aec451c8024 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -181,8 +181,8 @@ bool SvxSizeItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
{
if(bConvert)
{
- aTmp.Height = convertMm100ToTwip(aTmp.Height);
- aTmp.Width = convertMm100ToTwip(aTmp.Width);
+ aTmp.Height = o3tl::toTwips(aTmp.Height, o3tl::Length::mm100);
+ aTmp.Width = o3tl::toTwips(aTmp.Width, o3tl::Length::mm100);
}
m_aSize = Size( aTmp.Width, aTmp.Height );
}
@@ -198,7 +198,7 @@ bool SvxSizeItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
if(!(rVal >>= nVal ))
return false;
- m_aSize.setWidth( bConvert ? convertMm100ToTwip(nVal) : nVal );
+ m_aSize.setWidth( bConvert ? o3tl::toTwips(nVal, o3tl::Length::mm100) : nVal );
}
break;
case MID_SIZE_HEIGHT:
@@ -207,7 +207,7 @@ bool SvxSizeItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
if(!(rVal >>= nVal))
return true;
- m_aSize.setHeight( bConvert ? convertMm100ToTwip(nVal) : nVal );
+ m_aSize.setHeight( bConvert ? o3tl::toTwips(nVal, o3tl::Length::mm100) : nVal );
}
break;
default: OSL_FAIL("Wrong MemberId!");
@@ -407,26 +407,26 @@ bool SvxLRSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
if(!(rVal >>= aLRSpace))
return false;
- SetLeft( bConvert ? convertMm100ToTwip(aLRSpace.Left) : aLRSpace.Left );
- SetTextLeft( bConvert ? convertMm100ToTwip(aLRSpace.TextLeft) : aLRSpace.TextLeft );
- SetRight(bConvert ? convertMm100ToTwip(aLRSpace.Right) : aLRSpace.Right);
+ SetLeft( bConvert ? o3tl::toTwips(aLRSpace.Left, o3tl::Length::mm100) : aLRSpace.Left );
+ SetTextLeft( bConvert ? o3tl::toTwips(aLRSpace.TextLeft, o3tl::Length::mm100) : aLRSpace.TextLeft );
+ SetRight(bConvert ? o3tl::toTwips(aLRSpace.Right, o3tl::Length::mm100) : aLRSpace.Right);
nPropLeftMargin = aLRSpace.ScaleLeft;
nPropRightMargin = aLRSpace.ScaleRight;
- SetTextFirstLineOffset(static_cast<short>(bConvert ? convertMm100ToTwip(aLRSpace.FirstLine) : aLRSpace.FirstLine));
- SetPropTextFirstLineOffset ( static_cast<sal_uInt16>(aLRSpace.ScaleFirstLine) );
+ SetTextFirstLineOffset(bConvert ? o3tl::toTwips(aLRSpace.FirstLine, o3tl::Length::mm100) : aLRSpace.FirstLine);
+ SetPropTextFirstLineOffset ( aLRSpace.ScaleFirstLine );
SetAutoFirst( aLRSpace.AutoFirstLine );
break;
}
case MID_L_MARGIN:
- SetLeft( bConvert ? convertMm100ToTwip(nVal) : nVal );
+ SetLeft( bConvert ? o3tl::toTwips(nVal, o3tl::Length::mm100) : nVal );
break;
case MID_TXT_LMARGIN :
- SetTextLeft( bConvert ? convertMm100ToTwip(nVal) : nVal );
+ SetTextLeft( bConvert ? o3tl::toTwips(nVal, o3tl::Length::mm100) : nVal );
break;
case MID_R_MARGIN:
- SetRight(bConvert ? convertMm100ToTwip(nVal) : nVal);
+ SetRight(bConvert ? o3tl::toTwips(nVal, o3tl::Length::mm100) : nVal);
break;
case MID_L_REL_MARGIN:
case MID_R_REL_MARGIN:
@@ -444,11 +444,11 @@ bool SvxLRSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
}
break;
case MID_FIRST_LINE_INDENT :
- SetTextFirstLineOffset(static_cast<short>(bConvert ? convertMm100ToTwip(nVal) : nVal));
+ SetTextFirstLineOffset(bConvert ? o3tl::toTwips(nVal, o3tl::Length::mm100) : nVal);
break;
case MID_FIRST_LINE_REL_INDENT:
- SetPropTextFirstLineOffset ( static_cast<sal_uInt16>(nVal) );
+ SetPropTextFirstLineOffset ( nVal );
break;
case MID_FIRST_AUTO:
@@ -456,7 +456,7 @@ bool SvxLRSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
break;
case MID_GUTTER_MARGIN:
- SetGutterMargin(bConvert ? convertMm100ToTwip(nVal) : nVal);
+ SetGutterMargin(bConvert ? o3tl::toTwips(nVal, o3tl::Length::mm100) : nVal);
break;
default:
@@ -716,8 +716,8 @@ bool SvxULSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
if ( !(rVal >>= aUpperLowerMarginScale ))
return false;
{
- SetUpper(static_cast<sal_uInt16>(bConvert ? convertMm100ToTwip( aUpperLowerMarginScale.Upper ) : aUpperLowerMarginScale.Upper));
- SetLower(static_cast<sal_uInt16>(bConvert ? convertMm100ToTwip( aUpperLowerMarginScale.Lower ) : aUpperLowerMarginScale.Lower));
+ SetUpper(bConvert ? o3tl::toTwips(aUpperLowerMarginScale.Upper, o3tl::Length::mm100) : aUpperLowerMarginScale.Upper);
+ SetLower(bConvert ? o3tl::toTwips(aUpperLowerMarginScale.Lower, o3tl::Length::mm100) : aUpperLowerMarginScale.Lower);
if( aUpperLowerMarginScale.ScaleUpper > 1 )
nPropUpper = aUpperLowerMarginScale.ScaleUpper;
if( aUpperLowerMarginScale.ScaleLower > 1 )
@@ -728,12 +728,12 @@ bool SvxULSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
case MID_UP_MARGIN :
if(!(rVal >>= nVal))
return false;
- SetUpper(static_cast<sal_uInt16>(bConvert ? convertMm100ToTwip(nVal) : nVal));
+ SetUpper(bConvert ? o3tl::toTwips(nVal, o3tl::Length::mm100) : nVal);
break;
case MID_LO_MARGIN :
if(!(rVal >>= nVal) || nVal < 0)
return false;
- SetLower(static_cast<sal_uInt16>(bConvert ? convertMm100ToTwip(nVal) : nVal));
+ SetLower(bConvert ? o3tl::toTwips(nVal, o3tl::Length::mm100) : nVal);
break;
case MID_CTX_MARGIN :
if (!(rVal >>= bVal))
@@ -1125,7 +1125,7 @@ bool SvxShadowItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
default: ; // prevent warning
}
- nWidth = bConvert ? convertMm100ToTwip(aShadow.ShadowWidth) : aShadow.ShadowWidth;
+ nWidth = bConvert ? o3tl::toTwips(aShadow.ShadowWidth, o3tl::Length::mm100) : aShadow.ShadowWidth;
Color aSet(ColorTransparency, aShadow.Color);
aShadowColor = aSet;
}
@@ -1462,9 +1462,9 @@ lcl_lineToSvxLine(const table::BorderLine& rLine, SvxBorderLine& rSvxLine, bool
if ( bGuessWidth )
{
rSvxLine.GuessLinesWidths( rSvxLine.GetBorderLineStyle(),
- sal_uInt16( bConvert ? convertMm100ToTwip(rLine.OuterLineWidth) : rLine.OuterLineWidth ),
- sal_uInt16( bConvert ? convertMm100ToTwip(rLine.InnerLineWidth) : rLine.InnerLineWidth ),
- sal_uInt16( bConvert ? convertMm100ToTwip(rLine.LineDistance ) : rLine.LineDistance ));
+ bConvert ? o3tl::toTwips(rLine.OuterLineWidth, o3tl::Length::mm100) : rLine.OuterLineWidth,
+ bConvert ? o3tl::toTwips(rLine.InnerLineWidth, o3tl::Length::mm100) : rLine.InnerLineWidth,
+ bConvert ? o3tl::toTwips(rLine.LineDistance, o3tl::Length::mm100) : rLine.LineDistance );
}
bool bRet = !rSvxLine.isEmpty();
@@ -1492,7 +1492,7 @@ SvxBoxItem::LineToSvxLine(const css::table::BorderLine2& rLine, SvxBorderLine& r
bool bGuessWidth = true;
if ( rLine.LineWidth )
{
- rSvxLine.SetWidth( bConvert? convertMm100ToTwip( rLine.LineWidth ) : rLine.LineWidth );
+ rSvxLine.SetWidth( bConvert? o3tl::toTwips(rLine.LineWidth, o3tl::Length::mm100) : rLine.LineWidth );
// fdo#46112: double does not necessarily mean symmetric
// for backwards compatibility
bGuessWidth = (SvxBorderLineStyle::DOUBLE == nStyle || SvxBorderLineStyle::DOUBLE_THIN == nStyle) &&
@@ -1573,11 +1573,11 @@ bool SvxBoxItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
if ( aSeq[n] >>= nDist )
{
if( bConvert )
- nDist = convertMm100ToTwip(nDist);
+ nDist = o3tl::toTwips(nDist, o3tl::Length::mm100);
if ( n == 4 )
- SetAllDistances(sal_uInt16(nDist));
+ SetAllDistances(nDist);
else
- SetDistance( sal_uInt16( nDist ), nLines[n-5] );
+ SetDistance( nDist, nLines[n-5] );
}
else
return false;
@@ -1650,7 +1650,7 @@ bool SvxBoxItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
tools::Long nWidth(0);
rVal >>= nWidth;
if( bConvert )
- nWidth = convertMm100ToTwip( nWidth );
+ nWidth = o3tl::toTwips(nWidth, o3tl::Length::mm100);
// Set the line Width on all borders
for( SvxBoxItemLine n : o3tl::enumrange<SvxBoxItemLine>() )
@@ -1672,11 +1672,11 @@ bool SvxBoxItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
if(nDist >= 0)
{
if( bConvert )
- nDist = convertMm100ToTwip(nDist);
+ nDist = o3tl::toTwips(nDist, o3tl::Length::mm100);
if( nMemberId == BORDER_DISTANCE )
- SetAllDistances(sal_uInt16(nDist));
+ SetAllDistances(nDist);
else
- SetDistance( sal_uInt16( nDist ), nLine );
+ SetDistance( nDist, nLine );
}
}
else
@@ -2294,8 +2294,8 @@ bool SvxBoxInfoItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
if (( aSeq[4] >>= nVal ) && ( nVal >= 0 ))
{
if( bConvert )
- nVal = convertMm100ToTwip(nVal);
- SetDefDist( static_cast<sal_uInt16>(nVal) );
+ nVal = o3tl::toTwips(nVal, o3tl::Length::mm100);
+ SetDefDist( nVal );
}
}
return true;
@@ -2411,7 +2411,7 @@ bool SvxBoxInfoItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
if ( bRet && nVal>=0 )
{
if( bConvert )
- nVal = convertMm100ToTwip(nVal);
+ nVal = o3tl::toTwips(nVal, o3tl::Length::mm100);
SetDefDist( static_cast<sal_uInt16>(nVal) );
}
break;
diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx
index 12ee8dbe533d..229ac4affd2c 100644
--- a/editeng/source/items/numitem.cxx
+++ b/editeng/source/items/numitem.cxx
@@ -671,8 +671,8 @@ SvxNumRule::SvxNumRule( SvxNumRuleFlags nFeatures,
if ( eDefaultNumberFormatPositionAndSpaceMode ==
SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
{
- aFmts[i]->SetAbsLSpace( convertMm100ToTwip(DEF_WRITER_LSPACE * (i+1)) );
- aFmts[i]->SetFirstLineOffset(convertMm100ToTwip(-DEF_WRITER_LSPACE));
+ aFmts[i]->SetAbsLSpace(o3tl::toTwips(DEF_WRITER_LSPACE * (i+1), o3tl::Length::mm100));
+ aFmts[i]->SetFirstLineOffset(o3tl::toTwips(-DEF_WRITER_LSPACE, o3tl::Length::mm100));
}
else if ( eDefaultNumberFormatPositionAndSpaceMode ==
SvxNumberFormat::LABEL_ALIGNMENT )
diff --git a/editeng/source/items/paraitem.cxx b/editeng/source/items/paraitem.cxx
index 4dc508a6939f..3d097e7f040d 100644
--- a/editeng/source/items/paraitem.cxx
+++ b/editeng/source/items/paraitem.cxx
@@ -188,7 +188,7 @@ bool SvxLineSpacingItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
eLineSpaceRule = SvxLineSpaceRule::Auto;
nInterLineSpace = aLSp.Height;
if(bConvert)
- nInterLineSpace = static_cast<short>(convertMm100ToTwip(nInterLineSpace));
+ nInterLineSpace = o3tl::toTwips(nInterLineSpace, o3tl::Length::mm100);
}
break;
@@ -209,7 +209,7 @@ bool SvxLineSpacingItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
eLineSpaceRule = aLSp.Mode == style::LineSpacingMode::FIX ? SvxLineSpaceRule::Fix : SvxLineSpaceRule::Min;
nLineHeight = aLSp.Height;
if(bConvert)
- nLineHeight = static_cast<sal_uInt16>(convertMm100ToTwip(nLineHeight));
+ nLineHeight = o3tl::toTwips(nLineHeight, o3tl::Length::mm100);
}
break;
}
@@ -880,7 +880,7 @@ bool SvxTabStopItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
}
sal_Unicode cFill = pArr[i].FillChar;
sal_Unicode cDecimal = pArr[i].DecimalChar;
- SvxTabStop aTab( bConvert ? convertMm100ToTwip(pArr[i].Position) : pArr[i].Position,
+ SvxTabStop aTab( bConvert ? o3tl::toTwips(pArr[i].Position, o3tl::Length::mm100) : pArr[i].Position,
eAdjust,
cDecimal,
cFill );
@@ -894,7 +894,7 @@ bool SvxTabStopItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
if (!(rVal >>= nNewPos) )
return false;
if (bConvert)
- nNewPos = convertMm100ToTwip ( nNewPos );
+ nNewPos = o3tl::toTwips(nNewPos, o3tl::Length::mm100);
if (nNewPos <= 0)
return false;
const SvxTabStop& rTab = maTabStops.front();
diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx
index 433352b4653f..64236dd542f1 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -594,33 +594,30 @@ bool SvxFontHeightItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
// CONVERT_TWIPS is not set.
if( bConvert )
{
- aFontHeight.Height = static_cast<float>( nHeight / 20.0 );
+ aFontHeight.Height = o3tl::convert<double>(nHeight, o3tl::Length::twip, o3tl::Length::pt);
}
else
{
- double fPoints = convertMm100ToTwip(nHeight) / 20.0;
- float fRoundPoints =
- static_cast<float>(::rtl::math::round(fPoints, 1));
- aFontHeight.Height = fRoundPoints;
+ double fPoints = o3tl::convert<double>(nHeight, o3tl::Length::mm100, o3tl::Length::pt);
+ aFontHeight.Height = rtl::math::round(fPoints, 1);
}
- aFontHeight.Prop = static_cast<sal_Int16>(MapUnit::MapRelative == ePropUnit ? nProp : 100);
+ aFontHeight.Prop = MapUnit::MapRelative == ePropUnit ? nProp : 100;
- float fRet = static_cast<float>(static_cast<short>(nProp));
+ float fRet = nProp;
switch( ePropUnit )
{
case MapUnit::MapRelative:
fRet = 0.;
break;
case MapUnit::Map100thMM:
- fRet = convertMm100ToTwip(fRet);
- fRet /= 20.;
+ fRet = o3tl::convert(fRet, o3tl::Length::mm100, o3tl::Length::pt);
break;
case MapUnit::MapPoint:
break;
case MapUnit::MapTwip:
- fRet /= 20.;
+ fRet = o3tl::convert(fRet, o3tl::Length::twip, o3tl::Length::pt);
break;
default: ;//prevent warning
}
@@ -634,14 +631,12 @@ bool SvxFontHeightItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
// CONVERT_TWIPS is not set.
if( bConvert )
{
- rVal <<= static_cast<float>( nHeight / 20.0 );
+ rVal <<= static_cast<float>(o3tl::convert<double>(nHeight, o3tl::Length::twip, o3tl::Length::pt));
}
else
{
- double fPoints = convertMm100ToTwip(nHeight) / 20.0;
- float fRoundPoints =
- static_cast<float>(::rtl::math::round(fPoints, 1));
- rVal <<= fRoundPoints;
+ double fPoints = o3tl::convert<double>(nHeight, o3tl::Length::mm100, o3tl::Length::pt);
+ rVal <<= static_cast<float>(::rtl::math::round(fPoints, 1));
}
}
break;
@@ -650,21 +645,20 @@ bool SvxFontHeightItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
break;
case MID_FONTHEIGHT_DIFF:
{
- float fRet = static_cast<float>(static_cast<short>(nProp));
+ float fRet = nProp;
switch( ePropUnit )
{
case MapUnit::MapRelative:
fRet = 0.;
break;
case MapUnit::Map100thMM:
- fRet = convertMm100ToTwip(fRet);
- fRet /= 20.;
+ fRet = o3tl::convert(fRet, o3tl::Length::mm100, o3tl::Length::pt);
break;
case MapUnit::MapPoint:
break;
case MapUnit::MapTwip:
- fRet /= 20.;
+ fRet = o3tl::convert(fRet, o3tl::Length::twip, o3tl::Length::pt);
break;
default: ;//prevent warning
}
@@ -1500,7 +1494,7 @@ bool SvxKerningItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId)
if(!(rVal >>= nVal))
return false;
if(nMemberId & CONVERT_TWIPS)
- nVal = static_cast<sal_Int16>(convertMm100ToTwip(nVal));
+ nVal = o3tl::toTwips(nVal, o3tl::Length::mm100);
SetValue(nVal);
return true;
}
diff --git a/include/tools/UnitConversion.hxx b/include/tools/UnitConversion.hxx
index 7d3bdf565c1d..43237e0514c5 100644
--- a/include/tools/UnitConversion.hxx
+++ b/include/tools/UnitConversion.hxx
@@ -94,10 +94,6 @@ template <typename N> constexpr auto convertTwipToMm100(N n)
{
return o3tl::convert(n, o3tl::Length::twip, o3tl::Length::mm100);
}
-template <typename N> constexpr auto convertMm100ToTwip(N n)
-{
- return o3tl::convert(n, o3tl::Length::mm100, o3tl::Length::twip);
-}
constexpr sal_Int64 sanitiseMm100ToTwip(sal_Int64 n)
{
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 5f2145714e3a..18dec103b552 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -5125,10 +5125,10 @@ void Test::testAnchoredRotatedShape()
CPPUNIT_ASSERT_MESSAGE("must have a draw layer", pDrawLayer != nullptr);
SdrPage* pPage = pDrawLayer->GetPage(0);
CPPUNIT_ASSERT_MESSAGE("must have a draw page", pPage != nullptr);
- m_pDoc->SetRowHeightRange(0, MAXROW, 0, convertMm100ToTwip(1000));
+ m_pDoc->SetRowHeightRange(0, MAXROW, 0, o3tl::toTwips(1000, o3tl::Length::mm100));
constexpr tools::Long TOLERANCE = 30; //30 hmm
for ( SCCOL nCol = 0; nCol < MAXCOL; ++nCol )
- m_pDoc->SetColWidth(nCol, 0, convertMm100ToTwip(1000));
+ m_pDoc->SetColWidth(nCol, 0, o3tl::toTwips(1000, o3tl::Length::mm100));
{
//Add a rect
tools::Rectangle aRect( 4000, 5000, 10000, 7000 );
@@ -5160,9 +5160,9 @@ void Test::testAnchoredRotatedShape()
m_pDoc->SetDrawPageSize(0);
// increase row 5 by 2000 hmm
- m_pDoc->SetRowHeight(5, 0, convertMm100ToTwip(3000));
+ m_pDoc->SetRowHeight(5, 0, o3tl::toTwips(3000, o3tl::Length::mm100));
// increase col 6 by 1000 hmm
- m_pDoc->SetColWidth(6, 0, convertMm100ToTwip(2000));
+ m_pDoc->SetColWidth(6, 0, o3tl::toTwips(2000, o3tl::Length::mm100));
aRotRect.setWidth( aRotRect.GetWidth() + 1000 );
aRotRect.setHeight( aRotRect.GetHeight() + 2000 );
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 79b52627e015..58c9b8585ecf 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -209,10 +209,7 @@ ScTabSizeChangedHint::~ScTabSizeChangedHint()
static void lcl_ReverseTwipsToMM( tools::Rectangle& rRect )
{
- rRect.SetLeft(convertMm100ToTwip(rRect.Left()));
- rRect.SetRight(convertMm100ToTwip(rRect.Right()));
- rRect.SetTop(convertMm100ToTwip(rRect.Top()));
- rRect.SetBottom(convertMm100ToTwip(rRect.Bottom()));
+ rRect = o3tl::convert(rRect, o3tl::Length::mm100, o3tl::Length::twip);
}
static ScRange lcl_getClipRangeFromClipDoc(ScDocument* pClipDoc, SCTAB nClipTab)
@@ -1344,8 +1341,8 @@ bool ScDrawLayer::GetPrintArea( ScRange& rRange, bool bSetHor, bool bSetVer ) co
if (bSetHor)
{
- nStartX = convertMm100ToTwip(nStartX);
- nEndX = convertMm100ToTwip(nEndX);
+ nStartX = o3tl::toTwips(nStartX, o3tl::Length::mm100);
+ nEndX = o3tl::toTwips(nEndX, o3tl::Length::mm100);
tools::Long nWidth;
nWidth = 0;
@@ -1381,8 +1378,8 @@ bool ScDrawLayer::GetPrintArea( ScRange& rRange, bool bSetHor, bool bSetVer ) co
if (bSetVer)
{
- nStartY = convertMm100ToTwip(nStartY);
- nEndY = convertMm100ToTwip(nEndY);
+ nStartY = o3tl::toTwips(nStartY, o3tl::Length::mm100);
+ nEndY = o3tl::toTwips(nEndY, o3tl::Length::mm100);
SCROW nRow = pDoc->GetRowForHeight( nTab, nStartY);
rRange.aStart.SetRow( nRow>0 ? (nRow-1) : 0);
nRow = pDoc->GetRowForHeight( nTab, nEndY);
diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index fb8e7aee033f..5ce565a98257 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -792,13 +792,13 @@ void ScPatternAttr::GetFromEditItemSet( SfxItemSet& rDestSet, const SfxItemSet&
rDestSet.Put( *static_cast<const SvxFontItem*>(pItem), ATTR_CTL_FONT );
if (rEditSet.GetItemState(EE_CHAR_FONTHEIGHT,true,&pItem) == SfxItemState::SET)
- rDestSet.Put( SvxFontHeightItem( convertMm100ToTwip( static_cast<const SvxFontHeightItem*>(pItem)->GetHeight() ),
+ rDestSet.Put( SvxFontHeightItem(o3tl::toTwips(static_cast<const SvxFontHeightItem*>(pItem)->GetHeight(), o3tl::Length::mm100),
100, ATTR_FONT_HEIGHT ) );
if (rEditSet.GetItemState(EE_CHAR_FONTHEIGHT_CJK,true,&pItem) == SfxItemState::SET)
- rDestSet.Put( SvxFontHeightItem( convertMm100ToTwip( static_cast<const SvxFontHeightItem*>(pItem)->GetHeight() ),
+ rDestSet.Put( SvxFontHeightItem(o3tl::toTwips(static_cast<const SvxFontHeightItem*>(pItem)->GetHeight(), o3tl::Length::mm100),
100, ATTR_CJK_FONT_HEIGHT ) );
if (rEditSet.GetItemState(EE_CHAR_FONTHEIGHT_CTL,true,&pItem) == SfxItemState::SET)
- rDestSet.Put( SvxFontHeightItem( convertMm100ToTwip( static_cast<const SvxFontHeightItem*>(pItem)->GetHeight() ),
+ rDestSet.Put( SvxFontHeightItem(o3tl::toTwips(static_cast<const SvxFontHeightItem*>(pItem)->GetHeight(), o3tl::Length::mm100),
100, ATTR_CTL_FONT_HEIGHT ) );
if (rEditSet.GetItemState(EE_CHAR_WEIGHT,true,&pItem) == SfxItemState::SET)
diff --git a/sc/source/core/tool/docoptio.cxx b/sc/source/core/tool/docoptio.cxx
index 5810bff6e8ea..2b54cd2a52d1 100644
--- a/sc/source/core/tool/docoptio.cxx
+++ b/sc/source/core/tool/docoptio.cxx
@@ -272,7 +272,7 @@ ScDocCfg::ScDocCfg() :
case SCDOCLAYOUTOPT_TABSTOP:
// TabDistance in ScDocOptions is in twips
if (pValues[nProp] >>= nIntVal)
- SetTabDistance(static_cast<sal_uInt16>(convertMm100ToTwip(nIntVal)));
+ SetTabDistance(o3tl::toTwips(nIntVal, o3tl::Length::mm100));
break;
}
}
diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx
index 6d07bfd57cad..a5fc023f8a99 100644
--- a/sc/source/filter/oox/worksheethelper.cxx
+++ b/sc/source/filter/oox/worksheethelper.cxx
@@ -1222,7 +1222,7 @@ void WorksheetGlobals::convertColumns( OutlineLevelVec& orColLevels,
{
for( SCCOL nCol = nStartCol; nCol <= nEndCol; ++nCol )
{
- rDoc.SetColWidthOnly(nCol, nTab, static_cast<sal_uInt16>(convertMm100ToTwip(nWidth)));
+ rDoc.SetColWidthOnly(nCol, nTab, o3tl::toTwips(nWidth, o3tl::Length::mm100));
}
}
@@ -1278,7 +1278,7 @@ void WorksheetGlobals::convertRows(OutlineLevelVec& orRowLevels, const ValueRang
/* always import the row height, ensures better layout */
ScDocument& rDoc = getScDocument();
rDoc.SetRowHeightOnly(nStartRow, nEndRow, nTab,
- static_cast<sal_uInt16>(convertMm100ToTwip(nHeight)));
+ o3tl::toTwips(nHeight, o3tl::Length::mm100));
if(rModel.mbCustomHeight)
rDoc.SetManualHeight( nStartRow, nEndRow, nTab, true );
}
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 21be10d87a39..8828d4dd2af8 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -951,7 +951,7 @@ template<typename TableBorderType>
void lcl_fillBoxItems( SvxBoxItem& rOuter, SvxBoxInfoItem& rInner, const TableBorderType& rBorder )
{
::editeng::SvxBorderLine aLine;
- rOuter.SetAllDistances(static_cast<sal_uInt16>(convertMm100ToTwip(rBorder.Distance)));
+ rOuter.SetAllDistances(o3tl::toTwips(rBorder.Distance, o3tl::Length::mm100));
rOuter.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.TopLine ), SvxBoxItemLine::TOP );
rOuter.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.BottomLine ), SvxBoxItemLine::BOTTOM );
rOuter.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.LeftLine ), SvxBoxItemLine::LEFT );
@@ -2074,7 +2074,7 @@ static void lcl_SetCellProperty( const SfxItemPropertyMapEntry& rEntry, const un
if ( !(rValue >>= nIntVal) )
throw lang::IllegalArgumentException();
- rSet.Put(ScIndentItem(static_cast<sal_uInt16>(convertMm100ToTwip(nIntVal))));
+ rSet.Put(ScIndentItem(o3tl::toTwips(nIntVal, o3tl::Length::mm100)));
}
break;
@@ -8385,9 +8385,9 @@ void ScTableColumnObj::SetOnePropertyValue(const SfxItemPropertyMapEntry* pEntry
if ( aValue >>= nNewWidth )
{
// property is 1/100mm, column width is twips
- nNewWidth = convertMm100ToTwip(nNewWidth);
+ nNewWidth = o3tl::toTwips(nNewWidth, o3tl::Length::mm100);
rFunc.SetWidthOrHeight(
- true, aColArr, nTab, SC_SIZE_ORIGINAL, static_cast<sal_uInt16>(nNewWidth), true, true);
+ true, aColArr, nTab, SC_SIZE_ORIGINAL, nNewWidth, true, true);
}
}
else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
@@ -8522,9 +8522,9 @@ void ScTableRowObj::SetOnePropertyValue( const SfxItemPropertyMapEntry* pEntry,
if ( aValue >>= nNewHeight )
{
// property is 1/100mm, row height is twips
- nNewHeight = convertMm100ToTwip(nNewHeight);
+ nNewHeight = o3tl::toTwips(nNewHeight, o3tl::Length::mm100);
rFunc.SetWidthOrHeight(
- false, aRowArr, nTab, SC_SIZE_ORIGINAL, static_cast<sal_uInt16>(nNewHeight), true, true);
+ false, aRowArr, nTab, SC_SIZE_ORIGINAL, nNewHeight, true, true);
}
}
else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
diff --git a/sc/source/ui/unoobj/defltuno.cxx b/sc/source/ui/unoobj/defltuno.cxx
index ae2fe0242892..7015985e5a74 100644
--- a/sc/source/ui/unoobj/defltuno.cxx
+++ b/sc/source/ui/unoobj/defltuno.cxx
@@ -147,7 +147,7 @@ void SAL_CALL ScDocDefaultsObj::setPropertyValue(
sal_Int32 nValue = 0;
if (aValue >>= nValue)
{
- aDocOpt.SetTabDistance(static_cast<sal_uInt16>(convertMm100ToTwip(nValue)));
+ aDocOpt.SetTabDistance(o3tl::toTwips(nValue, o3tl::Length::mm100));
rDoc.SetDocOptions(aDocOpt);
}
}
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 5cb03d5aa39b..405f6c11842b 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -4113,7 +4113,7 @@ void SAL_CALL ScTableColumnsObj::setPropertyValue(
sal_Int32 nNewWidth = 0;
if ( aValue >>= nNewWidth )
rFunc.SetWidthOrHeight(
- true, aColArr, nTab, SC_SIZE_ORIGINAL, static_cast<sal_uInt16>(convertMm100ToTwip(nNewWidth)), true, true);
+ true, aColArr, nTab, SC_SIZE_ORIGINAL, o3tl::toTwips(nNewWidth, o3tl::Length::mm100), true, true);
}
else if ( aPropertyName == SC_UNONAME_CELLVIS )
{
@@ -4328,7 +4328,7 @@ void SAL_CALL ScTableRowsObj::setPropertyValue(
// TODO: It's probably cleaner to use a different property name
// for this.
- rDoc.SetRowHeightOnly( nStartRow, nEndRow, nTab, static_cast<sal_uInt16>(convertMm100ToTwip(nNewHeight)) );
+ rDoc.SetRowHeightOnly( nStartRow, nEndRow, nTab, o3tl::toTwips(nNewHeight, o3tl::Length::mm100) );
}
else
{
@@ -4351,12 +4351,12 @@ void SAL_CALL ScTableRowsObj::setPropertyValue(
// TODO: This is a band-aid fix. Eventually we need to
// re-work ods' style import to get it to set styles to
// ScDocument directly.
- rDoc.SetRowHeightOnly( nStartRow, nEndRow, nTab, static_cast<sal_uInt16>(convertMm100ToTwip(nNewHeight)) );
+ rDoc.SetRowHeightOnly( nStartRow, nEndRow, nTab, o3tl::toTwips(nNewHeight, o3tl::Length::mm100) );
rDoc.SetManualHeight( nStartRow, nEndRow, nTab, true );
}
else
rFunc.SetWidthOrHeight(
- false, aRowArr, nTab, SC_SIZE_ORIGINAL, static_cast<sal_uInt16>(convertMm100ToTwip(nNewHeight)), true, true);
+ false, aRowArr, nTab, SC_SIZE_ORIGINAL, o3tl::toTwips(nNewHeight, o3tl::Length::mm100), true, true);
}
}
else if ( aPropertyName == SC_UNONAME_CELLVIS )
diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx
index 98568aa82994..3ad29af9e515 100644
--- a/sc/source/ui/unoobj/styleuno.cxx
+++ b/sc/source/ui/unoobj/styleuno.cxx
@@ -1543,7 +1543,7 @@ void ScStyleObj::setPropertyValue_Impl( std::u16string_view rPropertyName, const
{
sal_Int16 nVal = 0;
*pValue >>= nVal;
- rSet.Put(ScIndentItem(static_cast<sal_uInt16>(convertMm100ToTwip(nVal))));
+ rSet.Put(ScIndentItem(o3tl::toTwips(nVal, o3tl::Length::mm100)));
}
break;
case ATTR_ROTATE_VALUE:
diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx
index e3f9c79368e0..088c403168d6 100644
--- a/sc/source/ui/view/cellsh3.cxx
+++ b/sc/source/ui/view/cellsh3.cxx
@@ -671,7 +671,7 @@ void ScCellShell::Execute( SfxRequest& rReq )
aRanges.emplace_back(nRow, nRow);
}
- pTabViewShell->SetWidthOrHeight(false, aRanges, SC_SIZE_DIRECT, convertMm100ToTwip(nHeight));
+ pTabViewShell->SetWidthOrHeight(false, aRanges, SC_SIZE_DIRECT, o3tl::toTwips(nHeight, o3tl::Length::mm100));
}
else if ( pReqArgs && pReqArgs->HasItem( FID_ROW_HEIGHT, &pHeight ) )
{
@@ -679,7 +679,7 @@ void ScCellShell::Execute( SfxRequest& rReq )
// #101390#; the value of the macro is in HMM so use convertMm100ToTwip to convert
pTabViewShell->SetMarkedWidthOrHeight( false, SC_SIZE_DIRECT,
- sal::static_int_cast<sal_uInt16>(convertMm100ToTwip(nHeight)));
+ o3tl::toTwips(nHeight, o3tl::Length::mm100));
if( ! rReq.IsAPI() )
rReq.Done();
}
@@ -718,7 +718,7 @@ void ScCellShell::Execute( SfxRequest& rReq )
// #101390#; the value of the macro is in HMM so use convertMm100ToTwip to convert
pTabViewShell->SetMarkedWidthOrHeight( false, SC_SIZE_OPTIMAL,
- sal::static_int_cast<sal_uInt16>( convertMm100ToTwip(rUInt16Item.GetValue()) ) );
+ o3tl::toTwips(rUInt16Item.GetValue(), o3tl::Length::mm100) );
ScGlobal::nLastRowHeightExtra = rUInt16Item.GetValue();
if( ! rReq.IsAPI() )
@@ -770,7 +770,7 @@ void ScCellShell::Execute( SfxRequest& rReq )
aRanges.emplace_back(nColumn, nColumn);
}
- pTabViewShell->SetWidthOrHeight(true, aRanges, SC_SIZE_DIRECT, convertMm100ToTwip(nWidth));
+ pTabViewShell->SetWidthOrHeight(true, aRanges, SC_SIZE_DIRECT, o3tl::toTwips(nWidth, o3tl::Length::mm100));
}
else if ( pReqArgs && pReqArgs->HasItem( FID_COL_WIDTH, &pWidth ) )
{
@@ -778,7 +778,7 @@ void ScCellShell::Execute( SfxRequest& rReq )
// #101390#; the value of the macro is in HMM so use convertMm100ToTwip to convert
pTabViewShell->SetMarkedWidthOrHeight( true, SC_SIZE_DIRECT,
- sal::static_int_cast<sal_uInt16>(convertMm100ToTwip(nWidth)));
+ o3tl::toTwips(nWidth, o3tl::Length::mm100));
if( ! rReq.IsAPI() )
rReq.Done();
}
@@ -815,7 +815,7 @@ void ScCellShell::Execute( SfxRequest& rReq )
// #101390#; the value of the macro is in HMM so use convertMm100ToTwip to convert
pTabViewShell->SetMarkedWidthOrHeight( true, SC_SIZE_OPTIMAL,
- sal::static_int_cast<sal_uInt16>( convertMm100ToTwip(rUInt16Item.GetValue()) ) );
+ o3tl::toTwips(rUInt16Item.GetValue(), o3tl::Length::mm100) );
ScGlobal::nLastColWidthExtra = rUInt16Item.GetValue();
if( ! rReq.IsAPI() )
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 1bdd4c30386a..156c52f7b066 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -465,10 +465,10 @@ void SdTiledRenderingTest::testPostMouseEvent()
Point aPosition(pCursor->GetPos().getX(), pCursor->GetPos().getY() + pCursor->GetSize().Height() / 2);
aPosition.setX(aPosition.getX() - 1000);
pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN,
- convertMm100ToTwip(aPosition.getX()), convertMm100ToTwip(aPosition.getY()),
+ o3tl::toTwips(aPosition.getX(), o3tl::Length::mm100), o3tl::toTwips(aPosition.getY(), o3tl::Length::mm100),
1, MOUSE_LEFT, 0);
pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP,
- convertMm100ToTwip(aPosition.getX()), convertMm100ToTwip(aPosition.getY()),
+ o3tl::toTwips(aPosition.getX(), o3tl::Length::mm100), o3tl::toTwips(aPosition.getY(), o3tl::Length::mm100),
1, MOUSE_LEFT, 0);
Scheduler::ProcessEventsToIdle();
CPPUNIT_ASSERT(pView->GetTextEditObject());
@@ -542,8 +542,8 @@ void SdTiledRenderingTest::testSetGraphicSelection()
CPPUNIT_ASSERT_EQUAL(int(SdrHdlKind::Lower), static_cast<int>(pHdl->GetKind()));
::tools::Rectangle aShapeBefore = pObject->GetSnapRect();
// Resize.
- pXImpressDocument->setGraphicSelection(LOK_SETGRAPHICSELECTION_START, convertMm100ToTwip(pHdl->GetPos().getX()), convertMm100ToTwip(pHdl->GetPos().getY()));
- pXImpressDocument->setGraphicSelection(LOK_SETGRAPHICSELECTION_END, convertMm100ToTwip(pHdl->GetPos().getX()), convertMm100ToTwip(pHdl->GetPos().getY() + 1000));
+ pXImpressDocument->setGraphicSelection(LOK_SETGRAPHICSELECTION_START, o3tl::toTwips(pHdl->GetPos().getX(), o3tl::Length::mm100), o3tl::toTwips(pHdl->GetPos().getY(), o3tl::Length::mm100));
+ pXImpressDocument->setGraphicSelection(LOK_SETGRAPHICSELECTION_END, o3tl::toTwips(pHdl->GetPos().getX(), o3tl::Length::mm100), o3tl::toTwips(pHdl->GetPos().getY() + 1000, o3tl::Length::mm100));
// Assert that view shell ID tracking works.
sal_Int32 nView1 = SfxLokHelper::getView();
@@ -810,8 +810,8 @@ void SdTiledRenderingTest::testResizeTable()
// Resize the upper row, decrease its height by 1 cm.
Point aInnerRowEdge = pObject->GetSnapRect().Center();
- pXImpressDocument->setGraphicSelection(LOK_SETGRAPHICSELECTION_START, convertMm100ToTwip(aInnerRowEdge.getX()), convertMm100ToTwip(aInnerRowEdge.getY()));
- pXImpressDocument->setGraphicSelection(LOK_SETGRAPHICSELECTION_END, convertMm100ToTwip(aInnerRowEdge.getX()), convertMm100ToTwip(aInnerRowEdge.getY() - 1000));
+ pXImpressDocument->setGraphicSelection(LOK_SETGRAPHICSELECTION_START, o3tl::toTwips(aInnerRowEdge.getX(), o3tl::Length::mm100), o3tl::toTwips(aInnerRowEdge.getY(), o3tl::Length::mm100));
+ pXImpressDocument->setGraphicSelection(LOK_SETGRAPHICSELECTION_END, o3tl::toTwips(aInnerRowEdge.getX(), o3tl::Length::mm100), o3tl::toTwips(aInnerRowEdge.getY() - 1000, o3tl::Length::mm100));
// Remember the resized row heights.
sal_Int32 nResizedRow1 = xRow1->getPropertyValue("Size").get<sal_Int32>();
@@ -855,8 +855,8 @@ void SdTiledRenderingTest::testResizeTableColumn()
// Resize the left column, decrease its width by 1 cm.
Point aInnerRowEdge = pObject->GetSnapRect().Center();
- pXImpressDocument->setGraphicSelection(LOK_SETGRAPHICSELECTION_START, convertMm100ToTwip(aInnerRowEdge.getX()), convertMm100ToTwip(aInnerRowEdge.getY()));
- pXImpressDocument->setGraphicSelection(LOK_SETGRAPHICSELECTION_END, convertMm100ToTwip(aInnerRowEdge.getX() - 1000), convertMm100ToTwip(aInnerRowEdge.getY()));
+ pXImpressDocument->setGraphicSelection(LOK_SETGRAPHICSELECTION_START, o3tl::toTwips(aInnerRowEdge.getX(), o3tl::Length::mm100), o3tl::toTwips(aInnerRowEdge.getY(), o3tl::Length::mm100));
+ pXImpressDocument->setGraphicSelection(LOK_SETGRAPHICSELECTION_END, o3tl::toTwips(aInnerRowEdge.getX() - 1000, o3tl::Length::mm100), o3tl::toTwips(aInnerRowEdge.getY(), o3tl::Length::mm100));
// Remember the resized column widths.
pXmlDoc = parseXmlDump();
@@ -1131,8 +1131,8 @@ void SdTiledRenderingTest::testCursorVisibility_SingleClick()
// Click once outside of the text (in the first quartile) => no editing.
const ::tools::Rectangle aRect = pTextObject->GetCurrentBoundRect();
- const auto cornerX = convertMm100ToTwip(aRect.getX() + (aRect.getWidth() / 4));
- const auto cornerY = convertMm100ToTwip(aRect.getY() + (aRect.getHeight() / 4));
+ const auto cornerX = o3tl::toTwips(aRect.getX() + (aRect.getWidth() / 4), o3tl::Length::mm100);
+ const auto cornerY = o3tl::toTwips(aRect.getY() + (aRect.getHeight() / 4), o3tl::Length::mm100);
pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN,
cornerX, cornerY,
1, MOUSE_LEFT, 0);
@@ -1146,8 +1146,8 @@ void SdTiledRenderingTest::testCursorVisibility_SingleClick()
CPPUNIT_ASSERT(!aView1.m_bCursorVisible);
// Click again, now on the text, in the center, to start editing.
- const auto centerX = convertMm100ToTwip(aRect.getX() + (aRect.getWidth() / 2));
- const auto centerY = convertMm100ToTwip(aRect.getY() + (aRect.getHeight() / 2));
+ const auto centerX = o3tl::toTwips(aRect.getX() + (aRect.getWidth() / 2), o3tl::Length::mm100);
+ const auto centerY = o3tl::toTwips(aRect.getY() + (aRect.getHeight() / 2), o3tl::Length::mm100);
pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN,
centerX, centerY,
1, MOUSE_LEFT, 0);
@@ -1180,8 +1180,8 @@ void SdTiledRenderingTest::testCursorVisibility_DoubleClick()
// Double-click outside the text to enter edit mode.
const ::tools::Rectangle aRect = pTextObject->GetCurrentBoundRect();
- const auto cornerX = convertMm100ToTwip(aRect.getX() + (aRect.getWidth() / 4));
- const auto cornerY = convertMm100ToTwip(aRect.getY() + (aRect.getHeight() / 4));
+ const auto cornerX = o3tl::toTwips(aRect.getX() + (aRect.getWidth() / 4), o3tl::Length::mm100);
+ const auto cornerY = o3tl::toTwips(aRect.getY() + (aRect.getHeight() / 4), o3tl::Length::mm100);
pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN,
cornerX, cornerY,
2, MOUSE_LEFT, 0);
@@ -1224,8 +1224,8 @@ void SdTiledRenderingTest::testCursorVisibility_MultiView()
SfxLokHelper::setView(nView1);
::tools::Rectangle aRect = pTextObject->GetCurrentBoundRect();
- const auto centerX = convertMm100ToTwip(aRect.getX() + (aRect.getWidth() / 2));
- const auto centerY = convertMm100ToTwip(aRect.getY() + (aRect.getHeight() / 2));
+ const auto centerX = o3tl::toTwips(aRect.getX() + (aRect.getWidth() / 2), o3tl::Length::mm100);
+ const auto centerY = o3tl::toTwips(aRect.getY() + (aRect.getHeight() / 2), o3tl::Length::mm100);
pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN,
centerX, centerY,
2, MOUSE_LEFT, 0);
@@ -1260,8 +1260,8 @@ void SdTiledRenderingTest::testCursorVisibility_Escape()
// Click once on the text to start editing.
const ::tools::Rectangle aRect = pTextObject->GetCurrentBoundRect();
- const auto centerX = convertMm100ToTwip(aRect.getX() + (aRect.getWidth() / 2));
- const auto centerY = convertMm100ToTwip(aRect.getY() + (aRect.getHeight() / 2));
+ const auto centerX = o3tl::toTwips(aRect.getX() + (aRect.getWidth() / 2), o3tl::Length::mm100);
+ const auto centerY = o3tl::toTwips(aRect.getY() + (aRect.getHeight() / 2), o3tl::Length::mm100);
pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN,
centerX, centerY,
1, MOUSE_LEFT, 0);
@@ -1441,10 +1441,10 @@ void SdTiledRenderingTest::testTdf102223()
// select contents of cell
::tools::Rectangle aRect = pTableObject->GetCurrentBoundRect();
pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN,
- convertMm100ToTwip(aRect.getX() + 2), convertMm100ToTwip(aRect.getY() + 2),
+ o3tl::toTwips(aRect.getX() + 2, o3tl::Length::mm100), o3tl::toTwips(aRect.getY() + 2, o3tl::Length::mm100),
1, MOUSE_LEFT, 0);
pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP,
- convertMm100ToTwip(aRect.getX() + 2), convertMm100ToTwip(aRect.getY() + 2),
+ o3tl::toTwips(aRect.getX() + 2, o3tl::Length::mm100), o3tl::toTwips(aRect.getY() + 2, o3tl::Length::mm100),
1, MOUSE_LEFT, 0);
Scheduler::ProcessEventsToIdle();
pView->SdrBeginTextEdit(pTableObject);
@@ -1484,10 +1484,10 @@ void SdTiledRenderingTest::testTdf118354()
// Without the fix, it would crash here
::tools::Rectangle aRect = pTableObject->GetCurrentBoundRect();
pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN,
- convertMm100ToTwip(aRect.getX() + 2), convertMm100ToTwip(aRect.getY() + 2),
+ o3tl::toTwips(aRect.getX() + 2, o3tl::Length::mm100), o3tl::toTwips(aRect.getY() + 2, o3tl::Length::mm100),
1, MOUSE_LEFT, 0);
pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP,
- convertMm100ToTwip(aRect.getX() + 2), convertMm100ToTwip(aRect.getY() + 2),
+ o3tl::toTwips(aRect.getX() + 2, o3tl::Length::mm100), o3tl::toTwips(aRect.getY() + 2, o3tl::Length::mm100),
1, MOUSE_LEFT, 0);
Scheduler::ProcessEventsToIdle();
@@ -1554,10 +1554,10 @@ void SdTiledRenderingTest::testTdf103083()
// select contents of bullet item
::tools::Rectangle aRect = pTextObject->GetCurrentBoundRect();
pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN,
- convertMm100ToTwip(aRect.getX() + 2), convertMm100ToTwip(aRect.getY() + 2),
+ o3tl::toTwips(aRect.getX() + 2, o3tl::Length::mm100), o3tl::toTwips(aRect.getY() + 2, o3tl::Length::mm100),
1, MOUSE_LEFT, 0);
pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP,
- convertMm100ToTwip(aRect.getX() + 2), convertMm100ToTwip(aRect.getY() + 2),
+ o3tl::toTwips(aRect.getX() + 2, o3tl::Length::mm100), o3tl::toTwips(aRect.getY() + 2, o3tl::Length::mm100),
1, MOUSE_LEFT, 0);
Scheduler::ProcessEventsToIdle();
pView->SdrBeginTextEdit(pTextObject);
@@ -1643,10 +1643,10 @@ void SdTiledRenderingTest::testTdf104405()
rEditView2.SetSelection(ESelection(0, 0, 0, 3)); // start para, start char, end para, end char.
::tools::Rectangle aRect = pTableObject->GetCurrentBoundRect();
pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN,
- convertMm100ToTwip(aRect.getX()), convertMm100ToTwip(aRect.getY()),
+ o3tl::toTwips(aRect.getX(), o3tl::Length::mm100), o3tl::toTwips(aRect.getY(), o3tl::Length::mm100),
1, MOUSE_LEFT, 0);
pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP,
- convertMm100ToTwip(aRect.getX()), convertMm100ToTwip(aRect.getY()),
+ o3tl::toTwips(aRect.getX(), o3tl::Length::mm100), o3tl::toTwips(aRect.getY(), o3tl::Length::mm100),
1, MOUSE_LEFT, 0);
Scheduler::ProcessEventsToIdle();
@@ -2025,8 +2025,8 @@ void SdTiledRenderingTest::testMultiViewInsertDeletePage2()
// Double-click outside the text to enter edit mode.
const ::tools::Rectangle aRect = pTextObject->GetCurrentBoundRect();
- const auto cornerX = convertMm100ToTwip(aRect.getX() + (aRect.getWidth() / 4));
- const auto cornerY = convertMm100ToTwip(aRect.getY() + (aRect.getHeight() / 4));
+ const auto cornerX = o3tl::toTwips(aRect.getX() + (aRect.getWidth() / 4), o3tl::Length::mm100);
+ const auto cornerY = o3tl::toTwips(aRect.getY() + (aRect.getHeight() / 4), o3tl::Length::mm100);
pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN,
cornerX, cornerY,
2, MOUSE_LEFT, 0);
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 91c9254eb39a..e44ee53a7899 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2386,7 +2386,7 @@ Size SdXImpressDocument::getDocumentSize()
Size aSize = pCurPageView->GetPageRect().GetSize();
// Convert the size in 100th mm to TWIP
// See paintTile above for further info.
- return Size(convertMm100ToTwip(aSize.getWidth()), convertMm100ToTwip(aSize.getHeight()));
+ return o3tl::convert(aSize, o3tl::Length::mm100, o3tl::Length::twip);
}
void SdXImpressDocument::getPostIts(::tools::JsonWriter& rJsonWriter)
diff --git a/svl/source/items/ptitem.cxx b/svl/source/items/ptitem.cxx
index 407627dcb27e..361cb4f4fc7d 100644
--- a/svl/source/items/ptitem.cxx
+++ b/svl/source/items/ptitem.cxx
@@ -107,15 +107,15 @@ bool SfxPointItem::PutValue( const uno::Any& rVal,
bRet = ( rVal >>= aValue );
if( bConvert )
{
- aValue.X = convertMm100ToTwip(aValue.X);
- aValue.Y = convertMm100ToTwip(aValue.Y);
+ aValue.X = o3tl::toTwips(aValue.X, o3tl::Length::mm100);
+ aValue.Y = o3tl::toTwips(aValue.Y, o3tl::Length::mm100);
}
}
else
{
bRet = ( rVal >>= nVal );
if( bConvert )
- nVal = convertMm100ToTwip( nVal );
+ nVal = o3tl::toTwips(nVal, o3tl::Length::mm100);
}
if ( bRet )
diff --git a/svx/source/dialog/rulritem.cxx b/svx/source/dialog/rulritem.cxx
index c9973fdd7462..830475293402 100644
--- a/svx/source/dialog/rulritem.cxx
+++ b/svx/source/dialog/rulritem.cxx
@@ -90,15 +90,15 @@ bool SvxLongLRSpaceItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberI
css::frame::status::LeftRightMargin aLeftRightMargin;
if ( rVal >>= aLeftRightMargin )
{
- mlLeft = bConvert ? convertMm100ToTwip(aLeftRightMargin.Left) : aLeftRightMargin.Left;
- mlRight = bConvert ? convertMm100ToTwip(aLeftRightMargin.Right) : aLeftRightMargin.Right;
+ mlLeft = bConvert ? o3tl::toTwips(aLeftRightMargin.Left, o3tl::Length::mm100) : aLeftRightMargin.Left;
+ mlRight = bConvert ? o3tl::toTwips(aLeftRightMargin.Right, o3tl::Length::mm100) : aLeftRightMargin.Right;
return true;
}
}
else if ( rVal >>= nVal )
{
if ( bConvert )
- nVal = convertMm100ToTwip( nVal );
+ nVal = o3tl::toTwips(nVal, o3tl::Length::mm100);
switch( nMemberId )
{
@@ -209,15 +209,15 @@ bool SvxLongULSpaceItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberI
css::frame::status::UpperLowerMargin aUpperLowerMargin;
if ( rVal >>= aUpperLowerMargin )
{
- mlLeft = bConvert ? convertMm100ToTwip( aUpperLowerMargin.Upper ) : aUpperLowerMargin.Upper;
- mlRight = bConvert ? convertMm100ToTwip( aUpperLowerMargin.Lower ) : aUpperLowerMargin.Lower;
+ mlLeft = bConvert ? o3tl::toTwips(aUpperLowerMargin.Upper, o3tl::Length::mm100) : aUpperLowerMargin.Upper;
+ mlRight = bConvert ? o3tl::toTwips(aUpperLowerMargin.Lower, o3tl::Length::mm100) : aUpperLowerMargin.Lower;
return true;
}
}
else if ( rVal >>= nVal )
{
if ( bConvert )
- nVal = convertMm100ToTwip( nVal );
+ nVal = o3tl::toTwips(nVal, o3tl::Length::mm100);
switch( nMemberId )
{
diff --git a/svx/source/items/algitem.cxx b/svx/source/items/algitem.cxx
index 470096993f47..96783e822ef5 100644
--- a/svx/source/items/algitem.cxx
+++ b/svx/source/items/algitem.cxx
@@ -269,16 +269,16 @@ bool SvxMarginItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
switch ( nMemberId & ~CONVERT_TWIPS )
{
case MID_MARGIN_L_MARGIN:
- nLeftMargin = static_cast<sal_Int16>( bConvert ? convertMm100ToTwip(nVal) : nVal );
+ nLeftMargin = static_cast<sal_Int16>( bConvert ? o3tl::toTwips(nVal, o3tl::Length::mm100) : nVal );
break;
case MID_MARGIN_R_MARGIN:
- nRightMargin = static_cast<sal_Int16>( bConvert ? convertMm100ToTwip(nVal) : nVal );
+ nRightMargin = static_cast<sal_Int16>( bConvert ? o3tl::toTwips(nVal, o3tl::Length::mm100) : nVal );
break;
case MID_MARGIN_UP_MARGIN:
- nTopMargin = static_cast<sal_Int16>( bConvert ? convertMm100ToTwip(nVal) : nVal );
+ nTopMargin = static_cast<sal_Int16>( bConvert ? o3tl::toTwips(nVal, o3tl::Length::mm100) : nVal );
break;
case MID_MARGIN_LO_MARGIN:
- nBottomMargin = static_cast<sal_Int16>( bConvert ? convertMm100ToTwip(nVal) : nVal );
+ nBottomMargin = static_cast<sal_Int16>( bConvert ? o3tl::toTwips(nVal, o3tl::Length::mm100) : nVal );
break;
default:
OSL_FAIL("unknown MemberId");
diff --git a/svx/source/items/grfitem.cxx b/svx/source/items/grfitem.cxx
index 2c0b678fbd3c..b241738f313f 100644
--- a/svx/source/items/grfitem.cxx
+++ b/svx/source/items/grfitem.cxx
@@ -83,10 +83,10 @@ bool SvxGrfCrop::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
return false;
if( bConvert )
{
- aVal.Right = convertMm100ToTwip(aVal.Right );
- aVal.Top = convertMm100ToTwip(aVal.Top );
- aVal.Left = convertMm100ToTwip(aVal.Left );
- aVal.Bottom = convertMm100ToTwip(aVal.Bottom);
+ aVal.Right = o3tl::toTwips(aVal.Right, o3tl::Length::mm100);
+ aVal.Top = o3tl::toTwips(aVal.Top, o3tl::Length::mm100);
+ aVal.Left = o3tl::toTwips(aVal.Left, o3tl::Length::mm100);
+ aVal.Bottom = o3tl::toTwips(aVal.Bottom, o3tl::Length::mm100);
}
nLeft = aVal.Left ;
diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx
index f460a8a10f59..10cfaa28808b 100644
--- a/svx/source/table/svdotable.cxx
+++ b/svx/source/table/svdotable.cxx
@@ -2461,7 +2461,7 @@ bool SdrTableObj::createTableEdgesJson(boost::property_tree::ptree & rJsonRoot)
tools::Rectangle aRect = GetCurrentBoundRect();
boost::property_tree::ptree aTableColumns;
{
- aTableColumns.put("tableOffset", convertMm100ToTwip(aRect.Left()));
+ aTableColumns.put("tableOffset", o3tl::toTwips(aRect.Left(), o3tl::Length::mm100));
boost::property_tree::ptree aEntries;
auto const & aEdges = mpImpl->mpLayouter->getVerticalEdges();
@@ -2469,18 +2469,18 @@ bool SdrTableObj::createTableEdgesJson(boost::property_tree::ptree & rJsonRoot)
{
if (rEdge.nIndex == 0)
{
- aTableColumns.put("left", convertMm100ToTwip(rEdge.nPosition));
+ aTableColumns.put("left", o3tl::toTwips(rEdge.nPosition, o3tl::Length::mm100));
}
else if (rEdge.nIndex == sal_Int32(aEdges.size() - 1))
{
- aTableColumns.put("right", convertMm100ToTwip(rEdge.nPosition));
+ aTableColumns.put("right", o3tl::toTwips(rEdge.nPosition, o3tl::Length::mm100));
}
else
{
boost::property_tree::ptree aEntry;
- aEntry.put("position", convertMm100ToTwip(rEdge.nPosition));
- aEntry.put("min", convertMm100ToTwip(rEdge.nPosition + rEdge.nMin));
- aEntry.put("max", convertMm100ToTwip(rEdge.nPosition + rEdge.nMax));
+ aEntry.put("position", o3tl::toTwips(rEdge.nPosition, o3tl::Length::mm100));
+ aEntry.put("min", o3tl::toTwips(rEdge.nPosition + rEdge.nMin, o3tl::Length::mm100));
+ aEntry.put("max", o3tl::toTwips(rEdge.nPosition + rEdge.nMax, o3tl::Length::mm100));
aEntry.put("hidden", false);
aEntries.push_back(std::make_pair("", aEntry));
}
@@ -2491,7 +2491,7 @@ bool SdrTableObj::createTableEdgesJson(boost::property_tree::ptree & rJsonRoot)
boost::property_tree::ptree aTableRows;
{
- aTableRows.put("tableOffset", convertMm100ToTwip(aRect.Top()));
+ aTableRows.put("tableOffset", o3tl::toTwips(aRect.Top(), o3tl::Length::mm100));
boost::property_tree::ptree aEntries;
auto const & aEdges = mpImpl->mpLayouter->getHorizontalEdges();
@@ -2499,18 +2499,18 @@ bool SdrTableObj::createTableEdgesJson(boost::property_tree::ptree & rJsonRoot)
{
if (rEdge.nIndex == 0)
{
- aTableRows.put("left", convertMm100ToTwip(rEdge.nPosition));
+ aTableRows.put("left", o3tl::toTwips(rEdge.nPosition, o3tl::Length::mm100));
}
else if (rEdge.nIndex == sal_Int32(aEdges.size() - 1))
{
- aTableRows.put("right", convertMm100ToTwip(rEdge.nPosition));
+ aTableRows.put("right", o3tl::toTwips(rEdge.nPosition, o3tl::Length::mm100));
}
else
{
boost::property_tree::ptree aEntry;
- aEntry.put("position", convertMm100ToTwip(rEdge.nPosition));
- aEntry.put("min", convertMm100ToTwip(rEdge.nPosition + rEdge.nMin));
- aEntry.put("max", convertMm100ToTwip(rEdge.nPosition + rEdge.nMax));
+ aEntry.put("position", o3tl::toTwips(rEdge.nPosition, o3tl::Length::mm100));
+ aEntry.put("min", o3tl::toTwips(rEdge.nPosition + rEdge.nMin, o3tl::Length::mm100));
+ aEntry.put("max", o3tl::toTwips(rEdge.nPosition + rEdge.nMax, o3tl::Length::mm100));
aEntry.put("hidden", false);
aEntries.push_back(std::make_pair("", aEntry));
}
diff --git a/svx/source/table/tablertfexporter.cxx b/svx/source/table/tablertfexporter.cxx
index 135693ea67b0..b131fa09bf3c 100644
--- a/svx/source/table/tablertfexporter.cxx
+++ b/svx/source/table/tablertfexporter.cxx
@@ -96,7 +96,7 @@ void SdrTableRtfExporter::Write()
Reference< XPropertySet > xSet( xColumns->getByIndex(nCol), UNO_QUERY_THROW );
sal_Int32 nWidth = 0;
xSet->getPropertyValue( gsSize ) >>= nWidth;
- nPos += convertMm100ToTwip(nWidth);
+ nPos += o3tl::toTwips(nWidth, o3tl::Length::mm100);
aColumnStart.push_back( nPos );
}
catch( Exception& )
diff --git a/svx/source/unodraw/SvxXTextColumns.cxx b/svx/source/unodraw/SvxXTextColumns.cxx
index a98e0f9cf8a0..ee0fa10fa1d4 100644
--- a/svx/source/unodraw/SvxXTextColumns.cxx
+++ b/svx/source/unodraw/SvxXTextColumns.cxx
@@ -209,7 +209,7 @@ void SvxXTextColumns::setPropertyValue(const OUString& rPropertyName, const css:
if (sal_Int32 nTmp; !(aValue >>= nTmp) || nTmp < 0)
throw css::lang::IllegalArgumentException();
else
- m_nSepLineWidth = convertMm100ToTwip(nTmp);
+ m_nSepLineWidth = o3tl::toTwips(nTmp, o3tl::Length::mm100);
break;
case WID_TXTCOL_LINE_COLOR:
if (!(aValue >>= m_nSepLineColor))
diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx
index fe9c280a62b2..0707a485c5de 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -931,7 +931,7 @@ bool XLineWidthItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId )
sal_Int32 nValue = 0;
rVal >>= nValue;
if( 0 != (nMemberId&CONVERT_TWIPS) )
- nValue = convertMm100ToTwip(nValue);
+ nValue = o3tl::toTwips(nValue, o3tl::Length::mm100);
SetValue( nValue );
return true;
diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx
index 92c195a9681d..77d8f66e1109 100644
--- a/sw/qa/core/layout/layout.cxx
+++ b/sw/qa/core/layout/layout.cxx
@@ -297,7 +297,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testGutterMargin)
// Verify that the new left edge is larger.
tools::Long nNewLeft = pPage->getFramePrintArea().Left();
- tools::Long nGutterTwips = convertMm100ToTwip(nGutterMm100);
+ tools::Long nGutterTwips = o3tl::toTwips(nGutterMm100, o3tl::Length::mm100);
// Without the accompanying fix in place, this test would have failed with:
// - Expected: 1134
// - Actual : 0
@@ -326,7 +326,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testGutterTopMargin)
// Verify that the new top edge is larger.
tools::Long nNewTop = pPage->getFramePrintArea().Top();
- tools::Long nGutterTwips = convertMm100ToTwip(nGutterMm100);
+ tools::Long nGutterTwips = o3tl::toTwips(nGutterMm100, o3tl::Length::mm100);
// Without the accompanying fix in place, this test would have failed with:
// - Expected: 1134
// - Actual : 0
@@ -353,7 +353,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testGutterMirrorMargin)
xStandard->setPropertyValue("GutterMargin", uno::makeAny(nGutterMm100));
tools::Long nNewLeft = pPage->getFramePrintArea().Left();
- tools::Long nGutterTwips = convertMm100ToTwip(nGutterMm100);
+ tools::Long nGutterTwips = o3tl::toTwips(nGutterMm100, o3tl::Length::mm100);
CPPUNIT_ASSERT_EQUAL(nGutterTwips, nNewLeft - nOldLeft);
tools::Long nNewRight = pPage2->getFramePrintArea().Right();
// Without the accompanying fix in place, this test would have failed with:
@@ -380,7 +380,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testRtlGutterMargin)
// Then make sure the new right edge of the print area is decreased:
tools::Long nNewRight = pPage->getFramePrintArea().Right();
- tools::Long nGutterTwips = convertMm100ToTwip(nGutterMm100);
+ tools::Long nGutterTwips = o3tl::toTwips(nGutterMm100, o3tl::Length::mm100);
// Without the accompanying fix in place, this test would have failed with:
// - Expected: 1134
// - Actual : 0
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index ae99eab0d49a..d946aba364e2 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1575,8 +1575,8 @@ CPPUNIT_TEST_FIXTURE(Test, testDefaultValues)
CPPUNIT_ASSERT_EQUAL(double(12), getProperty<double>(run, "CharHeight"));
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(run, "CharEscapement"));
CPPUNIT_ASSERT_EQUAL(sal_Int32(100), getProperty<sal_Int32>(run, "CharEscapementHeight"));
- CPPUNIT_ASSERT_EQUAL(sal_Int64(20),
- convertMm100ToTwip(getProperty<sal_Int16>(run, "CharKerning")));
+ CPPUNIT_ASSERT_EQUAL(sal_Int64(20), o3tl::toTwips(getProperty<sal_Int16>(run, "CharKerning"),
+ o3tl::Length::mm100));
CPPUNIT_ASSERT_EQUAL(sal_Int32(COL_AUTO), getProperty<sal_Int32>(run, "CharColor"));
run = getRun(paragraph, 8, "expand0pt");
@@ -1592,8 +1592,8 @@ CPPUNIT_TEST_FIXTURE(Test, testDefaultValues)
CPPUNIT_ASSERT_EQUAL(double(12), getProperty<double>(run, "CharHeight"));
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(run, "CharEscapement"));
CPPUNIT_ASSERT_EQUAL(sal_Int32(100), getProperty<sal_Int32>(run, "CharEscapementHeight"));
- CPPUNIT_ASSERT_EQUAL(sal_Int64(20),
- convertMm100ToTwip(getProperty<sal_Int16>(run, "CharKerning")));
+ CPPUNIT_ASSERT_EQUAL(sal_Int64(20), o3tl::toTwips(getProperty<sal_Int16>(run, "CharKerning"),
+ o3tl::Length::mm100));
CPPUNIT_ASSERT_EQUAL(sal_Int32(COL_AUTO), getProperty<sal_Int32>(run, "CharColor"));
run = getRun(paragraph, 10, "expand0pt");
diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx
index fcb598966280..1d51efc07ce6 100644
--- a/sw/source/core/draw/dflyobj.cxx
+++ b/sw/source/core/draw/dflyobj.cxx
@@ -898,10 +898,10 @@ void SwVirtFlyDrawObj::NbcCrop(const basegfx::B2DPoint& rRef, double fxFact, dou
// pSh->StartUndo(SwUndoId::START);
// Set new crop values in twips
- aCrop.SetLeft (convertMm100ToTwip(nLeftCrop));
- aCrop.SetTop (convertMm100ToTwip(nTopCrop));
- aCrop.SetRight (convertMm100ToTwip(nRightCrop));
- aCrop.SetBottom(convertMm100ToTwip(nBottomCrop));
+ aCrop.SetLeft (o3tl::toTwips(nLeftCrop, o3tl::Length::mm100));
+ aCrop.SetTop (o3tl::toTwips(nTopCrop, o3tl::Length::mm100));
+ aCrop.SetRight (o3tl::toTwips(nRightCrop, o3tl::Length::mm100));
+ aCrop.SetBottom(o3tl::toTwips(nBottomCrop, o3tl::Length::mm100));
pSh->SetAttrItem(aCrop);
// Set new frame size
diff --git a/sw/source/core/inc/rootfrm.hxx b/sw/source/core/inc/rootfrm.hxx
index 6e79b4aa941d..244d935bceb1 100644
--- a/sw/source/core/inc/rootfrm.hxx
+++ b/sw/source/core/inc/rootfrm.hxx
@@ -107,7 +107,7 @@ class SW_DLLPUBLIC SwRootFrame final : public SwLayoutFrame
static bool s_isNoVirDev;// No virt. Device for SystemPaints
/// Width of the HTML / Web document if not defined otherwise: 20cm.
- static constexpr sal_Int64 MIN_BROWSE_WIDTH = convertMm100ToTwip(20000);
+ static constexpr sal_Int64 MIN_BROWSE_WIDTH = o3tl::toTwips(20000, o3tl::Length::mm100);
bool mbCheckSuperfluous :1; // Search for empty Pages?
bool mbIdleFormat :1; // Trigger Idle Formatter?
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 9181f970ea18..711957cea1f2 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -326,8 +326,8 @@ bool SwFormatFrameSize::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
Size aTmp(aVal.Width, aVal.Height);
if(bConvert)
{
- aTmp.setHeight( convertMm100ToTwip(aTmp.Height()) );
- aTmp.setWidth( convertMm100ToTwip(aTmp.Width()) );
+ aTmp.setHeight(o3tl::toTwips(aTmp.Height(), o3tl::Length::mm100));
+ aTmp.setWidth(o3tl::toTwips(aTmp.Width(), o3tl::Length::mm100));
}
SetSize(aTmp);
}
@@ -391,7 +391,7 @@ bool SwFormatFrameSize::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
if(rVal >>= nWd)
{
if(bConvert)
- nWd = convertMm100ToTwip(nWd);
+ nWd = o3tl::toTwips(nWd, o3tl::Length::mm100);
if(nWd < MINLAY)
nWd = MINLAY;
SetWidth(nWd);
@@ -406,7 +406,7 @@ bool SwFormatFrameSize::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
if(rVal >>= nHg)
{
if(bConvert)
- nHg = convertMm100ToTwip(nHg);
+ nHg = o3tl::toTwips(nHg, o3tl::Length::mm100);
if(nHg < MINLAY)
nHg = MINLAY;
SetHeight(nHg);
@@ -1189,8 +1189,8 @@ bool SwFormatCol::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
SwColumn aCol;
aCol.SetWishWidth(pArray[i].Width );
nWidthSum = nWidthSum + pArray[i].Width;
- aCol.SetLeft (convertMm100ToTwip(pArray[i].LeftMargin));
- aCol.SetRight(convertMm100ToTwip(pArray[i].RightMargin));
+ aCol.SetLeft (o3tl::toTwips(pArray[i].LeftMargin, o3tl::Length::mm100));
+ aCol.SetRight(o3tl::toTwips(pArray[i].RightMargin, o3tl::Length::mm100));
m_aColumns.insert(m_aColumns.begin() + i, aCol);
}
bRet = true;
@@ -1433,7 +1433,7 @@ bool SwFormatVertOrient::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
sal_Int32 nVal = 0;
rVal >>= nVal;
if(bConvert)
- nVal = convertMm100ToTwip(nVal);
+ nVal = o3tl::toTwips(nVal, o3tl::Length::mm100);
SetPos( nVal );
}
break;
@@ -1531,7 +1531,7 @@ bool SwFormatHoriOrient::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
if(!(rVal >>= nVal))
bRet = false;
if(bConvert)
- nVal = convertMm100ToTwip(nVal);
+ nVal = o3tl::toTwips(nVal, o3tl::Length::mm100);
SetPos( nVal );
}
break;
@@ -2380,7 +2380,7 @@ bool SwTextGridItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
"This value needs TWIPS-MM100 conversion" );
sal_Int32 nTmp = 0;
bRet = (rVal >>= nTmp);
- nTmp = convertMm100ToTwip( nTmp );
+ nTmp = o3tl::toTwips(nTmp, o3tl::Length::mm100);
if( bRet && (nTmp >= 0) && ( nTmp <= SAL_MAX_UINT16) )
{
// rhbz#1043551 round up to 5pt -- 0 causes divide-by-zero
diff --git a/sw/source/core/para/paratr.cxx b/sw/source/core/para/paratr.cxx
index b8c6e668b01a..f724ac21c0fe 100644
--- a/sw/source/core/para/paratr.cxx
+++ b/sw/source/core/para/paratr.cxx
@@ -147,7 +147,7 @@ bool SwFormatDrop::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
{
sal_Int16 nVal = 0;
if ( rVal >>= nVal )
- m_nDistance = static_cast<sal_Int16>(convertMm100ToTwip(static_cast<sal_Int32>(nVal)));
+ m_nDistance = o3tl::toTwips(nVal, o3tl::Length::mm100);
else
return false;
break;
@@ -159,7 +159,7 @@ bool SwFormatDrop::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
auto pDrop = o3tl::doAccess<style::DropCapFormat>(rVal);
m_nLines = pDrop->Lines;
m_nChars = pDrop->Count;
- m_nDistance = convertMm100ToTwip(pDrop->Distance);
+ m_nDistance = o3tl::toTwips(pDrop->Distance, o3tl::Length::mm100);
}
}
break;
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index c47887f8350d..221f47fca29a 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -619,7 +619,7 @@ void SwXDrawPage::add(const uno::Reference< drawing::XShape > & xShape)
if ( !pDesc->GetHOrient() )
{
SwFormatHoriOrient* pHori = pDesc->GetHOrient( true );
- SwTwips nHoriPos = convertMm100ToTwip(aMM100Pos.X);
+ SwTwips nHoriPos = o3tl::toTwips(aMM100Pos.X, o3tl::Length::mm100);
pHori->SetPos( nHoriPos );
}
{
@@ -631,7 +631,7 @@ void SwXDrawPage::add(const uno::Reference< drawing::XShape > & xShape)
if ( !pDesc->GetVOrient() )
{
SwFormatVertOrient* pVert = pDesc->GetVOrient( true );
- SwTwips nVertPos = convertMm100ToTwip(aMM100Pos.Y);
+ SwTwips nVertPos = o3tl::toTwips(aMM100Pos.Y, o3tl::Length::mm100);
pVert->SetPos( nVertPos );
}
{
@@ -689,7 +689,7 @@ void SwXDrawPage::add(const uno::Reference< drawing::XShape > & xShape)
else if ((aAnchor.GetAnchorId() != RndStdIds::FLY_AT_PAGE) && m_pDoc->getIDocumentLayoutAccess().GetCurrentLayout())
{
SwCursorMoveState aState( CursorMoveState::SetOnlyText );
- Point aTmp(convertMm100ToTwip(aMM100Pos.X), convertMm100ToTwip(aMM100Pos.Y));
+ Point aTmp(o3tl::toTwips(aMM100Pos.X, o3tl::Length::mm100), o3tl::toTwips(aMM100Pos.Y, o3tl::Length::mm100));
m_pDoc->getIDocumentLayoutAccess().GetCurrentLayout()->GetModelPositionForViewPoint( pPam->GetPoint(), aTmp, &aState );
aAnchor.SetAnchor( pPam->GetPoint() );
diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx
index b71d108b9cf6..58aba6aef78c 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -2728,7 +2728,7 @@ SwXDocumentIndex::TokenAccess_Impl::replaceByIndex(
{
throw lang::IllegalArgumentException();
}
- nPosition = convertMm100ToTwip(nPosition);
+ nPosition = o3tl::toTwips(nPosition, o3tl::Length::mm100);
if(nPosition < 0)
{
throw lang::IllegalArgumentException();
diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx
index 50aa72b76894..76b7839415b0 100644
--- a/sw/source/core/unocore/unosett.cxx
+++ b/sw/source/core/unocore/unosett.cxx
@@ -841,10 +841,10 @@ void SwXLineNumberingProperties::setPropertyValue(
{
sal_Int32 nVal = 0;
aValue >>= nVal;
- sal_Int32 nTmp = convertMm100ToTwip(nVal);
+ sal_Int32 nTmp = o3tl::toTwips(nVal, o3tl::Length::mm100);
if (nTmp > SAL_MAX_UINT16)
nTmp = SAL_MAX_UINT16;
- aFontMetric.SetPosFromLeft( static_cast< sal_uInt16 >(nTmp) );
+ aFontMetric.SetPosFromLeft(nTmp);
}
break;
case WID_INTERVAL :
@@ -1624,14 +1624,14 @@ void SwXNumberingRules::SetPropertiesToNumFormat(
sal_Int32 nValue = 0;
rProp.Value >>= nValue;
// #i23727# nValue can be negative
- aFormat.SetAbsLSpace(convertMm100ToTwip(nValue));
+ aFormat.SetAbsLSpace(o3tl::toTwips(nValue, o3tl::Length::mm100));
}
else if (rProp.Name == UNO_NAME_SYMBOL_TEXT_DISTANCE)
{
sal_Int32 nValue = 0;
rProp.Value >>= nValue;
if (nValue >= 0)
- aFormat.SetCharTextDistance(static_cast<short>(convertMm100ToTwip(nValue)));
+ aFormat.SetCharTextDistance(o3tl::toTwips(nValue, o3tl::Length::mm100));
else
bWrongArg = true;
}
@@ -1640,7 +1640,7 @@ void SwXNumberingRules::SetPropertiesToNumFormat(
sal_Int32 nValue = 0;
rProp.Value >>= nValue;
// #i23727# nValue can be positive
- nValue = convertMm100ToTwip(nValue);
+ nValue = o3tl::toTwips(nValue, o3tl::Length::mm100);
aFormat.SetFirstLineOffset(nValue);
}
else if (rProp.Name == UNO_NAME_POSITION_AND_SPACE_MODE)
@@ -1689,7 +1689,7 @@ void SwXNumberingRules::SetPropertiesToNumFormat(
{
sal_Int32 nValue = 0;
rProp.Value >>= nValue;
- nValue = convertMm100ToTwip(nValue);
+ nValue = o3tl::toTwips(nValue, o3tl::Length::mm100);
if ( nValue >= 0 )
{
aFormat.SetListtabPos( nValue );
@@ -1703,14 +1703,14 @@ void SwXNumberingRules::SetPropertiesToNumFormat(
{
sal_Int32 nValue = 0;
rProp.Value >>= nValue;
- nValue = convertMm100ToTwip(nValue);
+ nValue = o3tl::toTwips(nValue, o3tl::Length::mm100);
aFormat.SetFirstLineIndent( nValue );
}
else if (rProp.Name == UNO_NAME_INDENT_AT)
{
sal_Int32 nValue = 0;
rProp.Value >>= nValue;
- nValue = convertMm100ToTwip(nValue);
+ nValue = o3tl::toTwips(nValue, o3tl::Length::mm100);
aFormat.SetIndentAt( nValue );
}
else if (rProp.Name == UNO_NAME_NUMBERING_TYPE)
@@ -1843,10 +1843,8 @@ void SwXNumberingRules::SetPropertiesToNumFormat(
awt::Size size;
if (rProp.Value >>= size)
{
- size.Width = convertMm100ToTwip(size.Width);
- size.Height = convertMm100ToTwip(size.Height);
- pSetSize->setWidth( size.Width );
- pSetSize->setHeight( size.Height );
+ pSetSize->setWidth(o3tl::toTwips(size.Width, o3tl::Length::mm100));
+ pSetSize->setHeight(o3tl::toTwips(size.Height, o3tl::Length::mm100));
}
else
bWrongArg = true;
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 9c9b6d52c675..6bb794009ff5 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -174,9 +174,9 @@ static bool lcl_LineToSvxLine(const table::BorderLine& rLine, SvxBorderLine& rSv
rSvxLine.SetColor(Color(ColorTransparency, rLine.Color));
rSvxLine.GuessLinesWidths( SvxBorderLineStyle::NONE,
- convertMm100ToTwip( rLine.OuterLineWidth ),
- convertMm100ToTwip( rLine.InnerLineWidth ),
- convertMm100ToTwip( rLine.LineDistance ) );
+ o3tl::toTwips(rLine.OuterLineWidth, o3tl::Length::mm100),
+ o3tl::toTwips(rLine.InnerLineWidth, o3tl::Length::mm100),
+ o3tl::toTwips(rLine.LineDistance, o3tl::Length::mm100) );
return rLine.InnerLineWidth > 0 || rLine.OuterLineWidth > 0;
}
@@ -219,7 +219,7 @@ static void lcl_SetSpecialProperty(SwFrameFormat* pFormat,
sal_Int32 nWidth = 0;
aValue >>= nWidth;
aSz.SetWidthPercent(0);
- aSz.SetWidth ( convertMm100ToTwip ( nWidth ) );
+ aSz.SetWidth ( o3tl::toTwips(nWidth, o3tl::Length::mm100) );
}
else if(FN_TABLE_RELATIVE_WIDTH == pEntry->nWID)
{
@@ -1313,7 +1313,7 @@ void SwXTextTableRow::setPropertyValue(const OUString& rPropertyName, const uno:
sal_Int32 nHeight = 0;
aValue >>= nHeight;
Size aSz(aFrameSize.GetSize());
- aSz.setHeight( convertMm100ToTwip(nHeight) );
+ aSz.setHeight( o3tl::toTwips(nHeight, o3tl::Length::mm100) );
aFrameSize.SetSize(aSz);
}
pDoc->SetAttr(aFrameSize, *pLn->ClaimFrameFormat());
@@ -2633,7 +2633,7 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName, const uno::An
aBoxInfo.SetLine(aVertLine.isEmpty() ? nullptr : &aVertLine, SvxBoxInfoItemLine::VERT);
aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::VERT, aBorder.IsVerticalLineValid);
- aBox.SetAllDistances(o3tl::narrowing<sal_uInt16>(convertMm100ToTwip(aBorder.Distance)));
+ aBox.SetAllDistances(o3tl::toTwips(aBorder.Distance, o3tl::Length::mm100));
aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::DISTANCE, aBorder.IsDistanceValid);
aSet.Put(aBox);
@@ -2653,10 +2653,10 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName, const uno::An
!aTableBorderDistances.IsBottomDistanceValid ))
break;
- const sal_uInt16 nLeftDistance = convertMm100ToTwip(aTableBorderDistances.LeftDistance);
- const sal_uInt16 nRightDistance = convertMm100ToTwip(aTableBorderDistances.RightDistance);
- const sal_uInt16 nTopDistance = convertMm100ToTwip(aTableBorderDistances.TopDistance);
- const sal_uInt16 nBottomDistance = convertMm100ToTwip(aTableBorderDistances.BottomDistance);
+ const sal_uInt16 nLeftDistance = o3tl::toTwips(aTableBorderDistances.LeftDistance, o3tl::Length::mm100);
+ const sal_uInt16 nRightDistance = o3tl::toTwips(aTableBorderDistances.RightDistance, o3tl::Length::mm100);
+ const sal_uInt16 nTopDistance = o3tl::toTwips(aTableBorderDistances.TopDistance, o3tl::Length::mm100);
+ const sal_uInt16 nBottomDistance = o3tl::toTwips(aTableBorderDistances.BottomDistance, o3tl::Length::mm100);
SwDoc* pDoc = pFormat->GetDoc();
SwTable* pTable = SwTable::FindTable( pFormat );
SwTableLines &rLines = pTable->GetTabLines();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 9bed3f18b726..5dd987b252a9 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3411,7 +3411,7 @@ static void impl_borderLine( FSHelperPtr const & pSerializer, sal_Int32 elementT
if( rStyleProps != nullptr && pBorderLine && !pBorderLine->isEmpty() &&
pBorderLine->GetBorderLineStyle() == static_cast<SvxBorderLineStyle>(rStyleProps->LineStyle) &&
pBorderLine->GetColor() == Color(ColorTransparency, rStyleProps->Color) &&
- pBorderLine->GetWidth() == convertMm100ToTwip( rStyleProps->LineWidth ) )
+ pBorderLine->GetWidth() == o3tl::toTwips(rStyleProps->LineWidth, o3tl::Length::mm100) )
return;
rtl::Reference<FastAttributeList> pAttr = FastSerializerHelper::createAttrList();
@@ -5148,7 +5148,7 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size
if (xShapePropSet)
{
if (css::awt::Size val; xShapePropSet->getPropertyValue("Size") >>= val)
- aSize = Size(convertMm100ToTwip(val.Width), convertMm100ToTwip(val.Height));
+ aSize = Size(o3tl::toTwips(val.Width, o3tl::Length::mm100), o3tl::toTwips(val.Height, o3tl::Length::mm100));
}
m_rExport.SdrExporter().startDMLAnchorInline(pFrameFormat, aSize);
@@ -9692,7 +9692,7 @@ void DocxAttributeOutput::ParaGrabBag(const SfxGrabBagItem& rItem)
m_bParaBeforeAutoSpacing = true;
// get fixed value which was set during import
rGrabBagElement.second >>= m_nParaBeforeSpacing;
- m_nParaBeforeSpacing = convertMm100ToTwip(m_nParaBeforeSpacing);
+ m_nParaBeforeSpacing = o3tl::toTwips(m_nParaBeforeSpacing, o3tl::Length::mm100);
SAL_INFO("sw.ww8", "DocxAttributeOutput::ParaGrabBag: property =" << rGrabBagElement.first << " : m_nParaBeforeSpacing= " << m_nParaBeforeSpacing);
}
else if (rGrabBagElement.first == "ParaBottomMarginAfterAutoSpacing")
@@ -9700,7 +9700,7 @@ void DocxAttributeOutput::ParaGrabBag(const SfxGrabBagItem& rItem)
m_bParaAfterAutoSpacing = true;
// get fixed value which was set during import
rGrabBagElement.second >>= m_nParaAfterSpacing;
- m_nParaAfterSpacing = convertMm100ToTwip(m_nParaAfterSpacing);
+ m_nParaAfterSpacing = o3tl::toTwips(m_nParaAfterSpacing, o3tl::Length::mm100);
SAL_INFO("sw.ww8", "DocxAttributeOutput::ParaGrabBag: property =" << rGrabBagElement.first << " : m_nParaBeforeSpacing= " << m_nParaAfterSpacing);
}
else if (rGrabBagElement.first == "CharThemeFill")
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 5b93db40de6d..f79422a9a2b7 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -3711,13 +3711,13 @@ void RtfAttributeOutput::ParaGrabBag(const SfxGrabBagItem& rItem)
{
m_bParaBeforeAutoSpacing = true;
rValue.second >>= m_nParaBeforeSpacing;
- m_nParaBeforeSpacing = convertMm100ToTwip(m_nParaBeforeSpacing);
+ m_nParaBeforeSpacing = o3tl::toTwips(m_nParaBeforeSpacing, o3tl::Length::mm100);
}
else if (rValue.first == "ParaBottomMarginAfterAutoSpacing")
{
m_bParaAfterAutoSpacing = true;
rValue.second >>= m_nParaAfterSpacing;
- m_nParaAfterSpacing = convertMm100ToTwip(m_nParaAfterSpacing);
+ m_nParaAfterSpacing = o3tl::toTwips(m_nParaAfterSpacing, o3tl::Length::mm100);
}
}
}
diff --git a/sw/source/filter/xml/xmltexti.cxx b/sw/source/filter/xml/xmltexti.cxx
index 189e26bb57e1..c3d390f93d5e 100644
--- a/sw/source/filter/xml/xmltexti.cxx
+++ b/sw/source/filter/xml/xmltexti.cxx
@@ -105,10 +105,10 @@ static void lcl_putHeightAndWidth ( SfxItemSet &rItemSet,
{
if( nWidth > 0 && nHeight > 0 )
{
- nWidth = convertMm100ToTwip( nWidth );
+ nWidth = o3tl::toTwips(nWidth, o3tl::Length::mm100);
if( nWidth < MINFLY )
nWidth = MINFLY;
- nHeight = convertMm100ToTwip( nHeight );
+ nHeight = o3tl::toTwips(nHeight, o3tl::Length::mm100);
if( nHeight < MINFLY )
nHeight = MINFLY;
rItemSet.Put( SwFormatFrameSize( SwFrameSize::Fixed, nWidth, nHeight ) );
diff --git a/sw/source/uibase/app/appopt.cxx b/sw/source/uibase/app/appopt.cxx
index 55494b43ef9a..a738084516a6 100644
--- a/sw/source/uibase/app/appopt.cxx
+++ b/sw/source/uibase/app/appopt.cxx
@@ -178,7 +178,7 @@ std::optional<SfxItemSet> SwModule::CreateItemSet( sal_uInt16 nId )
aRet.Put( SfxUInt16Item( SID_ATTR_DEFTABSTOP, o3tl::narrowing<sal_uInt16>(::GetTabDist(rDefTabs))));
}
else
- aRet.Put(SfxUInt16Item( SID_ATTR_DEFTABSTOP, o3tl::narrowing<sal_uInt16>(convertMm100ToTwip(pPref->GetDefTabInMm100()))));
+ aRet.Put(SfxUInt16Item( SID_ATTR_DEFTABSTOP, o3tl::toTwips(pPref->GetDefTabInMm100(), o3tl::Length::mm100)));
}
// Options for GridTabPage
diff --git a/sw/source/uibase/app/docshini.cxx b/sw/source/uibase/app/docshini.cxx
index 5869749a04b5..0b47fc6d26cc 100644
--- a/sw/source/uibase/app/docshini.cxx
+++ b/sw/source/uibase/app/docshini.cxx
@@ -658,7 +658,7 @@ void SwDocShell::SubInitNew()
aDfltSet.Put( aHyp );
- sal_uInt16 nNewPos = static_cast< sal_uInt16 >(convertMm100ToTwip(SW_MOD()->GetUsrPref(false)->GetDefTabInMm100()));
+ sal_uInt16 nNewPos = o3tl::toTwips(SW_MOD()->GetUsrPref(false)->GetDefTabInMm100(), o3tl::Length::mm100);
if( nNewPos )
aDfltSet.Put( SvxTabStopItem( 1, nNewPos,
SvxTabAdjust::Default, RES_PARATR_TABSTOP ) );
diff --git a/sw/source/uibase/config/fontcfg.cxx b/sw/source/uibase/config/fontcfg.cxx
index 3792fdb16012..d1f5059a3566 100644
--- a/sw/source/uibase/config/fontcfg.cxx
+++ b/sw/source/uibase/config/fontcfg.cxx
@@ -113,7 +113,7 @@ SwStdFontConfig::SwStdFontConfig() :
else
{
pValues[nProp] >>= nDefaultFontHeight[nProp - DEF_FONT_COUNT];
- nDefaultFontHeight[nProp - DEF_FONT_COUNT] = convertMm100ToTwip(nDefaultFontHeight[nProp - DEF_FONT_COUNT]);
+ nDefaultFontHeight[nProp - DEF_FONT_COUNT] = o3tl::toTwips(nDefaultFontHeight[nProp - DEF_FONT_COUNT], o3tl::Length::mm100);
}
}
}
diff --git a/sw/source/uibase/config/modcfg.cxx b/sw/source/uibase/config/modcfg.cxx
index 4733727e7043..425534945e67 100644
--- a/sw/source/uibase/config/modcfg.cxx
+++ b/sw/source/uibase/config/modcfg.cxx
@@ -1139,10 +1139,10 @@ void SwTableConfig::Load()
sal_Int32 nTemp = 0;
switch (nProp)
{
- case 0 : pValues[nProp] >>= nTemp; m_nTableHMove = o3tl::narrowing<sal_uInt16>(convertMm100ToTwip(nTemp)); break; //"Shift/Row",
- case 1 : pValues[nProp] >>= nTemp; m_nTableVMove = o3tl::narrowing<sal_uInt16>(convertMm100ToTwip(nTemp)); break; //"Shift/Column",
- case 2 : pValues[nProp] >>= nTemp; m_nTableHInsert = o3tl::narrowing<sal_uInt16>(convertMm100ToTwip(nTemp)); break; //"Insert/Row",
- case 3 : pValues[nProp] >>= nTemp; m_nTableVInsert = o3tl::narrowing<sal_uInt16>(convertMm100ToTwip(nTemp)); break; //"Insert/Column",
+ case 0 : pValues[nProp] >>= nTemp; m_nTableHMove = o3tl::toTwips(nTemp, o3tl::Length::mm100); break; //"Shift/Row",
+ case 1 : pValues[nProp] >>= nTemp; m_nTableVMove = o3tl::toTwips(nTemp, o3tl::Length::mm100); break; //"Shift/Column",
+ case 2 : pValues[nProp] >>= nTemp; m_nTableHInsert = o3tl::toTwips(nTemp, o3tl::Length::mm100); break; //"Insert/Row",
+ case 3 : pValues[nProp] >>= nTemp; m_nTableVInsert = o3tl::toTwips(nTemp, o3tl::Length::mm100); break; //"Insert/Column",
case 4 : pValues[nProp] >>= nTemp; m_eTableChgMode = static_cast<TableChgMode>(nTemp); break; //"Change/Effect",
case 5 : m_bInsTableFormatNum = *o3tl::doAccess<bool>(pValues[nProp]); break; //"Input/NumberRecognition",
case 6 : m_bInsTableChangeNumFormat = *o3tl::doAccess<bool>(pValues[nProp]); break; //"Input/NumberFormatRecognition",
diff --git a/sw/source/uibase/config/usrpref.cxx b/sw/source/uibase/config/usrpref.cxx
index 7f85d5a78940..0c759a78cf94 100644
--- a/sw/source/uibase/config/usrpref.cxx
+++ b/sw/source/uibase/config/usrpref.cxx
@@ -475,8 +475,8 @@ void SwGridConfig::Load()
case 0: m_rParent.SetSnap(bSet); break;// "Option/SnapToGrid",
case 1: m_rParent.SetGridVisible(bSet); break;//"Option/VisibleGrid",
case 2: m_rParent.SetSynchronize(bSet); break;// "Option/Synchronize",
- case 3: aSnap.setWidth( convertMm100ToTwip(nSet) ); break;// "Resolution/XAxis",
- case 4: aSnap.setHeight( convertMm100ToTwip(nSet) ); break;// "Resolution/YAxis",
+ case 3: aSnap.setWidth( o3tl::toTwips(nSet, o3tl::Length::mm100) ); break;// "Resolution/XAxis",
+ case 4: aSnap.setHeight( o3tl::toTwips(nSet, o3tl::Length::mm100) ); break;// "Resolution/YAxis",
case 5: m_rParent.SetDivisionX(static_cast<short>(nSet)); break;// "Subdivision/XAxis",
case 6: m_rParent.SetDivisionY(static_cast<short>(nSet)); break;// "Subdivision/YAxis"
}
diff --git a/sw/source/uibase/envelp/envimg.cxx b/sw/source/uibase/envelp/envimg.cxx
index e1db006171dc..b676b028f018 100644
--- a/sw/source/uibase/envelp/envimg.cxx
+++ b/sw/source/uibase/envelp/envimg.cxx
@@ -174,27 +174,27 @@ SwEnvCfgItem::SwEnvCfgItem() :
case 2: m_aEnvItem.m_bSend = *o3tl::doAccess<bool>(pValues[nProp]); break;// "Inscription/UseSender",
case 3:
pValues[nProp] >>= m_aEnvItem.m_nAddrFromLeft;// "Format/AddresseeFromLeft",
- m_aEnvItem.m_nAddrFromLeft = convertMm100ToTwip(m_aEnvItem.m_nAddrFromLeft);
+ m_aEnvItem.m_nAddrFromLeft = o3tl::toTwips(m_aEnvItem.m_nAddrFromLeft, o3tl::Length::mm100);
break;
case 4:
pValues[nProp] >>= m_aEnvItem.m_nAddrFromTop; // "Format/AddresseeFromTop",
- m_aEnvItem.m_nAddrFromTop = convertMm100ToTwip(m_aEnvItem.m_nAddrFromTop);
+ m_aEnvItem.m_nAddrFromTop = o3tl::toTwips(m_aEnvItem.m_nAddrFromTop, o3tl::Length::mm100);
break;
case 5:
pValues[nProp] >>= m_aEnvItem.m_nSendFromLeft; // "Format/SenderFromLeft",
- m_aEnvItem.m_nSendFromLeft = convertMm100ToTwip(m_aEnvItem.m_nSendFromLeft);
+ m_aEnvItem.m_nSendFromLeft = o3tl::toTwips(m_aEnvItem.m_nSendFromLeft, o3tl::Length::mm100);
break;
case 6:
pValues[nProp] >>= m_aEnvItem.m_nSendFromTop;// "Format/SenderFromTop",
- m_aEnvItem.m_nSendFromTop = convertMm100ToTwip(m_aEnvItem.m_nSendFromTop);
+ m_aEnvItem.m_nSendFromTop = o3tl::toTwips(m_aEnvItem.m_nSendFromTop, o3tl::Length::mm100);
break;
case 7:
pValues[nProp] >>= m_aEnvItem.m_nWidth; // "Format/Width",
- m_aEnvItem.m_nWidth = convertMm100ToTwip(m_aEnvItem.m_nWidth);
+ m_aEnvItem.m_nWidth = o3tl::toTwips(m_aEnvItem.m_nWidth, o3tl::Length::mm100);
break;
case 8:
pValues[nProp] >>= m_aEnvItem.m_nHeight; // "Format/Height",
- m_aEnvItem.m_nHeight = convertMm100ToTwip(m_aEnvItem.m_nHeight);
+ m_aEnvItem.m_nHeight = o3tl::toTwips(m_aEnvItem.m_nHeight, o3tl::Length::mm100);
break;
case 9:
{
@@ -204,11 +204,11 @@ SwEnvCfgItem::SwEnvCfgItem() :
case 10: m_aEnvItem.m_bPrintFromAbove = *o3tl::doAccess<bool>(pValues[nProp]); break;// "Print/FromAbove",
case 11:
pValues[nProp] >>= m_aEnvItem.m_nShiftRight;
- m_aEnvItem.m_nShiftRight = convertMm100ToTwip(m_aEnvItem.m_nShiftRight);// "Print/Right",
+ m_aEnvItem.m_nShiftRight = o3tl::toTwips(m_aEnvItem.m_nShiftRight, o3tl::Length::mm100);// "Print/Right",
break;
case 12:
pValues[nProp] >>= m_aEnvItem.m_nShiftDown;
- m_aEnvItem.m_nShiftDown = convertMm100ToTwip(m_aEnvItem.m_nShiftDown);
+ m_aEnvItem.m_nShiftDown = o3tl::toTwips(m_aEnvItem.m_nShiftDown, o3tl::Length::mm100);
break;// "Print/Down"
}
}
diff --git a/sw/source/uibase/envelp/labelcfg.cxx b/sw/source/uibase/envelp/labelcfg.cxx
index e0fbe142f688..413768e030f3 100644
--- a/sw/source/uibase/envelp/labelcfg.cxx
+++ b/sw/source/uibase/envelp/labelcfg.cxx
@@ -180,16 +180,16 @@ static std::unique_ptr<SwLabRec> lcl_CreateSwLabRec(const OUString& rType, const
switch(nTok++)
{
case 0 : pNewRec->m_bCont = sToken[0] == 'C'; break;
- case 1 : pNewRec->m_nHDist = convertMm100ToTwip(nVal); break;
- case 2 : pNewRec->m_nVDist = convertMm100ToTwip(nVal); break;
- case 3 : pNewRec->m_nWidth = convertMm100ToTwip(nVal); break;
- case 4 : pNewRec->m_nHeight = convertMm100ToTwip(nVal); break;
- case 5 : pNewRec->m_nLeft = convertMm100ToTwip(nVal); break;
- case 6 : pNewRec->m_nUpper = convertMm100ToTwip(nVal); break;
+ case 1 : pNewRec->m_nHDist = o3tl::toTwips(nVal, o3tl::Length::mm100); break;
+ case 2 : pNewRec->m_nVDist = o3tl::toTwips(nVal, o3tl::Length::mm100); break;
+ case 3 : pNewRec->m_nWidth = o3tl::toTwips(nVal, o3tl::Length::mm100); break;
+ case 4 : pNewRec->m_nHeight = o3tl::toTwips(nVal, o3tl::Length::mm100); break;
+ case 5 : pNewRec->m_nLeft = o3tl::toTwips(nVal, o3tl::Length::mm100); break;
+ case 6 : pNewRec->m_nUpper = o3tl::toTwips(nVal, o3tl::Length::mm100); break;
case 7 : pNewRec->m_nCols = nVal; break;
case 8 : pNewRec->m_nRows = nVal; break;
- case 9 : pNewRec->m_nPWidth = convertMm100ToTwip(nVal); break;
- case 10 : pNewRec->m_nPHeight = convertMm100ToTwip(nVal); break;
+ case 9 : pNewRec->m_nPWidth = o3tl::toTwips(nVal, o3tl::Length::mm100); break;
+ case 10 : pNewRec->m_nPHeight = o3tl::toTwips(nVal, o3tl::Length::mm100); break;
}
}
// lines added for compatibility with custom label definitions saved before patch fdo#44516
diff --git a/sw/source/uibase/envelp/labimg.cxx b/sw/source/uibase/envelp/labimg.cxx
index 5e7051cbc8b7..a3cfc5cc52b6 100644
--- a/sw/source/uibase/envelp/labimg.cxx
+++ b/sw/source/uibase/envelp/labimg.cxx
@@ -287,35 +287,35 @@ SwLabCfgItem::SwLabCfgItem(bool bLabel) :
case 4: pValues[nProp] >>= aItem.m_nRows; break;// "Format/Row",
case 5:
pValues[nProp] >>= aItem.m_lHDist;
- aItem.m_lHDist = convertMm100ToTwip(aItem.m_lHDist);
+ aItem.m_lHDist = o3tl::toTwips(aItem.m_lHDist, o3tl::Length::mm100);
break;// "Format/HorizontalDistance",
case 6:
pValues[nProp] >>= aItem.m_lVDist;
- aItem.m_lVDist = convertMm100ToTwip(aItem.m_lVDist);
+ aItem.m_lVDist = o3tl::toTwips(aItem.m_lVDist, o3tl::Length::mm100);
break;// "Format/VerticalDistance",
case 7:
pValues[nProp] >>= aItem.m_lWidth;
- aItem.m_lWidth = convertMm100ToTwip(aItem.m_lWidth);
+ aItem.m_lWidth = o3tl::toTwips(aItem.m_lWidth, o3tl::Length::mm100);
break;// "Format/Width",
case 8:
pValues[nProp] >>= aItem.m_lHeight;
- aItem.m_lHeight = convertMm100ToTwip(aItem.m_lHeight);
+ aItem.m_lHeight = o3tl::toTwips(aItem.m_lHeight, o3tl::Length::mm100);
break;// "Format/Height",
case 9:
pValues[nProp] >>= aItem.m_lLeft;
- aItem.m_lLeft = convertMm100ToTwip(aItem.m_lLeft);
+ aItem.m_lLeft = o3tl::toTwips(aItem.m_lLeft, o3tl::Length::mm100);
break;// "Format/LeftMargin",
case 10:
pValues[nProp] >>= aItem.m_lUpper;
- aItem.m_lUpper = convertMm100ToTwip(aItem.m_lUpper);
+ aItem.m_lUpper = o3tl::toTwips(aItem.m_lUpper, o3tl::Length::mm100);
break;// "Format/TopMargin",
case 11:
pValues[nProp] >>= aItem.m_lPWidth;
- aItem.m_lPWidth = convertMm100ToTwip(aItem.m_lPWidth);
+ aItem.m_lPWidth = o3tl::toTwips(aItem.m_lPWidth, o3tl::Length::mm100);
break;// "Format/PageWidth",
case 12:
pValues[nProp] >>= aItem.m_lPHeight;
- aItem.m_lPHeight = convertMm100ToTwip(aItem.m_lPHeight);
+ aItem.m_lPHeight = o3tl::toTwips(aItem.m_lPHeight, o3tl::Length::mm100);
break;// "Format/PageHeight",
case 13: aItem.m_bSynchron = *o3tl::doAccess<bool>(pValues[nProp]); break;// "Option/Synchronize",
case 14: aItem.m_bPage = *o3tl::doAccess<bool>(pValues[nProp]); break;// "Option/Page",
diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx
index a93432251a47..a217b5d56ecb 100644
--- a/sw/source/uibase/shells/grfsh.cxx
+++ b/sw/source/uibase/shells/grfsh.cxx
@@ -211,10 +211,10 @@ void SwGrfShell::Execute(SfxRequest &rReq)
rSh.StartUndo(SwUndoId::START);
tools::Rectangle aScaledCropedRectangle = aDialog.GetScaledCropRectangle();
- aCrop.SetLeft( convertMm100ToTwip( aScaledCropedRectangle.Left() ));
- aCrop.SetTop( convertMm100ToTwip( aScaledCropedRectangle.Top() ));
- aCrop.SetRight( convertMm100ToTwip( aScaledCropedRectangle.Right() ));
- aCrop.SetBottom( convertMm100ToTwip( aScaledCropedRectangle.Bottom() ));
+ aCrop.SetLeft( o3tl::toTwips( aScaledCropedRectangle.Left(), o3tl::Length::mm100 ));
+ aCrop.SetTop( o3tl::toTwips( aScaledCropedRectangle.Top(), o3tl::Length::mm100 ));
+ aCrop.SetRight( o3tl::toTwips( aScaledCropedRectangle.Right(), o3tl::Length::mm100 ));
+ aCrop.SetBottom( o3tl::toTwips( aScaledCropedRectangle.Bottom(), o3tl::Length::mm100 ));
Graphic aCompressedGraphic( aDialog.GetCompressedGraphic() );
rSh.ReRead(OUString(), OUString(), const_cast<const Graphic*>(&aCompressedGraphic));
diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx
index 7880e4fcacd8..7ac084f44aa4 100644
--- a/sw/source/uibase/uiview/view.cxx
+++ b/sw/source/uibase/uiview/view.cxx
@@ -1324,35 +1324,35 @@ void SwView::ReadUserDataSequence ( const uno::Sequence < beans::PropertyValue >
if ( rValue.Name == "ViewLeft" )
{
rValue.Value >>= nX;
- nX = convertMm100ToTwip( nX );
+ nX = o3tl::toTwips(nX, o3tl::Length::mm100);
}
else if ( rValue.Name == "ViewTop" )
{
rValue.Value >>= nY;
- nY = convertMm100ToTwip( nY );
+ nY = o3tl::toTwips(nY, o3tl::Length::mm100);
}
else if ( rValue.Name == "VisibleLeft" )
{
rValue.Value >>= nLeft;
- nLeft = convertMm100ToTwip( nLeft );
+ nLeft = o3tl::toTwips(nLeft, o3tl::Length::mm100);
bGotVisibleLeft = true;
}
else if ( rValue.Name == "VisibleTop" )
{
rValue.Value >>= nTop;
- nTop = convertMm100ToTwip( nTop );
+ nTop = o3tl::toTwips(nTop, o3tl::Length::mm100);
bGotVisibleTop = true;
}
else if ( rValue.Name == "VisibleRight" )
{
rValue.Value >>= nRight;
- nRight = convertMm100ToTwip( nRight );
+ nRight = o3tl::toTwips(nRight, o3tl::Length::mm100);
bGotVisibleRight = true;
}
else if ( rValue.Name == "VisibleBottom" )
{
rValue.Value >>= nBottom;
- nBottom = convertMm100ToTwip( nBottom );
+ nBottom = o3tl::toTwips(nBottom, o3tl::Length::mm100);
bGotVisibleBottom = true;
}
else if ( rValue.Name == "ZoomType" )
diff --git a/sw/source/uibase/uno/unomod.cxx b/sw/source/uibase/uno/unomod.cxx
index fa1c432d7591..44fe733886bd 100644
--- a/sw/source/uibase/uno/unomod.cxx
+++ b/sw/source/uibase/uno/unomod.cxx
@@ -610,7 +610,7 @@ void SwXViewSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, c
if(!(rValue >>= nTmp) || nTmp < 10)
throw IllegalArgumentException();
Size aSize( mpViewOption->GetSnapSize() );
- aSize.setWidth( convertMm100ToTwip( nTmp ) );
+ aSize.setWidth( o3tl::toTwips(nTmp, o3tl::Length::mm100) );
mpViewOption->SetSnapSize( aSize );
}
break;
@@ -620,7 +620,7 @@ void SwXViewSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, c
if(!(rValue >>= nTmp) || nTmp < 10)
throw IllegalArgumentException();
Size aSize( mpViewOption->GetSnapSize() );
- aSize.setHeight( convertMm100ToTwip( nTmp ) );
+ aSize.setHeight( o3tl::toTwips(nTmp, o3tl::Length::mm100) );
mpViewOption->SetSnapSize( aSize );
}
break;
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 51dfac84254c..2037d316a0f2 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -1071,27 +1071,27 @@ void SwXTextDocument::setPagePrintSettings(const Sequence< beans::PropertyValue
}
else if(sName == "LeftMargin")
{
- aData.SetLeftSpace(convertMm100ToTwip(nVal));
+ aData.SetLeftSpace(o3tl::toTwips(nVal, o3tl::Length::mm100));
}
else if(sName == "RightMargin")
{
- aData.SetRightSpace(convertMm100ToTwip(nVal));
+ aData.SetRightSpace(o3tl::toTwips(nVal, o3tl::Length::mm100));
}
else if(sName == "TopMargin")
{
- aData.SetTopSpace(convertMm100ToTwip(nVal));
+ aData.SetTopSpace(o3tl::toTwips(nVal, o3tl::Length::mm100));
}
else if(sName == "BottomMargin")
{
- aData.SetBottomSpace(convertMm100ToTwip(nVal));
+ aData.SetBottomSpace(o3tl::toTwips(nVal, o3tl::Length::mm100));
}
else if(sName == "HoriMargin")
{
- aData.SetHorzSpace(convertMm100ToTwip(nVal));
+ aData.SetHorzSpace(o3tl::toTwips(nVal, o3tl::Length::mm100));
}
else if(sName == "VertMargin")
{
- aData.SetVertSpace(convertMm100ToTwip(nVal));
+ aData.SetVertSpace(o3tl::toTwips(nVal, o3tl::Length::mm100));
}
else if(sName == "IsLandscape")
{
diff --git a/sw/source/uibase/utlui/uiitems.cxx b/sw/source/uibase/utlui/uiitems.cxx
index de816541cb07..7088018ccb63 100644
--- a/sw/source/uibase/utlui/uiitems.cxx
+++ b/sw/source/uibase/utlui/uiitems.cxx
@@ -129,7 +129,7 @@ bool SwPageFootnoteInfoItem::PutValue(const Any& rVal, sal_uInt8 nMemberId)
bRet = false;
else
{
- nSet32 = convertMm100ToTwip(nSet32);
+ nSet32 = o3tl::toTwips(nSet32, o3tl::Length::mm100);
switch(nMemberId & ~CONVERT_TWIPS)
{
case MID_FTN_HEIGHT: aFootnoteInfo.SetHeight(nSet32); break;
@@ -143,7 +143,7 @@ bool SwPageFootnoteInfoItem::PutValue(const Any& rVal, sal_uInt8 nMemberId)
sal_Int16 nSet = 0;
rVal >>= nSet;
if(nSet >= 0)
- aFootnoteInfo.SetLineWidth(convertMm100ToTwip(nSet));
+ aFootnoteInfo.SetLineWidth(o3tl::toTwips(nSet, o3tl::Length::mm100));
else
bRet = false;
}
diff --git a/tools/qa/cppunit/test_100mm2twips.cxx b/tools/qa/cppunit/test_100mm2twips.cxx
index bfed8c2e2ba9..fc1d228f2d49 100644
--- a/tools/qa/cppunit/test_100mm2twips.cxx
+++ b/tools/qa/cppunit/test_100mm2twips.cxx
@@ -34,12 +34,6 @@ public:
CPPUNIT_ASSERT_EQUAL(sal_Int64(-145), sanitiseMm100ToTwip(-255));
}
- void testConvertMm100ToTwip()
- {
- CPPUNIT_ASSERT_EQUAL(sal_Int64(145), convertMm100ToTwip(255));
- CPPUNIT_ASSERT_EQUAL(sal_Int64(-145), convertMm100ToTwip(-255));
- }
-
void testConvertPointToMm100()
{
CPPUNIT_ASSERT_DOUBLES_EQUAL(599.72, convertPointToMm100(17.0), 1E-2);
@@ -51,7 +45,6 @@ public:
CPPUNIT_TEST_SUITE(UnitConversionTest);
CPPUNIT_TEST(testSanitiseMm100ToTwip);
- CPPUNIT_TEST(testConvertMm100ToTwip);
CPPUNIT_TEST(testConvertPointToMm100);
CPPUNIT_TEST_SUITE_END();
};
diff --git a/vcl/source/filter/ipdf/pdfread.cxx b/vcl/source/filter/ipdf/pdfread.cxx
index 87af9c6c5c90..e1206e985eaa 100644
--- a/vcl/source/filter/ipdf/pdfread.cxx
+++ b/vcl/source/filter/ipdf/pdfread.cxx
@@ -26,7 +26,7 @@ namespace
/// Convert to inch, then assume 96 DPI.
inline double pointToPixel(const double fPoint, const double fResolutionDPI)
{
- return fPoint * fResolutionDPI / 72.;
+ return o3tl::convert(fPoint, o3tl::Length::pt, o3tl::Length::in) * fResolutionDPI;
}
/// Decide if PDF data is old enough to be compatible.
@@ -159,13 +159,15 @@ size_t RenderPDFBitmaps(const void* pBuffer, int nSize, std::vector<BitmapEx>& r
break;
// Calculate the bitmap size in points.
- size_t nPageWidthPoints = pPdfPage->getWidth();
- size_t nPageHeightPoints = pPdfPage->getHeight();
+ double nPageWidthPoints = pPdfPage->getWidth();
+ double nPageHeightPoints = pPdfPage->getHeight();
if (pSizeHint && pSizeHint->getX() && pSizeHint->getY())
{
// Have a size hint, prefer that over the logic size from the PDF.
- nPageWidthPoints = convertMm100ToTwip(pSizeHint->getX()) / 20;
- nPageHeightPoints = convertMm100ToTwip(pSizeHint->getY()) / 20;
+ nPageWidthPoints
+ = o3tl::convert(pSizeHint->getX(), o3tl::Length::mm100, o3tl::Length::pt);
+ nPageHeightPoints
+ = o3tl::convert(pSizeHint->getY(), o3tl::Length::mm100, o3tl::Length::pt);
}
// Returned unit is points, convert that to pixel.
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx
index 1d4c70f613a1..b0f1102ad785 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -900,12 +900,12 @@ void ListsManager::lcl_sprm( Sprm& rSprm )
const int nHeight = nFontHeight * 35;
int nWidth = (nHeight * aPrefSize.Width) / aPrefSize.Height;
- awt::Size aSize( convertMm100ToTwip(nWidth), convertMm100ToTwip(nHeight) );
+ awt::Size aSize( o3tl::toTwips(nWidth, o3tl::Length::mm100), o3tl::toTwips(nHeight, o3tl::Length::mm100) );
pCurrentLevel->SetGraphicSize( aSize );
}
else
{
- awt::Size aSize( convertMm100ToTwip(aPrefSize.Width), convertMm100ToTwip(aPrefSize.Height) );
+ awt::Size aSize( o3tl::toTwips(aPrefSize.Width, o3tl::Length::mm100), o3tl::toTwips(aPrefSize.Height, o3tl::Length::mm100) );
pCurrentLevel->SetGraphicSize( aSize );
}
}
diff --git a/xmloff/source/transform/TransformerBase.cxx b/xmloff/source/transform/TransformerBase.cxx
index 8814d19f26af..f75a2755223e 100644
--- a/xmloff/source/transform/TransformerBase.cxx
+++ b/xmloff/source/transform/TransformerBase.cxx
@@ -722,7 +722,7 @@ XMLMutableAttributeList *XMLTransformerBase::ProcessAttrList(
if (::sax::Converter::convertMeasure(nMeasure,
aAttrValue))
{
- nMeasure = static_cast<sal_Int32>(convertMm100ToTwip(nMeasure));
+ nMeasure = o3tl::toTwips(nMeasure, o3tl::Length::mm100);
OUStringBuffer aBuffer;
::sax::Converter::convertMeasure( aBuffer,