On 07/22/10 19:13, Pivithuru Wijegunawardana wrote:
I have created a simple GUI using UNO awt for statistical data analysis tool
in summer internship program. Now I want to get the user input data from the
spreadsheet from clac range selection. I hope to do this after user has
opened the dialog. Functionality I need is something alike the cell function
data input method. I wanted to know whether this is possible in using UNO
awt and cell range selection.

There is the XRangeSelection interface of the SpreadsheetView service, but it doesn't allow the same level of integration as Calc's own dialogs. With this interface, you can do something like the "Data Range" page of the "Chart Wizard" dialog, where you have a button in a modal dialog and start the range selection if that button is pressed. It doesn't allow selecting a range in the sheet with just the focus in a range edit, like it's possible in the Calc dialogs.

Sooner or later we'll have to extend the API here, so extensions can have dialogs that work like our own. So we shouldn't put much effort into implementing something with XRangeSelection now. Instead I suggest to just use simple Edit controls into which the range address has to be typed, like "Copy sort results to" in the "Sort" dialog. The component then has to parse that input. If we later extend the API, we can have the new API read and write from these Edit controls.

One thing you should prepare is the possibility to change your dialogs to modeless dialogs, because that's how Calc's reference dialogs work. A modeless dialog doesn't have an execute method that returns when the dialog is closed. Instead it performs its actions from event handlers, so you can't keep information in local variables across the execute call. To simulate this, you can just add a method like "dialogClosed" to your component, and call it directly after "execute", with no additional parameters. If that method reads the settings from the dialog and does the processing, it can later be called from a listener when the dialog is changed to modeless.

Niklas

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@sc.openoffice.org
For additional commands, e-mail: dev-h...@sc.openoffice.org

Reply via email to