summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ¼diger Timm <rt@openoffice.org>2003-06-12 06:59:37 +0000
committerRĂ¼diger Timm <rt@openoffice.org>2003-06-12 06:59:37 +0000
commit39775bc56d22683babfcaa3287b9d8c7ff7e54db (patch)
tree65a3000cb3b4d306a18f124a8df67fa33f1f4507
parent1236d2b7dde36e055a5d501a55e7b9bd9afc636e (diff)
INTEGRATION: CWS uaa04 (1.4.12); FILE MERGED
2003/06/04 08:54:10 obr 1.4.12.4: #i13956# container now support AccessibleText 2003/06/04 07:21:09 obr 1.4.12.3: finished transition from tabs to spaces 2003/06/02 12:49:54 obr 1.4.12.2: #109747# implement getAccessibleContext in a failsafe way, so that it can't kill the dispatch thread of the Java AccessBridge for Windows 2003/05/28 14:45:46 obr 1.4.12.1: #i14100# changed the private text change protocol with the JABG
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/Container.java86
1 files changed, 46 insertions, 40 deletions
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Container.java b/accessibility/bridge/org/openoffice/java/accessibility/Container.java
index 14881bf2fc29..0c5f87bb74e6 100644
--- a/accessibility/bridge/org/openoffice/java/accessibility/Container.java
+++ b/accessibility/bridge/org/openoffice/java/accessibility/Container.java
@@ -58,7 +58,6 @@
package org.openoffice.java.accessibility;
import javax.accessibility.AccessibleContext;
-import javax.accessibility.AccessibleRole;
import javax.accessibility.AccessibleState;
import com.sun.star.uno.*;
@@ -70,16 +69,18 @@ public class Container extends java.awt.Container implements javax.accessibility
protected XAccessibleContext unoAccessibleContext;
protected XAccessibleComponent unoAccessibleComponent = null;
- protected AccessibleRole accessibleRole;
+ protected javax.accessibility.AccessibleRole accessibleRole;
+ protected javax.accessibility.AccessibleText accessibleText;
protected boolean disposed = false;
- protected Container(AccessibleRole role, XAccessible xAccessible, XAccessibleContext xAccessibleContext) {
+ protected Container(javax.accessibility.AccessibleRole role,
+ XAccessible xAccessible, XAccessibleContext xAccessibleContext) {
accessibleRole = role;
-
unoAccessible = xAccessible;
unoAccessibleContext = xAccessibleContext;
unoAccessibleComponent = (XAccessibleComponent)
- UnoRuntime.queryInterface(XAccessibleComponent.class, xAccessibleContext);
+ UnoRuntime.queryInterface(XAccessibleComponent.class,
+ xAccessibleContext);
// Add the event listener right away, because the global focus notification doesn't
// work yet ..
@@ -320,6 +321,11 @@ public class Container extends java.awt.Container implements javax.accessibility
// Update the internal state set and fire the appropriate PropertyChangedEvent
handleStateChangedEvent(event.OldValue, event.NewValue);
break;
+ case AccessibleEventId.TEXT_CHANGED:
+ firePropertyChange(AccessibleContext.ACCESSIBLE_TEXT_PROPERTY,
+ AccessibleTextImpl.convertTextSegment(event.OldValue),
+ AccessibleTextImpl.convertTextSegment(event.NewValue));
+ break;
case AccessibleEventId.CHILD:
if (AnyConverter.isObject(event.OldValue)) {
AccessibleObjectFactory.removeChild(Container.this, event.OldValue);
@@ -359,51 +365,46 @@ public class Container extends java.awt.Container implements javax.accessibility
protected javax.accessibility.AccessibleContext accessibleContext = null;
+ /** This method actually creates the AccessibleContext object returned by
+ * getAccessibleContext().
+ */
+ protected javax.accessibility.AccessibleContext createAccessibleContext() {
+ return new AccessibleContainer();
+ }
+
/** Returns the AccessibleContext associated with this object */
- public javax.accessibility.AccessibleContext getAccessibleContext() {
+ public final javax.accessibility.AccessibleContext getAccessibleContext() {
if (accessibleContext == null) {
- accessibleContext = new AccessibleContainer();
+ try {
+ AccessibleContext ac = createAccessibleContext();
+ if (ac != null) {
+ // Set accessible name and description here to avoid
+ // unnecessary property change events later ..
+ ac.setAccessibleName(unoAccessibleContext.getAccessibleName());
+ ac.setAccessibleDescription(unoAccessibleContext.getAccessibleDescription());
+ accessibleContext = ac;
+ }
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
}
return accessibleContext;
}
protected class AccessibleContainer extends java.awt.Container.AccessibleAWTContainer {
- /**
- * Though the class is abstract, this should be called by all sub-classes
- */
protected AccessibleContainer() {
- super();
- // Set accessible name and description here to avoid unnecessary property change
- // events later ..
- XAccessibleContext unoAccessibleContext = unoAccessible.getAccessibleContext();
- String s = unoAccessibleContext.getAccessibleName();
- if (s != null && s.length() > 0) {
- setAccessibleName(s);
- }
- s = unoAccessibleContext.getAccessibleDescription();
- if (s != null && s.length() > 0) {
- setAccessibleDescription(s);
- }
-/*
- try {
- XAccessibleContext unoAccessibleContext = (XAccessibleContext)
- UnoRuntime.queryInterface(XAccessibleContext.class, unoAccessibleComponent);
+ /* Since getAccessibleText() is heavily used by the java access
+ * bridge for gnome and the gnome at-tools, we do a query interface
+ * here and remember the result.
+ */
+ accessibleText = AccessibleTextImpl.get(unoAccessibleContext);
+ }
- if (unoAccessibleContext!= null) {
- String s = unoAccessibleContext.getAccessibleName();
- if (s != null && s.length() > 0) {
- setAccessibleName(s);
- }
- s = unoAccessibleContext.getAccessibleDescription();
- if (s != null && s.length() > 0) {
- setAccessibleDescription(s);
- }
- }
- } catch (com.sun.star.uno.RuntimeException e) {
- System.err.println("RuntimeException caught");
- }
-*/
+ protected AccessibleContainer(boolean query) {
+ /* This constructor is explicitly for subclasses that implement
+ * AccessibleHypertext and therefor the default constructor would
+ * bring unnecessary overhead.
+ */
}
/** Check if the parent of an selectable object supports AccessibleSelection */
@@ -588,6 +589,11 @@ public class Container extends java.awt.Container implements javax.accessibility
return accessibleRole;
}
+ /** Gets the AccessibleText associated with this object presenting text on the display */
+ public javax.accessibility.AccessibleText getAccessibleText() {
+ return accessibleText;
+ }
+
/**
* Gets the current state set of this object.
*