summaryrefslogtreecommitdiff
path: root/sc/source
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 /sc/source
parente89404f00b25cfddd4098b4b2cf900d190617221 (diff)
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>
Diffstat (limited to 'sc/source')
-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
5 files changed, 12 insertions, 6 deletions
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 );