Hi Joel,

Joel Cordeiro escribió:
Thank you for the aknowledge.

As i know, i dont need to write a Uno Component, since my extension just
adds some entries to the context menu, and make some access to the
OpenThesaurus service.

that's why you *need* a Uno component implementing a css.task.Job [sorry
if I was rather cryptic in my previous mail]

(specification:
http://api.openoffice.org/docs/common/ref/com/sun/star/task/Job.html
documentation:
http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/Jobs/Implementation)

If you don't need an extension, let's say you want it for yourself, in
your own and only PC, you may achieve this even with OOo Basic adding a
macro with the menu "Tools" - "Customize" - "Events".

But if you want an extension, you must use a language which is able to
implement Uno components (C++/Java/Python).

Why?

You know that in order to add menu entries in a context menu, you need
to register a css.ui.XContextMenuInterceptor at the
css.frame.Controller's css.ui.XContextMenuInterception.
Besides, I guess you want to add this menu entries to *every* OOo Writer
document, and in every "context" where it makes sense to add these
entries (I mean, you don't want to add some entry bringing some
thesaurus feature when the user right-clicks a picture, or a form
control in design view)

So you need first a way to access the Controller of every Writer
document, every time the user creates a new document, or opens an
existing one.

How can your extension know when a new document is created, or an
existing one is loaded?
By registering a Job that will be executed upon this events:

* OnNew = a new documented is created
* OnLoad = a documented is loaded

This is clear by the Job definition:

"A job in OpenOffice.org is a UNO component that can be executed by the
job execution environment upon an event."

this means that every time a doc. is created, or loaded, the application
framework will invoke your UNO component's execute()
[http://api.openoffice.org/docs/common/ref/com/sun/star/task/XJob.html#execute]
method.

In the case your Job is registered for the OnLoad / OnNew events, when
the components's execute() methods is invoked you will get a reference
to the document's model, and from this you can start working: access the
Controller from the model with css.frame.XModel.getCurrentController() .

But as the controller can be disposed, or the same model can have
several controllers for different views, you need to do some extra work,
as explained on my previous mail; if not, your context menu interceptor
won't work in every context you'd really want it to; and your user may
find very annoying that your extensions sometimes works but other times not.


So my problem is just deploying it and make it
working as an extension for the extension manager of Open Office.


you can try the NetBeans IDE plug-in; it's both user-friendly (that is,
with easy-to-use wizards) and very complete; it can ease your work a
lot, if you first study how to use it.
I suggest you to try with the option "Debug Extension in Target
openOffice.org", and set breakpoint in your code.

You can try first by creating a client application with the SDK context
menu interceptor example.


Regards
Ariel.


--
Ariel Constenla-Haile
La Plata, Argentina

[EMAIL PROTECTED]
http://www.ArielConstenlaHaile.com.ar/ooo/



"Aus der Kriegsschule des Lebens
                - Was mich nicht umbringt,
        macht mich härter."
                Nietzsche Götzendämmerung, Sprüche und Pfeile, 8.






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to