Tobias Krais wrote:
Hi Carsten,

Second solution: I can extend the CommandURL:
-----%<-----
menuItemProperties[0] = new PropertyValue();
menuItemProperties[0].Name = "CommandURL";
menuItemProperties[0].Value = ".Judas:PrintTrays?Printer:string=LJ1100";
-----%<-----
Is this correct? But how can I access the values?
This is the way to go for your scenario.

Your protocol handler implements the XDispatch interface. The
OpenOffice.org menu uses this interface to call your implementation.

dispatch( const com::sun::star::util::URL aURL, Sequence<
beans::PropertyValue > aArgs )

As you can see the dispatch function has two arguments (aURL and aArgs).
The arguments inside your command URL are part of aURL. It's a structure
containing several members which describe parts of the URL. Your
arguments can be found inside aURL.Arguments. You have to parse the
string. For more information see the description of
com.sun.star.util.URL IDL file.

This sounds very interesting. I read the api and the part of the
Dev-Guide. But it does not work yet.
My CommandURL is this: ".Judas:PrintTrays". I want to add the parameter
"printer" with the value "test". Thus I use
".Judas:PrintTrays?printer=test" as my CommandURL. But using this
CommandURL, my newly created menu item is disabled.

Is the CommandURL with parameter correct? Is my implementation of my
component wrong? Here a small part of my component:
-----%<-----
public class JudasProtocolHandler extends WeakBase implements
                XServiceInfo,
                XDispatchProvider,
                XInitialization {

    /**
     * Dispatch object as inner class.
     */
    class OwnDispatch implements XDispatch {
-----%<-----
Where can I continue to search the failure?
Hi Tobias,

You have to check your queryDispatch/dispatch implementation. The framework code just asks your ProtocolHandler to handle the URL, so your code is responsible to parse the URL for optional arguments. It looks like that your implementation cannot handle the additional arguments.

Regards,
Carsten

--
Carsten Driesner (cd) - Project Lead OpenOffice.org Framework
Framework wiki: http://wiki.services.openoffice.org/wiki/Framework
OpenOffice.org Engineering at Sun: http://blogs.sun.com/GullFOSS

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to