Hi ashok,
ashok _ escribió:
I have a java UNO application that opens an OpenOffice document, and
provides the user with a swing UI to manipulate the document.
The swing application has a toolbar that provides various mark-up and
editing tools that act on the document.
I want to enable / disable some of these toolbar actions based on the
state of the viewcursor in the openoffice document.
for. e.g. if the cursor is in a particular section a toolbar action is
enabled, or if an image is selected in the document certain toolbar
items are disabled and so on....
Currently i do this within a swing timer thread that does all these
checks perioidically on the document and changes the state of the
toolbar approriately. However this is quite expensive as I have to do
all the checks everytime in the timer thread.
Is there a standard way I can make openoffice send notifications to my
application about such changes ? I have been looking at attaching an
XEventLister to the document's XComponent object and notifiying the
application from within the XEventListener class .... but is this the
correct way to do it ? or is there a better way to do this ?
first you should try to avoid the use of swing (or other Java gui)
within OOo, as I read it somewhere
(http://tools.openoffice.org/policies/java_usage.html): "OOo Java
implementations must not use swing, either because no free swing
implemetation is available or because it makes the user interface
inconsistent"
I think this is true: we should try that our extensions look consistent
with the general OOo look & feel.
Second, if you were using OOo API instead of a Java GUI with a toolbar,
you could achieve what you're trying to do using the so called "Complex
Toolbar Controls" functionaly, as explainer in
http://wiki.services.openoffice.org/wiki/Framework/Article/Generic_UNO_Interfaces_for_complex_toolbar_controls
and illustrated in the SDK example
$SDK_HOME/examples/cpp/complextoolbarcontrols
Regards,
Ariel
--
Ariel Constenla-Haile
La Plata, Argentina
[EMAIL PROTECTED]
[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]