Hi Carsten, thank you for replying.
The SDK examples create a installable package automatically if you build
them
with make. I was not aware of this. I will try to find out.Can you please
guide me more about it.
Also ,now i understood Function1refers to a function by name Function1. But
still i am not clearas to where should i define Function1? Should i define
Function1 inside ProtocolHandleraddon.java? Since i am a newbie i am not clear
with these concepts.
Thank you
With regards,
Bharathy B
Carsten Driesner - Sun Germany - ham02 - Hamburg - Software Engineer [EMAIL
PROTECTED] wrote:
bharathy b wrote:
Hi i tried to add a Addon to Writer using ProtocolHandlerAddon.java given in
the SDK .
ProtocolHandleraddon.java found in
OpenOffice.org2.0_SDK\examples\DevelopersGuide\Components\Addons\ProtocolHandlerAddon_java
The addon creates toolbar button in openoffice writer and should display a
message box when it is clicked. I used UNOPKG to do it instead of pkgchk. The
toolbar buttons appear. but they are not activated
here are the steps i have followed ...please tell me if i have missed out
anything or gone wrong anywhere.
Hi bharathy,
First of all I don't understand why you do the build by hand. The SDK
examples create a installable package automatically if you build them
with make. If you do it by hand there are many ways to do something wrong.
1) compile the ProtocolHandlerAddon.java and get the
ProtocolHandlerAddon.class and
ProtocolHandlerAddon$ProtocolHandlerAddonImpl.class
2) write the ProtocolHandlerAddon.uno.manifest file which Contains
Code:
RegistrationClassName:ProtocolHandlerAddon \n
3) Using this command i get ProtocolHandlerAddon.uno.jar file
Code:
jar cvf ProtocolHandlerAddon.uno.jar ProtocolHandlerAddon. class
ProtocolHandlerAddon$ProtocolHandlerAddonImpl.class
ProtocolHandlerAddon.uno.manifest
4) put the manifest.xml in a folder called META-INF. the manifest.xml is as
follows
Code:
5) now zip the following files into ProtocolHandlerAddon.uno.zip
i) ProtocolHandlerAddon.uno.jar
which inturn contains
META-INF/MANIFEST.MF \n
ProtocolHandlerAddon.class
ProtocolHandlerAddon$ProtocolHandlerAddonImpl.class
ProtocolHandlerAddon.uno.manifest
ii)Addons.xcu
iii) ProtocolHandler.xcu
iv) META-INF/manifest.xml
6) exit OpenOffice(including Quickstart) and add the package using \n
unopkg add ProtocolHandlerAddon.uno.zip
Here is the ProtocolHandlerAddon.java I hav used
import com.sun.star.uno.XComponentContext;
import com.sun.star.lib.uno.helper.Factory;
import com.sun.star.lang.XSingleComponentFactory\n;
import com.sun.star.lib.uno.helper.WeakBase;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.registry.XRegistryKey;
import com.sun.star.lang.XInitialization;
import com.sun.star.lang.XTypeProvider\n;
import com.sun.star.lang.XServiceInfo;
import com.sun.star.uno.Type;
import com.sun.star.frame.XStatusListener;
import com.sun.star.frame.XDispatchProvider;
import com.sun.star.frame.XDispatch;
import \ncom.sun.star.frame.XModel;
import com.sun.star.frame.XFrame;
import com.sun.star.frame.DispatchDescriptor;
import com.sun.star.awt.XToolkit;
import com.sun.star.awt.XWindowPeer;
import com.sun.star.awt.XMessageBox\n;
import com.sun.star.awt.WindowAttribute;
import com.sun.star.awt.WindowClass;
import com.sun.star.awt.WindowDescriptor;
import com.sun.star.awt.Rectangle;
public class ProtocolHandlerAddon {
\npublic static class ProtocolHandlerAddonImpl extends WeakBase implements
XDispatchProvider,
XDispatch,
XInitialization,
XServiceInfo {
static private final String[] m_serviceNames \u003d {
com.sun.star.frame.ProtocolHand,1] );
//--n/vnd.sun.star.uno-component;type=Java manifest:full-path=
ProtocolHandlerAddon.uno.jar/
5) now zip the following files into ProtocolHandlerAddon.uno.zip
i) ProtocolHandlerAddon.uno.jar
which inturn contains
META-INF/MANIFEST.MF
ProtocolHandlerAddon.class
ProtocolHandlerAddon$ProtocolHandlerAddonImpl.class
ProtocolHandlerAddon.uno.manifest
ii)Addons.xcu
iii) ProtocolHandler.xcu
iv) META-INF/manifest.xml
6) exit OpenOffice(including Quickstart) and add the package using
unopkg add ProtocolHandlerAddon.uno.zip
Here is the ProtocolHandlerAddon.java I hav used
import com.sun.star.uno.XComponentContext;
import com.sun.star.lib.uno.helper.Factory;
import com.sun.star.lang.XSingleComponentFactory ;
import com.sun.star.lib.uno.helper.WeakBase;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.registry.XRegistryKey;
import com.sun.star.lang.XInitialization;
import com.sun.star.lang.XTypeProvider ;
import com.sun.star.lang.XServiceInfo;
import com.sun.star.uno.Type;
import com.sun.star.frame.XStatusListener;
import com.sun.star.frame.XDispatchProvider;
import com.sun.star.frame.XDispatch;
import com.sun.star.frame.XModel;
import