[Libreoffice-commits] core.git: sc/source

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 29 13:36:06 UTC 2021


 sc/source/core/data/global.cxx  |    3 ++-
 sc/source/ui/drawfunc/fusel.cxx |    3 ++-
 sc/source/ui/view/gridwin5.cxx  |    4 +++-
 3 files changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 1b7fc505bdd6c3c44986221c6bbe33af1a0e3ac6
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Jun 29 13:54:00 2021 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue Jun 29 15:35:33 2021 +0200

    sc: don't require ctrl-click when clicking on internal links of shapes
    
    Excel doesn't require such additional actions, and Writer doesn't
    require ctrl-click for internal links (e.g. cross-references), either.
    
    Also suppress the tooltip hinting ctrl-click in this case.
    
    Change-Id: If2fbec533f5c2a57268a22cf96464e724922ff7f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118085
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Tested-by: Jenkins

diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index 55415f1fdbd7..bff82bab4b8e 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -761,7 +761,8 @@ void ScGlobal::OpenURL(const OUString& rURL, const OUString& rTarget, bool bIgno
     // OpenURL is always called in the GridWindow by mouse clicks in some way or another.
     // That's why pScActiveViewShell and nScClickMouseModifier are correct.
 
-    if (!bIgnoreSettings && !ShouldOpenURL())
+    // Fragments pointing into the current document should be always opened.
+    if (!bIgnoreSettings && !(ShouldOpenURL() || rURL.startsWith("#")))
         return;
 
     SfxViewFrame* pViewFrm = SfxViewFrame::Current();
diff --git a/sc/source/ui/drawfunc/fusel.cxx b/sc/source/ui/drawfunc/fusel.cxx
index 6c8f753d4974..02af11bfe7ca 100644
--- a/sc/source/ui/drawfunc/fusel.cxx
+++ b/sc/source/ui/drawfunc/fusel.cxx
@@ -223,7 +223,8 @@ bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
                 }
 
                 // open hyperlink, if found at object or in object's text
-                if ( !sURL.isEmpty() && ScGlobal::ShouldOpenURL() )
+                // Fragments pointing into the current document should be always opened.
+                if ( !sURL.isEmpty() && (ScGlobal::ShouldOpenURL() || sURL.startsWith("#")) )
                 {
                     ScGlobal::OpenURL( sURL, sTarget );
                     rViewShell.FakeButtonUp( rViewShell.GetViewData().GetActivePart() );
diff --git a/sc/source/ui/view/gridwin5.cxx b/sc/source/ui/view/gridwin5.cxx
index 21ecc7a1e018..915cb06e99f0 100644
--- a/sc/source/ui/view/gridwin5.cxx
+++ b/sc/source/ui/view/gridwin5.cxx
@@ -292,7 +292,9 @@ void ScGridWindow::RequestHelp(const HelpEvent& rHEvt)
                                         pObj = pHit;
                             }
                             ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( pObj );
-                            if ( pInfo && (pInfo->GetHlink().getLength() > 0) )
+                            // Fragments pointing into the current document need no tooltip
+                            // describing the ctrl-click functionality.
+                            if ( pInfo && (pInfo->GetHlink().getLength() > 0) && !pInfo->GetHlink().startsWith("#") )
                             {
                                 aPixRect = LogicToPixel(aVEvt.mpObj->GetLogicRect());
                                 aHelpText = SfxHelp::GetURLHelpText(pInfo->GetHlink());


More information about the Libreoffice-commits mailing list