diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2021-08-10 08:10:19 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2021-08-11 06:41:17 +0200 |
commit | fa339b3adb53300ae68913bed87e18caf9f2e262 (patch) | |
tree | e3aed1bb38664cfe343a6d7f0803d2312c86c76a /editeng | |
parent | e89404f00b25cfddd4098b4b2cf900d190617221 (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 'editeng')
-rw-r--r-- | editeng/source/editeng/impedit.cxx | 8 | ||||
-rw-r--r-- | editeng/source/items/paperinf.cxx | 4 |
2 files changed, 8 insertions, 4 deletions
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); } |