Learning OOo macros
Basic training
For informations on getting started with writing macros in OOo see: [http://wiki.services.openoffice.org/wiki/Extensions_development_basic]
In particular it was decided that we would try to follow the conventions used in the [[variable
Xray
Xray is a macro for introspection of OOo objects. The document that contains the xray macro and the documentation for its use can be found at [http://sourceforge.net/project/showfiles.php?group_id=87718&package_id=101416].
To install the macro scroll down to the installation section and click the install button.
To make xray even more useful you will require the OOo SDK. A link to a download page is available from [http://download.openoffice.org/index.html].
Note that in recent versions of xray the command to run it is xray rather (than in older version xray.xray).
xray thisComponent
OOo and Word macros
To make it easier to maintain macros written for both OOo Writer and Microsoft Word compiler constants and conditionals can be used.
#Const MSWD = False #Const MACWORD = False #Const OOo = Not MSWD #If MSWD then #Else #End If
Note that in OOo the conditionals must be inside a routine and that you can't wrap an entire sub or function inside a compiler conditional.
Creating OOo Extensions
For an overview of creating extensions (technical but this should be the most up to date): [http://wiki.services.openoffice.org/wiki/Extensions_best_practices#Package_File_Format]
For a description of a macro that makes it easier to create packages/extensions: [http://wiki.services.openoffice.org/wiki/Extensions_Packager]
The link to a page that contains a link to the macro isn't that obvious so here it is: [http://www.paolo-mantovani.org/] and choose the BasicAddonBuilder? link.
However, this macro doesn't allow you to install other bits of code such as the python code for the Zotero integration. So my quick and dirty approach was to:
- Choose the .oxt file option. This file is a simple zip file
- Add the python file inside a directory (I called the directory scripts) to the .oxt zip file
- Edit manifest.xml which is in the directory META-INF in the .oxt zip file by adding the line:
<manifest:file-entry manifest:media-type="application/vnd.sun.star.uno-component;type=Python" manifest:full-path="Scripts/ZoteroRPC.py"/>
before the line
</manifest:manifest>
To copy the icons that the Zotero Word template used, I simply right clicked the toolbar in Word, chose Customize, right clicked the icon, chose copy, then went to the Gimp, and acquired from clipboard so that I could then save the image as a .png file.
