summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ¼diger Timm <rt@openoffice.org>2003-06-12 06:59:28 +0000
committerRĂ¼diger Timm <rt@openoffice.org>2003-06-12 06:59:28 +0000
commit1236d2b7dde36e055a5d501a55e7b9bd9afc636e (patch)
treea9bf414ea1dda70a316fc0bda67cd8aee11acec3
parent86bc7a381133636154c422d32c3bd93e29750a50 (diff)
INTEGRATION: CWS uaa04 (1.6.2); FILE MERGED
2003/06/04 07:21:08 obr 1.6.2.3: finished transition from tabs to spaces 2003/06/02 12:49:53 obr 1.6.2.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:47 obr 1.6.2.1: #i14100# changed the private text change protocol with the JABG
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/Component.java87
1 files changed, 30 insertions, 57 deletions
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Component.java b/accessibility/bridge/org/openoffice/java/accessibility/Component.java
index 1eb84ac94f8c..b5b65e4d40e2 100644
--- a/accessibility/bridge/org/openoffice/java/accessibility/Component.java
+++ b/accessibility/bridge/org/openoffice/java/accessibility/Component.java
@@ -2,9 +2,9 @@
*
* $RCSfile: Component.java,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: vg $ $Date: 2003-05-22 12:39:59 $
+ * last change: $Author: rt $ $Date: 2003-06-12 07:59:28 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -316,42 +316,6 @@ public abstract class Component extends java.awt.Component {
}
}
- /** Fires the appropriate PropertyChangeEvent */
- protected void handleTextChangedEvent(Object any1, Object any2) {
- Object[] values = new Object[2];
- try {
- if (AnyConverter.isObject(any1)) {
- com.sun.star.awt.Selection s = (com.sun.star.awt.Selection)
- AnyConverter.toObject(SelectionType, any1);
- if (s != null) {
- // Since there is nothing like a "range" object in the JAA yet,
- // the Integer[2] is a private negotiation with the JABG
- Integer[] deleted = { new Integer(s.Min), new Integer(s.Max) };
- values[0] = deleted;
- if (Build.DEBUG) {
- System.err.println("text range (" + s.Min + "," + s.Max + ") deleted");
- }
- }
- }
-
- if (AnyConverter.isObject(any2)) {
- com.sun.star.awt.Selection s = (com.sun.star.awt.Selection)
- AnyConverter.toObject(SelectionType, any2);
- if (s != null) {
- // Since there is nothing like a "range" object in the JAA yet,
- // the Integer[2] is a private negotiation with the JABG
- Integer[] inserted = { new Integer(s.Min), new Integer(s.Max) };
- values[1] = inserted;
- if (Build.DEBUG) {
- System.err.println("text range (" + s.Min + "," + s.Max + ") inserted");
- }
- }
- }
- firePropertyChange(AccessibleContext.ACCESSIBLE_TEXT_PROPERTY, values[0], values[1]);
- } catch (com.sun.star.lang.IllegalArgumentException e) {
- }
- }
-
/** Called by OpenOffice process to notify property changes */
public void notifyEvent(AccessibleEventObject event) {
switch (event.EventId) {
@@ -383,7 +347,9 @@ public abstract class Component extends java.awt.Component {
firePropertyChange(AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY, null, null);
break;
case AccessibleEventId.TEXT_CHANGED:
- handleTextChangedEvent(event.OldValue, event.NewValue);
+ firePropertyChange(AccessibleContext.ACCESSIBLE_TEXT_PROPERTY,
+ AccessibleTextImpl.convertTextSegment(event.OldValue),
+ AccessibleTextImpl.convertTextSegment(event.NewValue));
break;
case AccessibleEventId.CARET_CHANGED:
firePropertyChange(accessibleContext.ACCESSIBLE_CARET_PROPERTY, toNumber(event.OldValue), toNumber(event.NewValue));
@@ -409,28 +375,35 @@ public abstract class Component extends java.awt.Component {
return new AccessibleUNOComponentListener();
}
- protected AccessibleContext accessibleContext = null;
+ protected javax.accessibility.AccessibleContext accessibleContext = null;
- protected abstract class AccessibleUNOComponent extends java.awt.Component.AccessibleAWTComponent
- implements javax.accessibility.AccessibleExtendedComponent {
+ /** This method actually creates the AccessibleContext object returned by
+ * getAccessibleContext().
+ */
+ protected javax.accessibility.AccessibleContext createAccessibleContext() {
+ return null;
+ }
- /**
- * Though the class is abstract, this should be called by all sub-classes
- */
- protected AccessibleUNOComponent() {
- 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);
+ /** Returns the AccessibleContext associated with this object */
+ public final javax.accessibility.AccessibleContext getAccessibleContext() {
+ if (accessibleContext == null) {
+ 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 abstract class AccessibleUNOComponent extends java.awt.Component.AccessibleAWTComponent
+ implements javax.accessibility.AccessibleExtendedComponent {
/** Check if the parent of an selectable object supports AccessibleSelection */
protected void dbgCheckSelectable() {