[PATCH] fdo#51296:UI: Calc doesn't take care of security setting "Ctrl-click required to follow hyperlinks

Petr Mladek pmladek at suse.cz
Tue Mar 26 07:11:45 PDT 2013


On Mon, Mar 25, 2013 at 5:56 PM, Akash Shetye <shetyeakash at gmail.com>
wrote:
>
> Petr thank you for your suggestions, I happened to overlook the "Ctrl-click
> to open hyperlink" prefix string to the tooltips in excitement oh having a
> patch :P. Now that I have taken a look at sc/ code, I find that the prefixed
> string is not hardcoded into the sw/ code. Also how sc/ and sw/ handle
> hyperlinks is very differently. I tried probing into the vcl part about
> fixedhyperlink.cxx to trace things back up from there but things aren't
> working well. Just knowing which part of code is doing the tooltip content
> setting in sc/ will be cool enough. Thanks for cc'ing the experts.

Yup, it needs some search. I am not much familiar with this code as
well. so, I suggest to compare the working code Writer with the code in
Calc.

In writer, it starts at
http://cgit.freedesktop.org/libreoffice/core/tree/sw/source/ui/utlui/initui.src#n137
where the English string "STR_HYPERLINK_CLICK" is defined "%s-click to
open hyperlink".

Then you might see
http://cgit.freedesktop.org/libreoffice/core/tree/sw/source/ui/utlui/initui.hrc#n51
, where we define some integer ID for the string STR_HYPERLINK_CLICK

The localized string is loaded at
http://cgit.freedesktop.org/libreoffice/core/tree/sw/source/ui/utlui/initui.cxx#n157
and the "%s" is replaced by a real key code at
http://cgit.freedesktop.org/libreoffice/core/tree/sw/source/ui/utlui/initui.cxx#n170

The string (variable aHyperlinkClick) is later used at
http://cgit.freedesktop.org/libreoffice/core/tree/sw/source/ui/docvw/edtwin2.cxx#n220
http://cgit.freedesktop.org/libreoffice/core/tree/sw/source/ui/docvw/SidebarTxtControl.cxx#n247

I think that edtwin2.cxx#n220 is the location that is responsible for
showing the tooltip when you hover over the hyperlink in Writer editor.
I think that SidebarTxtControl.cxx#n247 is just another place where you
could see similar tooltip but I am not sure where it is.


And now the fun is to find the related code in Calc. My guess is that it
might be somewhere around sc/source/ui/view. In each case, it should be
under sc/source/ui.

When I go back to sw/source/ui/docvw/edtwin2.cxx, the variable
"aHyperlinkClick" is assigned to "sTxt" which is later passed to
Help::ShowQuickHelp, so I would search for "ShowQuickHelp" and
"hyperlink" under sc/source/ui and try to fix where the hyperlink is
assigned to the tooltip string.

If you find this place, you need to:

    + define the string "%s-click to open hyperlink" in some
      Calc-specific .src file
    + define the related ID in the .hrc file
    + load the string as it was done in
      sw/source/ui/utlui/initui.cxx#n157
    + substiture the %s by the real key code
    + and finally add the string to the tooltip string if the 
      SvtSecurityOptions::E_CTRLCLICK_HYPERLINK option is set


I hope that the above makes sense and could help you.

Feel free to ask if you get lost. I am sure that Kohei or another Calc
expert could give you even more precise hints.


Best Regards,
Petr



More information about the LibreOffice mailing list