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
pgpdjs8tutKDp.pgp
Description: PGP signature