How to target calc/writer/impress with a Python LibreOffice Extension

Maybe this has been answered elsewhere, but I created a libreoffice writer extension, and I want to extend it so that the same menu appears in calc, but I can’t find any “writer” or “calc” strings in any libreoffice extensions that seem to obviously establish which Libreoffice programs they target.

Here is my extension’s source, in case its helpful.

remove:

        <prop oor:name="Context" oor:type="xs:string">
          <value>com.sun.star.text.TextDocument</value>
        </prop>

out of »addon.xcu«

1 Like

Thanks so much for your help, it’s a step in the right direction. OK so I’m able to change the menu for either a single one (writer/impress/calc) or all of them together. What if I want to target a subset of them, with every strategy I’ve tried for adding

          <value>com.sun.star.sheet.SpreadsheetDocument</value>

It ends up only showing in either calc or writer based on the order of the above vs the line you originally told me to remove. (I don’t want it to show up in draw, impress, and math).

also I’m curious how to make the same hotkeys also work with calc:
nvm this part, seems like hotkeys do in fact work in calc

<?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" xmlns:install="http://openoffice.org/2004/installation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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="Q_MOD1" oor:op="replace">
            <prop oor:name="Command">
						<value xml:lang="en-US">service:org.extension.sample.do?ExtendSelection</value>
				</prop>
        </node>

        <node oor:name="E_MOD1" oor:op="replace">
            <prop oor:name="Command">
						<value xml:lang="en-US">service:org.extension.sample.do?EditSelection</value>
				</prop>
        </node>
		
      </node>
    </node>
  </node>

</oor:component-data>