From 3a8d3519889a68ddf209ea7c83307bec51cd6da0 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 12 Aug 2014 12:11:25 +0200 Subject: java: remove unused methods Change-Id: Ibb905e6f3e7d92a0e558f1f6562e5b472cd2717b --- bean/com/sun/star/comp/beans/OOoBean.java | 65 --- .../qa/complex/framework/autosave/Protocol.java | 11 - .../src/net/adaptivebox/global/GlobalString.java | 78 --- .../net/adaptivebox/global/RandomGenerator.java | 11 - .../src/net/adaptivebox/space/DesignSpace.java | 10 - .../star/comp/Calc/NLPSolver/BaseNLPSolver.java | 16 - odk/examples/DevelopersGuide/Database/Sales.java | 44 -- .../DevelopersGuide/Forms/HsqlDatabase.java | 18 - .../DevelopersGuide/GUI/UnoDialogSample.java | 21 - odk/examples/java/Inspector/HideableTreeModel.java | 36 +- .../java/Inspector/SourceCodeGenerator.java | 91 ---- qadevOOo/runner/complexlib/Assurance.java | 63 --- qadevOOo/runner/convwatch/IniFile.java | 33 -- qadevOOo/runner/convwatch/PRNCompare.java | 109 ---- .../graphical/MSOfficePostscriptCreator.java | 209 -------- .../graphical/OpenOfficePostscriptCreator.java | 232 --------- qadevOOo/runner/helper/ConfigHelper.java | 37 -- qadevOOo/runner/helper/ProcessHandler.java | 26 - qadevOOo/runner/helper/StringHelper.java | 10 - qadevOOo/runner/helper/URLHelper.java | 52 -- qadevOOo/runner/lib/Parameters.java | 3 - qadevOOo/runner/org/openoffice/Runner.java | 14 - qadevOOo/runner/util/DBTools.java | 215 -------- qadevOOo/runner/util/DrawTools.java | 29 -- qadevOOo/runner/util/SOfficeFactory.java | 17 - qadevOOo/runner/util/UITools.java | 120 ----- qadevOOo/runner/util/XMLTools.java | 67 --- .../report/pentaho/model/OfficeStyles.java | 10 - .../script/framework/browse/DialogFactory.java | 95 ---- .../framework/container/ParcelDescriptor.java | 31 -- .../openoffice/idesupport/zip/ParcelZipper.java | 376 -------------- scripting/workben/installer/InstUtil.java | 62 --- swext/mediawiki/src/com/sun/star/wiki/Helper.java | 26 - toolkit/qa/complex/toolkit/Assert.java | 18 - .../com/sun/star/wizards/common/Configuration.java | 22 - wizards/com/sun/star/wizards/common/Desktop.java | 11 - .../com/sun/star/wizards/common/FileAccess.java | 73 --- wizards/com/sun/star/wizards/common/Helper.java | 17 - wizards/com/sun/star/wizards/common/JavaTools.java | 14 - .../sun/star/wizards/common/NumericalHelper.java | 572 --------------------- .../sun/star/wizards/common/PropertySetHelper.java | 34 -- .../sun/star/wizards/form/FormConfiguration.java | 44 -- .../com/sun/star/wizards/table/FieldFormatter.java | 12 - wizards/com/sun/star/wizards/ui/UnoDialog2.java | 73 --- .../com/sun/star/wizards/ui/event/DataAware.java | 35 -- wizards/com/sun/star/wizards/ui/event/Task.java | 49 -- .../sun/star/wizards/ui/event/UnoDataAware.java | 37 -- .../xmerge/converter/dom/DOMDocument.java | 32 -- 48 files changed, 1 insertion(+), 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. -

- 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: -

-            java -Dcom.sun.star.officebean.Options=--norestore  ...
-        
- 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 Frame 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\n\n\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; i0) { - 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 origData = new ArrayList(); - 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 toToConvert) { - if (toToConvert==null) return null; - String[] objs = new String[toToConvert.size()]; - for (int i=0; i=totalIndices.length) { - return totalIndices; - } - int[] indices = randomSelection(totalIndices.length, times); - for(int i=0; i 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 no 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 no 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= 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 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 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 \\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 createExcelPrintHelper() throws java.io.IOException { // create a program in tmp file @@ -595,95 +510,6 @@ public class MSOfficePostscriptCreator implements IOffice return aList; } - private ArrayList 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 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 .\\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 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 0) - { - for (int j=0;j * 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 @@ -97,58 +97,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 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 toMap() { return new HashMap(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; @@ -183,50 +172,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 com.sun.star.sdb.DataSource service * instance and copies all fields (which are not null) to @@ -337,166 +282,6 @@ public class DBTools { return xSrcCon.connectWithCompletion(xHandler) ; } - /** - * Registers Test data source in the DatabaseContext service. - * This source always has name 'APITestDatabase' and it - * is registered in subdirectory TestDB of directory - * docPath 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 TestDB directory. - * @return com.sun.star.sdb.DataSource 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 String value of the array is inserted - * into the field of CHARACTER type, etc. - * @param streamLength Is optional. It is used only if in values - * list XCharacterInputStream or XBinaryInputStream - * 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/'). 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 @@ -265,71 +210,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 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 ServiceManager factory. - * @param fileURL The file URL (in form file:///) 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 ServiceManager factory. - * @param fileURL XML file name (in form file:///) 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; ino 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 @@ -61,181 +61,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 @@ -291,116 +116,6 @@ public class NumericalHelper return retValue; } - /** - * 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 @@ -456,55 +171,6 @@ public class NumericalHelper return retValue; } - /** - * 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 @@ -559,142 +225,6 @@ public class NumericalHelper } return retValue; } - - /** - * 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 @@ -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 @@ -63,24 +63,6 @@ public abstract class DataAware { return dataObject; } - /** - * 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 @@ -114,23 +96,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; } - - - - /** - *

Creates a new DOM Document containing minimum - * OpenOffice XML tags.

- * - *

This method uses the subclass - * getOfficeClassAttribute method to get the - * attribute for office:class.

- * - * @param rootName root name of Document. - * - * @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; - } - } -- cgit