Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/4051

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/51/4051/1

fdo#51296 Helptext added for hyperlinks, hlinks behave  as in writer

Added prefixed of "ctrl+click to open hyperlink" to hlinks depending on the security setting. Now 
clicking links behave as in writer.

Change-Id: I87d0fecb6268463cd99478b70eb081ed958976be
---
M sc/inc/globstr.hrc
M sc/source/core/data/global.cxx
M sc/source/ui/src/globstr.src
M sc/source/ui/view/gridwin5.cxx
4 files changed, 72 insertions(+), 17 deletions(-)



diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index 7dc6cd6..d053da6 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -673,7 +673,10 @@
 
 #define STR_FUN_TEXT_SELECTION_COUNT    546
 
-#define STR_COUNT                   547
+#define STR_CTRLCLICKHYPERLINK      548
+#define STR_CLICKHYPERLINK          549
+
+#define STR_COUNT                   560
 
 #endif
 
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index 95084a9..a34b1de 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -925,20 +925,20 @@
     //  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
+    bool bCtrlClickHappened = (nScClickMouseModifier & KEY_MOD1);
+    bool bCtrlClickSecOption = aSecOpt.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK );
+    if( bCtrlClickHappened && !( bCtrlClickSecOption ) )
     {
-        //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 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
+        return;
+    }
     SfxStringItem aUrl( SID_FILE_NAME, rURL );
     SfxStringItem aTarget( SID_TARGETNAME, rTarget );
     aTarget.SetValue(OUString("_blank"));
diff --git a/sc/source/ui/src/globstr.src b/sc/source/ui/src/globstr.src
index b9ffd2a..9ab25c1 100644
--- a/sc/source/ui/src/globstr.src
+++ b/sc/source/ui/src/globstr.src
@@ -2065,6 +2065,14 @@
     {
         Text [ en-US ] = "Invalid condition." ;
     };
+    String STR_CTRLCLICKHYPERLINK
+    {
+        Text [ en-US ] = "ctrl+click to open hyperlink:";
+    };
+    String STR_CLICKHYPERLINK
+    {
+        Text [ en-US ] = "click to open hyperlink:";
+    };
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/gridwin5.cxx b/sc/source/ui/view/gridwin5.cxx
index 7055c22..7253feb 100644
--- a/sc/source/ui/view/gridwin5.cxx
+++ b/sc/source/ui/view/gridwin5.cxx
@@ -31,6 +31,7 @@
 #include <sfx2/viewfrm.hxx>
 
 #include <unotools/localedatawrapper.hxx>
+#include <unotools/securityoptions.hxx>
 
 #include "viewuno.hxx"
 #include "AccessibleDocument.hxx"
@@ -49,7 +50,8 @@
 #include "tabvwsh.hxx"
 #include "userdat.hxx"
 #include "postit.hxx"
-
+#include "global.hxx"
+#include "globstr.hrc"
 // -----------------------------------------------------------------------
 
 bool ScGridWindow::ShowNoteMarker( SCsCOL nPosX, SCsROW nPosY, bool bKeyboard )
@@ -237,16 +239,25 @@
 
 void ScGridWindow::RequestHelp(const HelpEvent& rHEvt)
 {
+    //To know whether to prefix STR_CTRLCLICKHYERLINK or STR_CLICKHYPERLINK
+    //to hyperlink tooltips/help text
+    SvtSecurityOptions aSecOpt;
+    //using sal_bool not bool because it seems so prominent
+    //stores state of ctrl click security setting
+    sal_Bool bCtrlClickHlink = aSecOpt.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK );
+    //Global string STR_CTRLCLICKHYPERLINK i.e, "ctrl+click to open hyperlink:"
+    OUString aCtrlClickHlinkStr = ScGlobal::GetRscString( STR_CTRLCLICKHYPERLINK );
+    //Global string STR_CLICKHYPERLINK i.e, "click to open hyperlink"
+    //could have just used this and made STR_CTRLCLICKHYPERLINK by prefixing
+    //ctrl+ to it; But don't know if 'ctrl' needs localization?
+    OUString aClickHlinkStr = ScGlobal::GetRscString( STR_CLICKHYPERLINK );
     sal_Bool bDone = false;
     sal_Bool bHelpEnabled = ( rHEvt.GetMode() & ( HELPMODE_BALLOON | HELPMODE_QUICK ) ) != 0;
     SdrView* pDrView = pViewData->GetScDrawView();
-
     sal_Bool bDrawTextEdit = false;
     if (pDrView)
         bDrawTextEdit = pDrView->IsTextEdit();
-
     //  notes or change tracking
-
     if ( bHelpEnabled && !bDrawTextEdit )
     {
         Point       aPosPixel = ScreenToOutputPixel( rHEvt.GetMousePosPixel() );
@@ -300,6 +311,16 @@
                         aHelpText = pIMapObj->GetAltText();
                         if (!aHelpText.Len())
                             aHelpText = pIMapObj->GetURL();
+                        if( bCtrlClickHlink )
+                        {
+                            //prefix STR_CTRLCLICKHYPERLINK to aHelpText
+                            aHelpText = aCtrlClickHlinkStr + aHelpText;
+                        }
+                        else
+                        {
+                            //Option not set, so prefix STR_CLICKHYPERLINK
+                            aHelpText = aClickHlinkStr + aHelpText;
+                        }
                         aPixRect = LogicToPixel(aVEvt.pObj->GetLogicRect());
                     }
                 }
@@ -329,6 +350,17 @@
                             {
                                 aPixRect = LogicToPixel(aVEvt.pObj->GetLogicRect());
                                 aHelpText = pInfo->GetHlink();
+                                if( bCtrlClickHlink )
+                                {
+                                //prefix STR_CTRLCLICKHYPERLINK to aHelpText
+                                aHelpText = aCtrlClickHlinkStr + aHelpText;
+                                }
+                                else
+                                {
+                                //Option not set, so prefix STR_CLICKHYPERLINK
+                                aHelpText = aClickHlinkStr + aHelpText;
+                                }
+
                             }
                         }
                     }
@@ -344,6 +376,18 @@
                 aHelpText = INetURLObject::decode( aUrl, INET_HEX_ESCAPE,
                     INetURLObject::DECODE_UNAMBIGUOUS );
 
+                if( bCtrlClickHlink )
+                {
+                    //prefix STR_CTRLCLICKHYPERLINK to aHelpText
+                    aHelpText = aCtrlClickHlinkStr + aHelpText;
+                }
+                else
+                {
+                    //Option not set, so prefix STR_CLICKHYPERLINK
+                    aHelpText = aClickHlinkStr + aHelpText;
+                }
+
+
                 ScDocument* pDoc = pViewData->GetDocument();
                 SCsCOL nPosX;
                 SCsROW nPosY;

-- 
To view, visit https://gerrit.libreoffice.org/4051
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I87d0fecb6268463cd99478b70eb081ed958976be
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Akash Shetye <shetyeakash@gmail.com>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.