diff options
Diffstat (limited to 'accessibility/bridge/org/openoffice/java/accessibility/Window.java')
-rw-r--r-- | accessibility/bridge/org/openoffice/java/accessibility/Window.java | 174 |
1 files changed, 87 insertions, 87 deletions
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Window.java b/accessibility/bridge/org/openoffice/java/accessibility/Window.java index ef44c3380a48..22a701963960 100644 --- a/accessibility/bridge/org/openoffice/java/accessibility/Window.java +++ b/accessibility/bridge/org/openoffice/java/accessibility/Window.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 @@ -32,17 +32,17 @@ import com.sun.star.accessibility.*; public class Window extends java.awt.Window implements javax.accessibility.Accessible, NativeFrame { protected XAccessibleComponent unoAccessibleComponent; - + boolean opened = false; boolean visible = false; - + java.awt.EventQueue eventQueue = null; - + public Window(java.awt.Window owner, XAccessibleComponent xAccessibleComponent) { super(owner); initialize(xAccessibleComponent); } - + private void initialize(XAccessibleComponent xAccessibleComponent) { unoAccessibleComponent = xAccessibleComponent; eventQueue = java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue(); @@ -53,27 +53,27 @@ public class Window extends java.awt.Window implements javax.accessibility.Acces broadcaster.addEventListener(new AccessibleWindowListener()); } } - + java.awt.Component initialComponent = null; - + public java.awt.Component getInitialComponent() { if (Build.DEBUG) { System.err.println("returning initial component object of class: " + initialComponent.getClass().getName()); } return initialComponent; } - + public void setInitialComponent(java.awt.Component c) { initialComponent = c; } - + public Integer getHWND() { return null; } - + /** - * 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 @@ -86,10 +86,10 @@ public class Window extends java.awt.Window implements javax.accessibility.Acces } 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 @@ -99,10 +99,10 @@ public class Window extends java.awt.Window implements javax.accessibility.Acces public void addNotify() { // createHierarchyEvents(0, null, null, 0, false); } - - /** + + /** * 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 @@ -111,7 +111,7 @@ public class Window extends java.awt.Window implements javax.accessibility.Acces */ public void removeNotify() { } - + /** * Determines if the object is visible. Note: this means that the * object intends to be visible; however, it may not in fact be @@ -124,7 +124,7 @@ public class Window extends java.awt.Window implements javax.accessibility.Acces public boolean isVisible(){ return visible; } - + /** * Shows or hides this component depending on the value of parameter * <code>b</code>. @@ -148,41 +148,41 @@ public class Window extends java.awt.Window implements javax.accessibility.Acces } } } - + public void dispose() { setVisible(false); postWindowEvent(java.awt.event.WindowEvent.WINDOW_CLOSED); - + // Transfer window focus back to the owner window if it is still the active frame if ((getOwner() instanceof Frame && ((Frame) getOwner()).active) || (getOwner() instanceof Dialog && ((Dialog) getOwner()).active)) { - eventQueue.postEvent(new java.awt.event.WindowEvent(getOwner(), + eventQueue.postEvent(new java.awt.event.WindowEvent(getOwner(), java.awt.event.WindowEvent.WINDOW_GAINED_FOCUS)); } } - + protected void postWindowEvent(int i) { eventQueue.postEvent(new java.awt.event.WindowEvent(this, i)); } - + protected void postComponentEvent(int i) { eventQueue.postEvent(new java.awt.event.ComponentEvent(this, i)); } - + /** * Update the proxy objects appropriatly on property change events */ protected class AccessibleWindowListener implements XAccessibleEventListener { - + protected AccessibleWindowListener() { } - + // The only expected state changes are ACTIVE and VISIBLE protected void setComponentState(short state, boolean enable) { switch (state) { case AccessibleStateType.ICONIFIED: - postWindowEvent(enable ? - java.awt.event.WindowEvent.WINDOW_ICONIFIED : + postWindowEvent(enable ? + java.awt.event.WindowEvent.WINDOW_ICONIFIED : java.awt.event.WindowEvent.WINDOW_DEICONIFIED); break; case AccessibleStateType.SHOWING: @@ -196,7 +196,7 @@ public class Window extends java.awt.Window implements javax.accessibility.Acces break; } } - + /** Updates the accessible name and fires the appropriate PropertyChangedEvent */ protected void handleNameChangedEvent(Object any) { try { @@ -210,7 +210,7 @@ public class Window extends java.awt.Window implements javax.accessibility.Acces } catch (com.sun.star.lang.IllegalArgumentException e) { } } - + /** Updates the accessible description and fires the appropriate PropertyChangedEvent */ protected void handleDescriptionChangedEvent(Object any) { try { @@ -223,21 +223,21 @@ public class Window extends java.awt.Window implements javax.accessibility.Acces } 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) { } } - + /** Fires a visible data property change event */ protected void handleVisibleDataEvent() { javax.accessibility.AccessibleContext ac = accessibleContext; @@ -245,7 +245,7 @@ public class Window extends java.awt.Window implements javax.accessibility.Acces ac.firePropertyChange(javax.accessibility.AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY, null, null); } } - + /** Called by OpenOffice process to notify property changes */ public void notifyEvent(AccessibleEventObject event) { switch (event.EventId) { @@ -281,14 +281,14 @@ public class Window extends java.awt.Window implements javax.accessibility.Acces } } } - + /** Called by OpenOffice process to notify that the UNO component is disposing */ public void disposing(com.sun.star.lang.EventObject eventObject) { } } - + protected javax.accessibility.AccessibleContext accessibleContext = null; - + /** Returns the AccessibleContext associated with this object */ public javax.accessibility.AccessibleContext getAccessibleContext() { if (accessibleContext == null) { @@ -297,14 +297,14 @@ public class Window extends java.awt.Window implements javax.accessibility.Acces } return accessibleContext; } - + protected class AccessibleWindow extends java.awt.Window.AccessibleAWTWindow { protected AccessibleWindow() { super(); } - + protected java.awt.event.ComponentListener accessibleComponentHandler = null; - + /** * Fire PropertyChange listener, if one is registered, * when shown/hidden.. @@ -315,33 +315,33 @@ public class Window extends java.awt.Window implements javax.accessibility.Acces javax.accessibility.AccessibleContext.ACCESSIBLE_STATE_PROPERTY, javax.accessibility.AccessibleState.VISIBLE, null); } - + public void componentShown(java.awt.event.ComponentEvent e) { AccessibleWindow.this.firePropertyChange( javax.accessibility.AccessibleContext.ACCESSIBLE_STATE_PROPERTY, null, javax.accessibility.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.ContainerListener accessibleContainerHandler = null; - + /** * Fire PropertyChange listener, if one is registered, * when children added/removed. */ - + protected class AccessibleContainerHandler implements java.awt.event.ContainerListener { public void componentAdded(java.awt.event.ContainerEvent e) { java.awt.Component c = e.getChild(); if (c != null && c instanceof javax.accessibility.Accessible) { AccessibleWindow.this.firePropertyChange( - javax.accessibility.AccessibleContext.ACCESSIBLE_CHILD_PROPERTY, + javax.accessibility.AccessibleContext.ACCESSIBLE_CHILD_PROPERTY, null, ((javax.accessibility.Accessible) c).getAccessibleContext()); } } @@ -349,14 +349,14 @@ public class Window extends java.awt.Window implements javax.accessibility.Acces java.awt.Component c = e.getChild(); if (c != null && c instanceof javax.accessibility.Accessible) { AccessibleWindow.this.firePropertyChange( - javax.accessibility.AccessibleContext.ACCESSIBLE_CHILD_PROPERTY, - ((javax.accessibility.Accessible) c).getAccessibleContext(), null); + javax.accessibility.AccessibleContext.ACCESSIBLE_CHILD_PROPERTY, + ((javax.accessibility.Accessible) c).getAccessibleContext(), null); } } } - + protected int propertyChangeListenerCount = 0; - + /** * Add a PropertyChangeListener to the listener list. * @@ -366,13 +366,13 @@ public class Window extends java.awt.Window implements javax.accessibility.Acces if (propertyChangeListenerCount++ == 0) { accessibleContainerHandler = new AccessibleContainerHandler(); Window.this.addContainerListener(accessibleContainerHandler); - + accessibleComponentHandler = new AccessibleComponentHandler(); Window.this.addComponentListener(accessibleComponentHandler); } super.addPropertyChangeListener(listener); } - + /** * Remove a PropertyChangeListener from the listener list. * This removes a PropertyChangeListener that was registered @@ -384,17 +384,17 @@ public class Window extends java.awt.Window implements javax.accessibility.Acces if (--propertyChangeListenerCount == 0) { Window.this.removeComponentListener(accessibleComponentHandler); accessibleComponentHandler = null; - + Window.this.removeContainerListener(accessibleContainerHandler); accessibleContainerHandler = null; } super.removePropertyChangeListener(listener); } - + /* * AccessibleComponent */ - + /** Returns the background color of the object */ public java.awt.Color getBackground() { try { @@ -403,11 +403,11 @@ public class Window extends java.awt.Window implements javax.accessibility.Acces 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 { @@ -416,118 +416,118 @@ public class Window extends java.awt.Window implements javax.accessibility.Acces 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 Window.this.isEnabled(); } - + public void setEnabled(boolean b) { // Not supported by UNO accessibility API } - + public boolean isVisible() { return Window.this.isVisible(); } - + public void setVisible(boolean b) { // Not supported by UNO accessibility API } - + public boolean isShowing() { return Window.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 { - com.sun.star.awt.Point unoPoint = unoAccessibleComponent.getLocationOnScreen(); + com.sun.star.awt.Point unoPoint = unoAccessibleComponent.getLocationOnScreen(); return new java.awt.Point(unoPoint.X, unoPoint.Y); } catch (com.sun.star.uno.RuntimeException e) { 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.getLocationOnScreen(); + com.sun.star.awt.Point unoPoint = unoAccessibleComponent.getLocationOnScreen(); 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 } - - /** Returns the Accessible child, if one exists, contained at the local coordinate Point */ + + /** Returns the Accessible child, if one exists, contained at the local coordinate Point */ public javax.accessibility.Accessible getAccessibleAt(java.awt.Point p) { try { java.awt.Component c = AccessibleObjectFactory.getAccessibleComponent( @@ -538,11 +538,11 @@ public class Window extends java.awt.Window implements javax.accessibility.Acces return null; } } - + public boolean isFocusTraversable() { return Window.this.isFocusable(); } - + public void requestFocus() { unoAccessibleComponent.grabFocus(); } |