[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - editeng/source include/vcl sc/source

Marco Cecchetti marco.cecchetti at collabora.com
Wed Jul 4 08:31:01 UTC 2018


 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 273ce0fff04838d84a9f9a56aa5f180d93f7428a
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date:   Thu May 10 23:13:12 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/56923
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>

diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 850aa9200784..a5c9d1ac98b6 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -573,7 +573,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 aa5e0c113e6f..99a1579dde1a 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 fc434c0a97a4..0ef2ca479a52 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -857,12 +857,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 5b7ede7a2be7..b3abf1f3e944 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -1985,56 +1985,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();
@@ -2284,7 +2234,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();
@@ -2373,20 +2326,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
@@ -2478,7 +2424,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;
     }
 }
@@ -2589,11 +2581,27 @@ void ScGridWindow::MouseMove( const MouseEvent& rMEvt )
         if ( nPosX >= (SCsCOL) nEditCol && nPosX <= (SCsCOL) nEndCol &&
              nPosY >= (SCsROW) nEditRow && nPosY <= (SCsROW) 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 ) );
@@ -5412,11 +5420,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;


More information about the Libreoffice-commits mailing list