diff options
author | Noel Grandin <noel@peralex.com> | 2014-08-12 12:11:25 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-08-19 14:57:13 +0200 |
commit | 3a8d3519889a68ddf209ea7c83307bec51cd6da0 (patch) | |
tree | ab67ef1b6f1f65443b7c4d0e086fdcff17f84283 | |
parent | 8b65a61788aa18e97de068bc75fdeecb20a23026 (diff) |
java: remove unused methods
Change-Id: Ibb905e6f3e7d92a0e558f1f6562e5b472cd2717b
48 files changed, 1 insertions, 3279 deletions
diff --git a/bean/com/sun/star/comp/beans/OOoBean.java b/bean/com/sun/star/comp/beans/OOoBean.java index 1357f6adcad0..b84ad5c4dd2c 100644 --- a/bean/com/sun/star/comp/beans/OOoBean.java +++ b/bean/com/sun/star/comp/beans/OOoBean.java @@ -658,71 +658,6 @@ public class OOoBean - /** Stores a document to the given URL. - <p> - Due due a bug (50651) calling this method may cause the office to crash, - when at the same time the office writes a backup of the document. This bug - also affects {@link #storeToByteArray storeToByteArray} and - {@link #storeToStream storeToStream}. The workaround - is to start the office with the option --norestore, which disables the automatic - backup and recovery mechanism. OOoBean offers currently no supported way of providing - startup options for OOo. But it is possible to set a Java property when starting - Java, which is examined by OOoBean: - <pre> - java -Dcom.sun.star.officebean.Options=--norestore ... - </pre> - It is planned to offer a way of specifying startup options in a future version. - The property can be used until then. When using this property only one option - can be provided. - - @throws IllegalArgumentException - if either of the arguments is out of the specified range. - - @throws java.io.IOException - if an IO error occurs reading the resource specified by the URL. - - @throws com.sun.star.lang.NoConnectionException - if no connection is established. - - @throws NoDocumentException - if no document is loaded - */ - private void storeToURL( - final String aURL, - final com.sun.star.beans.PropertyValue aArguments[] ) - throws - // @requirement FUNC.CON.LOST/0.2 - NoConnectionException, - java.io.IOException, - com.sun.star.lang.IllegalArgumentException, - NoDocumentException - { - // no document available? - if ( aDocument == null ) - throw new NoDocumentException(); - - try - { - // start runtime timeout - CallWatchThread aCallWatchThread = - new CallWatchThread( nOOoCallTimeOut, "storeToURL" ); - - // store the document - try { aDocument.storeToURL( aURL, aArguments ); } - catch ( com.sun.star.io.IOException aExc ) - { throw new java.io.IOException(); } - - // end runtime timeout - aCallWatchThread.cancel(); - } - catch ( java.lang.InterruptedException aExc ) - { throw new NoConnectionException(); } - } - - - - - // @requirement FUNC.BEAN.PROG/0.5 // @requirement API.SIM.SEAP/0.2 /** returns the <type scope="com::sun::star::frame">Frame</a> diff --git a/framework/qa/complex/framework/autosave/Protocol.java b/framework/qa/complex/framework/autosave/Protocol.java index db53ea6adb6b..33b3d1dd2127 100644 --- a/framework/qa/complex/framework/autosave/Protocol.java +++ b/framework/qa/complex/framework/autosave/Protocol.java @@ -681,17 +681,6 @@ public class Protocol extends JComponent return "********************************************************************************\n"; } - private String impl_generateHTMLFooter() - { - return "\n</table>\n</body>\n</html>\n"; - } - - private String impl_generateAsciiFooter() - { - return "\n\n"; - } - - /** * helper to log different representations of a property(array) * diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalString.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalString.java index bb7bf8d8dfe8..fc77d0f9a42e 100644 --- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalString.java +++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalString.java @@ -23,7 +23,6 @@ package net.adaptivebox.global; -import java.io.*; import java.util.*; public class GlobalString { @@ -49,81 +48,4 @@ public class GlobalString { - private static int getCharLoc(char data, String str) { - for(int i=0; i<str.length(); i++) { - if(str.charAt(i)==data) return i; - } - return -1; - } - private static String trim(String origStr, String discardStr) { - String str = origStr; - do { - if(str.length()==0) return str; - if(getCharLoc(str.charAt(0), discardStr)!=-1) str = str.substring(1); - else if(getCharLoc(str.charAt(str.length()-1), discardStr)!=-1) str = str.substring(0, str.length()-1); - else {return str;} - } while(true); - } - - private static boolean getFirstCharExist(String str, String chars) throws Exception { - int neglectFirstCharLength = chars.length(); - for(int i=0; i<neglectFirstCharLength; i++) { - if(str.startsWith(chars.substring(i, i+1))) { - return true; - } - } - return false; - } - - private static String getMeaningfulLine(BufferedReader outReader, String neglectFirstChars) throws Exception { - String str; - boolean isNeglect = true; - do { - str = outReader.readLine(); - if (str==null) { - return null; - } - str = trim(str, " \t"); - if(str.length()>0) { - isNeglect = getFirstCharExist(str, neglectFirstChars); - } - } while (isNeglect); - return str; - } - - private static String[] getMeaningfulLines(String srcStr, String neglectFirstChars) throws Exception { - StringReader outStringReader = new StringReader(srcStr); - BufferedReader outReader = new BufferedReader(outStringReader); - ArrayList<String> origData = new ArrayList<String>(); - while(true) { - String str = getMeaningfulLine(outReader, neglectFirstChars); - if (str==null) { - break; - } - origData.add(str); - } - return convert1DVectorToStringArray(origData); - } - - /** - * convert vector to 1D String array - */ - private static String[] convert1DVectorToStringArray(ArrayList<String> toToConvert) { - if (toToConvert==null) return null; - String[] objs = new String[toToConvert.size()]; - for (int i=0; i<toToConvert.size(); i++) { - objs[i] = getObjString(toToConvert.get(i)); - } - return(objs); - } - - private static String getObjString(Object nObj) { - if(nObj instanceof String) return (String)nObj; - return nObj.toString(); - } - - - - - }
\ No newline at end of file diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/RandomGenerator.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/RandomGenerator.java index 549d9e14c89d..448ae01d9d64 100644 --- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/RandomGenerator.java +++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/RandomGenerator.java @@ -53,17 +53,6 @@ public static double doubleRangeRandom(double lowLimit,double upLimit){ - private static int[] randomSelection(int[] totalIndices, int times) { - if (times>=totalIndices.length) { - return totalIndices; - } - int[] indices = randomSelection(totalIndices.length, times); - for(int i=0; i<indices.length; i++) { - indices[i] = totalIndices[indices[i]]; - } - return indices; - } - public static int[] randomSelection(int maxNum, int times) { if(times<=0) return new int[0]; int realTimes = Math.min(maxNum, times); diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/DesignSpace.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/DesignSpace.java index d2e3f5a55fe2..bc17ebd2f03b 100644 --- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/DesignSpace.java +++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/DesignSpace.java @@ -51,16 +51,6 @@ public class DesignSpace { return dimProps[dim].paramBound.boundAdjust(val); } - private void annulusAdjust (double[] location){ - for (int i=0; i<getDimension(); i++) { - location[i] = dimProps[i].paramBound.annulusAdjust(location[i]); - } - } - - - - - public void mutationAt(double[] location, int i){ location[i] = dimProps[i].paramBound.getRandomValue(); } diff --git a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseNLPSolver.java b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseNLPSolver.java index 8a85b5ad2d87..8794beb96e0c 100644 --- a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseNLPSolver.java +++ b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseNLPSolver.java @@ -45,7 +45,6 @@ import com.sun.star.lang.XMultiComponentFactory; import com.sun.star.lib.uno.helper.WeakBase; import com.sun.star.sheet.SolverConstraint; import com.sun.star.sheet.SolverConstraintOperator; -import com.sun.star.sheet.XCellRangeData; import com.sun.star.sheet.XSpreadsheet; import com.sun.star.sheet.XSpreadsheetDocument; import com.sun.star.sheet.XSpreadsheets; @@ -362,21 +361,6 @@ public abstract class BaseNLPSolver extends WeakBase - private XCellRangeData getCellRangeData(int sheet, int startCol, int startRow, int endCol, int endRow) { - try { - XSpreadsheets xSpreadsheets = m_document.getSheets(); - XIndexAccess xSheetIndex = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets); - XSpreadsheet xSpreadsheet = UnoRuntime.queryInterface(XSpreadsheet.class, xSheetIndex.getByIndex(sheet)); - return UnoRuntime.queryInterface(XCellRangeData.class, xSpreadsheet.getCellRangeByPosition(startCol, startRow, endCol, endRow)); - } catch (IndexOutOfBoundsException ex) { - Logger.getLogger(BaseNLPSolver.class.getName()).log(Level.SEVERE, null, ex); - } catch (WrappedTargetException ex) { - Logger.getLogger(BaseNLPSolver.class.getName()).log(Level.SEVERE, null, ex); - } - - return null; - } - private XChartDataArray getChartDataArray(CellRangeAddress cellRangeAddress) { return getChartDataArray(cellRangeAddress.Sheet, cellRangeAddress.StartColumn, cellRangeAddress.StartRow, cellRangeAddress.EndColumn, cellRangeAddress.EndRow); diff --git a/odk/examples/DevelopersGuide/Database/Sales.java b/odk/examples/DevelopersGuide/Database/Sales.java index ff1ec6555761..7a983c727ec9 100644 --- a/odk/examples/DevelopersGuide/Database/Sales.java +++ b/odk/examples/DevelopersGuide/Database/Sales.java @@ -33,7 +33,6 @@ *************************************************************************/ import com.sun.star.uno.*; -import com.sun.star.util.Date; import com.sun.star.beans.XPropertySet; import com.sun.star.sdbc.*; @@ -108,49 +107,6 @@ public class Sales - // inserts a row programmatically. - private void insertRow() throws com.sun.star.uno.Exception - { - // example for a programmatic way to do updates. - XStatement stmt = con.createStatement(); - XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class,stmt); - xProp.setPropertyValue("ResultSetType", new java.lang.Integer(ResultSetType.SCROLL_INSENSITIVE)); - xProp.setPropertyValue("ResultSetConcurrency", new java.lang.Integer(ResultSetConcurrency.UPDATABLE)); - XResultSet rs = stmt.executeQuery("SELECT * FROM SALES"); - XRow row = UnoRuntime.queryInterface(XRow.class,rs); - - // insert a new row - XRowUpdate updateRow = UnoRuntime.queryInterface(XRowUpdate.class,rs); - XResultSetUpdate updateRs = UnoRuntime. queryInterface(XResultSetUpdate.class,rs); - updateRs.moveToInsertRow(); - updateRow.updateInt(1, 4); - updateRow.updateInt(2, 102); - updateRow.updateInt(3, 5); - updateRow.updateString(4, "FTOP Darjeeling tea"); - updateRow.updateDate(5, new Date((short)1,(short)2,(short)2002)); - updateRow.updateFloat(6, 150); - updateRs.insertRow(); - } - - // deletes a row programmatically. - private void deleteRow() throws com.sun.star.uno.Exception - { - // example for a programmatic way to do updates. - XStatement stmt = con.createStatement(); - XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class,stmt); - xProp.setPropertyValue("ResultSetType", new java.lang.Integer(ResultSetType.SCROLL_INSENSITIVE)); - xProp.setPropertyValue("ResultSetConcurrency", new java.lang.Integer(ResultSetConcurrency.UPDATABLE)); - XResultSet rs = stmt.executeQuery("SELECT * FROM SALES"); - XRow row = UnoRuntime.queryInterface(XRow.class,rs); - - XResultSetUpdate updateRs = UnoRuntime. queryInterface(XResultSetUpdate.class,rs); - // move to the inserted row - rs.absolute(4); - updateRs.deleteRow(); - } - - - // displays the column names public void displayColumnNames() throws com.sun.star.uno.Exception { diff --git a/odk/examples/DevelopersGuide/Forms/HsqlDatabase.java b/odk/examples/DevelopersGuide/Forms/HsqlDatabase.java index 8350c9291690..311908d313dc 100644 --- a/odk/examples/DevelopersGuide/Forms/HsqlDatabase.java +++ b/odk/examples/DevelopersGuide/Forms/HsqlDatabase.java @@ -89,24 +89,6 @@ public class HsqlDatabase storable.storeAsURL( m_databaseDocumentFile, new PropertyValue[]{} ); } - /** returns a connection to the database - * - * Multiple calls to this method return the same connection. The HsqlDatabase object keeps - * the ownership of the connection, so you don't need to (and should not) dispose/close it. - * - */ - private XConnection defaultConnection() throws SQLException - { - if ( m_connection != null ) - return m_connection; - m_connection = m_databaseDocument.getDataSource().getConnection(new String(),new String()); - return m_connection; - } - - - - - /** closes the database document * * Any CloseVetoExceptions fired by third parties are ignored, and any reference to the diff --git a/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java b/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java index 5bf285392333..3c52f56fd10e 100644 --- a/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java +++ b/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java @@ -70,10 +70,8 @@ import com.sun.star.awt.XToolkit; import com.sun.star.awt.XTopWindow; import com.sun.star.awt.XWindow; import com.sun.star.awt.XWindowPeer; -import com.sun.star.beans.PropertyValue; import com.sun.star.beans.XMultiPropertySet; import com.sun.star.beans.XPropertySet; -import com.sun.star.configuration.theDefaultProvider; import com.sun.star.container.XIndexContainer; import com.sun.star.container.XNameAccess; import com.sun.star.container.XNameContainer; @@ -184,25 +182,6 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis } - private XNameAccess getRegistryKeyContent(String _sKeyName){ - try { - PropertyValue[] aNodePath = new PropertyValue[1]; - XMultiServiceFactory xMSFConfig = theDefaultProvider.get(m_xContext); - aNodePath[0] = new PropertyValue(); - aNodePath[0].Name = "nodepath"; - aNodePath[0].Value = _sKeyName; - Object oNode = xMSFConfig.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", aNodePath); - XNameAccess xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, oNode); - return xNameAccess; - } catch (Exception exception) { - exception.printStackTrace(System.err); - return null; - } - } - - - - protected void createDialog(XMultiComponentFactory _xMCF) { try { Object oDialogModel = _xMCF.createInstanceWithContext("com.sun.star.awt.UnoControlDialogModel", m_xContext); diff --git a/odk/examples/java/Inspector/HideableTreeModel.java b/odk/examples/java/Inspector/HideableTreeModel.java index 6fea28681b7b..dae9d0cdff0a 100644 --- a/odk/examples/java/Inspector/HideableTreeModel.java +++ b/odk/examples/java/Inspector/HideableTreeModel.java @@ -17,9 +17,6 @@ */ import java.util.ArrayList; -import java.util.Enumeration; - -import javax.swing.JTree; import javax.swing.event.TreeModelEvent; import javax.swing.event.TreeModelListener; import javax.swing.tree.TreeModel; @@ -87,14 +84,6 @@ public class HideableTreeModel implements TreeModel { - private void reload(Object node) { - if(node != null) { - TreePath tp = new TreePath(getPathToRoot(node)); - fireTreeStructureChanged(new TreeModelEvent(this, tp)); - } - } - - public void valueForPathChanged(TreePath path, Object newValue) { nodeChanged(path.getLastPathComponent()); } @@ -153,30 +142,7 @@ public class HideableTreeModel implements TreeModel { } } - private void fireTreeStructureChanged(TreeModelEvent event) { - for(TreeModelListener l : modelListeners) { - l.treeStructureChanged(event); - } - } - - - - - - private void addExpandedPaths(JTree tree, TreePath path, ArrayList<TreePath> pathlist) { - Enumeration aEnum = tree.getExpandedDescendants(path); - while(aEnum.hasMoreElements()) { - TreePath tp = (TreePath) aEnum.nextElement(); - pathlist.add(tp); - addExpandedPaths(tree, tp, pathlist); - } - } - - - - - - public boolean isLeaf(Object _oNode) { + public boolean isLeaf(Object _oNode) { if(_oNode instanceof TreeNode) { return ((TreeNode) _oNode).isLeaf(); } diff --git a/odk/examples/java/Inspector/SourceCodeGenerator.java b/odk/examples/java/Inspector/SourceCodeGenerator.java index 5444c7aec8ca..2eae0ff44f22 100644 --- a/odk/examples/java/Inspector/SourceCodeGenerator.java +++ b/odk/examples/java/Inspector/SourceCodeGenerator.java @@ -613,23 +613,11 @@ private class UnoObjectDefinition{ } - public void setTypeClass(TypeClass _aTypeClass){ - sVariableStemName = ""; - m_aTypeClass = _aTypeClass; - } - - public TypeClass getTypeClass(){ return m_aTypeClass; } - public void setTypeName(String _sTypeName){ - sVariableStemName = ""; - m_sTypeName = _sTypeName; - } - - public String getTypeName(){ return m_sTypeName; } @@ -1080,10 +1068,6 @@ private class UnoObjectDefinition{ return "short"; } - public String getunsignedshortTypeDescription(){ - return "short"; - } - public String getlongTypeDescription(){ return "int"; } @@ -1121,15 +1105,6 @@ private class UnoObjectDefinition{ } } - public String gettypeTypeDescription(boolean _bAsHeaderSourceCode){ - if (_bAsHeaderSourceCode){ - return "com.sun.star.uno.Type"; - } - else{ - return "Type"; - } - } - public String getanyTypeDescription(boolean _bAsHeaderSourceCode){ if (_bAsHeaderSourceCode){ return ""; @@ -1157,21 +1132,6 @@ private class UnoObjectDefinition{ } - public String getArrayDeclaration(String _sVariableDeclaration){ - String sReturn = ""; - String[] sDeclarations = _sVariableDeclaration.split(" "); - for (int i = 0; i< sDeclarations.length;i++){ - sReturn += sDeclarations[i]; - if (i == 0){ - sReturn += "[]"; - } - if (i < (sDeclarations.length -1)){ - sReturn += " "; - } - } - return sReturn; - } - public String getCommentSign(){ return "//"; } @@ -1280,10 +1240,6 @@ private class UnoObjectDefinition{ return "Integer"; } - public String getunsignedshortTypeDescription(){ - return "Integer"; - } - public String getlongTypeDescription(){ return "Integer"; } @@ -1321,15 +1277,6 @@ private class UnoObjectDefinition{ } } - public String gettypeTypeDescription(boolean _bAsHeaderSourceCode){ - if (_bAsHeaderSourceCode){ - return ""; - } - else{ - return "Object"; - } - } - public String getanyTypeDescription(boolean _bAsHeaderSourceCode){ if (_bAsHeaderSourceCode){ return ""; @@ -1361,21 +1308,6 @@ private class UnoObjectDefinition{ } - public String getArrayDeclaration(String _sVariableDeclaration){ - String sReturn = ""; - String[] sDeclarations = _sVariableDeclaration.split(" "); - for (int i = 0; i< sDeclarations.length;i++){ - sReturn += sDeclarations[i]; - if (i == 0){ - sReturn += "[]"; - } - if (i < (sDeclarations.length -1)){ - sReturn += " "; - } - } - return sReturn; - } - public String getCommentSign(){ return "'"; } @@ -1596,10 +1528,6 @@ private class UnoObjectDefinition{ return "sal_Int16"; } - public String getunsignedshortTypeDescription(){ - return "sal_uInt16"; - } - public String getlongTypeDescription(){ return "sal_Int32"; } @@ -1638,15 +1566,6 @@ private class UnoObjectDefinition{ } } - public String gettypeTypeDescription(boolean _bAsHeaderSourceCode){ - if (_bAsHeaderSourceCode){ - return "com/sun/star/uno/Type"; - } - else{ - return "Type"; - } - } - public String getanyTypeDescription(boolean _bAsHeaderSourceCode){ if (_bAsHeaderSourceCode){ return "com/sun/star/uno/XInterface"; @@ -1705,16 +1624,6 @@ private class UnoObjectDefinition{ return sReturn; } - public String getArrayDeclaration(String _sVariableDeclaration){ - this.bIncludeSequenceHeader = true; - String sReturn = ""; - String[] sDeclarations = _sVariableDeclaration.split(" "); - if (sDeclarations.length == 2){ - sReturn = getCSSNameSpaceString() +"::uno::Sequence<" + sDeclarations[1] + ">"; - } - return sReturn; - } - public String getCommentSign(){ return "//"; } diff --git a/qadevOOo/runner/complexlib/Assurance.java b/qadevOOo/runner/complexlib/Assurance.java index 575ec0793f69..3c12ca7156ff 100644 --- a/qadevOOo/runner/complexlib/Assurance.java +++ b/qadevOOo/runner/complexlib/Assurance.java @@ -18,9 +18,6 @@ package complexlib; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - /** * I have removed the assure(...) functions from ComplexTestCase due to the fact now I can * use the functions every where and don't need to be a ComplexTestCase any longer. @@ -122,66 +119,6 @@ public class Assurance - /** invokes a given method on a given object, and assures a certain exception is caught - * @param _message is the message to print when the check fails - * @param _object is the object to invoke the method on - * @param _methodName is the name of the method to invoke - * @param _methodArgs are the arguments to pass to the method. - * @param _argClasses are the classes to assume for the arguments of the methods - * @param _expectedExceptionClass is the class of the exception to be caught. If this is null, - * it means that <em>no</em> exception must be throw by invoking the method. - */ - private void assureException( final String _message, final Object _object, final String _methodName, - final Class<?>[] _argClasses, final Object[] _methodArgs, final Class<?> _expectedExceptionClass ) - { - Class<?> objectClass = _object.getClass(); - - boolean noExceptionAllowed = ( _expectedExceptionClass == null ); - - boolean caughtExpected = noExceptionAllowed; - try - { - Method method = objectClass.getMethod( _methodName, _argClasses ); - method.invoke(_object, _methodArgs ); - } - catch ( InvocationTargetException e ) - { - caughtExpected = noExceptionAllowed - ? false - : ( e.getTargetException().getClass().equals( _expectedExceptionClass ) ); - } - catch( Exception e ) - { - caughtExpected = false; - } - - assure( _message, caughtExpected ); - } - - /** invokes a given method on a given object, and assures a certain exception is caught - * @param _message is the message to print when the check fails - * @param _object is the object to invoke the method on - * @param _methodName is the name of the method to invoke - * @param _methodArgs are the arguments to pass to the method. Those implicitly define - * the classes of the arguments of the method which is called. - * @param _expectedExceptionClass is the class of the exception to be caught. If this is null, - * it means that <em>no</em> exception must be throw by invoking the method. - */ - private void assureException( final String _message, final Object _object, final String _methodName, - final Object[] _methodArgs, final Class<?> _expectedExceptionClass ) - { - Class<?>[] argClasses = new Class[ _methodArgs.length ]; - for ( int i=0; i<_methodArgs.length; ++i ) - argClasses[i] = _methodArgs[i].getClass(); - assureException( _message, _object, _methodName, argClasses, _methodArgs, _expectedExceptionClass ); - } - - - - - - - /** * Mark the currently executed method as failed. * with the given message. diff --git a/qadevOOo/runner/convwatch/IniFile.java b/qadevOOo/runner/convwatch/IniFile.java index 1e7795d4abd5..eaa511afa47d 100644 --- a/qadevOOo/runner/convwatch/IniFile.java +++ b/qadevOOo/runner/convwatch/IniFile.java @@ -198,39 +198,6 @@ class IniFile return -1; } - // i must be the index in the list, where the well known section starts - private int findLastKnownKeyIndex(int _nSectionIndex, String _sKey) - { - _sKey = toLowerIfNeed(_sKey); - int i = _nSectionIndex + 1; - for (int j=i; j<m_aList.size();j++) - { - String sLine = getItem(j).trim(); - - if (isRemark(sLine)) - { - continue; - } - - if (sLine.startsWith("[")) - { - // found end. - return j; - } - - int nEqual = sLine.indexOf("="); - if (nEqual >= 0) - { - String sKey = toLowerIfNeed(sLine.substring(0, nEqual).trim()); - if (sKey.equals(_sKey)) - { - return j; - } - } - } - return i; - } - private String getValue(int _nIndex) { String sLine = getItem(_nIndex).trim(); diff --git a/qadevOOo/runner/convwatch/PRNCompare.java b/qadevOOo/runner/convwatch/PRNCompare.java index dc9b9eb2344f..501ec30ebe17 100644 --- a/qadevOOo/runner/convwatch/PRNCompare.java +++ b/qadevOOo/runner/convwatch/PRNCompare.java @@ -315,115 +315,6 @@ public class PRNCompare } - private StatusHelper[] createDiffs(String[] _aRefList, String[] _aPSList, int _nMaxDiffs, TriState _tUseBorderMove) - { - if (_nMaxDiffs < 1) - { - _nMaxDiffs = 1; - } - - // count, from which file (jpegs) exist more, take the less one - // more are not compareable - - // take the min of both - int nMin = Math.min(_aRefList.length, _aPSList.length); - nMin = Math.min(nMin, _nMaxDiffs); - - StatusHelper[] aList = new StatusHelper[nMin]; - -// TODO: if both document do not have same page count, produce an error - - int nStatusIndex = 0; - for (int i=1;i<=nMin;i++) - { - String sOldGfx = _aRefList[i]; - String sNewGfx = _aPSList[i]; - - - String sDiffGfx = compareJPEGs(sOldGfx, sNewGfx ); - StatusHelper aStatus = new StatusHelper(sOldGfx, sNewGfx, sDiffGfx); - - if (sDiffGfx.length() > 0) - { - int nResult = identify(sDiffGfx); - if (nResult == 1) - { - aStatus.nDiffStatus = StatusHelper.DIFF_NO_DIFFERENCES; - } - else - { - try - { - int nPercent = estimateGfx(sOldGfx, sNewGfx, sDiffGfx); - - aStatus.nDiffStatus = StatusHelper.DIFF_DIFFERENCES_FOUND; - aStatus.nPercent = nPercent; - - if (nPercent > 75 && - ((_tUseBorderMove == TriState.TRUE ) || - ((_tUseBorderMove == TriState.UNSET) && - m_sDocumentType.indexOf("MS PowerPoint") > 0))) - { - _tUseBorderMove = TriState.TRUE; -// TODO: problem is here, that we have to create some new names. - - String sBasename1 = FileHelper.getBasename(sOldGfx); - String sNameNoSuffix1 = FileHelper.getNameNoSuffix(sBasename1); - String sBasename2 = FileHelper.getBasename(sNewGfx); - String sNameNoSuffix2 = FileHelper.getNameNoSuffix(sBasename2); - - String sTmpDir = util.utils.getUsersTempDir(); - String fs = System.getProperty("file.separator"); - - String sOld_BM_Gfx = sTmpDir + fs + sNameNoSuffix1 + "-BM-" + StringHelper.createValueString(i, 4) + ".jpg"; - String sNew_BM_Gfx = sTmpDir + fs + sNameNoSuffix2 + "-BM-" + StringHelper.createValueString(i, 4) + ".jpg"; - try - { - BorderRemover a = new BorderRemover(); - a.createNewImageWithoutBorder(sOldGfx, sOld_BM_Gfx); - a.createNewImageWithoutBorder(sNewGfx, sNew_BM_Gfx); - - String sDiff_BM_Gfx = compareJPEGs( sOld_BM_Gfx, sNew_BM_Gfx ); - - aStatus.setFilesForBorderMove(sOld_BM_Gfx, sNew_BM_Gfx, sDiff_BM_Gfx); - - if (sDiff_BM_Gfx.length() > 0) - { - nResult = identify(sDiff_BM_Gfx); - if (nResult == 1) - { - aStatus.nDiffStatus = StatusHelper.DIFF_AFTER_MOVE_DONE_NO_PROBLEMS; - aStatus.nPercent2 = 0; - } - else - { - nPercent = estimateGfx(sOld_BM_Gfx, sNew_BM_Gfx, sDiff_BM_Gfx); - aStatus.nDiffStatus = StatusHelper.DIFF_AFTER_MOVE_DONE_DIFFERENCES_FOUND; - aStatus.nPercent2 = nPercent; - } - } - else - { - } - } - catch(java.io.IOException e) - { - GlobalLogWriter.get().println("Exception caught. At border remove: " + e.getMessage()); - } - } - } - catch (java.io.IOException e) - { - GlobalLogWriter.get().println(e.getMessage()); - } - } - - } - aList[nStatusIndex ++] = aStatus; - } - return aList; - } - public static String compareJPEGs(String _sOldGfx, String _sNewGfx) { String sBasename1 = FileHelper.getBasename(_sOldGfx); diff --git a/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java b/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java index 8d9e8c9ecd4a..1d3081af6794 100644 --- a/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java +++ b/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java @@ -24,10 +24,6 @@ import java.io.RandomAccessFile; import helper.ProcessHandler; import java.util.ArrayList; import helper.OSHelper; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import org.w3c.dom.Document; -import org.w3c.dom.Node; /** * This object gives all functionallity to print msoffice documents. @@ -416,87 +412,6 @@ public class MSOfficePostscriptCreator implements IOffice return aList; } - private ArrayList<String> createWordStoreHelper() throws java.io.IOException - { - // create a program in tmp file - String sTmpPath = util.utils.getUsersTempDir(); - String ls = System.getProperty("line.separator"); - - String sSaveViaWord = "saveViaWord.pl"; - - ArrayList<String> aList = searchLocalFile(sSaveViaWord); - if (aList.isEmpty() == false) - { - return aList; - } - - String sName = FileHelper.appendPath(sTmpPath, sSaveViaWord); - if (FileHelper.isDebugEnabled()) - { - GlobalLogWriter.println("No local found, create a perl script: " + sName); - } - - File aFile = new File(sName); - FileWriter out = new FileWriter(aFile); - - out.write( "eval 'exec perl -wS $0 ${1+\"$@\"}' " + ls ); - out.write( " if 0; " + ls ); - out.write( "use strict; " + ls ); - out.write( " " + ls ); - out.write( "if ( $^O ne \"MSWin32\") " + ls ); - out.write( "{ " + ls ); - out.write( " print 'Windows only.\\n'; " + ls ); - out.write( " print_usage(); " + ls ); - out.write( " exit(1); " + ls ); - out.write( "} " + ls ); - out.write( " " + ls ); - out.write( "use Win32::OLE; " + ls ); - out.write( "use Win32::OLE::Const 'Microsoft Word'; " + ls ); - out.write( " " + ls ); - out.write( "# ------ usage ------ " + ls ); - out.write( "sub print_usage() " + ls ); - out.write( "{ " + ls ); - out.write( " print STDERR \"Usage: storeViaWord.pl <Word file> <output filer> <output file> \\n\" " + ls ); - out.write( "} " + ls ); - out.write( " " + ls ); - out.write( " " + ls ); - out.write( "if ($#ARGV != 2) " + ls ); - out.write( "{ " + ls ); - out.write( " print 'Too less arguments.\\n'; " + ls ); - out.write( " print_usage(); " + ls ); - out.write( " exit(1); " + ls ); - out.write( "} " + ls ); - out.write( " " + ls ); - out.write( " " + ls ); - out.write( "my $Word = Win32::OLE->new('Word.Application'); " + ls ); - out.write( "# $Word->{'Visible'} = 1; # if you want to see what's going on " + ls ); - out.write( "my $Book = $Word->Documents->Open($ARGV[0]) " + ls ); - out.write( " || die('Unable to open document ', Win32::OLE->LastError()); " + ls ); - out.write( "# my $oldActivePrinte = $Word->{ActivePrinter} ; " + ls ); - out.write( "# $Word->{ActivePrinter} = $ARGV[1]; " + ls ); - out.write( "# $Word->ActiveDocument->PrintOut({ " + ls ); - out.write( "# Background => 0, " + ls ); - out.write( "# Append => 0, " + ls ); - out.write( "# Range => wdPrintAllDocument, " + ls ); - out.write( "# Item => wdPrintDocumentContent, " + ls ); - out.write( "# Copies => 1, " + ls ); - out.write( "# PageType => wdPrintAllPages, " + ls ); - out.write( "# PrintToFile => 1, " + ls ); - out.write( "# OutputFileName => $ARGV[2] " + ls ); - out.write( "# }); " + ls ); - out.write( "# $Word->{ActivePrinter} = $oldActivePrinte; " + ls ); - out.write( "$Book->savaAs($ARGV[2], $ARGV[1]); " + ls ); - out.write( "# ActiveDocument.Close(SaveChanges:=WdSaveOptions.wdDoNotSaveChanges)" + ls ); - out.write( "$Book->Close({SaveChanges => 0}); " + ls ); - out.write( "$Word->Quit(); " + ls ); - out.close(); - - aList.add(getPerlExe()); - aList.add(sName); - return aList; - } - - private ArrayList<String> createExcelPrintHelper() throws java.io.IOException { // create a program in tmp file @@ -595,95 +510,6 @@ public class MSOfficePostscriptCreator implements IOffice return aList; } - private ArrayList<String> createExcelStoreHelper() throws java.io.IOException - { - // create a program in tmp file - String sTmpPath = util.utils.getUsersTempDir(); - String ls = System.getProperty("line.separator"); - - String sSaveViaExcel = "saveViaExcel.pl"; - - ArrayList<String> aList = searchLocalFile(sSaveViaExcel); - if (aList.isEmpty() == false) - { - return aList; - } - String sName = FileHelper.appendPath(sTmpPath, sSaveViaExcel); - if (FileHelper.isDebugEnabled()) - { - GlobalLogWriter.println("No local found, create a script: " + sName); - } - - File aFile = new File(sName); - FileWriter out = new FileWriter(aFile); - - out.write( "eval 'exec perl -wS $0 ${1+\"$@\"}' " + ls ); - out.write( " if 0; " + ls ); - out.write( "use strict; " + ls ); - out.write( "# This script is automatically created. " + ls ); - out.write( " " + ls ); - out.write( "use Win32::OLE qw(in with); " + ls ); - out.write( "use Win32::OLE::Const 'Microsoft Excel'; " + ls ); - out.write( " " + ls ); - out.write( "# ------ usage ------ " + ls ); - out.write( "sub print_usage() " + ls ); - out.write( "{ " + ls ); - out.write( " print STDERR \"Usage: savaViaExcel.pl <Excel file> <filefilter> <output file> .\\n " + ls ); - out.write( " execl_print.pl c:\\book1.xls Apple LaserWriter II NT v47.0 c:\\output\\book1.ps \\n\"; " + ls ); - out.write( "} " + ls ); - out.write( " " + ls ); - out.write( " " + ls ); - out.write( " " + ls ); - out.write( "$Win32::OLE::Warn = 3; # die on errors... " + ls ); - out.write( " " + ls ); - out.write( " " + ls ); - out.write( "if ($#ARGV != 2) " + ls ); - out.write( "{ " + ls ); - out.write( " print \"Too less arguments.\\n\"; " + ls ); - out.write( " print_usage(); " + ls ); - out.write( " exit(1); " + ls ); - out.write( "} " + ls ); - out.write( " " + ls ); - out.write( "my $Excel = Win32::OLE->GetActiveObject('Excel.Application') " + ls ); - out.write( " || Win32::OLE->new('Excel.Application', 'Quit'); # get already active Excel " + ls ); - out.write( " # application or open new " + ls ); - out.write( "my $sFilterParameter = $ARGV[1]; " + ls ); - out.write( "my $sFilterName = xlHTML; " + ls ); - out.write( "if ($sFilterParameter eq 'xlXMLSpreadsheet') " + ls ); - out.write( "{ " + ls ); - out.write( " $sFilterName = xlXMLSpreadsheet; " + ls ); - out.write( "} " + ls ); - out.write( "elsif ($sFilterParameter eq 'xlHTML') " + ls ); - out.write( "{ " + ls ); - out.write( " $sFilterName = xlHTML; " + ls ); - out.write( "} " + ls ); - out.write( "else " + ls ); - out.write( "{ " + ls ); - out.write( " my $undefined; " + ls); - out.write( " $sFilterName = $undefined; " + ls ); - out.write( "} " + ls ); - out.write( " " + ls ); - out.write( "my $Book = $Excel->Workbooks->Open( $ARGV[0] ); " + ls ); - out.write( "$Excel->{DisplayAlerts} = 0; " + ls ); - out.write( "$Book->saveAs($ARGV[2], " + ls ); - out.write( " $sFilterName, " + ls ); - out.write( " '', " + ls ); - out.write( " '', " + ls ); - out.write( " 0, " + ls ); - out.write( " 0, " + ls ); - out.write( " xlNoChange, " + ls ); - out.write( " xlLocalSessionChanges, " + ls ); - out.write( " 1); " + ls ); - out.write( "# Close worksheets without store changes" + ls ); - out.write( "# $Book->Close({SaveChanges => 0}); " + ls ); - out.write( "$Excel->Quit(); " + ls ); - out.close(); - - aList.add(getPerlExe()); - aList.add(sName); - return aList; - } - private ArrayList<String> createPowerPointPrintHelper() throws java.io.IOException { // create a program in tmp file @@ -855,39 +681,4 @@ public class MSOfficePostscriptCreator implements IOffice return sOfficeType; } - private static String getXMLDocumentFormat(String _sInputFile) - { - String sType = "word"; // default - try - { - // ---- Parse XML file ---- - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - DocumentBuilder builder = factory.newDocumentBuilder(); - Document document = builder.parse( new File (_sInputFile) ); - Node rootNode = document.getDocumentElement(); - - // ---- Get list of nodes to given tag ---- - // document. - String sRootNodeName = rootNode.getNodeName(); - if (sRootNodeName.equals("w:wordDocument")) - { - sType = "word"; - } - else if (sRootNodeName.equals("WorkBook")) - { - sType = "excel"; - } - // there exists no powerpoint xml representation in MSOffice 2003 - else - { - GlobalLogWriter.println("Error: unknown root node: '" + sRootNodeName + "' please check the document. Try to use Word as default."); - sType = "word"; // default - } - } - catch (java.lang.Exception e) - { - } - return sType; - } - } diff --git a/qadevOOo/runner/graphical/OpenOfficePostscriptCreator.java b/qadevOOo/runner/graphical/OpenOfficePostscriptCreator.java index 9b224b82120f..f63c623975d0 100644 --- a/qadevOOo/runner/graphical/OpenOfficePostscriptCreator.java +++ b/qadevOOo/runner/graphical/OpenOfficePostscriptCreator.java @@ -26,8 +26,6 @@ import java.util.ArrayList; import com.sun.star.uno.UnoRuntime; import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.document.XTypeDetection; -import com.sun.star.container.XNameAccess; import com.sun.star.frame.XDesktop; import com.sun.star.beans.XPropertySet; import com.sun.star.beans.PropertyValue; @@ -584,236 +582,6 @@ public class OpenOfficePostscriptCreator implements IOffice - private String getInternalFilterName(String _sFilterName, XMultiServiceFactory _xMSF) - { - if (_sFilterName.length() == 0) - { - return null; - } - - if (_xMSF == null) - { - GlobalLogWriter.println("MultiServiceFactory not set."); - return null; - } - Object aObj = null; - try - { - aObj = _xMSF.createInstance("com.sun.star.document.FilterFactory"); - } - catch(com.sun.star.uno.Exception e) - { - GlobalLogWriter.println("Can't get com.sun.star.document.FilterFactory."); - return null; - } - if (aObj != null) - { - XNameAccess aNameAccess = UnoRuntime.queryInterface(XNameAccess.class, aObj); - if (aNameAccess != null) - { - - if (! aNameAccess.hasByName(_sFilterName)) - { - GlobalLogWriter.println("FilterFactory.hasByName() says there exist no '" + _sFilterName + "'" ); - return null; - } - - Object[] aElements = null; - try - { - aElements = (Object[]) aNameAccess.getByName(_sFilterName); - if (aElements != null) - { - String sInternalFilterName = null; - for (int i=0;i<aElements.length; i++) - { - PropertyValue aPropertyValue = (PropertyValue)aElements[i]; - if (aPropertyValue.Name.equals("Type")) - { - String sValue = (String)aPropertyValue.Value; - sInternalFilterName = sValue; - } - } - return sInternalFilterName; - } - else - { - GlobalLogWriter.println("There are no elements for FilterName '" + _sFilterName + "'"); - return null; - } - } - catch (com.sun.star.container.NoSuchElementException e) - { - GlobalLogWriter.println("NoSuchElementException caught. " + e.getMessage()); - } - catch (com.sun.star.lang.WrappedTargetException e) - { - GlobalLogWriter.println("WrappedTargetException caught. " + e.getMessage()); - } - } - } - return null; - } - - - - private String getServiceNameFromFilterName(String _sFilterName, XMultiServiceFactory _xMSF) - { - if (_sFilterName.length() == 0) - { - return null; - } - - if (_xMSF == null) - { - GlobalLogWriter.println("MultiServiceFactory not set."); - return null; - } - Object aObj = null; - try - { - aObj = _xMSF.createInstance("com.sun.star.document.FilterFactory"); - } - catch(com.sun.star.uno.Exception e) - { - GlobalLogWriter.println("Can't get com.sun.star.document.FilterFactory."); - return null; - } - if (aObj != null) - { - XNameAccess aNameAccess = UnoRuntime.queryInterface(XNameAccess.class, aObj); - if (aNameAccess != null) - { - if (! aNameAccess.hasByName(_sFilterName)) - { - GlobalLogWriter.println("FilterFactory.hasByName() says there exist no '" + _sFilterName + "'" ); - return null; - } - - Object[] aElements = null; - try - { - aElements = (Object[]) aNameAccess.getByName(_sFilterName); - if (aElements != null) - { - String sServiceName = null; - for (int i=0;i<aElements.length; i++) - { - PropertyValue aPropertyValue = (PropertyValue)aElements[i]; - if (aPropertyValue.Name.equals("DocumentService")) - { - String sValue = (String)aPropertyValue.Value; - sServiceName = sValue; - break; - } - } - return sServiceName; - } - else - { - GlobalLogWriter.println("There are no elements for FilterName '" + _sFilterName + "'"); - return null; - } - } - catch (com.sun.star.container.NoSuchElementException e) - { - GlobalLogWriter.println("NoSuchElementException caught. " + e.getMessage()); - } - catch (com.sun.star.lang.WrappedTargetException e) - { - GlobalLogWriter.println("WrappedTargetException caught. " + e.getMessage()); - } - } - } - return null; - } - - - private static String getFileExtension(String _sInternalFilterName, XMultiServiceFactory _xMSF) - { - if (_sInternalFilterName.length() == 0) - { - return null; - } - - if (_xMSF == null) - { - GlobalLogWriter.println("MultiServiceFactory not set."); - return null; - } - XTypeDetection aTypeDetection = null; - try - { - Object oObj = _xMSF.createInstance("com.sun.star.document.TypeDetection"); - aTypeDetection = UnoRuntime.queryInterface(XTypeDetection.class, oObj); - } - catch(com.sun.star.uno.Exception e) - { - GlobalLogWriter.println("Can't get com.sun.star.document.TypeDetection."); - return null; - } - if (aTypeDetection != null) - { - XNameAccess aNameAccess = UnoRuntime.queryInterface(XNameAccess.class, aTypeDetection); - if (aNameAccess != null) - { - - if (! aNameAccess.hasByName(_sInternalFilterName)) - { - GlobalLogWriter.println("TypeDetection.hasByName() says there exist no '" + _sInternalFilterName + "'" ); - return null; - } - - Object[] aElements = null; - String[] aExtensions; - try - { - aElements = (Object[]) aNameAccess.getByName(_sInternalFilterName); - if (aElements != null) - { - String sExtension = null; - for (int i=0;i<aElements.length; i++) - { - PropertyValue aPropertyValue = (PropertyValue)aElements[i]; - if (aPropertyValue.Name.equals("Extensions")) - { - aExtensions = (String[])aPropertyValue.Value; - GlobalLogWriter.println(" Possible extensions are: " + String.valueOf(aExtensions.length)); - if (aExtensions.length > 0) - { - for (int j=0;j<aExtensions.length;j++) - { - GlobalLogWriter.println(" " + aExtensions[j]); - } - sExtension = aExtensions[0]; - GlobalLogWriter.println(""); - } - } - } - return sExtension; - } - else - { - GlobalLogWriter.println("There are no elements for FilterName '" + _sInternalFilterName + "'"); - return null; - } - } - catch (com.sun.star.container.NoSuchElementException e) - { - GlobalLogWriter.println("NoSuchElementException caught. " + e.getMessage()); - } - catch (com.sun.star.lang.WrappedTargetException e) - { - GlobalLogWriter.println("WrappedTargetException caught. " + e.getMessage()); - } -} - } - return null; - } - - - - private OfficeProvider m_aProvider = null; private void startOffice() { diff --git a/qadevOOo/runner/helper/ConfigHelper.java b/qadevOOo/runner/helper/ConfigHelper.java index f6029bc0e8a0..da873a59b97c 100644 --- a/qadevOOo/runner/helper/ConfigHelper.java +++ b/qadevOOo/runner/helper/ConfigHelper.java @@ -125,43 +125,6 @@ public class ConfigHelper } - private Object readRelativeKey(String sRelPath, - String sKey ) - throws com.sun.star.container.NoSuchElementException - { - try - { - XPropertySet xPath = UnoRuntime.queryInterface( - XPropertySet.class, - m_xConfig.getByHierarchicalName(sRelPath)); - return xPath.getPropertyValue(sKey); - } - catch(com.sun.star.uno.Exception ex) - { - throw new com.sun.star.container.NoSuchElementException(ex.getMessage()); - } - } - - - private void writeRelativeKey(String sRelPath, - String sKey , - Object aValue ) - throws com.sun.star.container.NoSuchElementException - { - try - { - XPropertySet xPath = UnoRuntime.queryInterface( - XPropertySet.class, - m_xConfig.getByHierarchicalName(sRelPath)); - xPath.setPropertyValue(sKey, aValue); - } - catch(com.sun.star.uno.Exception ex) - { - throw new com.sun.star.container.NoSuchElementException(ex.getMessage()); - } - } - - /** * Updates the configuration.<p> * This must be called after you have changed the configuration diff --git a/qadevOOo/runner/helper/ProcessHandler.java b/qadevOOo/runner/helper/ProcessHandler.java index 012a38fd0a47..85accac84cd8 100644 --- a/qadevOOo/runner/helper/ProcessHandler.java +++ b/qadevOOo/runner/helper/ProcessHandler.java @@ -765,20 +765,6 @@ public class ProcessHandler return exitValue; } - /** Causes the thread to sleep some time. - */ - private static void shortWait(long milliseconds) - { - try - { - Thread.sleep(milliseconds); - } - catch (InterruptedException e) - { - System.out.println("While waiting :" + e); - } - } - private void dbg(String message) { if (debug) @@ -813,18 +799,6 @@ public class ProcessHandler { return m_bInterrupt; } - /** - * Marks the thread to hold on, next time - * STUPID: The thread must poll this flag itself. - * - * Reason: interrupt() seems not to work as expected. - */ - private synchronized void holdOn() - { - m_bInterrupt = true; - interrupt(); - } - @Override public void run() { diff --git a/qadevOOo/runner/helper/StringHelper.java b/qadevOOo/runner/helper/StringHelper.java index 6308a0a2eacb..7c4943c05ee9 100644 --- a/qadevOOo/runner/helper/StringHelper.java +++ b/qadevOOo/runner/helper/StringHelper.java @@ -21,16 +21,6 @@ package helper; public class StringHelper { - private static String doubleQuote(String _sStr) - { - return "\"" + _sStr + "\""; - } - - private static String singleQuote(String _sStr) - { - return "'" + _sStr + "'"; - } - /** * removes quotes if both exists at start and at end */ diff --git a/qadevOOo/runner/helper/URLHelper.java b/qadevOOo/runner/helper/URLHelper.java index 9b5fc651f97f..60bebf87ee0e 100644 --- a/qadevOOo/runner/helper/URLHelper.java +++ b/qadevOOo/runner/helper/URLHelper.java @@ -98,58 +98,6 @@ public class URLHelper /** - * Does the same as getFileURLFromSystemPath() before ... but uses - * the given protocol string (e.g."http://") instead of "file:///". - * - * @param aSystemPath - * represent the file in system notation - * - * @param aBasePath - * define the base path of the aSystemPath value, - * which must be replaced with the value of "sServerPath". - * - * @param sServerURL - * Will be used to replace sBasePath. - * - * @example - * System Path = "d:\test\file.txt" - * Base Path = "d:\test" - * Server Path = "http://alaska:8000" - * => "http://alaska:8000/file.txt" - * - * @return [String] - * an url which represent the given system path - * and uses the given protocol - */ - private static String getURLWithProtocolFromSystemPath( File aSystemPath, File aBasePath, String sServerURL ) - { - String sFileURL = URLHelper.getFileURLFromSystemPath(aSystemPath); - String sBaseURL = URLHelper.getFileURLFromSystemPath(aBasePath ); - - // cut last '/'! - if (sBaseURL.lastIndexOf('/')==(sBaseURL.length()-1)) - sBaseURL = sBaseURL.substring(0,sBaseURL.length()-1); - - // cut last '/'! - if (sServerURL.lastIndexOf('/')==(sServerURL.length()-1)) - sServerURL = sServerURL.substring(0,sServerURL.length()-1); - - int index = sFileURL.indexOf(sBaseURL); - String sURL = sFileURL.substring(0,index) + sServerURL + - sFileURL.substring(index+sBaseURL.length()); - return sURL; - } - - - - - - - - - - - /** * Return a name list of all available files of a directory. * We filter pure sub directories names. All other files * are returned as full qualified URL strings. So they can be diff --git a/qadevOOo/runner/lib/Parameters.java b/qadevOOo/runner/lib/Parameters.java index 5b64378257ce..e66ea5027643 100644 --- a/qadevOOo/runner/lib/Parameters.java +++ b/qadevOOo/runner/lib/Parameters.java @@ -145,9 +145,6 @@ public class Parameters implements XPropertySet { private Map<String,Object> toMap() { return new HashMap<String,Object>(parameters) { - public String get(String obj) { - return Parameters.this.get(obj); - } }; } diff --git a/qadevOOo/runner/org/openoffice/Runner.java b/qadevOOo/runner/org/openoffice/Runner.java index c1c78503194b..33071aa4e7b4 100644 --- a/qadevOOo/runner/org/openoffice/Runner.java +++ b/qadevOOo/runner/org/openoffice/Runner.java @@ -37,20 +37,6 @@ import base.TestBase; public class Runner { - /** - * @return the time, which is done until last startTime() - */ - private static long meanTime(long _nCurrentTimer) - { - if (_nCurrentTimer == 0) - { - System.out.println("Forgotten to initialise a start timer?"); - return 0; - } - long nMeanTime = System.currentTimeMillis(); - return nMeanTime - _nCurrentTimer; - } - private static String beautifyTime(long _nTime) { long sec = (_nTime / 1000) % 60; diff --git a/qadevOOo/runner/util/DBTools.java b/qadevOOo/runner/util/DBTools.java index 4d41dbc0fe08..f6cd9a865e46 100644 --- a/qadevOOo/runner/util/DBTools.java +++ b/qadevOOo/runner/util/DBTools.java @@ -19,29 +19,18 @@ package util; import com.sun.star.uno.Exception; -import java.io.PrintWriter ; - import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.UnoRuntime; import com.sun.star.beans.PropertyValue; import com.sun.star.beans.XPropertySet; import com.sun.star.sdbc.XConnection ; -import com.sun.star.sdbc.XResultSet ; -import com.sun.star.sdbc.XResultSetUpdate ; -import com.sun.star.sdbc.XStatement ; -import com.sun.star.sdbc.XRowUpdate ; import com.sun.star.util.Date ; import com.sun.star.uno.XNamingService ; import com.sun.star.task.XInteractionHandler ; import com.sun.star.sdb.XCompletedConnection ; -import com.sun.star.io.XInputStream ; -import com.sun.star.io.XTextInputStream ; -import com.sun.star.io.XDataInputStream ; -import com.sun.star.container.XNameAccess ; import com.sun.star.frame.XStorable; import com.sun.star.sdb.XDocumentDataSource; -import com.sun.star.sdbc.XCloseable ; import java.sql.Statement; import java.sql.Connection; import java.sql.DriverManager; @@ -184,50 +173,6 @@ public class DBTools { } /** - * Prints datasource info. - * @param out Stream to which information is printed. - */ - private void printInfo(PrintWriter out) { - out.println("Name = '" + Name + "'") ; - out.println(" URL = '" + URL + "'") ; - out.print(" Info = ") ; - if (Info == null) out.println("null") ; - else { - out.print("{") ; - for (int i = 0; i < Info.length; i++) { - out.print(Info[i].Name + " = '" + Info[i].Value + "'") ; - if (i + 1 < Info.length) out.print("; ") ; - } - out.println("}") ; - } - out.println(" User = '" + User + "'") ; - out.println(" Password = '" + Password + "'") ; - out.println(" IsPasswordRequired = '" + IsPasswordRequired + "'") ; - out.println(" SuppressVersionColumns = '" + SuppressVersionColumns + "'") ; - out.println(" IsReadOnly = '" + IsReadOnly + "'") ; - out.print(" TableFilter = ") ; - if (TableFilter == null) out.println("null") ; - else { - out.print("{") ; - for (int i = 0; i < TableFilter.length; i++) { - out.print("'" + TableFilter[i] + "'") ; - if (i+1 < TableFilter.length) out.print("; "); - } - out.println("}") ; - } - out.print(" TableTypeFilter = ") ; - if (TableTypeFilter == null) out.println("null") ; - else { - out.print("{") ; - for (int i = 0; i < TableTypeFilter.length; i++) { - out.print("'" + TableTypeFilter[i] + "'") ; - if (i+1 < TableTypeFilter.length) out.print("; "); - } - out.println("}") ; - } - } - - /** * Creates new <code>com.sun.star.sdb.DataSource</code> service * instance and copies all fields (which are not null) to * appropriate service properties. @@ -338,166 +283,6 @@ public class DBTools { } /** - * Registers Test data source in the <code>DatabaseContext</code> service. - * 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. - * @param docPath Path to database <code>TestDB</code> directory. - * @return <code>com.sun.star.sdb.DataSource</code> service - * implementation which represents TestDB. - */ - private Object registerTestDB(String docPath) - throws com.sun.star.uno.Exception { - - String testURL = null ; - if (docPath.endsWith("/") || docPath.endsWith("\\")) - testURL = dirToUrl(docPath + "TestDB") ; - else - testURL = dirToUrl(docPath + "/" + "TestDB") ; - testURL = "sdbc:dbase:" + testURL ; - - String existURL = null ; - - XNameAccess na = UnoRuntime.queryInterface - (XNameAccess.class, dbContext) ; - - Object src = null ; - if (na.hasByName("APITestDatabase")) { - src = dbContext.getRegisteredObject("APITestDatabase") ; - - XPropertySet srcPs = UnoRuntime.queryInterface - (XPropertySet.class, src) ; - - existURL = (String) srcPs.getPropertyValue("URL") ; - } - - if (src == null || !testURL.equals(existURL)) { - // test data source must be reregistered. - DataSourceInfo info = new DataSourceInfo() ; - info.URL = testURL ; - src = info.getDataSourceService() ; - reRegisterDB("APITestDatabase", src) ; - src = dbContext.getRegisteredObject("APITestDatabase") ; - } - - return src ; - } - - - - /** - * Empties the table in the specified source. - * @param con Connection to the DataSource where appropriate - * table exists. - * @param table The name of the table where all rows will be deleted. - * @return Number of rows deleted. - */ - - // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - // Currently doesn't work because of bugs 85509, 85510 - - private int deleteAllRows(XConnection con, String table) - throws com.sun.star.sdbc.SQLException { - - XStatement stat = con.createStatement() ; - - XResultSet set = stat.executeQuery("SELECT * FROM " + table) ; - - XResultSetUpdate updt = UnoRuntime.queryInterface - (XResultSetUpdate.class, set) ; - - int count = 0 ; - set.last() ; - int rowNum = set.getRow() ; - set.first() ; - - for (int i = 0; i < rowNum; i++) { - updt.deleteRow() ; - set.next() ; - count ++ ; - } - - XCloseable xClose = UnoRuntime.queryInterface - (XCloseable.class, set) ; - xClose.close() ; - - return count ; - } - - /** - * Inserts row into test table of the specified connection. - * 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. - * @param values Values to be inserted into test table. Values of - * this array inserted into appropriate fields depending on their - * types. So <code>String</code> value of the array is inserted - * into the field of <code>CHARACTER</code> type, etc. - * @param streamLength Is optional. It is used only if in values - * list <code>XCharacterInputStream</code> or <code>XBinaryInputStream - * </code> types specified. In this case the parameter specifies - * the length of the stream for inserting. - */ - private void addRowToTestTable(XConnection con, String table, Object[] values, - int streamLength) - throws com.sun.star.sdbc.SQLException { - - XStatement stat = con.createStatement() ; - - XResultSet set = stat.executeQuery("SELECT * FROM " + table) ; - - XResultSetUpdate updt = UnoRuntime.queryInterface - (XResultSetUpdate.class, set) ; - - XRowUpdate rowUpdt = UnoRuntime.queryInterface - (XRowUpdate.class, set) ; - - updt.moveToInsertRow() ; - - for (int i = 0; i < values.length; i++) { - if (values[i] instanceof String) { - rowUpdt.updateString(TST_STRING, (String) values[i]) ; - } else - if (values[i] instanceof Integer) { - rowUpdt.updateInt(TST_INT, ((Integer) values[i]).intValue()) ; - } else - if (values[i] instanceof Double) { - rowUpdt.updateDouble(TST_DOUBLE, ((Double) values[i]).doubleValue()) ; - } else - if (values[i] instanceof Date) { - rowUpdt.updateDate(TST_DATE, (Date) values[i]) ; - } else - if (values[i] instanceof Boolean) { - rowUpdt.updateBoolean(TST_BOOLEAN, ((Boolean) values[i]).booleanValue()) ; - } else - if (values[i] instanceof XTextInputStream) { - rowUpdt.updateCharacterStream(TST_CHARACTER_STREAM, (XInputStream) values[i], - streamLength) ; - } else - if (values[i] instanceof XDataInputStream) { - rowUpdt.updateBinaryStream(TST_BINARY_STREAM, (XInputStream) values[i], - streamLength) ; - } - } - - updt.insertRow() ; - - XCloseable xClose = UnoRuntime.queryInterface - (XCloseable.class, set) ; - xClose.close() ; - } - - - - - - /** * Convert system pathname to SOffice URL string * (for example 'C:\Temp\DBDir\' -> 'file:///C|/Temp/DBDir/'). * (for example '\\server\Temp\DBDir\' -> 'file://server/Temp/DBDir/'). diff --git a/qadevOOo/runner/util/DrawTools.java b/qadevOOo/runner/util/DrawTools.java index 4facd805fd34..43c9e51a2411 100644 --- a/qadevOOo/runner/util/DrawTools.java +++ b/qadevOOo/runner/util/DrawTools.java @@ -28,13 +28,7 @@ import com.sun.star.drawing.XDrawPages; import com.sun.star.drawing.XDrawPagesSupplier; import com.sun.star.drawing.XDrawPage; import com.sun.star.drawing.XShapes; -import com.sun.star.drawing.XShape; - - import util.DesktopTools; -import util.InstCreator; -import util.ShapeDsc; - import com.sun.star.uno.AnyConverter; import com.sun.star.uno.Type; @@ -107,27 +101,4 @@ public class DrawTools { return UnoRuntime.queryInterface(XShapes.class,oDP); } - /** - * creates a XShape - * - * @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') - * @return the created XShape - */ - - private XShape createShape( XComponent oDoc, int height, int width, int x, - int y, String kind ) { - //possible values for kind are 'Ellipse', 'Line' and 'Rectangle' - - ShapeDsc sDsc = new ShapeDsc( height, width, x, y, kind ); - InstCreator instCreate = new InstCreator( oDoc, sDsc ); - XShape oShape = (XShape)instCreate.getInstance(); - - return oShape; - } - } diff --git a/qadevOOo/runner/util/SOfficeFactory.java b/qadevOOo/runner/util/SOfficeFactory.java index 298b8a18952f..f086a0d27fb2 100644 --- a/qadevOOo/runner/util/SOfficeFactory.java +++ b/qadevOOo/runner/util/SOfficeFactory.java @@ -440,22 +440,5 @@ public class SOfficeFactory { } // finished openDoc - private XComponent openDoc(String kind, String frameName, PropertyValue[] mediaDescriptor) - throws com.sun.star.lang.IllegalArgumentException, - com.sun.star.io.IOException, - com.sun.star.uno.Exception { - - if (frameName == null) { - frameName = "_blank"; - } - // load a blank a doc - XComponent oDoc = oCLoader.loadComponentFromURL( - "private:factory/" + kind, frameName, 40, mediaDescriptor); - DesktopTools.bringWindowToFront(oDoc); - - return oDoc; - - } // finished openDoc - } diff --git a/qadevOOo/runner/util/UITools.java b/qadevOOo/runner/util/UITools.java index e1b8ad592aa5..d57167cc75bc 100644 --- a/qadevOOo/runner/util/UITools.java +++ b/qadevOOo/runner/util/UITools.java @@ -83,12 +83,6 @@ public class UITools { oText.setText(cText); } - private static Object getValue(XInterface xInt) - { - XAccessibleValue oValue = UnoRuntime.queryInterface(XAccessibleValue.class, xInt); - return oValue.getCurrentValue(); - } - private static XAccessible makeRoot(XWindow xWindow) { return AccessibilityTools.getAccessibleObject(xWindow); @@ -157,55 +151,6 @@ public class UITools { /** - * Helper method: gets button via accessibility and 'click' it - * @param buttonName The name of the button in the accessibility tree - * @param toBePressed desired state of the toggle button - * - * @return true if the state of the button could be changed in the desired manner - */ - private boolean clickToggleButton(String buttonName, boolean toBePressed) - { - XAccessibleContext oButton =AccessibilityTools.getAccessibleObjectForRole - (mXRoot, AccessibleRole.TOGGLE_BUTTON, buttonName); - - if (oButton != null){ - boolean isChecked = oButton.getAccessibleStateSet().contains(com.sun.star.accessibility.AccessibleStateType.CHECKED); - if((isChecked && !toBePressed) || (!isChecked && toBePressed)){ - XAccessibleAction oAction = UnoRuntime.queryInterface(XAccessibleAction.class, oButton); - try{ - // "click" the button - oAction.doAccessibleAction(0); - return true; - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - System.out.println("Could not do accessible action with '" - + buttonName + "'" + e.toString()); - return false; - } - }else - //no need to press togglebar, do nothing - return true; - } else{ - System.out.println("Could not get button '" + buttonName + "'"); - return false; - } - } - - - - - - - - - - - - - - - - - /** * Helper method: returns the entry manes of a List-Box * @param ListBoxName the name of the listbox * @return the listbox entry names @@ -266,71 +211,6 @@ public class UITools { /** - * returns the value of a numeric field - * @param NumericFieldName the name of the numreic field - * @throws java.lang.Exception if something fail - * @return the value of the named numeric filed - */ - private String getNumericFieldValue(String NumericFieldName) - throws java.lang.Exception - { - try{ - XInterface xNumericField =AccessibilityTools.getAccessibleObjectForRole( - mXRoot, AccessibleRole.TEXT, NumericFieldName); - return getString(xNumericField); - - } catch (Exception e) { - throw new Exception("Could get value from NumericField '" - + NumericFieldName + "' : " + e.toString()); - } - } - - private String removeCharactersFromCurrencyString(String stringVal) - throws java.lang.Exception - { - try{ - int beginIndex = 0; - int endIndex = 0; - // find the first numeric character in stringVal - for(int i = 0; i < stringVal.length(); i++){ - int numVal = Character.getNumericValue(stringVal.charAt(i)); - // if ascii is a numeric value - if (numVal != -1){ - beginIndex = i; - break; - } - } - // find the last numeric character in stringVal - for(int i = stringVal.length()-1; i > 0; i--){ - int numVal = Character.getNumericValue(stringVal.charAt(i)); - if (numVal != -1){ - endIndex = i+1; - break; - } - } - String currencyVal = stringVal.substring(beginIndex, endIndex); - - currencyVal = currencyVal.substring(0, currencyVal.length()-3) + - "#" + currencyVal.substring(currencyVal.length()-2); - - currencyVal = currencyVal.replace(",", ""); - currencyVal = currencyVal.replace("\\.", ""); - currencyVal = currencyVal.replace("#", "."); - - return currencyVal; - } catch (Exception e) { - throw new Exception("Could get remove characters from currency string '" - + stringVal + "' : " + e.toString()); - } - - } - - - - - - - /** * set a value to a named check box * @param CheckBoxName the name of the check box * @param Value the value to set diff --git a/qadevOOo/runner/util/XMLTools.java b/qadevOOo/runner/util/XMLTools.java index 508fdfd76ebe..a59f523758ca 100644 --- a/qadevOOo/runner/util/XMLTools.java +++ b/qadevOOo/runner/util/XMLTools.java @@ -25,18 +25,9 @@ import java.util.HashSet; import java.util.Iterator; import com.sun.star.beans.PropertyValue; -import com.sun.star.io.XActiveDataSource; -import com.sun.star.io.XInputStream; -import com.sun.star.io.XOutputStream; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.ucb.XSimpleFileAccess; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XInterface; -import com.sun.star.xml.sax.InputSource; import com.sun.star.xml.sax.XAttributeList; import com.sun.star.xml.sax.XDocumentHandler; import com.sun.star.xml.sax.XLocator; -import com.sun.star.xml.sax.XParser; public class XMLTools { @@ -749,64 +740,6 @@ public class XMLTools { return props ; } - /** - * Gets the hanlder, which writes all the XML data passed to the - * file specified. - * @param xMSF Soffice <code>ServiceManager</code> factory. - * @param fileURL The file URL (in form file:///<path>) to which - * XML data is written. - * @return SAX handler to which XML data has to be written. - */ - private static XDocumentHandler getFileXMLWriter(XMultiServiceFactory xMSF, String fileURL) - throws com.sun.star.uno.Exception - { - XInterface oFacc = (XInterface)xMSF.createInstance( - "com.sun.star.comp.ucb.SimpleFileAccess"); - XSimpleFileAccess xFacc = UnoRuntime.queryInterface - (XSimpleFileAccess.class, oFacc) ; - - XInterface oWriter = (XInterface)xMSF.createInstance( - "com.sun.star.xml.sax.Writer"); - XActiveDataSource xWriterDS = UnoRuntime.queryInterface(XActiveDataSource.class, oWriter); - XDocumentHandler xDocHandWriter = UnoRuntime.queryInterface - (XDocumentHandler.class, oWriter) ; - - if (xFacc.exists(fileURL)) - xFacc.kill(fileURL); - XOutputStream fOut = xFacc.openFileWrite(fileURL) ; - xWriterDS.setOutputStream(fOut); - - return xDocHandWriter ; - } - - /** - * Parses XML file and passes its data to the SAX handler specified. - * @param xMSF Soffice <code>ServiceManager</code> factory. - * @param fileURL XML file name (in form file:///<path>) to be parsed. - * @param handler SAX handler to which XML data from file will - * be transferred. - */ - private static void parseXMLFile(XMultiServiceFactory xMSF, - String fileURL, XDocumentHandler handler) throws com.sun.star.uno.Exception - { - XInterface oFacc = (XInterface)xMSF.createInstance( - "com.sun.star.comp.ucb.SimpleFileAccess"); - XSimpleFileAccess xFacc = UnoRuntime.queryInterface - (XSimpleFileAccess.class, oFacc) ; - XInputStream oIn = xFacc.openFileRead(fileURL) ; - - XInterface oParser = (XInterface)xMSF.createInstance( - "com.sun.star.xml.sax.Parser"); - XParser xParser = UnoRuntime.queryInterface(XParser.class, oParser); - - xParser.setDocumentHandler(handler) ; - InputSource inSrc = new InputSource() ; - inSrc.aInputStream = oIn ; - xParser.parseStream(inSrc) ; - - oIn.closeInput(); - } - diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeStyles.java b/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeStyles.java index 167188daaab6..3844a0ba2951 100644 --- a/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeStyles.java +++ b/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeStyles.java @@ -59,16 +59,6 @@ public class OfficeStyles extends Element this.name = name; } - public String getFamily() - { - return family; - } - - public String getName() - { - return name; - } - @Override public boolean equals(final Object obj) { diff --git a/scripting/java/com/sun/star/script/framework/browse/DialogFactory.java b/scripting/java/com/sun/star/script/framework/browse/DialogFactory.java index 4b80e9a685f1..6e46e193f8cf 100644 --- a/scripting/java/com/sun/star/script/framework/browse/DialogFactory.java +++ b/scripting/java/com/sun/star/script/framework/browse/DialogFactory.java @@ -126,101 +126,6 @@ public class DialogFactory return (String)resultHolder.getResult(); } - private XDialog createConfirmDialog(String title, String prompt) - throws com.sun.star.uno.Exception - { - if (title == null || title.equals("")) - { - title = "Scripting Framework"; - } - - if (prompt == null || prompt.equals("")) - { - prompt = "Enter name"; - } - - // get the service manager from the component context - XMultiComponentFactory xMultiComponentFactory = - xComponentContext.getServiceManager(); - - // create the dialog model and set the properties - Object dialogModel = xMultiComponentFactory.createInstanceWithContext( - "com.sun.star.awt.UnoControlDialogModel", xComponentContext); - - XPropertySet props = UnoRuntime.queryInterface( - XPropertySet.class, dialogModel); - - props.setPropertyValue("Title", title); - setDimensions(dialogModel, 100, 100, 157, 37); - - // get the service manager from the dialog model - XMultiServiceFactory xMultiServiceFactory = - UnoRuntime.queryInterface( - XMultiServiceFactory.class, dialogModel); - - // create the label model and set the properties - Object label = xMultiServiceFactory.createInstance( - "com.sun.star.awt.UnoControlFixedTextModel"); - - setDimensions(label, 15, 5, 134, 12); - - XPropertySet labelProps = UnoRuntime.queryInterface( - XPropertySet.class, label); - labelProps.setPropertyValue("Name", "PromptLabel"); - labelProps.setPropertyValue("Label", prompt); - - // create the Run Macro button model and set the properties - Object okButtonModel = xMultiServiceFactory.createInstance( - "com.sun.star.awt.UnoControlButtonModel"); - - setDimensions(okButtonModel, 40, 18, 38, 15); - - XPropertySet buttonProps = UnoRuntime.queryInterface( - XPropertySet.class, okButtonModel); - buttonProps.setPropertyValue("Name", "Ok"); - buttonProps.setPropertyValue("Label", "Ok"); - - // create the Dont Run Macro button model and set the properties - Object cancelButtonModel = xMultiServiceFactory.createInstance( - "com.sun.star.awt.UnoControlButtonModel"); - - setDimensions(cancelButtonModel, 83, 18, 38, 15); - - buttonProps = UnoRuntime.queryInterface( - XPropertySet.class, cancelButtonModel); - buttonProps.setPropertyValue("Name", "Cancel"); - buttonProps.setPropertyValue("Label", "Cancel"); - - // insert the control models into the dialog model - XNameContainer xNameCont = UnoRuntime.queryInterface( - XNameContainer.class, dialogModel); - - xNameCont.insertByName("PromptLabel", label); - xNameCont.insertByName("Ok", okButtonModel); - xNameCont.insertByName("Cancel", cancelButtonModel); - - // create the dialog control and set the model - Object dialog = xMultiComponentFactory.createInstanceWithContext( - "com.sun.star.awt.UnoControlDialog", xComponentContext); - XControl xControl = UnoRuntime.queryInterface( - XControl.class, dialog); - - 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 = UnoRuntime.queryInterface( - XToolkit.class, toolkit); - XWindow xWindow = UnoRuntime.queryInterface( - XWindow.class, xControl); - xWindow.setVisible(false); - xControl.createPeer(xToolkit, null); - - 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 { diff --git a/scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java b/scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java index 0fd2c85d9969..8f39afdc9568 100644 --- a/scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java +++ b/scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java @@ -20,7 +20,6 @@ package com.sun.star.script.framework.container; import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; -import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -60,28 +59,6 @@ public class ParcelDescriptor { - // returns the ParcelDescriptor in the corresponding directory - // returns null if no ParcelDescriptor is found in the directory - private static synchronized ParcelDescriptor - getParcelDescriptor(File parent) { - - File path = new File(parent, PARCEL_DESCRIPTOR_NAME); - ParcelDescriptor pd = PARCEL_DESCRIPTOR_MAP.get(path); - - if (pd == null && path.exists()) { - try { - pd = new ParcelDescriptor(path); - } - catch (IOException ioe) { - return null; - } - PARCEL_DESCRIPTOR_MAP.put(path, pd); - } - return pd; - } - - - public ParcelDescriptor() throws IOException { ByteArrayInputStream bis = null; try { @@ -136,14 +113,6 @@ public class ParcelDescriptor { initLanguageProperties(); } - private void write(File file) throws IOException { - FileOutputStream fos = new FileOutputStream(file); - XMLParserFactory.getParser().write(document, fos); - fos.close(); - } - - - public void write(OutputStream out) throws IOException { XMLParserFactory.getParser().write(document, out); } diff --git a/scripting/java/org/openoffice/idesupport/zip/ParcelZipper.java b/scripting/java/org/openoffice/idesupport/zip/ParcelZipper.java index 30cf598a706a..45cdb185f313 100644 --- a/scripting/java/org/openoffice/idesupport/zip/ParcelZipper.java +++ b/scripting/java/org/openoffice/idesupport/zip/ParcelZipper.java @@ -19,11 +19,9 @@ package org.openoffice.idesupport.zip; import java.io.*; -import java.util.Enumeration; import java.util.zip.*; import org.openoffice.idesupport.filter.FileFilter; import org.openoffice.idesupport.filter.BinaryOnlyFilter; -import com.sun.star.script.framework.container.ParcelDescriptor; import org.openoffice.idesupport.xml.Manifest; public class ParcelZipper @@ -57,315 +55,6 @@ public class ParcelZipper - private String zipParcel(File basedir, File targetfile, FileFilter filter) - throws IOException { - String realpath, tmppath; - - realpath = targetfile.getPath(); - tmppath = realpath + ".tmp"; - - File tmpfile = new File(tmppath); - ZipOutputStream out = null; - try { - if (tmpfile.exists() == true) - tmpfile.delete(); - - out = new ZipOutputStream(new FileOutputStream(tmpfile)); - - File[] children = basedir.listFiles(); - for (int i = 0; i < children.length; i++) - addFileToParcel(children[i], "", out, filter); - } - catch (IOException ioe) { - out.close(); - tmpfile.delete(); - throw ioe; - } - finally { - if (out != null) - out.close(); - } - - if (targetfile.exists() == true) - targetfile.delete(); - tmpfile.renameTo(targetfile); - - return targetfile.getAbsolutePath(); - } - - private void addFileToParcel(File root, String path, ZipOutputStream out, FileFilter filter) - throws IOException { - ZipEntry ze; - - if (root.isDirectory() == true) { - ze = new ZipEntry(/* PARCEL_PREFIX_DIR + */ path + root.getName() + "/"); - out.putNextEntry(ze); - out.closeEntry(); - File[] children = root.listFiles(); - - for (int i = 0; i < children.length; i++) - addFileToParcel(children[i], path + root.getName() + "/", out, filter); - } - else { - if (filter.validate(root.getName()) == false && - root.getName().equals("parcel-descriptor.xml") == false) - return; - - ze = new ZipEntry(/* PARCEL_PREFIX_DIR + */ path + root.getName()); - out.putNextEntry(ze); - - byte[] bytes = new byte[1024]; - int len; - - FileInputStream fis = null; - try { - fis = new FileInputStream(root); - - while ((len = fis.read(bytes)) != -1) - out.write(bytes, 0, len); - } - finally { - if (fis != null) fis.close(); - } - out.closeEntry(); - } - } - - - - private boolean isDirectoryOverwriteNeeded(File parcel, File target) { - String parcelDir = getParcelDirFromParcelZip(parcel.getName()); - - File langdir; - try { - langdir = new File(target, getParcelLanguage(parcel)); - } - catch (IOException ioe) { - return false; - } - - if (langdir.exists() == false) - return false; - - File[] children = langdir.listFiles(); - - for (int i = 0; i < children.length; i++) - if (children[i].getName().equals(parcelDir)) - return true; - - return false; - } - - private boolean isDocumentOverwriteNeeded(File parcel, File document) - throws IOException - { - ZipFile documentZip = null; - boolean result = false; - - try { - documentZip = new ZipFile(document); - - String name = - PARCEL_PREFIX_DIR + getParcelLanguage(parcel) + - "/" + getParcelDirFromParcelZip(parcel.getName()) + - "/" + PARCEL_DESCRIPTOR_XML; - - if (documentZip.getEntry(name) != null) - result = true; - } - catch (IOException ioe) { - return false; - } - finally { - if (documentZip != null) documentZip.close(); - } - - return result; - } - - - - private String getParcelDirFromParcelZip(String zipname) { - String result = zipname.substring(0, zipname.lastIndexOf(".")); - return result; - } - - private String unzipToDirectory(File parcel, File targetDirectory) - throws IOException { - - ZipInputStream in = null; - File parcelDir = new File(targetDirectory, - getParcelLanguage(parcel) + File.separator + - getParcelDirFromParcelZip(parcel.getName())); - - if (isDirectoryOverwriteNeeded(parcel, targetDirectory)) { - if (deleteDir(parcelDir) == false) { - throw new IOException("Could not overwrite: " + - parcelDir.getAbsolutePath()); - } - } - - try { - in = new ZipInputStream(new FileInputStream(parcel)); - - File outFile; - ZipEntry inEntry = in.getNextEntry(); - byte[] bytes = new byte[1024]; - int len; - - while (inEntry != null) { - outFile = new File(parcelDir, inEntry.getName()); - if (inEntry.isDirectory()) { - outFile.mkdir(); - } - else { - if (outFile.getParentFile().exists() != true) - outFile.getParentFile().mkdirs(); - - FileOutputStream out = null; - try { - out = new FileOutputStream(outFile); - - while ((len = in.read(bytes)) != -1) - out.write(bytes, 0, len); - } - finally { - if (out != null) out.close(); - } - } - inEntry = in.getNextEntry(); - } - } - finally { - if (in != null) in.close(); - } - - return parcelDir.getAbsolutePath(); - } - - private boolean deleteDir(File basedir) { - if (basedir.isDirectory()) { - String[] children = basedir.list(); - for (int i=0; i<children.length; i++) { - boolean success = deleteDir(new File(basedir, children[i])); - if (!success) { - return false; - } - } - } - return basedir.delete(); - } - - private String unzipToZip(File parcel, File targetDocument) - throws IOException { - - ZipInputStream documentStream = null; - ZipInputStream parcelStream = null; - ZipOutputStream outStream = null; - Manifest manifest; - - String language = getParcelLanguage(parcel); - - if (isDocumentOverwriteNeeded(parcel, targetDocument)) { - String parcelName = language + "/" + - getParcelDirFromParcelZip(parcel.getName()); - removeParcel(targetDocument, parcelName); - } - - // first write contents of document to tmpfile - File tmpfile = new File(targetDocument.getAbsolutePath() + ".tmp"); - - manifest = addParcelToManifest(targetDocument, parcel); - - try { - documentStream = - new ZipInputStream(new FileInputStream(targetDocument)); - parcelStream = new ZipInputStream(new FileInputStream(parcel)); - outStream = new ZipOutputStream(new FileOutputStream(tmpfile)); - - copyParcelToZip(parcelStream, outStream, PARCEL_PREFIX_DIR + - language + "/" + getParcelDirFromParcelZip(parcel.getName())); - copyDocumentToZip(documentStream, outStream, manifest); - } - catch (IOException ioe) { - tmpfile.delete(); - throw ioe; - } - finally { - if (documentStream != null) documentStream.close(); - if (parcelStream != null) parcelStream.close(); - if (outStream != null) outStream.close(); - } - - if (targetDocument.delete() == false) { - tmpfile.delete(); - throw new IOException("Could not overwrite " + targetDocument); - } - else - tmpfile.renameTo(targetDocument); - - return targetDocument.getAbsolutePath(); - } - - private void copyParcelToZip(ZipInputStream in, ZipOutputStream out, - String parcelName) throws IOException { - - ZipEntry outEntry; - ZipEntry inEntry = in.getNextEntry(); - byte[] bytes = new byte[1024]; - int len; - - while (inEntry != null) { - if(parcelName!=null) - outEntry = new ZipEntry(parcelName + "/" + inEntry.getName()); - else - outEntry = new ZipEntry(inEntry); - out.putNextEntry(outEntry); - - if (inEntry.isDirectory() == false) - while ((len = in.read(bytes)) != -1) - out.write(bytes, 0, len); - - out.closeEntry(); - inEntry = in.getNextEntry(); - } - } - - private void copyDocumentToZip(ZipInputStream in, ZipOutputStream out, - Manifest manifest) throws IOException { - - ZipEntry outEntry; - ZipEntry inEntry; - byte[] bytes = new byte[1024]; - int len; - - while ((inEntry = in.getNextEntry()) != null) { - - outEntry = new ZipEntry(inEntry); - out.putNextEntry(outEntry); - - if(inEntry.getName().equals("META-INF/manifest.xml") && - manifest != null) { - InputStream manifestStream = null; - try { - manifestStream = manifest.getInputStream(); - while ((len = manifestStream.read(bytes)) != -1) - out.write(bytes, 0, len); - } - finally { - if (manifestStream != null) - manifestStream.close(); - } - } - else if (inEntry.isDirectory() == false) { - while ((len = in.read(bytes)) != -1) - out.write(bytes, 0, len); - } - - out.closeEntry(); - } - } - public String removeParcel(File document, String parcelName) throws IOException { @@ -464,44 +153,6 @@ public class ParcelZipper return result; } - private Manifest addParcelToManifest(File document, File parcel) - throws IOException { - - ZipFile parcelZip = null; - Manifest result = null; - - result = getManifestFromDocument(document); - if (result == null) - return null; - - String language = getParcelLanguage(parcel); - - try { - parcelZip = new ZipFile(parcel); - - String prefix = PARCEL_PREFIX_DIR + language + "/" + - getParcelDirFromParcelZip(parcel.getName()) + "/"; - - Enumeration entries = parcelZip.entries(); - while (entries.hasMoreElements()) { - ZipEntry entry = (ZipEntry)entries.nextElement(); - result.add(prefix + entry.getName()); - } - } - catch (IOException ioe) { - return null; - } - finally { - try { - if (parcelZip != null) - parcelZip.close(); - } - catch (IOException ioe) {} - } - - return result; - } - private Manifest removeParcelFromManifest(File document, String name) { Manifest result = null; @@ -512,31 +163,4 @@ public class ParcelZipper result.remove(name); return result; } - - private String getParcelLanguage(File file) throws IOException { - ZipFile zf = null; - ZipEntry ze = null; - InputStream is = null; - ParcelDescriptor pd; - - try { - zf = new ZipFile(file); - ze = zf.getEntry(PARCEL_DESCRIPTOR_XML); - - if (ze == null) - throw new IOException("Could not find Parcel Descriptor in parcel"); - - is = zf.getInputStream(ze); - pd = new ParcelDescriptor(is); - } - finally { - if (zf != null) - zf.close(); - - if (is != null) - is.close(); - } - - return pd.getLanguage().toLowerCase(); - } } diff --git a/scripting/workben/installer/InstUtil.java b/scripting/workben/installer/InstUtil.java index af29db64c3ce..703871dd67c7 100644 --- a/scripting/workben/installer/InstUtil.java +++ b/scripting/workben/installer/InstUtil.java @@ -142,36 +142,6 @@ public class InstUtil { - private static Properties getJeditLocation() { - - Properties results = new Properties(); - - StringBuffer str = new StringBuffer(); - str.append(System.getProperty("user.home")); - str.append(File.separator); - StringBuffer thePath = new StringBuffer(str.toString()); - - thePath.append(".jedit"); - - File jeditLogFile = new File( thePath.toString() + File.separator + "activity.log" ); - if( jeditLogFile.exists() ) { - String[] jeditDetails = getJeditInstallation( jeditLogFile ); - System.out.println( "getJeditLocation ) " + jeditDetails[0] ); - results.put("jEdit "+jeditDetails[1], jeditDetails[0]); - System.out.println( "jeditDetails[0] is " + jeditDetails[0]); - } - else { - System.out.println( "Prompt user for Jedit installation path" ); - } - - - return results; - } - - - - - private static String getNetbeansInstallation( File logFile ) { String installPath = ""; try { @@ -196,38 +166,6 @@ public class InstUtil { } - private static String[] getJeditInstallation( File logFile ) { - String[] jeditDetails = new String[2]; - try { - BufferedReader reader = new BufferedReader(new FileReader(logFile)); - String installPath = ""; - String version = ""; - - for (String s = reader.readLine(); s != null; s = reader.readLine()) { - if( s.indexOf( "jEdit home directory is" ) != -1 ) { - int pathStart = new String( "[message] jEdit: jEdit home directory is " ).length(); - installPath = s.substring( pathStart, s.length() ) +File.separator; - System.out.println( "installPath 1" + installPath ); - jeditDetails[0] = installPath; - } - if( s.indexOf( "jEdit: jEdit version" ) != -1 ) { - int versionStart = s.indexOf( "version" ) + 8; - System.out.println( "versionStart is: " + versionStart ); - version = s.substring( versionStart, s.length() ); - System.out.println( "jEdit version is: " + version ); - jeditDetails[1] = version; - } - } - reader.close(); - } - catch( IOException ioe ) { - System.out.println( "Error reading Jedit location information" ); - } - return jeditDetails; - } - - - private static File findVersionFile(File start) { File versionFile = null; diff --git a/swext/mediawiki/src/com/sun/star/wiki/Helper.java b/swext/mediawiki/src/com/sun/star/wiki/Helper.java index 57da1e841fb4..f2ab089ac017 100644 --- a/swext/mediawiki/src/com/sun/star/wiki/Helper.java +++ b/swext/mediawiki/src/com/sun/star/wiki/Helper.java @@ -21,7 +21,6 @@ package com.sun.star.wiki; import com.sun.star.awt.MessageBoxButtons; import com.sun.star.awt.MessageBoxType; import com.sun.star.awt.XControl; -import com.sun.star.awt.XControlContainer; import com.sun.star.awt.XDialog; import com.sun.star.awt.XMessageBox; import com.sun.star.awt.XMessageBoxFactory; @@ -815,31 +814,6 @@ public class Helper return aHostConfig; } - private static XControl GetControlFromDialog( XDialog xDialog, String aControlName ) - { - XControl xResult = null; - XControlContainer xControlCont = UnoRuntime.queryInterface( XControlContainer.class, xDialog ); - - if ( xControlCont != null ) - { - Object oControl = xControlCont.getControl( aControlName ); - xResult = UnoRuntime.queryInterface( XControl.class, oControl ); - } - - return xResult; - } - - private static XPropertySet GetSubControlPropSet( XDialog xDialog, String aControlName ) - { - XControl xControl = GetControlFromDialog( xDialog, aControlName ); - if ( xControl != null ) - return UnoRuntime.queryInterface( XPropertySet.class, xControl.getModel() ); - - return null; - } - - - protected static String[] GetPasswordsForURLAndUser( XComponentContext xContext, String sURL, String sUserName ) { String[] aResult = null; diff --git a/toolkit/qa/complex/toolkit/Assert.java b/toolkit/qa/complex/toolkit/Assert.java index 664840f811b3..0bda0b65c242 100644 --- a/toolkit/qa/complex/toolkit/Assert.java +++ b/toolkit/qa/complex/toolkit/Assert.java @@ -178,24 +178,6 @@ public class Assert assertException( i_message, i_object, i_methodName, argClasses, i_methodArgs, i_expectedExceptionClass ); } - /** invokes a given method on a given object, and assures a certain exception is caught - * @param i_object is the object to invoke the method on - * @param i_methodName is the name of the method to invoke - * @param i_methodArgs are the arguments to pass to the method. Those implicitly define - * the classes of the arguments of the method which is called. - * @param i_expectedExceptionClass is the class of the exception to be caught. If this is null, - * it means that <em>no</em> exception must be throw by invoking the method. - */ - private static void assertException( final Object i_object, final String i_methodName, final Object[] i_methodArgs, - final Class<?> i_expectedExceptionClass ) - { - assertException( - "did not catch the expected exception (" + - ( ( i_expectedExceptionClass == null ) ? "none" : i_expectedExceptionClass.getName() ) + - ") while calling " + i_object.getClass().getName() + "." + i_methodName, - i_object, i_methodName, i_methodArgs, i_expectedExceptionClass ); - } - diff --git a/wizards/com/sun/star/wizards/common/Configuration.java b/wizards/com/sun/star/wizards/common/Configuration.java index 9470577c82a2..d2f39c22cd95 100644 --- a/wizards/com/sun/star/wizards/common/Configuration.java +++ b/wizards/com/sun/star/wizards/common/Configuration.java @@ -336,28 +336,6 @@ public abstract class Configuration - private static XNameAccess getChildNodebyDisplayName(XNameAccess _xNameAccessNode, String _displayname, String _nodename) - { - String[] snames = null; - try - { - snames = _xNameAccessNode.getElementNames(); - for (int i = 0; i < snames.length; i++) - { - String curdisplayname = (String) Helper.getUnoPropertyValue(_xNameAccessNode.getByName(snames[i]), _nodename); - if (curdisplayname.equals(_displayname)) - { - return UnoRuntime.queryInterface(XNameAccess.class, _xNameAccessNode.getByName(snames[i])); - } - } - } - catch (Exception e) - { - e.printStackTrace(System.err); - } - return null; - } - public static XNameAccess getChildNodebyDisplayName(XMultiServiceFactory _xMSF, Locale _aLocale, XNameAccess _xNameAccessNode, String _displayname, String _nodename, int _nmaxcharcount) { String[] snames = null; diff --git a/wizards/com/sun/star/wizards/common/Desktop.java b/wizards/com/sun/star/wizards/common/Desktop.java index a09d4d85e51c..a9f029372790 100644 --- a/wizards/com/sun/star/wizards/common/Desktop.java +++ b/wizards/com/sun/star/wizards/common/Desktop.java @@ -18,7 +18,6 @@ package com.sun.star.wizards.common; import com.sun.star.beans.PropertyValue; -import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiComponentFactory; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.UnoRuntime; @@ -72,16 +71,6 @@ public class Desktop return xFrameSuppl.getActiveFrame(); } - private static XComponent getActiveComponent(XMultiServiceFactory _xMSF) - { - XFrame xFrame = getActiveFrame(_xMSF); - return UnoRuntime.queryInterface(XComponent.class, xFrame.getController().getModel()); - } - - - - - private static XDispatch getDispatcher(XFrame xFrame, String _stargetframe, com.sun.star.util.URL oURL) { try diff --git a/wizards/com/sun/star/wizards/common/FileAccess.java b/wizards/com/sun/star/wizards/common/FileAccess.java index 252f90219daa..12d4d4d4d8f0 100644 --- a/wizards/com/sun/star/wizards/common/FileAccess.java +++ b/wizards/com/sun/star/wizards/common/FileAccess.java @@ -26,7 +26,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Vector; -import com.sun.star.awt.VclWindowPeerAttribute; import com.sun.star.io.XActiveDataSink; import com.sun.star.io.XInputStream; import com.sun.star.io.XTextInputStream; @@ -339,40 +338,6 @@ public class FileAccess return ReturnPath; } - private static boolean createSubDirectory(XMultiServiceFactory xMSF, XSimpleFileAccess xSimpleFileAccess, String Path) - { - String sNoDirCreation = PropertyNames.EMPTY_STRING; - try - { - Resource oResource = new Resource(xMSF, "ImportWizard", "imp"); - sNoDirCreation = oResource.getResText(1050); - String sMsgDirNotThere = oResource.getResText(1051); - String sQueryForNewCreation = oResource.getResText(1052); - String OSPath = JavaTools.convertfromURLNotation(Path); - String sQueryMessage = JavaTools.replaceSubString(sMsgDirNotThere, OSPath, "%1"); - sQueryMessage = sQueryMessage + (char) 13 + sQueryForNewCreation; - int icreate = SystemDialog.showMessageBox(xMSF, "QueryBox", VclWindowPeerAttribute.YES_NO, sQueryMessage); - if (icreate == 2) - { - xSimpleFileAccess.createFolder(Path); - return true; - } - return false; - } - catch (com.sun.star.ucb.CommandAbortedException exception) - { - String sMsgNoDir = JavaTools.replaceSubString(sNoDirCreation, Path, "%1"); - SystemDialog.showMessageBox(xMSF, "ErrorBox", VclWindowPeerAttribute.OK, sMsgNoDir); - return false; - } - catch (com.sun.star.uno.Exception unoexception) - { - String sMsgNoDir = JavaTools.replaceSubString(sNoDirCreation, Path, "%1"); - SystemDialog.showMessageBox(xMSF, "ErrorBox", VclWindowPeerAttribute.OK, sMsgNoDir); - return false; - } - } - /** * We search in all given path for a given file */ @@ -566,24 +531,6 @@ public class FileAccess return filename; } - private boolean mkdir(String s) - { - try - { - fileAccess.createFolder(s); - return true; - } - catch (CommandAbortedException cax) - { - cax.printStackTrace(); - } - catch (com.sun.star.uno.Exception ex) - { - ex.printStackTrace(); - } - return false; - } - /** * @param def what to return in case of an exception * @return true if the given file exists or not. @@ -650,26 +597,6 @@ public class FileAccess - private String getNewFile(String parentDir, String name, String extension) - { - - int i = 0; - String url; - do - { - String filename = filename(name, extension, i++); - url = getURL(parentDir, filename); - } - while (exists(url, true)); - - return url; - } - - private static String filename(String name, String ext, int i) - { - return name + (i == 0 ? PropertyNames.EMPTY_STRING : String.valueOf(i)) + (ext.equals(PropertyNames.EMPTY_STRING) ? PropertyNames.EMPTY_STRING : "." + ext); - } - public static String connectURLs(String urlFolder, String urlFilename) { return urlFolder + (urlFolder.endsWith("/") ? PropertyNames.EMPTY_STRING : "/") + diff --git a/wizards/com/sun/star/wizards/common/Helper.java b/wizards/com/sun/star/wizards/common/Helper.java index aab3e7249483..e5e009d8879e 100644 --- a/wizards/com/sun/star/wizards/common/Helper.java +++ b/wizards/com/sun/star/wizards/common/Helper.java @@ -308,23 +308,6 @@ public class Helper return getDocumentDateAsDouble(date.Year * 10000 + date.Month * 100 + date.Day); } - private synchronized double getDocumentDateAsDouble(long javaTimeInMillis) - { - calendar.clear(); - JavaTools.setTimeInMillis(calendar, javaTimeInMillis); - - long date1 = getTimeInMillis(); - - /* - * docNullTime and date1 are in millis, but - * I need a day... - */ - return (date1 - docNullTime) / DAY_IN_MILLIS + 1; - - } - - - public String format(int formatIndex, DateTime date) { return formatter.convertNumberToString(formatIndex, getDocumentDateAsDouble(date)); diff --git a/wizards/com/sun/star/wizards/common/JavaTools.java b/wizards/com/sun/star/wizards/common/JavaTools.java index ac217f3aabc0..940b17d52530 100644 --- a/wizards/com/sun/star/wizards/common/JavaTools.java +++ b/wizards/com/sun/star/wizards/common/JavaTools.java @@ -310,14 +310,6 @@ public class JavaTools } } - private static String getFilenameOutOfPath(String sPath) - { - String[] Hierarchy = ArrayoutofString(sPath, "/"); - return Hierarchy[Hierarchy.length - 1]; - } - - - public static String convertfromURLNotation(String _sURLPath) { String sPath = PropertyNames.EMPTY_STRING; @@ -336,12 +328,6 @@ public class JavaTools - private static long getTimeInMillis(Calendar _calendar) - { - java.util.Date dDate = _calendar.getTime(); - return dDate.getTime(); - } - public static void setTimeInMillis(Calendar _calendar, long _timemillis) { java.util.Date dDate = new java.util.Date(); diff --git a/wizards/com/sun/star/wizards/common/NumericalHelper.java b/wizards/com/sun/star/wizards/common/NumericalHelper.java index 12efa62e949a..bf02290d9ae6 100644 --- a/wizards/com/sun/star/wizards/common/NumericalHelper.java +++ b/wizards/com/sun/star/wizards/common/NumericalHelper.java @@ -62,181 +62,6 @@ public class NumericalHelper /** - * get a byte value from the object - * @return a byte - * @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted - */ - private static byte toByte(Object aValue) - throws com.sun.star.lang.IllegalArgumentException - { - - byte retValue = 0; - TypeObject aTypeObject = getTypeObject(aValue); - switch (aTypeObject.iType) - { - case BYTE_TYPE: - retValue = getByte(aTypeObject); - break; - case CHAR_TYPE: - retValue = (byte) getChar(aTypeObject); - break; - case SHORT_TYPE: - retValue = (byte) getShort(aTypeObject); - break; - case INT_TYPE: - retValue = (byte) getInt(aTypeObject); - break; - case LONG_TYPE: - retValue = (byte) getLong(aTypeObject); - break; - case FLOAT_TYPE: - retValue = (byte) getFloat(aTypeObject); - break; - case DOUBLE_TYPE: - retValue = (byte) getDouble(aTypeObject); - break; - case STRING_TYPE: - try - { - Byte b = new Byte((String) aTypeObject.aValue); - retValue = b.byteValue(); - } - catch (java.lang.NumberFormatException e) - { - throw new com.sun.star.lang.IllegalArgumentException( - "Cannot convert to byte: " + aTypeObject.aValue); - } - break; - case BOOLEAN_TYPE: - retValue = getBool(aTypeObject) ? (byte) -1 : (byte) 0; - break; - default: - throw new com.sun.star.lang.IllegalArgumentException( - "Cannot convert this type: " + aValue.getClass().getName()); - } - return retValue; - } - - - - /** - * get a short value from the object - * @return a short - * @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted - */ - private static short toShort(Object aValue) - throws com.sun.star.lang.IllegalArgumentException - { - short retValue = 0; - TypeObject aTypeObject = getTypeObject(aValue); - switch (aTypeObject.iType) - { - case BYTE_TYPE: - retValue = getByte(aTypeObject); - break; - case CHAR_TYPE: - retValue = (byte) getChar(aTypeObject); - break; - case SHORT_TYPE: - retValue = getShort(aTypeObject); - break; - case INT_TYPE: - retValue = (short) getInt(aTypeObject); - break; - case LONG_TYPE: - retValue = (short) getLong(aTypeObject); - break; - case FLOAT_TYPE: - retValue = (short) getFloat(aTypeObject); - break; - case DOUBLE_TYPE: - retValue = (short) getDouble(aTypeObject); - break; - case STRING_TYPE: - try - { - Short s = new Short((String) aTypeObject.aValue); - retValue = s.shortValue(); - } - catch (java.lang.NumberFormatException e) - { - throw new com.sun.star.lang.IllegalArgumentException( - "Cannot convert to short: " + aTypeObject.aValue); - } - break; - case BOOLEAN_TYPE: - retValue = getBool(aTypeObject) ? (short) -1 : (short) 0; - break; - default: - throw new com.sun.star.lang.IllegalArgumentException( - "Cannot convert this type: " + aValue.getClass().getName()); - } - return retValue; - } - - - - - - - - /** - @param aValue a object this can contain anything - @return true, if the parameter aValue is type of real numbers - @deprecate, use isRealNumber() instead. - */ - private static boolean isNumerical(Object aValue) - { - try - { - TypeObject aTypeObject = getTypeObject(aValue); - switch (aTypeObject.iType) - { - case BYTE_TYPE: - case CHAR_TYPE: - case SHORT_TYPE: - case INT_TYPE: - case LONG_TYPE: - case DOUBLE_TYPE: - case FLOAT_TYPE: - return true; - default: - return false; - } - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - return false; - } - } - - - - /** - @param aValue a object this can contain anything - * @return true, if the value is type of any integer values. double / float are not(!) integer values - */ - private static boolean isInteger(Object aValue) throws com.sun.star.lang.IllegalArgumentException - { - TypeObject aTypeObject = getTypeObject(aValue); - switch (aTypeObject.iType) - { - case BYTE_TYPE: - case CHAR_TYPE: - case SHORT_TYPE: - case INT_TYPE: - case LONG_TYPE: - return true; - default: - return false; - } - } - - - - - - /** * get an int value from the object * @return an int * @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted @@ -292,116 +117,6 @@ public class NumericalHelper } /** - * get a long value from the object - * @return a long - * @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted - */ - private static long toLong(Object aValue) - throws com.sun.star.lang.IllegalArgumentException - { - long retValue = 0; - TypeObject aTypeObject = getTypeObject(aValue); - switch (aTypeObject.iType) - { - case BYTE_TYPE: - retValue = getByte(aTypeObject); - break; - case CHAR_TYPE: - retValue = getChar(aTypeObject); - break; - case SHORT_TYPE: - retValue = getShort(aTypeObject); - break; - case INT_TYPE: - retValue = getInt(aTypeObject); - break; - case LONG_TYPE: - retValue = getLong(aTypeObject); - break; - case FLOAT_TYPE: - retValue = (long) getFloat(aTypeObject); - break; - case DOUBLE_TYPE: - retValue = (long) getDouble(aTypeObject); - break; - case STRING_TYPE: - try - { - Long l = new Long((String) aTypeObject.aValue); - retValue = l.longValue(); - } - catch (java.lang.NumberFormatException e) - { - throw new com.sun.star.lang.IllegalArgumentException( - "Cannot convert to short: " + aTypeObject.aValue); - } - break; - case BOOLEAN_TYPE: - retValue = getBool(aTypeObject) ? -1 : 0; - break; - default: - throw new com.sun.star.lang.IllegalArgumentException( - "Cannot convert this type: " + aValue.getClass().getName()); - } - return retValue; - } - - /** - * get a float value from the object - * @return a float - * @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted - */ - private static float toFloat(Object aValue) - throws com.sun.star.lang.IllegalArgumentException - { - float retValue = (float) 0.0; - TypeObject aTypeObject = getTypeObject(aValue); - switch (aTypeObject.iType) - { - case BYTE_TYPE: - retValue = getByte(aTypeObject); - break; - case CHAR_TYPE: - retValue = getChar(aTypeObject); - break; - case SHORT_TYPE: - retValue = getShort(aTypeObject); - break; - case INT_TYPE: - retValue = getInt(aTypeObject); - break; - case LONG_TYPE: - retValue = getLong(aTypeObject); - break; - case FLOAT_TYPE: - retValue = getFloat(aTypeObject); - break; - case DOUBLE_TYPE: - retValue = (float) getDouble(aTypeObject); - break; - case STRING_TYPE: - try - { - Float f = new Float((String) aTypeObject.aValue); - retValue = f.floatValue(); - } - catch (java.lang.NumberFormatException e) - { - throw new com.sun.star.lang.IllegalArgumentException( - "Cannot convert to short: " + aTypeObject.aValue); - } - break; - case BOOLEAN_TYPE: - retValue = getBool(aTypeObject) ? (float) -1 : (float) 0; - break; - default: - throw new com.sun.star.lang.IllegalArgumentException( - "Cannot convert this type: " + aValue.getClass().getName()); - } - return retValue; - } - - /** * get a double value from the object * @return a double * @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted @@ -457,55 +172,6 @@ public class NumericalHelper } /** - * get a String value from the object - * @return a String - * @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted - */ - private static String toString(Object aValue) - throws com.sun.star.lang.IllegalArgumentException - { - String retValue = null; - TypeObject aTypeObject = getTypeObject(aValue); - switch (aTypeObject.iType) - { - case BYTE_TYPE: - retValue = aTypeObject.aValue.toString(); - break; - case CHAR_TYPE: - retValue = aTypeObject.aValue.toString(); - break; - case SHORT_TYPE: - retValue = aTypeObject.aValue.toString(); - break; - case INT_TYPE: - retValue = aTypeObject.aValue.toString(); - break; - case LONG_TYPE: - retValue = aTypeObject.aValue.toString(); - break; - case FLOAT_TYPE: - retValue = aTypeObject.aValue.toString(); - break; - case DOUBLE_TYPE: - retValue = aTypeObject.aValue.toString(); - break; - case STRING_TYPE: - retValue = (String) aTypeObject.aValue; - break; - case BOOLEAN_TYPE: - retValue = aTypeObject.aValue.toString(); - break; - case SEQUENCE_TYPE: - retValue = new String(toByteArray((aValue))); - break; - default: - throw new com.sun.star.lang.IllegalArgumentException( - "Cannot convert this type: " + aValue.getClass().getName()); - } - return retValue; - } - - /** * get a boolean value from the object * @return a boolean * @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted @@ -561,142 +227,6 @@ public class NumericalHelper } /** - * get an int array from an object - * @param anArrayValue a value that is constructed into an array - * @return an integer array - */ - private static int[] toIntArray(Object anArrayValue) - throws com.sun.star.lang.IllegalArgumentException - { - int[] retValue = null; - TypeObject aTypeObject = getTypeObject(anArrayValue); - if (aTypeObject.iType == SEQUENCE_TYPE) - { - Object[] obj = convertSequenceToObjectArray(aTypeObject); - retValue = new int[obj.length]; - for (int i = 0; i < obj.length; i++) - { - retValue[i] = toInt(obj[i]); - } - } - else - { // object is not really an array - retValue = new int[] - { - toInt(anArrayValue) - }; - } - return retValue; - } - - /** - * get an byte array from an object - * @param anArrayValue a value that is constructed into an array - * @return a byte array - */ - private static byte[] toByteArray(Object anArrayValue) - throws com.sun.star.lang.IllegalArgumentException - { - byte[] retValue = null; - TypeObject aTypeObject = getTypeObject(anArrayValue); - if (aTypeObject.iType == SEQUENCE_TYPE) - { - Object[] obj = convertSequenceToObjectArray(aTypeObject); - retValue = new byte[obj.length]; - for (int i = 0; i < obj.length; i++) - { - retValue[i] = toByte(obj[i]); - } - } - else - { // object is not really an array - retValue = new byte[] - { - toByte(anArrayValue) - }; - } - return retValue; - } - - /** - * get a short array from an object - * @param anArrayValue a value that is constructed into an array - * @return a short array - */ - private static short[] toShortArray(Object anArrayValue) - throws com.sun.star.lang.IllegalArgumentException - { - short[] retValue = null; - TypeObject aTypeObject = getTypeObject(anArrayValue); - if (aTypeObject.iType == SEQUENCE_TYPE) - { - Object[] obj = convertSequenceToObjectArray(aTypeObject); - retValue = new short[obj.length]; - for (int i = 0; i < obj.length; i++) - { - retValue[i] = toShort(obj[i]); - } - } - else - { // object is not really an array - retValue = new short[] - { - toShort(anArrayValue) - }; - } - return retValue; - } - - /** - * get a string array from an object - * @param anArrayValue a value that is constructed into an array - * @return a short array - */ - private static String[] toStringArray(Object anArrayValue) - throws com.sun.star.lang.IllegalArgumentException - { - String[] retValue = null; - TypeObject aTypeObject = getTypeObject(anArrayValue); - if (aTypeObject.iType == SEQUENCE_TYPE) - { - Object[] obj = convertSequenceToObjectArray(aTypeObject); - retValue = new String[obj.length]; - for (int i = 0; i < obj.length; i++) - { - retValue[i] = toString(obj[i]); - } - } - else - { // object is not really an array - retValue = new String[] - { - toString(anArrayValue) - }; - } - return retValue; - } - - - - - - - - - - - - - - - - - - - - - - /** * get the type object from the given object * @param aValue an object representing a (numerical) value; can also be an 'any' * @return a type object: the object together with the its type information @@ -917,107 +447,5 @@ public class NumericalHelper transform(number); } } - - public String getResult() - { - return val.toString(); - } - } - - private static Object[] convertSequenceToObjectArray( - TypeObject sourceObject) - throws com.sun.star.lang.IllegalArgumentException - { - Object array = sourceObject.aValue; - Class<?> c = array.getClass(); - Object[] aShortVal = null; - if (c.equals(byte[].class)) - { - byte[] vals = (byte[]) array; - aShortVal = new Object[vals.length]; - for (int i = 0; i < vals.length; i++) - { - aShortVal[i] = new Byte(vals[i]); - } - } - else if (c.equals(short[].class)) - { - short[] vals = (short[]) array; - aShortVal = new Object[vals.length]; - for (int i = 0; i < vals.length; i++) - { - aShortVal[i] = new Short(vals[i]); - } - } - else if (c.equals(int[].class)) - { - int[] vals = (int[]) array; - aShortVal = new Object[vals.length]; - for (int i = 0; i < vals.length; i++) - { - aShortVal[i] = new Integer(vals[i]); - } - } - else if (c.equals(long[].class)) - { - long[] vals = (long[]) array; - aShortVal = new Object[vals.length]; - for (int i = 0; i < vals.length; i++) - { - aShortVal[i] = new Long(vals[i]); - } - } - else if (c.equals(float[].class)) - { - float[] vals = (float[]) array; - aShortVal = new Object[vals.length]; - for (int i = 0; i < vals.length; i++) - { - aShortVal[i] = new Float(vals[i]); - } - } - else if (c.equals(double[].class)) - { - double[] vals = (double[]) array; - aShortVal = new Object[vals.length]; - for (int i = 0; i < vals.length; i++) - { - aShortVal[i] = new Double(vals[i]); - } - } - else if (c.equals(boolean[].class)) - { - boolean[] vals = (boolean[]) array; - aShortVal = new Object[vals.length]; - for (int i = 0; i < vals.length; i++) - { - aShortVal[i] = Boolean.valueOf(vals[i]); - } - } - // if nothing did match, try this - if (aShortVal == null) - { - try - { - aShortVal = (Object[]) array; - } - catch (java.lang.ClassCastException e) - { - // unknown type cannot be converted - throw new com.sun.star.lang.IllegalArgumentException( - "Cannot convert unknown type: '" + e.getMessage() + "'"); - } - } - return aShortVal; - } - - - - - - private static double roundDouble(double _dblvalue, int _ndecimals) - { - double dblfactor = java.lang.Math.pow(10.0, _ndecimals); - return ((int) (_dblvalue * dblfactor)) / dblfactor; } } diff --git a/wizards/com/sun/star/wizards/common/PropertySetHelper.java b/wizards/com/sun/star/wizards/common/PropertySetHelper.java index 660d4906f690..bebab376c0d0 100644 --- a/wizards/com/sun/star/wizards/common/PropertySetHelper.java +++ b/wizards/com/sun/star/wizards/common/PropertySetHelper.java @@ -17,13 +17,9 @@ */ package com.sun.star.wizards.common; -import com.sun.star.beans.Property; import com.sun.star.uno.UnoRuntime; import com.sun.star.beans.XPropertySet; -import com.sun.star.beans.XPropertySetInfo; import com.sun.star.uno.AnyConverter; -import com.sun.star.lang.XServiceInfo; - import java.util.HashMap; public class PropertySetHelper @@ -260,34 +256,4 @@ public class PropertySetHelper } return aObject; } - - - - /** - Debug helper, to show all properties which are available in the current object. - */ - private void showProperties() - { - String sName = PropertyNames.EMPTY_STRING; - - if (m_xPropertySet != null) - { - XServiceInfo xServiceInfo = UnoRuntime.queryInterface(XServiceInfo.class, m_xPropertySet); - if (xServiceInfo != null) - { - sName = xServiceInfo.getImplementationName(); - } - XPropertySetInfo xInfo = m_xPropertySet.getPropertySetInfo(); - Property[] aAllProperties = xInfo.getProperties(); - DebugHelper.writeInfo("Show all properties of Implementation of :'" + sName + "'"); - for (int i = 0; i < aAllProperties.length; i++) - { - DebugHelper.writeInfo(" - " + aAllProperties[i].Name); - } - } - else - { - DebugHelper.writeInfo("The given object don't support XPropertySet interface."); - } - } } diff --git a/wizards/com/sun/star/wizards/form/FormConfiguration.java b/wizards/com/sun/star/wizards/form/FormConfiguration.java index 3ef163cd6b6b..a871b1c4bb45 100644 --- a/wizards/com/sun/star/wizards/form/FormConfiguration.java +++ b/wizards/com/sun/star/wizards/form/FormConfiguration.java @@ -145,29 +145,6 @@ public class FormConfiguration Helper.setUnoPropertyValue(UnoDialog.getModel(optOnExistingRelation), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bsupportsRelations && (chkcreateSubForm.getState() == 1))); } - private void toggleSteps() - { - if (chkcreateSubForm.getState() == 1) - { - if (optOnExistingRelation.getState()) - { - onexistingRelationSelection(); - } - else if (optSelectManually.getState()) - { - CurUnoDialog.enablefromStep(FormWizard.SOFIELDLINKER_PAGE, (CurSubFormFieldSelection.getSelectedFieldNames().length > 0)); - CurUnoDialog.setStepEnabled(FormWizard.SOSUBFORMFIELDS_PAGE, true); - } - } - else - { - CurUnoDialog.setStepEnabled(FormWizard.SOSUBFORMFIELDS_PAGE, false); - CurUnoDialog.setStepEnabled(FormWizard.SOFIELDLINKER_PAGE, false); - CurUnoDialog.enablefromStep(FormWizard.SOCONTROL_PAGE, true); - } - toggleRelationsListbox(); - } - public String getreferencedTableName() { if (areexistingRelationsdefined()) @@ -184,27 +161,6 @@ public class FormConfiguration return PropertyNames.EMPTY_STRING; } - private void onexistingRelationSelection() - { - String scurreferencedTableName = getreferencedTableName(); - if (scurreferencedTableName.length() > 0) - { - if (CurSubFormFieldSelection.getSelectedCommandName().equals(scurreferencedTableName)) - { - CurUnoDialog.enablefromStep(FormWizard.SOSUBFORMFIELDS_PAGE, true); - CurUnoDialog.setStepEnabled(FormWizard.SOFIELDLINKER_PAGE, false); - return; - } - else - { - CurUnoDialog.setStepEnabled(FormWizard.SOSUBFORMFIELDS_PAGE, true); - CurUnoDialog.enablefromStep(FormWizard.SOFIELDLINKER_PAGE, false); - return; - } - } - CurUnoDialog.enablefromStep(FormWizard.SOSUBFORMFIELDS_PAGE, false); - } - private void toggleRelationsListbox() { boolean bdoenable = bsupportsRelations && this.optOnExistingRelation.getState() && (chkcreateSubForm.getState() == 1); diff --git a/wizards/com/sun/star/wizards/table/FieldFormatter.java b/wizards/com/sun/star/wizards/table/FieldFormatter.java index 399855a24fc3..a60a75c6e94e 100644 --- a/wizards/com/sun/star/wizards/table/FieldFormatter.java +++ b/wizards/com/sun/star/wizards/table/FieldFormatter.java @@ -239,18 +239,6 @@ public class FieldFormatter implements XItemListener - private String[] shiftArrayItem(String[] _slist, int _oldindex, int _shiftcount) - { - int newindex = _oldindex + _shiftcount; - if ((newindex >= 0) && (newindex < _slist.length)) - { - String buffer = _slist[newindex]; - _slist[newindex] = _slist[_oldindex]; - _slist[_oldindex] = buffer; - } - return _slist; - } - public boolean updateColumnofColumnDescriptor() { Object oColumn = Helper.getUnoPropertyValue(oColumnDescriptorModel, "Column"); diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog2.java b/wizards/com/sun/star/wizards/ui/UnoDialog2.java index 2d1ecbc70c0f..701d435ded3c 100644 --- a/wizards/com/sun/star/wizards/ui/UnoDialog2.java +++ b/wizards/com/sun/star/wizards/ui/UnoDialog2.java @@ -105,30 +105,6 @@ public class UnoDialog2 extends UnoDialog return insertCheckBox(sName, itemChanged, this, sPropNames, oPropValues); } - private XComboBox insertComboBox(String sName, String actionPerformed, String itemChanged, String textChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues) - { - XComboBox xComboBox = (XComboBox) insertControlModel2("com.sun.star.awt.UnoControlComboBoxModel", sName, sPropNames, oPropValues, XComboBox.class); - if (actionPerformed != null) - { - xComboBox.addActionListener((XActionListener) guiEventListener); - guiEventListener.add(sName, EVENT_ACTION_PERFORMED, actionPerformed, eventTarget); - } - if (itemChanged != null) - { - xComboBox.addItemListener((XItemListener) guiEventListener); - guiEventListener.add(sName, EVENT_ITEM_CHANGED, itemChanged, eventTarget); - } - if (textChanged != null) - { - XTextComponent xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, xComboBox); - xTextComponent.addTextListener((XTextListener) guiEventListener); - guiEventListener.add(sName, EVENT_TEXT_CHANGED, textChanged, eventTarget); - } - return xComboBox; - } - - - public XListBox insertListBox(String sName, String actionPerformed, String itemChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues) { XListBox xListBox = (XListBox) insertControlModel2("com.sun.star.awt.UnoControlListBoxModel", sName, sPropNames, oPropValues, XListBox.class); @@ -210,55 +186,6 @@ public class UnoDialog2 extends UnoDialog return UnoRuntime.queryInterface(type, xField); } - private XControl insertFileControl(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues) - { - return (XControl) insertEditField(sName, sTextChanged, eventTarget, "com.sun.star.awt.UnoControlFileControlModel", sPropNames, oPropValues, XControl.class); - } - - - - private XCurrencyField insertCurrencyField(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues) - { - return (XCurrencyField) insertEditField(sName, sTextChanged, eventTarget, "com.sun.star.awt.UnoControlCurrencyFieldModel", sPropNames, oPropValues, XCurrencyField.class); - } - - - - private XDateField insertDateField(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues) - { - return (XDateField) insertEditField(sName, sTextChanged, eventTarget, "com.sun.star.awt.UnoControlDateFieldModel", sPropNames, oPropValues, XDateField.class); - } - - - - private XNumericField insertNumericField(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues) - { - return (XNumericField) insertEditField(sName, sTextChanged, eventTarget, "com.sun.star.awt.UnoControlNumericFieldModel", sPropNames, oPropValues, XNumericField.class); - } - - - - private XTimeField insertTimeField(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues) - { - return (XTimeField) insertEditField(sName, sTextChanged, eventTarget, "com.sun.star.awt.UnoControlTimeFieldModel", sPropNames, oPropValues, XTimeField.class); - } - - - - private XPatternField insertPatternField(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues) - { - return (XPatternField) insertEditField(sName, sTextChanged, eventTarget, "com.sun.star.awt.UnoControlPatternFieldModel", sPropNames, oPropValues, XPatternField.class); - } - - - - private XTextComponent insertFormattedField(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues) - { - return (XTextComponent) insertEditField(sName, sTextChanged, eventTarget, "com.sun.star.awt.UnoControlFormattedFieldModel", sPropNames, oPropValues, XTextComponent.class); - } - - - public XControl insertFixedLine(String sName, String[] sPropNames, Object[] oPropValues) { Object oLine = insertControlModel2("com.sun.star.awt.UnoControlFixedLineModel", sName, sPropNames, oPropValues); diff --git a/wizards/com/sun/star/wizards/ui/event/DataAware.java b/wizards/com/sun/star/wizards/ui/event/DataAware.java index ec9af54a2eab..17485dc012fb 100644 --- a/wizards/com/sun/star/wizards/ui/event/DataAware.java +++ b/wizards/com/sun/star/wizards/ui/event/DataAware.java @@ -64,24 +64,6 @@ public abstract class DataAware { } /** - * sets a new data object. Optionally - * update the UI. - * @param obj the new data object. - * @param updateUI if true updateUI() will be called. - */ - private void setDataObject(Object obj, boolean updateUI) { - - if (obj != null && !value.isAssignable(obj.getClass())) - throw new ClassCastException("can not cast new DataObject to original Class"); - - dataObject = obj; - - if (updateUI) - updateUI(); - - } - - /** * Sets the given value to the data object. * this method delegates the job to the * Value object, but can be overwritten if @@ -115,23 +97,6 @@ public abstract class DataAware { protected abstract Object getFromUI(); /** - * updates the UI control according to the - * current state of the data object. - */ - private void updateUI() { - Object data = getFromData(); - Object ui = getFromUI(); - if (!equals(data, ui)) - try { - setToUI(data); - } catch (Exception ex) { - ex.printStackTrace(); - //TODO tell user... - } - enableControls(data); - } - - /** * enables * @param currentValue */ diff --git a/wizards/com/sun/star/wizards/ui/event/Task.java b/wizards/com/sun/star/wizards/ui/event/Task.java index 75608d9ffcaf..252fa8aad864 100644 --- a/wizards/com/sun/star/wizards/ui/event/Task.java +++ b/wizards/com/sun/star/wizards/ui/event/Task.java @@ -52,25 +52,6 @@ public class Task fireTaskStatusChanged(); } - private void advance(boolean success_) - { - if (success_) - { - successful++; - } - else - { - failed++; - } - fireTaskStatusChanged(); - if (failed + successful == max) - { - fireTaskFinished(); - } - } - - - public int getStatus() { return successful + failed; @@ -90,36 +71,6 @@ public class Task } } - private void fireTaskStarted() - { - TaskEvent te = new TaskEvent(this, TaskEvent.TASK_STARTED); - - for (int i = 0; i < listeners.size(); i++) - { - listeners.get(i).taskStarted(te); - } - } - - private void fireTaskFailed() - { - TaskEvent te = new TaskEvent(this, TaskEvent.TASK_FAILED); - - for (int i = 0; i < listeners.size(); i++) - { - listeners.get(i).taskFinished(te); - } - } - - private void fireTaskFinished() - { - TaskEvent te = new TaskEvent(this, TaskEvent.TASK_FINISHED); - - for (int i = 0; i < listeners.size(); i++) - { - listeners.get(i).taskFinished(te); - } - } - private void fireSubtaskNameChanged() { TaskEvent te = new TaskEvent(this, TaskEvent.SUBTASK_NAME_CHANGED); diff --git a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java index 310c83ec0a28..0ef03552b00b 100644 --- a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java +++ b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java @@ -120,43 +120,6 @@ public class UnoDataAware extends DataAware return Helper.getUnoPropertyValue(unoModel, unoPropName); } - private static UnoDataAware attachTextControl(Object data, String prop, Object unoText, final Listener listener, String unoProperty, boolean field, Object value) - { - XTextComponent text = UnoRuntime.queryInterface(XTextComponent.class, unoText); - final UnoDataAware uda = new UnoDataAware(data, - field - ? DataAwareFields.getFieldValueFor(data, prop, value) - : new DataAware.PropertyValue(prop, data), - text, unoProperty); - text.addTextListener(new XTextListener() - { - - public void textChanged(TextEvent te) - { - uda.updateData(); - if (listener != null) - { - listener.eventPerformed(te); - } - } - - public void disposing(EventObject eo) - { - } - }); - return uda; - } - - - - - - - - - - - static XItemListener itemListener(final DataAware da, final Listener listener) { return new XItemListener() diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/dom/DOMDocument.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/dom/DOMDocument.java index 475a7d166f5d..c7088a6f3a51 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/dom/DOMDocument.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/dom/DOMDocument.java @@ -35,7 +35,6 @@ import javax.xml.transform.stream.StreamResult; import javax.xml.transform.dom.DOMSource; import org.w3c.dom.Node; -import org.w3c.dom.Element; import org.w3c.dom.Document; import org.xml.sax.SAXException; @@ -336,37 +335,6 @@ public class DOMDocument return bytes; } - - - - /** - * <p>Creates a new DOM <code>Document</code> containing minimum - * OpenOffice XML tags.</p> - * - * <p>This method uses the subclass - * <code>getOfficeClassAttribute</code> method to get the - * attribute for <i>office:class</i>.</p> - * - * @param rootName root name of <code>Document</code>. - * - * @throws IOException If any I/O error occurs. - */ - private final Document createDOM(String rootName) throws IOException { - - Document doc = null; - - try { - DocumentBuilder builder = factory.newDocumentBuilder(); - doc = builder.newDocument(); - Element root = doc.createElement(rootName); - doc.appendChild(root); - } catch (ParserConfigurationException ex) { - System.out.println("Error:"+ ex); - } - - return doc; - } - } |