metadata-editor/README.md

36 lines
3.2 KiB
Markdown
Raw Normal View History

2016-04-07 13:37:45 +02:00
# LibreOffice Starter Extension
2016-04-07 12:32:05 +02:00
This repository contains some boilerplate code and config you need to get started to build your own LibreOffice Extension.
You can use this project as a starting point to write your own extension for LibreOffice.
## Get started
2017-03-23 13:10:40 +01:00
1. Install [LibreOffice](http://www.libreoffice.org/download) & the [LibreOffice SDK](http://www.libreoffice.org/download) (5.0 or greater)
2. Install [Eclipse](http://www.eclipse.org/) IDE for Java Developers & the [LOEclipse plugin](https://marketplace.eclipse.org/content/loeclipse)
2016-04-07 13:37:45 +02:00
3. [Download](https://github.com/smehrbrodt/libreoffice-starter-extension/archive/master.zip) this starter project & unzip it
2016-04-07 12:37:18 +02:00
4. Import the project in Eclipse (File->Import->Existing Projects into Workspace)
2016-07-12 14:42:02 +02:00
5. Let Eclipse know the paths to LibreOffice & the SDK (Project->Properties->LibreOffice Properties)
2016-04-07 12:37:18 +02:00
6. Setup Run Configuration
2017-03-23 12:59:38 +01:00
* Go to Run->Run Configurations
* Create a new run configuration of the type "LibreOffice Application"
* Select the project
* Run!
* *Hint: Show the error log to view the output of the run configuration (Window->Show View->Error Log)*
2017-03-23 13:10:40 +01:00
7. The extension will be installed in LibreOffice (see Tools->Extension Manager)
8. To launch the example dialog, click on the newly added toolbar/menu entry which have been added to Writer (named "Starter Project/Action One").
2016-04-07 12:32:05 +02:00
## Development Hints
* The entry point is in [StarterProjectImpl.java](https://github.com/smehrbrodt/libreoffice-starter-extension/blob/master/source/org/libreoffice/example/comp/StarterProjectImpl.java).
* Toolbar items and menu entries are defined in [Addons.xcu](https://github.com/smehrbrodt/libreoffice-starter-extension/blob/master/registry/org/openoffice/Office/Addons.xcu).
* Shortcuts are defined in [Accelerators.xcu](https://github.com/smehrbrodt/libreoffice-starter-extension/blob/master/registry/org/openoffice/Office/Accelerators.xcu).
* The position of the toolbar is defined in [WriterWindowState.xcu](https://github.com/smehrbrodt/libreoffice-starter-extension/blob/master/registry/org/openoffice/Office/UI/WriterWindowState.xcu).
* The dialog shown when clicking "Action One" is [ActionOneDialog.xdl](https://github.com/smehrbrodt/libreoffice-starter-extension/blob/master/dialog/ActionOneDialog.xdl). The dialog itself contains information how to edit it.
2017-03-23 13:10:40 +01:00
* The [DialogHelper](https://github.com/smehrbrodt/libreoffice-starter-extension/blob/master/source/org/libreoffice/example/helper/DialogHelper.java) contains some helper methods to work with the dialog.
2016-04-07 12:42:28 +02:00
* To debug the Java code, just stick a breakpoint anywhere in Eclipse and start your run configuration in debug mode.
* If you add non-code files (or an external .jar) to your extension, you need to mention them in [package.properties](https://github.com/smehrbrodt/libreoffice-starter-extension/blob/master/package.properties), else they won't be included in the packaged extension.
2017-03-23 13:10:40 +01:00
* Now go on customizing the extension to your needs. Some helpful links:
* [OpenOffice Wiki](https://wiki.openoffice.org/wiki/Extensions_development)
* [API Reference](http://api.libreoffice.org/docs/idl/ref/index.html)
* [Example extensions](http://api.libreoffice.org/examples/examples.html#Java_examples)