Hi Drew,
currently it is not that simple to get the current selection in database
app. Normally the database model com.sun.star.frame.XModel supports the
method getCurrentSelection which asks the current controller for his
getSelection when the controller supports the XSelectionSupplier
interface which isn't the case at the moment. The other way to get the
currently selected entry would be over the accessibility API but
therefor you have to search for a TreeList control below the window
hierarchy of the db window. I don't know what is easier, to implement
the XSelectionSupplier at the AppController.cxx of dbaccess or to use
accessibility API :-) But of course you should submit an enhancement
issue for this. The funny thing here is that the controller which is
responsible for displaying table/query data supports this interface.
There you get a sequence of PropertyValue which are needed to fill a RowSet.
Have a nice day,
Ocke
Andrew Jensen wrote:
Hi,
Well, the subject line pretty much sums it up, but this is why.
I currently have a macro that exports the result set of a query to a
text table. It is fairly simple using the SELECT INTO TEXT TABLE
command of HSQLDB and then simply removes the table object that is
created in the datasource. It is currently hard coded for the query,
and creates a file name based on the current date.
Now, after reading Mechtilde's comment yesterday I was thinking about
how one could generalize this macro and perhaps end up with an addon.
Preferably I would like to be able to run the macro and have it
recognize if either a table item or a query item is selected in the
BaseDocument window and use this as the source, prompting the user for
a file name.
The first step of course is to recognize when the current component on
the desktop is a BaseDocument. I have that part - pretty much -
working, although an open table view window on top of the basedocument
window is a problem still.
But the next step, getting a handle to the current selection just
eludes me. Any ideas on this would be most appreciated.
If this is not possible at this moment, then so be it. I can easily
put together a dialog box that would allow the user to select a table
or a query.
Then the next step would be figuring out how to make this an addon -
but here there seems to be plenty of resources to turn to and I will
scoure them first.
Thanks
Drew
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Ocke Janssen Tel: +49 40 23646 661, x66661
Dipl. Inf(FH) Fax: +49 40 23646 550
Sun Microsystems Inc.
Nagelsweg 55 mailto:[EMAIL PROTECTED]
D-20097 Hamburg http://www.sun.com/staroffice
Example isn't another way to teach,
it is the only way to teach.
Albert Einstein
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]