Madhan Ponnusamy wrote:
Hi Carsten,
Thank u...i had already searched in the code snippetbase but i cannot find
the solution. any way now i got a doubt in macros. I had created menus
programtically and i tried to link the menus to macros by the code
PropertyValue[] oMenuItem = CreateMenuItem(
"macro:///WebWizard.Language.LoadLanguage()", "HelloWorld");
where i created CreateMenuItem function as
public static PropertyValue[] CreateMenuItem(String command, String
label) {
PropertyValue[] aMenuItem = new PropertyValue[] { new
PropertyValue(),
new PropertyValue(), new PropertyValue() };
aMenuItem[0].Name = "CommandURL";
aMenuItem[0].Value = command;
aMenuItem[1].Name = "Label";
aMenuItem[1].Value = label;
aMenuItem[2].Name = "Type";
aMenuItem[2].Value = new Integer(ItemType.DEFAULT);
return aMenuItem;
}
this code worked.............but if i change the code as
PropertyValue[] oMenuItem = CreateMenuItem(
"macro:///HelloWorld.HelloWorld.printHw", "HelloWorld");
it is not working.where "HelloWorld.HelloWorld.printHW" is java macro below
OpenOffice.org Macors and
"WebWizard.Language.LoadLanguage" is a macro under My Macro's (seen it in
tools->macros->runmacros). what to do now??how to access the java macros
inside OpenOffice.org Macros...
Hi Madhan,
You can only use "macro:" URLs for OpenOffice.org Basic macros. There is
a new protocol schema called "script:" where you can call macros
implemented by languages supported by the scripting framework (see ).
Java is not supported by the scripting framework. Therefore you have to
implement a protocol handler as I already wrote you. A protocol handler
defines a new private protocol for its commands. The OpenOffice.org
framework calls your protocol handler whenever it finds commands with
your private protocol. E.g. the command URL
"org.openoffice.Office.MyComponent:function1" would activate the
protocol handler with the registered protocol
"org.openoffice.Office.MyComponent".
Juergen Schmidt gave you some hints where you can find sample code:
"you should take a look on ProtocolHandler add-ons. See for example the
<sdk>/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java
and i suggest the appropriate DevGuide chapter
http://api.openoffice.org/docs/DevelopersGuide/Components/Components.xhtml#1_7_Integrating_Components_into_OpenOffice.org
A small ProtocollHandler object can trigger different Java classes for
different commands (simplified -> protocol+commands = menu|toolbar items).
You can package your ProtocolHandler + xcu files + your Java classes in
one extension package and can deploy it easily."
Regards,
Carsten
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]