[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sc/source

Mert Tumer (via logerrit) logerrit at kemper.freedesktop.org
Thu Feb 20 15:48:10 UTC 2020


 sc/source/ui/view/gridwin.cxx |   26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

New commits:
commit 9bfa939f87f28cdaed2a24c3dc5f9a21004b19da
Author:     Mert Tumer <mert.tumer at collabora.com>
AuthorDate: Thu Feb 20 18:33:04 2020 +0300
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Thu Feb 20 16:47:37 2020 +0100

    send hyperlinkclicked callback on calc mobile
    
    for opening links ctrl+click must be pressed
    but in mobile this cant be done
    This patch allows it to send the callback and also
    cell coordinates for hyperlink popup
    
    Change-Id: I8c0fac167627ef449d9cf20a36a7a5a77978ae0f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89121
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index d416607a379e..1232a8fa3626 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -2189,7 +2189,31 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
             // ScGlobal::OpenURL() only understands Calc A1 style syntax.
             // Convert it to Calc A1 before calling OpenURL().
             if (pDoc->GetAddressConvention() == formula::FormulaGrammar::CONV_OOO)
-                ScGlobal::OpenURL(aUrl, aTarget);
+            {
+                // in mobile view there is no ctrl+click and for hyperlink popup
+                // the cell coordinates must be sent along with click position for elegance
+                if (comphelper::LibreOfficeKit::isActive() &&
+                     comphelper::LibreOfficeKit::isMobile(SfxLokHelper::getView()))
+                {
+                    ScTabViewShell* pViewShell = pViewData->GetViewShell();
+                    Point aPos = rMEvt.GetPosPixel();
+                    SCCOL nPosX;
+                    SCROW nPosY;
+                    pViewData->GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY );
+                    auto pForTabView = dynamic_cast<const ScTabViewShell *>(pViewShell);
+                    OString aCursor = pForTabView->GetViewData().describeCellCursorAt(nPosX, nPosY);
+                    double fPPTX = pForTabView->GetViewData().GetPPTX();
+                    int mouseX = aPos.X() / fPPTX;
+                    OStringBuffer aBuf;
+                    aBuf.append(aUrl.toUtf8().getStr());
+                    aBuf.append(" coordinates: ");
+                    aBuf.append(aCursor);
+                    aBuf.append(", ");
+                    aBuf.append(mouseX);
+                    pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_HYPERLINK_CLICKED, aBuf.makeStringAndClear().getStr());
+                } else
+                    ScGlobal::OpenURL(aUrl, aTarget);
+            }
             else
             {
                 ScAddress aTempAddr;


More information about the Libreoffice-commits mailing list