Hey Oliver, 

Thanks a bunch for that! 
The complete thing that I am trying to do is listed in my mail to the
api-dev, just a few minutes ago. 

The usecase I am trying to achieve is: 
1) Log document name/path/r-w attributes to a log (text/ascii) file in the
file system. 
2) Automatically read the contents of the document and log the same
(non-xml) on the file system.

I need the above usecases to happen, for each document that a user loads to
read/write/edit. 

Please advice. 

Cheers
G.

Gautham Kasinath
Masters Student
School of Computing and Information Science
Edith Cowan University
Mt. Lawley Campus
Perth
 
IM: [EMAIL PROTECTED], [EMAIL PROTECTED]
AOL Screen name: gkasinath42
Mobile: 0433 904 011
Home phone: 61 8 9444 8154
Home Page: http://www.geocities.com/gkasinath
The world is what it is, and we are what we are. - Maria Puzo (Godfather)

-----Original Message-----
From: Oliver Brinzing [mailto:[EMAIL PROTECTED] 
Sent: Saturday, January 07, 2006 9:17 PM
To: [email protected]
Subject: Re: [api-dev] RE: simple java component

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Gautham,

>  I am trying to write a component that will be invoked
> automatically when OOo initializes, and hence I expected some way to
invoke
> yours from the OOo writer, after loading.

you should have a look at the job execution environment ...
it's possible to start job's while oo is starting ... you're component can
install an GlobalEventBroadcaster an listen for global/document events:

        try {
            XMultiComponentFactory xMultiComponentFactory =
xComponentContext
                    .getServiceManager();

            Object objBroadCast = xMultiComponentFactory
                    .createInstanceWithContext(
                            "com.sun.star.frame.GlobalEventBroadcaster",
                            xComponentContext);

            xEvtBroadcast = (XEventBroadcaster) UnoRuntime.queryInterface(
                    XEventBroadcaster.class, objBroadCast);

            xEvtBroadcast.addEventListener(MyListener);

        } catch (Exception e) {
            e.printStackTrace();
        }

If you want to have access to your component via ui (toolsbar/menu), you can
install a ProtocolHandler (i will send you an example project ...)

> Please advice if such a thing is possible. At the moment I am reading
> through the dev guide about debugging in a hope that I can see your
> component working w/o having to write a remote client.

I am able to remote debug oo components using the eclipse debugger...
to do so, add the following statments to the jre oo uses ...
(Tools -> Options ... -> OpenOffice.org -> Java)

jre 1.4.2:
   -Xdebug
   -Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=n

jre 1.5.0:
 
agentlib:jdwp=transport=dt_socket,server=y,address=localhost:8000,suspend=n


if you want to start a component remote, start oo using:

soffice.exe
-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager

you can verifiy the connection with: netstat -a

regards

Oliver

- --
GnuPG key 0xCFD04A45: 8822 057F 4956 46D3 352C 1A06 4E2C AB40 CFD0 4A45
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFDv79hTiyrQM/QSkURAj/5AJ9I+qhYZosMWrsxc+iUYhjDbwnUCwCfTpk1
F50Ka2x3uhmmah9yCsPTiks=
=hHk+
-----END PGP SIGNATURE-----

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

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

Reply via email to