https://issues.apache.org/ooo/show_bug.cgi?id=121960

--- Comment #6 from Ariel Constenla-Haile <[email protected]> ---
Created attachment 80507
  --> https://issues.apache.org/ooo/attachment.cgi?id=80507&action=edit
Commands.xcu

This is the Commands.xcu file inside the extension on attachment 80464

The commands that are disabled by configuration are:

.uno:Bold
.uno:Italic
.uno:Underline
.uno:FontColor
.uno:BackgroundColor
.uno:CharFontName
.uno:FontHeight
.uno:ParagraphDialog
.uno:PageDialog

Best way to see the effect:

- Create a new Writer document
- dt + F3 to insert dummy text
- select a word and set it in bold, select another one and set it in italic
- open the Extension Manager and install the extension on attachment 80464,
trying to keep both windows visible (the Writer document and the Extension
Manager), looking at the formatting toolbar

When installing the extension finished, you'll see that the disabled commands
are indeed disabled on the formatting toolbar, the status is updated right
after the extension is installed. If you open a new window, you'll see that the
disabled commands are removed from the toolbar (this is because the toolbar and
menu managers remove disabled command on UI element initialization).

Disabled commands cannot be executed by selecting the respective toolbar/menu
item, nor by the keyword shortcut (for example, Ctrl + B does not set a word in
bold if .uno:Bold is disabled).

There are two bugs in the sidebar:

a) feature status is not reflected, the respective items are enabled in the
sidebar though disabled by configuration

b) the respective slot is executed regardless of being disabled

A third bug, may not be easy to implement:

c) disabled items are not removed

(a) is due to the use of a (class derived from) SfxControllerItem to track
status updates, this bypasses the dispatch framework (by "dispatch framework" I
mean all the UNO-based layer mainly implemented in the new framework module:
the framework's Frame, as dispatch provider, takes care of returning an empty
dispatch when the command is disabled, see Frame::queryDispatch() in
main/framework/source/services/frame.cxx, and Desktop::queryDispatch() in
main/framework/source/services/desktop.cxx).
Side note: the sfx2 context menu implementation has a similar bug, because the
SfxMenuControl is derived from SfxControllerItem: with .uno:Bold disabled,
right-click on a bold word, the context menu will display that Style - Bold is
checked; though selecting the menu item to remove the bold does not work, in
this case bug (b) does not apply.

(b) is due to the way the slot is executed through the SfxDispatcher and not
through the SfxBindings, the latter forwards calls to the dispatch framework,
the former bypasses it. An example, for the Bold in the text properties: 

main/svx/source/sidebar/text/TextPropertyPanel.cxx
IMPL_LINK(TextPropertyPanel, ToolboxFontSelectHandler, ToolBox*, pToolBox)

mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_WEIGHT, SFX_CALLMODE_RECORD,
&aWeightItem, 0L);

(c) makes the sidebar behave different from the toolbar and menubar, where
disabled items are removed (opengrok SvtCommandOptions in the framework
module).

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.

Reply via email to