static void SetUserList( const ScUserList* pNewList );
/// Open the specified URL.
static void OpenURL(const OUString& rURL, const OUString& rTarget);
+ /// 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,
const SfxObjectShell* pShell );
SC_DLLPUBLIC static OUString GetDocTabName( const OUString& rFileName,
{
// 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
- SvtSecurityOptions aSecOpt;
- bool bCtrlClickHappened = (nScClickMouseModifier & KEY_MOD1);
- bool bCtrlClickSecOption = aSecOpt.IsOptionSet( SvtSecurityOptions::EOption::CtrlClickHyperlink );
- if( bCtrlClickHappened && ! bCtrlClickSecOption )
- {
- // return since ctrl+click happened when the
- // ctrl+click security option was disabled, link should not open
- return;
- }
- else if( ! bCtrlClickHappened && bCtrlClickSecOption )
- {
- // ctrl+click did not happen; only click happened maybe with some
- // other key combo. and security option is set, so return
+
+ if (!ShouldOpenURL())
return;
- }
SfxViewFrame* pViewFrm = SfxViewFrame::Current();
if (!pViewFrm)
{ &aUrl, &aTarget, &aFrm, &aReferer, &aNewView, &aBrowsing });
}
+bool ScGlobal::ShouldOpenURL()
+{
+ SvtSecurityOptions aSecOpt;
+ bool bCtrlClickHappened = (nScClickMouseModifier & KEY_MOD1);
+ bool bCtrlClickSecOption = aSecOpt.IsOptionSet( SvtSecurityOptions::EOption::CtrlClickHyperlink );
+ if( bCtrlClickHappened && ! bCtrlClickSecOption )
+ {
+ // return since ctrl+click happened when the
+ // ctrl+click security option was disabled, link should not open
+ return false;
+ }
+ else if( ! bCtrlClickHappened && bCtrlClickSecOption )
+ {
+ // ctrl+click did not happen; only click happened maybe with some
+ // other key combo. and security option is set, so return
+ return false;
+ }
+ return true;
+}
+
bool ScGlobal::IsSystemRTL()
{
return MsLangId::isRightToLeft( Application::GetSettings().GetLanguageTag().getLanguageType() );