diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-08-23 15:06:53 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-08-23 15:06:53 +0200 |
commit | 6e4894c2019dc9c442dce738d3f0423d8d74973f (patch) | |
tree | e3734a287f4c02ecb120e54aa32141f95f484236 /accessibility/bridge/org/openoffice/java/accessibility/Component.java | |
parent | b84e1626f6fcb29fe784933dee51079c3447a50c (diff) |
recreated tag libreoffice-3.3.3.1 which had these commits:
commit d7e53cee633ec1c583c72e6d9c01122195c4383c (tag: refs/tags/libreoffice-3.3.3.1)
Author: Petr Mladek <pmladek@suse.cz>
Date: Tue May 31 17:39:04 2011 +0200
Version 3.3.3.1, tag libreoffice-3.3.3.1 (3.3.3-rc1)
Notes
split repo tag: components_libreoffice-3.3.3.1
split repo tag: components_libreoffice-3.3.4.1
Diffstat (limited to 'accessibility/bridge/org/openoffice/java/accessibility/Component.java')
-rw-r--r-- | accessibility/bridge/org/openoffice/java/accessibility/Component.java | 198 |
1 files changed, 99 insertions, 99 deletions
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Component.java b/accessibility/bridge/org/openoffice/java/accessibility/Component.java index 21043e1f5098..5101080f9ab7 100644 --- a/accessibility/bridge/org/openoffice/java/accessibility/Component.java +++ b/accessibility/bridge/org/openoffice/java/accessibility/Component.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -36,18 +36,18 @@ import com.sun.star.accessibility.*; public abstract class Component extends java.awt.Component { public static final Type RectangleType = new Type(com.sun.star.awt.Rectangle.class); public static final Type SelectionType = new Type(com.sun.star.awt.Selection.class); - + protected XAccessible unoAccessible; protected XAccessibleContext unoAccessibleContext; protected XAccessibleComponent unoAccessibleComponent; - + protected boolean disposed = false; - + protected Component(XAccessible xAccessible, XAccessibleContext xAccessibleContext) { super(); unoAccessible = xAccessible; unoAccessibleContext = xAccessibleContext; - unoAccessibleComponent = (XAccessibleComponent) + unoAccessibleComponent = (XAccessibleComponent) UnoRuntime.queryInterface(XAccessibleComponent.class, xAccessibleContext); // Add the event listener right away, because the global focus notification doesn't // work yet .. @@ -58,10 +58,10 @@ public abstract class Component extends java.awt.Component { broadcaster.addEventListener(createEventListener()); } } - + /** - * Determines whether this <code>Component</code> is showing on screen. - * This means that the component must be visible, and it must be in a + * Determines whether this <code>Component</code> is showing on screen. + * This means that the component must be visible, and it must be in a * <code>container</code> that is visible and showing. * @see #addNotify * @see #removeNotify @@ -74,10 +74,10 @@ public abstract class Component extends java.awt.Component { } return false; } - + /** * Makes this <code>Component</code> displayable by connecting it to a - * native screen resource. + * native screen resource. * This method is called internally by the toolkit and should * not be called directly by programs. * @see #isDisplayable @@ -86,10 +86,10 @@ public abstract class Component extends java.awt.Component { */ public void addNotify() { } - - /** + + /** * Makes this <code>Component</code> undisplayable by destroying it native - * screen resource. + * screen resource. * This method is called by the toolkit internally and should * not be called directly by programs. * @see #isDisplayable @@ -98,37 +98,37 @@ public abstract class Component extends java.awt.Component { */ public void removeNotify() { } - + /* * Fake the java focus handling. This is necessary to keep OOo focus * in sync with the java focus. See java.awt.DefaultKeyboardFocusManager * for implementation details. **/ - + /** Requests focus for this object */ public void requestFocus() { } - + /** Requests focus for this object */ public boolean requestFocus(boolean temporary) { // Must be a no-op to make focus handling work return true; } - + /** Requests the focus for this object in the containing window */ public boolean requestFocusInWindow() { return requestFocusInWindow(false); } - + /** Requests the focus for this object in the containing window */ protected boolean requestFocusInWindow(boolean temporary) { if (isFocusable() && isVisible()) { - getEventQueue().postEvent(new java.awt.event.FocusEvent(this, java.awt.event.FocusEvent.FOCUS_GAINED, temporary)); + getEventQueue().postEvent(new java.awt.event.FocusEvent(this, java.awt.event.FocusEvent.FOCUS_GAINED, temporary)); return true; } return false; } - + public Object[] getAccessibleComponents(Object[] targetSet) { try { java.util.ArrayList list = new java.util.ArrayList(targetSet.length); @@ -145,22 +145,22 @@ public abstract class Component extends java.awt.Component { return null; } } - + protected java.awt.EventQueue getEventQueue() { return java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue(); } - + protected class PropertyChangeBroadcaster implements Runnable { String propertyName; Object oldValue; Object newValue; - + public PropertyChangeBroadcaster(String name, Object param1, Object param2) { propertyName = name; oldValue = param1; newValue = param2; } - + public void run() { // Because this code is executed in the DispatchThread, it is better to catch every // exception that might occur @@ -177,19 +177,19 @@ public abstract class Component extends java.awt.Component { } } } - + protected void firePropertyChange(String property, Object oldValue, Object newValue) { getEventQueue().invokeLater(new PropertyChangeBroadcaster(property, oldValue, newValue)); } - + protected void fireStatePropertyChange(AccessibleState state, boolean set) { PropertyChangeBroadcaster broadcaster; - + // if (Build.DEBUG) { // System.err.println("[" + AccessibleRoleAdapter.getAccessibleRole(unoAccessibleContext.getAccessibleRole()) + "] " + // unoAccessibleContext.getAccessibleName() + " is " + (set ? "now " : "no longer ") + state); // } - + if (set) { broadcaster = new PropertyChangeBroadcaster( accessibleContext.ACCESSIBLE_STATE_PROPERTY, @@ -201,15 +201,15 @@ public abstract class Component extends java.awt.Component { } getEventQueue().invokeLater(broadcaster); } - + /** * Update the proxy objects appropriatly on property change events */ protected class AccessibleUNOComponentListener implements XAccessibleEventListener { - + protected AccessibleUNOComponentListener() { } - + protected void setComponentState(short state, boolean enable) { switch (state) { case AccessibleStateType.ACTIVE: @@ -229,8 +229,8 @@ public abstract class Component extends java.awt.Component { break; case AccessibleStateType.FOCUSED: getEventQueue().postEvent(new java.awt.event.FocusEvent( - Component.this, enable ? - java.awt.event.FocusEvent.FOCUS_GAINED : + Component.this, enable ? + java.awt.event.FocusEvent.FOCUS_GAINED : java.awt.event.FocusEvent.FOCUS_LOST)); break; case AccessibleStateType.PRESSED: @@ -255,7 +255,7 @@ public abstract class Component extends java.awt.Component { break; } } - + /** Updates the accessible name and fires the appropriate PropertyChangedEvent */ protected void handleNameChangedEvent(Object any) { try { @@ -268,7 +268,7 @@ public abstract class Component extends java.awt.Component { } catch (com.sun.star.lang.IllegalArgumentException e) { } } - + /** Updates the accessible description and fires the appropriate PropertyChangedEvent */ protected void handleDescriptionChangedEvent(Object any) { try { @@ -281,26 +281,26 @@ public abstract class Component extends java.awt.Component { } catch (com.sun.star.lang.IllegalArgumentException e) { } } - + /** Updates the internal states and fires the appropriate PropertyChangedEvent */ protected void handleStateChangedEvent(Object any1, Object any2) { try { if (AnyConverter.isShort(any1)) { setComponentState(AnyConverter.toShort(any1), false); } - + if (AnyConverter.isShort(any2)) { setComponentState(AnyConverter.toShort(any2), true); } } catch (com.sun.star.lang.IllegalArgumentException e) { } } - + /** Called by OpenOffice process to notify property changes */ public void notifyEvent(AccessibleEventObject event) { - + if ( !disposed ) { - + switch (event.EventId) { case AccessibleEventId.ACTION_CHANGED: firePropertyChange(accessibleContext.ACCESSIBLE_ACTION_PROPERTY, @@ -331,7 +331,7 @@ public abstract class Component extends java.awt.Component { break; case AccessibleEventId.TEXT_CHANGED: firePropertyChange(AccessibleContext.ACCESSIBLE_TEXT_PROPERTY, - AccessibleTextImpl.convertTextSegment(event.OldValue), + AccessibleTextImpl.convertTextSegment(event.OldValue), AccessibleTextImpl.convertTextSegment(event.NewValue)); break; /* @@ -354,20 +354,20 @@ public abstract class Component extends java.awt.Component { } } } - + /** Called by OpenOffice process to notify that the UNO component is disposing */ public void disposing(com.sun.star.lang.EventObject eventObject) { disposed = true; AccessibleObjectFactory.disposing(Component.this); } } - + protected XAccessibleEventListener createEventListener() { return new AccessibleUNOComponentListener(); } - + protected javax.accessibility.AccessibleContext accessibleContext = null; - + /** This method actually creates the AccessibleContext object returned by * getAccessibleContext(). */ @@ -381,7 +381,7 @@ public abstract class Component extends java.awt.Component { try { AccessibleContext ac = createAccessibleContext(); if (ac != null) { - // Set accessible name and description here to avoid + // Set accessible name and description here to avoid // unnecessary property change events later .. ac.setAccessibleName(unoAccessibleContext.getAccessibleName()); ac.setAccessibleDescription(unoAccessibleContext.getAccessibleDescription()); @@ -392,12 +392,12 @@ public abstract class Component extends java.awt.Component { } return accessibleContext; } - - protected abstract class AccessibleUNOComponent extends java.awt.Component.AccessibleAWTComponent + + protected abstract class AccessibleUNOComponent extends java.awt.Component.AccessibleAWTComponent implements javax.accessibility.AccessibleExtendedComponent { - + protected java.awt.event.ComponentListener accessibleComponentHandler = null; - + /** * Fire PropertyChange listener, if one is registered, * when shown/hidden.. @@ -408,22 +408,22 @@ public abstract class Component extends java.awt.Component { AccessibleContext.ACCESSIBLE_STATE_PROPERTY, AccessibleState.VISIBLE, null); } - + public void componentShown(java.awt.event.ComponentEvent e) { AccessibleUNOComponent.this.firePropertyChange( AccessibleContext.ACCESSIBLE_STATE_PROPERTY, null, AccessibleState.VISIBLE); } - + public void componentMoved(java.awt.event.ComponentEvent e) { } - + public void componentResized(java.awt.event.ComponentEvent e) { } } // inner class AccessibleComponentHandler - + protected java.awt.event.FocusListener accessibleFocusHandler = null; - + /** * Fire PropertyChange listener, if one is registered, * when focus events happen @@ -446,9 +446,9 @@ public abstract class Component extends java.awt.Component { } } } // inner class AccessibleFocusHandler - + protected int propertyChangeListenerCount = 0; - + /** * Add a PropertyChangeListener to the listener list. * @@ -458,13 +458,13 @@ public abstract class Component extends java.awt.Component { if (propertyChangeListenerCount++ == 0) { accessibleComponentHandler = new AccessibleComponentHandler(); Component.this.addComponentListener(accessibleComponentHandler); - + accessibleFocusHandler = new AccessibleFocusHandler(); Component.this.addFocusListener(accessibleFocusHandler); } super.addPropertyChangeListener(listener); } - + /** * Remove a PropertyChangeListener from the listener list. * This removes a PropertyChangeListener that was registered @@ -476,7 +476,7 @@ public abstract class Component extends java.awt.Component { if (--propertyChangeListenerCount == 0) { Component.this.removeComponentListener(accessibleComponentHandler); accessibleComponentHandler = null; - + Component.this.removeFocusListener(accessibleFocusHandler); accessibleFocusHandler = null; } @@ -501,7 +501,7 @@ public abstract class Component extends java.awt.Component { return AccessibleStateAdapter.getDefunctStateSet(); } } - + /** Gets the locale of the component */ public java.util.Locale getLocale() throws java.awt.IllegalComponentStateException { try { @@ -513,11 +513,11 @@ public abstract class Component extends java.awt.Component { return java.util.Locale.getDefault(); } } - + /* * AccessibleExtendedComponent */ - + /** Returns the background color of the object */ public java.awt.Color getBackground() { try { @@ -526,11 +526,11 @@ public abstract class Component extends java.awt.Component { return null; } } - + public void setBackground(java.awt.Color c) { // Not supported by UNO accessibility API } - + /** Returns the foreground color of the object */ public java.awt.Color getForeground() { try { @@ -539,62 +539,62 @@ public abstract class Component extends java.awt.Component { return null; } } - + public void setForeground(java.awt.Color c) { // Not supported by UNO accessibility API } - + public java.awt.Cursor getCursor() { // Not supported by UNO accessibility API return null; } - + public void setCursor(java.awt.Cursor cursor) { // Not supported by UNO accessibility API } - + public java.awt.Font getFont() { // FIXME return null; } - + public void setFont(java.awt.Font f) { // Not supported by UNO accessibility API } - + public java.awt.FontMetrics getFontMetrics(java.awt.Font f) { // FIXME return null; } - + public boolean isEnabled() { return Component.this.isEnabled(); } - + public void setEnabled(boolean b) { // Not supported by UNO accessibility API } - + public boolean isVisible() { return Component.this.isVisible(); } - + public void setVisible(boolean b) { // Not supported by UNO accessibility API } - + public boolean isShowing() { return Component.this.isShowing(); } - + public boolean contains(java.awt.Point p) { try { - return unoAccessibleComponent.containsPoint(new com.sun.star.awt.Point(p.x, p.y)); + return unoAccessibleComponent.containsPoint(new com.sun.star.awt.Point(p.x, p.y)); } catch (com.sun.star.uno.RuntimeException e) { return false; } } - + /** Returns the location of the object on the screen. */ public java.awt.Point getLocationOnScreen() { try { @@ -607,68 +607,68 @@ public abstract class Component extends java.awt.Component { return null; } } - + /** Gets the location of this component in the form of a point specifying the component's top-left corner */ public java.awt.Point getLocation() { try { - com.sun.star.awt.Point unoPoint = unoAccessibleComponent.getLocation(); + com.sun.star.awt.Point unoPoint = unoAccessibleComponent.getLocation(); return new java.awt.Point( unoPoint.X, unoPoint.Y ); } catch (com.sun.star.uno.RuntimeException e) { return null; } } - + /** Moves this component to a new location */ public void setLocation(java.awt.Point p) { // Not supported by UNO accessibility API } - + /** Gets the bounds of this component in the form of a Rectangle object */ public java.awt.Rectangle getBounds() { try { - com.sun.star.awt.Rectangle unoRect = unoAccessibleComponent.getBounds(); + com.sun.star.awt.Rectangle unoRect = unoAccessibleComponent.getBounds(); return new java.awt.Rectangle(unoRect.X, unoRect.Y, unoRect.Width, unoRect.Height); } catch (com.sun.star.uno.RuntimeException e) { return null; } } - + /** Moves and resizes this component to conform to the new bounding rectangle r */ public void setBounds(java.awt.Rectangle r) { // Not supported by UNO accessibility API } - + /** Returns the size of this component in the form of a Dimension object */ public java.awt.Dimension getSize() { try { - com.sun.star.awt.Size unoSize = unoAccessibleComponent.getSize(); + com.sun.star.awt.Size unoSize = unoAccessibleComponent.getSize(); return new java.awt.Dimension(unoSize.Width, unoSize.Height); } catch (com.sun.star.uno.RuntimeException e) { return null; } } - + /** Resizes this component so that it has width d.width and height d.height */ public void setSize(java.awt.Dimension d) { // Not supported by UNO accessibility API } - + public javax.accessibility.Accessible getAccessibleAt(java.awt.Point p) { // Not supported by this implementation return null; } - + public boolean isFocusTraversable() { return Component.this.isFocusable(); } - + public void requestFocus() { unoAccessibleComponent.grabFocus(); } - + public String getToolTipText() { try { - XAccessibleExtendedComponent unoAccessibleExtendedComponent = (XAccessibleExtendedComponent) + XAccessibleExtendedComponent unoAccessibleExtendedComponent = (XAccessibleExtendedComponent) UnoRuntime.queryInterface(XAccessibleExtendedComponent.class, unoAccessibleComponent); if (unoAccessibleExtendedComponent != null) { return unoAccessibleExtendedComponent.getToolTipText(); @@ -678,10 +678,10 @@ public abstract class Component extends java.awt.Component { } return null; } - + public String getTitledBorderText() { try { - XAccessibleExtendedComponent unoAccessibleExtendedComponent = (XAccessibleExtendedComponent) + XAccessibleExtendedComponent unoAccessibleExtendedComponent = (XAccessibleExtendedComponent) UnoRuntime.queryInterface(XAccessibleExtendedComponent.class, unoAccessibleComponent); if (unoAccessibleExtendedComponent != null) { return unoAccessibleExtendedComponent.getTitledBorderText(); @@ -691,10 +691,10 @@ public abstract class Component extends java.awt.Component { } return null; } - + public javax.accessibility.AccessibleKeyBinding getAccessibleKeyBinding() { try { - XAccessibleAction unoAccessibleAction = (XAccessibleAction) + XAccessibleAction unoAccessibleAction = (XAccessibleAction) UnoRuntime.queryInterface(XAccessibleAction.class, unoAccessibleComponent); if (unoAccessibleAction != null) { XAccessibleKeyBinding unoAccessibleKeyBinding = unoAccessibleAction.getAccessibleActionKeyBinding(0); @@ -710,7 +710,7 @@ public abstract class Component extends java.awt.Component { return null; } } - + // Extract a number from a UNO any public static java.lang.Number toNumber(java.lang.Object any) { try { @@ -732,7 +732,7 @@ public abstract class Component extends java.awt.Component { } return null; } - + public String toString() { return UnoRuntime.generateOid(unoAccessible); } |