Difference between revisions of "Calc/Add-In/Project Type"

From Apache OpenOffice Wiki
< Calc‎ | Add-In
Jump to: navigation, search
(Project Wizard)
(Project Wizard)
Line 25: Line 25:
 
* '''Step 5''': Deploying the extension package
 
* '''Step 5''': Deploying the extension package
 
<br>[[Image:Calc_AddIn4.png|center]]<br>
 
<br>[[Image:Calc_AddIn4.png|center]]<br>
 +
You can simply create or deploy the '''oxt''' extension package by choosing:<br>
 +
::'''Project View -> Project Node -> Context Menu -> Create OXT|Deploy Office Extension'''<br><br>
  
 
When you have deployed the package the usage of the Calc Add-In function(s) in your office is straight forward. Simply open a new spreadsheet document -> open the build-in function dialog -> select the “AddIn” category -> search a new Add-In function (uppercase notation) -> clicking next -> enter parameters ... -> ok
 
When you have deployed the package the usage of the Calc Add-In function(s) in your office is straight forward. Simply open a new spreadsheet document -> open the build-in function dialog -> select the “AddIn” category -> search a new Add-In function (uppercase notation) -> clicking next -> enter parameters ... -> ok

Revision as of 14:38, 5 October 2006

Overview

The StarOffice/OpenOffice.org Calc Add-In wizard creates a new project based on a J2SE class library project and supports additional targets to create a complete office extension package and to deploy this package into the configured office installation. This new targets will be provided at the project node later, similar to the "Create NBM" in a plugin module project.
The wizard will collect all necessary information and allows the definition of new build-in Calc functions which can be used in the spreadsheet application directly after deploying the extension and restarting the office (live deployment of calc add-ins does currently not work).
After finishing the wizard you can directly build the project and can create and deploy the office extension package in your office. The created build-in functions are default implemented and do nothing. In a second step you can insert your implementation in the generated skeleton (searching for the add-in function body), rebuild the extension and deploy it again to see the effect in your office.

Project Wizard

The project wizard should be simply to use, you simply choose

  • File -> New Project -> StarOffice/OpenOffice.org -> StarOffice/OpenOffice.org Calc Add-In

and follow the wizard.

  • Step 1: Selecting the project type

Calc AddIn1.png

  • Step 2: Defining the project name, Add-In name, an optional package and the project location

Calc AddIn2.png

The checkbox Create backward comptible Calc Add-In should be marked if you want create a Calc Add-In working with older office versions as well. The default mode creates a simplified code skeleton. Since OpenOffice.org 2.0.4 the Spreadsheet application takes care of a new configuration schema for Calc Add-In functions. An appropriate xcu file is generated as well and becomes part of the final oxt package. The backward compatible mode maps the older Add-In interfaces to the configuration in the generated code and deploys the schema with the final extension.

  • Step 4: Defining the new Add-In functions

Calc AddIn3.png

On this panel you have the possibility to define new Calc Add-In methods on a higher abstraction level, you won't have to deal with UNO IDL or xcu files directly. You can modify the default method, can insert localized descriptions and displaynames ... For more detailed descriptions of the different fields simply press the help button or read the appropriate chapter in the Developer's Guide - Spreadsheet - Add-Ins
Add a new function will always add the new function on top of the list. Add parameter will add the parameter as the first parameter when the function node is selected or will append the parameter behind the currently selected parameter. When you add a new language you can choose of a list of supported languages which are not added and when you delete a language, only the added languages are offered for removal.


Calc AddIn3a.png


Calc AddIn3b.png

  • Step 5: Deploying the extension package

Calc AddIn4.png

You can simply create or deploy the oxt extension package by choosing:

Project View -> Project Node -> Context Menu -> Create OXT|Deploy Office Extension

When you have deployed the package the usage of the Calc Add-In function(s) in your office is straight forward. Simply open a new spreadsheet document -> open the build-in function dialog -> select the “AddIn” category -> search a new Add-In function (uppercase notation) -> clicking next -> enter parameters ... -> ok


Calc AddIn5.png


Calc AddIn6.png

Generated Code

For a Calc Add-In the wizard generates more code and it would be to much to show them here. But new is that we generate a new config (.xcu) file for the Add-In describing the Add-In functions with descriptions, displaynames etc. The new configuration allows the easy support of localization of the description and displaynames. The underlying schema gets currently deployed with the extension package but with OO.org 2.0.4 the schema should be already come with the office. For the above shown example the following files are generated:

  • CalcAddIn.xcu
    the mentioned new configuration file
  • uno-extension-manifest.xml
    the package descriptor, will be packed as "META-INF/manifest.xml"
  • org/test/addin/XTestAddIn.idl
    the Add-In interface describing the new Add-In functions
  • org/test/addin/TestAddIn.idl
    the appropriate Add-In service definition
  • org/test/addin/TestAddinImpl.java
    the generated Add-In code skeleton where only the Add-In functions have to be implemented. Everything else is already implemented and even the Add-In functions are default implemented, so that the new generated project can be build and the extension can be deployed directly.
Personal tools