Accelerator for toggle button in toolbar

Discussions about using 3rd party extension with OpenOffice.org
Post Reply
jmarch
Posts: 6
Joined: Mon Dec 24, 2018 12:36 am

Accelerator for toggle button in toolbar

Post by jmarch »

I'm writing an extension where I want to have an accelerator for a toggle button in a toolbar. I'd like the accelerator to toggle the state of the button just as control-B does for the bold toolbar button.

My toolbar button looks like this:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="Addons" oor:package="org.openoffice.Office">
  <node oor:name="AddonUI">
    <node oor:name="OfficeToolBar">
      <node oor:name="com.philolog.hoplitekb.toolbar" oor:op="replace">
        <node oor:name="com.philolog.hoplitekb.button1" oor:op="replace">
          <prop oor:name="URL" oor:type="xs:string">
            <value>com.philolog.hoplitekb:open</value>
          </prop>
          <prop oor:name="ControlType">
					  <value>ToggleButton</value>
				  </prop>
          <prop oor:name="Title" oor:type="xs:string">
            <value xml:lang="en-US">Toggle Hoplite Keyboard</value>
          </prop>
          <prop oor:name="Target" oor:type="xs:string">
            <value>_self</value>
          </prop>
          <prop oor:name="Context" oor:type="xs:string">
            <value>com.sun.star.text.TextDocument</value>
          </prop>
        </node>
      </node>
    </node>...
But I'm not sure what to put in the Accelerators.xcu file to trigger it:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<oor:component-data xmlns:oor="http://openoffice.org/2001/registry"
  xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="Accelerators"
  oor:package="org.openoffice.Office">
  <node oor:name="PrimaryKeys">
    <node oor:name="Modules">
      <node oor:name="com.sun.star.text.TextDocument">
        <node oor:name="0_MOD1" oor:op="replace">
          <prop oor:name="Command">
            <value xml:lang="en-US">???????????</value>
          </prop>
        </node>
      </node>
    </node>
  </node>
</oor:component-data>
Thanks in advance for any help on this!
LibreOffice 7.3 on Mac Monterey
JeJe
Volunteer
Posts: 2785
Joined: Wed Mar 09, 2016 2:40 pm

Re: Accelerator for toggle button in toolbar

Post by JeJe »

You want a command that just toggles the state of the button? You may need to write your own macro/code to do that and call it with the url for the macro.

I doubt that Ctrl+B directly changes the state of the button. The state of the bold toolbar button also changes when you move the cursor onto or off bold text.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Post Reply