diff options
Diffstat (limited to 'accessibility/workben/org/openoffice/accessibility/awb/canvas')
4 files changed, 51 insertions, 51 deletions
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/canvas/Canvas.java b/accessibility/workben/org/openoffice/accessibility/awb/canvas/Canvas.java index 86b642e8091c..78855b5a3d48 100644 --- a/accessibility/workben/org/openoffice/accessibility/awb/canvas/Canvas.java +++ b/accessibility/workben/org/openoffice/accessibility/awb/canvas/Canvas.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 @@ -56,7 +56,7 @@ import org.openoffice.accessibility.misc.Options; <p>The canvas listens to selection events of the associated JTree and highlights the first selected node of that tree.</p> */ -public class Canvas +public class Canvas extends JPanel { // This constant can be passed to SetZoomMode to always show the whole screen. @@ -77,7 +77,7 @@ public class Canvas /** Tell the canvas which tree to use to highlight accessible - objects and to observe for changes in the tree structure. + objects and to observe for changes in the tree structure. */ public void SetTree (javax.swing.JTree aTree) { @@ -116,10 +116,10 @@ public class Canvas Graphics2D g2 = (Graphics2D)g; if (Options.GetBoolean("Antialiasing")) - g2.setRenderingHint (RenderingHints.KEY_ANTIALIASING, + g2.setRenderingHint (RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); else - g2.setRenderingHint (RenderingHints.KEY_ANTIALIASING, + g2.setRenderingHint (RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); setupTransformation (); @@ -139,7 +139,7 @@ public class Canvas g2.fill (aScreen); g2.setColor (Color.BLACK); g2.draw (aScreen); - + synchronized (maShapeList) { Iterator aShapeIterator = maShapeList.GetIterator(); @@ -148,7 +148,7 @@ public class Canvas boolean bShowText = Options.GetBoolean ("ShowText"); while (aShapeIterator.hasNext()) { - CanvasShape aCanvasShape = + CanvasShape aCanvasShape = (CanvasShape)aShapeIterator.next(); try { @@ -158,13 +158,13 @@ public class Canvas } catch (Exception aException) { - System.err.println ("caught exception while painting a shape:" + System.err.println ("caught exception while painting a shape:" + aException); aException.printStackTrace (System.err); } } } - + // Paint highlighted frame around active object as the last thing. if (maActiveObject != null) maActiveObject.paint_highlight (g2); @@ -216,11 +216,11 @@ public class Canvas // Calculate the scales that would map the screen onto the // widget in both of the coordinate axes and select the // smaller - // of the two: it maps the screen onto the widget in both + // of the two: it maps the screen onto the widget in both // axes at the same time. - double nHScale = (aWidgetSize.getWidth() - 10) + double nHScale = (aWidgetSize.getWidth() - 10) / aScreenSize.getWidth(); - double nVScale = (aWidgetSize.getHeight() - 10) + double nVScale = (aWidgetSize.getHeight() - 10) / aScreenSize.getHeight(); if (nHScale < nVScale) mnScale = nHScale; @@ -234,15 +234,15 @@ public class Canvas // Calculate offsets that center the scaled screen inside // the widget. - mnHOffset = (aWidgetSize.getWidth() + mnHOffset = (aWidgetSize.getWidth() - mnScale*aScreenSize.getWidth()) / 2.0; - mnVOffset = (aWidgetSize.getHeight() + mnVOffset = (aWidgetSize.getHeight() - mnScale*aScreenSize.getHeight()) / 2.0; if (mnHOffset < 0) mnHOffset = 0; if (mnVOffset < 0) mnVOffset = 0; - + setPreferredSize (new Dimension ( (int)(2*mnHOffset + mnScale * aScreenSize.getWidth()), (int)(2*mnVOffset + mnScale * aScreenSize.getHeight()))); @@ -259,8 +259,8 @@ public class Canvas } maLastWidgetSize = aWidgetSize; } - - + + protected boolean HighlightObject (CanvasShape aNewActiveObject) { @@ -268,7 +268,7 @@ public class Canvas { if (maActiveObject != null) maActiveObject.Highlight (false); - + maActiveObject = aNewActiveObject; if (maActiveObject != null) { @@ -292,7 +292,7 @@ public class Canvas - + /** Called when the selection of the tree changes. Highlight the corresponding graphical representation of the object. */ @@ -305,7 +305,7 @@ public class Canvas - private int + private int mnXAnchor, mnYAnchor, maResizeFlag; diff --git a/accessibility/workben/org/openoffice/accessibility/awb/canvas/CanvasShape.java b/accessibility/workben/org/openoffice/accessibility/awb/canvas/CanvasShape.java index f2595351a4f5..14059046625c 100644 --- a/accessibility/workben/org/openoffice/accessibility/awb/canvas/CanvasShape.java +++ b/accessibility/workben/org/openoffice/accessibility/awb/canvas/CanvasShape.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 @@ -48,7 +48,7 @@ class CanvasShape implements XAccessibleEventListener public final Color maHighlightColor = Color.red; public final Color maSelectionColor = Color.green; public final Color maFocusColor = Color.blue; - + public CanvasShape (javax.swing.tree.TreeNode aNode, Canvas aCanvas) { maNode = aNode; @@ -74,7 +74,7 @@ class CanvasShape implements XAccessibleEventListener public javax.swing.tree.TreePath getNodePath (javax.swing.tree.TreeNode node) { javax.swing.tree.TreeNode parent = node.getParent(); - return (parent != null) ? + return (parent != null) ? getNodePath(parent).pathByAddingChild(node) : new javax.swing.tree.TreePath(node); } @@ -86,7 +86,7 @@ class CanvasShape implements XAccessibleEventListener - /** Update the data obtained from the <type>AccessibilityNode</type> + /** Update the data obtained from the <type>AccessibilityNode</type> object. */ public void Update () @@ -111,7 +111,7 @@ class CanvasShape implements XAccessibleEventListener mbFocused = xStateSet.contains (AccessibleStateType.FOCUSED); } } - + UpdateGeometry (); if (mxComponent != null) @@ -137,7 +137,7 @@ class CanvasShape implements XAccessibleEventListener { if (mxComponent != null) { - com.sun.star.awt.Point aLocationOnScreen = + com.sun.star.awt.Point aLocationOnScreen = mxComponent.getLocationOnScreen(); com.sun.star.awt.Size aSizeOnScreen = mxComponent.getSize(); maPosition = new Point ( @@ -155,9 +155,9 @@ class CanvasShape implements XAccessibleEventListener according to the specified offset and scale. */ public void paint ( - Graphics2D g, - boolean bShowDescription, - boolean bShowName, + Graphics2D g, + boolean bShowDescription, + boolean bShowName, boolean bShowText) { try{ @@ -185,7 +185,7 @@ class CanvasShape implements XAccessibleEventListener color = new Color (maFgColor.getRed(), maFgColor.getGreen(), maFgColor.getBlue()); g.setColor (color); g.draw (maShape); - + if (mbFocused) { g.setColor (maFocusColor); @@ -240,18 +240,18 @@ class CanvasShape implements XAccessibleEventListener private void paintName (Graphics2D g) { - g.drawString ("Name: " + msName, - (float)maShape.x+5, - (float)maShape.y+15); + g.drawString ("Name: " + msName, + (float)maShape.x+5, + (float)maShape.y+15); } private void paintDescription (Graphics2D g) { - g.drawString ("Description: " + msDescription, - (float)maShape.x+5, - (float)maShape.y+35); + g.drawString ("Description: " + msDescription, + (float)maShape.x+5, + (float)maShape.y+35); } @@ -274,10 +274,10 @@ class CanvasShape implements XAccessibleEventListener { com.sun.star.awt.Rectangle aRect = xText.getCharacterBounds(i); - + double x = maShape.x + aRect.X; double y = maShape.y + aRect.Y + aRect.Height; - + g.drawString (sText.substring(i, i+1), (float)x, (float)y); } } @@ -319,7 +319,7 @@ class CanvasShape implements XAccessibleEventListener { return new Rectangle (maPosition, maSize); } - + public Point getOrigin () { return maPosition; @@ -364,12 +364,12 @@ class CanvasShape implements XAccessibleEventListener break; } } catch (Exception aException) { - System.err.println ("caught exception while updating a shape:" + System.err.println ("caught exception while updating a shape:" + aException); aException.printStackTrace (System.err); } } - + /** Callback for disposing events. */ public void disposing (com.sun.star.lang.EventObject e) @@ -379,8 +379,8 @@ class CanvasShape implements XAccessibleEventListener - - private Canvas + + private Canvas maCanvas; private javax.swing.tree.TreeNode maNode; diff --git a/accessibility/workben/org/openoffice/accessibility/awb/canvas/MouseObserver.java b/accessibility/workben/org/openoffice/accessibility/awb/canvas/MouseObserver.java index 3e7e2807906d..c2468ec38005 100644 --- a/accessibility/workben/org/openoffice/accessibility/awb/canvas/MouseObserver.java +++ b/accessibility/workben/org/openoffice/accessibility/awb/canvas/MouseObserver.java @@ -12,7 +12,7 @@ import javax.swing.tree.TreePath; /** Observe the mouse and highlight shapes of the canvas when clicked. */ public class MouseObserver - implements MouseListener, + implements MouseListener, MouseMotionListener { public MouseObserver (Canvas aCanvas) @@ -66,7 +66,7 @@ public class MouseObserver } - /** Search for the smallest shape that contains the mouse position. + /** Search for the smallest shape that contains the mouse position. */ protected CanvasShape FindCanvasShapeUnderMouse (MouseEvent e) { diff --git a/accessibility/workben/org/openoffice/accessibility/awb/canvas/ShapeContainer.java b/accessibility/workben/org/openoffice/accessibility/awb/canvas/ShapeContainer.java index 03ad4bf38c46..86e92cafed06 100644 --- a/accessibility/workben/org/openoffice/accessibility/awb/canvas/ShapeContainer.java +++ b/accessibility/workben/org/openoffice/accessibility/awb/canvas/ShapeContainer.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 @@ -87,18 +87,18 @@ public class ShapeContainer if (aShape == null) { aShape = new CanvasShape (aNode, maCanvas); - + if (aNode instanceof XAccessibleEventBroadcaster) ((XAccessibleEventBroadcaster) aNode).addEventListener(aShape); - + // Update bounding box that includes all objects. if (maShapeList.size() == 0) maBoundingBox = aShape.GetBBox(); else maBoundingBox = maBoundingBox.union (aShape.GetBBox()); - + maShapeList.put (aNode, aShape); - + maCanvas.repaint(); return true; @@ -117,7 +117,7 @@ public class ShapeContainer { if (aNode instanceof XAccessibleEventBroadcaster) ((XAccessibleEventBroadcaster) aNode).removeEventListener(aShape); - + maShapeList.remove (aNode); maCanvas.SelectObject (null); maCanvas.repaint (); |