sd/source/core/annotations/Annotation.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
New commits: commit 9a2a1dfef1b085b1b899dfd2775d61c2fc41d2f3 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Wed Jan 3 18:12:18 2024 +0100 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Thu Jan 4 04:52:33 2024 +0100 Simplify rectangle unit conversion Change-Id: Idc3a4e983de0dec226ae1830fd70dc222624edd5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161565 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> 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();