summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2022-01-22 15:45:49 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2022-01-22 20:02:15 +0100
commit75495067f6f4ba47bb7ff7fe2426f2199c175c78 (patch)
treee8d6146f42227efedd931ac93ea423fd9307e315
parent5e3ee8a1fff0ef0d77f274d1826a1e63e4a00040 (diff)
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 <mike.kaganski@collabora.com>
-rw-r--r--desktop/source/lib/init.cxx2
-rw-r--r--reportdesign/source/ui/misc/UITools.cxx2
-rw-r--r--sc/source/core/data/column2.cxx23
-rw-r--r--sc/source/filter/excel/xechart.cxx2
-rw-r--r--sc/source/ui/view/gridwin4.cxx3
-rw-r--r--sd/source/filter/eppt/eppt.cxx5
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx2
-rw-r--r--sd/source/ui/view/ViewShellBase.cxx2
-rw-r--r--svx/source/table/tablecontroller.cxx2
-rw-r--r--sw/source/core/access/accmap.cxx13
-rw-r--r--sw/source/core/frmedt/fefly1.cxx4
-rw-r--r--sw/source/core/layout/atrfrm.cxx10
-rw-r--r--sw/source/core/ole/ndole.cxx4
-rw-r--r--sw/source/core/unocore/unoframe.cxx4
-rw-r--r--sw/source/filter/html/htmlflywriter.cxx5
-rw-r--r--sw/source/filter/ww8/ww8par3.cxx3
-rw-r--r--vcl/source/window/printdlg.cxx10
17 files changed, 40 insertions, 56 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 3370779df25d..6e41ede6c35f 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -4210,7 +4210,7 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pComma
|| rPropValue.Name == "TransformRotationY")
{
rPropValue.Value >>= value;
- value = OutputDevice::LogicToLogic(value, MapUnit::MapTwip, MapUnit::Map100thMM);
+ value = o3tl::convert(value, o3tl::Length::twip, o3tl::Length::mm100);
rPropValue.Value <<= value;
}
}
diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx
index 066d330df338..243474ac39de 100644
--- a/reportdesign/source/ui/misc/UITools.cxx
+++ b/reportdesign/source/ui/misc/UITools.cxx
@@ -393,7 +393,7 @@ namespace
if ( SfxItemState::SET == _rItemSet.GetItemState( _nFontHeight,true,&pItem) )
if ( auto pFontItem = dynamic_cast< const SvxFontHeightItem *>( pItem ) )
{
- aNewFont.SetFontHeight(OutputDevice::LogicToLogic(Size(0, pFontItem->GetHeight()), MapMode(MapUnit::MapTwip), MapMode(MapUnit::MapPoint)).Height());
+ aNewFont.SetFontHeight(o3tl::convert(pFontItem->GetHeight(), o3tl::Length::twip, o3tl::Length::pt));
}
if ( SfxItemState::SET == _rItemSet.GetItemState( _nPosture,true,&pItem) )
if ( auto pFontItem = dynamic_cast< const SvxPostureItem *>( pItem ) )
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 037e34658c5d..905fc0c3373c 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -370,7 +370,6 @@ tools::Long ScColumn::GetNeededSize(
vcl::Font aOldFont = pDev->GetFont();
MapMode aHMMMode( MapUnit::Map100thMM, Point(), rZoomX, rZoomY );
- MapMode aTwipMode(MapUnit::MapTwip, Point(), rZoomX, rZoomY);
// save in document ?
std::unique_ptr<ScFieldEditEngine> pEngine = rDocument.CreateFieldEditEngine();
@@ -447,7 +446,7 @@ tools::Long ScColumn::GetNeededSize(
if ( !bTextWysiwyg )
{
aPaper = bInPrintTwips ?
- OutputDevice::LogicToLogic(aPaper, aTwipMode, aHMMMode) :
+ o3tl::convert(aPaper, o3tl::Length::twip, o3tl::Length::mm100) :
pDev->PixelToLogic(aPaper, aHMMMode);
}
}
@@ -502,7 +501,7 @@ tools::Long ScColumn::GetNeededSize(
aSize = Size( nWidth, nHeight );
Size aTextSize = bInPrintTwips ?
- OutputDevice::LogicToLogic(aSize, aHMMMode, aTwipMode) :
+ o3tl::toTwips(aSize, o3tl::Length::mm100) :
pDev->LogicToPixel(aSize, aHMMMode);
if ( bEdWidth )
@@ -526,18 +525,18 @@ tools::Long ScColumn::GetNeededSize(
nValue = 0;
else
{
- Size aTextSize(pEngine->CalcTextWidth(), 0);
+ sal_uInt32 aTextSize(pEngine->CalcTextWidth());
nValue = bInPrintTwips ?
- OutputDevice::LogicToLogic(aTextSize, aHMMMode, aTwipMode).Width() :
- pDev->LogicToPixel(aTextSize, aHMMMode).Width();
+ o3tl::toTwips(aTextSize, o3tl::Length::mm100) :
+ pDev->LogicToPixel(Size(aTextSize, 0), aHMMMode).Width();
}
}
else // height
{
- Size aTextSize(0, pEngine->GetTextHeight());
+ sal_uInt32 aTextSize(pEngine->GetTextHeight());
nValue = bInPrintTwips ?
- OutputDevice::LogicToLogic(aTextSize, aHMMMode, aTwipMode).Height() :
- pDev->LogicToPixel(aTextSize, aHMMMode).Height();
+ o3tl::toTwips(aTextSize, o3tl::Length::mm100) :
+ pDev->LogicToPixel(Size(0, aTextSize), aHMMMode).Height();
// With non-100% zoom and several lines or paragraphs, don't shrink below the result with FORMAT100 set
if ( !bTextWysiwyg && ( rZoomY.GetNumerator() != 1 || rZoomY.GetDenominator() != 1 ) &&
@@ -545,10 +544,10 @@ tools::Long ScColumn::GetNeededSize(
{
pEngine->SetControlWord( nCtrl | EEControlBits::FORMAT100 );
pEngine->QuickFormatDoc( true );
- aTextSize = Size(0, pEngine->GetTextHeight());
+ aTextSize = pEngine->GetTextHeight();
tools::Long nSecondValue = bInPrintTwips ?
- OutputDevice::LogicToLogic(aTextSize, aHMMMode, aTwipMode).Height() :
- pDev->LogicToPixel(aTextSize, aHMMMode).Height();
+ o3tl::toTwips(aTextSize, o3tl::Length::mm100) :
+ pDev->LogicToPixel(Size(0, aTextSize), aHMMMode).Height();
if ( nSecondValue > nValue )
nValue = nSecondValue;
}
diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx
index 78fe80cadc6f..0460ca371c1b 100644
--- a/sc/source/filter/excel/xechart.cxx
+++ b/sc/source/filter/excel/xechart.cxx
@@ -3303,7 +3303,7 @@ XclExpChChart::XclExpChChart( const XclExpRoot& rRoot,
Reference< XChartDocument > const & xChartDoc, const tools::Rectangle& rChartRect ) :
XclExpChGroupBase( XclExpChRoot( rRoot, *this ), EXC_CHFRBLOCK_TYPE_CHART, EXC_ID_CHCHART, 16 )
{
- Size aPtSize = OutputDevice::LogicToLogic( rChartRect.GetSize(), MapMode( MapUnit::Map100thMM ), MapMode( MapUnit::MapPoint ) );
+ Size aPtSize = o3tl::convert( rChartRect.GetSize(), o3tl::Length::mm100, o3tl::Length::pt );
// rectangle is stored in 16.16 fixed-point format
maRect.mnX = maRect.mnY = 0;
maRect.mnWidth = static_cast< sal_Int32 >( aPtSize.Width() << 16 );
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 84d844882da1..18a8ef76f2cd 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1223,8 +1223,7 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
// This is for sending the pixel-aligned twips position of the cursor to the specific views with
// the same given zoom level.
tools::Rectangle aCursorRect = pEditView->GetEditCursor();
- Point aCursPos = OutputDevice::LogicToLogic(aCursorRect.TopLeft(),
- MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
+ Point aCursPos = o3tl::toTwips(aCursorRect.TopLeft(), o3tl::Length::mm100);
const MapMode& rDevMM = rDevice.GetMapMode();
MapMode aMM(MapUnit::MapTwip);
diff --git a/sd/source/filter/eppt/eppt.cxx b/sd/source/filter/eppt/eppt.cxx
index 117c39d34453..b31fa4ed42a3 100644
--- a/sd/source/filter/eppt/eppt.cxx
+++ b/sd/source/filter/eppt/eppt.cxx
@@ -1070,9 +1070,8 @@ void ImplExportComments( const uno::Reference< drawing::XDrawPage >& xPage, SvMe
uno::Reference< office::XAnnotation > xAnnotation( xAnnotationEnumeration->nextElement() );
geometry::RealPoint2D aRealPoint2D( xAnnotation->getPosition() );
- MapMode aMapDest( MapUnit::MapInch, Point(), Fraction( 1, 576 ), Fraction( 1, 576 ) );
- Point aPoint( OutputDevice::LogicToLogic( Point( static_cast< sal_Int32 >( aRealPoint2D.X * 100.0 ),
- static_cast<sal_Int32>(aRealPoint2D.Y * 100.0)), MapMode(MapUnit::Map100thMM), aMapDest));
+ Point aPoint(o3tl::convert(aRealPoint2D.X, o3tl::Length::mm, o3tl::Length::master),
+ o3tl::convert(aRealPoint2D.Y, o3tl::Length::mm, o3tl::Length::master));
OUString sAuthor( xAnnotation->getAuthor() );
uno::Reference< text::XText > xText( xAnnotation->getTextRange() );
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index f0b939acb999..1fb8982a17fa 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2439,7 +2439,7 @@ void SdXImpressDocument::getPostIts(::tools::JsonWriter& rJsonWriter)
geometry::RealPoint2D const & rPoint = xAnnotation->getPosition();
geometry::RealSize2D const & rSize = xAnnotation->getSize();
::tools::Rectangle aRectangle(Point(rPoint.X * 100.0, rPoint.Y * 100.0), Size(rSize.Width * 100.0, rSize.Height * 100.0));
- aRectangle = OutputDevice::LogicToLogic(aRectangle, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
+ aRectangle = o3tl::toTwips(aRectangle, o3tl::Length::mm100);
OString sRectangle = aRectangle.toString();
rJsonWriter.put("rectangle", sRectangle.getStr());
}
diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx
index 7cc5a58b8da5..9c22b76c0c86 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -1008,7 +1008,7 @@ void ViewShellBase::NotifyCursor(SfxViewShell* pOtherShell) const
::tools::Rectangle aRectangle = pOutlinerView->GetOutputArea();
vcl::Window* pWin = pThisShell->GetActiveWindow();
if (pWin && pWin->GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
- aRectangle = OutputDevice::LogicToLogic(aRectangle, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
+ aRectangle = o3tl::toTwips(aRectangle, o3tl::Length::mm100);
OString sRectangle = aRectangle.toString();
SfxLokHelper::notifyOtherView(&pDrawViewShell->GetViewShellBase(), pOtherShell, LOK_CALLBACK_VIEW_LOCK, "rectangle", sRectangle);
}
diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx
index 8001979f5d08..a81140c8ddd1 100644
--- a/svx/source/table/tablecontroller.cxx
+++ b/svx/source/table/tablecontroller.cxx
@@ -2370,7 +2370,7 @@ void SvxTableController::updateSelectionOverlay()
tools::Rectangle aSelection(a2DRange.getMinX(), a2DRange.getMinY(), a2DRange.getMaxX(), a2DRange.getMaxY());
if (pOutDev->GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
- aSelection = OutputDevice::LogicToLogic(aSelection, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
+ aSelection = o3tl::toTwips(aSelection, o3tl::Length::mm100);
if(SfxViewShell* pViewShell = SfxViewShell::Current())
{
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<const SvxFontHeightItem*>(pItem)->GetHeight() );
aTmp <<= static_cast<float>(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;
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 46cb72752bbf..e98afe8db92b 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -223,18 +223,18 @@ void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPrevi
// use correct measurements
const LocaleDataWrapper& rLocWrap(Application::GetSettings().GetLocaleDataWrapper());
- MapUnit eUnit = MapUnit::MapMM;
+ o3tl::Length eUnit = o3tl::Length::mm;
int nDigits = 0;
if( rLocWrap.getMeasurementSystemEnum() == MeasurementSystem::US )
{
- eUnit = MapUnit::Map100thInch;
+ eUnit = o3tl::Length::in100;
nDigits = 2;
}
- Size aLogicPaperSize(OutputDevice::LogicToLogic(i_rOrigSize, MapMode(MapUnit::Map100thMM), MapMode(eUnit)));
+ Size aLogicPaperSize(o3tl::convert(i_rOrigSize, o3tl::Length::mm100, eUnit));
OUString aNumText( rLocWrap.getNum( aLogicPaperSize.Width(), nDigits ) );
OUStringBuffer aBuf;
aBuf.append( aNumText + " " );
- aBuf.appendAscii( eUnit == MapUnit::MapMM ? "mm" : "in" );
+ aBuf.appendAscii( eUnit == o3tl::Length::mm ? "mm" : "in" );
if( !i_rPaperName.empty() )
{
aBuf.append( " (" );
@@ -245,7 +245,7 @@ void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPrevi
aNumText = rLocWrap.getNum( aLogicPaperSize.Height(), nDigits );
aBuf.append( aNumText + " " );
- aBuf.appendAscii( eUnit == MapUnit::MapMM ? "mm" : "in" );
+ aBuf.appendAscii( eUnit == o3tl::Length::mm ? "mm" : "in" );
maVertText = aBuf.makeStringAndClear();
// We have a new Metafile and evtl. a new page, so we need to reset