sc/inc/global.hxx                 |    7 +++++--
 sc/source/core/data/global.cxx    |    4 ++--
 sc/source/ui/drawfunc/drawsh.cxx  |    2 +-
 sc/source/ui/drawfunc/drtxtob.cxx |    2 +-
 4 files changed, 9 insertions(+), 6 deletions(-)

New commits:
commit a2601800845c6500f833684f5e09bf324ac8af09
Author:     Samuel Mehrbrodt <samuel.mehrbr...@cib.de>
AuthorDate: Wed Jul 17 13:59:22 2019 +0200
Commit:     Samuel Mehrbrodt <samuel.mehrbr...@cib.de>
CommitDate: Wed Jul 17 17:05:37 2019 +0200

    tdf#121039 "Open hyperlink" from context menu does not work
    
    Change-Id: I802a4a64d48befa9c41b7095416f165082a155f2
    Reviewed-on: https://gerrit.libreoffice.org/75778
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@cib.de>

diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index c71403ebcdeb..0fef008448d5 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -565,8 +565,11 @@ public:
     SC_DLLPUBLIC static ScUnoAddInCollection* GetAddInCollection();
     SC_DLLPUBLIC static ScUserList*         GetUserList();
     static void                 SetUserList( const ScUserList* pNewList );
-    /// Open the specified URL.
-    static void                 OpenURL(const OUString& rURL, const OUString& 
rTarget);
+    /**
+     * Open the specified URL.
+     * @param bIgnoreSettings - If true, ignore security settings (Ctrl-Click) 
and just open the URL.
+     */
+    static void OpenURL(const OUString& rURL, const OUString& rTarget, bool 
bIgnoreSettings = false);
     /// Whether the URL can be opened according to current security options 
(Click/Ctrl-Click)
     static bool                 ShouldOpenURL();
     SC_DLLPUBLIC static OUString            GetAbsDocName( const OUString& 
rFileName,
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index 53855d39c4fe..19722265ce67 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -774,12 +774,12 @@ bool ScGlobal::EETextObjEqual( const EditTextObject* 
pObj1,
     return false;
 }
 
-void ScGlobal::OpenURL(const OUString& rURL, const OUString& rTarget)
+void ScGlobal::OpenURL(const OUString& rURL, const OUString& rTarget, bool 
bIgnoreSettings)
 {
     // OpenURL is always called in the GridWindow by mouse clicks in some way 
or another.
     // That's why pScActiveViewShell and nScClickMouseModifier are correct.
 
-    if (!ShouldOpenURL())
+    if (!bIgnoreSettings && !ShouldOpenURL())
         return;
 
     SfxViewFrame* pViewFrm = SfxViewFrame::Current();
diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx
index 5991c57bf56c..1f0a8f6d2ff8 100644
--- a/sc/source/ui/drawfunc/drawsh.cxx
+++ b/sc/source/ui/drawfunc/drawsh.cxx
@@ -248,7 +248,7 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq )
 
                 ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( pObj );
                 if ( pInfo && !pInfo->GetHlink().isEmpty() )
-                    ScGlobal::OpenURL( pInfo->GetHlink(), OUString() );
+                    ScGlobal::OpenURL( pInfo->GetHlink(), OUString(), true );
             }
             break;
 
diff --git a/sc/source/ui/drawfunc/drtxtob.cxx 
b/sc/source/ui/drawfunc/drtxtob.cxx
index 877434afee80..9a039034dd35 100644
--- a/sc/source/ui/drawfunc/drtxtob.cxx
+++ b/sc/source/ui/drawfunc/drtxtob.cxx
@@ -324,7 +324,7 @@ void ScDrawTextObjectBar::Execute( SfxRequest &rReq )
                 const SvxFieldData* pField = pFieldItem->GetField();
                 if (const SvxURLField* pURLField = dynamic_cast<const 
SvxURLField*>(pField))
                 {
-                    ScGlobal::OpenURL(pURLField->GetURL(), 
pURLField->GetTargetFrame());
+                    ScGlobal::OpenURL(pURLField->GetURL(), 
pURLField->GetTargetFrame(), true);
                 }
             }
             break;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to