summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2021-08-10 08:10:19 +0900
committerTomaž Vajngerl <quikee@gmail.com>2021-08-11 06:41:17 +0200
commitfa339b3adb53300ae68913bed87e18caf9f2e262 (patch)
treee3aed1bb38664cfe343a6d7f0803d2312c86c76a
parentThere is no LANGUAGE_ENGLISH {en} locale but LANGUAGE_ENGLISH_US {en-US} (diff)
downloadcore-fa339b3adb53300ae68913bed87e18caf9f2e262.tar.gz
core-fa339b3adb53300ae68913bed87e18caf9f2e262.zip
convert some LogicToLogic calls to use o3tl::convert instead
If a LogicToLogic uses fixed units, we can use o3tl::convert instead. We can also do the same for all other cases where LogicToLogic is used, but that needs additional investigation to determine if it is safe to do so. Note: MapUnit::Pixel is converted to o3tl::Length::pt because it assumed 72 PPI for a logical pixel, which corresponds with the conversion rate of a point (72 PPI). Today, 96 PPI is standard, which is also used for o3tl::Length:px. Change-Id: I29126df38bfcfda74b5d83d4cb880a378aecd18b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120230 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx3
-rw-r--r--chart2/source/controller/main/ChartWindow.cxx4
-rw-r--r--cui/source/tabpages/chardlg.cxx3
-rw-r--r--cui/source/tabpages/tpbitmap.cxx5
-rw-r--r--desktop/source/lib/init.cxx5
-rw-r--r--editeng/source/editeng/impedit.cxx8
-rw-r--r--editeng/source/items/paperinf.cxx4
-rw-r--r--extensions/source/propctrlr/fontdialog.cxx5
-rw-r--r--o3tl/qa/test-unit_conversion.cxx2
-rw-r--r--reportdesign/source/ui/dlg/Condition.cxx2
-rw-r--r--reportdesign/source/ui/misc/UITools.cxx2
-rw-r--r--sc/qa/unit/tiledrendering/tiledrendering.cxx6
-rw-r--r--sc/source/filter/rtf/rtfparse.cxx3
-rw-r--r--sc/source/ui/view/drawview.cxx4
-rw-r--r--sc/source/ui/view/gridwin4.cxx4
-rw-r--r--sc/source/ui/view/gridwin_dbgutil.cxx2
-rw-r--r--sc/source/ui/view/viewdata.cxx5
-rw-r--r--sd/qa/unit/tiledrendering/LOKitSearchTest.cxx28
-rw-r--r--sd/source/core/annotations/Annotation.cxx2
-rw-r--r--sd/source/core/drawdoc.cxx2
-rw-r--r--sd/source/ui/view/Outliner.cxx4
-rw-r--r--sd/source/ui/view/sdview.cxx4
-rw-r--r--sd/source/ui/view/sdwindow.cxx4
-rw-r--r--sfx2/source/control/unoctitm.cxx2
-rw-r--r--sfx2/source/view/ipclient.cxx2
-rw-r--r--svx/source/sdr/overlay/overlayobjectlist.cxx2
-rw-r--r--svx/source/sidebar/paragraph/ParaPropertyPanel.cxx25
-rw-r--r--svx/source/svdraw/sdrpagewindow.cxx2
-rw-r--r--svx/source/svdraw/svdmrkv.cxx20
-rw-r--r--svx/source/tbxctrls/grafctrl.cxx21
-rw-r--r--sw/source/uibase/dochdl/swdtflvr.cxx11
-rw-r--r--sw/source/uibase/shells/textsh.cxx3
-rw-r--r--vcl/source/treelist/transfer.cxx2
33 files changed, 110 insertions, 91 deletions
diff --git a/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx
index 4dfabee4836f..e48875d7c7a2 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx
@@ -408,7 +408,8 @@ void lcl_correctSymbolSizeForBitmaps( chart2::Symbol& rSymbol )
if( xProp->getPropertyValue( "SizePixel" ) >>= aAWTPixelSize )
{
Size aPixelSize(aAWTPixelSize.Width,aAWTPixelSize.Height);
- Size aNewSize = OutputDevice::LogicToLogic(aPixelSize, MapMode(MapUnit::MapPixel), MapMode(MapUnit::Map100thMM));
+ Size aNewSize = o3tl::convert(aPixelSize, o3tl::Length::pt, o3tl::Length::mm100);
+
aSize = awt::Size( aNewSize.Width(), aNewSize.Height() );
if( aSize.Width == 0 && aSize.Height == 0 )
diff --git a/chart2/source/controller/main/ChartWindow.cxx b/chart2/source/controller/main/ChartWindow.cxx
index ad5afd131b96..556cc81dcdeb 100644
--- a/chart2/source/controller/main/ChartWindow.cxx
+++ b/chart2/source/controller/main/ChartWindow.cxx
@@ -296,7 +296,9 @@ void ChartWindow::LogicInvalidate(const tools::Rectangle* pRectangle)
if (IsMapModeEnabled())
{
if (GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
- aRectangle = OutputDevice::LogicToLogic(aRectangle, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
+ {
+ aRectangle = o3tl::convert(aRectangle, o3tl::Length::mm100, o3tl::Length::twip);
+ }
}
else
{
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index c0794c0bec03..2bd029208b21 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -2583,7 +2583,8 @@ IMPL_LINK_NOARG(SvxCharPositionPage, FitToLineHdl_Impl, weld::Toggleable&, void)
IMPL_LINK_NOARG(SvxCharPositionPage, KerningModifyHdl_Impl, weld::MetricSpinButton&, void)
{
tools::Long nVal = static_cast<tools::Long>(m_xKerningMF->get_value(FieldUnit::POINT));
- nVal = OutputDevice::LogicToLogic( nVal, MapUnit::MapPoint, MapUnit::MapTwip );
+ nVal = o3tl::convert(nVal, o3tl::Length::pt, o3tl::Length::twip);
+
tools::Long nKern = static_cast<short>(m_xKerningMF->denormalize(nVal));
SvxFont& rFont = GetPreviewFont();
diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx
index 51d382193c2f..65cb4136cd5e 100644
--- a/cui/source/tabpages/tpbitmap.cxx
+++ b/cui/source/tabpages/tpbitmap.cxx
@@ -493,9 +493,10 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ModifyBitmapHdl, ValueSet*, void)
BitmapEx aBmpEx(pGraphicObject->GetGraphic().GetBitmapEx());
Size aTempBitmapSize = aBmpEx.GetSizePixel();
const double fUIScale = ( (mpView && mpView->GetModel()) ? double(mpView->GetModel()->GetUIScale()) : 1.0);
+ Size aBitmapSize100mm = o3tl::convert(aTempBitmapSize, o3tl::Length::pt, o3tl::Length::mm100);
- rBitmapSize.setWidth( (OutputDevice::LogicToLogic(static_cast<sal_Int32>(aTempBitmapSize.Width()),MapUnit::MapPixel, MapUnit::Map100thMM )) / fUIScale );
- rBitmapSize.setHeight( (OutputDevice::LogicToLogic(static_cast<sal_Int32>(aTempBitmapSize.Height()),MapUnit::MapPixel, MapUnit::Map100thMM )) / fUIScale );
+ rBitmapSize.setWidth(aBitmapSize100mm.Width() / fUIScale);
+ rBitmapSize.setHeight(aBitmapSize100mm.Height() / fUIScale);
CalculateBitmapPresetSize();
ModifyBitmapStyleHdl( *m_xBitmapStyleLB );
ModifyBitmapPositionHdl( *m_xPositionLB );
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 54edeaa831f1..b796d4240ba3 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3993,8 +3993,9 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pComma
if (aPropertyValuesVector[0].Name != "Action")
{
tools::Rectangle aChartBB = aChartHelper.GetChartBoundingBox();
- int nLeft = OutputDevice::LogicToLogic(aChartBB.Left(), MapUnit::MapTwip, MapUnit::Map100thMM);
- int nTop = OutputDevice::LogicToLogic(aChartBB.Top(), MapUnit::MapTwip, MapUnit::Map100thMM);
+
+ int nLeft = o3tl::convert(aChartBB.Left(), o3tl::Length::twip, o3tl::Length::mm100);
+ int nTop = o3tl::convert(aChartBB.Top(), o3tl::Length::twip, o3tl::Length::mm100);
for (beans::PropertyValue& rPropValue: aPropertyValuesVector)
{
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index 25942b9e09c9..720e50e8a998 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -405,7 +405,9 @@ void ImpEditView::lokSelectionCallback(const std::unique_ptr<tools::PolyPolygon>
for (tools::Rectangle & rRectangle : aRectangles)
{
if (bMm100ToTwip)
- rRectangle = OutputDevice::LogicToLogic(rRectangle, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
+ {
+ rRectangle = o3tl::convert(rRectangle, o3tl::Length::mm100, o3tl::Length::twip);
+ }
rRectangle.Move(aOrigin.getX(), aOrigin.getY());
v.emplace_back(rRectangle.toString().getStr());
}
@@ -1360,7 +1362,9 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor )
// LOK output is always in twips, convert from mm100 if necessary.
if (rOutDev.GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
- aRect = OutputDevice::LogicToLogic(aRect, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
+ {
+ aRect = o3tl::convert(aRect, o3tl::Length::mm100, o3tl::Length::twip);
+ }
else if (rOutDev.GetMapMode().GetMapUnit() == MapUnit::MapTwip)
{
// Writer comments: they use editeng, but are separate widgets.
diff --git a/editeng/source/items/paperinf.cxx b/editeng/source/items/paperinf.cxx
index e8646bc55377..86401e63f387 100644
--- a/editeng/source/items/paperinf.cxx
+++ b/editeng/source/items/paperinf.cxx
@@ -93,9 +93,9 @@ Paper SvxPaperInfo::GetSvxPaper( const Size &rSize, MapUnit eUnit )
tools::Long SvxPaperInfo::GetSloppyPaperDimension( tools::Long nSize )
{
- nSize = OutputDevice::LogicToLogic(nSize, MapUnit::MapTwip, MapUnit::Map100thMM);
+ nSize = o3tl::convert(nSize, o3tl::Length::twip, o3tl::Length::mm100);
nSize = PaperInfo::sloppyFitPageDimension(nSize);
- return OutputDevice::LogicToLogic(nSize, MapUnit::Map100thMM, MapUnit::MapTwip);
+ return o3tl::convert(nSize, o3tl::Length::mm100, o3tl::Length::twip);
}
diff --git a/extensions/source/propctrlr/fontdialog.cxx b/extensions/source/propctrlr/fontdialog.cxx
index 0e4b11be2896..89e6fb80e635 100644
--- a/extensions/source/propctrlr/fontdialog.cxx
+++ b/extensions/source/propctrlr/fontdialog.cxx
@@ -218,7 +218,8 @@ namespace pcr
// build SfxItems with the values
SvxFontItem aFontItem(static_cast<FontFamily>(nFontFamily), aFontName, aFontStyleName, PITCH_DONTKNOW, nFontCharset, CFID_FONT);
- nFontHeight = static_cast<float>(OutputDevice::LogicToLogic(Size(0, static_cast<sal_Int32>(nFontHeight)), MapMode(MapUnit::MapPoint), MapMode(MapUnit::MapTwip)).Height());
+ nFontHeight = static_cast<float>(o3tl::convert(nFontHeight, o3tl::Length::pt, o3tl::Length::twip));
+
SvxFontHeightItem aSvxFontHeightItem(static_cast<sal_uInt32>(nFontHeight),100,CFID_HEIGHT);
FontWeight eWeight=vcl::unohelper::ConvertFontWeight(nFontWeight);
@@ -319,7 +320,7 @@ namespace pcr
const SvxFontHeightItem& rSvxFontHeightItem =
static_cast<const SvxFontHeightItem&>(_rSet.Get(CFID_HEIGHT));
- float nHeight = static_cast<float>(OutputDevice::LogicToLogic(Size(0, rSvxFontHeightItem.GetHeight()), MapMode(MapUnit::MapTwip), MapMode(MapUnit::MapPoint)).Height());
+ float nHeight = static_cast<float>(o3tl::convert(rSvxFontHeightItem.GetHeight(), o3tl::Length::twip, o3tl::Length::pt));
lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_HEIGHT,makeAny(nHeight));
}
diff --git a/o3tl/qa/test-unit_conversion.cxx b/o3tl/qa/test-unit_conversion.cxx
index 80b01ea2bf2b..8b2c05c54549 100644
--- a/o3tl/qa/test-unit_conversion.cxx
+++ b/o3tl/qa/test-unit_conversion.cxx
@@ -875,5 +875,7 @@ static_assert(o3tl::toTwips(25, o3tl::Length::in100) == 1440 / 4);
static_assert(o3tl::toTwips(15, o3tl::Length::in100) == 216);
// the following twip value used to the constant for 20mm
static_assert(o3tl::toTwips(20, o3tl::Length::mm) == 1134);
+// 847 100thmm used to represent 24pt
+static_assert(o3tl::convert(24, o3tl::Length::pt, o3tl::Length::mm100) == 847);
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/reportdesign/source/ui/dlg/Condition.cxx b/reportdesign/source/ui/dlg/Condition.cxx
index c4a05704c177..030685c572a4 100644
--- a/reportdesign/source/ui/dlg/Condition.cxx
+++ b/reportdesign/source/ui/dlg/Condition.cxx
@@ -320,7 +320,7 @@ void Condition::updateToolbar(const uno::Reference< report::XReportControlFormat
{
vcl::Font aBaseFont( Application::GetDefaultDevice()->GetSettings().GetStyleSettings().GetAppFont() );
SvxFont aFont( VCLUnoHelper::CreateFont( _xReportControlFormat->getFontDescriptor(), aBaseFont ) );
- aFont.SetFontHeight(OutputDevice::LogicToLogic(Size(0, aFont.GetFontHeight()), MapMode(MapUnit::MapPoint), MapMode(MapUnit::MapTwip)).Height());
+ aFont.SetFontHeight(o3tl::convert(aFont.GetFontHeight(), o3tl::Length::pt, o3tl::Length::twip));
aFont.SetEmphasisMark( static_cast< FontEmphasisMark >( _xReportControlFormat->getControlTextEmphasis() ) );
aFont.SetRelief( static_cast< FontRelief >( _xReportControlFormat->getCharRelief() ) );
aFont.SetColor( Color(ColorTransparency, _xReportControlFormat->getCharColor()) );
diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx
index 739ee26c6048..25fa8bb255ca 100644
--- a/reportdesign/source/ui/misc/UITools.cxx
+++ b/reportdesign/source/ui/misc/UITools.cxx
@@ -249,7 +249,7 @@ namespace
aFontItem.PutValue( uno::makeAny( aControlFont ), 0 );
_rItemSet.Put(aFontItem);
- _rItemSet.Put(SvxFontHeightItem(OutputDevice::LogicToLogic(Size(0, aFont.GetFontHeight()), MapMode(MapUnit::MapPoint), MapMode(MapUnit::MapTwip)).Height(), 100, _nFontHeight));
+ _rItemSet.Put(SvxFontHeightItem(o3tl::convert(aFont.GetFontHeight(), o3tl::Length::pt, o3tl::Length::twip), 100, _nFontHeight));
lang::Locale aLocale;
switch(_nWhich)
{
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index b1a22e836e4b..2ca48dbf6091 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -1225,7 +1225,7 @@ void ScTiledRenderingTest::testInvalidateOnInserRowCol()
Scheduler::ProcessEventsToIdle();
CPPUNIT_ASSERT(aView.m_bInvalidateTiles);
CPPUNIT_ASSERT_EQUAL(size_t(2), aView.m_aInvalidations.size());
- CPPUNIT_ASSERT_EQUAL(tools::Rectangle(-75, 50985, 32212230, 63990), aView.m_aInvalidations[0]);
+ CPPUNIT_ASSERT_EQUAL(tools::Rectangle(-75, 50985, 32212230, 63989), aView.m_aInvalidations[0]);
// move on the right
for (int i = 0; i < 200; ++i)
@@ -1242,7 +1242,7 @@ void ScTiledRenderingTest::testInvalidateOnInserRowCol()
Scheduler::ProcessEventsToIdle();
CPPUNIT_ASSERT(aView.m_bInvalidateTiles);
CPPUNIT_ASSERT_EQUAL(size_t(2), aView.m_aInvalidations.size());
- CPPUNIT_ASSERT_EQUAL(tools::Rectangle(253650, -15, 32212230, 63990), aView.m_aInvalidations[0]);
+ CPPUNIT_ASSERT_EQUAL(tools::Rectangle(253650, -15, 32212230, 63989), aView.m_aInvalidations[0]);
}
void ScTiledRenderingTest::testCommentCallback()
@@ -1963,7 +1963,7 @@ void ScTiledRenderingTest::testSheetChangeInvalidation()
Scheduler::ProcessEventsToIdle();
CPPUNIT_ASSERT(aView1.m_bInvalidateTiles);
CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidations.size());
- CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1310720, 268435456), aView1.m_aInvalidations[0]);
+ CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1310719, 268435455), aView1.m_aInvalidations[0]);
CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1000000000, 1000000000), aView1.m_aInvalidations[1]);
CPPUNIT_ASSERT_EQUAL(size_t(1), aView1.m_aInvalidationsParts.size());
CPPUNIT_ASSERT_EQUAL(pModelObj->getPart(), aView1.m_aInvalidationsParts[0]);
diff --git a/sc/source/filter/rtf/rtfparse.cxx b/sc/source/filter/rtf/rtfparse.cxx
index 594535488a73..6820db9d4dc2 100644
--- a/sc/source/filter/rtf/rtfparse.cxx
+++ b/sc/source/filter/rtf/rtfparse.cxx
@@ -43,7 +43,8 @@ ScRTFParser::ScRTFParser( EditEngine* pEditP ) :
bNewDef( false )
{
// RTF default FontSize 12Pt
- tools::Long nMM = OutputDevice::LogicToLogic( 12, MapUnit::MapPoint, MapUnit::Map100thMM );
+ tools::Long nMM = o3tl::convert(12, o3tl::Length::pt, o3tl::Length::mm100);
+
pPool->SetPoolDefaultItem( SvxFontHeightItem( nMM, 100, EE_CHAR_FONTHEIGHT ) );
// Free-flying pInsDefault
pInsDefault.reset( new ScRTFCellDefault( pPool.get() ) );
diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx
index 61261477a109..6e500e84b142 100644
--- a/sc/source/ui/view/drawview.cxx
+++ b/sc/source/ui/view/drawview.cxx
@@ -564,7 +564,9 @@ bool ScDrawView::SdrBeginTextEdit(
{
tools::Rectangle aRectangle = pView->GetOutputArea();
if (pWinL && pWinL->GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
- aRectangle = OutputDevice::LogicToLogic(aRectangle, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
+ {
+ aRectangle = o3tl::convert(aRectangle, o3tl::Length::mm100, o3tl::Length::twip);
+ }
OString sRectangle = aRectangle.toString();
SfxLokHelper::notifyOtherViews(pViewSh, LOK_CALLBACK_VIEW_LOCK, "rectangle", sRectangle);
}
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index dab88b11717f..e95b4740bbf9 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1554,7 +1554,9 @@ void ScGridWindow::LogicInvalidate(const tools::Rectangle* pRectangle)
if (IsMapModeEnabled())
{
if (GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
- aRectangle = OutputDevice::LogicToLogic(aRectangle, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
+ {
+ aRectangle = o3tl::convert(aRectangle, o3tl::Length::mm100, o3tl::Length::twip);
+ }
}
else
aRectangle = PixelToLogic(aRectangle, MapMode(MapUnit::MapTwip));
diff --git a/sc/source/ui/view/gridwin_dbgutil.cxx b/sc/source/ui/view/gridwin_dbgutil.cxx
index 5c1bcce7095e..83e3ed9c49c6 100644
--- a/sc/source/ui/view/gridwin_dbgutil.cxx
+++ b/sc/source/ui/view/gridwin_dbgutil.cxx
@@ -58,7 +58,7 @@ void ScGridWindow::dumpColumnInformationHmm()
for (SCCOL nCol = 0; nCol <= 20; ++nCol)
{
sal_uInt16 nWidth = rDoc.GetColWidth(nCol, nTab);
- tools::Long nPixel = OutputDevice::LogicToLogic(Point(nWidth, 0), MapMode(MapUnit::MapTwip), MapMode(MapUnit::Map100thMM)).getX();
+ tools::Long nPixel = o3tl::convert(nWidth, o3tl::Length::twip, o3tl::Length::mm100);
std::cout << "Column: " << nCol << ", Width: " << nPixel << "hmm" << std::endl;
}
}
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index e284f2cce724..3a41f6b61137 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -1728,8 +1728,9 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich,
HMM_PER_TWIPS, HMM_PER_TWIPS, aFract, aFract ).GetEditArea( pPattern, false );
aPaperSize.setWidth( aUtilRect.GetWidth() );
if (bLOKPrintTwips)
- aPaperSizePTwips.setWidth(OutputDevice::LogicToLogic(
- aUtilRect.GetWidth(), MapUnit::Map100thMM, MapUnit::MapTwip));
+ {
+ aPaperSizePTwips.setWidth(o3tl::convert(aUtilRect.GetWidth(), o3tl::Length::mm100, o3tl::Length::twip));
+ }
}
pNewEngine->SetPaperSize( aPaperSize );
diff --git a/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx b/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
index 762faaac1b56..dd661553b425 100644
--- a/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
+++ b/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
@@ -347,9 +347,9 @@ void LOKitSearchTest::testSearchInPDF()
CPPUNIT_ASSERT_EQUAL(1, mpCallbackRecorder->m_nSearchResultCount);
CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size());
- CPPUNIT_ASSERT_EQUAL(OString("3763, 1331, 1432, 483"),
+ CPPUNIT_ASSERT_EQUAL(OString("3763, 1331, 1432, 482"),
mpCallbackRecorder->m_aSearchResultSelection[0]);
- CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(3763, 1331), Size(1433, 484)),
+ CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(3763, 1331), Size(1433, 483)),
mpCallbackRecorder->m_aSelection[0]);
// Search again - same result
@@ -359,9 +359,9 @@ void LOKitSearchTest::testSearchInPDF()
CPPUNIT_ASSERT_EQUAL(2, mpCallbackRecorder->m_nSearchResultCount);
CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size());
- CPPUNIT_ASSERT_EQUAL(OString("3763, 1331, 1432, 483"),
+ CPPUNIT_ASSERT_EQUAL(OString("3763, 1331, 1432, 482"),
mpCallbackRecorder->m_aSearchResultSelection[0]);
- CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(3763, 1331), Size(1433, 484)),
+ CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(3763, 1331), Size(1433, 483)),
mpCallbackRecorder->m_aSelection[0]);
}
@@ -444,7 +444,7 @@ void LOKitSearchTest::testSearchInPDFInMultiplePages()
CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size());
CPPUNIT_ASSERT_EQUAL(0, mpCallbackRecorder->m_aSearchResultPart[0]);
- CPPUNIT_ASSERT_EQUAL(OString("9463, 3382, 1099, 499"),
+ CPPUNIT_ASSERT_EQUAL(OString("9463, 3382, 1099, 498"),
mpCallbackRecorder->m_aSearchResultSelection[0]);
// Search for "him"
@@ -457,7 +457,7 @@ void LOKitSearchTest::testSearchInPDFInMultiplePages()
CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size());
CPPUNIT_ASSERT_EQUAL(0, mpCallbackRecorder->m_aSearchResultPart[0]);
- CPPUNIT_ASSERT_EQUAL(OString("5592, 5038, 1100, 499"),
+ CPPUNIT_ASSERT_EQUAL(OString("5592, 5038, 1099, 498"),
mpCallbackRecorder->m_aSearchResultSelection[0]);
// Search for "him"
@@ -470,7 +470,7 @@ void LOKitSearchTest::testSearchInPDFInMultiplePages()
CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size());
CPPUNIT_ASSERT_EQUAL(1, mpCallbackRecorder->m_aSearchResultPart[0]);
- CPPUNIT_ASSERT_EQUAL(OString("9463, 1308, 1099, 499"),
+ CPPUNIT_ASSERT_EQUAL(OString("9463, 1308, 1099, 498"),
mpCallbackRecorder->m_aSearchResultSelection[0]);
// Search for "him"
@@ -483,7 +483,7 @@ void LOKitSearchTest::testSearchInPDFInMultiplePages()
CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size());
CPPUNIT_ASSERT_EQUAL(1, mpCallbackRecorder->m_aSearchResultPart[0]);
- CPPUNIT_ASSERT_EQUAL(OString("5592, 2964, 1100, 499"),
+ CPPUNIT_ASSERT_EQUAL(OString("5592, 2964, 1099, 498"),
mpCallbackRecorder->m_aSearchResultSelection[0]);
// Search for "him" - back to start
@@ -496,7 +496,7 @@ void LOKitSearchTest::testSearchInPDFInMultiplePages()
CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size());
CPPUNIT_ASSERT_EQUAL(0, mpCallbackRecorder->m_aSearchResultPart[0]);
- CPPUNIT_ASSERT_EQUAL(OString("9463, 3382, 1099, 499"),
+ CPPUNIT_ASSERT_EQUAL(OString("9463, 3382, 1099, 498"),
mpCallbackRecorder->m_aSearchResultSelection[0]);
}
@@ -547,7 +547,7 @@ void LOKitSearchTest::testSearchInPDFInMultiplePagesBackwards()
CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size());
CPPUNIT_ASSERT_EQUAL(0, mpCallbackRecorder->m_aSearchResultPart[0]);
- CPPUNIT_ASSERT_EQUAL(OString("5592, 5038, 1100, 499"),
+ CPPUNIT_ASSERT_EQUAL(OString("5592, 5038, 1099, 498"),
mpCallbackRecorder->m_aSearchResultSelection[0]);
// Search for "him"
@@ -560,7 +560,7 @@ void LOKitSearchTest::testSearchInPDFInMultiplePagesBackwards()
CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size());
CPPUNIT_ASSERT_EQUAL(0, mpCallbackRecorder->m_aSearchResultPart[0]);
- CPPUNIT_ASSERT_EQUAL(OString("9463, 3382, 1099, 499"),
+ CPPUNIT_ASSERT_EQUAL(OString("9463, 3382, 1099, 498"),
mpCallbackRecorder->m_aSearchResultSelection[0]);
// Search for "him"
@@ -573,7 +573,7 @@ void LOKitSearchTest::testSearchInPDFInMultiplePagesBackwards()
CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size());
CPPUNIT_ASSERT_EQUAL(1, mpCallbackRecorder->m_aSearchResultPart[0]);
- CPPUNIT_ASSERT_EQUAL(OString("5592, 2964, 1100, 499"),
+ CPPUNIT_ASSERT_EQUAL(OString("5592, 2964, 1099, 498"),
mpCallbackRecorder->m_aSearchResultSelection[0]);
// Search for "him"
@@ -586,7 +586,7 @@ void LOKitSearchTest::testSearchInPDFInMultiplePagesBackwards()
CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size());
CPPUNIT_ASSERT_EQUAL(1, mpCallbackRecorder->m_aSearchResultPart[0]);
- CPPUNIT_ASSERT_EQUAL(OString("9463, 1308, 1099, 499"),
+ CPPUNIT_ASSERT_EQUAL(OString("9463, 1308, 1099, 498"),
mpCallbackRecorder->m_aSearchResultSelection[0]);
// Search for "him" - back to start
@@ -599,7 +599,7 @@ void LOKitSearchTest::testSearchInPDFInMultiplePagesBackwards()
CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size());
CPPUNIT_ASSERT_EQUAL(0, mpCallbackRecorder->m_aSearchResultPart[0]);
- CPPUNIT_ASSERT_EQUAL(OString("5592, 5038, 1100, 499"),
+ CPPUNIT_ASSERT_EQUAL(OString("5592, 5038, 1099, 498"),
mpCallbackRecorder->m_aSearchResultSelection[0]);
}
diff --git a/sd/source/core/annotations/Annotation.cxx b/sd/source/core/annotations/Annotation.cxx
index 7e9d4aff275a..1d1ca39fc9dd 100644
--- a/sd/source/core/annotations/Annotation.cxx
+++ b/sd/source/core/annotations/Annotation.cxx
@@ -359,7 +359,7 @@ std::string lcl_LOKGetCommentPayload(CommentNotificationType nType, uno::Referen
geometry::RealPoint2D const & rPoint = rxAnnotation->getPosition();
geometry::RealSize2D const & rSize = rxAnnotation->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::convert(aRectangle, o3tl::Length::mm100, o3tl::Length::twip);
OString sRectangle = aRectangle.toString();
aAnnotation.put("rectangle", sRectangle.getStr());
}
diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx
index baf1d57fea18..3734d4aa70ea 100644
--- a/sd/source/core/drawdoc.cxx
+++ b/sd/source/core/drawdoc.cxx
@@ -163,7 +163,7 @@ SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh)
SetScaleUnit(MapUnit::Map100thMM);
SetScaleFraction(Fraction(1, 1));
- SetDefaultFontHeight(847); // 24p
+ SetDefaultFontHeight(o3tl::convert(24, o3tl::Length::pt, o3tl::Length::mm100));
m_pItemPool->SetDefaultMetric(MapUnit::Map100thMM);
m_pItemPool->FreezeIdRanges();
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index dd823204ced1..316e330a7bed 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -743,7 +743,7 @@ void SdOutliner::sendLOKSearchResultCallback(const std::shared_ptr<sd::ViewShell
tools::Rectangle aSelection(Point(aSelectionHMM.getMinX(), aSelectionHMM.getMinY()),
Size(aSelectionHMM.getWidth(), aSelectionHMM.getHeight()));
- aSelection = OutputDevice::LogicToLogic(aSelection, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
+ aSelection = o3tl::convert(aSelection, o3tl::Length::mm100, o3tl::Length::twip);
aLogicRects.push_back(aSelection);
}
else
@@ -757,7 +757,7 @@ void SdOutliner::sendLOKSearchResultCallback(const std::shared_ptr<sd::ViewShell
{
for (tools::Rectangle& rRectangle : aLogicRects)
{
- rRectangle = OutputDevice::LogicToLogic(rRectangle, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
+ rRectangle = o3tl::convert(rRectangle, o3tl::Length::mm100, o3tl::Length::twip);
}
}
}
diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx
index d2b9816f40e9..49b384b98e7b 100644
--- a/sd/source/ui/view/sdview.cxx
+++ b/sd/source/ui/view/sdview.cxx
@@ -689,7 +689,9 @@ bool View::SdrBeginTextEdit(
{
::tools::Rectangle aRectangle = pView->GetOutputArea();
if (pWin && pWin->GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
- aRectangle = OutputDevice::LogicToLogic(aRectangle, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
+ {
+ aRectangle = o3tl::convert(aRectangle, o3tl::Length::mm100, o3tl::Length::twip);
+ }
OString sRectangle = aRectangle.toString();
SfxLokHelper::notifyOtherViews(&mpViewSh->GetViewShellBase(), LOK_CALLBACK_VIEW_LOCK, "rectangle", sRectangle);
}
diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx
index bb29151b4b1e..f639b463e124 100644
--- a/sd/source/ui/view/sdwindow.cxx
+++ b/sd/source/ui/view/sdwindow.cxx
@@ -1036,7 +1036,9 @@ void Window::LogicInvalidate(const ::tools::Rectangle* pRectangle)
{
aRectangle = *pRectangle;
if (GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
- aRectangle = OutputDevice::LogicToLogic(aRectangle, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
+ {
+ aRectangle = o3tl::convert(aRectangle, o3tl::Length::mm100, o3tl::Length::twip);
+ }
pResultRectangle = &aRectangle;
}
SfxViewShell& rSfxViewShell = pDrawViewShell->GetViewShellBase();
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index 235812a239ea..3d3bfd430c4f 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -1236,7 +1236,7 @@ static void InterceptLOKStateChangeEvent(sal_uInt16 nSID, SfxViewFrame* pViewFra
{
float nScaleValue = 1000.0;
nValue *= nScaleValue;
- sal_Int32 nConvertedValue = OutputDevice::LogicToLogic(nValue, MapUnit::MapTwip, MapUnit::MapInch);
+ sal_Int32 nConvertedValue = o3tl::convert(nValue, o3tl::Length::twip, o3tl::Length::in);
aBuffer.append(nConvertedValue / nScaleValue);
}
}
diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx
index 3c40c7bdf4a6..7484033b2808 100644
--- a/sfx2/source/view/ipclient.cxx
+++ b/sfx2/source/view/ipclient.cxx
@@ -342,7 +342,7 @@ void SAL_CALL SfxInPlaceClient_Impl::activatingInplace()
if (m_pClient->GetEditWin())
{
if (m_pClient->GetEditWin()->GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
- aRect = OutputDevice::LogicToLogic(aRect, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
+ aRect = o3tl::convert(aRect, o3tl::Length::mm100, o3tl::Length::twip);
}
OString str = aRect.toString() + ", \"INPLACE\"";
diff --git a/svx/source/sdr/overlay/overlayobjectlist.cxx b/svx/source/sdr/overlay/overlayobjectlist.cxx
index f3e9c9633ccd..d71f6c2783b9 100644
--- a/svx/source/sdr/overlay/overlayobjectlist.cxx
+++ b/svx/source/sdr/overlay/overlayobjectlist.cxx
@@ -70,7 +70,7 @@ namespace sdr::overlay
{
aSizeLogic = Size(DEFAULT_VALUE_FOR_HITTEST_TWIP, DEFAULT_VALUE_FOR_HITTEST_TWIP);
if (pManager->getOutputDevice().GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
- aSizeLogic = OutputDevice::LogicToLogic(aSizeLogic, MapMode(MapUnit::MapTwip), MapMode(MapUnit::Map100thMM));
+ aSizeLogic = o3tl::convert(aSizeLogic, o3tl::Length::twip, o3tl::Length::mm100);
}
fLogicTolerance = aSizeLogic.Width();
diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
index 2e54af0a8485..4816b7d085a1 100644
--- a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
+++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
@@ -257,18 +257,15 @@ void ParaPropertyPanel::StateChangedIndentImpl( SfxItemState eState, const SfxPo
{
const SvxLRSpaceItem* pSpace = static_cast<const SvxLRSpaceItem*>(pState);
maTxtLeft = pSpace->GetTextLeft();
- maTxtLeft = OutputDevice::LogicToLogic( maTxtLeft, m_eLRSpaceUnit, MapUnit::Map100thMM );
- maTxtLeft = OutputDevice::LogicToLogic( maTxtLeft, MapUnit::Map100thMM, MapUnit::MapTwip );
+ maTxtLeft = OutputDevice::LogicToLogic(maTxtLeft, m_eLRSpaceUnit, MapUnit::MapTwip);
tools::Long aTxtRight = pSpace->GetRight();
- aTxtRight = OutputDevice::LogicToLogic( aTxtRight, m_eLRSpaceUnit, MapUnit::Map100thMM );
- aTxtRight = OutputDevice::LogicToLogic( aTxtRight, MapUnit::Map100thMM, MapUnit::MapTwip );
+ aTxtRight = OutputDevice::LogicToLogic(aTxtRight, m_eLRSpaceUnit, MapUnit::MapTwip);
tools::Long aTxtFirstLineOfst = pSpace->GetTextFirstLineOffset();
- aTxtFirstLineOfst = OutputDevice::LogicToLogic( aTxtFirstLineOfst, m_eLRSpaceUnit, MapUnit::Map100thMM );
- aTxtFirstLineOfst = OutputDevice::LogicToLogic( aTxtFirstLineOfst, MapUnit::Map100thMM, MapUnit::MapTwip );
+ aTxtFirstLineOfst = OutputDevice::LogicToLogic( aTxtFirstLineOfst, m_eLRSpaceUnit, MapUnit::MapTwip );
- tools::Long nVal = OutputDevice::LogicToLogic( maTxtLeft, MapUnit::MapTwip, MapUnit::Map100thMM );
+ tools::Long nVal = o3tl::convert(maTxtLeft, o3tl::Length::twip, o3tl::Length::mm100);
nVal = static_cast<tools::Long>(mxLeftIndent->normalize( nVal ));
if ( maContext.GetCombinedContext_DI() != CombinedEnumContext(Application::WriterVariants, Context::Text)
@@ -278,7 +275,7 @@ void ParaPropertyPanel::StateChangedIndentImpl( SfxItemState eState, const SfxPo
mxFLineIndent->set_min( nVal*-1, FieldUnit::MM_100TH );
}
- tools::Long nrVal = OutputDevice::LogicToLogic( aTxtRight, MapUnit::MapTwip, MapUnit::Map100thMM );
+ tools::Long nrVal = o3tl::convert(aTxtRight, o3tl::Length::twip, o3tl::Length::mm100);
nrVal = static_cast<tools::Long>(mxRightIndent->normalize( nrVal ));
switch (maContext.GetCombinedContext_DI())
@@ -309,7 +306,7 @@ void ParaPropertyPanel::StateChangedIndentImpl( SfxItemState eState, const SfxPo
mxLeftIndent->set_value( nVal, FieldUnit::MM_100TH );
mxRightIndent->set_value( nrVal, FieldUnit::MM_100TH );
- tools::Long nfVal = OutputDevice::LogicToLogic( aTxtFirstLineOfst, MapUnit::MapTwip, MapUnit::Map100thMM );
+ tools::Long nfVal = o3tl::convert(aTxtFirstLineOfst, o3tl::Length::twip, o3tl::Length::mm100);
nfVal = static_cast<tools::Long>(mxFLineIndent->normalize( nfVal ));
mxFLineIndent->set_value( nfVal, FieldUnit::MM_100TH );
}
@@ -337,18 +334,16 @@ void ParaPropertyPanel::StateChangedULImpl( SfxItemState eState, const SfxPoolIt
const SvxULSpaceItem* pOldItem = static_cast<const SvxULSpaceItem*>(pState);
maUpper = pOldItem->GetUpper();
- maUpper = OutputDevice::LogicToLogic( maUpper, m_eULSpaceUnit, MapUnit::Map100thMM );
- maUpper = OutputDevice::LogicToLogic( maUpper, MapUnit::Map100thMM, MapUnit::MapTwip );
+ maUpper = OutputDevice::LogicToLogic(maUpper, m_eULSpaceUnit, MapUnit::MapTwip);
maLower = pOldItem->GetLower();
- maLower = OutputDevice::LogicToLogic( maLower, m_eULSpaceUnit, MapUnit::Map100thMM );
- maLower = OutputDevice::LogicToLogic( maLower, MapUnit::Map100thMM, MapUnit::MapTwip );
+ maLower = OutputDevice::LogicToLogic(maLower, m_eULSpaceUnit, MapUnit::MapTwip);
- sal_Int64 nVal = OutputDevice::LogicToLogic( maUpper, MapUnit::MapTwip, MapUnit::Map100thMM );
+ sal_Int64 nVal = o3tl::convert(maUpper, o3tl::Length::twip, o3tl::Length::mm100);
nVal = mxTopDist->normalize( nVal );
mxTopDist->set_value( nVal, FieldUnit::MM_100TH );
- nVal = OutputDevice::LogicToLogic( maLower, MapUnit::MapTwip, MapUnit::Map100thMM );
+ nVal = o3tl::convert(maLower, o3tl::Length::twip, o3tl::Length::mm100);
nVal = mxBottomDist->normalize( nVal );
mxBottomDist->set_value( nVal, FieldUnit::MM_100TH );
}
diff --git a/svx/source/svdraw/sdrpagewindow.cxx b/svx/source/svdraw/sdrpagewindow.cxx
index d82f234f3cd4..428faa990f39 100644
--- a/svx/source/svdraw/sdrpagewindow.cxx
+++ b/svx/source/svdraw/sdrpagewindow.cxx
@@ -462,7 +462,7 @@ void SdrPageWindow::InvalidatePageWindow(const basegfx::B2DRange& rRange)
static_cast<tools::Long>(ceil(rRange.getMaxX())),
static_cast<tools::Long>(ceil(rRange.getMaxY())));
- const tools::Rectangle aRectTwips = OutputDevice::LogicToLogic(aRect100thMM, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
+ const tools::Rectangle aRectTwips = o3tl::convert(aRect100thMM, o3tl::Length::mm100, o3tl::Length::twip);
if (SfxViewShell* pViewShell = SfxViewShell::Current())
SfxLokHelper::notifyInvalidation(pViewShell, &aRectTwips);
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index c89abea36b37..582c9773f685 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -262,7 +262,7 @@ void SdrMarkView::ModelHasChanged()
if (OutputDevice* pOutputDevice = mpMarkedPV->GetView().GetFirstOutputDevice())
{
if (pOutputDevice->GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
- aSelection = OutputDevice::LogicToLogic(aSelection, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
+ aSelection = o3tl::convert(aSelection, o3tl::Length::mm100, o3tl::Length::twip);
}
}
@@ -718,7 +718,9 @@ bool SdrMarkView::dumpGluePointsToJSON(boost::property_tree::ptree& rTree)
const SdrGluePoint& rGP = !VertexObject ? (*pGPL)[i] : pObj->GetVertexGluePoint(i);
Point rPoint = rGP.GetAbsolutePos(*pObj);
if (bConvertUnit)
- rPoint = OutputDevice::LogicToLogic(rPoint, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
+ {
+ rPoint = o3tl::convert(rPoint, o3tl::Length::mm100, o3tl::Length::twip);
+ }
point.put("x", rPoint.getX());
point.put("y", rPoint.getY());
node.add_child("point", point);
@@ -730,7 +732,9 @@ bool SdrMarkView::dumpGluePointsToJSON(boost::property_tree::ptree& rTree)
{
Point p(aGridOffset.getX(), aGridOffset.getY());
if (bConvertUnit)
- p = OutputDevice::LogicToLogic(p, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
+ {
+ p = o3tl::convert(p, o3tl::Length::mm100, o3tl::Length::twip);
+ }
boost::property_tree::ptree gridOffset;
gridOffset.put("x", p.getX());
gridOffset.put("y", p.getY());
@@ -785,7 +789,7 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S
{
if (pOutputDevice->GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
{
- aSelection = OutputDevice::LogicToLogic(aSelection, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
+ aSelection = o3tl::convert(aSelection, o3tl::Length::mm100, o3tl::Length::twip);
convertMapMode = true;
}
}
@@ -842,7 +846,7 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S
{
Point p(aGridOffset.getX(), aGridOffset.getY());
if (convertMapMode)
- p = OutputDevice::LogicToLogic(p, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
+ p = o3tl::convert(p, o3tl::Length::mm100, o3tl::Length::twip);
aExtraInfo.append(",\"gridOffsetX\":");
aExtraInfo.append(p.getX());
aExtraInfo.append(",\"gridOffsetY\":");
@@ -917,7 +921,7 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S
Point aMinPos(aDragParameters[1], aDragParameters[2]);
Point aMaxPos(aDragParameters[3], aDragParameters[4]);
Point aDragDirection = aMaxPos - aMinPos;
- aDragDirection = OutputDevice::LogicToLogic(aDragDirection, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
+ aDragDirection = o3tl::convert(aDragDirection, o3tl::Length::mm100, o3tl::Length::twip);
aExtraInfo.append(", \"dragDirection\": [");
aExtraInfo.append(aDragDirection.toString());
@@ -999,7 +1003,9 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S
Point pHdlPos = pHdl->GetPos();
pHdlPos.Move(addLogicOffset.getX(), addLogicOffset.getY());
if (convertMapMode)
- pHdlPos = OutputDevice::LogicToLogic(pHdlPos, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
+ {
+ pHdlPos = o3tl::convert(pHdlPos, o3tl::Length::mm100, o3tl::Length::twip);
+ }
point.put("x", pHdlPos.getX());
point.put("y", pHdlPos.getY());
child.add_child("point", point);
diff --git a/svx/source/tbxctrls/grafctrl.cxx b/svx/source/tbxctrls/grafctrl.cxx
index e17f8e465fcd..1751c7ea2844 100644
--- a/svx/source/tbxctrls/grafctrl.cxx
+++ b/svx/source/tbxctrls/grafctrl.cxx
@@ -620,8 +620,6 @@ void SvxGrafAttrHelper::ExecuteGrafAttr( SfxRequest& rReq, SdrView& rView )
{
SfxItemSet aGrfAttr( rPool, svl::Items<SDRATTR_GRAFCROP, SDRATTR_GRAFCROP> );
const MapUnit eOldMetric = rPool.GetMetric( 0 );
- const MapMode aMap100( MapUnit::Map100thMM );
- const MapMode aMapTwip( MapUnit::MapTwip );
aGrfAttr.Put(pObj->GetMergedItemSet());
rPool.SetDefaultMetric( MapUnit::MapTwip );
@@ -636,16 +634,13 @@ void SvxGrafAttrHelper::ExecuteGrafAttr( SfxRequest& rReq, SdrView& rView )
aCropDlgAttr.Put( SvxBrushItem( pObj->GetGraphic(), GPOS_MM, SID_ATTR_GRAF_GRAPHIC ) );
aCropDlgAttr.Put( SvxSizeItem( SID_ATTR_PAGE_SIZE,
- OutputDevice::LogicToLogic(
- Size( 200000, 200000 ), aMap100, aMapTwip ) ) );
- aCropDlgAttr.Put( SvxSizeItem( SID_ATTR_GRAF_FRMSIZE, OutputDevice::LogicToLogic(
- pObj->GetLogicRect().GetSize(), aMap100, aMapTwip ) ) );
+ o3tl::convert(Size(200000, 200000), o3tl::Length::mm100, o3tl::Length::twip)));
+ aCropDlgAttr.Put( SvxSizeItem( SID_ATTR_GRAF_FRMSIZE,
+ o3tl::convert(pObj->GetLogicRect().GetSize(), o3tl::Length::mm100, o3tl::Length::twip)));
const SdrGrafCropItem& rCrop = aGrfAttr.Get( SDRATTR_GRAFCROP );
- Size aLTSize( OutputDevice::LogicToLogic(
- Size( rCrop.GetLeft(), rCrop.GetTop() ), aMap100, aMapTwip ) );
- Size aRBSize( OutputDevice::LogicToLogic(
- Size( rCrop.GetRight(), rCrop.GetBottom() ), aMap100, aMapTwip ) );
+ Size aLTSize = o3tl::convert(Size(rCrop.GetLeft(), rCrop.GetTop()), o3tl::Length::mm100, o3tl::Length::twip);
+ Size aRBSize = o3tl::convert(Size(rCrop.GetRight(), rCrop.GetBottom()), o3tl::Length::mm100, o3tl::Length::twip);
aCropDlgAttr.Put( SdrGrafCropItem( aLTSize.Width(), aLTSize.Height(),
aRBSize.Width(), aRBSize.Height() ) );
@@ -674,8 +669,8 @@ void SvxGrafAttrHelper::ExecuteGrafAttr( SfxRequest& rReq, SdrView& rView )
{
const SdrGrafCropItem& rNewCrop = pOutAttr->Get( SDRATTR_GRAFCROP );
- aLTSize = OutputDevice::LogicToLogic( Size( rNewCrop.GetLeft(), rNewCrop.GetTop() ), aMapTwip, aMap100 );
- aRBSize = OutputDevice::LogicToLogic( Size( rNewCrop.GetRight(), rNewCrop.GetBottom() ), aMapTwip, aMap100 );
+ aLTSize = o3tl::convert(Size(rNewCrop.GetLeft(), rNewCrop.GetTop()), o3tl::Length::twip, o3tl::Length::mm100);
+ aRBSize = o3tl::convert(Size(rNewCrop.GetRight(), rNewCrop.GetBottom()), o3tl::Length::twip, o3tl::Length::mm100);
aSet.Put( SdrGrafCropItem( aLTSize.Width(), aLTSize.Height(), aRBSize.Width(), aRBSize.Height() ) );
}
@@ -684,7 +679,7 @@ void SvxGrafAttrHelper::ExecuteGrafAttr( SfxRequest& rReq, SdrView& rView )
{
Point aNewOrigin( pObj->GetLogicRect().TopLeft() );
const Size& rGrfSize = static_cast<const SvxSizeItem&>( pOutAttr->Get( SID_ATTR_GRAF_FRMSIZE ) ).GetSize();
- Size aNewGrfSize( OutputDevice::LogicToLogic( rGrfSize, aMapTwip, aMap100 ) );
+ Size aNewGrfSize = o3tl::convert(rGrfSize, o3tl::Length::twip, o3tl::Length::mm100);
Size aOldGrfSize( pObj->GetLogicRect().GetSize() );
tools::Rectangle aNewRect( aNewOrigin, aNewGrfSize );
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index 3dd384b64c9c..338a11b24b84 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -1010,7 +1010,8 @@ int SwTransferable::PrepareForCopy( bool bIsCut )
// --> OD #i98753#
// set size of embedded object at the object description structure
- m_aObjDesc.maSize = OutputDevice::LogicToLogic(m_pWrtShell->GetObjSize(), MapMode(MapUnit::MapTwip), MapMode(MapUnit::Map100thMM));
+ m_aObjDesc.maSize = o3tl::convert(m_pWrtShell->GetObjSize(), o3tl::Length::twip, o3tl::Length::mm100);
+
// <--
PrepareOLE( m_aObjDesc );
@@ -1158,7 +1159,7 @@ int SwTransferable::PrepareForCopy( bool bIsCut )
//Now adjust it. Thus in GetData the first query can still
//be answered with delayed rendering.
Size aSz( OLESIZE );
- m_aObjDesc.maSize = OutputDevice::LogicToLogic(aSz, MapMode(MapUnit::MapTwip), MapMode(MapUnit::Map100thMM));
+ m_aObjDesc.maSize = o3tl::convert(aSz, o3tl::Length::twip, o3tl::Length::mm100);
PrepareOLE( m_aObjDesc );
#if HAVE_FEATURE_DESKTOP
@@ -1261,7 +1262,7 @@ bool SwTransferable::CopyGlossary( SwTextBlocks& rGlossary, const OUString& rStr
//Now adjust it. Thus in GetData the first query can still
//be answered with delayed rendering.
Size aSz( OLESIZE );
- m_aObjDesc.maSize = OutputDevice::LogicToLogic(aSz, MapMode(MapUnit::MapTwip), MapMode(MapUnit::Map100thMM));
+ m_aObjDesc.maSize = o3tl::convert(aSz, o3tl::Length::twip, o3tl::Length::mm100);
PrepareOLE( m_aObjDesc );
AddFormat( SotClipboardFormatId::OBJECTDESCRIPTOR );
@@ -3623,8 +3624,8 @@ void SwTransferable::SetDataForDragAndDrop( const Point& rSttPos )
//Now adjust it. Thus in GetData the first query can still
//be answered with delayed rendering.
m_aObjDesc.maDragStartPos = rSttPos;
- m_aObjDesc.maSize = OutputDevice::LogicToLogic( Size( OLESIZE ),
- MapMode(MapUnit::MapTwip), MapMode(MapUnit::Map100thMM));
+ m_aObjDesc.maSize = o3tl::convert(Size( OLESIZE ), o3tl::Length::twip, o3tl::Length::mm100);
+
PrepareOLE( m_aObjDesc );
AddFormat( SotClipboardFormatId::OBJECTDESCRIPTOR );
}
diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx
index 114ce385e4d3..76be2461935a 100644
--- a/sw/source/uibase/shells/textsh.cxx
+++ b/sw/source/uibase/shells/textsh.cxx
@@ -351,8 +351,7 @@ void SwTextShell::ExecInsert(SfxRequest &rReq)
if(pItem && xObj.is())
{
Size aSize(static_cast<const SvxSizeItem*>(pItem)->GetSize());
- aSize = OutputDevice::LogicToLogic
- ( aSize, MapMode( MapUnit::MapTwip ), MapMode( MapUnit::Map100thMM ) );
+ aSize = o3tl::convert(aSize, o3tl::Length::twip, o3tl::Length::mm100);
if(aSize.Width() > MINLAY&& aSize.Height()> MINLAY)
{
diff --git a/vcl/source/treelist/transfer.cxx b/vcl/source/treelist/transfer.cxx
index 856cc5bd23a7..b43b220856bc 100644
--- a/vcl/source/treelist/transfer.cxx
+++ b/vcl/source/treelist/transfer.cxx
@@ -1643,7 +1643,7 @@ bool TransferableDataHelper::GetBitmapEx( const DataFlavor& rFlavor, BitmapEx& r
rBmpEx.SetPrefMapMode(MapMode(MapUnit::MapPixel));
// #i122388# also adapt size by applying the mew MapMode
- const Size aNewSize(OutputDevice::LogicToLogic(aSize, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapPixel)));
+ const Size aNewSize(o3tl::convert(aSize, o3tl::Length::mm100, o3tl::Length::pt));
rBmpEx.SetPrefSize(aNewSize);
}
}