Hi Frank,

Frank Schönheit escribió:
Hi Ariel,

forgot one thing:

**********************************************************************
**********************************************************************

com.sun.star.view.XSelectionSupplier
...
* an issue that was present in the previous impl. and was solved there
but comes back now is that there is no notification for the icon choice
ctrl. selection on the app. swap window
(http://www.openoffice.org/issues/show_bug.cgi?id=69740)

Cannot reproduce this in DEV300m29 - creating a XSelectionChangeListener
in Basic, and adding it to a DBDoc's controller, gives me notifications
both when the tree view selection and when the "category" selection changes.

Could you please verify your findings?

on DEV300_m29, once I applied your patch, OOo does not crash anymore
when the listener is added by Job OnLoad.

In the following I report some tests.

*******************************************************************

1. open a db document, it will open with the "Forms" icon selected,
don't select any item(=form) on the tree

2. now select another icon (let's say "Queries") *without* selection any
item

3. repeat this procedure, always without selecting items from the tree view

The result is: you get indeed notified of a selection change, but the
NamedDatabaseObject sequence has 0 length. For example the output with
the demo extension is:


com.sun.star.view.XSelectionChangeListener.selectionChanged()
dbaccess application controller - selection:
        Selection count:        0

com.sun.star.view.XSelectionChangeListener.selectionChanged()
dbaccess application controller - selection:
        Selection count:        0

com.sun.star.view.XSelectionChangeListener.selectionChanged()
dbaccess application controller - selection:
        Selection count:        0

com.sun.star.view.XSelectionChangeListener.selectionChanged()
dbaccess application controller - selection:
        Selection count:        0

com.sun.star.view.XSelectionChangeListener.selectionChanged()
dbaccess application controller - selection:
        Selection count:        0


This way you get notified that the selection changed, but you have no
way to know what changed.


********************************************************************
********************************************************************

Another test:

1. open a db document, it will open with the "Forms" icon selected,
don't select any item(=form) on the tree

2. now select another icon (let's say "Queries") *without* selection any
item

3. now select the "Reports" icon, and select one report in the tree view

4. now select the "Forms" icon, without selecting any form the tree view


You get notified of the report being selected [step 3], but when the
"Forms" icon is selected, you get notified as above: a 0 length
NamedDatabaseObject sequence. With the demo extension, the output is:


com.sun.star.view.XSelectionChangeListener.selectionChanged()
dbaccess application controller - selection:
        Selection count:        1
                [0] Type : DatabaseObject.REPORT
                [0] Name :
level_1_2/level_2_1/level_2_1_1/level_2_1_1_1/may_never_happen

com.sun.star.view.XSelectionChangeListener.selectionChanged()
dbaccess application controller - selection:
        Selection count:        0




*****************************************************************
*****************************************************************

Yet another test:

1. open a db document, it will open with the "Forms" icon selected,
don't select any item(=form) on the tree

2. now select the "Reports" icon, and select one report in the tree view

3. now select the "Forms" icon, without selecting any form the tree view

4. now select the "Tables" icon, and select a table the tree view

5. play changing the category (Forms, Reports, Tables, Queries) selection

Result: you get always notified, but when nothing is selected on the
respective tree view, you get a 0 length NamedDatabaseObject sequence.
So you know *that* the selection changed, but you have no way to know
*what* category is selected (not very useful for example if you have a
complex toolbar controller that updates states according to the category
- i.e. Forms, Reports, Tables, Queries).

 I guess that in this case (nothing selected on the tree views, only
the icon choice control changes) one should get a

com.sun.star.sdb.application.NamedDatabaseObject[0].Type =
com.sun.star.sdb.application.DatabaseObjectContainer.ALL_TABLES /
com.sun.star.sdb.application.DatabaseObjectContainer.ALL_QUERIES /
com.sun.star.sdb.application.DatabaseObjectContainer.ALL_FORMS /
com.sun.star.sdb.application.DatabaseObjectContainer.ALL_REPORTS

I'm not sure about the NamedDatabaseObject[0].Name, but reading the
specification, will it be the name of the "data source"? Quoting:


"In case of the virtual folders denoted by
DatabaseObjectContainer::ALL_TABLES,
DatabaseObjectContainer::ALL_QUERIES,
DatabaseObjectContainer::DATA_SOURCE, DatabaseObjectContainer::ALL_FORMS
or DatabaseObjectContainer::ALL_REPORTS, this denotes the name of the
data source."

What do you understand by the "name of the datasource"? the name as seen
on the DataSourceBrowser tree ("DataSourceName" = "The name of the
globally registered DataSource to be used for initial display.")?
[Note to myself: the DataSourceBrowser implements also the
XContextMenuInterception (which gives you a selection), but I didn't
test it]

******************************************************************
******************************************************************

Multiple selection test:

1. open a db document, it will open with the "Forms" icon selected,
don't select any item(=form) on the tree

2. select a category where you have several items on the tree view

3. select an element on the tree view ==> you get notified

4. pressing CTRL select another element  ==> you don't get notified

5. pressing CTRL select another element  ==> you don't get notified

6. select another category and then come back to the previous category
where 3 items in the tree view where selected  ==>  you get notified
that the selection changed, and that there are three elements selected.

The multiple selection is notified only when the category changes, not
as one goes selecting items (I guess that everytime the selection count
is increased, one should get a notification)


***************************************************************
***************************************************************

Multiple de-selection test:

1. select multiple elements keeping pressed the CTRL mod. key ==> you
don't get notified as the selection count increases

2. now without pressing the CTRL key, select one item, so that you from
multiple selection to only one item selected.

Following is the output. Comments start with "//" telling what I was doing

//********************************************************************

// when the document opens, the "Forms" icon is selected:
com.sun.star.view.XSelectionChangeListener.selectionChanged()
dbaccess application controller - selection:
        Selection count:        0


// select "Tables" icon
com.sun.star.view.XSelectionChangeListener.selectionChanged()
dbaccess application controller - selection:
        Selection count:        0


// select a table item on the tree view
com.sun.star.view.XSelectionChangeListener.selectionChanged()
dbaccess application controller - selection:
        Selection count:        1
                [0] Type : DatabaseObject.TABLE
                [0] Name : CLIENTES

// pressing CTRL, select other tables
// NO notification!


// select the "Forms" icon, without selecting any form
com.sun.star.view.XSelectionChangeListener.selectionChanged()
dbaccess application controller - selection:
        Selection count:        0


// select the "Tables" icon, where the tables where already selected
com.sun.star.view.XSelectionChangeListener.selectionChanged()
dbaccess application controller - selection:
        Selection count:        6
                [0] Type : DatabaseObject.TABLE
                [0] Name : CLIENTES
                [1] Type : DatabaseObject.TABLE
                [1] Name : copia_CLIENTES_CSV
                [2] Type : DatabaseObject.TABLE
                [2] Name : CSV_SIMPLE
                [3] Type : DatabaseObject.TABLE
                [3] Name : dBase_SIMPLE
                [4] Type : DatabaseObject.TABLE
                [4] Name : OOo_Calc_SIMPLE
                [5] Type : DatabaseObject.TABLE
                [5] Name : Vista1

// Select one table, without pressing CTRL, so that the multiple
// selection is de-selected, remaining only one selected item
// Here you get "count-down" series of de-selection notifications

com.sun.star.view.XSelectionChangeListener.selectionChanged()
dbaccess application controller - selection:
        Selection count:        5
                [0] Type : DatabaseObject.TABLE
                [0] Name : copia_CLIENTES_CSV
                [1] Type : DatabaseObject.TABLE
                [1] Name : CSV_SIMPLE
                [2] Type : DatabaseObject.TABLE
                [2] Name : dBase_SIMPLE
                [3] Type : DatabaseObject.TABLE
                [3] Name : OOo_Calc_SIMPLE
                [4] Type : DatabaseObject.TABLE
                [4] Name : Vista1



com.sun.star.view.XSelectionChangeListener.selectionChanged()
dbaccess application controller - selection:
        Selection count:        4
                [0] Type : DatabaseObject.TABLE
                [0] Name : CSV_SIMPLE
                [1] Type : DatabaseObject.TABLE
                [1] Name : dBase_SIMPLE
                [2] Type : DatabaseObject.TABLE
                [2] Name : OOo_Calc_SIMPLE
                [3] Type : DatabaseObject.TABLE
                [3] Name : Vista1



com.sun.star.view.XSelectionChangeListener.selectionChanged()
dbaccess application controller - selection:
        Selection count:        3
                [0] Type : DatabaseObject.TABLE
                [0] Name : dBase_SIMPLE
                [1] Type : DatabaseObject.TABLE
                [1] Name : OOo_Calc_SIMPLE
                [2] Type : DatabaseObject.TABLE
                [2] Name : Vista1



com.sun.star.view.XSelectionChangeListener.selectionChanged()
dbaccess application controller - selection:
        Selection count:        2
                [0] Type : DatabaseObject.TABLE
                [0] Name : OOo_Calc_SIMPLE
                [1] Type : DatabaseObject.TABLE
                [1] Name : Vista1



com.sun.star.view.XSelectionChangeListener.selectionChanged()
dbaccess application controller - selection:
        Selection count:        1
                [0] Type : DatabaseObject.TABLE
                [0] Name : Vista1



com.sun.star.view.XSelectionChangeListener.selectionChanged()
dbaccess application controller - selection:
        Selection count:        0


// in some cases I couldn't reproduce
// this changes [twice] the modified state
// of the document model

com.sun.star.document.XEventListener.notifyEvent()
        EventName:OnModifyChanged
        Source:[EMAIL PROTECTED]
[oid=-52a5c310;gcc3[0];1f814413e704d89ab568b8c13e074,
type=com.sun.star.frame.XModel]


com.sun.star.document.XEventListener.notifyEvent()
        EventName:OnModifyChanged
        Source:[EMAIL PROTECTED]
[oid=-52a5c310;gcc3[0];1f814413e704d89ab568b8c13e074,
type=com.sun.star.frame.XModel]


// finally the notification of the only remaining selected item
com.sun.star.view.XSelectionChangeListener.selectionChanged()
dbaccess application controller - selection:
        Selection count:        1
                [0] Type : DatabaseObject.TABLE
                [0] Name : CSV_SIMPLE

//************************************************************

here I find strange:

* no notification as the selection count increases
* the kind of "count-down" notifications when de-selecting a multiple
selection


*******************************************************************
*******************************************************************

Extra notification on selection changed:

1. select an item in the tree view
2. select another item (not selecting them both)

Result: you get three notifications instead of two:

com.sun.star.view.XSelectionChangeListener.selectionChanged()
dbaccess application controller - selection:
        Selection count:        1
                [0] Type : DatabaseObject.REPORT
                [0] Name :
level_1_2/level_2_1/level_2_1_1/level_2_1_1_1/may_never_happen


// this is an extra notification
com.sun.star.view.XSelectionChangeListener.selectionChanged()
dbaccess application controller - selection:
        Selection count:        0



com.sun.star.view.XSelectionChangeListener.selectionChanged()
dbaccess application controller - selection:
        Selection count:        1
                [0] Type : DatabaseObject.REPORT
                [0] Name : level_1_1/level_2_2/Report_a


*******************************************************************
*******************************************************************

Finally, reading Drew's comment on
http://www.openoffice.org/issues/show_bug.cgi?id=69740 I remember of the
incompatible [unpublished] API change: now the
com.sun.star.view.XSelectionChangeListener gets a sequence of
com.sun.star.sdb.application.NamedDatabaseObject , formerly it was a
sequence of css.beans.NamedValue. Seems that Drew isn't subscribed to
[EMAIL PROTECTED], which reminds me to start a thread in
[EMAIL PROTECTED] in order to discuss about moving interface-announce/discussion
to [EMAIL PROTECTED], when it's about OOo API and not some internal C++ impl.
[first I thought about dedicated mailing lists, but there are already
too many lists]


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]

Reply via email to