OpenOfficeAddon

Setting Up

  • Download the Openoffice sdk
  • Enable remote debugging on your openoffice installation
    • Go to tools -> options and click on Java under openoffice.org
    • Make sure a Java runtime enviroment is selected and clcik on Parameters
    • Add the following:
-Xdebug
-Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=n
  • Click ok and exit
  • Now set up your IDE to use the remote debugging connection(The following uses Eclipse)
    • Go to run -> Debug...
    • Select "Remote java Application" and click new
    • Choose your project and fill in localhost and 8000 for the server/port

Random ramblings

jar cvf !OpsProtocolHandler.jar org -m ../META-INF/MANIFEST.MF

Code Fragments

Settings

      try {

         //The service manager holds all the services

         XMultiComponentFactory sm = xComponentContext.getServiceManager();

         System.out.println("\tGot the servicemanager");

         

         //The ConfigurationProvider will gives us a view of the configuration      

         XMultiServiceFactory configurationProvider = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class,
 sm.createInstanceWithContext("com.sun.star.configuration.ConfigurationProvider", xComponentContext));

         System.out.println("\tGot the configurationProvider");

         

           // creation arguments: nodepath (eg <package>.<name> , see OpsSettins.xcs for the scheme and OpsSettins.xcu for the initial data

           com.sun.star.beans.PropertyValue aPathArgument = new com.sun.star.beans.PropertyValue();

           aPathArgument.Name = "nodepath";

           aPathArgument.Value = "/openprojectservices.org.OOoAddon.settings/Data";



           Object[] aArguments = new Object[1];

           aArguments[0] = aPathArgument;

           

           

         //Now lets ask the ConfigurationProvider for an ConfigurationUpdateAccess view

         Object updateView = configurationProvider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationUpdateAccess", aArguments);

         System.out.println("\tGot the updateView");



           //The updateView has an XHierarchicalPropertySet interface wich will gives our parameters

         XHierarchicalPropertySet xProperties = (XHierarchicalPropertySet) UnoRuntime.queryInterface(XHierarchicalPropertySet.class, updateView);

         System.out.println("\tGot the XHierarchicalPropertySet\n");

           

           //And finally there they are...

           String opsProjectURL = (String) xProperties.getHierarchicalPropertyValue("opsProjectURL");

           String opsHttpClientURL = (String) xProperties.getHierarchicalPropertyValue("opsHttpClientURL");

           String username = (String) xProperties.getHierarchicalPropertyValue("username");

           String password = (String) xProperties.getHierarchicalPropertyValue("password");

           System.out.println("\topsProjectURL: "+opsProjectURL);

           System.out.println("\topsHttpClientURL: "+opsHttpClientURL);

           System.out.println("\tusername: "+username);

           System.out.println("\tpassword: "+password);

           

           xProperties.setHierarchicalPropertyValue("opsProjectURL", "heelietsanders");

           opsProjectURL = (String) xProperties.getHierarchicalPropertyValue("opsProjectURL");

           

           System.out.println("\topsProjectURL: "+opsProjectURL);

           

           //The updateView has an XHierarchicalPropertySet interface wich will gives our parameters

           XChangesBatch xChangesBatch = (XChangesBatch) UnoRuntime.queryInterface(XChangesBatch.class, updateView);

         System.out.println("\tGot the XChangesBatch\n");

         xChangesBatch.commitChanges();



      } catch (Exception e) {

         // TODO Auto-generated catch block

         e.printStackTrace();

      } catch (RuntimeException e) {

         e.printStackTrace();

      }
-- IvoVanDongen - 08 Nov 2005
  • An overview:
    An overview

Documentation

Good sources for documentation: probately the best way to find your way around!OpenOffice.org is to check out the sources provided with the developer manual and to some extend the samples that come with the sdk itself.

-- IvoVanDongen - 05 Jan 2006

Topic revision: r6 - 05 Jan 2006 - 12:30:07 - IvoVanDongen

tip TWiki Tip of the Day
Escaping TWiki rendering
Use the verbatim tag to surround code excerpts and other formatted text with verbatim and /verbatim ... Read on Read more

 
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback