From ef740ac1291c1e7a04c45c727e18ce28b196c812 Mon Sep 17 00:00:00 2001 From: Dennis Francis Date: Mon, 25 May 2020 23:53:21 +0530 Subject: lokit: scPrintTwipsMsgs: LOK_CALLBACK_COMMENT Allow print twips coordinates in LOK_CALLBACK_COMMENT Change-Id: I052dacb311c651c49d61fd9937951fa5b81b32d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97967 Tested-by: Jenkins CollaboraOffice Reviewed-by: Dennis Francis (cherry picked from commit dd64235e326feb94c7530f7ee408545e4945d5df) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97978 Tested-by: Jenkins --- sc/source/ui/docshell/docsh4.cxx | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'sc/source/ui/docshell/docsh4.cxx') diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index c021ee40da3d..6e369608998e 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -2497,17 +2497,28 @@ void ScDocShell::LOKCommentNotify(LOKCommentNotificationType nType, const ScDocu ScViewData* pViewData = GetViewData(); if (pViewData && pViewData->GetActiveWin()) { - Point aScrPos = pViewData->GetScrPos(rPos.Col(), rPos.Row(), pViewData->GetActivePart(), true); - long nSizeXPix; - long nSizeYPix; - pViewData->GetMergeSizePixel(rPos.Col(), rPos.Row(), nSizeXPix, nSizeYPix); - - const double fPPTX = pViewData->GetPPTX(); - const double fPPTY = pViewData->GetPPTY(); - tools::Rectangle aRect(Point(aScrPos.getX() / fPPTX, aScrPos.getY() / fPPTY), - Size(nSizeXPix / fPPTX, nSizeYPix / fPPTY)); - - aAnnotation.put("cellPos", aRect.toString()); + bool bInPrintTwips = comphelper::LibreOfficeKit::isCompatFlagSet( + comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs); + OString aRectString; + if (bInPrintTwips) + { + Point aTopLeft = pViewData->GetPrintTwipsPos(rPos.Col(), rPos.Row()); + long nSizeX, nSizeY; + pViewData->GetMergeSizePrintTwips(rPos.Col(), rPos.Row(), nSizeX, nSizeY); + aRectString = tools::Rectangle(aTopLeft, Size(nSizeX, nSizeY)).toString(); + } + else + { + Point aTopLeft = pViewData->GetScrPos(rPos.Col(), rPos.Row(), + pViewData->GetActivePart(), true); + long nSizeXPix, nSizeYPix; + pViewData->GetMergeSizePixel(rPos.Col(), rPos.Row(), nSizeXPix, nSizeYPix); + const double fPPTX = pViewData->GetPPTX(); + const double fPPTY = pViewData->GetPPTY(); + aRectString = tools::Rectangle(Point(aTopLeft.getX() / fPPTX, aTopLeft.getY() / fPPTY), + Size(nSizeXPix / fPPTX, nSizeYPix / fPPTY)).toString(); + } + aAnnotation.put("cellPos", aRectString); } } -- cgit