diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2019-07-17 13:59:22 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2019-07-17 17:05:37 +0200 |
commit | a2601800845c6500f833684f5e09bf324ac8af09 (patch) | |
tree | 05ad8fe4c84bc867bdae31f7c0ae41bfeb4d3f9b /sc | |
parent | 51acd327651b5bca4383478cde3d05d5dbb5371f (diff) |
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.Mehrbrodt@cib.de>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/global.hxx | 7 | ||||
-rw-r--r-- | sc/source/core/data/global.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/drawfunc/drawsh.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/drawfunc/drtxtob.cxx | 2 |
4 files changed, 9 insertions, 6 deletions
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; |