Hi Ariel, > you can find a Scripting Framework example using a Java "macro" to test > in DatabaseDocument/s. You have to unzip and store the folder inside > your OOo user dir. user/Scripts/java and restart OOo to deploy it. > Inside this folder you will also find an ODB with the JAR embedded.
interesting, you picked the least-obvious "scripting language" to test, given that Java is the only one which has no UI for editing the "scripts". That's a good thing, actually :) > DataSourceBrowser: (note to myself: play more with the DataSourceBrowser in a Writer/Calc document, this was not on my list so far. note to Ariel: thanks for the hint.) > 1. open the table "names" > 2. from it, open the dialog Tools - Macros - Run macro - Macro selector > 3.1. if you run the Java method globalHello in user's > Script/java/HelloODB > XScriptContext.getDocument() returns NULL, so I use > XScriptContext.getDesktop().getCurrentFrame() to identify > the module, and the result is css.sdb.DataSourceBrowser > 3.2. if you run the Java method localHello embedded in the ODB > XScriptContext.getDocument() returns an XModel reference > to the css.sdb.OfficeDatabaseDocument (the dialog will be > executed with the app. main container window as parent > because the XModel is not null and so I instantiate the > DialogProvider with it as argument -- I could avoid this, > but I wanted to stress how the Scripting Framework's > XScriptContext.getDocument() works like ThisDatabaseDocument > even if invoked from the DSBrowser) In fact, XScriptContext.getDocument() and ThisDatabaseDocument are mapped to the same: the document containing the macros. XScriptContext.getInvocationContext() and ThisComponent are mapped to the component from where the macro was called. > FormDesign: > here this begin to get more complicated, and it makes really a > difference the OS, and if you are debugging or just running the Java macro. > For example, I left an exception I got only on Windows without > debugging, to see if other's can reproduce it. > Anyway exceptions are caught an the stack trace printed on a JPanel. > > > I still didn't have the time to test it deeply, but at first sight some > thing seems issues (for example, invoking from toolbars is impossible). Okay, I need to find time to play with it. If you're faster with describing what you mean with "impossible", I might spare it :) Thanks & Ciao Frank -- - Frank Schönheit, Software Engineer [EMAIL PROTECTED] - - Sun Microsystems http://www.sun.com/staroffice - - OpenOffice.org Base http://dba.openoffice.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]