incubator-ooo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ariel Constenla-Haile <arie...@apache.org>
Subject Re: [EXT] image double click
Date Thu, 16 Feb 2012 02:43:18 GMT

Hi Fabian,

On Wed, Feb 15, 2012 at 10:42:26AM +0100, fabian wrote:
> Hi Ariel,
> 
> thx, good to know! 
> 
> I just got back to the Dispatchinterceptor since I had to resolve
> other issues first.  As you mentioned I intercepted the events for:
> ".uno:GraphicDialog" and ".uno:InsertGraphic".
> 
> Now I want to only intercept the event if an image of interest was
> double-clicked. Am I right that neither the call of querydipatch nor
> the actual dispatch call (within my interceptor) gives me the source
> of the event, so what image was doublecklicked? 

you are right

> I guess when query dispatch is called I have to check if one of the
> two uno commands above was triggered and get the selected image (using
> xSelectionSupplier) to check if the image is of interest to me, then
> I return my own dispatcher. Otherwise I return the slave
> dispatchPprovider.
> 
> Is that a proper way to do it?

no, because this won't work in every case. For example, the menu item
Insert - Picture - From File... In the case you don't have
the accessibility feature enabled, menu items in the menu bar only query
for a dispatch object when the popup menu they belong to gets activated.

Let's suppose the following scenario:

- you open a Writer document
- your interceptor registers itself at the XFrame
- Go to Insert - Picture - From File...
- your interceptor gets queried for .uno:InsertGraphic 
- because no image is selected, you return the slave dispatcher's
  dispatch
- this way, the Insert Picture dialog shows up, you select an image, and
  insert it. The inserted image remains selected after inserting it
- Go again to Insert - Picture - From file...
- Problem: the menu implementation caches dispatch objects, so it won't
  query your interceptor again, instead it has the dispatch object
  provided by your slave: the image is selected, so this menu item will
  end up showing the Picture Properties dialog you want to avoid.

IMO the solution here is to return always your dispatch object when the
interceptor gets queried for .uno:GraphicDialog and .uno:InsertDialog,
and add  to dispatch() all the logic that decides whether to dispatch 
your custom implementation or AOO's one.

In queryDispatch() it may be useful to store also the AOO dispatch, for
later user in dispatch() in case you want to use AOO implementation (the
Insert Picture dialog, or the Picture Properties dialog).

Resuming:

- in queryDispatch(): if the URL represents one of the commands: store
  the dispatch object returned by your slave, return your own dispatch
  object

- in dispatch(): 
  - if the command is .uno:InsertGrapic, check if an image is selected,
    and if that image is of your interest. If so, tell your dispatch to
    dispatch the request; if not, tell your slave's dispatch
  - if the command is .uno:GraphicDialog, then you can be sure an image
    is selected. If you want to intercept every image, dispatch the
    request with your dispatch object. If you are interested in some
    images only, proceed as above.


That's all I can imagine right now. Hope that helps.


Regards
-- 
Ariel Constenla-Haile
La Plata, Argentina

Mime
View raw message