Hi Oliver,
Thank you for you help: I have succeeded in my goal, which was to make it 
possible to open, using an accelerator, the main window of an extension right 
after installation of the extension.
Basically, I had to provoke the instantiation of the extension, using your 
second recommendation, i.e. XJob + custom service + Jobs.xcu. In the execute 
function of the XJob interface, I installed the desired accelerator into the 
global accelerator configuration.
Your first recommendation, i.e. XJobExecutor + Accelerators.xcu was ineffective 
for the command attached to opening that main dialog window. I don't know why, 
since the protocol handler was instantiated! I ended up removing the 
XJobExecutor interface, its method, and the Accelerators.xcu file.
Lessons learned: the instantiation at startup is necessary, and the 
programmatic accelerator configuration is also necessary.
Thanks.

      De : Oliver Brinzing <oliver.brinz...@gmx.de>
 À : api@openoffice.apache.org 
 Envoyé le : Mercredi 24 juin 2015 20h29
 Objet : Re: Registration of an accelerator at extension installation
   
Hi Amenel,

you can use an Accelerators.xcu file in you extension, for example:

[...]
    <node oor:name="LEFT_MOD1_MOD2" oor:op="replace">
        <prop oor:name="Command">
            <value 
xml:lang="en-US">service:my.extension.Service?myParam1</value>
        </prop>
    </node>

and register it during extension installation, for example add

<manifest:file-entry manifest:full-path="Accelerators.xcu"
                                
manifest:media-type="application/vnd.sun.star.configuration-data" />

to the manifest.xml of your extension.
your service has to implement the "com.sun.star.task.XJobExecutor" Interface 
with the
trigger(string  Event ) method.

if you want your extension being instantiated during aoo startup, implement the
"com.sun.star.task.XJob Interface" with it's execute(NamedValue[] args) method.

add a Jobs.xcu, for example:

https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/Jobs/Configuration

<?xml version='1.0' encoding='UTF-8'?>
<oor:component-data oor:name="Jobs" oor:package="org.openoffice.Office" 
xmlns:oor="http://openoffice.org/2001/registry"; 
xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
    <node oor:name="Jobs">
        <node oor:name="my.extension.Service" oor:op="replace">
            <prop oor:name="Service" oor:type="xs:string">
                <value>my.extension.Service</value>
            </prop>
        </node>
    </node>
<!-- 
https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/Jobs/List_of_Supported_Events
 -->
    <node oor:name="Events">
        <node oor:name="onFirstVisibleTask" oor:op="modify">
            <node oor:name="JobList">
                <node oor:name="my.extension.Service" oor:op="replace"/>
            </node>
        </node>
    </node>
</oor:component-data>

and register in "manifest.xml"
<manifest:file-entry manifest:full-path="Jobs.xcu" 
manifest:media-type="application/vnd.sun.star.configuration-data" />

Regards
Oliver





---------------------------------------------------------------------
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



  

Reply via email to