<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.openoffice.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Exactt</id>
	<title>Apache OpenOffice Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.openoffice.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Exactt"/>
	<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/wiki/Special:Contributions/Exactt"/>
	<updated>2026-09-21T01:06:40Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.14</generator>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Extensions_trouble_shooting&amp;diff=75359</id>
		<title>Extensions trouble shooting</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Extensions_trouble_shooting&amp;diff=75359"/>
		<updated>2008-04-30T14:12:48Z</updated>

		<summary type="html">&lt;p&gt;Exactt: added work-arounds as mentioned in http://www.oooforum.org/forum/viewtopic.phtml?t=42403&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Extensions}}&lt;br /&gt;
[[Category:Extensions]]&lt;br /&gt;
&lt;br /&gt;
Collection of pitfalls and solutions regarding the extension development&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;span id=&amp;quot;java_loader&amp;quot;&amp;gt;Could not create Java implementation loader&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;When installing an extension containing a java service, then a message box may appear reading &amp;quot;Could not create Java implementation loader&amp;quot;. This usually happens when one wants to debug Java in the office process and therefore has provided the debug options for Java in the options dialog. The Java service of the extension will be registered in a separate process (uno.exe) which also needs to start Java. This Java uses the same settings from the options dialog. For example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If there is also a Java running in the office process, then the creation of the virtual machine in the second process will fail. The reason is, that the latter receives the same debug settings. It appears that two virtual machines, although in separate processes, cannot use the same port for debugging. If one changes the port number before adding the extension (and after the Java has been created in the office process), then the extension will be installed properly.&lt;br /&gt;
&lt;br /&gt;
The same effect can be seen when running &amp;quot;unopkg gui&amp;quot;. When installing the second Java component then a second uno.exe is created and the creation of the virtual machine in this process will fail.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
Possible Work-Arounds&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
If you receive this message and think it is not related to the above mentioned problem the following work-arounds might help:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
- Rename/Remove your openoffice.org user folder. (e.g. in Ubuntu it is .openoffice.org2/user in your home directory)&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
- Go into Options and uncheck Java/&amp;quot;Use a Java runtime environment.&amp;quot;&lt;br /&gt;
Restart OpenOffice and try to enable the extension again. Receive the same error.&lt;br /&gt;
Return the check to the &amp;quot;Use a Java runtime environment&amp;quot; box. &lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
[[Category:Extensions]]&lt;/div&gt;</summary>
		<author><name>Exactt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=OpenOffice_Add-On_Project_Type&amp;diff=40603</id>
		<title>OpenOffice Add-On Project Type</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=OpenOffice_Add-On_Project_Type&amp;diff=40603"/>
		<updated>2007-07-27T16:06:41Z</updated>

		<summary type="html">&lt;p&gt;Exactt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Back to [[OpenOffice_NetBeans_Integration|OpenOffice.org NetBeans Integration]]&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
&lt;br /&gt;
The Add-On wizard will enable users to create an OpenOffice.org component that including support of UI extensions. The component is based on a on a J2SE class library project and supports additional targets to create and deploy the package into the office installation.&lt;br /&gt;
All interface methods are default implemented and do nothing. In a second step you can insert your implementation in the generated skeleton, rebuild the extension and deploy it again to see the effect in your office.&lt;br /&gt;
&lt;br /&gt;
= Project Wizard =&lt;br /&gt;
The project wizard  is quite simple to use, you simply choose&lt;br /&gt;
*&amp;#039;&amp;#039; &amp;#039;&amp;#039;&amp;#039;File -&amp;gt; New Project -&amp;gt; StarOffice/OpenOffice.org -&amp;gt; StarOffice/OpenOffice.org Add-On&amp;#039;&amp;#039;&amp;#039; &amp;#039;&amp;#039;&lt;br /&gt;
and follow the wizard.&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Step 1&amp;#039;&amp;#039;&amp;#039;: Select the project type&lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:AddOn1.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Step 2&amp;#039;&amp;#039;&amp;#039;: Define the project name, Add-On name, an optional package and the project location &lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:AddOn2.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
The necessary xcu files are generated and become part of the final &amp;#039;&amp;#039;&amp;#039;oxt&amp;#039;&amp;#039;&amp;#039; package. These xcu files can be easily adapted later to extend the initial project to a more complex Add-On example. The generated Add-On skeleton implements a simple [http://api.openoffice.org/docs/common/ref/com/sun/star/frame/ProtocolHandler.html com.sun.star.frame.ProtocolHandler] Add-On.&amp;lt;br&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Step 3&amp;#039;&amp;#039;&amp;#039;: Defining the new commands&lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:AddOn3-1.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
This part is missing. See also discussion.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Step 4&amp;#039;&amp;#039;&amp;#039;: Defining the new toplevel menu&lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:AddOn3.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:AddOn4.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
On this panel you can define new toplevel menus with submenus on a higher abstraction level. You will not have to deal with xcu files directly. You can modify the default menu and commands, add new menus and commands, and you can insert localized displaynames. For more detailed descriptions of the different fields simply press the help button or read the appropriate chapter in the [http://api.openoffice.org/docs/DevelopersGuide/Components/Components.xhtml#1_7_1_Protocol_Handler Developer&amp;#039;s Guide - Writing UNO components - Integrating Components into OpenOffice.org - Protocol Handler]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you add a new language you can select languages from a list of supported languages. When you delete a language, you can only delete the languages you have added.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:Calc_AddIn3a.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:Calc_AddIn3b.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Step 5&amp;#039;&amp;#039;&amp;#039;: Deploying the extension package&lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:Calc_AddIn4.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
You can simply create or deploy the &amp;#039;&amp;#039;&amp;#039;oxt&amp;#039;&amp;#039;&amp;#039; extension package by choosing:&amp;lt;br&amp;gt;&lt;br /&gt;
::&amp;#039;&amp;#039;&amp;#039;Project View -&amp;gt; Project Node -&amp;gt; Context Menu -&amp;gt; Create OXT | Deploy Office Extension&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you have deployed the package, the newly defined menus are visible in the specified context. For example, if you choose the context &amp;#039;&amp;#039;&amp;#039;Writer&amp;#039;&amp;#039;&amp;#039;, the menu is visible when you open or create a text document.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:AddOn5.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Generated Code =&lt;br /&gt;
Two (.xcu) files for the Add-On are created that describe the Add-On commands with descriptions, displaynames etc., (Addons.xcu) and the protocol that is used to access these commands (ProtocolHandler.xcu). For the example shown above, the following files are generated:&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Addons.xcu&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;xcu file defining the new menus with submenus and commands. This file can be easily extended to support toolbars as well (toolbar support will be added later to the wizard).&lt;br /&gt;
&amp;lt;code&amp;gt;[xml]&lt;br /&gt;
&amp;lt;?xml version=&amp;#039;1.0&amp;#039; encoding=&amp;#039;UTF-8&amp;#039;?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;oor:component-data xmlns:oor=&amp;quot;http://openoffice.org/2001/registry&amp;quot; xmlns:xs=&amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot; oor:name=&amp;quot;Addons&amp;quot; oor:package=&amp;quot;org.openoffice.Office&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;node oor:name=&amp;quot;AddonUI&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;node oor:name=&amp;quot;OfficeMenuBar&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;node oor:name=&amp;quot;org.openoffice.testaddon.testaddon&amp;quot; oor:op=&amp;quot;replace&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;prop oor:name=&amp;quot;Title&amp;quot; oor:type=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;value/&amp;gt;&lt;br /&gt;
          &amp;lt;value xml:lang=&amp;quot;en&amp;quot;&amp;gt;My Menu&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/prop&amp;gt;&lt;br /&gt;
        &amp;lt;prop oor:name=&amp;quot;Target&amp;quot; oor:type=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;_self&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/prop&amp;gt;&lt;br /&gt;
        &amp;lt;prop oor:name=&amp;quot;ImageIdentifier&amp;quot; oor:type=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;value/&amp;gt;&lt;br /&gt;
        &amp;lt;/prop&amp;gt;&lt;br /&gt;
        &amp;lt;node oor:name=&amp;quot;Submenu&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;node oor:name=&amp;quot;m1&amp;quot; oor:op=&amp;quot;replace&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;prop oor:name=&amp;quot;URL&amp;quot; oor:type=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;value&amp;gt;org.openoffice.testaddon.testaddon:mycommands&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;/prop&amp;gt;&lt;br /&gt;
            &amp;lt;prop oor:name=&amp;quot;ImageIdentifier&amp;quot; oor:type=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;value/&amp;gt;&lt;br /&gt;
            &amp;lt;/prop&amp;gt;&lt;br /&gt;
            &amp;lt;prop oor:name=&amp;quot;Target&amp;quot; oor:type=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;value&amp;gt;_self&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;/prop&amp;gt;&lt;br /&gt;
            &amp;lt;prop oor:name=&amp;quot;Context&amp;quot; oor:type=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;value/&amp;gt;&lt;br /&gt;
            &amp;lt;/prop&amp;gt;&lt;br /&gt;
            &amp;lt;prop oor:name=&amp;quot;Title&amp;quot; oor:type=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;value/&amp;gt;&lt;br /&gt;
              &amp;lt;value xml:lang=&amp;quot;en&amp;quot;&amp;gt;Hello World&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;/prop&amp;gt;&lt;br /&gt;
          &amp;lt;/node&amp;gt;&lt;br /&gt;
        &amp;lt;/node&amp;gt;&lt;br /&gt;
      &amp;lt;/node&amp;gt;&lt;br /&gt;
    &amp;lt;/node&amp;gt;&lt;br /&gt;
    &amp;lt;node oor:name=&amp;quot;Images&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;node oor:name=&amp;quot;org.openoffice.testaddon.testaddon.mycommands.images&amp;quot; oor:op=&amp;quot;replace&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;prop oor:name=&amp;quot;URL&amp;quot; oor:type=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;org.openoffice.testaddon.testaddon:mycommands&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/prop&amp;gt;&lt;br /&gt;
        &amp;lt;node oor:name=&amp;quot;UserDefinedImages&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;prop oor:name=&amp;quot;ImageSmallURL&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;value/&amp;gt;&lt;br /&gt;
          &amp;lt;/prop&amp;gt;&lt;br /&gt;
        &amp;lt;/node&amp;gt;&lt;br /&gt;
      &amp;lt;/node&amp;gt;&lt;br /&gt;
      &amp;lt;/node&amp;gt;&lt;br /&gt;
  &amp;lt;/node&amp;gt;&lt;br /&gt;
&amp;lt;/oor:component-data&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;ProtocolHandler.xcu&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;xcu file defining the automatically generated protocol. The protocol is generated based on the package name and Add-On name.&lt;br /&gt;
&amp;lt;code&amp;gt;[xml]&lt;br /&gt;
&amp;lt;?xml version=&amp;#039;1.0&amp;#039; encoding=&amp;#039;UTF-8&amp;#039;?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;oor:component-data oor:name=&amp;quot;ProtocolHandler&amp;quot; oor:package=&amp;quot;org.openoffice.Office&amp;quot; xmlns:oor=&amp;quot;http://openoffice.org/2001/registry&amp;quot; xmlns:xs=&amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot; xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;node oor:name=&amp;quot;HandlerSet&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;node oor:name=&amp;quot;org.openoffice.testaddon.TestAddOn&amp;quot; oor:op=&amp;quot;replace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;prop oor:name=&amp;quot;Protocols&amp;quot; oor:type=&amp;quot;oor:string-list&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;value&amp;gt;org.openoffice.testaddon.testaddon:*&amp;lt;/value&amp;gt;&lt;br /&gt;
      &amp;lt;/prop&amp;gt;&lt;br /&gt;
    &amp;lt;/node&amp;gt;&lt;br /&gt;
  &amp;lt;/node&amp;gt;&lt;br /&gt;
&amp;lt;/oor:component-data&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;uno-extension-manifest.xml&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;the package descriptor, will be packed as &amp;amp;quot;META-INF/manifest.xml&amp;amp;quot;&lt;br /&gt;
&amp;lt;code&amp;gt;[xml]&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;manifest:manifest xmlns:manifest=&amp;quot;http://openoffice.org/2001/manifest&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;manifest:file-entry manifest:media-type=&amp;quot;application/vnd.sun.star.configuration-data&amp;quot;&lt;br /&gt;
                       manifest:full-path=&amp;quot;ProtocolHandler.xcu&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;manifest:file-entry manifest:media-type=&amp;quot;application/vnd.sun.star.configuration-data&amp;quot;&lt;br /&gt;
                       manifest:full-path=&amp;quot;Addons.xcu&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;manifest:file-entry manifest:media-type=&amp;quot;application/vnd.sun.star.uno-component;type=Java&amp;quot;&lt;br /&gt;
                       manifest:full-path=&amp;quot;TestAddOn.jar&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/manifest:manifest&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;org/openoffice/testaddon/TestAddOn.java&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;the generated Add-On code skeleton where the generated class acts itself as the dispatch object (can be easily changed to support more complex Add-Ons). Most of the methods are already implemented and you simply have to add your own code in the dispatch method in the right place for each specified command.&lt;br /&gt;
&amp;lt;code&amp;gt;[java]&lt;br /&gt;
package org.openoffice.testaddon;&lt;br /&gt;
&lt;br /&gt;
import com.sun.star.uno.UnoRuntime;&lt;br /&gt;
import com.sun.star.uno.XComponentContext;&lt;br /&gt;
import com.sun.star.lib.uno.helper.Factory;&lt;br /&gt;
import com.sun.star.lang.XSingleComponentFactory;&lt;br /&gt;
import com.sun.star.registry.XRegistryKey;&lt;br /&gt;
import com.sun.star.lib.uno.helper.WeakBase;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public final class TestAddOn extends WeakBase&lt;br /&gt;
   implements com.sun.star.lang.XServiceInfo,&lt;br /&gt;
              com.sun.star.frame.XDispatchProvider,&lt;br /&gt;
              com.sun.star.lang.XInitialization,&lt;br /&gt;
              com.sun.star.frame.XDispatch&lt;br /&gt;
{&lt;br /&gt;
    private final XComponentContext m_xContext;&lt;br /&gt;
    private com.sun.star.frame.XFrame m_xFrame;&lt;br /&gt;
    private static final String m_implementationName = TestAddOn.class.getName();&lt;br /&gt;
    private static final String[] m_serviceNames = {&lt;br /&gt;
        &amp;quot;com.sun.star.frame.ProtocolHandler&amp;quot; };&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    public TestAddOn( XComponentContext context )&lt;br /&gt;
    {&lt;br /&gt;
        m_xContext = context;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    public static XSingleComponentFactory __getComponentFactory( String sImplementationName ) {&lt;br /&gt;
        XSingleComponentFactory xFactory = null;&lt;br /&gt;
&lt;br /&gt;
        if ( sImplementationName.equals( m_implementationName ) )&lt;br /&gt;
            xFactory = Factory.createComponentFactory(TestAddOn.class, m_serviceNames);&lt;br /&gt;
        return xFactory;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public static boolean __writeRegistryServiceInfo( XRegistryKey xRegistryKey ) {&lt;br /&gt;
        return Factory.writeRegistryServiceInfo(m_implementationName,&lt;br /&gt;
                                                m_serviceNames,&lt;br /&gt;
                                                xRegistryKey);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // com.sun.star.lang.XServiceInfo:&lt;br /&gt;
    public String getImplementationName() {&lt;br /&gt;
         return m_implementationName;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public boolean supportsService( String sService ) {&lt;br /&gt;
        int len = m_serviceNames.length;&lt;br /&gt;
&lt;br /&gt;
        for( int i=0; i &amp;lt; len; i++) {&lt;br /&gt;
            if (sService.equals(m_serviceNames[i]))&lt;br /&gt;
                return true;&lt;br /&gt;
        }&lt;br /&gt;
        return false;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public String[] getSupportedServiceNames() {&lt;br /&gt;
        return m_serviceNames;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // com.sun.star.frame.XDispatchProvider:&lt;br /&gt;
    public com.sun.star.frame.XDispatch queryDispatch( com.sun.star.util.URL aURL,&lt;br /&gt;
                                                       String sTargetFrameName,&lt;br /&gt;
                                                       int iSearchFlags )&lt;br /&gt;
    {&lt;br /&gt;
        if ( aURL.Protocol.compareTo(&amp;quot;org.openoffice.testaddon.testaddon:&amp;quot;) == 0 )&lt;br /&gt;
        {&lt;br /&gt;
            if ( aURL.Path.compareTo(&amp;quot;mycommands&amp;quot;) == 0 )&lt;br /&gt;
                return this;&lt;br /&gt;
        }&lt;br /&gt;
        return null;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // com.sun.star.frame.XDispatchProvider:&lt;br /&gt;
    public com.sun.star.frame.XDispatch[] queryDispatches(&lt;br /&gt;
         com.sun.star.frame.DispatchDescriptor[] seqDescriptors )&lt;br /&gt;
    {&lt;br /&gt;
        int nCount = seqDescriptors.length;&lt;br /&gt;
        com.sun.star.frame.XDispatch[] seqDispatcher =&lt;br /&gt;
            new com.sun.star.frame.XDispatch[seqDescriptors.length];&lt;br /&gt;
&lt;br /&gt;
        for( int i=0; i &amp;lt; nCount; ++i )&lt;br /&gt;
        {&lt;br /&gt;
            seqDispatcher[i] = queryDispatch(seqDescriptors[i].FeatureURL,&lt;br /&gt;
                                             seqDescriptors[i].FrameName,&lt;br /&gt;
                                             seqDescriptors[i].SearchFlags );&lt;br /&gt;
        }&lt;br /&gt;
        return seqDispatcher;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // com.sun.star.lang.XInitialization:&lt;br /&gt;
    public void initialize( Object[] object )&lt;br /&gt;
        throws com.sun.star.uno.Exception&lt;br /&gt;
    {&lt;br /&gt;
        if ( object.length &amp;gt; 0 )&lt;br /&gt;
        {&lt;br /&gt;
            m_xFrame = (com.sun.star.frame.XFrame)UnoRuntime.queryInterface(&lt;br /&gt;
                com.sun.star.frame.XFrame.class, object[0]);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // com.sun.star.frame.XDispatch:&lt;br /&gt;
     public void dispatch( com.sun.star.util.URL aURL,&lt;br /&gt;
                           com.sun.star.beans.PropertyValue[] aArguments )&lt;br /&gt;
    {&lt;br /&gt;
         if ( aURL.Protocol.compareTo(&amp;quot;org.openoffice.testaddon.testaddon:&amp;quot;) == 0 )&lt;br /&gt;
        {&lt;br /&gt;
            if ( aURL.Path.compareTo(&amp;quot;mycommands&amp;quot;) == 0 )&lt;br /&gt;
            {&lt;br /&gt;
                // add your own code here&lt;br /&gt;
                return;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public void addStatusListener( com.sun.star.frame.XStatusListener xControl,&lt;br /&gt;
                                    com.sun.star.util.URL aURL )&lt;br /&gt;
    {&lt;br /&gt;
        // add your own code here&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public void removeStatusListener( com.sun.star.frame.XStatusListener xControl,&lt;br /&gt;
                                       com.sun.star.util.URL aURL )&lt;br /&gt;
    {&lt;br /&gt;
        // add your own code here&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Add-Ons]]&lt;br /&gt;
[[Category:API]]&lt;/div&gt;</summary>
		<author><name>Exactt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=OpenOffice_Add-On_Project_Type&amp;diff=40602</id>
		<title>OpenOffice Add-On Project Type</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=OpenOffice_Add-On_Project_Type&amp;diff=40602"/>
		<updated>2007-07-27T16:01:36Z</updated>

		<summary type="html">&lt;p&gt;Exactt: added an image for step 3&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Back to [[OpenOffice_NetBeans_Integration|OpenOffice.org NetBeans Integration]]&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
&lt;br /&gt;
The Add-On wizard will enable users to create an OpenOffice.org component that including support of UI extensions. The component is based on a on a J2SE class library project and supports additional targets to create and deploy the package into the office installation.&lt;br /&gt;
All interface methods are default implemented and do nothing. In a second step you can insert your implementation in the generated skeleton, rebuild the extension and deploy it again to see the effect in your office.&lt;br /&gt;
&lt;br /&gt;
= Project Wizard =&lt;br /&gt;
The project wizard  is quite simple to use, you simply choose&lt;br /&gt;
*&amp;#039;&amp;#039; &amp;#039;&amp;#039;&amp;#039;File -&amp;gt; New Project -&amp;gt; StarOffice/OpenOffice.org -&amp;gt; StarOffice/OpenOffice.org Add-On&amp;#039;&amp;#039;&amp;#039; &amp;#039;&amp;#039;&lt;br /&gt;
and follow the wizard.&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Step 1&amp;#039;&amp;#039;&amp;#039;: Select the project type&lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:AddOn1.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Step 2&amp;#039;&amp;#039;&amp;#039;: Define the project name, Add-On name, an optional package and the project location &lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:AddOn2.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
The necessary xcu files are generated and become part of the final &amp;#039;&amp;#039;&amp;#039;oxt&amp;#039;&amp;#039;&amp;#039; package. These xcu files can be easily adapted later to extend the initial project to a more complex Add-On example. The generated Add-On skeleton implements a simple [http://api.openoffice.org/docs/common/ref/com/sun/star/frame/ProtocolHandler.html com.sun.star.frame.ProtocolHandler] Add-On.&amp;lt;br&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Step 3&amp;#039;&amp;#039;&amp;#039;: Defining Functions and Description with Localization&lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:AddOn3-1.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
This part is missing. See also discussion.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Step 4&amp;#039;&amp;#039;&amp;#039;: Defining the new toplevel menu&lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:AddOn3.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:AddOn4.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
On this panel you can define new toplevel menus with submenus on a higher abstraction level. You will not have to deal with xcu files directly. You can modify the default menu and commands, add new menus and commands, and you can insert localized displaynames. For more detailed descriptions of the different fields simply press the help button or read the appropriate chapter in the [http://api.openoffice.org/docs/DevelopersGuide/Components/Components.xhtml#1_7_1_Protocol_Handler Developer&amp;#039;s Guide - Writing UNO components - Integrating Components into OpenOffice.org - Protocol Handler]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you add a new language you can select languages from a list of supported languages. When you delete a language, you can only delete the languages you have added.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:Calc_AddIn3a.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:Calc_AddIn3b.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Step 5&amp;#039;&amp;#039;&amp;#039;: Deploying the extension package&lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:Calc_AddIn4.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
You can simply create or deploy the &amp;#039;&amp;#039;&amp;#039;oxt&amp;#039;&amp;#039;&amp;#039; extension package by choosing:&amp;lt;br&amp;gt;&lt;br /&gt;
::&amp;#039;&amp;#039;&amp;#039;Project View -&amp;gt; Project Node -&amp;gt; Context Menu -&amp;gt; Create OXT | Deploy Office Extension&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you have deployed the package, the newly defined menus are visible in the specified context. For example, if you choose the context &amp;#039;&amp;#039;&amp;#039;Writer&amp;#039;&amp;#039;&amp;#039;, the menu is visible when you open or create a text document.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:AddOn5.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Generated Code =&lt;br /&gt;
Two (.xcu) files for the Add-On are created that describe the Add-On commands with descriptions, displaynames etc., (Addons.xcu) and the protocol that is used to access these commands (ProtocolHandler.xcu). For the example shown above, the following files are generated:&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Addons.xcu&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;xcu file defining the new menus with submenus and commands. This file can be easily extended to support toolbars as well (toolbar support will be added later to the wizard).&lt;br /&gt;
&amp;lt;code&amp;gt;[xml]&lt;br /&gt;
&amp;lt;?xml version=&amp;#039;1.0&amp;#039; encoding=&amp;#039;UTF-8&amp;#039;?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;oor:component-data xmlns:oor=&amp;quot;http://openoffice.org/2001/registry&amp;quot; xmlns:xs=&amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot; oor:name=&amp;quot;Addons&amp;quot; oor:package=&amp;quot;org.openoffice.Office&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;node oor:name=&amp;quot;AddonUI&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;node oor:name=&amp;quot;OfficeMenuBar&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;node oor:name=&amp;quot;org.openoffice.testaddon.testaddon&amp;quot; oor:op=&amp;quot;replace&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;prop oor:name=&amp;quot;Title&amp;quot; oor:type=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;value/&amp;gt;&lt;br /&gt;
          &amp;lt;value xml:lang=&amp;quot;en&amp;quot;&amp;gt;My Menu&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/prop&amp;gt;&lt;br /&gt;
        &amp;lt;prop oor:name=&amp;quot;Target&amp;quot; oor:type=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;_self&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/prop&amp;gt;&lt;br /&gt;
        &amp;lt;prop oor:name=&amp;quot;ImageIdentifier&amp;quot; oor:type=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;value/&amp;gt;&lt;br /&gt;
        &amp;lt;/prop&amp;gt;&lt;br /&gt;
        &amp;lt;node oor:name=&amp;quot;Submenu&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;node oor:name=&amp;quot;m1&amp;quot; oor:op=&amp;quot;replace&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;prop oor:name=&amp;quot;URL&amp;quot; oor:type=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;value&amp;gt;org.openoffice.testaddon.testaddon:mycommands&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;/prop&amp;gt;&lt;br /&gt;
            &amp;lt;prop oor:name=&amp;quot;ImageIdentifier&amp;quot; oor:type=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;value/&amp;gt;&lt;br /&gt;
            &amp;lt;/prop&amp;gt;&lt;br /&gt;
            &amp;lt;prop oor:name=&amp;quot;Target&amp;quot; oor:type=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;value&amp;gt;_self&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;/prop&amp;gt;&lt;br /&gt;
            &amp;lt;prop oor:name=&amp;quot;Context&amp;quot; oor:type=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;value/&amp;gt;&lt;br /&gt;
            &amp;lt;/prop&amp;gt;&lt;br /&gt;
            &amp;lt;prop oor:name=&amp;quot;Title&amp;quot; oor:type=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;value/&amp;gt;&lt;br /&gt;
              &amp;lt;value xml:lang=&amp;quot;en&amp;quot;&amp;gt;Hello World&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;/prop&amp;gt;&lt;br /&gt;
          &amp;lt;/node&amp;gt;&lt;br /&gt;
        &amp;lt;/node&amp;gt;&lt;br /&gt;
      &amp;lt;/node&amp;gt;&lt;br /&gt;
    &amp;lt;/node&amp;gt;&lt;br /&gt;
    &amp;lt;node oor:name=&amp;quot;Images&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;node oor:name=&amp;quot;org.openoffice.testaddon.testaddon.mycommands.images&amp;quot; oor:op=&amp;quot;replace&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;prop oor:name=&amp;quot;URL&amp;quot; oor:type=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;org.openoffice.testaddon.testaddon:mycommands&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/prop&amp;gt;&lt;br /&gt;
        &amp;lt;node oor:name=&amp;quot;UserDefinedImages&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;prop oor:name=&amp;quot;ImageSmallURL&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;value/&amp;gt;&lt;br /&gt;
          &amp;lt;/prop&amp;gt;&lt;br /&gt;
        &amp;lt;/node&amp;gt;&lt;br /&gt;
      &amp;lt;/node&amp;gt;&lt;br /&gt;
      &amp;lt;/node&amp;gt;&lt;br /&gt;
  &amp;lt;/node&amp;gt;&lt;br /&gt;
&amp;lt;/oor:component-data&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;ProtocolHandler.xcu&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;xcu file defining the automatically generated protocol. The protocol is generated based on the package name and Add-On name.&lt;br /&gt;
&amp;lt;code&amp;gt;[xml]&lt;br /&gt;
&amp;lt;?xml version=&amp;#039;1.0&amp;#039; encoding=&amp;#039;UTF-8&amp;#039;?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;oor:component-data oor:name=&amp;quot;ProtocolHandler&amp;quot; oor:package=&amp;quot;org.openoffice.Office&amp;quot; xmlns:oor=&amp;quot;http://openoffice.org/2001/registry&amp;quot; xmlns:xs=&amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot; xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;node oor:name=&amp;quot;HandlerSet&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;node oor:name=&amp;quot;org.openoffice.testaddon.TestAddOn&amp;quot; oor:op=&amp;quot;replace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;prop oor:name=&amp;quot;Protocols&amp;quot; oor:type=&amp;quot;oor:string-list&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;value&amp;gt;org.openoffice.testaddon.testaddon:*&amp;lt;/value&amp;gt;&lt;br /&gt;
      &amp;lt;/prop&amp;gt;&lt;br /&gt;
    &amp;lt;/node&amp;gt;&lt;br /&gt;
  &amp;lt;/node&amp;gt;&lt;br /&gt;
&amp;lt;/oor:component-data&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;uno-extension-manifest.xml&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;the package descriptor, will be packed as &amp;amp;quot;META-INF/manifest.xml&amp;amp;quot;&lt;br /&gt;
&amp;lt;code&amp;gt;[xml]&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;manifest:manifest xmlns:manifest=&amp;quot;http://openoffice.org/2001/manifest&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;manifest:file-entry manifest:media-type=&amp;quot;application/vnd.sun.star.configuration-data&amp;quot;&lt;br /&gt;
                       manifest:full-path=&amp;quot;ProtocolHandler.xcu&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;manifest:file-entry manifest:media-type=&amp;quot;application/vnd.sun.star.configuration-data&amp;quot;&lt;br /&gt;
                       manifest:full-path=&amp;quot;Addons.xcu&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;manifest:file-entry manifest:media-type=&amp;quot;application/vnd.sun.star.uno-component;type=Java&amp;quot;&lt;br /&gt;
                       manifest:full-path=&amp;quot;TestAddOn.jar&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/manifest:manifest&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;org/openoffice/testaddon/TestAddOn.java&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;the generated Add-On code skeleton where the generated class acts itself as the dispatch object (can be easily changed to support more complex Add-Ons). Most of the methods are already implemented and you simply have to add your own code in the dispatch method in the right place for each specified command.&lt;br /&gt;
&amp;lt;code&amp;gt;[java]&lt;br /&gt;
package org.openoffice.testaddon;&lt;br /&gt;
&lt;br /&gt;
import com.sun.star.uno.UnoRuntime;&lt;br /&gt;
import com.sun.star.uno.XComponentContext;&lt;br /&gt;
import com.sun.star.lib.uno.helper.Factory;&lt;br /&gt;
import com.sun.star.lang.XSingleComponentFactory;&lt;br /&gt;
import com.sun.star.registry.XRegistryKey;&lt;br /&gt;
import com.sun.star.lib.uno.helper.WeakBase;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public final class TestAddOn extends WeakBase&lt;br /&gt;
   implements com.sun.star.lang.XServiceInfo,&lt;br /&gt;
              com.sun.star.frame.XDispatchProvider,&lt;br /&gt;
              com.sun.star.lang.XInitialization,&lt;br /&gt;
              com.sun.star.frame.XDispatch&lt;br /&gt;
{&lt;br /&gt;
    private final XComponentContext m_xContext;&lt;br /&gt;
    private com.sun.star.frame.XFrame m_xFrame;&lt;br /&gt;
    private static final String m_implementationName = TestAddOn.class.getName();&lt;br /&gt;
    private static final String[] m_serviceNames = {&lt;br /&gt;
        &amp;quot;com.sun.star.frame.ProtocolHandler&amp;quot; };&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    public TestAddOn( XComponentContext context )&lt;br /&gt;
    {&lt;br /&gt;
        m_xContext = context;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    public static XSingleComponentFactory __getComponentFactory( String sImplementationName ) {&lt;br /&gt;
        XSingleComponentFactory xFactory = null;&lt;br /&gt;
&lt;br /&gt;
        if ( sImplementationName.equals( m_implementationName ) )&lt;br /&gt;
            xFactory = Factory.createComponentFactory(TestAddOn.class, m_serviceNames);&lt;br /&gt;
        return xFactory;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public static boolean __writeRegistryServiceInfo( XRegistryKey xRegistryKey ) {&lt;br /&gt;
        return Factory.writeRegistryServiceInfo(m_implementationName,&lt;br /&gt;
                                                m_serviceNames,&lt;br /&gt;
                                                xRegistryKey);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // com.sun.star.lang.XServiceInfo:&lt;br /&gt;
    public String getImplementationName() {&lt;br /&gt;
         return m_implementationName;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public boolean supportsService( String sService ) {&lt;br /&gt;
        int len = m_serviceNames.length;&lt;br /&gt;
&lt;br /&gt;
        for( int i=0; i &amp;lt; len; i++) {&lt;br /&gt;
            if (sService.equals(m_serviceNames[i]))&lt;br /&gt;
                return true;&lt;br /&gt;
        }&lt;br /&gt;
        return false;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public String[] getSupportedServiceNames() {&lt;br /&gt;
        return m_serviceNames;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // com.sun.star.frame.XDispatchProvider:&lt;br /&gt;
    public com.sun.star.frame.XDispatch queryDispatch( com.sun.star.util.URL aURL,&lt;br /&gt;
                                                       String sTargetFrameName,&lt;br /&gt;
                                                       int iSearchFlags )&lt;br /&gt;
    {&lt;br /&gt;
        if ( aURL.Protocol.compareTo(&amp;quot;org.openoffice.testaddon.testaddon:&amp;quot;) == 0 )&lt;br /&gt;
        {&lt;br /&gt;
            if ( aURL.Path.compareTo(&amp;quot;mycommands&amp;quot;) == 0 )&lt;br /&gt;
                return this;&lt;br /&gt;
        }&lt;br /&gt;
        return null;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // com.sun.star.frame.XDispatchProvider:&lt;br /&gt;
    public com.sun.star.frame.XDispatch[] queryDispatches(&lt;br /&gt;
         com.sun.star.frame.DispatchDescriptor[] seqDescriptors )&lt;br /&gt;
    {&lt;br /&gt;
        int nCount = seqDescriptors.length;&lt;br /&gt;
        com.sun.star.frame.XDispatch[] seqDispatcher =&lt;br /&gt;
            new com.sun.star.frame.XDispatch[seqDescriptors.length];&lt;br /&gt;
&lt;br /&gt;
        for( int i=0; i &amp;lt; nCount; ++i )&lt;br /&gt;
        {&lt;br /&gt;
            seqDispatcher[i] = queryDispatch(seqDescriptors[i].FeatureURL,&lt;br /&gt;
                                             seqDescriptors[i].FrameName,&lt;br /&gt;
                                             seqDescriptors[i].SearchFlags );&lt;br /&gt;
        }&lt;br /&gt;
        return seqDispatcher;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // com.sun.star.lang.XInitialization:&lt;br /&gt;
    public void initialize( Object[] object )&lt;br /&gt;
        throws com.sun.star.uno.Exception&lt;br /&gt;
    {&lt;br /&gt;
        if ( object.length &amp;gt; 0 )&lt;br /&gt;
        {&lt;br /&gt;
            m_xFrame = (com.sun.star.frame.XFrame)UnoRuntime.queryInterface(&lt;br /&gt;
                com.sun.star.frame.XFrame.class, object[0]);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // com.sun.star.frame.XDispatch:&lt;br /&gt;
     public void dispatch( com.sun.star.util.URL aURL,&lt;br /&gt;
                           com.sun.star.beans.PropertyValue[] aArguments )&lt;br /&gt;
    {&lt;br /&gt;
         if ( aURL.Protocol.compareTo(&amp;quot;org.openoffice.testaddon.testaddon:&amp;quot;) == 0 )&lt;br /&gt;
        {&lt;br /&gt;
            if ( aURL.Path.compareTo(&amp;quot;mycommands&amp;quot;) == 0 )&lt;br /&gt;
            {&lt;br /&gt;
                // add your own code here&lt;br /&gt;
                return;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public void addStatusListener( com.sun.star.frame.XStatusListener xControl,&lt;br /&gt;
                                    com.sun.star.util.URL aURL )&lt;br /&gt;
    {&lt;br /&gt;
        // add your own code here&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public void removeStatusListener( com.sun.star.frame.XStatusListener xControl,&lt;br /&gt;
                                       com.sun.star.util.URL aURL )&lt;br /&gt;
    {&lt;br /&gt;
        // add your own code here&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Add-Ons]]&lt;br /&gt;
[[Category:API]]&lt;/div&gt;</summary>
		<author><name>Exactt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=File:AddOn3-1.png&amp;diff=40601</id>
		<title>File:AddOn3-1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=File:AddOn3-1.png&amp;diff=40601"/>
		<updated>2007-07-27T16:00:54Z</updated>

		<summary type="html">&lt;p&gt;Exactt: AddOn screen 3&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;AddOn screen 3&lt;/div&gt;</summary>
		<author><name>Exactt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=OpenOffice_Add-On_Project_Type&amp;diff=40599</id>
		<title>OpenOffice Add-On Project Type</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=OpenOffice_Add-On_Project_Type&amp;diff=40599"/>
		<updated>2007-07-27T15:52:26Z</updated>

		<summary type="html">&lt;p&gt;Exactt: Added empty missing step 3&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Back to [[OpenOffice_NetBeans_Integration|OpenOffice.org NetBeans Integration]]&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
&lt;br /&gt;
The Add-On wizard will enable users to create an OpenOffice.org component that including support of UI extensions. The component is based on a on a J2SE class library project and supports additional targets to create and deploy the package into the office installation.&lt;br /&gt;
All interface methods are default implemented and do nothing. In a second step you can insert your implementation in the generated skeleton, rebuild the extension and deploy it again to see the effect in your office.&lt;br /&gt;
&lt;br /&gt;
= Project Wizard =&lt;br /&gt;
The project wizard  is quite simple to use, you simply choose&lt;br /&gt;
*&amp;#039;&amp;#039; &amp;#039;&amp;#039;&amp;#039;File -&amp;gt; New Project -&amp;gt; StarOffice/OpenOffice.org -&amp;gt; StarOffice/OpenOffice.org Add-On&amp;#039;&amp;#039;&amp;#039; &amp;#039;&amp;#039;&lt;br /&gt;
and follow the wizard.&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Step 1&amp;#039;&amp;#039;&amp;#039;: Select the project type&lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:AddOn1.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Step 2&amp;#039;&amp;#039;&amp;#039;: Define the project name, Add-On name, an optional package and the project location &lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:AddOn2.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
The necessary xcu files are generated and become part of the final &amp;#039;&amp;#039;&amp;#039;oxt&amp;#039;&amp;#039;&amp;#039; package. These xcu files can be easily adapted later to extend the initial project to a more complex Add-On example. The generated Add-On skeleton implements a simple [http://api.openoffice.org/docs/common/ref/com/sun/star/frame/ProtocolHandler.html com.sun.star.frame.ProtocolHandler] Add-On.&amp;lt;br&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Step 3&amp;#039;&amp;#039;&amp;#039;: Defining Functions and Description with Localization&lt;br /&gt;
This part is missing. See also discussion.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Step 4&amp;#039;&amp;#039;&amp;#039;: Defining the new toplevel menu&lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:AddOn3.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:AddOn4.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
On this panel you can define new toplevel menus with submenus on a higher abstraction level. You will not have to deal with xcu files directly. You can modify the default menu and commands, add new menus and commands, and you can insert localized displaynames. For more detailed descriptions of the different fields simply press the help button or read the appropriate chapter in the [http://api.openoffice.org/docs/DevelopersGuide/Components/Components.xhtml#1_7_1_Protocol_Handler Developer&amp;#039;s Guide - Writing UNO components - Integrating Components into OpenOffice.org - Protocol Handler]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you add a new language you can select languages from a list of supported languages. When you delete a language, you can only delete the languages you have added.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:Calc_AddIn3a.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:Calc_AddIn3b.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Step 5&amp;#039;&amp;#039;&amp;#039;: Deploying the extension package&lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:Calc_AddIn4.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
You can simply create or deploy the &amp;#039;&amp;#039;&amp;#039;oxt&amp;#039;&amp;#039;&amp;#039; extension package by choosing:&amp;lt;br&amp;gt;&lt;br /&gt;
::&amp;#039;&amp;#039;&amp;#039;Project View -&amp;gt; Project Node -&amp;gt; Context Menu -&amp;gt; Create OXT | Deploy Office Extension&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you have deployed the package, the newly defined menus are visible in the specified context. For example, if you choose the context &amp;#039;&amp;#039;&amp;#039;Writer&amp;#039;&amp;#039;&amp;#039;, the menu is visible when you open or create a text document.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:AddOn5.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Generated Code =&lt;br /&gt;
Two (.xcu) files for the Add-On are created that describe the Add-On commands with descriptions, displaynames etc., (Addons.xcu) and the protocol that is used to access these commands (ProtocolHandler.xcu). For the example shown above, the following files are generated:&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Addons.xcu&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;xcu file defining the new menus with submenus and commands. This file can be easily extended to support toolbars as well (toolbar support will be added later to the wizard).&lt;br /&gt;
&amp;lt;code&amp;gt;[xml]&lt;br /&gt;
&amp;lt;?xml version=&amp;#039;1.0&amp;#039; encoding=&amp;#039;UTF-8&amp;#039;?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;oor:component-data xmlns:oor=&amp;quot;http://openoffice.org/2001/registry&amp;quot; xmlns:xs=&amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot; oor:name=&amp;quot;Addons&amp;quot; oor:package=&amp;quot;org.openoffice.Office&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;node oor:name=&amp;quot;AddonUI&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;node oor:name=&amp;quot;OfficeMenuBar&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;node oor:name=&amp;quot;org.openoffice.testaddon.testaddon&amp;quot; oor:op=&amp;quot;replace&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;prop oor:name=&amp;quot;Title&amp;quot; oor:type=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;value/&amp;gt;&lt;br /&gt;
          &amp;lt;value xml:lang=&amp;quot;en&amp;quot;&amp;gt;My Menu&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/prop&amp;gt;&lt;br /&gt;
        &amp;lt;prop oor:name=&amp;quot;Target&amp;quot; oor:type=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;_self&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/prop&amp;gt;&lt;br /&gt;
        &amp;lt;prop oor:name=&amp;quot;ImageIdentifier&amp;quot; oor:type=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;value/&amp;gt;&lt;br /&gt;
        &amp;lt;/prop&amp;gt;&lt;br /&gt;
        &amp;lt;node oor:name=&amp;quot;Submenu&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;node oor:name=&amp;quot;m1&amp;quot; oor:op=&amp;quot;replace&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;prop oor:name=&amp;quot;URL&amp;quot; oor:type=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;value&amp;gt;org.openoffice.testaddon.testaddon:mycommands&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;/prop&amp;gt;&lt;br /&gt;
            &amp;lt;prop oor:name=&amp;quot;ImageIdentifier&amp;quot; oor:type=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;value/&amp;gt;&lt;br /&gt;
            &amp;lt;/prop&amp;gt;&lt;br /&gt;
            &amp;lt;prop oor:name=&amp;quot;Target&amp;quot; oor:type=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;value&amp;gt;_self&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;/prop&amp;gt;&lt;br /&gt;
            &amp;lt;prop oor:name=&amp;quot;Context&amp;quot; oor:type=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;value/&amp;gt;&lt;br /&gt;
            &amp;lt;/prop&amp;gt;&lt;br /&gt;
            &amp;lt;prop oor:name=&amp;quot;Title&amp;quot; oor:type=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;value/&amp;gt;&lt;br /&gt;
              &amp;lt;value xml:lang=&amp;quot;en&amp;quot;&amp;gt;Hello World&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;/prop&amp;gt;&lt;br /&gt;
          &amp;lt;/node&amp;gt;&lt;br /&gt;
        &amp;lt;/node&amp;gt;&lt;br /&gt;
      &amp;lt;/node&amp;gt;&lt;br /&gt;
    &amp;lt;/node&amp;gt;&lt;br /&gt;
    &amp;lt;node oor:name=&amp;quot;Images&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;node oor:name=&amp;quot;org.openoffice.testaddon.testaddon.mycommands.images&amp;quot; oor:op=&amp;quot;replace&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;prop oor:name=&amp;quot;URL&amp;quot; oor:type=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;org.openoffice.testaddon.testaddon:mycommands&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/prop&amp;gt;&lt;br /&gt;
        &amp;lt;node oor:name=&amp;quot;UserDefinedImages&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;prop oor:name=&amp;quot;ImageSmallURL&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;value/&amp;gt;&lt;br /&gt;
          &amp;lt;/prop&amp;gt;&lt;br /&gt;
        &amp;lt;/node&amp;gt;&lt;br /&gt;
      &amp;lt;/node&amp;gt;&lt;br /&gt;
      &amp;lt;/node&amp;gt;&lt;br /&gt;
  &amp;lt;/node&amp;gt;&lt;br /&gt;
&amp;lt;/oor:component-data&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;ProtocolHandler.xcu&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;xcu file defining the automatically generated protocol. The protocol is generated based on the package name and Add-On name.&lt;br /&gt;
&amp;lt;code&amp;gt;[xml]&lt;br /&gt;
&amp;lt;?xml version=&amp;#039;1.0&amp;#039; encoding=&amp;#039;UTF-8&amp;#039;?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;oor:component-data oor:name=&amp;quot;ProtocolHandler&amp;quot; oor:package=&amp;quot;org.openoffice.Office&amp;quot; xmlns:oor=&amp;quot;http://openoffice.org/2001/registry&amp;quot; xmlns:xs=&amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot; xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;node oor:name=&amp;quot;HandlerSet&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;node oor:name=&amp;quot;org.openoffice.testaddon.TestAddOn&amp;quot; oor:op=&amp;quot;replace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;prop oor:name=&amp;quot;Protocols&amp;quot; oor:type=&amp;quot;oor:string-list&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;value&amp;gt;org.openoffice.testaddon.testaddon:*&amp;lt;/value&amp;gt;&lt;br /&gt;
      &amp;lt;/prop&amp;gt;&lt;br /&gt;
    &amp;lt;/node&amp;gt;&lt;br /&gt;
  &amp;lt;/node&amp;gt;&lt;br /&gt;
&amp;lt;/oor:component-data&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;uno-extension-manifest.xml&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;the package descriptor, will be packed as &amp;amp;quot;META-INF/manifest.xml&amp;amp;quot;&lt;br /&gt;
&amp;lt;code&amp;gt;[xml]&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;manifest:manifest xmlns:manifest=&amp;quot;http://openoffice.org/2001/manifest&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;manifest:file-entry manifest:media-type=&amp;quot;application/vnd.sun.star.configuration-data&amp;quot;&lt;br /&gt;
                       manifest:full-path=&amp;quot;ProtocolHandler.xcu&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;manifest:file-entry manifest:media-type=&amp;quot;application/vnd.sun.star.configuration-data&amp;quot;&lt;br /&gt;
                       manifest:full-path=&amp;quot;Addons.xcu&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;manifest:file-entry manifest:media-type=&amp;quot;application/vnd.sun.star.uno-component;type=Java&amp;quot;&lt;br /&gt;
                       manifest:full-path=&amp;quot;TestAddOn.jar&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/manifest:manifest&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;org/openoffice/testaddon/TestAddOn.java&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;the generated Add-On code skeleton where the generated class acts itself as the dispatch object (can be easily changed to support more complex Add-Ons). Most of the methods are already implemented and you simply have to add your own code in the dispatch method in the right place for each specified command.&lt;br /&gt;
&amp;lt;code&amp;gt;[java]&lt;br /&gt;
package org.openoffice.testaddon;&lt;br /&gt;
&lt;br /&gt;
import com.sun.star.uno.UnoRuntime;&lt;br /&gt;
import com.sun.star.uno.XComponentContext;&lt;br /&gt;
import com.sun.star.lib.uno.helper.Factory;&lt;br /&gt;
import com.sun.star.lang.XSingleComponentFactory;&lt;br /&gt;
import com.sun.star.registry.XRegistryKey;&lt;br /&gt;
import com.sun.star.lib.uno.helper.WeakBase;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public final class TestAddOn extends WeakBase&lt;br /&gt;
   implements com.sun.star.lang.XServiceInfo,&lt;br /&gt;
              com.sun.star.frame.XDispatchProvider,&lt;br /&gt;
              com.sun.star.lang.XInitialization,&lt;br /&gt;
              com.sun.star.frame.XDispatch&lt;br /&gt;
{&lt;br /&gt;
    private final XComponentContext m_xContext;&lt;br /&gt;
    private com.sun.star.frame.XFrame m_xFrame;&lt;br /&gt;
    private static final String m_implementationName = TestAddOn.class.getName();&lt;br /&gt;
    private static final String[] m_serviceNames = {&lt;br /&gt;
        &amp;quot;com.sun.star.frame.ProtocolHandler&amp;quot; };&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    public TestAddOn( XComponentContext context )&lt;br /&gt;
    {&lt;br /&gt;
        m_xContext = context;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    public static XSingleComponentFactory __getComponentFactory( String sImplementationName ) {&lt;br /&gt;
        XSingleComponentFactory xFactory = null;&lt;br /&gt;
&lt;br /&gt;
        if ( sImplementationName.equals( m_implementationName ) )&lt;br /&gt;
            xFactory = Factory.createComponentFactory(TestAddOn.class, m_serviceNames);&lt;br /&gt;
        return xFactory;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public static boolean __writeRegistryServiceInfo( XRegistryKey xRegistryKey ) {&lt;br /&gt;
        return Factory.writeRegistryServiceInfo(m_implementationName,&lt;br /&gt;
                                                m_serviceNames,&lt;br /&gt;
                                                xRegistryKey);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // com.sun.star.lang.XServiceInfo:&lt;br /&gt;
    public String getImplementationName() {&lt;br /&gt;
         return m_implementationName;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public boolean supportsService( String sService ) {&lt;br /&gt;
        int len = m_serviceNames.length;&lt;br /&gt;
&lt;br /&gt;
        for( int i=0; i &amp;lt; len; i++) {&lt;br /&gt;
            if (sService.equals(m_serviceNames[i]))&lt;br /&gt;
                return true;&lt;br /&gt;
        }&lt;br /&gt;
        return false;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public String[] getSupportedServiceNames() {&lt;br /&gt;
        return m_serviceNames;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // com.sun.star.frame.XDispatchProvider:&lt;br /&gt;
    public com.sun.star.frame.XDispatch queryDispatch( com.sun.star.util.URL aURL,&lt;br /&gt;
                                                       String sTargetFrameName,&lt;br /&gt;
                                                       int iSearchFlags )&lt;br /&gt;
    {&lt;br /&gt;
        if ( aURL.Protocol.compareTo(&amp;quot;org.openoffice.testaddon.testaddon:&amp;quot;) == 0 )&lt;br /&gt;
        {&lt;br /&gt;
            if ( aURL.Path.compareTo(&amp;quot;mycommands&amp;quot;) == 0 )&lt;br /&gt;
                return this;&lt;br /&gt;
        }&lt;br /&gt;
        return null;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // com.sun.star.frame.XDispatchProvider:&lt;br /&gt;
    public com.sun.star.frame.XDispatch[] queryDispatches(&lt;br /&gt;
         com.sun.star.frame.DispatchDescriptor[] seqDescriptors )&lt;br /&gt;
    {&lt;br /&gt;
        int nCount = seqDescriptors.length;&lt;br /&gt;
        com.sun.star.frame.XDispatch[] seqDispatcher =&lt;br /&gt;
            new com.sun.star.frame.XDispatch[seqDescriptors.length];&lt;br /&gt;
&lt;br /&gt;
        for( int i=0; i &amp;lt; nCount; ++i )&lt;br /&gt;
        {&lt;br /&gt;
            seqDispatcher[i] = queryDispatch(seqDescriptors[i].FeatureURL,&lt;br /&gt;
                                             seqDescriptors[i].FrameName,&lt;br /&gt;
                                             seqDescriptors[i].SearchFlags );&lt;br /&gt;
        }&lt;br /&gt;
        return seqDispatcher;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // com.sun.star.lang.XInitialization:&lt;br /&gt;
    public void initialize( Object[] object )&lt;br /&gt;
        throws com.sun.star.uno.Exception&lt;br /&gt;
    {&lt;br /&gt;
        if ( object.length &amp;gt; 0 )&lt;br /&gt;
        {&lt;br /&gt;
            m_xFrame = (com.sun.star.frame.XFrame)UnoRuntime.queryInterface(&lt;br /&gt;
                com.sun.star.frame.XFrame.class, object[0]);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // com.sun.star.frame.XDispatch:&lt;br /&gt;
     public void dispatch( com.sun.star.util.URL aURL,&lt;br /&gt;
                           com.sun.star.beans.PropertyValue[] aArguments )&lt;br /&gt;
    {&lt;br /&gt;
         if ( aURL.Protocol.compareTo(&amp;quot;org.openoffice.testaddon.testaddon:&amp;quot;) == 0 )&lt;br /&gt;
        {&lt;br /&gt;
            if ( aURL.Path.compareTo(&amp;quot;mycommands&amp;quot;) == 0 )&lt;br /&gt;
            {&lt;br /&gt;
                // add your own code here&lt;br /&gt;
                return;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public void addStatusListener( com.sun.star.frame.XStatusListener xControl,&lt;br /&gt;
                                    com.sun.star.util.URL aURL )&lt;br /&gt;
    {&lt;br /&gt;
        // add your own code here&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public void removeStatusListener( com.sun.star.frame.XStatusListener xControl,&lt;br /&gt;
                                       com.sun.star.util.URL aURL )&lt;br /&gt;
    {&lt;br /&gt;
        // add your own code here&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Add-Ons]]&lt;br /&gt;
[[Category:API]]&lt;/div&gt;</summary>
		<author><name>Exactt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Talk:OpenOffice_Add-On_Project_Type&amp;diff=40598</id>
		<title>Talk:OpenOffice Add-On Project Type</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Talk:OpenOffice_Add-On_Project_Type&amp;diff=40598"/>
		<updated>2007-07-27T15:50:18Z</updated>

		<summary type="html">&lt;p&gt;Exactt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;What happened to Step 3?&lt;br /&gt;
This somehow is a crucial point. It adds the commands...&lt;/div&gt;</summary>
		<author><name>Exactt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=OpenOffice_Add-On_Project_Type&amp;diff=40597</id>
		<title>OpenOffice Add-On Project Type</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=OpenOffice_Add-On_Project_Type&amp;diff=40597"/>
		<updated>2007-07-27T15:33:41Z</updated>

		<summary type="html">&lt;p&gt;Exactt: just a typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Back to [[OpenOffice_NetBeans_Integration|OpenOffice.org NetBeans Integration]]&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
&lt;br /&gt;
The Add-On wizard will enable users to create an OpenOffice.org component that including support of UI extensions. The component is based on a on a J2SE class library project and supports additional targets to create and deploy the package into the office installation.&lt;br /&gt;
All interface methods are default implemented and do nothing. In a second step you can insert your implementation in the generated skeleton, rebuild the extension and deploy it again to see the effect in your office.&lt;br /&gt;
&lt;br /&gt;
= Project Wizard =&lt;br /&gt;
The project wizard  is quite simple to use, you simply choose&lt;br /&gt;
*&amp;#039;&amp;#039; &amp;#039;&amp;#039;&amp;#039;File -&amp;gt; New Project -&amp;gt; StarOffice/OpenOffice.org -&amp;gt; StarOffice/OpenOffice.org Add-On&amp;#039;&amp;#039;&amp;#039; &amp;#039;&amp;#039;&lt;br /&gt;
and follow the wizard.&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Step 1&amp;#039;&amp;#039;&amp;#039;: Select the project type&lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:AddOn1.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Step 2&amp;#039;&amp;#039;&amp;#039;: Define the project name, Add-On name, an optional package and the project location &lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:AddOn2.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
The necessary xcu files are generated and become part of the final &amp;#039;&amp;#039;&amp;#039;oxt&amp;#039;&amp;#039;&amp;#039; package. These xcu files can be easily adapted later to extend the initial project to a more complex Add-On example. The generated Add-On skeleton implements a simple [http://api.openoffice.org/docs/common/ref/com/sun/star/frame/ProtocolHandler.html com.sun.star.frame.ProtocolHandler] Add-On.&amp;lt;br&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Step 4&amp;#039;&amp;#039;&amp;#039;: Defining the new toplevel menu&lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:AddOn3.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:AddOn4.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
On this panel you can define new toplevel menus with submenus on a higher abstraction level. You will not have to deal with xcu files directly. You can modify the default menu and commands, add new menus and commands, and you can insert localized displaynames. For more detailed descriptions of the different fields simply press the help button or read the appropriate chapter in the [http://api.openoffice.org/docs/DevelopersGuide/Components/Components.xhtml#1_7_1_Protocol_Handler Developer&amp;#039;s Guide - Writing UNO components - Integrating Components into OpenOffice.org - Protocol Handler]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you add a new language you can select languages from a list of supported languages. When you delete a language, you can only delete the languages you have added.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:Calc_AddIn3a.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:Calc_AddIn3b.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Step 5&amp;#039;&amp;#039;&amp;#039;: Deploying the extension package&lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:Calc_AddIn4.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
You can simply create or deploy the &amp;#039;&amp;#039;&amp;#039;oxt&amp;#039;&amp;#039;&amp;#039; extension package by choosing:&amp;lt;br&amp;gt;&lt;br /&gt;
::&amp;#039;&amp;#039;&amp;#039;Project View -&amp;gt; Project Node -&amp;gt; Context Menu -&amp;gt; Create OXT | Deploy Office Extension&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you have deployed the package, the newly defined menus are visible in the specified context. For example, if you choose the context &amp;#039;&amp;#039;&amp;#039;Writer&amp;#039;&amp;#039;&amp;#039;, the menu is visible when you open or create a text document.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:AddOn5.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Generated Code =&lt;br /&gt;
Two (.xcu) files for the Add-On are created that describe the Add-On commands with descriptions, displaynames etc., (Addons.xcu) and the protocol that is used to access these commands (ProtocolHandler.xcu). For the example shown above, the following files are generated:&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Addons.xcu&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;xcu file defining the new menus with submenus and commands. This file can be easily extended to support toolbars as well (toolbar support will be added later to the wizard).&lt;br /&gt;
&amp;lt;code&amp;gt;[xml]&lt;br /&gt;
&amp;lt;?xml version=&amp;#039;1.0&amp;#039; encoding=&amp;#039;UTF-8&amp;#039;?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;oor:component-data xmlns:oor=&amp;quot;http://openoffice.org/2001/registry&amp;quot; xmlns:xs=&amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot; oor:name=&amp;quot;Addons&amp;quot; oor:package=&amp;quot;org.openoffice.Office&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;node oor:name=&amp;quot;AddonUI&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;node oor:name=&amp;quot;OfficeMenuBar&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;node oor:name=&amp;quot;org.openoffice.testaddon.testaddon&amp;quot; oor:op=&amp;quot;replace&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;prop oor:name=&amp;quot;Title&amp;quot; oor:type=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;value/&amp;gt;&lt;br /&gt;
          &amp;lt;value xml:lang=&amp;quot;en&amp;quot;&amp;gt;My Menu&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/prop&amp;gt;&lt;br /&gt;
        &amp;lt;prop oor:name=&amp;quot;Target&amp;quot; oor:type=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;_self&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/prop&amp;gt;&lt;br /&gt;
        &amp;lt;prop oor:name=&amp;quot;ImageIdentifier&amp;quot; oor:type=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;value/&amp;gt;&lt;br /&gt;
        &amp;lt;/prop&amp;gt;&lt;br /&gt;
        &amp;lt;node oor:name=&amp;quot;Submenu&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;node oor:name=&amp;quot;m1&amp;quot; oor:op=&amp;quot;replace&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;prop oor:name=&amp;quot;URL&amp;quot; oor:type=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;value&amp;gt;org.openoffice.testaddon.testaddon:mycommands&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;/prop&amp;gt;&lt;br /&gt;
            &amp;lt;prop oor:name=&amp;quot;ImageIdentifier&amp;quot; oor:type=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;value/&amp;gt;&lt;br /&gt;
            &amp;lt;/prop&amp;gt;&lt;br /&gt;
            &amp;lt;prop oor:name=&amp;quot;Target&amp;quot; oor:type=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;value&amp;gt;_self&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;/prop&amp;gt;&lt;br /&gt;
            &amp;lt;prop oor:name=&amp;quot;Context&amp;quot; oor:type=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;value/&amp;gt;&lt;br /&gt;
            &amp;lt;/prop&amp;gt;&lt;br /&gt;
            &amp;lt;prop oor:name=&amp;quot;Title&amp;quot; oor:type=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;value/&amp;gt;&lt;br /&gt;
              &amp;lt;value xml:lang=&amp;quot;en&amp;quot;&amp;gt;Hello World&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;/prop&amp;gt;&lt;br /&gt;
          &amp;lt;/node&amp;gt;&lt;br /&gt;
        &amp;lt;/node&amp;gt;&lt;br /&gt;
      &amp;lt;/node&amp;gt;&lt;br /&gt;
    &amp;lt;/node&amp;gt;&lt;br /&gt;
    &amp;lt;node oor:name=&amp;quot;Images&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;node oor:name=&amp;quot;org.openoffice.testaddon.testaddon.mycommands.images&amp;quot; oor:op=&amp;quot;replace&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;prop oor:name=&amp;quot;URL&amp;quot; oor:type=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;org.openoffice.testaddon.testaddon:mycommands&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/prop&amp;gt;&lt;br /&gt;
        &amp;lt;node oor:name=&amp;quot;UserDefinedImages&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;prop oor:name=&amp;quot;ImageSmallURL&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;value/&amp;gt;&lt;br /&gt;
          &amp;lt;/prop&amp;gt;&lt;br /&gt;
        &amp;lt;/node&amp;gt;&lt;br /&gt;
      &amp;lt;/node&amp;gt;&lt;br /&gt;
      &amp;lt;/node&amp;gt;&lt;br /&gt;
  &amp;lt;/node&amp;gt;&lt;br /&gt;
&amp;lt;/oor:component-data&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;ProtocolHandler.xcu&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;xcu file defining the automatically generated protocol. The protocol is generated based on the package name and Add-On name.&lt;br /&gt;
&amp;lt;code&amp;gt;[xml]&lt;br /&gt;
&amp;lt;?xml version=&amp;#039;1.0&amp;#039; encoding=&amp;#039;UTF-8&amp;#039;?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;oor:component-data oor:name=&amp;quot;ProtocolHandler&amp;quot; oor:package=&amp;quot;org.openoffice.Office&amp;quot; xmlns:oor=&amp;quot;http://openoffice.org/2001/registry&amp;quot; xmlns:xs=&amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot; xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;node oor:name=&amp;quot;HandlerSet&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;node oor:name=&amp;quot;org.openoffice.testaddon.TestAddOn&amp;quot; oor:op=&amp;quot;replace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;prop oor:name=&amp;quot;Protocols&amp;quot; oor:type=&amp;quot;oor:string-list&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;value&amp;gt;org.openoffice.testaddon.testaddon:*&amp;lt;/value&amp;gt;&lt;br /&gt;
      &amp;lt;/prop&amp;gt;&lt;br /&gt;
    &amp;lt;/node&amp;gt;&lt;br /&gt;
  &amp;lt;/node&amp;gt;&lt;br /&gt;
&amp;lt;/oor:component-data&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;uno-extension-manifest.xml&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;the package descriptor, will be packed as &amp;amp;quot;META-INF/manifest.xml&amp;amp;quot;&lt;br /&gt;
&amp;lt;code&amp;gt;[xml]&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;manifest:manifest xmlns:manifest=&amp;quot;http://openoffice.org/2001/manifest&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;manifest:file-entry manifest:media-type=&amp;quot;application/vnd.sun.star.configuration-data&amp;quot;&lt;br /&gt;
                       manifest:full-path=&amp;quot;ProtocolHandler.xcu&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;manifest:file-entry manifest:media-type=&amp;quot;application/vnd.sun.star.configuration-data&amp;quot;&lt;br /&gt;
                       manifest:full-path=&amp;quot;Addons.xcu&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;manifest:file-entry manifest:media-type=&amp;quot;application/vnd.sun.star.uno-component;type=Java&amp;quot;&lt;br /&gt;
                       manifest:full-path=&amp;quot;TestAddOn.jar&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/manifest:manifest&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;org/openoffice/testaddon/TestAddOn.java&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;the generated Add-On code skeleton where the generated class acts itself as the dispatch object (can be easily changed to support more complex Add-Ons). Most of the methods are already implemented and you simply have to add your own code in the dispatch method in the right place for each specified command.&lt;br /&gt;
&amp;lt;code&amp;gt;[java]&lt;br /&gt;
package org.openoffice.testaddon;&lt;br /&gt;
&lt;br /&gt;
import com.sun.star.uno.UnoRuntime;&lt;br /&gt;
import com.sun.star.uno.XComponentContext;&lt;br /&gt;
import com.sun.star.lib.uno.helper.Factory;&lt;br /&gt;
import com.sun.star.lang.XSingleComponentFactory;&lt;br /&gt;
import com.sun.star.registry.XRegistryKey;&lt;br /&gt;
import com.sun.star.lib.uno.helper.WeakBase;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public final class TestAddOn extends WeakBase&lt;br /&gt;
   implements com.sun.star.lang.XServiceInfo,&lt;br /&gt;
              com.sun.star.frame.XDispatchProvider,&lt;br /&gt;
              com.sun.star.lang.XInitialization,&lt;br /&gt;
              com.sun.star.frame.XDispatch&lt;br /&gt;
{&lt;br /&gt;
    private final XComponentContext m_xContext;&lt;br /&gt;
    private com.sun.star.frame.XFrame m_xFrame;&lt;br /&gt;
    private static final String m_implementationName = TestAddOn.class.getName();&lt;br /&gt;
    private static final String[] m_serviceNames = {&lt;br /&gt;
        &amp;quot;com.sun.star.frame.ProtocolHandler&amp;quot; };&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    public TestAddOn( XComponentContext context )&lt;br /&gt;
    {&lt;br /&gt;
        m_xContext = context;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    public static XSingleComponentFactory __getComponentFactory( String sImplementationName ) {&lt;br /&gt;
        XSingleComponentFactory xFactory = null;&lt;br /&gt;
&lt;br /&gt;
        if ( sImplementationName.equals( m_implementationName ) )&lt;br /&gt;
            xFactory = Factory.createComponentFactory(TestAddOn.class, m_serviceNames);&lt;br /&gt;
        return xFactory;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public static boolean __writeRegistryServiceInfo( XRegistryKey xRegistryKey ) {&lt;br /&gt;
        return Factory.writeRegistryServiceInfo(m_implementationName,&lt;br /&gt;
                                                m_serviceNames,&lt;br /&gt;
                                                xRegistryKey);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // com.sun.star.lang.XServiceInfo:&lt;br /&gt;
    public String getImplementationName() {&lt;br /&gt;
         return m_implementationName;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public boolean supportsService( String sService ) {&lt;br /&gt;
        int len = m_serviceNames.length;&lt;br /&gt;
&lt;br /&gt;
        for( int i=0; i &amp;lt; len; i++) {&lt;br /&gt;
            if (sService.equals(m_serviceNames[i]))&lt;br /&gt;
                return true;&lt;br /&gt;
        }&lt;br /&gt;
        return false;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public String[] getSupportedServiceNames() {&lt;br /&gt;
        return m_serviceNames;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // com.sun.star.frame.XDispatchProvider:&lt;br /&gt;
    public com.sun.star.frame.XDispatch queryDispatch( com.sun.star.util.URL aURL,&lt;br /&gt;
                                                       String sTargetFrameName,&lt;br /&gt;
                                                       int iSearchFlags )&lt;br /&gt;
    {&lt;br /&gt;
        if ( aURL.Protocol.compareTo(&amp;quot;org.openoffice.testaddon.testaddon:&amp;quot;) == 0 )&lt;br /&gt;
        {&lt;br /&gt;
            if ( aURL.Path.compareTo(&amp;quot;mycommands&amp;quot;) == 0 )&lt;br /&gt;
                return this;&lt;br /&gt;
        }&lt;br /&gt;
        return null;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // com.sun.star.frame.XDispatchProvider:&lt;br /&gt;
    public com.sun.star.frame.XDispatch[] queryDispatches(&lt;br /&gt;
         com.sun.star.frame.DispatchDescriptor[] seqDescriptors )&lt;br /&gt;
    {&lt;br /&gt;
        int nCount = seqDescriptors.length;&lt;br /&gt;
        com.sun.star.frame.XDispatch[] seqDispatcher =&lt;br /&gt;
            new com.sun.star.frame.XDispatch[seqDescriptors.length];&lt;br /&gt;
&lt;br /&gt;
        for( int i=0; i &amp;lt; nCount; ++i )&lt;br /&gt;
        {&lt;br /&gt;
            seqDispatcher[i] = queryDispatch(seqDescriptors[i].FeatureURL,&lt;br /&gt;
                                             seqDescriptors[i].FrameName,&lt;br /&gt;
                                             seqDescriptors[i].SearchFlags );&lt;br /&gt;
        }&lt;br /&gt;
        return seqDispatcher;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // com.sun.star.lang.XInitialization:&lt;br /&gt;
    public void initialize( Object[] object )&lt;br /&gt;
        throws com.sun.star.uno.Exception&lt;br /&gt;
    {&lt;br /&gt;
        if ( object.length &amp;gt; 0 )&lt;br /&gt;
        {&lt;br /&gt;
            m_xFrame = (com.sun.star.frame.XFrame)UnoRuntime.queryInterface(&lt;br /&gt;
                com.sun.star.frame.XFrame.class, object[0]);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // com.sun.star.frame.XDispatch:&lt;br /&gt;
     public void dispatch( com.sun.star.util.URL aURL,&lt;br /&gt;
                           com.sun.star.beans.PropertyValue[] aArguments )&lt;br /&gt;
    {&lt;br /&gt;
         if ( aURL.Protocol.compareTo(&amp;quot;org.openoffice.testaddon.testaddon:&amp;quot;) == 0 )&lt;br /&gt;
        {&lt;br /&gt;
            if ( aURL.Path.compareTo(&amp;quot;mycommands&amp;quot;) == 0 )&lt;br /&gt;
            {&lt;br /&gt;
                // add your own code here&lt;br /&gt;
                return;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public void addStatusListener( com.sun.star.frame.XStatusListener xControl,&lt;br /&gt;
                                    com.sun.star.util.URL aURL )&lt;br /&gt;
    {&lt;br /&gt;
        // add your own code here&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public void removeStatusListener( com.sun.star.frame.XStatusListener xControl,&lt;br /&gt;
                                       com.sun.star.util.URL aURL )&lt;br /&gt;
    {&lt;br /&gt;
        // add your own code here&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Add-Ons]]&lt;br /&gt;
[[Category:API]]&lt;/div&gt;</summary>
		<author><name>Exactt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Calc/Add-In/Simple_Calc_Add-In&amp;diff=36142</id>
		<title>Calc/Add-In/Simple Calc Add-In</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Calc/Add-In/Simple_Calc_Add-In&amp;diff=36142"/>
		<updated>2007-06-22T17:20:50Z</updated>

		<summary type="html">&lt;p&gt;Exactt: /* Requirements */ more ubuntu stuff&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a step by step guide on how to write a simple component (a Calc add-in) for [[OpenOffice.org]] (OOo) in C++. Even though the instructions are for [[Linux]], this guide should give an idea on how to write components on other operating systems as well.&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
Make sure you have a C++ compiler and standard C library development files, preferably GNU C++ and GNU C library development files. Most Linux distributions either come with them or have them in their repositories. For example in Ubuntu 5.10-7.04 the package names are g++ and libc6-dev.&lt;br /&gt;
&lt;br /&gt;
You need to install OOo version 2.0 or above if you do not already have it. Most Linux distributions come with it. For Ubuntu 7.04 the package name is openoffice.org, and it is installed at /usr/lib/openoffice.&lt;br /&gt;
&lt;br /&gt;
Our major reference will be the OOo SDK, so go ahead download it from http://download.openoffice.org/680/sdk.html or install the package named openoffice.org-dev. Extract the SDK to somewhere you have write access to. You can delete the .tar.gz file after the extraction. The index.html file in the SDK directory is the main page of the OOo SDK documentation. Reading the SDK documentation fully or major parts of it would be a very good practice before trying to write code for OOo (For now ignore the &amp;quot;Installation Guide&amp;quot; part). You will use &amp;quot;Developer&amp;#039;s Guide&amp;quot;, &amp;quot;IDL Reference&amp;quot; and &amp;quot;C++ Reference&amp;quot; parts the most.&lt;br /&gt;
&lt;br /&gt;
Open a terminal, go to the extracted SDK directory with cd command and type (replace /usr/lib/openoffice2 with your full OOo installation directory)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;&lt;br /&gt;
echo export OOoSDK=&amp;#039;&amp;quot;&amp;#039;`pwd`&amp;#039;&amp;quot;&amp;#039; &amp;gt; OOoSetenv&lt;br /&gt;
&lt;br /&gt;
echo export PATH=&amp;#039;&amp;quot;$OOoSDK/linux/bin:$PATH&amp;quot;&amp;#039; &amp;gt;&amp;gt; OOoSetenv&lt;br /&gt;
&lt;br /&gt;
echo export OOo=&amp;#039;&amp;quot;/usr/lib/openoffice2/program&amp;quot;&amp;#039; &amp;gt;&amp;gt; OOoSetenv&lt;br /&gt;
&lt;br /&gt;
echo export LD_LIBRARY_PATH=&amp;#039;&amp;quot;$OOo:$LD_LIBRARY_PATH&amp;quot;&amp;#039; &amp;gt;&amp;gt; OOoSetenv&lt;br /&gt;
&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will prepare a script named OOoSetenv (for environment parameters). You will need to type &amp;quot;source OOoSetenv&amp;quot; in a terminal every time you want to use the SDK (For each terminal session it is enough to do it once), so go ahead and type it.&lt;br /&gt;
&lt;br /&gt;
Later we will link against libcppuhelpergcc3.so which should be in $OOo directory. In your terminal type &amp;quot;ls $OOo/*cppuhelper*&amp;quot;. If you see libcppuhelpergcc3.so file listed, then everything is fine. If not then you should see something like libcppuhelpergcc3.so.3, and you should type &amp;quot;sudo ln -s $OOo/libcppuhelpergcc3.so.3 $OOo/libcppuhelpergcc3.so&amp;quot; in your terminal, enter your password if asked (This requires a user that can do super user tasks with sudo, a sudoer). This just creates a symbolic link named libcppuhelpergcc3.so to the original file libcppuhelpergcc3.so.3 in the same directory. If your Linux distribution does not have sudo command then become super user with su command, type the previous command without sudo at the beginning (you may need to write $OOo explicitly) and return to your user account (by typing exit).&lt;br /&gt;
&lt;br /&gt;
In your terminal type &amp;quot;mkdir myProjects&amp;quot;. This will create a directory named &amp;quot;myProjects&amp;quot; in the SDK directory. We will put our projects here. Close the terminal window now.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
A component is an add-on (Merriam-Webster says &amp;quot;add-on : something (as an accessory or added feature) that enhances the thing it is added to&amp;quot;) for OOo. They are more specifically called UNO components (See &amp;quot;3  Professional UNO&amp;quot; and &amp;quot;4  Writing UNO Components&amp;quot; in the SDK&amp;#039;s &amp;quot;Developer&amp;#039;s Guide&amp;quot; part). You can write components for OOo in many programming languages, including C++ and [[JavaEclipseTuto|Java]].&lt;br /&gt;
&lt;br /&gt;
Calc is the spreadsheet application of OOo. We will write a Calc add-in, which is a special UNO component, that provides a Random Number Generator (RNG) service. For example, the &amp;quot;RAND()&amp;quot; function of Calc is a RNG that returns a random number between 0 and 1. So let&amp;#039;s do something new and write a RNG that returns exponentially distributed (See http://mathworld.wolfram.com/ExponentialDistribution.html and http://en.wikipedia.org/wiki/Exponential_distribution) random numbers. In this guide we will do things that are the same for general UNO components and/or Calc add-ins written in C++, so we will not be doing anything specific to RNGs, it is just something we can implement for Calc. See http://en.wikipedia.org/wiki/Inverse_transform_sampling_method for more information about sampling arbitrary random variables with closed form inverse cumulative distribution functions.&lt;br /&gt;
&lt;br /&gt;
==Preparation==&lt;br /&gt;
Open a terminal window, go to the SDK directory and type &amp;quot;source OOoSetenv&amp;quot; and then &amp;quot;cd myProjects&amp;quot;. Keep the terminal window open. Then download the [[Media:MyRNG.tar.gz|MyRNG.tar.gz]] file, extract it into the myProjects directory, and type &amp;quot;cd myRNG&amp;quot; in the terminal. There should be six files in the myRNG directory.&lt;br /&gt;
&lt;br /&gt;
==IDL==&lt;br /&gt;
Writing a component for OOo starts with writing its &amp;quot;Interface Specification&amp;quot;. Interface Specification is simply defining your component in a way that is independent from whichever implementation language (like C++, Java) you use. For OOo there is a special language called UNOIDL (UNO Interface Definition Language) to write interface specifications (See &amp;quot;4.2  Using UNOIDL to Specify New Components&amp;quot; in the SDK&amp;#039;s &amp;quot;Developer&amp;#039;s Guide&amp;quot; part). UNOIDL is very simple, and similar to C++. As you may have guessed, RNG.idl file is our interface specification. What is inside it is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[unoidl]&lt;br /&gt;
#ifndef _org_openoffice_sheet_addin_RNG_idl_&lt;br /&gt;
#define _org_openoffice_sheet_addin_RNG_idl_&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;com/sun/star/uno/XInterface.idl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
module org { module openoffice { module sheet { module addin {&lt;br /&gt;
	interface XRNG : com::sun::star::uno::XInterface&lt;br /&gt;
	{&lt;br /&gt;
		double expo( [in] double m );&lt;br /&gt;
	};&lt;br /&gt;
&lt;br /&gt;
	service RNG : XRNG;&lt;br /&gt;
}; }; }; };&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First you define an interface. Our interface is XRNG (derived from XInterface which is the base interface for any component) which has the definition for our RNG function (expo) that produces exponentially distributed random numbers. It is a convention that interface names start with X. Then we have a service, RNG, that uses our interface XRNG. Read the 3rd and 4th chapters of the developer&amp;#039;s guide for more information about module, interface and service keywords. UNO components are put under org.openoffice module, Calc add-ins are put under org.openoffice.sheet.addin.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
A UNO component must implement XInterface, XTypeProvider, XServiceInfo and XWeak interfaces (See &amp;quot;4.4  Core Interfaces to Implement&amp;quot; of developer&amp;#039;s guide). Luckily there are helper template classes for C++ (See &amp;quot;4.6  C++ Component&amp;quot; of developer&amp;#039;s guide, and WeakImplHelper* under cppu in &amp;quot;C++ Reference&amp;quot;) that take care of XInterface, XTypeProvider, XWeak implementations. In addition to these interfaces that every UNO component should implement, a Calc add-in must implement XAddIn and XServiceName (See &amp;quot;8.6  Spreadsheet Add-Ins&amp;quot; of the developer&amp;#039;s guide) interfaces. As you read the SDK documentation more, things will become clearer. The RNG_impl.cxx file is our implementation. In it we have our RNG_impl class&amp;#039; definition with the WeakImplHelper4 helper template&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;&lt;br /&gt;
:class RNG_impl : public ::cppu::WeakImplHelper4&amp;lt; ::org::openoffice::sheet::addin::XRNG,&lt;br /&gt;
::sheet::XAddIn, lang::XServiceName, lang::XServiceInfo &amp;gt; //4-parameter template&lt;br /&gt;
&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and implementations of XRNG, XAddIn, XServiceName, XServiceInfo and XLocalizable (just a small detail) classes. In addition to these it has the functions create_RNG_impl (creates a single instance of our RNG service), component_getImplementationEnvironment, component_writeInfo, component_getFactory and the struct s_component_entries (See &amp;quot;4.6  C++ Component&amp;quot; of the developer&amp;#039;s guide). After reading the SDK documentation and taking closer looks into RNG_impl.cxx file a few times, everything in RNG_impl.cxx file should be reasonably clear :).&lt;br /&gt;
&lt;br /&gt;
==Other Files==&lt;br /&gt;
In order to ease the development there is a build script named &amp;quot;build&amp;quot; in the myRNG directory. What is inside it is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;&lt;br /&gt;
rm -rf com org *.rdb *.urd&lt;br /&gt;
&lt;br /&gt;
idlc -C -I$OOoSDK/idl RNG.idl&lt;br /&gt;
&lt;br /&gt;
regmerge RNG.rdb /UCR RNG.urd&lt;br /&gt;
&lt;br /&gt;
cppumaker -BUCR -Torg.openoffice.sheet.addin.XRNG -Tcom.sun.star.sheet.XAddIn -Tcom.sun.star.lang.XServiceName -Tcom.sun.star.lang.XServiceInfo -Tcom.sun.star.lang.XTypeProvider -Tcom.sun.star.uno.XWeak -Tcom.sun.star.uno.XAggregation -Tcom.sun.star.lang.XMultiServiceFactory -Tcom.sun.star.uno.XComponentContext -Tcom.sun.star.lang.XSingleComponentFactory -Tcom.sun.star.lang.XSingleServiceFactory -Tcom.sun.star.registry.XRegistryKey &lt;br /&gt;
$OOo/types.rdb RNG.rdb&lt;br /&gt;
&lt;br /&gt;
g++ -O2 -fomit-frame-pointer -c -o RNG_impl.o -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3 -I. -I$OOoSDK/include RNG_impl.cxx&lt;br /&gt;
&lt;br /&gt;
ld -o libRNG.so -shared -L$OOo --retain-symbols-file symbols.txt RNG_impl.o -lcppuhelpergcc3&lt;br /&gt;
&lt;br /&gt;
rm -rf com org *.urd RNG_impl.o&lt;br /&gt;
&lt;br /&gt;
regcomp -register -r *.rdb -c *.so&lt;br /&gt;
&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For details about idlc, regmerge, cppumaker and regcomp tools see &amp;quot;4.2.2  Generating Source Code from UNOIDL Definitions&amp;quot; of the developer&amp;#039;s guide and &amp;quot;Development Tools&amp;quot;. A component must export only three symbols, the function names which start with &amp;quot;component_&amp;quot;, and &amp;quot;--retain-symbols-file symbols.txt&amp;quot; option to the linker ld serves this purpose. In your terminal you can type &amp;quot;man ld&amp;quot; to read about --retain-symbols-file option.&lt;br /&gt;
&lt;br /&gt;
==Building &amp;amp; Testing==&lt;br /&gt;
If everything went right typing &amp;quot;./build&amp;quot; in the terminal should produce libRNG.so and RNG.rdb files without any error. If not we have spare ones, _libRNG.so_ and _RNG.rdb_ :). Copy RNG.rdb and libRNG.so into $OOo by typing &amp;quot;sudo cp *.so *.rdb $OOo&amp;quot; in the terminal. Edit the $OOo/unorc file by typing &amp;quot;sudo nano $OOo/unorc&amp;quot; and add &amp;quot;$ORIGIN/RNG.rdb&amp;quot; to the end of lines starting with UNO_TYPES and UNO_SERVICES (See &amp;quot;4.6.10  Building and Testing C++ Components&amp;quot; of the developer&amp;#039;s guide). Those two lines should look similar to this &amp;lt;br&amp;gt;&lt;br /&gt;
:UNO_TYPES=$ORIGIN/types.rdb $ORIGIN/RNG.rdb&lt;br /&gt;
:UNO_SERVICES=$ORIGIN/services.rdb $ORIGIN/RNG.rdb&lt;br /&gt;
Save and exit nano. Now it is time to try our RNG. Open OOo Calc, go to Tools &amp;gt; Macros &amp;gt; Organize Macros &amp;gt; OpenOffice.org Basic menu and click &amp;quot;Edit&amp;quot; in the new window. Then copy-paste the following lines into the Basic code editing window overwriting everything what was there&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
Sub Main&lt;br /&gt;
	mgr = getProcessServiceManager()&lt;br /&gt;
	o = mgr.createInstance(&amp;quot;org.openoffice.sheet.addin.RNG&amp;quot;)&lt;br /&gt;
	MsgBox o.expo(10)&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and run your Basic macro. You should see something like this&lt;br /&gt;
&lt;br /&gt;
[[Image:RNG shot.png]]&lt;br /&gt;
&lt;br /&gt;
==Further==&lt;br /&gt;
Dig into the SDK documentation more and study the examples in the SDK, both Java and C++, then you should be ready to write your own UNO component.&lt;br /&gt;
&lt;br /&gt;
A more complete C++ add-in can be found here : [[CompleteAddIn|another Example]]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* Using C++ with OOo SDK : [[Using_Cpp_with_the_OOo_SDK | Main Page]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI14.html Add-in : adding OOoCalc functions] (Chapter 14 from UNO/C++ document) &lt;br /&gt;
* [http://www.oooforum.org/forum/viewtopic.phtml?t=29552 Add-In in C++ (OOOForum)]&lt;br /&gt;
* [http://sc.openoffice.org/addin_howto.html How to add-in in OpenOffice.org Calc]&lt;br /&gt;
* [http://api.openoffice.org/docs/common/ref/com/sun/star/sheet/AddIn.html Service AddIn Documentation]&lt;br /&gt;
* [[SDKInstallation | How to install the SDK and compile the C++ examples]]&lt;br /&gt;
* [[SDKCppLanguage | The UNO C++ Language]]&lt;br /&gt;
&lt;br /&gt;
==Public Documentation License Notice==&lt;br /&gt;
The contents of this Documentation are subject to the Public Documentation License Version 1.0 (the &amp;quot;License&amp;quot;); you may only use this Documentation if you comply with the terms of this License. A copy of the License is available at http://www.openoffice.org/licenses/PDL.html.&lt;br /&gt;
&lt;br /&gt;
Original Author: Serhat Sevki Dincer (C) 2006, jfcgaussATgmail. All rights reserved.&lt;br /&gt;
&lt;br /&gt;
[[Category:Calc]]&lt;br /&gt;
[[Category:API]]&lt;br /&gt;
[[Category:Add-Ins]]&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:Extensions]]&lt;/div&gt;</summary>
		<author><name>Exactt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Calc/Add-In/Simple_Calc_Add-In&amp;diff=36141</id>
		<title>Calc/Add-In/Simple Calc Add-In</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Calc/Add-In/Simple_Calc_Add-In&amp;diff=36141"/>
		<updated>2007-06-22T17:19:23Z</updated>

		<summary type="html">&lt;p&gt;Exactt: /* Requirements */ some ubuntu updates&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a step by step guide on how to write a simple component (a Calc add-in) for [[OpenOffice.org]] (OOo) in C++. Even though the instructions are for [[Linux]], this guide should give an idea on how to write components on other operating systems as well.&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
Make sure you have a C++ compiler and standard C library development files, preferably GNU C++ and GNU C library development files. Most Linux distributions either come with them or have them in their repositories. For example I have Ubuntu 5.10, and the package names are g++ and libc6-dev.&lt;br /&gt;
&lt;br /&gt;
You need to install OOo version 2.0 or above if you do not already have it. Most Linux distributions come with it. For Ubuntu 7.04 the package name is openoffice.org, and it is installed at /usr/lib/openoffice.&lt;br /&gt;
&lt;br /&gt;
Our major reference will be the OOo SDK, so go ahead download it from http://download.openoffice.org/680/sdk.html or install the package named openoffice.org-dev. Extract the SDK to somewhere you have write access to. You can delete the .tar.gz file after the extraction. The index.html file in the SDK directory is the main page of the OOo SDK documentation. Reading the SDK documentation fully or major parts of it would be a very good practice before trying to write code for OOo (For now ignore the &amp;quot;Installation Guide&amp;quot; part). You will use &amp;quot;Developer&amp;#039;s Guide&amp;quot;, &amp;quot;IDL Reference&amp;quot; and &amp;quot;C++ Reference&amp;quot; parts the most.&lt;br /&gt;
&lt;br /&gt;
Open a terminal, go to the extracted SDK directory with cd command and type (replace /usr/lib/openoffice2 with your full OOo installation directory)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;&lt;br /&gt;
echo export OOoSDK=&amp;#039;&amp;quot;&amp;#039;`pwd`&amp;#039;&amp;quot;&amp;#039; &amp;gt; OOoSetenv&lt;br /&gt;
&lt;br /&gt;
echo export PATH=&amp;#039;&amp;quot;$OOoSDK/linux/bin:$PATH&amp;quot;&amp;#039; &amp;gt;&amp;gt; OOoSetenv&lt;br /&gt;
&lt;br /&gt;
echo export OOo=&amp;#039;&amp;quot;/usr/lib/openoffice2/program&amp;quot;&amp;#039; &amp;gt;&amp;gt; OOoSetenv&lt;br /&gt;
&lt;br /&gt;
echo export LD_LIBRARY_PATH=&amp;#039;&amp;quot;$OOo:$LD_LIBRARY_PATH&amp;quot;&amp;#039; &amp;gt;&amp;gt; OOoSetenv&lt;br /&gt;
&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will prepare a script named OOoSetenv (for environment parameters). You will need to type &amp;quot;source OOoSetenv&amp;quot; in a terminal every time you want to use the SDK (For each terminal session it is enough to do it once), so go ahead and type it.&lt;br /&gt;
&lt;br /&gt;
Later we will link against libcppuhelpergcc3.so which should be in $OOo directory. In your terminal type &amp;quot;ls $OOo/*cppuhelper*&amp;quot;. If you see libcppuhelpergcc3.so file listed, then everything is fine. If not then you should see something like libcppuhelpergcc3.so.3, and you should type &amp;quot;sudo ln -s $OOo/libcppuhelpergcc3.so.3 $OOo/libcppuhelpergcc3.so&amp;quot; in your terminal, enter your password if asked (This requires a user that can do super user tasks with sudo, a sudoer). This just creates a symbolic link named libcppuhelpergcc3.so to the original file libcppuhelpergcc3.so.3 in the same directory. If your Linux distribution does not have sudo command then become super user with su command, type the previous command without sudo at the beginning (you may need to write $OOo explicitly) and return to your user account (by typing exit).&lt;br /&gt;
&lt;br /&gt;
In your terminal type &amp;quot;mkdir myProjects&amp;quot;. This will create a directory named &amp;quot;myProjects&amp;quot; in the SDK directory. We will put our projects here. Close the terminal window now.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
A component is an add-on (Merriam-Webster says &amp;quot;add-on : something (as an accessory or added feature) that enhances the thing it is added to&amp;quot;) for OOo. They are more specifically called UNO components (See &amp;quot;3  Professional UNO&amp;quot; and &amp;quot;4  Writing UNO Components&amp;quot; in the SDK&amp;#039;s &amp;quot;Developer&amp;#039;s Guide&amp;quot; part). You can write components for OOo in many programming languages, including C++ and [[JavaEclipseTuto|Java]].&lt;br /&gt;
&lt;br /&gt;
Calc is the spreadsheet application of OOo. We will write a Calc add-in, which is a special UNO component, that provides a Random Number Generator (RNG) service. For example, the &amp;quot;RAND()&amp;quot; function of Calc is a RNG that returns a random number between 0 and 1. So let&amp;#039;s do something new and write a RNG that returns exponentially distributed (See http://mathworld.wolfram.com/ExponentialDistribution.html and http://en.wikipedia.org/wiki/Exponential_distribution) random numbers. In this guide we will do things that are the same for general UNO components and/or Calc add-ins written in C++, so we will not be doing anything specific to RNGs, it is just something we can implement for Calc. See http://en.wikipedia.org/wiki/Inverse_transform_sampling_method for more information about sampling arbitrary random variables with closed form inverse cumulative distribution functions.&lt;br /&gt;
&lt;br /&gt;
==Preparation==&lt;br /&gt;
Open a terminal window, go to the SDK directory and type &amp;quot;source OOoSetenv&amp;quot; and then &amp;quot;cd myProjects&amp;quot;. Keep the terminal window open. Then download the [[Media:MyRNG.tar.gz|MyRNG.tar.gz]] file, extract it into the myProjects directory, and type &amp;quot;cd myRNG&amp;quot; in the terminal. There should be six files in the myRNG directory.&lt;br /&gt;
&lt;br /&gt;
==IDL==&lt;br /&gt;
Writing a component for OOo starts with writing its &amp;quot;Interface Specification&amp;quot;. Interface Specification is simply defining your component in a way that is independent from whichever implementation language (like C++, Java) you use. For OOo there is a special language called UNOIDL (UNO Interface Definition Language) to write interface specifications (See &amp;quot;4.2  Using UNOIDL to Specify New Components&amp;quot; in the SDK&amp;#039;s &amp;quot;Developer&amp;#039;s Guide&amp;quot; part). UNOIDL is very simple, and similar to C++. As you may have guessed, RNG.idl file is our interface specification. What is inside it is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[unoidl]&lt;br /&gt;
#ifndef _org_openoffice_sheet_addin_RNG_idl_&lt;br /&gt;
#define _org_openoffice_sheet_addin_RNG_idl_&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;com/sun/star/uno/XInterface.idl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
module org { module openoffice { module sheet { module addin {&lt;br /&gt;
	interface XRNG : com::sun::star::uno::XInterface&lt;br /&gt;
	{&lt;br /&gt;
		double expo( [in] double m );&lt;br /&gt;
	};&lt;br /&gt;
&lt;br /&gt;
	service RNG : XRNG;&lt;br /&gt;
}; }; }; };&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First you define an interface. Our interface is XRNG (derived from XInterface which is the base interface for any component) which has the definition for our RNG function (expo) that produces exponentially distributed random numbers. It is a convention that interface names start with X. Then we have a service, RNG, that uses our interface XRNG. Read the 3rd and 4th chapters of the developer&amp;#039;s guide for more information about module, interface and service keywords. UNO components are put under org.openoffice module, Calc add-ins are put under org.openoffice.sheet.addin.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
A UNO component must implement XInterface, XTypeProvider, XServiceInfo and XWeak interfaces (See &amp;quot;4.4  Core Interfaces to Implement&amp;quot; of developer&amp;#039;s guide). Luckily there are helper template classes for C++ (See &amp;quot;4.6  C++ Component&amp;quot; of developer&amp;#039;s guide, and WeakImplHelper* under cppu in &amp;quot;C++ Reference&amp;quot;) that take care of XInterface, XTypeProvider, XWeak implementations. In addition to these interfaces that every UNO component should implement, a Calc add-in must implement XAddIn and XServiceName (See &amp;quot;8.6  Spreadsheet Add-Ins&amp;quot; of the developer&amp;#039;s guide) interfaces. As you read the SDK documentation more, things will become clearer. The RNG_impl.cxx file is our implementation. In it we have our RNG_impl class&amp;#039; definition with the WeakImplHelper4 helper template&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;&lt;br /&gt;
:class RNG_impl : public ::cppu::WeakImplHelper4&amp;lt; ::org::openoffice::sheet::addin::XRNG,&lt;br /&gt;
::sheet::XAddIn, lang::XServiceName, lang::XServiceInfo &amp;gt; //4-parameter template&lt;br /&gt;
&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and implementations of XRNG, XAddIn, XServiceName, XServiceInfo and XLocalizable (just a small detail) classes. In addition to these it has the functions create_RNG_impl (creates a single instance of our RNG service), component_getImplementationEnvironment, component_writeInfo, component_getFactory and the struct s_component_entries (See &amp;quot;4.6  C++ Component&amp;quot; of the developer&amp;#039;s guide). After reading the SDK documentation and taking closer looks into RNG_impl.cxx file a few times, everything in RNG_impl.cxx file should be reasonably clear :).&lt;br /&gt;
&lt;br /&gt;
==Other Files==&lt;br /&gt;
In order to ease the development there is a build script named &amp;quot;build&amp;quot; in the myRNG directory. What is inside it is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;&lt;br /&gt;
rm -rf com org *.rdb *.urd&lt;br /&gt;
&lt;br /&gt;
idlc -C -I$OOoSDK/idl RNG.idl&lt;br /&gt;
&lt;br /&gt;
regmerge RNG.rdb /UCR RNG.urd&lt;br /&gt;
&lt;br /&gt;
cppumaker -BUCR -Torg.openoffice.sheet.addin.XRNG -Tcom.sun.star.sheet.XAddIn -Tcom.sun.star.lang.XServiceName -Tcom.sun.star.lang.XServiceInfo -Tcom.sun.star.lang.XTypeProvider -Tcom.sun.star.uno.XWeak -Tcom.sun.star.uno.XAggregation -Tcom.sun.star.lang.XMultiServiceFactory -Tcom.sun.star.uno.XComponentContext -Tcom.sun.star.lang.XSingleComponentFactory -Tcom.sun.star.lang.XSingleServiceFactory -Tcom.sun.star.registry.XRegistryKey &lt;br /&gt;
$OOo/types.rdb RNG.rdb&lt;br /&gt;
&lt;br /&gt;
g++ -O2 -fomit-frame-pointer -c -o RNG_impl.o -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3 -I. -I$OOoSDK/include RNG_impl.cxx&lt;br /&gt;
&lt;br /&gt;
ld -o libRNG.so -shared -L$OOo --retain-symbols-file symbols.txt RNG_impl.o -lcppuhelpergcc3&lt;br /&gt;
&lt;br /&gt;
rm -rf com org *.urd RNG_impl.o&lt;br /&gt;
&lt;br /&gt;
regcomp -register -r *.rdb -c *.so&lt;br /&gt;
&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For details about idlc, regmerge, cppumaker and regcomp tools see &amp;quot;4.2.2  Generating Source Code from UNOIDL Definitions&amp;quot; of the developer&amp;#039;s guide and &amp;quot;Development Tools&amp;quot;. A component must export only three symbols, the function names which start with &amp;quot;component_&amp;quot;, and &amp;quot;--retain-symbols-file symbols.txt&amp;quot; option to the linker ld serves this purpose. In your terminal you can type &amp;quot;man ld&amp;quot; to read about --retain-symbols-file option.&lt;br /&gt;
&lt;br /&gt;
==Building &amp;amp; Testing==&lt;br /&gt;
If everything went right typing &amp;quot;./build&amp;quot; in the terminal should produce libRNG.so and RNG.rdb files without any error. If not we have spare ones, _libRNG.so_ and _RNG.rdb_ :). Copy RNG.rdb and libRNG.so into $OOo by typing &amp;quot;sudo cp *.so *.rdb $OOo&amp;quot; in the terminal. Edit the $OOo/unorc file by typing &amp;quot;sudo nano $OOo/unorc&amp;quot; and add &amp;quot;$ORIGIN/RNG.rdb&amp;quot; to the end of lines starting with UNO_TYPES and UNO_SERVICES (See &amp;quot;4.6.10  Building and Testing C++ Components&amp;quot; of the developer&amp;#039;s guide). Those two lines should look similar to this &amp;lt;br&amp;gt;&lt;br /&gt;
:UNO_TYPES=$ORIGIN/types.rdb $ORIGIN/RNG.rdb&lt;br /&gt;
:UNO_SERVICES=$ORIGIN/services.rdb $ORIGIN/RNG.rdb&lt;br /&gt;
Save and exit nano. Now it is time to try our RNG. Open OOo Calc, go to Tools &amp;gt; Macros &amp;gt; Organize Macros &amp;gt; OpenOffice.org Basic menu and click &amp;quot;Edit&amp;quot; in the new window. Then copy-paste the following lines into the Basic code editing window overwriting everything what was there&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
Sub Main&lt;br /&gt;
	mgr = getProcessServiceManager()&lt;br /&gt;
	o = mgr.createInstance(&amp;quot;org.openoffice.sheet.addin.RNG&amp;quot;)&lt;br /&gt;
	MsgBox o.expo(10)&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and run your Basic macro. You should see something like this&lt;br /&gt;
&lt;br /&gt;
[[Image:RNG shot.png]]&lt;br /&gt;
&lt;br /&gt;
==Further==&lt;br /&gt;
Dig into the SDK documentation more and study the examples in the SDK, both Java and C++, then you should be ready to write your own UNO component.&lt;br /&gt;
&lt;br /&gt;
A more complete C++ add-in can be found here : [[CompleteAddIn|another Example]]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* Using C++ with OOo SDK : [[Using_Cpp_with_the_OOo_SDK | Main Page]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI14.html Add-in : adding OOoCalc functions] (Chapter 14 from UNO/C++ document) &lt;br /&gt;
* [http://www.oooforum.org/forum/viewtopic.phtml?t=29552 Add-In in C++ (OOOForum)]&lt;br /&gt;
* [http://sc.openoffice.org/addin_howto.html How to add-in in OpenOffice.org Calc]&lt;br /&gt;
* [http://api.openoffice.org/docs/common/ref/com/sun/star/sheet/AddIn.html Service AddIn Documentation]&lt;br /&gt;
* [[SDKInstallation | How to install the SDK and compile the C++ examples]]&lt;br /&gt;
* [[SDKCppLanguage | The UNO C++ Language]]&lt;br /&gt;
&lt;br /&gt;
==Public Documentation License Notice==&lt;br /&gt;
The contents of this Documentation are subject to the Public Documentation License Version 1.0 (the &amp;quot;License&amp;quot;); you may only use this Documentation if you comply with the terms of this License. A copy of the License is available at http://www.openoffice.org/licenses/PDL.html.&lt;br /&gt;
&lt;br /&gt;
Original Author: Serhat Sevki Dincer (C) 2006, jfcgaussATgmail. All rights reserved.&lt;br /&gt;
&lt;br /&gt;
[[Category:Calc]]&lt;br /&gt;
[[Category:API]]&lt;br /&gt;
[[Category:Add-Ins]]&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:Extensions]]&lt;/div&gt;</summary>
		<author><name>Exactt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=JavaEclipseTuto&amp;diff=35654</id>
		<title>JavaEclipseTuto</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=JavaEclipseTuto&amp;diff=35654"/>
		<updated>2007-06-20T09:23:08Z</updated>

		<summary type="html">&lt;p&gt;Exactt: /* Trouble shooting */ add hint to sdk package&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=How to create a Java component with Eclipse=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This paper is a tutorial to guide UNO newcomers through creating their first Java component. This tutorial will use Eclipse and its plugin for the OpenOffice.org development, and every step will be detailed. If you are an experienced UNO programmer, you can still follow this tutorial to have a better view of how to use the Eclipse plugin.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===UNO Components===&lt;br /&gt;
This section will explain some very basic things about UNO components. You can skip it if you already know it. First I will explain what a component is and its main parts. Afterwards, I will explain what is needed to create a UNO component to help you to fully understand the different tools and their use during the tutorial.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Components anatomy====&lt;br /&gt;
&amp;#039;&amp;#039;&amp;quot;A component is a system element offering a predefined service and able to communicate with other components&amp;quot;&amp;#039;&amp;#039; explains [http://fr.wikipedia.org/wiki/composant Wikipedia (Fr)] (Even thought there is a definition on the English wikipedia article, I prefer the French one because of its completeness). In UNOs case a component will generally be delivered as a package containing a library (share library in C++ or jar in Java). For UNO, a component is made of two distinct parts: specifications and an implementation. &lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Specification: &amp;#039;&amp;#039;&amp;#039;definition in a common language of what the component should do. For UNO, this language is called UNO-IDL and is more or less similar to [http://en.wikipedia.org/wiki/Corba Corba] IDL. The documented part that will be provided as an API to use the component is the specification. Thus, it should be complete and implementation independent.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Implementation: &amp;#039;&amp;#039;&amp;#039;is the code that will realize what is described in the component specifications. This programming language can either be C++, Java, Python or others. This is the internal part of the component and will not be accessible from another component.&lt;br /&gt;
In order that UNO knows which implementation corresponds to which specification, the component will use registries. There are two of them: the first one describes all the component specifications (&amp;lt;tt&amp;gt;types.rdb&amp;lt;/tt&amp;gt;) and the second translates the implementation into specifications (&amp;lt;tt&amp;gt;services.rdb&amp;lt;/tt&amp;gt;) and is generated from the implementation. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Components creation process====&lt;br /&gt;
The following diagram will help you better understand what should be done to get a component from its specification and sources.  As shown by the diagram, the specifications are compiled and merged into one &amp;lt;tt&amp;gt;types.rdb&amp;lt;/tt&amp;gt; registry. &amp;lt;tt&amp;gt;Class&amp;lt;/tt&amp;gt; files are generated from that file to translate the specifications into a Java class definition file which is built with the implementation into a class using the &amp;lt;tt&amp;gt;java&amp;lt;/tt&amp;gt; compiler. All the classes are delivered as a &amp;lt;tt&amp;gt;jar&amp;lt;/tt&amp;gt; file with a specific manifest as we will see further in this tutorial. This doesn&amp;#039;t make a usable OpenOffice.org: the &amp;lt;tt&amp;gt;types.rdb&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;jar&amp;lt;/tt&amp;gt; file will have to be zipped into a &amp;lt;tt&amp;gt;.uno.pkg&amp;lt;/tt&amp;gt; file described with another manifest.&lt;br /&gt;
&lt;br /&gt;
[[Image:CompilationChain.png|center|UNO component build chain]]&lt;br /&gt;
&lt;br /&gt;
As I will explain later, the Eclipse plugin will hide some of these operations, however you will need to know how they work to fully understand the build process and what we will do in the following steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Installing the development platform===&lt;br /&gt;
Now that you know what to do, we will install and configure the development tools. This is quite simple, but you can run into some problems if you do not read the following information carefully. I will now assume that you have none of the development tools. The minimum requirements for OpenOffice.org Eclipse integration are:&lt;br /&gt;
&lt;br /&gt;
*OpenOffice.org 2.0&lt;br /&gt;
*OpenOffice.org SDK 2.0.4&lt;br /&gt;
*Eclipse 3.2&lt;br /&gt;
*Java 1.5 (the GNU Java does not work with the Eclipse integration)&lt;br /&gt;
&lt;br /&gt;
====OpenOffice.org====&lt;br /&gt;
First of all, you will need to have a working OpenOffice.org 2.0 and its Software Development Kit (SDK). The latest versions are available on the [http://download.openoffice.org/ OpenOffice.org download pages] for the most current platforms. The OpenOffice.org SDK version 2.0.4 is mandatory to use the plugin correctly. It includes a new tool used by the plugin: the &amp;lt;tt&amp;gt;uno-skeletonmaker&amp;lt;/tt&amp;gt;. This tool will generate the implementation skeleton to help you to concentrate only on your code.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;This tutorial assumes that you used the &amp;quot;Official&amp;quot; OpenOffice.org distribution&amp;#039;&amp;#039;&amp;#039; from the project&amp;#039;s website. Other distributions may not work with the Eclipse integration (see the trouble shooting section at the end of this page).&lt;br /&gt;
&lt;br /&gt;
====Eclipse and the plugin====&lt;br /&gt;
To get Eclipse, just go to their download pages and download the latest Eclipse SDK. You will have Eclipse and its SDK. Of course, you might want to download only the binary runtime, but you will have to follow more links. Once you have Eclipse, unzip it on your computer and that&amp;#039;s it: Eclipse has a Java plugin to help you program in Java.&lt;br /&gt;
&lt;br /&gt;
Now we will install the OpenOffice.org development plugin for Eclipse using the Eclipse software update system. &amp;#039;&amp;#039;&amp;#039;Do not try to download an archive from somewhere. Eclipse will do it for you when you do the following steps.&amp;#039;&amp;#039;&amp;#039; Select the &amp;#039;&amp;#039;&amp;#039;Help &amp;gt; Software updates &amp;gt; Find and install&amp;#039;&amp;#039;&amp;#039; menu to get the window shown in the following illustration. Check the second option on this window and click on the &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039; button.&lt;br /&gt;
&lt;br /&gt;
[[Image:InstallWindow.png|center|&amp;quot;Find &amp;amp; Install&amp;quot; window]]&lt;br /&gt;
&lt;br /&gt;
On the following page, you will see a list of &amp;quot;&amp;#039;&amp;#039;update sites&amp;#039;&amp;#039;&amp;quot;. These are URLs pointing to directories containing plugins informations and archives. Now click on the &amp;#039;&amp;#039;&amp;#039;Add remote site&amp;#039;&amp;#039;&amp;#039; button to get a small window asking for a name that will be displayed in the list and an URL. The URL of OpenOffice.org plugin update site is http://cedric.bosdonnat.free.fr/ooeclipseintegration. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Do not try to download an archive from this URL. This is the plugin update site for Eclipse.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Validate the new update site parameters and be sure that the OpenOffice.org site is checked before clicking on the &amp;#039;&amp;#039;&amp;#039;Finish&amp;#039;&amp;#039;&amp;#039; button. You should now see a window like the one in the following illustration. &amp;#039;&amp;#039;&amp;#039;Select the OpenOffice.org plugin Core and Java plugins&amp;#039;&amp;#039;&amp;#039;, click Next and let the wizard guide you through the end of the process. You will be asked to accept the plugin license and validate the installation archives which are not signed.&lt;br /&gt;
&lt;br /&gt;
[[Image:PluginUpdates.png|center|OpenOffice.org update site contents]]&lt;br /&gt;
&lt;br /&gt;
Congratulations, you have installed the OpenOffice.org plugin successfully. Now you must configure it. The following steps will guide you through this task. Go to the Eclipse options via the &amp;#039;&amp;#039;&amp;#039;Window &amp;gt; Preferences...&amp;#039;&amp;#039;&amp;#039; menu. In the list on the left, select the &amp;#039;&amp;#039;&amp;#039;OpenOffice.org plugin &amp;gt; SDK Configuration&amp;#039;&amp;#039;&amp;#039; item to get a window like the one shown in the following illustration.&lt;br /&gt;
&lt;br /&gt;
[[Image:UnoProperties.png|center|SDK configuration window]]&lt;br /&gt;
&lt;br /&gt;
In this window you will have to configure the path to your OpenOffice.org and to its SDK. So, let us begin with the SDK path: click on the &amp;#039;&amp;#039;&amp;#039;Add&amp;#039;&amp;#039;&amp;#039; button next to the SDKs list. You will have a window like the one shown in following illustration. Browse to your OpenOffice.org 2.0 SDK and validate. Then you will have to do the same for the OpenOffice.org path using the other &amp;#039;&amp;#039;&amp;#039;Add&amp;#039;&amp;#039;&amp;#039; button.&lt;br /&gt;
&lt;br /&gt;
Note that a URE installation can be selected instead of a complete OpenOffice.org installation. Please refer to the Java URE application tutorial for more details on the plugin&amp;#039;s URE support.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;If you are using Windows, please make sure that the path to the SDK does not contains any spaces.  Spaces in the path can cause problems when you build your UNO projects.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:SdkConfig.png|center|New SDK path window]]&lt;br /&gt;
&lt;br /&gt;
Now your OpenOffice.org plugin is ready to work. You can begin to create your new component. If there was any problem during the plugin installation, please report it to the dev@api.openoffice.org [http://api.openoffice.org/servlets/ProjectMailingListList mailing-list].&lt;br /&gt;
&lt;br /&gt;
==Creating a new component==&lt;br /&gt;
For the Eclipse plugin, a UNO component is a UNO project. This tutorial will explain how to easily create a new UNO component using the Eclipse plugin. We will now assume that you have very simple needs. The component that will be created is a &amp;quot;Hello world&amp;quot; service and its implementation. Creating a component that defines and implements more services is a bit more complex and requires advanced Java UNO knowledge.&lt;br /&gt;
&lt;br /&gt;
There are several ways to create a UNO component project using the plugin: &lt;br /&gt;
&lt;br /&gt;
*The first one is the &amp;#039;&amp;#039;&amp;#039;File &amp;gt; New &amp;gt; Project&amp;#039;&amp;#039;&amp;#039; menu entry and choose the &amp;#039;&amp;#039;&amp;#039;UNO &amp;gt; UNO-IDL Project&amp;#039;&amp;#039;&amp;#039; item as shown by the following illustration.&lt;br /&gt;
&lt;br /&gt;
[[Image:NewUnoProjectsItems.png|center|New UNO-IDL project item]]&lt;br /&gt;
&lt;br /&gt;
*The second one is the icon in the toolbar representing a blue folder with a star as shown by the following illustration.&lt;br /&gt;
&lt;br /&gt;
[[Image:NewUnoProjectIcon.png|center|New UNO-IDL project icon]]&lt;br /&gt;
&lt;br /&gt;
Then you only have to follow the wizard to create your UNO component project, its specification and a skeleton of the implementation. This wizard is composed of several pages:&lt;br /&gt;
&lt;br /&gt;
*The main configuration page to define the general project properties.&lt;br /&gt;
*The implementation language configuration page.&lt;br /&gt;
*The service configuration page.&lt;br /&gt;
*The interface configuration page.&lt;br /&gt;
After all these steps you will have a running component... doing nothing. The following sections will describe the different wizard pages and where to place your code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===The project configuration page===&lt;br /&gt;
The first page in the project wizard is the only page containing fields that must be filled in. All the others have default values to help you through the component creation. In our case, we will cover all the pages in the wizard to explain them all and define some new methods and attributes in our component.&lt;br /&gt;
&lt;br /&gt;
[[Image:NewUnoProject.jpg|center|New UNO-IDL project wizard page]]&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Project name:&amp;#039;&amp;#039;&amp;#039; is the component name, in our case, it will be &amp;quot;&amp;#039;&amp;#039;Helloworld&amp;#039;&amp;#039;&amp;quot;&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Location:&amp;#039;&amp;#039;&amp;#039; is the directory on your computer where the project will be created. You can change the default one by deselecting the &amp;#039;&amp;#039;&amp;#039;Use default&amp;#039;&amp;#039;&amp;#039; check box. The default location of each Eclipse project is a directory with your project name in the current Eclipse workspace. &amp;#039;&amp;#039;&amp;#039;Please do not use spaces in this path on Windows.  Spaces in the path can prevent your component from being built.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Root package:&amp;#039;&amp;#039;&amp;#039; is the name of the first module of your component. It is generally composed of two parts: the vendor name (here &amp;lt;tt&amp;gt;org.openoffice&amp;lt;/tt&amp;gt;) and the project name (here &amp;lt;tt&amp;gt;helloworld&amp;lt;/tt&amp;gt;).&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Used SDK:&amp;#039;&amp;#039;&amp;#039; selects the OpenOffice.org SDK which will be used to develop the component. You generally will have only one SDK in the list, but you can add others in the preferences or by clicking on the &amp;#039;&amp;#039;&amp;#039;Configure SDKs&amp;#039;&amp;#039;&amp;#039; button.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Used OOo:&amp;#039;&amp;#039;&amp;#039; selects the version of OpenOffice.org to use to develop the component. Just as with the SDK, you will generally have only one entry in the list, but you can add others in the preferences or by clicking on the OOo Installations button.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Programming language:&amp;#039;&amp;#039;&amp;#039; selects the programming language for the component implementation. For the moment, there is only Java available, however C++ and python are planned.&lt;br /&gt;
&lt;br /&gt;
===The implementation language configuration page===&lt;br /&gt;
This page depends on the chosen language. For Java, the default values should be kept: they define which class is the main class of the component. The component&amp;#039;s main class contains some code mapping the services to their implementation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===The service configuration page===&lt;br /&gt;
&lt;br /&gt;
[[Image:Eclipse_Service_Page.png|center|Service configuration page]]&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Module:&amp;#039;&amp;#039;&amp;#039; corresponds to the UNO-IDL module where to add the interface. If the text field is left empty, the interface will be added in the root module of the component (filled in the project wizard).&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Service name:&amp;#039;&amp;#039;&amp;#039; is the service name. By keeping the default value, you will be able to define your own interface using the interface configuration page. Otherwise, you can reuse an existing interface.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Published&amp;#039;&amp;#039;&amp;#039;: specifies if the interface is published or not. The published notion is translated into a keyword in UNO-IDL language. Declaring a UNO-IDL type as published means that it will not change in future releases. We will keep it unchecked because our component is really far from being a stable API.&lt;br /&gt;
&lt;br /&gt;
===The interface configuration page===&lt;br /&gt;
&lt;br /&gt;
[[Image:NewInterfacePage.png|center|Interface configuration page]]&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Module:&amp;#039;&amp;#039;&amp;#039; corresponds to the UNO-IDL module where the interface is added. If the text field is left empty, the interface will be added in the root module of the component (filled in the project wizard).&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Interface name:&amp;#039;&amp;#039;&amp;#039; is the interface name. By convention, we generally name an interface beginning with an &amp;quot;X&amp;quot;. In this tutorial, the interface will be named &amp;lt;tt&amp;gt;XHelloworld&amp;lt;/tt&amp;gt;.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Inherited interfaces:&amp;#039;&amp;#039;&amp;#039; is a list of all the interfaces from which the one that is about to be created will inherit. This is one of the changes in UNO-IDL between OpenOffice.org 1.1.x and 2.0, and why the plugin does not support OpenOffice.org versions prior to 2.0. All the UNO-IDL interfaces are inheriting more or less directly from the &amp;lt;tt&amp;gt;com::sun::star::uno::XInterface&amp;lt;/tt&amp;gt; type. As the &amp;lt;tt&amp;gt;XHelloworld&amp;lt;/tt&amp;gt; interface is very easy, no super interface will be added. This will implicitly define &amp;lt;tt&amp;gt;XInterface&amp;lt;/tt&amp;gt; as the only parent for the new interface. &lt;br /&gt;
**&amp;#039;&amp;#039;&amp;#039;&amp;quot;?&amp;quot; column:&amp;#039;&amp;#039;&amp;#039; specifies if the interface inheritance is mandatory or not. If the box is checked, the interface inheritance is optional and may not be implemented.&lt;br /&gt;
**&amp;#039;&amp;#039;&amp;#039;&amp;quot;Add&amp;quot; and &amp;quot;Del&amp;quot; buttons:&amp;#039;&amp;#039;&amp;#039; allows you to add an interface to the inherited ones or remove the selected interface.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Members:&amp;#039;&amp;#039;&amp;#039; is a list of all the methods and properties of the interface. See below for explanations about the members. In this tutorial, just create one &amp;lt;tt&amp;gt;string sayHello([in] boolean isBadBoy)&amp;lt;/tt&amp;gt; method and a &amp;lt;tt&amp;gt;LadyName&amp;lt;/tt&amp;gt; property.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Published:&amp;#039;&amp;#039;&amp;#039; specifies if the interface is published or not. The published notion is translated into a keyword in UNO-IDL language. Declaring a UNO-IDL type as published means that it will not change in future releases. We will keep it unchecked because our component is really far from being a stable API.&lt;br /&gt;
A UNO interface can contain two kind of members: methods and properties. When clicking on the &amp;#039;&amp;#039;&amp;#039;Add&amp;#039;&amp;#039;&amp;#039; button near the members&amp;#039; list, the following window will be shown. When double-clicking on a line in the members&amp;#039; list, you will edit the corresponding member through the same window.&lt;br /&gt;
&lt;br /&gt;
When the window is opened to create a new member, you can choose whether the member will be a property or a method. The name and returned type fields are always present, but the lower part of the dialog is different for a method and a property.&lt;br /&gt;
&lt;br /&gt;
[[Image:Eclipse_Interface_Members_Dialog.png|center|Interface member creation dialog]]&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;The arguments list:&amp;#039;&amp;#039;&amp;#039; defines the name, type and direction of the parameters of the method. Simply click on the cell to edit it.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Read-only and Bound check boxes:&amp;#039;&amp;#039;&amp;#039; selecting these boxes sets the corresponding IDL flag on the property.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Tip:&amp;#039;&amp;#039;&amp;#039; you can use &amp;#039;&amp;#039;&amp;lt;tt&amp;gt;&amp;#039;&amp;#039;Ctrl+Space&amp;#039;&amp;#039;&amp;lt;/tt&amp;gt;&amp;#039;&amp;#039; to complete the type name in the &amp;#039;&amp;#039;&amp;#039;Return type&amp;#039;&amp;#039;&amp;#039; field and &amp;#039;&amp;#039;&amp;#039;Type&amp;#039;&amp;#039;&amp;#039; column.&lt;br /&gt;
&lt;br /&gt;
===Writing the implementation===&lt;br /&gt;
After having completed the wizard, you need to write the component implementation. Hopefully a skeleton has been generated and opened. You need to complete the code where there are some TODOS. The generated project contains the following directories and files:&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;source:&amp;#039;&amp;#039;&amp;#039; directory containing your Java implementation classes.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;build:&amp;#039;&amp;#039;&amp;#039; directory containing all the generated temporary files, such as the results of the specification files (&amp;lt;tt&amp;gt;.idl&amp;lt;/tt&amp;gt; files) compilation (&amp;lt;tt&amp;gt;.urd&amp;lt;/tt&amp;gt; files) or the class files corresponding to the specifications (&amp;lt;tt&amp;gt;.class&amp;lt;/tt&amp;gt; files).&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;idl:&amp;#039;&amp;#039;&amp;#039; directory containing the specifications of the component.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;types.rdb:&amp;#039;&amp;#039;&amp;#039; generated UNO types registry from which the classes files will be generated.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;JRE and the jars:&amp;#039;&amp;#039;&amp;#039; describe the classpath of the component. They are visible only in the Java package explorer. The OpenOffice.org jars are changed if the OpenOffice.org version associated to the project is changed. &amp;#039;&amp;#039;In a future version, they will be packed in a user library to take less space in the tree.&amp;#039;&amp;#039;&lt;br /&gt;
The generated skeleton already contains the methods for the implementation registration. The only things to modify are:&lt;br /&gt;
&lt;br /&gt;
*Change the code of the setters and getters for the defined properties.&lt;br /&gt;
*Change the code of the defined methods.&lt;br /&gt;
The Eclipse integration even manages the libraries needed by your implementation. Let us imagine that we want to use the &amp;lt;tt&amp;gt;Fraction&amp;lt;/tt&amp;gt; class from the Apache &amp;lt;tt&amp;gt;common-math&amp;lt;/tt&amp;gt; jar. Download this jar from the Apache website, and import the &amp;lt;tt&amp;gt;common-math-1.1.jar&amp;lt;/tt&amp;gt; file into your component project, for example in a &amp;lt;tt&amp;gt;lib&amp;lt;/tt&amp;gt; directory. Add the jar to the project build path in the same way than in any other Eclipse Java project and use it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[java]&lt;br /&gt;
    // org.openoffice.helloworld.XHelloworld:&lt;br /&gt;
    private String mLadyName = &amp;quot;&amp;quot;;&lt;br /&gt;
    &lt;br /&gt;
    public String getLadyName()&lt;br /&gt;
    {&lt;br /&gt;
        return mLadyName;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public void setLadyName(String the_value)&lt;br /&gt;
    {&lt;br /&gt;
        mLadyName = the_value;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public String sayHello(boolean isBadBoy)&lt;br /&gt;
    {&lt;br /&gt;
    	String hello = &amp;quot;Hello Mrs. &amp;quot; + getLadyName();&lt;br /&gt;
        if (isBadBoy) {&lt;br /&gt;
        	Fraction f = new Fraction(1, 3);&lt;br /&gt;
        	hello = &amp;quot;A third is &amp;quot; + f.doubleValue();&lt;br /&gt;
        }&lt;br /&gt;
        return hello;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The above code shows you what could be an implementation of our component. Now, there is only to package it properly and test it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Packaging and testing the component==&lt;br /&gt;
Now we will show you how to export your component into an OpenOffice.org package. There is little to do apart from following these steps:&lt;br /&gt;
&lt;br /&gt;
*Select the &amp;#039;&amp;#039;&amp;#039;File &amp;gt; Export&amp;#039;&amp;#039;&amp;#039; menu. Then choose the &amp;#039;&amp;#039;&amp;#039;UNO &amp;gt; OpenOffice.org&amp;#039;&amp;#039;&amp;#039; package export type.&lt;br /&gt;
*The next page of the wizard asks for the UNO project to export (already selected), the directory where to export the package and the OpenOffice.org minimum compatibility version for the package. Depending of the selected OpenOffice.org version, the package will get a different name and a different structure.&lt;br /&gt;
*Click on the Finish button. The wizard will ask you whether to deploy to package or not and asks for the old package removal if needed.&lt;br /&gt;
Then we will suppose that the package is deployed on the OpenOffice.org installation and we will test it using the following &amp;lt;tt&amp;gt;OooBasic&amp;lt;/tt&amp;gt; macro.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
Sub testHelloworld&lt;br /&gt;
	oHelloworld = createUnoService( &amp;quot;org.openoffice.helloworld.Helloworld&amp;quot; )&lt;br /&gt;
	oHelloworld.LadyName = &amp;quot;Robinson&amp;quot;&lt;br /&gt;
	print oHelloworld.sayHello( false )&lt;br /&gt;
	print oHelloworld.sayHello( True )&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This macro should open two message windows with &amp;#039;&amp;#039;&amp;quot;Hello Mrs. Robinson&amp;quot;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;quot;A third is 0.3333333&amp;quot;&amp;#039;&amp;#039;. Your first UNO component is now running, enjoy doing others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Going further==&lt;br /&gt;
This chapter is only for those who enjoyed this tutorial and want to know more about the UNO component creation in Java or other languages. The following is a list of useful links for any UNO developer:&lt;br /&gt;
&lt;br /&gt;
*[http://api.openoffice.org/docs/DevelopersGuide/DevelopersGuide.xhtml OpenOffice.org developer&amp;#039;s guide] is a huge source of documentation for any OpenOffice.org developer. You should probably have a look at chapters 3 and 4 for UNO component information.&lt;br /&gt;
*[http://api.openoffice.org/docs/java/ref/overview-summary.html OOo Java reference] is the UNO binding for Java reference.&lt;br /&gt;
*[http://api.openoffice.org/docs/cpp/ref/names/index.html OOo C++ reference] is the UNO binding for C++ reference.&lt;br /&gt;
*[http://wiki.services.openoffice.org/ OOo Developer&amp;#039;s Wiki] is the wiki for all the OpenOffice.org developers. It contains useful information even for people who are just starting out with UNO.&lt;br /&gt;
*[http://udk.openoffice.org/common/man/draft/multinherit.html http://udk.openoffice.org/common/man/draft/multinherit.html] for further information on what changes have been made in UNO-IDL between OpenOffice.org 1.1.x and 2.0&lt;br /&gt;
*[http://tools.openoffice.org/autodoc/HowToWriteDocumentation-Cpp.html Autodoc Java reference] is the reference for &amp;lt;tt&amp;gt;javadoc&amp;lt;/tt&amp;gt; like comments in UNO-IDL files.&lt;br /&gt;
*[http://tools.openoffice.org/autodoc/HowToWriteDocumentation-Cpp.html Autodoc C++ documentation] is the reference for &amp;lt;tt&amp;gt;javadoc&amp;lt;/tt&amp;gt; like comments in C++ components.&lt;br /&gt;
*[http://cedric.bosdonnat.free.fr/wordpress/?p=19 URE C++ application tutorial] explains how to create a C++ application based on the URE, that is a UNO C++ component that does not need OpenOffice.org.&lt;br /&gt;
&lt;br /&gt;
==Trouble shooting==&lt;br /&gt;
* If you run into trouble it might be helpful to turn the log level to debug mode. This can be done inside Eclipse via Window &amp;gt; Preferences &amp;gt; OpenOffice.org Integration. The log file can be found in &amp;#039;&amp;#039;$YOURWORKSPACEPATH/.metadata/.log&amp;#039;&amp;#039; .&lt;br /&gt;
* If you plan to use the OpenOffice version that comes with your distribution try using the according SDK (in Ubuntu it is the package openoffice.org-dev). If there is no such package and you run into trouble not getting the skeletons and opening of an external editor you probably have to create a symbolic link to &amp;#039;&amp;#039;/usr/lib/libstlport_gcc.so&amp;#039;&amp;#039; from the official version of libstlport_gcc.so extracted from an official download of OOo.&lt;br /&gt;
* On Unix running &amp;#039;&amp;#039;setsdkenv_unix&amp;#039;&amp;#039; in your SDK directory might helpful as well.&lt;br /&gt;
&lt;br /&gt;
[[Category:Eclipse]]&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:Java]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>Exactt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=JavaEclipseTuto&amp;diff=29258</id>
		<title>JavaEclipseTuto</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=JavaEclipseTuto&amp;diff=29258"/>
		<updated>2007-03-28T11:12:47Z</updated>

		<summary type="html">&lt;p&gt;Exactt: /* How to create a Java component with Eclipse */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=How to create a Java component with Eclipse=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This paper is a tutorial to guide UNO newcomers through creating their first Java component. This tutorial will use Eclipse and its plugin for the OpenOffice.org development, and every step will be detailed. If you are an experienced UNO programmer, you can still follow this tutorial to have a better view of how to use the Eclipse plugin.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===UNO Components===&lt;br /&gt;
This section will explain some very basic things about UNO components. You can skip it if you already know it. First I will explain what a component is and its main parts. Afterwards, I will explain what is needed to create a UNO component to help you to fully understand the different tools and their use during the tutorial.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Components anatomy====&lt;br /&gt;
&amp;#039;&amp;#039;&amp;quot;A component is a system element offering a predefined service and able to communicate with other components&amp;quot;&amp;#039;&amp;#039; explains [http://fr.wikipedia.org/wiki/composant Wikipedia (Fr)] (Even thought there is a definition on the English wikipedia article, I prefer the French one because of its completeness). In UNOs case a component will generally be delivered as a package containing a library (share library in C++ or jar in Java). For UNO, a component is made of two distinct parts: specifications and an implementation. &lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Specification: &amp;#039;&amp;#039;&amp;#039;definition in a common language of what the component should do. For UNO, this language is called UNO-IDL and is more or less similar to [http://en.wikipedia.org/wiki/Corba Corba] IDL. The documented part that will be provided as an API to use the component is the specification. Thus, it should be complete and implementation independent.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Implementation: &amp;#039;&amp;#039;&amp;#039;is the code that will realize what is described in the component specifications. This programming language can either be C++, Java, Python or others. This is the internal part of the component and will not be accessible from another component.&lt;br /&gt;
In order that UNO knows which implementation corresponds to which specification, the component will use registries. There are two of them: the first one describes all the component specifications (&amp;lt;tt&amp;gt;types.rdb&amp;lt;/tt&amp;gt;) and the second translates the implementation into specifications (&amp;lt;tt&amp;gt;services.rdb&amp;lt;/tt&amp;gt;) and is generated from the implementation. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Components creation process====&lt;br /&gt;
The following diagram will help you better understand what should be done to get a component from its specification and sources.  As shown by the diagram, the specifications are compiled and merged into one &amp;lt;tt&amp;gt;types.rdb&amp;lt;/tt&amp;gt; registry. &amp;lt;tt&amp;gt;Class&amp;lt;/tt&amp;gt; files are generated from that file to translate the specifications into a Java class definition file which is built with the implementation into a class using the &amp;lt;tt&amp;gt;java&amp;lt;/tt&amp;gt; compiler. All the classes are delivered as a &amp;lt;tt&amp;gt;jar&amp;lt;/tt&amp;gt; file with a specific manifest as we will see further in this tutorial. This doesn&amp;#039;t make a usable OpenOffice.org: the &amp;lt;tt&amp;gt;types.rdb&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;jar&amp;lt;/tt&amp;gt; file will have to be zipped into a &amp;lt;tt&amp;gt;.uno.pkg&amp;lt;/tt&amp;gt; file described with another manifest.&lt;br /&gt;
&lt;br /&gt;
[[Image:CompilationChain.png|center|UNO component build chain]]&lt;br /&gt;
&lt;br /&gt;
As I will explain later, the Eclipse plugin will hide some of these operations, however you will need to know how they work to fully understand the build process and what we will do in the following steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Installing the development platform===&lt;br /&gt;
Now that you know what to do, we will install and configure the development tools. This is quite simple, but you can run into some problems if you do not read the following information carefully. I will now assume that you have none of the development tools. The minimum requirements for OpenOffice.org Eclipse integration are:&lt;br /&gt;
&lt;br /&gt;
*OpenOffice.org 2.0&lt;br /&gt;
*OpenOffice.org SDK 2.0.4&lt;br /&gt;
*Eclipse 3.2&lt;br /&gt;
*Java 1.5 (the GNU Java does not work with the Eclipse integration)&lt;br /&gt;
&lt;br /&gt;
====OpenOffice.org====&lt;br /&gt;
First of all, you will need to have a working OpenOffice.org 2.0 and its Software Development Kit (SDK). The latest versions are available on the [http://download.openoffice.org/ OpenOffice.org download pages] for the most current platforms. The OpenOffice.org SDK version 2.0.4 is mandatory to use the plugin correctly. It includes a new tool used by the plugin: the &amp;lt;tt&amp;gt;uno-skeletonmaker&amp;lt;/tt&amp;gt;. This tool will generate the implementation skeleton to help you to concentrate only on your code.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;This tutorial assumes that you used the &amp;quot;Official&amp;quot; OpenOffice.org distribution&amp;#039;&amp;#039;&amp;#039; from the project&amp;#039;s website. Other distributions may not work with the Eclipse integration (see the trouble shooting section at the end of this page).&lt;br /&gt;
&lt;br /&gt;
====Eclipse and the plugin====&lt;br /&gt;
To get Eclipse, just go to their download pages and download the latest Eclipse SDK. You will have Eclipse and its SDK. Of course, you might want to download only the binary runtime, but you will have to follow more links. Once you have Eclipse, unzip it on your computer and that&amp;#039;s it: Eclipse has a Java plugin to help you program in Java.&lt;br /&gt;
&lt;br /&gt;
Now we will install the OpenOffice.org development plugin for Eclipse using the Eclipse software update system. &amp;#039;&amp;#039;&amp;#039;Do not try to download an archive from somewhere. Eclipse will do it for you when you do the following steps.&amp;#039;&amp;#039;&amp;#039; Select the &amp;#039;&amp;#039;&amp;#039;Help &amp;gt; Software updates &amp;gt; Find and install&amp;#039;&amp;#039;&amp;#039; menu to get the window shown in the following illustration. Check the second option on this window and click on the &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039; button.&lt;br /&gt;
&lt;br /&gt;
[[Image:InstallWindow.png|center|&amp;quot;Find &amp;amp; Install&amp;quot; window]]&lt;br /&gt;
&lt;br /&gt;
On the following page, you will see a list of &amp;quot;&amp;#039;&amp;#039;update sites&amp;#039;&amp;#039;&amp;quot;. These are URLs pointing to directories containing plugins informations and archives. Now click on the &amp;#039;&amp;#039;&amp;#039;Add remote site&amp;#039;&amp;#039;&amp;#039; button to get a small window asking for a name that will be displayed in the list and an URL. The URL of OpenOffice.org plugin update site is http://cedric.bosdonnat.free.fr/ooeclipseintegration. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Do not try to download an archive from this URL. This is the plugin update site for Eclipse.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Validate the new update site parameters and be sure that the OpenOffice.org site is checked before clicking on the &amp;#039;&amp;#039;&amp;#039;Finish&amp;#039;&amp;#039;&amp;#039; button. You should now see a window like the one in the following illustration. &amp;#039;&amp;#039;&amp;#039;Select the OpenOffice.org plugin Core and Java plugins&amp;#039;&amp;#039;&amp;#039;, click Next and let the wizard guide you through the end of the process. You will be asked to accept the plugin license and validate the installation archives which are not signed.&lt;br /&gt;
&lt;br /&gt;
[[Image:PluginUpdates.png|center|OpenOffice.org update site contents]]&lt;br /&gt;
&lt;br /&gt;
Congratulations, you have installed the OpenOffice.org plugin successfully. Now you must configure it. The following steps will guide you through this task. Go to the Eclipse options via the &amp;#039;&amp;#039;&amp;#039;Window &amp;gt; Preferences...&amp;#039;&amp;#039;&amp;#039; menu. In the list on the left, select the &amp;#039;&amp;#039;&amp;#039;OpenOffice.org plugin &amp;gt; SDK Configuration&amp;#039;&amp;#039;&amp;#039; item to get a window like the one shown in the following illustration.&lt;br /&gt;
&lt;br /&gt;
[[Image:UnoProperties.png|center|SDK configuration window]]&lt;br /&gt;
&lt;br /&gt;
In this window you will have to configure the path to your OpenOffice.org and to its SDK. So, let us begin with the SDK path: click on the &amp;#039;&amp;#039;&amp;#039;Add&amp;#039;&amp;#039;&amp;#039; button next to the SDKs list. You will have a window like the one shown in following illustration. Browse to your OpenOffice.org 2.0 SDK and validate. Then you will have to do the same for the OpenOffice.org path using the other &amp;#039;&amp;#039;&amp;#039;Add&amp;#039;&amp;#039;&amp;#039; button.&lt;br /&gt;
&lt;br /&gt;
Note that a URE installation can be selected instead of a complete OpenOffice.org installation. Please refer to the Java URE application tutorial for more details on the plugin&amp;#039;s URE support.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;If you are using Windows, please make sure that the path to the SDK does not contains any spaces.  Spaces in the path can cause problems when you build your UNO projects.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:SdkConfig.png|center|New SDK path window]]&lt;br /&gt;
&lt;br /&gt;
Now your OpenOffice.org plugin is ready to work. You can begin to create your new component. If there was any problem during the plugin installation, please report it to the dev@api.openoffice.org [http://api.openoffice.org/servlets/ProjectMailingListList mailing-list].&lt;br /&gt;
&lt;br /&gt;
==Creating a new component==&lt;br /&gt;
For the Eclipse plugin, a UNO component is a UNO project. This tutorial will explain how to easily create a new UNO component using the Eclipse plugin. We will now assume that you have very simple needs. The component that will be created is a &amp;quot;Hello world&amp;quot; service and its implementation. Creating a component that defines and implements more services is a bit more complex and requires advanced Java UNO knowledge.&lt;br /&gt;
&lt;br /&gt;
There are several ways to create a UNO component project using the plugin: &lt;br /&gt;
&lt;br /&gt;
*The first one is the &amp;#039;&amp;#039;&amp;#039;File &amp;gt; New &amp;gt; Project&amp;#039;&amp;#039;&amp;#039; menu entry and choose the &amp;#039;&amp;#039;&amp;#039;UNO &amp;gt; UNO-IDL Project&amp;#039;&amp;#039;&amp;#039; item as shown by the following illustration.&lt;br /&gt;
&lt;br /&gt;
[[Image:NewUnoProjectsItems.png|center|New UNO-IDL project item]]&lt;br /&gt;
&lt;br /&gt;
*The second one is the icon in the toolbar representing a blue folder with a star as shown by the following illustration.&lt;br /&gt;
&lt;br /&gt;
[[Image:NewUnoProjectIcon.png|center|New UNO-IDL project icon]]&lt;br /&gt;
&lt;br /&gt;
Then you only have to follow the wizard to create your UNO component project, its specification and a skeleton of the implementation. This wizard is composed of several pages:&lt;br /&gt;
&lt;br /&gt;
*The main configuration page to define the general project properties.&lt;br /&gt;
*The implementation language configuration page.&lt;br /&gt;
*The service configuration page.&lt;br /&gt;
*The interface configuration page.&lt;br /&gt;
After all these steps you will have a running component... doing nothing. The following sections will describe the different wizard pages and where to place your code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===The project configuration page===&lt;br /&gt;
The first page in the project wizard is the only page containing fields that must be filled in. All the others have default values to help you through the component creation. In our case, we will cover all the pages in the wizard to explain them all and define some new methods and attributes in our component.&lt;br /&gt;
&lt;br /&gt;
[[Image:NewUnoProject.jpg|center|New UNO-IDL project wizard page]]&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Project name:&amp;#039;&amp;#039;&amp;#039; is the component name, in our case, it will be &amp;quot;&amp;#039;&amp;#039;Helloworld&amp;#039;&amp;#039;&amp;quot;&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Location:&amp;#039;&amp;#039;&amp;#039; is the directory on your computer where the project will be created. You can change the default one by deselecting the &amp;#039;&amp;#039;&amp;#039;Use default&amp;#039;&amp;#039;&amp;#039; check box. The default location of each Eclipse project is a directory with your project name in the current Eclipse workspace. &amp;#039;&amp;#039;&amp;#039;Please do not use spaces in this path on Windows.  Spaces in the path can prevent your component from being built.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Root package:&amp;#039;&amp;#039;&amp;#039; is the name of the first module of your component. It is generally composed of two parts: the vendor name (here &amp;lt;tt&amp;gt;org.openoffice&amp;lt;/tt&amp;gt;) and the project name (here &amp;lt;tt&amp;gt;helloworld&amp;lt;/tt&amp;gt;).&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Used SDK:&amp;#039;&amp;#039;&amp;#039; selects the OpenOffice.org SDK which will be used to develop the component. You generally will have only one SDK in the list, but you can add others in the preferences or by clicking on the &amp;#039;&amp;#039;&amp;#039;Configure SDKs&amp;#039;&amp;#039;&amp;#039; button.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Used OOo:&amp;#039;&amp;#039;&amp;#039; selects the version of OpenOffice.org to use to develop the component. Just as with the SDK, you will generally have only one entry in the list, but you can add others in the preferences or by clicking on the OOo Installations button.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Programming language:&amp;#039;&amp;#039;&amp;#039; selects the programming language for the component implementation. For the moment, there is only Java available, however C++ and python are planned.&lt;br /&gt;
&lt;br /&gt;
===The implementation language configuration page===&lt;br /&gt;
This page depends on the chosen language. For Java, the default values should be kept: they define which class is the main class of the component. The component&amp;#039;s main class contains some code mapping the services to their implementation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===The service configuration page===&lt;br /&gt;
&lt;br /&gt;
[[Image:Eclipse_Service_Page.png|center|Service configuration page]]&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Module:&amp;#039;&amp;#039;&amp;#039; corresponds to the UNO-IDL module where to add the interface. If the text field is left empty, the interface will be added in the root module of the component (filled in the project wizard).&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Service name:&amp;#039;&amp;#039;&amp;#039; is the service name. By keeping the default value, you will be able to define your own interface using the interface configuration page. Otherwise, you can reuse an existing interface.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Published&amp;#039;&amp;#039;&amp;#039;: specifies if the interface is published or not. The published notion is translated into a keyword in UNO-IDL language. Declaring a UNO-IDL type as published means that it will not change in future releases. We will keep it unchecked because our component is really far from being a stable API.&lt;br /&gt;
&lt;br /&gt;
===The interface configuration page===&lt;br /&gt;
&lt;br /&gt;
[[Image:NewInterfacePage.png|center|Interface configuration page]]&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Module:&amp;#039;&amp;#039;&amp;#039; corresponds to the UNO-IDL module where the interface is added. If the text field is left empty, the interface will be added in the root module of the component (filled in the project wizard).&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Interface name:&amp;#039;&amp;#039;&amp;#039; is the interface name. By convention, we generally name an interface beginning with an &amp;quot;X&amp;quot;. In this tutorial, the interface will be named &amp;lt;tt&amp;gt;XHelloworld&amp;lt;/tt&amp;gt;.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Inherited interfaces:&amp;#039;&amp;#039;&amp;#039; is a list of all the interfaces from which the one that is about to be created will inherit. This is one of the changes in UNO-IDL between OpenOffice.org 1.1.x and 2.0, and why the plugin does not support OpenOffice.org versions prior to 2.0. All the UNO-IDL interfaces are inheriting more or less directly from the &amp;lt;tt&amp;gt;com::sun::star::uno::XInterface&amp;lt;/tt&amp;gt; type. As the &amp;lt;tt&amp;gt;XHelloworld&amp;lt;/tt&amp;gt; interface is very easy, no super interface will be added. This will implicitly define &amp;lt;tt&amp;gt;XInterface&amp;lt;/tt&amp;gt; as the only parent for the new interface. &lt;br /&gt;
**&amp;#039;&amp;#039;&amp;#039;&amp;quot;?&amp;quot; column:&amp;#039;&amp;#039;&amp;#039; specifies if the interface inheritance is mandatory or not. If the box is checked, the interface inheritance is optional and may not be implemented.&lt;br /&gt;
**&amp;#039;&amp;#039;&amp;#039;&amp;quot;Add&amp;quot; and &amp;quot;Del&amp;quot; buttons:&amp;#039;&amp;#039;&amp;#039; allows you to add an interface to the inherited ones or remove the selected interface.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Members:&amp;#039;&amp;#039;&amp;#039; is a list of all the methods and properties of the interface. See below for explanations about the members. In this tutorial, just create one &amp;lt;tt&amp;gt;string sayHello([in] boolean isBadBoy)&amp;lt;/tt&amp;gt; method and a &amp;lt;tt&amp;gt;LadyName&amp;lt;/tt&amp;gt; property.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Published:&amp;#039;&amp;#039;&amp;#039; specifies if the interface is published or not. The published notion is translated into a keyword in UNO-IDL language. Declaring a UNO-IDL type as published means that it will not change in future releases. We will keep it unchecked because our component is really far from being a stable API.&lt;br /&gt;
A UNO interface can contain two kind of members: methods and properties. When clicking on the &amp;#039;&amp;#039;&amp;#039;Add&amp;#039;&amp;#039;&amp;#039; button near the members&amp;#039; list, the following window will be shown. When double-clicking on a line in the members&amp;#039; list, you will edit the corresponding member through the same window.&lt;br /&gt;
&lt;br /&gt;
When the window is opened to create a new member, you can choose whether the member will be a property or a method. The name and returned type fields are always present, but the lower part of the dialog is different for a method and a property.&lt;br /&gt;
&lt;br /&gt;
[[Image:Eclipse_Interface_Members_Dialog.png|center|Interface member creation dialog]]&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;The arguments list:&amp;#039;&amp;#039;&amp;#039; defines the name, type and direction of the parameters of the method. Simply click on the cell to edit it.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Read-only and Bound check boxes:&amp;#039;&amp;#039;&amp;#039; selecting these boxes sets the corresponding IDL flag on the property.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Tip:&amp;#039;&amp;#039;&amp;#039; you can use &amp;#039;&amp;#039;&amp;lt;tt&amp;gt;&amp;#039;&amp;#039;Ctrl+Space&amp;#039;&amp;#039;&amp;lt;/tt&amp;gt;&amp;#039;&amp;#039; to complete the type name in the &amp;#039;&amp;#039;&amp;#039;Return type&amp;#039;&amp;#039;&amp;#039; field and &amp;#039;&amp;#039;&amp;#039;Type&amp;#039;&amp;#039;&amp;#039; column.&lt;br /&gt;
&lt;br /&gt;
===Writing the implementation===&lt;br /&gt;
After having completed the wizard, you need to write the component implementation. Hopefully a skeleton has been generated and opened. You need to complete the code where there are some TODOS. The generated project contains the following directories and files:&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;source:&amp;#039;&amp;#039;&amp;#039; directory containing your Java implementation classes.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;build:&amp;#039;&amp;#039;&amp;#039; directory containing all the generated temporary files, such as the results of the specification files (&amp;lt;tt&amp;gt;.idl&amp;lt;/tt&amp;gt; files) compilation (&amp;lt;tt&amp;gt;.urd&amp;lt;/tt&amp;gt; files) or the class files corresponding to the specifications (&amp;lt;tt&amp;gt;.class&amp;lt;/tt&amp;gt; files).&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;idl:&amp;#039;&amp;#039;&amp;#039; directory containing the specifications of the component.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;types.rdb:&amp;#039;&amp;#039;&amp;#039; generated UNO types registry from which the classes files will be generated.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;JRE and the jars:&amp;#039;&amp;#039;&amp;#039; describe the classpath of the component. They are visible only in the Java package explorer. The OpenOffice.org jars are changed if the OpenOffice.org version associated to the project is changed. &amp;#039;&amp;#039;In a future version, they will be packed in a user library to take less space in the tree.&amp;#039;&amp;#039;&lt;br /&gt;
The generated skeleton already contains the methods for the implementation registration. The only things to modify are:&lt;br /&gt;
&lt;br /&gt;
*Change the code of the setters and getters for the defined properties.&lt;br /&gt;
*Change the code of the defined methods.&lt;br /&gt;
The Eclipse integration even manages the libraries needed by your implementation. Let us imagine that we want to use the &amp;lt;tt&amp;gt;Fraction&amp;lt;/tt&amp;gt; class from the Apache &amp;lt;tt&amp;gt;common-math&amp;lt;/tt&amp;gt; jar. Download this jar from the Apache website, and import the &amp;lt;tt&amp;gt;common-math-1.1.jar&amp;lt;/tt&amp;gt; file into your component project, for example in a &amp;lt;tt&amp;gt;lib&amp;lt;/tt&amp;gt; directory. Add the jar to the project build path in the same way than in any other Eclipse Java project and use it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[java]&lt;br /&gt;
    // org.openoffice.helloworld.XHelloworld:&lt;br /&gt;
    private String mLadyName = &amp;quot;&amp;quot;;&lt;br /&gt;
    &lt;br /&gt;
    public String getLadyName()&lt;br /&gt;
    {&lt;br /&gt;
        return mLadyName;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public void setLadyName(String the_value)&lt;br /&gt;
    {&lt;br /&gt;
        mLadyName = the_value;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public String sayHello(boolean isBadBoy)&lt;br /&gt;
    {&lt;br /&gt;
    	String hello = &amp;quot;Hello Mrs. &amp;quot; + getLadyName();&lt;br /&gt;
        if (isBadBoy) {&lt;br /&gt;
        	Fraction f = new Fraction(1, 3);&lt;br /&gt;
        	hello = &amp;quot;A third is &amp;quot; + f.doubleValue();&lt;br /&gt;
        }&lt;br /&gt;
        return hello;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The above code shows you what could be an implementation of our component. Now, there is only to package it properly and test it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Packaging and testing the component==&lt;br /&gt;
Now we will show you how to export your component into an OpenOffice.org package. There is little to do apart from following these steps:&lt;br /&gt;
&lt;br /&gt;
*Select the &amp;#039;&amp;#039;&amp;#039;File &amp;gt; Export&amp;#039;&amp;#039;&amp;#039; menu. Then choose the &amp;#039;&amp;#039;&amp;#039;UNO &amp;gt; OpenOffice.org&amp;#039;&amp;#039;&amp;#039; package export type.&lt;br /&gt;
*The next page of the wizard asks for the UNO project to export (already selected), the directory where to export the package and the OpenOffice.org minimum compatibility version for the package. Depending of the selected OpenOffice.org version, the package will get a different name and a different structure.&lt;br /&gt;
*Click on the Finish button. The wizard will ask you whether to deploy to package or not and asks for the old package removal if needed.&lt;br /&gt;
Then we will suppose that the package is deployed on the OpenOffice.org installation and we will test it using the following &amp;lt;tt&amp;gt;OooBasic&amp;lt;/tt&amp;gt; macro.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
Sub testHelloworld&lt;br /&gt;
	oHelloworld = createUnoService( &amp;quot;org.openoffice.helloworld.Helloworld&amp;quot; )&lt;br /&gt;
	oHelloworld.LadyName = &amp;quot;Robinson&amp;quot;&lt;br /&gt;
	print oHelloworld.sayHello( false )&lt;br /&gt;
	print oHelloworld.sayHello( True )&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This macro should open two message windows with &amp;#039;&amp;#039;&amp;quot;Hello Mrs. Robinson&amp;quot;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;quot;A third is 0.3333333&amp;quot;&amp;#039;&amp;#039;. Your first UNO component is now running, enjoy doing others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Going further==&lt;br /&gt;
This chapter is only for those who enjoyed this tutorial and want to know more about the UNO component creation in Java or other languages. The following is a list of useful links for any UNO developer:&lt;br /&gt;
&lt;br /&gt;
*[http://api.openoffice.org/docs/DevelopersGuide/DevelopersGuide.xhtml OpenOffice.org developer&amp;#039;s guide] is a huge source of documentation for any OpenOffice.org developer. You should probably have a look at chapters 3 and 4 for UNO component information.&lt;br /&gt;
*[http://api.openoffice.org/docs/java/ref/overview-summary.html OOo Java reference] is the UNO binding for Java reference.&lt;br /&gt;
*[http://api.openoffice.org/docs/cpp/ref/names/index.html OOo C++ reference] is the UNO binding for C++ reference.&lt;br /&gt;
*[http://wiki.services.openoffice.org/ OOo Developer&amp;#039;s Wiki] is the wiki for all the OpenOffice.org developers. It contains useful information even for people who are just starting out with UNO.&lt;br /&gt;
*[http://udk.openoffice.org/common/man/draft/multinherit.html http://udk.openoffice.org/common/man/draft/multinherit.html] for further information on what changes have been made in UNO-IDL between OpenOffice.org 1.1.x and 2.0&lt;br /&gt;
*[http://tools.openoffice.org/autodoc/HowToWriteDocumentation-Cpp.html Autodoc Java reference] is the reference for &amp;lt;tt&amp;gt;javadoc&amp;lt;/tt&amp;gt; like comments in UNO-IDL files.&lt;br /&gt;
*[http://tools.openoffice.org/autodoc/HowToWriteDocumentation-Cpp.html Autodoc C++ documentation] is the reference for &amp;lt;tt&amp;gt;javadoc&amp;lt;/tt&amp;gt; like comments in C++ components.&lt;br /&gt;
*[http://cedric.bosdonnat.free.fr/wordpress/?p=19 URE C++ application tutorial] explains how to create a C++ application based on the URE, that is a UNO C++ component that does not need OpenOffice.org.&lt;br /&gt;
&lt;br /&gt;
==Trouble shooting==&lt;br /&gt;
* If you run into trouble it might be helpful to turn the log level to debug mode. This can be done inside Eclipse via Window &amp;gt; Preferences &amp;gt; OpenOffice.org Integration. The log file can be found in &amp;#039;&amp;#039;$YOURWORKSPACEPATH/.metadata/.log&amp;#039;&amp;#039; .&lt;br /&gt;
* If you plan to use the OpenOffice version that comes with your distribution and run into trouble not getting the skeletons and opening of an external editor you probably have to create a symbolic link to &amp;#039;&amp;#039;/usr/lib/libstlport_gcc.so&amp;#039;&amp;#039; from the official version of libstlport_gcc.so extracted from an official download of OOo. (This works at least for Ubuntu Edgy and Feisty)&lt;br /&gt;
* The 64-Bit version of OOo that&amp;#039;s comes e.g. with Ubuntu AMD64 gives similar errors as the above. As there is no official 64-bit download the above workaround seems not to work. If you get it running please add your solution here.&lt;br /&gt;
* On Unix running &amp;#039;&amp;#039;setsdkenv_unix&amp;#039;&amp;#039; in your SDK directory might helpful as well.&lt;br /&gt;
&lt;br /&gt;
[[Category:Eclipse]]&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:Java]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>Exactt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=JavaEclipseTuto&amp;diff=29257</id>
		<title>JavaEclipseTuto</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=JavaEclipseTuto&amp;diff=29257"/>
		<updated>2007-03-28T10:44:45Z</updated>

		<summary type="html">&lt;p&gt;Exactt: /* OpenOffice.org */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=How to create a Java component with Eclipse=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This paper is a tutorial to guide UNO newcomers through creating their first Java component. This tutorial will use Eclipse and its plugin for the OpenOffice.org development, and every step will be detailed. If you are an experienced UNO programmer, you can still follow this tutorial to have a better view of how to use the Eclipse plugin.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===UNO Components===&lt;br /&gt;
This section will explain some very basic things about UNO components. You can skip it if you already know it. First I will explain what a component is and its main parts. Afterwards, I will explain what is needed to create a UNO component to help you to fully understand the different tools and their use during the tutorial.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Components anatomy====&lt;br /&gt;
&amp;#039;&amp;#039;&amp;quot;A component is a system element offering a predefined service and able to communicate with other components&amp;quot;&amp;#039;&amp;#039; explains [http://fr.wikipedia.org/wiki/composant Wikipedia (Fr)] (Even thought there is a definition on the English wikipedia article, I prefer the French one because of its completeness). In UNOs case a component will generally be delivered as a package containing a library (share library in C++ or jar in Java). For UNO, a component is made of two distinct parts: specifications and an implementation. &lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Specification: &amp;#039;&amp;#039;&amp;#039;definition in a common language of what the component should do. For UNO, this language is called UNO-IDL and is more or less similar to [http://en.wikipedia.org/wiki/Corba Corba] IDL. The documented part that will be provided as an API to use the component is the specification. Thus, it should be complete and implementation independent.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Implementation: &amp;#039;&amp;#039;&amp;#039;is the code that will realize what is described in the component specifications. This programming language can either be C++, Java, Python or others. This is the internal part of the component and will not be accessible from another component.&lt;br /&gt;
In order that UNO knows which implementation corresponds to which specification, the component will use registries. There are two of them: the first one describes all the component specifications (&amp;lt;tt&amp;gt;types.rdb&amp;lt;/tt&amp;gt;) and the second translates the implementation into specifications (&amp;lt;tt&amp;gt;services.rdb&amp;lt;/tt&amp;gt;) and is generated from the implementation. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Components creation process====&lt;br /&gt;
The following diagram will help you better understand what should be done to get a component from its specification and sources.  As shown by the diagram, the specifications are compiled and merged into one &amp;lt;tt&amp;gt;types.rdb&amp;lt;/tt&amp;gt; registry. &amp;lt;tt&amp;gt;Class&amp;lt;/tt&amp;gt; files are generated from that file to translate the specifications into a Java class definition file which is built with the implementation into a class using the &amp;lt;tt&amp;gt;java&amp;lt;/tt&amp;gt; compiler. All the classes are delivered as a &amp;lt;tt&amp;gt;jar&amp;lt;/tt&amp;gt; file with a specific manifest as we will see further in this tutorial. This doesn&amp;#039;t make a usable OpenOffice.org: the &amp;lt;tt&amp;gt;types.rdb&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;jar&amp;lt;/tt&amp;gt; file will have to be zipped into a &amp;lt;tt&amp;gt;.uno.pkg&amp;lt;/tt&amp;gt; file described with another manifest.&lt;br /&gt;
&lt;br /&gt;
[[Image:CompilationChain.png|center|UNO component build chain]]&lt;br /&gt;
&lt;br /&gt;
As I will explain later, the Eclipse plugin will hide some of these operations, however you will need to know how they work to fully understand the build process and what we will do in the following steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Installing the development platform===&lt;br /&gt;
Now that you know what to do, we will install and configure the development tools. This is quite simple, but you can run into some problems if you do not read the following information carefully. I will now assume that you have none of the development tools. The minimum requirements for OpenOffice.org Eclipse integration are:&lt;br /&gt;
&lt;br /&gt;
*OpenOffice.org 2.0&lt;br /&gt;
*OpenOffice.org SDK 2.0.4&lt;br /&gt;
*Eclipse 3.2&lt;br /&gt;
*Java 1.5 (the GNU Java does not work with the Eclipse integration)&lt;br /&gt;
&lt;br /&gt;
====OpenOffice.org====&lt;br /&gt;
First of all, you will need to have a working OpenOffice.org 2.0 and its Software Development Kit (SDK). The latest versions are available on the [http://download.openoffice.org/ OpenOffice.org download pages] for the most current platforms. The OpenOffice.org SDK version 2.0.4 is mandatory to use the plugin correctly. It includes a new tool used by the plugin: the &amp;lt;tt&amp;gt;uno-skeletonmaker&amp;lt;/tt&amp;gt;. This tool will generate the implementation skeleton to help you to concentrate only on your code.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;This tutorial assumes that you used the &amp;quot;Official&amp;quot; OpenOffice.org distribution&amp;#039;&amp;#039;&amp;#039; from the project&amp;#039;s website. Other distributions may not work with the Eclipse integration.&lt;br /&gt;
&lt;br /&gt;
====Eclipse and the plugin====&lt;br /&gt;
To get Eclipse, just go to their download pages and download the latest Eclipse SDK. You will have Eclipse and its SDK. Of course, you might want to download only the binary runtime, but you will have to follow more links. Once you have Eclipse, unzip it on your computer and that&amp;#039;s it: Eclipse has a Java plugin to help you program in Java.&lt;br /&gt;
&lt;br /&gt;
Now we will install the OpenOffice.org development plugin for Eclipse using the Eclipse software update system. &amp;#039;&amp;#039;&amp;#039;Do not try to download an archive from somewhere. Eclipse will do it for you when you do the following steps.&amp;#039;&amp;#039;&amp;#039; Select the &amp;#039;&amp;#039;&amp;#039;Help &amp;gt; Software updates &amp;gt; Find and install&amp;#039;&amp;#039;&amp;#039; menu to get the window shown in the following illustration. Check the second option on this window and click on the &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039; button.&lt;br /&gt;
&lt;br /&gt;
[[Image:InstallWindow.png|center|&amp;quot;Find &amp;amp; Install&amp;quot; window]]&lt;br /&gt;
&lt;br /&gt;
On the following page, you will see a list of &amp;quot;&amp;#039;&amp;#039;update sites&amp;#039;&amp;#039;&amp;quot;. These are URLs pointing to directories containing plugins informations and archives. Now click on the &amp;#039;&amp;#039;&amp;#039;Add remote site&amp;#039;&amp;#039;&amp;#039; button to get a small window asking for a name that will be displayed in the list and an URL. The URL of OpenOffice.org plugin update site is http://cedric.bosdonnat.free.fr/ooeclipseintegration. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Do not try to download an archive from this URL. This is the plugin update site for Eclipse.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Validate the new update site parameters and be sure that the OpenOffice.org site is checked before clicking on the &amp;#039;&amp;#039;&amp;#039;Finish&amp;#039;&amp;#039;&amp;#039; button. You should now see a window like the one in the following illustration. &amp;#039;&amp;#039;&amp;#039;Select the OpenOffice.org plugin Core and Java plugins&amp;#039;&amp;#039;&amp;#039;, click Next and let the wizard guide you through the end of the process. You will be asked to accept the plugin license and validate the installation archives which are not signed.&lt;br /&gt;
&lt;br /&gt;
[[Image:PluginUpdates.png|center|OpenOffice.org update site contents]]&lt;br /&gt;
&lt;br /&gt;
Congratulations, you have installed the OpenOffice.org plugin successfully. Now you must configure it. The following steps will guide you through this task. Go to the Eclipse options via the &amp;#039;&amp;#039;&amp;#039;Window &amp;gt; Preferences...&amp;#039;&amp;#039;&amp;#039; menu. In the list on the left, select the &amp;#039;&amp;#039;&amp;#039;OpenOffice.org plugin &amp;gt; SDK Configuration&amp;#039;&amp;#039;&amp;#039; item to get a window like the one shown in the following illustration.&lt;br /&gt;
&lt;br /&gt;
[[Image:UnoProperties.png|center|SDK configuration window]]&lt;br /&gt;
&lt;br /&gt;
In this window you will have to configure the path to your OpenOffice.org and to its SDK. So, let us begin with the SDK path: click on the &amp;#039;&amp;#039;&amp;#039;Add&amp;#039;&amp;#039;&amp;#039; button next to the SDKs list. You will have a window like the one shown in following illustration. Browse to your OpenOffice.org 2.0 SDK and validate. Then you will have to do the same for the OpenOffice.org path using the other &amp;#039;&amp;#039;&amp;#039;Add&amp;#039;&amp;#039;&amp;#039; button.&lt;br /&gt;
&lt;br /&gt;
Note that a URE installation can be selected instead of a complete OpenOffice.org installation. Please refer to the Java URE application tutorial for more details on the plugin&amp;#039;s URE support.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;If you are using Windows, please make sure that the path to the SDK does not contains any spaces.  Spaces in the path can cause problems when you build your UNO projects.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:SdkConfig.png|center|New SDK path window]]&lt;br /&gt;
&lt;br /&gt;
Now your OpenOffice.org plugin is ready to work. You can begin to create your new component. If there was any problem during the plugin installation, please report it to the dev@api.openoffice.org [http://api.openoffice.org/servlets/ProjectMailingListList mailing-list].&lt;br /&gt;
&lt;br /&gt;
==Creating a new component==&lt;br /&gt;
For the Eclipse plugin, a UNO component is a UNO project. This tutorial will explain how to easily create a new UNO component using the Eclipse plugin. We will now assume that you have very simple needs. The component that will be created is a &amp;quot;Hello world&amp;quot; service and its implementation. Creating a component that defines and implements more services is a bit more complex and requires advanced Java UNO knowledge.&lt;br /&gt;
&lt;br /&gt;
There are several ways to create a UNO component project using the plugin: &lt;br /&gt;
&lt;br /&gt;
*The first one is the &amp;#039;&amp;#039;&amp;#039;File &amp;gt; New &amp;gt; Project&amp;#039;&amp;#039;&amp;#039; menu entry and choose the &amp;#039;&amp;#039;&amp;#039;UNO &amp;gt; UNO-IDL Project&amp;#039;&amp;#039;&amp;#039; item as shown by the following illustration.&lt;br /&gt;
&lt;br /&gt;
[[Image:NewUnoProjectsItems.png|center|New UNO-IDL project item]]&lt;br /&gt;
&lt;br /&gt;
*The second one is the icon in the toolbar representing a blue folder with a star as shown by the following illustration.&lt;br /&gt;
&lt;br /&gt;
[[Image:NewUnoProjectIcon.png|center|New UNO-IDL project icon]]&lt;br /&gt;
&lt;br /&gt;
Then you only have to follow the wizard to create your UNO component project, its specification and a skeleton of the implementation. This wizard is composed of several pages:&lt;br /&gt;
&lt;br /&gt;
*The main configuration page to define the general project properties.&lt;br /&gt;
*The implementation language configuration page.&lt;br /&gt;
*The service configuration page.&lt;br /&gt;
*The interface configuration page.&lt;br /&gt;
After all these steps you will have a running component... doing nothing. The following sections will describe the different wizard pages and where to place your code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===The project configuration page===&lt;br /&gt;
The first page in the project wizard is the only page containing fields that must be filled in. All the others have default values to help you through the component creation. In our case, we will cover all the pages in the wizard to explain them all and define some new methods and attributes in our component.&lt;br /&gt;
&lt;br /&gt;
[[Image:NewUnoProject.jpg|center|New UNO-IDL project wizard page]]&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Project name:&amp;#039;&amp;#039;&amp;#039; is the component name, in our case, it will be &amp;quot;&amp;#039;&amp;#039;Helloworld&amp;#039;&amp;#039;&amp;quot;&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Location:&amp;#039;&amp;#039;&amp;#039; is the directory on your computer where the project will be created. You can change the default one by deselecting the &amp;#039;&amp;#039;&amp;#039;Use default&amp;#039;&amp;#039;&amp;#039; check box. The default location of each Eclipse project is a directory with your project name in the current Eclipse workspace. &amp;#039;&amp;#039;&amp;#039;Please do not use spaces in this path on Windows.  Spaces in the path can prevent your component from being built.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Root package:&amp;#039;&amp;#039;&amp;#039; is the name of the first module of your component. It is generally composed of two parts: the vendor name (here &amp;lt;tt&amp;gt;org.openoffice&amp;lt;/tt&amp;gt;) and the project name (here &amp;lt;tt&amp;gt;helloworld&amp;lt;/tt&amp;gt;).&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Used SDK:&amp;#039;&amp;#039;&amp;#039; selects the OpenOffice.org SDK which will be used to develop the component. You generally will have only one SDK in the list, but you can add others in the preferences or by clicking on the &amp;#039;&amp;#039;&amp;#039;Configure SDKs&amp;#039;&amp;#039;&amp;#039; button.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Used OOo:&amp;#039;&amp;#039;&amp;#039; selects the version of OpenOffice.org to use to develop the component. Just as with the SDK, you will generally have only one entry in the list, but you can add others in the preferences or by clicking on the OOo Installations button.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Programming language:&amp;#039;&amp;#039;&amp;#039; selects the programming language for the component implementation. For the moment, there is only Java available, however C++ and python are planned.&lt;br /&gt;
&lt;br /&gt;
===The implementation language configuration page===&lt;br /&gt;
This page depends on the chosen language. For Java, the default values should be kept: they define which class is the main class of the component. The component&amp;#039;s main class contains some code mapping the services to their implementation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===The service configuration page===&lt;br /&gt;
&lt;br /&gt;
[[Image:Eclipse_Service_Page.png|center|Service configuration page]]&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Module:&amp;#039;&amp;#039;&amp;#039; corresponds to the UNO-IDL module where to add the interface. If the text field is left empty, the interface will be added in the root module of the component (filled in the project wizard).&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Service name:&amp;#039;&amp;#039;&amp;#039; is the service name. By keeping the default value, you will be able to define your own interface using the interface configuration page. Otherwise, you can reuse an existing interface.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Published&amp;#039;&amp;#039;&amp;#039;: specifies if the interface is published or not. The published notion is translated into a keyword in UNO-IDL language. Declaring a UNO-IDL type as published means that it will not change in future releases. We will keep it unchecked because our component is really far from being a stable API.&lt;br /&gt;
&lt;br /&gt;
===The interface configuration page===&lt;br /&gt;
&lt;br /&gt;
[[Image:NewInterfacePage.png|center|Interface configuration page]]&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Module:&amp;#039;&amp;#039;&amp;#039; corresponds to the UNO-IDL module where the interface is added. If the text field is left empty, the interface will be added in the root module of the component (filled in the project wizard).&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Interface name:&amp;#039;&amp;#039;&amp;#039; is the interface name. By convention, we generally name an interface beginning with an &amp;quot;X&amp;quot;. In this tutorial, the interface will be named &amp;lt;tt&amp;gt;XHelloworld&amp;lt;/tt&amp;gt;.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Inherited interfaces:&amp;#039;&amp;#039;&amp;#039; is a list of all the interfaces from which the one that is about to be created will inherit. This is one of the changes in UNO-IDL between OpenOffice.org 1.1.x and 2.0, and why the plugin does not support OpenOffice.org versions prior to 2.0. All the UNO-IDL interfaces are inheriting more or less directly from the &amp;lt;tt&amp;gt;com::sun::star::uno::XInterface&amp;lt;/tt&amp;gt; type. As the &amp;lt;tt&amp;gt;XHelloworld&amp;lt;/tt&amp;gt; interface is very easy, no super interface will be added. This will implicitly define &amp;lt;tt&amp;gt;XInterface&amp;lt;/tt&amp;gt; as the only parent for the new interface. &lt;br /&gt;
**&amp;#039;&amp;#039;&amp;#039;&amp;quot;?&amp;quot; column:&amp;#039;&amp;#039;&amp;#039; specifies if the interface inheritance is mandatory or not. If the box is checked, the interface inheritance is optional and may not be implemented.&lt;br /&gt;
**&amp;#039;&amp;#039;&amp;#039;&amp;quot;Add&amp;quot; and &amp;quot;Del&amp;quot; buttons:&amp;#039;&amp;#039;&amp;#039; allows you to add an interface to the inherited ones or remove the selected interface.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Members:&amp;#039;&amp;#039;&amp;#039; is a list of all the methods and properties of the interface. See below for explanations about the members. In this tutorial, just create one &amp;lt;tt&amp;gt;string sayHello([in] boolean isBadBoy)&amp;lt;/tt&amp;gt; method and a &amp;lt;tt&amp;gt;LadyName&amp;lt;/tt&amp;gt; property.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Published:&amp;#039;&amp;#039;&amp;#039; specifies if the interface is published or not. The published notion is translated into a keyword in UNO-IDL language. Declaring a UNO-IDL type as published means that it will not change in future releases. We will keep it unchecked because our component is really far from being a stable API.&lt;br /&gt;
A UNO interface can contain two kind of members: methods and properties. When clicking on the &amp;#039;&amp;#039;&amp;#039;Add&amp;#039;&amp;#039;&amp;#039; button near the members&amp;#039; list, the following window will be shown. When double-clicking on a line in the members&amp;#039; list, you will edit the corresponding member through the same window.&lt;br /&gt;
&lt;br /&gt;
When the window is opened to create a new member, you can choose whether the member will be a property or a method. The name and returned type fields are always present, but the lower part of the dialog is different for a method and a property.&lt;br /&gt;
&lt;br /&gt;
[[Image:Eclipse_Interface_Members_Dialog.png|center|Interface member creation dialog]]&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;The arguments list:&amp;#039;&amp;#039;&amp;#039; defines the name, type and direction of the parameters of the method. Simply click on the cell to edit it.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Read-only and Bound check boxes:&amp;#039;&amp;#039;&amp;#039; selecting these boxes sets the corresponding IDL flag on the property.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Tip:&amp;#039;&amp;#039;&amp;#039; you can use &amp;#039;&amp;#039;&amp;lt;tt&amp;gt;&amp;#039;&amp;#039;Ctrl+Space&amp;#039;&amp;#039;&amp;lt;/tt&amp;gt;&amp;#039;&amp;#039; to complete the type name in the &amp;#039;&amp;#039;&amp;#039;Return type&amp;#039;&amp;#039;&amp;#039; field and &amp;#039;&amp;#039;&amp;#039;Type&amp;#039;&amp;#039;&amp;#039; column.&lt;br /&gt;
&lt;br /&gt;
===Writing the implementation===&lt;br /&gt;
After having completed the wizard, you need to write the component implementation. Hopefully a skeleton has been generated and opened. You need to complete the code where there are some TODOS. The generated project contains the following directories and files:&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;source:&amp;#039;&amp;#039;&amp;#039; directory containing your Java implementation classes.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;build:&amp;#039;&amp;#039;&amp;#039; directory containing all the generated temporary files, such as the results of the specification files (&amp;lt;tt&amp;gt;.idl&amp;lt;/tt&amp;gt; files) compilation (&amp;lt;tt&amp;gt;.urd&amp;lt;/tt&amp;gt; files) or the class files corresponding to the specifications (&amp;lt;tt&amp;gt;.class&amp;lt;/tt&amp;gt; files).&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;idl:&amp;#039;&amp;#039;&amp;#039; directory containing the specifications of the component.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;types.rdb:&amp;#039;&amp;#039;&amp;#039; generated UNO types registry from which the classes files will be generated.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;JRE and the jars:&amp;#039;&amp;#039;&amp;#039; describe the classpath of the component. They are visible only in the Java package explorer. The OpenOffice.org jars are changed if the OpenOffice.org version associated to the project is changed. &amp;#039;&amp;#039;In a future version, they will be packed in a user library to take less space in the tree.&amp;#039;&amp;#039;&lt;br /&gt;
The generated skeleton already contains the methods for the implementation registration. The only things to modify are:&lt;br /&gt;
&lt;br /&gt;
*Change the code of the setters and getters for the defined properties.&lt;br /&gt;
*Change the code of the defined methods.&lt;br /&gt;
The Eclipse integration even manages the libraries needed by your implementation. Let us imagine that we want to use the &amp;lt;tt&amp;gt;Fraction&amp;lt;/tt&amp;gt; class from the Apache &amp;lt;tt&amp;gt;common-math&amp;lt;/tt&amp;gt; jar. Download this jar from the Apache website, and import the &amp;lt;tt&amp;gt;common-math-1.1.jar&amp;lt;/tt&amp;gt; file into your component project, for example in a &amp;lt;tt&amp;gt;lib&amp;lt;/tt&amp;gt; directory. Add the jar to the project build path in the same way than in any other Eclipse Java project and use it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[java]&lt;br /&gt;
    // org.openoffice.helloworld.XHelloworld:&lt;br /&gt;
    private String mLadyName = &amp;quot;&amp;quot;;&lt;br /&gt;
    &lt;br /&gt;
    public String getLadyName()&lt;br /&gt;
    {&lt;br /&gt;
        return mLadyName;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public void setLadyName(String the_value)&lt;br /&gt;
    {&lt;br /&gt;
        mLadyName = the_value;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public String sayHello(boolean isBadBoy)&lt;br /&gt;
    {&lt;br /&gt;
    	String hello = &amp;quot;Hello Mrs. &amp;quot; + getLadyName();&lt;br /&gt;
        if (isBadBoy) {&lt;br /&gt;
        	Fraction f = new Fraction(1, 3);&lt;br /&gt;
        	hello = &amp;quot;A third is &amp;quot; + f.doubleValue();&lt;br /&gt;
        }&lt;br /&gt;
        return hello;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The above code shows you what could be an implementation of our component. Now, there is only to package it properly and test it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Packaging and testing the component==&lt;br /&gt;
Now we will show you how to export your component into an OpenOffice.org package. There is little to do apart from following these steps:&lt;br /&gt;
&lt;br /&gt;
*Select the &amp;#039;&amp;#039;&amp;#039;File &amp;gt; Export&amp;#039;&amp;#039;&amp;#039; menu. Then choose the &amp;#039;&amp;#039;&amp;#039;UNO &amp;gt; OpenOffice.org&amp;#039;&amp;#039;&amp;#039; package export type.&lt;br /&gt;
*The next page of the wizard asks for the UNO project to export (already selected), the directory where to export the package and the OpenOffice.org minimum compatibility version for the package. Depending of the selected OpenOffice.org version, the package will get a different name and a different structure.&lt;br /&gt;
*Click on the Finish button. The wizard will ask you whether to deploy to package or not and asks for the old package removal if needed.&lt;br /&gt;
Then we will suppose that the package is deployed on the OpenOffice.org installation and we will test it using the following &amp;lt;tt&amp;gt;OooBasic&amp;lt;/tt&amp;gt; macro.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
Sub testHelloworld&lt;br /&gt;
	oHelloworld = createUnoService( &amp;quot;org.openoffice.helloworld.Helloworld&amp;quot; )&lt;br /&gt;
	oHelloworld.LadyName = &amp;quot;Robinson&amp;quot;&lt;br /&gt;
	print oHelloworld.sayHello( false )&lt;br /&gt;
	print oHelloworld.sayHello( True )&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This macro should open two message windows with &amp;#039;&amp;#039;&amp;quot;Hello Mrs. Robinson&amp;quot;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;quot;A third is 0.3333333&amp;quot;&amp;#039;&amp;#039;. Your first UNO component is now running, enjoy doing others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Going further==&lt;br /&gt;
This chapter is only for those who enjoyed this tutorial and want to know more about the UNO component creation in Java or other languages. The following is a list of useful links for any UNO developer:&lt;br /&gt;
&lt;br /&gt;
*[http://api.openoffice.org/docs/DevelopersGuide/DevelopersGuide.xhtml OpenOffice.org developer&amp;#039;s guide] is a huge source of documentation for any OpenOffice.org developer. You should probably have a look at chapters 3 and 4 for UNO component information.&lt;br /&gt;
*[http://api.openoffice.org/docs/java/ref/overview-summary.html OOo Java reference] is the UNO binding for Java reference.&lt;br /&gt;
*[http://api.openoffice.org/docs/cpp/ref/names/index.html OOo C++ reference] is the UNO binding for C++ reference.&lt;br /&gt;
*[http://wiki.services.openoffice.org/ OOo Developer&amp;#039;s Wiki] is the wiki for all the OpenOffice.org developers. It contains useful information even for people who are just starting out with UNO.&lt;br /&gt;
*[http://udk.openoffice.org/common/man/draft/multinherit.html http://udk.openoffice.org/common/man/draft/multinherit.html] for further information on what changes have been made in UNO-IDL between OpenOffice.org 1.1.x and 2.0&lt;br /&gt;
*[http://tools.openoffice.org/autodoc/HowToWriteDocumentation-Cpp.html Autodoc Java reference] is the reference for &amp;lt;tt&amp;gt;javadoc&amp;lt;/tt&amp;gt; like comments in UNO-IDL files.&lt;br /&gt;
*[http://tools.openoffice.org/autodoc/HowToWriteDocumentation-Cpp.html Autodoc C++ documentation] is the reference for &amp;lt;tt&amp;gt;javadoc&amp;lt;/tt&amp;gt; like comments in C++ components.&lt;br /&gt;
*[http://cedric.bosdonnat.free.fr/wordpress/?p=19 URE C++ application tutorial] explains how to create a C++ application based on the URE, that is a UNO C++ component that does not need OpenOffice.org.&lt;br /&gt;
&lt;br /&gt;
[[Category:Eclipse]]&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:Java]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>Exactt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=JavaEclipseTuto&amp;diff=28347</id>
		<title>JavaEclipseTuto</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=JavaEclipseTuto&amp;diff=28347"/>
		<updated>2007-03-16T23:11:02Z</updated>

		<summary type="html">&lt;p&gt;Exactt: /* Eclipse and the plugin */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=How to create a Java component with Eclipse=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This paper is a tutorial to guide UNO newcomers to create their first Java component. This tutorial will use Eclipse and it&amp;#039;s plugin for the OpenOffice.org development. Of course, every step will be detailed, but if your are still an experienced UNO programmer, you can have a look at the next pages to have a better view of how to use the Eclipse plugin.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===UNO Components===&lt;br /&gt;
This section will explain some very basic things about UNO components. You might skip it if you already know it. First I will explain what is a component and it&amp;#039;s mains parts. Afterwards, I will explain what is needed to create a UNO component to help you to fully understand the different tools and their use during the tutorial.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Components anatomy====&lt;br /&gt;
&amp;#039;&amp;#039;&amp;quot;A component is a system element offering a predefined service and able to communicate with other components&amp;quot;&amp;#039;&amp;#039; explains [http://fr.wikipedia.org/wiki/composant Wikipedia (Fr)] (Even thought there is a definition on the English wikipedia article, I prefer the French one because of it completeness). In UNO case a component will generally be delivered as a package containing a library (share library in C++ or jar in Java). For UNO a component is made of two distinct parts: specifications and an implementation. &lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Specification: &amp;#039;&amp;#039;&amp;#039;definition in a common language of what the component should do. For UNO, this language is called UNO-IDL and is more or less similar to [http://en.wikipedia.org/wiki/Corba Corba] IDL. The documented part that will be provided as an API to use the component is the specification. Thus it should be complete and implementation independent.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Implementation: &amp;#039;&amp;#039;&amp;#039;is the code that will realize what is described in the component specifications. This programming language can either be C++, Java, Python or some others. This is the internal part of the component and will not be accessible from another component.&lt;br /&gt;
In order UNO knows which implementation corresponds to which specification, the component will use registries. There are two of them: the first one describes all the component specifications (&amp;lt;tt&amp;gt;types.rdb&amp;lt;/tt&amp;gt;) and the second translates the implementation into specifications (&amp;lt;tt&amp;gt;services.rdb&amp;lt;/tt&amp;gt;) and is generated from the implementation. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Components creation process====&lt;br /&gt;
To help you better understand what should be done to get a component from it&amp;#039;s specification and sources, you should have a look at the next illustration. As shown by the diagram, the specifications are compiled and merged into one &amp;lt;tt&amp;gt;types.rdb&amp;lt;/tt&amp;gt; registry. &amp;lt;tt&amp;gt;Class&amp;lt;/tt&amp;gt; files are generated from that file to translate the specifications into a Java class definition file which is build with the implementation into class using the &amp;lt;tt&amp;gt;java&amp;lt;/tt&amp;gt; compiler. All the classes are delivered as a &amp;lt;tt&amp;gt;jar&amp;lt;/tt&amp;gt; file with a specific manifest as we will see further in this tutorial. This doesn&amp;#039;t make a usable OpenOffice.org: the &amp;lt;tt&amp;gt;types.rdb&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;jar&amp;lt;/tt&amp;gt; file will have to be zipped into a &amp;lt;tt&amp;gt;.uno.pkg&amp;lt;/tt&amp;gt; file described with another manifest.&lt;br /&gt;
&lt;br /&gt;
[[Image:CompilationChain.png|center|UNO component build chain]]&lt;br /&gt;
&lt;br /&gt;
As I will explain it later, the Eclipse plugin will hide some of these operations, however you will need to know how they work to fully understand the build process and what we will do in the next steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Installing the development platform===&lt;br /&gt;
Now that you perfectly know what to do, we will install and configure the development tools. This is quite simple but you might be trapped into some problems if you don&amp;#039;t read the next lines carefully. I will now assume that you have none of the development tools. The OpenOffice.org Eclipse integration minimal requirements are the following one:&lt;br /&gt;
&lt;br /&gt;
*OpenOffice.org 2.0&lt;br /&gt;
*OpenOffice.org SDK 2.0.4&lt;br /&gt;
*Eclipse 3.2&lt;br /&gt;
*Java 1.5 (the GNU Java doesn&amp;#039;t work with the Eclipse integration)&lt;br /&gt;
&lt;br /&gt;
====OpenOffice.org====&lt;br /&gt;
First of all, you will need to have a working OpenOffice.org 2.0 and its Software Development Kit (SDK). The last versions are available on the [http://download.openoffice.org/ OpenOffice.org download pages] for the most current platforms. The OpenOffice.org SDK version 2.0.4 is mandatory to use the plugin correctly. It includes a new tool used by the plugin: the &amp;lt;tt&amp;gt;uno-skeletonmaker&amp;lt;/tt&amp;gt;. This tool will generate the implementation skeleton to help you to concentrate only on your code.&lt;br /&gt;
&lt;br /&gt;
This tutorial assumes that you used the &amp;quot;Official&amp;quot; OpenOffice.org distribution from the project&amp;#039;s website. Other distributions may not work with the Eclipse integration.&lt;br /&gt;
&lt;br /&gt;
====Eclipse and the plugin====&lt;br /&gt;
To get Eclipse, just get to their download pages and download the last Eclipse SDK. You will have Eclipse and it&amp;#039;s SDK. Of course, you might want to download only the binary runtime, but you will have to follow more links. Once you have Eclipse, unzip it on your computer and that&amp;#039;s it: eclipse has a Java plugin to help you program in Java.&lt;br /&gt;
&lt;br /&gt;
Now we will install the OpenOffice.org development plugin for Eclipse using the Eclipse software update system. &amp;#039;&amp;#039;&amp;#039;Do not try to download an archive somewhere: Eclipse will do it for you during the next steps.&amp;#039;&amp;#039;&amp;#039; Select the &amp;#039;&amp;#039;&amp;#039;Help &amp;gt; Software updates &amp;gt; Find and install&amp;#039;&amp;#039;&amp;#039; menu to get the window of the next illustration. Check the second option on this window and click on the &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039; button.&lt;br /&gt;
&lt;br /&gt;
[[Image:InstallWindow.png|center|&amp;quot;Find &amp;amp; Install&amp;quot; window]]&lt;br /&gt;
&lt;br /&gt;
On the following page, you will see a list of &amp;quot;&amp;#039;&amp;#039;update sites&amp;#039;&amp;#039;&amp;quot;. These are URLs pointing to directories containing plugins informations and archives. Now click on the &amp;#039;&amp;#039;&amp;#039;Add remote site&amp;#039;&amp;#039;&amp;#039; button to get a small window asking for a name that will be displayed in the list and an URL. The URL of OpenOffice.org plugin update site is http://cedric.bosdonnat.free.fr/ooeclipseintegration. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Do not hope to get an archive to download here: it&amp;#039;s the update site for Eclipse.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Then validate the new update site parameters and be sure that the OpenOffice.org site is checked before clicking on the &amp;#039;&amp;#039;&amp;#039;Finish&amp;#039;&amp;#039;&amp;#039; button. You should now see a window like the one of the next illustration. &amp;#039;&amp;#039;&amp;#039;Select the OpenOffice.org plugin Core and Java plugins&amp;#039;&amp;#039;&amp;#039;, click next and let the wizard guide you through the end of the process. You will be asked to accept the plugin licence and validate the installation archives which are not signed.&lt;br /&gt;
&lt;br /&gt;
[[Image:PluginUpdates.png|center|OpenOffice.org update site contents]]&lt;br /&gt;
&lt;br /&gt;
Congratulations, you have installed the OpenOffice.org plugin successfully, there is now to configure it. The following steps will guide you through this task. Go to the Eclipse options via the &amp;#039;&amp;#039;&amp;#039;Window &amp;gt; Preferences...&amp;#039;&amp;#039;&amp;#039; menu. In the list on the left, select the &amp;#039;&amp;#039;&amp;#039;OpenOffice.org plugin &amp;gt; SDK configuration&amp;#039;&amp;#039;&amp;#039; item to get a window like the one shown by the next illustration.&lt;br /&gt;
&lt;br /&gt;
[[Image:UnoProperties.png|center|SDK configuration window]]&lt;br /&gt;
&lt;br /&gt;
In this window you will have to configure the path to your OpenOffice.org and to it&amp;#039;s SDK. So let us begin with the SDK path: click on the &amp;#039;&amp;#039;&amp;#039;Add&amp;#039;&amp;#039;&amp;#039; button next to the SDKs list. You will have a window like the next illustration, browse to your OpenOffice.org 2.0 SDK and validate. Then you will have to do the same for the OpenOffice.org path using the other &amp;#039;&amp;#039;&amp;#039;Add&amp;#039;&amp;#039;&amp;#039; button.&lt;br /&gt;
&lt;br /&gt;
Note that a URE installation can be selected instead of a complete OpenOffice.org installation. Please report to the Java URE application tutorial for more details on the plugin&amp;#039;s URE support.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Please make sure that the path to the SDK doesn&amp;#039;t contains any space on Windows: it could cause some problems when building your UNO projects afterwards.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:SdkConfig.png|center|New SDK path window]]&lt;br /&gt;
&lt;br /&gt;
Now your OpenOffice.org plugin is ready to work: you can begin to create your new component. If there was any problem during the plugin installation, do not hesitate to report it to the dev@api.openoffice.org [http://api.openoffice.org/servlets/ProjectMailingListList mailing-list].&lt;br /&gt;
&lt;br /&gt;
==Creating a new component==&lt;br /&gt;
For the Eclipse plugin, a UNO component is a UNO project. This tutorial will explain how to easily create a new UNO component using the Eclipse plugin. We will now assume that you have very simple needs: the component that will be created is a &amp;quot;Hello world&amp;quot; service and its implementation. Creating a component defining and implementing more services is a bit more complex and need advanced Java UNO knowledge.&lt;br /&gt;
&lt;br /&gt;
There are several ways to create a UNO component project using the plugin: &lt;br /&gt;
&lt;br /&gt;
*the first one is the &amp;#039;&amp;#039;&amp;#039;File &amp;gt; New &amp;gt; Project&amp;#039;&amp;#039;&amp;#039; menu entry and choose the &amp;#039;&amp;#039;&amp;#039;UNO &amp;gt; UNO-IDL Project&amp;#039;&amp;#039;&amp;#039; item as shown by the next illustration.&lt;br /&gt;
&lt;br /&gt;
[[Image:NewUnoProjectsItems.png|center|New UNO-IDL project item]]&lt;br /&gt;
&lt;br /&gt;
*the second one is the icon in the toolbar representing a blue folder with a star as show by the next illustration.&lt;br /&gt;
&lt;br /&gt;
[[Image:NewUnoProjectIcon.png|center|New UNO-IDL project icon]]&lt;br /&gt;
&lt;br /&gt;
Then you only have to follow the wizard to create your UNO component project, its specification and a skeleton of implementation. This wizard is composed of several pages:&lt;br /&gt;
&lt;br /&gt;
*The main configuration page to define the general project properties&lt;br /&gt;
*The implementation language configuration page.&lt;br /&gt;
*The service configuration page&lt;br /&gt;
*The interface configuration page&lt;br /&gt;
After all these steps you can get a running component... doing nothing. The next sections will describe the different wizard pages and where to place your code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===The project configuration page===&lt;br /&gt;
The first page in the project wizard is the only page containing fields that need to be filled. All the others have default values to help you through the component creation. In our case, we will need all the pages to explain them all and define some mew methods and attributes in our component.&lt;br /&gt;
&lt;br /&gt;
[[Image:NewUnoProject.jpg|center|New UNO-IDL project wizard page]]&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Project name:&amp;#039;&amp;#039;&amp;#039; is the component name, in our case, it will be &amp;quot;&amp;#039;&amp;#039;Helloworld&amp;#039;&amp;#039;&amp;quot;&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Location:&amp;#039;&amp;#039;&amp;#039; is the directory on your computer where the project will be created. You can change the default one by deselecting the &amp;#039;&amp;#039;&amp;#039;Use default&amp;#039;&amp;#039;&amp;#039; check box. The default location of each Eclipse project is a directory with your project name in the current Eclipse workspace. &amp;#039;&amp;#039;&amp;#039;Please avoid spaces in this path on Windows: it could prevent your component to be built.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Root package:&amp;#039;&amp;#039;&amp;#039; is the name of the first module of your component. It generally composed of two parts: the vendor name (here &amp;lt;tt&amp;gt;org.openoffice&amp;lt;/tt&amp;gt;) and the project name (here &amp;lt;tt&amp;gt;helloworld&amp;lt;/tt&amp;gt;).&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Used SDK:&amp;#039;&amp;#039;&amp;#039; selects the OpenOffice.org SDK which will be used to develop the component. You generally will have only one SDK in the list, but you can add others in the preferences or by clicking on the &amp;#039;&amp;#039;&amp;#039;Configure SDKs&amp;#039;&amp;#039;&amp;#039; button.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Used OOo:&amp;#039;&amp;#039;&amp;#039; selects the version of OpenOffice.org to use to develop the component. As for the SDK, you will generally have only one entry in the list, but you can add others in the preferences or by clicking on the OOo Installations button.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Programming language:&amp;#039;&amp;#039;&amp;#039; selects the programming language for the component implementation. For the moment, there is only Java available, however C++ and python are planned.&lt;br /&gt;
&lt;br /&gt;
===The implementation language configuration page===&lt;br /&gt;
This page depends on the chosen language. For Java, the default values should be kept: they define which class is the main class of the component. The component&amp;#039;s main class contains some code mapping the services to their implementation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===The service configuration page===&lt;br /&gt;
&lt;br /&gt;
[[Image:Eclipse_Service_Page.png|center|Service configuration page]]&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Module:&amp;#039;&amp;#039;&amp;#039; corresponds to the UNO-IDL module where to add the interface. If the text field is left empty, the interface will be added in the root module of the component (filled in the project wizard).&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Service name:&amp;#039;&amp;#039;&amp;#039; is the service name. By keeping the default value, you will be able to define your own interface using the interface configuration page. Otherwise, you can reuse an existing interface.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Published&amp;#039;&amp;#039;&amp;#039;: specifies if the interface is published or not. The published notion is translated into a keyword in UNO-IDL language. Declaring a UNO-IDL type as published means that it will not change in future releases: we will keep it unchecked because our component is really far from being a stable API.&lt;br /&gt;
&lt;br /&gt;
===The interface configuration page===&lt;br /&gt;
&lt;br /&gt;
[[Image:NewInterfacePage.png|center|Interface configuration page]]&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Module:&amp;#039;&amp;#039;&amp;#039; corresponds to the UNO-IDL module where to add the interface. If the text field is left empty, the interface will be added in the root module of the component (filled in the project wizard).&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Interface name:&amp;#039;&amp;#039;&amp;#039; is the interface name. By convention, we generally name a interface beginning with an &amp;quot;X&amp;quot;. In this tutorial case, the interface will be named &amp;lt;tt&amp;gt;XHelloworld&amp;lt;/tt&amp;gt;.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Inherited interfaces:&amp;#039;&amp;#039;&amp;#039; is a list of all the interfaces from which the one that is about to be created will inherit. This is one of the changes in UNO-IDL between OpenOffice.org 1.1.x and 2.0: that is why the plugin does not support OpenOffice.org version prior to 2.0. All the UNO-IDL interfaces are inheriting more or less directly  from the &amp;lt;tt&amp;gt;com::sun::star::uno::XInterface&amp;lt;/tt&amp;gt; type. As the &amp;lt;tt&amp;gt;XHelloworld&amp;lt;/tt&amp;gt; interface is very easy, no super interface will be added: that will implicitly define &amp;lt;tt&amp;gt;XInterface&amp;lt;/tt&amp;gt; as the only parent for the new interface. &lt;br /&gt;
**&amp;#039;&amp;#039;&amp;#039;&amp;quot;?&amp;quot; column:&amp;#039;&amp;#039;&amp;#039; specifies if the interface inheritance is mandatory or not. If the box is checked, thus the interface inheritance is optional and may not be implemented.&lt;br /&gt;
**&amp;#039;&amp;#039;&amp;#039;&amp;quot;Add&amp;quot; and &amp;quot;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;Del&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;quot; buttons:&amp;#039;&amp;#039;&amp;#039; allows to add an interface to the inherited ones or removing the selected interface.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Members:&amp;#039;&amp;#039;&amp;#039; is a list of all the methods and properties of the interface. See the explanations about the members some lines below. In this tutorial, just create one &amp;lt;tt&amp;gt;string sayHello([in] boolean isBadBoy)&amp;lt;/tt&amp;gt; method and a &amp;lt;tt&amp;gt;LadyName&amp;lt;/tt&amp;gt; property.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Published:&amp;#039;&amp;#039;&amp;#039; specifies if the interface is published or not. The published notion is translated into a keyword in UNO-IDL language. Declaring a UNO-IDL type as published means that it will not change in future releases: we will keep it unchecked because our component is really far from being a stable API.&lt;br /&gt;
A UNO interface can contain two kind of members: methods and properties. When clicking on the &amp;#039;&amp;#039;&amp;#039;Add&amp;#039;&amp;#039;&amp;#039; button near the members&amp;#039; list, the following window will be shown. When double-clicking on a line in the members&amp;#039; list, you will edit the corresponding member through the same window.&lt;br /&gt;
&lt;br /&gt;
When the window is opened to create a new member, you can choose whether the member will be a property or a method. The name and returned type fields are always present, but the lower part of the dialog is different for a method and a property.&lt;br /&gt;
&lt;br /&gt;
[[Image:Eclipse_Interface_Members_Dialog.png|center|Interface member creation dialog]]&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;The arguments list:&amp;#039;&amp;#039;&amp;#039; defines the name, type and direction of the parameters of the method. Simply click on the cell to edit it.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Read-only and Bound check boxes:&amp;#039;&amp;#039;&amp;#039; selecting these boxes sets the corresponding IDL flag on the property.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Tip:&amp;#039;&amp;#039;&amp;#039; you can use &amp;#039;&amp;#039;&amp;lt;tt&amp;gt;&amp;#039;&amp;#039;Ctrl+Space&amp;#039;&amp;#039;&amp;lt;/tt&amp;gt;&amp;#039;&amp;#039; to complete the type name in the &amp;#039;&amp;#039;&amp;#039;Return type&amp;#039;&amp;#039;&amp;#039; field and &amp;#039;&amp;#039;&amp;#039;Type&amp;#039;&amp;#039;&amp;#039; column.&lt;br /&gt;
&lt;br /&gt;
===Writing the implementation===&lt;br /&gt;
After having completed the wizard, you need to write the component implementation. Hopefully a skeleton has been generated and opened: you just need to complete the code where there are some TODOS. The generated project contains the following directories and files to know:&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;source:&amp;#039;&amp;#039;&amp;#039; directory containing your Java implementation classes&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;build:&amp;#039;&amp;#039;&amp;#039; directory containing all the generated temporary files, such as the results of the specification files (&amp;lt;tt&amp;gt;.idl&amp;lt;/tt&amp;gt; files) compilation (&amp;lt;tt&amp;gt;.urd&amp;lt;/tt&amp;gt; files) or the class files corresponding to the specifications (&amp;lt;tt&amp;gt;.class&amp;lt;/tt&amp;gt; files)&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;idl:&amp;#039;&amp;#039;&amp;#039; directory containing the specifications of the component&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;types.rdb:&amp;#039;&amp;#039;&amp;#039; generated UNO types registry from which the classes files will be generated&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;JRE and the jars:&amp;#039;&amp;#039;&amp;#039; are describing the classpath of the component. They are visible only in the Java package explorer. The OpenOffice.org jars are changed if the OpenOffice.org version associated to the project is changed. &amp;#039;&amp;#039;In a future version, they will be packed in a user library to take less space in the tree.&amp;#039;&amp;#039;&lt;br /&gt;
The generated skeleton already contains the methods for the implementation registration. The only things to modify are:&lt;br /&gt;
&lt;br /&gt;
*Change the code of the setters and getters for the defined properties&lt;br /&gt;
*Change the code of the defined methods.&lt;br /&gt;
The Eclipse integration even manages the libraries needed by your implementation. Let us imagine, that we want to use the &amp;lt;tt&amp;gt;Fraction&amp;lt;/tt&amp;gt; class from the Apache &amp;lt;tt&amp;gt;common-math&amp;lt;/tt&amp;gt; jar. Download this jar from the Apache website, and import the &amp;lt;tt&amp;gt;common-math-1.1.jar&amp;lt;/tt&amp;gt; file into your component project: for example in a &amp;lt;tt&amp;gt;lib&amp;lt;/tt&amp;gt; directory. Add the jar to the project build path in the same way than in any other Eclipse Java project and use it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[java]&lt;br /&gt;
    // org.openoffice.helloworld.XHelloworld:&lt;br /&gt;
    private String mLadyName = &amp;quot;&amp;quot;;&lt;br /&gt;
    &lt;br /&gt;
    public String getLadyName()&lt;br /&gt;
    {&lt;br /&gt;
        return mLadyName;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public void setLadyName(String the_value)&lt;br /&gt;
    {&lt;br /&gt;
        mLadyName = the_value;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public String sayHello(boolean isBadBoy)&lt;br /&gt;
    {&lt;br /&gt;
    	String hello = &amp;quot;Hello Mrs. &amp;quot; + getLadyName();&lt;br /&gt;
        if (isBadBoy) {&lt;br /&gt;
        	Fraction f = new Fraction(1, 3);&lt;br /&gt;
        	hello = &amp;quot;A third is &amp;quot; + f.doubleValue();&lt;br /&gt;
        }&lt;br /&gt;
        return hello;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The above code show you what could be an implementation of our component. Now, there is only to package it properly and test it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Packaging and testing the component==&lt;br /&gt;
The next lines will show you how to export your component into an OpenOffice.org package. There is quite nothing to do apart from following these small steps:&lt;br /&gt;
&lt;br /&gt;
*Select the &amp;#039;&amp;#039;&amp;#039;File &amp;gt; Export&amp;#039;&amp;#039;&amp;#039; menu. Then choose the &amp;#039;&amp;#039;&amp;#039;UNO &amp;gt; OpenOffice.org&amp;#039;&amp;#039;&amp;#039; package export type.&lt;br /&gt;
*The next page of the wizard, asks for the UNO project to export (already selected), the directory where to export the package and the OpenOffice.org minimum compatibility version for the package. Depending of the selected OpenOffice.org version, the package will get a different name and a different structure.&lt;br /&gt;
*Then click on the Finish button. The wizard will ask you whether to deploy to package or not and asks for the old package removal if needed.&lt;br /&gt;
Then we will suppose that the package is deployed on the OpenOffice.org installation and we will test it using the following &amp;lt;tt&amp;gt;OooBasic&amp;lt;/tt&amp;gt; macro.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
Sub testHelloworld&lt;br /&gt;
	oHelloworld = createUnoService( &amp;quot;org.openoffice.helloworld.Helloworld&amp;quot; )&lt;br /&gt;
	oHelloworld.LadyName = &amp;quot;Robinson&amp;quot;&lt;br /&gt;
	print oHelloworld.sayHello( false )&lt;br /&gt;
	print oHelloworld.sayHello( True )&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This macro should open two message windows with &amp;#039;&amp;#039;&amp;quot;Hello Mrs. Robinson&amp;quot;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;quot;A third is 0.3333333&amp;quot;&amp;#039;&amp;#039;. Your first UNO component is now running, enjoy doing others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Going further==&lt;br /&gt;
This chapter is only for those who enjoyed this tutorial and want to know more about the UNO component creation in Java or other languages. You will have a list of useful links for any UNO developer in the next line.&lt;br /&gt;
&lt;br /&gt;
*[http://api.openoffice.org/docs/DevelopersGuide/DevelopersGuide.xhtml OpenOffice.org developer&amp;#039;s guide] is a huge source of documentation for any OpenOffice.org developer. You should probably have a look at the chapters 3 and 4 for UNO components informations.&lt;br /&gt;
*[http://api.openoffice.org/docs/java/ref/overview-summary.html OOo Java reference] is the UNO binding for Java reference.&lt;br /&gt;
*[http://api.openoffice.org/docs/cpp/ref/names/index.html OOo C++ reference] is the UNO binding for C++ reference.&lt;br /&gt;
*[http://wiki.services.openoffice.org/ OOo Developer&amp;#039;s Wiki] is the wiki for all the OpenOffice.org developers. It contains very useful informations even for people who just begin with UNO.&lt;br /&gt;
*[http://udk.openoffice.org/common/man/draft/multinherit.html http://udk.openoffice.org/common/man/draft/multinherit.html] for further informations on what changes in UNO-IDL between OpenOffice.org 1.1.x and 2.0&lt;br /&gt;
*[http://tools.openoffice.org/autodoc/HowToWriteDocumentation-Cpp.html Autodoc Java reference] is the reference for &amp;lt;tt&amp;gt;javadoc&amp;lt;/tt&amp;gt; like comments in UNO-IDL files.&lt;br /&gt;
*[http://tools.openoffice.org/autodoc/HowToWriteDocumentation-Cpp.html Autodoc C++ documentation] is the reference for &amp;lt;tt&amp;gt;javadoc&amp;lt;/tt&amp;gt; like comments in C++ components.&lt;br /&gt;
*[http://cedric.bosdonnat.free.fr/wordpress/?p=19 URE C++ application tutorial] explains how to create a C++ application based on the URE, that is a UNO C++ component that does not need OpenOffice.org.&lt;br /&gt;
&lt;br /&gt;
[[Category:Eclipse]]&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:Java]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>Exactt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=JavaEclipseTuto&amp;diff=28346</id>
		<title>JavaEclipseTuto</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=JavaEclipseTuto&amp;diff=28346"/>
		<updated>2007-03-16T23:06:04Z</updated>

		<summary type="html">&lt;p&gt;Exactt: /* The interface configuration page */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=How to create a Java component with Eclipse=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This paper is a tutorial to guide UNO newcomers to create their first Java component. This tutorial will use Eclipse and it&amp;#039;s plugin for the OpenOffice.org development. Of course, every step will be detailed, but if your are still an experienced UNO programmer, you can have a look at the next pages to have a better view of how to use the Eclipse plugin.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===UNO Components===&lt;br /&gt;
This section will explain some very basic things about UNO components. You might skip it if you already know it. First I will explain what is a component and it&amp;#039;s mains parts. Afterwards, I will explain what is needed to create a UNO component to help you to fully understand the different tools and their use during the tutorial.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Components anatomy====&lt;br /&gt;
&amp;#039;&amp;#039;&amp;quot;A component is a system element offering a predefined service and able to communicate with other components&amp;quot;&amp;#039;&amp;#039; explains [http://fr.wikipedia.org/wiki/composant Wikipedia (Fr)] (Even thought there is a definition on the English wikipedia article, I prefer the French one because of it completeness). In UNO case a component will generally be delivered as a package containing a library (share library in C++ or jar in Java). For UNO a component is made of two distinct parts: specifications and an implementation. &lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Specification: &amp;#039;&amp;#039;&amp;#039;definition in a common language of what the component should do. For UNO, this language is called UNO-IDL and is more or less similar to [http://en.wikipedia.org/wiki/Corba Corba] IDL. The documented part that will be provided as an API to use the component is the specification. Thus it should be complete and implementation independent.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Implementation: &amp;#039;&amp;#039;&amp;#039;is the code that will realize what is described in the component specifications. This programming language can either be C++, Java, Python or some others. This is the internal part of the component and will not be accessible from another component.&lt;br /&gt;
In order UNO knows which implementation corresponds to which specification, the component will use registries. There are two of them: the first one describes all the component specifications (&amp;lt;tt&amp;gt;types.rdb&amp;lt;/tt&amp;gt;) and the second translates the implementation into specifications (&amp;lt;tt&amp;gt;services.rdb&amp;lt;/tt&amp;gt;) and is generated from the implementation. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Components creation process====&lt;br /&gt;
To help you better understand what should be done to get a component from it&amp;#039;s specification and sources, you should have a look at the next illustration. As shown by the diagram, the specifications are compiled and merged into one &amp;lt;tt&amp;gt;types.rdb&amp;lt;/tt&amp;gt; registry. &amp;lt;tt&amp;gt;Class&amp;lt;/tt&amp;gt; files are generated from that file to translate the specifications into a Java class definition file which is build with the implementation into class using the &amp;lt;tt&amp;gt;java&amp;lt;/tt&amp;gt; compiler. All the classes are delivered as a &amp;lt;tt&amp;gt;jar&amp;lt;/tt&amp;gt; file with a specific manifest as we will see further in this tutorial. This doesn&amp;#039;t make a usable OpenOffice.org: the &amp;lt;tt&amp;gt;types.rdb&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;jar&amp;lt;/tt&amp;gt; file will have to be zipped into a &amp;lt;tt&amp;gt;.uno.pkg&amp;lt;/tt&amp;gt; file described with another manifest.&lt;br /&gt;
&lt;br /&gt;
[[Image:CompilationChain.png|center|UNO component build chain]]&lt;br /&gt;
&lt;br /&gt;
As I will explain it later, the Eclipse plugin will hide some of these operations, however you will need to know how they work to fully understand the build process and what we will do in the next steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Installing the development platform===&lt;br /&gt;
Now that you perfectly know what to do, we will install and configure the development tools. This is quite simple but you might be trapped into some problems if you don&amp;#039;t read the next lines carefully. I will now assume that you have none of the development tools. The OpenOffice.org Eclipse integration minimal requirements are the following one:&lt;br /&gt;
&lt;br /&gt;
*OpenOffice.org 2.0&lt;br /&gt;
*OpenOffice.org SDK 2.0.4&lt;br /&gt;
*Eclipse 3.2&lt;br /&gt;
*Java 1.5 (the GNU Java doesn&amp;#039;t work with the Eclipse integration)&lt;br /&gt;
&lt;br /&gt;
====OpenOffice.org====&lt;br /&gt;
First of all, you will need to have a working OpenOffice.org 2.0 and its Software Development Kit (SDK). The last versions are available on the [http://download.openoffice.org/ OpenOffice.org download pages] for the most current platforms. The OpenOffice.org SDK version 2.0.4 is mandatory to use the plugin correctly. It includes a new tool used by the plugin: the &amp;lt;tt&amp;gt;uno-skeletonmaker&amp;lt;/tt&amp;gt;. This tool will generate the implementation skeleton to help you to concentrate only on your code.&lt;br /&gt;
&lt;br /&gt;
This tutorial assumes that you used the &amp;quot;Official&amp;quot; OpenOffice.org distribution from the project&amp;#039;s website. Other distributions may not work with the Eclipse integration.&lt;br /&gt;
&lt;br /&gt;
====Eclipse and the plugin====&lt;br /&gt;
To get Eclipse, just get to their download pages and download the last Eclipse SDK. You will have Eclipse and it&amp;#039;s SDK. Of course, you might want to download only the binary runtime, but you will have to follow more links. Once you have Eclipse, unzip it on your computer and that&amp;#039;s it: eclipse has a Java plugin to help you program in Java.&lt;br /&gt;
&lt;br /&gt;
Now we will install the OpenOffice.org development plugin for Eclipse using the Eclipse software update system. &amp;#039;&amp;#039;&amp;#039;Do not try to download an archive somewhere: Eclipse will do it for you during the next steps.&amp;#039;&amp;#039;&amp;#039; Select the &amp;#039;&amp;#039;&amp;#039;Help &amp;gt; Software updates &amp;gt; Find and install&amp;#039;&amp;#039;&amp;#039; menu to get the window of the next illustration. Check the second option on this window and click on the &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039; button.&lt;br /&gt;
&lt;br /&gt;
[[Image:InstallWindow.png|center|&amp;quot;Find &amp;amp; Install&amp;quot; window]]&lt;br /&gt;
&lt;br /&gt;
On the following page, you will see a list of &amp;quot;&amp;#039;&amp;#039;update sites&amp;#039;&amp;#039;&amp;quot;. These are URLs pointing to directories containing plugins informations and archives. Now click on the &amp;#039;&amp;#039;&amp;#039;Add remote site&amp;#039;&amp;#039;&amp;#039; button to get a small window asking for a name that will be displayed in the list and an URL. The URL of OpenOffice.org plugin update site is http://cedric.bosdonnat.free.fr/ooeclipseintegration. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Do not hope to get an archive to download here: it&amp;#039;s the update site for Eclipse.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Then validate the new update site parameters and be sure that the OpenOffice.org site is checked before clicking on the &amp;#039;&amp;#039;&amp;#039;Finish&amp;#039;&amp;#039;&amp;#039; button. You should now see a window like the one of the next illustration. &amp;#039;&amp;#039;&amp;#039;Select the OpenOffice.org plugin Core and Java plugins&amp;#039;&amp;#039;&amp;#039;, click next and let the wizard guide you through the end of the process. You will be asked to accept the plugin licence and validate the installation archives which are not signed.&lt;br /&gt;
&lt;br /&gt;
[[Image:PluginUpdates.png|center|OpenOffice.org update site contents]]&lt;br /&gt;
&lt;br /&gt;
Congratulations, you have installed the OpenOffice.org plugin successfully, there is now to configure it. The following steps will guide you through this task. Go to the Eclipse options via the &amp;#039;&amp;#039;&amp;#039;Window &amp;gt; Preferences...&amp;#039;&amp;#039;&amp;#039; menu. In the list on the left, select the &amp;#039;&amp;#039;&amp;#039;OpenOffice.org plugin &amp;gt; SDK configuration&amp;#039;&amp;#039;&amp;#039; item to get a window like the one shown by the next illustration.&lt;br /&gt;
&lt;br /&gt;
[[Image:UnoProperties.png|center|SDK configuration window]]&lt;br /&gt;
&lt;br /&gt;
In this window you will have to configure the path to your OpenOffice.org and to it&amp;#039;s SDK. So let us begin with the SDK path: click on the &amp;#039;&amp;#039;&amp;#039;Add&amp;#039;&amp;#039;&amp;#039; button next to the SDKs list. You will have a window like the next illustration, browse to your OpenOffice.org 2.0 SDK and validate. Then you will have to do the same for the OpenOffice.org path using the other &amp;#039;&amp;#039;&amp;#039;Add&amp;#039;&amp;#039;&amp;#039; button.&lt;br /&gt;
&lt;br /&gt;
Note that a URE installation can be selected instead of a complete OpenOffice.org installation. Please report to the Java URE application tutorial for more details on the plugin&amp;#039;s URE support.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Please make sure that the path to the SDK doesn&amp;#039;t contains any space on Windows: it could cause some problems when building your UNO projects afterwards.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:SdkConfig.png|center|New SDK path window]]&lt;br /&gt;
&lt;br /&gt;
Now your OpenOffice.org plugin is ready to work: you can begin to create your new component. If there was any problem during the plugin installation, do not hesitate to report it to the dev@api.openoffice.org mailing-list.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Creating a new component==&lt;br /&gt;
For the Eclipse plugin, a UNO component is a UNO project. This tutorial will explain how to easily create a new UNO component using the Eclipse plugin. We will now assume that you have very simple needs: the component that will be created is a &amp;quot;Hello world&amp;quot; service and its implementation. Creating a component defining and implementing more services is a bit more complex and need advanced Java UNO knowledge.&lt;br /&gt;
&lt;br /&gt;
There are several ways to create a UNO component project using the plugin: &lt;br /&gt;
&lt;br /&gt;
*the first one is the &amp;#039;&amp;#039;&amp;#039;File &amp;gt; New &amp;gt; Project&amp;#039;&amp;#039;&amp;#039; menu entry and choose the &amp;#039;&amp;#039;&amp;#039;UNO &amp;gt; UNO-IDL Project&amp;#039;&amp;#039;&amp;#039; item as shown by the next illustration.&lt;br /&gt;
&lt;br /&gt;
[[Image:NewUnoProjectsItems.png|center|New UNO-IDL project item]]&lt;br /&gt;
&lt;br /&gt;
*the second one is the icon in the toolbar representing a blue folder with a star as show by the next illustration.&lt;br /&gt;
&lt;br /&gt;
[[Image:NewUnoProjectIcon.png|center|New UNO-IDL project icon]]&lt;br /&gt;
&lt;br /&gt;
Then you only have to follow the wizard to create your UNO component project, its specification and a skeleton of implementation. This wizard is composed of several pages:&lt;br /&gt;
&lt;br /&gt;
*The main configuration page to define the general project properties&lt;br /&gt;
*The implementation language configuration page.&lt;br /&gt;
*The service configuration page&lt;br /&gt;
*The interface configuration page&lt;br /&gt;
After all these steps you can get a running component... doing nothing. The next sections will describe the different wizard pages and where to place your code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===The project configuration page===&lt;br /&gt;
The first page in the project wizard is the only page containing fields that need to be filled. All the others have default values to help you through the component creation. In our case, we will need all the pages to explain them all and define some mew methods and attributes in our component.&lt;br /&gt;
&lt;br /&gt;
[[Image:NewUnoProject.jpg|center|New UNO-IDL project wizard page]]&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Project name:&amp;#039;&amp;#039;&amp;#039; is the component name, in our case, it will be &amp;quot;&amp;#039;&amp;#039;Helloworld&amp;#039;&amp;#039;&amp;quot;&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Location:&amp;#039;&amp;#039;&amp;#039; is the directory on your computer where the project will be created. You can change the default one by deselecting the &amp;#039;&amp;#039;&amp;#039;Use default&amp;#039;&amp;#039;&amp;#039; check box. The default location of each Eclipse project is a directory with your project name in the current Eclipse workspace. &amp;#039;&amp;#039;&amp;#039;Please avoid spaces in this path on Windows: it could prevent your component to be built.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Root package:&amp;#039;&amp;#039;&amp;#039; is the name of the first module of your component. It generally composed of two parts: the vendor name (here &amp;lt;tt&amp;gt;org.openoffice&amp;lt;/tt&amp;gt;) and the project name (here &amp;lt;tt&amp;gt;helloworld&amp;lt;/tt&amp;gt;).&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Used SDK:&amp;#039;&amp;#039;&amp;#039; selects the OpenOffice.org SDK which will be used to develop the component. You generally will have only one SDK in the list, but you can add others in the preferences or by clicking on the &amp;#039;&amp;#039;&amp;#039;Configure SDKs&amp;#039;&amp;#039;&amp;#039; button.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Used OOo:&amp;#039;&amp;#039;&amp;#039; selects the version of OpenOffice.org to use to develop the component. As for the SDK, you will generally have only one entry in the list, but you can add others in the preferences or by clicking on the OOo Installations button.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Programming language:&amp;#039;&amp;#039;&amp;#039; selects the programming language for the component implementation. For the moment, there is only Java available, however C++ and python are planned.&lt;br /&gt;
&lt;br /&gt;
===The implementation language configuration page===&lt;br /&gt;
This page depends on the chosen language. For Java, the default values should be kept: they define which class is the main class of the component. The component&amp;#039;s main class contains some code mapping the services to their implementation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===The service configuration page===&lt;br /&gt;
&lt;br /&gt;
[[Image:Eclipse_Service_Page.png|center|Service configuration page]]&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Module:&amp;#039;&amp;#039;&amp;#039; corresponds to the UNO-IDL module where to add the interface. If the text field is left empty, the interface will be added in the root module of the component (filled in the project wizard).&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Service name:&amp;#039;&amp;#039;&amp;#039; is the service name. By keeping the default value, you will be able to define your own interface using the interface configuration page. Otherwise, you can reuse an existing interface.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Published&amp;#039;&amp;#039;&amp;#039;: specifies if the interface is published or not. The published notion is translated into a keyword in UNO-IDL language. Declaring a UNO-IDL type as published means that it will not change in future releases: we will keep it unchecked because our component is really far from being a stable API.&lt;br /&gt;
&lt;br /&gt;
===The interface configuration page===&lt;br /&gt;
&lt;br /&gt;
[[Image:NewInterfacePage.png|center|Interface configuration page]]&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Module:&amp;#039;&amp;#039;&amp;#039; corresponds to the UNO-IDL module where to add the interface. If the text field is left empty, the interface will be added in the root module of the component (filled in the project wizard).&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Interface name:&amp;#039;&amp;#039;&amp;#039; is the interface name. By convention, we generally name a interface beginning with an &amp;quot;X&amp;quot;. In this tutorial case, the interface will be named &amp;lt;tt&amp;gt;XHelloworld&amp;lt;/tt&amp;gt;.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Inherited interfaces:&amp;#039;&amp;#039;&amp;#039; is a list of all the interfaces from which the one that is about to be created will inherit. This is one of the changes in UNO-IDL between OpenOffice.org 1.1.x and 2.0: that is why the plugin does not support OpenOffice.org version prior to 2.0. All the UNO-IDL interfaces are inheriting more or less directly  from the &amp;lt;tt&amp;gt;com::sun::star::uno::XInterface&amp;lt;/tt&amp;gt; type. As the &amp;lt;tt&amp;gt;XHelloworld&amp;lt;/tt&amp;gt; interface is very easy, no super interface will be added: that will implicitly define &amp;lt;tt&amp;gt;XInterface&amp;lt;/tt&amp;gt; as the only parent for the new interface. &lt;br /&gt;
**&amp;#039;&amp;#039;&amp;#039;&amp;quot;?&amp;quot; column:&amp;#039;&amp;#039;&amp;#039; specifies if the interface inheritance is mandatory or not. If the box is checked, thus the interface inheritance is optional and may not be implemented.&lt;br /&gt;
**&amp;#039;&amp;#039;&amp;#039;&amp;quot;Add&amp;quot; and &amp;quot;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;Del&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;quot; buttons:&amp;#039;&amp;#039;&amp;#039; allows to add an interface to the inherited ones or removing the selected interface.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Members:&amp;#039;&amp;#039;&amp;#039; is a list of all the methods and properties of the interface. See the explanations about the members some lines below. In this tutorial, just create one &amp;lt;tt&amp;gt;string sayHello([in] boolean isBadBoy)&amp;lt;/tt&amp;gt; method and a &amp;lt;tt&amp;gt;LadyName&amp;lt;/tt&amp;gt; property.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Published:&amp;#039;&amp;#039;&amp;#039; specifies if the interface is published or not. The published notion is translated into a keyword in UNO-IDL language. Declaring a UNO-IDL type as published means that it will not change in future releases: we will keep it unchecked because our component is really far from being a stable API.&lt;br /&gt;
A UNO interface can contain two kind of members: methods and properties. When clicking on the &amp;#039;&amp;#039;&amp;#039;Add&amp;#039;&amp;#039;&amp;#039; button near the members&amp;#039; list, the following window will be shown. When double-clicking on a line in the members&amp;#039; list, you will edit the corresponding member through the same window.&lt;br /&gt;
&lt;br /&gt;
When the window is opened to create a new member, you can choose whether the member will be a property or a method. The name and returned type fields are always present, but the lower part of the dialog is different for a method and a property.&lt;br /&gt;
&lt;br /&gt;
[[Image:Eclipse_Interface_Members_Dialog.png|center|Interface member creation dialog]]&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;The arguments list:&amp;#039;&amp;#039;&amp;#039; defines the name, type and direction of the parameters of the method. Simply click on the cell to edit it.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Read-only and Bound check boxes:&amp;#039;&amp;#039;&amp;#039; selecting these boxes sets the corresponding IDL flag on the property.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Tip:&amp;#039;&amp;#039;&amp;#039; you can use &amp;#039;&amp;#039;&amp;lt;tt&amp;gt;&amp;#039;&amp;#039;Ctrl+Space&amp;#039;&amp;#039;&amp;lt;/tt&amp;gt;&amp;#039;&amp;#039; to complete the type name in the &amp;#039;&amp;#039;&amp;#039;Return type&amp;#039;&amp;#039;&amp;#039; field and &amp;#039;&amp;#039;&amp;#039;Type&amp;#039;&amp;#039;&amp;#039; column.&lt;br /&gt;
&lt;br /&gt;
===Writing the implementation===&lt;br /&gt;
After having completed the wizard, you need to write the component implementation. Hopefully a skeleton has been generated and opened: you just need to complete the code where there are some TODOS. The generated project contains the following directories and files to know:&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;source:&amp;#039;&amp;#039;&amp;#039; directory containing your Java implementation classes&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;build:&amp;#039;&amp;#039;&amp;#039; directory containing all the generated temporary files, such as the results of the specification files (&amp;lt;tt&amp;gt;.idl&amp;lt;/tt&amp;gt; files) compilation (&amp;lt;tt&amp;gt;.urd&amp;lt;/tt&amp;gt; files) or the class files corresponding to the specifications (&amp;lt;tt&amp;gt;.class&amp;lt;/tt&amp;gt; files)&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;idl:&amp;#039;&amp;#039;&amp;#039; directory containing the specifications of the component&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;types.rdb:&amp;#039;&amp;#039;&amp;#039; generated UNO types registry from which the classes files will be generated&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;JRE and the jars:&amp;#039;&amp;#039;&amp;#039; are describing the classpath of the component. They are visible only in the Java package explorer. The OpenOffice.org jars are changed if the OpenOffice.org version associated to the project is changed. &amp;#039;&amp;#039;In a future version, they will be packed in a user library to take less space in the tree.&amp;#039;&amp;#039;&lt;br /&gt;
The generated skeleton already contains the methods for the implementation registration. The only things to modify are:&lt;br /&gt;
&lt;br /&gt;
*Change the code of the setters and getters for the defined properties&lt;br /&gt;
*Change the code of the defined methods.&lt;br /&gt;
The Eclipse integration even manages the libraries needed by your implementation. Let us imagine, that we want to use the &amp;lt;tt&amp;gt;Fraction&amp;lt;/tt&amp;gt; class from the Apache &amp;lt;tt&amp;gt;common-math&amp;lt;/tt&amp;gt; jar. Download this jar from the Apache website, and import the &amp;lt;tt&amp;gt;common-math-1.1.jar&amp;lt;/tt&amp;gt; file into your component project: for example in a &amp;lt;tt&amp;gt;lib&amp;lt;/tt&amp;gt; directory. Add the jar to the project build path in the same way than in any other Eclipse Java project and use it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[java]&lt;br /&gt;
    // org.openoffice.helloworld.XHelloworld:&lt;br /&gt;
    private String mLadyName = &amp;quot;&amp;quot;;&lt;br /&gt;
    &lt;br /&gt;
    public String getLadyName()&lt;br /&gt;
    {&lt;br /&gt;
        return mLadyName;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public void setLadyName(String the_value)&lt;br /&gt;
    {&lt;br /&gt;
        mLadyName = the_value;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public String sayHello(boolean isBadBoy)&lt;br /&gt;
    {&lt;br /&gt;
    	String hello = &amp;quot;Hello Mrs. &amp;quot; + getLadyName();&lt;br /&gt;
        if (isBadBoy) {&lt;br /&gt;
        	Fraction f = new Fraction(1, 3);&lt;br /&gt;
        	hello = &amp;quot;A third is &amp;quot; + f.doubleValue();&lt;br /&gt;
        }&lt;br /&gt;
        return hello;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The above code show you what could be an implementation of our component. Now, there is only to package it properly and test it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Packaging and testing the component==&lt;br /&gt;
The next lines will show you how to export your component into an OpenOffice.org package. There is quite nothing to do apart from following these small steps:&lt;br /&gt;
&lt;br /&gt;
*Select the &amp;#039;&amp;#039;&amp;#039;File &amp;gt; Export&amp;#039;&amp;#039;&amp;#039; menu. Then choose the &amp;#039;&amp;#039;&amp;#039;UNO &amp;gt; OpenOffice.org&amp;#039;&amp;#039;&amp;#039; package export type.&lt;br /&gt;
*The next page of the wizard, asks for the UNO project to export (already selected), the directory where to export the package and the OpenOffice.org minimum compatibility version for the package. Depending of the selected OpenOffice.org version, the package will get a different name and a different structure.&lt;br /&gt;
*Then click on the Finish button. The wizard will ask you whether to deploy to package or not and asks for the old package removal if needed.&lt;br /&gt;
Then we will suppose that the package is deployed on the OpenOffice.org installation and we will test it using the following &amp;lt;tt&amp;gt;OooBasic&amp;lt;/tt&amp;gt; macro.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
Sub testHelloworld&lt;br /&gt;
	oHelloworld = createUnoService( &amp;quot;org.openoffice.helloworld.Helloworld&amp;quot; )&lt;br /&gt;
	oHelloworld.LadyName = &amp;quot;Robinson&amp;quot;&lt;br /&gt;
	print oHelloworld.sayHello( false )&lt;br /&gt;
	print oHelloworld.sayHello( True )&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This macro should open two message windows with &amp;#039;&amp;#039;&amp;quot;Hello Mrs. Robinson&amp;quot;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;quot;A third is 0.3333333&amp;quot;&amp;#039;&amp;#039;. Your first UNO component is now running, enjoy doing others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Going further==&lt;br /&gt;
This chapter is only for those who enjoyed this tutorial and want to know more about the UNO component creation in Java or other languages. You will have a list of useful links for any UNO developer in the next line.&lt;br /&gt;
&lt;br /&gt;
*[http://api.openoffice.org/docs/DevelopersGuide/DevelopersGuide.xhtml OpenOffice.org developer&amp;#039;s guide] is a huge source of documentation for any OpenOffice.org developer. You should probably have a look at the chapters 3 and 4 for UNO components informations.&lt;br /&gt;
*[http://api.openoffice.org/docs/java/ref/overview-summary.html OOo Java reference] is the UNO binding for Java reference.&lt;br /&gt;
*[http://api.openoffice.org/docs/cpp/ref/names/index.html OOo C++ reference] is the UNO binding for C++ reference.&lt;br /&gt;
*[http://wiki.services.openoffice.org/ OOo Developer&amp;#039;s Wiki] is the wiki for all the OpenOffice.org developers. It contains very useful informations even for people who just begin with UNO.&lt;br /&gt;
*[http://udk.openoffice.org/common/man/draft/multinherit.html http://udk.openoffice.org/common/man/draft/multinherit.html] for further informations on what changes in UNO-IDL between OpenOffice.org 1.1.x and 2.0&lt;br /&gt;
*[http://tools.openoffice.org/autodoc/HowToWriteDocumentation-Cpp.html Autodoc Java reference] is the reference for &amp;lt;tt&amp;gt;javadoc&amp;lt;/tt&amp;gt; like comments in UNO-IDL files.&lt;br /&gt;
*[http://tools.openoffice.org/autodoc/HowToWriteDocumentation-Cpp.html Autodoc C++ documentation] is the reference for &amp;lt;tt&amp;gt;javadoc&amp;lt;/tt&amp;gt; like comments in C++ components.&lt;br /&gt;
*[http://cedric.bosdonnat.free.fr/wordpress/?p=19 URE C++ application tutorial] explains how to create a C++ application based on the URE, that is a UNO C++ component that does not need OpenOffice.org.&lt;br /&gt;
&lt;br /&gt;
[[Category:Eclipse]]&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:Java]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>Exactt</name></author>
	</entry>
</feed>