Bug 158157 - Unable to disable commands located in xxxToolbars
Summary: Unable to disable commands located in xxxToolbars
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: UI (show other bugs)
Version:
(earliest affected)
7.2.5.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Macro-UNOAPI
  Show dependency treegraph
 
Reported: 2023-11-10 09:48 UTC by Alain Romedenne
Modified: 2024-10-16 08:19 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
worksheet with Python scripts (16.39 KB, application/vnd.oasis.opendocument.spreadsheet)
2024-10-14 17:47 UTC, Alain Romedenne
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alain Romedenne 2023-11-10 09:48:51 UTC
Description:
I can successfully remove/reset commands that are present in menu pulldowns using 'disable commands' wiki documentation:
https://wiki.documentfoundation.org/Documentation/DevGuide/Writing_UNO_Components#Disable_Commands

I noticed that this does not remove counterpart commands from xxxToolbars such as ‘Tabbed Compact’ and the like.

Steps to Reproduce:
1. Copy the indicated wiki code inside any document
2. Run Main
3. Observe xxxToolbars are unaffected

Actual Results:
Menu pulldowns commands are removed or reset

Expected Results:
Equivalent xxxToolbars commands should be disabled/enabled in parallel


Reproducible: Always


User Profile Reset: No

Additional Info:
Versions past 7.2.5 exhibit a misbehaviour that's reported in bug#157915
Comment 1 Stéphane Guillou (stragu) 2023-11-28 16:35:59 UTC
Thanks Alain. I tried to bibisect bug 157915 and shared my results there, hopefully that gets things moving along. However, the issue I noticed started in 7.4.
When you say "versions past 7.2.5 exhibit a misbehaviour", do you mean that you can reproduce the bug in e.g. 7.2.6? And 7.3.0?

I assume it's not possible to test the issue you describe here in a recent master build, then, correct? But we can safely assume that the behaviour hasn't changed since 7.2 in that regard.
Comment 2 Alain Romedenne 2023-11-29 10:40:46 UTC
(In reply to Stéphane Guillou (stragu) from comment #1)
> Thanks Alain. I tried to bibisect bug 157915 and shared my results there,
> hopefully that gets things moving along. However, the issue I noticed
> started in 7.4.
> When you say "versions past 7.2.5 exhibit a misbehaviour", do you mean that
> you can reproduce the bug in e.g. 7.2.6? And 7.3.0?
> 
> I assume it's not possible to test the issue you describe here in a recent
> master build, then, correct? But we can safely assume that the behaviour
> hasn't changed since 7.2 in that regard.

Hi Stéphane,

By misbehaviour I meant that menu bars do not refresh properly:

1. run _disableCommands() subroutine
   Menus are hidden and become unoperating as expected
2. run _enableCommands() subroutine
   Menus are kept hidden and require to (re)open the doc in order to (re)appear

However running main() routine does not exhibit that behaviour
Comment 3 Buovjaga 2024-01-16 17:22:11 UTC
I tried to reproduce, but I got stuck. I copied the Basic code from https://wiki.documentfoundation.org/Documentation/DevGuide/Writing_UNO_Components#Disabling_Commands_at_Runtime

If I run the main function, the About dialog opens and another dialog opens with the text "Ok, dispatch object for .uno:About" and I am unable to close this dialog. I have to kill the LibreOffice process.

If I run disableCommands, I get

BASIC runtime error.
Property or method not found: stopped.

Pointing to line 94:

EXC.stopped REM Let's bubble-up the error condition

What should I do to reproduce this?
Comment 4 Alain Romedenne 2024-01-17 13:32:58 UTC
(In reply to Buovjaga from comment #3)
> I tried to reproduce, but I got stuck. I copied the Basic code from
> https://wiki.documentfoundation.org/Documentation/DevGuide/
> Writing_UNO_Components#Disabling_Commands_at_Runtime
> 
> If I run the main function, the About dialog opens and another dialog opens
> with the text "Ok, dispatch object for .uno:About" and I am unable to close
> this dialog. I have to kill the LibreOffice process.
> 
> If I run disableCommands, I get
> 
> BASIC runtime error.
> Property or method not found: stopped.
> 
> Pointing to line 94:
> 
> EXC.stopped REM Let's bubble-up the error condition
> 
> What should I do to reproduce this?

Hi Ilmari,

Including the 'About' panel in the test is probably a bad idea as pointed by Noel in bug157915. Please remove "About" from CMD_LIST Basic array when running Main() routine.

If you intend to run routines separately, please make sure they include Main() initialization statements:
Set EXC = New ERROR_RAISER ' Exception artifact
With ...
    ...
End With
CMD_LIST = ...
Comment 5 Alain Romedenne 2024-01-17 13:47:41 UTC
Ilmari, 

I tested the code sample under Win10 using TDF copy of LibO

Can you indicate your OS and LibO versions?
Comment 6 Buovjaga 2024-01-17 15:24:06 UTC
(In reply to Alain Romedenne from comment #4)
> Including the 'About' panel in the test is probably a bad idea as pointed by
> Noel in bug157915. Please remove "About" from CMD_LIST Basic array when
> running Main() routine.

I removed it. I got the File Open dialog, I canceled out. I realised that Linux with kf5 didn't let me close the dialog that popped up. I was able to close it when using the gen backend.

What is the result I am looking for? I see in the description of the code "At the end, the code removes the disabled commands again, otherwise LibreOffice would not be fully usable any longer". I also ran the macro when in Tabbed UI and the running seemed to be the same.

Arch Linux 64-bit, X11
Version: 24.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 88a7384edcd8f4240a659f2c2c7c1258471341f4
CPU threads: 8; OS: Linux 6.7; UI render: default; VCL: x11
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded
Built on 17 January 2024
Comment 7 Alain Romedenne 2024-01-24 13:23:49 UTC
(In reply to Buovjaga from comment #6)
> (In reply to Alain Romedenne from comment #4)
> > Including the 'About' panel in the test is probably a bad idea as pointed by
> > Noel in bug157915. Please remove "About" from CMD_LIST Basic array when
> > running Main() routine.
> 
> I removed it. I got the File Open dialog, I canceled out. I realised that
> Linux with kf5 didn't let me close the dialog that popped up. I was able to
> close it when using the gen backend.
> 
> What is the result I am looking for? I see in the description of the code
> "At the end, the code removes the disabled commands again, otherwise
> LibreOffice would not be fully usable any longer". I also ran the macro when
> in Tabbed UI and the running seemed to be the same.
> 
> Arch Linux 64-bit, X11
> Version: 24.8.0.0.alpha0+ (X86_64) / LibreOffice Community
> Build ID: 88a7384edcd8f4240a659f2c2c7c1258471341f4
> CPU threads: 8; OS: Linux 6.7; UI render: default; VCL: x11
> Locale: fi-FI (fi_FI.UTF-8); UI: en-US
> Calc: threaded
> Built on 17 January 2024

For Open SelectAll, Quit command sequence, you should get:

1. FileOpen dialog that you may cancel
 - Ok msg box stating that UNO dispatch command went fine
2. Writer doc content selected or Basic IDE code selected or else ..
 - Ok msg box stating that UNO dispatch command went fine
3. Quit dialog that you may cancel
 - Ok msg box stating that UNO dispatch command went fine
Then..
4. 3 Msg boxes boxes stating that Open, SelectAll and Quit UNO commands aren't available
Comment 8 Alain Romedenne 2024-10-13 14:55:52 UTC
I wonder what is still expected to validate that bug report. Can you please clarify?
Comment 9 Buovjaga 2024-10-14 11:53:16 UTC
(In reply to Alain Romedenne from comment #7)
> (In reply to Buovjaga from comment #6)
> > (In reply to Alain Romedenne from comment #4)
> > > Including the 'About' panel in the test is probably a bad idea as pointed by
> > > Noel in bug157915. Please remove "About" from CMD_LIST Basic array when
> > > running Main() routine.
> > 
> > I removed it. I got the File Open dialog, I canceled out. I realised that
> > Linux with kf5 didn't let me close the dialog that popped up. I was able to
> > close it when using the gen backend.
> > 
> > What is the result I am looking for? I see in the description of the code
> > "At the end, the code removes the disabled commands again, otherwise
> > LibreOffice would not be fully usable any longer". I also ran the macro when
> > in Tabbed UI and the running seemed to be the same.
> > 
> > Arch Linux 64-bit, X11
> > Version: 24.8.0.0.alpha0+ (X86_64) / LibreOffice Community
> > Build ID: 88a7384edcd8f4240a659f2c2c7c1258471341f4
> > CPU threads: 8; OS: Linux 6.7; UI render: default; VCL: x11
> > Locale: fi-FI (fi_FI.UTF-8); UI: en-US
> > Calc: threaded
> > Built on 17 January 2024
> 
> For Open SelectAll, Quit command sequence, you should get:
> 
> 1. FileOpen dialog that you may cancel
>  - Ok msg box stating that UNO dispatch command went fine
> 2. Writer doc content selected or Basic IDE code selected or else ..
>  - Ok msg box stating that UNO dispatch command went fine
> 3. Quit dialog that you may cancel
>  - Ok msg box stating that UNO dispatch command went fine
> Then..
> 4. 3 Msg boxes boxes stating that Open, SelectAll and Quit UNO commands
> aren't available

Ok, now I tried it and confirm the result in step 4, but Open and Quit commands are still enabled in menus. Is this the issue your report is about? And not only about Notebookbar?

Arch Linux 64-bit
Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 5daac16a03c84f5908808be446c705e19445c150
CPU threads: 8; OS: Linux 6.10; UI render: default; VCL: kf6 (cairo+wayland)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: CL threaded
Built on 10 October 2024
Comment 10 Alain Romedenne 2024-10-14 17:47:23 UTC
Created attachment 197050 [details]
worksheet with Python scripts
Comment 11 Alain Romedenne 2024-10-14 17:47:49 UTC
Hi Ilmari,

a. Use version 24.2 as 24.8 is not stable enough.

b. Two instances of Open menu exist in Writer, I suppose this is what you used, hence your observation.

c. Validate with the attached worksheet instead.

Python - or Basic for that same matter - work well, as menus come and go...

What is missing since the advent of the various xxxToolBars is that none of them reflect the expected disablement/enablement. Hence that bug report.
Comment 12 Buovjaga 2024-10-16 08:19:27 UTC
(In reply to Alain Romedenne from comment #10)
> Created attachment 197050 [details]
> worksheet with Python scripts

Ok, I do see now what is hidden. If I try with Tabbed, the Quit command does disappear from the File dropdown menu. "Open Remote File" remains in the Open dropdown. About Select All, I'm not sure if it is present in Tabbed in the first place.

Arch Linux 64-bit
Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: a5f45b816e6e26439fa9e6e594b6972b100d13af
CPU threads: 8; OS: Linux 6.10; UI render: default; VCL: kf6 (cairo+wayland)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: CL threaded
Built on 15 October 2024