summaryrefslogtreecommitdiff
path: root/toolkit/test
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/test')
-rw-r--r--toolkit/test/accessibility/AccTreeNode.java37
-rw-r--r--toolkit/test/accessibility/AccessibilityTree.java5
-rw-r--r--toolkit/test/accessibility/AccessibilityTreeModel.java21
-rw-r--r--toolkit/test/accessibility/AccessibleCellHandler.java6
-rw-r--r--toolkit/test/accessibility/AccessibleContextHandler.java2
-rw-r--r--toolkit/test/accessibility/AccessibleEditableTextHandler.java6
-rw-r--r--toolkit/test/accessibility/AccessibleHyperlinkHandler.java8
-rw-r--r--toolkit/test/accessibility/AccessibleHypertextHandler.java8
-rw-r--r--toolkit/test/accessibility/AccessibleTableHandler.java6
-rw-r--r--toolkit/test/accessibility/AccessibleTreeCellRenderer.java108
-rw-r--r--toolkit/test/accessibility/AccessibleTreeNode.java5
-rw-r--r--toolkit/test/accessibility/CanvasShape.java28
-rw-r--r--toolkit/test/accessibility/EventLogger.java47
-rw-r--r--toolkit/test/accessibility/FrameActionListener.java32
-rw-r--r--toolkit/test/accessibility/HelpWindow.java14
-rw-r--r--toolkit/test/accessibility/InformationWriter.java406
-rw-r--r--toolkit/test/accessibility/MessageArea.java11
-rw-r--r--toolkit/test/accessibility/NodeHandler.java10
-rw-r--r--toolkit/test/accessibility/NodeMap.java13
-rw-r--r--toolkit/test/accessibility/OfficeConnection.java8
-rw-r--r--toolkit/test/accessibility/Options.java10
-rw-r--r--toolkit/test/accessibility/SimpleOffice.java251
-rw-r--r--toolkit/test/accessibility/TextLogger.java59
-rw-r--r--toolkit/test/accessibility/TextUpdateListener.java144
-rw-r--r--toolkit/test/accessibility/ov/SelectionView.java244
25 files changed, 1 insertions, 1488 deletions
diff --git a/toolkit/test/accessibility/AccTreeNode.java b/toolkit/test/accessibility/AccTreeNode.java
index f728d8536869..aae3ed5758d4 100644
--- a/toolkit/test/accessibility/AccTreeNode.java
+++ b/toolkit/test/accessibility/AccTreeNode.java
@@ -23,7 +23,6 @@ import com.sun.star.accessibility.XAccessible;
import com.sun.star.accessibility.XAccessibleComponent;
import com.sun.star.accessibility.XAccessibleContext;
import com.sun.star.accessibility.XAccessibleEditableText;
-import com.sun.star.accessibility.XAccessibleExtendedComponent;
import com.sun.star.accessibility.XAccessibleSelection;
import com.sun.star.accessibility.XAccessibleTable;
import com.sun.star.accessibility.XAccessibleText;
@@ -52,24 +51,17 @@ class AccTreeNode
private ArrayList<HandlerDescriptor> maHandlers;
// The accessible context of this node.
- private XAccessible mxAccessible;
private XAccessibleContext mxContext;
private XAccessibleComponent mxComponent;
private XAccessibleText mxText;
private XAccessibleTable mxTable;
- public AccTreeNode (XAccessible xAccessible, XAccessibleContext xContext, AccessibleTreeNode aParent)
- {
- this (xAccessible, xContext, xContext, aParent);
- }
-
public AccTreeNode (XAccessible xAccessible, XAccessibleContext xContext, Object aDisplay, AccessibleTreeNode aParent)
{
super (aDisplay, aParent);
maHandlers = new ArrayList<HandlerDescriptor>(5);
mxContext = xContext;
- mxAccessible = xAccessible;
}
/** Update the internal data extracted from the corresponding accessible
@@ -102,17 +94,6 @@ class AccTreeNode
return mxComponent;
}
- public XAccessibleExtendedComponent getExtendedComponent ()
- {
- if (mxComponent == null)
- getComponent();
- if (mxComponent != null)
- return UnoRuntime.queryInterface(
- XAccessibleExtendedComponent.class, mxComponent);
- else
- return null;
- }
-
public XAccessibleText getText ()
{
if (mxText == null && mxContext != null)
@@ -136,14 +117,6 @@ class AccTreeNode
}
- public XAccessible getAccessible()
- {
- if ((mxAccessible == null) && (mxContext != null))
- mxAccessible = UnoRuntime.queryInterface(
- XAccessible.class, mxContext);
- return mxAccessible;
- }
-
public XAccessibleSelection getSelection ()
{
return UnoRuntime.queryInterface(
@@ -348,16 +321,6 @@ class AccTreeNode
return null;
}
- /** Update the specified handlers.
- @return
- The returned array contains the indices of the updated children
- and can be used to create a TreeModelEvent.
- */
- public java.util.List<Integer> updateChildren (java.lang.Class class1)
- {
- return updateChildren (class1, null);
- }
-
public java.util.List<Integer> updateChildren (java.lang.Class class1, java.lang.Class<AccessibleExtendedComponentHandler> class2)
{
ArrayList<Integer> aChildIndices = new ArrayList<Integer>();
diff --git a/toolkit/test/accessibility/AccessibilityTree.java b/toolkit/test/accessibility/AccessibilityTree.java
index 867fdbfa5ca0..d750bf75c811 100644
--- a/toolkit/test/accessibility/AccessibilityTree.java
+++ b/toolkit/test/accessibility/AccessibilityTree.java
@@ -204,11 +204,6 @@ public class AccessibilityTree
- public void disposing (com.sun.star.lang.EventObject e)
- {
- System.out.println ("disposing " + e);
- }
-
/*
public Dimension getPreferredSize ()
{
diff --git a/toolkit/test/accessibility/AccessibilityTreeModel.java b/toolkit/test/accessibility/AccessibilityTreeModel.java
index 4bf258ce7f55..bc6abf8457eb 100644
--- a/toolkit/test/accessibility/AccessibilityTreeModel.java
+++ b/toolkit/test/accessibility/AccessibilityTreeModel.java
@@ -71,21 +71,6 @@ public class AccessibilityTreeModel
}
-
-
- /** Inform all listeners (especially the renderer) of a change of the
- tree's structure.
- @param aNode This node specifies the sub tree in which all changes
- take place.
- */
- public void FireTreeStructureChanged (AccessibleTreeNode aNode)
- {
- }
-
-
-
-
-
@Override
public synchronized void setRoot (AccessibleTreeNode aRoot)
{
@@ -339,12 +324,6 @@ public class AccessibilityTreeModel
}
}
- protected TreeModelEvent createEvent (XAccessibleContext xParent)
- {
- AccessibleTreeNode aParentNode = maNodeMap.GetNode (xParent);
- return new TreeModelEvent (this, createPath (aParentNode));
- }
-
/** Create a TreeModelEvent object that informs listeners that one child
has been removed from or inserted into its parent.
*/
diff --git a/toolkit/test/accessibility/AccessibleCellHandler.java b/toolkit/test/accessibility/AccessibleCellHandler.java
index c52532d8555c..c251f679064c 100644
--- a/toolkit/test/accessibility/AccessibleCellHandler.java
+++ b/toolkit/test/accessibility/AccessibleCellHandler.java
@@ -53,12 +53,6 @@ class AccessibleCellHandler extends NodeHandler
maChildList.setSize (8);
}
- protected static XAccessibleTable getTable(Object aObject)
- {
- return UnoRuntime.queryInterface (
- XAccessibleTable.class, aObject);
- }
-
@Override
public AccessibleTreeNode createChild (AccessibleTreeNode aParent, int nIndex)
{
diff --git a/toolkit/test/accessibility/AccessibleContextHandler.java b/toolkit/test/accessibility/AccessibleContextHandler.java
index 9483c5c79b9a..3b3d351086c7 100644
--- a/toolkit/test/accessibility/AccessibleContextHandler.java
+++ b/toolkit/test/accessibility/AccessibleContextHandler.java
@@ -24,8 +24,6 @@ import tools.NameProvider;
class AccessibleContextHandler
extends NodeHandler
{
- protected int nChildrenCount;
-
@Override
public NodeHandler createHandler (XAccessibleContext xContext)
{
diff --git a/toolkit/test/accessibility/AccessibleEditableTextHandler.java b/toolkit/test/accessibility/AccessibleEditableTextHandler.java
index a31073b22af5..ae5df14618ec 100644
--- a/toolkit/test/accessibility/AccessibleEditableTextHandler.java
+++ b/toolkit/test/accessibility/AccessibleEditableTextHandler.java
@@ -45,12 +45,6 @@ class AccessibleEditableTextHandler extends NodeHandler
maChildList.setSize (1);
}
- protected static XAccessibleEditableText getEText (AccTreeNode aNode)
- {
- return UnoRuntime.queryInterface (
- XAccessibleEditableText.class, aNode.getContext());
- }
-
@Override
public AccessibleTreeNode createChild (AccessibleTreeNode aParent, int nIndex)
{
diff --git a/toolkit/test/accessibility/AccessibleHyperlinkHandler.java b/toolkit/test/accessibility/AccessibleHyperlinkHandler.java
index 9af7390e9749..41a161ac5a74 100644
--- a/toolkit/test/accessibility/AccessibleHyperlinkHandler.java
+++ b/toolkit/test/accessibility/AccessibleHyperlinkHandler.java
@@ -45,14 +45,6 @@ class AccessibleHyperlinkHandler extends AccessibleTreeHandler
maChildList.setSize (1);
}
- protected XAccessibleHyperlink getHyperlink(Object aObject)
- {
- XAccessibleHyperlink xHyperlink =
- UnoRuntime.queryInterface (
- XAccessibleHyperlink.class, aObject);
- return xHyperlink;
- }
-
@Override
public AccessibleTreeNode getChild (AccessibleTreeNode aParent, int nIndex)
{
diff --git a/toolkit/test/accessibility/AccessibleHypertextHandler.java b/toolkit/test/accessibility/AccessibleHypertextHandler.java
index 7021c2abc77e..603d68997d87 100644
--- a/toolkit/test/accessibility/AccessibleHypertextHandler.java
+++ b/toolkit/test/accessibility/AccessibleHypertextHandler.java
@@ -45,14 +45,6 @@ class AccessibleHypertextHandler extends AccessibleTreeHandler
maChildList.setSize (1);
}
- protected static XAccessibleHypertext getHypertext (AccTreeNode aNode)
- {
- XAccessibleHypertext xHypertext =
- UnoRuntime.queryInterface (
- XAccessibleHypertext.class, aNode.getContext());
- return xHypertext;
- }
-
@Override
public AccessibleTreeNode getChild (AccessibleTreeNode aParent, int nIndex)
{
diff --git a/toolkit/test/accessibility/AccessibleTableHandler.java b/toolkit/test/accessibility/AccessibleTableHandler.java
index 8697a52a0232..a72fe61a3587 100644
--- a/toolkit/test/accessibility/AccessibleTableHandler.java
+++ b/toolkit/test/accessibility/AccessibleTableHandler.java
@@ -45,12 +45,6 @@ class AccessibleTableHandler extends NodeHandler
maChildList.setSize (4);
}
- protected static XAccessibleTable getTable(Object aObject)
- {
- return UnoRuntime.queryInterface (
- XAccessibleTable.class, aObject);
- }
-
@Override
public AccessibleTreeNode createChild (AccessibleTreeNode aParent, int nIndex)
{
diff --git a/toolkit/test/accessibility/AccessibleTreeCellRenderer.java b/toolkit/test/accessibility/AccessibleTreeCellRenderer.java
deleted file mode 100644
index 3a1f7150b5e6..000000000000
--- a/toolkit/test/accessibility/AccessibleTreeCellRenderer.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-import java.awt.Color;
-import java.awt.Component;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.swing.JTree;
-import javax.swing.tree.DefaultTreeCellRenderer;
-import javax.swing.tree.TreePath;
-
-
-public class AccessibleTreeCellRenderer
- extends DefaultTreeCellRenderer
-{
- private Color
- maDefaultColor,
- maChangedColor;
- private ArrayList<Boolean>
- maChangedLines;
-
-
-
- public AccessibleTreeCellRenderer ()
- {
- maDefaultColor = Color.black;
- maChangedColor = Color.red;
- maChangedLines = new ArrayList<Boolean> ();
- }
-
- @Override
- public Component getTreeCellRendererComponent (
- JTree tree,
- Object value,
- boolean sel,
- boolean expanded,
- boolean leaf,
- int row,
- boolean hasFocus)
- {
- super.getTreeCellRendererComponent(
- tree, value, sel,
- expanded, leaf, row,
- hasFocus);
-
- if (maChangedLines.size()<=row || maChangedLines.get (row) == null)
- setTextNonSelectionColor (maDefaultColor);
- else
- setTextNonSelectionColor (maChangedColor);
-
- return this;
- }
-
- /** Tell the cell renderer that no changes shall be displayed anymore.
- */
- public void clearAllChanges ()
- {
- maChangedLines.clear();
- }
-
- /** Inform the cell renderer of a new changed line which to paint
- highlighted when asked to paint it the next time.
- */
- private void addChangedLine (int nRow)
- {
- while (maChangedLines.size() <= nRow) {
- maChangedLines.add(null);
- }
- nRow -= 1; // row index is one to large for some reason.
- maChangedLines.set (nRow, true);
- }
-
- /** Inform the cell renderer of a set of changed line which to paint
- highlighted when asked to paint them the next time.
- @param aChangedNodes
- The set of changed nodes. Each entry is a TreePath.
- @param aTree
- The JTree that is used to transform the given TreePath objects
- into rows.
- */
- public void addChangedNodes (List<TreePath> aChangedNodes, JTree aTree)
- {
- for (int i=0; i<aChangedNodes.size(); i++)
- {
- TreePath aPath = aChangedNodes.get (i);
- int nRow = aTree.getRowForPath (aPath);
- addChangedLine (nRow);
- }
- }
-
-}
-
diff --git a/toolkit/test/accessibility/AccessibleTreeNode.java b/toolkit/test/accessibility/AccessibleTreeNode.java
index 17b90b9dbcbd..951b86e8179c 100644
--- a/toolkit/test/accessibility/AccessibleTreeNode.java
+++ b/toolkit/test/accessibility/AccessibleTreeNode.java
@@ -47,11 +47,6 @@ class AccessibleTreeNode
return maParent;
}
- public Object getDisplayObject ()
- {
- return maDisplayObject;
- }
-
public int getChildCount ()
{
return 0;
diff --git a/toolkit/test/accessibility/CanvasShape.java b/toolkit/test/accessibility/CanvasShape.java
index aa1e47be4420..d16bc1406dd5 100644
--- a/toolkit/test/accessibility/CanvasShape.java
+++ b/toolkit/test/accessibility/CanvasShape.java
@@ -43,7 +43,6 @@ class CanvasShape
maSize = new Dimension (10,10);
maFgColor = java.awt.Color.black;
maBgColor = Color.blue;
- mnRole = -1;
mbHighlighted = false;
mbSelected = false;
mbFocused = false;
@@ -62,7 +61,6 @@ class CanvasShape
{
msName = mxContext.getAccessibleName();
msDescription = mxContext.getAccessibleDescription();
- mnRole = mxContext.getAccessibleRole();
// Extract the selected and focused flag.
XAccessibleStateSet xStateSet = mxContext.getAccessibleStateSet ();
@@ -257,41 +255,16 @@ class CanvasShape
mbHighlighted = false;
}
- public boolean isHighlighted ()
- {
- return mbHighlighted;
- }
-
public Rectangle getBBox ()
{
return new Rectangle (maPosition, maSize);
}
- public Point getOrigin ()
- {
- return maPosition;
- }
-
public TreePath getPath ()
{
return new TreePath (maNode.createPath());
}
- public int getRole ()
- {
- return mnRole;
- }
-
- public XAccessibleContext getContext ()
- {
- return mxContext;
- }
-
- public XAccessibleComponent getComponent ()
- {
- return mxComponent;
- }
-
@Override
public String toString ()
{
@@ -314,5 +287,4 @@ class CanvasShape
mbSelected,
// Set when the accessible object is focused.
mbFocused;
- private int mnRole;
}
diff --git a/toolkit/test/accessibility/EventLogger.java b/toolkit/test/accessibility/EventLogger.java
deleted file mode 100644
index b6be2264a2f2..000000000000
--- a/toolkit/test/accessibility/EventLogger.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-import javax.swing.JFrame;
-import javax.swing.JScrollPane;
-
-class EventLogger
-{
- public static synchronized EventLogger Instance ()
- {
- if (maInstance == null)
- maInstance = new EventLogger();
- return maInstance;
- }
-
- private EventLogger ()
- {
- try
- {
- JFrame aFrame = new JFrame ();
- TextLogger aLogger = new TextLogger ();
- aFrame.setContentPane (new JScrollPane (aLogger));
-
- aFrame.setSize (400,300);
- aFrame.setVisible (true);
- }
- catch (Exception e)
- {}
- }
-
- private static EventLogger maInstance = null;
-}
diff --git a/toolkit/test/accessibility/FrameActionListener.java b/toolkit/test/accessibility/FrameActionListener.java
deleted file mode 100644
index 55b734eabed3..000000000000
--- a/toolkit/test/accessibility/FrameActionListener.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-import com.sun.star.frame.XFrameActionListener;
-
-public class FrameActionListener
- implements XFrameActionListener
-{
- public void frameAction (com.sun.star.frame.FrameActionEvent aEvent)
- {
- System.out.println ("frame action");
- }
-
- public void disposing (com.sun.star.lang.EventObject aEvent)
- {
- }
-}
diff --git a/toolkit/test/accessibility/HelpWindow.java b/toolkit/test/accessibility/HelpWindow.java
index 171931eee6d8..00c93406766f 100644
--- a/toolkit/test/accessibility/HelpWindow.java
+++ b/toolkit/test/accessibility/HelpWindow.java
@@ -54,20 +54,6 @@ class HelpWindow
e.printStackTrace (System.err);
}
}
- public void loadURL (String sURL)
- {
- try
- {
- loadURL (new URL (sURL));
- }
- catch (MalformedURLException e)
- {
- e.printStackTrace (System.err);
- }
- }
-
-
-
private void loadURL (URL aURL)
{
diff --git a/toolkit/test/accessibility/InformationWriter.java b/toolkit/test/accessibility/InformationWriter.java
deleted file mode 100644
index 6642a8fb9981..000000000000
--- a/toolkit/test/accessibility/InformationWriter.java
+++ /dev/null
@@ -1,406 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-import com.sun.star.beans.Property;
-import com.sun.star.beans.XPropertySet;
-import com.sun.star.beans.XPropertySetInfo;
-
-import com.sun.star.container.XIndexAccess;
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.lang.XServiceInfo;
-import com.sun.star.lang.XServiceName;
-import com.sun.star.lang.XTypeProvider;
-
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.uno.XInterface;
-import com.sun.star.uno.Type;
-
-import com.sun.star.drawing.XDrawPage;
-import com.sun.star.drawing.XShape;
-import com.sun.star.drawing.XShapeDescriptor;
-
-import com.sun.star.accessibility.XAccessible;
-import com.sun.star.accessibility.XAccessibleContext;
-import com.sun.star.accessibility.XAccessibleComponent;
-import com.sun.star.accessibility.XAccessibleRelationSet;
-import com.sun.star.accessibility.XAccessibleStateSet;
-
-public class InformationWriter
-{
- public void drawPageTest (XInterface xPage)
- {
- try
- {
- printProperty (xPage, "BorderBottom ", "BorderBottom");
- printProperty (xPage, "BorderLeft ", "BorderLeft");
- printProperty (xPage, "BorderRight ", "BorderRight");
- printProperty (xPage, "BorderTop ", "BorderTop");
- printProperty (xPage, "Height ", "Height");
- printProperty (xPage, "Width ", "Width");
- printProperty (xPage, "Number ", "Number");
- }
- catch (Exception e)
- {
- System.out.println ("caught exception while testing draw page:" + e);
- }
- }
-
- private void printProperty (XInterface xObject, String prefix, String name)
- {
- try
- {
- XPropertySet xPropertySet = UnoRuntime.queryInterface(
- XPropertySet.class, xObject);
- MessageArea.println (prefix +
- xPropertySet.getPropertyValue (name));
- }
- catch (Exception e)
- {
- MessageArea.println ("caught exception while getting property "
- + name + " : " + e);
- }
- }
-
-
-
- public void showShapes (XDrawPage xPage)
- {
- try
- {
- XIndexAccess xShapeList = UnoRuntime.queryInterface(
- XIndexAccess.class, xPage);
-
- MessageArea.println ("There are " + xShapeList.getCount()
- + " shapes");
- for (int i=0; i<xShapeList.getCount(); i++)
- {
- XShape xShape = UnoRuntime.queryInterface(
- XShape.class, xShapeList.getByIndex (i));
-
- XShapeDescriptor xShapeDescriptor =
- UnoRuntime.queryInterface(
- XShapeDescriptor.class, xShape);
- String sName = xShapeDescriptor.getShapeType ();
- MessageArea.println (" shape " + i + " : " + sName);
-
- XPropertySet xPropertySet =
- UnoRuntime.queryInterface(
- XPropertySet.class, xShape);
- Integer nZOrder =
- (Integer) xPropertySet.getPropertyValue ("ZOrder");
- MessageArea.println (" zorder = " + nZOrder);
- }
- }
- catch (Exception e)
- {
- MessageArea.println ("caught exception in showShapes: " + e);
- }
- }
-
-
-
-
- /** @descr Print all available services of the given object to the
- standard output.
- */
- public void showServices (XInterface xObject)
- {
- try
- {
- MessageArea.println ("Services:");
- XMultiServiceFactory xMSF = UnoRuntime.queryInterface (
- XMultiServiceFactory.class,
- xObject
- );
- if (xMSF == null)
- MessageArea.println (" object does not support interface XMultiServiceFactory");
- else
- {
- String[] sServiceNames = xMSF.getAvailableServiceNames ();
- MessageArea.println (" object can create "
- + sServiceNames.length + " services");
- for (int i=0; i<sServiceNames.length; i++)
- MessageArea.println (" service " + i + " : " + sServiceNames[i]);
- }
- }
- catch (Exception e)
- {
- MessageArea.println ("caught exception in showServices : " + e);
- }
- }
-
- /** @descr Print the service and implementation name of the given
- object.
- */
- public void showInfo (XInterface xObject)
- {
- try
- {
- System.out.println ("Info:");
- // Use interface XServiceName to retrieve name of (main) service.
- XServiceName xSN = UnoRuntime.queryInterface (
- XServiceName.class, xObject);
- if (xSN == null)
- MessageArea.println (" interface XServiceName not supported");
- else
- {
- MessageArea.println (" Service name : " + xSN.getServiceName ());
- }
-
- // Use interface XServiceInfo to retrieve information about
- // supported services.
- XServiceInfo xSI = UnoRuntime.queryInterface (
- XServiceInfo.class, xObject);
- if (xSI == null)
- MessageArea.println (" interface XServiceInfo not supported");
- else
- {
- MessageArea.println (" Implementation name : "
- + xSI.getImplementationName ());
- }
- }
- catch (Exception e)
- {
- MessageArea.println ("caught exception in showInfo : " + e);
- }
- }
-
-
-
-
- /** @descr Print information about supported interfaces.
- */
- public void showInterfaces (XInterface xObject)
- {
- try
- {
- MessageArea.println ("Interfaces:");
- // Use interface XTypeProvider to retrieve a list of supported
- // interfaces.
- XTypeProvider xTP = UnoRuntime.queryInterface (
- XTypeProvider.class, xObject);
- if (xTP == null)
- MessageArea.println (" interface XTypeProvider not supported");
- else
- {
- Type[] aTypeList = xTP.getTypes ();
- MessageArea.println (" object supports " + aTypeList.length
- + " interfaces");
- for (int i=0; i<aTypeList.length; i++)
- MessageArea.println (" " + i + " : "
- + aTypeList[i].getTypeName());
- }
- }
- catch (Exception e)
- {
- MessageArea.println ("caught exception in showInterfaces : " + e);
- }
- }
-
-
- /** @descr Print information concerning the accessibility of the given
- object.
- */
- private boolean showAccessibility (XInterface xObject, int depth)
- {
- try
- {
- // Create indentation string.
- String sIndent = "";
- while (depth-- > 0) {
- sIndent += " ";
- }
-
- // Get XAccessibleContext object if given object does not
- // already support this interface.
- XAccessibleContext xContext
- = UnoRuntime.queryInterface (
- XAccessibleContext.class, xObject);
- if (xContext == null)
- {
- XAccessible xAccessible
- = UnoRuntime.queryInterface (
- XAccessible.class, xObject);
- if (xAccessible == null)
- {
- MessageArea.println (sIndent + "given object " + xObject
- + " is not accessible");
- return false;
- }
- else
- xContext = xAccessible.getAccessibleContext();
- }
-
- // Print information about the accessible context.
- if (xContext != null)
- {
- MessageArea.println (sIndent + "Name : "
- + xContext.getAccessibleName());
- MessageArea.println (sIndent + "Description : "
- + xContext.getAccessibleDescription());
- MessageArea.println (sIndent + "Role : "
- + xContext.getAccessibleRole());
- if (xContext.getAccessibleParent() != null)
- {
- MessageArea.println (sIndent + "Has parent : yes");
- MessageArea.println (sIndent + "Parent index : "
- + xContext.getAccessibleIndexInParent());
- }
- else
- MessageArea.println (sIndent + "Has parent : no");
- MessageArea.println (sIndent + "Child count : "
- + xContext.getAccessibleChildCount());
- MessageArea.print (sIndent + "Relation set : ");
- XAccessibleRelationSet xRelationSet
- = xContext.getAccessibleRelationSet();
- if (xRelationSet != null)
- {
- MessageArea.print (xRelationSet.getRelationCount() + " (");
- for (int i=0; i<xRelationSet.getRelationCount(); i++)
- {
- if (i > 0)
- MessageArea.print (", ");
- MessageArea.print (xRelationSet.getRelation(i).toString());
- }
- MessageArea.println (")");
- }
- else
- MessageArea.println ("no relation set");
-
- MessageArea.print (sIndent + "State set : ");
- XAccessibleStateSet xStateSet =
- xContext.getAccessibleStateSet();
- if (xStateSet != null)
- {
- XIndexAccess xStates =
- UnoRuntime.queryInterface (
- XIndexAccess.class, xStateSet);
- MessageArea.print (xStates.getCount() + " (");
- for (int i=0; i<xStates.getCount(); i++)
- {
- if (i > 0)
- MessageArea.print (", ");
- MessageArea.print (xStates.getByIndex(i).toString());
- }
- MessageArea.println (")");
- }
- else
- MessageArea.println ("no state set");
-
- showAccessibleComponent (xContext, sIndent);
- }
- else
- MessageArea.println ("object has no accessible context.");
-
- }
- catch (Exception e)
- {
- System.out.println ("caught exception in showAccessibility :" + e);
- }
- return true;
- }
-
-
-
-
- /** @descr Print information about the given accessible component.
- */
- private void showAccessibleComponent (XInterface xObject, String sIndent)
- {
- try
- {
- XAccessibleComponent xComponent =
- UnoRuntime.queryInterface (
- XAccessibleComponent.class, xObject);
-
- // Print information about the accessible context.
- if (xComponent != null)
- {
- MessageArea.println (sIndent + "Position : "
- + xComponent.getLocation().X+", "
- + xComponent.getLocation().Y);
- MessageArea.println (sIndent + "Screen position : "
- + xComponent.getLocationOnScreen().X+", "
- + xComponent.getLocationOnScreen().Y);
- MessageArea.println (sIndent + "Size : "
- + xComponent.getSize().Width+", "
- + xComponent.getSize().Height);
- }
- }
- catch (Exception e)
- {
- System.out.println (
- "caught exception in showAccessibleComponent : " + e);
- }
- }
-
-
- /** Show a textual representation of the accessibility subtree rooted in
- xRoot.
- */
- public boolean showAccessibilityTree (XAccessible xRoot, int depth)
- {
- try
- {
- if ( ! showAccessibility (xRoot, depth))
- return false;
-
- String sIndent = "";
- for (int i=0; i<depth; i++)
- sIndent += " ";
-
- // Iterate over children and show them.
- XAccessibleContext xContext = xRoot.getAccessibleContext();
- if (xContext != null)
- {
- int n = xContext.getAccessibleChildCount();
- for (int i=0; i<n; i++)
- {
- MessageArea.println (sIndent + "child " + i + " :");
- showAccessibilityTree (xContext.getAccessibleChild(i),depth+1);
- }
- }
- else
- MessageArea.println ("Accessible object has no context");
- }
- catch (Exception e)
- {
- System.out.println (
- "caught exception in showAccessibleTree : " + e);
- return false;
- }
-
- return true;
- }
-
- public void showProperties (XInterface xObject)
- {
- XPropertySet xSet = UnoRuntime.queryInterface (
- XPropertySet.class, xObject);
- if (xSet == null)
- MessageArea.println ("object does not support XPropertySet");
- else
- {
- XPropertySetInfo xInfo = xSet.getPropertySetInfo ();
- Property[] aProperties = xInfo.getProperties ();
- int n = aProperties.length;
- for (int i=0; i<n; i++)
- MessageArea.println (i + " : " + aProperties[i].Name +", " + aProperties[i].Type);
- }
- }
-}
diff --git a/toolkit/test/accessibility/MessageArea.java b/toolkit/test/accessibility/MessageArea.java
index 8ee0b98e6ccc..512cfaf73397 100644
--- a/toolkit/test/accessibility/MessageArea.java
+++ b/toolkit/test/accessibility/MessageArea.java
@@ -61,17 +61,6 @@ public class MessageArea
/** Show the given string at the end of the message area and scroll to make
- it visible.
- */
- public static synchronized void print (String aMessage)
- {
- print (0, aMessage);
- }
-
-
-
-
- /** Show the given string at the end of the message area and scroll to make
it visible. Indent the string as requested.
*/
private static synchronized void print (int nIndentation, String aMessage)
diff --git a/toolkit/test/accessibility/NodeHandler.java b/toolkit/test/accessibility/NodeHandler.java
index a172be7773b6..69cff2c13edf 100644
--- a/toolkit/test/accessibility/NodeHandler.java
+++ b/toolkit/test/accessibility/NodeHandler.java
@@ -37,16 +37,6 @@ abstract class NodeHandler
maChildList = new Vector<AccessibleTreeNode> ();
}
- /** Clear the cache of child objects.
- */
- public void clear ()
- {
- synchronized (maChildList)
- {
- maChildList.clear();
- }
- }
-
/** return the number of children this object has */
public int getChildCount()
{
diff --git a/toolkit/test/accessibility/NodeMap.java b/toolkit/test/accessibility/NodeMap.java
index aaf4baafff02..b8e8b3bf3300 100644
--- a/toolkit/test/accessibility/NodeMap.java
+++ b/toolkit/test/accessibility/NodeMap.java
@@ -106,19 +106,6 @@ class NodeMap
return null;
}
- XAccessibleContext GetAccessible (AccessibleTreeNode aNode)
- {
- if ((aNode != null) && (aNode instanceof AccTreeNode))
- return ((AccTreeNode)aNode).getContext();
- else
- return null;
- }
-
- boolean IsMember (XAccessibleContext xContext)
- {
- return maXAccessibleToNode.containsKey(xContext);
- }
-
boolean ValueIsMember (AccessibleTreeNode aNode)
{
return maXAccessibleToNode.containsValue(aNode);
diff --git a/toolkit/test/accessibility/OfficeConnection.java b/toolkit/test/accessibility/OfficeConnection.java
index eb43847f95db..4ecb98ba0b47 100644
--- a/toolkit/test/accessibility/OfficeConnection.java
+++ b/toolkit/test/accessibility/OfficeConnection.java
@@ -43,14 +43,6 @@ public class OfficeConnection
return maServiceManager;
}
- /** @descr Return a flag that indicates if the constructor has been able to
- establish a valid connection.
- */
- public boolean connectionIsValid ()
- {
- return getServiceManager() != null;
- }
-
/** @descr Connect to an already running LibreOffice application.
*/
private void connect ()
diff --git a/toolkit/test/accessibility/Options.java b/toolkit/test/accessibility/Options.java
index 3b9e5372c160..bbe7d608a7d3 100644
--- a/toolkit/test/accessibility/Options.java
+++ b/toolkit/test/accessibility/Options.java
@@ -34,16 +34,6 @@ class Options
return saOptions;
}
- static public void SetString (String sName, String sValue)
- {
- Instance().setProperty (sName, sValue);
- }
-
- static public String GetString (String sName)
- {
- return Instance().getProperty (sName);
- }
-
static public void SetBoolean (String sName, boolean bValue)
{
Instance().setProperty (sName, Boolean.toString(bValue));
diff --git a/toolkit/test/accessibility/SimpleOffice.java b/toolkit/test/accessibility/SimpleOffice.java
index e588e5b9e2fd..ecb16a6e3877 100644
--- a/toolkit/test/accessibility/SimpleOffice.java
+++ b/toolkit/test/accessibility/SimpleOffice.java
@@ -16,30 +16,11 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-import com.sun.star.awt.XWindow;
-
-import com.sun.star.beans.PropertyValue;
-import com.sun.star.container.XIndexAccess;
-import com.sun.star.container.XEnumerationAccess;
-import com.sun.star.container.XEnumeration;
-
-import com.sun.star.frame.XComponentLoader;
-import com.sun.star.frame.XController;
import com.sun.star.frame.XDesktop;
-import com.sun.star.frame.XFrame;
-import com.sun.star.frame.XModel;
-import com.sun.star.frame.XTasksSupplier;
-import com.sun.star.frame.XTask;
-
-import com.sun.star.lang.XComponent;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XInterface;
-import com.sun.star.drawing.XDrawView;
-import com.sun.star.drawing.XDrawPage;
-import com.sun.star.drawing.XShape;
import com.sun.star.accessibility.XAccessible;
-import com.sun.star.accessibility.XAccessibleContext;
import com.sun.star.awt.XExtendedToolkit;
@@ -66,80 +47,15 @@ public class SimpleOffice
getDesktop ();
}
- public XModel loadDocument (String URL)
- {
- XModel xModel = null;
- try
- {
- // Load the document from the specified URL.
- XComponentLoader xLoader =
- UnoRuntime.queryInterface(
- XComponentLoader.class, mxDesktop);
- XComponent xComponent = xLoader.loadComponentFromURL (
- URL,
- "_blank",
- 0,
- new PropertyValue[0]
- );
- xModel = UnoRuntime.queryInterface(
- XModel.class, xComponent);
- }
- catch (NullPointerException e)
- {
- MessageArea.println ("caught exception while loading "
- + URL + " : " + e);
- }
- catch (Exception e)
- {
- MessageArea.println ("caught exception while loading "
- + URL + " : " + e);
- }
- return xModel;
- }
- public XModel getModel (String name)
- {
- XModel xModel = null;
- try
- {
- XTasksSupplier xTasksSupplier =
- UnoRuntime.queryInterface(
- XTasksSupplier.class, mxDesktop);
- XEnumerationAccess xEA = xTasksSupplier.getTasks();
- XEnumeration xE = xEA.createEnumeration();
- while (xE.hasMoreElements())
- {
- XTask xTask = UnoRuntime.queryInterface(
- XTask.class, xE.nextElement());
- MessageArea.print (xTask.getName());
- }
- }
- catch (Exception e)
- {
- MessageArea.println ("caught exception while getting Model " + name
- + ": " + e);
- }
- return xModel;
- }
- public XModel getModel (XDrawView xView)
- {
- XController xController = UnoRuntime.queryInterface(
- XController.class, xView);
- if (xController != null)
- return xController.getModel();
- else
- {
- MessageArea.println ("can't cast view to controller");
- return null;
- }
- }
+
public XDesktop getDesktop ()
{
@@ -218,171 +134,6 @@ public class SimpleOffice
return xAccessible;
}
- /** Return the root object of the accessibility hierarchy.
- */
- public XAccessible getAccessibleRoot (XAccessible xAccessible)
- {
- try
- {
- XAccessible xParent = null;
- do
- {
- XAccessibleContext xContext = xAccessible.getAccessibleContext();
- if (xContext != null)
- xParent = xContext.getAccessibleParent();
- if (xParent != null)
- xAccessible = xParent;
- }
- while (xParent != null);
- }
- catch (Exception e)
- {
- MessageArea.println (
- "caught exception while getting accessible root" + e);
- e.printStackTrace();
- }
- return xAccessible;
- }
-
-
-
-
- /** @descr Return the current window associated with the given
- model.
- */
- public XWindow getCurrentWindow ()
- {
- return getCurrentWindow (UnoRuntime.queryInterface(
- XModel.class, getDesktop()));
- }
-
-
-
-
-
- private XWindow getCurrentWindow (XModel xModel)
- {
- XWindow xWindow = null;
- try
- {
- if (xModel == null)
- MessageArea.println ("invalid model (==null)");
- XController xController = xModel.getCurrentController();
- if (xController == null)
- MessageArea.println ("can't get controller from model");
- XFrame xFrame = xController.getFrame();
- if (xFrame == null)
- MessageArea.println ("can't get frame from controller");
- xWindow = xFrame.getComponentWindow ();
- if (xWindow == null)
- MessageArea.println ("can't get window from frame");
- }
- catch (Exception e)
- {
- MessageArea.println ("caught exception while getting current window" + e);
- }
-
- return xWindow;
- }
-
-
- /** @descr Return the current draw page of the given desktop.
- */
- public XDrawPage getCurrentDrawPage ()
- {
- return getCurrentDrawPage (UnoRuntime.queryInterface(
- XDrawView.class, getCurrentView()));
- }
-
-
-
-
- private XDrawPage getCurrentDrawPage (XDrawView xView)
- {
- XDrawPage xPage = null;
- try
- {
- if (xView == null)
- MessageArea.println ("can't get current draw page from null view");
- else
- xPage = xView.getCurrentPage();
- }
- catch (Exception e)
- {
- MessageArea.println ("caught exception while getting current draw page : " + e);
- }
-
- return xPage;
- }
-
-
- /** @descr Return the current view of the given desktop.
- */
- private XDrawView getCurrentView ()
- {
- return getCurrentView (getDesktop());
- }
-
- private XDrawView getCurrentView (XDesktop xDesktop)
- {
- if (xDesktop == null)
- MessageArea.println ("can't get desktop to retrieve current view");
-
- XDrawView xView = null;
- try
- {
- XComponent xComponent = xDesktop.getCurrentComponent();
- if (xComponent == null)
- MessageArea.println ("can't get component to retrieve current view");
-
- XFrame xFrame = xDesktop.getCurrentFrame();
- if (xFrame == null)
- MessageArea.println ("can't get frame to retrieve current view");
-
- XController xController = xFrame.getController();
- if (xController == null)
- MessageArea.println ("can't get controller to retrieve current view");
-
- xView = UnoRuntime.queryInterface(
- XDrawView.class, xController);
- if (xView == null)
- MessageArea.println ("could not cast controller into view");
- }
- catch (Exception e)
- {
- MessageArea.println ("caught exception while getting current view : " + e);
- }
-
- return xView;
- }
-
-
-
-
- // Return the accessible object of the document window.
- public static XAccessible getAccessibleDocumentWindow (XDrawPage xPage)
- {
- XIndexAccess xShapeList = UnoRuntime.queryInterface(
- XIndexAccess.class, xPage);
- if (xShapeList.getCount() > 0)
- {
- // All shapes return as accessible object the document window's
- // accessible object. This is, of course, a hack and will be
- // removed as soon as the missing infrastructure for obtaining
- // the object directly is implemented.
- XShape xShape = null;
- try{
- xShape = UnoRuntime.queryInterface(
- XShape.class, xShapeList.getByIndex (0));
- } catch (Exception e)
- {}
- XAccessible xAccessible = UnoRuntime.queryInterface (
- XAccessible.class, xShape);
- return xAccessible;
- }
- else
- return null;
- }
}
diff --git a/toolkit/test/accessibility/TextLogger.java b/toolkit/test/accessibility/TextLogger.java
deleted file mode 100644
index 952d14015973..000000000000
--- a/toolkit/test/accessibility/TextLogger.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-import javax.swing.JEditorPane;
-import javax.swing.event.HyperlinkListener;
-import javax.swing.event.HyperlinkEvent;
-
-class TextLogger
- extends JEditorPane
-{
- public TextLogger ()
- throws java.io.IOException
- {
- super ("http://localhost");
-
- setEditable (false);
- final JEditorPane finalPane = this;
- addHyperlinkListener (new HyperlinkListener()
- {
- public void hyperlinkUpdate (HyperlinkEvent e)
- {
- try
- {
- if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
- finalPane.setPage (e.getURL());
- }
- catch (java.io.IOException ex)
- {
- ex.printStackTrace(System.err);
- }
- }
- });
- }
-
- public void appendText (String sText)
- {
- try
- {
- getDocument().insertString (getDocument().getLength(), sText, null);
- }
- catch (javax.swing.text.BadLocationException e)
- {}
- }
-}
diff --git a/toolkit/test/accessibility/TextUpdateListener.java b/toolkit/test/accessibility/TextUpdateListener.java
deleted file mode 100644
index ef590f1a7106..000000000000
--- a/toolkit/test/accessibility/TextUpdateListener.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-import com.sun.star.accessibility.*;
-import com.sun.star.uno.UnoRuntime;
-
-import javax.swing.tree.*;
-import javax.swing.event.*;
-
-/** listen to tree model changes in order to update XAccessibleText objects
-*/
-class TextUpdateListener implements TreeModelListener
-{
- public void treeNodesChanged(TreeModelEvent e)
- {
- try {
- // if the change is to the first child of a DefaultMutableTreeNode
- // with an XAccessibleText child, then we call updateText
- int[] aIndices = e.getChildIndices();
- if (aIndices == null || aIndices.length >= 0) {
- return;
- }
- // we have a parent... lets check for XAccessibleText then
- DefaultMutableTreeNode aParent = (DefaultMutableTreeNode) (e
- .getTreePath().getLastPathComponent());
- DefaultMutableTreeNode aNode = (DefaultMutableTreeNode) (aParent
- .getChildAt(aIndices[0]));
- if (aParent.getUserObject() instanceof XAccessibleText) {
- // aha! we have an xText. So we can now check for
- // the various cases we support
- XAccessibleText xText = (XAccessibleText) aParent
- .getUserObject();
-
- if (aIndices[0] == 0) {
- // first child! Then we call updateText
- updateText(xText, aNode.toString());
- }
- }
- } catch (com.sun.star.lang.IndexOutOfBoundsException aException) {
- }
- }
-
- // don't care:
- public void treeNodesInserted(TreeModelEvent e) { }
- public void treeNodesRemoved(TreeModelEvent e) { }
- public void treeStructureChanged(TreeModelEvent e) { }
-
- /** update the text */
- boolean updateText( XAccessibleText xText, String sNew )
- throws com.sun.star.lang.IndexOutOfBoundsException
- {
- // is this text editable? if not, fudge you and return
- XAccessibleEditableText xEdit =
- UnoRuntime.queryInterface (
- XAccessibleEditableText.class, xText);
- if (xEdit == null)
- return false;
-
- String sOld = xText.getText();
-
- // false alarm? Early out if no change was done!
- if( sOld.equals( sNew ) )
- return false;
-
- // get the minimum length of both strings
- int nMinLength = sOld.length();
- if( sNew.length() < nMinLength )
- nMinLength = sNew.length();
-
- // count equal characters from front and end
- int nFront = 0;
- while( (nFront < nMinLength) &&
- (sNew.charAt(nFront) == sOld.charAt(nFront)) ) {
- nFront++;
- }
- int nBack = 0;
- while( (nBack < nMinLength) &&
- ( sNew.charAt(sNew.length()-nBack-1) ==
- sOld.charAt(sOld.length()-nBack-1) ) ) {
- nBack++;
- }
- if( nFront + nBack > nMinLength )
- nBack = nMinLength - nFront;
-
- // so... the first nFront and the last nBack characters
- // are the same. Change the others!
- String sDel = sOld.substring( nFront, sOld.length() - nBack );
- String sIns = sNew.substring( nFront, sNew.length() - nBack );
-
- System.out.println("edit text: " +
- sOld.substring(0, nFront) +
- " [ " + sDel + " -> " + sIns + " ] " +
- sOld.substring(sOld.length() - nBack) );
-
- boolean bRet = false;
- try
- {
- // edit the text, and use
- // (set|insert|delete|replace)Text as needed
- if( nFront+nBack == 0 )
- bRet = xEdit.setText( sIns );
- else if( sDel.length() == 0 )
- bRet = xEdit.insertText( sIns, nFront );
- else if( sIns.length() == 0 )
- bRet = xEdit.deleteText( nFront, sOld.length()-nBack );
- else
- bRet = xEdit.replaceText(nFront, sOld.length()-nBack,sIns);
- }
- catch( IndexOutOfBoundsException e )
- {
- bRet = false;
- }
-
- return bRet;
- }
-
- boolean setSelection( XAccessibleText xText, int p1, int p2 )
- {
- try
- {
- return xText.setSelection( p1, p2 );
- }
- catch( com.sun.star.lang.IndexOutOfBoundsException f )
- {
- return false;
- }
- }
-
-}
diff --git a/toolkit/test/accessibility/ov/SelectionView.java b/toolkit/test/accessibility/ov/SelectionView.java
deleted file mode 100644
index 0d84579eb844..000000000000
--- a/toolkit/test/accessibility/ov/SelectionView.java
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package ov;
-
-import java.awt.event.ActionListener;
-import java.awt.event.ActionEvent;
-
-import java.awt.Dimension;
-import java.awt.GridBagLayout;
-import java.awt.GridBagConstraints;
-
-import javax.swing.BoxLayout;
-import javax.swing.ButtonGroup;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JRadioButton;
-import javax.swing.JScrollPane;
-import javax.swing.JToggleButton;
-import com.sun.star.accessibility.AccessibleEventId;
-import com.sun.star.accessibility.AccessibleEventObject;
-import com.sun.star.accessibility.AccessibleStateType;
-import com.sun.star.accessibility.XAccessible;
-import com.sun.star.accessibility.XAccessibleContext;
-import com.sun.star.accessibility.XAccessibleSelection;
-import com.sun.star.accessibility.XAccessibleStateSet;
-
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.lang.IndexOutOfBoundsException;
-
-
-/** Display a list of children and select/deselect buttons
-*/
-class SelectionView
- extends ListeningObjectView
- implements ActionListener
-{
- static public ObjectView Create (
- ObjectViewContainer aContainer,
- XAccessibleContext xContext)
- {
- XAccessibleSelection xSelection = UnoRuntime.queryInterface(
- XAccessibleSelection.class, xContext);
- if (xSelection != null)
- return new SelectionView(aContainer);
- else
- return null;
- }
-
- public SelectionView (ObjectViewContainer aContainer)
- {
- super (aContainer);
- Layout();
- }
-
- @Override
- public String GetTitle ()
- {
- return "Selection";
- }
-
- /** Create and arrange the widgets for this view.
- */
- private void Layout ()
- {
- setLayout (new GridBagLayout());
-
- GridBagConstraints aConstraints = new GridBagConstraints();
-
- // Label that shows wheter the selection is multi selectable.
- aConstraints.gridx = 0;
- aConstraints.gridy = 0;
- aConstraints.anchor = GridBagConstraints.WEST;
- maTypeLabel = new JLabel ();
- add (maTypeLabel, aConstraints);
-
- // the JListBox
- maChildrenSelector = new JPanel ();
- maChildrenSelector.setPreferredSize (new Dimension (100,100));
- maChildrenSelector.setLayout (new BoxLayout (maChildrenSelector, BoxLayout.Y_AXIS));
-
- aConstraints.gridx = 0;
- aConstraints.gridwidth = 4;
- aConstraints.gridy = 1;
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
- add (new JScrollPane (maChildrenSelector,
- JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
- JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED),
- aConstraints);
-
- JButton aButton;
- aButton = new JButton( "Select all" );
- aButton.setActionCommand( "Select all" );
- aButton.addActionListener( this );
- aConstraints.gridx = 0;
- aConstraints.gridwidth = 1;
- aConstraints.gridy = 2;
- aConstraints.fill = GridBagConstraints.NONE;
- aConstraints.anchor = GridBagConstraints.WEST;
- add (aButton, aConstraints);
-
- aButton = new JButton( "Clear Selection" );
- aButton.setActionCommand( "Clear Selection" );
- aButton.addActionListener( this );
- aConstraints.gridx = 1;
- aConstraints.gridy = 2;
- aConstraints.weightx = 1;
- add (aButton, aConstraints);
-
- setSize (getPreferredSize());
- }
-
-
- @Override
- public void SetObject (XAccessibleContext xContext)
- {
- mxSelection = UnoRuntime.queryInterface(
- XAccessibleSelection.class, xContext);
- super.SetObject (xContext);
- }
-
-
- @Override
- public void Update ()
- {
- maChildrenSelector.removeAll ();
-
- // Determine whether multi selection is possible.
- XAccessibleStateSet aStateSet = mxContext.getAccessibleStateSet();
- boolean bMultiSelectable = false;
- ButtonGroup aButtonGroup = null;
- if (aStateSet!=null && aStateSet.contains(AccessibleStateType.MULTI_SELECTABLE))
- {
- bMultiSelectable = true;
- maTypeLabel.setText ("multi selectable");
- }
- else
- {
- maTypeLabel.setText ("single selectable");
- aButtonGroup = new ButtonGroup ();
- }
-
- int nCount = mxContext.getAccessibleChildCount();
- for (int i=0; i<nCount; i++)
- {
- try
- {
- XAccessible xChild = mxContext.getAccessibleChild(i);
- XAccessibleContext xChildContext = xChild.getAccessibleContext();
-
- String sName = i + " " + xChildContext.getAccessibleName();
- JToggleButton aChild;
- if (bMultiSelectable)
- aChild = new JCheckBox (sName);
- else
- {
- aChild = new JRadioButton (sName);
- aButtonGroup.add (aChild);
- }
-
- XAccessibleStateSet aChildStateSet = mxContext.getAccessibleStateSet();
- aChild.setSelected (aChildStateSet!=null
- && aChildStateSet.contains(AccessibleStateType.SELECTED));
-
- aChild.addActionListener (this);
- maChildrenSelector.add (aChild);
-
- }
- catch (IndexOutOfBoundsException e)
- {
- }
- }
- }
-
-
- void SelectAll()
- {
- mxSelection.selectAllAccessibleChildren();
- }
-
- void ClearSelection()
- {
- mxSelection.clearAccessibleSelection();
- }
-
-
- /** Call the function associated with the pressed button.
- */
- public void actionPerformed (ActionEvent aEvent)
- {
- String sCommand = aEvent.getActionCommand();
-
- if (sCommand.equals ("Clear Selection"))
- ClearSelection();
- else if (sCommand.equals ("Select all"))
- SelectAll();
- else
- {
- // Extract the child index from the widget text.
- String[] aWords = sCommand.split (" ");
- int nIndex = Integer.parseInt(aWords[0]);
- try
- {
- if (((JToggleButton)aEvent.getSource()).isSelected())
- mxSelection.selectAccessibleChild (nIndex);
- else
- mxSelection.deselectAccessibleChild (nIndex);
- }
- catch (IndexOutOfBoundsException e)
- {
- System.err.println ("caught exception while changing selection: " + e);
- }
- }
- }
-
-
- @Override
- public void notifyEvent (AccessibleEventObject aEvent)
- {
- if (aEvent.EventId == AccessibleEventId.SELECTION_CHANGED)
- Update ();
- }
-
- private JPanel maChildrenSelector;
- private XAccessibleSelection mxSelection;
- private JLabel maTypeLabel;
-}