editeng/source/editeng/impedit2.cxx |   12 ++
 include/vcl/ITiledRenderable.hxx    |    2 
 sc/source/core/data/global.cxx      |    6 -
 sc/source/ui/view/gridwin.cxx       |  153 +++++++++++++++++++-----------------
 4 files changed, 96 insertions(+), 77 deletions(-)

New commits:
commit d37cbe0254ae64b7de303ff186045ec7b2dbc2f5
Author: Marco Cecchetti <marco.cecche...@collabora.com>
Date:   Fri May 11 22:33:00 2018 +0200

    lok: sc: ctrl-clicking links doesn't work
    
    I think there is no reason for not execuring the code below
    
    if ((bDouble || bIsTiledRendering) && .... ) { ... }
    
    for both desktop and online.
    
    So since the code for open the clicked URL is below such if
    clause, I changed the code so that we return only when it's really a
    double click event.
    
    Moreover I reverted back the code for executing the list validation
    pop-up to its original place, since there is no more the need to have
    it executed in two places.
    
    Change-Id: Idbec2e6e45cd7ee8282005169e1132a11d4cac33
    Reviewed-on: https://gerrit.libreoffice.org/54150
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>
    Tested-by: Andras Timar <andras.ti...@collabora.com>

diff --git a/editeng/source/editeng/impedit2.cxx 
b/editeng/source/editeng/impedit2.cxx
index d66bf4e6e973..67fa9f3e0fed 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -595,7 +595,17 @@ bool ImpEditEngine::MouseButtonUp( const MouseEvent& 
rMEvt, EditView* pView )
     {
         if ( ( rMEvt.GetClicks() == 1 ) && rMEvt.IsLeft() && !rMEvt.IsMod2() )
         {
-            const SvxFieldItem* pFld = pView->GetFieldUnderMousePointer();
+
+            const SvxFieldItem* pFld;
+            if ( comphelper::LibreOfficeKit::isActive() )
+            {
+                Point aLogicClick = pView->GetWindow()->PixelToLogic( 
rMEvt.GetPosPixel() );
+                pFld = pView->GetField( aLogicClick );
+            }
+            else
+            {
+                pFld = pView->GetFieldUnderMousePointer();
+            }
             if ( pFld )
             {
                 EditPaM aPaM( aCurSel.Max() );
diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index 46ad7677e910..7f8f7ce4c332 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -59,7 +59,7 @@ namespace vcl
     { PointerStyle::HSizeBar, "col-resize" },
     { PointerStyle::VSizeBar, "row-resize" },
     { PointerStyle::Hand, "grab" },
-    { PointerStyle::RefHand, "grabbing" },
+    { PointerStyle::RefHand, "pointer" },
     // Pen, Magnify, Fill, Rotate
     // HShear, VShear
     // Mirror, Crook, Crop, MovePoint, MoveBezierWeight
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index 83c95286c0fa..4febc35ff02c 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -789,12 +789,6 @@ bool ScGlobal::EETextObjEqual( const EditTextObject* pObj1,
 
 void ScGlobal::OpenURL(const OUString& rURL, const OUString& rTarget)
 {
-    if (comphelper::LibreOfficeKit::isActive())
-    {
-        if(SfxViewShell* pViewShell = SfxViewShell::Current())
-            
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_HYPERLINK_CLICKED, 
rURL.toUtf8().getStr());
-    }
-
     // OpenURL is always called in the GridWindow by mouse clicks in some way 
or another.
     // That's why pScActiveViewShell and nScClickMouseModifier are correct.
     // SvtSecurityOptions to access Libreoffice global security parameters
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 23a6144b66da..6040d41e9ba0 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -1794,56 +1794,6 @@ void ScGridWindow::HandleMouseButtonDown( const 
MouseEvent& rMEvt, MouseEventSta
     }
 }
 
-void lcl_executeList( ScViewData* pViewData, ScModule* pScMod, ScMarkData& 
rMark )
-{
-    pViewData->GetView()->SelectionChanged();
-
-    SfxDispatcher* pDisp = pViewData->GetViewShell()->GetDispatcher();
-    bool bFormulaMode = pScMod->IsFormulaMode();
-    OSL_ENSURE( pDisp || bFormulaMode, "Cursor moved on inactive View ?" );
-
-    //  #i14927# execute SID_CURRENTCELL (for macro recording) only if there 
is no
-    //  multiple selection, so the argument string completely describes the 
selection,
-    //  and executing the slot won't change the existing selection (executing 
the slot
-    //  here and from a recorded macro is treated equally)
-    if ( pDisp && !bFormulaMode && !rMark.IsMultiMarked() )
-    {
-        OUString aAddr;                               // CurrentCell
-        if( rMark.IsMarked() )
-        {
-            ScRange aScRange;
-            rMark.GetMarkArea( aScRange );
-            aAddr = aScRange.Format(ScRefFlags::RANGE_ABS);
-            if ( aScRange.aStart == aScRange.aEnd )
-            {
-                //  make sure there is a range selection string even for a 
single cell
-                aAddr = aAddr + ":" + aAddr;
-            }
-
-            //! SID_MARKAREA does not exist anymore ???
-            //! What happens when selecting with the cursor ???
-        }
-        else                                        // only move cursor
-        {
-            ScAddress aScAddress( pViewData->GetCurX(), pViewData->GetCurY(), 
0 );
-            aAddr = aScAddress.Format(ScRefFlags::ADDR_ABS);
-        }
-
-        SfxStringItem aPosItem( SID_CURRENTCELL, aAddr );
-        // We don't want to align to the cursor position because if the
-        // cell cursor isn't visible after making selection, it would jump
-        // back to the origin of the selection where the cell cursor is.
-        SfxBoolItem aAlignCursorItem( FN_PARAM_2, false );
-        pDisp->ExecuteList(SID_CURRENTCELL,
-                SfxCallMode::SLOT | SfxCallMode::RECORD,
-                { &aPosItem, &aAlignCursorItem });
-
-        pViewData->GetView()->InvalidateAttribs();
-
-    }
-    pViewData->GetViewShell()->SelectionChanged();
-}
-
 void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
 {
     aCurMousePos = rMEvt.GetPosPixel();
@@ -2093,7 +2043,10 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& 
rMEvt )
 
     bool bIsTiledRendering = comphelper::LibreOfficeKit::isActive();
     bool bDouble = ( rMEvt.GetClicks() == 2 && rMEvt.IsLeft() );
-    if ((bDouble || bIsTiledRendering) && !bRefMode && (nMouseStatus == 
SC_GM_DBLDOWN || bIsTiledRendering) && !pScMod->IsRefDialogOpen())
+    if ((bDouble || bIsTiledRendering)
+            && !bRefMode
+            && (nMouseStatus == SC_GM_DBLDOWN || (bIsTiledRendering && 
nMouseStatus != SC_GM_URLDOWN))
+            && !pScMod->IsRefDialogOpen())
     {
         //  data pilot table
         Point aPos = rMEvt.GetPosPixel();
@@ -2182,20 +2135,13 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& 
rMEvt )
             }
         }
 
-        if (bIsTiledRendering)
-        {
-            ScTabView* pTabView = pViewData->GetView();
-            if (rMEvt.IsLeft() && pTabView->GetSelEngine()->SelMouseButtonUp( 
rMEvt ))
-                pTabView->SelectionChanged();
-        }
-
         if ( bIsTiledRendering && rMEvt.IsLeft() && 
pViewData->GetView()->GetSelEngine()->SelMouseButtonUp( rMEvt ) )
         {
-            lcl_executeList( pViewData, pScMod, rMark);
-            return;
+            pViewData->GetView()->SelectionChanged();
         }
 
-        return;
+        if ( bDouble )
+            return;
     }
 
             //      Links in edit cells
@@ -2287,7 +2233,53 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& 
rMEvt )
 
     if ( rMEvt.IsLeft() && 
pViewData->GetView()->GetSelEngine()->SelMouseButtonUp( rMEvt ) )
     {
-        lcl_executeList( pViewData, pScMod, rMark);
+        pViewData->GetView()->SelectionChanged();
+
+        SfxDispatcher* pDisp = pViewData->GetViewShell()->GetDispatcher();
+        bool bFormulaMode = pScMod->IsFormulaMode();
+        OSL_ENSURE( pDisp || bFormulaMode, "Cursor moved on inactive View ?" );
+
+        //  #i14927# execute SID_CURRENTCELL (for macro recording) only if 
there is no
+        //  multiple selection, so the argument string completely describes 
the selection,
+        //  and executing the slot won't change the existing selection 
(executing the slot
+        //  here and from a recorded macro is treated equally)
+        if ( pDisp && !bFormulaMode && !rMark.IsMultiMarked() )
+        {
+            OUString aAddr;                               // CurrentCell
+            if( rMark.IsMarked() )
+            {
+                ScRange aScRange;
+                rMark.GetMarkArea( aScRange );
+                aAddr = aScRange.Format(ScRefFlags::RANGE_ABS);
+                if ( aScRange.aStart == aScRange.aEnd )
+                {
+                    //  make sure there is a range selection string even for a 
single cell
+                    aAddr = aAddr + ":" + aAddr;
+                }
+
+                //! SID_MARKAREA does not exist anymore ???
+                //! What happens when selecting with the cursor ???
+            }
+            else                                        // only move cursor
+            {
+                ScAddress aScAddress( pViewData->GetCurX(), 
pViewData->GetCurY(), 0 );
+                aAddr = aScAddress.Format(ScRefFlags::ADDR_ABS);
+            }
+
+            SfxStringItem aPosItem( SID_CURRENTCELL, aAddr );
+            // We don't want to align to the cursor position because if the
+            // cell cursor isn't visible after making selection, it would jump
+            // back to the origin of the selection where the cell cursor is.
+            SfxBoolItem aAlignCursorItem( FN_PARAM_2, false );
+            pDisp->ExecuteList(SID_CURRENTCELL,
+                    SfxCallMode::SLOT | SfxCallMode::RECORD,
+                    { &aPosItem, &aAlignCursorItem });
+
+            pViewData->GetView()->InvalidateAttribs();
+
+        }
+        pViewData->GetViewShell()->SelectionChanged();
+
         return;
     }
 }
@@ -2398,11 +2390,27 @@ void ScGridWindow::MouseMove( const MouseEvent& rMEvt )
         if ( nPosX >= nEditCol && nPosX <= nEndCol &&
              nPosY >= nEditRow && nPosY <= nEndRow )
         {
+            if ( !pEditView )
+            {
+                SetPointer( Pointer( PointerStyle::Text ) );
+                return;
+            }
+
+            const SvxFieldItem* pFld;
+            if ( comphelper::LibreOfficeKit::isActive() )
+            {
+                Point aLogicClick = pEditView->GetWindow()->PixelToLogic( aPos 
);
+                pFld = pEditView->GetField( aLogicClick );
+            }
+            else
+            {
+                pFld = pEditView->GetFieldUnderMousePointer();
+            }
             //  Field can only be URL field
             bool bAlt = rMEvt.IsMod2();
-            if ( !bAlt && !nButtonDown && pEditView && 
pEditView->GetFieldUnderMousePointer() )
+            if ( !bAlt && !nButtonDown && pFld )
                 SetPointer( Pointer( PointerStyle::RefHand ) );
-            else if ( pEditView && pEditView->GetEditEngine()->IsVertical() )
+            else if ( pEditView->GetEditEngine()->IsVertical() )
                 SetPointer( Pointer( PointerStyle::TextVertical ) );
             else
                 SetPointer( Pointer( PointerStyle::Text ) );
@@ -5221,11 +5229,18 @@ bool ScGridWindow::GetEditUrl( const Point& rPos,
         EditView aTempView(pEngine.get(), this);
         aTempView.SetOutputArea( aLogicEdit );
 
-        MapMode aOld = GetMapMode();
-        SetMapMode(aEditMode);                  // no return anymore
-        bool bRet = extractURLInfo(aTempView.GetFieldUnderMousePointer(), 
pName, pUrl, pTarget);
-        SetMapMode(aOld);
-
+        bool bRet;
+        if (comphelper::LibreOfficeKit::isActive())
+        {
+            bRet = extractURLInfo(aTempView.GetField(aLogicClick), pName, 
pUrl, pTarget);
+        }
+        else
+        {
+            MapMode aOld = GetMapMode();
+            SetMapMode(aEditMode);                  // no return anymore
+            bRet = extractURLInfo(aTempView.GetFieldUnderMousePointer(), 
pName, pUrl, pTarget);
+            SetMapMode(aOld);
+        }
         return bRet;
     }
     return false;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to