[Libreoffice-commits] core.git: sc/source

Akash Shetye shetyeakash at gmail.com
Mon Mar 25 10:20:08 PDT 2013


 sc/source/core/data/global.cxx |   21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

New commits:
commit 99932fa89be0e041abf5ce5da3271600c841ff19
Author: Akash Shetye <shetyeakash at gmail.com>
Date:   Sun Mar 24 00:59:26 2013 +0530

    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

diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index c4fb19f..be9b38e 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>
@@ -924,13 +925,25 @@ void ScGlobal::OpenURL( const String& rURL, const String& rTarget )
 {
     //  OpenURL wird immer ueber irgendwelche Umwege durch Mausklicks im GridWindow
     //  aufgerufen, darum stimmen pScActiveViewShell und nScClickMouseModifier.
+    //SvtSecurityOptions to access Libreoffice global security parameters
+    SvtSecurityOptions aSecOpt;
+    bool bProceedHyperlink = false;
+    if ( (nScClickMouseModifier & KEY_MOD1) && aSecOpt.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK ))     // control-click -> into new window
+    {
+        //Ctrl key is pressed and ctrl+click hyperlink security control is set
+        bProceedHyperlink = true;
+    }
+    else if( !aSecOpt.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK ) )
+    {
+        //ctrl+click hyperlink security control is disabled just click will do
+        bProceedHyperlink = true;
+    }
+    if ( !bProceedHyperlink )
+        return;
 
     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"));
-
+    aTarget.SetValue(rtl::OUString("_blank"));
     SfxViewFrame* pFrame = NULL;
     String aReferName;
     if ( pScActiveViewShell )


More information about the Libreoffice-commits mailing list