Hi, i still cant make it work with the jobs or protocol handler, but for now i dont care, i'm trying to make the api of the extension i want, using client application, and then i change. Know i got another doubt: how does i add a action for the entry to the context menu i added? That is, when the user click in the menu item from the context menu, and that menu item is one of those i added, how can i create a action to process what i want? I see that it is related with the commandURL property of the menu entry, but i cannot understand how it works in practise.
Best regards, Joel Filipe Antunes Cordeiro [EMAIL PROTECTED] [EMAIL PROTECTED] On Fri, Sep 19, 2008 at 6:07 PM, Juergen Schmidt <[EMAIL PROTECTED]>wrote: > Joel Cordeiro wrote: > >> Hi, >> >> really thank you for the explanation. But for now, i wouldnt like to care >> with the those bugs you explain ( but those tricks are really helpfull in >> the future, thanks ). So lets forget those tricks for now, and get some >> concentration just to make something working. >> >> I have some questions, hope you will not considered they us much naive: >> >> - To add a context menu interceptor, since this topic is an Addon section >> on the developers guide, i guess it could be done by creating a project >> open >> office addon on netbeans. But when we do it, it obligates us to choose >> between a menu ou toolbar addon, and what i would like to do is a context >> menu. How is suppose we should do it? >> > no the NB addon project wizard is a wizard for a ProtocolHandler addon. > You have to implement a jobs addon. I know that is a little bit confusing > and i don't like the term jobs addon. But it is as it is. > See the addon term more as description for an extensions that typically > integrates in the user interface in some way. The NB wizard helps to speed > up the intila steps for simple menus and or toolbars. If you want more > complex toolbars you can modify the initial Addons.xcu file later on. > > You have to choose the UNO component project wizard and select the service > com.sun.star.task.Job. The wizard generates an appropriate skeleton project > for you. > > >> - On the developers guide, they talk about a xml describing the menus for >> the menu and the toolbar, but nothing about the context menu. Doesnt we >> need >> that too? (i see somehting in the link of an email you replied) >> > no not yet. In general i would agree that all kind of menus should be > described in the same way. But all this features grew over time and the xcu > files are one way to extend or create menus via an extension. It is > currently not implemented to define or merge context menus this way. > > See the related SDK example how you can intercept and extend a context > menu. Combine it with your job implementation. > > >> - i already tried the client application of the book, but it does not >> work, >> because it hasnt a main method. What should the main method do? >> Instantiate >> the class that implements the context menu interceptor? I havent >> understood >> how to make the connection between the extension and the interceptor >> class. >> > see the job example from SDK to learn how you can retrieve the frame etc. > from the arguments of the XJob.execute method. > > Probably that helps to move forward to combine both examples .... > > Otherwise feel free to come back with more questions. > > Juergen > > > > >> Hope this are normal questions. I already read the developers guide, at >> least the main topics to do that, but dont understand how to put it all >> together. >> >> Thank you a lot, >> >> Joel Filipe Antunes Cordeiro >> [EMAIL PROTECTED] >> [EMAIL PROTECTED] >> >> >> On Wed, Sep 17, 2008 at 7:25 PM, Ariel Constenla-Haile < >> [EMAIL PROTECTED]> wrote: >> >> Hi Joel, >>> >>> Joel Cordeiro escribió: >>> >>> Thank you for the aknowledge. >>>> >>>> As i know, i dont need to write a Uno Component, since my extension just >>>> adds some entries to the context menu, and make some access to the >>>> OpenThesaurus service. >>>> >>>> that's why you *need* a Uno component implementing a css.task.Job >>> [sorry >>> if I was rather cryptic in my previous mail] >>> >>> (specification: >>> http://api.openoffice.org/docs/common/ref/com/sun/star/task/Job.html >>> documentation: >>> >>> >>> http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/Jobs/Implementation >>> ) >>> >>> If you don't need an extension, let's say you want it for yourself, in >>> your own and only PC, you may achieve this even with OOo Basic adding a >>> macro with the menu "Tools" - "Customize" - "Events". >>> >>> But if you want an extension, you must use a language which is able to >>> implement Uno components (C++/Java/Python). >>> >>> Why? >>> >>> You know that in order to add menu entries in a context menu, you need >>> to register a css.ui.XContextMenuInterceptor at the >>> css.frame.Controller's css.ui.XContextMenuInterception. >>> Besides, I guess you want to add this menu entries to *every* OOo Writer >>> document, and in every "context" where it makes sense to add these >>> entries (I mean, you don't want to add some entry bringing some >>> thesaurus feature when the user right-clicks a picture, or a form >>> control in design view) >>> >>> So you need first a way to access the Controller of every Writer >>> document, every time the user creates a new document, or opens an >>> existing one. >>> >>> How can your extension know when a new document is created, or an >>> existing one is loaded? >>> By registering a Job that will be executed upon this events: >>> >>> * OnNew = a new documented is created >>> * OnLoad = a documented is loaded >>> >>> This is clear by the Job definition: >>> >>> "A job in OpenOffice.org is a UNO component that can be executed by the >>> job execution environment upon an event." >>> >>> this means that every time a doc. is created, or loaded, the application >>> framework will invoke your UNO component's execute() >>> [ >>> >>> http://api.openoffice.org/docs/common/ref/com/sun/star/task/XJob.html#execute >>> ] >>> method. >>> >>> In the case your Job is registered for the OnLoad / OnNew events, when >>> the components's execute() methods is invoked you will get a reference >>> to the document's model, and from this you can start working: access the >>> Controller from the model with css.frame.XModel.getCurrentController() . >>> >>> But as the controller can be disposed, or the same model can have >>> several controllers for different views, you need to do some extra work, >>> as explained on my previous mail; if not, your context menu interceptor >>> won't work in every context you'd really want it to; and your user may >>> find very annoying that your extensions sometimes works but other times >>> not. >>> >>> >>> So my problem is just deploying it and make it >>> >>>> working as an extension for the extension manager of Open Office. >>>> >>>> >>> you can try the NetBeans IDE plug-in; it's both user-friendly (that is, >>> with easy-to-use wizards) and very complete; it can ease your work a >>> lot, if you first study how to use it. >>> I suggest you to try with the option "Debug Extension in Target >>> openOffice.org", and set breakpoint in your code. >>> >>> You can try first by creating a client application with the SDK context >>> menu interceptor example. >>> >>> >>> >>> Regards >>> Ariel. >>> >>> >>> -- >>> Ariel Constenla-Haile >>> La Plata, Argentina >>> >>> [EMAIL PROTECTED] >>> http://www.ArielConstenlaHaile.com.ar/ooo/ >>> >>> >>> >>> "Aus der Kriegsschule des Lebens >>> - Was mich nicht umbringt, >>> macht mich härter." >>> Nietzsche Götzendämmerung, Sprüche und Pfeile, 8. >>> >>> >>> >>> >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>> For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >>> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
