diff options
author | Noel Grandin <noel@peralex.com> | 2014-08-13 10:08:31 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-08-13 10:24:10 +0200 |
commit | 34bcf9b498bccb5c924f4cec850ff15d88df6f07 (patch) | |
tree | 4d9604ec8c3b73639338ec45a0618b5daa5cf0ed /qadevOOo/runner/util | |
parent | 347926e8e57c1825261daa46c1886aa2ebf9571b (diff) |
java: remove dead methods
found by UCDetector
Change-Id: I219caa8e680dba5a395541a778df6144841c4dde
Diffstat (limited to 'qadevOOo/runner/util')
-rw-r--r-- | qadevOOo/runner/util/AccessibilityTools.java | 47 | ||||
-rw-r--r-- | qadevOOo/runner/util/DBTools.java | 124 | ||||
-rw-r--r-- | qadevOOo/runner/util/DesktopTools.java | 22 | ||||
-rw-r--r-- | qadevOOo/runner/util/DrawTools.java | 17 | ||||
-rw-r--r-- | qadevOOo/runner/util/DynamicClassLoader.java | 17 | ||||
-rw-r--r-- | qadevOOo/runner/util/FormTools.java | 17 | ||||
-rw-r--r-- | qadevOOo/runner/util/SOfficeFactory.java | 161 | ||||
-rw-r--r-- | qadevOOo/runner/util/SysUtils.java | 69 | ||||
-rw-r--r-- | qadevOOo/runner/util/UITools.java | 372 | ||||
-rw-r--r-- | qadevOOo/runner/util/XMLTools.java | 126 | ||||
-rw-r--r-- | qadevOOo/runner/util/compare/DocComparator.java | 6 | ||||
-rw-r--r-- | qadevOOo/runner/util/compare/GraphicalComparator.java | 19 | ||||
-rw-r--r-- | qadevOOo/runner/util/dbg.java | 44 | ||||
-rw-r--r-- | qadevOOo/runner/util/utils.java | 101 |
14 files changed, 17 insertions, 1125 deletions
diff --git a/qadevOOo/runner/util/AccessibilityTools.java b/qadevOOo/runner/util/AccessibilityTools.java index 6b893106c65b..5ca0b9bbead4 100644 --- a/qadevOOo/runner/util/AccessibilityTools.java +++ b/qadevOOo/runner/util/AccessibilityTools.java @@ -262,53 +262,6 @@ public class AccessibilityTools { return null; } - /** - * This methods retunrs the <CODE>XAccessibleContext</CODE> of a named Sheet-Cell like "G5".<p> - * @param xSheetAcc The <CODE>XAccessibleContext</CODE> of a Sheet - * @param cellName The name of a cell like "A5" - * @return the <CODE>XAccessiblecontext</CODE> of the named cell - */ - public static XAccessibleContext getSheetCell(XAccessibleContext xSheetAcc, String cellName){ - - int cellIndex = 0; - int column =0; - int charMem = 0; - for (int n=0; n<cellName.length(); n++){ - String cha = cellName.substring(n,n+1); - System.out.println("char: " + cha + " "); - - byte[] bytes = cha.getBytes(); - - if ((bytes[0] >= 'A') && (bytes[0] <= 'Z')){ - charMem = bytes[0]-64; - column++; - if ( column == 2 ){ - cellIndex += charMem * 26; - } - cellIndex= cellIndex+ (bytes[0]-65); - } else { - String sNumb = cellName.substring(n, cellName.length()); - int iNumb = Integer.valueOf(sNumb).intValue(); - cellIndex += (iNumb-1) * 256; - System.out.println("numb:" + (iNumb-1) * 256); - } - - } - - try { - XAccessibleContext ac = xSheetAcc.getAccessibleChild(cellIndex).getAccessibleContext(); - System.out.println(ac.getAccessibleRole() + "," + - ac.getAccessibleName() + "(" + - ac.getAccessibleDescription() + "):" + - utils.getImplName(ac)); - - return ac; - } catch (com.sun.star.lang.IndexOutOfBoundsException ex) { - System.out.println("ERROR: could not get child at index " + cellIndex +"': " + ex.toString()); - return null; - } - } - public static void printAccessibleTree(PrintWriter log, XAccessible xacc, boolean debugIsActive) { debug = debugIsActive; if (debug) printAccessibleTree(log, xacc, ""); diff --git a/qadevOOo/runner/util/DBTools.java b/qadevOOo/runner/util/DBTools.java index 5f22f5407dd2..7b352179929e 100644 --- a/qadevOOo/runner/util/DBTools.java +++ b/qadevOOo/runner/util/DBTools.java @@ -280,12 +280,7 @@ public class DBTools { */ public DataSourceInfo newDataSourceInfo() { return new DataSourceInfo() ;} - /** - * Returns new instance of <code>DataSourceInfo</code> class. - */ - public DataSourceInfo newDataSourceInfo(Object dataSource) { - return new DataSourceInfo(dataSource); - } + /** * Registers the datasource on the specified name in @@ -324,75 +319,9 @@ public class DBTools { registerDB(name, dataSource) ; } - /** - * RESERVED. Not used. - */ - public XConnection connectToTextDB(String contextName, - String dbDir, String fileExtension) - throws com.sun.star.uno.Exception { - - try { - XInterface newSource = (XInterface) xMSF.createInstance - ("com.sun.star.sdb.DataSource") ; - - XPropertySet xSrcProp = UnoRuntime.queryInterface(XPropertySet.class, newSource); - - xSrcProp.setPropertyValue("URL", "sdbc:text:" + dirToUrl(dbDir)); - - PropertyValue extParam = new PropertyValue() ; - extParam.Name = "EXT" ; - extParam.Value = fileExtension ; - xSrcProp.setPropertyValue("Info", new PropertyValue[] {extParam}) ; - dbContext.registerObject(contextName, newSource) ; - Object handler = xMSF.createInstance("com.sun.star.sdb.InteractionHandler"); - XInteractionHandler xHandler = UnoRuntime.queryInterface(XInteractionHandler.class, handler) ; - - XCompletedConnection xSrcCon = UnoRuntime.queryInterface(XCompletedConnection.class, newSource) ; - - XConnection con = xSrcCon.connectWithCompletion(xHandler) ; - - return con ; - } finally { - try { - dbContext.revokeObject(contextName) ; - } catch (Exception e) {} - } - } - - /** - * Registers DBase database (directory with DBF files) in the - * global DB context, then connects to it. - * @param contextName Name under which DB will be registered. - * @param dbDir The directory with DBF tables. - * @return Connection to the DB. - */ - public XConnection connectToDBase(String contextName, - String dbDir) - throws com.sun.star.uno.Exception { - - try { - XInterface newSource = (XInterface) xMSF.createInstance - ("com.sun.star.sdb.DataSource") ; - - XPropertySet xSrcProp = UnoRuntime.queryInterface(XPropertySet.class, newSource); - xSrcProp.setPropertyValue("URL", "sdbc:dbase:" + dirToUrl(dbDir)); - - dbContext.registerObject(contextName, newSource) ; - - XConnection con = connectToSource(newSource) ; - - return con ; - } catch(com.sun.star.uno.Exception e) { - try { - dbContext.revokeObject(contextName) ; - } catch (Exception ex) {} - - throw e ; - } - } /** * Performs connection to DataSource specified. @@ -461,23 +390,7 @@ public class DBTools { return src ; } - /** - * Connects to <code>DataSource</code> specially created for testing. - * This source always has name <code>'APITestDatabase'</code> and it - * is registered in subdirectory <code>TestDB</code> of directory - * <code>docPath</code> which is supposed to be a directory with test - * documents, but can be any other (it must have subdirectory with DBF - * tables). If such data source doesn't exists or exists with - * different URL it is recreated and reregistered. Finally connection - * performed. - * @param docPath Path to database <code>TestDB</code> directory. - * @return Connection to test database. - */ - public XConnection connectToTestDB(String docPath) - throws com.sun.star.uno.Exception { - return connectToSource(registerTestDB(docPath)) ; - } /** * Empties the table in the specified source. @@ -584,44 +497,9 @@ public class DBTools { xClose.close() ; } - /** - * Initializes test table specified of the connection specified. - * Deletes all record from table, and then inserts data from - * <code>TST_TABLE_VALUES</code> constant array. <p> - * Test table has some predefined format which includes as much - * field types as possible. For every column type constants - * {@link #TST_STRING TST_STRING}, {@link #TST_INT TST_INT}, etc. - * are declared for column index fast find. - * @param con Connection to data source where test table exists. - * @param table Test table name. - */ - public void initializeTestTable(XConnection con, String table) - throws com.sun.star.sdbc.SQLException { - - deleteAllRows(con, table) ; - for (int i = 0; i < TST_TABLE_VALUES.length; i++) { - addRowToTestTable(con, table, TST_TABLE_VALUES[i], TST_STREAM_LENGTHS[i]) ; - } - } - - /** - * Prints full info about currently registered DataSource's. - */ - public void printRegisteredDatabasesInfo(PrintWriter out) { - XEnumerationAccess dbContEA = UnoRuntime.queryInterface(XEnumerationAccess.class, dbContext) ; - XEnumeration xEnum = dbContEA.createEnumeration() ; - out.println("DatabaseContext registered DataSource's :") ; - while (xEnum.hasMoreElements()) { - try { - DataSourceInfo inf = new DataSourceInfo(xEnum.nextElement()) ; - inf.printInfo(out) ; - } catch (com.sun.star.container.NoSuchElementException e) {} - catch (com.sun.star.lang.WrappedTargetException e) {} - } - } /** * Convert system pathname to SOffice URL string diff --git a/qadevOOo/runner/util/DesktopTools.java b/qadevOOo/runner/util/DesktopTools.java index 30bfd8725d43..8e6ad3238cde 100644 --- a/qadevOOo/runner/util/DesktopTools.java +++ b/qadevOOo/runner/util/DesktopTools.java @@ -101,17 +101,7 @@ public class DesktopTools return xDesktop.getComponents().createEnumeration(); } - /** - * returns the current component on the desktop - * @param xMSF the XMultiServiceFactory - * @return XComponent of the current component on the desktop - */ - public static XComponent getCurrentComponent(XMultiServiceFactory xMSF) - { - XDesktop xDesktop = UnoRuntime.queryInterface( - XDesktop.class, createDesktop(xMSF)); - return xDesktop.getCurrentComponent(); - } + /** * returns the current component on the desktop @@ -460,15 +450,7 @@ public class DesktopTools } } - /** - * Due to typo deprecated - * @deprecated - */ - @Deprecated - public static void bringWindowToFromt(XModel xModel) - { - bringWindowToFront(xModel); - } + /** * This function brings a document to the front.<P> diff --git a/qadevOOo/runner/util/DrawTools.java b/qadevOOo/runner/util/DrawTools.java index acb89d88e26c..4facd805fd34 100644 --- a/qadevOOo/runner/util/DrawTools.java +++ b/qadevOOo/runner/util/DrawTools.java @@ -130,21 +130,4 @@ public class DrawTools { return oShape; } - /** - * creates a XShape and adds it to the documents - * first drawpage - * @param oDoc the document - * @param height the height of the shape - * @param width the width of the shape - * @param x the x-position of the shape - * @param y the y-position of the shape - * @param kind the kind of the shape ('Ellipse', 'Line' or 'Rectangle') - */ - public void addShape( XComponent oDoc, int height, int width, int x, - int y, String kind ) { - - getShapes(getDrawPage(oDoc,0)).add(createShape( oDoc, height, width, x, - y, kind ) ); - } - } diff --git a/qadevOOo/runner/util/DynamicClassLoader.java b/qadevOOo/runner/util/DynamicClassLoader.java index ff70becefbba..8fdd721f1ea2 100644 --- a/qadevOOo/runner/util/DynamicClassLoader.java +++ b/qadevOOo/runner/util/DynamicClassLoader.java @@ -61,23 +61,6 @@ public class DynamicClassLoader { /** * Get an instance of a class. The constructor matching to the - * arguments is used and the arguments are given to this constructor. - * @param className The class to instantiate. - * @param ctorArgs Arguments for the constructor. - * @return The instance of the class. - */ - public Object getInstance(String className, Object[] ctorArgs) - throws IllegalArgumentException { - Class<?>[] ctorType = new Class[ctorArgs.length]; - for(int i=0; i<ctorType.length; i++) { - ctorType[i] = ctorArgs[i].getClass(); - } - return getInstance(className, ctorType, ctorArgs); - - } - - /** - * Get an instance of a class. The constructor matching to the * given calss types is used and the instance is created using the arguments * for the constructor. * @param className The class to instantiate. diff --git a/qadevOOo/runner/util/FormTools.java b/qadevOOo/runner/util/FormTools.java index 9064487f791c..2de4698877c2 100644 --- a/qadevOOo/runner/util/FormTools.java +++ b/qadevOOo/runner/util/FormTools.java @@ -260,24 +260,7 @@ public class FormTools { return UnoRuntime.queryInterface(XLoadable.class, the_form); } - public static XLoadable bindForm( XTextDocument aDoc, String formName ) { - XLoadable formLoader = null; - try { - XForm the_form = (XForm) FormTools.getForms(WriterTools.getDrawPage(aDoc)).getByName(formName); - XPropertySet formProps = UnoRuntime.queryInterface(XPropertySet.class, the_form); - formProps.setPropertyValue("DataSourceName","Bibliography"); - formProps.setPropertyValue("Command","biblio"); - formProps.setPropertyValue("CommandType",new Integer(com.sun.star.sdb.CommandType.TABLE)); - formLoader = UnoRuntime.queryInterface(XLoadable.class, the_form); - } - catch (Exception ex) { - System.out.println("Exception: "+ex); - ex.printStackTrace(System.err); - } - - return formLoader; - } /** * Binds the form with the name specified of <code>aDoc</code> Writer document diff --git a/qadevOOo/runner/util/SOfficeFactory.java b/qadevOOo/runner/util/SOfficeFactory.java index 8a841397ee5c..dd46df9b6bdc 100644 --- a/qadevOOo/runner/util/SOfficeFactory.java +++ b/qadevOOo/runner/util/SOfficeFactory.java @@ -99,23 +99,7 @@ public class SOfficeFactory { } // finished createTextDoc - /** - * method which opens a new TextDocument - * - * @see XTextDocument - */ - public XTextDocument createTextDoc(String frameName, PropertyValue[] mediaDescriptor) - throws com.sun.star.uno.Exception { - XComponent oDoc = openDoc("swriter", frameName, mediaDescriptor); - - if (oDoc != null) { - DesktopTools.bringWindowToFront(oDoc); - return UnoRuntime.queryInterface(XTextDocument.class, oDoc); - } else { - return null; - } - } // finished createTextDoc /** * method which opens a new SpreadsheetDocument @@ -135,23 +119,7 @@ public class SOfficeFactory { } } // finished createCalcDoc - /** - * method which opens a new SpreadsheetDocument - * - * @see XSpreadsheetDocument - */ - public XSpreadsheetDocument createCalcDoc(String frameName, PropertyValue[] mediaDescriptor) - throws com.sun.star.uno.Exception { - - XComponent oDoc = openDoc("scalc", frameName, mediaDescriptor); - if (oDoc != null) { - DesktopTools.bringWindowToFront(oDoc); - return UnoRuntime.queryInterface(XSpreadsheetDocument.class, oDoc); - } else { - return null; - } - } // finished createCalcDoc /** * method which opens a new DrawDocument @@ -162,17 +130,7 @@ public class SOfficeFactory { return openDoc("sdraw", frameName); } // finished createDrawDoc - /** - * method which opens a new ImpressDocument - */ - /** - * method which opens a new DrawDocument - */ - public XComponent createDrawDoc(String frameName, PropertyValue[] mediaDescriptor) - throws com.sun.star.uno.Exception { - return openDoc("sdraw", frameName, mediaDescriptor); - } // finished createDrawDoc /** * method which opens a new ImpressDocument @@ -183,14 +141,7 @@ public class SOfficeFactory { return openDoc("simpress", frameName); } // finished createImpressDoc - /** - * method which opens a new ImpressDocument - */ - public XComponent createImpressDoc(String frameName, PropertyValue[] mediaDescriptor) - throws com.sun.star.uno.Exception { - return openDoc("simpress", frameName, mediaDescriptor); - } // finished createImpressDoc /** * method which opens a new MathDocument @@ -201,14 +152,7 @@ public class SOfficeFactory { return openDoc("smath", frameName); } // finished createMathDoc - /** - * method which opens a new MathDocument - */ - public XComponent createMathDoc(String frameName, PropertyValue[] mediaDescriptor) - throws com.sun.star.uno.Exception { - return openDoc("smath", frameName, mediaDescriptor); - } // finished createMathDoc /** * method which opens a new ChartDocument @@ -261,19 +205,7 @@ public class SOfficeFactory { return oTable; } - /** - * creates a simple TextFrame - * ... to be continued - */ - public static XTextFrame createTextFrame(XTextDocument xTextDoc) - { - - FrameDsc tDsc = new FrameDsc(); - InstCreator instCreate = new InstCreator(xTextDoc, tDsc); - XTextFrame oFrame = (XTextFrame) instCreate.getInstance(); - return oFrame; - } /** * creates a simple TextFrame @@ -289,15 +221,7 @@ public class SOfficeFactory { return oFrame; } - public static void insertString(XTextDocument xTextDoc, String cString) - { - XText xText = xTextDoc.getText(); - XText oText = UnoRuntime.queryInterface( - XText.class, xText); - XTextCursor oCursor = oText.createTextCursor(); - oText.insertString(oCursor, cString, false); - } public static void insertTextContent(XTextDocument xTextDoc, XTextContent xCont) @@ -335,33 +259,9 @@ public class SOfficeFactory { } /// finish createBookmark - /** - * the method createReferenceMark - */ - public static XTextContent createReferenceMark(XTextDocument xTextDoc) - { - - ReferenceMarkDsc tDsc = new ReferenceMarkDsc(); - InstCreator instCreate = new InstCreator(xTextDoc, tDsc); - - XTextContent oReferenceMark = (XTextContent) instCreate.getInstance(); - return oReferenceMark; - - } /// finish createReferenceMark - /** - * the method createFootnote - */ - public static XTextContent createFootnote(XTextDocument xTextDoc) - { - FootnoteDsc tDsc = new FootnoteDsc(); - InstCreator instCreate = new InstCreator(xTextDoc, tDsc); - - XTextContent oFootnote = (XTextContent) instCreate.getInstance(); - return oFootnote; - } /// finish createFootnote /** * the method create Index @@ -403,16 +303,7 @@ public class SOfficeFactory { return oIA; } - public static String getUniqueName(XInterface oInterface, String prefix) { - XNameAccess oNameAccess = UnoRuntime.queryInterface(XNameAccess.class, oInterface); - if (oNameAccess == null) { - return null; - } - int i; - for (i = 0; oNameAccess.hasByName(prefix + i); i++) { - } - return prefix + i; - } + public XShape createShape(XComponent oDoc, int height, int width, int x, int y, String kind) { //possible values for kind are 'Ellipse', 'Line' and 'Rectangle' @@ -482,45 +373,7 @@ public class SOfficeFactory { return oInstance; } - public XControlShape createControlShape(XComponent oDoc, int height, int width, int x, int y, String kind) { - - Size size = new Size(); - Point position = new Point(); - XControlShape oCShape = null; - XControlModel aControl = null; - - //get MSF - XMultiServiceFactory oDocMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, oDoc); - try { - Object oInt = oDocMSF.createInstance("com.sun.star.drawing.ControlShape"); - Object aCon = oDocMSF.createInstance("com.sun.star.form.component." + kind); - aControl = UnoRuntime.queryInterface(XControlModel.class, aCon); - oCShape = UnoRuntime.queryInterface(XControlShape.class, oInt); - size.Height = height; - size.Width = width; - position.X = x; - position.Y = y; - oCShape.setSize(size); - oCShape.setPosition(position); - - - } catch (Exception e) { - // Some exception occurs.FAILED - System.out.println("Couldn't create instance " + e); - } - - try { - oCShape.setControl(aControl); - } catch (Exception e) { - // Some exception occurs.FAILED - System.out.println("Couldn't get Control " + e); - } - - - return oCShape; - - } public XComponent loadDocument(String fileName) throws com.sun.star.lang.IllegalArgumentException, @@ -607,15 +460,5 @@ public class SOfficeFactory { } // finished openDoc - // query for XServiceInfo - public Object queryXServiceInfo(Object oObj) { - if (oObj != null) { - UnoRuntime.queryInterface( - XServiceInfo.class, oObj); - System.out.println("!!!! XServiceInfo n.a. !!!! "); - } else { - System.out.println("Object is empty!!!! "); - } - return null; - } // finish queryXServiceInfo + } diff --git a/qadevOOo/runner/util/SysUtils.java b/qadevOOo/runner/util/SysUtils.java index 0d289f4d68da..09896ade63e0 100644 --- a/qadevOOo/runner/util/SysUtils.java +++ b/qadevOOo/runner/util/SysUtils.java @@ -32,82 +32,15 @@ import com.sun.star.datatransfer.*; public class SysUtils { - public static String getJavaPath() { - String cp = System.getProperty("java.class.path"); - String jh = System.getProperty("java.home"); - String fs = System.getProperty("file.separator"); - jh = jh + fs + "bin" + fs; - jh = jh + "java -classpath "+cp; - return jh; - } - private static ArrayList<String> files = new ArrayList<String>(); - public static Object[] traverse( String afileDirectory ) { + private static ArrayList<String> files = new ArrayList<String>(); - File fileDirectory = new File(afileDirectory); - // Testing, if the file is a directory, and if so, it throws an exception - if ( !fileDirectory.isDirectory() ) { - throw new IllegalArgumentException( - "not a directory: " + fileDirectory.getName() - ); - } - // Getting all files and directories in the current directory - File[] entries = fileDirectory.listFiles( - new FileFilter() { - public boolean accept( File pathname ) { - return true; - } - } - ); - - // Iterating for each file and directory - for ( int i = 0; i < entries.length; ++i ) { - // Testing, if the entry in the list is a directory - if ( entries[ i ].isDirectory() ) { - // Recursive call for the new directory - traverse( entries[ i ].getAbsolutePath() ); - } else { - // adding file to List - try { - // Composing the URL by replacing all backslashs - String stringUrl = "file:///" - + entries[ i ].getAbsolutePath().replace( '\\', '/' ); - files.add(stringUrl); - } - catch( Exception exception ) { - exception.printStackTrace(); - } - } - } - return files.toArray(); - } - public static XComponent getActiveComponent(XMultiServiceFactory msf) { - XComponent ac = null; - try { - Object desk = msf.createInstance("com.sun.star.frame.Desktop"); - XDesktop xDesk = UnoRuntime.queryInterface(XDesktop.class,desk); - ac = xDesk.getCurrentComponent(); - } catch (com.sun.star.uno.Exception e) { - System.out.println("Couldn't get active Component"); - } - return ac; - } - public static XFrame getActiveFrame(XMultiServiceFactory msf) { - try { - Object desk = msf.createInstance("com.sun.star.frame.Desktop"); - XDesktop xDesk = UnoRuntime.queryInterface(XDesktop.class,desk); - return xDesk.getCurrentFrame(); - } catch (com.sun.star.uno.Exception e) { - System.out.println("Couldn't get active Component"); - } - return null; - } /** * Tries to obtain text data from cliboard if such one exists. diff --git a/qadevOOo/runner/util/UITools.java b/qadevOOo/runner/util/UITools.java index c97c6d47c008..2004bca59a8c 100644 --- a/qadevOOo/runner/util/UITools.java +++ b/qadevOOo/runner/util/UITools.java @@ -196,180 +196,20 @@ public class UITools { } } - /** - * Deactivates toggle button via Accessibility - * @param buttonName The name of the button in the Accessibility tree - * - * @return true if the button could be set to deactivated - */ - public boolean deactivateToggleButton(String buttonName){ - return clickToggleButton(buttonName, false); - } - /** - * Activates toggle button via Accessibility - * @param buttonName The name of the button in the Accessibility tree - * - * @return true if the button could be set to activated - */ - public boolean activateToggleButton(String buttonName){ - return clickToggleButton(buttonName, true); - } - /** - * returns the value of named radio button - * @param buttonName the name of the button to get the value of - * @throws java.lang.Exception if something fail - * @return Integer - */ - public Integer getRadioButtonValue(String buttonName) - throws java.lang.Exception - { - try { - XInterface xRB =AccessibilityTools.getAccessibleObjectForRole(mXRoot, - AccessibleRole.RADIO_BUTTON, buttonName); - - return (Integer) getValue(xRB); - } catch (Exception e) { - throw new Exception("Could not get value from RadioButton '" - + buttonName + "' : " + e.toString()); - } - } - /** - * returns the named graphic - * @param GraphicName the name of the graphic - * @return XInterface - * @throws java.lang.Exception if something fail - */ - public XInterface getGraphic(String GraphicName) throws java.lang.Exception - { - return AccessibilityTools.getAccessibleObjectForRole(mXRoot, AccessibleRole.GRAPHIC, - GraphicName); - } - /** - * set a named radio button the a given value - * @param buttonName the name of the button to set - * @param iValue the value to set - * @throws java.lang.Exception if something fail - */ - public void setRadioButtonValue(String buttonName, int iValue) - throws java.lang.Exception - { - try { - XInterface xRB =AccessibilityTools.getAccessibleObjectForRole(mXRoot, AccessibleRole.RADIO_BUTTON, buttonName); - if(xRB == null) - System.out.println("AccessibleObjectForRole couldn't be found for " + buttonName); - XAccessibleValue oValue = UnoRuntime.queryInterface(XAccessibleValue.class, xRB); - if(oValue == null) - System.out.println("XAccessibleValue couldn't be queried for " + buttonName); - oValue.setCurrentValue(new Integer(iValue)); - } catch (Exception e) { - e.printStackTrace(); - - throw new Exception("Could not set value to RadioButton '" - + buttonName + "' : " + e.toString()); - } - } - /** - * select an item in nanmed listbox - * @param ListBoxName the name of the listbox - * @param nChildIndex the index of the item to set - * @throws java.lang.Exception if something fail - */ - public void selectListboxItem(String ListBoxName, int nChildIndex) - throws java.lang.Exception - { - try { - XAccessibleContext xListBox = null; - xListBox =AccessibilityTools.getAccessibleObjectForRole(mXRoot, - AccessibleRole.COMBO_BOX, ListBoxName); - if (xListBox == null){ - xListBox =AccessibilityTools.getAccessibleObjectForRole(mXRoot, - AccessibleRole.PANEL, ListBoxName); - } - XAccessible xListBoxAccess = UnoRuntime.queryInterface(XAccessible.class, xListBox); - // if a List is not pulled to be open all entries are not visiblle, therefore the - // boolean argument - XAccessibleContext xList =AccessibilityTools.getAccessibleObjectForRole( - xListBoxAccess, AccessibleRole.LIST, true); - XAccessibleSelection xListSelect = UnoRuntime.queryInterface(XAccessibleSelection.class, xList); - xListSelect.selectAccessibleChild(nChildIndex); - } catch (Exception e) { - throw new Exception("Could not select item '" +nChildIndex+ - "' in listbox '" + ListBoxName + "' : " + e.toString()); - } - } - /** - * This method returns all entries as XInterface of a list box - * @param ListBoxName the name of the listbox - * @return Object[] containing XInterface - * @throws java.lang.Exception if something fail - */ - - public Object[] getListBoxObjects(String ListBoxName) - throws java.lang.Exception - { - ArrayList<XInterface> Items = new ArrayList<XInterface>(); - try { - XAccessibleContext xListBox = null; - XAccessibleContext xList = null; - - xListBox =AccessibilityTools.getAccessibleObjectForRole(mXRoot, - AccessibleRole.COMBO_BOX, ListBoxName); - if (xListBox == null){ - xListBox =AccessibilityTools.getAccessibleObjectForRole(mXRoot, - AccessibleRole.PANEL, ListBoxName); - } - - if (xListBox == null){ - // get the list of TreeListBox - xList =AccessibilityTools.getAccessibleObjectForRole(mXRoot, - AccessibleRole.TREE, ListBoxName); - - // all other list boxes have a children of kind of LIST - } else { - XAccessible xListBoxAccess = UnoRuntime.queryInterface(XAccessible.class, xListBox); - // if a List is not pulled to be open all entries are not visiblle, therefore the - // boolean argument - xList =AccessibilityTools.getAccessibleObjectForRole( - xListBoxAccess, AccessibleRole.LIST, true); - } - - for (int i=0;i<xList.getAccessibleChildCount();i++) { - try { - XAccessible xChild = xList.getAccessibleChild(i); - XAccessibleContext xChildCont = - xChild.getAccessibleContext(); - XInterface xChildInterface = UnoRuntime.queryInterface(XInterface.class, xChildCont); - Items.add(xChildInterface); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - throw new Exception("Could not get child form list of '" - + ListBoxName + "' : " + e.toString()); - } - } - - } catch (Exception e) { - throw new Exception("Could not get list of items from '" - + ListBoxName + "' : " + e.toString()); - } - Object[]ret = new XInterface[Items.size()]; - for (int i=0;i<Items.size();i++){ - ret[i] = Items.get(i); - } - return ret; - } /** * Helper method: returns the entry manes of a List-Box @@ -429,27 +269,7 @@ public class UITools { String[]ret = new String[Items.size()]; return Items.toArray(ret); } - /** - * set to a named nureric filed a given value - * @param NumericFieldName the name of the nureic field - * @param cValue the value to set - * @throws java.lang.Exception if something fail - */ - public void setNumericFieldValue(String NumericFieldName, String cValue) - throws java.lang.Exception - { - try{ - XInterface xNumericField =AccessibilityTools.getAccessibleObjectForRole( - mXRoot, AccessibleRole.TEXT, NumericFieldName); - UnoRuntime.queryInterface( - XAccessibleEditableText.class, xNumericField); - setString(xNumericField, cValue); - } catch (Exception e) { - throw new Exception("Could not set value '" + cValue + - "' into NumericField '" + NumericFieldName + "' : " + e.toString()); - } - } /** * returns the value of a numeric field @@ -511,66 +331,10 @@ public class UITools { } - /** - * returns the numeric value of a numeric filed. This is needed ie. for - * fields include the moneytary unit. - * @param NumericFieldName the name of the numeric filed - * @return the value of the numeric filed - * @throws java.lang.Exception if something fail - */ - public Double getNumericFieldNumericValue(String NumericFieldName) - throws java.lang.Exception - { - try{ - Double retValue = null; - String sValue = getNumericFieldValue(NumericFieldName); - String sAmount = removeCharactersFromCurrencyString(sValue); - retValue = Double.valueOf(sAmount); - return retValue; - - } catch (Exception e) { - throw new Exception("Could get numeric value from NumericField '" - + NumericFieldName + "' : " + e.toString()); - } - } - /** - * returns the content of a TextBox - * @param TextFieldName the name of the textbox - * @return the value of the text box - * @throws java.lang.Exception if something fail - */ - public String getTextBoxText(String TextFieldName) - throws java.lang.Exception - { - String TextFieldText = null; - try{ - XAccessibleContext xTextField =AccessibilityTools.getAccessibleObjectForRole(mXRoot, - AccessibleRole.SCROLL_PANE, TextFieldName); - XAccessible xTextFieldAccess = UnoRuntime.queryInterface(XAccessible.class, xTextField); - XAccessibleContext xFrame =AccessibilityTools.getAccessibleObjectForRole( - xTextFieldAccess, AccessibleRole.TEXT_FRAME); - for (int i=0;i<xFrame.getAccessibleChildCount();i++) { - try { - XAccessible xChild = xFrame.getAccessibleChild(i); - XAccessibleContext xChildCont = - xChild.getAccessibleContext(); - XInterface xChildInterface = UnoRuntime.queryInterface(XInterface.class, xChildCont); - TextFieldText += (getString(xChildInterface)); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - throw new Exception("Could not get child fom TextFrame of '" - + TextFieldName + "' : " + e.toString()); - } - } - return TextFieldText; - } catch (Exception e) { - throw new Exception("Could not get content fom Textbox '" - + TextFieldName + "' : " + e.toString()); - } - } /** * set a value to a named check box @@ -598,26 +362,7 @@ public class UITools { } } - /** - * returns the value of the named check box - * @param CheckBoxName the name of the check box - * @return the value of the check box - * @throws java.lang.Exception if something fail - */ - public Integer getCheckBoxValue(String CheckBoxName) - throws java.lang.Exception - { - try { - XInterface xCheckBox =AccessibilityTools.getAccessibleObjectForRole(mXRoot, - AccessibleRole.CHECK_BOX, CheckBoxName); - XAccessibleValue xCheckBoxValue = UnoRuntime.queryInterface(XAccessibleValue.class, xCheckBox); - return (Integer) xCheckBoxValue.getCurrentValue(); - } catch (Exception e) { - throw new Exception("Could not set value to CheckBox '" - + CheckBoxName + "' : " + e.toString()); - } - } /** * returns the message of a Basic-MessageBox @@ -642,130 +387,13 @@ public class UITools { } } - /** - * fetch the window which is equal to the given <CODE>WindowName</CODE> - * @return the named window - * @throws java.lang.Exception if something fail - */ - public XWindow getTopWindow(String WindowName, boolean debug) throws java.lang.Exception - { - XInterface xToolKit = null; - try { - xToolKit = (XInterface) mMSF.createInstance("com.sun.star.awt.Toolkit") ; - } catch (com.sun.star.uno.Exception e) { - throw new Exception("Could not toolkit: " + e.toString()); - } - XExtendedToolkit tk = UnoRuntime.queryInterface(XExtendedToolkit.class, xToolKit); - - int count = tk.getTopWindowCount(); - - XTopWindow retWindow = null; - - if (debug) System.out.println("getTopWindow ->"); - - for (int i=0; i < count ; i++){ - XTopWindow xTopWindow = tk.getTopWindow(i); - XAccessible xAcc = AccessibilityTools.getAccessibleObject(xTopWindow); - String accName = xAcc.getAccessibleContext().getAccessibleName(); - - if (debug){ - System.out.println("AccessibleName: " + accName); - } - - if (WindowName.equals(accName)){ - if (debug) System.out.println("-> found window with name '" + WindowName + "'"); - retWindow = xTopWindow; - } - } - if (debug) { - if (retWindow == null) System.out.println("could not found window with name '" + WindowName + "'"); - System.out.println("<- getTopWindow "); - } - return UnoRuntime.queryInterface(XWindow.class, retWindow); - } - public void clickMiddleOfAccessibleObject(short role, String name){ - - XAccessibleContext xAcc =AccessibilityTools.getAccessibleObjectForRole(mXRoot, role, name); - XAccessibleComponent aComp = UnoRuntime.queryInterface( - XAccessibleComponent.class, xAcc); - - System.out.println(xAcc.getAccessibleRole() + "," + - xAcc.getAccessibleName() + "(" + - xAcc.getAccessibleDescription() + "):" + - utils.getImplName(xAcc)); - - if (aComp != null) { - aComp.getLocationOnScreen(); - String bounds = "(" + aComp.getBounds().X + "," + - aComp.getBounds().Y + ")" + " (" + - aComp.getBounds().Width + "," + - aComp.getBounds().Height + ")"; - System.out.println("The boundary Rectangle is " + bounds); - try { - Robot rob = new Robot(); - int x = aComp.getLocationOnScreen().X + (aComp.getBounds().Width / 2); - int y = aComp.getLocationOnScreen().Y + (aComp.getBounds().Height / 2); - System.out.println("try to click mouse button on x/y " + x + "/" + y); - rob.mouseMove(x, y); - rob.mousePress(InputEvent.BUTTON1_MASK); - rob.mouseRelease(InputEvent.BUTTON1_MASK); - } catch (java.awt.AWTException e) { - System.out.println("couldn't press mouse button"); - } - } - } - public void doubleClickMiddleOfAccessibleObject(short role, String name) { - XAccessibleContext xAcc =AccessibilityTools.getAccessibleObjectForRole(mXRoot, role, name); - XAccessibleComponent aComp = UnoRuntime.queryInterface( - XAccessibleComponent.class, xAcc); - - System.out.println(xAcc.getAccessibleRole() + "," + - xAcc.getAccessibleName() + "(" + - xAcc.getAccessibleDescription() + "):" + - utils.getImplName(xAcc)); - - if (aComp != null) { - aComp.getLocationOnScreen(); - String bounds = "(" + aComp.getBounds().X + "," + - aComp.getBounds().Y + ")" + " (" + - aComp.getBounds().Width + "," + - aComp.getBounds().Height + ")"; - System.out.println("The boundary Rectangle is " + bounds); - try { - Robot rob = new Robot(); - int x = aComp.getLocationOnScreen().X + (aComp.getBounds().Width / 2); - int y = aComp.getLocationOnScreen().Y + (aComp.getBounds().Height / 2); - System.out.println("try to double click mouse button on x/y " + x + "/" + y); - rob.mouseMove(x, y); - rob.mousePress(InputEvent.BUTTON1_MASK); - rob.mouseRelease(InputEvent.BUTTON1_MASK); - utils.shortWait(100); - rob.mousePress(InputEvent.BUTTON1_MASK); - rob.mouseRelease(InputEvent.BUTTON1_MASK); - } catch (java.awt.AWTException e) { - System.out.println("couldn't press mouse button"); - } - } - } - /** - * <B>DEPRECATED</B> - * Since <CODE>AccessibilityTools</CODE> handle parameter <CODE>debugIsActive</CODE> - * this function does not work anymore. - * @deprecated Since <CODE>AccessibilityTools</CODE> handle parameter <CODE>debugIsActive</CODE> - * this function does not work anymore. - * @param log logWriter - */ - public void printAccessibleTree(PrintWriter log) - { - AccessibilityTools.printAccessibleTree(log, mXRoot); - } /** diff --git a/qadevOOo/runner/util/XMLTools.java b/qadevOOo/runner/util/XMLTools.java index f706d9c5878a..ac3c89e275d7 100644 --- a/qadevOOo/runner/util/XMLTools.java +++ b/qadevOOo/runner/util/XMLTools.java @@ -98,23 +98,9 @@ public class XMLTools { attrByName.put(attr.Name, attr) ; } - /** - * Adds an attribute with value specified. As a type of - * value 'CDATA' string specified. - * @param name The attribute name. - * @param value Attribute value. - */ - public void add(String name, String value) { - add(name, "CDATA", value) ; - } - /** - * Clears all attributes added before. - */ - public void clear() { - attrByName.clear() ; - attributes.clear() ; - } + + /*************************************** * XAttributeList methods @@ -392,12 +378,7 @@ public class XMLTools { public void addTagEnclosed(String tag, String outerTag) { tags.put(tag, outerTag) ; } - /** - * Adds a character data which must be contained in the XML data. - */ - public void addCharacters(String ch) { - chars.put(ch, "") ; - } + /** * Adds a character data which must be contained in the XML data and * must be inside the tag with name <code>outerTag</code>. @@ -647,9 +628,7 @@ public class XMLTools { tagSet.add(tag.name) ; } - public void addCharacters(String ch) { - chars.add(new Object[] {ch.trim(), null}) ; - } + public void addCharactersEnclosed(String ch, Tag outerTag) { chars.add(new Object[] {ch.trim(), outerTag}) ; @@ -760,36 +739,7 @@ public class XMLTools { } } - /** - * Creates <code>XDocumentHandler</code> implementation in form - * of <code>com.sun.star.xml.sax.Writer</code> service, which - * writes XML data into a <code>com.sun.star.io.Pipe</code> - * created. - * @return Single element array which contains the handler - * contained in <code>Any</code> structure. - */ - public static Object[] getDocumentHandler(XMultiServiceFactory xMSF) { - Object[] ret = new Object[1]; - try { - XInterface Writer = (XInterface) xMSF.createInstance( - "com.sun.star.xml.sax.Writer"); - XInterface oPipe = (XInterface) xMSF.createInstance - ( "com.sun.star.io.Pipe" ); - XOutputStream xPipeOutput = UnoRuntime. - queryInterface(XOutputStream.class, oPipe) ; - - XActiveDataSource xADS = UnoRuntime.queryInterface(XActiveDataSource.class,Writer); - xADS.setOutputStream(xPipeOutput); - XDocumentHandler handler = UnoRuntime.queryInterface(XDocumentHandler.class,Writer); - - Any arg = new Any(new Type(XDocumentHandler.class),handler); - - ret[0] = arg; - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(); - } - return ret; - } + public static PropertyValue[] createMediaDescriptor(String[] propNames, Object[] values) { PropertyValue[] props = new PropertyValue[propNames.length] ; @@ -863,73 +813,7 @@ public class XMLTools { oIn.closeInput(); } - /** - * Exports document (the whole or a part) into the file specified - * in XML format. - * @param xMSF Soffice <code>ServiceManager</code> factory. - * @param xDoc Document to be exported. - * @param docType Type of document (for example 'Calc', 'Writer', 'Draw') - * The type must start with <b>capital</b> letter. - * @param exportType The type of export specifies if the whole - * document will be exported or one of its parts (Meta info, Styles, etc.). - * The following types supported (it also depends of document type) : - * "" (empty string) - for the whole document ; - * "Content" - only content exported ; - * "Meta" - meta document info exported ; - * "Settings" - view settings of document exported ; - * "Styles" - document styles exported ; - * @param fileURL XML file name (in form file:///<path>) to be exported to. - */ - public static void exportDocument(XMultiServiceFactory xMSF, XComponent xDoc, - String docType, String exportType, String fileURL) - throws com.sun.star.uno.Exception { - XDocumentHandler xDocHandWriter = XMLTools.getFileXMLWriter(xMSF, fileURL) ; - Any arg = new Any(new Type(XDocumentHandler.class), xDocHandWriter); - XInterface oExp = (XInterface)xMSF.createInstanceWithArguments( - "com.sun.star.comp." + docType + ".XML" + exportType + "Exporter", - new Object[] {arg}); - XExporter xExp = UnoRuntime.queryInterface - (XExporter.class, oExp) ; - xExp.setSourceDocument(xDoc) ; - - XFilter filter = UnoRuntime.queryInterface(XFilter.class, oExp) ; - filter.filter(XMLTools.createMediaDescriptor( - new String[] {"FilterName"}, - new Object[] {"Custom filter"})) ; - } - - /** - * Imports document (the whole or a part) from the file specified - * in XML format. - * @param xMSF Soffice <code>ServiceManager</code> factory. - * @param xDoc Target document to be imported. - * @param docType Type of document (for example 'Calc', 'Writer', 'Draw') - * The type must start with <b>capital</b> letter. - * @param importType The type of export specifies if the whole - * document will be exported or one of its parts (Meta info, Styles, etc.). - * The following types supported (it hardly depends of XML data in file) : - * "" (empty string) - for the whole document ; - * "Content" - only content exported ; - * "Meta" - meta document info exported ; - * "Settings" - view settings of document exported ; - * "Styles" - document styles exported ; - * @param fileURL XML file name (in form file:///<path>) to be imported from. - */ - public static void importDocument(XMultiServiceFactory xMSF, XComponent xDoc, - String docType, String importType, String fileURL) - throws com.sun.star.uno.Exception { - - XInterface oImp = (XInterface)xMSF.createInstance( - "com.sun.star.comp." + docType + ".XML" + importType + "Importer"); - XImporter xImp = UnoRuntime.queryInterface - (XImporter.class, oImp) ; - XDocumentHandler xDocHandImp = UnoRuntime.queryInterface - (XDocumentHandler.class, oImp) ; - - xImp.setTargetDocument(xDoc) ; - parseXMLFile(xMSF, fileURL, xDocHandImp) ; - } } diff --git a/qadevOOo/runner/util/compare/DocComparator.java b/qadevOOo/runner/util/compare/DocComparator.java index 3521876f10d2..8503fda8254a 100644 --- a/qadevOOo/runner/util/compare/DocComparator.java +++ b/qadevOOo/runner/util/compare/DocComparator.java @@ -29,14 +29,12 @@ public interface DocComparator { public boolean isReferenceExistent() throws IOException; - public void createReference() throws IOException; - public boolean compare() throws IOException; - public boolean isDiffReferenceExistent() throws IOException; - public void createDiffReference() throws IOException; + + public boolean isDiffReferenceExistent() throws IOException; public boolean compareDiff() throws IOException; diff --git a/qadevOOo/runner/util/compare/GraphicalComparator.java b/qadevOOo/runner/util/compare/GraphicalComparator.java index f52e8f0bbfd7..30a39d3fdebc 100644 --- a/qadevOOo/runner/util/compare/GraphicalComparator.java +++ b/qadevOOo/runner/util/compare/GraphicalComparator.java @@ -51,24 +51,7 @@ class GraphicalComparator implements DocComparator return a; } - /** - * return a (FileFilter) function, which returns true, if the filename is a '*.prn' file - */ - FileFilter getTrueIfPRNFile_FileFilter() - { - FileFilter aFileFilter = new FileFilter() - { - public boolean accept( File pathname ) - { - if (pathname.getName().endsWith(".prn")) - { - return true; - } - return false; - } - }; - return aFileFilter; - } + /** * build a new file from _sEntry by diff --git a/qadevOOo/runner/util/dbg.java b/qadevOOo/runner/util/dbg.java index 99b0929bfbb4..2d711a1235c9 100644 --- a/qadevOOo/runner/util/dbg.java +++ b/qadevOOo/runner/util/dbg.java @@ -83,29 +83,7 @@ public class dbg { return types; } - /** - * Returns true if a specified target implements the interface with the - * given name. Note that the comparison is not case sensitive. - * @param xTarget The implementation which should be analysed. - * @param ifcName The name of the interface that is tested. The name can - * be full qualified, such as 'com.sun.star.io.XInputStream', or only - * consist of the interface name, such as 'XText'. - * @return True, if xTarget implements the interface named ifcType - * @see com.sun.star.uno.XInterface - */ - public static boolean implementsInterface( - XInterface xTarget, String ifcName) { - Type[] types = getInterfaceTypes(xTarget); - if( null != types ) { - int nLen = types.length; - for( int i = 0; i < nLen ; i++ ) { - if(types[i].getTypeName().toLowerCase().endsWith( - ifcName.toLowerCase())) - return true; - } - } - return false; - } + /** * Prints information about an interface type. @@ -203,18 +181,7 @@ public class dbg { } } - /** - * Print the names and the values of a sequnze of <code>PropertyValue</code> - * to to standard out. - * @param ps The property which should displayed - * @see com.sun.star.beans.PropertyValue - */ - public static void printProperyValueSequenzePairs(PropertyValue[] ps){ - for( int i = 0; i < ps.length; i++){ - printProperyValuePairs(ps[i], new PrintWriter(System.out)); - } - } /** * Print the names and the values of a sequenze of <code>PropertyValue</code> @@ -229,14 +196,7 @@ public class dbg { } } - /** - * Print the name and the value of a <code>PropertyValue</code> to to standard out. - * @param ps The property which should displayed - * @see com.sun.star.beans.PropertyValue - */ - public static void printProperyValuePairs(PropertyValue ps){ - printProperyValuePairs(ps, new PrintWriter(System.out)); - } + /** * Print the name and the value of a <code>PropertyValue</code> to a print writer. diff --git a/qadevOOo/runner/util/utils.java b/qadevOOo/runner/util/utils.java index 73664ce6989a..332a85deae47 100644 --- a/qadevOOo/runner/util/utils.java +++ b/qadevOOo/runner/util/utils.java @@ -215,38 +215,7 @@ public class utils { return; } - /** - * - * This method get the version for a given TestBase/platform combination - * - */ - public static String getVersion(String aFile, String aPlatform, String aTestbase) { - if ((aFile == null) || (aPlatform == null) || (aTestbase == null)) { - return "/"; - } - File the_file = new File(aFile); - try { - RandomAccessFile raf = new RandomAccessFile(the_file, "r"); - String res = ""; - while (!res.equals("[" + aTestbase.toUpperCase() + "]")) { - res = raf.readLine(); - } - res = "=/"; - while ((!res.startsWith(aPlatform)) || (res.startsWith("["))) { - res = raf.readLine(); - } - raf.close(); - if (res.startsWith("[")) { - res = "/"; - } - return res.substring(res.indexOf("=") + 1); - - } catch (Exception e) { - System.out.println("Couldn't find version"); - return "/"; - } - } /** * @@ -307,24 +276,7 @@ public class utils { return settingPath; } - public static void setOfficeSettingsValue(XMultiServiceFactory msf, String setting, String value) { - try { - Object settings = msf.createInstance("com.sun.star.comp.framework.PathSettings"); - XPropertySet pthSettings = null; - try { - pthSettings = (XPropertySet) AnyConverter.toObject( - new Type(XPropertySet.class), settings); - } catch (com.sun.star.lang.IllegalArgumentException iae) { - System.out.println("### couldn't get Office Settings"); - } - pthSettings.setPropertyValue(setting, value); - - } catch (Exception e) { - System.out.println("Couldn't set '" + setting + "' to value '" + value + "'"); - e.printStackTrace(); - } - } /** * This method returns the temp dicrectory of the user. @@ -570,15 +522,7 @@ public class utils { return true; } - public static void doOverwriteFile( - XMultiServiceFactory xMsf, String oldF, String newF) - { - try { - overwriteFile_impl(xMsf, oldF, newF); - } catch (InteractiveAugmentedIOException e) { - throw new RuntimeException(e); - } - } + public static boolean hasPropertyByName(XPropertySet props, String aName) { Property[] list = props.getPropertySetInfo().getProperties(); @@ -687,20 +631,7 @@ public class utils { return null; } - /** returns the path to the office binary folder - * - * @param msf The XMultiSeriveFactory - * @return the path to the office binrary or an empty string on any error - */ - public static String getOfficeBinPath(XMultiServiceFactory msf) { - String sysBinDir = ""; - try { - sysBinDir = utils.getSystemURL(utils.expandMacro(msf, "$SYSBINDIR")); - } catch (java.lang.Exception e) { - } - return sysBinDir; - } /** * Get an array of all property names from the property set. With the include @@ -871,37 +802,7 @@ public class utils { } - /** - * returns the platform of the office.<br> - * Since the runner and the office could run on different platform this function delivers the - * platform the office is running. - * @param xMSF the XMultiServiceFactory - * @return unxsols, unxsoli, unxlngi, wntmsci - */ - public static String getOfficeOS(XMultiServiceFactory xMSF) { - String platform = "unknown"; - - try { - String theOS = expandMacro(xMSF, "$_OS"); - if (theOS.equals("Windows")) { - platform = "wntmsci"; - } else if (theOS.equals("Linux")) { - platform = "unxlngi"; - } else { - if (theOS.equals("Solaris")) { - String theArch = expandMacro(xMSF, "$_ARCH"); - if (theArch.equals("SPARC")) { - platform = "unxsols"; - } else if (theArch.equals("x86")) { - platform = "unxsoli"; - } - } - } - } catch (Exception ex) { - } - return platform; - } /** * dispatches given <CODE>URL</CODE> to the document <CODE>XComponent</CODE> |