Java5 updates - convert to generics
Change-Id: I039e51958865a7ea000034e7bf765f64d49689cd
This commit is contained in:
committed by
Caolán McNamara
parent
f906ac2776
commit
8bfe47960f
@@ -34,6 +34,7 @@ import com.sun.star.uno.*;
|
||||
|
||||
import org.openoffice.java.accessibility.*;
|
||||
|
||||
import java.awt.Window;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
@@ -42,7 +43,7 @@ import javax.accessibility.Accessible;
|
||||
|
||||
public class AccessBridge {
|
||||
//
|
||||
protected static java.util.Hashtable topWindowMap = new java.util.Hashtable();
|
||||
protected static java.util.Hashtable<String, Window> topWindowMap = new java.util.Hashtable<String, Window>();
|
||||
|
||||
private static java.awt.Window getTopWindowImpl(XAccessible xAccessible) {
|
||||
// Because it can not be garantied that
|
||||
@@ -51,7 +52,7 @@ public class AccessBridge {
|
||||
// atomic.
|
||||
synchronized (topWindowMap) {
|
||||
String oid = UnoRuntime.generateOid(xAccessible);
|
||||
java.awt.Window w = (java.awt.Window) topWindowMap.get(oid);
|
||||
java.awt.Window w = topWindowMap.get(oid);
|
||||
|
||||
if (w == null) {
|
||||
w = AccessibleObjectFactory.getTopWindow(xAccessible);
|
||||
@@ -107,7 +108,7 @@ public class AccessBridge {
|
||||
case AccessibleRole.WINDOW:
|
||||
case AccessibleRole.FRAME:
|
||||
case AccessibleRole.DIALOG:
|
||||
return (java.awt.Window) topWindowMap.remove(UnoRuntime.generateOid(xAccessible));
|
||||
return topWindowMap.remove(UnoRuntime.generateOid(xAccessible));
|
||||
|
||||
default:
|
||||
break;
|
||||
@@ -156,7 +157,7 @@ public class AccessBridge {
|
||||
// FIXME this should be done in VCL
|
||||
unoToolkit.addTopWindowListener(this);
|
||||
|
||||
String os = (String) System.getProperty("os.name");
|
||||
String os = System.getProperty("os.name");
|
||||
|
||||
// Try to initialize the WindowsAccessBridgeAdapter
|
||||
if (os.startsWith("Windows")) {
|
||||
@@ -177,7 +178,7 @@ public class AccessBridge {
|
||||
* XTopWindowListener
|
||||
*/
|
||||
public void windowOpened(com.sun.star.lang.EventObject event) {
|
||||
XAccessible xAccessible = (XAccessible) UnoRuntime.queryInterface(XAccessible.class,
|
||||
XAccessible xAccessible = UnoRuntime.queryInterface(XAccessible.class,
|
||||
event.Source);
|
||||
java.awt.Window w = getTopWindow(xAccessible);
|
||||
}
|
||||
@@ -198,7 +199,7 @@ public class AccessBridge {
|
||||
}
|
||||
|
||||
public void windowClosed(com.sun.star.lang.EventObject event) {
|
||||
XAccessible xAccessible = (XAccessible) UnoRuntime.queryInterface(XAccessible.class,
|
||||
XAccessible xAccessible = UnoRuntime.queryInterface(XAccessible.class,
|
||||
event.Source);
|
||||
|
||||
java.awt.Window w = removeTopWindow(xAccessible);
|
||||
|
||||
@@ -34,7 +34,7 @@ import javax.accessibility.*;
|
||||
public class WindowsAccessBridgeAdapter {
|
||||
private static Method registerVirtualFrame;
|
||||
private static Method revokeVirtualFrame;
|
||||
private static java.util.Hashtable frameMap;
|
||||
private static java.util.Hashtable<Integer, Accessible> frameMap;
|
||||
|
||||
protected static native byte[] getProcessID();
|
||||
|
||||
@@ -44,9 +44,9 @@ public class WindowsAccessBridgeAdapter {
|
||||
// Therefor the bridge exports two methods that we try to find here.
|
||||
protected static void attach(XComponentContext xComponentContext) {
|
||||
try {
|
||||
Class bridge = Class.forName(
|
||||
Class<?> bridge = Class.forName(
|
||||
"com.sun.java.accessibility.AccessBridge");
|
||||
Class[] parameterTypes = {
|
||||
Class<?>[] parameterTypes = {
|
||||
javax.accessibility.Accessible.class, Integer.class
|
||||
};
|
||||
|
||||
@@ -63,7 +63,7 @@ public class WindowsAccessBridgeAdapter {
|
||||
"/singletons/com.sun.star.java.theJavaVirtualMachine");
|
||||
|
||||
if (AnyConverter.isObject(any)) {
|
||||
XJavaVM xJavaVM = (XJavaVM) UnoRuntime.queryInterface(XJavaVM.class,
|
||||
XJavaVM xJavaVM = UnoRuntime.queryInterface(XJavaVM.class,
|
||||
AnyConverter.toObject(new Type(XJavaVM.class), any));
|
||||
|
||||
if (xJavaVM != null) {
|
||||
@@ -71,7 +71,7 @@ public class WindowsAccessBridgeAdapter {
|
||||
|
||||
if (AnyConverter.isLong(any)) {
|
||||
createMapping(AnyConverter.toLong(any));
|
||||
frameMap = new java.util.Hashtable();
|
||||
frameMap = new java.util.Hashtable<Integer, Accessible>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -149,7 +149,7 @@ public class WindowsAccessBridgeAdapter {
|
||||
break;
|
||||
|
||||
default:
|
||||
a = (Accessible) AccessBridge.getTopWindow(xAccessible);
|
||||
a = AccessBridge.getTopWindow(xAccessible);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -201,7 +201,7 @@ public class WindowsAccessBridgeAdapter {
|
||||
public static void revokeTopWindow(int handle, XAccessible xAccessible) {
|
||||
Integer hwnd = new Integer(handle);
|
||||
|
||||
Accessible a = (Accessible) frameMap.remove(hwnd);
|
||||
Accessible a = frameMap.remove(hwnd);
|
||||
|
||||
if (a != null) {
|
||||
Object[] args = { a, hwnd };
|
||||
|
||||
@@ -57,8 +57,7 @@ public abstract class AbstractButton extends Component {
|
||||
return null;
|
||||
|
||||
try {
|
||||
XAccessibleText unoAccessibleText = (XAccessibleText)
|
||||
UnoRuntime.queryInterface(XAccessibleText.class,unoAccessibleComponent);
|
||||
XAccessibleText unoAccessibleText = UnoRuntime.queryInterface(XAccessibleText.class,unoAccessibleComponent);
|
||||
if (unoAccessibleText != null) {
|
||||
return new AccessibleTextImpl(unoAccessibleText);
|
||||
} else {
|
||||
@@ -137,8 +136,7 @@ public abstract class AbstractButton extends Component {
|
||||
XAccessibleContext xAccessibleContext = unoAccessibleContext;
|
||||
if (xAccessibleContext != null) {
|
||||
// Query for XAccessibleAction interface
|
||||
XAccessibleAction xAccessibleAction = (XAccessibleAction)
|
||||
UnoRuntime.queryInterface(XAccessibleAction.class, xAccessibleContext);
|
||||
XAccessibleAction xAccessibleAction = UnoRuntime.queryInterface(XAccessibleAction.class, xAccessibleContext);
|
||||
|
||||
if (xAccessibleAction != null) {
|
||||
return xAccessibleAction.doAccessibleAction(0);
|
||||
|
||||
@@ -36,8 +36,7 @@ public class AccessibleComponentImpl implements javax.accessibility.AccessibleCo
|
||||
|
||||
protected boolean hasState(short state) {
|
||||
try {
|
||||
XAccessibleContext unoAccessibleContext = (XAccessibleContext)
|
||||
UnoRuntime.queryInterface(XAccessibleContext.class, unoObject);
|
||||
XAccessibleContext unoAccessibleContext = UnoRuntime.queryInterface(XAccessibleContext.class, unoObject);
|
||||
// All UNO accessibility implementations must support XAccessibleContext
|
||||
// and return a valid XAccessibleStateSet ..
|
||||
return unoAccessibleContext.getAccessibleStateSet().contains(state);
|
||||
|
||||
+4
-3
@@ -23,6 +23,7 @@ import com.sun.star.style.*;
|
||||
import com.sun.star.uno.*;
|
||||
import com.sun.star.accessibility.AccessibleTextType;
|
||||
import com.sun.star.accessibility.XAccessibleEditableText;
|
||||
import com.sun.star.beans.PropertyValue;
|
||||
|
||||
import javax.accessibility.AccessibleText;
|
||||
import javax.swing.text.StyleConstants;
|
||||
@@ -104,7 +105,7 @@ public class AccessibleEditableTextImpl extends AccessibleTextImpl implements ja
|
||||
|
||||
/** Sets the attributes for the text between two indices */
|
||||
public void setAttributes(int startIndex, int endIndex, javax.swing.text.AttributeSet as) {
|
||||
java.util.ArrayList propertyValues = new java.util.ArrayList();
|
||||
java.util.ArrayList<PropertyValue> propertyValues = new java.util.ArrayList<PropertyValue>();
|
||||
|
||||
// Convert Alignment attribute
|
||||
Object attribute = as.getAttribute(StyleConstants.Alignment);
|
||||
@@ -298,7 +299,7 @@ public class AccessibleEditableTextImpl extends AccessibleTextImpl implements ja
|
||||
propertyValue.Name = "ParaTabStops";
|
||||
|
||||
javax.swing.text.TabSet tabSet = StyleConstants.getTabSet(as);
|
||||
java.util.ArrayList tabStops = new java.util.ArrayList(tabSet.getTabCount());
|
||||
java.util.ArrayList<TabStop> tabStops = new java.util.ArrayList<TabStop>(tabSet.getTabCount());
|
||||
|
||||
for (int i = 0, max = tabSet.getTabCount(); i < max; i++) {
|
||||
javax.swing.text.TabStop tab = tabSet.getTab(i);
|
||||
@@ -323,7 +324,7 @@ public class AccessibleEditableTextImpl extends AccessibleTextImpl implements ja
|
||||
|
||||
tabStops.add(unoTab);
|
||||
}
|
||||
propertyValue.Value = (com.sun.star.style.TabStop[]) tabStops.toArray();
|
||||
propertyValue.Value = tabStops.toArray();
|
||||
propertyValues.add(propertyValue);
|
||||
}
|
||||
|
||||
|
||||
@@ -136,14 +136,12 @@ public class AccessibleHypertextImpl extends AccessibleTextImpl
|
||||
|
||||
public static javax.accessibility.AccessibleText get(com.sun.star.uno.XInterface unoObject) {
|
||||
try {
|
||||
XAccessibleHypertext unoAccessibleHypertext = (XAccessibleHypertext)
|
||||
UnoRuntime.queryInterface(XAccessibleHypertext.class, unoObject);
|
||||
XAccessibleHypertext unoAccessibleHypertext = UnoRuntime.queryInterface(XAccessibleHypertext.class, unoObject);
|
||||
if (unoAccessibleHypertext != null) {
|
||||
return new AccessibleHypertextImpl(unoAccessibleHypertext);
|
||||
}
|
||||
|
||||
XAccessibleText unoAccessibleText = (XAccessibleText)
|
||||
UnoRuntime.queryInterface(XAccessibleText.class, unoObject);
|
||||
XAccessibleText unoAccessibleText = UnoRuntime.queryInterface(XAccessibleText.class, unoObject);
|
||||
if (unoAccessibleText != null) {
|
||||
return new AccessibleTextImpl(unoAccessibleText);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package org.openoffice.java.accessibility;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.lang.ref.WeakReference;
|
||||
import javax.accessibility.Accessible;
|
||||
import javax.accessibility.AccessibleStateSet;
|
||||
@@ -32,7 +33,7 @@ public class AccessibleObjectFactory {
|
||||
// This type is needed for conversions from/to uno Any
|
||||
public static final Type XAccessibleType = new Type(XAccessible.class);
|
||||
|
||||
private static java.util.Hashtable objectList = new java.util.Hashtable();
|
||||
private static java.util.Hashtable<String, WeakReference<Component>> objectList = new java.util.Hashtable<String, WeakReference<Component>>();
|
||||
private static java.awt.FocusTraversalPolicy focusTraversalPolicy = new FocusTraversalPolicy();
|
||||
|
||||
private static java.awt.EventQueue theEventQueue = java.awt.Toolkit.getDefaultToolkit().
|
||||
@@ -93,9 +94,9 @@ public class AccessibleObjectFactory {
|
||||
|
||||
// Check if we already have a wrapper object for this context
|
||||
synchronized (objectList) {
|
||||
WeakReference r = (WeakReference) objectList.get(oid);
|
||||
WeakReference<java.awt.Component> r = objectList.get(oid);
|
||||
if(r != null) {
|
||||
c = (java.awt.Component) r.get();
|
||||
c = r.get();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -450,7 +451,7 @@ public class AccessibleObjectFactory {
|
||||
if (c != null) {
|
||||
// Add the newly created object to the cache list
|
||||
synchronized (objectList) {
|
||||
objectList.put(c.toString(), new WeakReference(c));
|
||||
objectList.put(c.toString(), new WeakReference<Component>(c));
|
||||
if (Build.DEBUG) {
|
||||
// System.out.println("Object cache now contains " + objectList.size() + " objects.");
|
||||
}
|
||||
@@ -483,8 +484,7 @@ public class AccessibleObjectFactory {
|
||||
if (xAccessibleContext != null) {
|
||||
short role = xAccessibleContext.getAccessibleRole();
|
||||
XAccessibleStateSet xAccessibleStateSet = xAccessibleContext.getAccessibleStateSet();
|
||||
XAccessibleComponent xAccessibleComponent = (XAccessibleComponent)
|
||||
UnoRuntime.queryInterface(XAccessibleComponent.class, xAccessibleContext);
|
||||
XAccessibleComponent xAccessibleComponent = UnoRuntime.queryInterface(XAccessibleComponent.class, xAccessibleContext);
|
||||
|
||||
java.awt.Window w;
|
||||
if (role == AccessibleRole.DIALOG) {
|
||||
|
||||
@@ -74,8 +74,7 @@ public class AccessibleTextImpl implements javax.accessibility.AccessibleText {
|
||||
|
||||
public static javax.accessibility.AccessibleText get(com.sun.star.uno.XInterface unoObject) {
|
||||
try {
|
||||
XAccessibleText unoAccessibleText = (XAccessibleText)
|
||||
UnoRuntime.queryInterface(XAccessibleText.class, unoObject);
|
||||
XAccessibleText unoAccessibleText = UnoRuntime.queryInterface(XAccessibleText.class, unoObject);
|
||||
if (unoAccessibleText != null) {
|
||||
return new AccessibleTextImpl(unoAccessibleText);
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public class ComboBox extends Container {
|
||||
/** Gets the AccessibleAction associated with this object that supports one or more actions */
|
||||
public javax.accessibility.AccessibleAction getAccessibleAction() {
|
||||
if (unoAccessibleAction == null) {
|
||||
unoAccessibleAction = (XAccessibleAction) UnoRuntime.queryInterface(XAccessibleAction.class,
|
||||
unoAccessibleAction = UnoRuntime.queryInterface(XAccessibleAction.class,
|
||||
unoAccessibleContext);
|
||||
|
||||
if (unoAccessibleAction == null) {
|
||||
|
||||
@@ -38,13 +38,11 @@ public abstract class Component extends java.awt.Component {
|
||||
super();
|
||||
unoAccessible = xAccessible;
|
||||
unoAccessibleContext = xAccessibleContext;
|
||||
unoAccessibleComponent = (XAccessibleComponent)
|
||||
UnoRuntime.queryInterface(XAccessibleComponent.class, xAccessibleContext);
|
||||
unoAccessibleComponent = UnoRuntime.queryInterface(XAccessibleComponent.class, xAccessibleContext);
|
||||
// Add the event listener right away, because the global focus notification doesn't
|
||||
// work yet ..
|
||||
XAccessibleEventBroadcaster broadcaster = (XAccessibleEventBroadcaster)
|
||||
UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class,
|
||||
unoAccessibleComponent);
|
||||
XAccessibleEventBroadcaster broadcaster = UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class,
|
||||
unoAccessibleComponent);
|
||||
if (broadcaster != null) {
|
||||
broadcaster.addEventListener(createEventListener());
|
||||
}
|
||||
@@ -122,10 +120,10 @@ public abstract class Component extends java.awt.Component {
|
||||
|
||||
public Object[] getAccessibleComponents(Object[] targetSet) {
|
||||
try {
|
||||
java.util.ArrayList list = new java.util.ArrayList(targetSet.length);
|
||||
java.util.ArrayList<java.awt.Component> list = new java.util.ArrayList<java.awt.Component>(targetSet.length);
|
||||
for (int i=0; i < targetSet.length; i++) {
|
||||
java.awt.Component c = AccessibleObjectFactory.getAccessibleComponent(
|
||||
(XAccessible) UnoRuntime.queryInterface(XAccessible.class, targetSet[i]));
|
||||
UnoRuntime.queryInterface(XAccessible.class, targetSet[i]));
|
||||
if (c != null) {
|
||||
list.add(c);
|
||||
}
|
||||
@@ -659,8 +657,7 @@ public abstract class Component extends java.awt.Component {
|
||||
|
||||
public String getToolTipText() {
|
||||
try {
|
||||
XAccessibleExtendedComponent unoAccessibleExtendedComponent = (XAccessibleExtendedComponent)
|
||||
UnoRuntime.queryInterface(XAccessibleExtendedComponent.class, unoAccessibleComponent);
|
||||
XAccessibleExtendedComponent unoAccessibleExtendedComponent = UnoRuntime.queryInterface(XAccessibleExtendedComponent.class, unoAccessibleComponent);
|
||||
if (unoAccessibleExtendedComponent != null) {
|
||||
return unoAccessibleExtendedComponent.getToolTipText();
|
||||
}
|
||||
@@ -672,8 +669,7 @@ public abstract class Component extends java.awt.Component {
|
||||
|
||||
public String getTitledBorderText() {
|
||||
try {
|
||||
XAccessibleExtendedComponent unoAccessibleExtendedComponent = (XAccessibleExtendedComponent)
|
||||
UnoRuntime.queryInterface(XAccessibleExtendedComponent.class, unoAccessibleComponent);
|
||||
XAccessibleExtendedComponent unoAccessibleExtendedComponent = UnoRuntime.queryInterface(XAccessibleExtendedComponent.class, unoAccessibleComponent);
|
||||
if (unoAccessibleExtendedComponent != null) {
|
||||
return unoAccessibleExtendedComponent.getTitledBorderText();
|
||||
}
|
||||
@@ -685,8 +681,7 @@ public abstract class Component extends java.awt.Component {
|
||||
|
||||
public javax.accessibility.AccessibleKeyBinding getAccessibleKeyBinding() {
|
||||
try {
|
||||
XAccessibleAction unoAccessibleAction = (XAccessibleAction)
|
||||
UnoRuntime.queryInterface(XAccessibleAction.class, unoAccessibleComponent);
|
||||
XAccessibleAction unoAccessibleAction = UnoRuntime.queryInterface(XAccessibleAction.class, unoAccessibleComponent);
|
||||
if (unoAccessibleAction != null) {
|
||||
XAccessibleKeyBinding unoAccessibleKeyBinding = unoAccessibleAction.getAccessibleActionKeyBinding(0);
|
||||
if (unoAccessibleKeyBinding != null) {
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
package org.openoffice.java.accessibility;
|
||||
|
||||
import java.awt.Component;
|
||||
|
||||
import javax.accessibility.AccessibleContext;
|
||||
import javax.accessibility.AccessibleState;
|
||||
|
||||
@@ -39,15 +41,13 @@ public class Container extends java.awt.Container implements javax.accessibility
|
||||
accessibleRole = role;
|
||||
unoAccessible = xAccessible;
|
||||
unoAccessibleContext = xAccessibleContext;
|
||||
unoAccessibleComponent = (XAccessibleComponent)
|
||||
UnoRuntime.queryInterface(XAccessibleComponent.class,
|
||||
xAccessibleContext);
|
||||
unoAccessibleComponent = UnoRuntime.queryInterface(XAccessibleComponent.class,
|
||||
xAccessibleContext);
|
||||
|
||||
// Add the event listener right away, because the global focus notification doesn't
|
||||
// work yet ..
|
||||
XAccessibleEventBroadcaster broadcaster = (XAccessibleEventBroadcaster)
|
||||
UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class,
|
||||
unoAccessibleContext);
|
||||
XAccessibleEventBroadcaster broadcaster = UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class,
|
||||
unoAccessibleContext);
|
||||
if (broadcaster != null) {
|
||||
broadcaster.addEventListener(createEventListener());
|
||||
}
|
||||
@@ -125,10 +125,10 @@ public class Container extends java.awt.Container implements javax.accessibility
|
||||
|
||||
public Object[] getAccessibleComponents(Object[] targetSet) {
|
||||
try {
|
||||
java.util.ArrayList list = new java.util.ArrayList(targetSet.length);
|
||||
java.util.ArrayList<Component> list = new java.util.ArrayList<Component>(targetSet.length);
|
||||
for (int i=0; i < targetSet.length; i++) {
|
||||
java.awt.Component c = AccessibleObjectFactory.getAccessibleComponent(
|
||||
(XAccessible) UnoRuntime.queryInterface(XAccessible.class, targetSet[i]));
|
||||
UnoRuntime.queryInterface(XAccessible.class, targetSet[i]));
|
||||
if (c != null) {
|
||||
list.add(c);
|
||||
}
|
||||
@@ -567,8 +567,7 @@ public class Container extends java.awt.Container implements javax.accessibility
|
||||
/** Returns the AccessibleSelection interface for this object */
|
||||
public javax.accessibility.AccessibleSelection getAccessibleSelection() {
|
||||
try {
|
||||
XAccessibleSelection unoAccessibleSelection = (XAccessibleSelection)
|
||||
UnoRuntime.queryInterface(XAccessibleSelection.class, unoAccessibleContext);
|
||||
XAccessibleSelection unoAccessibleSelection = UnoRuntime.queryInterface(XAccessibleSelection.class, unoAccessibleContext);
|
||||
if (unoAccessibleSelection != null) {
|
||||
return new AccessibleSelectionImpl(unoAccessibleSelection);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public abstract class DescendantManager extends Component {
|
||||
protected class AccessibleDescendantManagerListener
|
||||
extends AccessibleUNOComponentListener {
|
||||
protected AccessibleDescendantManagerListener() {
|
||||
unoAccessibleSelection = (XAccessibleSelection) UnoRuntime.queryInterface(XAccessibleSelection.class,
|
||||
unoAccessibleSelection = UnoRuntime.queryInterface(XAccessibleSelection.class,
|
||||
unoAccessibleContext);
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public abstract class DescendantManager extends Component {
|
||||
extends AccessibleUNOComponent
|
||||
implements javax.accessibility.AccessibleSelection {
|
||||
protected AccessibleDescendantManager() {
|
||||
unoAccessibleSelection = (XAccessibleSelection) UnoRuntime.queryInterface(XAccessibleSelection.class,
|
||||
unoAccessibleSelection = UnoRuntime.queryInterface(XAccessibleSelection.class,
|
||||
unoAccessibleContext);
|
||||
}
|
||||
|
||||
|
||||
@@ -50,9 +50,8 @@ public class Dialog extends java.awt.Dialog implements javax.accessibility.Acces
|
||||
private void initialize(XAccessibleComponent xAccessibleComponent) {
|
||||
unoAccessibleComponent = xAccessibleComponent;
|
||||
eventQueue = java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue();
|
||||
XAccessibleEventBroadcaster broadcaster = (XAccessibleEventBroadcaster)
|
||||
UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class,
|
||||
xAccessibleComponent);
|
||||
XAccessibleEventBroadcaster broadcaster = UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class,
|
||||
xAccessibleComponent);
|
||||
if (broadcaster != null) {
|
||||
broadcaster.addEventListener(new AccessibleDialogListener());
|
||||
}
|
||||
|
||||
@@ -42,9 +42,8 @@ public class Frame extends java.awt.Frame implements javax.accessibility.Accessi
|
||||
private void initialize(XAccessibleComponent xAccessibleComponent) {
|
||||
unoAccessibleComponent = xAccessibleComponent;
|
||||
eventQueue = java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue();
|
||||
XAccessibleEventBroadcaster broadcaster = (XAccessibleEventBroadcaster)
|
||||
UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class,
|
||||
unoAccessibleComponent);
|
||||
XAccessibleEventBroadcaster broadcaster = UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class,
|
||||
unoAccessibleComponent);
|
||||
if (broadcaster != null) {
|
||||
broadcaster.addEventListener(new AccessibleFrameListener());
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public class Icon extends Component implements javax.accessibility.Accessible {
|
||||
/** Gets the AccessibleText associated with this object presenting text on the display */
|
||||
public javax.accessibility.AccessibleIcon[] getAccessibleIcon() {
|
||||
try {
|
||||
XAccessibleImage unoAccessibleImage = (XAccessibleImage) UnoRuntime.queryInterface(XAccessibleImage.class,
|
||||
XAccessibleImage unoAccessibleImage = UnoRuntime.queryInterface(XAccessibleImage.class,
|
||||
unoAccessibleComponent);
|
||||
|
||||
if (unoAccessibleImage != null) {
|
||||
|
||||
@@ -60,7 +60,7 @@ public class Label extends Component implements javax.accessibility.Accessible {
|
||||
return null;
|
||||
|
||||
try {
|
||||
XAccessibleText unoAccessibleText = (XAccessibleText) UnoRuntime.queryInterface(XAccessibleText.class,
|
||||
XAccessibleText unoAccessibleText = UnoRuntime.queryInterface(XAccessibleText.class,
|
||||
unoAccessibleContext);
|
||||
|
||||
if (unoAccessibleText != null) {
|
||||
|
||||
@@ -231,9 +231,9 @@ public class List extends DescendantManager implements javax.accessibility.Acces
|
||||
|
||||
public Object[] create(Object[] targetSet) {
|
||||
try {
|
||||
java.util.ArrayList list = new java.util.ArrayList(targetSet.length);
|
||||
java.util.ArrayList<ListItem> list = new java.util.ArrayList<ListItem>(targetSet.length);
|
||||
for (int i=0; i < targetSet.length; i++) {
|
||||
XAccessible xAccessible = (XAccessible) UnoRuntime.queryInterface(
|
||||
XAccessible xAccessible = UnoRuntime.queryInterface(
|
||||
XAccessible.class, targetSet[i]);
|
||||
if (xAccessible != null) {
|
||||
list.add(new ListItem(xAccessible));
|
||||
@@ -375,8 +375,7 @@ public class List extends DescendantManager implements javax.accessibility.Acces
|
||||
/** Gets the AccessibleComponent associated with this object that has a graphical representation */
|
||||
public javax.accessibility.AccessibleComponent getAccessibleComponent() {
|
||||
try {
|
||||
XAccessibleComponent unoAccessibleComponent = (XAccessibleComponent)
|
||||
UnoRuntime.queryInterface(XAccessibleComponent.class, unoAccessibleContext);
|
||||
XAccessibleComponent unoAccessibleComponent = UnoRuntime.queryInterface(XAccessibleComponent.class, unoAccessibleContext);
|
||||
return (unoAccessibleComponent != null) ?
|
||||
new AccessibleComponentImpl(unoAccessibleComponent) : null;
|
||||
} catch (com.sun.star.uno.RuntimeException e) {
|
||||
@@ -387,8 +386,7 @@ public class List extends DescendantManager implements javax.accessibility.Acces
|
||||
/** Gets the AccessibleAction associated with this object that has a graphical representation */
|
||||
public javax.accessibility.AccessibleAction getAccessibleAction() {
|
||||
try {
|
||||
XAccessibleAction unoAccessibleAction = (XAccessibleAction)
|
||||
UnoRuntime.queryInterface(XAccessibleAction.class, unoAccessibleContext);
|
||||
XAccessibleAction unoAccessibleAction = UnoRuntime.queryInterface(XAccessibleAction.class, unoAccessibleContext);
|
||||
return (unoAccessibleAction != null) ?
|
||||
new AccessibleActionImpl(unoAccessibleAction) : null;
|
||||
} catch (com.sun.star.uno.RuntimeException e) {
|
||||
@@ -403,8 +401,7 @@ public class List extends DescendantManager implements javax.accessibility.Acces
|
||||
return null;
|
||||
|
||||
try {
|
||||
XAccessibleText unoAccessibleText = (XAccessibleText)
|
||||
UnoRuntime.queryInterface(XAccessibleText.class, unoAccessibleContext);
|
||||
XAccessibleText unoAccessibleText = UnoRuntime.queryInterface(XAccessibleText.class, unoAccessibleContext);
|
||||
return (unoAccessibleText != null) ?
|
||||
new AccessibleTextImpl(unoAccessibleText) : null;
|
||||
} catch (com.sun.star.uno.RuntimeException e) {
|
||||
@@ -415,8 +412,7 @@ public class List extends DescendantManager implements javax.accessibility.Acces
|
||||
/** Gets the AccessibleValue associated with this object that has a graphical representation */
|
||||
public javax.accessibility.AccessibleValue getAccessibleValue() {
|
||||
try {
|
||||
XAccessibleValue unoAccessibleValue = (XAccessibleValue)
|
||||
UnoRuntime.queryInterface(XAccessibleValue.class, unoAccessibleContext);
|
||||
XAccessibleValue unoAccessibleValue = UnoRuntime.queryInterface(XAccessibleValue.class, unoAccessibleContext);
|
||||
return (unoAccessibleValue != null) ?
|
||||
new AccessibleValueImpl(unoAccessibleValue) : null;
|
||||
} catch (com.sun.star.uno.RuntimeException e) {
|
||||
@@ -427,8 +423,7 @@ public class List extends DescendantManager implements javax.accessibility.Acces
|
||||
/** Gets the AccessibleText associated with this object presenting text on the display */
|
||||
public javax.accessibility.AccessibleIcon[] getAccessibleIcon() {
|
||||
try {
|
||||
XAccessibleImage unoAccessibleImage = (XAccessibleImage)
|
||||
UnoRuntime.queryInterface(XAccessibleImage.class, unoAccessibleContext);
|
||||
XAccessibleImage unoAccessibleImage = UnoRuntime.queryInterface(XAccessibleImage.class, unoAccessibleContext);
|
||||
if (unoAccessibleImage != null) {
|
||||
javax.accessibility.AccessibleIcon[] icons = { new AccessibleIconImpl(unoAccessibleImage) };
|
||||
return icons;
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
*/
|
||||
package org.openoffice.java.accessibility;
|
||||
|
||||
import java.awt.Component;
|
||||
|
||||
import com.sun.star.accessibility.*;
|
||||
import com.sun.star.uno.AnyConverter;
|
||||
import com.sun.star.uno.UnoRuntime;
|
||||
@@ -24,7 +26,7 @@ import com.sun.star.uno.UnoRuntime;
|
||||
|
||||
public class Menu extends AbstractButton
|
||||
implements javax.accessibility.Accessible {
|
||||
private java.util.ArrayList children;
|
||||
private java.util.ArrayList<Component> children;
|
||||
protected XAccessibleSelection unoAccessibleSelection = null;
|
||||
|
||||
protected Menu(XAccessible xAccessible,
|
||||
@@ -34,7 +36,7 @@ public class Menu extends AbstractButton
|
||||
try {
|
||||
// Create a vector with the correct initial capacity
|
||||
int count = unoAccessibleContext.getAccessibleChildCount();
|
||||
children = new java.util.ArrayList(count);
|
||||
children = new java.util.ArrayList<Component>(count);
|
||||
|
||||
// Fill the vector with objects
|
||||
for (int i = 0; i < count; i++) {
|
||||
@@ -52,7 +54,7 @@ public class Menu extends AbstractButton
|
||||
}
|
||||
|
||||
if (children == null) {
|
||||
children = new java.util.ArrayList(0);
|
||||
children = new java.util.ArrayList<Component>(0);
|
||||
}
|
||||
} catch (com.sun.star.lang.IndexOutOfBoundsException e) {
|
||||
}
|
||||
@@ -172,7 +174,7 @@ public class Menu extends AbstractButton
|
||||
protected class AccessibleMenu extends AccessibleAbstractButton
|
||||
implements javax.accessibility.AccessibleSelection {
|
||||
protected AccessibleMenu() {
|
||||
unoAccessibleSelection = (XAccessibleSelection) UnoRuntime.queryInterface(XAccessibleSelection.class,
|
||||
unoAccessibleSelection = UnoRuntime.queryInterface(XAccessibleSelection.class,
|
||||
unoAccessibleContext);
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ public class MenuContainer extends Container implements javax.accessibility.Acce
|
||||
protected class AccessibleMenuContainer extends AccessibleContainer implements javax.accessibility.AccessibleSelection {
|
||||
|
||||
protected AccessibleMenuContainer() {
|
||||
unoAccessibleSelection = (XAccessibleSelection) UnoRuntime.queryInterface(XAccessibleSelection.class,
|
||||
unoAccessibleSelection = UnoRuntime.queryInterface(XAccessibleSelection.class,
|
||||
unoAccessibleContext);
|
||||
}
|
||||
|
||||
|
||||
@@ -128,9 +128,8 @@ public class Paragraph extends Container implements javax.accessibility.Accessib
|
||||
return null;
|
||||
|
||||
try {
|
||||
XAccessibleEditableText unoAccessibleText = (XAccessibleEditableText)
|
||||
UnoRuntime.queryInterface(XAccessibleEditableText.class,
|
||||
unoAccessibleComponent);
|
||||
XAccessibleEditableText unoAccessibleText = UnoRuntime.queryInterface(XAccessibleEditableText.class,
|
||||
unoAccessibleComponent);
|
||||
if (unoAccessibleText != null) {
|
||||
return new AccessibleEditableTextImpl(unoAccessibleText);
|
||||
} else {
|
||||
@@ -144,8 +143,7 @@ public class Paragraph extends Container implements javax.accessibility.Accessib
|
||||
/** Gets the AccessibleAction associated with this object that has a graphical representation */
|
||||
public javax.accessibility.AccessibleAction getAccessibleAction() {
|
||||
try {
|
||||
XAccessibleAction unoAccessibleAction = (XAccessibleAction)
|
||||
UnoRuntime.queryInterface(XAccessibleAction.class, unoAccessibleComponent);
|
||||
XAccessibleAction unoAccessibleAction = UnoRuntime.queryInterface(XAccessibleAction.class, unoAccessibleComponent);
|
||||
return (unoAccessibleAction != null) ?
|
||||
new AccessibleActionImpl(unoAccessibleAction) : null;
|
||||
} catch (com.sun.star.uno.RuntimeException e) {
|
||||
|
||||
@@ -49,7 +49,7 @@ public class ScrollBar extends Component implements SwingConstants, javax.access
|
||||
*/
|
||||
protected AccessibleScrollBar() {
|
||||
super();
|
||||
unoAccessibleAction = (XAccessibleAction) UnoRuntime.queryInterface(
|
||||
unoAccessibleAction = UnoRuntime.queryInterface(
|
||||
XAccessibleAction.class, unoAccessibleContext);
|
||||
if (unoAccessibleAction != null) {
|
||||
actionCount = unoAccessibleAction.getAccessibleActionCount();
|
||||
@@ -68,8 +68,7 @@ public class ScrollBar extends Component implements SwingConstants, javax.access
|
||||
/** Gets the AccessibleValue associated with this object that has a graphical representation */
|
||||
public javax.accessibility.AccessibleValue getAccessibleValue() {
|
||||
try {
|
||||
XAccessibleValue unoAccessibleValue = (XAccessibleValue)
|
||||
UnoRuntime.queryInterface(XAccessibleValue.class, unoAccessibleContext);
|
||||
XAccessibleValue unoAccessibleValue = UnoRuntime.queryInterface(XAccessibleValue.class, unoAccessibleContext);
|
||||
return (unoAccessibleValue != null) ?
|
||||
new AccessibleValueImpl(unoAccessibleValue) : null;
|
||||
} catch (com.sun.star.uno.RuntimeException e) {
|
||||
|
||||
@@ -130,7 +130,7 @@ public class Table extends DescendantManager implements javax.accessibility.Acce
|
||||
protected XAccessibleTable unoAccessibleTable;
|
||||
|
||||
public AccessibleTable() {
|
||||
unoAccessibleTable = (XAccessibleTable) UnoRuntime.queryInterface(XAccessibleTable.class, unoAccessibleContext);
|
||||
unoAccessibleTable = UnoRuntime.queryInterface(XAccessibleTable.class, unoAccessibleContext);
|
||||
}
|
||||
|
||||
/** Gets the role of this object */
|
||||
@@ -457,9 +457,9 @@ public class Table extends DescendantManager implements javax.accessibility.Acce
|
||||
|
||||
public Object[] create(Object[] targetSet) {
|
||||
try {
|
||||
java.util.ArrayList list = new java.util.ArrayList(targetSet.length);
|
||||
java.util.ArrayList<TableCell> list = new java.util.ArrayList<TableCell>(targetSet.length);
|
||||
for (int i=0; i < targetSet.length; i++) {
|
||||
XAccessible xAccessible = (XAccessible) UnoRuntime.queryInterface(
|
||||
XAccessible xAccessible = UnoRuntime.queryInterface(
|
||||
XAccessible.class, targetSet[i]);
|
||||
if (xAccessible != null) {
|
||||
list.add(new TableCell(xAccessible));
|
||||
@@ -650,8 +650,7 @@ public class Table extends DescendantManager implements javax.accessibility.Acce
|
||||
/** Gets the AccessibleComponent associated with this object that has a graphical representation */
|
||||
public javax.accessibility.AccessibleComponent getAccessibleComponent() {
|
||||
try {
|
||||
XAccessibleComponent unoAccessibleComponent = (XAccessibleComponent)
|
||||
UnoRuntime.queryInterface(XAccessibleComponent.class, unoAccessibleContext);
|
||||
XAccessibleComponent unoAccessibleComponent = UnoRuntime.queryInterface(XAccessibleComponent.class, unoAccessibleContext);
|
||||
return (unoAccessibleComponent != null) ?
|
||||
new AccessibleComponentImpl(unoAccessibleComponent) : null;
|
||||
} catch (com.sun.star.uno.RuntimeException e) {
|
||||
@@ -662,8 +661,7 @@ public class Table extends DescendantManager implements javax.accessibility.Acce
|
||||
/** Gets the AccessibleAction associated with this object that has a graphical representation */
|
||||
public javax.accessibility.AccessibleAction getAccessibleAction() {
|
||||
try {
|
||||
XAccessibleAction unoAccessibleAction = (XAccessibleAction)
|
||||
UnoRuntime.queryInterface(XAccessibleAction.class, unoAccessibleContext);
|
||||
XAccessibleAction unoAccessibleAction = UnoRuntime.queryInterface(XAccessibleAction.class, unoAccessibleContext);
|
||||
return (unoAccessibleAction != null) ?
|
||||
new AccessibleActionImpl(unoAccessibleAction) : null;
|
||||
} catch (com.sun.star.uno.RuntimeException e) {
|
||||
@@ -678,8 +676,7 @@ public class Table extends DescendantManager implements javax.accessibility.Acce
|
||||
return null;
|
||||
|
||||
try {
|
||||
XAccessibleText unoAccessibleText = (XAccessibleText)
|
||||
UnoRuntime.queryInterface(XAccessibleText.class, unoAccessibleContext);
|
||||
XAccessibleText unoAccessibleText = UnoRuntime.queryInterface(XAccessibleText.class, unoAccessibleContext);
|
||||
return (unoAccessibleText != null) ?
|
||||
new AccessibleTextImpl(unoAccessibleText) : null;
|
||||
} catch (com.sun.star.uno.RuntimeException e) {
|
||||
@@ -690,8 +687,7 @@ public class Table extends DescendantManager implements javax.accessibility.Acce
|
||||
/** Gets the AccessibleValue associated with this object that has a graphical representation */
|
||||
public javax.accessibility.AccessibleValue getAccessibleValue() {
|
||||
try {
|
||||
XAccessibleValue unoAccessibleValue = (XAccessibleValue)
|
||||
UnoRuntime.queryInterface(XAccessibleValue.class, unoAccessibleContext);
|
||||
XAccessibleValue unoAccessibleValue = UnoRuntime.queryInterface(XAccessibleValue.class, unoAccessibleContext);
|
||||
return (unoAccessibleValue != null) ?
|
||||
new AccessibleValueImpl(unoAccessibleValue) : null;
|
||||
} catch (com.sun.star.uno.RuntimeException e) {
|
||||
@@ -702,8 +698,7 @@ public class Table extends DescendantManager implements javax.accessibility.Acce
|
||||
/** Gets the AccessibleText associated with this object presenting text on the display */
|
||||
public javax.accessibility.AccessibleIcon[] getAccessibleIcon() {
|
||||
try {
|
||||
XAccessibleImage unoAccessibleImage = (XAccessibleImage)
|
||||
UnoRuntime.queryInterface(XAccessibleImage.class, unoAccessibleContext);
|
||||
XAccessibleImage unoAccessibleImage = UnoRuntime.queryInterface(XAccessibleImage.class, unoAccessibleContext);
|
||||
if (unoAccessibleImage != null) {
|
||||
javax.accessibility.AccessibleIcon[] icons = { new AccessibleIconImpl(unoAccessibleImage) };
|
||||
return icons;
|
||||
|
||||
@@ -86,8 +86,7 @@ public class TextComponent extends Component implements javax.accessibility.Acce
|
||||
return null;
|
||||
|
||||
try {
|
||||
XAccessibleText unoAccessibleText = (XAccessibleText)
|
||||
UnoRuntime.queryInterface(XAccessibleText.class,unoAccessibleComponent);
|
||||
XAccessibleText unoAccessibleText = UnoRuntime.queryInterface(XAccessibleText.class,unoAccessibleComponent);
|
||||
if (unoAccessibleText != null) {
|
||||
return new AccessibleTextImpl(unoAccessibleText);
|
||||
} else {
|
||||
@@ -101,8 +100,7 @@ public class TextComponent extends Component implements javax.accessibility.Acce
|
||||
/** Gets the AccessibleEditableText associated with this object presenting text on the display */
|
||||
public javax.accessibility.AccessibleEditableText getAccessibleEditableText() {
|
||||
try {
|
||||
XAccessibleEditableText unoAccessibleText = (XAccessibleEditableText)
|
||||
UnoRuntime.queryInterface(XAccessibleEditableText.class,unoAccessibleComponent);
|
||||
XAccessibleEditableText unoAccessibleText = UnoRuntime.queryInterface(XAccessibleEditableText.class,unoAccessibleComponent);
|
||||
if (unoAccessibleText != null) {
|
||||
return new AccessibleEditableTextImpl(unoAccessibleText);
|
||||
} else {
|
||||
@@ -116,8 +114,7 @@ public class TextComponent extends Component implements javax.accessibility.Acce
|
||||
/** Gets the AccessibleAction associated with this object that has a graphical representation */
|
||||
public javax.accessibility.AccessibleAction getAccessibleAction() {
|
||||
try {
|
||||
XAccessibleAction unoAccessibleAction = (XAccessibleAction)
|
||||
UnoRuntime.queryInterface(XAccessibleAction.class, unoAccessibleComponent);
|
||||
XAccessibleAction unoAccessibleAction = UnoRuntime.queryInterface(XAccessibleAction.class, unoAccessibleComponent);
|
||||
return (unoAccessibleAction != null) ?
|
||||
new AccessibleActionImpl(unoAccessibleAction) : null;
|
||||
} catch (com.sun.star.uno.RuntimeException e) {
|
||||
|
||||
@@ -40,7 +40,7 @@ class ToggleButton extends AbstractButton implements javax.accessibility.Accessi
|
||||
/** Gets the AccessibleValue associated with this object that has a graphical representation */
|
||||
public javax.accessibility.AccessibleValue getAccessibleValue() {
|
||||
try {
|
||||
XAccessibleValue unoAccessibleValue = (XAccessibleValue) UnoRuntime.queryInterface(XAccessibleValue.class,
|
||||
XAccessibleValue unoAccessibleValue = UnoRuntime.queryInterface(XAccessibleValue.class,
|
||||
unoAccessibleContext);
|
||||
|
||||
return (unoAccessibleValue != null)
|
||||
|
||||
@@ -54,7 +54,7 @@ public class ToolTip extends Component implements javax.accessibility.Accessible
|
||||
return null;
|
||||
|
||||
try {
|
||||
XAccessibleText unoAccessibleText = (XAccessibleText) UnoRuntime.queryInterface(XAccessibleText.class,
|
||||
XAccessibleText unoAccessibleText = UnoRuntime.queryInterface(XAccessibleText.class,
|
||||
unoAccessibleComponent);
|
||||
|
||||
if (unoAccessibleText != null) {
|
||||
|
||||
@@ -136,7 +136,7 @@ public class Tree extends DescendantManager implements javax.accessibility.Acces
|
||||
protected XAccessibleTable unoAccessibleTable;
|
||||
|
||||
public AccessibleTree() {
|
||||
unoAccessibleTable = (XAccessibleTable) UnoRuntime.queryInterface(XAccessibleTable.class, unoAccessibleContext);
|
||||
unoAccessibleTable = UnoRuntime.queryInterface(XAccessibleTable.class, unoAccessibleContext);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -467,9 +467,9 @@ public class Tree extends DescendantManager implements javax.accessibility.Acces
|
||||
|
||||
public Object[] create(Object[] targetSet) {
|
||||
try {
|
||||
java.util.ArrayList list = new java.util.ArrayList(targetSet.length);
|
||||
java.util.ArrayList<TreeItem> list = new java.util.ArrayList<TreeItem>(targetSet.length);
|
||||
for (int i=0; i < targetSet.length; i++) {
|
||||
XAccessible xAccessible = (XAccessible) UnoRuntime.queryInterface(
|
||||
XAccessible xAccessible = UnoRuntime.queryInterface(
|
||||
XAccessible.class, targetSet[i]);
|
||||
if (xAccessible != null) {
|
||||
list.add(new TreeItem(xAccessible));
|
||||
@@ -510,8 +510,7 @@ public class Tree extends DescendantManager implements javax.accessibility.Acces
|
||||
|
||||
public AccessibleTreeItem(XAccessibleContext xAccessibleContext) {
|
||||
unoAccessibleContext = xAccessibleContext;
|
||||
unoAccessibleSelection = (XAccessibleSelection)
|
||||
UnoRuntime.queryInterface(XAccessibleSelection.class, xAccessibleContext);
|
||||
unoAccessibleSelection = UnoRuntime.queryInterface(XAccessibleSelection.class, xAccessibleContext);
|
||||
}
|
||||
|
||||
/** Returns the accessible name of this object */
|
||||
@@ -614,8 +613,7 @@ public class Tree extends DescendantManager implements javax.accessibility.Acces
|
||||
/** Gets the AccessibleComponent associated with this object that has a graphical representation */
|
||||
public javax.accessibility.AccessibleComponent getAccessibleComponent() {
|
||||
try {
|
||||
XAccessibleComponent unoAccessibleComponent = (XAccessibleComponent)
|
||||
UnoRuntime.queryInterface(XAccessibleComponent.class, unoAccessibleContext);
|
||||
XAccessibleComponent unoAccessibleComponent = UnoRuntime.queryInterface(XAccessibleComponent.class, unoAccessibleContext);
|
||||
return (unoAccessibleComponent != null) ?
|
||||
new AccessibleComponentImpl(unoAccessibleComponent) : null;
|
||||
} catch (com.sun.star.uno.RuntimeException e) {
|
||||
@@ -631,8 +629,7 @@ public class Tree extends DescendantManager implements javax.accessibility.Acces
|
||||
/** Gets the AccessibleAction associated with this object that has a graphical representation */
|
||||
public javax.accessibility.AccessibleAction getAccessibleAction() {
|
||||
try {
|
||||
XAccessibleAction unoAccessibleAction = (XAccessibleAction)
|
||||
UnoRuntime.queryInterface(XAccessibleAction.class, unoAccessibleContext);
|
||||
XAccessibleAction unoAccessibleAction = UnoRuntime.queryInterface(XAccessibleAction.class, unoAccessibleContext);
|
||||
return (unoAccessibleAction != null) ?
|
||||
new AccessibleActionImpl(unoAccessibleAction) : null;
|
||||
} catch (com.sun.star.uno.RuntimeException e) {
|
||||
@@ -647,8 +644,7 @@ public class Tree extends DescendantManager implements javax.accessibility.Acces
|
||||
return null;
|
||||
|
||||
try {
|
||||
XAccessibleText unoAccessibleText = (XAccessibleText)
|
||||
UnoRuntime.queryInterface(XAccessibleText.class, unoAccessibleContext);
|
||||
XAccessibleText unoAccessibleText = UnoRuntime.queryInterface(XAccessibleText.class, unoAccessibleContext);
|
||||
return (unoAccessibleText != null) ?
|
||||
new AccessibleTextImpl(unoAccessibleText) : null;
|
||||
} catch (com.sun.star.uno.RuntimeException e) {
|
||||
@@ -659,8 +655,7 @@ public class Tree extends DescendantManager implements javax.accessibility.Acces
|
||||
/** Gets the AccessibleValue associated with this object that has a graphical representation */
|
||||
public javax.accessibility.AccessibleValue getAccessibleValue() {
|
||||
try {
|
||||
XAccessibleValue unoAccessibleValue = (XAccessibleValue)
|
||||
UnoRuntime.queryInterface(XAccessibleValue.class, unoAccessibleContext);
|
||||
XAccessibleValue unoAccessibleValue = UnoRuntime.queryInterface(XAccessibleValue.class, unoAccessibleContext);
|
||||
return (unoAccessibleValue != null) ?
|
||||
new AccessibleValueImpl(unoAccessibleValue) : null;
|
||||
} catch (com.sun.star.uno.RuntimeException e) {
|
||||
@@ -671,8 +666,7 @@ public class Tree extends DescendantManager implements javax.accessibility.Acces
|
||||
/** Gets the AccessibleText associated with this object presenting text on the display */
|
||||
public javax.accessibility.AccessibleIcon[] getAccessibleIcon() {
|
||||
try {
|
||||
XAccessibleImage unoAccessibleImage = (XAccessibleImage)
|
||||
UnoRuntime.queryInterface(XAccessibleImage.class, unoAccessibleContext);
|
||||
XAccessibleImage unoAccessibleImage = UnoRuntime.queryInterface(XAccessibleImage.class, unoAccessibleContext);
|
||||
if (unoAccessibleImage != null) {
|
||||
javax.accessibility.AccessibleIcon[] icons = { new AccessibleIconImpl(unoAccessibleImage) };
|
||||
return icons;
|
||||
|
||||
@@ -37,9 +37,8 @@ public class Window extends java.awt.Window implements javax.accessibility.Acces
|
||||
private void initialize(XAccessibleComponent xAccessibleComponent) {
|
||||
unoAccessibleComponent = xAccessibleComponent;
|
||||
eventQueue = java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue();
|
||||
XAccessibleEventBroadcaster broadcaster = (XAccessibleEventBroadcaster)
|
||||
UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class,
|
||||
unoAccessibleComponent);
|
||||
XAccessibleEventBroadcaster broadcaster = UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class,
|
||||
unoAccessibleComponent);
|
||||
if (broadcaster != null) {
|
||||
broadcaster.addEventListener(new AccessibleWindowListener());
|
||||
}
|
||||
|
||||
+5
-4
@@ -18,6 +18,8 @@
|
||||
|
||||
package org.openoffice.java.accessibility.logging;
|
||||
|
||||
import java.awt.Component;
|
||||
|
||||
import com.sun.star.accessibility.*;
|
||||
import com.sun.star.uno.*;
|
||||
|
||||
@@ -28,7 +30,7 @@ public class XAccessibleEventLog implements XAccessibleEventListener {
|
||||
|
||||
private static XAccessibleEventLog theEventListener = null;
|
||||
|
||||
private static java.util.Hashtable proxyList = new java.util.Hashtable();
|
||||
private static java.util.Hashtable<String, Component> proxyList = new java.util.Hashtable<String, Component>();
|
||||
|
||||
/** Creates a new instance of UNOAccessibleEventListener */
|
||||
public XAccessibleEventLog() {
|
||||
@@ -42,8 +44,7 @@ public class XAccessibleEventLog implements XAccessibleEventListener {
|
||||
}
|
||||
|
||||
public static void addEventListener(XAccessibleContext xac, java.awt.Component c) {
|
||||
XAccessibleEventBroadcaster broadcaster = (XAccessibleEventBroadcaster)
|
||||
UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class, xac);
|
||||
XAccessibleEventBroadcaster broadcaster = UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class, xac);
|
||||
if (broadcaster != null) {
|
||||
broadcaster.addEventListener(XAccessibleEventLog.get());
|
||||
|
||||
@@ -137,7 +138,7 @@ public class XAccessibleEventLog implements XAccessibleEventListener {
|
||||
}
|
||||
|
||||
protected static void logMessage(Object o, String s) {
|
||||
XAccessibleContext xac = (XAccessibleContext) UnoRuntime.queryInterface(XAccessibleContext.class, o);
|
||||
XAccessibleContext xac = UnoRuntime.queryInterface(XAccessibleContext.class, o);
|
||||
if( xac != null ) {
|
||||
String oid = UnoRuntime.generateOid(xac);
|
||||
synchronized (proxyList) {
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ public class XAccessibleTextLog
|
||||
private void setName(
|
||||
com.sun.star.accessibility.XAccessibleText xAccessibleText) {
|
||||
try {
|
||||
com.sun.star.accessibility.XAccessibleContext unoAccessibleContext = (com.sun.star.accessibility.XAccessibleContext) com.sun.star.uno.UnoRuntime.queryInterface(com.sun.star.accessibility.XAccessibleContext.class,
|
||||
com.sun.star.accessibility.XAccessibleContext unoAccessibleContext = com.sun.star.uno.UnoRuntime.queryInterface(com.sun.star.accessibility.XAccessibleContext.class,
|
||||
xAccessibleText);
|
||||
|
||||
if (unoAccessibleContext != null) {
|
||||
|
||||
@@ -110,8 +110,8 @@ public class LocalOfficeConnection
|
||||
UnoUrl aURL = UnoUrl.parseUnoUrl( url );
|
||||
mProgramPath = null;
|
||||
mConnType = aURL.getConnection();
|
||||
mPipe = (String) aURL.getConnectionParameters().get( "pipe" );
|
||||
mPort = (String) aURL.getConnectionParameters().get( "port" );
|
||||
mPipe = aURL.getConnectionParameters().get( "pipe" );
|
||||
mPort = aURL.getConnectionParameters().get( "port" );
|
||||
mProtocol = aURL.getProtocol();
|
||||
mInitialObject = aURL.getRootOid();
|
||||
}
|
||||
@@ -221,7 +221,7 @@ public class LocalOfficeConnection
|
||||
|
||||
// query for the XUnoUrlResolver interface
|
||||
XUnoUrlResolver xUrlResolver =
|
||||
(XUnoUrlResolver) UnoRuntime.queryInterface( XUnoUrlResolver.class, urlResolver );
|
||||
UnoRuntime.queryInterface( XUnoUrlResolver.class, urlResolver );
|
||||
|
||||
// try to connect to soffice
|
||||
Object aInitialObject = null;
|
||||
@@ -261,10 +261,9 @@ public class LocalOfficeConnection
|
||||
// XComponentContext
|
||||
if( null != aInitialObject )
|
||||
{
|
||||
XPropertySet xPropertySet = (XPropertySet)
|
||||
UnoRuntime.queryInterface( XPropertySet.class, aInitialObject);
|
||||
XPropertySet xPropertySet = UnoRuntime.queryInterface( XPropertySet.class, aInitialObject);
|
||||
Object xContext = xPropertySet.getPropertyValue("DefaultContext");
|
||||
XComponentContext xComponentContext = (XComponentContext) UnoRuntime.queryInterface(
|
||||
XComponentContext xComponentContext = UnoRuntime.queryInterface(
|
||||
XComponentContext.class, xContext);
|
||||
return xComponentContext;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public class LocalOfficeWindow
|
||||
/* package */ LocalOfficeWindow(OfficeConnection connection)
|
||||
{
|
||||
mConnection = connection;
|
||||
mConnection.addEventListener((XEventListener)this);
|
||||
mConnection.addEventListener(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,10 +109,10 @@ public class LocalOfficeWindow
|
||||
{
|
||||
compfactory = mConnection.getComponentContext().getServiceManager();
|
||||
XMultiServiceFactory factory;
|
||||
factory = (XMultiServiceFactory)UnoRuntime.queryInterface(
|
||||
factory = UnoRuntime.queryInterface(
|
||||
XMultiServiceFactory.class, compfactory);
|
||||
Object object = factory.createInstance( "com.sun.star.awt.Toolkit");
|
||||
return (XToolkit)UnoRuntime.queryInterface(XToolkit.class, object);
|
||||
return UnoRuntime.queryInterface(XToolkit.class, object);
|
||||
}
|
||||
else
|
||||
return null;
|
||||
@@ -124,13 +124,13 @@ public class LocalOfficeWindow
|
||||
if ( !bPeer )
|
||||
{
|
||||
// set real parent
|
||||
XVclWindowPeer xVclWindowPeer = (XVclWindowPeer)UnoRuntime.queryInterface(
|
||||
XVclWindowPeer xVclWindowPeer = UnoRuntime.queryInterface(
|
||||
XVclWindowPeer.class, mWindow);
|
||||
xVclWindowPeer.setProperty( "PluginParent", new Long(getNativeWindow()) );
|
||||
bPeer = true;
|
||||
|
||||
// show document window
|
||||
XWindow aWindow = (XWindow)UnoRuntime.queryInterface(XWindow.class, mWindow);
|
||||
XWindow aWindow = UnoRuntime.queryInterface(XWindow.class, mWindow);
|
||||
aWindow.setVisible( true );
|
||||
}
|
||||
}
|
||||
@@ -141,11 +141,11 @@ public class LocalOfficeWindow
|
||||
if ( bPeer )
|
||||
{
|
||||
// hide document window
|
||||
XWindow aWindow = (XWindow)UnoRuntime.queryInterface(XWindow.class, mWindow);
|
||||
XWindow aWindow = UnoRuntime.queryInterface(XWindow.class, mWindow);
|
||||
aWindow.setVisible( false );
|
||||
|
||||
// set null parent
|
||||
XVclWindowPeer xVclWindowPeer = (XVclWindowPeer)UnoRuntime.queryInterface(
|
||||
XVclWindowPeer xVclWindowPeer = UnoRuntime.queryInterface(
|
||||
XVclWindowPeer.class, mWindow);
|
||||
xVclWindowPeer.setProperty( "PluginParent", new Long(0) );
|
||||
bPeer = false;
|
||||
@@ -228,7 +228,7 @@ public class LocalOfficeWindow
|
||||
addComponentListener( new ComponentEventHandler() );
|
||||
|
||||
// set initial visibility
|
||||
XWindow aWindow = (XWindow)UnoRuntime.queryInterface(XWindow.class, mWindow);
|
||||
XWindow aWindow = UnoRuntime.queryInterface(XWindow.class, mWindow);
|
||||
aWindow.setVisible( bPeer );
|
||||
}
|
||||
catch (com.sun.star.uno.Exception exp) {
|
||||
|
||||
@@ -36,9 +36,8 @@ public class Controller
|
||||
{
|
||||
super( xController );
|
||||
this.xController = xController;
|
||||
xDispatchProvider = (com.sun.star.frame.XDispatchProvider)
|
||||
UnoRuntime.queryInterface( com.sun.star.frame.XDispatchProvider.class,
|
||||
xController );
|
||||
xDispatchProvider = UnoRuntime.queryInterface( com.sun.star.frame.XDispatchProvider.class,
|
||||
xController );
|
||||
}
|
||||
|
||||
//==============================================================
|
||||
|
||||
@@ -39,12 +39,10 @@ public class Frame
|
||||
{
|
||||
super( xFrame );
|
||||
this.xFrame = xFrame;
|
||||
xDispatchProvider = (com.sun.star.frame.XDispatchProvider)
|
||||
UnoRuntime.queryInterface( com.sun.star.frame.XDispatchProvider.class,
|
||||
xFrame );
|
||||
xDispatchProviderInterception = (com.sun.star.frame.XDispatchProviderInterception)
|
||||
UnoRuntime.queryInterface( com.sun.star.frame.XDispatchProviderInterception.class,
|
||||
xFrame );
|
||||
xDispatchProvider = UnoRuntime.queryInterface( com.sun.star.frame.XDispatchProvider.class,
|
||||
xFrame );
|
||||
xDispatchProviderInterception = UnoRuntime.queryInterface( com.sun.star.frame.XDispatchProviderInterception.class,
|
||||
xFrame );
|
||||
}
|
||||
|
||||
//==============================================================
|
||||
|
||||
@@ -176,8 +176,8 @@ public class LocalOfficeConnection
|
||||
{
|
||||
UnoUrl aURL = UnoUrl.parseUnoUrl( url );
|
||||
mConnType = aURL.getConnection();
|
||||
mPipe = (String) aURL.getConnectionParameters().get( "pipe" );
|
||||
mPort = (String) aURL.getConnectionParameters().get( "port" );
|
||||
mPipe = aURL.getConnectionParameters().get( "pipe" );
|
||||
mPort = aURL.getConnectionParameters().get( "port" );
|
||||
mProtocol = aURL.getProtocol();
|
||||
mInitialObject = aURL.getRootOid();
|
||||
}
|
||||
@@ -251,7 +251,7 @@ public class LocalOfficeConnection
|
||||
//to the office including the bridge needs to be terminated.
|
||||
if (mBridge != null)
|
||||
{
|
||||
XComponent comp = (XComponent)UnoRuntime.queryInterface(
|
||||
XComponent comp = UnoRuntime.queryInterface(
|
||||
XComponent.class, mBridge);
|
||||
if (comp != null)
|
||||
comp.dispose();
|
||||
@@ -337,10 +337,9 @@ public class LocalOfficeConnection
|
||||
// XComponentContext
|
||||
if( null != aInitialObject )
|
||||
{
|
||||
XPropertySet xPropertySet = (XPropertySet)
|
||||
UnoRuntime.queryInterface( XPropertySet.class, aInitialObject);
|
||||
XPropertySet xPropertySet = UnoRuntime.queryInterface( XPropertySet.class, aInitialObject);
|
||||
Object xContext = xPropertySet.getPropertyValue("DefaultContext");
|
||||
XComponentContext xComponentContext = (XComponentContext) UnoRuntime.queryInterface(
|
||||
XComponentContext xComponentContext = UnoRuntime.queryInterface(
|
||||
XComponentContext.class, xContext);
|
||||
return xComponentContext;
|
||||
}
|
||||
@@ -419,7 +418,7 @@ public class LocalOfficeConnection
|
||||
|
||||
XMultiComponentFactory xLocalServiceManager = xLocalContext.getServiceManager();
|
||||
try {
|
||||
xBridgeFactory = (XBridgeFactory)UnoRuntime.queryInterface(
|
||||
xBridgeFactory = UnoRuntime.queryInterface(
|
||||
XBridgeFactory.class,
|
||||
xLocalServiceManager.createInstanceWithContext(
|
||||
"com.sun.star.bridge.BridgeFactory", xLocalContext));
|
||||
@@ -435,7 +434,7 @@ public class LocalOfficeConnection
|
||||
} catch (com.sun.star.uno.Exception e) {
|
||||
throw new com.sun.star.uno.RuntimeException(e.getMessage());
|
||||
}
|
||||
XConnector connector_xConnector = (XConnector)UnoRuntime.queryInterface(XConnector.class, connector);
|
||||
XConnector connector_xConnector = UnoRuntime.queryInterface(XConnector.class, connector);
|
||||
// connect to the server
|
||||
XConnection xConnection = connector_xConnector.connect(conDcp);
|
||||
// create the bridge name. This should not be necessary if we pass an
|
||||
|
||||
@@ -62,7 +62,7 @@ public class LocalOfficeWindow
|
||||
protected LocalOfficeWindow(OfficeConnection connection)
|
||||
{
|
||||
mConnection = connection;
|
||||
mConnection.addEventListener((XEventListener)this);
|
||||
mConnection.addEventListener(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,10 +113,10 @@ public class LocalOfficeWindow
|
||||
{
|
||||
compfactory = mConnection.getComponentContext().getServiceManager();
|
||||
XMultiServiceFactory factory;
|
||||
factory = (XMultiServiceFactory)UnoRuntime.queryInterface(
|
||||
factory = UnoRuntime.queryInterface(
|
||||
XMultiServiceFactory.class, compfactory);
|
||||
Object object = factory.createInstance( "com.sun.star.awt.Toolkit");
|
||||
return (XToolkit)UnoRuntime.queryInterface(XToolkit.class, object);
|
||||
return UnoRuntime.queryInterface(XToolkit.class, object);
|
||||
}
|
||||
else
|
||||
return null;
|
||||
@@ -128,13 +128,13 @@ public class LocalOfficeWindow
|
||||
if ( !bPeer )
|
||||
{
|
||||
// set real parent
|
||||
XVclWindowPeer xVclWindowPeer = (XVclWindowPeer)UnoRuntime.queryInterface(
|
||||
XVclWindowPeer xVclWindowPeer = UnoRuntime.queryInterface(
|
||||
XVclWindowPeer.class, mWindow);
|
||||
|
||||
xVclWindowPeer.setProperty( "PluginParent", getWrappedWindowHandle());
|
||||
bPeer = true;
|
||||
// show document window
|
||||
XWindow aWindow = (XWindow)UnoRuntime.queryInterface(XWindow.class, mWindow);
|
||||
XWindow aWindow = UnoRuntime.queryInterface(XWindow.class, mWindow);
|
||||
aWindow.setVisible( true );
|
||||
}
|
||||
}
|
||||
@@ -145,11 +145,11 @@ public class LocalOfficeWindow
|
||||
if ( bPeer )
|
||||
{
|
||||
// hide document window
|
||||
XWindow aWindow = (XWindow)UnoRuntime.queryInterface(XWindow.class, mWindow);
|
||||
XWindow aWindow = UnoRuntime.queryInterface(XWindow.class, mWindow);
|
||||
aWindow.setVisible( false );
|
||||
|
||||
// set null parent
|
||||
XVclWindowPeer xVclWindowPeer = (XVclWindowPeer)UnoRuntime.queryInterface(
|
||||
XVclWindowPeer xVclWindowPeer = UnoRuntime.queryInterface(
|
||||
XVclWindowPeer.class, mWindow);
|
||||
xVclWindowPeer.setProperty( "PluginParent", new Long(0) );
|
||||
bPeer = false;
|
||||
@@ -209,7 +209,7 @@ public class LocalOfficeWindow
|
||||
|
||||
|
||||
// set initial visibility
|
||||
XWindow aWindow = (XWindow)UnoRuntime.queryInterface(XWindow.class, mWindow);
|
||||
XWindow aWindow = UnoRuntime.queryInterface(XWindow.class, mWindow);
|
||||
aWindow.setVisible( bPeer );
|
||||
}
|
||||
catch (com.sun.star.uno.Exception exp) {
|
||||
|
||||
@@ -295,9 +295,8 @@ public class OOoBean
|
||||
{
|
||||
com.sun.star.lang.XMultiComponentFactory aFactory =
|
||||
iConn.getComponentContext().getServiceManager();
|
||||
xServiceFactory = (com.sun.star.lang.XMultiServiceFactory)
|
||||
UnoRuntime.queryInterface(
|
||||
com.sun.star.lang.XMultiServiceFactory.class, aFactory );
|
||||
xServiceFactory = UnoRuntime.queryInterface(
|
||||
com.sun.star.lang.XMultiServiceFactory.class, aFactory );
|
||||
}
|
||||
};
|
||||
aConnectorThread.start();
|
||||
@@ -324,7 +323,7 @@ public class OOoBean
|
||||
try
|
||||
{
|
||||
Object aObject = getMultiServiceFactory().createInstance( "com.sun.star.frame.Desktop");
|
||||
xDesktop = (com.sun.star.frame.XDesktop) UnoRuntime.queryInterface(
|
||||
xDesktop = UnoRuntime.queryInterface(
|
||||
com.sun.star.frame.XDesktop.class, aObject );
|
||||
}
|
||||
catch ( com.sun.star.uno.Exception aExc )
|
||||
@@ -381,8 +380,7 @@ public class OOoBean
|
||||
new CallWatchThread( nOOoCallTimeOut, "clear" );
|
||||
//By closing the frame we avoid that dialogs are displayed, for example when
|
||||
//the document is modified.
|
||||
com.sun.star.util.XCloseable xCloseable = (com.sun.star.util.XCloseable)
|
||||
UnoRuntime.queryInterface( com.sun.star.util.XCloseable.class, aFrame );
|
||||
com.sun.star.util.XCloseable xCloseable = UnoRuntime.queryInterface( com.sun.star.util.XCloseable.class, aFrame );
|
||||
if ( xCloseable != null )
|
||||
{
|
||||
try
|
||||
@@ -415,9 +413,8 @@ public class OOoBean
|
||||
{
|
||||
try
|
||||
{
|
||||
com.sun.star.lang.XComponent xComp = (com.sun.star.lang.XComponent)
|
||||
UnoRuntime.queryInterface(
|
||||
com.sun.star.lang.XComponent.class, xURLTransformer );
|
||||
com.sun.star.lang.XComponent xComp = UnoRuntime.queryInterface(
|
||||
com.sun.star.lang.XComponent.class, xURLTransformer );
|
||||
if ( xComp != null )
|
||||
xComp.dispose();
|
||||
}
|
||||
@@ -573,23 +570,23 @@ public class OOoBean
|
||||
{
|
||||
// create the frame
|
||||
com.sun.star.awt.XWindow xWindow =
|
||||
(com.sun.star.awt.XWindow) UnoRuntime.queryInterface(
|
||||
com.sun.star.awt.XWindow.class, xFrameWindow.getUNOWindowPeer());
|
||||
UnoRuntime.queryInterface(
|
||||
com.sun.star.awt.XWindow.class, xFrameWindow.getUNOWindowPeer());
|
||||
Object xFrame = xServiceFactory.createInstance( "com.sun.star.frame.Frame");
|
||||
aFrame = new Frame( (com.sun.star.frame.XFrame)UnoRuntime.queryInterface(
|
||||
aFrame = new Frame( UnoRuntime.queryInterface(
|
||||
com.sun.star.frame.XFrame.class, xFrame ) );
|
||||
aFrame.initialize( xWindow );
|
||||
aFrame.setName( aFrame.toString() );
|
||||
|
||||
// register the frame at the desktop
|
||||
com.sun.star.frame.XFrames xFrames =
|
||||
( (com.sun.star.frame.XFramesSupplier)UnoRuntime.queryInterface(
|
||||
com.sun.star.frame.XFramesSupplier.class, getOOoDesktop() ) ).getFrames();
|
||||
UnoRuntime.queryInterface(
|
||||
com.sun.star.frame.XFramesSupplier.class, getOOoDesktop() ).getFrames();
|
||||
xFrames.append( aFrame );
|
||||
}
|
||||
|
||||
// Initializes the slot command execution environment.
|
||||
xURLTransformer = (com.sun.star.util.XURLTransformer) UnoRuntime.queryInterface(
|
||||
xURLTransformer = UnoRuntime.queryInterface(
|
||||
com.sun.star.util.XURLTransformer.class,
|
||||
xServiceFactory.createInstance( "com.sun.star.util.URLTransformer") );
|
||||
|
||||
@@ -603,8 +600,7 @@ public class OOoBean
|
||||
}
|
||||
|
||||
// get XComponentLoader from frame
|
||||
com.sun.star.frame.XComponentLoader xLoader = (com.sun.star.frame.XComponentLoader)
|
||||
UnoRuntime.queryInterface( com.sun.star.frame.XComponentLoader.class, aFrame );
|
||||
com.sun.star.frame.XComponentLoader xLoader = UnoRuntime.queryInterface( com.sun.star.frame.XComponentLoader.class, aFrame );
|
||||
if ( xLoader == null )
|
||||
{
|
||||
throw new java.lang.RuntimeException(
|
||||
@@ -668,7 +664,7 @@ public class OOoBean
|
||||
|
||||
// Get document's XModifiable interface if any.
|
||||
aDocument = new OfficeDocument(
|
||||
(com.sun.star.frame.XModel) UnoRuntime.queryInterface(
|
||||
UnoRuntime.queryInterface(
|
||||
com.sun.star.frame.XModel.class, xComponent ) );
|
||||
bLoaded = true;
|
||||
}
|
||||
@@ -1088,12 +1084,12 @@ xLayoutManager.showElement("private:resource/menubar/menubar");
|
||||
try
|
||||
{
|
||||
com.sun.star.beans.XPropertySet xPropSet =
|
||||
(com.sun.star.beans.XPropertySet) UnoRuntime.queryInterface(
|
||||
com.sun.star.beans.XPropertySet.class, aFrame );
|
||||
UnoRuntime.queryInterface(
|
||||
com.sun.star.beans.XPropertySet.class, aFrame );
|
||||
com.sun.star.frame.XLayoutManager xLayoutManager =
|
||||
(com.sun.star.frame.XLayoutManager) UnoRuntime.queryInterface(
|
||||
com.sun.star.frame.XLayoutManager.class,
|
||||
xPropSet.getPropertyValue( "LayoutManager" ) );
|
||||
UnoRuntime.queryInterface(
|
||||
com.sun.star.frame.XLayoutManager.class,
|
||||
xPropSet.getPropertyValue( "LayoutManager" ) );
|
||||
if ( bNewValue )
|
||||
xLayoutManager.showElement( aResourceURL );
|
||||
else
|
||||
|
||||
@@ -47,15 +47,12 @@ public class OfficeDocument extends Wrapper
|
||||
super( xModel );
|
||||
|
||||
this.xModel = xModel;
|
||||
this.xModifiable = (com.sun.star.util.XModifiable)
|
||||
UnoRuntime.queryInterface(
|
||||
com.sun.star.util.XModifiable.class, xModel );
|
||||
this.xPrintable = (com.sun.star.view.XPrintable)
|
||||
UnoRuntime.queryInterface(
|
||||
com.sun.star.view.XPrintable.class, xModel );
|
||||
this.xStorable = (com.sun.star.frame.XStorable)
|
||||
UnoRuntime.queryInterface(
|
||||
com.sun.star.frame.XStorable.class, xModel );
|
||||
this.xModifiable = UnoRuntime.queryInterface(
|
||||
com.sun.star.util.XModifiable.class, xModel );
|
||||
this.xPrintable = UnoRuntime.queryInterface(
|
||||
com.sun.star.view.XPrintable.class, xModel );
|
||||
this.xStorable = UnoRuntime.queryInterface(
|
||||
com.sun.star.frame.XStorable.class, xModel );
|
||||
}
|
||||
|
||||
//==========================================================
|
||||
|
||||
@@ -51,9 +51,8 @@ class Wrapper
|
||||
public Wrapper( com.sun.star.uno.XInterface xProxy )
|
||||
{
|
||||
xQueryInterface = (com.sun.star.uno.IQueryInterface) xProxy;
|
||||
xComponent = (com.sun.star.lang.XComponent)
|
||||
UnoRuntime.queryInterface(
|
||||
com.sun.star.lang.XComponent.class, xProxy );
|
||||
xComponent = UnoRuntime.queryInterface(
|
||||
com.sun.star.lang.XComponent.class, xProxy );
|
||||
}
|
||||
|
||||
//==============================================================
|
||||
|
||||
@@ -95,7 +95,7 @@ public class OOoBeanTest
|
||||
|
||||
private String getText(OOoBean bean) throws Exception
|
||||
{
|
||||
com.sun.star.frame.XModel model = (com.sun.star.frame.XModel)bean.getDocument();
|
||||
com.sun.star.frame.XModel model = bean.getDocument();
|
||||
com.sun.star.text.XTextDocument myDoc =
|
||||
UnoRuntime.queryInterface(com.sun.star.text.XTextDocument.class, model);
|
||||
com.sun.star.text.XText xText = myDoc.getText();
|
||||
|
||||
@@ -77,7 +77,7 @@ class WriterFrame extends java.awt.Frame
|
||||
|
||||
public void setText(String s) throws Exception
|
||||
{
|
||||
com.sun.star.frame.XModel model = (com.sun.star.frame.XModel)m_bean.getDocument();
|
||||
com.sun.star.frame.XModel model = m_bean.getDocument();
|
||||
com.sun.star.text.XTextDocument myDoc =
|
||||
UnoRuntime.queryInterface(com.sun.star.text.XTextDocument.class, model);
|
||||
com.sun.star.text.XText xText = myDoc.getText();
|
||||
@@ -88,7 +88,7 @@ class WriterFrame extends java.awt.Frame
|
||||
|
||||
public String getText() throws Exception
|
||||
{
|
||||
com.sun.star.frame.XModel model = (com.sun.star.frame.XModel)m_bean.getDocument();
|
||||
com.sun.star.frame.XModel model = m_bean.getDocument();
|
||||
com.sun.star.text.XTextDocument myDoc =
|
||||
UnoRuntime.queryInterface(com.sun.star.text.XTextDocument.class, model);
|
||||
com.sun.star.text.XText xText = myDoc.getText();
|
||||
@@ -112,7 +112,7 @@ class WriterFrame extends java.awt.Frame
|
||||
*/
|
||||
public void goToStart() throws Exception
|
||||
{
|
||||
com.sun.star.frame.XModel xModel = (com.sun.star.frame.XModel)m_bean.getDocument();
|
||||
com.sun.star.frame.XModel xModel = m_bean.getDocument();
|
||||
com.sun.star.frame.XController xController = xModel.getCurrentController();
|
||||
|
||||
com.sun.star.text.XTextViewCursorSupplier xVCSupplier =
|
||||
@@ -125,7 +125,7 @@ class WriterFrame extends java.awt.Frame
|
||||
|
||||
public void pageDown() throws Exception
|
||||
{
|
||||
com.sun.star.frame.XModel xModel = (com.sun.star.frame.XModel)m_bean.getDocument();
|
||||
com.sun.star.frame.XModel xModel = m_bean.getDocument();
|
||||
com.sun.star.frame.XController xController = xModel.getCurrentController();
|
||||
|
||||
com.sun.star.text.XTextViewCursorSupplier xVCSupplier =
|
||||
|
||||
@@ -27,9 +27,10 @@ import java.io.*;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Iterator;
|
||||
import java.util.HashMap;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.Vector;
|
||||
import java.util.ArrayList;
|
||||
import lib.TestParameters;
|
||||
import share.LogWriter;
|
||||
import util.utils;
|
||||
@@ -43,10 +44,10 @@ public class Helper {
|
||||
|
||||
/** The runner log writer
|
||||
* @member m_log for log purposes
|
||||
* @member m_sTestDocPath directory for seraching files to load
|
||||
* @member m_vFiles list of all files describet in "files.csv"
|
||||
* @member m_hFileURLs contains the postition of a file name in the m_vFiles Vector
|
||||
* @member m_hFileTypes contains the postition of a file type in the m_vFiles Vector
|
||||
* @member m_sTestDocPath directory for searching files to load
|
||||
* @member m_vFiles list of all files described in "files.csv"
|
||||
* @member m_hFileURLs contains the position of a file name in the m_vFiles Vector
|
||||
* @member m_hFileTypes contains the position of a file type in the m_vFiles Vector
|
||||
* @member m_param the test parameters
|
||||
*/
|
||||
|
||||
@@ -54,11 +55,11 @@ public class Helper {
|
||||
|
||||
String m_sTestDocPath = null;
|
||||
|
||||
Vector m_vFiles = null;
|
||||
ArrayList<ArrayList<String>> m_vFiles = null;
|
||||
|
||||
Hashtable m_hFileURLs = new Hashtable();
|
||||
HashMap<String,String> m_hFileURLs = new HashMap<String,String>();
|
||||
|
||||
Hashtable m_hFileTypes = new Hashtable();
|
||||
HashMap<String,String> m_hFileTypes = new HashMap<String,String>();
|
||||
|
||||
TestParameters m_param = null;
|
||||
|
||||
@@ -89,22 +90,22 @@ public class Helper {
|
||||
|
||||
|
||||
/** Reads a comma separated file (CSV). Every line of the file is
|
||||
* repesented by an <code>Vector</code> entry. Every data entry of a row is
|
||||
* represented by an <code>Vector</code> entry. Every data entry of a row is
|
||||
* also stored in a <code>Vector</code>. So the returned value is a
|
||||
* <code>Vector[][]</code> where the first dimension represents a row
|
||||
* and the second dimenesion inclueds the data values.
|
||||
* and the second dimension includes the data values.
|
||||
* @param csvFileName the name of the csv file
|
||||
* @return Vector filled with Vector filled with data of a row
|
||||
*/
|
||||
public Vector getToDoList(String csvFileName){
|
||||
public ArrayList<ArrayList<String>> getToDoList(String csvFileName){
|
||||
|
||||
try {
|
||||
|
||||
Vector vAll = new Vector();
|
||||
Vector vFields = new Vector();
|
||||
ArrayList<ArrayList<String>> vAll = new ArrayList<ArrayList<String>>();
|
||||
ArrayList<String> vFields = new ArrayList<String>();
|
||||
|
||||
// get content of file
|
||||
Vector content = getCSVFileContent(csvFileName);
|
||||
ArrayList<String> content = getCSVFileContent(csvFileName);
|
||||
|
||||
// remove superfluous content like "#" started lines
|
||||
content = removeSuperfluousContent(content);
|
||||
@@ -113,24 +114,24 @@ public class Helper {
|
||||
content = replacePlaceHolder(content);
|
||||
|
||||
// create Enumeration
|
||||
Enumeration contentEnum = content.elements();
|
||||
Iterator<String> contentEnum = content.iterator();
|
||||
|
||||
// the first line contains field names of the columns
|
||||
// split line by ";"
|
||||
StringTokenizer fields = new StringTokenizer(
|
||||
contentEnum.nextElement().toString(),";");
|
||||
contentEnum.next(),";");
|
||||
int fieldCount = 0;
|
||||
while (fields.hasMoreElements()){
|
||||
vFields.add(fields.nextElement());
|
||||
vFields.add(fields.nextToken());
|
||||
fieldCount++;
|
||||
}
|
||||
|
||||
// fill vData with data of CSV-row
|
||||
while (contentEnum.hasMoreElements()){
|
||||
Vector vData = new Vector();
|
||||
while (contentEnum.hasNext()){
|
||||
ArrayList<String> vData = new ArrayList<String>();
|
||||
|
||||
StringTokenizer data = new StringTokenizer(
|
||||
contentEnum.nextElement().toString(),";", true);
|
||||
contentEnum.next(),";", true);
|
||||
|
||||
// example: data = "firstData;secondData;;forthData"
|
||||
// => three tokens => missing one data because the imagine
|
||||
@@ -139,7 +140,7 @@ public class Helper {
|
||||
boolean nextIsData = false;
|
||||
int dataCount = 0;
|
||||
while (data.hasMoreTokens()) {
|
||||
Object myToken = data.nextToken();
|
||||
String myToken = data.nextToken();
|
||||
// if the "thirdData" will be recieved, myToken=";" but
|
||||
// vData must add an empty String
|
||||
if (myToken.equals(";")){
|
||||
@@ -176,9 +177,9 @@ public class Helper {
|
||||
* cannot be read
|
||||
*/
|
||||
|
||||
public Vector getCSVFileContent(String csvFileName) {
|
||||
public ArrayList<String> getCSVFileContent(String csvFileName) {
|
||||
try {
|
||||
Vector content = new Vector();
|
||||
ArrayList<String> content = new ArrayList<String>();
|
||||
BufferedReader br;
|
||||
String line;
|
||||
if ( m_param.DebugIsActive ) {
|
||||
@@ -194,7 +195,7 @@ public class Helper {
|
||||
br = new BufferedReader(new InputStreamReader(in));
|
||||
try {
|
||||
while( ( line = br.readLine() ) != null ) {
|
||||
content.addElement( line );
|
||||
content.add( line );
|
||||
}
|
||||
} catch (IOException e) {
|
||||
br.close();
|
||||
@@ -230,34 +231,34 @@ public class Helper {
|
||||
* @param content the content of a csv file
|
||||
* @return changed file content
|
||||
*/
|
||||
private Vector replacePlaceHolder(Vector content){
|
||||
private ArrayList<String> replacePlaceHolder(ArrayList<String> content){
|
||||
|
||||
Vector vReturn = new Vector();
|
||||
ArrayList<String> vReturn = new ArrayList<String>();
|
||||
|
||||
Vector placeHolders = new Vector();
|
||||
Enumeration m_params = m_param.keys();
|
||||
ArrayList<String> placeHolders = new ArrayList<String>();
|
||||
Iterator<String> m_params = m_param.keySet().iterator();
|
||||
String placeHolder = (String)m_param.get("placeHolder");
|
||||
|
||||
// get all place holdes from typeDetection.csv
|
||||
while (m_params.hasMoreElements()){
|
||||
String holderKey = (String) m_params.nextElement();
|
||||
// get all place holders from typeDetection.csv
|
||||
while (m_params.hasNext()){
|
||||
String holderKey = m_params.next();
|
||||
if (holderKey.startsWith(placeHolder)){
|
||||
placeHolders.add(holderKey);
|
||||
}
|
||||
}
|
||||
|
||||
// replace all occurrences of place holders in 'CSVData'
|
||||
Enumeration cont = content.elements();
|
||||
Iterator<String> cont = content.iterator();
|
||||
|
||||
while( cont.hasMoreElements() ) {
|
||||
while( cont.hasNext() ) {
|
||||
|
||||
String line = (String) cont.nextElement();
|
||||
String line = cont.next();
|
||||
String newLine = line;
|
||||
Enumeration holders = placeHolders.elements();
|
||||
Iterator<String> holders = placeHolders.iterator();
|
||||
|
||||
while( holders.hasMoreElements() ) {
|
||||
while( holders.hasNext() ) {
|
||||
|
||||
String holder = (String) holders.nextElement();
|
||||
String holder = holders.next();
|
||||
int startPos = line.indexOf(holder);
|
||||
|
||||
if (startPos > -1){
|
||||
@@ -280,29 +281,25 @@ public class Helper {
|
||||
|
||||
/** Removes lines of an ascii file content which starts with "#"
|
||||
* or are empty
|
||||
* @param content content of a csv fiöe
|
||||
* @param content content of a csv file
|
||||
* @return a stripped Vector
|
||||
*/
|
||||
public Vector removeSuperfluousContent(Vector content){
|
||||
try{
|
||||
Vector newContent = new Vector();
|
||||
Enumeration cont = content.elements();
|
||||
while( cont.hasMoreElements() ) {
|
||||
String line = (String) cont.nextElement();
|
||||
if (( ! line.startsWith( "#" ))&& ( line.length() != 0 )) {
|
||||
newContent.addElement( line );
|
||||
}
|
||||
}
|
||||
return newContent;
|
||||
} catch (ClassCastException e){
|
||||
return null;
|
||||
public ArrayList<String> removeSuperfluousContent(ArrayList<String> content){
|
||||
ArrayList<String> newContent = new ArrayList<String>();
|
||||
Iterator<String> cont = content.iterator();
|
||||
while( cont.hasNext() ) {
|
||||
String line = cont.next();
|
||||
if (( ! line.startsWith( "#" ))&& ( line.length() != 0 )) {
|
||||
newContent.add( line );
|
||||
}
|
||||
}
|
||||
return newContent;
|
||||
}
|
||||
|
||||
/** returns a <code>MediaDescripto</code> filled with given properties and
|
||||
* values.
|
||||
* @param propNames String Array of propertie names
|
||||
* @param values Objecr Array of propertie values
|
||||
* @param propNames String Array of property names
|
||||
* @param values Object Array of property values
|
||||
* @return <code>PropertyValue[]<code>
|
||||
* @see com.sun.star.beans.PropertyValue
|
||||
* @see com.sun.star.document.MediaDescriptor
|
||||
@@ -342,7 +339,7 @@ public class Helper {
|
||||
public String getURLforfileAlias(String fileAlias)
|
||||
throws FileAliasNotFoundException{
|
||||
try{
|
||||
String fileURL = (String) m_hFileURLs.get(fileAlias).toString();
|
||||
String fileURL = m_hFileURLs.get(fileAlias).toString();
|
||||
return utils.getFullURL(ensureEndingFileSep(m_sTestDocPath) + fileURL);
|
||||
} catch (java.lang.NullPointerException e){
|
||||
throw new FileAliasNotFoundException(fileAlias);
|
||||
@@ -358,25 +355,23 @@ public class Helper {
|
||||
public String getTypeforfileAlias(String fileAlias)
|
||||
throws FileAliasNotFoundException{
|
||||
try{
|
||||
return (String) m_hFileTypes.get(fileAlias).toString();
|
||||
return m_hFileTypes.get(fileAlias).toString();
|
||||
} catch (java.lang.NullPointerException e){
|
||||
throw new FileAliasNotFoundException(fileAlias);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filles the Hashtable m_hFileURLs with all file names and their URL
|
||||
* and the Hashtable m_hFilesTypes with all file names and thier file
|
||||
* typ name. This informations are extracted from "files.csv"
|
||||
* This is for faster acccess to get fileURL and fileType of fileAlias
|
||||
* Fills the Hashtable m_hFileURLs with all file names and their URL
|
||||
* and the Hashtable m_hFilesTypes with all file names and their file
|
||||
* type name. This informations are extracted from "files.csv"
|
||||
* This is for faster access to get fileURL and fileType of fileAlias
|
||||
*/
|
||||
public void createFilesList(){
|
||||
for (int i = 0; i < m_vFiles.size();i++){
|
||||
Vector toDo = (Vector) m_vFiles.get(i);
|
||||
m_hFileURLs.put((String) toDo.get(0).toString(),
|
||||
(String) toDo.get(1).toString());
|
||||
m_hFileTypes.put((String) toDo.get(0).toString(),
|
||||
(String) toDo.get(2).toString());
|
||||
ArrayList<String> toDo = m_vFiles.get(i);
|
||||
m_hFileURLs.put(toDo.get(0), toDo.get(1));
|
||||
m_hFileTypes.put(toDo.get(0), toDo.get(2));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -423,7 +418,7 @@ public class Helper {
|
||||
|
||||
}
|
||||
|
||||
/** This exeception should be thrown if a method seeks for an invalid alias name */
|
||||
/** This exception should be thrown if a method seeks for an invalid alias name */
|
||||
class FileAliasNotFoundException extends java.lang.Exception{
|
||||
/** throws error message with wrong alias name
|
||||
* @param fileAlias the alias name
|
||||
|
||||
@@ -27,9 +27,11 @@ import com.sun.star.uno.XInterface;
|
||||
import complexlib.ComplexTestCase;
|
||||
import java.io.File;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import java.util.ArrayList;
|
||||
import util.utils;
|
||||
|
||||
|
||||
@@ -218,11 +220,10 @@ public class TypeDetection extends ComplexTestCase {
|
||||
XInterface oObj = (XInterface) oInterface ;
|
||||
log.println("ImplName: "+utils.getImplName(oObj));
|
||||
|
||||
m_xDetection = (XTypeDetection)
|
||||
UnoRuntime.queryInterface(XTypeDetection.class, oInterface);
|
||||
Enumeration k = param.keys();
|
||||
while (k.hasMoreElements()){
|
||||
String kName = ((String)k.nextElement()).toString();
|
||||
m_xDetection = UnoRuntime.queryInterface(XTypeDetection.class, oInterface);
|
||||
Iterator<String> k = param.keySet().iterator();
|
||||
while (k.hasNext()){
|
||||
String kName = k.next();
|
||||
log.println(kName + ":" + param.get(kName).toString());
|
||||
}
|
||||
// create instrace of helper class
|
||||
@@ -248,17 +249,17 @@ public class TypeDetection extends ComplexTestCase {
|
||||
public void checkByURLonly() {
|
||||
try{
|
||||
log.println("### checkByURLonly() ###");
|
||||
Vector CSVData = helper.getToDoList(
|
||||
ArrayList<ArrayList<String>> CSVData = helper.getToDoList(
|
||||
(String)param.get("csv.files"));
|
||||
Enumeration allToDos = CSVData.elements();
|
||||
Iterator<ArrayList<String>> allToDos = CSVData.iterator();
|
||||
|
||||
while (allToDos.hasMoreElements()){
|
||||
Vector toDo = (Vector) allToDos.nextElement();
|
||||
while (allToDos.hasNext()){
|
||||
ArrayList<String> toDo = allToDos.next();
|
||||
|
||||
String fileAlias = (String) toDo.get(0);
|
||||
String fileURL = (String) toDo.get(1);
|
||||
String URLfileType = (String) toDo.get(2);
|
||||
String StreamfileType = (String) toDo.get(3);
|
||||
String fileAlias = toDo.get(0);
|
||||
String fileURL = toDo.get(1);
|
||||
String URLfileType = toDo.get(2);
|
||||
String StreamfileType = toDo.get(3);
|
||||
|
||||
fileURL = utils.getFullURL(helper.ensureEndingFileSep(
|
||||
(String)param.get("TestDocumentPath")) + fileURL);
|
||||
@@ -350,18 +351,18 @@ public class TypeDetection extends ComplexTestCase {
|
||||
try{
|
||||
log.println("### checkPreselectedType() ###");
|
||||
|
||||
Vector CSVData = helper.getToDoList(
|
||||
ArrayList<ArrayList<String>> CSVData = helper.getToDoList(
|
||||
(String)param.get("csv.preselectedType"));
|
||||
Enumeration allToDos = CSVData.elements();
|
||||
Iterator<ArrayList<String>> allToDos = CSVData.iterator();
|
||||
|
||||
while (allToDos.hasMoreElements()){
|
||||
while (allToDos.hasNext()){
|
||||
try{
|
||||
Vector toDo = (Vector) allToDos.nextElement();
|
||||
ArrayList<String> toDo = allToDos.next();
|
||||
|
||||
String fileAlias = (String) toDo.get(0);
|
||||
String fileAlias = toDo.get(0);
|
||||
String fileURL = helper.getURLforfileAlias(fileAlias);
|
||||
String preselectFileType = (String) toDo.get(1);
|
||||
String expectedFileType = (String) toDo.get(2);
|
||||
String preselectFileType = toDo.get(1);
|
||||
String expectedFileType = toDo.get(2);
|
||||
|
||||
PropertyValue[] MediaDescriptor = helper.createMediaDescriptor(
|
||||
new String[] {"URL", "MediaType"},
|
||||
@@ -399,21 +400,20 @@ public class TypeDetection extends ComplexTestCase {
|
||||
try{
|
||||
log.println("### checkPreselectedFilter() ###");
|
||||
|
||||
Vector CSVData = helper.getToDoList(
|
||||
ArrayList<ArrayList<String>> CSVData = helper.getToDoList(
|
||||
(String)param.get("csv.preselectedFilter"));
|
||||
Iterator<ArrayList<String>> allToDos = CSVData.iterator();
|
||||
|
||||
Enumeration allToDos = CSVData.elements();
|
||||
|
||||
while (allToDos.hasMoreElements()){
|
||||
while (allToDos.hasNext()){
|
||||
try{
|
||||
Vector toDo = (Vector) allToDos.nextElement();
|
||||
ArrayList<String> toDo = allToDos.next();
|
||||
|
||||
String fileAlias = (String) toDo.get(0);
|
||||
String fileAlias = toDo.get(0);
|
||||
String fileURL = helper.getURLforfileAlias(fileAlias);
|
||||
String filterName = (String) toDo.get(1);
|
||||
String filterOptions = (String) toDo.get(2);
|
||||
String filterData = (String) toDo.get(3);
|
||||
String expectedType = (String) toDo.get(4);
|
||||
String filterName = toDo.get(1);
|
||||
String filterOptions = toDo.get(2);
|
||||
String filterData = toDo.get(3);
|
||||
String expectedType = toDo.get(4);
|
||||
|
||||
PropertyValue[] MediaDescriptor = helper.createMediaDescriptor(
|
||||
new String[] {"URL","FilterName",
|
||||
@@ -452,16 +452,16 @@ public class TypeDetection extends ComplexTestCase {
|
||||
try{
|
||||
log.println("### checkPreselectedDocService() ###");
|
||||
|
||||
Vector CSVData = helper.getToDoList((String)param.get("csv.serviceName"));
|
||||
Enumeration allToDos = CSVData.elements();
|
||||
ArrayList<ArrayList<String>> CSVData = helper.getToDoList((String)param.get("csv.serviceName"));
|
||||
Iterator<ArrayList<String>> allToDos = CSVData.iterator();
|
||||
|
||||
while (allToDos.hasMoreElements()){
|
||||
while (allToDos.hasNext()){
|
||||
try{
|
||||
Vector toDo = (Vector) allToDos.nextElement();
|
||||
ArrayList<String> toDo = allToDos.next();
|
||||
|
||||
String fileAlias = (String) toDo.get(0);
|
||||
String fileAlias = toDo.get(0);
|
||||
String fileURL = helper.getURLforfileAlias(fileAlias);
|
||||
String serviceName = (String) toDo.get(1);
|
||||
String serviceName = toDo.get(1);
|
||||
String fileType = helper.getTypeforfileAlias(fileAlias);
|
||||
|
||||
PropertyValue[] MediaDescriptor = helper.createMediaDescriptor(
|
||||
|
||||
@@ -1011,7 +1011,7 @@ public class Base64
|
||||
if( bytes != null && bytes.length >= 4 )
|
||||
{
|
||||
|
||||
int head = ((int)bytes[0] & 0xff) | ((bytes[1] << 8) & 0xff00);
|
||||
int head = (bytes[0] & 0xff) | ((bytes[1] << 8) & 0xff00);
|
||||
if( java.util.zip.GZIPInputStream.GZIP_MAGIC == head )
|
||||
{
|
||||
java.io.ByteArrayInputStream bais = null;
|
||||
|
||||
@@ -113,7 +113,7 @@ public class XSLTFilterOLEExtracter {
|
||||
if (aName.equals("oledata.mso")) {
|
||||
try {
|
||||
//get the length and seek to 0
|
||||
XSeekable xSeek = (XSeekable) UnoRuntime.queryInterface(XSeekable.class, m_RootStream);
|
||||
XSeekable xSeek = UnoRuntime.queryInterface(XSeekable.class, m_RootStream);
|
||||
int oleLength = (int) xSeek.getLength();
|
||||
xSeek.seek(0);
|
||||
xSeek = null;
|
||||
@@ -142,14 +142,14 @@ public class XSLTFilterOLEExtracter {
|
||||
if (oSubStream == null) {
|
||||
return "Not Found:" + aName;
|
||||
}
|
||||
XInputStream xSubStream = (XInputStream) UnoRuntime.queryInterface(XInputStream.class,
|
||||
XInputStream xSubStream = UnoRuntime.queryInterface(XInputStream.class,
|
||||
oSubStream);
|
||||
if (xSubStream == null) {
|
||||
return "Not Found:" + aName;
|
||||
}
|
||||
//The first four byte are the length of the uncompressed data
|
||||
byte pLength[][] = new byte[1][4];
|
||||
XSeekable xSeek = (XSeekable) UnoRuntime.queryInterface(XSeekable.class, xSubStream);
|
||||
XSeekable xSeek = UnoRuntime.queryInterface(XSeekable.class, xSubStream);
|
||||
xSeek.seek(0);
|
||||
xSeek = null;
|
||||
//Get the uncompressed length
|
||||
@@ -186,7 +186,7 @@ public class XSLTFilterOLEExtracter {
|
||||
XStream xTempFileStream = null;
|
||||
try {
|
||||
Object oTempFile = xMSF.createInstance("com.sun.star.io.TempFile");
|
||||
xTempFileStream = (XStream) UnoRuntime.queryInterface(XStream.class, oTempFile);
|
||||
xTempFileStream = UnoRuntime.queryInterface(XStream.class, oTempFile);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
@@ -207,18 +207,18 @@ public class XSLTFilterOLEExtracter {
|
||||
xOutput.flush();
|
||||
//Get the input stream and seek to begin
|
||||
XInputStream xInput = m_RootStream.getInputStream();
|
||||
XSeekable xSeek = (XSeekable) UnoRuntime.queryInterface(XSeekable.class, xInput);
|
||||
XSeekable xSeek = UnoRuntime.queryInterface(XSeekable.class, xInput);
|
||||
xSeek.seek(0);
|
||||
oledata = null;
|
||||
xSeek = null;
|
||||
|
||||
//create an com.sun.star.embed.OLESimpleStorage from the temp stream
|
||||
Object pArgs[] = new Object[1];
|
||||
pArgs[0] = (Object) xInput;
|
||||
pArgs[0] = xInput;
|
||||
Object oTempStorage = m_xMSF.createInstanceWithArguments("com.sun.star.embed.OLESimpleStorage", pArgs);
|
||||
pArgs = null;
|
||||
|
||||
m_Storage = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, oTempStorage);
|
||||
m_Storage = UnoRuntime.queryInterface(XNameContainer.class, oTempStorage);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -230,11 +230,11 @@ public class XSLTFilterOLEExtracter {
|
||||
m_RootStream = CreateTempFileStream(m_xMSF);
|
||||
|
||||
Object pArgs[] = new Object[1];
|
||||
pArgs[0] = (Object) m_RootStream;
|
||||
pArgs[0] = m_RootStream;
|
||||
Object oTempStorage = m_xMSF.createInstanceWithArguments("com.sun.star.embed.OLESimpleStorage", pArgs);
|
||||
pArgs = null;
|
||||
|
||||
m_Storage = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, oTempStorage);
|
||||
m_Storage = UnoRuntime.queryInterface(XNameContainer.class, oTempStorage);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -273,13 +273,13 @@ public class XSLTFilterOLEExtracter {
|
||||
//write the compressed data to the temp stream
|
||||
xOutput.writeBytes(compressedBytes);
|
||||
//seek to 0
|
||||
XSeekable xSeek = (XSeekable) UnoRuntime.queryInterface(XSeekable.class, xInput);
|
||||
XSeekable xSeek = UnoRuntime.queryInterface(XSeekable.class, xInput);
|
||||
xSeek.seek(0);
|
||||
xSeek = null;
|
||||
oledata = null;
|
||||
|
||||
//insert the temp stream as a sub stream and use an XTransactedObject to commit it immediately
|
||||
XTransactedObject xTransact = (XTransactedObject) UnoRuntime.queryInterface(XTransactedObject.class, m_Storage);
|
||||
XTransactedObject xTransact = UnoRuntime.queryInterface(XTransactedObject.class, m_Storage);
|
||||
m_Storage.insertByName(aName, xInput);
|
||||
xTransact.commit();
|
||||
xTransact = null;
|
||||
@@ -327,7 +327,7 @@ public class XSLTFilterOLEExtracter {
|
||||
Object x = xComponentContext.getServiceManager().createInstanceWithContext(
|
||||
"com.sun.star.connection.Connector", xComponentContext);
|
||||
|
||||
XConnector xConnector = (XConnector) UnoRuntime.queryInterface(XConnector.class, x);
|
||||
XConnector xConnector = UnoRuntime.queryInterface(XConnector.class, x);
|
||||
|
||||
String a[] = parseUnoUrl(sConnectionString);
|
||||
if (null == a) {
|
||||
@@ -340,7 +340,7 @@ public class XSLTFilterOLEExtracter {
|
||||
x = xComponentContext.getServiceManager().createInstanceWithContext(
|
||||
"com.sun.star.bridge.BridgeFactory", xComponentContext);
|
||||
|
||||
XBridgeFactory xBridgeFactory = (XBridgeFactory) UnoRuntime.queryInterface(
|
||||
XBridgeFactory xBridgeFactory = UnoRuntime.queryInterface(
|
||||
XBridgeFactory.class, x);
|
||||
|
||||
// create a nameless bridge with no instance provider
|
||||
@@ -348,7 +348,7 @@ public class XSLTFilterOLEExtracter {
|
||||
XBridge bridge = xBridgeFactory.createBridge("", a[1], m_Connection, null);
|
||||
|
||||
// query for the XComponent interface and add this as event listener
|
||||
XComponent xComponent = (XComponent) UnoRuntime.queryInterface(
|
||||
XComponent xComponent = UnoRuntime.queryInterface(
|
||||
XComponent.class, bridge);
|
||||
|
||||
// get the remote instance
|
||||
@@ -360,7 +360,7 @@ public class XSLTFilterOLEExtracter {
|
||||
"Server didn't provide an instance for" + a[2], null);
|
||||
}
|
||||
|
||||
XMultiServiceFactory xFac = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, x);
|
||||
XMultiServiceFactory xFac = UnoRuntime.queryInterface(XMultiServiceFactory.class, x);
|
||||
return xFac;
|
||||
}
|
||||
protected static boolean DEBUG = false;
|
||||
|
||||
@@ -245,7 +245,7 @@ public class XSLTransformer
|
||||
l.started();
|
||||
}
|
||||
|
||||
XSeekable xseek = (XSeekable) UnoRuntime.queryInterface(XSeekable.class, m_xis);
|
||||
XSeekable xseek = UnoRuntime.queryInterface(XSeekable.class, m_xis);
|
||||
if (xseek != null) {
|
||||
xseek.seek(0);
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ public class ByteArrayToXInputStreamAdapter
|
||||
// System.err.println("readbytes(..., "+param+")");
|
||||
_check();
|
||||
try {
|
||||
int remain = (int)(m_length - m_pos);
|
||||
int remain = (m_length - m_pos);
|
||||
if (param > remain) param = remain;
|
||||
/* ARGH!!! */
|
||||
if (values[0] == null){
|
||||
|
||||
@@ -142,7 +142,7 @@ public class InputStreamToXInputStreamAdapter implements XInputStream {
|
||||
tmpIntVal = Integer.MAX_VALUE;
|
||||
} else {
|
||||
// Casting is safe here.
|
||||
tmpIntVal = (int)tmpLongVal;
|
||||
tmpIntVal = tmpLongVal;
|
||||
}
|
||||
tmpLongVal -= tmpIntVal;
|
||||
|
||||
|
||||
@@ -712,7 +712,7 @@ public final class PropertySetMixin {
|
||||
throws UnknownPropertyException, PropertyVetoException,
|
||||
com.sun.star.lang.IllegalArgumentException, WrappedTargetException
|
||||
{
|
||||
PropertyData p = (PropertyData) properties.get(name);
|
||||
PropertyData p = properties.get(name);
|
||||
if (p == null) {
|
||||
throw new UnknownPropertyException(name, object);
|
||||
}
|
||||
@@ -784,7 +784,7 @@ public final class PropertySetMixin {
|
||||
Object getProperty(String name, PropertyState[] state)
|
||||
throws UnknownPropertyException, WrappedTargetException
|
||||
{
|
||||
PropertyData p = (PropertyData) properties.get(name);
|
||||
PropertyData p = properties.get(name);
|
||||
if (p == null) {
|
||||
throw new UnknownPropertyException(name, object);
|
||||
}
|
||||
@@ -1008,7 +1008,7 @@ public final class PropertySetMixin {
|
||||
private PropertyData get(Object object, String propertyName)
|
||||
throws UnknownPropertyException
|
||||
{
|
||||
PropertyData p = (PropertyData) properties.get(propertyName);
|
||||
PropertyData p = properties.get(propertyName);
|
||||
if (p == null || !p.present) {
|
||||
throw new UnknownPropertyException(propertyName, object);
|
||||
}
|
||||
@@ -1057,7 +1057,7 @@ public final class PropertySetMixin {
|
||||
}
|
||||
|
||||
public boolean hasPropertyByName(String name) {
|
||||
PropertyData p = (PropertyData) properties.get(name);
|
||||
PropertyData p = properties.get(name);
|
||||
return p != null && p.present;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ import com.sun.star.lang.XMultiServiceFactory;
|
||||
|
||||
public class Bootstrap_Test {
|
||||
|
||||
static public boolean test( String ini_file, java.util.Hashtable bootstrap_parameters )
|
||||
static public boolean test( String ini_file, java.util.Hashtable<String,String> bootstrap_parameters )
|
||||
throws java.lang.Exception
|
||||
{
|
||||
boolean passed = false;
|
||||
@@ -91,7 +91,7 @@ public class Bootstrap_Test {
|
||||
if ( args.length == 0 )
|
||||
usage();
|
||||
|
||||
java.util.Hashtable bootstrap_parameters = new java.util.Hashtable();
|
||||
java.util.Hashtable<String,String> bootstrap_parameters = new java.util.Hashtable<String,String>();
|
||||
for ( int nPos = 1; nPos < args.length; ++nPos )
|
||||
{
|
||||
String arg = args[ nPos ];
|
||||
|
||||
@@ -31,11 +31,11 @@ import java.util.Hashtable;
|
||||
public class ComponentContext_Test {
|
||||
public static void main(String args[]) {
|
||||
try {
|
||||
Hashtable table = new Hashtable();
|
||||
Hashtable<String,Object> table = new Hashtable<String,Object>();
|
||||
table.put( "bla1", new ComponentContextEntry( null, new Integer( 1 ) ) );
|
||||
XComponentContext xInitialContext = Bootstrap.createInitialComponentContext( table );
|
||||
|
||||
table = new Hashtable();
|
||||
table = new Hashtable<String,Object>();
|
||||
table.put( "bla2", new ComponentContextEntry( new Integer( 2 ) ) );
|
||||
table.put( "bla3", new Integer( 3 ) );
|
||||
XComponentContext xContext = new ComponentContext( table, xInitialContext );
|
||||
|
||||
@@ -54,11 +54,11 @@ public class InterfaceContainer_Test
|
||||
Object proxyObj3TypeProv;
|
||||
Object proxyObj2TypeProv;
|
||||
//contains original objects
|
||||
List list1;
|
||||
List<Object> list1;
|
||||
//contains original objects + proxies
|
||||
List list2;
|
||||
List<Object> list2;
|
||||
//contains original object + proxies + null value
|
||||
List list3;
|
||||
List<Object> list3;
|
||||
|
||||
public InterfaceContainer_Test()
|
||||
{
|
||||
@@ -72,15 +72,15 @@ public class InterfaceContainer_Test
|
||||
proxyObj2TypeProv= ProxyProvider.createProxy(obj2, XTypeProvider.class);
|
||||
proxyObj3TypeProv= ProxyProvider.createProxy(obj3, XTypeProvider.class);
|
||||
|
||||
list1= new ArrayList();
|
||||
list1= new ArrayList<Object>();
|
||||
list1.add(obj1);
|
||||
list1.add(obj2);
|
||||
list1.add(obj3);
|
||||
list2= new ArrayList();
|
||||
list2= new ArrayList<Object>();
|
||||
list2.add(obj1);
|
||||
list2.add(proxyObj2TypeProv);
|
||||
list2.add(proxyObj3TypeProv);
|
||||
list3= new ArrayList();
|
||||
list3= new ArrayList<Object>();
|
||||
list3.add(obj1);
|
||||
list3.add(null);
|
||||
list3.add(proxyObj2TypeProv);
|
||||
@@ -368,7 +368,7 @@ public class InterfaceContainer_Test
|
||||
r[i++]= cont.isEmpty();
|
||||
cont.addAll(list2);
|
||||
|
||||
List list= new ArrayList();
|
||||
List<Object> list= new ArrayList<Object>();
|
||||
list.add(list2.get(0));
|
||||
list.add(list2.get(1));
|
||||
list.add(proxyObj3Weak2);
|
||||
@@ -396,7 +396,7 @@ public class InterfaceContainer_Test
|
||||
|
||||
cont.addAll(list1); //obj1, obj2, obj3
|
||||
cont.addAll(list2); //obj1, proxyObj2TypeProv, proxyObj3TypeProv
|
||||
List list = new ArrayList();
|
||||
List<Object> list = new ArrayList<Object>();
|
||||
list.add(obj1);
|
||||
list.add(proxyObj3Weak1);
|
||||
|
||||
|
||||
+6
-6
@@ -40,11 +40,11 @@ public class MultiTypeInterfaceContainer_Test
|
||||
Object proxyObj3TypeProv;
|
||||
Object proxyObj2TypeProv;
|
||||
//contains original objects
|
||||
List list1;
|
||||
List<Object> list1;
|
||||
//contains original objects + proxies
|
||||
List list2;
|
||||
List<Object> list2;
|
||||
//contains original object + proxies + null value
|
||||
List list3;
|
||||
List<Object> list3;
|
||||
|
||||
/** Creates a new instance of MultiTypeInterfaceContainer_Test */
|
||||
public MultiTypeInterfaceContainer_Test()
|
||||
@@ -60,15 +60,15 @@ public class MultiTypeInterfaceContainer_Test
|
||||
proxyObj2TypeProv= ProxyProvider.createProxy(obj2, XTypeProvider.class);
|
||||
proxyObj3TypeProv= ProxyProvider.createProxy(obj3, XTypeProvider.class);
|
||||
|
||||
list1= new ArrayList();
|
||||
list1= new ArrayList<Object>();
|
||||
list1.add(obj1);
|
||||
list1.add(obj2);
|
||||
list1.add(obj3);
|
||||
list2= new ArrayList();
|
||||
list2= new ArrayList<Object>();
|
||||
list2.add(obj1);
|
||||
list2.add(proxyObj2TypeProv);
|
||||
list2.add(proxyObj3TypeProv);
|
||||
list3= new ArrayList();
|
||||
list3= new ArrayList<Object>();
|
||||
list3.add(obj1);
|
||||
list3.add(null);
|
||||
list3.add(proxyObj2TypeProv);
|
||||
|
||||
@@ -104,47 +104,47 @@ public class PropertySet_Test
|
||||
value= new Boolean(true);
|
||||
cl.setPropertyValue("PropBoolA", value);
|
||||
ret= cl.getPropertyValue("PropBoolA");
|
||||
r[i++]= ((Boolean) ret).equals( (Boolean) value);
|
||||
r[i++]= ((Boolean) ret).equals( value);
|
||||
value= new Character('A');
|
||||
cl.setPropertyValue("PropCharA",value);
|
||||
ret= cl.getPropertyValue("PropCharA");
|
||||
r[i++]= ((Character) ret).equals((Character) value);
|
||||
r[i++]= ((Character) ret).equals(value);
|
||||
value= new Byte((byte) 111);
|
||||
cl.setPropertyValue("PropByteA",value);
|
||||
ret= cl.getPropertyValue("PropByteA");
|
||||
r[i++]= ((Byte) ret).equals((Byte) value);
|
||||
r[i++]= ((Byte) ret).equals(value);
|
||||
value= new Short((short)112);
|
||||
cl.setPropertyValue("PropShortA", value);
|
||||
ret= cl.getPropertyValue("PropShortA");
|
||||
r[i++]= ((Short) ret).equals((Short) value);
|
||||
r[i++]= ((Short) ret).equals(value);
|
||||
value= new Integer(113);
|
||||
cl.setPropertyValue("PropIntA", value);
|
||||
ret= cl.getPropertyValue("PropIntA");
|
||||
r[i++]= ((Integer) ret).equals((Integer) value);
|
||||
r[i++]= ((Integer) ret).equals(value);
|
||||
value= new Long(115);
|
||||
cl.setPropertyValue("PropLongA", value);
|
||||
ret= cl.getPropertyValue("PropLongA");
|
||||
r[i++]= ((Long) ret).equals((Long) value);
|
||||
r[i++]= ((Long) ret).equals(value);
|
||||
value= new Float(3.14);
|
||||
cl.setPropertyValue("PropFloatA", value);
|
||||
ret= cl.getPropertyValue("PropFloatA");
|
||||
r[i++]= ((Float) ret).equals((Float) value);
|
||||
r[i++]= ((Float) ret).equals(value);
|
||||
value= new Double(3.145);
|
||||
cl.setPropertyValue("PropDoubleA",value);
|
||||
ret= cl.getPropertyValue("PropDoubleA");
|
||||
r[i++]= ((Double) ret).equals((Double) value);
|
||||
r[i++]= ((Double) ret).equals(value);
|
||||
value= new String("string");
|
||||
cl.setPropertyValue("PropStringA",value);
|
||||
ret= cl.getPropertyValue("PropStringA");
|
||||
r[i++]= ((String) ret).equals((String) value);
|
||||
r[i++]= ((String) ret).equals(value);
|
||||
value= new ComponentBase();
|
||||
cl.setPropertyValue("PropXInterfaceA",value);
|
||||
ret= cl.getPropertyValue("PropXInterfaceA");
|
||||
r[i++]= ((XInterface) ret).equals((XInterface) value);
|
||||
r[i++]= ((XInterface) ret).equals(value);
|
||||
value= new ComponentBase();
|
||||
cl.setPropertyValue("PropXWeakA",value);
|
||||
ret= cl.getPropertyValue("PropXWeakA");
|
||||
r[i++]= ((XWeak) ret).equals((XWeak) value);
|
||||
r[i++]= ((XWeak) ret).equals(value);
|
||||
value = com.sun.star.beans.PropertyState.AMBIGUOUS_VALUE;
|
||||
cl.setPropertyValue("PropEnum",value);
|
||||
ret= cl.getPropertyValue("PropEnum");
|
||||
@@ -152,7 +152,7 @@ public class PropertySet_Test
|
||||
value= new byte[]{1,2,3};
|
||||
cl.setPropertyValue("PropArrayByteA", value);
|
||||
ret= cl.getPropertyValue("PropArrayByteA");
|
||||
r[i++]= ((byte[]) ret).equals((byte[]) value);
|
||||
r[i++]= ((byte[]) ret).equals(value);
|
||||
value= new Type(String.class);
|
||||
cl.setPropertyValue("PropTypeA", value);
|
||||
ret= cl.getPropertyValue("PropTypeA");
|
||||
@@ -162,10 +162,10 @@ public class PropertySet_Test
|
||||
value= new Boolean(true);
|
||||
cl.setPropertyValue("PropBoolB", value);
|
||||
ret= cl.getPropertyValue("PropBoolB");
|
||||
r[i++]= ((Boolean) ret).equals((Boolean) value);
|
||||
r[i++]= ((Boolean) ret).equals(value);
|
||||
cl.setPropertyValue("PropBoolC", value);
|
||||
ret= cl.getPropertyValue("PropBoolC");
|
||||
r[i++]= ((Boolean) ret).equals((Boolean) value);
|
||||
r[i++]= ((Boolean) ret).equals(value);
|
||||
|
||||
try{
|
||||
cl.setPropertyValue("PropBoolD", value);
|
||||
@@ -179,51 +179,51 @@ public class PropertySet_Test
|
||||
value= new Boolean(true);
|
||||
cl.setPropertyValue("PropObjectA", value);
|
||||
ret= cl.getPropertyValue("PropObjectA");
|
||||
r[i++]= ((Boolean) ret).equals((Boolean) value);
|
||||
r[i++]= ((Boolean) ret).equals(value);
|
||||
value= new Character('A');
|
||||
cl.setPropertyValue("PropObjectA",value);
|
||||
ret= cl.getPropertyValue("PropObjectA");
|
||||
r[i++]= ((Character) ret).equals((Character) value);
|
||||
r[i++]= ((Character) ret).equals(value);
|
||||
value= new Byte((byte) 111);
|
||||
cl.setPropertyValue("PropObjectA",value);
|
||||
ret= cl.getPropertyValue("PropObjectA");
|
||||
r[i++]= ((Byte) ret).equals((Byte) value);
|
||||
r[i++]= ((Byte) ret).equals(value);
|
||||
value= new Short((short)112);
|
||||
cl.setPropertyValue("PropObjectA", value);
|
||||
ret= cl.getPropertyValue("PropObjectA");
|
||||
r[i++]= ((Short) ret).equals((Short) value);
|
||||
r[i++]= ((Short) ret).equals(value);
|
||||
value= new Integer(113);
|
||||
cl.setPropertyValue("PropObjectA", value);
|
||||
ret= cl.getPropertyValue("PropObjectA");
|
||||
r[i++]= ((Integer) ret).equals((Integer) value);
|
||||
r[i++]= ((Integer) ret).equals(value);
|
||||
value= new Long(115);
|
||||
cl.setPropertyValue("PropObjectA", value);
|
||||
ret= cl.getPropertyValue("PropObjectA");
|
||||
r[i++]= ((Long) ret).equals((Long) value);
|
||||
r[i++]= ((Long) ret).equals(value);
|
||||
value= new Float(3.14);
|
||||
cl.setPropertyValue("PropObjectA", value);
|
||||
ret= cl.getPropertyValue("PropObjectA");
|
||||
r[i++]= ((Float) ret).equals((Float) value);
|
||||
r[i++]= ((Float) ret).equals(value);
|
||||
value= new Double(3.145);
|
||||
cl.setPropertyValue("PropObjectA",value);
|
||||
ret= cl.getPropertyValue("PropObjectA");
|
||||
r[i++]= ((Double) ret).equals((Double) value);
|
||||
r[i++]= ((Double) ret).equals(value);
|
||||
value= new String("string");
|
||||
cl.setPropertyValue("PropObjectA",value);
|
||||
ret= cl.getPropertyValue("PropObjectA");
|
||||
r[i++]= ((String) ret).equals((String) value);
|
||||
r[i++]= ((String) ret).equals(value);
|
||||
value= new ComponentBase();
|
||||
cl.setPropertyValue("PropObjectA",value);
|
||||
ret= cl.getPropertyValue("PropObjectA");
|
||||
r[i++]= ((XInterface) ret).equals((XInterface) value);
|
||||
r[i++]= ((XInterface) ret).equals(value);
|
||||
value= new ComponentBase();
|
||||
cl.setPropertyValue("PropObjectA",value);
|
||||
ret= cl.getPropertyValue("PropObjectA");
|
||||
r[i++]= ((XWeak) ret).equals((XWeak) value);
|
||||
r[i++]= ((XWeak) ret).equals(value);
|
||||
value= new byte[]{1,2,3};
|
||||
cl.setPropertyValue("PropObjectA", value);
|
||||
ret= cl.getPropertyValue("PropObjectA");
|
||||
r[i++]= ((byte[]) ret).equals((byte[]) value);
|
||||
r[i++]= ((byte[]) ret).equals(value);
|
||||
value= new Type(String.class);
|
||||
cl.setPropertyValue("PropObjectA", value);
|
||||
ret= cl.getPropertyValue("PropObjectA");
|
||||
@@ -401,35 +401,35 @@ public class PropertySet_Test
|
||||
value= new Boolean(true);
|
||||
cl.setPropertyValue("PropBoolClass", value);
|
||||
ret= cl.getPropertyValue("PropBoolClass");
|
||||
r[i++]= ((Boolean) ret).equals( (Boolean) value);
|
||||
r[i++]= ((Boolean) ret).equals( value);
|
||||
value= new Character('A');
|
||||
cl.setPropertyValue("PropCharClass",value);
|
||||
ret= cl.getPropertyValue("PropCharClass");
|
||||
r[i++]= ((Character) ret).equals((Character) value);
|
||||
r[i++]= ((Character) ret).equals(value);
|
||||
value= new Byte((byte) 111);
|
||||
cl.setPropertyValue("PropByteClass",value);
|
||||
ret= cl.getPropertyValue("PropByteClass");
|
||||
r[i++]= ((Byte) ret).equals((Byte) value);
|
||||
r[i++]= ((Byte) ret).equals(value);
|
||||
value= new Short((short)112);
|
||||
cl.setPropertyValue("PropShortClass", value);
|
||||
ret= cl.getPropertyValue("PropShortClass");
|
||||
r[i++]= ((Short) ret).equals((Short) value);
|
||||
r[i++]= ((Short) ret).equals(value);
|
||||
value= new Integer(113);
|
||||
cl.setPropertyValue("PropIntClass", value);
|
||||
ret= cl.getPropertyValue("PropIntClass");
|
||||
r[i++]= ((Integer) ret).equals((Integer) value);
|
||||
r[i++]= ((Integer) ret).equals(value);
|
||||
value= new Long(115);
|
||||
cl.setPropertyValue("PropLongClass", value);
|
||||
ret= cl.getPropertyValue("PropLongClass");
|
||||
r[i++]= ((Long) ret).equals((Long) value);
|
||||
r[i++]= ((Long) ret).equals(value);
|
||||
value= new Float(3.14);
|
||||
cl.setPropertyValue("PropFloatClass", value);
|
||||
ret= cl.getPropertyValue("PropFloatClass");
|
||||
r[i++]= ((Float) ret).equals((Float) value);
|
||||
r[i++]= ((Float) ret).equals(value);
|
||||
value= new Double(3.145);
|
||||
cl.setPropertyValue("PropDoubleClass",value);
|
||||
ret= cl.getPropertyValue("PropDoubleClass");
|
||||
r[i++]= ((Double) ret).equals((Double) value);
|
||||
r[i++]= ((Double) ret).equals(value);
|
||||
|
||||
cl.resetPropertyMembers();
|
||||
|
||||
@@ -1396,7 +1396,7 @@ class TestClass extends PropertySet
|
||||
value= new Integer(111);
|
||||
setPropertyValueNoBroadcast(propObjectA, value);
|
||||
r[i++]= objectPropA.equals(value);
|
||||
value= (XInterface) new ComponentBase();
|
||||
value= new ComponentBase();
|
||||
setPropertyValueNoBroadcast(propObjectA, value);
|
||||
r[i++]= objectPropA.equals(value);
|
||||
value= new Any( new Type(Integer.TYPE), new Integer(111));
|
||||
|
||||
@@ -123,7 +123,7 @@ public class UnoUrlTest {
|
||||
assertTrue((url != null));
|
||||
assertEquals("ABC", url.getRootOid());
|
||||
assertEquals(1, url.getConnectionParameters().size());
|
||||
assertEquals("val9", (String)url.getConnectionParameters().get("key9"));
|
||||
assertEquals("val9", url.getConnectionParameters().get("key9"));
|
||||
} catch (com.sun.star.lang.IllegalArgumentException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
@@ -176,7 +176,7 @@ public class UnoUrlTest {
|
||||
assertEquals("StarOffice.ServiceManager", url.getRootOid());
|
||||
assertEquals("socket", url.getConnection());
|
||||
assertEquals("urp", url.getProtocol());
|
||||
assertEquals("2002", (String)url.getConnectionParameters().get("port"));
|
||||
assertEquals("2002", url.getConnectionParameters().get("port"));
|
||||
} catch (com.sun.star.lang.IllegalArgumentException e) {
|
||||
fail("Caught exception:" + e.getMessage());
|
||||
}
|
||||
@@ -187,7 +187,7 @@ public class UnoUrlTest {
|
||||
UnoUrl url =
|
||||
UnoUrl.parseUnoUrl(
|
||||
"socket,host=localhost,horst=abc%c3%9c%c3%a4ABC%41%2c%2C,port=2002;urp;StarOffice.ServiceManager");
|
||||
assertEquals("abcÜäABCA,,", (String)url.getConnectionParameters().get("horst"));
|
||||
assertEquals("abcÜäABCA,,", url.getConnectionParameters().get("horst"));
|
||||
assertEquals(
|
||||
"host=localhost,horst=abc%c3%9c%c3%a4ABC%41%2c%2C,port=2002",
|
||||
url.getConnectionParametersAsString());
|
||||
|
||||
@@ -340,7 +340,7 @@ public final class Marshaling_Test {
|
||||
result = compareInterfaces((XInterface)op1, (XInterface)op2);
|
||||
|
||||
else if(op1.getClass() == String.class && op2.getClass() == String.class) // is it a String ?
|
||||
result = ((String)op1).equals((String)op2);
|
||||
result = ((String)op1).equals(op2);
|
||||
|
||||
else if(op1.getClass() == Type.class && op2.getClass() == Type.class) // types?
|
||||
result = op1.equals(op2);
|
||||
|
||||
@@ -81,7 +81,7 @@ public final class Protocol_Test {
|
||||
new Object[] { "hallo" });
|
||||
Message iMessage = iReceiver.readMessage();
|
||||
Object[] t_params = iMessage.getArguments();
|
||||
assertEquals("hallo", (String)t_params[0]);
|
||||
assertEquals("hallo", t_params[0]);
|
||||
|
||||
// send a reply
|
||||
iReceiver.writeReply(false, new ThreadId(new byte[] { 0, 1 }), null);
|
||||
@@ -184,7 +184,7 @@ public final class Protocol_Test {
|
||||
|
||||
Object[] t_params = iMessage.getArguments();
|
||||
|
||||
assertEquals("hallo", (String)t_params[0]);
|
||||
assertEquals("hallo", t_params[0]);
|
||||
|
||||
assertEquals("inOutString", ((String [])t_params[2])[0]);
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ import java.io.UnsupportedEncodingException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.Vector;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* This class finds a UNO installation on the system.
|
||||
@@ -395,7 +395,7 @@ final class InstallationFinder {
|
||||
File fSVersion = new File(
|
||||
System.getProperty( "user.home" ) ,SVERSION );
|
||||
if ( fSVersion.exists() ) {
|
||||
Vector lines = new Vector();
|
||||
ArrayList<String> lines = new ArrayList<String>();
|
||||
BufferedReader br = null;
|
||||
try {
|
||||
br = new BufferedReader( new InputStreamReader(
|
||||
@@ -427,7 +427,7 @@ final class InstallationFinder {
|
||||
}
|
||||
for ( int i = lines.size() - 1; i >= 0; i-- ) {
|
||||
StringTokenizer tokens = new StringTokenizer(
|
||||
(String)lines.elementAt( i ), "=" );
|
||||
lines.get( i ), "=" );
|
||||
if ( tokens.countTokens() != 2 )
|
||||
continue;
|
||||
String key = tokens.nextToken();
|
||||
|
||||
@@ -41,7 +41,7 @@ import java.util.Enumeration;
|
||||
import java.util.jar.Attributes;
|
||||
import java.util.jar.Manifest;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.Vector;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* This class can be used as a loader for application classes which use UNO.
|
||||
@@ -72,22 +72,22 @@ public final class Loader {
|
||||
String className = null;
|
||||
Class clazz = Loader.class;
|
||||
ClassLoader loader = clazz.getClassLoader();
|
||||
Vector res = new Vector();
|
||||
ArrayList<URL> res = new ArrayList<URL>();
|
||||
try {
|
||||
Enumeration en = loader.getResources( "META-INF/MANIFEST.MF" );
|
||||
Enumeration<URL> en = loader.getResources( "META-INF/MANIFEST.MF" );
|
||||
while ( en.hasMoreElements() ) {
|
||||
res.add( (URL) en.nextElement() );
|
||||
res.add( en.nextElement() );
|
||||
}
|
||||
// the jarfile with the com/sun/star/lib/loader/Loader.class
|
||||
// per-entry attribute is most probably the last resource in the
|
||||
// list, therefore search backwards
|
||||
for ( int i = res.size() - 1; i >= 0; i-- ) {
|
||||
URL jarurl = (URL) res.elementAt( i );
|
||||
URL jarurl = res.get( i );
|
||||
try {
|
||||
JarURLConnection jarConnection =
|
||||
(JarURLConnection) jarurl.openConnection();
|
||||
Manifest mf = jarConnection.getManifest();
|
||||
Attributes attrs = (Attributes) mf.getAttributes(
|
||||
Attributes attrs = mf.getAttributes(
|
||||
"com/sun/star/lib/loader/Loader.class" );
|
||||
if ( attrs != null ) {
|
||||
className = attrs.getValue( "Application-Class" );
|
||||
@@ -154,7 +154,7 @@ public final class Loader {
|
||||
|
||||
// get the urls from which to load classes and resources
|
||||
// from the class path
|
||||
Vector vec = new Vector();
|
||||
ArrayList<URL> vec = new ArrayList<URL>();
|
||||
String classpath = null;
|
||||
try {
|
||||
classpath = System.getProperty( "java.class.path" );
|
||||
@@ -233,7 +233,7 @@ public final class Loader {
|
||||
return m_Loader;
|
||||
}
|
||||
|
||||
private static void addUrls(Vector urls, String data, String delimiter) {
|
||||
private static void addUrls(ArrayList<URL> urls, String data, String delimiter) {
|
||||
StringTokenizer tokens = new StringTokenizer( data, delimiter );
|
||||
while ( tokens.hasMoreTokens() ) {
|
||||
try {
|
||||
@@ -247,7 +247,7 @@ public final class Loader {
|
||||
}
|
||||
}
|
||||
|
||||
private static void callUnoinfo(String path, Vector urls) {
|
||||
private static void callUnoinfo(String path, ArrayList<URL> urls) {
|
||||
Process p;
|
||||
try {
|
||||
p = Runtime.getRuntime().exec(
|
||||
|
||||
+25
-25
@@ -236,7 +236,7 @@ XInitialization {
|
||||
// create the dialog model and set the properties
|
||||
Object dialogModel = xMultiComponentFactory.createInstanceWithContext(
|
||||
"com.sun.star.awt.UnoControlDialogModel", _xComponentContext );
|
||||
XPropertySet xPSetDialog = ( XPropertySet )UnoRuntime.queryInterface(
|
||||
XPropertySet xPSetDialog = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, dialogModel );
|
||||
xPSetDialog.setPropertyValue( "PositionX", new Integer( dialogX) );
|
||||
xPSetDialog.setPropertyValue( "PositionY", new Integer( dialogY));
|
||||
@@ -245,13 +245,13 @@ XInitialization {
|
||||
xPSetDialog.setPropertyValue( "Title", _title );
|
||||
|
||||
// get the service manager from the dialog model
|
||||
XMultiServiceFactory xMultiServiceFactory = ( XMultiServiceFactory )UnoRuntime.queryInterface(
|
||||
XMultiServiceFactory xMultiServiceFactory = UnoRuntime.queryInterface(
|
||||
XMultiServiceFactory.class, dialogModel );
|
||||
|
||||
// create the Run Macro button model and set the properties
|
||||
Object runButtonModel = xMultiServiceFactory.createInstance(
|
||||
"com.sun.star.awt.UnoControlButtonModel" );
|
||||
XPropertySet xPSetButton = ( XPropertySet )UnoRuntime.queryInterface(
|
||||
XPropertySet xPSetButton = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, runButtonModel );
|
||||
LogUtils.DEBUG("run: x="+(((dialogW+cbIncrW)/2)-runButtonW -1) );
|
||||
LogUtils.DEBUG("run: y="+(dialogH+cbIncrH-runButtonH-1));
|
||||
@@ -266,7 +266,7 @@ XInitialization {
|
||||
// create the Dont Run Macro button model and set the properties
|
||||
Object doNotRunButtonModel = xMultiServiceFactory.createInstance(
|
||||
"com.sun.star.awt.UnoControlButtonModel" );
|
||||
xPSetButton = ( XPropertySet )UnoRuntime.queryInterface(
|
||||
xPSetButton = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, doNotRunButtonModel );
|
||||
LogUtils.DEBUG("dontrun: x="+(((dialogW+cbIncrW)/2)-1) );
|
||||
LogUtils.DEBUG("dontrun: y="+(dialogH+cbIncrH-doNotRunButtonH-1 ));
|
||||
@@ -279,7 +279,7 @@ XInitialization {
|
||||
xPSetButton.setPropertyValue( "Label", _doNotRunMacro );
|
||||
|
||||
// insert the control models into the dialog model
|
||||
XNameContainer xNameCont = ( XNameContainer )UnoRuntime.queryInterface(
|
||||
XNameContainer xNameCont = UnoRuntime.queryInterface(
|
||||
XNameContainer.class, dialogModel );
|
||||
xNameCont.insertByName( _runButtonName, runButtonModel );
|
||||
xNameCont.insertByName( _doNotRunButtonName, doNotRunButtonModel );
|
||||
@@ -290,7 +290,7 @@ XInitialization {
|
||||
// create the label model and set the properties
|
||||
Object label2Model = xMultiServiceFactory.createInstance(
|
||||
"com.sun.star.awt.UnoControlFixedTextModel" );
|
||||
XPropertySet xPSetLabel = ( XPropertySet )UnoRuntime.queryInterface(
|
||||
XPropertySet xPSetLabel = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, label2Model );
|
||||
xPSetLabel.setPropertyValue( "PositionX", new Integer( label2X ));
|
||||
xPSetLabel.setPropertyValue( "PositionY", new Integer( label2Y ));
|
||||
@@ -303,7 +303,7 @@ XInitialization {
|
||||
// create the label model and set the properties
|
||||
Object label3Model = xMultiServiceFactory.createInstance(
|
||||
"com.sun.star.awt.UnoControlFixedTextModel" );
|
||||
XPropertySet xPSetLabel3 = ( XPropertySet )UnoRuntime.queryInterface(
|
||||
XPropertySet xPSetLabel3 = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, label3Model );
|
||||
xPSetLabel3.setPropertyValue( "PositionX", new Integer( label3X ));
|
||||
xPSetLabel3.setPropertyValue( "PositionY", new Integer( label3Y ));
|
||||
@@ -316,7 +316,7 @@ XInitialization {
|
||||
// create the label model and set the properties
|
||||
Object label4Model = xMultiServiceFactory.createInstance(
|
||||
"com.sun.star.awt.UnoControlFixedTextModel" );
|
||||
XPropertySet xPSetLabel4 = ( XPropertySet )UnoRuntime.queryInterface(
|
||||
XPropertySet xPSetLabel4 = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, label4Model );
|
||||
xPSetLabel4.setPropertyValue( "PositionX", new Integer( label4X ));
|
||||
xPSetLabel4.setPropertyValue( "PositionY", new Integer( label4Y ));
|
||||
@@ -329,7 +329,7 @@ XInitialization {
|
||||
// create the checkbox model and set the properties
|
||||
Object checkBoxModel = xMultiServiceFactory.createInstance(
|
||||
"com.sun.star.awt.UnoControlCheckBoxModel" );
|
||||
XPropertySet xPSetCheckBox = ( XPropertySet )UnoRuntime.queryInterface(
|
||||
XPropertySet xPSetCheckBox = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, checkBoxModel );
|
||||
xPSetCheckBox.setPropertyValue( "PositionX", new Integer( checkBoxX ));
|
||||
xPSetCheckBox.setPropertyValue( "PositionY", new Integer( checkBoxY ));
|
||||
@@ -351,7 +351,7 @@ XInitialization {
|
||||
// create the label model and set the properties
|
||||
Object label5Model = xMultiServiceFactory.createInstance(
|
||||
"com.sun.star.awt.UnoControlFixedTextModel" );
|
||||
XPropertySet xPSetLabel5 = ( XPropertySet )UnoRuntime.queryInterface(
|
||||
XPropertySet xPSetLabel5 = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, label5Model );
|
||||
xPSetLabel5.setPropertyValue( "PositionX", new Integer( label5X ));
|
||||
xPSetLabel5.setPropertyValue( "PositionY", new Integer( label5Y ));
|
||||
@@ -368,7 +368,7 @@ XInitialization {
|
||||
// create the label model and set the properties
|
||||
Object labelModel = xMultiServiceFactory.createInstance(
|
||||
"com.sun.star.awt.UnoControlFixedTextModel" );
|
||||
XPropertySet xPSetLabel = ( XPropertySet )UnoRuntime.queryInterface(
|
||||
XPropertySet xPSetLabel = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, labelModel );
|
||||
xPSetLabel.setPropertyValue( "PositionX", new Integer( label1X ));
|
||||
xPSetLabel.setPropertyValue( "PositionY", new Integer( label1Y ));
|
||||
@@ -385,25 +385,25 @@ XInitialization {
|
||||
// create the dialog control and set the model
|
||||
Object dialog = xMultiComponentFactory.createInstanceWithContext(
|
||||
"com.sun.star.awt.UnoControlDialog", _xComponentContext );
|
||||
XControl xControl = ( XControl )UnoRuntime.queryInterface(
|
||||
XControl xControl = UnoRuntime.queryInterface(
|
||||
XControl.class, dialog );
|
||||
XControlModel xControlModel = ( XControlModel )UnoRuntime.queryInterface(
|
||||
XControlModel xControlModel = UnoRuntime.queryInterface(
|
||||
XControlModel.class, dialogModel );
|
||||
xControl.setModel( xControlModel );
|
||||
|
||||
// add an action listener to the button control
|
||||
XControlContainer xControlCont = ( XControlContainer )UnoRuntime.queryInterface(
|
||||
XControlContainer xControlCont = UnoRuntime.queryInterface(
|
||||
XControlContainer.class, dialog );
|
||||
|
||||
// Add to yes button
|
||||
Object objectButton = xControlCont.getControl( _runButtonName );
|
||||
XButton xButton = ( XButton )UnoRuntime.queryInterface(
|
||||
XButton xButton = UnoRuntime.queryInterface(
|
||||
XButton.class, objectButton );
|
||||
xButton.addActionListener( new ActionListenerImpl( xControlCont, _runButtonName ) );
|
||||
|
||||
// add to no button
|
||||
objectButton = xControlCont.getControl( _doNotRunButtonName );
|
||||
xButton = ( XButton )UnoRuntime.queryInterface(
|
||||
xButton = UnoRuntime.queryInterface(
|
||||
XButton.class, objectButton );
|
||||
xButton.addActionListener( new ActionListenerImpl( xControlCont, _doNotRunButtonName ) );
|
||||
|
||||
@@ -411,23 +411,23 @@ XInitialization {
|
||||
{
|
||||
// add to checkbox
|
||||
Object objectCheckBox = xControlCont.getControl( _checkBoxName );
|
||||
XCheckBox xCheckBox = ( XCheckBox )UnoRuntime.queryInterface(
|
||||
XCheckBox xCheckBox = UnoRuntime.queryInterface(
|
||||
XCheckBox.class, objectCheckBox );
|
||||
xCheckBox.addItemListener((XItemListener) new ItemListenerImpl( xControlCont ) );
|
||||
xCheckBox.addItemListener(new ItemListenerImpl( xControlCont ) );
|
||||
}
|
||||
|
||||
// create a peer
|
||||
Object toolkit = xMultiComponentFactory.createInstanceWithContext(
|
||||
"com.sun.star.awt.ExtToolkit", _xComponentContext );
|
||||
XToolkit xToolkit = ( XToolkit )UnoRuntime.queryInterface(
|
||||
XToolkit xToolkit = UnoRuntime.queryInterface(
|
||||
XToolkit.class, toolkit );
|
||||
XWindow xWindow = ( XWindow )UnoRuntime.queryInterface(
|
||||
XWindow xWindow = UnoRuntime.queryInterface(
|
||||
XWindow.class, xControl );
|
||||
xWindow.setVisible( false );
|
||||
xControl.createPeer( xToolkit, null );
|
||||
|
||||
// return the dialog
|
||||
XDialog xDialog = ( XDialog )UnoRuntime.queryInterface(
|
||||
XDialog xDialog = UnoRuntime.queryInterface(
|
||||
XDialog.class, dialog );
|
||||
return xDialog;
|
||||
}
|
||||
@@ -468,14 +468,14 @@ XInitialization {
|
||||
|
||||
public void dispose ()
|
||||
{
|
||||
XComponent xComponent = ( XComponent )UnoRuntime.queryInterface(
|
||||
XComponent xComponent = UnoRuntime.queryInterface(
|
||||
XComponent.class, _xDialog );
|
||||
xComponent.dispose();
|
||||
}
|
||||
|
||||
public void addEventListener ( com.sun.star.lang.XEventListener xListener )
|
||||
{
|
||||
XComponent xComponent = ( XComponent )UnoRuntime.queryInterface(
|
||||
XComponent xComponent = UnoRuntime.queryInterface(
|
||||
XComponent.class, _xDialog );
|
||||
xComponent.addEventListener( xListener );
|
||||
}
|
||||
@@ -483,7 +483,7 @@ XInitialization {
|
||||
|
||||
public void removeEventListener ( com.sun.star.lang.XEventListener aListener )
|
||||
{
|
||||
XComponent xComponent = ( XComponent )UnoRuntime.queryInterface(
|
||||
XComponent xComponent = UnoRuntime.queryInterface(
|
||||
XComponent.class, _xDialog );
|
||||
xComponent.removeEventListener( aListener );
|
||||
}
|
||||
@@ -514,7 +514,7 @@ XInitialization {
|
||||
private XCheckBox _xCheckBox;
|
||||
public ItemListenerImpl( XControlContainer xControlCont ) {
|
||||
Object objectCheckBox = xControlCont.getControl( _checkBoxName );
|
||||
_xCheckBox = ( XCheckBox )UnoRuntime.queryInterface(
|
||||
_xCheckBox = UnoRuntime.queryInterface(
|
||||
XCheckBox.class, objectCheckBox );
|
||||
}
|
||||
|
||||
|
||||
@@ -80,14 +80,13 @@ public class DialogFactory
|
||||
}
|
||||
|
||||
// add an action listener to the button controls
|
||||
XControlContainer controls = (XControlContainer)
|
||||
UnoRuntime.queryInterface(XControlContainer.class, xDialog);
|
||||
XControlContainer controls = UnoRuntime.queryInterface(XControlContainer.class, xDialog);
|
||||
|
||||
XButton okButton = (XButton) UnoRuntime.queryInterface(
|
||||
XButton okButton = UnoRuntime.queryInterface(
|
||||
XButton.class, controls.getControl("Ok"));
|
||||
okButton.setActionCommand("Ok");
|
||||
|
||||
XButton cancelButton = (XButton) UnoRuntime.queryInterface(
|
||||
XButton cancelButton = UnoRuntime.queryInterface(
|
||||
XButton.class, controls.getControl("Cancel"));
|
||||
cancelButton.setActionCommand("Cancel");
|
||||
|
||||
@@ -137,20 +136,18 @@ public class DialogFactory
|
||||
}
|
||||
|
||||
// add an action listener to the button controls
|
||||
XControlContainer controls = (XControlContainer)
|
||||
UnoRuntime.queryInterface(XControlContainer.class, xDialog);
|
||||
XControlContainer controls = UnoRuntime.queryInterface(XControlContainer.class, xDialog);
|
||||
|
||||
XButton okButton = (XButton) UnoRuntime.queryInterface(
|
||||
XButton okButton = UnoRuntime.queryInterface(
|
||||
XButton.class, controls.getControl("Ok"));
|
||||
okButton.setActionCommand("Ok");
|
||||
|
||||
XButton cancelButton = (XButton) UnoRuntime.queryInterface(
|
||||
XButton cancelButton = UnoRuntime.queryInterface(
|
||||
XButton.class, controls.getControl("Cancel"));
|
||||
cancelButton.setActionCommand("Cancel");
|
||||
|
||||
final XTextComponent textField = (XTextComponent)
|
||||
UnoRuntime.queryInterface(
|
||||
XTextComponent.class, controls.getControl("NameField"));
|
||||
final XTextComponent textField = UnoRuntime.queryInterface(
|
||||
XTextComponent.class, controls.getControl("NameField"));
|
||||
|
||||
final ResultHolder resultHolder = new ResultHolder();
|
||||
|
||||
@@ -204,7 +201,7 @@ public class DialogFactory
|
||||
Object dialogModel = xMultiComponentFactory.createInstanceWithContext(
|
||||
"com.sun.star.awt.UnoControlDialogModel", xComponentContext);
|
||||
|
||||
XPropertySet props = (XPropertySet) UnoRuntime.queryInterface(
|
||||
XPropertySet props = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, dialogModel);
|
||||
|
||||
props.setPropertyValue("Title", title);
|
||||
@@ -212,8 +209,8 @@ public class DialogFactory
|
||||
|
||||
// get the service manager from the dialog model
|
||||
XMultiServiceFactory xMultiServiceFactory =
|
||||
(XMultiServiceFactory) UnoRuntime.queryInterface(
|
||||
XMultiServiceFactory.class, dialogModel);
|
||||
UnoRuntime.queryInterface(
|
||||
XMultiServiceFactory.class, dialogModel);
|
||||
|
||||
// create the label model and set the properties
|
||||
Object label = xMultiServiceFactory.createInstance(
|
||||
@@ -221,7 +218,7 @@ public class DialogFactory
|
||||
|
||||
setDimensions(label, 15, 5, 134, 12);
|
||||
|
||||
XPropertySet labelProps = (XPropertySet) UnoRuntime.queryInterface(
|
||||
XPropertySet labelProps = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, label);
|
||||
labelProps.setPropertyValue("Name", "PromptLabel");
|
||||
labelProps.setPropertyValue("Label", prompt);
|
||||
@@ -232,7 +229,7 @@ public class DialogFactory
|
||||
|
||||
setDimensions(okButtonModel, 40, 18, 38, 15);
|
||||
|
||||
XPropertySet buttonProps = (XPropertySet) UnoRuntime.queryInterface(
|
||||
XPropertySet buttonProps = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, okButtonModel);
|
||||
buttonProps.setPropertyValue("Name", "Ok");
|
||||
buttonProps.setPropertyValue("Label", "Ok");
|
||||
@@ -243,13 +240,13 @@ public class DialogFactory
|
||||
|
||||
setDimensions(cancelButtonModel, 83, 18, 38, 15);
|
||||
|
||||
buttonProps = (XPropertySet) UnoRuntime.queryInterface(
|
||||
buttonProps = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, cancelButtonModel);
|
||||
buttonProps.setPropertyValue("Name", "Cancel");
|
||||
buttonProps.setPropertyValue("Label", "Cancel");
|
||||
|
||||
// insert the control models into the dialog model
|
||||
XNameContainer xNameCont = (XNameContainer) UnoRuntime.queryInterface(
|
||||
XNameContainer xNameCont = UnoRuntime.queryInterface(
|
||||
XNameContainer.class, dialogModel);
|
||||
|
||||
xNameCont.insertByName("PromptLabel", label);
|
||||
@@ -259,31 +256,29 @@ public class DialogFactory
|
||||
// create the dialog control and set the model
|
||||
Object dialog = xMultiComponentFactory.createInstanceWithContext(
|
||||
"com.sun.star.awt.UnoControlDialog", xComponentContext);
|
||||
XControl xControl = (XControl) UnoRuntime.queryInterface(
|
||||
XControl xControl = UnoRuntime.queryInterface(
|
||||
XControl.class, dialog);
|
||||
|
||||
XControlModel xControlModel = (XControlModel)
|
||||
UnoRuntime.queryInterface(XControlModel.class, dialogModel);
|
||||
XControlModel xControlModel = UnoRuntime.queryInterface(XControlModel.class, dialogModel);
|
||||
xControl.setModel(xControlModel);
|
||||
|
||||
// create a peer
|
||||
Object toolkit = xMultiComponentFactory.createInstanceWithContext(
|
||||
"com.sun.star.awt.ExtToolkit", xComponentContext);
|
||||
XToolkit xToolkit = (XToolkit) UnoRuntime.queryInterface(
|
||||
XToolkit xToolkit = UnoRuntime.queryInterface(
|
||||
XToolkit.class, toolkit);
|
||||
XWindow xWindow = (XWindow) UnoRuntime.queryInterface(
|
||||
XWindow xWindow = UnoRuntime.queryInterface(
|
||||
XWindow.class, xControl);
|
||||
xWindow.setVisible(false);
|
||||
xControl.createPeer(xToolkit, null);
|
||||
|
||||
return (XDialog) UnoRuntime.queryInterface(XDialog.class, dialog);
|
||||
return UnoRuntime.queryInterface(XDialog.class, dialog);
|
||||
}
|
||||
|
||||
private void setDimensions(Object o, int x, int y, int width, int height)
|
||||
throws com.sun.star.uno.Exception
|
||||
{
|
||||
XPropertySet props = (XPropertySet)
|
||||
UnoRuntime.queryInterface(XPropertySet.class, o);
|
||||
XPropertySet props = UnoRuntime.queryInterface(XPropertySet.class, o);
|
||||
|
||||
props.setPropertyValue("PositionX", new Integer(x));
|
||||
props.setPropertyValue("PositionY", new Integer(y));
|
||||
@@ -314,14 +309,14 @@ public class DialogFactory
|
||||
|
||||
setDimensions(dialogModel, 100, 100, 157, 58);
|
||||
|
||||
XPropertySet props = (XPropertySet) UnoRuntime.queryInterface(
|
||||
XPropertySet props = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, dialogModel);
|
||||
props.setPropertyValue("Title", title);
|
||||
|
||||
// get the service manager from the dialog model
|
||||
XMultiServiceFactory xMultiServiceFactory =
|
||||
(XMultiServiceFactory) UnoRuntime.queryInterface(
|
||||
XMultiServiceFactory.class, dialogModel);
|
||||
UnoRuntime.queryInterface(
|
||||
XMultiServiceFactory.class, dialogModel);
|
||||
|
||||
// create the label model and set the properties
|
||||
Object label = xMultiServiceFactory.createInstance(
|
||||
@@ -329,7 +324,7 @@ public class DialogFactory
|
||||
|
||||
setDimensions(label, 15, 5, 134, 12);
|
||||
|
||||
XPropertySet labelProps = (XPropertySet) UnoRuntime.queryInterface(
|
||||
XPropertySet labelProps = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, label);
|
||||
labelProps.setPropertyValue("Name", "PromptLabel");
|
||||
labelProps.setPropertyValue("Label", prompt);
|
||||
@@ -340,7 +335,7 @@ public class DialogFactory
|
||||
|
||||
setDimensions(edit, 15, 18, 134, 12);
|
||||
|
||||
XPropertySet editProps = (XPropertySet) UnoRuntime.queryInterface(
|
||||
XPropertySet editProps = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, edit);
|
||||
editProps.setPropertyValue("Name", "NameField");
|
||||
|
||||
@@ -350,7 +345,7 @@ public class DialogFactory
|
||||
|
||||
setDimensions(okButtonModel, 40, 39, 38, 15);
|
||||
|
||||
XPropertySet buttonProps = (XPropertySet) UnoRuntime.queryInterface(
|
||||
XPropertySet buttonProps = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, okButtonModel);
|
||||
buttonProps.setPropertyValue("Name", "Ok");
|
||||
buttonProps.setPropertyValue("Label", "Ok");
|
||||
@@ -361,14 +356,13 @@ public class DialogFactory
|
||||
|
||||
setDimensions(cancelButtonModel, 83, 39, 38, 15);
|
||||
|
||||
buttonProps = (XPropertySet) UnoRuntime.queryInterface(
|
||||
buttonProps = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, cancelButtonModel);
|
||||
buttonProps.setPropertyValue("Name", "Cancel");
|
||||
buttonProps.setPropertyValue("Label", "Cancel");
|
||||
|
||||
// insert the control models into the dialog model
|
||||
XNameContainer xNameCont = (XNameContainer)
|
||||
UnoRuntime.queryInterface(XNameContainer.class, dialogModel);
|
||||
XNameContainer xNameCont = UnoRuntime.queryInterface(XNameContainer.class, dialogModel);
|
||||
|
||||
xNameCont.insertByName("PromptLabel", label);
|
||||
xNameCont.insertByName("NameField", edit);
|
||||
@@ -378,24 +372,23 @@ public class DialogFactory
|
||||
// create the dialog control and set the model
|
||||
Object dialog = xMultiComponentFactory.createInstanceWithContext(
|
||||
"com.sun.star.awt.UnoControlDialog", xComponentContext);
|
||||
XControl xControl = (XControl) UnoRuntime.queryInterface(
|
||||
XControl xControl = UnoRuntime.queryInterface(
|
||||
XControl.class, dialog);
|
||||
|
||||
XControlModel xControlModel = (XControlModel)
|
||||
UnoRuntime.queryInterface(XControlModel.class, dialogModel);
|
||||
XControlModel xControlModel = UnoRuntime.queryInterface(XControlModel.class, dialogModel);
|
||||
xControl.setModel(xControlModel);
|
||||
|
||||
// create a peer
|
||||
Object toolkit = xMultiComponentFactory.createInstanceWithContext(
|
||||
"com.sun.star.awt.ExtToolkit", xComponentContext);
|
||||
XToolkit xToolkit = (XToolkit) UnoRuntime.queryInterface(
|
||||
XToolkit xToolkit = UnoRuntime.queryInterface(
|
||||
XToolkit.class, toolkit);
|
||||
XWindow xWindow = (XWindow) UnoRuntime.queryInterface(
|
||||
XWindow xWindow = UnoRuntime.queryInterface(
|
||||
XWindow.class, xControl);
|
||||
xWindow.setVisible(false);
|
||||
xControl.createPeer(xToolkit, null);
|
||||
|
||||
return (XDialog) UnoRuntime.queryInterface(XDialog.class, dialog);
|
||||
return UnoRuntime.queryInterface(XDialog.class, dialog);
|
||||
}
|
||||
|
||||
private static class ResultHolder {
|
||||
|
||||
@@ -99,11 +99,10 @@ public class ParcelBrowseNode extends PropertySet
|
||||
XMultiComponentFactory xFac = xCtx.getServiceManager();
|
||||
try
|
||||
{
|
||||
XSimpleFileAccess xSFA = ( XSimpleFileAccess)
|
||||
UnoRuntime.queryInterface( XSimpleFileAccess.class,
|
||||
xFac.createInstanceWithContext(
|
||||
"com.sun.star.ucb.SimpleFileAccess",
|
||||
xCtx ) );
|
||||
XSimpleFileAccess xSFA = UnoRuntime.queryInterface( XSimpleFileAccess.class,
|
||||
xFac.createInstanceWithContext(
|
||||
"com.sun.star.ucb.SimpleFileAccess",
|
||||
xCtx ) );
|
||||
if ( xSFA != null && ( xSFA.isReadOnly( parcelDirUrl ) ||
|
||||
container.isUnoPkg() ) )
|
||||
{
|
||||
@@ -221,7 +220,7 @@ public class ParcelBrowseNode extends PropertySet
|
||||
}
|
||||
}
|
||||
else {
|
||||
newName = (String) AnyConverter.toString(aParams[0]);
|
||||
newName = AnyConverter.toString(aParams[0]);
|
||||
}
|
||||
|
||||
if ( newName == null || newName.equals(""))
|
||||
@@ -234,7 +233,7 @@ public class ParcelBrowseNode extends PropertySet
|
||||
String languageName = newName + "." + provider.getScriptEditor().getExtension();
|
||||
String language = container.getLanguage();
|
||||
|
||||
ScriptEntry entry = new ScriptEntry( language, languageName, languageName, "", new HashMap() );
|
||||
ScriptEntry entry = new ScriptEntry( language, languageName, languageName, "", new HashMap<String,String>() );
|
||||
|
||||
Parcel parcel = (Parcel)container.getByName( getName() );
|
||||
ScriptMetaData data = new ScriptMetaData( parcel, entry, source );
|
||||
@@ -311,7 +310,7 @@ public class ParcelBrowseNode extends PropertySet
|
||||
}
|
||||
}
|
||||
else {
|
||||
newName = (String) AnyConverter.toString(aParams[0]);
|
||||
newName = AnyConverter.toString(aParams[0]);
|
||||
}
|
||||
container.renameParcel( getName(), newName );
|
||||
Parcel p = (Parcel)container.getByName( newName );
|
||||
|
||||
@@ -74,11 +74,10 @@ public class ProviderBrowseNode extends PropertySet
|
||||
XMultiComponentFactory xFac = m_xCtx.getServiceManager();
|
||||
try
|
||||
{
|
||||
xSFA = ( XSimpleFileAccess)
|
||||
UnoRuntime.queryInterface( XSimpleFileAccess.class,
|
||||
xFac.createInstanceWithContext(
|
||||
"com.sun.star.ucb.SimpleFileAccess",
|
||||
xCtx ) );
|
||||
xSFA = UnoRuntime.queryInterface( XSimpleFileAccess.class,
|
||||
xFac.createInstanceWithContext(
|
||||
"com.sun.star.ucb.SimpleFileAccess",
|
||||
xCtx ) );
|
||||
if ( container.isUnoPkg() || xSFA.isReadOnly( container.getParcelContainerDir() ) )
|
||||
{
|
||||
deletable = false;
|
||||
@@ -209,7 +208,7 @@ public class ProviderBrowseNode extends PropertySet
|
||||
}
|
||||
}
|
||||
else {
|
||||
name = (String) AnyConverter.toString(aParams[0]);
|
||||
name = AnyConverter.toString(aParams[0]);
|
||||
}
|
||||
|
||||
if (name == null || name.equals(""))
|
||||
|
||||
@@ -71,11 +71,10 @@ public class ScriptBrowseNode extends PropertySet
|
||||
try
|
||||
{
|
||||
data = (ScriptMetaData)parent.getByName( name );
|
||||
xSFA = ( XSimpleFileAccess)
|
||||
UnoRuntime.queryInterface( XSimpleFileAccess.class,
|
||||
xFac.createInstanceWithContext(
|
||||
"com.sun.star.ucb.SimpleFileAccess",
|
||||
xCtx ) );
|
||||
xSFA = UnoRuntime.queryInterface( XSimpleFileAccess.class,
|
||||
xFac.createInstanceWithContext(
|
||||
"com.sun.star.ucb.SimpleFileAccess",
|
||||
xCtx ) );
|
||||
}
|
||||
|
||||
// TODO fix exception types to be caught here, should we rethrow?
|
||||
@@ -250,7 +249,7 @@ public class ScriptBrowseNode extends PropertySet
|
||||
|
||||
try
|
||||
{
|
||||
String newName = (String) AnyConverter.toString(aParams[0]);
|
||||
String newName = AnyConverter.toString(aParams[0]);
|
||||
ScriptMetaData oldData = (ScriptMetaData)parent.getByName( name );
|
||||
oldData.loadSource();
|
||||
String oldSource = oldData.getSource();
|
||||
@@ -261,7 +260,7 @@ public class ScriptBrowseNode extends PropertySet
|
||||
String language = provider.getName();
|
||||
|
||||
ScriptEntry entry = new ScriptEntry(
|
||||
language, languageName, languageName, "", new HashMap() );
|
||||
language, languageName, languageName, "", new HashMap<String,String>() );
|
||||
|
||||
ScriptMetaData data = new ScriptMetaData(
|
||||
parent, entry, oldSource );
|
||||
|
||||
@@ -218,8 +218,7 @@ public class Parcel implements XNameContainer
|
||||
String pathToDescriptor = PathUtils.make_url(
|
||||
getPathToParcel(), ParcelDescriptor.PARCEL_DESCRIPTOR_NAME );
|
||||
|
||||
XSimpleFileAccess2 xSFA2 = ( XSimpleFileAccess2 )
|
||||
UnoRuntime.queryInterface( XSimpleFileAccess2.class, m_xSFA );
|
||||
XSimpleFileAccess2 xSFA2 = UnoRuntime.queryInterface( XSimpleFileAccess2.class, m_xSFA );
|
||||
|
||||
if ( xSFA2 != null )
|
||||
{
|
||||
|
||||
@@ -290,7 +290,7 @@ public class ParcelContainer implements XNameAccess
|
||||
}
|
||||
try
|
||||
{
|
||||
m_xSFA = ( XSimpleFileAccess )UnoRuntime.queryInterface(
|
||||
m_xSFA = UnoRuntime.queryInterface(
|
||||
XSimpleFileAccess.class,
|
||||
m_xCtx.getServiceManager().createInstanceWithContext(
|
||||
"com.sun.star.ucb.SimpleFileAccess", m_xCtx ) );
|
||||
@@ -454,8 +454,7 @@ public class ParcelContainer implements XNameAccess
|
||||
ParcelDescriptor pd = new ParcelDescriptor();
|
||||
pd.setLanguage( language );
|
||||
String parcelDesc = PathUtils.make_url( pathToParcel, ParcelDescriptor.PARCEL_DESCRIPTOR_NAME );
|
||||
XSimpleFileAccess2 xSFA2 = ( XSimpleFileAccess2 )
|
||||
UnoRuntime.queryInterface( XSimpleFileAccess2.class, m_xSFA );
|
||||
XSimpleFileAccess2 xSFA2 = UnoRuntime.queryInterface( XSimpleFileAccess2.class, m_xSFA );
|
||||
if ( xSFA2 != null )
|
||||
{
|
||||
LogUtils.DEBUG("createParcel() Using XSIMPLEFILEACCESS2 " + parcelDesc );
|
||||
@@ -667,10 +666,9 @@ public ParsedScriptUri parseScriptUri( String scriptURI ) throws com.sun.star.l
|
||||
try
|
||||
{
|
||||
xMcFac = m_xCtx.getServiceManager();
|
||||
xFac = ( XUriReferenceFactory )
|
||||
UnoRuntime.queryInterface( XUriReferenceFactory.class,
|
||||
xMcFac.createInstanceWithContext(
|
||||
"com.sun.star.uri.UriReferenceFactory", m_xCtx ) );
|
||||
xFac = UnoRuntime.queryInterface( XUriReferenceFactory.class,
|
||||
xMcFac.createInstanceWithContext(
|
||||
"com.sun.star.uri.UriReferenceFactory", m_xCtx ) );
|
||||
}
|
||||
catch( com.sun.star.uno.Exception e )
|
||||
{
|
||||
@@ -684,8 +682,7 @@ public ParsedScriptUri parseScriptUri( String scriptURI ) throws com.sun.star.l
|
||||
}
|
||||
|
||||
XUriReference uriRef = xFac.parse( scriptURI );
|
||||
XVndSunStarScriptUrl sfUri = ( XVndSunStarScriptUrl )
|
||||
UnoRuntime.queryInterface( XVndSunStarScriptUrl.class, uriRef );
|
||||
XVndSunStarScriptUrl sfUri = UnoRuntime.queryInterface( XVndSunStarScriptUrl.class, uriRef );
|
||||
|
||||
if ( sfUri == null )
|
||||
{
|
||||
|
||||
@@ -294,10 +294,10 @@ public class ParcelDescriptor {
|
||||
addScriptEntry(scripts[i]);
|
||||
}
|
||||
|
||||
public void setScriptEntries(Enumeration scripts) {
|
||||
public void setScriptEntries(Enumeration<ScriptEntry> scripts) {
|
||||
clearEntries();
|
||||
while (scripts.hasMoreElements())
|
||||
addScriptEntry((ScriptEntry) scripts.nextElement());
|
||||
addScriptEntry(scripts.nextElement());
|
||||
}
|
||||
|
||||
public String getLanguageProperty(String name) {
|
||||
@@ -427,7 +427,7 @@ public class ParcelDescriptor {
|
||||
Iterator<String> iter = languagedepprops.keySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
tempitem = document.createElement("prop");
|
||||
key = (String)iter.next();
|
||||
key = iter.next();
|
||||
tempitem.setAttribute("name", key);
|
||||
tempitem.setAttribute("value", languagedepprops.get(key));
|
||||
item.appendChild(tempitem);
|
||||
|
||||
@@ -27,7 +27,7 @@ public class ScriptEntry implements Cloneable {
|
||||
private String logicalname = "";
|
||||
private String description = "";
|
||||
|
||||
private Map languagedepprops;
|
||||
private Map<String,String> languagedepprops;
|
||||
|
||||
public ScriptEntry(String language, String languagename,
|
||||
String logicalname, String location) {
|
||||
@@ -39,7 +39,7 @@ public class ScriptEntry implements Cloneable {
|
||||
// as logical name also
|
||||
this.logicalname = languagename;
|
||||
this.location = location;
|
||||
this.languagedepprops = new HashMap();
|
||||
this.languagedepprops = new HashMap<String,String>();
|
||||
}
|
||||
|
||||
public ScriptEntry(ScriptEntry entry)
|
||||
@@ -53,14 +53,14 @@ public class ScriptEntry implements Cloneable {
|
||||
}
|
||||
|
||||
public ScriptEntry(String language, String languagename,
|
||||
String logicalname, String location, Map languagedepprops) {
|
||||
String logicalname, String location, Map<String,String> languagedepprops) {
|
||||
this( language, languagename, logicalname, location );
|
||||
this.languagedepprops = languagedepprops;
|
||||
}
|
||||
|
||||
public ScriptEntry(String language, String languagename,
|
||||
String logicalname, String location,
|
||||
Map languagedepprops, String description) {
|
||||
Map<String,String> languagedepprops, String description) {
|
||||
this( language, languagename, logicalname, location );
|
||||
this.languagedepprops = languagedepprops;
|
||||
this.description = description;
|
||||
@@ -84,7 +84,7 @@ public class ScriptEntry implements Cloneable {
|
||||
return false;
|
||||
}
|
||||
|
||||
public Map getLanguageProperties()
|
||||
public Map<String,String> getLanguageProperties()
|
||||
{
|
||||
return languagedepprops;
|
||||
}
|
||||
|
||||
@@ -249,8 +249,7 @@ public class ScriptMetaData extends ScriptEntry implements Cloneable {
|
||||
{
|
||||
try
|
||||
{
|
||||
String classpath = (String)getLanguageProperties().get("classpath");
|
||||
ArrayList paths = null;
|
||||
String classpath = getLanguageProperties().get("classpath");
|
||||
|
||||
if ( classpath == null )
|
||||
{
|
||||
@@ -271,7 +270,7 @@ public class ScriptMetaData extends ScriptEntry implements Cloneable {
|
||||
StringTokenizer stk = new StringTokenizer(classpath, ":");
|
||||
while ( stk.hasMoreElements() )
|
||||
{
|
||||
String relativeClasspath = (String)stk.nextElement();
|
||||
String relativeClasspath = stk.nextToken();
|
||||
String pathToProcess = PathUtils.make_url( parcelPath, relativeClasspath);
|
||||
URL url = expandURL( context, pathToProcess );
|
||||
if ( url != null )
|
||||
@@ -388,9 +387,8 @@ public class ScriptMetaData extends ScriptEntry implements Cloneable {
|
||||
OutputStream os = null;
|
||||
try
|
||||
{
|
||||
XSimpleFileAccess2 xSFA2 = ( XSimpleFileAccess2 )
|
||||
UnoRuntime.queryInterface( XSimpleFileAccess2.class,
|
||||
parent.m_xSFA );
|
||||
XSimpleFileAccess2 xSFA2 = UnoRuntime.queryInterface( XSimpleFileAccess2.class,
|
||||
parent.m_xSFA );
|
||||
if ( xSFA2 != null )
|
||||
{
|
||||
ByteArrayInputStream bis = new ByteArrayInputStream( getSourceBytes() );
|
||||
|
||||
@@ -275,7 +275,7 @@ public class UnoPkgContainer extends ParcelContainer
|
||||
// String path = containerUrl.substring( 0, containerUrl.lastIndexOf("/") );
|
||||
String packagesUrl = PathUtils.make_url( extensionDb, "/Scripts/" + extensionRepository + "-extension-desc.xml" );
|
||||
xos = m_xSFA.openFileWrite( packagesUrl );
|
||||
XTruncate xTrc = (XTruncate) UnoRuntime.queryInterface( XTruncate.class, xos );
|
||||
XTruncate xTrc = UnoRuntime.queryInterface( XTruncate.class, xos );
|
||||
if ( xTrc != null )
|
||||
{
|
||||
LogUtils.DEBUG("In writeUnoPackageDB() Truncating...." );
|
||||
|
||||
@@ -114,7 +114,7 @@ public class UCBStreamHandler extends URLStreamHandler {
|
||||
|
||||
// we will only deal with simple file write
|
||||
XOutputStream xos = m_xSimpleFileAccess.openFileWrite( path );
|
||||
XTruncate xtrunc = ( XTruncate ) UnoRuntime.queryInterface( XTruncate.class, xos );
|
||||
XTruncate xtrunc = UnoRuntime.queryInterface( XTruncate.class, xos );
|
||||
if ( xtrunc != null )
|
||||
{
|
||||
xtrunc.truncate();
|
||||
@@ -197,7 +197,7 @@ public class UCBStreamHandler extends URLStreamHandler {
|
||||
zis = new ZipInputStream(is);
|
||||
|
||||
while (zis.available() != 0) {
|
||||
entry = (ZipEntry)zis.getNextEntry();
|
||||
entry = zis.getNextEntry();
|
||||
|
||||
if (entry.getName().equals(file)) {
|
||||
return zis;
|
||||
|
||||
@@ -83,8 +83,8 @@ public class XStorageHelper implements XEventListener
|
||||
throw new IOException("Invalid path");
|
||||
}
|
||||
XDocumentSubStorageSupplier xDocumentSubStorageSupplier =
|
||||
(XDocumentSubStorageSupplier) UnoRuntime.queryInterface(
|
||||
XDocumentSubStorageSupplier.class, xModel);
|
||||
UnoRuntime.queryInterface(
|
||||
XDocumentSubStorageSupplier.class, xModel);
|
||||
xStorages = new XStorage[tokens.countTokens() ];
|
||||
LogUtils.DEBUG("XStorageHelper ctor, path chunks length: " + xStorages.length );
|
||||
|
||||
@@ -101,7 +101,7 @@ public class XStorageHelper implements XEventListener
|
||||
{
|
||||
LogUtils.DEBUG("** boo hoo Storage is null " );
|
||||
}
|
||||
XPropertySet xProps = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,storage );
|
||||
XPropertySet xProps = UnoRuntime.queryInterface(XPropertySet.class,storage );
|
||||
if ( xProps != null )
|
||||
{
|
||||
String mediaType = AnyConverter.toString( xProps.getPropertyValue( "MediaType" ) );
|
||||
@@ -114,8 +114,7 @@ public class XStorageHelper implements XEventListener
|
||||
}
|
||||
else
|
||||
{
|
||||
XNameAccess xNameAccess = (XNameAccess)
|
||||
UnoRuntime.queryInterface(XNameAccess.class, xStorages[i-1]);
|
||||
XNameAccess xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, xStorages[i-1]);
|
||||
if (xNameAccess == null )
|
||||
{
|
||||
disposeObject();
|
||||
@@ -162,8 +161,7 @@ public class XStorageHelper implements XEventListener
|
||||
{
|
||||
// TODO needs to cater for model for untitled document
|
||||
modelMap.put( PathUtils.getOidForModel( model ), model );
|
||||
XComponent xComp = (XComponent)
|
||||
UnoRuntime.queryInterface(XComponent.class, model);
|
||||
XComponent xComp = UnoRuntime.queryInterface(XComponent.class, model);
|
||||
|
||||
if ( xComp != null )
|
||||
{
|
||||
@@ -181,8 +179,7 @@ public class XStorageHelper implements XEventListener
|
||||
|
||||
public void disposing( EventObject Source )
|
||||
{
|
||||
XModel model = (XModel)
|
||||
UnoRuntime.queryInterface(XModel.class,Source.Source );
|
||||
XModel model = UnoRuntime.queryInterface(XModel.class,Source.Source );
|
||||
|
||||
if ( model != null )
|
||||
{
|
||||
@@ -234,8 +231,7 @@ public class XStorageHelper implements XEventListener
|
||||
return;
|
||||
}
|
||||
|
||||
XComponent xComponent = (XComponent)
|
||||
UnoRuntime.queryInterface(XComponent.class, xInterface);
|
||||
XComponent xComponent = UnoRuntime.queryInterface(XComponent.class, xInterface);
|
||||
|
||||
if (xComponent == null) {
|
||||
return;
|
||||
@@ -244,8 +240,7 @@ public class XStorageHelper implements XEventListener
|
||||
}
|
||||
static public void commit( XInterface xInterface )
|
||||
{
|
||||
XTransactedObject xTrans = (XTransactedObject)
|
||||
UnoRuntime.queryInterface(XTransactedObject.class, xInterface);
|
||||
XTransactedObject xTrans = UnoRuntime.queryInterface(XTransactedObject.class, xInterface);
|
||||
if ( xTrans != null )
|
||||
{
|
||||
try
|
||||
|
||||
@@ -52,7 +52,7 @@ public class EditorScriptContext implements XScriptContext
|
||||
*/
|
||||
public XModel getDocument()
|
||||
{
|
||||
XModel xModel = ( XModel ) UnoRuntime.queryInterface( XModel.class,
|
||||
XModel xModel = UnoRuntime.queryInterface( XModel.class,
|
||||
m_xDeskTop.getCurrentComponent() );
|
||||
|
||||
return xModel;
|
||||
@@ -60,7 +60,7 @@ public class EditorScriptContext implements XScriptContext
|
||||
|
||||
public XScriptInvocationContext getInvocationContext()
|
||||
{
|
||||
XScriptInvocationContext xContext = ( XScriptInvocationContext ) UnoRuntime.queryInterface(
|
||||
XScriptInvocationContext xContext = UnoRuntime.queryInterface(
|
||||
XScriptInvocationContext.class, getDocument() );
|
||||
return xContext;
|
||||
}
|
||||
|
||||
@@ -94,8 +94,7 @@ public class ScriptContext extends PropertySet implements XScriptContext
|
||||
|
||||
xInterface = xMCF.createInstanceWithContext(
|
||||
"com.sun.star.frame.Desktop", xCtxt);
|
||||
xDesktop = (XDesktop)
|
||||
UnoRuntime.queryInterface(XDesktop.class, xInterface);
|
||||
xDesktop = UnoRuntime.queryInterface(XDesktop.class, xInterface);
|
||||
if ( xModel != null )
|
||||
{
|
||||
sc = new ScriptContext(xCtxt, xDesktop, xModel, xInvocContext);
|
||||
|
||||
@@ -168,19 +168,19 @@ public abstract class ScriptProvider
|
||||
if ( AnyConverter.getType(aArguments[0]).getTypeClass().equals(TypeClass.INTERFACE) )
|
||||
{
|
||||
// try whether it denotes a XScriptInvocationContext
|
||||
m_xInvocContext = (XScriptInvocationContext)UnoRuntime.queryInterface(
|
||||
m_xInvocContext = UnoRuntime.queryInterface(
|
||||
XScriptInvocationContext.class, aArguments[0]);
|
||||
if ( m_xInvocContext != null )
|
||||
{
|
||||
// if so, obtain the document - by definition, this must be
|
||||
// the ScriptContainer
|
||||
m_xModel = (XModel)UnoRuntime.queryInterface( XModel.class,
|
||||
m_xModel = UnoRuntime.queryInterface( XModel.class,
|
||||
m_xInvocContext.getScriptContainer() );
|
||||
}
|
||||
else
|
||||
{
|
||||
// otherwise, check whether it's an XModel
|
||||
m_xModel = (XModel)UnoRuntime.queryInterface( XModel.class,
|
||||
m_xModel = UnoRuntime.queryInterface( XModel.class,
|
||||
m_xInvocContext.getScriptContainer() );
|
||||
}
|
||||
if ( m_xModel == null )
|
||||
@@ -261,8 +261,8 @@ public abstract class ScriptProvider
|
||||
m_xBrowseNodeProxy = new ProviderBrowseNode( this,
|
||||
m_container, m_xContext );
|
||||
|
||||
m_xInvocationProxy = (XInvocation)UnoRuntime.queryInterface(XInvocation.class, m_xBrowseNodeProxy);
|
||||
m_xPropertySetProxy = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, m_xBrowseNodeProxy);
|
||||
m_xInvocationProxy = UnoRuntime.queryInterface(XInvocation.class, m_xBrowseNodeProxy);
|
||||
m_xPropertySetProxy = UnoRuntime.queryInterface(XPropertySet.class, m_xBrowseNodeProxy);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -608,7 +608,7 @@ public abstract class ScriptProvider
|
||||
public void insertByName( String aName, java.lang.Object aElement ) throws com.sun.star.lang.IllegalArgumentException, com.sun.star.container.ElementExistException, com.sun.star.lang.WrappedTargetException
|
||||
{
|
||||
LogUtils.DEBUG("Provider for " + language + " received register for package " + aName );
|
||||
XPackage newPackage = ( XPackage ) UnoRuntime.queryInterface( XPackage.class, aElement );
|
||||
XPackage newPackage = UnoRuntime.queryInterface( XPackage.class, aElement );
|
||||
if ( aName.length() == 0 )
|
||||
{
|
||||
throw new com.sun.star.lang.IllegalArgumentException( "Empty name" );
|
||||
@@ -660,7 +660,7 @@ public abstract class ScriptProvider
|
||||
XTransientDocumentsDocumentContentFactory factory = null;
|
||||
try
|
||||
{
|
||||
factory = (XTransientDocumentsDocumentContentFactory)UnoRuntime.queryInterface(
|
||||
factory = UnoRuntime.queryInterface(
|
||||
XTransientDocumentsDocumentContentFactory.class,
|
||||
m_xMultiComponentFactory.createInstanceWithContext(
|
||||
"com.sun.star.frame.TransientDocumentsDocumentContentFactory",
|
||||
@@ -699,24 +699,21 @@ public abstract class ScriptProvider
|
||||
Object ucb = m_xMultiComponentFactory.createInstanceWithArgumentsAndContext( "com.sun.star.ucb.UniversalContentBroker", args, m_xContext );
|
||||
|
||||
|
||||
XContentIdentifierFactory xFac = ( XContentIdentifierFactory )
|
||||
UnoRuntime.queryInterface( XContentIdentifierFactory.class,
|
||||
ucb );
|
||||
XContentIdentifierFactory xFac = UnoRuntime.queryInterface( XContentIdentifierFactory.class,
|
||||
ucb );
|
||||
|
||||
|
||||
XContentIdentifier xCntId = xFac.createContentIdentifier( docUrl );
|
||||
|
||||
|
||||
XContentProvider xCntAccess = ( XContentProvider )
|
||||
UnoRuntime.queryInterface( XContentProvider.class,
|
||||
ucb );
|
||||
XContentProvider xCntAccess = UnoRuntime.queryInterface( XContentProvider.class,
|
||||
ucb );
|
||||
|
||||
|
||||
XContent xCnt = xCntAccess.queryContent( xCntId );
|
||||
|
||||
|
||||
XCommandProcessor xCmd = ( XCommandProcessor )
|
||||
UnoRuntime.queryInterface( XCommandProcessor.class, xCnt );
|
||||
XCommandProcessor xCmd = UnoRuntime.queryInterface( XCommandProcessor.class, xCnt );
|
||||
|
||||
|
||||
Property[] pArgs = new Property[ ] { new Property() };
|
||||
@@ -732,10 +729,10 @@ public abstract class ScriptProvider
|
||||
com.sun.star.ucb.XCommandEnvironment env = null ;
|
||||
Object result = xCmd.execute( command, 0, env ) ;
|
||||
|
||||
XRow values = ( XRow ) UnoRuntime.queryInterface( XRow.class,
|
||||
XRow values = UnoRuntime.queryInterface( XRow.class,
|
||||
result );
|
||||
|
||||
xModel = ( XModel ) UnoRuntime.queryInterface( XModel.class,
|
||||
xModel = UnoRuntime.queryInterface( XModel.class,
|
||||
values.getObject( 1, null ) );
|
||||
}
|
||||
catch ( Exception ignore )
|
||||
|
||||
+6
-7
@@ -59,7 +59,7 @@ public class ScriptEditorForBeanShell
|
||||
private static ScriptEditorForBeanShell theScriptEditorForBeanShell;
|
||||
|
||||
// global list of ScriptEditors, key is URL of file being edited
|
||||
private static Map BEING_EDITED = new HashMap();
|
||||
private static Map<URL,ScriptEditorForBeanShell> BEING_EDITED = new HashMap<URL,ScriptEditorForBeanShell>();
|
||||
|
||||
// template for new BeanShell scripts
|
||||
private static String BSHTEMPLATE;
|
||||
@@ -121,7 +121,7 @@ public class ScriptEditorForBeanShell
|
||||
public static ScriptEditorForBeanShell getEditor(URL url)
|
||||
{
|
||||
synchronized (BEING_EDITED) {
|
||||
return (ScriptEditorForBeanShell)BEING_EDITED.get(url);
|
||||
return BEING_EDITED.get(url);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,8 +211,7 @@ public class ScriptEditorForBeanShell
|
||||
public void run() {
|
||||
ScriptEditorForBeanShell editor;
|
||||
synchronized (BEING_EDITED) {
|
||||
editor = (ScriptEditorForBeanShell)
|
||||
BEING_EDITED.get(url);
|
||||
editor = BEING_EDITED.get(url);
|
||||
if (editor == null) {
|
||||
editor = new ScriptEditorForBeanShell(
|
||||
context, theCl, url);
|
||||
@@ -241,12 +240,12 @@ public class ScriptEditorForBeanShell
|
||||
this.filename = url.getFile();
|
||||
this.cl = cl;
|
||||
try {
|
||||
Class c = Class.forName(
|
||||
Class<?> c = Class.forName(
|
||||
"org.openoffice.netbeans.editor.NetBeansSourceView");
|
||||
|
||||
Class[] types = new Class[] { ScriptSourceModel.class };
|
||||
Class<?>[] types = new Class[] { ScriptSourceModel.class };
|
||||
|
||||
java.lang.reflect.Constructor ctor = c.getConstructor(types);
|
||||
java.lang.reflect.Constructor<?> ctor = c.getConstructor(types);
|
||||
|
||||
if (ctor != null) {
|
||||
Object[] args = new Object[] { this.model };
|
||||
|
||||
@@ -34,7 +34,7 @@ public interface Resolver {
|
||||
* @param c A Class
|
||||
* @return The ScriptProxy value
|
||||
*/
|
||||
public ScriptProxy getProxy( ScriptDescriptor sd, Class c )
|
||||
public ScriptProxy getProxy( ScriptDescriptor sd, Class<?> c )
|
||||
throws NoSuchMethodException;
|
||||
}
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ public class ScriptDescriptor
|
||||
*
|
||||
* @param classes The feature to be added to the ArgumentTypes attribute
|
||||
*/
|
||||
public synchronized void addArgumentTypes( Class[] classes )
|
||||
public synchronized void addArgumentTypes( Class<?>[] classes )
|
||||
{
|
||||
for ( int i = 0; i < classes.length; i++ )
|
||||
{
|
||||
@@ -181,7 +181,7 @@ public class ScriptDescriptor
|
||||
public String toString()
|
||||
{
|
||||
StringBuffer description = new StringBuffer( m_name );
|
||||
Class[] types = getArgumentTypes();
|
||||
Class<?>[] types = getArgumentTypes();
|
||||
|
||||
description.append( " (" );
|
||||
|
||||
|
||||
+2
-3
@@ -190,8 +190,7 @@ class ScriptImpl implements XScript
|
||||
aOutParamIndex[0] = new short[0];
|
||||
aOutParam[0] = new Object[0];
|
||||
|
||||
|
||||
Map languageProps = metaData.getLanguageProperties();
|
||||
Map<String,String> languageProps = metaData.getLanguageProperties();
|
||||
|
||||
ScriptDescriptor scriptDesc =
|
||||
new ScriptDescriptor( metaData.getLanguageName() );
|
||||
@@ -271,7 +270,7 @@ class ScriptImpl implements XScript
|
||||
LogUtils.DEBUG( "About to load Class " + className + " starting... " );
|
||||
|
||||
long start = new java.util.Date().getTime();
|
||||
Class c = scriptLoader.loadClass( className );
|
||||
Class<?> c = scriptLoader.loadClass( className );
|
||||
long end = new java.util.Date().getTime();
|
||||
|
||||
LogUtils.DEBUG("loadClass took: " + String.valueOf(end - start) +
|
||||
|
||||
@@ -50,7 +50,7 @@ public class StrictResolver implements Resolver
|
||||
* @param c the Class file in which to search for the method
|
||||
* @return the ScriptProxy matching the criteria, or null if no match is found
|
||||
*/
|
||||
public ScriptProxy getProxy( ScriptDescriptor sd, Class c )
|
||||
public ScriptProxy getProxy( ScriptDescriptor sd, Class<?> c )
|
||||
throws NoSuchMethodException
|
||||
{
|
||||
Method m = null;
|
||||
|
||||
+8
-10
@@ -51,7 +51,7 @@ public class ScriptEditorForJavaScript implements ScriptEditor
|
||||
static private Main rhinoWindow;
|
||||
private URL scriptURL;
|
||||
// global list of ScriptEditors, key is URL of file being edited
|
||||
private static Map BEING_EDITED = new HashMap();
|
||||
private static Map<URL,ScriptEditorForJavaScript> BEING_EDITED = new HashMap<URL,ScriptEditorForJavaScript>();
|
||||
|
||||
static {
|
||||
try {
|
||||
@@ -109,7 +109,7 @@ public class ScriptEditorForJavaScript implements ScriptEditor
|
||||
public static ScriptEditorForJavaScript getEditor(URL url)
|
||||
{
|
||||
synchronized (BEING_EDITED) {
|
||||
return (ScriptEditorForJavaScript)BEING_EDITED.get(url);
|
||||
return BEING_EDITED.get(url);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,8 +185,7 @@ public class ScriptEditorForJavaScript implements ScriptEditor
|
||||
public void run() {
|
||||
synchronized (BEING_EDITED) {
|
||||
ScriptEditorForJavaScript editor =
|
||||
(ScriptEditorForJavaScript) BEING_EDITED.get(
|
||||
url);
|
||||
BEING_EDITED.get(url);
|
||||
if (editor == null) {
|
||||
editor = new ScriptEditorForJavaScript(
|
||||
context, url);
|
||||
@@ -291,17 +290,16 @@ public class ScriptEditorForJavaScript implements ScriptEditor
|
||||
// remove all scripts from BEING_EDITED
|
||||
synchronized( BEING_EDITED )
|
||||
{
|
||||
java.util.Iterator iter = BEING_EDITED.keySet().iterator();
|
||||
java.util.Vector keysToRemove = new java.util.Vector();
|
||||
java.util.Iterator<URL> iter = BEING_EDITED.keySet().iterator();
|
||||
java.util.ArrayList<URL> keysToRemove = new java.util.ArrayList<URL>();
|
||||
while ( iter.hasNext() )
|
||||
{
|
||||
|
||||
URL key = (URL)iter.next();
|
||||
URL key = iter.next();
|
||||
keysToRemove.add( key );
|
||||
}
|
||||
for ( int i=0; i<keysToRemove.size(); i++ )
|
||||
{
|
||||
BEING_EDITED.remove( keysToRemove.elementAt( i ) );
|
||||
BEING_EDITED.remove( keysToRemove.get( i ) );
|
||||
}
|
||||
keysToRemove = null;
|
||||
}
|
||||
@@ -334,7 +332,7 @@ public class ScriptEditorForJavaScript implements ScriptEditor
|
||||
{
|
||||
synchronized( BEING_EDITED )
|
||||
{
|
||||
Object o = BEING_EDITED.remove( this.url );
|
||||
BEING_EDITED.remove( this.url );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ public class OfficeDocument
|
||||
/* ------------------------------------------------------------------ */
|
||||
public boolean isModified()
|
||||
{
|
||||
XModifiable modify = (XModifiable)query( XModifiable.class );
|
||||
XModifiable modify = query( XModifiable.class );
|
||||
return modify.isModified();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user