From 75495067f6f4ba47bb7ff7fe2426f2199c175c78 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sat, 22 Jan 2022 15:45:49 +0300 Subject: Use o3tl::convert instead of OutputDevice::LogicToLogic Change-Id: Ifb7be992c6e951692a741d10ed24ec8b3836982a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128782 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- sw/source/core/access/accmap.cxx | 13 +++---------- sw/source/core/frmedt/fefly1.cxx | 4 +--- sw/source/core/layout/atrfrm.cxx | 10 +++++----- sw/source/core/ole/ndole.cxx | 4 +--- sw/source/core/unocore/unoframe.cxx | 4 ++-- sw/source/filter/html/htmlflywriter.cxx | 5 ++--- sw/source/filter/ww8/ww8par3.cxx | 3 +-- 7 files changed, 15 insertions(+), 28 deletions(-) (limited to 'sw') diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index 4b0506475e51..439749f900bf 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -3031,19 +3031,14 @@ void SwAccessibleMap::FireEvents() tools::Rectangle SwAccessibleMap::GetVisibleArea() const { - MapMode aSrc( MapUnit::MapTwip ); - MapMode aDest( MapUnit::Map100thMM ); - return OutputDevice::LogicToLogic( GetVisArea().SVRect(), aSrc, aDest ); + return o3tl::convert( GetVisArea().SVRect(), o3tl::Length::twip, o3tl::Length::mm100 ); } // Convert a MM100 value relative to the document root into a pixel value // relative to the screen! Point SwAccessibleMap::LogicToPixel( const Point& rPoint ) const { - MapMode aSrc( MapUnit::Map100thMM ); - MapMode aDest( MapUnit::MapTwip ); - - Point aPoint = OutputDevice::LogicToLogic( rPoint, aSrc, aDest ); + Point aPoint = o3tl::toTwips( rPoint, o3tl::Length::mm100 ); if (const vcl::Window* pWin = GetShell()->GetWin()) { MapMode aMapMode; @@ -3057,9 +3052,7 @@ Point SwAccessibleMap::LogicToPixel( const Point& rPoint ) const Size SwAccessibleMap::LogicToPixel( const Size& rSize ) const { - MapMode aSrc( MapUnit::Map100thMM ); - MapMode aDest( MapUnit::MapTwip ); - Size aSize( OutputDevice::LogicToLogic( rSize, aSrc, aDest ) ); + Size aSize( o3tl::toTwips( rSize, o3tl::Length::mm100 ) ); if (const OutputDevice* pWin = GetShell()->GetWin()->GetOutDev()) { MapMode aMapMode; diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index 8158359458b7..e5d66afd9f73 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -2085,9 +2085,7 @@ void SwFEShell::AlignFormulaToBaseline( const uno::Reference < embed::XEmbeddedO } sal_Int32 nBaseline = ::comphelper::getINT32(aBaseline); - const MapMode aSourceMapMode( MapUnit::Map100thMM ); - const MapMode aTargetMapMode( MapUnit::MapTwip ); - nBaseline = OutputDevice::LogicToLogic( nBaseline, aSourceMapMode.GetMapUnit(), aTargetMapMode.GetMapUnit() ); + nBaseline = o3tl::toTwips( nBaseline, o3tl::Length::mm100 ); OSL_ENSURE( nBaseline > 0, "Wrong value of Baseline while retrieving from Starmath!" ); //nBaseline must be moved by aPrt position diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index 4791fda80169..871cb21b0a6b 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -3554,13 +3554,13 @@ IMapObject* SwFrameFormat::GetIMapObject( const Point& rPoint, { Point aPos( rPoint ); Size aActSz ( pRef == pFly ? pFly->getFrameArea().SSize() : pRef->getFramePrintArea().SSize() ); - const MapMode aSrc ( MapUnit::MapTwip ); - const MapMode aDest( MapUnit::Map100thMM ); - aOrigSz = OutputDevice::LogicToLogic( aOrigSz, aSrc, aDest ); - aActSz = OutputDevice::LogicToLogic( aActSz, aSrc, aDest ); + const o3tl::Length aSrc ( o3tl::Length::twip ); + const o3tl::Length aDest( o3tl::Length::mm100 ); + aOrigSz = o3tl::convert( aOrigSz, aSrc, aDest ); + aActSz = o3tl::convert( aActSz, aSrc, aDest ); aPos -= pRef->getFrameArea().Pos(); aPos -= pRef->getFramePrintArea().Pos(); - aPos = OutputDevice::LogicToLogic( aPos, aSrc, aDest ); + aPos = o3tl::convert( aPos, aSrc, aDest ); sal_uInt32 nFlags = 0; if ( pFly != pRef && pNd->IsGrfNode() ) { diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx index d553768db7ce..531a76a30c48 100644 --- a/sw/source/core/ole/ndole.cxx +++ b/sw/source/core/ole/ndole.cxx @@ -956,9 +956,7 @@ uno::Reference < embed::XEmbeddedObject > const & SwOLEObj::GetOleRef() if ( pFrame ) { Size aSz( pFrame->getFrameArea().SSize() ); - const MapMode aSrc ( MapUnit::MapTwip ); - const MapMode aDest( MapUnit::Map100thMM ); - aSz = OutputDevice::LogicToLogic( aSz, aSrc, aDest ); + aSz = o3tl::convert( aSz, o3tl::Length::twip, o3tl::Length::mm100 ); aArea.SetSize( aSz ); } else diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 5ba3ecf98f8e..fff6c1c66b41 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -2247,9 +2247,9 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName) { OSL_ENSURE( pTmpFrame->isFrameAreaDefinitionValid(), "frame not valid" ); const SwRect &rRect = pTmpFrame->getFrameArea(); - Size aMM100Size = OutputDevice::LogicToLogic( + Size aMM100Size = o3tl::convert( Size( rRect.Width(), rRect.Height() ), - MapMode( MapUnit::MapTwip ), MapMode( MapUnit::Map100thMM )); + o3tl::Length::twip, o3tl::Length::mm100 ); aAny <<= awt::Size( aMM100Size.Width(), aMM100Size.Height() ); } } diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx index 2aee659fc6e8..75938fbe217c 100644 --- a/sw/source/filter/html/htmlflywriter.cxx +++ b/sw/source/filter/html/htmlflywriter.cxx @@ -1937,10 +1937,9 @@ static Writer& OutHTML_FrameFormatGrfNode( Writer& rWrt, const SwFrameFormat& rF default: break; } - Size aMM100Size; const SwFormatFrameSize& rSize = rFrameFormat.GetFrameSize(); - aMM100Size = OutputDevice::LogicToLogic( rSize.GetSize(), - MapMode( MapUnit::MapTwip ), MapMode( MapUnit::Map100thMM )); + Size aMM100Size = o3tl::convert( rSize.GetSize(), + o3tl::Length::twip, o3tl::Length::mm100 ); OUString aFilterName(""); diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index a3a01db9304b..f59962580e2b 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -2356,8 +2356,7 @@ awt::Size SwWW8ImplReader::MiserableDropDownFormHack(const OUString &rString, static_cast(pItem)->GetHeight() ); aTmp <<= static_cast(aSize.Height()) / 20.0; - aFont.SetFontSize(OutputDevice::LogicToLogic(aSize, - MapMode(MapUnit::MapTwip), MapMode(MapUnit::Map100thMM))); + aFont.SetFontSize(o3tl::convert(aSize, o3tl::Length::twip, o3tl::Length::mm100)); } break; -- cgit