[PATCH libreoffice-4-0] fdo#51296 Patch accounts security setting requiring ctrl+cli...
Akash Shetye (via Code Review)
gerrit at gerrit.libreoffice.org
Mon Mar 25 07:01:06 PDT 2013
Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/3032
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/32/3032/1
fdo#51296 Patch accounts security setting requiring ctrl+click for hyperlinks.
Have used a boolean variable that acts as an entry condition to OpenURL methods main body/code and is set on qualification of security check.
Change-Id: I1280e7cf7e8923282fda17088fd7c61fbf503b9d
---
M sc/source/core/data/global.cxx
1 file changed, 36 insertions(+), 23 deletions(-)
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index e18d241..cbff570 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -38,6 +38,7 @@
#include <sal/macros.h>
#include <tools/rcid.h>
#include <unotools/charclass.hxx>
+#include <unotools/securityoptions.hxx>
#include <stdlib.h>
#include <time.h>
#include <ctype.h>
@@ -925,39 +926,51 @@
{
// OpenURL wird immer ueber irgendwelche Umwege durch Mausklicks im GridWindow
// aufgerufen, darum stimmen pScActiveViewShell und nScClickMouseModifier.
-
- SfxStringItem aUrl( SID_FILE_NAME, rURL );
- SfxStringItem aTarget( SID_TARGETNAME, rTarget );
-
- if ( nScClickMouseModifier & KEY_MOD1 ) // control-click -> into new window
- aTarget.SetValue(rtl::OUString("_blank"));
-
- SfxViewFrame* pFrame = NULL;
- String aReferName;
- if ( pScActiveViewShell )
+ //SvtSecurityOptions to access Libreoffice global security parameters
+ SvtSecurityOptions aSecOpt;
+ bool aProceedHyperlink = false;
+ if ( (nScClickMouseModifier & KEY_MOD1) && aSecOpt.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK )) // control-click -> into new window
{
- pFrame = pScActiveViewShell->GetViewFrame();
- SfxMedium* pMed = pFrame->GetObjectShell()->GetMedium();
- if (pMed)
- aReferName = pMed->GetName();
+ //Ctrl key is pressed and ctrl+click hyperlink security control is set
+ aProceedHyperlink = true;
}
+ else if( !( aSecOpt.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK ) ) )
+ {
+ //ctrl+click hyperlink security control is disabled just click will do
+ aProceedHyperlink = true;
+ }
+ if ( aProceedHyperlink )
+ {
+ SfxStringItem aUrl( SID_FILE_NAME, rURL );
+ SfxStringItem aTarget( SID_TARGETNAME, rTarget );
+ aTarget.SetValue(rtl::OUString("_blank"));
+ SfxViewFrame* pFrame = NULL;
+ String aReferName;
+ if ( pScActiveViewShell )
+ {
+ pFrame = pScActiveViewShell->GetViewFrame();
+ SfxMedium *pMed = pFrame->GetObjectShell()->GetMedium();
+ if (pMed)
+ aReferName = pMed->GetName();
+ }
- SfxFrameItem aFrm( SID_DOCFRAME, pFrame );
- SfxStringItem aReferer( SID_REFERER, aReferName );
+ SfxFrameItem aFrm( SID_DOCFRAME, pFrame );
+ SfxStringItem aReferer( SID_REFERER, aReferName );
- SfxBoolItem aNewView( SID_OPEN_NEW_VIEW, false );
- SfxBoolItem aBrowsing( SID_BROWSE, sal_True );
+ SfxBoolItem aNewView( SID_OPEN_NEW_VIEW, false );
+ SfxBoolItem aBrowsing( SID_BROWSE, sal_True );
- // kein SID_SILENT mehr
+ // kein SID_SILENT mehr
- SfxViewFrame* pViewFrm = SfxViewFrame::Current();
- if (pViewFrm)
- pViewFrm->GetDispatcher()->Execute( SID_OPENDOC,
- SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
+ SfxViewFrame* pViewFrm = SfxViewFrame::Current();
+ if (pViewFrm)
+ pViewFrm->GetDispatcher()->Execute( SID_OPENDOC,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
&aUrl, &aTarget,
&aFrm, &aReferer,
&aNewView, &aBrowsing,
0L );
+ }
}
//------------------------------------------------------------------------
--
To view, visit https://gerrit.libreoffice.org/3032
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1280e7cf7e8923282fda17088fd7c61fbf503b9d
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Akash Shetye <shetyeakash at gmail.com>
More information about the LibreOffice
mailing list