Embed submenu for ToggleDropdownButton in Addons.xcu/Toolbar

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
prof_milki
Posts: 2
Joined: Thu May 20, 2021 10:23 am

Embed submenu for ToggleDropdownButton in Addons.xcu/Toolbar

Post by prof_milki »

ToggleDropdownButton is one of the complex toolbar[1] controls you can use in Addons.xcu,
which could provide something like the .uno:Save toolbar button/menu combo:
toogledropdown.png
toogledropdown.png (8.73 KiB) Viewed 2681 times
But there aren't any examples on how you would declare the associated submenu/actions.
There's only the complextoolbarcontrols example[5], which uses some callback to populate the select options.

But I was wondering if you can declare it right in Addons.xcu and the OfficeToolbarMerging structure.
I gave it a try[6] with a few random prop/node and name= combinations, none of which really worked out of course:

Code: Select all

    <node oor:name="T4-2" oor:op="replace">
        <prop oor:name="ControlType" oor:type="xs:string"><value>ToggleDropdownButton</value></prop>
        <prop oor:name="Title" oor:type="xs:string"><value xml:lang="en-US">+++</value></prop>
        <prop oor:name="URL" oor:type="xs:string"><value> vnd.pkg?trigger </value></prop>
        <!--prop oor:name="List" oor:type="xs:string"><value xml:lang="en-US">entry entry2</value></prop-->
        <prop oor:name="Width" oor:type="xs:long"><value>50</value></prop>
        <node oor:name="DropdownMenuItem"> <!-- List, ToolBarItems, Submenu -->
            <node oor:name="T4-3" oor:op="replace">
                <prop oor:name="URL" oor:type="xs:string"><value> vnd.pkg?trigger2 </value></prop>
                <prop oor:name="Target" oor:type="xs:string"><value>_self</value></prop>
                <prop oor:name="ControlType" oor:type="xs:string"><value>Checkbox</value></prop>
                <prop oor:name="Title" oor:type="xs:string"><value xml:lang="en-US">FLAG</value></prop>
            </node>
        </node>
    </node>
It's not clear if that's possible at all, or how you would structure it then.
  • The `List` property likely just works for Comboboxes.
  • There aren't any custom property names declared in toolbarmerger.cxx[4] as far as I can tell.
  • Is there perhaps a way to reference another menu declaration through the URL?
  • Or do you really need to initialize your toolbar component? (Not sure if that's possible from PyUNO at all. Certainly would be performance and thus usability drain, if.)
  • You could probably hook up the primary URL to create a floating submenu (or xwindow or whatever). That just seems like a bit too much effort, and would undermine the primary toolbar icon retaining a real action.
  • I've seen some references to a similar post on oooforum.org, but seemingly there's no backup after all.
Has anyone seen one of Toggle/DropdownButton been used in another UNO extension perchance?

Refs
AOO 4.1.7 / LO 7.1.0.3 on Ubuntu 20.04 // Working on PageTranslate
JeJe
Volunteer
Posts: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: Embed submenu for ToggleDropdownButton in Addons.xcu/Too

Post by JeJe »

You could probably hook up the primary URL to create a floating submenu (or xwindow or whatever). That just seems like a bit too much effort,
Most of the uses for the dropdownbutton look to be floating windows like the font color. A popupmenu is really easy.

https://www.openoffice.org/api/docs/com ... pMenu.html
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Post Reply