Hi again, The problem is that i'm out of time. I'm working on a project, and the time is getting out, and i can't solve the problems. I have already read what's important on dev's guide, but it didn't helped me. Follow i write my doubts that i try to find over the internet and the dev's guide, and i couldn't find a answer about how to do that (if it is in the dev's guide, please tell me where):
1. If i'm using a job, i should register the interceptor class that implements XContextMenuInterceptor, on the execute method, right? 2. How does i do that? The book doesn't explain that, they give a little example using a client application. 3. I have to write a protocol handler to create a action when a user click one of my new entries on the context. I have a class that implement XDisptachProvider and XDispatch, and the method queryDispatch returns itself. The method dispatch have to parameters, url and property value. With that, how can i know the name of the menu entry the user selected? Thanks again for the attention, Joel Filipe Antunes Cordeiro [EMAIL PROTECTED] [EMAIL PROTECTED] On Sat, Oct 4, 2008 at 5:30 AM, Ariel Constenla-Haile < [EMAIL PROTECTED]> wrote: > Hi Joel, > > What you're trying to do is something complex: if there was an example > for adding a context menu entry via an extension, and we should set a > level of knowledge required to understand it, I'd set the level to > DIFFICULT/COMPLEX and the like; so you will have to be patient and study > gradually. > > I'd summarize the requirements as follow: > > * knowledge about how a context menu interceptor works (this includes > handling the document selection) > * knowledge about ProtocolHandler implementation > * knowledge about Job implementation > * obviously a general knowledge about how extension work in OOo > (configuration files, etc.) > > So said that... > > Joel Cordeiro escribió: > >> Hi, >> >> i still cant make it work with the jobs or protocol handler, but for now i >> dont care, >> > > sorry, but you *have* to care, because... > > 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 >> > > > you need a ProtocolHandler for that. > I quote myself in > http://www.openoffice.org/servlets/ReadMsg?list=dev&msgNo=21148 > > > My question is: How do I implement a context menu item and stick my >>> own callback to it so that the item is still visible. >>> >> >> For this, you have to implement a ProtocolHandler. The Dev's Guide >> explains how to do this. >> >> Some quotes about what a protocol handler is: >> >> "The dispatch framework binds user interface controls, such as menu or >> toolbar items, to the functionality of OpenOffice.org. >> Every function that is reachable in the user interface is described by a >> command URL and corresponding parameters. >> The protocol handler mechanism is an API that enables programmers to >> add arbitrary URL schemas to the existing set of command URLs >> by writing additional protocol handlers for them. >> Such a protocol handler must be implemented as a UNO component and >> registered in the OpenOffice.org configuration for the new URL schema." >> >> This means, you need a UNO component implementing a protocol handler, >> registered at OOo config. using a file ProtocolHandler.xcu, >> for example: >> >> <?xml version='1.0' encoding='UTF-8'?> >> <oor:component-data >> oor:package="org.openoffice.Office" >> oor:name="ProtocolHandler" >> xmlns:oor="http://openoffice.org/2001/registry" >> xmlns:xs="http://www.w3.org/2001/XMLSchema" >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> >> >> <node oor:name="HandlerSet"> >> <node >> oor:name="ar.com.arielconstenlahaile.openoffice.menuinterceptor.ProtocolHandlerImpl" >> >> oor:op="replace"> >> <prop oor:name="Protocols" oor:type="oor:string-list"> >> <value>ar.com.arielconstenlahaile.openoffice.Menuinterceptor:*</value> >> </prop> >> </node> >> </node> >> </oor:component-data> >> >> >> In this example: >> ar.com.arielconstenlahaile.openoffice.menuinterceptor.ProtocolHandlerImpl >> is the name of the Java class with the implementation of the >> ProtocolHandler (in Java the implementation name is/can be the same as >> the class name). The JAR must be indicated with an entry in the manifest >> of the extension. >> >> ar.com.arielconstenlahaile.openoffice.Menuinterceptor:* >> is the URL schema I've chosen. I use a place holder "*" so I use the >> same schema in every menu item, for example: >> >> "ar.com.arielconstenlahaile.openoffice.Menuinterceptor:openCalcDoc" >> "ar.com.arielconstenlahaile.openoffice.Menuinterceptor:openWriterDoc" >> >> As my URL schema is registered in OOo configuration registry, if I use >> this CommandURLs for my new items, they are enabled, and when the user >> chooses the menu item, the Dispatch Framework will process this request >> and look in the chain of responsability for a component willing to handle >> it: my ProtocolHandler implementation will be asked to dispatch it. >> > > > > Besides, if you want your menu item to have an image, you will have to > bind an image to the command URL in the configuration file named > Addons.xcu. > > Study a version of the SDK example at > http://www.ArielConstenlaHaile.com.ar/ooo/temp/ProtocolHandlerAddon.zip > > Pay attention to: > > * ProtocolHandler.xcu > * Addons.xcu, in particular the "Images" node > * ProtocolHandlerAddonImpl.java, in particular the > com.sun.star.frame.XDispatchProvider and com.sun.star.frame.XDispatch > implementation (in com.sun.star.frame.XDispatch.dispatch() is where you > "dispatch" the URL [answer to "how can i create a action to process what > i want?"]). > > > 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] > >
