diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2019-08-19 15:31:14 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2019-08-19 21:12:17 +0200 |
commit | 91b431f88e7abaa3a088b8caf1bdd7e5fe0bf120 (patch) | |
tree | 985f167782201e5ecdbc0b3ba2aa26fbb072638f /editeng | |
parent | 471b185b8b1ce3982271bbb77261fbb5e6860d17 (diff) |
tdf#121039 Open URL also when in edit mode
Change-Id: Ib51ced376bd2c8476f4f44629040e277960f8f1c
Reviewed-on: https://gerrit.libreoffice.org/77727
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/editeng/impedit2.cxx | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index bd3ad15d81a3..b81fa54d3e18 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -34,6 +34,7 @@ #include <sfx2/app.hxx> #include <svtools/colorcfg.hxx> #include <svl/ctloptions.hxx> +#include <unotools/securityoptions.hxx> #include <editeng/acorrcfg.hxx> #include <editeng/fhgtitem.hxx> #include <editeng/lrspitem.hxx> @@ -53,7 +54,9 @@ #include <com/sun/star/lang/Locale.hpp> #include <com/sun/star/text/CharacterCompressionType.hpp> #include <com/sun/star/i18n/InputSequenceCheckMode.hpp> - +#include <com/sun/star/system/SystemShellExecute.hpp> +#include <com/sun/star/system/SystemShellExecuteFlags.hpp> +#include <com/sun/star/system/XSystemShellExecute.hpp> #include <sal/log.hxx> #include <osl/diagnose.h> @@ -63,6 +66,7 @@ #include <i18nutil/unicode.hxx> #include <tools/diagnose_ex.h> #include <comphelper/lok.hxx> +#include <comphelper/processfactory.hxx> #include <unotools/configmgr.hxx> #include <unicode/ubidi.h> @@ -588,6 +592,23 @@ bool ImpEditEngine::MouseButtonUp( const MouseEvent& rMEvt, EditView* pView ) Point aLogicClick = rOutDev.PixelToLogic(rMEvt.GetPosPixel()); if (const SvxFieldItem* pFld = pView->GetField(aLogicClick)) { + // tdf#121039 When in edit mode, editeng is responsible for opening the URL on mouse click + if (auto pUrlField = dynamic_cast<const SvxURLField*>(pFld->GetField())) + { + SvtSecurityOptions aSecOpt; + bool bCtrlClickHappened = rMEvt.IsMod1(); + bool bCtrlClickSecOption + = aSecOpt.IsOptionSet(SvtSecurityOptions::EOption::CtrlClickHyperlink); + if ((bCtrlClickHappened && bCtrlClickSecOption) + || (!bCtrlClickHappened && !bCtrlClickSecOption)) + { + css::uno::Reference<css::system::XSystemShellExecute> exec( + css::system::SystemShellExecute::create( + comphelper::getProcessComponentContext())); + exec->execute(pUrlField->GetURL(), OUString(), + css::system::SystemShellExecuteFlags::URIS_ONLY); + } + } EditPaM aPaM( aCurSel.Max() ); sal_Int32 nPara = GetEditDoc().GetPos( aPaM.GetNode() ); GetEditEnginePtr()->FieldClicked( *pFld, nPara, aPaM.GetIndex() ); |