incubator-ooo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fabian <...@netempire.de>
Subject Re: [EXT] image double click
Date Tue, 07 Feb 2012 17:57:10 GMT
Hi Ariel,

thx for telling me about the dispatchProviderInterceptors. I read through the DevGuide and
some examples and implmented the interceptor and a Xjob. Unfortunately so far
I wasn't able to trigger my Job and the provided examples didn't help. 

Following I wrote down what I did. 
Thx for your help so far, I understand if you can't spare the time going through it

I startet out with my netbeans project (generate by the OOo-integration) which contains, the
CentralRegistration.class and my generated starter dispatch class 
called addonStarter.class which handles all my Dispatches and is referenced as protocollhandler
in the protocolhandler.xcu. 

I created: 
- a Interceptor class implementing XDispatchProviderInterceptor and XDispatch.
- a job class implementing com.sun.star.task.XJob and implements the execute method which
shall trigger my interceptor.

I wrote a configuration for my XJob (Jobs.xcu) and saved it along with addons.xcu and my protocollHandler.xcu
---------------------------------------
<node oor:name="Jobs">
      <node oor:name="Job _1" oor:op="replace">
          <prop oor:name="Service">
              <value>myaddon.test.InterceptorJob</value>
          </prop>
          <node oor:name="Arguments">
              <prop oor:name="arg_1" oor:type="xs:string" oor:op="replace">
                  <value>val_1</value>
              </prop>
          </node>
      </node>
  </node>
 <node oor:name="Events">
    <node oor:name="onFirstVisibleTask" oor:op="fuse">
        <node oor:name="JobList">
            <node oor:name="Job_1" oor:op="replace">
            </node>
        </node>
    </node>
	</node>
</oor:component-data>
---------------------------------------

Then I added my jobs.xcu to my uno-extension-manifest.xml with:

---------------------------------------
<manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
                      manifest:full-path="registry/data/org/openoffice/Office/ProtocolHandler.xcu"/>
---------------------------------------

This is were I stumble and my Job class wasn't triggered so far. I know that my job shall
be registered by __getServiceFactory and __writeRegistryServiceInfo by
the set implementatiton name: "myaddon.test.InterceptorJob", but I couldn't figure out what
is necessary that those methods are called by openoffice.

I've seen examples where the XJob implementation is set in the jar manifest as "RegistrationClassName"
and I guess therefor its __getServiceFactory is called. In my generated manifest my addonStarter
class is set as RegistrationClass.

Can you tell me about anything obvious I'm missing to fully register my job class?

Thank you!

regards,
Fabian





On Feb 6, 2012, at 2:19 PM, Ariel Constenla-Haile wrote:

> Hi Fabian,
> 
> On Mon, Feb 06, 2012 at 11:58:33AM +0100, fabian wrote:
>> Hi,
>> 
>> I am trying to find out if one can override the event when
>> double-clicking on an embedded image within a writer document.  For my
>> extension I would like to embed an image and when double-clicking it
>> I would like to trigger my own action instead of the default "image
>> dialog" which pops up. 
> 
> not that this dialog is shown not only on double-clicking an image:
> 
> - if the image is selected, the "Insert" - "Picture" - "From file..."
>  menu item does not insert a picture but shows the picture properties
>  dialog
> - the same happens with the icon in the "Picture" toolbar
> - if the image is selected, the context menu has a "Picture..." item
>  that triggers the Picture dialog
> - that dialog can be executed using the keyboard instead of the mouse
> - ...
> 
> 
>> 
>> I tried to use com.sun.star.document.XEventListener and
>> com.sun.star.view.XSelectionChangeListener to catch the click event.
>> But so far without success.
>> 
>> Is catching this event even possible via the api?
> 
> IMO it would work better to intercept the commands, with an
> XDispatchProviderInterceptor:
> http://www.openoffice.org/api/docs/common/ref/com/sun/star/frame/XDispatchProviderInterceptor.html
> Just intercept 
> - ".uno:GraphicDialog"
> - ".uno:InsertGraphic"
> and when an image is selected, return your dispatch object in
> queryDispatch().
> 
> This adds an extra level of complexity to your extension, you will have
> to implement an css.task.Job to register your dispatch interceptor.
> http://www.openoffice.org/api/docs/common/ref/com/sun/star/task/Job.html
> http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/Jobs/Implementation
> 
> IIRC there are examples in the SDK.
> 
> 
> Regards
> -- 
> Ariel Constenla-Haile
> La Plata, Argentina


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message