Skip navigation.

Open Life

Opendocuments, Web Office, Office suites

Posts tagged with "extensions"

Flisol 2007 in Guadalajara Part I

, , , ...

So I participated in the FLISOL 2007 event in LinuxCabal. My talk was about development of extensions in Linux. The talk was pretty good, but I guess the audience was too much of a newbie to connect with the talk.

My talk was pretty technical yet it was just a descriptive talk, i didnt got into specifics of the development of extensions in OpenOffice.org (spanish).

The talk guide the audience throught UI of OpenOffice.org to use the macros and the different bindings to languages that UNO support.

I showed the file structure of OpenOffice.org to let users know how to load the code either locally or remotely.

Here is an example in Python:
import uno

localContext = uno.getComponentContext()
resolver = localContext.ServiceManager.createInstanceWithContext(
                                          "com.sun.star.bridge.UnoUrlResolver", localContext )
ctx = resolver.resolve( "uno:socket, host=localhost,             
                                      port=2002;urp;StarOffice.ComponentContext" )


and how to add Python from the command line:
>
> /opt/openoffice.org2.2/program/unopkg add Wavelet.uno.zip
> 
> /opt/openoffice.org2.2/program/unopkg remove Wavelet.uno.zip
>


Finally I gave the description of the IDL reference in OpenOffice.org and how the interfaces interact with uno.

Unfortunately there were 2 things that went wrong, one is that OOo wouldnt show the IDE for Basic, and the samples I played around about the language which was ok in a sense since I wouldnt be able to finalize my presentation.

I put some code in basic, difference between a plain script in Basic and a more powerful script with connectivity to API.

Managing Python Extensions in OpenOffice.org I

, , , ...

For all Python fans out there, you might not know that OpenOffice.org can be run on Python. This is great because OpenOffice.org is a very interesting application but is hard to modify or develop on top of it. However extensions has been the way to go when you want to implement something new in OpenOffice.org. So here is a mini tour oriented to the way OpenOffice.org manage Python, which is different to the way OpenOffice.org handles the native OOoBasic. One thing is that OOoBasic is compatible with OpenOffice.org IDE that you get when you go to Tools > Macros > Manage Macros > OpenOffice.org Basic.

How Macros are handled.
Macros are usually handled on 3 stages, it can be either file based, user based, or application base.
  • The file based it means that the macros are stored in the file, this files will have the python source code within the document.
  • User based is that the macros are saved on the user preferences, this is usually stored in linux on the dot folders, in windows under the Application data folder.
  • Application base are stored in the applications folder which in linux is under /opt folder and on windows is under the Program Files folder.


The difference between this thre methods are the accesibility that you will get, for example document macros gain the portability of sending OpenDocument files and transporting the macro to other people on different computers.

The user-centric affect just the individual user account and might not be transferable to other users, for that you will want the application base. This also gain the availability since you can use the macro regardless of the document you are working on and it lives in OpenOffice.org. The global one lives in OOo and affect all users, this is the best one if you want to make large deployments.

What about Python
As I said before, Python is not a native language to OpenOffice.org, however you will be happy to know that python is included by default under OpenOffice.org. Is stored at openoffice.org2.2/program/python-core-2.3.4/ (versions might change); so you are able to use this macros on every openoffice.org installation.

As I mention before, the 3 layers that OOo can store macros will affect the installation of new macros developed in Python.

The easiest one is to have python saved in your application, so let say that you have the file MyScript.py. To load it to your OpenOffice.org application will be:
$ su
$ cp MyScript.py /opt/openoffice.org2.2/share/Scripts/ptyhon/
.

The user account level will be similar nad will execute by just doing the following:
$ cp MyScript ~/.openoffice.org2.2/user/Scripts/python/

* Be careful since the python folder is not created by default you will need to do create a folder under the Script folder.

The last one -- the document level is actually quite hard and might just put it here for reference but is more complicated than just coping the script inside the document. You will actually have to edit an XML file in order to manually register the file inside the document.

As you may know OpenDocuments are Zip files containing other files. They also have a file structure which will include:
meta.xml
content.xml
style.xml
mimetype
current.xml
Configuration2/
   accelerator
   images
   popmenu
   ...
META-INF/
   manifest.xml
Thumbnails/
   file.png

You will actually need to unzip and create a new folder called Scripts and inside create the python folder. Only then you will be able to copy your script MyScript.py inside the python folder.

Here is where you will need to edit the registry which is in the META-INF/manifest file and add 3 lines (before the final tag manifest:manifest].
 <manifest:file-entry manifest:media-type="" manifest:full-path="Scripts/python/MsgBox.py"/>
 <manifest:file-entry manifest:media-type="application/binary" manifest:full-path="Scripts/python/"/>
 <manifest:file-entry manifest:media-type="application/binary" manifest:full-path="Scripts/"/>


This will register the path of the script "Scripts/python/MsgBox.py" , the path of the scripting folders one for "Scripts/python" and other just for the "Scripts" folder.

Next post I will put some sample script so you can run and test your scripts meanwhile I will like to point to some default Python scripts already in OpenOffice.org.

Please go to Tools > Macros > Administer Macros > Python select the main application labeled as OpenOffice.org Macros and expand. You will see many sample codes that might look familiar to the ones you found at openoffice.org2.2/share/Scripts/python/HelloWorld.py you might also find Capitalized and the folder pythonSamples.

Later I will suggest you some useful sites to download some Python components.

The OOo Extension Repository

, , , ...

The Extension Project has skyrocked with the development of extensions for the OpenOffice.org Suite. The Extension repository mainly done on OOoBasic and Python.
* BorderLiner
Localized : English - Category : Tables - License : LGPL - OOoVersion : 2.02
Description : An Openoffice.org macro to draw borders in Calc and Writer tables and other objects just with a couple of key strokes

* History Manager
Localized : ?? - Category : ?? - License : ?? - OOoVersion : ??
Description :

* LanguageTool
Localized : English, German, Polish, Dutch, Latvian - Category : Linguistic - License : LGPL - OOoVersion : 2.x
Description : Grammar and style checker for English, German, Polish, and Dutch. Initial support for Italian, French, and Spanish. Latvian in preparation.

* Multipages
Localized : English, German - Category : UI tool - License : LGPL - OOoVersion : 1.1, 2.0, 2.1
Description : An Openoffice.org macro (extension package) to copy, delete, sort, rename and create multiple document pages automatically


* OOOBlogger
Localized : English - Category : Writer Tools - License : ?? - OOoVersion : ??
Description :

* Optimization Solver formerly known as ''LPSolver''
Localized : English - Category : Calc Tools - License : LGPL - OOoVersion : 2.0
Description : The Linear and Non-Linear Optimization Solver (or simply the Optimization Solver) is designed to compute an optimized solution that either maximizes or minimizes a given objective of a model while, at the same time, satisfying a set of constraints that may be defined in the model.
In this wiki: Optimization Solver

* SVG Import Filter
Localized : ?? - Category : ?? - License : ?? - OOoVersion : ??
Description :

* Code Snippet Creator
Localized : ?? - Category : Development tool - License : ?? - OOoVersion : ??
Description :

* Multisave
Localized : ?? - Category : ?? - License : ?? - OOoVersion : ??
Description : A Macro to save a document to multiple format in a few clicks

* Annotation Tool
Localized : ?? - Category : ?? - License : LGPL - OOoVersion : ??
Description : Extension of the note feature in Writer: text highlighting, quick remove of notes

* Mathtype Macros
Localized : English - Category : Math tool - License : GPL - OOoVersion : 2.0.x - Platform : Windows
Description : Macros for insertion of Mathtype objects in OOo Writer on the Windows platform

* QuasiWiki
Localized : English - Category : Wiki - License : GPL - OOoVersion : 2.0.x
Description : QuasiWiki implements some of the basic principles of wiki in OpenOffice.org Writer. It doesn't turn OpenOffice.org into a fully fledged wiki tool (hence the "quasi" prefix), but rather adds some wiki-like capabilities.

* txt2tags extension
Localized : English - Category : Markup - License : GPL - OOoVersion : 2.0.x
Description : txt2tags extension allows users to apply txt2tags markup to the currently opened Writer document.

* OxygenOffice Professional contents for OpenOffice.org as extension
Localized : English, German, Hungarian, French, Italian - Category : Templates, Gallery - License : LGPL - OOoVersion : 2.x
Description : Extension version of OxygenOffice Professional's extra contents for OpenOffice.org like templates and galleries.
Download : Direct link for extension downloads
Last update : February 14, 2007

* German template collection
Localized : German - Category : Templates - License : LGPL - OOoVersion : 2.1
Description : a collection of German templates hosted by the Germanophone project

* LilyPond for OpenOffice.org
Localized : English - Category : Music - License : ? Version : 2.1 OOoLilyPond is a macro for OpenOffice.org that simplifies the integration of music notation in OpenOffice.org Writer of Impress. It can be used to write a book on music theory or to write down exercises for music instruments or voices which need to be commented with lots of text.

* Pagination
Localized : French, English - Category: Writer Add-On - License : LGPL - OOoVersion : 2.x
Description : A macro to simplify the commands to paginate a document. Brings up a dialog box where you can choose among some options (position, first number, etc.)

* Calendrier
Localized : French, English - Category : Writer Add-On - License: LGPL - OOoversion : 2.0.4
Description : A tool to create calendar pages for one month or for one year.
November 2009
S M T W T F S
October 2009December 2009
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30