diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2024-01-03 18:12:18 +0100 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2024-01-04 04:52:33 +0100 |
commit | 9a2a1dfef1b085b1b899dfd2775d61c2fc41d2f3 (patch) | |
tree | 68b00e9d75bc6ba609aa26b84c12b483a47c26dc /sd | |
parent | 56767830b81fa21382b87cf43d78b1c73ca5dbd8 (diff) |
Simplify rectangle unit conversion
Change-Id: Idc3a4e983de0dec226ae1830fd70dc222624edd5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161565
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/core/annotations/Annotation.cxx | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sd/source/core/annotations/Annotation.cxx b/sd/source/core/annotations/Annotation.cxx index 9faee9d7b701..597c357dd3ba 100644 --- a/sd/source/core/annotations/Annotation.cxx +++ b/sd/source/core/annotations/Annotation.cxx @@ -364,10 +364,11 @@ OString lcl_LOKGetCommentPayload(CommentNotificationType nType, uno::Reference<o aJsonWriter.put("parthash", pPage ? OString::number(pPage->GetHashCode()) : OString()); 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)); - OString sRectangle = aRectangle.toString(); - aJsonWriter.put("rectangle", sRectangle.getStr()); + ::tools::Rectangle aRectangle(Point(std::round(o3tl::toTwips(rPoint.X, o3tl::Length::mm)), + std::round(o3tl::toTwips(rPoint.Y, o3tl::Length::mm))), + Size(std::round(o3tl::toTwips(rSize.Width, o3tl::Length::mm)), + std::round(o3tl::toTwips(rSize.Height, o3tl::Length::mm)))); + aJsonWriter.put("rectangle", aRectangle.toString()); } } return aJsonWriter.finishAndGetAsOString(); |