INTEGRATION: CWS uaa04 (1.4.2); FILE MERGED

2003/06/02 12:49:54 obr 1.4.2.1: #109747# implement getAccessibleContext in a failsafe way, so that it can't kill the dispatch thread of the Java AccessBridge for Windows
This commit is contained in:
Rüdiger Timm 2003-06-12 06:59:46 +00:00
parent 39775bc56d
commit 8a5025216e

View file

@ -54,25 +54,27 @@
* *
* *
************************************************************************/ ************************************************************************/
package org.openoffice.java.accessibility; package org.openoffice.java.accessibility;
import com.sun.star.accessibility.*;
import com.sun.star.uno.AnyConverter;
import com.sun.star.uno.UnoRuntime;
import javax.accessibility.AccessibleState; import javax.accessibility.AccessibleState;
import com.sun.star.uno.AnyConverter;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.accessibility.*;
public abstract class DescendantManager extends Component { public abstract class DescendantManager extends Component {
protected XAccessibleSelection unoAccessibleSelection = null; protected XAccessibleSelection unoAccessibleSelection = null;
protected javax.accessibility.Accessible activeDescendant = null; protected javax.accessibility.Accessible activeDescendant = null;
protected boolean multiselectable = false; protected boolean multiselectable = false;
protected DescendantManager(XAccessible xAccessible, XAccessibleContext xAccessibleContext) { protected DescendantManager(XAccessible xAccessible,
XAccessibleContext xAccessibleContext) {
super(xAccessible, xAccessibleContext); super(xAccessible, xAccessibleContext);
} }
protected DescendantManager(XAccessible xAccessible, XAccessibleContext xAccessibleContext, boolean multiselectable) { protected DescendantManager(XAccessible xAccessible,
XAccessibleContext xAccessibleContext, boolean multiselectable) {
super(xAccessible, xAccessibleContext); super(xAccessible, xAccessibleContext);
this.multiselectable = multiselectable; this.multiselectable = multiselectable;
} }
@ -80,39 +82,43 @@ public abstract class DescendantManager extends Component {
/** /**
* Update the proxy objects appropriatly on property change events * Update the proxy objects appropriatly on property change events
*/ */
protected class AccessibleDescendantManagerListener extends AccessibleUNOComponentListener { protected class AccessibleDescendantManagerListener
extends AccessibleUNOComponentListener {
protected AccessibleDescendantManagerListener() { protected AccessibleDescendantManagerListener() {
super(); unoAccessibleSelection = (XAccessibleSelection) UnoRuntime.queryInterface(XAccessibleSelection.class,
unoAccessibleContext);
} }
/** Called by OpenOffice process to notify property changes */ /** Called by OpenOffice process to notify property changes */
public void notifyEvent(AccessibleEventObject event) { public void notifyEvent(AccessibleEventObject event) {
switch (event.EventId) { switch (event.EventId) {
case AccessibleEventId.SELECTION_CHANGED: case AccessibleEventId.SELECTION_CHANGED:
firePropertyChange(javax.accessibility.AccessibleContext.ACCESSIBLE_SELECTION_PROPERTY, null, null); firePropertyChange(javax.accessibility.AccessibleContext.ACCESSIBLE_SELECTION_PROPERTY,
null, null);
break; break;
default: default:
super.notifyEvent(event); super.notifyEvent(event);
} }
} }
} }
protected abstract class AccessibleDescendantManager extends AccessibleUNOComponent protected abstract class AccessibleDescendantManager
extends AccessibleUNOComponent
implements javax.accessibility.AccessibleSelection { implements javax.accessibility.AccessibleSelection {
/**
* Though the class is abstract, this should be called by all sub-classes
*/
protected AccessibleDescendantManager() { protected AccessibleDescendantManager() {
super(); unoAccessibleSelection = (XAccessibleSelection) UnoRuntime.queryInterface(XAccessibleSelection.class,
unoAccessibleContext);
} }
/** Returns an AccessibleStateSet that contains corresponding Java states to the UAA state types */ /** Returns an AccessibleStateSet that contains corresponding Java states to the UAA state types */
protected javax.accessibility.AccessibleStateSet getAccessibleStateSetImpl(XAccessibleStateSet unoAS) { protected javax.accessibility.AccessibleStateSet getAccessibleStateSetImpl(
XAccessibleStateSet unoAS) {
javax.accessibility.AccessibleStateSet states = super.getAccessibleStateSetImpl(unoAS); javax.accessibility.AccessibleStateSet states = super.getAccessibleStateSetImpl(unoAS);
states.add(AccessibleExtendedState.MANAGES_DESCENDANTS); states.add(AccessibleExtendedState.MANAGES_DESCENDANTS);
if (multiselectable) { if (multiselectable) {
states.add(javax.accessibility.AccessibleState.MULTISELECTABLE); states.add(javax.accessibility.AccessibleState.MULTISELECTABLE);
} }
@ -120,7 +126,6 @@ public abstract class DescendantManager extends Component {
return states; return states;
} }
/* /*
* AccessibleContext * AccessibleContext
*/ */
@ -198,4 +203,3 @@ public abstract class DescendantManager extends Component {
} }
} }
} }