Issue 128582 - Keyboard mappings to macros became unavailable when AOO is started from C++
Summary: Keyboard mappings to macros became unavailable when AOO is started from C++
Status: UNCONFIRMED
Alias: None
Product: App Dev
Classification: Unclassified
Component: scripting (show other issues)
Version: 4.1.12
Hardware: PC Linux 64-bit
: P5 (lowest) Normal
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2024-01-06 20:23 UTC by SET
Modified: 2024-02-07 12:01 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: 4.1.15
Developer Difficulty: ---


Attachments
Simplest test case (6.29 KB, application/zip)
2024-01-07 18:37 UTC, SET
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description SET 2024-01-06 20:23:00 UTC
Hi,

This issue is observed on Linux in 4.1.15 and 4.5.0. It is not observed in 4.1.7.

A C++ application starts AOO using bootstrap() and text documents are created from *.ott templates containing basic macros. Some macros have bindings to keyboard combinations, all defined in the UI.

In 4.1.7, the keyboard bindings work as expected in unsaved new documents.

In 4.1.15 and 4.5.0, the macros are not called by the keyboard shortcuts when a new file is generated from a template. Executing the macros directly using the UI dialogs succeeds.

The bindings will work in 2 circumstances:

 - the newly generated document is saved and reloaded via the File menu,
 - the newly generated document is saved, closed and opened again.
 
If AOO is started from bash, without being started by the controlling application, the bindings just work.

I am reporting in the bug tracker because I could not find another official place to discuss this unexpected behaviour.

Thank you for any input, help and eventual resolution.

Regards.
Comment 1 Matthias Seidel 2024-01-07 12:29:40 UTC
(In reply to SET from comment #0)
> I am reporting in the bug tracker because I could not find another official
> place to discuss this unexpected behaviour.

Hi,

You can always subscribe to our developer mailing list:

https://openoffice.apache.org/mailing-lists.html#development-mailing-list-public
Comment 2 SET 2024-01-07 13:27:39 UTC
> You can always subscribe to our developer mailing list:
> 

I subscribed and posted the the dev mailing list.

Thank you for your reply.
Comment 3 Matthias Seidel 2024-01-07 13:30:23 UTC
You're welcome!

One thing comes to my mind:
The gap between 4.1.7 and 4.1.15 is quite big. Can you try with 4.1.14?
Comment 4 SET 2024-01-07 14:47:34 UTC
(In reply to Matthias Seidel from comment #3)
> You're welcome!
> 
> One thing comes to my mind:
> The gap between 4.1.7 and 4.1.15 is quite big. Can you try with 4.1.14?

The keyboard shortcuts are operational with 4.1.11, but not with 4.1.12.
Comment 5 damjan 2024-01-07 16:24:44 UTC
If the regression happened between 4.1.11 and 4.1.12, then the list of possible commits that caused the regression is in:
git log --name-status AOO411..AOO412

There's 71 of them, not sure what to look for.

If possible, please attach a minimal sample of this C++ code that reproduces the issue?
Comment 6 Matthias Seidel 2024-01-07 16:47:46 UTC
It is 4.1.11 to 4.1.12:

https://github.com/apache/openoffice/compare/AOO4111-GA...AOO4112-GA
Comment 7 SET 2024-01-07 18:37:38 UTC
Created attachment 87206 [details]
Simplest test case

Please find a test app to test different AOO versions.

Using:
 - gcc (GCC) 13.2.1 20230801
 - clang version 16.0.6
 - cmake version 3.28.1

on Arch Linux.

Thank you for your time.
Comment 8 Arrigo Marchiori 2024-02-01 19:26:16 UTC
Hello,

4.1.12 had some commits that changed the logic of allowing macro execution:
417e12810c61e06dae9a3df49a2e1860863ccceb
57221d74ec27db61efcf416a9f0e37ad824b5ccc
b42dd17c7ad2f25b3e10e8cdee9dd5292510f975 <-- check this in particular

SET, your C++ code does not seem to load any OTT templates, and the ZIP file does not include any.

I suspect that the culprit could be the above commit pointed with the arrow <-- because it stops macro execution on files that contain _no macros_. Is this your case?
(this check should be later repeated when macros are added).
Comment 9 SET 2024-02-04 19:40:27 UTC
Hi,

After reverting fb9ad7aa175, basic macros are callable by keyboard shortcuts when AOO 4.5.0 is started with ::cppu::bootstrap().

I made a diff bdb20b2a64..60e0a1c111 where I suspected fb9ad7aa175. bdb20b2a64 is the commit displayed in the 'About' dialog of 4.1.11 from your website, and 60e0a1c111 got 4.1.12.

To recapitulate the many situation:

 A. Any version started with the 'soffice' script on Arch Linux
    No unexpected behaviour when macros are called by keyboard shortcuts in all situations.

 B. 4.1.11 started by ::cppu::bootstrap()
    No unexpected behaviour in all situations.

 C. 4.1.12 to 4.5.0 started by ::cppu::bootstrap() with fb9ad7aa175 applied
    Macros are not callable by keyboard shortcuts on a new unsaved text document; they are callable by keyboard shortcuts after loading a saved document from storage.

 D. 4.5.0 started by ::cppu::bootstrap() with fb9ad7aa175 *reverted*
    No unexpected behaviour when macros are called by keyboard shortcuts in all situations.
    
Please consider for a fix.

Thank you.
Comment 10 SET 2024-02-04 19:44:33 UTC
(In reply to Arrigo Marchiori from comment #8)
> Hello,

I just saw your reply, completely missed it, sorry. I just posted #9.
Comment 11 SET 2024-02-04 19:58:20 UTC
(In reply to Arrigo Marchiori from comment #8)
> Hello,
>  
> SET, your C++ code does not seem to load any OTT templates, and the ZIP file
> does not include any.

I indeed mentioned templates in the OP because it's my workflow. In fact the problem occurs without templates also, please see comment #9.
Comment 12 Arrigo Marchiori 2024-02-06 19:36:06 UTC
Hello,

the commit list I was referring to for 4.1.12 shall be changed as follows for trunk (4.5.0):
aea5254635d14376dd83e528769fd1dec8f7dbd7
fb9ad7aa17549019ccdd2762a97d104449abf45d  <-- you reverted this
4018d3b8a14b17c2bbe7eaec1ac3a460adc072cb  <-- please check this

We cannot just revert fb9ad7aa175, unfortunately.
Comment 13 SET 2024-02-06 20:54:32 UTC
> 4018d3b8a14b17c2bbe7eaec1ac3a460adc072cb  <-- please check this

Should I understand
 - apply fb9ad7aa17549019ccdd2762a97d104449abf45d
 - revert 4018d3b8a14b17c2bbe7eaec1ac3a460adc072cb
 - or update 4018d3b8a14b17c2bbe7eaec1ac3a460adc072cb

?

Updating 4018d3b8a14b17c2bbe7eaec1ac3a460adc072cb is not really within my reach.

Thank you for having considered.
Comment 14 SET 2024-02-07 12:01:36 UTC
Reverting 4018d3b8a14b17c2bbe7eaec1ac3a460adc072cb does not change anything.

The macros are not callable by keyboard shortcuts. Please note that the macros are callable throughout via custom menu items and custom toolbar buttons.

I suppose 4018d3b8a14b17c2bbe7eaec1ac3a460adc072cb must be left applied and updated. That's complicated for me.