Bug 138347 - Link to call Basic script with vnd.sun.star.script: not working in Writer. Same thing working in Calc (also with HYPERLINK()).
Summary: Link to call Basic script with vnd.sun.star.script: not working in Writer. Sa...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
3.3.0 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Hyperlink
  Show dependency treegraph
 
Reported: 2020-11-19 18:12 UTC by Wolfgang Jäger
Modified: 2022-11-16 22:57 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
A text document with macro demonstrating the issue (30.02 KB, application/vnd.oasis.opendocument.text)
2020-11-19 18:12 UTC, Wolfgang Jäger
Details
Same macro in a spreadsheet document. Link working (46.89 KB, application/vnd.oasis.opendocument.spreadsheet)
2020-11-19 18:13 UTC, Wolfgang Jäger
Details
Exemplifying relevant differences by three insetzed hyperlinks (17.75 KB, application/vnd.oasis.opendocument.text)
2021-10-28 18:53 UTC, Wolfgang Jäger
Details
Event assigned to the Hyperlink (35.58 KB, image/png)
2021-11-23 19:53 UTC, Andreas Heinisch
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Wolfgang Jäger 2020-11-19 18:12:35 UTC
Created attachment 167402 [details]
A text document with macro demonstrating the issue

With 7.0.2 and also with 7.0.3:

A link like

vnd.sun.star.script:Standard.Module1.Main?language=Basic&location=document
is correctly shown on mouse over the linked text, but does not work in Writer.

Same link created same way in Calc is working as expected.  
The text of the link passed to HYPERLINK() also gives the working link.

See attachments.
Comment 1 Wolfgang Jäger 2020-11-19 18:13:41 UTC
Created attachment 167403 [details]
Same macro in a spreadsheet document. Link working
Comment 2 Andreas Heinisch 2021-07-07 19:24:47 UTC
Confirmed in:

Version: 7.3.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 0aea0cee58fe77a9058217dfdfc3d6a02b29ee2a
CPU threads: 6; OS: Windows 10.0 Build 19042; UI render: Skia/Raster; VCL: win
Locale: en-US (de_DE); UI: en-US
Calc: CL
Comment 3 Andreas Heinisch 2021-07-07 19:31:08 UTC
However, opening the link via context menu works. (Right Click -> Open Hyperlink)
Comment 4 Andreas Heinisch 2021-07-10 10:39:11 UTC
I tried to investigate this error. Here are my findings:

For both Calc and Writer the URL will be open in:
https://opengrok.libreoffice.org/xref/core/sfx2/source/appl/appopen.cxx?r=5021a10f#1078

The only difference is that the target of the URL is "empty" for Calc and "_blank" for Writer, if you try to open it using CTRL+click. However, if Writer opens the URL via context menu, the target is "empty" as well.

Calc will add the "_blank" target, if SHIFT is enabled, which is IMHO wrong:
https://opengrok.libreoffice.org/xref/core/sc/source/core/data/global.cxx?r=1b7fc505#810

Writer adds the "_blank" target in:
https://opengrok.libreoffice.org/xref/core/sw/source/uibase/wrtsh/wrtsh2.cxx?r=aa818a0b#546, because of the CTRL modifier in:
https://opengrok.libreoffice.org/xref/core/sw/source/uibase/docvw/edtwin.cxx?r=216a43bc#4691.

Imho, this is not a macro problem, but a problem in the target handling in appopen.cxx and the supported protocols for the "_blank" target.
Comment 5 Wolfgang Jäger 2021-10-28 18:53:59 UTC
Created attachment 175975 [details]
Exemplifying relevant differences by three insetzed hyperlinks

(In reply to Andreas Heinisch from comment #4)
> I tried to investigate this error. Here are my findings:
> 
> For both Calc and Writer the URL will be open in:
> https://opengrok.libreoffice.org/xref/core/sfx2/source/appl/appopen.
> cxx?r=5021a10f#1078
> 
> The only difference is that the target of the URL is "empty" for Calc and
> "_blank" for Writer, ...

> Imho, this is not a macro problem, but a problem in the target handling in
> appopen.cxx and the supported protocols for the "_blank" target.

I can't go the same ways, but would doubt the "... but a problem in the target handling..." as the only background. 

After all ordinary external links assigned to text portions in Writer are working as expected, and for a link made to call a script, I would expect the target frame irrelevant.  

A new example exemplifying differences I suppose to be part of the bug's backround is attached as "bug_tdf#138347_example2 .
Comment 6 Andreas Heinisch 2021-11-23 19:53:11 UTC
Created attachment 176454 [details]
Event assigned to the Hyperlink

Sry for the later reply. The working link has an event attached to it, whereas the not working macro contains only the link to the macro.
Comment 7 Andreas Heinisch 2021-11-23 19:56:00 UTC
However, if I attach a macro to the hyperlink triggering event to the first attachment, the link will be triggered twice if opened using the context menu of the hyperlink.
Comment 8 Wolfgang Jäger 2022-11-14 13:13:32 UTC
bump
Comment 9 Wolfgang Jäger 2022-11-16 22:57:34 UTC
Did a bit of research once more. Result:

The bug was already present in OOo and was never fixed. It continues to exist in AOO (tested with 4.1.7 portable). However, it only takes effect when the option "Ctrl+Click to activate Hyperlink" is set. 

Users shouldn't be encouraged to reduce security settings. And again: In Calc everything is OK so far. Same in Draw.  

To be clear: Only the Sub calling protocol vnd.sun.star.sript: is afflicted. Ordinary hyperlinks work as expected.