Hi Антон, On Wed, Mar 06, 2013 at 01:06:09AM +0400, Антон Борисов wrote: > It is possible to make openoffice react on addon's toolbar button press > action like standard add shape button (cursor icon changes and while moving > mouse after mouse click on draw page appeared shape, which resizing > according mouse movement) ?
I'm not sure I understand the question; you have some toolbar items added by your extension, when the user presses these toolbar items you want to do some stuff, like changing the mouse pointer, tracking mouse movement, etc. Did I get it right? If yes, I'm afraid you can't do that. In a css::awt::XWindow created by yourself, you can change the mouse pointer and add listeners/handlers to get information about mouse events (css::awt::XMouseClickHandler/XMouseListener/XMouseMotionHandler/XMouseMotionListener); in the case of an AOO application, you have access to the component's XWindow via the frame (css::frame::XFrame::getComponentWindow()), but you can't do much with that XWindow, all events are consumed by the application, you can add listeners but they will never get notified. > Or all can i do is dispatching standard commandi yes, you are limited to dispatch the command associated to your toolbar item. Don't know what you are trying to achieve, but you can insert a shape with your dispatch; of course, you will miss the user interaction, size and position must be determined by your code prior to inserting the shape. > and handling modifed action of drawpage , you get notified of every modification on the document by adding a css::util::XModifyListener; the draw/impress model also broadcasts some events that might be interesting for extension developers [1], but the model does not broadcast them to client code). [1] http://opengrok.adfinis-sygroup.org/source/xref/aoo-trunk/main/svx/source/unodraw/unomod.cxx#133 PageOrderModified ShapeModified ShapeInserted ShapeRemoved > deleting added shape and do what i need having deleted shape > properties? AFAIK one way to know if a shape was inserted is tracking the number of shapes on every page, and when the document is modified, check if the number has changed. An alternative way of knowing when a shape is removed is adding an event listener to every shape, because shapes are components, and as such get disposed, and notify this (I didn't try that myself, so it's just theory). Broadcasting the events I quoted above would be very useful in this case: you will get notified that a shape was inserted or removed, and the event source will be that shape. Regards -- Ariel Constenla-Haile La Plata, Argentina
pgpe_Cjb4PqPi.pgp
Description: PGP signature