• Maxim Monastirsky's avatar
    tdf#106999 Feedback for style commands · b91fb08f
    Maxim Monastirsky yazdı
    The .uno:StyleApply command takes some arguments, which make
    it possible to apply any style of any type. The problem is
    that it doesn't provide toggle state to be used when placing
    such commands on a toolbar or a menubar. The reason is that
    sfx2, by design, can provide status updates only for the
    .uno:StyleApply command as a whole, ignoring any arguments
    that might be specified in the UI element description. This
    behavior is even documented in the XDispatch idl.
    wrt solution, changing the generic UI code to handle the
    specifics of an individual command can never be a good idea.
    The usual approach in such cases is to create separate
    commands which will handle the status updates correctly. This
    is however not possible in our case because styles can be
    created by users, and we can't predict their names and create
    separate commands for all of them (given that now it's easy to
    add style commands to toolbars and menus - see tdf#106681).
    One possible solution is to create a toolbar button controller
    on top of .uno:StyleApply, which will be able to translate its
    status update to a state compatible with the toolbar. The downside
    is that it won't work when placing such command inside a menu, and
    in general the menu code in framework doesn't provide any way to
    control individual menu items, only a whole sub-menus via a
    popup menu controller.
    To fix the menu use-case too, this commit introduces a "proxy"
    dispatch implementation, which can be used by MenuBarManager
    in a transparent way, as if it was the "real" application-level
    dispatcher. This means that the changes needed in MenuBarManager
    are minimal and do not over-complicate the code, which is a good
    thing (Alternatively, such dispatcher could be registered via
    the dispatch interception mechanism, but it will add no gain,
    given the current requirements, and just add more complexity).
    And to make it easier to reuse the code, the new dispatcher
    is also used for the toolbar solution.
    Change-Id: Ia73b0fa70fd4d1d59360b255aa8fd19570b971ee
    Reviewed-on: https://gerrit.libreoffice.org/37590Tested-by: 's avatarJenkins <ci@libreoffice.org>
    Reviewed-by: 's avatarMaxim Monastirsky <momonasmon@gmail.com>
Library_fwk.mk 7.53 KB